fari
Version:
A lightweight library for creating virtual tours
1,457 lines (1,456 loc) • 1.61 MB
JavaScript
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
/**
* @license
* Copyright 2010-2024 Three.js Authors
* SPDX-License-Identifier: MIT
*/ const $084574008ccedf86$export$3545e07a80636437 = "168";
const $084574008ccedf86$export$7177b3e430c2d7ca = {
LEFT: 0,
MIDDLE: 1,
RIGHT: 2,
ROTATE: 0,
DOLLY: 1,
PAN: 2
};
const $084574008ccedf86$export$d46bd3ead7cc759b = {
ROTATE: 0,
PAN: 1,
DOLLY_PAN: 2,
DOLLY_ROTATE: 3
};
const $084574008ccedf86$export$3237e1f2c1ea1f44 = 0;
const $084574008ccedf86$export$b9a7b4fc5cb15f9b = 1;
const $084574008ccedf86$export$b8058bcc7037d3f3 = 2;
const $084574008ccedf86$export$f24be24dcddeac0d = 3;
const $084574008ccedf86$export$346307dbae2b7447 = 0;
const $084574008ccedf86$export$5813f879eee7cd88 = 1;
const $084574008ccedf86$export$a47c4b43a1be34f0 = 2;
const $084574008ccedf86$export$896ae1ade6c829c4 = 3;
const $084574008ccedf86$export$2ede184fc2998901 = 0;
const $084574008ccedf86$export$d9f0486e75b5ace = 1;
const $084574008ccedf86$export$3b296b6f144d5b03 = 2;
const $084574008ccedf86$export$63b8d6b580fc65ba = 0;
const $084574008ccedf86$export$5b29a26d96ee6af0 = 1;
const $084574008ccedf86$export$777d8f9551c2216b = 2;
const $084574008ccedf86$export$cdfa06f868e2e467 = 3;
const $084574008ccedf86$export$4138e1c684b46a20 = 4;
const $084574008ccedf86$export$eda4864c68df1fa2 = 5;
const $084574008ccedf86$export$20183a0484ce21a0 = 100;
const $084574008ccedf86$export$73e0df5177988548 = 101;
const $084574008ccedf86$export$28e582859cbec660 = 102;
const $084574008ccedf86$export$c8c1508da8d0600c = 103;
const $084574008ccedf86$export$99948c02fb51055f = 104;
const $084574008ccedf86$export$2110f05edf778d3d = 200;
const $084574008ccedf86$export$8805bad65e24940e = 201;
const $084574008ccedf86$export$7fbe15b28d28cf52 = 202;
const $084574008ccedf86$export$947829af9f2c17f6 = 203;
const $084574008ccedf86$export$d5773124e86cf28c = 204;
const $084574008ccedf86$export$11d468cc7f19e971 = 205;
const $084574008ccedf86$export$a78aed1ca2a87192 = 206;
const $084574008ccedf86$export$5d0fe17fd8773bac = 207;
const $084574008ccedf86$export$ef5f2dd8ffac5574 = 208;
const $084574008ccedf86$export$56b85b2686ab16 = 209;
const $084574008ccedf86$export$c05e2a1fc8609506 = 210;
const $084574008ccedf86$export$7dd8f434fd59075 = 211;
const $084574008ccedf86$export$99c8d898a9afbcee = 212;
const $084574008ccedf86$export$310cd2be38d13b56 = 213;
const $084574008ccedf86$export$db77b8fbcf45dbf4 = 214;
const $084574008ccedf86$export$69025ce147cee220 = 0;
const $084574008ccedf86$export$7182eb52ea3b3f04 = 1;
const $084574008ccedf86$export$eedccec66ab7ebe = 2;
const $084574008ccedf86$export$296f78a0b892f81a = 3;
const $084574008ccedf86$export$a60d398fc7b7590e = 4;
const $084574008ccedf86$export$7d7234c1240a1fc4 = 5;
const $084574008ccedf86$export$c5e2c52991f30937 = 6;
const $084574008ccedf86$export$2f843afa843d8916 = 7;
const $084574008ccedf86$export$e50ac29801f1774d = 0;
const $084574008ccedf86$export$9f9d94f963c85479 = 1;
const $084574008ccedf86$export$e641dc52bc3494aa = 2;
const $084574008ccedf86$export$9fcb6b4294603b2 = 0;
const $084574008ccedf86$export$98f52c2a46c598ca = 1;
const $084574008ccedf86$export$74b25e54b3bcd548 = 2;
const $084574008ccedf86$export$932b3dd283d4a366 = 3;
const $084574008ccedf86$export$a0d98fe6d7e4af64 = 4;
const $084574008ccedf86$export$2c7b09c1e9abfb5e = 5;
const $084574008ccedf86$export$212d53a513a325b2 = 6;
const $084574008ccedf86$export$f2863e1668a8e317 = 7;
const $084574008ccedf86$export$2595a3798997538 = "attached";
const $084574008ccedf86$export$d7e7dc2e114517a0 = "detached";
const $084574008ccedf86$export$1beec6768cbb3d2d = 300;
const $084574008ccedf86$export$8759762a6477f2c4 = 301;
const $084574008ccedf86$export$dc59f8aed047f61d = 302;
const $084574008ccedf86$export$d64030b316d3b087 = 303;
const $084574008ccedf86$export$ee99d97d46898098 = 304;
const $084574008ccedf86$export$dbf3e70ff37af79 = 306;
const $084574008ccedf86$export$533346c8e8dac0f5 = 1000;
const $084574008ccedf86$export$9d9334239a5a5e06 = 1001;
const $084574008ccedf86$export$c7e7c00b14f51a4f = 1002;
const $084574008ccedf86$export$727aa5ec3fe39bf0 = 1003;
const $084574008ccedf86$export$d129e38cf6feaa8c = 1004;
const $084574008ccedf86$export$14a4936464a36496 = 1004;
const $084574008ccedf86$export$d2327c1afe5bfdf2 = 1005;
const $084574008ccedf86$export$cbc5b7f5647595d8 = 1005;
const $084574008ccedf86$export$8a72f490b25c56c8 = 1006;
const $084574008ccedf86$export$19a719f377145a13 = 1007;
const $084574008ccedf86$export$dbe96bee3fe9dbf0 = 1007;
const $084574008ccedf86$export$5d8599b6a933fb1b = 1008;
const $084574008ccedf86$export$90d80f1e3506775f = 1008;
const $084574008ccedf86$export$2e8ce08d3f6f5e10 = 1009;
const $084574008ccedf86$export$545fce0311a9796a = 1010;
const $084574008ccedf86$export$88572337f312435f = 1011;
const $084574008ccedf86$export$c63dc51868b06a9d = 1012;
const $084574008ccedf86$export$5c612977753abe2 = 1013;
const $084574008ccedf86$export$c3c7fc4518ebba96 = 1014;
const $084574008ccedf86$export$f6d331659b644596 = 1015;
const $084574008ccedf86$export$2697304443f382bc = 1016;
const $084574008ccedf86$export$b3969b01faf587f2 = 1017;
const $084574008ccedf86$export$18886f8ae33e90de = 1018;
const $084574008ccedf86$export$6c8ea339bfab1301 = 1020;
const $084574008ccedf86$export$5a4c329b7e2092d3 = 35902;
const $084574008ccedf86$export$988473390501ed4b = 1021;
const $084574008ccedf86$export$7c67423a5ee6f5eb = 1022;
const $084574008ccedf86$export$3f8bb04b555a363c = 1023;
const $084574008ccedf86$export$cc09ccbf6d1ed449 = 1024;
const $084574008ccedf86$export$9053a81c4a69c289 = 1025;
const $084574008ccedf86$export$c1b6b5136be58045 = 1026;
const $084574008ccedf86$export$1e113ac2d0905829 = 1027;
const $084574008ccedf86$export$4e041a7967d15c4b = 1028;
const $084574008ccedf86$export$aa92e870a709d190 = 1029;
const $084574008ccedf86$export$6cdf0b461c7ce8a0 = 1030;
const $084574008ccedf86$export$1ba1c45f9f77d4d7 = 1031;
const $084574008ccedf86$export$d1fd40c11bfa798e = 1032;
const $084574008ccedf86$export$c200e7d26f592f21 = 1033;
const $084574008ccedf86$export$21d1799c6d552fc0 = 33776;
const $084574008ccedf86$export$afa304c3e981b668 = 33777;
const $084574008ccedf86$export$d2a1a68024a3e56c = 33778;
const $084574008ccedf86$export$9a79c424327dacf9 = 33779;
const $084574008ccedf86$export$19ada9bbb1af3573 = 35840;
const $084574008ccedf86$export$d0f0355bb3d948e4 = 35841;
const $084574008ccedf86$export$b82296714358084c = 35842;
const $084574008ccedf86$export$b71692456c47b6c3 = 35843;
const $084574008ccedf86$export$6ab91af2d757aee7 = 36196;
const $084574008ccedf86$export$7800993ef8106a6a = 37492;
const $084574008ccedf86$export$23ed8300a860e7d8 = 37496;
const $084574008ccedf86$export$dc5570b4a2b92d48 = 37808;
const $084574008ccedf86$export$68880cd325f8b2fb = 37809;
const $084574008ccedf86$export$7d2c0be323373d95 = 37810;
const $084574008ccedf86$export$22b52da301fc3a3e = 37811;
const $084574008ccedf86$export$c009e2cb4a66485e = 37812;
const $084574008ccedf86$export$118fff5afa255b63 = 37813;
const $084574008ccedf86$export$120713c829ae0667 = 37814;
const $084574008ccedf86$export$c79eeabbf53313e9 = 37815;
const $084574008ccedf86$export$443cf6567cdd6424 = 37816;
const $084574008ccedf86$export$6573984fc9840780 = 37817;
const $084574008ccedf86$export$e7aee563f30091de = 37818;
const $084574008ccedf86$export$2eb8634622ddeab7 = 37819;
const $084574008ccedf86$export$202b1ce7b5d25742 = 37820;
const $084574008ccedf86$export$18ab77abd087e467 = 37821;
const $084574008ccedf86$export$ce40b115e188bc81 = 36492;
const $084574008ccedf86$export$d279c5c4bac5121e = 36494;
const $084574008ccedf86$export$cde52d17225fdbd3 = 36495;
const $084574008ccedf86$export$b1688df4c4c21670 = 36283;
const $084574008ccedf86$export$fc15e5d8261eed58 = 36284;
const $084574008ccedf86$export$d220f6ade8463a0f = 36285;
const $084574008ccedf86$export$768646d09dc1b6ef = 36286;
const $084574008ccedf86$export$d62fdc9d1b1cccad = 2200;
const $084574008ccedf86$export$dfaf4422ce096e29 = 2201;
const $084574008ccedf86$export$f8f6f2041b78e210 = 2202;
const $084574008ccedf86$export$995b32462a65e855 = 2300;
const $084574008ccedf86$export$30fac1aace31cf4d = 2301;
const $084574008ccedf86$export$198b11ff4c72bb30 = 2302;
const $084574008ccedf86$export$7f795934b84ab523 = 2400;
const $084574008ccedf86$export$24a4ccb5099273b5 = 2401;
const $084574008ccedf86$export$8e8c3ecdcd8e1fee = 2402;
const $084574008ccedf86$export$bcfbbdcf8de7f8cd = 2500;
const $084574008ccedf86$export$d875e029ef558d3 = 2501;
const $084574008ccedf86$export$4c28c87c2dc84758 = 0;
const $084574008ccedf86$export$b23a071aa286eb29 = 1;
const $084574008ccedf86$export$f0d8293634f88842 = 2;
const $084574008ccedf86$export$deeb383078690b50 = 3200;
const $084574008ccedf86$export$8f910f4c4f73df11 = 3201;
const $084574008ccedf86$export$be2e2ddbc3983173 = 3202;
const $084574008ccedf86$export$1a54198784742f80 = 3203;
const $084574008ccedf86$export$2852a58ebdac27b8 = 0;
const $084574008ccedf86$export$9990ad26f9db5b2c = 1;
// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.
const $084574008ccedf86$export$bfcb490c2dd3db51 = "";
const $084574008ccedf86$export$561f394b24edfcaa = "srgb";
const $084574008ccedf86$export$42429b3acfb233a4 = "srgb-linear";
const $084574008ccedf86$export$626af19ae879bdf6 = "display-p3";
const $084574008ccedf86$export$c0dc1bc7e964761 = "display-p3-linear";
const $084574008ccedf86$export$f197347d588c1b4a = "linear";
const $084574008ccedf86$export$8d0a61916cc26abb = "srgb";
const $084574008ccedf86$export$ce9118f9eaae3bb2 = "rec709";
const $084574008ccedf86$export$ef371755dbe7f98a = "p3";
const $084574008ccedf86$export$69433f11f42d5527 = 0;
const $084574008ccedf86$export$9f542ae4b5baca34 = 7680;
const $084574008ccedf86$export$8a4f28336ef203d3 = 7681;
const $084574008ccedf86$export$2928c0231297c036 = 7682;
const $084574008ccedf86$export$c0e9611c8a15f9a8 = 7683;
const $084574008ccedf86$export$9c2c08927385dcc4 = 34055;
const $084574008ccedf86$export$7c74ea00fa1315e6 = 34056;
const $084574008ccedf86$export$22e2e5726612443 = 5386;
const $084574008ccedf86$export$1343870698229224 = 512;
const $084574008ccedf86$export$8e1d8ed281997fa6 = 513;
const $084574008ccedf86$export$55648a1cde8329a7 = 514;
const $084574008ccedf86$export$2dff107857e6aca2 = 515;
const $084574008ccedf86$export$6f93765ab2f451a2 = 516;
const $084574008ccedf86$export$6f3fb2d2440f2b76 = 517;
const $084574008ccedf86$export$4119cf7b4c98fd5a = 518;
const $084574008ccedf86$export$14cf96713ddd97a8 = 519;
const $084574008ccedf86$export$d9e2d19a747baaab = 512;
const $084574008ccedf86$export$36bcf49c713b3eb7 = 513;
const $084574008ccedf86$export$66f28d946fc6a0d5 = 514;
const $084574008ccedf86$export$64eea11eb407ddf1 = 515;
const $084574008ccedf86$export$155af022118f3a38 = 516;
const $084574008ccedf86$export$67ab95dde6bed156 = 517;
const $084574008ccedf86$export$1cdcb70d53d65f61 = 518;
const $084574008ccedf86$export$187b73a3e352c145 = 519;
const $084574008ccedf86$export$763e8360f4d7f77d = 35044;
const $084574008ccedf86$export$8505d14ac8546ca = 35048;
const $084574008ccedf86$export$721e63549e51d81e = 35040;
const $084574008ccedf86$export$415731dc4f48e299 = 35045;
const $084574008ccedf86$export$9e809946455f13bc = 35049;
const $084574008ccedf86$export$2ed9499a35b5f832 = 35041;
const $084574008ccedf86$export$32ab2503ea19469a = 35046;
const $084574008ccedf86$export$ab4022c2c3f86315 = 35050;
const $084574008ccedf86$export$ba7f1db36a76a970 = 35042;
const $084574008ccedf86$export$43600cc67fabd9f = "100";
const $084574008ccedf86$export$f63012db5506e7dd = "300 es";
const $084574008ccedf86$export$5a0e9190d10875d3 = 2000;
const $084574008ccedf86$export$cc83beedcb9be9ac = 2001;
/**
* https://github.com/mrdoob/eventdispatcher.js/
*/ class $084574008ccedf86$export$ec8b666c5fe2c75a {
addEventListener(type, listener) {
if (this._listeners === undefined) this._listeners = {};
const listeners = this._listeners;
if (listeners[type] === undefined) listeners[type] = [];
if (listeners[type].indexOf(listener) === -1) listeners[type].push(listener);
}
hasEventListener(type, listener) {
if (this._listeners === undefined) return false;
const listeners = this._listeners;
return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;
}
removeEventListener(type, listener) {
if (this._listeners === undefined) return;
const listeners = this._listeners;
const listenerArray = listeners[type];
if (listenerArray !== undefined) {
const index = listenerArray.indexOf(listener);
if (index !== -1) listenerArray.splice(index, 1);
}
}
dispatchEvent(event) {
if (this._listeners === undefined) return;
const listeners = this._listeners;
const listenerArray = listeners[event.type];
if (listenerArray !== undefined) {
event.target = this;
// Make a copy, in case listeners are removed while iterating.
const array = listenerArray.slice(0);
for(let i = 0, l = array.length; i < l; i++)array[i].call(this, event);
event.target = null;
}
}
}
const $084574008ccedf86$var$_lut = [
"00",
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"0a",
"0b",
"0c",
"0d",
"0e",
"0f",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"1a",
"1b",
"1c",
"1d",
"1e",
"1f",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"2a",
"2b",
"2c",
"2d",
"2e",
"2f",
"30",
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"3a",
"3b",
"3c",
"3d",
"3e",
"3f",
"40",
"41",
"42",
"43",
"44",
"45",
"46",
"47",
"48",
"49",
"4a",
"4b",
"4c",
"4d",
"4e",
"4f",
"50",
"51",
"52",
"53",
"54",
"55",
"56",
"57",
"58",
"59",
"5a",
"5b",
"5c",
"5d",
"5e",
"5f",
"60",
"61",
"62",
"63",
"64",
"65",
"66",
"67",
"68",
"69",
"6a",
"6b",
"6c",
"6d",
"6e",
"6f",
"70",
"71",
"72",
"73",
"74",
"75",
"76",
"77",
"78",
"79",
"7a",
"7b",
"7c",
"7d",
"7e",
"7f",
"80",
"81",
"82",
"83",
"84",
"85",
"86",
"87",
"88",
"89",
"8a",
"8b",
"8c",
"8d",
"8e",
"8f",
"90",
"91",
"92",
"93",
"94",
"95",
"96",
"97",
"98",
"99",
"9a",
"9b",
"9c",
"9d",
"9e",
"9f",
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"aa",
"ab",
"ac",
"ad",
"ae",
"af",
"b0",
"b1",
"b2",
"b3",
"b4",
"b5",
"b6",
"b7",
"b8",
"b9",
"ba",
"bb",
"bc",
"bd",
"be",
"bf",
"c0",
"c1",
"c2",
"c3",
"c4",
"c5",
"c6",
"c7",
"c8",
"c9",
"ca",
"cb",
"cc",
"cd",
"ce",
"cf",
"d0",
"d1",
"d2",
"d3",
"d4",
"d5",
"d6",
"d7",
"d8",
"d9",
"da",
"db",
"dc",
"dd",
"de",
"df",
"e0",
"e1",
"e2",
"e3",
"e4",
"e5",
"e6",
"e7",
"e8",
"e9",
"ea",
"eb",
"ec",
"ed",
"ee",
"ef",
"f0",
"f1",
"f2",
"f3",
"f4",
"f5",
"f6",
"f7",
"f8",
"f9",
"fa",
"fb",
"fc",
"fd",
"fe",
"ff"
];
let $084574008ccedf86$var$_seed = 1234567;
const $084574008ccedf86$var$DEG2RAD = Math.PI / 180;
const $084574008ccedf86$var$RAD2DEG = 180 / Math.PI;
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
function $084574008ccedf86$var$generateUUID() {
const d0 = Math.random() * 0xffffffff | 0;
const d1 = Math.random() * 0xffffffff | 0;
const d2 = Math.random() * 0xffffffff | 0;
const d3 = Math.random() * 0xffffffff | 0;
const uuid = $084574008ccedf86$var$_lut[d0 & 0xff] + $084574008ccedf86$var$_lut[d0 >> 8 & 0xff] + $084574008ccedf86$var$_lut[d0 >> 16 & 0xff] + $084574008ccedf86$var$_lut[d0 >> 24 & 0xff] + "-" + $084574008ccedf86$var$_lut[d1 & 0xff] + $084574008ccedf86$var$_lut[d1 >> 8 & 0xff] + "-" + $084574008ccedf86$var$_lut[d1 >> 16 & 0x0f | 0x40] + $084574008ccedf86$var$_lut[d1 >> 24 & 0xff] + "-" + $084574008ccedf86$var$_lut[d2 & 0x3f | 0x80] + $084574008ccedf86$var$_lut[d2 >> 8 & 0xff] + "-" + $084574008ccedf86$var$_lut[d2 >> 16 & 0xff] + $084574008ccedf86$var$_lut[d2 >> 24 & 0xff] + $084574008ccedf86$var$_lut[d3 & 0xff] + $084574008ccedf86$var$_lut[d3 >> 8 & 0xff] + $084574008ccedf86$var$_lut[d3 >> 16 & 0xff] + $084574008ccedf86$var$_lut[d3 >> 24 & 0xff];
// .toLowerCase() here flattens concatenated strings to save heap memory space.
return uuid.toLowerCase();
}
function $084574008ccedf86$var$clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
// compute euclidean modulo of m % n
// https://en.wikipedia.org/wiki/Modulo_operation
function $084574008ccedf86$var$euclideanModulo(n, m) {
return (n % m + m) % m;
}
// Linear mapping from range <a1, a2> to range <b1, b2>
function $084574008ccedf86$var$mapLinear(x, a1, a2, b1, b2) {
return b1 + (x - a1) * (b2 - b1) / (a2 - a1);
}
// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
function $084574008ccedf86$var$inverseLerp(x, y, value) {
if (x !== y) return (value - x) / (y - x);
else return 0;
}
// https://en.wikipedia.org/wiki/Linear_interpolation
function $084574008ccedf86$var$lerp(x, y, t) {
return (1 - t) * x + t * y;
}
// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
function $084574008ccedf86$var$damp(x, y, lambda, dt) {
return $084574008ccedf86$var$lerp(x, y, 1 - Math.exp(-lambda * dt));
}
// https://www.desmos.com/calculator/vcsjnyz7x4
function $084574008ccedf86$var$pingpong(x, length = 1) {
return length - Math.abs($084574008ccedf86$var$euclideanModulo(x, length * 2) - length);
}
// http://en.wikipedia.org/wiki/Smoothstep
function $084574008ccedf86$var$smoothstep(x, min, max) {
if (x <= min) return 0;
if (x >= max) return 1;
x = (x - min) / (max - min);
return x * x * (3 - 2 * x);
}
function $084574008ccedf86$var$smootherstep(x, min, max) {
if (x <= min) return 0;
if (x >= max) return 1;
x = (x - min) / (max - min);
return x * x * x * (x * (x * 6 - 15) + 10);
}
// Random integer from <low, high> interval
function $084574008ccedf86$var$randInt(low, high) {
return low + Math.floor(Math.random() * (high - low + 1));
}
// Random float from <low, high> interval
function $084574008ccedf86$var$randFloat(low, high) {
return low + Math.random() * (high - low);
}
// Random float from <-range/2, range/2> interval
function $084574008ccedf86$var$randFloatSpread(range) {
return range * (0.5 - Math.random());
}
// Deterministic pseudo-random float in the interval [ 0, 1 ]
function $084574008ccedf86$var$seededRandom(s) {
if (s !== undefined) $084574008ccedf86$var$_seed = s;
// Mulberry32 generator
let t = $084574008ccedf86$var$_seed += 0x6D2B79F5;
t = Math.imul(t ^ t >>> 15, t | 1);
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
return ((t ^ t >>> 14) >>> 0) / 4294967296;
}
function $084574008ccedf86$var$degToRad(degrees) {
return degrees * $084574008ccedf86$var$DEG2RAD;
}
function $084574008ccedf86$var$radToDeg(radians) {
return radians * $084574008ccedf86$var$RAD2DEG;
}
function $084574008ccedf86$var$isPowerOfTwo(value) {
return (value & value - 1) === 0 && value !== 0;
}
function $084574008ccedf86$var$ceilPowerOfTwo(value) {
return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));
}
function $084574008ccedf86$var$floorPowerOfTwo(value) {
return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));
}
function $084574008ccedf86$var$setQuaternionFromProperEuler(q, a, b, c, order) {
// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
// rotations are applied to the axes in the order specified by 'order'
// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
// angles are in radians
const cos = Math.cos;
const sin = Math.sin;
const c2 = cos(b / 2);
const s2 = sin(b / 2);
const c13 = cos((a + c) / 2);
const s13 = sin((a + c) / 2);
const c1_3 = cos((a - c) / 2);
const s1_3 = sin((a - c) / 2);
const c3_1 = cos((c - a) / 2);
const s3_1 = sin((c - a) / 2);
switch(order){
case "XYX":
q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);
break;
case "YZY":
q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);
break;
case "ZXZ":
q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);
break;
case "XZX":
q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);
break;
case "YXY":
q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);
break;
case "ZYZ":
q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);
break;
default:
console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + order);
}
}
function $084574008ccedf86$var$denormalize(value, array) {
switch(array.constructor){
case Float32Array:
return value;
case Uint32Array:
return value / 4294967295.0;
case Uint16Array:
return value / 65535.0;
case Uint8Array:
return value / 255.0;
case Int32Array:
return Math.max(value / 2147483647.0, -1);
case Int16Array:
return Math.max(value / 32767.0, -1);
case Int8Array:
return Math.max(value / 127.0, -1);
default:
throw new Error("Invalid component type.");
}
}
function $084574008ccedf86$var$normalize(value, array) {
switch(array.constructor){
case Float32Array:
return value;
case Uint32Array:
return Math.round(value * 4294967295.0);
case Uint16Array:
return Math.round(value * 65535.0);
case Uint8Array:
return Math.round(value * 255.0);
case Int32Array:
return Math.round(value * 2147483647.0);
case Int16Array:
return Math.round(value * 32767.0);
case Int8Array:
return Math.round(value * 127.0);
default:
throw new Error("Invalid component type.");
}
}
const $084574008ccedf86$export$6a7ef315a0d1ef07 = {
DEG2RAD: $084574008ccedf86$var$DEG2RAD,
RAD2DEG: $084574008ccedf86$var$RAD2DEG,
generateUUID: $084574008ccedf86$var$generateUUID,
clamp: $084574008ccedf86$var$clamp,
euclideanModulo: $084574008ccedf86$var$euclideanModulo,
mapLinear: $084574008ccedf86$var$mapLinear,
inverseLerp: $084574008ccedf86$var$inverseLerp,
lerp: $084574008ccedf86$var$lerp,
damp: $084574008ccedf86$var$damp,
pingpong: $084574008ccedf86$var$pingpong,
smoothstep: $084574008ccedf86$var$smoothstep,
smootherstep: $084574008ccedf86$var$smootherstep,
randInt: $084574008ccedf86$var$randInt,
randFloat: $084574008ccedf86$var$randFloat,
randFloatSpread: $084574008ccedf86$var$randFloatSpread,
seededRandom: $084574008ccedf86$var$seededRandom,
degToRad: $084574008ccedf86$var$degToRad,
radToDeg: $084574008ccedf86$var$radToDeg,
isPowerOfTwo: $084574008ccedf86$var$isPowerOfTwo,
ceilPowerOfTwo: $084574008ccedf86$var$ceilPowerOfTwo,
floorPowerOfTwo: $084574008ccedf86$var$floorPowerOfTwo,
setQuaternionFromProperEuler: $084574008ccedf86$var$setQuaternionFromProperEuler,
normalize: $084574008ccedf86$var$normalize,
denormalize: $084574008ccedf86$var$denormalize
};
class $084574008ccedf86$export$c977b3e384af9ae1 {
constructor(x = 0, y = 0){
$084574008ccedf86$export$c977b3e384af9ae1.prototype.isVector2 = true;
this.x = x;
this.y = y;
}
get width() {
return this.x;
}
set width(value) {
this.x = value;
}
get height() {
return this.y;
}
set height(value) {
this.y = value;
}
set(x, y) {
this.x = x;
this.y = y;
return this;
}
setScalar(scalar) {
this.x = scalar;
this.y = scalar;
return this;
}
setX(x) {
this.x = x;
return this;
}
setY(y) {
this.y = y;
return this;
}
setComponent(index, value) {
switch(index){
case 0:
this.x = value;
break;
case 1:
this.y = value;
break;
default:
throw new Error("index is out of range: " + index);
}
return this;
}
getComponent(index) {
switch(index){
case 0:
return this.x;
case 1:
return this.y;
default:
throw new Error("index is out of range: " + index);
}
}
clone() {
return new this.constructor(this.x, this.y);
}
copy(v) {
this.x = v.x;
this.y = v.y;
return this;
}
add(v) {
this.x += v.x;
this.y += v.y;
return this;
}
addScalar(s) {
this.x += s;
this.y += s;
return this;
}
addVectors(a, b) {
this.x = a.x + b.x;
this.y = a.y + b.y;
return this;
}
addScaledVector(v, s) {
this.x += v.x * s;
this.y += v.y * s;
return this;
}
sub(v) {
this.x -= v.x;
this.y -= v.y;
return this;
}
subScalar(s) {
this.x -= s;
this.y -= s;
return this;
}
subVectors(a, b) {
this.x = a.x - b.x;
this.y = a.y - b.y;
return this;
}
multiply(v) {
this.x *= v.x;
this.y *= v.y;
return this;
}
multiplyScalar(scalar) {
this.x *= scalar;
this.y *= scalar;
return this;
}
divide(v) {
this.x /= v.x;
this.y /= v.y;
return this;
}
divideScalar(scalar) {
return this.multiplyScalar(1 / scalar);
}
applyMatrix3(m) {
const x = this.x, y = this.y;
const e = m.elements;
this.x = e[0] * x + e[3] * y + e[6];
this.y = e[1] * x + e[4] * y + e[7];
return this;
}
min(v) {
this.x = Math.min(this.x, v.x);
this.y = Math.min(this.y, v.y);
return this;
}
max(v) {
this.x = Math.max(this.x, v.x);
this.y = Math.max(this.y, v.y);
return this;
}
clamp(min, max) {
// assumes min < max, componentwise
this.x = Math.max(min.x, Math.min(max.x, this.x));
this.y = Math.max(min.y, Math.min(max.y, this.y));
return this;
}
clampScalar(minVal, maxVal) {
this.x = Math.max(minVal, Math.min(maxVal, this.x));
this.y = Math.max(minVal, Math.min(maxVal, this.y));
return this;
}
clampLength(min, max) {
const length = this.length();
return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
}
floor() {
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
return this;
}
ceil() {
this.x = Math.ceil(this.x);
this.y = Math.ceil(this.y);
return this;
}
round() {
this.x = Math.round(this.x);
this.y = Math.round(this.y);
return this;
}
roundToZero() {
this.x = Math.trunc(this.x);
this.y = Math.trunc(this.y);
return this;
}
negate() {
this.x = -this.x;
this.y = -this.y;
return this;
}
dot(v) {
return this.x * v.x + this.y * v.y;
}
cross(v) {
return this.x * v.y - this.y * v.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() {
// computes the angle in radians with respect to the positive x-axis
const angle = Math.atan2(-this.y, -this.x) + Math.PI;
return angle;
}
angleTo(v) {
const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
if (denominator === 0) return Math.PI / 2;
const theta = this.dot(v) / denominator;
// clamp, to handle numerical problems
return Math.acos($084574008ccedf86$var$clamp(theta, -1, 1));
}
distanceTo(v) {
return Math.sqrt(this.distanceToSquared(v));
}
distanceToSquared(v) {
const dx = this.x - v.x, dy = this.y - v.y;
return dx * dx + dy * dy;
}
manhattanDistanceTo(v) {
return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);
}
setLength(length) {
return this.normalize().multiplyScalar(length);
}
lerp(v, alpha) {
this.x += (v.x - this.x) * alpha;
this.y += (v.y - this.y) * alpha;
return this;
}
lerpVectors(v1, v2, alpha) {
this.x = v1.x + (v2.x - v1.x) * alpha;
this.y = v1.y + (v2.y - v1.y) * alpha;
return this;
}
equals(v) {
return v.x === this.x && v.y === this.y;
}
fromArray(array, offset = 0) {
this.x = array[offset];
this.y = array[offset + 1];
return this;
}
toArray(array = [], offset = 0) {
array[offset] = this.x;
array[offset + 1] = this.y;
return array;
}
fromBufferAttribute(attribute, index) {
this.x = attribute.getX(index);
this.y = attribute.getY(index);
return this;
}
rotateAround(center, angle) {
const c = Math.cos(angle), s = Math.sin(angle);
const x = this.x - center.x;
const y = this.y - center.y;
this.x = x * c - y * s + center.x;
this.y = x * s + y * c + center.y;
return this;
}
random() {
this.x = Math.random();
this.y = Math.random();
return this;
}
*[Symbol.iterator]() {
yield this.x;
yield this.y;
}
}
class $084574008ccedf86$export$8ff26dafa08918 {
constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33){
$084574008ccedf86$export$8ff26dafa08918.prototype.isMatrix3 = true;
this.elements = [
1,
0,
0,
0,
1,
0,
0,
0,
1
];
if (n11 !== undefined) this.set(n11, n12, n13, n21, n22, n23, n31, n32, n33);
}
set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
const te = this.elements;
te[0] = n11;
te[1] = n21;
te[2] = n31;
te[3] = n12;
te[4] = n22;
te[5] = n32;
te[6] = n13;
te[7] = n23;
te[8] = n33;
return this;
}
identity() {
this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);
return this;
}
copy(m) {
const te = this.elements;
const me = m.elements;
te[0] = me[0];
te[1] = me[1];
te[2] = me[2];
te[3] = me[3];
te[4] = me[4];
te[5] = me[5];
te[6] = me[6];
te[7] = me[7];
te[8] = me[8];
return this;
}
extractBasis(xAxis, yAxis, zAxis) {
xAxis.setFromMatrix3Column(this, 0);
yAxis.setFromMatrix3Column(this, 1);
zAxis.setFromMatrix3Column(this, 2);
return this;
}
setFromMatrix4(m) {
const me = m.elements;
this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);
return this;
}
multiply(m) {
return this.multiplyMatrices(this, m);
}
premultiply(m) {
return this.multiplyMatrices(m, this);
}
multiplyMatrices(a, b) {
const ae = a.elements;
const be = b.elements;
const te = this.elements;
const a11 = ae[0], a12 = ae[3], a13 = ae[6];
const a21 = ae[1], a22 = ae[4], a23 = ae[7];
const a31 = ae[2], a32 = ae[5], a33 = ae[8];
const b11 = be[0], b12 = be[3], b13 = be[6];
const b21 = be[1], b22 = be[4], b23 = be[7];
const b31 = be[2], b32 = be[5], b33 = be[8];
te[0] = a11 * b11 + a12 * b21 + a13 * b31;
te[3] = a11 * b12 + a12 * b22 + a13 * b32;
te[6] = a11 * b13 + a12 * b23 + a13 * b33;
te[1] = a21 * b11 + a22 * b21 + a23 * b31;
te[4] = a21 * b12 + a22 * b22 + a23 * b32;
te[7] = a21 * b13 + a22 * b23 + a23 * b33;
te[2] = a31 * b11 + a32 * b21 + a33 * b31;
te[5] = a31 * b12 + a32 * b22 + a33 * b32;
te[8] = a31 * b13 + a32 * b23 + a33 * b33;
return this;
}
multiplyScalar(s) {
const te = this.elements;
te[0] *= s;
te[3] *= s;
te[6] *= s;
te[1] *= s;
te[4] *= s;
te[7] *= s;
te[2] *= s;
te[5] *= s;
te[8] *= s;
return this;
}
determinant() {
const te = this.elements;
const a = te[0], b = te[1], c = te[2], d = te[3], e = te[4], f = te[5], g = te[6], h = te[7], i = te[8];
return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;
}
invert() {
const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n12 = te[3], n22 = te[4], n32 = te[5], n13 = te[6], n23 = te[7], n33 = te[8], t11 = n33 * n22 - n32 * n23, t12 = n32 * n13 - n33 * n12, t13 = n23 * n12 - n22 * n13, det = n11 * t11 + n21 * t12 + n31 * t13;
if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
const detInv = 1 / det;
te[0] = t11 * detInv;
te[1] = (n31 * n23 - n33 * n21) * detInv;
te[2] = (n32 * n21 - n31 * n22) * detInv;
te[3] = t12 * detInv;
te[4] = (n33 * n11 - n31 * n13) * detInv;
te[5] = (n31 * n12 - n32 * n11) * detInv;
te[6] = t13 * detInv;
te[7] = (n21 * n13 - n23 * n11) * detInv;
te[8] = (n22 * n11 - n21 * n12) * detInv;
return this;
}
transpose() {
let tmp;
const m = this.elements;
tmp = m[1];
m[1] = m[3];
m[3] = tmp;
tmp = m[2];
m[2] = m[6];
m[6] = tmp;
tmp = m[5];
m[5] = m[7];
m[7] = tmp;
return this;
}
getNormalMatrix(matrix4) {
return this.setFromMatrix4(matrix4).invert().transpose();
}
transposeIntoArray(r) {
const m = this.elements;
r[0] = m[0];
r[1] = m[3];
r[2] = m[6];
r[3] = m[1];
r[4] = m[4];
r[5] = m[7];
r[6] = m[2];
r[7] = m[5];
r[8] = m[8];
return this;
}
setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {
const c = Math.cos(rotation);
const s = Math.sin(rotation);
this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);
return this;
}
//
scale(sx, sy) {
this.premultiply($084574008ccedf86$var$_m3.makeScale(sx, sy));
return this;
}
rotate(theta) {
this.premultiply($084574008ccedf86$var$_m3.makeRotation(-theta));
return this;
}
translate(tx, ty) {
this.premultiply($084574008ccedf86$var$_m3.makeTranslation(tx, ty));
return this;
}
// for 2D Transforms
makeTranslation(x, y) {
if (x.isVector2) this.set(1, 0, x.x, 0, 1, x.y, 0, 0, 1);
else this.set(1, 0, x, 0, 1, y, 0, 0, 1);
return this;
}
makeRotation(theta) {
// counterclockwise
const c = Math.cos(theta);
const s = Math.sin(theta);
this.set(c, -s, 0, s, c, 0, 0, 0, 1);
return this;
}
makeScale(x, y) {
this.set(x, 0, 0, 0, y, 0, 0, 0, 1);
return this;
}
//
equals(matrix) {
const te = this.elements;
const me = matrix.elements;
for(let i = 0; i < 9; i++){
if (te[i] !== me[i]) return false;
}
return true;
}
fromArray(array, offset = 0) {
for(let i = 0; i < 9; i++)this.elements[i] = array[i + offset];
return this;
}
toArray(array = [], offset = 0) {
const te = this.elements;
array[offset] = te[0];
array[offset + 1] = te[1];
array[offset + 2] = te[2];
array[offset + 3] = te[3];
array[offset + 4] = te[4];
array[offset + 5] = te[5];
array[offset + 6] = te[6];
array[offset + 7] = te[7];
array[offset + 8] = te[8];
return array;
}
clone() {
return new this.constructor().fromArray(this.elements);
}
}
const $084574008ccedf86$var$_m3 = /*@__PURE__*/ new $084574008ccedf86$export$8ff26dafa08918();
function $084574008ccedf86$var$arrayNeedsUint32(array) {
// assumes larger values usually on last
for(let i = array.length - 1; i >= 0; --i){
if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
}
return false;
}
const $084574008ccedf86$var$TYPED_ARRAYS = {
Int8Array: Int8Array,
Uint8Array: Uint8Array,
Uint8ClampedArray: Uint8ClampedArray,
Int16Array: Int16Array,
Uint16Array: Uint16Array,
Int32Array: Int32Array,
Uint32Array: Uint32Array,
Float32Array: Float32Array,
Float64Array: Float64Array
};
function $084574008ccedf86$var$getTypedArray(type, buffer) {
return new $084574008ccedf86$var$TYPED_ARRAYS[type](buffer);
}
function $084574008ccedf86$var$createElementNS(name) {
return document.createElementNS("http://www.w3.org/1999/xhtml", name);
}
function $084574008ccedf86$export$1033a2df66368859() {
const canvas = $084574008ccedf86$var$createElementNS("canvas");
canvas.style.display = "block";
return canvas;
}
const $084574008ccedf86$var$_cache = {};
function $084574008ccedf86$var$warnOnce(message) {
if (message in $084574008ccedf86$var$_cache) return;
$084574008ccedf86$var$_cache[message] = true;
console.warn(message);
}
function $084574008ccedf86$var$probeAsync(gl, sync, interval) {
return new Promise(function(resolve, reject) {
function probe() {
switch(gl.clientWaitSync(sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0)){
case gl.WAIT_FAILED:
reject();
break;
case gl.TIMEOUT_EXPIRED:
setTimeout(probe, interval);
break;
default:
resolve();
}
}
setTimeout(probe, interval);
});
}
/**
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
* or clipping. Based on W3C specifications for sRGB and Display P3,
* and ICC specifications for the D50 connection space. Values in/out
* are _linear_ sRGB and _linear_ Display P3.
*
* Note that both sRGB and Display P3 use the sRGB transfer functions.
*
* Reference:
* - http://www.russellcottrell.com/photo/matrixCalculator.htm
*/ const $084574008ccedf86$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new $084574008ccedf86$export$8ff26dafa08918().set(0.8224621, 0.177538, 0.0, 0.0331941, 0.9668058, 0.0, 0.0170827, 0.0723974, 0.9105199);
const $084574008ccedf86$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new $084574008ccedf86$export$8ff26dafa08918().set(1.2249401, -0.2249404, 0.0, -0.0420569, 1.0420571, 0.0, -0.0196376, -0.0786361, 1.0982735);
/**
* Defines supported color spaces by transfer function and primaries,
* and provides conversions to/from the Linear-sRGB reference space.
*/ const $084574008ccedf86$var$COLOR_SPACES = {
[$084574008ccedf86$export$42429b3acfb233a4]: {
transfer: $084574008ccedf86$export$f197347d588c1b4a,
primaries: $084574008ccedf86$export$ce9118f9eaae3bb2,
luminanceCoefficients: [
0.2126,
0.7152,
0.0722
],
toReference: (color)=>color,
fromReference: (color)=>color
},
[$084574008ccedf86$export$561f394b24edfcaa]: {
transfer: $084574008ccedf86$export$8d0a61916cc26abb,
primaries: $084574008ccedf86$export$ce9118f9eaae3bb2,
luminanceCoefficients: [
0.2126,
0.7152,
0.0722
],
toReference: (color)=>color.convertSRGBToLinear(),
fromReference: (color)=>color.convertLinearToSRGB()
},
[$084574008ccedf86$export$c0dc1bc7e964761]: {
transfer: $084574008ccedf86$export$f197347d588c1b4a,
primaries: $084574008ccedf86$export$ef371755dbe7f98a,
luminanceCoefficients: [
0.2289,
0.6917,
0.0793
],
toReference: (color)=>color.applyMatrix3($084574008ccedf86$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB),
fromReference: (color)=>color.applyMatrix3($084574008ccedf86$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3)
},
[$084574008ccedf86$export$626af19ae879bdf6]: {
transfer: $084574008ccedf86$export$8d0a61916cc26abb,
primaries: $084574008ccedf86$export$ef371755dbe7f98a,
luminanceCoefficients: [
0.2289,
0.6917,
0.0793
],
toReference: (color)=>color.convertSRGBToLinear().applyMatrix3($084574008ccedf86$var$LINEAR_DISPLAY_P3_TO_LINEAR_SRGB),
fromReference: (color)=>color.applyMatrix3($084574008ccedf86$var$LINEAR_SRGB_TO_LINEAR_DISPLAY_P3).convertLinearToSRGB()
}
};
const $084574008ccedf86$var$SUPPORTED_WORKING_COLOR_SPACES = new Set([
$084574008ccedf86$export$42429b3acfb233a4,
$084574008ccedf86$export$c0dc1bc7e964761
]);
const $084574008ccedf86$export$5e6fd513f44698c = {
enabled: true,
_workingColorSpace: $084574008ccedf86$export$42429b3acfb233a4,
get workingColorSpace () {
return this._workingColorSpace;
},
set workingColorSpace (colorSpace){
if (!$084574008ccedf86$var$SUPPORTED_WORKING_COLOR_SPACES.has(colorSpace)) throw new Error(`Unsupported working color space, "${colorSpace}".`);
this._workingColorSpace = colorSpace;
},
convert: function(color, sourceColorSpace, targetColorSpace) {
if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) return color;
const sourceToReference = $084574008ccedf86$var$COLOR_SPACES[sourceColorSpace].toReference;
const targetFromReference = $084574008ccedf86$var$COLOR_SPACES[targetColorSpace].fromReference;
return targetFromReference(sourceToReference(color));
},
fromWorkingColorSpace: function(color, targetColorSpace) {
return this.convert(color, this._workingColorSpace, targetColorSpace);
},
toWorkingColorSpace: function(color, sourceColorSpace) {
return this.convert(color, sourceColorSpace, this._workingColorSpace);
},
getPrimaries: function(colorSpace1) {
return $084574008ccedf86$var$COLOR_SPACES[colorSpace1].primaries;
},
getTransfer: function(colorSpace1) {
if (colorSpace1 === $084574008ccedf86$export$bfcb490c2dd3db51) return $084574008ccedf86$export$f197347d588c1b4a;
return $084574008ccedf86$var$COLOR_SPACES[colorSpace1].transfer;
},
getLuminanceCoefficients: function(target, colorSpace1 = this._workingColorSpace) {
return target.fromArray($084574008ccedf86$var$COLOR_SPACES[colorSpace1].luminanceCoefficients);
}
};
function $084574008ccedf86$var$SRGBToLinear(c) {
return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
}
function $084574008ccedf86$var$LinearToSRGB(c) {
return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;
}
let $084574008ccedf86$var$_canvas;
class $084574008ccedf86$export$698882cf06df44aa {
static getDataURL(image) {
if (/^data:/i.test(image.src)) return image.src;
if (typeof HTMLCanvasElement === "undefined") return image.src;
let canvas;
if (image instanceof HTMLCanvasElement) canvas = image;
else {
if ($084574008ccedf86$var$_canvas === undefined) $084574008ccedf86$var$_canvas = $084574008ccedf86$var$createElementNS("canvas");
$084574008ccedf86$var$_canvas.width = image.width;
$084574008ccedf86$var$_canvas.height = image.height;
const context = $084574008ccedf86$var$_canvas.getContext("2d");
if (image instanceof ImageData) context.putImageData(image, 0, 0);
else context.drawImage(image, 0, 0, image.width, image.height);
canvas = $084574008ccedf86$var$_canvas;
}
if (canvas.width > 2048 || canvas.height > 2048) {
console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", image);
return canvas.toDataURL("image/jpeg", 0.6);
} else return canvas.toDataURL("image/png");
}
static sRGBToLinear(image) {
if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) {
const canvas = $084574008ccedf86$var$createElementNS("canvas");
canvas.width = image.width;
canvas.height = image.height;
const context = canvas.getContext("2d");
context.drawImage(image, 0, 0, image.width, image.height);
const imageData = context.getImageData(0, 0, image.width, image.height);
const data = imageData.data;
for(let i = 0; i < data.length; i++)data[i] = $084574008ccedf86$var$SRGBToLinear(data[i] / 255) * 255;
context.putImageData(imageData, 0, 0);
return canvas;
} else if (image.data) {
const data = image.data.slice(0);
for(let i = 0; i < data.length; i++)if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) data[i] = Math.floor($084574008ccedf86$var$SRGBToLinear(data[i] / 255) * 255);
else // assuming float
data[i] = $084574008ccedf86$var$SRGBToLinear(data[i]);
return {
data: data,
width: image.width,
height: image.height
};
} else {
console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.");
return image;
}
}
}
let $084574008ccedf86$var$_sourceId = 0;
class $084574008ccedf86$export$1d2df86270c81ecb {
constructor(data = null){
this.isSource = true;
Object.defineProperty(this, "id", {
value: $084574008ccedf86$var$_sourceId++
});
this.uuid = $084574008ccedf86$var$generateUUID();
this.data = data;
this.dataReady = true;
this.version = 0;
}
set needsUpdate(value) {
if (value === true) this.version++;
}
toJSON(meta) {
const isRootObject = meta === undefined || typeof meta === "string";
if (!isRootObject && meta.images[this.uuid] !== undefined) return meta.images[this.uuid];
const output = {
uuid: this.uuid,
url: ""
};
const data = this.data;
if (data !== null) {
let url;
if (Array.isArray(data)) {
// cube texture
url = [];
for(let i = 0, l = data.length; i < l; i++)if (data[i].isDataTexture) url.push($084574008ccedf86$var$serializeImage(data[i].image));
else url.push($084574008ccedf86$var$serializeImage(data[i]));
} else // texture
url = $084574008ccedf86$var$serializeImage(data);
output.url = url;
}
if (!isRootObject) meta.images[this.uuid] = output;
return output;
}
}
function $084574008ccedf86$var$serializeImage(image) {
if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) // default images
return $084574008ccedf86$export$698882cf06df44aa.getDataURL(image);
else {
if (image.data) // images of DataTexture
return {
data: Array.from(image.data),
width: image.width,
height: image.height,
type: image.data.constructor.name
};
else {
console.warn("THREE.Texture: Unable to serialize Texture.");
return {};
}
}
}
let $084574008ccedf86$var$_textureId = 0;
class $084574008ccedf86$export$5431306cf43de24a extends $084574008ccedf86$export$ec8b666c5fe2c75a {
constructor(image = $084574008ccedf86$export$5431306cf43de24a.DEFAULT_IMAGE, mapping = $084574008ccedf86$export$5431306cf43de24a.DEFAULT_MAPPING, wrapS = $084574008ccedf86$export$9d9334239a5a5e06, wrapT = $084574008ccedf86$export$9d9334239a5a5e06, magFilter = $084574008ccedf86$export$8a72f490b25c56c8, minFilter = $084574008ccedf86$export$5d8599b6a933fb1b, format = $084574008ccedf86$export$3f8bb04b555a363c, type = $084574008cced