/* CultureCut · Hotel Continental Saigon. File này là toàn bộ bài tương tác, nạp bởi đoạn mã dán trong CMS. */ (function () { var host = document.getElementById('zac-continental-three'); if (!host || host.dataset.ccBundle || window.ZAC_EDIT) return; host.dataset.ccBundle = '1'; function run(code) { var s = document.createElement('script'); s.textContent = code; document.head.appendChild(s); s.remove(); } if (!document.getElementById('cc-fonts')) { var l = document.createElement('link'); l.id = 'cc-fonts'; l.rel = 'stylesheet'; l.href = 'https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Unbounded:wght@400;500&display=swap'; document.head.appendChild(l); } /* Khoá bảng màu sáng của bài: báo cho trình duyệt và tiện ích tự làm tối trang đừng đổi màu */ if (!document.querySelector('meta[name="darkreader-lock"]')) { var dl = document.createElement('meta'); dl.name = 'darkreader-lock'; document.head.appendChild(dl); } var st = document.createElement('style'); st.textContent = ".zac__cc{color-scheme:only light}\n.zac.zac__cc{position:relative;clear:both;width:100%;margin:0;color:#f6f0e6;font-family:\"EB Garamond\",\"Noto Serif\",Georgia,serif!important}\n.zac__cc .zac__cc-scroll{position:relative;height:1600vh}\n.zac__cc .zac__cc-sticky{position:sticky;top:0;height:100vh;height:100svh}\n.zac__cc .zac__cc-stage{position:relative;width:100%;height:100%;background:#241510;overflow:hidden}\n.zac__cc .zac__cc-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block;outline:none;touch-action:pan-y;cursor:grab}\n.zac__cc:fullscreen .zac__cc-stage canvas{touch-action:none}\n.zac__cc .cc-kicker{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:500;font-size:13px;letter-spacing:.34em;text-transform:uppercase;color:#a08a5e;margin-bottom:3vh}\n.zac__cc .cc-dash{width:22px;height:1px;background:#a08a5e;margin:2.6vh auto}\n.zac__cc .cc-hint::after{content:\"\";display:block;width:1px;height:34px;background:#d9c7a0;margin:10px auto 0;transform-origin:top;animation:ccdrop 2.2s cubic-bezier(.6,0,.3,1) infinite}\n@keyframes ccdrop{0%{transform:scaleY(0)}55%{transform:scaleY(1)}100%{transform:scaleY(1) translateY(34px) scaleY(0)}}\n.zac__cc .cc-no{display:inline-block;width:26px;height:26px;border-radius:50%;background:#e3b23c;color:#2b1811;font:700 14px/26px -apple-system,\"Segoe UI\",Roboto,Arial,sans-serif;letter-spacing:0;text-align:center;margin-right:12px;vertical-align:middle}\n.zac__cc .cc-step-tag{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:600;font-size:12.5px;letter-spacing:.3em;text-transform:uppercase;color:#a08a5e;margin-bottom:12px}\n.zac__cc .cc-step-h{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:400;font-style:italic;font-size:clamp(31px,2.7vw,39px);line-height:1.08;color:#2b1811;margin-bottom:0}.zac__cc:where(.cc-narrow) .cc-step-h{font-size:clamp(31px,calc(2.7 * var(--cw,1vw)),39px)}\n.zac__cc .cc-card .cc-dash{margin:16px 0 14px;background:#a08a5e}\n.zac__cc .cc-cred{margin-top:14px;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:14.5px;color:#8a7b6c}\n.zac__cc .cc-fig-i{aspect-ratio:4/3;overflow:hidden;background:#d8cdbb}\n.zac__cc .cc-fig.cc-tall .cc-fig-i{aspect-ratio:3/4}\n.zac__cc .cc-step .cc-fig .cc-fig-i img{display:block;width:100%!important;height:100%!important;max-width:none!important;object-fit:cover;margin:0!important}\n.zac__cc .cc-fig.cc-bw .cc-fig-i img{filter:grayscale(1) contrast(1.05)}\n.zac__cc [hidden]{display:none!important}\n.zac__cc button{font:inherit;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:17px;border:0;background:none;color:#f6f0e6;padding:6px 1px;cursor:pointer;line-height:1.2;border-radius:0}\n.zac__cc button:disabled{opacity:.45;cursor:default}\n.zac__cc .cc-skip{position:absolute;right:4.5vw;bottom:4vh;border-bottom:1px solid rgba(246,240,230,.6);text-shadow:0 1px 10px rgba(36,21,16,.9);display:none}.zac__cc:where(.cc-narrow) .cc-skip{right:calc(4.5 * var(--cw,1vw))}\n.zac__cc.cc-tour .cc-skip{display:block}\n.zac__cc .zac__cc-bar{position:absolute;left:0;right:0;top:0;display:flex;gap:22px;align-items:center;justify-content:space-between;padding:20px 4.5vw 44px;background:linear-gradient(to bottom,rgba(36,21,16,.55),rgba(36,21,16,0));pointer-events:none}.zac__cc:where(.cc-narrow) .zac__cc-bar{padding:20px calc(4.5 * var(--cw,1vw)) 44px}\n.zac__cc .cc-tools{display:flex;gap:22px;align-items:center;pointer-events:auto}\n.zac__cc .cc-tools button,.zac__cc .cc-snd{border-bottom:1px solid rgba(246,240,230,.5);text-shadow:0 1px 10px rgba(36,21,16,.8)}\n.zac__cc .cc-tools button[aria-pressed=\"true\"],.zac__cc .cc-snd[aria-pressed=\"true\"]{color:#f0d9a6;border-color:#f0d9a6}\n.zac__cc .zac__cc-bar select{font:inherit;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-size:17px;padding:8px 12px;border-radius:0;border:0;background:#f6f0e6;color:#3b2a22;max-width:100%}\n.zac__cc .cc-cut{position:absolute;right:4.5vw;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:stretch;background:#f6f0e6;color:#3b2a22;box-shadow:0 22px 50px rgba(36,21,16,.26);padding:20px 0 12px;min-width:170px}.zac__cc:where(.cc-narrow) .cc-cut{right:calc(4.5 * var(--cw,1vw))}\n.zac__cc .cc-cut-label{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:600;font-size:12px;letter-spacing:.3em;text-transform:uppercase;color:#a08a5e;padding:0 24px 10px}\n.zac__cc .cc-cut button{font-style:normal;font-size:21px;text-align:left;padding:7px 24px;color:#3b2a22}\n.zac__cc .cc-cut button[aria-pressed=\"true\"]{font-style:italic;color:#6e1f1d}\n.zac__cc .cc-cut button[aria-pressed=\"true\"]::after{content:\"\";display:inline-block;width:18px;height:1px;background:#6e1f1d;margin-left:10px;vertical-align:.3em}\n.zac__cc .cc-snd{pointer-events:auto;margin-left:auto}\n.zac__cc .cc-tod{display:inline-flex;align-items:center;gap:9px;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:17px;text-shadow:0 1px 10px rgba(36,21,16,.8)}\n.zac__cc .cc-tod input{width:110px;accent-color:#f6f0e6}\n.zac__cc .cc-tools,.zac__cc .cc-cut{visibility:hidden}\n.zac__cc:not(.cc-live) .cc-tools{display:none}\n.zac__cc.cc-live .cc-tools,.zac__cc.cc-live .cc-cut{visibility:visible}\n.zac__cc .zac__cc-caption{position:absolute;left:4.5vw;bottom:6vh;max-width:min(410px,calc(91vw - 210px));background:#f6f0e6;color:#3b2a22;box-shadow:0 22px 50px rgba(36,21,16,.26);padding:26px 30px 22px;font-size:17.5px;line-height:1.52}.zac__cc:where(.cc-narrow) .zac__cc-caption{left:calc(4.5 * var(--cw,1vw));max-width:min(410px,calc(calc(91 * var(--cw,1vw)) - 210px))}\n.zac__cc .zac__cc-caption b{display:block;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:400;font-style:italic;font-size:32px;line-height:1.1;color:#2b1811;margin-bottom:10px}\n.zac__cc .zac__cc-caption i{display:block;margin-top:12px;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:14px;color:#8a7b6c}\n.zac__cc .cc-legend{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:12px;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-size:15px}\n.zac__cc .cc-key{display:inline-flex;align-items:center;gap:6px}\n.zac__cc .cc-dot{width:10px;height:10px;display:inline-block;border:1px solid rgba(59,42,34,.4)}\n.zac__cc .zac__cc-message{position:absolute;left:50%;top:84px;transform:translateX(-50%);background:#f6f0e6;color:#3b2a22;padding:8px 16px;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:16px;max-width:90%}\n.zac__cc .cc-retry{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}\n.zac__cc .cc-start{background:#f6f0e6;color:#3b2a22;padding:14px 26px}\n#zac-continental-three.zac-sleep .zac__cc-scroll{height:auto}\n#zac-continental-three.zac-sleep .zac__cc-sticky{position:relative;height:60vh}\n#zac-continental-three.zac-sleep .zac__cc-bar,#zac-continental-three.zac-sleep .cc-cut,#zac-continental-three.zac-sleep .zac__cc-message{display:none}\n.zac__cc:fullscreen .zac__cc-scroll{height:100%}\n.zac__cc:fullscreen .cc-photo,.zac__cc:fullscreen .cc-step,.zac__cc:fullscreen .cc-hero,.zac__cc:fullscreen .cc-blade,.zac__cc:fullscreen .cc-skip{display:none!important}\n@media (prefers-reduced-motion:reduce){.zac__cc .cc-card,.zac__cc .cc-fig,.zac__cc .cc-big,.zac__cc .cc-hero{transition-duration:.01s}.zac__cc .cc-hint::after{animation:none}}\n@media (max-width:760px){\n.zac__cc .cc-step-h{font-size:29px}\n.zac__cc .cc-card .cc-dash{margin:12px 0 10px}\n.zac__cc .zac__cc-bar{padding:14px 14px 34px;gap:10px}\n.zac__cc .cc-tools{gap:14px}\n.zac__cc.cc-live .cc-tools{width:100%;flex-wrap:wrap}\n.zac__cc.cc-live .cc-snd{display:none}\n.zac__cc .cc-tod input{width:84px}\n.zac__cc .zac__cc-bar select{flex:1 1 100%;min-width:0}\n.zac__cc .cc-tools button[data-action=\"fullscreen\"]{display:none}\n.zac__cc .cc-skip{left:auto;right:14px;top:12px;bottom:auto;font-size:16px}\n.zac__cc .cc-cut{left:0;right:0;top:auto;bottom:0;transform:none;flex-direction:row;min-width:0;padding:0;box-shadow:0 -10px 30px rgba(36,21,16,.22)}\n.zac__cc .cc-cut-label{display:none}\n.zac__cc .cc-cut button{flex:1 1 auto;text-align:center;font-size:17px;padding:15px 3px 16px;white-space:nowrap}\n.zac__cc .cc-cut button[aria-pressed=\"true\"]::after{display:none}\n.zac__cc .cc-cut button[aria-pressed=\"true\"]{box-shadow:0 2px 0 #6e1f1d inset}\n.zac__cc .zac__cc-caption{left:0;right:0;bottom:54px;max-width:none;padding:18px 22px 16px;font-size:16.5px;line-height:1.45}\n.zac__cc .zac__cc-caption b{font-size:26px;margin-bottom:6px}\n.zac__cc .cc-legend{font-size:14px;gap:3px 12px;margin-top:8px}\n}.zac__cc:where(.cc-narrow) .cc-step-h{font-size:29px}.zac__cc:where(.cc-narrow) .cc-card .cc-dash{margin:12px 0 10px}.zac__cc:where(.cc-narrow) .zac__cc-bar{padding:14px 14px 34px;gap:10px}.zac__cc:where(.cc-narrow) .cc-tools{gap:14px}.zac__cc:where(.cc-narrow).cc-live .cc-tools{width:100%;flex-wrap:wrap}.zac__cc:where(.cc-narrow).cc-live .cc-snd{display:none}.zac__cc:where(.cc-narrow) .cc-tod input{width:84px}.zac__cc:where(.cc-narrow) .zac__cc-bar select{flex:1 1 100%;min-width:0}.zac__cc:where(.cc-narrow) .cc-tools button[data-action=\"fullscreen\"]{display:none}.zac__cc:where(.cc-narrow) .cc-skip{left:auto;right:14px;top:12px;bottom:auto;font-size:16px}.zac__cc:where(.cc-narrow) .cc-cut{left:0;right:0;top:auto;bottom:0;transform:none;flex-direction:row;min-width:0;padding:0;box-shadow:0 -10px 30px rgba(36,21,16,.22)}.zac__cc:where(.cc-narrow) .cc-cut-label{display:none}.zac__cc:where(.cc-narrow) .cc-cut button{flex:1 1 auto;text-align:center;font-size:17px;padding:15px 3px 16px;white-space:nowrap}.zac__cc:where(.cc-narrow) .cc-cut button[aria-pressed=\"true\"]::after{display:none}.zac__cc:where(.cc-narrow) .cc-cut button[aria-pressed=\"true\"]{box-shadow:0 2px 0 #6e1f1d inset}.zac__cc:where(.cc-narrow) .zac__cc-caption{left:0;right:0;bottom:54px;max-width:none;padding:18px 22px 16px;font-size:16.5px;line-height:1.45}.zac__cc:where(.cc-narrow) .zac__cc-caption b{font-size:26px;margin-bottom:6px}.zac__cc:where(.cc-narrow) .cc-legend{font-size:14px;gap:3px 12px;margin-top:8px}\n\n.zac__cc img{background:none!important;background-color:transparent!important}\n.zac__cc .cc-photo{position:absolute!important;max-width:none!important;pointer-events:none;margin:0!important;will-change:transform,opacity}\n.zac__cc .cc-paper{position:absolute;inset:0;background:#f1ece2;pointer-events:none}\n.zac__cc .cc-frame{position:absolute;box-sizing:border-box;outline:9px solid #fff;box-shadow:0 0 0 10px rgba(43,24,17,.08),0 26px 60px rgba(43,24,17,.28);pointer-events:none;will-change:transform,opacity}\n.zac__cc .cc-flow{position:absolute;inset:0;pointer-events:none;z-index:2}\n.zac__cc .cc-step.cc-mid .cc-dash{margin-left:auto;margin-right:auto}\n@media (max-width:760px){\n}\n.zac__cc.cc-onpaper .cc-skip{color:#2b1811;text-shadow:none;border-color:rgba(43,24,17,.5)}\n.zac__cc.cc-onpaper .zac__cc-bar{background:none}\n#zac-continental-three.zac-sleep .cc-flow,#zac-continental-three.zac-sleep .cc-paper,#zac-continental-three.zac-sleep .cc-frame{display:none}\n.zac__cc:fullscreen .cc-flow,.zac__cc:fullscreen .cc-paper,.zac__cc:fullscreen .cc-frame{display:none!important}\n.zac__cc .cc-section{background:#f6f0e6;color:#3b2a22;padding:9vh 6vw 10vh}.zac__cc:where(.cc-narrow) .cc-section{padding:9vh calc(6 * var(--cw,1vw)) 10vh}\n.zac__cc .cc-section .cc-kicker{color:#a08a5e;margin-bottom:14px}\n.zac__cc .cc-sec-title{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:300;font-style:italic;color:#6e1f1d;font-size:clamp(36px,4.6vw,72px);line-height:1.04;max-width:760px}.zac__cc:where(.cc-narrow) .cc-sec-title{font-size:clamp(36px,calc(4.6 * var(--cw,1vw)),72px)}\n.zac__cc .cc-sec-body{display:flex;gap:4vw;align-items:flex-start;margin-top:5vh;max-width:1400px}.zac__cc:where(.cc-narrow) .cc-sec-body{gap:calc(4 * var(--cw,1vw))}\n.zac__cc .cc-sec-fig{flex:1 1 0;min-width:0}\n.zac__cc .cc-sec-fig svg{display:block;width:100%;height:auto;overflow:visible}\n.zac__cc .cc-sec-note{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:15px;color:#8a7b6c;margin-top:14px}\n.zac__cc .cc-z{cursor:pointer;outline:none}\n.zac__cc .cc-z rect,.zac__cc .cc-z>path:not(.cc-ln){fill:#d9c7a0;fill-opacity:.42;stroke:none;transition:fill .3s,fill-opacity .3s}\n.zac__cc .cc-z rect.cc-air{fill-opacity:0}\n.zac__cc .cc-z:hover rect,.zac__cc .cc-z:hover>path:not(.cc-ln),.zac__cc .cc-z:focus-visible rect{fill-opacity:.7}\n.zac__cc .cc-z.cc-act rect,.zac__cc .cc-z.cc-act>path:not(.cc-ln){fill:#6e1f1d;fill-opacity:.55}\n.zac__cc .cc-z.cc-act rect.cc-air{fill-opacity:.16}\n.zac__cc .cc-ln{fill:none;stroke:#3b2a22;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}\n.zac__cc .cc-out{fill:none;stroke:#3b2a22;stroke-width:2.2;stroke-linejoin:round;pointer-events:none}\n.zac__cc .cc-ground{stroke:#3b2a22;stroke-width:1.4}\n.zac__cc .cc-n{fill:#3b2a22;transition:fill .3s}\n.zac__cc .cc-z.cc-act .cc-n{fill:#6e1f1d}\n.zac__cc .cc-nt{fill:#fff;font:700 12px -apple-system,\"Segoe UI\",Roboto,sans-serif;text-anchor:middle;pointer-events:none}\n.zac__cc .cc-fl{font:600 12px -apple-system,\"Segoe UI\",Roboto,sans-serif;fill:#7a6c58}\n.zac__cc .cc-st{font:italic 15px \"EB Garamond\",\"Noto Serif\",Georgia,serif;fill:#5a4c3a}\n.zac__cc .cc-sec-side{flex:0 0 300px}\n.zac__cc .cc-sec-lab{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:600;font-size:12.5px;letter-spacing:.3em;text-transform:uppercase;color:#7a6c58;margin-bottom:6px}\n.zac__cc .cc-section .cc-zb{display:flex;align-items:center;gap:12px;width:100%;text-align:left;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:normal;font-size:21px;letter-spacing:0;color:#3b2a22;padding:11px 0;border-bottom:1px solid rgba(28,21,16,.16)}\n.zac__cc .cc-zn{flex:none;width:24px;height:24px;border-radius:50%;background:#3b2a22;color:#fff;font:700 12px/24px -apple-system,\"Segoe UI\",Roboto,sans-serif;text-align:center}\n.zac__cc .cc-section .cc-zb[aria-pressed=\"true\"]{color:#6e1f1d;font-style:italic}\n.zac__cc .cc-zb[aria-pressed=\"true\"] .cc-zn{background:#6e1f1d}\n.zac__cc .cc-sec-info{background:#2b1811;color:#f6f0e6;padding:16px 18px;margin-top:18px;font-size:17px;line-height:1.5;min-height:118px}\n.zac__cc .cc-sec-info b{display:block;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:400;font-style:italic;font-size:28px;margin-bottom:6px;color:#f0d9a6}\n#zac-continental-three.zac-sleep .cc-section{display:none}\n.zac__cc:fullscreen .cc-section{display:none}\n@media (max-width:900px){.zac__cc .cc-section{padding:7vh 18px 8vh}.zac__cc .cc-sec-body{flex-direction:column;gap:22px}.zac__cc .cc-sec-side{flex:none;width:100%}.zac__cc .cc-sec-info{min-height:0}.zac__cc .cc-fl{font-size:15px}.zac__cc .cc-st{font-size:17px}}.zac__cc:where(.cc-narrow) .cc-section{padding:7vh 18px 8vh}.zac__cc:where(.cc-narrow) .cc-sec-body{flex-direction:column;gap:22px}.zac__cc:where(.cc-narrow) .cc-sec-side{flex:none;width:100%}.zac__cc:where(.cc-narrow) .cc-sec-info{min-height:0}.zac__cc:where(.cc-narrow) .cc-fl{font-size:15px}.zac__cc:where(.cc-narrow) .cc-st{font-size:17px}\n.zac__cc.cc-clay .cc-legend{display:none}\n.zac__cc:not(.cc-live) .zac__cc-bar{background:none}\n.zac__cc .cc-section{display:none}\n\n.zac__cc .cc-tools{margin-left:auto}\n.zac__cc .cc-hero{position:absolute;left:0;right:0;top:0;height:100vh;height:100svh;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;text-align:left;padding:0 6vw 12vh;box-sizing:border-box}.zac__cc:where(.cc-narrow) .cc-hero{padding:0 calc(6 * var(--cw,1vw)) 12vh}\n.zac__cc .cc-hero .cc-kicker{color:#f0d9a6;margin-bottom:2.2vh;text-shadow:0 1px 12px rgba(36,21,16,.7)}\n.zac__cc .cc-title{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:300;font-style:italic;font-size:clamp(46px,7.4vw,124px);line-height:.98;letter-spacing:-.01em;color:#f6f0e6;text-shadow:0 2px 26px rgba(36,21,16,.8),0 1px 3px rgba(36,21,16,.5)}.zac__cc:where(.cc-narrow) .cc-title{font-size:clamp(46px,calc(7.4 * var(--cw,1vw)),124px)}\n.zac__cc .cc-hint{position:absolute;right:6vw;bottom:5vh;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:16px;color:#f6f0e6;text-align:center}.zac__cc:where(.cc-narrow) .cc-hint{right:calc(6 * var(--cw,1vw))}\n.zac__cc .cc-hint::after{background:#f6f0e6!important}\n.zac__cc .cc-fig-c{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:14.5px;line-height:1.3;color:#6b5d50;text-align:center;padding:9px 6px 11px}\n@media (max-width:760px){\n.zac__cc .cc-hero{padding:0 22px 14vh}\n.zac__cc .cc-title{font-size:10.4vw}\n.zac__cc .cc-hint{right:22px}\n.zac__cc .cc-fig-c{font-size:13px;padding:7px 4px 9px}\n}.zac__cc:where(.cc-narrow) .cc-hero{padding:0 22px 14vh}.zac__cc:where(.cc-narrow) .cc-title{font-size:calc(10.4 * var(--cw,1vw))}.zac__cc:where(.cc-narrow) .cc-hint{right:22px}.zac__cc:where(.cc-narrow) .cc-fig-c{font-size:13px;padding:7px 4px 9px}\n.zac__cc:not(.cc-live) .cc-skip{color:#2b1811;text-shadow:0 0 8px rgba(246,240,230,.9),0 0 2px rgba(246,240,230,.9);border-color:rgba(43,24,17,.5)}\n.zac__cc .cc-step{position:absolute;left:4.5vw;width:min(480px,40vw);transform:translateY(-50%);display:grid;grid-template-columns:1fr 1fr;gap:10px}.zac__cc:where(.cc-narrow) .cc-step{left:calc(4.5 * var(--cw,1vw));width:min(480px,calc(40 * var(--cw,1vw)))}\n.zac__cc .cc-step>*{grid-column:span 2}\n.zac__cc .cc-step>.cc-fig:has(+ .cc-fig-b),.zac__cc .cc-step>.cc-fig-b{grid-column:span 1}\n.zac__cc .cc-step.cc-mid{left:50%;width:min(430px,88vw);display:block;transform:translate(-50%,-50%);text-align:center}.zac__cc:where(.cc-narrow) .cc-step.cc-mid{width:min(430px,calc(88 * var(--cw,1vw)))}\n.zac__cc .cc-card{box-sizing:border-box;background:#f6f0e6;color:#3b2a22;padding:28px 32px 24px;font-size:18.5px;line-height:1.56;box-shadow:0 22px 50px rgba(36,21,16,.24)}\n.zac__cc .cc-mid .cc-card{padding:26px 30px 22px}\n.zac__cc .cc-fig{box-sizing:border-box;background:#f6f0e6;padding:8px 8px 0;box-shadow:0 22px 50px rgba(36,21,16,.28)}\n.zac__cc .cc-step>.cc-fig:not(.cc-fig-b):not(:has(+ .cc-fig-b)) .cc-fig-i{aspect-ratio:16/10}\n@media (max-width:760px){\n.zac__cc .cc-step{left:6vw;width:88vw;gap:8px}\n.zac__cc .cc-step.cc-mid{left:50%}\n.zac__cc .cc-card,.zac__cc .cc-mid .cc-card{padding:22px 22px 20px;font-size:17px;line-height:1.5}\n.zac__cc .cc-fig{padding:6px 6px 0}\n}.zac__cc:where(.cc-narrow) .cc-step{left:calc(6 * var(--cw,1vw));width:calc(88 * var(--cw,1vw));gap:8px}.zac__cc:where(.cc-narrow) .cc-step.cc-mid{left:50%}.zac__cc:where(.cc-narrow) .cc-card,.zac__cc:where(.cc-narrow) .cc-mid .cc-card{padding:22px 22px 20px;font-size:17px;line-height:1.5}.zac__cc:where(.cc-narrow) .cc-fig{padding:6px 6px 0}\n.zac__cc .cc-step .cc-fig{pointer-events:auto;cursor:zoom-in}\n.zac__cc .cc-lb{position:fixed;inset:0;z-index:99999;background:rgba(36,21,16,.93);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px;box-sizing:border-box;cursor:zoom-out}\n.zac__cc .cc-lb img{display:block;max-width:min(94vw,1100px)!important;max-height:78vh!important;width:auto!important;height:auto!important;border:8px solid #f6f0e6;box-sizing:border-box}.zac__cc:where(.cc-narrow) .cc-lb img{max-width:min(calc(94 * var(--cw,1vw)),1100px)!important}\n.zac__cc .cc-lb.cc-bw img{filter:grayscale(1) contrast(1.05)}\n.zac__cc .cc-lb-c{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-size:17px;color:#f6f0e6;margin-top:14px;text-align:center}\n@media (max-width:760px){\n.zac__cc .cc-step:not(.cc-mid){grid-template-columns:repeat(4,1fr);gap:6px;left:4vw;width:92vw}\n.zac__cc .cc-step:not(.cc-mid)>.cc-card{grid-column:span 4;padding:16px 18px 15px;font-size:15.5px;line-height:1.45}\n.zac__cc .cc-step:not(.cc-mid)>.cc-fig,.zac__cc .cc-step:not(.cc-mid)>.cc-fig:has(+ .cc-fig-b),.zac__cc .cc-step:not(.cc-mid)>.cc-fig-b{grid-column:span 1;padding:4px;position:relative}\n.zac__cc .cc-step:not(.cc-mid)>.cc-fig .cc-fig-i{aspect-ratio:1/1!important}\n.zac__cc .cc-step:not(.cc-mid) .cc-fig-c,.zac__cc .cc-step:not(.cc-mid) .cc-cred{display:none}\n.zac__cc .cc-step:not(.cc-mid)>.cc-fig::after{content:\"+\";position:absolute;right:4px;bottom:4px;width:18px;height:18px;background:#f6f0e6;color:#2b1811;font:600 15px/17px Arial,sans-serif;text-align:center}\n.zac__cc .cc-step:not(.cc-mid) .cc-step-h{font-size:24px}\n.zac__cc .cc-step:not(.cc-mid) .cc-step-tag{margin-bottom:8px;font-size:11.5px}\n.zac__cc .cc-step:not(.cc-mid) .cc-card .cc-dash{margin:9px 0 8px}\n}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid){grid-template-columns:repeat(4,1fr);gap:6px;left:calc(4 * var(--cw,1vw));width:calc(92 * var(--cw,1vw))}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-card{grid-column:span 4;padding:16px 18px 15px;font-size:15.5px;line-height:1.45}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-fig,.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-fig:has(+ .cc-fig-b),.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-fig-b{grid-column:span 1;padding:4px;position:relative}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-fig .cc-fig-i{aspect-ratio:1/1!important}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid) .cc-fig-c,.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid) .cc-cred{display:none}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-fig::after{content:\"+\";position:absolute;right:4px;bottom:4px;width:18px;height:18px;background:#f6f0e6;color:#2b1811;font:600 15px/17px Arial,sans-serif;text-align:center}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid) .cc-step-h{font-size:24px}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid) .cc-step-tag{margin-bottom:8px;font-size:11.5px}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid) .cc-card .cc-dash{margin:9px 0 8px}\n.zac__cc .cc-scrim{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;background:linear-gradient(to top,rgba(36,21,16,.86),rgba(36,21,16,.5) 34%,rgba(36,21,16,.12) 62%,rgba(36,21,16,0) 82%)}\n#zac-continental-three.zac-sleep .cc-scrim,.zac__cc:fullscreen .cc-scrim{display:none}\n.zac__cc .cc-caps{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:500;font-size:clamp(11px,.95vw,13px);letter-spacing:.36em;text-transform:uppercase;color:rgba(246,240,230,.82);margin-top:5.5vh;text-shadow:0 1px 12px rgba(36,21,16,.8)}.zac__cc:where(.cc-narrow) .cc-caps{font-size:clamp(11px,calc(.95 * var(--cw,1vw)),13px)}\n.zac__cc .cc-hero .cc-kicker{font-size:clamp(15px,1.55vw,22px);font-weight:600}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker{font-size:clamp(15px,calc(1.55 * var(--cw,1vw)),22px)}@media (min-width:761px){.zac__cc:where(:not(.cc-narrow)) .cc-step{gap:0 2px;width:min(450px,38vw);background:#f6f0e6;box-shadow:0 20px 48px rgba(36,21,16,.22)}.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-card{box-shadow:none;background:none;padding:22px 30px 24px}.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-fig{box-shadow:none;background:none;padding:0}.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-fig .cc-fig-c{text-align:left;font-size:13px;padding:8px 30px 0;color:#8a7a68}.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-fig:has(+ .cc-fig-b) .cc-fig-c{padding-right:8px}.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-fig-b .cc-fig-c{padding-left:12px}.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-fig+.cc-card,.zac__cc:where(:not(.cc-narrow)) .cc-step>.cc-fig-b+.cc-card{padding-top:18px}}\n@media (max-width:760px){.zac__cc .cc-caps{font-size:10px;letter-spacing:.3em;margin-top:3.6vh}.zac__cc .cc-hero .cc-kicker{font-size:15px}}.zac__cc:where(.cc-narrow) .cc-caps{font-size:10px;letter-spacing:.3em;margin-top:3.6vh}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker{font-size:15px}\n\n@keyframes ccup{from{opacity:0}to{opacity:1}}\n.zac__cc.cc-live .cc-tools,.zac__cc.cc-live .cc-cut,.zac__cc.cc-live .zac__cc-caption{animation:ccup .6s ease-out both}\n@media (prefers-reduced-motion:reduce){.zac__cc.cc-live .cc-tools,.zac__cc.cc-live .cc-cut,.zac__cc.cc-live .zac__cc-caption{animation:none}}@media (min-width:761px){.zac__cc:where(:not(.cc-narrow)) .zac__cc-message{top:auto;bottom:4.5vh;font-size:14.5px;padding:6px 14px;white-space:nowrap;box-shadow:0 8px 22px rgba(36,21,16,.18)}}\n\n.zac__cc .cc-rail{position:absolute;right:22px;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;gap:13px;pointer-events:none;visibility:hidden}\n.zac__cc .cc-rail.cc-on{visibility:visible}\n.zac__cc .cc-rail>div{width:7px;height:7px;border-radius:50%;box-sizing:border-box;border:1.5px solid rgba(43,24,17,.55);background:rgba(246,240,230,.7)}\n.zac__cc .cc-rail>div.cc-past{background:rgba(43,24,17,.55)}\n.zac__cc .cc-rail>div.cc-cur{width:11px;height:11px;margin:-2px;background:#e3b23c;border-color:#2b1811}\n#zac-continental-three.zac-sleep .cc-rail,.zac__cc:fullscreen .cc-rail,.zac__cc.cc-live .cc-rail{display:none}\n@media (max-width:760px){\n.zac__cc .cc-rail{right:7px;gap:11px}\n.zac__cc .zac__cc-caption{padding:12px 18px 12px;cursor:pointer}\n.zac__cc .zac__cc-caption b{font-size:22px;margin-bottom:0;padding-right:28px;position:relative}\n.zac__cc .zac__cc-caption b::after{content:\"+\";position:absolute;right:0;top:0;font:400 22px/1.1 Arial,sans-serif;color:#a08a5e;font-style:normal}\n.zac__cc .zac__cc-caption.cc-open b::after{content:\"\\2212\"}\n.zac__cc .zac__cc-caption:not(.cc-open)>:not(b){display:none}\n.zac__cc .zac__cc-caption.cc-open b{margin-bottom:6px}\n}.zac__cc:where(.cc-narrow) .cc-rail{right:7px;gap:11px}.zac__cc:where(.cc-narrow) .zac__cc-caption{padding:12px 18px 12px;cursor:pointer}.zac__cc:where(.cc-narrow) .zac__cc-caption b{font-size:22px;margin-bottom:0;padding-right:28px;position:relative}.zac__cc:where(.cc-narrow) .zac__cc-caption b::after{content:\"+\";position:absolute;right:0;top:0;font:400 22px/1.1 Arial,sans-serif;color:#a08a5e;font-style:normal}.zac__cc:where(.cc-narrow) .zac__cc-caption.cc-open b::after{content:\"\\2212\"}.zac__cc:where(.cc-narrow) .zac__cc-caption:not(.cc-open)>:not(b){display:none}.zac__cc:where(.cc-narrow) .zac__cc-caption.cc-open b{margin-bottom:6px}\n\n.zac__cc .cc-tl{display:block!important;white-space:nowrap;margin:0;padding:0}\n\n.zac__cc .zac__cc-bar{top:var(--cc-top,0px)}@media (min-width:761px){.zac__cc:where(:not(.cc-narrow)) .zac__cc-bar{padding-top:24px}.zac__cc:where(:not(.cc-narrow)) .zac__cc-bar select{font-size:21px;padding:11px 16px}.zac__cc:where(:not(.cc-narrow)) .cc-tools{gap:30px}.zac__cc:where(:not(.cc-narrow)) .cc-tools button,.zac__cc:where(:not(.cc-narrow)) .cc-tools label,.zac__cc:where(:not(.cc-narrow)) .cc-tod{font-size:20px!important}.zac__cc:where(:not(.cc-narrow)) .cc-tod input{width:120px}}\n@media (max-width:760px){.zac__cc .zac__cc-message{top:calc(84px + var(--cc-top,0px))}.zac__cc .zac__cc-bar select{font-size:18px;padding:10px 12px}.zac__cc .cc-tools button,.zac__cc .cc-tools label,.zac__cc .cc-tod{font-size:17px!important}}.zac__cc:where(.cc-narrow) .zac__cc-message{top:calc(84px + var(--cc-top,0px))}.zac__cc:where(.cc-narrow) .zac__cc-bar select{font-size:18px;padding:10px 12px}.zac__cc:where(.cc-narrow) .cc-tools button,.zac__cc:where(.cc-narrow) .cc-tools label,.zac__cc:where(.cc-narrow) .cc-tod{font-size:17px!important}\n@media (max-width:760px){.zac__cc .cc-cut{bottom:var(--cc-bot,0px)}.zac__cc .cc-cut::after{content:\"\";position:absolute;left:0;right:0;top:100%;height:var(--cc-bot,0px);background:#f6f0e6}.zac__cc .zac__cc-caption{bottom:calc(54px + var(--cc-bot,0px))}}.zac__cc:where(.cc-narrow) .cc-cut{bottom:var(--cc-bot,0px)}.zac__cc:where(.cc-narrow) .cc-cut::after{content:\"\";position:absolute;left:0;right:0;top:100%;height:var(--cc-bot,0px);background:#f6f0e6}.zac__cc:where(.cc-narrow) .zac__cc-caption{bottom:calc(54px + var(--cc-bot,0px))}\n.zac__cc .cc-hero{padding-bottom:calc(12vh + var(--cc-bot,0px))}\n@media (max-width:760px){.zac__cc .cc-hero{padding-bottom:calc(14vh + var(--cc-bot,0px))}}.zac__cc:where(.cc-narrow) .cc-hero{padding-bottom:calc(14vh + var(--cc-bot,0px))}\n@media (prefers-reduced-motion:no-preference){\n.zac__cc .cc-hero .cc-kicker,.zac__cc .cc-hero .cc-tl,.zac__cc .cc-hero .cc-caps{animation:ccTitleIn 1.3s cubic-bezier(.2,.6,.2,1) both}\n.zac__cc .cc-old,.zac__cc .cc-oldl{animation:ccPush 16s cubic-bezier(.16,.6,.3,1) both}\n.zac__cc .cc-oldl{--ps:1.032}\n.zac__cc .cc-oldl+.cc-oldl{--ps:1.055}\n.zac__cc .cc-hero .cc-kicker{animation-delay:.5s}\n.zac__cc .cc-hero .cc-tl:nth-child(1){animation-delay:1s}\n.zac__cc .cc-hero .cc-tl:nth-child(2){animation-delay:1.45s}\n.zac__cc .cc-hero .cc-tl:nth-child(3){animation-delay:1.9s}\n.zac__cc .cc-hero .cc-caps{animation-delay:2.7s}\n}\n@keyframes ccPush{from{scale:1}to{scale:var(--ps,1.02)}}\n@keyframes ccTitleIn{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}\n\n\n.zac__cc .cc-how{position:absolute;left:50%;top:calc(18px + var(--cc-top,0px));transform:translateX(-50%);background:#f6f0e6;color:#2b1811;padding:9px 20px 10px;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-weight:500;font-size:19px;line-height:1.2;white-space:nowrap;box-shadow:0 10px 26px rgba(36,21,16,.22);pointer-events:none;display:none}\n.zac__cc .cc-how b{font-style:normal;font-weight:600;color:#6e1f1d}\n.zac__cc .cc-how u{text-decoration:none;display:inline-block;width:1px;height:14px;background:rgba(43,24,17,.35);margin:0 14px;vertical-align:-1px}\n.zac__cc.cc-live .cc-how{display:block}\n#zac-continental-three.zac-sleep .cc-how{display:none}@media (min-width:761px){.zac__cc:where(:not(.cc-narrow)) .zac__cc-bar{top:auto;bottom:var(--cc-bot,0px);justify-content:flex-end;padding:70px 4.5vw 4.5vh;background:linear-gradient(to top,rgba(36,21,16,.5),rgba(36,21,16,0))}.zac__cc:where(:not(.cc-narrow)) .cc-tools{display:grid;grid-template-columns:auto auto auto auto;justify-content:end;align-items:center;gap:14px 28px}.zac__cc:where(:not(.cc-narrow)) .zac__cc-bar select{grid-column:1/-1;width:100%;box-sizing:border-box}.zac__cc:where(:not(.cc-narrow)) .zac__cc-message{top:calc(70px + var(--cc-top,0px));bottom:auto}.zac__cc:where(:not(.cc-narrow)) .cc-cut{top:44%}}@media (min-width:761px) and (max-width:1240px){.zac__cc:where(:not(.cc-narrow)) .zac__cc-caption{bottom:calc(4.5vh + 150px + var(--cc-bot,0px))}}\n@media (max-width:760px){.zac__cc .cc-how{top:calc(108px + var(--cc-top,0px));font-size:15.5px;padding:6px 13px 7px}.zac__cc .cc-how u{margin:0 9px}.zac__cc .zac__cc-message{top:calc(150px + var(--cc-top,0px))}}.zac__cc:where(.cc-narrow) .cc-how{top:calc(108px + var(--cc-top,0px));font-size:15.5px;padding:6px 13px 7px}.zac__cc:where(.cc-narrow) .cc-how u{margin:0 9px}.zac__cc:where(.cc-narrow) .zac__cc-message{top:calc(150px + var(--cc-top,0px))}\n\n.zac__cc .cc-how.cc-nudge{background:#2b1811;color:#f6f0e6}\n.zac__cc .cc-how.cc-nudge b{color:#f0d9a6}\n.zac__cc .cc-how.cc-nudge u{background:rgba(246,240,230,.45)}\n\n@media (max-width:760px){.zac__cc .cc-rail{display:none}}.zac__cc:where(.cc-narrow) .cc-rail{display:none}\n@media (max-width:760px){\n.zac__cc .cc-step:not(.cc-mid){display:block;left:4vw;width:92vw;transform:translateY(-100%);background:#f6f0e6;box-shadow:0 18px 44px rgba(36,21,16,.26)}\n.zac__cc .cc-step:not(.cc-mid)>.cc-card{background:none;box-shadow:none;padding:14px 18px 15px}\n.zac__cc .cc-strip{display:flex;gap:3px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch;pointer-events:auto;overscroll-behavior-x:contain}\n.zac__cc .cc-strip::-webkit-scrollbar{display:none}\n.zac__cc .cc-strip.cc-one{display:block;overflow:visible;scroll-snap-type:none}\n.zac__cc .cc-strip .cc-fig{flex:0 0 100%;scroll-snap-align:start;position:relative;padding:0;background:none;box-shadow:none;cursor:zoom-in}\n.zac__cc .cc-strip .cc-fig:not(:only-child){flex-basis:86%}\n.zac__cc .cc-strip .cc-fig:last-child:not(:only-child){scroll-snap-align:end}\n.zac__cc .cc-strip .cc-fig .cc-fig-i{aspect-ratio:9/4!important}\n.zac__cc .cc-strip .cc-fig-c{display:none}\n.zac__cc .cc-strip .cc-fig[data-era]::before{content:attr(data-era);position:absolute;left:0;top:0;z-index:1;background:#f6f0e6;color:#6e1f1d;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:600;font-size:11.5px;line-height:1;letter-spacing:.24em;text-transform:uppercase;padding:7px 9px 6px 11px}\n}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid){display:block;left:calc(4 * var(--cw,1vw));width:calc(92 * var(--cw,1vw));transform:translateY(-100%);background:#f6f0e6;box-shadow:0 18px 44px rgba(36,21,16,.26)}.zac__cc:where(.cc-narrow) .cc-step:not(.cc-mid)>.cc-card{background:none;box-shadow:none;padding:14px 18px 15px}.zac__cc:where(.cc-narrow) .cc-strip{display:flex;gap:3px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch;pointer-events:auto;overscroll-behavior-x:contain}.zac__cc:where(.cc-narrow) .cc-strip::-webkit-scrollbar{display:none}.zac__cc:where(.cc-narrow) .cc-strip.cc-one{display:block;overflow:visible;scroll-snap-type:none}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig{flex:0 0 100%;scroll-snap-align:start;position:relative;padding:0;background:none;box-shadow:none;cursor:zoom-in}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig:not(:only-child){flex-basis:86%}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig:last-child:not(:only-child){scroll-snap-align:end}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig .cc-fig-i{aspect-ratio:9/4!important}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig-c{display:none}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-era]::before{content:attr(data-era);position:absolute;left:0;top:0;z-index:1;background:#f6f0e6;color:#6e1f1d;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:600;font-size:11.5px;line-height:1;letter-spacing:.24em;text-transform:uppercase;padding:7px 9px 6px 11px}\n.zac__cc .cc-step .cc-fig[data-era]{position:relative}\n.zac__cc .cc-step .cc-fig[data-era]::before{content:attr(data-era);position:absolute;left:0;top:0;z-index:1;background:#f6f0e6;color:#6e1f1d;font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-weight:600;font-size:11.5px;line-height:1;letter-spacing:.24em;text-transform:uppercase;padding:7px 9px 6px 11px}\n@media (max-width:760px){.zac__cc .cc-title{font-size:12.6vw;line-height:1}.zac__cc .cc-hero .cc-kicker{font-size:4.7vw;letter-spacing:.32em;margin-bottom:1.8vh}.zac__cc .cc-caps{font-size:3.05vw;letter-spacing:.3em;margin-top:3.2vh}.zac__cc .cc-hint{font-size:4.1vw}}.zac__cc:where(.cc-narrow) .cc-title{font-size:calc(12.6 * var(--cw,1vw));line-height:1}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker{font-size:calc(4.7 * var(--cw,1vw));letter-spacing:.32em;margin-bottom:1.8vh}.zac__cc:where(.cc-narrow) .cc-caps{font-size:calc(3.05 * var(--cw,1vw));letter-spacing:.3em;margin-top:3.2vh}.zac__cc:where(.cc-narrow) .cc-hint{font-size:calc(4.1 * var(--cw,1vw))}\n\n.zac__cc.cc-live .cc-step{visibility:hidden}\n\n.zac__cc .cc-logo{display:block;width:100%;height:auto;overflow:visible}\n.zac__cc .cc-hero .cc-kicker-logo{width:clamp(158px,15vw,255px);color:#fff;letter-spacing:0;text-shadow:none;filter:drop-shadow(0 1px 10px rgba(36,21,16,.55));margin-bottom:3vh}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker-logo{width:clamp(158px,calc(15 * var(--cw,1vw)),255px)}\n@media (max-width:760px){.zac__cc .cc-hero .cc-kicker-logo{width:39vw;margin-bottom:2.4vh}}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker-logo{width:calc(39 * var(--cw,1vw));margin-bottom:2.4vh}\n.zac__cc .cc-step-p+.cc-step-p{margin-top:.75em}\n\n.zac__cc .cc-step[data-step=\"5\"] .cc-strip .cc-fig .cc-fig-i{aspect-ratio:9/2.7!important}\n\n.zac__cc .cc-fig[data-vid] .cc-fig-i{position:relative}\n.zac__cc .cc-step .cc-fig .cc-fig-i video.cc-vid{position:absolute;left:0;top:0;display:block;width:100%!important;height:100%!important;max-width:none!important;object-fit:cover;margin:0!important;background:none;opacity:0;transition:opacity .4s;pointer-events:none}\n.zac__cc .cc-step .cc-fig .cc-fig-i video.cc-vid.cc-on{opacity:1}\n.zac__cc .cc-strip .cc-fig.cc-playing{transform:translateZ(0)}\n.zac__cc .cc-step.cc-same .cc-fig-b[data-era]::before{display:none}\n.zac__cc .cc-step.cc-same .cc-fig:not(.cc-fig-b){z-index:2}\n.zac__cc .cc-step.cc-same .cc-fig:not(.cc-fig-b)[data-era]::before{left:100%;transform:translateX(-50%)}\n.zac__cc .cc-step[data-step=\"5\"]>.cc-fig .cc-fig-i{aspect-ratio:16/7!important}\n.zac__cc .cc-step[data-step=\"7\"]>.cc-fig .cc-fig-i{aspect-ratio:16/7!important}\n.zac__cc .cc-step .cc-fig.cc-playing{cursor:default}\n.zac__cc .cc-step .cc-card .cc-dash{display:none}\n.zac__cc .cc-step .cc-card .cc-step-h{margin-bottom:14px}\n.zac__cc .cc-step .cc-fig-c{display:none}\n.zac__cc .cc-hero{align-items:center;justify-content:center;text-align:center;padding:0 6vw!important}.zac__cc:where(.cc-narrow) .cc-hero{padding:0 calc(6 * var(--cw,1vw))!important}\n.zac__cc .cc-hero .cc-caps{padding-left:.36em}\n.zac__cc .cc-hint{left:0;right:0!important;bottom:calc(5vh + var(--cc-bot,0px))}\n.zac__cc .cc-step[data-step=\"7\"] .cc-fig .cc-fig-i video.cc-vid{object-position:50% 92%}\n\n.zac__cc .cc-hero .cc-kicker-logo{--lw:clamp(150px,13.5vw,230px);width:auto;box-sizing:content-box;background:#f6f0e6;color:#2b1811;filter:none;padding:calc(var(--lw)*.07) calc(var(--lw)*.09) calc(var(--lw)*.095);box-shadow:0 6px 26px rgba(36,21,16,.35);margin-bottom:3.4vh}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker-logo{--lw:clamp(150px,calc(13.5 * var(--cw,1vw)),230px)}\n.zac__cc .cc-hero .cc-kicker-logo .cc-logo{width:var(--lw)}\n.zac__cc .cc-scrim{background:radial-gradient(ellipse 62% 46% at 50% 50%,rgba(36,21,16,.5),rgba(36,21,16,0) 100%),linear-gradient(to top,rgba(36,21,16,.9),rgba(36,21,16,.6) 34%,rgba(36,21,16,.38) 64%,rgba(36,21,16,.3) 100%)}\n@media (max-width:760px){.zac__cc .cc-hero .cc-kicker-logo{--lw:36vw;width:auto;margin-bottom:3vh}.zac__cc .cc-title{font-size:11.4vw;line-height:1.02}}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker-logo{--lw:calc(36 * var(--cw,1vw));width:auto;margin-bottom:3vh}.zac__cc:where(.cc-narrow) .cc-title{font-size:calc(11.4 * var(--cw,1vw));line-height:1.02}\n@media (max-width:760px){.zac__cc .cc-scrim{background:radial-gradient(ellipse 130% 34% at 50% 50%,rgba(36,21,16,.58),rgba(36,21,16,0) 100%),linear-gradient(to top,rgba(36,21,16,.9),rgba(36,21,16,.6) 34%,rgba(36,21,16,.4) 64%,rgba(36,21,16,.32) 100%)}}.zac__cc:where(.cc-narrow) .cc-scrim{background:radial-gradient(ellipse 130% 34% at 50% 50%,rgba(36,21,16,.58),rgba(36,21,16,0) 100%),linear-gradient(to top,rgba(36,21,16,.9),rgba(36,21,16,.6) 34%,rgba(36,21,16,.4) 64%,rgba(36,21,16,.32) 100%)}\n.zac__cc .cc-hero .cc-kicker-logo{--lw:clamp(104px,8.6vw,150px);background:rgba(246,240,230,.9);box-shadow:none;margin-bottom:3vh}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker-logo{--lw:clamp(104px,calc(8.6 * var(--cw,1vw)),150px)}\n@media (max-width:760px){.zac__cc .cc-hero .cc-kicker-logo{--lw:27vw;margin-bottom:2.6vh}}.zac__cc:where(.cc-narrow) .cc-hero .cc-kicker-logo{--lw:calc(27 * var(--cw,1vw));margin-bottom:2.6vh}\n\n@media (max-width:760px){.zac__cc .cc-title{font-size:12.6vw;line-height:1}.zac__cc .cc-tl .cc-tl2{display:block}\n.zac__cc .cc-strip:not(.cc-one){overflow:hidden;scroll-snap-type:none;gap:3px}\n.zac__cc .cc-strip .cc-fig:not(:only-child){flex:1 1 0;min-width:0}\n.zac__cc .cc-strip:not(.cc-one) .cc-fig .cc-fig-i{aspect-ratio:1/1!important}\n.zac__cc .cc-step.cc-same .cc-strip .cc-fig:not(.cc-fig-b)[data-era]::before{left:100%;transform:translateX(-50%)}}.zac__cc:where(.cc-narrow) .cc-title{font-size:calc(12.6 * var(--cw,1vw));line-height:1}.zac__cc:where(.cc-narrow) .cc-tl .cc-tl2{display:block}.zac__cc:where(.cc-narrow) .cc-strip:not(.cc-one){overflow:hidden;scroll-snap-type:none;gap:3px}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig:not(:only-child){flex:1 1 0;min-width:0}.zac__cc:where(.cc-narrow) .cc-strip:not(.cc-one) .cc-fig .cc-fig-i{aspect-ratio:1/1!important}.zac__cc:where(.cc-narrow) .cc-step.cc-same .cc-strip .cc-fig:not(.cc-fig-b)[data-era]::before{left:100%;transform:translateX(-50%)}\n@media (max-width:760px){.zac__cc .cc-strip .cc-fig[data-vid=\"tram3_phong\"] .cc-fig-i img,.zac__cc .cc-strip .cc-fig[data-vid=\"tram3_phong\"] .cc-fig-i video.cc-vid{object-position:12% 50%!important}\n.zac__cc .cc-strip .cc-fig[data-vid=\"tram3_hanh-lang\"] .cc-fig-i img,.zac__cc .cc-strip .cc-fig[data-vid=\"tram3_hanh-lang\"] .cc-fig-i video.cc-vid{object-position:90% 50%!important}\n.zac__cc .cc-strip .cc-fig[data-vid=\"tram5_nha-hat\"] .cc-fig-i img,.zac__cc .cc-strip .cc-fig[data-vid=\"tram5_nha-hat\"] .cc-fig-i video.cc-vid{object-position:88% 50%!important}\n.zac__cc .cc-step[data-step=\"5\"] .cc-strip .cc-fig .cc-fig-i{aspect-ratio:9/3.9!important}}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-vid=\"tram3_phong\"] .cc-fig-i img,.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-vid=\"tram3_phong\"] .cc-fig-i video.cc-vid{object-position:12% 50%!important}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-vid=\"tram3_hanh-lang\"] .cc-fig-i img,.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-vid=\"tram3_hanh-lang\"] .cc-fig-i video.cc-vid{object-position:90% 50%!important}.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-vid=\"tram5_nha-hat\"] .cc-fig-i img,.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-vid=\"tram5_nha-hat\"] .cc-fig-i video.cc-vid{object-position:88% 50%!important}.zac__cc:where(.cc-narrow) .cc-step[data-step=\"5\"] .cc-strip .cc-fig .cc-fig-i{aspect-ratio:9/3.9!important}\n.zac__cc .cc-step .cc-fig[data-era]::before,.zac__cc .cc-strip .cc-fig[data-era]::before{background:none;color:#fff;text-transform:none;font-style:italic;font-weight:500;font-size:17px;letter-spacing:.01em;top:auto;bottom:0;padding:0 0 8px 11px;text-shadow:0 1px 8px rgba(36,21,16,.85),0 0 2px rgba(36,21,16,.5);pointer-events:none}\n.zac__cc .cc-step.cc-same .cc-fig:not(.cc-fig-b)[data-era]::before,.zac__cc .cc-step.cc-same .cc-strip .cc-fig:not(.cc-fig-b)[data-era]::before{left:0;transform:none}\n@media (max-width:760px){.zac__cc .cc-step .cc-fig[data-era]::before,.zac__cc .cc-strip .cc-fig[data-era]::before{font-size:16px;padding:0 0 6px 9px}}.zac__cc:where(.cc-narrow) .cc-step .cc-fig[data-era]::before,.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-era]::before{font-size:16px;padding:0 0 6px 9px}\n\n.zac__cc .cc-hero .cc-by{font-family:\"Cormorant Garamond\",\"Cormorant\",Georgia,\"Times New Roman\",serif;font-style:italic;font-weight:500;font-size:clamp(15px,1.25vw,19px);letter-spacing:.02em;color:rgba(246,240,230,.9);margin-top:1.6vh;text-shadow:0 1px 12px rgba(36,21,16,.8);animation:ccTitleIn 1.3s cubic-bezier(.2,.6,.2,1) both;animation-delay:3s}.zac__cc:where(.cc-narrow) .cc-hero .cc-by{font-size:clamp(15px,calc(1.25 * var(--cw,1vw)),19px)}\n@media (max-width:760px){.zac__cc .cc-hero .cc-by{font-size:4.1vw;margin-top:1.4vh}}.zac__cc:where(.cc-narrow) .cc-hero .cc-by{font-size:calc(4.1 * var(--cw,1vw));margin-top:1.4vh}\n\n.zac__cc .cc-hero .cc-by{font-family:\"Unbounded\",\"Inter Tight\",Arial,sans-serif;font-style:normal;font-weight:500;font-size:clamp(10.5px,.86vw,13px);letter-spacing:.06em;margin-top:4.2vh;color:rgba(246,240,230,.92)}.zac__cc:where(.cc-narrow) .cc-hero .cc-by{font-size:clamp(10.5px,calc(.86 * var(--cw,1vw)),13px)}\n@media (max-width:760px){.zac__cc .cc-hero .cc-by{font-size:2.9vw;margin-top:3.4vh}}.zac__cc:where(.cc-narrow) .cc-hero .cc-by{font-size:calc(2.9 * var(--cw,1vw));margin-top:3.4vh}\n\n.zac__cc .cc-hero .cc-by{font-size:clamp(8px,.645vw,9.75px)}.zac__cc:where(.cc-narrow) .cc-hero .cc-by{font-size:clamp(8px,calc(.645 * var(--cw,1vw)),9.75px)}\n@media (max-width:760px){.zac__cc .cc-hero .cc-by{font-size:2.18vw}}.zac__cc:where(.cc-narrow) .cc-hero .cc-by{font-size:calc(2.18 * var(--cw,1vw))}\n.zac__cc .cc-hero .cc-caps{width:fit-content;margin-left:auto;margin-right:auto;box-sizing:border-box;border:1px solid rgba(246,240,230,.5);padding:.62em .9em .6em 1.26em;line-height:1}\n.zac__cc .cc-step .cc-fig[data-era]::before,.zac__cc .cc-strip .cc-fig[data-era]::before{font-family:\"Unbounded\",\"Inter Tight\",Arial,sans-serif;font-style:normal;font-weight:500;font-size:11.5px;letter-spacing:.04em;padding:0 0 10px 12px}\n@media (max-width:760px){.zac__cc .cc-step .cc-fig[data-era]::before,.zac__cc .cc-strip .cc-fig[data-era]::before{font-size:10.5px;padding:0 0 8px 9px}}.zac__cc:where(.cc-narrow) .cc-step .cc-fig[data-era]::before,.zac__cc:where(.cc-narrow) .cc-strip .cc-fig[data-era]::before{font-size:10.5px;padding:0 0 8px 9px}\n.zac__cc .cc-step[data-step=\"7\"]>.cc-fig .cc-fig-i{aspect-ratio:5/3!important}\n@media (max-width:760px){.zac__cc .cc-step[data-step=\"7\"] .cc-strip .cc-fig .cc-fig-i{aspect-ratio:5/3!important}}.zac__cc:where(.cc-narrow) .cc-step[data-step=\"7\"] .cc-strip .cc-fig .cc-fig-i{aspect-ratio:5/3!important}\n\n.zac__cc.cc-hasvid:not(:fullscreen) .zac__cc-scroll{height:1670vh}\n.zac__cc.cc-hasvid:not(:fullscreen){z-index:2}\n.zac__cc.cc-outro .cc-tools,.zac__cc.cc-outro .cc-cut,.zac__cc.cc-outro .zac__cc-caption,.zac__cc.cc-outro .cc-how,.zac__cc.cc-outro .zac__cc-bar{opacity:0!important;pointer-events:none!important;transition:opacity .25s}\n" + ".pv-wrap{color-scheme:only light}.pv-wrap{font-family:\"EB Garamond\",Georgia,serif;color:#3b2a22;background:#f6f0e6}.pv-col{max-width:680px;margin:0 auto;padding:10vh 22px}.pv-col p{font-size:22px;line-height:1.7;margin:0 0 1.2em}.pv-col p.pv-ph{color:#8a7b65;font-style:italic}\n.pv-vid{background:#2b1811;color:#f6f0e6;padding:10vh 6vw}.pv-wrap:where(.cc-narrow-pv) .pv-vid{padding:10vh calc(6 * var(--cw,1vw))}.pv-vid-in{max-width:1100px;margin:0 auto}.pv-k{font:500 13px \"Cormorant Garamond\",Georgia,serif;letter-spacing:.34em;text-transform:uppercase;color:#d9c7a0;margin-bottom:18px}\n.pv-t{font:italic 300 clamp(36px,4.6vw,72px)/1.04 \"Cormorant Garamond\",Georgia,serif;margin-bottom:5vh}.pv-wrap:where(.cc-narrow-pv) .pv-t{font:italic 300 clamp(36px,calc(4.6 * var(--cw,1vw)),72px)/1.04 \"Cormorant Garamond\",Georgia,serif}.pv-xn{background:#2b1811;color:#f6f0e6;padding:10vh 6vw}.pv-wrap:where(.cc-narrow-pv) .pv-xn{padding:10vh calc(6 * var(--cw,1vw))}.pv-xn-in{max-width:1100px;margin:0 auto}.pv-xn .pv-t{margin-bottom:4vh}\n.pv-ba{position:relative;aspect-ratio:3/2;overflow:hidden;background:#1c0f0a;cursor:ew-resize;touch-action:pan-y;user-select:none;-webkit-user-select:none;outline:9px solid #f6f0e6;outline-offset:0;margin:9px}.pv-ba img{position:absolute;max-width:none;pointer-events:none;-webkit-user-drag:none}\n.pv-ba-bar{position:absolute;top:0;bottom:0;width:2px;margin-left:-1px;background:#f6f0e6;box-shadow:0 0 12px rgba(0,0,0,.5)}.pv-ba-knob{position:absolute;top:50%;left:50%;width:46px;height:46px;margin:-23px 0 0 -23px;border-radius:50%;background:#e3b23c;box-shadow:0 4px 16px rgba(0,0,0,.4)}.pv-ba-knob::before,.pv-ba-knob::after{content:\"\";position:absolute;top:50%;width:8px;height:8px;border:solid #2b1811;border-width:2px 0 0 2px;margin-top:-5px}.pv-ba-knob::before{left:11px;transform:rotate(-45deg)}.pv-ba-knob::after{right:11px;transform:rotate(135deg)}\n.pv-ba2{margin-top:7vh}.pv-ba-tag{position:absolute;bottom:14px;font:600 12px \"Cormorant Garamond\",Georgia,serif;letter-spacing:.3em;text-transform:uppercase;background:rgba(43,24,17,.72);color:#f6f0e6;padding:7px 12px 6px 15px}.pv-ba-l{left:14px}.pv-ba-r{right:14px}.pv-ba-note{font:italic 16px \"Cormorant Garamond\",Georgia,serif;color:#b9ab93;margin-top:18px}\n.pv-col+.pv-col{padding-top:0}.pv-video{margin:0 0 9vh;width:min(1080px,calc(100vw - 44px));position:relative;left:50%;transform:translateX(-50%)}.pv-wrap:where(.cc-narrow-pv) .pv-video{width:min(1080px,calc(calc(100 * var(--cw,1vw)) - 44px))}.pv-video[hidden]{display:none}.pv-video figure,.pv-video>div{margin:0!important;width:100%!important;max-width:none!important;float:none!important}.pv-vbg{position:absolute;background:#2b1811;z-index:0;pointer-events:none}.cc-mainvid{position:relative;z-index:1;box-sizing:border-box}.cc-mainvid .video-container,.cc-mainvid>div{max-width:none!important}.pv-tail{position:relative;isolation:isolate}.pv-tail::before{content:\"\";position:absolute;top:0;bottom:0;left:var(--pvl,0px);width:var(--pvw,100%);background:#f6f0e6;z-index:-1}.pv-wrap:where(.cc-narrow-pv) .pv-tail::before{width:var(--pvw,100%)}.pv-tail>.pv-col:first-child{padding-top:9vh}.pv-about{border-top:1px solid rgba(43,24,17,.25);padding-top:26px}.pv-about .pv-k{color:#a08a5e}.pv-about .pv-lg{width:210px;max-width:60%;color:#111;margin:4px 0 22px}.pv-about .pv-logo{display:block;width:100%;height:auto}.pv-about p{font-size:19px;color:#5a4a40}\n@media (max-width:760px){.pv-xn{padding:8vh 14px}.pv-ba{aspect-ratio:4/3.4;outline-width:6px;margin:6px}.pv-ba-knob{width:40px;height:40px;margin:-20px 0 0 -20px}.pv-ba-knob::before{left:9px}.pv-ba-knob::after{right:9px}}.pv-wrap:where(.cc-narrow-pv) .pv-xn{padding:8vh 14px}.pv-wrap:where(.cc-narrow-pv) .pv-ba{aspect-ratio:4/3.4;outline-width:6px;margin:6px}.pv-wrap:where(.cc-narrow-pv) .pv-ba-knob{width:40px;height:40px;margin:-20px 0 0 -20px}.pv-wrap:where(.cc-narrow-pv) .pv-ba-knob::before{left:9px}.pv-wrap:where(.cc-narrow-pv) .pv-ba-knob::after{right:9px}\n.pv-vid{padding-top:4vh}.pv-box{aspect-ratio:16/9;border:1px solid rgba(217,199,160,.4);display:flex;align-items:center;justify-content:center;font:italic 18px \"Cormorant Garamond\",Georgia,serif;color:#b9ab93;text-align:center;padding:20px}"; document.head.appendChild(st); if (!document.getElementById('cc-offline-library')) { var lb = document.createElement('script'); lb.type = 'text/plain'; lb.id = 'cc-offline-library'; lb.textContent = "(()=>{var fg=Object.defineProperty;var pg=(s,t)=>{for(var e in t)fg(s,e,{get:t[e],enumerable:!0})};var qd={};pg(qd,{ACESFilmicToneMapping:()=>Ah,AddEquation:()=>Ui,AddOperation:()=>fd,AdditiveAnimationBlendMode:()=>Fh,AdditiveBlending:()=>_h,AgXToneMapping:()=>wh,AlphaFormat:()=>Nh,AlwaysCompare:()=>zh,AlwaysDepth:()=>ha,AlwaysStencilFunc:()=>yd,AmbientLight:()=>mo,AnimationAction:()=>Ao,AnimationClip:()=>Li,AnimationLoader:()=>Cc,AnimationMixer:()=>Vc,AnimationObjectGroup:()=>Gc,AnimationUtils:()=>Rc,ArcCurve:()=>Na,ArrayCamera:()=>So,ArrowHelper:()=>uh,AttachedBindMode:()=>oc,Audio:()=>bo,AudioAnalyser:()=>kc,AudioContext:()=>Rr,AudioListener:()=>Bc,AudioLoader:()=>Fc,AxesHelper:()=>dh,BackSide:()=>Ke,BasicDepthPacking:()=>xd,BasicShadowMap:()=>Mp,BatchedMesh:()=>Ea,BezierInterpolant:()=>lo,Bone:()=>ir,BooleanKeyframeTrack:()=>qn,Box2:()=>Eo,Box3:()=>De,Box3Helper:()=>ch,BoxGeometry:()=>Ci,BoxHelper:()=>lh,BufferAttribute:()=>fe,BufferGeometry:()=>Yt,BufferGeometryLoader:()=>yo,ByteType:()=>Ih,Cache:()=>Dn,Camera:()=>ps,CameraHelper:()=>oh,CanvasTexture:()=>Ac,CapsuleGeometry:()=>Ia,CatmullRomCurve3:()=>Ua,CineonToneMapping:()=>Th,CircleGeometry:()=>Pa,ClampToEdgeWrapping:()=>nn,Clock:()=>Jc,Color:()=>bt,ColorKeyframeTrack:()=>br,ColorManagement:()=>jt,Compatibility:()=>hm,CompressedArrayTexture:()=>bc,CompressedCubeTexture:()=>Tc,CompressedTexture:()=>os,CompressedTextureLoader:()=>Ic,ConeGeometry:()=>cr,ConstantAlphaFactor:()=>hd,ConstantColorFactor:()=>ld,Controls:()=>ph,CubeCamera:()=>gs,CubeDepthTexture:()=>ar,CubeReflectionMapping:()=>Zn,CubeRefractionMapping:()=>Fi,CubeTexture:()=>Ri,CubeTextureLoader:()=>Pc,CubicBezierCurve:()=>hr,CubicBezierCurve3:()=>Fa,CubicInterpolant:()=>ao,CullFaceBack:()=>gh,CullFaceFront:()=>qu,CullFaceFrontBack:()=>Sp,CullFaceNone:()=>Xu,Curve:()=>dn,CurvePath:()=>Ba,CustomBlending:()=>Zu,CustomToneMapping:()=>Eh,CylinderGeometry:()=>lr,Cylindrical:()=>Kc,Data3DTexture:()=>is,DataArrayTexture:()=>ns,DataTexture:()=>sn,DataTextureLoader:()=>Lc,DataUtils:()=>dc,DecrementStencilOp:()=>Gp,DecrementWrapStencilOp:()=>Hp,DefaultLoadingManager:()=>Ld,DepthFormat:()=>Vn,DepthStencilFormat:()=>Jn,DepthTexture:()=>Xn,DetachedBindMode:()=>pd,DirectionalLight:()=>po,DirectionalLightHelper:()=>ah,DiscreteInterpolant:()=>oo,DodecahedronGeometry:()=>La,DoubleSide:()=>Fn,DstAlphaFactor:()=>id,DstColorFactor:()=>rd,DynamicCopyUsage:()=>sm,DynamicDrawUsage:()=>Qp,DynamicReadUsage:()=>em,EdgesGeometry:()=>Da,EllipseCurve:()=>ls,EqualCompare:()=>bd,EqualDepth:()=>da,EqualStencilFunc:()=>Yp,EquirectangularReflectionMapping:()=>Pr,EquirectangularRefractionMapping:()=>Lr,Euler:()=>Sn,EventDispatcher:()=>un,ExternalTexture:()=>or,ExtrudeGeometry:()=>Va,FileLoader:()=>bn,Float16BufferAttribute:()=>xc,Float32BufferAttribute:()=>Tt,FloatType:()=>Je,Fog:()=>va,FogExp2:()=>xa,FramebufferTexture:()=>Mc,FrontSide:()=>fi,Frustum:()=>Wn,FrustumArray:()=>sr,GLBufferAttribute:()=>Yc,GLSL1:()=>am,GLSL3:()=>kh,GreaterCompare:()=>Td,GreaterDepth:()=>pa,GreaterEqualCompare:()=>Bh,GreaterEqualDepth:()=>fa,GreaterEqualStencilFunc:()=>Kp,GreaterStencilFunc:()=>Jp,GridHelper:()=>sh,Group:()=>oi,HTMLTexture:()=>Ec,HalfFloatType:()=>An,HemisphereLight:()=>ho,HemisphereLightHelper:()=>ih,IcosahedronGeometry:()=>Ha,ImageBitmapLoader:()=>Uc,ImageLoader:()=>Di,ImageUtils:()=>_a,IncrementStencilOp:()=>kp,IncrementWrapStencilOp:()=>Vp,InstancedBufferAttribute:()=>hi,InstancedBufferGeometry:()=>vo,InstancedInterleavedBuffer:()=>qc,InstancedMesh:()=>Aa,Int16BufferAttribute:()=>gc,Int32BufferAttribute:()=>_c,Int8BufferAttribute:()=>fc,IntType:()=>Ro,InterleavedBuffer:()=>as,InterleavedBufferAttribute:()=>wi,Interpolant:()=>di,InterpolateBezier:()=>lc,InterpolateDiscrete:()=>Ys,InterpolateLinear:()=>ga,InterpolateSmooth:()=>sa,InterpolationSamplingMode:()=>cm,InterpolationSamplingType:()=>lm,InvertStencilOp:()=>Wp,KeepStencilOp:()=>ra,KeyframeTrack:()=>an,LOD:()=>Ma,LatheGeometry:()=>Wa,Layers:()=>ss,LessCompare:()=>Md,LessDepth:()=>ua,LessEqualCompare:()=>Oh,LessEqualDepth:()=>ts,LessEqualStencilFunc:()=>Zp,LessStencilFunc:()=>qp,Light:()=>Un,LightProbe:()=>_o,LightShadow:()=>fs,Line:()=>Nn,Line3:()=>jc,LineBasicMaterial:()=>ke,LineCurve:()=>ur,LineCurve3:()=>Oa,LineDashedMaterial:()=>ro,LineLoop:()=>wa,LineSegments:()=>gn,LinearFilter:()=>xe,LinearInterpolant:()=>Mr,LinearMipMapLinearFilter:()=>wp,LinearMipMapNearestFilter:()=>Ep,LinearMipmapLinearFilter:()=>Tn,LinearMipmapNearestFilter:()=>Dr,LinearSRGBColorSpace:()=>Js,LinearToneMapping:()=>Mh,LinearTransfer:()=>$s,Loader:()=>Ve,LoaderUtils:()=>wr,LoadingManager:()=>Ar,LoopOnce:()=>md,LoopPingPong:()=>_d,LoopRepeat:()=>gd,MOUSE:()=>vp,Material:()=>Pe,MaterialBlending:()=>bp,MaterialLoader:()=>xo,MathUtils:()=>xm,Matrix2:()=>Qc,Matrix3:()=>Wt,Matrix4:()=>Vt,MaxEquation:()=>Qu,Mesh:()=>Ee,MeshBasicMaterial:()=>Hn,MeshDepthMaterial:()=>yr,MeshDistanceMaterial:()=>Sr,MeshLambertMaterial:()=>io,MeshMatcapMaterial:()=>so,MeshNormalMaterial:()=>no,MeshPhongMaterial:()=>to,MeshPhysicalMaterial:()=>ja,MeshStandardMaterial:()=>vr,MeshToonMaterial:()=>eo,MinEquation:()=>Ku,MirroredRepeatWrapping:()=>qs,MixOperation:()=>dd,MultiplyBlending:()=>vh,MultiplyOperation:()=>Ir,NearestFilter:()=>be,NearestMipMapLinearFilter:()=>Ap,NearestMipMapNearestFilter:()=>Tp,NearestMipmapLinearFilter:()=>vs,NearestMipmapNearestFilter:()=>Ch,NeutralToneMapping:()=>Rh,NeverCompare:()=>Sd,NeverDepth:()=>ca,NeverStencilFunc:()=>Xp,NoBlending:()=>Ni,NoColorSpace:()=>Kn,NoNormalPacking:()=>Up,NoToneMapping:()=>On,NormalAnimationBlendMode:()=>hl,NormalBlending:()=>xs,NormalGAPacking:()=>Op,NormalRGPacking:()=>Fp,NotEqualCompare:()=>Ad,NotEqualDepth:()=>ma,NotEqualStencilFunc:()=>$p,NumberKeyframeTrack:()=>us,Object3D:()=>oe,ObjectLoader:()=>Nc,ObjectSpaceNormalMap:()=>vd,OctahedronGeometry:()=>gr,OneFactor:()=>td,OneMinusConstantAlphaFactor:()=>ud,OneMinusConstantColorFactor:()=>cd,OneMinusDstAlphaFactor:()=>sd,OneMinusDstColorFactor:()=>ad,OneMinusSrcAlphaFactor:()=>Sh,OneMinusSrcColorFactor:()=>nd,OrthographicCamera:()=>ms,PCFShadowMap:()=>Cr,PCFSoftShadowMap:()=>Yu,PMREMGenerator:()=>pl,Path:()=>Ii,PerspectiveCamera:()=>Le,Plane:()=>vn,PlaneGeometry:()=>hs,PlaneHelper:()=>hh,PointLight:()=>fo,PointLightHelper:()=>nh,Points:()=>Ra,PointsMaterial:()=>rr,PolarGridHelper:()=>rh,PolyhedronGeometry:()=>ui,PositionalAudio:()=>zc,PropertyBinding:()=>he,PropertyMixer:()=>To,QuadraticBezierCurve:()=>dr,QuadraticBezierCurve3:()=>fr,Quaternion:()=>ze,QuaternionKeyframeTrack:()=>ds,QuaternionLinearInterpolant:()=>co,R11_EAC_Format:()=>Go,RED_GREEN_RGTC2_Format:()=>kr,RED_RGTC1_Format:()=>ol,REVISION:()=>Wu,RG11_EAC_Format:()=>zr,RGBADepthPacking:()=>Lp,RGBAFormat:()=>rn,RGBAIntegerFormat:()=>Do,RGBA_ASTC_10x10_Format:()=>el,RGBA_ASTC_10x5_Format:()=>Qo,RGBA_ASTC_10x6_Format:()=>jo,RGBA_ASTC_10x8_Format:()=>tl,RGBA_ASTC_12x10_Format:()=>nl,RGBA_ASTC_12x12_Format:()=>il,RGBA_ASTC_4x4_Format:()=>Wo,RGBA_ASTC_5x4_Format:()=>Xo,RGBA_ASTC_5x5_Format:()=>qo,RGBA_ASTC_6x5_Format:()=>Yo,RGBA_ASTC_6x6_Format:()=>Zo,RGBA_ASTC_8x5_Format:()=>Jo,RGBA_ASTC_8x6_Format:()=>$o,RGBA_ASTC_8x8_Format:()=>Ko,RGBA_BPTC_Format:()=>sl,RGBA_ETC2_EAC_Format:()=>ko,RGBA_PVRTC_2BPPV1_Format:()=>Oo,RGBA_PVRTC_4BPPV1_Format:()=>Fo,RGBA_S3TC_DXT1_Format:()=>Fr,RGBA_S3TC_DXT3_Format:()=>Or,RGBA_S3TC_DXT5_Format:()=>Br,RGBDepthPacking:()=>Dp,RGBFormat:()=>Uh,RGBIntegerFormat:()=>Rp,RGB_BPTC_SIGNED_Format:()=>rl,RGB_BPTC_UNSIGNED_Format:()=>al,RGB_ETC1_Format:()=>Bo,RGB_ETC2_Format:()=>zo,RGB_PVRTC_2BPPV1_Format:()=>Uo,RGB_PVRTC_4BPPV1_Format:()=>No,RGB_S3TC_DXT1_Format:()=>Ur,RGDepthPacking:()=>Np,RGFormat:()=>pi,RGIntegerFormat:()=>Lo,RawShaderMaterial:()=>xr,Ray:()=>ci,Raycaster:()=>Zc,RectAreaLight:()=>go,RedFormat:()=>Po,RedIntegerFormat:()=>Nr,ReinhardToneMapping:()=>bh,RenderObjectRefreshType:()=>um,RenderTarget:()=>js,RenderTarget3D:()=>Hc,RepeatWrapping:()=>Xs,ReplaceStencilOp:()=>zp,ReverseSubtractEquation:()=>$u,RingGeometry:()=>Xa,SIGNED_R11_EAC_Format:()=>Vo,SIGNED_RED_GREEN_RGTC2_Format:()=>cl,SIGNED_RED_RGTC1_Format:()=>ll,SIGNED_RG11_EAC_Format:()=>Ho,SRGBColorSpace:()=>en,SRGBTransfer:()=>ce,Scene:()=>ya,ShaderChunk:()=>Jt,ShaderLib:()=>Bn,ShaderMaterial:()=>Mn,ShadowMaterial:()=>Qa,Shape:()=>Pi,ShapeGeometry:()=>qa,ShapePath:()=>fh,ShapeUtils:()=>yn,ShortType:()=>Ph,Skeleton:()=>Ta,SkeletonHelper:()=>eh,SkinnedMesh:()=>ba,Source:()=>cc,Sphere:()=>Ie,SphereGeometry:()=>_r,Spherical:()=>$c,SphericalHarmonics3:()=>Er,SplineCurve:()=>pr,SpotLight:()=>uo,SpotLightHelper:()=>th,Sprite:()=>Sa,SpriteMaterial:()=>nr,SrcAlphaFactor:()=>yh,SrcAlphaSaturateFactor:()=>od,SrcColorFactor:()=>ed,StaticCopyUsage:()=>im,StaticDrawUsage:()=>ul,StaticReadUsage:()=>tm,StereoCamera:()=>Oc,StreamCopyUsage:()=>rm,StreamDrawUsage:()=>jp,StreamReadUsage:()=>nm,StringKeyframeTrack:()=>Yn,SubtractEquation:()=>Ju,SubtractiveBlending:()=>xh,TOUCH:()=>yp,TangentSpaceNormalMap:()=>$n,TetrahedronGeometry:()=>Ya,Texture:()=>Te,TextureLoader:()=>Dc,TextureSource:()=>mn,TextureUtils:()=>mh,Timer:()=>Mo,TimestampQuery:()=>om,TorusGeometry:()=>Za,TorusKnotGeometry:()=>Ja,Triangle:()=>Ln,TriangleFanDrawMode:()=>Pp,TriangleStripDrawMode:()=>Ip,TrianglesDrawMode:()=>Cp,TubeGeometry:()=>$a,UVMapping:()=>wo,Uint16BufferAttribute:()=>tr,Uint32BufferAttribute:()=>er,Uint8BufferAttribute:()=>pc,Uint8ClampedBufferAttribute:()=>mc,Uniform:()=>Wc,UniformsGroup:()=>Xc,UniformsLib:()=>yt,UniformsUtils:()=>Pd,UnsignedByteType:()=>on,UnsignedInt101111Type:()=>Dh,UnsignedInt248Type:()=>Oi,UnsignedInt5999Type:()=>Lh,UnsignedIntType:()=>_n,UnsignedShort4444Type:()=>Co,UnsignedShort5551Type:()=>Io,UnsignedShortType:()=>ys,VSMShadowMap:()=>_s,Vector2:()=>et,Vector3:()=>C,Vector4:()=>ue,VectorKeyframeTrack:()=>Tr,VideoFrameTexture:()=>Sc,VideoTexture:()=>Ca,WebGL3DRenderTarget:()=>uc,WebGLArrayRenderTarget:()=>hc,WebGLCoordinateSystem:()=>hn,WebGLCubeRenderTarget:()=>Vr,WebGLRenderTarget:()=>$e,WebGLRenderer:()=>Xd,WebGLUtils:()=>ag,WebGPUCoordinateSystem:()=>Ai,WebXRController:()=>rs,WireframeGeometry:()=>Ka,WrapAroundEnding:()=>Zs,ZeroCurvatureEnding:()=>bi,ZeroFactor:()=>ju,ZeroSlopeEnding:()=>Ti,ZeroStencilOp:()=>Bp,createCanvasElement:()=>Ed,error:()=>Lt,getConsoleFunction:()=>pm,log:()=>Qs,setConsoleFunction:()=>fm,warn:()=>gt,warnOnce:()=>Gn});var Wu=\"187\",vp={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Xu=0,gh=1,qu=2,Sp=3,Mp=0,Cr=1,Yu=2,_s=3,fi=0,Ke=1,Fn=2,Ni=0,xs=1,_h=2,xh=3,vh=4,Zu=5,bp=6,Ui=100,Ju=101,$u=102,Ku=103,Qu=104,ju=200,td=201,ed=202,nd=203,yh=204,Sh=205,id=206,sd=207,rd=208,ad=209,od=210,ld=211,cd=212,hd=213,ud=214,ca=0,ha=1,ua=2,ts=3,da=4,fa=5,pa=6,ma=7,Ir=0,dd=1,fd=2,On=0,Mh=1,bh=2,Th=3,Ah=4,Eh=5,wh=6,Rh=7,oc=\"attached\",pd=\"detached\",wo=300,Zn=301,Fi=302,Pr=303,Lr=304,Xs=1e3,nn=1001,qs=1002,be=1003,Ch=1004,Tp=1004,vs=1005,Ap=1005,xe=1006,Dr=1007,Ep=1007,Tn=1008,wp=1008,on=1009,Ih=1010,Ph=1011,ys=1012,Ro=1013,_n=1014,Je=1015,An=1016,Co=1017,Io=1018,Oi=1020,Lh=35902,Dh=35899,Nh=1021,Uh=1022,rn=1023,Vn=1026,Jn=1027,Po=1028,Nr=1029,pi=1030,Lo=1031,Rp=1032,Do=1033,Ur=33776,Fr=33777,Or=33778,Br=33779,No=35840,Uo=35841,Fo=35842,Oo=35843,Bo=36196,zo=37492,ko=37496,Go=37488,Vo=37489,zr=37490,Ho=37491,Wo=37808,Xo=37809,qo=37810,Yo=37811,Zo=37812,Jo=37813,$o=37814,Ko=37815,Qo=37816,jo=37817,tl=37818,el=37819,nl=37820,il=37821,sl=36492,rl=36494,al=36495,ol=36283,ll=36284,kr=36285,cl=36286,md=2200,gd=2201,_d=2202,Ys=2300,ga=2301,sa=2302,lc=2303,bi=2400,Ti=2401,Zs=2402,hl=2500,Fh=2501,Cp=0,Ip=1,Pp=2,xd=3200,Lp=3201,Dp=3202,Np=3203,$n=0,vd=1,Kn=\"\",en=\"srgb\",Js=\"srgb-linear\",$s=\"linear\",ce=\"srgb\",Up=\"\",Fp=\"rg\",Op=\"ga\",Bp=0,ra=7680,zp=7681,kp=7682,Gp=7683,Vp=34055,Hp=34056,Wp=5386,Xp=512,qp=513,Yp=514,Zp=515,Jp=516,$p=517,Kp=518,yd=519,Sd=512,Md=513,bd=514,Oh=515,Td=516,Ad=517,Bh=518,zh=519,ul=35044,Qp=35048,jp=35040,tm=35045,em=35049,nm=35041,im=35046,sm=35050,rm=35042,am=\"100\",kh=\"300 es\",hn=2e3,Ai=2001,om={COMPUTE:\"compute\",RENDER:\"render\"},lm={PERSPECTIVE:\"perspective\",LINEAR:\"linear\",FLAT:\"flat\"},cm={NORMAL:\"normal\",CENTROID:\"centroid\",SAMPLE:\"sample\",FIRST:\"first\",EITHER:\"either\"},hm={TEXTURE_COMPARE:\"depthTextureCompare\"},um={NONE:0,SHARED:1,FULL:2};function mg(s){for(let t=s.length-1;t>=0;--t)if(s[t]>=65535)return!0;return!1}var gg={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Vs(s,t){return new gg[s](t)}function dm(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Ks(s){return document.createElementNS(\"http://www.w3.org/1999/xhtml\",s)}function Ed(){let s=Ks(\"canvas\");return s.style.display=\"block\",s}var rf={},Ei=null;function fm(s){Ei=s}function pm(){return Ei}function Qs(...s){let t=\"THREE.\"+s.shift();Ei?Ei(\"log\",t,...s):console.log(t,...s)}function mm(s){let t=s[0];if(typeof t==\"string\"&&t.startsWith(\"TSL:\")){let e=s[1];e&&e.isStackTrace?s[0]+=\" \"+e.getLocation():s[1]='Stack trace not available. Enable \"THREE.Node.captureStackTrace\" to capture stack traces.'}return s}function gt(...s){s=mm(s);let t=\"THREE.\"+s.shift();if(Ei)Ei(\"warn\",t,...s);else{let e=s[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...s)}}function Lt(...s){s=mm(s);let t=\"THREE.\"+s.shift();if(Ei)Ei(\"error\",t,...s);else{let e=s[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...s)}}function Gn(...s){let t=s.join(\" \");t in rf||(rf[t]=!0,gt(...s))}function gm(s,t,e){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(t,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,e);break;default:n()}}setTimeout(r,e)})}var _m={[ca]:ca,[ua]:pa,[da]:da,[ts]:fa,[ha]:ha,[pa]:ua,[ma]:ma,[fa]:ts},un=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let i=n[t];if(i!==void 0){let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let r=0,a=i.length;r>8&255]+Xe[s>>16&255]+Xe[s>>24&255]+\"-\"+Xe[t&255]+Xe[t>>8&255]+\"-\"+Xe[t>>16&15|64]+Xe[t>>24&255]+\"-\"+Xe[e&63|128]+Xe[e>>8&255]+\"-\"+Xe[e>>16&255]+Xe[e>>24&255]+Xe[n&255]+Xe[n>>8&255]+Xe[n>>16&255]+Xe[n>>24&255]).toLowerCase()}function Gt(s,t,e){return Math.max(t,Math.min(e,s))}function wd(s,t){return(s%t+t)%t}function _g(s,t,e,n,i){return n+(s-t)*(i-n)/(e-t)}function xg(s,t,e){return s!==t?(e-s)/(t-s):0}function aa(s,t,e){return(1-e)*s+e*t}function vg(s,t,e,n){return aa(s,t,1-Math.exp(-e*n))}function yg(s,t=1){return t-Math.abs(wd(s,t*2)-t)}function Sg(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*(3-2*s))}function Mg(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*s*(s*(s*6-15)+10))}function bg(s,t){return s+Math.floor(Math.random()*(t-s+1))}function Tg(s,t){return s+Math.random()*(t-s)}function Ag(s){return s*(.5-Math.random())}function Eg(s){s!==void 0&&(af=s);let t=af+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function wg(s){return s*ji}function Rg(s){return s*es}function Cg(s){return s>0&&Number.isInteger(s)&&2**Math.round(Math.log2(s))===s}function Ig(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Rd(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Pg(s,t,e,n,i){let r=Math.cos,a=Math.sin,o=r(e/2),l=a(e/2),c=r((t+n)/2),h=a((t+n)/2),d=r((t-n)/2),u=a((t-n)/2),f=r((n-t)/2),p=a((n-t)/2);switch(i){case\"XYX\":s.set(o*h,l*d,l*u,o*c);break;case\"YZY\":s.set(l*u,o*h,l*d,o*c);break;case\"ZXZ\":s.set(l*d,l*u,o*h,o*c);break;case\"XZX\":s.set(o*h,l*p,l*f,o*c);break;case\"YXY\":s.set(l*f,o*h,l*p,o*c);break;case\"ZYZ\":s.set(l*p,l*f,o*h,o*c);break;default:gt(\"MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \"+i)}}function Gh(s){switch(s.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function Qi(s,t){if(t.constructor===Float32Array)return s;let e=Gh(t);if(e===void 0)throw new Error(\"THREE.MathUtils: Invalid component type.\");return Math.max(s/e,-1)}function Ze(s,t){if(t.constructor===Float32Array)return s;let e=Gh(t);if(e===void 0)throw new Error(\"THREE.MathUtils: Invalid component type.\");return Math.round(s*e)}var xm={DEG2RAD:ji,RAD2DEG:es,generateUUID:En,clamp:Gt,euclideanModulo:wd,mapLinear:_g,inverseLerp:xg,lerp:aa,damp:vg,pingpong:yg,smoothstep:Sg,smootherstep:Mg,randInt:bg,randFloat:Tg,randFloatSpread:Ag,seededRandom:Eg,degToRad:wg,radToDeg:Rg,isPowerOfTwo:Cg,ceilPowerOfTwo:Ig,floorPowerOfTwo:Rd,setQuaternionFromProperEuler:Pg,normalize:Ze,denormalize:Qi},et=class{static{this.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error(\"THREE.Vector2: index is out of range: \"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error(\"THREE.Vector2: index is out of range: \"+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Gt(this.x,t.x,e.x),this.y=Gt(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Gt(this.x,t,e),this.y=Gt(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Gt(n,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Gt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ze=class{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],d=n[i+3],u=r[a+0],f=r[a+1],p=r[a+2],_=r[a+3];if(d!==_||l!==u||c!==f||h!==p){let m=l*u+c*f+h*p+d*_;m<0&&(u=-u,f=-f,p=-p,_=-_,m=-m);let g=1-o;if(m<.9995){let v=Math.acos(m),S=Math.sin(v);g=Math.sin(g*v)/S,o=Math.sin(o*v)/S,l=l*g+u*o,c=c*g+f*o,h=h*g+p*o,d=d*g+_*o}else{l=l*g+u*o,c=c*g+f*o,h=h*g+p*o,d=d*g+_*o;let v=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=v,c*=v,h*=v,d*=v}}t[e]=l,t[e+1]=c,t[e+2]=h,t[e+3]=d}static multiplyQuaternionsFlat(t,e,n,i,r,a){let o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],d=r[a],u=r[a+1],f=r[a+2],p=r[a+3];return t[e]=o*p+h*d+l*f-c*u,t[e+1]=l*p+h*u+c*d-o*f,t[e+2]=c*p+h*f+o*u-l*d,t[e+3]=h*p-o*d-l*u-c*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,r=t._z,a=t._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),d=o(r/2),u=l(n/2),f=l(i/2),p=l(r/2);switch(a){case\"XYZ\":this._x=u*h*d+c*f*p,this._y=c*f*d-u*h*p,this._z=c*h*p+u*f*d,this._w=c*h*d-u*f*p;break;case\"YXZ\":this._x=u*h*d+c*f*p,this._y=c*f*d-u*h*p,this._z=c*h*p-u*f*d,this._w=c*h*d+u*f*p;break;case\"ZXY\":this._x=u*h*d-c*f*p,this._y=c*f*d+u*h*p,this._z=c*h*p+u*f*d,this._w=c*h*d-u*f*p;break;case\"ZYX\":this._x=u*h*d-c*f*p,this._y=c*f*d+u*h*p,this._z=c*h*p-u*f*d,this._w=c*h*d+u*f*p;break;case\"YZX\":this._x=u*h*d+c*f*p,this._y=c*f*d+u*h*p,this._z=c*h*p-u*f*d,this._w=c*h*d-u*f*p;break;case\"XZY\":this._x=u*h*d-c*f*p,this._y=c*f*d-u*h*p,this._z=c*h*p+u*f*d,this._w=c*h*d+u*f*p;break;default:gt(\"Quaternion: .setFromEuler() encountered an unknown order: \"+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],o=e[5],l=e[9],c=e[2],h=e[6],d=e[10],u=n+o+d;if(u>0){let f=.5/Math.sqrt(u+1);this._w=.25/f,this._x=(h-l)*f,this._y=(r-c)*f,this._z=(a-i)*f}else if(n>o&&n>d){let f=2*Math.sqrt(1+n-o-d);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+c)/f}else if(o>d){let f=2*Math.sqrt(1+o-n-d);this._w=(r-c)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(l+h)/f}else{let f=2*Math.sqrt(1+d-n-o);this._w=(a-i)/f,this._x=(r+c)/f,this._y=(l+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Gt(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,l=e._y,c=e._z,h=e._w;return this._x=n*h+a*o+i*c-r*l,this._y=i*h+a*l+r*o-n*c,this._z=r*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-r*c,this._onChangeCallback(),this}slerp(t,e){let n=t._x,i=t._y,r=t._z,a=t._w,o=this.dot(t);o<0&&(n=-n,i=-i,r=-r,a=-a,o=-o);let l=1-e;if(o<.9995){let c=Math.acos(o),h=Math.sin(c);l=Math.sin(l*c)/h,e=Math.sin(e*c)/h,this._x=this._x*l+n*e,this._y=this._y*l+i*e,this._z=this._z*l+r*e,this._w=this._w*l+a*e,this._onChangeCallback()}else this._x=this._x*l+n*e,this._y=this._y*l+i*e,this._z=this._z*l+r*e,this._w=this._w*l+a*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},C=class{static{this.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error(\"THREE.Vector3: index is out of range: \"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error(\"THREE.Vector3: index is out of range: \"+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(of.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(of.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*i-o*n),h=2*(o*e-r*i),d=2*(r*n-a*e);return this.x=e+l*c+a*d-o*h,this.y=n+l*h+o*c-r*d,this.z=i+l*d+r*h-a*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Gt(this.x,t.x,e.x),this.y=Gt(this.y,t.y,e.y),this.z=Gt(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Gt(this.x,t,e),this.y=Gt(this.y,t,e),this.z=Gt(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Gt(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,l=e.z;return this.x=i*l-r*o,this.y=r*a-n*l,this.z=n*o-i*a,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Jh.copy(this).projectOnVector(t),this.sub(Jh)}reflect(t){return this.sub(Jh.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Gt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Jh=new C,of=new ze,Wt=class{static{this.prototype.isMatrix3=!0}constructor(t,e,n,i,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,r,a,o,l,c)}set(t,e,n,i,r,a,o,l,c){let h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=r,h[5]=l,h[6]=n,h[7]=a,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[3],l=n[6],c=n[1],h=n[4],d=n[7],u=n[2],f=n[5],p=n[8],_=i[0],m=i[3],g=i[6],v=i[1],S=i[4],y=i[7],E=i[2],A=i[5],x=i[8];return r[0]=a*_+o*v+l*E,r[3]=a*m+o*S+l*A,r[6]=a*g+o*y+l*x,r[1]=c*_+h*v+d*E,r[4]=c*m+h*S+d*A,r[7]=c*g+h*y+d*x,r[2]=u*_+f*v+p*E,r[5]=u*m+f*S+p*A,r[8]=u*g+f*y+p*x,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return e*a*h-e*o*c-n*r*h+n*o*l+i*r*c-i*a*l}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],h=t[8],d=h*a-o*c,u=o*l-h*r,f=c*r-a*l,p=e*d+n*u+i*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let _=1/p;return t[0]=d*_,t[1]=(i*c-h*n)*_,t[2]=(o*n-i*a)*_,t[3]=u*_,t[4]=(h*e-i*l)*_,t[5]=(i*r-o*e)*_,t[6]=f*_,t[7]=(n*l-c*e)*_,t[8]=(a*e-n*r)*_,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,o){let l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*a+c*o)+a+t,-i*c,i*l,-i*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return Gn(\"Matrix3: .scale() is deprecated. Use .makeScale() instead.\"),this.premultiply($h.makeScale(t,e)),this}rotate(t){return Gn(\"Matrix3: .rotate() is deprecated. Use .makeRotation() instead.\"),this.premultiply($h.makeRotation(-t)),this}translate(t,e){return Gn(\"Matrix3: .translate() is deprecated. Use .makeTranslation() instead.\"),this.premultiply($h.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},$h=new Wt,lf=new Wt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),cf=new Wt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Lg(){let s={enabled:!0,workingColorSpace:Js,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===ce&&(i.r=li(i.r),i.g=li(i.g),i.b=li(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ce&&(i.r=Ws(i.r),i.g=Ws(i.g),i.b=Ws(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Kn?$s:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||\"standard\"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[a].fromXYZ).multiply(this.spaces[r].toXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Js]:{primaries:t,whitePoint:n,transfer:$s,toXYZ:lf,fromXYZ:cf,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:en},outputColorSpaceConfig:{drawingBufferColorSpace:en}},[en]:{primaries:t,whitePoint:n,transfer:ce,toXYZ:lf,fromXYZ:cf,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:en}}}),s}var jt=Lg();function li(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Ws(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Ms,_a=class{static getDataURL(t,e=\"image/png\"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>\"u\")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{Ms===void 0&&(Ms=Ks(\"canvas\")),Ms.width=t.width,Ms.height=t.height;let i=Ms.getContext(\"2d\");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=Ms}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<\"u\"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<\"u\"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap){let e=Ks(\"canvas\");e.width=t.width,e.height=t.height;let n=e.getContext(\"2d\");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let a=0;a1),this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(Qh).x}get height(){return this.source.getSize(Qh).y}get depth(){return this.source.getSize(Qh).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.mipmapsAutoUpdate=t.mipmapsAutoUpdate,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isPMREMTexture=t.isPMREMTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){gt(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let i=this[e];if(i===void 0){gt(`Texture.setValues(): property '${e}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t==\"string\";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:\"Texture\",generator:\"Texture.toJSON\"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:\"dispose\"})}transformUv(t){if(this.mapping!==wo)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Xs:t.x=t.x-Math.floor(t.x);break;case nn:t.x=t.x<0?0:1;break;case qs:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Xs:t.y=t.y-Math.floor(t.y);break;case nn:t.y=t.y<0?0:1;break;case qs:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};Te.DEFAULT_IMAGE=null;Te.DEFAULT_MAPPING=wo;Te.DEFAULT_ANISOTROPY=1;var ue=class{static{this.prototype.isVector4=!0}constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error(\"THREE.Vector4: index is out of range: \"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error(\"THREE.Vector4: index is out of range: \"+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r,l=t.elements,c=l[0],h=l[4],d=l[8],u=l[1],f=l[5],p=l[9],_=l[2],m=l[6],g=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(p-m)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(p+m)<.1&&Math.abs(c+f+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(c+1)/2,y=(f+1)/2,E=(g+1)/2,A=(h+u)/4,x=(d+_)/4,b=(p+m)/4;return S>y&&S>E?S<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(S),i=A/n,r=x/n):y>E?y<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(y),n=A/i,r=b/i):E<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(E),n=x/r,i=b/r),this.set(n,i,r,e),this}let v=Math.sqrt((m-p)*(m-p)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(d-_)/v,this.z=(u-h)/v,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Gt(this.x,t.x,e.x),this.y=Gt(this.y,t.y,e.y),this.z=Gt(this.z,t.z,e.z),this.w=Gt(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Gt(this.x,t,e),this.y=Gt(this.y,t,e),this.z=Gt(this.z,t,e),this.w=Gt(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Gt(n,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},js=class extends un{constructor(t=1,e=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:xe,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth,this.scissor=new ue(0,0,t,e),this.scissorTest=!1,this.viewport=new ue(0,0,t,e),this.textures=[];let i=n.count;for(let r=0;r1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type=\"InstancedMesh\",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(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.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(n.geometries=o),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),f.length>0&&(n.animations=f),p.length>0&&(n.nodes=p)}return n.object=i,n;function a(o){let l=[];for(let c in o){let h=o[c];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;nf+p?(c.inputState.pinching=!1,this.dispatchEvent({type:\"pinchend\",handedness:t.handedness,target:this})):!c.inputState.pinching&&u<=f-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:\"pinchstart\",handedness:t.handedness,target:this}))}else l!==null&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.quaternion,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:\"gripUpdated\",data:t,target:this})));o!==null&&(i=e.getPose(t.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.quaternion,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(Gg)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new oi;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},vm={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},xi={h:0,s:0,l:0},yl={h:0,s:0,l:0};function tu(s,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?s+(t-s)*6*e:e<1/2?t:e<2/3?s+(t-s)*6*(2/3-e):s}var bt=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let i=t;i&&i.isColor?this.copy(i):typeof i==\"number\"?this.setHex(i):typeof i==\"string\"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=en){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,jt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=jt.workingColorSpace){return this.r=t,this.g=e,this.b=n,jt.colorSpaceToWorking(this,i),this}setHSL(t,e,n,i=jt.workingColorSpace){if(t=wd(t,1),e=Gt(e,0,1),n=Gt(n,0,1),e===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+e):n+e-n*e,a=2*n-r;this.r=tu(a,r,t+1/3),this.g=tu(a,r,t),this.b=tu(a,r,t-1/3)}return jt.colorSpaceToWorking(this,i),this}setStyle(t,e=en){function n(r){r!==void 0&&parseFloat(r)<1&>(\"Color: Alpha component of \"+t+\" will be ignored.\")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let r,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+)?|\\.\\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,e);if(r=/^\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\%\\s*(?:,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseFloat(r[1]))/100,Math.min(100,parseFloat(r[2]))/100,Math.min(100,parseFloat(r[3]))/100,e);break;case\"hsl\":case\"hsla\":if(r=/^\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\%\\s*,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\%\\s*(?:,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:gt(\"Color: Unknown color model \"+t)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(a===6)return this.setHex(parseInt(r,16),e);gt(\"Color: Invalid hex color \"+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=en){let n=vm[t.toLowerCase()];return n!==void 0?this.setHex(n,e):gt(\"Color: Unknown color \"+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=li(t.r),this.g=li(t.g),this.b=li(t.b),this}copyLinearToSRGB(t){return this.r=Ws(t.r),this.g=Ws(t.g),this.b=Ws(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=en){return jt.workingToColorSpace(qe.copy(this),t),Math.round(Gt(qe.r*255,0,255))*65536+Math.round(Gt(qe.g*255,0,255))*256+Math.round(Gt(qe.b*255,0,255))}getHexString(t=en){return(\"000000\"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=jt.workingColorSpace){jt.workingToColorSpace(qe.copy(this),e);let n=qe.r,i=qe.g,r=qe.b,a=Math.max(n,i,r),o=Math.min(n,i,r),l,c,h=(o+a)/2;if(o===a)l=0,c=0;else{let d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(i-r)/d+(i0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Cn.subVectors(i,e),ei.subVectors(n,e),eu.subVectors(t,e);let a=Cn.dot(Cn),o=Cn.dot(ei),l=Cn.dot(eu),c=ei.dot(ei),h=ei.dot(eu),d=a*c-o*o;if(d===0)return r.set(0,0,0),null;let u=1/d,f=(c*l-o*h)*u,p=(a*h-o*l)*u;return r.set(1-f-p,p,f)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,ni)===null?!1:ni.x>=0&&ni.y>=0&&ni.x+ni.y<=1}static getInterpolation(t,e,n,i,r,a,o,l){return this.getBarycoord(t,e,n,i,ni)===null?(l.x=0,l.y=0,\"z\"in l&&(l.z=0),\"w\"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ni.x),l.addScaledVector(a,ni.y),l.addScaledVector(o,ni.z),l)}static getInterpolatedAttribute(t,e,n,i,r,a){return ru.setScalar(0),au.setScalar(0),ou.setScalar(0),ru.fromBufferAttribute(t,e),au.fromBufferAttribute(t,n),ou.fromBufferAttribute(t,i),a.setScalar(0),a.addScaledVector(ru,r.x),a.addScaledVector(au,r.y),a.addScaledVector(ou,r.z),a}static isFrontFacing(t,e,n,i){return Cn.subVectors(n,e),ei.subVectors(t,e),Cn.cross(ei).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Cn.subVectors(this.c,this.b),ei.subVectors(this.a,this.b),Cn.cross(ei).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return s.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return s.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return s.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return s.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return s.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,i=this.b,r=this.c,a,o;Es.subVectors(i,n),ws.subVectors(r,n),nu.subVectors(t,n);let l=Es.dot(nu),c=ws.dot(nu);if(l<=0&&c<=0)return e.copy(n);iu.subVectors(t,i);let h=Es.dot(iu),d=ws.dot(iu);if(h>=0&&d<=h)return e.copy(i);let u=l*d-h*c;if(u<=0&&l>=0&&h<=0&&l-h>0)return a=l/(l-h),e.copy(n).addScaledVector(Es,a);su.subVectors(t,r);let f=Es.dot(su),p=ws.dot(su);if(p>=0&&f<=p)return e.copy(r);let _=f*c-l*p;if(_<=0&&c>=0&&p<=0)return o=c/(c-p),e.copy(n).addScaledVector(ws,o);let m=h*p-f*d;if(m<=0&&d-h>=0&&f-p>=0)return _f.subVectors(r,i),o=(d-h)/(d-h+(f-p)),e.copy(i).addScaledVector(_f,o);let g=1/(m+_+u);return a=_*g,o=u*g,e.copy(n).addScaledVector(Es,a).addScaledVector(ws,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},De=class{constructor(t=new C(1/0,1/0,1/0),e=new C(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,In),In.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(qr),Ml.subVectors(this.max,qr),Rs.subVectors(t.a,qr),Cs.subVectors(t.b,qr),Is.subVectors(t.c,qr),vi.subVectors(Cs,Rs),yi.subVectors(Is,Cs),Gi.subVectors(Rs,Is);let e=[0,-vi.z,vi.y,0,-yi.z,yi.y,0,-Gi.z,Gi.y,vi.z,0,-vi.x,yi.z,0,-yi.x,Gi.z,0,-Gi.x,-vi.y,vi.x,0,-yi.y,yi.x,0,-Gi.y,Gi.x,0];return!lu(e,Rs,Cs,Is,Ml)||(e=[1,0,0,0,1,0,0,0,1],!lu(e,Rs,Cs,Is,Ml))?!1:(bl.crossVectors(vi,yi),e=[bl.x,bl.y,bl.z],lu(e,Rs,Cs,Is,Ml))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,In).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(In).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ii),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},ii=[new C,new C,new C,new C,new C,new C,new C,new C],In=new C,Sl=new De,Rs=new C,Cs=new C,Is=new C,vi=new C,yi=new C,Gi=new C,qr=new C,Ml=new C,bl=new C,Vi=new C;function lu(s,t,e,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){Vi.fromArray(s,r);let o=i.x*Math.abs(Vi.x)+i.y*Math.abs(Vi.y)+i.z*Math.abs(Vi.z),l=t.dot(Vi),c=e.dot(Vi),h=n.dot(Vi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}var ai=Vg();function Vg(){let s=new ArrayBuffer(4),t=new Float32Array(s),e=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}let r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;(c&8388608)===0;)c<<=1,h-=8388608;c&=-8388609,h+=947912704,r[l]=c|h}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:a,offsetTable:o}}function cn(s){Math.abs(s)>65504&>(\"DataUtils.toHalfFloat(): Value out of range.\"),s=Gt(s,-65504,65504),ai.floatView[0]=s;let t=ai.uint32View[0],e=t>>23&511;return ai.baseTable[e]+((t&8388607)>>ai.shiftTable[e])}function na(s){let t=s>>10;return ai.uint32View[0]=ai.mantissaTable[ai.offsetTable[t]+(s&1023)]+ai.exponentTable[t],ai.floatView[0]}var dc=class{static toHalfFloat(t){return cn(t)}static fromHalfFloat(t){return na(t)}},Ce=new C,Tl=new et,Hg=0,fe=class extends un{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError(\"THREE.BufferAttribute: array should be a Typed Array.\");this.isBufferAttribute=!0,Object.defineProperty(this,\"id\",{value:Hg++}),this.name=\"\",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=ul,this.updateRanges=[],this.gpuType=Je,this.version=0,this._normalizationScale=t!==void 0?Gh(t):void 0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this._normalizationScale=t._normalizationScale,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Yr.subVectors(t,this.center);let e=Yr.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(Yr,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(cu.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Yr.copy(t.center).add(cu)),this.expandByPoint(Yr.copy(t.center).sub(cu))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Xg=0,xn=new Vt,hu=new oe,Ps=new C,pn=new De,Zr=new De,Be=new C,Yt=class s extends un{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,\"id\",{value:Xg++}),this.uuid=En(),this.name=\"\",this.type=\"BufferGeometry\",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(mg(t)?er:tr)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let r=new Wt().getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return xn.makeRotationFromQuaternion(t),this.applyMatrix4(xn),this}rotateX(t){return xn.makeRotationX(t),this.applyMatrix4(xn),this}rotateY(t){return xn.makeRotationY(t),this.applyMatrix4(xn),this}rotateZ(t){return xn.makeRotationZ(t),this.applyMatrix4(xn),this}translate(t,e,n){return xn.makeTranslation(t,e,n),this.applyMatrix4(xn),this}scale(t,e,n){return xn.makeScale(t,e,n),this.applyMatrix4(xn),this}lookAt(t){return hu.lookAt(t),hu.updateMatrix(),this.applyMatrix4(hu.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ps).negate(),this.translate(Ps.x,Ps.y,Ps.z),this}setFromPoints(t){let e=this.getAttribute(\"position\");if(e===void 0){let n=[];for(let i=0,r=t.length;ie.count&>(\"BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.\"),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new De);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Lt(\"BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.\",this),this.boundingBox.set(new C(-1/0,-1/0,-1/0),new C(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(t[c]=l[c]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let l in n){let c=n[l];t.data.attributes[l]=c.toJSON(t.data)}let i={},r=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],h=[];for(let d=0,u=c.length;d0&&(i[l]=h,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let i=t.attributes;for(let c in i){let h=i[c];this.setAttribute(c,h.clone(e))}let r=t.morphAttributes;for(let c in r){let h=[],d=r[c];for(let u=0,f=d.length;u1)?null:e.copy(t.start).addScaledVector(i,a)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||Yg.getNormalMatrix(t),i=this.coplanarPoint(uu).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(t){return this.normal.fromArray(t.normal),this.constant=t.constant,this}},Zg=0,Pe=class extends un{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,\"id\",{value:Zg++}),this.uuid=En(),this.name=\"\",this.type=\"Material\",this.blending=xs,this.side=fi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=yh,this.blendDst=Sh,this.blendEquation=Ui,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new bt(0,0,0),this.blendAlpha=0,this.depthFunc=ts,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=yd,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ra,this.stencilZFail=ra,this.stencilZPass=ra,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){gt(`Material: parameter '${e}' has value of undefined.`);continue}let i=this[e];if(i===void 0){gt(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector2&&n&&n.isVector2||i&&i.isEuler&&n&&n.isEuler||i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t==\"string\";e&&(t={textures:{},images:{}});let n={metadata:{version:4.7,type:\"Material\",generator:\"Material.toJSON\"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(t).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(r=>r.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){let a=[];for(let o in r){let l=r[o];delete l.metadata,a.push(l)}return a}if(e){let r=i(t.textures),a=i(t.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new bt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.diffuseRoughness!==void 0&&(this.diffuseRoughness=t.diffuseRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.retroreflectivity!==void 0&&(this.retroreflectivity=t.retroreflectivity),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=t.iridescenceThicknessMinimum),t.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=t.iridescenceThicknessMaximum),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1]),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.clippingPlanes!==void 0&&(this.clippingPlanes=t.clippingPlanes.map(n=>new vn().fromJSON(n))),t.clipIntersection!==void 0&&(this.clipIntersection=t.clipIntersection),t.clipShadows!==void 0&&(this.clipShadows=t.clipShadows),t.depthPacking!==void 0&&(this.depthPacking=t.depthPacking),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.linecap!==void 0&&(this.linecap=t.linecap),t.linejoin!==void 0&&(this.linejoin=t.linejoin),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors==\"number\"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let n=t.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new et().fromArray(n)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new et().fromArray(t.clearcoatNormalScale)),t.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=e[t.diffuseRoughnessMap]||null),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let i=e.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:\"dispose\"})}set needsUpdate(t){t===!0&&this.version++}},nr=class extends Pe{constructor(t){super(),this.isSpriteMaterial=!0,this.type=\"SpriteMaterial\",this.color=new bt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},Ls,Jr=new C,Ds=new C,Ns=new C,Us=new et,$r=new et,ym=new Vt,Al=new C,Kr=new C,El=new C,vf=new et,du=new et,yf=new et,Sa=class extends oe{constructor(t=new nr){if(super(),this.isSprite=!0,this.type=\"Sprite\",Ls===void 0){Ls=new Yt;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new as(e,5);Ls.setIndex([0,1,2,0,2,3]),Ls.setAttribute(\"position\",new wi(n,3,0,!1)),Ls.setAttribute(\"uv\",new wi(n,2,3,!1))}this.geometry=Ls,this.material=t,this.center=new et(.5,.5),this.count=1}intersectsFrustum(t){return t.intersectsSprite(this)}raycast(t,e){t.camera===null&&Lt('Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.'),Ds.setFromMatrixScale(this.matrixWorld),ym.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ns.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ds.multiplyScalar(-Ns.z);let n=this.material.rotation,i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));let a=this.center;wl(Al.set(-.5,-.5,0),Ns,a,Ds,i,r),wl(Kr.set(.5,-.5,0),Ns,a,Ds,i,r),wl(El.set(.5,.5,0),Ns,a,Ds,i,r),vf.set(0,0),du.set(1,0),yf.set(1,1);let o=t.ray.intersectTriangle(Al,Kr,El,!1,Jr);if(o===null&&(wl(Kr.set(-.5,.5,0),Ns,a,Ds,i,r),du.set(0,1),o=t.ray.intersectTriangle(Al,El,Kr,!1,Jr),o===null))return;let l=t.ray.origin.distanceTo(Jr);lt.far||e.push({distance:l,point:Jr.clone(),uv:Ln.getInterpolation(Jr,Al,Kr,El,vf,du,yf,new et),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}toJSON(t){let e=super.toJSON(t);return e.object.center=this.center.toArray(),e}};function wl(s,t,e,n,i,r){Us.subVectors(s,e).addScalar(.5).multiply(n),i!==void 0?($r.x=r*Us.x-i*Us.y,$r.y=i*Us.x+r*Us.y):$r.copy(Us),s.copy(t),s.x+=$r.x,s.y+=$r.y,s.applyMatrix4(ym)}var Rl=new C,Sf=new C,Ma=class extends oe{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type=\"LOD\",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);let e=t.levels;for(let n=0,i=e.length;n0){let n,i;for(n=1,i=e.length;n0){Rl.setFromMatrixPosition(this.matrixWorld);let i=t.ray.origin.distanceTo(Rl);this.getObjectForDistance(i).raycast(t,e)}}update(t){let e=this.levels;if(e.length>1){Rl.setFromMatrixPosition(t.matrixWorld),Sf.setFromMatrixPosition(this.matrixWorld);let n=Rl.distanceTo(Sf)/t.zoom;e[0].object.visible=!0;let i,r;for(i=1,r=e.length;i=a)e[i-1].object.visible=!1,e[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(d=a*l-o,u=a*o-l,p=r*h,d>=0)if(u>=-p)if(u<=p){let _=1/h;d*=_,u*=_,f=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=r,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;else u<=-p?(d=Math.max(0,-(-a*r+o)),u=d>0?-r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c):u<=p?(d=0,u=Math.min(Math.max(-r,-l),r),f=u*(u+2*l)+c):(d=Math.max(0,-(a*r+o)),u=d>0?r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c);else u=a>0?-r:r,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(fu).addScaledVector(Cl,u),f}intersectSphere(t,e){if(t.radius<0)return null;si.subVectors(t.center,this.origin);let n=si.dot(this.direction),i=si.dot(si)-n*n,r=t.radius*t.radius;if(i>r)return null;let a=Math.sqrt(r-i),o=n-a,l=n+a;return l<0?null:o<0?this.at(l,e):this.at(o,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,a,o,l,c=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,i=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,i=(t.min.x-u.x)*c),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a=0?(o=(t.min.z-u.z)*d,l=(t.max.z-u.z)*d):(o=(t.max.z-u.z)*d,l=(t.min.z-u.z)*d),n>l||o>i)||((o>n||n!==n)&&(n=o),(l=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,si)!==null}intersectTriangle(t,e,n,i,r){let a=this.origin,o=this.direction,l=o.x,c=o.y,h=o.z,d=t.x-a.x,u=t.y-a.y,f=t.z-a.z,p=e.x-a.x,_=e.y-a.y,m=e.z-a.z,g=n.x-a.x,v=n.y-a.y,S=n.z-a.z,y=Math.abs(l),E=Math.abs(c),A=Math.abs(h),x,b,I,R,L,F,H,D,k,X,G,nt;if(y>=E&&y>=A?(I=l,F=d,k=p,nt=g,l>=0?(x=c,b=h,R=u,L=f,H=_,D=m,X=v,G=S):(x=h,b=c,R=f,L=u,H=m,D=_,X=S,G=v)):E>=A?(I=c,F=u,k=_,nt=v,c>=0?(x=h,b=l,R=f,L=d,H=m,D=p,X=S,G=g):(x=l,b=h,R=d,L=f,H=p,D=m,X=g,G=S)):(I=h,F=f,k=m,nt=S,h>=0?(x=l,b=c,R=d,L=u,H=p,D=_,X=g,G=v):(x=c,b=l,R=u,L=d,H=_,D=p,X=v,G=g)),I===0)return null;let W=x/I,Q=b/I,tt=1/I,Et=R-W*F,zt=L-Q*F,Y=H-W*k,xt=D-Q*k,wt=X-W*nt,Ft=G-Q*nt,vt=wt*xt-Ft*Y,Ot=Et*Ft-zt*wt,_e=Y*zt-xt*Et;if(i){if(vt<0||Ot<0||_e<0)return null}else if((vt<0||Ot<0||_e<0)&&(vt>0||Ot>0||_e>0))return null;let kt=vt+Ot+_e;if(kt===0)return null;let Kt=tt*(vt*F+Ot*k+_e*nt);return(kt>0?Kt<0:Kt>0)?null:this.at(Kt/kt,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Hn=class extends Pe{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type=\"MeshBasicMaterial\",this.color=new bt(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 Sn,this.combine=Ir,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},Mf=new Vt,Hi=new ci,Pl=new Ie,bf=new C,Ll=new C,Dl=new C,Nl=new C,pu=new C,Ul=new C,Tf=new C,Fl=new C,Ee=class extends oe{constructor(t=new Yt,e=new Hn){super(),this.isMesh=!0,this.type=\"Mesh\",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0?this.morphTargetInfluences=t.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,t.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,n=Object.keys(e);if(n.length>0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;r(t.far-t.near)**2))&&(Mf.copy(r).invert(),Hi.copy(t.ray).applyMatrix4(Mf),!(n.boundingBox!==null&&Hi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,Hi)))}_computeIntersections(t,e,n){let i,r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,d=r.attributes.normal,u=r.groups,f=r.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,_=u.length;p<_;p++){let m=u[p],g=a[m.materialIndex],v=Math.max(m.start,f.start),S=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let y=v,E=S;ye.far?null:{distance:c,point:Fl.clone(),object:s}}function Ol(s,t,e,n,i,r,a,o,l,c){s.getVertexPosition(o,Ll),s.getVertexPosition(l,Dl),s.getVertexPosition(c,Nl);let h=Jg(s,t,e,n,Ll,Dl,Nl,Tf);if(h){let d=new C;Ln.getBarycoord(Tf,Ll,Dl,Nl,d),i&&(h.uv=Ln.getInterpolatedAttribute(i,o,l,c,d,new et)),r&&(h.uv1=Ln.getInterpolatedAttribute(r,o,l,c,d,new et)),a&&(h.normal=Ln.getInterpolatedAttribute(a,o,l,c,d,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a:o,b:l,c,normal:new C,materialIndex:0};Ln.getNormal(Ll,Dl,Nl,u.normal),h.face=u,h.barycoord=d}return h}var Qr=new ue,Af=new ue,Ef=new ue,$g=new ue,wf=new Vt,Bl=new C,mu=new Ie,Rf=new Vt,gu=new ci,ba=class extends Ee{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type=\"SkinnedMesh\",this.bindMode=oc,this.bindMatrix=new Vt,this.bindMatrixInverse=new Vt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let t=this.geometry;this.boundingBox===null&&(this.boundingBox=new De),this.boundingBox.makeEmpty();let e=t.getAttribute(\"position\");for(let n=0;n0?t.max.x:t.min.x,kl.y=i.normal.y>0?t.max.y:t.min.y,kl.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(kl)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Lf=new Vt,sr=class s{constructor(){this.coordinateSystem=hn,this._frustums=[],this._count=0}setFromArrayCamera(t){let e=t.cameras,n=this._frustums;for(let i=0;i=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let o=r[this.index];a.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}},ln=new Vt,n_=new bt(1,1,1),i_=new Wn,s_=new sr,Gl=new De,Xi=new Ie,xu=new C,Df=new C,Nf=new C,r_=new C,vu=new Lu,Ye=new Ee,Vl=[];function a_(s,t,e=0){let n=t.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==t.array.constructor){let i=s.count;for(let r=0;r65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new fe(r,1))}this._geometryInitialized=!0}}_validateGeometry(t){let e=this.geometry;if(!!t.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have \"index\".');for(let n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing \"${n}\". All geometries must have consistent attributes.`);let i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error(`THREE.BatchedMesh: Added geometry attribute \"${n}\" has an inconsistent itemSize or normalized value.`)}}validateInstanceId(t){let e=this._instanceInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){let e=this._geometryInfo;if(t<0||t>=e.length||e[t].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new De);let t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error(\"THREE.BatchedMesh: Maximum item count reached.\");let n={visible:!0,active:!0,geometryIndex:t},i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(_u),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));let r=this._matricesTexture;ln.identity().toArray(r.image.data,i*16),r.needsUpdate=!0;let a=this._colorsTexture;return a&&(n_.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);let i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=e===-1?t.getAttribute(\"position\").count:e;let a=t.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?a.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error(\"THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.\");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(_u),l=this._availableGeometryIds.shift(),r[l]=i):(l=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(l,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error(\"THREE.BatchedMesh: Maximum geometry count reached.\");this._validateGeometry(e);let n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),a=e.getIndex(),o=this._geometryInfo[t];if(i&&a.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error(\"THREE.BatchedMesh: Reserved space not large enough for provided geometry.\");let l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=e.getAttribute(\"position\").count;for(let h in n.attributes){let d=e.getAttribute(h),u=n.getAttribute(h);a_(d,u,l);let f=d.itemSize;for(let p=d.count,_=c;p<_;p++){let m=l+p;for(let g=0;g=e.length||e[t].active===!1)return this;let n=this._instanceInfo;for(let i=0,r=n.length;io).sort((a,o)=>n[a].vertexStart-n[o].vertexStart),r=this.geometry;for(let a=0,o=n.length;a=this._geometryCount)return null;let n=this.geometry,i=this._geometryInfo[t];if(i.boundingBox===null){let r=new De,a=n.index,o=n.attributes.position;for(let l=i.start,c=i.start+i.count;l=this._geometryCount)return null;let n=this.geometry,i=this._geometryInfo[t];if(i.boundingSphere===null){let r=new Ie;this.getBoundingBoxAt(t,Gl),Gl.getCenter(r.center);let a=n.index,o=n.attributes.position,l=0;for(let c=i.start,h=i.start+i.count;co.active);if(Math.max(...n.map(o=>o.vertexStart+o.reservedVertexCount))>t)throw new Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(l=>l.indexStart+l.reservedIndexCount))>e)throw new Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Yt,this._initializeGeometry(r));let a=this.geometry;r.index&&zn(r.index.array,a.index.array);for(let o in r.attributes)zn(r.attributes[o].array,a.attributes[o].array);this._visibilityChanged=!0}raycast(t,e){let n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;Ye.material=this.material,Ye.geometry.index=a.index,Ye.geometry.attributes=a.attributes,Ye.geometry.boundingBox===null&&(Ye.geometry.boundingBox=new De),Ye.geometry.boundingSphere===null&&(Ye.geometry.boundingSphere=new Ie);for(let o=0,l=n.length;o({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=t._instanceInfo.map(e=>({...e})),this._availableInstanceIds=t._availableInstanceIds.slice(),this._availableGeometryIds=t._availableGeometryIds.slice(),this._nextIndexStart=t._nextIndexStart,this._nextVertexStart=t._nextVertexStart,this._geometryCount=t._geometryCount,this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._multiDrawBytesPerElement=t._multiDrawBytesPerElement,this._mergedDrawCounts=t._mergedDrawCounts.slice(),this._mergedDrawStarts=t._mergedDrawStarts.slice(),this._mergedDrawInstanceCounts=t._mergedDrawInstanceCounts.slice(),this._indirectTexture=t._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),t._colorsTexture!==null?(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()):this._colorsTexture=null,this}dispose(){super.dispose(),this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}_updateDrawParameters(t,e,n,i=\"multiDraw\"){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let r=e.getIndex(),a=r===null?1:r.array.BYTES_PER_ELEMENT,o=1;n.wireframe&&(o=2,a=e.attributes.position.count>65535?4:2);let l=this._instanceInfo,c=this._multiDrawStarts,h=this._multiDrawCounts,d=this._mergedDrawStarts,u=this._mergedDrawCounts,f=this._mergedDrawInstanceCounts,p=this._geometryInfo,_=this.perObjectFrustumCulled,m=this._indirectTexture,g=m.image.data,v=t.isArrayCamera?s_:i_;_&&(t.isArrayCamera?v.setFromArrayCamera(t):(ln.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse).multiply(this.matrixWorld),v.setFromProjectionMatrix(ln,t.coordinateSystem,t.reversedDepth)));let S=0,y=0;if(this.sortObjects){ln.copy(this.matrixWorld).invert(),Df.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ln),Nf.set(0,0,-1).transformDirection(t.matrixWorld).transformDirection(ln);for(let x=0,b=l.length;x0&&d[y-1]===R&&u[y-1]===L?f[y-1]++:(d[y]=R,u[y]=L,f[y]=1,y++):(c[S]=R,h[S]=L),g[S]=I.index,S++}vu.reset()}else for(let E=0,A=l.length;E0&&d[y-1]===R&&u[y-1]===L?f[y-1]++:(d[y]=R,u[y]=L,f[y]=1,y++):(c[S]=R,h[S]=L),g[S]=E,S++}}m.needsUpdate=!0,this._multiDrawCount=S,this._mergedDrawCount=y,this._multiDrawBytesPerElement=a,this._visibilityChanged=!1}onBeforeRender(t,e,n,i,r){t.isWebGPURenderer===!0?(this._visibilityChanged||this.perObjectFrustumCulled||this.sortObjects)&&(this._indirectTexture.needsUpdate=!0):this._updateDrawParameters(n,i,r)}onBeforeShadow(t,e,n,i,r,a){t.isWebGPURenderer!==!0&&this._updateDrawParameters(i,r,a)}},ke=class extends Pe{constructor(t){super(),this.isLineBasicMaterial=!0,this.type=\"LineBasicMaterial\",this.color=new bt(16777215),this.map=null,this.linewidth=1,this.linecap=\"round\",this.linejoin=\"round\",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},vc=new C,yc=new C,Uf=new Vt,ea=new ci,Hl=new Ie,yu=new C,Ff=new C,Nn=class extends oe{constructor(t=new Yt,e=new ke){super(),this.isLine=!0,this.type=\"Line\",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0?this.morphTargetInfluences=t.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,t.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[0];for(let i=1,r=e.count;i0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;rn)return;yu.applyMatrix4(s.matrixWorld);let c=t.ray.origin.distanceTo(yu);if(!(ct.far))return{distance:c,point:Ff.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}var Of=new C,Bf=new C,gn=class extends Nn{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type=\"LineSegments\"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,n=[];for(let i=0,r=e.count;i0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,a=i.length;ri.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}var Ca=class extends Te{constructor(t,e,n,i,r=xe,a=xe,o,l,c){super(t,e,n,i,r,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let h=this;function d(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=t.requestVideoFrameCallback(d)}\"requestVideoFrameCallback\"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(d))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;\"requestVideoFrameCallback\"in t===!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},Sc=class extends Ca{constructor(t,e,n,i,r,a,o,l){super({},t,e,n,i,r,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}},Mc=class extends Te{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=be,this.minFilter=be,this.generateMipmaps=!1,this.needsUpdate=!0}copy(t){return super.copy(t),this.source=new mn(Object.assign({},t.image)),this}},os=class extends Te{constructor(t=[],e,n,i,r,a,o,l,c,h,d,u){super(null,a,o,l,c,h,i,r,d,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}},bc=class extends os{constructor(t,e,n,i,r,a){super(t,e,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=nn,this.layerUpdates=new Set}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},Tc=class extends os{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,Zn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},Ri=class extends Te{constructor(t=[],e=Zn,n,i,r,a,o,l,c,h){super(t,e,n,i,r,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},Ac=class extends Te{constructor(t,e,n,i,r,a,o,l,c){super(t,e,n,i,r,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},Ec=class extends Te{constructor(t,e,n,i,r,a,o,l,c){super(t,e,n,i,r,a,o,l,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let h=t?t.parentNode:null;h!==null&&\"requestPaint\"in h&&(h.onpaint=()=>{this.needsUpdate=!0},h.requestPaint())}dispose(){let t=this.image?this.image.parentNode:null;t!==null&&\"onpaint\"in t&&(t.onpaint=null),super.dispose()}},Xn=class extends Te{constructor(t,e,n=_n,i,r,a,o=be,l=be,c,h=Vn,d=1){if(h!==Vn&&h!==Jn)throw new Error(\"THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat\");let u={width:t,height:e,depth:d};super(u,i,r,a,o,l,h,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new mn(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return e.compareFunction=this.compareFunction,e}},ar=class extends Xn{constructor(t,e=_n,n=Zn,i,r,a=be,o=be,l,c=Vn){let h={width:t,height:t,depth:1},d=[h,h,h,h,h,h];super(t,t,e,n,i,r,a,o,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},or=class extends Te{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}},Ci=class s extends Yt{constructor(t=1,e=1,n=1,i=1,r=1,a=1){super(),this.type=\"BoxGeometry\",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};let o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);let l=[],c=[],h=[],d=[],u=0,f=0;p(\"z\",\"y\",\"x\",-1,-1,n,e,t,a,r,0),p(\"z\",\"y\",\"x\",1,-1,n,e,-t,a,r,1),p(\"x\",\"z\",\"y\",1,1,t,n,e,i,a,2),p(\"x\",\"z\",\"y\",1,-1,t,n,-e,i,a,3),p(\"x\",\"y\",\"z\",1,-1,t,e,n,i,r,4),p(\"x\",\"y\",\"z\",-1,-1,t,e,-n,i,r,5),this.setIndex(l),this.setAttribute(\"position\",new Tt(c,3)),this.setAttribute(\"normal\",new Tt(h,3)),this.setAttribute(\"uv\",new Tt(d,2));function p(_,m,g,v,S,y,E,A,x,b,I){let R=y/x,L=E/b,F=y/2,H=E/2,D=A/2,k=x+1,X=b+1,G=0,nt=0,W=new C;for(let Q=0;Q0?1:-1,h.push(W.x,W.y,W.z),d.push(Et/x),d.push(1-Q/b),G+=1}}for(let Q=0;Q0){let I=(v-1)*_;for(let R=0;R0&&S(!0),e>0&&S(!1)),this.setIndex(h),this.setAttribute(\"position\",new Tt(d,3)),this.setAttribute(\"normal\",new Tt(u,3)),this.setAttribute(\"uv\",new Tt(f,2));function v(){let y=new C,E=new C,A=0,x=(e-t)/n;for(let b=0;b<=r;b++){let I=[],R=b/r,L=R*(e-t)+t;for(let F=0;F<=i;F++){let H=F/i,D=H*l+o,k=Math.sin(D),X=Math.cos(D);E.x=L*k,E.y=-R*n+m,E.z=L*X,d.push(E.x,E.y,E.z),y.set(k,x,X).normalize(),u.push(y.x,y.y,y.z),f.push(H,1-R),I.push(p++)}_.push(I)}for(let b=0;b0||I!==0)&&(h.push(R,L,H),A+=3),(e>0||I!==r-1)&&(h.push(L,F,H),A+=3)}c.addGroup(g,A,0),g+=A}function S(y){let E=p,A=new et,x=new C,b=0,I=y===!0?t:e,R=y===!0?1:-1;for(let F=1;F<=i;F++)d.push(0,m*R,0),u.push(0,R,0),f.push(.5,.5),p++;let L=p;for(let F=0;F<=i;F++){let D=F/i*l+o,k=Math.cos(D),X=Math.sin(D);x.x=I*X,x.y=m*R,x.z=I*k,d.push(x.x,x.y,x.z),u.push(0,R,0),A.x=k*.5+.5,A.y=X*.5*R+.5,f.push(A.x,A.y),p++}for(let F=0;F.9&&x<.1&&(S<.2&&(a[v+0]+=1),y<.2&&(a[v+2]+=1),E<.2&&(a[v+4]+=1))}}function u(v){r.push(v.x,v.y,v.z)}function f(v,S){let y=v*3;S.x=t[y+0],S.y=t[y+1],S.z=t[y+2]}function p(){let v=new C,S=new C,y=new C,E=new C,A=new et,x=new et,b=new et;for(let I=0,R=0;I0)l=i-1;else{l=i;break}if(i=l,n[i]===a)return i/(r-1);let h=n[i],u=n[i+1]-h,f=(a-h)/u;return(i+f)/(r-1)}getTangent(t,e){let i=t-1e-4,r=t+1e-4;i<0&&(i=0),r>1&&(r=1);let a=this.getPoint(i),o=this.getPoint(r),l=e||(a.isVector2?new et:new C);return l.copy(o).sub(a).normalize(),l}getTangentAt(t,e){let n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e=!1){let n=new C,i=[],r=[],a=[],o=new C,l=new Vt;for(let f=0;f<=t;f++){let p=f/t;i[f]=this.getTangentAt(p,new C)}r[0]=new C,a[0]=new C;let c=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),u=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),u<=c&&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 f=1;f<=t;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();let p=Math.acos(Gt(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(l.makeRotationAxis(o,p))}a[f].crossVectors(i[f],r[f])}if(e===!0){let f=Math.acos(Gt(r[0].dot(r[t]),-1,1));f/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(f=-f);for(let p=1;p<=t;p++)r[p].applyMatrix4(l.makeRotationAxis(i[p],f*p)),a[p].crossVectors(i[p],r[p])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this.cacheArcLengths=null,this}toJSON(){let t={metadata:{version:4.7,type:\"Curve\",generator:\"Curve.toJSON\"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this.cacheArcLengths=null,this}},ls=class extends dn{constructor(t=0,e=0,n=1,i=1,r=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type=\"EllipseCurve\",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(t,e=new et){let n=e,i=Math.PI*2,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%r]:(Vf.subVectors(i[0],i[1]).add(i[0]),c=Vf);let d=i[o%r],u=i[(o+1)%r];if(this.closed||o+2i.length-2?i.length-1:a+1],d=i[a>i.length-3?i.length-1:a+2];return n.set(Hf(o,l.x,c.x,h.x,d.x),Hf(o,l.y,c.y,h.y,d.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=n){let a=i[r]-n,o=this.curves[r],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){let d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);let h=c.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},Pi=class extends Ii{constructor(t){super(t),this.uuid=En(),this.type=\"Shape\",this.holes=[]}getPointsHoles(t){let e=[];for(let n=0,i=this.holes.length;n80*e){o=s[0],l=s[1];let h=o,d=l;for(let u=e;uh&&(h=f),p>d&&(d=p)}c=Math.max(h-o,d-l),c=c!==0?32767/c:0}return za(r,a,e,o,l,c,0),a}function Sm(s,t,e,n,i){let r;if(i===I_(s,t,e,n)>0)for(let a=t;a=t;a-=n)r=Wf(a/n|0,s[a],s[a+1],r);return r&&mr(r,r.next)&&(Ga(r),r=r.next),r}function cs(s,t){if(!s)return s;t||(t=s);let e=s,n;do if(n=!1,!e.steiner&&(mr(e,e.next)||ye(e.prev,e,e.next)===0)){if(Ga(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function za(s,t,e,n,i,r,a){if(!s)return;!a&&r&&T_(s,n,i,r);let o=s;for(;s.prev!==s.next;){let l=s.prev,c=s.next;if(r?g_(s,n,i,r):m_(s)){t.push(l.i,s.i,c.i),Ga(s),s=c.next,o=c.next;continue}if(s=c,s===o){a?a===1?(s=__(cs(s),t),za(s,t,e,n,i,r,2)):a===2&&x_(s,t,e,n,i,r):za(cs(s),t,e,n,i,r,1);break}}}function m_(s){let t=s.prev,e=s,n=s.next;if(ye(t,e,n)>=0)return!1;let i=t.x,r=e.x,a=n.x,o=t.y,l=e.y,c=n.y,h=Math.min(i,r,a),d=Math.min(o,l,c),u=Math.max(i,r,a),f=Math.max(o,l,c),p=n.next;for(;p!==t;){if(p.x>=h&&p.x<=u&&p.y>=d&&p.y<=f&&ia(i,o,r,l,a,c,p.x,p.y)&&ye(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function g_(s,t,e,n){let i=s.prev,r=s,a=s.next;if(ye(i,r,a)>=0)return!1;let o=i.x,l=r.x,c=a.x,h=i.y,d=r.y,u=a.y,f=Math.min(o,l,c),p=Math.min(h,d,u),_=Math.max(o,l,c),m=Math.max(h,d,u),g=Nu(f,p,t,e,n),v=Nu(_,m,t,e,n),S=s.prevZ,y=s.nextZ;for(;S&&S.z>=g&&y&&y.z<=v;){if(S.x>=f&&S.x<=_&&S.y>=p&&S.y<=m&&S!==i&&S!==a&&ia(o,h,l,d,c,u,S.x,S.y)&&ye(S.prev,S,S.next)>=0||(S=S.prevZ,y.x>=f&&y.x<=_&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ia(o,h,l,d,c,u,y.x,y.y)&&ye(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;S&&S.z>=g;){if(S.x>=f&&S.x<=_&&S.y>=p&&S.y<=m&&S!==i&&S!==a&&ia(o,h,l,d,c,u,S.x,S.y)&&ye(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;y&&y.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&ia(o,h,l,d,c,u,y.x,y.y)&&ye(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function __(s,t){let e=s;do{let n=e.prev,i=e.next.next;!mr(n,i)&&bm(n,e,e.next,i)&&ka(n,i)&&ka(i,n)&&(t.push(n.i,e.i,i.i),Ga(e),Ga(e.next),e=s=i),e=e.next}while(e!==s);return cs(e)}function x_(s,t,e,n,i,r){let a=s;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&w_(a,o)){let l=Tm(a,o);a=cs(a,a.next),l=cs(l,l.next),za(a,t,e,n,i,r,0),za(l,t,e,n,i,r,0);return}o=o.next}a=a.next}while(a!==s)}function v_(s,t,e,n){let i=[];for(let r=0,a=t.length;r=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>r&&(r=d,a=e.x=e.x&&e.x>=l&&n!==e.x&&Mm(ia.x||e.x===a.x&&b_(a,e)))&&(a=e,h=d)}e=e.next}while(e!==o);return a}function b_(s,t){return ye(s.prev,s,t.prev)<0&&ye(t.next,s,s.next)<0}function T_(s,t,e,n){let i=s;do i.z===0&&(i.z=Nu(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,A_(i)}function A_(s){let t,e=1;do{let n=s,i;s=null;let r=null;for(t=0;n;){t++;let a=n,o=0;for(let c=0;c0||l>0&&a;)o!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,l--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;n=a}r.nextZ=null,e*=2}while(t>1);return s}function Nu(s,t,e,n,i){return s=(s-e)*i|0,t=(t-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function E_(s){let t=s,e=s;do(t.x=(s-a)*(r-o)&&(s-a)*(n-o)>=(e-a)*(t-o)&&(e-a)*(r-o)>=(i-a)*(n-o)}function ia(s,t,e,n,i,r,a,o){return!(s===a&&t===o)&&Mm(s,t,e,n,i,r,a,o)}function w_(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!R_(s,t)&&(ka(s,t)&&ka(t,s)&&C_(s,t)&&(ye(s.prev,s,t.prev)||ye(s,t.prev,t))||mr(s,t)&&ye(s.prev,s,s.next)>0&&ye(t.prev,t,t.next)>0)}function ye(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function mr(s,t){return s.x===t.x&&s.y===t.y}function bm(s,t,e,n){let i=Kl(ye(s,t,e)),r=Kl(ye(s,t,n)),a=Kl(ye(e,n,s)),o=Kl(ye(e,n,t));return!!(i!==r&&a!==o||i===0&&$l(s,e,t)||r===0&&$l(s,n,t)||a===0&&$l(e,s,n)||o===0&&$l(e,t,n))}function $l(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Kl(s){return s>0?1:s<0?-1:0}function R_(s,t){let e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&bm(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function ka(s,t){return ye(s.prev,s,s.next)<0?ye(s,t,s.next)>=0&&ye(s,s.prev,t)>=0:ye(s,t,s.prev)<0||ye(s,s.next,t)<0}function C_(s,t){let e=s,n=!1,i=(s.x+t.x)/2,r=(s.y+t.y)/2;do e.y>r!=e.next.y>r&&e.next.y!==e.y&&i<(e.next.x-e.x)*(r-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==s);return n}function Tm(s,t){let e=Uu(s.i,s.x,s.y),n=Uu(t.i,t.x,t.y),i=s.next,r=t.prev;return s.next=t,t.prev=s,e.next=i,i.prev=e,n.next=e,e.prev=n,r.next=n,n.prev=r,n}function Wf(s,t,e,n){let i=Uu(s,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ga(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Uu(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function I_(s,t,e,n){let i=0;for(let r=t,a=e-n;r2&&s[t-1].equals(s[0])&&s.pop()}function qf(s,t){for(let e=0;eNumber.EPSILON){let Qt=Math.sqrt(U),pe=Math.sqrt(ne*ne+ae*ae),ft=ct.x-ee/Qt,Se=ct.y+Dt/Qt,Bt=at.x-ae/pe,Ht=at.y+ne/pe,w=((Bt-ft)*ae-(Ht-Se)*ne)/(Dt*ae-ee*ne);At=ft+Dt*w-j.x,_t=Se+ee*w-j.y;let M=At*At+_t*_t;if(M<=2)return new et(At,_t);qt=Math.sqrt(M/2)}else{let Qt=!1;Dt>Number.EPSILON?ne>Number.EPSILON&&(Qt=!0):Dt<-Number.EPSILON?ne<-Number.EPSILON&&(Qt=!0):Math.sign(ee)===Math.sign(ae)&&(Qt=!0),Qt?(At=-ee,_t=Dt,qt=Math.sqrt(U)):(At=Dt,_t=ee,qt=Math.sqrt(U/2))}return new et(At/qt,_t/qt)}let W=[];for(let j=0,ct=k.length,at=ct-1,At=j+1;j=0;j--){let ct=j/m,at=f*Math.cos(ct*Math.PI/2),At=p*Math.sin(ct*Math.PI/2)+_;for(let _t=0,qt=k.length;_t=0;){let At=at,_t=at-1;_t<0&&(_t=j.length-1);for(let qt=0,Dt=h+m*2;qt0)&&f.push(S,y,A),(g!==n-1||l0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}fromJSON(t,e){if(super.fromJSON(t,e),t.uniforms!==void 0)for(let n in t.uniforms){let i=t.uniforms[n];switch(this.uniforms[n]={},i.type){case\"t\":this.uniforms[n].value=e[i.value]||null;break;case\"c\":this.uniforms[n].value=new bt().setHex(i.value);break;case\"v2\":this.uniforms[n].value=new et().fromArray(i.value);break;case\"v3\":this.uniforms[n].value=new C().fromArray(i.value);break;case\"v4\":this.uniforms[n].value=new ue().fromArray(i.value);break;case\"m3\":this.uniforms[n].value=new Wt().fromArray(i.value);break;case\"m4\":this.uniforms[n].value=new Vt().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(let n in t.extensions)this.extensions[n]=t.extensions[n];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}},xr=class extends Mn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type=\"RawShaderMaterial\"}},vr=class extends Pe{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type=\"MeshStandardMaterial\",this.defines={STANDARD:\"\"},this.color=new bt(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 bt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new et(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 Sn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:\"\"},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},ja=class extends vr{constructor(t){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 et(1,1),this.clearcoatNormalMap=null,this.diffuseRoughnessMap=null,this.ior=1.5,Object.defineProperty(this,\"reflectivity\",{get:function(){return Gt(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.iridescenceThicknessMinimum=100,this.iridescenceThicknessMaximum=400,this.iridescenceThicknessMap=null,this.sheenColor=new bt(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 bt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new bt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._diffuseRoughness=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get diffuseRoughness(){return this._diffuseRoughness}set diffuseRoughness(t){this._diffuseRoughness>0!=t>0&&this.version++,this._diffuseRoughness=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(t){this._retroreflectivity>0!=t>0&&this.version++,this._retroreflectivity=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}get iridescenceThicknessRange(){return Gn('MeshPhysicalMaterial: The \"iridescenceThicknessRange\" property has been replaced by \"iridescenceThicknessMinimum\" and \"iridescenceThicknessMaximum\".'),[this.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum]}set iridescenceThicknessRange(t){Gn('MeshPhysicalMaterial: The \"iridescenceThicknessRange\" property has been replaced by \"iridescenceThicknessMinimum\" and \"iridescenceThicknessMaximum\".'),this.iridescenceThicknessMinimum=t[0],this.iridescenceThicknessMaximum=t[1]}copy(t){return super.copy(t),this.defines={STANDARD:\"\",PHYSICAL:\"\"},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.diffuseRoughness=t.diffuseRoughness,this.diffuseRoughnessMap=t.diffuseRoughnessMap,this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessMinimum=t.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum=t.iridescenceThicknessMaximum,this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.retroreflectivity=t.retroreflectivity,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}},to=class extends Pe{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type=\"MeshPhongMaterial\",this.color=new bt(16777215),this.specular=new bt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Sn,this.combine=Ir,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},eo=class extends Pe{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:\"\"},this.type=\"MeshToonMaterial\",this.color=new bt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},no=class extends Pe{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type=\"MeshNormalMaterial\",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}},io=class extends Pe{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type=\"MeshLambertMaterial\",this.color=new bt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new bt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Sn,this.combine=Ir,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}},yr=class extends Pe{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type=\"MeshDepthMaterial\",this.depthPacking=xd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Sr=class extends Pe{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type=\"MeshDistanceMaterial\",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},so=class extends Pe{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:\"\"},this.type=\"MeshMatcapMaterial\",this.color=new bt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$n,this.normalScale=new et(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:\"\"},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this.fog=t.fog,this}},ro=class extends ke{constructor(t){super(),this.isLineDashedMaterial=!0,this.type=\"LineDashedMaterial\",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}};function Pn(s,t){return!s||s.constructor===t?s:typeof t.BYTES_PER_ELEMENT==\"number\"?new t(s):Array.prototype.slice.call(s)}function Hs(s){return s!==void 0&&s.inTangents!==void 0&&s.outTangents!==void 0}function Am(s){function t(i,r){return s[i]-s[r]}let e=s.length,n=new Array(e);for(let i=0;i!==e;++i)n[i]=i;return n.sort(t),n}function Ou(s,t,e){let n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){let o=e[r]*t;for(let l=0;l!==t;++l)i[a++]=s[o+l]}return i}function Em(s,t,e,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(t.push(r.time),e.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(t.push(r.time),a.toArray(e,e.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(t.push(r.time),e.push(a)),r=s[i++];while(r!==void 0)}function O_(s,t,e,n,i=30){let r=s.clone();r.name=t;let a=[];for(let l=0;l=n)){d.push(c.times[f]);for(let _=0;_r.tracks[l].times[0]&&(o=r.tracks[l].times[0]);for(let l=0;l=o.times[p]){let g=p*d+h,v=g+d-h;_=o.values.slice(g,v)}else{let g=o.createInterpolant();g.evaluate(r),_=g.resultBuffer.slice()}l===\"quaternion\"&&new ze().fromArray(_).normalize().conjugate().toArray(_);let m=c.times.length;for(let g=0;g=r)){let o=e[1];t=r)break e}a=n,n=0;break n}break t}for(;n>>1;te;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);let o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(Lt(\"KeyframeTrack: Invalid value size in track.\",this),t=!1);let n=this.times,i=this.values,r=n.length;r===0&&(Lt(\"KeyframeTrack: Track is empty.\",this),t=!1);let a=null;for(let o=0;o!==r;o++){let l=n[o];if(typeof l==\"number\"&&isNaN(l)){Lt(\"KeyframeTrack: Time is not a valid number.\",this,o,l),t=!1;break}if(a!==null&&a>l){Lt(\"KeyframeTrack: Out of order keys.\",this,o,l,a),t=!1;break}a=l}if(i!==void 0&&dm(i))for(let o=0,l=i.length;o!==l;++o){let c=i[o];if(isNaN(c)){Lt(\"KeyframeTrack: Value is not a valid number.\",this,o,c),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===sa,r=t.length-1,a=1;for(let o=1;o0){t[a]=t[r];for(let o=r*n,l=a*n,c=0;c!==n;++c)e[l+c]=e[o+c];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,Hs(this.settings)&&(i.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),i}};function $f(s,t){for(let e=0,n=s.length;e!==n;e+=2)s[e]+=t}function Kf(s,t){for(let e=0,n=s.length;e!==n;e+=2)s[e]*=t}an.prototype.ValueTypeName=\"\";an.prototype.TimeBufferType=Float32Array;an.prototype.ValueBufferType=Float32Array;an.prototype.DefaultInterpolation=ga;var qn=class extends an{constructor(t,e,n){super(t,e,n)}};qn.prototype.ValueTypeName=\"bool\";qn.prototype.ValueBufferType=Array;qn.prototype.DefaultInterpolation=Ys;qn.prototype.InterpolantFactoryMethodLinear=void 0;qn.prototype.InterpolantFactoryMethodSmooth=void 0;var br=class extends an{constructor(t,e,n,i){super(t,e,n,i)}};br.prototype.ValueTypeName=\"color\";var us=class extends an{constructor(t,e,n,i){super(t,e,n,i)}};us.prototype.ValueTypeName=\"number\";var co=class extends di{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-e)/(i-e),c=t*o;for(let h=c+o;c!==h;c+=4)ze.slerpFlat(r,0,a,c-o,a,c,l);return r}},ds=class extends an{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new co(this.times,this.values,this.getValueSize(),t)}};ds.prototype.ValueTypeName=\"quaternion\";ds.prototype.InterpolantFactoryMethodSmooth=void 0;var Yn=class extends an{constructor(t,e,n){super(t,e,n)}};Yn.prototype.ValueTypeName=\"string\";Yn.prototype.ValueBufferType=Array;Yn.prototype.DefaultInterpolation=Ys;Yn.prototype.InterpolantFactoryMethodLinear=void 0;Yn.prototype.InterpolantFactoryMethodSmooth=void 0;var Tr=class extends an{constructor(t,e,n,i){super(t,e,n,i)}};Tr.prototype.ValueTypeName=\"vector\";var Li=class{constructor(t=\"\",e=-1,n=[],i=hl){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=En(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){let e=[],n=t.tracks,i=1/(t.fps||1);for(let a=0,o=n.length;a!==o;++a)e.push(V_(n[a]).scale(i));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||\"{}\"),r}static toJSON(t){let e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let r=0,a=n.length;r!==a;++r)e.push(an.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(t,e,n,i){let r=e.length,a=[];for(let o=0;o1){let d=h[1],u=i[d];u||(i[d]=u=[]),u.push(c)}}let a=[];for(let o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],e,n));return a}resetDuration(){let t=this.tracks,e=0;for(let n=0,i=t.length;n!==i;++n){let r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t{e&&e(r),this.manager.itemEnd(t)},0);return}if(ri[t]!==void 0){ri[t].push({onLoad:e,onProgress:n,onError:i});return}ri[t]=[],ri[t].push({onLoad:e,onProgress:n,onError:i});let a=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?\"include\":\"same-origin\",priority:this.priority,cache:this.cache,signal:typeof AbortSignal.any==\"function\"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&>(\"FileLoader: HTTP Status 0 received.\"),typeof ReadableStream>\"u\"||c.body===void 0||c.body.getReader===void 0)return c;let h=ri[t],d=c.body.getReader(),u=c.headers.get(\"X-File-Size\")||c.headers.get(\"Content-Length\"),f=u?parseInt(u):0,p=f!==0,_=0,m=new ReadableStream({start(g){v();function v(){d.read().then(({done:S,value:y})=>{if(S)g.close();else{_+=y.byteLength;let E=new ProgressEvent(\"progress\",{lengthComputable:p,loaded:_,total:f});for(let A=0,x=h.length;A{g.error(S)})}}});return new Response(m)}else throw new Bu(`fetch for \"${c.url}\" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case\"arraybuffer\":return c.arrayBuffer();case\"blob\":return c.blob();case\"document\":return c.text().then(h=>new DOMParser().parseFromString(h,o));case\"json\":return c.json();default:if(o===\"\")return c.text();{let d=/charset=\"?([^;\"\\s]*)\"?/i.exec(o),u=d&&d[1]?d[1].toLowerCase():void 0,f=new TextDecoder(u);return c.arrayBuffer().then(p=>f.decode(p))}}}).then(c=>{Dn.add(`file:${t}`,c);let h=ri[t];delete ri[t];for(let d=0,u=h.length;d{let h=ri[t];if(h===void 0)throw this.manager.itemError(t),c;delete ri[t];for(let d=0,u=h.length;d{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},Cc=class extends Ve{constructor(t){super(t)}load(t,e,n,i){let r=this,a=new bn(this.manager);a.setPriority(this.priority),a.setCache(this.cache),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(o){try{e(r.parse(JSON.parse(o)))}catch(l){i?i(l):Lt(l),r.manager.itemError(t)}},n,i)}parse(t){let e=[];for(let n=0;n0){let l=new Ar(e);r=new Di(l),r.setPriority(this.priority),r.setCache(this.cache),r.setCrossOrigin(this.crossOrigin);for(let c=0,h=t.length;c0){i=new Di(this.manager),i.setPriority(this.priority),i.setCache(this.cache),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=t.length;a{let g=null,v=null;return m.boundingBox!==void 0&&(g=new De().fromJSON(m.boundingBox)),m.boundingSphere!==void 0&&(v=new Ie().fromJSON(m.boundingSphere)),{...m,boundingBox:g,boundingSphere:v}}),a._instanceInfo=t.instanceInfo,a._availableInstanceIds=t.availableInstanceIds,a._availableGeometryIds=t.availableGeometryIds,a._nextIndexStart=t.nextIndexStart,a._nextVertexStart=t.nextVertexStart,a._geometryCount=t.geometryCount,a._maxInstanceCount=t.maxInstanceCount,a._maxVertexCount=t.maxVertexCount,a._maxIndexCount=t.maxIndexCount,a._geometryInitialized=t.geometryInitialized,a._matricesTexture=c(t.matricesTexture.uuid),a._indirectTexture=c(t.indirectTexture.uuid),t.colorsTexture!==void 0&&(a._colorsTexture=c(t.colorsTexture.uuid)),t.boundingSphere!==void 0&&(a.boundingSphere=new Ie().fromJSON(t.boundingSphere)),t.boundingBox!==void 0&&(a.boundingBox=new De().fromJSON(t.boundingBox));break;case\"LOD\":a=new Ma;break;case\"Line\":a=new Nn(o(t.geometry),l(t.material));break;case\"LineLoop\":a=new wa(o(t.geometry),l(t.material));break;case\"LineSegments\":a=new gn(o(t.geometry),l(t.material));break;case\"PointCloud\":case\"Points\":a=new Ra(o(t.geometry),l(t.material));break;case\"Sprite\":a=new Sa(l(t.material)),t.center!==void 0&&a.center.fromArray(t.center);break;case\"Group\":a=new oi;break;case\"Bone\":a=new ir;break;default:a=new oe}if(a.uuid=t.uuid,t.name!==void 0&&(a.name=t.name),t.pivot!==void 0&&(a.pivot=new C().fromArray(t.pivot)),t.matrix!==void 0?(a.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&(a.matrix.decompose(a.position,a.quaternion,a.scale),a.pivot!==null&&a.position.copy(a.pivot).applyMatrix4(a.matrix).sub(a.pivot))):(t.position!==void 0&&a.position.fromArray(t.position),t.rotation!==void 0&&a.rotation.fromArray(t.rotation),t.quaternion!==void 0&&a.quaternion.fromArray(t.quaternion),t.scale!==void 0&&a.scale.fromArray(t.scale)),t.up!==void 0&&a.up.fromArray(t.up),t.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),t.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=t.morphTargetInfluences.slice()),t.castShadow!==void 0&&(a.castShadow=t.castShadow),t.receiveShadow!==void 0&&(a.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.intensity!==void 0&&(a.shadow.intensity=t.shadow.intensity),t.shadow.bias!==void 0&&(a.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(a.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(a.shadow.radius=t.shadow.radius),t.shadow.blurSamples!==void 0&&(a.shadow.blurSamples=t.shadow.blurSamples),t.shadow.focus!==void 0&&(a.shadow.focus=t.shadow.focus),t.shadow.aspect!==void 0&&(a.shadow.aspect=t.shadow.aspect),t.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.mapType!==void 0&&(a.shadow.mapType=t.shadow.mapType),t.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(a.visible=t.visible),t.frustumCulled!==void 0&&(a.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(a.renderOrder=t.renderOrder),t.static!==void 0&&(a.static=t.static),t.userData!==void 0&&(a.userData=t.userData),t.layers!==void 0&&(a.layers.mask=t.layers),t.children!==void 0){let u=t.children;for(let f=0;f\"u\"&>(\"ImageBitmapLoader: createImageBitmap() not supported.\"),typeof fetch>\"u\"&>(\"ImageBitmapLoader: fetch() not supported.\"),this.options={premultiplyAlpha:\"none\"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,n,i){t===void 0&&(t=\"\"),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,a=Dn.get(`image-bitmap:${t}`);if(a!==void 0){if(r.manager.itemStart(t),a.then){a.then(c=>{wu.has(a)===!0?(i&&i(wu.get(a)),r.manager.itemError(t),r.manager.itemEnd(t)):(e&&e(c),r.manager.itemEnd(t))});return}setTimeout(function(){e&&e(a),r.manager.itemEnd(t)},0);return}let o={};o.credentials=this.withCredentials||this.crossOrigin!==\"anonymous\"?\"include\":\"same-origin\",o.headers=this.requestHeader,o.priority=this.priority,o.cache=this.cache,o.signal=typeof AbortSignal.any==\"function\"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let l=fetch(t,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign({},r.options,{colorSpaceConversion:\"none\"}))}).then(function(c){return Dn.add(`image-bitmap:${t}`,c),e&&e(c),r.manager.itemEnd(t),c}).catch(function(c){i&&i(c),wu.set(l,c),Dn.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});Dn.add(`image-bitmap:${t}`,l),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},tc,Rr=class{static getContext(){return tc===void 0&&(tc=new(window.AudioContext||window.webkitAudioContext)),tc}static setContext(t){tc=t}},Fc=class extends Ve{constructor(t){super(t)}load(t,e,n,i){let r=this,a=new bn(this.manager);a.setPriority(this.priority),a.setCache(this.cache),a.setResponseType(\"arraybuffer\"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,function(l){try{let c=l.slice(0),h=Rr.getContext(),d=t+\"#decode\";r.manager.itemStart(d),h.decodeAudioData(c,function(u){e(u),r.manager.itemEnd(d)}).catch(function(u){o(u),r.manager.itemEnd(d)})}catch(c){o(c)}},n,i);function o(l){i?i(l):Lt(l),r.manager.itemError(t)}}},ap=new Vt,op=new Vt,qi=new Vt,Oc=class{constructor(){this.type=\"StereoCamera\",this.aspect=1,this.eyeSep=.064,this.cameraL=new Le,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Le,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){let e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,qi.copy(t.projectionMatrix);let i=e.eyeSep/2,r=i*e.near/e.focus,a=e.near*Math.tan(ji*e.fov*.5)/e.zoom,o,l;op.elements[12]=-i,ap.elements[12]=i,o=-a*e.aspect+r,l=a*e.aspect+r,qi.elements[0]=2*e.near/(l-o),qi.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(qi),o=-a*e.aspect-r,l=a*e.aspect-r,qi.elements[0]=2*e.near/(l-o),qi.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(qi)}this.cameraL.matrix.copy(t.matrixWorld).multiply(op),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(t.matrixWorld).multiply(ap),this.cameraR.matrixWorldNeedsUpdate=!0}},Bs=-90,zs=1,gs=class extends oe{constructor(t,e,n){super(),this.type=\"CubeCamera\",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new Le(Bs,zs,t,e);i.layers=this.layers,this.add(i);let r=new Le(Bs,zs,t,e);r.layers=this.layers,this.add(r);let a=new Le(Bs,zs,t,e);a.layers=this.layers,this.add(a);let o=new Le(Bs,zs,t,e);o.layers=this.layers,this.add(o);let l=new Le(Bs,zs,t,e);l.layers=this.layers,this.add(l);let c=new Le(Bs,zs,t,e);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,i,r,a,o,l]=e;for(let c of e)this.remove(c);if(t===hn)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),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(t===Ai)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),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error(\"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: \"+t);for(let c of e)this.add(c),c.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[r,a,o,l,c,h]=this.children,d=t.getRenderTarget(),u=t.getActiveCubeFace(),f=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;let _=n.texture.mipmapsAutoUpdate;n.texture.mipmapsAutoUpdate=!1;let m=!1;t.isWebGLRenderer===!0?m=t.state.buffers.depth.getReversed():m=t.reversedDepthBuffer,t.setRenderTarget(n,0,i),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,r),t.setRenderTarget(n,1,i),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,a),t.setRenderTarget(n,2,i),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,o),t.setRenderTarget(n,3,i),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,l),t.setRenderTarget(n,4,i),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,c),n.texture.mipmapsAutoUpdate=_,t.setRenderTarget(n,5,i),m&&t.autoClear===!1&&t.clearDepth(),t.render(e,h),t.setRenderTarget(d,u,f),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},So=class extends Le{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t,this.perCameraFrustumCulled=!1}},Mo=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=W_.bind(this),t.addEventListener(\"visibilitychange\",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener(\"visibilitychange\",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function W_(){this._document.hidden===!1&&this.reset()}var Yi=new C,Ru=new ze,X_=new C,Zi=new C,Ji=new C,Bc=class extends oe{constructor(){super(),this.type=\"AudioListener\",this.context=Rr.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Mo}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t),this._timer.update();let e=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Yi,Ru,X_),Zi.set(0,0,-1).applyQuaternion(Ru),Ji.set(0,1,0).applyQuaternion(Ru),e.positionX){let n=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Yi.x,n),e.positionY.linearRampToValueAtTime(Yi.y,n),e.positionZ.linearRampToValueAtTime(Yi.z,n),e.forwardX.linearRampToValueAtTime(Zi.x,n),e.forwardY.linearRampToValueAtTime(Zi.y,n),e.forwardZ.linearRampToValueAtTime(Zi.z,n),e.upX.linearRampToValueAtTime(Ji.x,n),e.upY.linearRampToValueAtTime(Ji.y,n),e.upZ.linearRampToValueAtTime(Ji.z,n)}else e.setPosition(Yi.x,Yi.y,Yi.z),e.setOrientation(Zi.x,Zi.y,Zi.z,Ji.x,Ji.y,Ji.z)}},bo=class extends oe{constructor(t){super(),this.type=\"Audio\",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType=\"empty\",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType=\"audioNode\",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType=\"mediaNode\",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType=\"mediaStreamNode\",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType=\"buffer\",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0){gt(\"Audio: Audio is already playing.\");return}if(this.hasPlaybackControl===!1){gt(\"Audio: this Audio has no playback control.\");return}this._startedAt=this.context.currentTime+t;let e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){gt(\"Audio: this Audio has no playback control.\");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(t=0){if(this.hasPlaybackControl===!1){gt(\"Audio: this Audio has no playback control.\");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let l=e,c=e+e;l!==c;++l)if(n[l]!==n[l+e]){o.setValue(n,i);break}}saveOriginalState(){let t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let r=n,a=i;r!==a;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=this.valueSize*3;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let a=0;a!==r;++a)t[e+a]=t[n+a]}_slerp(t,e,n,i){ze.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){let a=this._workIndex*r;ze.multiplyQuaternionsFlat(t,a,t,e,t,n),ze.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,r){let a=1-i;for(let o=0;o!==r;++o){let l=e+o;t[l]=t[l]*a+t[n+o]*i}}_lerpAdditive(t,e,n,i,r){for(let a=0;a!==r;++a){let o=e+a;t[o]=t[o]+t[n+a]*i}}},Dd=\"\\\\[\\\\]\\\\.:\\\\/\",Y_=new RegExp(\"[\"+Dd+\"]\",\"g\"),Nd=\"[^\"+Dd+\"]\",Z_=\"[^\"+Dd.replace(\"\\\\.\",\"\")+\"]\",J_=/((?:WC+[\\/:])*)/.source.replace(\"WC\",Nd),$_=/(WCOD+)?/.source.replace(\"WCOD\",Z_),K_=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace(\"WC\",Nd),Q_=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace(\"WC\",Nd),j_=new RegExp(\"^\"+J_+$_+K_+Q_+\"$\"),t0=[\"material\",\"materials\",\"bones\",\"map\"],Vu=class{constructor(t,e,n){let i=n||he.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},he=class s{constructor(t,e,n){this.path=e,this.parsedPath=n||s.parseTrackName(e),this.node=s.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new s.Composite(t,e,n):new s(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\s/g,\"_\").replace(Y_,\"\")}static parseTrackName(t){let e=j_.exec(t);if(e===null)throw new Error(\"THREE.PropertyBinding: Cannot parse trackName: \"+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(\".\");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);t0.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error(\"THREE.PropertyBinding: can not parse propertyName from trackName: \"+t);return n}static findNode(t,e){if(e===void 0||e===\"\"||e===\".\"||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(r){for(let a=0;a=r){let d=r++,u=t[d];e[u.uuid]=h,t[h]=u,e[c]=d,t[d]=l;for(let f=0,p=i;f!==p;++f){let _=n[f],m=_[d],g=_[h];_[h]=m,_[d]=g}}}this.nCachedObjects_=r}uncache(){let t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=t.length;for(let o=0,l=arguments.length;o!==l;++o){let c=arguments[o],h=c.uuid,d=e[h];if(d!==void 0)if(delete e[h],d0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Fh:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case hl:default:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulate(i,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let n=this._timeScaleInterpolant;if(n!==null){let i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(e===0?this.paused=!0:(this._restoreTimeScale!==null&&(e=this._restoreTimeScale),this.timeScale=e),this.stopWarping())}}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,n=this.loop,i=this.time+t,r=this._loopCount,a=n===_d;if(t===0)return r===-1?i:a&&(r&1)===1?e-i:i;if(n===md){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else if(i<0)i=0;else{this.time=i;break t}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:\"finished\",action:this,direction:t<0?-1:1})}}else{if(r===-1&&(t>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=e||i<0){let o=Math.floor(i/e);i-=e*o,r+=Math.abs(o);let l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:\"finished\",action:this,direction:t>0?1:-1});else{if(l===1){let c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:\"loop\",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(a&&(r&1)===1)return e-i}return i}_setEndings(t,e,n){let i=this._interpolantSettings;n?(i.endingStart=Ti,i.endingEnd=Ti):(t?i.endingStart=this.zeroSlopeAtStart?Ti:bi:i.endingStart=Zs,e?i.endingEnd=this.zeroSlopeAtEnd?Ti:bi:i.endingEnd=Zs)}_scheduleFading(t,e,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let o=a.parameterPositions,l=a.sampleValues;return o[0]=r,l[0]=e,o[1]=r+t,l[1]=n,this}},e0=new Float32Array(1),Vc=class extends un{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<\"u\"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\",{detail:this}))}_bindAction(t,e){let n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,a=t._propertyBindings,o=t._interpolants,l=n.uuid,c=this._bindingsByRootAndName,h=c[l];h===void 0&&(h={},c[l]=h);for(let d=0;d!==r;++d){let u=i[d],f=u.name,p=h[f];if(p!==void 0)++p.referenceCount,a[d]=p;else{if(p=a[d],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,f));continue}let _=e&&e._propertyBindings[d].binding.parsedPath;p=new To(he.create(n,f,_),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),a[d]=p}o[d].resultBuffer=p.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){let n=(t._localRoot||this._root).uuid,i=t._clip.uuid,r=this._actionsByClip[i];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,i,n)}let e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){let r=e[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let n=0,i=e.length;n!==i;++n){let r=e[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return e!==null&&e=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;let e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1;for(let c=0;c!==n;++c)e[c]._update(i,t,r,a);let o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(t){this.time=0;for(let e=0;ea.clone())):this.uniforms.push(r.clone())}return this}clone(){return new this.constructor().copy(this)}},qc=class extends as{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){let e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){let e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}},Yc=class{constructor(t,e,n,i,r,a=!1){this.isGLBufferAttribute=!0,this.name=\"\",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.normalized=a,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},cp=new Vt,Zc=class{constructor(t,e,n=0,i=1/0){this.ray=new ci(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new ss,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,e.projectionMatrix.elements[14]).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):Lt(\"Raycaster: Unsupported camera type: \"+e.type)}setFromXRController(t){return cp.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(cp),this}intersectObject(t,e=!0,n=[]){return Hu(t,this,n,e),n.sort(hp),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,up).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},dp=new C,ec=new C,ks=new C,Gs=new C,Cu=new C,i0=new C,s0=new C,jc=class{constructor(t=new C,e=new C){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){dp.subVectors(t,this.start),ec.subVectors(this.end,this.start);let n=ec.dot(ec);if(n===0)return 0;let r=ec.dot(dp)/n;return e&&(r=Gt(r,0,1)),r}closestPointToPoint(t,e,n){let i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=i0,n=s0){let i=10000000000000001e-32,r,a,o=this.start,l=t.start,c=this.end,h=t.end;ks.subVectors(c,o),Gs.subVectors(h,l),Cu.subVectors(o,l);let d=ks.dot(ks),u=Gs.dot(Gs),f=Gs.dot(Cu);if(d<=i&&u<=i)return e.copy(o),n.copy(l),e.distanceToSquared(n);if(d<=i)r=0,a=f/u,a=Gt(a,0,1);else{let p=ks.dot(Cu);if(u<=i)a=0,r=Gt(-p/d,0,1);else{let _=ks.dot(Gs),m=d*u-_*_;m!==0?r=Gt((_*f-p*u)/m,0,1):r=0,a=(_*r+f)/u,a<0?(a=0,r=Gt(-p/d,0,1)):a>1&&(a=1,r=Gt((_-p)/d,0,1))}}return e.copy(o).addScaledVector(ks,r),n.copy(l).addScaledVector(Gs,a),e.distanceToSquared(n)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},fp=new C,th=class extends oe{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type=\"SpotLightHelper\";let n=new Yt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a1)for(let d=0;d.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{xp.set(t.z,0,-t.x).normalize();let e=Math.acos(t.y);this.quaternion.setFromAxisAngle(xp,e)}}setLength(t,e=t*.2,n=e*.2){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){super.dispose(),this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},dh=class extends gn{constructor(t=1){let e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Yt;i.setAttribute(\"position\",new Tt(e,3)),i.setAttribute(\"color\",new Tt(n,3));let r=new ke({vertexColors:!0,toneMapped:!1});super(i,r),this.type=\"AxesHelper\"}setColors(t,e,n){let i=new bt,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}},fh=class{constructor(){this.type=\"ShapePath\",this.color=new bt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(t,e){return this.currentPath=new Ii,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,a){return this.currentPath.bezierCurveTo(t,e,n,i,r,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(){function t(l,c){let h=!1,d=c.length;for(let u=0,f=d-1;ul.y!=_.y>l.y&&l.x<(_.x-p.x)*(l.y-p.y)/(_.y-p.y)+p.x&&(h=!h)}return h}function e(l,c){let h=c.getCenter(new et);if(t(h,l))return h;let d=h.y,u=[],f=l.length;for(let p=0;pd!=m.y>d){let g=_.x+(d-_.y)*(m.x-_.x)/(m.y-_.y);u.push(g)}}return u.length>1&&(u.sort((p,_)=>p-_),h.x=(u[0]+u[1])/2),h}let n=this.userData.style&&this.userData.style.fillRule||\"nonzero\";n!==\"nonzero\"&&n!==\"evenodd\"&&(gt('Fill-rule \"'+n+'\" is not supported, falling back to \"nonzero\".'),n=\"nonzero\");let i=n===\"nonzero\"?(l=>l!==0):(l=>(l&1)!==0),r=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let h=yn.area(c);if(h===0)continue;let d=new Eo;for(let u=0;uc.absArea-l.absArea);for(let l=0;l=0;d--){let u=r[d];if(u.boundingBox.containsBox(c.boundingBox)&&t(c.interiorPoint,u.points)){c.container=u.exclude?u.container:u,h=u.winding,c.winding+=h;break}}i(c.winding)===i(h)&&(c.exclude=!0)}for(let l of r)l.exclude||(l.role=l.container===null||l.container.role===\"hole\"?\"outer\":\"hole\");let a=[],o=new Map;for(let l of r){if(l.exclude||l.role!==\"outer\")continue;let c=new Pi;c.curves=l.subPath.curves,a.push(c),o.set(l,c)}for(let l of r){if(l.exclude||l.role!==\"hole\")continue;let c=o.get(l.container);if(!c)continue;let h=new Ii;h.curves=l.subPath.curves,c.holes.push(h)}return a}},ph=class extends un{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){this.domElement!==null&&this.disconnect(),this.domElement=t}disconnect(){}dispose(){}update(){}};function a0(s,t){let e=s.image&&s.image.width?s.image.width/s.image.height:1;return e>t?(s.repeat.x=1,s.repeat.y=e/t,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=t/e,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function o0(s,t){let e=s.image&&s.image.width?s.image.width/s.image.height:1;return e>t?(s.repeat.x=t/e,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=e/t,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function l0(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function Vh(s,t,e,n){let i=c0(n);switch(e){case Nh:return s*t;case Po:return s*t/i.components*i.byteLength;case Nr:return s*t/i.components*i.byteLength;case pi:return s*t*2/i.components*i.byteLength;case Lo:return s*t*2/i.components*i.byteLength;case Uh:return s*t*3/i.components*i.byteLength;case rn:return s*t*4/i.components*i.byteLength;case Do:return s*t*4/i.components*i.byteLength;case Ur:case Fr:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*8;case Or:case Br:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*16;case Uo:case Oo:return Math.max(s,16)*Math.max(t,8)/4;case No:case Fo:return Math.max(s,8)*Math.max(t,8)/2;case Bo:case zo:case Go:case Vo:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*8;case ko:case zr:case Ho:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*16;case Wo:return Math.floor((s+3)/4)*Math.floor((t+3)/4)*16;case Xo:return Math.floor((s+4)/5)*Math.floor((t+3)/4)*16;case qo:return Math.floor((s+4)/5)*Math.floor((t+4)/5)*16;case Yo:return Math.floor((s+5)/6)*Math.floor((t+4)/5)*16;case Zo:return Math.floor((s+5)/6)*Math.floor((t+5)/6)*16;case Jo:return Math.floor((s+7)/8)*Math.floor((t+4)/5)*16;case $o:return Math.floor((s+7)/8)*Math.floor((t+5)/6)*16;case Ko:return Math.floor((s+7)/8)*Math.floor((t+7)/8)*16;case Qo:return Math.floor((s+9)/10)*Math.floor((t+4)/5)*16;case jo:return Math.floor((s+9)/10)*Math.floor((t+5)/6)*16;case tl:return Math.floor((s+9)/10)*Math.floor((t+7)/8)*16;case el:return Math.floor((s+9)/10)*Math.floor((t+9)/10)*16;case nl:return Math.floor((s+11)/12)*Math.floor((t+9)/10)*16;case il:return Math.floor((s+11)/12)*Math.floor((t+11)/12)*16;case sl:case rl:case al:return Math.ceil(s/4)*Math.ceil(t/4)*16;case ol:case ll:return Math.ceil(s/4)*Math.ceil(t/4)*8;case kr:case cl:return Math.ceil(s/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function c0(s){switch(s){case on:case Ih:return{byteLength:1,components:1};case ys:case Ph:case An:return{byteLength:2,components:1};case Co:case Io:return{byteLength:2,components:4};case _n:case Ro:case Je:return{byteLength:4,components:1};case Lh:case Dh:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${s}.`)}var mh=class{static contain(t,e){return a0(t,e)}static cover(t,e){return o0(t,e)}static fill(t){return l0(t)}static getByteLength(t,e,n,i){return Vh(t,e,n,i)}};typeof __THREE_DEVTOOLS__<\"u\"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"register\",{detail:{revision:\"187\"}}));typeof window<\"u\"&&(window.__THREE__?gt(\"WARNING: Multiple instances of Three.js being imported.\"):window.__THREE__=\"187\");function $m(){let s=null,t=!1,e=null,n=null;function i(r,a){n=s.requestAnimationFrame(i),e(r,a)}return{start:function(){t!==!0&&e!==null&&s!==null&&(n=s.requestAnimationFrame(i),t=!0)},stop:function(){s!==null&&s.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(r){e=r},setContext:function(r){s=r}}}function h0(s){let t=new WeakMap;function e(o,l){let c=o.array,h=o.usage,d=c.byteLength,u=s.createBuffer();s.bindBuffer(l,u),s.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=s.FLOAT;else if(typeof Float16Array<\"u\"&&c instanceof Float16Array)f=s.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=s.SHORT;else if(c instanceof Uint32Array)f=s.UNSIGNED_INT;else if(c instanceof Int32Array)f=s.INT;else if(c instanceof Int8Array)f=s.BYTE;else if(c instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=s.UNSIGNED_BYTE;else throw new Error(\"THREE.WebGLAttributes: Unsupported buffer data format: \"+c);return{buffer:u,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){let h=l.array,d=l.updateRanges;if(s.bindBuffer(c,o),d.length===0)s.bufferSubData(c,0,h);else{d.sort((f,p)=>f.start-p.start);let u=0;for(let f=1;f 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`,w0=`#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,R0=`#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif`,C0=`#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif`,I0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#endif`,P0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#endif`,L0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec4 vColor;\n#endif`,D0=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif`,N0=`#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}\n#define inverseTransformDirection transformDirectionByInverseViewMatrix\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n\treturn normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n}\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\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`,U0=`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#endif`,F0=`#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif`,O0=`#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,B0=`#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,z0=`#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif`,k0=\"gl_FragColor = linearToOutputTexel( gl_FragColor );\",G0=`vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\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}`,V0=`#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 = transformNormalByInverseViewMatrix( 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 * reflectVec );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif`,H0=`#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\tuniform samplerCube envMap;\n\t#ifdef ENVMAP_TYPE_PMREM\n\t\tfloat roughnessToMip( const in float roughness ) {\n\t\t\tfloat r = clamp( roughness, 0.0, 1.0 );\n\t\t\treturn ENVMAP_MAX_LOD * r * ( 2.0 - r );\n\t\t}\n\t#endif\n#endif`,W0=`#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`,X0=`#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`,q0=`#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 = transformNormalByInverseViewMatrix( 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`,Y0=`#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif`,Z0=`#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif`,J0=`#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`,$0=`#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`,K0=`#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}`,Q0=`#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif`,j0=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,tx=`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`,ex=`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 = transformNormalByInverseViewMatrix( 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_SUN_LIGHTS > 0\n\tstruct SunLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform SunLight sunLights[ NUM_SUN_LIGHTS ];\n\tvoid getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {\n\t\tlight.color = sunLight.color;\n\t\tlight.direction = sunLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\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\n#include `,nx=`#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_PMREM\n\t\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureLod( envMap, envMapRotation * worldNormal, ENVMAP_MAX_LOD );\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_PMREM\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureLod( envMap, envMapRotation * reflectVec, roughnessToMip( 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_RETROREFLECTION\n\t\tvec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t\t#ifdef ENVMAP_TYPE_PMREM\n\t\t\t\tvec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );\n\t\t\t\tretroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );\n\t\t\t\tvec4 envMapColor = textureLod( envMap, envMapRotation * retroVec, roughnessToMip( roughness ) );\n\t\t\t\treturn envMapColor.rgb * envMapIntensity;\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\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_PMREM\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\t#ifdef USE_RETROREFLECTION\n\t\t\tvec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t\t#ifdef ENVMAP_TYPE_PMREM\n\t\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\t\treturn getIBLRetroRadiance( viewDir, bentNormal, roughness );\n\t\t\t\t#else\n\t\t\t\t\treturn vec3( 0.0 );\n\t\t\t\t#endif\n\t\t\t}\n\t\t#endif\n\t#endif\n#endif`,ix=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,sx=`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`,rx=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,ax=`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`,ox=`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = 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.045 );\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef USE_DIFFUSE_ROUGHNESS\n\tfloat diffuseRoughnessFactor = diffuseRoughness;\n\t#ifdef USE_DIFFUSE_ROUGHNESSMAP\n\t\tdiffuseRoughnessFactor *= texture2D( diffuseRoughnessMap, vDiffuseRoughnessMapUv ).r;\n\t#endif\n\tmaterial.diffuseRoughness = saturate( diffuseRoughnessFactor );\n#endif\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 = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, 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.045 );\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_RETROREFLECTION\n\tmaterial.retroreflectivity = retroreflectivity;\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.0001, 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`,lx=`uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\tvec2 dfg;\n\tvec3 multiScatteringCompensation;\n\t#ifdef USE_DIFFUSE_ROUGHNESS\n\t\tfloat diffuseRoughness;\n\t#endif\n\t#ifdef USE_RETROREFLECTION\n\t\tfloat retroreflectivity;\n\t#endif\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 iridescenceF0Dielectric;\n\t\tvec3 iridescenceF0Metallic;\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}\n#ifdef USE_DIFFUSE_ROUGHNESS\n\tconst float EON_EPSILON = 1e-7;\n\tfloat FON_DirectionalAlbedo( const in float mu, const in float roughness, const in float A ) {\n\t\tfloat muComp = 1.0 - mu;\n\t\tfloat gOverPi = muComp * ( 0.0571085289 + muComp * ( 0.491881867 + muComp * ( - 0.332181442 + muComp * 0.0714429953 ) ) );\n\t\treturn A * ( 1.0 + roughness * gOverPi );\n\t}\n\tvec3 BRDF_EON( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 diffuseColor, const in float roughness ) {\n\t\tvec3 rho = saturate( diffuseColor );\n\t\tif ( roughness <= EON_EPSILON ) return BRDF_Lambert( rho );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat s = dot( lightDir, viewDir ) - dotNL * dotNV;\n\t\tfloat sOverT = ( s > 0.0 ) ? s / max( max( dotNL, dotNV ), EON_EPSILON ) : s;\n\t\tfloat A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );\n\t\tvec3 singleScatter = rho * RECIPROCAL_PI * A * ( 1.0 + roughness * sOverT );\n\t\tfloat averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );\n\t\tfloat albedoV = FON_DirectionalAlbedo( dotNV, roughness, A );\n\t\tfloat albedoL = FON_DirectionalAlbedo( dotNL, roughness, A );\n\t\tvec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );\n\t\tvec3 multiScatter = rhoMultiScatter * RECIPROCAL_PI\n\t\t\t* max( EON_EPSILON, 1.0 - albedoV )\n\t\t\t* max( EON_EPSILON, 1.0 - albedoL )\n\t\t\t/ max( EON_EPSILON, 1.0 - averageAlbedo );\n\t\treturn singleScatter + multiScatter;\n\t}\n\tvec3 EON_DirectionalAlbedo( const in vec3 diffuseColor, const in float roughness, const in float dotNV ) {\n\t\tvec3 rho = saturate( diffuseColor );\n\t\tif ( roughness <= EON_EPSILON ) return rho;\n\t\tfloat A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );\n\t\tfloat directionalAlbedo = FON_DirectionalAlbedo( dotNV, roughness, A );\n\t\tfloat averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );\n\t\tvec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );\n\t\treturn rho * directionalAlbedo + rhoMultiScatter * ( 1.0 - directionalAlbedo );\n\t}\n#endif\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\treturn 0.5 / max( gv + gl, EPSILON );\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 = max( material.clearcoatRoughness, 0.045 );\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.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = max( material.roughness, 0.045 );\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 alphaT = max( material.alphaT, alpha );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( 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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\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.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\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 \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\tvec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\t#ifdef USE_RETROREFLECTION\n\t\tvec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );\n\t\tvec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );\n\t\tspecularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );\n\t#endif\n\treflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;\n\tvec3 halfDir = normalize( directLight.direction + geometryViewDir );\n\tfloat dotVH = saturate( dot( geometryViewDir, halfDir ) );\n\tvec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );\n\t#ifdef USE_RETROREFLECTION\n\t\tvec3 retroHalfDir = normalize( directLight.direction + retroViewDir );\n\t\tfloat dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );\n\t\tvec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );\n\t\tF = mix( F, retroF, saturate( material.retroreflectivity ) );\n\t#endif\n\t#ifdef USE_DIFFUSE_ROUGHNESS\n\t\tvec3 diffuseBRDF = BRDF_EON( directLight.direction, geometryViewDir, geometryNormal, material.diffuseColor, material.diffuseRoughness ) * ( 1.0 - material.metalness );\n\t#else\n\t\tvec3 diffuseBRDF = BRDF_Lambert( material.diffuseContribution );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * diffuseBRDF * ( 1.0 - F );\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\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );\n\t#endif\n\t#ifdef USE_DIFFUSE_ROUGHNESS\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\tvec3 diffuseAlbedo = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness );\n\t\tvec3 diffuse = irradiance * RECIPROCAL_PI * diffuseAlbedo * ( 1.0 - singleScattering - multiScattering );\n\t#else\n\t\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\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 ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\t#ifdef USE_DIFFUSE_ROUGHNESS\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\tvec3 diffuse = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness ) * ( 1.0 - totalScatteringDielectric );\n\t#else\n\t\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\t#endif\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\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}`,cx=`\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\tvec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tvec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );\n\t\tmaterial.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );\n\t}\n#endif\n#ifdef STANDARD\n\tfloat dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );\n\tmaterial.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;\n\t#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )\n\t\tfloat EssMs = material.dfg.x + material.dfg.y;\n\t\tmaterial.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );\n\t#endif\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 ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\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_SUN_LIGHTS > 0 ) && defined( RE_Direct )\n\tSunLight sunLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0\n\tSunLightShadow sunLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {\n\t\tsunLight = sunLights[ i ];\n\t\tgetSunLightInfo( sunLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )\n\t\tsunLightShadow = sunLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 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\t#if NUM_LIGHT_PROBE_GRIDS > 0\n\t\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n\t\tvec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n\t\tint probeGrid = - 1;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {\n\t\t\tif ( isInsideLightProbeGrid( probeWorldPos, probeWorldNormal, probesMin[ i ], probesMax[ i ], probesResolution[ i ] ) ) probeGrid = UNROLLED_LOOP_INDEX;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {\n\t\t\tif ( probeGrid == UNROLLED_LOOP_INDEX ) irradiance += getLightProbeGridIrradiance( probesSH[ i ], probesMin[ i ], probesMax[ i ], probesResolution[ i ], probeWorldPos, probeWorldNormal );\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`,hx=`#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( ENVMAP_TYPE_PMREM )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tvec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_RETROREFLECTION\n\t\t#ifdef USE_ANISOTROPY\n\t\t\tvec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t\t#else\n\t\t\tvec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t\t#endif\n\t\tiblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );\n\t#endif\n\tradiance += iblRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif`,ux=`#if defined( RE_IndirectDiffuse )\n\t#if defined( LAMBERT ) || defined( PHONG )\n\t\tirradiance += iblIrradiance;\n\t#endif\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`,dx=`#if NUM_LIGHT_PROBE_GRIDS > 0\nuniform highp sampler3D probesSH[ NUM_LIGHT_PROBE_GRIDS ];\nuniform vec3 probesMin[ NUM_LIGHT_PROBE_GRIDS ];\nuniform vec3 probesMax[ NUM_LIGHT_PROBE_GRIDS ];\nuniform vec3 probesResolution[ NUM_LIGHT_PROBE_GRIDS ];\nbool isInsideLightProbeGrid( vec3 worldPos, vec3 worldNormal, vec3 probesMin, vec3 probesMax, vec3 probesResolution ) {\n\tvec3 spacing = ( probesMax - probesMin ) / probesResolution;\n\tvec3 samplePos = worldPos + worldNormal * spacing * 0.5;\n\tvec3 margin = spacing * 0.01;\n\treturn all( greaterThanEqual( samplePos, probesMin - margin ) ) && all( lessThanEqual( samplePos, probesMax + margin ) );\n}\nvec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 probesMax, vec3 probesResolution, vec3 worldPos, vec3 worldNormal ) {\n\tvec3 res = probesResolution;\n\tvec3 gridRange = probesMax - probesMin;\n\tvec3 probeSpacing = gridRange / res;\n\tvec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n\tvec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.5 / res, 1.0 - 0.5 / res );\n\tfloat nz = res.z;\n\tfloat paddedSlices = nz + 2.0;\n\tfloat atlasDepth = 7.0 * paddedSlices;\n\tfloat uvZBase = uvw.z * nz + 1.0;\n\tvec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n\tvec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n\tvec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n\tvec3 c0 = s0.xyz;\n\tvec3 c1 = vec3( s0.w, s1.xy );\n\tvec3 c2 = vec3( s1.zw, s2.x );\n\tvec3 c3 = s2.yzw;\n\tvec3 c4 = s3.xyz;\n\tvec3 c5 = vec3( s3.w, s4.xy );\n\tvec3 c6 = vec3( s4.zw, s5.x );\n\tvec3 c7 = s5.yzw;\n\tvec3 c8 = s6.xyz;\n\tfloat x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n\tvec3 result = c0 * 0.886227;\n\tresult += c1 * 2.0 * 0.511664 * y;\n\tresult += c2 * 2.0 * 0.511664 * z;\n\tresult += c3 * 2.0 * 0.511664 * x;\n\tresult += c4 * 2.0 * 0.429043 * x * y;\n\tresult += c5 * 2.0 * 0.429043 * y * z;\n\tresult += c6 * ( 0.743125 * z * z - 0.247708 );\n\tresult += c7 * 2.0 * 0.429043 * x * z;\n\tresult += c8 * 0.429043 * ( x * x - y * y );\n\treturn max( result, vec3( 0.0 ) );\n}\n#endif`,fx=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,px=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif`,mx=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif`,gx=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif`,_x=`#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif`,xx=`#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif`,vx=`#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`,yx=`#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`,Sx=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif`,Mx=`#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif`,bx=`#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`,Tx=`#if defined( USE_MORPHCOLORS )\n\t#if defined( USE_COLOR_ALPHA )\n\t\tvColor *= morphTargetBaseInfluence;\n\t#elif defined( USE_COLOR )\n\t\tvColor.rgb *= morphTargetBaseInfluence;\n\t#endif\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.rgb += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif`,Ax=`#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`,Ex=`#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`,wx=`#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`,Rx=`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#ifdef DOUBLE_SIDED\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#ifdef DOUBLE_SIDED\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;`,Cx=`#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\t#if defined( USE_PACKED_NORMALMAP )\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\t#endif\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif`,Ix=`#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`,Px=`#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`,Lx=`#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\t#ifdef FLIP_SIDED\n\t\t\tvBitangent = - vBitangent;\n\t\t#endif\n\t#endif\n#endif`,Dx=`#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`,Nx=`#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,Ux=`#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`,Fx=`#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`,Ox=`#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif`,Bx=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,zx=`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.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in 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\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\t#else\n\t\treturn depth * ( near - far ) - near;\n\t#endif\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\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\t#else\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\t#endif\n}`,kx=`#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif`,Gx=`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;`,Vx=`#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,Hx=`#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`,Wx=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif`,Xx=`#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif`,qx=`#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_SUN_LIGHT_SHADOWS > 0\n\t\t#define SUN_LIGHT_CASCADES 2\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tuniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n\t\tuniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n\t\tvarying vec4 vSunShadowWorldPosition;\n\t\tvarying vec3 vSunShadowWorldNormal;\n\t\tstruct SunLightShadow {\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 SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\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\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tvec2 radius = shadowRadius * texelSize;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\t\tfloat getSunShadow(\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\t\tsampler2DShadow shadowMap,\n\t\t\t#else\n\t\t\t\tsampler2D shadowMap,\n\t\t\t#endif\n\t\t\tSunLightShadow sunLightShadow,\n\t\t\tint shadowIndex\n\t\t) {\n\t\t\tvec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );\n\t\t\tfloat viewDepth = vSunShadowWorldPosition.w;\n\t\t\tint cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;\n\t\t\tfloat shadow = 1.0;\n\t\t\tfor ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {\n\t\t\t\tvec4 cascade = sunShadowCascade[ cascadeOffset + i ];\n\t\t\t\tif ( viewDepth >= cascade.x && viewDepth < cascade.y ) {\n\t\t\t\t\tfloat cascadeShadow = getShadow(\n\t\t\t\t\t\tshadowMap,\n\t\t\t\t\t\tsunLightShadow.shadowMapSize,\n\t\t\t\t\t\tsunLightShadow.shadowIntensity,\n\t\t\t\t\t\tsunLightShadow.shadowBias,\n\t\t\t\t\t\tsunLightShadow.shadowRadius,\n\t\t\t\t\t\tsunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition\n\t\t\t\t\t);\n\t\t\t\t\tshadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn shadow;\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow 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\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat lightDistance = length( lightToPosition );\n\t\t\tfloat depthRange = shadowCameraFar - shadowCameraNear;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tfloat depthA = - shadowCameraNear / depthRange - shadowBias;\n\t\t\t\tfloat depthB = shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );\n\t\t\t#else\n\t\t\t\tfloat depthA = shadowCameraFar / depthRange + shadowBias;\n\t\t\t\tfloat depthB = - shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );\n\t\t\t#endif\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\tshadow = 0.0;\n\t\t\tfor ( int i = 0; i < 5; i ++ ) {\n\t\t\t\tvec2 offset = vogelDiskSample( i, 5, phi );\n\t\t\t\tvec3 direction = bd3D + ( tangent * offset.x + bitangent * offset.y ) * texelSize;\n\t\t\t\tvec3 absDirection = abs( direction );\n\t\t\t\tfloat dp = depthA + depthB / max( max( absDirection.x, absDirection.y ), absDirection.z );\n\t\t\t\tshadow += texture( shadowMap, vec4( direction, dp ) );\n\t\t\t}\n\t\t\tshadow *= 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube 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\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tdepth = 1.0 - depth;\n\t\t\t#endif\n\t\t\tshadow = step( dp, depth );\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif`,Yx=`#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_SUN_LIGHT_SHADOWS > 0\n\t\tvarying vec4 vSunShadowWorldPosition;\n\t\tvarying vec3 vSunShadowWorldNormal;\n\t#endif\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`,Zx=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#ifdef HAS_NORMAL\n\t\tvec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\t#else\n\t\tvec3 shadowWorldNormal = vec3( 0.0 );\n\t#endif\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\t\tvSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );\n\t\tvSunShadowWorldNormal = shadowWorldNormal;\n\t#endif\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`,Jx=`float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\tSunLightShadow sunLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {\n\t\tsunLight = sunLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\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 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\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}`,$x=`#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`,Kx=`#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`,Qx=`#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`,jx=`#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`,tv=`float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif`,ev=`#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif`,nv=`#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,iv=`#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 CineonToneMapping( 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; }`,sv=`#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 = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, 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`,rv=`#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\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\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#else\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#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`,av=`#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_DIFFUSE_ROUGHNESSMAP\n\tvarying vec2 vDiffuseRoughnessMapUv;\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`,ov=`#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_DIFFUSE_ROUGHNESSMAP\n\tuniform mat3 diffuseRoughnessMapTransform;\n\tvarying vec2 vDiffuseRoughnessMapUv;\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`,lv=`#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_DIFFUSE_ROUGHNESSMAP\n\tvDiffuseRoughnessMapUv = ( diffuseRoughnessMapTransform * vec3( DIFFUSE_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`,cv=`#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`,hv=`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}`,uv=`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 \n\t#include \n}`,dv=`varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}`,fv=`uniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_PMREM\n\t\tvec4 texColor = textureLod( envMap, backgroundRotation * vWorldDirection, roughnessToMip( backgroundBlurriness ) );\n\t#else\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}`,pv=`varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}`,mv=`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 \n\t#include \n}`,gv=`#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}`,_v=`#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\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#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}`,xv=`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}`,vv=`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}`,yv=`varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}`,Sv=`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}`,Mv=`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,bv=`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Tv=`#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Av=`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Ev=`#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}`,wv=`#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Rv=`#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}`,Cv=`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Iv=`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}`,Pv=`#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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}`,Lv=`#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}`,Dv=`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Nv=`#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}`,Uv=`#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_DIFFUSE_ROUGHNESS\n\tuniform float diffuseRoughness;\n\t#ifdef USE_DIFFUSE_ROUGHNESSMAP\n\t\tuniform sampler2D diffuseRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n\tuniform float retroreflectivity;\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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Fv=`#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}`,Ov=`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Bv=`uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}`,zv=`uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,kv=`#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}`,Gv=`uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n\t#include \n}`,Vv=`uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\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 \n\t#include \n\t#include \n}`,Hv=`uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}`,Jt={alphahash_fragment:u0,alphahash_pars_fragment:d0,alphamap_fragment:f0,alphamap_pars_fragment:p0,alphatest_fragment:m0,alphatest_pars_fragment:g0,aomap_fragment:_0,aomap_pars_fragment:x0,batching_pars_vertex:v0,batching_vertex:y0,begin_vertex:S0,beginnormal_vertex:M0,bsdfs:b0,iridescence_fragment:T0,bumpmap_pars_fragment:A0,clipping_planes_fragment:E0,clipping_planes_pars_fragment:w0,clipping_planes_pars_vertex:R0,clipping_planes_vertex:C0,color_fragment:I0,color_pars_fragment:P0,color_pars_vertex:L0,color_vertex:D0,common:N0,defaultnormal_vertex:U0,displacementmap_pars_vertex:F0,displacementmap_vertex:O0,emissivemap_fragment:B0,emissivemap_pars_fragment:z0,colorspace_fragment:k0,colorspace_pars_fragment:G0,envmap_fragment:V0,envmap_common_pars_fragment:H0,envmap_pars_fragment:W0,envmap_pars_vertex:X0,envmap_physical_pars_fragment:nx,envmap_vertex:q0,fog_vertex:Y0,fog_pars_vertex:Z0,fog_fragment:J0,fog_pars_fragment:$0,gradientmap_pars_fragment:K0,lightmap_pars_fragment:Q0,lights_lambert_fragment:j0,lights_lambert_pars_fragment:tx,lights_pars_begin:ex,lights_toon_fragment:ix,lights_toon_pars_fragment:sx,lights_phong_fragment:rx,lights_phong_pars_fragment:ax,lights_physical_fragment:ox,lights_physical_pars_fragment:lx,lights_fragment_begin:cx,lights_fragment_maps:hx,lights_fragment_end:ux,lightprobes_pars_fragment:dx,logdepthbuf_fragment:fx,logdepthbuf_pars_fragment:px,logdepthbuf_pars_vertex:mx,logdepthbuf_vertex:gx,map_fragment:_x,map_pars_fragment:xx,map_particle_fragment:vx,map_particle_pars_fragment:yx,metalnessmap_fragment:Sx,metalnessmap_pars_fragment:Mx,morphinstance_vertex:bx,morphcolor_vertex:Tx,morphnormal_vertex:Ax,morphtarget_pars_vertex:Ex,morphtarget_vertex:wx,normal_fragment_begin:Rx,normal_fragment_maps:Cx,normal_pars_fragment:Ix,normal_pars_vertex:Px,normal_vertex:Lx,normalmap_pars_fragment:Dx,clearcoat_normal_fragment_begin:Nx,clearcoat_normal_fragment_maps:Ux,clearcoat_pars_fragment:Fx,iridescence_pars_fragment:Ox,opaque_fragment:Bx,packing:zx,premultiplied_alpha_fragment:kx,project_vertex:Gx,dithering_fragment:Vx,dithering_pars_fragment:Hx,roughnessmap_fragment:Wx,roughnessmap_pars_fragment:Xx,shadowmap_pars_fragment:qx,shadowmap_pars_vertex:Yx,shadowmap_vertex:Zx,shadowmask_pars_fragment:Jx,skinbase_vertex:$x,skinning_pars_vertex:Kx,skinning_vertex:Qx,skinnormal_vertex:jx,specularmap_fragment:tv,specularmap_pars_fragment:ev,tonemapping_fragment:nv,tonemapping_pars_fragment:iv,transmission_fragment:sv,transmission_pars_fragment:rv,uv_pars_fragment:av,uv_pars_vertex:ov,uv_vertex:lv,worldpos_vertex:cv,background_vert:hv,background_frag:uv,backgroundCube_vert:dv,backgroundCube_frag:fv,cube_vert:pv,cube_frag:mv,depth_vert:gv,depth_frag:_v,distance_vert:xv,distance_frag:vv,equirect_vert:yv,equirect_frag:Sv,linedashed_vert:Mv,linedashed_frag:bv,meshbasic_vert:Tv,meshbasic_frag:Av,meshlambert_vert:Ev,meshlambert_frag:wv,meshmatcap_vert:Rv,meshmatcap_frag:Cv,meshnormal_vert:Iv,meshnormal_frag:Pv,meshphong_vert:Lv,meshphong_frag:Dv,meshphysical_vert:Nv,meshphysical_frag:Uv,meshtoon_vert:Fv,meshtoon_frag:Ov,points_vert:Bv,points_frag:zv,shadow_vert:kv,shadow_frag:Gv,sprite_vert:Vv,sprite_frag:Hv},yt={common:{diffuse:{value:new bt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Wt},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Wt}},envmap:{envMap:{value:null},envMapRotation:{value:new Wt},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Wt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Wt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Wt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Wt},normalScale:{value:new et(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Wt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Wt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Wt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Wt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new bt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:[]},probesMin:{value:[]},probesMax:{value:[]},probesResolution:{value:[]}},points:{diffuse:{value:new bt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0},uvTransform:{value:new Wt}},sprite:{diffuse:{value:new bt(16777215)},opacity:{value:1},center:{value:new et(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Wt},alphaMap:{value:null},alphaMapTransform:{value:new Wt},alphaTest:{value:0}}},Bn={basic:{uniforms:Qe([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.fog]),vertexShader:Jt.meshbasic_vert,fragmentShader:Jt.meshbasic_frag},lambert:{uniforms:Qe([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new bt(0)},envMapIntensity:{value:1}}]),vertexShader:Jt.meshlambert_vert,fragmentShader:Jt.meshlambert_frag},phong:{uniforms:Qe([yt.common,yt.specularmap,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,yt.lights,{emissive:{value:new bt(0)},specular:{value:new bt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Jt.meshphong_vert,fragmentShader:Jt.meshphong_frag},standard:{uniforms:Qe([yt.common,yt.envmap,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.roughnessmap,yt.metalnessmap,yt.fog,yt.lights,{emissive:{value:new bt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag},toon:{uniforms:Qe([yt.common,yt.aomap,yt.lightmap,yt.emissivemap,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.gradientmap,yt.fog,yt.lights,{emissive:{value:new bt(0)}}]),vertexShader:Jt.meshtoon_vert,fragmentShader:Jt.meshtoon_frag},matcap:{uniforms:Qe([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,yt.fog,{matcap:{value:null}}]),vertexShader:Jt.meshmatcap_vert,fragmentShader:Jt.meshmatcap_frag},points:{uniforms:Qe([yt.points,yt.fog]),vertexShader:Jt.points_vert,fragmentShader:Jt.points_frag},dashed:{uniforms:Qe([yt.common,yt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Jt.linedashed_vert,fragmentShader:Jt.linedashed_frag},depth:{uniforms:Qe([yt.common,yt.displacementmap]),vertexShader:Jt.depth_vert,fragmentShader:Jt.depth_frag},normal:{uniforms:Qe([yt.common,yt.bumpmap,yt.normalmap,yt.displacementmap,{opacity:{value:1}}]),vertexShader:Jt.meshnormal_vert,fragmentShader:Jt.meshnormal_frag},sprite:{uniforms:Qe([yt.sprite,yt.fog]),vertexShader:Jt.sprite_vert,fragmentShader:Jt.sprite_frag},background:{uniforms:{uvTransform:{value:new Wt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Jt.background_vert,fragmentShader:Jt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Wt}},vertexShader:Jt.backgroundCube_vert,fragmentShader:Jt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Jt.cube_vert,fragmentShader:Jt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Jt.equirect_vert,fragmentShader:Jt.equirect_frag},distance:{uniforms:Qe([yt.common,yt.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Jt.distance_vert,fragmentShader:Jt.distance_frag},shadow:{uniforms:Qe([yt.lights,yt.fog,{color:{value:new bt(0)},opacity:{value:1}}]),vertexShader:Jt.shadow_vert,fragmentShader:Jt.shadow_frag}};Bn.physical={uniforms:Qe([Bn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Wt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Wt},clearcoatNormalScale:{value:new et(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Wt},diffuseRoughness:{value:0},diffuseRoughnessMap:{value:null},diffuseRoughnessMapTransform:{value:new Wt},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Wt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Wt},sheen:{value:0},sheenColor:{value:new bt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Wt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Wt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Wt},transmissionSamplerSize:{value:new et},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Wt},attenuationDistance:{value:0},attenuationColor:{value:new bt(0)},specularColor:{value:new bt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Wt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Wt},anisotropyVector:{value:new et},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Wt}}]),vertexShader:Jt.meshphysical_vert,fragmentShader:Jt.meshphysical_frag};var Hh={r:0,b:0,g:0},Wv=new Vt,Km=new Wt;Km.set(-1,0,0,0,1,0,0,0,1);function Xv(s,t,e,n,i,r){let a=new bt(0),o=i===!0?0:1,l,c,h=null,d=0,u=null;function f(v){let S=v.isScene===!0?v.background:null;if(S&&S.isTexture){let y=v.backgroundBlurriness>0;S=t.get(S,y)}return S}function p(v){let S=!1,y=f(v);y===null?m(a,o):y&&y.isColor&&(m(y,1),S=!0);let E=s.xr.getEnvironmentBlendMode();E===\"additive\"?e.buffers.color.setClear(0,0,0,1,r):E===\"alpha-blend\"&&e.buffers.color.setClear(0,0,0,0,r),(s.autoClear||S)&&(e.buffers.depth.setTest(!0),e.buffers.depth.setMask(!0),e.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function _(v,S){let y=f(S);y&&y.isCubeTexture?(c===void 0&&(c=new Ee(new Ci(1,1,1),new Mn({name:\"BackgroundCubeMaterial\",uniforms:Ss(Bn.backgroundCube.uniforms),vertexShader:Bn.backgroundCube.vertexShader,fragmentShader:Bn.backgroundCube.fragmentShader,side:Ke,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute(\"normal\"),c.geometry.deleteAttribute(\"uv\"),c.onBeforeRender=function(E,A,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(c.material,\"envMap\",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=y,c.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Wv.makeRotationFromEuler(S.backgroundRotation)).transpose(),y.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(Km),c.material.toneMapped=jt.getTransfer(y.colorSpace)!==ce,(h!==y||d!==y.version||u!==s.toneMapping)&&(c.material.needsUpdate=!0,h=y,d=y.version,u=s.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(l===void 0&&(l=new Ee(new hs(2,2),new Mn({name:\"BackgroundMaterial\",uniforms:Ss(Bn.background.uniforms),vertexShader:Bn.background.vertexShader,fragmentShader:Bn.background.fragmentShader,side:fi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(\"normal\"),Object.defineProperty(l.material,\"map\",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=y,l.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,l.material.toneMapped=jt.getTransfer(y.colorSpace)!==ce,y.matrixAutoUpdate===!0&&y.updateMatrix(),l.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||d!==y.version||u!==s.toneMapping)&&(l.material.needsUpdate=!0,h=y,d=y.version,u=s.toneMapping),l.layers.enableAll(),v.unshift(l,l.geometry,l.material,0,0,null))}function m(v,S){v.getRGB(Hh,Id(s)),e.buffers.color.setClear(Hh.r,Hh.g,Hh.b,S,r)}function g(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(v,S=1){a.set(v),o=S,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(v){o=v,m(a,o)},render:p,addToRenderList:_,dispose:g}}function qv(s,t){let e=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=u(null),r=i,a=!1;function o(L,F,H,D,k){let X=!1,G=d(L,D,H,F);r!==G&&(r=G,c(r.object)),X=f(L,D,H,k),X&&p(L,D,H,k),k!==null&&t.update(k,s.ELEMENT_ARRAY_BUFFER),(X||a)&&(a=!1,y(L,F,H,D),k!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,t.get(k).buffer))}function l(){return s.createVertexArray()}function c(L){return s.bindVertexArray(L)}function h(L){return s.deleteVertexArray(L)}function d(L,F,H,D){let k=D.wireframe===!0,X=n[F.id];X===void 0&&(X={},n[F.id]=X);let G=L.isInstancedMesh===!0?L.id:0,nt=X[G];nt===void 0&&(nt={},X[G]=nt);let W=nt[H.id];W===void 0&&(W={},nt[H.id]=W);let Q=W[k];return Q===void 0&&(Q=u(l()),W[k]=Q),Q}function u(L){let F=[],H=[],D=[];for(let k=0;k=0){let tt=k[W],Et=X[W];if(Et===void 0&&(W===\"instanceMatrix\"&&L.instanceMatrix&&(Et=L.instanceMatrix),W===\"instanceColor\"&&L.instanceColor&&(Et=L.instanceColor)),tt===void 0||tt.attribute!==Et||Et&&tt.data!==Et.data)return!0;G++}return r.attributesNum!==G||r.index!==D}function p(L,F,H,D){let k={},X=F.attributes,G=0,nt=H.getAttributes();for(let W in nt)if(nt[W].location>=0){let tt=X[W];tt===void 0&&(W===\"instanceMatrix\"&&L.instanceMatrix&&(tt=L.instanceMatrix),W===\"instanceColor\"&&L.instanceColor&&(tt=L.instanceColor));let Et={};Et.attribute=tt,tt&&tt.data&&(Et.data=tt.data),k[W]=Et,G++}r.attributes=k,r.attributesNum=G,r.index=D}function _(){let L=r.newAttributes;for(let F=0,H=L.length;F=0){let Q=k[nt];if(Q===void 0&&(nt===\"instanceMatrix\"&&L.instanceMatrix&&(Q=L.instanceMatrix),nt===\"instanceColor\"&&L.instanceColor&&(Q=L.instanceColor)),Q!==void 0){let tt=Q.normalized,Et=Q.itemSize,zt=t.get(Q);if(zt===void 0)continue;let Y=zt.buffer,xt=zt.type,wt=zt.bytesPerElement,Ft=xt===s.INT||xt===s.UNSIGNED_INT||Q.gpuType===Ro;if(Q.isInterleavedBufferAttribute){let vt=Q.data,Ot=vt.isInterleavedBuffer===!0?vt.stride:vt.itemSize,_e=Q.offset;if(vt.isInstancedInterleavedBuffer||vt.isInstancedBufferAttribute){for(let kt=0;kt0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return\"highp\";x=\"mediump\"}return x===\"mediump\"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?\"mediump\":\"lowp\"}let c=e.precision!==void 0?e.precision:\"highp\",h=l(c);h!==c&&(gt(\"WebGLRenderer:\",c,\"not supported, using\",h,\"instead.\"),c=h);let d=e.reversedDepthBuffer===!0&&t.has(\"EXT_clip_control\"),u=e.logarithmicDepthBuffer===!0&&d===!1;e.reversedDepthBuffer===!0&&d===!1&>(\"WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.\"),e.logarithmicDepthBuffer===!0&&d===!0&>(\"WebGLRenderer: Logarithmic depth buffer is ignored when reversed depth buffer is enabled.\");let f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),p=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=s.getParameter(s.MAX_TEXTURE_SIZE),m=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),g=s.getParameter(s.MAX_VERTEX_ATTRIBS),v=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),S=s.getParameter(s.MAX_VARYING_VECTORS),y=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),E=s.getParameter(s.MAX_SAMPLES),A=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:_,maxCubemapSize:m,maxAttributes:g,maxVertexUniforms:v,maxVaryings:S,maxFragmentUniforms:y,maxSamples:E,samples:A}}function Jv(s){let t=this,e=null,n=0,i=!1,r=!1,a=new vn,o=new Wt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let f=d.length!==0||u||n!==0||i;return i=u,n=d.length,f},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(d,u){e=h(d,u,0)},this.setState=function(d,u,f){let p=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,g=s.get(d);if(!i||p===null||p.length===0||r&&!m)r?h(null):c();else{let v=r?0:n,S=v*4,y=g.clippingState||null;l.value=y,y=h(p,u,S,f);for(let E=0;E!==S;++E)y[E]=e[E];g.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==e&&(l.value=e,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function h(d,u,f,p){let _=d!==null?d.length:0,m=null;if(_!==0){if(m=l.value,p!==!0||m===null){let g=f+_*4,v=u.matrixWorldInverse;o.getNormalMatrix(v),(m===null||m.length\n\t\t\t\t\t#include \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 \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 Ci(5,5,5),r=new Mn({name:\"CubemapFromEquirect\",uniforms:Ss(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ke,blending:Ni});r.uniforms.tEquirect.value=e;let a=new Ee(i,r),o=e.minFilter;return e.minFilter===Tn&&(e.minFilter=xe),new gs(1,10,this).update(t,a),e.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(t,e=!0,n=!0,i=!0){let r=t.getRenderTarget();for(let a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(r)}},Cm=256,$v=3,Kv=20,Qm=256,jm=16,Qv=3,jv=new C,ty=new bt,pl=class s{constructor(t){this._renderer=t,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new gs(1,10,null),this._boxMesh=new Ee(new Ci(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(t,e=0,n=.1,i=100,r={}){let{size:a=256,position:o=jv}=r,l=this._renderer;this._setSize(a);let c=this._allocateTarget(),h=this._getSourceTarget(!0);e>0&&(h.texture.mipmapsAutoUpdate=!1);let d=l.autoClear,u=l.autoClearColor,f=l.autoClearDepth,p=l.autoClearStencil,_=t.background;l.autoClear=!0,l.autoClearColor=!0,l.autoClearDepth=!0,l.autoClearStencil=!0,_===null&&(t.background=l.getClearColor(ty));let m=new gs(n,i,h);return m.position.copy(o),m.update(l,t),l.autoClear=d,l.autoClearColor=u,l.autoClearDepth=f,l.autoClearStencil=p,t.background=_,e>0&&(h.texture.mipmapsAutoUpdate=!0,this._blur(c,e)),this._applyPMREM(c),c}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Lm(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Pm(),this._compileMaterial(this._equirectMaterial))}dispose(){this._sourceTarget!==null&&this._sourceTarget.dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._integrationMaterial!==null&&this._integrationMaterial.dispose(),this._boxMesh.geometry.dispose()}static lodToRoughness(t,e){return e>0?1-Math.sqrt(1-t/e):0}_setSize(t){this._cubeSize=Math.max(Cm,Rd(t))}_fromTexture(t,e){t.mapping===Zn||t.mapping===Fi?this._setSize(t.image.length===0?Cm:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4);let n=e||this._allocateTarget();return this._textureToCubemap(t),this._applyPMREM(n),n}_allocateTarget(){let t=this._cubeSize,e=Im(t,!1,!1),n=Math.log2(t)-$v;for(let i=0;i<=n;i++)e.texture.mipmaps.push({width:t>>i,height:t>>i});return e.texture.name=\"PMREM\",e.texture.isPMREMTexture=!0,e}_getSourceTarget(t=!1){let e=this._cubeSize,n=this._sourceTarget;return(n===null||n.width!==e||t&&n.depthBuffer===!1)&&(n!==null&&n.dispose(),this._sourceTarget=Im(e,!0,t)),this._sourceTarget}_compileMaterial(t){this._boxMesh.material=t,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(t,e,n){let i=this._boxMesh,r=this._cubeCamera;i.material=n,r.renderTarget=t,r.activeMipmapLevel=e;let a=t.width>>e;t.viewport.set(0,0,a,a),r.update(this._renderer,i),t.viewport.set(0,0,t.width,t.height)}_textureToCubemap(t){let e;t.mapping===Zn||t.mapping===Fi?(this._cubemapMaterial===null&&(this._cubemapMaterial=Lm()),e=this._cubemapMaterial,e.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):(this._equirectMaterial===null&&(this._equirectMaterial=Pm()),e=this._equirectMaterial),e.uniforms.envMap.value=t,this._renderCube(this._getSourceTarget(),0,e)}_applyPMREM(t){this._ggxMaterial===null&&(this._ggxMaterial=ey(),this._integrationMaterial=ny());let e=this._cubeSize,n=t.texture.mipmaps.length-1,i=this._ggxMaterial.uniforms;i.envMap.value=this._sourceTarget.texture;let r=this._integrationMaterial.uniforms;r.envMap.value=this._sourceTarget.texture,r.sourceLod.value=Math.log2(e/jm);for(let a=0;a<=n;a++){let o=s.lodToRoughness(a,n);if(a>n-Qv)r.roughness.value=o,this._renderCube(t,a,this._integrationMaterial);else{let l=o>0?Math.log2(e)+.5*Math.log2(6/(Qm*Math.pow(o,4)))+.5:0;i.roughness.value=o,i.lodBias.value=l,this._renderCube(t,a,this._ggxMaterial)}}}_blur(t,e){this._blurMaterial===null&&(this._blurMaterial=iy());let n=this._blurMaterial,i=n.uniforms,r=this._sourceTarget;i.sigma.value=Math.min(e,Math.PI)/Math.SQRT2,i.envMap.value=r.texture,this._renderCube(t,0,n),i.envMap.value=t.texture,this._renderCube(r,0,n)}};function Im(s,t,e){return new Vr(s,{minFilter:Tn,generateMipmaps:t,type:An,colorSpace:Js,depthBuffer:e})}function ml(s,t,e){return new Mn({name:s,uniforms:t,vertexShader:Jt.cube_vert,fragmentShader:e,side:Ke,blending:Ni,depthTest:!1,depthWrite:!1})}function ey(){return ml(\"PMREMGGXConvolution\",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},`\n\n\t\t#define GGX_SAMPLES ${Qm}u\n\n\t\tvarying vec3 vWorldDirection;\n\n\t\tuniform samplerCube envMap;\n\t\tuniform float roughness;\n\t\tuniform float lodBias;\n\n\t\t#include \n\n\t\t// Van der Corput radical inverse\n\t\tfloat radicalInverse_VdC( uint bits ) {\n\n\t\t\tbits = ( bits << 16u ) | ( bits >> 16u );\n\t\t\tbits = ( ( bits & 0x55555555u ) << 1u ) | ( ( bits & 0xAAAAAAAAu ) >> 1u );\n\t\t\tbits = ( ( bits & 0x33333333u ) << 2u ) | ( ( bits & 0xCCCCCCCCu ) >> 2u );\n\t\t\tbits = ( ( bits & 0x0F0F0F0Fu ) << 4u ) | ( ( bits & 0xF0F0F0F0u ) >> 4u );\n\t\t\tbits = ( ( bits & 0x00FF00FFu ) << 8u ) | ( ( bits & 0xFF00FF00u ) >> 8u );\n\t\t\treturn float( bits ) * 2.3283064365386963e-10; // / 0x100000000\n\n\t\t}\n\n\t\t// Hammersley sequence\n\t\tvec2 hammersley( uint i, uint N ) {\n\n\t\t\treturn vec2( float( i ) / float( N ), radicalInverse_VdC( i ) );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 N = normalize( vWorldDirection );\n\n\t\t\t// For very low roughness, just sample the environment directly\n\t\t\tif ( roughness < 0.001 ) {\n\n\t\t\t\tgl_FragColor = vec4( textureLod( envMap, N, 0.0 ).rgb, 1.0 );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tfloat alpha = roughness * roughness;\n\t\t\tfloat alpha2 = alpha * alpha;\n\n\t\t\t// Tangent space basis for VNDF sampling\n\t\t\tvec3 up = abs( N.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\tvec3 tangent = normalize( cross( up, N ) );\n\t\t\tvec3 bitangent = cross( N, tangent );\n\n\t\t\tvec3 prefilteredColor = vec3( 0.0 );\n\t\t\tfloat totalWeight = 0.0;\n\n\t\t\tfor ( uint i = 0u; i < GGX_SAMPLES; i ++ ) {\n\n\t\t\t\tvec2 Xi = hammersley( i, GGX_SAMPLES );\n\n\t\t\t\t// With V = N, sample the reflected direction directly.\n\t\t\t\tfloat invQ = 1.0 / ( 1.0 - Xi.x + alpha2 * Xi.x );\n\t\t\t\tfloat NdotL = ( 1.0 - Xi.x - alpha2 * Xi.x ) * invQ;\n\n\t\t\t\tif ( NdotL > 0.0 ) {\n\n\t\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\t\tfloat sinTheta = 2.0 * alpha * sqrt( Xi.x * ( 1.0 - Xi.x ) ) * invQ;\n\t\t\t\t\tvec3 L = N * NdotL + ( tangent * cos( phi ) + bitangent * sin( phi ) ) * sinTheta;\n\n\t\t\t\t\t// Match the source mip to the sample's solid angle. The terms\n\t\t\t\t\t// independent of the sample are precomputed in lodBias.\n\t\t\t\t\tfloat d = alpha2 * invQ;\n\t\t\t\t\tfloat lod = max( log2( d ) + lodBias, 0.0 );\n\n\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\tprefilteredColor += textureLod( envMap, L, lod ).rgb * NdotL;\n\t\t\t\t\ttotalWeight += NdotL;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );\n\n\t\t}\n\t`)}function ny(){return ml(\"PMREMGGXIntegration\",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:jm}},`\n\n\t\tvarying vec3 vWorldDirection;\n\n\t\tuniform samplerCube envMap;\n\t\tuniform float roughness;\n\t\tuniform float sourceLod;\n\t\tuniform int sourceSize;\n\n\t\tvoid main() {\n\n\t\t\tvec3 N = normalize( vWorldDirection );\n\n\t\t\tfloat alpha = roughness * roughness;\n\t\t\tfloat alpha2 = alpha * alpha;\n\n\t\t\tfloat texelSize = 2.0 / float( sourceSize );\n\n\t\t\tvec3 prefilteredColor = vec3( 0.0 );\n\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t// Pair opposite texels: only the one in N's hemisphere contributes.\n\t\t\tfor ( int face = 0; face < 3; face ++ ) {\n\n\t\t\t\tfor ( int y = 0; y < sourceSize; y ++ ) {\n\n\t\t\t\t\tfor ( int x = 0; x < sourceSize; x ++ ) {\n\n\t\t\t\t\t\tvec2 uv = ( vec2( x, y ) + 0.5 ) * texelSize - 1.0;\n\t\t\t\t\t\tvec3 texelDirection = face == 0 ? vec3( 1.0, uv ) : ( face == 1 ? vec3( uv.x, 1.0, uv.y ) : vec3( uv, 1.0 ) );\n\n\t\t\t\t\t\tfloat invDistance = inversesqrt( 1.0 + dot( uv, uv ) );\n\t\t\t\t\t\tfloat NdotL = dot( N, texelDirection );\n\t\t\t\t\t\ttexelDirection *= NdotL < 0.0 ? - 1.0 : 1.0;\n\t\t\t\t\t\tNdotL = abs( NdotL ) * invDistance;\n\n\t\t\t\t\t\t// With V = N, NdotH squared is ( 1 + NdotL ) / 2. Common factors\n\t\t\t\t\t\t// in the GGX distribution and texel solid angle cancel when normalized.\n\t\t\t\t\t\tfloat d = 1.0 + alpha2 + ( alpha2 - 1.0 ) * NdotL;\n\t\t\t\t\t\tfloat weight = NdotL * invDistance * invDistance * invDistance / ( d * d );\n\n\t\t\t\t\t\tprefilteredColor += textureLod( envMap, texelDirection, sourceLod ).rgb * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );\n\n\t\t}\n\t`)}function iy(){return ml(\"PMREMSphericalGaussianBlur\",{envMap:{value:null},sigma:{value:0}},`\n\n\t\t#define SAMPLES ${Kv}\n\t\t#define GOLDEN_ANGLE 2.39996322973\n\n\t\tvarying vec3 vWorldDirection;\n\n\t\tuniform samplerCube envMap;\n\t\tuniform float sigma;\n\n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\tvec3 outputDirection = normalize( vWorldDirection );\n\n\t\t\tvec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\tvec3 tangent = normalize( cross( up, outputDirection ) );\n\t\t\tvec3 bitangent = cross( outputDirection, tangent );\n\n\t\t\t// Truncate the kernel at three standard deviations or at the antipode.\n\t\t\tfloat thetaMax = min( 3.0 * sigma, PI );\n\t\t\tfloat truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );\n\n\t\t\tvec3 accumColor = vec3( 0.0 );\n\t\t\tfloat accumWeight = 0.0;\n\n\t\t\tfor ( int i = 0; i < SAMPLES; i ++ ) {\n\n\t\t\t\t// Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.\n\t\t\t\tfloat stratum = ( float( i ) + 0.5 ) / float( SAMPLES );\n\t\t\t\tfloat theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );\n\t\t\t\tfloat phi = float( i ) * GOLDEN_ANGLE;\n\n\t\t\t\tvec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;\n\t\t\t\tvec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;\n\n\t\t\t\t// Correct the planar sample density to solid angle.\n\t\t\t\tfloat weight = sin( theta ) / theta;\n\n\t\t\t\taccumColor += weight * textureLod( envMap, sampleDirection, 0.0 ).rgb;\n\t\t\t\taccumWeight += weight;\n\n\t\t\t}\n\n\t\t\tgl_FragColor = vec4( accumColor / accumWeight, 1.0 );\n\n\t\t}\n\t`)}function Pm(){return ml(\"PMREMEquirectangularToCubemap\",{envMap:{value:null}},`\n\n\t\tvarying vec3 vWorldDirection;\n\n\t\tuniform sampler2D envMap;\n\n\t\t#include \n\n\t\tvoid main() {\n\n\t\t\t// Average four subpixel samples to preserve small, bright features.\n\t\t\tvec3 direction = normalize( vWorldDirection );\n\t\t\tvec3 dx = dFdx( direction ) * 0.25;\n\t\t\tvec3 dy = dFdy( direction ) * 0.25;\n\n\t\t\tvec3 color = textureLod( envMap, equirectUv( normalize( direction - dx - dy ) ), 0.0 ).rgb;\n\t\t\tcolor += textureLod( envMap, equirectUv( normalize( direction + dx - dy ) ), 0.0 ).rgb;\n\t\t\tcolor += textureLod( envMap, equirectUv( normalize( direction - dx + dy ) ), 0.0 ).rgb;\n\t\t\tcolor += textureLod( envMap, equirectUv( normalize( direction + dx + dy ) ), 0.0 ).rgb;\n\t\t\tgl_FragColor = vec4( color * 0.25, 1.0 );\n\n\t\t}\n\t`)}function Lm(){return ml(\"PMREMCubemapToCubemap\",{envMap:{value:null},flipEnvMap:{value:-1}},`\n\n\t\tvarying vec3 vWorldDirection;\n\n\t\tuniform samplerCube envMap;\n\t\tuniform float flipEnvMap;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = vec4( textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ).rgb, 1.0 );\n\n\t\t}\n\t`)}function sy(s){let t=new WeakMap,e=new WeakMap,n=null;function i(u,f=!1){return u==null?null:f?a(u):r(u)}function r(u){if(u&&u.isTexture){let f=u.mapping;if(f===Pr||f===Lr)if(t.has(u)){let p=t.get(u).texture;return o(p,u.mapping)}else{let p=u.image;if(p&&p.height>0){let _=new Vr(p.height);return _.fromEquirectangularTexture(s,u),t.set(u,_),u.addEventListener(\"dispose\",c),o(_.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture&&u.isPMREMTexture!==!0){let f=u.mapping,p=f===Pr||f===Lr,_=f===Zn||f===Fi;if(p||_){let m=e.get(u),g=m!==void 0?m.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==g)return n===null&&(n=new pl(s)),m=p?n.fromEquirectangular(u,m):n.fromCubemap(u,m),m.texture.pmremVersion=u.pmremVersion,e.set(u,m),m.texture;if(m!==void 0)return m.texture;{let v=u.image;return p&&v&&v.height>0||_&&v&&l(v)?(n===null&&(n=new pl(s)),m=p?n.fromEquirectangular(u):n.fromCubemap(u),m.texture.pmremVersion=u.pmremVersion,e.set(u,m),u.addEventListener(\"dispose\",h),m.texture):null}}}return u}function o(u,f){return f===Pr?u.mapping=Zn:f===Lr&&(u.mapping=Fi),u}function l(u){let f=0,p=6;for(let _=0;_delete i[p]);function o(p){l(p.target)}function l(p){p.index!==null&&t.remove(p.index);for(let m in p.attributes)t.remove(p.attributes[m]);p.removeEventListener(\"dispose\",o),delete i[p.id],a.unregister(p);let _=r.get(p);_&&(t.remove(_),r.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,e.memory.geometries--}function c(p,_){return i[_.id]!==void 0||(_.addEventListener(\"dispose\",o),i[_.id]=new WeakRef(_),a.register(_,_.id,_),e.memory.geometries++),_}function h(p){let _=p.attributes;for(let m in _)t.update(_[m],s.ARRAY_BUFFER)}function d(p){let _=p.index,m=p.attributes.position,g=0;if(m===void 0)return;let v=_!==null?_.array.length:m.array.length/3-1,S=m.count>=65535?er:tr,y=new S(Math.ceil(v/3)*6,1),E=y.array;if(_!==null){let x=_.array;g=_.version;for(let b=0,I=0;bt.maxTextureSize&&(E=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);let A=new Float32Array(y*E*4*d),x=new ns(A,y,E,d);x.type=Je,x.needsUpdate=!0;let b=S*4;for(let R=0;R\n\t\t\t#include \n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}`,depthTest:!1,depthWrite:!1}),u=new Ee(h,d),f=new ms(-1,1,1,-1,0,1),p=null,_=null,m=!1,g,v=null,S=[],y=!1;this.setSize=function(E,A){a.setSize(E,A),o!==null&&o.setSize(E,A),l!==null&&l.setSize(E,A);for(let x=0;x0&&S[0].isRenderPass===!0;let A=a.width,x=a.height;S.length>0&&o===null&&(o=new $e(A,x,{type:An,depthBuffer:!1,stencilBuffer:!1}),l=new $e(A,x,{type:An,depthBuffer:!1,stencilBuffer:!1}));let b=i===!0&&S.some(I=>I.needsDepthTexture===!0);b!==(a.depthTexture!==null)&&(b===!0&&c===null&&(c=new Xn(A,x),r===!0&&(c.format=Jn,c.type=Oi)),a.dispose(),a.depthTexture=b?c:null,a.resolveDepthBuffer=b,a.storeMultisampledDepthBuffer=b);for(let I=0;I0)return s;let i=t*e,r=Dm[i];if(r===void 0&&(r=new Float32Array(i),Dm[i]=r),t!==0){n.toArray(r,0);for(let a=1,o=0;a!==t;++a)o+=e,s[a].toArray(r,o)}return r}function Ne(s,t){if(s.length!==t.length)return!1;for(let e=0,n=s.length;e0&&(this.seq=i.concat(r))}setValue(t,e,n,i){let r=this.map[e];r!==void 0&&r.setValue(t,n,i)}setOptional(t,e,n){let i=e[n];i!==void 0&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,a=e.length;r!==a;++r){let o=e[r],l=n[o.id];l.needsUpdate!==!1&&o.setValue(t,l.value,i)}}static seqWithValue(t,e){let n=[];for(let i=0,r=t.length;i!==r;++i){let a=t[i];a.id in e&&n.push(a)}return n}};function zm(s,t,e){let n=s.createShader(t);return s.shaderSource(n,e),s.compileShader(n),n}var tS=37297,eS=0;function nS(s,t){let e=s.split(`\n`),n=[],i=Math.max(t-6,0),r=Math.min(t+6,e.length);for(let a=i;a\":\" \"} ${o}: ${e[a]}`)}return n.join(`\n`)}var km=new Wt;function iS(s){jt._getMatrix(km,jt.workingColorSpace,s);let t=`mat3( ${km.elements.map(e=>e.toFixed(4))} )`;switch(jt.getTransfer(s)){case $s:return[t,\"LinearTransferOETF\"];case ce:return[t,\"sRGBTransferOETF\"];default:return gt(\"WebGLProgram: Unsupported color space: \",s),[t,\"LinearTransferOETF\"]}}function Gm(s,t,e){let n=s.getShaderParameter(t,s.COMPILE_STATUS),r=(s.getShaderInfoLog(t)||\"\").trim();if(n&&r===\"\")return\"\";let a=/ERROR: 0:(\\d+)/.exec(r);if(a){let o=parseInt(a[1]);return e.toUpperCase()+`\n\n`+r+`\n\n`+nS(s.getShaderSource(t),o)}else return r}function sS(s,t){let e=iS(t);return[`vec4 ${s}( vec4 value ) {`,`\treturn ${e[1]}( vec4( ${e[0]} * value.rgb, value.a ) );`,\"}\"].join(`\n`)}var rS={[Mh]:\"Linear\",[bh]:\"Reinhard\",[Th]:\"Cineon\",[Ah]:\"ACESFilmic\",[wh]:\"AgX\",[Rh]:\"Neutral\",[Eh]:\"Custom\"};function aS(s,t){let e=rS[t];return e===void 0?(gt(\"WebGLProgram: Unsupported toneMapping:\",t),\"vec3 \"+s+\"( vec3 color ) { return LinearToneMapping( color ); }\"):\"vec3 \"+s+\"( vec3 color ) { return \"+e+\"ToneMapping( color ); }\"}var Wh=new C;function oS(){jt.getLuminanceCoefficients(Wh);let s=Wh.x.toFixed(4),t=Wh.y.toFixed(4),e=Wh.z.toFixed(4);return[\"float luminance( const in vec3 rgb ) {\",`\tconst vec3 weights = vec3( ${s}, ${t}, ${e} );`,\"\treturn dot( weights, rgb );\",\"}\"].join(`\n`)}function lS(s){return[s.extensionClipCullDistance?\"#extension GL_ANGLE_clip_cull_distance : require\":\"\",s.extensionMultiDraw?\"#extension GL_ANGLE_multi_draw : require\":\"\"].filter(fl).join(`\n`)}function cS(s){let t=[];for(let e in s){let n=s[e];n!==!1&&t.push(\"#define \"+e+\" \"+n)}return t.join(`\n`)}function hS(s,t){let e={},n=s.getProgramParameter(t,s.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function kd(s){return s.replace(uS,dS)}function dS(s,t){let e=Jt[t];if(e===void 0)throw new Error(\"THREE.WebGLProgram: Can not resolve #include <\"+t+\">\");return kd(e)}var fS=/#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 Wm(s){return s.replace(fS,pS)}function pS(s,t,e,n){let i=\"\";for(let r=parseInt(t);r0&&(_+=`\n`),m=[\"#define SHADER_TYPE \"+e.shaderType,\"#define SHADER_NAME \"+e.shaderName,f].filter(fl).join(`\n`),m.length>0&&(m+=`\n`)):(_=[Xm(e),\"#define SHADER_TYPE \"+e.shaderType,\"#define SHADER_NAME \"+e.shaderName,f,e.extensionClipCullDistance?\"#define USE_CLIP_DISTANCE\":\"\",e.batching?\"#define USE_BATCHING\":\"\",e.batchingColor?\"#define USE_BATCHING_COLOR\":\"\",e.instancing?\"#define USE_INSTANCING\":\"\",e.instancingColor?\"#define USE_INSTANCING_COLOR\":\"\",e.instancingMorph?\"#define USE_INSTANCING_MORPH\":\"\",e.useFog&&e.fog?\"#define USE_FOG\":\"\",e.useFog&&e.fogExp2?\"#define FOG_EXP2\":\"\",e.map?\"#define USE_MAP\":\"\",e.envMap?\"#define USE_ENVMAP\":\"\",e.envMap?\"#define \"+h:\"\",e.lightMap?\"#define USE_LIGHTMAP\":\"\",e.aoMap?\"#define USE_AOMAP\":\"\",e.bumpMap?\"#define USE_BUMPMAP\":\"\",e.normalMap?\"#define USE_NORMALMAP\":\"\",e.normalMapObjectSpace?\"#define USE_NORMALMAP_OBJECTSPACE\":\"\",e.normalMapTangentSpace?\"#define USE_NORMALMAP_TANGENTSPACE\":\"\",e.displacementMap?\"#define USE_DISPLACEMENTMAP\":\"\",e.emissiveMap?\"#define USE_EMISSIVEMAP\":\"\",e.anisotropy?\"#define USE_ANISOTROPY\":\"\",e.anisotropyMap?\"#define USE_ANISOTROPYMAP\":\"\",e.clearcoatMap?\"#define USE_CLEARCOATMAP\":\"\",e.clearcoatRoughnessMap?\"#define USE_CLEARCOAT_ROUGHNESSMAP\":\"\",e.clearcoatNormalMap?\"#define USE_CLEARCOAT_NORMALMAP\":\"\",e.diffuseRoughnessMap?\"#define USE_DIFFUSE_ROUGHNESSMAP\":\"\",e.iridescenceMap?\"#define USE_IRIDESCENCEMAP\":\"\",e.iridescenceThicknessMap?\"#define USE_IRIDESCENCE_THICKNESSMAP\":\"\",e.specularMap?\"#define USE_SPECULARMAP\":\"\",e.specularColorMap?\"#define USE_SPECULAR_COLORMAP\":\"\",e.specularIntensityMap?\"#define USE_SPECULAR_INTENSITYMAP\":\"\",e.roughnessMap?\"#define USE_ROUGHNESSMAP\":\"\",e.metalnessMap?\"#define USE_METALNESSMAP\":\"\",e.alphaMap?\"#define USE_ALPHAMAP\":\"\",e.alphaHash?\"#define USE_ALPHAHASH\":\"\",e.transmission?\"#define USE_TRANSMISSION\":\"\",e.transmissionMap?\"#define USE_TRANSMISSIONMAP\":\"\",e.thicknessMap?\"#define USE_THICKNESSMAP\":\"\",e.sheenColorMap?\"#define USE_SHEEN_COLORMAP\":\"\",e.sheenRoughnessMap?\"#define USE_SHEEN_ROUGHNESSMAP\":\"\",e.mapUv?\"#define MAP_UV \"+e.mapUv:\"\",e.alphaMapUv?\"#define ALPHAMAP_UV \"+e.alphaMapUv:\"\",e.lightMapUv?\"#define LIGHTMAP_UV \"+e.lightMapUv:\"\",e.aoMapUv?\"#define AOMAP_UV \"+e.aoMapUv:\"\",e.emissiveMapUv?\"#define EMISSIVEMAP_UV \"+e.emissiveMapUv:\"\",e.bumpMapUv?\"#define BUMPMAP_UV \"+e.bumpMapUv:\"\",e.normalMapUv?\"#define NORMALMAP_UV \"+e.normalMapUv:\"\",e.displacementMapUv?\"#define DISPLACEMENTMAP_UV \"+e.displacementMapUv:\"\",e.metalnessMapUv?\"#define METALNESSMAP_UV \"+e.metalnessMapUv:\"\",e.roughnessMapUv?\"#define ROUGHNESSMAP_UV \"+e.roughnessMapUv:\"\",e.anisotropyMapUv?\"#define ANISOTROPYMAP_UV \"+e.anisotropyMapUv:\"\",e.clearcoatMapUv?\"#define CLEARCOATMAP_UV \"+e.clearcoatMapUv:\"\",e.clearcoatNormalMapUv?\"#define CLEARCOAT_NORMALMAP_UV \"+e.clearcoatNormalMapUv:\"\",e.clearcoatRoughnessMapUv?\"#define CLEARCOAT_ROUGHNESSMAP_UV \"+e.clearcoatRoughnessMapUv:\"\",e.diffuseRoughnessMapUv?\"#define DIFFUSE_ROUGHNESSMAP_UV \"+e.diffuseRoughnessMapUv:\"\",e.iridescenceMapUv?\"#define IRIDESCENCEMAP_UV \"+e.iridescenceMapUv:\"\",e.iridescenceThicknessMapUv?\"#define IRIDESCENCE_THICKNESSMAP_UV \"+e.iridescenceThicknessMapUv:\"\",e.sheenColorMapUv?\"#define SHEEN_COLORMAP_UV \"+e.sheenColorMapUv:\"\",e.sheenRoughnessMapUv?\"#define SHEEN_ROUGHNESSMAP_UV \"+e.sheenRoughnessMapUv:\"\",e.specularMapUv?\"#define SPECULARMAP_UV \"+e.specularMapUv:\"\",e.specularColorMapUv?\"#define SPECULAR_COLORMAP_UV \"+e.specularColorMapUv:\"\",e.specularIntensityMapUv?\"#define SPECULAR_INTENSITYMAP_UV \"+e.specularIntensityMapUv:\"\",e.transmissionMapUv?\"#define TRANSMISSIONMAP_UV \"+e.transmissionMapUv:\"\",e.thicknessMapUv?\"#define THICKNESSMAP_UV \"+e.thicknessMapUv:\"\",e.vertexTangents&&e.flatShading===!1?\"#define USE_TANGENT\":\"\",e.vertexNormals?\"#define HAS_NORMAL\":\"\",e.vertexColors?\"#define USE_COLOR\":\"\",e.vertexAlphas?\"#define USE_COLOR_ALPHA\":\"\",e.vertexUv1s?\"#define USE_UV1\":\"\",e.vertexUv2s?\"#define USE_UV2\":\"\",e.vertexUv3s?\"#define USE_UV3\":\"\",e.pointsUvs?\"#define USE_POINTS_UV\":\"\",e.flatShading?\"#define FLAT_SHADED\":\"\",e.skinning?\"#define USE_SKINNING\":\"\",e.morphTargets?\"#define USE_MORPHTARGETS\":\"\",e.morphNormals&&e.flatShading===!1?\"#define USE_MORPHNORMALS\":\"\",e.morphColors?\"#define USE_MORPHCOLORS\":\"\",e.morphTargetsCount>0?\"#define MORPHTARGETS_TEXTURE_STRIDE \"+e.morphTextureStride:\"\",e.morphTargetsCount>0?\"#define MORPHTARGETS_COUNT \"+e.morphTargetsCount:\"\",e.doubleSided?\"#define DOUBLE_SIDED\":\"\",e.flipSided?\"#define FLIP_SIDED\":\"\",e.shadowMapEnabled?\"#define USE_SHADOWMAP\":\"\",e.shadowMapEnabled?\"#define \"+l:\"\",e.sizeAttenuation?\"#define USE_SIZEATTENUATION\":\"\",e.numLightProbes>0?\"#define USE_LIGHT_PROBES\":\"\",e.logarithmicDepthBuffer?\"#define USE_LOGARITHMIC_DEPTH_BUFFER\":\"\",e.reversedDepthBuffer?\"#define USE_REVERSED_DEPTH_BUFFER\":\"\",\"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(fl).join(`\n`),m=[Xm(e),\"#define SHADER_TYPE \"+e.shaderType,\"#define SHADER_NAME \"+e.shaderName,f,e.useFog&&e.fog?\"#define USE_FOG\":\"\",e.useFog&&e.fogExp2?\"#define FOG_EXP2\":\"\",e.alphaToCoverage?\"#define ALPHA_TO_COVERAGE\":\"\",e.map?\"#define USE_MAP\":\"\",e.matcap?\"#define USE_MATCAP\":\"\",e.envMap?\"#define USE_ENVMAP\":\"\",e.envMap?\"#define \"+c:\"\",e.envMap?\"#define \"+h:\"\",e.envMap?\"#define \"+d:\"\",e.envMapPMREM?\"#define ENVMAP_MAX_LOD \"+e.envMapMaxLod+\".0\":\"\",e.envMapPMREM?\"#define ENVMAP_SIZE \"+e.envMapSize+\".0\":\"\",e.lightMap?\"#define USE_LIGHTMAP\":\"\",e.aoMap?\"#define USE_AOMAP\":\"\",e.bumpMap?\"#define USE_BUMPMAP\":\"\",e.normalMap?\"#define USE_NORMALMAP\":\"\",e.normalMapObjectSpace?\"#define USE_NORMALMAP_OBJECTSPACE\":\"\",e.normalMapTangentSpace?\"#define USE_NORMALMAP_TANGENTSPACE\":\"\",e.packedNormalMap?\"#define USE_PACKED_NORMALMAP\":\"\",e.emissiveMap?\"#define USE_EMISSIVEMAP\":\"\",e.anisotropy?\"#define USE_ANISOTROPY\":\"\",e.anisotropyMap?\"#define USE_ANISOTROPYMAP\":\"\",e.clearcoat?\"#define USE_CLEARCOAT\":\"\",e.clearcoatMap?\"#define USE_CLEARCOATMAP\":\"\",e.clearcoatRoughnessMap?\"#define USE_CLEARCOAT_ROUGHNESSMAP\":\"\",e.clearcoatNormalMap?\"#define USE_CLEARCOAT_NORMALMAP\":\"\",e.diffuseRoughness?\"#define USE_DIFFUSE_ROUGHNESS\":\"\",e.diffuseRoughnessMap?\"#define USE_DIFFUSE_ROUGHNESSMAP\":\"\",e.dispersion?\"#define USE_DISPERSION\":\"\",e.retroreflection?\"#define USE_RETROREFLECTION\":\"\",e.iridescence?\"#define USE_IRIDESCENCE\":\"\",e.iridescenceMap?\"#define USE_IRIDESCENCEMAP\":\"\",e.iridescenceThicknessMap?\"#define USE_IRIDESCENCE_THICKNESSMAP\":\"\",e.specularMap?\"#define USE_SPECULARMAP\":\"\",e.specularColorMap?\"#define USE_SPECULAR_COLORMAP\":\"\",e.specularIntensityMap?\"#define USE_SPECULAR_INTENSITYMAP\":\"\",e.roughnessMap?\"#define USE_ROUGHNESSMAP\":\"\",e.metalnessMap?\"#define USE_METALNESSMAP\":\"\",e.alphaMap?\"#define USE_ALPHAMAP\":\"\",e.alphaTest?\"#define USE_ALPHATEST\":\"\",e.alphaHash?\"#define USE_ALPHAHASH\":\"\",e.sheen?\"#define USE_SHEEN\":\"\",e.sheenColorMap?\"#define USE_SHEEN_COLORMAP\":\"\",e.sheenRoughnessMap?\"#define USE_SHEEN_ROUGHNESSMAP\":\"\",e.transmission?\"#define USE_TRANSMISSION\":\"\",e.transmissionMap?\"#define USE_TRANSMISSIONMAP\":\"\",e.thicknessMap?\"#define USE_THICKNESSMAP\":\"\",e.vertexTangents&&e.flatShading===!1?\"#define USE_TANGENT\":\"\",e.vertexColors||e.instancingColor?\"#define USE_COLOR\":\"\",e.vertexAlphas||e.batchingColor?\"#define USE_COLOR_ALPHA\":\"\",e.vertexUv1s?\"#define USE_UV1\":\"\",e.vertexUv2s?\"#define USE_UV2\":\"\",e.vertexUv3s?\"#define USE_UV3\":\"\",e.pointsUvs?\"#define USE_POINTS_UV\":\"\",e.gradientMap?\"#define USE_GRADIENTMAP\":\"\",e.flatShading?\"#define FLAT_SHADED\":\"\",e.doubleSided?\"#define DOUBLE_SIDED\":\"\",e.flipSided?\"#define FLIP_SIDED\":\"\",e.shadowMapEnabled?\"#define USE_SHADOWMAP\":\"\",e.shadowMapEnabled?\"#define \"+l:\"\",e.premultipliedAlpha?\"#define PREMULTIPLIED_ALPHA\":\"\",e.numLightProbes>0?\"#define USE_LIGHT_PROBES\":\"\",e.decodeVideoTexture?\"#define DECODE_VIDEO_TEXTURE\":\"\",e.decodeVideoTextureEmissive?\"#define DECODE_VIDEO_TEXTURE_EMISSIVE\":\"\",e.logarithmicDepthBuffer?\"#define USE_LOGARITHMIC_DEPTH_BUFFER\":\"\",e.reversedDepthBuffer?\"#define USE_REVERSED_DEPTH_BUFFER\":\"\",\"uniform mat4 viewMatrix;\",\"uniform vec3 cameraPosition;\",\"uniform bool isOrthographic;\",e.toneMapping!==On?\"#define TONE_MAPPING\":\"\",e.toneMapping!==On?Jt.tonemapping_pars_fragment:\"\",e.toneMapping!==On?aS(\"toneMapping\",e.toneMapping):\"\",e.dithering?\"#define DITHERING\":\"\",e.opaque?\"#define OPAQUE\":\"\",Jt.colorspace_pars_fragment,sS(\"linearToOutputTexel\",e.outputColorSpace),oS(),e.useDepthPacking?\"#define DEPTH_PACKING \"+e.depthPacking:\"\",`\n`].filter(fl).join(`\n`)),a=kd(a),a=Vm(a,e),a=Hm(a,e),o=kd(o),o=Vm(o,e),o=Hm(o,e),a=Wm(a),o=Wm(o),e.isRawShaderMaterial!==!0&&(g=`#version 300 es\n`,_=[u,\"#define attribute in\",\"#define varying out\",\"#define texture2D texture\"].join(`\n`)+`\n`+_,m=[\"#define varying in\",e.glslVersion===kh?\"\":\"layout(location = 0) out highp vec4 pc_fragColor;\",e.glslVersion===kh?\"\":\"#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`+m);let v=g+_+a,S=g+m+o,y=zm(i,i.VERTEX_SHADER,v),E=zm(i,i.FRAGMENT_SHADER,S);i.attachShader(p,y),i.attachShader(p,E),e.index0AttributeName!==void 0?i.bindAttribLocation(p,0,e.index0AttributeName):e.hasPositionAttribute===!0&&i.bindAttribLocation(p,0,\"position\"),i.linkProgram(p);function A(R){if(s.debug.checkShaderErrors){let L=i.getProgramInfoLog(p)||\"\",F=i.getShaderInfoLog(y)||\"\",H=i.getShaderInfoLog(E)||\"\",D=L.trim(),k=F.trim(),X=H.trim(),G=!0,nt=!0;if(i.getProgramParameter(p,i.LINK_STATUS)===!1)if(G=!1,typeof s.debug.onShaderError==\"function\")s.debug.onShaderError(i,p,y,E);else{let W=Gm(i,y,\"vertex\"),Q=Gm(i,E,\"fragment\");Lt(\"WebGLProgram: Shader Error \"+i.getError()+\" - VALIDATE_STATUS \"+i.getProgramParameter(p,i.VALIDATE_STATUS)+`\n\nMaterial Name: `+R.name+`\nMaterial Type: `+R.type+`\n\nProgram Info Log: `+D+`\n`+W+`\n`+Q)}else D!==\"\"?gt(\"WebGLProgram: Program Info Log:\",D):(k===\"\"||X===\"\")&&(nt=!1);nt&&(R.diagnostics={runnable:G,programLog:D,vertexShader:{log:k,prefix:_},fragmentShader:{log:X,prefix:m}})}i.deleteShader(y),i.deleteShader(E),x=new Gr(i,p),b=hS(i,p)}let x;this.getUniforms=function(){return x===void 0&&A(this),x};let b;this.getAttributes=function(){return b===void 0&&A(this),b};let I=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return I===!1&&(I=i.getProgramParameter(p,tS)),I},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(p),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=eS++,this.cacheKey=t,this.usedTimes=1,this.program=p,this.vertexShader=y,this.fragmentShader=E,this}var MS=0,Gd=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t,e,n){let i=this._getShaderCacheForMaterial(t);return i.has(e)===!1&&(i.add(e),e.usedTimes++),i.has(n)===!1&&(i.add(n),n.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderStage(t){return this._getShaderStage(t.vertexShader)}getFragmentShaderStage(t){return this._getShaderStage(t.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new Vd(t),e.set(t,n)),n}},Vd=class{constructor(t){this.id=MS++,this.code=t,this.usedTimes=0}};function bS(s){return s===pi||s===zr||s===kr}function TS(s,t,e,n,i,r){let a=new ss,o=new Gd,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer,u={MeshDepthMaterial:\"depth\",MeshDistanceMaterial:\"distance\",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 f(x){return l.add(x),x===0?\"uv\":`uv${x}`}function p(x,b,I,R,L,F){let H=R.fog,D=L.geometry,k=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?R.environment:null,X=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,G=t.get(x.envMap||k,X),nt=u[x.type],W=n.precision;x.precision!==null&&(W=n.getMaxPrecision(x.precision),W!==x.precision&>(\"WebGLProgram.getParameters:\",x.precision,\"not supported, using\",W,\"instead.\"));let Q=D.morphAttributes.position||D.morphAttributes.normal||D.morphAttributes.color,tt=Q!==void 0?Q.length:0,Et=0;D.morphAttributes.position!==void 0&&(Et=1),D.morphAttributes.normal!==void 0&&(Et=2),D.morphAttributes.color!==void 0&&(Et=3);let zt,Y,xt,wt;if(nt){let St=Bn[nt];zt=St.vertexShader,Y=St.fragmentShader}else{zt=x.vertexShader,Y=x.fragmentShader;let St=o.getVertexShaderStage(x),de=o.getFragmentShaderStage(x);o.update(x,St,de),xt=St.id,wt=de.id}let Ft=s.getRenderTarget(),vt=s.state.buffers.depth.getReversed(),Ot=L.isInstancedMesh===!0,_e=L.isBatchedMesh===!0,kt=!!x.map,Kt=!!x.matcap,te=!!G,j=te&&G.isPMREMTexture===!0,ct=!!x.aoMap,at=!!x.lightMap,At=!!x.bumpMap&&x.wireframe===!1,_t=!!x.normalMap,qt=!!x.displacementMap,Dt=!!x.emissiveMap,ee=!!x.metalnessMap,ne=!!x.roughnessMap,ae=x.anisotropy>0,U=x.clearcoat>0,we=x.diffuseRoughness>0,Qt=x.dispersion>0,pe=x.retroreflectivity>0,ft=x.iridescence>0,Se=x.sheen>0,Bt=x.transmission>0,Ht=ae&&!!x.anisotropyMap,w=U&&!!x.clearcoatMap,M=U&&!!x.clearcoatNormalMap,B=U&&!!x.clearcoatRoughnessMap,it=we&&!!x.diffuseRoughnessMap,K=ft&&!!x.iridescenceMap,ot=ft&&!!x.iridescenceThicknessMap,pt=Se&&!!x.sheenColorMap,Z=Se&&!!x.sheenRoughnessMap,J=!!x.specularMap,ht=!!x.specularColorMap,P=!!x.specularIntensityMap,$=Bt&&!!x.transmissionMap,q=Bt&&!!x.thicknessMap,ut=!!x.gradientMap,rt=!!x.alphaMap,lt=x.alphaTest>0,Nt=!!x.alphaHash,$t=!!x.extensions,st=On;x.toneMapped&&(Ft===null||Ft.isXRRenderTarget===!0)&&(st=s.toneMapping);let Ut=j?G.isCompressedCubeTexture?G.image[0].mipmaps:G.mipmaps:null,Zt={shaderID:nt,shaderType:x.type,shaderName:x.name,vertexShader:zt,fragmentShader:Y,defines:x.defines,customVertexShaderID:xt,customFragmentShaderID:wt,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:W,batching:_e,batchingColor:_e&&L._colorsTexture!==null,instancing:Ot,instancingColor:Ot&&L.instanceColor!==null,instancingMorph:Ot&&L.morphTexture!==null,outputColorSpace:Ft===null?s.outputColorSpace:Ft.isXRRenderTarget===!0?Ft.texture.colorSpace:jt.workingColorSpace,alphaToCoverage:!!x.alphaToCoverage,map:kt,matcap:Kt,envMap:te,envMapMode:te&&G.mapping,envMapPMREM:j,envMapMaxLod:j?Ut.length-1:null,envMapSize:j?Ut[0].width:null,aoMap:ct,lightMap:at,bumpMap:At,normalMap:_t,displacementMap:qt,emissiveMap:Dt,normalMapObjectSpace:_t&&x.normalMapType===vd,normalMapTangentSpace:_t&&x.normalMapType===$n,packedNormalMap:_t&&x.normalMapType===$n&&bS(x.normalMap.format),metalnessMap:ee,roughnessMap:ne,anisotropy:ae,anisotropyMap:Ht,clearcoat:U,clearcoatMap:w,clearcoatNormalMap:M,clearcoatRoughnessMap:B,diffuseRoughness:we,diffuseRoughnessMap:it,dispersion:Qt,retroreflection:pe,iridescence:ft,iridescenceMap:K,iridescenceThicknessMap:ot,sheen:Se,sheenColorMap:pt,sheenRoughnessMap:Z,specularMap:J,specularColorMap:ht,specularIntensityMap:P,transmission:Bt,transmissionMap:$,thicknessMap:q,gradientMap:ut,opaque:x.transparent===!1&&x.blending===xs&&x.alphaToCoverage===!1,alphaMap:rt,alphaTest:lt,alphaHash:Nt,combine:x.combine,mapUv:kt&&f(x.map.channel),aoMapUv:ct&&f(x.aoMap.channel),lightMapUv:at&&f(x.lightMap.channel),bumpMapUv:At&&f(x.bumpMap.channel),normalMapUv:_t&&f(x.normalMap.channel),displacementMapUv:qt&&f(x.displacementMap.channel),emissiveMapUv:Dt&&f(x.emissiveMap.channel),metalnessMapUv:ee&&f(x.metalnessMap.channel),roughnessMapUv:ne&&f(x.roughnessMap.channel),anisotropyMapUv:Ht&&f(x.anisotropyMap.channel),clearcoatMapUv:w&&f(x.clearcoatMap.channel),clearcoatNormalMapUv:M&&f(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:B&&f(x.clearcoatRoughnessMap.channel),diffuseRoughnessMapUv:it&&f(x.diffuseRoughnessMap.channel),iridescenceMapUv:K&&f(x.iridescenceMap.channel),iridescenceThicknessMapUv:ot&&f(x.iridescenceThicknessMap.channel),sheenColorMapUv:pt&&f(x.sheenColorMap.channel),sheenRoughnessMapUv:Z&&f(x.sheenRoughnessMap.channel),specularMapUv:J&&f(x.specularMap.channel),specularColorMapUv:ht&&f(x.specularColorMap.channel),specularIntensityMapUv:P&&f(x.specularIntensityMap.channel),transmissionMapUv:$&&f(x.transmissionMap.channel),thicknessMapUv:q&&f(x.thicknessMap.channel),alphaMapUv:rt&&f(x.alphaMap.channel),vertexTangents:!!D.attributes.tangent&&(_t||ae),vertexNormals:!!D.attributes.normal,vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!D.attributes.color&&D.attributes.color.itemSize===4,pointsUvs:L.isPoints===!0&&!!D.attributes.uv&&(kt||rt),fog:!!H,useFog:x.fog===!0,fogExp2:!!H&&H.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||D.attributes.normal===void 0&&_t===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:vt,skinning:L.isSkinnedMesh===!0,hasPositionAttribute:D.attributes.position!==void 0,morphTargets:D.morphAttributes.position!==void 0,morphNormals:D.morphAttributes.normal!==void 0,morphColors:D.morphAttributes.color!==void 0,morphTargetsCount:tt,morphTextureStride:Et,numSunLights:b.sun.length,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numSunLightShadows:b.sunShadowMap.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numLightProbeGrids:F.filter(St=>St.texture!==null).length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:x.dithering,shadowMapEnabled:s.shadowMap.enabled&&I.length>0,shadowMapType:s.shadowMap.type,toneMapping:st,decodeVideoTexture:kt&&x.map.isVideoTexture===!0&&jt.getTransfer(x.map.colorSpace)===ce,decodeVideoTextureEmissive:Dt&&x.emissiveMap.isVideoTexture===!0&&jt.getTransfer(x.emissiveMap.colorSpace)===ce,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===Fn,flipSided:x.side===Ke,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:$t&&x.extensions.clipCullDistance===!0&&e.has(\"WEBGL_clip_cull_distance\"),extensionMultiDraw:($t&&x.extensions.multiDraw===!0||_e)&&e.has(\"WEBGL_multi_draw\"),rendererExtensionParallelShaderCompile:e.has(\"KHR_parallel_shader_compile\"),customProgramCacheKey:x.customProgramCacheKey()};return Zt.vertexUv1s=l.has(1),Zt.vertexUv2s=l.has(2),Zt.vertexUv3s=l.has(3),l.clear(),Zt}function _(x){let b=[];if(x.shaderID?b.push(x.shaderID):(b.push(x.customVertexShaderID),b.push(x.customFragmentShaderID)),x.defines!==void 0)for(let I in x.defines)b.push(I),b.push(x.defines[I]);return x.isRawShaderMaterial===!1&&(m(b,x),g(b,x),b.push(s.outputColorSpace)),b.push(x.customProgramCacheKey),b.join()}function m(x,b){x.push(b.precision),x.push(b.outputColorSpace),x.push(b.envMapMode),x.push(b.envMapPMREM),x.push(b.envMapMaxLod),x.push(b.envMapSize),x.push(b.mapUv),x.push(b.alphaMapUv),x.push(b.lightMapUv),x.push(b.aoMapUv),x.push(b.bumpMapUv),x.push(b.normalMapUv),x.push(b.displacementMapUv),x.push(b.emissiveMapUv),x.push(b.metalnessMapUv),x.push(b.roughnessMapUv),x.push(b.anisotropyMapUv),x.push(b.clearcoatMapUv),x.push(b.clearcoatNormalMapUv),x.push(b.clearcoatRoughnessMapUv),x.push(b.diffuseRoughnessMapUv),x.push(b.iridescenceMapUv),x.push(b.iridescenceThicknessMapUv),x.push(b.sheenColorMapUv),x.push(b.sheenRoughnessMapUv),x.push(b.specularMapUv),x.push(b.specularColorMapUv),x.push(b.specularIntensityMapUv),x.push(b.transmissionMapUv),x.push(b.thicknessMapUv),x.push(b.combine),x.push(b.fogExp2),x.push(b.sizeAttenuation),x.push(b.morphTargetsCount),x.push(b.numSunLights),x.push(b.numDirLights),x.push(b.numPointLights),x.push(b.numSpotLights),x.push(b.numSpotLightMaps),x.push(b.numHemiLights),x.push(b.numRectAreaLights),x.push(b.numSunLightShadows),x.push(b.numDirLightShadows),x.push(b.numPointLightShadows),x.push(b.numSpotLightShadows),x.push(b.numSpotLightShadowsWithMaps),x.push(b.numLightProbes),x.push(b.numLightProbeGrids),x.push(b.shadowMapType),x.push(b.toneMapping),x.push(b.numClippingPlanes),x.push(b.numClipIntersection),x.push(b.depthPacking)}function g(x,b){a.disableAll(),b.instancing&&a.enable(0),b.instancingColor&&a.enable(1),b.instancingMorph&&a.enable(2),b.matcap&&a.enable(3),b.envMap&&a.enable(4),b.normalMapObjectSpace&&a.enable(5),b.normalMapTangentSpace&&a.enable(6),b.clearcoat&&a.enable(7),b.iridescence&&a.enable(8),b.alphaTest&&a.enable(9),b.vertexColors&&a.enable(10),b.vertexAlphas&&a.enable(11),b.vertexUv1s&&a.enable(12),b.vertexUv2s&&a.enable(13),b.vertexUv3s&&a.enable(14),b.vertexTangents&&a.enable(15),b.anisotropy&&a.enable(16),b.alphaHash&&a.enable(17),b.batching&&a.enable(18),b.dispersion&&a.enable(19),b.retroreflection&&a.enable(24),b.diffuseRoughness&&a.enable(25),b.batchingColor&&a.enable(20),b.gradientMap&&a.enable(21),b.packedNormalMap&&a.enable(22),b.vertexNormals&&a.enable(23),x.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reversedDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.decodeVideoTextureEmissive&&a.enable(20),b.alphaToCoverage&&a.enable(21),b.numLightProbeGrids>0&&a.enable(22),b.hasPositionAttribute&&a.enable(23),x.push(a.mask)}function v(x){let b=u[x.type],I;if(b){let R=Bn[b];I=Pd.clone(R.uniforms)}else I=x.uniforms;return I}function S(x,b){let I=h.get(b);return I!==void 0?++I.usedTimes:(I=new SS(s,b,x,i),c.push(I),h.set(b,I)),I}function y(x){if(--x.usedTimes===0){let b=c.indexOf(x);c[b]=c[c.length-1],c.pop(),h.delete(x.cacheKey),x.destroy()}}function E(x){o.remove(x)}function A(){o.dispose()}return{getParameters:p,getProgramCacheKey:_,getUniforms:v,acquireProgram:S,releaseProgram:y,releaseShaderCache:E,programs:c,dispose:A}}function AS(){let s=new WeakMap;function t(a){return s.has(a)}function e(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,l){s.get(a)[o]=l}function r(){s=new WeakMap}return{has:t,get:e,remove:n,update:i,dispose:r}}function ES(s,t){return s.groupOrder!==t.groupOrder?s.groupOrder-t.groupOrder:s.renderOrder!==t.renderOrder?s.renderOrder-t.renderOrder:s.material.id!==t.material.id?s.material.id-t.material.id:s.materialVariant!==t.materialVariant?s.materialVariant-t.materialVariant:s.z!==t.z?s.z-t.z:s.id-t.id}function qm(s,t){return s.groupOrder!==t.groupOrder?s.groupOrder-t.groupOrder:s.renderOrder!==t.renderOrder?s.renderOrder-t.renderOrder:s.z!==t.z?t.z-s.z:s.id-t.id}function Ym(){let s=[],t=0,e=[],n=[],i=[];function r(){t=0,e.length=0,n.length=0,i.length=0}function a(u){let f=0;return u.isInstancedMesh&&(f+=2),u.isSkinnedMesh&&(f+=1),f}function o(u,f,p,_,m,g){let v=s[t];return v===void 0?(v={id:u.id,object:u,geometry:f,material:p,materialVariant:a(u),groupOrder:_,renderOrder:u.renderOrder,z:m,group:g},s[t]=v):(v.id=u.id,v.object=u,v.geometry=f,v.material=p,v.materialVariant=a(u),v.groupOrder=_,v.renderOrder=u.renderOrder,v.z=m,v.group=g),t++,v}function l(u,f,p,_,m,g,v){v.reversedDepth===!0&&(m=-m);let S=o(u,f,p,_,m,g);p.transmission>0?n.push(S):p.transparent===!0?i.push(S):e.push(S)}function c(u,f,p,_,m,g){let v=o(u,f,p,_,m,g);p.transmission>0?n.unshift(v):p.transparent===!0?i.unshift(v):e.unshift(v)}function h(u,f){e.length>1&&e.sort(u||ES),n.length>1&&n.sort(f||qm),i.length>1&&i.sort(f||qm)}function d(){for(let u=t,f=s.length;u=r.length?(a=new Ym,r.push(a)):a=r[i],a}function e(){s=new WeakMap}return{get:t,dispose:e}}function RS(){let s={};return{get:function(t){if(s[t.id]!==void 0)return s[t.id];let e;switch(t.type){case\"SunLight\":case\"DirectionalLight\":e={direction:new C,color:new bt};break;case\"SpotLight\":e={position:new C,direction:new C,color:new bt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case\"PointLight\":e={position:new C,color:new bt,distance:0,decay:0};break;case\"HemisphereLight\":e={direction:new C,skyColor:new bt,groundColor:new bt};break;case\"RectAreaLight\":e={color:new bt,position:new C,halfWidth:new C,halfHeight:new C};break}return s[t.id]=e,e}}}function CS(){let s={};return{get:function(t){if(s[t.id]!==void 0)return s[t.id];let e;switch(t.type){case\"SunLight\":case\"DirectionalLight\":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case\"SpotLight\":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et};break;case\"PointLight\":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new et,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[t.id]=e,e}}}var IS=0;function PS(s,t){return(t.castShadow?2:0)-(s.castShadow?2:0)+(t.map?1:0)-(s.map?1:0)}function LS(s){let t=new RS,e=CS(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],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 c=0;c<9;c++)n.probe.push(new C);let i=new C,r=new Vt,a=new Vt;function o(c){let h=0,d=0,u=0;for(let F=0;F<9;F++)n.probe[F].set(0,0,0);let f=0,p=0,_=0,m=0,g=0,v=0,S=0,y=0,E=0,A=0,x=0,b=0,I=0,R=0;c.sort(PS);for(let F=0,H=c.length;F0&&(s.has(\"OES_texture_float_linear\")===!0?(n.rectAreaLTC1=yt.LTC_FLOAT_1,n.rectAreaLTC2=yt.LTC_FLOAT_2):(n.rectAreaLTC1=yt.LTC_HALF_1,n.rectAreaLTC2=yt.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;let L=n.hash;(L.sunLength!==f||L.directionalLength!==m||L.pointLength!==g||L.spotLength!==v||L.rectAreaLength!==S||L.hemiLength!==y||L.numSunShadows!==p||L.numDirectionalShadows!==E||L.numPointShadows!==A||L.numSpotShadows!==x||L.numSpotMaps!==b||L.numLightProbes!==R)&&(n.sun.length=f,n.directional.length=m,n.spot.length=v,n.rectArea.length=S,n.point.length=g,n.hemi.length=y,n.sunShadow.length=p,n.sunShadowMap.length=p,n.sunShadowMatrix.length=_,n.sunShadowCascade.length=_,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.directionalShadowMatrix.length=E,n.pointShadow.length=A,n.pointShadowMap.length=A,n.pointShadowMatrix.length=A,n.spotShadow.length=x,n.spotShadowMap.length=x,n.spotLightMatrix.length=x+b-I,n.spotLightMap.length=b,n.numSpotLightShadowsWithMaps=I,n.numLightProbes=R,L.sunLength=f,L.directionalLength=m,L.pointLength=g,L.spotLength=v,L.rectAreaLength=S,L.hemiLength=y,L.numSunShadows=p,L.numDirectionalShadows=E,L.numPointShadows=A,L.numSpotShadows=x,L.numSpotMaps=b,L.numLightProbes=R,n.version=IS++)}function l(c,h){let d=0,u=0,f=0,p=0,_=0,m=0,g=h.matrixWorldInverse;for(let v=0,S=c.length;vd.priority-u.priority||d.id-u.id)}function c(d){t.setupView(e,d)}let h={lightsArray:e,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:h,setupLights:l,setupLightsView:c,pushLight:a,pushShadow:o}}function DS(s){let t=new WeakMap;function e(i,r=0){let a=t.get(i),o;return a===void 0?(o=new Zm(s),t.set(i,[o])):r>=a.length?(o=new Zm(s),a.push(o)):o=a[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}var NS=`void main() {\n\tgl_Position = vec4( position, 1.0 );\n}`,US=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\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( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}`,FS=[new C(1,0,0),new C(-1,0,0),new C(0,1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1)],OS=[new C(0,-1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1),new C(0,-1,0),new C(0,-1,0)],Jm=new Vt,dl=new C,Fd=new C;function BS(s,t,e){let n=new Wn,i=new et,r=new et,a=new ue,o=new yr,l=new Sr,c={},h=e.maxTextureSize,d={[fi]:Ke,[Ke]:fi,[Fn]:Fn},u=new Mn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new et},radius:{value:4}},vertexShader:NS,fragmentShader:US}),f=u.clone();f.defines.HORIZONTAL_PASS=1;let p=new Yt;p.setAttribute(\"position\",new fe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let _=new Ee(p,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Cr;let g=this.type;this.render=function(A,x,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===Yu&&(gt(\"WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead.\"),this.type=Cr);let I=s.getRenderTarget(),R=s.getActiveCubeFace(),L=s.getActiveMipmapLevel(),F=s.state;F.setBlending(Ni),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);let H=g!==this.type;H&&x.traverse(function(D){D.material&&(Array.isArray(D.material)?D.material.forEach(k=>k.needsUpdate=!0):D.material.needsUpdate=!0)});for(let D=0,k=A.length;Dh||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/nt.x),i.x=r.x*nt.x,G.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/nt.y),i.y=r.y*nt.y,G.mapSize.y=r.y));let W=s.state.buffers.depth.getReversed();if(G.camera._reversedDepth=W,G.map===null||H===!0){if(G.map!==null&&(G.map.depthTexture!==null&&(G.map.depthTexture.dispose(),G.map.depthTexture=null),G.map.dispose()),this.type===_s){if(X.isPointLight){gt(\"WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.\");continue}G.map=new $e(i.x,i.y,{format:pi,type:An,minFilter:xe,magFilter:xe,generateMipmaps:!1}),G.map.texture.name=X.name+\".shadowMap\",G.map.depthTexture=new Xn(i.x,i.y,Je),G.map.depthTexture.name=X.name+\".shadowMapDepth\",G.map.depthTexture.format=Vn,G.map.depthTexture.compareFunction=null,G.map.depthTexture.minFilter=be,G.map.depthTexture.magFilter=be}else X.isPointLight?(G.map=new Vr(i.x),G.map.depthTexture=new ar(i.x,_n)):(G.map=new $e(i.x,i.y),G.map.depthTexture=new Xn(i.x,i.y,_n)),G.map.depthTexture.name=X.name+\".shadowMap\",G.map.depthTexture.format=Vn,this.type===Cr?(G.map.depthTexture.compareFunction=W?Bh:Oh,G.map.depthTexture.minFilter=xe,G.map.depthTexture.magFilter=xe):(G.map.depthTexture.compareFunction=null,G.map.depthTexture.minFilter=be,G.map.depthTexture.magFilter=be);G.camera.updateProjectionMatrix()}G.map.isWebGLCubeRenderTarget!==!0&&(G.map.width!==i.x||G.map.height!==i.y)&&G.map.setSize(i.x,i.y);let Q=G.map.isWebGLCubeRenderTarget?6:G.getViewportCount();X.isPointLight!==!0&&G.updateMatrices(X,b);let tt=(G.camera.layers.mask&4294967294)!==0?G.camera.layers:b.layers;for(let Et=0;Et0||x.map&&x.alphaTest>0||x.alphaToCoverage===!0){let F=R.uuid,H=x.uuid,D=c[F];D===void 0&&(D={},c[F]=D);let k=D[H];k===void 0&&(k=R.clone(),D[H]=k,x.addEventListener(\"dispose\",E)),R=k}if(R.visible=x.visible,R.wireframe=x.wireframe,I===_s?R.side=x.shadowSide!==null?x.shadowSide:x.side:R.side=x.shadowSide!==null?x.shadowSide:d[x.side],R.alphaMap=x.alphaMap,R.alphaTest=x.alphaToCoverage===!0?.5:x.alphaTest,R.map=x.map,R.clipShadows=x.clipShadows,R.clippingPlanes=x.clippingPlanes,R.clipIntersection=x.clipIntersection,R.displacementMap=x.displacementMap,R.displacementScale=x.displacementScale,R.displacementBias=x.displacementBias,R.wireframeLinewidth=x.wireframeLinewidth,R.linewidth=x.linewidth,b.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let F=s.properties.get(R);F.light=b}return R}function y(A,x,b,I,R,L){if(A.visible===!1)return;if(A.layers.test(R)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&L===_s)&&(!A.frustumCulled||A.intersectsFrustum(n))){A.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,A.matrixWorld);let D=t.update(A),k=A.material;if(Array.isArray(k)){let X=D.groups;for(let G=0,nt=X.length;G=1):W.indexOf(\"OpenGL ES\")!==-1&&(nt=parseFloat(/^OpenGL ES (\\d)/.exec(W)[1]),G=nt>=2);let Q=null,tt={},Et=s.getParameter(s.SCISSOR_BOX),zt=s.getParameter(s.VIEWPORT),Y=new ue().fromArray(Et),xt=new ue().fromArray(zt);function wt(P,$,q,ut){let rt=new Uint8Array(4),lt=s.createTexture();s.bindTexture(P,lt),s.texParameteri(P,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(P,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let Nt=0;Nt\"u\"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new et,h=new WeakMap,d=new Set,u,f=new WeakMap,p=new Set,_=new FinalizationRegistry(w=>p.delete(w)),m=!1;try{m=typeof OffscreenCanvas<\"u\"&&new OffscreenCanvas(1,1).getContext(\"2d\")!==null}catch{}function g(w,M){return m?new OffscreenCanvas(w,M):Ks(\"canvas\")}function v(w,M,B){let it=1,K=Ht(w);if((K.width>B||K.height>B)&&(it=B/Math.max(K.width,K.height)),it<1)if(typeof HTMLImageElement<\"u\"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<\"u\"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<\"u\"&&w instanceof ImageBitmap||typeof VideoFrame<\"u\"&&w instanceof VideoFrame){let ot=Math.floor(it*K.width),pt=Math.floor(it*K.height);u===void 0&&(u=g(ot,pt));let Z=M?g(ot,pt):u;return Z.width=ot,Z.height=pt,Z.getContext(\"2d\").drawImage(w,0,0,ot,pt),gt(\"WebGLRenderer: Texture has been resized from (\"+K.width+\"x\"+K.height+\") to (\"+ot+\"x\"+pt+\").\"),Z}else return\"data\"in w&>(\"WebGLRenderer: Image in DataTexture is too big (\"+K.width+\"x\"+K.height+\").\"),w;return w}function S(w){return w.generateMipmaps}function y(w){s.generateMipmap(w)}function E(w){return w.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:w.isWebGL3DRenderTarget?s.TEXTURE_3D:w.isWebGLArrayRenderTarget||w.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function A(w,M,B,it,K,ot=!1){if(w!==null){if(s[w]!==void 0)return s[w];gt(\"WebGLRenderer: Attempt to use non-existing WebGL internal format '\"+w+\"'\")}let pt;it&&(pt=t.get(\"EXT_texture_norm16\"),pt||gt(\"WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension\"));let Z=M;if(M===s.RED&&(B===s.FLOAT&&(Z=s.R32F),B===s.HALF_FLOAT&&(Z=s.R16F),B===s.UNSIGNED_BYTE&&(Z=s.R8),B===s.UNSIGNED_SHORT&&pt&&(Z=pt.R16_EXT),B===s.SHORT&&pt&&(Z=pt.R16_SNORM_EXT)),M===s.RED_INTEGER&&(B===s.UNSIGNED_BYTE&&(Z=s.R8UI),B===s.UNSIGNED_SHORT&&(Z=s.R16UI),B===s.UNSIGNED_INT&&(Z=s.R32UI),B===s.BYTE&&(Z=s.R8I),B===s.SHORT&&(Z=s.R16I),B===s.INT&&(Z=s.R32I)),M===s.RG&&(B===s.FLOAT&&(Z=s.RG32F),B===s.HALF_FLOAT&&(Z=s.RG16F),B===s.UNSIGNED_BYTE&&(Z=s.RG8),B===s.UNSIGNED_SHORT&&pt&&(Z=pt.RG16_EXT),B===s.SHORT&&pt&&(Z=pt.RG16_SNORM_EXT)),M===s.RG_INTEGER&&(B===s.UNSIGNED_BYTE&&(Z=s.RG8UI),B===s.UNSIGNED_SHORT&&(Z=s.RG16UI),B===s.UNSIGNED_INT&&(Z=s.RG32UI),B===s.BYTE&&(Z=s.RG8I),B===s.SHORT&&(Z=s.RG16I),B===s.INT&&(Z=s.RG32I)),M===s.RGB_INTEGER&&(B===s.UNSIGNED_BYTE&&(Z=s.RGB8UI),B===s.UNSIGNED_SHORT&&(Z=s.RGB16UI),B===s.UNSIGNED_INT&&(Z=s.RGB32UI),B===s.BYTE&&(Z=s.RGB8I),B===s.SHORT&&(Z=s.RGB16I),B===s.INT&&(Z=s.RGB32I)),M===s.RGBA_INTEGER&&(B===s.UNSIGNED_BYTE&&(Z=s.RGBA8UI),B===s.UNSIGNED_SHORT&&(Z=s.RGBA16UI),B===s.UNSIGNED_INT&&(Z=s.RGBA32UI),B===s.BYTE&&(Z=s.RGBA8I),B===s.SHORT&&(Z=s.RGBA16I),B===s.INT&&(Z=s.RGBA32I)),M===s.RGB&&(B===s.UNSIGNED_SHORT&&pt&&(Z=pt.RGB16_EXT),B===s.SHORT&&pt&&(Z=pt.RGB16_SNORM_EXT),B===s.UNSIGNED_INT_5_9_9_9_REV&&(Z=s.RGB9_E5),B===s.UNSIGNED_INT_10F_11F_11F_REV&&(Z=s.R11F_G11F_B10F)),M===s.RGBA){let J=ot?$s:jt.getTransfer(K);B===s.FLOAT&&(Z=s.RGBA32F),B===s.HALF_FLOAT&&(Z=s.RGBA16F),B===s.UNSIGNED_BYTE&&(Z=J===ce?s.SRGB8_ALPHA8:s.RGBA8),B===s.UNSIGNED_SHORT&&pt&&(Z=pt.RGBA16_EXT),B===s.SHORT&&pt&&(Z=pt.RGBA16_SNORM_EXT),B===s.UNSIGNED_SHORT_4_4_4_4&&(Z=s.RGBA4),B===s.UNSIGNED_SHORT_5_5_5_1&&(Z=s.RGB5_A1)}return(Z===s.R16F||Z===s.R32F||Z===s.RG16F||Z===s.RG32F||Z===s.RGBA16F||Z===s.RGBA32F)&&t.get(\"EXT_color_buffer_float\"),Z}function x(w,M){let B;return w?M===null||M===_n||M===Oi?B=s.DEPTH24_STENCIL8:M===Je?B=s.DEPTH32F_STENCIL8:M===ys&&(B=s.DEPTH24_STENCIL8,gt(\"DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.\")):M===null||M===_n||M===Oi?B=s.DEPTH_COMPONENT24:M===Je?B=s.DEPTH_COMPONENT32F:M===ys&&(B=s.DEPTH_COMPONENT16),B}function b(w,M){return S(w)===!0||w.isFramebufferTexture&&w.minFilter!==be&&w.minFilter!==xe?Math.log2(Math.max(M.width,M.height))+1:w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?M.mipmaps.length:1}function I(w){let M=new WeakRef(w);n.get(w).__ref=M,p.add(M),_.register(w,M,M)}function R(w){let M=n.get(w).__ref;M!==void 0&&(p.delete(M),_.unregister(M))}function L(w){H(w.target)}function F(w){D(w.target)}function H(w){w.removeEventListener(\"dispose\",L),R(w),X(w),w.isVideoTexture&&h.delete(w),w.isHTMLTexture&&d.delete(w)}function D(w){w.removeEventListener(\"dispose\",F),R(w),nt(w)}function k(){for(let w of p){let M=w.deref();M!==void 0&&(M.isRenderTarget===!0?D(M):H(M))}p.clear(),d.clear()}function X(w){let M=n.get(w);if(M.__webglInit===void 0)return;let B=w.source,it=f.get(B);if(it){let K=it[M.__cacheKey];K.usedTimes--,K.usedTimes===0&&G(w),Object.keys(it).length===0&&f.delete(B)}n.remove(w)}function G(w){let M=n.get(w);s.deleteTexture(M.__webglTexture);let B=w.source,it=f.get(B);delete it[M.__cacheKey],a.memory.textures--}function nt(w){let M=n.get(w);M.__depthDisposeCallback&&M.__depthDisposeCallback();let B=w.depthTexture;if(B&&B.renderTarget===w&&H(B),w.isWebGLCubeRenderTarget)for(let K=0;K<6;K++){if(Array.isArray(M.__webglFramebuffer[K]))for(let ot=0;ot=i.maxTextures&>(\"WebGLTextures: Trying to use \"+(w+1)+\" texture units while this GPU supports only \"+i.maxTextures),W+=1,w}function Y(w){let M=[];return M.push(w.wrapS),M.push(w.wrapT),M.push(w.wrapR||0),M.push(w.magFilter),M.push(w.minFilter),M.push(w.anisotropy),M.push(w.internalFormat),M.push(w.format),M.push(w.type),M.push(w.generateMipmaps),M.push(w.mipmapsAutoUpdate),M.push(w.premultiplyAlpha),M.push(w.flipY),M.push(w.unpackAlignment),M.push(w.colorSpace),M.join()}function xt(w,M){let B=n.get(w);if(w.isVideoTexture&&Se(w),w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&B.__version!==w.version){let it=w.image;if(it===null)gt(\"WebGLRenderer: Texture marked for update but no image data found.\");else if(it.complete===!1)gt(\"WebGLRenderer: Texture marked for update but image is incomplete\");else{at(B,w,M);return}}else w.isExternalTexture&&(B.__webglTexture=w.sourceTexture?w.sourceTexture:null);e.bindTexture(s.TEXTURE_2D,B.__webglTexture,s.TEXTURE0+M)}function wt(w,M){let B=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&B.__version!==w.version){at(B,w,M);return}else w.isExternalTexture&&(B.__webglTexture=w.sourceTexture?w.sourceTexture:null);e.bindTexture(s.TEXTURE_2D_ARRAY,B.__webglTexture,s.TEXTURE0+M)}function Ft(w,M){let B=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&B.__version!==w.version){at(B,w,M);return}e.bindTexture(s.TEXTURE_3D,B.__webglTexture,s.TEXTURE0+M)}function vt(w,M){let B=n.get(w);if(w.version>0&&B.__version!==w.version){At(B,w,M);return}e.bindTexture(s.TEXTURE_CUBE_MAP,B.__webglTexture,s.TEXTURE0+M)}let Ot={[Xs]:s.REPEAT,[nn]:s.CLAMP_TO_EDGE,[qs]:s.MIRRORED_REPEAT},_e={[be]:s.NEAREST,[Ch]:s.NEAREST_MIPMAP_NEAREST,[vs]:s.NEAREST_MIPMAP_LINEAR,[xe]:s.LINEAR,[Dr]:s.LINEAR_MIPMAP_NEAREST,[Tn]:s.LINEAR_MIPMAP_LINEAR},kt={[Sd]:s.NEVER,[zh]:s.ALWAYS,[Md]:s.LESS,[Oh]:s.LEQUAL,[bd]:s.EQUAL,[Bh]:s.GEQUAL,[Td]:s.GREATER,[Ad]:s.NOTEQUAL};function Kt(w,M){if(M.type===Je&&t.has(\"OES_texture_float_linear\")===!1&&(M.magFilter===xe||M.magFilter===Dr||M.magFilter===vs||M.magFilter===Tn||M.minFilter===xe||M.minFilter===Dr||M.minFilter===vs||M.minFilter===Tn)&>(\"WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.\"),s.texParameteri(w,s.TEXTURE_WRAP_S,Ot[M.wrapS]),s.texParameteri(w,s.TEXTURE_WRAP_T,Ot[M.wrapT]),(w===s.TEXTURE_3D||w===s.TEXTURE_2D_ARRAY)&&s.texParameteri(w,s.TEXTURE_WRAP_R,Ot[M.wrapR]),s.texParameteri(w,s.TEXTURE_MAG_FILTER,_e[M.magFilter]),s.texParameteri(w,s.TEXTURE_MIN_FILTER,_e[M.minFilter]),M.compareFunction&&(s.texParameteri(w,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(w,s.TEXTURE_COMPARE_FUNC,kt[M.compareFunction])),t.has(\"EXT_texture_filter_anisotropic\")===!0){if(M.magFilter===be||M.minFilter!==vs&&M.minFilter!==Tn||M.type===Je&&t.has(\"OES_texture_float_linear\")===!1)return;if(M.anisotropy>1||n.get(M).__currentAnisotropy){let B=t.get(\"EXT_texture_filter_anisotropic\");s.texParameterf(w,B.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,i.getMaxAnisotropy())),n.get(M).__currentAnisotropy=M.anisotropy}}}function te(w,M){let B=!1;w.__webglInit===void 0&&(w.__webglInit=!0,M.addEventListener(\"dispose\",L),I(M));let it=M.source,K=f.get(it);K===void 0&&(K={},f.set(it,K));let ot=Y(M);if(ot!==w.__cacheKey){K[ot]===void 0&&(K[ot]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,B=!0),K[ot].usedTimes++;let pt=K[w.__cacheKey];pt!==void 0&&(K[w.__cacheKey].usedTimes--,pt.usedTimes===0&&G(M)),w.__cacheKey=ot,w.__webglTexture=K[ot].texture}return B}function j(w,M,B){return Math.floor(Math.floor(w/B)/M)}function ct(w,M,B,it){let ot=w.updateRanges;if(ot.length===0)e.texSubImage2D(s.TEXTURE_2D,0,0,0,M.width,M.height,B,it,M.data);else{ot.sort((P,$)=>P.start-$.start);let pt=0;for(let P=1;P0){rt&<&&e.texStorage2D(s.TEXTURE_2D,$t,$,ut[0].width,ut[0].height);for(let st=0,Ut=ut.length;st0){let Zt=Vh(q.width,q.height,M.format,M.type);for(let St of M.layerUpdates){let de=q.data.subarray(St*Zt/q.data.BYTES_PER_ELEMENT,(St+1)*Zt/q.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,st,0,0,St,q.width,q.height,1,ht,de)}}else e.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,st,0,0,0,q.width,q.height,J.depth,ht,q.data)}else e.compressedTexImage3D(s.TEXTURE_2D_ARRAY,st,$,q.width,q.height,J.depth,0,q.data,0,0);else gt(\"WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\");else rt?Nt&&e.texSubImage3D(s.TEXTURE_2D_ARRAY,st,0,0,0,q.width,q.height,J.depth,ht,P,q.data):e.texImage3D(s.TEXTURE_2D_ARRAY,st,$,q.width,q.height,J.depth,0,ht,P,q.data);M.layerUpdates.size>0&&M.clearLayerUpdates()}else{rt&<&&e.texStorage2D(s.TEXTURE_2D,$t,$,ut[0].width,ut[0].height);for(let st=0,Ut=ut.length;st0){let st=Vh(J.width,J.height,M.format,M.type);for(let Ut of M.layerUpdates){let Zt=J.data.subarray(Ut*st/J.data.BYTES_PER_ELEMENT,(Ut+1)*st/J.data.BYTES_PER_ELEMENT);e.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,Ut,J.width,J.height,1,ht,P,Zt)}M.clearLayerUpdates()}else e.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,J.width,J.height,J.depth,ht,P,J.data)}else e.texImage3D(s.TEXTURE_2D_ARRAY,0,$,J.width,J.height,J.depth,0,ht,P,J.data);else if(M.isData3DTexture)rt?(lt&&e.texStorage3D(s.TEXTURE_3D,$t,$,J.width,J.height,J.depth),Nt&&e.texSubImage3D(s.TEXTURE_3D,0,0,0,0,J.width,J.height,J.depth,ht,P,J.data)):e.texImage3D(s.TEXTURE_3D,0,$,J.width,J.height,J.depth,0,ht,P,J.data);else if(M.isFramebufferTexture){if(lt)if(rt)e.texStorage2D(s.TEXTURE_2D,$t,$,J.width,J.height);else{let st=J.width,Ut=J.height;for(let Zt=0;Zt<$t;Zt++)e.texImage2D(s.TEXTURE_2D,Zt,$,st,Ut,0,ht,P,null),st>>=1,Ut>>=1}}else if(M.isHTMLTexture){if(\"texElementImage2D\"in s){let st=s.canvas;if(st.hasAttribute(\"layoutsubtree\")||st.setAttribute(\"layoutsubtree\",\"true\"),J.parentNode!==st){st.appendChild(J),d.add(M),st.onpaint=Ut=>{let Zt=Ut.changedElements;for(let St of d)Zt.includes(St.image)&&(St.needsUpdate=!0)},st.requestPaint();return}if(s.texElementImage2D.length===3)s.texElementImage2D(s.TEXTURE_2D,s.RGBA8,J);else{let Zt=s.RGBA,St=s.RGBA,de=s.UNSIGNED_BYTE;s.texElementImage2D(s.TEXTURE_2D,0,Zt,St,de,J)}s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE)}}else if(ut.length>0){if(rt&<){let st=Ht(ut[0]);e.texStorage2D(s.TEXTURE_2D,$t,$,st.width,st.height)}for(let st=0,Ut=ut.length;st0&&Ut++;let St=Ht($[0]);e.texStorage2D(s.TEXTURE_CUBE_MAP,Ut,lt,St.width,St.height)}for(let St=0;St<6;St++)if(P){Nt?st&&e.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+St,0,0,0,$[St].width,$[St].height,ut,rt,$[St].data):e.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+St,0,lt,$[St].width,$[St].height,0,ut,rt,$[St].data);for(let de=0;de>ot),q=Math.max(1,M.height>>ot);K===s.TEXTURE_3D||K===s.TEXTURE_2D_ARRAY?e.texImage3D(K,ot,J,$,q,M.depth,0,pt,Z,null):e.texImage2D(K,ot,J,$,q,0,pt,Z,null)}e.bindFramebuffer(s.FRAMEBUFFER,w),ft(M)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,it,K,P.__webglTexture,0,pe(M)):(K===s.TEXTURE_2D||K>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&K<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,it,K,P.__webglTexture,ot),e.bindFramebuffer(s.FRAMEBUFFER,null)}function qt(w,M,B){if(s.bindRenderbuffer(s.RENDERBUFFER,w),M.depthBuffer){let it=M.depthTexture,K=it&&it.isDepthTexture?it.type:null,ot=x(M.stencilBuffer,K),pt=M.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;ft(M)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,pe(M),ot,M.width,M.height):B?s.renderbufferStorageMultisample(s.RENDERBUFFER,pe(M),ot,M.width,M.height):s.renderbufferStorage(s.RENDERBUFFER,ot,M.width,M.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,pt,s.RENDERBUFFER,w)}else{let it=M.textures;for(let K=0;K{delete M.__boundDepthTexture,delete M.__depthDisposeCallback,it.removeEventListener(\"dispose\",K)};it.addEventListener(\"dispose\",K),M.__depthDisposeCallback=K}M.__boundDepthTexture=it}if(w.depthTexture&&!M.__autoAllocateDepthBuffer)if(B)for(let it=0;it<6;it++)Dt(M.__webglFramebuffer[it],w,it);else w.texture.mipmaps.length>0?Dt(M.__webglFramebuffer[0],w,0):Dt(M.__webglFramebuffer,w,0);else if(B){M.__webglDepthbuffer=[];for(let it=0;it<6;it++)if(e.bindFramebuffer(s.FRAMEBUFFER,M.__webglFramebuffer[it]),M.__webglDepthbuffer[it]===void 0)M.__webglDepthbuffer[it]=s.createRenderbuffer(),qt(M.__webglDepthbuffer[it],w,!1);else{let K=w.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ot=M.__webglDepthbuffer[it];s.bindRenderbuffer(s.RENDERBUFFER,ot),s.framebufferRenderbuffer(s.FRAMEBUFFER,K,s.RENDERBUFFER,ot)}}else if(w.texture.mipmaps.length>0?e.bindFramebuffer(s.FRAMEBUFFER,M.__webglFramebuffer[0]):e.bindFramebuffer(s.FRAMEBUFFER,M.__webglFramebuffer),M.__webglDepthbuffer===void 0)M.__webglDepthbuffer=s.createRenderbuffer(),qt(M.__webglDepthbuffer,w,!1);else{let K=w.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ot=M.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,ot),s.framebufferRenderbuffer(s.FRAMEBUFFER,K,s.RENDERBUFFER,ot)}e.bindFramebuffer(s.FRAMEBUFFER,null)}function ne(w,M,B){let it=n.get(w);M!==void 0&&_t(it.__webglFramebuffer,w,w.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),B!==void 0&&ee(w)}function ae(w){let M=w.texture,B=n.get(w),it=n.get(M);w.addEventListener(\"dispose\",F),I(w);let K=w.textures,ot=w.isWebGLCubeRenderTarget===!0,pt=K.length>1;if(pt||(it.__webglTexture===void 0&&(it.__webglTexture=s.createTexture()),it.__version=M.version,a.memory.textures++),ot){B.__webglFramebuffer=[];for(let Z=0;Z<6;Z++)if(M.mipmaps.length>0){B.__webglFramebuffer[Z]=[];for(let J=0;J0){B.__webglFramebuffer=[];for(let Z=0;Z0&&ft(w)===!1){B.__webglMultisampledFramebuffer=s.createFramebuffer(),B.__webglColorRenderbuffer=[],e.bindFramebuffer(s.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let Z=0;Z0)for(let J=0;J0&&s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAX_LEVEL,M.mipmaps.length-1),e.unbindTexture()}else if(pt){for(let Z=0,J=K.length;Z0)for(let J=0;J0&&s.texParameteri(Z,s.TEXTURE_MAX_LEVEL,M.mipmaps.length-1),e.unbindTexture()}w.depthBuffer&&ee(w)}function U(w){let M=w.textures;for(let B=0,it=M.length;B0){if(ft(w)===!1){let M=w.textures,B=w.width,it=w.height,K=s.COLOR_BUFFER_BIT,ot=w.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,pt=n.get(w),Z=M.length>1;if(Z)for(let ht=0;ht0?e.bindFramebuffer(s.DRAW_FRAMEBUFFER,pt.__webglFramebuffer[0]):e.bindFramebuffer(s.DRAW_FRAMEBUFFER,pt.__webglFramebuffer);for(let ht=0;ht0&&t.has(\"WEBGL_multisampled_render_to_texture\")===!0&&M.__useRenderToTexture!==!1}function Se(w){let M=a.render.frame;h.get(w)!==M&&(h.set(w,M),w.update())}function Bt(w,M){let B=w.colorSpace,it=w.format,K=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||B!==Js&&B!==Kn&&(jt.getTransfer(B)===ce?(it!==rn||K!==on)&>(\"WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.\"):Lt(\"WebGLTextures: Unsupported texture color space:\",B)),M}function Ht(w){return typeof HTMLImageElement<\"u\"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<\"u\"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=zt,this.resetTextureUnits=Q,this.getTextureUnits=tt,this.setTextureUnits=Et,this.setTexture2D=xt,this.setTexture2DArray=wt,this.setTexture3D=Ft,this.setTextureCube=vt,this.rebindTextures=ne,this.setupRenderTarget=ae,this.updateRenderTargetMipmap=U,this.updateMultisampleRenderTarget=Qt,this.setupDepthRenderbuffer=ee,this.setupFrameBufferTexture=_t,this.useMultisampledRTT=ft,this.dispose=k}function ag(s,t){function e(n,i=Kn){let r,a=jt.getTransfer(i);if(n===on)return s.UNSIGNED_BYTE;if(n===Co)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Io)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Lh)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Dh)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Ih)return s.BYTE;if(n===Ph)return s.SHORT;if(n===ys)return s.UNSIGNED_SHORT;if(n===Ro)return s.INT;if(n===_n)return s.UNSIGNED_INT;if(n===Je)return s.FLOAT;if(n===An)return s.HALF_FLOAT;if(n===Nh)return s.ALPHA;if(n===Uh)return s.RGB;if(n===rn)return s.RGBA;if(n===Vn)return s.DEPTH_COMPONENT;if(n===Jn)return s.DEPTH_STENCIL;if(n===Po)return s.RED;if(n===Nr)return s.RED_INTEGER;if(n===pi)return s.RG;if(n===Lo)return s.RG_INTEGER;if(n===Do)return s.RGBA_INTEGER;if(n===Ur||n===Fr||n===Or||n===Br)if(a===ce)if(r=t.get(\"WEBGL_compressed_texture_s3tc_srgb\"),r!==null){if(n===Ur)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Fr)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Or)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Br)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=t.get(\"WEBGL_compressed_texture_s3tc\"),r!==null){if(n===Ur)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Fr)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Or)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Br)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===No||n===Uo||n===Fo||n===Oo)if(r=t.get(\"WEBGL_compressed_texture_pvrtc\"),r!==null){if(n===No)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Uo)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Fo)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Oo)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Bo||n===zo||n===ko||n===Go||n===Vo||n===zr||n===Ho)if(r=t.get(\"WEBGL_compressed_texture_etc\"),r!==null){if(n===Bo||n===zo)return a===ce?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ko)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Go)return r.COMPRESSED_R11_EAC;if(n===Vo)return r.COMPRESSED_SIGNED_R11_EAC;if(n===zr)return r.COMPRESSED_RG11_EAC;if(n===Ho)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Wo||n===Xo||n===qo||n===Yo||n===Zo||n===Jo||n===$o||n===Ko||n===Qo||n===jo||n===tl||n===el||n===nl||n===il)if(r=t.get(\"WEBGL_compressed_texture_astc\"),r!==null){if(n===Wo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Xo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===qo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Yo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Zo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Jo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===$o)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ko)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Qo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===jo)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===tl)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===el)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===nl)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===il)return a===ce?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===sl||n===rl||n===al)if(r=t.get(\"EXT_texture_compression_bptc\"),r!==null){if(n===sl)return a===ce?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===rl)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===al)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ol||n===ll||n===kr||n===cl)if(r=t.get(\"EXT_texture_compression_rgtc\"),r!==null){if(n===ol)return r.COMPRESSED_RED_RGTC1_EXT;if(n===ll)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===kr)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===cl)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Oi?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:e}}var GS=`\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}`,VS=`\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}`,Hd=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(this.texture===null){let n=new or(t.texture);(t.depthNear!==e.depthNear||t.depthFar!==e.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new Mn({vertexShader:GS,fragmentShader:VS,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ee(new hs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},Wd=class extends un{constructor(t,e){super();let n=this,i=null,r=1,a=null,o=\"local-floor\",l=1,c=null,h=null,d=null,u=null,f=null,p=null,_=typeof XRWebGLBinding<\"u\",m=new Hd,g={},v=e.getContextAttributes(),S=null,y=null,E=[],A=[],x=new et,b=null,I=null,R=new Le;R.viewport=new ue;let L=new Le;L.viewport=new ue;let F=[R,L],H=new So,D=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let xt=E[Y];return xt===void 0&&(xt=new rs,E[Y]=xt),xt.getTargetRaySpace()},this.getControllerGrip=function(Y){let xt=E[Y];return xt===void 0&&(xt=new rs,E[Y]=xt),xt.getGripSpace()},this.getHand=function(Y){let xt=E[Y];return xt===void 0&&(xt=new rs,E[Y]=xt),xt.getHandSpace()};function X(Y){let xt=A.indexOf(Y.inputSource);if(xt===-1)return;let wt=E[xt];wt!==void 0&&(wt.update(Y.inputSource,Y.frame,c||a),wt.dispatchEvent({type:Y.type,data:Y.inputSource}))}function G(){i.removeEventListener(\"select\",X),i.removeEventListener(\"selectstart\",X),i.removeEventListener(\"selectend\",X),i.removeEventListener(\"squeeze\",X),i.removeEventListener(\"squeezestart\",X),i.removeEventListener(\"squeezeend\",X),i.removeEventListener(\"end\",G),i.removeEventListener(\"inputsourceschange\",nt);for(let Y=0;Y=0&&(A[Ft]=null,E[Ft].disconnect(wt))}for(let xt=0;xt=A.length){A.push(wt),Ft=Ot;break}else if(A[Ot]===null){A[Ot]=wt,Ft=Ot;break}if(Ft===-1)break}let vt=E[Ft];vt&&vt.connect(wt)}}function W(Y,xt){xt===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(xt.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;let xt=Y.near,wt=Y.far;m.texture!==null&&(m.depthNear>0&&(xt=m.depthNear),m.depthFar>0&&(wt=m.depthFar)),H.near=L.near=R.near=xt,H.far=L.far=R.far=wt,(D!==H.near||k!==H.far)&&(i.updateRenderState({depthNear:H.near,depthFar:H.far}),D=H.near,k=H.far),H.layers.mask=Y.layers.mask|6,R.layers.mask=H.layers.mask&-5,L.layers.mask=H.layers.mask&-3;let Ft=Y.parent,vt=H.cameras;W(H,Ft);for(let Ot=0;Ot0&&(m.alphaTest.value=g.alphaTest);let v=t.get(g),S=v.envMap,y=v.envMapRotation;S&&(m.envMap.value=S,m.envMapRotation.value.setFromMatrix4(HS.makeRotationFromEuler(y)).transpose(),S.isCubeTexture&&S.isRenderTargetTexture===!1&&m.envMapRotation.value.premultiply(og),m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap&&(m.lightMap.value=g.lightMap,m.lightMapIntensity.value=g.lightMapIntensity,e(g.lightMap,m.lightMapTransform)),g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,e(g.aoMap,m.aoMapTransform))}function a(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,e(g.map,m.mapTransform))}function o(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function l(m,g,v,S){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*v,m.scale.value=S*.5,g.map&&(m.map.value=g.map,e(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,e(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function c(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,e(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,e(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function h(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function d(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function u(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,e(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,e(g.roughnessMap,m.roughnessMapTransform)),g.envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function f(m,g,v){m.ior.value=g.ior,g.diffuseRoughness>0&&(m.diffuseRoughness.value=g.diffuseRoughness,g.diffuseRoughnessMap&&(m.diffuseRoughnessMap.value=g.diffuseRoughnessMap,e(g.diffuseRoughnessMap,m.diffuseRoughnessMapTransform))),g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,e(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,e(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,e(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,e(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,e(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Ke&&m.clearcoatNormalScale.value.negate())),g.dispersion>0&&(m.dispersion.value=g.dispersion),g.retroreflectivity>0&&(m.retroreflectivity.value=g.retroreflectivity),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessMinimum,m.iridescenceThicknessMaximum.value=g.iridescenceThicknessMaximum,g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,e(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,e(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,e(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,e(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,e(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,e(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,e(g.specularIntensityMap,m.specularIntensityMapTransform))}function p(m,g){g.matcap&&(m.matcap.value=g.matcap)}function _(m,g){let v=t.get(g).light;m.referencePosition.value.setFromMatrixPosition(v.matrixWorld),m.nearDistance.value=v.shadow.camera.near,m.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function XS(s,t,e,n){let i={},r={};function a(v,S){let y=S.program;n.uniformBlockBinding(v,y,i[v.id])}function o(v,S){let y=i[v.id];y===void 0&&(p(v),y=l(v),i[v.id]=y,v.addEventListener(\"dispose\",m));let E=S.program;n.updateUBOMapping(v,E);let A=t.render.frame;r[v.id]!==A&&(c(v),r[v.id]=A)}function l(v){let S=s.createBuffer(),y=v.__size,E=v.usage;return s.bindBuffer(s.UNIFORM_BUFFER,S),s.bufferData(s.UNIFORM_BUFFER,y,E),s.bindBuffer(s.UNIFORM_BUFFER,null),S}function c(v){let S=i[v.id],y=v.uniforms,E=v.__cache;s.bindBuffer(s.UNIFORM_BUFFER,S);for(let A=0,x=y.length;A0&&(y+=E-A),v.__size=y,v.__cache={},this}function _(v,S){let y={boundary:0,storage:0};return typeof v==\"number\"||typeof v==\"boolean\"?(y.boundary=4,y.storage=4):v.isVector2?(y.boundary=8,y.storage=8):v.isVector3||v.isColor?(y.boundary=16,y.storage=12):v.isVector4?(y.boundary=16,y.storage=16):v.isMatrix3?(y.boundary=16,y.storage=48):v.isMatrix4?(y.boundary=16,y.storage=64):v.isTexture?gt(\"WebGLRenderer: Texture samplers can not be part of an uniforms group.\"):ArrayBuffer.isView(v)?(y.boundary=16,y.storage=v.byteLength):gt(\"WebGLRenderer: Unsupported uniform value type.\",v),S===!0&&(y.boundary=16,y.storage=Math.ceil(y.storage/16)*16),y}function m(v){let S=v.target;S.removeEventListener(\"dispose\",m),s.deleteBuffer(i[S.id]),delete i[S.id],delete r[S.id]}function g(){for(let v in i)s.deleteBuffer(i[v]);i={},r={}}return{bind:a,update:o,dispose:g}}var qS=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Qn=null;function YS(){return Qn===null&&(Qn=new sn(qS,16,16,pi,An),Qn.name=\"DFG_LUT\",Qn.minFilter=xe,Qn.magFilter=xe,Qn.wrapS=nn,Qn.wrapT=nn,Qn.generateMipmaps=!1,Qn.needsUpdate=!0),Qn}var Xd=class{constructor(t={}){let{canvas:e=Ed(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h=\"default\",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:f=on}=t;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<\"u\"&&n instanceof WebGLRenderingContext)throw new Error(\"THREE.WebGLRenderer: WebGL 1 is not supported since r163.\");p=n.getContextAttributes().alpha}else p=a;let _=f,m=new Set([Do,Lo,Nr]),g=new Set([on,_n,ys,Oi,Co,Io]),v=new Uint32Array(4),S=new Int32Array(4),y={textures:[],min:[],max:[],resolution:[]},E=null,A=null,x=[],b=[],I=null;this.domElement=e,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=On,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let R=this,L=!1,F=null,H=null,D=null,k=null;this._outputColorSpace=en;let X=0,G=0,nt=null,W=-1,Q=null,tt=new ue,Et=new ue,zt=null,Y=new bt(0),xt=0,wt=e.width,Ft=e.height,vt=1,Ot=null,_e=null,kt=new ue(0,0,wt,Ft),Kt=new ue(0,0,wt,Ft),te=!1,j=new Wn,ct=new sr,at=!1,At=!1,_t=new Vt,qt=new C,Dt=new ue,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ne=!1;function ae(){return nt===null?vt:1}let U=n;function we(T,N){return e.getContext(T,N)}let Qt,pe,ft,Se,Bt,Ht,w,M,B,it,K,ot,pt,Z,J,ht,P,$,q,ut,rt,lt,Nt;try{let T={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if(\"setAttribute\"in e&&e.setAttribute(\"data-engine\",`three.js r${\"187\"}`),e.addEventListener(\"webglcontextlost\",Ut,!1),e.addEventListener(\"webglcontextrestored\",Zt,!1),e.addEventListener(\"webglcontextcreationerror\",St,!1),U===null){let N=\"webgl2\";if(U=we(N,T),U===null)throw we(N)?new Error(\"THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.\"):new Error(\"THREE.WebGLRenderer: Error creating WebGL context.\")}$t()}catch(T){throw e.removeEventListener(\"webglcontextlost\",Ut,!1),e.removeEventListener(\"webglcontextrestored\",Zt,!1),e.removeEventListener(\"webglcontextcreationerror\",St,!1),Lt(\"WebGLRenderer: \"+T.message),T}function $t(){Qt=new ry(U),Qt.init(),rt=new ag(U,Qt),pe=new Zv(U,Qt,t,rt),ft=new zS(U,Qt),pe.reversedDepthBuffer&&u&&ft.buffers.depth.setReversed(!0),H=U.createFramebuffer(),D=U.createFramebuffer(),k=U.createFramebuffer(),Se=new ly(U),Bt=new AS,Ht=new kS(U,Qt,ft,Bt,pe,rt,Se),w=new sy(R),M=new h0(U),lt=new qv(U,M),B=new ay(U,M,Se,lt),it=new hy(U,B,M,lt,Se),$=new cy(U,pe,Ht),J=new Jv(Bt),K=new TS(R,w,Qt,pe,lt,J),ot=new WS(R,Bt),pt=new wS,Z=new DS(Qt),P=new Xv(R,w,ft,it,p,l),ht=new BS(R,it,pe),Nt=new XS(U,Se,pe,ft),q=new Yv(U,Qt,Se),ut=new oy(U,Qt,Se),Se.programs=K.programs,R.capabilities=pe,R.extensions=Qt,R.properties=Bt,R.renderLists=pt,R.shadowMap=ht,R.state=ft,R.info=Se}_!==on&&(I=new dy(_,e.width,e.height,o,i,r));let st=new Wd(R,U);this.xr=st,this.getContext=function(){return U},this.getContextAttributes=function(){return U.getContextAttributes()},this.forceContextLoss=function(){let T=Qt.get(\"WEBGL_lose_context\");T&&T.loseContext()},this.forceContextRestore=function(){let T=Qt.get(\"WEBGL_lose_context\");T&&T.restoreContext()},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(T){T!==void 0&&(vt=T,this.setSize(wt,Ft,!1))},this.getSize=function(T){return T.set(wt,Ft)},this.setSize=function(T,N,V=!0){if(st.isPresenting){gt(\"WebGLRenderer: Can't change size while VR device is presenting.\");return}wt=T,Ft=N,e.width=Math.floor(T*vt),e.height=Math.floor(N*vt),V===!0&&(e.style.width=T+\"px\",e.style.height=N+\"px\"),I!==null&&I.setSize(e.width,e.height),this.setViewport(0,0,T,N)},this.getDrawingBufferSize=function(T){return T.set(wt*vt,Ft*vt).floor()},this.setDrawingBufferSize=function(T,N,V){wt=T,Ft=N,vt=V,e.width=Math.floor(T*V),e.height=Math.floor(N*V),this.setViewport(0,0,T,N)},this.setEffects=function(T){if(_===on){Lt(\"WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.\");return}if(T){for(let N=0;N{function mt(){if(O.forEach(function(Rt){let Mt=Bt.get(Rt).currentProgram;(Mt===void 0||Mt.isReady())&&O.delete(Rt)}),O.size===0){z(T);return}setTimeout(mt,10)}Qt.get(\"KHR_parallel_shader_compile\")!==null?mt():setTimeout(mt,10)})};let Yh=null;function lg(T){Yh&&Yh(T)}function Zd(){Bi.stop()}function Jd(){Bi.start()}let Bi=new $m;Bi.setAnimationLoop(lg),typeof self<\"u\"&&Bi.setContext(self),this.setAnimationLoop=function(T){Yh=T,st.setAnimationLoop(T),T===null?Bi.stop():Bi.start()},st.addEventListener(\"sessionstart\",Zd),st.addEventListener(\"sessionend\",Jd),this.render=function(T,N){if(N!==void 0&&N.isCamera!==!0){Lt(\"WebGLRenderer.render: camera is not an instance of THREE.Camera.\");return}if(L===!0)return;F!==null&&F.renderStart(T,N);let V=st.enabled===!0&&st.isPresenting===!0,O=I!==null&&(nt===null||V)&&I.begin(R,nt);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),st.enabled===!0&&st.isPresenting===!0&&(I===null||I.isCompositing()===!1)&&(st.cameraAutoUpdate===!0&&st.updateCamera(N),N=st.getCamera()),T.isScene===!0&&T.onBeforeRender(R,T,N,nt),A=Z.get(T,b.length),A.init(N),A.state.textureUnits=Ht.getTextureUnits(),b.push(A),_t.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),N.isArrayCamera?ct.setFromArrayCamera(N):j.setFromProjectionMatrix(_t,hn,N.reversedDepth),At=this.localClippingEnabled,at=J.init(this.clippingPlanes,At),E=pt.get(T,x.length),E.init(),x.push(E),this.info.render.frame++,st.enabled===!0&&st.isPresenting===!0){let Rt=R.xr.getDepthSensingMesh();Rt!==null&&Zh(Rt,N,-1/0,R.sortObjects)}Zh(T,N,0,R.sortObjects),E.finish(),F!==null&&F.updateLights(A.state.lightsArray),R.sortObjects===!0&&E.sort(Ot,_e),ne=st.enabled===!1||st.isPresenting===!1||st.hasDepthSensing()===!1,ne&&P.addToRenderList(E,T),this.info.autoReset===!0&&this.info.reset(),at===!0&&J.beginShadows();let z=A.state.shadowsArray;if(ht.render(z,T,N),at===!0&&J.endShadows(),(O&&I.hasRenderPass())===!1){let Rt=E.opaque,dt=E.transmissive;if(A.setupLights(),N.isArrayCamera){let Mt=N.cameras;if(dt.length>0)for(let Pt=0,Xt=Mt.length;Pt0&&Kd(Rt,dt,T,N),ne&&P.render(T),$d(E,T,N)}nt!==null&&G===0&&(Ht.updateMultisampleRenderTarget(nt),Ht.updateRenderTargetMipmap(nt)),O&&I.end(R),T.isScene===!0&&T.onAfterRender(R,T,N),lt.resetDefaultState(),W=-1,Q=null,b.pop(),b.length>0?(A=b[b.length-1],Ht.setTextureUnits(A.state.textureUnits),at===!0&&J.setGlobalState(R.clippingPlanes,A.state.camera)):A=null,x.pop(),x.length>0?E=x[x.length-1]:E=null,F!==null&&F.renderEnd()};function Zh(T,N,V,O){if(T.visible===!1)return;if(T.layers.test(N.layers)){if(T.isGroup)V=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(N);else if(T.isLight)A.pushLight(T),T.castShadow&&A.pushShadow(T);else if(T.isSprite){let Rt=N.isArrayCamera?ct:j;if(!T.frustumCulled||T.intersectsFrustum(Rt)){O&&Dt.setFromMatrixPosition(T.matrixWorld).applyMatrix4(_t);let dt=it.update(T),Mt=T.material;Mt.visible&&E.push(T,dt,Mt,V,Dt.z,null,N)}}else if(T.isMesh||T.isLine||T.isPoints){let Rt=N.isArrayCamera?ct:j;if(!T.frustumCulled||T.intersectsFrustum(Rt)){let dt=it.update(T),Mt=T.material;if(O&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),Dt.copy(T.boundingSphere.center)):(dt.boundingSphere===null&&dt.computeBoundingSphere(),Dt.copy(dt.boundingSphere.center)),Dt.applyMatrix4(T.matrixWorld).applyMatrix4(_t)),Array.isArray(Mt)){let Pt=dt.groups;for(let Xt=0,ie=Pt.length;Xt0&&gl(z,N,V),mt.length>0&&gl(mt,N,V),Rt.length>0&&gl(Rt,N,V),ft.buffers.depth.setTest(!0),ft.buffers.depth.setMask(!0),ft.buffers.color.setMask(!0),ft.setPolygonOffset(!1)}function Kd(T,N,V,O){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;if(A.state.transmissionRenderTarget[O.id]===void 0){let Ct=Qt.has(\"EXT_color_buffer_half_float\")||Qt.has(\"EXT_color_buffer_float\");A.state.transmissionRenderTarget[O.id]=new $e(1,1,{generateMipmaps:!0,type:Ct?An:on,minFilter:Tn,samples:Math.max(4,pe.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:jt.workingColorSpace})}let mt=A.state.transmissionRenderTarget[O.id],Rt=O.viewport||tt;mt.setSize(Rt.z*R.transmissionResolutionScale,Rt.w*R.transmissionResolutionScale);let dt=R.getRenderTarget(),Mt=R.getActiveCubeFace(),Pt=R.getActiveMipmapLevel();R.setRenderTarget(mt),R.getClearColor(Y),xt=R.getClearAlpha(),xt<1&&R.setClearColor(16777215,.5),R.clear(),ne&&P.render(V);let Xt=R.toneMapping;R.toneMapping=On;let ie=O.viewport;if(O.viewport!==void 0&&(O.viewport=void 0),A.setupLightsView(O),at===!0&&J.setGlobalState(R.clippingPlanes,O),gl(T,V,O),Ht.updateMultisampleRenderTarget(mt),Ht.updateRenderTargetMipmap(mt),Qt.has(\"WEBGL_multisampled_render_to_texture\")===!1){let Ct=!1;for(let se=0,Re=N.length;se0),Ct=!!V.morphAttributes.position,se=!!V.morphAttributes.normal,Re=!!V.morphAttributes.color,ge=On;O.toneMapped&&(nt===null||nt.isXRRenderTarget===!0)&&(ge=R.toneMapping);let me=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,He=me!==void 0?me.length:0,It=Bt.get(O),je=A.state.lights;if(at===!0&&(At===!0||T!==Q)){let ve=T===Q&&O.id===W;J.setState(O,T,ve)}let le=!1,zi=!1;O.version===It.__version?It.needsLights&&It.lightsStateVersion!==je.state.version||z.isBatchedMesh&&It.batching===!1||!z.isBatchedMesh&&It.batching===!0||z.isBatchedMesh&&It.batchingColor===!0&&z._colorsTexture===null||z.isBatchedMesh&&It.batchingColor===!1&&z._colorsTexture!==null||z.isInstancedMesh&&It.instancing===!1||!z.isInstancedMesh&&It.instancing===!0||z.isSkinnedMesh&&It.skinning===!1||!z.isSkinnedMesh&&It.skinning===!0||z.isInstancedMesh&&It.instancingColor===!0&&z.instanceColor===null||z.isInstancedMesh&&It.instancingColor===!1&&z.instanceColor!==null||z.isInstancedMesh&&It.instancingMorph===!0&&z.morphTexture===null||z.isInstancedMesh&&It.instancingMorph===!1&&z.morphTexture!==null||It.envMap!==Pt||O.fog===!0&&It.fog!==mt||It.numClippingPlanes!==void 0&&(It.numClippingPlanes!==J.numPlanes||It.numIntersection!==J.numIntersection)||It.vertexAlphas!==Xt||It.vertexTangents!==ie||It.morphTargets!==Ct||It.morphNormals!==se||It.morphColors!==Re||It.morphTargetsCount!==He||It.numLightProbeGrids!==jd(A.state.lightProbeGridArray)?le=!0:(It.outputColorSpace!==dt||It.toneMapping!==ge)&&(zi=!0):(le=!0,It.__version=O.version);let We=It.currentProgram;(le===!0||zi===!0)&&(We=zi===!0?cg(O,N,z,dt,ge):Wr(O,N,z),F&&O.isNodeMaterial&&F.onUpdateProgram(O,We,It));let _l=!1,gi=!1,ki=!1,re=We.getUniforms(),Ge=It.uniforms;if(ft.useProgram(We.program)&&(_l=!0,gi=!0,ki=!0),O.id!==W&&(W=O.id,gi=!0),_l||Q!==T){ft.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),re.setValue(U,\"projectionMatrix\",T.projectionMatrix),re.setValue(U,\"viewMatrix\",T.matrixWorldInverse);let Oe=re.map.cameraPosition;Oe!==void 0&&Oe.setValue(U,qt.setFromMatrixPosition(T.matrixWorld)),pe.logarithmicDepthBuffer&&re.setValue(U,\"logDepthBufFC\",2/(Math.log(T.far+1)/Math.LN2)),(O.isMeshPhongMaterial||O.isMeshToonMaterial||O.isMeshLambertMaterial||O.isMeshBasicMaterial||O.isMeshStandardMaterial||O.isShaderMaterial)&&re.setValue(U,\"isOrthographic\",T.isOrthographicCamera===!0),Q!==T&&(Q=T,gi=!0,ki=!0)}if(It.needsLights&&(je.state.sunShadowMap.length>0&&re.setValue(U,\"sunShadowMap\",je.state.sunShadowMap,Ht),je.state.directionalShadowMap.length>0&&re.setValue(U,\"directionalShadowMap\",je.state.directionalShadowMap,Ht),je.state.spotShadowMap.length>0&&re.setValue(U,\"spotShadowMap\",je.state.spotShadowMap,Ht),je.state.pointShadowMap.length>0&&re.setValue(U,\"pointShadowMap\",je.state.pointShadowMap,Ht)),z.isSkinnedMesh){re.setOptional(U,z,\"bindMatrix\"),re.setOptional(U,z,\"bindMatrixInverse\");let ve=z.skeleton;ve&&(ve.boneTexture===null&&ve.computeBoneTexture(),re.setValue(U,\"boneTexture\",ve.boneTexture,Ht))}z.isBatchedMesh&&(re.setOptional(U,z,\"batchingTexture\"),re.setValue(U,\"batchingTexture\",z._matricesTexture,Ht),re.setOptional(U,z,\"batchingIdTexture\"),re.setValue(U,\"batchingIdTexture\",z._indirectTexture,Ht),re.setOptional(U,z,\"batchingColorTexture\"),z._colorsTexture!==null&&re.setValue(U,\"batchingColorTexture\",z._colorsTexture,Ht));let wn=V.morphAttributes;if((wn.position!==void 0||wn.normal!==void 0||wn.color!==void 0)&&$.update(z,V,We),(gi||It.receiveShadow!==z.receiveShadow)&&(It.receiveShadow=z.receiveShadow,re.setValue(U,\"receiveShadow\",z.receiveShadow)),(O.isMeshStandardMaterial||O.isMeshLambertMaterial||O.isMeshPhongMaterial)&&O.envMap===null&&N.environment!==null&&(Ge.envMapIntensity.value=N.environmentIntensity),Ge.dfgLUT!==void 0&&(Ge.dfgLUT.value=YS()),gi){if(re.setValue(U,\"toneMappingExposure\",R.toneMappingExposure),It.needsLights&&ug(Ge,ki),mt&&O.fog===!0&&ot.refreshFogUniforms(Ge,mt),ot.refreshMaterialUniforms(Ge,O,vt,Ft,A.state.transmissionRenderTarget[T.id]),It.needsLights&&It.numLightProbeGrids>0){let ve=y,Oe=0;for(let jn of A.state.lightProbeGridArray)jn.texture!==null&&(ve.textures[Oe]=jn.texture,ve.min[Oe]=jn.boundingBox.min,ve.max[Oe]=jn.boundingBox.max,ve.resolution[Oe]=jn.resolution,Oe++);for(let jn in ve)ve[jn].length=Oe;Ge.probesSH.value=ve.textures,Ge.probesMin.value=ve.min,Ge.probesMax.value=ve.max,Ge.probesResolution.value=ve.resolution}Gr.upload(U,tf(It),Ge,Ht)}if(O.isShaderMaterial&&O.uniformsNeedUpdate===!0&&(Gr.upload(U,tf(It),Ge,Ht),O.uniformsNeedUpdate=!1),O.isSpriteMaterial&&re.setValue(U,\"center\",z.center),re.setValue(U,\"modelViewMatrix\",z.modelViewMatrix),re.setValue(U,\"normalMatrix\",z.normalMatrix),re.setValue(U,\"modelMatrix\",z.matrixWorld),O.uniformsGroups!==void 0){let ve=O.uniformsGroups;for(let Oe=0,jn=ve.length;Oe0&&Ht.useMultisampledRTT(T)===!1?O=Bt.get(T).__webglMultisampledFramebuffer:Array.isArray(Pt)?O=Pt[V]:O=Pt,tt.copy(T.viewport),Et.copy(T.scissor),zt=T.scissorTest}else tt.copy(kt).multiplyScalar(vt).floor(),Et.copy(Kt).multiplyScalar(vt).floor(),zt=te;if(V!==0&&(O=H),ft.bindFramebuffer(U.FRAMEBUFFER,O)&&ft.drawBuffers(T,O),ft.viewport(tt),ft.scissor(Et),ft.setScissorTest(zt),z){let dt=Bt.get(T.texture);U.framebufferTexture2D(U.FRAMEBUFFER,U.COLOR_ATTACHMENT0,U.TEXTURE_CUBE_MAP_POSITIVE_X+N,dt.__webglTexture,V)}else if(mt){let dt=N;for(let Mt=0;Mt1&&U.readBuffer(U.COLOR_ATTACHMENT0+dt);let Ct=nf(Pt);if(Ct.__formatReadable===!1){Lt(\"WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.\");return}if(Ct.__typeReadable===!1){Lt(\"WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.\");return}N>=0&&N<=T.width-O&&V>=0&&V<=T.height-z&&U.readPixels(N,V,O,z,rt.convert(Xt),rt.convert(ie),mt)}finally{let Pt=nt!==null?Bt.get(nt).__webglFramebuffer:null;ft.bindFramebuffer(U.FRAMEBUFFER,Pt)}}},this.readRenderTargetPixelsAsync=async function(T,N,V,O,z,mt,Rt,dt=0){if(!(T&&T.isWebGLRenderTarget))throw new Error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.\");let Mt=Bt.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Rt!==void 0&&(Mt=Mt[Rt],Array.isArray(Mt)&&(Mt=Mt[0])),Mt)if(N>=0&&N<=T.width-O&&V>=0&&V<=T.height-z){ft.bindFramebuffer(U.FRAMEBUFFER,Mt);let Pt=T.textures[dt],Xt=Pt.format,ie=Pt.type;T.textures.length>1&&U.readBuffer(U.COLOR_ATTACHMENT0+dt);let Ct=nf(Pt);if(Ct.__formatReadable===!1)throw new Error(\"THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.\");if(Ct.__typeReadable===!1)throw new Error(\"THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.\");let se=U.createBuffer();U.bindBuffer(U.PIXEL_PACK_BUFFER,se),U.bufferData(U.PIXEL_PACK_BUFFER,mt.byteLength,U.STREAM_READ),U.readPixels(N,V,O,z,rt.convert(Xt),rt.convert(ie),0),U.bindBuffer(U.PIXEL_PACK_BUFFER,null);let Re=nt!==null?Bt.get(nt).__webglFramebuffer:null;ft.bindFramebuffer(U.FRAMEBUFFER,Re);let ge=U.fenceSync(U.SYNC_GPU_COMMANDS_COMPLETE,0);return U.flush(),await gm(U,ge,4),U.bindBuffer(U.PIXEL_PACK_BUFFER,se),U.getBufferSubData(U.PIXEL_PACK_BUFFER,0,mt),U.bindBuffer(U.PIXEL_PACK_BUFFER,null),U.deleteBuffer(se),U.deleteSync(ge),mt}else throw new Error(\"THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.\")},this.copyFramebufferToTexture=function(T,N=null,V=0){let O=Math.pow(2,-V),z=Math.floor(T.image.width*O),mt=Math.floor(T.image.height*O),Rt=N!==null?N.x:0,dt=N!==null?N.y:0;Ht.setTexture2D(T,0),U.copyTexSubImage2D(U.TEXTURE_2D,V,0,0,Rt,dt,z,mt),ft.unbindTexture()},this.copyTextureToTexture=function(T,N,V=null,O=null,z=0,mt=0){let Rt,dt,Mt,Pt,Xt,ie,Ct,se,Re,ge=T.isCompressedTexture?T.mipmaps[mt]:T.image;if(V!==null)Rt=V.max.x-V.min.x,dt=V.max.y-V.min.y,Mt=V.isBox3?V.max.z-V.min.z:1,Pt=V.min.x,Xt=V.min.y,ie=V.isBox3?V.min.z:0;else{let re=Math.pow(2,-z);Rt=Math.floor(ge.width*re),dt=Math.floor(ge.height*re),T.isDataArrayTexture?Mt=ge.depth:T.isData3DTexture?Mt=Math.floor(ge.depth*re):Mt=1,Pt=0,Xt=0,ie=0}O!==null?(Ct=O.x,se=O.y,Re=O.z):(Ct=0,se=0,Re=0);let me=rt.convert(N.format),He=rt.convert(N.type),It;N.isData3DTexture?(Ht.setTexture3D(N,0),It=U.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(Ht.setTexture2DArray(N,0),It=U.TEXTURE_2D_ARRAY):(Ht.setTexture2D(N,0),It=U.TEXTURE_2D),ft.activeTexture(U.TEXTURE0),ft.pixelStorei(U.UNPACK_FLIP_Y_WEBGL,N.flipY),ft.pixelStorei(U.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),ft.pixelStorei(U.UNPACK_ALIGNMENT,N.unpackAlignment);let je=ft.getParameter(U.UNPACK_ROW_LENGTH),le=ft.getParameter(U.UNPACK_IMAGE_HEIGHT),zi=ft.getParameter(U.UNPACK_SKIP_PIXELS),We=ft.getParameter(U.UNPACK_SKIP_ROWS),_l=ft.getParameter(U.UNPACK_SKIP_IMAGES);ft.pixelStorei(U.UNPACK_ROW_LENGTH,ge.width),ft.pixelStorei(U.UNPACK_IMAGE_HEIGHT,ge.height),ft.pixelStorei(U.UNPACK_SKIP_PIXELS,Pt),ft.pixelStorei(U.UNPACK_SKIP_ROWS,Xt),ft.pixelStorei(U.UNPACK_SKIP_IMAGES,ie);let gi=T.isDataArrayTexture||T.isData3DTexture,ki=N.isDataArrayTexture||N.isData3DTexture;if(T.isDepthTexture){let re=Bt.get(T),Ge=Bt.get(N),wn=Bt.get(re.__renderTarget),ve=Bt.get(Ge.__renderTarget);ft.bindFramebuffer(U.READ_FRAMEBUFFER,wn.__webglFramebuffer),ft.bindFramebuffer(U.DRAW_FRAMEBUFFER,ve.__webglFramebuffer);for(let Oe=0;Oe\n
\n
\n\n
\n\"Khách\n\"Khách\n\"\"\"\"\n
\n
\n\n
\n
\n\n\n\n\n\n
\n
\n
\n
Bóc tầng
\n\n\n\n\n\n
\n\n
\n\n\n
\n
\n
\n
\n
\n
Bên trong khách sạn
lâu đời nhất Việt Nam
\n
Hotel Continental Saigon
Quỳnh Nhi - Quang Thông
\n
Cuộn xuống
\n
\n
Năm 1880
Hotel Continental
Hotel Continental khai trương năm 1880, sau đó lần lượt đổi tên thành Đại Lục Lữ Quán (thập niên 1960-1970), Hải Âu (sau năm 1975), trước khi lấy lại tên Hotel Continental Saigon vào những năm sau đó.
Ảnh tư liệu
\n
2026
Hotel Continental Saigon
Sau 146 năm, khách sạn lâu đời nhất Việt Nam này trở thành một trong những công trình biểu tượng của TP.HCM. Công trình kiên định với chức năng duy nhất là phục vụ lưu trú, chưa từng chuyển đổi mục đích sử dụng.
Ảnh: Hotel Continental Saigon
\n
\"\"
Thập niên 1960
\"\"
Mái hiên hôm nay
1
Bên dưới mái hiên, dọc theo góc phố
Những bộ bàn ghế mây ngày ấy nhường chỗ cho bàn ghế sắt sơn trắng, với những đường uốn thanh mảnh mang nét hiện đại hơn. Cách bài trí gần như giữ nguyên vẹn với từng bộ bàn ghế nối nhau dọc hàng cột, theo mái hiên ôm lấy góc phố, tạo nên khung cảnh quen thuộc trước khách sạn.
\n
\"\"
Thời xe ngựa, bên Nhà hát
\"\"
Bên Nhà hát hôm nay
2
Toàn cảnh
Khi khánh thành năm 1880, khách sạn chỉ có một tòa nhà trên mặt tiền đường Đồng Khởi, sau đó dần mở rộng. Qua các đợt tu bổ, riêng phần mái vẫn giữ độ dốc và lớp ngói đất nung, hai đặc điểm của thiết kế ban đầu giúp nước mưa thoát nhanh và không gian bên dưới bớt nóng.
\n
\"\"
Một phòng nghỉ
\"\"
Hành lang gạch bông
3
Hành lang và phòng nghỉ
Những chi tiết nội thất bằng gỗ của trước đây vẫn được gìn giữ, mang theo dáng vẻ truyền thống của khách sạn. Những khu vực dễ xuống cấp do sử dụng thường xuyên, như phòng vệ sinh, được bảo trì định kỳ để đáp ứng nhu cầu của khách lưu trú.
Nội thất trong mô hình là phỏng dựng
\n
\"\"
Sân vườn dưới tán sứ
4
Sân vườn Patio - Trái tim của khách sạn
Nằm giữa các dãy nhà, sân Patio được ví như trái tim của khách sạn. Từ nhiều góc bên trong đều có thể nhìn xuống khoảng sân này. Hai cây sứ cổ thụ vẫn tỏa bóng giữa sân Patio. Cây lâu đời nhất bén rễ từ thuở những viên gạch đầu tiên của khách sạn được đặt xuống năm 1876. Năm 2023, một cơn bão làm cây sứ thứ ba bật gốc sau hơn một thế kỷ đứng trong sân. Khách sạn trồng một cây sứ non vào đúng chỗ ấy, để khoảng sân lại có đủ ba cây như bao năm nay.
\n
\"\"
Thời biển hiệu Continental Palace
\"\"
Góc nhà hôm nay
5
Nhà hàng tầng trệt
Hai mặt nhà hàng từng mở thẳng ra phố nay được lắp kính, để giữa cái nóng ban trưa, thực khách vẫn có thể thong thả dùng bữa bên cửa và ngắm người qua lại. Nội thất đã thay đổi khá nhiều, nhưng không khí nhộn nhịp của những bữa ăn, của tiếng thực khách râm ran trò chuyện, bao năm qua vẫn nguyên vẹn.
\n
\"\"
Mặt tiền hôm nay
6
Lát cắt tòa nhà
Qua lát cắt của tòa nhà, những hành lang dài và cánh cửa gỗ chạm hoa bách hợp hiện ra sau mặt tiền quen thuộc. Đó cũng là một lát cắt của văn hóa Sài Gòn xưa, nơi dấu ấn kiến trúc Pháp còn hiện diện trong những không gian khách vẫn bước qua mỗi ngày.
Qua nhiều lần đổi chủ, việc gìn giữ dáng nhà và những chi tiết nội thất xưa luôn là một phần trong cách khách sạn tiếp đón khách.
Mô hình minh hoạ, bố cục theo hồ sơ thiết kế 2009
\n
\n\n\n"; host.className = 'zac zac__cc'; /* Hết giai đoạn chờ tải: đoạn mã dán trong CMS ẩn link file và video cho tới lúc này */ document.documentElement.classList.remove('cc-wait'); /* Thoát khỏi cột bài của CMS: kéo khối ra hết bề ngang trang và gỡ overflow của các khung bọc để phần ghim khi cuộn vẫn chạy */ var wrapEl = null; function fit() { var vw = document.documentElement.clientWidth, x0 = 0, cw = vw; /* Trang mobile (wap) mở trong cửa sổ rộng: cả trang là một cột hẹp ở giữa. Bám theo cột đó thay vì tràn hết cửa sổ. */ var col = null, br = document.body.getBoundingClientRect(); if (br.width < vw - 40) col = br; else if (/(^|\s)wap(\s|$)/.test(document.body.className + ' ' + document.documentElement.className) || /^m\./.test(location.hostname)) { for (var a = host.parentElement; a && a !== document.documentElement; a = a.parentElement) { var ar = a.getBoundingClientRect(); if (ar.width < vw - 40 && (!col || ar.width > col.width)) col = ar; } } if (col && col.width >= 280) { x0 = col.left; cw = col.width; } var nar = cw <= 760 && (vw > 760 || cw < vw - 40); host.classList.toggle('cc-narrow', nar); if (wrapEl) wrapEl.classList.toggle('cc-narrow-pv', nar); [host, wrapEl].forEach(function (el) { if (!el) return; el.style.setProperty('margin-left', '0', 'important'); el.style.setProperty('width', 'auto', 'important'); var r = el.getBoundingClientRect(); el.style.setProperty('max-width', 'none', 'important'); el.style.setProperty('width', cw + 'px', 'important'); el.style.setProperty('margin-left', (x0 - r.left) + 'px', 'important'); el.style.setProperty('--cw', (cw / 100) + 'px'); }); } for (var an = host.parentElement; an && an !== document.body && an !== document.documentElement; an = an.parentElement) { var cs = getComputedStyle(an); if (cs.overflowX !== 'visible' || cs.overflowY !== 'visible') an.style.setProperty('overflow', 'visible', 'important'); if (cs.transform !== 'none') an.style.setProperty('transform', 'none', 'important'); } /* Trang bài Znews máy tính đặt overflow-x:hidden cho cả html và body, làm body thành khung cuộn riêng và phần ghim bị trôi. Đổi sang clip: vẫn chặn tràn ngang nhưng không tạo khung cuộn. */ var bcs = getComputedStyle(document.body); if (bcs.overflowX !== 'visible' || bcs.overflowY !== 'visible') { document.body.style.setProperty('overflow-y', 'visible', 'important'); document.body.style.setProperty('overflow-x', 'clip', 'important'); } /* Né thanh menu dính của trang: đo phần menu đang che mép trên khung 3D rồi đẩy cụm điều khiển xuống dưới nó */ var gapTick = 0; function topGap() { gapTick = 0; var st = host.querySelector('.zac__cc-sticky'), g = 0, gb = 0; function probe(y, top) { var hr = host.getBoundingClientRect(), els = document.elementsFromPoint(Math.round(hr.left + hr.width / 2), y), v = 0; for (var i = 0; i < els.length; i++) { if (host.contains(els[i])) break; for (var e = els[i]; e && e !== document.body; e = e.parentElement) { var p = getComputedStyle(e).position; if (p === 'fixed' || p === 'sticky') { var er = e.getBoundingClientRect(); v = top ? er.bottom : innerHeight - er.top; break; } } if (v) break; } return v; } if (st) { var r = st.getBoundingClientRect(); if (r.top <= 2 && r.bottom > 160) g = probe(4, true); if (r.bottom >= innerHeight - 2 && r.top < innerHeight - 160) gb = probe(innerHeight - 4, false); } host.style.setProperty('--cc-top', Math.max(0, Math.min(160, Math.round(g))) + 'px'); host.style.setProperty('--cc-bot', Math.max(0, Math.min(160, Math.round(gb))) + 'px'); } function askGap() { if (!gapTick) gapTick = requestAnimationFrame(topGap); } addEventListener('scroll', askGap, { passive: true }); addEventListener('resize', askGap); setInterval(askGap, 1200); fit(); addEventListener('resize', fit); addEventListener('load', fit); setTimeout(fit, 600); setTimeout(fit, 2500); if (host.dataset.below !== 'off') { var w = document.createElement('div'); w.className = 'pv-wrap'; w.innerHTML = "

Năm 2025, TP.HCM cấp hơn 28.000 giấy phép xây dựng các công trình mới. Cũng trong năm này, theo thống kê của Sở Văn hóa và Thể thao tính đến ngày 19/11, thành phố sau sáp nhập có 321 di tích được xếp hạng, trong đó 218 di tích cấp thành phố. Khách sạn cũng được xếp hạng di tích kiến trúc nghệ thuật cấp thành phố từ năm 2012.

Qua nhiều thế hệ, những người làm việc tại đây gìn giữ dáng vẻ quen thuộc của tòa nhà, đồng thời điều chỉnh các chi tiết phục vụ nhu cầu của khách qua từng thời kỳ. Sự chăm chút ấy góp phần đưa khách sạn trở thành một biểu tượng văn hóa của thành phố.

Với hai mặt tiền hướng ra đường Đồng Khởi và Công trường Lam Sơn, ngay cạnh Nhà hát Thành phố, Hotel Continental Saigon cũng thu hút những du khách ghé qua ngắm nhìn kiến trúc. Tòa nhà và những câu chuyện gắn với từng không gian bên trong giúp họ hình dung khu trung tâm đã thay đổi ra sao qua các thời kỳ của Sài Gòn - TP.HCM.

\n

#CultureCut là series của Tri Thức - Znews, khám phá những công trình mang dấu ấn văn hóa và lịch sử của TP.HCM. Qua ảnh tư liệu và các lát cắt kiến trúc dựng bằng mô hình 3D, mỗi số mang đến cái nhìn bao quát về một công trình, từ dáng vẻ bên ngoài đến cách tổ chức không gian bên trong. Cách bố trí các gian phòng, hoa văn trang trí và kiểu dáng nội thất gợi mở nếp sống của một thời.

\n"; host.insertAdjacentElement('afterend', w); wrapEl = w; fit(); if (w.querySelector('.pv-ba')) run("(function(){document.querySelectorAll('.pv-ba').forEach(function(b){var d=b.dataset.a.split(',').map(Number),o=b.querySelector('.pv-ba-old'),n=b.querySelector('.pv-ba-now'),bar=b.querySelector('.pv-ba-bar'),x=0.5;\nvar A=[{el:o,ax:d[0],ay:d[1],hf:d[2]},{el:n,ax:d[3],ay:d[4],hf:d[5]}];\nfunction cl(v,a,c){return Math.max(a,Math.min(c,v))}\nfunction lay(){var W=b.clientWidth,H=b.clientHeight,L=9,R=9,U=9,D=9;if(!W||!o.naturalWidth||!n.naturalWidth)return;\nA.forEach(function(q){q.iw=q.el.naturalWidth;q.ih=q.el.naturalHeight;var k=q.iw/(q.hf*q.ih);L=Math.min(L,q.ax*k);R=Math.min(R,(1-q.ax)*k);U=Math.min(U,q.ay/q.hf);D=Math.min(D,(1-q.ay)/q.hf)});\nvar Hc=Math.max(W/(L+R),H/(U+D))*1.002,cx=cl(0.36*W,W-R*Hc,L*Hc),cy=cl(0.9*H,H-D*Hc,U*Hc);\nA.forEach(function(q){var sc=Hc/(q.hf*q.ih),w=q.iw*sc,h=q.ih*sc,s=q.el.style;s.width=w+'px';s.height=h+'px';s.left=(cx-q.ax*w)+'px';s.top=(cy-q.ay*h)+'px';q.l=cx-q.ax*w;q.w=w});set(x)}\nfunction set(v){x=cl(v,0.02,0.98);var W=b.clientWidth,q=A[0];bar.style.left=(x*100)+'%';if(q.w)o.style.clipPath='inset(0 '+(q.l+q.w-x*W)+'px 0 0)';b.setAttribute('aria-valuenow',Math.round(x*100))}\nfunction mv(e){var r=b.getBoundingClientRect();set((e.clientX-r.left)/r.width)}\nb.addEventListener('pointerdown',function(e){b.setPointerCapture(e.pointerId);mv(e);b.onpointermove=mv});\nfunction up(){b.onpointermove=null}b.addEventListener('pointerup',up);b.addEventListener('pointercancel',up);\nb.addEventListener('keydown',function(e){if(e.key==='ArrowLeft')set(x-0.04);if(e.key==='ArrowRight')set(x+0.04)});\n[o,n].forEach(function(i){i.addEventListener('load',lay)});addEventListener('resize',lay);lay()})})();"); } run("(function () {\n if (window.ZAC_EDIT) return;\n 'use strict';\n var root = document.getElementById('zac-continental-three');\n if (!root || root.dataset.init || root.closest('[contenteditable=\"true\"]') || document.designMode === 'on') return;\n root.dataset.init = '1';\n var mobile = matchMedia('(max-width:760px), (pointer:coarse)').matches || (document.getElementById('zac-continental-three') || document.body).classList.contains('cc-narrow');\n var reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;\n var canvas = root.querySelector('canvas'), stage = root.querySelector('.zac__cc-stage'), scroller = root.querySelector('.zac__cc-scroll');\n var oldImg = root.querySelector('.cc-old'), nowImg = root.querySelector('.cc-now'), steps = Array.from(root.querySelectorAll('.cc-step')), hero = root.querySelector('.cc-hero'), frame = root.querySelector('.cc-frame'), scrim = root.querySelector('.cc-scrim'), paper = root.querySelector('.cc-paper'), skip = root.querySelector('.cc-skip'), todIn = root.querySelector('.cc-tod input');\n var caption = root.querySelector('.zac__cc-caption'), status = root.querySelector('.zac__cc-message');\n var retry = root.querySelector('.cc-retry'), startBtn = root.querySelector('.cc-start');\n var select = root.querySelector('select'), cutBtns = Array.from(root.querySelectorAll('[data-cut]')), actBtns = Array.from(root.querySelectorAll('[data-action]'));\n var SECX = 4, cores = [], secPlane = null, secOn = false, secLabels = [], streetL = [], CTXB = [], CTXR = null, stOn = true, marks = [], hls = [], facLabels = [], MATG = null, T, renderer, scene, camera, ready = false, loading = false, dirty = true, groups = {}, cut = 4, spin = false, tween = null, introDone = false, introP = 0, UPV, cutLabels = [], lblOn = true, planes = [], bladeMesh = null, cutFv = 4, L = {}, todV = -1, live = false;\n var OUT = 0, outFrom = null, MVR = null, hasVid = false, mvT = 0;\n var lastT = 0, qT = 0, qS = -1, shift = 0, camSh = 0, shY = 0, V3, secW, secTr = false, cam = { tx: 0, ty: 7, tz: 0, az: -0.75, pol: 0.32, dist: 125, fov: 35, yaw: 0, tilt: 0 };\n var sayTimer;\n function say(text, ms) { status.textContent = text || ''; status.hidden = !text; clearTimeout(sayTimer); if (text && ms) sayTimer = setTimeout(function () { status.hidden = true; }, ms); }\n\n // ---------- Hình bổ dọc: chạm vào từng khu ----------\n (function () {\n var sec = root.querySelector('.cc-section'); if (!sec) return;\n var data = JSON.parse(sec.dataset.zones), info = sec.querySelector('.cc-sec-info'), zs = Array.from(sec.querySelectorAll('.cc-z')), bs = Array.from(sec.querySelectorAll('.cc-zb'));\n function pick(i) {\n zs.forEach(function (z) { z.classList.toggle('cc-act', +z.dataset.z === i); });\n bs.forEach(function (b) { b.setAttribute('aria-pressed', String(+b.dataset.z === i)); });\n info.textContent = ''; var b = document.createElement('b'); b.textContent = data[i][0]; info.append(b, document.createTextNode(data[i][1]));\n }\n zs.concat(bs).forEach(function (el) {\n el.addEventListener('click', function () { pick(+el.dataset.z); });\n el.addEventListener('keydown', function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); pick(+el.dataset.z); } });\n });\n pick(2);\n })();\n\n // ---------- Tải Three.js (dùng chung file .txt với các bài 3D khác) ----------\n function library() {\n if (globalThis.ZnewsThree187 && globalThis.ZnewsThree187.WebGLRenderer) return Promise.resolve(globalThis.ZnewsThree187);\n if (!globalThis.zacThree187Loading) {\n globalThis.zacThree187Loading = (async function () {\n var inline = document.getElementById('cc-offline-library'), code;\n if (inline) code = inline.textContent;\n else {\n var res = await fetch(root.dataset.three, { credentials: 'omit' });\n if (!res.ok) throw Error('Không tải được Three.js (' + res.status + ').');\n code = await res.text();\n }\n var s = document.createElement('script'); s.textContent = code; document.head.append(s); s.remove();\n if (!globalThis.ZnewsThree187 || !globalThis.ZnewsThree187.WebGLRenderer) throw Error('Chưa khởi động được Three.js.');\n return globalThis.ZnewsThree187;\n })().catch(function (e) { delete globalThis.zacThree187Loading; throw e; });\n }\n return globalThis.zacThree187Loading;\n }\n\n // ---------- Kích thước (m), lấy từ hồ sơ thiết kế 2009 ----------\n var BASE = [0, 5.4, 9.7, 14.0], HGT = [5.4, 4.3, 4.3, 4.3], TOP = 18.3;\n function X(x) { return x - 55.5; }\n function Z(y) { return 47 - y; }\n var GROUND = [[21, 90, 22, 43], [21, 46.5, 43, 72], [46.5, 90, 62, 72], [72.5, 90, 43, 62]];\n var UPPER = [[21, 90, 22, 42], [21, 46.5, 42, 72], [46.5, 90, 62, 72]];\n // Theo mặt bằng 2009: lầu 3 chỉ có ở cánh nhìn ra Công trường Lam Sơn (phòng 301-314); lầu 2 có sân cảnh phía trong; cánh Đồng Khởi và cánh sau cao ba tầng\n var FP = [GROUND, UPPER, [[21, 90, 22, 34], [21, 62, 34, 42], [21, 46.5, 42, 72], [46.5, 90, 62, 72]], [[21, 90, 22, 34]]];\n function inFP(f, x, y) { return FP[f].some(function (r) { return x >= r[0] && x <= r[1] && y >= r[2] && y <= r[3]; }); }\n var COURT = [46.5, 72.5, 43, 62];\n var TREES = [[50.4, 51.5, 1.15], [68.4, 53.5, 1.15], [59.5, 58.8, 0.5]]; // sân Patio: hai cây sứ cổ thụ và một cây non\n var EDGES_UP = [[21, 22, 90, 22, 0, -1, 'street'], [21, 22, 21, 72, -1, 0, 'street'], [90, 22, 90, 42, 1, 0, 'side'], [90, 62, 90, 72, 1, 0, 'side'],\n [46.5, 42, 90, 42, 0, 1, 'court'], [46.5, 42, 46.5, 62, 1, 0, 'court'], [46.5, 62, 90, 62, 0, -1, 'court'], [21, 72, 90, 72, 0, 1, 'blind']];\n var EDGES_2 = [[21, 22, 90, 22, 0, -1, 'street'], [21, 22, 21, 72, -1, 0, 'street'], [90, 22, 90, 34, 1, 0, 'side'], [90, 62, 90, 72, 1, 0, 'side'],\n [62, 34, 90, 34, 0, 1, 'court'], [62, 34, 62, 42, 1, 0, 'court'], [46.5, 42, 62, 42, 0, 1, 'court'], [46.5, 42, 46.5, 62, 1, 0, 'court'], [46.5, 62, 90, 62, 0, -1, 'court'], [21, 72, 90, 72, 0, 1, 'blind']];\n var EDGES_3 = [[21, 22, 90, 22, 0, -1, 'street'], [21, 22, 21, 34, -1, 0, 'street'], [90, 22, 90, 34, 1, 0, 'side'], [21, 34, 90, 34, 0, 1, 'court']];\n var EDGES_F = [null, EDGES_UP, EDGES_2, EDGES_3];\n var EDGES_G = [[21, 22, 90, 22, 0, -1, 'street'], [21, 22, 21, 72, -1, 0, 'street'], [90, 22, 90, 72, 1, 0, 'blind'], [21, 72, 90, 72, 0, 1, 'blind'],\n [46.5, 43, 72.5, 43, 0, 1, 'court'], [46.5, 43, 46.5, 62, 1, 0, 'court'], [46.5, 62, 72.5, 62, 0, -1, 'court'], [72.5, 43, 72.5, 62, -1, 0, 'court']];\n // Các khu chức năng (giản lược) — [x0,x1,y0,y1,loại]\n var KIND = {\n sanh: ['Sảnh, lễ tân', 0xc29a5c], an: ['Nhà hàng, phòng tiệc', 0xa8674f], shop: ['Cửa hàng', 0x8fa29a], vp: ['Văn phòng, phòng họp', 0xa9a48c],\n kt: ['Bếp, kho, khu nhân viên', 0xb9b3a8], spa: ['Spa, hồ bơi', 0x9db6b4], pho: ['Phòng nhìn ra phố', 0xc9a172], vuon: ['Phòng nhìn vào sân vườn', 0xaeb088],\n sau: ['Phòng phía sau', 0xc4b69e], hl: ['Hành lang, hiên (gạch bông)', 0xc59a7c], core: ['Thang máy, cầu thang', 0x6f4a30]\n };\n var ZONES0 = [[21, 37, 22, 34, 'an'], [37, 52, 22, 36, 'sanh'], [52, 64, 22, 36, 'vp'], [64, 90, 22, 36, 'shop'], [52, 90, 36, 43, 'vp'], [21, 40, 34, 58, 'an'], [40, 46.5, 36, 62, 'kt'], [21, 40, 58, 72, 'shop'], [40, 90, 62, 72, 'kt'], [72.5, 90, 43, 62, 'spa']];\n var LABELS0 = [[29, 28, 'Nhà hàng'], [44.5, 29, 'Sảnh chính'], [58, 29, 'Văn phòng'], [77, 29, 'Cửa hàng'], [30, 46, 'Phòng tiệc, phòng ăn'], [30, 65, 'Cửa hàng'], [65, 67, 'Bếp, kho'], [81, 52.5, 'Spa, hồ bơi'], [59.5, 52.5, 'Sân vườn']];\n var CORES = [[52, 55.5, 35, 39], [31, 35, 67.5, 71.5], [85, 88.5, 31, 34.5]];\n function upperZones() {\n var z = [], x, y;\n for (x = 21; x < 89.9; x += 4.6) z.push([x, Math.min(x + 4.6, 90), 22, 30.5, 'pho']);\n z.push([29.5, 90, 30.5, 32.5, 'hl']);\n for (x = 46.5; x < 89.9; x += 4.35) z.push([x, Math.min(x + 4.35, 90), 32.5, 42, 'vuon']);\n for (y = 30.5; y < 71.9; y += 4.6) z.push([21, 29.5, y, Math.min(y + 4.6, 72), 'pho']);\n z.push([29.5, 31.5, 32.5, 72, 'hl']);\n for (y = 32.5; y < 71.9; y += 4.95) z.push([31.5, 46.5, y, Math.min(y + 4.95, 72), 'vuon']);\n z.push([46.5, 90, 62, 64, 'hl']);\n for (x = 46.5; x < 89.9; x += 4.35) z.push([x, Math.min(x + 4.35, 90), 64, 72, 'sau']);\n return z;\n }\n var LABELS_UP = [[62, 26.2, 'Phòng nhìn ra phố'], [78, 31.5, 'Hành lang'], [70, 37.2, 'Phòng nhìn vào sân vườn'], [25.2, 54, 'Phòng nhìn ra Đồng Khởi'], [70, 68, 'Phòng phía sau'], [43.5, 48, 'Hiên'], [59.5, 52.5, 'Sân vườn']];\n\n // ---------- Công cụ hình học ----------\n function Batch() { this.p = []; this.n = []; this.u = []; }\n Batch.prototype.box = function (cx, cy, cz, sx, sy, sz, ry) {\n var c = Math.cos(ry || 0), s = Math.sin(ry || 0), hx = sx / 2, hy = sy / 2, hz = sz / 2, p = this.p, n = this.n;\n var F = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], q = [[-1, -1], [1, -1], [1, 1], [-1, -1], [1, 1], [-1, 1]];\n for (var f = 0; f < 6; f++) {\n var N = F[f], u, v;\n if (N[0]) { u = [0, 1, 0]; v = [0, 0, 1]; } else if (N[1]) { u = [0, 0, 1]; v = [1, 0, 0]; } else { u = [1, 0, 0]; v = [0, 1, 0]; }\n if (N[0] + N[1] + N[2] < 0) { var t = u; u = v; v = t; }\n for (var k = 0; k < 6; k++) {\n var lx = (N[0] + u[0] * q[k][0] + v[0] * q[k][1]) * hx, ly = (N[1] + u[1] * q[k][0] + v[1] * q[k][1]) * hy, lz = (N[2] + u[2] * q[k][0] + v[2] * q[k][1]) * hz;\n var wx = cx + c * lx + s * lz, wy = cy + ly, wz = cz - s * lx + c * lz;\n p.push(wx, wy, wz);\n if (N[1]) this.u.push(wx, wz); else if (N[0]) this.u.push(c * lz - s * lx + cz + cx, wy); else this.u.push(c * lx + s * lz + cx + cz, wy);\n n.push(c * N[0] + s * N[2], N[1], -s * N[0] + c * N[2]);\n }\n }\n };\n Batch.prototype.tri = function (a, b, c) {\n var ux = b[0] - a[0], uy = b[1] - a[1], uz = b[2] - a[2], vx = c[0] - a[0], vy = c[1] - a[1], vz = c[2] - a[2];\n var nx = uy * vz - uz * vy, ny = uz * vx - ux * vz, nz = ux * vy - uy * vx, l = Math.hypot(nx, ny, nz) || 1;\n this.p.push.apply(this.p, a.concat(b, c));\n for (var i = 0; i < 3; i++) this.n.push(nx / l, ny / l, nz / l);\n var ax = Math.abs(nx) > Math.abs(nz), sl = l / (Math.hypot(nx, nz) || 1);\n [a, b, c].forEach(function (q) { this.u.push(ax ? q[2] : q[0], q[1] * sl); }, this);\n };\n Batch.prototype.mesh = function (mat, shadow) {\n var g = new T.BufferGeometry();\n g.setAttribute('position', new T.Float32BufferAttribute(this.p, 3));\n g.setAttribute('normal', new T.Float32BufferAttribute(this.n, 3));\n if (this.u.length === this.p.length / 3 * 2) g.setAttribute('uv', new T.Float32BufferAttribute(this.u, 2));\n var m = new T.Mesh(g, mat); m.castShadow = !!shadow; m.receiveShadow = true; return m;\n };\n function rectBox(b, r, y0, h, gap) {\n var i = gap || 0;\n b.box((X(r[0]) + X(r[1])) / 2, y0 + h / 2, (Z(r[2]) + Z(r[3])) / 2, r[1] - r[0] - 2 * i, h, r[3] - r[2] - 2 * i);\n }\n function hipRoof(b, r, y0, h) {\n var x0 = X(r[0]), x1 = X(r[1]), z0 = Z(r[3]), z1 = Z(r[2]), w = x1 - x0, d = z1 - z0;\n var a = [x0, y0, z0], bb = [x1, y0, z0], c = [x1, y0, z1], e = [x0, y0, z1], r1, r2;\n if (w >= d) { r1 = [x0 + d / 2, y0 + h, (z0 + z1) / 2]; r2 = [x1 - d / 2, y0 + h, (z0 + z1) / 2];\n b.tri(e, c, r2); b.tri(e, r2, r1); b.tri(bb, a, r1); b.tri(bb, r1, r2); b.tri(a, e, r1); b.tri(c, bb, r2);\n } else { r1 = [(x0 + x1) / 2, y0 + h, z0 + w / 2]; r2 = [(x0 + x1) / 2, y0 + h, z1 - w / 2];\n b.tri(c, bb, r1); b.tri(c, r1, r2); b.tri(a, e, r2); b.tri(a, r2, r1); b.tri(bb, a, r1); b.tri(e, c, r2);\n }\n }\n function archShape(w, h) {\n var s = new T.Shape(), r = w / 2;\n s.moveTo(-r, 0); s.lineTo(r, 0); s.lineTo(r, h - r); s.absarc(0, h - r, r, 0, Math.PI, false); s.lineTo(-r, 0);\n return new T.ShapeGeometry(s, 10);\n }\n function Inst(geo, mat, shadow) { this.geo = geo; this.mat = mat; this.m = []; this.shadow = shadow; }\n Inst.prototype.add = function (x, y, z, ry, sx, sy, sz) {\n this.m.push(new T.Matrix4().compose(new T.Vector3(x, y, z), new T.Quaternion().setFromAxisAngle(new T.Vector3(0, 1, 0), ry), new T.Vector3(sx || 1, sy || 1, sz || 1)));\n };\n Inst.prototype.mesh = function () {\n var im = new T.InstancedMesh(this.geo, this.mat, Math.max(1, this.m.length));\n this.m.forEach(function (m, i) { im.setMatrixAt(i, m); });\n im.count = this.m.length; im.castShadow = !!this.shadow; im.receiveShadow = true; return im;\n };\n function textCanvas(text, opt) {\n var c = document.createElement('canvas'), ctx = c.getContext('2d'), fs = 46, lead = opt.lead ? 150 : 0, font = (opt.weight || '600') + ' ' + fs + 'px ' + (opt.font || '-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif');\n if (opt.caps) text = text.toUpperCase();\n function prep() { ctx.font = font; if (opt.caps && 'letterSpacing' in ctx) ctx.letterSpacing = '5px'; }\n prep(); var w = Math.ceil(ctx.measureText(text).width) + 56, th = fs + 36; c.width = w; c.height = th + lead; prep();\n if (opt.bg) { ctx.fillStyle = opt.bg; ctx.fillRect(0, 6, w, th - 12); ctx.strokeStyle = 'rgba(43,24,17,.28)'; ctx.lineWidth = 2; ctx.strokeRect(1, 7, w - 2, th - 14); }\n ctx.textBaseline = 'middle'; ctx.textAlign = 'center'; ctx.lineJoin = 'round';\n if (opt.halo) { ctx.strokeStyle = opt.halo; ctx.lineWidth = 12; ctx.strokeText(text, w / 2, th / 2 + 2); }\n ctx.fillStyle = opt.color || '#1d1a16'; ctx.fillText(text, w / 2, th / 2 + 2);\n if (lead) { ctx.fillStyle = opt.color || '#1d1a16'; ctx.fillRect(w / 2 - 1.5, th - 7, 3, lead - 3); ctx.beginPath(); ctx.arc(w / 2, th + lead - 11, 10, 0, 7); ctx.fill(); }\n var tex = new T.CanvasTexture(c); tex.colorSpace = T.SRGBColorSpace; tex.anisotropy = 4; return { tex: tex, ratio: w / c.height, k: c.height / th };\n }\n function textSprite(text, size, opt) {\n opt = opt || {}; var t = textCanvas(text, opt);\n var sp = new T.Sprite(new T.SpriteMaterial({ map: t.tex, depthTest: opt.depthTest !== false, transparent: true, sizeAttenuation: !opt.fix })); if (opt.fix) { sp.userData.k = t.k; sp.userData.r = t.ratio; fixL.push(sp); }\n sp.scale.set(size * t.k * t.ratio, size * t.k, 1); if (opt.lead) sp.center.set(0.5, 0); if (opt.depthTest === false) sp.renderOrder = 10; return sp;\n }\n\n var how = root.querySelector('.cc-how');\n function howText() { return (mobile || (window.matchMedia && matchMedia('(pointer:coarse)').matches)) ? 'Vuốt ngang để xoayHai ngón để thu phóng' : 'Kéo chuột để xoayGiữ ' + (/Mac|iPhone|iPad/.test(navigator.platform || '') ? '⌘' : 'Ctrl') + ' và cuộn để thu phóng'; }\n if (how) how.innerHTML = howText();\n var nudgeT = 0; function nudge() { if (!how) return; how.classList.add('cc-nudge'); clearTimeout(nudgeT); nudgeT = setTimeout(function () { how.classList.remove('cc-nudge'); }, 1600); }\n var UIEL = [root.querySelector('.cc-cut'), caption, root.querySelector('.cc-tools'), how];\n var fixL = [], LBL = { color: '#2b1811', bg: 'rgba(246,240,230,.94)', weight: '700', depthTest: false, caps: true, lead: false, fix: true }, LEADT = null;\n // ---------- Dựng cảnh ----------\n function build() {\n var M = function (c, o) { o = o || {}; o.color = c; o.roughness = o.roughness == null ? 0.85 : o.roughness; o.metalness = o.metalness || 0; return new T.MeshStandardMaterial(o); };\n // Chất liệu vẽ bằng canvas (không cần file ảnh): vôi, ngói, ván gỗ, gạch bông, gạch men, nhựa đường, gạch vỉa hè\n var seed = 7; function rnd() { seed = (seed * 16807) % 2147483647; return seed / 2147483647; }\n function tex(px, metres, draw, data) {\n var cv = document.createElement('canvas'); cv.width = cv.height = px; var x = cv.getContext('2d'); draw(x, px);\n var t = new T.CanvasTexture(cv); t.wrapS = t.wrapT = T.RepeatWrapping; t.repeat.set(1 / metres, 1 / metres); t.anisotropy = 8; if (!data) t.colorSpace = T.SRGBColorSpace; return t;\n }\n var tPlaster = tex(512, 7, function (x, n) {\n x.fillStyle = '#f4f1ea'; x.fillRect(0, 0, n, n);\n for (var i = 0; i < 9000; i++) { x.fillStyle = 'rgba(' + (rnd() > 0.5 ? '90,70,50' : '255,255,255') + ',' + (0.03 + rnd() * 0.05) + ')'; x.fillRect(rnd() * n, rnd() * n, 1 + rnd() * 2.5, 1 + rnd() * 2.5); }\n for (i = 0; i < 26; i++) { var sx = rnd() * n, g = x.createLinearGradient(0, 0, 0, n); g.addColorStop(0, 'rgba(110,90,60,' + (0.05 + rnd() * 0.07) + ')'); g.addColorStop(0.5 + rnd() * 0.5, 'rgba(110,90,60,0)'); x.fillStyle = g; x.fillRect(sx, 0, 3 + rnd() * 14, n); }\n });\n var tRoof = tex(256, 1.6, function (x, n) {\n var r = n / 8;\n for (var j = 0; j < 8; j++) for (var i = -1; i < 8; i++) {\n var ox = i * r + (j % 2) * r / 2, oy = j * r, l = 40 + rnd() * 16, g = x.createLinearGradient(0, oy, 0, oy + r);\n g.addColorStop(0, 'hsl(14,' + (46 + rnd() * 12) + '%,' + (l - 17) + '%)'); g.addColorStop(0.25, 'hsl(15,52%,' + l + '%)'); g.addColorStop(1, 'hsl(17,50%,' + (l + 7) + '%)');\n x.fillStyle = g; x.fillRect(ox, oy, r, r); x.fillStyle = 'rgba(40,15,8,.5)'; x.fillRect(ox, oy, 1.5, r);\n }\n });\n var tPlank = tex(512, 2.4, function (x, n) {\n var w = n / 10;\n for (var i = 0; i < 10; i++) {\n var l = 78 + rnd() * 16; x.fillStyle = 'hsl(32,22%,' + l + '%)'; x.fillRect(i * w, 0, w, n);\n for (var k = 0; k < 26; k++) { x.fillStyle = 'rgba(70,45,20,' + (0.03 + rnd() * 0.06) + ')'; x.fillRect(i * w + rnd() * w, 0, 1, n); }\n x.fillStyle = 'rgba(40,25,10,.55)'; x.fillRect(i * w, 0, 1.5, n);\n for (k = 0; k < 2; k++) x.fillRect(i * w, rnd() * n, w, 1.5);\n }\n });\n var tBong = tex(256, 0.8, function (x, n) {\n var h = n / 2;\n for (var j = 0; j < 2; j++) for (var i = 0; i < 2; i++) {\n var ox = i * h, oy = j * h; x.fillStyle = '#e7d9bb'; x.fillRect(ox, oy, h, h);\n x.fillStyle = '#a5563a'; x.beginPath(); x.moveTo(ox + h / 2, oy + h * 0.12); x.lineTo(ox + h * 0.88, oy + h / 2); x.lineTo(ox + h / 2, oy + h * 0.88); x.lineTo(ox + h * 0.12, oy + h / 2); x.fill();\n x.fillStyle = '#e7d9bb'; x.beginPath(); x.arc(ox + h / 2, oy + h / 2, h * 0.17, 0, 7); x.fill();\n x.fillStyle = '#3d4a44'; x.beginPath(); x.arc(ox + h / 2, oy + h / 2, h * 0.08, 0, 7); x.fill();\n [[0, 0], [1, 0], [0, 1], [1, 1]].forEach(function (q) { x.beginPath(); x.arc(ox + q[0] * h, oy + q[1] * h, h * 0.2, 0, 7); x.fill(); });\n x.strokeStyle = 'rgba(60,45,30,.5)'; x.lineWidth = 1.5; x.strokeRect(ox, oy, h, h);\n }\n });\n var tMen = tex(256, 1.2, function (x, n) {\n var w = n / 8; for (var j = 0; j < 8; j++) for (var i = 0; i < 8; i++) { x.fillStyle = 'hsl(40,10%,' + (86 + rnd() * 9) + '%)'; x.fillRect(i * w, j * w, w, w); }\n x.fillStyle = 'rgba(90,85,75,.6)'; for (i = 0; i < 8; i++) { x.fillRect(i * w, 0, 1.5, n); x.fillRect(0, i * w, n, 1.5); }\n });\n var tRoad = tex(512, 9, function (x, n) {\n x.fillStyle = '#6d6a66'; x.fillRect(0, 0, n, n);\n for (var i = 0; i < 16000; i++) { var v = rnd(); x.fillStyle = 'rgba(' + (v > 0.5 ? '235,225,205' : '20,18,15') + ',' + (0.05 + rnd() * 0.12) + ')'; x.fillRect(rnd() * n, rnd() * n, 1 + rnd() * 2, 1 + rnd() * 2); }\n for (i = 0; i < 14; i++) { var g = x.createRadialGradient(0, 0, 0, 0, 0, 1); g.addColorStop(0, 'rgba(30,26,22,.16)'); g.addColorStop(1, 'rgba(30,26,22,0)'); x.save(); x.translate(rnd() * n, rnd() * n); x.scale(40 + rnd() * 90, 20 + rnd() * 40); x.fillStyle = g; x.fillRect(-1, -1, 2, 2); x.restore(); }\n });\n var tPaver = tex(256, 2, function (x, n) {\n var w = n / 5; for (var j = 0; j < 5; j++) for (var i = 0; i < 5; i++) { x.fillStyle = 'hsl(36,12%,' + (82 + rnd() * 12) + '%)'; x.fillRect(i * w, j * w, w, w); }\n x.fillStyle = 'rgba(70,60,48,.55)'; for (i = 0; i < 5; i++) { x.fillRect(i * w, 0, 2, n); x.fillRect(0, i * w, n, 2); }\n });\n var mat = {\n wall: M(0xfaf5ea, { map: tPlaster, bumpMap: tPlaster, bumpScale: 0.5, roughness: 0.92 }), trim: M(0xfffaf0, { roughness: 0.7 }), base: M(0xe9dcc2, { map: tPlaster, bumpMap: tPlaster, bumpScale: 0.5, roughness: 0.9 }),\n glass: M(0x93a7b3, { roughness: 0.07, metalness: 1, envMapIntensity: 1.25 }),\n glassWarm: M(0x8a7a66, { emissive: 0xd99a55, emissiveIntensity: 0.12, roughness: 0.1, metalness: 0.9, envMapIntensity: 1.2 }), iron: M(0x23262a, { roughness: 0.38, metalness: 0.7 }),\n tile: M(0xffffff, { map: tRoof, bumpMap: tRoof, bumpScale: 1.4, roughness: 0.78 }), slab: M(0xd8d1c3, { map: tPlaster }), cutSlab: M(0xece3d2), pave: M(0xd39a72, { map: tPaver, bumpMap: tPaver, bumpScale: 0.4, roughness: 0.8 }), road: M(0xffffff, { map: tRoad, bumpMap: tRoad, bumpScale: 0.5, roughness: 0.82 }),\n walk: M(0xe3d8c4, { map: tPaver, bumpMap: tPaver, bumpScale: 0.4, roughness: 0.85 }), trunk: M(0x6b5642, { roughness: 1 }), leaf: M(0x556a3a, { roughness: 1 }), leaf2: M(0x70823f, { roughness: 1 }), flower: M(0xfff6e6), water: M(0x3f8088, { roughness: 0.04, metalness: 0.55, envMapIntensity: 1.6 }),\n ghost: M(0xd9cfbd, { transparent: true, opacity: 0.62, roughness: 1 }), umb: M(0xfbfaf6, { roughness: 1 }), pot: M(0x9b5f44, { roughness: 0.7 }), mark: M(0xb5ab99, { roughness: 1 })\n };\n var kmat = {}; Object.keys(KIND).forEach(function (k) {\n kmat[k] = k === 'hl' ? M(0xffffff, { map: tBong, roughness: 0.32 }) : (k === 'kt' || k === 'spa') ? M(KIND[k][1], { map: tMen, roughness: 0.3 }) : M(KIND[k][1], { map: tPlank, bumpMap: tPlank, bumpScale: 0.25, roughness: 0.42 });\n });\n // Bầu trời nắng chiều: vừa là nền, vừa là thứ kính, mặt nước và sàn gỗ phản chiếu lại\n var sky = (function () {\n var cv = document.createElement('canvas'); cv.width = 1024; cv.height = 512; var x = cv.getContext('2d'), g = x.createLinearGradient(0, 0, 0, 512);\n g.addColorStop(0, '#7fa6cc'); g.addColorStop(0.3, '#b3cbdc'); g.addColorStop(0.44, '#e6dccb'); g.addColorStop(0.5, '#eeddc2'); g.addColorStop(0.56, '#d8cab2'); g.addColorStop(1, '#8a7c69');\n x.fillStyle = g; x.fillRect(0, 0, 1024, 512);\n for (var i = 0; i < 16; i++) { var cx = rnd() * 1024, cy = 60 + rnd() * 150, rg = x.createRadialGradient(0, 0, 0, 0, 0, 1); rg.addColorStop(0, 'rgba(255,248,236,.55)'); rg.addColorStop(1, 'rgba(255,248,236,0)'); x.save(); x.translate(cx, cy); x.scale(70 + rnd() * 110, 16 + rnd() * 22); x.fillStyle = rg; x.fillRect(-1, -1, 2, 2); x.restore(); }\n var sg = x.createRadialGradient(906, 178, 0, 906, 178, 150); sg.addColorStop(0, 'rgba(255,244,214,1)'); sg.addColorStop(0.12, 'rgba(255,226,170,.8)'); sg.addColorStop(1, 'rgba(255,214,150,0)'); x.fillStyle = sg; x.fillRect(700, 0, 324, 400);\n var t = new T.CanvasTexture(cv); t.mapping = T.EquirectangularReflectionMapping; t.colorSpace = T.SRGBColorSpace; return t;\n })();\n scene.background = sky;\n try { var pm = new T.PMREMGenerator(renderer); scene.environment = pm.fromEquirectangular(sky).texture; scene.environmentIntensity = 0.6; pm.dispose(); } catch (e) {}\n L.hemi = new T.HemisphereLight(0xdfe8f2, 0x9a8468, 0.5); scene.add(L.hemi);\n var sun = new T.DirectionalLight(0xffdfb8, 3.0); sun.position.set(-80, 55, 70); sun.castShadow = true;\n var sz = mobile ? 1024 : 2048; sun.shadow.mapSize.set(sz, sz); var sc = sun.shadow.camera; sc.left = -80; sc.right = 80; sc.top = 80; sc.bottom = -80; sc.near = 10; sc.far = 260; sun.shadow.bias = -0.0004; sun.shadow.normalBias = 0.04;\n scene.add(sun); L.sun = sun; L.warm = []; L.lamps = [];\n [[44.5, 29], [29, 28], [30, 46], [77, 29], [30, 65], [59.5, 52.5]].forEach(function (q) { var pl = new T.PointLight(0xffb469, 0, 46, 1.7); pl.position.set(X(q[0]), 3.4, Z(q[1])); scene.add(pl); L.lamps.push(pl); });\n // Nhát cắt: mỗi tầng vỏ có một mặt phẳng cắt riêng, quét ngang toà nhà theo cuộn\n for (var pi = 0; pi < 4; pi++) planes.push(new T.Plane(new T.Vector3(-1, 0, 0), 1e4));\n var MAT = mat;\n function clipSet(i) { var o = {}; ['wall', 'trim', 'base', 'glass', 'glassWarm', 'iron', 'tile', 'slab'].forEach(function (k) { o[k] = MAT[k].clone(); o[k].clippingPlanes = [planes[i]]; o[k].clipShadows = true; if (k === 'glassWarm') L.warm.push(o[k]); }); return o; }\n bladeMesh = new T.Mesh(new T.PlaneGeometry(60, 1), new T.MeshBasicMaterial({ color: 0xfff1cf, transparent: true, opacity: 0.3, side: T.DoubleSide, depthWrite: false, fog: false }));\n bladeMesh.rotation.y = Math.PI / 2; bladeMesh.visible = false; bladeMesh.renderOrder = 5; scene.add(bladeMesh);\n\n // Đường phố, vỉa hè, cây\n var env = new T.Group();\n var ground = new Batch(); ground.box(0, -0.06, 0, 1400, 0.1, 1400); env.add(ground.mesh(mat.road));\n var walk = new Batch();\n // Vỉa hè và các ô phố quanh khách sạn, đặt theo bản đồ OpenStreetMap (toạ độ bản vẽ: mặt Lam Sơn y=22, mặt Đồng Khởi x=21)\n function slab(x0, x1, y0, y1, h) { walk.box((X(x0) + X(x1)) / 2, (h || 0.12) / 2, (Z(y0) + Z(y1)) / 2, x1 - x0, h || 0.12, y1 - y0); }\n slab(16.5, 92, 14, 22); slab(16.5, 21, 22, 74);\n slab(19, 108, -47, 5, 0.1);\n slab(-75, 7, 1, 123, 0.1); slab(16.5, 186, 74, 123, 0.1); slab(92, 186, 10, 74, 0.1);\n slab(-140, 3, -34, -17, 0.1); slab(20, 116, -120, -74, 0.1); slab(-35, 7, -77, -48, 0.1); slab(196, 290, -90, 123, 0.1); slab(-75, 186, 133, 232, 0.1);\n env.add(walk.mesh(mat.walk));\n var pave = new Batch(); rectBox(pave, COURT, 0, 0.1); env.add(pave.mesh(mat.pave));\n var trunk = new Batch(), leaf = new Batch(), leaf2 = new Batch(), flower = new Batch();\n var blob = new Inst(new T.SphereGeometry(1, 18, 12), mat.leaf, true), blob2 = new Inst(new T.SphereGeometry(1, 18, 12), mat.leaf2, true);\n function streetTree(x, z) { trunk.box(x, 3.2, z, 0.45, 6.4, 0.45); blob.add(x, 8, z, 0, 3.0, 2.2, 3.0); blob2.add(x + 1.3, 9.0, z - 0.6, 0.5, 2.3, 1.8, 2.3); blob.add(x - 1.4, 8.8, z + 0.8, 0, 2.1, 1.6, 2.1); blob2.add(x - 0.3, 10, z + 0.2, 0, 1.9, 1.4, 1.9); }\n for (var tx = 56; tx < 96; tx += 11) streetTree(X(tx), Z(15.5));\n var dkT = { trunk: new Batch(), blob: new Inst(new T.SphereGeometry(1, 18, 12), mat.leaf, true), blob2: new Inst(new T.SphereGeometry(1, 18, 12), mat.leaf2, true) };\n (function () { var t0 = trunk, b0 = blob, b1 = blob2; trunk = dkT.trunk; blob = dkT.blob; blob2 = dkT.blob2; for (var ty = 34; ty < 78; ty += 11) streetTree(X(17.4), Z(ty)); trunk = t0; blob = b0; blob2 = b1; })();\n groups.dk = new T.Group(); groups.dk.add(dkT.trunk.mesh(mat.trunk, true), dkT.blob.mesh(), dkT.blob2.mesh()); env.add(groups.dk);\n for (var ty2 = 86; ty2 < 120; ty2 += 12) { streetTree(X(4), Z(ty2)); streetTree(X(17.4), Z(ty2)); }\n for (var tx2 = -128; tx2 < -4; tx2 += 16) { streetTree(X(tx2), Z(-21)); streetTree(X(tx2 + 8), Z(-30)); }\n TREES.forEach(function (t, i) {\n var x = X(t[0]), z = Z(t[1]), S = t[2] || 1;\n trunk.box(x, 1.4 * S, z, 0.6 * S, 2.8 * S, 0.6 * S, 0.3 * i);\n for (var k = 0; k < 5; k++) { var a = k * 1.26 + i, r = (1.6 + (k % 2)) * S; trunk.box(x + Math.cos(a) * r * 0.5, 3.2 * S, z + Math.sin(a) * r * 0.5, 0.3 * S, 1.8 * S, 0.3 * S, a); blob2.add(x + Math.cos(a) * r, (4.4 + (k % 3) * 0.4) * S, z + Math.sin(a) * r, a, 1.5 * S, 0.9 * S, 1.5 * S); flower.box(x + Math.cos(a) * r, (5.25 + (k % 3) * 0.4) * S, z + Math.sin(a) * r, 0.5 * S, 0.12 * S, 0.5 * S, a); }\n });\n env.add(trunk.mesh(mat.trunk, true), leaf.mesh(mat.leaf, true), flower.mesh(mat.flower), blob.mesh(), blob2.mesh());\n var umb = new Batch(), pot = new Batch(), iron = new Batch();\n for (var gx = 50; gx < 70; gx += 4) for (var gy = 46; gy < 61; gy += 4.5) { iron.box(X(gx), 0.75, Z(gy), 0.9, 0.05, 0.9); iron.box(X(gx), 0.38, Z(gy), 0.08, 0.75, 0.08); }\n var plant = new Batch();\n for (var ux = 25; ux < 88; ux += 3.6) { var tx0 = X(ux), tz0 = Z(19.4); umb.box(tx0, 2.55, tz0, 2.5, 0.08, 2.5, 0.785); umb.box(tx0, 2.68, tz0, 1.6, 0.14, 1.6, 0.785); umb.box(tx0, 2.84, tz0, 0.7, 0.16, 0.7, 0.785); iron.box(tx0, 1.3, tz0, 0.06, 2.6, 0.06);\n umb.box(tx0, 0.74, tz0, 0.95, 0.06, 0.95); umb.box(tx0, 0.5, tz0, 0.8, 0.42, 0.8);\n [[-0.95, 0], [0.95, 0], [0, -0.95], [0, 0.95]].forEach(function (d) { umb.box(tx0 + d[0], 0.24, tz0 + d[1], 0.42, 0.48, 0.42); umb.box(tx0 + d[0] * 1.24, 0.66, tz0 + d[1] * 1.24, d[0] ? 0.06 : 0.42, 0.6, d[1] ? 0.06 : 0.42); }); }\n for (var px = 23; px < 89; px += 3.45) { pot.box(X(px), 0.3, Z(21.2), 0.55, 0.6, 0.55); plant.box(X(px), 0.95, Z(21.2), 0.7, 0.75, 0.7, 0.4); }\n for (var py = 25; py < 70; py += 3.45) { pot.box(X(20.2), 0.3, Z(py), 0.55, 0.6, 0.55); plant.box(X(20.2), 0.95, Z(py), 0.7, 0.75, 0.7, 0.4); }\n env.add(umb.mesh(mat.umb, true), pot.mesh(mat.pot), iron.mesh(mat.iron), plant.mesh(mat.leaf, true));\n // Khối nhà xung quanh theo bản đồ thực tế: Nhà hát nằm ngay trước mặt dài của khách sạn, mặt chính quay ra trục Lê Lợi\n var plinth = new Batch();\n function ctxB(parts) {\n var b = new Batch(), bx = new T.Box3();\n parts.forEach(function (q) {\n var w = q[1] - q[0], d = q[3] - q[2], cx = (X(q[0]) + X(q[1])) / 2, cz = (Z(q[2]) + Z(q[3])) / 2;\n b.box(cx, q[4] / 2, cz, w, q[4], d);\n if (!q[5]) {\n b.box(cx, q[4] + 0.5, cz, w - 3, 1, d - 3); b.box(cx, q[4] + 0.2, cz, w + 0.9, 0.5, d + 0.9);\n var nf = Math.max(2, Math.round(q[4] / 3.9)), k;\n for (k = 1; k < nf; k++) b.box(cx, k * q[4] / nf, cz, w + 0.5, k === 1 ? 0.45 : 0.26, d + 0.5);\n var nx = Math.max(2, Math.round(w / 6.5)), nz = Math.max(2, Math.round(d / 6.5));\n for (k = 0; k <= nx; k++) { var px = cx - w / 2 + k * w / nx; b.box(px, q[4] / 2, cz - d / 2, 0.7, q[4], 0.5); b.box(px, q[4] / 2, cz + d / 2, 0.7, q[4], 0.5); }\n for (k = 0; k <= nz; k++) { var pz = cz - d / 2 + k * d / nz; b.box(cx - w / 2, q[4] / 2, pz, 0.5, q[4], 0.7); b.box(cx + w / 2, q[4] / 2, pz, 0.5, q[4], 0.7); }\n }\n bx.expandByPoint(new T.Vector3(cx - w / 2 - 2, -1, cz - d / 2 - 2)); bx.expandByPoint(new T.Vector3(cx + w / 2 + 2, q[4] + 16, cz + d / 2 + 2));\n plinth.box(cx, 0.22, cz, w, 0.3, d);\n });\n var m = mat.ghost.clone(), me = b.mesh(m); me.receiveShadow = false; env.add(me);\n var o = { m: m, meshes: [me], box: bx, f: 1, lbl: null, ly: 0 }; CTXB.push(o); return o;\n }\n var opera = ctxB([[47, 103, -38, -10, 15], [50, 100, -41, -7, 9], [42, 47, -34, -14, 13], [39.5, 42, -33, -15, 1.8, 1], [38, 39.5, -34, -14, 1.2, 1], [36.5, 38, -35, -13, 0.6, 1]]);\n (function () { var ob = new Batch(); [-32.5, -28, -20, -15.5].forEach(function (y) { ob.box(X(42.3), 6.5, Z(y), 1, 13, 1); }); ob.box(X(44.5), 14.2, Z(-24), 6, 2.4, 22); ob.box(X(75), 28.3, Z(-24), 50, 0.7, 1.4);\n var om = ob.mesh(opera.m); om.receiveShadow = false; env.add(om); opera.meshes.push(om); })();\n var dome = new T.Mesh(new T.CylinderGeometry(12.5, 12.5, 54, 28, 1, false, 0, Math.PI), opera.m); dome.rotation.set(0, 0, Math.PI / 2); dome.position.set(X(75), 15.6, Z(-24)); dome.receiveShadow = false; env.add(dome); opera.meshes.push(dome);\n var hyatt = ctxB([[96, 160, 13, 47, 34], [159, 179, 20, 68, 34]]);\n var union = ctxB([[-71, 0, 9, 117, 30]]);\n var carav = ctxB([[24, 113, -116, -79, 34], [58, 98, -114, -82, 72]]);\n [[[21, 114, 74, 119, 24]], [[116, 170, 71, 89, 18]], [[115, 164, 93, 109, 15]], [[59, 121, 149, 228, 48]], [[133, 175, 143, 170, 40]], [[201, 283, -43, -16, 28]], [[250, 277, 4, 55, 50]], [[201, 222, -86, -56, 16]], [[-31, 3, -73, -50, 24]]].forEach(ctxB);\n env.add(plinth.mesh(mat.walk));\n var mk = new Batch();\n function dashX(y, x0, x1) { for (var x = x0; x < x1; x += 7) mk.box(X(x + 1.5), 0.02, Z(y), 3, 0.03, 0.22); }\n function dashY(x, y0, y1) { for (var y = y0; y < y1; y += 7) mk.box(X(x), 0.02, Z(y + 1.5), 0.22, 0.03, 3); }\n dashY(11.8, -140, 6); dashY(11.8, 16, 122); dashX(9.5, 22, 90); dashX(-11.5, -140, 4); dashX(-40.5, -140, 4); dashX(128, -75, 186); dashY(191, -90, 123); dashX(-60.5, 20, 112); dashY(-78, -6, 124);\n for (var zx = 7.6; zx < 16.2; zx += 1.1) { mk.box(X(zx), 0.02, Z(10.5), 0.5, 0.03, 3.4); mk.box(X(zx), 0.02, Z(-4), 0.5, 0.03, 3.4); mk.box(X(zx), 0.02, Z(-45), 0.5, 0.03, 3.4); }\n for (var zy = 5.6; zy < 13.8; zy += 1.1) mk.box(X(24), 0.02, Z(zy), 3.4, 0.03, 0.5);\n for (var zy2 = -33; zy2 < -17; zy2 += 1.1) mk.box(X(5), 0.02, Z(zy2), 3.4, 0.03, 0.5);\n var mkm = mk.mesh(mat.mark); mkm.receiveShadow = true; env.add(mkm);\n MATG = mat.ghost;\n [['Đường Đồng Khởi', X(11.8), 1.6, Z(62), 2.2], ['Công trường Lam Sơn', X(52), 1.6, Z(9.5), 2.4], ['Đường Lê Lợi', X(-42), 1.6, Z(-25), 2.2], ['Park Hyatt', X(132), 39, Z(32), 2, hyatt], ['Nhà hát Thành phố', X(72), 32, Z(-24), 2.6, opera], ['Union Square', X(-30), 35, Z(60), 2, union], ['Caravelle', X(72), 77, Z(-98), 2, carav]].forEach(function (l) {\n var s = textSprite(l[0], l[4] * 0.62, { color: '#2b1811', halo: 'rgba(246,240,230,.9)', caps: true }); s.position.set(l[1], l[2], l[3]); env.add(s); streetL.push(s);\n if (l[5]) { l[5].lbl = s; l[5].ly = l[2]; }\n });\n [[-17.5, 6.2, 26.5], [-4, TOP + 5, 12], [9, 17.5, 21], [4, 4.5, -2], [-26.5, 6.5, 19]].forEach(function (q, i) {\n var c = document.createElement('canvas'); c.width = c.height = 128; var x = c.getContext('2d');\n x.fillStyle = '#e3b23c'; x.beginPath(); x.arc(64, 64, 58, 0, 7); x.fill(); x.strokeStyle = '#2b1811'; x.lineWidth = 4; x.stroke();\n x.fillStyle = '#2b1811'; x.font = '700 70px -apple-system,\"Segoe UI\",Roboto,Arial,sans-serif'; x.textAlign = 'center'; x.textBaseline = 'middle'; x.fillText(String(i + 1), 64, 68);\n var t = new T.CanvasTexture(c); t.colorSpace = T.SRGBColorSpace;\n var s = new T.Sprite(new T.SpriteMaterial({ map: t, depthTest: false, transparent: true, sizeAttenuation: false })); s.scale.setScalar(mobile ? 0.04 : 0.04); s.position.set(q[0], q[1], q[2]); s.renderOrder = 12; s.visible = false; scene.add(s); marks.push(s);\n });\n // Tô vàng phần đang được nói tới ở từng trạm (hộp trong suốt phủ lên mô hình trắng)\n var gold = new T.MeshBasicMaterial({ color: 0xe3b23c, transparent: true, opacity: 0.55, depthWrite: false, fog: false, polygonOffset: true, polygonOffsetFactor: -2, polygonOffsetUnits: -2 });\n [[21.4, 89.6, 17.6, 21.6, 0.05, 4.3], null, [21.5, 89.5, 22.5, 30.8, BASE[3] + 0.2, 1.1], [46.5, 72.5, 43, 62, 0.06, 0.25], [21.4, 36.8, 22.5, 33.8, 0.3, 1.3]].forEach(function (q) {\n if (!q) { hls.push(null); return; }\n var m = new T.Mesh(new T.BoxGeometry(q[1] - q[0], q[5], q[3] - q[2]), gold); m.position.set((X(q[0]) + X(q[1])) / 2, q[4] + q[5] / 2, (Z(q[2]) + Z(q[3])) / 2); m.renderOrder = 6; m.visible = false; scene.add(m); hls.push(m);\n });\n [[29, 'Nhà hàng'], [44.5, 'Sảnh chính'], [77, 'Cửa hàng']].forEach(function (l) { var s = textSprite(l[1], mobile ? 1.5 : 1.15, LBL); s.position.set(X(l[0]), mobile ? 6.5 : 4.6, Z(18.4)); s.visible = false; scene.add(s); facLabels.push(s); });\n // Người, đèn đường, xe: cho mô hình có tỉ lệ\n var pm = M(0x8c857a, { roughness: 1 }), lamp = new Batch(), ppl = new Inst(new T.CapsuleGeometry(0.2, 0.72, 4, 12), pm, true), pph = new Inst(new T.SphereGeometry(0.17, 14, 10), pm, true);\n function person(x, z, r) { var k = 0.92 + (r % 1) * 0.14; ppl.add(x, 0.56 * k, z, r, 1, k, 1); pph.add(x, 1.3 * k, z, r, 1, 1, 1); }\n [[26, 16.6], [26.7, 16.9], [34, 15.8], [41, 17], [47.5, 16.2], [48.2, 16.5], [56, 15.6], [63, 17], [70, 16], [70.6, 16.4], [79, 15.7], [86, 16.8], [44, 20.4], [45.2, 20.8], [31, 20.5]].forEach(function (q, i) { person(X(q[0]), Z(q[1]), i * 1.3); });\n [[19.2, 27], [18.6, 35], [19.2, 35.6], [18.4, 46], [19.1, 55], [18.7, 63], [19.3, 63.5]].forEach(function (q, i) { person(X(q[0]), Z(q[1]), i * 0.9 + 0.4); });\n function lampAt(x, z) { lamp.box(x, 2.4, z, 0.14, 4.8, 0.14); lamp.box(x, 0.3, z, 0.34, 0.6, 0.34); lamp.box(x, 4.95, z, 0.5, 0.5, 0.5); lamp.box(x, 5.28, z, 0.3, 0.16, 0.3); }\n for (var lx = 24; lx < 92; lx += 13) lampAt(X(lx), Z(14.6)); for (var ly = 30; ly < 74; ly += 13) lampAt(X(16.9), Z(ly));\n env.add(ppl.mesh(), pph.mesh(), lamp.mesh(mat.iron, true));\n groups.env = env; scene.add(env);\n\n // Vỏ ngoài từng tầng: mặt tiền dựng theo ảnh hiện trạng\n var archG = archShape(1.3, 2.7), archS = archShape(1.75, 3.15), rectG = new T.PlaneGeometry(1, 1), unitBox = new T.BoxGeometry(1, 1, 1);\n rectG.translate(0, 0.5, 0);\n function floorGroup(f) {\n var mat = clipSet(f);\n var g = new T.Group(), shell = new Batch(), trim = new Batch(), base = new Batch(), ironB = new Batch();\n var glassI = new Inst(archG, mat.glass), surI = new Inst(archS, mat.trim), rectI = new Inst(rectG, f === 0 ? mat.glassWarm : mat.glass), rectS = new Inst(rectG, mat.trim), post = new Inst(unitBox, mat.trim);\n var y0 = BASE[f], h = HGT[f];\n FP[f].forEach(function (r) { rectBox(f === 0 ? base : shell, r, y0, h); });\n (f === 0 ? EDGES_G : EDGES_F[f]).forEach(function (e) {\n var x1 = X(e[0]), z1 = Z(e[1]), x2 = X(e[2]), z2 = Z(e[3]), nx = e[4], nz = -e[5], type = e[6];\n var L = Math.hypot(x2 - x1, z2 - z1), dx = (x2 - x1) / L, dz = (z2 - z1) / L, ry = Math.atan2(nx, nz);\n var n = Math.max(1, Math.round(L / 3.45)), s = L / n, ax = Math.abs(dx), az = Math.abs(dz), anx = Math.abs(nx), anz = Math.abs(nz);\n function at(t, out) { return [x1 + dx * t + nx * out, z1 + dz * t + nz * out]; }\n var cH = f === 0 ? 0.6 : 0.28, cO = f === 0 ? 0.5 : 0.3, m = at(L / 2, cO / 2);\n if (type !== 'blind' || f === 0) trim.box(m[0], y0 + h - cH / 2, m[1], ax * (L + 2 * cO) + anx * cO, cH, az * (L + 2 * cO) + anz * cO);\n if (type === 'street' && f === 0) { var cn = at(L / 2, 1.6); trim.box(cn[0], 4.35, cn[1], ax * L + anx * 3.2, 0.18, az * L + anz * 3.2); }\n if (type === 'blind') return;\n if (type === 'street') { [0.3, L - 0.3].forEach(function (tt) { var ep = at(tt, 0.17); (f === 0 ? base : trim).box(ep[0], y0 + h / 2, ep[1], ax * 0.85 + anx * 0.34, h, az * 0.85 + anz * 0.34); }); if (f === 0) { var fs2 = at(L / 2, 3.2); trim.box(fs2[0], 4.16, fs2[1], ax * L + anx * 0.08, 0.38, az * L + anz * 0.08); } }\n for (var i = 0; i < n; i++) {\n var t = s * (i + 0.5), p = at(t, 0.04), q;\n if (type === 'street' && f > 0) {\n surI.add(p[0], y0 + 0.55, p[1], ry); q = at(t, 0.07); glassI.add(q[0], y0 + 0.75, q[1], ry);\n var mq = at(t, 0.1); trim.box(mq[0], y0 + 1.78, mq[1], ax * 0.07 + anx * 0.06, 2.05, az * 0.07 + anz * 0.06); trim.box(mq[0], y0 + 2.8, mq[1], ax * 1.3 + anx * 0.06, 0.08, az * 1.3 + anz * 0.06); trim.box(mq[0], y0 + 1.8, mq[1], ax * 1.3 + anx * 0.06, 0.05, az * 1.3 + anz * 0.06);\n var sl = at(t, 0.14); trim.box(sl[0], y0 + 0.7, sl[1], ax * 1.9 + anx * 0.3, 0.1, az * 1.9 + anz * 0.3); var ky = at(t, 0.12); trim.box(ky[0], y0 + 3.62, ky[1], ax * 0.3 + anx * 0.2, 0.36, az * 0.3 + anz * 0.2);\n var full = f === 3 || i < 2 || i >= n - 2, bw = full ? s : 2.1;\n if (full || i % 2 === 0 || f === 1) {\n var bp = at(t, 0.45); trim.box(bp[0], y0 + 0.62, bp[1], ax * bw + anx * 0.9, 0.14, az * bw + anz * 0.9);\n var rp = at(t, 0.86); trim.box(rp[0], y0 + 1.62, rp[1], ax * bw + anx * 0.08, 0.08, az * bw + anz * 0.08); trim.box(rp[0], y0 + 0.82, rp[1], ax * bw + anx * 0.06, 0.05, az * bw + anz * 0.06);\n var nb = full ? 14 : 9; for (var k = 0; k <= nb; k++) { var pp = at(t + (k / nb - 0.5) * bw, 0.86); post.add(pp[0], y0 + 1.2, pp[1], 0, k % (nb / (full ? 2 : 1) | 0 || 1) === 0 ? 0.1 : 0.035, 0.8, k % (nb / (full ? 2 : 1) | 0 || 1) === 0 ? 0.1 : 0.035); }\n [-0.4, 0.4].forEach(function (u) { var bk = at(t + u * bw, 0.3); trim.box(bk[0], y0 + 0.38, bk[1], ax * 0.14 + anx * 0.5, 0.36, az * 0.14 + anz * 0.5); });\n }\n } else if (type === 'street') {\n rectS.add(p[0], 0.25, p[1], ry, 2.9, 3.95, 1); q = at(t, 0.07); rectI.add(q[0], 0.45, q[1], ry, 2.3, 3.5, 1);\n } else {\n var w = f === 0 ? 1.6 : 1.1, hh = f === 0 ? 2.6 : 2.0, sy = f === 0 ? 0.6 : 0.9;\n rectS.add(p[0], y0 + sy - 0.15, p[1], ry, w + 0.4, hh + 0.3, 1); q = at(t, 0.07); rectI.add(q[0], y0 + sy, q[1], ry, w, hh, 1);\n }\n if (type === 'street' && i > 0) { var pl = at(i * s, 0.12); (f === 0 ? base : trim).box(pl[0], y0 + h / 2, pl[1], ax * 0.55 + anx * 0.24, h, az * 0.55 + anz * 0.24); }\n }\n });\n if (shell.p.length) { var c1 = shell.mesh(mat.wall, true); cores.push(c1); g.add(c1); }\n if (base.p.length) { var c2 = base.mesh(mat.base, true); cores.push(c2); g.add(c2); }\n g.add(trim.mesh(mat.trim, true)); if (ironB.p.length) g.add(ironB.mesh(mat.iron));\n [glassI, surI, rectI, rectS, post].forEach(function (I) { if (I.m.length) g.add(I.mesh()); });\n if (f === 0) {\n [[X(44), Z(22) + 0.62, 0, 15], [X(21) - 0.62, Z(36), -Math.PI / 2, 9]].forEach(function (sg) {\n var t = textCanvas('HOTEL CONTINENTAL SAIGON', { color: '#b8902f', font: 'Georgia,Times New Roman,serif' });\n var pl = new T.Mesh(new T.PlaneGeometry(sg[3], sg[3] / t.ratio), new T.MeshBasicMaterial({ map: t.tex, transparent: true }));\n pl.material.clippingPlanes = [planes[0]]; pl.position.set(sg[0], 4.78, sg[1]); pl.rotation.y = sg[2]; g.add(pl);\n });\n }\n return g;\n }\n for (var f = 0; f < 4; f++) { groups['shell' + f] = floorGroup(f); scene.add(groups['shell' + f]); }\n\n var rmat = clipSet(3);\n // Mái: sàn mái, lan can, mái ngói, hồ bơi trên khối phụ\n var roof = new T.Group(), rs = new Batch(), rt = new Batch(), rp = new Batch(), bal = new Inst(unitBox, rmat.trim), wat = new Batch();\n FP[3].forEach(function (r) { rectBox(rs, r, TOP, 0.35); });\n function parapet(B, I, e, y, balus) {\n var x1 = X(e[0]), z1 = Z(e[1]), x2 = X(e[2]), z2 = Z(e[3]), nx = e[4], nz = -e[5], L = Math.hypot(x2 - x1, z2 - z1), dx = (x2 - x1) / L, dz = (z2 - z1) / L, ax = Math.abs(dx), az = Math.abs(dz), anx = Math.abs(nx), anz = Math.abs(nz);\n B.box(x1 + dx * L / 2 + nx * 0.35, y + 0.3, z1 + dz * L / 2 + nz * 0.35, ax * (L + 1.4) + anx * 0.7, 0.6, az * (L + 1.4) + anz * 0.7);\n if (!balus) return;\n B.box(x1 + dx * L / 2, y + 1.5, z1 + dz * L / 2, ax * L + anx * 0.35, 0.16, az * L + anz * 0.35);\n B.box(x1 + dx * L / 2, y + 0.7, z1 + dz * L / 2, ax * L + anx * 0.4, 0.2, az * L + anz * 0.4);\n for (var t = 0.2; t < L; t += 0.32) I.add(x1 + dx * t, y + 1.1, z1 + dz * t, 0, 0.12, 0.65, 0.12);\n }\n [[21, 22, 90, 22, 0, -1], [21, 22, 21, 34, -1, 0], [90, 22, 90, 34, 1, 0], [21, 34, 90, 34, 0, 1]].forEach(function (e) { parapet(rp, bal, e, TOP, false); });\n hipRoof(rt, [22, 89, 23, 33], TOP + 0.35, 3.0);\n roof.add(rs.mesh(rmat.slab, true), rt.mesh(rmat.tile, true), rp.mesh(rmat.trim, true));\n groups.roof = roof; scene.add(roof);\n // Mái thấp: cánh Đồng Khởi và cánh sau (trên lầu 2), sân cảnh lầu 2 (trên lầu 1)\n [[2, [[21, 62, 34, 42], [21, 46.5, 42, 72], [46.5, 90, 62, 72]], BASE[3]], [1, [[62, 90, 34, 42]], BASE[2]]].forEach(function (q) {\n var lm = clipSet(q[0]), g2 = new T.Group(), s2 = new Batch(), t2 = new Batch(), p2 = new Batch(), b2 = new Inst(unitBox, lm.trim);\n q[1].forEach(function (r) { rectBox(s2, r, q[2], 0.35); });\n if (q[0] === 2) {\n parapet(p2, b2, [21, 34, 21, 72, -1, 0], q[2], true); parapet(p2, b2, [46.5, 42, 46.5, 62, 1, 0], q[2], false); parapet(p2, b2, [46.5, 62, 90, 62, 0, -1], q[2], false); parapet(p2, b2, [90, 62, 90, 72, 1, 0], q[2], false); parapet(p2, b2, [21, 72, 90, 72, 0, 1], q[2], false); parapet(p2, b2, [46.5, 42, 62, 42, 0, 1], q[2], false);\n hipRoof(t2, [24.5, 43.5, 38.5, 70.5], q[2] + 0.35, 2.2); hipRoof(t2, [48, 88.5, 63.2, 71], q[2] + 0.35, 1.5);\n } else { parapet(p2, b2, [62, 42, 90, 42, 0, 1], q[2], true); parapet(p2, b2, [90, 34, 90, 42, 1, 0], q[2], true); }\n g2.add(s2.mesh(lm.slab, true), p2.mesh(lm.trim, true)); if (t2.p.length) g2.add(t2.mesh(lm.tile, true)); if (b2.m.length) g2.add(b2.mesh());\n groups['low' + q[0]] = g2; scene.add(g2);\n });\n var annex = new T.Group(), ar = new Batch(); rectBox(ar, GROUND[3], 5.4, 0.3); rectBox(wat, [75, 88, 46, 59], 5.7, 0.12);\n annex.add(ar.mesh(mat.slab, true), wat.mesh(mat.water)); groups.annex = annex; scene.add(annex);\n\n // Lát cắt: mỗi tầng hiện sàn, tường ngăn, cửa và nội thất từng phòng (cắt ngang tường ở độ cao ~1,5 m)\n var cm = { wall: M(0xf3ead8, { map: tPlaster, roughness: 0.92 }), wood: M(0x7a4e30, { map: tPlank, roughness: 0.38 }), linen: M(0xfbf7ee, { roughness: 1 }), tile: M(0xe4e0d4, { map: tMen, roughness: 0.22 }), fab: M(0x7d2f2a, { roughness: 1 }), fab2: M(0x5d6b4a, { roughness: 1 }), steel: M(0xc4c7c6, { roughness: 0.28, metalness: 0.9 }), rattan: M(0xc7a36c, { roughness: 0.8 }) };\n function pbox(b, x0, x1, y0, y1, yb, h) { b.box((X(x0) + X(x1)) / 2, yb + h / 2, (Z(y0) + Z(y1)) / 2, Math.abs(x1 - x0), h, Math.abs(y1 - y0)); }\n function frame(r, side) {\n var x0 = r[0], x1 = r[1], y0 = r[2], y1 = r[3], hor = side === 'y1' || side === 'y0';\n return { w: hor ? x1 - x0 : y1 - y0, d: hor ? y1 - y0 : x1 - x0, P: function (u, v) { return side === 'y1' ? [x0 + u, y1 - v] : side === 'y0' ? [x0 + u, y0 + v] : side === 'x1' ? [x1 - v, y0 + u] : [x0 + v, y0 + u]; } };\n }\n function lb(b, F, u0, u1, v0, v1, yb, h) { var p = F.P(u0, v0), q = F.P(u1, v1); pbox(b, Math.min(p[0], q[0]), Math.max(p[0], q[0]), Math.min(p[1], q[1]), Math.max(p[1], q[1]), yb, h); }\n function hits(r, q) { return r[0] < q[1] && r[1] > q[0] && r[2] < q[3] && r[3] > q[2]; }\n // Một phòng ngủ: tường phía hành lang có cửa, phòng tắm, giường, tủ, bàn viết, ghế bên cửa sổ\n function room(S, r, side, yb, wh, inner) {\n var F = frame(r, side), w = F.w, d = F.d, t = 0.2;\n lb(S.wall, F, 0, w - 1.5, 0, t, yb, wh); lb(S.wall, F, w - 0.45, w, 0, t, yb, wh);\n lb(S.wood, F, w - 1.5, w - 1.42, t, t + 1.0, yb, wh - 0.1);\n lb(S.wall, F, 0, t, 0, d, yb, wh);\n if (inner) lb(S.wall, F, 0, w, d - 0.2, d, yb, 0.95);\n lb(S.tile, F, t, 2.1, t, 2.5, yb, 0.05);\n lb(S.wall, F, t, 2.24, 2.5, 2.64, yb, wh); lb(S.wall, F, 2.1, 2.24, t, 1.5, yb, wh);\n lb(S.linen, F, t + 0.1, t + 0.85, t + 0.1, 2.3, yb, 0.55); lb(S.linen, F, 1.25, 1.95, t + 0.1, t + 0.6, yb + 0.55, 0.2); lb(S.wood, F, 1.25, 1.95, t + 0.1, t + 0.6, yb, 0.55);\n lb(S.wood, F, 2.3, 2.85, t, t + 1.3, yb, wh - 0.1);\n var bv = 2.9 + (d - 2.9) * 0.42;\n lb(S.wood, F, t, t + 0.12, bv - 1.0, bv + 1.0, yb, 1.15); lb(S.wood, F, t + 0.12, t + 2.2, bv - 0.9, bv + 0.9, yb, 0.35);\n lb(S.linen, F, t + 0.12, t + 2.2, bv - 0.88, bv + 0.88, yb + 0.35, 0.22);\n lb(S.linen, F, t + 0.2, t + 0.65, bv - 0.75, bv - 0.1, yb + 0.57, 0.14); lb(S.linen, F, t + 0.2, t + 0.65, bv + 0.1, bv + 0.75, yb + 0.57, 0.14);\n lb(S.fab, F, t + 1.55, t + 2.0, bv - 0.89, bv + 0.89, yb + 0.57, 0.03);\n lb(S.wood, F, t, t + 0.45, bv - 1.5, bv - 1.05, yb, 0.5); lb(S.wood, F, t, t + 0.45, bv + 1.05, bv + 1.5, yb, 0.5);\n lb(S.wood, F, w - 0.65, w - 0.05, bv - 0.7, bv + 0.7, yb, 0.75); lb(S.fab2, F, w - 1.2, w - 0.8, bv - 0.22, bv + 0.22, yb, 0.45);\n if (d > 7.5) { lb(S.rattan, F, w / 2 - 1.1, w / 2 - 0.4, d - 1.6, d - 0.9, yb, 0.5); lb(S.rattan, F, w / 2 + 0.4, w / 2 + 1.1, d - 1.6, d - 0.9, yb, 0.5); lb(S.wood, F, w / 2 - 0.25, w / 2 + 0.25, d - 1.5, d - 1.0, yb, 0.45); }\n }\n function upperRooms() {\n var R = [[21, 29.5, 22, 32.5, 'pho', 'x1']], i, n, st;\n for (n = 13, st = 60.5 / n, i = 0; i < n; i++) R.push([29.5 + i * st, 29.5 + (i + 1) * st, 22, 30.5, 'pho', 'y1']);\n for (n = 8, st = 39.5 / n, i = 0; i < n; i++) R.push([21, 29.5, 32.5 + i * st, 32.5 + (i + 1) * st, 'pho', 'x1']);\n for (n = 10, st = 43.5 / n, i = 0; i < n; i++) R.push([46.5 + i * st, 46.5 + (i + 1) * st, 32.5, 42, 'vuon', 'y0']);\n for (n = 8, st = 39.5 / n, i = 0; i < n; i++) R.push([31.5, 40.5, 32.5 + i * st, 32.5 + (i + 1) * st, 'vuon', 'x0', 1]);\n for (n = 10, st = 43.5 / n, i = 0; i < n; i++) R.push([46.5 + i * st, 46.5 + (i + 1) * st, 64, 72, 'sau', 'y0']);\n return R;\n }\n var HALLS = [[29.5, 90, 30.5, 32.5], [29.5, 31.5, 32.5, 72], [46.5, 90, 62, 64], [40.5, 46.5, 32.5, 62]];\n var cyl = new T.CylinderGeometry(1, 1, 1, 20);\n function tables(S, I, z, sp, rad, yb) {\n for (var x = z[0] + sp * 0.6; x < z[1] - sp * 0.4; x += sp) for (var y = z[2] + sp * 0.6; y < z[3] - sp * 0.4; y += sp) {\n if (CORES.some(function (q) { return hits([x - 1.5, x + 1.5, y - 1.5, y + 1.5], q); })) continue;\n I.add(X(x), yb + 0.4, Z(y), 0, rad, 0.8, rad);\n for (var k = 0; k < 4; k++) { var a = k * Math.PI / 2 + 0.4; S.rattan.box(X(x) + Math.cos(a) * (rad + 0.42), yb + 0.25, Z(y) + Math.sin(a) * (rad + 0.42), 0.46, 0.5, 0.46, -a); }\n }\n }\n function extWalls(S, edges, yb, wh) {\n edges.forEach(function (e) {\n var hor = e[1] === e[3], a = hor ? Math.min(e[0], e[2]) : Math.min(e[1], e[3]), b2 = hor ? Math.max(e[0], e[2]) : Math.max(e[1], e[3]), o = -0.2 * (hor ? e[5] : e[4]), c0 = (hor ? e[1] : e[0]) + o, full = e[6] === 'blind';\n function seg(u0, u1, h) { if (hor) pbox(S.wall, u0, u1, c0 - 0.2, c0 + 0.2, yb, h); else pbox(S.wall, c0 - 0.2, c0 + 0.2, u0, u1, yb, h); }\n seg(a, b2, full ? wh : 0.95); if (full) return;\n var n = Math.max(1, Math.round((b2 - a) / 3.45)), st = (b2 - a) / n;\n for (var i = 0; i <= n; i++) seg(Math.max(a, a + i * st - 0.35), Math.min(b2, a + i * st + 0.35), wh);\n });\n }\n var UR = upperRooms().filter(function (r) { return !CORES.some(function (q) { return hits(r, q); }); });\n for (var c = 0; c < 4; c++) {\n var cg = new T.Group(), slab = new Batch(), byKind = {}, wh = c === 0 ? 1.9 : 1.5, yb = BASE[c] + 0.12, S = {};\n Object.keys(cm).forEach(function (k) { S[k] = new Batch(); });\n var tabI = new Inst(cyl, cm.linen, true);\n function tint(z, k) { var b = byKind[k] || (byKind[k] = new Batch()); pbox(b, z[0], z[1], z[2], z[3], yb - 0.02, 0.06); }\n FP[c].forEach(function (r) { rectBox(slab, r, BASE[c] - 0.02, 0.14); });\n if (c > 0) {\n FP[c].forEach(function (r) { tint(r, 'hl'); });\n UR.forEach(function (r) { if (!inFP(c, (r[0] + r[1]) / 2, (r[2] + r[3]) / 2)) return; pbox(byKind[r[4]] || (byKind[r[4]] = new Batch()), r[0], r[1], r[2], r[3], yb, 0.06); room(S, r, r[5], yb + 0.04, wh, r[6]); });\n if (c < 3) for (var vy = 35; vy < 61; vy += 6.5) { S.rattan.box(X(44.6), yb + 0.3, Z(vy), 0.6, 0.55, 0.6); S.rattan.box(X(44.6), yb + 0.3, Z(vy + 1.6), 0.6, 0.55, 0.6); S.wood.box(X(44.6), yb + 0.25, Z(vy + 0.8), 0.45, 0.45, 0.45); }\n extWalls(S, EDGES_F[c], yb, wh);\n } else {\n ZONES0.forEach(function (z) {\n tint(z, z[4]);\n if (z[0] !== 21) pbox(S.wall, z[0] - 0.11, z[0] + 0.11, z[2], z[3], yb, wh);\n if (z[2] !== 22) pbox(S.wall, z[0], z[1], z[2] - 0.11, z[2] + 0.11, yb, wh);\n });\n tables(S, tabI, ZONES0[0], 3.1, 0.6, yb); tables(S, tabI, ZONES0[5], 3.7, 0.85, yb);\n // Sảnh: thảm, quầy lễ tân, ghế chờ, cột\n pbox(S.fab, 40, 49.5, 25, 32.5, yb + 0.03, 0.03); pbox(S.wood, 39.5, 47, 34.3, 35.2, yb, 1.1); pbox(S.wood, 39.5, 47, 35.3, 35.75, yb, 1.75);\n [[41.5, 27], [41.5, 30.5], [47.5, 27], [47.5, 30.5]].forEach(function (q) { pbox(S.fab2, q[0] - 1, q[0] + 1, q[1] - 0.45, q[1] + 0.45, yb, 0.5); });\n pbox(S.wood, 44, 45, 28.3, 29.2, yb, 0.42);\n [[38.5, 24], [38.5, 33], [50.5, 24], [50.5, 33]].forEach(function (q) { pbox(S.wall, q[0] - 0.3, q[0] + 0.3, q[1] - 0.3, q[1] + 0.3, yb, wh); });\n // Văn phòng: các dãy bàn\n [[52, 64, 22, 36], [52, 90, 36, 43]].forEach(function (z) { for (var x = z[0] + 2; x < z[1] - 1.5; x += 3.2) for (var y = z[2] + 2; y < z[3] - 1.2; y += 3) { if (CORES.some(function (q) { return hits([x - 1.2, x + 1.2, y - 1, y + 1.4], q); })) continue; pbox(S.wood, x - 0.8, x + 0.8, y - 0.4, y + 0.4, yb, 0.75); pbox(S.fab2, x - 0.22, x + 0.22, y + 0.55, y + 1.0, yb, 0.45); } });\n // Cửa hàng: chia gian, quầy và kệ\n for (var sx = 64; sx < 89.9; sx += 5.2) { if (sx > 64) pbox(S.wall, sx - 0.1, sx + 0.1, 22.4, 36, yb, wh); pbox(S.wood, sx + 0.8, sx + 4.4, 33.6, 34.4, yb, 0.95); pbox(S.wood, sx + 0.25, sx + 0.7, 24, 32, yb, 1.7); pbox(S.linen, sx + 2, sx + 3.6, 26, 29.5, yb, 0.8); }\n for (var sy = 58; sy < 71.9; sy += 4.67) { if (sy > 58) pbox(S.wall, 21.4, 40, sy - 0.1, sy + 0.1, yb, wh); pbox(S.wood, 36.5, 37.3, sy + 0.7, sy + 4, yb, 0.95); pbox(S.wood, 24, 34, sy + 0.25, sy + 0.7, yb, 1.7); pbox(S.linen, 26, 31, sy + 1.9, sy + 3.3, yb, 0.8); }\n // Bếp, kho: dãy bàn inox\n for (var ky = 38; ky < 60; ky += 3.4) pbox(S.steel, 41.2, 45.6, ky, ky + 0.9, yb, 0.9);\n for (var kx = 43; kx < 88; kx += 5.5) { pbox(S.steel, kx, kx + 3.8, 64.2, 65.1, yb, 0.9); pbox(S.steel, kx, kx + 3.8, 67.6, 68.5, yb, 0.9); pbox(S.wood, kx, kx + 3.8, 70.9, 71.6, yb, 1.7); }\n // Spa: các phòng trị liệu\n for (var py2 = 43; py2 < 61.9; py2 += 4.75) { if (py2 > 43) pbox(S.wall, 72.5, 84, py2 - 0.1, py2 + 0.1, yb, wh); pbox(S.wood, 75, 77, py2 + 1.6, py2 + 3.1, yb, 0.5); pbox(S.linen, 75, 77, py2 + 1.65, py2 + 3.05, yb + 0.5, 0.15); pbox(S.wood, 79.5, 81.5, py2 + 1.6, py2 + 3.1, yb, 0.5); pbox(S.linen, 79.5, 81.5, py2 + 1.65, py2 + 3.05, yb + 0.5, 0.15); }\n pbox(S.wall, 83.9, 84.1, 43, 62, yb, wh);\n extWalls(S, EDGES_G, yb, wh);\n }\n CORES.forEach(function (r) {\n pbox(S.wood, r[0], r[1], r[2], r[3], yb, wh + 0.5);\n for (var k = 0; k < 6; k++) pbox(S.wall, r[1] + 0.1, r[1] + 1.5, r[2] + k * 0.6, r[2] + (k + 1) * 0.6, yb, 0.2 + k * 0.22);\n });\n cg.add(slab.mesh(mat.cutSlab));\n Object.keys(byKind).forEach(function (k) { if (k !== 'core') cg.add(byKind[k].mesh(kmat[k])); });\n Object.keys(S).forEach(function (k) { if (S[k].p.length) cg.add(S[k].mesh(cm[k], true)); });\n if (tabI.m.length) cg.add(tabI.mesh());\n (c === 0 ? LABELS0 : LABELS_UP).forEach(function (l) {\n if (c > 0 && l[2] !== 'Sân vườn' && !inFP(c, l[0], l[1])) return;\n var sp = textSprite(l[2], mobile ? 1.5 : 1.05, LBL);\n sp.position.set(X(l[0]), BASE[c] + 0.9, Z(l[1])); cg.add(sp); cutLabels.push(sp);\n });\n var lift = textSprite('Thang máy, cầu thang', mobile ? 1.5 : 1.05, LBL);\n lift.position.set(X(53.7), BASE[c] + wh + 0.4, Z(37)); cg.add(lift); cutLabels.push(lift);\n cg.visible = false; groups['cut' + c] = cg; scene.add(cg);\n }\n secPlane = new T.Plane(new T.Vector3(1, 0, 0), 1e4); var done2 = [];\n ['shell0', 'shell1', 'shell2', 'shell3', 'cut0', 'cut1', 'cut2', 'cut3', 'roof', 'low1', 'low2', 'annex'].forEach(function (gk) {\n groups[gk].traverse(function (o) {\n if (!o.isMesh || !o.material) return; var m = o.material, i = done2.indexOf(m);\n if (i < 0) { done2.push(m); if (!m.clippingPlanes || !m.clippingPlanes.length) { m = o.material = m.clone(); done2.push(m); } m.clippingPlanes = (m.clippingPlanes || []).concat([secPlane]); m.clipShadows = true; }\n });\n });\n // Lát nhà dày 7 m dựng riêng cho mặt cắt dọc: sàn, tường, cửa, nội thất từng tầng\n var sg = new T.Group(), sw = new Batch(), sp2 = new Batch(), sf = new Batch(), sd = new Batch(), x0 = SECX + 55.5, x1 = x0 + 7, PO = 0.08;\n function wallY(y, yb, h, open) { // tường chạy theo chiều sâu lát cắt, có thể trổ 2 ô cửa\n if (!open) { pbox(sw, x0, x1, y - 0.22, y + 0.22, yb, h); } else { [[x0, x0 + 1.1], [x0 + 2.9, x0 + 4.1], [x0 + 5.9, x1]].forEach(function (s) { pbox(sw, s[0], s[1], y - 0.22, y + 0.22, yb, h); }); pbox(sw, x0, x1, y - 0.22, y + 0.22, yb, open[0]); pbox(sw, x0, x1, y - 0.22, y + 0.22, yb + open[1], h - open[1]); }\n pbox(sp2, x0 - PO, x0, y - 0.22, y + 0.22, yb, h);\n }\n function slabY(y0, y1, yb, t) { pbox(sw, x0, x1, y0, y1, yb, t); pbox(sp2, x0 - PO, x0, y0, y1, yb, t); }\n function bed(y, yb, w) { pbox(sf, x0 + 1.4, x0 + 3.4, y, y + w, yb, 0.5); pbox(sd, x0 + 1.4, x0 + 3.4, y, y + 0.12, yb, 1.15); pbox(sf, x0 + 1.5, x0 + 2.1, y + 0.25, y + w - 0.25, yb + 0.5, 0.14); }\n function fig2(x, y, yb) { pbox(sd, x - 0.17, x + 0.17, y - 0.12, y + 0.12, yb, 0.9); pbox(sd, x - 0.22, x + 0.22, y - 0.13, y + 0.13, yb + 0.9, 0.62); pbox(sd, x - 0.11, x + 0.11, y - 0.11, y + 0.11, yb + 1.54, 0.24); }\n [[22, 42], [62, 72]].forEach(function (w, wi) {\n for (var f = 0; f < (wi === 0 ? 4 : 3); f++) {\n var yb = BASE[f], h = HGT[f], we = wi === 0 && f > 1 ? 34 : w[1]; slabY(w[0], f === 3 ? 34 : w[1], yb - 0.3, 0.3);\n wallY(w[0], yb, h, wi === 0 ? (f === 0 ? [0.3, 3.9] : [0.9, 3.3]) : (f === 0 ? null : [0.9, 3.0])); wallY(we, yb, h, wi === 0 ? [0.9, 3.0] : null);\n pbox(sw, x1 - 0.25, x1, w[0], we, yb, h);\n if (wi === 0 && f > 0) { wallY(30.2, yb, h, [0, 2.2]); bed(23.2, yb, 1.7); bed(26, yb, 1.7); pbox(sd, x0 + 4.6, x0 + 5.6, 28.6, 29.4, yb, 0.78); if (f === 1) { wallY(33.2, yb, h, [0, 2.2]); bed(34.2, yb, 1.7); bed(37, yb, 1.7); pbox(sd, x0 + 4.6, x0 + 5.6, 40, 40.8, yb, 0.78); } if (f === 2) { fig2(x0 + 4.4, 31.7, yb); pbox(sw, x0, x1, 41.8, 42, yb, 1.0); pbox(sf, x0 + 2.4, x0 + 3.4, 37.4, 38.4, yb, 0.76); fig2(x0 + 4.2, 38, yb); }\n pbox(sw, x0, x1, 21.1, 22, yb + 0.5, 0.14); pbox(sw, x0, x1, 21.1, 21.18, yb + 0.64, 0.95); pbox(sp2, x0 - PO, x0, 21.1, 22, yb + 0.5, 0.14); }\n if (wi === 0 && f === 0) { wallY(36, yb, h, [0, 2.6]); [24.5, 27.5, 30.5, 33].forEach(function (ty, i) { pbox(sf, x0 + 1.6 + (i % 2) * 2.4, x0 + 2.6 + (i % 2) * 2.4, ty, ty + 1, yb, 0.76); pbox(sd, x0 + 0.9 + (i % 2) * 2.4, x0 + 1.3 + (i % 2) * 2.4, ty + 0.3, ty + 0.7, yb, 0.46); }); pbox(sd, x0 + 2, x0 + 5, 38.5, 39.3, yb, 1.05); fig2(x0 + 3.2, 40.2, yb); fig2(x0 + 4.5, 29.2, yb); }\n if (wi === 1 && f > 0) { wallY(64.6, yb, h, [0, 2.2]); bed(66, yb, 1.7); bed(68.8, yb, 1.7); }\n if (wi === 1 && f === 0) { pbox(sd, x0 + 1.5, x0 + 5, 66, 67, yb, 0.9); pbox(sd, x0 + 1.5, x0 + 2.5, 69.5, 71, yb, 1.9); }\n }\n if (wi === 0) slabY(22, 34, TOP - 0.05, 0.4); else slabY(w[0], w[1], BASE[3] - 0.05, 0.4);\n });\n pbox(sw, x0, x1, 17.6, 22, 4.3, 0.16); pbox(sp2, x0 - PO, x0, 17.6, 22, 4.3, 0.16); pbox(sf, x0 + 2.5, x0 + 3.5, 19.2, 20.2, 0, 0.76); fig2(x0 + 1.8, 19.7, 0); fig2(x0 + 4.4, 18.6, 0);\n [[x0 + 2, 47], [x0 + 5, 52], [x0 + 2.4, 57]].forEach(function (g) { pbox(sf, g[0] - 0.5, g[0] + 0.5, g[1] - 0.5, g[1] + 0.5, 0, 0.76); }); fig2(x0 + 3.6, 49.5, 0);\n sg.add(sw.mesh(M(0xf6f1e6, { roughness: 0.95 }), true), sf.mesh(M(0xfbf7ee, { roughness: 1 }), true), sd.mesh(M(0x8c857a, { roughness: 1 }), true), sp2.mesh(new T.MeshBasicMaterial({ color: 0x857869 })));\n var wB = new Batch(), wP = new Batch();\n for (var wf = 0; wf < 3; wf++) { var wy = BASE[wf], wh2 = HGT[wf]; pbox(wB, x0, x1, 42, 62, wy - 0.3, 0.3); pbox(wP, x0 - PO, x0, 42, 62, wy - 0.3, 0.3); pbox(wB, x1 - 0.25, x1, 42, 62, wy, wh2);\n [47, 52, 57].forEach(function (y) { pbox(wB, x0, x1, y - 0.22, y + 0.22, wy, wh2); pbox(wP, x0 - PO, x0, y - 0.22, y + 0.22, wy, wh2); }); }\n pbox(wB, x0, x1, 34, 62, BASE[3] - 0.05, 0.4); pbox(wP, x0 - PO, x0, 34, 62, BASE[3] - 0.05, 0.4); pbox(wB, x1 - 0.25, x1, 34, 42, BASE[2], HGT[2]); pbox(wB, x0, x1, 37.8, 38.2, BASE[2], HGT[2]); pbox(wP, x0 - PO, x0, 37.8, 38.2, BASE[2], HGT[2]);\n secW = new T.Group(); secW.add(wB.mesh(M(0xf6f1e6, { roughness: 0.95 }), true), wP.mesh(new T.MeshBasicMaterial({ color: 0x857869 }))); sg.add(secW);\n sg.visible = false; groups.sec = sg; scene.add(sg);\n [['Mái ngói', TOP + 1.6, 32], ['Phòng nhìn ra phố', BASE[3] + 2.4, 26], ['Hành lang', BASE[2] + 2.4, 31.7], ['Phòng nhìn vào sân', BASE[1] + 2.4, 37.5], ['Sân cảnh lầu 2', BASE[2] + 2.0, 38.5], ['Sân trong', 2.2, 52.5], ['Dãy nhà phía sau', BASE[1] + 2.4, 67.5], ['Sảnh, nhà hàng', 2.6, 29], ['Hiên cà phê', 4.6, 19.8]].forEach(function (l) {\n var s = textSprite(l[0], mobile ? 1.5 : 1.1, LBL); s.position.set(SECX - 0.4, l[1], Z(l[2])); s.visible = false; scene.add(s); secLabels.push(s);\n });\n }\n\n // ---------- Lát cắt ----------\n var CUT_NOTE = {\n 3: ['Lầu 3', 'Chỉ có ở cánh nhìn ra Công trường Lam Sơn: 14 phòng dọc một hành lang. Hai cánh còn lại dừng ở lầu 2.', ['pho', 'vuon', 'sau', 'hl', 'core']],\n 2: ['Lầu 2', 'Phòng nghỉ ở cả ba cánh. Cánh Lam Sơn có thêm một khoảng sân lộ thiên phía trong.', ['pho', 'vuon', 'sau', 'hl', 'core']],\n 1: ['Lầu 1', 'Ba cánh nhà quanh sân Patio, nối nhau bằng hành lang, thang máy và cầu thang.', ['pho', 'vuon', 'sau', 'hl', 'core']],\n 0: ['Tầng trệt', 'Sảnh, nhà hàng, phòng tiệc và dãy cửa hàng mở ra hai mặt phố. Bếp và kho ở phía sau.', ['sanh', 'an', 'shop', 'vp', 'kt', 'spa', 'core']]\n };\n var NOTE_SRC = 'Mô hình minh hoạ. Bố cục theo hồ sơ thiết kế 2009; cách chia phòng và nội thất là phỏng dựng.';\n function setCut(c, quiet) {\n if (secOn && !arguments[3]) setSec(false);\n cut = c; planes.forEach(function (q) { q.constant = 1e4; }); if (bladeMesh) bladeMesh.visible = false; if (!arguments[2]) cutFv = c;\n for (var f = 0; f < 4; f++) { groups['shell' + f].visible = f < c; groups['cut' + f].visible = f === c; }\n groups.roof.visible = c === 4; groups.low2.visible = c > 2; groups.low1.visible = c > 1; groups.annex.visible = c !== 0;\n cutBtns.forEach(function (b) { b.setAttribute('aria-pressed', String(+b.dataset.cut === c)); });\n if (!quiet) showCaption(CUT_NOTE[c] ? [CUT_NOTE[c][0], CUT_NOTE[c][1], NOTE_SRC, CUT_NOTE[c][2]] : null);\n dirty = true;\n }\n // Lát cắt liên tục: cf = 4 là nguyên khối, 3,5 là nhát cắt đang đi nửa đường qua mái và lầu 3...\n function setCutF(cf) {\n if (cf === cutFv) return;\n var base = Math.ceil(cf), t = base - cf;\n if (t < 0.002) { setCut(base, true); return; }\n setCut(base - 1, true, 1); cutFv = cf;\n var f = base - 1, k = 46 - 92 * t, top = base === 4 ? TOP + 4 : BASE[f] + HGT[f];\n groups['shell' + f].visible = true; planes[f].constant = k; if (base === 4) groups.roof.visible = true; if (f === 2 || f === 1) groups['low' + f].visible = true;\n bladeMesh.visible = true; bladeMesh.scale.set(1, top - BASE[f] + 3, 1); bladeMesh.position.set(k, (top + BASE[f]) / 2, 0); dirty = true;\n }\n // Ánh sáng theo thời điểm trong ngày: 0 = sáng sớm, 0,4 = trưa, 0,72 = chiều, 1 = chạng vạng lên đèn\n var TOD = [[0, [70, 38, 85], 0xffeedd, 2.5, 0.55, 1, 0.6, 0.1, 0xe6d8c0], [0.4, [-15, 115, 45], 0xfffaf2, 3.2, 0.6, 1, 0.65, 0.05, 0xe6d8c0], [0.72, [-80, 55, 70], 0xffdfb8, 3.0, 0.5, 1, 0.6, 0.12, 0xe6d8c0], [1, [-105, 16, 45], 0xff8f55, 1.2, 0.2, 0.34, 0.26, 1.7, 0x5a4636]];\n function setTOD(t) {\n t = clamp(t, 0, 1); if (Math.abs(t - todV) < 0.002 || !L.sun) return; todV = t;\n var i = 0; while (i < TOD.length - 2 && t > TOD[i + 1][0]) i++;\n var a = TOD[i], b = TOD[i + 1], k = (t - a[0]) / (b[0] - a[0]), m = function (n) { return a[n] + (b[n] - a[n]) * k; };\n L.sun.position.set(a[1][0] + (b[1][0] - a[1][0]) * k, a[1][1] + (b[1][1] - a[1][1]) * k, a[1][2] + (b[1][2] - a[1][2]) * k);\n L.sun.color.setHex(a[2]).lerp(new T.Color(b[2]), k); L.sun.intensity = m(3); L.hemi.intensity = m(4);\n scene.backgroundIntensity = m(5); scene.environmentIntensity = m(6); scene.fog.color.setHex(a[8]).lerp(new T.Color(b[8]), k);\n var w = m(7); L.warm.forEach(function (q) { q.emissiveIntensity = w; }); var night = clamp((t - 0.8) / 0.2, 0, 1);\n L.lamps.forEach(function (q) { q.intensity = night * 520; }); dirty = true;\n }\n function showCaption(cap) {\n if (!cap) { caption.hidden = true; return; }\n caption.textContent = '';\n var b = document.createElement('b'); b.textContent = cap[0]; var cb = document.createElement('div'); cb.className = 'cc-cap-t'; cb.textContent = cap[1]; caption.append(b, cb);\n if (cap[3]) {\n var lg = document.createElement('div'); lg.className = 'cc-legend';\n cap[3].forEach(function (k) {\n var it = document.createElement('div'), d = document.createElement('div'); it.className = 'cc-key'; d.className = 'cc-dot';\n d.style.background = '#' + KIND[k][1].toString(16).padStart(6, '0'); it.append(d, document.createTextNode(KIND[k][0])); lg.append(it);\n });\n caption.append(lg);\n }\n if (cap[2]) { var i = document.createElement('i'); i.textContent = cap[2]; caption.append(i); }\n caption.hidden = false;\n }\n\n // ---------- Góc xem ----------\n var VIEWS = {\n photo: [[-19, 10.5, 22, -0.76, -0.2, 40, 55], 4, null],\n cover: [[-30.2, 8.9, 30.5, -0.907, -0.16, 45.5, 30], 4, null],\n corner: [[0, 7, 0, -0.75, 0.32, 125], 4, ['Góc phố của Continental', 'Trong những bức ảnh hơn trăm năm về trước, góc phố nơi Hotel Continental Saigon tọa lạc còn chưa có Nhà hát Thành phố và những kiến trúc xung quanh. Suốt 146 năm, nhà hát xuất hiện, các công trình bên cạnh và phía đối diện lần lượt đổi khác, đường phố cũng nhiều lần thay dáng. Khách sạn vẫn ôm lấy góc đường ấy.', NOTE_SRC]],\n front: [[0, 9, 8, 0.05, 0.12, 100], 4, ['Mặt tiền dài', 'Mặt nhìn ra Công trường Lam Sơn: các hàng cửa vòm, ban công chạy suốt, mái hiên che dãy bàn ghế ở tầng trệt.', 'Chi tiết mặt tiền dựng theo ảnh hiện trạng.']],\n dongkhoi: [[-30, 9, 0, -1.5, 0.12, 82], 4, ['Mặt đường Đồng Khởi', 'Mặt dọc đường Đồng Khởi, phía tòa nhà đầu tiên dựng năm 1880. Tầng trệt là dãy cửa hàng.', NOTE_SRC]],\n garden: [[4, 2, -2, 0.95, 1.0, 78], 4, ['Sân vườn Patio', 'Sân Patio rộng hơn 600 m², nằm giữa các dãy nhà, có những cây sứ lâu năm.', 'Diện tích sân vườn và lối đi: 618,54 m² (bảng hiện trạng, hồ sơ 2009).']],\n cut2: [[0, 10, 0, -0.55, 0.85, 105], 2, undefined],\n room: [[9, 10, 19, -0.5, 0.8, 30], 2, ['Cận cảnh một dãy phòng', 'Mỗi phòng mở cửa ra hành lang chung, cửa sổ nhìn xuống phố.', 'Cách chia phòng và nội thất là phỏng dựng để minh hoạ.']],\n cut0: [[0, 4, 0, -0.55, 0.95, 105], 0, undefined],\n khu: [[2, 5, 38, -1.12, 0.38, 235], 4, ['Khách sạn giữa khu phố', 'Nhà hát Thành phố ở ngay trước mặt dài của khách sạn. Xung quanh là các tòa nhà cao tầng xây sau.', 'Vị trí các khối nhà xung quanh đặt theo bản đồ OpenStreetMap; hình khối là giản lược.']],\n top: [[0, 0, 0, 0, 1.53, 170], 4, ['Nhìn từ trên xuống', 'Các dãy nhà khép quanh sân Patio. Khu đất rộng 3.397 m², sân vườn và lối đi chiếm khoảng 619 m².', 'Số liệu: bảng thống kê diện tích hiện trạng, hồ sơ 2009.']]\n };\n function viewTarget(id) {\n var v = VIEWS[id][0];\n var o = { tx: v[0], ty: v[1], tz: v[2], az: v[3], pol: v[4], dist: v[5] * (mobile && id !== 'photo' && id !== 'cover' ? 1.3 * MA() : 1), fov: v[6] || (mobile ? 42 : 35), yaw: 0, tilt: 0 };\n if (id === 'photo' || id === 'cover') photoAlign(o);\n return o;\n }\n // Chỉnh ống kính và hướng nhìn để chân góc toà nhà trong 3D trùng với chân góc toà nhà trên ảnh, dù ảnh bị cắt theo khung nào\n // Góc toà nhà trên từng ảnh: ax = vị trí ngang, ay = chân góc, hf = chiều cao góc (tính theo tỉ lệ ảnh)\n var P_OLD = { el: oldImg, ax: 0.305, ay: 0.95, hf: 0.915, iw: 1600, ih: 895 }, P_NOW = { el: nowImg, ax: 0.46, ay: 0.83, hf: 0.65, iw: 1600, ih: 1189 };\n var PHOTO = { tan: 0.63 }, PL = null, COVER = null, covOn = false, nowClip = '', COVN = { on: false, k: 1, dx: 0, dy: 0 }, covDone = false, readyT = 0;\n // Đặt hai ảnh sao cho góc toà nhà nằm đúng một chỗ, cao bằng nhau, và cả hai vẫn phủ kín khung\n // Đường cuộn thật dài hơn đường cuộn \"ảo\" 150vh: đoạn lát cắt đứng yên và đoạn toà nhà liền lại được kéo giãn để người đọc kịp xem\n var QMAP = [[0, 0], [0.8226, 0.914], [0.9286, 0.958], [0.9946, 0.994], [1, 1]];\n function qmap(x, a, b) { for (var i = 1; i < QMAP.length; i++) if (x <= QMAP[i][a] || i === QMAP.length - 1) { var p0 = QMAP[i - 1], p1 = QMAP[i]; return p0[b] + (p1[b] - p0[b]) * Math.max(0, Math.min(1, (x - p0[a]) / (p1[a] - p0[a]))); } }\n function QV(x) { return qmap(x, 0, 1); } function QA(x) { return qmap(x, 1, 0); }\n var P1 = 0.77, STEP_C = [0.115, 0.235, 0.47, 0.6, 0.752, 0.84, 0.94];\n var STEP_R = [[0.075, 0.165], [0.245, 0.33], [0.435, 0.51], [0.535, 0.69], [0.72, 0.795], [0.805, 0.88], [0.905, 0.965]];\n var FR = null, oldL = Array.from(root.querySelectorAll('.cc-oldl')), pushS = null;\n function layoutPhotos() {\n var W = stage.clientWidth, H = stage.clientHeight; if (!W || !H) return;\n var fw = W < 760 ? W * 0.88 : Math.min(W * 0.5, H * 0.95), fh = fw * (W < 760 ? 0.8 : 0.66), fx = (W - fw) / 2, fy = (H - fh) * 0.44;\n var A = [P_OLD, P_NOW], L = 9, R = 9, U = 9, D = 9;\n A.forEach(function (q) { if (q.el.naturalWidth) { q.iw = q.el.naturalWidth; q.ih = q.el.naturalHeight; } var k = q.iw / (q.hf * q.ih); L = Math.min(L, q.ax * k); R = Math.min(R, (1 - q.ax) * k); U = Math.min(U, q.ay / q.hf); D = Math.min(D, (1 - q.ay) / q.hf); });\n var Hc = Math.max(fw / (L + R), fh / (U + D)) * 1.002, cx = fx + clamp(0.34 * fw, fw - R * Hc, L * Hc), cy = fy + clamp(0.9 * fh, fh - D * Hc, U * Hc);\n A.forEach(function (q) {\n var sc = Hc / (q.hf * q.ih), w = q.iw * sc, h = q.ih * sc, st = q.el.style; q.dh = h; q.l = cx - q.ax * w; q.t = cy - q.ay * h; q.w = w; q.h = h;\n st.setProperty('width', w.toFixed(1) + 'px', 'important'); st.setProperty('height', h.toFixed(1) + 'px', 'important');\n st.left = q.l.toFixed(1) + 'px'; st.top = q.t.toFixed(1) + 'px'; st.right = st.bottom = 'auto';\n if (q === P_OLD) oldL.forEach(function (el) { var ls = el.style; ls.setProperty('width', w.toFixed(1) + 'px', 'important'); ls.setProperty('height', h.toFixed(1) + 'px', 'important'); ls.left = st.left; ls.top = st.top; ls.right = ls.bottom = 'auto'; });\n st.clipPath = 'inset(' + (fy - q.t).toFixed(1) + 'px ' + (q.l + w - fx - fw).toFixed(1) + 'px ' + (q.t + h - fy - fh).toFixed(1) + 'px ' + (fx - q.l).toFixed(1) + 'px)';\n });\n FR = { x: fx, y: fy, w: fw, h: fh }; var fs = frame.style; fs.left = fx + 'px'; fs.top = fy + 'px'; fs.width = fw + 'px'; fs.height = fh + 'px';\n PL = { cx: cx, cy: cy, dh: P_NOW.dh };\n var span = scroller.offsetHeight - innerHeight - OUT; steps.forEach(function (s, i) { s.style.top = (QA(i < 7 ? STEP_C[i] / 0.955 * P1 : 0.938) * span + (i < 2 ? innerHeight * 0.85 : mobile ? innerHeight - (parseFloat(root.style.getPropertyValue('--cc-bot')) || 0) - 14 : innerHeight * 0.52)).toFixed(0) + 'px'; });\n }\n function photoAlign(o) {\n var W = canvas.clientWidth, H = canvas.clientHeight;\n if (!W || !H || !camera) return; if (!PL) layoutPhotos(); if (!PL) return;\n var wx = PL.cx / W * 2 - 1, wy = 1 - PL.cy / H * 2;\n var ty = (PL.tan || PHOTO.tan) * H / PL.dh, tx = ty * W / H; o.fov = Math.atan(ty) * 360 / Math.PI;\n var save = Object.assign({}, cam), v = new T.Vector3(), yaw = 0, tilt = 0, sh0 = shift, sy0 = shY; shift = 0; shY = 0;\n Object.assign(cam, o);\n // Tính trên ống kính của chính tư thế ảnh, không lệch khung: nếu dùng ống kính đang hiển thị (đang ở một trạm khác) thì mô hình sẽ lệch khỏi ảnh\n camera.fov = o.fov; camera.updateProjectionMatrix(); camSh = -1;\n for (var i = 0; i < 8; i++) {\n cam.yaw = yaw; cam.tilt = tilt; place(); camera.updateMatrixWorld(); v.set(-34.5, 0, 25).project(camera);\n yaw += Math.atan(wx * tx) - Math.atan(v.x * tx); tilt += Math.atan(v.y * ty) - Math.atan(wy * ty);\n }\n Object.assign(cam, save); o.yaw = yaw; o.tilt = tilt; shift = sh0; shY = sy0;\n }\n var SECSH = 0.3;\n // Trạm lát cắt: tính khoảng lùi máy quay để cả mặt cắt nằm gọn trong phần màn hình bên phải thẻ chữ, ở mọi tỉ lệ cửa sổ\n function secPose() {\n if (mobile) return pose([SECX, 11.5, 14, -1.36, 0.26, 78], 40);\n var W = canvas.clientWidth || 1280, H = canvas.clientHeight || 800, live = root.classList.contains('cc-live') || document.fullscreenElement === root, L = 40, R = W - 64;\n if (!live && steps[5]) L = steps[5].offsetLeft + steps[5].offsetWidth + 30;\n if (R - L < 320) L = 40;\n SECSH = live ? 0 : (L + R) / W - 1;\n var o = pose([SECX, 12.5, 6, -1.36, 0.3, 68], 30);\n o.dist = Math.max(66, Math.min(180, 58 * H / (R - L) / (2 * Math.tan(15 * Math.PI / 180))));\n return o;\n }\n // Màn hình dọc càng hẹp và cao thì bề ngang nhìn thấy càng ít: lùi máy thêm theo tỉ lệ khung để toà nhà không bị cắt hai bên\n function MA() { var W = canvas.clientWidth || innerWidth, H = canvas.clientHeight || innerHeight; return clamp(0.54 * H / W, 1, 1.9); }\n function pose(a, fov) { return { tx: a[0], ty: a[1], tz: a[2], az: a[3], pol: a[4], dist: a[5] * (mobile ? (a[6] ? 1.3 : 1) * MA() : 1), fov: fov || (mobile ? 42 : 35), yaw: 0, tilt: 0 }; }\n // Một cú máy liền mạch theo cuộn: [vị trí cuộn, tư thế camera, lát cắt, thời điểm trong ngày]\n var TK = null, TKsize = '';\n function tourKeys() {\n var key = canvas.clientWidth + 'x' + canvas.clientHeight; if (TK && TKsize === key) return TK; TKsize = key;\n var ph = viewTarget('photo'), cor = pose([0, 7, 0, -0.75, 0.32, 125, 1]), ter = pose([-13, 5, 24, -0.52, 0.17, mobile ? 46 : 38], 46), up = pose([0, 12, 0, -0.55, 0.85, 105, 1]),\n rm = pose([9, 14.5, 17, -0.5, 0.72, mobile ? 58 : 48]), gd = pose([4, 2, -2, 0.95, 1.0, 78, 1]), lob = pose([mobile ? -23 : -20, 3, mobile ? 25 : 14, -0.35, 0.8, mobile ? 74 : 62]);\n TK = [[0.40, ph, 4, 0.1], [0.46, ter, 4, 0.14], [0.50, ter, 4, 0.16], [0.56, cor, 4, 0.4], [0.59, cor, 4, 0.42], [0.66, up, 3, 0.55], [0.68, up, 3, 0.56],\n [0.75, rm, 3, 0.6], [0.79, rm, 3, 0.62], [0.85, gd, 3, 0.66], [0.88, gd, 3, 0.68], [0.93, lob, 0, 0.72], [0.955, lob, 0, 0.72], [0.985, cor, 4, 0.72]];\n return TK;\n }\n function tourApply(p) {\n var K = tourKeys(), i = 0; if (p <= K[0][0]) { Object.assign(cam, K[0][1]); setCutF(4); setTOD(K[0][3]); return; }\n while (i < K.length - 2 && p > K[i + 1][0]) i++;\n var a = K[i], b = K[i + 1], k = smooth(a[0], b[0], p);\n for (var key in a[1]) cam[key] = a[1][key] + (b[1][key] - a[1][key]) * k;\n setCutF(Math.round((a[2] + (b[2] - a[2]) * k) * 500) / 500); setTOD(a[3] + (b[3] - a[3]) * k);\n }\n var clayOn = false, skyTex = null;\n function setClay(on) {\n if (!scene || on === clayOn) return; clayOn = on; var seen = [];\n scene.traverse(function (o) {\n if (!o.isMesh || !o.material || !o.material.isMeshStandardMaterial || seen.indexOf(o.material) >= 0) return; var m = o.material; seen.push(m);\n if (!m.userData.o) m.userData.o = { c: m.color.clone(), map: m.map, me: m.metalness, ro: m.roughness, ei: m.emissiveIntensity };\n var s = m.userData.o;\n if (on) { var l = 0.3 * s.c.r + 0.59 * s.c.g + 0.11 * s.c.b, v = s.me > 0.8 ? 0.42 : 0.2 + 0.72 * Math.pow(l, 0.75); m.color.setRGB(v, v * 0.985, v * 0.955); m.map = null; m.metalness = 0; m.roughness = 0.96; }\n else { m.color.copy(s.c); m.map = s.map; m.metalness = s.me; m.roughness = s.ro; }\n m.needsUpdate = true;\n });\n if (!skyTex) skyTex = scene.background; scene.background = on ? new T.Color(0xf4ecdc) : skyTex;\n root.classList.toggle('cc-clay', on); dirty = true;\n }\n // Lát cắt dọc: bỏ khối đặc, bật nội thất cả bốn tầng, rồi cắt toà nhà bằng một mặt phẳng đứng\n function setSec(on, k) {\n if (!secPlane) return;\n if (on !== secOn) {\n secOn = on; groups.sec.visible = on; if (groups.dk) groups.dk.visible = !on;\n if (on) { planes.forEach(function (q) { q.constant = 1e4; }); if (bladeMesh) bladeMesh.visible = false; for (var f = 0; f < 4; f++) { groups['shell' + f].visible = true; groups['cut' + f].visible = false; } groups.roof.visible = true; groups.low1.visible = true; groups.low2.visible = true; groups.annex.visible = true; }\n else { secPlane.constant = 1e4; cutFv = -9; secLabels.forEach(function (s) { s.visible = false; }); }\n }\n if (on) { secPlane.constant = -k; groups.sec.position.x = k - SECX; groups.sec.visible = k > -34.4; secW.visible = k < -9.3; var lo = k > SECX - 0.5; secLabels.forEach(function (s) { s.visible = lo; }); }\n dirty = true;\n }\n function goView(id, instant) {\n if (id === 'section') { setSec(true, SECX); showCaption(['Lát cắt tòa nhà', 'Lát cắt đi từ mặt phố vào trong: dãy phòng nhìn ra phố, hành lang, dãy phòng nhìn vào sân, sân Patio, rồi dãy nhà phía sau.', NOTE_SRC]); cutBtns.forEach(function (b) { b.setAttribute('aria-pressed', 'false'); }); var ts = secPose(); if (instant || reduce) { Object.assign(cam, ts); dirty = true; return; } tween = { from: Object.assign({}, cam), to: ts, t0: performance.now(), d: 1300 }; return; }\n setSec(false);\n var v = VIEWS[id]; if (!v) return;\n setCut(v[1], v[2] !== undefined); if (v[2] !== undefined) showCaption(v[2]);\n var to = viewTarget(id);\n if (instant || reduce) { Object.assign(cam, to); dirty = true; return; }\n var from = Object.assign({}, cam), da = to.az - from.az; while (da > Math.PI) da -= 2 * Math.PI; while (da < -Math.PI) da += 2 * Math.PI; to.az = from.az + da;\n tween = { from: from, to: to, t0: performance.now(), d: 1300 };\n }\n\n // ---------- Điều khiển ----------\n function place() {\n var cp = Math.cos(cam.pol);\n if (camera.fov !== cam.fov || camSh !== shift) { camera.fov = cam.fov; camSh = shift; camera.updateProjectionMatrix(); camera.projectionMatrix.elements[8] = -shift; camera.projectionMatrix.elements[9] = shY; camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert(); }\n camera.position.set(cam.tx + cam.dist * cp * Math.sin(cam.az), cam.ty + cam.dist * Math.sin(cam.pol), cam.tz + cam.dist * cp * Math.cos(cam.az));\n camera.lookAt(cam.tx, cam.ty, cam.tz);\n if (cam.yaw) camera.rotateOnWorldAxis(UPV, cam.yaw);\n if (cam.tilt) camera.rotateX(cam.tilt);\n }\n function clamp(v, a, b) { return Math.max(a, Math.min(b, v)); }\n function panBy(dx, dy) {\n var k = cam.dist / canvas.clientHeight * 0.9, ca = Math.cos(cam.az), sa = Math.sin(cam.az);\n cam.tx -= dx * k * ca; cam.tz += dx * k * sa; cam.ty = clamp(cam.ty + dy * k * Math.cos(cam.pol), 0, 30);\n cam.tx -= dy * k * Math.sin(cam.pol) * sa; cam.tz -= dy * k * Math.sin(cam.pol) * ca; dirty = true;\n }\n function interactive() { return ready && introDone; }\n var pts = new Map();\n canvas.addEventListener('pointerdown', function (e) { if (!interactive()) return; tween = null; canvas.setPointerCapture(e.pointerId); pts.set(e.pointerId, [e.clientX, e.clientY]); });\n canvas.addEventListener('pointermove', function (e) {\n if (!pts.has(e.pointerId)) return;\n var prev = pts.get(e.pointerId), dx = e.clientX - prev[0], dy = e.clientY - prev[1];\n if (pts.size === 2) {\n var other = Array.from(pts).find(function (p) { return p[0] !== e.pointerId; })[1];\n var d0 = Math.hypot(prev[0] - other[0], prev[1] - other[1]), d1 = Math.hypot(e.clientX - other[0], e.clientY - other[1]);\n cam.dist = clamp(cam.dist * d0 / Math.max(1, d1), 12, 260); panBy(dx * 0.5, dy * 0.5);\n } else if (e.buttons === 2 || e.shiftKey) panBy(dx, dy);\n else { cam.az -= dx * 0.006; if (e.pointerType !== 'touch' || document.fullscreenElement === root) cam.pol = clamp(cam.pol + dy * 0.005, 0.03, 1.55); }\n pts.set(e.pointerId, [e.clientX, e.clientY]); dirty = true;\n });\n function up(e) { pts.delete(e.pointerId); }\n canvas.addEventListener('pointerup', up); canvas.addEventListener('pointercancel', up);\n canvas.addEventListener('contextmenu', function (e) { e.preventDefault(); });\n canvas.addEventListener('wheel', function (e) {\n if (!interactive()) return;\n if (!(e.ctrlKey || e.metaKey || document.fullscreenElement === root)) { nudge(); return; }\n e.preventDefault(); tween = null; cam.dist = clamp(cam.dist * Math.exp(e.deltaY * 0.0015), 12, 260); dirty = true;\n }, { passive: false });\n\n // ---------- Mở bài: ảnh xưa -> ảnh nay -> 3D theo nhịp cuộn ----------\n function smooth(a, b, x) { var t = clamp((x - a) / (b - a), 0, 1); return t * t * (3 - 2 * t); }\n var rail = root.querySelector('.cc-rail'), railI = -2;\n function railAt(p) { var j = -1; for (var i = 2; i < 7; i++) if (p >= STEP_R[i][0] - 0.03) j = i - 2; return j; }\n function railSet(i) { if (!rail || i === railI) return; railI = i; rail.classList.toggle('cc-on', i >= 0); Array.prototype.forEach.call(rail.children, function (d, k) { d.className = k === i ? 'cc-cur' : k < i ? 'cc-past' : ''; }); }\n if (caption) caption.addEventListener('click', function () { caption.classList.toggle('cc-open'); });\n // Trang mobile mở trong cửa sổ rộng: lớp cc-narrow có thể được gắn sau khi bài đã chạy, nên phải kiểm tra lại, nếu không máy quay và vị trí thẻ vẫn theo bản máy tính\n // Mobile: ảnh của mỗi trạm gom vào một dải nằm trong thẻ, vuốt ngang khi có hai ảnh. Máy tính: trả ảnh về chỗ cũ\n function stripSet() {\n steps.forEach(function (s) {\n var st = s.querySelector('.cc-strip'), figs = Array.from(s.querySelectorAll('.cc-fig')); if (!figs.length) return;\n if (mobile && !st) { st = document.createElement('div'); st.className = 'cc-strip' + (figs.length < 2 ? ' cc-one' : ''); s.insertBefore(st, figs[0]); figs.forEach(function (f) { st.appendChild(f); }); }\n else if (!mobile && st) { figs.forEach(function (f) { s.insertBefore(f, st); }); st.remove(); }\n });\n }\n stripSet();\n // Video ngắn thay ảnh \"Nay\": tắt tiếng, tự lặp, chỉ chạy khi nằm trong màn hình. Không tải được thì giữ ảnh\n (function () {\n // Bản xem thử đọc video cạnh file (data-video-base). Bản CMS: Znews chỉ phát video qua đường dẫn có chữ ký tạo lúc hiển thị trang,\n // nên 7 clip được gói (base64) vào một file txt riêng tải lên như tài liệu; bài tìm liên kết \"continental_video\" trong trang để nạp\n var base = root.getAttribute('data-video-base');\n function mount(srcOf) {\n var vio = ('IntersectionObserver' in window) ? new IntersectionObserver(function (es) {\n es.forEach(function (e) { var v = e.target; if (e.isIntersecting) { if (!v.getAttribute('src')) v.src = v.getAttribute('data-src'); var p = v.play(); if (p && p.catch) p.catch(function () {}); } else v.pause(); });\n }, { threshold: 0.25 }) : null;\n root.querySelectorAll('.cc-fig[data-vid]').forEach(function (f) {\n var src = srcOf(f.getAttribute('data-vid')); if (!src || f.querySelector('video.cc-vid')) return;\n var v = document.createElement('video'); v.className = 'cc-vid'; v.muted = true; v.loop = true; v.playsInline = true;\n v.setAttribute('muted', ''); v.setAttribute('playsinline', ''); v.setAttribute('webkit-playsinline', ''); v.preload = 'none'; v.disablePictureInPicture = true;\n v.setAttribute('data-src', src);\n v.addEventListener('playing', function () { v.classList.add('cc-on'); f.classList.add('cc-playing'); });\n v.addEventListener('error', function () { v.remove(); });\n f.querySelector('.cc-fig-i').appendChild(v);\n if (vio) vio.observe(v); else { v.src = src; v.play(); }\n });\n }\n if (base != null) { mount(function (n) { return base + n + (root.getAttribute('data-video-ext') || '.mp4'); }); return; }\n var as = document.querySelectorAll('a[href*=\"continental_video\"]'), a = as[as.length - 1], url = root.getAttribute('data-video-src') || (a && a.href);\n Array.prototype.forEach.call(as, function (x) { var p = (x.closest && x.closest('p,table')) || x; p.style.display = 'none'; });\n if (!url || !window.fetch || !window.Blob || !window.URL) return;\n setTimeout(function () {\n fetch(url, { credentials: 'omit' }).then(function (r) { if (!r.ok) throw 0; return r.json(); }).then(function (J) {\n var U = {}, mime = J._type || 'video/mp4';\n for (var k in J) { if (k.charAt(0) === '_') continue; var b = atob(J[k]), n = b.length, arr = new Uint8Array(n); while (n--) arr[n] = b.charCodeAt(n); U[k] = URL.createObjectURL(new Blob([arr], { type: mime })); }\n mount(function (n) { return U[n]; });\n }).catch(function () {});\n }, 1500);\n })();\n // Video chính của bài: phóng viên chèn thẻ video của CMS vào thân bài, ngay sau khối này. KHÔNG dời khối video đi chỗ khác:\n // trình phát của Znews giữ chỗ cũ và dựng lại ở đó, sinh ra hai video. Thay vào đó để video nguyên chỗ, nới rộng nó,\n // lót nền ngà phía sau, rồi đưa đoạn giới thiệu series (phần của mình) xuống ngay sau video\n // ---------- Nối sang video chính (Nhật 24/11, hướng 2) ----------\n // Cuối phần tự khám phá, cuộn thêm một đoạn thì máy quay lùi về đúng góc của khung hình đầu video. Video thật được giữ yên\n // ngay sau lớp 3D, đúng chỗ đó; cuộn tiếp thì lớp 3D trượt lên, để lộ video cùng góc, cùng khung\n // Khung đầu video: ax, ay = chân góc toà nhà (tỉ lệ theo khung), tan = nửa góc nhìn dọc của máy quay\n var P_VID = { pose: [-34.5, 2.5, 25, -0.8, 0, 60, 30], ax: 0.262, ay: 0.83, tan: 0.18 };\n if (root.dataset.vidpose) { try { Object.assign(P_VID, JSON.parse(root.dataset.vidpose)); } catch (e) {} }\n // Chỗ video đứng yên trên màn hình: sát mép dưới (trên thanh dưới của trang mobile), để lớp 3D vừa nhấc lên là thấy video ngay\n function vidY() {\n var topH = parseFloat(root.style.getPropertyValue('--cc-top')) || 0, bot = parseFloat(root.style.getPropertyValue('--cc-bot')) || 0;\n if (vidY.w !== innerWidth) { vidY.w = innerWidth; vidY.b = 0; } vidY.b = bot = Math.max(vidY.b || 0, bot); // thanh dưới chỉ đo được khi khung 3D còn ghim: giữ số lớn nhất\n return Math.round(Math.max(topH + MVR.pad, innerHeight - bot - MVR.pad - (MVR.first.getBoundingClientRect().height || MVR.W * 9 / 16)));\n }\n function vidRect() {\n if (!MVR) return null;\n var sr = stage.getBoundingClientRect(), topH = parseFloat(root.style.getPropertyValue('--cc-top')) || 0;\n return { x: MVR.left - sr.left, y: vidY(), w: MVR.W, h: MVR.W * 9 / 16 };\n }\n function vidPose() {\n var v = P_VID.pose, o = { tx: v[0], ty: v[1], tz: v[2], az: v[3], pol: v[4], dist: v[5], fov: v[6], yaw: 0, tilt: 0 }, R = vidRect(); if (!R) return o;\n var pl0 = PL; PL = { cx: R.x + P_VID.ax * R.w, cy: R.y + P_VID.ay * R.h, dh: R.h, tan: P_VID.tan }; photoAlign(o); PL = pl0;\n return o;\n }\n // Giữ video yên sau lớp 3D bằng position:sticky (trình duyệt tự ghim, không giật như khi dịch bằng JS theo sự kiện cuộn).\n // Chỉ bật khi đã gần cuối hành trình, lúc khung 3D đang phủ kín màn hình\n function mvPin() {\n if (!MVR) return;\n var on = document.fullscreenElement !== root && ready && qT > 0.9 ? 1 : 0, bot = Math.max(0, Math.round(innerHeight - vidY() - (MVR.first.getBoundingClientRect().height || MVR.W * 9 / 16)));\n var key = on + ':' + bot; if (key === mvT) return; mvT = key;\n MVR.kids.forEach(function (k) {\n k.style.removeProperty('transform');\n if (on) { k.style.setProperty('position', 'sticky', 'important'); k.style.setProperty('bottom', bot + 'px', 'important'); }\n else { k.style.removeProperty('position'); k.style.removeProperty('bottom'); }\n });\n }\n var outT = 0, outS = 0, outDone = -1;\n function outroUpdate() {\n var has = !!MVR && !reduce;\n if (has !== hasVid) { hasVid = has; root.classList.toggle('cc-hasvid', has); }\n var o1 = has ? Math.round(scroller.offsetHeight * 70 / 1670) : 0;\n if (o1 !== OUT) { OUT = o1; layoutPhotos(); introUpdate(); }\n var r = scroller.getBoundingClientRect(), sp = r.height - innerHeight - OUT;\n outT = OUT > 0 && introDone && ready && document.fullscreenElement !== root ? clamp((-r.top - sp) / OUT, 0, 1) : 0;\n mvPin();\n }\n // Trình phát Znews tự chạy video khi video nằm trong màn hình, kể cả lúc còn nằm khuất sau lớp 3D, nên tới lúc lộ ra thì video\n // đã sang cảnh khác và không còn khớp góc với 3D. Giữ video ở khung đầu cho tới khi lớp 3D trượt qua nửa video, rồi mới cho chạy\n var vHold = false, vDone = false;\n function vidGate() {\n if (!MVR || vDone) return;\n var v = MVR.first.tagName === 'VIDEO' ? MVR.first : MVR.first.querySelector('video'); if (!v) return;\n var vr = MVR.first.getBoundingClientRect(), sb = scroller.getBoundingClientRect().bottom;\n // Chỉ dừng và tua về đầu MỘT lần (tua liên tục làm trình phát nháy), và cho chạy ngay khi mép video bắt đầu lộ ra\n var behind = qT > 0.9 && sb > vr.bottom - 4 && vr.bottom > 0 && vr.top < innerHeight;\n if (behind) {\n if (!vHold) { vHold = true; if (!v.paused) v.pause(); if (v.currentTime > 0.05) { try { v.currentTime = 0; } catch (e) {} } }\n else if (!v.paused) v.pause();\n } else if (vHold && sb <= vr.bottom - 4 && vr.top < innerHeight) {\n vHold = false; vDone = true; var p = v.play(); if (p && p.catch) p.catch(function () {});\n }\n }\n // Gọi mỗi khung hình: máy quay bám theo cuộn có làm mượt, giống phần hành trình\n function outroStep(dt) {\n // Đã tới nơi thì thôi vẽ lại: vẽ lại mô hình 3D mỗi khung hình trong lúc lớp 3D đang trượt lên làm Safari rớt khung, trông như giật\n if (outS === outT && (!outFrom ? true : outDone === outS)) return;\n var d = outT - outS; outS = Math.abs(d) < 0.0005 ? outT : outS + d * (1 - Math.exp(-Math.min(dt, 250) / 120));\n var o = outS;\n if (o > 0) {\n if (!outFrom) { tween = null; setSec(false); setCutF(4); setCut(4, true); outFrom = Object.assign({}, cam); }\n var to = vidPose(), k = smooth(0.02, 0.9, o), dz = to.az - outFrom.az; while (dz > Math.PI) dz -= 2 * Math.PI; while (dz < -Math.PI) dz += 2 * Math.PI; to.az = outFrom.az + dz;\n for (var key in to) cam[key] = outFrom[key] + (to[key] - outFrom[key]) * k;\n dirty = true; outDone = outS;\n } else if (outFrom) { Object.assign(cam, outFrom); outFrom = null; dirty = true; }\n root.classList.toggle('cc-outro', o > 0.01);\n }\n (function () {\n var tail = null, bg = null, last = '';\n function imp(el, k, v) { if (el.style.getPropertyValue(k) !== v || el.style.getPropertyPriority(k) !== 'important') el.style.setProperty(k, v, 'important'); }\n setInterval(function () {\n var body = document.querySelector('.the-article-body'), wrap = document.querySelector('.pv-wrap:not(.pv-tail)'), about = document.querySelector('.pv-about');\n if (!body || !wrap || !about || !body.contains(wrap)) return;\n // Trang mobile (wap) bọc nội dung trong các khối .inpage, nên video không phải con trực tiếp của thân bài:\n // tìm video ở bất cứ đâu trong thân bài phía sau khối chữ, rồi leo lên tới khối ngang hàng trong khung chứa nó\n var SEL = 'video,figure.video,figure.cms-video,.player,.video-container,.video-player', kids = [];\n Array.prototype.forEach.call(body.querySelectorAll(SEL), function (v) {\n if (root.contains(v) || wrap.contains(v) || (tail && tail.contains(v)) || !(wrap.compareDocumentPosition(v) & 4)) return;\n var ad = v.closest('.znews-banner,[class*=\"banner\"],[class*=\"adtima\"],ins'); if (ad && ad !== body && body.contains(ad)) return;\n var k = v;\n while (k.parentElement && k.parentElement !== body && !(k.parentElement.parentElement === body && /(^|\\s)inpage(\\s|$)/.test(k.parentElement.className)) && k.parentElement !== wrap.parentElement) k = k.parentElement;\n if (k.contains(root) || k.contains(wrap) || kids.indexOf(k) >= 0) return;\n kids.push(k);\n });\n if (!kids.length) return;\n if (!tail) {\n tail = document.createElement('div'); tail.className = 'pv-wrap pv-tail';\n bg = document.createElement('div'); bg.className = 'pv-vbg';\n while (wrap.firstChild) tail.appendChild(wrap.firstChild); // Nhật 24/11: video nằm ngay sau phần 3D, toàn bộ chữ xuống dưới video\n if (getComputedStyle(body).position === 'static') body.style.position = 'relative';\n }\n var first = kids[0], end = kids[kids.length - 1];\n if (bg.nextElementSibling !== first) first.parentElement.insertBefore(bg, first);\n if (end.nextElementSibling !== tail) end.parentElement.insertBefore(tail, end.nextSibling);\n tail.classList.toggle('cc-narrow-pv', wrap.classList.contains('cc-narrow-pv'));\n var wr = wrap.getBoundingClientRect();\n // Đoạn giới thiệu series rộng và thẳng mép đúng như khối chữ phía trên\n var tm = parseFloat(tail.style.marginLeft) || 0, tl = tail.getBoundingClientRect().left - tm;\n imp(tail, 'max-width', 'none'); imp(tail, 'width', Math.round(wr.width) + 'px'); imp(tail, 'margin-left', Math.round(wr.left - tl) + 'px'); imp(tail, 'margin-right', '0px');\n tail.style.setProperty('--cw', wrap.style.getPropertyValue('--cw'));\n // Nhật 24/11: video phải liền với cụm 3D. Video tràn hết bề ngang, sát ngay mép dưới phần 3D, không khe hở;\n // chỉ khi màn hình quá bẹt mới thu lại cho vừa chiều cao, hai bên là dải nâu sẫm\n var topH = parseFloat(root.style.getPropertyValue('--cc-top')) || 0;\n // Nhật 24/11: không tràn hết màn hình (đụng logo ở góc): trên desktop video thu lại, có lề quanh; mobile vẫn rộng hết cột\n var wide = wr.width > 760, pad = wide ? Math.round(Math.min(innerHeight * 0.07, 64)) : 0;\n var W = Math.round(Math.min(wide ? Math.min(1080, wr.width - 88) : wr.width, Math.max(320, (innerHeight - topH - 2 * pad) * 16 / 9)));\n kids.forEach(function (k) {\n k.classList.add('cc-mainvid');\n var pr = k.parentElement.getBoundingClientRect(), pl = parseFloat(getComputedStyle(k.parentElement).paddingLeft) || 0;\n var ml = Math.round(wr.left + (wr.width - W) / 2 - pr.left - pl);\n imp(k, 'width', W + 'px'); imp(k, 'max-width', 'none'); imp(k, 'margin-left', ml + 'px'); imp(k, 'margin-right', '0px'); imp(k, 'float', 'none');\n imp(k, 'margin-top', (k === first ? pad : 0) + 'px'); imp(k, 'margin-bottom', (k === end ? pad : 0) + 'px');\n if (k.tagName === 'VIDEO') { imp(k, 'height', 'auto'); imp(k, 'display', 'block'); }\n });\n MVR = { kids: kids, first: first, W: W, left: wr.left + (wr.width - W) / 2, pad: pad }; outroUpdate();\n // Nền chạy liền từ đáy khối chữ phía trên tới đỉnh đoạn giới thiệu series, không để hở khe trắng\n var op = bg.offsetParent || body, br = op.getBoundingClientRect();\n // Tính theo vị trí gốc (đỉnh đoạn chữ phía sau trừ chiều cao video), KHÔNG theo vị trí đang hiển thị: video đang được ghim (sticky)\n // nên vị trí hiển thị đổi liên tục khi cuộn, nền tính theo đó sẽ nhảy theo từng nhịp và trông như giật\n var tt = tail.getBoundingClientRect().top, kh = 0; kids.forEach(function (k) { kh += k.offsetHeight; });\n var ft = tt - kh - 2 * pad, t0 = (ft - wr.bottom > 30 ? ft : Math.min(ft, wr.bottom)) - br.top - op.clientTop - 1, t1 = tt - br.top - op.clientTop + 1;\n var key = [Math.round(wr.left - br.left - op.clientLeft), Math.round(wr.width), Math.round(t0), Math.round(t1 - t0)].join(',');\n if (key !== last) {\n last = key; var p = key.split(',');\n // Trang ép mọi khối con của thân bài về bề rộng cột (660px!important), nên phải đặt kèm !important\n ['left', 'width', 'top', 'height'].forEach(function (k, i) { bg.style.setProperty(k, p[i] + 'px', 'important'); });\n ['max-width', 'margin', 'padding'].forEach(function (k) { bg.style.setProperty(k, k === 'max-width' ? 'none' : '0', 'important'); });\n tail.style.setProperty('--pvl', '0px'); tail.style.setProperty('--pvw', '100%');\n }\n }, 500);\n })();\n var botSeen = '';\n function chkMobile() {\n var m = matchMedia('(max-width:760px), (pointer:coarse)').matches || root.classList.contains('cc-narrow');\n var bt = root.style.getPropertyValue('--cc-bot'); if (bt !== botSeen) { botSeen = bt; if (m === mobile && FR) layoutPhotos(); }\n if (m === mobile) return; mobile = m; TK = null; TKsize = ''; camSh = -1; stripSet(); layoutPhotos();\n if (how) how.innerHTML = howText();\n }\n function introUpdate() {\n chkMobile();\n if (document.fullscreenElement === root) return;\n var r = scroller.getBoundingClientRect(), span = r.height - innerHeight - OUT, H = stage.clientHeight;\n qT = span > 0 ? QV(clamp(-r.top / span, 0, 1)) : 1; if (!ready || reduce || qS < 0) qS = qT;\n var q0 = qS, p = Math.min(q0 / P1, 1) * 0.955, sq = clamp((q0 - P1) / (0.955 - P1), 0, 1); introP = p;\n // Mở bài: ảnh xưa phủ kín màn hình, cuộn xuống thì lùi ra thành khung ảnh nhỏ giữa trang giấy\n var kx = smooth(0.15, 0.2, p), kp = ready ? smooth(0.27, 0.33, p) : 0, kb = ready ? smooth(0.345, 0.4, p) : 0, W = stage.clientWidth, fo = 1;\n if (FR && P_OLD.w) {\n var q = P_OLD, k0 = smooth(COVN.on ? 0.016 : 0, 0.085, p), sc0 = Math.max(W / q.iw, H / q.ih), cw = q.iw * sc0, ch = q.ih * sc0, cl = clamp(W * 0.5 - 0.42 * cw, W - cw, 0), ct = (H - ch) * 0.6;\n var w = q.w * Math.pow(cw / q.w, 1 - k0), e = cw > q.w ? (w - q.w) / (cw - q.w) : 0, z = w / q.w, l = q.l + (cl - q.l) * e, t = q.t + (ct - q.t) * e;\n var vx = FR.x * (1 - e), vy = FR.y * (1 - e), vw = FR.w + (W - FR.w) * e, vh = FR.h + (H - FR.h) * e, os = oldImg.style, fs = frame.style;\n // Chiều sâu: ảnh xưa tách ba lớp trời, toà nhà, hàng cây. Mở trang thì máy đẩy vào rất chậm, cuộn xuống thì các lớp trượt lệch nhau rồi khép lại khi ảnh lùi thành khung\n var amt = reduce ? 0 : e, pvx = W * (mobile ? 0.3 : 0.34), pvy = H * 0.1, ox = pvx - q.l, oy = pvy - q.t;\n // Cú đẩy máy chậm lúc mở trang chạy bằng CSS (thuộc tính scale). Khi người đọc bắt đầu cuộn thì chốt giá trị đang có rồi thu dần về 1 theo cuộn\n var allL = [oldImg].concat(oldL);\n if (!pushS && p > 0.002) pushS = allL.map(function (el) { var v = parseFloat(getComputedStyle(el).scale) || 1; el.style.animation = 'none'; return v; });\n function setL(el, f, i) {\n var st = el.style, S = pushS ? 1 + (pushS[i] - 1) * e * e * e : 1, zf = z * f, lf = pvx + (l - pvx) * f, tf = pvy + (t - pvy) * f;\n var x0 = pvx + (vx - pvx) / S, x1 = pvx + (vx + vw - pvx) / S, y0 = pvy + (vy - pvy) / S, y1 = pvy + (vy + vh - pvy) / S;\n if (pushS) st.scale = S.toFixed(4);\n st.transformOrigin = ox.toFixed(1) + 'px ' + oy.toFixed(1) + 'px'; st.transform = 'translate(' + (lf - q.l - ox * (1 - zf)).toFixed(1) + 'px,' + (tf - q.t - oy * (1 - zf)).toFixed(1) + 'px) scale(' + zf.toFixed(4) + ')';\n st.clipPath = 'inset(' + ((y0 - tf) / zf).toFixed(1) + 'px ' + ((lf + q.w * zf - x1) / zf).toFixed(1) + 'px ' + ((tf + q.h * zf - y1) / zf).toFixed(1) + 'px ' + ((x0 - lf) / zf).toFixed(1) + 'px)';\n }\n setL(oldImg, 1, 0); oldL.forEach(function (el, i) { setL(el, 1 + (+el.dataset.f) * amt, i + 1); });\n fs.left = vx.toFixed(1) + 'px'; fs.top = vy.toFixed(1) + 'px'; fs.width = vw.toFixed(1) + 'px'; fs.height = vh.toFixed(1) + 'px'; var ss = scrim.style; ss.left = fs.left; ss.top = fs.top; ss.width = fs.width; ss.height = fs.height; fo = smooth(0.25, 0.9, 1 - e);\n nowImg.style.visibility = e > 0.001 ? 'hidden' : '';\n // Cover: nửa phải ảnh xưa tan dần sang ảnh khách sạn ngày nay, đặt trùng góc toà nhà; cuộn xuống thì ảnh xưa phủ lại rồi lùi ra thành khung\n var cv = COVN.on && P_NOW.w ? 1 - smooth(0.006, 0.032, p) : 0, ns = nowImg.style, N = P_NOW;\n if (cv > 0.002) {\n var a0 = W * (mobile ? 0.3 : 0.4), a1 = W * (mobile ? 0.8 : 0.72), al = (1 - cv).toFixed(3);\n var mi = 'linear-gradient(90deg,#000 ' + ((a0 - l) / z).toFixed(1) + 'px,rgba(0,0,0,' + al + ') ' + ((a1 - l) / z).toFixed(1) + 'px)';\n os.webkitMaskImage = mi; os.maskImage = mi;\n if (!covOn) { covOn = true; nowClip = ns.clipPath; }\n var zn = z * COVN.k, kx0 = l + q.ax * w, sx = clamp((vx + vw - kx0) / ((1 - N.ax) * N.w * zn) * 1.01, 1, 1.4), zx = zn * sx, nl = kx0 - N.ax * N.w * zx, nt = t + q.ay * q.h * z + COVN.dy * q.h * z - N.ay * N.h * zn;\n ns.transformOrigin = '0 0'; ns.transform = 'translate(' + (nl - N.l).toFixed(1) + 'px,' + (nt - N.t).toFixed(1) + 'px) scale(' + zx.toFixed(4) + ',' + zn.toFixed(4) + ')';\n ns.clipPath = 'inset(' + ((vy - nt) / zn).toFixed(1) + 'px ' + Math.max(0, (nl + N.w * zx - vx - vw) / zx).toFixed(1) + 'px ' + ((nt + N.h * zn - vy - vh) / zn).toFixed(1) + 'px ' + ((vx - nl) / zx).toFixed(1) + 'px)';\n ns.visibility = '';\n } else if (covOn) { covOn = false; os.webkitMaskImage = os.maskImage = ''; ns.transform = ''; ns.clipPath = nowClip; }\n }\n if (hero) { var ho = 1 - smooth(0.004, 0.026, p); hero.style.opacity = ho.toFixed(3); hero.style.visibility = ho <= 0 ? 'hidden' : ''; scrim.style.opacity = ho.toFixed(3); scrim.style.visibility = ho <= 0 ? 'hidden' : ''; }\n oldImg.style.opacity = (1 - kx).toFixed(3); oldImg.style.visibility = kx >= 1 ? 'hidden' : '';\n oldL.forEach(function (el) { el.style.opacity = oldImg.style.opacity; el.style.visibility = oldImg.style.visibility; });\n nowImg.style.opacity = (1 - kb).toFixed(3); if (kb >= 1) nowImg.style.visibility = 'hidden';\n frame.style.opacity = (fo * (1 - kb)).toFixed(3); frame.style.visibility = kb >= 1 ? 'hidden' : '';\n paper.style.opacity = (1 - kp).toFixed(3); paper.style.visibility = kp >= 1 ? 'hidden' : '';\n root.classList.toggle('cc-onpaper', kp < 0.5);\n marks.forEach(function (s, i) { var on = !(ready && q0 >= 0.996) && sq === 0 && p >= STEP_R[i + 2][0] - 0.02 && p < STEP_R[i + 2][1] + 0.01; if (s.visible !== on) { s.visible = on; if (hls[i]) hls[i].visible = on; if (i === 0) facLabels.forEach(function (x) { x.visible = on; }); dirty = true; } });\n var done = ready && q0 >= 0.996;\n root.classList.toggle('cc-tour', !done && p > 0.09);\n if (done !== introDone) {\n introDone = done; root.classList.toggle('cc-live', done);\n if (done) { todIn.value = 50; setTOD(0.5); setSec(false); setCutF(4); setCut(4, true); select.value = 'corner'; goView('corner', true); }\n else { tween = null; caption.hidden = true; }\n }\n secTr = sq > 0 && !done; var sh = mobile || document.fullscreenElement === root ? 0 : (sq > 0 ? 0.3 + (SECSH - 0.3) * smooth(0, 0.4, sq) : 0.3) * smooth(0.4, 0.47, p) * (1 - smooth(0.96, 0.994, q0)); if (Math.abs(sh - shift) > 0.0005) { shift = sh; dirty = true; }\n var sy = mobile && document.fullscreenElement !== root ? -0.42 * smooth(0.4, 0.47, p) * (1 - smooth(0.96, 0.994, q0)) : 0; if (Math.abs(sy - shY) > 0.0005) { shY = sy; camSh = -1; dirty = true; }\n railSet(done || p < 0.42 ? -1 : sq > 0 ? 5 : railAt(p));\n if (ready && !introDone) {\n if (sq > 0) {\n // Trạm 5 sang 6: dựng lại các tầng từ dưới lên, máy quay lùi ra ngang toà nhà, rồi nhát cắt mới quét\n var K = tourKeys(), lob = K[K.length - 2][1], sp = secPose(), kc = smooth(0, 0.4, sq), kt = clamp((sq - 0.38) / 0.4, 0, 1), kk = -34.6 + (SECX + 34.6) * (kt < 0.28 ? 0.68 * smooth(0, 0.28, kt) : 0.68 + 0.32 * smooth(0.28, 1, kt)); sp.tx = kk;\n for (var key in lob) cam[key] = lob[key] + (sp[key] - lob[key]) * kc; cam.dist += 34 * Math.sin(Math.PI * kc);\n // Hết trạm 6: nhát cắt khép lại, máy quay lùi dần ra toàn cảnh góc phố theo cuộn, không nhảy cảnh\n var rq = clamp((q0 - 0.958) / (0.994 - 0.958), 0, 1);\n if (rq > 0) { var ct = viewTarget('corner'), ke = smooth(0, 1, rq), dz = ct.az - sp.az; while (dz > Math.PI) dz -= 2 * Math.PI; while (dz < -Math.PI) dz += 2 * Math.PI; ct.az = sp.az + dz; sp.tx = SECX;\n for (var k2 in ct) if (typeof sp[k2] === 'number') cam[k2] = sp[k2] + (ct[k2] - sp[k2]) * ke; cam.dist += 16 * Math.sin(Math.PI * ke); kk = SECX - (SECX + 34.6) * smooth(0.08, 0.8, rq); }\n setTOD(0.72 - 0.22 * smooth(0, 0.3, sq));\n if (sq < 0.34) { if (secOn) setSec(false); setCutF(Math.round(smooth(0.02, 0.3, sq) * 2000) / 500); } else setSec(true, kk);\n } else { if (secOn) setSec(false); tourApply(p); if (COVER) { Object.assign(cam, COVER); setTOD(0.46); } }\n dirty = true;\n }\n }\n addEventListener('scroll', function () { if (ready && !reduce) { var r = scroller.getBoundingClientRect(), sp = r.height - innerHeight - OUT; qT = sp > 0 ? QV(clamp(-r.top / sp, 0, 1)) : 1; } else introUpdate(); outroUpdate(); }, { passive: true });\n addEventListener('resize', function () { layoutPhotos(); introUpdate(); });\n [oldImg, nowImg].forEach(function (im) { im.addEventListener('load', function () { layoutPhotos(); introUpdate(); }); });\n layoutPhotos();\n var lb = document.createElement('div'); lb.className = 'cc-lb'; lb.hidden = true; lb.innerHTML = '\"\"
'; root.appendChild(lb);\n lb.addEventListener('click', function () { lb.hidden = true; });\n root.querySelectorAll('.cc-step .cc-fig').forEach(function (f) { f.addEventListener('click', function () { if (f.querySelector('video.cc-on')) return; lb.firstChild.src = f.querySelector('img').src; lb.lastChild.textContent = f.querySelector('.cc-fig-c').textContent; lb.className = 'cc-lb' + (f.classList.contains('cc-bw') ? ' cc-bw' : ''); lb.hidden = false; }); });\n\n // ---------- Vòng lặp vẽ ----------\n function ease(t) { return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2; }\n var visible = true;\n function resize() {\n var w = canvas.clientWidth, h = canvas.clientHeight; if (!w || !h || !renderer) return;\n renderer.setSize(w, h, false); camera.aspect = w / h; camera.updateProjectionMatrix(); camSh = -1; dirty = true;\n }\n function loop(now) {\n requestAnimationFrame(loop);\n if (!visible) return;\n if (qS !== qT && qS >= 0) { var dq = qT - qS; qS = Math.abs(dq) < 0.00004 ? qT : qS + dq * (1 - Math.exp(-Math.min(now - lastT, 250) / 120)); introUpdate(); }\n if (MVR) { outroUpdate(); vidGate(); } outroStep(now - lastT);\n var fdt = 1 - Math.exp(-Math.min(now - lastT, 400) / 110); lastT = now;\n if (tween) {\n var t = Math.min(1, (now - tween.t0) / tween.d), k = ease(t);\n for (var key in tween.to) cam[key] = tween.from[key] + (tween.to[key] - tween.from[key]) * k;\n if (t >= 1) tween = null; dirty = true;\n }\n if (spin && !pts.size && !tween && !outFrom) { cam.az += 0.0025; dirty = true; }\n if (MATG && camera) {\n var go = (clayOn ? 0.9 : 0.62) * (1 - smooth(0.42, 0.62, cam.pol)), cp = camera.position;\n if (!CTXR) { CTXR = { ray: new T.Ray(), v: new T.Vector3(), h: new T.Vector3(), pts: [[0, 8, 0], [-34.5, 3, 25], [0, 3, 25], [34.5, 3, 25], [-34.5, 14, 25], [34.5, 14, 25], [-34.5, 3, 0], [-34.5, 3, -25], [-34.5, 14, -25], [0, 16, 25], [-20, 3, 25], [20, 3, 25]] }; }\n for (var ci = 0; ci < CTXB.length; ci++) {\n var o = CTXB[ci], hit = o.box.containsPoint(cp);\n for (var pi = -1; pi < CTXR.pts.length && !hit; pi++) {\n var q = pi < 0 ? [cam.tx, cam.ty, cam.tz] : CTXR.pts[pi]; CTXR.v.set(q[0] - cp.x, q[1] - cp.y, q[2] - cp.z); var len = CTXR.v.length(); if (len < 1) continue;\n CTXR.ray.origin.copy(cp); CTXR.ray.direction.copy(CTXR.v).multiplyScalar(1 / len);\n if (CTXR.ray.intersectBox(o.box, CTXR.h) && CTXR.h.distanceTo(cp) < len - 1) hit = true;\n }\n var ft = hit || secOn || secTr || COVER || cutFv < 3.5 ? 0 : 1, nf = Math.abs(ft - o.f) < 0.02 ? ft : o.f + (ft - o.f) * fdt, op = go * nf;\n if (nf !== o.f || Math.abs(op - o.m.opacity) > 0.004) { o.f = nf; o.m.opacity = op; o.m.visible = op > 0.02; if (o.lbl) o.lbl.position.y = 3 + (o.ly - 3) * nf; dirty = true; }\n }\n }\n var so = cam.dist > 70; if (so !== stOn) { stOn = so; streetL.forEach(function (x) { x.visible = so; }); dirty = true; }\n var lb2 = cam.dist > 40 && (introDone || cutFv < 4) && !secOn && !secTr; if (lb2 !== lblOn) { lblOn = lb2; cutLabels.forEach(function (x) { x.visible = lb2; }); dirty = true; }\n if (!dirty) return;\n dirty = false; place(); camera.updateMatrixWorld();\n var Hc = canvas.clientHeight, Wc = canvas.clientWidth, u = 2 * Math.tan(cam.fov * Math.PI / 360) / Hc, LB = mobile ? 21 : 26, MK = mobile ? 30 : 36, boxes = [];\n var vis = [];\n // Nhãn chú thích: chữ, đường kẻ và chấm là ba phần rời. Mỗi khung hình xếp lại để nhãn không đè nhau, không đè chấm hay đường kẻ của nhãn khác và không tràn mép màn hình\n if (!LEADT) {\n var c1 = document.createElement('canvas'); c1.width = c1.height = 4; var x1c = c1.getContext('2d'); x1c.fillStyle = '#2b1811'; x1c.fillRect(0, 0, 4, 4);\n var c2 = document.createElement('canvas'); c2.width = c2.height = 32; var x2c = c2.getContext('2d'); x2c.fillStyle = '#2b1811'; x2c.beginPath(); x2c.arc(16, 16, 14, 0, 7); x2c.fill();\n LEADT = [new T.CanvasTexture(c1), new T.CanvasTexture(c2)]; LEADT[0].colorSpace = LEADT[1].colorSpace = T.SRGBColorSpace;\n }\n var L0 = LB * 1.75, DOT = mobile ? 7 : 8, obst = [], uiR = [], cr = canvas.getBoundingClientRect();\n // Các bảng giao diện nổi trên mô hình (bóc tầng, thẻ chú thích, cụm điều khiển) cũng là vật cản của nhãn\n UIEL.concat(steps).forEach(function (el) { if (!el || el.hidden || !el.offsetWidth) return; var cs = getComputedStyle(el); if (cs.visibility === 'hidden' || +cs.opacity < 0.05) return; var r = el.getBoundingClientRect(), b = [r.left - cr.left, r.right - cr.left, r.top - cr.top, r.bottom - cr.top, 1]; uiR.push(b); obst.push(b); });\n fixL.forEach(function (sp) {\n var ud = sp.userData;\n if (!ud.ld && sp.parent) {\n ud.ld = new T.Sprite(new T.SpriteMaterial({ map: LEADT[0], depthTest: false, transparent: true, sizeAttenuation: false })); ud.dt = new T.Sprite(new T.SpriteMaterial({ map: LEADT[1], depthTest: false, transparent: true, sizeAttenuation: false }));\n ud.ld.renderOrder = ud.dt.renderOrder = 9; ud.ld.center.set(0.5, 0); sp.parent.add(ud.ld, ud.dt);\n }\n var on = sp.visible && sp.parent && sp.parent.visible; if (on) { sp.getWorldPosition(V3).project(camera); if (V3.z > 1) on = false; }\n if (ud.ld) { ud.ld.visible = ud.dt.visible = !!on; ud.ld.position.copy(sp.position); ud.dt.position.copy(sp.position); }\n if (!on) return;\n var ax = (V3.x + 1) * Wc / 2, ay = (1 - V3.y) * Hc / 2, w = LB * ud.r;\n vis.push({ sp: sp, ax: ax, ay: ay, w: w }); obst.push([ax - DOT / 2 - 2, ax + DOT / 2 + 2, ay - DOT / 2 - 2, ay + DOT / 2 + 2, sp]);\n });\n vis.sort(function (a, b) { return b.ay - a.ay; });\n // Thanh menu cố định của trang (đo sẵn trong --cc-top) che mép trên: nhãn không được chui lên đó\n var topIn = parseFloat(root.style.getPropertyValue('--cc-top')) || 0;\n vis.forEach(function (it) {\n var x0 = it.ax - it.w / 2, pad = 8, lim = Math.max(10, it.w / 2 - 4);\n if (it.ay < topIn + 6 || it.ax < pad + 4 || it.ax > Wc - pad - 4 || uiR.some(function (b) { return it.ax > b[0] && it.ax < b[1] && it.ay > b[2] && it.ay < b[3]; })) { it.sp.scale.set(1e-6, 1e-6, 1); it.sp.userData.ld.visible = it.sp.userData.dt.visible = false; return; }\n x0 = clamp(clamp(x0, pad, Wc - pad - it.w), it.ax - it.w / 2 - lim, it.ax - it.w / 2 + lim);\n var y = it.ay - L0 - LB, x1 = x0 + it.w;\n for (var n = 0; n < 5; n++) { var moved = false; obst.forEach(function (o) { if (o[4] === it.sp) return; if (x0 < o[1] + 5 && x1 > o[0] - 5 && y < o[3] + 3 && y + LB > o[2] - 3) {\n // Đụng chấm của nhãn khác: thử né ngang trước (đường kẻ của mình vẫn nằm dưới nhãn), không được mới đẩy lên\n var lo = Math.max(pad, it.ax - it.w + 4), hi = Math.min(Wc - pad - it.w, it.ax - 4), c1 = o[1] + 6, c2 = o[0] - 6 - it.w, nx = null;\n if (o[4]) { if (c1 >= lo && c1 <= hi) nx = c1; if (c2 >= lo && c2 <= hi && (nx === null || Math.abs(c2 - x0) < Math.abs(nx - x0))) nx = c2; }\n if (nx !== null && n < 2) { x0 = nx; x1 = x0 + it.w; } else y = o[2] - LB - 5;\n moved = true; } }); if (!moved) break; }\n y = Math.max(y, Math.min(4 + topIn, it.ay - LB - 6));\n var len = Math.max(2, it.ay - y - LB), ud = it.sp.userData;\n it.sp.scale.set(it.w * u, LB * u, 1); it.sp.center.set((it.ax - x0) / it.w, -len / LB);\n ud.ld.scale.set(2 * u, (len + 1) * u, 1); ud.dt.scale.set(DOT * u, DOT * u, 1);\n var bx = [x0, x1, y, y + LB, null]; obst.push(bx); obst.push([it.ax - 2, it.ax + 2, y + LB, it.ay, null]); boxes.push(bx);\n });\n marks.forEach(function (m) { m.scale.setScalar(MK * u); if (!m.visible) return; V3.copy(m.position).project(camera); var mx = (V3.x + 1) * Wc / 2, my = (1 - V3.y) * Hc / 2, y = my, R = MK / 2 + 5;\n for (var n = 0; n < 2; n++) boxes.forEach(function (b) { if (mx + R > b[0] && mx - R < b[1] && y + R > b[2] && y - R < b[3]) y = b[2] - R; });\n m.center.set(0.5, 0.5 - (my - y) / MK); });\n renderer.render(scene, camera);\n }\n todIn.addEventListener('input', function () { if (introDone) setTOD(+todIn.value / 100); });\n skip.addEventListener('click', function () { toExplore(); });\n // Âm thanh nền (tuỳ chọn, mặc định tắt): tiếng phố xa và vài nốt nhạc thưa, tạo bằng Web Audio, không cần file\n var AC = null, master = null, noteTimer = 0;\n function sound(on) {\n if (on && !AC) {\n var C = window.AudioContext || window.webkitAudioContext; if (!C) return;\n AC = new C(); master = AC.createGain(); master.gain.value = 0; master.connect(AC.destination);\n var n = AC.sampleRate * 4, buf = AC.createBuffer(1, n, AC.sampleRate), d = buf.getChannelData(0), l = 0;\n for (var i = 0; i < n; i++) { l = (l + 0.02 * (Math.random() * 2 - 1)) / 1.02; d[i] = l * 3.5; }\n var src = AC.createBufferSource(); src.buffer = buf; src.loop = true;\n var lp = AC.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 380; var g = AC.createGain(); g.gain.value = 0.42;\n src.connect(lp); lp.connect(g); g.connect(master); src.start();\n var lfo = AC.createOscillator(), lg = AC.createGain(); lfo.frequency.value = 0.11; lg.gain.value = 0.12; lfo.connect(lg); lg.connect(g.gain); lfo.start();\n var dl = AC.createDelay(1), fb = AC.createGain(), wet = AC.createGain(); dl.delayTime.value = 0.41; fb.gain.value = 0.38; wet.gain.value = 0.5; dl.connect(fb); fb.connect(dl); dl.connect(wet); wet.connect(master);\n var SC = [196, 220, 261.63, 293.66, 329.63, 392, 440, 523.25];\n noteTimer = setInterval(function () {\n if (AC.state !== 'running' || Math.random() < 0.35) return;\n var t = AC.currentTime, o = AC.createOscillator(), e = AC.createGain(); o.type = 'triangle'; o.frequency.value = SC[Math.floor(Math.random() * SC.length)];\n e.gain.setValueAtTime(0, t); e.gain.linearRampToValueAtTime(0.11, t + 0.03); e.gain.exponentialRampToValueAtTime(0.0008, t + 4.2);\n o.connect(e); e.connect(master); e.connect(dl); o.start(t); o.stop(t + 4.4);\n }, 2300);\n }\n if (!AC) return; if (on) AC.resume();\n master.gain.cancelScheduledValues(AC.currentTime); master.gain.linearRampToValueAtTime(on ? 0.6 : 0, AC.currentTime + 1.2);\n }\n async function start() {\n if (loading || ready) return; loading = true; retry.hidden = true;\n try {\n T = await library();\n renderer = new T.WebGLRenderer({ canvas: canvas, antialias: true, powerPreference: mobile ? 'default' : 'high-performance' });\n renderer.setPixelRatio(Math.min(devicePixelRatio || 1, mobile ? 1.5 : 2));\n renderer.outputColorSpace = T.SRGBColorSpace; renderer.toneMapping = T.ACESFilmicToneMapping; renderer.toneMappingExposure = 1.05;\n renderer.shadowMap.enabled = true; renderer.shadowMap.type = T.PCFShadowMap;\n scene = new T.Scene(); scene.background = new T.Color(0xf1dcbd); scene.fog = new T.Fog(0xe6d8c0, 330, 950);\n camera = new T.PerspectiveCamera(35, 1, 0.5, 900); UPV = new T.Vector3(0, 1, 0); V3 = new T.Vector3();\n build();\n if ('ResizeObserver' in window) new ResizeObserver(resize).observe(canvas); else addEventListener('resize', resize);\n if ('IntersectionObserver' in window) new IntersectionObserver(function (en) { visible = en[0].isIntersecting; if (visible) dirty = true; }).observe(stage);\n renderer.localClippingEnabled = true; resize(); setCut(4, true); setTOD(0.1); cutLabels.forEach(function (x) { x.visible = false; }); lblOn = false; Object.assign(cam, viewTarget('photo'));\n ready = true; readyT = performance.now(); [select, todIn].concat(cutBtns, actBtns).forEach(function (el) { el.disabled = false; });\n if (!/mau/.test(location.hash)) setClay(true);\n introUpdate(); requestAnimationFrame(loop);\n } catch (err) {\n loading = false; retry.hidden = false; say(err.message || String(err));\n }\n }\n startBtn.addEventListener('click', start);\n if ('IntersectionObserver' in window) {\n var io = new IntersectionObserver(function (en) { if (en[0].isIntersecting) { io.disconnect(); start(); } }, { rootMargin: '600px 0px' });\n io.observe(root);\n } else start();\n introUpdate();\n\n function toExplore() {\n // Nếu người đọc bấm điều khiển khi còn ở phần mở bài, cuộn tới cuối phần mở bài\n if (introDone) return true;\n var r = scroller.getBoundingClientRect(); scrollBy({ top: r.bottom - OUT - innerHeight + 2, behavior: reduce ? 'auto' : 'smooth' }); return false;\n }\n select.addEventListener('change', function () { if (toExplore()) goView(select.value); });\n cutBtns.forEach(function (b) { b.addEventListener('click', function () { if (!toExplore()) return; tween = null; setCut(+b.dataset.cut); }); });\n actBtns.forEach(function (b) {\n b.addEventListener('click', function () {\n var a = b.dataset.action;\n if (a === 'sound') { var on = b.getAttribute('aria-pressed') !== 'true'; b.setAttribute('aria-pressed', String(on)); b.textContent = on ? 'Tắt âm thanh' : 'Bật âm thanh'; sound(on); return; }\n if (a === 'clay') { var c2 = !clayOn; setClay(c2); b.setAttribute('aria-pressed', String(c2)); return; }\n if (a === 'motion') { spin = !spin; b.textContent = spin ? 'Dừng xoay' : 'Tự xoay'; dirty = true; }\n else if (a === 'fullscreen') {\n if (document.fullscreenElement) document.exitFullscreen();\n else if (root.requestFullscreen) { introDone = true; root.requestFullscreen(); goView(select.value); }\n }\n });\n });\n document.addEventListener('fullscreenchange', function () { setTimeout(function () { resize(); introUpdate(); }, 80); });\n})();\n"); })();