diff --git a/internal/locales/de.json b/internal/locales/de.json index dc3e7f3..3889827 100644 --- a/internal/locales/de.json +++ b/internal/locales/de.json @@ -102,6 +102,9 @@ "logs.modal.total_week_note": "Aktivität der letzten Woche", "logs.modal.insights_recurring": "Wiederkehrende IPs", "logs.modal.insights_recurring_empty": "Keine wiederkehrenden IPs erkannt.", + "logs.modal.threat_map_title": "Globale Bedrohungskarte", + "logs.modal.threat_map_hint": "Ziehen zum Drehen, Scrollen zum Zoomen.", + "logs.modal.threat_map_empty": "Keine Geodaten verfügbar.", "filter_debug.title": "Filter-Debug", "filter_debug.select_filter": "Wählen Sie einen Filter", "filter_debug.filter_content": "Filter-Inhalt", diff --git a/internal/locales/de_ch.json b/internal/locales/de_ch.json index 70b50ca..eacaeea 100644 --- a/internal/locales/de_ch.json +++ b/internal/locales/de_ch.json @@ -102,6 +102,9 @@ "logs.modal.total_week_note": "Aktivität vor letschte Wuche", "logs.modal.insights_recurring": "Wiederkehrendi IPs", "logs.modal.insights_recurring_empty": "Ke wiederkehrendi IPs erkannt.", + "logs.modal.threat_map_title": "Globali Bedrohigscharte", + "logs.modal.threat_map_hint": "Zieh zum Dräie, Scroll zum Zoomä.", + "logs.modal.threat_map_empty": "Ke Geodate verfüegbar.", "filter_debug.title": "Filter Debug", "filter_debug.select_filter": "Wähl ä Filter us", "filter_debug.filter_content": "Filter-Inhalt", diff --git a/internal/locales/en.json b/internal/locales/en.json index 15d42d1..1fb2474 100644 --- a/internal/locales/en.json +++ b/internal/locales/en.json @@ -102,6 +102,9 @@ "logs.modal.total_week_note": "Weekly activity", "logs.modal.insights_recurring": "Recurring IPs", "logs.modal.insights_recurring_empty": "No recurring IPs detected.", + "logs.modal.threat_map_title": "Global Threat Map", + "logs.modal.threat_map_hint": "Drag to rotate, scroll to zoom.", + "logs.modal.threat_map_empty": "No geo data available.", "filter_debug.title": "Filter Debug", "filter_debug.select_filter": "Select a Filter", "filter_debug.filter_content": "Filter Content", diff --git a/internal/locales/es.json b/internal/locales/es.json index dcaeb9d..334e12f 100644 --- a/internal/locales/es.json +++ b/internal/locales/es.json @@ -102,6 +102,9 @@ "logs.modal.total_week_note": "Actividad semanal", "logs.modal.insights_recurring": "IPs recurrentes", "logs.modal.insights_recurring_empty": "No se detectaron IPs recurrentes.", + "logs.modal.threat_map_title": "Mapa global de amenazas", + "logs.modal.threat_map_hint": "Arrastrar para girar, desplazar para hacer zoom.", + "logs.modal.threat_map_empty": "No hay datos geográficos disponibles.", "filter_debug.title": "Depuración de filtros", "filter_debug.select_filter": "Selecciona un filtro", "filter_debug.filter_content": "Contenido del filtro", diff --git a/internal/locales/fr.json b/internal/locales/fr.json index 918e4ab..55b9663 100644 --- a/internal/locales/fr.json +++ b/internal/locales/fr.json @@ -102,6 +102,9 @@ "logs.modal.total_week_note": "Activité hebdomadaire", "logs.modal.insights_recurring": "IPs récurrentes", "logs.modal.insights_recurring_empty": "Aucune IP récurrente détectée.", + "logs.modal.threat_map_title": "Carte mondiale des menaces", + "logs.modal.threat_map_hint": "Glisser pour tourner, défiler pour zoomer.", + "logs.modal.threat_map_empty": "Aucune donnée géographique disponible.", "filter_debug.title": "Débogage des filtres", "filter_debug.select_filter": "Sélectionnez un filtre", "filter_debug.filter_content": "Contenu du filtre", diff --git a/internal/locales/it.json b/internal/locales/it.json index 9fb844e..03d9f4b 100644 --- a/internal/locales/it.json +++ b/internal/locales/it.json @@ -102,6 +102,9 @@ "logs.modal.total_week_note": "Attività settimanale", "logs.modal.insights_recurring": "IP ricorrenti", "logs.modal.insights_recurring_empty": "Nessun IP ricorrente rilevato.", + "logs.modal.threat_map_title": "Mappa globale delle minacce", + "logs.modal.threat_map_hint": "Trascinare per ruotare, scorrere per zoomare.", + "logs.modal.threat_map_empty": "Nessun dato geografico disponibile.", "filter_debug.title": "Debug Filtro", "filter_debug.select_filter": "Seleziona un filtro", "filter_debug.filter_content": "Contenuto del filtro", diff --git a/pkg/web/static/js/globe.js b/pkg/web/static/js/globe.js new file mode 100644 index 0000000..8dcb27e --- /dev/null +++ b/pkg/web/static/js/globe.js @@ -0,0 +1,208 @@ +// 3D threat globe for Ban Insights modal. +"use strict"; + +// ========================================================================= +// Country Coordinates (ISO 3166-1 alpha-2 -> lat/lng) +// ========================================================================= + +var COUNTRY_COORDS = { + AF:{lat:33.94,lng:67.71},AL:{lat:41.15,lng:20.17},DZ:{lat:28.03,lng:1.66}, + AS:{lat:-14.27,lng:-170.13},AD:{lat:42.55,lng:1.6},AO:{lat:-11.2,lng:17.87}, + AG:{lat:17.06,lng:-61.8},AR:{lat:-38.42,lng:-63.62},AM:{lat:40.07,lng:45.04}, + AU:{lat:-25.27,lng:133.78},AT:{lat:47.52,lng:14.55},AZ:{lat:40.14,lng:47.58}, + BS:{lat:25.03,lng:-77.4},BH:{lat:26.07,lng:50.56},BD:{lat:23.68,lng:90.36}, + BB:{lat:13.19,lng:-59.54},BY:{lat:53.71,lng:27.95},BE:{lat:50.5,lng:4.47}, + BZ:{lat:17.19,lng:-88.5},BJ:{lat:9.31,lng:2.32},BT:{lat:27.51,lng:90.43}, + BO:{lat:-16.29,lng:-63.59},BA:{lat:43.92,lng:17.68},BW:{lat:-22.33,lng:24.68}, + BR:{lat:-14.24,lng:-51.93},BN:{lat:4.54,lng:114.73},BG:{lat:42.73,lng:25.49}, + BF:{lat:12.24,lng:-1.56},BI:{lat:-3.37,lng:29.92},KH:{lat:12.57,lng:104.99}, + CM:{lat:7.37,lng:12.35},CA:{lat:56.13,lng:-106.35},CV:{lat:16.0,lng:-24.01}, + CF:{lat:6.61,lng:20.94},TD:{lat:15.45,lng:18.73},CL:{lat:-35.68,lng:-71.54}, + CN:{lat:35.86,lng:104.2},CO:{lat:4.57,lng:-74.3},KM:{lat:-11.88,lng:43.87}, + CG:{lat:-0.23,lng:15.83},CD:{lat:-4.04,lng:21.76},CR:{lat:9.75,lng:-83.75}, + CI:{lat:7.54,lng:-5.55},HR:{lat:45.1,lng:15.2},CU:{lat:21.52,lng:-77.78}, + CY:{lat:35.13,lng:33.43},CZ:{lat:49.82,lng:15.47},DK:{lat:56.26,lng:9.5}, + DJ:{lat:11.83,lng:42.59},DM:{lat:15.41,lng:-61.37},DO:{lat:18.74,lng:-70.16}, + EC:{lat:-1.83,lng:-78.18},EG:{lat:26.82,lng:30.8},SV:{lat:13.79,lng:-88.9}, + GQ:{lat:1.65,lng:10.27},ER:{lat:15.18,lng:39.78},EE:{lat:58.6,lng:25.01}, + ET:{lat:9.15,lng:40.49},FJ:{lat:-17.71,lng:178.07},FI:{lat:61.92,lng:25.75}, + FR:{lat:46.23,lng:2.21},GA:{lat:-0.8,lng:11.61},GM:{lat:13.44,lng:-15.31}, + GE:{lat:42.32,lng:43.36},DE:{lat:51.17,lng:10.45},GH:{lat:7.95,lng:-1.02}, + GR:{lat:39.07,lng:21.82},GD:{lat:12.12,lng:-61.68},GT:{lat:15.78,lng:-90.23}, + GN:{lat:9.95,lng:-9.7},GW:{lat:11.8,lng:-15.18},GY:{lat:4.86,lng:-58.93}, + HT:{lat:18.97,lng:-72.29},HN:{lat:15.2,lng:-86.24},HU:{lat:47.16,lng:19.5}, + IS:{lat:64.96,lng:-19.02},IN:{lat:20.59,lng:78.96},ID:{lat:-0.79,lng:113.92}, + IR:{lat:32.43,lng:53.69},IQ:{lat:33.22,lng:43.68},IE:{lat:53.41,lng:-8.24}, + IL:{lat:31.05,lng:34.85},IT:{lat:41.87,lng:12.57},JM:{lat:18.11,lng:-77.3}, + JP:{lat:36.2,lng:138.25},JO:{lat:30.59,lng:36.24},KZ:{lat:48.02,lng:66.92}, + KE:{lat:-0.02,lng:37.91},KI:{lat:-3.37,lng:-168.73},KP:{lat:40.34,lng:127.51}, + KR:{lat:35.91,lng:127.77},KW:{lat:29.31,lng:47.48},KG:{lat:41.2,lng:74.77}, + LA:{lat:19.86,lng:102.5},LV:{lat:56.88,lng:24.6},LB:{lat:33.85,lng:35.86}, + LS:{lat:-29.61,lng:28.23},LR:{lat:6.43,lng:-9.43},LY:{lat:26.34,lng:17.23}, + LI:{lat:47.17,lng:9.56},LT:{lat:55.17,lng:23.88},LU:{lat:49.82,lng:6.13}, + MK:{lat:41.51,lng:21.75},MG:{lat:-18.77,lng:46.87},MW:{lat:-13.25,lng:34.3}, + MY:{lat:4.21,lng:101.98},MV:{lat:3.2,lng:73.22},ML:{lat:17.57,lng:-4.0}, + MT:{lat:35.94,lng:14.38},MH:{lat:7.13,lng:171.18},MR:{lat:21.01,lng:-10.94}, + MU:{lat:-20.35,lng:57.55},MX:{lat:23.63,lng:-102.55},FM:{lat:7.43,lng:150.55}, + MD:{lat:47.41,lng:28.37},MC:{lat:43.75,lng:7.41},MN:{lat:46.86,lng:103.85}, + ME:{lat:42.71,lng:19.37},MA:{lat:31.79,lng:-7.09},MZ:{lat:-18.67,lng:35.53}, + MM:{lat:21.91,lng:95.96},NA:{lat:-22.96,lng:18.49},NR:{lat:-0.52,lng:166.93}, + NP:{lat:28.39,lng:84.12},NL:{lat:52.13,lng:5.29},NZ:{lat:-40.9,lng:174.89}, + NI:{lat:12.87,lng:-85.21},NE:{lat:17.61,lng:8.08},NG:{lat:9.08,lng:8.68}, + NO:{lat:60.47,lng:8.47},OM:{lat:21.47,lng:55.98},PK:{lat:30.38,lng:69.35}, + PW:{lat:7.51,lng:134.58},PA:{lat:8.54,lng:-80.78},PG:{lat:-6.31,lng:143.96}, + PY:{lat:-23.44,lng:-58.44},PE:{lat:-9.19,lng:-75.02},PH:{lat:12.88,lng:121.77}, + PL:{lat:51.92,lng:19.15},PT:{lat:39.4,lng:-8.22},QA:{lat:25.35,lng:51.18}, + RO:{lat:45.94,lng:24.97},RU:{lat:61.52,lng:105.32},RW:{lat:-1.94,lng:29.87}, + KN:{lat:17.36,lng:-62.78},LC:{lat:13.91,lng:-60.98},VC:{lat:12.98,lng:-61.29}, + WS:{lat:-13.76,lng:-172.1},SM:{lat:43.94,lng:12.46},ST:{lat:0.19,lng:6.61}, + SA:{lat:23.89,lng:45.08},SN:{lat:14.5,lng:-14.45},RS:{lat:44.02,lng:21.01}, + SC:{lat:-4.68,lng:55.49},SL:{lat:8.46,lng:-11.78},SG:{lat:1.35,lng:103.82}, + SK:{lat:48.67,lng:19.7},SI:{lat:46.15,lng:14.99},SB:{lat:-9.65,lng:160.16}, + SO:{lat:5.15,lng:46.2},ZA:{lat:-30.56,lng:22.94},SS:{lat:6.88,lng:31.31}, + ES:{lat:40.46,lng:-3.75},LK:{lat:7.87,lng:80.77},SD:{lat:12.86,lng:30.22}, + SR:{lat:3.92,lng:-56.03},SZ:{lat:-26.52,lng:31.47},SE:{lat:60.13,lng:18.64}, + CH:{lat:46.82,lng:8.23},SY:{lat:34.8,lng:38.99},TW:{lat:23.7,lng:120.96}, + TJ:{lat:38.86,lng:71.28},TZ:{lat:-6.37,lng:34.89},TH:{lat:15.87,lng:100.99}, + TL:{lat:-8.87,lng:125.73},TG:{lat:8.62,lng:1.21},TO:{lat:-21.18,lng:-175.2}, + TT:{lat:10.69,lng:-61.22},TN:{lat:33.89,lng:9.54},TR:{lat:38.96,lng:35.24}, + TM:{lat:38.97,lng:59.56},TV:{lat:-7.11,lng:177.65},UG:{lat:1.37,lng:32.29}, + UA:{lat:48.38,lng:31.17},AE:{lat:23.42,lng:53.85},GB:{lat:55.38,lng:-3.44}, + US:{lat:37.09,lng:-95.71},UY:{lat:-32.52,lng:-55.77},UZ:{lat:41.38,lng:64.59}, + VU:{lat:-15.38,lng:166.96},VE:{lat:6.42,lng:-66.59},VN:{lat:14.06,lng:108.28}, + YE:{lat:15.55,lng:48.52},ZM:{lat:-13.13,lng:27.85},ZW:{lat:-19.02,lng:29.15}, + PS:{lat:31.95,lng:35.23},HK:{lat:22.4,lng:114.11},XK:{lat:42.6,lng:20.9}, + PR:{lat:18.22,lng:-66.59},RE:{lat:-21.12,lng:55.54},GP:{lat:16.27,lng:-61.55}, + MQ:{lat:14.64,lng:-61.02},GF:{lat:3.93,lng:-53.13},YT:{lat:-12.83,lng:45.17}, + NC:{lat:-20.9,lng:165.62},PF:{lat:-17.68,lng:-149.41},CW:{lat:12.17,lng:-68.98}, + SX:{lat:18.04,lng:-63.05},AW:{lat:12.51,lng:-69.97} +}; + +// ========================================================================= +// Globe State +// ========================================================================= + +var _globeInstance = null; +var _globeResizeObserver = null; + +// ========================================================================= +// Color Helper +// ========================================================================= + +// Returns an rgba string interpolating from blue (low) to red (high). +function _threatColor(ratio) { + var r = Math.round(30 + 225 * ratio); + var g = Math.round(100 * (1 - ratio)); + var b = Math.round(220 * (1 - ratio)); + return 'rgba(' + r + ',' + g + ',' + b + ',0.9)'; +} + +// ========================================================================= +// Render +// ========================================================================= + +function renderInsightsGlobe() { + if (typeof Globe === 'undefined') return; + + var container = document.getElementById('insightsGlobe'); + if (!container) return; + + destroyInsightsGlobe(); + + var countries = (latestBanInsights && latestBanInsights.countries) || []; + if (!countries.length) { + var emptyMsg = (translations && translations['logs.modal.threat_map_empty']) || 'No geo data available.'; + container.innerHTML = '

' + escapeHtml(emptyMsg) + '

'; + return; + } + + var maxCount = 1; + countries.forEach(function(s) { + if (s.count > maxCount) maxCount = s.count; + }); + + var points = []; + countries.forEach(function(s) { + var code = (s.country || '').toUpperCase(); + var coords = COUNTRY_COORDS[code]; + if (!coords) return; + var ratio = Math.min(s.count / maxCount, 1); + points.push({ + lat: coords.lat, + lng: coords.lng, + alt: 0.06 + 0.7 * ratio, + radius: 0.4 + 0.6 * ratio, + color: _threatColor(ratio), + label: '
' + + '' + escapeHtml(s.country || '??') + '
' + + formatNumber(s.count) + ' ban' + (s.count !== 1 ? 's' : '') + '
', + country: s.country, + count: s.count + }); + }); + + var width = container.clientWidth || 600; + var height = container.clientHeight || 420; + + var globe = Globe() + .width(width) + .height(height) + .backgroundColor('rgba(0,0,0,0)') + .showAtmosphere(true) + .atmosphereColor('#3b82f6') + .atmosphereAltitude(0.15) + .globeImageUrl('//unpkg.com/three-globe/example/img/earth-night.jpg') + .pointsData(points) + .pointLat('lat') + .pointLng('lng') + .pointAltitude('alt') + .pointRadius('radius') + .pointColor('color') + .pointLabel('label') + .pointsMerge(false) + (container); + + globe.pointOfView({ lat: 30, lng: 10, altitude: 2.2 }); + + var controls = globe.controls(); + if (controls) { + controls.autoRotate = true; + controls.autoRotateSpeed = 0.4; + controls.enableZoom = true; + controls.minDistance = 120; + controls.maxDistance = 500; + } + + _globeInstance = globe; + + _globeResizeObserver = new ResizeObserver(function(entries) { + for (var i = 0; i < entries.length; i++) { + var rect = entries[i].contentRect; + if (_globeInstance && rect.width > 0 && rect.height > 0) { + _globeInstance.width(rect.width).height(rect.height); + } + } + }); + _globeResizeObserver.observe(container); +} + +// ========================================================================= +// Cleanup Globe +// ========================================================================= + +function destroyInsightsGlobe() { + if (_globeResizeObserver) { + _globeResizeObserver.disconnect(); + _globeResizeObserver = null; + } + if (_globeInstance) { + _globeInstance.pauseAnimation(); + _globeInstance._destructor && _globeInstance._destructor(); + _globeInstance = null; + } + var container = document.getElementById('insightsGlobe'); + if (container) { + container.innerHTML = ''; + } +} diff --git a/pkg/web/static/js/modals.js b/pkg/web/static/js/modals.js index 52bf1e9..077ec21 100644 --- a/pkg/web/static/js/modals.js +++ b/pkg/web/static/js/modals.js @@ -18,6 +18,9 @@ function closeModal(modalId) { if (!modal || modal.classList.contains('hidden')) { return; } + if (modalId === 'banInsightsModal' && typeof destroyInsightsGlobe === 'function') { + destroyInsightsGlobe(); + } modal.classList.add('hidden'); openModalCount = Math.max(0, openModalCount - 1); updateBodyScrollLock(); @@ -186,6 +189,9 @@ function openBanInsightsModal() { updateTranslations(); } openModal('banInsightsModal'); + if (typeof renderInsightsGlobe === 'function') { + setTimeout(renderInsightsGlobe, 150); + } } // ========================================================================= diff --git a/pkg/web/static/vendor/globe/countries-110m.json b/pkg/web/static/vendor/globe/countries-110m.json new file mode 100644 index 0000000..055d19f --- /dev/null +++ b/pkg/web/static/vendor/globe/countries-110m.json @@ -0,0 +1 @@ +{"type":"Topology","objects":{"countries":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","arcs":[[[0]],[[1]]],"id":"242","properties":{"name":"Fiji"}},{"type":"Polygon","arcs":[[2,3,4,5,6,7,8,9,10]],"id":"834","properties":{"name":"Tanzania"}},{"type":"Polygon","arcs":[[11,12,13,14]],"id":"732","properties":{"name":"W. Sahara"}},{"type":"MultiPolygon","arcs":[[[15,16,17,18]],[[19]],[[20]],[[21]],[[22]],[[23]],[[24]],[[25]],[[26]],[[27]],[[28]],[[29]],[[30]],[[31]],[[32]],[[33]],[[34]],[[35]],[[36]],[[37]],[[38]],[[39]],[[40]],[[41]],[[42]],[[43]],[[44]],[[45]],[[46]],[[47]]],"id":"124","properties":{"name":"Canada"}},{"type":"MultiPolygon","arcs":[[[-19,48,49,50]],[[51]],[[52]],[[53]],[[54]],[[55]],[[56]],[[57]],[[-17,58]],[[59]]],"id":"840","properties":{"name":"United States of America"}},{"type":"Polygon","arcs":[[60,61,62,63,64,65]],"id":"398","properties":{"name":"Kazakhstan"}},{"type":"Polygon","arcs":[[-63,66,67,68,69]],"id":"860","properties":{"name":"Uzbekistan"}},{"type":"MultiPolygon","arcs":[[[70,71]],[[72]],[[73]],[[74]]],"id":"598","properties":{"name":"Papua New Guinea"}},{"type":"MultiPolygon","arcs":[[[-72,75]],[[76,77]],[[78]],[[79,80]],[[81]],[[82]],[[83]],[[84]],[[85]],[[86]],[[87]],[[88]],[[89]]],"id":"360","properties":{"name":"Indonesia"}},{"type":"MultiPolygon","arcs":[[[90,91]],[[92,93,94,95,96,97]]],"id":"032","properties":{"name":"Argentina"}},{"type":"MultiPolygon","arcs":[[[-92,98]],[[99,-95,100,101]]],"id":"152","properties":{"name":"Chile"}},{"type":"Polygon","arcs":[[-8,102,103,104,105,106,107,108,109,110,111]],"id":"180","properties":{"name":"Dem. Rep. Congo"}},{"type":"Polygon","arcs":[[112,113,114,115]],"id":"706","properties":{"name":"Somalia"}},{"type":"Polygon","arcs":[[-3,116,117,118,-113,119]],"id":"404","properties":{"name":"Kenya"}},{"type":"Polygon","arcs":[[120,121,122,123,124,125,126,127]],"id":"729","properties":{"name":"Sudan"}},{"type":"Polygon","arcs":[[-122,128,129,130,131]],"id":"148","properties":{"name":"Chad"}},{"type":"Polygon","arcs":[[132,133]],"id":"332","properties":{"name":"Haiti"}},{"type":"Polygon","arcs":[[-133,134]],"id":"214","properties":{"name":"Dominican Rep."}},{"type":"MultiPolygon","arcs":[[[135]],[[136]],[[137]],[[138]],[[139]],[[140]],[[141,142,143]],[[144]],[[145]],[[146,147,148,149,-66,150,151,152,153,154,155,156,157,158,159,160,161]],[[162]],[[163,164]]],"id":"643","properties":{"name":"Russia"}},{"type":"MultiPolygon","arcs":[[[165]],[[166]],[[167]]],"id":"044","properties":{"name":"Bahamas"}},{"type":"Polygon","arcs":[[168]],"id":"238","properties":{"name":"Falkland Is."}},{"type":"MultiPolygon","arcs":[[[169]],[[-161,170,171,172]],[[173]],[[174]]],"id":"578","properties":{"name":"Norway"}},{"type":"Polygon","arcs":[[175]],"id":"304","properties":{"name":"Greenland"}},{"type":"Polygon","arcs":[[176]],"id":"260","properties":{"name":"Fr. S. Antarctic Lands"}},{"type":"Polygon","arcs":[[177,-77]],"id":"626","properties":{"name":"Timor-Leste"}},{"type":"Polygon","arcs":[[178,179,180,181,182,183,184],[185]],"id":"710","properties":{"name":"South Africa"}},{"type":"Polygon","arcs":[[-186]],"id":"426","properties":{"name":"Lesotho"}},{"type":"Polygon","arcs":[[-50,186,187,188,189]],"id":"484","properties":{"name":"Mexico"}},{"type":"Polygon","arcs":[[190,191,-93]],"id":"858","properties":{"name":"Uruguay"}},{"type":"Polygon","arcs":[[-191,-98,192,193,194,195,196,197,198,199,200]],"id":"076","properties":{"name":"Brazil"}},{"type":"Polygon","arcs":[[-194,201,-96,-100,202]],"id":"068","properties":{"name":"Bolivia"}},{"type":"Polygon","arcs":[[-195,-203,-102,203,204,205]],"id":"604","properties":{"name":"Peru"}},{"type":"Polygon","arcs":[[-196,-206,206,207,208,209,210]],"id":"170","properties":{"name":"Colombia"}},{"type":"Polygon","arcs":[[-209,211,212,213]],"id":"591","properties":{"name":"Panama"}},{"type":"Polygon","arcs":[[-213,214,215,216]],"id":"188","properties":{"name":"Costa Rica"}},{"type":"Polygon","arcs":[[-216,217,218,219]],"id":"558","properties":{"name":"Nicaragua"}},{"type":"Polygon","arcs":[[-219,220,221,222,223]],"id":"340","properties":{"name":"Honduras"}},{"type":"Polygon","arcs":[[-222,224,225]],"id":"222","properties":{"name":"El Salvador"}},{"type":"Polygon","arcs":[[-189,226,227,-223,-226,228]],"id":"320","properties":{"name":"Guatemala"}},{"type":"Polygon","arcs":[[-188,229,-227]],"id":"084","properties":{"name":"Belize"}},{"type":"Polygon","arcs":[[-197,-211,230,231]],"id":"862","properties":{"name":"Venezuela"}},{"type":"Polygon","arcs":[[-198,-232,232,233]],"id":"328","properties":{"name":"Guyana"}},{"type":"Polygon","arcs":[[-199,-234,234,235]],"id":"740","properties":{"name":"Suriname"}},{"type":"MultiPolygon","arcs":[[[-200,-236,236]],[[237,238,239,240,241,242,243,244]],[[245]]],"id":"250","properties":{"name":"France"}},{"type":"Polygon","arcs":[[-205,246,-207]],"id":"218","properties":{"name":"Ecuador"}},{"type":"Polygon","arcs":[[247]],"id":"630","properties":{"name":"Puerto Rico"}},{"type":"Polygon","arcs":[[248]],"id":"388","properties":{"name":"Jamaica"}},{"type":"Polygon","arcs":[[249]],"id":"192","properties":{"name":"Cuba"}},{"type":"Polygon","arcs":[[-181,250,251,252]],"id":"716","properties":{"name":"Zimbabwe"}},{"type":"Polygon","arcs":[[-180,253,254,-251]],"id":"072","properties":{"name":"Botswana"}},{"type":"Polygon","arcs":[[-179,255,256,257,-254]],"id":"516","properties":{"name":"Namibia"}},{"type":"Polygon","arcs":[[258,259,260,261,262,263,264]],"id":"686","properties":{"name":"Senegal"}},{"type":"Polygon","arcs":[[-261,265,266,267,268,269,270]],"id":"466","properties":{"name":"Mali"}},{"type":"Polygon","arcs":[[-13,271,-266,-260,272]],"id":"478","properties":{"name":"Mauritania"}},{"type":"Polygon","arcs":[[273,274,275,276,277]],"id":"204","properties":{"name":"Benin"}},{"type":"Polygon","arcs":[[-131,278,279,-277,280,-268,281,282]],"id":"562","properties":{"name":"Niger"}},{"type":"Polygon","arcs":[[-278,-280,283,284]],"id":"566","properties":{"name":"Nigeria"}},{"type":"Polygon","arcs":[[-130,285,286,287,288,289,-284,-279]],"id":"120","properties":{"name":"Cameroon"}},{"type":"Polygon","arcs":[[-275,290,291,292]],"id":"768","properties":{"name":"Togo"}},{"type":"Polygon","arcs":[[-292,293,294,295]],"id":"288","properties":{"name":"Ghana"}},{"type":"Polygon","arcs":[[-270,296,-295,297,298,299]],"id":"384","properties":{"name":"Côte d'Ivoire"}},{"type":"Polygon","arcs":[[-262,-271,-300,300,301,302,303]],"id":"324","properties":{"name":"Guinea"}},{"type":"Polygon","arcs":[[-263,-304,304]],"id":"624","properties":{"name":"Guinea-Bissau"}},{"type":"Polygon","arcs":[[-299,305,306,-301]],"id":"430","properties":{"name":"Liberia"}},{"type":"Polygon","arcs":[[-302,-307,307]],"id":"694","properties":{"name":"Sierra Leone"}},{"type":"Polygon","arcs":[[-269,-281,-276,-293,-296,-297]],"id":"854","properties":{"name":"Burkina Faso"}},{"type":"Polygon","arcs":[[-108,308,-286,-129,-121,309]],"id":"140","properties":{"name":"Central African Rep."}},{"type":"Polygon","arcs":[[-107,310,311,312,-287,-309]],"id":"178","properties":{"name":"Congo"}},{"type":"Polygon","arcs":[[-288,-313,313,314]],"id":"266","properties":{"name":"Gabon"}},{"type":"Polygon","arcs":[[-289,-315,315]],"id":"226","properties":{"name":"Eq. Guinea"}},{"type":"Polygon","arcs":[[-7,316,317,-252,-255,-258,318,-103]],"id":"894","properties":{"name":"Zambia"}},{"type":"Polygon","arcs":[[-6,319,-317]],"id":"454","properties":{"name":"Malawi"}},{"type":"Polygon","arcs":[[-5,320,-184,321,-182,-253,-318,-320]],"id":"508","properties":{"name":"Mozambique"}},{"type":"Polygon","arcs":[[-183,-322]],"id":"748","properties":{"name":"eSwatini"}},{"type":"MultiPolygon","arcs":[[[-106,322,-311]],[[-104,-319,-257,323]]],"id":"024","properties":{"name":"Angola"}},{"type":"Polygon","arcs":[[-9,-112,324]],"id":"108","properties":{"name":"Burundi"}},{"type":"Polygon","arcs":[[325,326,327,328,329,330,331]],"id":"376","properties":{"name":"Israel"}},{"type":"Polygon","arcs":[[-331,332,333]],"id":"422","properties":{"name":"Lebanon"}},{"type":"Polygon","arcs":[[334]],"id":"450","properties":{"name":"Madagascar"}},{"type":"Polygon","arcs":[[-327,335]],"id":"275","properties":{"name":"Palestine"}},{"type":"Polygon","arcs":[[-265,336]],"id":"270","properties":{"name":"Gambia"}},{"type":"Polygon","arcs":[[337,338,339]],"id":"788","properties":{"name":"Tunisia"}},{"type":"Polygon","arcs":[[-12,340,341,-338,342,-282,-267,-272]],"id":"012","properties":{"name":"Algeria"}},{"type":"Polygon","arcs":[[-326,343,344,345,346,-328,-336]],"id":"400","properties":{"name":"Jordan"}},{"type":"Polygon","arcs":[[347,348,349,350,351]],"id":"784","properties":{"name":"United Arab Emirates"}},{"type":"Polygon","arcs":[[352,353]],"id":"634","properties":{"name":"Qatar"}},{"type":"Polygon","arcs":[[354,355,356]],"id":"414","properties":{"name":"Kuwait"}},{"type":"Polygon","arcs":[[-345,357,358,359,360,-357,361]],"id":"368","properties":{"name":"Iraq"}},{"type":"MultiPolygon","arcs":[[[-351,362,363,364]],[[-349,365]]],"id":"512","properties":{"name":"Oman"}},{"type":"MultiPolygon","arcs":[[[366]],[[367]]],"id":"548","properties":{"name":"Vanuatu"}},{"type":"Polygon","arcs":[[368,369,370,371]],"id":"116","properties":{"name":"Cambodia"}},{"type":"Polygon","arcs":[[-369,372,373,374,375,376]],"id":"764","properties":{"name":"Thailand"}},{"type":"Polygon","arcs":[[-370,-377,377,378,379]],"id":"418","properties":{"name":"Laos"}},{"type":"Polygon","arcs":[[-376,380,381,382,383,-378]],"id":"104","properties":{"name":"Myanmar"}},{"type":"Polygon","arcs":[[-371,-380,384,385]],"id":"704","properties":{"name":"Vietnam"}},{"type":"MultiPolygon","arcs":[[[386,386,386]],[[-147,387,388,389,390]]],"id":"408","properties":{"name":"North Korea"}},{"type":"Polygon","arcs":[[-389,391]],"id":"410","properties":{"name":"South Korea"}},{"type":"Polygon","arcs":[[-149,392]],"id":"496","properties":{"name":"Mongolia"}},{"type":"Polygon","arcs":[[-383,393,394,395,396,397,398,399,400]],"id":"356","properties":{"name":"India"}},{"type":"Polygon","arcs":[[-382,401,-394]],"id":"050","properties":{"name":"Bangladesh"}},{"type":"Polygon","arcs":[[-400,402]],"id":"064","properties":{"name":"Bhutan"}},{"type":"Polygon","arcs":[[-398,403]],"id":"524","properties":{"name":"Nepal"}},{"type":"Polygon","arcs":[[-396,404,405,406,407]],"id":"586","properties":{"name":"Pakistan"}},{"type":"Polygon","arcs":[[-69,408,409,-407,410,411]],"id":"004","properties":{"name":"Afghanistan"}},{"type":"Polygon","arcs":[[-68,412,413,-409]],"id":"762","properties":{"name":"Tajikistan"}},{"type":"Polygon","arcs":[[-62,414,-413,-67]],"id":"417","properties":{"name":"Kyrgyzstan"}},{"type":"Polygon","arcs":[[-64,-70,-412,415,416]],"id":"795","properties":{"name":"Turkmenistan"}},{"type":"Polygon","arcs":[[-360,417,418,419,420,421,-416,-411,-406,422]],"id":"364","properties":{"name":"Iran"}},{"type":"Polygon","arcs":[[-332,-334,423,424,-358,-344]],"id":"760","properties":{"name":"Syria"}},{"type":"Polygon","arcs":[[-420,425,426,427,428]],"id":"051","properties":{"name":"Armenia"}},{"type":"Polygon","arcs":[[-172,429,430]],"id":"752","properties":{"name":"Sweden"}},{"type":"Polygon","arcs":[[-156,431,432,433,434]],"id":"112","properties":{"name":"Belarus"}},{"type":"Polygon","arcs":[[-155,435,-164,436,437,438,439,440,441,442,-432]],"id":"804","properties":{"name":"Ukraine"}},{"type":"Polygon","arcs":[[-433,-443,443,444,445,446,-142,447]],"id":"616","properties":{"name":"Poland"}},{"type":"Polygon","arcs":[[448,449,450,451,452,453,454]],"id":"040","properties":{"name":"Austria"}},{"type":"Polygon","arcs":[[-441,455,456,457,458,-449,459]],"id":"348","properties":{"name":"Hungary"}},{"type":"Polygon","arcs":[[-439,460]],"id":"498","properties":{"name":"Moldova"}},{"type":"Polygon","arcs":[[-438,461,462,463,-456,-440,-461]],"id":"642","properties":{"name":"Romania"}},{"type":"Polygon","arcs":[[-434,-448,-144,464,465]],"id":"440","properties":{"name":"Lithuania"}},{"type":"Polygon","arcs":[[-157,-435,-466,466,467]],"id":"428","properties":{"name":"Latvia"}},{"type":"Polygon","arcs":[[-158,-468,468]],"id":"233","properties":{"name":"Estonia"}},{"type":"Polygon","arcs":[[-446,469,-453,470,-238,471,472,473,474,475,476]],"id":"276","properties":{"name":"Germany"}},{"type":"Polygon","arcs":[[-463,477,478,479,480,481]],"id":"100","properties":{"name":"Bulgaria"}},{"type":"MultiPolygon","arcs":[[[482]],[[-480,483,484,485,486]]],"id":"300","properties":{"name":"Greece"}},{"type":"MultiPolygon","arcs":[[[-359,-425,487,488,-427,-418]],[[-479,489,-484]]],"id":"792","properties":{"name":"Turkey"}},{"type":"Polygon","arcs":[[-486,490,491,492,493]],"id":"008","properties":{"name":"Albania"}},{"type":"Polygon","arcs":[[-458,494,495,496,497,498]],"id":"191","properties":{"name":"Croatia"}},{"type":"Polygon","arcs":[[-452,499,-239,-471]],"id":"756","properties":{"name":"Switzerland"}},{"type":"Polygon","arcs":[[-472,-245,500]],"id":"442","properties":{"name":"Luxembourg"}},{"type":"Polygon","arcs":[[-473,-501,-244,501,502]],"id":"056","properties":{"name":"Belgium"}},{"type":"Polygon","arcs":[[-474,-503,503]],"id":"528","properties":{"name":"Netherlands"}},{"type":"Polygon","arcs":[[504,505]],"id":"620","properties":{"name":"Portugal"}},{"type":"Polygon","arcs":[[-505,506,-242,507]],"id":"724","properties":{"name":"Spain"}},{"type":"Polygon","arcs":[[508,509]],"id":"372","properties":{"name":"Ireland"}},{"type":"Polygon","arcs":[[510]],"id":"540","properties":{"name":"New Caledonia"}},{"type":"MultiPolygon","arcs":[[[511]],[[512]],[[513]],[[514]],[[515]]],"id":"090","properties":{"name":"Solomon Is."}},{"type":"MultiPolygon","arcs":[[[516]],[[517]]],"id":"554","properties":{"name":"New Zealand"}},{"type":"MultiPolygon","arcs":[[[518]],[[519]]],"id":"036","properties":{"name":"Australia"}},{"type":"Polygon","arcs":[[520]],"id":"144","properties":{"name":"Sri Lanka"}},{"type":"MultiPolygon","arcs":[[[521]],[[-61,-150,-393,-148,-391,522,-385,-379,-384,-401,-403,-399,-404,-397,-408,-410,-414,-415]]],"id":"156","properties":{"name":"China"}},{"type":"Polygon","arcs":[[523]],"id":"158","properties":{"name":"Taiwan"}},{"type":"MultiPolygon","arcs":[[[-451,524,525,-240,-500]],[[526]],[[527]]],"id":"380","properties":{"name":"Italy"}},{"type":"MultiPolygon","arcs":[[[-476,528]],[[529]]],"id":"208","properties":{"name":"Denmark"}},{"type":"MultiPolygon","arcs":[[[-510,530]],[[531]]],"id":"826","properties":{"name":"United Kingdom"}},{"type":"Polygon","arcs":[[532]],"id":"352","properties":{"name":"Iceland"}},{"type":"MultiPolygon","arcs":[[[-152,533,-421,-429,534]],[[-419,-426]]],"id":"031","properties":{"name":"Azerbaijan"}},{"type":"Polygon","arcs":[[-153,-535,-428,-489,535]],"id":"268","properties":{"name":"Georgia"}},{"type":"MultiPolygon","arcs":[[[536]],[[537]],[[538]],[[539]],[[540]],[[541]],[[542]]],"id":"608","properties":{"name":"Philippines"}},{"type":"MultiPolygon","arcs":[[[-374,543]],[[-81,544,545,546]]],"id":"458","properties":{"name":"Malaysia"}},{"type":"Polygon","arcs":[[-546,547]],"id":"096","properties":{"name":"Brunei"}},{"type":"Polygon","arcs":[[-450,-459,-499,548,-525]],"id":"705","properties":{"name":"Slovenia"}},{"type":"Polygon","arcs":[[-160,549,-430,-171]],"id":"246","properties":{"name":"Finland"}},{"type":"Polygon","arcs":[[-442,-460,-455,550,-444]],"id":"703","properties":{"name":"Slovakia"}},{"type":"Polygon","arcs":[[-445,-551,-454,-470]],"id":"203","properties":{"name":"Czechia"}},{"type":"Polygon","arcs":[[-126,551,552,553]],"id":"232","properties":{"name":"Eritrea"}},{"type":"MultiPolygon","arcs":[[[554]],[[555]],[[556]]],"id":"392","properties":{"name":"Japan"}},{"type":"Polygon","arcs":[[-193,-97,-202]],"id":"600","properties":{"name":"Paraguay"}},{"type":"Polygon","arcs":[[-364,557,558]],"id":"887","properties":{"name":"Yemen"}},{"type":"Polygon","arcs":[[-346,-362,-356,559,-354,560,-352,-365,-559,561]],"id":"682","properties":{"name":"Saudi Arabia"}},{"type":"MultiPolygon","arcs":[[[562]],[[563]],[[564]],[[565]],[[566]],[[567]],[[568]],[[569]]],"id":"010","properties":{"name":"Antarctica"}},{"type":"Polygon","arcs":[[570,571]],"properties":{"name":"N. Cyprus"}},{"type":"Polygon","arcs":[[-572,572]],"id":"196","properties":{"name":"Cyprus"}},{"type":"Polygon","arcs":[[-341,-15,573]],"id":"504","properties":{"name":"Morocco"}},{"type":"Polygon","arcs":[[-124,574,575,-329,576]],"id":"818","properties":{"name":"Egypt"}},{"type":"Polygon","arcs":[[-123,-132,-283,-343,-340,577,-575]],"id":"434","properties":{"name":"Libya"}},{"type":"Polygon","arcs":[[-114,-119,578,-127,-554,579,580]],"id":"231","properties":{"name":"Ethiopia"}},{"type":"Polygon","arcs":[[-553,581,582,-580]],"id":"262","properties":{"name":"Djibouti"}},{"type":"Polygon","arcs":[[-115,-581,-583,583]],"properties":{"name":"Somaliland"}},{"type":"Polygon","arcs":[[-11,584,-110,585,-117]],"id":"800","properties":{"name":"Uganda"}},{"type":"Polygon","arcs":[[-10,-325,-111,-585]],"id":"646","properties":{"name":"Rwanda"}},{"type":"Polygon","arcs":[[-496,586,587]],"id":"070","properties":{"name":"Bosnia and Herz."}},{"type":"Polygon","arcs":[[-481,-487,-494,588,589]],"id":"807","properties":{"name":"Macedonia"}},{"type":"Polygon","arcs":[[-457,-464,-482,-590,590,591,-587,-495]],"id":"688","properties":{"name":"Serbia"}},{"type":"Polygon","arcs":[[-492,592,-497,-588,-592,593]],"id":"499","properties":{"name":"Montenegro"}},{"type":"Polygon","arcs":[[-493,-594,-591,-589]],"properties":{"name":"Kosovo"}},{"type":"Polygon","arcs":[[594]],"id":"780","properties":{"name":"Trinidad and Tobago"}},{"type":"Polygon","arcs":[[-109,-310,-128,-579,-118,-586]],"id":"728","properties":{"name":"S. Sudan"}}]},"land":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","arcs":[[[0]],[[1]],[[3,320,184,255,323,104,322,311,313,315,289,284,273,290,293,297,305,307,302,304,263,336,258,272,13,573,341,338,577,575,329,332,423,487,535,153,435,164,436,461,477,489,484,490,592,497,548,525,240,507,505,506,242,501,503,474,528,476,446,142,464,466,468,158,549,430,172,161,387,391,389,522,385,371,372,543,374,380,401,394,404,422,360,354,559,352,560,347,365,349,362,557,561,346,576,124,551,581,583,115,119],[421,416,64,150,533]],[[17,48,186,229,227,223,219,216,213,209,230,232,234,236,200,191,93,100,203,246,207,211,214,217,220,224,228,189,50,15,58]],[[19]],[[20]],[[21]],[[22]],[[23]],[[24]],[[25]],[[26]],[[27]],[[28]],[[29]],[[30]],[[31]],[[32]],[[33]],[[34]],[[35]],[[36]],[[37]],[[38]],[[39]],[[40]],[[41]],[[42]],[[43]],[[44]],[[45]],[[46]],[[47]],[[51]],[[52]],[[53]],[[54]],[[55]],[[56]],[[57]],[[59]],[[70,75]],[[72]],[[73]],[[74]],[[77,177]],[[78]],[[546,79,544,547]],[[81]],[[82]],[[83]],[[84]],[[85]],[[86]],[[87]],[[88]],[[89]],[[90,98]],[[133,134]],[[135]],[[136]],[[137]],[[138]],[[139]],[[140]],[[144]],[[145]],[[162]],[[165]],[[166]],[[167]],[[168]],[[169]],[[173]],[[174]],[[175]],[[176]],[[245]],[[247]],[[248]],[[249]],[[334]],[[366]],[[367]],[[482]],[[508,530]],[[510]],[[511]],[[512]],[[513]],[[514]],[[515]],[[516]],[[517]],[[518]],[[519]],[[520]],[[521]],[[523]],[[526]],[[527]],[[529]],[[531]],[[532]],[[536]],[[537]],[[538]],[[539]],[[540]],[[541]],[[542]],[[554]],[[555]],[[556]],[[562]],[[563]],[[564]],[[565]],[[566]],[[567]],[[568]],[[569]],[[570,572]],[[594]]]}]}},"arcs":[[[99478,40237],[69,98],[96,-171],[-46,-308],[-172,-81],[-153,73],[-27,260],[107,203],[126,-74]],[[0,41087],[57,27],[-34,-284],[-23,-32],[99822,-145],[-177,-124],[-36,220],[139,121],[88,33],[163,184],[-99999,0]],[[59417,50018],[47,-65],[1007,-1203],[19,-343],[399,-590]],[[60889,47817],[-128,-728],[16,-335],[178,-216],[8,-153],[-76,-357],[16,-180],[-18,-282],[97,-370],[115,-583],[101,-129]],[[61198,44484],[-221,-342],[-303,-230],[-167,10],[-99,-177],[-193,-16],[-73,-74],[-334,166],[-209,-48]],[[59599,43773],[-77,804],[-95,275],[-55,164],[-273,110]],[[59099,45126],[-157,177],[-177,100],[-111,99],[-116,150]],[[58538,45652],[-150,745],[-161,330],[-55,343],[27,307],[-50,544]],[[58149,47921],[115,28],[101,214],[108,308],[69,124],[-3,192],[-60,134],[-16,233]],[[58463,49154],[80,74],[16,348],[-110,333]],[[58449,49909],[98,71],[304,-7],[566,45]],[[47592,66920],[1,-40],[-6,-114]],[[47587,66766],[-1,-895],[-911,31],[9,-1512],[-261,-53],[-68,-304],[53,-853],[-1088,4],[-60,-197]],[[45260,62987],[12,249]],[[45272,63236],[5,-1],[625,48],[33,213],[114,265],[92,816],[386,637],[131,745],[86,44],[91,460],[234,63],[100,-76],[126,0],[90,134],[172,19],[-7,317],[42,0]],[[15878,79530],[-38,1],[-537,581],[-199,255],[-503,244],[-155,523],[40,363],[-356,252],[-48,476],[-336,429],[-6,304]],[[13740,82958],[154,285],[-7,373],[-473,376],[-284,674],[-173,424],[-255,266],[-187,242],[-147,306],[-279,-192],[-270,-330],[-247,388],[-194,259],[-271,164],[-273,17],[1,3364],[2,2193]],[[10837,91767],[518,-142],[438,-285],[289,-54],[244,247],[336,184],[413,-72],[416,259],[455,148],[191,-245],[207,138],[62,278],[192,-63],[470,-530],[369,401],[38,-449],[341,97],[105,173],[337,-34],[424,-248],[650,-217],[383,-100],[272,38],[374,-300],[-390,-293],[502,-127],[750,70],[236,103],[296,-354],[302,299],[-283,251],[179,202],[338,27],[223,59],[224,-141],[279,-321],[310,47],[491,-266],[431,94],[405,-14],[-32,367],[247,103],[431,-200],[-2,-559],[177,471],[223,-16],[126,594],[-298,364],[-324,239],[22,653],[329,429],[366,-95],[281,-261],[378,-666],[-247,-290],[517,-120],[-1,-604],[371,463],[332,-380],[-83,-438],[269,-399],[290,427],[202,510],[16,649],[394,-46],[411,-87],[373,-293],[17,-293],[-207,-315],[196,-316],[-36,-288],[-544,-413],[-386,-91],[-287,178],[-83,-297],[-268,-498],[-81,-259],[-322,-399],[-397,-39],[-220,-250],[-18,-384],[-323,-74],[-340,-479],[-301,-665],[-108,-466],[-16,-686],[409,-99],[125,-553],[130,-448],[388,117],[517,-256],[277,-225],[199,-279],[348,-163],[294,-248],[459,-34],[302,-58],[-45,-511],[86,-594],[201,-661],[414,-561],[214,192],[150,607],[-145,934],[-196,311],[445,276],[314,415],[154,411],[-23,395],[-188,502],[-338,445],[328,619],[-121,535],[-93,922],[194,137],[476,-161],[286,-57],[230,155],[258,-200],[342,-343],[85,-229],[495,-45],[-8,-496],[92,-747],[254,-92],[201,-348],[402,328],[266,652],[184,274],[216,-527],[362,-754],[307,-709],[-112,-371],[370,-333],[250,-338],[442,-152],[179,-189],[110,-500],[216,-78],[112,-223],[20,-664],[-202,-222],[-199,-207],[-458,-210],[-349,-486],[-470,-96],[-594,125],[-417,4],[-287,-41],[-233,-424],[-354,-262],[-401,-782],[-320,-545],[236,97],[446,776],[583,493],[415,58],[246,-289],[-262,-397],[88,-637],[91,-446],[361,-295],[459,86],[278,664],[19,-429],[180,-214],[-344,-387],[-615,-351],[-276,-239],[-310,-426],[-211,44],[-11,500],[483,488],[-445,-19],[-309,-72]],[[31350,77248],[-181,334],[0,805],[-123,171],[-187,-100],[-92,155],[-212,-446],[-84,-460],[-99,-269],[-118,-91],[-89,-30],[-28,-146],[-512,0],[-422,-4],[-125,-109],[-294,-425],[-34,-46],[-89,-231],[-255,1],[-273,-3],[-125,-93],[44,-116],[25,-181],[-5,-60],[-363,-293],[-286,-93],[-323,-316],[-70,0],[-94,93],[-31,85],[6,61],[61,207],[131,325],[81,349],[-56,514],[-59,536],[-290,277],[35,105],[-41,73],[-76,0],[-56,93],[-14,140],[-54,-61],[-75,18],[17,59],[-65,58],[-27,155],[-216,189],[-224,197],[-272,229],[-261,214],[-248,-167],[-91,-6],[-342,154],[-225,-77],[-269,183],[-284,94],[-194,36],[-86,100],[-49,325],[-94,-3],[-1,-227],[-575,0],[-951,0],[-944,0],[-833,0],[-834,0],[-819,0],[-847,0],[-273,0],[-824,0],[-789,0]],[[26668,87478],[207,273],[381,-6],[-6,-114],[-325,-326],[-196,13],[-61,160]],[[27840,93593],[-306,313],[12,213],[133,39],[636,-63],[479,-325],[25,-163],[-296,17],[-299,13],[-304,-80],[-80,36]],[[27690,87261],[107,177],[114,-13],[70,-121],[-108,-310],[-123,50],[-73,176],[13,41]],[[23996,94879],[-151,-229],[-403,44],[-337,155],[148,266],[399,159],[243,-208],[101,-187]],[[23933,96380],[-126,-17],[-521,38],[-74,165],[559,-9],[195,-109],[-33,-68]],[[23124,97116],[332,-205],[-76,-214],[-411,-122],[-226,138],[-119,221],[-22,245],[360,-24],[162,-39]],[[25514,94532],[-449,73],[-738,190],[-96,325],[-34,293],[-279,258],[-574,72],[-322,183],[104,242],[573,-37],[308,-190],[547,1],[240,-194],[-64,-222],[319,-134],[177,-140],[374,-26],[406,-50],[441,128],[566,51],[451,-42],[298,-223],[62,-244],[-174,-157],[-414,-127],[-355,72],[-797,-91],[-570,-11]],[[19093,96754],[392,-92],[-93,-177],[-518,-170],[-411,191],[224,188],[406,60]],[[19177,97139],[361,-120],[-339,-115],[-461,1],[5,84],[285,177],[149,-27]],[[34555,80899],[-148,-372],[-184,-517],[181,199],[187,-126],[-98,-206],[247,-162],[128,144],[277,-182],[-86,-433],[194,101],[36,-313],[86,-367],[-117,-520],[-125,-22],[-183,111],[60,484],[-77,75],[-322,-513],[-166,21],[196,277],[-267,144],[-298,-35],[-539,18],[-43,175],[173,208],[-121,160],[234,356],[287,941],[172,336],[241,204],[129,-26],[-54,-160]],[[26699,89048],[304,-203],[318,-184],[25,-281],[204,46],[199,-196],[-247,-186],[-432,142],[-156,266],[-275,-314],[-396,-306],[-95,346],[-377,-57],[242,292],[35,465],[95,542],[201,-49],[51,-259],[143,91],[161,-155]],[[28119,93327],[263,235],[616,-299],[383,-282],[36,-258],[515,134],[290,-376],[670,-234],[242,-238],[263,-553],[-510,-275],[654,-386],[441,-130],[400,-543],[437,-39],[-87,-414],[-487,-687],[-342,253],[-437,568],[-359,-74],[-35,-338],[292,-344],[377,-272],[114,-157],[181,-584],[-96,-425],[-350,160],[-697,473],[393,-509],[289,-357],[45,-206],[-753,236],[-596,343],[-337,287],[97,167],[-414,304],[-405,286],[5,-171],[-803,-94],[-235,203],[183,435],[522,10],[571,76],[-92,211],[96,294],[360,576],[-77,261],[-107,203],[-425,286],[-563,201],[178,150],[-294,367],[-245,34],[-219,201],[-149,-175],[-503,-76],[-1011,132],[-588,174],[-450,89],[-231,207],[290,270],[-394,2],[-88,599],[213,528],[286,241],[717,158],[-204,-382],[219,-369],[256,477],[704,242],[477,-611],[-42,-387],[550,172]],[[23749,94380],[579,-20],[530,-144],[-415,-526],[-331,-115],[-298,-442],[-317,22],[-173,519],[4,294],[145,251],[276,161]],[[15873,95551],[472,442],[570,383],[426,-9],[381,87],[-38,-454],[-214,-205],[-259,-29],[-517,-252],[-444,-91],[-377,128]],[[13136,82508],[267,47],[-84,-671],[242,-475],[-111,1],[-167,270],[-103,272],[-140,184],[-51,260],[16,188],[131,-76]],[[20696,97433],[546,-81],[751,-215],[212,-281],[108,-247],[-453,66],[-457,192],[-619,21],[268,176],[-335,142],[-21,227]],[[15692,79240],[-140,-82],[-456,269],[-84,209],[-248,207],[-50,168],[-286,107],[-107,321],[24,137],[291,-129],[171,-89],[261,-63],[94,-204],[138,-280],[277,-244],[115,-327]],[[16239,94566],[397,-123],[709,-33],[270,-171],[298,-249],[-349,-149],[-681,-415],[-344,-414],[0,-257],[-731,-285],[-147,259],[-641,312],[119,250],[192,432],[241,388],[-272,362],[939,93]],[[20050,95391],[247,99],[291,-26],[49,-289],[-169,-281],[-940,-91],[-701,-256],[-423,-14],[-35,193],[577,261],[-1255,-70],[-389,106],[379,577],[262,165],[782,-199],[493,-350],[485,-45],[-397,565],[255,215],[286,-68],[94,-282],[109,-210]],[[20410,93755],[311,-239],[175,-575],[86,-417],[466,-293],[502,-279],[-31,-260],[-456,-48],[178,-227],[-94,-217],[-503,93],[-478,160],[-322,-36],[-522,-201],[-704,-88],[-494,-56],[-151,279],[-379,161],[-246,-66],[-343,468],[185,62],[429,101],[392,-26],[362,103],[-537,138],[-594,-47],[-394,12],[-146,217],[644,237],[-428,-9],[-485,156],[233,443],[193,235],[744,359],[284,-114],[-139,-277],[618,179],[386,-298],[314,302],[254,-194],[227,-580],[140,244],[-197,606],[244,86],[276,-94]],[[22100,93536],[-306,386],[329,286],[331,-124],[496,75],[72,-172],[-259,-283],[420,-254],[-50,-532],[-455,-229],[-268,50],[-192,225],[-690,456],[5,189],[567,-73]],[[20389,94064],[372,24],[211,-130],[-244,-390],[-434,413],[95,83]],[[22639,95907],[212,-273],[9,-303],[-127,-440],[-458,-60],[-298,94],[5,345],[-455,-46],[-18,457],[299,-18],[419,201],[390,-34],[22,77]],[[23329,98201],[192,180],[285,42],[-122,135],[646,30],[355,-315],[468,-127],[455,-112],[220,-390],[334,-190],[-381,-176],[-513,-445],[-492,-42],[-575,76],[-299,240],[4,215],[220,157],[-508,-4],[-306,196],[-176,268],[193,262]],[[24559,98965],[413,112],[324,19],[545,96],[409,220],[344,-30],[300,-166],[211,319],[367,95],[498,65],[849,24],[148,-63],[802,100],[601,-38],[602,-37],[742,-47],[597,-75],[508,-161],[-12,-157],[-678,-257],[-672,-119],[-251,-133],[605,3],[-656,-358],[-452,-167],[-476,-483],[-573,-98],[-177,-120],[-841,-64],[383,-74],[-192,-105],[230,-292],[-264,-202],[-429,-167],[-132,-232],[-388,-176],[39,-134],[475,23],[6,-144],[-742,-355],[-726,163],[-816,-91],[-414,71],[-525,31],[-35,284],[514,133],[-137,427],[170,41],[742,-255],[-379,379],[-450,113],[225,229],[492,141],[79,206],[-392,231],[-118,304],[759,-26],[220,-64],[433,216],[-625,68],[-972,-38],[-491,201],[-232,239],[-324,173],[-61,202]],[[29106,90427],[-180,-174],[-312,-30],[-69,289],[118,331],[255,82],[217,-163],[3,-253],[-32,-82]],[[23262,91636],[169,-226],[-173,-207],[-374,179],[-226,-65],[-380,266],[245,183],[194,256],[295,-168],[166,-106],[84,-112]],[[32078,80046],[96,49],[365,-148],[284,-247],[8,-108],[-135,-11],[-360,186],[-258,279]],[[32218,78370],[97,-288],[202,-79],[257,16],[-137,-242],[-102,-38],[-353,250],[-69,198],[105,183]],[[31350,77248],[48,-194],[-296,-286],[-286,-204],[-293,-175],[-147,-351],[-47,-133],[-3,-313],[92,-313],[115,-15],[-29,216],[83,-131],[-22,-169],[-188,-96],[-133,11],[-205,-103],[-121,-29],[-162,-29],[-231,-171],[408,111],[82,-112],[-389,-177],[-177,-1],[8,72],[-84,-164],[82,-27],[-60,-424],[-203,-455],[-20,152],[-61,30],[-91,148],[57,-318],[69,-105],[5,-223],[-89,-230],[-157,-472],[-25,24],[86,402],[-142,225],[-33,491],[-53,-255],[59,-375],[-183,93],[191,-191],[12,-562],[79,-41],[29,-204],[39,-591],[-176,-439],[-288,-175],[-182,-346],[-139,-38],[-141,-217],[-39,-199],[-305,-383],[-157,-281],[-131,-351],[-43,-419],[50,-411],[92,-505],[124,-418],[1,-256],[132,-685],[-9,-398],[-12,-230],[-69,-361],[-83,-75],[-137,72],[-44,259],[-105,136],[-148,508],[-129,452],[-42,231],[57,393],[-77,325],[-217,494],[-108,90],[-281,-268],[-49,30],[-135,275],[-174,147],[-314,-75],[-247,66],[-212,-41],[-114,-92],[50,-157],[-5,-240],[59,-117],[-53,-77],[-103,87],[-104,-112],[-202,18],[-207,312],[-242,-73],[-202,137],[-173,-42],[-234,-138],[-253,-438],[-276,-255],[-152,-282],[-63,-266],[-3,-407],[14,-284],[52,-201]],[[23016,65864],[-108,-18],[-197,130],[-217,184],[-78,277],[-61,414],[-164,337],[-96,346],[-139,404],[-196,236],[-227,-11],[-175,-467],[-230,177],[-144,178],[-69,325],[-92,309],[-165,260],[-142,186],[-102,210],[-481,0],[0,-244],[-221,0],[-552,-4],[-634,416],[-419,287],[26,116],[-353,-64],[-316,-46]],[[17464,69802],[-46,302],[-180,340],[-130,71],[-30,169],[-156,30],[-100,159],[-258,59],[-71,95],[-33,324],[-270,594],[-231,821],[10,137],[-123,195],[-215,495],[-38,482],[-148,323],[61,489],[-10,507],[-89,453],[109,557],[34,536],[33,536],[-50,792],[-88,506],[-80,274],[33,115],[402,-200],[148,-558],[69,156],[-45,484],[-94,485]],[[6833,62443],[49,-51],[45,-79],[71,-207],[-7,-33],[-108,-126],[-89,-92],[-41,-99],[-69,84],[8,165],[-46,216],[14,65],[48,97],[-19,116],[16,55],[21,-11],[107,-100]],[[6668,62848],[-23,-71],[-94,-43],[-47,125],[-32,48],[-3,37],[27,50],[99,-56],[73,-90]],[[6456,63091],[-9,-63],[-149,17],[21,72],[137,-26]],[[6104,63411],[23,-38],[80,-196],[-15,-34],[-19,8],[-97,21],[-35,133],[-11,24],[74,82]],[[5732,63705],[5,-138],[-33,-58],[-93,107],[14,43],[43,58],[64,-12]],[[3759,86256],[220,-54],[27,-226],[-171,-92],[-182,110],[-168,161],[274,101]],[[7436,84829],[185,-40],[117,-183],[-240,-281],[-277,-225],[-142,152],[-43,277],[252,210],[148,90]],[[13740,82958],[-153,223],[-245,188],[-78,515],[-358,478],[-150,558],[-267,38],[-441,15],[-326,170],[-574,613],[-266,112],[-486,211],[-385,-51],[-546,272],[-330,252],[-309,-125],[58,-411],[-154,-38],[-321,-123],[-245,-199],[-308,-126],[-39,348],[125,580],[295,182],[-76,148],[-354,-329],[-190,-394],[-400,-420],[203,-287],[-262,-424],[-299,-248],[-278,-180],[-69,-261],[-434,-305],[-87,-278],[-325,-252],[-191,45],[-259,-165],[-282,-201],[-231,-197],[-477,-169],[-43,99],[304,276],[271,182],[296,324],[345,66],[137,243],[385,353],[62,119],[205,208],[48,448],[141,349],[-320,-179],[-90,102],[-150,-215],[-181,300],[-75,-212],[-104,294],[-278,-236],[-170,0],[-24,352],[50,216],[-179,211],[-361,-113],[-235,277],[-190,142],[-1,334],[-214,252],[108,340],[226,330],[99,303],[225,43],[191,-94],[224,285],[201,-51],[212,183],[-52,270],[-155,106],[205,228],[-170,-7],[-295,-128],[-85,-131],[-219,131],[-392,-67],[-407,142],[-117,238],[-351,343],[390,247],[620,289],[228,0],[-38,-296],[586,23],[-225,366],[-342,225],[-197,296],[-267,252],[-381,187],[155,309],[493,19],[350,270],[66,287],[284,281],[271,68],[526,262],[256,-40],[427,315],[421,-124],[201,-266],[123,114],[469,-35],[-16,-136],[425,-101],[283,59],[585,-186],[534,-56],[214,-77],[370,96],[421,-177],[302,-83]],[[2297,88264],[171,-113],[173,61],[225,-156],[276,-79],[-23,-64],[-211,-125],[-211,128],[-106,107],[-245,-34],[-66,52],[17,223]],[[74266,79657],[-212,-393],[-230,-56],[-13,-592],[-155,-267],[-551,194],[-200,-1058],[-143,-131],[-550,-236],[250,-1026],[-190,-154],[22,-337]],[[72294,75601],[-171,87],[-140,212],[-412,62],[-461,16],[-100,-65],[-396,248],[-158,-122],[-43,-349],[-457,204],[-183,-84],[-62,-259]],[[69711,75551],[-159,-109],[-367,-412],[-121,-422],[-104,-4],[-76,280],[-353,19],[-57,484],[-135,4],[21,593],[-333,431],[-476,-46],[-326,-86],[-265,533],[-227,223],[-431,423],[-52,51],[-715,-349],[11,-2178]],[[65546,74986],[-142,-29],[-195,463],[-188,166],[-315,-123],[-123,-197]],[[64583,75266],[-15,144],[68,246],[-53,206],[-322,202],[-125,530],[-154,150],[-9,192],[270,-56],[11,432],[236,96],[243,-88],[50,576],[-50,365],[-278,-28],[-236,144],[-321,-260],[-259,-124]],[[63639,77993],[-142,96],[29,304],[-177,395],[-207,-17],[-235,401],[160,448],[-81,120],[222,649],[285,-342],[35,431],[573,643],[434,15],[612,-409],[329,-239],[295,249],[440,12],[356,-306],[80,175],[391,-25],[69,280],[-450,406],[267,288],[-52,161],[266,153],[-200,405],[127,202],[1039,205],[136,146],[695,218],[250,245],[499,-127],[88,-612],[290,144],[356,-202],[-23,-322],[267,33],[696,558],[-102,-185],[355,-457],[620,-1500],[148,309],[383,-340],[399,151],[154,-106],[133,-341],[194,-115],[119,-251],[358,79],[147,-361]],[[69711,75551],[83,-58],[-234,-382],[205,-223],[198,147],[329,-311],[-355,-425],[-212,58]],[[69725,74357],[-114,-15],[-40,164],[58,274],[-371,-137],[-89,-380],[-132,-326],[-232,28],[-72,-261],[204,-140],[60,-440],[-156,-598]],[[68841,72526],[-210,124],[-154,4]],[[68477,72654],[7,362],[-369,253],[-291,289],[-181,278],[-317,408],[-137,609],[-93,108],[-301,-27],[-106,121],[-30,471],[-374,312],[-234,-343],[-237,-204],[45,-297],[-313,-8]],[[89166,49043],[482,-407],[513,-338],[192,-302],[154,-297],[43,-349],[462,-365],[68,-313],[-256,-64],[62,-393],[248,-388],[180,-627],[159,20],[-11,-262],[215,-100],[-84,-111],[295,-249],[-30,-171],[-184,-41],[-69,153],[-238,66],[-281,89],[-216,377],[-158,325],[-144,517],[-362,259],[-235,-169],[-170,-195],[35,-436],[-218,-203],[-155,99],[-288,25]],[[89175,45193],[-4,1925],[-5,1925]],[[92399,48417],[106,-189],[33,-307],[-87,-157],[-52,348],[-65,229],[-126,193],[-158,252],[-200,174],[77,143],[150,-166],[94,-130],[117,-142],[111,-248]],[[92027,47129],[-152,-144],[-142,-138],[-148,1],[-228,171],[-158,165],[23,183],[249,-86],[152,46],[42,283],[40,15],[27,-314],[158,45],[78,202],[155,211],[-30,348],[166,11],[56,-97],[-5,-327],[-93,-361],[-146,-48],[-44,-166]],[[92988,47425],[84,-134],[135,-375],[131,-200],[-39,-166],[-78,-59],[-120,227],[-122,375],[-59,450],[38,57],[30,-175]],[[89175,45193],[-247,485],[-282,118],[-69,-168],[-352,-18],[118,481],[175,164],[-72,642],[-134,496],[-538,500],[-229,50],[-417,546],[-82,-287],[-107,-52],[-63,216],[-1,257],[-212,290],[299,213],[198,-11],[-23,156],[-407,1],[-110,352],[-248,109],[-117,293],[374,143],[142,192],[446,-242],[44,-220],[78,-955],[287,-354],[232,627],[319,356],[247,1],[238,-206],[206,-212],[298,-113]],[[84713,45326],[28,-117],[5,-179]],[[84746,45030],[-181,-441],[-238,-130],[-33,71],[25,201],[119,360],[275,235]],[[87280,46506],[-27,445],[49,212],[58,200],[63,-173],[0,-282],[-143,-402]],[[82744,53024],[-158,-533],[204,-560],[-48,-272],[312,-546],[-329,-70],[-93,-403],[12,-535],[-267,-404],[-7,-589],[-107,-903],[-41,210],[-316,-266],[-110,361],[-198,34],[-139,189],[-330,-212],[-101,285],[-182,-32],[-229,68],[-43,793],[-138,164],[-134,505],[-38,517],[32,548],[165,392]],[[80461,51765],[47,-395],[190,-334],[179,121],[177,-43],[162,299],[133,52],[263,-166],[226,126],[143,822],[107,205],[96,672],[319,0],[241,-100]],[[85936,48924],[305,-172],[101,-452],[-234,244],[-232,49],[-157,-39],[-192,21],[65,325],[344,24]],[[85242,48340],[-192,108],[-54,254],[281,29],[69,-195],[-104,-196]],[[85536,51864],[20,-322],[164,-52],[26,-241],[-15,-517],[-143,58],[-42,-359],[114,-312],[-78,-71],[-112,374],[-82,755],[56,472],[92,215]],[[84146,51097],[319,25],[275,429],[48,-132],[-223,-587],[-209,-113],[-267,115],[-463,-29],[-243,-85],[-39,-447],[248,-526],[150,268],[518,201],[-22,-272],[-121,86],[-121,-347],[-245,-229],[263,-757],[-50,-203],[249,-682],[-2,-388],[-148,-173],[-109,207],[134,484],[-273,-229],[-69,164],[36,228],[-200,346],[21,576],[-186,-179],[24,-689],[11,-846],[-176,-85],[-119,173],[79,544],[-43,570],[-117,4],[-86,405],[115,387],[40,469],[139,891],[58,243],[237,439],[217,-174],[350,-82]],[[83414,44519],[-368,414],[259,116],[146,-180],[97,-180],[-17,-159],[-117,-11]],[[83705,45536],[185,45],[249,216],[-41,-328],[-417,-168],[-370,73],[0,216],[220,123],[174,-177]],[[82849,45639],[172,48],[69,-251],[-321,-119],[-193,-79],[-149,5],[95,340],[153,5],[74,209],[100,-158]],[[80134,46785],[38,-210],[533,-59],[61,244],[515,-284],[101,-383],[417,-108],[341,-351],[-317,-225],[-306,238],[-251,-16],[-288,44],[-260,106],[-322,225],[-204,59],[-116,-74],[-506,243],[-48,254],[-255,44],[191,564],[337,-35],[224,-231],[115,-45]],[[78991,49939],[47,-412],[97,-330],[204,-52],[135,-374],[-70,-735],[-11,-914],[-308,-12],[-234,494],[-356,482],[-119,358],[-210,481],[-138,443],[-212,827],[-244,493],[-81,508],[-103,461],[-250,372],[-145,506],[-209,330],[-290,652],[-24,300],[178,-24],[430,-114],[246,-577],[215,-401],[153,-246],[263,-635],[283,-9],[233,-405],[161,-495],[211,-270],[-111,-482],[159,-205],[100,-15]],[[30935,19481],[106,-274],[139,-443],[361,-355],[389,-147],[-125,-296],[-264,-29],[-141,208]],[[31400,18145],[-168,16],[-297,1],[0,1319]],[[33993,32727],[-70,-473],[-74,-607],[3,-588],[-61,-132],[-21,-382]],[[33770,30545],[-19,-308],[353,-506],[-38,-408],[173,-257],[-14,-289],[-267,-757],[-412,-317],[-557,-123],[-305,59],[59,-352],[-57,-442],[51,-298],[-167,-208],[-284,-82],[-267,216],[-108,-155],[39,-587],[188,-178],[152,186],[82,-307],[-255,-183],[-223,-367],[-41,-595],[-66,-316],[-262,-2],[-218,-302],[-80,-443],[273,-433],[266,-119],[-96,-531],[-328,-333],[-180,-692],[-254,-234],[-113,-276],[89,-614],[185,-342],[-117,30]],[[30952,19680],[-257,93],[-672,79],[-115,344],[6,443],[-185,-38],[-98,214],[-24,626],[213,260],[88,375],[-33,299],[148,504],[101,782],[-30,347],[122,112],[-30,223],[-129,118],[92,248],[-126,224],[-65,682],[112,120],[-47,720],[65,605],[75,527],[166,215],[-84,576],[-1,543],[210,386],[-7,494],[159,576],[1,544],[-72,108],[-128,1020],[171,607],[-27,572],[100,537],[182,555],[196,367],[-83,232],[58,190],[-9,985],[302,291],[96,614],[-34,148]],[[31359,37147],[231,534],[364,-144],[163,-427],[109,475],[316,-24],[45,-127]],[[32587,37434],[511,-964],[227,-89],[339,-437],[286,-231],[40,-261],[-273,-898],[280,-160],[312,-91],[220,95],[252,453],[45,521]],[[34826,35372],[138,114],[139,-341],[-6,-472],[-234,-326],[-186,-241],[-314,-573],[-370,-806]],[[31400,18145],[-92,-239],[-238,-183],[-137,19],[-164,48],[-202,177],[-291,86],[-350,330],[-283,317],[-383,662],[229,-124],[390,-395],[369,-212],[143,271],[90,405],[256,244],[198,-70]],[[30669,40193],[136,-402],[37,-426],[146,-250],[-88,-572],[150,-663],[109,-814],[200,81]],[[30952,19680],[-247,4],[-134,-145],[-250,-213],[-45,-552],[-118,-14],[-313,192],[-318,412],[-346,338],[-87,374],[79,346],[-140,393],[-36,1007],[119,568],[293,457],[-422,172],[265,522],[94,982],[309,-208],[145,1224],[-186,157],[-87,-738],[-175,83],[87,845],[95,1095],[127,404],[-80,576],[-22,666],[117,19],[170,954],[192,945],[118,881],[-64,885],[83,487],[-34,730],[163,721],[50,1143],[89,1227],[87,1321],[-20,967],[-58,832]],[[30452,39739],[143,151],[74,303]],[[58538,45652],[-109,60],[-373,-99],[-75,-71],[-79,-377],[62,-261],[-49,-699],[-34,-593],[75,-105],[194,-230],[76,107],[23,-637],[-212,5],[-114,325],[-103,252],[-213,82],[-62,310],[-170,-187],[-222,83],[-93,268],[-176,55],[-131,-15],[-15,184],[-96,15]],[[56642,44124],[-127,35],[-172,-89],[-121,15],[-68,-54],[15,703],[-93,219],[-21,363],[41,356],[-56,228],[-5,372],[-337,-5],[24,213],[-142,-2],[-15,-103],[-172,-23],[-69,-344],[-42,-148],[-154,83],[-91,-83],[-184,-47],[-106,309],[-64,191],[-80,354],[-68,440],[-820,8],[-98,-71],[-80,11],[-115,-79]],[[53422,46976],[-39,183]],[[53383,47159],[71,62],[9,258],[45,152],[101,124]],[[53609,47755],[73,-60],[95,226],[152,-6],[17,-167],[104,-105],[164,370],[161,289],[71,189],[-10,486],[121,574],[127,304],[183,285],[32,189],[7,216],[45,205],[-14,335],[34,524],[55,368],[83,316],[16,357]],[[55125,52650],[25,412],[108,300],[149,190],[229,-200],[177,-218],[203,-59],[207,-115],[83,357],[38,46],[127,-60],[309,295],[110,-125],[90,18],[41,143],[104,51],[209,-62],[178,-14],[91,63]],[[57603,53672],[169,-488],[124,-71],[75,99],[128,-39],[155,125],[66,-252],[244,-393]],[[58564,52653],[-16,-691],[111,-80],[-89,-210],[-107,-157],[-106,-308],[-59,-274],[-15,-475],[-65,-225],[-2,-446]],[[58216,49787],[-80,-165],[-10,-351],[-38,-46],[-26,-323]],[[58062,48902],[70,-268],[17,-713]],[[61551,49585],[-165,488],[-3,2152],[243,670]],[[61626,52895],[76,186],[178,11],[247,417],[362,26],[785,1773]],[[63274,55308],[194,493],[125,363],[0,308],[0,596],[1,244],[2,9]],[[63596,57321],[89,12],[128,88],[147,59],[132,202],[105,2],[6,-163],[-25,-344],[1,-310],[-59,-214],[-78,-639],[-134,-659],[-172,-755],[-238,-866],[-237,-661],[-327,-806],[-278,-479],[-415,-586],[-259,-450],[-304,-715],[-64,-312],[-63,-140]],[[59417,50018],[-3,627],[80,239],[137,391],[101,431],[-123,678],[-32,296],[-132,411]],[[59445,53091],[171,352],[188,390]],[[59804,53833],[145,-99],[0,-332],[95,-194],[193,0],[352,-502],[87,-6],[65,16],[62,-68],[185,-47],[82,247],[254,247],[112,-200],[190,0]],[[61551,49585],[-195,-236],[-68,-246],[-104,-44],[-40,-416],[-89,-238],[-54,-393],[-112,-195]],[[56824,55442],[-212,258],[-96,170],[-18,184],[45,246],[-1,241],[-160,369],[-31,253]],[[56351,57163],[3,143],[-102,174],[-3,343],[-58,228],[-98,-34],[28,217],[72,246],[-32,245],[92,181],[-58,138],[73,365],[127,435],[240,-41],[-14,2345]],[[56621,62148],[3,248],[320,2],[0,1180]],[[56944,63578],[1117,0],[1077,0],[1102,0]],[[60240,63578],[90,-580],[-61,-107],[40,-608],[102,-706],[106,-145],[152,-219]],[[60669,61213],[-141,-337],[-204,-97],[-88,-181],[-27,-393],[-120,-868],[30,-236]],[[60119,59101],[-45,-508],[-112,-582],[-168,-293],[-119,-451],[-28,-241],[-132,-166],[-82,-618],[4,-531]],[[59437,55711],[-3,460],[-39,12],[5,294],[-33,203],[-143,233],[-34,426],[34,436],[-129,41],[-19,-132],[-167,-30],[67,-173],[23,-355],[-152,-324],[-138,-426],[-144,-61],[-233,345],[-105,-122],[-29,-172],[-143,-112],[-9,-122],[-277,0],[-38,122],[-200,20],[-100,-101],[-77,51],[-143,344],[-48,163],[-200,-81],[-76,-274],[-72,-528],[-95,-111],[-85,-65],[189,-230]],[[56351,57163],[-176,-101],[-141,-239],[-201,-645],[-261,-273],[-269,36],[-78,-54],[28,-208],[-145,-207],[-118,-230],[-350,-226],[-69,134],[-46,11],[-52,-152],[-229,-44]],[[54244,54965],[43,160],[-87,407],[-39,245],[-121,100],[-164,345],[60,279],[127,-60],[78,42],[155,-6],[-151,537],[10,393],[-18,392],[-111,378]],[[54026,58177],[28,279],[-178,13],[0,380],[-115,219],[120,778],[354,557],[15,769],[107,1199],[60,254],[-116,203],[-4,188],[-104,153],[-68,919]],[[54125,64088],[280,323],[1108,-1132],[1108,-1131]],[[30080,62227],[24,-321],[-21,-228],[-68,-99],[71,-177],[-5,-161]],[[30081,61241],[-185,100],[-131,-41],[-169,43],[-130,-110],[-149,184],[24,190],[256,-82],[210,-47],[100,131],[-127,256],[2,226],[-175,92],[62,163],[170,-26],[241,-93]],[[30080,62227],[34,101],[217,-3],[165,-152],[73,15],[50,-209],[152,11],[-9,-176],[124,-21],[136,-217],[-103,-240],[-132,128],[-127,-25],[-92,28],[-50,-107],[-106,-37],[-43,144],[-92,-85],[-111,-405],[-71,94],[-14,170]],[[76049,98451],[600,133],[540,-297],[640,-572],[-69,-531],[-606,-73],[-773,170],[-462,226],[-213,423],[-379,117],[722,404]],[[78565,97421],[704,-336],[-82,-240],[-1566,-228],[507,776],[229,66],[208,-38]],[[88563,95563],[734,-26],[1004,-313],[-219,-439],[-1023,16],[-461,-139],[-550,384],[149,406],[366,111]],[[91172,95096],[697,-155],[-321,-234],[-444,53],[-516,233],[66,192],[518,-89]],[[88850,93928],[263,234],[348,54],[394,-226],[34,-155],[-421,-4],[-569,66],[-49,31]],[[62457,98194],[542,107],[422,8],[57,-160],[159,142],[262,97],[412,-129],[-107,-90],[-373,-78],[-250,-45],[-39,-97],[-324,-98],[-301,140],[158,185],[-618,18]],[[56314,82678],[-511,-9],[-342,67]],[[55461,82736],[63,260],[383,191]],[[55907,83187],[291,-103],[123,-94],[-30,-162],[23,-150]],[[64863,94153],[665,518],[-75,268],[621,312],[917,380],[925,110],[475,220],[541,76],[193,-233],[-187,-184],[-984,-293],[-848,-282],[-863,-562],[-414,-577],[-435,-568],[56,-491],[531,-484],[-164,-52],[-907,77],[-74,262],[-503,158],[-40,320],[284,126],[-10,323],[551,503],[-255,73]],[[89698,82309],[96,-569],[-7,-581],[114,-597],[280,-1046],[-411,195],[-171,-854],[271,-605],[-8,-413],[-211,356],[-182,-457],[-51,496],[31,575],[-32,638],[64,446],[13,790],[-163,581],[24,808],[257,271],[-110,274],[123,83],[73,-391]],[[86327,75524],[-39,104]],[[86288,75628],[-2,300],[142,16],[40,698],[-73,506],[238,208],[338,-104],[186,575],[96,647],[107,216],[146,532],[-459,-175],[-240,-233],[-423,1],[-112,555],[-329,420],[-483,189],[-103,579],[-97,363],[-104,254],[-172,596],[-244,217],[-415,176],[-369,-16],[-345,-106],[-229,-294],[152,-141],[4,-326],[-155,-189],[-251,-627],[3,-260],[-392,-373],[-333,223]],[[82410,80055],[-331,-49],[-146,198],[-166,63],[-407,-416],[-366,-98],[-255,-146],[-350,96],[-258,-6],[-168,302],[-272,284],[-279,78],[-351,-78],[-263,-109],[-394,248],[-53,443],[-327,152],[-252,69],[-311,244],[-288,-612],[113,-348],[-270,-411],[-402,148],[-277,22],[-186,276],[-289,8],[-242,182],[-423,-278],[-530,-509],[-292,-102]],[[74375,79706],[-109,-49]],[[63639,77993],[-127,-350],[-269,-97],[-276,-610],[252,-561],[-27,-398],[303,-696]],[[63495,75281],[-166,-238],[-48,-150],[-122,40],[-191,359],[-78,20]],[[62890,75312],[-175,137],[-85,242],[-259,124],[-169,-93],[-48,110],[-378,283],[-409,96],[-235,101],[-34,-70]],[[61098,76242],[-354,499],[-317,223],[-240,347],[202,95],[231,494],[-156,234],[410,241],[-8,129],[-249,-95]],[[60617,78409],[9,262],[143,165],[269,43],[44,197],[-62,326],[113,310],[-3,173],[-410,192],[-162,-6],[-172,277],[-213,-94],[-352,208],[6,116],[-99,256],[-222,29],[-23,183],[70,120],[-178,334],[-288,-57],[-84,30],[-70,-134],[-104,23]],[[58829,81362],[-68,379],[-66,196],[54,55],[224,-20],[108,129],[-80,157],[-187,104],[16,107],[-113,108],[-174,387],[60,159],[-27,277],[-272,141],[-146,-70],[-39,146],[-293,149]],[[57826,83766],[-89,348],[-24,287],[-134,136]],[[57579,84537],[120,187],[-83,551],[198,341],[-42,103]],[[57772,85719],[316,327],[-291,280]],[[57797,86326],[594,755],[258,341],[105,301],[-411,405],[113,385],[-250,440],[187,506],[-323,673],[256,445],[-425,394],[41,414]],[[57942,91385],[224,54],[473,237]],[[58639,91676],[286,206],[456,-358],[761,-140],[1050,-668],[213,-281],[18,-393],[-308,-311],[-454,-157],[-1240,449],[-204,-75],[453,-433],[18,-274],[18,-604],[358,-180],[217,-153],[36,286],[-168,254],[177,224],[672,-368],[233,144],[-186,433],[647,578],[256,-34],[260,-206],[161,406],[-231,352],[136,353],[-204,367],[777,-190],[158,-331],[-351,-73],[1,-328],[219,-203],[429,128],[68,377],[580,282],[970,507],[209,-29],[-273,-359],[344,-61],[199,202],[521,16],[412,245],[317,-356],[315,391],[-291,343],[145,195],[820,-179],[385,-185],[1006,-675],[186,309],[-282,313],[-8,125],[-335,58],[92,280],[-149,461],[-8,189],[512,535],[183,537],[206,116],[736,-156],[57,-328],[-263,-479],[173,-189],[89,-413],[-63,-809],[307,-362],[-120,-395],[-544,-839],[318,-87],[110,213],[306,151],[74,293],[240,281],[-162,336],[130,390],[-304,49],[-67,328],[222,593],[-361,482],[497,398],[-64,421],[139,13],[145,-328],[-109,-570],[297,-108],[-127,426],[465,233],[577,31],[513,-337],[-247,492],[-28,630],[483,119],[669,-26],[602,77],[-226,309],[321,388],[319,16],[540,293],[734,79],[93,162],[729,55],[227,-133],[624,314],[510,-10],[77,255],[265,252],[656,242],[476,-191],[-378,-146],[629,-90],[75,-292],[254,143],[812,-7],[626,-289],[223,-221],[-69,-307],[-307,-175],[-730,-328],[-209,-175],[345,-83],[410,-149],[251,112],[141,-379],[122,153],[444,93],[892,-97],[67,-276],[1162,-88],[15,451],[590,-104],[443,4],[449,-312],[128,-378],[-165,-247],[349,-465],[437,-240],[268,620],[446,-266],[473,159],[538,-182],[204,166],[455,-83],[-201,549],[367,256],[2509,-384],[236,-351],[727,-451],[1122,112],[553,-98],[231,-244],[-33,-432],[342,-168],[372,121],[492,15],[525,-116],[526,66],[484,-526],[344,189],[-224,378],[123,262],[886,-165],[578,36],[799,-282],[-99610,-258],[681,-451],[728,-588],[-24,-367],[187,-147],[-64,429],[754,-88],[544,-553],[-276,-257],[-455,-61],[-7,-578],[-111,-122],[-260,17],[-212,206],[-369,172],[-62,257],[-283,96],[-315,-76],[-151,207],[60,219],[-333,-140],[126,-278],[-158,-251],[99997,-3],[-357,-260],[-360,44],[250,-315],[166,-487],[128,-159],[32,-244],[-71,-157],[-518,129],[-777,-445],[-247,-69],[-425,-415],[-403,-362],[-102,-269],[-397,409],[-724,-464],[-126,219],[-268,-253],[-371,81],[-90,-388],[-333,-572],[10,-239],[316,-132],[-37,-860],[-258,-22],[-119,-494],[116,-255],[-486,-302],[-96,-674],[-415,-144],[-83,-600],[-400,-551],[-103,407],[-119,862],[-155,1313],[134,819],[234,353],[14,276],[432,132],[496,744],[479,608],[499,471],[223,833],[-337,-50],[-167,-487],[-705,-649],[-227,727],[-717,-201],[-696,-990],[230,-362],[-620,-154],[-430,-61],[20,427],[-431,90],[-344,-291],[-850,102],[-914,-175],[-899,-1153],[-1065,-1394],[438,-74],[136,-370],[270,-132],[178,295],[305,-38],[401,-650],[9,-503],[-217,-590],[-23,-705],[-126,-945],[-418,-855],[-94,-409],[-377,-688],[-374,-682],[-179,-349],[-370,-346],[-175,-8],[-175,287],[-373,-432],[-43,-197]],[[0,92833],[36,24],[235,-1],[402,-169],[-24,-81],[-286,-141],[-363,-36],[99694,-30],[-49,187],[-99645,247]],[[59287,77741],[73,146],[198,-127],[89,-23],[36,-117],[42,-18]],[[59725,77602],[2,-51],[136,-142],[284,35],[-55,-210],[-304,-103],[-377,-342],[-154,121],[61,277],[-304,173],[50,113],[265,197],[-42,71]],[[28061,66408],[130,47],[184,-18],[8,-153],[-303,-95],[-19,219]],[[28391,66555],[220,-265],[-48,-420],[-51,75],[4,309],[-124,234],[-1,67]],[[28280,65474],[84,-23],[97,-491],[1,-343],[-68,-29],[-70,340],[-104,171],[60,375]],[[33000,19946],[333,354],[236,-148],[167,237],[222,-266],[-83,-207],[-375,-177],[-125,207],[-236,-266],[-139,266]],[[54206,97653],[105,202],[408,20],[350,-206],[915,-440],[-699,-233],[-155,-435],[-243,-111],[-132,-490],[-335,-23],[-598,361],[252,210],[-416,170],[-541,499],[-216,463],[757,212],[152,-207],[396,8]],[[57942,91385],[117,414],[-356,235],[-431,-200],[-137,-433],[-265,-262],[-298,143],[-362,-29],[-309,312],[-167,-156]],[[55734,91409],[-172,-24],[-41,-389],[-523,95],[-74,-329],[-267,2],[-183,-421],[-278,-655],[-431,-831],[101,-202],[-97,-234],[-275,10],[-180,-554],[17,-784],[177,-300],[-92,-694],[-231,-405],[-122,-341]],[[53063,85353],[-187,363],[-548,-684],[-371,-138],[-384,301],[-99,635],[-88,1363],[256,381],[733,496],[549,609],[508,824],[668,1141],[465,444],[763,741],[610,259],[457,-31],[423,489],[506,-26],[499,118],[869,-433],[-358,-158],[305,-371]],[[57613,97879],[-412,-318],[-806,-70],[-819,98],[-50,163],[-398,11],[-304,271],[858,165],[403,-142],[281,177],[702,-148],[545,-207]],[[56867,96577],[-620,-241],[-490,137],[191,152],[-167,189],[575,119],[110,-222],[401,-134]],[[37010,99398],[932,353],[975,-27],[354,218],[982,57],[2219,-74],[1737,-469],[-513,-227],[-1062,-26],[-1496,-58],[140,-105],[984,65],[836,-204],[540,181],[231,-212],[-305,-344],[707,220],[1348,229],[833,-114],[156,-253],[-1132,-420],[-157,-136],[-888,-102],[643,-28],[-324,-431],[-224,-383],[9,-658],[333,-386],[-434,-24],[-457,-187],[513,-313],[65,-502],[-297,-55],[360,-508],[-617,-42],[322,-241],[-91,-208],[-391,-91],[-388,-2],[348,-400],[4,-263],[-549,244],[-143,-158],[375,-148],[364,-361],[105,-476],[-495,-114],[-214,228],[-344,340],[95,-401],[-322,-311],[732,-25],[383,-32],[-745,-515],[-755,-466],[-813,-204],[-306,-2],[-288,-228],[-386,-624],[-597,-414],[-192,-24],[-370,-145],[-399,-138],[-238,-365],[-4,-415],[-141,-388],[-453,-472],[112,-462],[-125,-488],[-142,-577],[-391,-36],[-410,482],[-556,3],[-269,324],[-186,577],[-481,735],[-141,385],[-38,530],[-384,546],[100,435],[-186,208],[275,691],[418,220],[110,247],[58,461],[-318,-209],[-151,-88],[-249,-84],[-341,193],[-19,401],[109,314],[258,9],[567,-157],[-478,375],[-249,202],[-276,-83],[-232,147],[310,550],[-169,220],[-220,409],[-335,626],[-353,230],[3,247],[-745,346],[-590,43],[-743,-24],[-677,-44],[-323,188],[-482,372],[729,186],[559,31],[-1188,154],[-627,241],[39,229],[1051,285],[1018,284],[107,214],[-750,213],[243,235],[961,413],[404,63],[-115,265],[658,156],[854,93],[853,5],[303,-184],[737,325],[663,-221],[390,-46],[577,-192],[-660,318],[38,253]],[[69148,21851],[179,-186],[263,-74],[9,-112],[-77,-269],[-427,-38],[-7,314],[41,244],[19,121]],[[84713,45326],[32,139],[239,133],[194,20],[87,74],[105,-74],[-102,-160],[-289,-258],[-233,-170]],[[54540,33696],[133,292],[109,-162],[47,-252],[125,-43],[175,-112],[149,43],[248,302],[0,2182]],[[55526,35946],[75,-88],[165,-562],[-26,-360],[62,-207],[199,60],[139,264],[132,177],[68,283],[135,137],[117,-71],[133,-166],[226,-29],[178,138],[28,184],[48,283],[152,47],[83,222],[93,393],[249,442],[393,435]],[[58175,37528],[113,-7],[134,-100],[94,71],[148,-59]],[[58664,37433],[133,-832],[72,-419],[-49,-659],[23,-212]],[[58843,35311],[-140,108],[-80,-42],[-26,-172],[-76,-222],[2,-204],[166,-320],[163,63],[56,263]],[[58908,34785],[211,-5]],[[59119,34780],[-70,-430],[-32,-491],[-72,-267],[-190,-298],[-54,-86],[-118,-300],[-77,-303],[-158,-424],[-314,-609],[-196,-355],[-210,-269],[-290,-229],[-141,-31],[-36,-164],[-169,88],[-138,-113],[-301,114],[-168,-72],[-115,31],[-286,-233],[-238,-94],[-171,-223],[-127,-14],[-117,210],[-94,11],[-120,264],[-13,-82],[-37,159],[2,346],[-90,396],[89,108],[-7,453],[-182,553],[-139,501],[-1,1],[-199,768]],[[58049,33472],[-121,182],[-130,-120],[-151,-232],[-148,-374],[209,-454],[99,59],[51,188],[155,93],[47,192],[85,288],[-96,178]],[[23016,65864],[-107,-518],[-49,-426],[-20,-791],[-27,-289],[48,-322],[86,-288],[56,-458],[184,-440],[65,-337],[109,-291],[295,-157],[114,-247],[244,165],[212,60],[208,106],[175,101],[176,241],[67,345],[22,496],[48,173],[188,155],[294,137],[246,-21],[169,50],[66,-125],[-9,-285],[-149,-351],[-66,-360],[51,-103],[-42,-255],[-69,-461],[-71,152],[-58,-10]],[[25472,61510],[-53,-8],[-99,-357],[-51,70],[-33,-27],[2,-87]],[[25238,61101],[-257,7],[-259,-1],[-1,-333],[-125,-1],[103,-198],[103,-136],[31,-128],[45,-36],[-7,-201],[-357,-2],[-133,-481],[39,-111],[-32,-138],[-7,-172]],[[24381,59170],[-314,636],[-144,191],[-226,155],[-156,-43],[-223,-223],[-140,-58],[-196,156],[-208,112],[-260,271],[-208,83],[-314,275],[-233,282],[-70,158],[-155,35],[-284,187],[-116,270],[-299,335],[-139,373],[-66,288],[93,57],[-29,169],[64,153],[1,204],[-93,266],[-25,235],[-94,298],[-244,587],[-280,462],[-135,368],[-238,241],[-51,145],[42,365],[-142,138],[-164,287],[-69,412],[-149,48],[-162,311],[-130,288],[-12,184],[-149,446],[-99,452],[5,227],[-201,234],[-93,-25],[-159,163],[-44,-240],[46,-284],[27,-444],[95,-243],[206,-407],[46,-139],[42,-42],[37,-203],[49,8],[56,-381],[85,-150],[59,-210],[174,-300],[92,-550],[83,-259],[77,-277],[15,-311],[134,-20],[112,-268],[100,-264],[-6,-106],[-117,-217],[-49,3],[-74,359],[-181,337],[-201,286],[-142,150],[9,432],[-42,320],[-132,183],[-191,264],[-37,-76],[-70,154],[-171,143],[-164,343],[20,44],[115,-33],[103,221],[10,266],[-214,422],[-163,163],[-102,369],[-103,388],[-129,472],[-113,531]],[[33993,32727],[180,63],[279,-457],[103,18],[286,-379],[218,-327],[160,-402],[-122,-280],[77,-334]],[[35174,30629],[-121,-372],[-313,-328],[-205,118],[-151,-63],[-256,253],[-189,-19],[-169,327]],[[34826,35372],[54,341],[38,350],[0,325],[-100,107],[-104,-96],[-103,26],[-33,228],[-26,541],[-52,177],[-187,160],[-114,-116],[-293,113],[18,802],[-82,329]],[[33842,38659],[87,122],[-27,337],[77,259],[49,465],[-66,367],[-151,166],[-30,233],[41,342],[-533,24],[-107,688],[81,10],[-3,255],[-55,172],[-12,342],[-161,175],[-175,-6],[-115,172],[-188,117],[-109,220],[-311,98],[-302,529],[23,396],[-34,227],[29,443],[-363,-100],[-147,-222],[-243,-239],[-62,-179],[-143,-13],[-206,50]],[[30686,44109],[-157,-102],[-126,68],[18,898],[-228,-348],[-245,15],[-105,315],[-184,34],[59,254],[-155,359],[-115,532],[73,108],[0,250],[168,171],[-28,319],[71,206],[20,275],[318,402],[227,114],[37,89],[251,-28]],[[30585,48040],[125,1620],[6,256],[-43,339],[-123,215],[1,430],[156,97],[56,-61],[9,226],[-162,61],[-4,370],[541,-13],[92,203],[77,-187],[55,-349],[52,73]],[[31423,51320],[153,-312],[216,38],[54,181],[206,138],[115,97],[32,250],[198,168],[-15,124],[-235,51],[-39,372],[12,396],[-125,153],[52,55],[206,-76],[221,-148],[80,140],[200,92],[310,221],[102,225],[-37,167]],[[33129,53652],[145,26],[64,-136],[-36,-259],[96,-90],[63,-274],[-77,-209],[-44,-502],[71,-299],[20,-274],[171,-277],[137,-29],[30,116],[88,25],[126,104],[90,157],[154,-50],[67,21]],[[34294,51702],[151,-48],[25,120],[-46,118],[28,171],[112,-53],[131,61],[159,-125]],[[34854,51946],[121,-122],[86,160],[62,-25],[38,-166],[133,42],[107,224],[85,436],[164,540]],[[35650,53035],[95,28],[69,-327],[155,-1033],[149,-97],[7,-408],[-208,-487],[86,-178],[491,-92],[10,-593],[211,388],[349,-212],[462,-361],[135,-346],[-45,-327],[323,182],[540,-313],[415,23],[411,-489],[355,-662],[214,-170],[237,-24],[101,-186],[94,-752],[46,-358],[-110,-977],[-142,-385],[-391,-822],[-177,-668],[-206,-513],[-69,-11],[-78,-435],[20,-1107],[-77,-910],[-30,-390],[-88,-233],[-49,-790],[-282,-771],[-47,-610],[-225,-256],[-65,-355],[-302,2],[-437,-227],[-195,-263],[-311,-173],[-327,-470],[-235,-586],[-41,-441],[46,-326],[-51,-597],[-63,-289],[-195,-325],[-308,-1040],[-244,-468],[-189,-277],[-127,-562],[-183,-337]],[[33842,38659],[-4,182],[-259,302],[-258,9],[-484,-172],[-133,-520],[-7,-318],[-110,-708]],[[30669,40193],[175,638],[-119,496],[63,199],[-49,219],[108,295],[6,503],[13,415],[60,200],[-240,951]],[[30452,39739],[-279,340],[-24,242],[-551,593],[-498,646],[-214,365],[-115,488],[46,170],[-236,775],[-274,1090],[-262,1177],[-114,269],[-87,435],[-216,386],[-198,239],[90,264],[-134,563],[86,414],[221,373]],[[27693,48568],[33,-246],[-79,-141],[8,-216],[114,47],[113,-64],[116,-298],[157,243],[53,398],[170,514],[334,233],[303,619],[86,384],[-38,449]],[[29063,50490],[74,56],[184,-280],[89,-279],[129,-152],[163,-620],[207,-74],[153,157],[101,-103],[166,51],[213,-276],[-179,-602],[83,-14],[139,-314]],[[29063,50490],[-119,140],[-137,195],[-79,-94],[-235,82],[-68,255],[-52,-10],[-278,338]],[[28095,51396],[-37,183],[103,44],[-12,296],[65,214],[138,40],[117,371],[106,310],[-102,141],[52,343],[-62,540],[59,155],[-44,500],[-112,315]],[[28366,54848],[36,287],[89,-43],[52,176],[-64,348],[34,86]],[[28513,55702],[143,-18],[209,412],[114,63],[3,195],[51,500],[159,274],[175,11],[22,123],[218,-49],[218,298],[109,132],[134,285],[98,-36],[73,-156],[-54,-199]],[[30185,57537],[-178,-99],[-71,-295],[-107,-169],[-81,-220],[-34,-422],[-77,-345],[144,-40],[35,-271],[62,-130],[21,-238],[-33,-219],[10,-123],[69,-49],[66,-207],[357,57],[161,-75],[196,-508],[112,63],[200,-32],[158,68],[99,-102],[-50,-318],[-62,-199],[-22,-423],[56,-393],[79,-175],[9,-133],[-140,-294],[100,-130],[74,-207],[85,-589]],[[28366,54848],[-93,170],[-59,319],[68,158],[-70,40],[-52,196],[-138,164],[-122,-38],[-56,-205],[-112,-149],[-61,-20],[-27,-123],[132,-321],[-75,-76],[-40,-87],[-130,-30],[-48,353],[-36,-101],[-92,35],[-56,238],[-114,39],[-72,69],[-119,-1],[-8,-128],[-32,89]],[[26954,55439],[14,117],[23,120],[-10,107],[41,70],[-58,88],[-1,238],[107,53]],[[27070,56232],[100,-212],[-6,-126],[111,-26],[26,48],[77,-145],[136,42],[119,150],[168,119],[95,176],[153,-34],[-10,-58],[155,-21],[124,-102],[90,-177],[105,-164]],[[26954,55439],[-151,131],[-56,124],[32,103],[-11,130],[-77,142],[-109,116],[-95,76],[-19,173],[-73,105],[18,-172],[-55,-141],[-64,164],[-89,58],[-38,120],[2,179],[36,187],[-78,83],[64,114]],[[26191,57131],[42,76],[183,-156],[63,77],[89,-50],[46,-121],[82,-40],[66,126]],[[26762,57043],[70,-321],[108,-238],[130,-252]],[[26191,57131],[-96,186],[-130,238],[-61,200],[-117,185],[-140,267],[31,91],[46,-88],[21,41]],[[25745,58251],[86,25],[35,135],[41,5],[-6,290],[65,14],[58,-4],[60,158],[82,-120],[29,74],[51,70],[97,163],[4,121],[27,-5],[36,141],[29,17],[47,-90],[56,-27],[61,76],[70,0],[97,77],[38,81],[95,-12]],[[26903,59440],[-24,-57],[-14,-132],[29,-216],[-64,-202],[-30,-237],[-9,-261],[15,-152],[7,-266],[-43,-58],[-26,-253],[19,-156],[-56,-151],[12,-159],[43,-97]],[[25745,58251],[-48,185],[-84,51]],[[25613,58487],[19,237],[-38,64],[-57,42],[-122,-70],[-10,79],[-84,95],[-60,118],[-82,50]],[[25179,59102],[58,150],[-22,116],[20,113],[131,166],[127,225]],[[25493,59872],[29,-23],[61,104],[79,8],[26,-48],[43,29],[129,-53],[128,15],[90,66],[32,66],[89,-31],[66,-40],[73,14],[55,51],[127,-82],[44,-13],[85,-110],[80,-132],[101,-91],[73,-162]],[[25613,58487],[-31,-139],[-161,9],[-100,57],[-115,117],[-154,37],[-79,127]],[[24973,58695],[9,86],[95,149],[52,66],[-15,69],[65,37]],[[25238,61101],[-2,-468],[-22,-667],[83,0]],[[25297,59966],[90,-107],[24,88],[82,-75]],[[24973,58695],[-142,103],[-174,11],[-127,117],[-149,244]],[[25472,61510],[1,-87],[53,-3],[-5,-160],[-45,-256],[24,-91],[-29,-212],[18,-56],[-32,-299],[-55,-156],[-50,-19],[-55,-205]],[[30185,57537],[-8,-139],[-163,-69],[91,-268],[-3,-309],[-123,-344],[105,-468],[120,38],[62,427],[-86,208],[-14,447],[346,241],[-38,278],[97,186],[100,-415],[195,-9],[180,-330],[11,-195],[249,-6],[297,61],[159,-264],[213,-74],[155,185],[4,149],[344,35],[333,9],[-236,-175],[95,-279],[222,-44],[210,-291],[45,-473],[144,13],[109,-139]],[[33400,55523],[-220,-347],[-24,-215],[95,-220],[-69,-110],[-171,-95],[5,-273],[-75,-163],[188,-448]],[[33400,55523],[183,-217],[171,-385],[8,-304],[105,-14],[149,-289],[109,-205]],[[34125,54109],[-44,-532],[-169,-154],[15,-139],[-51,-305],[123,-429],[89,-1],[37,-333],[169,-514]],[[34125,54109],[333,-119],[30,107],[225,43],[298,-159]],[[35011,53981],[-144,-508],[22,-404],[109,-351],[-49,-254],[-24,-270],[-71,-248]],[[35011,53981],[95,-65],[204,-140],[294,-499],[46,-242]],[[51718,79804],[131,-155],[400,-109],[-140,-404],[-35,-421]],[[52074,78715],[-77,-101],[-126,54],[9,-150],[-203,-332],[-5,-267],[133,92],[95,-259]],[[51900,77752],[-11,-167],[82,-222],[-97,-180],[72,-457],[151,-75],[-32,-256]],[[52065,76395],[-252,-334],[-548,160],[-404,-192],[-32,-355]],[[50829,75674],[-322,-77],[-313,267],[-101,-127],[-511,268],[-111,230]],[[49471,76235],[144,354],[53,1177],[-287,620],[-205,299],[-424,227],[-28,431],[360,129],[466,-152],[-88,669],[263,-254],[646,461],[84,484],[243,119]],[[50698,80799],[40,-207],[129,-10],[129,-237],[194,-279],[143,46],[243,-269]],[[51576,79843],[62,-52],[80,13]],[[52429,75765],[179,226],[47,-507],[-92,-456],[-126,120],[-64,398],[56,219]],[[27693,48568],[148,442],[-60,258],[-106,-275],[-166,259],[56,167],[-47,536],[97,89],[52,368],[105,381],[-20,241],[153,126],[190,236]],[[31588,61519],[142,-52],[50,-118],[-71,-149],[-209,4],[-163,-21],[-16,253],[40,86],[227,-3]],[[28453,61504],[187,-53],[147,-142],[46,-161],[-195,-11],[-84,-99],[-156,95],[-159,215],[34,135],[116,41],[64,-20]],[[27147,64280],[240,-42],[219,-7],[261,-201],[110,-216],[260,66],[98,-138],[235,-366],[173,-267],[92,8],[165,-120],[-20,-167],[205,-24],[210,-242],[-33,-138],[-185,-75],[-187,-29],[-191,46],[-398,-57],[186,329],[-113,154],[-179,39],[-96,171],[-66,336],[-157,-23],[-259,159],[-83,124],[-362,91],[-97,115],[104,148],[-273,30],[-199,-307],[-115,-8],[-40,-144],[-138,-65],[-118,56],[146,183],[60,213],[126,131],[142,116],[210,56],[67,65]],[[58175,37528],[-177,267],[-215,90],[-82,375],[0,208],[-119,64],[-315,649],[-87,342],[-56,105],[-107,473]],[[57017,40101],[311,-65],[90,-68],[94,13],[154,383],[241,486],[100,46],[33,205],[159,235],[210,81]],[[58409,41417],[18,-220],[232,12],[128,-125],[60,-146],[132,-43],[145,-190],[0,-748],[-54,-409],[-12,-442],[45,-175],[-31,-348],[-42,-53],[-74,-426],[-292,-671]],[[55526,35946],[0,1725],[274,20],[8,2105],[207,19],[428,207],[106,-243],[177,231],[85,2],[156,133]],[[56967,40145],[50,-44]],[[54540,33696],[-207,446],[-108,432],[-62,575],[-68,428],[-93,910],[-7,707],[-35,322],[-108,243],[-144,489],[-146,708],[-60,371],[-226,577],[-17,453]],[[53259,40357],[134,113],[166,100],[180,-17],[166,-267],[42,41],[1126,26],[192,-284],[673,-83],[510,241]],[[56448,40227],[228,134],[180,-34],[109,-133],[2,-49]],[[45357,58612],[-115,460],[-138,210],[122,112],[134,415],[66,304]],[[45426,60113],[96,189],[138,-51],[135,129],[155,6],[133,-173],[184,-157],[168,-435],[184,-405]],[[46619,59216],[13,-368],[54,-338],[104,-166],[24,-229],[-13,-184]],[[46801,57931],[-40,-33],[-151,47],[-21,-66],[-61,-13],[-200,144],[-134,6]],[[46194,58016],[-513,25],[-75,-67],[-92,19],[-147,-96]],[[45367,57897],[-46,453]],[[45321,58350],[253,-13],[67,83],[50,5],[103,136],[119,-124],[121,-11],[120,133],[-56,170],[-92,-99],[-86,3],[-110,145],[-88,-9],[-63,-140],[-302,-17]],[[46619,59216],[93,107],[47,348],[88,14],[194,-165],[157,117],[107,-39],[42,131],[1114,9],[62,414],[-48,73],[-134,2550],[-134,2550],[425,10]],[[48632,65335],[937,-1289],[937,-1289],[66,-277],[173,-169],[129,-96],[3,-376],[308,58]],[[51185,61897],[1,-1361],[-152,-394],[-24,-364],[-247,-94],[-379,-51],[-102,-210],[-178,-23]],[[50104,59400],[-178,-3],[-70,114],[-153,-84],[-259,-246],[-53,-184],[-216,-265],[-38,-152],[-116,-120],[-134,79],[-76,-144],[-41,-405],[-221,-490],[7,-200],[-76,-250],[18,-343]],[[48498,56707],[-114,-88],[-65,-74],[-43,253],[-80,-67],[-48,11],[-51,-172],[-215,5],[-77,89],[-36,-54]],[[47769,56610],[-85,170],[15,176],[-35,69],[-59,-58],[11,192],[57,152],[-114,248],[-33,163],[-62,130],[-55,15],[-67,-83],[-90,-79],[-76,-128],[-119,48],[-77,150],[-46,19],[-73,-78],[-44,-1],[-16,216]],[[47587,66766],[1045,-1431]],[[45426,60113],[-24,318],[78,291],[34,557],[-30,583],[-34,294],[28,295],[-72,281],[-146,255]],[[50747,54278],[-229,-69]],[[50518,54209],[-69,407],[13,1357],[-56,122],[-11,290],[-96,207],[-85,174],[35,311]],[[50249,57077],[96,67],[56,258],[136,56],[61,176]],[[50598,57634],[93,173],[100,2],[212,-340]],[[51003,57469],[-11,-197],[62,-350],[-54,-238],[29,-159],[-135,-366],[-86,-181],[-52,-372],[7,-376],[-16,-952]],[[54026,58177],[-78,-34],[-9,-188]],[[53939,57955],[-52,-13],[-188,647],[-65,24],[-217,-331],[-215,173],[-150,34],[-80,-83],[-163,18],[-164,-252],[-141,-14],[-337,305],[-131,-145],[-142,10],[-104,223],[-279,221],[-298,-70],[-72,-128],[-39,-340],[-80,-238],[-19,-527]],[[50598,57634],[6,405],[-320,134],[-9,286],[-156,386],[-37,269],[22,286]],[[51185,61897],[392,263],[804,1161],[952,1126]],[[53333,64447],[439,-255],[156,-324],[197,220]],[[53939,57955],[110,-235],[-31,-107],[-14,-196],[-234,-457],[-74,-377],[-39,-307],[-59,-132],[-56,-414],[-148,-243],[-43,-299],[-63,-238],[-26,-246],[-191,-199],[-156,243],[-105,-10],[-165,-345],[-81,-6],[-132,-570],[-71,-418]],[[52361,53399],[-289,-213],[-105,31],[-107,-132],[-222,13],[-149,370],[-91,427],[-197,389],[-209,-7],[-245,1]],[[54244,54965],[-140,-599],[-67,-107],[-21,-458],[28,-249],[-23,-176],[132,-309],[23,-212],[103,-305],[127,-190],[12,-269],[29,-172]],[[54447,51919],[-20,-319],[-220,140],[-225,156],[-350,23]],[[53632,51919],[-35,32],[-164,-76],[-169,79],[-132,-38]],[[53132,51916],[-452,13]],[[52680,51929],[40,466],[-108,391],[-127,100],[-56,265],[-72,85],[4,163]],[[50518,54209],[-224,-126]],[[50294,54083],[-62,207],[-74,375],[-22,294],[61,532],[-69,215],[-27,466],[1,429],[-116,305],[20,184]],[[50006,57090],[243,-13]],[[50294,54083],[-436,-346],[-154,-203],[-250,-171],[-248,168]],[[49206,53531],[13,233],[-121,509],[73,667],[117,496],[-74,841]],[[49214,56277],[-38,444],[7,336],[482,27],[123,-43],[90,96],[128,-47]],[[48498,56707],[125,-129],[49,-195],[125,-125],[97,149],[130,22],[190,-152]],[[49206,53531],[-126,-7],[-194,116],[-178,-7],[-329,-103],[-193,-170],[-275,-217],[-54,15]],[[47857,53158],[22,487],[26,74],[-8,233],[-118,247],[-88,40],[-81,162],[60,262],[-28,286],[13,172]],[[47655,55121],[44,0],[17,258],[-22,114],[27,82],[103,71],[-69,473],[-64,245],[23,200],[55,46]],[[47655,55121],[-78,15],[-57,-238],[-78,3],[-55,126],[19,237],[-116,362],[-73,-67],[-59,-13]],[[47158,55546],[-77,-34],[3,217],[-44,155],[9,171],[-60,249],[-78,211],[-222,1],[-65,-112],[-76,-13],[-48,-128],[-32,-163],[-148,-260]],[[46320,55840],[-122,349],[-108,232],[-71,76],[-69,118],[-32,261],[-41,130],[-80,97]],[[45797,57103],[123,288],[84,-11],[73,99],[61,1],[44,78],[-24,196],[31,62],[5,200]],[[45797,57103],[-149,247],[-117,39],[-63,166],[1,90],[-84,125],[-18,127]],[[47857,53158],[-73,-5],[-286,282],[-252,449],[-237,324],[-187,381]],[[46822,54589],[66,189],[15,172],[126,320],[129,276]],[[46822,54589],[-75,44],[-200,238],[-144,316],[-49,216],[-34,437]],[[55125,52650],[-178,33],[-188,99],[-166,-313],[-146,-550]],[[56824,55442],[152,-239],[2,-192],[187,-308],[116,-255],[70,-355],[208,-234],[44,-187]],[[53609,47755],[-104,203],[-84,-100],[-112,-255]],[[53309,47603],[-228,626]],[[53081,48229],[212,326],[-105,391],[95,148],[187,73],[23,261],[148,-283],[245,-25],[85,279],[36,393],[-31,461],[-131,350],[120,684],[-69,117],[-207,-48],[-78,305],[21,258]],[[53081,48229],[-285,596],[-184,488],[-169,610],[9,196],[61,189],[67,430],[56,438]],[[52636,51176],[94,35],[404,-6],[-2,711]],[[52636,51176],[-52,90],[96,663]],[[59099,45126],[131,-264],[71,-501],[-47,-160],[-56,-479],[53,-490],[-87,-205],[-85,-549],[147,-153]],[[59226,42325],[-843,-487],[26,-421]],[[56448,40227],[-181,369],[-188,483],[13,1880],[579,-7],[-24,203],[41,222],[-49,277],[32,286],[-29,184]],[[59599,43773],[-77,-449],[77,-768],[97,9],[100,-191],[116,-427],[24,-760],[-120,-124],[-85,-410],[-181,365],[-21,417],[59,274],[-16,237],[-110,149],[-77,-54],[-159,284]],[[61198,44484],[45,-265],[-11,-588],[34,-519],[11,-923],[49,-290],[-83,-422],[-108,-410],[-177,-366],[-254,-225],[-313,-287],[-313,-634],[-107,-108],[-194,-420],[-115,-136],[-23,-421],[132,-448],[54,-346],[4,-177],[49,29],[-8,-579],[-45,-275],[65,-101],[-41,-245],[-116,-211],[-229,-199],[-334,-320],[-122,-219],[24,-248],[71,-40],[-24,-311]],[[58908,34785],[-24,261],[-41,265]],[[53383,47159],[-74,444]],[[53259,40357],[-26,372],[38,519],[96,541],[15,254],[90,532],[66,243],[159,386],[90,263],[29,438],[-15,335],[-83,211],[-74,358],[-68,355],[15,122],[85,235],[-84,570],[-57,396],[-139,374],[26,115]],[[58062,48902],[169,-46],[85,336],[147,-38]],[[59922,69905],[-49,-186]],[[59873,69719],[-100,82],[-58,-394],[69,-66],[-71,-81],[-12,-156],[131,80]],[[59832,69184],[7,-230],[-139,-944]],[[59700,68010],[-27,153],[-155,862]],[[59518,69025],[80,194],[-19,34],[74,276],[56,446],[40,149],[8,6]],[[59757,70130],[93,-1],[25,104],[75,8]],[[59950,70241],[4,-242],[-38,-90],[6,-4]],[[59757,70130],[99,482],[138,416],[5,21]],[[59999,71049],[125,-31],[45,-231],[-151,-223],[-68,-323]],[[63761,43212],[74,-251],[69,-390],[45,-711],[72,-276],[-28,-284],[-49,-174],[-94,347],[-53,-175],[53,-438],[-24,-250],[-77,-137],[-18,-500],[-109,-689],[-137,-814],[-172,-1120],[-106,-821],[-125,-685],[-226,-140],[-243,-250],[-160,151],[-220,211],[-77,312],[-18,524],[-98,471],[-26,425],[50,426],[128,102],[1,197],[133,447],[25,377],[-65,280],[-52,372],[-23,544],[97,331],[38,375],[138,22],[155,121],[103,107],[122,7],[158,337],[229,364],[83,297],[-38,253],[118,-71],[153,410],[6,356],[92,264],[96,-254]],[[59873,69719],[0,-362],[-41,-173]],[[45321,58350],[36,262]],[[52633,68486],[-118,1061],[-171,238],[-3,143],[-227,352],[-24,445],[171,330],[65,487],[-44,563],[57,303]],[[52339,72408],[302,239],[195,-71],[-9,-299],[236,217],[20,-113],[-139,-290],[-2,-273],[96,-147],[-36,-511],[-183,-297],[53,-322],[143,-10],[70,-281],[106,-92]],[[53191,70158],[-16,-454],[-135,-170],[-86,-189],[-191,-228],[30,-244],[-24,-250],[-136,-137]],[[47592,66920],[-2,700],[449,436],[277,90],[227,159],[107,295],[324,234],[12,438],[161,51],[126,219],[363,99],[51,230],[-73,125],[-96,624],[-17,359],[-104,379]],[[49397,71358],[267,323],[300,102],[175,244],[268,180],[471,105],[459,48],[140,-87],[262,232],[297,5],[113,-137],[190,35]],[[52633,68486],[90,-522],[15,-274],[-49,-482],[21,-270],[-36,-323],[24,-371],[-110,-247],[164,-431],[11,-253],[99,-330],[130,109],[219,-275],[122,-370]],[[59922,69905],[309,-234],[544,630]],[[60775,70301],[112,-720]],[[60887,69581],[-53,-89],[-556,-296],[277,-591],[-92,-101],[-46,-197],[-212,-82],[-66,-213],[-120,-182],[-310,94]],[[59709,67924],[-9,86]],[[64327,64904],[49,29],[11,-162],[217,93],[230,-15],[168,-18],[190,400],[207,379],[176,364]],[[65575,65974],[52,-202]],[[65627,65772],[38,-466]],[[65665,65306],[-142,-3],[-23,-384],[50,-82],[-126,-117],[-1,-241],[-81,-245],[-7,-238]],[[65335,63996],[-56,-125],[-835,298],[-106,599],[-11,136]],[[64113,65205],[-18,430],[75,310],[76,64],[84,-185],[5,-346],[-61,-348]],[[64274,65130],[-77,-42],[-84,117]],[[63326,68290],[58,-261],[-25,-135],[89,-445]],[[63448,67449],[-196,-16],[-69,282],[-248,57]],[[62935,67772],[204,567],[187,-49]],[[60775,70301],[615,614],[105,715],[-26,431],[152,146],[142,369]],[[61763,72576],[119,92],[324,-77],[97,-150],[133,100]],[[62436,72541],[180,-705],[182,-177],[21,-345],[-139,-204],[-65,-461],[193,-562],[340,-324],[143,-449],[-46,-428],[89,0],[3,-314],[153,-311]],[[63490,68261],[-164,29]],[[62935,67772],[-516,47],[-784,1188],[-413,414],[-335,160]],[[65665,65306],[125,-404],[155,-214],[203,-78],[165,-107],[125,-339],[75,-196],[100,-75],[-1,-132],[-101,-352],[-44,-166],[-117,-189],[-104,-404],[-126,31],[-58,-141],[-44,-300],[34,-395],[-26,-72],[-128,2],[-174,-221],[-27,-288],[-63,-125],[-173,5],[-109,-149],[1,-238],[-134,-165],[-153,56],[-186,-199],[-128,-34]],[[64752,60417],[-91,413],[-217,975]],[[64444,61805],[833,591],[185,1182],[-127,418]],[[65575,65974],[80,201],[35,-51],[-26,-244],[-37,-108]],[[96448,41190],[175,-339],[-92,-78],[-93,259],[10,158]],[[96330,41322],[-39,163],[-6,453],[133,-182],[45,-476],[-75,74],[-58,-32]],[[78495,57780],[-66,713],[178,492],[359,112],[261,-84]],[[79227,59013],[229,-232],[126,407],[246,-217]],[[79828,58971],[64,-394],[-34,-708],[-467,-455],[122,-358],[-292,-43],[-240,-238]],[[78981,56775],[-233,87],[-112,307],[-141,611]],[[78495,57780],[-249,271],[-238,-11],[41,464],[-245,-3],[-22,-650],[-150,-863],[-90,-522],[19,-428],[181,-18],[113,-539],[50,-512],[155,-338],[168,-69],[144,-306]],[[78372,54256],[-91,-243],[-183,-71],[-22,304],[-227,258],[-48,-105]],[[77801,54399],[-110,227],[-47,292],[-148,334],[-135,280],[-45,-347],[-53,328],[30,369],[82,566]],[[77375,56448],[135,607],[152,551],[-108,539],[4,274],[-32,330],[-185,470],[-66,296],[96,109],[101,514],[-113,390],[-177,431],[-134,519],[117,107],[127,639],[196,26],[162,256],[159,137]],[[77809,62643],[120,-182],[16,-355],[188,-27],[-68,-623],[6,-530],[293,353],[83,-104],[163,17],[56,205],[210,-40],[211,-480],[18,-583],[224,-515],[-12,-500],[-90,-266]],[[77809,62643],[59,218],[237,384]],[[78105,63245],[25,-139],[148,-16],[-42,676],[144,86]],[[78380,63852],[162,-466],[125,-537],[342,-5],[108,-515],[-178,-155],[-80,-212],[333,-353],[231,-699],[175,-520],[210,-411],[70,-418],[-50,-590]],[[77375,56448],[-27,439],[86,452],[-94,350],[23,644],[-113,306],[-90,707],[-50,746],[-121,490],[-183,-297],[-315,-421],[-156,53],[-172,138],[96,732],[-58,554],[-218,681],[34,213],[-163,76],[-197,481]],[[75657,62792],[-18,476],[97,-90],[6,424]],[[75742,63602],[137,140],[-30,251],[63,201],[11,612],[217,-135],[124,487],[14,288],[153,496],[-8,338],[359,408],[199,-107],[-23,364],[97,108],[-20,224]],[[77035,67277],[162,44],[93,-348],[121,-141],[8,-452],[-11,-487],[-263,-493],[-33,-701],[293,98],[66,-544],[176,-115],[-81,-490],[206,-222],[121,-109],[203,172],[9,-244]],[[78380,63852],[149,145],[221,-3],[271,68],[236,315],[134,-222],[254,-108],[-44,-340],[132,-240],[280,-154]],[[80013,63313],[-371,-505],[-231,-558],[-61,-410],[212,-623],[260,-772],[252,-365],[169,-475],[127,-1093],[-37,-1039],[-232,-389],[-318,-381],[-227,-492],[-346,-550],[-101,378],[78,401],[-206,335]],[[86327,75524],[0,0]],[[86327,75524],[-106,36],[-120,-200],[-83,-202],[10,-424],[-143,-130],[-50,-105],[-104,-174],[-185,-97],[-121,-159],[-9,-256],[-32,-65],[111,-96],[157,-259]],[[85652,73393],[-40,-143],[-118,-39],[-197,-29],[-108,-266],[-124,21],[-17,-54]],[[85048,72883],[-135,112],[-34,-111],[-81,-49],[-10,112],[-72,54],[-75,94],[76,260],[66,69],[-25,108],[71,319],[-18,96],[-163,65],[-131,158]],[[84517,74170],[227,379],[306,318],[191,419],[131,-185],[241,-22],[-44,312],[429,254],[111,331],[179,-348]],[[85652,73393],[240,-697],[68,-383],[3,-681],[-105,-325],[-252,-113],[-222,-245],[-250,-51],[-31,322],[51,443],[-122,615],[206,99],[-190,506]],[[82410,80055],[-135,-446],[-197,-590],[72,-241],[157,74],[274,-92],[214,219],[223,-189],[251,-413],[-30,-210],[-219,66],[-404,-78],[-195,-168],[-204,-391],[-423,-229],[-277,-313],[-286,120],[-156,53],[-146,-381],[89,-227],[45,-195],[-194,-199],[-200,-316],[-324,-208],[-417,-22],[-448,-205],[-324,-318],[-123,184],[-336,-1],[-411,359],[-274,88],[-369,-82],[-574,133],[-306,-14],[-163,351],[-127,544],[-171,66],[-336,368],[-374,83],[-330,101],[-100,256],[107,690],[-192,476],[-396,222],[-233,313],[-73,413]],[[75742,63602],[-147,937],[-76,-2],[-46,-377],[-152,306],[86,336],[124,34],[128,500],[-160,101],[-257,-8],[-265,81],[-24,410],[-133,30],[-220,255],[-98,-401],[200,-313],[-173,-220],[-62,-215],[171,-159],[-47,-356],[96,-444],[43,-486]],[[74730,63611],[-39,-216],[-189,7],[-343,-122],[16,-445],[-148,-349],[-400,-398],[-311,-695],[-209,-373],[-276,-387],[-1,-271],[-138,-146],[-251,-212],[-129,-31],[-84,-450],[58,-769],[15,-490],[-118,-561],[-1,-1004],[-144,-29],[-126,-450],[84,-195],[-253,-168],[-93,-401],[-112,-170],[-263,552],[-128,827],[-107,596],[-97,279],[-148,568],[-69,739],[-48,369],[-253,811],[-115,1145],[-83,756],[1,716],[-54,553],[-404,-353],[-196,70],[-362,716],[133,214],[-82,232],[-326,501]],[[68937,64577],[185,395],[612,-2],[-56,507],[-156,300],[-31,455],[-182,265],[306,619],[323,-45],[290,620],[174,599],[270,593],[-4,421],[236,342],[-224,292],[-96,400],[-99,517],[137,255],[421,-144],[310,88],[268,496]],[[71621,71550],[298,-692],[-28,-482],[111,-303],[-9,-301],[-200,79],[78,-651],[273,-374],[386,-413]],[[72530,68413],[-176,-268],[-108,-553],[269,-224],[262,-289],[362,-332],[381,-76],[160,-301],[215,-56],[334,-138],[231,10],[32,234],[-36,375],[21,255]],[[74477,67050],[170,124],[23,-465]],[[74670,66709],[6,-119],[252,-224],[175,92],[234,-39],[227,17],[20,363],[-113,189]],[[75471,66988],[224,74],[252,439],[321,376],[233,-145],[198,249],[130,-367],[-94,-248],[300,-89]],[[75657,62792],[-79,308],[-16,301],[-53,285],[-116,344],[-256,23],[25,-243],[-87,-329],[-118,120],[-41,-108],[-78,65],[-108,53]],[[74670,66709],[184,439],[150,150],[198,-137],[147,-14],[122,-159]],[[72530,68413],[115,141],[223,-182],[280,-385],[157,-84],[93,-284],[216,-117],[225,-259],[314,-136],[324,-57]],[[68937,64577],[-203,150],[-83,424],[-215,450],[-512,-111],[-451,-11],[-391,-83]],[[67082,65396],[105,687],[400,305],[-23,272],[-133,96],[-7,520],[-266,260],[-112,357],[-137,310]],[[66909,68203],[465,-301],[278,88],[166,-75],[56,129],[194,-52],[361,246],[10,503],[154,334],[207,-1],[31,166],[212,77],[103,-55],[108,166],[-15,355],[118,356],[177,150],[-110,390],[265,-18],[76,213],[-12,227],[139,248],[-32,294],[-66,250],[163,258],[298,124],[319,68],[141,109],[162,67]],[[70877,72519],[205,-276],[82,-454],[457,-239]],[[68841,72526],[85,-72],[201,189],[93,-114],[90,271],[166,-12],[43,86],[29,239],[120,205],[150,-134],[-30,-181],[84,-28],[-26,-496],[110,-194],[97,125],[123,58],[173,265],[192,-44],[286,-1]],[[70827,72688],[50,-169]],[[66909,68203],[252,536],[-23,380],[-210,100],[-22,375],[-91,472],[119,323],[-121,87],[76,430],[113,736]],[[67002,71642],[284,-224],[209,79],[58,268],[219,89],[157,180],[55,472],[234,114],[44,211],[131,-158],[84,-19]],[[69725,74357],[-101,-182],[-303,98],[-26,-340],[301,46],[343,-192],[526,89]],[[70465,73876],[70,-546],[91,59],[169,-134],[-10,-230],[42,-337]],[[72294,75601],[-39,-134],[-438,-320],[-99,-234],[-356,-70],[-105,-378],[-294,80],[-192,-116],[-266,-279],[39,-138],[-79,-136]],[[67002,71642],[-24,498],[-207,21],[-318,523],[-221,65],[-308,299],[-197,55],[-122,-110],[-186,17],[-197,-338],[-244,-114]],[[64978,72558],[-52,417],[40,618],[-216,200],[71,405],[-184,34],[61,498],[262,-145],[244,189],[-202,355],[-80,338],[-224,-151],[-28,-433],[-87,383]],[[62436,72541],[-152,473],[55,183],[-87,678],[190,168]],[[62442,74043],[44,-223],[141,-273],[190,-78]],[[62817,73469],[101,17]],[[62918,73486],[327,436],[104,44],[82,-174],[-95,-292],[173,-309],[69,29]],[[63578,73220],[88,-436],[263,-123],[193,-296],[395,-102],[434,156],[27,139]],[[67082,65396],[-523,179],[-303,136],[-313,76],[-118,725],[-133,105],[-214,-106],[-280,-286],[-339,196],[-281,454],[-267,168],[-186,561],[-205,788],[-149,-96],[-177,196],[-104,-231]],[[59999,71049],[-26,452],[68,243]],[[60041,71744],[74,129],[75,130],[15,329],[91,-115],[306,165],[147,-112],[229,2],[320,222],[149,-10],[316,92]],[[62817,73469],[-113,342],[1,91],[-123,-2],[-82,159],[-58,-16]],[[62442,74043],[-109,172],[-207,147],[27,288],[-47,208]],[[62106,74858],[386,92]],[[62492,74950],[57,-155],[106,-103],[-56,-148],[148,-202],[-78,-189],[118,-160],[124,-97],[7,-410]],[[55734,91409],[371,-289],[433,-402],[8,-910],[93,-230]],[[56639,89578],[-478,-167],[-269,-413],[43,-361],[-441,-475],[-537,-509],[-202,-832],[198,-416],[265,-328],[-255,-666],[-289,-138],[-106,-992],[-157,-554],[-337,57],[-158,-468],[-321,-27],[-89,558],[-232,671],[-211,835]],[[58829,81362],[-239,-35],[-85,-129],[-18,-298],[-111,57],[-250,-28],[-73,138],[-104,-103],[-105,86],[-218,12],[-310,141],[-281,47],[-215,-14],[-152,-160],[-133,-23]],[[56535,81053],[-6,263],[-85,274],[166,121],[2,235],[-77,225],[-12,261]],[[56523,82432],[268,-4],[302,223],[64,333],[228,190],[-26,264]],[[57359,83438],[169,100],[298,228]],[[60617,78409],[-222,-48],[-185,-191],[-260,-31],[-239,-220],[14,-317]],[[59287,77741],[-38,64],[-432,149],[-19,221],[-257,-73],[-103,-325],[-215,-437]],[[58223,77340],[-126,101],[-131,-95],[-124,109]],[[57842,77455],[70,64],[49,203],[76,188],[-20,106],[58,47],[27,-81],[164,-18],[74,44],[-52,60],[19,88],[-97,150],[-40,247],[-101,97],[20,200],[-125,159],[-115,22],[-204,184],[-185,-58],[-66,-87]],[[57394,79070],[-118,0],[-69,-139],[-205,-56],[-95,-91],[-129,144],[-178,3],[-172,65],[-120,-127]],[[56308,78869],[-19,159],[-155,161]],[[56134,79189],[55,238],[77,154]],[[56266,79581],[60,-35],[-71,266],[252,491],[138,69],[29,166],[-139,515]],[[56266,79581],[-264,227],[-200,-84],[-131,61],[-165,-127],[-140,210],[-114,-81],[-16,36]],[[55236,79823],[-127,291],[-207,36],[-26,185],[-191,66],[-41,-153],[-151,122],[17,163],[-207,51],[-132,191]],[[54171,80775],[-114,377],[22,204],[-69,316],[-101,210],[77,158],[-64,300]],[[53922,82340],[189,174],[434,273],[350,200],[277,-100],[21,-144],[268,-7]],[[56314,82678],[142,-64],[67,-182]],[[54716,79012],[-21,-241],[-156,-2],[53,-128],[-92,-380]],[[54500,78261],[-53,-100],[-243,-14],[-140,-134],[-229,45]],[[53835,78058],[-398,153],[-62,205],[-274,-102],[-32,-113],[-169,84]],[[52900,78285],[-142,16],[-125,108],[42,145],[-10,104]],[[52665,78658],[83,33],[141,-164],[39,156],[245,-25],[199,106],[133,-18],[87,-121],[26,100],[-40,385],[100,75],[98,272]],[[53776,79457],[206,-190],[157,242],[98,44],[215,-180],[131,30],[128,-111]],[[54711,79292],[-23,-75],[28,-205]],[[56308,78869],[-170,-123],[-131,-401],[-168,-401],[-223,-111]],[[55616,77833],[-173,26],[-213,-155]],[[55230,77704],[-104,-89],[-229,114],[-208,253],[-88,73]],[[54601,78055],[-54,200],[-47,6]],[[54716,79012],[141,-151],[103,-65],[233,73],[22,118],[111,18],[135,92],[30,-38],[130,74],[66,139],[91,36],[297,-180],[59,61]],[[57842,77455],[-50,270],[30,252],[-9,259],[-160,352],[-89,249],[-86,175],[-84,58]],[[58223,77340],[6,-152],[-135,-128],[-84,56],[-78,-713]],[[57932,76403],[-163,62],[-202,215],[-327,-138],[-138,-150],[-408,31],[-213,92],[-108,-43],[-80,243]],[[56293,76715],[-51,103],[65,99],[-69,74],[-87,-133],[-162,172],[-22,244],[-169,139],[-31,188],[-151,232]],[[55907,83187],[-59,497]],[[55848,83684],[318,181],[466,-38],[273,59],[39,-123],[148,-38],[267,-287]],[[55848,83684],[10,445],[136,371],[262,202],[221,-442],[223,12],[53,453]],[[56753,84725],[237,105],[121,-73],[239,-219],[229,-1]],[[56753,84725],[32,349],[-102,-75],[-176,210],[-24,340],[351,164],[350,86],[301,-97],[287,17]],[[54171,80775],[-124,-62],[-73,68],[-70,-113],[-200,-114],[-103,-147],[-202,-129],[49,-176],[30,-249],[141,-142],[157,-254]],[[52665,78658],[-298,181],[-57,-128],[-236,4]],[[51718,79804],[16,259],[-56,133]],[[51678,80196],[32,400]],[[51710,80596],[-47,619],[167,0],[70,222],[69,541],[-51,200]],[[51918,82178],[54,125],[232,32],[52,-130],[188,291],[-63,222],[-13,335]],[[52368,83053],[210,-78],[178,90]],[[52756,83065],[4,-228],[281,-138],[-3,-210],[283,111],[156,162],[313,-233],[132,-189]],[[57932,76403],[-144,-245],[-101,-422],[89,-337]],[[57776,75399],[-239,79],[-283,-186]],[[57254,75292],[-3,-294],[-252,-56],[-196,206],[-222,-162],[-206,17]],[[56375,75003],[-20,391],[-139,189]],[[56216,75583],[46,84],[-30,70],[47,188],[105,185],[-135,255],[-24,216],[68,134]],[[57302,71436],[-35,-175],[-400,-50],[3,98],[-339,115],[52,251],[152,-199],[216,34],[207,-42],[-7,-103],[151,71]],[[57254,75292],[135,-157],[-86,-369],[-66,-67]],[[57237,74699],[-169,17],[-145,56],[-336,-154],[192,-332],[-141,-96],[-154,-1],[-147,305],[-52,-130],[62,-353],[139,-277],[-105,-129],[155,-273],[137,-171],[4,-334],[-257,157],[82,-302],[-176,-62],[105,-521],[-184,-8],[-228,257],[-104,473],[-49,393],[-108,272],[-143,337],[-18,168]],[[55597,73991],[129,287],[16,192],[91,85],[5,155]],[[55838,74710],[182,53],[106,129],[150,-12],[46,103],[53,20]],[[60041,71744],[-102,268],[105,222],[-169,-51],[-233,136],[-191,-340],[-421,-66],[-225,317],[-300,20],[-64,-245],[-192,-70],[-268,314],[-303,-11],[-165,588],[-203,328],[135,459],[-176,283],[308,565],[428,23],[117,449],[529,-78],[334,383],[324,167],[459,13],[485,-417],[399,-228],[323,91],[239,-53],[328,309]],[[61542,75120],[296,28],[268,-290]],[[57776,75399],[33,-228],[243,-190],[-51,-145],[-330,-33],[-118,-182],[-232,-319],[-87,276],[3,121]],[[55597,73991],[-48,41],[-5,130],[-154,199],[-24,281],[23,403],[38,184],[-47,93]],[[55380,75322],[-18,188],[120,291],[18,-111],[75,52]],[[55575,75742],[59,-159],[66,-60],[19,-214]],[[55719,75309],[-35,-201],[39,-254],[115,-144]],[[55230,77704],[67,-229],[89,-169],[-107,-222]],[[55279,77084],[-126,131],[-192,-8],[-239,98],[-130,-13],[-60,-123],[-99,136],[-59,-245],[136,-277],[61,-183],[127,-221],[106,-130],[105,-247],[246,-224]],[[55155,75778],[-31,-100]],[[55124,75678],[-261,218],[-161,213],[-254,176],[-233,434],[56,45],[-127,248],[-5,200],[-179,93],[-85,-255],[-82,198],[6,205],[10,9]],[[53809,77462],[194,-20],[51,100],[94,-97],[109,-11],[-1,165],[97,60],[27,239],[221,157]],[[52900,78285],[-22,-242],[-122,-100],[-206,75],[-60,-239],[-132,-19],[-48,94],[-156,-200],[-134,-28],[-120,126]],[[51576,79843],[30,331],[72,22]],[[50698,80799],[222,117]],[[50920,80916],[204,-47],[257,123],[176,-258],[153,-138]],[[50920,80916],[143,162],[244,869],[380,248],[231,-17]],[[47490,75324],[101,150],[113,86],[70,-289],[164,0],[47,75],[162,-21],[78,-296],[-129,-160],[-3,-461],[-45,-86],[-11,-280],[-120,-48],[111,-355],[-77,-388],[96,-175],[-38,-161],[-103,-222],[23,-195]],[[47929,72498],[-112,-153],[-146,83],[-143,-65],[42,462],[-26,363],[-124,55],[-67,224],[22,386],[111,215],[20,239],[58,355],[-6,250],[-56,212],[-12,200]],[[47490,75324],[14,420],[-114,257],[393,426],[340,-106],[373,3],[296,-101],[230,31],[449,-19]],[[50829,75674],[15,-344],[-263,-393],[-356,-125],[-25,-199],[-171,-327],[-107,-481],[108,-338],[-160,-263],[-60,-384],[-210,-118],[-197,-454],[-352,-9],[-265,11],[-174,-209],[-106,-223],[-136,49],[-103,199],[-79,340],[-259,92]],[[48278,82406],[46,-422],[-210,-528],[-493,-349],[-393,89],[225,617],[-145,601],[378,463],[210,276]],[[47896,83153],[57,-317],[-57,-317],[172,9],[210,-122]],[[96049,38125],[228,-366],[144,-272],[-105,-142],[-153,160],[-199,266],[-179,313],[-184,416],[-38,201],[119,-9],[156,-201],[122,-200],[89,-166]],[[95032,44386],[78,-203],[-194,4],[-106,363],[166,-142],[56,-22]],[[94910,44908],[-42,-109],[-206,512],[-57,353],[94,0],[100,-473],[111,-283]],[[94680,44747],[-108,-14],[-170,60],[-58,91],[17,235],[183,-93],[91,-124],[45,-155]],[[94344,45841],[65,-187],[12,-119],[-218,251],[-152,212],[-104,197],[41,60],[128,-142],[228,-272]],[[93649,46431],[111,-193],[-56,-33],[-121,134],[-114,243],[14,99],[166,-250]],[[99134,26908],[-105,-319],[-138,-404],[-214,-236],[-48,155],[-116,85],[160,486],[-91,326],[-299,236],[8,214],[201,206],[47,455],[-13,382],[-113,396],[8,104],[-133,244],[-218,523],[-117,418],[104,46],[151,-328],[216,-153],[78,-526],[202,-622],[5,403],[126,-161],[41,-447],[224,-192],[188,-48],[158,226],[141,-69],[-67,-524],[-85,-345],[-212,12],[-74,-179],[26,-254],[-41,-110]],[[97129,24846],[238,310],[167,306],[123,441],[106,149],[41,330],[195,273],[61,-251],[63,-244],[198,239],[80,-249],[0,-249],[-103,-274],[-182,-435],[-142,-238],[103,-284],[-214,-7],[-238,-223],[-75,-387],[-157,-597],[-219,-264],[-138,-169],[-256,13],[-180,194],[-302,42],[-46,217],[149,438],[349,583],[179,111],[200,225]],[[91024,26469],[166,-39],[20,-702],[-95,-203],[-29,-476],[-97,162],[-193,-412],[-57,32],[-171,19],[-171,505],[-38,390],[-160,515],[7,271],[181,-52],[269,-204],[151,81],[217,113]],[[85040,31546],[-294,-303],[-241,-137],[-53,-309],[-103,-240],[-236,-15],[-174,-52],[-246,107],[-199,-64],[-191,-27],[-165,-315],[-81,26],[-140,-167],[-133,-187],[-203,23],[-186,0],[-295,377],[-149,113],[6,338],[138,81],[47,134],[-10,212],[34,411],[-31,350],[-147,598],[-45,337],[12,336],[-111,385],[-7,174],[-123,235],[-35,463],[-158,467],[-39,252],[122,-255],[-93,548],[137,-171],[83,-229],[-5,303],[-138,465],[-26,186],[-65,177],[31,341],[56,146],[38,295],[-29,346],[114,425],[21,-450],[118,406],[225,198],[136,252],[212,217],[126,46],[77,-73],[219,220],[168,66],[42,129],[74,54],[153,-14],[292,173],[151,262],[71,316],[163,300],[13,236],[7,321],[194,502],[117,-510],[119,118],[-99,279],[87,287],[122,-128],[34,449],[152,291],[67,233],[140,101],[4,165],[122,-69],[5,148],[122,85],[134,80],[205,-271],[155,-350],[173,-4],[177,-56],[-59,325],[133,473],[126,155],[-44,147],[121,338],[168,208],[142,-70],[234,111],[-5,302],[-204,195],[148,86],[184,-147],[148,-242],[234,-151],[79,60],[172,-182],[162,169],[105,-51],[65,113],[127,-292],[-74,-316],[-105,-239],[-96,-20],[32,-236],[-81,-295],[-99,-291],[20,-166],[221,-327],[214,-189],[143,-204],[201,-350],[78,1],[145,-151],[43,-183],[265,-200],[183,202],[55,317],[56,262],[34,324],[85,470],[-39,286],[20,171],[-32,339],[37,445],[53,120],[-43,197],[67,313],[52,325],[7,168],[104,222],[78,-289],[19,-371],[70,-71],[11,-249],[101,-300],[21,-335],[-10,-214],[100,-464],[179,223],[92,-250],[133,-231],[-29,-262],[60,-506],[42,-295],[70,-72],[75,-505],[-27,-307],[90,-400],[301,-309],[197,-281],[186,-257],[-37,-143],[159,-371],[108,-639],[111,130],[113,-256],[68,91],[48,-626],[197,-363],[129,-226],[217,-478],[78,-475],[7,-337],[-19,-365],[132,-502],[-16,-523],[-48,-274],[-75,-527],[6,-339],[-55,-423],[-123,-538],[-205,-290],[-102,-458],[-93,-292],[-82,-510],[-107,-294],[-70,-442],[-36,-407],[14,-187],[-159,-205],[-311,-22],[-257,-242],[-127,-229],[-168,-254],[-230,262],[-170,104],[43,308],[-152,-112],[-243,-428],[-240,160],[-158,94],[-159,42],[-269,171],[-179,364],[-52,449],[-64,298],[-137,240],[-267,71],[91,287],[-67,438],[-136,-408],[-247,-109],[146,327],[42,341],[107,289],[-22,438],[-226,-504],[-174,-202],[-106,-470],[-217,243],[9,313],[-174,429],[-147,221],[52,137],[-356,358],[-195,17],[-267,287],[-498,-56],[-359,-211],[-317,-197],[-265,39]],[[72718,55024],[-42,-615],[-116,-168],[-242,-135],[-132,470],[-49,849],[126,959],[192,-328],[129,-416],[134,-616]],[[80409,61331],[-228,183],[-8,509],[137,267],[304,166],[159,-14],[62,-226],[-122,-260],[-64,-341],[-240,-284]],[[84517,74170],[-388,-171],[-204,-277],[-300,-161],[148,274],[-58,230],[220,397],[-147,310],[-242,-209],[-314,-411],[-171,-381],[-272,-29],[-142,-275],[147,-400],[227,-97],[9,-265],[220,-173],[311,422],[247,-230],[179,-15],[45,-310],[-393,-165],[-130,-319],[-270,-296],[-142,-414],[299,-325],[109,-581],[169,-541],[189,-454],[-5,-439],[-174,-161],[66,-315],[164,-184],[-43,-481],[-71,-468],[-155,-53],[-203,-640],[-225,-775],[-258,-705],[-382,-545],[-386,-498],[-313,-68],[-170,-262],[-96,192],[-157,-294],[-388,-296],[-294,-90],[-95,-624],[-154,-35],[-73,429],[66,228],[-373,189],[-131,-96]],[[83826,64992],[-167,-947],[-119,-485],[-146,499],[-32,438],[163,581],[223,447],[127,-176],[-49,-357]],[[53835,78058],[-31,-291],[67,-251]],[[53871,77516],[-221,86],[-226,-210],[15,-293],[-34,-168],[91,-301],[261,-298],[140,-488],[309,-476],[217,3],[68,-130],[-78,-118],[249,-214],[204,-178],[238,-308],[29,-111],[-52,-211],[-154,276],[-242,97],[-116,-382],[200,-219],[-33,-309],[-116,-35],[-148,-506],[-116,-46],[1,181],[57,317],[60,126],[-108,342],[-85,298],[-115,74],[-82,255],[-179,107],[-120,238],[-206,38],[-217,267],[-254,384],[-189,340],[-86,585],[-138,68],[-226,195],[-128,-80],[-161,-274],[-115,-43]],[[54100,73116],[211,51],[-100,-465],[41,-183],[-58,-303],[-213,222],[-141,64],[-387,300],[38,304],[325,-54],[284,64]],[[52419,74744],[139,183],[166,-419],[-39,-782],[-126,38],[-113,-197],[-105,156],[-11,713],[-64,338],[153,-30]],[[52368,83053],[-113,328],[-8,604],[46,159],[80,177],[244,37],[98,163],[223,167],[-9,-304],[-82,-192],[33,-166],[151,-89],[-68,-223],[-83,64],[-200,-425],[76,-288]],[[53436,83731],[88,-296],[-166,-478],[-291,333],[-39,246],[408,195]],[[47896,83153],[233,24],[298,-365],[-149,-406]],[[49140,82132],[1,0],[40,343],[-186,364],[-4,8],[-337,104],[-66,160],[101,264],[-92,163],[-149,-279],[-17,569],[-140,301],[101,611],[216,480],[222,-47],[335,49],[-297,-639],[283,81],[304,-3],[-72,-481],[-250,-530],[287,-38],[22,-62],[248,-697],[190,-95],[171,-673],[79,-233],[337,-113],[-34,-378],[-142,-173],[111,-305],[-250,-310],[-371,6],[-473,-163],[-130,116],[-183,-276],[-257,67],[-195,-226],[-148,118],[407,621],[249,127],[-2,1],[-434,98],[-79,235],[291,183],[-152,319],[52,387],[413,-54]],[[45969,89843],[-64,-382],[314,-403],[-361,-451],[-801,-405],[-240,-107],[-365,87],[-775,187],[273,261],[-605,289],[492,114],[-12,174],[-583,137],[188,385],[421,87],[433,-400],[422,321],[349,-167],[453,315],[461,-42]],[[63495,75281],[146,-311],[141,-419],[130,-28],[85,-159],[-228,-47],[-49,-459],[-48,-207],[-101,-138],[7,-293]],[[62492,74950],[68,96],[207,-169],[149,-36],[38,70],[-136,319],[72,82]],[[61542,75120],[42,252],[-70,403],[-160,218],[-154,68],[-102,181]],[[83564,58086],[-142,450],[238,-22],[97,-213],[-74,-510],[-119,295]],[[84051,56477],[70,165],[30,367],[153,35],[-44,-398],[205,570],[-26,-563],[-100,-195],[-87,-373],[-87,-175],[-171,409],[57,158]],[[85104,55551],[28,-392],[16,-332],[-94,-540],[-102,602],[-130,-300],[89,-435],[-79,-277],[-327,343],[-78,428],[84,280],[-176,280],[-87,-245],[-131,23],[-205,-330],[-46,173],[109,498],[175,166],[151,223],[98,-268],[212,162],[45,264],[196,15],[-16,457],[225,-280],[23,-297],[20,-218]],[[82917,56084],[-369,-561],[136,414],[200,364],[167,409],[146,587],[49,-482],[-183,-325],[-146,-406]],[[83982,61347],[-46,-245],[95,-423],[-73,-491],[-164,-196],[-43,-476],[62,-471],[147,-65],[123,70],[347,-328],[-27,-321],[91,-142],[-29,-272],[-216,290],[-103,310],[-71,-217],[-177,354],[-253,-87],[-138,130],[14,244],[87,151],[-83,136],[-36,-213],[-137,340],[-41,257],[-11,566],[112,-195],[29,925],[90,535],[169,-1],[171,-168],[85,153],[26,-150]],[[83899,57324],[-43,282],[166,-183],[177,1],[-5,-247],[-129,-251],[-176,-178],[-10,275],[20,301]],[[84861,57766],[78,-660],[-214,157],[5,-199],[68,-364],[-132,-133],[-11,416],[-84,31],[-43,357],[163,-47],[-4,224],[-169,451],[266,-13],[77,-220]],[[78372,54256],[64,-56],[164,-356],[116,-396],[16,-398],[-29,-269],[27,-203],[20,-349],[98,-163],[109,-523],[-5,-199],[-197,-40],[-263,438],[-329,469],[-32,301],[-161,395],[-38,489],[-100,322],[30,431],[-61,250]],[[80461,51765],[204,-202],[214,110],[56,500],[119,112],[333,128],[199,467],[137,374]],[[81723,53254],[126,-307],[58,202],[133,-19],[16,377],[13,291]],[[82069,53798],[214,411],[140,462],[112,2],[143,-299],[13,-257],[183,-165],[231,-177],[-20,-232],[-186,-29],[50,-289],[-205,-201]],[[81723,53254],[110,221],[236,323]],[[53809,77462],[62,54]],[[57797,86326],[-504,-47],[-489,-216],[-452,-125],[-161,323],[-269,193],[62,582],[-135,533],[133,345],[252,371],[635,640],[185,124],[-28,250],[-387,279]],[[54711,79292],[39,130],[123,-10],[95,61],[7,55],[54,28],[18,134],[64,26],[43,106],[82,1]],[[60669,61213],[161,-684],[77,-542],[152,-288],[379,-558],[154,-336],[151,-341],[87,-203],[136,-178]],[[61966,58083],[-83,-144],[-119,51]],[[61764,57990],[-95,191],[-114,346],[-124,190],[-71,204],[-242,237],[-191,7],[-67,124],[-163,-139],[-168,268],[-87,-441],[-323,124]],[[89411,73729],[-256,-595],[4,-610],[-104,-472],[48,-296],[-145,-416],[-355,-278],[-488,-36],[-396,-675],[-186,227],[-12,442],[-483,-130],[-329,-279],[-325,-11],[282,-435],[-186,-1004],[-179,-248],[-135,229],[69,533],[-176,172],[-113,405],[263,182],[145,371],[280,306],[203,403],[553,177],[297,-121],[291,1050],[185,-282],[408,591],[158,229],[174,723],[-47,664],[117,374],[295,108],[152,-819],[-9,-479]],[[90169,76553],[197,250],[62,-663],[-412,-162],[-244,-587],[-436,404],[-152,-646],[-308,-9],[-39,587],[138,455],[296,33],[81,817],[83,460],[326,-615],[213,-198],[195,-126]],[[86769,70351],[154,352],[158,-68],[114,248],[204,-127],[35,-203],[-156,-357],[-114,189],[-143,-137],[-73,-346],[-181,168],[2,281]],[[64752,60417],[-201,-158],[-54,-263],[-6,-201],[-277,-249],[-444,-276],[-249,-417],[-122,-33],[-83,35],[-163,-245],[-177,-114],[-233,-30],[-70,-34],[-61,-156],[-73,-43],[-43,-150],[-137,13],[-89,-80],[-192,30],[-72,345],[8,323],[-46,174],[-54,437],[-80,243],[56,29],[-29,270],[34,114],[-12,257]],[[61883,60238],[121,189],[-28,249],[74,290],[114,-153],[75,53],[321,14],[50,-59],[269,-60],[106,30],[70,-197],[130,99],[199,620],[259,266],[801,226]],[[63448,67449],[109,-510],[137,-135],[47,-207],[190,-249],[16,-243],[-27,-197],[35,-199],[80,-165],[37,-194],[41,-145]],[[64274,65130],[53,-226]],[[61883,60238],[-37,252],[-83,178],[-22,236],[-143,212],[-148,495],[-79,482],[-192,406],[-124,97],[-184,563],[-32,411],[12,350],[-159,655],[-130,231],[-150,122],[-92,339],[15,133],[-77,306],[-81,132],[-108,440],[-170,476],[-141,406],[-139,-3],[44,325],[12,206],[34,236]],[[36483,4468],[141,0],[414,127],[419,-127],[342,-255],[120,-359],[33,-254],[11,-301],[-430,-186],[-452,-150],[-522,-139],[-582,-116],[-658,35],[-365,197],[49,243],[593,162],[239,197],[174,254],[126,220],[168,209],[180,243]],[[31586,3163],[625,-23],[599,-58],[207,243],[147,208],[288,-243],[-82,-301],[-81,-266],[-582,81],[-621,-35],[-348,197],[0,23],[-152,174]],[[29468,8472],[190,70],[321,-23],[82,301],[16,219],[-6,475],[158,278],[256,93],[147,-220],[65,-220],[120,-267],[92,-254],[76,-267],[33,-266],[-49,-231],[-76,-220],[-326,-81],[-311,-116],[-364,11],[136,232],[-327,-81],[-310,-81],[-212,174],[-16,243],[305,231]],[[21575,8103],[174,104],[353,-81],[403,-46],[305,-81],[304,69],[163,-335],[-217,46],[-337,-23],[-343,23],[-376,-35],[-283,116],[-146,243]],[[15938,7061],[60,197],[332,-104],[359,-93],[332,104],[-158,-208],[-261,-151],[-386,47],[-278,208]],[[14643,7177],[202,127],[277,-139],[425,-231],[-164,23],[-359,58],[-381,162]],[[4524,4144],[169,220],[517,-93],[277,-185],[212,-209],[76,-266],[-533,-81],[-364,208],[-163,209],[-11,35],[-180,162]],[[0,529],[16,-5],[245,344],[501,-185],[32,21],[294,188],[38,-7],[32,-4],[402,-246],[352,246],[63,34],[816,104],[265,-138],[130,-71],[419,-196],[789,-151],[625,-185],[1072,-139],[800,162],[1181,-116],[669,-185],[734,174],[773,162],[60,278],[-1094,23],[-898,139],[-234,231],[-745,128],[49,266],[103,243],[104,220],[-55,243],[-462,162],[-212,209],[-430,185],[675,-35],[642,93],[402,-197],[495,173],[457,220],[223,197],[-98,243],[-359,162],[-408,174],[-571,35],[-500,81],[-539,58],[-180,220],[-359,185],[-217,208],[-87,672],[136,-58],[250,-185],[457,58],[441,81],[228,-255],[441,58],[370,127],[348,162],[315,197],[419,58],[-11,220],[-97,220],[81,208],[359,104],[163,-196],[425,115],[321,151],[397,12],[375,57],[376,139],[299,128],[337,127],[218,-35],[190,-46],[414,81],[370,-104],[381,11],[364,81],[375,-57],[414,-58],[386,23],[403,-12],[413,-11],[381,23],[283,174],[337,92],[349,-127],[331,104],[300,208],[179,-185],[98,-208],[180,-197],[288,174],[332,-220],[375,-70],[321,-162],[392,35],[354,104],[418,-23],[376,-81],[381,-104],[147,254],[-180,197],[-136,209],[-359,46],[-158,220],[-60,220],[-98,440],[213,-81],[364,-35],[359,35],[327,-93],[283,-174],[119,-208],[376,-35],[359,81],[381,116],[342,70],[283,-139],[370,46],[239,451],[224,-266],[321,-104],[348,58],[228,-232],[365,-23],[337,-69],[332,-128],[218,220],[108,209],[278,-232],[381,58],[283,-127],[190,-197],[370,58],[288,127],[283,151],[337,81],[392,69],[354,81],[272,127],[163,186],[65,254],[-32,244],[-87,231],[-98,232],[-87,231],[-71,209],[-16,231],[27,232],[130,220],[109,243],[44,231],[-55,255],[-32,232],[136,266],[152,173],[180,220],[190,186],[223,173],[109,255],[152,162],[174,151],[267,34],[174,186],[196,115],[228,70],[202,150],[157,186],[218,69],[163,-151],[-103,-196],[-283,-174],[-120,-127],[-206,92],[-229,-58],[-190,-139],[-202,-150],[-136,-174],[-38,-231],[17,-220],[130,-197],[-190,-139],[-261,-46],[-153,-197],[-163,-185],[-174,-255],[-44,-220],[98,-243],[147,-185],[229,-139],[212,-185],[114,-232],[60,-220],[82,-232],[130,-196],[82,-220],[38,-544],[81,-220],[22,-232],[87,-231],[-38,-313],[-152,-243],[-163,-197],[-370,-81],[-125,-208],[-169,-197],[-419,-220],[-370,-93],[-348,-127],[-376,-128],[-223,-243],[-446,-23],[-489,23],[-441,-46],[-468,0],[87,-232],[424,-104],[311,-162],[174,-208],[-310,-185],[-479,58],[-397,-151],[-17,-243],[-11,-232],[327,-196],[60,-220],[353,-220],[588,-93],[500,-162],[398,-185],[506,-186],[690,-92],[681,-162],[473,-174],[517,-197],[272,-278],[136,-220],[337,209],[457,173],[484,186],[577,150],[495,162],[691,12],[680,-81],[560,-139],[180,255],[386,173],[702,12],[550,127],[522,128],[577,81],[614,104],[430,150],[-196,209],[-119,208],[0,220],[-539,-23],[-571,-93],[-544,0],[-77,220],[39,440],[125,128],[397,138],[468,139],[337,174],[337,174],[251,231],[380,104],[376,81],[190,47],[430,23],[408,81],[343,116],[337,139],[305,139],[386,185],[245,197],[261,173],[82,232],[-294,139],[98,243],[185,185],[288,116],[305,139],[283,185],[217,232],[136,277],[202,163],[331,-35],[136,-197],[332,-23],[11,220],[142,231],[299,-58],[71,-220],[331,-34],[360,104],[348,69],[315,-34],[120,-243],[305,196],[283,105],[315,81],[310,81],[283,139],[310,92],[240,128],[168,208],[207,-151],[288,81],[202,-277],[157,-209],[316,116],[125,232],[283,162],[365,-35],[108,-220],[229,220],[299,69],[326,23],[294,-11],[310,-70],[300,-34],[130,-197],[180,-174],[304,104],[327,24],[315,0],[310,11],[278,81],[294,70],[245,162],[261,104],[283,58],[212,162],[152,324],[158,197],[288,-93],[109,-208],[239,-139],[289,46],[196,-208],[206,-151],[283,139],[98,255],[250,104],[289,197],[272,81],[326,116],[218,127],[228,139],[218,127],[261,-69],[250,208],[180,162],[261,-11],[229,139],[54,208],[234,162],[228,116],[278,93],[256,46],[244,-35],[262,-58],[223,-162],[27,-254],[245,-197],[168,-162],[332,-70],[185,-162],[229,-162],[266,-35],[223,116],[240,243],[261,-127],[272,-70],[261,-69],[272,-46],[277,0],[229,-614],[-11,-150],[-33,-267],[-266,-150],[-218,-220],[38,-232],[310,12],[-38,-232],[-141,-220],[-131,-243],[212,-185],[321,-58],[321,104],[153,232],[92,220],[153,185],[174,174],[70,208],[147,289],[174,58],[316,24],[277,69],[283,93],[136,231],[82,220],[190,220],[272,151],[234,115],[153,197],[157,104],[202,93],[277,-58],[250,58],[272,69],[305,-34],[201,162],[142,393],[103,-162],[131,-278],[234,-115],[266,-47],[267,70],[283,-46],[261,-12],[174,58],[234,-35],[212,-127],[250,81],[300,0],[255,81],[289,-81],[185,197],[141,196],[191,163],[348,439],[179,-81],[212,-162],[185,-208],[354,-359],[272,-12],[256,0],[299,70],[299,81],[229,162],[190,174],[310,23],[207,127],[218,-116],[141,-185],[196,-185],[305,23],[190,-150],[332,-151],[348,-58],[288,47],[218,185],[185,185],[250,46],[251,-81],[288,-58],[261,93],[250,0],[245,-58],[256,-58],[250,104],[299,93],[283,23],[316,0],[255,58],[251,46],[76,290],[11,243],[174,-162],[49,-266],[92,-244],[115,-196],[234,-105],[315,35],[365,12],[250,35],[364,0],[262,11],[364,-23],[310,-46],[196,-186],[-54,-220],[179,-173],[299,-139],[310,-151],[360,-104],[375,-92],[283,-93],[315,-12],[180,197],[245,-162],[212,-185],[245,-139],[337,-58],[321,-69],[136,-232],[316,-139],[212,-208],[310,-93],[321,12],[299,-35],[332,12],[332,-47],[310,-81],[288,-139],[289,-116],[195,-173],[-32,-232],[-147,-208],[-125,-266],[-98,-209],[-131,-243],[-364,-93],[-163,-208],[-360,-127],[-125,-232],[-190,-220],[-201,-185],[-115,-243],[-70,-220],[-28,-266],[6,-220],[158,-232],[60,-220],[130,-208],[517,-81],[109,-255],[-501,-93],[-424,-127],[-528,-23],[-234,-336],[-49,-278],[-119,-220],[-147,-220],[370,-196],[141,-244],[239,-219],[338,-197],[386,-186],[419,-185],[636,-185],[142,-289],[800,-128],[53,-45],[208,-175],[767,151],[636,-186],[479,-142],[-99999,0]],[[59092,71341],[19,3],[40,143],[200,-8],[253,176],[-188,-251],[21,-111]],[[59437,71293],[-30,21],[-53,-45],[-42,12],[-14,-22],[-5,59],[-20,37],[-54,6],[-75,-51],[-52,31]],[[59437,71293],[8,-48],[-285,-240],[-136,77],[-64,237],[132,22]],[[45272,63236],[13,274],[106,161],[91,308],[-18,200],[96,417],[155,376],[93,95],[74,344],[6,315],[100,365],[185,216],[177,603],[5,8],[139,227],[259,65],[218,404],[140,158],[232,493],[-70,735],[106,508],[37,312],[179,399],[278,270],[206,244],[186,612],[87,362],[205,-2],[167,-251],[264,41],[288,-131],[121,-6]],[[56944,63578],[0,2175],[0,2101],[-83,476],[71,365],[-43,253],[101,283]],[[56990,69231],[369,10],[268,-156],[275,-175],[129,-92],[214,188],[114,169],[245,49],[198,-75],[75,-293],[65,193],[222,-140],[217,-33],[137,149]],[[59700,68010],[-78,-238],[-60,-446],[-75,-308],[-65,-103],[-93,191],[-125,263],[-198,847],[-29,-53],[115,-624],[171,-594],[210,-920],[102,-321],[90,-334],[249,-654],[-55,-103],[9,-384],[323,-530],[49,-121]],[[53191,70158],[326,-204],[117,51],[232,-98],[368,-264],[130,-526],[250,-114],[391,-248],[296,-293],[136,153],[133,272],[-65,452],[87,288],[200,277],[192,80],[375,-121],[95,-264],[104,-2],[88,-101],[276,-70],[68,-195]],[[59804,53833],[-164,643],[-127,137],[-48,236],[-141,288],[-171,42],[95,337],[147,14],[42,181]],[[61764,57990],[-98,-261],[-94,-277],[22,-163],[4,-180],[155,-10],[67,42],[62,-106]],[[61882,57035],[-61,-209],[103,-325],[102,-285],[106,-210],[909,-702],[233,4]],[[61966,58083],[66,-183],[-9,-245],[-158,-142],[119,-161]],[[61984,57352],[-102,-317]],[[61984,57352],[91,-109],[54,-245],[125,-247],[138,-2],[262,151],[302,70],[245,184],[138,39],[99,108],[158,20]],[[58449,49909],[-166,-182],[-67,60]],[[58564,52653],[115,161],[176,-132],[224,138],[195,-1],[171,272]],[[55279,77084],[100,2],[-69,-260],[134,-227],[-41,-278],[-65,-27]],[[55338,76294],[-52,-53],[-90,-138],[-41,-325]],[[55719,75309],[35,-5],[13,121],[164,91],[62,23]],[[55993,75539],[95,35],[128,9]],[[55993,75539],[-9,44],[33,71],[31,144],[-39,-4],[-54,110],[-46,28],[-36,94],[-52,36],[-40,84],[-50,-33],[-38,-196],[-66,-43]],[[55627,75874],[22,51],[-106,123],[-91,63],[-40,82],[-74,101]],[[55380,75322],[-58,46],[-78,192],[-120,118]],[[55627,75874],[-52,-132]],[[32866,56937],[160,77],[58,-21],[-11,-440],[-232,-65],[-50,53],[81,163],[-6,233]]],"bbox":[-180,-85.60903777459771,180,83.64513000000001],"transform":{"scale":[0.0036000360003600037,0.0016925586033320105],"translate":[-180,-85.60903777459771]}} diff --git a/pkg/web/static/vendor/globe/globe.gl.min.js b/pkg/web/static/vendor/globe/globe.gl.min.js new file mode 100644 index 0000000..16bfa1c --- /dev/null +++ b/pkg/web/static/vendor/globe/globe.gl.min.js @@ -0,0 +1,20 @@ +// Version 2.45.0 globe.gl - https://github.com/vasturiano/globe.gl +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Globe=t()}(this,function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0;--t)if(e[t]>=65535)return!0;return!1}function wt(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Mt(){const e=wt("canvas");return e.style.display="block",e}const Et={};function Ct(...e){const t="THREE."+e.shift();console.log(t,...e)}function Rt(...e){const t="THREE."+e.shift();console.warn(t,...e)}function Nt(...e){const t="THREE."+e.shift();console.error(t,...e)}function Pt(...e){const t=e.join(" ");t in Et||(Et[t]=!0,Rt(...e))}class Dt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return void 0!==n&&(void 0!==n[e]&&-1!==n[e].indexOf(t))}removeEventListener(e,t){const n=this._listeners;if(void 0===n)return;const r=n[e];if(void 0!==r){const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){const t=this._listeners;if(void 0===t)return;const n=t[e.type];if(void 0!==n){e.target=this;const t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Lt[e>>16&255]+Lt[e>>24&255]+"-"+Lt[255&t]+Lt[t>>8&255]+"-"+Lt[t>>16&15|64]+Lt[t>>24&255]+"-"+Lt[63&n|128]+Lt[n>>8&255]+"-"+Lt[n>>16&255]+Lt[n>>24&255]+Lt[255&r]+Lt[r>>8&255]+Lt[r>>16&255]+Lt[r>>24&255]).toLowerCase()}function Ft(e,t,n){return Math.max(t,Math.min(n,e))}function kt(e,t){return(e%t+t)%t}function qt(e,t,n){return(1-n)*e+n*t}function Vt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function zt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Gt={DEG2RAD:Ut,RAD2DEG:Ot,generateUUID:Bt,clamp:Ft,euclideanModulo:kt,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:qt,damp:function(e,t,n,r){return qt(e,t,1-Math.exp(-n*r))},pingpong:function(e,t=1){return t-Math.abs(kt(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(It=e);let t=It+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Ut},radToDeg:function(e){return e*Ot},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),u=s((t+r)/2),c=a((t+r)/2),h=s((t-r)/2),A=a((t-r)/2),d=s((r-t)/2),p=a((r-t)/2);switch(i){case"XYX":e.set(o*c,l*h,l*A,o*u);break;case"YZY":e.set(l*A,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*A,o*c,o*u);break;case"XZX":e.set(o*c,l*p,l*d,o*u);break;case"YXY":e.set(l*d,o*c,l*p,o*u);break;case"ZYZ":e.set(l*p,l*d,o*c,o*u);break;default:Rt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:zt,denormalize:Vt};class Ht{constructor(e=0,t=0){Ht.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,s=this.y-e.y;return this.x=i*n-s*r+e.x,this.y=i*r+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class jt{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,s,a){let o=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[s+0],A=i[s+1],d=i[s+2],p=i[s+3];if(a<=0)return e[t+0]=o,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(a>=1)return e[t+0]=h,e[t+1]=A,e[t+2]=d,void(e[t+3]=p);if(c!==p||o!==h||l!==A||u!==d){let e=o*h+l*A+u*d+c*p;e<0&&(h=-h,A=-A,d=-d,p=-p,e=-e);let t=1-a;if(e<.9995){const n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=o*t+h*(a=Math.sin(a*n)/r),l=l*t+A*a,u=u*t+d*a,c=c*t+p*a}else{o=o*t+h*a,l=l*t+A*a,u=u*t+d*a,c=c*t+p*a;const e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,r,i,s){const a=n[r],o=n[r+1],l=n[r+2],u=n[r+3],c=i[s],h=i[s+1],A=i[s+2],d=i[s+3];return e[t]=a*d+u*c+o*A-l*h,e[t+1]=o*d+u*h+l*c-a*A,e[t+2]=l*d+u*A+a*h-o*c,e[t+3]=u*d-a*c-o*h-l*A,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,i=e._z,s=e._order,a=Math.cos,o=Math.sin,l=a(n/2),u=a(r/2),c=a(i/2),h=o(n/2),A=o(r/2),d=o(i/2);switch(s){case"XYZ":this._x=h*u*c+l*A*d,this._y=l*A*c-h*u*d,this._z=l*u*d+h*A*c,this._w=l*u*c-h*A*d;break;case"YXZ":this._x=h*u*c+l*A*d,this._y=l*A*c-h*u*d,this._z=l*u*d-h*A*c,this._w=l*u*c+h*A*d;break;case"ZXY":this._x=h*u*c-l*A*d,this._y=l*A*c+h*u*d,this._z=l*u*d+h*A*c,this._w=l*u*c-h*A*d;break;case"ZYX":this._x=h*u*c-l*A*d,this._y=l*A*c+h*u*d,this._z=l*u*d-h*A*c,this._w=l*u*c+h*A*d;break;case"YZX":this._x=h*u*c+l*A*d,this._y=l*A*c+h*u*d,this._z=l*u*d-h*A*c,this._w=l*u*c-h*A*d;break;case"XZY":this._x=h*u*c-l*A*d,this._y=l*A*c-h*u*d,this._z=l*u*d+h*A*c,this._w=l*u*c+h*A*d;break;default:Rt("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],i=t[8],s=t[1],a=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+a+c;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(i-l)*e,this._z=(s-r)*e}else if(n>a&&n>c){const e=2*Math.sqrt(1+n-a-c);this._w=(u-o)/e,this._x=.25*e,this._y=(r+s)/e,this._z=(i+l)/e}else if(a>c){const e=2*Math.sqrt(1+a-n-c);this._w=(i-l)/e,this._x=(r+s)/e,this._y=.25*e,this._z=(o+u)/e}else{const e=2*Math.sqrt(1+c-n-a);this._w=(s-r)/e,this._x=(i+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ft(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,i=e._z,s=e._w,a=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+s*a+r*l-i*o,this._y=r*u+s*o+i*a-n*l,this._z=i*u+s*l+n*o-r*a,this._w=s*u-n*a-r*o-i*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,r=e._y,i=e._z,s=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,i=-i,s=-s,a=-a);let o=1-t;if(a<.9995){const e=Math.acos(a),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+n*t,this._y=this._y*o+r*t,this._z=this._z*o+i*t,this._w=this._w*o+s*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+r*t,this._z=this._z*o+i*t,this._w=this._w*o+s*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Wt{constructor(e=0,t=0,n=0){Wt.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Qt.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qt.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=e.elements,s=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,i=e.x,s=e.y,a=e.z,o=e.w,l=2*(s*r-a*n),u=2*(a*t-i*r),c=2*(i*n-s*t);return this.x=t+o*l+s*c-a*u,this.y=n+o*u+a*l-i*c,this.z=r+o*c+i*u-s*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ft(this.x,e.x,t.x),this.y=Ft(this.y,e.y,t.y),this.z=Ft(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ft(this.x,e,t),this.y=Ft(this.y,e,t),this.z=Ft(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,i=e.z,s=t.x,a=t.y,o=t.z;return this.x=r*o-i*a,this.y=i*s-n*o,this.z=n*a-r*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Xt.copy(this).projectOnVector(e),this.sub(Xt)}reflect(e){return this.sub(Xt.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Xt=new Wt,Qt=new jt;class $t{constructor(e,t,n,r,i,s,a,o,l){$t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,s,a,o,l)}set(e,t,n,r,i,s,a,o,l){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=i,u[5]=o,u[6]=n,u[7]=s,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],A=n[5],d=n[8],p=r[0],f=r[3],m=r[6],g=r[1],_=r[4],v=r[7],y=r[2],b=r[5],x=r[8];return i[0]=s*p+a*g+o*y,i[3]=s*f+a*_+o*b,i[6]=s*m+a*v+o*x,i[1]=l*p+u*g+c*y,i[4]=l*f+u*_+c*b,i[7]=l*m+u*v+c*x,i[2]=h*p+A*g+d*y,i[5]=h*f+A*_+d*b,i[8]=h*m+A*v+d*x,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8];return t*s*u-t*a*l-n*i*u+n*a*o+r*i*l-r*s*o}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=u*s-a*l,h=a*o-u*i,A=l*i-s*o,d=t*c+n*h+r*A;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const p=1/d;return e[0]=c*p,e[1]=(r*l-u*n)*p,e[2]=(a*n-r*s)*p,e[3]=h*p,e[4]=(u*t-r*o)*p,e[5]=(r*i-a*t)*p,e[6]=A*p,e[7]=(n*o-l*t)*p,e[8]=(s*t-n*i)*p,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,s,a){const o=Math.cos(i),l=Math.sin(i);return this.set(n*o,n*l,-n*(o*s+l*a)+s+e,-r*l,r*o,-r*(-l*s+o*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yt.makeScale(e,t)),this}rotate(e){return this.premultiply(Yt.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const Yt=new $t,Kt=(new $t).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Zt=(new $t).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Jt(){const e={enabled:!0,workingColorSpace:st,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===ot&&(e.r=tn(e.r),e.g=tn(e.g),e.b=tn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===ot&&(e.r=nn(e.r),e.g=nn(e.g),e.b=nn(e.b)),e):e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===rt?at:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Pt("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Pt("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[st]:{primaries:t,whitePoint:r,transfer:at,toXYZ:Kt,fromXYZ:Zt,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:it},outputColorSpaceConfig:{drawingBufferColorSpace:it}},[it]:{primaries:t,whitePoint:r,transfer:ot,toXYZ:Kt,fromXYZ:Zt,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:it}}}),e}const en=Jt();function tn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function nn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let rn;class sn{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{void 0===rn&&(rn=wt("canvas")),rn.width=e.width,rn.height=e.height;const t=rn.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=rn}return n.toDataURL(t)}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=wt("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(cn).x}get height(){return this.source.getSize(cn).y}get depth(){return this.source.getSize(cn).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(void 0===n){Rt(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];void 0!==r?r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n:Rt(`Texture.setValues(): property '${t}' does not exist.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case X:e.x=e.x-Math.floor(e.x);break;case Q:e.x=e.x<0?0:1;break;case $:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case X:e.y=e.y-Math.floor(e.y);break;case Q:e.y=e.y<0?0:1;break;case $:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}hn.DEFAULT_IMAGE=null,hn.DEFAULT_MAPPING=300,hn.DEFAULT_ANISOTROPY=1;class An{constructor(e=0,t=0,n=0,r=1){An.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*t+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*t+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*t+s[7]*n+s[11]*r+s[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i;const s=.01,a=.1,o=e.elements,l=o[0],u=o[4],c=o[8],h=o[1],A=o[5],d=o[9],p=o[2],f=o[6],m=o[10];if(Math.abs(u-h)o&&e>g?eg?o1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,vn),vn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(En),Cn.subVectors(this.max,En),bn.subVectors(e.a,En),xn.subVectors(e.b,En),Tn.subVectors(e.c,En),Sn.subVectors(xn,bn),wn.subVectors(Tn,xn),Mn.subVectors(bn,Tn);let t=[0,-Sn.z,Sn.y,0,-wn.z,wn.y,0,-Mn.z,Mn.y,Sn.z,0,-Sn.x,wn.z,0,-wn.x,Mn.z,0,-Mn.x,-Sn.y,Sn.x,0,-wn.y,wn.x,0,-Mn.y,Mn.x,0];return!!Pn(t,bn,xn,Tn,Cn)&&(t=[1,0,0,0,1,0,0,0,1],!!Pn(t,bn,xn,Tn,Cn)&&(Rn.crossVectors(Sn,wn),t=[Rn.x,Rn.y,Rn.z],Pn(t,bn,xn,Tn,Cn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(vn).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(_n[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_n[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_n[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_n[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_n[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_n[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_n[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_n[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_n)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const _n=[new Wt,new Wt,new Wt,new Wt,new Wt,new Wt,new Wt,new Wt],vn=new Wt,yn=new gn,bn=new Wt,xn=new Wt,Tn=new Wt,Sn=new Wt,wn=new Wt,Mn=new Wt,En=new Wt,Cn=new Wt,Rn=new Wt,Nn=new Wt;function Pn(e,t,n,r,i){for(let s=0,a=e.length-3;s<=a;s+=3){Nn.fromArray(e,s);const a=i.x*Math.abs(Nn.x)+i.y*Math.abs(Nn.y)+i.z*Math.abs(Nn.z),o=t.dot(Nn),l=n.dot(Nn),u=r.dot(Nn);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>a)return!1}return!0}const Dn=new gn,Ln=new Wt,In=new Wt;class Un{constructor(e=new Wt,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Dn.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ln.subVectors(e,this.center);const t=Ln.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Ln,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(In.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ln.copy(e.center).add(In)),this.expandByPoint(Ln.copy(e.center).sub(In))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const On=new Wt,Bn=new Wt,Fn=new Wt,kn=new Wt,qn=new Wt,Vn=new Wt,zn=new Wt;class Gn{constructor(e=new Wt,t=new Wt(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,On)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=On.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(On.copy(this.origin).addScaledVector(this.direction,t),On.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Bn.copy(e).add(t).multiplyScalar(.5),Fn.copy(t).sub(e).normalize(),kn.copy(this.origin).sub(Bn);const i=.5*e.distanceTo(t),s=-this.direction.dot(Fn),a=kn.dot(this.direction),o=-kn.dot(Fn),l=kn.lengthSq(),u=Math.abs(1-s*s);let c,h,A,d;if(u>0)if(c=s*o-a,h=s*a-o,d=i*u,c>=0)if(h>=-d)if(h<=d){const e=1/u;c*=e,h*=e,A=c*(c+s*h+2*a)+h*(s*c+h+2*o)+l}else h=i,c=Math.max(0,-(s*h+a)),A=-c*c+h*(h+2*o)+l;else h=-i,c=Math.max(0,-(s*h+a)),A=-c*c+h*(h+2*o)+l;else h<=-d?(c=Math.max(0,-(-s*i+a)),h=c>0?-i:Math.min(Math.max(-i,-o),i),A=-c*c+h*(h+2*o)+l):h<=d?(c=0,h=Math.min(Math.max(-i,-o),i),A=h*(h+2*o)+l):(c=Math.max(0,-(s*i+a)),h=c>0?i:Math.min(Math.max(-i,-o),i),A=-c*c+h*(h+2*o)+l);else h=s>0?-i:i,c=Math.max(0,-(s*h+a)),A=-c*c+h*(h+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,c),r&&r.copy(Bn).addScaledVector(Fn,h),A}intersectSphere(e,t){On.subVectors(e.center,this.origin);const n=On.dot(this.direction),r=On.dot(On)-n*n,i=e.radius*e.radius;if(r>i)return null;const s=Math.sqrt(i-r),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,s,a,o;const l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,s=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,s=(e.min.y-h.y)*u),n>s||i>r?null:((i>n||isNaN(n))&&(n=i),(s=0?(a=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(a=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||a>r?null:((a>n||n!=n)&&(n=a),(o=0?n:r,t)))}intersectsBox(e){return null!==this.intersectBox(e,On)}intersectTriangle(e,t,n,r,i){qn.subVectors(t,e),Vn.subVectors(n,e),zn.crossVectors(qn,Vn);let s,a=this.direction.dot(zn);if(a>0){if(r)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}kn.subVectors(this.origin,e);const o=s*this.direction.dot(Vn.crossVectors(kn,Vn));if(o<0)return null;const l=s*this.direction.dot(qn.cross(kn));if(l<0)return null;if(o+l>a)return null;const u=-s*kn.dot(zn);return u<0?null:this.at(u/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Hn{constructor(e,t,n,r,i,s,a,o,l,u,c,h,A,d,p,f){Hn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,r,i,s,a,o,l,u,c,h,A,d,p,f)}set(e,t,n,r,i,s,a,o,l,u,c,h,A,d,p,f){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=s,m[9]=a,m[13]=o,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=A,m[7]=d,m[11]=p,m[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Hn).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/jn.setFromMatrixColumn(e,0).length(),i=1/jn.setFromMatrixColumn(e,1).length(),s=1/jn.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,i=e.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){const e=s*u,n=s*c,r=a*u,i=a*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-a*o,t[2]=i-e*l,t[6]=r+n*l,t[10]=s*o}else if("YXZ"===e.order){const e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e+i*a,t[4]=r*a-n,t[8]=s*l,t[1]=s*c,t[5]=s*u,t[9]=-a,t[2]=n*a-r,t[6]=i+e*a,t[10]=s*o}else if("ZXY"===e.order){const e=o*u,n=o*c,r=l*u,i=l*c;t[0]=e-i*a,t[4]=-s*c,t[8]=r+n*a,t[1]=n+r*a,t[5]=s*u,t[9]=i-e*a,t[2]=-s*l,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){const e=s*u,n=s*c,r=a*u,i=a*c;t[0]=o*u,t[4]=r*l-n,t[8]=e*l+i,t[1]=o*c,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){const e=s*o,n=s*l,r=a*o,i=a*l;t[0]=o*u,t[4]=i-e*c,t[8]=r*c+n,t[1]=c,t[5]=s*u,t[9]=-a*u,t[2]=-l*u,t[6]=n*c+r,t[10]=e-i*c}else if("XZY"===e.order){const e=s*o,n=s*l,r=a*o,i=a*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+i,t[5]=s*u,t[9]=n*c-r,t[2]=r*c-n,t[6]=a*u,t[10]=i*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Xn,e,Qn)}lookAt(e,t,n){const r=this.elements;return Kn.subVectors(e,t),0===Kn.lengthSq()&&(Kn.z=1),Kn.normalize(),$n.crossVectors(n,Kn),0===$n.lengthSq()&&(1===Math.abs(n.z)?Kn.x+=1e-4:Kn.z+=1e-4,Kn.normalize(),$n.crossVectors(n,Kn)),$n.normalize(),Yn.crossVectors(Kn,$n),r[0]=$n.x,r[4]=Yn.x,r[8]=Kn.x,r[1]=$n.y,r[5]=Yn.y,r[9]=Kn.y,r[2]=$n.z,r[6]=Yn.z,r[10]=Kn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],A=n[13],d=n[2],p=n[6],f=n[10],m=n[14],g=n[3],_=n[7],v=n[11],y=n[15],b=r[0],x=r[4],T=r[8],S=r[12],w=r[1],M=r[5],E=r[9],C=r[13],R=r[2],N=r[6],P=r[10],D=r[14],L=r[3],I=r[7],U=r[11],O=r[15];return i[0]=s*b+a*w+o*R+l*L,i[4]=s*x+a*M+o*N+l*I,i[8]=s*T+a*E+o*P+l*U,i[12]=s*S+a*C+o*D+l*O,i[1]=u*b+c*w+h*R+A*L,i[5]=u*x+c*M+h*N+A*I,i[9]=u*T+c*E+h*P+A*U,i[13]=u*S+c*C+h*D+A*O,i[2]=d*b+p*w+f*R+m*L,i[6]=d*x+p*M+f*N+m*I,i[10]=d*T+p*E+f*P+m*U,i[14]=d*S+p*C+f*D+m*O,i[3]=g*b+_*w+v*R+y*L,i[7]=g*x+_*M+v*N+y*I,i[11]=g*T+_*E+v*P+y*U,i[15]=g*S+_*C+v*D+y*O,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],s=e[1],a=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],A=e[14];return e[3]*(+i*o*c-r*l*c-i*a*h+n*l*h+r*a*A-n*o*A)+e[7]*(+t*o*A-t*l*h+i*s*h-r*s*A+r*l*u-i*o*u)+e[11]*(+t*l*c-t*a*A-i*s*c+n*s*A+i*a*u-n*l*u)+e[15]*(-r*a*u-t*o*c+t*a*h+r*s*c-n*s*h+n*o*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],A=e[11],d=e[12],p=e[13],f=e[14],m=e[15],g=c*f*l-p*h*l+p*o*A-a*f*A-c*o*m+a*h*m,_=d*h*l-u*f*l-d*o*A+s*f*A+u*o*m-s*h*m,v=u*p*l-d*c*l+d*a*A-s*p*A-u*a*m+s*c*m,y=d*c*o-u*p*o-d*a*h+s*p*h+u*a*f-s*c*f,b=t*g+n*_+r*v+i*y;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/b;return e[0]=g*x,e[1]=(p*h*i-c*f*i-p*r*A+n*f*A+c*r*m-n*h*m)*x,e[2]=(a*f*i-p*o*i+p*r*l-n*f*l-a*r*m+n*o*m)*x,e[3]=(c*o*i-a*h*i-c*r*l+n*h*l+a*r*A-n*o*A)*x,e[4]=_*x,e[5]=(u*f*i-d*h*i+d*r*A-t*f*A-u*r*m+t*h*m)*x,e[6]=(d*o*i-s*f*i-d*r*l+t*f*l+s*r*m-t*o*m)*x,e[7]=(s*h*i-u*o*i+u*r*l-t*h*l-s*r*A+t*o*A)*x,e[8]=v*x,e[9]=(d*c*i-u*p*i-d*n*A+t*p*A+u*n*m-t*c*m)*x,e[10]=(s*p*i-d*a*i+d*n*l-t*p*l-s*n*m+t*a*m)*x,e[11]=(u*a*i-s*c*i-u*n*l+t*c*l+s*n*A-t*a*A)*x,e[12]=y*x,e[13]=(u*p*r-d*c*r+d*n*h-t*p*h-u*n*f+t*c*f)*x,e[14]=(d*a*r-s*p*r-d*n*o+t*p*o+s*n*f-t*a*f)*x,e[15]=(s*c*r-u*a*r+u*n*o-t*c*o-s*n*h+t*a*h)*x,this}scale(e){const t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),i=1-n,s=e.x,a=e.y,o=e.z,l=i*s,u=i*a;return this.set(l*s+n,l*a-r*o,l*o+r*a,0,l*a+r*o,u*a+n,u*o-r*s,0,l*o-r*a,u*o+r*s,i*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,s){return this.set(1,n,i,0,e,1,s,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,i=t._x,s=t._y,a=t._z,o=t._w,l=i+i,u=s+s,c=a+a,h=i*l,A=i*u,d=i*c,p=s*u,f=s*c,m=a*c,g=o*l,_=o*u,v=o*c,y=n.x,b=n.y,x=n.z;return r[0]=(1-(p+m))*y,r[1]=(A+v)*y,r[2]=(d-_)*y,r[3]=0,r[4]=(A-v)*b,r[5]=(1-(h+m))*b,r[6]=(f+g)*b,r[7]=0,r[8]=(d+_)*x,r[9]=(f-g)*x,r[10]=(1-(h+p))*x,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let i=jn.set(r[0],r[1],r[2]).length();const s=jn.set(r[4],r[5],r[6]).length(),a=jn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Wn.copy(this);const o=1/i,l=1/s,u=1/a;return Wn.elements[0]*=o,Wn.elements[1]*=o,Wn.elements[2]*=o,Wn.elements[4]*=l,Wn.elements[5]*=l,Wn.elements[6]*=l,Wn.elements[8]*=u,Wn.elements[9]*=u,Wn.elements[10]*=u,t.setFromRotationMatrix(Wn),n.x=i,n.y=s,n.z=a,this}makePerspective(e,t,n,r,i,s,a=2e3,o=!1){const l=this.elements,u=2*i/(t-e),c=2*i/(n-r),h=(t+e)/(t-e),A=(n+r)/(n-r);let d,p;if(o)d=i/(s-i),p=s*i/(s-i);else if(a===yt)d=-(s+i)/(s-i),p=-2*s*i/(s-i);else{if(a!==bt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-i),p=-s*i/(s-i)}return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=A,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,i,s,a=2e3,o=!1){const l=this.elements,u=2/(t-e),c=2/(n-r),h=-(t+e)/(t-e),A=-(n+r)/(n-r);let d,p;if(o)d=1/(s-i),p=s/(s-i);else if(a===yt)d=-2/(s-i),p=-(s+i)/(s-i);else{if(a!==bt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);d=-1/(s-i),p=-i/(s-i)}return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=c,l[9]=0,l[13]=A,l[2]=0,l[6]=0,l[10]=d,l[14]=p,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const jn=new Wt,Wn=new Hn,Xn=new Wt(0,0,0),Qn=new Wt(1,1,1),$n=new Wt,Yn=new Wt,Kn=new Wt,Zn=new Hn,Jn=new jt;class er{constructor(e=0,t=0,n=0,r=er.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,i=r[0],s=r[4],a=r[8],o=r[1],l=r[5],u=r[9],c=r[2],h=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Ft(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-s,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Ft(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Ft(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,A),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,i));break;case"ZYX":this._y=Math.asin(-Ft(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,A),this._z=Math.atan2(o,i)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Ft(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(a,A));break;case"XZY":this._z=Math.asin(-Ft(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,i)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Rt("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Zn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zn,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Jn.setFromEuler(this),this.setFromQuaternion(Jn,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}er.DEFAULT_ORDER="XYZ";class tr{constructor(){this.mask=1}set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=r,n;function s(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){_r.subVectors(r,t),vr.subVectors(n,t),yr.subVectors(e,t);const s=_r.dot(_r),a=_r.dot(vr),o=_r.dot(yr),l=vr.dot(vr),u=vr.dot(yr),c=s*l-a*a;if(0===c)return i.set(0,0,0),null;const h=1/c,A=(l*o-a*u)*h,d=(s*u-a*o)*h;return i.set(1-A-d,d,A)}static containsPoint(e,t,n,r){return null!==this.getBarycoord(e,t,n,r,br)&&(br.x>=0&&br.y>=0&&br.x+br.y<=1)}static getInterpolation(e,t,n,r,i,s,a,o){return null===this.getBarycoord(e,t,n,r,br)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(i,br.x),o.addScaledVector(s,br.y),o.addScaledVector(a,br.z),o)}static getInterpolatedAttribute(e,t,n,r,i,s){return Cr.setScalar(0),Rr.setScalar(0),Nr.setScalar(0),Cr.fromBufferAttribute(e,t),Rr.fromBufferAttribute(e,n),Nr.fromBufferAttribute(e,r),s.setScalar(0),s.addScaledVector(Cr,i.x),s.addScaledVector(Rr,i.y),s.addScaledVector(Nr,i.z),s}static isFrontFacing(e,t,n,r){return _r.subVectors(n,t),vr.subVectors(e,t),_r.cross(vr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return _r.subVectors(this.c,this.b),vr.subVectors(this.a,this.b),.5*_r.cross(vr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,i){return Pr.getInterpolation(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return Pr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,i=this.c;let s,a;xr.subVectors(r,n),Tr.subVectors(i,n),wr.subVectors(e,n);const o=xr.dot(wr),l=Tr.dot(wr);if(o<=0&&l<=0)return t.copy(n);Mr.subVectors(e,r);const u=xr.dot(Mr),c=Tr.dot(Mr);if(u>=0&&c<=u)return t.copy(r);const h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return s=o/(o-u),t.copy(n).addScaledVector(xr,s);Er.subVectors(e,i);const A=xr.dot(Er),d=Tr.dot(Er);if(d>=0&&A<=d)return t.copy(i);const p=A*l-o*d;if(p<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(n).addScaledVector(Tr,a);const f=u*d-A*c;if(f<=0&&c-u>=0&&A-d>=0)return Sr.subVectors(i,r),a=(c-u)/(c-u+(A-d)),t.copy(r).addScaledVector(Sr,a);const m=1/(f+p+h);return s=p*m,a=h*m,t.copy(n).addScaledVector(xr,s).addScaledVector(Tr,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Dr={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},Lr={h:0,s:0,l:0},Ir={h:0,s:0,l:0};function Ur(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}let Or=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=it){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,en.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=en.workingColorSpace){return this.r=e,this.g=t,this.b=n,en.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=en.workingColorSpace){if(e=kt(e,1),t=Ft(t,0,1),n=Ft(n,0,1),0===t)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Ur(i,r,e+1/3),this.g=Ur(i,r,e),this.b=Ur(i,r,e-1/3)}return en.colorSpaceToWorking(this,r),this}setStyle(e,t=it){function n(t){void 0!==t&&parseFloat(t)<1&&Rt("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;const s=r[1],a=r[2];switch(s){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:Rt("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=r[1],i=n.length;if(3===i)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===i)return this.setHex(parseInt(n,16),t);Rt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=it){const n=Dr[e.toLowerCase()];return void 0!==n?this.setHex(n,t):Rt("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=tn(e.r),this.g=tn(e.g),this.b=tn(e.b),this}copyLinearToSRGB(e){return this.r=nn(e.r),this.g=nn(e.g),this.b=nn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=it){return en.workingToColorSpace(Br.copy(this),e),65536*Math.round(Ft(255*Br.r,0,255))+256*Math.round(Ft(255*Br.g,0,255))+Math.round(Ft(255*Br.b,0,255))}getHexString(e=it){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=en.workingColorSpace){en.workingToColorSpace(Br.copy(this),t);const n=Br.r,r=Br.g,i=Br.b,s=Math.max(n,r,i),a=Math.min(n,r,i);let o,l;const u=(a+s)/2;if(a===s)o=0,l=0;else{const e=s-a;switch(l=u<=.5?e/(s+a):e/(2-s-a),s){case n:o=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){Rt(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:Rt(`Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==T&&(n.blendSrc=this.blendSrc),this.blendDst!==S&&(n.blendDst=this.blendDst),this.blendEquation!==m&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==lt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==lt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==lt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class qr extends kr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Or(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 er,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Vr=zr();function zr(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(r[e]=0,r[256|e]=32768,i[e]=24,i[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,i[e]=-t-1,i[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,i[e]=13,i[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,i[e]=24,i[256|e]=24):(r[e]=31744,r[256|e]=64512,i[e]=13,i[256|e]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,s[e]=t|n}for(let e=1024;e<2048;++e)s[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)a[e]=e<<23;a[31]=1199570944,a[32]=2147483648;for(let e=33;e<63;++e)a[e]=2147483648+(e-32<<23);a[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function Gr(e){Math.abs(e)>65504&&Rt("DataUtils.toHalfFloat(): Value out of range."),e=Ft(e,-65504,65504),Vr.floatView[0]=e;const t=Vr.uint32View[0],n=t>>23&511;return Vr.baseTable[n]+((8388607&t)>>Vr.shiftTable[n])}function Hr(e){const t=e>>10;return Vr.uint32View[0]=Vr.mantissaTable[Vr.offsetTable[t]+(1023&e)]+Vr.exponentTable[t],Vr.floatView[0]}const jr=new Wt,Wr=new Ht;let Xr=0;class Qr{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Xr++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=gt,this.updateRanges=[],this.gpuType=le,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&Rt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new gn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Nt("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Wt(-1/0,-1/0,-1/0),new Wt(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const r=n[t];e.data.attributes[t]=r.toJSON(e.data)}const r={};let i=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,r=n.length;t0&&(r[t]=s,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(e.data.boundingSphere=a.toJSON()),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone());const r=e.attributes;for(const e in r){const n=r[e];this.setAttribute(e,n.clone(t))}const i=e.morphAttributes;for(const e in i){const n=[],r=i[e];for(let e=0,i=r.length;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)return}oi.copy(i).invert(),li.copy(e.ray).applyMatrix4(oi),null!==n.boundingBox&&!1===li.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,li)}}_computeIntersections(e,t,n){let r;const i=this.geometry,s=this.material,a=i.index,o=i.attributes.position,l=i.attributes.uv,u=i.attributes.uv1,c=i.attributes.normal,h=i.groups,A=i.drawRange;if(null!==a)if(Array.isArray(s))for(let i=0,o=h.length;in.far?null:{distance:u,point:gi.clone(),object:e}}(e,t,n,r,hi,Ai,di,mi);if(c){const e=new Wt;Pr.getBarycoord(mi,hi,Ai,di,e),i&&(c.uv=Pr.getInterpolatedAttribute(i,o,l,u,e,new Ht)),s&&(c.uv1=Pr.getInterpolatedAttribute(s,o,l,u,e,new Ht)),a&&(c.normal=Pr.getInterpolatedAttribute(a,o,l,u,e,new Wt),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));const t={a:o,b:l,c:u,normal:new Wt,materialIndex:0};Pr.getNormal(hi,Ai,di,t.normal),c.face=t,c.barycoord=e}return c}class yi extends ai{constructor(e=1,t=1,n=1,r=1,i=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:s};const a=this;r=Math.floor(r),i=Math.floor(i),s=Math.floor(s);const o=[],l=[],u=[],c=[];let h=0,A=0;function d(e,t,n,r,i,s,d,p,f,m,g){const _=s/f,v=d/m,y=s/2,b=d/2,x=p/2,T=f+1,S=m+1;let w=0,M=0;const E=new Wt;for(let s=0;s0?1:-1,u.push(E.x,E.y,E.z),c.push(o/f),c.push(1-s/m),w+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Mi extends gr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Hn,this.projectionMatrix=new Hn,this.projectionMatrixInverse=new Hn,this.coordinateSystem=yt,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Ei=new Wt,Ci=new Ht,Ri=new Ht;class Ni extends Mi{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*Ot*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Ut*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*Ot*Math.atan(Math.tan(.5*Ut*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Ei.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ei.x,Ei.y).multiplyScalar(-e/Ei.z),Ei.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ei.x,Ei.y).multiplyScalar(-e/Ei.z)}getViewSize(e,t){return this.getViewBounds(e,Ci,Ri),t.subVectors(Ri,Ci)}setViewOffset(e,t,n,r,i,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Ut*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,a=s.fullHeight;i+=s.offsetX*r/e,t-=s.offsetY*n/a,r*=s.width/e,n*=s.height/a}const a=this.filmOffset;0!==a&&(i+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Pi=-90;class Di extends gr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ni(Pi,1,e,t);r.layers=this.layers,this.add(r);const i=new Ni(Pi,1,e,t);i.layers=this.layers,this.add(i);const s=new Ni(Pi,1,e,t);s.layers=this.layers,this.add(s);const a=new Ni(Pi,1,e,t);a.layers=this.layers,this.add(a);const o=new Ni(Pi,1,e,t);o.layers=this.layers,this.add(o);const l=new Ni(Pi,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,i,s,a,o]=t;for(const e of t)this.remove(e);if(e===yt)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(e!==bt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,s,a,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,s),e.setRenderTarget(n,2,r),e.render(t,a),e.setRenderTarget(n,3,r),e.render(t,o),e.setRenderTarget(n,4,r),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5,r),e.render(t,u),e.setRenderTarget(c,h,A),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Li extends hn{constructor(e=[],t=301,n,r,i,s,a,o,l,u){super(e,t,n,r,i,s,a,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ii extends pn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Li(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \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"},r=new yi(5,5,5),i=new wi({name:"CubemapFromEquirect",uniforms:bi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;const s=new _i(r,i),a=t.minFilter;t.minFilter===te&&(t.minFilter=J);return new Di(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}}let Ui=class extends gr{constructor(){super(),this.isGroup=!0,this.type="Group"}};const Oi={type:"move"};class Bi{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Ui,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Ui,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Wt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Wt),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Ui,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Wt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Wt),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){s=!0;for(const r of e.hand.values()){const e=t.getJointPose(r,n),i=this._getHandJoint(l,r);null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=null!==e}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],a=r.position.distanceTo(i.position),o=.02,u=.005;l.inputState.pinching&&a>o+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&a<=o-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(r=t.getPose(e.targetRaySpace,n),null===r&&null!==i&&(r=i),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Oi)))}return null!==a&&(a.visible=null!==r),null!==o&&(o.visible=null!==i),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Ui;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Fi extends gr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new er,this.environmentIntensity=1,this.environmentRotation=new er,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ki{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=gt,this.updateRanges=[],this.version=0,this.uuid=Bt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Xi.getNormalMatrix(e),r=this.coplanarPoint(ji).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const $i=new Un,Yi=new Ht(.5,.5),Ki=new Wt;class Zi{constructor(e=new Qi,t=new Qi,n=new Qi,r=new Qi,i=new Qi,s=new Qi){this.planes=[e,t,n,r,i,s]}set(e,t,n,r,i,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3,n=!1){const r=this.planes,i=e.elements,s=i[0],a=i[1],o=i[2],l=i[3],u=i[4],c=i[5],h=i[6],A=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],_=i[13],v=i[14],y=i[15];if(r[0].setComponents(l-s,A-u,m-d,y-g).normalize(),r[1].setComponents(l+s,A+u,m+d,y+g).normalize(),r[2].setComponents(l+a,A+c,m+p,y+_).normalize(),r[3].setComponents(l-a,A-c,m-p,y-_).normalize(),n)r[4].setComponents(o,h,f,v).normalize(),r[5].setComponents(l-o,A-h,m-f,y-v).normalize();else if(r[4].setComponents(l-o,A-h,m-f,y-v).normalize(),t===yt)r[5].setComponents(l+o,A+h,m+f,y+v).normalize();else{if(t!==bt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);r[5].setComponents(o,h,f,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),$i.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),$i.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere($i)}intersectsSprite(e){$i.center.set(0,0,0);const t=Yi.distanceTo(e.center);return $i.radius=.7071067811865476+t,$i.applyMatrix4(e.matrixWorld),this.intersectsSphere($i)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Ki.y=r.normal.y>0?e.max.y:e.min.y,Ki.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ki)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const Ji=new Hn,es=new Zi;class ts{constructor(){this.coordinateSystem=yt}intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;ls.applyMatrix4(e.matrixWorld);const l=t.ray.origin.distanceTo(ls);return lt.far?void 0:{distance:l,point:us.clone().applyMatrix4(e.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:e}}const As=new Wt,ds=new Wt;class ps extends cs{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,r=t.count;ei.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:a})}}class bs extends hn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Y,this.minFilter=Y,this.generateMipmaps=!1,this.needsUpdate=!0}}class xs extends hn{constructor(e,t,n=1014,r,i,s,a=1003,o=1003,l,u=1026,c=1){if(u!==_e&&u!==ve)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},r,i,s,a,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new on(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class Ts extends hn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ss extends ai{constructor(e=1,t=32,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const i=[],s=[],a=[],o=[],l=new Wt,u=new Ht;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let i=0,c=3;i<=t;i++,c+=3){const h=n+i/t*r;l.x=e*Math.cos(h),l.y=e*Math.sin(h),s.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(s[c]/e+1)/2,u.y=(s[c+1]/e+1)/2,o.push(u.x,u.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new Zr(s,3)),this.setAttribute("normal",new Zr(a,3)),this.setAttribute("uv",new Zr(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ss(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ws extends ai{constructor(e=1,t=1,n=1,r=32,i=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o};const l=this;r=Math.floor(r),i=Math.floor(i);const u=[],c=[],h=[],A=[];let d=0;const p=[],f=n/2;let m=0;function g(n){const i=d,s=new Ht,p=new Wt;let g=0;const _=!0===n?e:t,v=!0===n?1:-1;for(let e=1;e<=r;e++)c.push(0,f*v,0),h.push(0,v,0),A.push(.5,.5),d++;const y=d;for(let e=0;e<=r;e++){const t=e/r*o+a,n=Math.cos(t),i=Math.sin(t);p.x=_*i,p.y=f*v,p.z=_*n,c.push(p.x,p.y,p.z),h.push(0,v,0),s.x=.5*n+.5,s.y=.5*i*v+.5,A.push(s.x,s.y),d++}for(let e=0;e0||0!==r)&&(u.push(s,a,l),_+=3),(t>0||r!==i-1)&&(u.push(a,o,l),_+=3)}l.addGroup(m,_,0),m+=_}(),!1===s&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(u),this.setAttribute("position",new Zr(c,3)),this.setAttribute("normal",new Zr(h,3)),this.setAttribute("uv",new Zr(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ws(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ms{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Rt("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),i=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const i=n.length;let s;s=t||e*n[i-1];let a,o=0,l=i-1;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),a=n[r]-s,a<0)o=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===s)return r/(i-1);const u=n[r];return(r+(s-u)/(n[r+1]-u))/(i-1)}getTangent(e,t){const n=1e-4;let r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);const s=this.getPoint(r),a=this.getPoint(i),o=t||(s.isVector2?new Ht:new Wt);return o.copy(a).sub(s).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new Wt,r=[],i=[],s=[],a=new Wt,o=new Hn;for(let t=0;t<=e;t++){const n=t/e;r[t]=this.getTangentAt(n,new Wt)}i[0]=new Wt,s[0]=new Wt;let l=Number.MAX_VALUE;const u=Math.abs(r[0].x),c=Math.abs(r[0].y),h=Math.abs(r[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),s[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(r[t-1],r[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(Ft(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(o.makeRotationAxis(a,e))}s[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(Ft(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(a.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(o.makeRotationAxis(r[n],t*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Es extends Ms{constructor(e=0,t=0,n=1,r=1,i=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t=new Ht){const n=t,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)r;)i-=r;ir.length-2?r.length-1:s+1],c=r[s>r.length-3?r.length-1:s+2];return n.set(Ls(a,o.x,l.x,u.x,c.x),Ls(a,o.y,l.y,u.y,c.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===u&&l===i-1&&(l=i-2,u=1),this.closed||l>0?a=r[(l-1)%i]:(Rs.subVectors(r[0],r[1]).add(r[0]),a=Rs);const c=r[l%i],h=r[(l+1)%i];if(this.closed||l+2=n){const e=r[i]-n,s=this.curves[i],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};class js extends Hs{constructor(e){super(e),this.uuid=Bt(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n80*n){o=e[0],l=e[1];let t=o,r=l;for(let s=n;st&&(t=n),i>r&&(r=i)}u=Math.max(t-o,r-l),u=0!==u?32767/u:0}return $s(s,a,n,o,l,u,0),a}function Xs(e,t,n,r,i){let s;if(i===function(e,t,n,r){let i=0;for(let s=t,a=n-r;s0)for(let i=t;i=t;i-=r)s=fa(i/r|0,e[i],e[i+1],s);return s&&ua(s,s.next)&&(ma(s),s=s.next),s}function Qs(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!ua(r,r.next)&&0!==la(r.prev,r,r.next))r=r.next;else{if(ma(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function $s(e,t,n,r,i,s,a){if(!e)return;!a&&s&&function(e,t,n,r){let i=e;do{0===i.z&&(i.z=ra(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let s=null;for(t=0;i;){t++;let a=i,o=0;for(let e=0;e0||l>0&&a;)0!==o&&(0===l||!a||i.z<=a.z)?(r=i,i=i.nextZ,o--):(r=a,a=a.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;i=a}s.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,s);let o=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(s?Ks(e,r,i,s):Ys(e))t.push(l.i,e.i,u.i),ma(e),e=u.next,o=u.next;else if((e=u)===o){a?1===a?$s(e=Zs(Qs(e),t),t,n,r,i,s,2):2===a&&Js(e,t,n,r,i,s):$s(Qs(e),t,n,r,i,s,1);break}}}function Ys(e){const t=e.prev,n=e,r=e.next;if(la(t,n,r)>=0)return!1;const i=t.x,s=n.x,a=r.x,o=t.y,l=n.y,u=r.y,c=Math.min(i,s,a),h=Math.min(o,l,u),A=Math.max(i,s,a),d=Math.max(o,l,u);let p=r.next;for(;p!==t;){if(p.x>=c&&p.x<=A&&p.y>=h&&p.y<=d&&aa(i,o,s,l,a,u,p.x,p.y)&&la(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ks(e,t,n,r){const i=e.prev,s=e,a=e.next;if(la(i,s,a)>=0)return!1;const o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,A=a.y,d=Math.min(o,l,u),p=Math.min(c,h,A),f=Math.max(o,l,u),m=Math.max(c,h,A),g=ra(d,p,t,n,r),_=ra(f,m,t,n,r);let v=e.prevZ,y=e.nextZ;for(;v&&v.z>=g&&y&&y.z<=_;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==i&&v!==a&&aa(o,c,l,h,u,A,v.x,v.y)&&la(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&aa(o,c,l,h,u,A,y.x,y.y)&&la(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==i&&v!==a&&aa(o,c,l,h,u,A,v.x,v.y)&&la(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;y&&y.z<=_;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&aa(o,c,l,h,u,A,y.x,y.y)&&la(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Zs(e,t){let n=e;do{const r=n.prev,i=n.next.next;!ua(r,i)&&ca(r,n,n.next,i)&&da(r,i)&&da(i,r)&&(t.push(r.i,n.i,i.i),ma(n),ma(n.next),n=e=i),n=n.next}while(n!==e);return Qs(n)}function Js(e,t,n,r,i,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&oa(a,e)){let o=pa(a,e);return a=Qs(a,a.next),o=Qs(o,o.next),$s(a,t,n,r,i,s,0),void $s(o,t,n,r,i,s,0)}e=e.next}a=a.next}while(a!==e)}function ea(e,t){let n=e.x-t.x;if(0===n&&(n=e.y-t.y,0===n)){n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}return n}function ta(e,t){const n=function(e,t){let n=t;const r=e.x,i=e.y;let s,a=-1/0;if(ua(e,n))return n;do{if(ua(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,s=n.x=n.x&&n.x>=l&&r!==n.x&&sa(is.x||n.x===s.x&&na(s,n)))&&(s=n,c=t)}n=n.next}while(n!==o);return s}(e,t);if(!n)return t;const r=pa(n,e);return Qs(r,r.next),Qs(n,n.next)}function na(e,t){return la(e.prev,e,t.prev)<0&&la(t.next,e,e.next)<0}function ra(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ia(e){let t=e,n=e;do{(t.x=(e-a)*(s-o)&&(e-a)*(r-o)>=(n-a)*(t-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function aa(e,t,n,r,i,s,a,o){return!(e===a&&t===o)&&sa(e,t,n,r,i,s,a,o)}function oa(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ca(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(da(e,t)&&da(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(la(e.prev,e,t.prev)||la(e,t.prev,t))||ua(e,t)&&la(e.prev,e,e.next)>0&&la(t.prev,t,t.next)>0)}function la(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ua(e,t){return e.x===t.x&&e.y===t.y}function ca(e,t,n,r){const i=Aa(la(e,t,n)),s=Aa(la(e,t,r)),a=Aa(la(n,r,e)),o=Aa(la(n,r,t));return i!==s&&a!==o||(!(0!==i||!ha(e,n,t))||(!(0!==s||!ha(e,r,t))||(!(0!==a||!ha(n,e,r))||!(0!==o||!ha(n,t,r)))))}function ha(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Aa(e){return e>0?1:e<0?-1:0}function da(e,t){return la(e.prev,e,e.next)<0?la(e,t,e.next)>=0&&la(e,e.prev,t)>=0:la(e,t,e.prev)<0||la(e,e.next,t)<0}function pa(e,t){const n=ga(e.i,e.x,e.y),r=ga(t.i,t.x,t.y),i=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function fa(e,t,n,r){const i=ga(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ma(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ga(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class _a{static triangulate(e,t,n=2){return Ws(e,t,n)}}class va{static area(e){const t=e.length;let n=0;for(let r=t-1,i=0;i2&&e[t-1].equals(e[0])&&e.pop()}function ba(e,t){for(let n=0;nNumber.EPSILON){const h=Math.sqrt(c),A=Math.sqrt(l*l+u*u),d=t.x-o/h,p=t.y+a/h,f=((n.x-u/A-d)*u-(n.y+l/A-p)*l)/(a*u-o*l);r=d+a*f-e.x,i=p+o*f-e.y;const m=r*r+i*i;if(m<=2)return new Ht(r,i);s=Math.sqrt(m/2)}else{let e=!1;a>Number.EPSILON?l>Number.EPSILON&&(e=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(r=-o,i=a,s=Math.sqrt(c)):(r=a,i=o,s=Math.sqrt(c/2))}return new Ht(r/s,i/s)}const P=[];for(let e=0,t=E.length,n=t-1,r=e+1;e=0;e--){const t=e/d,n=c*Math.cos(t*Math.PI/2),r=h*Math.sin(t*Math.PI/2)+A;for(let e=0,t=E.length;e=0;){const r=n;let i=n-1;i<0&&(i=e.length-1);for(let e=0,n=o+2*d;e0)&&A.push(t,i,l),(e!==n-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Da extends kr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Or(16777215),this.specular=new Or(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Or(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class La extends kr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Or(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Or(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Ia extends kr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Ua extends kr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Or(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Or(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new er,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Oa extends kr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Ba extends kr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Fa extends kr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Or(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ht(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ka extends ns{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}const qa={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class Va{constructor(e,t,n){const r=this;let i,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,!1===s&&void 0!==r.onStart&&r.onStart(e,a,o),s=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(s=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;tNumber.EPSILON){if(l<0&&(n=t[s],o=-o,a=t[i],l=-l),e.ya.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(a.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=a.x)return!0}}return r}const n=va.isClockWise,r=this.subPaths;if(0===r.length)return[];let i,s,a;const o=[];if(1===r.length)return s=r[0],a=new js,a.curves=s.curves,o.push(a),o;let l=!n(r[0].getPoints());l=e?!l:l;const u=[],c=[];let h,A,d=[],p=0;c[p]=void 0,d[p]=[];for(let t=0,a=r.length;t1){let e=!1,n=0;for(let e=0,t=c.length;e0&&!1===e&&(d=u)}for(let e=0,t=c.length;ee.start-t.start);let t=0;for(let e=1;e 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"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}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * 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 a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 uv = vec2( roughness, dotNV );\n\treturn texture2D( dfgLUT, uv ).rg;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );\n\tvec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );\n\tvec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;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\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 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; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\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",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"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}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"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}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#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}",depth_frag:"#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}",distanceRGBA_vert:"#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}",distanceRGBA_frag:"#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 \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 = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"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}",linedashed_vert:"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}",linedashed_frag:"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}",meshbasic_vert:"#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}",meshbasic_frag:"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}",meshlambert_vert:"#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}",meshlambert_frag:"#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}",meshmatcap_vert:"#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}",meshmatcap_frag:"#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}",meshnormal_vert:"#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}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \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( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \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}",meshphong_frag:"#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}",meshphysical_vert:"#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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \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 \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\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#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}",meshtoon_frag:"#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 \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}",points_vert:"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}",points_frag:"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}",shadow_vert:"#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}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \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}",sprite_vert:"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}",sprite_frag:"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}"},Oo={common:{diffuse:{value:new Or(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $t}},envmap:{envMap:{value:null},envMapRotation:{value:new $t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $t},normalScale:{value:new Ht(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Or(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Or(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0},uvTransform:{value:new $t}},sprite:{diffuse:{value:new Or(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}}},Bo={basic:{uniforms:xi([Oo.common,Oo.specularmap,Oo.envmap,Oo.aomap,Oo.lightmap,Oo.fog]),vertexShader:Uo.meshbasic_vert,fragmentShader:Uo.meshbasic_frag},lambert:{uniforms:xi([Oo.common,Oo.specularmap,Oo.envmap,Oo.aomap,Oo.lightmap,Oo.emissivemap,Oo.bumpmap,Oo.normalmap,Oo.displacementmap,Oo.fog,Oo.lights,{emissive:{value:new Or(0)}}]),vertexShader:Uo.meshlambert_vert,fragmentShader:Uo.meshlambert_frag},phong:{uniforms:xi([Oo.common,Oo.specularmap,Oo.envmap,Oo.aomap,Oo.lightmap,Oo.emissivemap,Oo.bumpmap,Oo.normalmap,Oo.displacementmap,Oo.fog,Oo.lights,{emissive:{value:new Or(0)},specular:{value:new Or(1118481)},shininess:{value:30}}]),vertexShader:Uo.meshphong_vert,fragmentShader:Uo.meshphong_frag},standard:{uniforms:xi([Oo.common,Oo.envmap,Oo.aomap,Oo.lightmap,Oo.emissivemap,Oo.bumpmap,Oo.normalmap,Oo.displacementmap,Oo.roughnessmap,Oo.metalnessmap,Oo.fog,Oo.lights,{emissive:{value:new Or(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Uo.meshphysical_vert,fragmentShader:Uo.meshphysical_frag},toon:{uniforms:xi([Oo.common,Oo.aomap,Oo.lightmap,Oo.emissivemap,Oo.bumpmap,Oo.normalmap,Oo.displacementmap,Oo.gradientmap,Oo.fog,Oo.lights,{emissive:{value:new Or(0)}}]),vertexShader:Uo.meshtoon_vert,fragmentShader:Uo.meshtoon_frag},matcap:{uniforms:xi([Oo.common,Oo.bumpmap,Oo.normalmap,Oo.displacementmap,Oo.fog,{matcap:{value:null}}]),vertexShader:Uo.meshmatcap_vert,fragmentShader:Uo.meshmatcap_frag},points:{uniforms:xi([Oo.points,Oo.fog]),vertexShader:Uo.points_vert,fragmentShader:Uo.points_frag},dashed:{uniforms:xi([Oo.common,Oo.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Uo.linedashed_vert,fragmentShader:Uo.linedashed_frag},depth:{uniforms:xi([Oo.common,Oo.displacementmap]),vertexShader:Uo.depth_vert,fragmentShader:Uo.depth_frag},normal:{uniforms:xi([Oo.common,Oo.bumpmap,Oo.normalmap,Oo.displacementmap,{opacity:{value:1}}]),vertexShader:Uo.meshnormal_vert,fragmentShader:Uo.meshnormal_frag},sprite:{uniforms:xi([Oo.sprite,Oo.fog]),vertexShader:Uo.sprite_vert,fragmentShader:Uo.sprite_frag},background:{uniforms:{uvTransform:{value:new $t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Uo.background_vert,fragmentShader:Uo.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $t}},vertexShader:Uo.backgroundCube_vert,fragmentShader:Uo.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Uo.cube_vert,fragmentShader:Uo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Uo.equirect_vert,fragmentShader:Uo.equirect_frag},distanceRGBA:{uniforms:xi([Oo.common,Oo.displacementmap,{referencePosition:{value:new Wt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Uo.distanceRGBA_vert,fragmentShader:Uo.distanceRGBA_frag},shadow:{uniforms:xi([Oo.lights,Oo.fog,{color:{value:new Or(0)},opacity:{value:1}}]),vertexShader:Uo.shadow_vert,fragmentShader:Uo.shadow_frag}};Bo.physical={uniforms:xi([Bo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $t},clearcoatNormalScale:{value:new Ht(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $t},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $t},sheen:{value:0},sheenColor:{value:new Or(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $t},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $t},attenuationDistance:{value:0},attenuationColor:{value:new Or(0)},specularColor:{value:new Or(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $t},anisotropyVector:{value:new Ht},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $t}}]),vertexShader:Uo.meshphysical_vert,fragmentShader:Uo.meshphysical_frag};const Fo={r:0,b:0,g:0},ko=new er,qo=new Hn;function Vo(e,t,n,r,i,s,a){const o=new Or(0);let l,u,c=!0===s?0:1,h=null,A=0,d=null;function p(e){let r=!0===e.isScene?e.background:null;if(r&&r.isTexture){r=(e.backgroundBlurriness>0?n:t).get(r)}return r}function f(t,n){t.getRGB(Fo,Ti(e)),r.buffers.color.setClear(Fo.r,Fo.g,Fo.b,n,a)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),c=t,f(o,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,f(o,c)},render:function(t){let n=!1;const i=p(t);null===i?f(o,c):i&&i.isColor&&(f(i,1),n=!0);const s=e.xr.getEnvironmentBlendMode();"additive"===s?r.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&r.buffers.color.setClear(0,0,0,0,a),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const r=p(n);r&&(r.isCubeTexture||r.mapping===W)?(void 0===u&&(u=new _i(new yi(1,1,1),new wi({name:"BackgroundCubeMaterial",uniforms:bi(Bo.backgroundCube.uniforms),vertexShader:Bo.backgroundCube.vertexShader,fragmentShader:Bo.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),ko.copy(n.backgroundRotation),ko.x*=-1,ko.y*=-1,ko.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(ko.y*=-1,ko.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(qo.makeRotationFromEuler(ko)),u.material.toneMapped=en.getTransfer(r.colorSpace)!==ot,h===r&&A===r.version&&d===e.toneMapping||(u.material.needsUpdate=!0,h=r,A=r.version,d=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(void 0===l&&(l=new _i(new Sa(2,2),new wi({name:"BackgroundMaterial",uniforms:bi(Bo.background.uniforms),vertexShader:Bo.background.vertexShader,fragmentShader:Bo.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=en.getTransfer(r.colorSpace)!==ot,!0===r.matrixAutoUpdate&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),h===r&&A===r.version&&d===e.toneMapping||(l.material.needsUpdate=!0,h=r,A=r.version,d=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==u&&(u.geometry.dispose(),u.material.dispose(),u=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function zo(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=u(null);let s=i,a=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){const t=[],r=[],i=[];for(let e=0;e=0){const n=i[t];let r=a[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n)return!0;if(n.attribute!==r)return!0;if(r&&n.data!==r.data)return!0;o++}}return s.attributesNum!==o||s.index!==r}(n,f,l,m),g&&function(e,t,n,r){const i={},a=t.attributes;let o=0;const l=n.getAttributes();for(const t in l){if(l[t].location>=0){let n=a[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,o++}}s.attributes=i,s.attributesNum=o,s.index=r}(n,f,l,m),null!==m&&t.update(m,e.ELEMENT_ARRAY_BUFFER),(g||a)&&(a=!1,function(n,r,i,s){c();const a=s.attributes,o=i.getAttributes(),l=r.defaultAttributeValues;for(const r in o){const i=o[r];if(i.location>=0){let o=a[r];if(void 0===o&&("instanceMatrix"===r&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===r&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const r=o.normalized,a=o.itemSize,l=t.get(o);if(void 0===l)continue;const u=l.buffer,c=l.type,d=l.bytesPerElement,f=c===e.INT||c===e.UNSIGNED_INT||o.gpuType===ae;if(o.isInterleavedBufferAttribute){const t=o.data,l=t.stride,m=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==n.precision?n.precision:"highp";const o=s(a);o!==a&&(Rt("WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:s,textureFormatReadable:function(t){return t===ge||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const i=n===ue&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==ne&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==le&&!i)},precision:a,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function jo(e){const t=this;let n=null,r=0,i=!1,s=!1;const a=new Qi,o=new $t,l={value:null,needsUpdate:!1};function u(e,n,r,i){const s=null!==e?e.length:0;let u=null;if(0!==s){if(u=l.value,!0!==i||null===u){const t=r+4*s,i=n.matrixWorldInverse;o.getNormalMatrix(i),(null===u||u.length0);t.numPlanes=r,t.numIntersection=0}();else{const e=s?0:r,t=4*e;let i=p.clippingState||null;l.value=i,i=u(h,o,t,c);for(let e=0;e!==t;++e)i[e]=n[e];p.clippingState=i,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=e}}}function Wo(e){let t=new WeakMap;function n(e,t){return t===H?e.mapping=z:t===j&&(e.mapping=G),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const s=i.mapping;if(s===H||s===j){if(t.has(i)){return n(t.get(i).texture,i.mapping)}{const s=i.image;if(s&&s.height>0){const a=new Ii(s.height);return a.fromEquirectangularTexture(e,i),t.set(i,a),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}const Xo=[.125,.215,.35,.446,.526,.582],Qo=20,$o=new ao,Yo=new Or;let Ko=null,Zo=0,Jo=0,el=!1;const tl=new Wt;let nl=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,i={}){const{size:s=256,position:a=tl}=i;Ko=this._renderer.getRenderTarget(),Zo=this._renderer.getActiveCubeFace(),Jo=this._renderer.getActiveMipmapLevel(),el=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,r,o,a),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=al(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=sl(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=Xo[a-e+4-1]:0===a&&(o=0),n.push(o);const l=1/(s-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],A=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*A),_=new Float32Array(f*d*A),v=new Float32Array(m*d*A);for(let e=0;e2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(r,p*d*e),_.set(h,f*d*e);const i=[e,e,e,e,e,e];v.set(i,m*d*e)}const y=new ai;y.setAttribute("position",new Qr(g,p)),y.setAttribute("uv",new Qr(_,f)),y.setAttribute("faceIndex",new Qr(v,m)),r.push(new _i(y,null)),i>4&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}(r)),this._blurMaterial=function(e,t,n){const r=new Float32Array(Qo),i=new Wt(0,1,0),s=new wi({name:"SphericalGaussianBlur",defines:{n:Qo,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:ol(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return s}(r,e,t)}return r}_compileMaterial(e){const t=new _i(new ai,e);this._renderer.compile(t,$o)}_sceneToCubeUV(e,t,n,r,i){const s=new Ni(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(Yo),l.toneMapping=0,l.autoClear=!1;l.state.buffers.depth.getReversed()&&(l.setRenderTarget(r),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new _i(new yi,new qr({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));const h=this._backgroundBox,A=h.material;let d=!1;const p=e.background;p?p.isColor&&(A.color.copy(p),e.background=null,d=!0):(A.color.copy(Yo),d=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(s.up.set(0,a[t],0),s.position.set(i.x,i.y,i.z),s.lookAt(i.x+o[t],i.y,i.z)):1===n?(s.up.set(0,0,a[t]),s.position.set(i.x,i.y,i.z),s.lookAt(i.x,i.y+o[t],i.z)):(s.up.set(0,a[t],0),s.position.set(i.x,i.y,i.z),s.lookAt(i.x,i.y,i.z+o[t]));const u=this._cubeSize;il(r,n*u,t>2?u:0,u,u),l.setRenderTarget(r),d&&l.render(h,s),l.render(e,s)}l.toneMapping=c,l.autoClear=u,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===z||e.mapping===G;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=al()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=sl());const i=r?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=i;i.uniforms.envMap.value=e;const a=this._cubeSize;il(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,$o)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let t=1;t\n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 3.2: Transform view direction to hemisphere configuration\n\t\t\t\tvec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tfloat lensq = Vh.x * Vh.x + Vh.y * Vh.y;\n\t\t\t\tvec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(Vh, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + Vh.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\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\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:0,depthTest:!1,depthWrite:!1});return r}(this._lodMax,e,t)}const s=this._ggxMaterial,a=this._lodMeshes[n];a.material=s;const o=s.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-u*u)*(.05+.95*l),{_lodMax:h}=this,A=this._sizeLods[n],d=3*A*(n>h-4?n-h+4:0),p=4*(this._cubeSize-A);o.envMap.value=e.texture,o.roughness.value=c,o.mipInt.value=h-t,il(i,d,p,3*A,2*A),r.setRenderTarget(i),r.render(a,$o),o.envMap.value=i.texture,o.roughness.value=0,o.mipInt.value=h-n,il(e,d,p,3*A,2*A),r.setRenderTarget(e),r.render(a,$o)}_blur(e,t,n,r,i){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,r,"latitudinal",i),this._halfBlur(s,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,s,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&Nt("blur direction must be either latitudinal or longitudinal!");const u=this._lodMeshes[r];u.material=l;const c=l.uniforms,h=this._sizeLods[n]-1,A=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,d=i/A,p=isFinite(i)?1+Math.floor(3*d):Qo;p>Qo&&Rt(`sigmaRadians, ${i}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const f=[];let m=0;for(let e=0;eg-4?r-g+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(t),o.render(u,$o)}};function rl(e,t,n){const r=new pn(e,t,n);return r.texture.mapping=W,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function il(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function sl(){return new wi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ol(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function al(){return new wi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ol(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ol(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function ll(e){let t=new WeakMap,n=null;function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const s=i.mapping,a=s===H||s===j,o=s===z||s===G;if(a||o){let s=t.get(i);const l=void 0!==s?s.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new nl(e)),s=a?n.fromEquirectangular(i,s):n.fromCubemap(i,s),s.texture.pmremVersion=i.pmremVersion,t.set(i,s),s.texture;if(void 0!==s)return s.texture;{const l=i.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;const n=6;for(let r=0;rt.maxTextureSize&&(y=Math.ceil(v/t.maxTextureSize),v=t.maxTextureSize);const b=new Float32Array(v*y*4*c),x=new fn(b,v,y,c);x.type=le,x.needsUpdate=!0;const T=4*_;for(let w=0;w0)return e;const i=t*n;let s=yl[i];if(void 0===s&&(s=new Float32Array(i),yl[i]=s),0!==t){r.toArray(s,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(s,i)}return s}function Ml(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n":" "} ${i}: ${n[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}return i}function Su(e,t){const n=function(e){en._getMatrix(xu,en.workingColorSpace,e);const t=`mat3( ${xu.elements.map(e=>e.toFixed(4))} )`;switch(en.getTransfer(e)){case at:return[t,"LinearTransferOETF"];case ot:return[t,"sRGBTransferOETF"];default:return Rt("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function wu(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:Rt("WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Mu=new Wt;function Eu(){en.getLuminanceCoefficients(Mu);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Mu.x.toFixed(4)}, ${Mu.y.toFixed(4)}, ${Mu.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Cu(e){return""!==e}function Ru(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Nu(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Pu=/^[ \t]*#include +<([\w\d./]+)>/gm;function Du(e){return e.replace(Pu,Iu)}const Lu=new Map;function Iu(e,t){let n=Uo[t];if(void 0===n){const e=Lu.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=Uo[e],Rt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return Du(n)}const Uu=/#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 Ou(e){return e.replace(Uu,Bu)}function Bu(e,t,n,r){let i="";for(let e=parseInt(t);e0&&(m+="\n"),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter(Cu).join("\n"),g.length>0&&(g+="\n")):(m=[Fu(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.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(Cu).join("\n"),g=[Fu(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",A?"#define CUBEUV_TEXEL_WIDTH "+A.texelWidth:"",A?"#define CUBEUV_TEXEL_HEIGHT "+A.texelHeight:"",A?"#define CUBEUV_MAX_MIP "+A.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Uo.tonemapping_pars_fragment:"",0!==n.toneMapping?wu("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Uo.colorspace_pars_fragment,Su("linearToOutputTexel",n.outputColorSpace),Eu(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Cu).join("\n")),a=Du(a),a=Ru(a,n),a=Nu(a,n),o=Du(o),o=Ru(o,n),o=Nu(o,n),a=Ou(a),o=Ou(o),!0!==n.isRawShaderMaterial&&(_="#version 300 es\n",m=[d,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#define varying in",n.glslVersion===vt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===vt?"":"#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"+g);const v=_+m+a,y=_+g+o,b=yu(i,i.VERTEX_SHADER,v),x=yu(i,i.FRAGMENT_SHADER,y);function T(t){if(e.debug.checkShaderErrors){const n=i.getProgramInfoLog(f)||"",r=i.getShaderInfoLog(b)||"",s=i.getShaderInfoLog(x)||"",a=n.trim(),o=r.trim(),l=s.trim();let u=!0,c=!0;if(!1===i.getProgramParameter(f,i.LINK_STATUS))if(u=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(i,f,b,x);else{const e=Tu(i,b,"vertex"),n=Tu(i,x,"fragment");Nt("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(f,i.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+n)}else""!==a?Rt("WebGLProgram: Program Info Log:",a):""!==o&&""!==l||(c=!1);c&&(t.diagnostics={runnable:u,programLog:a,vertexShader:{log:o,prefix:m},fragmentShader:{log:l,prefix:g}})}i.deleteShader(b),i.deleteShader(x),S=new vu(i,f),w=function(e,t){const n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i0,Q=s.clearcoat>0,$=s.dispersion>0,Y=s.iridescence>0,K=s.sheen>0,Z=s.transmission>0,J=X&&!!s.anisotropyMap,ee=Q&&!!s.clearcoatMap,te=Q&&!!s.clearcoatNormalMap,ne=Q&&!!s.clearcoatRoughnessMap,re=Y&&!!s.iridescenceMap,ie=Y&&!!s.iridescenceThicknessMap,se=K&&!!s.sheenColorMap,ae=K&&!!s.sheenRoughnessMap,oe=!!s.specularMap,le=!!s.specularColorMap,ue=!!s.specularIntensityMap,ce=Z&&!!s.transmissionMap,he=Z&&!!s.thicknessMap,Ae=!!s.gradientMap,de=!!s.alphaMap,pe=s.alphaTest>0,fe=!!s.alphaHash,me=!!s.extensions;let ge=0;s.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(ge=e.toneMapping));const _e={shaderID:T,shaderType:s.type,shaderName:s.name,vertexShader:M,fragmentShader:E,defines:s.defines,customVertexShaderID:C,customFragmentShaderID:R,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:d,batching:I,batchingColor:I&&null!==g._colorsTexture,instancing:L,instancingColor:L&&null!==g.instanceColor,instancingMorph:L&&null!==g.morphTexture,supportsVertexTextures:A,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:st,alphaToCoverage:!!s.alphaToCoverage,map:U,matcap:O,envMap:B,envMapMode:B&&b.mapping,envMapCubeUVHeight:x,aoMap:F,lightMap:k,bumpMap:q,normalMap:V,displacementMap:A&&z,emissiveMap:G,normalMapObjectSpace:V&&1===s.normalMapType,normalMapTangentSpace:V&&0===s.normalMapType,metalnessMap:H,roughnessMap:j,anisotropy:X,anisotropyMap:J,clearcoat:Q,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,dispersion:$,iridescence:Y,iridescenceMap:re,iridescenceThicknessMap:ie,sheen:K,sheenColorMap:se,sheenRoughnessMap:ae,specularMap:oe,specularColorMap:le,specularIntensityMap:ue,transmission:Z,transmissionMap:ce,thicknessMap:he,gradientMap:Ae,opaque:!1===s.transparent&&1===s.blending&&!1===s.alphaToCoverage,alphaMap:de,alphaTest:pe,alphaHash:fe,combine:s.combine,mapUv:U&&f(s.map.channel),aoMapUv:F&&f(s.aoMap.channel),lightMapUv:k&&f(s.lightMap.channel),bumpMapUv:q&&f(s.bumpMap.channel),normalMapUv:V&&f(s.normalMap.channel),displacementMapUv:z&&f(s.displacementMap.channel),emissiveMapUv:G&&f(s.emissiveMap.channel),metalnessMapUv:H&&f(s.metalnessMap.channel),roughnessMapUv:j&&f(s.roughnessMap.channel),anisotropyMapUv:J&&f(s.anisotropyMap.channel),clearcoatMapUv:ee&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:te&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:re&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:se&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:ae&&f(s.sheenRoughnessMap.channel),specularMapUv:oe&&f(s.specularMap.channel),specularColorMapUv:le&&f(s.specularColorMap.channel),specularIntensityMapUv:ue&&f(s.specularIntensityMap.channel),transmissionMapUv:ce&&f(s.transmissionMap.channel),thicknessMapUv:he&&f(s.thicknessMap.channel),alphaMapUv:de&&f(s.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(V||X),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!v.attributes.color&&4===v.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!v.attributes.uv&&(U||de),fog:!!_,useFog:!0===s.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===s.flatShading&&!1===s.wireframe,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:D,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==v.morphAttributes.position,morphNormals:void 0!==v.morphAttributes.normal,morphColors:void 0!==v.morphAttributes.color,morphTargetsCount:w,morphTextureStride:N,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ge,decodeVideoTexture:U&&!0===s.map.isVideoTexture&&en.getTransfer(s.map.colorSpace)===ot,decodeVideoTextureEmissive:G&&!0===s.emissiveMap.isVideoTexture&&en.getTransfer(s.emissiveMap.colorSpace)===ot,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:me&&!0===s.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(me&&!0===s.extensions.multiDraw||I)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return _e.vertexUv1s=u.has(1),_e.vertexUv2s=u.has(2),_e.vertexUv3s=u.has(3),u.clear(),_e},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0);t.instancing&&o.enable(1);t.instancingColor&&o.enable(2);t.instancingMorph&&o.enable(3);t.matcap&&o.enable(4);t.envMap&&o.enable(5);t.normalMapObjectSpace&&o.enable(6);t.normalMapTangentSpace&&o.enable(7);t.clearcoat&&o.enable(8);t.iridescence&&o.enable(9);t.alphaTest&&o.enable(10);t.vertexColors&&o.enable(11);t.vertexAlphas&&o.enable(12);t.vertexUv1s&&o.enable(13);t.vertexUv2s&&o.enable(14);t.vertexUv3s&&o.enable(15);t.vertexTangents&&o.enable(16);t.anisotropy&&o.enable(17);t.alphaHash&&o.enable(18);t.batching&&o.enable(19);t.dispersion&&o.enable(20);t.batchingColor&&o.enable(21);t.gradientMap&&o.enable(22);e.push(o.mask),o.disableAll(),t.fog&&o.enable(0);t.useFog&&o.enable(1);t.flatShading&&o.enable(2);t.logarithmicDepthBuffer&&o.enable(3);t.reversedDepthBuffer&&o.enable(4);t.skinning&&o.enable(5);t.morphTargets&&o.enable(6);t.morphNormals&&o.enable(7);t.morphColors&&o.enable(8);t.premultipliedAlpha&&o.enable(9);t.shadowMapEnabled&&o.enable(10);t.doubleSided&&o.enable(11);t.flipSided&&o.enable(12);t.useDepthPacking&&o.enable(13);t.dithering&&o.enable(14);t.transmission&&o.enable(15);t.sheen&&o.enable(16);t.opaque&&o.enable(17);t.pointsUvs&&o.enable(18);t.decodeVideoTexture&&o.enable(19);t.decodeVideoTextureEmissive&&o.enable(20);t.alphaToCoverage&&o.enable(21);e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=Bo[t];n=Si.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r;for(let e=0,t=c.length;e0?r.push(c):!0===a.transparent?i.push(c):n.push(c)},unshift:function(e,t,a,o,l,u){const c=s(e,t,a,o,l,u);a.transmission>0?r.unshift(c):!0===a.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(let n=t,r=e.length;n1&&n.sort(e||ju),r.length>1&&r.sort(t||Wu),i.length>1&&i.sort(t||Wu)}}}function Qu(){let e=new WeakMap;return{get:function(t,n){const r=e.get(t);let i;return void 0===r?(i=new Xu,e.set(t,[i])):n>=r.length?(i=new Xu,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function $u(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Wt,color:new Or};break;case"SpotLight":n={position:new Wt,direction:new Wt,color:new Or,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Wt,color:new Or,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Wt,skyColor:new Or,groundColor:new Or};break;case"RectAreaLight":n={color:new Or,position:new Wt,halfWidth:new Wt,halfHeight:new Wt}}return e[t.id]=n,n}}}let Yu=0;function Ku(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Zu(e){const t=new $u,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new Wt);const i=new Wt,s=new Hn,a=new Hn;return{setup:function(i){let s=0,a=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0;i.sort(Ku);for(let e=0,v=i.length;e0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Oo.LTC_FLOAT_1,r.rectAreaLTC2=Oo.LTC_FLOAT_2):(r.rectAreaLTC1=Oo.LTC_HALF_1,r.rectAreaLTC2=Oo.LTC_HALF_2)),r.ambient[0]=s,r.ambient[1]=a,r.ambient[2]=o;const v=r.hash;v.directionalLength===l&&v.pointLength===u&&v.spotLength===c&&v.rectAreaLength===h&&v.hemiLength===A&&v.numDirectionalShadows===d&&v.numPointShadows===p&&v.numSpotShadows===f&&v.numSpotMaps===m&&v.numLightProbes===_||(r.directional.length=l,r.spot.length=c,r.rectArea.length=h,r.point.length=u,r.hemi.length=A,r.directionalShadow.length=d,r.directionalShadowMap.length=d,r.pointShadow.length=p,r.pointShadowMap.length=p,r.spotShadow.length=f,r.spotShadowMap.length=f,r.directionalShadowMatrix.length=d,r.pointShadowMatrix.length=p,r.spotLightMatrix.length=f+m-g,r.spotLightMap.length=m,r.numSpotLightShadowsWithMaps=g,r.numLightProbes=_,v.directionalLength=l,v.pointLength=u,v.spotLength=c,v.rectAreaLength=h,v.hemiLength=A,v.numDirectionalShadows=d,v.numPointShadows=p,v.numSpotShadows=f,v.numSpotMaps=m,v.numLightProbes=_,r.version=Yu++)},setupView:function(e,t){let n=0,o=0,l=0,u=0,c=0;const h=t.matrixWorldInverse;for(let t=0,A=e.length;t=i.length?(s=new Ju(e),i.push(s)):s=i[r],s},dispose:function(){t=new WeakMap}}}function tc(e,t,n){let r=new Zi;const i=new Ht,s=new Ht,a=new An,o=new Oa({depthPacking:3201}),l=new Ba,u={},c=n.maxTextureSize,h={[d]:1,[p]:0,[f]:2},A=new wi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),m=A.clone();m.defines.HORIZONTAL_PASS=1;const g=new ai;g.setAttribute("position",new Qr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new _i(g,A),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let y=this.type;function b(n,r){const s=t.update(_);A.defines.VSM_SAMPLES!==n.blurSamples&&(A.defines.VSM_SAMPLES=n.blurSamples,m.defines.VSM_SAMPLES=n.blurSamples,A.needsUpdate=!0,m.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new pn(i.x,i.y)),A.uniforms.shadow_pass.value=n.map.texture,A.uniforms.resolution.value=n.mapSize,A.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,s,A,_,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,s,m,_,null)}function x(t,n,r,i){let s=null;const a=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=s.uuid,t=n.uuid;let r=u[e];void 0===r&&(r={},u[e]=r);let i=r[t];void 0===i&&(i=s.clone(),r[t]=i,n.addEventListener("dispose",S)),s=i}if(s.visible=n.visible,s.wireframe=n.wireframe,s.side=3===i?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],s.alphaMap=n.alphaMap,s.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===r.isPointLight&&!0===s.isMeshDistanceMaterial){e.properties.get(s).light=r}return s}function T(n,i,s,a,o){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=t.update(n),l=n.material;if(Array.isArray(l)){const t=r.groups;for(let u=0,c=t.length;uc||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/f.x),i.x=s.x*f.x,h.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/f.y),i.y=s.y*f.y,h.mapSize.y=s.y)),null===h.map||!0===d||!0===p){const e=3!==this.type?{minFilter:Y,magFilter:Y}:{};null!==h.map&&h.map.dispose(),h.map=new pn(i.x,i.y,e),h.map.texture.name=u.name+".shadowMap",h.camera.updateProjectionMatrix()}e.setRenderTarget(h.map),e.clear();const m=h.getViewportCount();for(let e=0;e=1):-1!==$.indexOf("OpenGL ES")&&(Q=parseFloat(/^OpenGL ES (\d)/.exec($)[1]),X=Q>=2);let Y=null,K={};const Z=e.getParameter(e.SCISSOR_BOX),J=e.getParameter(e.VIEWPORT),ee=(new An).fromArray(Z),te=(new An).fromArray(J);function ne(t,n,r,i){const s=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let a=0;an||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(r*i.width),s=Math.floor(r*i.height);void 0===h&&(h=p(n,s));const a=t?p(n,s):h;a.width=n,a.height=s;return a.getContext("2d").drawImage(e,0,0,n,s),Rt("WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+n+"x"+s+")."),a}return"data"in e&&Rt("WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+")."),e}return e}function m(e){return e.generateMipmaps}function g(t){e.generateMipmap(t)}function _(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function v(n,r,i,s,a=!1){if(null!==n){if(void 0!==e[n])return e[n];Rt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=r;if(r===e.RED&&(i===e.FLOAT&&(o=e.R32F),i===e.HALF_FLOAT&&(o=e.R16F),i===e.UNSIGNED_BYTE&&(o=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.R8UI),i===e.UNSIGNED_SHORT&&(o=e.R16UI),i===e.UNSIGNED_INT&&(o=e.R32UI),i===e.BYTE&&(o=e.R8I),i===e.SHORT&&(o=e.R16I),i===e.INT&&(o=e.R32I)),r===e.RG&&(i===e.FLOAT&&(o=e.RG32F),i===e.HALF_FLOAT&&(o=e.RG16F),i===e.UNSIGNED_BYTE&&(o=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RG8UI),i===e.UNSIGNED_SHORT&&(o=e.RG16UI),i===e.UNSIGNED_INT&&(o=e.RG32UI),i===e.BYTE&&(o=e.RG8I),i===e.SHORT&&(o=e.RG16I),i===e.INT&&(o=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGB8UI),i===e.UNSIGNED_SHORT&&(o=e.RGB16UI),i===e.UNSIGNED_INT&&(o=e.RGB32UI),i===e.BYTE&&(o=e.RGB8I),i===e.SHORT&&(o=e.RGB16I),i===e.INT&&(o=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),i===e.UNSIGNED_INT&&(o=e.RGBA32UI),i===e.BYTE&&(o=e.RGBA8I),i===e.SHORT&&(o=e.RGBA16I),i===e.INT&&(o=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),r===e.RGBA){const t=a?at:en.getTransfer(s);i===e.FLOAT&&(o=e.RGBA32F),i===e.HALF_FLOAT&&(o=e.RGBA16F),i===e.UNSIGNED_BYTE&&(o=t===ot?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return o!==e.R16F&&o!==e.R32F&&o!==e.RG16F&&o!==e.RG32F&&o!==e.RGBA16F&&o!==e.RGBA32F||t.get("EXT_color_buffer_float"),o}function y(t,n){let r;return t?null===n||n===oe||n===Ae?r=e.DEPTH24_STENCIL8:n===le?r=e.DEPTH32F_STENCIL8:n===se&&(r=e.DEPTH24_STENCIL8,Rt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===oe||n===Ae?r=e.DEPTH_COMPONENT24:n===le?r=e.DEPTH_COMPONENT32F:n===se&&(r=e.DEPTH_COMPONENT16),r}function b(e,t){return!0===m(e)||e.isFramebufferTexture&&e.minFilter!==Y&&e.minFilter!==J?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function x(e){const t=e.target;t.removeEventListener("dispose",x),function(e){const t=r.get(e);if(void 0===t.__webglInit)return;const n=e.source,i=A.get(n);if(i){const r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&S(e),0===Object.keys(i).length&&A.delete(n)}r.remove(e)}(t),t.isVideoTexture&&c.delete(t)}function T(t){const n=t.target;n.removeEventListener("dispose",T),function(t){const n=r.get(t);t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r0&&s.__version!==t.version){const e=t.image;if(null===e)Rt("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(s,t,i);Rt("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(s.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+i)}const E={[X]:e.REPEAT,[Q]:e.CLAMP_TO_EDGE,[$]:e.MIRRORED_REPEAT},C={[Y]:e.NEAREST,[K]:e.NEAREST_MIPMAP_NEAREST,[Z]:e.NEAREST_MIPMAP_LINEAR,[J]:e.LINEAR,[ee]:e.LINEAR_MIPMAP_NEAREST,[te]:e.LINEAR_MIPMAP_LINEAR},R={[ut]:e.NEVER,[mt]:e.ALWAYS,[ct]:e.LESS,[At]:e.LEQUAL,[ht]:e.EQUAL,[ft]:e.GEQUAL,[dt]:e.GREATER,[pt]:e.NOTEQUAL};function N(n,s){if(s.type!==le||!1!==t.has("OES_texture_float_linear")||s.magFilter!==J&&s.magFilter!==ee&&s.magFilter!==Z&&s.magFilter!==te&&s.minFilter!==J&&s.minFilter!==ee&&s.minFilter!==Z&&s.minFilter!==te||Rt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,E[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,E[s.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,E[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,C[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,C[s.minFilter]),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,R[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Y)return;if(s.minFilter!==Z&&s.minFilter!==te)return;if(s.type===le&&!1===t.has("OES_texture_float_linear"))return;if(s.anisotropy>1||r.get(s).__currentAnisotropy){const a=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy}}}function P(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",x));const i=n.source;let s=A.get(i);void 0===s&&(s={},A.set(i,s));const o=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===s[o]&&(s[o]={texture:e.createTexture(),usedTimes:0},a.memory.textures++,r=!0),s[o].usedTimes++;const i=s[t.__cacheKey];void 0!==i&&(s[t.__cacheKey].usedTimes--,0===i.usedTimes&&S(n)),t.__cacheKey=o,t.__webglTexture=s[o].texture}return r}function D(e,t,n){return Math.floor(Math.floor(e/n)/t)}function L(t,a,o){let l=e.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=e.TEXTURE_3D);const u=P(t,a),c=a.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const h=r.get(c);if(c.version!==h.__version||!0===u){n.activeTexture(e.TEXTURE0+o);const t=en.getPrimaries(en.workingColorSpace),r=a.colorSpace===rt?null:en.getPrimaries(a.colorSpace),A=a.colorSpace===rt||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,A);let d=f(a.image,!1,i.maxTextureSize);d=z(a,d);const p=s.convert(a.format,a.colorSpace),_=s.convert(a.type);let x,T=v(a.internalFormat,p,_,a.colorSpace,a.isVideoTexture);N(l,a);const S=a.mipmaps,w=!0!==a.isVideoTexture,M=void 0===h.__version||!0===u,E=c.dataReady,C=b(a,d);if(a.isDepthTexture)T=y(a.format===ve,a.type),M&&(w?n.texStorage2D(e.TEXTURE_2D,1,T,d.width,d.height):n.texImage2D(e.TEXTURE_2D,0,T,d.width,d.height,0,p,_,null));else if(a.isDataTexture)if(S.length>0){w&&M&&n.texStorage2D(e.TEXTURE_2D,C,T,S[0].width,S[0].height);for(let t=0,r=S.length;te.start-t.start);let o=0;for(let e=1;e0){const r=Do(x.width,x.height,a.format,a.type);for(const i of a.layerUpdates){const s=x.data.subarray(i*r/x.data.BYTES_PER_ELEMENT,(i+1)*r/x.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,x.width,x.height,1,p,s)}a.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,x.width,x.height,d.depth,p,x.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,T,x.width,x.height,d.depth,0,x.data,0,0);else Rt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else w?E&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,x.width,x.height,d.depth,p,_,x.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,T,x.width,x.height,d.depth,0,p,_,x.data)}else{w&&M&&n.texStorage2D(e.TEXTURE_2D,C,T,S[0].width,S[0].height);for(let t=0,r=S.length;t0){const t=Do(d.width,d.height,a.format,a.type);for(const r of a.layerUpdates){const i=d.data.subarray(r*t/d.data.BYTES_PER_ELEMENT,(r+1)*t/d.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,d.width,d.height,1,p,_,i)}a.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,d.width,d.height,d.depth,p,_,d.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,T,d.width,d.height,d.depth,0,p,_,d.data);else if(a.isData3DTexture)w?(M&&n.texStorage3D(e.TEXTURE_3D,C,T,d.width,d.height,d.depth),E&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,d.width,d.height,d.depth,p,_,d.data)):n.texImage3D(e.TEXTURE_3D,0,T,d.width,d.height,d.depth,0,p,_,d.data);else if(a.isFramebufferTexture){if(M)if(w)n.texStorage2D(e.TEXTURE_2D,C,T,d.width,d.height);else{let t=d.width,r=d.height;for(let i=0;i>=1,r>>=1}}else if(S.length>0){if(w&&M){const t=G(S[0]);n.texStorage2D(e.TEXTURE_2D,C,T,t.width,t.height)}for(let t=0,r=S.length;t>c),r=Math.max(1,i.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,d,t,r,i.depth,0,h,A,null):n.texImage2D(u,c,d,t,r,0,h,A,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),V(i)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,f.__webglTexture,0,q(i)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,f.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function U(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,a=y(n.stencilBuffer,s),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=q(n);V(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,a,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,a,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,a,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");const e=t.texture.mipmaps;e&&e.length>0?O(i.__webglFramebuffer[0],t):O(i.__webglFramebuffer,t)}else if(s){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),void 0===i.__webglDepthbuffer[r])i.__webglDepthbuffer[r]=e.createRenderbuffer(),U(i.__webglDepthbuffer[r],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,s)}}else{const r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),void 0===i.__webglDepthbuffer)i.__webglDepthbuffer=e.createRenderbuffer(),U(i.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}const F=[],k=[];function q(e){return Math.min(i.maxSamples,e.samples)}function V(e){const n=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function z(e,t){const n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==st&&n!==rt&&(en.getTransfer(n)===ot?r===ge&&i===ne||Rt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Nt("WebGLTextures: Unsupported texture color space:",n)),t}function G(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(u.width=e.naturalWidth||e.width,u.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(u.width=e.displayWidth,u.height=e.displayHeight):(u.width=e.width,u.height=e.height),u}this.allocateTextureUnit=function(){const e=w;return e>=i.maxTextures&&Rt("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+i.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.setTexture2D=M,this.setTexture2DArray=function(t,i){const s=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version?L(s,t,i):(t.isExternalTexture&&(s.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+i))},this.setTexture3D=function(t,i){const s=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version?L(s,t,i):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,a){const o=r.get(t);t.version>0&&o.__version!==t.version?function(t,a,o){if(6!==a.image.length)return;const l=P(t,a),u=a.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const c=r.get(u);if(u.version!==c.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=en.getPrimaries(en.workingColorSpace),r=a.colorSpace===rt?null:en.getPrimaries(a.colorSpace),h=a.colorSpace===rt||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,h);const A=a.isCompressedTexture||a.image[0].isCompressedTexture,d=a.image[0]&&a.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)p[e]=A||d?d?a.image[e].image:a.image[e]:f(a.image[e],!0,i.maxCubemapSize),p[e]=z(a,p[e]);const _=p[0],y=s.convert(a.format,a.colorSpace),x=s.convert(a.type),T=v(a.internalFormat,y,x,a.colorSpace),S=!0!==a.isVideoTexture,w=void 0===c.__version||!0===l,M=u.dataReady;let E,C=b(a,_);if(N(e.TEXTURE_CUBE_MAP,a),A){S&&w&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,T,_.width,_.height);for(let t=0;t<6;t++){E=p[t].mipmaps;for(let r=0;r0&&C++;const t=G(p[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,T,t.width,t.height)}for(let t=0;t<6;t++)if(d){S?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,p[t].width,p[t].height,y,x,p[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,T,p[t].width,p[t].height,0,y,x,p[t].data);for(let r=0;r1;if(h||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=i.version,a.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===V(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0)if(!1===V(t)){const i=t.textures,s=t.width,a=t.height;let o=e.COLOR_BUFFER_BIT;const u=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=i.length>1;if(h)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new _i(new Sa(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class oc extends Dt{constructor(e,t){super();const n=this;let r=null,i=1,s=null,a="local-floor",o=1,l=null,u=null,c=null,h=null,A=null,d=null;const p="undefined"!=typeof XRWebGLBinding,f=new ac,m={},g=t.getContextAttributes();let _=null,v=null;const y=[],b=[],x=new Ht;let T=null;const S=new Ni;S.viewport=new An;const w=new Ni;w.viewport=new An;const M=[S,w],E=new fo;let C=null,R=null;function N(e){const t=b.indexOf(e.inputSource);if(-1===t)return;const n=y[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function P(){r.removeEventListener("select",N),r.removeEventListener("selectstart",N),r.removeEventListener("selectend",N),r.removeEventListener("squeeze",N),r.removeEventListener("squeezestart",N),r.removeEventListener("squeezeend",N),r.removeEventListener("end",P),r.removeEventListener("inputsourceschange",D);for(let e=0;e=0&&(b[r]=null,y[r].disconnect(n))}for(let t=0;t=b.length){b.push(n),r=e;break}if(null===b[e]){b[e]=n,r=e;break}}if(-1===r)break}const i=y[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=y[e];return void 0===t&&(t=new Bi,y[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=y[e];return void 0===t&&(t=new Bi,y[e]=t),t.getGripSpace()},this.getHand=function(e){let t=y[e];return void 0===t&&(t=new Bi,y[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&Rt("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){a=e,!0===n.isPresenting&&Rt("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:A},this.getBinding=function(){return null===c&&p&&(c=new XRWebGLBinding(r,t)),c},this.getFrame=function(){return d},this.getSession=function(){return r},this.setSession=async function(u){if(r=u,null!==r){_=e.getRenderTarget(),r.addEventListener("select",N),r.addEventListener("selectstart",N),r.addEventListener("selectend",N),r.addEventListener("squeeze",N),r.addEventListener("squeezestart",N),r.addEventListener("squeezeend",N),r.addEventListener("end",P),r.addEventListener("inputsourceschange",D),!0!==g.xrCompatible&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(x);if(p&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,s=null,a=null;g.depth&&(a=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=g.stencil?ve:_e,s=g.stencil?Ae:oe);const o={colorFormat:t.RGBA8,depthFormat:a,scaleFactor:i};c=this.getBinding(),h=c.createProjectionLayer(o),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),v=new pn(h.textureWidth,h.textureHeight,{format:ge,type:ne,depthTexture:new xs(h.textureWidth,h.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:g.antialias?4:0,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{const n={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:i};A=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),v=new pn(A.framebufferWidth,A.framebufferHeight,{format:ge,type:ne,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil,resolveDepthBuffer:!1===A.ignoreDepthValues,resolveStencilBuffer:!1===A.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await r.requestReferenceSpace(a),B.setContext(r),B.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new Wt,I=new Wt;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===r)return;let t=e.near,n=e.far;null!==f.texture&&(f.depthNear>0&&(t=f.depthNear),f.depthFar>0&&(n=f.depthFar)),E.near=w.near=S.near=t,E.far=w.far=S.far=n,C===E.near&&R===E.far||(r.updateRenderState({depthNear:E.near,depthFar:E.far}),C=E.near,R=E.far),E.layers.mask=6|e.layers.mask,S.layers.mask=3&E.layers.mask,w.layers.mask=5&E.layers.mask;const i=e.parent,s=E.cameras;U(E,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);const i=t.get(r),s=i.envMap,a=i.envMapRotation;s&&(e.envMap.value=s,lc.copy(a),lc.x*=-1,lc.y*=-1,lc.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(lc.y*=-1,lc.z*=-1),e.envMapRotation.value.setFromMatrix4(uc.makeRotationFromEuler(lc)),e.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Ti(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,s,a,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(r(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(r(e,i),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,i,o)):i.isMeshMatcapMaterial?(r(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){const r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i,s,a):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function hc(e,t,n,r){let i={},s={},a=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,r){const i=e.value,s=t+"_"+n;if(void 0===r[s])return r[s]="number"==typeof i||"boolean"==typeof i?i:i.clone(),!0;{const e=r[s];if("number"==typeof i||"boolean"==typeof i){if(e!==i)return r[s]=i,!0}else if(!1===e.equals(i))return e.copy(i),!0}return!1}function u(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?Rt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Rt("WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){const n=t.target;n.removeEventListener("dispose",c);const r=a.indexOf(n.__bindingPointIndex);a.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete s[n.id]}return{bind:function(e,t){const n=t.program;r.uniformBlockBinding(e,n)},update:function(n,h){let A=i[n.id];void 0===A&&(!function(e){const t=e.uniforms;let n=0;const r=16;for(let e=0,i=t.length;e0&&(n+=r-i);e.__size=n,e.__cache={}}(n),A=function(t){const n=function(){for(let e=0;e=t||n<0||h&&e-u>=s}function f(){var e=Tc();if(p(e))return m(e);o=setTimeout(f,function(e){var n=t-(e-l);return h?Vc(n,s-(e-u)):n}(e))}function m(e){return o=void 0,A&&r?d(e):(r=i=void 0,a)}function g(){var e=Tc(),n=p(e);if(r=arguments,i=this,l=e,n){if(void 0===o)return function(e){return u=e,o=setTimeout(f,t),c?d(e):a}(l);if(h)return clearTimeout(o),o=setTimeout(f,t),d(l)}return void 0===o&&(o=setTimeout(f,t)),a}return t=kc(t)||0,vc(n)&&(c=!!n.leading,s=(h="maxWait"in n)?qc(kc(n.maxWait)||0,t):s,A="trailing"in n?!!n.trailing:A),g.cancel=function(){void 0!==o&&clearTimeout(o),u=0,r=l=i=o=void 0},g.flush=function(){return void 0===o?a:m(Tc())},g}function Gc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),$c=function(){return performance.now()},Yc=function(){function e(){for(var e=[],t=0;t0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?s(e[n],e[n-1],n-r):s(e[i],e[i+1>n?n:i+1],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},Zc=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Jc=new Yc,eh=function(){function e(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Qc.Linear.None,this._interpolationFunction=Kc.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Zc.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,"object"==typeof t?(this._group=t,t.add(this)):!0===t&&(this._group=Jc,Jc.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e<0?0:e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=$c()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var i in this._valuesEnd)r[i]=this._valuesEnd[i];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,n,r,i){for(var s in n){var a=e[s],o=Array.isArray(a),l=o?"array":typeof a,u=!o&&Array.isArray(n[s]);if("undefined"!==l&&"function"!==l){if(u){if(0===(m=n[s]).length)continue;for(var c=[a],h=0,A=m.length;hl)return 1;var e=Math.trunc(a/o),t=a-e*o,n=Math.min(t/s._duration,1);return 0===n&&a===s._duration?1:n}(),c=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),0===this._duration||a>=this._duration){if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);for(i in isFinite(this._repeat)&&(this._repeat-=h),this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,d=this._chainedTweens.length;A=(a=(v+x)/2))?v=a:x=a,(d=n>=(o=(y+T)/2))?y=o:T=o,(p=r>=(l=(b+S)/2))?b=l:S=l,s=g,!(g=g[f=p<<2|d<<1|A]))return s[f]=_,e;if(u=+e._x.call(null,g.data),c=+e._y.call(null,g.data),h=+e._z.call(null,g.data),t===u&&n===c&&r===h)return _.next=g,s?s[f]=_:e._root=_,e;do{s=s?s[f]=new Array(8):e._root=new Array(8),(A=t>=(a=(v+x)/2))?v=a:x=a,(d=n>=(o=(y+T)/2))?y=o:T=o,(p=r>=(l=(b+S)/2))?b=l:S=l}while((f=p<<2|d<<1|A)==(m=(h>=l)<<2|(c>=o)<<1|u>=a));return s[m]=g,s[f]=_,e}function rh(e,t,n,r,i,s,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=s,this.z1=a}th.getAll.bind(th),th.removeAll.bind(th),th.add.bind(th),th.remove.bind(th),th.update.bind(th);const ih=(e,t,n,r,i,s)=>Math.sqrt((e-r)**2+(t-i)**2+(n-s)**2);function sh(e){return e[0]}function ah(e){return e[1]}function oh(e){return e[2]}function lh(e,t,n,r){var i=new uh(null==t?sh:t,null==n?ah:n,null==r?oh:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function uh(e,t,n,r,i,s,a,o,l){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=s,this._x1=a,this._y1=o,this._z1=l,this._root=void 0}function ch(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var hh=lh.prototype=uh.prototype;function Ah(e,t){return null==e||null==t?NaN:et?1:e>=t?0:NaN}function dh(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function ph(e){let t,n,r;function i(e,r,i=0,s=e.length){if(i>>1;n(e[t],r)<0?i=t+1:s=t}while(iAh(e(t),n),r=(t,n)=>e(t)-n):(t=e===Ah||e===dh?e:fh,n=e,r=e),{left:i,center:function(e,t,n=0,s=e.length){const a=i(e,t,n,s-1);return a>n&&r(e[a-1],t)>-r(e[a],t)?a-1:a},right:function(e,r,i=0,s=e.length){if(i>>1;n(e[t],r)<=0?i=t+1:s=t}while(il&&(l=A),du&&(u=d),pc&&(c=p));if(s>l||a>u||o>c)return this;this.cover(s,a,o).cover(l,u,c);for(let s=0;se||e>=a||i>t||t>=o||s>n||n>=l;)switch(c=(nm||(a=h.y0)>g||(o=h.z0)>_||(l=h.x1)=T)<<2|(t>=x)<<1|e>=b)&&(h=v[v.length-1],v[v.length-1]=v[v.length-1-A],v[v.length-1-A]=h)}else{var S=e-+this._x.call(null,y.data),w=t-+this._y.call(null,y.data),M=n-+this._z.call(null,y.data),E=S*S+w*w+M*M;if(E{if(!h.length)do{const s=h.data;ih(e,t,n,this._x(s),this._y(s),this._z(s))<=r&&i.push(s)}while(h=h.next);return A>l||d>u||p>c||f=(l=(g+y)/2))?g=l:y=l,(A=a>=(u=(_+b)/2))?_=u:b=u,(d=o>=(c=(v+x)/2))?v=c:x=c,t=m,!(m=m[p=d<<2|A<<1|h]))return this;if(!m.length)break;(t[p+1&7]||t[p+2&7]||t[p+3&7]||t[p+4&7]||t[p+5&7]||t[p+6&7]||t[p+7&7])&&(n=t,f=p)}for(;m.data!==e;)if(r=m,!(m=m.next))return this;return(i=m.next)&&delete m.next,r?(i?r.next=i:delete r.next,this):t?(i?t[p]=i:delete t[p],(m=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&m===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!m.length&&(n?n[f]=m:this._root=m),this):(this._root=i,this)},hh.removeAll=function(e){for(var t=0,n=e.length;t=t&&(n=r=t):(n>t&&(n=t),r=s&&(n=r=s):(n>s&&(n=s),r0){for(s=e[--i];i>0&&(t=s,n=e[--i],s=t+n,r=n-(s-t),!r););i>0&&(r<0&&e[i-1]<0||r>0&&e[i-1]>0)&&(n=2*r,t=s+n,n==t-s&&(s=t))}return s}}const vh=Math.sqrt(50),yh=Math.sqrt(10),bh=Math.sqrt(2);function xh(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),a=s>=vh?10:s>=yh?5:s>=bh?2:1;let o,l,u;return i<0?(u=Math.pow(10,-i)/a,o=Math.round(e*u),l=Math.round(t*u),o/ut&&--l,u=-u):(u=Math.pow(10,i)*a,o=Math.round(e/u),l=Math.round(t/u),o*ut&&--l),l>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Xh(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Xh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Oh.exec(e))?new $h(t[1],t[2],t[3],1):(t=Bh.exec(e))?new $h(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Fh.exec(e))?Xh(t[1],t[2],t[3],t[4]):(t=kh.exec(e))?Xh(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=qh.exec(e))?tA(t[1],t[2]/100,t[3]/100,1):(t=Vh.exec(e))?tA(t[1],t[2]/100,t[3]/100,t[4]):zh.hasOwnProperty(e)?Wh(zh[e]):"transparent"===e?new $h(NaN,NaN,NaN,0):null}function Wh(e){return new $h(e>>16&255,e>>8&255,255&e,1)}function Xh(e,t,n,r){return r<=0&&(e=t=n=NaN),new $h(e,t,n,r)}function Qh(e,t,n,r){return 1===arguments.length?function(e){return e instanceof Rh||(e=jh(e)),e?new $h((e=e.rgb()).r,e.g,e.b,e.opacity):new $h}(e):new $h(e,t,n,null==r?1:r)}function $h(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Yh(){return`#${eA(this.r)}${eA(this.g)}${eA(this.b)}`}function Kh(){const e=Zh(this.opacity);return`${1===e?"rgb(":"rgba("}${Jh(this.r)}, ${Jh(this.g)}, ${Jh(this.b)}${1===e?")":`, ${e})`}`}function Zh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function eA(e){return((e=Jh(e))<16?"0":"")+e.toString(16)}function tA(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new rA(e,t,n,r)}function nA(e){if(e instanceof rA)return new rA(e.h,e.s,e.l,e.opacity);if(e instanceof Rh||(e=jh(e)),!e)return new rA;if(e instanceof rA)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),a=NaN,o=s-i,l=(s+i)/2;return o?(a=t===s?(n-r)/o+6*(n0&&l<1?0:a,new rA(a,o,l,e.opacity)}function rA(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function iA(e){return(e=(e||0)%360)<0?e+360:e}function sA(e){return Math.max(0,Math.min(1,e||0))}function aA(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Eh(Rh,jh,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Gh,formatHex:Gh,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return nA(this).formatHsl()},formatRgb:Hh,toString:Hh}),Eh($h,Qh,Ch(Rh,{brighter(e){return e=null==e?Ph:Math.pow(Ph,e),new $h(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Nh:Math.pow(Nh,e),new $h(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $h(Jh(this.r),Jh(this.g),Jh(this.b),Zh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Yh,formatHex:Yh,formatHex8:function(){return`#${eA(this.r)}${eA(this.g)}${eA(this.b)}${eA(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Kh,toString:Kh})),Eh(rA,function(e,t,n,r){return 1===arguments.length?nA(e):new rA(e,t,n,null==r?1:r)},Ch(Rh,{brighter(e){return e=null==e?Ph:Math.pow(Ph,e),new rA(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Nh:Math.pow(Nh,e),new rA(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new $h(aA(e>=240?e-240:e+120,i,r),aA(e,i,r),aA(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new rA(iA(this.h),sA(this.s),sA(this.l),Zh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Zh(this.opacity);return`${1===e?"hsl(":"hsla("}${iA(this.h)}, ${100*sA(this.s)}%, ${100*sA(this.l)}%${1===e?")":`, ${e})`}`}}));var oA=e=>()=>e;function lA(e){return 1===(e=+e)?uA:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):oA(isNaN(t)?n:t)}}function uA(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):oA(isNaN(e)?t:e)}var cA=function e(t){var n=lA(t);function r(e,t){var r=n((e=Qh(e)).r,(t=Qh(t)).r),i=n(e.g,t.g),s=n(e.b,t.b),a=uA(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=s(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1);function hA(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(s){for(n=0;ns&&(i=t.slice(s,i),o[a]?o[a]+=i:o[++a]=i),(n=n[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:mA(n,r)})),s=vA.lastIndex;return st&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}(a[0],a[e-1])),r=e>2?CA:EA,i=s=null,h}function h(t){return null==t||isNaN(t=+t)?n:(i||(i=r(a.map(e),o,l)))(e(u(t)))}return h.invert=function(n){return u(t((s||(s=r(o,a.map(e),mA)))(n)))},h.domain=function(e){return arguments.length?(a=Array.from(e,TA),c()):a.slice()},h.range=function(e){return arguments.length?(o=Array.from(e),c()):o.slice()},h.rangeRound=function(e){return o=Array.from(e),l=xA,c()},h.clamp=function(e){return arguments.length?(u=!!e||wA,c()):u!==wA},h.interpolate=function(e){return arguments.length?(l=e,c()):l},h.unknown=function(e){return arguments.length?(n=e,h):n},function(n,r){return e=n,t=r,c()}}function NA(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function PA(e){return(e=NA(Math.abs(e)))?e[1]:NaN}var DA,LA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function IA(e){if(!(t=LA.exec(e)))throw new Error("invalid format: "+e);var t;return new UA({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function UA(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function OA(e,t){var n=NA(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}IA.prototype=UA.prototype,UA.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var BA={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>OA(100*e,t),r:OA,s:function(e,t){var n=NA(e,t);if(!n)return e+"";var r=n[0],i=n[1],s=i-(DA=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return s===a?r:s>a?r+new Array(s-a+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+NA(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function FA(e){return e}var kA,qA,VA,zA=Array.prototype.map,GA=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function HA(e){var t,n,r=void 0===e.grouping||void 0===e.thousands?FA:(t=zA.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,s=[],a=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>r&&(o=Math.max(1,r-l)),s.push(e.substring(i-=o,i+o)),!((l+=o+1)>r));)o=t[a=(a+1)%t.length];return s.reverse().join(n)}),i=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",o=void 0===e.numerals?FA:function(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}(zA.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=IA(e)).fill,n=e.align,h=e.sign,A=e.symbol,d=e.zero,p=e.width,f=e.comma,m=e.precision,g=e.trim,_=e.type;"n"===_?(f=!0,_="g"):BA[_]||(void 0===m&&(m=12),g=!0,_="g"),(d||"0"===t&&"="===n)&&(d=!0,t="0",n="=");var v="$"===A?i:"#"===A&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",y="$"===A?s:/[%p]/.test(_)?l:"",b=BA[_],x=/[defgprs%]/.test(_);function T(e){var i,s,l,A=v,T=y;if("c"===_)T=b(e)+T,e="";else{var S=(e=+e)<0||1/e<0;if(e=isNaN(e)?c:b(Math.abs(e),m),g&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),S&&0===+e&&"+"!==h&&(S=!1),A=(S?"("===h?h:u:"-"===h||"("===h?"":h)+A,T=("s"===_?GA[8+DA/3]:"")+T+(S&&"("===h?")":""),x)for(i=-1,s=e.length;++i(l=e.charCodeAt(i))||l>57){T=(46===l?a+e.slice(i+1):e.slice(i))+T,e=e.slice(0,i);break}}f&&!d&&(e=r(e,1/0));var w=A.length+e.length+T.length,M=w>1)+A+e+T+M.slice(w);break;default:e=M+A+e+T}return o(e)}return m=void 0===m?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),T.toString=function(){return e+""},T}return{format:h,formatPrefix:function(e,t){var n=h(((e=IA(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(PA(t)/3))),i=Math.pow(10,-r),s=GA[8+r/3];return function(e){return n(i*e)+s}}}}function jA(e,t,n,r){var i,s=function(e,t,n){n=+n;const r=(t=+t)<(e=+e),i=r?Th(t,e,n):Th(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}(e,t,n);switch((r=IA(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(i=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(PA(t)/3)))-PA(Math.abs(e)))}(s,a))||(r.precision=i),VA(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,PA(t)-PA(e))+1}(s,Math.max(Math.abs(e),Math.abs(t))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(e){return Math.max(0,-PA(Math.abs(e)))}(s))||(r.precision=i-2*("%"===r.type))}return qA(r)}function WA(e){var t=e.domain;return e.ticks=function(e){var n=t();return function(e,t,n){if(!((n=+n)>0))return[];if((e=+e)===(t=+t))return[e];const r=t=i))return[];const o=s-i+1,l=new Array(o);if(r)if(a<0)for(let e=0;e0;){if((i=Th(l,u,n))===r)return s[a]=l,s[o]=u,t(s);if(i>0)l=Math.floor(l/i)*i,u=Math.ceil(u/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,u=Math.floor(u*i)/i}r=i}return e},e}function XA(){var e=RA()(wA,wA);return e.copy=function(){return t=e,XA().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},Mh.apply(e,arguments),WA(e)}function QA(){var e,t=0,n=1,r=1,i=[.5],s=[0,1];function a(t){return null!=t&&t<=t?s[mh(i,t,0,r)]:e}function o(){var e=-1;for(i=new Array(r);++e=r?[i[r-1],n]:[i[a-1],i[a]]},a.unknown=function(t){return arguments.length?(e=t,a):a},a.thresholds=function(){return i.slice()},a.copy=function(){return QA().domain([t,n]).range(s).unknown(e)},Mh.apply(WA(a),arguments)}kA=HA({thousands:",",grouping:[3],currency:["$",""]}),qA=kA.format,VA=kA.formatPrefix;var $A=1e-6,YA=1e-12,KA=Math.PI,ZA=KA/2,JA=KA/4,ed=2*KA,td=180/KA,nd=KA/180,rd=Math.abs,id=Math.atan,sd=Math.atan2,ad=Math.cos,od=Math.ceil,ld=Math.exp,ud=Math.hypot,cd=Math.log,hd=Math.sin,Ad=Math.sign||function(e){return e>0?1:e<0?-1:0},dd=Math.sqrt,pd=Math.tan;function fd(e){return e>1?ZA:e<-1?-ZA:Math.asin(e)}function md(e){return(e=hd(e/2))*e}function gd(){}function _d(e,t){e&&yd.hasOwnProperty(e.type)&&yd[e.type](e,t)}var vd={Feature:function(e,t){_d(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,s=ad(t=(t*=nd)/2+JA),a=hd(t),o=Cd*a,l=Ed*s+o*ad(i),u=o*r*hd(i);qd.add(sd(u,l)),Md=e,Ed=s,Cd=a}function Xd(e){return[sd(e[1],e[0]),fd(e[2])]}function Qd(e){var t=e[0],n=e[1],r=ad(n);return[r*ad(t),r*hd(t),hd(n)]}function $d(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Yd(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Kd(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Zd(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Jd(e){var t=dd(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var ep,tp,np,rp,ip,sp,ap,op,lp,up,cp,hp,Ap,dp,pp,fp,mp={point:gp,lineStart:vp,lineEnd:yp,polygonStart:function(){mp.point=bp,mp.lineStart=xp,mp.lineEnd=Tp,Bd=new _h,zd.polygonStart()},polygonEnd:function(){zd.polygonEnd(),mp.point=gp,mp.lineStart=vp,mp.lineEnd=yp,qd<0?(Rd=-(Pd=180),Nd=-(Dd=90)):Bd>$A?Dd=90:Bd<-1e-6&&(Nd=-90),kd[0]=Rd,kd[1]=Pd},sphere:function(){Rd=-(Pd=180),Nd=-(Dd=90)}};function gp(e,t){Fd.push(kd=[Rd=e,Pd=e]),tDd&&(Dd=t)}function _p(e,t){var n=Qd([e*nd,t*nd]);if(Od){var r=Yd(Od,n),i=Yd([r[1],-r[0],0],r);Jd(i),i=Xd(i);var s,a=e-Ld,o=a>0?1:-1,l=i[0]*td*o,u=rd(a)>180;u^(o*LdDd&&(Dd=s):u^(o*Ld<(l=(l+360)%360-180)&&lDd&&(Dd=t)),u?eSp(Rd,Pd)&&(Pd=e):Sp(e,Pd)>Sp(Rd,Pd)&&(Rd=e):Pd>=Rd?(ePd&&(Pd=e)):e>Ld?Sp(Rd,e)>Sp(Rd,Pd)&&(Pd=e):Sp(e,Pd)>Sp(Rd,Pd)&&(Rd=e)}else Fd.push(kd=[Rd=e,Pd=e]);tDd&&(Dd=t),Od=n,Ld=e}function vp(){mp.point=_p}function yp(){kd[0]=Rd,kd[1]=Pd,mp.point=gp,Od=null}function bp(e,t){if(Od){var n=e-Ld;Bd.add(rd(n)>180?n+(n>0?360:-360):n)}else Id=e,Ud=t;zd.point(e,t),_p(e,t)}function xp(){zd.lineStart()}function Tp(){bp(Id,Ud),zd.lineEnd(),rd(Bd)>$A&&(Rd=-(Pd=180)),kd[0]=Rd,kd[1]=Pd,Od=null}function Sp(e,t){return(t-=e)<0?t+360:t}function wp(e,t){return e[0]-t[0]}function Mp(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tSp(r[0],r[1])&&(r[1]=i[1]),Sp(i[0],r[1])>Sp(r[0],r[1])&&(r[0]=i[0])):s.push(r=i);for(a=-1/0,t=0,r=s[n=s.length-1];t<=n;r=i,++t)i=s[t],(o=Sp(r[1],i[0]))>a&&(a=o,Rd=i[0],Pd=r[1])}return Fd=kd=null,Rd===1/0||Nd===1/0?[[NaN,NaN],[NaN,NaN]]:[[Rd,Nd],[Pd,Dd]]}var Cp={sphere:gd,point:Rp,lineStart:Pp,lineEnd:Ip,polygonStart:function(){Cp.lineStart=Up,Cp.lineEnd=Op},polygonEnd:function(){Cp.lineStart=Pp,Cp.lineEnd=Ip}};function Rp(e,t){e*=nd;var n=ad(t*=nd);Np(n*ad(e),n*hd(e),hd(t))}function Np(e,t,n){++ep,np+=(e-np)/ep,rp+=(t-rp)/ep,ip+=(n-ip)/ep}function Pp(){Cp.point=Dp}function Dp(e,t){e*=nd;var n=ad(t*=nd);dp=n*ad(e),pp=n*hd(e),fp=hd(t),Cp.point=Lp,Np(dp,pp,fp)}function Lp(e,t){e*=nd;var n=ad(t*=nd),r=n*ad(e),i=n*hd(e),s=hd(t),a=sd(dd((a=pp*s-fp*i)*a+(a=fp*r-dp*s)*a+(a=dp*i-pp*r)*a),dp*r+pp*i+fp*s);tp+=a,sp+=a*(dp+(dp=r)),ap+=a*(pp+(pp=i)),op+=a*(fp+(fp=s)),Np(dp,pp,fp)}function Ip(){Cp.point=Rp}function Up(){Cp.point=Bp}function Op(){Fp(hp,Ap),Cp.point=Rp}function Bp(e,t){hp=e,Ap=t,e*=nd,t*=nd,Cp.point=Fp;var n=ad(t);dp=n*ad(e),pp=n*hd(e),fp=hd(t),Np(dp,pp,fp)}function Fp(e,t){e*=nd;var n=ad(t*=nd),r=n*ad(e),i=n*hd(e),s=hd(t),a=pp*s-fp*i,o=fp*r-dp*s,l=dp*i-pp*r,u=ud(a,o,l),c=fd(u),h=u&&-c/u;lp.add(h*a),up.add(h*o),cp.add(h*l),tp+=c,sp+=c*(dp+(dp=r)),ap+=c*(pp+(pp=i)),op+=c*(fp+(fp=s)),Np(dp,pp,fp)}function kp(e){ep=tp=np=rp=ip=sp=ap=op=0,lp=new _h,up=new _h,cp=new _h,Td(e,Cp);var t=+lp,n=+up,r=+cp,i=ud(t,n,r);return iKA&&(e-=Math.round(e/ed)*ed),[e,t]}function zp(e,t,n){return(e%=ed)?t||n?qp(Hp(e),jp(t,n)):Hp(e):t||n?jp(t,n):Vp}function Gp(e){return function(t,n){return rd(t+=e)>KA&&(t-=Math.round(t/ed)*ed),[t,n]}}function Hp(e){var t=Gp(e);return t.invert=Gp(-e),t}function jp(e,t){var n=ad(e),r=hd(e),i=ad(t),s=hd(t);function a(e,t){var a=ad(t),o=ad(e)*a,l=hd(e)*a,u=hd(t),c=u*n+o*r;return[sd(l*i-c*s,o*n-u*r),fd(c*i+l*s)]}return a.invert=function(e,t){var a=ad(t),o=ad(e)*a,l=hd(e)*a,u=hd(t),c=u*i-l*s;return[sd(l*i+u*s,o*n+c*r),fd(c*n-o*r)]},a}function Wp(e,t){(t=Qd(t))[0]-=e,Jd(t);var n=function(e){return e>1?0:e<-1?KA:Math.acos(e)}(-t[1]);return((-t[2]<0?-n:n)+ed-$A)%ed}function Xp(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:gd,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function Qp(e,t){return rd(e[0]-t[0])<$A&&rd(e[1]-t[1])<$A}function $p(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Yp(e,t,n,r,i){var s,a,o=[],l=[];if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n,r=e[0],a=e[t];if(Qp(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),s=0;s=0;--s)i.point((c=u[s])[0],c[1]);else r(A.x,A.p.x,-1,i);A=A.p}u=(A=A.o).z,d=!d}while(!A.v);i.lineEnd()}}}function Kp(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r=0?1:-1,M=w*S,E=M>KA,C=m*x;if(l.add(sd(C*w*hd(M),g*T+C*ad(M))),a+=E?S+w*ed:S,E^p>=n^y>=n){var R=Yd(Qd(d),Qd(v));Jd(R);var N=Yd(s,R);Jd(N);var P=(E^S>=0?-1:1)*fd(N[2]);(r>P||r===P&&(R[0]||R[1]))&&(o+=E^S>=0?1:-1)}}return(a<-1e-6||a<$A&&l<-1e-12)^1&o}function ef(e,t,n,r){return function(i){var s,a,o,l=t(i),u=Xp(),c=t(u),h=!1,A={point:d,lineStart:f,lineEnd:m,polygonStart:function(){A.point=g,A.lineStart=_,A.lineEnd=v,a=[],s=[]},polygonEnd:function(){A.point=d,A.lineStart=f,A.lineEnd=m,a=Sh(a);var e=Jp(s,r);a.length?(h||(i.polygonStart(),h=!0),Yp(a,nf,e,n,i)):e&&(h||(i.polygonStart(),h=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),h&&(i.polygonEnd(),h=!1),a=s=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(t,n){e(t,n)&&i.point(t,n)}function p(e,t){l.point(e,t)}function f(){A.point=p,l.lineStart()}function m(){A.point=d,l.lineEnd()}function g(e,t){o.push([e,t]),c.point(e,t)}function _(){c.lineStart(),o=[]}function v(){g(o[0][0],o[0][1]),c.lineEnd();var e,t,n,r,l=c.clean(),A=u.result(),d=A.length;if(o.pop(),s.push(o),o=null,d)if(1&l){if((t=(n=A[0]).length-1)>0){for(h||(i.polygonStart(),h=!0),i.lineStart(),e=0;e1&&2&l&&A.push(A.pop().concat(A.shift())),a.push(A.filter(tf))}return A}}function tf(e){return e.length>1}function nf(e,t){return((e=e.x)[0]<0?e[1]-ZA-$A:ZA-e[1])-((t=t.x)[0]<0?t[1]-ZA-$A:ZA-t[1])}Vp.invert=Vp;var rf=ef(function(){return!0},function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(s,a){var o=s>0?KA:-KA,l=rd(s-n);rd(l-KA)<$A?(e.point(n,r=(r+a)/2>0?ZA:-ZA),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(o,r),e.point(s,r),t=0):i!==o&&l>=KA&&(rd(n-i)<$A&&(n-=i*$A),rd(s-o)<$A&&(s-=o*$A),r=function(e,t,n,r){var i,s,a=hd(e-n);return rd(a)>$A?id((hd(t)*(s=ad(r))*hd(n)-hd(r)*(i=ad(t))*hd(e))/(i*s*a)):(t+r)/2}(n,r,s,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(o,r),t=0),e.point(n=s,r=a),i=o},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}},function(e,t,n,r){var i;if(null==e)i=n*ZA,r.point(-KA,i),r.point(0,i),r.point(KA,i),r.point(KA,0),r.point(KA,-i),r.point(0,-i),r.point(-KA,-i),r.point(-KA,0),r.point(-KA,i);else if(rd(e[0]-t[0])>$A){var s=e[0]0,i=rd(t)>$A;function s(e,n){return ad(e)*ad(n)>t}function a(e,n,r){var i=[1,0,0],s=Yd(Qd(e),Qd(n)),a=$d(s,s),o=s[0],l=a-o*o;if(!l)return!r&&e;var u=t*a/l,c=-t*o/l,h=Yd(i,s),A=Zd(i,u);Kd(A,Zd(s,c));var d=h,p=$d(A,d),f=$d(d,d),m=p*p-f*($d(A,A)-1);if(!(m<0)){var g=dd(m),_=Zd(d,(-p-g)/f);if(Kd(_,A),_=Xd(_),!r)return _;var v,y=e[0],b=n[0],x=e[1],T=n[1];b0^_[1]<(rd(_[0]-y)<$A?x:T):x<=_[1]&&_[1]<=T:S>KA^(y<=_[0]&&_[0]<=b)){var M=Zd(d,(-p+g)/f);return Kd(M,A),[_,Xd(M)]}}}function o(t,n){var i=r?e:KA-e,s=0;return t<-i?s|=1:t>i&&(s|=2),n<-i?s|=4:n>i&&(s|=8),s}return ef(s,function(e){var t,n,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,A){var d,p=[h,A],f=s(h,A),m=r?f?0:o(h,A):f?o(h+(h<0?KA:-KA),A):0;if(!t&&(u=l=f)&&e.lineStart(),f!==l&&(!(d=a(t,p))||Qp(t,d)||Qp(p,d))&&(p[2]=1),f!==l)c=0,f?(e.lineStart(),d=a(p,t),e.point(d[0],d[1])):(d=a(t,p),e.point(d[0],d[1],2),e.lineEnd()),t=d;else if(i&&t&&r^f){var g;m&n||!(g=a(p,t,!0))||(c=0,r?(e.lineStart(),e.point(g[0][0],g[0][1]),e.point(g[1][0],g[1][1]),e.lineEnd()):(e.point(g[1][0],g[1][1]),e.lineEnd(),e.lineStart(),e.point(g[0][0],g[0][1],3)))}!f||t&&Qp(t,p)||e.point(p[0],p[1]),t=p,l=f,n=m},lineEnd:function(){l&&e.lineEnd(),t=null},clean:function(){return c|(u&&l)<<1}}},function(t,r,i,s){!function(e,t,n,r,i,s){if(n){var a=ad(t),o=hd(t),l=r*n;null==i?(i=t+r*ed,s=t-l/2):(i=Wp(a,i),s=Wp(a,s),(r>0?is)&&(i+=r*ed));for(var u,c=i;r>0?c>s:c0)do{u.point(0===c||3===c?e:n,c>1?r:t)}while((c=(c+o+4)%4)!==h);else u.point(s[0],s[1])}function a(r,i){return rd(r[0]-e)<$A?i>0?0:3:rd(r[0]-n)<$A?i>0?2:1:rd(r[1]-t)<$A?i>0?1:0:i>0?3:2}function o(e,t){return l(e.x,t.x)}function l(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var l,u,c,h,A,d,p,f,m,g,_,v=a,y=Xp(),b={point:x,lineStart:function(){b.point=T,u&&u.push(c=[]);g=!0,m=!1,p=f=NaN},lineEnd:function(){l&&(T(h,A),d&&m&&y.rejoin(),l.push(y.result()));b.point=x,m&&v.lineEnd()},polygonStart:function(){v=y,l=[],u=[],_=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=u.length;nr&&(A-s)*(r-a)>(d-a)*(e-s)&&++t:d<=r&&(A-s)*(r-a)<(d-a)*(e-s)&&--t;return t}(),n=_&&t,i=(l=Sh(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),i&&Yp(l,o,t,s,a),a.polygonEnd());v=a,l=u=c=null}};function x(e,t){i(e,t)&&v.point(e,t)}function T(s,a){var o=i(s,a);if(u&&c.push([s,a]),g)h=s,A=a,d=o,g=!1,o&&(v.lineStart(),v.point(s,a));else if(o&&m)v.point(s,a);else{var l=[p=Math.max(hf,Math.min(cf,p)),f=Math.max(hf,Math.min(cf,f))],y=[s=Math.max(hf,Math.min(cf,s)),a=Math.max(hf,Math.min(cf,a))];!function(e,t,n,r,i,s){var a,o=e[0],l=e[1],u=0,c=1,h=t[0]-o,A=t[1]-l;if(a=n-o,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=i-o,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>u&&(u=a)}else if(h>0){if(a0)){if(a/=A,A<0){if(a0){if(a>c)return;a>u&&(u=a)}if(a=s-l,A||!(a<0)){if(a/=A,A<0){if(a>c)return;a>u&&(u=a)}else if(A>0){if(a0&&(e[0]=o+u*h,e[1]=l+u*A),c<1&&(t[0]=o+c*h,t[1]=l+c*A),!0}}}}}(l,y,e,t,n,r)?o&&(v.lineStart(),v.point(s,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(y[0],y[1]),o||v.lineEnd(),_=!1)}p=s,f=a,m=o}return b}}var df={sphere:gd,point:gd,lineStart:function(){df.point=ff,df.lineEnd=pf},lineEnd:gd,polygonStart:gd,polygonEnd:gd};function pf(){df.point=df.lineEnd=gd}function ff(e,t){of=e*=nd,lf=hd(t*=nd),uf=ad(t),df.point=mf}function mf(e,t){e*=nd;var n=hd(t*=nd),r=ad(t),i=rd(e-of),s=ad(i),a=r*hd(i),o=uf*n-lf*r*s,l=lf*n+uf*r*s;af.add(sd(dd(a*a+o*o),l)),of=e,lf=n,uf=r}var gf=[null,null],_f={type:"LineString",coordinates:gf};function vf(e,t){return gf[0]=e,gf[1]=t,function(e){return af=new _h,Td(e,df),+af}(_f)}var yf={Feature:function(e,t){return xf(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r0&&(i=vf(e[s],e[s-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))$A}).map(l)).concat(wh(od(s/d)*d,i,d).filter(function(e){return rd(e%f)>$A}).map(u))}return g.lines=function(){return _().map(function(e){return{type:"LineString",coordinates:e}})},g.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(h(a).slice(1),c(n).reverse().slice(1),h(o).reverse().slice(1))]}},g.extent=function(e){return arguments.length?g.extentMajor(e).extentMinor(e):g.extentMinor()},g.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],o=+e[0][1],a=+e[1][1],r>n&&(e=r,r=n,n=e),o>a&&(e=o,o=a,a=e),g.precision(m)):[[r,o],[n,a]]},g.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],s=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),s>i&&(n=s,s=i,i=n),g.precision(m)):[[t,s],[e,i]]},g.step=function(e){return arguments.length?g.stepMajor(e).stepMinor(e):g.stepMinor()},g.stepMajor=function(e){return arguments.length?(p=+e[0],f=+e[1],g):[p,f]},g.stepMinor=function(e){return arguments.length?(A=+e[0],d=+e[1],g):[A,d]},g.precision=function(A){return arguments.length?(m=+A,l=Cf(s,i,90),u=Rf(t,e,m),c=Cf(o,a,90),h=Rf(r,n,m),g):m},g.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()()}function Pf(e,t){var n=e[0]*nd,r=e[1]*nd,i=t[0]*nd,s=t[1]*nd,a=ad(r),o=hd(r),l=ad(s),u=hd(s),c=a*ad(n),h=a*hd(n),A=l*ad(i),d=l*hd(i),p=2*fd(dd(md(s-r)+a*l*md(i-n))),f=hd(p),m=p?function(e){var t=hd(e*=p)/f,n=hd(p-e)/f,r=n*c+t*A,i=n*h+t*d,s=n*o+t*u;return[sd(i,r)*td,sd(s,dd(r*r+i*i))*td]}:function(){return[n*td,r*td]};return m.distance=p,m}var Df=e=>e,Lf=1/0,If=Lf,Uf=-Lf,Of=Uf,Bf={point:function(e,t){eUf&&(Uf=e);tOf&&(Of=t)},lineStart:gd,lineEnd:gd,polygonStart:gd,polygonEnd:gd,result:function(){var e=[[Lf,If],[Uf,Of]];return Uf=Of=-(If=Lf=1/0),e}};function Ff(e){return function(t){var n=new kf;for(var r in e)n[r]=e[r];return n.stream=t,n}}function kf(){}function qf(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),Td(n,e.stream(Bf)),t(Bf.result()),null!=r&&e.clipExtent(r),e}function Vf(e,t,n){return qf(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],s=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-s*(n[1][0]+n[0][0]))/2,o=+t[0][1]+(i-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([a,o])},n)}kf.prototype={constructor:kf,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var zf=ad(30*nd);function Gf(e,t){return+t?function(e,t){function n(r,i,s,a,o,l,u,c,h,A,d,p,f,m){var g=u-r,_=c-i,v=g*g+_*_;if(v>4*t&&f--){var y=a+A,b=o+d,x=l+p,T=dd(y*y+b*b+x*x),S=fd(x/=T),w=rd(rd(x)-1)<$A||rd(s-h)<$A?(s+h)/2:sd(b,y),M=e(w,S),E=M[0],C=M[1],R=E-r,N=C-i,P=_*R-g*N;(P*P/v>t||rd((g*R+_*N)/v-.5)>.3||a*A+o*d+l*p2?e[2]%360*nd:0,R()):[m*td,g*td,_*td]},E.angle=function(e){return arguments.length?(v=e%360*nd,R()):v*td},E.reflectX=function(e){return arguments.length?(y=e?-1:1,R()):y<0},E.reflectY=function(e){return arguments.length?(b=e?-1:1,R()):b<0},E.precision=function(e){return arguments.length?(a=Gf(o,M=e*e),N()):dd(M)},E.fitExtent=function(e,t){return Vf(E,e,t)},E.fitSize=function(e,t){return function(e,t,n){return Vf(e,[[0,0],t],n)}(E,e,t)},E.fitWidth=function(e,t){return function(e,t,n){return qf(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),s=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([s,a])},n)}(E,e,t)},E.fitHeight=function(e,t){return function(e,t,n){return qf(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),s=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([s,a])},n)}(E,e,t)},function(){return t=e.apply(this,arguments),E.invert=t.invert&&C,R()}}(function(){return e})()}function Xf(e,t){return[e,cd(pd((ZA+t)/2))]}function Qf(e,t){var n=ad(t),r=1+ad(e)*n;return[n*hd(e)/r,hd(t)/r]}function $f(){return Wf(Qf).scale(250).clipAngle(142)}function Yf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,a=[],o=Math.pow(2,e),l=360/o,u=180/o,c=void 0===i?o-1:i,h=void 0===s?o-1:s,A=n,d=Math.min(o-1,c);A<=d;A++)for(var p=r,f=Math.min(o-1,h);p<=f;p++){var m=p,g=u;if(t)m=0===p?p:vm(p/o)*o,g=180*((p+1===o?p+1:vm((p+1)/o)*o)-m)/o;var _=(A+.5)*l-180,v=90-(180*m/o+g/2),y=g;a.push({x:A,y:p,lng:_,lat:v,latLen:y})}return a},xm=new WeakMap,Tm=new WeakMap,Sm=new WeakMap,wm=new WeakMap,Mm=new WeakMap,Em=new WeakMap,Cm=new WeakMap,Rm=new WeakMap,Nm=new WeakSet,Pm=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.tileUrl,s=r.minLevel,a=void 0===s?0:s,o=r.maxLevel,l=void 0===o?17:o,u=r.mercatorProjection,c=void 0===u||u;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){Jf(e,t),t.add(e)}(n=Zf(this,t),Nm),tm(n,xm,void 0),tm(n,Tm,void 0),tm(n,Sm,void 0),tm(n,wm,void 0),tm(n,Mm,{}),tm(n,Em,void 0),tm(n,Cm,void 0),tm(n,Rm,void 0),im(n,"minLevel",void 0),im(n,"maxLevel",void 0),im(n,"thresholds",um(new Array(30)).map(function(e,t){return 8/Math.pow(2,t)})),im(n,"curvatureResolution",5),im(n,"tileMargin",0),im(n,"clearTiles",function(){Object.values(em(Mm,n)).forEach(function(e){e.forEach(function(e){e.obj&&(n.remove(e.obj),pm(e.obj),delete e.obj)})}),nm(Mm,n,{})}),nm(xm,n,e),n.tileUrl=i,nm(Tm,n,c),n.minLevel=a,n.maxLevel=l,n.level=0,n.add(nm(Rm,n,new _i(new wa(.99*em(xm,n),180,90),new qr({color:0})))),em(Rm,n).visible=!1,em(Rm,n).material.polygonOffset=!0,em(Rm,n).material.polygonOffsetUnits=3,em(Rm,n).material.polygonOffsetFactor=1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&om(e,t)}(t,e),rm(t,[{key:"tileUrl",get:function(){return em(Sm,this)},set:function(e){nm(Sm,this,e),this.updatePov(em(Cm,this))}},{key:"level",get:function(){return em(wm,this)},set:function(e){var t,n=this;em(Mm,this)[e]||Kf(Nm,this,Dm).call(this,e);var r=em(wm,this);if(nm(wm,this,e),e!==r&&void 0!==r){if(em(Rm,this).visible=e>0,em(Mm,this)[e].forEach(function(e){return e.obj&&(e.obj.material.depthWrite=!0)}),re)for(var i=e+1;i<=r;i++)em(Mm,this)[i]&&em(Mm,this)[i].forEach(function(e){e.obj&&(n.remove(e.obj),pm(e.obj),delete e.obj)});Kf(Nm,this,Lm).call(this)}}},{key:"updatePov",value:function(e){var t,n=this;if(e&&e instanceof Mi&&(nm(Cm,this,e),nm(Em,this,function(r){if(!r.hullPnts){var i=360/Math.pow(2,n.level),s=r.lng,a=r.lat,o=r.latLen,l=s-i/2,u=s+i/2,c=a-o/2,h=a+o/2;r.hullPnts=[[a,s],[c,l],[h,l],[c,u],[h,u]].map(function(e){var t=lm(e,2);return fm(t[0],t[1],em(xm,n))}).map(function(e){var t=e.x,n=e.y,r=e.z;return new Wt(t,n,r)})}return t||(t=new Zi,e.updateMatrix(),e.updateMatrixWorld(),t.setFromProjectionMatrix((new Hn).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse))),r.hullPnts.some(function(e){return t.containsPoint(e.clone().applyMatrix4(n.matrixWorld))})}),this.tileUrl)){var r=(e.position.clone().distanceTo(this.getWorldPosition(new Wt))-em(xm,this))/em(xm,this),i=this.thresholds.findIndex(function(e){return e&&e<=r});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,i<0?this.thresholds.length:i)),Kf(Nm,this,Lm).call(this)}}}])}(Ui);function Dm(e){var t=this;if(e>7)em(Mm,this)[e]=[];else{var n=em(Mm,this)[e]=bm(e,em(Tm,this));n.forEach(function(e){return e.centroid=fm(e.lat,e.lng,em(xm,t))}),n.octree=lh().x(function(e){return e.centroid.x}).y(function(e){return e.centroid.y}).z(function(e){return e.centroid.z}).addAll(n)}}function Lm(){var e=this;if(this.tileUrl&&void 0!==this.level&&em(Mm,this).hasOwnProperty(this.level)&&(em(Em,this)||!(this.level>6))){var t=em(Mm,this)[this.level];if(em(Cm,this)){var n=this.worldToLocal(em(Cm,this).position.clone());if(t.octree){var r,i=this.worldToLocal(em(Cm,this).position.clone()),s=3*(i.length()-em(xm,this));t=(r=t.octree).findAllWithinRadius.apply(r,um(i).concat([s]))}else{var a=function(e){var t=e.x,n=e.y,r=e.z,i=Math.sqrt(t*t+n*n+r*r),s=Math.acos(n/i),a=Math.atan2(r,t);return{lat:90-180*s/Math.PI,lng:90-180*a/Math.PI-(a<-Math.PI/2?360:0),r:i}}(n),o=90*(a.r/em(xm,this)-1),l=o/Math.cos(mm(a.lat)),u=[a.lng-l,a.lng+l],c=[a.lat+o,a.lat-o],h=lm(ym(this.level,em(Tm,this),u[0],c[0]),2),A=h[0],d=h[1],p=lm(ym(this.level,em(Tm,this),u[1],c[1]),2),f=p[0],m=p[1];!t.record&&(t.record={});var g=t.record;if(g.hasOwnProperty("".concat(Math.round((A+f)/2),"_").concat(Math.round((d+m)/2)))){for(var _=[],v=A;v<=f;v++)for(var y=d;y<=m;y++){var b="".concat(v,"_").concat(y);g.hasOwnProperty(b)||(g[b]=bm(this.level,em(Tm,this),v,y,v,y)[0],t.push(g[b])),_.push(g[b])}t=_}else t=bm(this.level,em(Tm,this),A,d,f,m).map(function(e){var n="".concat(e.x,"_").concat(e.y);return g.hasOwnProperty(n)?g[n]:(g[n]=e,t.push(e),e)})}}t.filter(function(e){return!e.obj}).filter(em(Em,this)||function(){return!0}).forEach(function(t){var n=t.x,r=t.y,i=t.lng,s=t.lat,a=t.latLen,o=360/Math.pow(2,e.level);if(!t.obj){var l=o*(1-e.tileMargin),u=a*(1-e.tileMargin),c=mm(i),h=mm(-s),A=new _i(new wa(em(xm,e),Math.ceil(l/e.curvatureResolution),Math.ceil(u/e.curvatureResolution),mm(90-l/2)+c,mm(l),mm(90-u/2)+h,mm(u)),new Ua);if(em(Tm,e)){var d=lm([s+a/2,s-a/2].map(function(e){return.5-e/180}),2),p=d[0],f=d[1];!function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=XA().domain([1,0]).range([t,n]).clamp(!0),i=XA().domain([_m(t),_m(n)]).range([1,0]).clamp(!0),s=function(e){return i(_m(r(e)))},a=e.array,o=0,l=a.length;o80*n){o=e[0],l=e[1];let t=o,r=l;for(let s=n;st&&(t=n),i>r&&(r=i)}u=Math.max(t-o,r-l),u=0!==u?32767/u:0}return Bm(s,a,n,o,l,u,0),a}function Um(e,t,n,r,i){let s;if(i===function(e,t,n,r){let i=0;for(let s=t,a=n-r;s0)for(let i=t;i=t;i-=r)s=rg(i/r|0,e[i],e[i+1],s);return s&&Km(s,s.next)&&(ig(s),s=s.next),s}function Om(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!Km(r,r.next)&&0!==Ym(r.prev,r,r.next))r=r.next;else{if(ig(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function Bm(e,t,n,r,i,s,a){if(!e)return;!a&&s&&function(e,t,n,r){let i=e;do{0===i.z&&(i.z=jm(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let s=null;for(t=0;i;){t++;let a=i,o=0;for(let e=0;e0||l>0&&a;)0!==o&&(0===l||!a||i.z<=a.z)?(r=i,i=i.nextZ,o--):(r=a,a=a.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;i=a}s.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,s);let o=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(s?km(e,r,i,s):Fm(e))t.push(l.i,e.i,u.i),ig(e),e=u.next,o=u.next;else if((e=u)===o){a?1===a?Bm(e=qm(Om(e),t),t,n,r,i,s,2):2===a&&Vm(e,t,n,r,i,s):Bm(Om(e),t,n,r,i,s,1);break}}}function Fm(e){const t=e.prev,n=e,r=e.next;if(Ym(t,n,r)>=0)return!1;const i=t.x,s=n.x,a=r.x,o=t.y,l=n.y,u=r.y,c=Math.min(i,s,a),h=Math.min(o,l,u),A=Math.max(i,s,a),d=Math.max(o,l,u);let p=r.next;for(;p!==t;){if(p.x>=c&&p.x<=A&&p.y>=h&&p.y<=d&&Qm(i,o,s,l,a,u,p.x,p.y)&&Ym(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function km(e,t,n,r){const i=e.prev,s=e,a=e.next;if(Ym(i,s,a)>=0)return!1;const o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,A=a.y,d=Math.min(o,l,u),p=Math.min(c,h,A),f=Math.max(o,l,u),m=Math.max(c,h,A),g=jm(d,p,t,n,r),_=jm(f,m,t,n,r);let v=e.prevZ,y=e.nextZ;for(;v&&v.z>=g&&y&&y.z<=_;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==i&&v!==a&&Qm(o,c,l,h,u,A,v.x,v.y)&&Ym(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&Qm(o,c,l,h,u,A,y.x,y.y)&&Ym(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=f&&v.y>=p&&v.y<=m&&v!==i&&v!==a&&Qm(o,c,l,h,u,A,v.x,v.y)&&Ym(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;y&&y.z<=_;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==i&&y!==a&&Qm(o,c,l,h,u,A,y.x,y.y)&&Ym(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function qm(e,t){let n=e;do{const r=n.prev,i=n.next.next;!Km(r,i)&&Zm(r,n,n.next,i)&&tg(r,i)&&tg(i,r)&&(t.push(r.i,n.i,i.i),ig(n),ig(n.next),n=e=i),n=n.next}while(n!==e);return Om(n)}function Vm(e,t,n,r,i,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&$m(a,e)){let o=ng(a,e);return a=Om(a,a.next),o=Om(o,o.next),Bm(a,t,n,r,i,s,0),void Bm(o,t,n,r,i,s,0)}e=e.next}a=a.next}while(a!==e)}function zm(e,t){let n=e.x-t.x;if(0===n&&(n=e.y-t.y,0===n)){n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}return n}function Gm(e,t){const n=function(e,t){let n=t;const r=e.x,i=e.y;let s,a=-1/0;if(Km(e,n))return n;do{if(Km(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,s=n.x=n.x&&n.x>=l&&r!==n.x&&Xm(is.x||n.x===s.x&&Hm(s,n)))&&(s=n,c=t)}n=n.next}while(n!==o);return s}(e,t);if(!n)return t;const r=ng(n,e);return Om(r,r.next),Om(n,n.next)}function Hm(e,t){return Ym(e.prev,e,t.prev)<0&&Ym(t.next,e,e.next)<0}function jm(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Wm(e){let t=e,n=e;do{(t.x=(e-a)*(s-o)&&(e-a)*(r-o)>=(n-a)*(t-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function Qm(e,t,n,r,i,s,a,o){return!(e===a&&t===o)&&Xm(e,t,n,r,i,s,a,o)}function $m(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Zm(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(tg(e,t)&&tg(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Ym(e.prev,e,t.prev)||Ym(e,t.prev,t))||Km(e,t)&&Ym(e.prev,e,e.next)>0&&Ym(t.prev,t,t.next)>0)}function Ym(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Km(e,t){return e.x===t.x&&e.y===t.y}function Zm(e,t,n,r){const i=eg(Ym(e,t,n)),s=eg(Ym(e,t,r)),a=eg(Ym(n,r,e)),o=eg(Ym(n,r,t));return i!==s&&a!==o||(!(0!==i||!Jm(e,n,t))||(!(0!==s||!Jm(e,r,t))||(!(0!==a||!Jm(n,e,r))||!(0!==o||!Jm(n,t,r)))))}function Jm(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function eg(e){return e>0?1:e<0?-1:0}function tg(e,t){return Ym(e.prev,e,e.next)<0?Ym(e,t,e.next)>=0&&Ym(e,e.prev,t)>=0:Ym(e,t,e.prev)<0||Ym(e,e.next,t)<0}function ng(e,t){const n=sg(e.i,e.x,e.y),r=sg(t.i,t.x,t.y),i=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function rg(e,t,n,r){const i=sg(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ig(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function sg(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ag(e){const t=[],n=[],r=e[0][0].length;let i=0,s=0;for(const a of e){for(const e of a)for(let n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:1,t=[],n=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(r){if(n){var i=180*vf(r,n)/Math.PI;if(i>e)for(var s=Pf(n,r),a=n.length>2||r.length>2?mA(n[2]||0,r[2]||0):null,o=a?function(e){return[].concat(dg(s(e)),[a(e)])}:s,l=1/Math.ceil(i/e),u=l;u<1;)t.push(o(u)),u+=l}t.push(n=r)}),t},mg="undefined"!=typeof window&&window.THREE?window.THREE:{BufferGeometry:ai,Float32BufferAttribute:Zr},gg=(new mg.BufferGeometry).setAttribute?"setAttribute":"addAttribute",_g=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=lg(this,t)).type="GeoJsonGeometry",n.parameters={geoJson:e,radius:r,resolution:i};var s=({Point:u,MultiPoint:function(e,t){var n={vertices:[],indices:[]};return e.map(function(e){return u(e,t)}).forEach(function(e){var t=Ag(e,1)[0];vg(n,t)}),[n]},LineString:c,MultiLineString:function(e,t){var n={vertices:[],indices:[]};return e.map(function(e){return c(e,t)}).forEach(function(e){var t=Ag(e,1)[0];vg(n,t)}),[n]},Polygon:h,MultiPolygon:function(e,t){var n={vertices:[],indices:[]},r={vertices:[],indices:[]};e.map(function(e){return h(e,t)}).forEach(function(e){var t=Ag(e,2),i=t[0],s=t[1];vg(n,i),s&&vg(r,s)});var i=[n];return r.vertices.length&&i.push(r),i}}[e.type]||function(){return[]})(e.coordinates,r),a=[],o=[],l=0;function u(e,t){return[{vertices:bg(e[1],e[0],t+(e[2]||0)),indices:[]}]}function c(e,t){for(var n=ag([fg(e,i).map(function(e){var n=Ag(e,3),r=n[0],i=n[1],s=n[2];return bg(i,r,t+(void 0===s?0:s))})]).vertices,r=Math.round(n.length/3),s=[],a=1;a=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;e.push(i)}}catch(e){r.e(e)}finally{r.f()}}function bg(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}function xg(e){let t,n,r,i=-1,s=0;for(let a=0;a=2&&a.setY(t,e.getY(t)),r>=3&&a.setZ(t,e.getZ(t)),r>=4&&a.setW(t,e.getW(t));return a}var Sg=Object.freeze({__proto__:null,computeMikkTSpaceTangents:function(e,t,n=!0){if(!t||!t.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!e.hasAttribute("position")||!e.hasAttribute("normal")||!e.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function r(e){if(e.normalized||e.isInterleavedBufferAttribute){const t=new Float32Array(e.count*e.itemSize);for(let n=0,r=0;n2&&(t[r++]=e.getZ(n));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const i=e.index?e.toNonIndexed():e,s=t.generateTangents(r(i.attributes.position),r(i.attributes.normal),r(i.attributes.uv));if(n)for(let e=3;ee.materialIndex!==t.materialIndex?e.materialIndex-t.materialIndex:e.start-t.start),null===e.getIndex()){const t=e.getAttribute("position"),n=[];for(let e=0;e{const r=new e.array.constructor(e.count*e.itemSize);u[n][t]=new e.constructor(r,e.itemSize,e.normalized)}))}const d=.5*t,p=Math.log10(1/t),f=Math.pow(10,p),m=d*f;for(let t=0;tn&&l.add(t)}l.normalize(),p.setXYZ(t+e,l.x,l.y,l.z)}}return c.setAttribute("normal",p),c},toTrianglesDrawMode:function(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(e=$g(e,360),t=$g(t,100),n=$g(n,100),0===t)r=i=s=n;else{var o=n<.5?n*(1+t):n+t-n*t,l=2*n-o;r=a(l,o,e+1/3),i=a(l,o,e),s=a(l,o,e-1/3)}return{r:255*r,g:255*i,b:255*s}}(e.h,r,s),a=!0,o="hsl"),e.hasOwnProperty("a")&&(n=e.a));return n=Qg(n),{ok:a,format:e.format||o,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}function Ng(e,t,n){e=$g(e,255),t=$g(t,255),n=$g(n,255);var r,i,s=Math.max(e,t,n),a=Math.min(e,t,n),o=(s+a)/2;if(s==a)r=i=0;else{var l=s-a;switch(i=o>.5?l/(2-s-a):l/(s+a),s){case e:r=(t-n)/l+(t>1)+720)%360;--t;)r.h=(r.h+i)%360,s.push(Rg(r));return s}function jg(e,t){t=t||6;for(var n=Rg(e).toHsv(),r=n.h,i=n.s,s=n.v,a=[],o=1/t;t--;)a.push(Rg({h:r,s:i,v:s})),s=(s+o)%1;return a}Rg.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,n,r=this.toRgb();return e=r.r/255,t=r.g/255,n=r.b/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=Qg(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=Pg(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=Pg(this._r,this._g,this._b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=Ng(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=Ng(this._r,this._g,this._b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return Dg(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,n,r,i){var s=[Zg(Math.round(e).toString(16)),Zg(Math.round(t).toString(16)),Zg(Math.round(n).toString(16)),Zg(e_(r))];if(i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1))return s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0);return s.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*$g(this._r,255))+"%",g:Math.round(100*$g(this._g,255))+"%",b:Math.round(100*$g(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*$g(this._r,255))+"%, "+Math.round(100*$g(this._g,255))+"%, "+Math.round(100*$g(this._b,255))+"%)":"rgba("+Math.round(100*$g(this._r,255))+"%, "+Math.round(100*$g(this._g,255))+"%, "+Math.round(100*$g(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(Xg[Dg(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+Lg(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var i=Rg(e);n="#"+Lg(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return Rg(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(Bg,arguments)},brighten:function(){return this._applyModification(Fg,arguments)},darken:function(){return this._applyModification(kg,arguments)},desaturate:function(){return this._applyModification(Ig,arguments)},saturate:function(){return this._applyModification(Ug,arguments)},greyscale:function(){return this._applyModification(Og,arguments)},spin:function(){return this._applyModification(qg,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Hg,arguments)},complement:function(){return this._applyCombination(Vg,arguments)},monochromatic:function(){return this._applyCombination(jg,arguments)},splitcomplement:function(){return this._applyCombination(Gg,arguments)},triad:function(){return this._applyCombination(zg,[3])},tetrad:function(){return this._applyCombination(zg,[4])}},Rg.fromRatio=function(e,t){if("object"==Mg(e)){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:Jg(e[r]));e=n}return Rg(e,t)},Rg.equals=function(e,t){return!(!e||!t)&&Rg(e).toRgbString()==Rg(t).toRgbString()},Rg.random=function(){return Rg.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},Rg.mix=function(e,t,n){n=0===n?0:n||50;var r=Rg(e).toRgb(),i=Rg(t).toRgb(),s=n/100;return Rg({r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a})}, +// =4.5;break;case"AAlarge":i=s>=3;break;case"AAAsmall":i=s>=7}return i},Rg.mostReadable=function(e,t,n){var r,i,s,a,o=null,l=0;i=(n=n||{}).includeFallbackColors,s=n.level,a=n.size;for(var u=0;ul&&(l=r,o=Rg(t[u]));return Rg.isReadable(e,o,{level:s,size:a})||!i?o:(n.includeFallbackColors=!1,Rg.mostReadable(e,["#fff","#000"],n))};var Wg=Rg.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Xg=Rg.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(Wg);function Qg(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function $g(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Yg(e){return Math.min(1,Math.max(0,e))}function Kg(e){return parseInt(e,16)}function Zg(e){return 1==e.length?"0"+e:""+e}function Jg(e){return e<=1&&(e=100*e+"%"),e}function e_(e){return Math.round(255*parseFloat(e)).toString(16)}function t_(e){return Kg(e)/255}var n_,r_,i_,s_=(r_="[\\s|\\(]+("+(n_="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+n_+")[,|\\s]+("+n_+")\\s*\\)?",i_="[\\s|\\(]+("+n_+")[,|\\s]+("+n_+")[,|\\s]+("+n_+")[,|\\s]+("+n_+")\\s*\\)?",{CSS_UNIT:new RegExp(n_),rgb:new RegExp("rgb"+r_),rgba:new RegExp("rgba"+i_),hsl:new RegExp("hsl"+r_),hsla:new RegExp("hsla"+i_),hsv:new RegExp("hsv"+r_),hsva:new RegExp("hsva"+i_),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function a_(e){return!!s_.CSS_UNIT.exec(e)}function o_(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},e.prototype.update=function(e,t){void 0===t&&(t=!0),this._currentTick++,this._currentTime+=e,this._tickDeltaTime=e,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),t&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},e.prototype.getTimer=function(){return Date.now()},e}();Object.defineProperty(t,"__esModule",{value:!0}),t.default=i},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t){var n=function(){function e(){this.functions=[]}return e.prototype.add=function(e){return-1===this.functions.indexOf(e)&&(this.functions.push(e),!0)},e.prototype.remove=function(e){var t=this.functions.indexOf(e);return t>-1&&(this.functions.splice(t,1),!0)},e.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},e.prototype.dispatch=function(){for(var e=[],t=0;tu==c>-u?(s=u,u=t[++h]):(s=c,c=r[++A]);let d=0;if(hu==c>-u?(a=u+s,o=s-(a-u),u=t[++h]):(a=c+s,o=s-(a-c),c=r[++A]),s=a,0!==o&&(i[d++]=o);hu==c>-u?(a=s+u,l=a-s,o=s-(a-l)+(u-l),u=t[++h]):(a=s+c,l=a-s,o=s-(a-l)+(c-l),c=r[++A]),s=a,0!==o&&(i[d++]=o);for(;h=33306690738754716e-32*u?l:-function(e,t,n,r,i,s,a){let o,l,u,c,h,A,d,p,f,m,g,_,v,y,b,x,T,S;const w=e-i,M=n-i,E=t-s,C=r-s;y=w*C,A=R_*w,d=A-(A-w),p=w-d,A=R_*C,f=A-(A-C),m=C-f,b=p*m-(y-d*f-p*f-d*m),x=E*M,A=R_*E,d=A-(A-E),p=E-d,A=R_*M,f=A-(A-M),m=M-f,T=p*m-(x-d*f-p*f-d*m),g=b-T,h=b-g,D_[0]=b-(g+h)+(h-T),_=y+g,h=_-y,v=y-(_-h)+(g-h),g=v-x,h=v-g,D_[1]=v-(g+h)+(h-x),S=_+g,h=S-_,D_[2]=_-(S-h)+(g-h),D_[3]=S;let R=function(e,t){let n=t[0];for(let r=1;r=N||-R>=N)return R;if(h=e-w,o=e-(w+h)+(h-i),h=n-M,u=n-(M+h)+(h-i),h=t-E,l=t-(E+h)+(h-s),h=r-C,c=r-(C+h)+(h-s),0===o&&0===l&&0===u&&0===c)return R;if(N=11093356479670487e-47*a+33306690738754706e-32*Math.abs(R),R+=w*c+C*o-(E*u+M*l),R>=N||-R>=N)return R;y=o*C,A=R_*o,d=A-(A-o),p=o-d,A=R_*C,f=A-(A-C),m=C-f,b=p*m-(y-d*f-p*f-d*m),x=l*M,A=R_*l,d=A-(A-l),p=l-d,A=R_*M,f=A-(A-M),m=M-f,T=p*m-(x-d*f-p*f-d*m),g=b-T,h=b-g,O_[0]=b-(g+h)+(h-T),_=y+g,h=_-y,v=y-(_-h)+(g-h),g=v-x,h=v-g,O_[1]=v-(g+h)+(h-x),S=_+g,h=S-_,O_[2]=_-(S-h)+(g-h),O_[3]=S;const P=N_(4,D_,4,O_,L_);y=w*c,A=R_*w,d=A-(A-w),p=w-d,A=R_*c,f=A-(A-c),m=c-f,b=p*m-(y-d*f-p*f-d*m),x=E*u,A=R_*E,d=A-(A-E),p=E-d,A=R_*u,f=A-(A-u),m=u-f,T=p*m-(x-d*f-p*f-d*m),g=b-T,h=b-g,O_[0]=b-(g+h)+(h-T),_=y+g,h=_-y,v=y-(_-h)+(g-h),g=v-x,h=v-g,O_[1]=v-(g+h)+(h-x),S=_+g,h=S-_,O_[2]=_-(S-h)+(g-h),O_[3]=S;const D=N_(P,L_,4,O_,I_);y=o*c,A=R_*o,d=A-(A-o),p=o-d,A=R_*c,f=A-(A-c),m=c-f,b=p*m-(y-d*f-p*f-d*m),x=l*u,A=R_*l,d=A-(A-l),p=l-d,A=R_*u,f=A-(A-u),m=u-f,T=p*m-(x-d*f-p*f-d*m),g=b-T,h=b-g,O_[0]=b-(g+h)+(h-T),_=y+g,h=_-y,v=y-(_-h)+(g-h),g=v-x,h=v-g,O_[1]=v-(g+h)+(h-x),S=_+g,h=S-_,O_[2]=_-(S-h)+(g-h),O_[3]=S;const L=N_(D,I_,4,O_,U_);return U_[L-1]}(e,t,n,r,i,s,u)}const F_=Math.pow(2,-52),k_=new Uint32Array(512);class q_{static from(e,t=W_,n=X_){const r=e.length,i=new Float64Array(2*r);for(let s=0;s>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:i}=this,s=e.length>>1;let a=1/0,o=1/0,l=-1/0,u=-1/0;for(let t=0;tl&&(l=n),r>u&&(u=r),this._ids[t]=t}const c=(a+l)/2,h=(o+u)/2;let A,d,p;for(let t=0,n=1/0;t0&&(d=t,n=r)}let g=e[2*d],_=e[2*d+1],v=1/0;for(let t=0;tr&&(t[n++]=i,r=s)}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(B_(f,m,g,_,y,b)<0){const e=d,t=g,n=_;d=p,g=y,_=b,p=e,y=t,b=n}const x=function(e,t,n,r,i,s){const a=n-e,o=r-t,l=i-e,u=s-t,c=a*a+o*o,h=l*l+u*u,A=.5/(a*u-o*l),d=e+(u*c-o*h)*A,p=t+(a*h-l*c)*A;return{x:d,y:p}}(f,m,g,_,y,b);this._cx=x.x,this._cy=x.y;for(let t=0;t0&&Math.abs(u-s)<=F_&&Math.abs(c-a)<=F_)continue;if(s=u,a=c,l===A||l===d||l===p)continue;let h=0;for(let e=0,t=this._hashKey(u,c);e=0;)if(m=f,m===h){m=-1;break}if(-1===m)continue;let g=this._addTriangle(m,l,n[m],-1,-1,r[m]);r[l]=this._legalize(g+2),r[m]=g,T++;let _=n[m];for(;f=n[_],B_(u,c,e[2*_],e[2*_+1],e[2*f],e[2*f+1])<0;)g=this._addTriangle(_,l,f,r[l],-1,r[_]),r[l]=this._legalize(g+2),n[_]=_,T--,_=f;if(m===h)for(;f=t[m],B_(u,c,e[2*f],e[2*f+1],e[2*m],e[2*m+1])<0;)g=this._addTriangle(f,l,m,-1,r[m],r[f]),this._legalize(g+2),r[f]=g,n[m]=m,T--,m=f;this._hullStart=t[l]=m,n[m]=t[_]=l,n[l]=_,i[this._hashKey(u,c)]=l,i[this._hashKey(e[2*m],e[2*m+1])]=m}this.hull=new Uint32Array(T);for(let e=0,t=this._hullStart;e0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:r}=this;let i=0,s=0;for(;;){const a=n[e],o=e-e%3;if(s=o+(e+2)%3,-1===a){if(0===i)break;e=k_[--i];continue}const l=a-a%3,u=o+(e+1)%3,c=l+(a+2)%3,h=t[s],A=t[e],d=t[u],p=t[c];if(z_(r[2*h],r[2*h+1],r[2*A],r[2*A+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){t[e]=p,t[a]=h;const r=n[c];if(-1===r){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,r),this._link(a,n[s]),this._link(s,c);const o=l+(a+1)%3;i=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=r}else{let i=n+1,s=r;j_(e,n+r>>1,i),t[e[n]]>t[e[r]]&&j_(e,n,r),t[e[i]]>t[e[r]]&&j_(e,i,r),t[e[n]]>t[e[i]]&&j_(e,n,i);const a=e[i],o=t[a];for(;;){do{i++}while(t[e[i]]o);if(s=s-n?(H_(e,t,i,r),H_(e,t,n,s-1)):(H_(e,t,n,s-1),H_(e,t,i,r))}}function j_(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function W_(e){return e[0]}function X_(e){return e[1]}function Q_(e,t){var n,r,i,s,a,o,l,u,c,h=0,A=e[0],d=e[1],p=t.length;for(n=0;n=0||s<=0&&o>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(i=B_(s,o,a,l,0,0)))return 0;(i>0&&l>0&&a<=0||i<0&&l<=0&&a>0)&&h++}u=c,a=l,s=o}}return h%2!=0}var $_=function(e,t,n={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const r=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}(e),i="Feature"===(s=t).type?s.geometry:s;var s;const a=i.type,o=t.bbox;let l=i.coordinates;if(o&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(r,o))return!1;"Polygon"===a&&(l=[l]);let u=!1;for(var c=0;cY_||Math.abs(this._y1-i)>Y_)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class Z_{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}class J_{constructor(e,[t,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(t=+t)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=r,this.xmin=t,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this;let i,s;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,o,l=0,u=0,c=n.length;l1;)i-=2;for(let e=2;e0){if(t>=this.ymax)return null;(i=(this.ymax-t)/r)0){if(e>=this.xmax)return null;(i=(this.xmax-e)/n)this.xmax?2:0)|(tthis.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t2&&function(e){const{triangles:t,coords:n}=e;for(let e=0;e1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},(e,t)=>t).sort((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]);const e=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let e=0,n=t.length/2;e0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],s[r[0]]=1,2===r.length&&(s[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new J_(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:r,halfedges:i,triangles:s,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t=0&&i!==n&&i!==r;)n=i;return i}_step(e,t,n){const{inedges:r,hull:i,_hullIndex:s,halfedges:a,triangles:o,points:l}=this;if(-1===r[e]||!l.length)return(e+1)%(l.length>>1);let u=e,c=tv(t-l[2*e],2)+tv(n-l[2*e+1],2);const h=r[e];let A=h;do{let r=o[A];const h=tv(t-l[2*r],2)+tv(n-l[2*r+1],2);if(h0?1:e<0?-1:0},mv=Math.sqrt;function gv(e){return e>1?ov:e<-1?-ov:Math.asin(e)}function _v(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function vv(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function yv(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]}function bv(e){var t=mv(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]}function xv(e){return[cv(e[1],e[0])*lv,gv(Av(-1,dv(1,e[2])))*lv]}function Tv(e){const t=e[0]*uv,n=e[1]*uv,r=hv(n);return[r*hv(t),r*pv(t),pv(n)]}function Sv(e){return e=e.map(e=>Tv(e)),_v(e[0],vv(e[2],e[1]))}function wv(e){const t=function(e){if(e.length<2)return{};let t=0;for(;isNaN(e[t][0]+e[t][1])&&t++2?e[2]*nd:0),t.invert=function(t){return(t=e.invert(t[0]*nd,t[1]*nd))[0]*=td,t[1]*=td,t},t}(e[t]),r=$f().translate([0,0]).scale(1).rotate(n.invert([180,0]));e=e.map(r);const i=[];let s=1;for(let t=0,n=e.length;t1e32?i.push(t):n>s&&(s=n)}const a=1e6*mv(s);i.forEach(t=>e[t]=[a,0]),e.push([0,a]),e.push([-a,0]),e.push([0,-a]);const o=sv.from(e);o.projection=r;const{triangles:l,halfedges:u,inedges:c}=o;for(let n=0,r=u.length;ne.length-3-1&&(l[n]=t);return o}(e),n=function(e){const{triangles:t}=e;if(!t)return[];const n=[];for(let e=0,r=t.length/3;e{if(e[0]!==e[1]&&!(Sv(e.map(e=>t[e]))<0))for(let t,r=0;r<3;r++)t=(r+1)%3,n.add(gh([e[r],e[t]]).join("-"))}),Array.from(n,e=>e.split("-").map(Number)))}(n,e),i=function(e,t){const n=[];e.forEach(e=>{for(let t=0;t<3;t++){const r=e[t],i=e[(t+1)%3];n[r]=n[r]||[],n[r].push(i)}}),0===e.length&&(2===t?(n[0]=[1],n[1]=[0]):1===t&&(n[0]=[]));return n}(n,e.length),s=function(e,t){function n(e,t){let n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}return function(r,i,s){void 0===s&&(s=0);let a,o,l=s;const u=Tv([r,i]);do{a=s,s=null,o=n(u,Tv(t[a])),e[a].forEach(e=>{let r=n(u,Tv(t[e]));if(r{const n=e.map(e=>t[e]).map(Tv);return xv(bv(yv(yv(vv(n[1],n[0]),vv(n[2],n[1])),vv(n[0],n[2]))))})}(n,e),{polygons:o,centers:l}=function(e,t,n){const r=[],i=e.slice();if(0===t.length){if(n.length<2)return{polygons:r,centers:i};if(2===n.length){const e=Tv(n[0]),t=Tv(n[1]),s=bv(yv(e,t)),o=bv(vv(e,t)),l=vv(s,o),u=[s,vv(s,l),vv(vv(s,l),l),vv(vv(vv(s,l),l),l)].map(xv).map(a);return r.push(u),r.push(u.slice().reverse()),{polygons:r,centers:i}}}t.forEach((e,t)=>{for(let n=0;n<3;n++){const i=e[n],s=e[(n+1)%3],a=e[(n+2)%3];r[i]=r[i]||[],r[i].push([s,a,t,[i,s,a]])}});const s=r.map(e=>{const t=[e[0][2]];let r=e[0][1];for(let n=1;n2)return t;if(2==t.length){const r=Mv(n[e[0][3][0]],n[e[0][3][1]],i[t[0]]),s=Mv(n[e[0][3][2]],n[e[0][3][0]],i[t[0]]),o=a(r),l=a(s);return[t[0],l,t[1],o]}});function a(e){let n=-1;return i.slice(t.length,1/0).forEach((r,i)=>{r[0]===e[0]&&r[1]===e[1]&&(n=i+t.length)}),n<0&&(n=i.length,i.push(e)),n}return{polygons:s,centers:i}}(a,n,e),u=function(e){const t=[];return e.forEach(e=>{if(!e)return;let n=e[e.length-1];for(let r of e)r>n&&t.push([n,r]),n=r}),t}(o),c=function(e,t){const n=new Set,r=[];e.map(e=>{if(!(Sv(e.map(e=>t[e>t.length?0:e]))>1e-12))for(let t=0;t<3;t++){let r=[e[t],e[(t+1)%3]],i=`${r[0]}-${r[1]}`;n.has(i)?n.delete(i):n.add(`${r[1]}-${r[0]}`)}});const i=new Map;let s;if(n.forEach(e=>{e=e.split("-").map(Number),i.set(e[0],e[1]),s=e[0]}),void 0===s)return r;let a=s;do{r.push(a);let e=i.get(a);i.set(a,-1),a=e}while(a>-1&&a!==s);return r}(n,e),h=function(e,t){return function(n){const r=new Map,i=new Map;return e.forEach((e,t)=>{const s=e.join("-");r.set(s,n[t]),i.set(s,!0)}),t.forEach(e=>{let t=0,n=-1;for(let i=0;i<3;i++){let s=gh([e[i],e[(i+1)%3]]).join("-");r.get(s)>t&&(t=r.get(s),n=s)}i.set(n,!1)}),e.map(e=>i.get(e.join("-")))}}(r,n);return{delaunay:t,edges:r,triangles:n,centers:l,neighbors:i,polygons:o,mesh:u,hull:c,urquhart:h,find:s}}function Mv(e,t,n){e=Tv(e),t=Tv(t),n=Tv(n);const r=fv(_v(vv(t,e),n));return xv(bv(yv(e,t)).map(e=>r*e))}function Ev(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{}).resolution,n=void 0===t?1/0:t,r=function(e,t){return e.map(function(e){var n,r=[];return e.forEach(function(e){if(n){var i=180*vf(e,n)/Math.PI;if(i>t)for(var s=Pf(n,e),a=1/Math.ceil(i/t),o=a;o<1;)r.push(s(o)),o+=a}r.push(n=e)}),r})}(e,n),i=Sh(r),s=function(e,t){var n={type:"Polygon",coordinates:e},r=Ep(n),i=Dv(r,2),s=Dv(i[0],2),a=s[0],o=s[1],l=Dv(i[1],2),u=l[0],c=l[1];if(Math.min(Math.abs(u-a),Math.abs(c-o))u||c>=89||o<=-89;return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minLng,r=t.maxLng,i=t.minLat,s=t.maxLat,a=Math.round(Math.pow(360/e,2)/Math.PI),o=(1+Math.sqrt(5))/2,l=function(e){return e/o*360%360-180},u=function(e){return Math.acos(2*e/a-1)/Math.PI*180-90},c=function(e){return a*(Math.cos((e+90)*Math.PI/180)+1)/2},h=[void 0!==s?Math.ceil(c(s)):0,void 0!==i?Math.floor(c(i)):a-1],A=void 0===n&&void 0===r?function(){return!0}:void 0===n?function(e){return e<=r}:void 0===r?function(e){return e>=n}:r>=n?function(e){return e>=n&&e<=r}:function(e){return e>=n||e<=r},d=[],p=h[0];p<=h[1];p++){var f=l(p);A(f)&&d.push([f,u(p)])}return d}(t,{minLng:a,maxLng:u,minLat:o,maxLat:c}).filter(function(e){return Ov(e,n,h)})}(e,n),a=[].concat(Lv(i),Lv(s)),o={type:"Polygon",coordinates:e},l=Dv(Ep(o),2),u=Dv(l[0],2),c=u[0],h=u[1],A=Dv(l[1],2),d=A[0],p=A[1],f=c>d||p>=89||h<=-89,m=[];if(f){var g=function(e){const t=function(e){if(t.delaunay=null,t._data=e,"object"==typeof t._data&&"FeatureCollection"===t._data.type&&(t._data=t._data.features),"object"==typeof t._data){const e=t._data.map(e=>[t._vx(e),t._vy(e),e]).filter(e=>isFinite(e[0]+e[1]));t.points=e.map(e=>[e[0],e[1]]),t.valid=e.map(e=>e[2]),t.delaunay=wv(t.points)}return t};return t._vx=function(e){return"object"==typeof e&&"type"in e?kp(e)[0]:0 in e?e[0]:void 0},t._vy=function(e){return"object"==typeof e&&"type"in e?kp(e)[1]:1 in e?e[1]:void 0},t.x=function(e){return e?(t._vx=e,t):t._vx},t.y=function(e){return e?(t._vy=e,t):t._vy},t.polygons=function(e){if(void 0!==e&&t(e),!t.delaunay)return!1;const n={type:"FeatureCollection",features:[]};return 0===t.valid.length||(t.delaunay.polygons.forEach((e,r)=>n.features.push({type:"Feature",geometry:e?{type:"Polygon",coordinates:[[...e,e[0]].map(e=>t.delaunay.centers[e])]}:null,properties:{site:t.valid[r],sitecoordinates:t.points[r],neighbours:t.delaunay.neighbors[r]}})),1===t.valid.length&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:t.valid[0],sitecoordinates:t.points[0],neighbours:[]}})),n},t.triangles=function(e){return void 0!==e&&t(e),!!t.delaunay&&{type:"FeatureCollection",features:t.delaunay.triangles.map((e,n)=>(e=e.map(e=>t.points[e]),e.center=t.delaunay.centers[n],e)).filter(e=>Sv(e)>0).map(e=>({type:"Feature",properties:{circumcenter:e.center},geometry:{type:"Polygon",coordinates:[[...e,e[0]]]}}))}},t.links=function(e){if(void 0!==e&&t(e),!t.delaunay)return!1;const n=t.delaunay.edges.map(e=>vf(t.points[e[0]],t.points[e[1]])),r=t.delaunay.urquhart(n);return{type:"FeatureCollection",features:t.delaunay.edges.map((e,i)=>({type:"Feature",properties:{source:t.valid[e[0]],target:t.valid[e[1]],length:n[i],urquhart:!!r[i]},geometry:{type:"LineString",coordinates:[t.points[e[0]],t.points[e[1]]]}}))}},t.mesh=function(e){return void 0!==e&&t(e),!!t.delaunay&&{type:"MultiLineString",coordinates:t.delaunay.edges.map(e=>[t.points[e[0]],t.points[e[1]]])}},t.cellMesh=function(e){if(void 0!==e&&t(e),!t.delaunay)return!1;const{centers:n,polygons:r}=t.delaunay,i=[];for(const e of r)if(e)for(let t=e.length,r=e[t-1],s=e[0],a=0;ar&&i.push([n[r],n[s]]);return{type:"MultiLineString",coordinates:i}},t._found=void 0,t.find=function(e,n,r){if(t._found=t.delaunay.find(e,n,t._found),!r||vf([e,n],t.points[t._found])r[e]),r[n[0]]]]}},e?t(e):t}(a).triangles(),_=new Map(a.map(function(e,t){var n=Dv(e,2),r=n[0],i=n[1];return["".concat(r,"-").concat(i),t]}));g.features.forEach(function(e){var t,n=e.geometry.coordinates[0].slice(0,3).reverse(),r=[];if(n.forEach(function(e){var t=Dv(e,2),n=t[0],i=t[1],s="".concat(n,"-").concat(i);_.has(s)&&r.push(_.get(s))}),3===r.length){if(r.some(function(e){return e=t&&(++n,r+=t);else{let i=-1;for(let s of e)null!=(s=t(s,++i,e))&&(s=+s)>=s&&(++n,r+=s)}if(n)return r/n}(r,function(t){return t[e]})});if(!Ov(s,o,f))return 1}(t=m).push.apply(t,Lv(n))},b=0,x=v.triangles.length;b2&&void 0!==arguments[2]&&arguments[2]?function(e,t){return(e&&yf.hasOwnProperty(e.type)?yf[e.type]:xf)(e,t)}(t,e):$_(e,t)}var Bv=window.THREE?window.THREE:{BufferGeometry:ai,Float32BufferAttribute:Zr},Fv=(new Bv.BufferGeometry).setAttribute?"setAttribute":"addAttribute",kv=function(e){function t(e,n,r,i,s,a,o){var l;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(l=Cv(this,t)).type="ConicPolygonGeometry",l.parameters={polygonGeoJson:e,bottomHeight:n,topHeight:r,closedBottom:i,closedTop:s,includeSides:a,curvatureResolution:o},n=n||0,r=r||1,i=void 0===i||i,s=void 0===s||s,a=void 0===a||a;var u=Uv(e,{resolution:o=o||5}),c=u.contour,h=u.triangles,A=Sh(h.uvs),d=[],p=[],f=[],m=0,g=function(e){var t=Math.round(d.length/3),n=f.length;d=d.concat(e.vertices),p=p.concat(e.uvs),f=f.concat(t?e.indices.map(function(e){return e+t}):e.indices),l.addGroup(n,f.length-n,m++)};function _(e,t){var n="function"==typeof t?t:function(){return t},r=e.map(function(e){return e.map(function(e){var t=Dv(e,2),r=t[0],i=t[1];return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180;return[n*Math.sin(r)*Math.cos(i),n*Math.cos(r),n*Math.sin(r)*Math.sin(i)]}(i,r,n(r,i))})});return ag(r)}function v(e){return{indices:!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?h.indices:h.indices.slice().reverse(),vertices:_([h.points],e).vertices,uvs:A}}return a&&g(function(){for(var e=_(c,n),t=e.vertices,i=e.holes,s=_(c,r).vertices,a=Sh([s,t]),o=Math.round(s.length/3),l=new Set(i),u=0,h=[],A=0;A=0;m--)for(var g=0;ge.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=(t instanceof Array?t.length?t:[void 0]:[t]).map(function(e){return{keyAccessor:e,isProp:!(e instanceof Function)}}),s=e.reduce(function(e,t){var r=e,s=t;return i.forEach(function(e,t){var a,o=e.keyAccessor;if(e.isProp){var l=s,u=l[o],c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r1&&void 0!==arguments[1]?arguments[1]:1;r===i.length?Object.keys(t).forEach(function(e){return t[e]=n(t[e])}):Object.values(t).forEach(function(t){return e(t,r+1)})}(s);var a=s;return r&&(a=[],function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n.length===i.length?a.push({keys:n,vals:t}):Object.entries(t).forEach(function(t){var r=Vv(t,2),i=r[0],s=r[1];return e(s,[].concat(zv(n),[i]))})}(s),t instanceof Array&&0===t.length&&1===a.length&&(a[0].keys=[])),a},Wv=function(e){var t,n=void 0!==(e=e||{})?e:{},r={};for(t in n)n.hasOwnProperty(t)&&(r[t]=n[t]);var i,s,a,o,l;i="object"==typeof window,s="function"==typeof importScripts,o="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,a=o&&!i&&!s,l=!i&&!a&&!s;var u,c,h,A,d,p="";a?(p=__dirname+"/",u=function(e,t){var n;return(n=te(e))||(A||(A=require("fs")),d||(d=require("path")),e=d.normalize(e),n=A.readFileSync(e)),t?n:n.toString()},h=function(e){var t=u(e,!0);return t.buffer||(t=new Uint8Array(t)),v(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),n.inspect=function(){return"[Emscripten Module object]"}):l?("undefined"!=typeof read&&(u=function(e){var t=te(e);return t?J(t):read(e)}),h=function(e){var t;return(t=te(e))?t:"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(v("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs&&scriptArgs,"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(i||s)&&(s?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),p=0!==p.indexOf("blob:")?p.substr(0,p.lastIndexOf("/")+1):"",u=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText}catch(t){var n=te(e);if(n)return J(n);throw t}},s&&(h=function(e){try{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}catch(t){var n=te(e);if(n)return n;throw t}}),c=function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)t(r.response);else{var i=te(e);i?t(i.buffer):n()}},r.onerror=n,r.send(null)});var f=n.print||console.log.bind(console),m=n.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(n[t]=r[t]);r=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram;var g=0;var _=!1;function v(e,t){e||fe("Assertion failed: "+t)}function y(e){var t=n["_"+e];return v(t,"Cannot call unknown function "+e+", make sure it is exported"),t}function b(e,t,n,r,i){var s={string:function(e){var t=0;if(null!=e&&0!==e){var n=1+(e.length<<2);(function(e,t,n){(function(e,t,n,r){if(!(r>0))return 0;for(var i=n,s=n+r-1,a=0;a=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a);if(o<=127){if(n>=s)break;t[n++]=o}else if(o<=2047){if(n+1>=s)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=s)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=s)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0})(e,S,t,n)})(e,t=ae(n),n)}return t},array:function(e){var t=ae(e.length);return function(e,t){T.set(e,t)}(e,t),t}};var a=y(e),o=[],l=0;if(r)for(var u=0;u=r);)++i;if(i-t>16&&e.subarray&&R)return R.decode(e.subarray(t,i));for(var s="";t>10,56320|1023&u)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s}(S,e,t):""}function P(e,t){return e%t>0&&(e+=t-e%t),e}function D(e){x=e,n.HEAP8=T=new Int8Array(e),n.HEAP16=w=new Int16Array(e),n.HEAP32=M=new Int32Array(e),n.HEAPU8=S=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAPU32=new Uint32Array(e),n.HEAPF32=E=new Float32Array(e),n.HEAPF64=C=new Float64Array(e)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var L=n.TOTAL_MEMORY||33554432;function I(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?n.dynCall_v(r):n.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}L=(x=n.buffer?n.buffer:new ArrayBuffer(L)).byteLength,D(x),M[7152]=5271520;var U=[],O=[],B=[],F=[];function k(e){U.unshift(e)}function q(e){F.unshift(e)}var V=Math.abs,z=Math.ceil,G=Math.floor,H=Math.min,j=0,W=null;n.preloadedImages={},n.preloadedAudios={};var X,Q,$=null,Y="data:application/octet-stream;base64,";function K(e){return String.prototype.startsWith?e.startsWith(Y):0===e.indexOf(Y)}$="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAY2VsbFRvVmVydGV4AGdyYXBoLT5idWNrZXRzICE9IE5VTEwAdmVydGV4R3JhcGguYwBpbml0VmVydGV4R3JhcGgAbm9kZSAhPSBOVUxMAGFkZFZlcnRleE5vZGU=";function Z(){return T.length}function J(e){for(var t=[],n=0;n255&&(r&=255),t.push(String.fromCharCode(r))}return t.join("")}var ee="function"==typeof atob?atob:function(e){var t,n,r,i,s,a,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",u=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=o.indexOf(e.charAt(u++))<<2|(i=o.indexOf(e.charAt(u++)))>>4,n=(15&i)<<4|(s=o.indexOf(e.charAt(u++)))>>2,r=(3&s)<<6|(a=o.indexOf(e.charAt(u++))),l+=String.fromCharCode(t),64!==s&&(l+=String.fromCharCode(n)),64!==a&&(l+=String.fromCharCode(r))}while(u=0){if((0|n)>13780509){if(0|(o=0|pt(15,l)))break;l=0|i[(u=l)>>2],u=0|i[u+4>>2]}else c=0|sn(0|n,0|(o=((0|n)<0)<<31>>31),3,0),u=0|w(),o=0|Jt(0|n,0|o,1,0),o=0|Jt(0|(o=0|sn(0|c,0|u,0|o,0|w())),0|w(),1,0),u=0|w(),i[l>>2]=o,i[l+4>>2]=u,l=o;if(mn(0|r,0,l<<3),0|s){mn(0|s,0,l<<2),o=0|O(e,t,n,r,s,l,u,0);break}(o=0|Zt(l,4))?(c=0|O(e,t,n,r,o,l,u,0),Kt(o),o=c):o=13}else o=2}while(0);return D=a,0|(c=o)}function U(e,t,n,r,s){e|=0,t|=0,n|=0,r|=0,s|=0;var a,o,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0;if(o=D,D=D+16|0,m=o+8|0,i[(f=a=o)>>2]=e,i[f+4>>2]=t,(0|n)<0)return D=o,0|(m=2);if(i[(l=r)>>2]=e,i[l+4>>2]=t,(l=!!(0|s))&&(i[s>>2]=0),0|je(e,t))return D=o,0|(m=9);i[m>>2]=0;e:do{if((0|n)>=1)if(l)for(d=1,A=0,p=0,f=1,l=e;;){if(!(A|p)){if(0|(l=0|B(l,t,4,m,a)))break e;if(0|je(l=0|i[(t=a)>>2],t=0|i[t+4>>2])){l=9;break e}}if(0|(l=0|B(l,t,0|i[26800+(p<<2)>>2],m,a)))break e;if(l=0|i[(t=a)>>2],t=0|i[t+4>>2],i[(e=r+(d<<3)|0)>>2]=l,i[e+4>>2]=t,i[s+(d<<2)>>2]=f,u=(0|(e=A+1|0))==(0|f),h=6==(0|(c=p+1|0)),0|je(l,t)){l=9;break e}if((0|(f=f+(h&u&1)|0))>(0|n)){l=0;break}d=d+1|0,A=u?0:e,p=u?h?0:c:p}else for(d=1,A=0,p=0,f=1,l=e;;){if(!(A|p)){if(0|(l=0|B(l,t,4,m,a)))break e;if(0|je(l=0|i[(t=a)>>2],t=0|i[t+4>>2])){l=9;break e}}if(0|(l=0|B(l,t,0|i[26800+(p<<2)>>2],m,a)))break e;if(l=0|i[(t=a)>>2],t=0|i[t+4>>2],i[(e=r+(d<<3)|0)>>2]=l,i[e+4>>2]=t,u=(0|(e=A+1|0))==(0|f),h=6==(0|(c=p+1|0)),0|je(l,t)){l=9;break e}if((0|(f=f+(h&u&1)|0))>(0|n)){l=0;break}d=d+1|0,A=u?0:e,p=u?h?0:c:p}else l=0}while(0);return D=o,0|(m=l)}function O(e,t,n,r,s,a,o,l){n|=0,r|=0,s|=0,l|=0;var u,c,h,A=0,d=0,p=0,f=0,m=0,g=0,_=0;if(h=D,D=D+16|0,u=h+8|0,c=h,A=0|on(0|(e|=0),0|(t|=0),0|(a|=0),0|(o|=0)),p=0|w(),!(!(0|(_=0|i[(g=f=r+(A<<3)|0)>>2]))&!(0|(g=0|i[g+4>>2]))|(d=(0|_)==(0|e)&(0|g)==(0|t))))do{A=0|an(0|(A=0|Jt(0|A,0|p,1,0)),0|w(),0|a,0|o),p=0|w(),d=(0|(g=0|i[(_=f=r+(A<<3)|0)>>2]))==(0|e)&(0|(_=0|i[_+4>>2]))==(0|t)}while(!(!(0|g)&!(0|_)|d));if(A=s+(A<<2)|0,d&&(0|i[A>>2])<=(0|l))return D=h,0|(_=0);if(i[(_=f)>>2]=e,i[_+4>>2]=t,i[A>>2]=l,(0|l)>=(0|n))return D=h,0|(_=0);switch(d=l+1|0,i[u>>2]=0,0|(A=0|B(e,t,2,u,c))){case 9:m=9;break;case 0:(A=0|O(0|i[(A=c)>>2],0|i[A+4>>2],n,r,s,a,o,d))||(m=9)}e:do{if(9==(0|m)){switch(i[u>>2]=0,0|(A=0|B(e,t,3,u,c))){case 9:break;case 0:if(0|(A=0|O(0|i[(A=c)>>2],0|i[A+4>>2],n,r,s,a,o,d)))break e;break;default:break e}switch(i[u>>2]=0,0|(A=0|B(e,t,1,u,c))){case 9:break;case 0:if(0|(A=0|O(0|i[(A=c)>>2],0|i[A+4>>2],n,r,s,a,o,d)))break e;break;default:break e}switch(i[u>>2]=0,0|(A=0|B(e,t,5,u,c))){case 9:break;case 0:if(0|(A=0|O(0|i[(A=c)>>2],0|i[A+4>>2],n,r,s,a,o,d)))break e;break;default:break e}switch(i[u>>2]=0,0|(A=0|B(e,t,4,u,c))){case 9:break;case 0:if(0|(A=0|O(0|i[(A=c)>>2],0|i[A+4>>2],n,r,s,a,o,d)))break e;break;default:break e}switch(i[u>>2]=0,0|(A=0|B(e,t,6,u,c))){case 9:break;case 0:if(0|(A=0|O(0|i[(A=c)>>2],0|i[A+4>>2],n,r,s,a,o,d)))break e;break;default:break e}return D=h,0|(_=0)}}while(0);return D=h,0|(_=A)}function B(e,t,n,r,s){e|=0,t|=0,s|=0;var a,o,l=0,u=0,c=0,h=0,A=0,d=0,p=0;if((n|=0)>>>0>6)return 0|(s=1);if(A=(0|i[(r|=0)>>2])%6|0,i[r>>2]=A,(0|A)>0){l=0;do{n=0|be(n),l=l+1|0}while((0|l)<(0|i[r>>2]))}if(A=0|un(0|e,0|t,45),w(),(o=127&A)>>>0>121)return 0|(s=5);a=0|Qe(e,t),l=0|un(0|e,0|t,52),w(),l&=15;e:do{if(l){for(;;){if(c=0|un(0|e,0|t,0|(u=3*(15-l|0)|0)),w(),7==(0|(c&=7))){t=5;break}if(p=!(0|Je(l)),l=l+-1|0,d=0|cn(7,0,0|u),t&=~w(),e=0|cn(0|i[(p?432:16)+(28*c|0)+(n<<2)>>2],0,0|u)|e&~d,t|=u=0|w(),!(n=0|i[(p?640:224)+(28*c|0)+(n<<2)>>2])){n=0;break e}if(!l){h=8;break e}}return 0|t}h=8}while(0);8==(0|h)&&(e|=0|cn(0|(p=0|i[848+(28*o|0)+(n<<2)>>2]),0,45),t=w()|-1040385&t,n=0|i[4272+(28*o|0)+(n<<2)>>2],127&~p||(p=0|cn(0|i[848+(28*o|0)+20>>2],0,45),t=w()|-1040385&t,n=0|i[4272+(28*o|0)+20>>2],e=0|Ye(p|e,t),t=0|w(),i[r>>2]=1+(0|i[r>>2]))),c=0|un(0|e,0|t,45),w(),c&=127;e:do{if(0|z(c)){t:do{if(1==(0|Qe(e,t))){if((0|o)!=(0|c)){if(0|W(c,0|i[7696+(28*o|0)>>2])){e=0|Ze(e,t),u=1,t=0|w();break}M(27795,26864,533,26872)}switch(0|a){case 3:e=0|Ye(e,t),t=0|w(),i[r>>2]=1+(0|i[r>>2]),u=0;break t;case 5:e=0|Ze(e,t),t=0|w(),i[r>>2]=5+(0|i[r>>2]),u=0;break t;case 0:return 0|(p=9);default:return 0|(p=1)}}else u=0}while(0);if((0|n)>0){l=0;do{e=0|$e(e,t),t=0|w(),l=l+1|0}while((0|l)!=(0|n))}if((0|o)!=(0|c)){if(!(0|G(c))){if(!!(0|u)|5!=(0|Qe(e,t)))break;i[r>>2]=1+(0|i[r>>2]);break}switch(127&A){case 8:case 118:break e}3!=(0|Qe(e,t))&&(i[r>>2]=1+(0|i[r>>2]))}}else if((0|n)>0){l=0;do{e=0|Ye(e,t),t=0|w(),l=l+1|0}while((0|l)!=(0|n))}}while(0);return i[r>>2]=((0|i[r>>2])+n|0)%6|0,i[(p=s)>>2]=e,i[p+4>>2]=t,0|(p=0)}function F(e,t,n,r){e|=0,t|=0,n|=0,r|=0;var s,a,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0;if(a=D,D=D+16|0,f=a+8|0,i[(p=s=a)>>2]=e,i[p+4>>2]=t,(0|n)<0)return D=a,0|(f=2);if(!n)return i[(f=r)>>2]=e,i[f+4>>2]=t,D=a,0|(f=0);i[f>>2]=0;e:do{if(0|je(e,t))e=9;else{o=0,p=e;do{if(0|(e=0|B(p,t,4,f,s)))break e;if(o=o+1|0,0|je(p=0|i[(t=s)>>2],t=0|i[t+4>>2])){e=9;break e}}while((0|o)<(0|n));i[(d=r)>>2]=p,i[d+4>>2]=t,d=n+-1|0,A=0,e=1;do{if(o=26800+(A<<2)|0,5==(0|A))for(u=0|i[o>>2],l=0,o=e;;){if(0|(e=0|B(0|i[(e=s)>>2],0|i[e+4>>2],u,f,s)))break e;if((0|l)!=(0|d)){if(c=0|i[(h=s)>>2],h=0|i[h+4>>2],i[(e=r+(o<<3)|0)>>2]=c,i[e+4>>2]=h,0|je(c,h)){e=9;break e}e=o+1|0}else e=o;if((0|(l=l+1|0))>=(0|n))break;o=e}else for(u=s,h=0|i[o>>2],c=0,o=e,l=0|i[u>>2],u=0|i[u+4>>2];;){if(0|(e=0|B(l,u,h,f,s)))break e;if(l=0|i[(u=s)>>2],u=0|i[u+4>>2],i[(e=r+(o<<3)|0)>>2]=l,i[e+4>>2]=u,e=o+1|0,0|je(l,u)){e=9;break e}if((0|(c=c+1|0))>=(0|n))break;o=e}A=A+1|0}while(A>>>0<6);e=(0|p)==(0|i[(e=s)>>2])&&(0|t)==(0|i[e+4>>2])?0:9}}while(0);return D=a,0|(f=e)}function k(e,t,n,r){e|=0,t|=0,r|=0;var s,a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0;if(s=D,D=D+16|0,l=s,!(n|=0))return i[r>>2]=e,i[r+4>>2]=t,D=s,0|(r=0);do{if((0|n)>=0){if((0|n)>13780509){if(0|(a=0|pt(15,l)))break;a=0|i[(o=l)>>2],o=0|i[o+4>>2]}else A=0|sn(0|n,0|(a=((0|n)<0)<<31>>31),3,0),o=0|w(),a=0|Jt(0|n,0|a,1,0),a=0|Jt(0|(a=0|sn(0|A,0|o,0|a,0|w())),0|w(),1,0),o=0|w(),i[(A=l)>>2]=a,i[A+4>>2]=o;if(h=0|Zt(a,8)){if(!(A=0|Zt(a,4))){Kt(h),a=13;break}if(0|(a=0|O(e,t,n,h,A,a,o,0))){Kt(h),Kt(A);break}if(t=0|i[l>>2],(0|(l=0|i[l+4>>2]))>0|!(0|l)&t>>>0>0){a=0,u=0,c=0;do{!(0|(o=0|i[(e=h+(u<<3)|0)>>2]))&!(0|(e=0|i[e+4>>2]))||(0|i[A+(u<<2)>>2])!=(0|n)||(i[(d=r+(a<<3)|0)>>2]=o,i[d+4>>2]=e,a=a+1|0),u=0|Jt(0|u,0|c,1,0),c=0|w()}while((0|c)<(0|l)|(0|c)==(0|l)&u>>>0>>0)}Kt(h),Kt(A),a=0}else a=13}else a=2}while(0);return D=s,0|(d=a)}function q(e,t,n,r){n|=0,r|=0;var s,a,o,l=0,u=0;for(o=D,D=D+16|0,s=o,a=o+8|0,l=(l=!(0|je(e|=0,t|=0)))?1:2;;){if(i[a>>2]=0,!(0|B(e,t,l,a,s))&((0|i[(u=s)>>2])==(0|n)?(0|i[u+4>>2])==(0|r):0)){e=4;break}if((l=l+1|0)>>>0>=7){l=7,e=4;break}}return 4==(0|e)?(D=o,0|l):0}function V(e,t,n,r,a,o,l){t|=0,n|=0,r|=0,a|=0,o|=0,l|=0;var u,c,h,A,d,p,f,m,g,_,v=0,y=0,b=0,x=0,T=0,S=0,M=0,E=0,C=0,R=0,N=0,P=0,L=0,I=0,U=0,O=0,B=0,F=0,k=0;if(_=D,D=D+64|0,f=_+48|0,m=_+32|0,g=_+24|0,u=_+8|0,c=_,(0|(y=0|i[(e|=0)>>2]))<=0)return D=_,0|(U=0);for(h=e+4|0,A=f+8|0,d=m+8|0,p=u+8|0,v=0,L=0;;){P=(b=0|i[h>>2])+(L<<4)|0,i[f>>2]=i[P>>2],i[f+4>>2]=i[P+4>>2],i[f+8>>2]=i[P+8>>2],i[f+12>>2]=i[P+12>>2],(0|L)==(y+-1|0)?(i[m>>2]=i[b>>2],i[m+4>>2]=i[b+4>>2],i[m+8>>2]=i[b+8>>2],i[m+12>>2]=i[b+12>>2]):(P=b+(L+1<<4)|0,i[m>>2]=i[P>>2],i[m+4>>2]=i[P+4>>2],i[m+8>>2]=i[P+8>>2],i[m+12>>2]=i[P+12>>2]),y=0|re(f,m,r,g);e:do{if(y)b=0,v=y;else if(b=0|i[(y=g)>>2],(0|(y=0|i[y+4>>2]))>0|!(0|y)&b>>>0>0){N=0,P=0;t:for(;;){if(B=1/(+(b>>>0)+4294967296*+(0|y)),k=+s[f>>3],F=+((y=0|en(0|b,0|y,0|N,0|P))>>>0)+4294967296*+(0|w()),O=+(N>>>0)+4294967296*+(0|P),s[u>>3]=B*(k*F)+B*(+s[m>>3]*O),s[p>>3]=B*(+s[A>>3]*F)+B*(+s[d>>3]*O),0|(y=0|et(u,r,c))){v=y;break}S=0|on(0|(C=0|i[(R=c)>>2]),0|(R=0|i[R+4>>2]),0|t,0|n),x=0|w(),b=0|i[(T=y=l+(S<<3)|0)>>2],T=0|i[T+4>>2];n:do{if(!(0|b)&!(0|T))I=y,U=16;else for(M=0,E=0;;){if((0|M)>(0|n)|(0|M)==(0|n)&E>>>0>t>>>0){v=1;break t}if((0|b)==(0|C)&(0|T)==(0|R))break n;if(S=0|an(0|(y=0|Jt(0|S,0|x,1,0)),0|w(),0|t,0|n),x=0|w(),E=0|Jt(0|E,0|M,1,0),M=0|w(),!(0|(b=0|i[(T=y=l+(S<<3)|0)>>2]))&!(0|(T=0|i[T+4>>2]))){I=y,U=16;break}}}while(0);if(16!=(0|U)||(U=0,!(0|C)&!(0|R))||(i[(E=I)>>2]=C,i[E+4>>2]=R,E=o+(i[a>>2]<<3)|0,i[E>>2]=C,i[E+4>>2]=R,E=0|Jt(0|i[(E=a)>>2],0|i[E+4>>2],1,0),C=0|w(),i[(R=a)>>2]=E,i[R+4>>2]=C),N=0|Jt(0|N,0|P,1,0),P=0|w(),b=0|i[(y=g)>>2],!((0|(y=0|i[y+4>>2]))>(0|P)|(0|y)==(0|P)&b>>>0>N>>>0)){b=1;break e}}b=0}else b=1}while(0);if(L=L+1|0,!b){U=21;break}if((0|L)>=(0|(y=0|i[e>>2]))){v=0,U=21;break}}return 21==(0|U)?(D=_,0|v):0}function z(e){return(e|=0)>>>0>121?0|(e=0):0|(e=0|i[7696+(28*e|0)+16>>2])}function G(e){return 4==(0|(e|=0))|117==(0|e)|0}function H(e){return 0|i[11120+(216*(0|i[(e|=0)>>2])|0)+(72*(0|i[e+4>>2])|0)+(24*(0|i[e+8>>2])|0)+(i[e+12>>2]<<3)>>2]}function j(e){return 0|i[11120+(216*(0|i[(e|=0)>>2])|0)+(72*(0|i[e+4>>2])|0)+(24*(0|i[e+8>>2])|0)+(i[e+12>>2]<<3)+4>>2]}function W(e,t){return t|=0,(0|i[7696+(28*(e|=0)|0)+20>>2])==(0|t)?0|(t=1):0|(t=(0|i[7696+(28*e|0)+24>>2])==(0|t))}function X(e,t){return 0|i[848+(28*(e|=0)|0)+((t|=0)<<2)>>2]}function Q(e,t){return t|=0,(0|i[848+(28*(e|=0)|0)>>2])==(0|t)?0|(t=0):(0|i[848+(28*e|0)+4>>2])==(0|t)?0|(t=1):(0|i[848+(28*e|0)+8>>2])==(0|t)?0|(t=2):(0|i[848+(28*e|0)+12>>2])==(0|t)?0|(t=3):(0|i[848+(28*e|0)+16>>2])==(0|t)?0|(t=4):(0|i[848+(28*e|0)+20>>2])==(0|t)?0|(t=5):0|((0|i[848+(28*e|0)+24>>2])==(0|t)?6:7)}function $(e){var t,n,r;return t=(r=+s[(e|=0)+16>>3])-(n=+s[e+24>>3]),+(r>3]<+s[e+24>>3]|0}function K(e){return+(+s[(e|=0)>>3]-+s[e+8>>3])}function Z(e,t){e|=0;var n,r,i=0;return(i=+s[(t|=0)>>3])>=+s[e+8>>3]&&i<=+s[e>>3]?(n=+s[e+16>>3],i=+s[e+24>>3],t=(r=+s[t+8>>3])>=i,e=r<=n&1,n>3]<+s[t+8>>3]||+s[e+8>>3]>+s[t>>3]?0|(l=0):(i=(u=+s[e+16>>3])<(h=+s[(n=e+24|0)>>3]),c=(o=+s[(l=t+16|0)>>3])<(a=+s[(r=t+24|0)>>3]),t=h-o>3],t)||(h=+ht(+s[n>>3],e))>+ht(+s[l>>3],t)?0|(c=0):0|(c=1))}function ee(e,t){t|=0;var n,r,i,a,o,l=0,u=0,c=0,h=0;return+s[(e|=0)>>3]<+s[t>>3]||+s[e+8>>3]>+s[t+8>>3]?0|(l=0):(i=(a=+s[(l=e+16|0)>>3])<(u=+s[e+24>>3]),c=(h=+s[(n=t+16|0)>>3])<(o=+s[(r=t+24|0)>>3]),t=u-h>3],t)?0|(c=(h=+ht(+s[l>>3],e))>=+ht(+s[n>>3],t)):0|(c=0))}function te(e,t){e|=0,t|=0;var n,r,a,o,l,u=0;a=D,D=D+176|0,i[(r=a)>>2]=4,u=+s[t>>3],s[r+8>>3]=u,o=+s[t+16>>3],s[r+16>>3]=o,s[r+24>>3]=u,u=+s[t+24>>3],s[r+32>>3]=u,l=+s[t+8>>3],s[r+40>>3]=l,s[r+48>>3]=u,s[r+56>>3]=l,s[r+64>>3]=o,n=(t=r+72|0)+96|0;do{i[t>>2]=0,t=t+4|0}while((0|t)<(0|n));fn(0|e,0|r,168),D=a}function ne(e,t,n){e|=0,t|=0,n|=0;var r,o,c,h,A,d,p,f=0,m=0,g=0,_=0,y=0,x=0,T=0;d=D,D=D+288|0,A=d+264|0,_=d+96|0,m=(f=g=d)+96|0;do{i[f>>2]=0,f=f+4|0}while((0|f)<(0|m));return 0|(t=0|st(t,g))?(D=d,0|(x=t)):(rt(g=0|i[(m=g)>>2],m=0|i[m+4>>2],A),it(g,m,_),h=+At(A,_+8|0),s[A>>3]=+s[e>>3],s[(m=A+8|0)>>3]=+s[e+16>>3],s[_>>3]=+s[e+8>>3],s[(g=_+8|0)>>3]=+s[e+24>>3],o=+At(A,_),T=+s[m>>3]-+s[g>>3],c=+u(+T),p=+s[A>>3]-+s[_>>3],r=+u(+p),!(0==T|0==p)&&(T=+An(+c,+r),T=+v(+o*o/+dn(+T/+dn(+c,+r),3)/(h*(2.59807621135*h)*.8)),s[a>>3]=T,y=~~T>>>0,x=+u(T)>=1?T>0?~~+b(+l(T/4294967296),4294967295)>>>0:~~+v((T-+(~~T>>>0))/4294967296)>>>0:0,2146435072&~i[a+4>>2])?(_=!(0|y)&!(0|x),i[(t=n)>>2]=_?1:y,i[t+4>>2]=_?0:x,t=0):t=1,D=d,0|(x=t))}function re(e,t,n,r){e|=0,t|=0,n|=0,r|=0;var o,c,h,A,d=0,p=0,f=0;A=D,D=D+288|0,c=A+264|0,h=A+96|0,o=(d=p=A)+96|0;do{i[d>>2]=0,d=d+4|0}while((0|d)<(0|o));return 0|(n=0|st(n,p))?(D=A,0|(r=n)):(rt(d=0|i[(n=p)>>2],n=0|i[n+4>>2],c),it(d,n,h),f=+At(c,h+8|0),f=+v(+ +At(e,t)/(2*f)),s[a>>3]=f,n=~~f>>>0,d=+u(f)>=1?f>0?~~+b(+l(f/4294967296),4294967295)>>>0:~~+v((f-+(~~f>>>0))/4294967296)>>>0:0,2146435072&~i[a+4>>2]?(p=!(0|n)&!(0|d),i[r>>2]=p?1:n,i[r+4>>2]=p?0:d,D=A,0|(r=0)):(D=A,0|(r=1)))}function ie(e,t,n,r){t|=0,n|=0,r|=0,i[(e|=0)>>2]=t,i[e+4>>2]=n,i[e+8>>2]=r}function se(e,t){e|=0;var n,r,a,o,l=0,c=0,h=0,A=0,d=0,p=0,f=0;i[(o=(t|=0)+8|0)>>2]=0,r=+s[e>>3],A=+u(+r),a=+s[e+8>>3],A+=.5*(d=1.1547005383792515*+u(+a)),A-=+(0|(l=~~A)),d-=+(0|(e=~~d));do{if(A<.5){if(A<.3333333333333333){if(i[t>>2]=l,d<.5*(A+1)){i[t+4>>2]=e;break}e=e+1|0,i[t+4>>2]=e;break}if(e=(1&!(d<(f=1-A)))+e|0,i[t+4>>2]=e,f<=d&d<2*A){l=l+1|0,i[t>>2]=l;break}i[t>>2]=l;break}if(!(A<.6666666666666666)){if(l=l+1|0,i[t>>2]=l,d<.5*A){i[t+4>>2]=e;break}e=e+1|0,i[t+4>>2]=e;break}if(d<1-A){if(i[t+4>>2]=e,2*A-1>2]=l;break}}else e=e+1|0,i[t+4>>2]=e;l=l+1|0,i[t>>2]=l}while(0);do{if(r<0){if(1&e){l=~~(+(0|l)-(2*(+((p=0|en(0|l,((0|l)<0)<<31>>31,0|(p=(e+1|0)/2|0),((0|p)<0)<<31>>31))>>>0)+4294967296*+(0|w()))+1)),i[t>>2]=l;break}l=~~(+(0|l)-2*(+((p=0|en(0|l,((0|l)<0)<<31>>31,0|(p=(0|e)/2|0),((0|p)<0)<<31>>31))>>>0)+4294967296*+(0|w()))),i[t>>2]=l;break}}while(0);p=t+4|0,a<0&&(l=l-((1|e<<1)/2|0)|0,i[t>>2]=l,e=0-e|0,i[p>>2]=e),c=e-l|0,(0|l)<0?(h=0-l|0,i[p>>2]=c,i[o>>2]=h,i[t>>2]=0,e=c,l=0):h=0,(0|e)<0&&(l=l-e|0,i[t>>2]=l,h=h-e|0,i[o>>2]=h,i[p>>2]=0,e=0),n=l-h|0,c=e-h|0,(0|h)<0&&(i[t>>2]=n,i[p>>2]=c,i[o>>2]=0,e=c,l=n,h=0),(0|(c=(0|h)<(0|(c=(0|e)<(0|l)?e:l))?h:c))<=0||(i[t>>2]=l-c,i[p>>2]=e-c,i[o>>2]=h-c)}function ae(e){var t,n=0,r=0,s=0,a=0,o=0;n=0|i[(e|=0)>>2],r=0|i[(t=e+4|0)>>2],(0|n)<0&&(r=r-n|0,i[t>>2]=r,i[(o=e+8|0)>>2]=(0|i[o>>2])-n,i[e>>2]=0,n=0),(0|r)<0?(n=n-r|0,i[e>>2]=n,a=(0|i[(o=e+8|0)>>2])-r|0,i[o>>2]=a,i[t>>2]=0,r=0):(o=a=e+8|0,a=0|i[a>>2]),(0|a)<0&&(n=n-a|0,i[e>>2]=n,r=r-a|0,i[t>>2]=r,i[o>>2]=0,a=0),(0|(s=(0|a)<(0|(s=(0|r)<(0|n)?r:n))?a:s))<=0||(i[e>>2]=n-s,i[t>>2]=r-s,i[o>>2]=a-s)}function oe(e,t){t|=0;var n,r;r=0|i[(e|=0)+8>>2],n=+((0|i[e+4>>2])-r|0),s[t>>3]=+((0|i[e>>2])-r|0)-.5*n,s[t+8>>3]=.8660254037844386*n}function le(e,t,n){e|=0,t|=0,i[(n|=0)>>2]=(0|i[t>>2])+(0|i[e>>2]),i[n+4>>2]=(0|i[t+4>>2])+(0|i[e+4>>2]),i[n+8>>2]=(0|i[t+8>>2])+(0|i[e+8>>2])}function ue(e,t,n){e|=0,t|=0,i[(n|=0)>>2]=(0|i[e>>2])-(0|i[t>>2]),i[n+4>>2]=(0|i[e+4>>2])-(0|i[t+4>>2]),i[n+8>>2]=(0|i[e+8>>2])-(0|i[t+8>>2])}function ce(e,t){t|=0;var n,r=0;r=0|y(0|i[(e|=0)>>2],t),i[e>>2]=r,n=0|y(0|i[(r=e+4|0)>>2],t),i[r>>2]=n,t=0|y(0|i[(e=e+8|0)>>2],t),i[e>>2]=t}function he(e){var t,n,r=0,s=0,a=0,o=0,l=0;l=(0|(n=0|i[(e|=0)>>2]))<0,e=(e=(s=(0|(o=((t=(0|(a=(0|i[e+4>>2])-(l?n:0)|0))<0)?0-a|0:0)+((0|i[e+8>>2])-(l?n:0))|0))<0)?0:o)-((a=(0|(s=(0|e)<(0|(s=(0|(r=(t?0:a)-(s?o:0)|0))<(0|(o=(l?0:n)-(t?a:0)-(s?o:0)|0))?r:o))?e:s))>0)?s:0)|0,r=r-(a?s:0)|0;e:do{switch(o-(a?s:0)|0){case 0:switch(0|r){case 0:return 0|(l=0|e?1==(0|e)?1:7:0);case 1:return 0|(l=0|e?1==(0|e)?3:7:2);default:break e}case 1:switch(0|r){case 0:return 0|(l=0|e?1==(0|e)?5:7:4);case 1:if(e)break e;return 0|(e=6);default:break e}}}while(0);return 0|(l=7)}function Ae(e){var t,n,r=0,s=0,a=0,o=0,l=0,u=0,c=0;if(u=0|i[(n=(e|=0)+8|0)>>2],(t=(0|i[e>>2])-u|0)>>>0>715827881|(u=(0|i[(c=e+4|0)>>2])-u|0)>>>0>715827881){if(o=2147483647-t|0,l=-2147483648-t|0,(a=(0|t)>0)?(0|o)<(0|t):(0|l)>(0|t))return 0|(c=1);if(s=t<<1,a?(2147483647-s|0)<(0|t):(-2147483648-s|0)>(0|t))return 0|(c=1);if((0|u)>0?(2147483647-u|0)<(0|u):(-2147483648-u|0)>(0|u))return 0|(c=1);if(r=3*t|0,s=u<<1,(a?(0|o)<(0|s):(0|l)>(0|s))||((0|t)>-1?(-2147483648|r)>=(0|u):(-2147483648^r)<(0|u)))return 0|(c=1)}else s=u<<1,r=3*t|0;return a=0|$t(.14285714285714285*+(r-u|0)),i[e>>2]=a,o=0|$t(.14285714285714285*+(s+t|0)),i[c>>2]=o,i[n>>2]=0,r=(s=(0|o)<(0|a))?a:o,(0|(s=s?o:a))<0&&((-2147483648==(0|s)||((0|r)>0?(2147483647-r|0)<(0|s):(-2147483648-r|0)>(0|s)))&&M(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|s):(-2147483648^r)<(0|s))&&M(27795,26892,354,26903)),r=o-a|0,(0|a)<0?(s=0-a|0,i[c>>2]=r,i[n>>2]=s,i[e>>2]=0,a=0):(r=o,s=0),(0|r)<0&&(a=a-r|0,i[e>>2]=a,s=s-r|0,i[n>>2]=s,i[c>>2]=0,r=0),l=a-s|0,o=r-s|0,(0|s)<0?(i[e>>2]=l,i[c>>2]=o,i[n>>2]=0,r=o,o=l,s=0):o=a,(0|(a=(0|s)<(0|(a=(0|r)<(0|o)?r:o))?s:a))<=0||(i[e>>2]=o-a,i[c>>2]=r-a,i[n>>2]=s-a),0|(c=0)}function de(e){var t,n=0,r=0,s=0,a=0,o=0,l=0,u=0;if(a=0|i[(t=(e|=0)+8|0)>>2],(o=(0|i[e>>2])-a|0)>>>0>715827881|(a=(0|i[(l=e+4|0)>>2])-a|0)>>>0>715827881){if((r=(0|o)>0)?(2147483647-o|0)<(0|o):(-2147483648-o|0)>(0|o))return 0|(l=1);if(n=o<<1,(s=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 0|(l=1);if(u=a<<1,s?(2147483647-u|0)<(0|a):(-2147483648-u|0)>(0|a))return 0|(u=1);if(r?(2147483647-n|0)<(0|a):(-2147483648-n|0)>(0|a))return 0|(u=1);if(r=3*a|0,(0|a)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))return 0|(u=1)}else r=3*a|0,n=o<<1;return s=0|$t(.14285714285714285*+(n+a|0)),i[e>>2]=s,a=0|$t(.14285714285714285*+(r-o|0)),i[l>>2]=a,i[t>>2]=0,n=(r=(0|a)<(0|s))?s:a,(0|(r=r?a:s))<0&&((-2147483648==(0|r)||((0|n)>0?(2147483647-n|0)<(0|r):(-2147483648-n|0)>(0|r)))&&M(27795,26892,402,26917),((0|n)>-1?(-2147483648|n)>=(0|r):(-2147483648^n)<(0|r))&&M(27795,26892,402,26917)),n=a-s|0,(0|s)<0?(r=0-s|0,i[l>>2]=n,i[t>>2]=r,i[e>>2]=0,s=0):(n=a,r=0),(0|n)<0&&(s=s-n|0,i[e>>2]=s,r=r-n|0,i[t>>2]=r,i[l>>2]=0,n=0),o=s-r|0,a=n-r|0,(0|r)<0?(i[e>>2]=o,i[l>>2]=a,i[t>>2]=0,n=a,a=o,r=0):a=s,(0|(s=(0|r)<(0|(s=(0|n)<(0|a)?n:a))?r:s))<=0||(i[e>>2]=a-s,i[l>>2]=n-s,i[t>>2]=r-s),0|(u=0)}function pe(e){var t,n,r=0,s=0,a=0,o=0,l=0;s=0|i[(t=(e|=0)+8|0)>>2],a=0|$t(.14285714285714285*+((3*(r=(0|i[e>>2])-s|0)|0)-(s=(0|i[(n=e+4|0)>>2])-s|0)|0)),i[e>>2]=a,r=0|$t(.14285714285714285*+((s<<1)+r|0)),i[n>>2]=r,i[t>>2]=0,s=r-a|0,(0|a)<0?(l=0-a|0,i[n>>2]=s,i[t>>2]=l,i[e>>2]=0,r=s,a=0,s=l):s=0,(0|r)<0&&(a=a-r|0,i[e>>2]=a,s=s-r|0,i[t>>2]=s,i[n>>2]=0,r=0),l=a-s|0,o=r-s|0,(0|s)<0?(i[e>>2]=l,i[n>>2]=o,i[t>>2]=0,r=o,o=l,s=0):o=a,(0|(a=(0|s)<(0|(a=(0|r)<(0|o)?r:o))?s:a))<=0||(i[e>>2]=o-a,i[n>>2]=r-a,i[t>>2]=s-a)}function fe(e){var t,n,r=0,s=0,a=0,o=0,l=0;s=0|i[(t=(e|=0)+8|0)>>2],a=0|$t(.14285714285714285*+(((r=(0|i[e>>2])-s|0)<<1)+(s=(0|i[(n=e+4|0)>>2])-s|0)|0)),i[e>>2]=a,r=0|$t(.14285714285714285*+((3*s|0)-r|0)),i[n>>2]=r,i[t>>2]=0,s=r-a|0,(0|a)<0?(l=0-a|0,i[n>>2]=s,i[t>>2]=l,i[e>>2]=0,r=s,a=0,s=l):s=0,(0|r)<0&&(a=a-r|0,i[e>>2]=a,s=s-r|0,i[t>>2]=s,i[n>>2]=0,r=0),l=a-s|0,o=r-s|0,(0|s)<0?(i[e>>2]=l,i[n>>2]=o,i[t>>2]=0,r=o,o=l,s=0):o=a,(0|(a=(0|s)<(0|(a=(0|r)<(0|o)?r:o))?s:a))<=0||(i[e>>2]=o-a,i[n>>2]=r-a,i[t>>2]=s-a)}function me(e){var t,n,r,s=0,a=0,o=0,l=0;s=0|i[(e|=0)>>2],a=0|i[(n=e+4|0)>>2],o=0|i[(r=e+8|0)>>2],l=a+(3*s|0)|0,i[e>>2]=l,a=o+(3*a|0)|0,i[n>>2]=a,s=(3*o|0)+s|0,i[r>>2]=s,o=a-l|0,(0|l)<0?(s=s-l|0,i[n>>2]=o,i[r>>2]=s,i[e>>2]=0,a=o,o=0):o=l,(0|a)<0&&(o=o-a|0,i[e>>2]=o,s=s-a|0,i[r>>2]=s,i[n>>2]=0,a=0),t=o-s|0,l=a-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=l,i[r>>2]=0,o=t,s=0):l=a,(0|(a=(0|s)<(0|(a=(0|l)<(0|o)?l:o))?s:a))<=0||(i[e>>2]=o-a,i[n>>2]=l-a,i[r>>2]=s-a)}function ge(e){var t,n,r,s=0,a=0,o=0,l=0;l=0|i[(e|=0)>>2],o=(3*(s=0|i[(n=e+4|0)>>2])|0)+l|0,l=(a=0|i[(r=e+8|0)>>2])+(3*l|0)|0,i[e>>2]=l,i[n>>2]=o,s=(3*a|0)+s|0,i[r>>2]=s,a=o-l|0,(0|l)<0?(s=s-l|0,i[n>>2]=a,i[r>>2]=s,i[e>>2]=0,l=0):a=o,(0|a)<0&&(l=l-a|0,i[e>>2]=l,s=s-a|0,i[r>>2]=s,i[n>>2]=0,a=0),t=l-s|0,o=a-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=o,i[r>>2]=0,l=t,s=0):o=a,(0|(a=(0|s)<(0|(a=(0|o)<(0|l)?o:l))?s:a))<=0||(i[e>>2]=l-a,i[n>>2]=o-a,i[r>>2]=s-a)}function _e(e,t){e|=0;var n,r,s,a=0,o=0,l=0;((t|=0)+-1|0)>>>0>=6||(l=(0|i[15440+(12*t|0)>>2])+(0|i[e>>2])|0,i[e>>2]=l,s=e+4|0,o=(0|i[15440+(12*t|0)+4>>2])+(0|i[s>>2])|0,i[s>>2]=o,r=e+8|0,t=(0|i[15440+(12*t|0)+8>>2])+(0|i[r>>2])|0,i[r>>2]=t,a=o-l|0,(0|l)<0?(t=t-l|0,i[s>>2]=a,i[r>>2]=t,i[e>>2]=0,o=0):(a=o,o=l),(0|a)<0&&(o=o-a|0,i[e>>2]=o,t=t-a|0,i[r>>2]=t,i[s>>2]=0,a=0),n=o-t|0,l=a-t|0,(0|t)<0?(i[e>>2]=n,i[s>>2]=l,i[r>>2]=0,o=n,t=0):l=a,(0|(a=(0|t)<(0|(a=(0|l)<(0|o)?l:o))?t:a))<=0||(i[e>>2]=o-a,i[s>>2]=l-a,i[r>>2]=t-a))}function ve(e){var t,n,r,s=0,a=0,o=0,l=0;l=0|i[(e|=0)>>2],o=(s=0|i[(n=e+4|0)>>2])+l|0,l=(a=0|i[(r=e+8|0)>>2])+l|0,i[e>>2]=l,i[n>>2]=o,s=a+s|0,i[r>>2]=s,a=o-l|0,(0|l)<0?(s=s-l|0,i[n>>2]=a,i[r>>2]=s,i[e>>2]=0,o=0):(a=o,o=l),(0|a)<0&&(o=o-a|0,i[e>>2]=o,s=s-a|0,i[r>>2]=s,i[n>>2]=0,a=0),t=o-s|0,l=a-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=l,i[r>>2]=0,o=t,s=0):l=a,(0|(a=(0|s)<(0|(a=(0|l)<(0|o)?l:o))?s:a))<=0||(i[e>>2]=o-a,i[n>>2]=l-a,i[r>>2]=s-a)}function ye(e){var t,n,r,s=0,a=0,o=0,l=0;s=0|i[(e|=0)>>2],o=0|i[(n=e+4|0)>>2],a=0|i[(r=e+8|0)>>2],l=o+s|0,i[e>>2]=l,o=a+o|0,i[n>>2]=o,s=a+s|0,i[r>>2]=s,a=o-l|0,(0|l)<0?(s=s-l|0,i[n>>2]=a,i[r>>2]=s,i[e>>2]=0,o=0):(a=o,o=l),(0|a)<0&&(o=o-a|0,i[e>>2]=o,s=s-a|0,i[r>>2]=s,i[n>>2]=0,a=0),t=o-s|0,l=a-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=l,i[r>>2]=0,o=t,s=0):l=a,(0|(a=(0|s)<(0|(a=(0|l)<(0|o)?l:o))?s:a))<=0||(i[e>>2]=o-a,i[n>>2]=l-a,i[r>>2]=s-a)}function be(e){switch(0|(e|=0)){case 1:e=5;break;case 5:e=4;break;case 4:e=6;break;case 6:e=2;break;case 2:e=3;break;case 3:e=1}return 0|e}function xe(e){switch(0|(e|=0)){case 1:e=3;break;case 3:e=2;break;case 2:e=6;break;case 6:e=4;break;case 4:e=5;break;case 5:e=1}return 0|e}function Te(e){var t,n,r,s=0,a=0,o=0,l=0;s=0|i[(e|=0)>>2],a=0|i[(n=e+4|0)>>2],o=0|i[(r=e+8|0)>>2],l=a+(s<<1)|0,i[e>>2]=l,a=o+(a<<1)|0,i[n>>2]=a,s=(o<<1)+s|0,i[r>>2]=s,o=a-l|0,(0|l)<0?(s=s-l|0,i[n>>2]=o,i[r>>2]=s,i[e>>2]=0,a=o,o=0):o=l,(0|a)<0&&(o=o-a|0,i[e>>2]=o,s=s-a|0,i[r>>2]=s,i[n>>2]=0,a=0),t=o-s|0,l=a-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=l,i[r>>2]=0,o=t,s=0):l=a,(0|(a=(0|s)<(0|(a=(0|l)<(0|o)?l:o))?s:a))<=0||(i[e>>2]=o-a,i[n>>2]=l-a,i[r>>2]=s-a)}function Se(e){var t,n,r,s=0,a=0,o=0,l=0;l=0|i[(e|=0)>>2],o=((s=0|i[(n=e+4|0)>>2])<<1)+l|0,l=(a=0|i[(r=e+8|0)>>2])+(l<<1)|0,i[e>>2]=l,i[n>>2]=o,s=(a<<1)+s|0,i[r>>2]=s,a=o-l|0,(0|l)<0?(s=s-l|0,i[n>>2]=a,i[r>>2]=s,i[e>>2]=0,l=0):a=o,(0|a)<0&&(l=l-a|0,i[e>>2]=l,s=s-a|0,i[r>>2]=s,i[n>>2]=0,a=0),t=l-s|0,o=a-s|0,(0|s)<0?(i[e>>2]=t,i[n>>2]=o,i[r>>2]=0,l=t,s=0):o=a,(0|(a=(0|s)<(0|(a=(0|o)<(0|l)?o:l))?s:a))<=0||(i[e>>2]=l-a,i[n>>2]=o-a,i[r>>2]=s-a)}function we(e,t){t|=0;var n,r,s,a=0,o=0,l=0;return s=(0|(r=(0|i[(e|=0)>>2])-(0|i[t>>2])|0))<0,n=(0|(o=(0|i[e+4>>2])-(0|i[t+4>>2])-(s?r:0)|0))<0,t=(t=(e=(0|(l=(s?0-r|0:0)+(0|i[e+8>>2])-(0|i[t+8>>2])+(n?0-o|0:0)|0))<0)?0:l)-((o=(0|(e=(0|t)<(0|(e=(0|(a=(n?0:o)-(e?l:0)|0))<(0|(l=(s?0:r)-(n?o:0)-(e?l:0)|0))?a:l))?t:e))>0)?e:0)|0,a=a-(o?e:0)|0,0|((0|(e=(0|(e=l-(o?e:0)|0))>-1?e:0-e|0))>(0|(t=(0|(a=(0|a)>-1?a:0-a|0))>(0|(t=(0|t)>-1?t:0-t|0))?a:t))?e:t)}function Me(e,t){t|=0;var n;n=0|i[(e|=0)+8>>2],i[t>>2]=(0|i[e>>2])-n,i[t+4>>2]=(0|i[e+4>>2])-n}function Ee(e,t){t|=0;var n,r,s,a=0,o=0,l=0;if(o=0|i[(e|=0)>>2],i[t>>2]=o,l=0|i[e+4>>2],i[(r=t+4|0)>>2]=l,i[(s=t+8|0)>>2]=0,e=(a=(0|l)<(0|o))?o:l,(0|(a=a?l:o))<0){if(-2147483648==(0|a)||((0|e)>0?(2147483647-e|0)<(0|a):(-2147483648-e|0)>(0|a)))return 0|(t=1);if((0|e)>-1?(-2147483648|e)>=(0|a):(-2147483648^e)<(0|a))return 0|(t=1)}return e=l-o|0,(0|o)<0?(a=0-o|0,i[r>>2]=e,i[s>>2]=a,i[t>>2]=0,o=0):(e=l,a=0),(0|e)<0&&(o=o-e|0,i[t>>2]=o,a=a-e|0,i[s>>2]=a,i[r>>2]=0,e=0),n=o-a|0,l=e-a|0,(0|a)<0?(i[t>>2]=n,i[r>>2]=l,i[s>>2]=0,e=l,l=n,a=0):l=o,(0|(o=(0|a)<(0|(o=(0|e)<(0|l)?e:l))?a:o))<=0||(i[t>>2]=l-o,i[r>>2]=e-o,i[s>>2]=a-o),0|(t=0)}function Ce(e){var t,n,r,s;n=(s=0|i[(t=(e|=0)+8|0)>>2])-(0|i[e>>2])|0,i[e>>2]=n,e=(0|i[(r=e+4|0)>>2])-s|0,i[r>>2]=e,i[t>>2]=0-(e+n)}function Re(e){var t,n,r=0,s=0,a=0,o=0,l=0;r=0-(s=0|i[(e|=0)>>2])|0,i[e>>2]=r,i[(t=e+8|0)>>2]=0,o=(a=0|i[(n=e+4|0)>>2])+s|0,(0|s)>0?(i[n>>2]=o,i[t>>2]=s,i[e>>2]=0,r=0,a=o):s=0,(0|a)<0?(l=r-a|0,i[e>>2]=l,s=s-a|0,i[t>>2]=s,i[n>>2]=0,o=l-s|0,r=0-s|0,(0|s)<0?(i[e>>2]=o,i[n>>2]=r,i[t>>2]=0,a=r,s=0):(a=0,o=l)):o=r,(0|(r=(0|s)<(0|(r=(0|a)<(0|o)?a:o))?s:r))<=0||(i[e>>2]=o-r,i[n>>2]=a-r,i[t>>2]=s-r)}function Ne(e,t,n){n|=0;var r,s,a=0,o=0;return s=D,D=D+16|0,r=s,o=-2130706433&(t|=0)|134217728,!0&268435456==(2013265920&t)?(a=0|un(0|(e|=0),0|t,56),w(),a=0|function(e,t,n){e|=0,t|=0,n|=0;var r=0,s=0,a=0;if(a=D,D=D+16|0,s=a,r=0|je(e,t),(n+-1|0)>>>0>5)return D=a,0|(s=-1);if(r=!!(0|r),1==(0|n)&r)return D=a,0|(s=-1);do{if(!(0|qt(e,t,s))){if(r){r=(5+(0|i[26352+(n<<2)>>2])-(0|i[s>>2])|0)%5|0;break}r=(6+(0|i[26384+(n<<2)>>2])-(0|i[s>>2])|0)%6|0;break}r=-1}while(0);return s=r,D=a,0|s}(e,o,7&a),-1==(0|a)?(i[n>>2]=0,D=s,0|(o=6)):(0|nt(e,o,r)&&M(27795,26932,282,26947),t=0|un(0|e,0|t,52),w(),t&=15,0|je(e,o)?Ie(r,t,a,2,n):Fe(r,t,a,2,n),D=s,0|(o=0))):(D=s,0|(o=6))}function Pe(e,t,n,r){t|=0,r|=0;var a,o=0,l=0,u=0,c=0;if(a=D,D=D+16|0,function(e,t,n){e|=0,t|=0,n|=0;var r=0,a=0,o=0;o=D,D=D+32|0,a=o,function(e,t){e|=0,t|=0;var n=0,r=0,i=0;n=+s[e>>3],r=+A(+n),n=+d(+n),s[t+16>>3]=n,n=+s[e+8>>3],i=r*+A(+n),s[t>>3]=i,n=r*+d(+n),s[t+8>>3]=n}(e,a),i[t>>2]=0,s[n>>3]=5,r=+kt(16400,a),r<+s[n>>3]&&(i[t>>2]=0,s[n>>3]=r);r=+kt(16424,a),r<+s[n>>3]&&(i[t>>2]=1,s[n>>3]=r);r=+kt(16448,a),r<+s[n>>3]&&(i[t>>2]=2,s[n>>3]=r);r=+kt(16472,a),r<+s[n>>3]&&(i[t>>2]=3,s[n>>3]=r);r=+kt(16496,a),r<+s[n>>3]&&(i[t>>2]=4,s[n>>3]=r);r=+kt(16520,a),r<+s[n>>3]&&(i[t>>2]=5,s[n>>3]=r);r=+kt(16544,a),r<+s[n>>3]&&(i[t>>2]=6,s[n>>3]=r);r=+kt(16568,a),r<+s[n>>3]&&(i[t>>2]=7,s[n>>3]=r);r=+kt(16592,a),r<+s[n>>3]&&(i[t>>2]=8,s[n>>3]=r);r=+kt(16616,a),r<+s[n>>3]&&(i[t>>2]=9,s[n>>3]=r);r=+kt(16640,a),r<+s[n>>3]&&(i[t>>2]=10,s[n>>3]=r);r=+kt(16664,a),r<+s[n>>3]&&(i[t>>2]=11,s[n>>3]=r);r=+kt(16688,a),r<+s[n>>3]&&(i[t>>2]=12,s[n>>3]=r);r=+kt(16712,a),r<+s[n>>3]&&(i[t>>2]=13,s[n>>3]=r);r=+kt(16736,a),r<+s[n>>3]&&(i[t>>2]=14,s[n>>3]=r);r=+kt(16760,a),r<+s[n>>3]&&(i[t>>2]=15,s[n>>3]=r);r=+kt(16784,a),r<+s[n>>3]&&(i[t>>2]=16,s[n>>3]=r);r=+kt(16808,a),r<+s[n>>3]&&(i[t>>2]=17,s[n>>3]=r);r=+kt(16832,a),r<+s[n>>3]&&(i[t>>2]=18,s[n>>3]=r);if(r=+kt(16856,a),!(r<+s[n>>3]))return void(D=o);i[t>>2]=19,s[n>>3]=r,D=o}(e|=0,n|=0,c=a),(l=+f(+(1-.5*+s[c>>3])))<1e-16)return i[r>>2]=0,i[r+4>>2]=0,i[r+8>>2]=0,i[r+12>>2]=0,void(D=a);if(c=0|i[n>>2],o=+ut((o=+s[15920+(24*c|0)>>3])-+ut(+function(e,t){e|=0,t|=0;var n=0,r=0,i=0,a=0,o=0;return a=+s[t>>3],r=+A(+a),i=+s[t+8>>3]-+s[e+8>>3],o=r*+d(+i),n=+s[e>>3],+ +_(+o,+(+d(+a)*+A(+n)-+A(+i)*(r*+d(+n))))}(15600+(c<<4)|0,e))),u=0|Je(t)?+ut(o+-.3334731722518321):o,o=2.618033988749896*+p(+l),(0|t)>0){e=0;do{o*=2.6457513110645907,e=e+1|0}while((0|e)!=(0|t))}l=+A(+u)*o,s[r>>3]=l,u=+d(+u)*o,s[r+8>>3]=u,D=a}function De(e,t,n,r,a){t|=0,n|=0,r|=0,a|=0;var o,l=0,h=0;if(l=+function(e){e|=0;var t=0,n=0;return n=+s[e>>3],t=+s[e+8>>3],+ +c(+(n*n+t*t))}(e|=0),l<1e-16)return t=15600+(t<<4)|0,i[a>>2]=i[t>>2],i[a+4>>2]=i[t+4>>2],i[a+8>>2]=i[t+8>>2],void(i[a+12>>2]=i[t+12>>2]);if(h=+_(+ +s[e+8>>3],+ +s[e>>3]),(0|n)>0){e=0;do{l*=.37796447300922725,e=e+1|0}while((0|e)!=(0|n))}o=.3333333333333333*l,r?(n=!(0|Je(n)),l=+g(.381966011250105*(n?o:.37796447300922725*o))):(l=+g(.381966011250105*l),0|Je(n)&&(h=+ut(h+.3334731722518321))),function(e,t,n,r){e|=0,t=+t,n=+n,r|=0;var a=0,o=0,l=0,c=0;if(n<1e-16)return i[r>>2]=i[e>>2],i[r+4>>2]=i[e+4>>2],i[r+8>>2]=i[e+8>>2],void(i[r+12>>2]=i[e+12>>2]);o=t<0?t+6.283185307179586:t,o=t>=6.283185307179586?o+-6.283185307179586:o;do{if(!(o<1e-16)){if(a=+u(+(o+-3.141592653589793))<1e-16,t=+s[e>>3],a){t-=n,s[r>>3]=t,a=r;break}if(l=+A(+n),n=+d(+n),t=l*+d(+t)+ +A(+o)*(n*+A(+t)),t=+m(+((t=t>1?1:t)<-1?-1:t)),s[r>>3]=t,+u(+(t+-1.5707963267948966))<1e-16)return s[r>>3]=1.5707963267948966,void(s[r+8>>3]=0);if(+u(+(t+1.5707963267948966))<1e-16)return s[r>>3]=-1.5707963267948966,void(s[r+8>>3]=0);if(c=1/+A(+t),o=n*+d(+o)*c,n=+s[e>>3],t=c*((l-+d(+t)*+d(+n))/+A(+n)),l=o>1?1:o,t=t>1?1:t,(t=+s[e+8>>3]+ +_(+(l<-1?-1:l),+(t<-1?-1:t)))>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);return void(s[r+8>>3]=t)}t=+s[e>>3]+n,s[r>>3]=t,a=r}while(0);if(+u(+(t+-1.5707963267948966))<1e-16)return s[a>>3]=1.5707963267948966,void(s[r+8>>3]=0);if(+u(+(t+1.5707963267948966))<1e-16)return s[a>>3]=-1.5707963267948966,void(s[r+8>>3]=0);if(t=+s[e+8>>3],t>3.141592653589793)do{t+=-6.283185307179586}while(t>3.141592653589793);if(t<-3.141592653589793)do{t+=6.283185307179586}while(t<-3.141592653589793);s[r+8>>3]=t}(15600+(t<<4)|0,+ut(+s[15920+(24*t|0)>>3]-h),l,a)}function Le(e,t,n){t|=0,n|=0;var r,s;r=D,D=D+16|0,oe((e|=0)+4|0,s=r),De(s,0|i[e>>2],t,0,n),D=r}function Ie(e,t,n,r,a){e|=0,t|=0,n|=0,r|=0,a|=0;var o,l,u,c,h,A,d,p,f,m,g,_,v,y,b,x,T,S,w,E,C,R,N=0,P=0,L=0,I=0,U=0,O=0;if(R=D,D=D+272|0,I=R+240|0,w=R,E=R+224|0,C=R+208|0,g=R+176|0,_=R+160|0,v=R+192|0,y=R+144|0,b=R+128|0,x=R+112|0,T=R+96|0,S=R+80|0,i[(N=R+256|0)>>2]=t,i[I>>2]=i[e>>2],i[I+4>>2]=i[e+4>>2],i[I+8>>2]=i[e+8>>2],i[I+12>>2]=i[e+12>>2],Ue(I,N,w),i[a>>2]=0,(0|(I=r+n+(5==(0|r)&1)|0))<=(0|n))D=R;else{l=E+4|0,u=g+4|0,c=n+5|0,h=16880+((o=0|i[N>>2])<<2)|0,A=16960+(o<<2)|0,d=b+8|0,p=x+8|0,f=T+8|0,m=C+4|0,L=n;e:for(;;){P=w+((0|L)%5<<4)|0,i[C>>2]=i[P>>2],i[C+4>>2]=i[P+4>>2],i[C+8>>2]=i[P+8>>2],i[C+12>>2]=i[P+12>>2];do{}while(2==(0|Oe(C,o,0,1)));if((0|L)>(0|n)&!!(0|Je(t))){if(i[g>>2]=i[C>>2],i[g+4>>2]=i[C+4>>2],i[g+8>>2]=i[C+8>>2],i[g+12>>2]=i[C+12>>2],oe(l,_),r=0|i[g>>2],N=0|i[17040+(80*r|0)+(i[E>>2]<<2)>>2],i[g>>2]=i[18640+(80*r|0)+(20*N|0)>>2],(0|(P=0|i[18640+(80*r|0)+(20*N|0)+16>>2]))>0){e=0;do{ve(u),e=e+1|0}while((0|e)<(0|P))}switch(P=18640+(80*r|0)+(20*N|0)+4|0,i[v>>2]=i[P>>2],i[v+4>>2]=i[P+4>>2],i[v+8>>2]=i[P+8>>2],ce(v,3*(0|i[h>>2])|0),le(u,v,u),ae(u),oe(u,y),U=+(0|i[A>>2]),s[b>>3]=3*U,s[d>>3]=0,O=-1.5*U,s[x>>3]=O,s[p>>3]=2.598076211353316*U,s[T>>3]=O,s[f>>3]=-2.598076211353316*U,0|i[17040+(80*(0|i[g>>2])|0)+(i[C>>2]<<2)>>2]){case 1:e=x,r=b;break;case 3:e=T,r=x;break;case 2:e=b,r=T;break;default:e=12;break e}Bt(_,y,r,e,S),De(S,0|i[g>>2],o,1,a+8+(i[a>>2]<<4)|0),i[a>>2]=1+(0|i[a>>2])}if((0|L)<(0|c)&&(oe(m,g),De(g,0|i[C>>2],o,1,a+8+(i[a>>2]<<4)|0),i[a>>2]=1+(0|i[a>>2])),i[E>>2]=i[C>>2],i[E+4>>2]=i[C+4>>2],i[E+8>>2]=i[C+8>>2],i[E+12>>2]=i[C+12>>2],(0|(L=L+1|0))>=(0|I)){e=3;break}}3!=(0|e)?12==(0|e)&&M(26970,27017,572,27027):D=R}}function Ue(e,t,n){e|=0,t|=0,n|=0;var r,s=0,a=0,o=0,l=0,u=0;r=D,D=D+128|0,a=r,l=20240,u=(o=s=r+64|0)+60|0;do{i[o>>2]=i[l>>2],o=o+4|0,l=l+4|0}while((0|o)<(0|u));l=20304,u=(o=a)+60|0;do{i[o>>2]=i[l>>2],o=o+4|0,l=l+4|0}while((0|o)<(0|u));s=(u=!(0|Je(0|i[t>>2])))?s:a,Te(a=e+4|0),Se(a),0|Je(0|i[t>>2])&&(ge(a),i[t>>2]=1+(0|i[t>>2])),i[n>>2]=i[e>>2],le(a,s,t=n+4|0),ae(t),i[n+16>>2]=i[e>>2],le(a,s+12|0,t=n+20|0),ae(t),i[n+32>>2]=i[e>>2],le(a,s+24|0,t=n+36|0),ae(t),i[n+48>>2]=i[e>>2],le(a,s+36|0,t=n+52|0),ae(t),i[n+64>>2]=i[e>>2],le(a,s+48|0,n=n+68|0),ae(n),D=r}function Oe(e,t,n,r){n|=0,r|=0;var s,a,o,l,u,c,h=0,A=0,d=0,p=0,f=0;if(c=D,D=D+32|0,u=c+12|0,a=c,f=(e|=0)+4|0,p=0|i[16960+((t|=0)<<2)>>2],p=(l=!!(0|r))?3*p|0:p,h=0|i[f>>2],s=0|i[(o=e+8|0)>>2],l){if((0|(h=s+h+(r=0|i[(A=e+12|0)>>2])|0))==(0|p))return D=c,0|(f=1);d=A}else h=s+h+(r=0|i[(d=e+12|0)>>2])|0;if((0|h)<=(0|p))return D=c,0|(f=0);do{if((0|r)>0){if(r=0|i[e>>2],(0|s)>0){A=18640+(80*r|0)+60|0,r=e;break}r=18640+(80*r|0)+40|0,n?(ie(u,p,0,0),ue(f,u,a),ye(a),le(a,u,f),A=r,r=e):(A=r,r=e)}else A=18640+(80*(0|i[e>>2])|0)+20|0,r=e}while(0);if(i[r>>2]=i[A>>2],(0|i[(h=A+16|0)>>2])>0){r=0;do{ve(f),r=r+1|0}while((0|r)<(0|i[h>>2]))}return e=A+4|0,i[u>>2]=i[e>>2],i[u+4>>2]=i[e+4>>2],i[u+8>>2]=i[e+8>>2],t=0|i[16880+(t<<2)>>2],ce(u,l?3*t|0:t),le(f,u,f),ae(f),r=l&&((0|i[o>>2])+(0|i[f>>2])+(0|i[d>>2])|0)==(0|p)?1:2,D=c,0|(f=r)}function Be(e,t){e|=0,t|=0;var n=0;do{n=0|Oe(e,t,0,1)}while(2==(0|n));return 0|n}function Fe(e,t,n,r,a){e|=0,t|=0,n|=0,r|=0,a|=0;var o,l,u,c,h,A,d,p,f,m,g,_,v,y,b,x,T,S,w=0,E=0,C=0,R=0,N=0;if(S=D,D=D+240|0,y=S+208|0,b=S,x=S+192|0,T=S+176|0,f=S+160|0,m=S+144|0,g=S+128|0,_=S+112|0,v=S+96|0,i[(w=S+224|0)>>2]=t,i[y>>2]=i[e>>2],i[y+4>>2]=i[e+4>>2],i[y+8>>2]=i[e+8>>2],i[y+12>>2]=i[e+12>>2],ke(y,w,b),i[a>>2]=0,(0|(p=r+n+(6==(0|r)&1)|0))<=(0|n))D=S;else{l=n+6|0,u=16960+((o=0|i[w>>2])<<2)|0,c=m+8|0,h=g+8|0,A=_+8|0,d=x+4|0,E=0,C=n,r=-1;e:for(;;){if(e=b+((w=(0|C)%6|0)<<4)|0,i[x>>2]=i[e>>2],i[x+4>>2]=i[e+4>>2],i[x+8>>2]=i[e+8>>2],i[x+12>>2]=i[e+12>>2],e=E,E=0|Oe(x,o,0,1),(0|C)>(0|n)&!!(0|Je(t))&&(1!=(0|e)&&(0|i[x>>2])!=(0|r))){switch(oe(b+((w+5|0)%6<<4)+4|0,T),oe(b+(w<<4)+4|0,f),R=+(0|i[u>>2]),s[m>>3]=3*R,s[c>>3]=0,N=-1.5*R,s[g>>3]=N,s[h>>3]=2.598076211353316*R,s[_>>3]=N,s[A>>3]=-2.598076211353316*R,w=0|i[y>>2],0|i[17040+(80*w|0)+(((0|r)==(0|w)?i[x>>2]:r)<<2)>>2]){case 1:e=g,r=m;break;case 3:e=_,r=g;break;case 2:e=m,r=_;break;default:e=8;break e}Bt(T,f,r,e,v),0|Ft(T,v)||0|Ft(f,v)||(De(v,0|i[y>>2],o,1,a+8+(i[a>>2]<<4)|0),i[a>>2]=1+(0|i[a>>2]))}if((0|C)<(0|l)&&(oe(d,T),De(T,0|i[x>>2],o,1,a+8+(i[a>>2]<<4)|0),i[a>>2]=1+(0|i[a>>2])),(0|(C=C+1|0))>=(0|p)){e=3;break}r=0|i[x>>2]}3!=(0|e)?8==(0|e)&&M(27054,27017,737,27099):D=S}}function ke(e,t,n){e|=0,t|=0,n|=0;var r,s=0,a=0,o=0,l=0,u=0;r=D,D=D+160|0,a=r,l=20368,u=(o=s=r+80|0)+72|0;do{i[o>>2]=i[l>>2],o=o+4|0,l=l+4|0}while((0|o)<(0|u));l=20448,u=(o=a)+72|0;do{i[o>>2]=i[l>>2],o=o+4|0,l=l+4|0}while((0|o)<(0|u));s=(u=!(0|Je(0|i[t>>2])))?s:a,Te(a=e+4|0),Se(a),0|Je(0|i[t>>2])&&(ge(a),i[t>>2]=1+(0|i[t>>2])),i[n>>2]=i[e>>2],le(a,s,t=n+4|0),ae(t),i[n+16>>2]=i[e>>2],le(a,s+12|0,t=n+20|0),ae(t),i[n+32>>2]=i[e>>2],le(a,s+24|0,t=n+36|0),ae(t),i[n+48>>2]=i[e>>2],le(a,s+36|0,t=n+52|0),ae(t),i[n+64>>2]=i[e>>2],le(a,s+48|0,t=n+68|0),ae(t),i[n+80>>2]=i[e>>2],le(a,s+60|0,n=n+84|0),ae(n),D=r}function qe(e,t){return t=0|un(0|(e|=0),0|(t|=0),45),w(),127&t}function Ve(e,t){e|=0;var n=0,i=0,s=0,a=0;return!0&134217728==(-16777216&(t|=0))?(i=0|un(0|e,0|t,52),w(),i&=15,n=0|un(0|e,0|t,45),w(),(n&=127)>>>0>121?0|(e=0):!(613566756&(a=0|cn(0|(s=0|un(0|e,0|t,0|(a=3*(15^i)|0))),0|w(),0|a))&(0|en(-1227133514,-1171,0|a,0|(s=0|w()))))&!(4681&s&w())&&15==(0|i)|!(0|(a=0|un(0|(0|cn(0|~e,0|~t,0|(a=19+(3*i|0)|0))),0|w(),0|a)))&!(0|w())?0|r[20528+n|0]?!(0|e)&!(0|(t&=8191))?0|(a=1):(a=0|hn(0|e,0|t),w(),0|!!((63-a|0)%3|0)):0|(a=1):0|(a=0)):0|(e=0)}function ze(e,t,n,r){e|=0,n|=0,r|=0;var s=0,a=0,o=0,l=0;if(s=0|cn(0|(t|=0),0,52),a=0|w(),n=0|cn(0|n,0,45),n=0|a|w()|134225919,(0|t)<1)return a=-1,r=n,i[(t=e)>>2]=a,void(i[(e=e+4|0)>>2]=r);for(a=1,s=-1;l=0|cn(7,0,0|(o=3*(15-a|0)|0)),n&=~w(),s=s&~l|(o=0|cn(0|r,0,0|o)),n=0|n|w(),(0|a)!=(0|t);)a=a+1|0;i[(o=l=e)>>2]=s,i[(l=l+4|0)>>2]=n}function Ge(e,t,n,r){n|=0,r|=0;var s=0,a=0;if(a=0|un(0|(e|=0),0|(t|=0),52),w(),n>>>0>15)return 0|(r=4);if((0|(a&=15))<(0|n))return 0|(r=12);if((0|a)==(0|n))return i[r>>2]=e,i[r+4>>2]=t,0|(r=0);if(s=0|cn(0|n,0,52),s|=e,e=w()|-15728641&t,(0|a)>(0|n))do{t=0|cn(7,0,3*(14-n|0)|0),n=n+1|0,s|=t,e=0|w()|e}while((0|n)<(0|a));return i[r>>2]=s,i[r+4>>2]=e,0|(r=0)}function He(e,t,n,r){n|=0,r|=0;var s=0,a=0,o=0;if(a=0|un(0|(e|=0),0|(t|=0),52),w(),!((0|n)<16&(0|(a&=15))<=(0|n)))return 0|(r=4);s=n-a|0,n=0|un(0|e,0|t,45),w();e:do{if(0|z(127&n)){t:do{if(0|a){for(n=1;!((o=0|cn(7,0,3*(15-n|0)|0))&e|0)&!((0|w())&t);){if(!(n>>>0>>0))break t;n=n+1|0}n=0|St(7,0,s,((0|s)<0)<<31>>31),s=0|w();break e}}while(0);n=0|Jt(0|(n=0|sn(0|(n=0|St(7,0,s,((0|s)<0)<<31>>31)),0|w(),5,0)),0|w(),-5,-1),n=0|Jt(0|(n=0|rn(0|n,0|w(),6,0)),0|w(),1,0),s=0|w()}else n=0|St(7,0,s,((0|s)<0)<<31>>31),s=0|w()}while(0);return i[(o=r)>>2]=n,i[o+4>>2]=s,0|(o=0)}function je(e,t){var n=0,r=0,i=0;if(i=0|un(0|(e|=0),0|(t|=0),45),w(),!(0|z(127&i)))return 0|(i=0);i=0|un(0|e,0|t,52),w(),i&=15;e:do{if(i)for(r=1;;){if(n=0|un(0|e,0|t,3*(15-r|0)|0),w(),0|(n&=7))break e;if(!(r>>>0>>0)){n=0;break}r=r+1|0}else n=0}while(0);return 0|(i=1&!(0|n))}function We(e,t,n,r){return e|=0,t|=0,(0|(r|=0))<(0|(n|=0))?(r=e,S(0|(n=t)),0|r):(n=0|cn(-1,-1,3+(3*(r-n|0)|0)|0),r=0|cn(0|~n,0|~w(),3*(15-r|0)|0),n=~w()&t,r=~r&e,S(0|n),0|r)}function Xe(e,t,n,r){n|=0,r|=0;var s=0;return s=0|un(0|(e|=0),0|(t|=0),52),w(),(0|n)<16&(0|(s&=15))<=(0|n)?((0|s)<(0|n)&&(s=0|cn(-1,-1,3+(3*(n+-1-s|0)|0)|0),s=0|cn(0|~s,0|~w(),3*(15-n|0)|0),t=~w()&t,e&=~s),s=0|cn(0|n,0,52),n=-15728641&t|w(),i[r>>2]=e|s,i[r+4>>2]=n,0|(r=0)):0|(r=4)}function Qe(e,t){var n=0,r=0,i=0;if(i=0|un(0|(e|=0),0|(t|=0),52),w(),!(i&=15))return 0|(i=0);for(r=1;;){if(n=0|un(0|e,0|t,3*(15-r|0)|0),w(),0|(n&=7)){r=5;break}if(!(r>>>0>>0)){n=0,r=5;break}r=r+1|0}return 5==(0|r)?0|n:0}function $e(e,t){var n=0,r=0,i=0,s=0,a=0,o=0,l=0;if(l=0|un(0|(e|=0),0|(t|=0),52),w(),!(l&=15))return l=e,S(0|(o=t)),0|l;for(o=1,n=0;;){r=0|cn(7,0,0|(s=3*(15-o|0)|0)),i=0|w(),a=0|un(0|e,0|t,0|s),w(),e=(s=0|cn(0|be(7&a),0,0|s))|e&~r,t=(a=0|w())|t&~i;e:do{if(!n)if(!(s&r|0)&!(a&i|0))n=0;else if(r=0|un(0|e,0|t,52),w(),r&=15){n=1;t:for(;;){switch(a=0|un(0|e,0|t,3*(15-n|0)|0),w(),7&a){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(i=0|un(0|e,0|t,0|(a=3*(15-n|0)|0)),w(),s=0|cn(7,0,0|a),t&=~w(),e=e&~s|(a=0|cn(0|be(7&i),0,0|a)),t=0|t|w(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(o>>>0>>0))break;o=o+1|0}return S(0|t),0|e}function Ye(e,t){var n=0,r=0,i=0,s=0,a=0;if(r=0|un(0|(e|=0),0|(t|=0),52),w(),!(r&=15))return r=e,S(0|(n=t)),0|r;for(n=1;a=0|un(0|e,0|t,0|(s=3*(15-n|0)|0)),w(),i=0|cn(7,0,0|s),t&=~w(),e=(s=0|cn(0|be(7&a),0,0|s))|e&~i,t=0|w()|t,n>>>0>>0;)n=n+1|0;return S(0|t),0|e}function Ke(e,t){var n=0,r=0,i=0,s=0,a=0,o=0,l=0;if(l=0|un(0|(e|=0),0|(t|=0),52),w(),!(l&=15))return l=e,S(0|(o=t)),0|l;for(o=1,n=0;;){r=0|cn(7,0,0|(s=3*(15-o|0)|0)),i=0|w(),a=0|un(0|e,0|t,0|s),w(),e=(s=0|cn(0|xe(7&a),0,0|s))|e&~r,t=(a=0|w())|t&~i;e:do{if(!n)if(!(s&r|0)&!(a&i|0))n=0;else if(r=0|un(0|e,0|t,52),w(),r&=15){n=1;t:for(;;){switch(a=0|un(0|e,0|t,3*(15-n|0)|0),w(),7&a){case 1:break t;case 0:break;default:n=1;break e}if(!(n>>>0>>0)){n=1;break e}n=n+1|0}for(n=1;;){if(s=0|cn(7,0,0|(i=3*(15-n|0)|0)),a=t&~w(),t=0|un(0|e,0|t,0|i),w(),e=e&~s|(t=0|cn(0|xe(7&t),0,0|i)),t=0|a|w(),!(n>>>0>>0)){n=1;break}n=n+1|0}}else n=1}while(0);if(!(o>>>0>>0))break;o=o+1|0}return S(0|t),0|e}function Ze(e,t){var n=0,r=0,i=0,s=0,a=0;if(r=0|un(0|(e|=0),0|(t|=0),52),w(),!(r&=15))return r=e,S(0|(n=t)),0|r;for(n=1;s=0|cn(7,0,0|(a=3*(15-n|0)|0)),i=t&~w(),t=0|un(0|e,0|t,0|a),w(),e=(t=0|cn(0|xe(7&t),0,0|a))|e&~s,t=0|w()|i,n>>>0>>0;)n=n+1|0;return S(0|t),0|e}function Je(e){return(0|(e|=0))%2|0}function et(e,t,n){n|=0;var r,s=0;return r=D,D=D+16|0,s=r,(t|=0)>>>0>15?(D=r,0|(s=4)):2146435072&~i[(e|=0)+4>>2]&&2146435072&~i[e+8+4>>2]?(function(e,t,n){var r,i;r=D,D=D+16|0,Pe(e|=0,t|=0,n|=0,i=r),se(i,n+4|0),D=r}(e,t,s),t=0|function(e,t){e|=0;var n,r=0,s=0,a=0,o=0,l=0,u=0,c=0,h=0;if(n=D,D=D+64|0,u=n+40|0,s=n+24|0,a=n+12|0,o=n,cn(0|(t|=0),0,52),r=134225919|w(),!t)return(0|i[e+4>>2])>2||(0|i[e+8>>2])>2||(0|i[e+12>>2])>2?(u=0,S(0|(l=0)),D=n,0|u):(cn(0|H(e),0,45),l=0|w()|r,u=-1,S(0|l),D=n,0|u);if(i[u>>2]=i[e>>2],i[u+4>>2]=i[e+4>>2],i[u+8>>2]=i[e+8>>2],i[u+12>>2]=i[e+12>>2],l=u+4|0,(0|t)>0)for(e=-1;i[s>>2]=i[l>>2],i[s+4>>2]=i[l+4>>2],i[s+8>>2]=i[l+8>>2],1&t?(pe(l),i[a>>2]=i[l>>2],i[a+4>>2]=i[l+4>>2],i[a+8>>2]=i[l+8>>2],me(a)):(fe(l),i[a>>2]=i[l>>2],i[a+4>>2]=i[l+4>>2],i[a+8>>2]=i[l+8>>2],ge(a)),ue(s,a,o),ae(o),c=0|cn(7,0,0|(h=3*(15-t|0)|0)),r&=~w(),e=(h=0|cn(0|he(o),0,0|h))|e&~c,r=0|w()|r,(0|t)>1;)t=t+-1|0;else e=-1;e:do{if((0|i[l>>2])<=2&&(0|i[u+8>>2])<=2&&(0|i[u+12>>2])<=2){if(t=0|cn(0|(s=0|H(u)),0,45),t|=e,e=w()|-1040385&r,o=0|j(u),!(0|z(s))){if((0|o)<=0)break;for(a=0;;){if(s=0|un(0|t,0|e,52),w(),s&=15)for(r=1;u=0|un(0|t,0|e,0|(h=3*(15-r|0)|0)),w(),c=0|cn(7,0,0|h),e&=~w(),t=t&~c|(h=0|cn(0|be(7&u),0,0|h)),e=0|e|w(),r>>>0>>0;)r=r+1|0;if((0|(a=a+1|0))==(0|o))break e}}a=0|un(0|t,0|e,52),w(),a&=15;t:do{if(a){r=1;n:for(;;){switch(h=0|un(0|t,0|e,3*(15-r|0)|0),w(),7&h){case 1:break n;case 0:break;default:break t}if(!(r>>>0>>0))break t;r=r+1|0}if(0|W(s,0|i[u>>2]))for(r=1;c=0|cn(7,0,0|(u=3*(15-r|0)|0)),h=e&~w(),e=0|un(0|t,0|e,0|u),w(),t=t&~c|(e=0|cn(0|xe(7&e),0,0|u)),e=0|h|w(),r>>>0>>0;)r=r+1|0;else for(r=1;u=0|un(0|t,0|e,0|(h=3*(15-r|0)|0)),w(),c=0|cn(7,0,0|h),e&=~w(),t=t&~c|(h=0|cn(0|be(7&u),0,0|h)),e=0|e|w(),r>>>0>>0;)r=r+1|0}}while(0);if((0|o)>0){r=0;do{t=0|$e(t,e),e=0|w(),r=r+1|0}while((0|r)!=(0|o))}}else t=0,e=0}while(0);return h=t,S(0|(c=e)),D=n,0|h}(s,t),s=0|w(),i[n>>2]=t,i[n+4>>2]=s,!(0|t)&!(0|s)&&M(27795,27122,959,27145),D=r,0|(s=0)):(D=r,0|(s=3))}function tt(e,t,n){var r,s=0,a=0,o=0;if(r=(n|=0)+4|0,a=0|un(0|(e|=0),0|(t|=0),52),w(),a&=15,o=0|un(0|e,0|t,45),w(),s=!(0|a),0|z(127&o)){if(s)return 0|(o=1);s=1}else{if(s)return 0|(o=0);s=0|i[r>>2]||0|i[n+8>>2]?1:1&!!(0|i[n+12>>2])}for(n=1;1&n?me(r):ge(r),o=0|un(0|e,0|t,3*(15-n|0)|0),w(),_e(r,7&o),n>>>0>>0;)n=n+1|0;return 0|s}function nt(e,t,n){n|=0;var r,s,a=0,o=0,l=0,u=0,c=0,h=0;if(s=D,D=D+16|0,r=s,h=0|un(0|(e|=0),0|(t|=0),45),w(),(h&=127)>>>0>121)return i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,i[n+12>>2]=0,D=s,0|(h=5);e:do{if(0|z(h)&&(l=0|un(0|e,0|t,52),w(),0|(l&=15))){a=1;t:for(;;){switch(c=0|un(0|e,0|t,3*(15-a|0)|0),w(),7&c){case 5:break t;case 0:break;default:a=t;break e}if(!(a>>>0>>0)){a=t;break e}a=a+1|0}for(o=1,a=t;u=0|cn(7,0,0|(t=3*(15-o|0)|0)),c=a&~w(),a=0|un(0|e,0|a,0|t),w(),e=e&~u|(a=0|cn(0|xe(7&a),0,0|t)),a=0|c|w(),o>>>0>>0;)o=o+1|0}else a=t}while(0);if(c=7696+(28*h|0)|0,i[n>>2]=i[c>>2],i[n+4>>2]=i[c+4>>2],i[n+8>>2]=i[c+8>>2],i[n+12>>2]=i[c+12>>2],!(0|tt(e,a,n)))return D=s,0|(h=0);if(u=n+4|0,i[r>>2]=i[u>>2],i[r+4>>2]=i[u+4>>2],i[r+8>>2]=i[u+8>>2],l=0|un(0|e,0|a,52),w(),c=15&l,1&l?(ge(u),l=c+1|0):l=c,0|z(h)){e:do{if(c)for(t=1;;){if(o=0|un(0|e,0|a,3*(15-t|0)|0),w(),0|(o&=7)){a=o;break e}if(!(t>>>0>>0)){a=0;break}t=t+1|0}else a=0}while(0);a=4==(0|a)&1}else a=0;if(0|Oe(n,l,a,0)){if(0|z(h))do{}while(0|Oe(n,l,0,0));(0|l)!=(0|c)&&fe(u)}else(0|l)!=(0|c)&&(i[u>>2]=i[r>>2],i[u+4>>2]=i[r+4>>2],i[u+8>>2]=i[r+8>>2]);return D=s,0|(h=0)}function rt(e,t,n){n|=0;var r,i,s=0;return i=D,D=D+16|0,0|(s=0|nt(e|=0,t|=0,r=i))?(D=i,0|s):(s=0|un(0|e,0|t,52),w(),Le(r,15&s,n),D=i,0|(s=0))}function it(e,t,n){n|=0;var r,i=0,s=0,a=0;if(r=D,D=D+16|0,0|(i=0|nt(e|=0,t|=0,a=r)))return D=r,0|(a=i);i=0|un(0|e,0|t,45),w(),i=!(0|z(127&i)),s=0|un(0|e,0|t,52),w(),s&=15;e:do{if(!i){if(0|s)for(i=1;;){if(!(!((0|cn(7,0,3*(15-i|0)|0))&e|0)&!((0|w())&t)))break e;if(!(i>>>0>>0))break;i=i+1|0}return Ie(a,s,0,5,n),D=r,0|0}}while(0);return Fe(a,s,0,6,n),D=r,0|0}function st(e,t){t|=0;var n=0,r=0,s=0,a=0,o=0,l=0,u=0;if((e|=0)>>>0>15)return 0|(l=4);if(cn(0|e,0,52),l=134225919|w(),!e){n=0,r=0;do{0|z(r)&&(cn(0|r,0,45),o=0|l|w(),i[(e=t+(n<<3)|0)>>2]=-1,i[e+4>>2]=o,n=n+1|0),r=r+1|0}while(122!=(0|r));return 0|(n=0)}n=0,o=0;do{if(0|z(o)){for(cn(0|o,0,45),r=1,s=-1,a=0|l|w();s&=~(u=0|cn(7,0,3*(15-r|0)|0)),a&=~w(),(0|r)!=(0|e);)r=r+1|0;i[(u=t+(n<<3)|0)>>2]=s,i[u+4>>2]=a,n=n+1|0}o=o+1|0}while(122!=(0|o));return 0|(n=0)}function at(e,t,n,r){e|=0,r|=0;var s=0,a=0,o=0;s=0|un(0|(t|=0),0|(n|=0),52),w(),!(0|t)&!(0|n)|(0|r)>15|(0|(s&=15))>(0|r)?(a=-1,t=-1,n=0,s=0):(t=0|We(t,n,s+1|0,r),o=-15728641&w(),n=0|cn(0|r,0,52),a=s,t=(t=!(0|je(n|=t,o=0|o|w())))?-1:r,s=o),i[(o=e)>>2]=n,i[o+4>>2]=s,i[e+8>>2]=a,i[e+12>>2]=t}function ot(e,t,n,r){n|=0,r|=0;var s=0,a=0;return s=0|un(0|(e|=0),0|(t|=0),52),w(),s&=15,i[(a=r+8|0)>>2]=s,!(0|e)&!(0|t)|(0|n)>15|(0|s)>(0|n)?(i[(n=r)>>2]=0,i[n+4>>2]=0,i[a>>2]=-1,void(i[r+12>>2]=-1)):(e=0|We(e,t,s+1|0,n),a=-15728641&w(),s=0|cn(0|n,0,52),s|=e,a=0|a|w(),i[(e=r)>>2]=s,i[e+4>>2]=a,e=r+12|0,0|je(s,a)?void(i[e>>2]=n):void(i[e>>2]=-1))}function lt(e){var t,n=0,r=0,s=0,a=0,o=0,l=0,u=0,c=0;if(!(!(0|(n=0|i[(r=e|=0)>>2]))&!(0|(r=0|i[r+4>>2]))||(s=0|un(0|n,0|r,52),w(),n=0|Jt(0|(u=0|cn(1,0,3*(15^(s&=15))|0)),0|w(),0|n,0|r),r=0|w(),i[(u=e)>>2]=n,i[u+4>>2]=r,(0|s)<(0|(l=0|i[(u=e+8|0)>>2]))))){for(t=e+12|0,o=s;;){if((0|o)==(0|l)){s=5;break}if(c=(0|o)==(0|i[t>>2]),s=0|un(0|n,0|r,0|(a=3*(15-o|0)|0)),w(),c&1==(0|(s&=7))&!0){s=7;break}if(!(7==(0|s)&!0)){s=10;break}if(n=0|Jt(0|n,0|r,0|(c=0|cn(1,0,0|a)),0|w()),r=0|w(),i[(c=e)>>2]=n,i[c+4>>2]=r,!((0|o)>(0|l))){s=10;break}o=o+-1|0}if(5==(0|s))return i[(c=e)>>2]=0,i[c+4>>2]=0,i[u>>2]=-1,void(i[t>>2]=-1);if(7==(0|s))return l=0|Jt(0|n,0|r,0|(l=0|cn(1,0,0|a)),0|w()),u=0|w(),i[(c=e)>>2]=l,i[c+4>>2]=u,void(i[t>>2]=o+-1)}}function ut(e){var t;return t=(e=+e)<0?e+6.283185307179586:e,+(e>=6.283185307179586?t+-6.283185307179586:t)}function ct(e,t){return t|=0,+u(+(+s[(e|=0)>>3]-+s[t>>3]))<17453292519943298e-27?0|(t=+u(+(+s[e+8>>3]-+s[t+8>>3]))<17453292519943298e-27):0|(t=0)}function ht(e,t){switch(e=+e,0|(t|=0)){case 1:e=e<0?e+6.283185307179586:e;break;case 2:e=e>0?e+-6.283185307179586:e}return+e}function At(e,t){e|=0;var n,r,i,a=0;return r=+s[(t|=0)>>3],n=+s[e>>3],a=(i=+d(.5*(r-n)))*i+(a=+d(.5*(+s[t+8>>3]-+s[e+8>>3])))*(+A(+r)*+A(+n)*a),2*+_(+ +c(+a),+ +c(+(1-a)))*6371.007180918475}function dt(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[20656+(e<<3)>>3],0|(t=0))}function pt(e,t){t|=0;var n=0;return(e|=0)>>>0>15?0|(t=4):(n=0|sn(0|(n=0|St(7,0,e,((0|e)<0)<<31>>31)),0|w(),120,0),e=0|w(),i[t>>2]=2|n,i[t+4>>2]=e,0|(t=0))}function ft(e,t,n){e|=0,n|=0;var r,i,a,o,l=0,u=0,h=0,f=0,m=0,v=0;return v=+s[(t|=0)>>3],a=+s[e>>3],m=+d(.5*(v-a)),h=+s[t+8>>3],i=+s[e+8>>3],f=+d(.5*(h-i)),r=+A(+a),o=+A(+v),f=2*+_(+ +c(+(f=m*m+f*(o*r*f))),+ +c(+(1-f))),m=+s[n>>3],v=+d(.5*(m-v)),l=+s[n+8>>3],h=+d(.5*(l-h)),u=+A(+m),h=2*+_(+ +c(+(h=v*v+h*(o*u*h))),+ +c(+(1-h))),m=+d(.5*(a-m)),l=+d(.5*(i-l)),l=2*+_(+ +c(+(l=m*m+l*(r*u*l))),+ +c(+(1-l))),4*+g(+ +c(+ +p(.5*(u=.5*(f+h+l)))*+p(.5*(u-f))*+p(.5*(u-h))*+p(.5*(u-l))))}function mt(e,t,n){n|=0;var r,a,o,l=0,u=0;if(o=D,D=D+192|0,a=o,0|(u=0|rt(e|=0,t|=0,r=o+168|0)))return D=o,0|(n=u);if(0|it(e,t,a)&&M(27795,27190,415,27199),(0|(t=0|i[a>>2]))>0){if(l=+ft(a+8|0,a+8+((1!=(0|t)&1)<<4)|0,r)+0,1!=(0|t)){e=1;do{l+=+ft(a+8+((u=e)<<4)|0,a+8+((0|(e=e+1|0))%(0|t)<<4)|0,r)}while((0|e)<(0|t))}}else l=0;return s[n>>3]=l,D=o,0|(n=0)}function gt(e){e|=0;var t,n,r=0;return(t=0|Zt(1,12))||M(27280,27235,49,27293),0|(r=0|i[(n=e+4|0)>>2])?(i[(r=r+8|0)>>2]=t,i[n>>2]=t,0|t):(0|i[e>>2]&&M(27310,27235,61,27333),i[(r=e)>>2]=t,i[n>>2]=t,0|t)}function _t(e,t){e|=0,t|=0;var n,r;return(r=0|Yt(24))||M(27347,27235,78,27361),i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],i[r+12>>2]=i[t+12>>2],i[r+16>>2]=0,0|(n=0|i[(t=e+4|0)>>2])?(i[n+16>>2]=r,i[t>>2]=r,0|r):(0|i[e>>2]&&M(27376,27235,82,27361),i[e>>2]=r,i[t>>2]=r,0|r)}function vt(e){var t=0,n=0,r=0,s=0;if(e|=0)for(r=1;;){if(0|(t=0|i[e>>2]))do{if(0|(n=0|i[t>>2]))do{s=n,n=0|i[n+16>>2],Kt(s)}while(0|n);s=t,t=0|i[t+8>>2],Kt(s)}while(0|t);if(t=e,e=0|i[e+8>>2],r||Kt(t),!e)break;r=0}}function yt(e){var t,n,r=0,a=0,o=0,l=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0,T=0,S=0,w=0,E=0,C=0,R=0,N=0,P=0,D=0,L=0,I=0,U=0,O=0;if(0|i[(l=(e|=0)+8|0)>>2])return 0|(O=1);if(!(o=0|i[e>>2]))return 0|(O=0);r=o,a=0;do{a=a+1|0,r=0|i[r+8>>2]}while(0|r);if(a>>>0<2)return 0|(O=0);(n=0|Yt(a<<2))||M(27396,27235,317,27415),(t=0|Yt(a<<5))||M(27437,27235,321,27415),i[e>>2]=0,i[(C=e+4|0)>>2]=0,i[l>>2]=0,a=0,I=0,E=0,m=0;e:for(;;){if(f=0|i[o>>2]){c=0,h=f;do{if(d=+s[h+8>>3],r=h,h=0|i[h+16>>2],A=+s[(l=(p=!(0|h))?f:h)+8>>3],+u(+(d-A))>3.141592653589793){O=14;break}c+=(A-d)*(+s[r>>3]+ +s[l>>3])}while(!p);if(14==(0|O)){O=0,c=0,r=f;do{w=+s[r+8>>3],D=0|i[(L=r+16|0)>>2],S=+s[(D=0|D?D:f)+8>>3],c+=(+s[r>>3]+ +s[D>>3])*((S<0?S+6.283185307179586:S)-(w<0?w+6.283185307179586:w)),r=0|i[(0|r?L:o)>>2]}while(0|r)}c>0?(i[n+(I<<2)>>2]=o,I=I+1|0,l=E,r=m):O=19}else O=19;if(19==(0|O)){O=0;do{if(!a){if(m){l=C,h=m+8|0,r=o,a=e;break}if(0|i[e>>2]){O=27;break e}l=C,h=e,r=o,a=e;break}if(0|i[(r=a+8|0)>>2]){O=21;break e}if(!(a=0|Zt(1,12))){O=23;break e}i[r>>2]=a,l=a+4|0,h=a,r=m}while(0);if(i[h>>2]=o,i[l>>2]=o,h=t+(E<<5)|0,p=0|i[o>>2]){for(s[(f=t+(E<<5)+8|0)>>3]=17976931348623157e292,s[(m=t+(E<<5)+24|0)>>3]=17976931348623157e292,s[h>>3]=-17976931348623157e292,s[(g=t+(E<<5)+16|0)>>3]=-17976931348623157e292,x=17976931348623157e292,T=-17976931348623157e292,l=0,_=p,d=17976931348623157e292,y=17976931348623157e292,b=-17976931348623157e292,A=-17976931348623157e292;c=+s[_>>3],w=+s[_+8>>3],_=0|i[_+16>>2],S=+s[((v=!(0|_))?p:_)+8>>3],c>3]=c,d=c),w>3]=w,y=w),c>b?s[h>>3]=c:c=b,w>A&&(s[g>>3]=w,A=w),x=w>0&wT?w:T,l|=+u(+(w-S))>3.141592653589793,!v;)b=c;l&&(s[g>>3]=T,s[m>>3]=x)}else i[h>>2]=0,i[h+4>>2]=0,i[h+8>>2]=0,i[h+12>>2]=0,i[h+16>>2]=0,i[h+20>>2]=0,i[h+24>>2]=0,i[h+28>>2]=0;l=E+1|0}if(o=0|i[(L=o+8|0)>>2],i[L>>2]=0,!o){O=45;break}E=l,m=r}if(21==(0|O))M(27213,27235,35,27247);else if(23==(0|O))M(27267,27235,37,27247);else if(27==(0|O))M(27310,27235,61,27333);else if(45==(0|O)){e:do{if((0|I)>0){for(L=!(0|l),P=l<<2,D=!(0|e),N=0,r=0;;){if(R=0|i[n+(N<<2)>>2],L)O=73;else{if(!(E=0|Yt(P))){O=50;break}if(!(C=0|Yt(P))){O=52;break}t:do{if(D)a=0;else{for(l=0,a=0,h=e;o=t+(l<<5)|0,0|bt(0|i[h>>2],o,0|i[R>>2])?(i[E+(a<<2)>>2]=h,i[C+(a<<2)>>2]=o,v=a+1|0):v=a,h=0|i[h+8>>2];)l=l+1|0,a=v;if((0|v)>0)if(o=0|i[E>>2],1==(0|v))a=o;else for(g=0,_=-1,a=o,m=o;;){for(p=0|i[m>>2],o=0,h=0;f=(0|(l=0|i[i[E+(h<<2)>>2]>>2]))==(0|p)?o:o+(1&bt(l,0|i[C+(h<<2)>>2],0|i[p>>2]))|0,(0|(h=h+1|0))!=(0|v);)o=f;if(a=(l=(0|f)>(0|_))?m:a,(0|(o=g+1|0))==(0|v))break t;g=o,_=l?f:_,m=0|i[E+(o<<2)>>2]}else a=0}}while(0);if(Kt(E),Kt(C),a){if(o=0|i[(l=a+4|0)>>2])a=o+8|0;else if(0|i[a>>2]){O=70;break}i[a>>2]=R,i[l>>2]=R}else O=73}if(73==(0|O)){if(O=0,0|(r=0|i[R>>2]))do{C=r,r=0|i[r+16>>2],Kt(C)}while(0|r);Kt(R),r=1}if((0|(N=N+1|0))>=(0|I)){U=r;break e}}50==(0|O)?M(27452,27235,249,27471):52==(0|O)?M(27490,27235,252,27471):70==(0|O)&&M(27310,27235,61,27333)}else U=0}while(0);return Kt(n),Kt(t),0|(O=U)}return 0}function bt(e,t,n){e|=0;var r=0,a=0,o=0,l=0,u=0,c=0,h=0,A=0;if(!(0|Z(t|=0,n|=0)))return 0|(e=0);if(t=0|Y(t),r=+s[n>>3],a=t&(a=+s[n+8>>3])<0?a+6.283185307179586:a,!(e=0|i[e>>2]))return 0|(e=0);if(t){t=0,h=a,n=e;e:for(;;){for(;l=+s[n>>3],a=+s[n+8>>3],A=0|i[(n=n+16|0)>>2],o=+s[(A=0|A?A:e)>>3],u=+s[A+8>>3],l>o?(c=l,l=u):(c=o,o=l,l=a,a=u),(r=r==o|r==c?r+2220446049250313e-31:r)c;)if(!(n=0|i[n>>2])){n=22;break e}if(((c=(u=l<0?l+6.283185307179586:l)+(r-o)/(c-o)*((l=a<0?a+6.283185307179586:a)-u))<0?c+6.283185307179586:c)>(h=u==h|l==h?h+-2220446049250313e-31:h)&&(t^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|t}else{t=0,h=a,n=e;e:for(;;){for(;l=+s[n>>3],a=+s[n+8>>3],A=0|i[(n=n+16|0)>>2],o=+s[(A=0|A?A:e)>>3],u=+s[A+8>>3],l>o?(c=l,l=u):(c=o,o=l,l=a,a=u),(r=r==o|r==c?r+2220446049250313e-31:r)c;)if(!(n=0|i[n>>2])){n=22;break e}if(l+(r-o)/(c-o)*(a-l)>(h=l==h|a==h?h+-2220446049250313e-31:h)&&(t^=1),!(n=0|i[n>>2])){n=22;break}}if(22==(0|n))return 0|t}return 0}function xt(e,t,n,s,a){n|=0,s|=0,a|=0;var o,l,u,c,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0;if(c=D,D=D+32|0,y=c+16|0,u=c,h=0|un(0|(e|=0),0|(t|=0),52),w(),h&=15,g=0|un(0|n,0|s,52),w(),(0|h)!=(15&g))return D=c,0|(y=12);if(f=0|un(0|e,0|t,45),w(),f&=127,m=0|un(0|n,0|s,45),w(),f>>>0>121|(m&=127)>>>0>121)return D=c,0|(y=5);if(g=(0|f)!=(0|m)){if(7==(0|(d=0|Q(f,m))))return D=c,0|(y=1);7==(0|(p=0|Q(m,f)))?M(27514,27538,161,27548):(_=d,A=p)}else _=0,A=0;o=0|z(f),l=0|z(m),i[y>>2]=0,i[y+4>>2]=0,i[y+8>>2]=0,i[y+12>>2]=0;do{if(_){if(d=(0|(m=0|i[4272+(28*f|0)+(_<<2)>>2]))>0,l)if(d){f=0,p=n,d=s;do{p=0|Ke(p,d),d=0|w(),1==(0|(A=0|xe(A)))&&(A=0|xe(1)),f=f+1|0}while((0|f)!=(0|m));m=A,f=p,p=d}else m=A,f=n,p=s;else if(d){f=0,p=n,d=s;do{p=0|Ze(p,d),d=0|w(),A=0|xe(A),f=f+1|0}while((0|f)!=(0|m));m=A,f=p,p=d}else m=A,f=n,p=s;if(tt(f,p,y),g||M(27563,27538,191,27548),(d=!!(0|o))&(A=!!(0|l))&&M(27590,27538,192,27548),d){if(7==(0|(A=0|Qe(e,t)))){h=5;break}if(0|r[22e3+(7*A|0)+_|0]){h=1;break}f=p=0|i[21168+(28*A|0)+(_<<2)>>2]}else if(A){if(7==(0|(A=0|Qe(f,p)))){h=5;break}if(0|r[22e3+(7*A|0)+m|0]){h=1;break}f=0,p=0|i[21168+(28*m|0)+(A<<2)>>2]}else f=0,p=0;if((f|p|0)<0)h=5;else{if((0|p)>0){d=y+4|0,A=0;do{ye(d),A=A+1|0}while((0|A)!=(0|p))}if(i[u>>2]=0,i[u+4>>2]=0,i[u+8>>2]=0,_e(u,_),0|h)for(;0|Je(h)?me(u):ge(u),(0|h)>1;)h=h+-1|0;if((0|f)>0){h=0;do{ye(u),h=h+1|0}while((0|h)!=(0|f))}le(v=y+4|0,u,v),ae(v),v=51}}else if(tt(n,s,y),!!(0|o)&!!(0|l))if((0|m)!=(0|f)&&M(27621,27538,261,27548),7==(0|(A=0|Qe(e,t)))|7==(0|(h=0|Qe(n,s))))h=5;else if(0|r[22e3+(7*A|0)+h|0])h=1;else if((0|(A=0|i[21168+(28*A|0)+(h<<2)>>2]))>0){d=y+4|0,h=0;do{ye(d),h=h+1|0}while((0|h)!=(0|A));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(h=y+4|0,i[a>>2]=i[h>>2],i[a+4>>2]=i[h+4>>2],i[a+8>>2]=i[h+8>>2],h=0),D=c,0|(y=h)}function Tt(e,t,n,r){n|=0,r|=0;var s,a,o,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0;if(o=D,D=D+48|0,s=o+36|0,c=o+24|0,h=o+12|0,A=o,l=0|un(0|(e|=0),0|(t|=0),52),w(),l&=15,p=0|un(0|e,0|t,45),w(),(p&=127)>>>0>121)return D=o,0|(r=5);if(a=0|z(p),cn(0|l,0,52),g=134225919|w(),i[(u=r)>>2]=-1,i[u+4>>2]=g,!l)return 7==(0|(l=0|he(n)))||127==(0|(l=0|X(p,l)))?(D=o,0|(g=1)):(f=0|cn(0|l,0,45),m=0|w(),m=-1040385&i[(p=r)+4>>2]|m,i[(g=r)>>2]=i[p>>2]|f,i[g+4>>2]=m,D=o,0|(g=0));for(i[s>>2]=i[n>>2],i[s+4>>2]=i[n+4>>2],i[s+8>>2]=i[n+8>>2],n=l;;){if(u=n,n=n+-1|0,i[c>>2]=i[s>>2],i[c+4>>2]=i[s+4>>2],i[c+8>>2]=i[s+8>>2],0|Je(u)){if(0|(l=0|Ae(s))){n=13;break}i[h>>2]=i[s>>2],i[h+4>>2]=i[s+4>>2],i[h+8>>2]=i[s+8>>2],me(h)}else{if(0|(l=0|de(s))){n=13;break}i[h>>2]=i[s>>2],i[h+4>>2]=i[s+4>>2],i[h+8>>2]=i[s+8>>2],ge(h)}if(ue(c,h,A),ae(A),v=0|i[(l=r)>>2],l=0|i[l+4>>2],_=0|cn(7,0,0|(y=3*(15-u|0)|0)),l&=~w(),y=0|cn(0|he(A),0,0|y),l=0|w()|l,i[(g=r)>>2]=y|v&~_,i[g+4>>2]=l,(0|u)<=1){n=14;break}}e:do{if(13!=(0|n)&&14==(0|n))if((0|i[s>>2])<=1&&(0|i[s+4>>2])<=1&&(0|i[s+8>>2])<=1){A=127==(0|(l=0|X(p,n=0|he(s))))?0:0|z(l);t:do{if(n){if(a){if(7==(0|(l=0|Qe(e,t)))){l=5;break e}if((0|(u=0|i[21376+(28*l|0)+(n<<2)>>2]))>0){l=n,n=0;do{l=0|be(l),n=n+1|0}while((0|n)!=(0|u))}else l=n;if(1==(0|l)){l=9;break e}127==(0|(n=0|X(p,l)))&&M(27648,27538,411,27678),0|z(n)?M(27693,27538,412,27678):(m=n,f=u,d=l)}else m=l,f=0,d=n;if((0|(h=0|i[4272+(28*p|0)+(d<<2)>>2]))<=-1&&M(27724,27538,419,27678),!A){if((0|f)<0){l=5;break e}if(0|f){l=0,n=0|i[(u=r)>>2],u=0|i[u+4>>2];do{n=0|Ye(n,u),u=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=u,l=l+1|0}while((0|l)<(0|f))}if((0|h)<=0){l=m,n=58;break}for(l=0,n=0|i[(u=r)>>2],u=0|i[u+4>>2];;)if(n=0|Ye(n,u),u=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=u,(0|(l=l+1|0))==(0|h)){l=m,n=58;break t}}if(7==(0|(c=0|Q(m,p)))&&M(27514,27538,428,27678),n=0|i[(l=r)>>2],l=0|i[l+4>>2],(0|h)>0){u=0;do{n=0|Ye(n,l),l=0|w(),i[(y=r)>>2]=n,i[y+4>>2]=l,u=u+1|0}while((0|u)!=(0|h))}if(7==(0|(l=0|Qe(n,l)))&&M(27795,27538,440,27678),n=0|G(m),(0|(n=0|i[(n?21792:21584)+(28*c|0)+(l<<2)>>2]))<0&&M(27795,27538,454,27678),n){l=0,u=0|i[(c=r)>>2],c=0|i[c+4>>2];do{u=0|$e(u,c),c=0|w(),i[(y=r)>>2]=u,i[y+4>>2]=c,l=l+1|0}while((0|l)<(0|n));l=m,n=58}else l=m,n=58}else if(!!(0|a)&!!(0|A)){if(7==(0|(n=0|Qe(e,t)))|7==(0|(u=0|Qe(0|i[(u=r)>>2],0|i[u+4>>2])))){l=5;break e}if((0|(u=0|i[21376+(28*n|0)+(u<<2)>>2]))<0){l=5;break e}if(u){n=0,c=0|i[(h=r)>>2],h=0|i[h+4>>2];do{c=0|Ye(c,h),h=0|w(),i[(y=r)>>2]=c,i[y+4>>2]=h,n=n+1|0}while((0|n)<(0|u));n=58}else n=59}else n=58}while(0);if(58==(0|n)&&A&&(n=59),59==(0|n)&&1==(0|Qe(0|i[(y=r)>>2],0|i[y+4>>2]))){l=9;break}_=0|i[(y=r)>>2],y=-1040385&i[y+4>>2],v=0|cn(0|l,0,45),y=0|y|w(),i[(l=r)>>2]=_|v,i[l+4>>2]=y,l=0}else l=1}while(0);return D=o,0|(y=l)}function St(e,t,n,r){e|=0,t|=0;var i=0,s=0,a=0;if(!(0|(n|=0))&!(0|(r|=0)))return s=1,S(0|(i=0)),0|s;s=e,i=t,e=1,t=0;do{e=0|sn(0|((a=!0&!(1&n))?1:s),0|(a?0:i),0|e,0|t),t=0|w(),n=0|ln(0|n,0|r,1),r=0|w(),s=0|sn(0|s,0|i,0|s,0|i),i=0|w()}while(!(!(0|n)&!(0|r)));return S(0|t),0|e}function wt(e,t,n,r){n|=0,r|=0;var a,o=0,l=0,u=0,c=0,h=0,d=0;a=D,D=D+16|0,l=a,u=0|un(0|(e|=0),0|(t|=0),52),w(),u&=15;do{if(u){if(!(o=0|rt(e,t,l))){h=+s[l>>3],c=1/+A(+h),d=+s[25968+(u<<3)>>3],s[n>>3]=h+d,s[n+8>>3]=h-d,h=+s[l+8>>3],c*=d,s[n+16>>3]=c+h,s[n+24>>3]=h-c;break}return D=a,0|(u=o)}if(o=0|un(0|e,0|t,45),w(),(o&=127)>>>0>121)return D=a,0|(u=5);l=22064+(o<<5)|0,i[n>>2]=i[l>>2],i[n+4>>2]=i[l+4>>2],i[n+8>>2]=i[l+8>>2],i[n+12>>2]=i[l+12>>2],i[n+16>>2]=i[l+16>>2],i[n+20>>2]=i[l+20>>2],i[n+24>>2]=i[l+24>>2],i[n+28>>2]=i[l+28>>2];break}while(0);return function(e,t){t=+t;var n,r,i,a,o,l,u,c=0,h=0;c=(a=+s[(i=16+(e|=0)|0)>>3])-(r=+s[(n=e+24|0)>>3]),c=a>3],c=.5*(c*t-c),h+=t=.5*((u=h-(l=+s[(o=e+8|0)>>3]))*t-u),s[e>>3]=h>1.5707963267948966?1.5707963267948966:h,t=l-t,s[o>>3]=t<-1.5707963267948966?-1.5707963267948966:t,t=(t=a+c)>3.141592653589793?t+-6.283185307179586:t,s[i>>3]=t<-3.141592653589793?t+6.283185307179586:t,t=(t=r-c)>3.141592653589793?t+-6.283185307179586:t,s[n>>3]=t<-3.141592653589793?t+6.283185307179586:t}(n,r?1.4:1.1),(0|i[(r=26096+(u<<3)|0)>>2])==(0|e)&&(0|i[r+4>>2])==(0|t)&&(s[n>>3]=1.5707963267948966),(0|i[(u=26224+(u<<3)|0)>>2])==(0|e)&&(0|i[u+4>>2])==(0|t)&&(s[n+8>>3]=-1.5707963267948966),1.5707963267948966!=+s[n>>3]&&-1.5707963267948966!=+s[n+8>>3]?(D=a,0|(u=0)):(s[n+16>>3]=3.141592653589793,s[n+24>>3]=-3.141592653589793,D=a,0|(u=0))}function Mt(e,t,n,s){e|=0,t|=0,n|=0,s|=0;var a,o,l,u=0,c=0,h=0,A=0;l=D,D=D+48|0,a=l+40|0,o=l,ze(c=l+32|0,0,0,0),h=0|i[c>>2],c=0|i[c+4>>2];do{if(n>>>0<=15){if(0|(u=0|Pt(s))){i[(s=o)>>2]=0,i[s+4>>2]=0,i[o+8>>2]=u,i[o+12>>2]=-1,h=o+29|0,i[(s=o+16|0)>>2]=0,i[s+4>>2]=0,i[s+8>>2]=0,r[s+12|0]=0,r[h|0]=0|r[a|0],r[h+1|0]=0|r[a+1|0],r[h+2|0]=0|r[a+2|0];break}if(u=0|Zt(1+(0|i[t+8>>2])|0,32)){Dt(t,u),i[(A=o)>>2]=h,i[A+4>>2]=c,i[o+8>>2]=0,i[o+12>>2]=n,i[o+16>>2]=s,i[o+20>>2]=t,i[o+24>>2]=u,r[o+28|0]=0,r[(h=o+29|0)|0]=0|r[a|0],r[h+1|0]=0|r[a+1|0],r[h+2|0]=0|r[a+2|0];break}i[(s=o)>>2]=0,i[s+4>>2]=0,i[o+8>>2]=13,i[o+12>>2]=-1,h=o+29|0,i[(s=o+16|0)>>2]=0,i[s+4>>2]=0,i[s+8>>2]=0,r[s+12|0]=0,r[h|0]=0|r[a|0],r[h+1|0]=0|r[a+1|0],r[h+2|0]=0|r[a+2|0];break}i[(h=o)>>2]=0,i[h+4>>2]=0,i[o+8>>2]=4,i[o+12>>2]=-1,A=o+29|0,i[(h=o+16|0)>>2]=0,i[h+4>>2]=0,i[h+8>>2]=0,r[h+12|0]=0,r[A|0]=0|r[a|0],r[A+1|0]=0|r[a+1|0],r[A+2|0]=0|r[a+2|0]}while(0);Et(o),i[e>>2]=i[o>>2],i[e+4>>2]=i[o+4>>2],i[e+8>>2]=i[o+8>>2],i[e+12>>2]=i[o+12>>2],i[e+16>>2]=i[o+16>>2],i[e+20>>2]=i[o+20>>2],i[e+24>>2]=i[o+24>>2],i[e+28>>2]=i[o+28>>2],D=l}function Et(e){var t,n,s,a,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0;if(a=D,D=D+336|0,t=a+168|0,n=a,!(0|(l=0|i[(u=e|=0)>>2]))&!(0|(u=0|i[u+4>>2])))D=a;else{if(0|r[(o=e+28|0)|0]?(l=0|Ct(l,u),u=0|w()):r[o|0]=1,!(0|i[i[(s=e+20|0)>>2]>>2]))return 0|(l=0|i[(o=e+24|0)>>2])&&Kt(l),i[(x=e)>>2]=0,i[x+4>>2]=0,i[e+8>>2]=0,i[s>>2]=0,i[e+12>>2]=-1,i[e+16>>2]=0,i[o>>2]=0,void(D=a);c=15&(o=0|i[(x=e+16|0)>>2]);e:do{if(!(0|l)&!(0|u))b=e+24|0;else{v=e+12|0,g=3==(0|c),m=255&o,p=3==(1|c),_=e+24|0,f=(c+-1|0)>>>0<3,A=3==(2|c),d=n+8|0;t:for(;;){if(h=0|un(0|l,0|u,52),w(),(0|(h&=15))==(0|i[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|rt(l,u,t))){y=15;break t}if(0|Lt(0|i[s>>2],0|i[_>>2],t)){y=19;break t}}if(p&&(c=0|i[4+(0|i[s>>2])>>2],i[t>>2]=i[c>>2],i[t+4>>2]=i[c+4>>2],i[t+8>>2]=i[c+8>>2],i[t+12>>2]=i[c+12>>2],0|Z(26832,t))){if(0|et(0|i[4+(0|i[s>>2])>>2],h,n)){y=25;break}if((0|i[(c=n)>>2])==(0|l)&&(0|i[c+4>>2])==(0|u)){y=29;break}}if(f){if(0|(c=0|it(l,u,t))){y=32;break}if(0|wt(l,u,n,0)){y=36;break}if(A&&0|It(0|i[s>>2],0|i[_>>2],t,n)){y=42;break}if(p&&0|Ot(0|i[s>>2],0|i[_>>2],t,n)){y=42;break}}if(g){if(o=0|wt(l,u,t,1),c=0|i[_>>2],0|o){y=45;break}if(0|J(c,t)){if(te(n,t),0|ee(t,0|i[_>>2])){y=53;break}if(0|Lt(0|i[s>>2],0|i[_>>2],d)){y=53;break}if(0|Ot(0|i[s>>2],0|i[_>>2],n,t)){y=53;break}}}}do{if((0|h)<(0|i[v>>2])){if(o=0|wt(l,u,t,1),c=0|i[_>>2],0|o){y=58;break t}if(!(0|J(c,t))){y=73;break}if(0|ee(0|i[_>>2],t)&&(te(n,t),0|It(0|i[s>>2],0|i[_>>2],n,t))){y=65;break t}if(0|(l=0|Xe(l,u,h+1|0,n))){y=67;break t}l=0|i[(u=n)>>2],u=0|i[u+4>>2]}else y=73}while(0);if(73==(0|y)&&(y=0,l=0|Ct(l,u),u=0|w()),!(0|l)&!(0|u)){b=_;break e}}switch(0|y){case 15:0|(o=0|i[_>>2])&&Kt(o),i[(y=e)>>2]=0,i[y+4>>2]=0,i[s>>2]=0,i[v>>2]=-1,i[x>>2]=0,i[_>>2]=0,i[e+8>>2]=c,y=20;break;case 19:i[e>>2]=l,i[e+4>>2]=u,y=20;break;case 25:M(27795,27761,470,27772);break;case 29:case 42:return i[e>>2]=l,i[e+4>>2]=u,void(D=a);case 32:return 0|(o=0|i[_>>2])&&Kt(o),i[(b=e)>>2]=0,i[b+4>>2]=0,i[s>>2]=0,i[v>>2]=-1,i[x>>2]=0,i[_>>2]=0,i[e+8>>2]=c,void(D=a);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Kt(c),i[(y=e)>>2]=0,i[y+4>>2]=0,i[s>>2]=0,i[v>>2]=-1,i[x>>2]=0,i[_>>2]=0,i[e+8>>2]=o,y=55;break;case 53:i[e>>2]=l,i[e+4>>2]=u,y=55;break;case 58:0|c&&Kt(c),i[(y=e)>>2]=0,i[y+4>>2]=0,i[s>>2]=0,i[v>>2]=-1,i[x>>2]=0,i[_>>2]=0,i[e+8>>2]=o,y=71;break;case 65:i[e>>2]=l,i[e+4>>2]=u,y=71;break;case 67:return 0|(o=0|i[_>>2])&&Kt(o),i[(b=e)>>2]=0,i[b+4>>2]=0,i[s>>2]=0,i[v>>2]=-1,i[x>>2]=0,i[_>>2]=0,i[e+8>>2]=l,void(D=a)}if(20==(0|y))return void(D=a);if(55==(0|y))return void(D=a);if(71==(0|y))return void(D=a)}}while(0);0|(o=0|i[b>>2])&&Kt(o),i[(y=e)>>2]=0,i[y+4>>2]=0,i[e+8>>2]=0,i[s>>2]=0,i[e+12>>2]=-1,i[x>>2]=0,i[b>>2]=0,D=a}}function Ct(e,t){var n,r=0,s=0,a=0,o=0,l=0,u=0,c=0,h=0,A=0;n=D,D=D+16|0,A=n,s=0|un(0|(e|=0),0|(t|=0),52),w(),s&=15,r=0|un(0|e,0|t,45),w();do{if(s){for(;r=0|cn(s+4095|0,0,52),a=w()|-15728641&t,r=r|e|(l=0|cn(7,0,0|(o=3*(15-s|0)|0))),a|=u=0|w(),c=0|un(0|e,0|t,0|o),w(),s=s+-1|0,!((c&=7)>>>0<6);){if(!s){h=4;break}t=a,e=r}if(4==(0|h)){r=0|un(0|r,0|a,45),w();break}return A=0|cn(((A=!(0|c)&!!(0|je(r,a)))?2:1)+c|0,0,0|o),h=0|w()|t&~u,A|=e&~l,S(0|h),D=n,0|A}}while(0);return(r&=127)>>>0>120?(A=0,S(0|(h=0)),D=n,0|A):(ze(A,0,r+1|0,0),h=0|i[A+4>>2],A=0|i[A>>2],S(0|h),D=n,0|A)}function Rt(e,t,n){e|=0;var r,a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0;if(!(0|Z(t|=0,n|=0)))return 0|(p=0);if(t=0|Y(t),a=+s[n>>3],o=t&(o=+s[n+8>>3])<0?o+6.283185307179586:o,(0|(p=0|i[e>>2]))<=0)return 0|(p=0);if(r=0|i[e+4>>2],t){t=0,d=o,n=-1,e=0;e:for(;;){for(A=e;u=+s[r+(A<<4)>>3],o=+s[r+(A<<4)+8>>3],l=+s[r+((e=(n+2|0)%(0|p)|0)<<4)>>3],c=+s[r+(e<<4)+8>>3],u>l?(h=u,u=c):(h=l,l=u,u=o,o=c),(a=a==l|a==h?a+2220446049250313e-31:a)h;){if((0|(n=A+1|0))>=(0|p)){n=22;break e}e=A,A=n,n=e}if(((h=(c=u<0?u+6.283185307179586:u)+(a-l)/(h-l)*((u=o<0?o+6.283185307179586:o)-c))<0?h+6.283185307179586:h)>(d=c==d|u==d?d+-2220446049250313e-31:d)&&(t^=1),(0|(e=A+1|0))>=(0|p)){n=22;break}n=A}if(22==(0|n))return 0|t}else{t=0,d=o,n=-1,e=0;e:for(;;){for(A=e;u=+s[r+(A<<4)>>3],o=+s[r+(A<<4)+8>>3],l=+s[r+((e=(n+2|0)%(0|p)|0)<<4)>>3],c=+s[r+(e<<4)+8>>3],u>l?(h=u,u=c):(h=l,l=u,u=o,o=c),(a=a==l|a==h?a+2220446049250313e-31:a)h;){if((0|(n=A+1|0))>=(0|p)){n=22;break e}e=A,A=n,n=e}if(u+(a-l)/(h-l)*(o-u)>(d=u==d|o==d?d+-2220446049250313e-31:d)&&(t^=1),(0|(e=A+1|0))>=(0|p)){n=22;break}n=A}if(22==(0|n))return 0|t}return 0}function Nt(e,t){t|=0;var n,r,a,o,l,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0;if(!(r=0|i[(e|=0)>>2]))return i[t>>2]=0,i[t+4>>2]=0,i[t+8>>2]=0,i[t+12>>2]=0,i[t+16>>2]=0,i[t+20>>2]=0,i[t+24>>2]=0,void(i[t+28>>2]=0);if(s[(a=t+8|0)>>3]=17976931348623157e292,s[(o=t+24|0)>>3]=17976931348623157e292,s[t>>3]=-17976931348623157e292,s[(l=t+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(n=0|i[e+4>>2],g=17976931348623157e292,_=-17976931348623157e292,v=0,e=-1,d=17976931348623157e292,p=17976931348623157e292,m=-17976931348623157e292,h=-17976931348623157e292,y=0;c=+s[n+(y<<4)>>3],f=+s[n+(y<<4)+8>>3],A=+s[n+(((0|(e=e+2|0))==(0|r)?0:e)<<4)+8>>3],c>3]=c,d=c),f>3]=f,p=f),c>m?s[t>>3]=c:c=m,f>h&&(s[l>>3]=f,h=f),g=f>0&f_?f:_,v|=+u(+(f-A))>3.141592653589793,(0|(e=y+1|0))!=(0|r);)b=y,m=c,y=e,e=b;v&&(s[l>>3]=_,s[o>>3]=g)}}function Pt(e){return 0|((e|=0)>>>0<4?0:15)}function Dt(e,t){t|=0;var n,r=0,a=0,o=0,l=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0,T=0,S=0,w=0,M=0;if(_=0|i[(e|=0)>>2]){if(s[(v=t+8|0)>>3]=17976931348623157e292,s[(y=t+24|0)>>3]=17976931348623157e292,s[t>>3]=-17976931348623157e292,s[(b=t+16|0)>>3]=-17976931348623157e292,(0|_)>0){for(o=0|i[e+4>>2],m=17976931348623157e292,g=-17976931348623157e292,a=0,r=-1,A=17976931348623157e292,d=17976931348623157e292,f=-17976931348623157e292,c=-17976931348623157e292,x=0;l=+s[o+(x<<4)>>3],p=+s[o+(x<<4)+8>>3],h=+s[o+(((0|(w=r+2|0))==(0|_)?0:w)<<4)+8>>3],l>3]=l,A=l),p>3]=p,d=p),l>f?s[t>>3]=l:l=f,p>c&&(s[b>>3]=p,c=p),m=p>0&pg?p:g,a|=+u(+(p-h))>3.141592653589793,(0|(r=x+1|0))!=(0|_);)w=x,f=l,x=r,r=w;a&&(s[b>>3]=g,s[y>>3]=m)}}else i[t>>2]=0,i[t+4>>2]=0,i[t+8>>2]=0,i[t+12>>2]=0,i[t+16>>2]=0,i[t+20>>2]=0,i[t+24>>2]=0,i[t+28>>2]=0;if(!((0|(r=0|i[(w=e+8|0)>>2]))<=0)){n=e+12|0,S=0;do{if(o=0|i[n>>2],a=S,y=t+((S=S+1|0)<<5)|0,b=0|i[o+(a<<3)>>2]){if(s[(x=t+(S<<5)+8|0)>>3]=17976931348623157e292,s[(e=t+(S<<5)+24|0)>>3]=17976931348623157e292,s[y>>3]=-17976931348623157e292,s[(T=t+(S<<5)+16|0)>>3]=-17976931348623157e292,(0|b)>0){for(_=0|i[o+(a<<3)+4>>2],m=17976931348623157e292,g=-17976931348623157e292,o=0,a=-1,v=0,A=17976931348623157e292,d=17976931348623157e292,p=-17976931348623157e292,c=-17976931348623157e292;l=+s[_+(v<<4)>>3],f=+s[_+(v<<4)+8>>3],h=+s[_+(((0|(a=a+2|0))==(0|b)?0:a)<<4)+8>>3],l>3]=l,A=l),f>3]=f,d=f),l>p?s[y>>3]=l:l=p,f>c&&(s[T>>3]=f,c=f),m=f>0&fg?f:g,o|=+u(+(f-h))>3.141592653589793,(0|(a=v+1|0))!=(0|b);)M=v,v=a,p=l,a=M;o&&(s[T>>3]=g,s[e>>3]=m)}}else i[y>>2]=0,i[y+4>>2]=0,i[y+8>>2]=0,i[y+12>>2]=0,i[y+16>>2]=0,i[y+20>>2]=0,i[y+24>>2]=0,i[y+28>>2]=0,r=0|i[w>>2]}while((0|S)<(0|r))}}function Lt(e,t,n){var r=0,s=0,a=0;if(!(0|Rt(e|=0,t|=0,n|=0)))return 0|(s=0);if((0|i[(s=e+8|0)>>2])<=0)return 0|(s=1);for(r=e+12|0,e=0;;){if(a=e,e=e+1|0,0|Rt((0|i[r>>2])+(a<<3)|0,t+(e<<5)|0,n)){e=0,r=6;break}if((0|e)>=(0|i[s>>2])){e=1,r=6;break}}return 6==(0|r)?0|e:0}function It(e,t,n,r){r|=0;var s,a,o=0,l=0,u=0,c=0,h=0;if(a=D,D=D+16|0,s=a,!(0|Rt(e|=0,t|=0,u=(n|=0)+8|0)))return D=a,0|(c=0);c=e+8|0;e:do{if((0|i[c>>2])>0){for(l=e+12|0,o=0;;){if(h=o,o=o+1|0,0|Rt((0|i[l>>2])+(h<<3)|0,t+(o<<5)|0,u)){o=0;break}if((0|o)>=(0|i[c>>2]))break e}return D=a,0|o}}while(0);if(0|Ut(e,t,n,r))return D=a,0|(h=0);i[s>>2]=i[n>>2],i[s+4>>2]=u,o=0|i[c>>2];e:do{if((0|o)>0)for(e=e+12|0,u=0,l=o;;){if(o=0|i[e>>2],(0|i[o+(u<<3)>>2])>0){if(0|Rt(s,r,0|i[o+(u<<3)+4>>2])){o=0;break e}if(o=u+1|0,0|Ut((0|i[e>>2])+(u<<3)|0,t+(o<<5)|0,n,r)){o=0;break e}l=0|i[c>>2]}else o=u+1|0;if(!((0|o)<(0|l))){o=1;break}u=o}else o=1}while(0);return D=a,0|(h=o)}function Ut(e,t,n,r){e|=0,n|=0;var a,o,l,u,c,h,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0,T=0,S=0,w=0,M=0;if(h=D,D=D+176|0,u=h+172|0,A=h+168|0,c=h,!(0|J(t|=0,r|=0)))return D=h,0|(e=0);if(function(e,t,n,r){var a,o,l,u,c;t|=0,n|=0,r|=0,e=(o=+s[16+(e|=0)>>3])<(c=+s[e+24>>3]),a=(u=+s[t+16>>3])<(l=+s[t+24>>3]),t=c-u>2]=e?a|t?1:2:0,i[r>>2]=a?e?1:t?2:1:0}(t,r,u,A),fn(0|c,0|n,168),(0|i[n>>2])>0){t=0;do{x=+ht(+s[(w=c+8+(t<<4)+8|0)>>3],0|i[A>>2]),s[w>>3]=x,t=t+1|0}while((0|t)<(0|i[n>>2]))}o=+s[r>>3],l=+s[r+8>>3],x=+ht(+s[r+16>>3],0|i[A>>2]),a=+ht(+s[r+24>>3],0|i[A>>2]);e:do{if((0|i[e>>2])>0){if(r=e+4|0,(0|(A=0|i[c>>2]))<=0)for(t=0;;)if((0|(t=t+1|0))>=(0|i[e>>2])){t=0;break e}for(n=0;;){if(t=0|i[r>>2],y=+s[t+(n<<4)>>3],b=+ht(+s[t+(n<<4)+8>>3],0|i[u>>2]),t=0|i[r>>2],w=(0|(n=n+1|0))%(0|i[e>>2])|0,d=+s[t+(w<<4)>>3],p=+ht(+s[t+(w<<4)+8>>3],0|i[u>>2]),!(y>=o)|!(d>=o)&&!(y<=l)|!(d<=l)&&!(b<=a)|!(p<=a)&&!(b>=x)|!(p>=x)){v=d-y,g=p-b,t=0;do{if(M=t,w=(0|(t=t+1|0))==(0|A)?0:t,d=+s[c+8+(M<<4)+8>>3],p=+s[c+8+(w<<4)+8>>3]-d,f=+s[c+8+(M<<4)>>3],!(0==(_=v*p-g*(m=+s[c+8+(w<<4)>>3]-f))||(T=b-d,S=y-f,m=(T*m-p*S)/_,m<0|m>1))&&(_=(v*T-g*S)/_)>=0&_<=1){t=1;break e}}while((0|t)<(0|A))}if((0|n)>=(0|i[e>>2])){t=0;break}}}else t=0}while(0);return D=h,0|(M=t)}function Ot(e,t,n,r){var s=0,a=0,o=0;if(0|Ut(e|=0,t|=0,n|=0,r|=0))return 0|(a=1);if((0|i[(a=e+8|0)>>2])<=0)return 0|(a=0);for(s=e+12|0,e=0;;){if(o=e,e=e+1|0,0|Ut((0|i[s>>2])+(o<<3)|0,t+(e<<5)|0,n,r)){e=1,s=6;break}if((0|e)>=(0|i[a>>2])){e=0,s=6;break}}return 6==(0|s)?0|e:0}function Bt(e,t,n,r,i){t|=0,n|=0,r|=0,i|=0;var a,o,l,u,c,h,A,d=0;u=+s[(e|=0)>>3],l=+s[t>>3]-u,o=+s[e+8>>3],a=+s[t+8>>3]-o,h=+s[n>>3],d=((d=+s[r>>3]-h)*(o-(A=+s[n+8>>3]))-(u-h)*(c=+s[r+8>>3]-A))/(l*c-a*d),s[i>>3]=u+l*d,s[i+8>>3]=o+a*d}function Ft(e,t){return t|=0,+u(+(+s[(e|=0)>>3]-+s[t>>3]))<1.1920928955078125e-7?0|(t=+u(+(+s[e+8>>3]-+s[t+8>>3]))<1.1920928955078125e-7):0|(t=0)}function kt(e,t){t|=0;var n,r,i;return+((i=+s[(e|=0)>>3]-+s[t>>3])*i+(r=+s[e+8>>3]-+s[t+8>>3])*r+(n=+s[e+16>>3]-+s[t+16>>3])*n)}function qt(e,t,n){n|=0;var r,s,a,o,l=0,u=0,c=0;if(o=D,D=D+32|0,c=o,0|(l=0|nt(e|=0,t|=0,s=o+16|0)))return D=o,0|(n=l);r=0|qe(e,t),a=0|Qe(e,t),function(e,t){e=7696+(28*(e|=0)|0)|0,i[(t|=0)>>2]=i[e>>2],i[t+4>>2]=i[e+4>>2],i[t+8>>2]=i[e+8>>2],i[t+12>>2]=i[e+12>>2]}(r,c),l=0|function(e,t){e|=0;var n=0,r=0;if((t|=0)>>>0>20)return-1;do{if((0|i[11120+(216*t|0)>>2])!=(0|e))if((0|i[11120+(216*t|0)+8>>2])!=(0|e))if((0|i[11120+(216*t|0)+16>>2])!=(0|e))if((0|i[11120+(216*t|0)+24>>2])!=(0|e))if((0|i[11120+(216*t|0)+32>>2])!=(0|e))if((0|i[11120+(216*t|0)+40>>2])!=(0|e))if((0|i[11120+(216*t|0)+48>>2])!=(0|e))if((0|i[11120+(216*t|0)+56>>2])!=(0|e))if((0|i[11120+(216*t|0)+64>>2])!=(0|e))if((0|i[11120+(216*t|0)+72>>2])!=(0|e))if((0|i[11120+(216*t|0)+80>>2])!=(0|e))if((0|i[11120+(216*t|0)+88>>2])!=(0|e))if((0|i[11120+(216*t|0)+96>>2])!=(0|e))if((0|i[11120+(216*t|0)+104>>2])!=(0|e))if((0|i[11120+(216*t|0)+112>>2])!=(0|e))if((0|i[11120+(216*t|0)+120>>2])!=(0|e))if((0|i[11120+(216*t|0)+128>>2])!=(0|e)){if((0|i[11120+(216*t|0)+136>>2])!=(0|e)){if((0|i[11120+(216*t|0)+144>>2])==(0|e)){e=0,n=2,r=0;break}if((0|i[11120+(216*t|0)+152>>2])==(0|e)){e=0,n=2,r=1;break}if((0|i[11120+(216*t|0)+160>>2])==(0|e)){e=0,n=2,r=2;break}if((0|i[11120+(216*t|0)+168>>2])==(0|e)){e=1,n=2,r=0;break}if((0|i[11120+(216*t|0)+176>>2])==(0|e)){e=1,n=2,r=1;break}if((0|i[11120+(216*t|0)+184>>2])==(0|e)){e=1,n=2,r=2;break}if((0|i[11120+(216*t|0)+192>>2])==(0|e)){e=2,n=2,r=0;break}if((0|i[11120+(216*t|0)+200>>2])==(0|e)){e=2,n=2,r=1;break}if((0|i[11120+(216*t|0)+208>>2])==(0|e)){e=2,n=2,r=2;break}return-1}e=2,n=1,r=2}else e=2,n=1,r=1;else e=2,n=1,r=0;else e=1,n=1,r=2;else e=1,n=1,r=1;else e=1,n=1,r=0;else e=0,n=1,r=2;else e=0,n=1,r=1;else e=0,n=1,r=0;else e=2,n=0,r=2;else e=2,n=0,r=1;else e=2,n=0,r=0;else e=1,n=0,r=2;else e=1,n=0,r=1;else e=1,n=0,r=0;else e=0,n=0,r=2;else e=0,n=0,r=1;else e=0,n=0,r=0}while(0);return 0|i[11120+(216*t|0)+(72*n|0)+(24*e|0)+(r<<3)+4>>2]}(r,0|i[s>>2]);e:do{if(0|z(r)){switch(0|r){case 4:e=0;break;case 14:e=1;break;case 24:e=2;break;case 38:e=3;break;case 49:e=4;break;case 58:e=5;break;case 63:e=6;break;case 72:e=7;break;case 83:e=8;break;case 97:e=9;break;case 107:e=10;break;case 117:e=11;break;default:l=1;break e}if(u=0|i[26416+(24*e|0)+8>>2],t=0|i[26416+(24*e|0)+16>>2],(0|(e=0|i[s>>2]))!=(0|i[c>>2])&&(c=0|G(r))|(0|(e=0|i[s>>2]))==(0|t)&&(l=(l+1|0)%6|0),3==(0|a)&(0|e)==(0|t)){l=(l+5|0)%6|0,u=22;break}5==(0|a)&(0|e)==(0|u)?(l=(l+1|0)%6|0,u=22):u=22}else u=22}while(0);return 22==(0|u)&&(i[n>>2]=l,l=0),D=o,0|(n=l)}function Vt(e,t,n,r){n|=0,r|=0;var s,a,o,l,u,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0;if(u=D,D=D+32|0,y=u+24|0,l=u+20|0,o=u+8|0,a=u+16|0,s=u,p=(p=!(0|je(e|=0,t|=0)))?6:5,m=0|un(0|e,0|t,52),w(),p>>>0<=n>>>0)return D=u,0|(r=2);!(g=!(0|(m&=15)))&&!((_=0|cn(7,0,3*(15^m)|0))&e|0)&!((0|w())&t)?c=n:h=4;e:do{if(4==(0|h)){if((0|((c=!!(0|je(e,t)))?4:5))<(0|n))return D=u,0|(r=1);if(0|qt(e,t,y))return D=u,0|(r=1);if(h=(0|i[y>>2])+n|0,7==(0|(_=0|i[(c=c?26704+((0|h)%5<<2)|0:26736+((0|h)%6<<2)|0)>>2])))return D=u,0|(r=1);i[l>>2]=0,c=0|B(e,t,_,l,o);do{if(!c){if(f=0|i[(d=o)>>2],h=(A=(d=0|i[d+4>>2])>>>0>>0|(0|d)==(0|t)&f>>>0>>0)?f:e,A=A?d:t,!g&&!(f&(g=0|cn(7,0,3*(15^m)|0))|0)&!(d&(0|w())))c=n;else{if(d=(n+-1+p|0)%(0|p)|0,c=0|je(e,t),(0|d)<0&&M(27795,27797,246,27806),(0|((p=!!(0|c))?4:5))<(0|d)&&M(27795,27797,246,27806),0|qt(e,t,y)&&M(27795,27797,246,27806),c=(0|i[y>>2])+d|0,7==(0|(d=0|i[(c=p?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&M(27795,27797,246,27806),i[a>>2]=0,0|(c=0|B(e,t,d,a,s)))break;p=0|i[(f=s)>>2],f=0|i[f+4>>2];do{if(f>>>0>>0|(0|f)==(0|A)&p>>>0>>0){if(h=0|je(p,f)?0|q(p,f,e,t):0|i[26800+(((0|i[a>>2])+(0|i[26768+(d<<2)>>2])|0)%6<<2)>>2],c=0|je(p,f),(h+-1|0)>>>0>5){c=-1,h=p,A=f;break}if(1==(0|h)&(c=!!(0|c))){c=-1,h=p,A=f;break}do{if(!(0|qt(p,f,y))){if(c){c=(5+(0|i[26352+(h<<2)>>2])-(0|i[y>>2])|0)%5|0;break}c=(6+(0|i[26384+(h<<2)>>2])-(0|i[y>>2])|0)%6|0;break}c=-1}while(0);h=p,A=f}else c=n}while(0);f=0|i[(d=o)>>2],d=0|i[d+4>>2]}if((0|h)==(0|f)&(0|A)==(0|d)){if(e=(p=!!(0|je(f,d)))?0|q(f,d,e,t):0|i[26800+(((0|i[l>>2])+(0|i[26768+(_<<2)>>2])|0)%6<<2)>>2],c=0|je(f,d),(e+-1|0)>>>0<=5&&!(1==(0|e)&(v=!!(0|c))))do{if(!(0|qt(f,d,y))){if(v){c=(5+(0|i[26352+(e<<2)>>2])-(0|i[y>>2])|0)%5|0;break}c=(6+(0|i[26384+(e<<2)>>2])-(0|i[y>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|p&5==(0|c)?0:c}t=A,e=h;break e}}while(0);return D=u,0|(r=c)}}while(0);return v=0|cn(0|c,0,56),y=w()|-2130706433&t|536870912,i[r>>2]=v|e,i[r+4>>2]=y,D=u,0|(r=0)}function zt(e,t,n){e|=0,n|=0;var r=0;(0|(t|=0))>0?(r=0|Zt(t,4),i[e>>2]=r,r||M(27819,27842,40,27856)):i[e>>2]=0,i[e+4>>2]=t,i[e+8>>2]=0,i[e+12>>2]=n}function Gt(e){var t,n,r,a=0,o=0,l=0,c=0;t=(e|=0)+4|0,n=e+12|0,r=e+8|0;e:for(;;){for(o=0|i[t>>2],a=0;;){if((0|a)>=(0|o))break e;if(l=0|i[e>>2],c=0|i[l+(a<<2)>>2])break;a=a+1|0}a=l+(~~(+u(+ +h(10,+ +(15-(0|i[n>>2])|0))*(+s[c>>3]+ +s[c+8>>3]))%+(0|o))>>>0<<2)|0,o=0|i[a>>2];t:do{if(0|o){if(l=c+32|0,(0|o)==(0|c))i[a>>2]=i[l>>2];else{if(!(a=0|i[(o=o+32|0)>>2]))break;for(;(0|a)!=(0|c);)if(!(a=0|i[(o=a+32|0)>>2]))break t;i[o>>2]=i[l>>2]}Kt(c),i[r>>2]=(0|i[r>>2])-1}}while(0)}Kt(0|i[e>>2])}function Ht(e){var t,n=0,r=0;for(t=0|i[(e|=0)+4>>2],r=0;;){if((0|r)>=(0|t)){n=0,r=4;break}if(n=0|i[(0|i[e>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|n:0}function jt(e,t){t|=0;var n=0,r=0,a=0,o=0;if(n=~~(+u(+ +h(10,+ +(15-(0|i[(e|=0)+12>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,n=(0|i[e>>2])+(n<<2)|0,!(r=0|i[n>>2]))return 0|(o=1);o=t+32|0;do{if((0|r)!=(0|t)){if(!(n=0|i[r+32>>2]))return 0|(o=1);for(a=n;;){if((0|a)==(0|t)){a=8;break}if(!(n=0|i[a+32>>2])){n=1,a=10;break}r=a,a=n}if(8==(0|a)){i[r+32>>2]=i[o>>2];break}if(10==(0|a))return 0|n}else i[n>>2]=i[o>>2]}while(0);return Kt(t),i[(o=e+8|0)>>2]=(0|i[o>>2])-1,0|(o=0)}function Wt(e,t,n){e|=0,t|=0,n|=0;var r,a=0,o=0,l=0;(r=0|Yt(40))||M(27872,27842,98,27885),i[r>>2]=i[t>>2],i[r+4>>2]=i[t+4>>2],i[r+8>>2]=i[t+8>>2],i[r+12>>2]=i[t+12>>2],i[(o=r+16|0)>>2]=i[n>>2],i[o+4>>2]=i[n+4>>2],i[o+8>>2]=i[n+8>>2],i[o+12>>2]=i[n+12>>2],i[r+32>>2]=0,o=~~(+u(+ +h(10,+ +(15-(0|i[e+12>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,o=(0|i[e>>2])+(o<<2)|0,a=0|i[o>>2];do{if(a){for(;!(0|ct(a,t)&&0|ct(a+16|0,n));)if(o=0|i[a+32>>2],!(0|i[(a=0|o?o:a)+32>>2])){l=10;break}if(10==(0|l)){i[a+32>>2]=r;break}return Kt(r),0|(l=a)}i[o>>2]=r}while(0);return i[(l=e+8|0)>>2]=1+(0|i[l>>2]),0|(l=r)}function Xt(e,t,n){t|=0,n|=0;var r=0,a=0;if(a=~~(+u(+ +h(10,+ +(15-(0|i[(e|=0)+12>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,!(a=0|i[(0|i[e>>2])+(a<<2)>>2]))return 0|(n=0);if(!n){for(e=a;;){if(0|ct(e,t)){r=10;break}if(!(e=0|i[e+32>>2])){e=0,r=10;break}}if(10==(0|r))return 0|e}for(e=a;;){if(0|ct(e,t)&&0|ct(e+16|0,n)){r=10;break}if(!(e=0|i[e+32>>2])){e=0,r=10;break}}return 10==(0|r)?0|e:0}function Qt(e,t){t|=0;var n=0;if(n=~~(+u(+ +h(10,+ +(15-(0|i[(e|=0)+12>>2])|0))*(+s[t>>3]+ +s[t+8>>3]))%+(0|i[e+4>>2]))>>>0,!(e=0|i[(0|i[e>>2])+(n<<2)>>2]))return 0|(n=0);for(;;){if(0|ct(e,t)){t=5;break}if(!(e=0|i[e+32>>2])){e=0,t=5;break}}return 5==(0|t)?0|e:0}function $t(e){return 0|+gn(+(e=+e))}function Yt(e){e|=0;var t,n=0,r=0,s=0,a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0;t=D,D=D+16|0,p=t;do{if(e>>>0<245){if(e=(h=e>>>0<11?16:e+11&-8)>>>3,3&(r=(d=0|i[6977])>>>e))return s=0|i[(r=(e=27948+((n=(1&r^1)+e|0)<<1<<2)|0)+8|0)>>2],(0|(o=0|i[(a=s+8|0)>>2]))==(0|e)?i[6977]=d&~(1<>2]=e,i[r>>2]=o),x=n<<3,i[s+4>>2]=3|x,i[(x=s+x+4|0)>>2]=1|i[x>>2],D=t,0|(x=a);if(h>>>0>(A=0|i[6979])>>>0){if(0|r)return n=((n=r<>>=u=n>>>12&16)>>>5&8)|u|(o=(n>>>=r)>>>2&4)|(e=(n>>>=o)>>>1&2)|(s=(n>>>=e)>>>1&1))+(n>>>s)|0)<<1<<2)|0)+8|0)>>2],(0|(r=0|i[(u=o+8|0)>>2]))==(0|n)?(e=d&~(1<>2]=n,i[e>>2]=r,e=d),l=(x=s<<3)-h|0,i[o+4>>2]=3|h,i[(a=o+h|0)+4>>2]=1|l,i[o+x>>2]=l,0|A&&(s=0|i[6982],r=27948+((n=A>>>3)<<1<<2)|0,e&(n=1<>2]:(i[6977]=e|n,n=r,e=r+8|0),i[e>>2]=s,i[n+12>>2]=s,i[s+8>>2]=n,i[s+12>>2]=r),i[6979]=l,i[6982]=a,D=t,0|(x=u);if(o=0|i[6978]){for(r=(o&0-o)-1|0,r=c=0|i[28212+(((s=(r>>>=a=r>>>12&16)>>>5&8)|a|(l=(r>>>=s)>>>2&4)|(u=(r>>>=l)>>>1&2)|(c=(r>>>=u)>>>1&1))+(r>>>c)<<2)>>2],u=c,c=(-8&i[c+4>>2])-h|0;(e=0|i[r+16>>2])||(e=0|i[r+20>>2]);)r=e,u=(a=(l=(-8&i[e+4>>2])-h|0)>>>0>>0)?e:u,c=a?l:c;if((l=u+h|0)>>>0>u>>>0){a=0|i[u+24>>2],n=0|i[u+12>>2];do{if((0|n)==(0|u)){if(!(n=0|i[(e=u+20|0)>>2])&&!(n=0|i[(e=u+16|0)>>2])){r=0;break}for(;;)if(r=0|i[(s=n+20|0)>>2])n=r,e=s;else{if(!(r=0|i[(s=n+16|0)>>2]))break;n=r,e=s}i[e>>2]=0,r=n}else r=0|i[u+8>>2],i[r+12>>2]=n,i[n+8>>2]=r,r=n}while(0);do{if(0|a){if(n=0|i[u+28>>2],(0|u)==(0|i[(e=28212+(n<<2)|0)>>2])){if(i[e>>2]=r,!r){i[6978]=o&~(1<>2])==(0|u)?x:a+20)>>2]=r,!r)break;i[r+24>>2]=a,0|(n=0|i[u+16>>2])&&(i[r+16>>2]=n,i[n+24>>2]=r),0|(n=0|i[u+20>>2])&&(i[r+20>>2]=n,i[n+24>>2]=r)}}while(0);return c>>>0<16?(x=c+h|0,i[u+4>>2]=3|x,i[(x=u+x+4|0)>>2]=1|i[x>>2]):(i[u+4>>2]=3|h,i[l+4>>2]=1|c,i[l+c>>2]=c,0|A&&(s=0|i[6982],r=27948+((n=A>>>3)<<1<<2)|0,(n=1<>2]:(i[6977]=n|d,n=r,e=r+8|0),i[e>>2]=s,i[n+12>>2]=s,i[s+8>>2]=n,i[s+12>>2]=r),i[6979]=c,i[6982]=l),D=t,0|(x=u+8|0)}d=h}else d=h}else d=h}else if(e>>>0<=4294967231)if(h=-8&(e=e+11|0),s=0|i[6978]){a=0-h|0,c=(e>>>=8)?h>>>0>16777215?31:h>>>((c=14-((u=((g=e<<(d=(e+1048320|0)>>>16&8))+520192|0)>>>16&4)|d|(c=((g<<=u)+245760|0)>>>16&2))+(g<>>15)|0)+7|0)&1|c<<1:0,r=0|i[28212+(c<<2)>>2];e:do{if(r)for(e=0,u=h<<(31==(0|c)?0:25-(c>>>1)|0),o=0;;){if((l=(-8&i[r+4>>2])-h|0)>>>0>>0){if(!l){e=r,a=0,g=65;break e}e=r,a=l}if(o=!(0|(g=0|i[r+20>>2]))|(0|g)==(0|(r=0|i[r+16+(u>>>31<<2)>>2]))?o:g,!r){r=o,g=61;break}u<<=1}else r=0,e=0,g=61}while(0);if(61==(0|g)){if(!(0|r)&!(0|e)){if(!(e=((e=2<>>=l=d>>>12&16)>>>5&8)|l|(u=(d>>>=o)>>>2&4)|(c=(d>>>=u)>>>1&2)|(r=(d>>>=c)>>>1&1))+(d>>>r)<<2)>>2]}r?g=65:(u=e,l=a)}if(65==(0|g))for(o=r;;){if(a=(r=(d=(-8&i[o+4>>2])-h|0)>>>0>>0)?d:a,e=r?o:e,(r=0|i[o+16>>2])||(r=0|i[o+20>>2]),!r){u=e,l=a;break}o=r}if(0|u&&l>>>0<((0|i[6979])-h|0)>>>0&&(A=u+h|0)>>>0>u>>>0){o=0|i[u+24>>2],n=0|i[u+12>>2];do{if((0|n)==(0|u)){if(!(n=0|i[(e=u+20|0)>>2])&&!(n=0|i[(e=u+16|0)>>2])){n=0;break}for(;;)if(r=0|i[(a=n+20|0)>>2])n=r,e=a;else{if(!(r=0|i[(a=n+16|0)>>2]))break;n=r,e=a}i[e>>2]=0}else x=0|i[u+8>>2],i[x+12>>2]=n,i[n+8>>2]=x}while(0);do{if(o){if(e=0|i[u+28>>2],(0|u)==(0|i[(r=28212+(e<<2)|0)>>2])){if(i[r>>2]=n,!n){s&=~(1<>2])==(0|u)?x:o+20)>>2]=n,!n)break;i[n+24>>2]=o,0|(e=0|i[u+16>>2])&&(i[n+16>>2]=e,i[e+24>>2]=n),(e=0|i[u+20>>2])&&(i[n+20>>2]=e,i[e+24>>2]=n)}}while(0);e:do{if(l>>>0<16)x=l+h|0,i[u+4>>2]=3|x,i[(x=u+x+4|0)>>2]=1|i[x>>2];else{if(i[u+4>>2]=3|h,i[A+4>>2]=1|l,i[A+l>>2]=l,n=l>>>3,l>>>0<256){r=27948+(n<<1<<2)|0,(e=0|i[6977])&(n=1<>2]:(i[6977]=e|n,n=r,e=r+8|0),i[e>>2]=A,i[n+12>>2]=A,i[A+8>>2]=n,i[A+12>>2]=r;break}if(n=28212+((r=(n=l>>>8)?l>>>0>16777215?31:l>>>((r=14-((y=((x=n<<(b=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(r=((x<<=y)+245760|0)>>>16&2))+(x<>>15)|0)+7|0)&1|r<<1:0)<<2)|0,i[A+28>>2]=r,i[(e=A+16|0)+4>>2]=0,i[e>>2]=0,!(s&(e=1<>2]=A,i[A+24>>2]=n,i[A+12>>2]=A,i[A+8>>2]=A;break}n=0|i[n>>2];t:do{if((-8&i[n+4>>2])!=(0|l)){for(s=l<<(31==(0|r)?0:25-(r>>>1)|0);e=0|i[(r=n+16+(s>>>31<<2)|0)>>2];){if((-8&i[e+4>>2])==(0|l)){n=e;break t}s<<=1,n=e}i[r>>2]=A,i[A+24>>2]=n,i[A+12>>2]=A,i[A+8>>2]=A;break e}}while(0);x=0|i[(b=n+8|0)>>2],i[x+12>>2]=A,i[b>>2]=A,i[A+8>>2]=x,i[A+12>>2]=n,i[A+24>>2]=0}}while(0);return D=t,0|(x=u+8|0)}d=h}else d=h;else d=-1}while(0);if((r=0|i[6979])>>>0>=d>>>0)return n=r-d|0,e=0|i[6982],n>>>0>15?(x=e+d|0,i[6982]=x,i[6979]=n,i[x+4>>2]=1|n,i[e+r>>2]=n,i[e+4>>2]=3|d):(i[6979]=0,i[6982]=0,i[e+4>>2]=3|r,i[(x=e+r+4|0)>>2]=1|i[x>>2]),D=t,0|(x=e+8|0);if((l=0|i[6980])>>>0>d>>>0)return y=l-d|0,i[6980]=y,b=(x=0|i[6983])+d|0,i[6983]=b,i[b+4>>2]=1|y,i[x+4>>2]=3|d,D=t,0|(x=x+8|0);if(0|i[7095]?e=0|i[7097]:(i[7097]=4096,i[7096]=4096,i[7098]=-1,i[7099]=-1,i[7100]=0,i[7088]=0,i[7095]=-16&p^1431655768,e=4096),u=d+48|0,(h=(o=e+(c=d+47|0)|0)&(a=0-e|0))>>>0<=d>>>0)return D=t,0|(x=0);if(0|(e=0|i[7087])&&(p=(A=0|i[7085])+h|0)>>>0<=A>>>0|p>>>0>e>>>0)return D=t,0|(x=0);e:do{if(4&i[7088])n=0,g=143;else{r=0|i[6983];t:do{if(r){for(s=28356;!((p=0|i[s>>2])>>>0<=r>>>0&&(p+(0|i[s+4>>2])|0)>>>0>r>>>0);){if(!(e=0|i[s+8>>2])){g=128;break t}s=e}if((n=o-l&a)>>>0<2147483647)if((0|(e=0|_n(0|n)))==((0|i[s>>2])+(0|i[s+4>>2])|0)){if(-1!=(0|e)){l=n,o=e,g=145;break e}}else s=e,g=136;else n=0}else g=128}while(0);do{if(128==(0|g))if(-1!=(0|(r=0|_n(0)))&&(n=r,m=(n=((m=(f=0|i[7096])+-1|0)&n|0?(m+n&0-f)-n|0:0)+h|0)+(f=0|i[7085])|0,n>>>0>d>>>0&n>>>0<2147483647)){if(0|(p=0|i[7087])&&m>>>0<=f>>>0|m>>>0>p>>>0){n=0;break}if((0|(e=0|_n(0|n)))==(0|r)){l=n,o=r,g=145;break e}s=e,g=136}else n=0}while(0);do{if(136==(0|g)){if(r=0-n|0,!(u>>>0>n>>>0&n>>>0<2147483647&-1!=(0|s))){if(-1==(0|s)){n=0;break}l=n,o=s,g=145;break e}if((e=c-n+(e=0|i[7097])&0-e)>>>0>=2147483647){l=n,o=s,g=145;break e}if(-1==(0|_n(0|e))){_n(0|r),n=0;break}l=e+n|0,o=s,g=145;break e}}while(0);i[7088]=4|i[7088],g=143}}while(0);if(143==(0|g)&&h>>>0<2147483647&&!(-1==(0|(y=0|_n(0|h)))|1^(v=(_=(m=0|_n(0))-y|0)>>>0>(d+40|0)>>>0)|y>>>0>>0&-1!=(0|y)&-1!=(0|m)^1)&&(l=v?_:n,o=y,g=145),145==(0|g)){n=(0|i[7085])+l|0,i[7085]=n,n>>>0>(0|i[7086])>>>0&&(i[7086]=n),c=0|i[6983];e:do{if(c){for(n=28356;;){if((0|o)==((e=0|i[n>>2])+(r=0|i[n+4>>2])|0)){g=154;break}if(!(s=0|i[n+8>>2]))break;n=s}if(!(154!=(0|g)||(b=n+4|0,8&i[n+12>>2]))&&o>>>0>c>>>0&e>>>0<=c>>>0){i[b>>2]=r+l,b=c+(y=7&(y=c+8|0)?0-y&7:0)|0,y=(x=(0|i[6980])+l|0)-y|0,i[6983]=b,i[6980]=y,i[b+4>>2]=1|y,i[c+x+4>>2]=40,i[6984]=i[7099];break}for(o>>>0<(0|i[6981])>>>0&&(i[6981]=o),r=o+l|0,n=28356;;){if((0|i[n>>2])==(0|r)){g=162;break}if(!(e=0|i[n+8>>2]))break;n=e}if(162==(0|g)&&!(8&i[n+12>>2])){i[n>>2]=o,i[(A=n+4|0)>>2]=(0|i[A>>2])+l,h=(A=o+(7&(A=o+8|0)?0-A&7:0)|0)+d|0,u=(n=r+(7&(n=r+8|0)?0-n&7:0)|0)-A-d|0,i[A+4>>2]=3|d;t:do{if((0|c)==(0|n))x=(0|i[6980])+u|0,i[6980]=x,i[6983]=h,i[h+4>>2]=1|x;else{if((0|i[6982])==(0|n)){x=(0|i[6979])+u|0,i[6979]=x,i[6982]=h,i[h+4>>2]=1|x,i[h+x>>2]=x;break}if(1==(3&(e=0|i[n+4>>2]))){l=-8&e,s=e>>>3;n:do{if(e>>>0<256){if(e=0|i[n+8>>2],(0|(r=0|i[n+12>>2]))==(0|e)){i[6977]=i[6977]&~(1<>2]=r,i[r+8>>2]=e;break}o=0|i[n+24>>2],e=0|i[n+12>>2];do{if((0|e)==(0|n)){if(e=0|i[(s=(r=n+16|0)+4|0)>>2])r=s;else if(!(e=0|i[r>>2])){e=0;break}for(;;)if(s=0|i[(a=e+20|0)>>2])e=s,r=a;else{if(!(s=0|i[(a=e+16|0)>>2]))break;e=s,r=a}i[r>>2]=0}else x=0|i[n+8>>2],i[x+12>>2]=e,i[e+8>>2]=x}while(0);if(!o)break;s=28212+((r=0|i[n+28>>2])<<2)|0;do{if((0|i[s>>2])==(0|n)){if(i[s>>2]=e,0|e)break;i[6978]=i[6978]&~(1<>2])==(0|n)?x:o+20)>>2]=e,!e)break n}while(0);if(i[e+24>>2]=o,0|(s=0|i[(r=n+16|0)>>2])&&(i[e+16>>2]=s,i[s+24>>2]=e),!(r=0|i[r+4>>2]))break;i[e+20>>2]=r,i[r+24>>2]=e}while(0);n=n+l|0,a=l+u|0}else a=u;if(i[(n=n+4|0)>>2]=-2&i[n>>2],i[h+4>>2]=1|a,i[h+a>>2]=a,n=a>>>3,a>>>0<256){r=27948+(n<<1<<2)|0,(e=0|i[6977])&(n=1<>2]:(i[6977]=e|n,n=r,e=r+8|0),i[e>>2]=h,i[n+12>>2]=h,i[h+8>>2]=n,i[h+12>>2]=r;break}n=a>>>8;do{if(n){if(a>>>0>16777215){s=31;break}s=a>>>((s=14-((y=((x=n<<(b=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(s=((x<<=y)+245760|0)>>>16&2))+(x<>>15)|0)+7|0)&1|s<<1}else s=0}while(0);if(n=28212+(s<<2)|0,i[h+28>>2]=s,i[(e=h+16|0)+4>>2]=0,i[e>>2]=0,!((e=0|i[6978])&(r=1<>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break}n=0|i[n>>2];n:do{if((-8&i[n+4>>2])!=(0|a)){for(s=a<<(31==(0|s)?0:25-(s>>>1)|0);e=0|i[(r=n+16+(s>>>31<<2)|0)>>2];){if((-8&i[e+4>>2])==(0|a)){n=e;break n}s<<=1,n=e}i[r>>2]=h,i[h+24>>2]=n,i[h+12>>2]=h,i[h+8>>2]=h;break t}}while(0);x=0|i[(b=n+8|0)>>2],i[x+12>>2]=h,i[b>>2]=h,i[h+8>>2]=x,i[h+12>>2]=n,i[h+24>>2]=0}}while(0);return D=t,0|(x=A+8|0)}for(n=28356;!((e=0|i[n>>2])>>>0<=c>>>0&&(x=e+(0|i[n+4>>2])|0)>>>0>c>>>0);)n=0|i[n+8>>2];n=(e=(e=(a=x+-47|0)+(7&(e=a+8|0)?0-e&7:0)|0)>>>0<(a=c+16|0)>>>0?c:e)+8|0,b=o+(y=7&(y=o+8|0)?0-y&7:0)|0,y=(r=l+-40|0)-y|0,i[6983]=b,i[6980]=y,i[b+4>>2]=1|y,i[o+r+4>>2]=40,i[6984]=i[7099],i[(r=e+4|0)>>2]=27,i[n>>2]=i[7089],i[n+4>>2]=i[7090],i[n+8>>2]=i[7091],i[n+12>>2]=i[7092],i[7089]=o,i[7090]=l,i[7092]=0,i[7091]=n,n=e+24|0;do{b=n,i[(n=n+4|0)>>2]=7}while((b+8|0)>>>0>>0);if((0|e)!=(0|c)){if(o=e-c|0,i[r>>2]=-2&i[r>>2],i[c+4>>2]=1|o,i[e>>2]=o,n=o>>>3,o>>>0<256){r=27948+(n<<1<<2)|0,(e=0|i[6977])&(n=1<>2]:(i[6977]=e|n,n=r,e=r+8|0),i[e>>2]=c,i[n+12>>2]=c,i[c+8>>2]=n,i[c+12>>2]=r;break}if(r=28212+((s=(n=o>>>8)?o>>>0>16777215?31:o>>>((s=14-((y=((x=n<<(b=(n+1048320|0)>>>16&8))+520192|0)>>>16&4)|b|(s=((x<<=y)+245760|0)>>>16&2))+(x<>>15)|0)+7|0)&1|s<<1:0)<<2)|0,i[c+28>>2]=s,i[c+20>>2]=0,i[a>>2]=0,!((n=0|i[6978])&(e=1<>2]=c,i[c+24>>2]=r,i[c+12>>2]=c,i[c+8>>2]=c;break}n=0|i[r>>2];t:do{if((-8&i[n+4>>2])!=(0|o)){for(s=o<<(31==(0|s)?0:25-(s>>>1)|0);e=0|i[(r=n+16+(s>>>31<<2)|0)>>2];){if((-8&i[e+4>>2])==(0|o)){n=e;break t}s<<=1,n=e}i[r>>2]=c,i[c+24>>2]=n,i[c+12>>2]=c,i[c+8>>2]=c;break e}}while(0);x=0|i[(b=n+8|0)>>2],i[x+12>>2]=c,i[b>>2]=c,i[c+8>>2]=x,i[c+12>>2]=n,i[c+24>>2]=0}}else!(0|(x=0|i[6981]))|o>>>0>>0&&(i[6981]=o),i[7089]=o,i[7090]=l,i[7092]=0,i[6986]=i[7095],i[6985]=-1,i[6990]=27948,i[6989]=27948,i[6992]=27956,i[6991]=27956,i[6994]=27964,i[6993]=27964,i[6996]=27972,i[6995]=27972,i[6998]=27980,i[6997]=27980,i[7e3]=27988,i[6999]=27988,i[7002]=27996,i[7001]=27996,i[7004]=28004,i[7003]=28004,i[7006]=28012,i[7005]=28012,i[7008]=28020,i[7007]=28020,i[7010]=28028,i[7009]=28028,i[7012]=28036,i[7011]=28036,i[7014]=28044,i[7013]=28044,i[7016]=28052,i[7015]=28052,i[7018]=28060,i[7017]=28060,i[7020]=28068,i[7019]=28068,i[7022]=28076,i[7021]=28076,i[7024]=28084,i[7023]=28084,i[7026]=28092,i[7025]=28092,i[7028]=28100,i[7027]=28100,i[7030]=28108,i[7029]=28108,i[7032]=28116,i[7031]=28116,i[7034]=28124,i[7033]=28124,i[7036]=28132,i[7035]=28132,i[7038]=28140,i[7037]=28140,i[7040]=28148,i[7039]=28148,i[7042]=28156,i[7041]=28156,i[7044]=28164,i[7043]=28164,i[7046]=28172,i[7045]=28172,i[7048]=28180,i[7047]=28180,i[7050]=28188,i[7049]=28188,i[7052]=28196,i[7051]=28196,b=o+(y=7&(y=o+8|0)?0-y&7:0)|0,y=(x=l+-40|0)-y|0,i[6983]=b,i[6980]=y,i[b+4>>2]=1|y,i[o+x+4>>2]=40,i[6984]=i[7099]}while(0);if((n=0|i[6980])>>>0>d>>>0)return y=n-d|0,i[6980]=y,b=(x=0|i[6983])+d|0,i[6983]=b,i[b+4>>2]=1|y,i[x+4>>2]=3|d,D=t,0|(x=x+8|0)}return i[(x=27904)>>2]=12,D=t,0|(x=0)}function Kt(e){var t=0,n=0,r=0,s=0,a=0,o=0,l=0,u=0;if(e|=0){n=e+-8|0,s=0|i[6981],u=n+(t=-8&(e=0|i[e+-4>>2]))|0;do{if(1&e)l=n,o=n;else{if(r=0|i[n>>2],!(3&e))return;if(a=r+t|0,(o=n+(0-r)|0)>>>0>>0)return;if((0|i[6982])==(0|o)){if(3&~(t=0|i[(e=u+4|0)>>2])){l=o,t=a;break}return i[6979]=a,i[e>>2]=-2&t,i[o+4>>2]=1|a,void(i[o+a>>2]=a)}if(n=r>>>3,r>>>0<256){if(e=0|i[o+8>>2],(0|(t=0|i[o+12>>2]))==(0|e)){i[6977]=i[6977]&~(1<>2]=t,i[t+8>>2]=e,l=o,t=a;break}s=0|i[o+24>>2],e=0|i[o+12>>2];do{if((0|e)==(0|o)){if(e=0|i[(n=(t=o+16|0)+4|0)>>2])t=n;else if(!(e=0|i[t>>2])){e=0;break}for(;;)if(n=0|i[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|i[(r=e+16|0)>>2]))break;e=n,t=r}i[t>>2]=0}else l=0|i[o+8>>2],i[l+12>>2]=e,i[e+8>>2]=l}while(0);if(s){if(t=0|i[o+28>>2],(0|i[(n=28212+(t<<2)|0)>>2])==(0|o)){if(i[n>>2]=e,!e){i[6978]=i[6978]&~(1<>2])==(0|o)?l:s+20)>>2]=e,!e){l=o,t=a;break}i[e+24>>2]=s,0|(n=0|i[(t=o+16|0)>>2])&&(i[e+16>>2]=n,i[n+24>>2]=e),(t=0|i[t+4>>2])?(i[e+20>>2]=t,i[t+24>>2]=e,l=o,t=a):(l=o,t=a)}else l=o,t=a}}while(0);if(!(o>>>0>=u>>>0)&&1&(r=0|i[(e=u+4|0)>>2])){if(2&r)i[e>>2]=-2&r,i[l+4>>2]=1|t,i[o+t>>2]=t,s=t;else{if((0|i[6983])==(0|u)){if(u=(0|i[6980])+t|0,i[6980]=u,i[6983]=l,i[l+4>>2]=1|u,(0|l)!=(0|i[6982]))return;return i[6982]=0,void(i[6979]=0)}if((0|i[6982])==(0|u))return u=(0|i[6979])+t|0,i[6979]=u,i[6982]=o,i[l+4>>2]=1|u,void(i[o+u>>2]=u);s=(-8&r)+t|0,n=r>>>3;do{if(r>>>0<256){if(t=0|i[u+8>>2],(0|(e=0|i[u+12>>2]))==(0|t)){i[6977]=i[6977]&~(1<>2]=e,i[e+8>>2]=t;break}a=0|i[u+24>>2],e=0|i[u+12>>2];do{if((0|e)==(0|u)){if(e=0|i[(n=(t=u+16|0)+4|0)>>2])t=n;else if(!(e=0|i[t>>2])){n=0;break}for(;;)if(n=0|i[(r=e+20|0)>>2])e=n,t=r;else{if(!(n=0|i[(r=e+16|0)>>2]))break;e=n,t=r}i[t>>2]=0,n=e}else n=0|i[u+8>>2],i[n+12>>2]=e,i[e+8>>2]=n,n=e}while(0);if(0|a){if(e=0|i[u+28>>2],(0|i[(t=28212+(e<<2)|0)>>2])==(0|u)){if(i[t>>2]=n,!n){i[6978]=i[6978]&~(1<>2])==(0|u)?r:a+20)>>2]=n,!n)break;i[n+24>>2]=a,0|(t=0|i[(e=u+16|0)>>2])&&(i[n+16>>2]=t,i[t+24>>2]=n),0|(e=0|i[e+4>>2])&&(i[n+20>>2]=e,i[e+24>>2]=n)}}while(0);if(i[l+4>>2]=1|s,i[o+s>>2]=s,(0|l)==(0|i[6982]))return void(i[6979]=s)}if(e=s>>>3,s>>>0<256)return n=27948+(e<<1<<2)|0,(t=0|i[6977])&(e=1<>2]:(i[6977]=t|e,e=n,t=n+8|0),i[t>>2]=l,i[e+12>>2]=l,i[l+8>>2]=e,void(i[l+12>>2]=n);e=28212+((r=(e=s>>>8)?s>>>0>16777215?31:s>>>((r=14-((a=((u=e<<(o=(e+1048320|0)>>>16&8))+520192|0)>>>16&4)|o|(r=((u<<=a)+245760|0)>>>16&2))+(u<>>15)|0)+7|0)&1|r<<1:0)<<2)|0,i[l+28>>2]=r,i[l+20>>2]=0,i[l+16>>2]=0,t=0|i[6978],n=1<>2];t:do{if((-8&i[e+4>>2])!=(0|s)){for(r=s<<(31==(0|r)?0:25-(r>>>1)|0);t=0|i[(n=e+16+(r>>>31<<2)|0)>>2];){if((-8&i[t+4>>2])==(0|s)){e=t;break t}r<<=1,e=t}i[n>>2]=l,i[l+24>>2]=e,i[l+12>>2]=l,i[l+8>>2]=l;break e}}while(0);u=0|i[(o=e+8|0)>>2],i[u+12>>2]=l,i[o>>2]=l,i[l+8>>2]=u,i[l+12>>2]=e,i[l+24>>2]=0}else i[6978]=t|n,i[e>>2]=l,i[l+24>>2]=e,i[l+12>>2]=l,i[l+8>>2]=l}while(0);if(u=(0|i[6985])-1|0,i[6985]=u,!(0|u)){for(e=28364;e=0|i[e>>2];)e=e+8|0;i[6985]=-1}}}}function Zt(e,t){t|=0;var n=0;return(e|=0)?(n=0|y(t,e),(t|e)>>>0>65535&&(n=((n>>>0)/(e>>>0)|0)==(0|t)?n:-1)):n=0,(e=0|Yt(n))&&3&i[e+-4>>2]?(mn(0|e,0,0|n),0|e):0|e}function Jt(e,t,n,r){return 0|(S((t|=0)+(r|=0)+((n=(e|=0)+(n|=0)>>>0)>>>0>>0|0)>>>0|0),n)}function en(e,t,n,r){return 0|(S(0|(r=(t|=0)-(r|=0)-((n|=0)>>>0>(e|=0)>>>0|0)>>>0)),e-n>>>0)}function tn(e){return 0|((e|=0)?31-(0|T(e^e-1)):32)}function nn(e,t,n,r,s){s|=0;var a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0;if(h=e|=0,o=n|=0,l=d=r|=0,!(c=u=t|=0))return a=!!(0|s),l?a?(i[s>>2]=0|e,i[s+4>>2]=0&t,s=0,0|(S(0|(d=0)),s)):(s=0,0|(S(0|(d=0)),s)):(a&&(i[s>>2]=(h>>>0)%(o>>>0),i[s+4>>2]=0),s=(h>>>0)/(o>>>0)>>>0,0|(S(0|(d=0)),s));a=!(0|l);do{if(o){if(!a){if((a=(0|T(0|l))-(0|T(0|c))|0)>>>0<=31){o=A=a+1|0,e=h>>>(A>>>0)&(t=a-31>>31)|c<<(l=31-a|0),t&=c>>>(A>>>0),a=0,l=h<>2]=0|e,i[s+4>>2]=u|0&t,s=0,0|(S(0|(d=0)),s)):(s=0,0|(S(0|(d=0)),s))}if((a=o-1|0)&o|0){o=l=33+(0|T(0|o))-(0|T(0|c))|0,e=(A=32-l|0)-1>>31&c>>>((p=l-32|0)>>>0)|(c<>>(l>>>0))&(t=p>>31),t&=c>>>(l>>>0),a=h<<(f=64-l|0)&(u=A>>31),l=(c<>>(p>>>0))&u|h<>31;break}return 0|s&&(i[s>>2]=a&h,i[s+4>>2]=0),1==(0|o)?(f=0|e,0|(S(0|(p=u|0&t)),f)):(p=c>>>((f=0|tn(0|o))>>>0)|0,f=c<<32-f|h>>>(f>>>0),0|(S(0|p),f))}if(a)return 0|s&&(i[s>>2]=(c>>>0)%(o>>>0),i[s+4>>2]=0),f=(c>>>0)/(o>>>0)>>>0,0|(S(0|(p=0)),f);if(!h)return 0|s&&(i[s>>2]=0,i[s+4>>2]=(c>>>0)%(l>>>0)),f=(c>>>0)/(l>>>0)>>>0,0|(S(0|(p=0)),f);if(!((a=l-1|0)&l))return 0|s&&(i[s>>2]=0|e,i[s+4>>2]=a&c|0&t),p=0,f=c>>>((0|tn(0|l))>>>0),0|(S(0|p),f);if((a=(0|T(0|l))-(0|T(0|c))|0)>>>0<=30){o=t=a+1|0,e=c<<(l=31-a|0)|h>>>(t>>>0),t=c>>>(t>>>0),a=0,l=h<>2]=0|e,i[s+4>>2]=u|0&t,f=0,0|(S(0|(p=0)),f)):(f=0,0|(S(0|(p=0)),f))}while(0);if(o){c=0|Jt(0|(A=0|n),0|(h=d|0&r),-1,-1),n=0|w(),u=l,l=0;do{r=u,u=a>>>31|u<<1,a=l|a<<1,en(0|c,0|n,0|(r=e<<1|r>>>31),0|(d=e>>>31|t<<1)),l=1&(p=(f=0|w())>>31|((0|f)<0?-1:0)<<1),e=0|en(0|r,0|d,p&A|0,(((0|f)<0?-1:0)>>31|((0|f)<0?-1:0)<<1)&h),t=0|w(),o=o-1|0}while(0|o);c=u,u=0}else c=l,u=0,l=0;return o=0,0|s&&(i[s>>2]=e,i[s+4>>2]=t),f=a<<1&-2|l,0|(S(0|(p=(0|a)>>>31|(c|o)<<1|u)),f)}function rn(e,t,n,r){n|=0;var i,s,a,o,l;return s=(r|=0)>>31|((0|r)<0?-1:0)<<1,i=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,a=0|en((l=(t|=0)>>31|((0|t)<0?-1:0)<<1)^(e|=0)|0,(o=((0|t)<0?-1:0)>>31|((0|t)<0?-1:0)<<1)^t|0,0|l,0|o),e=s^l,t=i^o,0|en((0|nn(a,0|w(),0|en(s^n|0,i^r|0,0|s,0|i),0|w(),0))^e,(0|w())^t,0|e,0|t)}function sn(e,t,n,r){t|=0,r|=0;var i,s;return n=0|function(e,t){var n,r,i,s=0;return e=((n=0|y(s=65535&(t|=0),i=65535&(e|=0)))>>>16)+(0|y(s,r=e>>>16))|0,t=0|y(s=t>>>16,i),0|(S((e>>>16)+(0|y(s,r))+(((65535&e)+t|0)>>>16)|0),e+t<<16|65535&n)}(i=e|=0,s=n|=0),e=0|w(),0|(S((0|y(t,s))+(0|y(r,i))+e|0&e),n)}function an(e,t,n,r){n|=0;var s,a,o,l,u,c;return s=D,D=D+16|0,l=0|s,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,u=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,nn(e=0|en((o=(t|=0)>>31|((0|t)<0?-1:0)<<1)^(e|=0)|0,(a=((0|t)<0?-1:0)>>31|((0|t)<0?-1:0)<<1)^t|0,0|o,0|a),t=0|w(),0|en(c^n|0,u^r|0,0|c,0|u),0|w(),l),r=0|en(i[l>>2]^o|0,i[l+4>>2]^a|0,0|o,0|a),n=0|w(),D=s,0|(S(0|n),r)}function on(e,t,n,r){var s,a;return a=D,D=D+16|0,nn(e|=0,t|=0,n|=0,r|=0,s=0|a),D=a,0|(S(0|i[s+4>>2]),i[s>>2])}function ln(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(S(t>>n|0),e>>>n|(t&(1<>n-32)}function un(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(S(t>>>n|0),e>>>n|(t&(1<>>n-32|0)}function cn(e,t,n){return e|=0,t|=0,(0|(n|=0))<32?(S(t<>>32-n),e<=0?+l(e+.5):+v(e-.5)}function fn(e,t,n){e|=0,t|=0;var s,a,o=0;if((0|(n|=0))>=8192)return R(0|e,0|t,0|n),0|e;if(a=0|e,s=e+n|0,(3&e)==(3&t)){for(;3&e;){if(!n)return 0|a;r[e|0]=0|r[t|0],e=e+1|0,t=t+1|0,n=n-1|0}for(o=(n=-4&s)-64|0;(0|e)<=(0|o);)i[e>>2]=i[t>>2],i[e+4>>2]=i[t+4>>2],i[e+8>>2]=i[t+8>>2],i[e+12>>2]=i[t+12>>2],i[e+16>>2]=i[t+16>>2],i[e+20>>2]=i[t+20>>2],i[e+24>>2]=i[t+24>>2],i[e+28>>2]=i[t+28>>2],i[e+32>>2]=i[t+32>>2],i[e+36>>2]=i[t+36>>2],i[e+40>>2]=i[t+40>>2],i[e+44>>2]=i[t+44>>2],i[e+48>>2]=i[t+48>>2],i[e+52>>2]=i[t+52>>2],i[e+56>>2]=i[t+56>>2],i[e+60>>2]=i[t+60>>2],e=e+64|0,t=t+64|0;for(;(0|e)<(0|n);)i[e>>2]=i[t>>2],e=e+4|0,t=t+4|0}else for(n=s-4|0;(0|e)<(0|n);)r[e|0]=0|r[t|0],r[e+1|0]=0|r[t+1|0],r[e+2|0]=0|r[t+2|0],r[e+3|0]=0|r[t+3|0],e=e+4|0,t=t+4|0;for(;(0|e)<(0|s);)r[e|0]=0|r[t|0],e=e+1|0,t=t+1|0;return 0|a}function mn(e,t,n){t|=0;var s,a=0,o=0,l=0;if(s=(e|=0)+(n|=0)|0,t&=255,(0|n)>=67){for(;3&e;)r[e|0]=t,e=e+1|0;for(l=t|t<<8|t<<16|t<<24,o=(a=-4&s)-64|0;(0|e)<=(0|o);)i[e>>2]=l,i[e+4>>2]=l,i[e+8>>2]=l,i[e+12>>2]=l,i[e+16>>2]=l,i[e+20>>2]=l,i[e+24>>2]=l,i[e+28>>2]=l,i[e+32>>2]=l,i[e+36>>2]=l,i[e+40>>2]=l,i[e+44>>2]=l,i[e+48>>2]=l,i[e+52>>2]=l,i[e+56>>2]=l,i[e+60>>2]=l,e=e+64|0;for(;(0|e)<(0|a);)i[e>>2]=l,e=e+4|0}for(;(0|e)<(0|s);)r[e|0]=t,e=e+1|0;return s-n|0}function gn(e){return(e=+e)>=0?+l(e+.5):+v(e-.5)}function _n(e){e|=0;var t,n,r;return r=0|C(),(0|e)>0&(0|(t=(n=0|i[o>>2])+e|0))<(0|n)|(0|t)<0?(P(0|t),E(12),-1):(0|t)>(0|r)&&!(0|N(0|t))?(E(12),-1):(i[o>>2]=t,0|n)}return{___divdi3:rn,___muldi3:sn,___remdi3:an,___uremdi3:on,_areNeighborCells:function(e,t,n,r,s){s|=0;var a,o,l,u=0,c=0,h=0,A=0;if(l=D,D=D+64|0,o=l,a=l+56|0,!(!0&134217728==(2013265920&(t|=0))&!0&134217728==(2013265920&(r|=0))))return D=l,0|(s=5);if((0|(e|=0))==(0|(n|=0))&(0|t)==(0|r))return i[s>>2]=0,D=l,0|(s=0);if(c=0|un(0|e,0|t,52),w(),c&=15,A=0|un(0|n,0|r,52),w(),(0|c)!=(15&A))return D=l,0|(s=12);if(u=c+-1|0,c>>>0>1){Ge(e,t,u,o),Ge(n,r,u,a),h=0|i[(A=o)>>2],A=0|i[A+4>>2];e:do{if((0|h)==(0|i[a>>2])&&(0|A)==(0|i[a+4>>2])){u=0|un(0|e,0|t,0|(c=3*(15^c)|0)),w(),u&=7,c=0|un(0|n,0|r,0|c),w(),c&=7;do{if(!(0|u)|!(0|c))i[s>>2]=1,u=0;else if(7==(0|u))u=5;else{if(1==(0|u)|1==(0|c)&&0|je(h,A)){u=5;break}if((0|i[15536+(u<<2)>>2])!=(0|c)&&(0|i[15568+(u<<2)>>2])!=(0|c))break e;i[s>>2]=1,u=0}}while(0);return D=l,0|(s=u)}}while(0)}c=(u=o)+56|0;do{i[u>>2]=0,u=u+4|0}while((0|u)<(0|c));return L(e,t,1,o),u=(0|i[(t=o)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=o+8|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=o+16|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=o+24|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=o+32|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)||(0|i[(t=o+40|0)>>2])==(0|n)&&(0|i[t+4>>2])==(0|r)?1:1&((0|i[(u=o+48|0)>>2])==(0|n)?(0|i[u+4>>2])==(0|r):0),i[s>>2]=u,D=l,0|(s=0)},_bitshift64Ashr:ln,_bitshift64Lshr:un,_bitshift64Shl:cn,_calloc:Zt,_cellAreaKm2:function(e,t,n){return 0|(e=0|mt(e|=0,t|=0,n|=0))||(s[n>>3]=6371.007180918475*+s[n>>3]*6371.007180918475),0|e},_cellAreaM2:function(e,t,n){return 0|(e=0|mt(e|=0,t|=0,n|=0))||(s[n>>3]=6371.007180918475*+s[n>>3]*6371.007180918475*1e3*1e3),0|e},_cellAreaRads2:mt,_cellToBoundary:it,_cellToCenterChild:Xe,_cellToChildPos:function(e,t,n,r){n|=0,r|=0;var s,a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0;if(s=D,D=D+16|0,_=s,v=0|un(0|(e|=0),0|(t|=0),52),w(),v&=15,n>>>0>15)return D=s,0|(v=4);if((0|v)<(0|n))return D=s,0|(v=12);if((0|v)!=(0|n))if(o=0|cn(0|n,0,52),o|=e,u=w()|-15728641&t,(0|v)>(0|n)){c=n;do{g=0|cn(7,0,3*(14-c|0)|0),c=c+1|0,o|=g,u=0|w()|u}while((0|c)<(0|v));g=o}else g=o;else g=e,u=t;m=0|un(0|g,0|u,45),w();e:do{if(0|z(127&m)){if(c=0|un(0|g,0|u,52),w(),0|(c&=15))for(o=1;;){if(!(!((m=0|cn(7,0,3*(15-o|0)|0))&g|0)&!((0|w())&u))){h=33;break e}if(!(o>>>0>>0))break;o=o+1|0}if(i[(m=r)>>2]=0,i[m+4>>2]=0,(0|v)>(0|n)){for(m=-15728641&t,f=v;;){if(p=f,(f=f+-1|0)>>>0>15|(0|v)<(0|f)){h=19;break}if((0|v)!=(0|f))if(o=0|cn(0|f,0,52),o|=e,c=0|w()|m,(0|v)<(0|p))d=o;else{h=f;do{d=0|cn(7,0,3*(14-h|0)|0),h=h+1|0,o|=d,c=0|w()|c}while((0|h)<(0|v));d=o}else d=e,c=t;if(A=0|un(0|d,0|c,45),w(),0|z(127&A)){A=0|un(0|d,0|c,52),w(),A&=15;t:do{if(A)for(h=1;;){if(o=0|un(0|d,0|c,3*(15-h|0)|0),w(),0|(o&=7))break t;if(!(h>>>0>>0)){o=0;break}h=h+1|0}else o=0}while(0);o=1&!(0|o)}else o=0;if(c=0|un(0|e,0|t,3*(15-p|0)|0),w(),7==(0|(c&=7))){a=5,h=42;break}if(1==(0|c)&(o=!!(0|o))){a=5,h=42;break}if(0|(d=c+((!!(0|c)&o)<<31>>31)|0)&&(h=0|St(7,0,h=v-p|0,((0|h)<0)<<31>>31),A=0|w(),o?(o=0|Jt(0|(o=0|sn(0|h,0|A,5,0)),0|w(),-5,-1),o=0|Jt(0|(o=0|rn(0|o,0|w(),6,0)),0|w(),1,0),c=0|w()):(o=h,c=A),p=0|Jt(0|o,0|c,0|(p=0|sn(0|h,0|A,0|(p=d+-1|0),((0|p)<0)<<31>>31)),0|w()),A=0|Jt(0|p,0|(d=0|w()),0|i[(A=r)>>2],0|i[A+4>>2]),d=0|w(),i[(p=r)>>2]=A,i[p+4>>2]=d),(0|f)<=(0|n)){h=37;break}}if(19==(0|h))M(27795,27122,1276,27158);else{if(37==(0|h)){a=0|i[(l=r)+4>>2],l=0|i[l>>2];break}if(42==(0|h))return D=s,0|a}}else a=0,l=0}else h=33}while(0);e:do{if(33==(0|h)){if(i[(m=r)>>2]=0,i[m+4>>2]=0,(0|v)>(0|n)){for(o=v;;){if(a=0|un(0|e,0|t,3*(15-o|0)|0),w(),7==(0|(a&=7))){a=5;break}if(a=0|sn(0|(l=0|St(7,0,l=v-o|0,((0|l)<0)<<31>>31)),0|w(),0|a,0),l=0|w(),l=0|Jt(0|i[(m=r)>>2],0|i[m+4>>2],0|a,0|l),a=0|w(),i[(m=r)>>2]=l,i[m+4>>2]=a,(0|(o=o+-1|0))<=(0|n))break e}return D=s,0|a}a=0,l=0}}while(0);return 0|He(g,u,v,_)&&M(27795,27122,1236,27173),((0|a)>-1|-1==(0|a)&l>>>0>4294967295)&((0|(_=0|i[(v=_)+4>>2]))>(0|a)|((0|_)==(0|a)?(0|i[v>>2])>>>0>l>>>0:0))?(D=s,0|(v=0)):(M(27795,27122,1316,27158),0)},_cellToChildren:function(e,t,n,r){r|=0;var s,a,o=0,l=0;if(a=D,D=D+16|0,at(s=a,e|=0,t|=0,n|=0),!(0|(e=0|i[(t=s)>>2]))&!(0|(t=0|i[t+4>>2])))return D=a,0;o=0,n=0;do{i[(l=r+(o<<3)|0)>>2]=e,i[l+4>>2]=t,o=0|Jt(0|o,0|n,1,0),n=0|w(),lt(s),e=0|i[(l=s)>>2],t=0|i[l+4>>2]}while(!(!(0|e)&!(0|t)));return D=a,0},_cellToChildrenSize:He,_cellToLatLng:rt,_cellToLocalIj:function(e,t,n,r,i,s){var a,o;return e|=0,t|=0,n|=0,r|=0,s|=0,o=D,D=D+16|0,a=o,(i|=0)?e=15:(e=0|xt(e,t,n,r,a))||(Me(a,s),e=0),D=o,0|e},_cellToParent:Ge,_cellToVertex:Vt,_cellToVertexes:function(e,t,n){n|=0;var r,s=0,a=0;return a=!(0|je(e|=0,t|=0)),r=!(0|(s=0|Vt(e,t,0,n))),a?r?0|(s=0|Vt(e,t,1,n+8|0))||0|(s=0|Vt(e,t,2,n+16|0))||0|(s=0|Vt(e,t,3,n+24|0))||(s=0|Vt(e,t,4,n+32|0))?0|(a=s):0|Vt(e,t,5,n+40|0):0|(a=s):r?0|(s=0|Vt(e,t,1,n+8|0))||0|(s=0|Vt(e,t,2,n+16|0))||0|(s=0|Vt(e,t,3,n+24|0))||0|(s=0|Vt(e,t,4,n+32|0))?0|(a=s):(i[(a=n+40|0)>>2]=0,i[a+4>>2]=0,0|(a=0)):0|(a=s)},_cellsToDirectedEdge:function(e,t,n,r,s){return s|=0,7==(0|(n=0|q(e|=0,t|=0,n|=0,r|=0)))?0|(s=11):(r=0|cn(0|n,0,56),t=-2130706433&t|w()|268435456,i[s>>2]=e|r,i[s+4>>2]=t,0|(s=0))},_cellsToLinkedMultiPolygon:function(e,t,n){n|=0;var r,s,a,o=0;if(a=D,D=D+32|0,r=a,e=0|function(e,t,n){e|=0,n|=0;var r,s,a=0,o=0,l=0,u=0,c=0,h=0;if(s=D,D=D+176|0,r=s,(0|(t|=0))<1)return zt(n,0,0),D=s,0;for(c=0|un(0|i[(c=e)>>2],0|i[c+4>>2],52),w(),zt(n,(0|t)>6?t:6,15&c),c=0;!(0|(a=0|it(0|i[(a=e+(c<<3)|0)>>2],0|i[a+4>>2],r)));){if((0|(a=0|i[r>>2]))>0){u=0;do{l=r+8+(u<<4)|0,(o=0|Xt(n,a=r+8+((0|(u=u+1|0))%(0|a)<<4)|0,l))?jt(n,o):Wt(n,l,a),a=0|i[r>>2]}while((0|u)<(0|a))}if((0|(c=c+1|0))>=(0|t)){a=0,h=13;break}}return 13==(0|h)?(D=s,0|a):(Gt(n),D=s,0|(h=a))}(e|=0,t|=0,s=a+16|0),0|e)return D=a,0|(n=e);if(i[n>>2]=0,i[n+4>>2]=0,i[n+8>>2]=0,0|(e=0|Ht(s)))do{t=0|gt(n);do{_t(t,e),o=e+16|0,i[r>>2]=i[o>>2],i[r+4>>2]=i[o+4>>2],i[r+8>>2]=i[o+8>>2],i[r+12>>2]=i[o+12>>2],jt(s,e),e=0|Qt(s,r)}while(0|e);e=0|Ht(s)}while(0|e);return Gt(s),(e=0|yt(n))?(vt(n),D=a,0|(o=e)):(D=a,0|(o=0))},_childPosToCell:function(e,t,n,r,s,a){e|=0,t|=0,a|=0;var o,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0;if(o=D,D=D+16|0,l=o,(s|=0)>>>0>15)return D=o,0|(a=4);if(u=0|un(0|(n|=0),0|(r|=0),52),w(),(0|(u&=15))>(0|s))return D=o,0|(a=12);if(0|He(n,r,s,l)&&M(27795,27122,1236,27173),!(((0|t)>-1|-1==(0|t)&e>>>0>4294967295)&((0|(h=0|i[(A=l)+4>>2]))>(0|t)|((0|h)==(0|t)?(0|i[A>>2])>>>0>e>>>0:0))))return D=o,0|(a=2);A=s-u|0,s=0|cn(0|s,0,52),c=w()|-15728641&r,i[(h=a)>>2]=s|n,i[h+4>>2]=c,h=0|un(0|n,0|r,45),w();e:do{if(0|z(127&h)){if(0|u)for(l=1;;){if(!(!((h=0|cn(7,0,3*(15-l|0)|0))&n|0)&!((0|w())&r)))break e;if(!(l>>>0>>0))break;l=l+1|0}if((0|A)<1)return D=o,0|(a=0);for(h=15^u,r=-1,c=1,l=1;;){u=0|St(7,0,u=A-c|0,((0|u)<0)<<31>>31),n=0|w();do{if(l){if(l=0|rn(0|(l=0|Jt(0|(l=0|sn(0|u,0|n,5,0)),0|w(),-5,-1)),0|w(),6,0),(0|t)>(0|(s=0|w()))|(0|t)==(0|s)&e>>>0>l>>>0){t=0|en(0|(t=0|Jt(0|e,0|t,-1,-1)),0|w(),0|l,0|s),l=0|w(),f=0|i[(d=a)>>2],d=0|i[d+4>>2],p=0|cn(7,0,0|(m=3*(h+r|0)|0)),d&=~w(),m=0|cn(0|(s=0|Jt(0|(r=0|rn(0|t,0|l,0|u,0|n)),0|(e=0|w()),2,0)),0|w(),0|m),d=0|w()|d,i[(s=a)>>2]=m|f&~p,i[s+4>>2]=d,e=0|en(0|t,0|l,0|(e=0|sn(0|r,0|e,0|u,0|n)),0|w()),l=0,t=0|w();break}p=0|i[(m=a)>>2],m=0|i[m+4>>2],f=0|cn(7,0,3*(h+r|0)|0),m&=~w(),i[(l=a)>>2]=p&~f,i[l+4>>2]=m,l=1;break}s=0|i[(p=a)>>2],p=0|i[p+4>>2],d=0|cn(7,0,0|(r=3*(h+r|0)|0)),p&=~w(),r=0|cn(0|(m=0|rn(0|e,0|t,0|u,0|n)),0|(l=0|w()),0|r),p=0|w()|p,i[(f=a)>>2]=r|s&~d,i[f+4>>2]=p,e=0|en(0|e,0|t,0|(l=0|sn(0|m,0|l,0|u,0|n)),0|w()),l=0,t=0|w()}while(0);if(!((0|A)>(0|c))){t=0;break}r=~c,c=c+1|0}return D=o,0|t}}while(0);if((0|A)<1)return D=o,0|(m=0);for(s=15^u,l=1;;){if(f=0|St(7,0,f=A-l|0,((0|f)<0)<<31>>31),m=0|w(),n=0|i[(c=a)>>2],c=0|i[c+4>>2],r=0|cn(7,0,0|(u=3*(s-l|0)|0)),c&=~w(),u=0|cn(0|(d=0|rn(0|e,0|t,0|f,0|m)),0|(p=0|w()),0|u),c=0|w()|c,i[(h=a)>>2]=u|n&~r,i[h+4>>2]=c,e=0|en(0|e,0|t,0|(m=0|sn(0|d,0|p,0|f,0|m)),0|w()),t=0|w(),(0|A)<=(0|l)){t=0;break}l=l+1|0}return D=o,0|t},_compactCells:function(e,t,n,r){t|=0;var s,a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0,T=0,S=0,E=0,C=0,R=0,N=0,P=0,D=0;if(!(0|(n|=0))&!(0|(r|=0)))return 0|(D=0);if(o=0|i[(a=e|=0)>>2],!0&!(15728640&(a=0|i[a+4>>2]))){if(!((0|r)>0|!(0|r)&n>>>0>0))return 0|(D=0);if(i[(D=t)>>2]=o,i[D+4>>2]=a,1==(0|n)&!(0|r))return 0|(D=0);a=1,o=0;do{P=0|i[(N=e+(a<<3)|0)+4>>2],i[(D=t+(a<<3)|0)>>2]=i[N>>2],i[D+4>>2]=P,a=0|Jt(0|a,0|o,1,0),o=0|w()}while((0|o)<(0|r)|(0|o)==(0|r)&a>>>0>>0);return 0|(a=0)}if(!(P=0|Yt(s=n<<3)))return 0|(D=13);if(fn(0|P,0|e,0|s),!(N=0|Zt(n,8)))return Kt(P),0|(D=13);e:for(;;){C=0|un(0|(h=0|i[(a=P)>>2]),0|(a=0|i[a+4>>2]),52),w(),R=(C&=15)+-1|0,E=!!(0|C),S=(0|r)>0|!(0|r)&n>>>0>0;t:do{if(E&S){if(y=0|cn(0|R,0,52),b=0|w(),R>>>0>15){if(!(!(0|h)&!(0|a))){D=16;break e}for(o=0,e=0;;){if(o=0|Jt(0|o,0|e,1,0),!((0|(e=0|w()))<(0|r)|(0|e)==(0|r)&o>>>0>>0))break t;if(!(!(0|(T=0|i[(l=P+(o<<3)|0)>>2]))&!(0|(l=0|i[l+4>>2])))){a=l,D=16;break e}}}for(u=h,e=a,o=0,l=0;;){if(!(!(0|u)&!(0|e))){if(!(!0&!(117440512&e))){D=21;break e}if(A=0|un(0|u,0|e,52),w(),(0|(A&=15))<(0|R)){a=12,D=27;break e}if((0|A)!=(0|R)&&(u|=y,e=-15728641&e|b,A>>>0>=C>>>0)){c=R;do{T=0|cn(7,0,3*(14-c|0)|0),c=c+1|0,u|=T,e=0|w()|e}while(c>>>0>>0)}if(p=0|on(0|u,0|e,0|n,0|r),f=0|w(),!(!(0|(d=0|i[(A=c=N+(p<<3)|0)>>2]))&!(0|(A=0|i[A+4>>2])))){_=0,v=0;do{if((0|_)>(0|r)|(0|_)==(0|r)&v>>>0>n>>>0){D=31;break e}if((0|d)==(0|u)&(-117440513&A)==(0|e)){m=0|un(0|d,0|A,56),w(),g=(m&=7)+1|0,T=0|un(0|d,0|A,45),w();n:do{if(0|z(127&T)){if(d=0|un(0|d,0|A,52),w(),!(d&=15)){A=6;break}for(A=1;;){if(!(!((T=0|cn(7,0,3*(15-A|0)|0))&u|0)&!((0|w())&e))){A=7;break n}if(!(A>>>0>>0)){A=6;break}A=A+1|0}}else A=7}while(0);if((m+2|0)>>>0>A>>>0){D=41;break e}T=0|cn(0|g,0,56),e=w()|-117440513&e,i[(x=c)>>2]=0,i[x+4>>2]=0,u|=T}else p=0|an(0|(p=0|Jt(0|p,0|f,1,0)),0|w(),0|n,0|r),f=0|w();v=0|Jt(0|v,0|_,1,0),_=0|w(),d=0|i[(A=c=N+(p<<3)|0)>>2],A=0|i[A+4>>2]}while(!(!(0|d)&!(0|A)))}i[(T=c)>>2]=u,i[T+4>>2]=e}if(o=0|Jt(0|o,0|l,1,0),!((0|(l=0|w()))<(0|r)|(0|l)==(0|r)&o>>>0>>0))break t;u=0|i[(e=P+(o<<3)|0)>>2],e=0|i[e+4>>2]}}}while(0);if(T=0|Jt(0|n,0|r,5,0),(x=0|w())>>>0<0|!(0|x)&T>>>0<11){D=85;break}if(T=0|rn(0|n,0|r,6,0),w(),!(T=0|Zt(T,8))){D=48;break}do{if(S){for(g=0,e=0,m=0,_=0;;){if(!(0|(o=0|i[(l=A=N+(g<<3)|0)>>2]))&!(0|(l=0|i[l+4>>2])))x=m;else{d=0|un(0|o,0|l,56),w(),u=(d&=7)+1|0,p=-117440513&l,x=0|un(0|o,0|l,45),w();t:do{if(0|z(127&x)){if(f=0|un(0|o,0|l,52),w(),0|(f&=15))for(c=1;;){if(!(!(o&(x=0|cn(7,0,3*(15-c|0)|0))|0)&!(p&(0|w()))))break t;if(!(c>>>0>>0))break;c=c+1|0}o|=l=0|cn(0|u,0,56),l=0|w()|p,i[(u=A)>>2]=o,i[u+4>>2]=l,u=d+2|0}}while(0);7==(0|u)?(i[(x=T+(e<<3)|0)>>2]=o,i[x+4>>2]=-117440513&l,e=0|Jt(0|e,0|m,1,0),x=0|w()):x=m}if(g=0|Jt(0|g,0|_,1,0),!((0|(_=0|w()))<(0|r)|(0|_)==(0|r)&g>>>0>>0))break;m=x}if(S){if(v=R>>>0>15,y=0|cn(0|R,0,52),b=0|w(),!E){for(o=0,c=0,u=0,l=0;!(0|h)&!(0|a)||(i[(R=t+(o<<3)|0)>>2]=h,i[R+4>>2]=a,o=0|Jt(0|o,0|c,1,0),c=0|w()),u=0|Jt(0|u,0|l,1,0),(0|(l=0|w()))<(0|r)|(0|l)==(0|r)&u>>>0>>0;)h=0|i[(a=P+(u<<3)|0)>>2],a=0|i[a+4>>2];a=x;break}for(o=0,c=0,l=0,u=0;;){do{if(!(!(0|h)&!(0|a))){if(f=0|un(0|h,0|a,52),w(),v|(0|(f&=15))<(0|R)){D=80;break e}if((0|f)!=(0|R)){if(A=h|y,d=-15728641&a|b,f>>>0>=C>>>0){p=R;do{E=0|cn(7,0,3*(14-p|0)|0),p=p+1|0,A|=E,d=0|w()|d}while(p>>>0>>0)}}else A=h,d=a;m=0|on(0|A,0|d,0|n,0|r),p=0,f=0,_=0|w();do{if((0|p)>(0|r)|(0|p)==(0|r)&f>>>0>n>>>0){D=81;break e}if((-117440513&(g=0|i[(E=N+(m<<3)|0)+4>>2]))==(0|d)&&(0|i[E>>2])==(0|A)){D=65;break}m=0|an(0|(E=0|Jt(0|m,0|_,1,0)),0|w(),0|n,0|r),_=0|w(),f=0|Jt(0|f,0|p,1,0),p=0|w(),E=N+(m<<3)|0}while((0|i[E>>2])!=(0|A)||(0|i[E+4>>2])!=(0|d));if(65==(0|D)&&(D=0,!0&100663296==(117440512&g)))break;i[(E=t+(o<<3)|0)>>2]=h,i[E+4>>2]=a,o=0|Jt(0|o,0|c,1,0),c=0|w()}}while(0);if(l=0|Jt(0|l,0|u,1,0),!((0|(u=0|w()))<(0|r)|(0|u)==(0|r)&l>>>0>>0))break;h=0|i[(a=P+(l<<3)|0)>>2],a=0|i[a+4>>2]}a=x}else o=0,a=x}else o=0,e=0,a=0}while(0);if(mn(0|N,0,0|s),fn(0|P,0|T,e<<3),Kt(T),!(0|e)&!(0|a)){D=89;break}t=t+(o<<3)|0,r=a,n=e}if(16==(0|D))!0&!(117440512&a)?(a=4,D=27):D=21;else if(31==(0|D))M(27795,27122,529,27132);else{if(41==(0|D))return Kt(P),Kt(N),0|(D=10);if(48==(0|D))return Kt(P),Kt(N),0|(D=13);80==(0|D)?M(27795,27122,620,27132):81==(0|D)?M(27795,27122,632,27132):85==(0|D)&&(fn(0|t,0|P,n<<3),D=89)}return 21==(0|D)?(Kt(P),Kt(N),0|(D=5)):27==(0|D)?(Kt(P),Kt(N),0|(D=a)):89==(0|D)?(Kt(P),Kt(N),0|(D=0)):0},_destroyLinkedMultiPolygon:vt,_directedEdgeToBoundary:Ne,_directedEdgeToCells:function(e,t,n){e|=0;var r,s,a,o=0;return r=D,D=D+16|0,o=r,!0&268435456==(2013265920&(t|=0))?(s=-2130706433&t|134217728,i[(a=n|=0)>>2]=e,i[a+4>>2]=s,i[o>>2]=0,t=0|un(0|e,0|t,56),w(),o=0|B(e,s,7&t,o,n+8|0),D=r,0|o):(D=r,0|(o=6))},_edgeLengthKm:function(e,t,n){n|=0;var r,a=0,o=0,l=0,u=0,h=0,p=0,f=0;if(r=D,D=D+176|0,0|(e=0|Ne(e|=0,t|=0,u=r)))return u=e,l=+s[n>>3],l*=6371.007180918475,s[n>>3]=l,D=r,0|u;if(s[n>>3]=0,(0|(e=0|i[u>>2]))<=1)return u=0,l=0,l*=6371.007180918475,s[n>>3]=l,D=r,0|u;t=e+-1|0,e=0,a=+s[u+8>>3],o=+s[u+16>>3],l=0;do{p=a,a=+s[u+8+((e=e+1|0)<<4)>>3],f=+d(.5*(a-p)),h=o,o=+s[u+8+(e<<4)+8>>3],h=f*f+(h=+d(.5*(o-h)))*(+A(+p)*+A(+a)*h),l+=2*+_(+ +c(+h),+ +c(+(1-h)))}while((0|e)!=(0|t));return s[n>>3]=l,u=0,f=l,f*=6371.007180918475,s[n>>3]=f,D=r,0|u},_edgeLengthM:function(e,t,n){n|=0;var r,a=0,o=0,l=0,u=0,h=0,p=0,f=0;if(r=D,D=D+176|0,0|(e=0|Ne(e|=0,t|=0,u=r)))return u=e,l=+s[n>>3],l*=6371.007180918475,l*=1e3,s[n>>3]=l,D=r,0|u;if(s[n>>3]=0,(0|(e=0|i[u>>2]))<=1)return u=0,l=0,l*=6371.007180918475,l*=1e3,s[n>>3]=l,D=r,0|u;t=e+-1|0,e=0,a=+s[u+8>>3],o=+s[u+16>>3],l=0;do{p=a,a=+s[u+8+((e=e+1|0)<<4)>>3],f=+d(.5*(a-p)),h=o,o=+s[u+8+(e<<4)+8>>3],h=f*f+(h=+d(.5*(o-h)))*(+A(+p)*+A(+a)*h),l+=2*+_(+ +c(+h),+ +c(+(1-h)))}while((0|e)!=(0|t));return s[n>>3]=l,u=0,f=l,f*=6371.007180918475,f*=1e3,s[n>>3]=f,D=r,0|u},_edgeLengthRads:function(e,t,n){n|=0;var r,a=0,o=0,l=0,u=0,h=0,p=0,f=0;if(r=D,D=D+176|0,0|(e=0|Ne(e|=0,t|=0,u=r)))return D=r,0|(u=e);if(s[n>>3]=0,(0|(e=0|i[u>>2]))<=1)return D=r,0|(u=0);t=e+-1|0,e=0,a=+s[u+8>>3],o=+s[u+16>>3],l=0;do{p=a,a=+s[u+8+((e=e+1|0)<<4)>>3],f=+d(.5*(a-p)),h=o,o=+s[u+8+(e<<4)+8>>3],h=f*f+(h=+d(.5*(o-h)))*(+A(+a)*+A(+p)*h),l+=2*+_(+ +c(+h),+ +c(+(1-h)))}while((0|e)<(0|t));return s[n>>3]=l,D=r,0|(u=0)},_emscripten_replace_memory:function(e){return r=new Int8Array(e),i=new Int32Array(e),s=new Float64Array(e),n=e,!0},_free:Kt,_getBaseCellNumber:qe,_getDirectedEdgeDestination:function(e,t,n){e|=0,t|=0,n|=0;var r,s,a=0;return r=D,D=D+16|0,i[(a=r)>>2]=0,!0&268435456==(2013265920&t)?(s=0|un(0|e,0|t,56),w(),a=0|B(e,-2130706433&t|134217728,7&s,a,n),D=r,0|a):(D=r,0|(a=6))},_getDirectedEdgeOrigin:function(e,t,n){return e|=0,n|=0,!0&268435456==(2013265920&(t|=0))?(i[n>>2]=e,i[n+4>>2]=-2130706433&t|134217728,0|(n=0)):0|(n=6)},_getHexagonAreaAvgKm2:dt,_getHexagonAreaAvgM2:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[20784+(e<<3)>>3],0|(t=0))},_getHexagonEdgeLengthAvgKm:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[20912+(e<<3)>>3],0|(t=0))},_getHexagonEdgeLengthAvgM:function(e,t){return t|=0,(e|=0)>>>0>15?0|(t=4):(s[t>>3]=+s[21040+(e<<3)>>3],0|(t=0))},_getIcosahedronFaces:function e(t,n,r){r|=0;var s,a=0,o=0,l=0,u=0,c=0,h=0,A=0,d=0;s=D,D=D+128|0,A=s+112|0,l=s+96|0,d=s,o=0|un(0|(t|=0),0|(n|=0),52),w(),c=15&o,i[A>>2]=c,u=0|un(0|t,0|n,45),w(),u&=127;e:do{if(0|z(u)){if(0|c)for(a=1;;){if(!(!((h=0|cn(7,0,3*(15-a|0)|0))&t|0)&!((0|w())&n))){o=0;break e}if(!(a>>>0>>0))break;a=a+1|0}if(!(1&o))return h=0|cn(c+1|0,0,52),d=w()|-15728641&n,d=0|e((h|t)&~(A=0|cn(7,0,3*(14-c|0)|0)),d&~w(),r),D=s,0|d;o=1}else o=0}while(0);if(!(a=0|nt(t,n,l))){o?(Ue(l,A,d),h=5):(ke(l,A,d),h=6);e:do{if(0|z(u))if(c)for(a=1;;){if(!(!((u=0|cn(7,0,3*(15-a|0)|0))&t|0)&!((0|w())&n))){t=2;break e}if(!(a>>>0>>0)){t=5;break}a=a+1|0}else t=5;else t=2}while(0);mn(0|r,-1,t<<2);e:do{if(o)for(l=0;;){if(Be(u=d+(l<<4)|0,0|i[A>>2]),u=0|i[u>>2],-1==(0|(c=0|i[r>>2]))|(0|c)==(0|u))a=r;else{o=0;do{if((o=o+1|0)>>>0>=t>>>0){a=1;break e}c=0|i[(a=r+(o<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|u)))}if(i[a>>2]=u,(l=l+1|0)>>>0>=h>>>0){a=0;break}}else for(l=0;;){if(Oe(u=d+(l<<4)|0,0|i[A>>2],0,1),u=0|i[u>>2],-1==(0|(c=0|i[r>>2]))|(0|c)==(0|u))a=r;else{o=0;do{if((o=o+1|0)>>>0>=t>>>0){a=1;break e}c=0|i[(a=r+(o<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|u)))}if(i[a>>2]=u,(l=l+1|0)>>>0>=h>>>0){a=0;break}}}while(0)}return D=s,0|(d=a)},_getNumCells:pt,_getPentagons:st,_getRes0Cells:function(e){e|=0;var t=0,n=0,r=0;t=0;do{cn(0|t,0,45),r=134225919|w(),i[(n=e+(t<<3)|0)>>2]=-1,i[n+4>>2]=r,t=t+1|0}while(122!=(0|t));return 0},_getResolution:function(e,t){return t=0|un(0|(e|=0),0|(t|=0),52),w(),15&t},_greatCircleDistanceKm:At,_greatCircleDistanceM:function(e,t){e|=0;var n,r,i,a=0;return r=+s[(t|=0)>>3],n=+s[e>>3],a=(i=+d(.5*(r-n)))*i+(a=+d(.5*(+s[t+8>>3]-+s[e+8>>3])))*(+A(+r)*+A(+n)*a),2*+_(+ +c(+a),+ +c(+(1-a)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(e,t){e|=0;var n,r,i,a=0;return r=+s[(t|=0)>>3],n=+s[e>>3],a=(i=+d(.5*(r-n)))*i+(a=+d(.5*(+s[t+8>>3]-+s[e+8>>3])))*(+A(+r)*+A(+n)*a),2*+_(+ +c(+a),+ +c(+(1-a)))},_gridDisk:L,_gridDiskDistances:I,_gridDistance:function(e,t,n,r,s){n|=0,r|=0,s|=0;var a,o,l=0,u=0;return o=D,D=D+32|0,u=o,0|(a=0|xt(e|=0,t|=0,e,t,l=o+12|0))?(D=o,0|(u=a)):0|(e=0|xt(e,t,n,r,u))?(D=o,0|(u=e)):(l=0|we(l,u),i[(u=s)>>2]=l,i[u+4>>2]=((0|l)<0)<<31>>31,D=o,0|(u=0))},_gridPathCells:function(e,t,n,r,s){n|=0,r|=0,s|=0;var a,o,l=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0,T=0,S=0,E=0,C=0;if(o=D,D=D+48|0,c=o+12|0,E=o,!(l=0|xt(e|=0,t|=0,e,t,a=o+24|0))&&!(l=0|xt(e,t,n,r,c))){S=((0|(T=0|we(a,c)))<0)<<31>>31,i[a>>2]=0,i[a+4>>2]=0,i[a+8>>2]=0,i[c>>2]=0,i[c+4>>2]=0,i[c+8>>2]=0,0|xt(e,t,e,t,a)&&M(27795,27538,692,27747),0|xt(e,t,n,r,c)&&M(27795,27538,697,27747),Ce(a),Ce(c),p=0|T?1/+(0|T):0,n=0|i[a>>2],v=p*+((0|i[c>>2])-n|0),r=0|i[(y=a+4|0)>>2],b=p*+((0|i[c+4>>2])-r|0),l=0|i[(x=a+8|0)>>2],p*=+((0|i[c+8>>2])-l|0),i[E>>2]=n,i[(f=E+4|0)>>2]=r,i[(m=E+8|0)>>2]=l;e:do{if((0|T)<0)l=0;else for(g=0,_=0;;){C=v*(A=+(_>>>0)+4294967296*+(0|g))+ +(0|n),h=b*A+ +(0|r),A=p*A+ +(0|l),n=~~+pn(+C),c=~~+pn(+h),l=~~+pn(+A),C=+u(+(+(0|n)-C)),h=+u(+(+(0|c)-h)),A=+u(+(+(0|l)-A));do{if(!(C>h&C>A)){if(d=0-n|0,h>A){r=d-l|0;break}r=c,l=d-c|0;break}n=0-(c+l)|0,r=c}while(0);if(i[E>>2]=n,i[f>>2]=r,i[m>>2]=l,Re(E),0|(l=0|Tt(e,t,E,s+(_<<3)|0)))break e;if(!((0|g)<(0|S)|(0|g)==(0|S)&_>>>0>>0)){l=0;break e}n=0|Jt(0|_,0|g,1,0),g=r=0|w(),_=n,n=0|i[a>>2],r=0|i[y>>2],l=0|i[x>>2]}}while(0);return D=o,0|(E=l)}return D=o,0|(E=l)},_gridPathCellsSize:function(e,t,n,r,s){n|=0,r|=0,s|=0;var a,o=0,l=0,u=0;return a=D,D=D+32|0,u=a,(o=0|xt(e|=0,t|=0,e,t,l=a+12|0))||(o=0|xt(e,t,n,r,u))?(D=a,0|(u=o)):(r=0|Jt(0|(r=0|we(l,u)),((0|r)<0)<<31>>31,1,0),l=0|w(),i[(u=s)>>2]=r,i[u+4>>2]=l,D=a,0|(u=0))},_gridRing:function(e,t,n,r){return 0|F(e|=0,t|=0,n|=0,r|=0)?(mn(0|r,0,48*n|0),0|(r=0|k(e,t,n,r))):0|(r=0)},_gridRingUnsafe:F,_i64Add:Jt,_i64Subtract:en,_isPentagon:je,_isResClassIII:function(e,t){return t=0|un(0|(e|=0),0|(t|=0),52),w(),1&t},_isValidCell:Ve,_isValidDirectedEdge:function(e,t){var n=0;switch(n=0|un(0|(e|=0),0|(t|=0),56),w(),7&n){case 0:case 7:return 0|(n=0)}return n=-2130706433&t|134217728,!0&268435456==(2013265920&t)?!0&16777216==(117440512&t)&!!(0|je(e,n))?0|(n=0):0|(n=0|Ve(e,n)):0|(n=0)},_isValidVertex:function(e,t){e|=0;var n,r,s=0,a=0;return r=D,D=D+16|0,n=r,!0&536870912==(2013265920&(t|=0))&&0|Ve(e,s=-2130706433&t|134217728)?(a=0|un(0|e,0|t,56),w(),s=(a=!(0|Vt(e,s,7&a,n)))&((0|i[(s=n)>>2])==(0|e)?(0|i[s+4>>2])==(0|t):0)&1,D=r,0|s):(D=r,0|(s=0))},_latLngToCell:et,_llvm_ctlz_i64:hn,_llvm_maxnum_f64:An,_llvm_minnum_f64:dn,_llvm_round_f64:pn,_localIjToCell:function(e,t,n,r,i){var s,a;return e|=0,t|=0,n|=0,i|=0,a=D,D=D+16|0,s=a,(r|=0)?n=15:(n=0|Ee(n,s))||(n=0|Tt(e,t,s,i)),D=a,0|n},_malloc:Yt,_maxFaceCount:function(e,t,n){n|=0;var r=0,s=0;if(s=0|un(0|(e|=0),0|(t|=0),45),w(),!(0|z(127&s)))return s=2,i[n>>2]=s,0;if(s=0|un(0|e,0|t,52),w(),!(s&=15))return s=5,i[n>>2]=s,0;for(r=1;;){if(!(!((0|cn(7,0,3*(15-r|0)|0))&e|0)&!((0|w())&t))){r=2,e=6;break}if(!(r>>>0>>0)){r=5,e=6;break}r=r+1|0}return 6==(0|e)?(i[n>>2]=r,0):0},_maxGridDiskSize:function(e,t){t|=0;var n=0,r=0,s=0;return(0|(e|=0))<0?0|(t=2):(0|e)>13780509?0|(t=0|pt(15,t)):(s=0|sn(0|e,0|(n=((0|e)<0)<<31>>31),3,0),r=0|w(),n=0|Jt(0|e,0|n,1,0),n=0|Jt(0|(n=0|sn(0|s,0|r,0|n,0|w())),0|w(),1,0),e=0|w(),i[t>>2]=n,i[t+4>>2]=e,0|(t=0))},_maxPolygonToCellsSize:function(e,t,n,r){e|=0,t|=0,r|=0;var s,a=0,o=0,l=0,u=0,c=0;if(s=D,D=D+48|0,a=s+16|0,o=s+8|0,l=s,0|(n=0|Pt(n|=0)))return D=s,0|(l=n);if(u=0|i[(c=e)+4>>2],i[(n=o)>>2]=i[c>>2],i[n+4>>2]=u,Nt(o,a),!(n=0|ne(a,t,l))){if(t=0|i[o>>2],(0|(o=0|i[e+8>>2]))>0){a=0|i[e+12>>2],n=0;do{t=(0|i[a+(n<<3)>>2])+t|0,n=n+1|0}while((0|n)<(0|o))}a=0|i[(n=l)>>2],(0|(n=0|i[n+4>>2]))<(0|(o=((0|t)<0)<<31>>31))|(0|n)==(0|o)&a>>>0>>0?(i[(n=l)>>2]=t,i[n+4>>2]=o,n=o):t=a,u=0|Jt(0|t,0|n,12,0),c=0|w(),i[(n=l)>>2]=u,i[n+4>>2]=c,i[(n=r)>>2]=u,i[n+4>>2]=c,n=0}return D=s,0|(c=n)},_maxPolygonToCellsSizeExperimental:function(e,t,n,a){t|=0,n|=0,a|=0;var o,l,c=0,h=0,d=0,p=0,f=0,m=0,g=0,_=0;if(l=D,D=D+48|0,f=l+32|0,p=l+40|0,o=l,!(0|i[(e|=0)>>2]))return i[(m=a)>>2]=0,i[m+4>>2]=0,D=l,0|(m=0);ze(f,0,0,0),c=0|i[(d=f)>>2],d=0|i[d+4>>2];do{if(t>>>0>15)i[(m=o)>>2]=0,i[m+4>>2]=0,i[o+8>>2]=4,i[o+12>>2]=-1,n=o+29|0,i[(m=o+16|0)>>2]=0,i[m+4>>2]=0,i[m+8>>2]=0,r[m+12|0]=0,r[n|0]=0|r[p|0],r[n+1|0]=0|r[p+1|0],r[n+2|0]=0|r[p+2|0],n=4,m=9;else{if(0|(n=0|Pt(n))){i[(f=o)>>2]=0,i[f+4>>2]=0,i[o+8>>2]=n,i[o+12>>2]=-1,m=o+29|0,i[(f=o+16|0)>>2]=0,i[f+4>>2]=0,i[f+8>>2]=0,r[f+12|0]=0,r[m|0]=0|r[p|0],r[m+1|0]=0|r[p+1|0],r[m+2|0]=0|r[p+2|0],m=9;break}if(!(n=0|Zt(1+(0|i[e+8>>2])|0,32))){i[(m=o)>>2]=0,i[m+4>>2]=0,i[o+8>>2]=13,i[o+12>>2]=-1,n=o+29|0,i[(m=o+16|0)>>2]=0,i[m+4>>2]=0,i[m+8>>2]=0,r[m+12|0]=0,r[n|0]=0|r[p|0],r[n+1|0]=0|r[p+1|0],r[n+2|0]=0|r[p+2|0],n=13,m=9;break}Dt(e,n),i[(_=o)>>2]=c,i[_+4>>2]=d,i[(d=o+8|0)>>2]=0,i[o+12>>2]=t,i[o+20>>2]=e,i[o+24>>2]=n,r[o+28|0]=0,r[(c=o+29|0)|0]=0|r[p|0],r[c+1|0]=0|r[p+1|0],r[c+2|0]=0|r[p+2|0],i[o+16>>2]=3,g=+K(n),g*=+$(n),h=+u(+ +s[n>>3]),h=g/+A(+ +dn(+h,+ +u(+ +s[n+8>>3])))*6371.007180918475*6371.007180918475,n=0|i[(c=o+12|0)>>2];e:do{if((0|n)>0)do{if(dt(n+-1|0,f),!(h/+s[f>>3]>10))break e;n=(_=0|i[c>>2])+-1|0,i[c>>2]=n}while((0|_)>1)}while(0);if(Et(o),i[(c=a)>>2]=0,i[c+4>>2]=0,!(!(0|(n=0|i[(c=o)>>2]))&!(0|(c=0|i[c+4>>2]))))do{He(n,c,t,f),p=f,p=0|Jt(0|i[(e=a)>>2],0|i[e+4>>2],0|i[p>>2],0|i[p+4>>2]),e=0|w(),i[(_=a)>>2]=p,i[_+4>>2]=e,Et(o),n=0|i[(_=o)>>2],c=0|i[_+4>>2]}while(!(!(0|n)&!(0|c)));n=0|i[d>>2]}}while(0);return D=l,0|(_=n)},_memcpy:fn,_memset:mn,_originToDirectedEdges:function(e,t,n){n|=0;var r,s=0;return r=!(0|je(e|=0,t|=0)),t&=-2130706433,i[(s=n)>>2]=r?e:0,i[s+4>>2]=r?285212672|t:0,i[(s=n+8|0)>>2]=e,i[s+4>>2]=301989888|t,i[(s=n+16|0)>>2]=e,i[s+4>>2]=318767104|t,i[(s=n+24|0)>>2]=e,i[s+4>>2]=335544320|t,i[(s=n+32|0)>>2]=e,i[s+4>>2]=352321536|t,i[(n=n+40|0)>>2]=e,i[n+4>>2]=369098752|t,0},_pentagonCount:function(){return 12},_polygonToCells:function(e,t,n,r){e|=0,t|=0,r|=0;var s,a,o,l,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0,y=0,b=0,x=0,T=0,S=0,M=0,E=0,C=0,R=0,N=0,P=0,L=0,I=0,B=0,F=0,k=0;if(l=D,D=D+112|0,s=l+80|0,d=l+72|0,a=l,o=l+56|0,0|(u=0|Pt(n|=0)))return D=l,0|(k=u);if(!(k=0|Yt(32+(i[(p=e+8|0)>>2]<<5)|0)))return D=l,0|(k=13);if(Dt(e,k),!(u=0|Pt(n))){if(F=0|i[(B=e)+4>>2],i[(u=d)>>2]=i[B>>2],i[u+4>>2]=F,Nt(d,s),u=0|ne(s,t,a))B=0,F=0;else{if(u=0|i[d>>2],(0|(c=0|i[p>>2]))>0){h=0|i[e+12>>2],n=0;do{u=(0|i[h+(n<<3)>>2])+u|0,n=n+1|0}while((0|n)!=(0|c));n=u}else n=u;c=0|i[(u=a)>>2],(0|(u=0|i[u+4>>2]))<(0|(h=((0|n)<0)<<31>>31))|(0|u)==(0|h)&c>>>0>>0?(i[(u=a)>>2]=n,i[u+4>>2]=h,u=h):n=c,B=0|Jt(0|n,0|u,12,0),F=0|w(),i[(u=a)>>2]=B,i[u+4>>2]=F,u=0}if(!u){if(!(n=0|Zt(B,8)))return Kt(k),D=l,0|(k=13);if(!(A=0|Zt(B,8)))return Kt(k),Kt(n),D=l,0|(k=13);i[(L=s)>>2]=0,i[L+4>>2]=0,I=0|i[(L=e)+4>>2],i[(u=d)>>2]=i[L>>2],i[u+4>>2]=I,u=0|V(d,B,F,t,s,n,A);e:do{if(u)Kt(n),Kt(A),Kt(k);else{t:do{if((0|i[p>>2])>0){for(h=e+12|0,c=0;u=0|V((0|i[h>>2])+(c<<3)|0,B,F,t,s,n,A),c=c+1|0,!(0|u);)if((0|c)>=(0|i[p>>2]))break t;Kt(n),Kt(A),Kt(k);break e}}while(0);(0|F)>0|!(0|F)&B>>>0>0&&mn(0|A,0,B<<3),L=0|i[(I=s)+4>>2];t:do{if((0|L)>0|!(0|L)&(0|i[I>>2])>>>0>0){R=n,N=A,P=n,L=A,I=n,u=n,M=n,E=A,C=A,n=A;n:for(;;){for(b=0,x=0,T=0,S=0,c=0,h=0;;){d=(A=a)+56|0;do{i[A>>2]=0,A=A+4|0}while((0|A)<(0|d));if(0|U(p=0|i[(t=R+(b<<3)|0)>>2],t=0|i[t+4>>2],1,a,0)){d=(A=a)+56|0;do{i[A>>2]=0,A=A+4|0}while((0|A)<(0|d));0|(A=0|Zt(7,4))&&(O(p,t,1,a,A,7,0,0),Kt(A))}for(y=0;;){_=0|i[(v=a+(y<<3)|0)>>2],v=0|i[v+4>>2];r:do{if(!(0|_)&!(0|v))A=c,d=h;else{if(f=0|on(0|_,0|v,0|B,0|F),p=0|w(),!(!(0|(d=0|i[(t=A=r+(f<<3)|0)>>2]))&!(0|(t=0|i[t+4>>2])))){m=0,g=0;do{if((0|m)>(0|F)|(0|m)==(0|F)&g>>>0>B>>>0)break n;if((0|d)==(0|_)&(0|t)==(0|v)){A=c,d=h;break r}f=0|an(0|(A=0|Jt(0|f,0|p,1,0)),0|w(),0|B,0|F),p=0|w(),g=0|Jt(0|g,0|m,1,0),m=0|w(),d=0|i[(t=A=r+(f<<3)|0)>>2],t=0|i[t+4>>2]}while(!(!(0|d)&!(0|t)))}if(!(0|_)&!(0|v)){A=c,d=h;break}rt(_,v,o),0|Lt(e,k,o)&&(g=0|Jt(0|c,0|h,1,0),h=0|w(),i[(m=A)>>2]=_,i[m+4>>2]=v,i[(c=N+(c<<3)|0)>>2]=_,i[c+4>>2]=v,c=g),A=c,d=h}}while(0);if((y=y+1|0)>>>0>=7)break;c=A,h=d}if(b=0|Jt(0|b,0|x,1,0),x=0|w(),T=0|Jt(0|T,0|S,1,0),S=0|w(),c=0|i[(h=s)>>2],!((0|S)<(0|(h=0|i[h+4>>2]))|(0|S)==(0|h)&T>>>0>>0))break;c=A,h=d}if((0|h)>0|!(0|h)&c>>>0>0){c=0,h=0;do{i[(S=R+(c<<3)|0)>>2]=0,i[S+4>>2]=0,c=0|Jt(0|c,0|h,1,0),h=0|w(),T=0|i[(S=s)+4>>2]}while((0|h)<(0|T)|((0|h)==(0|T)?c>>>0<(0|i[S>>2])>>>0:0))}if(i[(S=s)>>2]=A,i[S+4>>2]=d,!((0|d)>0|!(0|d)&A>>>0>0))break t;y=n,b=C,x=I,T=E,S=N,n=M,C=u,E=P,M=y,u=b,I=L,L=x,P=T,N=R,R=S}Kt(P),Kt(L),Kt(k),u=1;break e}u=A}while(0);Kt(k),Kt(n),Kt(u),u=0}}while(0);return D=l,0|(k=u)}}return Kt(k),D=l,0|(k=u)},_polygonToCellsExperimental:function(e,t,n,r,s,a){r|=0,s|=0,a|=0;var o,l,u,c=0,h=0,A=0,d=0,p=0,f=0,m=0,g=0;u=D,D=D+160|0,h=u+64|0,p=u+112|0,g=u,Mt(d=u+80|0,e|=0,t|=0,n|=0),at(h,0|i[(A=d)>>2],0|i[A+4>>2],t),o=0|i[(A=h)>>2],A=0|i[A+4>>2],c=0|i[d+8>>2],i[(f=p+4|0)>>2]=i[d>>2],i[f+4>>2]=i[d+4>>2],i[f+8>>2]=i[d+8>>2],i[f+12>>2]=i[d+12>>2],i[f+16>>2]=i[d+16>>2],i[f+20>>2]=i[d+20>>2],i[f+24>>2]=i[d+24>>2],i[f+28>>2]=i[d+28>>2],i[(f=g)>>2]=o,i[f+4>>2]=A,i[(f=g+8|0)>>2]=c,t=p,n=(e=g+12|0)+36|0;do{i[e>>2]=i[t>>2],e=e+4|0,t=t+4|0}while((0|e)<(0|n));if(i[(p=g+48|0)>>2]=i[h>>2],i[p+4>>2]=i[h+4>>2],i[p+8>>2]=i[h+8>>2],i[p+12>>2]=i[h+12>>2],!(0|o)&!(0|A))return D=u,0|(g=c);n=g+16|0,l=g+24|0,d=g+28|0,c=0,h=0,t=o,e=A;do{if(!((0|c)<(0|s)|(0|c)==(0|s)&h>>>0>>0)){m=4;break}if(A=h,h=0|Jt(0|h,0|c,1,0),c=0|w(),i[(A=a+(A<<3)|0)>>2]=t,i[A+4>>2]=e,lt(p),!(0|(t=0|i[(e=p)>>2]))&!(0|(e=0|i[e+4>>2]))){if(Et(n),!(0|(e=0|i[(t=n)>>2]))&!(0|(t=0|i[t+4>>2]))){m=10;break}ot(e,t,0|i[d>>2],p),t=0|i[(e=p)>>2],e=0|i[e+4>>2]}i[(A=g)>>2]=t,i[A+4>>2]=e}while(!(!(0|t)&!(0|e)));return 4==(0|m)?(0|(t=0|i[(e=g+40|0)>>2])&&Kt(t),i[(m=g+16|0)>>2]=0,i[m+4>>2]=0,i[l>>2]=0,i[g+36>>2]=0,i[d>>2]=-1,i[g+32>>2]=0,i[e>>2]=0,ot(0,0,0,p),i[g>>2]=0,i[g+4>>2]=0,i[f>>2]=0,D=u,0|(g=14)):(10==(0|m)&&(i[g>>2]=0,i[g+4>>2]=0,i[f>>2]=i[l>>2]),g=0|i[f>>2],D=u,0|g)},_readInt64AsDoubleFromPointer:function(e){return+(+((0|i[(e|=0)>>2])>>>0)+4294967296*+(0|i[e+4>>2]))},_res0CellCount:function(){return 122},_round:gn,_sbrk:_n,_sizeOfCellBoundary:function(){return 168},_sizeOfCoordIJ:function(){return 8},_sizeOfGeoLoop:function(){return 8},_sizeOfGeoPolygon:function(){return 16},_sizeOfH3Index:function(){return 8},_sizeOfLatLng:function(){return 16},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompactCells:function(e,t,n,r,s,a,o){e|=0,r|=0,s|=0,a|=0;var l,u=0,c=0,h=0,A=0,d=0,p=0,f=0,m=0;if(l=D,D=D+16|0,m=l,!((0|(n|=0))>0|!(0|n)&(t|=0)>>>0>0))return D=l,0|(m=0);if((0|(o|=0))>=16)return D=l,0|(m=12);p=0,f=0,d=0,u=0;e:for(;;){if(A=0|un(0|(c=0|i[(h=e+(p<<3)|0)>>2]),0|(h=0|i[h+4>>2]),52),w(),(15&A)>(0|o)){u=12,c=11;break}if(at(m,c,h,o),!(0|(h=0|i[(A=m)>>2]))&!(0|(A=0|i[A+4>>2])))c=d;else{c=d;do{if(!((0|u)<(0|a)|(0|u)==(0|a)&c>>>0>>0)){c=10;break e}i[(d=r+(c<<3)|0)>>2]=h,i[d+4>>2]=A,c=0|Jt(0|c,0|u,1,0),u=0|w(),lt(m),h=0|i[(d=m)>>2],A=0|i[d+4>>2]}while(!(!(0|h)&!(0|A)))}if(p=0|Jt(0|p,0|f,1,0),!((0|(f=0|w()))<(0|n)|(0|f)==(0|n)&p>>>0>>0)){u=0,c=11;break}d=c}return 10==(0|c)?(D=l,0|(m=14)):11==(0|c)?(D=l,0|u):0},_uncompactCellsSize:function(e,t,n,r,s){e|=0,t|=0,n|=0,r|=0,s|=0;var a,o,l=0,u=0,c=0,h=0,A=0,d=0;o=D,D=D+16|0,a=o;e:do{if((0|n)>0|!(0|n)&t>>>0>0){for(A=0,u=0,l=0,d=0;;){if(!(!(0|(c=0|i[(h=e+(A<<3)|0)>>2]))&!(0|(h=0|i[h+4>>2]))||(h=!(0|He(c,h,r,a)),u=0|Jt(0|i[(c=a)>>2],0|i[c+4>>2],0|u,0|l),l=0|w(),h))){l=12;break}if(A=0|Jt(0|A,0|d,1,0),!((0|(d=0|w()))<(0|n)|(0|d)==(0|n)&A>>>0>>0))break e}return D=o,0|l}u=0,l=0}while(0);return i[s>>2]=u,i[s+4>>2]=l,D=o,0|(s=0)},_vertexToLatLng:function(e,t,n){n|=0;var r,s,a,o,l=0,u=0;return o=D,D=D+192|0,s=o,a=o+168|0,l=0|un(0|(e|=0),0|(t|=0),56),w(),l&=7,0|(r=0|nt(e,u=-2130706433&t|134217728,a))?(D=o,0|(u=r)):(t=0|un(0|e,0|t,52),w(),t&=15,0|je(e,u)?Ie(a,t,l,1,s):Fe(a,t,l,1,s),u=s+8|0,i[n>>2]=i[u>>2],i[n+4>>2]=i[u+4>>2],i[n+8>>2]=i[u+8>>2],i[n+12>>2]=i[u+12>>2],D=o,0|(u=0))},establishStackSpace:function(e,t){D=e|=0},stackAlloc:function(e){var t;return t=D,D=(D=D+(e|=0)|0)+15&-16,0|t},stackRestore:function(e){D=e|=0},stackSave:function(){return 0|D}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(e){g=e},c:function(){return g},d:function(e,t,n,r){fe("Assertion failed: "+N(e)+", at: "+[t?N(t):"unknown filename",n,r?N(r):"unknown function"])},e:function(e){return n.___errno_location&&(M[n.___errno_location()>>2]=e),e},f:Z,g:function(e,t,n){S.set(S.subarray(t,t+n),e)},h:function(e){var t=Z(),n=16777216,r=2130706432;if(e>r)return!1;for(var i=Math.max(t,16777216);i>1]=t;break;case"i32":M[e>>2]=t;break;case"i64":Q=[t>>>0,(X=t,+V(X)>=1?X>0?(0|H(+G(X/4294967296),4294967295))>>>0:~~+z((X-+(~~X>>>0))/4294967296)>>>0:0)],M[e>>2]=Q[0],M[e+4>>2]=Q[1];break;case"float":E[e>>2]=t;break;case"double":C[e>>3]=t;break;default:fe("invalid type for setValue: "+n)}},n.getValue=function(e,t,n){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return T[e|0];case"i16":return w[e>>1];case"i32":case"i64":return M[e>>2];case"float":return E[e>>2];case"double":return C[e>>3];default:fe("invalid type for getValue: "+t)}return null},$)if(K($)||(ie=$,$=n.locateFile?n.locateFile(ie,p):p+ie),a||l){var ue=h($);S.set(ue,8)}else{j++,n.monitorRunDependencies&&n.monitorRunDependencies(j);var ce=function(e){e.byteLength&&(e=new Uint8Array(e)),S.set(e,8),n.memoryInitializerRequest&&delete n.memoryInitializerRequest.response,function(){if(j--,n.monitorRunDependencies&&n.monitorRunDependencies(j),0==j&&W){var e=W;W=null,e()}}()},he=function(){c($,ce,function(){throw"could not load memory initializer "+$})},Ae=te($);if(Ae)ce(Ae.buffer);else if(n.memoryInitializerRequest){var de=function(){var e=n.memoryInitializerRequest,t=e.response;if(200!==e.status&&0!==e.status){var r=te(n.memoryInitializerRequestURL);if(!r)return console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+e.status+", retrying "+$),void he();t=r.buffer}ce(t)};n.memoryInitializerRequest.response?setTimeout(de,0):n.memoryInitializerRequest.addEventListener("load",de)}else he()}function pe(e){function t(){se||(se=!0,_||(I(O),I(B),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)q(n.postRun.shift());I(F)}()))}j>0||(!function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)k(n.preRun.shift());I(U)}(),j>0||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),t()},1)):t()))}function fe(e){throw n.onAbort&&n.onAbort(e),f(e+=""),m(e),_=!0,"abort("+e+"). Build with -s ASSERTIONS=1 for more info."}if(W=function e(){se||pe(),se||(W=e)},n.run=pe,n.abort=fe,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return pe(),e}("object"==typeof Wv?Wv:{}),Xv="number",Qv={0:"Success",1:"The operation failed but a more specific error is not available",2:"Argument was outside of acceptable range",3:"Latitude or longitude arguments were outside of acceptable range",4:"Resolution argument was outside of acceptable range",5:"Cell argument was not valid",6:"Directed edge argument was not valid",7:"Undirected edge argument was not valid",8:"Vertex argument was not valid",9:"Pentagon distortion was encountered",10:"Duplicate input",11:"Cell arguments were not neighbors",12:"Cell arguments had incompatible resolutions",13:"Memory allocation failed",14:"Bounds of provided memory were insufficient",15:"Mode or flags argument was not valid"},$v={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function Yv(e,t,n){var r=n&&"value"in n,i=new Error((e[t]||"Unknown error")+" (code: "+t+(r?", value: "+n.value:"")+")");return i.code=t,i}function Kv(e,t){return Yv(Qv,e,2===arguments.length?{value:t}:{})}function Zv(e,t){return Yv($v,e,2===arguments.length?{value:t}:{})}function Jv(e){if(0!==e)throw Kv(e)} +/* + * Copyright 2018-2019, 2022 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var ey={};[["sizeOfH3Index",Xv],["sizeOfLatLng",Xv],["sizeOfCellBoundary",Xv],["sizeOfGeoLoop",Xv],["sizeOfGeoPolygon",Xv],["sizeOfLinkedGeoPolygon",Xv],["sizeOfCoordIJ",Xv],["readInt64AsDoubleFromPointer",Xv],["isValidCell",Xv,[Xv,Xv]],["latLngToCell",Xv,[Xv,Xv,Xv,Xv]],["cellToLatLng",Xv,[Xv,Xv,Xv]],["cellToBoundary",Xv,[Xv,Xv,Xv]],["maxGridDiskSize",Xv,[Xv,Xv]],["gridDisk",Xv,[Xv,Xv,Xv,Xv]],["gridDiskDistances",Xv,[Xv,Xv,Xv,Xv,Xv]],["gridRing",Xv,[Xv,Xv,Xv,Xv]],["gridRingUnsafe",Xv,[Xv,Xv,Xv,Xv]],["maxPolygonToCellsSize",Xv,[Xv,Xv,Xv,Xv]],["polygonToCells",Xv,[Xv,Xv,Xv,Xv]],["maxPolygonToCellsSizeExperimental",Xv,[Xv,Xv,Xv,Xv]],["polygonToCellsExperimental",Xv,[Xv,Xv,Xv,Xv,Xv,Xv]],["cellsToLinkedMultiPolygon",Xv,[Xv,Xv,Xv]],["destroyLinkedMultiPolygon",null,[Xv]],["compactCells",Xv,[Xv,Xv,Xv,Xv]],["uncompactCells",Xv,[Xv,Xv,Xv,Xv,Xv,Xv]],["uncompactCellsSize",Xv,[Xv,Xv,Xv,Xv,Xv]],["isPentagon",Xv,[Xv,Xv]],["isResClassIII",Xv,[Xv,Xv]],["getBaseCellNumber",Xv,[Xv,Xv]],["getResolution",Xv,[Xv,Xv]],["maxFaceCount",Xv,[Xv,Xv,Xv]],["getIcosahedronFaces",Xv,[Xv,Xv,Xv]],["cellToParent",Xv,[Xv,Xv,Xv,Xv]],["cellToChildren",Xv,[Xv,Xv,Xv,Xv]],["cellToCenterChild",Xv,[Xv,Xv,Xv,Xv]],["cellToChildrenSize",Xv,[Xv,Xv,Xv,Xv]],["cellToChildPos",Xv,[Xv,Xv,Xv,Xv]],["childPosToCell",Xv,[Xv,Xv,Xv,Xv,Xv,Xv]],["areNeighborCells",Xv,[Xv,Xv,Xv,Xv,Xv]],["cellsToDirectedEdge",Xv,[Xv,Xv,Xv,Xv,Xv]],["getDirectedEdgeOrigin",Xv,[Xv,Xv,Xv]],["getDirectedEdgeDestination",Xv,[Xv,Xv,Xv]],["isValidDirectedEdge",Xv,[Xv,Xv]],["directedEdgeToCells",Xv,[Xv,Xv,Xv]],["originToDirectedEdges",Xv,[Xv,Xv,Xv]],["directedEdgeToBoundary",Xv,[Xv,Xv,Xv]],["gridDistance",Xv,[Xv,Xv,Xv,Xv,Xv]],["gridPathCells",Xv,[Xv,Xv,Xv,Xv,Xv]],["gridPathCellsSize",Xv,[Xv,Xv,Xv,Xv,Xv]],["cellToLocalIj",Xv,[Xv,Xv,Xv,Xv,Xv,Xv]],["localIjToCell",Xv,[Xv,Xv,Xv,Xv,Xv]],["getHexagonAreaAvgM2",Xv,[Xv,Xv]],["getHexagonAreaAvgKm2",Xv,[Xv,Xv]],["getHexagonEdgeLengthAvgM",Xv,[Xv,Xv]],["getHexagonEdgeLengthAvgKm",Xv,[Xv,Xv]],["greatCircleDistanceM",Xv,[Xv,Xv]],["greatCircleDistanceKm",Xv,[Xv,Xv]],["greatCircleDistanceRads",Xv,[Xv,Xv]],["cellAreaM2",Xv,[Xv,Xv,Xv]],["cellAreaKm2",Xv,[Xv,Xv,Xv]],["cellAreaRads2",Xv,[Xv,Xv,Xv]],["edgeLengthM",Xv,[Xv,Xv,Xv]],["edgeLengthKm",Xv,[Xv,Xv,Xv]],["edgeLengthRads",Xv,[Xv,Xv,Xv]],["getNumCells",Xv,[Xv,Xv]],["getRes0Cells",Xv,[Xv]],["res0CellCount",Xv],["getPentagons",Xv,[Xv,Xv]],["pentagonCount",Xv],["cellToVertex",Xv,[Xv,Xv,Xv,Xv]],["cellToVertexes",Xv,[Xv,Xv,Xv]],["vertexToLatLng",Xv,[Xv,Xv,Xv]],["isValidVertex",Xv,[Xv,Xv]]].forEach(function(e){ey[e[0]]=Wv.cwrap.apply(Wv,e)});var ty=16,ny=ey.sizeOfH3Index(),ry=ey.sizeOfLatLng(),iy=ey.sizeOfCellBoundary(),sy=ey.sizeOfGeoPolygon(),ay=ey.sizeOfGeoLoop();ey.sizeOfLinkedGeoPolygon(),ey.sizeOfCoordIJ();var oy=Math.pow(2,32)-1;var ly=/[^0-9a-fA-F]/;function uy(e){if(Array.isArray(e)&&2===e.length&&Number.isInteger(e[0])&&Number.isInteger(e[1]))return e;if("string"!=typeof e||ly.test(e))return[0,0];var t=parseInt(e.substring(0,e.length-8),ty);return[parseInt(e.substring(e.length-8),ty),t]}function cy(e){if(e>=0)return e.toString(ty);var t=hy(8,(e&=2147483647).toString(ty));return t=(parseInt(t[0],ty)+8).toString(ty)+t.substring(1)}function hy(e,t){for(var n=e-t.length,r="",i=0;i15||Math.floor(e)!==e)throw Kv(4,e)}(t),n=Boolean(n),0===e.length||0===e[0].length)return[];var r,i=function(e,t){var n,r=e.length-1,i=Wv._calloc(sy),s=0+ay,a=s+4;if(Ay(e[0],i+0,t),r>0){n=Wv._calloc(r,ay);for(var o=0;ooy)throw Zv(1001,e);return e}((r=s,ey.readInt64AsDoubleFromPointer(r))),o=Wv._calloc(a,ny);try{return Jv(ey.polygonToCells(i,t,0,o)),function(e,t){for(var n=[],r=0;r0){for(var i=Wv.getValue(e+n,"i32"),s=0;s0){const{width:n,height:r}=e.context;t.bufferWidth=n,t.bufferHeight=r}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const n in e){const r=e[n];t[n]={version:r.version}}return t}containsNode(e){const t=e.material;for(const e in t)if(t[e]&&t[e].isNode)return!0;return null!==e.renderer.overrideNodes.modelViewMatrix||null!==e.renderer.overrideNodes.modelNormalViewMatrix}getMaterialData(e){const t={};for(const n of this.refreshUniforms){const r=e[n];null!=r&&("object"==typeof r&&void 0!==r.clone?!0===r.isTexture?t[n]={id:r.id,version:r.version}:t[n]=r.clone():t[n]=r)}return t}equals(e,t){const{object:n,material:r,geometry:i}=e,s=this.getRenderObjectData(e);if(!0!==s.worldMatrix.equals(n.matrixWorld))return s.worldMatrix.copy(n.matrixWorld),!1;const a=s.material;for(const e in a){const t=a[e],n=r[e];if(void 0!==t.equals){if(!1===t.equals(n))return t.copy(n),!1}else if(!0===n.isTexture){if(t.id!==n.id||t.version!==n.version)return t.id=n.id,t.version=n.version,!1}else if(t!==n)return a[e]=n,!1}if(a.transmission>0){const{width:t,height:n}=e.context;if(s.bufferWidth!==t||s.bufferHeight!==n)return s.bufferWidth=t,s.bufferHeight=n,!1}const o=s.geometry,l=i.attributes,u=o.attributes,c=Object.keys(u),h=Object.keys(l);if(o.id!==i.id)return o.id=i.id,!1;if(c.length!==h.length)return s.geometry.attributes=this.getAttributesData(l),!1;for(const e of c){const t=u[e],n=l[e];if(void 0===n)return delete u[e],!1;if(t.version!==n.version)return t.version=n.version,!1}const A=i.index,d=o.indexVersion,p=A?A.version:null;if(d!==p)return o.indexVersion=p,!1;if(o.drawRange.start!==i.drawRange.start||o.drawRange.count!==i.drawRange.count)return o.drawRange.start=i.drawRange.start,o.drawRange.count=i.drawRange.count,!1;if(s.morphTargetInfluences){let e=!1;for(let t=0;t>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}const wy=e=>Sy(e),My=e=>Sy(e),Ey=(...e)=>Sy(e),Cy=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Ry=new WeakMap;function Ny(e){return Cy.get(e)}function Py(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e))return Float32Array;if(/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function Dy(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void Nt("TSL: Unsupported type:",e)}function Ly(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void Nt("TSL: Unsupported type:",e)}function Iy(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)?48:/mat4/.test(e)?64:void Nt("TSL: Unsupported type:",e)}function Uy(e){if(null==e)return null;const t=typeof e;return!0===e.isNode?"node":"number"===t?"float":"boolean"===t?"bool":"string"===t?"string":"function"===t?"shader":!0===e.isVector2?"vec2":!0===e.isVector3?"vec3":!0===e.isVector4?"vec4":!0===e.isMatrix2?"mat2":!0===e.isMatrix3?"mat3":!0===e.isMatrix4?"mat4":!0===e.isColor?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function Oy(e,...t){const n=e?e.slice(-4):void 0;return 1===t.length&&("vec2"===n?t=[t[0],t[0]]:"vec3"===n?t=[t[0],t[0],t[0]]:"vec4"===n&&(t=[t[0],t[0],t[0],t[0]])),"color"===e?new Or(...t):"vec2"===n?new Ht(...t):"vec3"===n?new Wt(...t):"vec4"===n?new An(...t):"mat2"===n?new xo(...t):"mat3"===n?new $t(...t):"mat4"===n?new Hn(...t):"bool"===e?t[0]||!1:"float"===e||"int"===e||"uint"===e?t[0]||0:"string"===e?t[0]||"":"ArrayBuffer"===e?ky(t[0]):null}function By(e){let t=Ry.get(e);return void 0===t&&(t={},Ry.set(e,t)),t}function Fy(e){let t="";const n=new Uint8Array(e);for(let e=0;ee.charCodeAt(0)).buffer}const qy={VERTEX:"vertex",FRAGMENT:"fragment"},Vy={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},zy={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},Gy=["fragment","vertex"],Hy=["setup","analyze","generate"],jy=[...Gy,"compute"],Wy=["x","y","z","w"],Xy={analyze:"setup",generate:"analyze"};let Qy=0;class $y extends Dt{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Vy.NONE,this.updateBeforeType=Vy.NONE,this.updateAfterType=Vy.NONE,this.uuid=Gt.generateUUID(),this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:Qy++})}set needsUpdate(e){!0===e&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,Vy.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Vy.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Vy.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){const t=[];e.add(this);for(const n of Object.getOwnPropertyNames(this)){const r=this[n];if(!0!==n.startsWith("_")&&!e.has(r))if(!0===Array.isArray(r))for(let e=0;e0&&(e.inputNodes=n)}deserialize(e){if(void 0!==e.inputNodes){const t=e.meta.nodes;for(const n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){const r=[];for(const i of e.inputNodes[n])r.push(t[i]);this[n]=r}else if("object"==typeof e.inputNodes[n]){const r={};for(const i in e.inputNodes[n]){const s=e.inputNodes[n][i];r[i]=t[s]}this[n]=r}else{const r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){const{uuid:t,type:n}=this,r=void 0===e||"string"==typeof e;r&&(e={textures:{},images:{},nodes:{}});let i=e.nodes[t];function s(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(void 0===i&&(i={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==r&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta),r){const t=s(e.textures),n=s(e.images),r=s(e.nodes);t.length>0&&(i.textures=t),n.length>0&&(i.images=n),r.length>0&&(i.nodes=r)}return i}}class Yy extends $y{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.indexNode.getNodeType(e);return`${this.node.build(e)}[ ${this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint")} ]`}}class Ky extends $y{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let n=null;for(const r of this.convertTo.split("|"))null!==n&&e.getTypeLength(t)!==e.getTypeLength(r)||(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const n=this.node,r=this.getNodeType(e),i=n.build(e,r);return e.format(i,r,t)}}class Zy extends $y{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){const n=e.getVectorType(this.getNodeType(e,t)),r=e.getDataFromNode(this);if(void 0!==r.propertyName)return e.format(r.propertyName,n,t);if("void"!==n&&"void"!==t&&this.hasDependencies(e)){const i=super.build(e,n),s=e.getVarFromNode(this,null,n),a=e.getPropertyName(s);return e.addLineFlowCode(`${a} = ${i}`,this),r.snippet=i,r.propertyName=a,e.format(r.propertyName,n,t)}}return super.build(e,t)}}class Jy extends Zy{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){const n=this.getNodeType(e),r=e.getTypeLength(n),i=this.nodes,s=e.getComponentType(n),a=[];let o=0;for(const t of i){if(o>=r){Nt(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`);break}let i,l=t.getNodeType(e),u=e.getTypeLength(l);o+u>r&&(Nt(`TSL: Length of '${n}()' data exceeds maximum length of output type.`),u=r-o,l=e.getTypeFromLength(u)),o+=u,i=t.build(e,l);if(e.getComponentType(l)!==s){const t=e.getTypeFromLength(u,s);i=e.format(i,l,t)}a.push(i)}const l=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(l,n,t)}}const eb=Wy.join("");class tb extends $y{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(Wy.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){const n=this.node,r=e.getTypeLength(n.getNodeType(e));let i=null;if(r>1){let s=null;this.getVectorLength()>=r&&(s=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const a=n.build(e,s);i=this.components.length===r&&this.components===eb.slice(0,this.components.length)?e.format(a,s,t):e.format(`${a}.${this.components}`,this.getNodeType(e),t)}else i=n.build(e,t);return i}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class nb extends Zy{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:n,targetNode:r}=this,i=this.getNodeType(e),s=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,s),o=r.build(e,a),l=t.build(e,i),u=e.getTypeLength(i),c=[];for(let e=0;e(e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"))(e).split("").sort().join("");$y.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==lb?lb.assign(this,...e):Nt("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn()."),this;{const t=ub.get("assign");return this.addToStack(t(...e))}},$y.prototype.toVarIntent=function(){return this},$y.prototype.get=function(e){return new ob(this,e)};const Ab={};function db(e,t,n){Ab[e]=Ab[t]=Ab[n]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new tb(this,e),this._cache[e]=t),t},set(t){this[e].assign(kb(t))}};const r=e.toUpperCase(),i=t.toUpperCase(),s=n.toUpperCase();$y.prototype["set"+r]=$y.prototype["set"+i]=$y.prototype["set"+s]=function(t){const n=hb(e);return new nb(this,n,kb(t))},$y.prototype["flip"+r]=$y.prototype["flip"+i]=$y.prototype["flip"+s]=function(){const t=hb(e);return new rb(this,t)}}const pb=["x","y","z","w"],fb=["r","g","b","a"],mb=["s","t","p","q"];for(let e=0;e<4;e++){let t=pb[e],n=fb[e],r=mb[e];db(t,n,r);for(let i=0;i<4;i++){t=pb[e]+pb[i],n=fb[e]+fb[i],r=mb[e]+mb[i],db(t,n,r);for(let s=0;s<4;s++){t=pb[e]+pb[i]+pb[s],n=fb[e]+fb[i]+fb[s],r=mb[e]+mb[i]+mb[s],db(t,n,r);for(let a=0;a<4;a++)t=pb[e]+pb[i]+pb[s]+pb[a],n=fb[e]+fb[i]+fb[s]+fb[a],r=mb[e]+mb[i]+mb[s]+mb[a],db(t,n,r)}}}for(let e=0;e<32;e++)Ab[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new Yy(this,new ab(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(kb(t))}};Object.defineProperties($y.prototype,Ab);const gb=new WeakMap,_b=function(e,t=null){for(const n in e)e[n]=kb(e[n],t);return e},vb=function(e,t=null){const n=e.length;for(let r=0;ro?(Nt(`TSL: "${n}" parameter length exceeds limit.`),t.slice(0,o)):t}return null===t?s=(...t)=>i(new e(...zb(u(t)))):null!==n?(n=kb(n),s=(...r)=>i(new e(t,...zb(u(r)),n))):s=(...n)=>i(new e(t,...zb(u(n)))),s.setParameterLength=(...e)=>(1===e.length?a=o=e[0]:2===e.length&&([a,o]=e),s),s.setName=e=>(l=e,s),s},bb=function(e,...t){return kb(new e(...zb(t)))};class xb extends $y{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),i=e.getClosestSubBuild(t.subBuilds)||"",s=i||"default";if(r[s])return r[s];const a=e.subBuildFn,o=e.fnCall;e.subBuildFn=i,e.fnCall=this;let l=null;if(t.layout){let r=gb.get(e.constructor);void 0===r&&(r=new WeakMap,gb.set(e.constructor,r));let i=r.get(t);void 0===i&&(i=kb(e.buildFunctionNode(t)),r.set(t,i)),e.addInclude(i);const s=n?function(e){let t;Vb(e);t=e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)?[...e]:e[0];return t}(n):null;l=kb(i.call(s))}else{const r=new Proxy(e,{get:(e,t,n)=>{let r;return r=Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,n),r}}),i=n?function(e){let t=0;return Vb(e),new Proxy(e,{get:(n,r,i)=>{let s;if("length"===r)return s=e.length,s;if(Symbol.iterator===r)s=function*(){for(const t of e)yield kb(t)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){const n=e[0];s=void 0===n[r]?n[t++]:Reflect.get(n,r,i)}else e[0]instanceof $y&&(s=void 0===e[r]?e[t++]:Reflect.get(e,r,i));else s=Reflect.get(n,r,i);s=kb(s)}return s}})}(n):null,s=Array.isArray(n)?n.length>0:null!==n,a=t.jsFunc,o=s||a.length>1?a(i,r):a(r);l=kb(o)}return e.subBuildFn=a,e.fnCall=o,t.once&&(r[s]=l),l}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){const t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null;const r=e.getBuildStage(),i=e.getNodeProperties(this),s=e.getSubBuildOutput(this),a=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,"setup"===r){const t=e.getSubBuildProperty("initialized",this);if(!0!==i[t]&&(i[t]=!0,i[s]=this.getOutputNode(e),i[s].build(e),this.shaderNode.subBuilds))for(const t of e.chaining){const n=e.getDataFromNode(t,"any");n.subBuilds=n.subBuilds||new Set;for(const e of this.shaderNode.subBuilds)n.subBuilds.add(e)}n=i[s]}else"analyze"===r?a.build(e,t):"generate"===r&&(n=a.build(e,t)||"");return e.fnCall=o,n}}class Tb extends $y{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new xb(this,e)}setup(){return this.call()}}const Sb=[!1,!0],wb=[0,1,2,3],Mb=[-1,-2],Eb=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],Cb=new Map;for(const e of Sb)Cb.set(e,new ab(e));const Rb=new Map;for(const e of wb)Rb.set(e,new ab(e,"uint"));const Nb=new Map([...Rb].map(e=>new ab(e.value,"int")));for(const e of Mb)Nb.set(e,new ab(e,"int"));const Pb=new Map([...Nb].map(e=>new ab(e.value)));for(const e of Eb)Pb.set(e,new ab(e));for(const e of Eb)Pb.set(-e,new ab(-e));const Db={bool:Cb,uint:Rb,ints:Nb,float:Pb},Lb=new Map([...Cb,...Pb]),Ib=(e,t)=>Lb.has(e)?Lb.get(e):!0===e.isNode?e:new ab(e,t),Ub=function(e,t=null){return(...n)=>{for(const t of n)if(void 0===t)return Nt(`TSL: Invalid parameter for the type "${e}".`),kb(new ab(0,e));if((0===n.length||!["bool","float","int","uint"].includes(e)&&n.every(e=>{const t=typeof e;return"object"!==t&&"function"!==t}))&&(n=[Oy(e,...n)]),1===n.length&&null!==t&&t.has(n[0]))return qb(t.get(n[0]));if(1===n.length){const t=Ib(n[0],e);return t.nodeType===e?qb(t):qb(new Ky(t,e))}const r=n.map(e=>Ib(e));return qb(new Jy(r,e))}},Ob=e=>"object"==typeof e&&null!==e?e.value:e,Bb=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function Fb(e,t){return new Tb(e,t)}const kb=(e,t=null)=>function(e,t=null){const n=Uy(e);return"node"===n?e:null===t&&("float"===n||"boolean"===n)||n&&"shader"!==n&&"string"!==n?kb(Ib(e,t)):"shader"===n?e.isFn?e:Qb(e):e}(e,t),qb=(e,t=null)=>kb(e,t).toVarIntent(),Vb=(e,t=null)=>new _b(e,t),zb=(e,t=null)=>new vb(e,t),Gb=(e,t=null,n=null,r=null)=>new yb(e,t,n,r),Hb=(e,...t)=>new bb(e,...t),jb=(e,t=null,n=null,r={})=>new yb(e,t,n,{...r,intent:!0});let Wb=0;class Xb extends $y{constructor(e,t=null){super();let n=null;null!==t&&("object"==typeof t?n=t.return:("string"==typeof t?n=t:Nt("TSL: Invalid layout type."),t=null)),this.shaderNode=new Fb(e,n),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){const t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){const n={name:"fn"+Wb++,type:t,inputs:[]};for(const t in e)"return"!==t&&n.inputs.push({name:t,type:e[t]});e=n}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){const t=this.shaderNode.call(e);return"void"===this.shaderNode.nodeType&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){const t=this.getNodeType(e);return Nt('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".'),e.generateConst(t)}}function Qb(e,t=null){const n=new Xb(e,t);return new Proxy(()=>{},{apply:(e,t,r)=>n.call(...r),get:(e,t,r)=>Reflect.get(n,t,r),set:(e,t,r,i)=>Reflect.set(n,t,r,i)})}const $b=e=>{lb=e},Yb=()=>lb,Kb=(...e)=>lb.If(...e);function Zb(e){return lb&&lb.addToStack(e),e}cb("toStack",Zb);const Jb=new Ub("color"),ex=new Ub("float",Db.float),tx=new Ub("int",Db.ints),nx=new Ub("uint",Db.uint),rx=new Ub("bool",Db.bool),ix=new Ub("vec2"),sx=new Ub("ivec2"),ax=new Ub("uvec2"),ox=new Ub("bvec2"),lx=new Ub("vec3"),ux=new Ub("ivec3"),cx=new Ub("uvec3"),hx=new Ub("bvec3"),Ax=new Ub("vec4"),dx=new Ub("ivec4"),px=new Ub("uvec4"),fx=new Ub("bvec4"),mx=new Ub("mat2"),gx=new Ub("mat3"),_x=new Ub("mat4");cb("toColor",Jb),cb("toFloat",ex),cb("toInt",tx),cb("toUint",nx),cb("toBool",rx),cb("toVec2",ix),cb("toIVec2",sx),cb("toUVec2",ax),cb("toBVec2",ox),cb("toVec3",lx),cb("toIVec3",ux),cb("toUVec3",cx),cb("toBVec3",hx),cb("toVec4",Ax),cb("toIVec4",dx),cb("toUVec4",px),cb("toBVec4",fx),cb("toMat2",mx),cb("toMat3",gx),cb("toMat4",_x);const vx=Gb(Yy).setParameterLength(2),yx=(e,t)=>kb(new Ky(kb(e),t));cb("element",vx),cb("convert",yx);cb("append",e=>(Rt("TSL: .append() has been renamed to .toStack()."),Zb(e)));class bx extends $y{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1){super(e),this.name=t,this.varying=n,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return wy(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const xx=(e,t)=>kb(new bx(e,t)),Tx=(e,t)=>kb(new bx(e,t,!0)),Sx=Hb(bx,"vec4","DiffuseColor"),wx=Hb(bx,"vec3","EmissiveColor"),Mx=Hb(bx,"float","Roughness"),Ex=Hb(bx,"float","Metalness"),Cx=Hb(bx,"float","Clearcoat"),Rx=Hb(bx,"float","ClearcoatRoughness"),Nx=Hb(bx,"vec3","Sheen"),Px=Hb(bx,"float","SheenRoughness"),Dx=Hb(bx,"float","Iridescence"),Lx=Hb(bx,"float","IridescenceIOR"),Ix=Hb(bx,"float","IridescenceThickness"),Ux=Hb(bx,"float","AlphaT"),Ox=Hb(bx,"float","Anisotropy"),Bx=Hb(bx,"vec3","AnisotropyT"),Fx=Hb(bx,"vec3","AnisotropyB"),kx=Hb(bx,"color","SpecularColor"),qx=Hb(bx,"float","SpecularF90"),Vx=Hb(bx,"float","Shininess"),zx=Hb(bx,"vec4","Output"),Gx=Hb(bx,"float","dashSize"),Hx=Hb(bx,"float","gapSize"),jx=Hb(bx,"float","pointWidth"),Wx=Hb(bx,"float","IOR"),Xx=Hb(bx,"float","Transmission"),Qx=Hb(bx,"float","Thickness"),$x=Hb(bx,"float","AttenuationDistance"),Yx=Hb(bx,"color","AttenuationColor"),Kx=Hb(bx,"float","Dispersion");class Zx extends $y{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1){super("string"),this.name=e,this.shared=t,this.order=n,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const Jx=e=>new Zx(e),eT=(e,t=0)=>new Zx(e,!0,t),tT=eT("frame"),nT=eT("render"),rT=Jx("object");class iT extends ib{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=rT}setName(e){return this.name=e,this}label(e){return Rt('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{const n=e(t,this);void 0!==n&&(this.value=n)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){const n=this.getNodeType(e),r=this.getUniformHash(e);let i=e.getNodeFromHash(r);void 0===i&&(e.setHashNode(this,r),i=this);const s=i.getInputType(e),a=e.getUniformFromNode(i,s,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(a);void 0!==e.context.nodeName&&delete e.context.nodeName;let l=o;if("bool"===n){const t=e.getDataFromNode(this);let r=t.propertyName;if(void 0===r){const i=e.getVarFromNode(this,null,"bool");r=e.getPropertyName(i),t.propertyName=r,l=e.format(o,s,n),e.addLineFlowCode(`${r} = ${l}`,this)}l=r}return e.format(l,n,t)}}const sT=(e,t)=>{const n=Bb(t||e);return n===e&&(e=Oy(n)),e=e&&!0===e.isNode?e.node&&e.node.value||e.value:e,kb(new iT(e,n))};class aT extends Zy{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return null===this.nodeType&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const oT=(...e)=>{let t;if(1===e.length){const n=e[0];t=new aT(null,n.length,n)}else{const n=e[0],r=e[1];t=new aT(n,r)}return kb(t)};cb("toArray",(e,t)=>oT(Array(t).fill(e)));class lT extends Zy{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){const n=e.getTypeLength(t.node.getNodeType(e));return Wy.join("").slice(0,n)!==t.components}return!1}setup(e){const{targetNode:t,sourceNode:n}=this,r=t.getScope();e.getNodeProperties(r).assign=!0;const i=e.getNodeProperties(this);i.sourceNode=n,i.targetNode=t.context({assign:!0})}generate(e,t){const{targetNode:n,sourceNode:r}=e.getNodeProperties(this),i=this.needsSplitAssign(e),s=n.build(e),a=n.getNodeType(e),o=r.build(e,a),l=r.getNodeType(e),u=e.getDataFromNode(this);let c;if(!0===u.initialized)"void"!==t&&(c=s);else if(i){const r=e.getVarFromNode(this,null,a),i=e.getPropertyName(r);e.addLineFlowCode(`${i} = ${o}`,this);const l=n.node,u=l.node.context({assign:!0}).build(e);for(let t=0;t{const r=n.type;let i;return i="pointer"===r?"&"+t.build(e):t.build(e,r),i};if(Array.isArray(i)){if(i.length>r.length)Nt("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),i.length=r.length;else if(i.length(t=t.length>1||t[0]&&!0===t[0].isNode?zb(t):Vb(t[0]),new cT(kb(e),t));cb("call",hT);const AT={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class dT extends Zy{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let i=new dT(e,t,n);for(let t=0;t>"===n||"<<"===n)return e.getIntegerType(s);if("!"===n||"&&"===n||"||"===n||"^^"===n)return"bool";if("=="===n||"!="===n||"<"===n||">"===n||"<="===n||">="===n){const t=Math.max(e.getTypeLength(s),e.getTypeLength(a));return t>1?`bvec${t}`:"bool"}if(e.isMatrix(s)){if("float"===a)return s;if(e.isVector(a))return e.getVectorFromMatrix(s);if(e.isMatrix(a))return s}else if(e.isMatrix(a)){if("float"===s)return a;if(e.isVector(s))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(s)?a:s}generate(e,t){const n=this.op,{aNode:r,bNode:i}=this,s=this.getNodeType(e,t);let a=null,o=null;"void"!==s?(a=r.getNodeType(e),o=i?i.getNodeType(e):null,"<"===n||">"===n||"<="===n||">="===n||"=="===n||"!="===n?e.isVector(a)?o=a:e.isVector(o)?a=o:a!==o&&(a=o="float"):">>"===n||"<<"===n?(a=s,o=e.changeComponentType(o,"uint")):"%"===n?(a=s,o=e.isInteger(a)&&e.isInteger(o)?o:a):e.isMatrix(a)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(a):e.isMatrix(o)||(a=o=s):a=e.isMatrix(o)?"float"===a?"float":e.isVector(a)?e.getVectorFromMatrix(o):o=s:o=s):a=o=s;const l=r.build(e,a),u=i?i.build(e,o):null,c=e.getFunctionOperator(n);if("void"!==t){const r=e.renderer.coordinateSystem===yt;if("=="===n||"!="===n||"<"===n||">"===n||"<="===n||">="===n)return r&&e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${l}, ${u} )`,s,t):e.format(`( ${l} ${n} ${u} )`,s,t);if("%"===n)return e.isInteger(o)?e.format(`( ${l} % ${u} )`,s,t):e.format(`${this.getOperatorMethod(e,s)}( ${l}, ${u} )`,s,t);if("!"===n||"~"===n)return e.format(`(${n}${l})`,a,t);if(c)return e.format(`${c}( ${l}, ${u} )`,s,t);if(e.isMatrix(a)&&"float"===o)return e.format(`( ${u} ${n} ${l} )`,s,t);if("float"===a&&e.isMatrix(o))return e.format(`${l} ${n} ${u}`,s,t);{let i=`( ${l} ${n} ${u} )`;return!r&&"bool"===s&&e.isVector(a)&&e.isVector(o)&&(i=`all${i}`),e.format(i,s,t)}}if("void"!==a)return c?e.format(`${c}( ${l}, ${u} )`,s,t):e.isMatrix(a)&&"float"===o?e.format(`${u} ${n} ${l}`,s,t):e.format(`${l} ${n} ${u}`,s,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const pT=jb(dT,"+").setParameterLength(2,1/0).setName("add"),fT=jb(dT,"-").setParameterLength(2,1/0).setName("sub"),mT=jb(dT,"*").setParameterLength(2,1/0).setName("mul"),gT=jb(dT,"/").setParameterLength(2,1/0).setName("div"),_T=jb(dT,"%").setParameterLength(2).setName("mod"),vT=jb(dT,"==").setParameterLength(2).setName("equal"),yT=jb(dT,"!=").setParameterLength(2).setName("notEqual"),bT=jb(dT,"<").setParameterLength(2).setName("lessThan"),xT=jb(dT,">").setParameterLength(2).setName("greaterThan"),TT=jb(dT,"<=").setParameterLength(2).setName("lessThanEqual"),ST=jb(dT,">=").setParameterLength(2).setName("greaterThanEqual"),wT=jb(dT,"&&").setParameterLength(2,1/0).setName("and"),MT=jb(dT,"||").setParameterLength(2,1/0).setName("or"),ET=jb(dT,"!").setParameterLength(1).setName("not"),CT=jb(dT,"^^").setParameterLength(2).setName("xor"),RT=jb(dT,"&").setParameterLength(2).setName("bitAnd"),NT=jb(dT,"~").setParameterLength(1).setName("bitNot"),PT=jb(dT,"|").setParameterLength(2).setName("bitOr"),DT=jb(dT,"^").setParameterLength(2).setName("bitXor"),LT=jb(dT,"<<").setParameterLength(2).setName("shiftLeft"),IT=jb(dT,">>").setParameterLength(2).setName("shiftRight"),UT=Qb(([e])=>(e.addAssign(1),e)),OT=Qb(([e])=>(e.subAssign(1),e)),BT=Qb(([e])=>{const t=tx(e).toConst();return e.addAssign(1),t}),FT=Qb(([e])=>{const t=tx(e).toConst();return e.subAssign(1),t});cb("add",pT),cb("sub",fT),cb("mul",mT),cb("div",gT),cb("mod",_T),cb("equal",vT),cb("notEqual",yT),cb("lessThan",bT),cb("greaterThan",xT),cb("lessThanEqual",TT),cb("greaterThanEqual",ST),cb("and",wT),cb("or",MT),cb("not",ET),cb("xor",CT),cb("bitAnd",RT),cb("bitNot",NT),cb("bitOr",PT),cb("bitXor",DT),cb("shiftLeft",LT),cb("shiftRight",IT),cb("incrementBefore",UT),cb("decrementBefore",OT),cb("increment",BT),cb("decrement",FT);const kT=(e,t)=>(Rt('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.'),_T(tx(e),tx(t)));cb("modInt",kT);class qT extends Zy{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===qT.MAX||e===qT.MIN)&&arguments.length>3){let i=new qT(e,t,n);for(let t=2;ts&&i>a?t:s>a?n:a>i?r:t}getNodeType(e){const t=this.method;return t===qT.LENGTH||t===qT.DISTANCE||t===qT.DOT?"float":t===qT.CROSS?"vec3":t===qT.ALL||t===qT.ANY?"bool":t===qT.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){const{aNode:t,bNode:n,method:r}=this;let i=null;if(r===qT.ONE_MINUS)i=fT(1,t);else if(r===qT.RECIPROCAL)i=gT(1,t);else if(r===qT.DIFFERENCE)i=dS(fT(t,n));else if(r===qT.TRANSFORM_DIRECTION){let r=t,s=n;e.isMatrix(r.getNodeType(e))?s=Ax(lx(s),0):r=Ax(lx(r),0);const a=mT(r,s).xyz;i=sS(a)}return null!==i?i:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let n=this.method;const r=this.getNodeType(e),i=this.getInputType(e),s=this.aNode,a=this.bNode,o=this.cNode,l=e.renderer.coordinateSystem;if(n===qT.NEGATE)return e.format("( - "+s.build(e,i)+" )",r,t);{const u=[];return n===qT.CROSS?u.push(s.build(e,r),a.build(e,r)):l===yt&&n===qT.STEP?u.push(s.build(e,1===e.getTypeLength(s.getNodeType(e))?"float":i),a.build(e,i)):l!==yt||n!==qT.MIN&&n!==qT.MAX?n===qT.REFRACT?u.push(s.build(e,i),a.build(e,i),o.build(e,"float")):n===qT.MIX?u.push(s.build(e,i),a.build(e,i),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":i)):(l===bt&&n===qT.ATAN&&null!==a&&(n="atan2"),"fragment"===e.shaderStage||n!==qT.DFDX&&n!==qT.DFDY||(Rt(`TSL: '${n}' is not supported in the ${e.shaderStage} stage.`),n="/*"+n+"*/"),u.push(s.build(e,i)),null!==a&&u.push(a.build(e,i)),null!==o&&u.push(o.build(e,i))):u.push(s.build(e,i),a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":i)),e.format(`${e.getMethod(n,r)}( ${u.join(", ")} )`,r,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}qT.ALL="all",qT.ANY="any",qT.RADIANS="radians",qT.DEGREES="degrees",qT.EXP="exp",qT.EXP2="exp2",qT.LOG="log",qT.LOG2="log2",qT.SQRT="sqrt",qT.INVERSE_SQRT="inversesqrt",qT.FLOOR="floor",qT.CEIL="ceil",qT.NORMALIZE="normalize",qT.FRACT="fract",qT.SIN="sin",qT.COS="cos",qT.TAN="tan",qT.ASIN="asin",qT.ACOS="acos",qT.ATAN="atan",qT.ABS="abs",qT.SIGN="sign",qT.LENGTH="length",qT.NEGATE="negate",qT.ONE_MINUS="oneMinus",qT.DFDX="dFdx",qT.DFDY="dFdy",qT.ROUND="round",qT.RECIPROCAL="reciprocal",qT.TRUNC="trunc",qT.FWIDTH="fwidth",qT.TRANSPOSE="transpose",qT.DETERMINANT="determinant",qT.INVERSE="inverse",qT.EQUALS="equals",qT.MIN="min",qT.MAX="max",qT.STEP="step",qT.REFLECT="reflect",qT.DISTANCE="distance",qT.DIFFERENCE="difference",qT.DOT="dot",qT.CROSS="cross",qT.POW="pow",qT.TRANSFORM_DIRECTION="transformDirection",qT.MIX="mix",qT.CLAMP="clamp",qT.REFRACT="refract",qT.SMOOTHSTEP="smoothstep",qT.FACEFORWARD="faceforward";const VT=ex(1e-6),zT=ex(1e6),GT=ex(Math.PI),HT=ex(2*Math.PI),jT=ex(2*Math.PI),WT=ex(.5*Math.PI),XT=jb(qT,qT.ALL).setParameterLength(1),QT=jb(qT,qT.ANY).setParameterLength(1),$T=jb(qT,qT.RADIANS).setParameterLength(1),YT=jb(qT,qT.DEGREES).setParameterLength(1),KT=jb(qT,qT.EXP).setParameterLength(1),ZT=jb(qT,qT.EXP2).setParameterLength(1),JT=jb(qT,qT.LOG).setParameterLength(1),eS=jb(qT,qT.LOG2).setParameterLength(1),tS=jb(qT,qT.SQRT).setParameterLength(1),nS=jb(qT,qT.INVERSE_SQRT).setParameterLength(1),rS=jb(qT,qT.FLOOR).setParameterLength(1),iS=jb(qT,qT.CEIL).setParameterLength(1),sS=jb(qT,qT.NORMALIZE).setParameterLength(1),aS=jb(qT,qT.FRACT).setParameterLength(1),oS=jb(qT,qT.SIN).setParameterLength(1),lS=jb(qT,qT.COS).setParameterLength(1),uS=jb(qT,qT.TAN).setParameterLength(1),cS=jb(qT,qT.ASIN).setParameterLength(1),hS=jb(qT,qT.ACOS).setParameterLength(1),AS=jb(qT,qT.ATAN).setParameterLength(1,2),dS=jb(qT,qT.ABS).setParameterLength(1),pS=jb(qT,qT.SIGN).setParameterLength(1),fS=jb(qT,qT.LENGTH).setParameterLength(1),mS=jb(qT,qT.NEGATE).setParameterLength(1),gS=jb(qT,qT.ONE_MINUS).setParameterLength(1),_S=jb(qT,qT.DFDX).setParameterLength(1),vS=jb(qT,qT.DFDY).setParameterLength(1),yS=jb(qT,qT.ROUND).setParameterLength(1),bS=jb(qT,qT.RECIPROCAL).setParameterLength(1),xS=jb(qT,qT.TRUNC).setParameterLength(1),TS=jb(qT,qT.FWIDTH).setParameterLength(1),SS=jb(qT,qT.TRANSPOSE).setParameterLength(1),wS=jb(qT,qT.DETERMINANT).setParameterLength(1),MS=jb(qT,qT.INVERSE).setParameterLength(1),ES=(e,t)=>(Rt('TSL: "equals" is deprecated. Use "equal" inside a vector instead, like: "bvec*( equal( ... ) )"'),vT(e,t)),CS=jb(qT,qT.MIN).setParameterLength(2,1/0),RS=jb(qT,qT.MAX).setParameterLength(2,1/0),NS=jb(qT,qT.STEP).setParameterLength(2),PS=jb(qT,qT.REFLECT).setParameterLength(2),DS=jb(qT,qT.DISTANCE).setParameterLength(2),LS=jb(qT,qT.DIFFERENCE).setParameterLength(2),IS=jb(qT,qT.DOT).setParameterLength(2),US=jb(qT,qT.CROSS).setParameterLength(2),OS=jb(qT,qT.POW).setParameterLength(2),BS=e=>mT(e,e),FS=e=>mT(e,e,e),kS=e=>mT(e,e,e,e),qS=jb(qT,qT.TRANSFORM_DIRECTION).setParameterLength(2),VS=e=>mT(pS(e),OS(dS(e),1/3)),zS=e=>IS(e,e),GS=jb(qT,qT.MIX).setParameterLength(3),HS=(e,t=0,n=1)=>kb(new qT(qT.CLAMP,kb(e),kb(t),kb(n))),jS=e=>HS(e),WS=jb(qT,qT.REFRACT).setParameterLength(3),XS=jb(qT,qT.SMOOTHSTEP).setParameterLength(3),QS=jb(qT,qT.FACEFORWARD).setParameterLength(3),$S=Qb(([e])=>{const t=IS(e.xy,ix(12.9898,78.233)),n=_T(t,GT);return aS(oS(n).mul(43758.5453))}),YS=(e,t,n)=>GS(t,n,e),KS=(e,t,n)=>XS(t,n,e),ZS=(e,t)=>NS(t,e),JS=(e,t)=>(Rt('TSL: "atan2" is overloaded. Use "atan" instead.'),AS(e,t)),ew=QS,tw=nS;cb("all",XT),cb("any",QT),cb("equals",ES),cb("radians",$T),cb("degrees",YT),cb("exp",KT),cb("exp2",ZT),cb("log",JT),cb("log2",eS),cb("sqrt",tS),cb("inverseSqrt",nS),cb("floor",rS),cb("ceil",iS),cb("normalize",sS),cb("fract",aS),cb("sin",oS),cb("cos",lS),cb("tan",uS),cb("asin",cS),cb("acos",hS),cb("atan",AS),cb("abs",dS),cb("sign",pS),cb("length",fS),cb("lengthSq",zS),cb("negate",mS),cb("oneMinus",gS),cb("dFdx",_S),cb("dFdy",vS),cb("round",yS),cb("reciprocal",bS),cb("trunc",xS),cb("fwidth",TS),cb("atan2",JS),cb("min",CS),cb("max",RS),cb("step",ZS),cb("reflect",PS),cb("distance",DS),cb("dot",IS),cb("cross",US),cb("pow",OS),cb("pow2",BS),cb("pow3",FS),cb("pow4",kS),cb("transformDirection",qS),cb("mix",YS),cb("clamp",HS),cb("refract",WS),cb("smoothstep",KS),cb("faceForward",QS),cb("difference",LS),cb("saturate",jS),cb("cbrt",VS),cb("transpose",SS),cb("determinant",wS),cb("inverse",MS),cb("rand",$S);class nw extends $y{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}getNodeType(e){const{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);const r=t.getNodeType(e);if(null!==n){const t=n.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(r))return t}return r}setup(e){const t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,i=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=i,null!==r&&(e.getDataFromNode(r).parentNodeBlock=i);const s=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=s?n:n.context({nodeBlock:n}),a.elseNode=r?s?r:r.context({nodeBlock:r}):null}generate(e,t){const n=this.getNodeType(e),r=e.getDataFromNode(this);if(void 0!==r.nodeProperty)return r.nodeProperty;const{condNode:i,ifNode:s,elseNode:a}=e.getNodeProperties(this),o=e.currentFunctionNode,l="void"!==t,u=l?xx(n).build(e):"";r.nodeProperty=u;const c=i.build(e,"bool");if(e.context.uniformFlow&&null!==a){const r=s.build(e,n),i=a.build(e,n),o=e.getTernary(c,r,i);return e.format(o,n,t)}e.addFlowCode(`\n${e.tab}if ( ${c} ) {\n\n`).addFlowTab();let h=s.build(e,n);if(h&&(l?h=u+" = "+h+";":(h="return "+h+";",null===o&&(Rt("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),h="// "+h))),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==a){e.addFlowCode(" else {\n\n").addFlowTab();let t=a.build(e,n);t&&(l?t=u+" = "+t+";":(t="return "+t+";",null===o&&(Rt("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values."),t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+"\t"+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(u,n,t)}}const rw=Gb(nw).setParameterLength(2,3);cb("select",rw);class iw extends $y{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){const t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){const n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}}const sw=Gb(iw).setParameterLength(1,2),aw=e=>sw(e,{uniformFlow:!0}),ow=(e,t)=>sw(e,{nodeName:t});function lw(e,t){return Rt('TSL: "label()" has been deprecated. Use "setName()" instead.'),ow(e,t)}cb("context",sw),cb("label",lw),cb("uniformFlow",aw),cb("setName",ow);class uw extends $y{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){let t=e.getNodeProperties(this).assign;if(!0!==t&&this.node.isShaderCallNodeInternal&&null===this.node.shaderNode.getLayout()&&e.fnCall&&e.fnCall.shaderNode){e.getDataFromNode(this.node.shaderNode).hasLoop&&(t=!0)}return t}build(...e){const t=e[0];return!1===this._hasStack(t)&&"setup"===t.buildStage&&(t.context.nodeLoop||t.context.nodeBlock)&&t.getBaseStack().addToStack(this),!0===this.intent&&!0!==this.isAssign(t)?this.node.build(...e):super.build(...e)}generate(e){const{node:t,name:n,readOnly:r}=this,{renderer:i}=e,s=!0===i.backend.isWebGPUBackend;let a=!1,o=!1;r&&(a=e.isDeterministic(t),o=s?r:a);const l=this.getNodeType(e);if("void"==l){!0!==this.intent&&Nt('TSL: ".toVar()" can not be used with void type.');return t.build(e)}const u=e.getVectorType(l),c=t.build(e,u),h=e.getVarFromNode(this,n,u,void 0,o),A=e.getPropertyName(h);let d=A;if(o)if(s)d=a?`const ${A}`:`let ${A}`;else{const n=t.getArrayCount(e);d=`const ${e.getVar(h.type,A,n)}`}return e.addLineFlowCode(`${d} = ${c}`,this),A}_hasStack(e){return void 0!==e.getDataFromNode(this).stack}}const cw=Gb(uw),hw=(e,t=null)=>cw(e,t).toStack(),Aw=(e,t=null)=>cw(e,t,!0).toStack(),dw=e=>cw(e).setIntent(!0).toStack();cb("toVar",hw),cb("toConst",Aw),cb("toVarIntent",dw);class pw extends $y{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(null!==this.nodeType)return this.nodeType;e.addSubBuild(this.name);const t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);const n=this.node.build(e,...t);return e.removeSubBuild(),n}}const fw=(e,t,n=null)=>kb(new pw(kb(e),t,n));class mw extends $y{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let n=t.varying;if(void 0===n){const r=this.name,i=this.getNodeType(e),s=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,i,s,a),t.node=fw(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation="fragment"===e.shaderStage),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(qy.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(qy.VERTEX,this.node)}generate(e){const t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(void 0===n[t]){const i=this.getNodeType(e),s=e.getPropertyName(r,qy.VERTEX);e.flowNodeFromShaderStage(qy.VERTEX,n.node,i,s),n[t]=s}return e.getPropertyName(r)}}const gw=Gb(mw).setParameterLength(1,2),_w=e=>gw(e);cb("toVarying",gw),cb("toVertexStage",_w),cb("varying",(...e)=>(Rt("TSL: .varying() has been renamed to .toVarying()."),gw(...e))),cb("vertexStage",(...e)=>(Rt("TSL: .vertexStage() has been renamed to .toVertexStage()."),gw(...e)));const vw=Qb(([e])=>{const t=e.mul(.9478672986).add(.0521327014).pow(2.4),n=e.mul(.0773993808),r=e.lessThanEqual(.04045);return GS(t,n,r)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),yw=Qb(([e])=>{const t=e.pow(.41666).mul(1.055).sub(.055),n=e.mul(12.92),r=e.lessThanEqual(.0031308);return GS(t,n,r)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),bw="WorkingColorSpace";class xw extends Zy{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===bw?en.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let i=t;return!1!==en.enabled&&n!==r&&n&&r?(en.getTransfer(n)===ot&&(i=Ax(vw(i.rgb),i.a)),en.getPrimaries(n)!==en.getPrimaries(r)&&(i=Ax(gx(en._getMatrix(new $t,n,r)).mul(i.rgb),i.a)),en.getTransfer(r)===ot&&(i=Ax(yw(i.rgb),i.a)),i):i}}const Tw=(e,t)=>kb(new xw(kb(e),bw,t)),Sw=(e,t)=>kb(new xw(kb(e),t,bw));cb("workingToColorSpace",Tw),cb("colorSpaceToWorking",Sw);let ww=class extends Yy{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}};class Mw extends $y{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=Vy.OBJECT}setGroup(e){return this.group=e,this}element(e){return kb(new ww(this,kb(e)))}setNodeType(e){const t=sT(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let e=1;ekb(new Ew(e,t,n));class Rw extends Zy{static get type(){return"ToneMappingNode"}constructor(e,t=Pw,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return Ey(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){const t=this.colorNode||e.context.color,n=this._toneMapping;if(0===n)return t;let r=null;const i=e.renderer.library.getToneMappingFunction(n);return null!==i?r=Ax(i(t.rgb,this.exposureNode),t.a):(Nt("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}}const Nw=(e,t,n)=>kb(new Rw(e,kb(t),kb(n))),Pw=Cw("toneMappingExposure","float");cb("toneMapping",(e,t,n)=>Nw(t,n,e));class Dw extends ib{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=gt,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(0===this.bufferStride&&0===this.bufferOffset){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(null!==this.attribute)return;const t=this.getNodeType(e),n=this.value,r=e.getTypeLength(t),i=this.bufferStride||r,s=this.bufferOffset,a=!0===n.isInterleavedBuffer?n:new ki(n,i),o=new Vi(a,r,s);a.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(n);let i=null;if("vertex"===e.shaderStage||"compute"===e.shaderStage)this.name=r,i=r;else{i=gw(this).build(e,t)}return i}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const Lw=(e,t=null,n=0,r=0)=>kb(new Dw(e,t,n,r)),Iw=(e,t=null,n=0,r=0)=>Lw(e,t,n,r).setUsage(_t),Uw=(e,t=null,n=0,r=0)=>Lw(e,t,n,r).setInstanced(!0),Ow=(e,t=null,n=0,r=0)=>Iw(e,t,n,r).setInstanced(!0);cb("toAttribute",e=>Lw(e.value));class Bw extends $y{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.version=1,this.name="",this.updateBeforeType=Vy.OBJECT,this.onInitFunction=null}setCount(e){return this.count=e,this}getCount(){return this.count}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Rt('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){const t=this.computeNode.build(e);if(t){e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){const{shaderStage:n}=e;if("compute"===n){const t=this.computeNode.build(e,"void");""!==t&&e.addLineFlowCode(t,this)}else{const n=e.getNodeProperties(this).outputComputeNode;if(n)return n.build(e,t)}}}const Fw=(e,t=[64])=>{(0===t.length||t.length>3)&&Nt("TSL: compute() workgroupSize must have 1, 2, or 3 elements");for(let e=0;eFw(e,n).setCount(t);cb("compute",kw),cb("computeKernel",Fw);class qw extends $y{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}getNodeType(e){const t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);const r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){const n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const i=this.node.build(e,...t);return e.setCache(n),i}setParent(e){return this.parent=e,this}getParent(){return this.parent}}const Vw=e=>new qw(kb(e));function zw(e,t=!0){return Rt('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),Vw(e).setParent(t)}cb("cache",zw),cb("isolate",Vw);class Gw extends $y{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const Hw=Gb(Gw).setParameterLength(2);cb("bypass",Hw);class jw extends $y{static get type(){return"RemapNode"}constructor(e,t,n,r=ex(0),i=ex(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=n,this.outLowNode=r,this.outHighNode=i,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:n,outLowNode:r,outHighNode:i,doClamp:s}=this;let a=e.sub(t).div(n.sub(t));return!0===s&&(a=a.clamp()),a.mul(i.sub(r)).add(r)}}const Ww=Gb(jw,null,null,{doClamp:!1}).setParameterLength(3,5),Xw=Gb(jw).setParameterLength(3,5);cb("remap",Ww),cb("remapClamp",Xw);class Qw extends $y{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const n=this.getNodeType(e),r=this.snippet;if("void"!==n)return e.format(r,n,t);e.addLineFlowCode(r,this)}}const $w=Gb(Qw).setParameterLength(1,2),Yw=e=>(e?rw(e,$w("discard")):$w("discard")).toStack();cb("discard",Yw);class Kw extends Zy{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;const n=(null!==this._toneMapping?this._toneMapping:e.toneMapping)||0,r=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||rt;return 0!==n&&(t=t.toneMapping(n)),r!==rt&&r!==en.workingColorSpace&&(t=t.workingToColorSpace(r)),t}}const Zw=(e,t=null,n=null)=>kb(new Kw(kb(e),t,n));cb("renderOutput",Zw);class Jw extends Zy{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}getNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){const t=this.callback,n=this.node.build(e),r="--- TSL debug - "+e.shaderStage+" shader ---",i="-".repeat(r.length);let s="";return s+="// #"+r+"#\n",s+=e.flow.code.replace(/^\t/gm,"")+"\n",s+="/* ... */ "+n+" /* ... */\n",s+="// #"+i+"#\n",null!==t?t(e,s):Ct(s),n}}const eM=(e,t=null)=>kb(new Jw(kb(e),t)).toStack();cb("debug",eM);class tM{constructor(){this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class nM extends $y{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=Vy.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}getNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return!0===e.context.inspector&&null!==this.callback&&(t=this.callback(t)),!0!==e.renderer.backend.isWebGPUBackend&&e.renderer.inspector.constructor!==tM&&Pt('TSL: ".toInspector()" is only available with WebGPU.'),t}}function rM(e,t="",n=null){return(e=kb(e)).before(new nM(e,t,n))}cb("toInspector",rM);class iM extends $y{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(null===t){const n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){const r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),n=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){const r=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(r),s=e.getAttribute(t,i);if("vertex"===e.shaderStage)return e.format(s.name,i,n);return gw(this).build(e,n)}return Rt(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const sM=(e,t=null)=>kb(new iM(e,t)),aM=(e=0)=>sM("uv"+(e>0?e:""),"vec2");class oM extends $y{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const n=this.textureNode.build(e,"property"),r=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}}const lM=Gb(oM).setParameterLength(1,2);class uM extends iT{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=Vy.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&void 0!==n.width){const{width:e,height:t}=n;this.value=Math.log2(Math.max(e,t))}}}const cM=Gb(uM).setParameterLength(1),hM=new hn;class AM extends iT{static get type(){return"TextureNode"}constructor(e=hM,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=Vy.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return!0===this.value.isDepthTexture?"float":this.value.type===oe?"uvec4":this.value.type===ae?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return aM(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=sT(this.value.matrix)),this._matrixUniform.mul(lx(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(null===this._flipYUniform&&(this._flipYUniform=sT(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(tx(lM(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const n=this.value;if(!n||!0!==n.isTexture)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");const r=Qb(()=>{let t=this.uvNode;return null!==t&&!0!==e.context.forceUVContext||!e.context.getUV||(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),!0===this.updateMatrix&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=null!==this._matrixUniform||null!==this._flipYUniform?Vy.OBJECT:Vy.NONE,t})();let i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),t.uvNode=r,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,i,s,a,o,l){const u=this.value;let c;return c=i?e.generateTextureBias(u,t,n,i,s,l):o?e.generateTextureGrad(u,t,n,o,s,l):a?e.generateTextureCompare(u,t,n,a,s,l):!1===this.sampler?e.generateTextureLoad(u,t,n,r,s,l):r?e.generateTextureLevel(u,t,n,r,s,l):e.generateTexture(u,t,n,s,l),c}generate(e,t){const n=this.value,r=e.getNodeProperties(this),i=super.generate(e,"property");if(/^sampler/.test(t))return i+"_sampler";if(e.isReference(t))return i;{const s=e.getDataFromNode(this);let a=s.propertyName;if(void 0===a){const{uvNode:t,levelNode:n,biasNode:o,compareNode:l,depthNode:u,gradNode:c,offsetNode:h}=r,A=this.generateUV(e,t),d=n?n.build(e,"float"):null,p=o?o.build(e,"float"):null,f=u?u.build(e,"int"):null,m=l?l.build(e,"float"):null,g=c?[c[0].build(e,"vec2"),c[1].build(e,"vec2")]:null,_=h?this.generateOffset(e,h):null,v=e.getVarFromNode(this);a=e.getPropertyName(v);const y=this.generateSnippet(e,i,A,d,p,f,m,g,_);e.addLineFlowCode(`${a} = ${y}`,this),s.snippet=y,s.propertyName=a}let o=a;const l=this.getNodeType(e);return e.needsToWorkingColorSpace(n)&&(o=Sw($w(o,l),n.colorSpace).setup(e).build(e,l)),e.format(o,l,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return Rt("TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=kb(e),t.referenceNode=this.getBase(),kb(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){const t=this.clone();t.biasNode=kb(e).mul(cM(t)),t.referenceNode=this.getBase();const n=t.value;return!1===t.generateMipmaps&&(n&&!1===n.generateMipmaps||n.minFilter===Y||n.magFilter===Y)&&(Rt("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),kb(t)}level(e){const t=this.clone();return t.levelNode=kb(e),t.referenceNode=this.getBase(),kb(t)}size(e){return lM(this,e)}bias(e){const t=this.clone();return t.biasNode=kb(e),t.referenceNode=this.getBase(),kb(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){const t=this.clone();return t.compareNode=kb(e),t.referenceNode=this.getBase(),kb(t)}grad(e,t){const n=this.clone();return n.gradNode=[kb(e),kb(t)],n.referenceNode=this.getBase(),kb(n)}depth(e){const t=this.clone();return t.depthNode=kb(e),t.referenceNode=this.getBase(),kb(t)}offset(e){const t=this.clone();return t.offsetNode=kb(e),t.referenceNode=this.getBase(),kb(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix();const n=this._flipYUniform;null!==n&&(n.value=e.image instanceof ImageBitmap&&!0===e.flipY||!0===e.isRenderTargetTexture||!0===e.isFramebufferTexture||!0===e.isDepthTexture)}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}const dM=Gb(AM).setParameterLength(1,4).setName("texture"),pM=(e=hM,t=null,n=null,r=null)=>{let i;return e&&!0===e.isTextureNode?(i=kb(e.clone()),i.referenceNode=e.getBase(),null!==t&&(i.uvNode=kb(t)),null!==n&&(i.levelNode=kb(n)),null!==r&&(i.biasNode=kb(r))):i=dM(e,t,n,r),i},fM=(...e)=>pM(...e).setSampler(!1);class mM extends iT{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const gM=(e,t,n)=>kb(new mM(e,t,n));class _M extends Yy{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),n=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,n)}}class vM extends mM{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?Uy(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=Vy.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){const{array:e,value:t}=this,n=this.elementType;if("float"===n||"int"===n||"uint"===n)for(let n=0;nkb(new vM(e,t));const bM=Gb(class extends $y{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}).setParameterLength(1);let xM,TM;class SM extends $y{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===SM.DPR?"float":this.scope===SM.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=Vy.NONE;return this.scope!==SM.SIZE&&this.scope!==SM.VIEWPORT&&this.scope!==SM.DPR||(e=Vy.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===SM.VIEWPORT?null!==t?TM.copy(t.viewport):(e.getViewport(TM),TM.multiplyScalar(e.getPixelRatio())):this.scope===SM.DPR?this._output.value=e.getPixelRatio():null!==t?(xM.width=t.width,xM.height=t.height):e.getDrawingBufferSize(xM)}setup(){const e=this.scope;let t=null;return t=e===SM.SIZE?sT(xM||(xM=new Ht)):e===SM.VIEWPORT?sT(TM||(TM=new An)):e===SM.DPR?sT(1):ix(CM.div(EM)),this._output=t,t}generate(e){if(this.scope===SM.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const n=e.getNodeProperties(EM).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}}SM.COORDINATE="coordinate",SM.VIEWPORT="viewport",SM.SIZE="size",SM.UV="uv",SM.DPR="dpr";const wM=Hb(SM,SM.DPR),MM=Hb(SM,SM.UV),EM=Hb(SM,SM.SIZE),CM=Hb(SM,SM.COORDINATE),RM=Hb(SM,SM.VIEWPORT),NM=RM.zw,PM=CM.sub(RM.xy),DM=PM.div(NM),LM=Qb(()=>(Rt('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.'),EM),"vec2").once()(),IM=sT(0,"uint").setName("u_cameraIndex").setGroup(eT("cameraIndex")).toVarying("v_cameraIndex"),UM=sT("float").setName("cameraNear").setGroup(nT).onRenderUpdate(({camera:e})=>e.near),OM=sT("float").setName("cameraFar").setGroup(nT).onRenderUpdate(({camera:e})=>e.far),BM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.projectionMatrix);t=yM(n).setGroup(nT).setName("cameraProjectionMatrices").element(e.isMultiViewCamera?bM("gl_ViewID_OVR"):IM).toConst("cameraProjectionMatrix")}else t=sT("mat4").setName("cameraProjectionMatrix").setGroup(nT).onRenderUpdate(({camera:e})=>e.projectionMatrix);return t}).once()(),FM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.projectionMatrixInverse);t=yM(n).setGroup(nT).setName("cameraProjectionMatricesInverse").element(e.isMultiViewCamera?bM("gl_ViewID_OVR"):IM).toConst("cameraProjectionMatrixInverse")}else t=sT("mat4").setName("cameraProjectionMatrixInverse").setGroup(nT).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse);return t}).once()(),kM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.matrixWorldInverse);t=yM(n).setGroup(nT).setName("cameraViewMatrices").element(e.isMultiViewCamera?bM("gl_ViewID_OVR"):IM).toConst("cameraViewMatrix")}else t=sT("mat4").setName("cameraViewMatrix").setGroup(nT).onRenderUpdate(({camera:e})=>e.matrixWorldInverse);return t}).once()(),qM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.matrixWorld);t=yM(n).setGroup(nT).setName("cameraWorldMatrices").element(e.isMultiViewCamera?bM("gl_ViewID_OVR"):IM).toConst("cameraWorldMatrix")}else t=sT("mat4").setName("cameraWorldMatrix").setGroup(nT).onRenderUpdate(({camera:e})=>e.matrixWorld);return t}).once()(),VM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.normalMatrix);t=yM(n).setGroup(nT).setName("cameraNormalMatrices").element(e.isMultiViewCamera?bM("gl_ViewID_OVR"):IM).toConst("cameraNormalMatrix")}else t=sT("mat3").setName("cameraNormalMatrix").setGroup(nT).onRenderUpdate(({camera:e})=>e.normalMatrix);return t}).once()(),zM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(let t=0,r=e.cameras.length;t{const n=e.cameras,r=t.array;for(let e=0,t=n.length;et.value.setFromMatrixPosition(e.matrixWorld));return t}).once()(),GM=Qb(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){const n=[];for(const t of e.cameras)n.push(t.viewport);t=yM(n,"vec4").setGroup(nT).setName("cameraViewports").element(IM).toConst("cameraViewport")}else t=Ax(0,0,EM.x,EM.y).toConst("cameraViewport");return t}).once()(),HM=new Un;class jM extends $y{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=Vy.OBJECT,this.uniformNode=new iT(null)}getNodeType(){const e=this.scope;return e===jM.WORLD_MATRIX?"mat4":e===jM.POSITION||e===jM.VIEW_POSITION||e===jM.DIRECTION||e===jM.SCALE?"vec3":e===jM.RADIUS?"float":void 0}update(e){const t=this.object3d,n=this.uniformNode,r=this.scope;if(r===jM.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===jM.POSITION)n.value=n.value||new Wt,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===jM.SCALE)n.value=n.value||new Wt,n.value.setFromMatrixScale(t.matrixWorld);else if(r===jM.DIRECTION)n.value=n.value||new Wt,t.getWorldDirection(n.value);else if(r===jM.VIEW_POSITION){const r=e.camera;n.value=n.value||new Wt,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(r.matrixWorldInverse)}else if(r===jM.RADIUS){const r=e.object.geometry;null===r.boundingSphere&&r.computeBoundingSphere(),HM.copy(r.boundingSphere).applyMatrix4(t.matrixWorld),n.value=HM.radius}}generate(e){const t=this.scope;return t===jM.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===jM.POSITION||t===jM.VIEW_POSITION||t===jM.DIRECTION||t===jM.SCALE?this.uniformNode.nodeType="vec3":t===jM.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}jM.WORLD_MATRIX="worldMatrix",jM.POSITION="position",jM.SCALE="scale",jM.VIEW_POSITION="viewPosition",jM.DIRECTION="direction",jM.RADIUS="radius";const WM=Gb(jM,jM.DIRECTION).setParameterLength(1),XM=Gb(jM,jM.WORLD_MATRIX).setParameterLength(1),QM=Gb(jM,jM.POSITION).setParameterLength(1),$M=Gb(jM,jM.SCALE).setParameterLength(1),YM=Gb(jM,jM.VIEW_POSITION).setParameterLength(1),KM=Gb(jM,jM.RADIUS).setParameterLength(1);class ZM extends jM{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const JM=Hb(ZM,ZM.DIRECTION),eE=Hb(ZM,ZM.WORLD_MATRIX),tE=Hb(ZM,ZM.POSITION),nE=Hb(ZM,ZM.SCALE),rE=Hb(ZM,ZM.VIEW_POSITION),iE=Hb(ZM,ZM.RADIUS),sE=sT(new $t).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),aE=sT(new Hn).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),oE=Qb(e=>e.renderer.overrideNodes.modelViewMatrix||lE).once()().toVar("modelViewMatrix"),lE=kM.mul(eE),uE=Qb(e=>(e.context.isHighPrecisionModelViewMatrix=!0,sT("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),cE=Qb(e=>{const t=e.context.isHighPrecisionModelViewMatrix;return sT("mat3").onObjectUpdate(({object:e,camera:n})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),hE=sM("position","vec3"),AE=hE.toVarying("positionLocal"),dE=hE.toVarying("positionPrevious"),pE=Qb(e=>eE.mul(AE).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),fE=Qb(()=>AE.transformDirection(eE).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),mE=Qb(e=>e.context.setupPositionView().toVarying("v_positionView"),"vec3").once(["POSITION"])(),gE=Qb(e=>{let t;return t=e.camera.isOrthographicCamera?lx(0,0,1):mE.negate().toVarying("v_positionViewDirection").normalize(),t.toVar("positionViewDirection")},"vec3").once(["POSITION"])();class _E extends $y{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";const{material:t}=e;return 1===t.side?"false":e.getFrontFacing()}}const vE=Hb(_E),yE=ex(vE).mul(2).sub(1),bE=Qb(([e],{material:t})=>{const n=t.side;return 1===n?e=e.mul(-1):2===n&&(e=e.mul(yE)),e}),xE=sM("normal","vec3"),TE=Qb(e=>!1===e.geometry.hasAttribute("normal")?(Rt('TSL: Vertex attribute "normal" not found on geometry.'),lx(0,1,0)):xE,"vec3").once()().toVar("normalLocal"),SE=mE.dFdx().cross(mE.dFdy()).normalize().toVar("normalFlat"),wE=Qb(e=>{let t;return t=!0===e.material.flatShading?SE:PE(TE).toVarying("v_normalViewGeometry").normalize(),t},"vec3").once()().toVar("normalViewGeometry"),ME=Qb(e=>{let t=wE.transformDirection(kM);return!0!==e.material.flatShading&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),EE=Qb(({subBuildFn:e,material:t,context:n})=>{let r;return"NORMAL"===e||"VERTEX"===e?(r=wE,!0!==t.flatShading&&(r=bE(r))):r=n.setupNormal().context({getUV:null}),r},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),CE=EE.transformDirection(kM).toVar("normalWorld"),RE=Qb(({subBuildFn:e,context:t})=>{let n;return n="NORMAL"===e||"VERTEX"===e?EE:t.setupClearcoatNormal().context({getUV:null}),n},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),NE=Qb(([e,t=eE])=>{const n=gx(t),r=e.div(lx(n[0].dot(n[0]),n[1].dot(n[1]),n[2].dot(n[2])));return n.mul(r).xyz}),PE=Qb(([e],t)=>{const n=t.renderer.overrideNodes.modelNormalViewMatrix;if(null!==n)return n.transformDirection(e);const r=sE.mul(e);return kM.transformDirection(r)}),DE=Qb(()=>(Rt('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),EE)).once(["NORMAL","VERTEX"])(),LE=Qb(()=>(Rt('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),CE)).once(["NORMAL","VERTEX"])(),IE=Qb(()=>(Rt('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),RE)).once(["NORMAL","VERTEX"])(),UE=new er,OE=new Hn,BE=sT(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),FE=sT(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),kE=sT(new Hn).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){const n=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return n?(UE.copy(n),OE.makeRotationFromEuler(UE)):OE.identity(),OE}),qE=gE.negate().reflect(EE),VE=gE.negate().refract(EE,BE),zE=qE.transformDirection(kM).toVar("reflectVector"),GE=VE.transformDirection(kM).toVar("reflectVector"),HE=new Li;class jE extends AM{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===z?zE:e.mapping===G?GE:(Nt('CubeTextureNode: Mapping "%s" not supported.',e.mapping),lx(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return e.renderer.coordinateSystem!==bt&&n.isRenderTargetTexture||(t=lx(t.x.negate(),t.yz)),kE.mul(t)}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}}const WE=Gb(jE).setParameterLength(1,4).setName("cubeTexture"),XE=(e=HE,t=null,n=null,r=null)=>{let i;return e&&!0===e.isCubeTextureNode?(i=kb(e.clone()),i.referenceNode=e,null!==t&&(i.uvNode=kb(t)),null!==n&&(i.levelNode=kb(n)),null!==r&&(i.biasNode=kb(r))):i=WE(e,t,n,r),i};class QE extends Yy{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}}class $E extends $y{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=Vy.OBJECT}element(e){return kb(new QE(this,kb(e)))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Rt('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?gM(null,e,this.count):Array.isArray(this.getValueFromReference())?yM(null,e):"texture"===e?pM(null):"cubeTexture"===e?XE(null):sT(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let n=e[t[0]];for(let e=1;ekb(new $E(e,t,n)),KE=(e,t,n,r)=>kb(new $E(e,t,r,n));class ZE extends $E{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}const JE=(e,t,n=null)=>kb(new ZE(e,t,n)),eC=aM(),tC=mE.dFdx(),nC=mE.dFdy(),rC=eC.dFdx(),iC=eC.dFdy(),sC=EE,aC=nC.cross(sC),oC=sC.cross(tC),lC=aC.mul(rC.x).add(oC.mul(iC.x)),uC=aC.mul(rC.y).add(oC.mul(iC.y)),cC=lC.dot(lC).max(uC.dot(uC)),hC=cC.equal(0).select(0,cC.inverseSqrt()),AC=lC.mul(hC).toVar("tangentViewFrame"),dC=uC.mul(hC).toVar("bitangentViewFrame"),pC=Qb(e=>(!1===e.geometry.hasAttribute("tangent")&&e.geometry.computeTangents(),sM("tangent","vec4")))(),fC=pC.xyz.toVar("tangentLocal"),mC=Qb(({subBuildFn:e,geometry:t,material:n})=>{let r;return r="VERTEX"===e||t.hasAttribute("tangent")?oE.mul(Ax(fC,0)).xyz.toVarying("v_tangentView").normalize():AC,!0!==n.flatShading&&(r=bE(r)),r},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),gC=mC.transformDirection(kM).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),_C=Qb(([e,t],{subBuildFn:n,material:r})=>{let i=e.mul(pC.w).xyz;return"NORMAL"===n&&!0!==r.flatShading&&(i=i.toVarying(t)),i}).once(["NORMAL"]),vC=_C(xE.cross(pC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),yC=_C(TE.cross(fC),"v_bitangentLocal").normalize().toVar("bitangentLocal"),bC=Qb(({subBuildFn:e,geometry:t,material:n})=>{let r;return r="VERTEX"===e||t.hasAttribute("tangent")?_C(EE.cross(mC),"v_bitangentView").normalize():dC,!0!==n.flatShading&&(r=bE(r)),r},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),xC=_C(CE.cross(gC),"v_bitangentWorld").normalize().toVar("bitangentWorld"),TC=gx(mC,bC,EE).toVar("TBNViewMatrix"),SC=gE.mul(TC),wC=Qb(()=>{let e=Fx.cross(gE);return e=e.cross(Fx).normalize(),e=GS(e,EE,Ox.mul(Mx.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()();class MC extends Zy{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=0}setup({material:e}){const{normalMapType:t,scaleNode:n}=this;let r=this.node.mul(2).sub(1);if(null!==n){let t=n;!0===e.flatShading&&(t=bE(t)),r=lx(r.xy.mul(t),r.z)}let i=null;return 1===t?i=PE(r):0===t?i=TC.mul(r).normalize():(Nt(`NodeMaterial: Unsupported normal map type: ${t}`),i=EE),i}}const EC=Gb(MC).setParameterLength(1,2),CC=Qb(({textureNode:e,bumpScale:t})=>{const n=t=>e.isolate().context({getUV:e=>t(e.uvNode||aM()),forceUVContext:!0}),r=ex(n(e=>e));return ix(ex(n(e=>e.add(e.dFdx()))).sub(r),ex(n(e=>e.add(e.dFdy()))).sub(r)).mul(t)}),RC=Qb(e=>{const{surf_pos:t,surf_norm:n,dHdxy:r}=e,i=t.dFdx().normalize(),s=n,a=t.dFdy().normalize().cross(s),o=s.cross(i),l=i.dot(a).mul(yE),u=l.sign().mul(r.x.mul(a).add(r.y.mul(o)));return l.abs().mul(n).sub(u).normalize()});class NC extends Zy{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=null!==this.scaleNode?this.scaleNode:1,t=CC({textureNode:this.textureNode,bumpScale:e});return RC({surf_pos:mE,surf_norm:EE,dHdxy:t})}}const PC=Gb(NC).setParameterLength(1,2),DC=new Map;class LC extends $y{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=DC.get(e);return void 0===n&&(n=JE(e,t),DC.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){const t=e.context.material,n=this.scope;let r=null;if(n===LC.COLOR){const e=void 0!==t.color?this.getColor(n):lx();r=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(n===LC.OPACITY){const e=this.getFloat(n);r=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(n===LC.SPECULAR_STRENGTH)r=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:ex(1);else if(n===LC.SPECULAR_INTENSITY){const e=this.getFloat(n);r=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(n).a):e}else if(n===LC.SPECULAR_COLOR){const e=this.getColor(n);r=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(n).rgb):e}else if(n===LC.ROUGHNESS){const e=this.getFloat(n);r=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(n).g):e}else if(n===LC.METALNESS){const e=this.getFloat(n);r=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(n).b):e}else if(n===LC.EMISSIVE){const e=this.getFloat("emissiveIntensity"),i=this.getColor(n).mul(e);r=t.emissiveMap&&!0===t.emissiveMap.isTexture?i.mul(this.getTexture(n)):i}else if(n===LC.NORMAL)t.normalMap?(r=EC(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType):r=t.bumpMap?PC(this.getTexture("bump").r,this.getFloat("bumpScale")):EE;else if(n===LC.CLEARCOAT){const e=this.getFloat(n);r=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(n).r):e}else if(n===LC.CLEARCOAT_ROUGHNESS){const e=this.getFloat(n);r=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(n).r):e}else if(n===LC.CLEARCOAT_NORMAL)r=t.clearcoatNormalMap?EC(this.getTexture(n),this.getCache(n+"Scale","vec2")):EE;else if(n===LC.SHEEN){const e=this.getColor("sheenColor").mul(this.getFloat("sheen"));r=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(n===LC.SHEEN_ROUGHNESS){const e=this.getFloat(n);r=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(n).a):e,r=r.clamp(.07,1)}else if(n===LC.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){const e=this.getTexture(n);r=mx(gR.x,gR.y,gR.y.negate(),gR.x).mul(e.rg.mul(2).sub(ix(1)).normalize().mul(e.b))}else r=gR;else if(n===LC.IRIDESCENCE_THICKNESS){const e=YE("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const i=YE("0","float",t.iridescenceThicknessRange);r=e.sub(i).mul(this.getTexture(n).g).add(i)}else r=e}else if(n===LC.TRANSMISSION){const e=this.getFloat(n);r=t.transmissionMap?e.mul(this.getTexture(n).r):e}else if(n===LC.THICKNESS){const e=this.getFloat(n);r=t.thicknessMap?e.mul(this.getTexture(n).g):e}else if(n===LC.IOR)r=this.getFloat(n);else if(n===LC.LIGHT_MAP)r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity"));else if(n===LC.AO)r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(n===LC.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):ex(0);else{const t=this.getNodeType(e);r=this.getCache(n,t)}return r}}LC.ALPHA_TEST="alphaTest",LC.COLOR="color",LC.OPACITY="opacity",LC.SHININESS="shininess",LC.SPECULAR="specular",LC.SPECULAR_STRENGTH="specularStrength",LC.SPECULAR_INTENSITY="specularIntensity",LC.SPECULAR_COLOR="specularColor",LC.REFLECTIVITY="reflectivity",LC.ROUGHNESS="roughness",LC.METALNESS="metalness",LC.NORMAL="normal",LC.CLEARCOAT="clearcoat",LC.CLEARCOAT_ROUGHNESS="clearcoatRoughness",LC.CLEARCOAT_NORMAL="clearcoatNormal",LC.EMISSIVE="emissive",LC.ROTATION="rotation",LC.SHEEN="sheen",LC.SHEEN_ROUGHNESS="sheenRoughness",LC.ANISOTROPY="anisotropy",LC.IRIDESCENCE="iridescence",LC.IRIDESCENCE_IOR="iridescenceIOR",LC.IRIDESCENCE_THICKNESS="iridescenceThickness",LC.IOR="ior",LC.TRANSMISSION="transmission",LC.THICKNESS="thickness",LC.ATTENUATION_DISTANCE="attenuationDistance",LC.ATTENUATION_COLOR="attenuationColor",LC.LINE_SCALE="scale",LC.LINE_DASH_SIZE="dashSize",LC.LINE_GAP_SIZE="gapSize",LC.LINE_WIDTH="linewidth",LC.LINE_DASH_OFFSET="dashOffset",LC.POINT_SIZE="size",LC.DISPERSION="dispersion",LC.LIGHT_MAP="light",LC.AO="ao";const IC=Hb(LC,LC.ALPHA_TEST),UC=Hb(LC,LC.COLOR),OC=Hb(LC,LC.SHININESS),BC=Hb(LC,LC.EMISSIVE),FC=Hb(LC,LC.OPACITY),kC=Hb(LC,LC.SPECULAR),qC=Hb(LC,LC.SPECULAR_INTENSITY),VC=Hb(LC,LC.SPECULAR_COLOR),zC=Hb(LC,LC.SPECULAR_STRENGTH),GC=Hb(LC,LC.REFLECTIVITY),HC=Hb(LC,LC.ROUGHNESS),jC=Hb(LC,LC.METALNESS),WC=Hb(LC,LC.NORMAL),XC=Hb(LC,LC.CLEARCOAT),QC=Hb(LC,LC.CLEARCOAT_ROUGHNESS),$C=Hb(LC,LC.CLEARCOAT_NORMAL),YC=Hb(LC,LC.ROTATION),KC=Hb(LC,LC.SHEEN),ZC=Hb(LC,LC.SHEEN_ROUGHNESS),JC=Hb(LC,LC.ANISOTROPY),eR=Hb(LC,LC.IRIDESCENCE),tR=Hb(LC,LC.IRIDESCENCE_IOR),nR=Hb(LC,LC.IRIDESCENCE_THICKNESS),rR=Hb(LC,LC.TRANSMISSION),iR=Hb(LC,LC.THICKNESS),sR=Hb(LC,LC.IOR),aR=Hb(LC,LC.ATTENUATION_DISTANCE),oR=Hb(LC,LC.ATTENUATION_COLOR),lR=Hb(LC,LC.LINE_SCALE),uR=Hb(LC,LC.LINE_DASH_SIZE),cR=Hb(LC,LC.LINE_GAP_SIZE),hR=Hb(LC,LC.LINE_WIDTH),AR=Hb(LC,LC.LINE_DASH_OFFSET),dR=Hb(LC,LC.POINT_SIZE),pR=Hb(LC,LC.DISPERSION),fR=Hb(LC,LC.LIGHT_MAP),mR=Hb(LC,LC.AO),gR=sT(new Ht).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),_R=Qb(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class vR extends $y{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),n=this.scope;let r,i;if(n===vR.VERTEX)r=e.getVertexIndex();else if(n===vR.INSTANCE)r=e.getInstanceIndex();else if(n===vR.DRAW)r=e.getDrawIndex();else if(n===vR.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===vR.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else{if(n!==vR.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+n);r=e.getSubgroupIndex()}if("vertex"===e.shaderStage||"compute"===e.shaderStage)i=r;else{i=gw(this).build(e,t)}return i}}vR.VERTEX="vertex",vR.INSTANCE="instance",vR.SUBGROUP="subgroup",vR.INVOCATION_LOCAL="invocationLocal",vR.INVOCATION_SUBGROUP="invocationSubgroup",vR.DRAW="draw";const yR=Hb(vR,vR.VERTEX),bR=Hb(vR,vR.INSTANCE),xR=Hb(vR,vR.SUBGROUP),TR=Hb(vR,vR.INVOCATION_SUBGROUP),SR=Hb(vR,vR.INVOCATION_LOCAL),wR=Hb(vR,vR.DRAW);class MR extends $y{static get type(){return"InstanceNode"}constructor(e,t,n=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=n,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=Vy.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{instanceMatrix:t,instanceColor:n}=this,{count:r}=t;let{instanceMatrixNode:i,instanceColorNode:s}=this;if(null===i){if(r<=1e3)i=gM(t.array,"mat4",Math.max(r,1)).element(bR);else{const e=new go(t.array,16,1);this.buffer=e;const n=t.usage===_t?Ow:Uw,r=[n(e,"vec4",16,0),n(e,"vec4",16,4),n(e,"vec4",16,8),n(e,"vec4",16,12)];i=_x(...r)}this.instanceMatrixNode=i}if(n&&null===s){const e=new Hi(n.array,3),t=n.usage===_t?Ow:Uw;this.bufferColor=e,s=lx(t(e,"vec3",3,0)),this.instanceColorNode=s}const a=i.mul(AE).xyz;if(AE.assign(a),e.hasGeometryAttribute("normal")){const e=NE(TE,i);TE.assign(e)}null!==this.instanceColorNode&&Tx("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){null!==this.buffer&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.usage!==_t&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&null!==this.bufferColor&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.usage!==_t&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version))}}const ER=Gb(MR).setParameterLength(2,3);class CR extends MR{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:n,instanceColor:r}=e;super(t,n,r),this.instancedMesh=e}}const RR=Gb(CR).setParameterLength(1);class NR extends $y{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=bR:this.batchingIdNode=wR);const t=Qb(([e])=>{const t=tx(lM(fM(this.batchMesh._indirectTexture),0).x),n=tx(e).mod(t),r=tx(e).div(t);return fM(this.batchMesh._indirectTexture,sx(n,r)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]}),n=t(tx(this.batchingIdNode)),r=this.batchMesh._matricesTexture,i=tx(lM(fM(r),0).x),s=ex(n).mul(4).toInt().toVar(),a=s.mod(i),o=s.div(i),l=_x(fM(r,sx(a,o)),fM(r,sx(a.add(1),o)),fM(r,sx(a.add(2),o)),fM(r,sx(a.add(3),o))),u=this.batchMesh._colorsTexture;if(null!==u){const e=Qb(([e])=>{const t=tx(lM(fM(u),0).x),n=e,r=n.mod(t),i=n.div(t);return fM(u,sx(r,i)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]}),t=e(n);Tx("vec3","vBatchColor").assign(t)}const c=gx(l);AE.assign(l.mul(AE));const h=TE.div(lx(c[0].dot(c[0]),c[1].dot(c[1]),c[2].dot(c[2]))),A=c.mul(h).xyz;TE.assign(A),e.hasGeometryAttribute("tangent")&&fC.mulAssign(c)}}const PR=Gb(NR).setParameterLength(1);class DR extends Yy{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n;const r=e.context.assign;if(n=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===r||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):super.generate(e),!0!==r){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}const LR=Gb(DR).setParameterLength(2);class IR extends mM{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,i=null;t&&t.isStruct?(r="struct",i=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=Ny(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=i,this.access=zy.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(0===this.bufferCount){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return LR(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(zy.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=Lw(this.value),this._varying=gw(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(null!==this.structTypeNode)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}}const UR=(e,t=null,n=0)=>kb(new IR(e,t,n)),OR=new WeakMap;class BR extends $y{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=Vy.OBJECT,this.skinIndexNode=sM("skinIndex","uvec4"),this.skinWeightNode=sM("skinWeight","vec4"),this.bindMatrixNode=YE("bindMatrix","mat4"),this.bindMatrixInverseNode=YE("bindMatrixInverse","mat4"),this.boneMatricesNode=KE("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=AE,this.toPositionNode=AE,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:i,bindMatrixInverseNode:s}=this,a=e.element(n.x),o=e.element(n.y),l=e.element(n.z),u=e.element(n.w),c=i.mul(t),h=pT(a.mul(r.x).mul(c),o.mul(r.y).mul(c),l.mul(r.z).mul(c),u.mul(r.w).mul(c));return s.mul(h).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=TE){const{skinIndexNode:n,skinWeightNode:r,bindMatrixNode:i,bindMatrixInverseNode:s}=this,a=e.element(n.x),o=e.element(n.y),l=e.element(n.z),u=e.element(n.w);let c=pT(r.x.mul(a),r.y.mul(o),r.z.mul(l),r.w.mul(u));return c=s.mul(c).mul(i),c.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=KE("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,dE)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||!0===By(e.object).useVelocity}setup(e){this.needsPreviousBoneMatrices(e)&&dE.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){const t=this.getSkinnedNormal();TE.assign(t),e.hasGeometryAttribute("tangent")&&fC.assign(t)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){const t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;OR.get(t)!==e.frameId&&(OR.set(t,e.frameId),null!==this.previousBoneMatricesNode&&t.previousBoneMatrices.set(t.boneMatrices),t.update())}}const FR=e=>kb(new BR(e));class kR extends $y{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode("i".charCodeAt(0)+e)}getProperties(e){const t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;const n={};for(let e=0,t=this.params.length-1;eNumber(l)?">=":"<")),a)s=`while ( ${l} )`;else{const n={start:o,end:l},r=n.start,i=n.end;let a;const d=()=>h.includes("<")?"+=":"-=";if(null!=A)switch(typeof A){case"function":a=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":a=u+" "+d()+" "+e.generateConst(c,A);break;case"string":a=u+" "+A;break;default:A.isNode?a=u+" "+d()+" "+A.build(e):(Nt("TSL: 'Loop( { update: ... } )' is not a function, string or number."),a="break /* invalid update */")}else A="int"===c||"uint"===c?h.includes("<")?"++":"--":d()+" 1.",a=u+" "+A;s=`for ( ${e.getVar(c,u)+" = "+r}; ${u+" "+h+" "+i}; ${a} )`}e.addFlowCode((0===r?"\n":"")+e.tab+s+" {\n\n").addFlowTab()}const i=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode("\n"+e.tab+i);for(let t=0,n=this.params.length-1;tnew kR(zb(e,"int")).toStack(),VR=()=>$w("break").toStack(),zR=new WeakMap,GR=new An,HR=Qb(({bufferMap:e,influence:t,stride:n,width:r,depth:i,offset:s})=>{const a=tx(yR).mul(n).add(s),o=a.div(r),l=a.sub(o.mul(r));return fM(e,sx(l,o)).depth(i).xyz.mul(t)});class jR extends $y{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=sT(1),this.updateType=Vy.OBJECT}setup(e){const{geometry:t}=e,n=void 0!==t.morphAttributes.position,r=t.hasAttribute("normal")&&void 0!==t.morphAttributes.normal,i=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,s=void 0!==i?i.length:0,{texture:a,stride:o,size:l}=function(e){const t=void 0!==e.morphAttributes.position,n=void 0!==e.morphAttributes.normal,r=void 0!==e.morphAttributes.color,i=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=void 0!==i?i.length:0;let a=zR.get(e);if(void 0===a||a.count!==s){void 0!==a&&a.texture.dispose();const o=e.morphAttributes.position||[],l=e.morphAttributes.normal||[],u=e.morphAttributes.color||[];let c=0;!0===t&&(c=1),!0===n&&(c=2),!0===r&&(c=3);let h=e.attributes.position.count*c,A=1;const d=4096;h>d&&(A=Math.ceil(h/d),h=d);const p=new Float32Array(h*A*4*s),f=new fn(p,h,A,s);f.type=le,f.needsUpdate=!0;const m=4*c;for(let _=0;_{const t=ex(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(fM(this.mesh.morphTexture,sx(tx(e).add(1),tx(bR))).r):t.assign(YE("morphTargetInfluences","float").element(e).toVar()),Kb(t.notEqual(0),()=>{!0===n&&AE.addAssign(HR({bufferMap:a,influence:t,stride:o,width:u,depth:e,offset:tx(0)})),!0===r&&TE.addAssign(HR({bufferMap:a,influence:t,stride:o,width:u,depth:e,offset:tx(1)}))})})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}const WR=Gb(jR).setParameterLength(1);class XR extends $y{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class QR extends XR{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class $R extends iw{static get type(){return"LightingContextNode"}constructor(e,t=null,n=null,r=null){super(e),this.lightingModel=t,this.backdropNode=n,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,n={directDiffuse:lx().toVar("directDiffuse"),directSpecular:lx().toVar("directSpecular"),indirectDiffuse:lx().toVar("indirectDiffuse"),indirectSpecular:lx().toVar("indirectSpecular")};return{radiance:lx().toVar("radiance"),irradiance:lx().toVar("irradiance"),iblIrradiance:lx().toVar("iblIrradiance"),ambientOcclusion:ex(1).toVar("ambientOcclusion"),reflectedLight:n,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const YR=Gb($R);class KR extends XR{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}const ZR=new Ht;class JR extends AM{static get type(){return"ViewportTextureNode"}constructor(e=MM,t=null,n=null){let r=null;null===n?(r=new bs,r.minFilter=te,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=Vy.FRAME,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),null===e)return t;if(!1===n.has(e)){const r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){const t=e.renderer.getRenderTarget();return this.value=this.getTextureForReference(t),this.value}updateBefore(e){const t=e.renderer,n=t.getRenderTarget();null===n?t.getDrawingBufferSize(ZR):ZR.set(n.width,n.height);const r=this.getTextureForReference(n);r.image.width===ZR.width&&r.image.height===ZR.height||(r.image.width=ZR.width,r.image.height=ZR.height,r.needsUpdate=!0);const i=r.generateMipmaps;r.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(r),r.generateMipmaps=i}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const eN=Gb(JR).setParameterLength(0,3),tN=Gb(JR,null,null,{generateMipmaps:!0}).setParameterLength(0,3);let nN=null;class rN extends JR{static get type(){return"ViewportDepthTextureNode"}constructor(e=MM,t=null){null===nN&&(nN=new xs),super(e,t,nN)}getTextureForReference(){return nN}}const iN=Gb(rN).setParameterLength(0,2);class sN extends $y{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===sN.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,n=this.valueNode;let r=null;if(t===sN.DEPTH_BASE)null!==n&&(r=cN().assign(n));else if(t===sN.DEPTH)r=e.isPerspectiveCamera?oN(mE.z,UM,OM):aN(mE.z,UM,OM);else if(t===sN.LINEAR_DEPTH)if(null!==n)if(e.isPerspectiveCamera){const e=lN(n,UM,OM);r=aN(e,UM,OM)}else r=n;else r=aN(mE.z,UM,OM);return r}}sN.DEPTH_BASE="depthBase",sN.DEPTH="depth",sN.LINEAR_DEPTH="linearDepth";const aN=(e,t,n)=>e.add(t).div(t.sub(n)),oN=(e,t,n)=>t.add(e).mul(n).div(n.sub(t).mul(e)),lN=(e,t,n)=>t.mul(n).div(n.sub(t).mul(e).sub(n)),uN=(e,t,n)=>{t=t.max(1e-6).toVar();const r=eS(e.negate().div(t)),i=eS(n.div(t));return r.div(i)},cN=Gb(sN,sN.DEPTH_BASE),hN=Hb(sN,sN.DEPTH),AN=Gb(sN,sN.LINEAR_DEPTH).setParameterLength(0,1),dN=AN(iN());hN.assign=e=>cN(e);class pN extends $y{static get type(){return"ClippingNode"}constructor(e=pN.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===pN.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===pN.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return Qb(()=>{const n=ex().toVar("distanceToPlane"),r=ex().toVar("distanceToGradient"),i=ex(1).toVar("clipOpacity"),s=t.length;if(!1===this.hardwareClipping&&s>0){const e=yM(t).setGroup(nT);qR(s,({i:t})=>{const s=e.element(t);n.assign(mE.dot(s.xyz).negate().add(s.w)),r.assign(n.fwidth().div(2)),i.mulAssign(XS(r.negate(),r,n))})}const a=e.length;if(a>0){const t=yM(e).setGroup(nT),s=ex(1).toVar("intersectionClipOpacity");qR(a,({i:e})=>{const i=t.element(e);n.assign(mE.dot(i.xyz).negate().add(i.w)),r.assign(n.fwidth().div(2)),s.mulAssign(XS(r.negate(),r,n).oneMinus())}),i.mulAssign(s.oneMinus())}Sx.a.mulAssign(i),Sx.a.equal(0).discard()})()}setupDefault(e,t){return Qb(()=>{const n=t.length;if(!1===this.hardwareClipping&&n>0){const e=yM(t).setGroup(nT);qR(n,({i:t})=>{const n=e.element(t);mE.dot(n.xyz).greaterThan(n.w).discard()})}const r=e.length;if(r>0){const t=yM(e).setGroup(nT),n=rx(!0).toVar("clipped");qR(r,({i:e})=>{const r=t.element(e);n.assign(mE.dot(r.xyz).greaterThan(r.w).and(n))}),n.discard()}})()}setupHardwareClipping(e,t){const n=e.length;return t.enableHardwareClipping(n),Qb(()=>{const r=yM(e).setGroup(nT),i=bM(t.getClipDistance());qR(n,({i:e})=>{const t=r.element(e),n=mE.dot(t.xyz).sub(t.w).negate();i.element(e).assign(n)})})()}}pN.ALPHA_TO_COVERAGE="alphaToCoverage",pN.DEFAULT="default",pN.HARDWARE="hardware";const fN=Qb(([e])=>aS(mT(1e4,oS(mT(17,e.x).add(mT(.1,e.y)))).mul(pT(.1,dS(oS(mT(13,e.y).add(e.x))))))),mN=Qb(([e])=>fN(ix(fN(e.xy),e.z))),gN=Qb(([e])=>{const t=RS(fS(_S(e.xyz)),fS(vS(e.xyz))),n=ex(1).div(ex(.05).mul(t)).toVar("pixScale"),r=ix(ZT(rS(eS(n))),ZT(iS(eS(n)))),i=ix(mN(rS(r.x.mul(e.xyz))),mN(rS(r.y.mul(e.xyz)))),s=aS(eS(n)),a=pT(mT(s.oneMinus(),i.x),mT(s,i.y)),o=CS(s,s.oneMinus()),l=lx(a.mul(a).div(mT(2,o).mul(fT(1,o))),a.sub(mT(.5,o)).div(fT(1,o)),fT(1,fT(1,a).mul(fT(1,a)).div(mT(2,o).mul(fT(1,o))))),u=a.lessThan(o.oneMinus()).select(a.lessThan(o).select(l.x,l.y),l.z);return HS(u,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class _N extends iM{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e);let n;return n=!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new An(1,1,1,1)),n}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const vN=(e=0)=>kb(new _N(e)),yN=Qb(([e,t])=>CS(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),bN=Qb(([e,t])=>CS(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xN=Qb(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),TN=Qb(([e,t])=>GS(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),NS(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),SN=Qb(([e,t])=>{const n=t.a.add(e.a.mul(t.a.oneMinus()));return Ax(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(n),n)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),wN=Qb(([e])=>Ax(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),MN=Qb(([e])=>(Kb(e.a.equal(0),()=>Ax(0)),Ax(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class EN extends kr{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,Object.defineProperty(this,"shadowPositionNode",{get:()=>this.receivedShadowPositionNode,set:e=>{Rt('NodeMaterial: ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".'),this.receivedShadowPositionNode=e}})}_getNodeChildren(){const e=[];for(const t of Object.getOwnPropertyNames(this)){if(!0===t.startsWith("_"))continue;const n=this[t];n&&!0===n.isNode&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){const e=[];for(const{property:t,childNode:n}of this._getNodeChildren())e.push(wy(t.slice(0,-4)),n.getCacheKey());return this.type+My(e)}build(e){this.setup(e)}setupObserver(e){return new Ty(e)}setup(e){e.context.setupNormal=()=>fw(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,n=t.getRenderTarget();e.addStack();const r=fw(this.setupVertex(e),"VERTEX"),i=this.vertexNode||r;let s;e.stack.outputNode=i,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();const a=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==n?!0===n.depthBuffer&&this.setupDepth(e):!0===t.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);const r=this.setupLighting(e);null!==a&&e.stack.addToStack(a);const i=Ax(r,Sx.a).max(0);s=this.setupOutput(e,i),zx.assign(s);const o=null!==this.outputNode;if(o&&(s=this.outputNode),null!==n){const e=t.getMRT(),n=this.mrtNode;null!==e?(o&&zx.assign(s),s=e,null!==n&&(s=e.merge(n))):null!==n&&(s=n)}}else{let t=this.fragmentNode;!0!==t.isOutputStructNode&&(t=Ax(t)),s=this.setupOutput(e,t)}e.stack.outputNode=s,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;const{unionPlanes:t,intersectionPlanes:n}=e.clippingContext;let r=null;if(t.length>0||n.length>0){const t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?r=kb(new pN(pN.ALPHA_TO_COVERAGE)):e.stack.addToStack(kb(new pN))}return r}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(kb(new pN(pN.HARDWARE))),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:n}=e;let r=this.depthNode;if(null===r){const e=t.getMRT();e&&e.has("depth")?r=e.get("depth"):!0===t.logarithmicDepthBuffer&&(r=n.isPerspectiveCamera?uN(mE.z,UM,OM):aN(mE.z,UM,OM))}null!==r&&hN.assign(r).toStack()}setupPositionView(){return oE.mul(AE).xyz}setupModelViewProjection(){return BM.mul(mE)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),_R}setupPosition(e){const{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&WR(t).toStack(),!0===t.isSkinnedMesh&&FR(t).toStack(),this.displacementMap){const e=JE("displacementMap","texture"),t=JE("displacementScale","float"),n=JE("displacementBias","float");AE.addAssign(TE.normalize().mul(e.x.mul(t).add(n)))}return t.isBatchedMesh&&PR(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&RR(t).toStack(),null!==this.positionNode&&AE.assign(fw(this.positionNode,"POSITION","vec3")),AE}setupDiffuseColor(e){const{object:t,geometry:n}=e;null!==this.maskNode&&rx(this.maskNode).not().discard();let r=this.colorNode?Ax(this.colorNode):UC;if(!0===this.vertexColors&&n.hasAttribute("color")&&(r=r.mul(vN())),t.instanceColor){r=Tx("vec3","vInstanceColor").mul(r)}if(t.isBatchedMesh&&t._colorsTexture){r=Tx("vec3","vBatchColor").mul(r)}Sx.assign(r);const i=this.opacityNode?ex(this.opacityNode):FC;Sx.a.assign(Sx.a.mul(i));let s=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(s=null!==this.alphaTestNode?ex(this.alphaTestNode):IC,!0===this.alphaToCoverage?(Sx.a=XS(s,s.add(TS(Sx.a)),Sx.a),Sx.a.lessThanEqual(0).discard()):Sx.a.lessThanEqual(s).discard()),!0===this.alphaHash&&Sx.a.lessThan(gN(AE)).discard(),e.isOpaque()&&Sx.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?lx(0):Sx.rgb}setupNormal(){return this.normalNode?lx(this.normalNode):WC}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?JE("envMap","cubeTexture"):JE("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new KR(fR)),t}setupLights(e){const t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);const r=this.setupLightMap(e);if(r&&r.isLightingNode&&t.push(r),null!==this.aoNode||e.material.aoMap){const e=null!==this.aoNode?this.aoNode:mR;t.push(new QR(e))}let i=this.lightsNode||e.lightsNode;return t.length>0&&(i=e.renderer.lighting.createNode([...i.getLights(),...t])),i}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:i}=this,s=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null;let a=this.setupOutgoingLight(e);if(s&&s.getScope().hasLights){const t=this.setupLightingModel(e)||null;a=YR(s,t,n,r)}else null!==n&&(a=lx(null!==r?GS(a,n,r):n));return(i&&!0===i.isNode||t.emissive&&!0===t.emissive.isColor)&&(wx.assign(lx(i||BC)),a=a.add(wx)),a}setupFog(e,t){const n=e.fogNode;return n&&(zx.assign(t),t=Ax(n.toVar())),t}setupPremultipliedAlpha(e,t){return wN(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(const t in e){const n=e[t];void 0===this[t]&&(this[t]=n,n&&n.clone&&(this[t]=n.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});const n=kr.prototype.toJSON.call(this,e);n.inputNodes={};for(const{property:t,childNode:r}of this._getNodeChildren())n.inputNodes[t]=r.toJSON(e).uuid;function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(t){const t=r(e.textures),i=r(e.images),s=r(e.nodes);t.length>0&&(n.textures=t),i.length>0&&(n.images=i),s.length>0&&(n.nodes=s)}return n}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}const CN=new ns;class RN extends EN{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(CN),this.setValues(e)}}const NN=new ka;class PN extends EN{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(NN),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){const e=this.offsetNode?ex(this.offsetNode):AR,t=this.dashScaleNode?ex(this.dashScaleNode):lR,n=this.dashSizeNode?ex(this.dashSizeNode):uR,r=this.gapSizeNode?ex(this.gapSizeNode):cR;Gx.assign(n),Hx.assign(r);const i=gw(sM("lineDistance").mul(t));(e?i.add(e):i).mod(Gx.add(Hx)).greaterThan(Gx).discard()}}let DN=null;class LN extends JR{static get type(){return"ViewportSharedTextureNode"}constructor(e=MM,t=null){null===DN&&(DN=new bs),super(e,t,DN)}getTextureForReference(){return DN}updateReference(){return this}}const IN=Gb(LN).setParameterLength(0,2),UN=e=>kb(e).mul(.5).add(.5),ON=new Ia;class BN extends EN{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(ON),this.setValues(e)}setupDiffuseColor(){const e=this.opacityNode?ex(this.opacityNode):FC;Sx.assign(Sw(Ax(UN(EE),e),it))}}const FN=Qb(([e=fE])=>{const t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return ix(t,n)});class kN extends Ii{constructor(e=1,t={}){super(e,t),this.isCubeRenderTarget=!0}fromEquirectangularTexture(e,t){const n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i=new yi(5,5,5),s=FN(fE),a=new EN;a.colorNode=pM(t,s,0),a.side=1,a.blending=0;const o=new _i(i,a),l=new Fi;l.add(o),t.minFilter===te&&(t.minFilter=J);const u=new Di(1,10,this),c=e.getMRT();return e.setMRT(null),u.update(e,l),e.setMRT(c),t.minFilter=n,t.currentGenerateMipmaps=r,o.geometry.dispose(),o.material.dispose(),this}}const qN=new WeakMap;class VN extends Zy{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=XE(null);const t=new Li;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=Vy.RENDER}updateBefore(e){const{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){const e=r.isTextureNode?r.value:n[r.property];if(e&&e.isTexture){const n=e.mapping;if(n===H||n===j){if(qN.has(e)){const t=qN.get(e);GN(t,e.mapping),this._cubeTexture=t}else{const n=e.image;if(function(e){return null!=e&&e.height>0}(n)){const r=new kN(n.height);r.fromEquirectangularTexture(t,e),GN(r.texture,e.mapping),this._cubeTexture=r.texture,qN.set(e,r.texture),e.addEventListener("dispose",zN)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function zN(e){const t=e.target;t.removeEventListener("dispose",zN);const n=qN.get(t);void 0!==n&&(qN.delete(t),n.dispose())}function GN(e,t){t===H?e.mapping=z:t===j&&(e.mapping=G)}const HN=Gb(VN).setParameterLength(1);class jN extends XR{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=HN(this.envNode)}}class WN extends XR{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){const t=ex(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class XN{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class QN extends XN{constructor(){super()}indirect({context:e}){const t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ax(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ax(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Sx.rgb)}finish(e){const{material:t,context:n}=e,r=n.outgoingLight,i=e.context.environment;if(i)switch(t.combine){case 0:r.rgb.assign(GS(r.rgb,r.rgb.mul(i.rgb),zC.mul(GC)));break;case 1:r.rgb.assign(GS(r.rgb,i.rgb,zC.mul(GC)));break;case 2:r.rgb.addAssign(i.rgb.mul(zC.mul(GC)));break;default:Rt("BasicLightingModel: Unsupported .combine value:",t.combine)}}}const $N=new qr;class YN extends EN{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues($N),this.setValues(e)}setupNormal(){return bE(wE)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new jN(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new WN(fR)),t}setupOutgoingLight(){return Sx.rgb}setupLightingModel(){return new QN}}const KN=Qb(({f0:e,f90:t,dotVH:n})=>{const r=n.mul(-5.55473).sub(6.98316).mul(n).exp2();return e.mul(r.oneMinus()).add(t.mul(r))}),ZN=Qb(e=>e.diffuseColor.mul(1/Math.PI)),JN=Qb(({dotNH:e})=>Vx.mul(ex(.5)).add(1).mul(ex(1/Math.PI)).mul(e.pow(Vx))),eP=Qb(({lightDirection:e})=>{const t=e.add(gE).normalize(),n=EE.dot(t).clamp(),r=gE.dot(t).clamp(),i=KN({f0:kx,f90:1,dotVH:r}),s=ex(.25),a=JN({dotNH:n});return i.mul(s).mul(a)});class tP extends QN{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=EE.dot(e).clamp().mul(t);n.directDiffuse.addAssign(r.mul(ZN({diffuseColor:Sx.rgb}))),!0===this.specular&&n.directSpecular.addAssign(r.mul(eP({lightDirection:e})).mul(zC))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(ZN({diffuseColor:Sx}))),r.indirectDiffuse.mulAssign(t)}}const nP=new Ua;class rP extends EN{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(nP),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new jN(t):null}setupLightingModel(){return new tP(!1)}}const iP=new Da;class sP extends EN{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(iP),this.setValues(e)}setupEnvironment(e){const t=super.setupEnvironment(e);return t?new jN(t):null}setupLightingModel(){return new tP}setupVariants(){const e=(this.shininessNode?ex(this.shininessNode):OC).max(1e-4);Vx.assign(e);const t=this.specularNode||kC;kx.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}const aP=Qb(e=>{if(!1===e.geometry.hasAttribute("normal"))return ex(0);const t=wE.dFdx().abs().max(wE.dFdy().abs());return t.x.max(t.y).max(t.z)}),oP=Qb(e=>{const{roughness:t}=e,n=aP();let r=t.max(.0525);return r=r.add(n),r=r.min(1),r}),lP=Qb(({alpha:e,dotNL:t,dotNV:n})=>{const r=e.pow2(),i=t.mul(r.add(r.oneMinus().mul(n.pow2())).sqrt()),s=n.mul(r.add(r.oneMinus().mul(t.pow2())).sqrt());return gT(.5,i.add(s).max(VT))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),uP=Qb(({alphaT:e,alphaB:t,dotTV:n,dotBV:r,dotTL:i,dotBL:s,dotNV:a,dotNL:o})=>{const l=o.mul(lx(e.mul(n),t.mul(r),a).length()),u=a.mul(lx(e.mul(i),t.mul(s),o).length());return gT(.5,l.add(u)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),cP=Qb(({alpha:e,dotNH:t})=>{const n=e.pow2(),r=t.pow2().mul(n.oneMinus()).oneMinus();return n.div(r.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),hP=ex(1/Math.PI),AP=Qb(({alphaT:e,alphaB:t,dotNH:n,dotTH:r,dotBH:i})=>{const s=e.mul(t),a=lx(t.mul(r),e.mul(i),s.mul(n)),o=a.dot(a),l=s.div(o);return hP.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),dP=Qb(({lightDirection:e,f0:t,f90:n,roughness:r,f:i,normalView:s=EE,USE_IRIDESCENCE:a,USE_ANISOTROPY:o})=>{const l=r.pow2(),u=e.add(gE).normalize(),c=s.dot(e).clamp(),h=s.dot(gE).clamp(),A=s.dot(u).clamp(),d=gE.dot(u).clamp();let p,f,m=KN({f0:t,f90:n,dotVH:d});if(Ob(a)&&(m=Dx.mix(m,i)),Ob(o)){const t=Bx.dot(e),n=Bx.dot(gE),r=Bx.dot(u),i=Fx.dot(e),s=Fx.dot(gE),a=Fx.dot(u);p=uP({alphaT:Ux,alphaB:l,dotTV:n,dotBV:s,dotTL:t,dotBL:i,dotNV:h,dotNL:c}),f=AP({alphaT:Ux,alphaB:l,dotNH:A,dotTH:r,dotBH:a})}else p=lP({alpha:l,dotNL:c,dotNV:h}),f=cP({alpha:l,dotNH:A});return m.mul(p).mul(f)}),pP=new Uint16Array([11481,15204,11534,15171,11808,15015,12385,14843,12894,14716,13396,14600,13693,14483,13976,14366,14237,14171,14405,13961,14511,13770,14605,13598,14687,13444,14760,13305,14822,13066,14876,12857,14923,12675,14963,12517,14997,12379,15025,12230,15049,12023,15070,11843,15086,11687,15100,11551,15111,11433,15120,11330,15127,11217,15132,11060,15135,10922,15138,10801,15139,10695,15139,10600,13012,14923,13020,14917,13064,14886,13176,14800,13349,14666,13513,14526,13724,14398,13960,14230,14200,14020,14383,13827,14488,13651,14583,13491,14667,13348,14740,13132,14803,12908,14856,12713,14901,12542,14938,12394,14968,12241,14992,12017,15010,11822,15024,11654,15034,11507,15041,11380,15044,11269,15044,11081,15042,10913,15037,10764,15031,10635,15023,10520,15014,10419,15003,10330,13657,14676,13658,14673,13670,14660,13698,14622,13750,14547,13834,14442,13956,14317,14112,14093,14291,13889,14407,13704,14499,13538,14586,13389,14664,13201,14733,12966,14792,12758,14842,12577,14882,12418,14915,12272,14940,12033,14959,11826,14972,11646,14980,11490,14983,11355,14983,11212,14979,11008,14971,10830,14961,10675,14950,10540,14936,10420,14923,10315,14909,10204,14894,10041,14089,14460,14090,14459,14096,14452,14112,14431,14141,14388,14186,14305,14252,14130,14341,13941,14399,13756,14467,13585,14539,13430,14610,13272,14677,13026,14737,12808,14790,12617,14833,12449,14869,12303,14896,12065,14916,11845,14929,11655,14937,11490,14939,11347,14936,11184,14930,10970,14921,10783,14912,10621,14900,10480,14885,10356,14867,10247,14848,10062,14827,9894,14805,9745,14400,14208,14400,14206,14402,14198,14406,14174,14415,14122,14427,14035,14444,13913,14469,13767,14504,13613,14548,13463,14598,13324,14651,13082,14704,12858,14752,12658,14795,12483,14831,12330,14860,12106,14881,11875,14895,11675,14903,11501,14905,11351,14903,11178,14900,10953,14892,10757,14880,10589,14865,10442,14847,10313,14827,10162,14805,9965,14782,9792,14757,9642,14731,9507,14562,13883,14562,13883,14563,13877,14566,13862,14570,13830,14576,13773,14584,13689,14595,13582,14613,13461,14637,13336,14668,13120,14704,12897,14741,12695,14776,12516,14808,12358,14835,12150,14856,11910,14870,11701,14878,11519,14882,11361,14884,11187,14880,10951,14871,10748,14858,10572,14842,10418,14823,10286,14801,10099,14777,9897,14751,9722,14725,9567,14696,9430,14666,9309,14702,13604,14702,13604,14702,13600,14703,13591,14705,13570,14707,13533,14709,13477,14712,13400,14718,13305,14727,13106,14743,12907,14762,12716,14784,12539,14807,12380,14827,12190,14844,11943,14855,11727,14863,11539,14870,11376,14871,11204,14868,10960,14858,10748,14845,10565,14829,10406,14809,10269,14786,10058,14761,9852,14734,9671,14705,9512,14674,9374,14641,9253,14608,9076,14821,13366,14821,13365,14821,13364,14821,13358,14821,13344,14821,13320,14819,13252,14817,13145,14815,13011,14814,12858,14817,12698,14823,12539,14832,12389,14841,12214,14850,11968,14856,11750,14861,11558,14866,11390,14867,11226,14862,10972,14853,10754,14840,10565,14823,10401,14803,10259,14780,10032,14754,9820,14725,9635,14694,9473,14661,9333,14627,9203,14593,8988,14557,8798,14923,13014,14922,13014,14922,13012,14922,13004,14920,12987,14919,12957,14915,12907,14909,12834,14902,12738,14894,12623,14888,12498,14883,12370,14880,12203,14878,11970,14875,11759,14873,11569,14874,11401,14872,11243,14865,10986,14855,10762,14842,10568,14825,10401,14804,10255,14781,10017,14754,9799,14725,9611,14692,9445,14658,9301,14623,9139,14587,8920,14548,8729,14509,8562,15008,12672,15008,12672,15008,12671,15007,12667,15005,12656,15001,12637,14997,12605,14989,12556,14978,12490,14966,12407,14953,12313,14940,12136,14927,11934,14914,11742,14903,11563,14896,11401,14889,11247,14879,10992,14866,10767,14851,10570,14833,10400,14812,10252,14789,10007,14761,9784,14731,9592,14698,9424,14663,9279,14627,9088,14588,8868,14548,8676,14508,8508,14467,8360,15080,12386,15080,12386,15079,12385,15078,12383,15076,12378,15072,12367,15066,12347,15057,12315,15045,12253,15030,12138,15012,11998,14993,11845,14972,11685,14951,11530,14935,11383,14920,11228,14904,10981,14887,10762,14870,10567,14850,10397,14827,10248,14803,9997,14774,9771,14743,9578,14710,9407,14674,9259,14637,9048,14596,8826,14555,8632,14514,8464,14471,8317,14427,8182,15139,12008,15139,12008,15138,12008,15137,12007,15135,12003,15130,11990,15124,11969,15115,11929,15102,11872,15086,11794,15064,11693,15041,11581,15013,11459,14987,11336,14966,11170,14944,10944,14921,10738,14898,10552,14875,10387,14850,10239,14824,9983,14794,9758,14762,9563,14728,9392,14692,9244,14653,9014,14611,8791,14569,8597,14526,8427,14481,8281,14436,8110,14391,7885,15188,11617,15188,11617,15187,11617,15186,11618,15183,11617,15179,11612,15173,11601,15163,11581,15150,11546,15133,11495,15110,11427,15083,11346,15051,11246,15024,11057,14996,10868,14967,10687,14938,10517,14911,10362,14882,10206,14853,9956,14821,9737,14787,9543,14752,9375,14715,9228,14675,8980,14632,8760,14589,8565,14544,8395,14498,8248,14451,8049,14404,7824,14357,7630,15228,11298,15228,11298,15227,11299,15226,11301,15223,11303,15219,11302,15213,11299,15204,11290,15191,11271,15174,11217,15150,11129,15119,11015,15087,10886,15057,10744,15024,10599,14990,10455,14957,10318,14924,10143,14891,9911,14856,9701,14820,9516,14782,9352,14744,9200,14703,8946,14659,8725,14615,8533,14568,8366,14521,8220,14472,7992,14423,7770,14374,7578,14315,7408,15260,10819,15260,10819,15259,10822,15258,10826,15256,10832,15251,10836,15246,10841,15237,10838,15225,10821,15207,10788,15183,10734,15151,10660,15120,10571,15087,10469,15049,10359,15012,10249,14974,10041,14937,9837,14900,9647,14860,9475,14820,9320,14779,9147,14736,8902,14691,8688,14646,8499,14598,8335,14549,8189,14499,7940,14448,7720,14397,7529,14347,7363,14256,7218,15285,10410,15285,10411,15285,10413,15284,10418,15282,10425,15278,10434,15272,10442,15264,10449,15252,10445,15235,10433,15210,10403,15179,10358,15149,10301,15113,10218,15073,10059,15033,9894,14991,9726,14951,9565,14909,9413,14865,9273,14822,9073,14777,8845,14730,8641,14682,8459,14633,8300,14583,8129,14531,7883,14479,7670,14426,7482,14373,7321,14305,7176,14201,6939,15305,9939,15305,9940,15305,9945,15304,9955,15302,9967,15298,9989,15293,10010,15286,10033,15274,10044,15258,10045,15233,10022,15205,9975,15174,9903,15136,9808,15095,9697,15053,9578,15009,9451,14965,9327,14918,9198,14871,8973,14825,8766,14775,8579,14725,8408,14675,8259,14622,8058,14569,7821,14515,7615,14460,7435,14405,7276,14350,7108,14256,6866,14149,6653,15321,9444,15321,9445,15321,9448,15320,9458,15317,9470,15314,9490,15310,9515,15302,9540,15292,9562,15276,9579,15251,9577,15226,9559,15195,9519,15156,9463,15116,9389,15071,9304,15025,9208,14978,9023,14927,8838,14878,8661,14827,8496,14774,8344,14722,8206,14667,7973,14612,7749,14556,7555,14499,7382,14443,7229,14385,7025,14322,6791,14210,6588,14100,6409,15333,8920,15333,8921,15332,8927,15332,8943,15329,8965,15326,9002,15322,9048,15316,9106,15307,9162,15291,9204,15267,9221,15244,9221,15212,9196,15175,9134,15133,9043,15088,8930,15040,8801,14990,8665,14938,8526,14886,8391,14830,8261,14775,8087,14719,7866,14661,7664,14603,7482,14544,7322,14485,7178,14426,6936,14367,6713,14281,6517,14166,6348,14054,6198,15341,8360,15341,8361,15341,8366,15341,8379,15339,8399,15336,8431,15332,8473,15326,8527,15318,8585,15302,8632,15281,8670,15258,8690,15227,8690,15191,8664,15149,8612,15104,8543,15055,8456,15001,8360,14948,8259,14892,8122,14834,7923,14776,7734,14716,7558,14656,7397,14595,7250,14534,7070,14472,6835,14410,6628,14350,6443,14243,6283,14125,6135,14010,5889,15348,7715,15348,7717,15348,7725,15347,7745,15345,7780,15343,7836,15339,7905,15334,8e3,15326,8103,15310,8193,15293,8239,15270,8270,15240,8287,15204,8283,15163,8260,15118,8223,15067,8143,15014,8014,14958,7873,14899,7723,14839,7573,14778,7430,14715,7293,14652,7164,14588,6931,14524,6720,14460,6531,14396,6362,14330,6210,14207,6015,14086,5781,13969,5576,15352,7114,15352,7116,15352,7128,15352,7159,15350,7195,15348,7237,15345,7299,15340,7374,15332,7457,15317,7544,15301,7633,15280,7703,15251,7754,15216,7775,15176,7767,15131,7733,15079,7670,15026,7588,14967,7492,14906,7387,14844,7278,14779,7171,14714,6965,14648,6770,14581,6587,14515,6420,14448,6269,14382,6123,14299,5881,14172,5665,14049,5477,13929,5310,15355,6329,15355,6330,15355,6339,15355,6362,15353,6410,15351,6472,15349,6572,15344,6688,15337,6835,15323,6985,15309,7142,15287,7220,15260,7277,15226,7310,15188,7326,15142,7318,15090,7285,15036,7239,14976,7177,14914,7045,14849,6892,14782,6736,14714,6581,14645,6433,14576,6293,14506,6164,14438,5946,14369,5733,14270,5540,14140,5369,14014,5216,13892,5043,15357,5483,15357,5484,15357,5496,15357,5528,15356,5597,15354,5692,15351,5835,15347,6011,15339,6195,15328,6317,15314,6446,15293,6566,15268,6668,15235,6746,15197,6796,15152,6811,15101,6790,15046,6748,14985,6673,14921,6583,14854,6479,14785,6371,14714,6259,14643,6149,14571,5946,14499,5750,14428,5567,14358,5401,14242,5250,14109,5111,13980,4870,13856,4657,15359,4555,15359,4557,15358,4573,15358,4633,15357,4715,15355,4841,15353,5061,15349,5216,15342,5391,15331,5577,15318,5770,15299,5967,15274,6150,15243,6223,15206,6280,15161,6310,15111,6317,15055,6300,14994,6262,14928,6208,14860,6141,14788,5994,14715,5838,14641,5684,14566,5529,14492,5384,14418,5247,14346,5121,14216,4892,14079,4682,13948,4496,13822,4330,15359,3498,15359,3501,15359,3520,15359,3598,15358,3719,15356,3860,15355,4137,15351,4305,15344,4563,15334,4809,15321,5116,15303,5273,15280,5418,15250,5547,15214,5653,15170,5722,15120,5761,15064,5763,15002,5733,14935,5673,14865,5597,14792,5504,14716,5400,14640,5294,14563,5185,14486,5041,14410,4841,14335,4655,14191,4482,14051,4325,13918,4183,13790,4012,15360,2282,15360,2285,15360,2306,15360,2401,15359,2547,15357,2748,15355,3103,15352,3349,15345,3675,15336,4020,15324,4272,15307,4496,15285,4716,15255,4908,15220,5086,15178,5170,15128,5214,15072,5234,15010,5231,14943,5206,14871,5166,14796,5102,14718,4971,14639,4833,14559,4687,14480,4541,14402,4401,14315,4268,14167,4142,14025,3958,13888,3747,13759,3556,15360,923,15360,925,15360,946,15360,1052,15359,1214,15357,1494,15356,1892,15352,2274,15346,2663,15338,3099,15326,3393,15309,3679,15288,3980,15260,4183,15226,4325,15185,4437,15136,4517,15080,4570,15018,4591,14950,4581,14877,4545,14800,4485,14720,4411,14638,4325,14556,4231,14475,4136,14395,3988,14297,3803,14145,3628,13999,3465,13861,3314,13729,3177,15360,263,15360,264,15360,272,15360,325,15359,407,15358,548,15356,780,15352,1144,15347,1580,15339,2099,15328,2425,15312,2795,15292,3133,15264,3329,15232,3517,15191,3689,15143,3819,15088,3923,15025,3978,14956,3999,14882,3979,14804,3931,14722,3855,14639,3756,14554,3645,14470,3529,14388,3409,14279,3289,14124,3173,13975,3055,13834,2848,13701,2658,15360,49,15360,49,15360,52,15360,75,15359,111,15358,201,15356,283,15353,519,15348,726,15340,1045,15329,1415,15314,1795,15295,2173,15269,2410,15237,2649,15197,2866,15150,3054,15095,3140,15032,3196,14963,3228,14888,3236,14808,3224,14725,3191,14639,3146,14553,3088,14466,2976,14382,2836,14262,2692,14103,2549,13952,2409,13808,2278,13674,2154,15360,4,15360,4,15360,4,15360,13,15359,33,15358,59,15357,112,15353,199,15348,302,15341,456,15331,628,15316,827,15297,1082,15272,1332,15241,1601,15202,1851,15156,2069,15101,2172,15039,2256,14970,2314,14894,2348,14813,2358,14728,2344,14640,2311,14551,2263,14463,2203,14376,2133,14247,2059,14084,1915,13930,1761,13784,1609,13648,1464,15360,0,15360,0,15360,0,15360,3,15359,18,15358,26,15357,53,15354,80,15348,97,15341,165,15332,238,15318,326,15299,427,15275,529,15245,654,15207,771,15161,885,15108,994,15046,1089,14976,1170,14900,1229,14817,1266,14731,1284,14641,1282,14550,1260,14460,1223,14370,1174,14232,1116,14066,1050,13909,981,13761,910,13623,839]);let fP=null;const mP=Qb(({roughness:e,dotNV:t})=>{null===fP&&(fP=new Gi(pP,32,32,xe,ue),fP.minFilter=J,fP.magFilter=J,fP.wrapS=Q,fP.wrapT=Q,fP.generateMipmaps=!1,fP.needsUpdate=!0);const n=ix(e,t);return pM(fP,n).rg}),gP=Qb(({lightDirection:e,f0:t,f90:n,roughness:r,f:i,USE_IRIDESCENCE:s,USE_ANISOTROPY:a})=>{const o=dP({lightDirection:e,f0:t,f90:n,roughness:r,f:i,USE_IRIDESCENCE:s,USE_ANISOTROPY:a}),l=EE.dot(e).clamp(),u=EE.dot(gE).clamp(),c=mP({roughness:r,dotNV:u}),h=mP({roughness:r,dotNV:l}),A=t.mul(c.x).add(n.mul(c.y)),d=t.mul(h.x).add(n.mul(h.y)),p=c.x.add(c.y),f=h.x.add(h.y),m=ex(1).sub(p),g=ex(1).sub(f),_=t.add(t.oneMinus().mul(.047619)),v=A.mul(d).mul(_).div(ex(1).sub(m.mul(g).mul(_).mul(_)).add(VT)),y=m.mul(g),b=v.mul(y);return o.add(b)}),_P=Qb(e=>{const{dotNV:t,specularColor:n,specularF90:r,roughness:i}=e,s=mP({dotNV:t,roughness:i});return n.mul(s.x).add(r.mul(s.y))}),vP=Qb(({f:e,f90:t,dotVH:n})=>{const r=n.oneMinus().saturate(),i=r.mul(r),s=r.mul(i,i).clamp(0,.9999);return e.sub(lx(t).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),yP=Qb(({roughness:e,dotNH:t})=>{const n=e.pow2(),r=ex(1).div(n),i=t.pow2().oneMinus().max(.0078125);return ex(2).add(r).mul(i.pow(r.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),bP=Qb(({dotNV:e,dotNL:t})=>ex(1).div(ex(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),xP=Qb(({lightDirection:e})=>{const t=e.add(gE).normalize(),n=EE.dot(e).clamp(),r=EE.dot(gE).clamp(),i=EE.dot(t).clamp(),s=yP({roughness:Px,dotNH:i}),a=bP({dotNV:r,dotNL:n});return Nx.mul(s).mul(a)}),TP=Qb(({N:e,V:t,roughness:n})=>{const r=e.dot(t).saturate(),i=ix(n,r.oneMinus().sqrt());return i.assign(i.mul(.984375).add(.0078125)),i}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),SP=Qb(({f:e})=>{const t=e.length();return RS(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),wP=Qb(({v1:e,v2:t})=>{const n=e.dot(t),r=n.abs().toVar(),i=r.mul(.0145206).add(.4965155).mul(r).add(.8543985).toVar(),s=r.add(4.1616724).mul(r).add(3.417594).toVar(),a=i.div(s),o=n.greaterThan(0).select(a,RS(n.mul(n).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(a));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),MP=Qb(({N:e,V:t,P:n,mInv:r,p0:i,p1:s,p2:a,p3:o})=>{const l=s.sub(i).toVar(),u=o.sub(i).toVar(),c=l.cross(u),h=lx().toVar();return Kb(c.dot(n.sub(i)).greaterThanEqual(0),()=>{const l=t.sub(e.mul(t.dot(e))).normalize(),u=e.cross(l).negate(),c=r.mul(gx(l,u,e).transpose()).toVar(),A=c.mul(i.sub(n)).normalize().toVar(),d=c.mul(s.sub(n)).normalize().toVar(),p=c.mul(a.sub(n)).normalize().toVar(),f=c.mul(o.sub(n)).normalize().toVar(),m=lx(0).toVar();m.addAssign(wP({v1:A,v2:d})),m.addAssign(wP({v1:d,v2:p})),m.addAssign(wP({v1:p,v2:f})),m.addAssign(wP({v1:f,v2:A})),h.assign(lx(SP({f:m})))}),h}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),EP=1/6,CP=e=>mT(EP,mT(e,mT(e,e.negate().add(3)).sub(3)).add(1)),RP=e=>mT(EP,mT(e,mT(e,mT(3,e).sub(6))).add(4)),NP=e=>mT(EP,mT(e,mT(e,mT(-3,e).add(3)).add(3)).add(1)),PP=e=>mT(EP,OS(e,3)),DP=e=>CP(e).add(RP(e)),LP=e=>NP(e).add(PP(e)),IP=e=>pT(-1,RP(e).div(CP(e).add(RP(e)))),UP=e=>pT(1,PP(e).div(NP(e).add(PP(e)))),OP=(e,t,n)=>{const r=e.uvNode,i=mT(r,t.zw).add(.5),s=rS(i),a=aS(i),o=DP(a.x),l=LP(a.x),u=IP(a.x),c=UP(a.x),h=IP(a.y),A=UP(a.y),d=ix(s.x.add(u),s.y.add(h)).sub(.5).mul(t.xy),p=ix(s.x.add(c),s.y.add(h)).sub(.5).mul(t.xy),f=ix(s.x.add(u),s.y.add(A)).sub(.5).mul(t.xy),m=ix(s.x.add(c),s.y.add(A)).sub(.5).mul(t.xy),g=DP(a.y).mul(pT(o.mul(e.sample(d).level(n)),l.mul(e.sample(p).level(n)))),_=LP(a.y).mul(pT(o.mul(e.sample(f).level(n)),l.mul(e.sample(m).level(n))));return g.add(_)},BP=Qb(([e,t])=>{const n=ix(e.size(tx(t))),r=ix(e.size(tx(t.add(1)))),i=gT(1,n),s=gT(1,r),a=OP(e,Ax(i,n),rS(t)),o=OP(e,Ax(s,r),iS(t));return aS(t).mix(a,o)}),FP=Qb(([e,t])=>{const n=t.mul(cM(e));return BP(e,n)}),kP=Qb(([e,t,n,r,i])=>{const s=lx(WS(t.negate(),sS(e),gT(1,r))),a=lx(fS(i[0].xyz),fS(i[1].xyz),fS(i[2].xyz));return sS(s).mul(n.mul(a))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),qP=Qb(([e,t])=>e.mul(HS(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),VP=tN(),zP=tN(),GP=Qb(([e,t,n],{material:r})=>{const i=(1===r.side?VP:zP).sample(e),s=eS(EM.x).mul(qP(t,n));return BP(i,s)}),HP=Qb(([e,t,n])=>(Kb(n.notEqual(0),()=>{const r=JT(t).negate().div(n);return KT(r.negate().mul(e))}),lx(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),jP=Qb(([e,t,n,r,i,s,a,o,l,u,c,h,A,d,p])=>{let f,m;if(p){f=Ax().toVar(),m=lx().toVar();const i=c.sub(1).mul(p.mul(.025)),s=lx(c.sub(i),c,c.add(i));qR({start:0,end:3},({i:i})=>{const c=s.element(i),p=kP(e,t,h,c,o),g=a.add(p),_=u.mul(l.mul(Ax(g,1))),v=ix(_.xy.div(_.w)).toVar();v.addAssign(1),v.divAssign(2),v.assign(ix(v.x,v.y.oneMinus()));const y=GP(v,n,c);f.element(i).assign(y.element(i)),f.a.addAssign(y.a),m.element(i).assign(r.element(i).mul(HP(fS(p),A,d).element(i)))}),f.a.divAssign(3)}else{const i=kP(e,t,h,c,o),s=a.add(i),p=u.mul(l.mul(Ax(s,1))),g=ix(p.xy.div(p.w)).toVar();g.addAssign(1),g.divAssign(2),g.assign(ix(g.x,g.y.oneMinus())),f=GP(g,n,c),m=r.mul(HP(fS(i),A,d))}const g=m.rgb.mul(f.rgb),_=e.dot(t).clamp(),v=lx(_P({dotNV:_,specularColor:i,specularF90:s,roughness:n})),y=m.r.add(m.g,m.b).div(3);return Ax(v.oneMinus().mul(g),f.a.oneMinus().mul(y).oneMinus())}),WP=gx(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),XP=(e,t)=>e.sub(t).div(e.add(t)).pow2(),QP=Qb(({outsideIOR:e,eta2:t,cosTheta1:n,thinFilmThickness:r,baseF0:i})=>{const s=GS(e,t,XS(0,.03,r)),a=e.div(s).pow2().mul(n.pow2().oneMinus()).oneMinus();Kb(a.lessThan(0),()=>lx(1));const o=a.sqrt(),l=XP(s,e),u=KN({f0:l,f90:1,dotVH:n}),c=u.oneMinus(),h=s.lessThan(e).select(Math.PI,0),A=ex(Math.PI).sub(h),d=(e=>{const t=e.sqrt();return lx(1).add(t).div(lx(1).sub(t))})(i.clamp(0,.9999)),p=XP(d,s.toVec3()),f=KN({f0:p,f90:1,dotVH:o}),m=lx(d.x.lessThan(s).select(Math.PI,0),d.y.lessThan(s).select(Math.PI,0),d.z.lessThan(s).select(Math.PI,0)),g=s.mul(r,o,2),_=lx(A).add(m),v=u.mul(f).clamp(1e-5,.9999),y=v.sqrt(),b=c.pow2().mul(f).div(lx(1).sub(v)),x=u.add(b).toVar(),T=b.sub(c).toVar();return qR({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{T.mulAssign(y);const t=((e,t)=>{const n=e.mul(2*Math.PI*1e-9),r=lx(54856e-17,44201e-17,52481e-17),i=lx(1681e3,1795300,2208400),s=lx(43278e5,93046e5,66121e5),a=ex(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(n.mul(2239900).add(t.x).cos()).mul(n.pow2().mul(-45282e5).exp());let o=r.mul(s.mul(2*Math.PI).sqrt()).mul(i.mul(n).add(t).cos()).mul(n.pow2().negate().mul(s).exp());return o=lx(o.x.add(a),o.y,o.z).div(1.0685e-7),WP.mul(o)})(ex(e).mul(g),ex(e).mul(_)).mul(2);x.addAssign(T.mul(t))}),x.max(lx(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),$P=Qb(({normal:e,viewDir:t,roughness:n})=>{const r=e.dot(t).saturate(),i=n.pow2(),s=rw(n.lessThan(.25),ex(-339.2).mul(i).add(ex(161.4).mul(n)).sub(25.9),ex(-8.48).mul(i).add(ex(14.3).mul(n)).sub(9.95)),a=rw(n.lessThan(.25),ex(44).mul(i).sub(ex(23.7).mul(n)).add(3.26),ex(1.97).mul(i).sub(ex(3.27).mul(n)).add(.72));return rw(n.lessThan(.25),0,ex(.1).mul(n).sub(.025)).add(s.mul(r).add(a).exp()).mul(1/Math.PI).saturate()}),YP=lx(.04),KP=ex(1);class ZP extends XN{constructor(e=!1,t=!1,n=!1,r=!1,i=!1,s=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=i,this.dispersion=s,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=lx().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=lx().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=lx().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=lx().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=lx().toVar("sheenSpecularIndirect")),!0===this.iridescence){const e=EE.dot(gE).clamp();this.iridescenceFresnel=QP({outsideIOR:ex(1),eta2:Lx,cosTheta1:e,thinFilmThickness:Ix,baseF0:kx}),this.iridescenceF0=vP({f:this.iridescenceFresnel,f90:1,dotVH:e})}if(!0===this.transmission){const t=pE,n=zM.sub(pE).normalize(),r=CE,i=e.context;i.backdrop=jP(r,n,Mx,Sx,kx,qx,t,eE,kM,BM,Wx,Qx,Yx,$x,this.dispersion?Kx:null),i.backdropAlpha=Xx,Sx.a.mulAssign(GS(1,i.backdrop.a,Xx))}super.start(e)}computeMultiscattering(e,t,n){const r=EE.dot(gE).clamp(),i=mP({roughness:Mx,dotNV:r}),s=this.iridescenceF0?Dx.mix(kx,this.iridescenceF0):kx,a=s.mul(i.x).add(n.mul(i.y)),o=i.x.add(i.y).oneMinus(),l=s.add(s.oneMinus().mul(.047619)),u=a.mul(l).div(o.mul(l).oneMinus());e.addAssign(a),t.addAssign(u.mul(o))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){const r=EE.dot(e).clamp().mul(t);if(!0===this.sheen&&this.sheenSpecularDirect.addAssign(r.mul(xP({lightDirection:e}))),!0===this.clearcoat){const n=RE.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(n.mul(dP({lightDirection:e,f0:YP,f90:KP,roughness:Rx,normalView:RE})))}n.directDiffuse.addAssign(r.mul(ZN({diffuseColor:Sx.rgb}))),n.directSpecular.addAssign(r.mul(gP({lightDirection:e,f0:kx,f90:1,roughness:Mx,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:i,ltc_1:s,ltc_2:a}){const o=t.add(n).sub(r),l=t.sub(n).sub(r),u=t.sub(n).add(r),c=t.add(n).add(r),h=EE,A=gE,d=mE.toVar(),p=TP({N:h,V:A,roughness:Mx}),f=s.sample(p).toVar(),m=a.sample(p).toVar(),g=gx(lx(f.x,0,f.y),lx(0,1,0),lx(f.z,0,f.w)).toVar(),_=kx.mul(m.x).add(kx.oneMinus().mul(m.y)).toVar();i.directSpecular.addAssign(e.mul(_).mul(MP({N:h,V:A,P:d,mInv:g,p0:o,p1:l,p2:u,p3:c}))),i.directDiffuse.addAssign(e.mul(Sx).mul(MP({N:h,V:A,P:d,mInv:gx(1,0,0,0,1,0,0,0,1),p0:o,p1:l,p2:u,p3:c})))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){const{irradiance:t,reflectedLight:n}=e.context;n.indirectDiffuse.addAssign(t.mul(ZN({diffuseColor:Sx})))}indirectSpecular(e){const{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(n.mul(Nx,$P({normal:EE,viewDir:gE,roughness:Px}))),!0===this.clearcoat){const e=RE.dot(gE).clamp(),t=_P({dotNV:e,specularColor:YP,specularF90:KP,roughness:Rx});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(t))}const i=lx().toVar("singleScattering"),s=lx().toVar("multiScattering"),a=n.mul(1/Math.PI);this.computeMultiscattering(i,s,qx);const o=i.add(s),l=Sx.mul(o.r.max(o.g).max(o.b).oneMinus());r.indirectSpecular.addAssign(t.mul(i)),r.indirectSpecular.addAssign(s.mul(a)),r.indirectDiffuse.addAssign(l.mul(a))}ambientOcclusion(e){const{ambientOcclusion:t,reflectedLight:n}=e.context,r=EE.dot(gE).clamp().add(t),i=Mx.mul(-16).oneMinus().negate().exp2(),s=t.sub(r.pow(i).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(s)}finish({context:e}){const{outgoingLight:t}=e;if(!0===this.clearcoat){const e=RE.dot(gE).clamp(),n=KN({dotVH:e,f0:YP,f90:KP}),r=t.mul(Cx.mul(n).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(Cx));t.assign(r)}if(!0===this.sheen){const e=Nx.r.max(Nx.g).max(Nx.b).mul(.157).oneMinus(),n=t.mul(e).add(this.sheenSpecularDirect,this.sheenSpecularIndirect);t.assign(n)}}}const JP=ex(1),eD=ex(-2),tD=ex(.8),nD=ex(-1),rD=ex(.4),iD=ex(2),sD=ex(.305),aD=ex(3),oD=ex(.21),lD=ex(4),uD=ex(4),cD=ex(16),hD=Qb(([e])=>{const t=lx(dS(e)).toVar(),n=ex(-1).toVar();return Kb(t.x.greaterThan(t.z),()=>{Kb(t.x.greaterThan(t.y),()=>{n.assign(rw(e.x.greaterThan(0),0,3))}).Else(()=>{n.assign(rw(e.y.greaterThan(0),1,4))})}).Else(()=>{Kb(t.z.greaterThan(t.y),()=>{n.assign(rw(e.z.greaterThan(0),2,5))}).Else(()=>{n.assign(rw(e.y.greaterThan(0),1,4))})}),n}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),AD=Qb(([e,t])=>{const n=ix().toVar();return Kb(t.equal(0),()=>{n.assign(ix(e.z,e.y).div(dS(e.x)))}).ElseIf(t.equal(1),()=>{n.assign(ix(e.x.negate(),e.z.negate()).div(dS(e.y)))}).ElseIf(t.equal(2),()=>{n.assign(ix(e.x.negate(),e.y).div(dS(e.z)))}).ElseIf(t.equal(3),()=>{n.assign(ix(e.z.negate(),e.y).div(dS(e.x)))}).ElseIf(t.equal(4),()=>{n.assign(ix(e.x.negate(),e.z).div(dS(e.y)))}).Else(()=>{n.assign(ix(e.x,e.y).div(dS(e.z)))}),mT(.5,n.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),dD=Qb(([e])=>{const t=ex(0).toVar();return Kb(e.greaterThanEqual(tD),()=>{t.assign(JP.sub(e).mul(nD.sub(eD)).div(JP.sub(tD)).add(eD))}).ElseIf(e.greaterThanEqual(rD),()=>{t.assign(tD.sub(e).mul(iD.sub(nD)).div(tD.sub(rD)).add(nD))}).ElseIf(e.greaterThanEqual(sD),()=>{t.assign(rD.sub(e).mul(aD.sub(iD)).div(rD.sub(sD)).add(iD))}).ElseIf(e.greaterThanEqual(oD),()=>{t.assign(sD.sub(e).mul(lD.sub(aD)).div(sD.sub(oD)).add(aD))}).Else(()=>{t.assign(ex(-2).mul(eS(mT(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),pD=Qb(([e,t])=>{const n=e.toVar();n.assign(mT(2,n).sub(1));const r=lx(n,1).toVar();return Kb(t.equal(0),()=>{r.assign(r.zyx)}).ElseIf(t.equal(1),()=>{r.assign(r.xzy),r.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{r.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{r.assign(r.zyx),r.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{r.assign(r.xzy),r.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{r.z.mulAssign(-1)}),r}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),fD=Qb(([e,t,n,r,i,s])=>{const a=ex(n),o=lx(t),l=HS(dD(a),eD,s),u=aS(l),c=rS(l),h=lx(mD(e,o,c,r,i,s)).toVar();return Kb(u.notEqual(0),()=>{const t=lx(mD(e,o,c.add(1),r,i,s)).toVar();h.assign(GS(h,t,u))}),h}),mD=Qb(([e,t,n,r,i,s])=>{const a=ex(n).toVar(),o=lx(t),l=ex(hD(o)).toVar(),u=ex(RS(uD.sub(a),0)).toVar();a.assign(RS(a,uD));const c=ex(ZT(a)).toVar(),h=ix(AD(o,l).mul(c.sub(2)).add(1)).toVar();return Kb(l.greaterThan(2),()=>{h.y.addAssign(c),l.subAssign(3)}),h.x.addAssign(l.mul(c)),h.x.addAssign(u.mul(mT(3,cD))),h.y.addAssign(mT(4,ZT(s).sub(c))),h.x.mulAssign(r),h.y.mulAssign(i),e.sample(h).grad(ix(),ix())}),gD=Qb(({envMap:e,mipInt:t,outputDirection:n,theta:r,axis:i,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const l=lS(r),u=n.mul(l).add(i.cross(n).mul(oS(r))).add(i.mul(i.dot(n).mul(l.oneMinus())));return mD(e,u,t,s,a,o)}),_D=Qb(({n:e,latitudinal:t,poleAxis:n,outputDirection:r,weights:i,samples:s,dTheta:a,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h})=>{const A=lx(rw(t,n,US(n,r))).toVar();Kb(A.equal(lx(0)),()=>{A.assign(lx(r.z,0,r.x.negate()))}),A.assign(sS(A));const d=lx().toVar();return d.addAssign(i.element(0).mul(gD({theta:0,axis:A,outputDirection:r,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h}))),qR({start:tx(1),end:e},({i:e})=>{Kb(e.greaterThanEqual(s),()=>{VR()});const t=ex(a.mul(ex(e))).toVar();d.addAssign(i.element(e).mul(gD({theta:t.mul(-1),axis:A,outputDirection:r,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h}))),d.addAssign(i.element(e).mul(gD({theta:t,axis:A,outputDirection:r,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:h})))}),Ax(d,1)}),vD=Qb(([e])=>{const t=nx(e).toVar();return t.assign(t.shiftLeft(nx(16)).bitOr(t.shiftRight(nx(16)))),t.assign(t.bitAnd(nx(1431655765)).shiftLeft(nx(1)).bitOr(t.bitAnd(nx(2863311530)).shiftRight(nx(1)))),t.assign(t.bitAnd(nx(858993459)).shiftLeft(nx(2)).bitOr(t.bitAnd(nx(3435973836)).shiftRight(nx(2)))),t.assign(t.bitAnd(nx(252645135)).shiftLeft(nx(4)).bitOr(t.bitAnd(nx(4042322160)).shiftRight(nx(4)))),t.assign(t.bitAnd(nx(16711935)).shiftLeft(nx(8)).bitOr(t.bitAnd(nx(4278255360)).shiftRight(nx(8)))),ex(t).mul(2.3283064365386963e-10)}),yD=Qb(([e,t])=>ix(ex(e).div(ex(t)),vD(e))),bD=Qb(([e,t,n])=>{const r=lx(t).toVar(),i=ex(n),s=i.mul(i).toVar(),a=sS(lx(s.mul(r.x),s.mul(r.y),r.z)).toVar(),o=a.x.mul(a.x).add(a.y.mul(a.y)),l=rw(o.greaterThan(0),lx(a.y.negate(),a.x,0).div(tS(o)),lx(1,0,0)).toVar(),u=US(a,l).toVar(),c=tS(e.x),h=mT(2,3.14159265359).mul(e.y),A=c.mul(lS(h)).toVar(),d=c.mul(oS(h)).toVar(),p=mT(.5,a.z.add(1));d.assign(p.oneMinus().mul(tS(A.mul(A).oneMinus())).add(p.mul(d)));const f=l.mul(A).add(u.mul(d)).add(a.mul(tS(RS(0,A.mul(A).add(d.mul(d)).oneMinus()))));return sS(lx(s.mul(f.x),s.mul(f.y),RS(0,f.z)))}),xD=Qb(({roughness:e,mipInt:t,envMap:n,N_immutable:r,GGX_SAMPLES:i,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:o})=>{const l=lx(r).toVar(),u=lx(0).toVar(),c=ex(0).toVar();return Kb(e.lessThan(.001),()=>{u.assign(mD(n,l,t,s,a,o))}).Else(()=>{const r=rw(dS(l.z).lessThan(.999),lx(0,0,1),lx(1,0,0)),h=sS(US(r,l)).toVar(),A=US(l,h).toVar();qR({start:nx(0),end:i},({i:r})=>{const d=yD(r,i),p=bD(d,lx(0,0,1),e),f=sS(h.mul(p.x).add(A.mul(p.y)).add(l.mul(p.z))),m=sS(f.mul(IS(l,f).mul(2)).sub(l)),g=RS(IS(l,m),0);Kb(g.greaterThan(0),()=>{const e=mD(n,m,t,s,a,o);u.addAssign(e.mul(g)),c.addAssign(g)})}),Kb(c.greaterThan(0),()=>{u.assign(u.div(c))})}),Ax(u,1)}),TD=[.125,.215,.35,.446,.526,.582],SD=20,wD=new ao(-1,1,1,-1,0,1),MD=new Ni(90,1),ED=new Or;let CD=null,RD=0,ND=0;const PD=new Wt,DD=new WeakMap,LD=[3,1,5,0,4,2],ID=pD(aM(),sM("faceIndex")).normalize(),UD=lx(ID.x,ID.y,ID.z);class OD{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,i={}){const{size:s=256,position:a=PD,renderTarget:o=null}=i;if(this._setSize(s),!1===this._hasInitialized){Rt('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');const s=o||this._allocateTarget();return i.renderTarget=s,this.fromSceneAsync(e,t,n,r,i),s}CD=this._renderer.getRenderTarget(),RD=this._renderer.getActiveCubeFace(),ND=this._renderer.getActiveMipmapLevel();const l=o||this._allocateTarget();return l.depthBuffer=!0,this._init(l),this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}async fromSceneAsync(e,t=0,n=.1,r=100,i={}){return Pt('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,i)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){Rt('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromEquirectangularAsync(e,n),n}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return Pt('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){Rt("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);const n=t||this._allocateTarget();return this.fromCubemapAsync(e,t),n}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return Pt('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=qD(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=VD(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===z||e.mapping===G?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=TD[a-e+4-1]:0===a&&(o=0),n.push(o);const l=1/(s-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],A=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*A),_=new Float32Array(f*d*A),v=new Float32Array(m*d*A);for(let e=0;e2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0],i=LD[e];g.set(r,p*d*i),_.set(h,f*d*i);const s=[i,i,i,i,i,i];v.set(s,m*d*i)}const y=new ai;y.setAttribute("position",new Qr(g,p)),y.setAttribute("uv",new Qr(_,f)),y.setAttribute("faceIndex",new Qr(v,m)),r.push(new _i(y,null)),i>4&&i--}return{lodMeshes:r,sizeLods:t,sigmas:n}}(t)),this._blurMaterial=function(e,t,n){const r=yM(new Array(SD).fill(0)),i=sT(new Wt(0,1,0)),s=sT(0),a=ex(SD),o=sT(0),l=sT(1),u=pM(),c=sT(0),h=ex(1/t),A=ex(1/n),d=ex(e),p={n:a,latitudinal:o,weights:r,poleAxis:i,outputDirection:UD,dTheta:s,samples:l,envMap:u,mipInt:c,CUBEUV_TEXEL_WIDTH:h,CUBEUV_TEXEL_HEIGHT:A,CUBEUV_MAX_MIP:d},f=kD("blur");return f.fragmentNode=_D({...p,latitudinal:o.equal(1)}),DD.set(f,p),f}(t,e.width,e.height)}}async _compileMaterial(e){const t=new _i(new ai,e);await this._renderer.compile(t,wD)}_sceneToCubeUV(e,t,n,r,i){const s=MD;s.near=t,s.far=n;const a=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],l=this._renderer,u=l.autoClear;l.getClearColor(ED),l.autoClear=!1,null===this._backgroundBox&&(this._backgroundBox=new _i(new yi,new qr({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));const c=this._backgroundBox,h=c.material;let A=!1;const d=e.background;d?d.isColor&&(h.color.copy(d),e.background=null,A=!0):(h.color.copy(ED),A=!0),l.setRenderTarget(r),l.clear(),A&&l.render(c,s);for(let t=0;t<6;t++){const n=t%3;0===n?(s.up.set(0,a[t],0),s.position.set(i.x,i.y,i.z),s.lookAt(i.x+o[t],i.y,i.z)):1===n?(s.up.set(0,0,a[t]),s.position.set(i.x,i.y,i.z),s.lookAt(i.x,i.y+o[t],i.z)):(s.up.set(0,a[t],0),s.position.set(i.x,i.y,i.z),s.lookAt(i.x,i.y,i.z+o[t]));const u=this._cubeSize;FD(r,n*u,t>2?u:0,u,u),l.render(e,s)}l.autoClear=u,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===z||e.mapping===G;r?null===this._cubemapMaterial&&(this._cubemapMaterial=qD(e)):null===this._equirectMaterial&&(this._equirectMaterial=VD(e));const i=r?this._cubemapMaterial:this._equirectMaterial;i.fragmentNode.value=e;const s=this._lodMeshes[0];s.material=i;const a=this._cubeSize;FD(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(s,wD)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let t=1;th-4?n-h+4:0),p=4*(this._cubeSize-A);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=c,o.mipInt.value=h-t,FD(i,d,p,3*A,2*A),r.setRenderTarget(i),r.render(a,wD),i.texture.frame=(i.texture.frame||0)+1,o.envMap.value=i.texture,o.roughness.value=0,o.mipInt.value=h-n,FD(e,d,p,3*A,2*A),r.setRenderTarget(e),r.render(a,wD)}_blur(e,t,n,r,i){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,r,"latitudinal",i),this._halfBlur(s,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,s,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&Nt("blur direction must be either latitudinal or longitudinal!");const u=this._lodMeshes[r];u.material=l;const c=DD.get(l),h=this._sizeLods[n]-1,A=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,d=i/A,p=isFinite(i)?1+Math.floor(3*d):SD;p>SD&&Rt(`sigmaRadians, ${i}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const f=[];let m=0;for(let e=0;eg-4?r-g+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(t),o.render(u,wD)}}function BD(e,t){const n=new dn(e,t,{magFilter:J,minFilter:J,generateMipmaps:!1,type:ue,format:ge,colorSpace:st});return n.texture.mapping=W,n.texture.name="PMREM.cubeUv",n.texture.isPMREMTexture=!0,n.scissorTest=!0,n}function FD(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function kD(e){const t=new EN;return t.depthTest=!1,t.depthWrite=!1,t.blending=0,t.name=`PMREM_${e}`,t}function qD(e){const t=kD("cubemap");return t.fragmentNode=XE(e,UD),t}function VD(e){const t=kD("equirect");return t.fragmentNode=pM(e,FN(UD),0),t}const zD=new WeakMap;function GD(e,t,n){const r=function(e){let t=zD.get(e);void 0===t&&(t=new WeakMap,zD.set(e,t));return t}(t);let i=r.get(e);if((void 0!==i?i.pmremVersion:-1)!==e.pmremVersion){const t=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;let t=0;const n=6;for(let r=0;r0}(t))return null;i=n.fromEquirectangular(e,i)}i.pmremVersion=e.pmremVersion,r.set(e,i)}return i.texture}class HD extends Zy{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;const r=new hn;r.isRenderTargetTexture=!0,this._texture=pM(r),this._width=sT(0),this._height=sT(0),this._maxMip=sT(0),this.updateBeforeType=Vy.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=function(e){const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem;const n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(t=!0===r.isPMREMTexture?r:GD(r,e.renderer,this._generator),null!==t&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){null===this._generator&&(this._generator=new OD(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this)),t=kE.mul(lx(t.x,t.y.negate(),t.z));let n=this.levelNode;return null===n&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),fD(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}const jD=Gb(HD).setParameterLength(1,3),WD=new WeakMap;class XD extends XR{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){const{material:t}=e;let n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){const e=n.isTextureNode?n.value:t[n.property];let r=WD.get(e);void 0===r&&(r=jD(e),WD.set(e,r)),n=r}const r=!0===t.useAnisotropy||t.anisotropy>0?wC:EE,i=n.context(QD(Mx,r)).mul(FE),s=n.context($D(CE)).mul(Math.PI).mul(FE),a=Vw(i),o=Vw(s);e.context.radiance.addAssign(a),e.context.iblIrradiance.addAssign(o);const l=e.context.lightingModel.clearcoatRadiance;if(l){const e=n.context(QD(Rx,RE)).mul(FE),t=Vw(e);l.addAssign(t)}}}const QD=(e,t)=>{let n=null;return{getUV:()=>(null===n&&(n=gE.negate().reflect(t),n=kS(e).mix(n,t).normalize(),n=n.transformDirection(kM)),n),getTextureLevel:()=>e}},$D=e=>({getUV:()=>e,getTextureLevel:()=>ex(1)}),YD=new Na;class KD extends EN{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(YD),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new XD(t):null}setupLightingModel(){return new ZP}setupSpecular(){const e=GS(lx(.04),Sx.rgb,Ex);kx.assign(e),qx.assign(1)}setupVariants(){const e=this.metalnessNode?ex(this.metalnessNode):jC;Ex.assign(e);let t=this.roughnessNode?ex(this.roughnessNode):HC;t=oP({roughness:t}),Mx.assign(t),this.setupSpecular(),Sx.assign(Ax(Sx.rgb.mul(e.oneMinus()),Sx.a))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}const ZD=new Pa;class JD extends KD{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(ZD),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){const e=this.iorNode?ex(this.iorNode):sR;Wx.assign(e),kx.assign(GS(CS(BS(Wx.sub(1).div(Wx.add(1))).mul(VC),lx(1)).mul(qC),Sx.rgb,Ex)),qx.assign(GS(qC,1,Ex))}setupLightingModel(){return new ZP(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){const e=this.clearcoatNode?ex(this.clearcoatNode):XC,t=this.clearcoatRoughnessNode?ex(this.clearcoatRoughnessNode):QC;Cx.assign(e),Rx.assign(oP({roughness:t}))}if(this.useSheen){const e=this.sheenNode?lx(this.sheenNode):KC,t=this.sheenRoughnessNode?ex(this.sheenRoughnessNode):ZC;Nx.assign(e),Px.assign(t)}if(this.useIridescence){const e=this.iridescenceNode?ex(this.iridescenceNode):eR,t=this.iridescenceIORNode?ex(this.iridescenceIORNode):tR,n=this.iridescenceThicknessNode?ex(this.iridescenceThicknessNode):nR;Dx.assign(e),Lx.assign(t),Ix.assign(n)}if(this.useAnisotropy){const e=(this.anisotropyNode?ix(this.anisotropyNode):JC).toVar();Ox.assign(e.length()),Kb(Ox.equal(0),()=>{e.assign(ix(1,0))}).Else(()=>{e.divAssign(ix(Ox)),Ox.assign(Ox.saturate())}),Ux.assign(Ox.pow2().mix(Mx.pow2(),1)),Bx.assign(TC[0].mul(e.x).add(TC[1].mul(e.y))),Fx.assign(TC[1].mul(e.x).sub(TC[0].mul(e.y)))}if(this.useTransmission){const e=this.transmissionNode?ex(this.transmissionNode):rR,t=this.thicknessNode?ex(this.thicknessNode):iR,n=this.attenuationDistanceNode?ex(this.attenuationDistanceNode):aR,r=this.attenuationColorNode?lx(this.attenuationColorNode):oR;if(Xx.assign(e),Qx.assign(t),$x.assign(n),Yx.assign(r),this.useDispersion){const e=this.dispersionNode?ex(this.dispersionNode):pR;Kx.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?lx(this.clearcoatNormalNode):$C}setup(e){e.context.setupClearcoatNormal=()=>fw(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dispersionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}const eL=Qb(({normal:e,lightDirection:t,builder:n})=>{const r=e.dot(t),i=ix(r.mul(.5).add(.5),0);if(n.material.gradientMap){const e=JE("gradientMap","texture").context({getUV:()=>i});return lx(e.r)}{const e=i.fwidth().mul(.5);return GS(lx(.7),lx(1),XS(ex(.7).sub(e.x),ex(.7).add(e.x),i.x))}});class tL extends XN{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){const i=eL({normal:xE,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(i.mul(ZN({diffuseColor:Sx.rgb})))}indirect(e){const{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(ZN({diffuseColor:Sx}))),r.indirectDiffuse.mulAssign(t)}}const nL=new La;class rL extends EN{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(nL),this.setValues(e)}setupLightingModel(){return new tL}}const iL=Qb(()=>{const e=lx(gE.z,0,gE.x.negate()).normalize(),t=gE.cross(e);return ix(e.dot(EE),t.dot(EE)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),sL=new Fa;class aL extends EN{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(sL),this.setValues(e)}setupVariants(e){const t=iL;let n;n=e.material.matcap?JE("matcap","texture").context({getUV:()=>t}):lx(GS(.2,.8,t.y)),Sx.rgb.mulAssign(n.rgb)}}class oL extends Zy{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:n}=this;if("vec2"===this.getNodeType(e)){const e=t.cos(),r=t.sin();return mx(e,r,r.negate(),e).mul(n)}{const e=t,r=_x(Ax(1,0,0,0),Ax(0,lS(e.x),oS(e.x).negate(),0),Ax(0,oS(e.x),lS(e.x),0),Ax(0,0,0,1)),i=_x(Ax(lS(e.y),0,oS(e.y),0),Ax(0,1,0,0),Ax(oS(e.y).negate(),0,lS(e.y),0),Ax(0,0,0,1)),s=_x(Ax(lS(e.z),oS(e.z).negate(),0,0),Ax(oS(e.z),lS(e.z),0,0),Ax(0,0,1,0),Ax(0,0,0,1));return r.mul(i).mul(s).mul(Ax(n,1)).xyz}}}const lL=Gb(oL).setParameterLength(2),uL=new zi;class cL extends EN{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(uL),this.setValues(e)}setupPositionView(e){const{object:t,camera:n}=e,{positionNode:r,rotationNode:i,scaleNode:s,sizeAttenuation:a}=this,o=oE.mul(lx(r||0));let l=ix(eE[0].xyz.length(),eE[1].xyz.length());null!==s&&(l=l.mul(ix(s))),n.isPerspectiveCamera&&!1===a&&(l=l.mul(o.z.negate()));let u=hE.xy;if(t.center&&!0===t.center.isVector2){const e=((e,t,n)=>kb(new Mw(e,t,n)))("center","vec2",t);u=u.sub(e.sub(.5))}u=u.mul(l);const c=ex(i||YC),h=lL(u,c);return Ax(o.xy.add(h),o.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}const hL=new fs,AL=new Ht;class dL extends cL{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(hL),this.setValues(e)}setupPositionView(){const{positionNode:e}=this;return oE.mul(lx(e||AE)).xyz}setupVertexSprite(e){const{material:t,camera:n}=e,{rotationNode:r,scaleNode:i,sizeNode:s,sizeAttenuation:a}=this;let o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let l=null!==s?ix(s):dR;l=l.mul(wM),n.isPerspectiveCamera&&!0===a&&(l=l.mul(pL.div(mE.z.negate()))),i&&i.isNode&&(l=l.mul(ix(i)));let u=hE.xy;if(r&&r.isNode){const e=ex(r);u=lL(u,e)}return u=u.mul(l),u=u.div(NM.div(2)),u=u.mul(o.w),o=o.add(Ax(u,0,0)),o}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}const pL=sT(1).onFrameUpdate(function({renderer:e}){const t=e.getSize(AL);this.value=.5*t.y});class fL extends XN{constructor(){super(),this.shadowNode=ex(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Sx.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Sx.rgb)}}const mL=new Ra;class gL extends EN{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(mL),this.setValues(e)}setupLightingModel(){return new fL}}xx("vec3"),xx("vec3"),xx("vec3");class _L{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context="undefined"!=typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){const e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),null!==this._animationLoop&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class vL{constructor(){this.weakMap=new WeakMap}get(e){let t=this.weakMap;for(let n=0;n{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(const t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;const e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,i={};for(const s of e){let e;if(s.node&&s.node.attribute?e=s.node.attribute:(e=t.getAttribute(s.name),i[s.name]=e.version),void 0===e)continue;n.push(e);const a=e.isInterleavedBufferAttribute?e.data:e;r.add(a)}return this.attributes=n,this.attributesId=i,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){const{object:e,material:t,geometry:n,group:r,drawRange:i}=this,s=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),o=null!==a;let l=1;if(!0===n.isInstancedBufferGeometry?l=n.instanceCount:void 0!==e.count&&(l=Math.max(0,e.count)),0===l)return null;if(s.instanceCount=l,!0===e.isBatchedMesh)return s;let u=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(u=2);let c=i.start*u,h=(i.start+i.count)*u;null!==r&&(c=Math.max(c,r.start*u),h=Math.min(h,(r.start+r.count)*u));const A=n.attributes.position;let d=1/0;o?d=a.count:null!=A&&(d=A.count),c=Math.max(c,0),h=Math.min(h,d);const p=h-c;return p<0||p===1/0?null:(s.vertexCount=p,s.firstVertex=c,s)}getGeometryCacheKey(){const{geometry:e}=this;let t="";for(const n of Object.keys(e.attributes).sort()){const r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(const n of Object.keys(e.morphAttributes).sort()){const r=e.morphAttributes[n];t+="morph-"+n+",";for(let e=0,n=r.length;e1||Array.isArray(e.morphTargetInfluences))&&(r+=e.uuid+","),r+=e.receiveShadow+",",wy(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){const e=this.attributesId;for(const t in e){const n=this.geometry.getAttribute(t);if(void 0===n||e[t]!==n.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=Ey(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Ey(e,1)),e=Ey(e,this.camera.id),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}const xL=[];class TL{constructor(e,t,n,r,i,s){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=i,this.info=s,this.chainMaps={}}get(e,t,n,r,i,s,a,o){const l=this.getChainMap(o);xL[0]=e,xL[1]=t,xL[2]=s,xL[3]=i;let u=l.get(xL);return void 0===u?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,i,s,a,o),l.set(xL,u)):(u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,i,s,a,o)):u.version=t.version)),xL.length=0,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new vL)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,i,s,a,o,l,u,c){const h=this.getChainMap(c),A=new bL(e,t,n,r,i,s,a,o,l,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),h.delete(A.getChainArray())},A}}class SL{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}const wL=1,ML=2,EL=3,CL=4,RL=16;class NL extends SL{constructor(e){super(),this.backend=e}delete(e){const t=super.delete(e);return null!==t&&this.backend.destroyAttribute(e),t}update(e,t){const n=this.get(e);if(void 0===n.version)t===wL?this.backend.createAttribute(e):t===ML?this.backend.createIndexAttribute(e):t===EL?this.backend.createStorageAttribute(e):t===CL&&this.backend.createIndirectStorageAttribute(e),n.version=this._getBufferAttribute(e).version;else{const t=this._getBufferAttribute(e);(n.version{this.info.memory.geometries--;const r=t.index,i=e.getAttributes();null!==r&&this.attributes.delete(r);for(const e of i)this.attributes.delete(e);const s=this.wireframes.get(t);void 0!==s&&this.attributes.delete(s),t.removeEventListener("dispose",n),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",n),this._geometryDisposeListeners.set(t,n)}updateAttributes(e){const t=e.getAttributes();for(const e of t)e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute?this.updateAttribute(e,EL):this.updateAttribute(e,wL);const n=this.getIndex(e);null!==n&&this.updateAttribute(n,ML);const r=e.geometry.indirect;null!==r&&this.updateAttribute(r,CL)}updateAttribute(e,t){const n=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndex(e){const{geometry:t,material:n}=e;let r=t.index;if(!0===n.wireframe){const e=this.wireframes;let n=e.get(t);void 0===n?(n=DL(t),e.set(t,n)):n.version!==PL(t)&&(this.attributes.delete(n),n=DL(t),e.set(t,n)),r=n}return r}dispose(){for(const[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class IL{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0}}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):Nt("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class UL{constructor(e){this.cacheKey=e,this.usedTimes=0}}class OL extends UL{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}}class BL extends UL{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let FL=0;class kL{constructor(e,t,n,r=null,i=null){this.id=FL++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=i,this.usedTimes=0}}class qL extends SL{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){const{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){const i=r.pipeline;i&&(i.usedTimes--,i.computeProgram.usedTimes--);const s=this.nodes.getForCompute(e);let a=this.programs.compute.get(s.computeShader);void 0===a&&(i&&0===i.computeProgram.usedTimes&&this._releaseProgram(i.computeProgram),a=new kL(s.computeShader,"compute",e.name,s.transforms,s.nodeAttributes),this.programs.compute.set(s.computeShader,a),n.createProgram(a));const o=this._getComputeCacheKey(e,a);let l=this.caches.get(o);void 0===l&&(i&&0===i.usedTimes&&this._releasePipeline(i),l=this._getComputePipeline(e,a,o,t)),l.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=l}return r.pipeline}getForRender(e,t=null){const{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){const i=r.pipeline;i&&(i.usedTimes--,i.vertexProgram.usedTimes--,i.fragmentProgram.usedTimes--);const s=e.getNodeBuilderState(),a=e.material?e.material.name:"";let o=this.programs.vertex.get(s.vertexShader);void 0===o&&(i&&0===i.vertexProgram.usedTimes&&this._releaseProgram(i.vertexProgram),o=new kL(s.vertexShader,"vertex",a),this.programs.vertex.set(s.vertexShader,o),n.createProgram(o));let l=this.programs.fragment.get(s.fragmentShader);void 0===l&&(i&&0===i.fragmentProgram.usedTimes&&this._releaseProgram(i.fragmentProgram),l=new kL(s.fragmentShader,"fragment",a),this.programs.fragment.set(s.fragmentShader,l),n.createProgram(l));const u=this._getRenderCacheKey(e,o,l);let c=this.caches.get(u);void 0===c?(i&&0===i.usedTimes&&this._releasePipeline(i),c=this._getRenderPipeline(e,o,l,u,t)):e.pipeline=c,c.usedTimes++,o.usedTimes++,l.usedTimes++,r.pipeline=c}return r.pipeline}delete(e){const t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let i=this.caches.get(n);return void 0===i&&(i=new BL(n,t),this.caches.set(n,i),this.backend.createComputePipeline(i,r)),i}_getRenderPipeline(e,t,n,r,i){r=r||this._getRenderCacheKey(e,t,n);let s=this.caches.get(r);return void 0===s&&(s=new OL(r,t,n),this.caches.set(r,s),e.pipeline=s,this.backend.createRenderPipeline(e,i)),s}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){const t=e.code,n=e.stage;this.programs[n].delete(t)}_needsComputeUpdate(e){const t=this.get(e);return void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class VL extends SL{constructor(e,t,n,r,i,s){super(),this.backend=e,this.textures=n,this.pipelines=i,this.attributes=r,this.nodes=t,this.info=s,this.pipelines.bindings=this}getForRender(e){const t=e.getBindings();for(const e of t){const n=this.get(e);void 0===n.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),n.bindGroup=e)}return t}getForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t){const n=this.get(e);void 0===n.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),n.bindGroup=e)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){const t=this.nodes.getForCompute(e).bindings;for(const e of t)this.delete(e)}deleteForRender(e){const t=e.getBindings();for(const e of t)this.delete(e)}_updateBindings(e){for(const t of e)this._update(t,e)}_init(e){for(const t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){const e=t.attribute,n=e.isIndirectStorageBufferAttribute?CL:EL;this.attributes.update(e,n)}}_update(e,t){const{backend:n}=this;let r=!1,i=!0,s=0,a=0;for(const t of e.bindings){if(t.isNodeUniformsGroup){if(!1===this.nodes.updateGroup(t))continue}if(t.isStorageBuffer){const e=t.attribute,n=e.isIndirectStorageBufferAttribute?CL:EL;this.attributes.update(e,n)}if(t.isUniformBuffer){t.update()&&n.updateBinding(t)}else if(t.isSampledTexture){const e=t.update(),o=t.texture,l=this.textures.get(o);e&&(this.textures.updateTexture(o),t.generation!==l.generation&&(t.generation=l.generation,r=!0,i=!1));if(void 0!==n.get(o).externalTexture||l.isDefaultTexture?i=!1:(s=10*s+o.id,a+=o.version),!0===o.isStorageTexture&&!0===o.mipmapsAutoUpdate){const e=this.get(o);!0===t.store?e.needsMipmap=!0:this.textures.needsMipmaps(o)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(o),e.needsMipmap=!1)}}else if(t.isSampler){if(t.update()){const e=this.textures.updateSampler(t.texture);t.samplerKey!==e&&(t.samplerKey=e,r=!0,i=!1)}}}!0===r&&this.backend.updateBindings(e,t,i?s:0,a)}}function zL(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function GL(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function HL(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&2===e.side&&!1===e.forceSinglePass}class jL{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,n),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,i,s,a){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:i,group:s,clippingContext:a},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=n,o.groupOrder=r,o.renderOrder=e.renderOrder,o.z=i,o.group=s,o.clippingContext=a),this.renderItemsIndex++,o}push(e,t,n,r,i,s,a){const o=this.getNextRenderItem(e,t,n,r,i,s,a);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===n.transparent||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(HL(n)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,n,r,i,s,a){const o=this.getNextRenderItem(e,t,n,r,i,s,a);!0===n.transparent||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(HL(n)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||zL),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||GL),this.transparent.length>1&&this.transparent.sort(t||GL)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e>t,l=a.height>>t;let u=e.depthTexture||i[t];const c=!0===e.depthBuffer||!0===e.stencilBuffer;let h=!1;void 0===u&&c&&(u=new xs,u.format=e.stencilBuffer?ve:_e,u.type=e.stencilBuffer?Ae:oe,u.image.width=o,u.image.height=l,u.image.depth=a.depth,u.renderTarget=e,u.isArrayTexture=!0===e.multiview&&a.depth>1,i[t]=u),n.width===a.width&&a.height===n.height||(h=!0,u&&(u.needsUpdate=!0,u.image.width=o,u.image.height=l,u.image.depth=u.isArrayTexture?u.image.depth:1)),n.width=a.width,n.height=a.height,n.textures=s,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(h=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);const A={sampleCount:r};if(!0!==e.isXRRenderTarget){for(let e=0;e{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){const n=this.get(e);if(!0===n.initialized&&n.version===e.version)return;const r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,i=this.backend;if(r&&!0===n.initialized&&i.destroyTexture(e),e.isFramebufferTexture){const t=this.renderer.getRenderTarget();e.type=t?t.texture.type:ne}const{width:s,height:a,depth:o}=this.getSize(e);if(t.width=s,t.height=a,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,s,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||!0===e.isStorageTexture||!0===e.isExternalTexture)i.createTexture(e,t),n.generation=e.version;else if(e.version>0){const r=e.image;if(void 0===r)Rt("Renderer: Texture marked for update but image is undefined.");else if(!1===r.complete)Rt("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){const n=[];for(const t of e.images)n.push(t);t.images=n}else t.image=r;void 0!==n.isDefaultTexture&&!0!==n.isDefaultTexture||(i.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),!0===e.source.dataReady&&i.updateTexture(e,t);const s=!0===e.isStorageTexture&&!1===e.mipmapsAutoUpdate;t.needsMipmaps&&0===e.mipmaps.length&&!s&&i.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else i.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;!0!==n.initialized&&(n.initialized=!0,n.generation=e.version,this.info.memory.textures++,e.isVideoTexture&&en.getTransfer(e.colorSpace)!==ot&&Rt("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=tI){let n=e.images?e.images[0]:e.image;return n?(void 0!==n.image&&(n=n.image),"undefined"!=typeof HTMLVideoElement&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):"undefined"!=typeof VideoFrame&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return r=e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyRenderTarget(e){if(!0===this.has(e)){const t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let e=0;e=2)for(let n=0;n"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})),this.name=t,this.isStructLayoutNode=!0}getLength(){const e=Float32Array.BYTES_PER_ELEMENT;let t=0;for(const n of this.membersLayout){const r=n.type,i=Ly(r)*e,s=t%8,a=s%Iy(r),o=s+a;t+=a,0!==o&&8-oe.name===t);return n?n.type:"void"}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class lI extends $y{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}generate(e){const t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class uI extends $y{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(e){const t=e.getNodeProperties(this);if(void 0===t.membersLayout){const n=this.members,r=[];for(let t=0;t{const t=e.toUint().mul(747796405).add(2891336453),n=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return n.shiftRight(22).bitXor(n).toFloat().mul(1/2**32)}),gI=(e,t)=>OS(mT(4,e.mul(fT(1,e))),t),_I=Qb(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),vI=Qb(([e])=>lx(_I(e.z.add(_I(e.y.mul(1)))),_I(e.z.add(_I(e.x.mul(1)))),_I(e.y.add(_I(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),yI=Qb(([e,t,n])=>{const r=lx(e).toVar(),i=ex(1.4).toVar(),s=ex(0).toVar(),a=lx(r).toVar();return qR({start:ex(0),end:ex(3),type:"float",condition:"<="},()=>{const e=lx(vI(a.mul(2))).toVar();r.addAssign(e.add(n.mul(ex(.1).mul(t)))),a.mulAssign(1.8),i.mulAssign(1.5),r.mulAssign(1.2);const o=ex(_I(r.z.add(_I(r.x.add(_I(r.y)))))).toVar();s.addAssign(o.div(i)),a.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class bI extends $y{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}getNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){const t=this.parametersNodes;let n=this._candidateFn;if(null===n){let r=null,i=-1;for(const n of this.functionNodes){const s=n.shaderNode.layout;if(null===s)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const a=s.inputs;if(t.length===a.length){let s=0;for(let n=0;ni&&(r=n,i=s)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}const xI=Gb(bI),TI=e=>(...t)=>xI(e,...t),SI=sT(0).setGroup(nT).onRenderUpdate(e=>e.time),wI=sT(0).setGroup(nT).onRenderUpdate(e=>e.deltaTime),MI=sT(0,"uint").setGroup(nT).onRenderUpdate(e=>e.frameId),EI=Qb(([e,t,n=ix(.5)])=>lL(e.sub(n),t).add(n)),CI=Qb(([e,t,n=ix(.5)])=>{const r=e.sub(n),i=r.dot(r),s=i.mul(i).mul(t);return e.add(r.mul(s))}),RI=Qb(({position:e=null,horizontal:t=!0,vertical:n=!1})=>{let r;null!==e?(r=eE.toVar(),r[3][0]=e.x,r[3][1]=e.y,r[3][2]=e.z):r=eE;const i=kM.mul(r);return Ob(t)&&(i[0][0]=eE[0].length(),i[0][1]=0,i[0][2]=0),Ob(n)&&(i[1][0]=0,i[1][1]=eE[1].length(),i[1][2]=0),i[2][0]=0,i[2][1]=0,i[2][2]=1,BM.mul(i).mul(AE)}),NI=Qb(([e=null])=>{const t=AN();return AN(iN(e)).sub(t).lessThan(0).select(MM,e)});class PI extends $y{static get type(){return"SpriteSheetUVNode"}constructor(e,t=aM(),n=ex(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=n}setup(){const{frameNode:e,uvNode:t,countNode:n}=this,{width:r,height:i}=n,s=e.mod(r.mul(i)).floor(),a=s.mod(r),o=i.sub(s.add(1).div(r).ceil()),l=n.reciprocal(),u=ix(a,o);return t.add(u).mul(l)}}const DI=Gb(PI).setParameterLength(3),LI=Qb(([e,t=null,n=null,r=ex(1),i=AE,s=TE])=>{let a=s.abs().normalize();a=a.div(a.dot(lx(1)));const o=i.yz.mul(r),l=i.zx.mul(r),u=i.xy.mul(r),c=e.value,h=null!==t?t.value:c,A=null!==n?n.value:c,d=pM(c,o).mul(a.x),p=pM(h,l).mul(a.y),f=pM(A,u).mul(a.z);return pT(d,p,f)}),II=new Qi,UI=new Wt,OI=new Wt,BI=new Wt,FI=new Hn,kI=new Wt(0,0,-1),qI=new An,VI=new Wt,zI=new Wt,GI=new An,HI=new Ht,jI=new dn,WI=MM.flipX();jI.depthTexture=new xs(1,1);let XI=!1;class QI extends AM{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||jI.texture,WI),this._reflectorBaseNode=e.reflector||new $I(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=kb(new QI({defaultTexture:jI.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class $I extends $y{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:n=new gr,resolutionScale:r=1,generateMipmaps:i=!1,bounces:s=!0,depth:a=!1,samples:o=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,void 0!==t.resolution&&(Pt('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=i,this.bounces=s,this.depth=a,this.samples=o,this.updateBeforeType=s?Vy.RENDER:Vy.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){const n=this.resolutionScale;t.getDrawingBufferSize(HI),e.setSize(Math.round(HI.width*n),Math.round(HI.height*n))}setup(e){return this._updateResolution(jI,e.renderer),super.setup(e)}dispose(){super.dispose();for(const e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new dn(0,0,{type:ue,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=1008,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new xs),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&XI)return!1;XI=!0;const{scene:t,camera:n,renderer:r,material:i}=e,{target:s}=this,a=this.getVirtualCamera(n),o=this.getRenderTarget(a);r.getDrawingBufferSize(HI),this._updateResolution(o,r),OI.setFromMatrixPosition(s.matrixWorld),BI.setFromMatrixPosition(n.matrixWorld),FI.extractRotation(s.matrixWorld),UI.set(0,0,1),UI.applyMatrix4(FI),VI.subVectors(OI,BI);let l=!1;if(!0===VI.dot(UI)>0&&!1===this.forceUpdate){if(!1===this.hasOutput)return void(XI=!1);l=!0}VI.reflect(UI).negate(),VI.add(OI),FI.extractRotation(n.matrixWorld),kI.set(0,0,-1),kI.applyMatrix4(FI),kI.add(BI),zI.subVectors(OI,kI),zI.reflect(UI).negate(),zI.add(OI),a.coordinateSystem=n.coordinateSystem,a.position.copy(VI),a.up.set(0,1,0),a.up.applyMatrix4(FI),a.up.reflect(UI),a.lookAt(zI),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),II.setFromNormalAndCoplanarPoint(UI,OI),II.applyMatrix4(a.matrixWorldInverse),qI.set(II.normal.x,II.normal.y,II.normal.z,II.constant);const u=a.projectionMatrix;GI.x=(Math.sign(qI.x)+u.elements[8])/u.elements[0],GI.y=(Math.sign(qI.y)+u.elements[9])/u.elements[5],GI.z=-1,GI.w=(1+u.elements[10])/u.elements[14],qI.multiplyScalar(1/qI.dot(GI));u.elements[2]=qI.x,u.elements[6]=qI.y,u.elements[10]=r.coordinateSystem===bt?qI.z-0:qI.z+1-0,u.elements[14]=qI.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),i.visible=!1;const c=r.getRenderTarget(),h=r.getMRT(),A=r.autoClear;r.setMRT(null),r.setRenderTarget(o),r.autoClear=!0;const d=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",l?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=d,r.setMRT(h),r.setRenderTarget(c),r.autoClear=A,i.visible=!0,XI=!1,this.forceUpdate=!1}get resolution(){return Pt('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Pt('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}const YI=new ao(-1,1,1,-1,0,1);class KI extends ai{constructor(e=!1){super();const t=!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Zr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Zr(t,2))}}const ZI=new KI;class JI extends _i{constructor(e=null){super(ZI,e),this.camera=YI,this.isQuadMesh=!0}async renderAsync(e){Pt('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,YI)}render(e){e.render(this,YI)}}const eU=new Ht;class tU extends AM{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:ue}){const i=new dn(t,n,r);super(i.texture,aM()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.pixelRatio=1,this.renderTarget=i,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new JI(new EN),this.updateBeforeType=Vy.RENDER}get autoResize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const n=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){const t=e.getPixelRatio(),n=e.getSize(eU),r=Math.floor(n.width*t),i=Math.floor(n.height*t);r===this.renderTarget.width&&i===this.renderTarget.height||(this.renderTarget.setSize(r,i),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;const n=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(n)}clone(){const e=new AM(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const nU=(e,...t)=>kb(new tU(kb(e),...t)),rU=Qb(([e,t,n],r)=>{let i;r.renderer.coordinateSystem===bt?(e=ix(e.x,e.y.oneMinus()).mul(2).sub(1),i=Ax(lx(e,t),1)):i=Ax(lx(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);const s=Ax(n.mul(i));return s.xyz.div(s.w)}),iU=Qb(([e,t])=>{const n=t.mul(Ax(e,1)),r=n.xy.div(n.w).mul(.5).add(.5).toVar();return ix(r.x,r.y.oneMinus())}),sU=Qb(([e,t,n])=>{const r=lM(fM(t)),i=sx(e.mul(r)).toVar(),s=fM(t,i).toVar(),a=fM(t,i.sub(sx(2,0))).toVar(),o=fM(t,i.sub(sx(1,0))).toVar(),l=fM(t,i.add(sx(1,0))).toVar(),u=fM(t,i.add(sx(2,0))).toVar(),c=fM(t,i.add(sx(0,2))).toVar(),h=fM(t,i.add(sx(0,1))).toVar(),A=fM(t,i.sub(sx(0,1))).toVar(),d=fM(t,i.sub(sx(0,2))).toVar(),p=dS(fT(ex(2).mul(o).sub(a),s)).toVar(),f=dS(fT(ex(2).mul(l).sub(u),s)).toVar(),m=dS(fT(ex(2).mul(h).sub(c),s)).toVar(),g=dS(fT(ex(2).mul(A).sub(d),s)).toVar(),_=rU(e,s,n).toVar(),v=p.lessThan(f).select(_.sub(rU(e.sub(ix(ex(1).div(r.x),0)),o,n)),_.negate().add(rU(e.add(ix(ex(1).div(r.x),0)),l,n))),y=m.lessThan(g).select(_.sub(rU(e.add(ix(0,ex(1).div(r.y))),h,n)),_.negate().add(rU(e.sub(ix(0,ex(1).div(r.y))),A,n)));return sS(US(v,y))}),aU=Qb(([e])=>aS(ex(52.9829189).mul(aS(IS(e,ix(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]});class oU extends $y{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(aM())}sample(e){return this.callback(e)}}class lU extends $y{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===lU.OBJECT?this.updateType=Vy.OBJECT:e===lU.MATERIAL?this.updateType=Vy.RENDER:e===lU.BEFORE_OBJECT?this.updateBeforeType=Vy.OBJECT:e===lU.BEFORE_MATERIAL&&(this.updateBeforeType=Vy.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}lU.OBJECT="object",lU.MATERIAL="material",lU.BEFORE_OBJECT="beforeObject",lU.BEFORE_MATERIAL="beforeMaterial";const uU=(e,t)=>kb(new lU(e,t)).toStack();class cU extends Hi{constructor(e,t,n=Float32Array){super(ArrayBuffer.isView(e)?e:new n(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class hU extends Qr{constructor(e,t,n=Float32Array){super(ArrayBuffer.isView(e)?e:new n(e*t),t),this.isStorageBufferAttribute=!0}}class AU extends $y{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const dU=Hb(AU),pU=new er,fU=new Hn;class mU extends $y{static get type(){return"SceneNode"}constructor(e=mU.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,n=null!==this.scene?this.scene:e.scene;let r;return t===mU.BACKGROUND_BLURRINESS?r=YE("backgroundBlurriness","float",n):t===mU.BACKGROUND_INTENSITY?r=YE("backgroundIntensity","float",n):t===mU.BACKGROUND_ROTATION?r=sT("mat4").setName("backgroundRotation").setGroup(nT).onRenderUpdate(()=>{const e=n.background;return null!==e&&e.isTexture&&300!==e.mapping?(pU.copy(n.backgroundRotation),pU.x*=-1,pU.y*=-1,pU.z*=-1,fU.makeRotationFromEuler(pU)):fU.identity(),fU}):Nt("SceneNode: Unknown scope:",t),r}}mU.BACKGROUND_BLURRINESS="backgroundBlurriness",mU.BACKGROUND_INTENSITY="backgroundIntensity",mU.BACKGROUND_ROTATION="backgroundRotation";const gU=Hb(mU,mU.BACKGROUND_BLURRINESS),_U=Hb(mU,mU.BACKGROUND_INTENSITY),vU=Hb(mU,mU.BACKGROUND_ROTATION);class yU extends AM{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=zy.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){let n;return n=null!==this.storeNode?this.generateStore(e):super.generate(e,t),n}toReadWrite(){return this.setAccess(zy.READ_WRITE)}toReadOnly(){return this.setAccess(zy.READ_ONLY)}toWriteOnly(){return this.setAccess(zy.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:i}=t,s=super.generate(e,"property"),a=n.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),o=r.build(e,"vec4"),l=i?i.build(e,"int"):null,u=e.generateTextureStore(e,s,a,l,o);e.addLineFlowCode(u,this)}clone(){const e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e}}const bU=Gb(yU).setParameterLength(1,3),xU=Qb(({texture:e,uv:t})=>{const n=1e-4,r=lx().toVar();return Kb(t.x.lessThan(n),()=>{r.assign(lx(1,0,0))}).ElseIf(t.y.lessThan(n),()=>{r.assign(lx(0,1,0))}).ElseIf(t.z.lessThan(n),()=>{r.assign(lx(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{r.assign(lx(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{r.assign(lx(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{r.assign(lx(0,0,-1))}).Else(()=>{const n=.01,i=e.sample(t.add(lx(-.01,0,0))).r.sub(e.sample(t.add(lx(n,0,0))).r),s=e.sample(t.add(lx(0,-.01,0))).r.sub(e.sample(t.add(lx(0,n,0))).r),a=e.sample(t.add(lx(0,0,-.01))).r.sub(e.sample(t.add(lx(0,0,n))).r);r.assign(lx(i,s,a))}),r.normalize()});class TU extends AM{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return lx(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const n=this.value;return!e.isFlipY()||!0!==n.isRenderTargetTexture&&!0!==n.isFramebufferTexture||(t=this.sampler?t.flipY():t.setY(tx(lM(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return xU({texture:this,uv:e})}}const SU=Gb(TU).setParameterLength(1,3);class wU extends $E{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}const MU=new WeakMap;class EU extends Zy{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=Vy.OBJECT,this.updateAfterType=Vy.OBJECT,this.previousModelWorldMatrix=sT(new Hn),this.previousProjectionMatrix=sT(new Hn).setGroup(nT),this.previousCameraViewMatrix=sT(new Hn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){const r=RU(n);this.previousModelWorldMatrix.value.copy(r);const i=CU(t);i.frameId!==e&&(i.frameId=e,void 0===i.previousProjectionMatrix?(i.previousProjectionMatrix=new Hn,i.previousCameraViewMatrix=new Hn,i.currentProjectionMatrix=new Hn,i.currentCameraViewMatrix=new Hn,i.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),i.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}updateAfter({object:e}){RU(e).copy(e.matrixWorld)}setup(){const e=null===this.projectionMatrix?BM:sT(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(oE).mul(AE),r=this.previousProjectionMatrix.mul(t).mul(dE),i=n.xy.div(n.w),s=r.xy.div(r.w);return fT(i,s)}}function CU(e){let t=MU.get(e);return void 0===t&&(t={},MU.set(e,t)),t}function RU(e,t=0){const n=CU(e);let r=n[t];return void 0===r&&(n[t]=r=new Hn,n[t].copy(e.matrixWorld)),r}const NU=Hb(EU),PU=Qb(([e])=>UU(e.rgb)),DU=Qb(([e,t=ex(1)])=>t.mix(UU(e.rgb),e.rgb)),LU=Qb(([e,t=ex(1)])=>{const n=pT(e.r,e.g,e.b).div(3),r=e.r.max(e.g.max(e.b)),i=r.sub(n).mul(t).mul(-3);return GS(e.rgb,r,i)}),IU=Qb(([e,t=ex(1)])=>{const n=lx(.57735,.57735,.57735),r=t.cos();return lx(e.rgb.mul(r).add(n.cross(e.rgb).mul(t.sin()).add(n.mul(IS(n,e.rgb).mul(r.oneMinus())))))}),UU=(e,t=lx(en.getLuminanceCoefficients(new Wt)))=>IS(e,t),OU=Qb(([e,t=lx(1),n=lx(0),r=lx(1),i=ex(1),s=lx(en.getLuminanceCoefficients(new Wt,st))])=>{const a=e.rgb.dot(lx(s)),o=RS(e.rgb.mul(t).add(n),0).toVar(),l=o.pow(r).toVar();return Kb(o.r.greaterThan(0),()=>{o.r.assign(l.r)}),Kb(o.g.greaterThan(0),()=>{o.g.assign(l.g)}),Kb(o.b.greaterThan(0),()=>{o.b.assign(l.b)}),o.assign(a.add(o.sub(a).mul(i))),Ax(o.rgb,e.a)});class BU extends Zy{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const FU=Gb(BU).setParameterLength(2),kU=new Ht;class qU extends AM{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class VU extends qU{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){const e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class zU extends Zy{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;const i=new xs;i.isRenderTargetTexture=!0,i.name="depth";const s=new dn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:ue,...r});s.texture.name="output",s.depthTexture=i,this.renderTarget=s,this._textures={output:s.texture,depth:i},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=sT(0),this._cameraFar=sT(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=Vy.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Rt("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Rt("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(void 0===t){t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(void 0!==t){const n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&(t=kb(new VU(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),t=kb(new VU(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){const n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=lN(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){const n=this._cameraNear,r=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=aN(i,n,r)}return t}async compileAsync(e){const t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getColorBufferType(),this.scope===zU.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:n}=this;let r,i;const s=t.getOutputRenderTarget();s&&!0===s.isXRRenderTarget?(i=1,r=t.xr.getCamera(),t.xr.updateCamera(r),kU.set(s.width,s.height)):(r=this.camera,i=t.getPixelRatio(),t.getSize(kU)),this._pixelRatio=i,this.setSize(kU.width,kU.height);const a=t.getRenderTarget(),o=t.getMRT(),l=t.autoClear,u=r.layers.mask;this._cameraNear.value=r.near,this._cameraFar.value=r.far,null!==this._layers&&(r.layers.mask=this._layers.mask);for(const e in this._previousTextures)this.toggleTexture(e);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0;const c=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=c,t.setRenderTarget(a),t.setMRT(o),t.autoClear=l,r.layers.mask=u}setSize(e,t){this._width=e,this._height=t;const n=Math.floor(this._width*this._pixelRatio*this._resolutionScale),r=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(n,r),null!==this._scissor&&this.renderTarget.scissor.copy(this._scissor),null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,n,r){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new An),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r),this._scissor.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setViewport(e,t,n,r){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new An),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r),this._viewport.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}zU.COLOR="color",zU.DEPTH="depth";class GU extends zU{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,i){super(zU.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=i,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){const{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((e,n,r,i,s,a,o,l)=>{if((s.isMeshToonMaterial||s.isMeshToonNodeMaterial)&&!1===s.wireframe){const u=this._getOutlineMaterial(s);t.renderObject(e,n,r,i,u,a,o,l)}t.renderObject(e,n,r,i,s,a,o,l)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){const e=new EN;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=1;const t=TE.negate(),n=BM.mul(oE),r=ex(1),i=n.mul(Ax(AE,1)),s=n.mul(Ax(AE.add(t),1)),a=sS(i.sub(s));return e.vertexNode=i.add(a.mul(this.thicknessNode).mul(i.w).mul(r)),e.colorNode=Ax(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const HU=Qb(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),jU=Qb(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),WU=Qb(([e,t])=>{const n=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),r=e.mul(e.mul(6.2).add(1.7)).add(.06);return n.div(r).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),XU=Qb(([e])=>{const t=e.mul(e.add(.0245786)).sub(90537e-9),n=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(n)}),QU=Qb(([e,t])=>{const n=gx(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),r=gx(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=n.mul(e),e=XU(e),(e=r.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),$U=gx(lx(1.6605,-.1246,-.0182),lx(-.5876,1.1329,-.1006),lx(-.0728,-.0083,1.1187)),YU=gx(lx(.6274,.0691,.0164),lx(.3293,.9195,.088),lx(.0433,.0113,.8956)),KU=Qb(([e])=>{const t=lx(e).toVar(),n=lx(t.mul(t)).toVar(),r=lx(n.mul(n)).toVar();return ex(15.5).mul(r.mul(n)).sub(mT(40.14,r.mul(t))).add(mT(31.96,r).sub(mT(6.868,n.mul(t))).add(mT(.4298,n).add(mT(.1191,t).sub(.00232))))}),ZU=Qb(([e,t])=>{const n=lx(e).toVar(),r=gx(lx(.856627153315983,.137318972929847,.11189821299995),lx(.0951212405381588,.761241990602591,.0767994186031903),lx(.0482516061458583,.101439036467562,.811302368396859)),i=gx(lx(1.1271005818144368,-.1413297634984383,-.14132976349843826),lx(-.11060664309660323,1.157823702216272,-.11060664309660294),lx(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=ex(-12.47393),a=ex(4.026069);return n.mulAssign(t),n.assign(YU.mul(n)),n.assign(r.mul(n)),n.assign(RS(n,1e-10)),n.assign(eS(n)),n.assign(n.sub(s).div(a.sub(s))),n.assign(HS(n,0,1)),n.assign(KU(n)),n.assign(i.mul(n)),n.assign(OS(RS(lx(0),n),lx(2.2))),n.assign($U.mul(n)),n.assign(HS(n,0,1)),n}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),JU=Qb(([e,t])=>{const n=ex(.76),r=ex(.15);e=e.mul(t);const i=CS(e.r,CS(e.g,e.b)),s=rw(i.lessThan(.08),i.sub(mT(6.25,i.mul(i))),.04);e.subAssign(s);const a=RS(e.r,RS(e.g,e.b));Kb(a.lessThan(n),()=>e);const o=fT(1,n),l=fT(1,o.mul(o).div(a.add(o.sub(n))));e.mulAssign(l.div(a));const u=fT(1,gT(1,r.mul(a.sub(l)).add(1)));return GS(e,lx(l),u)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class eO extends $y{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const n of t)n.build(e);const n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const tO=Gb(eO).setParameterLength(1,3);class nO extends eO{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}getNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){const n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let n=t.nodeFunction;return void 0===n&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);const n=this.getNodeFunction(e),r=n.name,i=n.type,s=e.getCodeFromNode(this,i);""!==r&&(s.name=r);const a=e.getPropertyName(s),o=this.getNodeFunction(e).getCode(a);return s.code=o+"\n","property"===t?a:e.format(`${a}()`,i,t)}}const rO=(e,t=[],n="")=>{for(let e=0;er.call(...e);return i.functionNode=r,i};class iO extends $y{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new Dt,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return null!==this.outputType}set value(e){this._value!==e&&(this._cache&&"URL"===this.inputType&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&null===this._cache&&"URL"===this.inputType&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&null!==e.value&&void 0!==e.value&&(("URL"===this.inputType||"String"===this.inputType)&&"string"==typeof e.value||"Number"===this.inputType&&"number"==typeof e.value||"Vector2"===this.inputType&&e.value.isVector2||"Vector3"===this.inputType&&e.value.isVector3||"Vector4"===this.inputType&&e.value.isVector4||"Color"===this.inputType&&e.value.isColor||"Matrix3"===this.inputType&&e.value.isMatrix3||"Matrix4"===this.inputType&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:ex()}serialize(e){super.serialize(e),null!==this.value?"ArrayBuffer"===this.inputType?e.value=Fy(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;null!==e.value&&(t="ArrayBuffer"===e.inputType?ky(e.value):"Texture"===e.inputType?e.meta.textures[e.value]:e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const sO=Gb(iO).setParameterLength(1);class aO extends Map{get(e,t=null,...n){if(this.has(e))return super.get(e);if(null!==t){const r=t(...n);return this.set(e,r),r}}}class oO{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const lO=new aO;class uO extends $y{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new aO,this._output=sO(null),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const n=this._outputs;return void 0===n[e]?n[e]=sO(t):n[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):void 0===n[e]?(n[e]=sO(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const n=this.getObject()[e];if("function"==typeof n)return n(...t)}async callAsync(e,...t){const n=this.getObject()[e];if("function"==typeof n)return"AsyncFunction"===n.constructor.name?await n(...t):n(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){null!==e?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),null!==this._object)return this._object;const e=new oO(this),t=lO.get("THREE"),n=lO.get("TSL"),r=this.getMethod(),i=[e,this._local,lO,()=>this.refresh(),(e,t)=>this.setOutput(e,t),t,n];this._object=r(...i);const s=this._object.layout;if(s&&(!1===s.cache&&this._local.clear(),this._output.outputType=s.outputType||null,Array.isArray(s.elements)))for(const e of s.elements){const t=e.id||e.name;e.inputType&&(void 0===this.getParameter(t)&&this.setParameter(t,null),this.getParameter(t).inputType=e.inputType),e.outputType&&(void 0===this.getOutput(t)&&this.setOutput(t,null),this.getOutput(t).outputType=e.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const e in this.parameters){let t=this.parameters[e];t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:ex()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),null!==this._method)return this._method;const e=["layout","init","main","dispose"].join(", "),t="\nreturn { ...output, "+e+" };",n="var "+e+"; var output = {};\n"+this.codeNode.code+t;return this._method=new Function(...["parameters","local","global","refresh","setOutput","THREE","TSL"],n),this._method}dispose(){null!==this._method&&(this._object&&"function"==typeof this._object.dispose&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[wy(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const n in this.parameters)t.push(this.parameters[n].getCacheKey(e));return My(t)}set needsUpdate(e){!0===e&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return null===this.codeNode||(!0===this._needsOutputUpdate&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value),this}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const cO=Gb(uO).setParameterLength(1,2);function hO(e){let t;const n=e.context.getViewZ;return void 0!==n&&(t=n(this)),(t||mE.z).negate()}const AO=Qb(([e,t],n)=>{const r=hO(n);return XS(e,t,r)}),dO=Qb(([e],t)=>{const n=hO(t);return e.mul(e,n,n).negate().exp().oneMinus()}),pO=Qb(([e,t])=>Ax(t.toFloat().mix(zx.rgb,e.toVec3()),zx.a));let fO=null,mO=null;class gO extends $y{static get type(){return"RangeNode"}constructor(e=ex(),t=ex()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(Uy(t.value)),i=e.getTypeLength(Uy(n.value));return r>i?r:i}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(e=>{!0===e.isConstNode&&(t=e)}),null===t)throw new Error('THREE.TSL: No "ConstNode" found in node graph.');return t}setup(e){const t=e.object;let n=null;if(t.count>1){const r=this.getConstNode(this.minNode),i=this.getConstNode(this.maxNode),s=r.value,a=i.value,o=e.getTypeLength(Uy(s)),l=e.getTypeLength(Uy(a));fO=fO||new An,mO=mO||new An,fO.setScalar(0),mO.setScalar(0),1===o?fO.setScalar(s):s.isColor?fO.set(s.r,s.g,s.b,1):fO.set(s.x,s.y,s.z||0,s.w||0),1===l?mO.setScalar(a):a.isColor?mO.set(a.r,a.g,a.b,1):mO.set(a.x,a.y,a.z||0,a.w||0);const u=4,c=u*t.count,h=new Float32Array(c);for(let e=0;ekb(new vO(e,t)),bO=yO("numWorkgroups","uvec3"),xO=yO("workgroupId","uvec3"),TO=yO("globalId","uvec3"),SO=yO("localId","uvec3"),wO=yO("subgroupSize","uint");const MO=Gb(class extends $y{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:n}=e;!0===n.backend.isWebGLBackend?e.addFlowCode(`\t// ${t}Barrier \n`):e.addLineFlowCode(`${t}Barrier()`,this)}});class EO extends Yy{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n;const r=e.context.assign;if(n=super.generate(e),!0!==r){const r=this.getNodeType(e);n=e.format(n,r,t)}return n}}class CO extends $y{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Rt('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return kb(new EO(this,e))}generate(e){const t=""!==this.name?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class RO extends $y{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=e.getNodeProperties(this),n=t.parents,r=this.method,i=this.getNodeType(e),s=this.getInputType(e),a=this.pointerNode,o=this.valueNode,l=[];l.push(`&${a.build(e,s)}`),null!==o&&l.push(o.build(e,s));const u=`${e.getMethod(r,i)}( ${l.join(", ")} )`;if(!(!!n&&(1===n.length&&!0===n[0].isStackNode)))return void 0===t.constNode&&(t.constNode=$w(u,i).toConst()),t.constNode.build(e);e.addLineFlowCode(u,this)}}RO.ATOMIC_LOAD="atomicLoad",RO.ATOMIC_STORE="atomicStore",RO.ATOMIC_ADD="atomicAdd",RO.ATOMIC_SUB="atomicSub",RO.ATOMIC_MAX="atomicMax",RO.ATOMIC_MIN="atomicMin",RO.ATOMIC_AND="atomicAnd",RO.ATOMIC_OR="atomicOr",RO.ATOMIC_XOR="atomicXor";const NO=Gb(RO),PO=(e,t,n)=>NO(e,t,n).toStack();class DO extends Zy{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){const t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(n)?0:e.getTypeLength(n))?t:n}getNodeType(e){const t=this.method;return t===DO.SUBGROUP_ELECT?"bool":t===DO.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){const n=this.method,r=this.getNodeType(e),i=this.getInputType(e),s=this.aNode,a=this.bNode,o=[];if(n===DO.SUBGROUP_BROADCAST||n===DO.SUBGROUP_SHUFFLE||n===DO.QUAD_BROADCAST){const t=a.getNodeType(e);o.push(s.build(e,r),a.build(e,"float"===t?"int":r))}else n===DO.SUBGROUP_SHUFFLE_XOR||n===DO.SUBGROUP_SHUFFLE_DOWN||n===DO.SUBGROUP_SHUFFLE_UP?o.push(s.build(e,r),a.build(e,"uint")):(null!==s&&o.push(s.build(e,i)),null!==a&&o.push(a.build(e,i)));const l=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${l}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}DO.SUBGROUP_ELECT="subgroupElect",DO.SUBGROUP_BALLOT="subgroupBallot",DO.SUBGROUP_ADD="subgroupAdd",DO.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",DO.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",DO.SUBGROUP_MUL="subgroupMul",DO.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",DO.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",DO.SUBGROUP_AND="subgroupAnd",DO.SUBGROUP_OR="subgroupOr",DO.SUBGROUP_XOR="subgroupXor",DO.SUBGROUP_MIN="subgroupMin",DO.SUBGROUP_MAX="subgroupMax",DO.SUBGROUP_ALL="subgroupAll",DO.SUBGROUP_ANY="subgroupAny",DO.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",DO.QUAD_SWAP_X="quadSwapX",DO.QUAD_SWAP_Y="quadSwapY",DO.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",DO.SUBGROUP_BROADCAST="subgroupBroadcast",DO.SUBGROUP_SHUFFLE="subgroupShuffle",DO.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",DO.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",DO.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",DO.QUAD_BROADCAST="quadBroadcast";const LO=jb(DO,DO.SUBGROUP_ELECT).setParameterLength(0),IO=jb(DO,DO.SUBGROUP_BALLOT).setParameterLength(1),UO=jb(DO,DO.SUBGROUP_ADD).setParameterLength(1),OO=jb(DO,DO.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),BO=jb(DO,DO.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),FO=jb(DO,DO.SUBGROUP_MUL).setParameterLength(1),kO=jb(DO,DO.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),qO=jb(DO,DO.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),VO=jb(DO,DO.SUBGROUP_AND).setParameterLength(1),zO=jb(DO,DO.SUBGROUP_OR).setParameterLength(1),GO=jb(DO,DO.SUBGROUP_XOR).setParameterLength(1),HO=jb(DO,DO.SUBGROUP_MIN).setParameterLength(1),jO=jb(DO,DO.SUBGROUP_MAX).setParameterLength(1),WO=jb(DO,DO.SUBGROUP_ALL).setParameterLength(0),XO=jb(DO,DO.SUBGROUP_ANY).setParameterLength(0),QO=jb(DO,DO.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),$O=jb(DO,DO.QUAD_SWAP_X).setParameterLength(1),YO=jb(DO,DO.QUAD_SWAP_Y).setParameterLength(1),KO=jb(DO,DO.QUAD_SWAP_DIAGONAL).setParameterLength(1),ZO=jb(DO,DO.SUBGROUP_BROADCAST).setParameterLength(2),JO=jb(DO,DO.SUBGROUP_SHUFFLE).setParameterLength(2),eB=jb(DO,DO.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),tB=jb(DO,DO.SUBGROUP_SHUFFLE_UP).setParameterLength(2),nB=jb(DO,DO.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),rB=jb(DO,DO.QUAD_BROADCAST).setParameterLength(1);let iB;function sB(e){iB=iB||new WeakMap;let t=iB.get(e);return void 0===t&&iB.set(e,t={}),t}function aB(e){const t=sB(e);return t.shadowMatrix||(t.shadowMatrix=sT("mat4").setGroup(nT).onRenderUpdate(t=>(!0===e.castShadow&&!1!==t.renderer.shadowMap.enabled||(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function oB(e,t=pE){const n=aB(e).mul(t);return n.xyz.div(n.w)}function lB(e){const t=sB(e);return t.position||(t.position=sT(new Wt).setGroup(nT).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.matrixWorld)))}function uB(e){const t=sB(e);return t.targetPosition||(t.targetPosition=sT(new Wt).setGroup(nT).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(e.target.matrixWorld)))}function cB(e){const t=sB(e);return t.viewPosition||(t.viewPosition=sT(new Wt).setGroup(nT).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new Wt,n.value.setFromMatrixPosition(e.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}const hB=e=>kM.transformDirection(lB(e).sub(uB(e))),AB=(e,t)=>{for(const n of t)if(n.isAnalyticLightNode&&n.light.id===e)return n;return null},dB=new WeakMap,pB=[];class fB extends $y{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=xx("vec3","totalDiffuse"),this.totalSpecularNode=xx("vec3","totalSpecular"),this.outgoingLightNode=xx("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=this._lights;for(let t=0;te.sort((e,t)=>e.id-t.id))(this._lights),i=e.renderer.library;for(const e of r)if(e.isNode)t.push(kb(e));else{let r=null;if(null!==n&&(r=AB(e.id,n)),null===r){const n=i.getLightNodeClass(e.constructor);if(null===n){Rt(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}let r=null;dB.has(e)?r=dB.get(e):(r=kb(new n(e)),dB.set(e,r)),t.push(r)}}this._lightNodes=t}setupDirectLight(e,t,n){const{lightingModel:r,reflectedLight:i}=e.context;r.direct({...n,lightNode:t,reflectedLight:i},e)}setupDirectRectAreaLight(e,t,n){const{lightingModel:r,reflectedLight:i}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:i},e)}setupLights(e,t){for(const n of t)n.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){const t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode;const r=e.context,i=r.lightingModel,s=e.getNodeProperties(this);if(i){const{totalDiffuseNode:t,totalSpecularNode:a}=this;r.outgoingLight=n;const o=e.addStack();s.nodes=o.nodes,i.start(e);const{backdrop:l,backdropAlpha:u}=r,{directDiffuse:c,directSpecular:h,indirectDiffuse:A,indirectSpecular:d}=r.reflectedLight;let p=c.add(A);null!==l&&(p=lx(null!==u?u.mix(p,l):l)),t.assign(p),a.assign(h.add(d)),n.assign(t.add(a)),i.finish(e),n=n.bypass(e.removeStack())}else s.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}class mB extends $y{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=Vy.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){gB.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||pE)}}const gB=xx("vec3","shadowPositionWorld");function _B(e,t){return t=function(e,t={}){return t.toneMapping=e.toneMapping,t.toneMappingExposure=e.toneMappingExposure,t.outputColorSpace=e.outputColorSpace,t.renderTarget=e.getRenderTarget(),t.activeCubeFace=e.getActiveCubeFace(),t.activeMipmapLevel=e.getActiveMipmapLevel(),t.renderObjectFunction=e.getRenderObjectFunction(),t.pixelRatio=e.getPixelRatio(),t.mrt=e.getMRT(),t.clearColor=e.getClearColor(t.clearColor||new Or),t.clearAlpha=e.getClearAlpha(),t.autoClear=e.autoClear,t.scissorTest=e.getScissorTest(),t}(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}const vB=new WeakMap,yB=Qb(({depthTexture:e,shadowCoord:t,depthLayer:n})=>{let r=pM(e,t.xy).setName("t_basic");return e.isArrayTexture&&(r=r.depth(n)),r.compare(t.z)}),bB=Qb(({depthTexture:e,shadowCoord:t,shadow:n,depthLayer:r})=>{const i=(t,n)=>{let i=pM(e,t);return e.isArrayTexture&&(i=i.depth(r)),i.compare(n)},s=YE("mapSize","vec2",n).setGroup(nT),a=YE("radius","float",n).setGroup(nT),o=ix(1).div(s),l=o.x.negate().mul(a),u=o.y.negate().mul(a),c=o.x.mul(a),h=o.y.mul(a),A=l.div(2),d=u.div(2),p=c.div(2),f=h.div(2);return pT(i(t.xy.add(ix(l,u)),t.z),i(t.xy.add(ix(0,u)),t.z),i(t.xy.add(ix(c,u)),t.z),i(t.xy.add(ix(A,d)),t.z),i(t.xy.add(ix(0,d)),t.z),i(t.xy.add(ix(p,d)),t.z),i(t.xy.add(ix(l,0)),t.z),i(t.xy.add(ix(A,0)),t.z),i(t.xy,t.z),i(t.xy.add(ix(p,0)),t.z),i(t.xy.add(ix(c,0)),t.z),i(t.xy.add(ix(A,f)),t.z),i(t.xy.add(ix(0,f)),t.z),i(t.xy.add(ix(p,f)),t.z),i(t.xy.add(ix(l,h)),t.z),i(t.xy.add(ix(0,h)),t.z),i(t.xy.add(ix(c,h)),t.z)).mul(1/17)}),xB=Qb(({depthTexture:e,shadowCoord:t,shadow:n,depthLayer:r})=>{const i=(t,n)=>{let i=pM(e,t);return e.isArrayTexture&&(i=i.depth(r)),i.compare(n)},s=YE("mapSize","vec2",n).setGroup(nT),a=ix(1).div(s),o=a.x,l=a.y,u=t.xy,c=aS(u.mul(s).add(.5));return u.subAssign(c.mul(a)),pT(i(u,t.z),i(u.add(ix(o,0)),t.z),i(u.add(ix(0,l)),t.z),i(u.add(a),t.z),GS(i(u.add(ix(o.negate(),0)),t.z),i(u.add(ix(o.mul(2),0)),t.z),c.x),GS(i(u.add(ix(o.negate(),l)),t.z),i(u.add(ix(o.mul(2),l)),t.z),c.x),GS(i(u.add(ix(0,l.negate())),t.z),i(u.add(ix(0,l.mul(2))),t.z),c.y),GS(i(u.add(ix(o,l.negate())),t.z),i(u.add(ix(o,l.mul(2))),t.z),c.y),GS(GS(i(u.add(ix(o.negate(),l.negate())),t.z),i(u.add(ix(o.mul(2),l.negate())),t.z),c.x),GS(i(u.add(ix(o.negate(),l.mul(2))),t.z),i(u.add(ix(o.mul(2),l.mul(2))),t.z),c.x),c.y)).mul(1/9)}),TB=Qb(({depthTexture:e,shadowCoord:t,depthLayer:n})=>{const r=ex(1).toVar();let i=pM(e).sample(t.xy);e.isArrayTexture&&(i=i.depth(n)),i=i.rg;const s=NS(t.z,i.x);return Kb(s.notEqual(ex(1)),()=>{const e=t.z.sub(i.x),n=RS(0,i.y.mul(i.y));let a=n.div(n.add(e.mul(e)));a=HS(fT(a,.3).div(.95-.3)),r.assign(HS(RS(s,a)))}),r}),SB=Qb(([e,t,n])=>{let r=pE.sub(e).length();return r=r.sub(t).div(n.sub(t)),r=r.saturate(),r}),wB=e=>{let t=vB.get(e);if(void 0===t){const n=e.isPointLight?(e=>{const t=e.shadow.camera,n=YE("near","float",t).setGroup(nT),r=YE("far","float",t).setGroup(nT),i=QM(e);return SB(i,n,r)})(e):null;t=new EN,t.colorNode=Ax(0,0,0,1),t.depthNode=n,t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.fog=!1,vB.set(e,t)}return t},MB=new vL,EB=[],CB=(e,t,n,r)=>{EB[0]=e,EB[1]=t;let i=MB.get(EB);return void 0!==i&&i.shadowType===n&&i.useVelocity===r||(i=(i,s,a,o,l,u,...c)=>{(!0===i.castShadow||i.receiveShadow&&3===n)&&(r&&(By(i).useVelocity=!0),i.onBeforeShadow(e,i,a,t.camera,o,s.overrideMaterial,u),e.renderObject(i,s,a,o,l,u,...c),i.onAfterShadow(e,i,a,t.camera,o,s.overrideMaterial,u))},i.shadowType=n,i.useVelocity=r,MB.set(EB,i)),EB[0]=null,EB[1]=null,i},RB=Qb(({samples:e,radius:t,size:n,shadowPass:r,depthLayer:i})=>{const s=ex(0).toVar("meanVertical"),a=ex(0).toVar("squareMeanVertical"),o=e.lessThanEqual(ex(1)).select(ex(0),ex(2).div(e.sub(1))),l=e.lessThanEqual(ex(1)).select(ex(0),ex(-1));qR({start:tx(0),end:tx(e),type:"int",condition:"<"},({i:e})=>{const u=l.add(ex(e).mul(o));let c=r.sample(pT(CM.xy,ix(0,u).mul(t)).div(n));r.value.isArrayTexture&&(c=c.depth(i)),c=c.x,s.addAssign(c),a.addAssign(c.mul(c))}),s.divAssign(e),a.divAssign(e);const u=tS(a.sub(s.mul(s)));return ix(s,u)}),NB=Qb(({samples:e,radius:t,size:n,shadowPass:r,depthLayer:i})=>{const s=ex(0).toVar("meanHorizontal"),a=ex(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(ex(1)).select(ex(0),ex(2).div(e.sub(1))),l=e.lessThanEqual(ex(1)).select(ex(0),ex(-1));qR({start:tx(0),end:tx(e),type:"int",condition:"<"},({i:e})=>{const u=l.add(ex(e).mul(o));let c=r.sample(pT(CM.xy,ix(u,0).mul(t)).div(n));r.value.isArrayTexture&&(c=c.depth(i)),s.addAssign(c.x),a.addAssign(pT(c.y.mul(c.y),c.x.mul(c.x)))}),s.divAssign(e),a.divAssign(e);const u=tS(a.sub(s.mul(s)));return ix(s,u)}),PB=[yB,bB,xB,TB];let DB;const LB=new JI;class IB extends mB{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:i,depthLayer:s}){const a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),o=t({depthTexture:n,shadowCoord:r,shadow:i,depthLayer:s});return a.select(o,ex(1))}setupShadowCoord(e,t){const{shadow:n}=this,{renderer:r}=e,i=YE("bias","float",n).setGroup(nT);let s,a=t;if(n.camera.isOrthographicCamera||!0!==r.logarithmicDepthBuffer)a=a.xyz.div(a.w),s=a.z,r.coordinateSystem===bt&&(s=s.mul(2).sub(1));else{const e=a.w;a=a.xy.div(e);const t=YE("near","float",n.camera).setGroup(nT),r=YE("far","float",n.camera).setGroup(nT);s=uN(e.negate(),t,r)}return a=lx(a.x,a.y.oneMinus(),s.add(i)),a}getShadowFilterFn(e){return PB[e]}setupRenderTarget(e,t){const n=new xs(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=ct;const r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){const{renderer:t,camera:n}=e,{light:r,shadow:i}=this,s=t.shadowMap.type,{depthTexture:a,shadowMap:o}=this.setupRenderTarget(i,e);if(i.camera.coordinateSystem=n.coordinateSystem,i.camera.updateProjectionMatrix(),3===s&&!0!==i.isPointLightShadow){a.compareFunction=null,o.depth>1?(o._vsmShadowMapVertical||(o._vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:xe,type:ue,depth:o.depth,depthBuffer:!1}),o._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=o._vsmShadowMapVertical,o._vsmShadowMapHorizontal||(o._vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:xe,type:ue,depth:o.depth,depthBuffer:!1}),o._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=o._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:xe,type:ue,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(i.mapSize.width,i.mapSize.height,{format:xe,type:ue,depthBuffer:!1}));let t=pM(a);a.isArrayTexture&&(t=t.depth(this.depthLayer));let n=pM(this.vsmShadowMapVertical.texture);a.isArrayTexture&&(n=n.depth(this.depthLayer));const r=YE("blurSamples","float",i).setGroup(nT),s=YE("radius","float",i).setGroup(nT),l=YE("mapSize","vec2",i).setGroup(nT);let u=this.vsmMaterialVertical||(this.vsmMaterialVertical=new EN);u.fragmentNode=RB({samples:r,radius:s,size:l,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),u.name="VSMVertical",u=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new EN),u.fragmentNode=NB({samples:r,radius:s,size:l,shadowPass:n,depthLayer:this.depthLayer}).context(e.getSharedContext()),u.name="VSMHorizontal"}const l=YE("intensity","float",i).setGroup(nT),u=YE("normalBias","float",i).setGroup(nT),c=aB(r).mul(gB.add(CE.mul(u))),h=this.setupShadowCoord(e,c),A=i.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===A)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const d=3===s&&!0!==i.isPointLightShadow?this.vsmShadowMapHorizontal.texture:a,p=this.setupShadowFilter(e,{filterFn:A,shadowTexture:o.texture,depthTexture:d,shadowCoord:h,shadow:i,depthLayer:this.depthLayer});let f=pM(o.texture,h);a.isArrayTexture&&(f=f.depth(this.depthLayer));const m=GS(1,p.rgb.mix(f,1),l.mul(f.a)).toVar();this.shadowMap=o,this.shadow.map=o;const g=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return m.toInspector(`${g} / Color`,()=>pM(this.shadowMap.texture)).toInspector(`${g} / Depth`,()=>fM(this.shadowMap.depthTexture,aM().mul(lM(pM(this.shadowMap.depthTexture)))).x.oneMinus())}setup(e){if(!1!==e.renderer.shadowMap.enabled)return Qb(()=>{const t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),null===n&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.shadowNode&&Rt('NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:i,scene:s}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);const a=s.name;s.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,i.render(s,t.camera),s.name=a}updateShadow(e){const{shadowMap:t,light:n,shadow:r}=this,{renderer:i,scene:s,camera:a}=e,o=i.shadowMap.type,l=t.depthTexture.version;this._depthVersionCached=l;const u=r.camera.layers.mask;4294967294&r.camera.layers.mask||(r.camera.layers.mask=a.layers.mask);const c=i.getRenderObjectFunction(),h=i.getMRT(),A=!!h&&h.has("velocity");DB=function(e,t,n){return n=function(e,t){return t=function(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}(t,n=_B(e,n)),n}(i,s,DB),s.overrideMaterial=wB(n),i.setRenderObjectFunction(CB(i,r,o,A)),i.setClearColor(0,0),i.setRenderTarget(t),this.renderShadow(e),i.setRenderObjectFunction(c),3===o&&!0!==r.isPointLightShadow&&this.vsmPass(i),r.camera.layers.mask=u,function(e,t,n){!function(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}(e,n),function(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}(t,n)}(i,s,DB)}vsmPass(e){const{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),LB.material=this.vsmMaterialVertical,LB.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),LB.material=this.vsmMaterialHorizontal,LB.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){const{shadow:t}=this;let n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const UB=(e,t)=>kb(new IB(e,t)),OB=new Or,BB=Qb(([e,t])=>{const n=e.toVar(),r=dS(n),i=gT(1,RS(r.x,RS(r.y,r.z)));r.mulAssign(i),n.mulAssign(i.mul(t.mul(2).oneMinus()));const s=ix(n.xy).toVar(),a=t.mul(1.5).oneMinus();return Kb(r.z.greaterThanEqual(a),()=>{Kb(n.z.greaterThan(0),()=>{s.x.assign(fT(4,n.x))})}).ElseIf(r.x.greaterThanEqual(a),()=>{const e=pS(n.x);s.x.assign(n.z.mul(e).add(e.mul(2)))}).ElseIf(r.y.greaterThanEqual(a),()=>{const e=pS(n.y);s.x.assign(n.x.add(e.mul(2)).add(2)),s.y.assign(n.z.mul(e).sub(2))}),ix(.125,.25).mul(s).add(ix(.375,.75)).flipY()}).setLayout({name:"cubeToUV",type:"vec2",inputs:[{name:"pos",type:"vec3"},{name:"texelSizeY",type:"float"}]}),FB=Qb(({depthTexture:e,bd3D:t,dp:n,texelSize:r})=>pM(e,BB(t,r.y)).compare(n)),kB=Qb(({depthTexture:e,bd3D:t,dp:n,texelSize:r,shadow:i})=>{const s=YE("radius","float",i).setGroup(nT),a=ix(-1,1).mul(s).mul(r.y);return pM(e,BB(t.add(a.xyy),r.y)).compare(n).add(pM(e,BB(t.add(a.yyy),r.y)).compare(n)).add(pM(e,BB(t.add(a.xyx),r.y)).compare(n)).add(pM(e,BB(t.add(a.yyx),r.y)).compare(n)).add(pM(e,BB(t,r.y)).compare(n)).add(pM(e,BB(t.add(a.xxy),r.y)).compare(n)).add(pM(e,BB(t.add(a.yxy),r.y)).compare(n)).add(pM(e,BB(t.add(a.xxx),r.y)).compare(n)).add(pM(e,BB(t.add(a.yxx),r.y)).compare(n)).mul(1/9)}),qB=Qb(({filterFn:e,depthTexture:t,shadowCoord:n,shadow:r})=>{const i=n.xyz.toVar(),s=i.length(),a=sT("float").setGroup(nT).onRenderUpdate(()=>r.camera.near),o=sT("float").setGroup(nT).onRenderUpdate(()=>r.camera.far),l=YE("bias","float",r).setGroup(nT),u=sT(r.mapSize).setGroup(nT),c=ex(1).toVar();return Kb(s.sub(o).lessThanEqual(0).and(s.sub(a).greaterThanEqual(0)),()=>{const n=s.sub(a).div(o.sub(a)).toVar();n.addAssign(l);const h=i.normalize(),A=ix(1).div(u.mul(ix(4,2)));c.assign(e({depthTexture:t,bd3D:h,dp:n,texelSize:A,shadow:r}))}),c}),VB=new An,zB=new Ht,GB=new Ht;class HB extends IB{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return 0===e?FB:kB}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:i,shadow:s}){return qB({filterFn:t,shadowTexture:n,depthTexture:r,shadowCoord:i,shadow:s})}renderShadow(e){const{shadow:t,shadowMap:n,light:r}=this,{renderer:i,scene:s}=e,a=t.getFrameExtents();GB.copy(t.mapSize),GB.multiply(a),n.setSize(GB.width,GB.height),zB.copy(t.mapSize);const o=i.autoClear,l=i.getClearColor(OB),u=i.getClearAlpha();i.autoClear=!1,i.setClearColor(t.clearColor,t.clearAlpha),i.clear();const c=t.getViewportCount();for(let e=0;ekb(new HB(e,t));class WB extends XR{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Or,this.colorNode=e&&e.colorNode||sT(this.color).setGroup(nT),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=Vy.FRAME}getHash(){return this.light.uuid}getLightVector(e){return cB(this.light).sub(e.context.positionView||mE)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return UB(this.light)}setupShadow(e){const{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let n=this.shadowColorNode;if(null===n){const e=this.light.shadow.shadowNode;let t;t=void 0!==e?kb(e):this.setupShadowNode(),this.shadowNode=t,this.shadowColorNode=n=this.colorNode.mul(t),this.baseColorNode=this.colorNode}this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);const t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){const{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}const XB=Qb(({lightDistance:e,cutoffDistance:t,decayExponent:n})=>{const r=e.pow(n).max(.01).reciprocal();return t.greaterThan(0).select(r.mul(e.div(t).pow4().oneMinus().clamp().pow2()),r)}),QB=({color:e,lightVector:t,cutoffDistance:n,decayExponent:r})=>{const i=t.normalize(),s=t.length(),a=XB({lightDistance:s,cutoffDistance:n,decayExponent:r});return{lightDirection:i,lightColor:e.mul(a)}};class $B extends WB{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=sT(0).setGroup(nT),this.decayExponentNode=sT(2).setGroup(nT)}update(e){const{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return jB(this.light)}setupDirect(e){return QB({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}const YB=Qb(([e=aM()])=>{const t=e.mul(2),n=t.x.floor(),r=t.y.floor();return n.add(r).mod(2).sign()}),KB=Qb(([e=aM()],{renderer:t,material:n})=>{const r=zS(e.mul(2).sub(1));let i;if(n.alphaToCoverage&&t.currentSamples>0){const e=ex(r.fwidth()).toVar();i=XS(e.oneMinus(),e.add(1),r).oneMinus()}else i=rw(r.greaterThan(1),0,1);return i}),ZB=Qb(([e,t,n])=>{const r=ex(n).toVar(),i=ex(t).toVar(),s=rx(e).toVar();return rw(s,i,r)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),JB=Qb(([e,t])=>{const n=rx(t).toVar(),r=ex(e).toVar();return rw(n,r.negate(),r)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),eF=Qb(([e])=>{const t=ex(e).toVar();return tx(rS(t))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),tF=Qb(([e,t])=>{const n=ex(e).toVar();return t.assign(eF(n)),n.sub(ex(t))}),nF=Qb(([e,t,n,r,i,s])=>{const a=ex(s).toVar(),o=ex(i).toVar(),l=ex(r).toVar(),u=ex(n).toVar(),c=ex(t).toVar(),h=ex(e).toVar(),A=ex(fT(1,o)).toVar();return fT(1,a).mul(h.mul(A).add(c.mul(o))).add(a.mul(u.mul(A).add(l.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),rF=Qb(([e,t,n,r,i,s])=>{const a=ex(s).toVar(),o=ex(i).toVar(),l=lx(r).toVar(),u=lx(n).toVar(),c=lx(t).toVar(),h=lx(e).toVar(),A=ex(fT(1,o)).toVar();return fT(1,a).mul(h.mul(A).add(c.mul(o))).add(a.mul(u.mul(A).add(l.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),iF=TI([nF,rF]),sF=Qb(([e,t,n,r,i,s,a,o,l,u,c])=>{const h=ex(c).toVar(),A=ex(u).toVar(),d=ex(l).toVar(),p=ex(o).toVar(),f=ex(a).toVar(),m=ex(s).toVar(),g=ex(i).toVar(),_=ex(r).toVar(),v=ex(n).toVar(),y=ex(t).toVar(),b=ex(e).toVar(),x=ex(fT(1,d)).toVar(),T=ex(fT(1,A)).toVar();return ex(fT(1,h)).toVar().mul(T.mul(b.mul(x).add(y.mul(d))).add(A.mul(v.mul(x).add(_.mul(d))))).add(h.mul(T.mul(g.mul(x).add(m.mul(d))).add(A.mul(f.mul(x).add(p.mul(d))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),aF=Qb(([e,t,n,r,i,s,a,o,l,u,c])=>{const h=ex(c).toVar(),A=ex(u).toVar(),d=ex(l).toVar(),p=lx(o).toVar(),f=lx(a).toVar(),m=lx(s).toVar(),g=lx(i).toVar(),_=lx(r).toVar(),v=lx(n).toVar(),y=lx(t).toVar(),b=lx(e).toVar(),x=ex(fT(1,d)).toVar(),T=ex(fT(1,A)).toVar();return ex(fT(1,h)).toVar().mul(T.mul(b.mul(x).add(y.mul(d))).add(A.mul(v.mul(x).add(_.mul(d))))).add(h.mul(T.mul(g.mul(x).add(m.mul(d))).add(A.mul(f.mul(x).add(p.mul(d))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),oF=TI([sF,aF]),lF=Qb(([e,t,n])=>{const r=ex(n).toVar(),i=ex(t).toVar(),s=nx(e).toVar(),a=nx(s.bitAnd(nx(7))).toVar(),o=ex(ZB(a.lessThan(nx(4)),i,r)).toVar(),l=ex(mT(2,ZB(a.lessThan(nx(4)),r,i))).toVar();return JB(o,rx(a.bitAnd(nx(1)))).add(JB(l,rx(a.bitAnd(nx(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),uF=Qb(([e,t,n,r])=>{const i=ex(r).toVar(),s=ex(n).toVar(),a=ex(t).toVar(),o=nx(e).toVar(),l=nx(o.bitAnd(nx(15))).toVar(),u=ex(ZB(l.lessThan(nx(8)),a,s)).toVar(),c=ex(ZB(l.lessThan(nx(4)),s,ZB(l.equal(nx(12)).or(l.equal(nx(14))),a,i))).toVar();return JB(u,rx(l.bitAnd(nx(1)))).add(JB(c,rx(l.bitAnd(nx(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),cF=TI([lF,uF]),hF=Qb(([e,t,n])=>{const r=ex(n).toVar(),i=ex(t).toVar(),s=cx(e).toVar();return lx(cF(s.x,i,r),cF(s.y,i,r),cF(s.z,i,r))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),AF=Qb(([e,t,n,r])=>{const i=ex(r).toVar(),s=ex(n).toVar(),a=ex(t).toVar(),o=cx(e).toVar();return lx(cF(o.x,a,s,i),cF(o.y,a,s,i),cF(o.z,a,s,i))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),dF=TI([hF,AF]),pF=Qb(([e])=>{const t=ex(e).toVar();return mT(.6616,t)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),fF=Qb(([e])=>{const t=ex(e).toVar();return mT(.982,t)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),mF=Qb(([e])=>{const t=lx(e).toVar();return mT(.6616,t)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),gF=TI([pF,mF]),_F=Qb(([e])=>{const t=lx(e).toVar();return mT(.982,t)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),vF=TI([fF,_F]),yF=Qb(([e,t])=>{const n=tx(t).toVar(),r=nx(e).toVar();return r.shiftLeft(n).bitOr(r.shiftRight(tx(32).sub(n)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),bF=Qb(([e,t,n])=>{e.subAssign(n),e.bitXorAssign(yF(n,tx(4))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(yF(e,tx(6))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(yF(t,tx(8))),t.addAssign(e),e.subAssign(n),e.bitXorAssign(yF(n,tx(16))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(yF(e,tx(19))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(yF(t,tx(4))),t.addAssign(e)}),xF=Qb(([e,t,n])=>{const r=nx(n).toVar(),i=nx(t).toVar(),s=nx(e).toVar();return r.bitXorAssign(i),r.subAssign(yF(i,tx(14))),s.bitXorAssign(r),s.subAssign(yF(r,tx(11))),i.bitXorAssign(s),i.subAssign(yF(s,tx(25))),r.bitXorAssign(i),r.subAssign(yF(i,tx(16))),s.bitXorAssign(r),s.subAssign(yF(r,tx(4))),i.bitXorAssign(s),i.subAssign(yF(s,tx(14))),r.bitXorAssign(i),r.subAssign(yF(i,tx(24))),r}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),TF=Qb(([e])=>{const t=nx(e).toVar();return ex(t).div(ex(nx(tx(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),SF=Qb(([e])=>{const t=ex(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),wF=Qb(([e])=>{const t=tx(e).toVar(),n=nx(nx(1)).toVar(),r=nx(nx(tx(3735928559)).add(n.shiftLeft(nx(2))).add(nx(13))).toVar();return xF(r.add(nx(t)),r,r)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),MF=Qb(([e,t])=>{const n=tx(t).toVar(),r=tx(e).toVar(),i=nx(nx(2)).toVar(),s=nx().toVar(),a=nx().toVar(),o=nx().toVar();return s.assign(a.assign(o.assign(nx(tx(3735928559)).add(i.shiftLeft(nx(2))).add(nx(13))))),s.addAssign(nx(r)),a.addAssign(nx(n)),xF(s,a,o)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),EF=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=tx(t).toVar(),s=tx(e).toVar(),a=nx(nx(3)).toVar(),o=nx().toVar(),l=nx().toVar(),u=nx().toVar();return o.assign(l.assign(u.assign(nx(tx(3735928559)).add(a.shiftLeft(nx(2))).add(nx(13))))),o.addAssign(nx(s)),l.addAssign(nx(i)),u.addAssign(nx(r)),xF(o,l,u)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),CF=Qb(([e,t,n,r])=>{const i=tx(r).toVar(),s=tx(n).toVar(),a=tx(t).toVar(),o=tx(e).toVar(),l=nx(nx(4)).toVar(),u=nx().toVar(),c=nx().toVar(),h=nx().toVar();return u.assign(c.assign(h.assign(nx(tx(3735928559)).add(l.shiftLeft(nx(2))).add(nx(13))))),u.addAssign(nx(o)),c.addAssign(nx(a)),h.addAssign(nx(s)),bF(u,c,h),u.addAssign(nx(i)),xF(u,c,h)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),RF=Qb(([e,t,n,r,i])=>{const s=tx(i).toVar(),a=tx(r).toVar(),o=tx(n).toVar(),l=tx(t).toVar(),u=tx(e).toVar(),c=nx(nx(5)).toVar(),h=nx().toVar(),A=nx().toVar(),d=nx().toVar();return h.assign(A.assign(d.assign(nx(tx(3735928559)).add(c.shiftLeft(nx(2))).add(nx(13))))),h.addAssign(nx(u)),A.addAssign(nx(l)),d.addAssign(nx(o)),bF(h,A,d),h.addAssign(nx(a)),A.addAssign(nx(s)),xF(h,A,d)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),NF=TI([wF,MF,EF,CF,RF]),PF=Qb(([e,t])=>{const n=tx(t).toVar(),r=tx(e).toVar(),i=nx(NF(r,n)).toVar(),s=cx().toVar();return s.x.assign(i.bitAnd(tx(255))),s.y.assign(i.shiftRight(tx(8)).bitAnd(tx(255))),s.z.assign(i.shiftRight(tx(16)).bitAnd(tx(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),DF=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=tx(t).toVar(),s=tx(e).toVar(),a=nx(NF(s,i,r)).toVar(),o=cx().toVar();return o.x.assign(a.bitAnd(tx(255))),o.y.assign(a.shiftRight(tx(8)).bitAnd(tx(255))),o.z.assign(a.shiftRight(tx(16)).bitAnd(tx(255))),o}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),LF=TI([PF,DF]),IF=Qb(([e])=>{const t=ix(e).toVar(),n=tx().toVar(),r=tx().toVar(),i=ex(tF(t.x,n)).toVar(),s=ex(tF(t.y,r)).toVar(),a=ex(SF(i)).toVar(),o=ex(SF(s)).toVar(),l=ex(iF(cF(NF(n,r),i,s),cF(NF(n.add(tx(1)),r),i.sub(1),s),cF(NF(n,r.add(tx(1))),i,s.sub(1)),cF(NF(n.add(tx(1)),r.add(tx(1))),i.sub(1),s.sub(1)),a,o)).toVar();return gF(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),UF=Qb(([e])=>{const t=lx(e).toVar(),n=tx().toVar(),r=tx().toVar(),i=tx().toVar(),s=ex(tF(t.x,n)).toVar(),a=ex(tF(t.y,r)).toVar(),o=ex(tF(t.z,i)).toVar(),l=ex(SF(s)).toVar(),u=ex(SF(a)).toVar(),c=ex(SF(o)).toVar(),h=ex(oF(cF(NF(n,r,i),s,a,o),cF(NF(n.add(tx(1)),r,i),s.sub(1),a,o),cF(NF(n,r.add(tx(1)),i),s,a.sub(1),o),cF(NF(n.add(tx(1)),r.add(tx(1)),i),s.sub(1),a.sub(1),o),cF(NF(n,r,i.add(tx(1))),s,a,o.sub(1)),cF(NF(n.add(tx(1)),r,i.add(tx(1))),s.sub(1),a,o.sub(1)),cF(NF(n,r.add(tx(1)),i.add(tx(1))),s,a.sub(1),o.sub(1)),cF(NF(n.add(tx(1)),r.add(tx(1)),i.add(tx(1))),s.sub(1),a.sub(1),o.sub(1)),l,u,c)).toVar();return vF(h)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),OF=TI([IF,UF]),BF=Qb(([e])=>{const t=ix(e).toVar(),n=tx().toVar(),r=tx().toVar(),i=ex(tF(t.x,n)).toVar(),s=ex(tF(t.y,r)).toVar(),a=ex(SF(i)).toVar(),o=ex(SF(s)).toVar(),l=lx(iF(dF(LF(n,r),i,s),dF(LF(n.add(tx(1)),r),i.sub(1),s),dF(LF(n,r.add(tx(1))),i,s.sub(1)),dF(LF(n.add(tx(1)),r.add(tx(1))),i.sub(1),s.sub(1)),a,o)).toVar();return gF(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),FF=Qb(([e])=>{const t=lx(e).toVar(),n=tx().toVar(),r=tx().toVar(),i=tx().toVar(),s=ex(tF(t.x,n)).toVar(),a=ex(tF(t.y,r)).toVar(),o=ex(tF(t.z,i)).toVar(),l=ex(SF(s)).toVar(),u=ex(SF(a)).toVar(),c=ex(SF(o)).toVar(),h=lx(oF(dF(LF(n,r,i),s,a,o),dF(LF(n.add(tx(1)),r,i),s.sub(1),a,o),dF(LF(n,r.add(tx(1)),i),s,a.sub(1),o),dF(LF(n.add(tx(1)),r.add(tx(1)),i),s.sub(1),a.sub(1),o),dF(LF(n,r,i.add(tx(1))),s,a,o.sub(1)),dF(LF(n.add(tx(1)),r,i.add(tx(1))),s.sub(1),a,o.sub(1)),dF(LF(n,r.add(tx(1)),i.add(tx(1))),s,a.sub(1),o.sub(1)),dF(LF(n.add(tx(1)),r.add(tx(1)),i.add(tx(1))),s.sub(1),a.sub(1),o.sub(1)),l,u,c)).toVar();return vF(h)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),kF=TI([BF,FF]),qF=Qb(([e])=>{const t=ex(e).toVar(),n=tx(eF(t)).toVar();return TF(NF(n))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),VF=Qb(([e])=>{const t=ix(e).toVar(),n=tx(eF(t.x)).toVar(),r=tx(eF(t.y)).toVar();return TF(NF(n,r))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),zF=Qb(([e])=>{const t=lx(e).toVar(),n=tx(eF(t.x)).toVar(),r=tx(eF(t.y)).toVar(),i=tx(eF(t.z)).toVar();return TF(NF(n,r,i))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),GF=Qb(([e])=>{const t=Ax(e).toVar(),n=tx(eF(t.x)).toVar(),r=tx(eF(t.y)).toVar(),i=tx(eF(t.z)).toVar(),s=tx(eF(t.w)).toVar();return TF(NF(n,r,i,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),HF=TI([qF,VF,zF,GF]),jF=Qb(([e])=>{const t=ex(e).toVar(),n=tx(eF(t)).toVar();return lx(TF(NF(n,tx(0))),TF(NF(n,tx(1))),TF(NF(n,tx(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),WF=Qb(([e])=>{const t=ix(e).toVar(),n=tx(eF(t.x)).toVar(),r=tx(eF(t.y)).toVar();return lx(TF(NF(n,r,tx(0))),TF(NF(n,r,tx(1))),TF(NF(n,r,tx(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),XF=Qb(([e])=>{const t=lx(e).toVar(),n=tx(eF(t.x)).toVar(),r=tx(eF(t.y)).toVar(),i=tx(eF(t.z)).toVar();return lx(TF(NF(n,r,i,tx(0))),TF(NF(n,r,i,tx(1))),TF(NF(n,r,i,tx(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),QF=Qb(([e])=>{const t=Ax(e).toVar(),n=tx(eF(t.x)).toVar(),r=tx(eF(t.y)).toVar(),i=tx(eF(t.z)).toVar(),s=tx(eF(t.w)).toVar();return lx(TF(NF(n,r,i,s,tx(0))),TF(NF(n,r,i,s,tx(1))),TF(NF(n,r,i,s,tx(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),$F=TI([jF,WF,XF,QF]),YF=Qb(([e,t,n,r])=>{const i=ex(r).toVar(),s=ex(n).toVar(),a=tx(t).toVar(),o=lx(e).toVar(),l=ex(0).toVar(),u=ex(1).toVar();return qR(a,()=>{l.addAssign(u.mul(OF(o))),u.mulAssign(i),o.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),KF=Qb(([e,t,n,r])=>{const i=ex(r).toVar(),s=ex(n).toVar(),a=tx(t).toVar(),o=lx(e).toVar(),l=lx(0).toVar(),u=ex(1).toVar();return qR(a,()=>{l.addAssign(u.mul(kF(o))),u.mulAssign(i),o.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),ZF=Qb(([e,t,n,r])=>{const i=ex(r).toVar(),s=ex(n).toVar(),a=tx(t).toVar(),o=lx(e).toVar();return ix(YF(o,a,s,i),YF(o.add(lx(tx(19),tx(193),tx(17))),a,s,i))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),JF=Qb(([e,t,n,r])=>{const i=ex(r).toVar(),s=ex(n).toVar(),a=tx(t).toVar(),o=lx(e).toVar(),l=lx(KF(o,a,s,i)).toVar(),u=ex(YF(o.add(lx(tx(19),tx(193),tx(17))),a,s,i)).toVar();return Ax(l,u)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),ek=Qb(([e,t,n,r,i,s,a])=>{const o=tx(a).toVar(),l=ex(s).toVar(),u=tx(i).toVar(),c=tx(r).toVar(),h=tx(n).toVar(),A=tx(t).toVar(),d=ix(e).toVar(),p=lx($F(ix(A.add(c),h.add(u)))).toVar(),f=ix(p.x,p.y).toVar();f.subAssign(.5),f.mulAssign(l),f.addAssign(.5);const m=ix(ix(ex(A),ex(h)).add(f)).toVar(),g=ix(m.sub(d)).toVar();return Kb(o.equal(tx(2)),()=>dS(g.x).add(dS(g.y))),Kb(o.equal(tx(3)),()=>RS(dS(g.x),dS(g.y))),IS(g,g)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),tk=Qb(([e,t,n,r,i,s,a,o,l])=>{const u=tx(l).toVar(),c=ex(o).toVar(),h=tx(a).toVar(),A=tx(s).toVar(),d=tx(i).toVar(),p=tx(r).toVar(),f=tx(n).toVar(),m=tx(t).toVar(),g=lx(e).toVar(),_=lx($F(lx(m.add(d),f.add(A),p.add(h)))).toVar();_.subAssign(.5),_.mulAssign(c),_.addAssign(.5);const v=lx(lx(ex(m),ex(f),ex(p)).add(_)).toVar(),y=lx(v.sub(g)).toVar();return Kb(u.equal(tx(2)),()=>dS(y.x).add(dS(y.y)).add(dS(y.z))),Kb(u.equal(tx(3)),()=>RS(dS(y.x),dS(y.y),dS(y.z))),IS(y,y)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),nk=TI([ek,tk]),rk=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=ex(t).toVar(),s=ix(e).toVar(),a=tx().toVar(),o=tx().toVar(),l=ix(tF(s.x,a),tF(s.y,o)).toVar(),u=ex(1e6).toVar();return qR({start:-1,end:tx(1),name:"x",condition:"<="},({x:e})=>{qR({start:-1,end:tx(1),name:"y",condition:"<="},({y:t})=>{const n=ex(nk(l,e,t,a,o,i,r)).toVar();u.assign(CS(u,n))})}),Kb(r.equal(tx(0)),()=>{u.assign(tS(u))}),u}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ik=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=ex(t).toVar(),s=ix(e).toVar(),a=tx().toVar(),o=tx().toVar(),l=ix(tF(s.x,a),tF(s.y,o)).toVar(),u=ix(1e6,1e6).toVar();return qR({start:-1,end:tx(1),name:"x",condition:"<="},({x:e})=>{qR({start:-1,end:tx(1),name:"y",condition:"<="},({y:t})=>{const n=ex(nk(l,e,t,a,o,i,r)).toVar();Kb(n.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(n)}).ElseIf(n.lessThan(u.y),()=>{u.y.assign(n)})})}),Kb(r.equal(tx(0)),()=>{u.assign(tS(u))}),u}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),sk=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=ex(t).toVar(),s=ix(e).toVar(),a=tx().toVar(),o=tx().toVar(),l=ix(tF(s.x,a),tF(s.y,o)).toVar(),u=lx(1e6,1e6,1e6).toVar();return qR({start:-1,end:tx(1),name:"x",condition:"<="},({x:e})=>{qR({start:-1,end:tx(1),name:"y",condition:"<="},({y:t})=>{const n=ex(nk(l,e,t,a,o,i,r)).toVar();Kb(n.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(n)}).ElseIf(n.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(n)}).ElseIf(n.lessThan(u.z),()=>{u.z.assign(n)})})}),Kb(r.equal(tx(0)),()=>{u.assign(tS(u))}),u}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ak=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=ex(t).toVar(),s=lx(e).toVar(),a=tx().toVar(),o=tx().toVar(),l=tx().toVar(),u=lx(tF(s.x,a),tF(s.y,o),tF(s.z,l)).toVar(),c=ex(1e6).toVar();return qR({start:-1,end:tx(1),name:"x",condition:"<="},({x:e})=>{qR({start:-1,end:tx(1),name:"y",condition:"<="},({y:t})=>{qR({start:-1,end:tx(1),name:"z",condition:"<="},({z:n})=>{const s=ex(nk(u,e,t,n,a,o,l,i,r)).toVar();c.assign(CS(c,s))})})}),Kb(r.equal(tx(0)),()=>{c.assign(tS(c))}),c}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ok=TI([rk,ak]),lk=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=ex(t).toVar(),s=lx(e).toVar(),a=tx().toVar(),o=tx().toVar(),l=tx().toVar(),u=lx(tF(s.x,a),tF(s.y,o),tF(s.z,l)).toVar(),c=ix(1e6,1e6).toVar();return qR({start:-1,end:tx(1),name:"x",condition:"<="},({x:e})=>{qR({start:-1,end:tx(1),name:"y",condition:"<="},({y:t})=>{qR({start:-1,end:tx(1),name:"z",condition:"<="},({z:n})=>{const s=ex(nk(u,e,t,n,a,o,l,i,r)).toVar();Kb(s.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(s)}).ElseIf(s.lessThan(c.y),()=>{c.y.assign(s)})})})}),Kb(r.equal(tx(0)),()=>{c.assign(tS(c))}),c}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uk=TI([ik,lk]),ck=Qb(([e,t,n])=>{const r=tx(n).toVar(),i=ex(t).toVar(),s=lx(e).toVar(),a=tx().toVar(),o=tx().toVar(),l=tx().toVar(),u=lx(tF(s.x,a),tF(s.y,o),tF(s.z,l)).toVar(),c=lx(1e6,1e6,1e6).toVar();return qR({start:-1,end:tx(1),name:"x",condition:"<="},({x:e})=>{qR({start:-1,end:tx(1),name:"y",condition:"<="},({y:t})=>{qR({start:-1,end:tx(1),name:"z",condition:"<="},({z:n})=>{const s=ex(nk(u,e,t,n,a,o,l,i,r)).toVar();Kb(s.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(s)}).ElseIf(s.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(s)}).ElseIf(s.lessThan(c.z),()=>{c.z.assign(s)})})})}),Kb(r.equal(tx(0)),()=>{c.assign(tS(c))}),c}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hk=TI([sk,ck]),Ak=Qb(([e,t,n,r,i,s,a,o,l,u,c])=>{const h=tx(e).toVar(),A=ix(t).toVar(),d=ix(n).toVar(),p=ix(r).toVar(),f=ex(i).toVar(),m=ex(s).toVar(),g=ex(a).toVar(),_=rx(o).toVar(),v=tx(l).toVar(),y=ex(u).toVar(),b=ex(c).toVar(),x=A.mul(d).add(p),T=ex(0).toVar();return Kb(h.equal(tx(0)),()=>{T.assign(kF(x))}),Kb(h.equal(tx(1)),()=>{T.assign($F(x))}),Kb(h.equal(tx(2)),()=>{T.assign(hk(x,f,tx(0)))}),Kb(h.equal(tx(3)),()=>{T.assign(KF(lx(x,0),v,y,b))}),T.assign(T.mul(g.sub(m)).add(m)),Kb(_,()=>{T.assign(HS(T,m,g))}),T}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),dk=Qb(([e,t,n,r,i,s,a,o,l,u,c])=>{const h=tx(e).toVar(),A=lx(t).toVar(),d=lx(n).toVar(),p=lx(r).toVar(),f=ex(i).toVar(),m=ex(s).toVar(),g=ex(a).toVar(),_=rx(o).toVar(),v=tx(l).toVar(),y=ex(u).toVar(),b=ex(c).toVar(),x=A.mul(d).add(p),T=ex(0).toVar();return Kb(h.equal(tx(0)),()=>{T.assign(kF(x))}),Kb(h.equal(tx(1)),()=>{T.assign($F(x))}),Kb(h.equal(tx(2)),()=>{T.assign(hk(x,f,tx(0)))}),Kb(h.equal(tx(3)),()=>{T.assign(KF(x,v,y,b))}),T.assign(T.mul(g.sub(m)).add(m)),Kb(_,()=>{T.assign(HS(T,m,g))}),T}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),pk=Qb(([e])=>{const t=e.y,n=e.z,r=lx().toVar();return Kb(t.lessThan(1e-4),()=>{r.assign(lx(n,n,n))}).Else(()=>{let i=e.x;i=i.sub(rS(i)).mul(6).toVar();const s=tx(xS(i)),a=i.sub(ex(s)),o=n.mul(t.oneMinus()),l=n.mul(t.mul(a).oneMinus()),u=n.mul(t.mul(a.oneMinus()).oneMinus());Kb(s.equal(tx(0)),()=>{r.assign(lx(n,u,o))}).ElseIf(s.equal(tx(1)),()=>{r.assign(lx(l,n,o))}).ElseIf(s.equal(tx(2)),()=>{r.assign(lx(o,n,u))}).ElseIf(s.equal(tx(3)),()=>{r.assign(lx(o,l,n))}).ElseIf(s.equal(tx(4)),()=>{r.assign(lx(u,o,n))}).Else(()=>{r.assign(lx(n,o,l))})}),r}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),fk=Qb(([e])=>{const t=lx(e).toVar(),n=ex(t.x).toVar(),r=ex(t.y).toVar(),i=ex(t.z).toVar(),s=ex(CS(n,CS(r,i))).toVar(),a=ex(RS(n,RS(r,i))).toVar(),o=ex(a.sub(s)).toVar(),l=ex().toVar(),u=ex().toVar(),c=ex().toVar();return c.assign(a),Kb(a.greaterThan(0),()=>{u.assign(o.div(a))}).Else(()=>{u.assign(0)}),Kb(u.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Kb(n.greaterThanEqual(a),()=>{l.assign(r.sub(i).div(o))}).ElseIf(r.greaterThanEqual(a),()=>{l.assign(pT(2,i.sub(n).div(o)))}).Else(()=>{l.assign(pT(4,n.sub(r).div(o)))}),l.mulAssign(1/6),Kb(l.lessThan(0),()=>{l.addAssign(1)})}),lx(l,u,c)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),mk=Qb(([e])=>{const t=lx(e).toVar(),n=hx(xT(t,lx(.04045))).toVar(),r=lx(t.div(12.92)).toVar(),i=lx(OS(RS(t.add(lx(.055)),lx(0)).div(1.055),lx(2.4))).toVar();return GS(r,i,n)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),gk=(e,t)=>{e=ex(e),t=ex(t);const n=ix(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return XS(e.sub(n),e.add(n),t)},_k=(e,t,n,r)=>GS(e,t,n[r].clamp()),vk=(e,t,n,r,i)=>GS(e,t,gk(n,r[i])),yk=Qb(([e,t,n])=>{const r=sS(e).toVar(),i=fT(ex(.5).mul(t.sub(n)),pE).div(r).toVar(),s=fT(ex(-.5).mul(t.sub(n)),pE).div(r).toVar(),a=lx().toVar();a.x=r.x.greaterThan(ex(0)).select(i.x,s.x),a.y=r.y.greaterThan(ex(0)).select(i.y,s.y),a.z=r.z.greaterThan(ex(0)).select(i.z,s.z);const o=CS(a.x,a.y,a.z).toVar();return pE.add(r.mul(o)).toVar().sub(n)}),bk=Qb(([e,t])=>{const n=e.x,r=e.y,i=e.z;let s=t.element(0).mul(.886227);return s=s.add(t.element(1).mul(1.023328).mul(r)),s=s.add(t.element(2).mul(1.023328).mul(i)),s=s.add(t.element(3).mul(1.023328).mul(n)),s=s.add(t.element(4).mul(.858086).mul(n).mul(r)),s=s.add(t.element(5).mul(.858086).mul(r).mul(i)),s=s.add(t.element(6).mul(i.mul(i).mul(.743125).sub(.247708))),s=s.add(t.element(7).mul(.858086).mul(n).mul(i)),s=s.add(t.element(8).mul(.429043).mul(mT(n,n).sub(mT(r,r)))),s});var xk=Object.freeze({__proto__:null,BRDF_GGX:dP,BRDF_Lambert:ZN,BasicPointShadowFilter:FB,BasicShadowFilter:yB,Break:VR,Const:Aw,Continue:()=>$w("continue").toStack(),DFGApprox:mP,D_GGX:cP,Discard:Yw,EPSILON:VT,F_Schlick:KN,Fn:Qb,HALF_PI:WT,INFINITY:zT,If:Kb,Loop:qR,NodeAccess:zy,NodeShaderStage:qy,NodeType:{BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},NodeUpdateType:Vy,OnBeforeMaterialUpdate:e=>uU(lU.BEFORE_MATERIAL,e),OnBeforeObjectUpdate:e=>uU(lU.BEFORE_OBJECT,e),OnMaterialUpdate:e=>uU(lU.MATERIAL,e),OnObjectUpdate:e=>uU(lU.OBJECT,e),PCFShadowFilter:bB,PCFSoftShadowFilter:xB,PI:GT,PI2:HT,PointShadowFilter:kB,Return:()=>$w("return").toStack(),Schlick_to_F0:vP,ScriptableNodeResources:lO,ShaderNode:Fb,Stack:Zb,Switch:(...e)=>lb.Switch(...e),TBNViewMatrix:TC,TWO_PI:jT,VSMShadowFilter:TB,V_GGX_SmithCorrelated:lP,Var:hw,VarIntent:dw,abs:dS,acesFilmicToneMapping:QU,acos:hS,add:pT,addMethodChaining:cb,addNodeElement:function(e){Rt("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:ZU,all:XT,alphaT:Ux,and:wT,anisotropy:Ox,anisotropyB:Fx,anisotropyT:Bx,any:QT,append:e=>(Rt("TSL: append() has been renamed to Stack()."),Zb(e)),array:oT,arrayBuffer:e=>kb(new ab(e,"ArrayBuffer")),asin:cS,assign:uT,atan:AS,atan2:JS,atomicAdd:(e,t)=>PO(RO.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>PO(RO.ATOMIC_AND,e,t),atomicFunc:PO,atomicLoad:e=>PO(RO.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>PO(RO.ATOMIC_MAX,e,t),atomicMin:(e,t)=>PO(RO.ATOMIC_MIN,e,t),atomicOr:(e,t)=>PO(RO.ATOMIC_OR,e,t),atomicStore:(e,t)=>PO(RO.ATOMIC_STORE,e,t),atomicSub:(e,t)=>PO(RO.ATOMIC_SUB,e,t),atomicXor:(e,t)=>PO(RO.ATOMIC_XOR,e,t),attenuationColor:Yx,attenuationDistance:$x,attribute:sM,attributeArray:(e,t="float")=>{let n,r;!0===t.isStruct?(n=t.layout.getLength(),r=Py("float")):(n=Dy(t),r=Py(t));const i=new hU(e,n,r);return UR(i,t,e)},backgroundBlurriness:gU,backgroundIntensity:_U,backgroundRotation:vU,batch:PR,bentNormalView:wC,billboarding:RI,bitAnd:RT,bitNot:NT,bitOr:PT,bitXor:DT,bitangentGeometry:vC,bitangentLocal:yC,bitangentView:bC,bitangentWorld:xC,bitcast:fI,blendBurn:yN,blendColor:SN,blendDodge:bN,blendOverlay:TN,blendScreen:xN,blur:_D,bool:rx,buffer:gM,bufferAttribute:Lw,builtin:bM,bumpMap:PC,burn:(...e)=>(Rt('TSL: "burn" has been renamed. Use "blendBurn" instead.'),yN(e)),bvec2:ox,bvec3:hx,bvec4:fx,bypass:Hw,cache:zw,call:hT,cameraFar:OM,cameraIndex:IM,cameraNear:UM,cameraNormalMatrix:VM,cameraPosition:zM,cameraProjectionMatrix:BM,cameraProjectionMatrixInverse:FM,cameraViewMatrix:kM,cameraViewport:GM,cameraWorldMatrix:qM,cbrt:VS,cdl:OU,ceil:iS,checker:YB,cineonToneMapping:WU,clamp:HS,clearcoat:Cx,clearcoatNormalView:RE,clearcoatRoughness:Rx,code:tO,color:Jb,colorSpaceToWorking:Sw,colorToDirection:e=>kb(e).mul(2).sub(1),compute:kw,computeKernel:Fw,computeSkinning:(e,t=null)=>{const n=new BR(e);return n.positionNode=UR(new Hi(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(bR).toVar(),n.skinIndexNode=UR(new Hi(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(bR).toVar(),n.skinWeightNode=UR(new Hi(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(bR).toVar(),n.bindMatrixNode=sT(e.bindMatrix,"mat4"),n.bindMatrixInverseNode=sT(e.bindMatrixInverse,"mat4"),n.boneMatricesNode=gM(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),n.toPositionNode=t,kb(n)},context:sw,convert:yx,convertColorSpace:(e,t,n)=>kb(new xw(kb(e),t,n)),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():nU(e,...t),cos:lS,cross:US,cubeTexture:XE,cubeTextureBase:WE,cubeToUV:BB,dFdx:_S,dFdy:vS,dashSize:Gx,debug:eM,decrement:FT,decrementBefore:OT,defaultBuildStages:Hy,defaultShaderStages:Gy,defined:Ob,degrees:YT,deltaTime:wI,densityFog:function(e,t){return Rt('TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),pO(e,dO(t))},densityFogFactor:dO,depth:hN,depthPass:(e,t,n)=>kb(new zU(zU.DEPTH,e,t,n)),determinant:wS,difference:LS,diffuseColor:Sx,directPointLight:QB,directionToColor:UN,directionToFaceDirection:bE,dispersion:Kx,distance:DS,div:gT,dodge:(...e)=>(Rt('TSL: "dodge" has been renamed. Use "blendDodge" instead.'),bN(e)),dot:IS,drawIndex:wR,dynamicBufferAttribute:Iw,element:vx,emissive:wx,equal:vT,equals:ES,equirectUV:FN,exp:KT,exp2:ZT,expression:$w,faceDirection:yE,faceForward:QS,faceforward:ew,float:ex,floatBitsToInt:e=>new pI(e,"int","float"),floatBitsToUint:e=>new pI(e,"uint","float"),floor:rS,fog:pO,fract:aS,frameGroup:tT,frameId:MI,frontFacing:vE,fwidth:TS,gain:(e,t)=>e.lessThan(.5)?gI(e.mul(2),t).div(2):fT(1,gI(mT(fT(1,e),2),t).div(2)),gapSize:Hx,getConstNodeType:Bb,getCurrentStack:Yb,getDirection:pD,getDistanceAttenuation:XB,getGeometryRoughness:aP,getNormalFromDepth:sU,getParallaxCorrectNormal:yk,getRoughness:oP,getScreenPosition:iU,getShIrradianceAt:bk,getShadowMaterial:wB,getShadowRenderObjectFunction:CB,getTextureIndex:hI,getViewPosition:rU,ggxConvolution:xD,globalId:TO,glsl:(e,t)=>tO(e,t,"glsl"),glslFn:(e,t)=>rO(e,t,"glsl"),grayscale:PU,greaterThan:xT,greaterThanEqual:ST,hash:mI,highpModelNormalViewMatrix:cE,highpModelViewMatrix:uE,hue:IU,increment:BT,incrementBefore:UT,inspector:rM,instance:ER,instanceIndex:bR,instancedArray:(e,t="float")=>{let n,r;!0===t.isStruct?(n=t.layout.getLength(),r=Py("float")):(n=Dy(t),r=Py(t));const i=new cU(e,n,r);return UR(i,t,e)},instancedBufferAttribute:Uw,instancedDynamicBufferAttribute:Ow,instancedMesh:RR,int:tx,intBitsToFloat:e=>new pI(e,"float","int"),interleavedGradientNoise:aU,inverse:MS,inverseSqrt:nS,inversesqrt:tw,invocationLocalIndex:SR,invocationSubgroupIndex:TR,ior:Wx,iridescence:Dx,iridescenceIOR:Lx,iridescenceThickness:Ix,isolate:Vw,ivec2:sx,ivec3:ux,ivec4:dx,js:(e,t)=>tO(e,t,"js"),label:lw,length:fS,lengthSq:zS,lessThan:bT,lessThanEqual:TT,lightPosition:lB,lightProjectionUV:oB,lightShadowMatrix:aB,lightTargetDirection:hB,lightTargetPosition:uB,lightViewPosition:cB,lightingContext:YR,lights:(e=[])=>kb(new fB).setLights(e),linearDepth:AN,linearToneMapping:HU,localId:SO,log:JT,log2:eS,logarithmicDepthToViewZ:(e,t,n)=>{const r=e.mul(JT(n.div(t)));return ex(Math.E).pow(r).mul(t).negate()},luminance:UU,mat2:mx,mat3:gx,mat4:_x,matcapUV:iL,materialAO:mR,materialAlphaTest:IC,materialAnisotropy:JC,materialAnisotropyVector:gR,materialAttenuationColor:oR,materialAttenuationDistance:aR,materialClearcoat:XC,materialClearcoatNormal:$C,materialClearcoatRoughness:QC,materialColor:UC,materialDispersion:pR,materialEmissive:BC,materialEnvIntensity:FE,materialEnvRotation:kE,materialIOR:sR,materialIridescence:eR,materialIridescenceIOR:tR,materialIridescenceThickness:nR,materialLightMap:fR,materialLineDashOffset:AR,materialLineDashSize:uR,materialLineGapSize:cR,materialLineScale:lR,materialLineWidth:hR,materialMetalness:jC,materialNormal:WC,materialOpacity:FC,materialPointSize:dR,materialReference:JE,materialReflectivity:GC,materialRefractionRatio:BE,materialRotation:YC,materialRoughness:HC,materialSheen:KC,materialSheenRoughness:ZC,materialShininess:OC,materialSpecular:kC,materialSpecularColor:VC,materialSpecularIntensity:qC,materialSpecularStrength:zC,materialThickness:iR,materialTransmission:rR,max:RS,maxMipLevel:cM,mediumpModelViewMatrix:lE,metalness:Ex,min:CS,mix:GS,mixElement:YS,mod:_T,modInt:kT,modelDirection:JM,modelNormalMatrix:sE,modelPosition:tE,modelRadius:iE,modelScale:nE,modelViewMatrix:oE,modelViewPosition:rE,modelViewProjection:_R,modelWorldMatrix:eE,modelWorldMatrixInverse:aE,morphReference:WR,mrt:dI,mul:mT,mx_aastep:gk,mx_add:(e,t=ex(0))=>pT(e,t),mx_atan2:(e=ex(0),t=ex(1))=>AS(e,t),mx_cell_noise_float:(e=aM())=>HF(e.convert("vec2|vec3")),mx_contrast:(e,t=1,n=.5)=>ex(e).sub(n).mul(t).add(n),mx_divide:(e,t=ex(1))=>gT(e,t),mx_fractal_noise_float:(e=aM(),t=3,n=2,r=.5,i=1)=>YF(e,tx(t),n,r).mul(i),mx_fractal_noise_vec2:(e=aM(),t=3,n=2,r=.5,i=1)=>ZF(e,tx(t),n,r).mul(i),mx_fractal_noise_vec3:(e=aM(),t=3,n=2,r=.5,i=1)=>KF(e,tx(t),n,r).mul(i),mx_fractal_noise_vec4:(e=aM(),t=3,n=2,r=.5,i=1)=>JF(e,tx(t),n,r).mul(i),mx_frame:()=>MI,mx_heighttonormal:(e,t)=>(e=lx(e),t=ex(t),PC(e,t)),mx_hsvtorgb:pk,mx_ifequal:(e,t,n,r)=>e.equal(t).mix(n,r),mx_ifgreater:(e,t,n,r)=>e.greaterThan(t).mix(n,r),mx_ifgreatereq:(e,t,n,r)=>e.greaterThanEqual(t).mix(n,r),mx_invert:(e,t=ex(1))=>fT(t,e),mx_modulo:(e,t=ex(1))=>_T(e,t),mx_multiply:(e,t=ex(1))=>mT(e,t),mx_noise_float:(e=aM(),t=1,n=0)=>OF(e.convert("vec2|vec3")).mul(t).add(n),mx_noise_vec3:(e=aM(),t=1,n=0)=>kF(e.convert("vec2|vec3")).mul(t).add(n),mx_noise_vec4:(e=aM(),t=1,n=0)=>{e=e.convert("vec2|vec3");return Ax(kF(e),OF(e.add(ix(19,73)))).mul(t).add(n)},mx_place2d:(e,t=ix(.5,.5),n=ix(1,1),r=ex(0),i=ix(0,0))=>{let s=e;if(t&&(s=s.sub(t)),n&&(s=s.mul(n)),r){const e=r.mul(Math.PI/180),t=e.cos(),n=e.sin();s=ix(s.x.mul(t).sub(s.y.mul(n)),s.x.mul(n).add(s.y.mul(t)))}return t&&(s=s.add(t)),i&&(s=s.add(i)),s},mx_power:(e,t=ex(1))=>OS(e,t),mx_ramp4:(e,t,n,r,i=aM())=>{const s=i.x.clamp(),a=i.y.clamp(),o=GS(e,t,s),l=GS(n,r,s);return GS(o,l,a)},mx_ramplr:(e,t,n=aM())=>_k(e,t,n,"x"),mx_ramptb:(e,t,n=aM())=>_k(e,t,n,"y"),mx_rgbtohsv:fk,mx_rotate2d:(e,t)=>{e=ix(e);const n=(t=ex(t)).mul(Math.PI/180);return lL(e,n)},mx_rotate3d:(e,t,n)=>{e=lx(e),t=ex(t),n=lx(n);const r=t.mul(Math.PI/180),i=n.normalize(),s=r.cos(),a=r.sin(),o=ex(1).sub(s);return e.mul(s).add(i.cross(e).mul(a)).add(i.mul(i.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=ex(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){const n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},r=t.replace(/^out/,"").toLowerCase();if(void 0!==n[r])return e.element(n[r])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){const n={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==n[t])return e.element(n[t])}return e},mx_splitlr:(e,t,n,r=aM())=>vk(e,t,n,r,"x"),mx_splittb:(e,t,n,r=aM())=>vk(e,t,n,r,"y"),mx_srgb_texture_to_lin_rec709:mk,mx_subtract:(e,t=ex(0))=>fT(e,t),mx_timer:()=>SI,mx_transform_uv:(e=1,t=0,n=aM())=>n.mul(e).add(t),mx_unifiednoise2d:(e,t=aM(),n=ix(1,1),r=ix(0,0),i=1,s=0,a=1,o=!1,l=1,u=2,c=.5)=>Ak(e,t.convert("vec2|vec3"),n,r,i,s,a,o,l,u,c),mx_unifiednoise3d:(e,t=aM(),n=ix(1,1),r=ix(0,0),i=1,s=0,a=1,o=!1,l=1,u=2,c=.5)=>dk(e,t.convert("vec2|vec3"),n,r,i,s,a,o,l,u,c),mx_worley_noise_float:(e=aM(),t=1)=>ok(e.convert("vec2|vec3"),t,tx(1)),mx_worley_noise_vec2:(e=aM(),t=1)=>uk(e.convert("vec2|vec3"),t,tx(1)),mx_worley_noise_vec3:(e=aM(),t=1)=>hk(e.convert("vec2|vec3"),t,tx(1)),negate:mS,neutralToneMapping:JU,nodeArray:zb,nodeImmutable:Hb,nodeObject:kb,nodeObjectIntent:qb,nodeObjects:Vb,nodeProxy:Gb,nodeProxyIntent:jb,normalFlat:SE,normalGeometry:xE,normalLocal:TE,normalMap:EC,normalView:EE,normalViewGeometry:wE,normalWorld:CE,normalWorldGeometry:ME,normalize:sS,not:ET,notEqual:yT,numWorkgroups:bO,objectDirection:WM,objectGroup:rT,objectPosition:QM,objectRadius:KM,objectScale:$M,objectViewPosition:YM,objectWorldMatrix:XM,oneMinus:gS,or:MT,orthographicDepthToViewZ:(e,t,n)=>t.sub(n).mul(e).sub(t),oscSawtooth:(e=SI)=>e.fract(),oscSine:(e=SI)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=SI)=>e.fract().round(),oscTriangle:(e=SI)=>e.add(.5).fract().mul(2).sub(1).abs(),output:zx,outputStruct:cI,overlay:(...e)=>(Rt('TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),TN(e)),overloadingFn:TI,parabola:gI,parallaxDirection:SC,parallaxUV:(e,t)=>e.sub(SC.mul(t)),parameter:(e,t)=>kb(new iI(e,t)),pass:(e,t,n)=>kb(new zU(zU.COLOR,e,t,n)),passTexture:(e,t)=>kb(new qU(e,t)),pcurve:(e,t,n)=>OS(gT(OS(e,t),pT(OS(e,t),OS(fT(1,e),n))),1/t),perspectiveDepthToViewZ:lN,pmremTexture:jD,pointShadow:jB,pointUV:dU,pointWidth:jx,positionGeometry:hE,positionLocal:AE,positionPrevious:dE,positionView:mE,positionViewDirection:gE,positionWorld:pE,positionWorldDirection:fE,posterize:FU,pow:OS,pow2:BS,pow3:FS,pow4:kS,premultiplyAlpha:wN,property:xx,quadBroadcast:rB,quadSwapDiagonal:KO,quadSwapX:$O,quadSwapY:YO,radians:$T,rand:$S,range:_O,rangeFog:function(e,t,n){return Rt('TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),pO(e,AO(t,n))},rangeFogFactor:AO,reciprocal:bS,reference:YE,referenceBuffer:KE,reflect:PS,reflectVector:zE,reflectView:qE,reflector:e=>kb(new QI(e)),refract:WS,refractVector:GE,refractView:VE,reinhardToneMapping:jU,remap:Ww,remapClamp:Xw,renderGroup:nT,renderOutput:Zw,rendererReference:Cw,rotate:lL,rotateUV:EI,roughness:Mx,round:yS,rtt:nU,sRGBTransferEOTF:vw,sRGBTransferOETF:yw,sample:(e,t=null)=>kb(new oU(e,kb(t))),sampler:e=>(!0===e.isNode?e:pM(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:pM(e)).convert("samplerComparison"),saturate:jS,saturation:DU,screen:(...e)=>(Rt('TSL: "screen" has been renamed. Use "blendScreen" instead.'),xN(e)),screenCoordinate:CM,screenDPR:wM,screenSize:EM,screenUV:MM,scriptable:cO,scriptableValue:sO,select:rw,setCurrentStack:$b,setName:ow,shaderStages:jy,shadow:UB,shadowPositionWorld:gB,shapeCircle:KB,sharedUniformGroup:eT,sheen:Nx,sheenRoughness:Px,shiftLeft:LT,shiftRight:IT,shininess:Vx,sign:pS,sin:oS,sinc:(e,t)=>oS(GT.mul(t.mul(e).sub(1))).div(GT.mul(t.mul(e).sub(1))),skinning:FR,smoothstep:XS,smoothstepElement:KS,specularColor:kx,specularF90:qx,spherizeUV:CI,split:(e,t)=>kb(new tb(kb(e),t)),spritesheetUV:DI,sqrt:tS,stack:aI,step:NS,stepElement:ZS,storage:UR,storageBarrier:()=>MO("storage").toStack(),storageObject:(e,t,n)=>(Rt('TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),UR(e,t,n).setPBO(!0)),storageTexture:bU,string:(e="")=>kb(new ab(e,"string")),struct:(e,t=null)=>{const n=new oI(e,t),r=(...t)=>{let r=null;if(t.length>0)if(t[0].isNode){r={};const n=Object.keys(e);for(let e=0;eMO("texture").toStack(),textureBicubic:FP,textureBicubicLevel:BP,textureCubeUV:fD,textureLevel:(e,t,n)=>pM(e,t).level(n),textureLoad:fM,textureSize:lM,textureStore:(e,t,n)=>{const r=bU(e,t,n);return null!==n&&r.toStack(),r},thickness:Qx,time:SI,toneMapping:Nw,toneMappingExposure:Pw,toonOutlinePass:(e,t,n=new Or(0,0,0),r=.003,i=1)=>kb(new GU(e,t,kb(n),kb(r),kb(i))),transformDirection:qS,transformNormal:NE,transformNormalToView:PE,transformedClearcoatNormalView:IE,transformedNormalView:DE,transformedNormalWorld:LE,transmission:Xx,transpose:SS,triNoise3D:yI,triplanarTexture:(...e)=>LI(...e),triplanarTextures:LI,trunc:xS,uint:nx,uintBitsToFloat:e=>new pI(e,"float","uint"),uniform:sT,uniformArray:yM,uniformCubeTexture:(e=HE)=>WE(e),uniformFlow:aw,uniformGroup:Jx,uniformTexture:(e=hM)=>pM(e),unpremultiplyAlpha:MN,userData:(e,t,n)=>kb(new wU(e,t,n)),uv:aM,uvec2:ax,uvec3:cx,uvec4:px,varying:gw,varyingProperty:Tx,vec2:ix,vec3:lx,vec4:Ax,vectorComponents:Wy,velocity:NU,vertexColor:vN,vertexIndex:yR,vertexStage:_w,vibrance:LU,viewZToLogarithmicDepth:uN,viewZToOrthographicDepth:aN,viewZToPerspectiveDepth:oN,viewport:RM,viewportCoordinate:PM,viewportDepthTexture:iN,viewportLinearDepth:dN,viewportMipTexture:tN,viewportResolution:LM,viewportSafeUV:NI,viewportSharedTexture:IN,viewportSize:NM,viewportTexture:eN,viewportUV:DM,wgsl:(e,t)=>tO(e,t,"wgsl"),wgslFn:(e,t)=>rO(e,t,"wgsl"),workgroupArray:(e,t)=>kb(new CO("Workgroup",e,t)),workgroupBarrier:()=>MO("workgroup").toStack(),workgroupId:xO,workingToColorSpace:Tw,xor:CT});const Tk=new rI;class Sk extends SL{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){const r=this.renderer,i=this.nodes.getBackgroundNode(e)||e.background;let s=!1;if(null===i)r._clearColor.getRGB(Tk),Tk.a=r._clearColor.a;else if(!0===i.isColor)i.getRGB(Tk),Tk.a=1,s=!0;else if(!0===i.isNode){const o=this.get(e),l=i;Tk.copy(r._clearColor);let u=o.backgroundMesh;if(void 0===u){const h=sw(Ax(l).mul(_U),{getUV:()=>vU.mul(ME),getTextureLevel:()=>gU});let A=_R;A=A.setZ(A.w);const d=new EN;function p(){i.removeEventListener("dispose",p),u.material.dispose(),u.geometry.dispose()}d.name="Background.material",d.side=1,d.depthTest=!1,d.depthWrite=!1,d.allowOverride=!1,d.fog=!1,d.lights=!1,d.vertexNode=A,d.colorNode=h,o.backgroundMeshNode=h,o.backgroundMesh=u=new _i(new wa(1,32,32),d),u.frustumCulled=!1,u.name="Background.mesh",u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},i.addEventListener("dispose",p)}const c=l.getCacheKey();o.backgroundCacheKey!==c&&(o.backgroundMeshNode.node=Ax(l).mul(_U),o.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,o.backgroundCacheKey=c),t.unshift(u,u.geometry,u.material,0,0,null,null)}else Nt("Renderer: Unsupported background configuration.",i);const a=r.xr.getEnvironmentBlendMode();if("additive"===a?Tk.set(0,0,0,1):"alpha-blend"===a&&Tk.set(0,0,0,0),!0===r.autoClear||!0===s){const f=n.clearColorValue;f.r=Tk.r,f.g=Tk.g,f.b=Tk.b,f.a=Tk.a,!0!==r.backend.isWebGLBackend&&!0!==r.alpha||(f.r*=f.a,f.g*=f.a,f.b*=f.a),n.depthClearValue=r._clearDepth,n.stencilClearValue=r._clearStencil,n.clearColor=!0===r.autoClearColor,n.clearDepth=!0===r.autoClearDepth,n.clearStencil=!0===r.autoClearStencil}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}}let wk=0;class Mk{constructor(e="",t=[],n=0,r=[]){this.name=e,this.bindings=t,this.index=n,this.bindingsReference=r,this.id=wk++}}class Ek{constructor(e,t,n,r,i,s,a,o,l,u=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=u,this.nodeAttributes=r,this.bindings=i,this.updateNodes=s,this.updateBeforeNodes=a,this.updateAfterNodes=o,this.observer=l,this.usedTimes=0}createBindings(){const e=[];for(const t of this.bindings){if(!0!==t.bindings[0].groupNode.shared){const n=new Mk(t.name,[],t.index,t.bindingsReference);e.push(n);for(const e of t.bindings)n.bindings.push(e.clone())}else e.push(t)}return e}}class Ck{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}}class Rk{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class Nk{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}}class Pk extends Nk{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}}class Dk{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}}let Lk=0;class Ik{constructor(e=null){this.id=Lk++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class Uk{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class Ok{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0}setValue(e){this.value=e}getValue(){return this.value}}class Bk extends Ok{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class Fk extends Ok{constructor(e,t=new Ht){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class kk extends Ok{constructor(e,t=new Wt){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class qk extends Ok{constructor(e,t=new An){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class Vk extends Ok{constructor(e,t=new Or){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class zk extends Ok{constructor(e,t=new xo){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class Gk extends Ok{constructor(e,t=new $t){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class Hk extends Ok{constructor(e,t=new Hn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class jk extends Bk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Wk extends Fk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Xk extends kk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Qk extends qk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class $k extends Vk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Yk extends zk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Kk extends Gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class Zk extends Hk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}let Jk=0;const eq=new WeakMap,tq=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),nq=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class rq{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=aI(),this.stacks=[],this.tab="\t",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Ik,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:Jk++})}isOpaque(){const e=this.material;return!1===e.transparent&&1===e.blending&&!1===e.alphaToCoverage}getBindGroupsCache(){let e=eq.get(this.renderer);return void 0===e&&(e=new vL,eq.set(this.renderer,e)),e}createRenderTarget(e,t,n){return new dn(e,t,n)}createCubeRenderTarget(e,t){return new kN(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){const n=this.getBindGroupsCache(),r=[];let i,s=!0;for(const e of t)r.push(e),s=s&&!0!==e.groupNode.shared;return s?(i=n.get(r),void 0===i&&(i=new Mk(e,r,this.bindingsIndexes[e].group,r),n.set(r,i))):i=new Mk(e,r,this.bindingsIndexes[e].group,r),i}getBindGroupArray(e,t){const n=this.bindings[t];let r=n[e];return void 0===r&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(null===e){const t={},n=this.bindings;for(const e of jy)for(const r in n[e]){const i=n[e][r];(t[r]||(t[r]=[])).push(...i)}e=[];for(const n in t){const r=t[n],i=this._getBindGroup(n,r);e.push(i)}this.bindGroups=e}return e}sortBindingGroups(){const e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t=0?`${Math.round(t)}u`:"0u";if("bool"===e)return t?"true":"false";if("color"===e)return`${this.getType("vec3")}( ${nq(t.r)}, ${nq(t.g)}, ${nq(t.b)} )`;const n=this.getTypeLength(e),r=this.getComponentType(e),i=e=>this.generateConst(r,e);if(2===n)return`${this.getType(e)}( ${i(t.x)}, ${i(t.y)} )`;if(3===n)return`${this.getType(e)}( ${i(t.x)}, ${i(t.y)}, ${i(t.z)} )`;if(4===n&&"mat2"!==e)return`${this.getType(e)}( ${i(t.x)}, ${i(t.y)}, ${i(t.z)}, ${i(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(i).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){const n=this.attributes;for(const t of n)if(t.name===e)return t;const r=new Ck(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){const t=e.type;if(e.isDataTexture){if(t===ae)return"int";if(t===oe)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;const t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let n=Ny(e);const r="float"===t?"":t[0];return!0===/mat2/.test(t)&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return tq.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);const n=t.array,r=e.itemSize,i=e.normalized;let s;return e instanceof Kr||!0===i||(s=this.getTypeFromArray(n)),this.getTypeFromLength(r,s)}getTypeLength(e){const t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return null!==n?Number(n[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:!0===/mat4/.test(e)?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){const t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]!==e)throw new Error("NodeBuilder: Invalid active stack removal.");this.activeStacks.pop()}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=aI(this.stack);const e=Yb();return this.stacks.push(e),$b(this.stack),this.stack}removeStack(){const e=this.stack;for(const t of e.nodes){this.getDataFromNode(t).stack=e}return this.stack=e.parent,$b(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){let r=(n=null===n?e.isGlobal(this)?this.globalCache:this.cache:n).getData(e);void 0===r&&(r={},n.setData(e,r)),void 0===r[t]&&(r[t]={});let i=r[t];const s=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(s);return a&&(void 0===i.subBuildsCache&&(i.subBuildsCache={}),i=i.subBuildsCache[a]||(i.subBuildsCache[a]={}),i.subBuilds=s),i}getNodeProperties(e,t="any"){const n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t){const n=this.getDataFromNode(e);let r=n.bufferAttribute;if(void 0===r){const i=this.uniforms.index++;r=new Ck("nodeAttribute"+i,t,e),this.bufferAttributes.push(r),n.bufferAttribute=r}return r}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){const i=this.getDataFromNode(e,r,this.globalCache);let s=i.structType;if(void 0===s){const a=this.structs.index++;null===n&&(n="StructType"+a),s=new Uk(n,t),this.structs[r].push(s),this.types[r][n]=e,i.structType=s}return s}getOutputStructTypeFromNode(e,t){const n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){const i=this.getDataFromNode(e,n,this.globalCache);let s=i.uniform;if(void 0===s){const a=this.uniforms.index++;s=new Rk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(s),this.registerDeclaration(s),i.uniform=s}return s}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,i=!1){const s=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",s.subBuilds);let o=s[a];if(void 0===o){const l=i?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),c=this.vars[l]||(this.vars[l]=0);null===t&&(t=(i?"nodeConst":"nodeVar")+c,this.vars[l]++),"variable"!==a&&(t=this.getSubBuildProperty(t,s.subBuilds));const h=e.getArrayCount(this);o=new Nk(t,n,i,h),i||u.push(o),this.registerDeclaration(o),s[a]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values)for(const t of e.values)if(!this.isDeterministic(t))return!1;return!0}return!!e.isConstNode}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,i=null){const s=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",s.subBuilds);let o=s[a];if(void 0===o){const e=this.varyings,l=e.length;null===t&&(t="nodeVarying"+l),"varying"!==a&&(t=this.getSubBuildProperty(t,s.subBuilds)),o=new Pk(t,n,r,i),e.push(o),this.registerDeclaration(o),s[a]=o}return o}registerDeclaration(e){const t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=this.getPropertyName(e);let i=1,s=r;for(;void 0!==n[s];)s=r+"_"+i++;i>1&&(e.name=s,Rt(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`)),n[s]=e}getCodeFromNode(e,t,n=this.shaderStage){const r=this.getDataFromNode(e);let i=r.code;if(void 0===i){const e=this.codes[n]||(this.codes[n]=[]),s=e.length;i=new Dk("nodeCode"+s,t),e.push(i),r.code=i}return i}addFlowCodeHierarchy(e,t){const{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e);let i=!0,s=t;for(;s;){if(!0===r.get(s)){i=!1;break}s=this.getDataFromNode(s).parentNodeBlock}if(i)for(const e of n)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,n){const r=this.getDataFromNode(e),i=r.flowCodes||(r.flowCodes=[]),s=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);i.push(t),s.set(n,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+="\t",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){const t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){const t=new nO,n=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=n,t}flowShaderNode(e){const t=e.layout,n={[Symbol.iterator](){let e=0;const t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};for(const e of t.inputs)n[e.name]=new iI(e.type,e.name);e.layout=null;const r=e.call(n),i=this.flowStagesNode(r,t.type);return e.layout=t,i}flowBuildStage(e,t,n=null){const r=this.getBuildStage();this.setBuildStage(t);const i=e.build(this,n);return this.setBuildStage(r),i}flowStagesNode(e,t=null){const n=this.flow,r=this.vars,i=this.declarations,s=this.cache,a=this.buildStage,o=this.stack,l={code:""};this.flow=l,this.vars={},this.declarations={},this.cache=new Ik,this.stack=aI();for(const n of Hy)this.setBuildStage(n),l.result=e.build(this,t);return l.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=i,this.cache=s,this.stack=o,this.setBuildStage(a),l}getFunctionOperator(){return null}buildFunctionCode(){Rt("Abstract function.")}flowChildNode(e,t=null){const n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){const i=this.tab,s=this.cache,a=this.shaderStage,o=this.context;this.setShaderStage(e);const l={...this.context};delete l.nodeBlock,this.cache=this.globalCache,this.tab="\t",this.context=l;let u=null;if("generate"===this.buildStage){const i=this.flowChildNode(t,n);null!==r&&(i.code+=`${this.tab+r} = ${i.result};\n`),this.flowCode[e]=this.flowCode[e]+i.code,u=i}else u=t.build(this);return this.setShaderStage(a),this.cache=s,this.tab=i,this.context=o,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Rt("Abstract function.")}getVaryings(){Rt("Abstract function.")}getVar(e,t,n=null){return`${null!==n?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e){let t="";const n=this.vars[e];if(void 0!==n)for(const e of n)t+=`${this.getVar(e.type,e.name)}; `;return t}getUniforms(){Rt("Abstract function.")}getCodes(e){const t=this.codes[e];let n="";if(void 0!==t)for(const e of t)n+=e.code+"\n";return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Rt("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e,!t)return null;const n=this.subBuildLayers;for(let e=t.length-1;e>=0;e--){const r=t[e];if(n.includes(r))return r}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n,r;return n=null!==t?this.getClosestSubBuild(t):this.subBuildFn,r=n?e?n+"_"+e:n:e,r}build(){const{object:e,material:t,renderer:n}=this;if(null!==t){let e=n.library.fromMaterial(t);null===e&&(Nt(`NodeMaterial: Material "${t.type}" is not compatible.`),e=new EN),e.build(this)}else this.addFlow("compute",e);for(const e of Hy){this.setBuildStage(e),this.context.vertex&&this.context.vertex.isNode&&this.flowNodeFromShaderStage("vertex",this.context.vertex);for(const t of jy){this.setShaderStage(t);const n=this.flowNodes[t];for(const t of n)"generate"===e?this.flowNode(t):t.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getNodeUniform(e,t){if("float"===t||"int"===t||"uint"===t)return new jk(e);if("vec2"===t||"ivec2"===t||"uvec2"===t)return new Wk(e);if("vec3"===t||"ivec3"===t||"uvec3"===t)return new Xk(e);if("vec4"===t||"ivec4"===t||"uvec4"===t)return new Qk(e);if("color"===t)return new $k(e);if("mat2"===t)return new Yk(e);if("mat3"===t)return new Kk(e);if("mat4"===t)return new Zk(e);throw new Error(`Uniform "${t}" not declared.`)}format(e,t,n){if((t=this.getVectorType(t))===(n=this.getVectorType(n))||null===n||this.isReference(n))return e;const r=this.getTypeLength(t),i=this.getTypeLength(n);return 16===r&&9===i?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===r&&4===i?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||i>4||0===i?e:r===i?`${this.getType(n)}( ${e} )`:r>i?(e="bool"===n?`all( ${e} )`:`${e}.${"xyz".slice(0,i)}`,this.format(e,this.getTypeFromLength(i,this.getComponentType(t)),n)):4===i&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===r?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===r&&i>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${s} - Node System\n`}}class iq{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return void 0===n&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){const t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===Vy.FRAME){const t=this._getMaps(this.updateBeforeMap,n);t.frameId!==this.frameId&&!1!==e.updateBefore(this)&&(t.frameId=this.frameId)}else if(t===Vy.RENDER){const t=this._getMaps(this.updateBeforeMap,n);t.renderId!==this.renderId&&!1!==e.updateBefore(this)&&(t.renderId=this.renderId)}else t===Vy.OBJECT&&e.updateBefore(this)}updateAfterNode(e){const t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===Vy.FRAME){const t=this._getMaps(this.updateAfterMap,n);t.frameId!==this.frameId&&!1!==e.updateAfter(this)&&(t.frameId=this.frameId)}else if(t===Vy.RENDER){const t=this._getMaps(this.updateAfterMap,n);t.renderId!==this.renderId&&!1!==e.updateAfter(this)&&(t.renderId=this.renderId)}else t===Vy.OBJECT&&e.updateAfter(this)}updateNode(e){const t=e.getUpdateType(),n=e.updateReference(this);if(t===Vy.FRAME){const t=this._getMaps(this.updateMap,n);t.frameId!==this.frameId&&!1!==e.update(this)&&(t.frameId=this.frameId)}else if(t===Vy.RENDER){const t=this._getMaps(this.updateMap,n);t.renderId!==this.renderId&&!1!==e.update(this)&&(t.renderId=this.renderId)}else t===Vy.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class sq{constructor(e,t,n=null,r="",i=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=i}}sq.isNodeFunctionInput=!0;class aq extends WB{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){const e=this.colorNode;return{lightDirection:hB(this.light),lightColor:e}}}const oq=new Hn,lq=new Hn;let uq=null;class cq extends WB{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=sT(new Wt).setGroup(nT),this.halfWidth=sT(new Wt).setGroup(nT),this.updateType=Vy.RENDER}update(e){super.update(e);const{light:t}=this,n=e.camera.matrixWorldInverse;lq.identity(),oq.copy(t.matrixWorld),oq.premultiply(n),lq.extractRotation(oq),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(lq),this.halfHeight.value.applyMatrix4(lq)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=pM(uq.LTC_FLOAT_1),n=pM(uq.LTC_FLOAT_2)):(t=pM(uq.LTC_HALF_1),n=pM(uq.LTC_HALF_2));const{colorNode:r,light:i}=this;return{lightColor:r,lightPosition:cB(i),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){uq=e}}class hq extends WB{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=sT(0).setGroup(nT),this.penumbraCosNode=sT(0).setGroup(nT),this.cutoffDistanceNode=sT(0).setGroup(nT),this.decayExponentNode=sT(0).setGroup(nT),this.colorNode=sT(this.color).setGroup(nT)}update(e){super.update(e);const{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){const{coneCosNode:n,penumbraCosNode:r}=this;return XS(n,r,t)}getLightCoord(e){const t=e.getNodeProperties(this);let n=t.projectionUV;return void 0===n&&(n=oB(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){const{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:i}=this,s=this.getLightVector(e),a=s.normalize(),o=a.dot(hB(i)),l=this.getSpotAttenuation(e,o),u=s.length(),c=XB({lightDistance:u,cutoffDistance:n,decayExponent:r});let h,A,d=t.mul(l).mul(c);if(i.colorNode?(A=this.getLightCoord(e),h=i.colorNode(A)):i.map&&(A=this.getLightCoord(e),h=pM(i.map,A.xy).onRenderUpdate(()=>i.map)),h){d=A.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(h),d)}return{lightColor:d,lightDirection:a}}}class Aq extends hq{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){const n=this.light.iesMap;let r=null;if(n&&!0===n.isTexture){const e=t.acos().mul(1/Math.PI);r=pM(n,ix(e,0),0).r}else r=super.getSpotAttenuation(t);return r}}const dq=Qb(([e,t])=>{const n=e.abs().sub(t);return fS(RS(n,0)).add(CS(RS(n.x,n.y),0))});class pq extends hq{static get type(){return"ProjectorLightNode"}update(e){super.update(e);const t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){const t=ex(0),n=this.penumbraCosNode,r=aB(this.light).mul(e.context.positionWorld||pE);return Kb(r.w.greaterThan(0),()=>{const e=r.xyz.div(r.w),i=dq(e.xy.sub(ix(.5)),ix(.5)),s=gT(-1,fT(1,hS(n)).sub(1));t.assign(jS(i.mul(-2).mul(s)))}),t}}class fq extends WB{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class mq extends WB{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=lB(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=sT(new Or).setGroup(nT)}update(e){const{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){const{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,i=CE.dot(r).mul(.5).add(.5),s=GS(n,t,i);e.context.irradiance.addAssign(s)}}class gq extends WB{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new Wt);this.lightProbe=yM(t)}update(e){const{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){const t=bk(CE,this.lightProbe);e.context.irradiance.addAssign(t)}}class _q{parseFunction(){Rt("Abstract function.")}}class vq{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Rt("Abstract function.")}}vq.isNodeFunction=!0;const yq=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,bq=/[a-z_0-9]+/gi,xq="#pragma main";class Tq extends vq{constructor(e){const{type:t,inputs:n,name:r,precision:i,inputsCode:s,blockCode:a,headerCode:o}=(e=>{const t=(e=e.trim()).indexOf(xq),n=-1!==t?e.slice(t+12):e,r=n.match(yq);if(null!==r&&5===r.length){const i=r[4],s=[];let a=null;for(;null!==(a=bq.exec(i));)s.push(a);const o=[];let l=0;for(;l{const n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n};let s=t(e.material);try{s.build()}catch(e){s=t(new EN),s.build(),Nt("TSL: "+e)}n=this._createNodeBuilderState(s),r.set(i,n)}n.usedTimes++,t.nodeBuilderState=n}return n}delete(e){if(e.isRenderObject){const t=this.get(e).nodeBuilderState;t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e))}return super.delete(e)}getForCompute(e){const t=this.get(e);let n=t.nodeBuilderState;if(void 0===n){const r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n}return n}_createNodeBuilderState(e){return new Ek(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{const n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{const n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Mq[0]=e,Mq[1]=t;const n=this.renderer.info.calls,r=this.callHashCache.get(Mq)||{};if(r.callId!==n){const i=this.getEnvironmentNode(e),s=this.getFogNode(e);t&&Eq.push(t.getCacheKey(!0)),i&&Eq.push(i.getCacheKey()),s&&Eq.push(s.getCacheKey()),Eq.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Eq.push(this.renderer.shadowMap.enabled?1:0),Eq.push(this.renderer.shadowMap.type),r.callId=n,r.cacheKey=My(Eq),this.callHashCache.set(Mq,r),Eq.length=0}return Mq.length=0,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){const t=this.get(e),n=e.background;if(n){const r=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;if(t.background!==n||r){const i=this.getCacheNode("background",n,()=>{if(!0===n.isCubeTexture||n.mapping===H||n.mapping===j||n.mapping===W){if(e.backgroundBlurriness>0||n.mapping===W)return jD(n);{let e;return e=!0===n.isCubeTexture?XE(n):pM(n),HN(e)}}if(!0===n.isTexture)return pM(n,MM.flipY()).setUpdateMatrix(!0);!0!==n.isColor&&Nt("WebGPUNodes: Unsupported background configuration.",n)},r);t.backgroundNode=i,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){const i=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap);let s=i.get(t);return(void 0===s||r)&&(s=n(),i.set(t,s)),s}updateFog(e){const t=this.get(e),n=e.fog;if(n){if(t.fog!==n){const e=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){const e=YE("color","color",n).setGroup(nT),t=YE("density","float",n).setGroup(nT);return pO(e,dO(t))}if(n.isFog){const e=YE("color","color",n).setGroup(nT),t=YE("near","float",n).setGroup(nT),r=YE("far","float",n).setGroup(nT);return pO(e,AO(t,r))}Nt("Renderer: Unsupported fog configuration.",n)});t.fogNode=e,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){const t=this.get(e),n=e.environment;if(n){if(t.environment!==n){const e=this.getCacheNode("environment",n,()=>!0===n.isCubeTexture?XE(n):!0===n.isTexture?pM(n):void Nt("Nodes: Unsupported environment configuration.",n));t.environmentNode=e,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,i=null){const s=this.nodeFrame;return s.renderer=e,s.scene=t,s.object=n,s.camera=r,s.material=i,s}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){const e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}hasOutputChange(e){return wq.get(e)!==this.getOutputCacheKey()}getOutputNode(e){const t=this.renderer,n=this.getOutputCacheKey(),r=e.isArrayTexture?SU(e,lx(MM,bM("gl_ViewID_OVR"))).renderOutput(t.toneMapping,t.currentColorSpace):pM(e,MM).renderOutput(t.toneMapping,t.currentColorSpace);return wq.set(e,n),r}updateBefore(e){const t=e.getNodeBuilderState();for(const n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){const t=e.getNodeBuilderState();for(const n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){const t=this.getNodeFrame(),n=this.getForCompute(e);for(const e of n.updateNodes)t.updateNode(e)}updateForRender(e){const t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(const e of n.updateNodes)t.updateNode(e)}needsRefresh(e){const t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new iq,this.nodeBuilderCache=new Map,this.cacheLib={}}}const Rq=new Qi;class Nq{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new $t,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,n){const r=e.length;for(let i=0;i0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},i=new XRWebGLLayer(e,r,n);this._glBaseLayer=i,e.updateRenderState({baseLayer:i}),t.setPixelRatio(1),t._setXRLayerSize(i.framebufferWidth,i.framebufferHeight),this._xrRenderTarget=new Fq(i.framebufferWidth,i.framebufferHeight,{format:ge,type:ne,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===i.ignoreDepthValues,resolveStencilBuffer:!1===i.ignoreDepthValues}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){const t=this._session;if(null===t)return;const n=e.near,r=e.far,i=this._cameraXR,s=this._cameraL,a=this._cameraR;i.near=a.near=s.near=n,i.far=a.far=s.far=r,i.isMultiViewCamera=this._useMultiview,this._currentDepthNear===i.near&&this._currentDepthFar===i.far||(t.updateRenderState({depthNear:i.near,depthFar:i.far}),this._currentDepthNear=i.near,this._currentDepthFar=i.far),i.layers.mask=6|e.layers.mask,s.layers.mask=3&i.layers.mask,a.layers.mask=5&i.layers.mask;const o=e.parent,l=i.cameras;zq(i,o);for(let e=0;e=0&&(n[s]=null,t[s].disconnect(i))}for(let r=0;r=n.length){n.push(i),s=e;break}if(null===n[e]){n[e]=i,s=e;break}}if(-1===s)break}const a=t[s];a&&a.connect(i)}}function Wq(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function Xq(e,t){if(void 0===t)return;const n=this._cameraXR,r=this._renderer,i=r.backend,s=this._glBaseLayer,a=this.getReferenceSpace(),o=t.getViewerPose(a);if(this._xrFrame=t,null!==o){const e=o.views;null!==this._glBaseLayer&&i.setXRTarget(s.framebuffer);let t=!1;e.length!==n.cameras.length&&(n.cameras.length=0,t=!0);for(let r=0;r{await this.compileAsync(e,t);const r=this._renderLists.get(e,t),i=this._renderContexts.get(e,t,this._renderTarget),s=e.overrideMaterial||n.material,a=this._objects.get(n,s,e,t,r.lightsNode,i,i.clippingContext),{fragmentShader:o,vertexShader:l}=a.getNodeBuilderState();return{fragmentShader:o,vertexShader:l}}}}async init(){return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(e){if(null===this._getFallback)return void t(e);try{this.backend=n=this._getFallback(e),await n.init(this)}catch(e){return void t(e)}}this._nodes=new Cq(this,n),this._animation=new _L(this,this._nodes,this.info),this._attributes=new NL(n),this._background=new Sk(this,this._nodes),this._geometries=new LL(this._attributes,this.info),this._textures=new nI(this,n,this.info),this._pipelines=new qL(n,this._nodes),this._bindings=new VL(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new TL(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new XL(this.lighting),this._bundles=new Lq,this._renderContexts=new eI,this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();const r=this._nodes.nodeFrame,i=r.renderId,s=this._currentRenderContext,a=this._currentRenderObjectFunction,o=this._compilationPromises,l=!0===e.isScene?e:$q;null===n&&(n=e);const u=this._renderTarget,c=this._renderContexts.get(n,t,u),h=this._activeMipmapLevel,A=[];this._currentRenderContext=c,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=A,r.renderId++,r.update(),c.depth=this.depth,c.stencil=this.stencil,c.clippingContext||(c.clippingContext=new Nq),c.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,u);const d=this._renderLists.get(e,t);if(d.begin(),this._projectObject(e,t,0,d,c.clippingContext),n!==e&&n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&d.pushLight(e)}),d.finish(),null!==u){this._textures.updateRenderTarget(u,h);const e=this._textures.get(u);c.textures=e.textures,c.depthTexture=e.depthTexture}else c.textures=null,c.depthTexture=null;this._background.update(l,d,c);const p=d.opaque,f=d.transparent,m=d.transparentDoublePass,g=d.lightsNode;!0===this.opaque&&p.length>0&&this._renderObjects(p,t,l,g),!0===this.transparent&&f.length>0&&this._renderTransparents(f,m,t,l,g),r.renderId=i,this._currentRenderContext=s,this._currentRenderObjectFunction=a,this._compilationPromises=o,this._handleObjectFunction=this._renderObjectDirect,await Promise.all(A)}async renderAsync(e,t){Pt('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){Nt("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){null!==this._inspector&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){!0===e?(this.overrideNodes.modelViewMatrix=uE,this.overrideNodes.modelNormalViewMatrix=cE):this.highPrecision&&(this.overrideNodes.modelViewMatrix=null,this.overrideNodes.modelNormalViewMatrix=null)}get highPrecision(){return this.overrideNodes.modelViewMatrix===uE&&this.overrideNodes.modelNormalViewMatrix===cE}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getColorBufferType(){return this._colorBufferType}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\n\nMessage: ${e.message}`;e.reason&&(t+=`\nReason: ${e.reason}`),Nt(t),this._isDeviceLost=!0}_renderBundle(e,t,n){const{bundleGroup:r,camera:i,renderList:s}=e,a=this._currentRenderContext,o=this._bundles.get(r,i),l=this.backend.get(o);void 0===l.renderContexts&&(l.renderContexts=new Set);const u=r.version!==l.version,c=!1===l.renderContexts.has(a)||u;if(l.renderContexts.add(a),c){this.backend.beginBundle(a),(void 0===l.renderObjects||u)&&(l.renderObjects=[]),this._currentRenderBundle=o;const{transparentDoublePass:e,transparent:c,opaque:h}=s;!0===this.opaque&&h.length>0&&this._renderObjects(h,i,t,n),!0===this.transparent&&c.length>0&&this._renderTransparents(c,e,i,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,o),l.version=r.version}else{const{renderObjects:e}=l;for(let t=0,n=e.length;t>=h,d.viewportValue.height>>=h,d.viewportValue.minDepth=y,d.viewportValue.maxDepth=b,d.viewport=!1===d.viewportValue.equals(Kq),d.scissorValue.copy(_).multiplyScalar(v).floor(),d.scissor=m._scissorTest&&!1===d.scissorValue.equals(Kq),d.scissorValue.width>>=h,d.scissorValue.height>>=h,d.clippingContext||(d.clippingContext=new Nq),d.clippingContext.updateGlobal(l,t),l.onBeforeRender(this,e,t,A);const x=t.isArrayCamera?Jq:Zq;t.isArrayCamera||(eV.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),x.setFromProjectionMatrix(eV,t.coordinateSystem,t.reversedDepth));const T=this._renderLists.get(e,t);if(T.begin(),this._projectObject(e,t,0,T,d.clippingContext),T.finish(),!0===this.sortObjects&&T.sort(this._opaqueSort,this._transparentSort),null!==A){this._textures.updateRenderTarget(A,h);const e=this._textures.get(A);d.textures=e.textures,d.depthTexture=e.depthTexture,d.width=e.width,d.height=e.height,d.renderTarget=A,d.depth=A.depthBuffer,d.stencil=A.stencilBuffer}else d.textures=null,d.depthTexture=null,d.width=Yq.width,d.height=Yq.height,d.depth=this.depth,d.stencil=this.stencil;d.width>>=h,d.height>>=h,d.activeCubeFace=c,d.activeMipmapLevel=h,d.occlusionQueryCount=T.occlusionQueryCount,d.scissorValue.max(tV.set(0,0,0,0)),d.scissorValue.x+d.scissorValue.width>d.width&&(d.scissorValue.width=Math.max(d.width-d.scissorValue.x,0)),d.scissorValue.y+d.scissorValue.height>d.height&&(d.scissorValue.height=Math.max(d.height-d.scissorValue.y,0)),this._background.update(l,T,d),d.camera=t,this.backend.beginRender(d);const{bundles:S,lightsNode:w,transparentDoublePass:M,transparent:E,opaque:C}=T;return S.length>0&&this._renderBundles(S,l,w),!0===this.opaque&&C.length>0&&this._renderObjects(C,t,l,w),!0===this.transparent&&E.length>0&&this._renderTransparents(E,M,t,l,w),this.backend.finishRender(d),i.renderId=s,this._currentRenderContext=a,this._currentRenderObjectFunction=o,null!==r&&(this.setRenderTarget(u,c,h),this._renderOutput(A)),l.onAfterRender(this,e,t,A),this.inspector.finishRender(this.backend.getTimestampUID(d)),d}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){const t=this._quad;this._nodes.hasOutputChange(e.texture)&&(t.material.fragmentNode=this._nodes.getOutputNode(e.texture),t.material.needsUpdate=!0);const n=this.autoClear,r=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(t,t.camera,!1),this.autoClear=n,this.xr.enabled=r}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,i=0,s=1){this._canvasTarget.setViewport(e,t,n,r,i,s)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){const t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(!1===this._initialized)throw new Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');const r=this._renderTarget||this._getFrameBufferTarget();let i=null;if(null!==r){this._textures.updateRenderTarget(r);const e=this._textures.get(r);i=this._renderContexts.getForClear(r),i.textures=e.textures,i.depthTexture=e.depthTexture,i.width=e.width,i.height=e.height,i.renderTarget=r,i.depth=r.depthBuffer,i.stencil=r.stencilBuffer,i.clearColorValue=this.backend.getClearColor(),i.activeCubeFace=this.getActiveCubeFace(),i.activeMipmapLevel=this.getActiveMipmapLevel()}this.backend.clear(e,t,n,i),null!==r&&null===this._renderTarget&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){Pt('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){Pt('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Pt('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Pt('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){const e=0!==this.currentToneMapping,t=this.currentColorSpace!==en.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return null!==this._renderTarget?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:0}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:en.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){!0===this._initialized&&(this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),null!==this._frameBufferTarget&&this._frameBufferTarget.dispose(),Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&e.dispose()})),this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null),this._frameBufferTarget.dispose(),this._frameBufferTarget=null}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(!0===this._isDeviceLost)return;if(!1===this._initialized)return Rt("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);const n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);const i=this.backend,s=this._pipelines,a=this._bindings,o=this._nodes,l=Array.isArray(e)?e:[e];if(void 0===l[0]||!0!==l[0].isComputeNode)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");i.beginCompute(e);for(const n of l){if(!1===s.has(n)){const e=()=>{n.removeEventListener("dispose",e),s.delete(n),a.deleteForCompute(n),o.delete(n)};n.addEventListener("dispose",e);const t=n.onInitFunction;null!==t&&t.call(n,{renderer:this})}o.updateForCompute(n),a.updateForCompute(n);const r=a.getForCompute(n),l=s.getForCompute(n,r);i.compute(e,n,r,l,t)}i.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return Pt('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(!1===this._initialized)throw new Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){Pt('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(!1===this._initialized)throw new Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}copyFramebufferToTexture(e,t=null){if(null!==t)if(t.isVector2)t=tV.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return void Nt("Renderer.copyFramebufferToTexture: Invalid rectangle.");t=tV.copy(t).floor()}else t=tV.set(0,0,e.image.width,e.image.height);let n,r=this._currentRenderContext;null!==r?n=r.renderTarget:(n=this._renderTarget||this._getFrameBufferTarget(),null!==n&&(this._textures.updateRenderTarget(n),r=this._textures.get(n))),this._textures.updateTexture(e,{renderTarget:n}),this.backend.copyFramebufferToTexture(e,r,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,i=0,s=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,i,s),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,i,s=0,a=0){return this.backend.copyTextureToBuffer(e.textures[s],t,n,r,i,a)}_projectObject(e,t,n,r,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(i=i.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){const s=t.isArrayCamera?Jq:Zq;if(!e.frustumCulled||s.intersectsSprite(e,t)){!0===this.sortObjects&&tV.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eV);const{geometry:t,material:s}=e;s.visible&&r.push(e,t,s,n,tV.z,null,i)}}else if(e.isLineLoop)Nt("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){const s=t.isArrayCamera?Jq:Zq;if(!e.frustumCulled||s.intersectsObject(e,t)){const{geometry:t,material:s}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),tV.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(eV)),Array.isArray(s)){const a=t.groups;for(let o=0,l=a.length;o0){for(const{material:e}of t)e.side=1;this._renderObjects(t,n,r,i,"backSide");for(const{material:e}of t)e.side=0;this._renderObjects(e,n,r,i);for(const{material:e}of t)e.side=2}else this._renderObjects(e,n,r,i)}_renderObjects(e,t,n,r,i=null){for(let s=0,a=e.length;s0||i.transmissionNode&&i.transmissionNode.isNode||i.backdropNode&&i.backdropNode.isNode,e.isShadowPassMaterial){const{colorNode:t,depthNode:n,positionNode:r}=this._getShadowNodes(i);e.side=null===i.shadowSide?i.side:i.shadowSide,null!==t&&(e.colorNode=t),null!==n&&(e.depthNode=n),null!==r&&(e.positionNode=r)}i=e}!0===i.transparent&&2===i.side&&!1===i.forceSinglePass?(i.side=1,this._handleObjectFunction(e,i,t,n,a,s,o,"backSide"),i.side=0,this._handleObjectFunction(e,i,t,n,a,s,o,l),i.side=2):this._handleObjectFunction(e,i,t,n,a,s,o,l),d&&(t.overrideMaterial.colorNode=u,t.overrideMaterial.depthNode=c,t.overrideMaterial.positionNode=h,t.overrideMaterial.side=A),e.onAfterRender(this,t,n,r,i,s)}_renderObjectDirect(e,t,n,r,i,s,a,o){const l=this._objects.get(e,t,n,r,i,this._currentRenderContext,a,o);l.drawRange=e.geometry.drawRange,l.group=s;const u=this._nodes.needsRefresh(l);if(u&&(this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l)),this._pipelines.updateForRender(l),null!==this._currentRenderBundle){this.backend.get(this._currentRenderBundle).renderObjects.push(l),l.bundle=this._currentRenderBundle.bundleGroup}this.backend.draw(l,this.info),u&&this._nodes.updateAfter(l)}_createObjectPipeline(e,t,n,r,i,s,a,o){const l=this._objects.get(e,t,n,r,i,this._currentRenderContext,a,o);l.drawRange=e.geometry.drawRange,l.group=s,this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l),this._pipelines.getForRender(l,this._compilationPromises),this._nodes.updateAfter(l)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class rV{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}clone(){return Object.assign(new this.constructor,this)}}let iV=class extends rV{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t}get byteLength(){return(e=this._buffer.byteLength)+(RL-e%RL)%RL;var e}get buffer(){return this._buffer}update(){return!0}};class sV extends iV{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let aV=0;class oV extends sV{constructor(e,t){super("UniformBuffer_"+aV++,e?e.value:null),this.nodeUniform=e,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class lV extends sV{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[]}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(null===e){const t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){const e=this.bytesPerElement;let t=0;for(let n=0,r=this.uniforms.length;n{this.generation=null,this.version=0},this.texture=t,this.version=t?t.version:0,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=0,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){const{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){const e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=0},e.texture=this.texture,e}}let AV=0;class dV extends hV{constructor(e,t){super(e,t),this.id=AV++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class pV extends dV{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class fV extends pV{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}}class mV extends pV{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}}const gV={bitcast_int_uint:new eO("uint tsl_bitcast_uint_to_int ( int x ) { return floatBitsToInt( uintBitsToFloat( x ) ); }"),bitcast_uint_int:new eO("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }")},_V={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint"},vV={low:"lowp",medium:"mediump",high:"highp"},yV={swizzleAssign:!0,storageBuffer:!1},bV={perspective:"smooth",linear:"noperspective"},xV={centroid:"centroid"},TV="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\nprecision highp sampler3D;\nprecision highp samplerCube;\nprecision highp sampler2DArray;\n\nprecision highp usampler2D;\nprecision highp usampler3D;\nprecision highp usamplerCube;\nprecision highp usampler2DArray;\n\nprecision highp isampler2D;\nprecision highp isampler3D;\nprecision highp isamplerCube;\nprecision highp isampler2DArray;\n\nprecision lowp sampler2DShadow;\nprecision lowp sampler2DArrayShadow;\nprecision lowp samplerCubeShadow;\n";class SV extends rq{constructor(e,t){super(e,t,new Sq),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&e.colorSpace!==rt}_include(e){const t=gV[e];return t.build(this),this.addInclude(t),t}getMethod(e){return void 0!==gV[e]&&this._include(e),_V[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),r=[];for(const e of t.inputs)r.push(this.getType(e.type)+" "+e.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {\n\n\t${n.vars}\n\n${n.code}\n\treturn ${n.result};\n\n}`}setupPBO(e){const t=e.value;if(void 0===t.pbo){const e=t.array,n=t.count*t.itemSize,{itemSize:r}=t,i=t.array.constructor.name.toLowerCase().includes("int");let s=i?be:ye;2===r?s=i?Te:xe:3===r?s=i?1032:me:4===r&&(s=i?Se:ge);const a={Float32Array:le,Uint8Array:ne,Uint16Array:se,Uint32Array:oe,Int8Array:re,Int16Array:ie,Int32Array:ae,Uint8ClampedArray:ne},o=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(n/r))));let l=Math.ceil(n/r/o);o*l*r0?r:"";t=`${e.name} {\n\t${n} ${i.name}[${s}];\n};\n`}else{t=`${this.getVectorType(i.type)} ${this.getPropertyName(i,e)};`,s=!0}const a=i.node.precision;if(null!==a&&(t=vV[a]+" "+t),s){t="\t"+t;const e=i.groupNode.name;(r[e]||(r[e]=[])).push(t)}else t="uniform "+t,n.push(t)}let i="";for(const t in r){const n=r[t];i+=this._getGLSLUniformStruct(e+"_"+t,n.join("\n"))+"\n"}return i+=n.join("\n"),i}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==ae){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);const r=n.array;!1==(r instanceof Uint32Array||r instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){const e=this.getAttributesArray();let n=0;for(const r of e)t+=`layout( location = ${n++} ) in ${r.type} ${r.name};\n`}return t}getStructMembers(e){const t=[];for(const n of e.members)t.push(`\t${n.type} ${n.name};`);return t.join("\n")}getStructs(e){const t=[],n=this.structs[e],r=[];for(const e of n)if(e.output)for(const t of e.members)r.push(`layout( location = ${t.index} ) out ${t.type} ${t.name};`);else{let n="struct "+e.name+" {\n";n+=this.getStructMembers(e),n+="\n};\n",t.push(n)}return 0===r.length&&r.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+r.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="";const n=this.varyings;if("vertex"===e||"compute"===e)for(const r of n){"compute"===e&&(r.needsInterpolation=!0);const n=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){t+=`${bV[r.interpolationType]||r.interpolationType} ${xV[r.interpolationSampling]||""} out ${n} ${r.name};\n`}else{t+=`${n.includes("int")||n.includes("uv")||n.includes("iv")?"flat ":""}out ${n} ${r.name};\n`}else t+=`${n} ${r.name};\n`}else if("fragment"===e)for(const e of n)if(e.needsInterpolation){const n=this.getType(e.type);if(e.interpolationType){t+=`${bV[e.interpolationType]||e.interpolationType} ${xV[e.interpolationSampling]||""} in ${n} ${e.name};\n`}else{t+=`${n.includes("int")||n.includes("uv")||n.includes("iv")?"flat ":""}in ${n} ${e.name};\n`}}for(const n of this.builtins[e])t+=`${n};\n`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}getSubgroupSize(){Nt("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){Nt("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){Nt("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){const r=this.extensions[n]||(this.extensions[n]=new Map);!1===r.has(e)&&r.set(e,{name:e,behavior:t})}getExtensions(e){const t=[];if("vertex"===e){const t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}const n=this.extensions[e];if(void 0!==n)for(const{name:e,behavior:r}of n.values())t.push(`#extension ${e} : ${r}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=yV[e];if(void 0===t){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance"}if(void 0!==n){const e=this.renderer.backend.extensions;e.has(n)&&(e.get(n),t=!0)}yV[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){const e=this.transforms;let t="";for(let n=0;n0&&(n+="\n"),n+=`\t// flow -> ${s}\n\t`),n+=`${r.code}\n\t`,e===i&&"compute"!==t&&(n+="// result\n\t","vertex"===t?(n+="gl_Position = ",n+=`${r.result};`):"fragment"===t&&(e.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${r.result};`)))}const s=e[t];s.extensions=this.getExtensions(t),s.uniforms=this.getUniforms(t),s.attributes=this.getAttributes(t),s.varyings=this.getVaryings(t),s.vars=this.getVars(t),s.structs=this.getStructs(t),s.codes=this.getCodes(t),s.transforms=this.getTransforms(t),s.flow=n}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){const i=super.getUniformFromNode(e,t,n,r),s=this.getDataFromNode(e,n,this.globalCache);let a=s.uniformGPU;if(void 0===a){const r=e.groupNode,o=r.name,l=this.getBindGroupArray(o,n);if("texture"===t)a=new pV(i.name,i.node,r),l.push(a);else if("cubeTexture"===t)a=new fV(i.name,i.node,r),l.push(a);else if("texture3D"===t)a=new mV(i.name,i.node,r),l.push(a);else if("buffer"===t){e.name=`NodeBuffer_${e.id}`,i.name=`buffer${e.id}`;const t=new oV(e,r);t.name=e.name,l.push(t),a=t}else{const e=this.uniformGroups[n]||(this.uniformGroups[n]={});let s=e[o];void 0===s&&(s=new cV(n+"_"+o,r),e[o]=s,l.push(s)),a=this.getNodeUniform(i,t),s.addUniform(a)}s.uniformGPU=a}return i}}let wV=null,MV=null;class EV{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Tt]:null,[xt]:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){const t=this.get(e),n=this.renderer.info.frame;let r;r=!0===e.isComputeNode?"c:"+this.renderer.info.compute.frameCalls:"r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){const t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){const t=e.startsWith("c:")?xt:Tt;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void Pt("WebGPURenderer: Timestamp tracking is disabled.");const t=this.timestampQueryPool[e];if(!t)return;const n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return wV=wV||new Ht,this.renderer.getDrawingBufferSize(wV)}setScissorTest(){}getClearColor(){const e=this.renderer;return MV=MV||new rI,e.getClearColor(MV),MV.getRGB(MV),MV}getDomElement(){let e=this.domElement;return null===e&&(e=void 0!==this.parameters.canvas?this.parameters.canvas:Mt(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${s} webgpu`),this.domElement=e),e}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}dispose(){}}let CV,RV,NV=0;class PV{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class DV{constructor(e){this.backend=e}createAttribute(e,t){const n=this.backend,{gl:r}=n,i=e.array,s=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,o=n.get(a);let l,u=o.bufferGPU;if(void 0===u&&(u=this._createBuffer(r,t,i,s),o.bufferGPU=u,o.bufferType=t,o.version=a.version),i instanceof Float32Array)l=r.FLOAT;else if("undefined"!=typeof Float16Array&&i instanceof Float16Array)l=r.HALF_FLOAT;else if(i instanceof Uint16Array)l=e.isFloat16BufferAttribute?r.HALF_FLOAT:r.UNSIGNED_SHORT;else if(i instanceof Int16Array)l=r.SHORT;else if(i instanceof Uint32Array)l=r.UNSIGNED_INT;else if(i instanceof Int32Array)l=r.INT;else if(i instanceof Int8Array)l=r.BYTE;else if(i instanceof Uint8Array)l=r.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+i);l=r.UNSIGNED_BYTE}let c={bufferGPU:u,bufferType:t,type:l,byteLength:i.byteLength,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:l===r.INT||l===r.UNSIGNED_INT||e.gpuType===ae,id:NV++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){const e=this._createBuffer(r,t,i,s);c=new PV(c,e)}n.set(e,c)}updateAttribute(e){const t=this.backend,{gl:n}=t,r=e.array,i=e.isInterleavedBufferAttribute?e.data:e,s=t.get(i),a=s.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,s.bufferGPU),0===o.length)n.bufferSubData(a,0,r);else{for(let e=0,t=o.length;e0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n){const e=12288;for(let t=0;t<8;t++)t{!function i(){const s=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(s===e.WAIT_FAILED)return e.deleteSync(t),void r();s!==e.TIMEOUT_EXPIRED?(e.deleteSync(t),n()):requestAnimationFrame(i)}()})}}let UV,OV,BV,FV=!1;class kV{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,!1===FV&&(this._init(),FV=!0)}_init(){const e=this.gl;UV={[X]:e.REPEAT,[Q]:e.CLAMP_TO_EDGE,[$]:e.MIRRORED_REPEAT},OV={[Y]:e.NEAREST,[K]:e.NEAREST_MIPMAP_NEAREST,[Z]:e.NEAREST_MIPMAP_LINEAR,[J]:e.LINEAR,[ee]:e.LINEAR_MIPMAP_NEAREST,[te]:e.LINEAR_MIPMAP_LINEAR},BV={[ut]:e.NEVER,[mt]:e.ALWAYS,[ct]:e.LESS,[At]:e.LEQUAL,[ht]:e.EQUAL,[ft]:e.GEQUAL,[dt]:e.GREATER,[pt]:e.NOTEQUAL}}getGLTextureType(e){const{gl:t}=this;let n;return n=!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,i=!1){const{gl:s,extensions:a}=this;if(null!==e){if(void 0!==s[e])return s[e];Rt("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let o=t;if(t===s.RED&&(n===s.FLOAT&&(o=s.R32F),n===s.HALF_FLOAT&&(o=s.R16F),n===s.UNSIGNED_BYTE&&(o=s.R8),n===s.UNSIGNED_SHORT&&(o=s.R16),n===s.UNSIGNED_INT&&(o=s.R32UI),n===s.BYTE&&(o=s.R8I),n===s.SHORT&&(o=s.R16I),n===s.INT&&(o=s.R32I)),t===s.RED_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.R8UI),n===s.UNSIGNED_SHORT&&(o=s.R16UI),n===s.UNSIGNED_INT&&(o=s.R32UI),n===s.BYTE&&(o=s.R8I),n===s.SHORT&&(o=s.R16I),n===s.INT&&(o=s.R32I)),t===s.RG&&(n===s.FLOAT&&(o=s.RG32F),n===s.HALF_FLOAT&&(o=s.RG16F),n===s.UNSIGNED_BYTE&&(o=s.RG8),n===s.UNSIGNED_SHORT&&(o=s.RG16),n===s.UNSIGNED_INT&&(o=s.RG32UI),n===s.BYTE&&(o=s.RG8I),n===s.SHORT&&(o=s.RG16I),n===s.INT&&(o=s.RG32I)),t===s.RG_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.RG8UI),n===s.UNSIGNED_SHORT&&(o=s.RG16UI),n===s.UNSIGNED_INT&&(o=s.RG32UI),n===s.BYTE&&(o=s.RG8I),n===s.SHORT&&(o=s.RG16I),n===s.INT&&(o=s.RG32I)),t===s.RGB){const e=i?at:en.getTransfer(r);n===s.FLOAT&&(o=s.RGB32F),n===s.HALF_FLOAT&&(o=s.RGB16F),n===s.UNSIGNED_BYTE&&(o=s.RGB8),n===s.UNSIGNED_SHORT&&(o=s.RGB16),n===s.UNSIGNED_INT&&(o=s.RGB32UI),n===s.BYTE&&(o=s.RGB8I),n===s.SHORT&&(o=s.RGB16I),n===s.INT&&(o=s.RGB32I),n===s.UNSIGNED_BYTE&&(o=e===ot?s.SRGB8:s.RGB8),n===s.UNSIGNED_SHORT_5_6_5&&(o=s.RGB565),n===s.UNSIGNED_SHORT_5_5_5_1&&(o=s.RGB5_A1),n===s.UNSIGNED_SHORT_4_4_4_4&&(o=s.RGB4),n===s.UNSIGNED_INT_5_9_9_9_REV&&(o=s.RGB9_E5),n===s.UNSIGNED_INT_10F_11F_11F_REV&&(o=s.R11F_G11F_B10F)}if(t===s.RGB_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.RGB8UI),n===s.UNSIGNED_SHORT&&(o=s.RGB16UI),n===s.UNSIGNED_INT&&(o=s.RGB32UI),n===s.BYTE&&(o=s.RGB8I),n===s.SHORT&&(o=s.RGB16I),n===s.INT&&(o=s.RGB32I)),t===s.RGBA){const e=i?at:en.getTransfer(r);n===s.FLOAT&&(o=s.RGBA32F),n===s.HALF_FLOAT&&(o=s.RGBA16F),n===s.UNSIGNED_BYTE&&(o=s.RGBA8),n===s.UNSIGNED_SHORT&&(o=s.RGBA16),n===s.UNSIGNED_INT&&(o=s.RGBA32UI),n===s.BYTE&&(o=s.RGBA8I),n===s.SHORT&&(o=s.RGBA16I),n===s.INT&&(o=s.RGBA32I),n===s.UNSIGNED_BYTE&&(o=e===ot?s.SRGB8_ALPHA8:s.RGBA8),n===s.UNSIGNED_SHORT_4_4_4_4&&(o=s.RGBA4),n===s.UNSIGNED_SHORT_5_5_5_1&&(o=s.RGB5_A1)}return t===s.RGBA_INTEGER&&(n===s.UNSIGNED_BYTE&&(o=s.RGBA8UI),n===s.UNSIGNED_SHORT&&(o=s.RGBA16UI),n===s.UNSIGNED_INT&&(o=s.RGBA32UI),n===s.BYTE&&(o=s.RGBA8I),n===s.SHORT&&(o=s.RGBA16I),n===s.INT&&(o=s.RGBA32I)),t===s.DEPTH_COMPONENT&&(n===s.UNSIGNED_SHORT&&(o=s.DEPTH_COMPONENT16),n===s.UNSIGNED_INT&&(o=s.DEPTH_COMPONENT24),n===s.FLOAT&&(o=s.DEPTH_COMPONENT32F)),t===s.DEPTH_STENCIL&&n===s.UNSIGNED_INT_24_8&&(o=s.DEPTH24_STENCIL8),o!==s.R16F&&o!==s.R32F&&o!==s.RG16F&&o!==s.RG32F&&o!==s.RGBA16F&&o!==s.RGBA32F||a.get("EXT_color_buffer_float"),o}setTextureParameters(e,t){const{gl:n,extensions:r,backend:i}=this,s=en.getPrimaries(en.workingColorSpace),a=t.colorSpace===rt?null:en.getPrimaries(t.colorSpace),o=t.colorSpace===rt||s===a?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,o),n.texParameteri(e,n.TEXTURE_WRAP_S,UV[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,UV[t.wrapT]),e!==n.TEXTURE_3D&&e!==n.TEXTURE_2D_ARRAY||t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,UV[t.wrapR]),n.texParameteri(e,n.TEXTURE_MAG_FILTER,OV[t.magFilter]);const l=void 0!==t.mipmaps&&t.mipmaps.length>0,u=t.minFilter===J&&l?te:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,OV[u]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,BV[t.compareFunction])),!0===r.has("EXT_texture_filter_anisotropic")){if(t.magFilter===Y)return;if(t.minFilter!==Z&&t.minFilter!==te)return;if(t.type===le&&!1===r.has("OES_texture_float_linear"))return;if(t.anisotropy>1){const s=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,i.getMaxAnisotropy()))}}}createDefaultTexture(e){const{gl:t,backend:n,defaultTextures:r}=this,i=this.getGLTextureType(e);let s=r[i];void 0===s&&(s=t.createTexture(),n.state.bindTexture(i,s),t.texParameteri(i,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(i,t.TEXTURE_MAG_FILTER,t.NEAREST),r[i]=s),n.set(e,{textureGPU:s,glTextureType:i})}createTexture(e,t){const{gl:n,backend:r}=this,{levels:i,width:s,height:a,depth:o}=t,l=r.utils.convert(e.format,e.colorSpace),u=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,l,u,e.colorSpace,e.isVideoTexture),h=n.createTexture(),A=this.getGLTextureType(e);r.state.bindTexture(A,h),this.setTextureParameters(A,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,i,c,s,a,o):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,i,c,s,a,o):e.isVideoTexture||n.texStorage2D(A,i,c,s,a),r.set(e,{textureGPU:h,glTextureType:A,glFormat:l,glType:u,glInternalFormat:c})}copyBufferToTexture(e,t){const{gl:n,backend:r}=this,{textureGPU:i,glTextureType:s,glFormat:a,glType:o}=r.get(t),{width:l,height:u}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(s,i),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(s,0,0,0,l,u,a,o,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){const{gl:n}=this,{width:r,height:i}=t,{textureGPU:s,glTextureType:a,glFormat:o,glType:l,glInternalFormat:u}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==s)if(this.backend.state.bindTexture(a,s),this.setTextureParameters(a,e),e.isCompressedTexture){const r=e.mipmaps,i=t.image;for(let t=0;t0){const t=Do(r.width,r.height,e.format,e.type);for(const i of e.layerUpdates){const e=r.data.subarray(i*t/r.data.BYTES_PER_ELEMENT,(i+1)*t/r.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,i,r.width,r.height,1,o,l,e)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,r.width,r.height,r.depth,o,l,r.data)}else if(e.isData3DTexture){const e=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,l,e.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,o,l,t.image);else{const s=e.mipmaps;if(s.length>0)for(let e=0,t=s.length;e0,h=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(c){const n=0!==a||0!==o;let c,A;if(!0===e.isDepthTexture?(c=r.DEPTH_BUFFER_BIT,A=r.DEPTH_ATTACHMENT,t.stencil&&(c|=r.STENCIL_BUFFER_BIT)):(c=r.COLOR_BUFFER_BIT,A=r.COLOR_ATTACHMENT0),n){const e=this.backend.get(t.renderTarget),n=e.framebuffers[t.getCacheKey()],A=e.msaaFrameBuffer;i.bindFramebuffer(r.DRAW_FRAMEBUFFER,n),i.bindFramebuffer(r.READ_FRAMEBUFFER,A);const d=h-o-u;r.blitFramebuffer(a,d,a+l,d+u,a,d,a+l,d+u,c,r.NEAREST),i.bindFramebuffer(r.READ_FRAMEBUFFER,n),i.bindTexture(r.TEXTURE_2D,s),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d,l,u),i.unbindTexture()}else{const e=r.createFramebuffer();i.bindFramebuffer(r.DRAW_FRAMEBUFFER,e),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,A,r.TEXTURE_2D,s,0),r.blitFramebuffer(0,0,l,u,0,0,l,u,c,r.NEAREST),r.deleteFramebuffer(e)}}else i.bindTexture(r.TEXTURE_2D,s),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,h-u-o,l,u),i.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){const{gl:i}=this,s=t.renderTarget,{depthTexture:a,depthBuffer:o,stencilBuffer:l,width:u,height:c}=s;if(i.bindRenderbuffer(i.RENDERBUFFER,e),o&&!l){let t=i.DEPTH_COMPONENT24;if(!0===r){this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(i.RENDERBUFFER,s.samples,t,u,c)}else n>0?(a&&a.isDepthTexture&&a.type===i.FLOAT&&(t=i.DEPTH_COMPONENT32F),i.renderbufferStorageMultisample(i.RENDERBUFFER,n,t,u,c)):i.renderbufferStorage(i.RENDERBUFFER,t,u,c);i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e)}else o&&l&&(n>0?i.renderbufferStorageMultisample(i.RENDERBUFFER,n,i.DEPTH24_STENCIL8,u,c):i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,u,c),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e));i.bindRenderbuffer(i.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,i,s){const{backend:a,gl:o}=this,{textureGPU:l,glFormat:u,glType:c}=this.backend.get(e),h=o.createFramebuffer();o.bindFramebuffer(o.READ_FRAMEBUFFER,h);const A=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+s:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,A,l,0);const d=this._getTypedArrayType(c),p=r*i*this._getBytesPerTexel(c,u),f=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,f),o.bufferData(o.PIXEL_PACK_BUFFER,p,o.STREAM_READ),o.readPixels(t,n,r,i,u,c,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();const m=new d(p/d.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,f),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,m),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),o.deleteFramebuffer(h),m}_getTypedArrayType(e){const{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_5_5_1)return Uint16Array;if(e===t.UNSIGNED_SHORT_5_6_5)return Uint16Array;if(e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){const{gl:n}=this;let r=0;return e===n.UNSIGNED_BYTE&&(r=1),e!==n.UNSIGNED_SHORT_4_4_4_4&&e!==n.UNSIGNED_SHORT_5_5_5_1&&e!==n.UNSIGNED_SHORT_5_6_5&&e!==n.UNSIGNED_SHORT&&e!==n.HALF_FLOAT||(r=2),e!==n.UNSIGNED_INT&&e!==n.FLOAT||(r=4),t===n.RGBA?4*r:t===n.RGB?3*r:t===n.ALPHA?r:void 0}dispose(){const{gl:e}=this;null!==this._srcFramebuffer&&e.deleteFramebuffer(this._srcFramebuffer),null!==this._dstFramebuffer&&e.deleteFramebuffer(this._dstFramebuffer)}}function qV(e){return e.isDataTexture?e.image.data:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class VV{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class zV{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;const e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}const GV={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class HV{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){const{gl:n,mode:r,object:i,type:s,info:a,index:o}=this;0!==o?n.drawElements(r,t,s,e):n.drawArrays(r,e,t),a.update(i,t,1)}renderInstances(e,t,n){const{gl:r,mode:i,type:s,index:a,object:o,info:l}=this;0!==n&&(0!==a?r.drawElementsInstanced(i,t,s,e,n):r.drawArraysInstanced(i,e,t,n),l.update(o,t,n))}renderMultiDraw(e,t,n){const{extensions:r,mode:i,object:s,info:a}=this;if(0===n)return;const o=r.get("WEBGL_multi_draw");if(null===o)for(let r=0;rthis.maxQueries)return Pt(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null==t)return;if(null!==this.activeQuery)return;const n=this.queries[t];if(n)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(e){e("Error in beginQuery:",e),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;const t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(e){e("Error in endQuery:",e),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{const e=new Map;for(const[t,n]of this.queryOffsets){if("ended"===this.queryStates.get(n)){const r=this.queries[n];e.set(t,this.resolveQuery(r))}}if(0===e.size)return this.lastValue;const t={},n=[];for(const[r,i]of e){const e=r.match(/^(.*):f(\d+)$/),s=parseInt(e[2]);!1===n.includes(s)&&n.push(s),void 0===t[s]&&(t[s]=0);const a=await i;this.timestamps.set(r,a),t[s]+=a}const r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return e("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed)return void t(this.lastValue);let n,r=!1;const i=e=>{r||(r=!0,n&&(clearTimeout(n),n=null),t(e))},s=()=>{if(this.isDisposed)i(this.lastValue);else try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void i(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE))return void(n=setTimeout(s,1));const r=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(r)/1e6)}catch(e){e("Error checking query:",e),t(this.lastValue)}};s()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,this.trackTimestamp)){for(const e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class XV extends EV{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);const t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=void 0!==t.context?t.context:e.domElement.getContext("webgl2",n);function i(t){t.preventDefault();const n={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(n)}this._onContextLost=i,e.domElement.addEventListener("webglcontextlost",i,!1),this.gl=r,this.extensions=new VV(this),this.capabilities=new zV(this),this.attributeUtils=new DV(this),this.textureUtils=new kV(this),this.bufferRenderer=new HV(this),this.state=new LV(this),this.utils=new IV(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile")}get coordinateSystem(){return yt}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){const r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),null!==n){const t=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&!1===e.multiview&&Rt("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new WV(this.gl,e,2048));const n=this.timestampQueryPool[e];null!==n.allocateQueriesForContext(t)&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){const{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{const{width:e,height:n}=this.getDrawingBufferSize();t.viewport(0,0,e,n)}if(e.scissor){const{x:n,y:r,width:i,height:s}=e.scissorValue;t.scissor(n,e.height-s-r,i,s)}this.initTimestampQuery(Tt,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);const r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){const{gl:t,state:n}=this,r=this.get(e),i=r.previousContext;n.resetVertexState();const s=e.occlusionQueryCount;s>0&&(s>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));const a=e.textures;if(null!==a)for(let e=0;e{let a=0;for(let t=0;t{t.isBatchedMesh?null!==t._multiDrawInstances?(Pt("WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances)):this.hasFeature("WEBGL_multi_draw")?_.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):Pt("WebGLBackend: WEBGL_multi_draw not supported."):y>1?_.renderInstances(b,v,y):_.render(b,v)};if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){const n=this.get(e.camera),r=e.camera.cameras,i=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===n.indexesGPU||n.indexesGPU.length!==r.length){const e=new Uint32Array([0,0,0,0]),t=[];for(let n=0,i=r.length;n{const i=this.parallel,s=()=>{n.getProgramParameter(a,i.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),t()):requestAnimationFrame(s)};s()});return void t.push(i)}this._completeCompile(e,r)}_handleSource(e,t){const n=e.split("\n"),r=[],i=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let e=i;e":" "} ${i}: ${n[e]}`)}return r.join("\n")}_getShaderErrors(e,t,n){const r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(r&&""===i)return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const r=parseInt(s[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+this._handleSource(e.getShaderSource(t),r)}return i}_logProgramError(e,t,n){if(this.renderer.debug.checkShaderErrors){const r=this.gl,i=(r.getProgramInfoLog(e)||"").trim();if(!1===r.getProgramParameter(e,r.LINK_STATUS))if("function"==typeof this.renderer.debug.onShaderError)this.renderer.debug.onShaderError(r,e,n,t);else{const s=this._getShaderErrors(r,n,"vertex"),a=this._getShaderErrors(r,t,"fragment");Nt("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(e,r.VALIDATE_STATUS)+"\n\nProgram Info Log: "+i+"\n"+s+"\n"+a)}else""!==i&&Rt("WebGLProgram: Program Info Log:",i)}}_completeCompile(e,t){const{state:n,gl:r}=this,i=this.get(t),{programGPU:s,fragmentShader:a,vertexShader:o}=i;!1===r.getProgramParameter(s,r.LINK_STATUS)&&this._logProgramError(s,a,o),n.useProgram(s);const l=e.getBindings();this._setupBindings(l,s),this.set(t,{programGPU:s})}createComputePipeline(e,t){const{state:n,gl:r}=this,i={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(i);const{computeProgram:s}=e,a=r.createProgram(),o=this.get(i).shaderGPU,l=this.get(s).shaderGPU,u=s.transforms,c=[],h=[];for(let e=0;eGV[t]===e),n=this.extensions;for(let e=0;e1,A=!0===i.isXRRenderTarget,d=!0===A&&!0===i._hasExternalTextures;let p=s.msaaFrameBuffer,f=s.depthRenderbuffer;const m=this.extensions.get("WEBGL_multisampled_render_to_texture"),g=this.extensions.get("OVR_multiview2"),_=this._useMultisampledExtension(i),v=YL(e);let y;if(u?(s.cubeFramebuffers||(s.cubeFramebuffers={}),y=s.cubeFramebuffers[v]):A&&!1===d?y=this._xrFramebuffer:(s.framebuffers||(s.framebuffers={}),y=s.framebuffers[v]),void 0===y){y=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,y);const r=e.textures,o=[];if(u){s.cubeFramebuffers[v]=y;const{textureGPU:e}=this.get(r[0]),n=this.renderer._activeCubeFace,i=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,e,i)}else{s.framebuffers[v]=y;for(let n=0;n0&&!1===_&&!i.multiview){if(void 0===p){const r=[];p=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,p);const i=[],u=e.textures;for(let n=0;n0&&!1===this._useMultisampledExtension(r)){const s=i.framebuffers[e.getCacheKey()];let a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));const o=i.msaaFrameBuffer,l=i.msaaRenderbuffers,u=e.textures,c=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,o),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,s),c)for(let e=0;e0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){null!==this.textureUtils&&this.textureUtils.dispose();const e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}const QV="point-list",$V="line-list",YV="line-strip",KV="triangle-list",ZV="triangle-strip",JV="never",ez="less",tz="equal",nz="less-equal",rz="greater",iz="not-equal",sz="greater-equal",az="always",oz="store",lz="load",uz="clear",cz="ccw",hz="cw",Az="none",dz="back",pz="uint16",fz="uint32",mz="r8unorm",gz="r8snorm",_z="r8uint",vz="r8sint",yz="r16uint",bz="r16sint",xz="r16float",Tz="rg8unorm",Sz="rg8snorm",wz="rg8uint",Mz="rg8sint",Ez="r32uint",Cz="r32sint",Rz="r32float",Nz="rg16uint",Pz="rg16sint",Dz="rg16float",Lz="rgba8unorm",Iz="rgba8unorm-srgb",Uz="rgba8snorm",Oz="rgba8uint",Bz="rgba8sint",Fz="bgra8unorm",kz="bgra8unorm-srgb",qz="rgb9e5ufloat",Vz="rgb10a2unorm",zz="rg11b10ufloat",Gz="rg32uint",Hz="rg32sint",jz="rg32float",Wz="rgba16uint",Xz="rgba16sint",Qz="rgba16float",$z="rgba32uint",Yz="rgba32sint",Kz="rgba32float",Zz="depth16unorm",Jz="depth24plus",eG="depth24plus-stencil8",tG="depth32float",nG="depth32float-stencil8",rG="bc1-rgba-unorm",iG="bc1-rgba-unorm-srgb",sG="bc2-rgba-unorm",aG="bc2-rgba-unorm-srgb",oG="bc3-rgba-unorm",lG="bc3-rgba-unorm-srgb",uG="bc4-r-unorm",cG="bc4-r-snorm",hG="bc5-rg-unorm",AG="bc5-rg-snorm",dG="bc6h-rgb-ufloat",pG="bc6h-rgb-float",fG="bc7-rgba-unorm",mG="bc7-rgba-unorm-srgb",gG="etc2-rgb8unorm",_G="etc2-rgb8unorm-srgb",vG="etc2-rgb8a1unorm",yG="etc2-rgb8a1unorm-srgb",bG="etc2-rgba8unorm",xG="etc2-rgba8unorm-srgb",TG="eac-r11unorm",SG="eac-r11snorm",wG="eac-rg11unorm",MG="eac-rg11snorm",EG="astc-4x4-unorm",CG="astc-4x4-unorm-srgb",RG="astc-5x4-unorm",NG="astc-5x4-unorm-srgb",PG="astc-5x5-unorm",DG="astc-5x5-unorm-srgb",LG="astc-6x5-unorm",IG="astc-6x5-unorm-srgb",UG="astc-6x6-unorm",OG="astc-6x6-unorm-srgb",BG="astc-8x5-unorm",FG="astc-8x5-unorm-srgb",kG="astc-8x6-unorm",qG="astc-8x6-unorm-srgb",VG="astc-8x8-unorm",zG="astc-8x8-unorm-srgb",GG="astc-10x5-unorm",HG="astc-10x5-unorm-srgb",jG="astc-10x6-unorm",WG="astc-10x6-unorm-srgb",XG="astc-10x8-unorm",QG="astc-10x8-unorm-srgb",$G="astc-10x10-unorm",YG="astc-10x10-unorm-srgb",KG="astc-12x10-unorm",ZG="astc-12x10-unorm-srgb",JG="astc-12x12-unorm",eH="astc-12x12-unorm-srgb",tH="clamp-to-edge",nH="repeat",rH="mirror-repeat",iH="linear",sH="nearest",aH="zero",oH="one",lH="src",uH="one-minus-src",cH="src-alpha",hH="one-minus-src-alpha",AH="dst",dH="one-minus-dst",pH="dst-alpha",fH="one-minus-dst-alpha",mH="src-alpha-saturated",gH="constant",_H="one-minus-constant",vH="add",yH="subtract",bH="reverse-subtract",xH="min",TH="max",SH=0,wH=15,MH="keep",EH="zero",CH="replace",RH="invert",NH="increment-clamp",PH="decrement-clamp",DH="increment-wrap",LH="decrement-wrap",IH="storage",UH="read-only-storage",OH="write-only",BH="read-only",FH="read-write",kH="non-filtering",qH="comparison",VH="float",zH="unfilterable-float",GH="depth",HH="sint",jH="uint",WH="2d",XH="3d",QH="2d",$H="2d-array",YH="cube",KH="3d",ZH="all",JH="vertex",ej="instance",tj={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},nj={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class rj extends hV{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){const{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class ij extends iV{constructor(e,t){super(e,t?t.array:null),this.attribute=t,this.isStorageBuffer=!0}}let sj=0;class aj extends ij{constructor(e,t){super("StorageBuffer_"+sj++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:zy.READ_WRITE,this.groupNode=t}get buffer(){return this.nodeUniform.value}}class oj extends SL{constructor(e){super(),this.device=e;this.mipmapSampler=e.createSampler({minFilter:iH}),this.flipYSampler=e.createSampler({minFilter:sH}),this.transferPipelines={},this.flipYPipelines={},this.mipmapVertexShaderModule=e.createShaderModule({label:"mipmapVertex",code:"\nstruct VarysStruct {\n\t@builtin( position ) Position: vec4,\n\t@location( 0 ) vTex : vec2\n};\n\n@vertex\nfn main( @builtin( vertex_index ) vertexIndex : u32 ) -> VarysStruct {\n\n\tvar Varys : VarysStruct;\n\n\tvar pos = array< vec2, 4 >(\n\t\tvec2( -1.0, 1.0 ),\n\t\tvec2( 1.0, 1.0 ),\n\t\tvec2( -1.0, -1.0 ),\n\t\tvec2( 1.0, -1.0 )\n\t);\n\n\tvar tex = array< vec2, 4 >(\n\t\tvec2( 0.0, 0.0 ),\n\t\tvec2( 1.0, 0.0 ),\n\t\tvec2( 0.0, 1.0 ),\n\t\tvec2( 1.0, 1.0 )\n\t);\n\n\tVarys.vTex = tex[ vertexIndex ];\n\tVarys.Position = vec4( pos[ vertexIndex ], 0.0, 1.0 );\n\n\treturn Varys;\n\n}\n"}),this.mipmapFragmentShaderModule=e.createShaderModule({label:"mipmapFragment",code:"\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img : texture_2d;\n\n@fragment\nfn main( @location( 0 ) vTex : vec2 ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img, imgSampler, vTex );\n\n}\n"}),this.flipYFragmentShaderModule=e.createShaderModule({label:"flipYFragment",code:"\n@group( 0 ) @binding( 0 )\nvar imgSampler : sampler;\n\n@group( 0 ) @binding( 1 )\nvar img : texture_2d;\n\n@fragment\nfn main( @location( 0 ) vTex : vec2 ) -> @location( 0 ) vec4 {\n\n\treturn textureSample( img, imgSampler, vec2( vTex.x, 1.0 - vTex.y ) );\n\n}\n"})}getTransferPipeline(e){let t=this.transferPipelines[e];return void 0===t&&(t=this.device.createRenderPipeline({label:`mipmap-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.mipmapFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:ZV,stripIndexFormat:fz},layout:"auto"}),this.transferPipelines[e]=t),t}getFlipYPipeline(e){let t=this.flipYPipelines[e];return void 0===t&&(t=this.device.createRenderPipeline({label:`flipY-${e}`,vertex:{module:this.mipmapVertexShaderModule,entryPoint:"main"},fragment:{module:this.flipYFragmentShaderModule,entryPoint:"main",targets:[{format:e}]},primitive:{topology:ZV,stripIndexFormat:fz},layout:"auto"}),this.flipYPipelines[e]=t),t}flipY(e,t,n=0){const r=t.format,{width:i,height:s}=t.size,a=this.getTransferPipeline(r),o=this.getFlipYPipeline(r),l=this.device.createTexture({size:{width:i,height:s,depthOrArrayLayers:1},format:r,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),u=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:QH,baseArrayLayer:n}),c=l.createView({baseMipLevel:0,mipLevelCount:1,dimension:QH,baseArrayLayer:0}),h=this.device.createCommandEncoder({}),A=(e,t,n)=>{const r=e.getBindGroupLayout(0),i=this.device.createBindGroup({layout:r,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t}]}),s=h.beginRenderPass({colorAttachments:[{view:n,loadOp:uz,storeOp:oz,clearValue:[0,0,0,0]}]});s.setPipeline(e),s.setBindGroup(0,i),s.draw(4,1,0,0),s.end()};A(a,u,c),A(o,c,u),this.device.queue.submit([h.finish()]),l.destroy()}generateMipmaps(e,t,n=0,r=null){const i=this.get(e);void 0===i.layers&&(i.layers=[]);const s=i.layers[n]||this._mipmapCreateBundles(e,t,n),a=r||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(a,s),null===r&&this.device.queue.submit([a.finish()]),i.layers[n]=s}_mipmapCreateBundles(e,t,n){const r=this.getTransferPipeline(t.format),i=r.getBindGroupLayout(0);let s=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:QH,baseArrayLayer:n});const a=[];for(let o=1;o0)for(let t=0,s=r.length;t0)for(let t=0,s=r.length;t0?e.width:n.size.width,u=a>0?e.height:n.size.height;o.queue.copyExternalImageToTexture({source:e,flipY:i},{texture:t,mipLevel:a,origin:{x:0,y:0,z:r},premultipliedAlpha:s},{width:l,height:u,depthOrArrayLayers:1})}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new oj(this.backend.device)),e}_generateMipmaps(e,t,n=0,r=null){this._getPassUtils().generateMipmaps(e,t,n,r)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,i,s=0,a=0){const o=this.backend.device,l=e.data,u=this._getBytesPerTexel(n.format),c=e.width*u;o.queue.writeTexture({texture:t,mipLevel:a,origin:{x:0,y:0,z:r}},l,{offset:e.width*e.height*u*s,bytesPerRow:c},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===i&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n){const r=this.backend.device,i=this._getBlockData(n.format),s=n.size.depthOrArrayLayers>1;for(let a=0;a]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,dj=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/gi,pj={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2":"vec2","vec2":"ivec2","vec2":"uvec2","vec2":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3":"vec3","vec3":"ivec3","vec3":"uvec3","vec3":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4":"vec4","vec4":"ivec4","vec4":"uvec4","vec4":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2":"mat2",mat2x2f:"mat2","mat3x3":"mat3",mat3x3f:"mat3","mat4x4":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"};class fj extends vq{constructor(e){const{type:t,inputs:n,name:r,inputsCode:i,blockCode:s,outputType:a}=(e=>{const t=(e=e.trim()).match(Aj);if(null!==t&&4===t.length){const n=t[2],r=[];let i=null;for(;null!==(i=dj.exec(n));)r.push({name:i[1],type:i[2]});const s=[];for(let e=0;e "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class mj extends _q{parseFunction(e){return new fj(e)}}const gj="undefined"!=typeof self?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},_j={[zy.READ_ONLY]:"read",[zy.WRITE_ONLY]:"write",[zy.READ_WRITE]:"read_write"},vj={[X]:"repeat",[Q]:"clamp",[$]:"mirror"},yj={vertex:gj?gj.VERTEX:1,fragment:gj?gj.FRAGMENT:2,compute:gj?gj.COMPUTE:4},bj={instance:!0,swizzleAssign:!1,storageBuffer:!0},xj={"^^":"tsl_xor"},Tj={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3",vec2:"vec2",ivec2:"vec2",uvec2:"vec2",bvec2:"vec2",vec3:"vec3",ivec3:"vec3",uvec3:"vec3",bvec3:"vec3",vec4:"vec4",ivec4:"vec4",uvec4:"vec4",bvec4:"vec4",mat2:"mat2x2",mat3:"mat3x3",mat4:"mat4x4"},Sj={},wj={tsl_xor:new eO("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new eO("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new eO("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new eO("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new eO("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new eO("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new eO("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new eO("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new eO("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new eO("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new eO("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new eO("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new eO("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")},Mj={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast"};let Ej="";!0!==("undefined"!=typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(Ej+="diagnostic( off, derivative_uniformity );\n");class Cj extends rq{constructor(e,t){super(e,t,new mj),this.uniformGroups={},this.builtins={},this.directives={},this.scopedArrays=new Map}_generateTextureSample(e,t,n,r,i,s=this.shaderStage){return"fragment"===s?r?i?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:i?`textureSample( ${t}, ${t}_sampler, ${n}, ${i} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,i,s){return!1===this.isUnfilterable(e)?s?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,s,r):this.generateTextureLod(e,t,n,i,s,r)}generateWrapFunction(e){const t=`tsl_coord_${vj[e.wrapS]}S_${vj[e.wrapT]}_${e.isData3DTexture?"3d":"2d"}T`;let n=Sj[t];if(void 0===n){const r=[],i=e.isData3DTexture?"vec3f":"vec2f";let s=`fn ${t}( coord : ${i} ) -> ${i} {\n\n\treturn ${i}(\n`;const a=(e,t)=>{e===X?(r.push(wj.repeatWrapping_float),s+=`\t\ttsl_repeatWrapping_float( coord.${t} )`):e===Q?(r.push(wj.clampWrapping_float),s+=`\t\ttsl_clampWrapping_float( coord.${t} )`):e===$?(r.push(wj.mirrorWrapping_float),s+=`\t\ttsl_mirrorWrapping_float( coord.${t} )`):(s+=`\t\tcoord.${t}`,Rt(`WebGPURenderer: Unsupported texture wrap type "${e}" for vertex shader.`))};a(e.wrapS,"x"),s+=",\n",a(e.wrapT,"y"),e.isData3DTexture&&(s+=",\n",a(e.wrapR,"z")),s+="\n\t);\n\n}\n",Sj[t]=n=new eO(s,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){const r=this.getDataFromNode(e,this.shaderStage,this.globalCache);void 0===r.dimensionsSnippet&&(r.dimensionsSnippet={});let i=r.dimensionsSnippet[n];if(void 0===r.dimensionsSnippet[n]){let s,a;const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),l=o>1;a=e.isData3DTexture?"vec3":"vec2",s=l||e.isStorageTexture?t:`${t}${n?`, u32( ${n} )`:""}`,i=new uw(new Qw(`textureDimensions( ${s} )`,a)),r.dimensionsSnippet[n]=i,(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)&&(r.arrayLayerCount=new uw(new Qw(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new uw(new Qw("6u","u32")))}return i.build(this)}generateFilteredTexture(e,t,n,r,i="0u"){this._include("biquadraticTexture");const s=this.generateWrapFunction(e),a=this.generateTextureDimension(e,t,i);return r&&(n=`${n} + vec2(${r}) / ${a}`),`tsl_biquadraticTexture( ${t}, ${s}( ${n} ), ${a}, u32( ${i} ) )`}generateTextureLod(e,t,n,r,i,s="0u"){const a=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,s),l=e.isData3DTexture?"vec3":"vec2";i&&(n=`${n} + ${l}(${i}) / ${l}( ${o} )`);const u=`${l}( ${a}( ${n} ) * ${l}( ${o} ) )`;return this.generateTextureLoad(e,t,u,s,r,null)}generateTextureLoad(e,t,n,r,i,s){let a;return null===r&&(r="0u"),s&&(n=`${n} + ${s}`),i?a=`textureLoad( ${t}, ${n}, ${i}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,i){let s;return s=r?`textureStore( ${t}, ${n}, ${r}, ${i} )`:`textureStore( ${t}, ${n}, ${i} )`,s}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&!0===e.isDataTexture&&e.type===le||!1===this.isSampleCompare(e)&&e.minFilter===Y&&e.magFilter===Y||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,i,s=this.shaderStage){let a=null;return a=this.isUnfilterable(e)?this.generateTextureLod(e,t,n,r,i,"0",s):this._generateTextureSample(e,t,n,r,i,s),a}generateTextureGrad(e,t,n,r,i,s,a=this.shaderStage){if("fragment"===a)return s?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${s} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;Nt(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,i,s,a=this.shaderStage){if("fragment"===a)return!0===e.isDepthTexture&&!0===e.isArrayTexture?s?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i}, ${r}, ${s} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${i}, ${r} )`:s?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;Nt(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureLevel(e,t,n,r,i,s){return!1===this.isUnfilterable(e)?s?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,s,r):this.generateTextureLod(e,t,n,i,s,r)}generateTextureBias(e,t,n,r,i,s,a=this.shaderStage){if("fragment"===a)return s?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;Nt(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){const t=e.name,n=e.type;return"texture"===n||"cubeTexture"===n||"storageTexture"===n||"texture3D"===n?t:"buffer"===n||"storageBuffer"===n||"indirectStorageBuffer"===n?this.isCustomStruct(e)?t:t+".value":e.groupNode.name+"."+t}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){const t=xj[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?(Rt("WebGPURenderer: Atomic operations are only supported in compute shaders."),zy.READ_WRITE):zy.READ_ONLY:e.access}getStorageAccess(e,t){return _j[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){const i=super.getUniformFromNode(e,t,n,r),s=this.getDataFromNode(e,n,this.globalCache);if(void 0===s.uniformGPU){let a;const o=e.groupNode,l=o.name,u=this.getBindGroupArray(l,n);if("texture"===t||"cubeTexture"===t||"storageTexture"===t||"texture3D"===t){let r=null;const s=this.getNodeAccess(e,n);if("texture"===t||"storageTexture"===t?r=!0===e.value.is3DTexture?new mV(i.name,i.node,o,s):new pV(i.name,i.node,o,s):"cubeTexture"===t?r=new fV(i.name,i.node,o,s):"texture3D"===t&&(r=new mV(i.name,i.node,o,s)),r.store=!0===e.isStorageTextureNode,r.mipLevel=r.store?e.mipLevel:0,r.setVisibility(yj[n]),!1===this.isUnfilterable(e.value)&&!1===r.store){const e=new rj(`${i.name}_sampler`,i.node,o);e.setVisibility(yj[n]),u.push(e,r),a=[e,r]}else u.push(r),a=[r]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){const s=new("buffer"===t?oV:aj)(e,o);s.setVisibility(yj[n]),u.push(s),a=s,i.name=r||"NodeBuffer_"+i.id}else{const e=this.uniformGroups[n]||(this.uniformGroups[n]={});let r=e[l];void 0===r&&(r=new cV(l,o),r.setVisibility(yj[n]),e[l]=r,u.push(r)),a=this.getNodeUniform(i,t),r.addUniform(a)}s.uniformGPU=a}return i}getBuiltin(e,t,n,r=this.shaderStage){const i=this.builtins[r]||(this.builtins[r]=new Map);return!1===i.has(e)&&i.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),r=[];for(const e of t.inputs)r.push(e.name+" : "+this.getType(e.type));let i=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {\n${n.vars}\n${n.code}\n`;return n.result&&(i+=`\treturn ${n.result};\n`),i+="\n}\n",i}getInstanceIndex(){return"vertex"===this.shaderStage?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){const t=[],n=this.directives[e];if(void 0!==n)for(const e of n)t.push(`enable ${e};`);return t.join("\n")}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array`,"vertex")}getBuiltins(e){const t=[],n=this.builtins[e];if(void 0!==n)for(const{name:e,property:r,type:i}of n.values())t.push(`@builtin( ${e} ) ${r} : ${i}`);return t.join(",\n\t")}getScopedArray(e,t,n,r){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:n,bufferCount:r}),e}getScopedArrays(e){if("compute"!==e)return;const t=[];for(const{name:e,scope:n,bufferType:r,bufferCount:i}of this.scopedArrays.values()){const s=this.getType(r);t.push(`var<${n}> ${e}: array< ${s}, ${i} >;`)}return t.join("\n")}getAttributes(e){const t=[];if("compute"===e&&(this.getBuiltin("global_invocation_id","globalId","vec3","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3","attribute"),this.getBuiltin("local_invocation_id","localId","vec3","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),"vertex"===e||"compute"===e){const e=this.getBuiltins("attribute");e&&t.push(e);const n=this.getAttributesArray();for(let e=0,r=n.length;e"),t.push(`\t${r+n.name} : ${i}`)}return e.output&&t.push(`\t${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="";const n=this.structs[e];if(n.length>0){const e=[];for(const t of n){let n=`struct ${t.name} {\n`;n+=this.getStructMembers(t),n+="\n};",e.push(n)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,n=null){let r=`var ${t} : `;return r+=null!==n?this.generateArrayDeclaration(e,n):this.getType(e),r}getVars(e){const t=[],n=this.vars[e];if(void 0!==n)for(const e of n)t.push(`\t${this.getVar(e.type,e.name,e.count)};`);return`\n${t.join("\n")}\n`}getVaryings(e){const t=[];if("vertex"===e&&this.getBuiltin("position","Vertex","vec4","vertex"),"vertex"===e||"fragment"===e){const n=this.varyings,r=this.vars[e];for(let i=0;in.value.itemSize;return r&&!i}getUniforms(e){const t=this.uniforms[e],n=[],r=[],i=[],s={};for(const i of t){const t=i.groupNode.name,a=this.bindingsIndexes[t];if("texture"===i.type||"cubeTexture"===i.type||"storageTexture"===i.type||"texture3D"===i.type){const t=i.node.value;let r;!1===this.isUnfilterable(t)&&!0!==i.node.isStorageTextureNode&&(this.isSampleCompare(t)?n.push(`@binding( ${a.binding++} ) @group( ${a.group} ) var ${i.name}_sampler : sampler_comparison;`):n.push(`@binding( ${a.binding++} ) @group( ${a.group} ) var ${i.name}_sampler : sampler;`));let s="";const{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(t);if(o>1&&(s="_multisampled"),!0===t.isCubeTexture)r="texture_cube";else if(!0===t.isDepthTexture)r=this.renderer.backend.compatibilityMode&&null===t.compareFunction?`texture${s}_2d`:`texture_depth${s}_2d${!0===t.isArrayTexture?"_array":""}`;else if(!0===i.node.isStorageTextureNode){const n=hj(t),s=this.getStorageAccess(i.node,e),a=i.node.value.is3DTexture,o=i.node.value.isArrayTexture;r=`texture_storage_${a?"3d":"2d"+(o?"_array":"")}<${n}, ${s}>`}else if(!0===t.isArrayTexture||!0===t.isDataArrayTexture||!0===t.isCompressedArrayTexture)r="texture_2d_array";else if(!0===t.is3DTexture||!0===t.isData3DTexture)r="texture_3d";else{r=`texture${s}_2d<${this.getComponentTypeFromTexture(t).charAt(0)}32>`}n.push(`@binding( ${a.binding++} ) @group( ${a.group} ) var ${i.name} : ${r};`)}else if("buffer"===i.type||"storageBuffer"===i.type||"indirectStorageBuffer"===i.type){const t=i.node,n=this.getType(t.getNodeType(this)),s=t.bufferCount,o=s>0&&"buffer"===i.type?", "+s:"",l=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(i))r.push(`@binding( ${a.binding++} ) @group( ${a.group} ) var<${l}> ${i.name} : ${n};`);else{const e=`\tvalue : array< ${t.isAtomic?`atomic<${n}>`:`${n}`}${o} >`;r.push(this._getWGSLStructBinding(i.name,e,l,a.binding++,a.group))}}else{const e=this.getType(this.getVectorType(i.type)),t=i.groupNode.name;(s[t]||(s[t]={index:a.binding++,id:a.group,snippets:[]})).snippets.push(`\t${i.name} : ${e}`)}}for(const e in s){const t=s[e];i.push(this._getWGSLStructBinding(e,t.snippets.join(",\n"),"uniform",t.index,t.id))}let a=n.join("\n");return a+=r.join("\n"),a+=i.join("\n"),a}buildCode(){const e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(const t in e){this.shaderStage=t;const n=e[t];n.uniforms=this.getUniforms(t),n.attributes=this.getAttributes(t),n.varyings=this.getVaryings(t),n.structs=this.getStructs(t),n.vars=this.getVars(t),n.codes=this.getCodes(t),n.directives=this.getDirectives(t),n.scopedArrays=this.getScopedArrays(t);let r="// code\n\n";r+=this.flowCode[t];const i=this.flowNodes[t],s=i[i.length-1],a=s.outputNode,o=void 0!==a&&!0===a.isOutputStructNode;for(const e of i){const i=this.getFlowData(e),l=e.name;if(l&&(r.length>0&&(r+="\n"),r+=`\t// flow -> ${l}\n`),r+=`${i.code}\n\t`,e===s&&"compute"!==t)if(r+="// result\n\n\t","vertex"===t)r+=`varyings.Vertex = ${i.result};`;else if("fragment"===t)if(o)n.returnType=a.getNodeType(this),n.structs+="var output : "+n.returnType+";",r+=`return ${i.result};`;else{let e="\t@location(0) color: vec4";const t=this.getBuiltins("output");t&&(e+=",\n\t"+t),n.returnType="OutputStruct",n.structs+=this._getWGSLStruct("OutputStruct",e),n.structs+="\nvar output : OutputStruct;",r+=`output.color = ${i.result};\n\n\treturn output;`}}n.flow=r}if(this.shaderStage=null,null!==this.material)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{const t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return null!==t&&(n=this._getWGSLMethod(e+"_"+t)),void 0===n&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return Tj[e]||e}isAvailable(e){let t=bj[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),bj[e]=t),t}_getWGSLMethod(e){return void 0!==wj[e]&&this._include(e),Mj[e]}_include(e){const t=wj[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\n// directives\n${e.directives}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// varyings\n${e.varyings}\nvar varyings : VaryingsStruct;\n\n// codes\n${e.codes}\n\n@vertex\nfn main( ${e.attributes} ) -> VaryingsStruct {\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n\treturn varyings;\n\n}\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\n// global\n${Ej}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// codes\n${e.codes}\n\n@fragment\nfn main( ${e.varyings} ) -> ${e.returnType} {\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLComputeCode(e,t){const[n,r,i]=t;return`${this.getSignature()}\n// directives\n${e.directives}\n\n// system\nvar instanceIndex : u32;\n\n// locals\n${e.scopedArrays}\n\n// structs\n${e.structs}\n\n// uniforms\n${e.uniforms}\n\n// codes\n${e.codes}\n\n@compute @workgroup_size( ${n}, ${r}, ${i} )\nfn main( ${e.attributes} ) {\n\n\t// system\n\tinstanceIndex = globalId.x\n\t\t+ globalId.y * ( ${n} * numWorkgroups.x )\n\t\t+ globalId.z * ( ${n} * numWorkgroups.x ) * ( ${r} * numWorkgroups.y );\n\n\t// vars\n\t${e.vars}\n\n\t// flow\n\t${e.flow}\n\n}\n`}_getWGSLStruct(e,t){return`\nstruct ${e} {\n${t}\n};`}_getWGSLStructBinding(e,t,n,r=0,i=0){const s=e+"Struct";return`${this._getWGSLStruct(s,t)}\n@binding( ${r} ) @group( ${i} )\nvar<${n}> ${e} : ${s};`}}class Rj{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return null!==e.depthTexture?t=this.getTextureFormatGPU(e.depthTexture):e.depth&&e.stencil?t=eG:e.depth&&(t=Jz),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){const e=this.backend.renderer,n=e.getRenderTarget();t=n?n.samples:e.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=t||1;const n=t>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return t=null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return null!==e.textures?e.textures.map(e=>this.getTextureFormatGPU(e)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?QV:e.isLineSegments||e.isMesh&&!0===t.wireframe?$V:e.isLine?YV:e.isMesh?KV:void 0}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){const e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(e===ne)return Fz;if(e===ue)return Qz;throw new Error("Unsupported outputType")}}const Nj=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"undefined"!=typeof Float16Array&&Nj.set(Float16Array,["float16"]);const Pj=new Map([[Kr,["float16"]]]),Dj=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class Lj{constructor(e){this.backend=e}createAttribute(e,t){const n=this._getBufferAttribute(e),r=this.backend,i=r.get(n);let s=i.buffer;if(void 0===s){const a=r.device;let o=n.array;if(!1===e.normalized)if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e1&&(r.multisampled=!0,n.texture.isDepthTexture||(r.sampleType=zH)),n.texture.isDepthTexture)t.compatibilityMode&&null===n.texture.compareFunction?r.sampleType=zH:r.sampleType=GH;else if(n.texture.isDataTexture||n.texture.isDataArrayTexture||n.texture.isData3DTexture){const e=n.texture.type;e===ae?r.sampleType=HH:e===oe?r.sampleType=jH:e===le&&(this.backend.hasFeature("float32-filterable")?r.sampleType=VH:r.sampleType=zH)}n.isSampledCubeTexture?r.viewDimension=YH:n.texture.isArrayTexture||n.texture.isDataArrayTexture||n.texture.isCompressedArrayTexture?r.viewDimension=$H:n.isSampledTexture3D&&(r.viewDimension=KH),e.texture=r}else if(n.isSampler){const r={};n.texture.isDepthTexture&&(null!==n.texture.compareFunction?r.type=qH:t.compatibilityMode&&(r.type=kH)),e.sampler=r}else Nt(`WebGPUBindingUtils: Unsupported binding "${n}".`);r.push(e)}return n.createBindGroupLayout({entries:r})}createBindings(e,t,n,r=0){const{backend:i,bindGroupLayoutCache:s}=this,a=i.get(e);let o,l=s.get(e.bindingsReference);void 0===l&&(l=this.createBindingsLayout(e),s.set(e.bindingsReference,l)),n>0&&(void 0===a.groups&&(a.groups=[],a.versions=[]),a.versions[n]===r&&(o=a.groups[n])),void 0===o&&(o=this.createBindGroup(e,l),n>0&&(a.groups[n]=o,a.versions[n]=r)),a.group=o,a.layout=l}updateBinding(e){const t=this.backend,n=t.device,r=e.buffer,i=t.get(e).buffer;n.queue.writeBuffer(i,0,r,0)}createBindGroupIndex(e,t){const n=this.backend.device,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,i=e[0],s=n.createBuffer({label:"bindingCameraIndex_"+i,size:16,usage:r});n.queue.writeBuffer(s,0,e,0);const a=[{binding:0,resource:{buffer:s}}];return n.createBindGroup({label:"bindGroupCameraIndex_"+i,layout:t,entries:a})}createBindGroup(e,t){const n=this.backend,r=n.device;let i=0;const s=[];for(const t of e.bindings){if(t.isUniformBuffer){const e=n.get(t);if(void 0===e.buffer){const n=t.byteLength,i=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=r.createBuffer({label:"bindingBuffer_"+t.name,size:n,usage:i});e.buffer=s}s.push({binding:i,resource:{buffer:e.buffer}})}else if(t.isStorageBuffer){const e=n.get(t);if(void 0===e.buffer){const r=t.attribute;e.buffer=n.get(r).buffer}s.push({binding:i,resource:{buffer:e.buffer}})}else if(t.isSampledTexture){const e=n.get(t.texture);let a;if(void 0!==e.externalTexture)a=r.importExternalTexture({source:e.externalTexture});else{const n=t.store?1:e.texture.mipLevelCount,r=t.store?t.mipLevel:0;let i=`view-${e.texture.width}-${e.texture.height}`;if(e.texture.depthOrArrayLayers>1&&(i+=`-${e.texture.depthOrArrayLayers}`),i+=`-${n}-${r}`,a=e[i],void 0===a){const s=ZH;let o;o=t.isSampledCubeTexture?YH:t.isSampledTexture3D?KH:t.texture.isArrayTexture||t.texture.isDataArrayTexture||t.texture.isCompressedArrayTexture?$H:QH,a=e[i]=e.texture.createView({aspect:s,dimension:o,mipLevelCount:n,baseMipLevel:r})}}s.push({binding:i,resource:a})}else if(t.isSampler){const e=n.get(t.texture);s.push({binding:i,resource:e.sampler})}i++}return r.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:s})}}class Uj{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){const{object:n,material:r,geometry:i,pipeline:s}=e,{vertexProgram:a,fragmentProgram:o}=s,l=this.backend,u=l.device,c=l.utils,h=l.get(s),A=[];for(const t of e.getBindings()){const e=l.get(t);A.push(e.layout)}const d=l.attributeUtils.createShaderVertexBuffers(e);let p;0===r.blending||1===r.blending&&!1===r.transparent||(p=this._getBlending(r));let f={};!0===r.stencilWrite&&(f={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});const m=this._getColorWriteMask(r),g=[];if(null!==e.context.textures){const t=e.context.textures;for(let e=0;e1},layout:u.createPipelineLayout({bindGroupLayouts:A})},w={},M=e.context.depth,E=e.context.stencil;if(!0!==M&&!0!==E||(!0===M&&(w.format=x,w.depthWriteEnabled=r.depthWrite,w.depthCompare=b),!0===E&&(w.stencilFront=f,w.stencilBack={},w.stencilReadMask=r.stencilFuncMask,w.stencilWriteMask=r.stencilWriteMask),!0===r.polygonOffset&&(w.depthBias=r.polygonOffsetUnits,w.depthBiasSlopeScale=r.polygonOffsetFactor,w.depthBiasClamp=0),S.depthStencil=w),u.pushErrorScope("validation"),null===t)h.pipeline=u.createRenderPipeline(S),u.popErrorScope().then(e=>{null!==e&&(h.error=!0,Nt(e.message))});else{const e=new Promise(async e=>{try{h.pipeline=await u.createRenderPipelineAsync(S)}catch(e){}const t=await u.popErrorScope();null!==t&&(h.error=!0,Nt(t.message)),e()});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){const n=this.backend,{utils:r,device:i}=n,s=r.getCurrentDepthStencilFormat(e),a={label:t,colorFormats:r.getCurrentColorFormats(e),depthStencilFormat:s,sampleCount:this._getSampleCount(e)};return i.createRenderBundleEncoder(a)}createComputePipeline(e,t){const n=this.backend,r=n.device,i=n.get(e.computeProgram).module,s=n.get(e),a=[];for(const e of t){const t=n.get(e);a.push(t.layout)}s.pipeline=r.createComputePipeline({compute:i,layout:r.createPipelineLayout({bindGroupLayouts:a})})}_getBlending(e){let t,n;const r=e.blending,i=e.blendSrc,s=e.blendDst,a=e.blendEquation;if(5===r){const r=null!==e.blendSrcAlpha?e.blendSrcAlpha:i,o=null!==e.blendDstAlpha?e.blendDstAlpha:s,l=null!==e.blendEquationAlpha?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(s),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(r),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(l)}}else{const i=(e,r,i,s)=>{t={srcFactor:e,dstFactor:r,operation:vH},n={srcFactor:i,dstFactor:s,operation:vH}};if(e.premultipliedAlpha)switch(r){case 1:i(oH,hH,oH,hH);break;case 2:i(oH,oH,oH,oH);break;case 3:i(aH,uH,aH,oH);break;case 4:i(AH,hH,aH,oH)}else switch(r){case 1:i(cH,hH,oH,hH);break;case 2:i(cH,oH,oH,oH);break;case 3:Nt("WebGPURenderer: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:Nt("WebGPURenderer: MultiplyBlending requires material.premultipliedAlpha = true")}}if(void 0!==t&&void 0!==n)return{color:t,alpha:n};Nt("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case v:t=aH;break;case 201:t=oH;break;case 202:t=lH;break;case 203:t=uH;break;case T:t=cH;break;case S:t=hH;break;case 208:t=AH;break;case 209:t=dH;break;case 206:t=pH;break;case 207:t=fH;break;case 210:t=mH;break;case 211:t=gH;break;case 212:t=_H;break;default:Nt("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t;const n=e.stencilFunc;switch(n){case 512:t=JV;break;case 519:t=az;break;case 513:t=ez;break;case 515:t=nz;break;case 514:t=tz;break;case 518:t=sz;break;case 516:t=rz;break;case 517:t=iz;break;default:Nt("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case lt:t=MH;break;case 0:t=EH;break;case 7681:t=CH;break;case 5386:t=RH;break;case 7682:t=NH;break;case 7683:t=PH;break;case 34055:t=DH;break;case 34056:t=LH;break;default:Nt("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case m:t=vH;break;case 101:t=yH;break;case 102:t=bH;break;case 103:t=xH;break;case 104:t=TH;break;default:Nt("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){const r={},i=this.backend.utils;r.topology=i.getPrimitiveTopology(e,n),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?pz:fz);let s=1===n.side;return e.isMesh&&e.matrixWorld.determinant()<0&&(s=!s),r.frontFace=!0===s?hz:cz,r.cullMode=2===n.side?Az:dz,r}_getColorWriteMask(e){return!0===e.colorWrite?wH:SH}_getDepthCompare(e){let t;if(!1===e.depthTest)t=az;else{const n=e.depthFunc;switch(n){case 0:t=JV;break;case 1:t=az;break;case 2:t=ez;break;case 3:t=nz;break;case 4:t=tz;break;case 5:t=sz;break;case 6:t=rz;break;case 7:t=iz;break;default:Nt("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}}class Oj extends jV{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const r=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:r,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Pt(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;const t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||0===this.currentQueryIndex||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if("unmapped"!==this.resultBuffer.mapState)return this.lastValue;const e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();const r=this.device.createCommandEncoder();r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);const i=r.finish();if(this.device.queue.submit([i]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;const s=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},o=[];for(const[t,n]of e){const e=t.match(/^(.*):f(\d+)$/),r=parseInt(e[2]);!1===o.includes(r)&&o.push(r),void 0===a[r]&&(a[r]=0);const i=s[n],l=s[n+1],u=Number(l-i)/1e6;this.timestamps.set(t,u),a[r]+=u}const l=a[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=l,this.frames=o,l}catch(e){return e("Error resolving queries:",e),"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){e("Error waiting for pending resolve:",e)}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(e){e("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}class Bj extends EV{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.compatibilityMode=void 0!==e.compatibilityMode&&e.compatibilityMode,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=this.parameters.compatibilityMode,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new Rj(this),this.attributeUtils=new Lj(this),this.bindingUtils=new Ij(this),this.pipelineUtils=new Uj(this),this.textureUtils=new cj(this),this.occludedResolveCache=new Map}async init(e){await super.init(e);const t=this.parameters;let n;if(void 0===t.device){const e={powerPreference:t.powerPreference,featureLevel:t.compatibilityMode?"compatibility":void 0},r="undefined"!=typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===r)throw new Error("WebGPUBackend: Unable to create WebGPU adapter.");const i=Object.values(tj),s=[];for(const e of i)r.features.has(e)&&s.push(e);const a={requiredFeatures:s,requiredLimits:t.requiredLimits};n=await r.requestDevice(a)}else n=t.device;n.lost.then(t=>{const n={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(n)}),this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(tj.TimestampQuery),this.updateSize()}get context(){const e=this.renderer.getCanvasTarget(),t=this.get(e);let n=t.context;if(void 0===n){const r=this.parameters;n=!0===e.isDefaultCanvasTarget&&void 0!==r.context?r.context:e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${s} webgpu`);const i=r.alpha?"premultiplied":"opaque",a=r.outputType===ue?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:i,toneMapping:{mode:a}}),t.context=n}return n}get coordinateSystem(){return bt}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){const e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples;let i=n.descriptor;if(void 0===i||n.samples!==r){i={colorAttachments:[{view:null}]},!0!==e.depth&&!0!==e.stencil||(i.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});const t=i.colorAttachments[0];r>0?t.view=this.textureUtils.getColorBuffer().createView():t.resolveTarget=void 0,n.descriptor=i,n.samples=r}const s=i.colorAttachments[0];return r>0?s.resolveTarget=this.context.getCurrentTexture().createView():s.view=this.context.getCurrentTexture().createView(),i}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){const n=e.renderTarget,r=this.get(n);let i=r.descriptors;void 0!==i&&r.width===n.width&&r.height===n.height&&r.samples===n.samples||(i={},r.descriptors=i);const s=e.getCacheKey();let a=i[s];if(void 0===a){const t=e.textures,o=[];let l;const u=this._isRenderCameraDepthArray(e);for(let r=0;r1)if(!0===u){const t=e.camera.cameras;for(let e=0;e0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,i=n.createQuerySet({type:"occlusion",count:r,label:`occlusionQuerySet_${e.id}`}),t.occlusionQuerySet=i,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null),s=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:lz}),this.initTimestampQuery(Tt,this.getTimestampUID(e),s),s.occlusionQuerySet=i;const a=s.depthStencilAttachment;if(null!==e.textures){const t=s.colorAttachments;for(let n=0;n0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();const r=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){const n=[];for(let e=0;e0){const r=8*n;let i=this.occludedResolveCache.get(r);void 0===i&&(i=this.device.createBuffer({size:r,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(r,i));const s=this.device.createBuffer({size:r,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,i,0),t.encoder.copyBufferToBuffer(i,0,s,0,r),t.occlusionQueryBuffer=s,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){const t=e.textures;for(let e=0;eo&&(i[0]=Math.min(a,o),i[1]=Math.ceil(a/o)),s.dispatchSize=i}i=s.dispatchSize}a.dispatchWorkgroups(i[0],i[1]||1,i[2]||1)}finishCompute(e){const t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}draw(e,t){const{object:n,material:r,context:i,pipeline:s}=e,a=e.getBindings(),o=this.get(i),l=this.get(s),u=l.pipeline;if(!0===l.error)return;const c=e.getIndex(),h=null!==c,A=e.getDrawParameters();if(null===A)return;const d=(t,n)=>{this.pipelineUtils.setPipeline(t,u),n.pipeline=u;const s=n.bindingGroups;for(let e=0,n=a.length;e{if(d(r,i),!0===n.isBatchedMesh){const e=n._multiDrawStarts,i=n._multiDrawCounts,s=n._multiDrawCount,a=n._multiDrawInstances;null!==a&&Pt("WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");for(let o=0;o1?0:o;!0===h?r.drawIndexed(i[o],s,e[o]/c.array.BYTES_PER_ELEMENT,0,l):r.draw(i[o],s,e[o],l),t.update(n,i[o],s)}}else if(!0===h){const{vertexCount:i,instanceCount:s,firstVertex:a}=A,o=e.getIndirect();if(null!==o){const e=this.get(o).buffer;r.drawIndexedIndirect(e,0)}else r.drawIndexed(i,s,a,0,0);t.update(n,i,s)}else{const{vertexCount:i,instanceCount:s,firstVertex:a}=A,o=e.getIndirect();if(null!==o){const e=this.get(o).buffer;r.drawIndirect(e,0)}else r.draw(i,s,a,0);t.update(n,i,s)}};if(e.camera.isArrayCamera&&e.camera.cameras.length>0){const t=this.get(e.camera),r=e.camera.cameras,s=e.getBindingGroup("cameraIndex");if(void 0===t.indexesGPU||t.indexesGPU.length!==r.length){const e=this.get(s),n=[],i=new Uint32Array([0,0,0,0]);for(let t=0,s=r.length;t(Rt("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new XV(e)));super(new t(e),e),this.library=new qj,this.isWebGPURenderer=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}xk.BRDF_GGX,xk.BRDF_Lambert,xk.BasicPointShadowFilter,xk.BasicShadowFilter,xk.Break,xk.Const,xk.Continue,xk.DFGApprox,xk.D_GGX,xk.Discard,xk.EPSILON,xk.F_Schlick;const zj=xk.Fn;xk.INFINITY;const Gj=xk.If,Hj=xk.Loop;xk.NodeAccess,xk.NodeShaderStage,xk.NodeType,xk.NodeUpdateType,xk.PCFShadowFilter,xk.PCFSoftShadowFilter,xk.PI,xk.PI2,xk.TWO_PI,xk.HALF_PI,xk.PointShadowFilter,xk.Return,xk.Schlick_to_F0,xk.ScriptableNodeResources,xk.ShaderNode,xk.Stack,xk.Switch,xk.TBNViewMatrix,xk.VSMShadowFilter,xk.V_GGX_SmithCorrelated,xk.Var,xk.VarIntent,xk.abs,xk.acesFilmicToneMapping,xk.acos,xk.add,xk.addMethodChaining,xk.addNodeElement,xk.agxToneMapping,xk.all,xk.alphaT,xk.and,xk.anisotropy,xk.anisotropyB,xk.anisotropyT,xk.any,xk.append,xk.array,xk.arrayBuffer;const jj=xk.asin;xk.assign,xk.atan,xk.atan2,xk.atomicAdd,xk.atomicAnd,xk.atomicFunc,xk.atomicLoad,xk.atomicMax,xk.atomicMin,xk.atomicOr,xk.atomicStore,xk.atomicSub,xk.atomicXor,xk.attenuationColor,xk.attenuationDistance,xk.attribute,xk.attributeArray,xk.backgroundBlurriness,xk.backgroundIntensity,xk.backgroundRotation,xk.batch,xk.bentNormalView,xk.billboarding,xk.bitAnd,xk.bitNot,xk.bitOr,xk.bitXor,xk.bitangentGeometry,xk.bitangentLocal,xk.bitangentView,xk.bitangentWorld,xk.bitcast,xk.blendBurn,xk.blendColor,xk.blendDodge,xk.blendOverlay,xk.blendScreen,xk.blur,xk.bool,xk.buffer,xk.bufferAttribute,xk.bumpMap,xk.burn,xk.builtin,xk.bvec2,xk.bvec3,xk.bvec4,xk.bypass,xk.cache,xk.call,xk.cameraFar,xk.cameraIndex,xk.cameraNear,xk.cameraNormalMatrix,xk.cameraPosition,xk.cameraProjectionMatrix,xk.cameraProjectionMatrixInverse,xk.cameraViewMatrix,xk.cameraViewport,xk.cameraWorldMatrix,xk.cbrt,xk.cdl,xk.ceil,xk.checker,xk.cineonToneMapping,xk.clamp,xk.clearcoat,xk.clearcoatNormalView,xk.clearcoatRoughness,xk.code,xk.color,xk.colorSpaceToWorking,xk.colorToDirection,xk.compute,xk.computeKernel,xk.computeSkinning,xk.context,xk.convert,xk.convertColorSpace,xk.convertToTexture;const Wj=xk.cos;xk.cross,xk.cubeTexture,xk.cubeTextureBase,xk.cubeToUV,xk.dFdx,xk.dFdy,xk.dashSize,xk.debug,xk.decrement,xk.decrementBefore,xk.defaultBuildStages,xk.defaultShaderStages,xk.defined,xk.degrees,xk.deltaTime,xk.densityFog,xk.densityFogFactor,xk.depth,xk.depthPass,xk.determinant,xk.difference,xk.diffuseColor,xk.directPointLight,xk.directionToColor,xk.directionToFaceDirection,xk.dispersion,xk.distance,xk.div,xk.dodge,xk.dot,xk.drawIndex,xk.dynamicBufferAttribute,xk.element,xk.emissive,xk.equal,xk.equals,xk.equirectUV;const Xj=xk.exp;xk.exp2,xk.expression,xk.faceDirection,xk.faceForward,xk.faceforward;const Qj=xk.float;xk.floatBitsToInt,xk.floatBitsToUint,xk.floor,xk.fog,xk.fract,xk.frameGroup,xk.frameId,xk.frontFacing,xk.fwidth,xk.gain,xk.gapSize,xk.getConstNodeType,xk.getCurrentStack,xk.getDirection,xk.getDistanceAttenuation,xk.getGeometryRoughness,xk.getNormalFromDepth,xk.interleavedGradientNoise,xk.getParallaxCorrectNormal,xk.getRoughness,xk.getScreenPosition,xk.getShIrradianceAt,xk.getShadowMaterial,xk.getShadowRenderObjectFunction,xk.getTextureIndex,xk.getViewPosition,xk.globalId,xk.glsl,xk.glslFn,xk.grayscale,xk.greaterThan,xk.greaterThanEqual,xk.hash,xk.highpModelNormalViewMatrix,xk.highpModelViewMatrix,xk.hue,xk.increment,xk.incrementBefore,xk.instance;const $j=xk.instanceIndex;xk.instancedArray,xk.instancedBufferAttribute,xk.instancedDynamicBufferAttribute,xk.instancedMesh,xk.int,xk.intBitsToFloat,xk.inverse,xk.inverseSqrt,xk.inversesqrt,xk.invocationLocalIndex,xk.invocationSubgroupIndex,xk.ior,xk.iridescence,xk.iridescenceIOR,xk.iridescenceThickness,xk.ivec2,xk.ivec3,xk.ivec4,xk.js,xk.label,xk.length,xk.lengthSq,xk.lessThan,xk.lessThanEqual,xk.lightPosition,xk.lightProjectionUV,xk.lightShadowMatrix,xk.lightTargetDirection,xk.lightTargetPosition,xk.lightViewPosition,xk.lightingContext,xk.lights,xk.linearDepth,xk.linearToneMapping,xk.localId,xk.log,xk.log2,xk.logarithmicDepthToViewZ,xk.luminance,xk.mat2,xk.mat3,xk.mat4,xk.matcapUV,xk.materialAO,xk.materialAlphaTest,xk.materialAnisotropy,xk.materialAnisotropyVector,xk.materialAttenuationColor,xk.materialAttenuationDistance,xk.materialClearcoat,xk.materialClearcoatNormal,xk.materialClearcoatRoughness,xk.materialColor,xk.materialDispersion,xk.materialEmissive,xk.materialEnvIntensity,xk.materialEnvRotation,xk.materialIOR,xk.materialIridescence,xk.materialIridescenceIOR,xk.materialIridescenceThickness,xk.materialLightMap,xk.materialLineDashOffset,xk.materialLineDashSize,xk.materialLineGapSize,xk.materialLineScale,xk.materialLineWidth,xk.materialMetalness,xk.materialNormal,xk.materialOpacity,xk.materialPointSize,xk.materialReference,xk.materialReflectivity,xk.materialRefractionRatio,xk.materialRotation,xk.materialRoughness,xk.materialSheen,xk.materialSheenRoughness,xk.materialShininess,xk.materialSpecular,xk.materialSpecularColor,xk.materialSpecularIntensity,xk.materialSpecularStrength,xk.materialThickness,xk.materialTransmission,xk.max,xk.maxMipLevel,xk.mediumpModelViewMatrix,xk.metalness,xk.min,xk.mix,xk.mixElement,xk.mod,xk.modInt,xk.modelDirection,xk.modelNormalMatrix,xk.modelPosition,xk.modelRadius,xk.modelScale,xk.modelViewMatrix,xk.modelViewPosition,xk.modelViewProjection,xk.modelWorldMatrix,xk.modelWorldMatrixInverse,xk.morphReference,xk.mrt,xk.mul,xk.mx_aastep,xk.mx_add,xk.mx_atan2,xk.mx_cell_noise_float,xk.mx_contrast,xk.mx_divide,xk.mx_fractal_noise_float,xk.mx_fractal_noise_vec2,xk.mx_fractal_noise_vec3,xk.mx_fractal_noise_vec4,xk.mx_frame,xk.mx_heighttonormal,xk.mx_hsvtorgb,xk.mx_ifequal,xk.mx_ifgreater,xk.mx_ifgreatereq,xk.mx_invert,xk.mx_modulo,xk.mx_multiply,xk.mx_noise_float,xk.mx_noise_vec3,xk.mx_noise_vec4,xk.mx_place2d,xk.mx_power,xk.mx_ramp4,xk.mx_ramplr,xk.mx_ramptb,xk.mx_rgbtohsv,xk.mx_rotate2d,xk.mx_rotate3d,xk.mx_safepower,xk.mx_separate,xk.mx_splitlr,xk.mx_splittb,xk.mx_srgb_texture_to_lin_rec709,xk.mx_subtract,xk.mx_timer,xk.mx_transform_uv,xk.mx_unifiednoise2d,xk.mx_unifiednoise3d,xk.mx_worley_noise_float,xk.mx_worley_noise_vec2,xk.mx_worley_noise_vec3;const Yj=xk.negate;xk.neutralToneMapping,xk.nodeArray,xk.nodeImmutable,xk.nodeObject,xk.nodeObjectIntent,xk.nodeObjects,xk.nodeProxy,xk.nodeProxyIntent,xk.normalFlat,xk.normalGeometry,xk.normalLocal,xk.normalMap,xk.normalView,xk.normalViewGeometry,xk.normalWorld,xk.normalWorldGeometry,xk.normalize,xk.not,xk.notEqual,xk.numWorkgroups,xk.objectDirection,xk.objectGroup,xk.objectPosition,xk.objectRadius,xk.objectScale,xk.objectViewPosition,xk.objectWorldMatrix,xk.OnBeforeObjectUpdate,xk.OnBeforeMaterialUpdate,xk.OnObjectUpdate,xk.OnMaterialUpdate,xk.oneMinus,xk.or,xk.orthographicDepthToViewZ,xk.oscSawtooth,xk.oscSine,xk.oscSquare,xk.oscTriangle,xk.output,xk.outputStruct,xk.overlay,xk.overloadingFn,xk.parabola,xk.parallaxDirection,xk.parallaxUV,xk.parameter,xk.pass,xk.passTexture,xk.pcurve,xk.perspectiveDepthToViewZ,xk.pmremTexture,xk.pointShadow,xk.pointUV,xk.pointWidth,xk.positionGeometry,xk.positionLocal,xk.positionPrevious,xk.positionView,xk.positionViewDirection,xk.positionWorld,xk.positionWorldDirection,xk.posterize,xk.pow,xk.pow2,xk.pow3,xk.pow4,xk.premultiplyAlpha,xk.property,xk.radians,xk.rand,xk.range,xk.rangeFog,xk.rangeFogFactor,xk.reciprocal,xk.reference,xk.referenceBuffer,xk.reflect,xk.reflectVector,xk.reflectView,xk.reflector,xk.refract,xk.refractVector,xk.refractView,xk.reinhardToneMapping,xk.remap,xk.remapClamp,xk.renderGroup,xk.renderOutput,xk.rendererReference,xk.rotate,xk.rotateUV,xk.roughness,xk.round,xk.rtt,xk.sRGBTransferEOTF,xk.sRGBTransferOETF,xk.sample,xk.sampler,xk.samplerComparison,xk.saturate,xk.saturation,xk.screen,xk.screenCoordinate,xk.screenDPR,xk.screenSize,xk.screenUV,xk.scriptable,xk.scriptableValue,xk.select,xk.setCurrentStack,xk.setName,xk.shaderStages,xk.shadow,xk.shadowPositionWorld,xk.shapeCircle,xk.sharedUniformGroup,xk.sheen,xk.sheenRoughness,xk.shiftLeft,xk.shiftRight,xk.shininess,xk.sign;const Kj=xk.sin;xk.sinc,xk.skinning,xk.smoothstep,xk.smoothstepElement,xk.specularColor,xk.specularF90,xk.spherizeUV,xk.split,xk.spritesheetUV;const Zj=xk.sqrt;xk.stack,xk.step,xk.stepElement;const Jj=xk.storage;xk.storageBarrier,xk.storageObject,xk.storageTexture,xk.string,xk.struct,xk.sub,xk.subgroupAdd,xk.subgroupAll,xk.subgroupAnd,xk.subgroupAny,xk.subgroupBallot,xk.subgroupBroadcast,xk.subgroupBroadcastFirst,xk.subBuild,xk.subgroupElect,xk.subgroupExclusiveAdd,xk.subgroupExclusiveMul,xk.subgroupInclusiveAdd,xk.subgroupInclusiveMul,xk.subgroupIndex,xk.subgroupMax,xk.subgroupMin,xk.subgroupMul,xk.subgroupOr,xk.subgroupShuffle,xk.subgroupShuffleDown,xk.subgroupShuffleUp,xk.subgroupShuffleXor,xk.subgroupSize,xk.subgroupXor,xk.tan,xk.tangentGeometry,xk.tangentLocal,xk.tangentView,xk.tangentWorld,xk.texture,xk.texture3D,xk.textureBarrier,xk.textureBicubic,xk.textureBicubicLevel,xk.textureCubeUV,xk.textureLoad,xk.textureSize,xk.textureLevel,xk.textureStore,xk.thickness,xk.time,xk.toneMapping,xk.toneMappingExposure,xk.toonOutlinePass,xk.transformDirection,xk.transformNormal,xk.transformNormalToView,xk.transformedClearcoatNormalView,xk.transformedNormalView,xk.transformedNormalWorld,xk.transmission,xk.transpose,xk.triNoise3D,xk.triplanarTexture,xk.triplanarTextures,xk.trunc,xk.uint,xk.uintBitsToFloat;const eW=xk.uniform;xk.uniformArray,xk.uniformCubeTexture,xk.uniformGroup,xk.uniformFlow,xk.uniformTexture,xk.unpremultiplyAlpha,xk.userData,xk.uv,xk.uvec2,xk.uvec3,xk.uvec4,xk.varying,xk.varyingProperty,xk.vec2,xk.vec3,xk.vec4,xk.vectorComponents,xk.velocity,xk.vertexColor,xk.vertexIndex,xk.vertexStage,xk.vibrance,xk.viewZToLogarithmicDepth,xk.viewZToOrthographicDepth,xk.viewZToPerspectiveDepth,xk.viewport,xk.viewportCoordinate,xk.viewportDepthTexture,xk.viewportLinearDepth,xk.viewportMipTexture,xk.viewportResolution,xk.viewportSafeUV,xk.viewportSharedTexture,xk.viewportSize,xk.viewportTexture,xk.viewportUV,xk.wgsl,xk.wgslFn,xk.workgroupArray,xk.workgroupBarrier,xk.workgroupId,xk.workingToColorSpace,xk.xor;const tW=new gn,nW=new Wt;class rW extends po{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new Zr([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new Zr([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new go(t,6,1);return this.setAttribute("instanceStart",new Vi(n,3,0)),this.setAttribute("instanceEnd",new Vi(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new go(t,6,1);return this.setAttribute("instanceColorStart",new Vi(n,3,0)),this.setAttribute("instanceColorEnd",new Vi(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Ea(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new gn);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),tW.setFromBufferAttribute(t),this.boundingBox.union(tW))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Un),null===this.boundingBox&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let i=0,s=e.count;i\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tfloat alpha = opacity;\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"};class iW extends wi{constructor(e){super({type:"LineMaterial",uniforms:Si.clone(Bo.line.uniforms),vertexShader:Bo.line.vertexShader,fragmentShader:Bo.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const sW=new An,aW=new Wt,oW=new Wt,lW=new An,uW=new An,cW=new An,hW=new Wt,AW=new Hn,dW=new class{constructor(e=new Wt,t=new Wt){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){To.subVectors(e,this.start),So.subVectors(this.end,this.start);const n=So.dot(So);let r=So.dot(To)/n;return t&&(r=Ft(r,0,1)),r}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Co,n=Ro){const r=1e-8*1e-8;let i,s;const a=this.start,o=e.start,l=this.end,u=e.end;wo.subVectors(l,a),Mo.subVectors(u,o),Eo.subVectors(a,o);const c=wo.dot(wo),h=Mo.dot(Mo),A=Mo.dot(Eo);if(c<=r&&h<=r)return t.copy(a),n.copy(o),t.sub(n),t.dot(t);if(c<=r)i=0,s=A/h,s=Ft(s,0,1);else{const e=wo.dot(Eo);if(h<=r)s=0,i=Ft(-e/c,0,1);else{const t=wo.dot(Mo),n=c*h-t*t;i=0!==n?Ft((t*A-e*h)/n,0,1):0,s=(t*i+A)/h,s<0?(s=0,i=Ft(-e/c,0,1)):s>1&&(s=1,i=Ft((t-e)/c,0,1))}}return t.copy(a).add(wo.multiplyScalar(i)),n.copy(o).add(Mo.multiplyScalar(s)),t.sub(n),t.dot(t)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}},pW=new Wt,fW=new gn,mW=new Un,gW=new An;let _W,vW;function yW(e,t,n){return gW.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),gW.multiplyScalar(1/gW.w),gW.x=vW/n.width,gW.y=vW/n.height,gW.applyMatrix4(e.projectionMatrixInverse),gW.multiplyScalar(1/gW.w),Math.abs(Math.max(gW.x,gW.y))}class bW extends _i{constructor(e=new rW,t=new iW({color:16777215*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let e=0,i=0,s=t.count;ec&&uW.z>c)continue;if(lW.z>c){const e=lW.z-uW.z,t=(lW.z-c)/e;lW.lerp(uW,t)}else if(uW.z>c){const e=uW.z-lW.z,t=(uW.z-c)/e;uW.lerp(lW,t)}lW.applyMatrix4(r),uW.applyMatrix4(r),lW.multiplyScalar(1/lW.w),uW.multiplyScalar(1/uW.w),lW.x*=i.x/2,lW.y*=i.y/2,uW.x*=i.x/2,uW.y*=i.y/2,dW.start.copy(lW),dW.start.z=0,dW.end.copy(uW),dW.end.z=0;const a=dW.closestPointToPointParameter(hW,!0);dW.at(a,pW);const u=Gt.lerp(lW.z,uW.z,a),h=u>=-1&&u<=1,A=hW.distanceTo(pW)<.5*vW;if(h&&A){dW.start.fromBufferAttribute(o,t),dW.end.fromBufferAttribute(l,t),dW.start.applyMatrix4(s),dW.end.applyMatrix4(s);const r=new Wt,i=new Wt;_W.distanceSqToSegment(dW.start,dW.end,i,r),n.push({point:i,pointOnLine:r,distance:_W.origin.distanceTo(i),object:e,face:null,faceIndex:t,uv:null,uv1:null})}}}(this,r,t))}}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(sW),this.material.uniforms.resolution.value.set(sW.z,sW.w))}}class xW extends rW{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n3?(i=p===r)&&(l=s[(o=s[4])?5:(o=3,3)],s[4]=s[5]=e):s[0]<=d&&((i=n<2&&dr||r>p)&&(s[4]=n,s[5]=r,A.n=p,o=0))}if(i||n>1)return a;throw h=!0,r}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,p),o=c,l=p;(t=o<2?e:l)||!h;){s||(o?o<3?(o>1&&(A.n=-1),d(o,l)):A.n=l:A.v=l);try{if(u=2,s){if(o||(i="next"),t=s[i]){if(!(t=t.call(s,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=s.return)&&t.call(s),o<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),o=1);s=e}else if((t=(h=A.n<0)?l:n.call(r,A))!==a)break}catch(t){s=e,o=1,l=t}finally{u=1}}return{value:t,done:h}}}(n,i,s),!0),u}var a={};function o(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(HW(t={},r,function(){return this}),t),h=u.prototype=o.prototype=Object.create(c);function A(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,HW(e,i,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,HW(h,"constructor",u),HW(u,"constructor",l),l.displayName="GeneratorFunction",HW(u,i,"GeneratorFunction"),HW(h),HW(h,i,"Generator"),HW(h,r,function(){return this}),HW(h,"toString",function(){return"[object Generator]"}),(GW=function(){return{w:s,m:A}})()}function HW(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}HW=function(e,t,n,r){function s(t,n){HW(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(s("next",0),s("throw",1),s("return",2))},HW(e,t,n,r)}function jW(e,t){return jW=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},jW(e,t)}function WW(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s,a,o=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=s.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(e,t)||YW(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function XW(e,t,n,r){var i=BW(FW(e.prototype),t,n);return"function"==typeof i?function(e){return i.apply(n,e)}:i}function QW(e){return function(e){if(Array.isArray(e))return MW(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||YW(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $W(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function YW(e,t){if(e){if("string"==typeof e)return MW(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?MW(e,t):void 0}}var KW=function(e){e instanceof Array?e.forEach(KW):(e.map&&e.map.dispose(),e.dispose())},ZW=function(e){e.geometry&&e.geometry.dispose(),e.material&&KW(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(ZW)},JW=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),ZW(t)}};function eX(e,t){var n=new t;return{linkProp:function(t){return{default:n[t](),onChange:function(n,r){r[e][t](n)},triggerUpdate:!1}},linkMethod:function(t){return function(n){for(var r=n[e],i=arguments.length,s=new Array(i>1?i-1:0),a=1;a2&&void 0!==arguments[2]?arguments[2]:0,r=(90-e)*Math.PI/180,i=(90-t)*Math.PI/180,s=tX*(1+n),a=Math.sin(r);return{x:s*a*Math.cos(i),y:s*Math.cos(r),z:s*a*Math.sin(i)}}function iX(e){var t=e.x,n=e.y,r=e.z,i=Math.sqrt(t*t+n*n+r*r),s=Math.acos(n/i),a=Math.atan2(r,t);return{lat:90-180*s/Math.PI,lng:90-180*a/Math.PI-(a<-Math.PI/2?360:0),altitude:i/tX-1}}function sX(e){return e*Math.PI/180}var aX=window.THREE?window.THREE:{BackSide:1,BufferAttribute:Qr,Color:Or,Mesh:_i,ShaderMaterial:wi};var oX=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.color,s=void 0===i?"gold":i,a=r.size,o=void 0===a?2:a,l=r.coefficient,u=void 0===l?.5:l,c=r.power,h=void 0===c?1:c,A=r.hollowRadius,d=void 0===A?0:A,p=r.backside,f=void 0===p||p;NW(this,t),n=RW(this,t);var m=function(e,t){for(var n=e.clone(),r=new Float32Array(3*e.attributes.position.count),i=0,s=r.length;i1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=1,s=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(s){var a=WW(s.slice(1),4),o=a[0],l=a[1],u=a[2],c=a[3];t=new Or("rgb(".concat(+o,",").concat(+l,",").concat(+u,")")),i=Math.min(+c,1)}else t=new Or(e);r&&t.convertLinearToSRGB();var h=t.toArray();return n?[].concat(QW(h),[i]):h};var dX=window.THREE?window.THREE:{BufferAttribute:Qr};function pX(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float32Array;if(1===t)return new dX.BufferAttribute(new n(e),t);for(var r=new dX.BufferAttribute(new n(e.length*t),t),i=0,s=e.length;i1&&void 0!==arguments[1]?arguments[1]:{},i=r.dataBindAttr,s=void 0===i?"__data":i,a=r.objBindAttr,o=void 0===a?"__threeObj":a,l=r.removeDelay,u=void 0===l?0:l;return NW(this,t),OW(n=RW(this,t),"scene",void 0),DW(n,fX,void 0),DW(n,mX,void 0),DW(n,gX,void 0),n.scene=e,LW(fX,n,s),LW(mX,n,o),LW(gX,n,u),n.onRemoveObj(function(){}),n}return kW(t,e),UW(t,[{key:"onCreateObj",value:function(e){var n=this;return XW(t,"onCreateObj",this)([function(t){var r=e(t);return t[PW(mX,n)]=r,r[PW(fX,n)]=t,n.scene.add(r),r}]),this}},{key:"onRemoveObj",value:function(e){var n=this;return XW(t,"onRemoveObj",this)([function(r,i){var s=XW(t,"getData",n)([r]);e(r,i);var a=function(){n.scene.remove(r),JW(r),delete s[PW(mX,n)]};PW(gX,n)?setTimeout(a,PW(gX,n)):a()}]),this}}])}(T_),vX=window.THREE?window.THREE:{BufferGeometry:ai,CylinderGeometry:ws,Matrix4:Hn,Mesh:_i,MeshLambertMaterial:Ua,Object3D:gr,Vector3:Wt},yX=Object.assign({},Sg),bX=yX.BufferGeometryUtils||yX,xX=Xc({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;JW(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new _X(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=wg(e.pointLat),r=wg(e.pointLng),i=wg(e.pointAltitude),s=wg(e.pointRadius),a=wg(e.pointColor),o=new vX.CylinderGeometry(1,1,1,e.pointResolution);o.applyMatrix4((new vX.Matrix4).makeRotationX(Math.PI/2)),o.applyMatrix4((new vX.Matrix4).makeTranslation(0,0,-.5));var l=2*Math.PI*tX/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&JW(e.scene),e.dataMapper.scene=e.pointsMerge?new vX.Object3D:e.scene,e.dataMapper.onCreateObj(function(){var e=new vX.Mesh(o);return e.__globeObjType="point",e}).onUpdateObj(function(t,o){var c=function(n){var r=t.__currentTargetD=n,i=r.r,s=r.alt,a=r.lat,o=r.lng;Object.assign(t.position,rX(a,o));var u=e.pointsMerge?new vX.Vector3(0,0,0):e.scene.localToWorld(new vX.Vector3(0,0,0));t.lookAt(u),t.scale.x=t.scale.y=Math.min(30,i)*l,t.scale.z=Math.max(s*tX,.1)},h={alt:+i(o),r:+s(o),lat:+n(o),lng:+r(o)},A=t.__currentTargetD||Object.assign({},h,{alt:-.001});Object.keys(h).some(function(e){return A[e]!==h[e]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?c(h):e.tweenGroup.add(new eh(A).to(h,e.pointsTransitionDuration).easing(Qc.Quadratic.InOut).onUpdate(c).start()));if(!e.pointsMerge){var d=a(o),p=d?hX(d):0,f=!!p;t.visible=f,f&&(u.hasOwnProperty(d)||(u[d]=new vX.MeshLambertMaterial({color:cX(d),transparent:p<1,opacity:p})),t.material=u[d])}}).digest(e.pointsData),e.pointsMerge){var c=e.pointsData.length?(bX.mergeGeometries||bX.mergeBufferGeometries)(e.pointsData.map(function(t){var n=e.dataMapper.getObj(t),r=n.geometry.clone();n.updateMatrix(),r.applyMatrix4(n.matrix);var i=AX(a(t));return r.setAttribute("color",pX(Array(r.getAttribute("position").count).fill(i),4)),r})):new vX.BufferGeometry,h=new vX.Mesh(c,new vX.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));h.__globeObjType="points",h.__data=e.pointsData,e.dataMapper.clear(),JW(e.scene),e.scene.add(h)}}}),TX=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:"\n ".concat(Uo.common,"\n ").concat(Uo.logdepthbuf_pars_vertex,"\n \n uniform float dashTranslate; \n\n attribute vec4 color;\n varying vec4 vColor;\n \n attribute float relDistance;\n varying float vRelDistance;\n\n void main() {\n // pass through colors and distances\n vColor = color;\n vRelDistance = relDistance + dashTranslate;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n \n ").concat(Uo.logdepthbuf_vertex,"\n }\n "),fragmentShader:"\n ".concat(Uo.logdepthbuf_pars_fragment,"\n\n uniform float dashOffset; \n uniform float dashSize;\n uniform float gapSize; \n \n varying vec4 vColor;\n varying float vRelDistance;\n \n void main() {\n // ignore pixels in the gap\n if (vRelDistance < dashOffset) discard;\n if (mod(vRelDistance - dashOffset, dashSize + gapSize) > dashSize) discard;\n \n // set px color: [r, g, b, a], interpolated between vertices \n gl_FragColor = vColor; \n \n ").concat(Uo.logdepthbuf_fragment,"\n }\n ")}},SX=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=("attribute float surfaceRadius;\nvarying float vSurfaceRadius;\nvarying vec3 vPos;\n"+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join("\n")),e.fragmentShader=("uniform float uSurfaceRadius;\nvarying float vSurfaceRadius;\nvarying vec3 vPos;\n"+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join("\n")),e},wX=function(e){return e.vertexShader="\n attribute float r;\n \n const float PI = 3.1415926535897932384626433832795;\n float toRad(in float a) {\n return a * PI / 180.0;\n }\n \n vec3 Polar2Cartesian(in vec3 c) { // [lat, lng, r]\n float phi = toRad(90.0 - c.x);\n float theta = toRad(90.0 - c.y);\n float r = c.z;\n return vec3( // x,y,z\n r * sin(phi) * cos(theta),\n r * cos(phi),\n r * sin(phi) * sin(theta)\n );\n }\n \n vec2 Cartesian2Polar(in vec3 p) {\n float r = sqrt(p.x * p.x + p.y * p.y + p.z * p.z);\n float phi = acos(p.y / r);\n float theta = atan(p.z, p.x);\n return vec2( // lat,lng\n 90.0 - phi * 180.0 / PI,\n 90.0 - theta * 180.0 / PI - (theta < -PI / 2.0 ? 360.0 : 0.0)\n );\n }\n ".concat(e.vertexShader.replace("}"," \n vec3 pos = Polar2Cartesian(vec3(Cartesian2Polar(position), r));\n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n }\n "),"\n "),e},MX=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},EX=["stroke"],CX=window.THREE?window.THREE:{BufferGeometry:ai,CubicBezierCurve3:Bs,Curve:Ms,Group:Ui,Line:cs,Mesh:_i,NormalBlending:1,ShaderMaterial:wi,TubeGeometry:Ma,Vector3:Wt},RX=C_.default||C_,NX=Xc({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.pause()},resumeAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),null===(t=e.ticker)||void 0===t||t.dispose()}},stateInit:function(e){return{tweenGroup:e.tweenGroup,ticker:new RX,sharedMaterial:new CX.ShaderMaterial(zW(zW({},TX()),{},{transparent:!0,blending:CX.NormalBlending}))}},init:function(e,t){JW(e),t.scene=e,t.dataMapper=new _X(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var e=new CX.Group;return e.__globeObjType="arc",e}),t.ticker.onTick.add(function(e,n){t.dataMapper.entries().map(function(e){return WW(e,2)[1]}).filter(function(e){return e.children.length&&e.children[0].material&&e.children[0].__dashAnimateStep}).forEach(function(e){var t=e.children[0],r=t.__dashAnimateStep*n,i=t.material.uniforms.dashTranslate.value%1e9;t.material.uniforms.dashTranslate.value=i+r})})},update:function(e){var t=wg(e.arcStartLat),n=wg(e.arcStartLng),r=wg(e.arcStartAltitude),i=wg(e.arcEndLat),s=wg(e.arcEndLng),a=wg(e.arcEndAltitude),o=wg(e.arcAltitude),l=wg(e.arcAltitudeAutoScale),u=wg(e.arcStroke),c=wg(e.arcColor),h=wg(e.arcDashLength),A=wg(e.arcDashGap),d=wg(e.arcDashInitialGap),p=wg(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(f,m){var g=u(m),_=null!=g;if(!f.children.length||_!==("Mesh"===f.children[0].type)){JW(f);var v=_?new CX.Mesh:new CX.Line(new CX.BufferGeometry);v.material=e.sharedMaterial.clone(),f.add(v)}var y=f.children[0];Object.assign(y.material.uniforms,{dashSize:{value:h(m)},gapSize:{value:A(m)},dashOffset:{value:d(m)}});var b=p(m);y.__dashAnimateStep=b>0?1e3/b:0;var x=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=t+1;if(e instanceof Array||e instanceof Function){var s=e instanceof Array?XA().domain(e.map(function(t,n){return n/(e.length-1)})).range(e):e;n=function(e){return AX(s(e),!0,!0)}}else{var a=AX(e,!0,!0);n=function(){return a}}for(var o=[],l=0,u=i;l1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[],i=0,s=e+1;i170&&(e[0]+=n>t?360:-360)}),t.__globeObjType="hexbin",t}).onUpdateObj(function(t,n){var r=Math.max(0,Math.min(1,+l(n))),i=WW(t.__hexCenter,2),u=i[0],c=i[1],A=0===r?t.__hexGeoJson:t.__hexGeoJson.map(function(e){var t=WW(e,2),n=t[0],i=t[1];return[[n,c],[i,u]].map(function(e){var t=WW(e,2);return function(e,t,n){return e-(e-t)*n}(t[0],t[1],r)})}),d=e.hexTopCurvatureResolution;t.geometry&&t.geometry.dispose(),t.geometry=new kv([A],0,tX,!1,!0,!0,d);var p={alt:+s(n)},f=function(e){var n=(t.__currentTargetD=e).alt;t.scale.x=t.scale.y=t.scale.z=1+n;var r=tX/(n+1);t.geometry.setAttribute("surfaceRadius",pX(Array(t.geometry.getAttribute("position").count).fill(r),1))},m=t.__currentTargetD||Object.assign({},p,{alt:-.001});Object.keys(p).some(function(e){return m[e]!==p[e]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?f(p):e.tweenGroup.add(new eh(m).to(p,e.hexTransitionDuration).easing(Qc.Quadratic.InOut).onUpdate(f).start()));if(!e.hexBinMerge){var g=o(n),_=a(n);[g,_].forEach(function(e){if(!h.hasOwnProperty(e)){var t=hX(e);h[e]=MX(new PX.MeshLambertMaterial({color:cX(e),transparent:t<1,opacity:t,side:PX.DoubleSide}),SX)}}),t.material=[g,_].map(function(e){return h[e]})}}).digest(c),e.hexBinMerge){var A=c.length?(LX.mergeGeometries||LX.mergeBufferGeometries)(c.map(function(t){var n=e.dataMapper.getObj(t),r=n.geometry.toNonIndexed();n.updateMatrix(),r.applyMatrix4(n.matrix);var i=AX(a(t)),s=AX(o(t)),l=r.getAttribute("position").count,u=r.groups[0].count;return r.setAttribute("color",pX(QW(new Array(l)).map(function(e,t){return t>=u?i:s}),4)),r})):new PX.BufferGeometry,d=new PX.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:PX.DoubleSide});d.onBeforeCompile=function(e){d.userData.shader=SX(e)};var p=new PX.Mesh(A,d);p.__globeObjType="hexBinPoints",p.__data=c,e.dataMapper.clear(),JW(e.scene),e.scene.add(p)}}}),UX=function(e){return e*e},OX=function(e){return e*Math.PI/180};var BX=Math.sqrt(2*Math.PI);var FX=function(e){var t=WW(e,2),n=t[0],r=t[1],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=s.lngAccessor,o=void 0===a?function(e){return e[0]}:a,l=s.latAccessor,u=void 0===l?function(e){return e[1]}:l,c=s.weightAccessor,h=void 0===c?function(){return 1}:c,A=s.bandwidth,d=[n,r],p=A*Math.PI/180;return function(e){let t=0;for(let n of e)(n=+n)&&(t+=n);return t}(i.map(function(e){var t=h(e);if(!t)return 0;var n=function(e,t){var n=Math.sqrt,r=Math.cos,i=function(e){return UX(Math.sin(e/2))},s=OX(e[1]),a=OX(t[1]),o=OX(e[0]),l=OX(t[0]);return 2*Math.asin(n(i(a-s)+r(s)*r(a)*i(l-o)))}(d,[o(e),u(e)]);return function(e,t){return Math.exp(-UX(e/t)/2)/(t*BX)}(n,p)*t}))},kX=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function a(e){CW(s,r,i,a,o,"next",e)}function o(e){CW(s,r,i,a,o,"throw",e)}a(void 0)})}}(GW().m(function e(t){var n,r,i,s,a,o,l,u,c,h,A,d,p,f,m,g,_,v,y,b,x,T,S,w,M,E,C,R,N,P,D,L,I,U,O,B,F,k,q,V,z,G,H=arguments;return GW().w(function(e){for(;;)switch(e.n){case 0:if(r=H.length>1&&void 0!==H[1]?H[1]:[],s=(i=H.length>2&&void 0!==H[2]?H[2]:{}).lngAccessor,a=void 0===s?function(e){return e[0]}:s,o=i.latAccessor,l=void 0===o?function(e){return e[1]}:o,u=i.weightAccessor,c=void 0===u?function(){return 1}:u,h=i.bandwidth,null!==(n=navigator)&&void 0!==n&&n.gpu){e.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),e.a(2,t.map(function(e){return FX(e,r,{lngAccessor:a,latAccessor:l,weightAccessor:c,bandwidth:h})}));case 1:return A=zj,d=Gj,p=eW,m=Qj,g=$j,_=Hj,v=Zj,y=Kj,b=Wj,x=jj,T=Xj,S=Yj,w=(f=Jj)(new cU(new Float32Array(t.flat().map(OX)),2),"vec2",t.length),M=f(new cU(new Float32Array(r.map(function(e){return[OX(a(e)),OX(l(e)),c(e)]}).flat()),3),"vec3",r.length),E=new cU(t.length,1),C=f(E,"float",t.length),R=m(Math.PI),N=v(R.mul(2)),P=function(e){return e.mul(e)},D=function(e){return P(y(e.div(2)))},L=function(e,t){var n=m(e[1]),r=m(t[1]),i=m(e[0]),s=m(t[0]);return m(2).mul(x(v(D(r.sub(n)).add(b(n).mul(b(r)).mul(D(s.sub(i)))))))},I=function(e,t){return T(S(P(e.div(t)).div(2))).div(t.mul(N))},U=p(OX(h)),O=p(OX(4*h)),B=p(r.length),F=A(function(){var e=w.element(g),t=C.element(g);t.assign(0),_(B,function(n){var r=n.i,i=M.element(r),s=i.z;d(s,function(){var n=L(i.xy,e.xy);d(n&&n.lessThan(O),function(){t.addAssign(I(n,U).mul(s))})})})}),k=F().compute(t.length),q=new Vj,e.n=2,q.computeAsync(k);case 2:return V=Array,z=Float32Array,e.n=3,q.getArrayBufferAsync(E);case 3:return G=e.v,e.a(2,V.from.call(V,new z(G)))}},e)}));return function(t){return e.apply(this,arguments)}}(),qX=window.THREE?window.THREE:{Mesh:_i,MeshLambertMaterial:Ua,SphereGeometry:wa},VX=function(e){var t=jh(function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"}(e));return t.opacity=Math.cbrt(e),t.formatRgb()},zX=Xc({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return VX}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;JW(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new _X(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var e=new qX.Mesh(new qX.SphereGeometry(tX),MX(new qX.MeshLambertMaterial({vertexColors:!0,transparent:!0}),wX));return e.__globeObjType="heatmap",e})},update:function(e){var t=wg(e.heatmapPoints),n=wg(e.heatmapPointLat),r=wg(e.heatmapPointLng),i=wg(e.heatmapPointWeight),s=wg(e.heatmapBandwidth),a=wg(e.heatmapColorFn),o=wg(e.heatmapColorSaturation),l=wg(e.heatmapBaseAltitude),u=wg(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(c,h){var A=s(h),d=a(h),p=o(h),f=l(h),m=u(h),g=t(h).map(function(e){var t=n(e),s=r(e),a=rX(t,s);return{x:a.x,y:a.y,z:a.z,lat:t,lng:s,weight:i(e)}}),_=Math.max(.1,A/3.5),v=Math.ceil(360/(_||-1));c.geometry.parameters.widthSegments!==v&&(c.geometry.dispose(),c.geometry=new qX.SphereGeometry(tX,v,v/2));var y=function(e){for(var t=e.itemSize,n=[],r=0;r=n)&&(t=n);return t}(r.map(Math.abs))||1e-15,o=QA([0,a/s],n);c.geometry.setAttribute("color",pX(r.map(function(e){return o(Math.abs(e))}),4));var l=XA([0,a],[tX*(1+f),tX*(1+(i||f))]);c.geometry.setAttribute("r",pX(r.map(l)))},i={kdeVals:t,topAlt:m,saturation:p},s=c.__currentTargetD||Object.assign({},i,{kdeVals:t.map(function(){return 0}),topAlt:m?f:m,saturation:.5});s.kdeVals.length!==t.length&&(s.kdeVals=t.slice()),Object.keys(i).some(function(e){return s[e]!==i[e]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?r(i):e.tweenGroup.add(new eh(s).to(i,e.heatmapsTransitionDuration).easing(Qc.Quadratic.InOut).onUpdate(r).start()))})}).digest(e.heatmapsData)}}),GX=window.THREE?window.THREE:{DoubleSide:2,Group:Ui,LineBasicMaterial:ns,LineSegments:ps,Mesh:_i,MeshBasicMaterial:qr},HX=Xc({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;JW(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new _X(e,{objBindAttr:"__threeObjPolygon"}).id(function(e){return e.id}).onCreateObj(function(){var e=new GX.Group;return e.__defaultSideMaterial=MX(new GX.MeshBasicMaterial({side:GX.DoubleSide,depthWrite:!0}),SX),e.__defaultCapMaterial=new GX.MeshBasicMaterial({side:GX.DoubleSide,depthWrite:!0}),e.add(new GX.Mesh(void 0,[e.__defaultSideMaterial,e.__defaultCapMaterial])),e.add(new GX.LineSegments(void 0,new GX.LineBasicMaterial)),e.__globeObjType="polygon",e})},update:function(e){var t=wg(e.polygonGeoJsonGeometry),n=wg(e.polygonAltitude),r=wg(e.polygonCapCurvatureResolution),i=wg(e.polygonCapColor),s=wg(e.polygonCapMaterial),a=wg(e.polygonSideColor),o=wg(e.polygonSideMaterial),l=wg(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(e){var c={data:e,capColor:i(e),capMaterial:s(e),sideColor:a(e),sideMaterial:o(e),strokeColor:l(e),altitude:+n(e),capCurvatureResolution:+r(e)},h=t(e),A=e.__id||"".concat(Math.round(1e9*Math.random()));e.__id=A,"Polygon"===h.type?u.push(zW({id:"".concat(A,"_0"),coords:h.coordinates},c)):"MultiPolygon"===h.type?u.push.apply(u,QW(h.coordinates.map(function(e,t){return zW({id:"".concat(A,"_").concat(t),coords:e},c)}))):console.warn("Unsupported GeoJson geometry type: ".concat(h.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(t,n){var r=n.coords,i=n.capColor,s=n.capMaterial,a=n.sideColor,o=n.sideMaterial,l=n.strokeColor,u=n.altitude,c=n.capCurvatureResolution,h=WW(t.children,2),A=h[0],d=h[1],p=!!l;d.visible=p;var f=!(!i&&!s),m=!(!a&&!o);(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return function(e,t){return e===t}};return Object.entries(t).every(function(t){var r=WW(t,2),i=r[0],s=r[1];return e.hasOwnProperty(i)&&n(i)(e[i],s)})})(A.geometry.parameters||{},{polygonGeoJson:r,curvatureResolution:c,closedTop:f,includeSides:m})||(A.geometry&&A.geometry.dispose(),A.geometry=new kv(r,0,tX,!1,f,m,c)),!p||d.geometry.parameters&&d.geometry.parameters.geoJson.coordinates===r&&d.geometry.parameters.resolution===c||(d.geometry&&d.geometry.dispose(),d.geometry=new _g({type:"Polygon",coordinates:r},tX,c));var g=m?0:-1,_=f?m?1:0:-1;if(g>=0&&(A.material[g]=o||t.__defaultSideMaterial),_>=0&&(A.material[_]=s||t.__defaultCapMaterial),[[!o&&a,g],[!s&&i,_]].forEach(function(e){var t=WW(e,2),n=t[0],r=t[1];if(n&&!(r<0)){var i=A.material[r],s=hX(n);i.color.set(cX(n)),i.transparent=s<1,i.opacity=s}}),p){var v=d.material,y=hX(l);v.color.set(cX(l)),v.transparent=y<1,v.opacity=y}var b={alt:u},x=function(e){var n=(t.__currentTargetD=e).alt;A.scale.x=A.scale.y=A.scale.z=1+n,p&&(d.scale.x=d.scale.y=d.scale.z=1+n+1e-4),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(e){n(e),t(e.uniforms)}}}(t.__defaultSideMaterial,function(e){return e.uSurfaceRadius.value=tX/(n+1)})},T=t.__currentTargetD||Object.assign({},b,{alt:-.001});Object.keys(b).some(function(e){return T[e]!==b[e]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||T.alt===b.alt?x(b):e.tweenGroup.add(new eh(T).to(b,e.polygonsTransitionDuration).easing(Qc.Quadratic.InOut).onUpdate(x).start()))}).digest(u)}});var jX=window.THREE?window.THREE:{BufferGeometry:ai,DoubleSide:2,Mesh:_i,MeshLambertMaterial:Ua,Vector3:Wt},WX=Object.assign({},Sg),XX=WX.BufferGeometryUtils||WX,QX=Xc({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;JW(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new _X(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var e=new jX.Mesh(void 0,new jX.MeshLambertMaterial({side:jX.DoubleSide}));return e.__globeObjType="hexPolygon",e})},update:function(e){var t=wg(e.hexPolygonGeoJsonGeometry),n=wg(e.hexPolygonColor),r=wg(e.hexPolygonAltitude),i=wg(e.hexPolygonResolution),s=wg(e.hexPolygonMargin),a=wg(e.hexPolygonUseDots),o=wg(e.hexPolygonCurvatureResolution),l=wg(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,c){var h=t(c),A=i(c),d=r(c),p=Math.max(0,Math.min(1,+s(c))),f=a(c),m=o(c),g=l(c),_=n(c),v=hX(_);u.material.color.set(cX(_)),u.material.transparent=v<1,u.material.opacity=v;var y={alt:d,margin:p,curvatureResolution:m},b={geoJson:h,h3Res:A},x=u.__currentTargetD||Object.assign({},y,{alt:-.001}),T=u.__currentMemD||b;if(Object.keys(y).some(function(e){return x[e]!==y[e]})||Object.keys(b).some(function(e){return T[e]!==b[e]})){u.__currentMemD=b;var S=[];"Polygon"===h.type?vy(h.coordinates,A,!0).forEach(function(e){return S.push(e)}):"MultiPolygon"===h.type?h.coordinates.forEach(function(e){return vy(e,A,!0).forEach(function(e){return S.push(e)})}):console.warn("Unsupported GeoJson geometry type: ".concat(h.type,". Skipping geometry..."));var w=S.map(function(e){var t=gy(e),n=_y(e).reverse(),r=t[1];return n.forEach(function(e){var t=e[0];Math.abs(r-t)>170&&(e[0]+=r>t?360:-360)}),{h3Idx:e,hexCenter:t,hexGeoJson:n}}),M=function(e){var t=u.__currentTargetD=e,n=t.alt,r=t.margin,i=t.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=w.length?(XX.mergeGeometries||XX.mergeBufferGeometries)(w.map(function(e){var t=WW(e.hexCenter,2),s=t[0],a=t[1];if(f){var o=rX(s,a,n),l=rX(e.hexGeoJson[0][1],e.hexGeoJson[0][0],n),u=.85*(1-r)*new jX.Vector3(o.x,o.y,o.z).distanceTo(new jX.Vector3(l.x,l.y,l.z)),c=new Ss(u,g);return c.rotateX(sX(-s)),c.rotateY(sX(a)),c.translate(o.x,o.y,o.z),c}var h=0===r?e.hexGeoJson:e.hexGeoJson.map(function(e){var t=WW(e,2),n=t[0],i=t[1];return[[n,a],[i,s]].map(function(e){var t=WW(e,2);return function(e,t,n){return e-(e-t)*n}(t[0],t[1],r)})});return new kv([h],tX,tX*(1+n),!1,!0,!1,i)})):new jX.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?M(y):e.tweenGroup.add(new eh(x).to(y,e.hexPolygonsTransitionDuration).easing(Qc.Quadratic.InOut).onUpdate(M).start())}}).digest(e.hexPolygonsData)}}),$X=window.THREE?window.THREE:{Vector3:Wt};function YX(e,t){var n=Math.max(e.length,t.length),r=dA.apply(void 0,QW([e,t].map(function(e){return e.map(function(e){return[e.x,e.y,e.z]})}).map(function(e){return function(e,t){var n=e[e.length-1];return[].concat(QW(e),QW(Array(t-e.length).fill(n)))}(e,n)})));return function(n){return 0===n?e:1===n?t:r(n).map(function(e){var t=WW(e,3),n=t[0],r=t[1],i=t[2];return new $X.Vector3(n,r,i)})}}var KX=window.THREE?window.THREE:{BufferGeometry:ai,Color:Or,Group:Ui,Line:cs,NormalBlending:1,ShaderMaterial:wi,Vector3:Wt},ZX=C_.default||C_,JX=Xc({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.pause()},resumeAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.resume()},_destructor:function(e){var t;null===(t=e.ticker)||void 0===t||t.dispose()}},stateInit:function(e){return{tweenGroup:e.tweenGroup,ticker:new ZX,sharedMaterial:new KX.ShaderMaterial(zW(zW({},TX()),{},{transparent:!0,blending:KX.NormalBlending}))}},init:function(e,t){JW(e),t.scene=e,t.dataMapper=new _X(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var e=new KX.Group;return e.__globeObjType="path",e}),t.ticker.onTick.add(function(e,n){t.dataMapper.entries().map(function(e){return WW(e,2)[1]}).filter(function(e){return e.children.length&&e.children[0].material&&e.children[0].__dashAnimateStep}).forEach(function(e){var t=e.children[0],r=t.__dashAnimateStep*n;if("Line"===t.type){var i=t.material.uniforms.dashTranslate.value%1e9;t.material.uniforms.dashTranslate.value=i+r}else if("Line2"===t.type){for(var s=t.material.dashOffset-r,a=t.material.dashSize+t.material.gapSize;s<=-a;)s+=a;t.material.dashOffset=s}})})},update:function(e){var t=wg(e.pathPoints),n=wg(e.pathPointLat),r=wg(e.pathPointLng),i=wg(e.pathPointAlt),s=wg(e.pathStroke),a=wg(e.pathColor),o=wg(e.pathDashLength),l=wg(e.pathDashGap),u=wg(e.pathDashInitialGap),c=wg(e.pathDashAnimateTime);function h(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=t+1;if(e instanceof Array||e instanceof Function){var a=e instanceof Array?XA().domain(e.map(function(t,n){return n/(e.length-1)})).range(e):e;n=function(e){return AX(a(e),i,!0)}}else{var o=AX(e,i,!0);n=function(){return o}}for(var l=[],u=0,c=s;u1&&void 0!==arguments[1]?arguments[1]:1,t=[],n=null;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(r){if(n){for(;Math.abs(n[1]-r[1])>180;)n[1]+=360*(n[1]e)for(var a=Math.floor(i/e),o=s(n[0],r[0],a),l=s(n[1],r[1],a),u=s(n[2],r[2],a),c=0,h=o.length;c0?1e3/b:0,f){v.material.resolution=e.rendererSize;var x=o(d),T=l(d),S=u(d);v.material.dashed=T>0,v.material.dashed?v.material.defines.USE_DASH="":delete v.material.defines.USE_DASH,v.material.dashed&&(v.material.dashScale=1/(_=0,y.forEach(function(e){g&&(_+=g.distanceTo(e)),g=e}),_),v.material.dashSize=x,v.material.gapSize=T,v.material.dashOffset=-S);var w=a(d);if(w instanceof Array){var M=h(a(d),y.length-1,1,!1);v.geometry.setColors(M.array),v.material.vertexColors=!0}else{var E=w,C=hX(E);v.material.color=new KX.Color(cX(E)),v.material.transparent=C<1,v.material.opacity=C,v.material.vertexColors=!1}v.material.needsUpdate=!0}else{Object.assign(v.material.uniforms,{dashSize:{value:o(d)},gapSize:{value:l(d)},dashOffset:{value:u(d)}});var R=h(a(d),y.length),N=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[],i=0,s=e+1;i0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;NW(this,t),(e=RW(this,t)).type="CircleLineGeometry",e.parameters={radius:n,segmentCount:r};for(var i=[],s=0;s<=r;s++){var a=(s/r-.25)*Math.PI*2;i.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return e.setFromPoints(i),e}return kW(t,e),UW(t)}((window.THREE?window.THREE:{BufferGeometry:ai}).BufferGeometry),aQ=window.THREE?window.THREE:{Color:Or,Group:Ui,Line:cs,LineBasicMaterial:ns,Vector3:Wt},oQ=C_.default||C_,lQ=Xc({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.pause()},resumeAnimation:function(e){var t;null===(t=e.ticker)||void 0===t||t.resume()},_destructor:function(e){var t;null===(t=e.ticker)||void 0===t||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;JW(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new _X(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var e=new aQ.Group;return e.__globeObjType="ring",e}),t.ticker=new oQ,t.ticker.onTick.add(function(e){if(t.ringsData.length){var n=wg(t.ringColor),r=wg(t.ringAltitude),i=wg(t.ringMaxRadius),s=wg(t.ringPropagationSpeed),a=wg(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(e){return WW(e,2)[1]}).forEach(function(o){var l,u,c=WW(o,2),h=c[0],A=c[1];if((A.__nextRingTime||0)<=e){var d=a(h)/1e3;A.__nextRingTime=e+(d<=0?1/0:d);var p,f=new aQ.Line(new sQ(1,t.ringResolution),new aQ.LineBasicMaterial),m=n(h),g=m instanceof Array||m instanceof Function;g?m instanceof Array?(p=XA().domain(m.map(function(e,t){return t/(m.length-1)})).range(m),f.material.transparent=m.some(function(e){return hX(e)<1})):(p=m,f.material.transparent=!0):(f.material.color=new aQ.Color(cX(m)),l=f.material,u=hX(m),l.opacity=u,l.transparent=u<1,l.depthWrite=u>=1);var _=tX*(1+r(h)),v=i(h),y=v*Math.PI/180,b=s(h),x=b<=0,T=function(e){var t=e.t,n=(x?1-t:t)*y;if(f.scale.x=f.scale.y=_*Math.sin(n),f.position.z=_*(1-Math.cos(n)),g){var r=p(t);f.material.color=new aQ.Color(cX(r)),f.material.transparent&&(f.material.opacity=hX(r))}};if(0===b)T({t:0}),A.add(f);else{var S=1e3*Math.abs(v/b);t.tweenGroup.add(new eh({t:0}).to({t:1},S).onUpdate(T).onStart(function(){return A.add(f)}).onComplete(function(){A.remove(f),ZW(f)}).start())}}})}})},update:function(e){var t=wg(e.ringLat),n=wg(e.ringLng),r=wg(e.ringAltitude),i=e.scene.localToWorld(new aQ.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(e,s){var a=t(s),o=n(s),l=r(s);Object.assign(e.position,rX(a,o,l)),e.lookAt(i)}).digest(e.ringsData)}}),uQ={glyphs:{0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"ο":{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"¦":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},"Τ":{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},"Π":{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},"ΐ":{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"²":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"–":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},"Κ":{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},"ƒ":{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},"ό":{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"»":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"©":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},"ώ":{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"«":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"∙":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"ÿ":{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},"µ":{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},"Ι":{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},"Ύ":{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"’":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"Ν":{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},"ς":{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},"Ψ":{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},"ι":{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},"Ά":{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},"ε":{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},"Δ":{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"‰":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"—":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},"ρ":{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"¯":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},"Η":{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"Α":{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"…":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},"ν":{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"¶":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},"β":{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},"Μ":{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},"Ό":{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ή":{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"•":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"¥":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},"γ":{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},"α":{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"­":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"Χ":{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"†":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"°":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},"Ξ":{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "}," ":{x_min:0,x_max:0,ha:853},"Ϋ":{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"”":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},"Ί":{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},"Β":{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},"υ":{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},"χ":{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},"ί":{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},"Ζ":{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"¨":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"‹":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"„":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},"δ":{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},"έ":{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},"ω":{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"´":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"±":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"ϋ":{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"§":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},"Ω":{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},"ύ":{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"™":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},"ή":{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},"Θ":{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"®":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},"Ε":{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"³":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},"σ":{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},"ζ":{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},"θ":{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},"Ο":{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},"Γ":{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},"Έ":{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"Ώ":{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},"Ϊ":{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"½":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},"Ρ":{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},"ª":{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"΅":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},"Φ":{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"⁋":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},"Σ":{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"›":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"£":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"¬":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},"λ":{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:{postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:'Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "MgOpen", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.',manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50},cQ=zW(zW({},window.THREE?window.THREE:{BoxGeometry:yi,CircleGeometry:Ss,DoubleSide:2,Group:Ui,Mesh:_i,MeshLambertMaterial:Ua,TextGeometry:SW,Vector3:Wt}),{},{Font:class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){const r=[],i=function(e,t,n,r){const i=Array.from(e),s=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*s,o=[];let l=0,u=0;"rtl"!=r&&"tb"!=r||i.reverse();for(let e=0;e1?t-1:0),r=1;r1?t-1:0),r=1;r2&&void 0!==arguments[2]&&arguments[2],n=function(n){function r(){var n;NW(this,r);for(var i=arguments.length,s=new Array(i),a=0;a1&&void 0!==arguments[1]?arguments[1]:Object);return Object.keys(e()).forEach(function(e){return n.prototype[e]=function(){var t,n=(t=this.__kapsuleInstance)[e].apply(t,arguments);return n===this.__kapsuleInstance?this:n}}),n}(YQ,(window.THREE?window.THREE:{Group:Ui}).Group,!0);const ZQ={type:"change"},JQ={type:"start"},e$={type:"end"},t$=1e-6,n$=-1,r$=0,i$=1,s$=2,a$=3,o$=4,l$=new Ht,u$=new Ht,c$=new Wt,h$=new Wt,A$=new Wt,d$=new jt,p$=new Wt,f$=new Wt,m$=new Wt,g$=new Wt;class _$ extends Po{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:a,MIDDLE:o,RIGHT:l},this.target=new Wt,this.state=n$,this.keyState=n$,this._lastPosition=new Wt,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new Wt,this._movePrev=new Ht,this._moveCurr=new Ht,this._lastAxis=new Wt,this._zoomStart=new Ht,this._zoomEnd=new Ht,this._panStart=new Ht,this._panEnd=new Ht,this._pointers=[],this._pointerPositions={},this._onPointerMove=y$.bind(this),this._onPointerDown=v$.bind(this),this._onPointerUp=b$.bind(this),this._onPointerCancel=x$.bind(this),this._onContextMenu=R$.bind(this),this._onMouseWheel=C$.bind(this),this._onKeyDown=S$.bind(this),this._onKeyUp=T$.bind(this),this._onTouchStart=N$.bind(this),this._onTouchMove=P$.bind(this),this._onTouchEnd=D$.bind(this),this._onMouseDown=w$.bind(this),this._onMouseMove=M$.bind(this),this._onMouseUp=E$.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,null!==t&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}handleResize(){const e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>t$&&(this.dispatchEvent(ZQ),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>t$||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(ZQ),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=n$,this.keyState=n$,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(ZQ),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(u$.copy(this._panEnd).sub(this._panStart),u$.lengthSq()){if(this.object.isOrthographicCamera){const e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;u$.x*=e,u$.y*=t}u$.multiplyScalar(this._eye.length()*this.panSpeed),h$.copy(this._eye).cross(this.object.up).setLength(u$.x),h$.add(c$.copy(this.object.up).setLength(u$.y)),this.object.position.add(h$),this.target.add(h$),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(u$.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){g$.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=g$.length();e?(this._eye.copy(this.object.position).sub(this.target),p$.copy(this._eye).normalize(),f$.copy(this.object.up).normalize(),m$.crossVectors(f$,p$).normalize(),f$.setLength(this._moveCurr.y-this._movePrev.y),m$.setLength(this._moveCurr.x-this._movePrev.x),g$.copy(f$.add(m$)),A$.crossVectors(g$,this._eye).normalize(),e*=this.rotateSpeed,d$.setFromAxisAngle(A$,e),this._eye.applyQuaternion(d$),this.object.up.applyQuaternion(d$),this._lastAxis.copy(A$),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),d$.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(d$),this.object.up.applyQuaternion(d$)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===o$?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Gt.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,1!==e&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Gt.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return l$.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),l$}_getMouseOnCircle(e,t){return l$.set((e-.5*this.screen.width-this.screen.left)/(.5*this.screen.width),(this.screen.height+2*(this.screen.top-t))/this.screen.width),l$}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;tthis.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()Math.PI&&(n-=q$),r<-Math.PI?r+=q$:r>Math.PI&&(r-=q$),this._spherical.theta=n<=r?Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(k$.setFromSpherical(this._spherical),k$.applyQuaternion(this._quatInverse),t.copy(this.target).add(k$),this.object.lookAt(this.target),!0===this.enableDamping?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){const t=k$.length();e=this._clampDistance(t*this._scale);const n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){const t=new Wt(this._mouse.x,this._mouse.y,0);t.unproject(this.object);const n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;const r=new Wt(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=k$.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;null!==e&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(O$.origin.copy(this.object.position),O$.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(O$.direction))$$||8*(1-this._lastQuaternion.dot(this.object.quaternion))>$$||this._lastTargetPosition.distanceToSquared(this.target)>$$)&&(this.dispatchEvent(L$),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0)}_getAutoRotationAngle(e){return null!==e?q$/60*this.autoRotateSpeed*e:q$/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(.01*e);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){k$.setFromMatrixColumn(t,0),k$.multiplyScalar(-e),this._panOffset.add(k$)}_panUp(e,t){!0===this.screenSpacePanning?k$.setFromMatrixColumn(t,1):(k$.setFromMatrixColumn(t,0),k$.crossVectors(this.object.up,k$)),k$.multiplyScalar(e),this._panOffset.add(k$)}_pan(e,t){const n=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;k$.copy(r).sub(this.target);let i=k$.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,s=n.width,a=n.height;this._mouse.x=r/s*2-1,this._mouse.y=-i/a*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(q$*this._rotateDelta.x/t.clientHeight),this._rotateUp(q$*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(q$*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-q$*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(q$*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-q$*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(1===this._pointers.length)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(1===this._pointers.length)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(1==this._pointers.length)this._rotateEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(q$*this._rotateDelta.x/t.clientHeight),this._rotateUp(q$*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(1===this._pointers.length)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const s=.5*(e.pageX+t.x),a=.5*(e.pageY+t.y);this._updateZoomParameters(s,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;tcY||8*(1-this._lastQuaternion.dot(t.quaternion))>cY)&&(this.dispatchEvent(uY),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){const e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}}function dY(e){if(!e.altKey&&!1!==this.enabled){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1}this._updateMovementVector(),this._updateRotationVector()}}function pY(e){if(!1!==this.enabled){switch(e.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0}this._updateMovementVector(),this._updateRotationVector()}}function fY(e){if(!1!==this.enabled)if(this.dragToLook)this._status++;else{switch(e.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1}this._updateMovementVector()}}function mY(e){if(!1!==this.enabled&&(!this.dragToLook||this._status>0)){const t=this._getContainerDimensions(),n=t.size[0]/2,r=t.size[1]/2;this._moveState.yawLeft=-(e.pageX-t.offset[0]-n)/n,this._moveState.pitchDown=(e.pageY-t.offset[1]-r)/r,this._updateRotationVector()}}function gY(e){if(!1!==this.enabled){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(e.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0}this._updateMovementVector()}this._updateRotationVector()}}function _Y(){!1!==this.enabled&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function vY(e){!1!==this.enabled&&e.preventDefault()}const yY={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class bY{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const xY=new ao(-1,1,1,-1,0,1);const TY=new class extends ai{constructor(){super(),this.setAttribute("position",new Zr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Zr([0,2,0,0,2,0],2))}};class SY{constructor(e){this._mesh=new _i(TY,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,xY)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class wY extends bY{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof wi?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Si.clone(e.uniforms),this.material=new wi({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new SY(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class MY extends bY{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),i=e.state;let s,a;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0),this.inverse?(s=0,a=1):(s=1,a=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,s,4294967295),i.buffers.stencil.setClear(a),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.color.setMask(!0),i.buffers.depth.setMask(!0),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}}class EY extends bY{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class CY{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new Ht);this._width=n.width,this._height=n.height,(t=new pn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:ue})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new wY(yY),this.copyPass.material.blending=0,this.clock=new mo}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t1?r-1:0),s=1;s=0&&i<1?(o=s,l=a):i>=1&&i<2?(o=a,l=s):i>=2&&i<3?(l=s,u=a):i>=3&&i<4?(l=a,u=s):i>=4&&i<5?(o=a,u=s):i>=5&&i<6&&(o=s,u=a);var c=n-s/2;return r(o+c,l+c,u+c)}var VY={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var zY=/^#[a-fA-F0-9]{6}$/,GY=/^#[a-fA-F0-9]{8}$/,HY=/^#[a-fA-F0-9]{3}$/,jY=/^#[a-fA-F0-9]{4}$/,WY=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,XY=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,QY=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,$Y=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function YY(e){if("string"!=typeof e)throw new BY(3);var t=function(e){if("string"!=typeof e)return e;var t=e.toLowerCase();return VY[t]?"#"+VY[t]:e}(e);if(t.match(zY))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(GY)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(HY))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(jY)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=WY.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var s=XY.exec(t.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var a=QY.exec(t);if(a){var o="rgb("+qY(parseInt(""+a[1],10),parseInt(""+a[2],10)/100,parseInt(""+a[3],10)/100)+")",l=WY.exec(o);if(!l)throw new BY(4,t,o);return{red:parseInt(""+l[1],10),green:parseInt(""+l[2],10),blue:parseInt(""+l[3],10)}}var u=$Y.exec(t.substring(0,50));if(u){var c="rgb("+qY(parseInt(""+u[1],10),parseInt(""+u[2],10)/100,parseInt(""+u[3],10)/100)+")",h=WY.exec(c);if(!h)throw new BY(4,t,c);return{red:parseInt(""+h[1],10),green:parseInt(""+h[2],10),blue:parseInt(""+h[3],10),alpha:parseFloat(""+u[4])>1?parseFloat(""+u[4])/100:parseFloat(""+u[4])}}throw new BY(5)}function KY(e){return function(e){var t,n=e.red/255,r=e.green/255,i=e.blue/255,s=Math.max(n,r,i),a=Math.min(n,r,i),o=(s+a)/2;if(s===a)return void 0!==e.alpha?{hue:0,saturation:0,lightness:o,alpha:e.alpha}:{hue:0,saturation:0,lightness:o};var l=s-a,u=o>.5?l/(2-s-a):l/(s+a);switch(s){case n:t=(r-i)/l+(r=1?rK(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new BY(7)}function sK(e){if("object"!=typeof e)throw new BY(8);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&"number"==typeof e.alpha}(e))return iK(e);if(function(e){return"number"==typeof e.red&&"number"==typeof e.green&&"number"==typeof e.blue&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return rK(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&"number"==typeof e.alpha}(e))return function(e,t,n,r){if("object"==typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?nK(e.hue,e.saturation,e.lightness):"rgba("+qY(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new BY(2)}(e);if(function(e){return"number"==typeof e.hue&&"number"==typeof e.saturation&&"number"==typeof e.lightness&&("number"!=typeof e.alpha||void 0===e.alpha)}(e))return function(e,t,n){if("object"==typeof e&&void 0===t&&void 0===n)return nK(e.hue,e.saturation,e.lightness);throw new BY(1)}(e);throw new BY(8)}function aK(e,t,n){return function(){var r=n.concat(Array.prototype.slice.call(arguments));return r.length>=t?e.apply(this,r):aK(e,t,r)}}function oK(e){return aK(e,e.length,[])}function lK(e,t,n){return Math.max(e,Math.min(t,n))}oK(function(e,t){if("transparent"===t)return t;var n=KY(t);return sK(NY({},n,{hue:n.hue+parseFloat(e)}))}),oK(function(e,t){if("transparent"===t)return t;var n=KY(t);return sK(NY({},n,{lightness:lK(0,1,n.lightness-parseFloat(e))}))}),oK(function(e,t){if("transparent"===t)return t;var n=KY(t);return sK(NY({},n,{saturation:lK(0,1,n.saturation-parseFloat(e))}))}),oK(function(e,t){if("transparent"===t)return t;var n=KY(t);return sK(NY({},n,{lightness:lK(0,1,n.lightness+parseFloat(e))}))});var uK=oK(function(e,t,n){if("transparent"===t)return n;if("transparent"===n)return t;if(0===e)return n;var r=YY(t),i=NY({},r,{alpha:"number"==typeof r.alpha?r.alpha:1}),s=YY(n),a=NY({},s,{alpha:"number"==typeof s.alpha?s.alpha:1}),o=i.alpha-a.alpha,l=2*parseFloat(e)-1,u=((l*o===-1?l:l+o)/(1+l*o)+1)/2,c=1-u;return iK({red:Math.floor(i.red*u+a.red*c),green:Math.floor(i.green*u+a.green*c),blue:Math.floor(i.blue*u+a.blue*c),alpha:i.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))})}),cK=uK;var hK=oK(function(e,t){if("transparent"===t)return t;var n=YY(t);return iK(NY({},n,{alpha:lK(0,1,(100*("number"==typeof n.alpha?n.alpha:1)+100*parseFloat(e))/100)}))}),AK=hK;oK(function(e,t){if("transparent"===t)return t;var n=KY(t);return sK(NY({},n,{saturation:lK(0,1,n.saturation+parseFloat(e))}))}),oK(function(e,t){return"transparent"===t?t:sK(NY({},KY(t),{hue:parseFloat(e)}))}),oK(function(e,t){return"transparent"===t?t:sK(NY({},KY(t),{lightness:parseFloat(e)}))}),oK(function(e,t){return"transparent"===t?t:sK(NY({},KY(t),{saturation:parseFloat(e)}))}),oK(function(e,t){return"transparent"===t?t:cK(parseFloat(e),"rgb(0, 0, 0)",t)}),oK(function(e,t){return"transparent"===t?t:cK(parseFloat(e),"rgb(255, 255, 255)",t)}),oK(function(e,t){if("transparent"===t)return t;var n=YY(t);return iK(NY({},n,{alpha:lK(0,1,+(100*("number"==typeof n.alpha?n.alpha:1)-100*parseFloat(e)).toFixed(2)/100)}))});var dK="http://www.w3.org/1999/xhtml",pK={svg:"http://www.w3.org/2000/svg",xhtml:dK,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fK(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),pK.hasOwnProperty(t)?{space:pK[t],local:e}:e}function mK(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===dK&&t.documentElement.namespaceURI===dK?t.createElement(e):t.createElementNS(n,e)}}function gK(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _K(e){var t=fK(e);return(t.local?gK:mK)(t)}function vK(){}function yK(e){return null==e?vK:function(){return this.querySelector(e)}}function bK(){return[]}function xK(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function TK(e){return function(t){return t.matches(e)}}var SK=Array.prototype.find;function wK(){return this.firstElementChild}var MK=Array.prototype.filter;function EK(){return Array.from(this.children)}function CK(e){return new Array(e.length)}function RK(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function NK(e,t,n,r,i,s){for(var a,o=0,l=t.length,u=s.length;ot?1:e>=t?0:NaN}function UK(e){return function(){this.removeAttribute(e)}}function OK(e){return function(){this.removeAttributeNS(e.space,e.local)}}function BK(e,t){return function(){this.setAttribute(e,t)}}function FK(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kK(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function qK(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function VK(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zK(e){return function(){this.style.removeProperty(e)}}function GK(e,t,n){return function(){this.style.setProperty(e,t,n)}}function HK(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function jK(e){return function(){delete this[e]}}function WK(e,t){return function(){this[e]=t}}function XK(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function QK(e){return e.trim().split(/^|\s+/)}function $K(e){return e.classList||new YK(e)}function YK(e){this._node=e,this._names=QK(e.getAttribute("class")||"")}function KK(e,t){for(var n=$K(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var vZ=[null];function yZ(e,t){this._groups=e,this._parents=t}yZ.prototype={constructor:yZ,select:function(e){"function"!=typeof e&&(e=yK(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=y&&(y=v+1);!(_=m[y])&&++y=0;)(r=i[s])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=IK);for(var n=this._groups,r=n.length,i=new Array(r),s=0;s1?this.each((null==t?zK:"function"==typeof t?HK:GK)(e,t,null==n?"":n)):function(e,t){return e.style.getPropertyValue(t)||VK(e).getComputedStyle(e,null).getPropertyValue(t)}(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?jK:"function"==typeof t?XK:WK)(e,t)):this.node()[e]},classed:function(e,t){var n=QK(e+"");if(arguments.length<2){for(var r=$K(this.node()),i=-1,s=n.length;++i=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=s.length;if(!(arguments.length<2)){for(o=t?fZ:pZ,r=0;ro&&wZ.sort(CZ),e=wZ.shift(),o=wZ.length,e.__d&&(n=void 0,r=void 0,i=(r=(t=e).__v).__e,s=[],a=[],t.__P&&((n=BZ({},r)).__v=r.__v+1,xZ.vnode&&xZ.vnode(n),JZ(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,s,null==i?zZ(r):i,!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,tJ(s,n,a),r.__e=r.__=null,n.__e!=i&&GZ(n)));jZ.__r=0}function WZ(e,t,n,r,i,s,a,o,l,u,c){var h,A,d,p,f,m,g,_=r&&r.__k||IZ,v=t.length;for(l=XZ(n,t,_,l,v),h=0;h0?kZ(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,o=null,-1!=(u=a.__i=$Z(a,n,l,h))&&(h--,(o=n[u])&&(o.__u|=2)),null==o||null==o.__v?(-1==u&&(i>c?A--:il?A--:A++,a.__u|=4))):e.__k[s]=null;if(h)for(s=0;s(c?1:0))for(i=n-1,s=n+1;i>=0||s=0?i--:s++])&&!(2&u.__u)&&o==u.key&&l==u.type)return a;return-1}function YZ(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||UZ.test(t)?n:n+"px"}function KZ(e,t,n,r,i){var s,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||YZ(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||YZ(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(RZ,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=NZ,e.addEventListener(t,s?DZ:PZ,s)):e.removeEventListener(t,s?DZ:PZ,s);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function ZZ(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=NZ++;else if(t.t0?e:OZ(e)?e.map(nJ):BZ({},e)}function rJ(e,t,n,r,i,s,a,o,l){var u,c,h,A,d,p,f,m=n.props,g=t.props,_=t.type;if("svg"==_?i="http://www.w3.org/2000/svg":"math"==_?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;u2&&(a.children=arguments.length>3?bZ.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return kZ(e,a,r,i,null)}(qZ,null,[e]),r||LZ,LZ,t.namespaceURI,r?null:t.firstChild?bZ.call(t.childNodes):null,i,r?r.__e:t.firstChild,false,s),tJ(i,e,s)}function lJ(e,t,n){var r,i,s,a,o=BZ({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)"key"==s?r=t[s]:"ref"==s?i=t[s]:o[s]=void 0===t[s]&&null!=a?a[s]:t[s];return arguments.length>2&&(o.children=arguments.length>3?bZ.call(arguments,2):n),kZ(e.type,o,r||e.key,i||e.ref,null)}function uJ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2&&void 0!==arguments[2]?arguments[2]:{}).style,r=void 0===n?{}:n,i=function(e){return"string"==typeof e?new yZ([[document.querySelector(e)]],[document.documentElement]):new yZ([[e]],vZ)}(!!e&&"object"===dJ(e)&&!!e.node&&"function"==typeof e.node?e.node():e);"static"===i.style("position")&&i.style("position","relative"),t.tooltipEl=i.append("div").attr("class","float-tooltip-kap"),Object.entries(r).forEach(function(e){var n=AJ(e,2),r=n[0],i=n[1];return t.tooltipEl.style(r,i)}),t.tooltipEl.style("left","-10000px").style("display","none");var s="tooltip-".concat(Math.round(1e12*Math.random()));t.mouseInside=!1,i.on("mousemove.".concat(s),function(e){t.mouseInside=!0;var n=function(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}(e),r=i.node(),s=r.offsetWidth,a=r.offsetHeight,o=[null===t.offsetX||void 0===t.offsetX?"-".concat(n[0]/s*100,"%"):"number"==typeof t.offsetX?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,null===t.offsetY||void 0===t.offsetY?a>130&&a-n[1]<100?"calc(-100% - 6px)":"21px":"number"==typeof t.offsetY?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",n[0]+"px").style("top",n[1]+"px").style("transform","translate(".concat(o.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),i.on("mouseover.".concat(s),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),i.on("mouseout.".concat(s),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){var t,n;e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):"string"==typeof e.content?e.tooltipEl.html(e.content):!function(e){return SZ(lJ(e))}(e.content)?(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):(e.tooltipEl.text(""),t=e.content,delete(n=e.tooltipEl.node()).__k,oJ(pJ(t),n)):e.tooltipEl.text("")}});function mJ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0),h=!!n.morphAttributes.position,A=!!n.morphAttributes.normal,d=!!n.morphAttributes.color;let p=0;r.toneMapped&&(null!==M&&!0!==M.isXRRenderTarget||(p=x.toneMapping));const f=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==f?f.length:0,g=ae.get(r),_=v.state.lights;if(!0===G&&(!0===H||e!==C)){const t=e===C&&r.id===E;Me.setState(r,e,t)}let y=!1;r.version===g.__version?g.needsLights&&g.lightsStateVersion!==_.state.version||g.outputColorSpace!==o||i.isBatchedMesh&&!1===g.batching?y=!0:i.isBatchedMesh||!0!==g.batching?i.isBatchedMesh&&!0===g.batchingColor&&null===i.colorTexture||i.isBatchedMesh&&!1===g.batchingColor&&null!==i.colorTexture||i.isInstancedMesh&&!1===g.instancing?y=!0:i.isInstancedMesh||!0!==g.instancing?i.isSkinnedMesh&&!1===g.skinning?y=!0:i.isSkinnedMesh||!0!==g.skinning?i.isInstancedMesh&&!0===g.instancingColor&&null===i.instanceColor||i.isInstancedMesh&&!1===g.instancingColor&&null!==i.instanceColor||i.isInstancedMesh&&!0===g.instancingMorph&&null===i.morphTexture||i.isInstancedMesh&&!1===g.instancingMorph&&null!==i.morphTexture||g.envMap!==l||!0===r.fog&&g.fog!==s?y=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Me.numPlanes&&g.numIntersection===Me.numIntersection?(g.vertexAlphas!==u||g.vertexTangents!==c||g.morphTargets!==h||g.morphNormals!==A||g.morphColors!==d||g.toneMapping!==p||g.morphTargetsCount!==m)&&(y=!0):y=!0:y=!0:y=!0:y=!0:(y=!0,g.__version=r.version);let b=g.currentProgram;!0===y&&(b=Je(r,t,i));let T=!1,S=!1,w=!1;const R=b.getUniforms(),N=g.uniforms;re.useProgram(b.program)&&(T=!0,S=!0,w=!0);r.id!==E&&(E=r.id,S=!0);if(T||C!==e){re.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),R.setValue(Ue,"projectionMatrix",e.projectionMatrix),R.setValue(Ue,"viewMatrix",e.matrixWorldInverse);const t=R.map.cameraPosition;void 0!==t&&t.setValue(Ue,W.setFromMatrixPosition(e.matrixWorld)),ee.logarithmicDepthBuffer&&R.setValue(Ue,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&R.setValue(Ue,"isOrthographic",!0===e.isOrthographicCamera),C!==e&&(C=e,S=!0,w=!0)}if(i.isSkinnedMesh){R.setOptional(Ue,i,"bindMatrix"),R.setOptional(Ue,i,"bindMatrixInverse");const e=i.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),R.setValue(Ue,"boneTexture",e.boneTexture,le))}i.isBatchedMesh&&(R.setOptional(Ue,i,"batchingTexture"),R.setValue(Ue,"batchingTexture",i._matricesTexture,le),R.setOptional(Ue,i,"batchingIdTexture"),R.setValue(Ue,"batchingIdTexture",i._indirectTexture,le),R.setOptional(Ue,i,"batchingColorTexture"),null!==i._colorsTexture&&R.setValue(Ue,"batchingColorTexture",i._colorsTexture,le));const P=n.morphAttributes;void 0===P.position&&void 0===P.normal&&void 0===P.color||Re.update(i,n,b);(S||g.receiveShadow!==i.receiveShadow)&&(g.receiveShadow=i.receiveShadow,R.setValue(Ue,"receiveShadow",i.receiveShadow));r.isMeshGouraudMaterial&&null!==r.envMap&&(N.envMap.value=l,N.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);r.isMeshStandardMaterial&&null===r.envMap&&null!==t.environment&&(N.envMapIntensity.value=t.environmentIntensity);void 0!==N.dfgLUT&&(N.dfgLUT.value=(null===dc&&(dc=new Gi(Ac,32,32,xe,ue),dc.minFilter=J,dc.magFilter=J,dc.wrapS=Q,dc.wrapT=Q,dc.generateMipmaps=!1,dc.needsUpdate=!0),dc));S&&(R.setValue(Ue,"toneMappingExposure",x.toneMappingExposure),g.needsLights&&(L=w,(D=N).ambientLightColor.needsUpdate=L,D.lightProbe.needsUpdate=L,D.directionalLights.needsUpdate=L,D.directionalLightShadows.needsUpdate=L,D.pointLights.needsUpdate=L,D.pointLightShadows.needsUpdate=L,D.spotLights.needsUpdate=L,D.spotLightShadows.needsUpdate=L,D.rectAreaLights.needsUpdate=L,D.hemisphereLights.needsUpdate=L),s&&!0===r.fog&&ve.refreshFogUniforms(N,s),ve.refreshMaterialUniforms(N,r,O,U,v.state.transmissionRenderTarget[e.id]),vu.upload(Ue,et(g),N,le));var D,L;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(vu.upload(Ue,et(g),N,le),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&R.setValue(Ue,"center",i.center);if(R.setValue(Ue,"modelViewMatrix",i.modelViewMatrix),R.setValue(Ue,"normalMatrix",i.normalMatrix),R.setValue(Ue,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){const e=r.uniformsGroups;for(let t=0,n=e.length;t{function n(){r.forEach(function(e){ae.get(e).currentProgram.isReady()&&r.delete(e)}),0!==r.size?setTimeout(n,10):t(e)}null!==Z.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let He=null;function je(){Xe.stop()}function We(){Xe.start()}const Xe=new Lo;function Qe(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)v.pushLight(e),e.castShadow&&v.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||z.intersectsSprite(e)){r&&X.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);const t=ge.update(e),i=e.material;i.visible&&_.push(e,t,i,n,X.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||z.intersectsObject(e))){const t=ge.update(e),i=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),X.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),X.copy(t.boundingSphere.center)),X.applyMatrix4(e.matrixWorld).applyMatrix4(j)),Array.isArray(i)){const r=t.groups;for(let s=0,a=r.length;s0&&Ke(i,t,n),s.length>0&&Ke(s,t,n),a.length>0&&Ke(a,t,n),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function Ye(e,t,n,r){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===v.state.transmissionRenderTarget[r.id]&&(v.state.transmissionRenderTarget[r.id]=new pn(1,1,{generateMipmaps:!0,type:Z.has("EXT_color_buffer_half_float")||Z.has("EXT_color_buffer_float")?ue:ne,minFilter:te,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:en.workingColorSpace}));const s=v.state.transmissionRenderTarget[r.id],a=r.viewport||R;s.setSize(a.z*x.transmissionResolutionScale,a.w*x.transmissionResolutionScale);const o=x.getRenderTarget(),l=x.getActiveCubeFace(),u=x.getActiveMipmapLevel();x.setRenderTarget(s),x.getClearColor(D),L=x.getClearAlpha(),L<1&&x.setClearColor(16777215,.5),x.clear(),Y&&Ce.render(n);const c=x.toneMapping;x.toneMapping=0;const h=r.viewport;if(void 0!==r.viewport&&(r.viewport=void 0),v.setupLightsView(r),!0===G&&Me.setGlobalState(x.clippingPlanes,r),Ke(e,n,r),le.updateMultisampleRenderTarget(s),le.updateRenderTargetMipmap(s),!1===Z.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,s=t.length;i0)for(let t=0,s=n.length;t0&&Ye(r,i,e,t),Y&&Ce.render(e),$e(_,e,t);null!==M&&0===w&&(le.updateMultisampleRenderTarget(M),le.updateRenderTargetMipmap(M)),!0===e.isScene&&e.onAfterRender(x,e,t),Le.resetDefaultState(),E=-1,C=null,b.pop(),b.length>0?(v=b[b.length-1],!0===G&&Me.setGlobalState(x.clippingPlanes,v.state.camera)):v=null,y.pop(),_=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(e,t,n){const r=ae.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),ae.get(e.texture).__webglTexture=t,ae.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=ae.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const nt=Ue.createFramebuffer();this.setRenderTarget=function(e,t=0,n=0){M=e,S=t,w=n;let r=!0,i=null,s=!1,a=!1;if(e){const o=ae.get(e);if(void 0!==o.__useDefaultFramebuffer)re.bindFramebuffer(Ue.FRAMEBUFFER,null),r=!1;else if(void 0===o.__webglFramebuffer)le.setupRenderTarget(e);else if(o.__hasExternalTextures)le.rebindTextures(e,ae.get(e.texture).__webglTexture,ae.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(o.__boundDepthTexture!==t){if(null!==t&&ae.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");le.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const u=ae.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(u[t])?u[t][n]:u[t],s=!0):i=e.samples>0&&!1===le.useMultisampledRTT(e)?ae.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[n]:u,R.copy(e.viewport),N.copy(e.scissor),P=e.scissorTest}else R.copy(k).multiplyScalar(O).floor(),N.copy(q).multiplyScalar(O).floor(),P=V;0!==n&&(i=nt);if(re.bindFramebuffer(Ue.FRAMEBUFFER,i)&&r&&re.drawBuffers(e,i),re.viewport(R),re.scissor(N),re.setScissorTest(P),s){const r=ae.get(e.texture);Ue.framebufferTexture2D(Ue.FRAMEBUFFER,Ue.COLOR_ATTACHMENT0,Ue.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){const r=t;for(let t=0;t=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&Ue.readBuffer(Ue.COLOR_ATTACHMENT0+o),Ue.readPixels(t,n,r,i,De.convert(l),De.convert(u),s))}finally{const e=null!==M?ae.get(M).__webglFramebuffer:null;re.bindFramebuffer(Ue.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,s,a,o=0){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=ae.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){re.bindFramebuffer(Ue.FRAMEBUFFER,l);const a=e.textures[o],u=a.format,c=a.type;if(!ee.textureFormatReadable(u))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ee.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const h=Ue.createBuffer();Ue.bindBuffer(Ue.PIXEL_PACK_BUFFER,h),Ue.bufferData(Ue.PIXEL_PACK_BUFFER,s.byteLength,Ue.STREAM_READ),e.textures.length>1&&Ue.readBuffer(Ue.COLOR_ATTACHMENT0+o),Ue.readPixels(t,n,r,i,De.convert(u),De.convert(c),0);const A=null!==M?ae.get(M).__webglFramebuffer:null;re.bindFramebuffer(Ue.FRAMEBUFFER,A);const d=Ue.fenceSync(Ue.SYNC_GPU_COMMANDS_COMPLETE,0);return Ue.flush(),await function(e,t,n){return new Promise(function(r,i){setTimeout(function s(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}},n)})}(Ue,d,4),Ue.bindBuffer(Ue.PIXEL_PACK_BUFFER,h),Ue.getBufferSubData(Ue.PIXEL_PACK_BUFFER,0,s),Ue.deleteBuffer(h),Ue.deleteSync(d),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),a=null!==t?t.x:0,o=null!==t?t.y:0;le.setTexture2D(e,0),Ue.copyTexSubImage2D(Ue.TEXTURE_2D,n,0,0,a,o,i,s),re.unbindTexture()};const rt=Ue.createFramebuffer(),at=Ue.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,s=null){let a,o,l,u,c,h,A,d,p;null===s&&(0!==i?(Pt("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=i,i=0):s=0);const f=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)a=n.max.x-n.min.x,o=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,u=n.min.x,c=n.min.y,h=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-i);a=Math.floor(f.width*t),o=Math.floor(f.height*t),l=e.isDataArrayTexture?f.depth:e.isData3DTexture?Math.floor(f.depth*t):1,u=0,c=0,h=0}null!==r?(A=r.x,d=r.y,p=r.z):(A=0,d=0,p=0);const m=De.convert(t.format),g=De.convert(t.type);let _;t.isData3DTexture?(le.setTexture3D(t,0),_=Ue.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(le.setTexture2DArray(t,0),_=Ue.TEXTURE_2D_ARRAY):(le.setTexture2D(t,0),_=Ue.TEXTURE_2D),Ue.pixelStorei(Ue.UNPACK_FLIP_Y_WEBGL,t.flipY),Ue.pixelStorei(Ue.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ue.pixelStorei(Ue.UNPACK_ALIGNMENT,t.unpackAlignment);const v=Ue.getParameter(Ue.UNPACK_ROW_LENGTH),y=Ue.getParameter(Ue.UNPACK_IMAGE_HEIGHT),b=Ue.getParameter(Ue.UNPACK_SKIP_PIXELS),x=Ue.getParameter(Ue.UNPACK_SKIP_ROWS),T=Ue.getParameter(Ue.UNPACK_SKIP_IMAGES);Ue.pixelStorei(Ue.UNPACK_ROW_LENGTH,f.width),Ue.pixelStorei(Ue.UNPACK_IMAGE_HEIGHT,f.height),Ue.pixelStorei(Ue.UNPACK_SKIP_PIXELS,u),Ue.pixelStorei(Ue.UNPACK_SKIP_ROWS,c),Ue.pixelStorei(Ue.UNPACK_SKIP_IMAGES,h);const S=e.isDataArrayTexture||e.isData3DTexture,w=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=ae.get(e),r=ae.get(t),f=ae.get(n.__renderTarget),m=ae.get(r.__renderTarget);re.bindFramebuffer(Ue.READ_FRAMEBUFFER,f.__webglFramebuffer),re.bindFramebuffer(Ue.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(t,n){return e.hoverOrderComparator(t.object,n.object)});var i=r.find(function(t){return e.hoverFilter(t.object)})||null;n=i?i.object:null,e.intersection=i||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&wg(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos;return{x:t.x,y:t.y}},cameraPosition:function(e,t,n,r){var i=e.camera;if(t&&e.initialised){var s=t,a=n||{x:0,y:0,z:0};if(r){var o=Object.assign({},i.position),l=h();e.tweenGroup.add(new eh(o).to(s,r).easing(Qc.Quadratic.Out).onUpdate(u).start()),e.tweenGroup.add(new eh(l).to(a,r/3).easing(Qc.Quadratic.Out).onUpdate(c).start())}else u(s),c(a);return this}return Object.assign({},i.position,{lookAt:h()});function u(e){var t=e.x,n=e.y,r=e.z;void 0!==t&&(i.position.x=t),void 0!==n&&(i.position.y=n),void 0!==r&&(i.position.z=r)}function c(t){var n=new bJ.Vector3(t.x,t.y,t.z);e.controls.enabled&&e.controls.target?e.controls.target=n:i.lookAt(n)}function h(){return Object.assign(new bJ.Vector3(0,0,-1e3).applyQuaternion(i.quaternion).add(i.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length,i=new Array(r>3?r-3:0),s=3;s2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=e.camera;if(t){var s=new bJ.Vector3(0,0,0),a=2*Math.max.apply(Math,vJ(Object.entries(t).map(function(e){var t=_J(e,2),n=t[0],r=t[1];return Math.max.apply(Math,vJ(r.map(function(e){return Math.abs(s[n]-e)})))}))),o=(1-2*r/e.height)*i.fov,l=a/Math.atan(o*Math.PI/180),u=l/i.aspect,c=Math.max(l,u);if(c>0){var h=s.clone().sub(i.position).normalize().multiplyScalar(-c);this.cameraPosition(h,s,n)}}return this},getBbox:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0},n=new bJ.Box3(new bJ.Vector3(0,0,0),new bJ.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(e){return n.expandByObject(e)}),Object.assign.apply(Object,vJ(["x","y","z"].map(function(e){return gJ({},e,[n.min[e],n.max[e]])})))):null},getScreenCoords:function(e,t,n,r){var i=new bJ.Vector3(t,n,r);return i.project(this.camera()),{x:(i.x+1)*e.width/2,y:-(i.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=new bJ.Vector2(t/e.width*2-1,-n/e.height*2+1),s=new bJ.Raycaster;return s.setFromCamera(i,e.camera),Object.assign({},s.ray.at(r,new bJ.Vector3))},intersectingObjects:function(e,t,n){var r=new bJ.Vector2(t/e.width*2-1,-n/e.height*2+1),i=new bJ.Raycaster;return i.params.Line.threshold=e.lineHoverPrecision,i.params.Points.threshold=e.pointsHoverPrecision,i.setFromCamera(r,e.camera),i.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new bJ.Scene,camera:new bJ.PerspectiveCamera,clock:new bJ.Clock,tweenGroup:new Yc,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.controlType,i=void 0===r?"trackball":r,s=n.useWebGPU,a=void 0!==s&&s,o=n.rendererConfig,l=void 0===o?{}:o,u=n.extraRenderers,c=void 0===u?[]:u,h=n.waitForLoadComplete,A=void 0===h||h;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new fJ(t.container),t.pointerPos=new bJ.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(e){return t.container.addEventListener(e,function(n){if("pointerdown"===e&&(t.isPointerPressed=!0),!t.isPointerDragging&&"pointermove"===n.type&&(n.pressure>0||t.isPointerPressed)&&("mouse"===n.pointerType||void 0===n.movementX||[n.movementX,n.movementY].some(function(e){return Math.abs(e)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var r=(i=t.container,s=i.getBoundingClientRect(),a=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,{top:s.top+o,left:s.left+a});t.pointerPos.x=n.pageX-r.left,t.pointerPos.y=n.pageY-r.top}var i,s,a,o},{passive:!0})}),t.container.addEventListener("pointerup",function(e){t.isPointerPressed&&(t.isPointerPressed=!1,t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag)||requestAnimationFrame(function(){0===e.button&&t.onClick(t.hoverObj||null,e,t.intersection),2===e.button&&t.onRightClick&&t.onRightClick(t.hoverObj||null,e,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(e){t.onRightClick&&e.preventDefault()}),t.renderer=new(a?Vj:bJ.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},l)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=c,t.extraRenderers.forEach(function(e){e.domElement.style.position="absolute",e.domElement.style.top="0px",e.domElement.style.pointerEvents="none",t.container.appendChild(e.domElement)}),t.postProcessingComposer=new CY(t.renderer),t.postProcessingComposer.addPass(new RY(t.scene,t.camera)),t.controls=new{trackball:_$,orbit:Y$,fly:AY}[i](t.camera,t.renderer.domElement),"fly"===i&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),"trackball"!==i&&"orbit"!==i||(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(vJ(t.extraRenderers)).forEach(function(e){return e.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new bJ.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,i=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(i,"px"),[e.renderer,e.postProcessingComposer].concat(vJ(e.extraRenderers)).forEach(function(e){return e.setSize(r,i)}),e.camera.aspect=r/i;var s=e.viewOffset.slice(0,2);s.some(function(e){return e})&&(n=e.camera).setViewOffset.apply(n,[r,i].concat(vJ(s),[r,i])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,o=e.width,l=e.height,u=e.viewOffset.slice(0,2);u.some(function(e){return e})?(a=e.camera).setViewOffset.apply(a,[o,l].concat(vJ(u),[o,l])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=2.5*e.skyRadius,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new bJ.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var c=YY(e.backgroundColor).alpha;void 0===c&&(c=1),e.renderer.setClearColor(new bJ.Color(AK(1,e.backgroundColor)),c)}function h(){e.loadComplete=e.scene.visible=!0}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?(new bJ.TextureLoader).load(e.backgroundImageUrl,function(t){t.colorSpace=bJ.SRGBColorSpace,e.skysphere.material=new bJ.MeshBasicMaterial({map:t,side:bJ.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&h()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&h())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(t){return e.scene.remove(t)}),e.lights.forEach(function(t){return e.scene.add(t)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(t){return e.scene.remove(t)}),e.objects.forEach(function(t){return e.scene.add(t)}))}});function TJ(e,t){var n=new t;return n._destructor&&n._destructor(),{linkProp:function(t){return{default:n[t](),onChange:function(n,r){r[e][t](n)},triggerUpdate:!1}},linkMethod:function(t){return function(n){for(var r=n[e],i=arguments.length,s=new Array(i>1?i-1:0),a=1;a=-1&&pc.z<=1&&!0===e.layers.test(r.layers),u=e.element;u.style.display=!0===l?"":"none",!0===l&&(e.onBeforeRender(t,n,r),u.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(pc.x*i+i)+"px,"+(-pc.y*s+s)+"px)",u.parentNode!==o&&o.appendChild(u),e.onAfterRender(t,n,r));const h={distanceToCameraSquared:c(r,e)};a.objects.set(e,h)}for(let t=0,i=e.children.length;t1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e.globe.toGeoCoords(e.renderObjs.cameraPosition());if(void 0===t.lat&&void 0===t.lng&&void 0===t.altitude)return r;var i=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(e){return i[e]=+i[e]}),n){for(;r.lng-i.lng>180;)r.lng-=360;for(;r.lng-i.lng<-180;)r.lng+=360;e.tweenGroup.add(new eh(r).to(i,n).easing(Qc.Cubic.InOut).onUpdate(s).start())}else s(i);return this;function s(t){var n=t.lat,r=t.lng,i=t.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(n,r,i)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i +
+
+
+

Global Threat Map

+

Drag to rotate, scroll to zoom.

+
+ 3D +
+
+
@@ -1470,6 +1480,7 @@ + @@ -1479,6 +1490,7 @@ +