@loaders.gl/tile-converter 3.3.0-alpha.4 → 3.3.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-attributes-worker.d.ts +1 -1
- package/dist/3d-tiles-attributes-worker.js +2 -2
- package/dist/3d-tiles-attributes-worker.js.map +2 -2
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +21 -17
- package/dist/converter.min.js +1 -1
- package/dist/dist.min.js +2 -2
- package/dist/es5/3d-tiles-attributes-worker.js +2 -2
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +27 -19
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +2 -2
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +25 -15
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/i3s-attributes-worker.js.map +1 -1
- package/dist/workers/3d-tiles-attributes-worker.js +1 -1
- package/package.json +15 -15
- package/src/3d-tiles-attributes-worker.ts +1 -1
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +25 -18
- package/src/workers/3d-tiles-attributes-worker.ts +1 -1
package/dist/converter.min.js
CHANGED
|
@@ -289,4 +289,4 @@ var n=r(14),i=r(511),a=r(62),o=function(e){if(!(this instanceof o))return new o(
|
|
|
289
289
|
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
|
|
290
290
|
* @copyright (c) 2012-2014 Chris Talkington, contributors.
|
|
291
291
|
*/
|
|
292
|
-
var n=r(0).inherits,i=r(210).Transform,a=r(232),o=r(62),s=function(e){if(!(this instanceof s))return new s(e);e=this.options=o.defaults(e,{}),i.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]};n(s,i),s.prototype._transform=function(e,t,r){r(null,e)},s.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)},s.prototype.append=function(e,t,r){var n=this;function i(e,i){e?r(e):(t.size=i.length||0,t.crc32=a.unsigned(i),n.files.push(t),r(null,t))}t.crc32=0,"buffer"===t.sourceType?i(null,e):"stream"===t.sourceType&&o.collectStream(e,i)},s.prototype.finalize=function(){this._writeStringified(),this.end()},e.exports=s},function(e,t,r){const n=r(78).get,i=r(78).set,a=r(78).has,o=r(78).isUndefined,s=(e,t,r)=>{const s=Object.keys(t).reduce((r,s)=>{const u=Array.isArray(t[s].path)?t[s].path.filter(t=>a(e,t))[0]:t[s].path,c=u?n(e,u):void 0;return((e,t,r,n,a)=>{const s=e[t].default,u=e[t].transform,c=e[t].omitValues||[];let l=u?u(r,n,a):r;return o(l)&&!o(s)&&(l=s),-1==c.indexOf(l)?i(Object.assign({},n),t,l):n})(t,s,c,r,e)},{});return r?r(s,e):s},u=(e,t,r)=>Array.isArray(e)?((e,t,r)=>e.map(e=>{const n=u(e,t);return r?r(n,e):n}))(e,t,r):s(e,t,r);e.exports=u},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){function r(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=533},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"filename",(function(){return no})),r.d(n,"dirname",(function(){return io})),r.d(n,"join",(function(){return ao}));var i={};r.r(i),r.d(i,"readdir",(function(){return so})),r.d(i,"stat",(function(){return uo})),r.d(i,"readFile",(function(){return co})),r.d(i,"readFileSync",(function(){return lo})),r.d(i,"writeFile",(function(){return ho})),r.d(i,"writeFileSync",(function(){return po})),r.d(i,"open",(function(){return fo})),r.d(i,"close",(function(){return mo})),r.d(i,"read",(function(){return go})),r.d(i,"fstat",(function(){return yo})),r.d(i,"isSupported",(function(){return bo})),r.d(i,"_readToArrayBuffer",(function(){return vo}));var a={};r.r(a),r.d(a,"name",(function(){return Ag})),r.d(a,"decode",(function(){return Sg}));var o={};r.r(o),r.d(o,"name",(function(){return Rg})),r.d(o,"preprocess",(function(){return Og}));var s={};r.r(s),r.d(s,"name",(function(){return Ig})),r.d(s,"preprocess",(function(){return Pg}));var u={};r.r(u),r.d(u,"name",(function(){return Mg})),r.d(u,"preprocess",(function(){return Fg})),r.d(u,"decode",(function(){return Lg})),r.d(u,"encode",(function(){return Ng}));var c={};r.r(c),r.d(c,"name",(function(){return Vg})),r.d(c,"decode",(function(){return Qg}));var l={};r.r(l),r.d(l,"name",(function(){return Zg})),r.d(l,"decode",(function(){return ey})),r.d(l,"encode",(function(){return ty}));var h={};r.r(h),r.d(h,"name",(function(){return ry})),r.d(h,"decode",(function(){return ny})),r.d(h,"encode",(function(){return iy}));var p={};r.r(p),r.d(p,"name",(function(){return ay})),r.d(p,"decode",(function(){return oy})),r.d(p,"encode",(function(){return sy}));var f={};r.r(f),r.d(f,"name",(function(){return cy})),r.d(f,"decode",(function(){return ly}));var d=r(114);const m="object"!=typeof process||"[object process]"!==String(process)||process.browser,g={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global},y=g.global||g.self||g.window;function b(e,t,r){return t<=e&&e<=r}global["encoding-indexes"]={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]}||{};var v=Math.floor;function w(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function _(e){return 0<=e&&e<=127}var k=_;function x(e){this.tokens=[].slice.call(e),this.tokens.reverse()}x.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};function E(e,t){if(e)throw TypeError("Decoder error");return t||65533}function A(e){throw TypeError("The code point "+e+" could not be encoded.")}function S(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(T,e)?T[e]:null}var j=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],T={};j.forEach((function(e){e.encodings.forEach((function(e){e.labels.forEach((function(t){T[t]=e}))}))}));var C,B,R={},O={};function I(e,t){return t&&t[e]||null}function P(e,t){var r=t.indexOf(e);return-1===r?null:r}function D(e){if(!("encoding-indexes"in global))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return global["encoding-indexes"][e]}function M(e,t){if(!(this instanceof M))throw TypeError("Called as a function. Did you forget 'new'?");e=void 0!==e?String(e):"utf-8",t=w(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=S(e);if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!O[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");return this._encoding=r,Boolean(t.fatal)&&(this._error_mode="fatal"),Boolean(t.ignoreBOM)&&(this._ignoreBOM=!0),Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase(),this.fatal="fatal"===this._error_mode,this.ignoreBOM=this._ignoreBOM),this}function F(e,t){if(!(this instanceof F))throw TypeError("Called as a function. Did you forget 'new'?");t=w(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){var r=S(e=void 0!==e?String(e):"utf-8");if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!R[r.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");this._encoding=r}else this._encoding=S("utf-8"),void 0!==e&&"console"in global&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase()),this}function L(e){var t=e.fatal,r=0,n=0,i=0,a=128,o=191;this.handler=function(e,s){if(-1===s&&0!==i)return i=0,E(t);if(-1===s)return-1;if(0===i){if(b(s,0,127))return s;if(b(s,194,223))i=1,r=31&s;else if(b(s,224,239))224===s&&(a=160),237===s&&(o=159),i=2,r=15&s;else{if(!b(s,240,244))return E(t);240===s&&(a=144),244===s&&(o=143),i=3,r=7&s}return null}if(!b(s,a,o))return r=i=n=0,a=128,o=191,e.prepend(s),E(t);if(a=128,o=191,r=r<<6|63&s,(n+=1)!==i)return null;var u=r;return r=i=n=0,u}}function N(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r,n;b(t,128,2047)?(r=1,n=192):b(t,2048,65535)?(r=2,n=224):b(t,65536,1114111)&&(r=3,n=240);for(var i=[(t>>6*r)+n];r>0;){var a=t>>6*(r-1);i.push(128|63&a),r-=1}return i}}function z(e,t){var r=t.fatal;this.handler=function(t,n){if(-1===n)return-1;if(_(n))return n;var i=e[n-128];return null===i?E(r):i}}function U(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(k(r))return r;var n=P(r,e);return null===n&&A(r),n+128}}function q(e){var t=e.fatal,r=0,n=0,i=0;this.handler=function(e,a){if(-1===a&&0===r&&0===n&&0===i)return-1;var o;if(-1!==a||0===r&&0===n&&0===i||(r=0,n=0,i=0,E(t)),0!==i){o=null,b(a,48,57)&&(o=function(e){if(e>39419&&e<189e3||e>1237575)return null;if(7457===e)return 59335;var t,r=0,n=0,i=D("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[0]<=e))break;r=a[0],n=a[1]}return n+e-r}(10*(126*(10*(r-129)+n-48)+i-129)+a-48));var s=[n,i,a];return r=0,n=0,i=0,null===o?(e.prepend(s),E(t)):o}if(0!==n)return b(a,129,254)?(i=a,null):(e.prepend([n,a]),r=0,n=0,E(t));if(0!==r){if(b(a,48,57))return n=a,null;var u=r,c=null;r=0;var l=a<127?64:65;return(b(a,64,126)||b(a,128,254))&&(c=190*(u-129)+(a-l)),null===(o=null===c?null:I(c,D("gb18030")))&&_(a)&&e.prepend(a),null===o?E(t):o}return _(a)?a:128===a?8364:b(a,129,254)?(r=a,null):E(t)}}function H(e,t){e.fatal;this.handler=function(e,r){if(-1===r)return-1;if(k(r))return r;if(58853===r)return A(r);if(t&&8364===r)return 128;var n=P(r,D("gb18030"));if(null!==n){var i=n%190;return[v(n/190)+129,i+(i<63?64:65)]}if(t)return A(r);n=function(e){if(59335===e)return 7457;var t,r=0,n=0,i=D("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[1]<=e))break;r=a[1],n=a[0]}return n+e-r}(r);var a=v(n/10/126/10),o=v((n-=10*a*126*10)/10/126),s=v((n-=10*o*126)/10);return[a+129,o+48,s+129,n-10*s+48]}}function G(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:98;switch((b(n,64,126)||b(n,161,254))&&(a=157*(i-129)+(n-o)),a){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var s=null===a?null:I(a,D("big5"));return null===s&&_(n)&&e.prepend(n),null===s?E(t):s}return _(n)?n:b(n,129,254)?(r=n,null):E(t)}}function V(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r=function(e){var t=B=B||D("big5").map((function(e,t){return t<5024?null:e}));return 9552===e||9566===e||9569===e||9578===e||21313===e||21317===e?t.lastIndexOf(e):P(e,t)}(t);if(null===r)return A(t);var n=v(r/157)+129;if(n<161)return A(t);var i=r%157;return[n,i+(i<63?64:98)]}}function W(e){var t=e.fatal,r=!1,n=0;this.handler=function(e,i){if(-1===i&&0!==n)return n=0,E(t);if(-1===i&&0===n)return-1;if(142===n&&b(i,161,223))return n=0,65216+i;if(143===n&&b(i,161,254))return r=!0,n=i,null;if(0!==n){var a=n;n=0;var o=null;return b(a,161,254)&&b(i,161,254)&&(o=I(94*(a-161)+(i-161),D(r?"jis0212":"jis0208"))),r=!1,b(i,161,254)||e.prepend(i),null===o?E(t):o}return _(i)?i:142===i||143===i||b(i,161,254)?(n=i,null):E(t)}}function K(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;if(165===t)return 92;if(8254===t)return 126;if(b(t,65377,65439))return[142,t-65377+161];8722===t&&(t=65293);var r=P(t,D("jis0208"));return null===r?A(t):[v(r/94)+161,r%94+161]}}function J(e){var t=e.fatal,r=0,n=1,i=2,a=3,o=4,s=5,u=6,c=r,l=r,h=0,p=!1;this.handler=function(e,f){switch(c){default:case r:return 27===f?(c=s,null):b(f,0,127)&&14!==f&&15!==f&&27!==f?(p=!1,f):-1===f?-1:(p=!1,E(t));case n:return 27===f?(c=s,null):92===f?(p=!1,165):126===f?(p=!1,8254):b(f,0,127)&&14!==f&&15!==f&&27!==f&&92!==f&&126!==f?(p=!1,f):-1===f?-1:(p=!1,E(t));case i:return 27===f?(c=s,null):b(f,33,95)?(p=!1,65344+f):-1===f?-1:(p=!1,E(t));case a:return 27===f?(c=s,null):b(f,33,126)?(p=!1,h=f,c=o,null):-1===f?-1:(p=!1,E(t));case o:if(27===f)return c=s,E(t);if(b(f,33,126)){c=a;var d=I(94*(h-33)+f-33,D("jis0208"));return null===d?E(t):d}return-1===f?(c=a,e.prepend(f),E(t)):(c=a,E(t));case s:return 36===f||40===f?(h=f,c=u,null):(e.prepend(f),p=!1,c=l,E(t));case u:var m=h;h=0;var g=null;if(40===m&&66===f&&(g=r),40===m&&74===f&&(g=n),40===m&&73===f&&(g=i),36!==m||64!==f&&66!==f||(g=a),null!==g){c=c=g;var y=p;return p=!0,y?E(t):null}return e.prepend([m,f]),p=!1,c=l,E(t)}}}function Q(e){e.fatal;var t=0,r=1,n=2,i=t;this.handler=function(e,a){if(-1===a&&i!==t)return e.prepend(a),i=t,[27,40,66];if(-1===a&&i===t)return-1;if(!(i!==t&&i!==r||14!==a&&15!==a&&27!==a))return A(65533);if(i===t&&k(a))return a;if(i===r&&(k(a)&&92!==a&&126!==a||165==a||8254==a)){if(k(a))return a;if(165===a)return 92;if(8254===a)return 126}if(k(a)&&i!==t)return e.prepend(a),i=t,[27,40,66];if((165===a||8254===a)&&i!==r)return e.prepend(a),i=r,[27,40,74];8722===a&&(a=65293);var o=P(a,D("jis0208"));return null===o?A(a):i!==n?(e.prepend(a),i=n,[27,36,66]):[v(o/94)+33,o%94+33]}}function Y(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:65,s=i<160?129:193;if((b(n,64,126)||b(n,128,252))&&(a=188*(i-s)+n-o),b(a,8836,10715))return 48508+a;var u=null===a?null:I(a,D("jis0208"));return null===u&&_(n)&&e.prepend(n),null===u?E(t):u}return _(n)||128===n?n:b(n,161,223)?65216+n:b(n,129,159)||b(n,224,252)?(r=n,null):E(t)}}function $(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t)||128===t)return t;if(165===t)return 92;if(8254===t)return 126;if(b(t,65377,65439))return t-65377+161;8722===t&&(t=65293);var r=function(e){return(C=C||D("jis0208").map((function(e,t){return b(t,8272,8835)?null:e}))).indexOf(e)}(t);if(null===r)return A(t);var n=v(r/188),i=r%188;return[n+(n<31?129:193),i+(i<63?64:65)]}}function X(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0,b(n,65,254)&&(a=190*(i-129)+(n-65));var o=null===a?null:I(a,D("euc-kr"));return null===a&&_(n)&&e.prepend(n),null===o?E(t):o}return _(n)?n:b(n,129,254)?(r=n,null):E(t)}}function Z(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r=P(t,D("euc-kr"));return null===r?A(t):[v(r/190)+129,r%190+65]}}function ee(e,t){var r=e>>8,n=255&e;return t?[r,n]:[n,r]}function te(e,t){var r=t.fatal,n=null,i=null;this.handler=function(t,a){if(-1===a&&(null!==n||null!==i))return E(r);if(-1===a&&null===n&&null===i)return-1;if(null===n)return n=a,null;var o;if(o=e?(n<<8)+a:(a<<8)+n,n=null,null!==i){var s=i;return i=null,b(o,56320,57343)?65536+1024*(s-55296)+(o-56320):(t.prepend(ee(o,e)),E(r))}return b(o,55296,56319)?(i=o,null):b(o,56320,57343)?E(r):o}}function re(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(b(r,0,65535))return ee(r,e);var n=ee(55296+(r-65536>>10),e),i=ee(56320+(r-65536&1023),e);return n.concat(i)}}function ne(e){e.fatal;this.handler=function(e,t){return-1===t?-1:_(t)?t:63360+t-128}}function ie(e){e.fatal;this.handler=function(e,t){return-1===t?-1:k(t)?t:b(t,63360,63487)?t-63360+128:A(t)}}Object.defineProperty&&(Object.defineProperty(M.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(M.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(M.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),M.prototype.decode=function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=w(t),this._do_not_flush||(this._decoder=O[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var n,i=new x(r),a=[];;){var o=i.read();if(-1===o)break;if(-1===(n=this._decoder.handler(i,o)))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}if(!this._do_not_flush){do{if(-1===(n=this._decoder.handler(i,i.read())))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}while(!i.endOfStream());this._decoder=null}return function(e){var t,r;return t=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===t.indexOf(r)||this._ignoreBOM||this._BOMseen||(e.length>0&&65279===e[0]?(this._BOMseen=!0,e.shift()):e.length>0&&(this._BOMseen=!0)),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return t}(e)}.call(this,a)},Object.defineProperty&&Object.defineProperty(F.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),F.prototype.encode=function(e,t){e=void 0===e?"":String(e),t=w(t),this._do_not_flush||(this._encoder=R[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(t.stream);for(var r,n=new x(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=1023&a,u=1023&o;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e)),i=[];;){var a=n.read();if(-1===a)break;if(-1===(r=this._encoder.handler(n,a)))break;Array.isArray(r)?i.push.apply(i,r):i.push(r)}if(!this._do_not_flush){for(;-1!==(r=this._encoder.handler(n,n.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);this._encoder=null}return new Uint8Array(i)},R["UTF-8"]=function(e){return new N(e)},O["UTF-8"]=function(e){return new L(e)},"encoding-indexes"in global&&j.forEach((function(e){"Legacy single-byte encodings"===e.heading&&e.encodings.forEach((function(e){var t=e.name,r=D(t.toLowerCase());O[t]=function(e){return new z(r,e)},R[t]=function(e){return new U(r,e)}}))})),O.GBK=function(e){return new q(e)},R.GBK=function(e){return new H(e,!0)},R.gb18030=function(e){return new H(e)},O.gb18030=function(e){return new q(e)},R.Big5=function(e){return new V(e)},O.Big5=function(e){return new G(e)},R["EUC-JP"]=function(e){return new K(e)},O["EUC-JP"]=function(e){return new W(e)},R["ISO-2022-JP"]=function(e){return new Q(e)},O["ISO-2022-JP"]=function(e){return new J(e)},R.Shift_JIS=function(e){return new $(e)},O.Shift_JIS=function(e){return new Y(e)},R["EUC-KR"]=function(e){return new Z(e)},O["EUC-KR"]=function(e){return new X(e)},R["UTF-16BE"]=function(e){return new re(!0,e)},O["UTF-16BE"]=function(e){return new te(!0,e)},R["UTF-16LE"]=function(e){return new re(!1,e)},O["UTF-16LE"]=function(e){return new te(!1,e)},R["x-user-defined"]=function(e){return new ie(e)},O["x-user-defined"]=function(e){return new ne(e)};function ae(e){return Buffer.from(e).toString("base64")}function oe(e){return Buffer.from(e,"base64").toString("ascii")}let se;se=Symbol.iterator;class ue{constructor(e){var t,r,n;n=void 0,(r="map")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.map={},e instanceof ue?e.forEach((e,t)=>this.append(t,e)):Array.isArray(e)?e.forEach(e=>this.append(e[0],e[1])):e&&Object.getOwnPropertyNames(e).forEach(t=>this.append(t,e[t]))}append(e,t){e=ce(e),t=le(t);const r=this.map[e];this.map[e]=r?`${r}, ${t}`:t}delete(e){delete this.map[ce(e)]}get(e){return e=ce(e),this.has(e)?this.map[e]:null}has(e){return this.map.hasOwnProperty(ce(e))}set(e,t){this.map[ce(e)]=le(t)}forEach(e,t=null){for(const r in this.map)this.map.hasOwnProperty(r)&&(t?e.call(t,this.map[r],r,this):e(this.map[r],r,this))}keys(){const e=[];return this.forEach((function(t,r){e.push(r)})),he(e)}values(){const e=[];return this.forEach((function(t){e.push(t)})),he(e)}entries(){const e=[];return this.forEach((function(t,r){e.push([r,t])})),he(e)}*[se](){yield*this.entries()}}function ce(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function le(e){return"string"!=typeof e&&(e=String(e)),e}function he(e){const t={next(){const t=e.shift();return{done:void 0===t,value:t}}};return t[Symbol.iterator]=function(){return t},t}function pe(e,t){if(!e)throw new Error("@loaders.gl/polyfills assertion "+t)}var fe=r(2),de=r.n(fe),me=r(39),ge=r.n(me),ye=r(50),be=r.n(ye),ve=r(14),we=r.n(ve);function _e(e){if((t=e)&&t instanceof ArrayBuffer)return e;var t;if((e=>e&&e instanceof Buffer)(e)){return new Uint8Array(e).buffer}if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}async function ke(e,t){if(!function(e){return e.startsWith("http:")||e.startsWith("https:")}(e)){const t=e.split("?")[0];return await new Promise((e,r)=>{const n=de.a.createReadStream(t,{encoding:null});n.once("readable",()=>e(n)),n.on("error",e=>r(e))})}return await new Promise((r,n)=>{const i=(e.startsWith("https:")?be.a.request:ge.a.request)(function(e,t){const r=(null==t?void 0:t.headers)||{},n={};for(const e of Object.keys(r))n[e.toLowerCase()]=r[e];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";const i=new URL(e);return{hostname:i.hostname,path:i.pathname,method:"GET",...t,...null==t?void 0:t.fetch,headers:n,port:i.port}}(e,t),e=>r(e));i.on("error",e=>n(e)),i.end()})}async function xe(e){const t=[];return await new Promise((r,n)=>{e.on("error",e=>n(e)),e.on("readable",()=>e.read()),e.on("data",e=>{"string"==typeof e&&n(new Error("Read stream not binary")),t.push(_e(e))}),e.on("end",()=>{const e=function(e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}(t);r(e)})})}var Ee=r(4);function Ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Se=e=>"function"==typeof e,je=e=>(e=>null!==e&&"object"==typeof e)(e)&&Se(e.read)&&Se(e.pipe)&&(e=>"boolean"==typeof e)(e.readable);class Te{constructor(e,t){Ae(this,"ok",void 0),Ae(this,"status",void 0),Ae(this,"statusText",void 0),Ae(this,"headers",void 0),Ae(this,"url",void 0),Ae(this,"bodyUsed",!1),Ae(this,"_body",void 0);const{headers:r,status:n=200,statusText:i="OK",url:a}=t||{};this.url=a,this.ok=200===n,this.status=n,this.statusText=i,this.headers=new ue((null==t?void 0:t.headers)||{}),je(e)?this._body=function(e,t){switch(t.get("content-encoding")){case"br":return e.pipe(we.a.createBrotliDecompress());case"gzip":return e.pipe(we.a.createGunzip());case"deflate":return e.pipe(we.a.createDeflate());default:return e}}(e,r):this._body="string"==typeof e?Ee.Readable.from([(new TextEncoder).encode(e)]):Ee.Readable.from([e||new ArrayBuffer(0)])}get body(){return pe(!this.bodyUsed),pe(je(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){if(!je(this._body))return this._body||new ArrayBuffer(0);return await xe(this._body)}async text(){const e=await this.arrayBuffer();return(new TextDecoder).decode(e)}async json(){const e=await this.text();return JSON.parse(e)}async blob(){if("undefined"==typeof Blob)throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}}const Ce=e=>e.startsWith("data:");async function Be(e,t){try{if(Ce(e)){const{arrayBuffer:t,mimeType:r}=function(e){const t=e.indexOf(",");let r,n;return";base64"===e.slice(t-7,t)?(r=Buffer.from(e.slice(t+1),"base64"),n=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),n=e.slice(5,t).trim()),n?n.startsWith(";")&&(n="text/plain"+n):n="text/plain;charset=US-ASCII",{arrayBuffer:_e(r),mimeType:n}}(e);return new Te(t,{headers:{"content-type":r},url:e})}const r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");const i=await ke(n,t),a=function(e,t,r={}){const n={};if(t&&t.headers){const e=t.headers;for(const t in e){const r=e[t];n[t.toLowerCase()]=String(r)}}if(!n["content-length"]){const t=function(e){if((e=>e.startsWith("http:")||e.startsWith("https:"))(e))return null;if(Ce(e))return e.length-"data:".length;try{const t=e.split("?")[0];return de.a.statSync(t).size}catch(e){}return null}(e);Number.isFinite(t)&&(n["content-length"]=t)}return Object.assign(n,r),new ue(n)}(e,i,r),{status:o,statusText:s}=function(e){if(e.statusCode)return{status:e.statusCode,statusText:e.statusMessage||"NA"};return{status:200,statusText:"OK"}}(i),u=!t||t.followRedirect||void 0===t.followRedirect;if(o>=300&&o<400&&a.has("location")&&u){const r=function(e,t){if(t.startsWith("http"))return t;const r=new URL(e);return r.pathname=t,r.href}(e,a.get("location"));return await Be(r,t)}return new Te(i,{headers:a,status:o,statusText:s,url:e})}catch(t){return new Te(null,{status:400,statusText:String(t),url:e})}}var Re=r(258),Oe=r.n(Re),Ie=r(63),Pe=r.n(Ie);function De(e,t){const r=function(e,t){const r=t.type?t.type.replace("image/",""):"jpeg",n=Pe()(e.data,[e.width,e.height,4],[4,4*e.width,1],0);return Oe()(n,r,t)}(e,t);return new Promise(e=>{const t=[];r.on("data",e=>t.push(e)),r.on("end",()=>{const r=Buffer.concat(t);e(function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e).buffer}return e}(r))})})}var Me=r(259),Fe=r.n(Me),Le=r(0),Ne=r.n(Le);async function ze(e,t){pe(t,"MIMEType is required to parse image under Node.js");const r=Ne.a.promisify(Fe.a),n=e instanceof Buffer?e:Buffer.from(e),i=await r(n,t),a=[...i.shape],o=4===i.shape.length?i.shape.shift():1;return{shape:a,data:i.data instanceof Buffer?new Uint8Array(i.data):i.data,width:i.shape[0],height:i.shape[1],components:i.shape[2],layers:o}}var Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};function qe(){}var He="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function Ge(e){return"object"==typeof e&&null!==e||"function"==typeof e}var Ve=qe,We=Promise,Ke=Promise.prototype.then,Je=Promise.resolve.bind(We),Qe=Promise.reject.bind(We);function Ye(e){return new We(e)}function $e(e){return Je(e)}function Xe(e){return Qe(e)}function Ze(e,t,r){return Ke.call(e,t,r)}function et(e,t,r){Ze(Ze(e,t,r),void 0,Ve)}function tt(e,t){et(e,t)}function rt(e,t){et(e,void 0,t)}function nt(e,t,r){return Ze(e,t,r)}function it(e){Ze(e,void 0,Ve)}var at=function(){var e=He&&He.queueMicrotask;if("function"==typeof e)return e;var t=$e(void 0);return function(e){return Ze(t,e)}}();function ot(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function st(e,t,r){try{return $e(ot(e,t,r))}catch(e){return Xe(e)}}var ut=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.push=function(e){var t=this._back,r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size},e.prototype.shift=function(){var e=this._front,t=e,r=this._cursor,n=r+1,i=e._elements,a=i[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),i[r]=void 0,a},e.prototype.forEach=function(e){for(var t=this._cursor,r=this._front,n=r._elements;!(t===n.length&&void 0===r._next||t===n.length&&(t=0,0===(n=(r=r._next)._elements).length));)e(n[t]),++t},e.prototype.peek=function(){var e=this._front,t=this._cursor;return e._elements[t]},e}();function ct(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?ft(e):"closed"===t._state?function(e){ft(e),gt(e)}(e):dt(e,t._storedError)}function lt(e,t){return Yn(e._ownerReadableStream,t)}function ht(e){"readable"===e._ownerReadableStream._state?mt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){dt(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function pt(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ft(e){e._closedPromise=Ye((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function dt(e,t){ft(e),mt(e,t)}function mt(e,t){void 0!==e._closedPromise_reject&&(it(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function gt(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var yt=Ue("[[AbortSteps]]"),bt=Ue("[[ErrorSteps]]"),vt=Ue("[[CancelSteps]]"),wt=Ue("[[PullSteps]]"),_t=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},kt=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function xt(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(t+" is not an object.");var r}function Et(e,t){if("function"!=typeof e)throw new TypeError(t+" is not a function.")}function At(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(t+" is not an object.")}function St(e,t,r){if(void 0===e)throw new TypeError("Parameter "+t+" is required in '"+r+"'.")}function jt(e,t,r){if(void 0===e)throw new TypeError(t+" is required in '"+r+"'.")}function Tt(e){return Number(e)}function Ct(e){return 0===e?0:e}function Bt(e,t){var r=Number.MAX_SAFE_INTEGER,n=Number(e);if(n=Ct(n),!_t(n))throw new TypeError(t+" is not a finite number");if((n=function(e){return Ct(kt(e))}(n))<0||n>r)throw new TypeError(t+" is outside the accepted range of 0 to "+r+", inclusive");return _t(n)&&0!==n?n:0}function Rt(e,t){if(!Jn(e))throw new TypeError(t+" is not a ReadableStream.")}function Ot(e){return new Nt(e)}function It(e,t){e._reader._readRequests.push(t)}function Pt(e,t,r){var n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Dt(e){return e._reader._readRequests.length}function Mt(e){var t=e._reader;return void 0!==t&&!!zt(t)}var Ft,Lt,Nt=function(){function e(e){if(St(e,1,"ReadableStreamDefaultReader"),Rt(e,"First parameter"),Qn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ct(this,e),this._readRequests=new ut}return Object.defineProperty(e.prototype,"closed",{get:function(){return zt(this)?this._closedPromise:Xe(qt("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),zt(this)?void 0===this._ownerReadableStream?Xe(pt("cancel")):lt(this,e):Xe(qt("cancel"))},e.prototype.read=function(){if(!zt(this))return Xe(qt("read"));if(void 0===this._ownerReadableStream)return Xe(pt("read from"));var e,t,r=Ye((function(r,n){e=r,t=n}));return Ut(this,{_chunkSteps:function(t){return e({value:t,done:!1})},_closeSteps:function(){return e({value:void 0,done:!0})},_errorSteps:function(e){return t(e)}}),r},e.prototype.releaseLock=function(){if(!zt(this))throw qt("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ht(this)}},e}();function zt(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Ut(e,t){var r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[wt](t)}function qt(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}Object.defineProperties(Nt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Nt.prototype,Ue.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),"symbol"==typeof Ue.asyncIterator&&((Ft={})[Ue.asyncIterator]=function(){return this},Lt=Ft,Object.defineProperty(Lt,Ue.asyncIterator,{enumerable:!1}));var Ht=function(){function e(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}return e.prototype.next=function(){var e=this,t=function(){return e._nextSteps()};return this._ongoingPromise=this._ongoingPromise?nt(this._ongoingPromise,t,t):t(),this._ongoingPromise},e.prototype.return=function(e){var t=this,r=function(){return t._returnSteps(e)};return this._ongoingPromise?nt(this._ongoingPromise,r,r):r()},e.prototype._nextSteps=function(){var e=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var t,r,n=this._reader;if(void 0===n._ownerReadableStream)return Xe(pt("iterate"));var i=Ye((function(e,n){t=e,r=n}));return Ut(n,{_chunkSteps:function(r){e._ongoingPromise=void 0,at((function(){return t({value:r,done:!1})}))},_closeSteps:function(){e._ongoingPromise=void 0,e._isFinished=!0,ht(n),t({value:void 0,done:!0})},_errorSteps:function(t){e._ongoingPromise=void 0,e._isFinished=!0,ht(n),r(t)}}),i},e.prototype._returnSteps=function(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;var t=this._reader;if(void 0===t._ownerReadableStream)return Xe(pt("finish iterating"));if(!this._preventCancel){var r=lt(t,e);return ht(t),nt(r,(function(){return{value:e,done:!0}}))}return ht(t),$e({value:e,done:!0})},e}(),Gt={next:function(){return Vt(this)?this._asyncIteratorImpl.next():Xe(Wt("next"))},return:function(e){return Vt(this)?this._asyncIteratorImpl.return(e):Xe(Wt("return"))}};function Vt(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function Wt(e){return new TypeError("ReadableStreamAsyncIterator."+e+" can only be used on a ReadableSteamAsyncIterator")}void 0!==Lt&&Object.setPrototypeOf(Gt,Lt);var Kt=Number.isNaN||function(e){return e!=e};function Jt(e){return!!function(e){if("number"!=typeof e)return!1;if(Kt(e))return!1;if(e<0)return!1;return!0}(e)&&e!==1/0}function Qt(e){var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Yt(e,t,r){if(!Jt(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function $t(e){e._queue=new ut,e._queueTotalSize=0}function Xt(e){return e.slice()}var Zt=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"view",{get:function(){if(!rr(this))throw br("view");return this._view},enumerable:!1,configurable:!0}),e.prototype.respond=function(e){if(!rr(this))throw br("respond");if(St(e,1,"respond"),e=Bt(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(e,t){if(!Jt(t=Number(t)))throw new RangeError("bytesWritten must be a finite");pr(e,t)}(this._associatedReadableByteStreamController,e)},e.prototype.respondWithNewView=function(e){if(!rr(this))throw br("respondWithNewView");if(St(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){var r=e._pendingPullIntos.peek();if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,pr(e,t.byteLength)}(this._associatedReadableByteStreamController,e)},e}();Object.defineProperties(Zt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Zt.prototype,Ue.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var er=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"byobRequest",{get:function(){if(!tr(this))throw vr("byobRequest");if(null===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos.peek(),t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),r=Object.create(Zt.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(r,this,t),this._byobRequest=r}return this._byobRequest},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!tr(this))throw vr("desiredSize");return gr(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!tr(this))throw vr("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==t._state)return;if(e._queueTotalSize>0)return void(e._closeRequested=!0);if(e._pendingPullIntos.length>0){if(e._pendingPullIntos.peek().bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw mr(e,r),r}}dr(e),$n(t)}(this)},e.prototype.enqueue=function(e){if(!tr(this))throw vr("enqueue");if(St(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");!function(e,t){var r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;var n=t.buffer,i=t.byteOffset,a=t.byteLength,o=n;if(Mt(r))if(0===Dt(r))or(e,o,i,a);else{var s=new Uint8Array(o,i,a);Pt(r,s,!1)}else kr(r)?(or(e,o,i,a),hr(e)):or(e,o,i,a);nr(e)}(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!tr(this))throw vr("error");mr(this,e)},e.prototype[vt]=function(e){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0);$t(this);var t=this._cancelAlgorithm(e);return dr(this),t},e.prototype[wt]=function(e){var t=this._controlledReadableByteStream;if(this._queueTotalSize>0){var r=this._queue.shift();this._queueTotalSize-=r.byteLength,cr(this);var n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);e._chunkSteps(n)}else{var i=this._autoAllocateChunkSize;if(void 0!==i){var a=void 0;try{a=new ArrayBuffer(i)}catch(t){return void e._errorSteps(t)}var o={buffer:a,byteOffset:0,byteLength:i,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}It(t,e),nr(this)}},e}();function tr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function rr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function nr(e){(function(e){var t=e._controlledReadableByteStream;if("readable"!==t._state)return!1;if(e._closeRequested)return!1;if(!e._started)return!1;if(Mt(t)&&Dt(t)>0)return!0;if(kr(t)&&_r(t)>0)return!0;if(gr(e)>0)return!0;return!1})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,et(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,nr(e))}),(function(t){mr(e,t)}))))}function ir(e,t){var r=!1;"closed"===e._state&&(r=!0);var n=ar(t);"default"===t.readerType?Pt(e,n,r):function(e,t,r){var n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function ar(e){var t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function or(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function sr(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,o=a-a%r,s=i,u=!1;o>n&&(s=o-t.bytesFilled,u=!0);for(var c,l,h,p,f,d=e._queue;s>0;){var m=d.peek(),g=Math.min(s,m.byteLength),y=t.byteOffset+t.bytesFilled;c=t.buffer,l=y,h=m.buffer,p=m.byteOffset,f=g,new Uint8Array(c).set(new Uint8Array(h,p,f),l),m.byteLength===g?d.shift():(m.byteOffset+=g,m.byteLength-=g),e._queueTotalSize-=g,ur(e,g,t),s-=g}return u}function ur(e,t,r){lr(e),r.bytesFilled+=t}function cr(e){0===e._queueTotalSize&&e._closeRequested?(dr(e),$n(e._controlledReadableByteStream)):nr(e)}function lr(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function hr(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos.peek();sr(e,t)&&(fr(e),ir(e._controlledReadableByteStream,t))}}function pr(e,t){var r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=t.buffer;var r=e._controlledReadableByteStream;if(kr(r))for(;_r(r)>0;){ir(r,fr(e))}}(e,r)}else!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(ur(e,t,r),!(r.bytesFilled<r.elementSize)){fr(e);var n=r.bytesFilled%r.elementSize;if(n>0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);or(e,a,0,a.byteLength)}r.buffer=r.buffer,r.bytesFilled-=n,ir(e._controlledReadableByteStream,r),hr(e)}}(e,t,r);nr(e)}function fr(e){var t=e._pendingPullIntos.shift();return lr(e),t}function dr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function mr(e,t){var r=e._controlledReadableByteStream;"readable"===r._state&&(!function(e){lr(e),e._pendingPullIntos=new ut}(e),$t(e),dr(e),Xn(r,t))}function gr(e){var t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function yr(e,t,r){var n=Object.create(er.prototype),i=function(){},a=function(){return $e(void 0)},o=function(){return $e(void 0)};void 0!==t.start&&(i=function(){return t.start(n)}),void 0!==t.pull&&(a=function(){return t.pull(n)}),void 0!==t.cancel&&(o=function(e){return t.cancel(e)});var s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");!function(e,t,r,n,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,$t(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=new ut,e._readableStreamController=t,et($e(r()),(function(){t._started=!0,nr(t)}),(function(e){mr(t,e)}))}(e,n,i,a,o,r,s)}function br(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function vr(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}function wr(e,t){e._reader._readIntoRequests.push(t)}function _r(e){return e._reader._readIntoRequests.length}function kr(e){var t=e._reader;return void 0!==t&&!!Er(t)}Object.defineProperties(er.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(er.prototype,Ue.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var xr=function(){function e(e){if(St(e,1,"ReadableStreamBYOBReader"),Rt(e,"First parameter"),Qn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!tr(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ct(this,e),this._readIntoRequests=new ut}return Object.defineProperty(e.prototype,"closed",{get:function(){return Er(this)?this._closedPromise:Xe(Ar("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Er(this)?void 0===this._ownerReadableStream?Xe(pt("cancel")):lt(this,e):Xe(Ar("cancel"))},e.prototype.read=function(e){if(!Er(this))return Xe(Ar("read"));if(!ArrayBuffer.isView(e))return Xe(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return Xe(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return Xe(new TypeError("view's buffer must have non-zero byteLength"));if(void 0===this._ownerReadableStream)return Xe(pt("read from"));var t,r,n=Ye((function(e,n){t=e,r=n}));return function(e,t,r){var n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?r._errorSteps(n._storedError):function(e,t,r){var n=e._controlledReadableByteStream,i=1;t.constructor!==DataView&&(i=t.constructor.BYTES_PER_ELEMENT);var a=t.constructor,o={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(o),void wr(n,r);if("closed"!==n._state){if(e._queueTotalSize>0){if(sr(e,o)){var s=ar(o);return cr(e),void r._chunkSteps(s)}if(e._closeRequested){var u=new TypeError("Insufficient bytes to fill elements in the given buffer");return mr(e,u),void r._errorSteps(u)}}e._pendingPullIntos.push(o),wr(n,r),nr(e)}else{var c=new a(o.buffer,o.byteOffset,0);r._closeSteps(c)}}(n._readableStreamController,t,r)}(this,e,{_chunkSteps:function(e){return t({value:e,done:!1})},_closeSteps:function(e){return t({value:e,done:!0})},_errorSteps:function(e){return r(e)}}),n},e.prototype.releaseLock=function(){if(!Er(this))throw Ar("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ht(this)}},e}();function Er(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Ar(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Sr(e,t){var r=e.highWaterMark;if(void 0===r)return t;if(Kt(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function jr(e){var t=e.size;return t||function(){return 1}}function Tr(e,t){xt(e,t);var r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Tt(r),size:void 0===n?void 0:Cr(n,t+" has member 'size' that")}}function Cr(e,t){return Et(e,t),function(t){return Tt(e(t))}}function Br(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function Rr(e,t,r){return Et(e,r),function(){return st(e,t,[])}}function Or(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function Ir(e,t,r){return Et(e,r),function(r,n){return st(e,t,[r,n])}}function Pr(e,t){if(!Lr(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(xr.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(xr.prototype,Ue.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Dr=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:At(e,"First parameter");var r=Tr(t,"Second parameter"),n=function(e,t){xt(e,t);var r=null==e?void 0:e.abort,n=null==e?void 0:e.close,i=null==e?void 0:e.start,a=null==e?void 0:e.type,o=null==e?void 0:e.write;return{abort:void 0===r?void 0:Br(r,e,t+" has member 'abort' that"),close:void 0===n?void 0:Rr(n,e,t+" has member 'close' that"),start:void 0===i?void 0:Or(i,e,t+" has member 'start' that"),write:void 0===o?void 0:Ir(o,e,t+" has member 'write' that"),type:a}}(e,"First parameter");if(Fr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");var i=jr(r);!function(e,t,r,n){var i=Object.create(rn.prototype),a=function(){},o=function(){return $e(void 0)},s=function(){return $e(void 0)},u=function(){return $e(void 0)};void 0!==t.start&&(a=function(){return t.start(i)});void 0!==t.write&&(o=function(e){return t.write(e,i)});void 0!==t.close&&(s=function(){return t.close()});void 0!==t.abort&&(u=function(e){return t.abort(e)});nn(e,i,a,o,s,u,r,n)}(this,n,Sr(r,1),i)}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Lr(this))throw hn("locked");return Nr(this)},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Lr(this)?Nr(this)?Xe(new TypeError("Cannot abort a stream that already has a writer")):zr(this,e):Xe(hn("abort"))},e.prototype.close=function(){return Lr(this)?Nr(this)?Xe(new TypeError("Cannot close a stream that already has a writer")):Vr(this)?Xe(new TypeError("Cannot close an already-closing stream")):Ur(this):Xe(hn("close"))},e.prototype.getWriter=function(){if(!Lr(this))throw hn("getWriter");return Mr(this)},e}();function Mr(e){return new Jr(e)}function Fr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ut,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Lr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function Nr(e){return void 0!==e._writer}function zr(e,t){var r=e._state;if("closed"===r||"errored"===r)return $e(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;var n=!1;"erroring"===r&&(n=!0,t=void 0);var i=Ye((function(r,i){e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:i,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||Hr(e,t),i}function Ur(e){var t=e._state;if("closed"===t||"errored"===t)return Xe(new TypeError("The stream (in "+t+" state) is not in the writable state and cannot be closed"));var r,n=Ye((function(t,r){var n={_resolve:t,_reject:r};e._closeRequest=n})),i=e._writer;return void 0!==i&&e._backpressure&&"writable"===t&&kn(i),Yt(r=e._writableStreamController,tn,0),sn(r),n}function qr(e,t){"writable"!==e._state?Gr(e):Hr(e,t)}function Hr(e,t){var r=e._writableStreamController;e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&Xr(n,t),!function(e){if(void 0===e._inFlightWriteRequest&&void 0===e._inFlightCloseRequest)return!1;return!0}(e)&&r._started&&Gr(e)}function Gr(e){e._state="errored",e._writableStreamController[bt]();var t=e._storedError;if(e._writeRequests.forEach((function(e){e._reject(t)})),e._writeRequests=new ut,void 0!==e._pendingAbortRequest){var r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Wr(e);et(e._writableStreamController[yt](r._reason),(function(){r._resolve(),Wr(e)}),(function(t){r._reject(t),Wr(e)}))}else Wr(e)}function Vr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Wr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&gn(t,e._storedError)}function Kr(e,t){var r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){bn(e)}(r):kn(r)),e._backpressure=t}Object.defineProperties(Dr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Dr.prototype,Ue.toStringTag,{value:"WritableStream",configurable:!0});var Jr=function(){function e(e){if(St(e,1,"WritableStreamDefaultWriter"),Pr(e,"First parameter"),Nr(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;var t,r=e._state;if("writable"===r)!Vr(e)&&e._backpressure?bn(this):wn(this),dn(this);else if("erroring"===r)vn(this,e._storedError),dn(this);else if("closed"===r)wn(this),dn(t=this),yn(t);else{var n=e._storedError;vn(this,n),mn(this,n)}}return Object.defineProperty(e.prototype,"closed",{get:function(){return Qr(this)?this._closedPromise:Xe(pn("closed"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Qr(this))throw pn("desiredSize");if(void 0===this._ownerWritableStream)throw fn("desiredSize");return function(e){var t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return on(t._writableStreamController)}(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ready",{get:function(){return Qr(this)?this._readyPromise:Xe(pn("ready"))},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Qr(this)?void 0===this._ownerWritableStream?Xe(fn("abort")):function(e,t){return zr(e._ownerWritableStream,t)}(this,e):Xe(pn("abort"))},e.prototype.close=function(){if(!Qr(this))return Xe(pn("close"));var e=this._ownerWritableStream;return void 0===e?Xe(fn("close")):Vr(e)?Xe(new TypeError("Cannot close an already-closing stream")):Yr(this)},e.prototype.releaseLock=function(){if(!Qr(this))throw pn("releaseLock");void 0!==this._ownerWritableStream&&Zr(this)},e.prototype.write=function(e){return void 0===e&&(e=void 0),Qr(this)?void 0===this._ownerWritableStream?Xe(fn("write to")):en(this,e):Xe(pn("write"))},e}();function Qr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function Yr(e){return Ur(e._ownerWritableStream)}function $r(e,t){"pending"===e._closedPromiseState?gn(e,t):function(e,t){mn(e,t)}(e,t)}function Xr(e,t){"pending"===e._readyPromiseState?_n(e,t):function(e,t){vn(e,t)}(e,t)}function Zr(e){var t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Xr(e,r),$r(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function en(e,t){var r=e._ownerWritableStream,n=r._writableStreamController,i=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return un(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Xe(fn("write to"));var a=r._state;if("errored"===a)return Xe(r._storedError);if(Vr(r)||"closed"===a)return Xe(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Xe(r._storedError);var o=function(e){return Ye((function(t,r){var n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{Yt(e,t,r)}catch(t){return void un(e,t)}var n=e._controlledWritableStream;if(!Vr(n)&&"writable"===n._state){var i=cn(e);Kr(n,i)}sn(e)}(n,t,i),o}Object.defineProperties(Jr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Jr.prototype,Ue.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var tn={},rn=function(){function e(){throw new TypeError("Illegal constructor")}return e.prototype.error=function(e){if(void 0===e&&(e=void 0),!function(e){if(!Ge(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&ln(this,e)},e.prototype[yt]=function(e){var t=this._abortAlgorithm(e);return an(this),t},e.prototype[bt]=function(){$t(this)},e}();function nn(e,t,r,n,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,$t(t),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=i,t._abortAlgorithm=a;var u=cn(t);Kr(e,u),et($e(r()),(function(){t._started=!0,sn(t)}),(function(r){t._started=!0,qr(e,r)}))}function an(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function on(e){return e._strategyHWM-e._queueTotalSize}function sn(e){var t=e._controlledWritableStream;if(e._started&&void 0===t._inFlightWriteRequest)if("erroring"!==t._state){if(0!==e._queue.length){var r=e._queue.peek().value;r===tn?function(e){var t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Qt(e);var r=e._closeAlgorithm();an(e),et(r,(function(){!function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var t=e._writer;void 0!==t&&yn(t)}(t)}),(function(e){!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),qr(e,t)}(t,e)}))}(e):function(e,t){var r=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(r),et(e._writeAlgorithm(t),(function(){!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);var t=r._state;if(Qt(e),!Vr(r)&&"writable"===t){var n=cn(e);Kr(r,n)}sn(e)}),(function(t){"writable"===r._state&&an(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,qr(e,t)}(r,t)}))}(e,r)}}else Gr(t)}function un(e,t){"writable"===e._controlledWritableStream._state&&ln(e,t)}function cn(e){return on(e)<=0}function ln(e,t){var r=e._controlledWritableStream;an(e),Hr(r,t)}function hn(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function pn(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function fn(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function dn(e){e._closedPromise=Ye((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function mn(e,t){dn(e),gn(e,t)}function gn(e,t){void 0!==e._closedPromise_reject&&(it(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function yn(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function bn(e){e._readyPromise=Ye((function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function vn(e,t){bn(e),_n(e,t)}function wn(e){bn(e),kn(e)}function _n(e,t){void 0!==e._readyPromise_reject&&(it(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function kn(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(rn.prototype,{error:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(rn.prototype,Ue.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var xn="undefined"!=typeof DOMException?DOMException:void 0;var En,An=function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;try{return new e,!0}catch(e){return!1}}(xn)?xn:((En=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}).prototype=Object.create(Error.prototype),Object.defineProperty(En.prototype,"constructor",{value:En,writable:!0,configurable:!0}),En);function Sn(e,t,r,n,i,a){var o=Ot(e),s=Mr(t);e._disturbed=!0;var u=!1,c=$e(void 0);return Ye((function(l,h){var p,f,d,m;if(void 0!==a){if(p=function(){var r=new An("Aborted","AbortError"),a=[];n||a.push((function(){return"writable"===t._state?zr(t,r):$e(void 0)})),i||a.push((function(){return"readable"===e._state?Yn(e,r):$e(void 0)})),v((function(){return Promise.all(a.map((function(e){return e()})))}),!0,r)},a.aborted)return void p();a.addEventListener("abort",p)}if(b(e,o._closedPromise,(function(e){n?w(!0,e):v((function(){return zr(t,e)}),!0,e)})),b(t,s._closedPromise,(function(t){i?w(!0,t):v((function(){return Yn(e,t)}),!0,t)})),f=e,d=o._closedPromise,m=function(){r?w():v((function(){return function(e){var t=e._ownerWritableStream,r=t._state;return Vr(t)||"closed"===r?$e(void 0):"errored"===r?Xe(t._storedError):Yr(e)}(s)}))},"closed"===f._state?m():tt(d,m),Vr(t)||"closed"===t._state){var g=new TypeError("the destination writable stream closed before all data could be piped to it");i?w(!0,g):v((function(){return Yn(e,g)}),!0,g)}function y(){var e=c;return Ze(c,(function(){return e!==c?y():void 0}))}function b(e,t,r){"errored"===e._state?r(e._storedError):rt(t,r)}function v(e,r,n){function i(){et(e(),(function(){return _(r,n)}),(function(e){return _(!0,e)}))}u||(u=!0,"writable"!==t._state||Vr(t)?i():tt(y(),i))}function w(e,r){u||(u=!0,"writable"!==t._state||Vr(t)?_(e,r):tt(y(),(function(){return _(e,r)})))}function _(e,t){Zr(s),ht(o),void 0!==a&&a.removeEventListener("abort",p),e?h(t):l(void 0)}it(Ye((function(e,t){!function r(n){n?e():Ze(u?$e(!0):Ze(s._readyPromise,(function(){return Ye((function(e,t){Ut(o,{_chunkSteps:function(t){c=Ze(en(s,t),void 0,qe),e(!1)},_closeSteps:function(){return e(!0)},_errorSteps:t})}))})),r,t)}(!1)})))}))}var jn=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Tn(this))throw Ln("desiredSize");return Dn(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!Tn(this))throw Ln("close");if(!Mn(this))throw new TypeError("The stream is not in a state that permits close");On(this)},e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!Tn(this))throw Ln("enqueue");if(!Mn(this))throw new TypeError("The stream is not in a state that permits enqueue");return In(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!Tn(this))throw Ln("error");Pn(this,e)},e.prototype[vt]=function(e){$t(this);var t=this._cancelAlgorithm(e);return Rn(this),t},e.prototype[wt]=function(e){var t=this._controlledReadableStream;if(this._queue.length>0){var r=Qt(this);this._closeRequested&&0===this._queue.length?(Rn(this),$n(t)):Cn(this),e._chunkSteps(r)}else It(t,e),Cn(this)},e}();function Tn(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function Cn(e){Bn(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,et(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Cn(e))}),(function(t){Pn(e,t)}))))}function Bn(e){var t=e._controlledReadableStream;return!!Mn(e)&&(!!e._started&&(!!(Qn(t)&&Dt(t)>0)||Dn(e)>0))}function Rn(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function On(e){if(Mn(e)){var t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Rn(e),$n(t))}}function In(e,t){if(Mn(e)){var r=e._controlledReadableStream;if(Qn(r)&&Dt(r)>0)Pt(r,t,!1);else{var n=void 0;try{n=e._strategySizeAlgorithm(t)}catch(t){throw Pn(e,t),t}try{Yt(e,t,n)}catch(t){throw Pn(e,t),t}}Cn(e)}}function Pn(e,t){var r=e._controlledReadableStream;"readable"===r._state&&($t(e),Rn(e),Xn(r,t))}function Dn(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Mn(e){var t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Fn(e,t,r,n,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,$t(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,e._readableStreamController=t,et($e(r()),(function(){t._started=!0,Cn(t)}),(function(e){Pn(t,e)}))}function Ln(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function Nn(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function zn(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function Un(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function qn(e,t){if("bytes"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamType");return e}function Hn(e,t){if("byob"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamReaderMode");return e}function Gn(e,t){xt(e,t);var r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,i=null==e?void 0:e.preventClose,a=null==e?void 0:e.signal;return void 0!==a&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(t+" is not an AbortSignal.")}(a,t+" has member 'signal' that"),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(i),signal:a}}Object.defineProperties(jn.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(jn.prototype,Ue.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var Vn=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:At(e,"First parameter");var r=Tr(t,"Second parameter"),n=function(e,t){xt(e,t);var r=e,n=null==r?void 0:r.autoAllocateChunkSize,i=null==r?void 0:r.cancel,a=null==r?void 0:r.pull,o=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Bt(n,t+" has member 'autoAllocateChunkSize' that"),cancel:void 0===i?void 0:Nn(i,r,t+" has member 'cancel' that"),pull:void 0===a?void 0:zn(a,r,t+" has member 'pull' that"),start:void 0===o?void 0:Un(o,r,t+" has member 'start' that"),type:void 0===s?void 0:qn(s,t+" has member 'type' that")}}(e,"First parameter");if(Kn(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");yr(this,n,Sr(r,0))}else{var i=jr(r);!function(e,t,r,n){var i=Object.create(jn.prototype),a=function(){},o=function(){return $e(void 0)},s=function(){return $e(void 0)};void 0!==t.start&&(a=function(){return t.start(i)}),void 0!==t.pull&&(o=function(){return t.pull(i)}),void 0!==t.cancel&&(s=function(e){return t.cancel(e)}),Fn(e,i,a,o,s,r,n)}(this,n,Sr(r,1),i)}}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Jn(this))throw Zn("locked");return Qn(this)},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Jn(this)?Qn(this)?Xe(new TypeError("Cannot cancel a stream that already has a reader")):Yn(this,e):Xe(Zn("cancel"))},e.prototype.getReader=function(e){if(void 0===e&&(e=void 0),!Jn(this))throw Zn("getReader");return void 0===function(e,t){xt(e,t);var r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Hn(r,t+" has member 'mode' that")}}(e,"First parameter").mode?Ot(this):new xr(this)},e.prototype.pipeThrough=function(e,t){if(void 0===t&&(t={}),!Jn(this))throw Zn("pipeThrough");St(e,1,"pipeThrough");var r=function(e,t){xt(e,t);var r=null==e?void 0:e.readable;jt(r,"readable","ReadableWritablePair"),Rt(r,t+" has member 'readable' that");var n=null==e?void 0:e.writable;return jt(n,"writable","ReadableWritablePair"),Pr(n,t+" has member 'writable' that"),{readable:r,writable:n}}(e,"First parameter"),n=Gn(t,"Second parameter");if(Qn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Nr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return it(Sn(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable},e.prototype.pipeTo=function(e,t){if(void 0===t&&(t={}),!Jn(this))return Xe(Zn("pipeTo"));if(void 0===e)return Xe("Parameter 1 is required in 'pipeTo'.");if(!Lr(e))return Xe(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var r;try{r=Gn(t,"Second parameter")}catch(e){return Xe(e)}return Qn(this)?Xe(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Nr(e)?Xe(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Sn(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)},e.prototype.tee=function(){if(!Jn(this))throw Zn("tee");var e=function(e,t){var r,n,i,a,o,s=Ot(e),u=!1,c=!1,l=!1,h=Ye((function(e){o=e}));function p(){return u||(u=!0,Ut(s,{_chunkSteps:function(e){at((function(){u=!1;var t=e,r=e;c||In(i._readableStreamController,t),l||In(a._readableStreamController,r)}))},_closeSteps:function(){u=!1,c||On(i._readableStreamController),l||On(a._readableStreamController),c&&l||o(void 0)},_errorSteps:function(){u=!1}})),$e(void 0)}function f(){}return i=Wn(f,p,(function(t){if(c=!0,r=t,l){var i=Xt([r,n]),a=Yn(e,i);o(a)}return h})),a=Wn(f,p,(function(t){if(l=!0,n=t,c){var i=Xt([r,n]),a=Yn(e,i);o(a)}return h})),rt(s._closedPromise,(function(e){Pn(i._readableStreamController,e),Pn(a._readableStreamController,e),c&&l||o(void 0)})),[i,a]}(this);return Xt(e)},e.prototype.values=function(e){if(void 0===e&&(e=void 0),!Jn(this))throw Zn("values");var t,r,n,i,a,o=function(e,t){xt(e,t);var r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e,"First parameter");return t=this,r=o.preventCancel,n=Ot(t),i=new Ht(n,r),(a=Object.create(Gt))._asyncIteratorImpl=i,a},e}();function Wn(e,t,r,n,i){void 0===n&&(n=1),void 0===i&&(i=function(){return 1});var a=Object.create(Vn.prototype);return Kn(a),Fn(a,Object.create(jn.prototype),e,t,r,n,i),a}function Kn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Jn(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Qn(e){return void 0!==e._reader}function Yn(e,t){return e._disturbed=!0,"closed"===e._state?$e(void 0):"errored"===e._state?Xe(e._storedError):($n(e),nt(e._readableStreamController[vt](t),qe))}function $n(e){e._state="closed";var t=e._reader;void 0!==t&&(gt(t),zt(t)&&(t._readRequests.forEach((function(e){e._closeSteps()})),t._readRequests=new ut))}function Xn(e,t){e._state="errored",e._storedError=t;var r=e._reader;void 0!==r&&(mt(r,t),zt(r)?(r._readRequests.forEach((function(e){e._errorSteps(t)})),r._readRequests=new ut):(r._readIntoRequests.forEach((function(e){e._errorSteps(t)})),r._readIntoRequests=new ut))}function Zn(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function ei(e,t){xt(e,t);var r=null==e?void 0:e.highWaterMark;return jt(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Tt(r)}}Object.defineProperties(Vn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Vn.prototype,Ue.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof Ue.asyncIterator&&Object.defineProperty(Vn.prototype,Ue.asyncIterator,{value:Vn.prototype.values,writable:!0,configurable:!0});var ti=function(e){return e.byteLength},ri=function(){function e(e){St(e,1,"ByteLengthQueuingStrategy"),e=ei(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ii(this))throw ni("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ii(this))throw ni("size");return ti},enumerable:!1,configurable:!0}),e}();function ni(e){return new TypeError("ByteLengthQueuingStrategy.prototype."+e+" can only be used on a ByteLengthQueuingStrategy")}function ii(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(ri.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(ri.prototype,Ue.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var ai=function(){return 1},oi=function(){function e(e){St(e,1,"CountQueuingStrategy"),e=ei(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ui(this))throw si("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ui(this))throw si("size");return ai},enumerable:!1,configurable:!0}),e}();function si(e){return new TypeError("CountQueuingStrategy.prototype."+e+" can only be used on a CountQueuingStrategy")}function ui(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function ci(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function li(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function hi(e,t,r){return Et(e,r),function(r,n){return st(e,t,[r,n])}}Object.defineProperties(oi.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(oi.prototype,Ue.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var pi=function(){function e(e,t,r){void 0===e&&(e={}),void 0===t&&(t={}),void 0===r&&(r={}),void 0===e&&(e=null);var n=Tr(t,"Second parameter"),i=Tr(r,"Third parameter"),a=function(e,t){xt(e,t);var r=null==e?void 0:e.flush,n=null==e?void 0:e.readableType,i=null==e?void 0:e.start,a=null==e?void 0:e.transform,o=null==e?void 0:e.writableType;return{flush:void 0===r?void 0:ci(r,e,t+" has member 'flush' that"),readableType:n,start:void 0===i?void 0:li(i,e,t+" has member 'start' that"),transform:void 0===a?void 0:hi(a,e,t+" has member 'transform' that"),writableType:o}}(e,"First parameter");if(void 0!==a.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==a.writableType)throw new RangeError("Invalid writableType specified");var o,s=Sr(i,0),u=jr(i),c=Sr(n,1),l=jr(n);!function(e,t,r,n,i,a){function o(){return t}e._writable=function(e,t,r,n,i,a){void 0===i&&(i=1),void 0===a&&(a=function(){return 1});var o=Object.create(Dr.prototype);return Fr(o),nn(o,Object.create(rn.prototype),e,t,r,n,i,a),o}(o,(function(t){return function(e,t){var r=e._transformStreamController;if(e._backpressure){return nt(e._backpressureChangePromise,(function(){var n=e._writable;if("erroring"===n._state)throw n._storedError;return _i(r,t)}))}return _i(r,t)}(e,t)}),(function(){return function(e){var t=e._readable,r=e._transformStreamController,n=r._flushAlgorithm();return vi(r),nt(n,(function(){if("errored"===t._state)throw t._storedError;On(t._readableStreamController)}),(function(r){throw di(e,r),t._storedError}))}(e)}),(function(t){return function(e,t){return di(e,t),$e(void 0)}(e,t)}),r,n),e._readable=Wn(o,(function(){return function(e){return gi(e,!1),e._backpressureChangePromise}(e)}),(function(t){return mi(e,t),$e(void 0)}),i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,gi(e,!0),e._transformStreamController=void 0}(this,Ye((function(e){o=e})),c,l,s,u),function(e,t){var r=Object.create(yi.prototype),n=function(e){try{return wi(r,e),$e(void 0)}catch(e){return Xe(e)}},i=function(){return $e(void 0)};void 0!==t.transform&&(n=function(e){return t.transform(e,r)});void 0!==t.flush&&(i=function(){return t.flush(r)});!function(e,t,r,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n}(e,r,n,i)}(this,a),void 0!==a.start?o(a.start(this._transformStreamController)):o(void 0)}return Object.defineProperty(e.prototype,"readable",{get:function(){if(!fi(this))throw xi("readable");return this._readable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"writable",{get:function(){if(!fi(this))throw xi("writable");return this._writable},enumerable:!1,configurable:!0}),e}();function fi(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function di(e,t){Pn(e._readable._readableStreamController,t),mi(e,t)}function mi(e,t){vi(e._transformStreamController),un(e._writable._writableStreamController,t),e._backpressure&&gi(e,!1)}function gi(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Ye((function(t){e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(pi.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(pi.prototype,Ue.toStringTag,{value:"TransformStream",configurable:!0});var yi=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!bi(this))throw ki("desiredSize");return Dn(this._controlledTransformStream._readable._readableStreamController)},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!bi(this))throw ki("enqueue");wi(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!bi(this))throw ki("error");var t;t=e,di(this._controlledTransformStream,t)},e.prototype.terminate=function(){if(!bi(this))throw ki("terminate");!function(e){var t=e._controlledTransformStream;On(t._readable._readableStreamController);var r=new TypeError("TransformStream terminated");mi(t,r)}(this)},e}();function bi(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function vi(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function wi(e,t){var r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Mn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{In(n,t)}catch(e){throw mi(r,e),r._readable._storedError}(function(e){return!Bn(e)})(n)!==r._backpressure&&gi(r,!0)}function _i(e,t){return nt(e._transformAlgorithm(t),void 0,(function(t){throw di(e._controlledTransformStream,t),t}))}function ki(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function xi(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}Object.defineProperties(yi.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(yi.prototype,Ue.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Ei={ReadableStream:Vn,ReadableStreamDefaultController:jn,ReadableByteStreamController:er,ReadableStreamBYOBRequest:Zt,ReadableStreamDefaultReader:Nt,ReadableStreamBYOBReader:xr,WritableStream:Dr,WritableStreamDefaultController:rn,WritableStreamDefaultWriter:Jr,ByteLengthQueuingStrategy:ri,CountQueuingStrategy:oi,TransformStream:pi,TransformStreamDefaultController:yi};if(void 0!==He)for(var Ai in Ei)Object.prototype.hasOwnProperty.call(Ei,Ai)&&Object.defineProperty(He,Ai,{value:Ei[Ai],writable:!0,configurable:!0});delete global.ReadableStream;let Si,ji,Ti;Si=Symbol.asyncIterator;ji=Symbol.toStringTag;Ti=Symbol.toStringTag;(!m||!("TextEncoder"in y))&&(y.TextEncoder=F);(!m||!("TextDecoder"in y))&&(y.TextDecoder=M),m||"atob"in y||!ae||(y.atob=ae),m||"btoa"in y||!oe||(y.btoa=oe),m||"Headers"in y||!ue||(y.Headers=ue),m||"Response"in y||!Te||(y.Response=Te),m||"fetch"in y||!Be||(y.fetch=Be),m||"DOMParser"in y||!d.DOMParser||(y.DOMParser=d.DOMParser),m||"_encodeImageNode"in y||!De||(y._encodeImageNode=De),m||"_parseImageNode"in y||!ze||(y._parseImageNode=ze),"allSettled"in Promise||(Promise.allSettled=function(e){const t=e.map(e=>e.then(e=>({status:"fulfilled",value:e})).catch(e=>({status:"rejected",reason:e})));return Promise.all(t)});var Ci=r(1),Bi=r(22),Ri=r.n(Bi),Oi=r(7),Ii=r.n(Oi);"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof global&&global,"undefined"!=typeof document&&document;const Pi=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),Di="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version),Mi=(Di&&parseFloat(Di[1]),e=>"boolean"==typeof e),Fi=e=>"function"==typeof e,Li=e=>null!==e&&"object"==typeof e,Ni=e=>Li(e)&&e.constructor==={}.constructor,zi=e=>e&&"function"==typeof e[Symbol.iterator],Ui=e=>e&&"function"==typeof e[Symbol.asyncIterator],qi=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,Hi=e=>"undefined"!=typeof Blob&&e instanceof Blob,Gi=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Li(e)&&Fi(e.tee)&&Fi(e.cancel)&&Fi(e.getReader))(e)||(e=>Li(e)&&Fi(e.read)&&Fi(e.pipe)&&Mi(e.readable))(e);function Vi(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Wi(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function Ki(e){var t,r;let n;return Vi(e,"null loader"),Vi(Wi(e),"invalid loader"),Array.isArray(e)&&(n=e[1],e=e[0],e={...e,options:{...e.options,...n}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(r=e)&&void 0!==r&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}let Ji="";const Qi={};function Yi(e){for(const t in Qi)if(e.startsWith(t)){const r=Qi[t];e=e.replace(t,r)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${Ji}${e}`),e}const $i=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Xi=/^([-\w.]+\/[-\w.+]+)/;function Zi(e){const t=Xi.exec(e);return t?t[1]:e}function ea(e){const t=$i.exec(e);return t?t[1]:""}const ta=/\?.*/;function ra(e){if(qi(e)){const t=na(e.url||"");return{url:t,type:Zi(e.headers.get("content-type")||"")||ea(t)}}return Hi(e)?{url:na(e.name||""),type:e.type||""}:"string"==typeof e?{url:na(e),type:ea(e)}:{url:"",type:""}}function na(e){return e.replace(ta,"")}async function ia(e){if(qi(e))return e;const t={},r=function(e){return qi(e)?e.headers["content-length"]||-1:Hi(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);r>=0&&(t["content-length"]=String(r));const{url:n,type:i}=ra(e);i&&(t["content-type"]=i);const a=await async function(e){if("string"==typeof e)return"data:,"+e.slice(0,5);if(e instanceof Blob){const t=e.slice(0,5);return await new Promise(e=>{const r=new FileReader;r.onload=t=>{var r;return e(null==t||null===(r=t.target)||void 0===r?void 0:r.result)},r.readAsDataURL(t)})}if(e instanceof ArrayBuffer){const t=e.slice(0,5);return"data:base64,"+function(e){let t="";const r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)t+=String.fromCharCode(r[e]);return btoa(t)}(t)}return null}(e);a&&(t["x-first-bytes"]=a),"string"==typeof e&&(e=(new TextEncoder).encode(e));const o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function aa(e){if(!e.ok){const t=await async function(e){let t=`Failed to fetch resource ${e.url} (${e.status}): `;try{const r=e.headers.get("Content-Type");let n=e.statusText;r.includes("application/json")&&(n+=" "+await e.text()),t+=n,t=t.length>60?t.slice(0,60)+"...":t}catch(e){}return t}(e);throw new Error(t)}}async function oa(e,t){if("string"==typeof e){e=Yi(e);let r=t;return null!=t&&t.fetch&&"function"!=typeof(null==t?void 0:t.fetch)&&(r=t.fetch),await fetch(e,r)}return await ia(e)}const sa=new(r(546).a)({id:"loaders.gl"});class ua{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const ca={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var e,t,r;r=void 0,(t="console")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Pi,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},la={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function ha(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const pa=()=>{const e=ha();return e.globalOptions=e.globalOptions||{...ca},e.globalOptions};function fa(e,t,r,n){return r=r||[],function(e,t){ma(e,null,ca,la,t);for(const r of t){const n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};ma(n,r.id,i,a,t)}}(e,r=Array.isArray(r)?r:[r]),ya(t,e,n)}function da(e,t){const r=pa(),n=e||r;return"function"==typeof n.fetch?n.fetch:Li(n.fetch)?e=>oa(e,n):null!=t&&t.fetch?null==t?void 0:t.fetch:oa}function ma(e,t,r,n,i){const a=t||"Top level",o=t?t+".":"";for(const s in e){const u=!t&&Li(e[s]),c="baseUri"===s&&!t,l="workerUrl"===s&&t;if(!(s in r)&&!c&&!l)if(s in n)sa.warn(`${a} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u){const e=ga(s,i);sa.warn(`${a} loader option '${o}${s}' not recognized. ${e}`)()}}}function ga(e,t){const r=e.toLowerCase();let n="";for(const i of t)for(const t in i.options){if(e===t)return`Did you mean '${i.id}.${t}'?`;const a=t.toLowerCase();(r.startsWith(a)||a.startsWith(r))&&(n=n||`Did you mean '${i.id}.${t}'?`)}return n}function ya(e,t,r){const n={...e.options||{}};return function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}(n,r),null===n.log&&(n.log=new ua),ba(n,pa()),ba(n,t),n}function ba(e,t){for(const r in t)if(r in t){const n=t[r];Ni(n)&&Ni(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function va(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const wa={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},_a=wa.global||wa.self||wa.window||{},ka="object"!=typeof process||"[object process]"!==String(process)||process.browser,xa="function"==typeof importScripts,Ea="undefined"!=typeof window&&void 0!==window.orientation,Aa="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);Aa&&parseFloat(Aa[1]);var Sa=r(545);const ja=new Map;function Ta(e){va(e.source&&!e.url||!e.source&&e.url);let t=ja.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return Ca((t=e,`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var t}(e.url),ja.set(e.url,t)),e.source&&(t=Ca(e.source),ja.set(e.source,t))),va(t),t}function Ca(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function Ba(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}function Ra(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oa=()=>{};class Ia{static isSupported(){return"undefined"!=typeof Worker&&ka||void 0!==Sa.Worker&&!ka}constructor(e){Ra(this,"name",void 0),Ra(this,"source",void 0),Ra(this,"url",void 0),Ra(this,"terminated",!1),Ra(this,"worker",void 0),Ra(this,"onMessage",void 0),Ra(this,"onError",void 0),Ra(this,"_loadableURL","");const{name:t,source:r,url:n}=e;va(r||n),this.name=t,this.source=r,this.url=n,this.onMessage=Oa,this.onError=e=>console.log(e),this.worker=ka?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Oa,this.onError=Oa,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||function e(t,r=!0,n){const i=n||new Set;if(t){if(Ba(t))i.add(t);else if(Ba(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"==typeof t)for(const n in t)e(t[n],r,i)}else;return void 0===n?Array.from(i):[]}(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=e.message+" in "),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=Ta({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./"+this.url;e=new Sa.Worker(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new Sa.Worker(this.source,{eval:!0})}return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}function Pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Da{constructor(e,t){Pa(this,"name",void 0),Pa(this,"workerThread",void 0),Pa(this,"isRunning",!0),Pa(this,"result",void 0),Pa(this,"_resolve",()=>{}),Pa(this,"_reject",()=>{}),this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){va(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){va(this.isRunning),this.isRunning=!1,this._reject(e)}}function Ma(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Fa{static isSupported(){return Ia.isSupported()}constructor(e){Ma(this,"name","unnamed"),Ma(this,"source",void 0),Ma(this,"url",void 0),Ma(this,"maxConcurrency",1),Ma(this,"maxMobileConcurrency",1),Ma(this,"onDebug",()=>{}),Ma(this,"reuseWorkers",!0),Ma(this,"props",{}),Ma(this,"jobQueue",[]),Ma(this,"idleQueue",[]),Ma(this,"count",0),Ma(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,r)=>e.done(r)),r=((e,t)=>e.error(t))){const n=new Promise(n=>(this.jobQueue.push({name:e,onMessage:t,onError:r,onStart:n}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const r=new Da(t.name,e);e.onMessage=e=>t.onMessage(r,e.type,e.payload),e.onError=e=>t.onError(r,e),t.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Ia({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Ea?this.maxMobileConcurrency:this.maxConcurrency}}function La(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Na={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class za{static isSupported(){return Ia.isSupported()}static getWorkerFarm(e={}){return za._workerFarm=za._workerFarm||new za({}),za._workerFarm.setProps(e),za._workerFarm}constructor(e){La(this,"props",void 0),La(this,"workerPools",new Map),this.props={...Na},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:r,url:n}=e;let i=this.workerPools.get(t);return i||(i=new Fa({name:t,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}La(za,"_workerFarm",void 0);function Ua(e,t={}){const r=t[e.id]||{},n=e.id+"-worker.js";let i=r.workerUrl;if(i||"compression"!==e.id||(i=t.workerUrl),"test"===t._workerType&&(i=`modules/${e.module}/dist/${n}`),!i){let t=e.version;"latest"===t&&(t="beta");const r=t?"@"+t:"";i=`https://unpkg.com/@loaders.gl/${e.module}${r}/dist/${n}`}return va(i),i}async function qa(e,t,r,n,i){const a=e.id,o=Ua(e,r),s=za.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));const u=await s.startJob("process-on-worker",Ha.bind(null,i));u.postMessage("process",{input:t,options:r,context:n});const c=await u.result;return await c.result}async function Ha(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{const r=await e(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}function Ga(e){if(ArrayBuffer.isView(e)&&(e=e.buffer),"undefined"!=typeof Buffer&&e instanceof ArrayBuffer){const t=new Buffer(e.byteLength),r=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=r[e];return t}return Vi(!1)}function Va(e){return e&&"object"==typeof e&&e.isBuffer}function Wa(e){return Ga?Ga(e):e}function Ka(e){if(Va(e))return function(e){if(Va(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Ja(...e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}function Qa(...e){const t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');const n=new r(t.reduce((e,t)=>e+t.length,0));let i=0;for(const e of t)n.set(e,i),i+=e.length;return n}function Ya(e,t,r){const n=void 0!==r?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}async function $a(e){const t=[];for await(const r of e)t.push(r);return Ja(...t)}const Xa=262144;function Za(e,t){return Pi?async function*(e,t){const r=e.getReader();let n;try{for(;;){const e=n||r.read();null!=t&&t._streamReadAhead&&(n=r.read());const{done:i,value:a}=await e;if(i)return;yield Ka(a)}}catch(e){r.releaseLock()}}(e,t):async function*(e,t){for await(const t of e)yield Ka(t)}(e)}function eo(e,t){if("string"==typeof e)return function*(e,t){const r=(null==t?void 0:t.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<e.length;){const t=Math.min(e.length-n,r),a=e.slice(n,n+t);n+=t,yield i.encode(a)}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){const{chunkSize:r=Xa}=t;let n=0;for(;n<e.byteLength;){const t=Math.min(e.byteLength-n,r),i=new ArrayBuffer(t),a=new Uint8Array(e,n,t);new Uint8Array(i).set(a),n+=t,yield i}}(e,t);if(Hi(e))return async function*(e,t){const r=(null==t?void 0:t.chunkSize)||1048576;let n=0;for(;n<e.size;){const t=n+r,i=await e.slice(n,t).arrayBuffer();n=t,yield i}}(e,t);if(Gi(e))return Za(e,t);if(qi(e)){return Za(e.body,t)}throw new Error("makeIterator")}const to="Cannot convert supplied data type";async function ro(e,t,r){const n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||n)return function(e,t,r){if(t.text&&"string"==typeof e)return e;var n;if((n=e)&&"object"==typeof n&&n.isBuffer&&(e=e.buffer),e instanceof ArrayBuffer){const r=e;if(t.text&&!t.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary){return new TextDecoder("utf8").decode(e)}let r=e.buffer;const n=e.byteLength||e.length;return 0===e.byteOffset&&n===r.byteLength||(r=r.slice(e.byteOffset,e.byteOffset+n)),r}throw new Error(to)}(e,t);if(Hi(e)&&(e=await ia(e)),qi(e)){const r=e;return await aa(r),t.binary?await r.arrayBuffer():await r.text()}if(Gi(e)&&(e=eo(e,r)),zi(e)||Ui(e))return $a(e);throw new Error(to)}function no(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}function io(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}function ao(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(new RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t))).join("/")}const oo=Le.promisify;let so,uo,co,lo,ho,po,fo,mo,go,yo,bo=Boolean(de.a);try{so=oo(de.a.readdir),uo=oo(de.a.stat),co=oo(de.a.readFile),lo=de.a.readFileSync,ho=oo(de.a.writeFile),po=de.a.writeFileSync,fo=oo(de.a.open),mo=oo(de.a.close),go=oo(de.a.read),yo=oo(de.a.fstat),bo=Boolean(de.a)}catch{}async function vo(e,t,r){const n=Buffer.alloc(r),{bytesRead:i}=await go(e,n,0,r,t);if(i!==r)throw new Error("fs.read failed");return function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(n)}function wo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _o(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}const ko="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";_o();class xo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";wo(this,"storage",void 0),wo(this,"id",void 0),wo(this,"config",{}),this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function Eo(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}let Ao;function So(e){return"string"==typeof e?Ao[e.toUpperCase()]||Ao.WHITE:e}function jo(e,t){if(!e)throw new Error(t||"Assertion failed")}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Ao||(Ao={}));const To={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},Co=(globalThis,To.window||To.self||To.global),Bo=To.process||{};console;function Ro(){let e;var t,r;if(_o&&"performance"in Co)e=null==Co||null===(t=Co.performance)||void 0===t||null===(r=t.now)||void 0===r?void 0:r.call(t);else if("hrtime"in Bo){var n;const t=null==Bo||null===(n=Bo.hrtime)||void 0===n?void 0:n.call(Bo);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Oo={debug:_o&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Io={enabled:!0,level:0};function Po(){}const Do={},Mo={once:!0};class Fo{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};wo(this,"id",void 0),wo(this,"VERSION",ko),wo(this,"_startTs",Ro()),wo(this,"_deltaTs",Ro()),wo(this,"_storage",void 0),wo(this,"userData",{}),wo(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new xo("__probe-".concat(this.id,"__"),Io),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ro()-this._startTs).toPrecision(10))}getDelta(){return Number((Ro()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){jo(e,t)}warn(e){return this._getLogFunction(0,e,Oo.warn,arguments,Mo)}error(e){return this._getLogFunction(0,e,Oo.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Oo.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Oo.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return this._getLogFunction(e,t,Oo.debug||Oo.info,arguments,Mo)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||Po,r&&[r],{tag:zo(t)}):Po}image(e){let{logLevel:t,priority:n,image:i,message:a="",scale:o=1}=e;return this._shouldLog(t||n)?_o?function(e){let{image:t,message:r="",scale:n=1}=e;if("string"==typeof t){const e=new Image;return e.onload=()=>{const t=Eo(e,r,n);console.log(...t)},e.src=t,Po}const i=t.nodeName||"";if("img"===i.toLowerCase())return console.log(...Eo(t,r,n)),Po;if("canvas"===i.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...Eo(e,r,n)),e.src=t.toDataURL(),Po}return Po}({image:i,message:a,scale:o}):function(e){let{image:t,message:n="",scale:i=1}=e,a=null;try{a=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(a)return()=>a(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then(e=>console.log(e));return Po}({image:i,message:a,scale:o}):Po}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Po)}group(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const n=No({logLevel:e,message:t,opts:r}),{collapsed:i}=r;return n.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Po)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Lo(e)}_getLogFunction(e,t,r,n,i){if(this._shouldLog(e)){i=No({logLevel:e,message:t,args:n,opts:i}),jo(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Ro();const a=i.tag||i.message;if(i.once){if(Do[a])return Po;Do[a]=Ro()}return t=function(e,t,r){if("string"==typeof t){const o=r.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(o," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,a=r.background,_o||"string"!=typeof n||(i&&(i=So(i),n="[".concat(i,"m").concat(n,"[39m")),a&&(i=So(a),n="[".concat(a+10,"m").concat(n,"[49m"))),t=n}var n,i,a;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return Po}}function Lo(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return jo(Number.isFinite(t)&&t>=0),t}function No(e){const{logLevel:t,message:r}=e;e.logLevel=Lo(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return jo("string"===i||"object"===i),Object.assign(e,{args:n},e.opts)}function zo(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}wo(Fo,"VERSION",ko);const Uo=new Fo({id:"loaders.gl"}),qo=()=>{const e=ha();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};const Ho=/\.([^.]+)$/;function Go(e,t=[],r,n){if(!Vo(e))return null;if(t&&!Array.isArray(t))return Ki(t);let i=[];t&&(i=i.concat(t)),null!=r&&r.ignoreRegisteredLoaders||i.push(...qo()),function(e){for(const t of e)Ki(t)}(i);const a=function(e,t,r,n){const{url:i,type:a}=ra(e),o=i||(null==n?void 0:n.url);let s=null,u="";null!=r&&r.mimeType&&(s=Ko(t,null==r?void 0:r.mimeType),u="match forced by supplied MIME type "+(null==r?void 0:r.mimeType));var c;s=s||function(e,t){const r=t&&Ho.exec(t),n=r&&r[1];return n?function(e,t){t=t.toLowerCase();for(const r of e)for(const e of r.extensions)if(e.toLowerCase()===t)return r;return null}(e,n):null}(t,o),u=u||(s?"matched url "+o:""),s=s||Ko(t,a),u=u||(s?"matched MIME type "+a:""),s=s||function(e,t){if(!t)return null;for(const r of e)if("string"==typeof t){if(Jo(t,r))return r}else if(ArrayBuffer.isView(t)){if(Qo(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(Qo(t,0,r))return r}return null}(t,e),u=u||(s?"matched initial data "+Yo(e):""),s=s||Ko(t,null==r?void 0:r.fallbackMimeType),u=u||(s?"matched fallback MIME type "+a:""),u&&Uo.log(1,`selectLoader selected ${null===(c=s)||void 0===c?void 0:c.name}: ${u}.`);return s}(e,i,r,n);if(!(a||null!=r&&r.nothrow))throw new Error(Wo(e));return a}function Vo(e){return!(e instanceof Response&&204===e.status)}function Wo(e){const{url:t,type:r}=ra(e);let i="No valid loader found (";i+=t?n.filename(t)+", ":"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;const a=e?Yo(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function Ko(e,t){for(const r of e){if(r.mimeTypes&&r.mimeTypes.includes(t))return r;if(t==="application/x."+r.id)return r}return null}function Jo(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}function Qo(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>function(e,t,r,n){if(n instanceof ArrayBuffer)return function(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;const n=new Uint8Array(e),i=new Uint8Array(t);for(let e=0;e<n.length;++e)if(n[e]!==i[e])return!1;return!0}(n,e,n.byteLength);switch(typeof n){case"function":return n(e,r);case"string":const i=$o(e,t,n.length);return n===i;default:return!1}}(e,t,r,n))}function Yo(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return $o(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return $o(e,0,t)}return""}function $o(e,t,r){if(e.byteLength<t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}async function Xo(e,t,r,n){va(!n||"object"==typeof n),!t||Array.isArray(t)||Wi(t)||(n=void 0,r=t,t=void 0),e=await e,r=r||{};const{url:i}=ra(e),a=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...e]:e}return r&&r.length?r:null}(t,n),o=await async function(e,t=[],r,n){if(!Vo(e))return null;let i=Go(e,t,{...r,nothrow:!0},n);if(i)return i;if(Hi(e)&&(i=Go(e=await e.slice(0,10).arrayBuffer(),t,r,n)),!(i||null!=r&&r.nothrow))throw new Error(Wo(e));return i}(e,a,r);return o?(n=function(e,t,r=null){if(r)return r;const n={fetch:da(t,e),...e};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:i,parse:Xo,loaders:a},r=fa(r,o,a,i),n),await async function(e,t,r,n){if(function(e,t="3.3.0-alpha.4"){va(e,"no worker provided");const r=e.version}(e),qi(t)){const e=t,{ok:r,redirected:i,status:a,statusText:o,type:s,url:u}=e,c=Object.fromEntries(e.headers.entries());n.response={headers:c,ok:r,redirected:i,status:a,statusText:o,type:s,url:u}}if(t=await ro(t,e,r),e.parseTextSync&&"string"==typeof t)return r.dataType="text",e.parseTextSync(t,r,n,e);if(function(e,t){return!!za.isSupported()&&(!!(ka||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(e,r))return await qa(e,t,r,n,Xo);if(e.parseText&&"string"==typeof t)return await e.parseText(t,r,n,e);if(e.parse)return await e.parse(t,r,n,e);throw va(!e.parseSync),new Error(e.id+" loader - no parser found and worker is disabled")}(o,e,r,n)):null}async function Zo(e,t,r,n){Array.isArray(t)||Wi(t)||(void 0,r=t,t=void 0);const i=da(r);let a=e;return"string"==typeof e&&(a=await i(e)),Hi(e)&&(a=await i(e)),await Xo(a,t,r)}function es(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}const ts=1/Math.PI*180,rs=1/180*Math.PI,ns={};function is(e,{precision:t=ns.precision||4}={}){return e=function(e){return Math.round(e/ns.EPSILON)*ns.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function as(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function os(e,t,r){if(as(e)){r=r||((n=e).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<e.length;++n)r[n]=t(e[n],n,r);return r}var n;return t(e)}function ss(e){return function(e,t){return os(e,e=>e*rs,t)}(e)}function us(e){return cs(e)}function cs(e,t){return os(e,e=>e*ts,t)}function ls(e,t,r){return os(e,e=>Math.max(t,Math.min(r,e)))}function hs(e,t,r){const n=ns.EPSILON;r&&(ns.EPSILON=r);try{if(e===t)return!0;if(as(e)&&as(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!hs(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=ns.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{ns.EPSILON=n}}ns.EPSILON=1e-12,ns.debug=!1,ns.precision=4,ns.printTypes=!1,ns.printDegrees=!1,ns.printRowMajor=!0;class ps extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){get ELEMENTS(){return es(!1),0}clone(){return(new this.constructor).copy(this)}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}to(e){return e===this?this:as(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(ns)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+is(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!hs(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){void 0===r&&(r=t,t=e,e=this);for(let n=0;n<this.ELEMENTS;++n){const i=e[n];this[n]=i+r*(t[n]-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if(Array.isArray(e))return this.multiply(e);for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.scale(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}multiplyByScalar(e){return this.scale(e)}get elements(){return this}check(){if(ns.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}function fs(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function ds(e,t,r=""){if(ns.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}const ms={};function gs(e,t){ms[e]||(ms[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}class ys extends ps{get ELEMENTS(){return es(!1),0}copy(e){return es(!1),this}get x(){return this[0]}set x(e){this[0]=fs(e)}get y(){return this[1]}set y(e){this[1]=fs(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-e[r];t+=n*n}return fs(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return fs(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return es(e>=0&&e<this.ELEMENTS,"index is out of range"),fs(this[e])}setComponent(e,t){return es(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var bs=1e-6,vs="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function ws(){var e=new vs(3);return vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function _s(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function ks(e,t,r){var n=new vs(3);return n[0]=e,n[1]=t,n[2]=r,n}function xs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Es(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function As(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function Ss(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function js(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,h=a*s-n*c,p=n*u-i*s,f=i*p-a*h,d=a*l-n*p,m=n*h-i*l,g=2*o;return l*=g,h*=g,p*=g,f*=2,d*=2,m*=2,e[0]=s+l+f,e[1]=u+h+d,e[2]=c+p+m,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ts,Cs=_s;Ts=ws();function Bs(e,t,r){const n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function Rs(e,t,r){const n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function Os(e,t,r){const n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}const Is=[0,0,0],Ps={};class Ds extends ys{static get ZERO(){return Ps.ZERO=Ps.ZERO||Object.freeze(new Ds(0,0,0,0))}constructor(e=0,t=0,r=0){super(-0,-0,-0),1===arguments.length&&as(e)?this.copy(e):(ns.debug&&(fs(e),fs(t),fs(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y),fs(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=fs(e)}angle(e){return r=e,n=(t=this)[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=Math.sqrt(n*n+i*i+a*a)*Math.sqrt(o*o+s*s+u*u),l=c&&xs(t,r)/c,Math.acos(Math.min(Math.max(l,-1),1));var t,r,n,i,a,o,s,u,c,l}cross(e){return Es(this,this,e),this.check()}rotateX({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0],s[1]=o[1]*Math.cos(a)-o[2]*Math.sin(a),s[2]=o[1]*Math.sin(a)+o[2]*Math.cos(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateY({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[2]*Math.sin(a)+o[0]*Math.cos(a),s[1]=o[1],s[2]=o[2]*Math.cos(a)-o[0]*Math.sin(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateZ({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0]*Math.cos(a)-o[1]*Math.sin(a),s[1]=o[0]*Math.sin(a)+o[1]*Math.cos(a),s[2]=o[2],r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return As(this,this,e),this.check()}transformAsVector(e){return Rs(this,this,e),this.check()}transformByMatrix3(e){return Ss(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return js(this,this,e),this.check()}}class Ms extends ps{get ELEMENTS(){return es(!1),0}get RANK(){return es(!1),0}toString(){let e="[";if(ns.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=fs(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[r+e];return t}setColumn(e,t){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)this[r+e]=t[e];return this}}function Fs(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=t[9],f=t[10],d=t[11],m=t[12],g=t[13],y=t[14],b=t[15],v=r[0],w=r[1],_=r[2],k=r[3];return e[0]=v*n+w*s+_*h+k*m,e[1]=v*i+w*u+_*p+k*g,e[2]=v*a+w*c+_*f+k*y,e[3]=v*o+w*l+_*d+k*b,v=r[4],w=r[5],_=r[6],k=r[7],e[4]=v*n+w*s+_*h+k*m,e[5]=v*i+w*u+_*p+k*g,e[6]=v*a+w*c+_*f+k*y,e[7]=v*o+w*l+_*d+k*b,v=r[8],w=r[9],_=r[10],k=r[11],e[8]=v*n+w*s+_*h+k*m,e[9]=v*i+w*u+_*p+k*g,e[10]=v*a+w*c+_*f+k*y,e[11]=v*o+w*l+_*d+k*b,v=r[12],w=r[13],_=r[14],k=r[15],e[12]=v*n+w*s+_*h+k*m,e[13]=v*i+w*u+_*p+k*g,e[14]=v*a+w*c+_*f+k*y,e[15]=v*o+w*l+_*d+k*b,e}function Ls(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ns(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(u,c,l),e}function zs(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function Us(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}!function(){var e,t=(e=new vs(2),vs!=Float32Array&&(e[0]=0,e[1]=0),e)}();function qs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function Hs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}!function(){var e,t=(e=new vs(4),vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();const Gs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Vs=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ws=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),Ks={};class Js extends Ms{static get IDENTITY(){return Ks.IDENTITY=Ks.IDENTITY||Object.freeze(new Js(Gs)),Ks.IDENTITY}static get ZERO(){return Ks.ZERO=Ks.ZERO||Object.freeze(new Js(Vs)),Ks.ZERO}get INDICES(){return Ws}get ELEMENTS(){return 16}get RANK(){return 4}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this[9]=c,this[10]=l,this[11]=h,this[12]=p,this[13]=f,this[14]=d,this[15]=m,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=i,this[2]=u,this[3]=p,this[4]=t,this[5]=a,this[6]=c,this[7]=f,this[8]=r,this[9]=o,this[10]=l,this[11]=d,this[12]=n,this[13]=s,this[14]=h,this[15]=m,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Gs)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[1]=l+y,e[2]=p-g,e[3]=0,e[4]=l-y,e[5]=1-c-d,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum({left:e,right:t,bottom:r,top:n,near:i,far:a}){return a===1/0?Js._computeInfinitePerspectiveOffCenter(this,e,t,r,n,i):function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(i-n),c=1/(a-o);e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0}(this,e,t,r,n,i,a),this.check()}static _computeInfinitePerspectiveOffCenter(e,t,r,n,i,a){const o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-2*a;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=c,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=l,e[15]=0,e}lookAt(e,t,r){return 1===arguments.length&&({eye:e,center:t,up:r}=e),function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d=t[0],m=t[1],g=t[2],y=n[0],b=n[1],v=n[2],w=r[0],_=r[1],k=r[2];Math.abs(d-w)<bs&&Math.abs(m-_)<bs&&Math.abs(g-k)<bs?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(l=d-w,h=m-_,p=g-k,i=b*(p*=f=1/Math.hypot(l,h,p))-v*(h*=f),a=v*(l*=f)-y*p,o=y*h-b*l,(f=Math.hypot(i,a,o))?(i*=f=1/f,a*=f,o*=f):(i=0,a=0,o=0),s=h*o-p*a,u=p*i-l*o,c=l*a-h*i,(f=Math.hypot(s,u,c))?(s*=f=1/f,u*=f,c*=f):(s=0,u=0,c=0),e[0]=i,e[1]=s,e[2]=l,e[3]=0,e[4]=a,e[5]=u,e[6]=h,e[7]=0,e[8]=o,e[9]=c,e[10]=p,e[11]=0,e[12]=-(i*d+a*m+o*g),e[13]=-(s*d+u*m+c*g),e[14]=-(l*d+h*m+p*g),e[15]=1)}(this,e,t=t||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:e,right:t,bottom:r,top:n,near:i=.1,far:a=500}){return function(e,t,r,n,i,a,o){var s=1/(t-r),u=1/(n-i),c=1/(a-o);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*u,e[14]=(o+a)*c,e[15]=1}(this,e,t,r,n,i,a),this.check()}orthographic({fovy:e=45*Math.PI/180,aspect:t=1,focalDistance:r=1,near:n=.1,far:i=500}){if(e>2*Math.PI)throw Error("radians");const a=e/2,o=r*Math.tan(a),s=o*t;return(new Js).ortho({left:-s,right:s,bottom:-o,top:o,near:n,far:i})}perspective({fovy:e,fov:t=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((e=e||t)>2*Math.PI)throw Error("radians");return function(e,t,r,n,i){var a,o=1/Math.tan(t/2);e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n)}(this,e,r,n,i),this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],p=e[11],f=e[12],d=e[13],m=e[14],g=e[15],(t*o-r*a)*(h*g-p*m)-(t*s-n*a)*(l*g-p*d)+(t*u-i*a)*(l*m-h*d)+(r*s-n*o)*(c*g-p*f)-(r*u-i*o)*(c*m-h*f)+(n*u-i*s)*(c*d-l*f);var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*n,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*n,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*n,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*n,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T,C,B;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],h=t[9],p=t[10],f=t[11],d=t[12],m=t[13],g=t[14],y=t[15],(B=(b=r*s-n*o)*(C=p*y-f*g)-(v=r*u-i*o)*(T=h*y-f*m)+(w=r*c-a*o)*(j=h*g-p*m)+(_=n*u-i*s)*(S=l*y-f*d)-(k=n*c-a*s)*(A=l*g-p*d)+(x=i*c-a*u)*(E=l*m-h*d))&&(B=1/B,e[0]=(s*C-u*T+c*j)*B,e[1]=(i*T-n*C-a*j)*B,e[2]=(m*x-g*k+y*_)*B,e[3]=(p*k-h*x-f*_)*B,e[4]=(u*S-o*C-c*A)*B,e[5]=(r*C-i*S+a*A)*B,e[6]=(g*w-d*x-y*v)*B,e[7]=(l*x-p*w+f*v)*B,e[8]=(o*T-s*S+c*E)*B,e[9]=(n*S-r*T-a*E)*B,e[10]=(d*k-m*w+y*b)*B,e[11]=(h*w-l*k-f*b)*B,e[12]=(s*A-o*j-u*E)*B,e[13]=(r*j-n*A+i*E)*B,e[14]=(m*v-d*_-g*b)*B,e[15]=(l*_-h*v+p*b)*B),this.check()}multiplyLeft(e){return Fs(this,e,this),this.check()}multiplyRight(e){return Fs(this,this,e),this.check()}rotateX(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[4],s=r[5],u=r[6],c=r[7],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+l*i,t[5]=s*a+h*i,t[6]=u*a+p*i,t[7]=c*a+f*i,t[8]=l*a-o*i,t[9]=h*a-s*i,t[10]=p*a-u*i,t[11]=f*a-c*i,this.check()}rotateY(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a-l*i,t[1]=s*a-h*i,t[2]=u*a-p*i,t[3]=c*a-f*i,t[8]=o*i+l*a,t[9]=s*i+h*a,t[10]=u*i+p*a,t[11]=c*i+f*a,this.check()}rotateZ(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[4],h=r[5],p=r[6],f=r[7],r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+l*i,t[1]=s*a+h*i,t[2]=u*a+p*i,t[3]=c*a+f*i,t[4]=l*a-o*i,t[5]=h*a-s*i,t[6]=p*a-u*i,t[7]=f*a-c*i,this.check()}rotateXYZ([e,t,r]){return this.rotateX(e).rotateY(t).rotateZ(r)}rotateAxis(e,t){return function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T=n[0],C=n[1],B=n[2],R=Math.hypot(T,C,B);R<bs||(T*=R=1/R,C*=R,B*=R,i=Math.sin(r),o=1-(a=Math.cos(r)),s=t[0],u=t[1],c=t[2],l=t[3],h=t[4],p=t[5],f=t[6],d=t[7],m=t[8],g=t[9],y=t[10],b=t[11],v=T*T*o+a,w=C*T*o+B*i,_=B*T*o-C*i,k=T*C*o-B*i,x=C*C*o+a,E=B*C*o+T*i,A=T*B*o+C*i,S=C*B*o-T*i,j=B*B*o+a,e[0]=s*v+h*w+m*_,e[1]=u*v+p*w+g*_,e[2]=c*v+f*w+y*_,e[3]=l*v+d*w+b*_,e[4]=s*k+h*x+m*E,e[5]=u*k+p*x+g*E,e[6]=c*k+f*x+y*E,e[7]=l*k+d*x+b*E,e[8]=s*A+h*S+m*j,e[9]=u*A+p*S+g*j,e[10]=c*A+f*S+y*j,e[11]=l*A+d*S+b*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return Array.isArray(e)?Ls(this,this,e):Ls(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b;return t=this,r=this,g=(n=e)[0],y=n[1],b=n[2],r===t?(t[12]=r[0]*g+r[4]*y+r[8]*b+r[12],t[13]=r[1]*g+r[5]*y+r[9]*b+r[13],t[14]=r[2]*g+r[6]*y+r[10]*b+r[14],t[15]=r[3]*g+r[7]*y+r[11]*b+r[15]):(i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=r[9],d=r[10],m=r[11],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=l,t[7]=h,t[8]=p,t[9]=f,t[10]=d,t[11]=m,t[12]=i*g+u*y+p*b+r[12],t[13]=a*g+c*y+f*b+r[13],t[14]=o*g+l*y+d*b+r[14],t[15]=s*g+h*y+m*b+r[15]),this.check()}transform(e,t){return 4===e.length?(r=t||[-0,-0,-0,-0],i=this,a=(n=e)[0],o=n[1],s=n[2],u=n[3],r[0]=i[0]*a+i[4]*o+i[8]*s+i[12]*u,r[1]=i[1]*a+i[5]*o+i[9]*s+i[13]*u,r[2]=i[2]*a+i[6]*o+i[10]*s+i[14]*u,r[3]=i[3]*a+i[7]*o+i[11]*s+i[15]*u,ds(t=r,4),t):this.transformAsPoint(e,t);var r,n,i,a,o,s,u}transformAsPoint(e,t){const{length:r}=e;switch(r){case 2:t=Us(t||[-0,-0],e,this);break;case 3:t=As(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}transformAsVector(e,t){switch(e.length){case 2:t=Bs(t||[-0,-0],e,this);break;case 3:t=Rs(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}transformPoint(e,t){return gs("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}transformVector(e,t){return gs("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}transformDirection(e,t){return gs("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}var Qs=.1,Ys=1e-12,$s=1e-15,Xs=1e-20;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const Zs=e=>e,eu=new Ds;function tu(e,t,r=Zs){return as(e)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z),t}function ru(e,t,r=Zs){return as(t)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]),t}const nu=new Ds,iu=new Ds,au=new Ds;const ou=new Ds,su={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},uu={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},cu={east:new Ds,north:new Ds,up:new Ds,west:new Ds,south:new Ds,down:new Ds},lu=new Ds,hu=new Ds,pu=new Ds;function fu(e,t,r,n,i,a){const o=su[t]&&su[t][r];let s,u,c;es(o&&(!n||n===o));const l=ou.copy(i);if(hs(l.x,0,1e-14)&&hs(l.y,0,1e-14)){const e=Math.sign(l.z);s=lu.fromArray(uu[t]),"east"!==t&&"west"!==t&&s.scale(e),u=hu.fromArray(uu[r]),"east"!==r&&"west"!==r&&u.scale(e),c=pu.fromArray(uu[n]),"east"!==n&&"west"!==n&&c.scale(e)}else{const{up:i,east:a,north:o}=cu;a.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,i),o.copy(i).cross(a);const{down:h,west:p,south:f}=cu;h.copy(i).scale(-1),p.copy(a).scale(-1),f.copy(o).scale(-1),s=cu[t],u=cu[r],c=cu[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}const du=new Ds,mu=new Ds,gu=new Ds,yu=new Ds,bu=new Ds,vu=new Ds;let wu;class _u{static get WGS84(){return wu=wu||new _u(6378137,6378137,6356752.314245179),wu}constructor(e=0,t=0,r=0){es(e>=0),es(t>=0),es(r>=0),this.radii=new Ds(e,t,r),this.radiiSquared=new Ds(e*e,t*t,r*r),this.radiiToTheFourth=new Ds(e*e*e*e,t*t*t*t,r*r*r*r),this.oneOverRadii=new Ds(0===e?0:1/e,0===t?0:1/t,0===r?0:1/r),this.oneOverRadiiSquared=new Ds(0===e?0:1/(e*e),0===t?0:1/(t*t),0===r?0:1/(r*r)),this.minimumRadius=Math.min(e,t,r),this.maximumRadius=Math.max(e,t,r),this.centerToleranceSquared=Qs,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,t=[0,0,0]){const r=mu,n=gu,[,,i]=e;this.geodeticSurfaceNormalCartographic(e,r),n.copy(this.radiiSquared).scale(r);const a=Math.sqrt(r.dot(n));return n.scale(1/a),r.scale(i),n.add(r),n.to(t)}cartesianToCartographic(e,t=[0,0,0]){vu.from(e);const r=this.scaleToGeodeticSurface(vu,yu);if(!r)return;const n=this.geodeticSurfaceNormal(r,mu),i=bu;i.copy(vu).subtract(r);const a=Math.atan2(n.y,n.x),o=Math.asin(n.z),s=Math.sign(xs(i,vu))*_s(i);return ru([a,o,s],t,ns._cartographicRadians?Zs:us)}eastNorthUpToFixedFrame(e,t=new Js){return fu(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,r,n,i=new Js){return fu(this,e,t,r,n,i)}geocentricSurfaceNormal(e,t=[0,0,0]){return du.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const r=function(e,t=eu){return tu(e,t,ns._cartographicRadians?Zs:ss)}(e),n=r[0],i=r[1],a=Math.cos(i);return du.set(a*Math.cos(n),a*Math.sin(n),Math.sin(i)).normalize(),du.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return du.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return function(e,t,r=new Ds){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;nu.from(e);const o=e.x,s=e.y,u=e.z,c=n.x,l=n.y,h=n.z,p=o*o*c*c,f=s*s*l*l,d=u*u*h*h,m=p+f+d,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const y=iu;if(y.copy(e).scale(g),m<a)return y.to(r);const b=i.x,v=i.y,w=i.z,_=au;_.set(y.x*b*2,y.y*v*2,y.z*w*2);let k,x,E,A,S=(1-g)*e.len()/(.5*_.len()),j=0;do{S-=j,k=1/(1+S*b),x=1/(1+S*v),E=1/(1+S*w);const e=k*k,t=x*x,r=E*E;A=p*e+f*t+d*r-1;j=A/(-2*(p*(e*k)*b+f*(t*x)*v+d*(r*E)*w))}while(Math.abs(A)>Ys);return nu.scale([k,x,E]).to(r)}(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){yu.from(e);const r=yu.x,n=yu.y,i=yu.z,a=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*a.x+n*n*a.y+i*i*a.z);return yu.multiplyScalar(o).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return yu.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return yu.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,r=[0,0,0]){es(hs(this.radii.x,this.radii.y,$s)),es(this.radii.z>0),yu.from(e);const n=yu.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-t))return yu.set(0,0,n).to(r)}}const{_parseImageNode:ku}=globalThis,xu="undefined"!=typeof Image,Eu="undefined"!=typeof ImageBitmap,Au=Boolean(ku),Su=!!Pi||Au;function ju(e){const t=Cu(e);if(!t)throw new Error("Not an image");return t}function Tu(e){switch(ju(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Cu(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const Bu=/^data:image\/svg\+xml/,Ru=/\.svg((\?|#).*)?$/;function Ou(e){return e&&(Bu.test(e)||Ru.test(e))}function Iu(e,t){if(Ou(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Pu(e,t,r){const n=function(e,t){if(Ou(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,"+btoa(t)}return Iu(e,t)}(e,r),i=self.URL||self.webkitURL,a="string"!=typeof n&&i.createObjectURL(n);try{return await async function(e,t){const r=new Image;if(r.src=e,t.image&&t.image.decode&&r.decode)return await r.decode(),r;return await new Promise((t,n)=>{try{r.onload=()=>t(r),r.onerror=t=>n(new Error(`Could not load image ${e}: ${t}`))}catch(e){n(e)}})}(a||n,t)}finally{a&&i.revokeObjectURL(a)}}const Du={};let Mu=!0;async function Fu(e,t,r){let n;if(Ou(r)){n=await Pu(e,t,r)}else n=Iu(e,r);const i=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Du)return!1;return!0}(t)&&Mu||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),Mu=!1}return await createImageBitmap(e)}(n,i)}function Lu(e){const t=Nu(e);return function(e){const t=Nu(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let i=2;for(;i+9<t.byteLength;){const e=t.getUint16(i,!1);if(n.has(e))return{mimeType:"image/jpeg",height:t.getUint16(i+5,!1),width:t.getUint16(i+7,!1)};if(!r.has(e))return null;i+=2,i+=t.getUint16(i,!1)}return null}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function Nu(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const zu={id:"image",module:"images",name:"Images",version:"3.3.0-alpha.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,r){const n=((t=t||{}).image||{}).type||"auto",{url:i}=r||{};let a;switch(function(e){switch(e){case"auto":case"data":return function(){if(Eu)return"imagebitmap";if(xu)return"image";if(Su)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return Eu||xu||Su;case"imagebitmap":return Eu;case"image":return xu;case"data":return Su;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(n)){case"imagebitmap":a=await Fu(e,t,i);break;case"image":a=await Pu(e,t,i);break;case"data":a=await async function(e,t){const{mimeType:r}=Lu(e)||{},n=globalThis._parseImageNode;return Vi(n),await n(e,r)}(e);break;default:Vi(!1)}return"data"===n&&(a=Tu(a)),a},tests:[e=>Boolean(Lu(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Uu={draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},qu={name:"Draco",id:ka?"draco":"draco-nodejs",module:"draco",shapes:["mesh"],version:"3.3.0-alpha.4",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Uu};function Hu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gu{constructor(e,t){Hu(this,"fields",void 0),Hu(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(e)),function(e){const t={};for(const r of e)t[r.name]&&console.warn("Schema: duplicated field name",r.name,r),t[r.name]=!0}(e),this.fields=e,this.metadata=t||new Map}compareTo(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(let t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}select(...e){const t=Object.create(null);for(const r of e)t[r]=!0;const r=this.fields.filter(e=>t[e.name]);return new Gu(r,this.metadata)}selectAt(...e){const t=e.map(e=>this.fields[e]).filter(Boolean);return new Gu(t,this.metadata)}assign(e){let t,r=this.metadata;if(e instanceof Gu){const n=e;t=n.fields,r=Vu(Vu(new Map,this.metadata),n.metadata)}else t=e;const n=Object.create(null);for(const e of this.fields)n[e.name]=e;for(const e of t)n[e.name]=e;const i=Object.values(n);return new Gu(i,r)}}function Vu(e,t){return new Map([...e||new Map,...t||new Map])}function Wu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ku{constructor(e,t,r=!1,n=new Map){Wu(this,"name",void 0),Wu(this,"type",void 0),Wu(this,"nullable",void 0),Wu(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new Ku(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let Ju,Qu,Yu,$u,Xu,Zu,ec,tc,rc;function nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(Ju||(Ju={}));class ic{static isNull(e){return e&&e.typeId===Ju.Null}static isInt(e){return e&&e.typeId===Ju.Int}static isFloat(e){return e&&e.typeId===Ju.Float}static isBinary(e){return e&&e.typeId===Ju.Binary}static isUtf8(e){return e&&e.typeId===Ju.Utf8}static isBool(e){return e&&e.typeId===Ju.Bool}static isDecimal(e){return e&&e.typeId===Ju.Decimal}static isDate(e){return e&&e.typeId===Ju.Date}static isTime(e){return e&&e.typeId===Ju.Time}static isTimestamp(e){return e&&e.typeId===Ju.Timestamp}static isInterval(e){return e&&e.typeId===Ju.Interval}static isList(e){return e&&e.typeId===Ju.List}static isStruct(e){return e&&e.typeId===Ju.Struct}static isUnion(e){return e&&e.typeId===Ju.Union}static isFixedSizeBinary(e){return e&&e.typeId===Ju.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===Ju.FixedSizeList}static isMap(e){return e&&e.typeId===Ju.Map}static isDictionary(e){return e&&e.typeId===Ju.Dictionary}get typeId(){return Ju.NONE}compareTo(e){return this===e}}Symbol.toStringTag;Symbol.toStringTag;Qu=Symbol.toStringTag;class ac extends ic{constructor(e,t){super(),nc(this,"isSigned",void 0),nc(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return Ju.Int}get[Qu](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class oc extends ac{constructor(){super(!0,8)}}class sc extends ac{constructor(){super(!0,16)}}class uc extends ac{constructor(){super(!0,32)}}class cc extends ac{constructor(){super(!1,8)}}class lc extends ac{constructor(){super(!1,16)}}class hc extends ac{constructor(){super(!1,32)}}const pc=32,fc=64;Yu=Symbol.toStringTag;class dc extends ic{constructor(e){super(),nc(this,"precision",void 0),this.precision=e}get typeId(){return Ju.Float}get[Yu](){return"Float"}toString(){return"Float"+this.precision}}class mc extends dc{constructor(){super(pc)}}class gc extends dc{constructor(){super(fc)}}Symbol.toStringTag;Symbol.toStringTag;$u=Symbol.toStringTag;Xu=Symbol.toStringTag;Zu=Symbol.toStringTag;ec=Symbol.toStringTag;tc=Symbol.toStringTag;class yc extends ic{constructor(e,t){super(),nc(this,"listSize",void 0),nc(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return Ju.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[tc](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}rc=Symbol.toStringTag;function bc(e,t,r){const n=function(e){switch(e.constructor){case Int8Array:return new oc;case Uint8Array:return new cc;case Int16Array:return new sc;case Uint16Array:return new lc;case Int32Array:return new uc;case Uint32Array:return new hc;case Float32Array:return new mc;case Float64Array:return new gc;default:throw new Error("array type not supported")}}(t.value),i=r||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new Ku(e,new yc(t.size,new Ku("value",n)),!1,i)}function vc(e,t,r){return bc(e,t,r?wc(r.metadata):void 0)}function wc(e){const t=new Map;for(const r in e)t.set(r+".string",JSON.stringify(e[r]));return t}function _c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kc={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},xc={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Ec{constructor(e){_c(this,"draco",void 0),_c(this,"decoder",void 0),_c(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const n=this.decoder.GetEncodedGeometryType(r),i=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(n){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!i.ptr){const t="DRACO decompression failed: "+e.error_msg();throw new Error(t)}const a=this._getDracoLoaderData(i,n,t),o=this._getMeshData(i,a,t),s=function(e){let t=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0;const s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let e=0;e<u;e+=3){const u=s[e],c=s[e+1],l=s[e+2];t=u<t?u:t,r=c<r?c:r,n=l<n?l:n,i=u>i?u:i,a=c>a?c:a,o=l>o?l:o}return[[t,r,n],[i,a,o]]}(o.attributes),u=function(e,t,r){const n=wc(t.metadata),i=[],a=function(e){const t={};for(const r in e){const n=e[r];t[n.name||"undefined"]=n}return t}(t.attributes);for(const t in e){const r=vc(t,e[t],a[t]);i.push(r)}if(r){const e=vc("indices",r);i.push(e)}return new Gu(i,n)}(o.attributes,a,o.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:s},...o,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,t,r){const n=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,r);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:n,attributes:i}}_getDracoAttributes(e,t){const r={};for(let n=0;n<e.num_attributes();n++){const i=this.decoder.GetAttribute(e,n),a=this._getAttributeMetadata(e,n);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:n,metadata:a};const o=this._getQuantizationTransform(i,t);o&&(r[i.unique_id()].quantization_transform=o);const s=this._getOctahedronTransform(i,t);s&&(r[i.unique_id()].octahedron_transform=s)}return r}_getMeshData(e,t,r){const n=this._getMeshAttributes(t,e,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(e,t,r){const n={};for(const i of Object.values(e.attributes)){const e=this._deduceAttributeName(i,r);i.name=e;const{value:a,size:o}=this._getAttributeValues(t,i);n[e]={value:a,size:o,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return n}_getTriangleListIndices(e){const t=3*e.num_faces(),r=4*t,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(e,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,t).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const r=xc[t.data_type],n=t.num_components,i=e.num_points()*n,a=i*r.BYTES_PER_ELEMENT,o=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,r);let s;const u=this.draco._malloc(a);try{const n=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,n,o,a,u),s=new r(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}return{value:s,size:n}}_deduceAttributeName(e,t){const r=e.unique_id;for(const[e,n]of Object.entries(t.extraAttributes||{}))if(n===r)return e;const n=e.attribute_type;for(const e in kc){if(this.draco[e]===n)return kc[e]}const i=t.attributeNameEntry||"name";return e.metadata[i]?e.metadata[i].string:"CUSTOM_ATTRIBUTE_"+r}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const r=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(r)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},r=this.metadataQuerier.NumEntries(e);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(e,n);t[r]=this._getDracoMetadataField(e,r)}return t}_getDracoMetadataField(e,t){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,r);const n=function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:r=[]}=e,n=[...t,...r];for(const e of n)this.decoder.SkipAttributeTransform(this.draco[e])}_getQuantizationTransform(e,t){const{quantizedAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map(e=>t.min_value(e))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}var Ac=r(51);const Sc={};async function jc(e,t=null,r={}){return t&&(e=function(e,t,r){if(e.startsWith("http"))return e;const n=r.modules||{};if(n[e])return n[e];if(!ka)return`modules/${t}/dist/libs/${e}`;if(r.CDN)return va(r.CDN.startsWith("http")),`${r.CDN}/${t}@3.3.0-alpha.4/dist/libs/${e}`;if(xa)return"../src/libs/"+e;return`modules/${t}/src/libs/${e}`}(e,t,r)),Sc[e]=Sc[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!ka)try{return Ac&&Ac.requireFromFile&&await Ac.requireFromFile(e)}catch{return null}if(xa)return importScripts(e);const t=await fetch(e);return function(e,t){if(!ka)return Ac.requireFromString&&Ac.requireFromString(e,t);if(xa)return eval.call(_a,e),null;const r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch(t){r.text=e}return document.body.appendChild(r),null}(await t.text(),e)}(e),await Sc[e]}let Tc;async function Cc(e){const t=e.modules||{};return Tc=t.draco3d?Tc||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):Tc||async function(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",e);break;case"wasm":default:[t,r]=await Promise.all([await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",e),await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",e)])}return t=t||globalThis.DracoDecoderModule,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e({...r,onModuleLoaded:e=>t({draco:e})})})}(t,r)}(e),await Tc}const Bc={id:ka?"draco-writer":"draco-writer-nodejs",name:"Draco compressed geometry writer",module:"draco",version:"3.3.0-alpha.4",worker:!0,options:{draco:{},source:null}},Rc={...qu,parse:async function(e,t){const{draco:r}=await Cc(t),n=new Ec(r);try{return n.parseSync(e,null==t?void 0:t.draco)}finally{n.destroy()}}};new Uint8Array([0]);const Oc=[171,75,84,88,32,50,48,187,13,10,26,10];var Ic,Pc,Dc,Mc,Fc,Lc,Nc,zc,Uc;(Uc=Ic||(Ic={}))[Uc.NONE=0]="NONE",Uc[Uc.BASISLZ=1]="BASISLZ",Uc[Uc.ZSTD=2]="ZSTD",Uc[Uc.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Pc||(Pc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Dc||(Dc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Mc||(Mc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Fc||(Fc={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Lc||(Lc={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Nc||(Nc={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(zc||(zc={}));class qc{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Ic.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:Pc.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:Dc.UNSPECIFIED,colorPrimaries:Mc.SRGB,transferFunction:Mc.SRGB,flags:Lc.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class Hc{constructor(e,t,r,n){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function Gc(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function Vc(e,t){const r=new Array(t.mipMapLevels);let n=t.width,i=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){const s=Kc(t,n,i,e,o),u=Wc(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:n,height:i,levelSize:s},n=Math.max(1,n>>1),i=Math.max(1,i>>1),a+=s}return r}function Wc(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function Kc(e,t,r,n,i){return Array.isArray(n)?e.sizeFunction(n[i]):e.sizeFunction(t,r)}const Jc={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919},Qc={131:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Jc.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Jc.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Jc.COMPRESSED_RED_RGTC1_EXT,140:Jc.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Jc.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Jc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Jc.COMPRESSED_RGB8_ETC2,148:Jc.COMPRESSED_SRGB8_ETC2,149:Jc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Jc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Jc.COMPRESSED_RGBA8_ETC2_EAC,152:Jc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Jc.COMPRESSED_R11_EAC,154:Jc.COMPRESSED_SIGNED_R11_EAC,155:Jc.COMPRESSED_RG11_EAC,156:Jc.COMPRESSED_SIGNED_RG11_EAC,157:Jc.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Jc.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Jc.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Jc.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Jc.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Jc.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Jc.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Jc.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Jc.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Jc.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Jc.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Jc.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Jc.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Jc.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Jc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Jc.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Jc.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Jc.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Jc.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Jc.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Jc.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Jc.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Jc.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Jc.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Jc.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Jc.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Jc.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Jc.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Jc.COMPRESSED_RGBA_ASTC_12x12_KHR};const Yc=[171,75,84,88,32,50,48,187,13,10,26,10];function $c(e){const t=new Uint8Array(e);return!(t.byteLength<Yc.length||t[0]!==Yc[0]||t[1]!==Yc[1]||t[2]!==Yc[2]||t[3]!==Yc[3]||t[4]!==Yc[4]||t[5]!==Yc[5]||t[6]!==Yc[6]||t[7]!==Yc[7]||t[8]!==Yc[8]||t[9]!==Yc[9]||t[10]!==Yc[10]||t[11]!==Yc[11])}function Xc(e){const t=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Oc.length);if(t[0]!==Oc[0]||t[1]!==Oc[1]||t[2]!==Oc[2]||t[3]!==Oc[3]||t[4]!==Oc[4]||t[5]!==Oc[5]||t[6]!==Oc[6]||t[7]!==Oc[7]||t[8]!==Oc[8]||t[9]!==Oc[9]||t[10]!==Oc[10]||t[11]!==Oc[11])throw new Error("Missing KTX 2.0 identifier.");const r=new qc,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Hc(e,Oc.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const a=i._nextUint32();r.supercompressionScheme=i._nextUint32();const o=i._nextUint32(),s=i._nextUint32(),u=i._nextUint32(),c=i._nextUint32(),l=i._nextUint64(),h=i._nextUint64(),p=new Hc(e,Oc.length+n,3*a*8,!0);for(let t=0;t<a;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const f=new Hc(e,o,s,!0),d={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:{x:f._nextUint8()+1,y:f._nextUint8()+1,z:f._nextUint8()+1,w:f._nextUint8()+1},bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(d.descriptorBlockSize/4-6)/4;for(let e=0;e<m;e++)d.samples[e]={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelID:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:f._nextUint32(),sampleUpper:f._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(d);const g=new Hc(e,u,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),n=Gc(t),i=g._scan(e-t.byteLength);r.keyValue[n]=n.match(/^ktx/i)?Gc(i):i,e%4&&g._skip(4-e%4)}if(h<=0)return r;const y=new Hc(e,l,h,!0),b=y._nextUint16(),v=y._nextUint16(),w=y._nextUint32(),_=y._nextUint32(),k=y._nextUint32(),x=y._nextUint32(),E=[];for(let e=0;e<a;e++)E.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});const A=l+y._offset,S=A+w,j=S+_,T=j+k,C=new Uint8Array(e.buffer,e.byteOffset+A,w),B=new Uint8Array(e.buffer,e.byteOffset+S,_),R=new Uint8Array(e.buffer,e.byteOffset+j,k),O=new Uint8Array(e.buffer,e.byteOffset+T,x);return r.globalData={endpointCount:b,selectorCount:v,imageDescs:E,endpointsData:C,selectorsData:B,tablesData:R,extendedData:O},r}(new Uint8Array(e)),r=Math.max(1,t.levels.length),n=t.pixelWidth,i=t.pixelHeight,a=(o=t.vkFormat,Qc[o]);var o;return Vc(t.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:e=>e.uncompressedByteLength,internalFormat:a})}const Zc=542327876,el=31,tl=0,rl=1,nl=2,il=3,al=4,ol=7,sl=20,ul=21,cl=131072,ll=4,hl={DXT1:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Jc.COMPRESSED_RGB_ATC_WEBGL,ATCA:Jc.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Jc.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},pl={DXT1:dl,DXT3:ml,DXT5:ml,"ATC ":dl,ATCA:ml,ATCI:ml};function fl(e){const t=new Int32Array(e,0,el),r=t[ul];Vi(Boolean(t[sl]&ll),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const a=hl[n],o=pl[n];Vi(a&&o,"DDS: Unknown pixel format "+r);let s=1;t[nl]&cl&&(s=Math.max(1,t[ol]));const u=t[al],c=t[il],l=t[rl]+4;return Vc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}function dl(e,t){return(e+3>>2)*(t+3>>2)*8}function ml(e,t){return(e+3>>2)*(t+3>>2)*16}const gl=55727696,yl=1347834371,bl=13,vl=52,wl=0,_l=2,kl=4,xl=6,El=7,Al=11,Sl=12,jl={0:[Jc.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Jc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Jc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Jc.COMPRESSED_RGB_ETC1_WEBGL],7:[Jc.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Jc.COMPRESSED_RGB8_ETC2],23:[Jc.COMPRESSED_RGBA8_ETC2_EAC],24:[Jc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Jc.COMPRESSED_R11_EAC],26:[Jc.COMPRESSED_RG11_EAC],27:[Jc.COMPRESSED_RGBA_ASTC_4X4_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Jc.COMPRESSED_RGBA_ASTC_5X4_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Jc.COMPRESSED_RGBA_ASTC_5X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Jc.COMPRESSED_RGBA_ASTC_6X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Jc.COMPRESSED_RGBA_ASTC_6X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Jc.COMPRESSED_RGBA_ASTC_8X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Jc.COMPRESSED_RGBA_ASTC_8X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Jc.COMPRESSED_RGBA_ASTC_8X8_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Jc.COMPRESSED_RGBA_ASTC_10X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Jc.COMPRESSED_RGBA_ASTC_10X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Jc.COMPRESSED_RGBA_ASTC_10X8_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Jc.COMPRESSED_RGBA_ASTC_10X10_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Jc.COMPRESSED_RGBA_ASTC_12X10_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Jc.COMPRESSED_RGBA_ASTC_12X12_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Tl={0:Cl,1:Cl,2:Bl,3:Bl,6:Rl,7:Rl,9:Ol,11:Ol,22:Rl,23:Ol,24:Rl,25:Rl,26:Ol,27:Ol,28:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16},29:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16},30:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16},31:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16},32:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16},33:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16},34:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16},35:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16},36:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16},37:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16},38:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16},39:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16},40:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}};function Cl(e,t){return(e=Math.max(e,16))*(t=Math.max(t,8))/4}function Bl(e,t){return(e=Math.max(e,8))*(t=Math.max(t,8))/2}function Rl(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function Ol(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function Il(e){if($c(e))return Xc(e);if(function(e){return new Uint32Array(e,0,el)[tl]===Zc}(e))return fl(e);if(function(e){const t=new Uint32Array(e,0,bl)[wl];return t===gl||t===yl}(e))return function(e){const t=new Uint32Array(e,0,bl),r=t[_l],n=t[kl],i=jl[r]||[],a=i.length>1&&n?i[1]:i[0],o=Tl[r],s=t[Al],u=t[El],c=t[xl],l=vl+t[Sl];return Vc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}(e);throw new Error("Texture container format not recognized")}let Pl,Dl;async function Ml(e){const t=e.modules||{};return t.basis?t.basis:(Pl=Pl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await jc("basis_transcoder.js","textures",e),await jc("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,initializeBasis:n}=e;n(),t({BasisFile:r})})})}(t,r)}(e),await Pl)}async function Fl(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Dl=Dl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await jc("https://unpkg.com/@loaders.gl/textures@3.3.0-alpha.4/dist/libs/basis_encoder.js","textures",e),await jc("https://unpkg.com/@loaders.gl/textures@3.3.0-alpha.4/dist/libs/basis_encoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,KTX2File:n,initializeBasis:i,BasisEncoder:a}=e;i(),t({BasisFile:r,KTX2File:n,BasisEncoder:a})})})}(t,r)}(e),await Dl)}const Ll=["","WEBKIT_","MOZ_"],Nl={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let zl=null;function Ul(e){if(!zl){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,zl=new Set;for(const t of Ll)for(const r in Nl)if(e&&e.getExtension(`${t}${r}`)){const e=Nl[r];zl.add(e)}}return zl}const ql={etc1:{basisFormat:0,compressed:!0,format:Jc.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Jc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Jc.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function Hl(e,t){if("auto"===t.basis.containerFormat){if($c(e)){return Wl((await Fl(t)).KTX2File,e,t)}const{BasisFile:r}=await Ml(t);return Gl(r,e,t)}switch(t.basis.module){case"encoder":const r=await Fl(t);switch(t.basis.containerFormat){case"ktx2":return Wl(r.KTX2File,e,t);case"basis":default:return Gl(r.BasisFile,e,t)}case"transcoder":default:const{BasisFile:n}=await Ml(t);return Gl(n,e,t)}}function Gl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");const e=n.getNumImages(),t=[];for(let i=0;i<e;i++){const e=n.getNumLevels(i),a=[];for(let t=0;t<e;t++)a.push(Vl(n,i,t,r));t.push(a)}return t}finally{n.close(),n.delete()}}function Vl(e,t,r,n){const i=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c}=Jl(n,o),l=e.getImageTranscodedSizeInBytes(t,r,c),h=new Uint8Array(l);if(!e.transcodeImage(h,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:a,data:h,compressed:s,format:u,hasAlpha:o}}function Wl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");const e=n.getLevels(),t=[];for(let i=0;i<e;i++){t.push(Kl(n,i,r));break}return[t]}finally{n.close(),n.delete()}}function Kl(e,t,r){const{alphaFlag:n,height:i,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=Jl(r,n),c=e.getImageTranscodedSizeInBytes(t,0,0,u),l=new Uint8Array(c);if(!e.transcodeImage(l,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:i,data:l,compressed:o,hasAlpha:n,format:s}}function Jl(e,t){let r=e&&e.basis&&e.basis.format;return"auto"===r&&(r=Ql()),"object"==typeof r&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),ql[r]}function Ql(){const e=Ul();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}const Yl={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.3.0-alpha.4",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},$l={...Yl,parse:async(e,t)=>t["compressed-texture"].useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await Hl(e,t))[0]):Il(e)},Xl={name:"Basis",id:ka?"basis":"basis-nodejs",module:"textures",version:"3.3.0-alpha.4",worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Zl={...Xl,parse:Hl};let eh,th;function rh(e,t=null){return t?`${e}?token=${t}`:e}!function(e){e.UInt8="UInt8",e.UInt16="UInt16",e.UInt32="UInt32",e.UInt64="UInt64",e.Int16="Int16",e.Int32="Int32",e.Int64="Int64",e.Float32="Float32",e.Float64="Float64"}(eh||(eh={})),function(e){e.vertexCount="vertexCount",e.featureCount="featureCount"}(th||(th={}));var nh=5121,ih=5125,ah=5126,oh=5130;function sh(e){switch(e){case eh.UInt8:return Uint8Array;case eh.UInt16:return Uint16Array;case eh.UInt32:return Uint32Array;case eh.Float32:return Float32Array;case eh.UInt64:return Float64Array;default:throw new Error("parse i3s tile content: unknown type of data: "+e)}}const uh={UInt8:nh,UInt16:ih,Float32:ah,UInt32:ih,UInt64:oh};function ch(e){switch(e){case eh.UInt8:return 1;case eh.UInt16:case eh.Int16:return 2;case eh.UInt32:case eh.Int32:case eh.Float32:return 4;case eh.UInt64:case eh.Int64:case eh.Float64:return 8;default:throw new Error("parse i3s tile content: unknown size of data: "+e)}}let lh;async function hh(e,t){const{attributeName:r,attributeType:n}=t;return r?{[r]:n?ph(n,e):null}:{}}function ph(e,t){switch(e){case"String":return function(e){const t=[];try{const r=new DataView(e,0,4).getUint32(0,!0),n=new Uint32Array(e,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),a=new Uint8Array(e,i,r);t.push(n.decode(a)),i+=r}}catch(e){console.error("Parse string attribute error: ",e.message)}return t}(t);case"Oid32":return fh(t);case"Float64":return function(e){return new Float64Array(e,8)}(t);case"Int16":return function(e){return new Int16Array(e,4)}(t);default:return fh(t)}}function fh(e){return new Uint32Array(e,4)}!function(e){e[e.DEFAULT=-1]="DEFAULT",e[e.LNGLAT=1]="LNGLAT",e[e.METER_OFFSETS=2]="METER_OFFSETS",e[e.LNGLAT_OFFSETS=3]="LNGLAT_OFFSETS",e[e.CARTESIAN=0]="CARTESIAN"}(lh||(lh={}));const dh={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.3.0-alpha.4",mimeTypes:["application/binary"],parse:async function(e,t){return e=hh(e,t)},extensions:["bin"],options:{},binary:!0};function mh(e){return e.hasOwnProperty("objectIds")?"Oid32":e.hasOwnProperty("attributeValues")?e.attributeValues.valueType:""}function gh(e,t){var r;if(null==t||null===(r=t.i3s)||void 0===r||!r.colorsByAttribute)return[255,255,255,255];const{minValue:n,maxValue:i,minColor:a,maxColor:o}=t.i3s.colorsByAttribute,s=(e-n)/(i-n),u=[255,255,255,255];for(let e=0;e<a.length;e++)u[e]=Math.round((o[e]-a[e])*s+a[e]);return u}async function yh(e,{attributeUrls:t},{attributeStorageInfo:r},n){var i;const a=r.findIndex(({name:t})=>e===t);if(-1===a)return null;const o=rh(t[a],null==n||null===(i=n.i3s)||void 0===i?void 0:i.token),s=mh(r[a]);return await Zo(o,dh,{attributeName:e,attributeType:s})}const bh=new Ds([0,0,0]);async function vh(e,t,r,n,i){const a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new Js,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){var o;const e=rh(t.textureUrl,null==n||null===(o=n.i3s)||void 0===o?void 0:o.token),r=function(e){switch(e){case"ktx-etc2":case"dds":return $l;case"ktx2":return Zl;case"jpg":case"png":default:return zu}}(t.textureFormat),s=await fetch(e,null==n?void 0:n.fetch),u=await s.arrayBuffer();if(null!=n&&n.i3s.decodeTextures){if(r===zu){const e={...t.textureLoaderOptions,image:{type:"data"}};try{a.texture=await i.parse(u,e)}catch(t){a.texture=await Xo(u,r,e)}}else if(r===$l||r===Zl){let e=await Zo(u,r,t.textureLoaderOptions);r===Zl&&(e=e[0]),a.texture={compressed:!0,mipmaps:!1,width:e[0].width,height:e[0].height,data:e}}}else a.texture=u}return a.material=function(e,t){let r;e?r={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=xh(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=xh(r.pbrMetallicRoughness.baseColorFactor));t&&function(e,t){const r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:r}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:r}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:r}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:r})}(r,t);return r}(t.materialDefinition,a.texture),a.material&&(a.texture=null),await async function(e,t,r,n,i){var a;const o=e.byteLength;let s,u,c,l=0,h=0;if(r.isDracoGeometry){var p;const t=await Xo(e,Rc,{draco:{attributeNameEntry:"i3s-attribute-type"}});u=t.header.vertexCount,c=null===(p=t.indices)||void 0===p?void 0:p.value;const{POSITION:r,NORMAL:n,COLOR_0:i,TEXCOORD_0:a,"feature-index":o,"uv-region":l}=t.attributes;s={position:r,normal:n,color:i,uv0:a,uvRegion:l,id:o},function(e,t){for(const r in t.loaderData.attributes){const n=t.loaderData.attributes[r];switch(n.name){case"POSITION":e.position.metadata=n.metadata;break;case"feature-index":e.id.metadata=n.metadata}}}(s,t);const h=function(e){var t,r;return null==e||null===(t=e.metadata)||void 0===t||null===(r=t["i3s-feature-ids"])||void 0===r?void 0:r.intArray}(o);h&&function(e,t){const r=e.id.value,n=new Float32Array(r.length);for(let e=0;e<r.length;e++)n[e]=t[r[e]];e.id.value=n}(s,h)}else{const{vertexAttributes:t,ordering:r,featureAttributes:i,featureAttributeOrder:a}=n.store.defaultGeometrySchema,o=function(e,t){let r=0,n=0,i=0;for(const{property:a,type:o}of t.store.defaultGeometrySchema.header){const t=sh(o);switch(a){case th.vertexCount:n=new t(e,0,4)[0],r+=ch(o);break;case th.featureCount:i=new t(e,4,4)[0],r+=ch(o)}}return{vertexCount:n,featureCount:i,byteOffset:r}}(e,n);l=o.byteOffset,u=o.vertexCount,h=o.featureCount;const{attributes:c,byteOffset:p}=_h(e,l,t,u,r),{attributes:f}=_h(e,p,i,h,a);!function(e){const{id:t,faceRange:r}=e;if(!t||!r)return;const n=t.value,i=r.value,a=i[i.length-1]+1,o=new Uint32Array(3*a);let s=0,u=0;for(let e=1;e<i.length;e+=2){const t=Number(n[s]),r=i[e],a=i[e-1],c=u+3*(r-a+1);o.fill(t,u,c),s++,u=c}e.id.value=o}(f),s=function(e,t){return{...e,...t}}(c,f)}if(null!=i&&null!==(a=i.i3s)&&void 0!==a&&a.coordinateSystem&&i.i3s.coordinateSystem!==lh.METER_OFFSETS)t.modelMatrix=function(e){var t,r;const n=e.metadata,i=(null==n||null===(t=n["i3s-scale_x"])||void 0===t?void 0:t.double)||1,a=(null==n||null===(r=n["i3s-scale_y"])||void 0===r?void 0:r.double)||1,o=new Js;return o[0]=i,o[5]=a,o}(s.position),t.coordinateSystem=lh.LNGLAT_OFFSETS;else{const e=function(e,t){const r=t.mbs,n=e.value,i=e.metadata,a=new Js,o=new Ds(r[0],r[1],r[2]),s=new Ds;return _u.WGS84.cartographicToCartesian(o,s),_u.WGS84.eastNorthUpToFixedFrame(s,a),e.value=function(e,t={},r){const n=new Float64Array(e.length),i=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let t=0;t<n.length;t+=3)n[t]=e[t]*i+r.x,n[t+1]=e[t+1]*a+r.y,n[t+2]=e[t+2]+r.z;for(let e=0;e<n.length;e+=3)_u.WGS84.cartographicToCartesian(n.subarray(e,e+3),bh),n[e]=bh.x,n[e+1]=bh.y,n[e+2]=bh.z;return n}(n,i,o),a}(s.position,r);t.modelMatrix=e.invert(),t.coordinateSystem=lh.METER_OFFSETS}s.color=await async function(e,t,r,n,i){var a;if(null==i||null===(a=i.i3s)||void 0===a||!a.colorsByAttribute)return e;const o=n.fields.find(({name:e})=>{var t,r;return e===(null==i||null===(t=i.i3s)||void 0===t||null===(r=t.colorsByAttribute)||void 0===r?void 0:r.attributeName)});if(!o||!["esriFieldTypeDouble","esriFieldTypeInteger","esriFieldTypeSmallInteger"].includes(o.type))return e;const s=await yh(o.name,r,n,i);if(!s)return e;const u=n.fields.find(({type:e})=>"esriFieldTypeOID"===e);if(!u)return e;const c=await yh(u.name,r,n,i);if(!c)return e;const l={};for(let e=0;e<c[u.name].length;e++)l[c[u.name][e]]=gh(s[o.name][e],i);for(let r=0;r<t.value.length;r++){const n=l[t.value[r]];n&&e.value.set(n,4*r)}return e}(s.color,s.id,r,n,i),t.attributes={positions:s.position,normals:s.normal,colors:wh(s.color),texCoords:s.uv0,uvRegions:wh(s.uvRegion)},t.indices=c||null,s.id&&s.id.value&&(t.featureIds=s.id.value);for(const e in t.attributes)t.attributes[e]||delete t.attributes[e];return t.vertexCount=u,t.byteLength=o,t}(e,a,t,r,n)}function wh(e){return e?(e.normalized=!0,e):e}function _h(e,t,r,n,i){const a={};for(const o of i)if(r[o]){const{valueType:i,valuesPerElement:s}=r[o];if(t+n*s*ch(i)<=e.byteLength){const r=e.slice(t);let u;if("UInt64"===i)u=kh(r,n*s,ch(i));else{u=new(sh(i))(r,0,n*s)}switch(a[o]={value:u,type:uh[i],size:s},o){case"color":a.color.normalized=!0}t+=n*s*ch(i)}else if("uv0"!==o)break}return{attributes:a,byteOffset:t}}function kh(e,t,r){const n=[],i=new DataView(e);let a=0;for(let e=0;e<t;e++){const e=i.getUint32(a,!0)+2**32*i.getUint32(a+4,!0);n.push(e),a+=r}return new Uint32Array(n)}function xh(e){const t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}const Eh={name:"I3S Content (Indexed Scene Layers)",id:ka?"i3s-content":"i3s-content-nodejs",module:"i3s",worker:!0,version:"3.3.0-alpha.4",mimeTypes:["application/octet-stream"],parse:async function(e,t,r){const{tile:n,_tileOptions:i,tileset:a,_tilesetOptions:o}=(null==t?void 0:t.i3s)||{},s=i||n,u=o||a;if(!s||!u)return null;return await vh(e,s,u,t,r)},extensions:["bin"],options:{"i3s-content":{}}};const Ah=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Ds,new Ds;const Sh=new Ds,jh=new Ds;class Th{constructor(e=[0,0,0],t=0){this.radius=-0,this.center=new Ds,this.fromCenterRadius(e,t)}fromCenterRadius(e,t){return this.center.from(e),this.radius=t,this}fromCornerPoints(e,t){return t=Sh.from(t),this.center=(new Ds).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Th(this.center,this.radius)}union(e){const t=this.center,r=this.radius,n=e.center,i=e.radius,a=Sh.copy(n).subtract(t),o=a.magnitude();if(r>=o+i)return this.clone();if(i>=o+r)return e.clone();const s=.5*(r+o+i);return jh.copy(a).scale((-r+s)/o).add(t),this.center.copy(jh),this.radius=s,this}expand(e){const t=(e=Sh.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}transform(e){this.center.transform(e);const t=Ns(Sh,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}distanceSquaredTo(e){return(e=Sh.from(e)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}intersectPlane(e){const t=this.center,r=this.radius,n=e.normal.dot(t)+e.distance;return n<-r?Ah.OUTSIDE:n<r?Ah.INTERSECTING:Ah.INSIDE}}function Ch(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=r[0],f=r[1],d=r[2],m=r[3],g=r[4],y=r[5],b=r[6],v=r[7],w=r[8];return e[0]=p*n+f*o+d*c,e[1]=p*i+f*s+d*l,e[2]=p*a+f*u+d*h,e[3]=m*n+g*o+y*c,e[4]=m*i+g*s+y*l,e[5]=m*a+g*u+y*h,e[6]=b*n+v*o+w*c,e[7]=b*i+v*s+w*l,e[8]=b*a+v*u+w*h,e}function Bh(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}const Rh=Object.freeze([1,0,0,0,1,0,0,0,1]),Oh=Object.freeze([0,0,0,0,0,0,0,0,0]),Ih=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Ph={};class Dh extends Ms{static get IDENTITY(){return Ph.IDENTITY=Ph.IDENTITY||Object.freeze(new Dh(Rh)),Ph.IDENTITY}static get ZERO(){return Ph.ZERO=Ph.ZERO||Object.freeze(new Dh(Oh)),Ph.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Ih}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}set(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=n,this[2]=o,this[3]=t,this[4]=i,this[5]=s,this[6]=r,this[7]=a,this[8]=u,this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s);var e,t,r,n,i,a,o,s,u,c}identity(){return this.copy(Rh)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[3]=l-y,e[6]=p+g,e[1]=l+y,e[4]=1-c-d,e[7]=f-m,e[2]=p-g,e[5]=f+m,e[8]=1-c-h}(this,e),this.check()}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else 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,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],(d=r*(h=l*o-s*c)+n*(p=-l*a+s*u)+i*(f=c*a-o*u))&&(d=1/d,e[0]=h*d,e[1]=(-l*n+i*c)*d,e[2]=(s*n-i*o)*d,e[3]=p*d,e[4]=(l*r-i*u)*d,e[5]=(-s*r+i*a)*d,e[6]=f*d,e[7]=(-c*r+n*u)*d,e[8]=(o*r-n*a)*d),this.check()}multiplyLeft(e){return Ch(this,e,this),this.check()}multiplyRight(e){return Ch(this,this,e),this.check()}rotate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=Math.sin(n),d=Math.cos(n),t[0]=d*i+f*s,t[1]=d*a+f*u,t[2]=d*o+f*c,t[3]=d*s-f*i,t[4]=d*u-f*a,t[5]=d*c-f*o,t[6]=l,t[7]=h,t[8]=p,this.check()}scale(e){return Array.isArray(e)?Bh(this,this,e):Bh(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=n[0],d=n[1],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=f*i+d*s+l,t[7]=f*a+d*u+h,t[8]=f*o+d*c+p,this.check()}transform(e,t){switch(e.length){case 2:t=zs(t||[-0,-0],e,this);break;case 3:t=Ss(t||[-0,-0,-0],e,this);break;case 4:t=Os(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}transformVector(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}transformVector2(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}transformVector3(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}}function Mh(){var e=new vs(4);return vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fh(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Lh(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function Nh(e,t,r,n){var i,a,o,s,u,c=t[0],l=t[1],h=t[2],p=t[3],f=r[0],d=r[1],m=r[2],g=r[3];return(a=c*f+l*d+h*m+p*g)<0&&(a=-a,f=-f,d=-d,m=-m,g=-g),1-a>bs?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*c+u*f,e[1]=s*l+u*d,e[2]=s*h+u*m,e[3]=s*p+u*g,e}function zh(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e}var Uh,qh,Hh,Gh,Vh,Wh,Kh,Jh=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},Qh=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},Yh=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},$h=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},Xh=qs,Zh=Hs,ep=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e},tp=(Uh=ws(),qh=ks(1,0,0),Hh=ks(0,1,0),function(e,t,r){var n=xs(t,r);return n<-.999999?(Es(Uh,qh,t),Cs(Uh)<1e-6&&Es(Uh,Hh,t),function(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a}(Uh,Uh),Fh(e,Uh,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Es(Uh,t,r),e[0]=Uh[0],e[1]=Uh[1],e[2]=Uh[2],e[3]=1+n,ep(e,e))});Gh=Mh(),Vh=Mh(),Wh=new vs(9),vs!=Float32Array&&(Wh[1]=0,Wh[2]=0,Wh[3]=0,Wh[5]=0,Wh[6]=0,Wh[7]=0),Wh[0]=1,Wh[4]=1,Wh[8]=1,Kh=Wh;const rp=[0,0,0,1];class np extends ps{constructor(e=0,t=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&1===arguments.length?this.copy(e):this.set(e,t,r,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this.check()}fromMatrix3(e){return zh(this,e),this.check()}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}fromAxisRotation(e,t){return Fh(this,e,t),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=fs(e)}get y(){return this[1]}set y(e){this[1]=fs(e)}get z(){return this[2]}set z(e){this[2]=fs(e)}get w(){return this[3]}set w(e){this[3]=fs(e)}len(){return Xh(this)}lengthSquared(){return Zh(this)}dot(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return Yh(this,e)}rotationTo(e,t){return tp(this,e,t),this.check()}add(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return Jh(this,this,e),this.check()}calculateW(){return function(e,t){var r=t[0],n=t[1],i=t[2];e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(this,this),this.check()}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}invert(){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s}(this,this),this.check()}lerp(e,t,r){return $h(this,e,t,r),this.check()}multiplyRight(e,t){return es(!t),Lh(this,this,e),this.check()}multiplyLeft(e,t){return es(!t),Lh(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s}(this,this,e),this.check()}rotateY(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s}(this,this,e),this.check()}rotateZ(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s}(this,this,e),this.check()}scale(e){return Qh(this,this,e),this.check()}slerp(e,t,r){switch(arguments.length){case 1:({start:e=rp,target:t,ratio:r}=arguments[0]);break;case 2:[t,r]=arguments,e=this}return Nh(this,e,t,r),this.check()}transformVector4(e,t=e){return function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,h=c*i+u*n-o*a,p=c*a+o*i-s*n,f=-o*n-s*i-u*a;e[0]=l*c+f*-o+h*-u-p*-s,e[1]=h*c+f*-s+p*-o-l*-u,e[2]=p*c+f*-u+l*-s-h*-o,e[3]=t[3]}(t,e,this),ds(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e,t){return this.multiplyLeft(e,t)}multiply(e,t){return this.multiplyRight(e,t)}}const ip=new Ds,ap=new Ds,op=new Ds,sp=new Ds,up=new Ds,cp=new Ds,lp=new Ds,hp=0,pp=1,fp=2,dp=3,mp=4,gp=5,yp=6,bp=7,vp=8;class wp{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=(new Ds).from(e),this.halfAxes=new Dh(t)}get halfSize(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Ds(e).len(),new Ds(t).len(),new Ds(r).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new Ds(e).normalize(),i=new Ds(t).normalize(),a=new Ds(r).normalize();return(new np).fromMatrix3(new Dh([...n,...i,...a]))}fromCenterHalfSizeQuaternion(e,t,r){const n=new np(r),i=(new Dh).fromQuaternion(n);return i[0]=i[0]*t[0],i[1]=i[1]*t[0],i[2]=i[2]*t[0],i[3]=i[3]*t[1],i[4]=i[4]*t[1],i[5]=i[5]*t[1],i[6]=i[6]*t[2],i[7]=i[7]*t[2],i[8]=i[8]*t[2],this.center=(new Ds).from(e),this.halfAxes=i,this}clone(){return new wp(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Th){const t=this.halfAxes,r=t.getColumn(0,op),n=t.getColumn(1,sp),i=t.getColumn(2,up),a=ip.copy(r).add(n).add(i);return e.center.copy(this.center),e.radius=a.magnitude(),e}intersectPlane(e){const t=this.center,r=e.normal,n=this.halfAxes,i=r.x,a=r.y,o=r.z,s=Math.abs(i*n[hp]+a*n[pp]+o*n[fp])+Math.abs(i*n[dp]+a*n[mp]+o*n[gp])+Math.abs(i*n[yp]+a*n[bp]+o*n[vp]),u=r.dot(t)+e.distance;return u<=-s?Ah.OUTSIDE:u>=s?Ah.INSIDE:Ah.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const t=ap.from(e).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,op),i=r.getColumn(1,sp),a=r.getColumn(2,up),o=n.magnitude(),s=i.magnitude(),u=a.magnitude();n.normalize(),i.normalize(),a.normalize();let c,l=0;return c=Math.abs(t.dot(n))-o,c>0&&(l+=c*c),c=Math.abs(t.dot(i))-s,c>0&&(l+=c*c),c=Math.abs(t.dot(a))-u,c>0&&(l+=c*c),l}computePlaneDistances(e,t,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const a=this.center,o=this.halfAxes,s=o.getColumn(0,op),u=o.getColumn(1,sp),c=o.getColumn(2,up),l=cp.copy(s).add(u).add(c).add(a),h=lp.copy(l).subtract(e);let p=t.dot(h);return n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),r[0]=n,r[1]=i,r}transform(e){this.center.transformAsPoint(e);const t=this.halfAxes.getColumn(0,op);t.transformAsPoint(e);const r=this.halfAxes.getColumn(1,sp);r.transformAsPoint(e);const n=this.halfAxes.getColumn(2,up);return n.transformAsPoint(e),this.halfAxes=new Dh([...t,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const _p=new Ds,kp=new Ds;class xp{constructor(e=[0,0,1],t=0){this.normal=new Ds,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return es(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=_p.from(e),this.normal.from(t).normalize();const r=-this.normal.dot(e);return this.distance=r,this}fromCoefficients(e,t,r,n){return this.normal.set(e,t,r),es(hs(this.normal.len(),1)),this.distance=n,this}clone(e){return new xp(this.normal,this.distance)}equals(e){return hs(this.distance,e.distance)&&hs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const t=kp.copy(this.normal).transformAsVector(e).normalize(),r=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(r,t)}projectPointOntoPlane(e,t=[0,0,0]){e=_p.from(e);const r=this.getPointDistance(e),n=kp.copy(this.normal).scale(r);return e.subtract(n).to(t)}}const Ep=[new Ds([1,0,0]),new Ds([0,1,0]),new Ds([0,0,1])],Ap=new Ds,Sp=new Ds;new xp(new Ds(1,0,0),0);class jp{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e,es(this.planes.every(e=>e instanceof xp))}fromBoundingSphere(e){this.planes.length=2*Ep.length;const t=e.center,r=e.radius;let n=0;for(const e of Ep){let i=this.planes[n],a=this.planes[n+1];i||(i=this.planes[n]=new xp),a||(a=this.planes[n+1]=new xp);const o=Ap.copy(e).scale(-r).add(t);e.dot(o);i.fromPointNormal(o,e);const s=Ap.copy(e).scale(r).add(t),u=Sp.copy(e).negate();u.dot(s);a.fromPointNormal(s,u),n+=2}return this}computeVisibility(e){es(e);let t=Ah.INSIDE;for(const r of this.planes){switch(e.intersectPlane(r)){case Ah.OUTSIDE:return Ah.OUTSIDE;case Ah.INTERSECTING:t=Ah.INTERSECTING}}return t}computeVisibilityWithPlaneMask(e,t){if(es(e,"boundingVolume is required."),es(Number.isFinite(t),"parentPlaneMask is required."),t===jp.MASK_OUTSIDE||t===jp.MASK_INSIDE)return t;let r=jp.MASK_INSIDE;const n=this.planes;for(let i=0;i<this.planes.length;++i){const a=i<31?1<<i:0;if(i<31&&0==(t&a))continue;const o=n[i],s=e.intersectPlane(o);if(s===Ah.OUTSIDE)return jp.MASK_OUTSIDE;s===Ah.INTERSECTING&&(r|=a)}return r}}new Ds,new Ds,new Ds,new Ds,new Ds;const Tp=new Ds,Cp=new Ds,Bp=new Ds,Rp=new Ds,Op=new Ds,Ip=new Ds,Pp=new Ds,Dp=new Ds,Mp=new Ds,Fp=new Ds,Lp=new Ds,Np=new Ds;Math.PI;const zp=new Dh,Up=new Dh,qp=new Dh,Hp=new Dh,Gp=new Dh;function Vp(e,t={}){const r=Xs;let n=0,i=0;const a=Up,o=qp;a.identity(),o.copy(e);const s=r*function(e){let t=0;for(let r=0;r<9;++r){const n=e[r];t+=n*n}return Math.sqrt(t)}(o);for(;i<10&&Jp(o)>s;)Qp(o,Hp),Gp.copy(Hp).transpose(),o.multiplyRight(Hp),o.multiplyLeft(Gp),a.multiplyRight(Hp),++n>2&&(++i,n=0);return t.unitary=a.toTarget(t.unitary),t.diagonal=o.toTarget(t.diagonal),t}const Wp=[1,0,0],Kp=[2,2,1];function Jp(e){let t=0;for(let r=0;r<3;++r){const n=e[zp.getElementIndex(Kp[r],Wp[r])];t+=2*n*n}return Math.sqrt(t)}function Qp(e,t){const r=$s;let n=0,i=1;for(let t=0;t<3;++t){const r=Math.abs(e[zp.getElementIndex(Kp[t],Wp[t])]);r>n&&(i=t,n=r)}const a=Wp[i],o=Kp[i];let s=1,u=0;if(Math.abs(e[zp.getElementIndex(o,a)])>r){const t=(e[zp.getElementIndex(o,o)]-e[zp.getElementIndex(a,a)])/2/e[zp.getElementIndex(o,a)];let r;r=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),s=1/Math.sqrt(1+r*r),u=r*s}return Dh.IDENTITY.to(t),t[zp.getElementIndex(a,a)]=t[zp.getElementIndex(o,o)]=s,t[zp.getElementIndex(o,a)]=u,t[zp.getElementIndex(a,o)]=-u,t}const Yp=new Ds,$p=new Ds,Xp=new Ds,Zp=new Ds,ef=new Ds,tf=new Dh,rf={diagonal:new Dh,unitary:new Dh};const nf=0,af=1,of=3,sf=4,uf=5,cf=1,lf=2,hf="empty",pf="scenegraph",ff="pointcloud",df="mesh",mf="I3S",gf="TILES3D",yf="geometricError",bf=1;async function vf(e){return JSON.parse((new TextDecoder).decode(e))}const wf={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.3.0-alpha.4",mimeTypes:["application/json"],parse:async function(e){return e=vf(e)},extensions:["json"],options:{}};function _f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class kf{constructor(e,t){var r,n;_f(this,"tileset",void 0),_f(this,"nodePages",[]),_f(this,"pendingNodePages",[]),_f(this,"nodesPerPage",void 0),_f(this,"options",void 0),_f(this,"lodSelectionMetricType",void 0),_f(this,"textureDefinitionsSelectedFormats",[]),_f(this,"nodesInNodePages",void 0),_f(this,"textureLoaderOptions",{}),this.tileset={...e},this.nodesPerPage=(null===(r=e.nodePages)||void 0===r?void 0:r.nodesPerPage)||64,this.lodSelectionMetricType=null===(n=e.nodePages)||void 0===n?void 0:n.lodSelectionMetricType,this.options=t,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(e)}async getNodeById(e){const t=Math.floor(e/this.nodesPerPage);if(!this.nodePages[t]&&!this.pendingNodePages[t]){var r;const e=rh(`${this.tileset.url}/nodepages/${t}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.pendingNodePages[t]={status:"Pending",promise:Zo(e,wf,this.options)},this.nodePages[t]=await this.pendingNodePages[t].promise,this.nodesInNodePages+=this.nodePages[t].nodes.length,this.pendingNodePages[t].status="Done"}"Pending"===this.pendingNodePages[t].status&&(this.nodePages[t]=await this.pendingNodePages[t].promise);const n=e%this.nodesPerPage;return this.nodePages[t].nodes[n]}async formTileFromNodePages(e){const t=await this.getNodeById(e),r=[],n=[];for(const e of t.children||[])n.push(this.getNodeById(e));const i=await Promise.all(n);for(const e of i)r.push({id:e.index.toString(),obb:e.obb});let a,o,s,u="jpg",c=[],l=!1;if(t&&t.mesh){const{url:e,isDracoGeometry:r}=t.mesh.geometry&&this.getContentUrl(t.mesh.geometry)||{isDracoGeometry:!1};a=e,l=r;const{textureData:n,materialDefinition:i}=this.getInformationFromMaterial(t.mesh.material);s=i,u=n.format||u,n.name&&(o=`${this.tileset.url}/nodes/${t.mesh.material.resource}/textures/${n.name}`),this.tileset.attributeStorageInfo&&(c=function(e,t){const r=[],{attributeStorageInfo:n,url:i}=e;for(let e=0;e<n.length;e++){const a=n[e].key;r.push(`${i}/nodes/${t}/attributes/${a}/0`)}return r}(this.tileset,t.mesh.attribute.resource))}const h=this.getLodSelection(t);return xf({id:e.toString(),lodSelection:h,obb:t.obb,contentUrl:a,textureUrl:o,attributeUrls:c,materialDefinition:s,textureFormat:u,textureLoaderOptions:this.textureLoaderOptions,children:r,isDracoGeometry:l})}getContentUrl(e){let t=null;const r=this.tileset.geometryDefinitions[e.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(e=>e.compressedAttributes&&"draco"===e.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(e=>!e.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);t={url:`${this.tileset.url}/nodes/${e.resource}/geometries/${n}`,isDracoGeometry:i}}return t}getLodSelection(e){const t=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&t.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(e.lodThreshold/(.25*Math.PI))}),t.push({metricType:this.lodSelectionMetricType,maxError:e.lodThreshold}),t}getInformationFromMaterial(e){const t={textureData:{name:null}};if(e){var r;const a=null===(r=this.tileset.materialDefinitions)||void 0===r?void 0:r[e.definition];if(a){var n,i;t.materialDefinition=a;const e=null==a||null===(n=a.pbrMetallicRoughness)||void 0===n||null===(i=n.baseColorTexture)||void 0===i?void 0:i.textureSetDefinitionId;"number"==typeof e&&(t.textureData=this.textureDefinitionsSelectedFormats[e]||t.textureData)}}return t}initSelectedFormatsForTextureDefinitions(e){this.textureDefinitionsSelectedFormats=[];const t=this.getSupportedTextureFormats(),r=e.textureSetDefinitions||[];for(const e of r){const r=e&&e.formats||[];let n=null;for(const e of t){const t=r.find(t=>t.format===e);if(t){n=t;break}}n&&"ktx2"===n.format&&(this.textureLoaderOptions.basis={format:Ql(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(n)}}getSupportedTextureFormats(){const e=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const t=Ul();t.has("etc2")&&e.push("ktx-etc2"),t.has("dxt")&&e.push("dds"),e.push("ktx2")}return e.push("jpg"),e.push("png"),e}}function xf(e){var t,r;const n={};let i=[0,0,0,1];if(e.mbs)i=e.mbs,n.sphere=[..._u.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){n.box=[..._u.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];const t=(new wp).fromCenterHalfSizeQuaternion(n.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();n.sphere=[...t.center,t.radius],i=[...e.obb.center,t.radius]}const a=null===(t=e.lodSelection)||void 0===t?void 0:t[0].metricType,o=null===(r=e.lodSelection)||void 0===r?void 0:r[0].maxError,s=e.transform,u=df,c=lf;return{...e,mbs:i,boundingVolume:n,lodMetricType:a,lodMetricValue:o,transformMatrix:s,type:u,refine:c}}const Ef=/layers\/[0-9]+$/,Af=/nodes\/([0-9-]+|root)$/,Sf={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.3.0-alpha.4",mimeTypes:["application/octet-stream"],parse:async function(e,t={},r){const n=r.url;t.i3s=t.i3s||{};if("504b0304"===function(e){if(e instanceof ArrayBuffer)return[...new Uint8Array(e,0,4)].map(e=>e.toString(16).padStart(2,"0")).join("");return null}(e))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i,a;i="auto"===t.i3s.isTileset?Ef.test(n):t.i3s.isTileset;a="auto"===t.isTileHeader?Af.test(n):t.i3s.isTileHeader;e=i?await async function(e,t,r){const n=JSON.parse((new TextDecoder).decode(e));return n.loader=Sf,await async function(e,t,r){if(e.url=r.url,e.nodePages)e.nodePagesTile=new kf(e,t),e.root=e.nodePagesTile.formTileFromNodePages(0);else{var n;const r=rh(e.url+"/nodes/root",null===(n=t.i3s)||void 0===n?void 0:n.token);e.root=await Zo(r,e.loader,{...t,i3s:{...t.i3s,loadContent:!1,isTileHeader:!0,isTileset:!1}})}e.basePath=e.url,e.type=mf,e.lodMetricType=e.root.lodMetricType,e.lodMetricValue=e.root.lodMetricValue}(n,t,r),n}(e,t,r):a?await async function(e,t){return function(e,t){const r=t.url||"";let n,i,a;return e.geometryData&&(n=`${r}/${e.geometryData[0].href}`),e.textureData&&(i=`${r}/${e.textureData[0].href}`),e.attributeData&&(a=function(e,t){const{attributeData:r=[]}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(r,e)),xf({...e,url:r,contentUrl:n,textureUrl:i,attributeUrls:a,isDracoGeometry:!1})}(e=JSON.parse((new TextDecoder).decode(e)),t)}(e,r):await async function(e,t){return await Xo(e,Eh,t)}(e,t);return e},extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:lh.METER_OFFSETS,colorsByAttribute:null}}};function jf(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}class Tf{constructor(e,t){wo(this,"name",void 0),wo(this,"type",void 0),wo(this,"sampleSize",1),wo(this,"time",void 0),wo(this,"count",void 0),wo(this,"samples",void 0),wo(this,"lastTiming",void 0),wo(this,"lastSampleTime",void 0),wo(this,"lastSampleCount",void 0),wo(this,"_count",0),wo(this,"_time",0),wo(this,"_samples",0),wo(this,"_startTime",0),wo(this,"_timerPending",!1),this.name=e,this.type=t,this.reset()}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=jf(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(jf()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class Cf{constructor(e){wo(this,"id",void 0),wo(this,"stats",{}),this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e in this.stats)this.stats[e].reset();return this}forEach(e){for(const t in this.stats)e(this.stats[t])}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(e){if(!e||!e.name)return null;const{name:t,type:r}=e;return this.stats[t]||(this.stats[t]=e instanceof Tf?e:new Tf(t,r)),this.stats[t]}}function Bf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Rf={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class Of{constructor(e={}){Bf(this,"props",void 0),Bf(this,"stats",void 0),Bf(this,"activeRequestCount",0),Bf(this,"requestQueue",[]),Bf(this,"requestMap",new Map),Bf(this,"deferredUpdate",null),this.props={...Rf,...e},this.stats=new Cf({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(e,t=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);const r={handle:e,priority:0,getPriority:t},n=new Promise(e=>(r.resolve=e,r));return this.requestQueue.push(r),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){const{handle:t,resolve:r}=e;let n=!1;const i=()=>{n||(n=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(let t=0;t<e;++t){const e=this.requestQueue.shift();e&&this._issueRequest(e)}}}_updateAllRequests(){const e=this.requestQueue;for(let t=0;t<e.length;++t){const r=e[t];this._updateRequest(r)||(e.splice(t,1),this.requestMap.delete(r.handle),t--)}e.sort((e,t)=>e.priority-t.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}function If(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Pf{constructor(e,t,r){If(this,"item",void 0),If(this,"previous",void 0),If(this,"next",void 0),this.item=e,this.previous=t,this.next=r}}function Df(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Mf{constructor(){Df(this,"head",null),Df(this,"tail",null),Df(this,"_length",0)}get length(){return this._length}add(e){const t=new Pf(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,t){e!==t&&(this.remove(t),this._insert(e,t))}_insert(e,t){const r=e.next;e.next=t,this.tail===e?this.tail=t:r.previous=t,t.next=r,t.previous=e,++this._length}}function Ff(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lf(e){return null!=e}class Nf{constructor(){Ff(this,"_list",void 0),Ff(this,"_sentinel",void 0),Ff(this,"_trimTiles",void 0),this._list=new Mf,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){const t=e._cacheNode;Lf(t)&&this._list.splice(this._sentinel,t)}add(e,t,r){Lf(t._cacheNode)||(t._cacheNode=this._list.add(t),r&&r(e,t))}unloadTile(e,t,r){const n=t._cacheNode;Lf(n)&&(this._list.remove(n),t._cacheNode=void 0,r&&r(e,t))}unloadTiles(e,t){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,i=1024*e.maximumMemoryUsage*1024,a=this._sentinel;let o=n.head;for(;o!==a&&(e.gpuMemoryUsageInBytes>i||r);){const r=o.item;o=o.next,this.unloadTile(e,r,t)}}trim(){this._trimTiles=!0}}const zf=new Ds,Uf=new Ds,qf=new jp([new xp,new xp,new xp,new xp,new xp,new xp]);function Hf(e,t){const{cameraDirection:r,cameraUp:n,height:i}=e,{metersPerUnit:a}=e.distanceScales,o=Vf(e,e.center),s=_u.WGS84.eastNorthUpToFixedFrame(o),u=e.unprojectPosition(e.cameraPosition),c=_u.WGS84.cartographicToCartesian(u,new Ds),l=new Ds(s.transformAsVector(new Ds(r).scale(a))).normalize(),h=new Ds(s.transformAsVector(new Ds(n).scale(a))).normalize();!function(e){const t=e.getFrustumPlanes(),r=Gf(t.near,e.cameraPosition),n=Vf(e,r),i=Vf(e,e.cameraPosition,Uf);let a=0;qf.planes[a++].fromPointNormal(n,zf.copy(n).subtract(i));for(const i in t){if("near"===i)continue;const o=Gf(t[i],r,Uf),s=Vf(e,o,Uf);qf.planes[a++].fromPointNormal(s,zf.copy(n).subtract(s))}}(e);const p=e.constructor,{longitude:f,latitude:d,width:m,bearing:g,zoom:y}=e;return{camera:{position:c,direction:l,up:h},viewport:e,topDownViewport:new p({longitude:f,latitude:d,height:i,width:m,bearing:g,zoom:y,pitch:0}),height:i,cullingVolume:qf,frameNumber:t,sseDenominator:1.15}}function Gf(e,t,r=new Ds){const n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Vf(e,t,r=new Ds){const n=e.unprojectPosition(t);return _u.WGS84.cartographicToCartesian(n,r)}const Wf=new Ds;function Kf(e,t){if(e instanceof wp){const{halfAxes:r}=e,n=function(e){e.getColumn(0,Wf);const t=e.getColumn(1),r=e.getColumn(2),n=Wf.add(t).add(r);return n.len()}(r);return Math.log2(6356752.314245179/(n+t[2]))}if(e instanceof Th){const{radius:r}=e;return Math.log2(6356752.314245179/(r+t[2]))}if(e.width&&e.height){const{width:t,height:r}=e;return(Math.log2(6378137/t)+Math.log2(6378137/r))/2}return 1}function Jf(e,t,r){const n=_u.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],new Ds),i=Math.sqrt(Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2)+Math.pow(n[2]-r[2],2));return Math.log2(6356752.314245179/(i+t[2]))}function Qf(e){return null!=e}const Yf=new Ds,$f=new Ds,Xf=new Ds;function Zf(e,t,r){if(Vi(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,r){const n=new Ds(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(10===e.length){const t=e.slice(3,6),r=new np;r.fromArray(e,6);const n=new Ds([1,0,0]),a=new Ds([0,1,0]),o=new Ds([0,0,1]);n.transformByQuaternion(r),n.scale(t[0]),a.transformByQuaternion(r),a.scale(t[1]),o.transformByQuaternion(r),o.scale(t[2]),i=[...n.toArray(),...a.toArray(),...o.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];const a=t.transformAsVector(i.slice(0,3)),o=t.transformAsVector(i.slice(3,6)),s=t.transformAsVector(i.slice(6,9)),u=new Dh([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);if(Qf(r))return r.center=n,r.halfAxes=u,r;return new wp(n,u)}(e.box,t,r);if(e.region){const[t,r,n,i,a,o]=e.region,s=_u.WGS84.cartographicToCartesian([cs(t),cs(i),a],$f),u=_u.WGS84.cartographicToCartesian([cs(n),cs(r),o],Xf),c=(new Ds).addVectors(s,u).multiplyScalar(.5),l=(new Ds).subVectors(s,u).len()/2;return ed([c[0],c[1],c[2],l],new Js)}if(e.sphere)return ed(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function ed(e,t,r){const n=new Ds(e[0],e[1],e[2]);t.transform(n,n);const i=t.getScale(Yf),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return Qf(r)?(r.center=n,r.radius=o,r):new Th(n,o)}new Ds,new Ds,new Js,new Ds,new Ds,new Ds;function td(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){const r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return function(e,t){const r=e*t;return 1-Math.exp(-r*r)}(t,r)*n}return 0}const rd=new Ds,nd=new Ds,id=new Ds,ad=new Ds,od=new Ds,sd=new Js,ud=new Js;function cd(e,t){const{topDownViewport:r}=t,n=e.header.mbs[1],i=e.header.mbs[0],a=e.header.mbs[2],o=e.header.mbs[3],s=[...e.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);_u.WGS84.cartographicToCartesian(u,rd),nd.copy(rd).subtract(s).normalize(),_u.WGS84.eastNorthUpToFixedFrame(s,sd),ud.copy(sd).invert(),id.copy(rd).transform(ud);const c=Math.sqrt(id[0]*id[0]+id[1]*id[1]),l=c*c/id[2];ad.copy([id[0],id[1],l]);const h=ad.transform(sd).subtract(s).normalize(),p=nd.cross(h).normalize().scale(o).add(s),f=_u.WGS84.cartesianToCartographic(p),d=r.project([i,n,a]),m=r.project(f);return od.copy(d).subtract(m).magnitude()}function ld(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class hd{constructor(e=0){ld(this,"_map",new Map),ld(this,"_array",void 0),ld(this,"_length",void 0),this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return Vi(e<this._array.length),this._array[e]}set(e,t){Vi(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}delete(e){const t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){const t=this.length++;this._array[t]=e,this._map.set(e,t)}}pop(){const e=this._array[--this.length];return this._map.delete(e),e}reserve(e){Vi(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Vi(e>=0),this.length=e}trim(e){null==e&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}}function pd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fd={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class dd{traversalFinished(e){return!0}constructor(e){pd(this,"options",void 0),pd(this,"root",void 0),pd(this,"requestedTiles",void 0),pd(this,"selectedTiles",void 0),pd(this,"emptyTiles",void 0),pd(this,"lastUpdate",(new Date).getTime()),pd(this,"updateDebounceTime",1e3),pd(this,"_traversalStack",void 0),pd(this,"_emptyTraversalStack",void 0),pd(this,"_frameNumber",void 0),this.options={...fd,...e},this._traversalStack=new hd,this._emptyTraversalStack=new hd,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(e,t,r){this.root=e,this.options={...this.options,...r},this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){const r=this._traversalStack;for(e._selectionDepth=1,r.push(e);r.length>0;){const e=r.pop();let n=!1;this.canTraverse(e,t)&&(this.updateChildTiles(e,t),n=this.updateAndPushChildren(e,t,r,e.hasRenderContent?e._selectionDepth+1:e._selectionDepth));const i=e.parent,a=Boolean(!i||i._shouldRefine),o=!n;e.hasRenderContent?e.refine===cf?(this.loadTile(e,t),this.selectTile(e,t)):e.refine===lf&&(this.loadTile(e,t),o&&this.selectTile(e,t)):(this.emptyTiles[e.id]=e,this.loadTile(e,t),o&&this.selectTile(e,t)),this.touchTile(e,t),e._shouldRefine=n&&a}const n=(new Date).getTime();(this.traversalFinished(t)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(t))}updateChildTiles(e,t){const r=e.children;for(const e of r)this.updateTile(e,t);return!0}updateAndPushChildren(e,t,r,n){const{loadSiblings:i,skipLevelOfDetail:a}=this.options,o=e.children;o.sort(this.compareDistanceToCamera.bind(this));const s=e.refine===lf&&e.hasRenderContent&&!a;let u=!1,c=!0;for(const e of o)if(e._selectionDepth=n,e.isVisibleAndInRequestVolume?(r.find(e)&&r.delete(e),r.push(e),u=!0):(s||i)&&(this.loadTile(e,t),this.touchTile(e,t)),s){let r;if(r=!!e._inRequestVolume&&(e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t)),c=c&&r,!c)return!1}return u||(c=!1),c}updateTile(e,t){this.updateTileVisibility(e,t)}selectTile(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}canTraverse(e,t,r=!1,n=!1){return!!e.hasChildren&&(e.hasTilesetContent?!e.contentExpired:!(!n&&!e.isVisibleAndInRequestVolume)&&this.shouldRefine(e,t,r))}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,t,r){let n=e._screenSpaceError;return r&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(e,t){const r=[];if(this.options.viewportTraversersMap)for(const e in this.options.viewportTraversersMap){this.options.viewportTraversersMap[e]===t.viewport.id&&r.push(e)}else r.push(t.viewport.id);e.updateVisibility(t,r)}compareDistanceToCamera(e,t){return e._distanceToCamera-t._distanceToCamera}anyChildrenVisible(e,t){let r=!1;for(const n of e.children)n.updateVisibility(t),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(e,t){let r=!0;const n=this._emptyTraversalStack;for(n.push(e);n.length>0&&r;){const e=n.pop();this.updateTile(e,t),e.isVisibleAndInRequestVolume||this.loadTile(e,t),this.touchTile(e,t);if(!e.hasRenderContent&&this.canTraverse(e,t,!1,!0)){const t=e.children;for(const e of t)n.find(e)&&n.delete(e),n.push(e)}else e.contentAvailable||(r=!1)}return r}}function md(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gd=new Ds;class yd{constructor(e,t,r,n=""){md(this,"tileset",void 0),md(this,"header",void 0),md(this,"id",void 0),md(this,"url",void 0),md(this,"parent",void 0),md(this,"refine",void 0),md(this,"type",void 0),md(this,"contentUrl",void 0),md(this,"lodMetricType",void 0),md(this,"lodMetricValue",void 0),md(this,"boundingVolume",void 0),md(this,"content",void 0),md(this,"contentState",void 0),md(this,"gpuMemoryUsageInBytes",void 0),md(this,"children",void 0),md(this,"depth",void 0),md(this,"viewportIds",void 0),md(this,"transform",void 0),md(this,"extensions",void 0),md(this,"implicitTiling",void 0),md(this,"userData",void 0),md(this,"computedTransform",void 0),md(this,"hasEmptyContent",void 0),md(this,"hasTilesetContent",void 0),md(this,"traverser",void 0),md(this,"_cacheNode",void 0),md(this,"_frameNumber",void 0),md(this,"_lodJudge",void 0),md(this,"_expireDate",void 0),md(this,"_expiredContent",void 0),md(this,"_shouldRefine",void 0),md(this,"_distanceToCamera",void 0),md(this,"_centerZDepth",void 0),md(this,"_screenSpaceError",void 0),md(this,"_visibilityPlaneMask",void 0),md(this,"_visible",void 0),md(this,"_inRequestVolume",void 0),md(this,"_stackLength",void 0),md(this,"_selectionDepth",void 0),md(this,"_touchedFrame",void 0),md(this,"_visitedFrame",void 0),md(this,"_selectedFrame",void 0),md(this,"_requestedFrame",void 0),md(this,"_priority",void 0),md(this,"_contentBoundingVolume",void 0),md(this,"_viewerRequestVolume",void 0),md(this,"_initialTransform",void 0),this.header=t,this.tileset=e,this.id=n||t.id,this.url=t.url,this.parent=r,this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=nf,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new dd({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Js,this.transform=new Js,this._initializeLodMetric(t),this._initializeTransforms(t),this._initializeBoundingVolumes(t),this._initializeContent(t),this._initializeRenderingState(t),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,this.implicitTiling=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===of||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===nf}get contentExpired(){return this.contentState===sf}get contentFailed(){return this.contentState===uf}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}getScreenSpaceError(e,t){switch(this.tileset.type){case mf:return cd(this,e);case gf:return function(e,t,r){const n=e.tileset,i=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,a=r?i:e.lodMetricValue;if(0===a)return 0;const o=Math.max(e._distanceToCamera,1e-7),{height:s,sseDenominator:u}=t,{viewDistanceScale:c}=n.options;let l=a*s*(c||1)/(o*u);return l-=td(n,o),l}(this,e,t);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getPriority(){const e=this.tileset._traverser,{skipLevelOfDetail:t}=e.options,r=this.refine===cf||t;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===nf)return-1;const n=this.parent,i=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=af;const e=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!e)return this.contentState=nf,!1;try{const t=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await Zo(t,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=of,this._onContentLoaded(),!0}catch(e){throw this.contentState=uf,e}finally{e.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=nf,!0}updateVisibility(e,t){if(this._frameNumber===e.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:jp.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const e=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(e)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==jp.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}visibility(e,t){const{cullingVolume:r}=e,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,t)}contentVisibility(){return!0}distanceToTile(e){const t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){const t=this.boundingVolume;return gd.subVectors(t.center,e.position),e.direction.dot(gd)}insideViewerRequestVolume(e){const t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=sf,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new Js(e.transform):new Js;const t=this.parent,r=this.tileset,n=t&&t.computedTransform?t.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new Js(n).multiplyRight(this.transform);const i=t&&t._initialTransform?t._initialTransform.clone():new Js;this._initialTransform=new Js(i).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=nf,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=jp.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||lf}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(e){this.boundingVolume=Zf(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Zf(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Zf(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new Js){const t=e.clone().multiplyRight(this.transform);!t.equals(this.computedTransform)&&(this.computedTransform=t,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(t=this.tileset.tileset).asset&&t.asset.gltfUpAxis||"Y"}}var t}}class bd extends dd{compareDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,t){if(super.updateTileVisibility(e,t),!e.isVisibleAndInRequestVolume)return;const r=e.children.length>0;if(e.hasTilesetContent&&r){const r=e.children[0];return this.updateTileVisibility(r,t),void(e._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))return void(e._visible=!1);const n=e.refine===lf,i=e._optimChildrenWithinParent===bf;n&&i&&r&&!this.anyChildrenVisible(e,t)&&(e._visible=!1)}meetsScreenSpaceErrorEarly(e,t){const{parent:r}=e;return!(!r||r.hasTilesetContent||r.refine!==cf)&&!this.shouldRefine(e,t,!0)}}class vd{constructor(){var e,t,r;e=this,t="frameNumberMap",r=new Map,t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}register(e,t){const r=this.frameNumberMap.get(e)||new Map,n=r.get(t)||0;r.set(t,n+1),this.frameNumberMap.set(e,r)}deregister(e,t){const r=this.frameNumberMap.get(e);if(!r)return;const n=r.get(t)||1;r.set(t,n-1)}isZero(e,t){var r;return 0===((null===(r=this.frameNumberMap.get(e))||void 0===r?void 0:r.get(t))||0)}}function wd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _d="REQUESTED",kd="COMPLETED",xd="ERROR";class Ed{constructor(){wd(this,"_statusMap",void 0),wd(this,"pendingTilesRegister",new vd),this._statusMap={}}add(e,t,r,n){if(!this._statusMap[t]){const{frameNumber:i,viewport:{id:a}}=n;this._statusMap[t]={request:e,callback:r,key:t,frameState:n,status:_d},this.pendingTilesRegister.register(a,i),e().then(e=>{this._statusMap[t].status=kd;const{frameNumber:r,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,r),this._statusMap[t].callback(e,n)}).catch(e=>{this._statusMap[t].status=xd;const{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n),r(e)})}}update(e,t){if(this._statusMap[e]){const{frameNumber:r,viewport:{id:n}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(n,r);const{frameNumber:i,viewport:{id:a}}=t;this.pendingTilesRegister.register(a,i),this._statusMap[e].frameState=t}}find(e){return this._statusMap[e]}hasPendingTiles(e,t){return!this.pendingTilesRegister.isZero(e,t)}}class Ad extends dd{traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}constructor(e){var t,r,n;super(e),n=void 0,(r="_tileManager")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this._tileManager=new Ed}shouldRefine(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";const r=2*cd(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}(e,t),"DIG"===e._lodJudge}updateChildTiles(e,t){const r=e.header.children||[],n=e.children,i=e.tileset;for(const a of r){const r=`${a.id}-${t.viewport.id}`,o=n&&n.find(e=>e.id===r);if(o)o&&this.updateTile(o,t);else{let n=()=>this._loadTile(a.id,i);this._tileManager.find(r)?this._tileManager.update(r,t):(i.tileset.nodePages&&(n=()=>i.tileset.nodePagesTile.formTileFromNodePages(a.id)),this._tileManager.add(n,r,t=>this._onTileLoad(t,e,r),t))}}return!1}async _loadTile(e,t){const{loader:r}=t,n=t.getTileUrl(`${t.url}/nodes/${e}`),i={...t.loadOptions,i3s:{...t.loadOptions.i3s,isTileHeader:!0}};return await Zo(n,r,i)}_onTileLoad(e,t,r){const n=new yd(t.tileset,e,t,r);t.children.push(n);const i=this._tileManager.find(n.id).frameState;this.updateTile(n,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,i)}}function Sd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const jd={description:"",ellipsoid:_u.WGS84,modelMatrix:new Js,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Td="Tiles In Tileset(s)";class Cd{constructor(e,t){Sd(this,"options",void 0),Sd(this,"loadOptions",void 0),Sd(this,"type",void 0),Sd(this,"tileset",void 0),Sd(this,"loader",void 0),Sd(this,"url",void 0),Sd(this,"basePath",void 0),Sd(this,"modelMatrix",void 0),Sd(this,"ellipsoid",void 0),Sd(this,"lodMetricType",void 0),Sd(this,"lodMetricValue",void 0),Sd(this,"refine",void 0),Sd(this,"root",void 0),Sd(this,"roots",void 0),Sd(this,"asset",void 0),Sd(this,"description",void 0),Sd(this,"properties",void 0),Sd(this,"extras",void 0),Sd(this,"attributions",void 0),Sd(this,"credits",void 0),Sd(this,"stats",void 0),Sd(this,"traverseCounter",void 0),Sd(this,"geometricError",void 0),Sd(this,"selectedTiles",void 0),Sd(this,"updatePromise",null),Sd(this,"tilesetInitializationPromise",void 0),Sd(this,"cartographicCenter",void 0),Sd(this,"cartesianCenter",void 0),Sd(this,"zoom",void 0),Sd(this,"boundingVolume",void 0),Sd(this,"gpuMemoryUsageInBytes",void 0),Sd(this,"dynamicScreenSpaceErrorComputedDensity",void 0),Sd(this,"_traverser",void 0),Sd(this,"_cache",void 0),Sd(this,"_requestScheduler",void 0),Sd(this,"_frameNumber",void 0),Sd(this,"_queryParamsString",void 0),Sd(this,"_queryParams",void 0),Sd(this,"_extensionsUsed",void 0),Sd(this,"_tiles",void 0),Sd(this,"_pendingCount",void 0),Sd(this,"lastUpdatedVieports",void 0),Sd(this,"_requestedTiles",void 0),Sd(this,"_emptyTiles",void 0),Sd(this,"frameStateData",void 0),Sd(this,"maximumMemoryUsage",void 0),Vi(e),this.options={...jd,...t},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||n.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new Nf,this._requestScheduler=new Of({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new Cf({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(e){const t=[];for(const r of Object.keys(e))t.push(`${r}=${e[r]}`);switch(t.length){case 0:return"";case 1:return"?"+t[0];default:return"?"+t.join("&")}}(this._queryParams)),this._queryParamsString}setProps(e){this.options={...this.options,...e}}setOptions(e){this.options={...this.options,...e}}getTileUrl(e){return e.startsWith("data:")?e:`${e}${this.queryParams}`}hasExtension(e){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(e)>-1)}update(e=null){this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(e=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),e(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;const t=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const r=[];for(const e of t){const t=e.id;this._needTraverse(t)?r.push(t):this.traverseCounter--}for(const e of t){const t=e.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!r.includes(t))continue;const n=Hf(e,this._frameNumber);this._traverser.traverse(this.roots[t],n,this.options)}}_needTraverse(e){let t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}_onTraversalEnd(e){const t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[t],n=Object.values(this._traverser.selectedTiles),[i,a]=function(e,t,r){if(0===r||e.length<=r)return[e,[]];const n=[],{longitude:i,latitude:a}=t.viewport;for(const[t,r]of e.entries()){const[e,o]=r.header.mbs,s=Math.abs(i-e),u=Math.abs(a-o),c=Math.sqrt(u*u+s*s);n.push([t,c])}const o=n.sort((e,t)=>e[1]-t[1]),s=[];for(let t=0;t<r;t++)s.push(e[o[t][0]]);const u=[];for(let t=r;t<o.length;t++)u.push(e[o[t][0]]);return[s,u]}(n,e,this.options.maximumTilesSelected);r.selectedTiles=i;for(const e of a)e.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const e in this.frameStateData){const t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,t){if(e.length!==t.length)return!0;const r=new Set(e.map(e=>e.id)),n=new Set(t.map(e=>e.id));let i=e.filter(e=>!n.has(e.id)).length>0;return i=i||t.filter(e=>!r.has(e.id)).length>0,i}_loadTiles(){for(const e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,t)=>e._unloadTile(t))}_updateStats(){let e=0,t=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(e++,r.content.pointCount?t+=r.content.pointCount:t+=r.content.vertexCount);this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=e,this.stats.get("Points/Vertices").count=t}async _initializeTileSet(e){this.type===mf&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===gf&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===mf&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;const t=this.tileset.fullExtent;if(t){const{xmin:e,xmax:r,ymin:n,ymax:i,zmin:a,zmax:o}=t;return this.cartographicCenter=new Ds(e+(r-e)/2,n+(i-n)/2,a+(o-a)/2),this.cartesianCenter=_u.WGS84.cartographicToCartesian(this.cartographicCenter,new Ds),void(this.zoom=Jf(t,this.cartographicCenter,this.cartesianCenter))}const r=null===(e=this.tileset.store)||void 0===e?void 0:e.extent;if(r){const[e,t,n,i]=r;return this.cartographicCenter=new Ds(e+(n-e)/2,t+(i-t)/2,0),this.cartesianCenter=_u.WGS84.cartographicToCartesian(this.cartographicCenter,new Ds),void(this.zoom=function(e,t,r){const[n,i,a,o]=e;return Jf({xmin:n,xmax:a,ymin:i,ymax:o,zmin:0,zmax:0},t,r)}(r,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Ds,this.zoom=1}calculateViewPropsTiles3D(){const e=this.root;Vi(e);const{center:t}=e.boundingVolume;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Ds,void(this.zoom=1);0!==t[0]||0!==t[1]||0!==t[2]?this.cartographicCenter=_u.WGS84.cartesianToCartographic(t,new Ds):this.cartographicCenter=new Ds(0,0,-_u.WGS84.radii[0]),this.cartesianCenter=t,this.zoom=Kf(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Td),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points/Vertices","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(e,t){const r=new yd(this,e.root,t);if(t&&(t.children.push(r),r.depth=t.depth+1),this.type===gf){const e=[];for(e.push(r);e.length>0;){const t=e.pop();this.stats.get(Td).incrementCount();const r=t.header.children||[];for(const n of r){const r=new yd(this,n,t);t.children.push(r),r.depth=t.depth+1,e.push(r)}}}return r}_initializeTraverser(){let e;switch(this.type){case gf:e=bd;break;case mf:e=Ad;break;default:e=dd}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let t;try{this._onStartTileLoading(),t=await e.loadContent()}catch(t){this._onTileLoadError(e,t)}finally{this._onEndTileLoading(),this._onTileLoad(e,t)}}_onTileLoadError(e,t){this.stats.get("Failed Tile Loads").incrementCount();const r=t.message||t.toString(),n=e.url;console.error(`A 3D tile failed to load: ${e.url} ${r}`),this.options.onTileError(e,r,n)}_onTileLoad(e,t){if(t){if(this.type===mf){var r,n;const e=(null===(r=this.tileset)||void 0===r||null===(n=r.nodePagesTile)||void 0===n?void 0:n.nodesInNodePages)||0;this.stats.get(Td).reset(),this.stats.get(Td).addCount(e)}e&&e.content&&function(e,t){Vi(e),Vi(t);const{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:a}}=e;let o=new Js(i);switch(r&&o.translate(r),n){case"Z":break;case"Y":const e=(new Js).rotateX(Math.PI/2);o=o.multiplyRight(e);break;case"X":const t=(new Js).rotateY(-Math.PI/2);o=o.multiplyRight(t)}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);const s=new Ds(a);t.cartesianModelMatrix=o,t.cartesianOrigin=s;const u=_u.WGS84.cartesianToCartographic(s,new Ds),c=_u.WGS84.eastNorthUpToFixedFrame(s).invert();t.cartographicModelMatrix=c.multiplyRight(o),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}(e,e.content),this._addTileToCache(e),this.options.onTileLoad(e)}}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(e){this._cache.add(this,e,t=>t._updateCacheStats(e))}_updateCacheStats(e){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){const e=[];for(this.root&&e.push(this.root);e.length>0;){const t=e.pop();for(const r of t.children)e.push(r);this._destroyTile(t)}this.root=null}_destroySubtree(e){const t=e,r=[];for(r.push(t);r.length>0;){e=r.pop();for(const t of e.children)r.push(t);e!==t&&this._destroyTile(e)}t.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed,this.extras=e.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}const Bd=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],Rd=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],Od=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31];class Id{constructor(e){this.options=e,this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this._ix=this.options._width,this._iy=this.options._height}getHeight(e,t){if(e=Math.abs(e)>90?NaN:e,isNaN(e)||isNaN(t))return NaN;const r=function(e,t){t=Math.abs(t);let r=Pd(e,t);2*Math.abs(r)===t?r-=Pd(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t);return r}(t,360);let n=(t=-180!==r?r:180)*this.options._rlonres,i=-e*this.options._rlatres,a=Math.floor(n),o=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(i));n-=a,i-=o,o+=(this.options._height-1)/2,a+=a<0?this.options._width:a>=this.options._width?-this.options._width:0;let s=0,u=0,c=0,l=0,h=new Array(10);if(a!==this._ix||o!==this._iy)if(this.options.cubic){const e=[this._rawval(a,o-1),this._rawval(a+1,o-1),this._rawval(a-1,o),this._rawval(a,o),this._rawval(a+1,o),this._rawval(a+2,o),this._rawval(a-1,o+1),this._rawval(a,o+1),this._rawval(a+1,o+1),this._rawval(a+2,o+1),this._rawval(a,o+2),this._rawval(a+1,o+2)];let t=Rd;0!==o&&(t=o===this.options._height-2?Od:Bd);let r=372;0!==o&&(r=o===this.options._height-2?372:240);for(let n=0;n<10;++n){h[n]=0;for(let r=0;r<12;++r)h[n]+=e[r]*t[10*r+n];h[n]/=r}}else s=this._rawval(a,o),u=this._rawval(a+1,o),c=this._rawval(a,o+1),l=this._rawval(a+1,o+1);else this.options.cubic?h=this._t:(s=this._v00,u=this._v01,c=this._v10,l=this._v11);if(!this.options.cubic){const e=(1-i)*((1-n)*s+n*u)+i*((1-n)*c+n*l),t=this.options._offset+this.options._scale*e;return this._ix=a,this._iy=o,this._v00=s,this._v01=u,this._v10=c,this._v11=l,t}let p=h[0]+n*(h[1]+n*(h[3]+n*h[6]))+i*(h[2]+n*(h[4]+n*h[7])+i*(h[5]+n*h[8]+i*h[9]));return p=this.options._offset+this.options._scale*p,this._ix=a,this._iy=o,this._t=h,p}_rawval(e,t){e<0?e+=this.options._width:e>=this.options._width&&(e-=this.options._width),(t<0||t>=this.options._height)&&(t=t<0?-t:2*(this.options._height-1)-t,e+=(e<this.options._width/2?1:-1)*this.options._width/2);const r=this.options._datastart+2*(t*this.options._swidth+e);return this.options.data[r]<<8|this.options.data[r+1]}}function Pd(e,t){return e-Math.floor(e/t)*t}function Dd(e,t){const r=function*(e){let t=0;do{const r=e.indexOf(10,t);if(-1!==r){const n=e.subarray(t,r);t=r+1,yield{offset:t,line:Md(n)}}else{const r=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Md(r)}}}while(t<e.length);return{offset:t,line:""}}(e);let n=r.next();if(n.done||"P5"!==n.value.line)throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,h=0,p=null,f=null;do{n=r.next();const e=n.value.line;if(e.length){if("#"!==e[0]){let t=e.split(" ");if(t=t.filter(e=>""!==e),l=parseInt(t[0],10),h=parseInt(t[1],10),!l||!h)throw new Error("Geoid model file: Error reading raster size");break}{const r=e.split(" "),n=r[0],l=r[1];if("#"!==n||!l)continue;const h=r.length>2?r.slice(2):[];if("Description"===l)u=h.join(" ");else if("DateTime"===l)c=h.join(" ");else if("Offset"===l){if(!r[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(r[2],10)}else if("Scale"===l){if(!r[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(r[2])}else l===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(r[2]))&&(o=parseFloat(r[2])):l===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(r[2]))&&(s=parseFloat(r[2]))}}}while(!n.done);n=r.next();const d=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(65535!==d)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,f=l,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(0===a)throw new Error("Geoid model file: Scale not set");if(a<0)throw new Error("Geoid model file: Scale must be positive");if(h<2||l<2)throw new Error("Geoid model file: Raster size too small");if(1&l)throw new Error("Geoid model file: Raster width is odd");if(!(1&h))throw new Error("Geoid model file: Raster height is even");const m=l/360,g=(h-1)/180;return new Id({cubic:t.cubic,_width:l,_height:h,_rlonres:m,_rlatres:g,_offset:i,_scale:a,_swidth:f,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function Md(e){let t="";for(const r of e)t+=String.fromCharCode(r);return t}const Fd={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:"3.3.0-alpha.4",mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>Dd(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};function Ld(e,t){const r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=_u.WGS84.cartographicToCartesian(r,new Ds),i=(new wp).fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...i.center,...i.halfAxes.toArray()]}function Nd(e,t){const r=[],n=e.boundingVolume,i=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:2*t.mbs[3]*16/i},o={metricType:"maxScreenThresholdSQ",maxError:.25*Math.PI*a.maxError*a.maxError};return"OrientedBoundingBox"===n.constructor.name?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function zd(e){let t=(e.header.lodSelection.maxScreenThreshold||{}).maxError;if(!t){const r=e.header.lodSelection.maxScreenThresholdSQ;r&&(t=Math.sqrt(r.maxError/(.25*Math.PI)))}return t||(t=16),2*e.header.mbs[3]*16/t}r(260);var Ud=r(80),qd=r.n(Ud);function Hd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Gd={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log("Started "+e.props.command)}};class Vd{constructor({id:e="browser-driver"}={}){Hd(this,"id",void 0),Hd(this,"props",{...Gd}),Hd(this,"childProcess",null),Hd(this,"port",0),Hd(this,"successTimer",void 0),this.id=e}async start(e){e={...Gd,...e},this.props=e;const t=[...e.arguments];return this.port=Number(e.port),e.portArg&&(e.autoPort&&(this.port=await function(e=3e3){return new Promise(t=>{qd.a.exec("lsof -i -P -n | grep LISTEN",(r,n)=>{if(r)return void t(e);const i=[],a=/:(\d+) \(LISTEN\)/;n.split("\n").forEach(e=>{const t=a.exec(e);t&&i.push(Number(t[1]))});let o=e;for(;i.includes(o);)o++;t(o)})})}(e.port)),t.push(e.portArg,String(this.port))),await new Promise((r,n)=>{try{this._setTimeout(()=>{e.onSuccess&&e.onSuccess(this),r({})}),console.log(`Spawning ${e.command} ${e.arguments.join(" ")}`);const i=Ud.spawn(e.command,t,e.spawn);this.childProcess=i,i.stdout.on("data",e=>{console.log(e.toString())}),i.stderr.on("data",e=>{console.log(`Child process wrote to stderr: "${e}".`),this._clearTimeout(),n(new Error(e))}),i.on("error",e=>{console.log("Child process errored with "+e),this._clearTimeout(),n(e)}),i.on("close",e=>{console.log("Child process exited with "+e),this.childProcess=null,this._clearTimeout(),r({})})}catch(e){n(e)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(e=0){try{await this.stop(),process.exit(e)}catch(e){console.error(e.message||e),process.exit(1)}}_setTimeout(e){Number(this.props.wait)>0&&(this.successTimer=setTimeout(e,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}}var Wd=r(79),Kd=r.n(Wd);const Jd="function"==typeof atob?atob:"function"==typeof Buffer?function(e){return Buffer.from(e,"base64").toString("binary")}:$d,Qd=Jd("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"),Yd=!(!WebAssembly||Jd===$d)&&function(e){var t,r,n,i=-1;t=e.length-1,r=new ArrayBuffer(e.length),n=new Uint8Array(r);for(;t>i++;)n[i]=e.charCodeAt(i);return n}(Qd).buffer;Math.floor(1048576.00032768);function $d(e){return e}Yd||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");r(113);async function Xd(e,t,r,n,i){"win32"===process.platform?await async function(e,t,r=0,n=Object(Ci.join)(".","*"),i){"@"===n[0]&&(n="*"+n.substr(1));const a=nm(t),o=["a","-tzip","-mx="+r,a,n],s=new Vd;await s.start({command:i,arguments:o,spawn:{cwd:""+e},wait:0})}(e,t,r,n,i):await async function(e,t,r=0,n="."){const i=nm(t),a=["-"+r,"-r",i,n],o=new Vd;await o.start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}(e,t,r,n)}async function Zd(e,t,r="index.json"){let n;n=t instanceof Promise?new Uint8Array(await t):t instanceof ArrayBuffer?new Uint8Array(t):t,await fe.promises.mkdir(e,{recursive:!0});const i=Object(Ci.join)(e,r);try{await fe.promises.writeFile(i,n)}catch(e){throw e}return console.log(i+" saved."),i}async function em(e,t,r="index.json",n=!0){const i=await Zd(e,t,r);if(n){const e=await function(e){const t=e+".gz",r=Object(ve.createGzip)(),n=Object(fe.createReadStream)(e),i=Object(fe.createWriteStream)(t);return new Promise((e,a)=>{n.on("end",()=>{console.log(t+" compressed and saved."),e(t)}),n.on("error",e=>{console.log(t+": compression error!"),a(e)}),n.pipe(r).pipe(i)})}(i);return await rm(i),e}return i}function tm(e){return fe.promises.rmdir(e,{recursive:!0})}function rm(e){return fe.promises.unlink(e)}function nm(e){return Object(Ci.isAbsolute)(e)?e:Object(Ci.join)(process.cwd(),e)}function im(e){let t=e[0];const r=Math.floor(t/3600);t-=3600*r;const n=Math.floor(t/60);t-=60*n;const i=Math.floor(t),a=e[1]/1e6;let o="";return r&&(o+=r+"h "),n&&(o+=n+"m "),i&&(o+=i+"s"),o||(o+=a+"ms"),o}async function am(e){const{slpk:t,outputPath:r,tilesetName:n}=e,i=nm(r);try{if(t){const e=Object(Ci.join)(i,n+".slpk");return(await fe.promises.stat(e)).size}const e=Object(Ci.join)(i,n);return await async function e(t){let r=0;const n=await fe.promises.readdir(t);for(const i of n){const n=await fe.promises.stat(Object(Ci.join)(t,i));n.isDirectory()?r+=await e(Object(Ci.join)(t,i)):r+=n.size}return r}(e)}catch(e){return console.log("Calculate file sizes error: ",e),null}}const om=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(e=>Ii()(e,om()))}});function sm(e,t){let r,n,i;const a=e.boundingVolume,o=_u.WGS84.cartesianToCartographic(a.center,new Ds);return o[2]=o[2]-t.getHeight(o[1],o[0]),a instanceof wp?(n=a.halfSize,r=new Ds(n[0],n[1],n[2]).len(),i=a.quaternion):(r=e.boundingVolume.radius,n=[r,r,r],i=(new np).fromMatrix3(new Dh([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[o[0],o[1],o[2],r],obb:{center:[o[0],o[1],o[2]],halfSize:n,quaternion:i}}}function um(e,t){const r=function(e){const t=[];for(let r=0;r<e.length;r+=3){const n=new Ds([e[r],e[r+1],e[r+2]]);t.push(n)}return t}(e),n=function(e,t=new wp){if(!e||0===e.length)return t.halfAxes=new Dh([0,0,0,0,0,0,0,0,0]),t.center=new Ds,t;const r=e.length,n=new Ds(0,0,0);for(const t of e)n.add(t);const i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(const t of e){const e=Yp.copy(t).subtract(n);a+=e.x*e.x,o+=e.x*e.y,s+=e.x*e.z,u+=e.y*e.y,c+=e.y*e.z,l+=e.z*e.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;const h=tf;h[0]=a,h[1]=o,h[2]=s,h[3]=o,h[4]=u,h[5]=c,h[6]=s,h[7]=c,h[8]=l;const{unitary:p}=Vp(h,rf),f=t.halfAxes.copy(p);let d=f.getColumn(0,Xp),m=f.getColumn(1,Zp),g=f.getColumn(2,ef),y=-Number.MAX_VALUE,b=-Number.MAX_VALUE,v=-Number.MAX_VALUE,w=Number.MAX_VALUE,_=Number.MAX_VALUE,k=Number.MAX_VALUE;for(const t of e)y=Math.max(t.dot(d),y),b=Math.max(t.dot(m),b),v=Math.max(t.dot(g),v),w=Math.min(t.dot(d),w),_=Math.min(t.dot(m),_),k=Math.min(t.dot(g),k);d=d.multiplyByScalar(.5*(w+y)),m=m.multiplyByScalar(.5*(_+b)),g=g.multiplyByScalar(.5*(k+v)),t.center.copy(d).add(m).add(g);const x=$p.set(y-w,b-_,v-k).multiplyByScalar(.5),E=new Dh([x[0],0,0,0,x[1],0,0,0,x[2]]);return t.halfAxes.multiplyRight(E),t}(r),i=function(e,t=new Th){if(!e||0===e.length)return t.fromCenterRadius([0,0,0],0);const r=Pp.copy(e[0]),n=Tp.copy(r),i=Cp.copy(r),a=Bp.copy(r),o=Rp.copy(r),s=Op.copy(r),u=Ip.copy(r);for(const t of e){r.copy(t);const e=r.x,c=r.y,l=r.z;e<n.x&&r.copy(n),e>o.x&&r.copy(o),c<i.y&&r.copy(i),c>s.y&&r.copy(s),l<a.z&&r.copy(a),l>u.z&&r.copy(u)}const c=Dp.copy(o).subtract(n).magnitudeSquared(),l=Dp.copy(s).subtract(i).magnitudeSquared(),h=Dp.copy(u).subtract(a).magnitudeSquared();let p=n,f=o,d=c;l>d&&(d=l,p=i,f=s),h>d&&(d=h,p=a,f=u);const m=Mp;m.x=.5*(p.x+f.x),m.y=.5*(p.y+f.y),m.z=.5*(p.z+f.z);let g=Dp.copy(f).subtract(m).magnitudeSquared(),y=Math.sqrt(g);const b=Fp;b.x=n.x,b.y=i.y,b.z=a.z;const v=Lp;v.x=o.x,v.y=s.y,v.z=u.z;const w=Np.copy(b).add(v).multiplyByScalar(.5);let _=0;for(const t of e){r.copy(t);const e=Dp.copy(r).subtract(w).magnitude();e>_&&(_=e);const n=Dp.copy(r).subtract(m).magnitudeSquared();if(n>g){const e=Math.sqrt(n);y=.5*(y+e),g=y*y;const t=e-y;m.x=(y*m.x+t*r.x)/e,m.y=(y*m.y+t*r.y)/e,m.z=(y*m.z+t*r.z)/e}}return y<_?(m.to(t.center),t.radius=y):(w.to(t.center),t.radius=_),t}(r);let a=_u.WGS84.cartesianToCartographic(i.center,new Ds),o=_u.WGS84.cartesianToCartographic(n.center,new Ds);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],i.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function cm(e){const t=e[3],r=new Ds(e[0],e[1],e[2]),n=new Dh([t,0,0,0,t,0,0,0,t]);return new wp(r,n)}async function lm(e,t,r={},n={}){const i=function(e){const t="3.3.0-alpha.4"!==e.version?" (worker-utils@3.3.0-alpha.4)":"";return`${e.name}@${e.version}${t}`}(e),a=za.getWorkerFarm(r),{source:o}=r,s={name:i,source:o};o||(s.url=Ua(e,r));const u=a.getWorkerPool(s),c=r.jobName||e.name,l=await u.startJob(c,hm.bind(null,n)),h=function e(t){if(null===t)return{};const r=Object.assign({},t);return Object.keys(r).forEach(n=>{"object"!=typeof t[n]||ArrayBuffer.isView(t[n])?"function"==typeof r[n]||r[n]instanceof RegExp?r[n]={}:r[n]=t[n]:r[n]=e(t[n])}),r}(r);l.postMessage("process",{input:t,options:h});return(await l.result).result}async function hm(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{if(!e.process)return void t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});const r=await e.process(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("process-on-worker: unknown message "+r)}}const pm={id:"3d-tiles-attributes",name:"3DTiles Attributes Worker",module:"tile-converter",version:"3.3.0-alpha.4",options:{attributes:null}};const fm="Tile converter does not work in browser, only in node js environment";function dm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mm{constructor(){dm(this,"options",void 0),dm(this,"tilesetPath",void 0),dm(this,"vertexCounter",void 0),dm(this,"conversionStartTime",void 0),dm(this,"geoidHeightModel",void 0),dm(this,"sourceTileset",void 0),dm(this,"attributeStorageInfo",void 0),dm(this,"workerSource",{}),this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={}}async convert(e){if(Pi)return console.log(fm),fm;const{inputUrl:t,outputPath:r,tilesetName:n,maxDepth:i,egmFilePath:a}=e;this.conversionStartTime=Ri.a.hrtime(),this.options={maxDepth:i},console.log("Loading egm file..."),this.geoidHeightModel=await Zo(a,Fd),console.log("Loading egm file completed!"),await this.loadWorkers();const o=await Zo(t,Sf,{});this.sourceTileset=new Cd(o,{loadOptions:{_nodeWorkers:!0,reuseWorkers:!0,"i3s-content-nodejs":{workerUrl:"./modules/i3s/dist/i3s-content-nodejs-worker.js"},i3s:{coordinateSystem:lh.LNGLAT_OFFSETS,decodeTextures:!1}}}),await this.sourceTileset.tilesetInitializationPromise;const s=this.sourceTileset.root;s.header.obb||(s.header.obb=cm(s.header.mbs)),this.tilesetPath=Object(Ci.join)(""+r,""+n),this.attributeStorageInfo=o.attributeStorageInfo;try{await tm(this.tilesetPath)}catch(e){}const u={boundingVolume:{box:Ld(s.header.obb,this.geoidHeightModel)},geometricError:zd(s),children:[]};await this._addChildren(s,u,1);const c=Ii()({root:u},{asset:{path:"asset",transform:e=>Ii()(e,{version:{path:"version",default:"1.0"}})},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>Ii()(e,om())}});await Zd(this.tilesetPath,JSON.stringify(c),"tileset.json"),this._finishConversion({slpk:!1,outputPath:r,tilesetName:n});za.getWorkerFarm({}).destroy()}async convertChildNode(e,t,r,n){const i=await this._loadChildNode(e,n);if(e.children.push(i),i.contentUrl){var a;await this.sourceTileset._loadTile(i),this.vertexCounter+=i.content.vertexCount;let e=null;this.attributeStorageInfo&&(e=await this._loadChildAttributes(i,this.attributeStorageInfo)),i.header.obb||(i.header.obb=cm(i.header.mbs));const n={box:Ld(i.header.obb,this.geoidHeightModel)},o={boundingVolume:n,geometricError:zd(i),children:[]},s={tileContent:i.content,textureFormat:null==i||null===(a=i.header)||void 0===a?void 0:a.textureFormat},u=await function(e,t){return lm(pm,e,t)}(s,{source:this.workerSource.tile3dWorkerSource,featureAttributes:e});o.content={uri:i.id+".b3dm",boundingVolume:n},await Zd(this.tilesetPath,new Uint8Array(u),i.id+".b3dm"),t.children.push(o),i.unloadContent(),await this._addChildren(i,o,r+1)}else await this._addChildren(i,t,r+1)}async _addChildren(e,t,r){if(this.options.maxDepth&&r>this.options.maxDepth)return;const n=[];for(const i of e.header.children||[])n.push(this.convertChildNode(e,t,r,i));await Promise.all(n)}async _loadChildNode(e,t){let r;if(this.sourceTileset.tileset.nodePages)console.log("Node conversion: "+t.id),r=await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(t.id);else{const{loader:n}=this.sourceTileset,i=this._relativeUrlToFullUrl(e.url,t.href),a={i3s:{...this.sourceTileset.loadOptions,isTileHeader:!0,loadContent:!1}};console.log("Node conversion: "+i),r=await Zo(i,n,a)}return new yd(this.sourceTileset,r,e)}_relativeUrlToFullUrl(e,t){let r=e.split("/");const n=t.split("/");for(const e of n)switch(e){case".":continue;case"..":r=r.slice(0,-1);break;default:r.push(e)}return r.join("/")}async _loadChildAttributes(e,t){const r=[],{attributeUrls:n}=e.header;for(let e=0;e<n.length;e++){const i=n[e],a=t[e],o={attributeName:a.name,attributeType:this._getAttributeType(a)};r.push(Zo(i,dh,o))}const i=await Promise.all(r);return this._replaceNestedArrays(i),Object.assign({},...i)}_getAttributeType(e){return e.attributeValues?e.attributeValues.valueType:e.objectIds?"Oid32":""}_replaceNestedArrays(e){for(let t=0;t<e.length;t++){const r=e[t];for(const e in r)r[e]=Array.from(r[e])}}async _finishConversion(e){const t=await am(e),r=im(Ri.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finish conversion of I3S"),console.log("Total conversion time: "+r),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",t," bytes"),console.log("------------------------------------------------")}async loadWorkers(){console.log("Loading workers source...");const e=Ua(pm,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.tile3dWorkerSource=r,console.log("Loading workers source completed!")}}async function gm(e,t,r){if(function(e,t){return!!za.isSupported()&&(!!(Pi||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(t,r={...pa(),...r}))return await lm(t,e,r);if(t.encode)return await t.encode(e,r);if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeText)return(new TextEncoder).encode(await t.encodeText(e,r));if(t.encodeInBatches){const n=function(e,t,r){if(t.encodeInBatches){const n=function(e){return[{table:e,start:0,end:e.length}]}(e);return t.encodeInBatches(n,r)}throw new Error("Writer could not encode data in batches")}(e,t,r),i=[];for await(const e of n)i.push(e);return Ja(...i)}if(!Pi&&t.encodeURLtoURL){const n=ym("input");await async function(e,t,r){e=Yi(e),Pi||await i.writeFile(e,Wa(t),{flag:"w"}),Vi(!1)}(n,e);const a=ym("output"),o=await async function(e,t,r,n){if(e=Yi(e),t=Yi(t),Pi||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}(n,a,t,r);return(await oa(o)).arrayBuffer()}throw new Error("Writer could not encode data")}function ym(e){return"/tmp/"+e}const bm={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"};Object.keys(bm);function vm(e,t,r){Vi(e instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}const wm={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},_m={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...wm},km={[wm.DOUBLE]:Float64Array,[wm.FLOAT]:Float32Array,[wm.UNSIGNED_SHORT]:Uint16Array,[wm.UNSIGNED_INT]:Uint32Array,[wm.UNSIGNED_BYTE]:Uint8Array,[wm.BYTE]:Int8Array,[wm.SHORT]:Int16Array,[wm.INT]:Int32Array},xm={DOUBLE:wm.DOUBLE,FLOAT:wm.FLOAT,UNSIGNED_SHORT:wm.UNSIGNED_SHORT,UNSIGNED_INT:wm.UNSIGNED_INT,UNSIGNED_BYTE:wm.UNSIGNED_BYTE,BYTE:wm.BYTE,SHORT:wm.SHORT,INT:wm.INT};class Em{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in km){if(km[t]===e)return t}throw new Error("Failed to convert GL type")}static fromName(e){const t=xm[e];if(!t)throw new Error("Failed to convert GL type");return t}static getArrayType(e){switch(e){case wm.UNSIGNED_SHORT_5_6_5:case wm.UNSIGNED_SHORT_4_4_4_4:case wm.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=km[e];if(!t)throw new Error("Failed to convert GL type");return t}}static getByteSize(e){return Em.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(Em.getArrayType(e))}static createTypedArray(e,t,r=0,n){void 0===n&&(n=(t.byteLength-r)/Em.getByteSize(e));return new(Em.getArrayType(e))(t,r,n)}}function Am(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Sm{constructor(e,t){Am(this,"json",void 0),Am(this,"buffer",void 0),Am(this,"featuresLength",0),Am(this,"_cachedTypedArrays",{}),this.json=e,this.buffer=t}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e,t=_m.UNSIGNED_INT,r=1){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(e,t,r,1,n.byteOffset):n}getPropertyArray(e,t,r){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(t=Em.fromName(n.componentType)),this._getTypedArrayFromBinary(e,t,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(e,t,n)}getProperty(e,t,r,n,i){const a=this.json[e];if(!a)return a;const o=this.getPropertyArray(e,t,r);if(1===r)return o[n];for(let e=0;e<r;++e)i[e]=o[r*n+e];return i}_getTypedArrayFromBinary(e,t,r,n,i){const a=this._cachedTypedArrays;let o=a[e];return o||(o=Em.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+i,n*r),a[e]=o),o}_getTypedArrayFromArray(e,t,r){const n=this._cachedTypedArrays;let i=n[e];return i||(i=Em.createTypedArray(t,r),n[e]=i),i}}const jm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tm={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},Cm={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};const Bm=e=>void 0!==e;function Rm(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy");const i=t.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?function(e,t){let r,n,i;const a=e.instancesLength,o=e.classes;let s,u=e.classIds,c=e.parentCounts,l=e.parentIds,h=a;Bm(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a));if(Bm(c))for(Bm(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,a)),s=new Uint16Array(a),h=0,r=0;r<a;++r)s[r]=h,h+=c[r];Bm(l)&&Bm(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,i=getBinaryAccessor(l),l=i.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,h));const p=o.length;for(r=0;r<p;++r){const e=o[r].length,n=o[r].instances,i=getBinaryProperties(e,n,t);o[r].instances=combine(i,n)}const f=new Array(p).fill(0),d=new Uint16Array(a);for(r=0;r<a;++r)n=u[r],d[r]=f[n],++f[n];const m={classes:o,classIds:u,classIndexes:d,parentCounts:c,parentIndexes:s,parentIds:l};return function(e){const t=e.classIds.length;for(let r=0;r<t;++r)Im(e,r,stack)}(m),m}(n,r):null}function Om(e,t,r){if(!e)return;const n=e.parentCounts;return e.parentIds?r(e,t):n>0?function(e,t,r){const n=e.classIds,i=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);const c=++marker,l=scratchStack;l.length=0,l.push(t);for(;l.length>0;){if(t=l.pop(),u[t]===c)continue;u[t]=c;const n=r(e,t);if(Bm(n))return n;const s=i[t],h=o[t];for(let e=0;e<s;++e){const r=a[h+e];r!==t&&l.push(r)}}return null}(e,t,r):function(e,t,r){let n=!0;for(;n;){const i=r(e,t);if(Bm(i))return i;const a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}(e,t,r)}function Im(e,t,r){const n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,o=e.classIds.length;if(!Bm(i))return;assert(t<o,`Parent index ${t} exceeds the total number of instances: ${o}`),assert(-1===r.indexOf(t),"Circular dependency detected in the batch table hierarchy."),r.push(t);const s=Bm(n)?n[t]:1,u=Bm(n)?a[t]:t;for(let n=0;n<s;++n){const a=i[u+n];a!==t&&Im(e,a,r)}r.pop(t)}function Pm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dm(e){return null!=e}const Mm=(e,t)=>e,Fm={HIERARCHY:!0,extensions:!0,extras:!0};class Lm{constructor(e,t,r,n={}){var i;Pm(this,"json",void 0),Pm(this,"binary",void 0),Pm(this,"featureCount",void 0),Pm(this,"_extensions",void 0),Pm(this,"_properties",void 0),Pm(this,"_binaryProperties",void 0),Pm(this,"_hierarchy",void 0),Vi(r>=0),this.json=e||{},this.binary=t,this.featureCount=r,this._extensions=(null===(i=this.json)||void 0===i?void 0:i.extensions)||{},this._properties={};for(const e in this.json)Fm[e]||(this._properties[e]=this.json[e]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Rm(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,t){if(this._checkBatchId(e),Vi("string"==typeof t,t),this._hierarchy){return Dm(Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return e.classes[n].name===t}))}return!1}isExactClass(e,t){return Vi("string"==typeof t,t),this.getExactClassName(e)===t}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){const t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}hasProperty(e,t){return this._checkBatchId(e),Vi("string"==typeof t,t),Dm(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),(t=Dm(t)?t:[]).length=0;const r=Object.keys(this._properties);return t.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}getProperty(e,t){if(this._checkBatchId(e),Vi("string"==typeof t,t),this._binaryProperties){const r=this._binaryProperties[t];if(Dm(r))return this._getBinaryProperty(r,e)}const r=this._properties[t];if(Dm(r))return Mm(r[e]);if(this._hierarchy){const r=this._getHierarchyProperty(e,t);if(Dm(r))return r}}setProperty(e,t,r){const n=this.featureCount;if(this._checkBatchId(e),Vi("string"==typeof t,t),this._binaryProperties){const n=this._binaryProperties[t];if(n)return void this._setBinaryProperty(n,e,r)}if(this._hierarchy&&this._setHierarchyProperty(this,e,t,r))return;let i=this._properties[t];Dm(i)||(this._properties[t]=new Array(n),i=this._properties[t]),i[e]=Mm(r)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,t){return e.unpack(e.typedArray,t)}_setBinaryProperty(e,t,r){e.pack(r,e.typedArray,t)}_initializeBinaryProperties(){let e=null;for(const t in this._properties){const r=this._properties[t],n=this._initializeBinaryProperty(t,r);n&&(e=e||{},e[t]=n)}return e}_initializeBinaryProperty(e,t){if("byteOffset"in t){const r=t;Vi(this.binary,`Property ${e} requires a batch table binary.`),Vi(r.type,`Property ${e} requires a type.`);const n=function(e,t,r,n){const{componentType:i}=e;Vi(e.componentType);const a="string"==typeof i?Em.fromName(i):i,o=jm[e.type],s=Tm[e.type],u=Cm[e.type];return r+=e.byteOffset,{values:Em.createTypedArray(a,t,r,o*n),type:a,size:o,unpacker:s,packer:u}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(e,t){if(!this._hierarchy)return!1;const r=Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return Dm(e.classes[n].instances[t])});return Dm(r)}_getPropertyNamesInHierarchy(e,t){Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n].instances;for(const e in i)i.hasOwnProperty(e)&&-1===t.indexOf(e)&&t.push(e)})}_getHierarchyProperty(e,t){return Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n],a=e.classIndexes[r],o=i.instances[t];return Dm(o)?Dm(o.typedArray)?this._getBinaryProperty(o,a):Mm(o[a]):null})}_setHierarchyProperty(e,t,r,n){const i=Om(this._hierarchy,t,(e,i)=>{const a=e.classIds[i],o=e.classes[a],s=e.classIndexes[i],u=o.instances[r];return!!Dm(u)&&(Vi(i===t,`Inherited property "${r}" is read-only.`),Dm(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=Mm(n),!0)});return Dm(i)}}function Nm(e,t,r=0){const n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=4,e.version=n.getUint32(r,!0),r+=4,e.byteLength=n.getUint32(r,!0),r+=4,1!==e.version)throw new Error(`3D Tile Version ${e.version} not supported`);return r}function zm(e,t,r){const n=new DataView(t);let i;e.header=e.header||{};let a=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let s=n.getUint32(r,!0);r+=4;let u=n.getUint32(r,!0);return r+=4,s>=570425344?(r-=8,i=a,s=o,u=0,a=0,o=0,console.warn("b3dm tile in legacy format.")):u>=570425344&&(r-=4,i=s,s=a,u=o,a=0,o=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=i,r}function Um(e,t,r,n){return r=function(e,t,r,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:a,batchLength:o}=e.header;if(e.featureTableJson={BATCH_LENGTH:o||0},i>0){const n=vm(t,r,i);e.featureTableJson=JSON.parse(n)}return r+=i,e.featureTableBinary=new Uint8Array(t,r,a),r+=a}(e,t,r),r=function(e,t,r,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:a}=e.header;if(i>0){const n=vm(t,r,i);e.batchTableJson=JSON.parse(n),r+=i,a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}(e,t,r)}function qm(e,t=[0,0,0]){const r=e>>11&31,n=e>>5&63,i=31&e;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}function Hm(e,t,r){if(!(t||e&&e.batchIds&&r))return null;const{batchIds:n,isRGB565:i,pointCount:a}=e;if(n&&r){const e=new Uint8ClampedArray(3*a);for(let t=0;t<a;t++){const i=n[t],a=r.getProperty(i,"dimensions").map(e=>255*e);e[3*t]=a[0],e[3*t+1]=a[1],e[3*t+2]=a[2]}return{type:_m.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}if(i){const e=new Uint8ClampedArray(3*a);for(let r=0;r<a;r++){const n=qm(t[r]);e[3*r]=n[0],e[3*r+1]=n[1],e[3*r+2]=n[2]}return{type:_m.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}return t&&t.length===3*a?{type:_m.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:_m.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}class Gm extends ys{constructor(e=0,t=0){super(2),as(e)&&1===arguments.length?this.copy(e):(ns.debug&&(fs(e),fs(t)),this[0]=e,this[1]=t)}set(e,t){return this[0]=e,this[1]=t,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Us(this,this,e),this.check()}transformAsVector(e){return Bs(this,this,e),this.check()}transformByMatrix3(e){return zs(this,this,e),this.check()}transformByMatrix2x3(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5]}(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i}(this,this,e),this.check()}}function Vm(e,t){if(!e)throw new Error("math.gl assertion failed. "+t)}new Gm,new Ds,new Gm,new Gm,new Uint8Array(1);function Wm(e,t=255){return ls(e,0,t)/t*2-1}function Km(e){return e<0?-1:1}function Jm(e,t,r,n){if(Vm(n),e<0||e>r||t<0||t>r)throw new Error("x and y must be unsigned normalized integers between 0 and "+r);if(n.x=Wm(e,r),n.y=Wm(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const e=n.x;n.x=(1-Math.abs(n.y))*Km(e),n.y=(1-Math.abs(e))*Km(n.y)}return n.normalize()}function Qm(e,t,r){return Jm(e,t,255,r)}const Ym=new Ds;function $m(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){const r=new Ds,n=new Float32Array(3*e.pointCount);for(let i=0;i<e.pointCount;i++)r.set(t[3*i],t[3*i+1],t[3*i+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,3*i);return n}(e,t)):{type:_m.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}async function Xm(e,t,r,n,i){r=Um(e,t,r=zm(e,t,r=Nm(e,t,r))),function(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}(e);const{featureTable:a,batchTable:o}=function(e){const t=new Sm(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",_m.FLOAT,3);const n=function(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",_m.UNSIGNED_SHORT,1),e.batchIds)){const n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:i,batchTableBinary:a}=e;r=new Lm(i,a,n)}return r}(e,t);return{featureTable:t,batchTable:n}}(e);return await async function(e,t,r,n,i){let a,o,s;const u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);const c=t.getExtension("3DTILES_draco_point_compression");if(c){o=c.properties;const t=c.byteOffset,r=c.byteLength;if(!o||!Number.isFinite(t)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");a=e.featureTableBinary.slice(t,t+r),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!a)return!0;const l={buffer:a,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await async function(e,t,r,n){const{parse:i}=n,a={...r,draco:{...r.draco,extraAttributes:t.batchTableProperties||{}}};delete a["3d-tiles"];const o=await i(t.buffer,Rc,a),s=o.attributes.POSITION&&o.attributes.POSITION.value,u=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,c=o.attributes.NORMAL&&o.attributes.NORMAL.value,l=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,h=s&&o.attributes.POSITION.value.quantization,p=c&&o.attributes.NORMAL.value.quantization;if(h){const t=o.POSITION.data.quantization,r=t.range;e.quantizedVolumeScale=new Ds(r,r,r),e.quantizedVolumeOffset=new Ds(t.minValues),e.quantizedRange=(1<<t.quantizationBits)-1,e.isQuantizedDraco=!0}p&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);const f={};if(t.batchTableProperties)for(const e of Object.keys(t.batchTableProperties))o.attributes[e]&&o.attributes[e].value&&(f[e.toLowerCase()]=o.attributes[e].value);e.attributes={positions:s,colors:Hm(e,u,void 0),normals:c,batchIds:l,...f}}(e,l,n,i)}(e,a,0,n,i),function(e,t,r){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",_m.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){const n=t.getPropertyArray("POSITION_QUANTIZED",_m.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",_m.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",_m.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=$m(e,n,r)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(e,a,n),function(e,t,r){if(!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",_m.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",_m.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",_m.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Hm(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",_m.UNSIGNED_BYTE,4))}(e,a,o),function(e,t){if(!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",_m.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",_m.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=function(e,t){if(!t)return null;if(e.isOctEncoded16P){const r=new Float32Array(3*e.pointsLength);for(let n=0;n<e.pointsLength;n++)Qm(t[2*n],t[2*n+1],Ym),Ym.toArray(r,3*n);return{type:_m.FLOAT,size:2,value:r}}return{type:_m.FLOAT,size:2,value:t}}(e,r)}}(e,a),r}function Zm(e,t,r){if(e.byteLength<=t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}function eg(e){try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse JSON from data starting with "${function(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Zm(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Zm(e,0,t)}return""}(e)}"`)}}function tg(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function rg(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const r=t.baseUri||t.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url "+e);return r.substr(0,r.lastIndexOf("/")+1)+e}function ng(e,t,r){const n=e.bufferViews[r];tg(n);const i=t[n.buffer];tg(i);const a=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,a,n.byteLength)}function ig(e,t){return Vi(e>=0),Vi(t>0),e+(t-1)&~(t-1)}function ag(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{const t=e.byteOffset,r=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,t,r)}return t.set(n,r),r+ig(n.byteLength,4)}const og=["SCALAR","VEC2","VEC3","VEC4"],sg=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ug=new Map(sg),cg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},lg={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},hg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function pg(e){return og[e-1]||og[0]}function fg(e){const t=ug.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function dg(e,t){const r=hg[e.componentType],n=cg[e.type],i=lg[e.componentType],a=e.count*n,o=e.count*n*i;return tg(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function mg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gg={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class yg{constructor(e){mg(this,"gltf",void 0),mg(this,"sourceBuffers",void 0),mg(this,"byteLength",void 0),this.gltf=e||{json:{...gg},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];if(!r)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return r}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,r=this.gltf.buffers[t];tg(r);const n=(e.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,{ArrayType:n,length:i}=dg(e,t);return new n(r,t.byteOffset+e.byteOffset,i)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,n=t.byteOffset||0;return new Uint8Array(r,n,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,r){return e.extensions=e.extensions||{},e.extensions[t]=r,this.registerUsedExtension(t),this}setObjectExtension(e,t,r){(e.extensions||{})[t]=r}removeObjectExtension(e,t){const r=e.extensions||{},n=r[t];return delete r[t],n}addExtension(e,t={}){return tg(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return tg(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:r}=e;this.json.nodes=this.json.nodes||[];const n={mesh:t};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:r,material:n,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(r){const e=this._addIndices(r);a.primitives[0].indices=e}return Number.isFinite(n)&&(a.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const r=Lu(e),n=t||(null==r?void 0:r.mimeType),i={bufferView:this.addBufferView(e),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(e){const t=e.byteLength;tg(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=ig(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(e,t){const r={bufferView:e,type:pg(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const r=this.addBufferView(e);let n={min:t.min,max:t.max};n.min&&n.max||(n=this._getAccessorMinMax(e,t.size));const i={size:t.size,componentType:fg(e),count:Math.round(e.length/t.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(i,t))}addTexture(e){const{imageIndex:t}=e,r={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),i=new Uint8Array(n);let a=0;for(const e of this.sourceBuffers||[])a=ag(e,i,a);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(e,t){let r=!0;for(;r;){const n=e.indexOf(t);n>-1?e.splice(n,1):r=!1}}_addAttributes(e={}){const t={};for(const r in e){const n=e[r],i=this._getGltfAttributeName(r),a=this.addBinaryBuffer(n.value,n);t[i]=a}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){const r={min:null,max:null};if(e.length<t)return r;r.min=[],r.max=[];const n=e.subarray(0,t);for(const e of n)r.min.push(e),r.max.push(e);for(let n=t;n<e.length;n+=t)for(let i=0;i<t;i++)r.min[0+i]=Math.min(r.min[0+i],e[n+i]),r.max[0+i]=Math.max(r.max[0+i],e[n+i]);return r}}const bg=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),vg=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),wg={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},_g={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let kg;async function xg(){return kg||(kg=async function(){let e="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";WebAssembly.validate(bg)&&(e="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",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const t=await WebAssembly.instantiate(function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?vg[t[n]]:64*(t[n]-60)+t[++n];return t.buffer.slice(0,r)}(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}()),kg}function Eg(e,t,r,n,i,a,o){const s=e.exports.sbrk,u=n+3&-4,c=s(u*i),l=s(a.length),h=new Uint8Array(e.exports.memory.buffer);h.set(a,l);const p=t(c,n,i,l,a.length);if(0===p&&o&&o(c,u,i),r.set(h.subarray(c,c+n*i)),s(c-s(0)),0!==p)throw new Error("Malformed buffer data: "+p)}const Ag="EXT_meshopt_compression";async function Sg(e,t){var r;const n=new yg(e);if(null==t||null===(r=t.gltf)||void 0===r||!r.decompressMeshes)return;const i=[];for(const t of e.json.bufferViews||[])i.push(jg(n,t));await Promise.all(i),n.removeExtension("EXT_meshopt_compression")}async function jg(e,t){const r=e.getObjectExtension(t,"EXT_meshopt_compression");if(r){const{byteOffset:n=0,byteLength:i=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],h=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);return await async function(e,t,r,n,i,a="NONE"){const o=await xg();Eg(o,o.exports[_g[i]],e,t,r,n,o.exports[wg[a||"NONE"]])}(p,o,a,h,s,u),p}return null}const Tg=["image/png","image/jpeg","image/gif"],Cg={};function Bg(e){return void 0===Cg[e]&&(Cg[e]=function(e){switch(e){case"image/webp":return function(){if(!Pi)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return Pi;default:if(!Pi){const{_parseImageNode:t}=globalThis;return Boolean(t)&&Tg.includes(e)}return!0}}(e)),Cg[e]}const Rg="EXT_texture_webp";function Og(e,t){const r=new yg(e);if(!Bg("image/webp")){if(r.getRequiredExtensions().includes("EXT_texture_webp"))throw new Error("gltf: Required extension EXT_texture_webp not supported by browser");return}const{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"EXT_texture_webp");t&&(e.source=t.source),r.removeObjectExtension(e,"EXT_texture_webp")}r.removeExtension("EXT_texture_webp")}const Ig="KHR_texture_basisu";function Pg(e,t){const r=new yg(e),{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"KHR_texture_basisu");t&&(e.source=t.source),r.removeObjectExtension(e,"KHR_texture_basisu")}r.removeExtension("KHR_texture_basisu")}function Dg(e){const{buffer:t,size:r,count:n}=function(e){let t=e,r=1,n=0;e&&e.value&&(t=e.value,r=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,r=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(r&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),n=t.length/r);return{buffer:t,size:r,count:n}}(e);return{value:t,size:r,byteOffset:0,count:n,type:pg(r),componentType:fg(t)}}const Mg="KHR_draco_mesh_compression";function Fg(e,t,r){const n=new yg(e);for(const e of qg(n))n.getObjectExtension(e,"KHR_draco_mesh_compression")}async function Lg(e,t,r){var n;if(null==t||null===(n=t.gltf)||void 0===n||!n.decompressMeshes)return;const i=new yg(e),a=[];for(const e of qg(i))i.getObjectExtension(e,"KHR_draco_mesh_compression")&&a.push(zg(i,e,t,r));await Promise.all(a),i.removeExtension("KHR_draco_mesh_compression")}function Ng(e,t={}){const r=new yg(e);for(const e of r.json.meshes||[])Ug(e,t),r.addRequiredExtension("KHR_draco_mesh_compression")}async function zg(e,t,r,n){const i=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!i)return;const a=e.getTypedArrayForBufferView(i.bufferView),o=Ya(a.buffer,a.byteOffset),{parse:s}=n,u={...r};delete u["3d-tiles"];const c=await s(o,Rc,u,n),l=function(e){const t={};for(const r in e){const n=e[r];if("indices"!==r){const e=Dg(n);t[r]=e}}return t}(c.attributes);for(const[r,n]of Object.entries(l))if(r in t.attributes){const i=t.attributes[r],a=e.getAccessor(i);null!=a&&a.min&&null!=a&&a.max&&(n.min=a.min,n.max=a.max)}t.attributes=l,c.indices&&(t.indices=Dg(c.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function Ug(e,t,r=4,n,i){var a;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:e}),s=null==i||null===(a=i.parseSync)||void 0===a?void 0:a.call(i,{attributes:e}),u=n._addFauxAttributes(s.attributes);return{primitives:[{attributes:u,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(o),attributes:u}}}]}}function*qg(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}const Hg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Gg={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};const Vg="KHR_texture_transform",Wg=new Ds,Kg=new Dh,Jg=new Dh;async function Qg(e,t){if(!new yg(e).getExtension("KHR_texture_transform"))return;const r=e.json.materials||[];for(let t=0;t<r.length;t++)Yg(t,e)}function Yg(e,t){var r,n,i;const a=[],o=null===(r=t.json.materials)||void 0===r?void 0:r[e],s=null==o||null===(n=o.pbrMetallicRoughness)||void 0===n?void 0:n.baseColorTexture;s&&$g(t,e,s,a);const u=null==o?void 0:o.emissiveTexture;u&&$g(t,e,u,a);const c=null==o?void 0:o.normalTexture;c&&$g(t,e,c,a);const l=null==o?void 0:o.occlusionTexture;l&&$g(t,e,l,a);const h=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;h&&$g(t,e,h,a)}function $g(e,t,r,n){const i=function(e,t){var r;const n=null===(r=e.extensions)||void 0===r?void 0:r.KHR_texture_transform,{texCoord:i=0}=e,{texCoord:a=i}=n;if(-1===t.findIndex(([e,t])=>e===i&&t===a)){const r=function(e){const{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,i=(new Dh).set(1,0,0,0,1,0,t[0],t[1],1),a=Kg.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=Jg.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(a).multiplyRight(o)}(n);return i!==a&&(e.texCoord=a),t.push([i,a]),{originalTexCoord:i,texCoord:a,matrix:r}}return null}(r,n);if(!i)return;const a=e.json.meshes||[];for(const r of a)for(const n of r.primitives){const r=n.material;Number.isFinite(r)&&t===r&&Xg(e,n,i)}}function Xg(e,t,r){const{originalTexCoord:n,texCoord:i,matrix:a}=r,o=t.attributes["TEXCOORD_"+n];if(Number.isFinite(o)){var s;const r=null===(s=e.json.accessors)||void 0===s?void 0:s[o];if(r&&r.bufferView){var u;const o=null===(u=e.json.bufferViews)||void 0===u?void 0:u[r.bufferView];if(o){const{arrayBuffer:s,byteOffset:u}=e.buffers[o.buffer],c=(u||0)+(r.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:h}=dg(r,o),p=Gg[r.componentType],f=Hg[r.type],d=o.byteStride||p*f,m=new Float32Array(h);for(let e=0;e<r.count;e++){const t=new l(s,c+e*d,2);Wg.set(t[0],t[1],1),Wg.transformByMatrix3(a),m.set([Wg[0],Wg[1]],e*f)}n===i?function(e,t,r,n){e.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=n.buffer.byteLength,t.byteOffset=0,delete t.byteStride}(r,o,e.buffers,m):function(e,t,r,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});const a=n.json.bufferViews;if(!a)return;a.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});const o=n.json.accessors;if(!o)return;o.push({bufferView:(null==a?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes["TEXCOORD_"+e]=o.length-1}(i,r,t,e,m)}}}}const Zg="KHR_lights_punctual";async function ey(e){const t=new yg(e),{json:r}=t,n=t.getExtension("KHR_lights_punctual");n&&(t.json.lights=n.lights,t.removeExtension("KHR_lights_punctual"));for(const e of r.nodes||[]){const r=t.getObjectExtension(e,"KHR_lights_punctual");r&&(e.light=r.light),t.removeObjectExtension(e,"KHR_lights_punctual")}}async function ty(e){const t=new yg(e),{json:r}=t;if(r.lights){const e=t.addExtension("KHR_lights_punctual");tg(!e.lights),e.lights=r.lights,delete r.lights}if(t.json.lights){for(const e of t.json.lights){const r=e.node;t.addObjectExtension(r,"KHR_lights_punctual",e)}delete t.json.lights}}const ry="KHR_materials_unlit";async function ny(e){const t=new yg(e),{json:r}=t;t.removeExtension("KHR_materials_unlit");for(const e of r.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}}function iy(e){const t=new yg(e),{json:r}=t;if(t.materials)for(const e of r.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}const ay="KHR_techniques_webgl";async function oy(e){const t=new yg(e),{json:r}=t,n=t.getExtension("KHR_techniques_webgl");if(n){const e=function(e,t){const{programs:r=[],shaders:n=[],techniques:i=[]}=e,a=new TextDecoder;return n.forEach(e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=a.decode(t.getTypedArrayForBufferView(e.bufferView))}),r.forEach(e=>{e.fragmentShader=n[e.fragmentShader],e.vertexShader=n[e.vertexShader]}),i.forEach(e=>{e.program=r[e.program]}),i}(n,t);for(const n of r.materials||[]){const r=t.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,e[r.technique]),n.technique.values=uy(n.technique,t)),t.removeObjectExtension(n,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function sy(e,t){}function uy(e,t){const r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(t=>{e.uniforms[t].value&&!(t in r)&&(r[t]=e.uniforms[t].value)}),Object.keys(r).forEach(e=>{"object"==typeof r[e]&&void 0!==r[e].index&&(r[e].texture=t.getTexture(r[e].index))}),r}const cy="EXT_feature_metadata";async function ly(e){!function(e){var t;const r=e.getExtension("EXT_feature_metadata"),n=null==r||null===(t=r.schema)||void 0===t?void 0:t.classes,i=null==r?void 0:r.featureTables;(null==r?void 0:r.featureTextures)&&console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');if(n&&i)for(const t in n){const r=n[t],a=fy(i,t);a&&hy(e,a,r)}}(new yg(e))}function hy(e,t,r){for(const i in r.properties){var n;const a=r.properties[i],o=null==t||null===(n=t.properties)||void 0===n?void 0:n[i],s=t.count;if(o){const t=py(e,a,s,o);o.data=t}}}function py(e,t,r,n){const i=n.bufferView;let a=e.getTypedArrayForBufferView(i);switch(t.type){case"STRING":{const t=n.stringOffsetBufferView;a=function(e,t,r){const n=[],i=new TextDecoder("utf8");let a=0;for(let o=0;o<r;o++){const r=t[4*(o+1)]-t[4*o],s=e.subarray(a,r+a),u=i.decode(s);n.push(u),a+=r}return n}(a,e.getTypedArrayForBufferView(t),r);break}}return a}function fy(e,t){for(const r in e){const n=e[r];if(n.class===t)return n}return null}const dy=[a,o,s,u,l,h,p,c,f];function my(e,t){var r;const n=(null==t||null===(r=t.gltf)||void 0===r?void 0:r.excludeExtensions)||{};return!(e in n&&!n[e])}function gy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yy={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},by={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class vy{constructor(){gy(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),gy(this,"json",void 0)}normalize(e,t){this.json=e.json;const r=e.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+r.asset.version)}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),function(e){const t=new yg(e),{json:r}=t;for(const e of r.images||[]){const r=t.getObjectExtension(e,"KHR_binary_glTF");r&&Object.assign(e,r),t.removeObjectExtension(e,"KHR_binary_glTF")}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in yy)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const r=e[t];if(r&&!Array.isArray(r)){e[t]=[];for(const n in r){const i=r[n];i.id=i.id||n;const a=e[t].length;e[t].push(i),this.idToIndexMap[t][n]=a}}}_convertObjectIdsToArrayIndices(e){for(const t in yy)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:r,material:n}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");r&&(t.indices=this._convertIdToIndex(r,"accessor")),n&&(t.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(e=>this._convertIdToIndex(e,"node"))),e.meshes&&(e.meshes=e.meshes.map(e=>this._convertIdToIndex(e,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(e=>this._convertIdToIndex(e,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute "+t),e[t]=[]);for(const r of e[t])for(const e in r){const t=r[e],n=this._convertIdToIndex(t,e);r[e]=n}}_convertIdToIndex(e,t){const r=by[t];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][e];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return n}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const i of e.materials){var t,r,n;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const a=(null===(t=i.values)||void 0===t?void 0:t.tex)||(null===(r=i.values)||void 0===r?void 0:r.texture2d_0)||(null===(n=i.values)||void 0===n?void 0:n.diffuseTex),o=e.textures.findIndex(e=>e.id===a);-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})}}}function wy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ky={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},xy=10240,Ey=10241,Ay=10242,Sy=10243,jy=10497,Ty={magFilter:xy,minFilter:Ey,wrapS:Ay,wrapT:Sy},Cy={[xy]:9729,[Ey]:9986,[Ay]:jy,[Sy]:jy};class By{constructor(){wy(this,"baseUri",""),wy(this,"json",{}),wy(this,"buffers",[]),wy(this,"images",[])}postProcess(e,t={}){const{json:r,buffers:n=[],images:i=[],baseUri:a=""}=e;return tg(r),this.baseUri=a,this.json=r,this.buffers=n,this.images=i,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,t)=>this._resolveImage(e,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){return e.id=e.id||"scene-"+t,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||"node-"+t,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const r=this.getMesh(t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-"+t,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-"+t,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const r in t)e.attributes[r]=this.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||"material-"+t,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var r,n;if(e.id=e.id||"accessor-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(r=e.componentType,ky[r]),e.components=(n=e.type,_y[n]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:r,byteLength:n}=dg(e,e.bufferView),i=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let a=t.arrayBuffer.slice(i,i+n);e.bufferView.byteStride&&(a=this._getValueFromInterleavedBuffer(t,i,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new r(a)}return e}_getValueFromInterleavedBuffer(e,t,r,n,i){const a=new Uint8Array(i*n);for(let o=0;o<i;o++){const i=t+o*r;a.set(new Uint8Array(e.arrayBuffer.slice(i,i+n)),o*n)}return a.buffer}_resolveTexture(e,t){return e.id=e.id||"texture-"+t,e.sampler="sampler"in e?this.getSampler(e.sampler):Cy,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||"sampler-"+t,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}return e}_enumSamplerParameter(e){return Ty[e]}_resolveImage(e,t){e.id=e.id||"image-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const r=this.images[t];return r&&(e.image=r),e}_resolveBufferView(e,t){const r=e.buffer,n={id:"bufferView-"+t,...e,buffer:this.buffers[r]},i=this.buffers[r].arrayBuffer;let a=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(a+=e.byteOffset),n.data=new Uint8Array(i,a,e.byteLength),n}_resolveCamera(e,t){return e.id=e.id||"camera-"+t,e.perspective,e.orthographic,e}}const Ry=1735152710;function Oy(e,t=0,r={}){const n=new DataView(e),{magic:i=Ry}=r,a=n.getUint32(t,!1);return a===i||a===Ry}function Iy(e,t,r=0,n={}){const i=new DataView(t),a=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(i,r+0),o=i.getUint32(r+4,!0),s=i.getUint32(r+8,!0);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=12,e.version){case 1:return function(e,t,r){Vi(e.header.byteLength>20);const n=t.getUint32(r+0,!0),i=t.getUint32(r+4,!0);return r+=8,Vi(0===i),Py(e,t,r,n),r+=n,r+=Dy(e,t,r,e.header.byteLength)}(e,i,r);case 2:return function(e,t,r,n){return Vi(e.header.byteLength>20),function(e,t,r,n){for(;r+8<=e.header.byteLength;){const i=t.getUint32(r+0,!0),a=t.getUint32(r+4,!0);switch(r+=8,a){case 1313821514:Py(e,t,r,i);break;case 5130562:Dy(e,t,r,i);break;case 0:n.strict||Py(e,t,r,i);break;case 1:n.strict||Dy(e,t,r,i)}r+=ig(i,4)}}(e,t,r,n),r+e.header.byteLength}(e,i,r,{});default:throw new Error(`Invalid GLB version ${e.version}. Only supports v1 and v2.`)}}function Py(e,t,r,n){const i=new Uint8Array(t.buffer,r,n),a=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(a),ig(n,4)}function Dy(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),ig(n,4)}async function My(e,t,r=0,n,i){var a,o,s,u;!function(e,t,r,n){n.uri&&(e.baseUri=n.uri);if(t instanceof ArrayBuffer&&!Oy(t,r,n)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=eg(t);else if(t instanceof ArrayBuffer){const i={};r=Iy(i,t,r,n.glb),tg("glTF"===i.type,"Invalid GLB magic string "+i.type),e._glb=i,e.json=i.json}else tg(!1,"GLTF: must be ArrayBuffer or string");const i=e.json.buffers||[];if(e.buffers=new Array(i.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const a=e.json.images||[];e.images=new Array(a.length).fill({})}(e,t,r,n),function(e,t={}){(new vy).normalize(e,t)}(e,{normalize:null==n||null===(a=n.gltf)||void 0===a?void 0:a.normalize}),function(e,t={},r){const n=dy.filter(e=>my(e.name,t));for(const a of n){var i;null===(i=a.preprocess)||void 0===i||i.call(a,e,t,r)}}(e,n,i);const c=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&e.json.buffers&&await async function(e,t,r){const n=e.json.buffers||[];for(let o=0;o<n.length;++o){const s=n[o];if(s.uri){var i,a;const{fetch:n}=r;tg(n);const u=rg(s.uri,t),c=await(null==r||null===(i=r.fetch)||void 0===i?void 0:i.call(r,u)),l=await(null==c||null===(a=c.arrayBuffer)||void 0===a?void 0:a.call(c));e.buffers[o]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete s.uri}else null===e.buffers[o]&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}(e,n,i),null!=n&&null!==(s=n.gltf)&&void 0!==s&&s.loadImages){const t=async function(e,t,r){const n=function(e){const t=new Set,r=e.json.textures||[];for(const e of r)void 0!==e.source&&t.add(e.source);return Array.from(t).sort()}(e),i=e.json.images||[],a=[];for(const o of n)a.push(Fy(e,i[o],o,t,r));return await Promise.all(a)}(e,n,i);c.push(t)}const l=async function(e,t={},r){const n=dy.filter(e=>my(e.name,t));for(const a of n){var i;await(null===(i=a.decode)||void 0===i?void 0:i.call(a,e,t,r))}}(e,n,i);return c.push(l),await Promise.all(c),null!=n&&null!==(u=n.gltf)&&void 0!==u&&u.postProcess?function(e,t){return(new By).postProcess(e,t)}(e,n):e}async function Fy(e,t,r,n,i){const{fetch:a,parse:o}=i;let s;if(t.uri&&!t.hasOwnProperty("bufferView")){const e=rg(t.uri,n),r=await a(e);s=await r.arrayBuffer(),t.bufferView={data:s}}if(Number.isFinite(t.bufferView)){const r=ng(e.json,e.buffers,t.bufferView);s=Ya(r.buffer,r.byteOffset,r.byteLength)}tg(s,"glTF image has no data");let u=await o(s,[zu,Zl],{mimeType:t.mimeType,basis:n.basis||{format:Ql()}},i);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}const Ly={name:"glTF",id:"gltf",module:"gltf",version:"3.3.0-alpha.4",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},r){(t={...Ly.options,...t}).gltf={...Ly.options.gltf,...t.gltf};const{byteOffset:n=0}=t;return await My({},e,n,t,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const Ny=0,zy=1;function Uy(e,t,r,n){e.rotateYtoZ=!0;const i=e.byteOffset+e.byteLength-r;if(0===i)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Ya(t,r,i),e.gltfByteOffset=0,e.gltfByteLength=i,r%4==0||console.warn(e.type+": embedded glb is not aligned to a 4-byte boundary."),e.byteOffset+e.byteLength}async function qy(e,t,r,n){const i=r["3d-tiles"]||{};if(function(e,t,r){switch(t){case Ny:const t=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),r=(new TextDecoder).decode(t);e.gltfUrl=r.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case zy:break;default:throw new Error("b3dm: Illegal glTF format field")}}(e,t),i.loadGLTF){const{parse:t,fetch:i}=n;e.gltfUrl&&(e.gltfArrayBuffer=await i(e.gltfUrl,r),e.gltfByteOffset=0),e.gltfArrayBuffer&&(e.gltf=await t(e.gltfArrayBuffer,Ly,r,n),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength)}}async function Hy(e,t,r,n,i){var a;r=function(e,t,r,n,i){r=Nm(e,t,r),r=zm(e,t,r),r=Um(e,t,r),r=Uy(e,t,r,n);const a=new Sm(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",_m.FLOAT,3),r}(e,t,r,n),await qy(e,zy,n,i);const o=null==e||null===(a=e.gltf)||void 0===a?void 0:a.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}async function Gy(e,t,r,n,i){return r=function(e,t,r,n,i){if(r=Nm(e,t,r),1!==e.version)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=zm(e,t,r);const a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r=Um(e,t,r+=4),r=Uy(e,t,r,n),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new Sm(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",_m.FLOAT,3);new Lm(e.batchTableJson,e.batchTableBinary,s);return function(e,t,r,n){const i=[new Array(n),e._batchTable][0],a=new Ds,o=new Ds,s=new Ds,u=new Ds,c=new Dh,l=new np,h=new Ds,p={},f=new Js,d=[],m=[],g=new Ds,y=new Ds;for(let r=0;r<n;r++){let n;if(t.hasProperty("POSITION"))n=t.getProperty("POSITION",_m.FLOAT,3,r,a);else if(t.hasProperty("POSITION_QUANTIZED")){n=t.getProperty("POSITION_QUANTIZED",_m.UNSIGNED_SHORT,3,r,a);const e=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",_m.FLOAT,3,g);if(!e)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",_m.FLOAT,3,y);if(!i)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=65535;for(let t=0;t<3;t++)n[t]=n[t]/o*i[t]+e[t]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(n),p.translation=a,e.normalUp=t.getProperty("NORMAL_UP",_m.FLOAT,3,r,d),e.normalRight=t.getProperty("NORMAL_RIGHT",_m.FLOAT,3,r,m);const b=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",_m.UNSIGNED_SHORT,2,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",_m.UNSIGNED_SHORT,2,m),e.octNormalUp){if(!e.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}e.eastNorthUp?(_u.WGS84.eastNorthUpToFixedFrame(a,f),f.getRotationMatrix3(c)):c.identity()}b&&(u.copy(o).cross(s).normalize(),c.setColumn(0,o),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),p.rotation=l,h.set(1,1,1);const v=t.getProperty("SCALE",_m.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const w=t.getProperty("SCALE_NON_UNIFORM",_m.FLOAT,3,r,d);w&&h.scale(w),p.scale=h;let _=t.getProperty("BATCH_ID",_m.UNSIGNED_SHORT,1,r);void 0===_&&(_=r);const k=(new Js).fromQuaternion(p.rotation);f.identity(),f.translate(p.translation),f.multiplyRight(k),f.scale(p.scale);const x=f.clone();i[r]={modelMatrix:x,batchId:_}}e.instances=i}(e,o,0,s),r}(e,t,r,n),await qy(e,e.gltfFormat,n,i),r}async function Vy(e,t=0,r,n,i={}){switch(i.byteOffset=t,i.type=function(e,t=0){const r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}(e,t),i.type){case bm.COMPOSITE:return await async function(e,t,r,n,i,a){r=Nm(e,t,r);const o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&e.byteLength-r>12;){const o={};e.tiles.push(o),r=await a(t,r,n,i,o)}return r}(i,e,t,r,n,Vy);case bm.BATCHED_3D_MODEL:return await Hy(i,e,t,r,n);case bm.GLTF:return await async function(e,t,r,n){e.rotateYtoZ=!0,e.gltfUpAxis=r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y";const{parse:i}=n;e.gltf=await i(t,Ly,r,n)}(i,e,r,n);case bm.INSTANCED_3D_MODEL:return await Gy(i,e,t,r,n);case bm.POINT_CLOUD:return await Xm(i,e,t,r,n);default:throw new Error("3DTileLoader: unknown type "+i.type)}}async function Wy(e,t,r,n){const i=e[t].bufferView,a=e.bufferViews[i],o=e.buffers[a.buffer];if(null==n||!n.url||!n.fetch)throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){const e=function(e,t){if(t.startsWith("http")){const r=new URL(e,t);return decodeURI(r.toString())}const r=new URL(e,"http://"+t);return`/${r.host}${r.pathname}`}(o.uri,null==n?void 0:n.url),t=await n.fetch(e),r=await t.arrayBuffer();return new Uint8Array(r,a.byteOffset,a.byteLength)}return new Uint8Array(r,a.byteOffset,a.byteLength)}function Ky(e){const t=new DataView(e);return t.getUint32(0,!0)+2**32*t.getUint32(4,!0)}const Jy={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.3.0-alpha.4",extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(e,t,r){if(1952609651!==new Uint32Array(e.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(e.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const n=Ky(e.slice(8,16)),i=new Uint8Array(e,24,n),a=new TextDecoder("utf8").decode(i),o=JSON.parse(a),s=Ky(e.slice(16,24));let u=new ArrayBuffer(0);return s&&(u=e.slice(24+n)),"bufferView"in o.tileAvailability&&(o.tileAvailability.explicitBitstream=await Wy(o,"tileAvailability",u,r)),"bufferView"in o.contentAvailability&&(o.contentAvailability.explicitBitstream=await Wy(o,"contentAvailability",u,r)),"bufferView"in o.childSubtreeAvailability&&(o.childSubtreeAvailability.explicitBitstream=await Wy(o,"childSubtreeAvailability",u,r)),o},options:{}},Qy={QUADTREE:4,OCTREE:8};function Yy(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&function(e,t){const r=Math.floor(e/8),n=e%8;return 1==(t[r]>>n&1)}(t,e.explicitBitstream)}function $y(e,t,r,n){const{basePath:i,refine:a,getRefine:o,lodMetricType:s,getTileType:u,rootLodMetricValue:c,rootBoundingVolume:l}=n,h=e.contentUrl&&e.contentUrl.replace(i+"/",""),p=c/2**t,f=function(e,t,r){if(t.region){const{childTileX:n,childTileY:i,childTileZ:a}=r,[o,s,u,c,l,h]=t.region,p=2**e,f=(u-o)/p,d=(c-s)/p,m=(h-l)/p,[g,y]=[o+f*n,o+f*(n+1)],[b,v]=[s+d*i,s+d*(i+1)],[w,_]=[l+m*a,l+m*(a+1)];return{region:[g,b,y,v,w,_]}}return console.warn("Unsupported bounding volume type: ",t),null}(t,l,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:o(a),type:u(e),lodMetricType:s,lodMetricValue:p,geometricError:p,transform:e.transform,boundingVolume:f}}function Xy(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function Zy(e,t,r,n,i){const a=function(e){const t={};for(const r in e)t[`{${r}}`]=e[r];return t}({level:t,x:r,y:n,z:i});return e.replace(/{level}|{x}|{y}|{z}/gi,e=>a[e])}function eb(e){if(!e.contentUrl)return hf;const t=e.contentUrl.split(".").pop();switch(t){case"pnts":return ff;case"i3dm":case"b3dm":case"glb":case"gltf":return pf;default:return t}}function tb(e){switch(e){case"REPLACE":case"replace":return lf;case"ADD":case"add":return cf;default:return e}}function rb(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){const r=new URL(e,t+"/");return decodeURI(r.toString())}return e.startsWith("/")?e:`${t}/${e}`}function nb(e,t){if(!e)return null;if(e.content){const r=e.content.uri||e.content.url;e.contentUrl=rb(r,t.basePath)}return e.id=e.contentUrl,e.lodMetricType=yf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=eb(e),e.refine=tb(e.refine),e}async function ib(e,t,r,n){var i;const a=t.basePath,{subdivisionScheme:o,maximumLevel:s,subtreeLevels:u,subtrees:{uri:c}}=r,l=rb(Zy(c,0,0,0,0),a),h=await Zo(l,Jy,n),p=rb(e.content.uri,a),f=null==t||null===(i=t.root)||void 0===i?void 0:i.refine,d=e.geometricError,m=e.boundingVolume,g={contentUrlTemplate:p,subtreesUriTemplate:c,subdivisionScheme:o,subtreeLevels:u,maximumLevel:s,refine:f,basePath:a,lodMetricType:yf,rootLodMetricValue:d,rootBoundingVolume:m,getTileType:eb,getRefine:tb};return await async function(e,t,r){if(!e)return null;e.lodMetricType=yf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform;const{children:n,contentUrl:i}=await async function e(t){const{options:r,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;let{subtree:o,level:s=0}=t;const{subdivisionScheme:u,subtreeLevels:c,maximumLevel:l,contentUrlTemplate:h,subtreesUriTemplate:p,basePath:f}=r,d={children:[],lodMetricValue:0,contentUrl:""},m=Qy[u],g=1&i,y=i>>1&1,b=i>>2&1,v=(m**s-1)/(m-1);let w=Xy(n.mortonIndex,i),_=v+w,k=Xy(n.x,g),x=Xy(n.y,y),E=Xy(n.z,b),A=!1;s+1>c&&(A=Yy(o.childSubtreeAvailability,w));const S=Xy(a.x,k),j=Xy(a.y,x),T=Xy(a.z,E),C=s+a.level;if(A){const e=Zy(`${f}/${p}`,C,S,j,T);o=await Zo(e,Jy),a.mortonIndex=w,a.x=k,a.y=x,a.z=E,a.level=s,w=0,_=0,k=0,x=0,E=0,s=0}if(!Yy(o.tileAvailability,_)||s>l)return d;Yy(o.contentAvailability,_)&&(d.contentUrl=Zy(h,C,S,j,T));const B=s+1,R={mortonIndex:w,x:k,y:x,z:E};for(let t=0;t<m;t++){const n=await e({subtree:o,options:r,parentData:R,childIndex:t,level:B,globalData:a});if(n.contentUrl||n.children.length){const e=$y(n,C+1,{childTileX:k,childTileY:x,childTileZ:E},r);d.children.push(e)}}return d}({subtree:t,options:r});i&&(e.contentUrl=i,e.content={uri:i.replace(r.basePath+"/","")});return e.refine=tb(e.refine),e.type=eb(e),e.children=n,e.id=e.contentUrl,e}(e,h,g)}function ab(e){var t;return(null==e||null===(t=e.extensions)||void 0===t?void 0:t["3DTILES_implicit_tiling"])||(null==e?void 0:e.implicitTiling)}const ob={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.3.0-alpha.4",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(e,t,r){const i=t["3d-tiles"]||{};let a;a="auto"===i.isTileset?r.url&&-1!==r.url.indexOf(".json"):i.isTileset;e=a?await async function(e,t,r){var i;const a=JSON.parse((new TextDecoder).decode(e));return a.loader=t.loader||ob,a.url=r.url,a.basePath=function(e){return n.dirname(e.url)}(a),a.root=await async function(e,t){const r=e.basePath;let n;const i=ab(null==e?void 0:e.root);n=i&&e.root?await ib(e.root,e,i,t):nb(e.root,e);const a=[];for(a.push(n);a.length>0;){const n=(a.pop()||{}).children||[];for(let i of n){const n=ab(i);n?i=await ib(i,e,n,t):nb(i,{basePath:r}),a.push(i)}}return n}(a,t),a.type=gf,a.lodMetricType=yf,a.lodMetricValue=(null===(i=a.root)||void 0===i?void 0:i.lodMetricValue)||0,a}(e,t,r):await async function(e,t,r){const n={content:{featureIds:null}};return await Vy(e,0,t,r,n.content),n.content}(e,t,r);return e},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function sb(e,t){if(!t){const r=await async function(e){Vi(e);const t={Authorization:"Bearer "+e},r=await oa("https://api.cesium.com/v1/assets",{fetch:{headers:t}});if(!r.ok)throw new Error(r.statusText);return await r.json()}(e);for(const e of r.items)"3DTILES"===e.type&&(t=e.id)}const r=await async function(e,t){Vi(e,t);const r={Authorization:"Bearer "+e},n="https://api.cesium.com/v1/assets/"+t;let i=await oa(""+n,{fetch:{headers:r}});if(!i.ok)throw new Error(i.statusText);let a=await i.json();if(i=await oa(n+"/endpoint",{fetch:{headers:r}}),!i.ok)throw new Error(i.statusText);const o=await i.json();return a={...a,...o},a}(e,t),{type:n,url:i}=r;return Vi("3DTILES"===n&&i),r.headers={Authorization:"Bearer "+r.accessToken},r}const ub={...ob,id:"cesium-ion",name:"Cesium Ion",preload:async function(e,t={}){t=t["cesium-ion"]||{};const{accessToken:r}=t;let n=t.assetId;if(!Number.isFinite(n)){const t=e.match(/\/([0-9]+)\/tileset.json/);n=t&&t[1]}return sb(r,n)},parse:async(e,t,r)=>((t={...t})["3d-tiles"]=t["cesium-ion"],t.loader=ub,ob.parse(e,t,r)),options:{"cesium-ion":{...ob.options["3d-tiles"],accessToken:null}}};var cb=r(10),lb=r.n(cb);const hb=new Uint8Array(256);let pb=hb.length;function fb(){return pb>hb.length-16&&(lb.a.randomFillSync(hb),pb=0),hb.slice(pb,pb+=16)}var db=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var mb=function(e){return"string"==typeof e&&db.test(e)};const gb=[];for(let e=0;e<256;++e)gb.push((e+256).toString(16).substr(1));var yb=function(e,t=0){const r=(gb[e[t+0]]+gb[e[t+1]]+gb[e[t+2]]+gb[e[t+3]]+"-"+gb[e[t+4]]+gb[e[t+5]]+"-"+gb[e[t+6]]+gb[e[t+7]]+"-"+gb[e[t+8]]+gb[e[t+9]]+"-"+gb[e[t+10]]+gb[e[t+11]]+gb[e[t+12]]+gb[e[t+13]]+gb[e[t+14]]+gb[e[t+15]]).toLowerCase();if(!mb(r))throw TypeError("Stringified UUID is invalid");return r};var bb=function(e,t,r){const n=(e=e||{}).random||(e.rng||fb)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return yb(n)},vb=r(81),wb=r.n(vb);function _b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class kb{constructor(e,t){_b(this,"nodesPerPage",void 0),_b(this,"nodesCounter",void 0),_b(this,"writeFile",void 0),_b(this,"nodePages",void 0),this.nodesPerPage=t,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=e}useWriteFunction(e){this.writeFile=e}getNodeById(e){const t=Math.floor(e/this.nodesPerPage),r=e%this.nodesPerPage;return this.nodePages[t].nodes[r]}updateAll(e,t){const r=this.getNodeById(e);Object.assign(r,t,{index:r.index})}updateMaterialByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.material={definition:t,resource:r.index})}updateVertexCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.vertexCount=t)}updateNodeAttributeByNodeId(e){const t=this.getNodeById(e);t.mesh&&t.index&&(t.mesh.attribute.resource=t.index)}updateFeatureCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.featureCount=t)}updateTexelCountHintByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&r.mesh.material&&(r.mesh.material.texelCountHint=t)}addChildRelation(e,t){var r;if(null==e)return;null===(r=this.getNodeById(e).children)||void 0===r||r.push(t)}updateResourceInMesh(e){e.mesh&&isFinite(e.index)&&(e.mesh.geometry.resource=e.index)}push(e,t){let r=this.nodePages[this.nodePages.length-1];return r.nodes.length===this.nodesPerPage&&(r={nodes:[]},this.nodePages.push(r)),e.index=this.nodesCounter++,r.nodes.push(e),this.addChildRelation(t,e.index),this.updateResourceInMesh(e),e.index}async save(e,t,r=!1){if(r){for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(Ci.join)(e,"nodepages");await t.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:this.writeFile(a,i,r.toString()+".json")})}const r=Ii()({nodeCount:this.nodesCounter},{folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}}),n=!1;await t.enqueue({archiveKey:"metadata.json",writePromise:this.writeFile(e,JSON.stringify(r),"metadata.json",n)})}else for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(Ci.join)(e,"nodepages",r.toString());await t.enqueue({writePromise:this.writeFile(a,i)})}}}const xb={};class Eb extends ys{static get ZERO(){return xb.ZERO=xb.ZERO||Object.freeze(new Eb(0,0,0,0))}constructor(e=0,t=0,r=0,n=0){super(-0,-0,-0,-0),as(e)&&1===arguments.length?this.copy(e):(ns.debug&&(fs(e),fs(t),fs(r),fs(n)),this[0]=e,this[1]=t,this[2]=r,this[3]=n)}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y),fs(e.z),fs(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=fs(e)}get w(){return this[3]}set w(e){this[3]=fs(e)}transform(e){return As(this,this,e),this.check()}transformByMatrix3(e){return Os(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3]}(this,this,e),this.check()}transformByQuaternion(e){return js(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}function Ab(e){const{positions:t,normals:r,texCoords:n,colors:i,featureIndices:a}=e,o=t.length/9;if(!a.length)return{faceRange:new Uint32Array([0,o-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:i};const s=function(e){let t=1,r=1,n=Sb(e.slice(0,3));const i=[],a=[],o=[n];i[0]=0,a[0]=n;for(let s=3;s<e.length;s+=3){const u=Sb(e.slice(s,s+3));n!==u&&(i[t]=s/3-1,i[t+1]=s/3,a[r]=u,o.includes(u)||o.push(u),t+=2,r+=1),n=u}i[t]=e.length/3-1;const s=new Uint32Array(i),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}(a);return function(e,t){const r=e[0],n=[r.featureId||0];let i=new Float32Array(r.positions),a=new Float32Array(r.normals),o=new Uint8Array(r.colors),s=new Float32Array(r.texCoords);const u=[0];let c=0,l=0;for(let t=1;t<e.length;t++){const r=e[t];n.push(r.featureId||0),i=Qa(i,r.positions),a=Qa(a,r.normals),o=Qa(o,r.colors),s=Qa(s,r.texCoords);const h=e[c];u.push(h.positions.length/9-1+l),u.push(h.positions.length/9+l),l+=h.positions.length/9,c+=1}u.push(i.length/9-1);return{faceRange:new Uint32Array(u),featureIds:n,positions:i,normals:a,colors:o,texCoords:s,featureCount:t}}(function(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r],i=t.find(e=>e.featureId===n.featureId);i?(i.positions=Qa(i.positions,n.positions),i.normals=Qa(i.normals,n.normals),i.colors=Qa(i.colors,n.colors),i.texCoords=Qa(i.texCoords,n.texCoords)):t.push(n)}return t}(function(e){const{featureIds:t,positions:r,normals:n,colors:i,texCoords:a,faceRange:o=new Uint32Array(0)}=e,s=[];let u=new Float32Array(r),c=new Float32Array(n),l=new Uint8Array(i),h=new Float32Array(a),p=0;for(let e=0;e<t.length;e++){const r=o[e+p],n=o[e+p+1],i=jb("positions",r,n),a=jb("normals",r,n),f=jb("colors",r,n),d=jb("texCoords",r,n);s.push({featureId:t[e],positions:u.slice(0,i),normals:c.slice(0,a),colors:l.slice(0,f),texCoords:h.slice(0,d)}),u=u.slice(i),c=c.slice(a),l=l.slice(f),h=h.slice(d),p+=1}return s.sort((e,t)=>e.featureId-t.featureId)}({...s,...e})),s.featureCount)}function Sb(e){const t={};let r=e[0],n=1;for(const i of e)t[i]=(t[i]||0)+1,n=n>t[i]?n:t[i],r=n>t[i]?r:i;return r}function jb(e,t,r){const n=r-t+1,i=3*n;switch(e){case"positions":case"normals":return 9*n;case"colors":return 4*i;case"texCoords":return 2*i;default:return 0}}function Tb(e){const t={};for(const r in e)t[r]={value:e[r].value};return t}function Cb(e){var t,r,n,i,a,o,s,u,c,l;const h=null===(t=e.gltf)||void 0===t||null===(r=t.materials)||void 0===r?void 0:r.map(e=>({id:e.id}));let p=(null===(n=e.gltf)||void 0===n||null===(i=n.scene)||void 0===i?void 0:i.nodes)||(null===(a=e.gltf)||void 0===a||null===(o=a.scenes)||void 0===o||null===(s=o[0])||void 0===s?void 0:s.nodes)||(null===(u=e.gltf)||void 0===u?void 0:u.nodes)||[];const f=(null===(c=e.gltf)||void 0===c||null===(l=c.images)||void 0===l?void 0:l.map(e=>{var t;if(null!=e&&null!==(t=e.image)&&void 0!==t&&t.compressed)return{data:null,compressed:!0};{var r;const t=null==e||null===(r=e.image)||void 0===r?void 0:r.data,n=new Uint8Array(t.length);return n.set(t),{data:n,compressed:!1,height:e.image.height,width:e.image.width,components:e.image.components,mimeType:e.mimeType}}}))||[];!function e(t){for(let n=0;n<t.length;n++){const i=t[n];var r;if(i.mesh)t[n]={...i,mesh:{...i.mesh,primitives:null===(r=i.mesh)||void 0===r?void 0:r.primitives.map(e=>{var t,r;return{...e,indices:{value:null==e||null===(t=e.indices)||void 0===t?void 0:t.value},attributes:Tb(e.attributes),material:{id:null==e||null===(r=e.material)||void 0===r?void 0:r.id}}})}};i.children&&e(i.children)}}(p);return{gltfMaterials:h,nodes:p,images:f,cartographicOrigin:e.cartographicOrigin,cartesianModelMatrix:e.cartesianModelMatrix}}function Bb(e,t,r){var n,i,a,o;const s=null==t||null===(n=t.featureIdAttributes)||void 0===n?void 0:n[0];if(null!=s&&null!==(i=s.featureIds)&&void 0!==i&&i.attribute){return e[s.featureIds.attribute].value}if(null!=s&&null!==(a=s.featureIds)&&void 0!==a&&a.hasOwnProperty("constant")&&null!=s&&null!==(o=s.featureIds)&&void 0!==o&&o.hasOwnProperty("divisor")){var u;return function(e,t=0,r=0){let n=[];if(r>0){let i=t,a=r;for(let t=0;t<e;t++)n.push(i),a-=1,0===a&&(i++,a=r)}else n=Array(e).fill(t,0,e);return n}((null==e||null===(u=e.POSITIONS)||void 0===u?void 0:u.value.length)/3||0,s.featureIds.constant,s.featureIds.divisor)}const c=(null==t?void 0:t.featureIdTextures)&&(null==t?void 0:t.featureIdTextures[0]);if(c){var l,h;return function(e,t,r){var n,i,a;if(null==r||!r.length)return[];const o=null==e||null===(n=e.featureIds)||void 0===n||null===(i=n.texture)||void 0===i?void 0:i.index,s=null==e||null===(a=e.featureIds)||void 0===a?void 0:a.channels;if(!s||void 0===o)return[];const u=r[o],c=[],l={r:0,g:1,b:2,a:3}[s];if(u.compressed)console.warn(`Can't get batch Ids from ${u.mimeType} compressed texture`);else for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1],i=Math.min(Rb(r)*u.width|0,u.width-1),a=(Math.min(Rb(n)*u.height|0,u.height-1)*u.width+i)*u.components+l,o=new Uint8Array(u.data)[a];c.push(o)}return c}(c,e["TEXCOORD_"+((null==c||null===(l=c.featureIds)||void 0===l||null===(h=l.texture)||void 0===h?void 0:h.texCoord)||0)].value,r)}return(null==t?void 0:t.featureTextures)&&(null==t?void 0:t.featureTextures[0])?(console.warn("EXT_feature_metadata doesn't yet support featureTextures in primitive"),[]):[]}function Rb(e){return(e%1+1)%1}function Ob(e,t){const r=[];for(const n of t){const t=e[n]||null;r.push(t)}return r}function Ib(e,t){return"OBJECTID"===e?"OBJECTID":"string"==typeof t?"string":"number"==typeof t?Number.isInteger(t)?"Int32":"double":"string"}function Pb(e,t,r){const n={key:"f_"+e,name:t,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(r){case"OBJECTID":!function(e){e.attributeValues={valueType:"Oid32",valuesPerElement:1}}(n);break;case"string":Lb(n);break;case"double":!function(e){e.attributeValues={valueType:"Float64",valuesPerElement:1}}(n);break;case"Int32":break;default:Lb(n)}return n}function Db(e){switch(e){case"OBJECTID":return"esriFieldTypeOID";case"string":return"esriFieldTypeString";case"Int32":return"esriFieldTypeInteger";case"double":return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}function Mb(e,t){return{name:e,type:t,alias:e}}function Fb(e){const t=[],r=[];for(const r in e)t.push({fieldName:r,visible:!0,isEditable:!1,label:r});return r.push({fieldInfos:t,type:"fields"}),{title:"{OBJECTID}",mediaInfos:[],popupElements:r,fieldInfos:t,expressionInfos:[]}}function Lb(e){e.ordering.unshift("attributeByteCounts"),e.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),e.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},e.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}const Nb=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"];let zb=new Ds;async function Ub(e,t,r,n,i,a,o,s,u){var c;const l=o,h=function(e=[]){const t=[];for(const r of e)t.push(Xb(r));return t}(null===(c=e.gltf)||void 0===c?void 0:c.materials),p=Cb(e),f=await async function(e,t){const{gltfMaterials:r,nodes:n,images:i,cartographicOrigin:a,cartesianModelMatrix:o}=e,s=new Map;for(const e of r||[{id:"default"}])s.set(e.id,{positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null});Hb(n,i,a,o,s,t);for(const e of s.keys()){const t=s.get(e);t&&(0!==t.positions.length?t.featureIndicesGroups&&(t.featureIndices=t.featureIndicesGroups.reduce((e,t)=>e.concat(t)),delete t.featureIndicesGroups):s.delete(e))}return s}(p,l);o&&function(e,t){for(const r of e.values()){const e=um(r.positions,t);r.boundingVolumes=e;const n=e.obb.center;for(let e=0;e<r.positions.length;e+=3){const i=r.positions.subarray(e,e+3);_u.WGS84.cartesianToCartographic(Array.from(i),zb),zb[2]=zb[2]-t.getHeight(zb[1],zb[0]),zb=zb.subtract(n),r.positions.set(zb,e)}}}(f,s),f.has("default")&&h.push({material:{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}});const d=[];let{materials:m=[]}=e.gltf||{materials:[]};null!=m&&m.length||m.push({id:"default"});for(let o=0;o<m.length;o++){const s=m[o];if(!f.has(s.id))continue;const c=f.get(s.id);if(!c)continue;const{material:l,texture:p}=h[o],g=t();d.push(await qb({convertedAttributes:c,material:l,texture:p,tileContent:e,nodeId:g,featuresHashArray:n,propertyTable:r,attributeStorageInfo:i,draco:a,workerSource:u}))}return d.length?d:null}async function qb({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:i,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,workerSource:c}){var l;const h=e.boundingVolumes,p=e.positions.length/3,{faceRange:f,featureIds:d,positions:m,normals:g,colors:y,texCoords:b,featureCount:v}=Ab(e);n.batchTableJson&&function(e,t,r,n){const i=function(e,t,r){const n={};for(let i=0;i<e.length;i++){const a=e[i],o=iv(i,t,r);n[a.toString()]=o}return n}(e,n,r);av(t,i),av(e,i)}(d,e.featureIndices,a,n.batchTableJson);const w=new Uint32Array(2),_=function(e){const t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}(d);w.set([p,v],0);const k=new Uint8Array(Ja(w.buffer,m.buffer,g.buffer,r?b.buffer:new ArrayBuffer(0),y.buffer,_.buffer,f.buffer)),x=u?async function(e,t,r,n){const{positions:i,normals:a,texCoords:o,colors:s,featureIds:u,faceRange:c}=r,l=new Uint32Array(e);for(let e=0;e<l.length;e++)l.set([e],e);const h=function(e,t){const r=new Uint32Array(e.length);let n=0,i=0;for(let e=1;e<t.length;e+=2){const a=3*(t[e]+1);r.fill(n,i,a),n++,i=a+1}return r}(new Uint32Array(t.featureIndices.length?t.featureIndices:e),c),p={positions:i,normals:a,colors:s,"feature-index":h};o.length&&(p.texCoords=o);const f={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(u)}};return gm({attributes:p,indices:l},Bc,{...Bc.options,source:n,reuseWorkers:!0,_nodeWorkers:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:f}})}(p,e,{positions:m,normals:g,texCoords:r?b:new Float32Array(0),colors:y,featureIds:d,faceRange:f},c.draco):null;let E=[];return s&&o&&(E=function(e,t,r){const n=[],i=function(e,t){let r=!1;for(const n of Object.values(t))e.length!==n.length&&(r=!0);return r}(e,t)?function(e,t){const r={};for(const n in t){const i=t[n];r[n]=Ob(i,e)}return r}(e,t):t,a={OBJECTID:e,...i};for(const e in a){const t=sv(e,r),i=a[e],o=ov(t,i);n.push(o)}return n}(d,o,s)),{nodeId:i,geometry:k,compressedGeometry:x,texture:r,sharedResources:ev((null===(l=n.gltf)||void 0===l?void 0:l.materials)||[],i),meshMaterial:t,vertexCount:p,attributes:E,featureCount:v,boundingVolumes:h}}function Hb(e,t,r,n,i,a,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){if(e)for(const s of e)Gb(s,t,r,n,i,a,o)}function Gb(e,t,r,n,i,a,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){const s=function(e,t){let r=t;const{matrix:n,rotation:i,scale:a,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),i&&(r=r.rotateXYZ(i)),a&&(r=r.scale(a)),r}(e,o),u=e.mesh;u&&function(e,t,r,n,i,a=!1,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){for(const p of e.primitives){var s,u,c,l,h;let e=null;p.material?e=i.get(p.material.id):i.has("default")&&(e=i.get("default")),Vi(null!==e,"Primitive - material mapping failed");const f=p.attributes;e&&(e.positions=Qa(e.positions,Vb({vertices:f.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:null===(s=p.indices)||void 0===s?void 0:s.value,attributeSpecificTransformation:Wb,useCartesianPositions:a})),e.normals=Qa(e.normals,Vb({vertices:f.NORMAL&&f.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:null===(u=p.indices)||void 0===u?void 0:u.value,attributeSpecificTransformation:Kb,useCartesianPositions:!1})),e.texCoords=Qa(e.texCoords,Jb(f.TEXCOORD_0&&f.TEXCOORD_0.value,null===(c=p.indices)||void 0===c?void 0:c.value)),e.colors=Qa(e.colors,Qb(f.COLOR_0,null===(l=p.indices)||void 0===l?void 0:l.value)),e.featureIndicesGroups=e.featureIndicesGroups||[],e.featureIndicesGroups.push(Yb($b(f,p,t),null===(h=p.indices)||void 0===h?void 0:h.value)))}}(u,t,r,n,i,a,s),Hb(e.children||[],t,r,n,i,a,s)}function Vb(e){const{vertices:t,indices:r,attributeSpecificTransformation:n}=e,i=new Float32Array(3*r.length);if(!t)return i;for(let a=0;a<r.length;a++){const o=3*r[a],s=t.subarray(o,o+3);let u=new Ds(Array.from(s));u=n(u,e),i[3*a]=u.x,i[3*a+1]=u.y,i[3*a+2]=u.z}return i}function Wb(e,t){const{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:i,useCartesianPositions:a}=t;return i&&(e=e.transform(i)),e=e.transform(r),a?e:(_u.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n))}function Kb(e,t){const{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r)}function Jb(e,t){const r=new Float32Array(2*t.length);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){const i=2*t[n],a=e.subarray(i,i+2);r[2*n]=a[0],r[2*n+1]=a[1]}return r}function Qb(e,t){const r=(null==e?void 0:e.components)||4,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;const i=e.value;for(let e=0;e<t.length;e++){const a=t[e]*r,o=i.subarray(a,a+r),s=new Uint8Array(r);for(let e=0;e<o.length;e++)s[e]=255*o[e];n.set(s,e*r)}return n}function Yb(e,t){if(!e.length||!t.length)return[];const r=[];for(let n=0;n<t.length;n++){const i=t[n];r.push(e[i])}return r}function $b(e,t,r){const n=function(e,t,r){const n=null==t?void 0:t.extensions;if(!n)return[];for(const[t,i]of Object.entries(n||{}))switch(t){case"EXT_feature_metadata":return Bb(e,i,r);case"EXT_mesh_features":return console.warn("EXT_mesh_features extension is not supported yet"),[];default:return[]}return[]}(e,t,r);if(n.length)return n;for(let t=0;t<Nb.length;t++){const r=Nb[t];if(e[r]&&e[r].value)return e[r].value}return[]}function Xb(e){var t,r,n,i;const a={doubleSided:e.doubleSided,emissiveFactor:null===(t=e.emissiveFactor)||void 0===t?void 0:t.map(e=>Math.round(255*e)),alphaMode:Zb(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.roughnessFactor)||1,metallicFactor:(null==e||null===(n=e.pbrMetallicRoughness)||void 0===n?void 0:n.metallicFactor)||1}};let o;if(null!=e&&null!==(i=e.pbrMetallicRoughness)&&void 0!==i&&i.baseColorTexture?(o=e.pbrMetallicRoughness.baseColorTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(o=e.emissiveTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),!o){var s;const t=null==e||null===(s=e.pbrMetallicRoughness)||void 0===s?void 0:s.baseColorFactor;a.pbrMetallicRoughness.baseColorFactor=t&&t.map(e=>Math.round(255*e))||void 0}return{material:a,texture:o}}function Zb(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function ev(e,t){const r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(const n of e){const{materialDefinitionInfo:e,textureDefinitionInfo:i}=tv(n,t);r.materialDefinitionInfos.push(e),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function tv(e,t){var r;const n=(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture)||e.emissiveTexture;let i=null;n&&(i=function(e,t){var r,n,i;return{encoding:null!=e&&null!==(r=e.source)&&void 0!==r&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:nv(e,t),size:null===(n=e.source)||void 0===n?void 0:n.image.width,length:[null===(i=e.source)||void 0===i?void 0:i.image.data.length]}]}}(n.texture,t));const{baseColorFactor:a,metallicFactor:o}=(null==e?void 0:e.pbrMetallicRoughness)||{};let s=a;return a&&0!==a[3]||!e.emissiveFactor||(s=e.emissiveFactor,s[3]=s[3]||1),{materialDefinitionInfo:rv(s||[1,1,1,1],o),textureDefinitionInfo:i}}function rv(e,t=1){const r=new Eb(0,0,0,1),n=new Eb(1,1,1,1),i=new Eb(.04/255,.04/255,.04/255,0),a=new Eb(e),o=n.subtract(i).multiply(a),s=o.lerp(o,r,t);i[3]=1;const u=i.lerp(i,a,t);return{params:{diffuse:s.toArray(),specular:u.toArray(),renderMode:"solid"}}}function nv(e,t){var r;const{width:n,height:i}=null===(r=e.source)||void 0===r?void 0:r.image,a=t+1,o=32-a.toString(2).length,s="0".repeat(o).concat(a.toString(2));return BigInt(`0b${(268435456+(n-1<<12)+(i-1<<0)).toString(2)}${s}`).toString()}function iv(e,t,r){const n=function(e,t){let r="";for(const n in e)r+=e[n][t];return r}(t,e),i=wb()(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function av(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function ov(e,t){let r;switch(e){case"Oid32":case"Int32":r=function(e){const t=new Uint32Array([e.length]),r=new Uint32Array(e);return Ja(t.buffer,r.buffer)}(t);break;case"Float64":r=function(e){const t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return Ja(t.buffer,r.buffer,n.buffer)}(t);break;case"string":r=uv(t);break;default:r=uv(t)}return r}function sv(e,t){return t.find(t=>t.name===e).attributeValues.valueType}function uv(e){const t=new Uint32Array([e.length]);let r=0;const n=new Uint32Array(e.length),i=[];for(let t=0;t<e.length;t++){const a=String(e[t])+"\0",o=Buffer.from(a),s=o.length;r+=s,n[t]=s,i.push(o)}const a=new Uint32Array([r]);return Ja(t.buffer,a.buffer,n.buffer,...i)}function cv(e){const t=null==e?void 0:e.batchTableJson;if(t)return t;const{extensionName:r,extension:n}=function(e){var t,r,n;const i=["EXT_feature_metadata","EXT_mesh_features"];if(!(null==e||null===(t=e.gltf)||void 0===t?void 0:t.extensionsUsed))return{extensionName:null,extension:null};let a="";for(const t of(null==e||null===(o=e.gltf)||void 0===o?void 0:o.extensionsUsed)||[]){var o;if(i.includes(t)){a=t;break}}const s=null==e||null===(r=e.gltf)||void 0===r||null===(n=r.extensions)||void 0===n?void 0:n[a];return{extensionName:a,extension:s}}(e);switch(r){case"EXT_mesh_features":return console.warn("The I3S converter does not yet support the EXT_mesh_features extension"),null;case"EXT_feature_metadata":return function(e){if(null!=e&&e.featureTextures)return console.warn("The I3S converter does not yet support the EXT_feature_metadata feature textures"),null;if(null!=e&&e.featureTables){var t;const r=null===(t=Object.keys(e.featureTables))||void 0===t?void 0:t[0];if(r){const t=null==e?void 0:e.featureTables[r],n={};for(const e in t.properties)n[e]=t.properties[e].data;return n}}return console.warn("The I3S converter couldn't handle EXT_feature_metadata extension"),null}(n);default:return null}}const lv={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}},hv=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},mbs:{path:"mbs"},obb:{path:"obb"},lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>Ii()(e,{id:{path:"id"},href:{path:"href"},mbs:{path:"mbs"},obb:{path:"obb"}}),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});function pv(e,t,r){const n={};for(const[t,i]of e.entries())n[`Mat${r.nodePath}${t}`]=Ii()(i,{name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>Ii()(r,{renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1,1]},diffuse:{path:"diffuse",default:[1,1,1,1]},specular:{path:"specular",default:[0,0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}})}});return n}function fv(e,t,r){if(!e)return null;const n={};for(const[t,i]of e.entries()){const e=`${r.nodePath}${t}`;i.imageIndex=e,n[e]=Ii()(i,{encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(e=>Ii()(e,{id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}))}})}return n}function dv(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const mv={};function gv(e="id"){mv[e]=mv[e]||1;const t=mv[e]++;return"".concat(e,"-").concat(t)}const yv={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};const bv=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),vv=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),wv=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),_v=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),kv={POSITION:{size:3,value:new Float32Array(vv)},NORMAL:{size:3,value:new Float32Array(wv)},TEXCOORD_0:{size:2,value:new Float32Array(_v)}};class xv extends class{static get DRAW_MODE(){return yv}constructor(e={}){const{id:t=gv("geometry"),drawMode:r=yv.TRIANGLES,attributes:n={},indices:i=null,vertexCount:a=null}=e;this.id=t,this.drawMode=0|r,this.attributes={},this.userData={},this._setAttributes(n,i),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return"Geometry ".concat(this.id," attribute ").concat(e)}_setAttributes(e,t){t&&(this.indices=ArrayBuffer.isView(t)?{value:t,size:1}:t);for(const t in e){let r=e[t];r=ArrayBuffer.isView(r)?{value:r}:r,dv(ArrayBuffer.isView(r.value),"".concat(this._print(t),": must be typed array or object with value as typed array")),"POSITION"!==t&&"positions"!==t||r.size||(r.size=3),"indices"===t?(dv(!this.indices),this.indices=r):this.attributes[t]=r}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(e,t){if(t)return t.value.length;let r=1/0;for(const t in e){const n=e[t],{value:i,size:a,constant:o}=n;!o&&i&&a>=1&&(r=Math.min(r,i.length/a))}return dv(Number.isFinite(r)),r}}{constructor(e={}){const{id:t=gv("cube-geometry")}=e;super({...e,id:t,indices:{size:1,value:new Uint16Array(bv)},attributes:{...kv,...e.attributes}})}}function Ev(e){var t,r;if(null==e||null===(t=e.parentNode)||void 0===t||!t.obb||null==e||null===(r=e.parentNode)||void 0===r||!r.mbs)return[];const n=[];return function(e,t){var r;const n=function(e){const{center:t,halfSize:r,quaternion:n}=e;return(new wp).fromCenterHalfSizeQuaternion(t,r,n)}(t.parentNode.obb),i=function(e){const t=new xv,r=e.obb.halfSize,n=t.getAttributes(),i=new Float32Array(n.POSITION.value),a=_u.WGS84.cartographicToCartesian(e.obb.center);let o=[];for(let t=0;t<i.length;t+=3){const n=new Ds(i[t]*=r[0],i[t+1]*=r[1],i[t+2]*=r[2]).transformByQuaternion(e.obb.quaternion).add(a);o=o.concat(n)}return o}(t);if(function(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){const i=[t[n],t[n+1],t[n+2]],a=_u.WGS84.cartesianToCartographic(i);if(e.distanceTo(a)>0){r=!1;break}}return r}(n,i))return;const a=`OBB of Tile (${t.id}) doesn't fit into Parent (${null===(r=t.parentNode)||void 0===r?void 0:r.id}) tile OBB`;e.push(a)}(n,e),function(e,t){const r=Av(t.mbs),n=Av(t.parentNode.mbs);if(r.center.distanceTo(n.center)+r.radius>n.radius){var i;const r=`MBS of Tile (${t.id}) doesn't fit into Parent (${null===(i=t.parentNode)||void 0===i?void 0:i.id}) tile MBS`;e.push(r)}}(n,e),n}function Av(e){return new Th([e[0],e[1],e[2]],e[3])}const Sv={name:"Basis Universal Supercompressed GPU Texture",id:Pi?"ktx2-basis-writer":"ktx2-basis-writer-nodejs",module:"textures",version:"3.3.0-alpha.4",extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},{_encodeImageNode:jv}=globalThis;let Tv=!0;const Cv={name:"Images",id:"image",module:"images",version:"3.3.0-alpha.4",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},jv?jv(e,{type:t.image.mimeType}):async function(e,t){const{mimeType:r,jpegQuality:n}=t.image,{width:i,height:a}=function(e){return Tu(e)}(e),o=document.createElement("canvas");o.width=i,o.height=a,function(e,t,r=0,n=0){if(0===r&&0===n&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t.getContext("bitmaprenderer");if(r)return r.transferFromImageBitmap(e),t}const i=t.getContext("2d");if(e.data){const r=new Uint8ClampedArray(e.data),n=new ImageData(r,e.width,e.height);return i.putImageData(n,0,0),t}i.drawImage(e,0,0)}(e,o);const s=await new Promise(e=>{if(n&&Tv)try{return void o.toBlob(e,r,n)}catch(e){Tv=!1}o.toBlob(e,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}(e,t)}};class Bv extends Array{enqueue(e){this.push(e)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return 0===this.length}}function Rv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ov extends Bv{constructor(e=2e3,t=400){super(),Rv(this,"intervalId",void 0),Rv(this,"writePromise",null),Rv(this,"fileMap",{}),Rv(this,"listeningInterval",void 0),Rv(this,"writeConcurrency",void 0),this.listeningInterval=e,this.writeConcurrency=t}async enqueue(e){super.enqueue(e),Ri.a.memoryUsage().rss>4294967296&&await this.startWrite()}startListening(){this.intervalId=setInterval(this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){if(this.writePromise)return await this.writePromise,void(this.writePromise=null);this.writePromise=this.doWrite(),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){const e=[],t=[];for(let r=0;r<this.writeConcurrency;r++){const r=this.dequeue();if(!r)break;const{archiveKey:n,writePromise:i}=r;t.push(n),e.push(i)}const r=await Promise.allSettled(e);this.updateFileMap(t,r)}this.writePromise=null}updateFileMap(e,t){for(let r=0;r<e.length;r++){const n=e[r];n&&"value"in t[r]&&(this.fileMap[n]=t[r].value)}}}const Iv={id:"i3s-attributes",name:"I3S Attributes Worker",module:"tile-converter",version:"3.3.0-alpha.4",options:{useCartesianPositions:!1}};var Pv;function Dv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Mv=(null===(Pv=Ri.a.env)||void 0===Pv?void 0:Pv.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";class Fv{constructor(){Dv(this,"nodePages",void 0),Dv(this,"options",void 0),Dv(this,"layers0Path",void 0),Dv(this,"materialMap",void 0),Dv(this,"materialDefinitions",void 0),Dv(this,"vertexCounter",void 0),Dv(this,"layers0",void 0),Dv(this,"featuresHashArray",void 0),Dv(this,"refinementCounter",void 0),Dv(this,"validate",void 0),Dv(this,"boundingVolumeWarnings",[]),Dv(this,"conversionStartTime",[0,0]),Dv(this,"refreshTokenTime",[0,0]),Dv(this,"sourceTileset",null),Dv(this,"geoidHeightModel",null),Dv(this,"Loader",ob),Dv(this,"generateTextures",void 0),Dv(this,"generateBoundingVolumes",void 0),Dv(this,"layersHasTexture",void 0),Dv(this,"workerSource",{}),Dv(this,"writeQueue",new Ov),this.nodePages=new kb(Zd,64),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1}async convert(e){if(Pi)return console.log(fm),fm;this.conversionStartTime=Ri.a.hrtime();const{tilesetName:t,slpk:r,egmFilePath:n,inputUrl:i,validate:a,outputPath:o,draco:s,sevenZipExe:u,maxDepth:c,token:l,generateTextures:h,generateBoundingVolumes:p}=e;this.options={maxDepth:c,slpk:r,sevenZipExe:u,egmFilePath:n,draco:s,token:l,inputUrl:i},this.validate=Boolean(a),this.Loader=-1!==i.indexOf("https://")?ub:ob,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(p),this.writeQueue=new Ov,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await Zo(n,Fd),console.log("Loading egm file completed!"),r&&this.nodePages.useWriteFunction(em),await this.loadWorkers();try{const e=await this._fetchPreloadOptions(),n={loadOptions:{_nodeWorkers:!0,reuseWorkers:!0,basis:{format:"rgba32"},"basis-nodejs":{format:"rgba32",workerUrl:"./modules/textures/dist/basis-nodejs-worker.js"},"draco-nodejs":{workerUrl:"./modules/draco/dist/draco-nodejs-worker.js"}}};e.headers&&(n.loadOptions.fetch={headers:e.headers}),Object.assign(n,e);const a=await Zo(i,this.Loader,n.loadOptions);return this.sourceTileset=new Cd(a,n),await this._createAndSaveTileset(o,t),await this._finishConversion({slpk:Boolean(r),outputPath:o,tilesetName:t}),a}catch(e){throw e}finally{za.getWorkerFarm({}).destroy()}}async _createAndSaveTileset(e,t){const r=Object(Ci.join)(""+e,""+t);try{await tm(r)}catch(e){}this.layers0Path=Object(Ci.join)(r,"SceneServer","layers","0"),this._formLayers0(t),this.materialDefinitions=[],this.materialMap=new Map;const n=this.sourceTileset.root,i=sm(n,this.geoidHeightModel),a=this.nodePages.push({index:0,lodThreshold:0,obb:i.obb,children:[]}),o=this.options.slpk,s=this._formRootNodeIndexDocument(i);await this._convertNodesTree(s,n,a,i),this.layers0.materialDefinitions=this.materialDefinitions,!1===this.layersHasTexture&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(e=>"uv0"!==e)),await this._writeLayers0(),async function(e,t,r){const n={serviceItemId:bb().replace(/-/gi,""),layerName:e,layers0:t},i=Ii()(n,{serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}}),a=Object(Ci.join)(r,"SceneServer");await Zd(a,JSON.stringify(i))}(t,this.layers0,r),await this._writeNodeIndexDocument(s,"root",Object(Ci.join)(this.layers0Path,"nodes","root")),await this.nodePages.save(this.layers0Path,this.writeQueue,o),await this.writeQueue.finalize(),await this._createSlpk(r)}_formLayers0(e){var t,r,n;const i=function(e){let t;t=e instanceof Th?e:e.getBoundingSphere();const r=t.center,n=t.radius,i=_u.WGS84.cartesianToCartographic(new Ds(r[0]+n,r[1]+n,r[2]+n),new Ds),a=_u.WGS84.cartesianToCartographic(new Ds(r[0]-n,r[1]-n,r[2]-n),new Ds);return{xmin:a[0],xmax:i[0],ymin:a[1],ymax:i[1],zmin:a[2],zmax:i[2]}}((null===(t=this.sourceTileset)||void 0===t?void 0:t.boundingVolume)||(null===(r=this.sourceTileset)||void 0===r||null===(n=r.root)||void 0===n?void 0:n.boundingVolume)),a=[i.xmin,i.ymin,i.xmax,i.ymax],o={version:`{${bb().toUpperCase()}}`,id:0,name:e,href:"./layers/0",store:{id:`{${bb().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:64},compressGeometry:this.options.draco,fullExtent:i};this.layers0=Ii()(o,{version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>Ii()(e,{wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}})},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>Ii()(e,lv)},fullExtent:{path:"fullExtent",transform:e=>Ii()(e,{xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}})},heightModelInfo:{path:"heightModelInfo",transform:e=>Ii()(e,{heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}})},nodePages:{path:"nodePages",transform:e=>Ii()(e,{nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}})},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"compressGeometry",transform:e=>{const t=[{geometryBuffers:[]},{geometryBuffers:[]}];return t[0].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),t[1].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),e&&(t[0].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","uv0","color","feature-index"]}}),t[1].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","color","feature-index"]}})),t},default:[{geometryBuffers:[{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}},{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}]}]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}})}_formRootNodeIndexDocument(e){const t={version:`{${bb().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...e,children:[]};return Ii()(t,hv())}async _convertNodesTree(e,t,r,n){if(await this.sourceTileset._loadTile(t),this.isContentSupported(t)){e.children=e.children||[],e.children.push({id:"1",href:"./1",...n});const[i]=await this._createNode(e,t,r,0),a=Object(Ci.join)(this.layers0Path,"nodes",i.path);this.options.slpk?await this.writeQueue.enqueue({archiveKey:"nodes/1/3dNodeIndexDocument.json.gz",writePromise:em(a,JSON.stringify(i),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Zd(a,JSON.stringify(i))})}else await this._addChildrenWithNeighborsAndWriteFile({parentNode:e,sourceTiles:t.children,parentId:r,level:1});await t.unloadContent()}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:em(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:Zd(this.layers0Path,JSON.stringify(this.layers0))})}async _writeNodeIndexDocument(e,t,r){this.options.slpk?await this.writeQueue.enqueue({archiveKey:`nodes/${t}/3dNodeIndexDocument.json.gz`,writePromise:em(r,JSON.stringify(e),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Zd(r,JSON.stringify(e))})}async _createSlpk(e){if(this.options.slpk){const t=Object(Ci.join)(e,"SceneServer","layers","0"),r=e+".slpk";await Xd(t,r,0,".",this.options.sevenZipExe);try{await tm(e)}catch(e){}}}async _addChildrenWithNeighborsAndWriteFile(e){const t=[];await this._addChildren({...e,childNodes:t}),await this._addNeighborsAndWriteFile(e.parentNode,t)}async convertNestedTileset({sourceTile:e,parentNode:t,childNodes:r,parentId:n,level:i}){await this.sourceTileset._loadTile(e),await this._addChildren({parentNode:t,sourceTiles:e.children,childNodes:r,parentId:n,level:i+1}),await e.unloadContent()}async convertNode({sourceTile:e,parentNode:t,childNodes:r,parentId:n,level:i}){const a=await this._createNode(t,e,n,i);t.children=t.children||[];for(const e of a)t.children.push({id:e.id,href:"../"+e.path,obb:e.obb,mbs:e.mbs}),r.push(e)}async _addChildren(e){const{childNodes:t,sourceTiles:r,parentNode:n,parentId:i,level:a}=e;if(this.options.maxDepth&&a>this.options.maxDepth)return;const o=[];for(const e of r)"json"===e.type?o.push(this.convertNestedTileset({sourceTile:e,parentNode:n,childNodes:t,parentId:i,level:a})):o.push(this.convertNode({sourceTile:e,parentNode:n,childNodes:t,parentId:i,level:a})),await Promise.all(o),e.id&&console.log(e.id)}async _addNeighborsAndWriteFile(e,t){for(const n of t){var r;const t=Object(Ci.join)(this.layers0Path,"nodes",n.path),i=n.path;if(delete n.path,Number(null==e||null===(r=e.children)||void 0===r?void 0:r.length)<1e3)for(const t of e.children||[])n.id!==t.id&&n.neighbors&&n.neighbors.push({...t});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete n.neighbors;await this._writeNodeIndexDocument(n,i,t),n.neighbors=[]}}async _createNode(e,t,r,n){var i,a;this.validate&&this._checkAddRefinementTypeForTile(t),await this._updateTilesetOptions(),await this.sourceTileset._loadTile(t);let o=sm(t,this.geoidHeightModel);const s=cv(t.content);!s||null!==(i=this.layers0)&&void 0!==i&&null!==(a=i.attributeStorageInfo)&&void 0!==a&&a.length||this._convertPropertyTableToNodeAttributes(s);const u=await this._convertResources(t,r,s),c=[],l=[],h={geometry:null,compressedGeometry:null,texture:null,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(const n of u||[h]){this.layersHasTexture=this.layersHasTexture||Boolean(n.texture),this.generateBoundingVolumes&&n.boundingVolumes&&(o=n.boundingVolumes);const i=Nd(t,o),a=i.find(e=>"maxScreenThresholdSQ"===e.metricType)||{maxError:0},s=this._updateNodeInNodePages(a,o,t,r,n),u=this._createNodeIndexDocument(e,o,i,s,n);s.mesh&&await this._writeResources(n,u.path),this.validate&&(this.boundingVolumeWarnings=Ev(u),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),c.push(u),l.push(s)}return t.unloadContent(),await this._addChildrenWithNeighborsAndWriteFile({parentNode:c[0],sourceTiles:t.children,parentId:l[0].index,level:n+1}),c}async _convertResources(e,t,r){var n;if(!this.isContentSupported(e))return null;const i={center:[],halfSize:[],quaternion:[]};return await Ub(e.content,()=>this.nodePages.push({index:0,obb:i},t),r,this.featuresHashArray,null===(n=this.layers0)||void 0===n?void 0:n.attributeStorageInfo,this.options.draco,this.generateBoundingVolumes,this.geoidHeightModel,this.workerSource)}_updateNodeInNodePages(e,t,r,n,i){const{meshMaterial:a,texture:o,vertexCount:s,featureCount:u,geometry:c}=i,l={index:0,lodThreshold:e.maxError,obb:t.obb,children:[]};c&&this.isContentSupported(r)&&(l.mesh={geometry:{definition:o?0:1,resource:0},attribute:{resource:0},material:{definition:0}});let h=i.nodeId;if(h){this.nodePages.updateAll(h,l);const e=this.nodePages.getNodeById(h);this.nodePages.updateResourceInMesh(e)}else h=this.nodePages.push(l,n);if(a&&this.nodePages.updateMaterialByNodeId(h,this._findOrCreateMaterial(a)),o){const e=o.image.height*o.image.width;this.nodePages.updateTexelCountHintByNodeId(h,e)}return s&&(this.vertexCounter+=s,this.nodePages.updateVertexCountByNodeId(h,s)),this.nodePages.updateNodeAttributeByNodeId(h),u&&this.nodePages.updateFeatureCountByNodeId(h,u),this.nodePages.getNodeById(h)}_createNodeIndexDocument(e,t,r,n,i){const{texture:a,attributes:o}=i,s=n.index,u={version:e.version,id:s.toString(),path:s.toString(),level:e.level+1,...t,lodSelection:r,parentNode:{id:e.id,href:"../"+e.id,mbs:e.mbs,obb:e.obb},children:[],neighbors:[]},c=Ii()(u,hv());var l,h;if(n.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},a&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),o&&o.length&&null!==(l=this.layers0)&&void 0!==l&&null!==(h=l.attributeStorageInfo)&&void 0!==h&&h.length)){c.attributeData=[];for(let e=0;e<o.length;e++){const t=this.layers0.attributeStorageInfo[e].key;c.attributeData.push({href:`./attributes/${t}/0`})}}return c}async _writeResources(e,t){const{geometry:r,compressedGeometry:n,texture:i,sharedResources:a,attributes:o}=e,s=Object(Ci.join)(this.layers0Path,"nodes",t),u=Object(Ci.join)("nodes",t);await this._writeGeometries(r,n,s,u),await this._writeShared(a,s,u,t),await this._writeTexture(i,s,u),await this._writeAttributes(o,s,u)}async _writeGeometries(e,t,r,n){if(this.options.slpk){const t=Object(Ci.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/0.bin.gz",writePromise:em(t,e,"0.bin")})}else{const t=Object(Ci.join)(r,"geometries/0/");await this.writeQueue.enqueue({writePromise:Zd(t,e,"index.bin")})}if(this.options.draco)if(this.options.slpk){const e=Object(Ci.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/1.bin.gz",writePromise:em(e,t,"1.bin")})}else{const e=Object(Ci.join)(r,"geometries/1/");await this.writeQueue.enqueue({writePromise:Zd(e,t,"index.bin")})}}async _writeShared(e,t,r,n){if(!e)return;e.nodePath=n;const i=Ii()(e,{materialDefinitions:{path:"materialDefinitionInfos",transform:pv},textureDefinitions:{path:"textureDefinitionInfos",transform:fv}}),a=JSON.stringify(i);if(this.options.slpk){const e=Object(Ci.join)(t,"shared");await this.writeQueue.enqueue({archiveKey:r+"/shared/sharedResource.json.gz",writePromise:em(e,a,"sharedResource.json")})}else{const e=Object(Ci.join)(t,"shared/");await this.writeQueue.enqueue({writePromise:Zd(e,a)})}}async _writeTexture(e,t,r){if(e){const n=this._getFormatByMimeType(null==e?void 0:e.mimeType),i=[],a=e.bufferView.data;switch(n){case"jpg":case"png":if(i.push({name:"0",format:n}),await this.writeTextureFile(a,"0",n,t,r),this.generateTextures){i.push({name:"1",format:"ktx2"});const n=e.image.data.subarray(),a=new Uint8Array(n),o=gm({...e.image,data:a},Sv,{...Sv.options,source:this.workerSource.ktx2,reuseWorkers:!0,_nodeWorkers:!0});await this.writeTextureFile(o,"1","ktx2",t,r)}break;case"ktx2":if(i.push({name:"1",format:n}),await this.writeTextureFile(a,"1",n,t,r),this.generateTextures){i.push({name:"0",format:"jpg"});const n=gm(e.image.data[0],Cv);await this.writeTextureFile(n,"0","jpg",t,r)}}this.layers0.textureSetDefinitions.length||this.layers0.textureSetDefinitions.push({formats:i})}}async writeTextureFile(e,t,r,n,i){if(this.options.slpk){const a=Object(Ci.join)(n,"textures"),o=!1;await this.writeQueue.enqueue({archiveKey:`${i}/textures/${t}.${r}`,writePromise:em(a,e,`${t}.${r}`,o)})}else{const i=Object(Ci.join)(n,`textures/${t}/`);await this.writeQueue.enqueue({writePromise:Zd(i,e,"index."+r)})}}async _writeAttributes(e=[],t,r){var n,i;if(null!=e&&e.length&&null!==(n=this.layers0)&&void 0!==n&&null!==(i=n.attributeStorageInfo)&&void 0!==i&&i.length)for(let n=0;n<e.length;n++){const i=this.layers0.attributeStorageInfo[n].key,a=new Uint8Array(e[n]);if(this.options.slpk){const e=Object(Ci.join)(t,"attributes",i);await this.writeQueue.enqueue({archiveKey:`${r}/attributes/${i}.bin.gz`,writePromise:em(e,a,"0.bin")})}else{const e=Object(Ci.join)(t,`attributes/${i}/0`);await this.writeQueue.enqueue({writePromise:Zd(e,a,"index.bin")})}}}_getFormatByMimeType(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(e){const t=wb()(JSON.stringify(e));if(this.materialMap.has(t))return this.materialMap.get(t);const r=this.materialDefinitions.push(e)-1;return this.materialMap.set(t,r),r}_convertPropertyTableToNodeAttributes(e){let t=0;const r={OBJECTID:[0],...e};for(const e in r){const n=Ib(e,r[e][0]),i=Pb(t,e,n),a=Mb(e,Db(n)),o=Fb(r);this.layers0.attributeStorageInfo.push(i),this.layers0.fields.push(a),this.layers0.popupInfo=o,this.layers0.layerType="3DObject",t+=1}}async _finishConversion(e){const{tilesCount:t,tilesWithAddRefineCount:r}=this.refinementCounter,n=r?r/t*100:0,i=await am(e),a=im(Ri.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finishing conversion of 3DTILES"),console.log("Total conversion time: "+a),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",i," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',n,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};const e={"cesium-ion":{accessToken:this.options.token||Mv}},t=await this.Loader.preload(this.options.inputUrl,e);return this.refreshTokenTime=Ri.a.hrtime(),{...e,...t}}async _updateTilesetOptions(){if(Ri.a.hrtime(this.refreshTokenTime)[0]<1800)return;this.refreshTokenTime=Ri.a.hrtime();const e=await this._fetchPreloadOptions();this.sourceTileset.options={...this.sourceTileset.options,...e},e.headers&&(this.sourceTileset.loadOptions.fetch={...this.sourceTileset.loadOptions.fetch,headers:e.headers},console.log("Authorization Bearer token has been updated"))}_checkAddRefinementTypeForTile(e){1===e.refine&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(e){var t;return["b3dm","glTF"].includes(null==e||null===(t=e.content)||void 0===t?void 0:t.type)}async loadWorkers(){if(console.log("Loading workers source..."),this.options.draco){const e=Ua(Bc,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.draco=r}if(this.generateTextures){const e=Ua(Sv,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.ktx2=r}const e=Ua(Iv,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.I3SAttributes=r,console.log("Loading workers source completed!")}}const Lv={id:"zip",module:"zip",name:"Zip Archive",version:"3.3.0-alpha.4",extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:async function(e,t={}){const r=[],n={};try{const i=new Kd.a;return(await i.loadAsync(e,t)).forEach((e,a)=>{const o=a.name,s=async function(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(e){return r.log.error(`Unable to read ${t} from zip archive: ${e}`),e}}(i,o,t).then(t=>{n[e]=t});r.push(s)}),await Promise.all(r),n}catch(e){throw t.log.error("Unable to read zip archive: "+e),e}}};class Nv{async install(e="",t=""){console.log('Installing "EGM2008-5" model...');const r=await Zo("https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",Lv,{});let n=process.cwd();e&&(n=Object(Ci.join)(n,e)),await Zd(n,new Uint8Array(r["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log('Installing "I3S Content Loader worker"'),await this.installWorker("i3s","i3s-content-nodejs-worker.js",t),console.log('Installing "Draco Loader worker"'),await this.installWorker("draco","draco-nodejs-worker.js",t),console.log('Installing "Basis Loader worker"'),await this.installWorker("textures","basis-nodejs-worker.js",t),console.log("All dependencies were installed succesfully.")}async installWorker(e,t,r){const n=await oa(`https://unpkg.com/@loaders.gl/${e}@3.3.0-alpha.4/dist/${t}`),i=await n.arrayBuffer();if(!i)return;const a=Object(Ci.join)(process.cwd(),r,"modules",e,"dist");await Zd(a,i,t)}}const zv={I3S:"I3S",_3DTILES:"3DTILES"};function Uv(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Will generate obb and mbs bounding volumes from geometry]"),console.log("--validate [Enable validation]"),process.exit(0)}function qv(e,t){if(e+1>=t.length)return"";const r=t[e+1];return 0===r.indexOf("--")?"":r}function Hv(e,t){const r=qv(e,t).toLowerCase().trim();return!("--no-draco"===t[e]&&!r)&&(!r||"true"===r)}(async function(){const[,,...e]=process.argv;0===e.length&&Uv();const t=function(e){const t={output:"data",sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:Object(Ci.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1};return e.forEach((r,n)=>{if(0===r.indexOf("--"))switch(r){case"--input-type":t.inputType=qv(n,e);break;case"--tileset":t.tileset=qv(n,e);break;case"--name":t.name=qv(n,e);break;case"--output":t.output=qv(n,e);break;case"--max-depth":t.maxDepth=function(e,t){const r=qv(e,t),n=Number.parseInt(r);if(isFinite(n))return n;return NaN}(n,e);break;case"--slpk":t.slpk=Hv(n,e);break;case"--7zExe":t.sevenZipExe=qv(n,e);break;case"--egm":t.egm=qv(n,e);break;case"--token":t.token=qv(n,e);break;case"--no-draco":t.draco=Hv(n,e);break;case"--validate":t.validate=Hv(n,e);break;case"--install-dependencies":t.installDependencies=Hv(n,e);break;case"--generate-textures":t.generateTextures=Hv(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=Hv(n,e);break;case"--help":Uv();break;default:console.warn("Unknown option "+r),process.exit(0)}}),t}(function(e){return e.reduce((e,t)=>{const r=t.indexOf("="),n=t.slice(0,r),i=t.slice(r+1,t.length);return t.includes("=")&&t.startsWith("--")&&i?e.concat(n,i):e.concat(t)},[])}(e));if(t.installDependencies){return void(new Nv).install("deps")}const r=function(e){const t={name:()=>console.log("Missed: --name [Tileset name]"),output:()=>console.log("Missed: --output [Output path name]"),sevenZipExe:()=>console.log("Missed: --7zExe [7z archiver executable path]"),egm:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]"),tileset:()=>console.log("Missed: --tileset [tileset.json file]"),inputType:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]")},r=[];for(const n in t){const i=e[n],a=Boolean(i)&&"inputType"===n&&!Object.values(zv).includes(i.toUpperCase());i&&!a||r.push(t[n])}r.length&&(r.forEach(e=>e()),process.exit(0));return e}(t);await async function(e){console.log("------------------------------------------------"),console.log("Starting conversion of "+e.inputType),console.log("------------------------------------------------");switch(e.inputType.toUpperCase()){case zv.I3S:(new mm).convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case zv._3DTILES:const t=new Fv;await t.convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,egmFilePath:e.egm,token:e.token,draco:e.draco,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate});break;default:Uv()}}(r)})().catch(e=>{console.log(e),process.exit(1)})},,,,,,,,,,,function(e,t){e.exports=require("worker_threads")},function(e,t,r){"use strict";function n(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}r.d(t,"a",(function(){return _}));const i="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source",a=n();class o{constructor(e,t,r="sessionStorage"){this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function s(e,t,r,n=600){const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}const u={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function c(e){return"string"==typeof e?u[e.toUpperCase()]||u.WHITE:e}function l(e,t){if(!e)throw new Error(t||"Assertion failed")}const h={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},p=h.window||h.self||h.global,f=h.process||{};console;function d(){let e;if(a&&p.performance)e=p.performance.now();else if(f.hrtime){const t=f.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const m={debug:a&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},g={enabled:!0,level:0};function y(){}const b={},v={once:!0};function w(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}class _{constructor({id:e}={id:""}){this.id=e,this.VERSION=i,this._startTs=d(),this._deltaTs=d(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new o("__probe-".concat(this.id,"__"),g),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((d()-this._startTs).toPrecision(10))}getDelta(){return Number((d()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){l(e,t)}warn(e){return this._getLogFunction(0,e,m.warn,arguments,v)}error(e){return this._getLogFunction(0,e,m.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,m.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,m.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,m.debug||m.info,arguments,v)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||y,r&&[r],{tag:w(t)}):y}image({logLevel:e,priority:t,image:n,message:i="",scale:o=1}){return this._shouldLog(e||t)?a?function({image:e,message:t="",scale:r=1}){if("string"==typeof e){const n=new Image;return n.onload=()=>{const e=s(n,t,r);console.log(...e)},n.src=e,y}const n=e.nodeName||"";if("img"===n.toLowerCase())return console.log(...s(e,t,r)),y;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...s(n,t,r)),n.src=e.toDataURL(),y}return y}({image:n,message:i,scale:o}):function({image:e,message:t="",scale:n=1}){let i=null;try{i=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(i)return()=>i(e,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(e=>console.log(e));return y}({image:n,message:i,scale:o}):y}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||y)}group(e,t,r={collapsed:!1}){r=x({logLevel:e,message:t,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(e,t,r={}){return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||y)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=k(e)}_getLogFunction(e,t,r,n=[],i){if(this._shouldLog(e)){i=x({logLevel:e,message:t,args:n,opts:i}),l(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=d();const o=i.tag||i.message;if(i.once){if(b[o])return y;b[o]=d()}return t=function(e,t,r){if("string"==typeof t){const s=r.time?function(e,t=8){const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,o=r.background,a||"string"!=typeof n||(i&&(i=c(i),n="[".concat(i,"m").concat(n,"[39m")),o&&(i=c(o),n="[".concat(o+10,"m").concat(n,"[49m"))),t=n}var n,i,o;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return y}}function k(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return l(Number.isFinite(t)&&t>=0),t}function x(e){const{logLevel:t,message:r}=e;e.logLevel=k(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(e.args=n,typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return l("string"===i||"object"===i),Object.assign(e,e.opts)}_.VERSION=i}]);
|
|
292
|
+
var n=r(0).inherits,i=r(210).Transform,a=r(232),o=r(62),s=function(e){if(!(this instanceof s))return new s(e);e=this.options=o.defaults(e,{}),i.call(this,e),this.supports={directory:!0,symlink:!0},this.files=[]};n(s,i),s.prototype._transform=function(e,t,r){r(null,e)},s.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)},s.prototype.append=function(e,t,r){var n=this;function i(e,i){e?r(e):(t.size=i.length||0,t.crc32=a.unsigned(i),n.files.push(t),r(null,t))}t.crc32=0,"buffer"===t.sourceType?i(null,e):"stream"===t.sourceType&&o.collectStream(e,i)},s.prototype.finalize=function(){this._writeStringified(),this.end()},e.exports=s},function(e,t,r){const n=r(78).get,i=r(78).set,a=r(78).has,o=r(78).isUndefined,s=(e,t,r)=>{const s=Object.keys(t).reduce((r,s)=>{const u=Array.isArray(t[s].path)?t[s].path.filter(t=>a(e,t))[0]:t[s].path,c=u?n(e,u):void 0;return((e,t,r,n,a)=>{const s=e[t].default,u=e[t].transform,c=e[t].omitValues||[];let l=u?u(r,n,a):r;return o(l)&&!o(s)&&(l=s),-1==c.indexOf(l)?i(Object.assign({},n),t,l):n})(t,s,c,r,e)},{});return r?r(s,e):s},u=(e,t,r)=>Array.isArray(e)?((e,t,r)=>e.map(e=>{const n=u(e,t);return r?r(n,e):n}))(e,t,r):s(e,t,r);e.exports=u},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){function r(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}r.keys=function(){return[]},r.resolve=r,e.exports=r,r.id=533},function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"filename",(function(){return no})),r.d(n,"dirname",(function(){return io})),r.d(n,"join",(function(){return ao}));var i={};r.r(i),r.d(i,"readdir",(function(){return so})),r.d(i,"stat",(function(){return uo})),r.d(i,"readFile",(function(){return co})),r.d(i,"readFileSync",(function(){return lo})),r.d(i,"writeFile",(function(){return ho})),r.d(i,"writeFileSync",(function(){return po})),r.d(i,"open",(function(){return fo})),r.d(i,"close",(function(){return mo})),r.d(i,"read",(function(){return go})),r.d(i,"fstat",(function(){return yo})),r.d(i,"isSupported",(function(){return bo})),r.d(i,"_readToArrayBuffer",(function(){return vo}));var a={};r.r(a),r.d(a,"name",(function(){return Ag})),r.d(a,"decode",(function(){return Sg}));var o={};r.r(o),r.d(o,"name",(function(){return Rg})),r.d(o,"preprocess",(function(){return Og}));var s={};r.r(s),r.d(s,"name",(function(){return Ig})),r.d(s,"preprocess",(function(){return Pg}));var u={};r.r(u),r.d(u,"name",(function(){return Mg})),r.d(u,"preprocess",(function(){return Fg})),r.d(u,"decode",(function(){return Lg})),r.d(u,"encode",(function(){return Ng}));var c={};r.r(c),r.d(c,"name",(function(){return Vg})),r.d(c,"decode",(function(){return Qg}));var l={};r.r(l),r.d(l,"name",(function(){return Zg})),r.d(l,"decode",(function(){return ey})),r.d(l,"encode",(function(){return ty}));var h={};r.r(h),r.d(h,"name",(function(){return ry})),r.d(h,"decode",(function(){return ny})),r.d(h,"encode",(function(){return iy}));var p={};r.r(p),r.d(p,"name",(function(){return ay})),r.d(p,"decode",(function(){return oy})),r.d(p,"encode",(function(){return sy}));var f={};r.r(f),r.d(f,"name",(function(){return cy})),r.d(f,"decode",(function(){return ly}));var d=r(114);const m="object"!=typeof process||"[object process]"!==String(process)||process.browser,g={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global},y=g.global||g.self||g.window;function b(e,t,r){return t<=e&&e<=r}global["encoding-indexes"]={ibm866:[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,1118,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,1038,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],macintosh:[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]}||{};var v=Math.floor;function w(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function _(e){return 0<=e&&e<=127}var k=_;function x(e){this.tokens=[].slice.call(e),this.tokens.reverse()}x.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.pop());else this.tokens.push(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.shift());else this.tokens.unshift(e)}};function E(e,t){if(e)throw TypeError("Decoder error");return t||65533}function A(e){throw TypeError("The code point "+e+" could not be encoded.")}function S(e){return e=String(e).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(T,e)?T[e]:null}var j=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],T={};j.forEach((function(e){e.encodings.forEach((function(e){e.labels.forEach((function(t){T[t]=e}))}))}));var C,B,R={},O={};function I(e,t){return t&&t[e]||null}function P(e,t){var r=t.indexOf(e);return-1===r?null:r}function D(e){if(!("encoding-indexes"in global))throw Error("Indexes missing. Did you forget to include encoding-indexes.js first?");return global["encoding-indexes"][e]}function M(e,t){if(!(this instanceof M))throw TypeError("Called as a function. Did you forget 'new'?");e=void 0!==e?String(e):"utf-8",t=w(t),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1;var r=S(e);if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!O[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes.js first?");return this._encoding=r,Boolean(t.fatal)&&(this._error_mode="fatal"),Boolean(t.ignoreBOM)&&(this._ignoreBOM=!0),Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase(),this.fatal="fatal"===this._error_mode,this.ignoreBOM=this._ignoreBOM),this}function F(e,t){if(!(this instanceof F))throw TypeError("Called as a function. Did you forget 'new'?");t=w(t),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(t.fatal)?"fatal":"replacement";if(Boolean(t.NONSTANDARD_allowLegacyEncoding)){var r=S(e=void 0!==e?String(e):"utf-8");if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+e);if(!R[r.name])throw Error("Encoder not present. Did you forget to include encoding-indexes.js first?");this._encoding=r}else this._encoding=S("utf-8"),void 0!==e&&"console"in global&&console.warn("TextEncoder constructor called with encoding label, which is ignored.");return Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase()),this}function L(e){var t=e.fatal,r=0,n=0,i=0,a=128,o=191;this.handler=function(e,s){if(-1===s&&0!==i)return i=0,E(t);if(-1===s)return-1;if(0===i){if(b(s,0,127))return s;if(b(s,194,223))i=1,r=31&s;else if(b(s,224,239))224===s&&(a=160),237===s&&(o=159),i=2,r=15&s;else{if(!b(s,240,244))return E(t);240===s&&(a=144),244===s&&(o=143),i=3,r=7&s}return null}if(!b(s,a,o))return r=i=n=0,a=128,o=191,e.prepend(s),E(t);if(a=128,o=191,r=r<<6|63&s,(n+=1)!==i)return null;var u=r;return r=i=n=0,u}}function N(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r,n;b(t,128,2047)?(r=1,n=192):b(t,2048,65535)?(r=2,n=224):b(t,65536,1114111)&&(r=3,n=240);for(var i=[(t>>6*r)+n];r>0;){var a=t>>6*(r-1);i.push(128|63&a),r-=1}return i}}function z(e,t){var r=t.fatal;this.handler=function(t,n){if(-1===n)return-1;if(_(n))return n;var i=e[n-128];return null===i?E(r):i}}function U(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(k(r))return r;var n=P(r,e);return null===n&&A(r),n+128}}function q(e){var t=e.fatal,r=0,n=0,i=0;this.handler=function(e,a){if(-1===a&&0===r&&0===n&&0===i)return-1;var o;if(-1!==a||0===r&&0===n&&0===i||(r=0,n=0,i=0,E(t)),0!==i){o=null,b(a,48,57)&&(o=function(e){if(e>39419&&e<189e3||e>1237575)return null;if(7457===e)return 59335;var t,r=0,n=0,i=D("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[0]<=e))break;r=a[0],n=a[1]}return n+e-r}(10*(126*(10*(r-129)+n-48)+i-129)+a-48));var s=[n,i,a];return r=0,n=0,i=0,null===o?(e.prepend(s),E(t)):o}if(0!==n)return b(a,129,254)?(i=a,null):(e.prepend([n,a]),r=0,n=0,E(t));if(0!==r){if(b(a,48,57))return n=a,null;var u=r,c=null;r=0;var l=a<127?64:65;return(b(a,64,126)||b(a,128,254))&&(c=190*(u-129)+(a-l)),null===(o=null===c?null:I(c,D("gb18030")))&&_(a)&&e.prepend(a),null===o?E(t):o}return _(a)?a:128===a?8364:b(a,129,254)?(r=a,null):E(t)}}function H(e,t){e.fatal;this.handler=function(e,r){if(-1===r)return-1;if(k(r))return r;if(58853===r)return A(r);if(t&&8364===r)return 128;var n=P(r,D("gb18030"));if(null!==n){var i=n%190;return[v(n/190)+129,i+(i<63?64:65)]}if(t)return A(r);n=function(e){if(59335===e)return 7457;var t,r=0,n=0,i=D("gb18030-ranges");for(t=0;t<i.length;++t){var a=i[t];if(!(a[1]<=e))break;r=a[1],n=a[0]}return n+e-r}(r);var a=v(n/10/126/10),o=v((n-=10*a*126*10)/10/126),s=v((n-=10*o*126)/10);return[a+129,o+48,s+129,n-10*s+48]}}function G(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:98;switch((b(n,64,126)||b(n,161,254))&&(a=157*(i-129)+(n-o)),a){case 1133:return[202,772];case 1135:return[202,780];case 1164:return[234,772];case 1166:return[234,780]}var s=null===a?null:I(a,D("big5"));return null===s&&_(n)&&e.prepend(n),null===s?E(t):s}return _(n)?n:b(n,129,254)?(r=n,null):E(t)}}function V(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r=function(e){var t=B=B||D("big5").map((function(e,t){return t<5024?null:e}));return 9552===e||9566===e||9569===e||9578===e||21313===e||21317===e?t.lastIndexOf(e):P(e,t)}(t);if(null===r)return A(t);var n=v(r/157)+129;if(n<161)return A(t);var i=r%157;return[n,i+(i<63?64:98)]}}function W(e){var t=e.fatal,r=!1,n=0;this.handler=function(e,i){if(-1===i&&0!==n)return n=0,E(t);if(-1===i&&0===n)return-1;if(142===n&&b(i,161,223))return n=0,65216+i;if(143===n&&b(i,161,254))return r=!0,n=i,null;if(0!==n){var a=n;n=0;var o=null;return b(a,161,254)&&b(i,161,254)&&(o=I(94*(a-161)+(i-161),D(r?"jis0212":"jis0208"))),r=!1,b(i,161,254)||e.prepend(i),null===o?E(t):o}return _(i)?i:142===i||143===i||b(i,161,254)?(n=i,null):E(t)}}function K(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;if(165===t)return 92;if(8254===t)return 126;if(b(t,65377,65439))return[142,t-65377+161];8722===t&&(t=65293);var r=P(t,D("jis0208"));return null===r?A(t):[v(r/94)+161,r%94+161]}}function J(e){var t=e.fatal,r=0,n=1,i=2,a=3,o=4,s=5,u=6,c=r,l=r,h=0,p=!1;this.handler=function(e,f){switch(c){default:case r:return 27===f?(c=s,null):b(f,0,127)&&14!==f&&15!==f&&27!==f?(p=!1,f):-1===f?-1:(p=!1,E(t));case n:return 27===f?(c=s,null):92===f?(p=!1,165):126===f?(p=!1,8254):b(f,0,127)&&14!==f&&15!==f&&27!==f&&92!==f&&126!==f?(p=!1,f):-1===f?-1:(p=!1,E(t));case i:return 27===f?(c=s,null):b(f,33,95)?(p=!1,65344+f):-1===f?-1:(p=!1,E(t));case a:return 27===f?(c=s,null):b(f,33,126)?(p=!1,h=f,c=o,null):-1===f?-1:(p=!1,E(t));case o:if(27===f)return c=s,E(t);if(b(f,33,126)){c=a;var d=I(94*(h-33)+f-33,D("jis0208"));return null===d?E(t):d}return-1===f?(c=a,e.prepend(f),E(t)):(c=a,E(t));case s:return 36===f||40===f?(h=f,c=u,null):(e.prepend(f),p=!1,c=l,E(t));case u:var m=h;h=0;var g=null;if(40===m&&66===f&&(g=r),40===m&&74===f&&(g=n),40===m&&73===f&&(g=i),36!==m||64!==f&&66!==f||(g=a),null!==g){c=c=g;var y=p;return p=!0,y?E(t):null}return e.prepend([m,f]),p=!1,c=l,E(t)}}}function Q(e){e.fatal;var t=0,r=1,n=2,i=t;this.handler=function(e,a){if(-1===a&&i!==t)return e.prepend(a),i=t,[27,40,66];if(-1===a&&i===t)return-1;if(!(i!==t&&i!==r||14!==a&&15!==a&&27!==a))return A(65533);if(i===t&&k(a))return a;if(i===r&&(k(a)&&92!==a&&126!==a||165==a||8254==a)){if(k(a))return a;if(165===a)return 92;if(8254===a)return 126}if(k(a)&&i!==t)return e.prepend(a),i=t,[27,40,66];if((165===a||8254===a)&&i!==r)return e.prepend(a),i=r,[27,40,74];8722===a&&(a=65293);var o=P(a,D("jis0208"));return null===o?A(a):i!==n?(e.prepend(a),i=n,[27,36,66]):[v(o/94)+33,o%94+33]}}function Y(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0;var o=n<127?64:65,s=i<160?129:193;if((b(n,64,126)||b(n,128,252))&&(a=188*(i-s)+n-o),b(a,8836,10715))return 48508+a;var u=null===a?null:I(a,D("jis0208"));return null===u&&_(n)&&e.prepend(n),null===u?E(t):u}return _(n)||128===n?n:b(n,161,223)?65216+n:b(n,129,159)||b(n,224,252)?(r=n,null):E(t)}}function $(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t)||128===t)return t;if(165===t)return 92;if(8254===t)return 126;if(b(t,65377,65439))return t-65377+161;8722===t&&(t=65293);var r=function(e){return(C=C||D("jis0208").map((function(e,t){return b(t,8272,8835)?null:e}))).indexOf(e)}(t);if(null===r)return A(t);var n=v(r/188),i=r%188;return[n+(n<31?129:193),i+(i<63?64:65)]}}function X(e){var t=e.fatal,r=0;this.handler=function(e,n){if(-1===n&&0!==r)return r=0,E(t);if(-1===n&&0===r)return-1;if(0!==r){var i=r,a=null;r=0,b(n,65,254)&&(a=190*(i-129)+(n-65));var o=null===a?null:I(a,D("euc-kr"));return null===a&&_(n)&&e.prepend(n),null===o?E(t):o}return _(n)?n:b(n,129,254)?(r=n,null):E(t)}}function Z(e){e.fatal;this.handler=function(e,t){if(-1===t)return-1;if(k(t))return t;var r=P(t,D("euc-kr"));return null===r?A(t):[v(r/190)+129,r%190+65]}}function ee(e,t){var r=e>>8,n=255&e;return t?[r,n]:[n,r]}function te(e,t){var r=t.fatal,n=null,i=null;this.handler=function(t,a){if(-1===a&&(null!==n||null!==i))return E(r);if(-1===a&&null===n&&null===i)return-1;if(null===n)return n=a,null;var o;if(o=e?(n<<8)+a:(a<<8)+n,n=null,null!==i){var s=i;return i=null,b(o,56320,57343)?65536+1024*(s-55296)+(o-56320):(t.prepend(ee(o,e)),E(r))}return b(o,55296,56319)?(i=o,null):b(o,56320,57343)?E(r):o}}function re(e,t){t.fatal;this.handler=function(t,r){if(-1===r)return-1;if(b(r,0,65535))return ee(r,e);var n=ee(55296+(r-65536>>10),e),i=ee(56320+(r-65536&1023),e);return n.concat(i)}}function ne(e){e.fatal;this.handler=function(e,t){return-1===t?-1:_(t)?t:63360+t-128}}function ie(e){e.fatal;this.handler=function(e,t){return-1===t?-1:k(t)?t:b(t,63360,63487)?t-63360+128:A(t)}}Object.defineProperty&&(Object.defineProperty(M.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(M.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(M.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),M.prototype.decode=function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=w(t),this._do_not_flush||(this._decoder=O[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(t.stream);for(var n,i=new x(r),a=[];;){var o=i.read();if(-1===o)break;if(-1===(n=this._decoder.handler(i,o)))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}if(!this._do_not_flush){do{if(-1===(n=this._decoder.handler(i,i.read())))break;null!==n&&(Array.isArray(n)?a.push.apply(a,n):a.push(n))}while(!i.endOfStream());this._decoder=null}return function(e){var t,r;return t=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===t.indexOf(r)||this._ignoreBOM||this._BOMseen||(e.length>0&&65279===e[0]?(this._BOMseen=!0,e.shift()):e.length>0&&(this._BOMseen=!0)),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>10),56320+(1023&n)))}return t}(e)}.call(this,a)},Object.defineProperty&&Object.defineProperty(F.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),F.prototype.encode=function(e,t){e=void 0===e?"":String(e),t=w(t),this._do_not_flush||(this._encoder=R[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(t.stream);for(var r,n=new x(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)i.push(a);else if(56320<=a&&a<=57343)i.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)i.push(65533);else{var o=t.charCodeAt(n+1);if(56320<=o&&o<=57343){var s=1023&a,u=1023&o;i.push(65536+(s<<10)+u),n+=1}else i.push(65533)}n+=1}return i}(e)),i=[];;){var a=n.read();if(-1===a)break;if(-1===(r=this._encoder.handler(n,a)))break;Array.isArray(r)?i.push.apply(i,r):i.push(r)}if(!this._do_not_flush){for(;-1!==(r=this._encoder.handler(n,n.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);this._encoder=null}return new Uint8Array(i)},R["UTF-8"]=function(e){return new N(e)},O["UTF-8"]=function(e){return new L(e)},"encoding-indexes"in global&&j.forEach((function(e){"Legacy single-byte encodings"===e.heading&&e.encodings.forEach((function(e){var t=e.name,r=D(t.toLowerCase());O[t]=function(e){return new z(r,e)},R[t]=function(e){return new U(r,e)}}))})),O.GBK=function(e){return new q(e)},R.GBK=function(e){return new H(e,!0)},R.gb18030=function(e){return new H(e)},O.gb18030=function(e){return new q(e)},R.Big5=function(e){return new V(e)},O.Big5=function(e){return new G(e)},R["EUC-JP"]=function(e){return new K(e)},O["EUC-JP"]=function(e){return new W(e)},R["ISO-2022-JP"]=function(e){return new Q(e)},O["ISO-2022-JP"]=function(e){return new J(e)},R.Shift_JIS=function(e){return new $(e)},O.Shift_JIS=function(e){return new Y(e)},R["EUC-KR"]=function(e){return new Z(e)},O["EUC-KR"]=function(e){return new X(e)},R["UTF-16BE"]=function(e){return new re(!0,e)},O["UTF-16BE"]=function(e){return new te(!0,e)},R["UTF-16LE"]=function(e){return new re(!1,e)},O["UTF-16LE"]=function(e){return new te(!1,e)},R["x-user-defined"]=function(e){return new ie(e)},O["x-user-defined"]=function(e){return new ne(e)};function ae(e){return Buffer.from(e).toString("base64")}function oe(e){return Buffer.from(e,"base64").toString("ascii")}let se;se=Symbol.iterator;class ue{constructor(e){var t,r,n;n=void 0,(r="map")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.map={},e instanceof ue?e.forEach((e,t)=>this.append(t,e)):Array.isArray(e)?e.forEach(e=>this.append(e[0],e[1])):e&&Object.getOwnPropertyNames(e).forEach(t=>this.append(t,e[t]))}append(e,t){e=ce(e),t=le(t);const r=this.map[e];this.map[e]=r?`${r}, ${t}`:t}delete(e){delete this.map[ce(e)]}get(e){return e=ce(e),this.has(e)?this.map[e]:null}has(e){return this.map.hasOwnProperty(ce(e))}set(e,t){this.map[ce(e)]=le(t)}forEach(e,t=null){for(const r in this.map)this.map.hasOwnProperty(r)&&(t?e.call(t,this.map[r],r,this):e(this.map[r],r,this))}keys(){const e=[];return this.forEach((function(t,r){e.push(r)})),he(e)}values(){const e=[];return this.forEach((function(t){e.push(t)})),he(e)}entries(){const e=[];return this.forEach((function(t,r){e.push([r,t])})),he(e)}*[se](){yield*this.entries()}}function ce(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function le(e){return"string"!=typeof e&&(e=String(e)),e}function he(e){const t={next(){const t=e.shift();return{done:void 0===t,value:t}}};return t[Symbol.iterator]=function(){return t},t}function pe(e,t){if(!e)throw new Error("@loaders.gl/polyfills assertion "+t)}var fe=r(2),de=r.n(fe),me=r(39),ge=r.n(me),ye=r(50),be=r.n(ye),ve=r(14),we=r.n(ve);function _e(e){if((t=e)&&t instanceof ArrayBuffer)return e;var t;if((e=>e&&e instanceof Buffer)(e)){return new Uint8Array(e).buffer}if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error(`toArrayBuffer(${JSON.stringify(e,null,2).slice(10)})`)}async function ke(e,t){if(!function(e){return e.startsWith("http:")||e.startsWith("https:")}(e)){const t=e.split("?")[0];return await new Promise((e,r)=>{const n=de.a.createReadStream(t,{encoding:null});n.once("readable",()=>e(n)),n.on("error",e=>r(e))})}return await new Promise((r,n)=>{const i=(e.startsWith("https:")?be.a.request:ge.a.request)(function(e,t){const r=(null==t?void 0:t.headers)||{},n={};for(const e of Object.keys(r))n[e.toLowerCase()]=r[e];n["accept-encoding"]=n["accept-encoding"]||"gzip,br,deflate";const i=new URL(e);return{hostname:i.hostname,path:i.pathname,method:"GET",...t,...null==t?void 0:t.fetch,headers:n,port:i.port}}(e,t),e=>r(e));i.on("error",e=>n(e)),i.end()})}async function xe(e){const t=[];return await new Promise((r,n)=>{e.on("error",e=>n(e)),e.on("readable",()=>e.read()),e.on("data",e=>{"string"==typeof e&&n(new Error("Read stream not binary")),t.push(_e(e))}),e.on("end",()=>{const e=function(e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}(t);r(e)})})}var Ee=r(4);function Ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Se=e=>"function"==typeof e,je=e=>(e=>null!==e&&"object"==typeof e)(e)&&Se(e.read)&&Se(e.pipe)&&(e=>"boolean"==typeof e)(e.readable);class Te{constructor(e,t){Ae(this,"ok",void 0),Ae(this,"status",void 0),Ae(this,"statusText",void 0),Ae(this,"headers",void 0),Ae(this,"url",void 0),Ae(this,"bodyUsed",!1),Ae(this,"_body",void 0);const{headers:r,status:n=200,statusText:i="OK",url:a}=t||{};this.url=a,this.ok=200===n,this.status=n,this.statusText=i,this.headers=new ue((null==t?void 0:t.headers)||{}),je(e)?this._body=function(e,t){switch(t.get("content-encoding")){case"br":return e.pipe(we.a.createBrotliDecompress());case"gzip":return e.pipe(we.a.createGunzip());case"deflate":return e.pipe(we.a.createDeflate());default:return e}}(e,r):this._body="string"==typeof e?Ee.Readable.from([(new TextEncoder).encode(e)]):Ee.Readable.from([e||new ArrayBuffer(0)])}get body(){return pe(!this.bodyUsed),pe(je(this._body)),this.bodyUsed=!0,this._body}async arrayBuffer(){if(!je(this._body))return this._body||new ArrayBuffer(0);return await xe(this._body)}async text(){const e=await this.arrayBuffer();return(new TextDecoder).decode(e)}async json(){const e=await this.text();return JSON.parse(e)}async blob(){if("undefined"==typeof Blob)throw new Error("Blob polyfill not installed");return new Blob([await this.arrayBuffer()])}}const Ce=e=>e.startsWith("data:");async function Be(e,t){try{if(Ce(e)){const{arrayBuffer:t,mimeType:r}=function(e){const t=e.indexOf(",");let r,n;return";base64"===e.slice(t-7,t)?(r=Buffer.from(e.slice(t+1),"base64"),n=e.slice(5,t-7).trim()):(r=Buffer.from(decodeURIComponent(e.slice(t+1))),n=e.slice(5,t).trim()),n?n.startsWith(";")&&(n="text/plain"+n):n="text/plain;charset=US-ASCII",{arrayBuffer:_e(r),mimeType:n}}(e);return new Te(t,{headers:{"content-type":r},url:e})}const r={},n=e;e.endsWith(".gz")&&(e=e.slice(0,-3),r["content-encoding"]="gzip");const i=await ke(n,t),a=function(e,t,r={}){const n={};if(t&&t.headers){const e=t.headers;for(const t in e){const r=e[t];n[t.toLowerCase()]=String(r)}}if(!n["content-length"]){const t=function(e){if((e=>e.startsWith("http:")||e.startsWith("https:"))(e))return null;if(Ce(e))return e.length-"data:".length;try{const t=e.split("?")[0];return de.a.statSync(t).size}catch(e){}return null}(e);Number.isFinite(t)&&(n["content-length"]=t)}return Object.assign(n,r),new ue(n)}(e,i,r),{status:o,statusText:s}=function(e){if(e.statusCode)return{status:e.statusCode,statusText:e.statusMessage||"NA"};return{status:200,statusText:"OK"}}(i),u=!t||t.followRedirect||void 0===t.followRedirect;if(o>=300&&o<400&&a.has("location")&&u){const r=function(e,t){if(t.startsWith("http"))return t;const r=new URL(e);return r.pathname=t,r.href}(e,a.get("location"));return await Be(r,t)}return new Te(i,{headers:a,status:o,statusText:s,url:e})}catch(t){return new Te(null,{status:400,statusText:String(t),url:e})}}var Re=r(258),Oe=r.n(Re),Ie=r(63),Pe=r.n(Ie);function De(e,t){const r=function(e,t){const r=t.type?t.type.replace("image/",""):"jpeg",n=Pe()(e.data,[e.width,e.height,4],[4,4*e.width,1],0);return Oe()(n,r,t)}(e,t);return new Promise(e=>{const t=[];r.on("data",e=>t.push(e)),r.on("end",()=>{const r=Buffer.concat(t);e(function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e).buffer}return e}(r))})})}var Me=r(259),Fe=r.n(Me),Le=r(0),Ne=r.n(Le);async function ze(e,t){pe(t,"MIMEType is required to parse image under Node.js");const r=Ne.a.promisify(Fe.a),n=e instanceof Buffer?e:Buffer.from(e),i=await r(n,t),a=[...i.shape],o=4===i.shape.length?i.shape.shift():1;return{shape:a,data:i.data instanceof Buffer?new Uint8Array(i.data):i.data,width:i.shape[0],height:i.shape[1],components:i.shape[2],layers:o}}var Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};function qe(){}var He="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function Ge(e){return"object"==typeof e&&null!==e||"function"==typeof e}var Ve=qe,We=Promise,Ke=Promise.prototype.then,Je=Promise.resolve.bind(We),Qe=Promise.reject.bind(We);function Ye(e){return new We(e)}function $e(e){return Je(e)}function Xe(e){return Qe(e)}function Ze(e,t,r){return Ke.call(e,t,r)}function et(e,t,r){Ze(Ze(e,t,r),void 0,Ve)}function tt(e,t){et(e,t)}function rt(e,t){et(e,void 0,t)}function nt(e,t,r){return Ze(e,t,r)}function it(e){Ze(e,void 0,Ve)}var at=function(){var e=He&&He.queueMicrotask;if("function"==typeof e)return e;var t=$e(void 0);return function(e){return Ze(t,e)}}();function ot(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function st(e,t,r){try{return $e(ot(e,t,r))}catch(e){return Xe(e)}}var ut=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.push=function(e){var t=this._back,r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size},e.prototype.shift=function(){var e=this._front,t=e,r=this._cursor,n=r+1,i=e._elements,a=i[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),i[r]=void 0,a},e.prototype.forEach=function(e){for(var t=this._cursor,r=this._front,n=r._elements;!(t===n.length&&void 0===r._next||t===n.length&&(t=0,0===(n=(r=r._next)._elements).length));)e(n[t]),++t},e.prototype.peek=function(){var e=this._front,t=this._cursor;return e._elements[t]},e}();function ct(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?ft(e):"closed"===t._state?function(e){ft(e),gt(e)}(e):dt(e,t._storedError)}function lt(e,t){return Yn(e._ownerReadableStream,t)}function ht(e){"readable"===e._ownerReadableStream._state?mt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){dt(e,t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function pt(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ft(e){e._closedPromise=Ye((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function dt(e,t){ft(e),mt(e,t)}function mt(e,t){void 0!==e._closedPromise_reject&&(it(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function gt(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}var yt=Ue("[[AbortSteps]]"),bt=Ue("[[ErrorSteps]]"),vt=Ue("[[CancelSteps]]"),wt=Ue("[[PullSteps]]"),_t=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},kt=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function xt(e,t){if(void 0!==e&&("object"!=typeof(r=e)&&"function"!=typeof r))throw new TypeError(t+" is not an object.");var r}function Et(e,t){if("function"!=typeof e)throw new TypeError(t+" is not a function.")}function At(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(t+" is not an object.")}function St(e,t,r){if(void 0===e)throw new TypeError("Parameter "+t+" is required in '"+r+"'.")}function jt(e,t,r){if(void 0===e)throw new TypeError(t+" is required in '"+r+"'.")}function Tt(e){return Number(e)}function Ct(e){return 0===e?0:e}function Bt(e,t){var r=Number.MAX_SAFE_INTEGER,n=Number(e);if(n=Ct(n),!_t(n))throw new TypeError(t+" is not a finite number");if((n=function(e){return Ct(kt(e))}(n))<0||n>r)throw new TypeError(t+" is outside the accepted range of 0 to "+r+", inclusive");return _t(n)&&0!==n?n:0}function Rt(e,t){if(!Jn(e))throw new TypeError(t+" is not a ReadableStream.")}function Ot(e){return new Nt(e)}function It(e,t){e._reader._readRequests.push(t)}function Pt(e,t,r){var n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Dt(e){return e._reader._readRequests.length}function Mt(e){var t=e._reader;return void 0!==t&&!!zt(t)}var Ft,Lt,Nt=function(){function e(e){if(St(e,1,"ReadableStreamDefaultReader"),Rt(e,"First parameter"),Qn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ct(this,e),this._readRequests=new ut}return Object.defineProperty(e.prototype,"closed",{get:function(){return zt(this)?this._closedPromise:Xe(qt("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),zt(this)?void 0===this._ownerReadableStream?Xe(pt("cancel")):lt(this,e):Xe(qt("cancel"))},e.prototype.read=function(){if(!zt(this))return Xe(qt("read"));if(void 0===this._ownerReadableStream)return Xe(pt("read from"));var e,t,r=Ye((function(r,n){e=r,t=n}));return Ut(this,{_chunkSteps:function(t){return e({value:t,done:!1})},_closeSteps:function(){return e({value:void 0,done:!0})},_errorSteps:function(e){return t(e)}}),r},e.prototype.releaseLock=function(){if(!zt(this))throw qt("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ht(this)}},e}();function zt(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function Ut(e,t){var r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[wt](t)}function qt(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}Object.defineProperties(Nt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Nt.prototype,Ue.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0}),"symbol"==typeof Ue.asyncIterator&&((Ft={})[Ue.asyncIterator]=function(){return this},Lt=Ft,Object.defineProperty(Lt,Ue.asyncIterator,{enumerable:!1}));var Ht=function(){function e(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}return e.prototype.next=function(){var e=this,t=function(){return e._nextSteps()};return this._ongoingPromise=this._ongoingPromise?nt(this._ongoingPromise,t,t):t(),this._ongoingPromise},e.prototype.return=function(e){var t=this,r=function(){return t._returnSteps(e)};return this._ongoingPromise?nt(this._ongoingPromise,r,r):r()},e.prototype._nextSteps=function(){var e=this;if(this._isFinished)return Promise.resolve({value:void 0,done:!0});var t,r,n=this._reader;if(void 0===n._ownerReadableStream)return Xe(pt("iterate"));var i=Ye((function(e,n){t=e,r=n}));return Ut(n,{_chunkSteps:function(r){e._ongoingPromise=void 0,at((function(){return t({value:r,done:!1})}))},_closeSteps:function(){e._ongoingPromise=void 0,e._isFinished=!0,ht(n),t({value:void 0,done:!0})},_errorSteps:function(t){e._ongoingPromise=void 0,e._isFinished=!0,ht(n),r(t)}}),i},e.prototype._returnSteps=function(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;var t=this._reader;if(void 0===t._ownerReadableStream)return Xe(pt("finish iterating"));if(!this._preventCancel){var r=lt(t,e);return ht(t),nt(r,(function(){return{value:e,done:!0}}))}return ht(t),$e({value:e,done:!0})},e}(),Gt={next:function(){return Vt(this)?this._asyncIteratorImpl.next():Xe(Wt("next"))},return:function(e){return Vt(this)?this._asyncIteratorImpl.return(e):Xe(Wt("return"))}};function Vt(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl")}function Wt(e){return new TypeError("ReadableStreamAsyncIterator."+e+" can only be used on a ReadableSteamAsyncIterator")}void 0!==Lt&&Object.setPrototypeOf(Gt,Lt);var Kt=Number.isNaN||function(e){return e!=e};function Jt(e){return!!function(e){if("number"!=typeof e)return!1;if(Kt(e))return!1;if(e<0)return!1;return!0}(e)&&e!==1/0}function Qt(e){var t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Yt(e,t,r){if(!Jt(r=Number(r)))throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function $t(e){e._queue=new ut,e._queueTotalSize=0}function Xt(e){return e.slice()}var Zt=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"view",{get:function(){if(!rr(this))throw br("view");return this._view},enumerable:!1,configurable:!0}),e.prototype.respond=function(e){if(!rr(this))throw br("respond");if(St(e,1,"respond"),e=Bt(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");this._view.buffer,function(e,t){if(!Jt(t=Number(t)))throw new RangeError("bytesWritten must be a finite");pr(e,t)}(this._associatedReadableByteStreamController,e)},e.prototype.respondWithNewView=function(e){if(!rr(this))throw br("respondWithNewView");if(St(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");!function(e,t){var r=e._pendingPullIntos.peek();if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,pr(e,t.byteLength)}(this._associatedReadableByteStreamController,e)},e}();Object.defineProperties(Zt.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Zt.prototype,Ue.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});var er=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"byobRequest",{get:function(){if(!tr(this))throw vr("byobRequest");if(null===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos.peek(),t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),r=Object.create(Zt.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(r,this,t),this._byobRequest=r}return this._byobRequest},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!tr(this))throw vr("desiredSize");return gr(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!tr(this))throw vr("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==t._state)return;if(e._queueTotalSize>0)return void(e._closeRequested=!0);if(e._pendingPullIntos.length>0){if(e._pendingPullIntos.peek().bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw mr(e,r),r}}dr(e),$n(t)}(this)},e.prototype.enqueue=function(e){if(!tr(this))throw vr("enqueue");if(St(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");!function(e,t){var r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;var n=t.buffer,i=t.byteOffset,a=t.byteLength,o=n;if(Mt(r))if(0===Dt(r))or(e,o,i,a);else{var s=new Uint8Array(o,i,a);Pt(r,s,!1)}else kr(r)?(or(e,o,i,a),hr(e)):or(e,o,i,a);nr(e)}(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!tr(this))throw vr("error");mr(this,e)},e.prototype[vt]=function(e){this._pendingPullIntos.length>0&&(this._pendingPullIntos.peek().bytesFilled=0);$t(this);var t=this._cancelAlgorithm(e);return dr(this),t},e.prototype[wt]=function(e){var t=this._controlledReadableByteStream;if(this._queueTotalSize>0){var r=this._queue.shift();this._queueTotalSize-=r.byteLength,cr(this);var n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);e._chunkSteps(n)}else{var i=this._autoAllocateChunkSize;if(void 0!==i){var a=void 0;try{a=new ArrayBuffer(i)}catch(t){return void e._errorSteps(t)}var o={buffer:a,byteOffset:0,byteLength:i,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}It(t,e),nr(this)}},e}();function tr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function rr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function nr(e){(function(e){var t=e._controlledReadableByteStream;if("readable"!==t._state)return!1;if(e._closeRequested)return!1;if(!e._started)return!1;if(Mt(t)&&Dt(t)>0)return!0;if(kr(t)&&_r(t)>0)return!0;if(gr(e)>0)return!0;return!1})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,et(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,nr(e))}),(function(t){mr(e,t)}))))}function ir(e,t){var r=!1;"closed"===e._state&&(r=!0);var n=ar(t);"default"===t.readerType?Pt(e,n,r):function(e,t,r){var n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function ar(e){var t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function or(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function sr(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,o=a-a%r,s=i,u=!1;o>n&&(s=o-t.bytesFilled,u=!0);for(var c,l,h,p,f,d=e._queue;s>0;){var m=d.peek(),g=Math.min(s,m.byteLength),y=t.byteOffset+t.bytesFilled;c=t.buffer,l=y,h=m.buffer,p=m.byteOffset,f=g,new Uint8Array(c).set(new Uint8Array(h,p,f),l),m.byteLength===g?d.shift():(m.byteOffset+=g,m.byteLength-=g),e._queueTotalSize-=g,ur(e,g,t),s-=g}return u}function ur(e,t,r){lr(e),r.bytesFilled+=t}function cr(e){0===e._queueTotalSize&&e._closeRequested?(dr(e),$n(e._controlledReadableByteStream)):nr(e)}function lr(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function hr(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos.peek();sr(e,t)&&(fr(e),ir(e._controlledReadableByteStream,t))}}function pr(e,t){var r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=t.buffer;var r=e._controlledReadableByteStream;if(kr(r))for(;_r(r)>0;){ir(r,fr(e))}}(e,r)}else!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(ur(e,t,r),!(r.bytesFilled<r.elementSize)){fr(e);var n=r.bytesFilled%r.elementSize;if(n>0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);or(e,a,0,a.byteLength)}r.buffer=r.buffer,r.bytesFilled-=n,ir(e._controlledReadableByteStream,r),hr(e)}}(e,t,r);nr(e)}function fr(e){var t=e._pendingPullIntos.shift();return lr(e),t}function dr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function mr(e,t){var r=e._controlledReadableByteStream;"readable"===r._state&&(!function(e){lr(e),e._pendingPullIntos=new ut}(e),$t(e),dr(e),Xn(r,t))}function gr(e){var t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function yr(e,t,r){var n=Object.create(er.prototype),i=function(){},a=function(){return $e(void 0)},o=function(){return $e(void 0)};void 0!==t.start&&(i=function(){return t.start(n)}),void 0!==t.pull&&(a=function(){return t.pull(n)}),void 0!==t.cancel&&(o=function(e){return t.cancel(e)});var s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");!function(e,t,r,n,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,$t(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=new ut,e._readableStreamController=t,et($e(r()),(function(){t._started=!0,nr(t)}),(function(e){mr(t,e)}))}(e,n,i,a,o,r,s)}function br(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function vr(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}function wr(e,t){e._reader._readIntoRequests.push(t)}function _r(e){return e._reader._readIntoRequests.length}function kr(e){var t=e._reader;return void 0!==t&&!!Er(t)}Object.defineProperties(er.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(er.prototype,Ue.toStringTag,{value:"ReadableByteStreamController",configurable:!0});var xr=function(){function e(e){if(St(e,1,"ReadableStreamBYOBReader"),Rt(e,"First parameter"),Qn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!tr(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ct(this,e),this._readIntoRequests=new ut}return Object.defineProperty(e.prototype,"closed",{get:function(){return Er(this)?this._closedPromise:Xe(Ar("closed"))},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Er(this)?void 0===this._ownerReadableStream?Xe(pt("cancel")):lt(this,e):Xe(Ar("cancel"))},e.prototype.read=function(e){if(!Er(this))return Xe(Ar("read"));if(!ArrayBuffer.isView(e))return Xe(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return Xe(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return Xe(new TypeError("view's buffer must have non-zero byteLength"));if(void 0===this._ownerReadableStream)return Xe(pt("read from"));var t,r,n=Ye((function(e,n){t=e,r=n}));return function(e,t,r){var n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?r._errorSteps(n._storedError):function(e,t,r){var n=e._controlledReadableByteStream,i=1;t.constructor!==DataView&&(i=t.constructor.BYTES_PER_ELEMENT);var a=t.constructor,o={buffer:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:i,viewConstructor:a,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(o),void wr(n,r);if("closed"!==n._state){if(e._queueTotalSize>0){if(sr(e,o)){var s=ar(o);return cr(e),void r._chunkSteps(s)}if(e._closeRequested){var u=new TypeError("Insufficient bytes to fill elements in the given buffer");return mr(e,u),void r._errorSteps(u)}}e._pendingPullIntos.push(o),wr(n,r),nr(e)}else{var c=new a(o.buffer,o.byteOffset,0);r._closeSteps(c)}}(n._readableStreamController,t,r)}(this,e,{_chunkSteps:function(e){return t({value:e,done:!1})},_closeSteps:function(e){return t({value:e,done:!0})},_errorSteps:function(e){return r(e)}}),n},e.prototype.releaseLock=function(){if(!Er(this))throw Ar("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");ht(this)}},e}();function Er(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function Ar(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function Sr(e,t){var r=e.highWaterMark;if(void 0===r)return t;if(Kt(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function jr(e){var t=e.size;return t||function(){return 1}}function Tr(e,t){xt(e,t);var r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Tt(r),size:void 0===n?void 0:Cr(n,t+" has member 'size' that")}}function Cr(e,t){return Et(e,t),function(t){return Tt(e(t))}}function Br(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function Rr(e,t,r){return Et(e,r),function(){return st(e,t,[])}}function Or(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function Ir(e,t,r){return Et(e,r),function(r,n){return st(e,t,[r,n])}}function Pr(e,t){if(!Lr(e))throw new TypeError(t+" is not a WritableStream.")}Object.defineProperties(xr.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(xr.prototype,Ue.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});var Dr=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:At(e,"First parameter");var r=Tr(t,"Second parameter"),n=function(e,t){xt(e,t);var r=null==e?void 0:e.abort,n=null==e?void 0:e.close,i=null==e?void 0:e.start,a=null==e?void 0:e.type,o=null==e?void 0:e.write;return{abort:void 0===r?void 0:Br(r,e,t+" has member 'abort' that"),close:void 0===n?void 0:Rr(n,e,t+" has member 'close' that"),start:void 0===i?void 0:Or(i,e,t+" has member 'start' that"),write:void 0===o?void 0:Ir(o,e,t+" has member 'write' that"),type:a}}(e,"First parameter");if(Fr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");var i=jr(r);!function(e,t,r,n){var i=Object.create(rn.prototype),a=function(){},o=function(){return $e(void 0)},s=function(){return $e(void 0)},u=function(){return $e(void 0)};void 0!==t.start&&(a=function(){return t.start(i)});void 0!==t.write&&(o=function(e){return t.write(e,i)});void 0!==t.close&&(s=function(){return t.close()});void 0!==t.abort&&(u=function(e){return t.abort(e)});nn(e,i,a,o,s,u,r,n)}(this,n,Sr(r,1),i)}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Lr(this))throw hn("locked");return Nr(this)},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Lr(this)?Nr(this)?Xe(new TypeError("Cannot abort a stream that already has a writer")):zr(this,e):Xe(hn("abort"))},e.prototype.close=function(){return Lr(this)?Nr(this)?Xe(new TypeError("Cannot close a stream that already has a writer")):Vr(this)?Xe(new TypeError("Cannot close an already-closing stream")):Ur(this):Xe(hn("close"))},e.prototype.getWriter=function(){if(!Lr(this))throw hn("getWriter");return Mr(this)},e}();function Mr(e){return new Jr(e)}function Fr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ut,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Lr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function Nr(e){return void 0!==e._writer}function zr(e,t){var r=e._state;if("closed"===r||"errored"===r)return $e(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;var n=!1;"erroring"===r&&(n=!0,t=void 0);var i=Ye((function(r,i){e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:i,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||Hr(e,t),i}function Ur(e){var t=e._state;if("closed"===t||"errored"===t)return Xe(new TypeError("The stream (in "+t+" state) is not in the writable state and cannot be closed"));var r,n=Ye((function(t,r){var n={_resolve:t,_reject:r};e._closeRequest=n})),i=e._writer;return void 0!==i&&e._backpressure&&"writable"===t&&kn(i),Yt(r=e._writableStreamController,tn,0),sn(r),n}function qr(e,t){"writable"!==e._state?Gr(e):Hr(e,t)}function Hr(e,t){var r=e._writableStreamController;e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&Xr(n,t),!function(e){if(void 0===e._inFlightWriteRequest&&void 0===e._inFlightCloseRequest)return!1;return!0}(e)&&r._started&&Gr(e)}function Gr(e){e._state="errored",e._writableStreamController[bt]();var t=e._storedError;if(e._writeRequests.forEach((function(e){e._reject(t)})),e._writeRequests=new ut,void 0!==e._pendingAbortRequest){var r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Wr(e);et(e._writableStreamController[yt](r._reason),(function(){r._resolve(),Wr(e)}),(function(t){r._reject(t),Wr(e)}))}else Wr(e)}function Vr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Wr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&gn(t,e._storedError)}function Kr(e,t){var r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){bn(e)}(r):kn(r)),e._backpressure=t}Object.defineProperties(Dr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Dr.prototype,Ue.toStringTag,{value:"WritableStream",configurable:!0});var Jr=function(){function e(e){if(St(e,1,"WritableStreamDefaultWriter"),Pr(e,"First parameter"),Nr(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;var t,r=e._state;if("writable"===r)!Vr(e)&&e._backpressure?bn(this):wn(this),dn(this);else if("erroring"===r)vn(this,e._storedError),dn(this);else if("closed"===r)wn(this),dn(t=this),yn(t);else{var n=e._storedError;vn(this,n),mn(this,n)}}return Object.defineProperty(e.prototype,"closed",{get:function(){return Qr(this)?this._closedPromise:Xe(pn("closed"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Qr(this))throw pn("desiredSize");if(void 0===this._ownerWritableStream)throw fn("desiredSize");return function(e){var t=e._ownerWritableStream,r=t._state;if("errored"===r||"erroring"===r)return null;if("closed"===r)return 0;return on(t._writableStreamController)}(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ready",{get:function(){return Qr(this)?this._readyPromise:Xe(pn("ready"))},enumerable:!1,configurable:!0}),e.prototype.abort=function(e){return void 0===e&&(e=void 0),Qr(this)?void 0===this._ownerWritableStream?Xe(fn("abort")):function(e,t){return zr(e._ownerWritableStream,t)}(this,e):Xe(pn("abort"))},e.prototype.close=function(){if(!Qr(this))return Xe(pn("close"));var e=this._ownerWritableStream;return void 0===e?Xe(fn("close")):Vr(e)?Xe(new TypeError("Cannot close an already-closing stream")):Yr(this)},e.prototype.releaseLock=function(){if(!Qr(this))throw pn("releaseLock");void 0!==this._ownerWritableStream&&Zr(this)},e.prototype.write=function(e){return void 0===e&&(e=void 0),Qr(this)?void 0===this._ownerWritableStream?Xe(fn("write to")):en(this,e):Xe(pn("write"))},e}();function Qr(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function Yr(e){return Ur(e._ownerWritableStream)}function $r(e,t){"pending"===e._closedPromiseState?gn(e,t):function(e,t){mn(e,t)}(e,t)}function Xr(e,t){"pending"===e._readyPromiseState?_n(e,t):function(e,t){vn(e,t)}(e,t)}function Zr(e){var t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Xr(e,r),$r(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function en(e,t){var r=e._ownerWritableStream,n=r._writableStreamController,i=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return un(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Xe(fn("write to"));var a=r._state;if("errored"===a)return Xe(r._storedError);if(Vr(r)||"closed"===a)return Xe(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Xe(r._storedError);var o=function(e){return Ye((function(t,r){var n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{Yt(e,t,r)}catch(t){return void un(e,t)}var n=e._controlledWritableStream;if(!Vr(n)&&"writable"===n._state){var i=cn(e);Kr(n,i)}sn(e)}(n,t,i),o}Object.defineProperties(Jr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Jr.prototype,Ue.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});var tn={},rn=function(){function e(){throw new TypeError("Illegal constructor")}return e.prototype.error=function(e){if(void 0===e&&(e=void 0),!function(e){if(!Ge(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream"))return!1;return!0}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&ln(this,e)},e.prototype[yt]=function(e){var t=this._abortAlgorithm(e);return an(this),t},e.prototype[bt]=function(){$t(this)},e}();function nn(e,t,r,n,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,$t(t),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=i,t._abortAlgorithm=a;var u=cn(t);Kr(e,u),et($e(r()),(function(){t._started=!0,sn(t)}),(function(r){t._started=!0,qr(e,r)}))}function an(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function on(e){return e._strategyHWM-e._queueTotalSize}function sn(e){var t=e._controlledWritableStream;if(e._started&&void 0===t._inFlightWriteRequest)if("erroring"!==t._state){if(0!==e._queue.length){var r=e._queue.peek().value;r===tn?function(e){var t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Qt(e);var r=e._closeAlgorithm();an(e),et(r,(function(){!function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var t=e._writer;void 0!==t&&yn(t)}(t)}),(function(e){!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),qr(e,t)}(t,e)}))}(e):function(e,t){var r=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(r),et(e._writeAlgorithm(t),(function(){!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);var t=r._state;if(Qt(e),!Vr(r)&&"writable"===t){var n=cn(e);Kr(r,n)}sn(e)}),(function(t){"writable"===r._state&&an(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,qr(e,t)}(r,t)}))}(e,r)}}else Gr(t)}function un(e,t){"writable"===e._controlledWritableStream._state&&ln(e,t)}function cn(e){return on(e)<=0}function ln(e,t){var r=e._controlledWritableStream;an(e),Hr(r,t)}function hn(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function pn(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function fn(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function dn(e){e._closedPromise=Ye((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function mn(e,t){dn(e),gn(e,t)}function gn(e,t){void 0!==e._closedPromise_reject&&(it(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function yn(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function bn(e){e._readyPromise=Ye((function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function vn(e,t){bn(e),_n(e,t)}function wn(e){bn(e),kn(e)}function _n(e,t){void 0!==e._readyPromise_reject&&(it(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function kn(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(rn.prototype,{error:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(rn.prototype,Ue.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});var xn="undefined"!=typeof DOMException?DOMException:void 0;var En,An=function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;try{return new e,!0}catch(e){return!1}}(xn)?xn:((En=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}).prototype=Object.create(Error.prototype),Object.defineProperty(En.prototype,"constructor",{value:En,writable:!0,configurable:!0}),En);function Sn(e,t,r,n,i,a){var o=Ot(e),s=Mr(t);e._disturbed=!0;var u=!1,c=$e(void 0);return Ye((function(l,h){var p,f,d,m;if(void 0!==a){if(p=function(){var r=new An("Aborted","AbortError"),a=[];n||a.push((function(){return"writable"===t._state?zr(t,r):$e(void 0)})),i||a.push((function(){return"readable"===e._state?Yn(e,r):$e(void 0)})),v((function(){return Promise.all(a.map((function(e){return e()})))}),!0,r)},a.aborted)return void p();a.addEventListener("abort",p)}if(b(e,o._closedPromise,(function(e){n?w(!0,e):v((function(){return zr(t,e)}),!0,e)})),b(t,s._closedPromise,(function(t){i?w(!0,t):v((function(){return Yn(e,t)}),!0,t)})),f=e,d=o._closedPromise,m=function(){r?w():v((function(){return function(e){var t=e._ownerWritableStream,r=t._state;return Vr(t)||"closed"===r?$e(void 0):"errored"===r?Xe(t._storedError):Yr(e)}(s)}))},"closed"===f._state?m():tt(d,m),Vr(t)||"closed"===t._state){var g=new TypeError("the destination writable stream closed before all data could be piped to it");i?w(!0,g):v((function(){return Yn(e,g)}),!0,g)}function y(){var e=c;return Ze(c,(function(){return e!==c?y():void 0}))}function b(e,t,r){"errored"===e._state?r(e._storedError):rt(t,r)}function v(e,r,n){function i(){et(e(),(function(){return _(r,n)}),(function(e){return _(!0,e)}))}u||(u=!0,"writable"!==t._state||Vr(t)?i():tt(y(),i))}function w(e,r){u||(u=!0,"writable"!==t._state||Vr(t)?_(e,r):tt(y(),(function(){return _(e,r)})))}function _(e,t){Zr(s),ht(o),void 0!==a&&a.removeEventListener("abort",p),e?h(t):l(void 0)}it(Ye((function(e,t){!function r(n){n?e():Ze(u?$e(!0):Ze(s._readyPromise,(function(){return Ye((function(e,t){Ut(o,{_chunkSteps:function(t){c=Ze(en(s,t),void 0,qe),e(!1)},_closeSteps:function(){return e(!0)},_errorSteps:t})}))})),r,t)}(!1)})))}))}var jn=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!Tn(this))throw Ln("desiredSize");return Dn(this)},enumerable:!1,configurable:!0}),e.prototype.close=function(){if(!Tn(this))throw Ln("close");if(!Mn(this))throw new TypeError("The stream is not in a state that permits close");On(this)},e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!Tn(this))throw Ln("enqueue");if(!Mn(this))throw new TypeError("The stream is not in a state that permits enqueue");return In(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!Tn(this))throw Ln("error");Pn(this,e)},e.prototype[vt]=function(e){$t(this);var t=this._cancelAlgorithm(e);return Rn(this),t},e.prototype[wt]=function(e){var t=this._controlledReadableStream;if(this._queue.length>0){var r=Qt(this);this._closeRequested&&0===this._queue.length?(Rn(this),$n(t)):Cn(this),e._chunkSteps(r)}else It(t,e),Cn(this)},e}();function Tn(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function Cn(e){Bn(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,et(e._pullAlgorithm(),(function(){e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Cn(e))}),(function(t){Pn(e,t)}))))}function Bn(e){var t=e._controlledReadableStream;return!!Mn(e)&&(!!e._started&&(!!(Qn(t)&&Dt(t)>0)||Dn(e)>0))}function Rn(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function On(e){if(Mn(e)){var t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Rn(e),$n(t))}}function In(e,t){if(Mn(e)){var r=e._controlledReadableStream;if(Qn(r)&&Dt(r)>0)Pt(r,t,!1);else{var n=void 0;try{n=e._strategySizeAlgorithm(t)}catch(t){throw Pn(e,t),t}try{Yt(e,t,n)}catch(t){throw Pn(e,t),t}}Cn(e)}}function Pn(e,t){var r=e._controlledReadableStream;"readable"===r._state&&($t(e),Rn(e),Xn(r,t))}function Dn(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Mn(e){var t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Fn(e,t,r,n,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,$t(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,e._readableStreamController=t,et($e(r()),(function(){t._started=!0,Cn(t)}),(function(e){Pn(t,e)}))}function Ln(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function Nn(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function zn(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function Un(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function qn(e,t){if("bytes"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamType");return e}function Hn(e,t){if("byob"!==(e=""+e))throw new TypeError(t+" '"+e+"' is not a valid enumeration value for ReadableStreamReaderMode");return e}function Gn(e,t){xt(e,t);var r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,i=null==e?void 0:e.preventClose,a=null==e?void 0:e.signal;return void 0!==a&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(t+" is not an AbortSignal.")}(a,t+" has member 'signal' that"),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(i),signal:a}}Object.defineProperties(jn.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(jn.prototype,Ue.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});var Vn=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),void 0===e?e=null:At(e,"First parameter");var r=Tr(t,"Second parameter"),n=function(e,t){xt(e,t);var r=e,n=null==r?void 0:r.autoAllocateChunkSize,i=null==r?void 0:r.cancel,a=null==r?void 0:r.pull,o=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Bt(n,t+" has member 'autoAllocateChunkSize' that"),cancel:void 0===i?void 0:Nn(i,r,t+" has member 'cancel' that"),pull:void 0===a?void 0:zn(a,r,t+" has member 'pull' that"),start:void 0===o?void 0:Un(o,r,t+" has member 'start' that"),type:void 0===s?void 0:qn(s,t+" has member 'type' that")}}(e,"First parameter");if(Kn(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");yr(this,n,Sr(r,0))}else{var i=jr(r);!function(e,t,r,n){var i=Object.create(jn.prototype),a=function(){},o=function(){return $e(void 0)},s=function(){return $e(void 0)};void 0!==t.start&&(a=function(){return t.start(i)}),void 0!==t.pull&&(o=function(){return t.pull(i)}),void 0!==t.cancel&&(s=function(e){return t.cancel(e)}),Fn(e,i,a,o,s,r,n)}(this,n,Sr(r,1),i)}}return Object.defineProperty(e.prototype,"locked",{get:function(){if(!Jn(this))throw Zn("locked");return Qn(this)},enumerable:!1,configurable:!0}),e.prototype.cancel=function(e){return void 0===e&&(e=void 0),Jn(this)?Qn(this)?Xe(new TypeError("Cannot cancel a stream that already has a reader")):Yn(this,e):Xe(Zn("cancel"))},e.prototype.getReader=function(e){if(void 0===e&&(e=void 0),!Jn(this))throw Zn("getReader");return void 0===function(e,t){xt(e,t);var r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Hn(r,t+" has member 'mode' that")}}(e,"First parameter").mode?Ot(this):new xr(this)},e.prototype.pipeThrough=function(e,t){if(void 0===t&&(t={}),!Jn(this))throw Zn("pipeThrough");St(e,1,"pipeThrough");var r=function(e,t){xt(e,t);var r=null==e?void 0:e.readable;jt(r,"readable","ReadableWritablePair"),Rt(r,t+" has member 'readable' that");var n=null==e?void 0:e.writable;return jt(n,"writable","ReadableWritablePair"),Pr(n,t+" has member 'writable' that"),{readable:r,writable:n}}(e,"First parameter"),n=Gn(t,"Second parameter");if(Qn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Nr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return it(Sn(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable},e.prototype.pipeTo=function(e,t){if(void 0===t&&(t={}),!Jn(this))return Xe(Zn("pipeTo"));if(void 0===e)return Xe("Parameter 1 is required in 'pipeTo'.");if(!Lr(e))return Xe(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));var r;try{r=Gn(t,"Second parameter")}catch(e){return Xe(e)}return Qn(this)?Xe(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Nr(e)?Xe(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Sn(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)},e.prototype.tee=function(){if(!Jn(this))throw Zn("tee");var e=function(e,t){var r,n,i,a,o,s=Ot(e),u=!1,c=!1,l=!1,h=Ye((function(e){o=e}));function p(){return u||(u=!0,Ut(s,{_chunkSteps:function(e){at((function(){u=!1;var t=e,r=e;c||In(i._readableStreamController,t),l||In(a._readableStreamController,r)}))},_closeSteps:function(){u=!1,c||On(i._readableStreamController),l||On(a._readableStreamController),c&&l||o(void 0)},_errorSteps:function(){u=!1}})),$e(void 0)}function f(){}return i=Wn(f,p,(function(t){if(c=!0,r=t,l){var i=Xt([r,n]),a=Yn(e,i);o(a)}return h})),a=Wn(f,p,(function(t){if(l=!0,n=t,c){var i=Xt([r,n]),a=Yn(e,i);o(a)}return h})),rt(s._closedPromise,(function(e){Pn(i._readableStreamController,e),Pn(a._readableStreamController,e),c&&l||o(void 0)})),[i,a]}(this);return Xt(e)},e.prototype.values=function(e){if(void 0===e&&(e=void 0),!Jn(this))throw Zn("values");var t,r,n,i,a,o=function(e,t){xt(e,t);var r=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(r)}}(e,"First parameter");return t=this,r=o.preventCancel,n=Ot(t),i=new Ht(n,r),(a=Object.create(Gt))._asyncIteratorImpl=i,a},e}();function Wn(e,t,r,n,i){void 0===n&&(n=1),void 0===i&&(i=function(){return 1});var a=Object.create(Vn.prototype);return Kn(a),Fn(a,Object.create(jn.prototype),e,t,r,n,i),a}function Kn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Jn(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function Qn(e){return void 0!==e._reader}function Yn(e,t){return e._disturbed=!0,"closed"===e._state?$e(void 0):"errored"===e._state?Xe(e._storedError):($n(e),nt(e._readableStreamController[vt](t),qe))}function $n(e){e._state="closed";var t=e._reader;void 0!==t&&(gt(t),zt(t)&&(t._readRequests.forEach((function(e){e._closeSteps()})),t._readRequests=new ut))}function Xn(e,t){e._state="errored",e._storedError=t;var r=e._reader;void 0!==r&&(mt(r,t),zt(r)?(r._readRequests.forEach((function(e){e._errorSteps(t)})),r._readRequests=new ut):(r._readIntoRequests.forEach((function(e){e._errorSteps(t)})),r._readIntoRequests=new ut))}function Zn(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function ei(e,t){xt(e,t);var r=null==e?void 0:e.highWaterMark;return jt(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Tt(r)}}Object.defineProperties(Vn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(Vn.prototype,Ue.toStringTag,{value:"ReadableStream",configurable:!0}),"symbol"==typeof Ue.asyncIterator&&Object.defineProperty(Vn.prototype,Ue.asyncIterator,{value:Vn.prototype.values,writable:!0,configurable:!0});var ti=function(e){return e.byteLength},ri=function(){function e(e){St(e,1,"ByteLengthQueuingStrategy"),e=ei(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ii(this))throw ni("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ii(this))throw ni("size");return ti},enumerable:!1,configurable:!0}),e}();function ni(e){return new TypeError("ByteLengthQueuingStrategy.prototype."+e+" can only be used on a ByteLengthQueuingStrategy")}function ii(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")}Object.defineProperties(ri.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(ri.prototype,Ue.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});var ai=function(){return 1},oi=function(){function e(e){St(e,1,"CountQueuingStrategy"),e=ei(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}return Object.defineProperty(e.prototype,"highWaterMark",{get:function(){if(!ui(this))throw si("highWaterMark");return this._countQueuingStrategyHighWaterMark},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){if(!ui(this))throw si("size");return ai},enumerable:!1,configurable:!0}),e}();function si(e){return new TypeError("CountQueuingStrategy.prototype."+e+" can only be used on a CountQueuingStrategy")}function ui(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")}function ci(e,t,r){return Et(e,r),function(r){return st(e,t,[r])}}function li(e,t,r){return Et(e,r),function(r){return ot(e,t,[r])}}function hi(e,t,r){return Et(e,r),function(r,n){return st(e,t,[r,n])}}Object.defineProperties(oi.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(oi.prototype,Ue.toStringTag,{value:"CountQueuingStrategy",configurable:!0});var pi=function(){function e(e,t,r){void 0===e&&(e={}),void 0===t&&(t={}),void 0===r&&(r={}),void 0===e&&(e=null);var n=Tr(t,"Second parameter"),i=Tr(r,"Third parameter"),a=function(e,t){xt(e,t);var r=null==e?void 0:e.flush,n=null==e?void 0:e.readableType,i=null==e?void 0:e.start,a=null==e?void 0:e.transform,o=null==e?void 0:e.writableType;return{flush:void 0===r?void 0:ci(r,e,t+" has member 'flush' that"),readableType:n,start:void 0===i?void 0:li(i,e,t+" has member 'start' that"),transform:void 0===a?void 0:hi(a,e,t+" has member 'transform' that"),writableType:o}}(e,"First parameter");if(void 0!==a.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==a.writableType)throw new RangeError("Invalid writableType specified");var o,s=Sr(i,0),u=jr(i),c=Sr(n,1),l=jr(n);!function(e,t,r,n,i,a){function o(){return t}e._writable=function(e,t,r,n,i,a){void 0===i&&(i=1),void 0===a&&(a=function(){return 1});var o=Object.create(Dr.prototype);return Fr(o),nn(o,Object.create(rn.prototype),e,t,r,n,i,a),o}(o,(function(t){return function(e,t){var r=e._transformStreamController;if(e._backpressure){return nt(e._backpressureChangePromise,(function(){var n=e._writable;if("erroring"===n._state)throw n._storedError;return _i(r,t)}))}return _i(r,t)}(e,t)}),(function(){return function(e){var t=e._readable,r=e._transformStreamController,n=r._flushAlgorithm();return vi(r),nt(n,(function(){if("errored"===t._state)throw t._storedError;On(t._readableStreamController)}),(function(r){throw di(e,r),t._storedError}))}(e)}),(function(t){return function(e,t){return di(e,t),$e(void 0)}(e,t)}),r,n),e._readable=Wn(o,(function(){return function(e){return gi(e,!1),e._backpressureChangePromise}(e)}),(function(t){return mi(e,t),$e(void 0)}),i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,gi(e,!0),e._transformStreamController=void 0}(this,Ye((function(e){o=e})),c,l,s,u),function(e,t){var r=Object.create(yi.prototype),n=function(e){try{return wi(r,e),$e(void 0)}catch(e){return Xe(e)}},i=function(){return $e(void 0)};void 0!==t.transform&&(n=function(e){return t.transform(e,r)});void 0!==t.flush&&(i=function(){return t.flush(r)});!function(e,t,r,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n}(e,r,n,i)}(this,a),void 0!==a.start?o(a.start(this._transformStreamController)):o(void 0)}return Object.defineProperty(e.prototype,"readable",{get:function(){if(!fi(this))throw xi("readable");return this._readable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"writable",{get:function(){if(!fi(this))throw xi("writable");return this._writable},enumerable:!1,configurable:!0}),e}();function fi(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function di(e,t){Pn(e._readable._readableStreamController,t),mi(e,t)}function mi(e,t){vi(e._transformStreamController),un(e._writable._writableStreamController,t),e._backpressure&&gi(e,!1)}function gi(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Ye((function(t){e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(pi.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(pi.prototype,Ue.toStringTag,{value:"TransformStream",configurable:!0});var yi=function(){function e(){throw new TypeError("Illegal constructor")}return Object.defineProperty(e.prototype,"desiredSize",{get:function(){if(!bi(this))throw ki("desiredSize");return Dn(this._controlledTransformStream._readable._readableStreamController)},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e){if(void 0===e&&(e=void 0),!bi(this))throw ki("enqueue");wi(this,e)},e.prototype.error=function(e){if(void 0===e&&(e=void 0),!bi(this))throw ki("error");var t;t=e,di(this._controlledTransformStream,t)},e.prototype.terminate=function(){if(!bi(this))throw ki("terminate");!function(e){var t=e._controlledTransformStream;On(t._readable._readableStreamController);var r=new TypeError("TransformStream terminated");mi(t,r)}(this)},e}();function bi(e){return!!Ge(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function vi(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function wi(e,t){var r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Mn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{In(n,t)}catch(e){throw mi(r,e),r._readable._storedError}(function(e){return!Bn(e)})(n)!==r._backpressure&&gi(r,!0)}function _i(e,t){return nt(e._transformAlgorithm(t),void 0,(function(t){throw di(e._controlledTransformStream,t),t}))}function ki(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function xi(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}Object.defineProperties(yi.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),"symbol"==typeof Ue.toStringTag&&Object.defineProperty(yi.prototype,Ue.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Ei={ReadableStream:Vn,ReadableStreamDefaultController:jn,ReadableByteStreamController:er,ReadableStreamBYOBRequest:Zt,ReadableStreamDefaultReader:Nt,ReadableStreamBYOBReader:xr,WritableStream:Dr,WritableStreamDefaultController:rn,WritableStreamDefaultWriter:Jr,ByteLengthQueuingStrategy:ri,CountQueuingStrategy:oi,TransformStream:pi,TransformStreamDefaultController:yi};if(void 0!==He)for(var Ai in Ei)Object.prototype.hasOwnProperty.call(Ei,Ai)&&Object.defineProperty(He,Ai,{value:Ei[Ai],writable:!0,configurable:!0});delete global.ReadableStream;let Si,ji,Ti;Si=Symbol.asyncIterator;ji=Symbol.toStringTag;Ti=Symbol.toStringTag;(!m||!("TextEncoder"in y))&&(y.TextEncoder=F);(!m||!("TextDecoder"in y))&&(y.TextDecoder=M),m||"atob"in y||!ae||(y.atob=ae),m||"btoa"in y||!oe||(y.btoa=oe),m||"Headers"in y||!ue||(y.Headers=ue),m||"Response"in y||!Te||(y.Response=Te),m||"fetch"in y||!Be||(y.fetch=Be),m||"DOMParser"in y||!d.DOMParser||(y.DOMParser=d.DOMParser),m||"_encodeImageNode"in y||!De||(y._encodeImageNode=De),m||"_parseImageNode"in y||!ze||(y._parseImageNode=ze),"allSettled"in Promise||(Promise.allSettled=function(e){const t=e.map(e=>e.then(e=>({status:"fulfilled",value:e})).catch(e=>({status:"rejected",reason:e})));return Promise.all(t)});var Ci=r(1),Bi=r(22),Ri=r.n(Bi),Oi=r(7),Ii=r.n(Oi);"undefined"!=typeof self&&self,"undefined"!=typeof window&&window,"undefined"!=typeof global&&global,"undefined"!=typeof document&&document;const Pi=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),Di="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version),Mi=(Di&&parseFloat(Di[1]),e=>"boolean"==typeof e),Fi=e=>"function"==typeof e,Li=e=>null!==e&&"object"==typeof e,Ni=e=>Li(e)&&e.constructor==={}.constructor,zi=e=>e&&"function"==typeof e[Symbol.iterator],Ui=e=>e&&"function"==typeof e[Symbol.asyncIterator],qi=e=>"undefined"!=typeof Response&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json,Hi=e=>"undefined"!=typeof Blob&&e instanceof Blob,Gi=e=>(e=>"undefined"!=typeof ReadableStream&&e instanceof ReadableStream||Li(e)&&Fi(e.tee)&&Fi(e.cancel)&&Fi(e.getReader))(e)||(e=>Li(e)&&Fi(e.read)&&Fi(e.pipe)&&Mi(e.readable))(e);function Vi(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Wi(e){var t;if(!e)return!1;Array.isArray(e)&&(e=e[0]);return Array.isArray(null===(t=e)||void 0===t?void 0:t.extensions)}function Ki(e){var t,r;let n;return Vi(e,"null loader"),Vi(Wi(e),"invalid loader"),Array.isArray(e)&&(n=e[1],e=e[0],e={...e,options:{...e.options,...n}}),(null!==(t=e)&&void 0!==t&&t.parseTextSync||null!==(r=e)&&void 0!==r&&r.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}let Ji="";const Qi={};function Yi(e){for(const t in Qi)if(e.startsWith(t)){const r=Qi[t];e=e.replace(t,r)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${Ji}${e}`),e}const $i=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Xi=/^([-\w.]+\/[-\w.+]+)/;function Zi(e){const t=Xi.exec(e);return t?t[1]:e}function ea(e){const t=$i.exec(e);return t?t[1]:""}const ta=/\?.*/;function ra(e){if(qi(e)){const t=na(e.url||"");return{url:t,type:Zi(e.headers.get("content-type")||"")||ea(t)}}return Hi(e)?{url:na(e.name||""),type:e.type||""}:"string"==typeof e?{url:na(e),type:ea(e)}:{url:"",type:""}}function na(e){return e.replace(ta,"")}async function ia(e){if(qi(e))return e;const t={},r=function(e){return qi(e)?e.headers["content-length"]||-1:Hi(e)?e.size:"string"==typeof e?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}(e);r>=0&&(t["content-length"]=String(r));const{url:n,type:i}=ra(e);i&&(t["content-type"]=i);const a=await async function(e){if("string"==typeof e)return"data:,"+e.slice(0,5);if(e instanceof Blob){const t=e.slice(0,5);return await new Promise(e=>{const r=new FileReader;r.onload=t=>{var r;return e(null==t||null===(r=t.target)||void 0===r?void 0:r.result)},r.readAsDataURL(t)})}if(e instanceof ArrayBuffer){const t=e.slice(0,5);return"data:base64,"+function(e){let t="";const r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)t+=String.fromCharCode(r[e]);return btoa(t)}(t)}return null}(e);a&&(t["x-first-bytes"]=a),"string"==typeof e&&(e=(new TextEncoder).encode(e));const o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function aa(e){if(!e.ok){const t=await async function(e){let t=`Failed to fetch resource ${e.url} (${e.status}): `;try{const r=e.headers.get("Content-Type");let n=e.statusText;r.includes("application/json")&&(n+=" "+await e.text()),t+=n,t=t.length>60?t.slice(0,60)+"...":t}catch(e){}return t}(e);throw new Error(t)}}async function oa(e,t){if("string"==typeof e){e=Yi(e);let r=t;return null!=t&&t.fetch&&"function"!=typeof(null==t?void 0:t.fetch)&&(r=t.fetch),await fetch(e,r)}return await ia(e)}const sa=new(r(546).a)({id:"loaders.gl"});class ua{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const ca={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var e,t,r;r=void 0,(t="console")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Pi,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},la={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function ha(){globalThis.loaders=globalThis.loaders||{};const{loaders:e}=globalThis;return e._state=e._state||{},e._state}const pa=()=>{const e=ha();return e.globalOptions=e.globalOptions||{...ca},e.globalOptions};function fa(e,t,r,n){return r=r||[],function(e,t){ma(e,null,ca,la,t);for(const r of t){const n=e&&e[r.id]||{},i=r.options&&r.options[r.id]||{},a=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};ma(n,r.id,i,a,t)}}(e,r=Array.isArray(r)?r:[r]),ya(t,e,n)}function da(e,t){const r=pa(),n=e||r;return"function"==typeof n.fetch?n.fetch:Li(n.fetch)?e=>oa(e,n):null!=t&&t.fetch?null==t?void 0:t.fetch:oa}function ma(e,t,r,n,i){const a=t||"Top level",o=t?t+".":"";for(const s in e){const u=!t&&Li(e[s]),c="baseUri"===s&&!t,l="workerUrl"===s&&t;if(!(s in r)&&!c&&!l)if(s in n)sa.warn(`${a} loader option '${o}${s}' no longer supported, use '${n[s]}'`)();else if(!u){const e=ga(s,i);sa.warn(`${a} loader option '${o}${s}' not recognized. ${e}`)()}}}function ga(e,t){const r=e.toLowerCase();let n="";for(const i of t)for(const t in i.options){if(e===t)return`Did you mean '${i.id}.${t}'?`;const a=t.toLowerCase();(r.startsWith(a)||a.startsWith(r))&&(n=n||`Did you mean '${i.id}.${t}'?`)}return n}function ya(e,t,r){const n={...e.options||{}};return function(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}(n,r),null===n.log&&(n.log=new ua),ba(n,pa()),ba(n,t),n}function ba(e,t){for(const r in t)if(r in t){const n=t[r];Ni(n)&&Ni(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function va(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const wa={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},_a=wa.global||wa.self||wa.window||{},ka="object"!=typeof process||"[object process]"!==String(process)||process.browser,xa="function"==typeof importScripts,Ea="undefined"!=typeof window&&void 0!==window.orientation,Aa="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);Aa&&parseFloat(Aa[1]);var Sa=r(545);const ja=new Map;function Ta(e){va(e.source&&!e.url||!e.source&&e.url);let t=ja.get(e.source||e.url);return t||(e.url&&(t=function(e){if(!e.startsWith("http"))return e;return Ca((t=e,`try {\n importScripts('${t}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var t}(e.url),ja.set(e.url,t)),e.source&&(t=Ca(e.source),ja.set(e.source,t))),va(t),t}function Ca(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function Ba(e){return!!e&&(e instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&e instanceof MessagePort||("undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)))}function Ra(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Oa=()=>{};class Ia{static isSupported(){return"undefined"!=typeof Worker&&ka||void 0!==Sa.Worker&&!ka}constructor(e){Ra(this,"name",void 0),Ra(this,"source",void 0),Ra(this,"url",void 0),Ra(this,"terminated",!1),Ra(this,"worker",void 0),Ra(this,"onMessage",void 0),Ra(this,"onError",void 0),Ra(this,"_loadableURL","");const{name:t,source:r,url:n}=e;va(r||n),this.name=t,this.source=r,this.url=n,this.onMessage=Oa,this.onError=e=>console.log(e),this.worker=ka?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Oa,this.onError=Oa,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,t){t=t||function e(t,r=!0,n){const i=n||new Set;if(t){if(Ba(t))i.add(t);else if(Ba(t.buffer))i.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"==typeof t)for(const n in t)e(t[n],r,i)}else;return void 0===n?Array.from(i):[]}(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=e.message+" in "),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),new Error(t)}_createBrowserWorker(){this._loadableURL=Ta({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},e.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},e.onmessageerror=e=>console.error(e),e}_createNodeWorker(){let e;if(this.url){const t=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./"+this.url;e=new Sa.Worker(t,{eval:!1})}else{if(!this.source)throw new Error("no worker");e=new Sa.Worker(this.source,{eval:!0})}return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}function Pa(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Da{constructor(e,t){Pa(this,"name",void 0),Pa(this,"workerThread",void 0),Pa(this,"isRunning",!0),Pa(this,"result",void 0),Pa(this,"_resolve",()=>{}),Pa(this,"_reject",()=>{}),this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){va(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){va(this.isRunning),this.isRunning=!1,this._reject(e)}}function Ma(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Fa{static isSupported(){return Ia.isSupported()}constructor(e){Ma(this,"name","unnamed"),Ma(this,"source",void 0),Ma(this,"url",void 0),Ma(this,"maxConcurrency",1),Ma(this,"maxMobileConcurrency",1),Ma(this,"onDebug",()=>{}),Ma(this,"reuseWorkers",!0),Ma(this,"props",{}),Ma(this,"jobQueue",[]),Ma(this,"idleQueue",[]),Ma(this,"count",0),Ma(this,"isDestroyed",!1),this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=((e,t,r)=>e.done(r)),r=((e,t)=>e.error(t))){const n=new Promise(n=>(this.jobQueue.push({name:e,onMessage:t,onError:r,onStart:n}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});const r=new Da(t.name,e);e.onMessage=e=>t.onMessage(r,e.type,e.payload),e.onError=e=>t.onError(r,e),t.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Ia({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Ea?this.maxMobileConcurrency:this.maxConcurrency}}function La(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Na={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class za{static isSupported(){return Ia.isSupported()}static getWorkerFarm(e={}){return za._workerFarm=za._workerFarm||new za({}),za._workerFarm.setProps(e),za._workerFarm}constructor(e){La(this,"props",void 0),La(this,"workerPools",new Map),this.props={...Na},this.setProps(e),this.workerPools=new Map}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:t,source:r,url:n}=e;let i=this.workerPools.get(t);return i||(i=new Fa({name:t,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(t,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}La(za,"_workerFarm",void 0);function Ua(e,t={}){const r=t[e.id]||{},n=e.id+"-worker.js";let i=r.workerUrl;if(i||"compression"!==e.id||(i=t.workerUrl),"test"===t._workerType&&(i=`modules/${e.module}/dist/${n}`),!i){let t=e.version;"latest"===t&&(t="beta");const r=t?"@"+t:"";i=`https://unpkg.com/@loaders.gl/${e.module}${r}/dist/${n}`}return va(i),i}async function qa(e,t,r,n,i){const a=e.id,o=Ua(e,r),s=za.getWorkerFarm(r).getWorkerPool({name:a,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));const u=await s.startJob("process-on-worker",Ha.bind(null,i));u.postMessage("process",{input:t,options:r,context:n});const c=await u.result;return await c.result}async function Ha(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{const r=await e(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}function Ga(e){if(ArrayBuffer.isView(e)&&(e=e.buffer),"undefined"!=typeof Buffer&&e instanceof ArrayBuffer){const t=new Buffer(e.byteLength),r=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=r[e];return t}return Vi(!1)}function Va(e){return e&&"object"==typeof e&&e.isBuffer}function Wa(e){return Ga?Ga(e):e}function Ka(e){if(Va(e))return function(e){if(Va(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(e);if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function Ja(...e){const t=e.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),r=t.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(r);let i=0;for(const e of t)n.set(e,i),i+=e.byteLength;return n.buffer}function Qa(...e){const t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');const n=new r(t.reduce((e,t)=>e+t.length,0));let i=0;for(const e of t)n.set(e,i),i+=e.length;return n}function Ya(e,t,r){const n=void 0!==r?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}async function $a(e){const t=[];for await(const r of e)t.push(r);return Ja(...t)}const Xa=262144;function Za(e,t){return Pi?async function*(e,t){const r=e.getReader();let n;try{for(;;){const e=n||r.read();null!=t&&t._streamReadAhead&&(n=r.read());const{done:i,value:a}=await e;if(i)return;yield Ka(a)}}catch(e){r.releaseLock()}}(e,t):async function*(e,t){for await(const t of e)yield Ka(t)}(e)}function eo(e,t){if("string"==typeof e)return function*(e,t){const r=(null==t?void 0:t.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<e.length;){const t=Math.min(e.length-n,r),a=e.slice(n,n+t);n+=t,yield i.encode(a)}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){const{chunkSize:r=Xa}=t;let n=0;for(;n<e.byteLength;){const t=Math.min(e.byteLength-n,r),i=new ArrayBuffer(t),a=new Uint8Array(e,n,t);new Uint8Array(i).set(a),n+=t,yield i}}(e,t);if(Hi(e))return async function*(e,t){const r=(null==t?void 0:t.chunkSize)||1048576;let n=0;for(;n<e.size;){const t=n+r,i=await e.slice(n,t).arrayBuffer();n=t,yield i}}(e,t);if(Gi(e))return Za(e,t);if(qi(e)){return Za(e.body,t)}throw new Error("makeIterator")}const to="Cannot convert supplied data type";async function ro(e,t,r){const n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||n)return function(e,t,r){if(t.text&&"string"==typeof e)return e;var n;if((n=e)&&"object"==typeof n&&n.isBuffer&&(e=e.buffer),e instanceof ArrayBuffer){const r=e;if(t.text&&!t.binary){return new TextDecoder("utf8").decode(r)}return r}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary){return new TextDecoder("utf8").decode(e)}let r=e.buffer;const n=e.byteLength||e.length;return 0===e.byteOffset&&n===r.byteLength||(r=r.slice(e.byteOffset,e.byteOffset+n)),r}throw new Error(to)}(e,t);if(Hi(e)&&(e=await ia(e)),qi(e)){const r=e;return await aa(r),t.binary?await r.arrayBuffer():await r.text()}if(Gi(e)&&(e=eo(e,r)),zi(e)||Ui(e))return $a(e);throw new Error(to)}function no(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(t+1):""}function io(e){const t=e&&e.lastIndexOf("/");return t>=0?e.substr(0,t):""}function ao(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(new RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t))).join("/")}const oo=Le.promisify;let so,uo,co,lo,ho,po,fo,mo,go,yo,bo=Boolean(de.a);try{so=oo(de.a.readdir),uo=oo(de.a.stat),co=oo(de.a.readFile),lo=de.a.readFileSync,ho=oo(de.a.writeFile),po=de.a.writeFileSync,fo=oo(de.a.open),mo=oo(de.a.close),go=oo(de.a.read),yo=oo(de.a.fstat),bo=Boolean(de.a)}catch{}async function vo(e,t,r){const n=Buffer.alloc(r),{bytesRead:i}=await go(e,n,0,r,t);if(i!==r)throw new Error("fs.read failed");return function(e){if(Buffer.isBuffer(e)){return new Uint8Array(e.buffer,e.byteOffset,e.length).slice().buffer}return e}(n)}function wo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _o(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}const ko="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";_o();class xo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";wo(this,"storage",void 0),wo(this,"id",void 0),wo(this,"config",{}),this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function Eo(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}let Ao;function So(e){return"string"==typeof e?Ao[e.toUpperCase()]||Ao.WHITE:e}function jo(e,t){if(!e)throw new Error(t||"Assertion failed")}!function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Ao||(Ao={}));const To={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},Co=(globalThis,To.window||To.self||To.global),Bo=To.process||{};console;function Ro(){let e;var t,r;if(_o&&"performance"in Co)e=null==Co||null===(t=Co.performance)||void 0===t||null===(r=t.now)||void 0===r?void 0:r.call(t);else if("hrtime"in Bo){var n;const t=null==Bo||null===(n=Bo.hrtime)||void 0===n?void 0:n.call(Bo);e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const Oo={debug:_o&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Io={enabled:!0,level:0};function Po(){}const Do={},Mo={once:!0};class Fo{constructor(){let{id:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};wo(this,"id",void 0),wo(this,"VERSION",ko),wo(this,"_startTs",Ro()),wo(this,"_deltaTs",Ro()),wo(this,"_storage",void 0),wo(this,"userData",{}),wo(this,"LOG_THROTTLE_TIMEOUT",0),this.id=e,this._storage=new xo("__probe-".concat(this.id,"__"),Io),this.userData={},this.timeStamp("".concat(this.id," started")),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((Ro()-this._startTs).toPrecision(10))}getDelta(){return Number((Ro()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){jo(e,t)}warn(e){return this._getLogFunction(0,e,Oo.warn,arguments,Mo)}error(e){return this._getLogFunction(0,e,Oo.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,Oo.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,Oo.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return this._getLogFunction(e,t,Oo.debug||Oo.info,arguments,Mo)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||Po,r&&[r],{tag:zo(t)}):Po}image(e){let{logLevel:t,priority:n,image:i,message:a="",scale:o=1}=e;return this._shouldLog(t||n)?_o?function(e){let{image:t,message:r="",scale:n=1}=e;if("string"==typeof t){const e=new Image;return e.onload=()=>{const t=Eo(e,r,n);console.log(...t)},e.src=t,Po}const i=t.nodeName||"";if("img"===i.toLowerCase())return console.log(...Eo(t,r,n)),Po;if("canvas"===i.toLowerCase()){const e=new Image;return e.onload=()=>console.log(...Eo(e,r,n)),e.src=t.toDataURL(),Po}return Po}({image:i,message:a,scale:o}):function(e){let{image:t,message:n="",scale:i=1}=e,a=null;try{a=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(a)return()=>a(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then(e=>console.log(e));return Po}({image:i,message:a,scale:o}):Po}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||Po)}group(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const n=No({logLevel:e,message:t,opts:r}),{collapsed:i}=r;return n.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Po)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=Lo(e)}_getLogFunction(e,t,r,n,i){if(this._shouldLog(e)){i=No({logLevel:e,message:t,args:n,opts:i}),jo(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Ro();const a=i.tag||i.message;if(i.once){if(Do[a])return Po;Do[a]=Ro()}return t=function(e,t,r){if("string"==typeof t){const o=r.time?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(o," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,a=r.background,_o||"string"!=typeof n||(i&&(i=So(i),n="[".concat(i,"m").concat(n,"[39m")),a&&(i=So(a),n="[".concat(a+10,"m").concat(n,"[49m"))),t=n}var n,i,a;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return Po}}function Lo(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return jo(Number.isFinite(t)&&t>=0),t}function No(e){const{logLevel:t,message:r}=e;e.logLevel=Lo(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return jo("string"===i||"object"===i),Object.assign(e,{args:n},e.opts)}function zo(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}wo(Fo,"VERSION",ko);const Uo=new Fo({id:"loaders.gl"}),qo=()=>{const e=ha();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};const Ho=/\.([^.]+)$/;function Go(e,t=[],r,n){if(!Vo(e))return null;if(t&&!Array.isArray(t))return Ki(t);let i=[];t&&(i=i.concat(t)),null!=r&&r.ignoreRegisteredLoaders||i.push(...qo()),function(e){for(const t of e)Ki(t)}(i);const a=function(e,t,r,n){const{url:i,type:a}=ra(e),o=i||(null==n?void 0:n.url);let s=null,u="";null!=r&&r.mimeType&&(s=Ko(t,null==r?void 0:r.mimeType),u="match forced by supplied MIME type "+(null==r?void 0:r.mimeType));var c;s=s||function(e,t){const r=t&&Ho.exec(t),n=r&&r[1];return n?function(e,t){t=t.toLowerCase();for(const r of e)for(const e of r.extensions)if(e.toLowerCase()===t)return r;return null}(e,n):null}(t,o),u=u||(s?"matched url "+o:""),s=s||Ko(t,a),u=u||(s?"matched MIME type "+a:""),s=s||function(e,t){if(!t)return null;for(const r of e)if("string"==typeof t){if(Jo(t,r))return r}else if(ArrayBuffer.isView(t)){if(Qo(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(Qo(t,0,r))return r}return null}(t,e),u=u||(s?"matched initial data "+Yo(e):""),s=s||Ko(t,null==r?void 0:r.fallbackMimeType),u=u||(s?"matched fallback MIME type "+a:""),u&&Uo.log(1,`selectLoader selected ${null===(c=s)||void 0===c?void 0:c.name}: ${u}.`);return s}(e,i,r,n);if(!(a||null!=r&&r.nothrow))throw new Error(Wo(e));return a}function Vo(e){return!(e instanceof Response&&204===e.status)}function Wo(e){const{url:t,type:r}=ra(e);let i="No valid loader found (";i+=t?n.filename(t)+", ":"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;const a=e?Yo(e):"";return i+=a?` first bytes: "${a}"`:"first bytes: not available",i+=")",i}function Ko(e,t){for(const r of e){if(r.mimeTypes&&r.mimeTypes.includes(t))return r;if(t==="application/x."+r.id)return r}return null}function Jo(e,t){if(t.testText)return t.testText(e);return(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}function Qo(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>function(e,t,r,n){if(n instanceof ArrayBuffer)return function(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;const n=new Uint8Array(e),i=new Uint8Array(t);for(let e=0;e<n.length;++e)if(n[e]!==i[e])return!1;return!0}(n,e,n.byteLength);switch(typeof n){case"function":return n(e,r);case"string":const i=$o(e,t,n.length);return n===i;default:return!1}}(e,t,r,n))}function Yo(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return $o(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return $o(e,0,t)}return""}function $o(e,t,r){if(e.byteLength<t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}async function Xo(e,t,r,n){va(!n||"object"==typeof n),!t||Array.isArray(t)||Wi(t)||(n=void 0,r=t,t=void 0),e=await e,r=r||{};const{url:i}=ra(e),a=function(e,t){if(!t&&e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){const e=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...e]:e}return r&&r.length?r:null}(t,n),o=await async function(e,t=[],r,n){if(!Vo(e))return null;let i=Go(e,t,{...r,nothrow:!0},n);if(i)return i;if(Hi(e)&&(i=Go(e=await e.slice(0,10).arrayBuffer(),t,r,n)),!(i||null!=r&&r.nothrow))throw new Error(Wo(e));return i}(e,a,r);return o?(n=function(e,t,r=null){if(r)return r;const n={fetch:da(t,e),...e};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:i,parse:Xo,loaders:a},r=fa(r,o,a,i),n),await async function(e,t,r,n){if(function(e,t="3.3.0-alpha.5"){va(e,"no worker provided");const r=e.version}(e),qi(t)){const e=t,{ok:r,redirected:i,status:a,statusText:o,type:s,url:u}=e,c=Object.fromEntries(e.headers.entries());n.response={headers:c,ok:r,redirected:i,status:a,statusText:o,type:s,url:u}}if(t=await ro(t,e,r),e.parseTextSync&&"string"==typeof t)return r.dataType="text",e.parseTextSync(t,r,n,e);if(function(e,t){return!!za.isSupported()&&(!!(ka||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(e,r))return await qa(e,t,r,n,Xo);if(e.parseText&&"string"==typeof t)return await e.parseText(t,r,n,e);if(e.parse)return await e.parse(t,r,n,e);throw va(!e.parseSync),new Error(e.id+" loader - no parser found and worker is disabled")}(o,e,r,n)):null}async function Zo(e,t,r,n){Array.isArray(t)||Wi(t)||(void 0,r=t,t=void 0);const i=da(r);let a=e;return"string"==typeof e&&(a=await i(e)),Hi(e)&&(a=await i(e)),await Xo(a,t,r)}function es(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}const ts=1/Math.PI*180,rs=1/180*Math.PI,ns={};function is(e,{precision:t=ns.precision||4}={}){return e=function(e){return Math.round(e/ns.EPSILON)*ns.EPSILON}(e),"".concat(parseFloat(e.toPrecision(t)))}function as(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function os(e,t,r){if(as(e)){r=r||((n=e).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<e.length;++n)r[n]=t(e[n],n,r);return r}var n;return t(e)}function ss(e){return function(e,t){return os(e,e=>e*rs,t)}(e)}function us(e){return cs(e)}function cs(e,t){return os(e,e=>e*ts,t)}function ls(e,t,r){return os(e,e=>Math.max(t,Math.min(r,e)))}function hs(e,t,r){const n=ns.EPSILON;r&&(ns.EPSILON=r);try{if(e===t)return!0;if(as(e)&&as(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!hs(e[r],t[r]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):!(!Number.isFinite(e)||!Number.isFinite(t))&&Math.abs(e-t)<=ns.EPSILON*Math.max(1,Math.abs(e),Math.abs(t))}finally{ns.EPSILON=n}}ns.EPSILON=1e-12,ns.debug=!1,ns.precision=4,ns.printTypes=!1,ns.printDegrees=!1,ns.printRowMajor=!0;class ps extends(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Array)){get ELEMENTS(){return es(!1),0}clone(){return(new this.constructor).copy(this)}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}to(e){return e===this?this:as(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(ns)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+is(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!hs(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){void 0===r&&(r=t,t=e,e=this);for(let n=0;n<this.ELEMENTS;++n){const i=e[n];this[n]=i+r*(t[n]-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if(Array.isArray(e))return this.multiply(e);for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.scale(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}multiplyByScalar(e){return this.scale(e)}get elements(){return this}check(){if(ns.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}}function fs(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(e));return e}function ds(e,t,r=""){if(ns.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,t))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return e}const ms={};function gs(e,t){ms[e]||(ms[e]=!0,console.warn("".concat(e," has been removed in version ").concat(t,", see upgrade guide for more information")))}class ys extends ps{get ELEMENTS(){return es(!1),0}copy(e){return es(!1),this}get x(){return this[0]}set x(e){this[0]=fs(e)}get y(){return this[1]}set y(e){this[1]=fs(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-e[r];t+=n*n}return fs(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return fs(t)}normalize(){const e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(const t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return es(e>=0&&e<this.ELEMENTS,"index is out of range"),fs(this[e])}setComponent(e,t){return es(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}var bs=1e-6,vs="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function ws(){var e=new vs(3);return vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function _s(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function ks(e,t,r){var n=new vs(3);return n[0]=e,n[1]=t,n[2]=r,n}function xs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Es(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function As(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function Ss(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function js(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,h=a*s-n*c,p=n*u-i*s,f=i*p-a*h,d=a*l-n*p,m=n*h-i*l,g=2*o;return l*=g,h*=g,p*=g,f*=2,d*=2,m*=2,e[0]=s+l+f,e[1]=u+h+d,e[2]=c+p+m,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ts,Cs=_s;Ts=ws();function Bs(e,t,r){const n=t[0],i=t[1],a=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/a,e[1]=(r[1]*n+r[5]*i)/a,e}function Rs(e,t,r){const n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a||1;return e[0]=(r[0]*n+r[4]*i+r[8]*a)/o,e[1]=(r[1]*n+r[5]*i+r[9]*a)/o,e[2]=(r[2]*n+r[6]*i+r[10]*a)/o,e}function Os(e,t,r){const n=t[0],i=t[1],a=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*a,e[1]=r[1]*n+r[4]*i+r[7]*a,e[2]=r[2]*n+r[5]*i+r[8]*a,e[3]=t[3],e}const Is=[0,0,0],Ps={};class Ds extends ys{static get ZERO(){return Ps.ZERO=Ps.ZERO||Object.freeze(new Ds(0,0,0,0))}constructor(e=0,t=0,r=0){super(-0,-0,-0),1===arguments.length&&as(e)?this.copy(e):(ns.debug&&(fs(e),fs(t),fs(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y),fs(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=fs(e)}angle(e){return r=e,n=(t=this)[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=Math.sqrt(n*n+i*i+a*a)*Math.sqrt(o*o+s*s+u*u),l=c&&xs(t,r)/c,Math.acos(Math.min(Math.max(l,-1),1));var t,r,n,i,a,o,s,u,c,l}cross(e){return Es(this,this,e),this.check()}rotateX({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0],s[1]=o[1]*Math.cos(a)-o[2]*Math.sin(a),s[2]=o[1]*Math.sin(a)+o[2]*Math.cos(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateY({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[2]*Math.sin(a)+o[0]*Math.cos(a),s[1]=o[1],s[2]=o[2]*Math.cos(a)-o[0]*Math.sin(a),r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}rotateZ({radians:e,origin:t=Is}){var r,n,i,a,o,s;return r=this,i=t,a=e,s=[],(o=[])[0]=(n=this)[0]-i[0],o[1]=n[1]-i[1],o[2]=n[2]-i[2],s[0]=o[0]*Math.cos(a)-o[1]*Math.sin(a),s[1]=o[0]*Math.sin(a)+o[1]*Math.cos(a),s[2]=o[2],r[0]=s[0]+i[0],r[1]=s[1]+i[1],r[2]=s[2]+i[2],this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return As(this,this,e),this.check()}transformAsVector(e){return Rs(this,this,e),this.check()}transformByMatrix3(e){return Ss(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2]}(this,this,e),this.check()}transformByQuaternion(e){return js(this,this,e),this.check()}}class Ms extends ps{get ELEMENTS(){return es(!1),0}get RANK(){return es(!1),0}toString(){let e="[";if(ns.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=fs(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[r+e];return t}setColumn(e,t){const r=e*this.RANK;for(let e=0;e<this.RANK;++e)this[r+e]=t[e];return this}}function Fs(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=t[9],f=t[10],d=t[11],m=t[12],g=t[13],y=t[14],b=t[15],v=r[0],w=r[1],_=r[2],k=r[3];return e[0]=v*n+w*s+_*h+k*m,e[1]=v*i+w*u+_*p+k*g,e[2]=v*a+w*c+_*f+k*y,e[3]=v*o+w*l+_*d+k*b,v=r[4],w=r[5],_=r[6],k=r[7],e[4]=v*n+w*s+_*h+k*m,e[5]=v*i+w*u+_*p+k*g,e[6]=v*a+w*c+_*f+k*y,e[7]=v*o+w*l+_*d+k*b,v=r[8],w=r[9],_=r[10],k=r[11],e[8]=v*n+w*s+_*h+k*m,e[9]=v*i+w*u+_*p+k*g,e[10]=v*a+w*c+_*f+k*y,e[11]=v*o+w*l+_*d+k*b,v=r[12],w=r[13],_=r[14],k=r[15],e[12]=v*n+w*s+_*h+k*m,e[13]=v*i+w*u+_*p+k*g,e[14]=v*a+w*c+_*f+k*y,e[15]=v*o+w*l+_*d+k*b,e}function Ls(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ns(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(u,c,l),e}function zs(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function Us(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}!function(){var e,t=(e=new vs(2),vs!=Float32Array&&(e[0]=0,e[1]=0),e)}();function qs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function Hs(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}!function(){var e,t=(e=new vs(4),vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();const Gs=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Vs=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ws=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),Ks={};class Js extends Ms{static get IDENTITY(){return Ks.IDENTITY=Ks.IDENTITY||Object.freeze(new Js(Gs)),Ks.IDENTITY}static get ZERO(){return Ks.ZERO=Ks.ZERO||Object.freeze(new Js(Vs)),Ks.ZERO}get INDICES(){return Ws}get ELEMENTS(){return 16}get RANK(){return 4}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this[9]=c,this[10]=l,this[11]=h,this[12]=p,this[13]=f,this[14]=d,this[15]=m,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m){return this[0]=e,this[1]=i,this[2]=u,this[3]=p,this[4]=t,this[5]=a,this[6]=c,this[7]=f,this[8]=r,this[9]=o,this[10]=l,this[11]=d,this[12]=n,this[13]=s,this[14]=h,this[15]=m,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Gs)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[1]=l+y,e[2]=p-g,e[3]=0,e[4]=l-y,e[5]=1-c-d,e[6]=f+m,e[7]=0,e[8]=p+g,e[9]=f-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this,e),this.check()}frustum({left:e,right:t,bottom:r,top:n,near:i,far:a}){return a===1/0?Js._computeInfinitePerspectiveOffCenter(this,e,t,r,n,i):function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(i-n),c=1/(a-o);e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0}(this,e,t,r,n,i,a),this.check()}static _computeInfinitePerspectiveOffCenter(e,t,r,n,i,a){const o=2*a/(r-t),s=2*a/(i-n),u=(r+t)/(r-t),c=(i+n)/(i-n),l=-2*a;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=u,e[9]=c,e[10]=-1,e[11]=-1,e[12]=0,e[13]=0,e[14]=l,e[15]=0,e}lookAt(e,t,r){return 1===arguments.length&&({eye:e,center:t,up:r}=e),function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d=t[0],m=t[1],g=t[2],y=n[0],b=n[1],v=n[2],w=r[0],_=r[1],k=r[2];Math.abs(d-w)<bs&&Math.abs(m-_)<bs&&Math.abs(g-k)<bs?function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(e):(l=d-w,h=m-_,p=g-k,i=b*(p*=f=1/Math.hypot(l,h,p))-v*(h*=f),a=v*(l*=f)-y*p,o=y*h-b*l,(f=Math.hypot(i,a,o))?(i*=f=1/f,a*=f,o*=f):(i=0,a=0,o=0),s=h*o-p*a,u=p*i-l*o,c=l*a-h*i,(f=Math.hypot(s,u,c))?(s*=f=1/f,u*=f,c*=f):(s=0,u=0,c=0),e[0]=i,e[1]=s,e[2]=l,e[3]=0,e[4]=a,e[5]=u,e[6]=h,e[7]=0,e[8]=o,e[9]=c,e[10]=p,e[11]=0,e[12]=-(i*d+a*m+o*g),e[13]=-(s*d+u*m+c*g),e[14]=-(l*d+h*m+p*g),e[15]=1)}(this,e,t=t||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:e,right:t,bottom:r,top:n,near:i=.1,far:a=500}){return function(e,t,r,n,i,a,o){var s=1/(t-r),u=1/(n-i),c=1/(a-o);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*u,e[14]=(o+a)*c,e[15]=1}(this,e,t,r,n,i,a),this.check()}orthographic({fovy:e=45*Math.PI/180,aspect:t=1,focalDistance:r=1,near:n=.1,far:i=500}){if(e>2*Math.PI)throw Error("radians");const a=e/2,o=r*Math.tan(a),s=o*t;return(new Js).ortho({left:-s,right:s,bottom:-o,top:o,near:n,far:i})}perspective({fovy:e,fov:t=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((e=e||t)>2*Math.PI)throw Error("radians");return function(e,t,r,n,i){var a,o=1/Math.tan(t/2);e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n)}(this,e,r,n,i),this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],p=e[11],f=e[12],d=e[13],m=e[14],g=e[15],(t*o-r*a)*(h*g-p*m)-(t*s-n*a)*(l*g-p*d)+(t*u-i*a)*(l*m-h*d)+(r*s-n*o)*(c*g-p*f)-(r*u-i*o)*(c*m-h*f)+(n*u-i*s)*(c*d-l*f);var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*n,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*n,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e=[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=null){const r=this.getScale(t||[-0,-0,-0]),n=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*n,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*n,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*n,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15]}(this,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T,C,B;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],h=t[9],p=t[10],f=t[11],d=t[12],m=t[13],g=t[14],y=t[15],(B=(b=r*s-n*o)*(C=p*y-f*g)-(v=r*u-i*o)*(T=h*y-f*m)+(w=r*c-a*o)*(j=h*g-p*m)+(_=n*u-i*s)*(S=l*y-f*d)-(k=n*c-a*s)*(A=l*g-p*d)+(x=i*c-a*u)*(E=l*m-h*d))&&(B=1/B,e[0]=(s*C-u*T+c*j)*B,e[1]=(i*T-n*C-a*j)*B,e[2]=(m*x-g*k+y*_)*B,e[3]=(p*k-h*x-f*_)*B,e[4]=(u*S-o*C-c*A)*B,e[5]=(r*C-i*S+a*A)*B,e[6]=(g*w-d*x-y*v)*B,e[7]=(l*x-p*w+f*v)*B,e[8]=(o*T-s*S+c*E)*B,e[9]=(n*S-r*T-a*E)*B,e[10]=(d*k-m*w+y*b)*B,e[11]=(h*w-l*k-f*b)*B,e[12]=(s*A-o*j-u*E)*B,e[13]=(r*j-n*A+i*E)*B,e[14]=(m*v-d*_-g*b)*B,e[15]=(l*_-h*v+p*b)*B),this.check()}multiplyLeft(e){return Fs(this,e,this),this.check()}multiplyRight(e){return Fs(this,this,e),this.check()}rotateX(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[4],s=r[5],u=r[6],c=r[7],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[4]=o*a+l*i,t[5]=s*a+h*i,t[6]=u*a+p*i,t[7]=c*a+f*i,t[8]=l*a-o*i,t[9]=h*a-s*i,t[10]=p*a-u*i,t[11]=f*a-c*i,this.check()}rotateY(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[8],h=r[9],p=r[10],f=r[11],r!==t&&(t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a-l*i,t[1]=s*a-h*i,t[2]=u*a-p*i,t[3]=c*a-f*i,t[8]=o*i+l*a,t[9]=s*i+h*a,t[10]=u*i+p*a,t[11]=c*i+f*a,this.check()}rotateZ(e){var t,r,n,i,a,o,s,u,c,l,h,p,f;return t=this,r=this,n=e,i=Math.sin(n),a=Math.cos(n),o=r[0],s=r[1],u=r[2],c=r[3],l=r[4],h=r[5],p=r[6],f=r[7],r!==t&&(t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t[0]=o*a+l*i,t[1]=s*a+h*i,t[2]=u*a+p*i,t[3]=c*a+f*i,t[4]=l*a-o*i,t[5]=h*a-s*i,t[6]=p*a-u*i,t[7]=f*a-c*i,this.check()}rotateXYZ([e,t,r]){return this.rotateX(e).rotateY(t).rotateZ(r)}rotateAxis(e,t){return function(e,t,r,n){var i,a,o,s,u,c,l,h,p,f,d,m,g,y,b,v,w,_,k,x,E,A,S,j,T=n[0],C=n[1],B=n[2],R=Math.hypot(T,C,B);R<bs||(T*=R=1/R,C*=R,B*=R,i=Math.sin(r),o=1-(a=Math.cos(r)),s=t[0],u=t[1],c=t[2],l=t[3],h=t[4],p=t[5],f=t[6],d=t[7],m=t[8],g=t[9],y=t[10],b=t[11],v=T*T*o+a,w=C*T*o+B*i,_=B*T*o-C*i,k=T*C*o-B*i,x=C*C*o+a,E=B*C*o+T*i,A=T*B*o+C*i,S=C*B*o-T*i,j=B*B*o+a,e[0]=s*v+h*w+m*_,e[1]=u*v+p*w+g*_,e[2]=c*v+f*w+y*_,e[3]=l*v+d*w+b*_,e[4]=s*k+h*x+m*E,e[5]=u*k+p*x+g*E,e[6]=c*k+f*x+y*E,e[7]=l*k+d*x+b*E,e[8]=s*A+h*S+m*j,e[9]=u*A+p*S+g*j,e[10]=c*A+f*S+y*j,e[11]=l*A+d*S+b*j,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]))}(this,this,e,t),this.check()}scale(e){return Array.isArray(e)?Ls(this,this,e):Ls(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d,m,g,y,b;return t=this,r=this,g=(n=e)[0],y=n[1],b=n[2],r===t?(t[12]=r[0]*g+r[4]*y+r[8]*b+r[12],t[13]=r[1]*g+r[5]*y+r[9]*b+r[13],t[14]=r[2]*g+r[6]*y+r[10]*b+r[14],t[15]=r[3]*g+r[7]*y+r[11]*b+r[15]):(i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=r[9],d=r[10],m=r[11],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=l,t[7]=h,t[8]=p,t[9]=f,t[10]=d,t[11]=m,t[12]=i*g+u*y+p*b+r[12],t[13]=a*g+c*y+f*b+r[13],t[14]=o*g+l*y+d*b+r[14],t[15]=s*g+h*y+m*b+r[15]),this.check()}transform(e,t){return 4===e.length?(r=t||[-0,-0,-0,-0],i=this,a=(n=e)[0],o=n[1],s=n[2],u=n[3],r[0]=i[0]*a+i[4]*o+i[8]*s+i[12]*u,r[1]=i[1]*a+i[5]*o+i[9]*s+i[13]*u,r[2]=i[2]*a+i[6]*o+i[10]*s+i[14]*u,r[3]=i[3]*a+i[7]*o+i[11]*s+i[15]*u,ds(t=r,4),t):this.transformAsPoint(e,t);var r,n,i,a,o,s,u}transformAsPoint(e,t){const{length:r}=e;switch(r){case 2:t=Us(t||[-0,-0],e,this);break;case 3:t=As(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}transformAsVector(e,t){switch(e.length){case 2:t=Bs(t||[-0,-0],e,this);break;case 3:t=Rs(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}transformPoint(e,t){return gs("Matrix4.transformPoint","3.0"),this.transformAsPoint(e,t)}transformVector(e,t){return gs("Matrix4.transformVector","3.0"),this.transformAsPoint(e,t)}transformDirection(e,t){return gs("Matrix4.transformDirection","3.0"),this.transformAsVector(e,t)}}var Qs=.1,Ys=1e-12,$s=1e-15,Xs=1e-20;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const Zs=e=>e,eu=new Ds;function tu(e,t,r=Zs){return as(e)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z),t}function ru(e,t,r=Zs){return as(t)?(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]):"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]),t}const nu=new Ds,iu=new Ds,au=new Ds;const ou=new Ds,su={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},uu={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},cu={east:new Ds,north:new Ds,up:new Ds,west:new Ds,south:new Ds,down:new Ds},lu=new Ds,hu=new Ds,pu=new Ds;function fu(e,t,r,n,i,a){const o=su[t]&&su[t][r];let s,u,c;es(o&&(!n||n===o));const l=ou.copy(i);if(hs(l.x,0,1e-14)&&hs(l.y,0,1e-14)){const e=Math.sign(l.z);s=lu.fromArray(uu[t]),"east"!==t&&"west"!==t&&s.scale(e),u=hu.fromArray(uu[r]),"east"!==r&&"west"!==r&&u.scale(e),c=pu.fromArray(uu[n]),"east"!==n&&"west"!==n&&c.scale(e)}else{const{up:i,east:a,north:o}=cu;a.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,i),o.copy(i).cross(a);const{down:h,west:p,south:f}=cu;h.copy(i).scale(-1),p.copy(a).scale(-1),f.copy(o).scale(-1),s=cu[t],u=cu[r],c=cu[n]}return a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=u.x,a[5]=u.y,a[6]=u.z,a[7]=0,a[8]=c.x,a[9]=c.y,a[10]=c.z,a[11]=0,a[12]=l.x,a[13]=l.y,a[14]=l.z,a[15]=1,a}const du=new Ds,mu=new Ds,gu=new Ds,yu=new Ds,bu=new Ds,vu=new Ds;let wu;class _u{static get WGS84(){return wu=wu||new _u(6378137,6378137,6356752.314245179),wu}constructor(e=0,t=0,r=0){es(e>=0),es(t>=0),es(r>=0),this.radii=new Ds(e,t,r),this.radiiSquared=new Ds(e*e,t*t,r*r),this.radiiToTheFourth=new Ds(e*e*e*e,t*t*t*t,r*r*r*r),this.oneOverRadii=new Ds(0===e?0:1/e,0===t?0:1/t,0===r?0:1/r),this.oneOverRadiiSquared=new Ds(0===e?0:1/(e*e),0===t?0:1/(t*t),0===r?0:1/(r*r)),this.minimumRadius=Math.min(e,t,r),this.maximumRadius=Math.max(e,t,r),this.centerToleranceSquared=Qs,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,t=[0,0,0]){const r=mu,n=gu,[,,i]=e;this.geodeticSurfaceNormalCartographic(e,r),n.copy(this.radiiSquared).scale(r);const a=Math.sqrt(r.dot(n));return n.scale(1/a),r.scale(i),n.add(r),n.to(t)}cartesianToCartographic(e,t=[0,0,0]){vu.from(e);const r=this.scaleToGeodeticSurface(vu,yu);if(!r)return;const n=this.geodeticSurfaceNormal(r,mu),i=bu;i.copy(vu).subtract(r);const a=Math.atan2(n.y,n.x),o=Math.asin(n.z),s=Math.sign(xs(i,vu))*_s(i);return ru([a,o,s],t,ns._cartographicRadians?Zs:us)}eastNorthUpToFixedFrame(e,t=new Js){return fu(this,"east","north","up",e,t)}localFrameToFixedFrame(e,t,r,n,i=new Js){return fu(this,e,t,r,n,i)}geocentricSurfaceNormal(e,t=[0,0,0]){return du.from(e).normalize().to(t)}geodeticSurfaceNormalCartographic(e,t=[0,0,0]){const r=function(e,t=eu){return tu(e,t,ns._cartographicRadians?Zs:ss)}(e),n=r[0],i=r[1],a=Math.cos(i);return du.set(a*Math.cos(n),a*Math.sin(n),Math.sin(i)).normalize(),du.to(t)}geodeticSurfaceNormal(e,t=[0,0,0]){return du.from(e).scale(this.oneOverRadiiSquared).normalize().to(t)}scaleToGeodeticSurface(e,t){return function(e,t,r=new Ds){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:a}=t;nu.from(e);const o=e.x,s=e.y,u=e.z,c=n.x,l=n.y,h=n.z,p=o*o*c*c,f=s*s*l*l,d=u*u*h*h,m=p+f+d,g=Math.sqrt(1/m);if(!Number.isFinite(g))return;const y=iu;if(y.copy(e).scale(g),m<a)return y.to(r);const b=i.x,v=i.y,w=i.z,_=au;_.set(y.x*b*2,y.y*v*2,y.z*w*2);let k,x,E,A,S=(1-g)*e.len()/(.5*_.len()),j=0;do{S-=j,k=1/(1+S*b),x=1/(1+S*v),E=1/(1+S*w);const e=k*k,t=x*x,r=E*E;A=p*e+f*t+d*r-1;j=A/(-2*(p*(e*k)*b+f*(t*x)*v+d*(r*E)*w))}while(Math.abs(A)>Ys);return nu.scale([k,x,E]).to(r)}(e,this,t)}scaleToGeocentricSurface(e,t=[0,0,0]){yu.from(e);const r=yu.x,n=yu.y,i=yu.z,a=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*a.x+n*n*a.y+i*i*a.z);return yu.multiplyScalar(o).to(t)}transformPositionToScaledSpace(e,t=[0,0,0]){return yu.from(e).scale(this.oneOverRadii).to(t)}transformPositionFromScaledSpace(e,t=[0,0,0]){return yu.from(e).scale(this.radii).to(t)}getSurfaceNormalIntersectionWithZAxis(e,t=0,r=[0,0,0]){es(hs(this.radii.x,this.radii.y,$s)),es(this.radii.z>0),yu.from(e);const n=yu.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-t))return yu.set(0,0,n).to(r)}}const{_parseImageNode:ku}=globalThis,xu="undefined"!=typeof Image,Eu="undefined"!=typeof ImageBitmap,Au=Boolean(ku),Su=!!Pi||Au;function ju(e){const t=Cu(e);if(!t)throw new Error("Not an image");return t}function Tu(e){switch(ju(e)){case"data":return e;case"image":case"imagebitmap":const t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Cu(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"image":e&&"object"==typeof e&&e.data&&e.width&&e.height?"data":null}const Bu=/^data:image\/svg\+xml/,Ru=/\.svg((\?|#).*)?$/;function Ou(e){return e&&(Bu.test(e)||Ru.test(e))}function Iu(e,t){if(Ou(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Pu(e,t,r){const n=function(e,t){if(Ou(t)){let t=(new TextDecoder).decode(e);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(t=unescape(encodeURIComponent(t)))}catch(e){throw new Error(e.message)}return"data:image/svg+xml;base64,"+btoa(t)}return Iu(e,t)}(e,r),i=self.URL||self.webkitURL,a="string"!=typeof n&&i.createObjectURL(n);try{return await async function(e,t){const r=new Image;if(r.src=e,t.image&&t.image.decode&&r.decode)return await r.decode(),r;return await new Promise((t,n)=>{try{r.onload=()=>t(r),r.onerror=t=>n(new Error(`Could not load image ${e}: ${t}`))}catch(e){n(e)}})}(a||n,t)}finally{a&&i.revokeObjectURL(a)}}const Du={};let Mu=!0;async function Fu(e,t,r){let n;if(Ou(r)){n=await Pu(e,t,r)}else n=Iu(e,r);const i=t&&t.imagebitmap;return await async function(e,t=null){!function(e){for(const t in e||Du)return!1;return!0}(t)&&Mu||(t=null);if(t)try{return await createImageBitmap(e,t)}catch(e){console.warn(e),Mu=!1}return await createImageBitmap(e)}(n,i)}function Lu(e){const t=Nu(e);return function(e){const t=Nu(e);if(!(t.byteLength>=24&&2303741511===t.getUint32(0,!1)))return null;return{mimeType:"image/png",width:t.getUint32(16,!1),height:t.getUint32(20,!1)}}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=3&&65496===t.getUint16(0,!1)&&255===t.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let i=2;for(;i+9<t.byteLength;){const e=t.getUint16(i,!1);if(n.has(e))return{mimeType:"image/jpeg",height:t.getUint16(i+5,!1),width:t.getUint16(i+7,!1)};if(!r.has(e))return null;i+=2,i+=t.getUint16(i,!1)}return null}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=10&&1195984440===t.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:t.getUint16(6,!0),height:t.getUint16(8,!0)}}(t)||function(e){const t=Nu(e);if(!(t.byteLength>=14&&16973===t.getUint16(0,!1)&&t.getUint32(2,!0)===t.byteLength))return null;return{mimeType:"image/bmp",width:t.getUint32(18,!0),height:t.getUint32(22,!0)}}(t)}function Nu(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}const zu={id:"image",module:"images",name:"Images",version:"3.3.0-alpha.5",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(e,t,r){const n=((t=t||{}).image||{}).type||"auto",{url:i}=r||{};let a;switch(function(e){switch(e){case"auto":case"data":return function(){if(Eu)return"imagebitmap";if(xu)return"image";if(Su)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(e){switch(e){case"auto":return Eu||xu||Su;case"imagebitmap":return Eu;case"image":return xu;case"data":return Su;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}(e),e}}(n)){case"imagebitmap":a=await Fu(e,t,i);break;case"image":a=await Pu(e,t,i);break;case"data":a=await async function(e,t){const{mimeType:r}=Lu(e)||{},n=globalThis._parseImageNode;return Vi(n),await n(e,r)}(e);break;default:Vi(!1)}return"data"===n&&(a=Tu(a)),a},tests:[e=>Boolean(Lu(new DataView(e)))],options:{image:{type:"auto",decode:!0}}},Uu={draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}},qu={name:"Draco",id:ka?"draco":"draco-nodejs",module:"draco",shapes:["mesh"],version:"3.3.0-alpha.5",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:Uu};function Hu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Gu{constructor(e,t){Hu(this,"fields",void 0),Hu(this,"metadata",void 0),function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}(Array.isArray(e)),function(e){const t={};for(const r of e)t[r.name]&&console.warn("Schema: duplicated field name",r.name,r),t[r.name]=!0}(e),this.fields=e,this.metadata=t||new Map}compareTo(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(let t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}select(...e){const t=Object.create(null);for(const r of e)t[r]=!0;const r=this.fields.filter(e=>t[e.name]);return new Gu(r,this.metadata)}selectAt(...e){const t=e.map(e=>this.fields[e]).filter(Boolean);return new Gu(t,this.metadata)}assign(e){let t,r=this.metadata;if(e instanceof Gu){const n=e;t=n.fields,r=Vu(Vu(new Map,this.metadata),n.metadata)}else t=e;const n=Object.create(null);for(const e of this.fields)n[e.name]=e;for(const e of t)n[e.name]=e;const i=Object.values(n);return new Gu(i,r)}}function Vu(e,t){return new Map([...e||new Map,...t||new Map])}function Wu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ku{constructor(e,t,r=!1,n=new Map){Wu(this,"name",void 0),Wu(this,"type",void 0),Wu(this,"nullable",void 0),Wu(this,"metadata",void 0),this.name=e,this.type=t,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new Ku(this.name,this.type,this.nullable,this.metadata)}compareTo(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}toString(){return`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}let Ju,Qu,Yu,$u,Xu,Zu,ec,tc,rc;function nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(Ju||(Ju={}));class ic{static isNull(e){return e&&e.typeId===Ju.Null}static isInt(e){return e&&e.typeId===Ju.Int}static isFloat(e){return e&&e.typeId===Ju.Float}static isBinary(e){return e&&e.typeId===Ju.Binary}static isUtf8(e){return e&&e.typeId===Ju.Utf8}static isBool(e){return e&&e.typeId===Ju.Bool}static isDecimal(e){return e&&e.typeId===Ju.Decimal}static isDate(e){return e&&e.typeId===Ju.Date}static isTime(e){return e&&e.typeId===Ju.Time}static isTimestamp(e){return e&&e.typeId===Ju.Timestamp}static isInterval(e){return e&&e.typeId===Ju.Interval}static isList(e){return e&&e.typeId===Ju.List}static isStruct(e){return e&&e.typeId===Ju.Struct}static isUnion(e){return e&&e.typeId===Ju.Union}static isFixedSizeBinary(e){return e&&e.typeId===Ju.FixedSizeBinary}static isFixedSizeList(e){return e&&e.typeId===Ju.FixedSizeList}static isMap(e){return e&&e.typeId===Ju.Map}static isDictionary(e){return e&&e.typeId===Ju.Dictionary}get typeId(){return Ju.NONE}compareTo(e){return this===e}}Symbol.toStringTag;Symbol.toStringTag;Qu=Symbol.toStringTag;class ac extends ic{constructor(e,t){super(),nc(this,"isSigned",void 0),nc(this,"bitWidth",void 0),this.isSigned=e,this.bitWidth=t}get typeId(){return Ju.Int}get[Qu](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class oc extends ac{constructor(){super(!0,8)}}class sc extends ac{constructor(){super(!0,16)}}class uc extends ac{constructor(){super(!0,32)}}class cc extends ac{constructor(){super(!1,8)}}class lc extends ac{constructor(){super(!1,16)}}class hc extends ac{constructor(){super(!1,32)}}const pc=32,fc=64;Yu=Symbol.toStringTag;class dc extends ic{constructor(e){super(),nc(this,"precision",void 0),this.precision=e}get typeId(){return Ju.Float}get[Yu](){return"Float"}toString(){return"Float"+this.precision}}class mc extends dc{constructor(){super(pc)}}class gc extends dc{constructor(){super(fc)}}Symbol.toStringTag;Symbol.toStringTag;$u=Symbol.toStringTag;Xu=Symbol.toStringTag;Zu=Symbol.toStringTag;ec=Symbol.toStringTag;tc=Symbol.toStringTag;class yc extends ic{constructor(e,t){super(),nc(this,"listSize",void 0),nc(this,"children",void 0),this.listSize=e,this.children=[t]}get typeId(){return Ju.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[tc](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}rc=Symbol.toStringTag;function bc(e,t,r){const n=function(e){switch(e.constructor){case Int8Array:return new oc;case Uint8Array:return new cc;case Int16Array:return new sc;case Uint16Array:return new lc;case Int32Array:return new uc;case Uint32Array:return new hc;case Float32Array:return new mc;case Float64Array:return new gc;default:throw new Error("array type not supported")}}(t.value),i=r||function(e){const t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new Ku(e,new yc(t.size,new Ku("value",n)),!1,i)}function vc(e,t,r){return bc(e,t,r?wc(r.metadata):void 0)}function wc(e){const t=new Map;for(const r in e)t.set(r+".string",JSON.stringify(e[r]));return t}function _c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kc={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},xc={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Ec{constructor(e){_c(this,"draco",void 0),_c(this,"decoder",void 0),_c(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e,t={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(t);const n=this.decoder.GetEncodedGeometryType(r),i=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let e;switch(n){case this.draco.TRIANGULAR_MESH:e=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:e=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!e.ok()||!i.ptr){const t="DRACO decompression failed: "+e.error_msg();throw new Error(t)}const a=this._getDracoLoaderData(i,n,t),o=this._getMeshData(i,a,t),s=function(e){let t=1/0,r=1/0,n=1/0,i=-1/0,a=-1/0,o=-1/0;const s=e.POSITION?e.POSITION.value:[],u=s&&s.length;for(let e=0;e<u;e+=3){const u=s[e],c=s[e+1],l=s[e+2];t=u<t?u:t,r=c<r?c:r,n=l<n?l:n,i=u>i?u:i,a=c>a?c:a,o=l>o?l:o}return[[t,r,n],[i,a,o]]}(o.attributes),u=function(e,t,r){const n=wc(t.metadata),i=[],a=function(e){const t={};for(const r in e){const n=e[r];t[n.name||"undefined"]=n}return t}(t.attributes);for(const t in e){const r=vc(t,e[t],a[t]);i.push(r)}if(r){const e=vc("indices",r);i.push(e)}return new Gu(i,n)}(o.attributes,a,o.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:s},...o,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(e,t,r){const n=this._getTopLevelMetadata(e),i=this._getDracoAttributes(e,r);return{geometry_type:t,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:n,attributes:i}}_getDracoAttributes(e,t){const r={};for(let n=0;n<e.num_attributes();n++){const i=this.decoder.GetAttribute(e,n),a=this._getAttributeMetadata(e,n);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:n,metadata:a};const o=this._getQuantizationTransform(i,t);o&&(r[i.unique_id()].quantization_transform=o);const s=this._getOctahedronTransform(i,t);s&&(r[i.unique_id()].octahedron_transform=s)}return r}_getMeshData(e,t,r){const n=this._getMeshAttributes(t,e,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(e,t,r){const n={};for(const i of Object.values(e.attributes)){const e=this._deduceAttributeName(i,r);i.name=e;const{value:a,size:o}=this._getAttributeValues(t,i);n[e]={value:a,size:o,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return n}_getTriangleListIndices(e){const t=3*e.num_faces(),r=4*t,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(e,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,t).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(e){const t=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,t),function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(t)}finally{this.draco.destroy(t)}}_getAttributeValues(e,t){const r=xc[t.data_type],n=t.num_components,i=e.num_points()*n,a=i*r.BYTES_PER_ELEMENT,o=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}(this.draco,r);let s;const u=this.draco._malloc(a);try{const n=this.decoder.GetAttribute(e,t.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,n,o,a,u),s=new r(this.draco.HEAPF32.buffer,u,i).slice()}finally{this.draco._free(u)}return{value:s,size:n}}_deduceAttributeName(e,t){const r=e.unique_id;for(const[e,n]of Object.entries(t.extraAttributes||{}))if(n===r)return e;const n=e.attribute_type;for(const e in kc){if(this.draco[e]===n)return kc[e]}const i=t.attributeNameEntry||"name";return e.metadata[i]?e.metadata[i].string:"CUSTOM_ATTRIBUTE_"+r}_getTopLevelMetadata(e){const t=this.decoder.GetMetadata(e);return this._getDracoMetadata(t)}_getAttributeMetadata(e,t){const r=this.decoder.GetAttributeMetadata(e,t);return this._getDracoMetadata(r)}_getDracoMetadata(e){if(!e||!e.ptr)return{};const t={},r=this.metadataQuerier.NumEntries(e);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(e,n);t[r]=this._getDracoMetadataField(e,r)}return t}_getDracoMetadataField(e,t){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,t,r);const n=function(e){const t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(e,t),string:this.metadataQuerier.GetStringEntry(e,t),double:this.metadataQuerier.GetDoubleEntry(e,t),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(e){const{quantizedAttributes:t=[],octahedronAttributes:r=[]}=e,n=[...t,...r];for(const e of n)this.decoder.SkipAttributeTransform(this.draco[e])}_getQuantizationTransform(e,t){const{quantizedAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits(),range:t.range(),min_values:new Float32Array([1,2,3]).map(e=>t.min_value(e))}}finally{this.draco.destroy(t)}}return null}_getOctahedronTransform(e,t){const{octahedronAttributes:r=[]}=t,n=e.attribute_type();if(r.map(e=>this.decoder[e]).includes(n)){const t=new this.draco.AttributeQuantizationTransform;try{if(t.InitFromAttribute(e))return{quantization_bits:t.quantization_bits()}}finally{this.draco.destroy(t)}}return null}}var Ac=r(51);const Sc={};async function jc(e,t=null,r={}){return t&&(e=function(e,t,r){if(e.startsWith("http"))return e;const n=r.modules||{};if(n[e])return n[e];if(!ka)return`modules/${t}/dist/libs/${e}`;if(r.CDN)return va(r.CDN.startsWith("http")),`${r.CDN}/${t}@3.3.0-alpha.5/dist/libs/${e}`;if(xa)return"../src/libs/"+e;return`modules/${t}/src/libs/${e}`}(e,t,r)),Sc[e]=Sc[e]||async function(e){if(e.endsWith("wasm")){const t=await fetch(e);return await t.arrayBuffer()}if(!ka)try{return Ac&&Ac.requireFromFile&&await Ac.requireFromFile(e)}catch{return null}if(xa)return importScripts(e);const t=await fetch(e);return function(e,t){if(!ka)return Ac.requireFromString&&Ac.requireFromString(e,t);if(xa)return eval.call(_a,e),null;const r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch(t){r.text=e}return document.body.appendChild(r),null}(await t.text(),e)}(e),await Sc[e]}let Tc;async function Cc(e){const t=e.modules||{};return Tc=t.draco3d?Tc||t.draco3d.createDecoderModule({}).then(e=>({draco:e})):Tc||async function(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",e);break;case"wasm":default:[t,r]=await Promise.all([await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",e),await jc("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","draco",e)])}return t=t||globalThis.DracoDecoderModule,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e({...r,onModuleLoaded:e=>t({draco:e})})})}(t,r)}(e),await Tc}const Bc={id:ka?"draco-writer":"draco-writer-nodejs",name:"Draco compressed geometry writer",module:"draco",version:"3.3.0-alpha.5",worker:!0,options:{draco:{},source:null}},Rc={...qu,parse:async function(e,t){const{draco:r}=await Cc(t),n=new Ec(r);try{return n.parseSync(e,null==t?void 0:t.draco)}finally{n.destroy()}}};new Uint8Array([0]);const Oc=[171,75,84,88,32,50,48,187,13,10,26,10];var Ic,Pc,Dc,Mc,Fc,Lc,Nc,zc,Uc;(Uc=Ic||(Ic={}))[Uc.NONE=0]="NONE",Uc[Uc.BASISLZ=1]="BASISLZ",Uc[Uc.ZSTD=2]="ZSTD",Uc[Uc.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Pc||(Pc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Dc||(Dc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Mc||(Mc={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Fc||(Fc={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Lc||(Lc={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Nc||(Nc={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(zc||(zc={}));class qc{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Ic.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:Pc.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:Dc.UNSPECIFIED,colorPrimaries:Mc.SRGB,transferFunction:Mc.SRGB,flags:Lc.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class Hc{constructor(e,t,r,n){this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function Gc(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}function Vc(e,t){const r=new Array(t.mipMapLevels);let n=t.width,i=t.height,a=0;for(let o=0;o<t.mipMapLevels;++o){const s=Kc(t,n,i,e,o),u=Wc(e,o,a,s);r[o]={compressed:!0,format:t.internalFormat,data:u,width:n,height:i,levelSize:s},n=Math.max(1,n>>1),i=Math.max(1,i>>1),a+=s}return r}function Wc(e,t,r,n){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+r,n)}function Kc(e,t,r,n,i){return Array.isArray(n)?e.sizeFunction(n[i]):e.sizeFunction(t,r)}const Jc={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919},Qc={131:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Jc.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Jc.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Jc.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Jc.COMPRESSED_RED_RGTC1_EXT,140:Jc.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Jc.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Jc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Jc.COMPRESSED_RGB8_ETC2,148:Jc.COMPRESSED_SRGB8_ETC2,149:Jc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Jc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Jc.COMPRESSED_RGBA8_ETC2_EAC,152:Jc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Jc.COMPRESSED_R11_EAC,154:Jc.COMPRESSED_SIGNED_R11_EAC,155:Jc.COMPRESSED_RG11_EAC,156:Jc.COMPRESSED_SIGNED_RG11_EAC,157:Jc.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Jc.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Jc.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Jc.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Jc.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Jc.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Jc.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Jc.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Jc.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Jc.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Jc.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Jc.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Jc.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Jc.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Jc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Jc.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Jc.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Jc.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Jc.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Jc.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Jc.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Jc.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Jc.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Jc.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Jc.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Jc.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Jc.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Jc.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Jc.COMPRESSED_RGBA_ASTC_12x12_KHR};const Yc=[171,75,84,88,32,50,48,187,13,10,26,10];function $c(e){const t=new Uint8Array(e);return!(t.byteLength<Yc.length||t[0]!==Yc[0]||t[1]!==Yc[1]||t[2]!==Yc[2]||t[3]!==Yc[3]||t[4]!==Yc[4]||t[5]!==Yc[5]||t[6]!==Yc[6]||t[7]!==Yc[7]||t[8]!==Yc[8]||t[9]!==Yc[9]||t[10]!==Yc[10]||t[11]!==Yc[11])}function Xc(e){const t=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Oc.length);if(t[0]!==Oc[0]||t[1]!==Oc[1]||t[2]!==Oc[2]||t[3]!==Oc[3]||t[4]!==Oc[4]||t[5]!==Oc[5]||t[6]!==Oc[6]||t[7]!==Oc[7]||t[8]!==Oc[8]||t[9]!==Oc[9]||t[10]!==Oc[10]||t[11]!==Oc[11])throw new Error("Missing KTX 2.0 identifier.");const r=new qc,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Hc(e,Oc.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const a=i._nextUint32();r.supercompressionScheme=i._nextUint32();const o=i._nextUint32(),s=i._nextUint32(),u=i._nextUint32(),c=i._nextUint32(),l=i._nextUint64(),h=i._nextUint64(),p=new Hc(e,Oc.length+n,3*a*8,!0);for(let t=0;t<a;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const f=new Hc(e,o,s,!0),d={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:{x:f._nextUint8()+1,y:f._nextUint8()+1,z:f._nextUint8()+1,w:f._nextUint8()+1},bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},m=(d.descriptorBlockSize/4-6)/4;for(let e=0;e<m;e++)d.samples[e]={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelID:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:f._nextUint32(),sampleUpper:f._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(d);const g=new Hc(e,u,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),n=Gc(t),i=g._scan(e-t.byteLength);r.keyValue[n]=n.match(/^ktx/i)?Gc(i):i,e%4&&g._skip(4-e%4)}if(h<=0)return r;const y=new Hc(e,l,h,!0),b=y._nextUint16(),v=y._nextUint16(),w=y._nextUint32(),_=y._nextUint32(),k=y._nextUint32(),x=y._nextUint32(),E=[];for(let e=0;e<a;e++)E.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});const A=l+y._offset,S=A+w,j=S+_,T=j+k,C=new Uint8Array(e.buffer,e.byteOffset+A,w),B=new Uint8Array(e.buffer,e.byteOffset+S,_),R=new Uint8Array(e.buffer,e.byteOffset+j,k),O=new Uint8Array(e.buffer,e.byteOffset+T,x);return r.globalData={endpointCount:b,selectorCount:v,imageDescs:E,endpointsData:C,selectorsData:B,tablesData:R,extendedData:O},r}(new Uint8Array(e)),r=Math.max(1,t.levels.length),n=t.pixelWidth,i=t.pixelHeight,a=(o=t.vkFormat,Qc[o]);var o;return Vc(t.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:e=>e.uncompressedByteLength,internalFormat:a})}const Zc=542327876,el=31,tl=0,rl=1,nl=2,il=3,al=4,ol=7,sl=20,ul=21,cl=131072,ll=4,hl={DXT1:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Jc.COMPRESSED_RGB_ATC_WEBGL,ATCA:Jc.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Jc.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},pl={DXT1:dl,DXT3:ml,DXT5:ml,"ATC ":dl,ATCA:ml,ATCI:ml};function fl(e){const t=new Int32Array(e,0,el),r=t[ul];Vi(Boolean(t[sl]&ll),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const a=hl[n],o=pl[n];Vi(a&&o,"DDS: Unknown pixel format "+r);let s=1;t[nl]&cl&&(s=Math.max(1,t[ol]));const u=t[al],c=t[il],l=t[rl]+4;return Vc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}function dl(e,t){return(e+3>>2)*(t+3>>2)*8}function ml(e,t){return(e+3>>2)*(t+3>>2)*16}const gl=55727696,yl=1347834371,bl=13,vl=52,wl=0,_l=2,kl=4,xl=6,El=7,Al=11,Sl=12,jl={0:[Jc.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Jc.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Jc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Jc.COMPRESSED_RGB_ETC1_WEBGL],7:[Jc.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Jc.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Jc.COMPRESSED_RGB8_ETC2],23:[Jc.COMPRESSED_RGBA8_ETC2_EAC],24:[Jc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Jc.COMPRESSED_R11_EAC],26:[Jc.COMPRESSED_RG11_EAC],27:[Jc.COMPRESSED_RGBA_ASTC_4X4_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Jc.COMPRESSED_RGBA_ASTC_5X4_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Jc.COMPRESSED_RGBA_ASTC_5X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Jc.COMPRESSED_RGBA_ASTC_6X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Jc.COMPRESSED_RGBA_ASTC_6X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Jc.COMPRESSED_RGBA_ASTC_8X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Jc.COMPRESSED_RGBA_ASTC_8X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Jc.COMPRESSED_RGBA_ASTC_8X8_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Jc.COMPRESSED_RGBA_ASTC_10X5_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Jc.COMPRESSED_RGBA_ASTC_10X6_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Jc.COMPRESSED_RGBA_ASTC_10X8_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Jc.COMPRESSED_RGBA_ASTC_10X10_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Jc.COMPRESSED_RGBA_ASTC_12X10_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Jc.COMPRESSED_RGBA_ASTC_12X12_KHR,Jc.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Tl={0:Cl,1:Cl,2:Bl,3:Bl,6:Rl,7:Rl,9:Ol,11:Ol,22:Rl,23:Ol,24:Rl,25:Rl,26:Ol,27:Ol,28:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16},29:function(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16},30:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16},31:function(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16},32:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16},33:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16},34:function(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16},35:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16},36:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16},37:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16},38:function(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16},39:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16},40:function(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}};function Cl(e,t){return(e=Math.max(e,16))*(t=Math.max(t,8))/4}function Bl(e,t){return(e=Math.max(e,8))*(t=Math.max(t,8))/2}function Rl(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function Ol(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function Il(e){if($c(e))return Xc(e);if(function(e){return new Uint32Array(e,0,el)[tl]===Zc}(e))return fl(e);if(function(e){const t=new Uint32Array(e,0,bl)[wl];return t===gl||t===yl}(e))return function(e){const t=new Uint32Array(e,0,bl),r=t[_l],n=t[kl],i=jl[r]||[],a=i.length>1&&n?i[1]:i[0],o=Tl[r],s=t[Al],u=t[El],c=t[xl],l=vl+t[Sl];return Vc(new Uint8Array(e,l),{mipMapLevels:s,width:u,height:c,sizeFunction:o,internalFormat:a})}(e);throw new Error("Texture container format not recognized")}let Pl,Dl;async function Ml(e){const t=e.modules||{};return t.basis?t.basis:(Pl=Pl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await jc("basis_transcoder.js","textures",e),await jc("basis_transcoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,initializeBasis:n}=e;n(),t({BasisFile:r})})})}(t,r)}(e),await Pl)}async function Fl(e){const t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Dl=Dl||async function(e){let t=null,r=null;return[t,r]=await Promise.all([await jc("https://unpkg.com/@loaders.gl/textures@3.3.0-alpha.5/dist/libs/basis_encoder.js","textures",e),await jc("https://unpkg.com/@loaders.gl/textures@3.3.0-alpha.5/dist/libs/basis_encoder.wasm","textures",e)]),t=t||globalThis.BASIS,await function(e,t){const r={};t&&(r.wasmBinary=t);return new Promise(t=>{e(r).then(e=>{const{BasisFile:r,KTX2File:n,initializeBasis:i,BasisEncoder:a}=e;i(),t({BasisFile:r,KTX2File:n,BasisEncoder:a})})})}(t,r)}(e),await Dl)}const Ll=["","WEBKIT_","MOZ_"],Nl={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let zl=null;function Ul(e){if(!zl){e=e||function(){try{return document.createElement("canvas").getContext("webgl")}catch(e){return null}}()||void 0,zl=new Set;for(const t of Ll)for(const r in Nl)if(e&&e.getExtension(`${t}${r}`)){const e=Nl[r];zl.add(e)}}return zl}const ql={etc1:{basisFormat:0,compressed:!0,format:Jc.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Jc.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Jc.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Jc.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Jc.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Jc.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function Hl(e,t){if("auto"===t.basis.containerFormat){if($c(e)){return Wl((await Fl(t)).KTX2File,e,t)}const{BasisFile:r}=await Ml(t);return Gl(r,e,t)}switch(t.basis.module){case"encoder":const r=await Fl(t);switch(t.basis.containerFormat){case"ktx2":return Wl(r.KTX2File,e,t);case"basis":default:return Gl(r.BasisFile,e,t)}case"transcoder":default:const{BasisFile:n}=await Ml(t);return Gl(n,e,t)}}function Gl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");const e=n.getNumImages(),t=[];for(let i=0;i<e;i++){const e=n.getNumLevels(i),a=[];for(let t=0;t<e;t++)a.push(Vl(n,i,t,r));t.push(a)}return t}finally{n.close(),n.delete()}}function Vl(e,t,r,n){const i=e.getImageWidth(t,r),a=e.getImageHeight(t,r),o=e.getHasAlpha(),{compressed:s,format:u,basisFormat:c}=Jl(n,o),l=e.getImageTranscodedSizeInBytes(t,r,c),h=new Uint8Array(l);if(!e.transcodeImage(h,t,r,c,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:a,data:h,compressed:s,format:u,hasAlpha:o}}function Wl(e,t,r){const n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");const e=n.getLevels(),t=[];for(let i=0;i<e;i++){t.push(Kl(n,i,r));break}return[t]}finally{n.close(),n.delete()}}function Kl(e,t,r){const{alphaFlag:n,height:i,width:a}=e.getImageLevelInfo(t,0,0),{compressed:o,format:s,basisFormat:u}=Jl(r,n),c=e.getImageTranscodedSizeInBytes(t,0,0,u),l=new Uint8Array(c);if(!e.transcodeImage(l,t,0,0,u,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:a,height:i,data:l,compressed:o,hasAlpha:n,format:s}}function Jl(e,t){let r=e&&e.basis&&e.basis.format;return"auto"===r&&(r=Ql()),"object"==typeof r&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),ql[r]}function Ql(){const e=Ul();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}const Yl={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.3.0-alpha.5",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},$l={...Yl,parse:async(e,t)=>t["compressed-texture"].useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await Hl(e,t))[0]):Il(e)},Xl={name:"Basis",id:ka?"basis":"basis-nodejs",module:"textures",version:"3.3.0-alpha.5",worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},Zl={...Xl,parse:Hl};let eh,th;function rh(e,t=null){return t?`${e}?token=${t}`:e}!function(e){e.UInt8="UInt8",e.UInt16="UInt16",e.UInt32="UInt32",e.UInt64="UInt64",e.Int16="Int16",e.Int32="Int32",e.Int64="Int64",e.Float32="Float32",e.Float64="Float64"}(eh||(eh={})),function(e){e.vertexCount="vertexCount",e.featureCount="featureCount"}(th||(th={}));var nh=5121,ih=5125,ah=5126,oh=5130;function sh(e){switch(e){case eh.UInt8:return Uint8Array;case eh.UInt16:return Uint16Array;case eh.UInt32:return Uint32Array;case eh.Float32:return Float32Array;case eh.UInt64:return Float64Array;default:throw new Error("parse i3s tile content: unknown type of data: "+e)}}const uh={UInt8:nh,UInt16:ih,Float32:ah,UInt32:ih,UInt64:oh};function ch(e){switch(e){case eh.UInt8:return 1;case eh.UInt16:case eh.Int16:return 2;case eh.UInt32:case eh.Int32:case eh.Float32:return 4;case eh.UInt64:case eh.Int64:case eh.Float64:return 8;default:throw new Error("parse i3s tile content: unknown size of data: "+e)}}let lh;async function hh(e,t){const{attributeName:r,attributeType:n}=t;return r?{[r]:n?ph(n,e):null}:{}}function ph(e,t){switch(e){case"String":return function(e){const t=[];try{const r=new DataView(e,0,4).getUint32(0,!0),n=new Uint32Array(e,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),a=new Uint8Array(e,i,r);t.push(n.decode(a)),i+=r}}catch(e){console.error("Parse string attribute error: ",e.message)}return t}(t);case"Oid32":return fh(t);case"Float64":return function(e){return new Float64Array(e,8)}(t);case"Int16":return function(e){return new Int16Array(e,4)}(t);default:return fh(t)}}function fh(e){return new Uint32Array(e,4)}!function(e){e[e.DEFAULT=-1]="DEFAULT",e[e.LNGLAT=1]="LNGLAT",e[e.METER_OFFSETS=2]="METER_OFFSETS",e[e.LNGLAT_OFFSETS=3]="LNGLAT_OFFSETS",e[e.CARTESIAN=0]="CARTESIAN"}(lh||(lh={}));const dh={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.3.0-alpha.5",mimeTypes:["application/binary"],parse:async function(e,t){return e=hh(e,t)},extensions:["bin"],options:{},binary:!0};function mh(e){return e.hasOwnProperty("objectIds")?"Oid32":e.hasOwnProperty("attributeValues")?e.attributeValues.valueType:""}function gh(e,t){var r;if(null==t||null===(r=t.i3s)||void 0===r||!r.colorsByAttribute)return[255,255,255,255];const{minValue:n,maxValue:i,minColor:a,maxColor:o}=t.i3s.colorsByAttribute,s=(e-n)/(i-n),u=[255,255,255,255];for(let e=0;e<a.length;e++)u[e]=Math.round((o[e]-a[e])*s+a[e]);return u}async function yh(e,{attributeUrls:t},{attributeStorageInfo:r},n){var i;const a=r.findIndex(({name:t})=>e===t);if(-1===a)return null;const o=rh(t[a],null==n||null===(i=n.i3s)||void 0===i?void 0:i.token),s=mh(r[a]);return await Zo(o,dh,{attributeName:e,attributeType:s})}const bh=new Ds([0,0,0]);async function vh(e,t,r,n,i){const a={attributes:{},indices:null,featureIds:[],vertexCount:0,modelMatrix:new Js,coordinateSystem:0,byteLength:0,texture:null};if(t.textureUrl){var o;const e=rh(t.textureUrl,null==n||null===(o=n.i3s)||void 0===o?void 0:o.token),r=function(e){switch(e){case"ktx-etc2":case"dds":return $l;case"ktx2":return Zl;case"jpg":case"png":default:return zu}}(t.textureFormat),s=await fetch(e,null==n?void 0:n.fetch),u=await s.arrayBuffer();if(null!=n&&n.i3s.decodeTextures){if(r===zu){const e={...t.textureLoaderOptions,image:{type:"data"}};try{a.texture=await i.parse(u,e)}catch(t){a.texture=await Xo(u,r,e)}}else if(r===$l||r===Zl){let e=await Zo(u,r,t.textureLoaderOptions);r===Zl&&(e=e[0]),a.texture={compressed:!0,mipmaps:!1,width:e[0].width,height:e[0].height,data:e}}}else a.texture=u}return a.material=function(e,t){let r;e?r={...e,pbrMetallicRoughness:e.pbrMetallicRoughness?{...e.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},t?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=xh(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=xh(r.pbrMetallicRoughness.baseColorFactor));t&&function(e,t){const r={source:{image:t}};e.pbrMetallicRoughness&&e.pbrMetallicRoughness.baseColorTexture?e.pbrMetallicRoughness.baseColorTexture={...e.pbrMetallicRoughness.baseColorTexture,texture:r}:e.emissiveTexture?e.emissiveTexture={...e.emissiveTexture,texture:r}:e.pbrMetallicRoughness&&e.pbrMetallicRoughness.metallicRoughnessTexture?e.pbrMetallicRoughness.metallicRoughnessTexture={...e.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:e.normalTexture?e.normalTexture={...e.normalTexture,texture:r}:e.occlusionTexture&&(e.occlusionTexture={...e.occlusionTexture,texture:r})}(r,t);return r}(t.materialDefinition,a.texture),a.material&&(a.texture=null),await async function(e,t,r,n,i){var a;const o=e.byteLength;let s,u,c,l=0,h=0;if(r.isDracoGeometry){var p;const t=await Xo(e,Rc,{draco:{attributeNameEntry:"i3s-attribute-type"}});u=t.header.vertexCount,c=null===(p=t.indices)||void 0===p?void 0:p.value;const{POSITION:r,NORMAL:n,COLOR_0:i,TEXCOORD_0:a,"feature-index":o,"uv-region":l}=t.attributes;s={position:r,normal:n,color:i,uv0:a,uvRegion:l,id:o},function(e,t){for(const r in t.loaderData.attributes){const n=t.loaderData.attributes[r];switch(n.name){case"POSITION":e.position.metadata=n.metadata;break;case"feature-index":e.id.metadata=n.metadata}}}(s,t);const h=function(e){var t,r;return null==e||null===(t=e.metadata)||void 0===t||null===(r=t["i3s-feature-ids"])||void 0===r?void 0:r.intArray}(o);h&&function(e,t){const r=e.id.value,n=new Float32Array(r.length);for(let e=0;e<r.length;e++)n[e]=t[r[e]];e.id.value=n}(s,h)}else{const{vertexAttributes:t,ordering:r,featureAttributes:i,featureAttributeOrder:a}=n.store.defaultGeometrySchema,o=function(e,t){let r=0,n=0,i=0;for(const{property:a,type:o}of t.store.defaultGeometrySchema.header){const t=sh(o);switch(a){case th.vertexCount:n=new t(e,0,4)[0],r+=ch(o);break;case th.featureCount:i=new t(e,4,4)[0],r+=ch(o)}}return{vertexCount:n,featureCount:i,byteOffset:r}}(e,n);l=o.byteOffset,u=o.vertexCount,h=o.featureCount;const{attributes:c,byteOffset:p}=_h(e,l,t,u,r),{attributes:f}=_h(e,p,i,h,a);!function(e){const{id:t,faceRange:r}=e;if(!t||!r)return;const n=t.value,i=r.value,a=i[i.length-1]+1,o=new Uint32Array(3*a);let s=0,u=0;for(let e=1;e<i.length;e+=2){const t=Number(n[s]),r=i[e],a=i[e-1],c=u+3*(r-a+1);o.fill(t,u,c),s++,u=c}e.id.value=o}(f),s=function(e,t){return{...e,...t}}(c,f)}if(null!=i&&null!==(a=i.i3s)&&void 0!==a&&a.coordinateSystem&&i.i3s.coordinateSystem!==lh.METER_OFFSETS)t.modelMatrix=function(e){var t,r;const n=e.metadata,i=(null==n||null===(t=n["i3s-scale_x"])||void 0===t?void 0:t.double)||1,a=(null==n||null===(r=n["i3s-scale_y"])||void 0===r?void 0:r.double)||1,o=new Js;return o[0]=i,o[5]=a,o}(s.position),t.coordinateSystem=lh.LNGLAT_OFFSETS;else{const e=function(e,t){const r=t.mbs,n=e.value,i=e.metadata,a=new Js,o=new Ds(r[0],r[1],r[2]),s=new Ds;return _u.WGS84.cartographicToCartesian(o,s),_u.WGS84.eastNorthUpToFixedFrame(s,a),e.value=function(e,t={},r){const n=new Float64Array(e.length),i=t["i3s-scale_x"]&&t["i3s-scale_x"].double||1,a=t["i3s-scale_y"]&&t["i3s-scale_y"].double||1;for(let t=0;t<n.length;t+=3)n[t]=e[t]*i+r.x,n[t+1]=e[t+1]*a+r.y,n[t+2]=e[t+2]+r.z;for(let e=0;e<n.length;e+=3)_u.WGS84.cartographicToCartesian(n.subarray(e,e+3),bh),n[e]=bh.x,n[e+1]=bh.y,n[e+2]=bh.z;return n}(n,i,o),a}(s.position,r);t.modelMatrix=e.invert(),t.coordinateSystem=lh.METER_OFFSETS}s.color=await async function(e,t,r,n,i){var a;if(null==i||null===(a=i.i3s)||void 0===a||!a.colorsByAttribute)return e;const o=n.fields.find(({name:e})=>{var t,r;return e===(null==i||null===(t=i.i3s)||void 0===t||null===(r=t.colorsByAttribute)||void 0===r?void 0:r.attributeName)});if(!o||!["esriFieldTypeDouble","esriFieldTypeInteger","esriFieldTypeSmallInteger"].includes(o.type))return e;const s=await yh(o.name,r,n,i);if(!s)return e;const u=n.fields.find(({type:e})=>"esriFieldTypeOID"===e);if(!u)return e;const c=await yh(u.name,r,n,i);if(!c)return e;const l={};for(let e=0;e<c[u.name].length;e++)l[c[u.name][e]]=gh(s[o.name][e],i);for(let r=0;r<t.value.length;r++){const n=l[t.value[r]];n&&e.value.set(n,4*r)}return e}(s.color,s.id,r,n,i),t.attributes={positions:s.position,normals:s.normal,colors:wh(s.color),texCoords:s.uv0,uvRegions:wh(s.uvRegion)},t.indices=c||null,s.id&&s.id.value&&(t.featureIds=s.id.value);for(const e in t.attributes)t.attributes[e]||delete t.attributes[e];return t.vertexCount=u,t.byteLength=o,t}(e,a,t,r,n)}function wh(e){return e?(e.normalized=!0,e):e}function _h(e,t,r,n,i){const a={};for(const o of i)if(r[o]){const{valueType:i,valuesPerElement:s}=r[o];if(t+n*s*ch(i)<=e.byteLength){const r=e.slice(t);let u;if("UInt64"===i)u=kh(r,n*s,ch(i));else{u=new(sh(i))(r,0,n*s)}switch(a[o]={value:u,type:uh[i],size:s},o){case"color":a.color.normalized=!0}t+=n*s*ch(i)}else if("uv0"!==o)break}return{attributes:a,byteOffset:t}}function kh(e,t,r){const n=[],i=new DataView(e);let a=0;for(let e=0;e<t;e++){const e=i.getUint32(a,!0)+2**32*i.getUint32(a+4,!0);n.push(e),a+=r}return new Uint32Array(n)}function xh(e){const t=[...e];for(let r=0;r<e.length;r++)t[r]=e[r]/255;return t}const Eh={name:"I3S Content (Indexed Scene Layers)",id:ka?"i3s-content":"i3s-content-nodejs",module:"i3s",worker:!0,version:"3.3.0-alpha.5",mimeTypes:["application/octet-stream"],parse:async function(e,t,r){const{tile:n,_tileOptions:i,tileset:a,_tilesetOptions:o}=(null==t?void 0:t.i3s)||{},s=i||n,u=o||a;if(!s||!u)return null;return await vh(e,s,u,t,r)},extensions:["bin"],options:{"i3s-content":{}}};const Ah=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new Ds,new Ds;const Sh=new Ds,jh=new Ds;class Th{constructor(e=[0,0,0],t=0){this.radius=-0,this.center=new Ds,this.fromCenterRadius(e,t)}fromCenterRadius(e,t){return this.center.from(e),this.radius=t,this}fromCornerPoints(e,t){return t=Sh.from(t),this.center=(new Ds).from(e).add(t).scale(.5),this.radius=this.center.distance(t),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Th(this.center,this.radius)}union(e){const t=this.center,r=this.radius,n=e.center,i=e.radius,a=Sh.copy(n).subtract(t),o=a.magnitude();if(r>=o+i)return this.clone();if(i>=o+r)return e.clone();const s=.5*(r+o+i);return jh.copy(a).scale((-r+s)/o).add(t),this.center.copy(jh),this.radius=s,this}expand(e){const t=(e=Sh.from(e)).subtract(this.center).magnitude();return t>this.radius&&(this.radius=t),this}transform(e){this.center.transform(e);const t=Ns(Sh,e);return this.radius=Math.max(t[0],Math.max(t[1],t[2]))*this.radius,this}distanceSquaredTo(e){return(e=Sh.from(e)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}intersectPlane(e){const t=this.center,r=this.radius,n=e.normal.dot(t)+e.distance;return n<-r?Ah.OUTSIDE:n<r?Ah.INTERSECTING:Ah.INSIDE}}function Ch(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],p=r[0],f=r[1],d=r[2],m=r[3],g=r[4],y=r[5],b=r[6],v=r[7],w=r[8];return e[0]=p*n+f*o+d*c,e[1]=p*i+f*s+d*l,e[2]=p*a+f*u+d*h,e[3]=m*n+g*o+y*c,e[4]=m*i+g*s+y*l,e[5]=m*a+g*u+y*h,e[6]=b*n+v*o+w*c,e[7]=b*i+v*s+w*l,e[8]=b*a+v*u+w*h,e}function Bh(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}const Rh=Object.freeze([1,0,0,0,1,0,0,0,1]),Oh=Object.freeze([0,0,0,0,0,0,0,0,0]),Ih=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Ph={};class Dh extends Ms{static get IDENTITY(){return Ph.IDENTITY=Ph.IDENTITY||Object.freeze(new Dh(Rh)),Ph.IDENTITY}static get ZERO(){return Ph.ZERO=Ph.ZERO||Object.freeze(new Dh(Oh)),Ph.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Ih}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}set(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this[4]=i,this[5]=a,this[6]=o,this[7]=s,this[8]=u,this.check()}setRowMajor(e,t,r,n,i,a,o,s,u){return this[0]=e,this[1]=n,this[2]=o,this[3]=t,this[4]=i,this[5]=s,this[6]=r,this[7]=a,this[8]=u,this.check()}determinant(){return t=(e=this)[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s);var e,t,r,n,i,a,o,s,u,c}identity(){return this.copy(Rh)}fromQuaternion(e){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,h=n*s,p=i*o,f=i*s,d=i*u,m=a*o,g=a*s,y=a*u;e[0]=1-h-d,e[3]=l-y,e[6]=p+g,e[1]=l+y,e[4]=1-c-d,e[7]=f-m,e[2]=p-g,e[5]=f+m,e[8]=1-c-h}(this,e),this.check()}transpose(){return function(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else 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,this),this.check()}invert(){var e,t,r,n,i,a,o,s,u,c,l,h,p,f,d;return e=this,r=(t=this)[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],(d=r*(h=l*o-s*c)+n*(p=-l*a+s*u)+i*(f=c*a-o*u))&&(d=1/d,e[0]=h*d,e[1]=(-l*n+i*c)*d,e[2]=(s*n-i*o)*d,e[3]=p*d,e[4]=(l*r-i*u)*d,e[5]=(-s*r+i*a)*d,e[6]=f*d,e[7]=(-c*r+n*u)*d,e[8]=(o*r-n*a)*d),this.check()}multiplyLeft(e){return Ch(this,e,this),this.check()}multiplyRight(e){return Ch(this,this,e),this.check()}rotate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=Math.sin(n),d=Math.cos(n),t[0]=d*i+f*s,t[1]=d*a+f*u,t[2]=d*o+f*c,t[3]=d*s-f*i,t[4]=d*u-f*a,t[5]=d*c-f*o,t[6]=l,t[7]=h,t[8]=p,this.check()}scale(e){return Array.isArray(e)?Bh(this,this,e):Bh(this,this,[e,e,e]),this.check()}translate(e){var t,r,n,i,a,o,s,u,c,l,h,p,f,d;return t=this,n=e,i=(r=this)[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],p=r[8],f=n[0],d=n[1],t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=u,t[5]=c,t[6]=f*i+d*s+l,t[7]=f*a+d*u+h,t[8]=f*o+d*c+p,this.check()}transform(e,t){switch(e.length){case 2:t=zs(t||[-0,-0],e,this);break;case 3:t=Ss(t||[-0,-0,-0],e,this);break;case 4:t=Os(t||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return ds(t,e.length),t}transformVector(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}transformVector2(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}transformVector3(e,t){return gs("Matrix3.transformVector"),this.transform(e,t)}}function Mh(){var e=new vs(4);return vs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Fh(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Lh(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function Nh(e,t,r,n){var i,a,o,s,u,c=t[0],l=t[1],h=t[2],p=t[3],f=r[0],d=r[1],m=r[2],g=r[3];return(a=c*f+l*d+h*m+p*g)<0&&(a=-a,f=-f,d=-d,m=-m,g=-g),1-a>bs?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*c+u*f,e[1]=s*l+u*d,e[2]=s*h+u*m,e[3]=s*p+u*g,e}function zh(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e}var Uh,qh,Hh,Gh,Vh,Wh,Kh,Jh=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},Qh=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},Yh=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},$h=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},Xh=qs,Zh=Hs,ep=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o,e},tp=(Uh=ws(),qh=ks(1,0,0),Hh=ks(0,1,0),function(e,t,r){var n=xs(t,r);return n<-.999999?(Es(Uh,qh,t),Cs(Uh)<1e-6&&Es(Uh,Hh,t),function(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a}(Uh,Uh),Fh(e,Uh,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Es(Uh,t,r),e[0]=Uh[0],e[1]=Uh[1],e[2]=Uh[2],e[3]=1+n,ep(e,e))});Gh=Mh(),Vh=Mh(),Wh=new vs(9),vs!=Float32Array&&(Wh[1]=0,Wh[2]=0,Wh[3]=0,Wh[5]=0,Wh[6]=0,Wh[7]=0),Wh[0]=1,Wh[4]=1,Wh[8]=1,Kh=Wh;const rp=[0,0,0,1];class np extends ps{constructor(e=0,t=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(e)&&1===arguments.length?this.copy(e):this.set(e,t,r,n)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this.check()}fromMatrix3(e){return zh(this,e),this.check()}identity(){return function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1}(this),this.check()}fromAxisRotation(e,t){return Fh(this,e,t),this.check()}setAxisAngle(e,t){return this.fromAxisRotation(e,t)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=fs(e)}get y(){return this[1]}set y(e){this[1]=fs(e)}get z(){return this[2]}set z(e){this[2]=fs(e)}get w(){return this[3]}set w(e){this[3]=fs(e)}len(){return Xh(this)}lengthSquared(){return Zh(this)}dot(e,t){if(void 0!==t)throw new Error("Quaternion.dot only takes one argument");return Yh(this,e)}rotationTo(e,t){return tp(this,e,t),this.check()}add(e,t){if(void 0!==t)throw new Error("Quaternion.add only takes one argument");return Jh(this,this,e),this.check()}calculateW(){return function(e,t){var r=t[0],n=t[1],i=t[2];e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(this,this),this.check()}conjugate(){return function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3]}(this,this),this.check()}invert(){return function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s}(this,this),this.check()}lerp(e,t,r){return $h(this,e,t,r),this.check()}multiplyRight(e,t){return es(!t),Lh(this,this,e),this.check()}multiplyLeft(e,t){return es(!t),Lh(this,e,this),this.check()}normalize(){const e=this.len(),t=e>0?1/e:0;return this[0]=this[0]*t,this[1]=this[1]*t,this[2]=this[2]*t,this[3]=this[3]*t,0===e&&(this[3]=1),this.check()}rotateX(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s}(this,this,e),this.check()}rotateY(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s}(this,this,e),this.check()}rotateZ(e){return function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s}(this,this,e),this.check()}scale(e){return Qh(this,this,e),this.check()}slerp(e,t,r){switch(arguments.length){case 1:({start:e=rp,target:t,ratio:r}=arguments[0]);break;case 2:[t,r]=arguments,e=this}return Nh(this,e,t,r),this.check()}transformVector4(e,t=e){return function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,h=c*i+u*n-o*a,p=c*a+o*i-s*n,f=-o*n-s*i-u*a;e[0]=l*c+f*-o+h*-u-p*-s,e[1]=h*c+f*-s+p*-o-l*-u,e[2]=p*c+f*-u+l*-s-h*-o,e[3]=t[3]}(t,e,this),ds(t,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,t){return this.setAxisAngle(e,t)}premultiply(e,t){return this.multiplyLeft(e,t)}multiply(e,t){return this.multiplyRight(e,t)}}const ip=new Ds,ap=new Ds,op=new Ds,sp=new Ds,up=new Ds,cp=new Ds,lp=new Ds,hp=0,pp=1,fp=2,dp=3,mp=4,gp=5,yp=6,bp=7,vp=8;class wp{constructor(e=[0,0,0],t=[0,0,0,0,0,0,0,0,0]){this.center=(new Ds).from(e),this.halfAxes=new Dh(t)}get halfSize(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new Ds(e).len(),new Ds(t).len(),new Ds(r).len()]}get quaternion(){const e=this.halfAxes.getColumn(0),t=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new Ds(e).normalize(),i=new Ds(t).normalize(),a=new Ds(r).normalize();return(new np).fromMatrix3(new Dh([...n,...i,...a]))}fromCenterHalfSizeQuaternion(e,t,r){const n=new np(r),i=(new Dh).fromQuaternion(n);return i[0]=i[0]*t[0],i[1]=i[1]*t[0],i[2]=i[2]*t[0],i[3]=i[3]*t[1],i[4]=i[4]*t[1],i[5]=i[5]*t[1],i[6]=i[6]*t[2],i[7]=i[7]*t[2],i[8]=i[8]*t[2],this.center=(new Ds).from(e),this.halfAxes=i,this}clone(){return new wp(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Th){const t=this.halfAxes,r=t.getColumn(0,op),n=t.getColumn(1,sp),i=t.getColumn(2,up),a=ip.copy(r).add(n).add(i);return e.center.copy(this.center),e.radius=a.magnitude(),e}intersectPlane(e){const t=this.center,r=e.normal,n=this.halfAxes,i=r.x,a=r.y,o=r.z,s=Math.abs(i*n[hp]+a*n[pp]+o*n[fp])+Math.abs(i*n[dp]+a*n[mp]+o*n[gp])+Math.abs(i*n[yp]+a*n[bp]+o*n[vp]),u=r.dot(t)+e.distance;return u<=-s?Ah.OUTSIDE:u>=s?Ah.INSIDE:Ah.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){const t=ap.from(e).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,op),i=r.getColumn(1,sp),a=r.getColumn(2,up),o=n.magnitude(),s=i.magnitude(),u=a.magnitude();n.normalize(),i.normalize(),a.normalize();let c,l=0;return c=Math.abs(t.dot(n))-o,c>0&&(l+=c*c),c=Math.abs(t.dot(i))-s,c>0&&(l+=c*c),c=Math.abs(t.dot(a))-u,c>0&&(l+=c*c),l}computePlaneDistances(e,t,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const a=this.center,o=this.halfAxes,s=o.getColumn(0,op),u=o.getColumn(1,sp),c=o.getColumn(2,up),l=cp.copy(s).add(u).add(c).add(a),h=lp.copy(l).subtract(e);let p=t.dot(h);return n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),l.copy(a).add(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).add(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).add(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),a.copy(l).subtract(s).subtract(u).subtract(c),h.copy(l).subtract(e),p=t.dot(h),n=Math.min(p,n),i=Math.max(p,i),r[0]=n,r[1]=i,r}transform(e){this.center.transformAsPoint(e);const t=this.halfAxes.getColumn(0,op);t.transformAsPoint(e);const r=this.halfAxes.getColumn(1,sp);r.transformAsPoint(e);const n=this.halfAxes.getColumn(2,up);return n.transformAsPoint(e),this.halfAxes=new Dh([...t,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const _p=new Ds,kp=new Ds;class xp{constructor(e=[0,0,1],t=0){this.normal=new Ds,this.distance=-0,this.fromNormalDistance(e,t)}fromNormalDistance(e,t){return es(Number.isFinite(t)),this.normal.from(e).normalize(),this.distance=t,this}fromPointNormal(e,t){e=_p.from(e),this.normal.from(t).normalize();const r=-this.normal.dot(e);return this.distance=r,this}fromCoefficients(e,t,r,n){return this.normal.set(e,t,r),es(hs(this.normal.len(),1)),this.distance=n,this}clone(e){return new xp(this.normal,this.distance)}equals(e){return hs(this.distance,e.distance)&&hs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){const t=kp.copy(this.normal).transformAsVector(e).normalize(),r=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(r,t)}projectPointOntoPlane(e,t=[0,0,0]){e=_p.from(e);const r=this.getPointDistance(e),n=kp.copy(this.normal).scale(r);return e.subtract(n).to(t)}}const Ep=[new Ds([1,0,0]),new Ds([0,1,0]),new Ds([0,0,1])],Ap=new Ds,Sp=new Ds;new xp(new Ds(1,0,0),0);class jp{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(e=[]){this.planes=e,es(this.planes.every(e=>e instanceof xp))}fromBoundingSphere(e){this.planes.length=2*Ep.length;const t=e.center,r=e.radius;let n=0;for(const e of Ep){let i=this.planes[n],a=this.planes[n+1];i||(i=this.planes[n]=new xp),a||(a=this.planes[n+1]=new xp);const o=Ap.copy(e).scale(-r).add(t);e.dot(o);i.fromPointNormal(o,e);const s=Ap.copy(e).scale(r).add(t),u=Sp.copy(e).negate();u.dot(s);a.fromPointNormal(s,u),n+=2}return this}computeVisibility(e){es(e);let t=Ah.INSIDE;for(const r of this.planes){switch(e.intersectPlane(r)){case Ah.OUTSIDE:return Ah.OUTSIDE;case Ah.INTERSECTING:t=Ah.INTERSECTING}}return t}computeVisibilityWithPlaneMask(e,t){if(es(e,"boundingVolume is required."),es(Number.isFinite(t),"parentPlaneMask is required."),t===jp.MASK_OUTSIDE||t===jp.MASK_INSIDE)return t;let r=jp.MASK_INSIDE;const n=this.planes;for(let i=0;i<this.planes.length;++i){const a=i<31?1<<i:0;if(i<31&&0==(t&a))continue;const o=n[i],s=e.intersectPlane(o);if(s===Ah.OUTSIDE)return jp.MASK_OUTSIDE;s===Ah.INTERSECTING&&(r|=a)}return r}}new Ds,new Ds,new Ds,new Ds,new Ds;const Tp=new Ds,Cp=new Ds,Bp=new Ds,Rp=new Ds,Op=new Ds,Ip=new Ds,Pp=new Ds,Dp=new Ds,Mp=new Ds,Fp=new Ds,Lp=new Ds,Np=new Ds;Math.PI;const zp=new Dh,Up=new Dh,qp=new Dh,Hp=new Dh,Gp=new Dh;function Vp(e,t={}){const r=Xs;let n=0,i=0;const a=Up,o=qp;a.identity(),o.copy(e);const s=r*function(e){let t=0;for(let r=0;r<9;++r){const n=e[r];t+=n*n}return Math.sqrt(t)}(o);for(;i<10&&Jp(o)>s;)Qp(o,Hp),Gp.copy(Hp).transpose(),o.multiplyRight(Hp),o.multiplyLeft(Gp),a.multiplyRight(Hp),++n>2&&(++i,n=0);return t.unitary=a.toTarget(t.unitary),t.diagonal=o.toTarget(t.diagonal),t}const Wp=[1,0,0],Kp=[2,2,1];function Jp(e){let t=0;for(let r=0;r<3;++r){const n=e[zp.getElementIndex(Kp[r],Wp[r])];t+=2*n*n}return Math.sqrt(t)}function Qp(e,t){const r=$s;let n=0,i=1;for(let t=0;t<3;++t){const r=Math.abs(e[zp.getElementIndex(Kp[t],Wp[t])]);r>n&&(i=t,n=r)}const a=Wp[i],o=Kp[i];let s=1,u=0;if(Math.abs(e[zp.getElementIndex(o,a)])>r){const t=(e[zp.getElementIndex(o,o)]-e[zp.getElementIndex(a,a)])/2/e[zp.getElementIndex(o,a)];let r;r=t<0?-1/(-t+Math.sqrt(1+t*t)):1/(t+Math.sqrt(1+t*t)),s=1/Math.sqrt(1+r*r),u=r*s}return Dh.IDENTITY.to(t),t[zp.getElementIndex(a,a)]=t[zp.getElementIndex(o,o)]=s,t[zp.getElementIndex(o,a)]=u,t[zp.getElementIndex(a,o)]=-u,t}const Yp=new Ds,$p=new Ds,Xp=new Ds,Zp=new Ds,ef=new Ds,tf=new Dh,rf={diagonal:new Dh,unitary:new Dh};const nf=0,af=1,of=3,sf=4,uf=5,cf=1,lf=2,hf="empty",pf="scenegraph",ff="pointcloud",df="mesh",mf="I3S",gf="TILES3D",yf="geometricError",bf=1;async function vf(e){return JSON.parse((new TextDecoder).decode(e))}const wf={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.3.0-alpha.5",mimeTypes:["application/json"],parse:async function(e){return e=vf(e)},extensions:["json"],options:{}};function _f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class kf{constructor(e,t){var r,n;_f(this,"tileset",void 0),_f(this,"nodePages",[]),_f(this,"pendingNodePages",[]),_f(this,"nodesPerPage",void 0),_f(this,"options",void 0),_f(this,"lodSelectionMetricType",void 0),_f(this,"textureDefinitionsSelectedFormats",[]),_f(this,"nodesInNodePages",void 0),_f(this,"textureLoaderOptions",{}),this.tileset={...e},this.nodesPerPage=(null===(r=e.nodePages)||void 0===r?void 0:r.nodesPerPage)||64,this.lodSelectionMetricType=null===(n=e.nodePages)||void 0===n?void 0:n.lodSelectionMetricType,this.options=t,this.nodesInNodePages=0,this.initSelectedFormatsForTextureDefinitions(e)}async getNodeById(e){const t=Math.floor(e/this.nodesPerPage);if(!this.nodePages[t]&&!this.pendingNodePages[t]){var r;const e=rh(`${this.tileset.url}/nodepages/${t}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.pendingNodePages[t]={status:"Pending",promise:Zo(e,wf,this.options)},this.nodePages[t]=await this.pendingNodePages[t].promise,this.nodesInNodePages+=this.nodePages[t].nodes.length,this.pendingNodePages[t].status="Done"}"Pending"===this.pendingNodePages[t].status&&(this.nodePages[t]=await this.pendingNodePages[t].promise);const n=e%this.nodesPerPage;return this.nodePages[t].nodes[n]}async formTileFromNodePages(e){const t=await this.getNodeById(e),r=[],n=[];for(const e of t.children||[])n.push(this.getNodeById(e));const i=await Promise.all(n);for(const e of i)r.push({id:e.index.toString(),obb:e.obb});let a,o,s,u="jpg",c=[],l=!1;if(t&&t.mesh){const{url:e,isDracoGeometry:r}=t.mesh.geometry&&this.getContentUrl(t.mesh.geometry)||{isDracoGeometry:!1};a=e,l=r;const{textureData:n,materialDefinition:i}=this.getInformationFromMaterial(t.mesh.material);s=i,u=n.format||u,n.name&&(o=`${this.tileset.url}/nodes/${t.mesh.material.resource}/textures/${n.name}`),this.tileset.attributeStorageInfo&&(c=function(e,t){const r=[],{attributeStorageInfo:n,url:i}=e;for(let e=0;e<n.length;e++){const a=n[e].key;r.push(`${i}/nodes/${t}/attributes/${a}/0`)}return r}(this.tileset,t.mesh.attribute.resource))}const h=this.getLodSelection(t);return xf({id:e.toString(),lodSelection:h,obb:t.obb,contentUrl:a,textureUrl:o,attributeUrls:c,materialDefinition:s,textureFormat:u,textureLoaderOptions:this.textureLoaderOptions,children:r,isDracoGeometry:l})}getContentUrl(e){let t=null;const r=this.tileset.geometryDefinitions[e.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(e=>e.compressedAttributes&&"draco"===e.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(e=>!e.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);t={url:`${this.tileset.url}/nodes/${e.resource}/geometries/${n}`,isDracoGeometry:i}}return t}getLodSelection(e){const t=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&t.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(e.lodThreshold/(.25*Math.PI))}),t.push({metricType:this.lodSelectionMetricType,maxError:e.lodThreshold}),t}getInformationFromMaterial(e){const t={textureData:{name:null}};if(e){var r;const a=null===(r=this.tileset.materialDefinitions)||void 0===r?void 0:r[e.definition];if(a){var n,i;t.materialDefinition=a;const e=null==a||null===(n=a.pbrMetallicRoughness)||void 0===n||null===(i=n.baseColorTexture)||void 0===i?void 0:i.textureSetDefinitionId;"number"==typeof e&&(t.textureData=this.textureDefinitionsSelectedFormats[e]||t.textureData)}}return t}initSelectedFormatsForTextureDefinitions(e){this.textureDefinitionsSelectedFormats=[];const t=this.getSupportedTextureFormats(),r=e.textureSetDefinitions||[];for(const e of r){const r=e&&e.formats||[];let n=null;for(const e of t){const t=r.find(t=>t.format===e);if(t){n=t;break}}n&&"ktx2"===n.format&&(this.textureLoaderOptions.basis={format:Ql(),containerFormat:"ktx2",module:"encoder"}),this.textureDefinitionsSelectedFormats.push(n)}}getSupportedTextureFormats(){const e=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const t=Ul();t.has("etc2")&&e.push("ktx-etc2"),t.has("dxt")&&e.push("dds"),e.push("ktx2")}return e.push("jpg"),e.push("png"),e}}function xf(e){var t,r;const n={};let i=[0,0,0,1];if(e.mbs)i=e.mbs,n.sphere=[..._u.WGS84.cartographicToCartesian(e.mbs.slice(0,3)),e.mbs[3]];else if(e.obb){n.box=[..._u.WGS84.cartographicToCartesian(e.obb.center),...e.obb.halfSize,...e.obb.quaternion];const t=(new wp).fromCenterHalfSizeQuaternion(n.box.slice(0,3),e.obb.halfSize,e.obb.quaternion).getBoundingSphere();n.sphere=[...t.center,t.radius],i=[...e.obb.center,t.radius]}const a=null===(t=e.lodSelection)||void 0===t?void 0:t[0].metricType,o=null===(r=e.lodSelection)||void 0===r?void 0:r[0].maxError,s=e.transform,u=df,c=lf;return{...e,mbs:i,boundingVolume:n,lodMetricType:a,lodMetricValue:o,transformMatrix:s,type:u,refine:c}}const Ef=/layers\/[0-9]+$/,Af=/nodes\/([0-9-]+|root)$/,Sf={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.3.0-alpha.5",mimeTypes:["application/octet-stream"],parse:async function(e,t={},r){const n=r.url;t.i3s=t.i3s||{};if("504b0304"===function(e){if(e instanceof ArrayBuffer)return[...new Uint8Array(e,0,4)].map(e=>e.toString(16).padStart(2,"0")).join("");return null}(e))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i,a;i="auto"===t.i3s.isTileset?Ef.test(n):t.i3s.isTileset;a="auto"===t.isTileHeader?Af.test(n):t.i3s.isTileHeader;e=i?await async function(e,t,r){const n=JSON.parse((new TextDecoder).decode(e));return n.loader=Sf,await async function(e,t,r){if(e.url=r.url,e.nodePages)e.nodePagesTile=new kf(e,t),e.root=e.nodePagesTile.formTileFromNodePages(0);else{var n;const r=rh(e.url+"/nodes/root",null===(n=t.i3s)||void 0===n?void 0:n.token);e.root=await Zo(r,e.loader,{...t,i3s:{...t.i3s,loadContent:!1,isTileHeader:!0,isTileset:!1}})}e.basePath=e.url,e.type=mf,e.lodMetricType=e.root.lodMetricType,e.lodMetricValue=e.root.lodMetricValue}(n,t,r),n}(e,t,r):a?await async function(e,t){return function(e,t){const r=t.url||"";let n,i,a;return e.geometryData&&(n=`${r}/${e.geometryData[0].href}`),e.textureData&&(i=`${r}/${e.textureData[0].href}`),e.attributeData&&(a=function(e,t){const{attributeData:r=[]}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(r,e)),xf({...e,url:r,contentUrl:n,textureUrl:i,attributeUrls:a,isDracoGeometry:!1})}(e=JSON.parse((new TextDecoder).decode(e)),t)}(e,r):await async function(e,t){return await Xo(e,Eh,t)}(e,t);return e},extensions:["bin"],options:{i3s:{token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,_tileOptions:null,_tilesetOptions:null,useDracoGeometry:!0,useCompressedTextures:!0,decodeTextures:!0,coordinateSystem:lh.METER_OFFSETS,colorsByAttribute:null}}};function jf(){let e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const t=process.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}class Tf{constructor(e,t){wo(this,"name",void 0),wo(this,"type",void 0),wo(this,"sampleSize",1),wo(this,"time",void 0),wo(this,"count",void 0),wo(this,"samples",void 0),wo(this,"lastTiming",void 0),wo(this,"lastSampleTime",void 0),wo(this,"lastSampleCount",void 0),wo(this,"_count",0),wo(this,"_time",0),wo(this,"_samples",0),wo(this,"_startTime",0),wo(this,"_timerPending",!1),this.name=e,this.type=t,this.reset()}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=jf(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(jf()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class Cf{constructor(e){wo(this,"id",void 0),wo(this,"stats",{}),this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(const e in this.stats)this.stats[e].reset();return this}forEach(e){for(const t in this.stats)e(this.stats[t])}getTable(){const e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(e){if(!e||!e.name)return null;const{name:t,type:r}=e;return this.stats[t]||(this.stats[t]=e instanceof Tf?e:new Tf(t,r)),this.stats[t]}}function Bf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Rf={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class Of{constructor(e={}){Bf(this,"props",void 0),Bf(this,"stats",void 0),Bf(this,"activeRequestCount",0),Bf(this,"requestQueue",[]),Bf(this,"requestMap",new Map),Bf(this,"deferredUpdate",null),this.props={...Rf,...e},this.stats=new Cf({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(e,t=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);const r={handle:e,priority:0,getPriority:t},n=new Promise(e=>(r.resolve=e,r));return this.requestQueue.push(r),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){const{handle:t,resolve:r}=e;let n=!1;const i=()=>{n||(n=!0,this.requestMap.delete(t),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==e){this._updateAllRequests();for(let t=0;t<e;++t){const e=this.requestQueue.shift();e&&this._issueRequest(e)}}}_updateAllRequests(){const e=this.requestQueue;for(let t=0;t<e.length;++t){const r=e[t];this._updateRequest(r)||(e.splice(t,1),this.requestMap.delete(r.handle),t--)}e.sort((e,t)=>e.priority-t.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),!(e.priority<0)||(e.resolve(null),!1)}}function If(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Pf{constructor(e,t,r){If(this,"item",void 0),If(this,"previous",void 0),If(this,"next",void 0),this.item=e,this.previous=t,this.next=r}}function Df(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Mf{constructor(){Df(this,"head",null),Df(this,"tail",null),Df(this,"_length",0)}get length(){return this._length}add(e){const t=new Pf(e,this.tail,null);return this.tail?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,t){e!==t&&(this.remove(t),this._insert(e,t))}_insert(e,t){const r=e.next;e.next=t,this.tail===e?this.tail=t:r.previous=t,t.next=r,t.previous=e,++this._length}}function Ff(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lf(e){return null!=e}class Nf{constructor(){Ff(this,"_list",void 0),Ff(this,"_sentinel",void 0),Ff(this,"_trimTiles",void 0),this._list=new Mf,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){const t=e._cacheNode;Lf(t)&&this._list.splice(this._sentinel,t)}add(e,t,r){Lf(t._cacheNode)||(t._cacheNode=this._list.add(t),r&&r(e,t))}unloadTile(e,t,r){const n=t._cacheNode;Lf(n)&&(this._list.remove(n),t._cacheNode=void 0,r&&r(e,t))}unloadTiles(e,t){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,i=1024*e.maximumMemoryUsage*1024,a=this._sentinel;let o=n.head;for(;o!==a&&(e.gpuMemoryUsageInBytes>i||r);){const r=o.item;o=o.next,this.unloadTile(e,r,t)}}trim(){this._trimTiles=!0}}const zf=new Ds,Uf=new Ds,qf=new jp([new xp,new xp,new xp,new xp,new xp,new xp]);function Hf(e,t){const{cameraDirection:r,cameraUp:n,height:i}=e,{metersPerUnit:a}=e.distanceScales,o=Vf(e,e.center),s=_u.WGS84.eastNorthUpToFixedFrame(o),u=e.unprojectPosition(e.cameraPosition),c=_u.WGS84.cartographicToCartesian(u,new Ds),l=new Ds(s.transformAsVector(new Ds(r).scale(a))).normalize(),h=new Ds(s.transformAsVector(new Ds(n).scale(a))).normalize();!function(e){const t=e.getFrustumPlanes(),r=Gf(t.near,e.cameraPosition),n=Vf(e,r),i=Vf(e,e.cameraPosition,Uf);let a=0;qf.planes[a++].fromPointNormal(n,zf.copy(n).subtract(i));for(const i in t){if("near"===i)continue;const o=Gf(t[i],r,Uf),s=Vf(e,o,Uf);qf.planes[a++].fromPointNormal(s,zf.copy(n).subtract(s))}}(e);const p=e.constructor,{longitude:f,latitude:d,width:m,bearing:g,zoom:y}=e;return{camera:{position:c,direction:l,up:h},viewport:e,topDownViewport:new p({longitude:f,latitude:d,height:i,width:m,bearing:g,zoom:y,pitch:0}),height:i,cullingVolume:qf,frameNumber:t,sseDenominator:1.15}}function Gf(e,t,r=new Ds){const n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Vf(e,t,r=new Ds){const n=e.unprojectPosition(t);return _u.WGS84.cartographicToCartesian(n,r)}const Wf=new Ds;function Kf(e,t){if(e instanceof wp){const{halfAxes:r}=e,n=function(e){e.getColumn(0,Wf);const t=e.getColumn(1),r=e.getColumn(2),n=Wf.add(t).add(r);return n.len()}(r);return Math.log2(6356752.314245179/(n+t[2]))}if(e instanceof Th){const{radius:r}=e;return Math.log2(6356752.314245179/(r+t[2]))}if(e.width&&e.height){const{width:t,height:r}=e;return(Math.log2(6378137/t)+Math.log2(6378137/r))/2}return 1}function Jf(e,t,r){const n=_u.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],new Ds),i=Math.sqrt(Math.pow(n[0]-r[0],2)+Math.pow(n[1]-r[1],2)+Math.pow(n[2]-r[2],2));return Math.log2(6356752.314245179/(i+t[2]))}function Qf(e){return null!=e}const Yf=new Ds,$f=new Ds,Xf=new Ds;function Zf(e,t,r){if(Vi(e,"3D Tile: boundingVolume must be defined"),e.box)return function(e,t,r){const n=new Ds(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(10===e.length){const t=e.slice(3,6),r=new np;r.fromArray(e,6);const n=new Ds([1,0,0]),a=new Ds([0,1,0]),o=new Ds([0,0,1]);n.transformByQuaternion(r),n.scale(t[0]),a.transformByQuaternion(r),a.scale(t[1]),o.transformByQuaternion(r),o.scale(t[2]),i=[...n.toArray(),...a.toArray(),...o.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];const a=t.transformAsVector(i.slice(0,3)),o=t.transformAsVector(i.slice(3,6)),s=t.transformAsVector(i.slice(6,9)),u=new Dh([a[0],a[1],a[2],o[0],o[1],o[2],s[0],s[1],s[2]]);if(Qf(r))return r.center=n,r.halfAxes=u,r;return new wp(n,u)}(e.box,t,r);if(e.region){const[t,r,n,i,a,o]=e.region,s=_u.WGS84.cartographicToCartesian([cs(t),cs(i),a],$f),u=_u.WGS84.cartographicToCartesian([cs(n),cs(r),o],Xf),c=(new Ds).addVectors(s,u).multiplyScalar(.5),l=(new Ds).subVectors(s,u).len()/2;return ed([c[0],c[1],c[2],l],new Js)}if(e.sphere)return ed(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function ed(e,t,r){const n=new Ds(e[0],e[1],e[2]);t.transform(n,n);const i=t.getScale(Yf),a=Math.max(Math.max(i[0],i[1]),i[2]),o=e[3]*a;return Qf(r)?(r.center=n,r.radius=o,r):new Th(n,o)}new Ds,new Ds,new Js,new Ds,new Ds,new Ds;function td(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){const r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return function(e,t){const r=e*t;return 1-Math.exp(-r*r)}(t,r)*n}return 0}const rd=new Ds,nd=new Ds,id=new Ds,ad=new Ds,od=new Ds,sd=new Js,ud=new Js;function cd(e,t){const{topDownViewport:r}=t,n=e.header.mbs[1],i=e.header.mbs[0],a=e.header.mbs[2],o=e.header.mbs[3],s=[...e.boundingVolume.center],u=r.unprojectPosition(r.cameraPosition);_u.WGS84.cartographicToCartesian(u,rd),nd.copy(rd).subtract(s).normalize(),_u.WGS84.eastNorthUpToFixedFrame(s,sd),ud.copy(sd).invert(),id.copy(rd).transform(ud);const c=Math.sqrt(id[0]*id[0]+id[1]*id[1]),l=c*c/id[2];ad.copy([id[0],id[1],l]);const h=ad.transform(sd).subtract(s).normalize(),p=nd.cross(h).normalize().scale(o).add(s),f=_u.WGS84.cartesianToCartographic(p),d=r.project([i,n,a]),m=r.project(f);return od.copy(d).subtract(m).magnitude()}function ld(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class hd{constructor(e=0){ld(this,"_map",new Map),ld(this,"_array",void 0),ld(this,"_length",void 0),this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return Vi(e<this._array.length),this._array[e]}set(e,t){Vi(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}delete(e){const t=this._map.get(e);t>=0&&(this._array.splice(t,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){const t=this.length++;this._array[t]=e,this._map.set(e,t)}}pop(){const e=this._array[--this.length];return this._map.delete(e),e}reserve(e){Vi(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){Vi(e>=0),this.length=e}trim(e){null==e&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}}function pd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const fd={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class dd{traversalFinished(e){return!0}constructor(e){pd(this,"options",void 0),pd(this,"root",void 0),pd(this,"requestedTiles",void 0),pd(this,"selectedTiles",void 0),pd(this,"emptyTiles",void 0),pd(this,"lastUpdate",(new Date).getTime()),pd(this,"updateDebounceTime",1e3),pd(this,"_traversalStack",void 0),pd(this,"_emptyTraversalStack",void 0),pd(this,"_frameNumber",void 0),this.options={...fd,...e},this._traversalStack=new hd,this._emptyTraversalStack=new hd,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(e,t,r){this.root=e,this.options={...this.options,...r},this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,t){const r=this._traversalStack;for(e._selectionDepth=1,r.push(e);r.length>0;){const e=r.pop();let n=!1;this.canTraverse(e,t)&&(this.updateChildTiles(e,t),n=this.updateAndPushChildren(e,t,r,e.hasRenderContent?e._selectionDepth+1:e._selectionDepth));const i=e.parent,a=Boolean(!i||i._shouldRefine),o=!n;e.hasRenderContent?e.refine===cf?(this.loadTile(e,t),this.selectTile(e,t)):e.refine===lf&&(this.loadTile(e,t),o&&this.selectTile(e,t)):(this.emptyTiles[e.id]=e,this.loadTile(e,t),o&&this.selectTile(e,t)),this.touchTile(e,t),e._shouldRefine=n&&a}const n=(new Date).getTime();(this.traversalFinished(t)||n-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=n,this.options.onTraversalEnd(t))}updateChildTiles(e,t){const r=e.children;for(const e of r)this.updateTile(e,t);return!0}updateAndPushChildren(e,t,r,n){const{loadSiblings:i,skipLevelOfDetail:a}=this.options,o=e.children;o.sort(this.compareDistanceToCamera.bind(this));const s=e.refine===lf&&e.hasRenderContent&&!a;let u=!1,c=!0;for(const e of o)if(e._selectionDepth=n,e.isVisibleAndInRequestVolume?(r.find(e)&&r.delete(e),r.push(e),u=!0):(s||i)&&(this.loadTile(e,t),this.touchTile(e,t)),s){let r;if(r=!!e._inRequestVolume&&(e.hasRenderContent?e.contentAvailable:this.executeEmptyTraversal(e,t)),c=c&&r,!c)return!1}return u||(c=!1),c}updateTile(e,t){this.updateTileVisibility(e,t)}selectTile(e,t){this.shouldSelectTile(e)&&(e._selectedFrame=t.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,t){this.shouldLoadTile(e)&&(e._requestedFrame=t.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,t){e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber}canTraverse(e,t,r=!1,n=!1){return!!e.hasChildren&&(e.hasTilesetContent?!e.contentExpired:!(!n&&!e.isVisibleAndInRequestVolume)&&this.shouldRefine(e,t,r))}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,t,r){let n=e._screenSpaceError;return r&&(n=e.getScreenSpaceError(t,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(e,t){const r=[];if(this.options.viewportTraversersMap)for(const e in this.options.viewportTraversersMap){this.options.viewportTraversersMap[e]===t.viewport.id&&r.push(e)}else r.push(t.viewport.id);e.updateVisibility(t,r)}compareDistanceToCamera(e,t){return e._distanceToCamera-t._distanceToCamera}anyChildrenVisible(e,t){let r=!1;for(const n of e.children)n.updateVisibility(t),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(e,t){let r=!0;const n=this._emptyTraversalStack;for(n.push(e);n.length>0&&r;){const e=n.pop();this.updateTile(e,t),e.isVisibleAndInRequestVolume||this.loadTile(e,t),this.touchTile(e,t);if(!e.hasRenderContent&&this.canTraverse(e,t,!1,!0)){const t=e.children;for(const e of t)n.find(e)&&n.delete(e),n.push(e)}else e.contentAvailable||(r=!1)}return r}}function md(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gd=new Ds;class yd{constructor(e,t,r,n=""){md(this,"tileset",void 0),md(this,"header",void 0),md(this,"id",void 0),md(this,"url",void 0),md(this,"parent",void 0),md(this,"refine",void 0),md(this,"type",void 0),md(this,"contentUrl",void 0),md(this,"lodMetricType",void 0),md(this,"lodMetricValue",void 0),md(this,"boundingVolume",void 0),md(this,"content",void 0),md(this,"contentState",void 0),md(this,"gpuMemoryUsageInBytes",void 0),md(this,"children",void 0),md(this,"depth",void 0),md(this,"viewportIds",void 0),md(this,"transform",void 0),md(this,"extensions",void 0),md(this,"implicitTiling",void 0),md(this,"userData",void 0),md(this,"computedTransform",void 0),md(this,"hasEmptyContent",void 0),md(this,"hasTilesetContent",void 0),md(this,"traverser",void 0),md(this,"_cacheNode",void 0),md(this,"_frameNumber",void 0),md(this,"_lodJudge",void 0),md(this,"_expireDate",void 0),md(this,"_expiredContent",void 0),md(this,"_shouldRefine",void 0),md(this,"_distanceToCamera",void 0),md(this,"_centerZDepth",void 0),md(this,"_screenSpaceError",void 0),md(this,"_visibilityPlaneMask",void 0),md(this,"_visible",void 0),md(this,"_inRequestVolume",void 0),md(this,"_stackLength",void 0),md(this,"_selectionDepth",void 0),md(this,"_touchedFrame",void 0),md(this,"_visitedFrame",void 0),md(this,"_selectedFrame",void 0),md(this,"_requestedFrame",void 0),md(this,"_priority",void 0),md(this,"_contentBoundingVolume",void 0),md(this,"_viewerRequestVolume",void 0),md(this,"_initialTransform",void 0),this.header=t,this.tileset=e,this.id=n||t.id,this.url=t.url,this.parent=r,this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=nf,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new dd({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Js,this.transform=new Js,this._initializeLodMetric(t),this._initializeTransforms(t),this._initializeBoundingVolumes(t),this._initializeContent(t),this._initializeRenderingState(t),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,this.implicitTiling=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===of||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===nf}get contentExpired(){return this.contentState===sf}get contentFailed(){return this.contentState===uf}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}getScreenSpaceError(e,t){switch(this.tileset.type){case mf:return cd(this,e);case gf:return function(e,t,r){const n=e.tileset,i=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,a=r?i:e.lodMetricValue;if(0===a)return 0;const o=Math.max(e._distanceToCamera,1e-7),{height:s,sseDenominator:u}=t,{viewDistanceScale:c}=n.options;let l=a*s*(c||1)/(o*u);return l-=td(n,o),l}(this,e,t);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getPriority(){const e=this.tileset._traverser,{skipLevelOfDetail:t}=e.options,r=this.refine===cf||t;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===nf)return-1;const n=this.parent,i=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-i,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=af;const e=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!e)return this.contentState=nf,!1;try{const t=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await Zo(t,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=of,this._onContentLoaded(),!0}catch(e){throw this.contentState=uf,e}finally{e.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=nf,!0}updateVisibility(e,t){if(this._frameNumber===e.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:jp.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const e=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(e)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,n),this._visible=this._visibilityPlaneMask!==jp.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=t}visibility(e,t){const{cullingVolume:r}=e,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,t)}contentVisibility(){return!0}distanceToTile(e){const t=this.boundingVolume;return Math.sqrt(Math.max(t.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth({camera:e}){const t=this.boundingVolume;return gd.subVectors(t.center,e.position),e.direction.dot(gd)}insideViewerRequestVolume(e){const t=this._viewerRequestVolume;return!t||t.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=sf,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new Js(e.transform):new Js;const t=this.parent,r=this.tileset,n=t&&t.computedTransform?t.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new Js(n).multiplyRight(this.transform);const i=t&&t._initialTransform?t._initialTransform.clone():new Js;this._initialTransform=new Js(i).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=nf,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=jp.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||lf}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(e){this.boundingVolume=Zf(e.boundingVolume,this.computedTransform,this.boundingVolume);const t=e.content;t&&(t.boundingVolume&&(this._contentBoundingVolume=Zf(t.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=Zf(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(e=new Js){const t=e.clone().multiplyRight(this.transform);!t.equals(this.computedTransform)&&(this.computedTransform=t,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return{assetGltfUpAxis:(t=this.tileset.tileset).asset&&t.asset.gltfUpAxis||"Y"}}var t}}class bd extends dd{compareDistanceToCamera(e,t){return 0===t._distanceToCamera&&0===e._distanceToCamera?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,t){if(super.updateTileVisibility(e,t),!e.isVisibleAndInRequestVolume)return;const r=e.children.length>0;if(e.hasTilesetContent&&r){const r=e.children[0];return this.updateTileVisibility(r,t),void(e._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(e,t))return void(e._visible=!1);const n=e.refine===lf,i=e._optimChildrenWithinParent===bf;n&&i&&r&&!this.anyChildrenVisible(e,t)&&(e._visible=!1)}meetsScreenSpaceErrorEarly(e,t){const{parent:r}=e;return!(!r||r.hasTilesetContent||r.refine!==cf)&&!this.shouldRefine(e,t,!0)}}class vd{constructor(){var e,t,r;e=this,t="frameNumberMap",r=new Map,t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}register(e,t){const r=this.frameNumberMap.get(e)||new Map,n=r.get(t)||0;r.set(t,n+1),this.frameNumberMap.set(e,r)}deregister(e,t){const r=this.frameNumberMap.get(e);if(!r)return;const n=r.get(t)||1;r.set(t,n-1)}isZero(e,t){var r;return 0===((null===(r=this.frameNumberMap.get(e))||void 0===r?void 0:r.get(t))||0)}}function wd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _d="REQUESTED",kd="COMPLETED",xd="ERROR";class Ed{constructor(){wd(this,"_statusMap",void 0),wd(this,"pendingTilesRegister",new vd),this._statusMap={}}add(e,t,r,n){if(!this._statusMap[t]){const{frameNumber:i,viewport:{id:a}}=n;this._statusMap[t]={request:e,callback:r,key:t,frameState:n,status:_d},this.pendingTilesRegister.register(a,i),e().then(e=>{this._statusMap[t].status=kd;const{frameNumber:r,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,r),this._statusMap[t].callback(e,n)}).catch(e=>{this._statusMap[t].status=xd;const{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n),r(e)})}}update(e,t){if(this._statusMap[e]){const{frameNumber:r,viewport:{id:n}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(n,r);const{frameNumber:i,viewport:{id:a}}=t;this.pendingTilesRegister.register(a,i),this._statusMap[e].frameState=t}}find(e){return this._statusMap[e]}hasPendingTiles(e,t){return!this.pendingTilesRegister.isZero(e,t)}}class Ad extends dd{traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}constructor(e){var t,r,n;super(e),n=void 0,(r="_tileManager")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this._tileManager=new Ed}shouldRefine(e,t){return e._lodJudge=function(e,t){if(0===e.lodMetricValue||isNaN(e.lodMetricValue))return"DIG";const r=2*cd(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}(e,t),"DIG"===e._lodJudge}updateChildTiles(e,t){const r=e.header.children||[],n=e.children,i=e.tileset;for(const a of r){const r=`${a.id}-${t.viewport.id}`,o=n&&n.find(e=>e.id===r);if(o)o&&this.updateTile(o,t);else{let n=()=>this._loadTile(a.id,i);this._tileManager.find(r)?this._tileManager.update(r,t):(i.tileset.nodePages&&(n=()=>i.tileset.nodePagesTile.formTileFromNodePages(a.id)),this._tileManager.add(n,r,t=>this._onTileLoad(t,e,r),t))}}return!1}async _loadTile(e,t){const{loader:r}=t,n=t.getTileUrl(`${t.url}/nodes/${e}`),i={...t.loadOptions,i3s:{...t.loadOptions.i3s,isTileHeader:!0}};return await Zo(n,r,i)}_onTileLoad(e,t,r){const n=new yd(t.tileset,e,t,r);t.children.push(n);const i=this._tileManager.find(n.id).frameState;this.updateTile(n,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||(new Date).getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(n,i)}}function Sd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const jd={description:"",ellipsoid:_u.WGS84,modelMatrix:new Js,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Td="Tiles In Tileset(s)";class Cd{constructor(e,t){Sd(this,"options",void 0),Sd(this,"loadOptions",void 0),Sd(this,"type",void 0),Sd(this,"tileset",void 0),Sd(this,"loader",void 0),Sd(this,"url",void 0),Sd(this,"basePath",void 0),Sd(this,"modelMatrix",void 0),Sd(this,"ellipsoid",void 0),Sd(this,"lodMetricType",void 0),Sd(this,"lodMetricValue",void 0),Sd(this,"refine",void 0),Sd(this,"root",void 0),Sd(this,"roots",void 0),Sd(this,"asset",void 0),Sd(this,"description",void 0),Sd(this,"properties",void 0),Sd(this,"extras",void 0),Sd(this,"attributions",void 0),Sd(this,"credits",void 0),Sd(this,"stats",void 0),Sd(this,"traverseCounter",void 0),Sd(this,"geometricError",void 0),Sd(this,"selectedTiles",void 0),Sd(this,"updatePromise",null),Sd(this,"tilesetInitializationPromise",void 0),Sd(this,"cartographicCenter",void 0),Sd(this,"cartesianCenter",void 0),Sd(this,"zoom",void 0),Sd(this,"boundingVolume",void 0),Sd(this,"gpuMemoryUsageInBytes",void 0),Sd(this,"dynamicScreenSpaceErrorComputedDensity",void 0),Sd(this,"_traverser",void 0),Sd(this,"_cache",void 0),Sd(this,"_requestScheduler",void 0),Sd(this,"_frameNumber",void 0),Sd(this,"_queryParamsString",void 0),Sd(this,"_queryParams",void 0),Sd(this,"_extensionsUsed",void 0),Sd(this,"_tiles",void 0),Sd(this,"_pendingCount",void 0),Sd(this,"lastUpdatedVieports",void 0),Sd(this,"_requestedTiles",void 0),Sd(this,"_emptyTiles",void 0),Sd(this,"frameStateData",void 0),Sd(this,"maximumMemoryUsage",void 0),Vi(e),this.options={...jd,...t},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||n.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new Nf,this._requestScheduler=new Of({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new Cf({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber&&0===this._requestedTiles.length}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(e){const t=[];for(const r of Object.keys(e))t.push(`${r}=${e[r]}`);switch(t.length){case 0:return"";case 1:return"?"+t[0];default:return"?"+t.join("&")}}(this._queryParams)),this._queryParamsString}setProps(e){this.options={...this.options,...e}}setOptions(e){this.options={...this.options,...e}}getTileUrl(e){return e.startsWith("data:")?e:`${e}${this.queryParams}`}hasExtension(e){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(e)>-1)}update(e=null){this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(e=null){return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(e=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),e(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;const t=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const r=[];for(const e of t){const t=e.id;this._needTraverse(t)?r.push(t):this.traverseCounter--}for(const e of t){const t=e.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!r.includes(t))continue;const n=Hf(e,this._frameNumber);this._traverser.traverse(this.roots[t],n,this.options)}}_needTraverse(e){let t=e;return this.options.viewportTraversersMap&&(t=this.options.viewportTraversersMap[e]),t===e}_onTraversalEnd(e){const t=e.viewport.id;this.frameStateData[t]||(this.frameStateData[t]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[t],n=Object.values(this._traverser.selectedTiles),[i,a]=function(e,t,r){if(0===r||e.length<=r)return[e,[]];const n=[],{longitude:i,latitude:a}=t.viewport;for(const[t,r]of e.entries()){const[e,o]=r.header.mbs,s=Math.abs(i-e),u=Math.abs(a-o),c=Math.sqrt(u*u+s*s);n.push([t,c])}const o=n.sort((e,t)=>e[1]-t[1]),s=[];for(let t=0;t<r;t++)s.push(e[o[t][0]]);const u=[];for(let t=r;t<o.length;t++)u.push(e[o[t][0]]);return[s,u]}(n,e,this.options.maximumTilesSelected);r.selectedTiles=i;for(const e of a)e.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const e in this.frameStateData){const t=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(t.selectedTiles),this._requestedTiles=this._requestedTiles.concat(t._requestedTiles),this._emptyTiles=this._emptyTiles.concat(t._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,t){if(e.length!==t.length)return!0;const r=new Set(e.map(e=>e.id)),n=new Set(t.map(e=>e.id));let i=e.filter(e=>!n.has(e.id)).length>0;return i=i||t.filter(e=>!r.has(e.id)).length>0,i}_loadTiles(){for(const e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,t)=>e._unloadTile(t))}_updateStats(){let e=0,t=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(e++,r.content.pointCount?t+=r.content.pointCount:t+=r.content.vertexCount);this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=e,this.stats.get("Points/Vertices").count=t}async _initializeTileSet(e){this.type===mf&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===gf&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===mf&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;const t=this.tileset.fullExtent;if(t){const{xmin:e,xmax:r,ymin:n,ymax:i,zmin:a,zmax:o}=t;return this.cartographicCenter=new Ds(e+(r-e)/2,n+(i-n)/2,a+(o-a)/2),this.cartesianCenter=_u.WGS84.cartographicToCartesian(this.cartographicCenter,new Ds),void(this.zoom=Jf(t,this.cartographicCenter,this.cartesianCenter))}const r=null===(e=this.tileset.store)||void 0===e?void 0:e.extent;if(r){const[e,t,n,i]=r;return this.cartographicCenter=new Ds(e+(n-e)/2,t+(i-t)/2,0),this.cartesianCenter=_u.WGS84.cartographicToCartesian(this.cartographicCenter,new Ds),void(this.zoom=function(e,t,r){const[n,i,a,o]=e;return Jf({xmin:n,xmax:a,ymin:i,ymax:o,zmin:0,zmax:0},t,r)}(r,this.cartographicCenter,this.cartesianCenter))}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new Ds,this.zoom=1}calculateViewPropsTiles3D(){const e=this.root;Vi(e);const{center:t}=e.boundingVolume;if(!t)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new Ds,void(this.zoom=1);0!==t[0]||0!==t[1]||0!==t[2]?this.cartographicCenter=_u.WGS84.cartesianToCartographic(t,new Ds):this.cartographicCenter=new Ds(0,0,-_u.WGS84.radii[0]),this.cartesianCenter=t,this.zoom=Kf(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Td),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points/Vertices","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(e,t){const r=new yd(this,e.root,t);if(t&&(t.children.push(r),r.depth=t.depth+1),this.type===gf){const e=[];for(e.push(r);e.length>0;){const t=e.pop();this.stats.get(Td).incrementCount();const r=t.header.children||[];for(const n of r){const r=new yd(this,n,t);t.children.push(r),r.depth=t.depth+1,e.push(r)}}}return r}_initializeTraverser(){let e;switch(this.type){case gf:e=bd;break;case mf:e=Ad;break;default:e=dd}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let t;try{this._onStartTileLoading(),t=await e.loadContent()}catch(t){this._onTileLoadError(e,t)}finally{this._onEndTileLoading(),this._onTileLoad(e,t)}}_onTileLoadError(e,t){this.stats.get("Failed Tile Loads").incrementCount();const r=t.message||t.toString(),n=e.url;console.error(`A 3D tile failed to load: ${e.url} ${r}`),this.options.onTileError(e,r,n)}_onTileLoad(e,t){if(t){if(this.type===mf){var r,n;const e=(null===(r=this.tileset)||void 0===r||null===(n=r.nodePagesTile)||void 0===n?void 0:n.nodesInNodePages)||0;this.stats.get(Td).reset(),this.stats.get(Td).addCount(e)}e&&e.content&&function(e,t){Vi(e),Vi(t);const{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:a}}=e;let o=new Js(i);switch(r&&o.translate(r),n){case"Z":break;case"Y":const e=(new Js).rotateX(Math.PI/2);o=o.multiplyRight(e);break;case"X":const t=(new Js).rotateY(-Math.PI/2);o=o.multiplyRight(t)}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);const s=new Ds(a);t.cartesianModelMatrix=o,t.cartesianOrigin=s;const u=_u.WGS84.cartesianToCartographic(s,new Ds),c=_u.WGS84.eastNorthUpToFixedFrame(s).invert();t.cartographicModelMatrix=c.multiplyRight(o),t.cartographicOrigin=u,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}(e,e.content),this._addTileToCache(e),this.options.onTileLoad(e)}}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(e){this._cache.add(this,e,t=>t._updateCacheStats(e))}_updateCacheStats(e){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=e.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.content&&e.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){const e=[];for(this.root&&e.push(this.root);e.length>0;){const t=e.pop();for(const r of t.children)e.push(r);this._destroyTile(t)}this.root=null}_destroySubtree(e){const t=e,r=[];for(r.push(t);r.length>0;){e=r.pop();for(const t of e.children)r.push(t);e!==t&&this._destroyTile(e)}t.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed,this.extras=e.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}const Bd=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],Rd=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],Od=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31];class Id{constructor(e){this.options=e,this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this._ix=this.options._width,this._iy=this.options._height}getHeight(e,t){if(e=Math.abs(e)>90?NaN:e,isNaN(e)||isNaN(t))return NaN;const r=function(e,t){t=Math.abs(t);let r=Pd(e,t);2*Math.abs(r)===t?r-=Pd(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t);return r}(t,360);let n=(t=-180!==r?r:180)*this.options._rlonres,i=-e*this.options._rlatres,a=Math.floor(n),o=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(i));n-=a,i-=o,o+=(this.options._height-1)/2,a+=a<0?this.options._width:a>=this.options._width?-this.options._width:0;let s=0,u=0,c=0,l=0,h=new Array(10);if(a!==this._ix||o!==this._iy)if(this.options.cubic){const e=[this._rawval(a,o-1),this._rawval(a+1,o-1),this._rawval(a-1,o),this._rawval(a,o),this._rawval(a+1,o),this._rawval(a+2,o),this._rawval(a-1,o+1),this._rawval(a,o+1),this._rawval(a+1,o+1),this._rawval(a+2,o+1),this._rawval(a,o+2),this._rawval(a+1,o+2)];let t=Rd;0!==o&&(t=o===this.options._height-2?Od:Bd);let r=372;0!==o&&(r=o===this.options._height-2?372:240);for(let n=0;n<10;++n){h[n]=0;for(let r=0;r<12;++r)h[n]+=e[r]*t[10*r+n];h[n]/=r}}else s=this._rawval(a,o),u=this._rawval(a+1,o),c=this._rawval(a,o+1),l=this._rawval(a+1,o+1);else this.options.cubic?h=this._t:(s=this._v00,u=this._v01,c=this._v10,l=this._v11);if(!this.options.cubic){const e=(1-i)*((1-n)*s+n*u)+i*((1-n)*c+n*l),t=this.options._offset+this.options._scale*e;return this._ix=a,this._iy=o,this._v00=s,this._v01=u,this._v10=c,this._v11=l,t}let p=h[0]+n*(h[1]+n*(h[3]+n*h[6]))+i*(h[2]+n*(h[4]+n*h[7])+i*(h[5]+n*h[8]+i*h[9]));return p=this.options._offset+this.options._scale*p,this._ix=a,this._iy=o,this._t=h,p}_rawval(e,t){e<0?e+=this.options._width:e>=this.options._width&&(e-=this.options._width),(t<0||t>=this.options._height)&&(t=t<0?-t:2*(this.options._height-1)-t,e+=(e<this.options._width/2?1:-1)*this.options._width/2);const r=this.options._datastart+2*(t*this.options._swidth+e);return this.options.data[r]<<8|this.options.data[r+1]}}function Pd(e,t){return e-Math.floor(e/t)*t}function Dd(e,t){const r=function*(e){let t=0;do{const r=e.indexOf(10,t);if(-1!==r){const n=e.subarray(t,r);t=r+1,yield{offset:t,line:Md(n)}}else{const r=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Md(r)}}}while(t<e.length);return{offset:t,line:""}}(e);let n=r.next();if(n.done||"P5"!==n.value.line)throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,a=0,o=-1,s=-1,u="NONE",c="UNKNOWN",l=0,h=0,p=null,f=null;do{n=r.next();const e=n.value.line;if(e.length){if("#"!==e[0]){let t=e.split(" ");if(t=t.filter(e=>""!==e),l=parseInt(t[0],10),h=parseInt(t[1],10),!l||!h)throw new Error("Geoid model file: Error reading raster size");break}{const r=e.split(" "),n=r[0],l=r[1];if("#"!==n||!l)continue;const h=r.length>2?r.slice(2):[];if("Description"===l)u=h.join(" ");else if("DateTime"===l)c=h.join(" ");else if("Offset"===l){if(!r[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(r[2],10)}else if("Scale"===l){if(!r[2])throw new Error("Geoid model file: Error reading scale");a=parseFloat(r[2])}else l===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(r[2]))&&(o=parseFloat(r[2])):l===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(r[2]))&&(s=parseFloat(r[2]))}}}while(!n.done);n=r.next();const d=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(65535!==d)throw new Error("Geoid model file: Incorrect value of maxval");if(p=n.value.offset,f=l,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(0===a)throw new Error("Geoid model file: Scale not set");if(a<0)throw new Error("Geoid model file: Scale must be positive");if(h<2||l<2)throw new Error("Geoid model file: Raster size too small");if(1&l)throw new Error("Geoid model file: Raster width is odd");if(!(1&h))throw new Error("Geoid model file: Raster height is even");const m=l/360,g=(h-1)/180;return new Id({cubic:t.cubic,_width:l,_height:h,_rlonres:m,_rlatres:g,_offset:i,_scale:a,_swidth:f,_datastart:p,_maxerror:o,_rmserror:s,_description:u,_datetime:c,data:e})}function Md(e){let t="";for(const r of e)t+=String.fromCharCode(r);return t}const Fd={name:"PGM - Netpbm grayscale image format",id:"pgm",module:"tile-converter",version:"3.3.0-alpha.5",mimeTypes:["image/x-portable-graymap"],parse:async(e,t)=>Dd(new Uint8Array(e),t),extensions:["pgm"],options:{cubic:!1}};function Ld(e,t){const r=[e.center[0],e.center[1],e.center[2]+t.getHeight(e.center[1],e.center[0])],n=_u.WGS84.cartographicToCartesian(r,new Ds),i=(new wp).fromCenterHalfSizeQuaternion(n,e.halfSize,e.quaternion);return[...i.center,...i.halfAxes.toArray()]}function Nd(e,t){const r=[],n=e.boundingVolume,i=e.lodMetricValue||.1,a={metricType:"maxScreenThreshold",maxError:2*t.mbs[3]*16/i},o={metricType:"maxScreenThresholdSQ",maxError:.25*Math.PI*a.maxError*a.maxError};return"OrientedBoundingBox"===n.constructor.name?(r.push(o),r.push(a)):(r.push(a),r.push(o)),r}function zd(e){let t=(e.header.lodSelection.maxScreenThreshold||{}).maxError;if(!t){const r=e.header.lodSelection.maxScreenThresholdSQ;r&&(t=Math.sqrt(r.maxError/(.25*Math.PI)))}return t||(t=16),2*e.header.mbs[3]*16/t}r(260);var Ud=r(80),qd=r.n(Ud);function Hd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Gd={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log("Started "+e.props.command)}};class Vd{constructor({id:e="browser-driver"}={}){Hd(this,"id",void 0),Hd(this,"props",{...Gd}),Hd(this,"childProcess",null),Hd(this,"port",0),Hd(this,"successTimer",void 0),this.id=e}async start(e){e={...Gd,...e},this.props=e;const t=[...e.arguments];return this.port=Number(e.port),e.portArg&&(e.autoPort&&(this.port=await function(e=3e3){return new Promise(t=>{qd.a.exec("lsof -i -P -n | grep LISTEN",(r,n)=>{if(r)return void t(e);const i=[],a=/:(\d+) \(LISTEN\)/;n.split("\n").forEach(e=>{const t=a.exec(e);t&&i.push(Number(t[1]))});let o=e;for(;i.includes(o);)o++;t(o)})})}(e.port)),t.push(e.portArg,String(this.port))),await new Promise((r,n)=>{try{this._setTimeout(()=>{e.onSuccess&&e.onSuccess(this),r({})}),console.log(`Spawning ${e.command} ${e.arguments.join(" ")}`);const i=Ud.spawn(e.command,t,e.spawn);this.childProcess=i,i.stdout.on("data",e=>{console.log(e.toString())}),i.stderr.on("data",e=>{console.log(`Child process wrote to stderr: "${e}".`),this._clearTimeout(),n(new Error(e))}),i.on("error",e=>{console.log("Child process errored with "+e),this._clearTimeout(),n(e)}),i.on("close",e=>{console.log("Child process exited with "+e),this.childProcess=null,this._clearTimeout(),r({})})}catch(e){n(e)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(e=0){try{await this.stop(),process.exit(e)}catch(e){console.error(e.message||e),process.exit(1)}}_setTimeout(e){Number(this.props.wait)>0&&(this.successTimer=setTimeout(e,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}}var Wd=r(79),Kd=r.n(Wd);const Jd="function"==typeof atob?atob:"function"==typeof Buffer?function(e){return Buffer.from(e,"base64").toString("binary")}:$d,Qd=Jd("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"),Yd=!(!WebAssembly||Jd===$d)&&function(e){var t,r,n,i=-1;t=e.length-1,r=new ArrayBuffer(e.length),n=new Uint8Array(r);for(;t>i++;)n[i]=e.charCodeAt(i);return n}(Qd).buffer;Math.floor(1048576.00032768);function $d(e){return e}Yd||console.log("WebAssembly not available or WASM module could not be decoded; md5WASM will fall back to JavaScript");r(113);async function Xd(e,t,r,n,i){"win32"===process.platform?await async function(e,t,r=0,n=Object(Ci.join)(".","*"),i){"@"===n[0]&&(n="*"+n.substr(1));const a=nm(t),o=["a","-tzip","-mx="+r,a,n],s=new Vd;await s.start({command:i,arguments:o,spawn:{cwd:""+e},wait:0})}(e,t,r,n,i):await async function(e,t,r=0,n="."){const i=nm(t),a=["-"+r,"-r",i,n],o=new Vd;await o.start({command:"zip",arguments:a,spawn:{cwd:e},wait:0})}(e,t,r,n)}async function Zd(e,t,r="index.json"){let n;n=t instanceof Promise?new Uint8Array(await t):t instanceof ArrayBuffer?new Uint8Array(t):t,await fe.promises.mkdir(e,{recursive:!0});const i=Object(Ci.join)(e,r);try{await fe.promises.writeFile(i,n)}catch(e){throw e}return console.log(i+" saved."),i}async function em(e,t,r="index.json",n=!0){const i=await Zd(e,t,r);if(n){const e=await function(e){const t=e+".gz",r=Object(ve.createGzip)(),n=Object(fe.createReadStream)(e),i=Object(fe.createWriteStream)(t);return new Promise((e,a)=>{n.on("end",()=>{console.log(t+" compressed and saved."),e(t)}),n.on("error",e=>{console.log(t+": compression error!"),a(e)}),n.pipe(r).pipe(i)})}(i);return await rm(i),e}return i}function tm(e){return fe.promises.rmdir(e,{recursive:!0})}function rm(e){return fe.promises.unlink(e)}function nm(e){return Object(Ci.isAbsolute)(e)?e:Object(Ci.join)(process.cwd(),e)}function im(e){let t=e[0];const r=Math.floor(t/3600);t-=3600*r;const n=Math.floor(t/60);t-=60*n;const i=Math.floor(t),a=e[1]/1e6;let o="";return r&&(o+=r+"h "),n&&(o+=n+"m "),i&&(o+=i+"s"),o||(o+=a+"ms"),o}async function am(e){const{slpk:t,outputPath:r,tilesetName:n}=e,i=nm(r);try{if(t){const e=Object(Ci.join)(i,n+".slpk");return(await fe.promises.stat(e)).size}const e=Object(Ci.join)(i,n);return await async function e(t){let r=0;const n=await fe.promises.readdir(t);for(const i of n){const n=await fe.promises.stat(Object(Ci.join)(t,i));n.isDirectory()?r+=await e(Object(Ci.join)(t,i)):r+=n.size}return r}(e)}catch(e){return console.log("Calculate file sizes error: ",e),null}}const om=()=>({boundingVolume:{path:"boundingVolume"},geometricError:{path:"geometricError"},content:{path:"content"},children:{path:"children",transform:e=>e.map(e=>Ii()(e,om()))}});function sm(e,t){let r,n,i;const a=e.boundingVolume,o=_u.WGS84.cartesianToCartographic(a.center,new Ds);return o[2]=o[2]-t.getHeight(o[1],o[0]),a instanceof wp?(n=a.halfSize,r=new Ds(n[0],n[1],n[2]).len(),i=a.quaternion):(r=e.boundingVolume.radius,n=[r,r,r],i=(new np).fromMatrix3(new Dh([n[0],0,0,0,n[1],0,0,0,n[2]])).normalize()),{mbs:[o[0],o[1],o[2],r],obb:{center:[o[0],o[1],o[2]],halfSize:n,quaternion:i}}}function um(e,t){const r=function(e){const t=[];for(let r=0;r<e.length;r+=3){const n=new Ds([e[r],e[r+1],e[r+2]]);t.push(n)}return t}(e),n=function(e,t=new wp){if(!e||0===e.length)return t.halfAxes=new Dh([0,0,0,0,0,0,0,0,0]),t.center=new Ds,t;const r=e.length,n=new Ds(0,0,0);for(const t of e)n.add(t);const i=1/r;n.multiplyByScalar(i);let a=0,o=0,s=0,u=0,c=0,l=0;for(const t of e){const e=Yp.copy(t).subtract(n);a+=e.x*e.x,o+=e.x*e.y,s+=e.x*e.z,u+=e.y*e.y,c+=e.y*e.z,l+=e.z*e.z}a*=i,o*=i,s*=i,u*=i,c*=i,l*=i;const h=tf;h[0]=a,h[1]=o,h[2]=s,h[3]=o,h[4]=u,h[5]=c,h[6]=s,h[7]=c,h[8]=l;const{unitary:p}=Vp(h,rf),f=t.halfAxes.copy(p);let d=f.getColumn(0,Xp),m=f.getColumn(1,Zp),g=f.getColumn(2,ef),y=-Number.MAX_VALUE,b=-Number.MAX_VALUE,v=-Number.MAX_VALUE,w=Number.MAX_VALUE,_=Number.MAX_VALUE,k=Number.MAX_VALUE;for(const t of e)y=Math.max(t.dot(d),y),b=Math.max(t.dot(m),b),v=Math.max(t.dot(g),v),w=Math.min(t.dot(d),w),_=Math.min(t.dot(m),_),k=Math.min(t.dot(g),k);d=d.multiplyByScalar(.5*(w+y)),m=m.multiplyByScalar(.5*(_+b)),g=g.multiplyByScalar(.5*(k+v)),t.center.copy(d).add(m).add(g);const x=$p.set(y-w,b-_,v-k).multiplyByScalar(.5),E=new Dh([x[0],0,0,0,x[1],0,0,0,x[2]]);return t.halfAxes.multiplyRight(E),t}(r),i=function(e,t=new Th){if(!e||0===e.length)return t.fromCenterRadius([0,0,0],0);const r=Pp.copy(e[0]),n=Tp.copy(r),i=Cp.copy(r),a=Bp.copy(r),o=Rp.copy(r),s=Op.copy(r),u=Ip.copy(r);for(const t of e){r.copy(t);const e=r.x,c=r.y,l=r.z;e<n.x&&r.copy(n),e>o.x&&r.copy(o),c<i.y&&r.copy(i),c>s.y&&r.copy(s),l<a.z&&r.copy(a),l>u.z&&r.copy(u)}const c=Dp.copy(o).subtract(n).magnitudeSquared(),l=Dp.copy(s).subtract(i).magnitudeSquared(),h=Dp.copy(u).subtract(a).magnitudeSquared();let p=n,f=o,d=c;l>d&&(d=l,p=i,f=s),h>d&&(d=h,p=a,f=u);const m=Mp;m.x=.5*(p.x+f.x),m.y=.5*(p.y+f.y),m.z=.5*(p.z+f.z);let g=Dp.copy(f).subtract(m).magnitudeSquared(),y=Math.sqrt(g);const b=Fp;b.x=n.x,b.y=i.y,b.z=a.z;const v=Lp;v.x=o.x,v.y=s.y,v.z=u.z;const w=Np.copy(b).add(v).multiplyByScalar(.5);let _=0;for(const t of e){r.copy(t);const e=Dp.copy(r).subtract(w).magnitude();e>_&&(_=e);const n=Dp.copy(r).subtract(m).magnitudeSquared();if(n>g){const e=Math.sqrt(n);y=.5*(y+e),g=y*y;const t=e-y;m.x=(y*m.x+t*r.x)/e,m.y=(y*m.y+t*r.y)/e,m.z=(y*m.z+t*r.z)/e}}return y<_?(m.to(t.center),t.radius=y):(w.to(t.center),t.radius=_),t}(r);let a=_u.WGS84.cartesianToCartographic(i.center,new Ds),o=_u.WGS84.cartesianToCartographic(n.center,new Ds);return a[2]=a[2]-t.getHeight(a[1],a[0]),o[2]=o[2]-t.getHeight(o[1],o[0]),{mbs:[a[0],a[1],a[2],i.radius],obb:{center:o,halfSize:n.halfSize,quaternion:n.quaternion}}}function cm(e){const t=e[3],r=new Ds(e[0],e[1],e[2]),n=new Dh([t,0,0,0,t,0,0,0,t]);return new wp(r,n)}async function lm(e,t,r={},n={}){const i=function(e){const t="3.3.0-alpha.5"!==e.version?" (worker-utils@3.3.0-alpha.5)":"";return`${e.name}@${e.version}${t}`}(e),a=za.getWorkerFarm(r),{source:o}=r,s={name:i,source:o};o||(s.url=Ua(e,r));const u=a.getWorkerPool(s),c=r.jobName||e.name,l=await u.startJob(c,hm.bind(null,n)),h=function e(t){if(null===t)return{};const r=Object.assign({},t);return Object.keys(r).forEach(n=>{"object"!=typeof t[n]||ArrayBuffer.isView(t[n])||t[n]instanceof Array?"function"==typeof r[n]||r[n]instanceof RegExp?r[n]={}:r[n]=t[n]:r[n]=e(t[n])}),r}(r);l.postMessage("process",{input:t,options:h});return(await l.result).result}async function hm(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":const{id:i,input:a,options:o}=n;try{if(!e.process)return void t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});const r=await e.process(a,o);t.postMessage("done",{id:i,result:r})}catch(e){const r=e instanceof Error?e.message:"unknown error";t.postMessage("error",{id:i,error:r})}break;default:console.warn("process-on-worker: unknown message "+r)}}const pm={id:"3d-tiles-attributes",name:"3DTiles Attributes Worker",module:"tile-converter",version:"3.3.0-alpha.5",options:{featureAttributes:null}};const fm="Tile converter does not work in browser, only in node js environment";function dm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class mm{constructor(){dm(this,"options",void 0),dm(this,"tilesetPath",void 0),dm(this,"vertexCounter",void 0),dm(this,"conversionStartTime",void 0),dm(this,"geoidHeightModel",void 0),dm(this,"sourceTileset",void 0),dm(this,"attributeStorageInfo",void 0),dm(this,"workerSource",{}),this.options={},this.tilesetPath="",this.vertexCounter=0,this.conversionStartTime=[0,0],this.geoidHeightModel=null,this.sourceTileset=null,this.attributeStorageInfo=null,this.workerSource={}}async convert(e){if(Pi)return console.log(fm),fm;const{inputUrl:t,outputPath:r,tilesetName:n,maxDepth:i,egmFilePath:a}=e;this.conversionStartTime=Ri.a.hrtime(),this.options={maxDepth:i},console.log("Loading egm file..."),this.geoidHeightModel=await Zo(a,Fd),console.log("Loading egm file completed!"),await this.loadWorkers();const o=await Zo(t,Sf,{});this.sourceTileset=new Cd(o,{loadOptions:{_nodeWorkers:!0,reuseWorkers:!0,"i3s-content-nodejs":{workerUrl:"./modules/i3s/dist/i3s-content-nodejs-worker.js"},i3s:{coordinateSystem:lh.LNGLAT_OFFSETS,decodeTextures:!1}}}),await this.sourceTileset.tilesetInitializationPromise;const s=this.sourceTileset.root;s.header.obb||(s.header.obb=cm(s.header.mbs)),this.tilesetPath=Object(Ci.join)(""+r,""+n),this.attributeStorageInfo=o.attributeStorageInfo;try{await tm(this.tilesetPath)}catch(e){}const u={boundingVolume:{box:Ld(s.header.obb,this.geoidHeightModel)},geometricError:zd(s),children:[]};await this._addChildren(s,u,1);const c=Ii()({root:u},{asset:{path:"asset",transform:e=>Ii()(e,{version:{path:"version",default:"1.0"}})},geometricError:{path:"root",transform:e=>e.geometricError},root:{path:"root",transform:e=>Ii()(e,om())}});await Zd(this.tilesetPath,JSON.stringify(c),"tileset.json"),this._finishConversion({slpk:!1,outputPath:r,tilesetName:n});za.getWorkerFarm({}).destroy()}async convertChildNode(e,t,r,n){const i=await this._loadChildNode(e,n);if(e.children.push(i),i.contentUrl){var a;await this.sourceTileset._loadTile(i),this.vertexCounter+=i.content.vertexCount;let e=null;this.attributeStorageInfo&&(e=await this._loadChildAttributes(i,this.attributeStorageInfo)),i.header.obb||(i.header.obb=cm(i.header.mbs));const n={box:Ld(i.header.obb,this.geoidHeightModel)},o={boundingVolume:n,geometricError:zd(i),children:[]},s={tileContent:i.content,textureFormat:null==i||null===(a=i.header)||void 0===a?void 0:a.textureFormat},u=await function(e,t){return lm(pm,e,t)}(s,{source:this.workerSource.tile3dWorkerSource,featureAttributes:e});o.content={uri:i.id+".b3dm",boundingVolume:n},await Zd(this.tilesetPath,new Uint8Array(u),i.id+".b3dm"),t.children.push(o),i.unloadContent(),await this._addChildren(i,o,r+1)}else await this._addChildren(i,t,r+1)}async _addChildren(e,t,r){if(this.options.maxDepth&&r>this.options.maxDepth)return;const n=[];for(const i of e.header.children||[])n.push(this.convertChildNode(e,t,r,i));await Promise.all(n)}async _loadChildNode(e,t){let r;if(this.sourceTileset.tileset.nodePages)console.log("Node conversion: "+t.id),r=await this.sourceTileset.tileset.nodePagesTile.formTileFromNodePages(t.id);else{const{loader:n}=this.sourceTileset,i=this._relativeUrlToFullUrl(e.url,t.href),a={i3s:{...this.sourceTileset.loadOptions,isTileHeader:!0,loadContent:!1}};console.log("Node conversion: "+i),r=await Zo(i,n,a)}return new yd(this.sourceTileset,r,e)}_relativeUrlToFullUrl(e,t){let r=e.split("/");const n=t.split("/");for(const e of n)switch(e){case".":continue;case"..":r=r.slice(0,-1);break;default:r.push(e)}return r.join("/")}async _loadChildAttributes(e,t){const r=[],{attributeUrls:n}=e.header;for(let e=0;e<n.length;e++){const i=n[e],a=t[e],o={attributeName:a.name,attributeType:this._getAttributeType(a)};r.push(Zo(i,dh,o))}const i=await Promise.all(r);return this._replaceNestedArrays(i),Object.assign({},...i)}_getAttributeType(e){return e.attributeValues?e.attributeValues.valueType:e.objectIds?"Oid32":""}_replaceNestedArrays(e){for(let t=0;t<e.length;t++){const r=e[t];for(const e in r)r[e]=Array.from(r[e])}}async _finishConversion(e){const t=await am(e),r=im(Ri.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finish conversion of I3S"),console.log("Total conversion time: "+r),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",t," bytes"),console.log("------------------------------------------------")}async loadWorkers(){console.log("Loading workers source...");const e=Ua(pm,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.tile3dWorkerSource=r,console.log("Loading workers source completed!")}}async function gm(e,t,r){if(function(e,t){return!!za.isSupported()&&(!!(Pi||null!=t&&t._nodeWorkers)&&(e.worker&&(null==t?void 0:t.worker)))}(t,r={...pa(),...r}))return await lm(t,e,r);if(t.encode)return await t.encode(e,r);if(t.encodeSync)return t.encodeSync(e,r);if(t.encodeText)return(new TextEncoder).encode(await t.encodeText(e,r));if(t.encodeInBatches){const n=function(e,t,r){if(t.encodeInBatches){const n=function(e){return[{table:e,start:0,end:e.length}]}(e);return t.encodeInBatches(n,r)}throw new Error("Writer could not encode data in batches")}(e,t,r),i=[];for await(const e of n)i.push(e);return Ja(...i)}if(!Pi&&t.encodeURLtoURL){const n=ym("input");await async function(e,t,r){e=Yi(e),Pi||await i.writeFile(e,Wa(t),{flag:"w"}),Vi(!1)}(n,e);const a=ym("output"),o=await async function(e,t,r,n){if(e=Yi(e),t=Yi(t),Pi||!r.encodeURLtoURL)throw new Error;return await r.encodeURLtoURL(e,t,n)}(n,a,t,r);return(await oa(o)).arrayBuffer()}throw new Error("Writer could not encode data")}function ym(e){return"/tmp/"+e}const bm={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"};Object.keys(bm);function vm(e,t,r){Vi(e instanceof ArrayBuffer);const n=new TextDecoder("utf8"),i=new Uint8Array(e,t,r);return n.decode(i)}const wm={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},_m={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...wm},km={[wm.DOUBLE]:Float64Array,[wm.FLOAT]:Float32Array,[wm.UNSIGNED_SHORT]:Uint16Array,[wm.UNSIGNED_INT]:Uint32Array,[wm.UNSIGNED_BYTE]:Uint8Array,[wm.BYTE]:Int8Array,[wm.SHORT]:Int16Array,[wm.INT]:Int32Array},xm={DOUBLE:wm.DOUBLE,FLOAT:wm.FLOAT,UNSIGNED_SHORT:wm.UNSIGNED_SHORT,UNSIGNED_INT:wm.UNSIGNED_INT,UNSIGNED_BYTE:wm.UNSIGNED_BYTE,BYTE:wm.BYTE,SHORT:wm.SHORT,INT:wm.INT};class Em{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(const t in km){if(km[t]===e)return t}throw new Error("Failed to convert GL type")}static fromName(e){const t=xm[e];if(!t)throw new Error("Failed to convert GL type");return t}static getArrayType(e){switch(e){case wm.UNSIGNED_SHORT_5_6_5:case wm.UNSIGNED_SHORT_4_4_4_4:case wm.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const t=km[e];if(!t)throw new Error("Failed to convert GL type");return t}}static getByteSize(e){return Em.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(Em.getArrayType(e))}static createTypedArray(e,t,r=0,n){void 0===n&&(n=(t.byteLength-r)/Em.getByteSize(e));return new(Em.getArrayType(e))(t,r,n)}}function Am(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Sm{constructor(e,t){Am(this,"json",void 0),Am(this,"buffer",void 0),Am(this,"featuresLength",0),Am(this,"_cachedTypedArrays",{}),this.json=e,this.buffer=t}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e,t=_m.UNSIGNED_INT,r=1){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(e,t,r,1,n.byteOffset):n}getPropertyArray(e,t,r){const n=this.json[e];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(t=Em.fromName(n.componentType)),this._getTypedArrayFromBinary(e,t,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(e,t,n)}getProperty(e,t,r,n,i){const a=this.json[e];if(!a)return a;const o=this.getPropertyArray(e,t,r);if(1===r)return o[n];for(let e=0;e<r;++e)i[e]=o[r*n+e];return i}_getTypedArrayFromBinary(e,t,r,n,i){const a=this._cachedTypedArrays;let o=a[e];return o||(o=Em.createTypedArray(t,this.buffer.buffer,this.buffer.byteOffset+i,n*r),a[e]=o),o}_getTypedArrayFromArray(e,t,r){const n=this._cachedTypedArrays;let i=n[e];return i||(i=Em.createTypedArray(t,r),n[e]=i),i}}const jm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tm={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},Cm={SCALAR:(e,t,r)=>{t[r]=e},VEC2:(e,t,r)=>{t[2*r+0]=e[0],t[2*r+1]=e[1]},VEC3:(e,t,r)=>{t[3*r+0]=e[0],t[3*r+1]=e[1],t[3*r+2]=e[2]},VEC4:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT2:(e,t,r)=>{t[4*r+0]=e[0],t[4*r+1]=e[1],t[4*r+2]=e[2],t[4*r+3]=e[3]},MAT3:(e,t,r)=>{t[9*r+0]=e[0],t[9*r+1]=e[1],t[9*r+2]=e[2],t[9*r+3]=e[3],t[9*r+4]=e[4],t[9*r+5]=e[5],t[9*r+6]=e[6],t[9*r+7]=e[7],t[9*r+8]=e[8],t[9*r+9]=e[9]},MAT4:(e,t,r)=>{t[16*r+0]=e[0],t[16*r+1]=e[1],t[16*r+2]=e[2],t[16*r+3]=e[3],t[16*r+4]=e[4],t[16*r+5]=e[5],t[16*r+6]=e[6],t[16*r+7]=e[7],t[16*r+8]=e[8],t[16*r+9]=e[9],t[16*r+10]=e[10],t[16*r+11]=e[11],t[16*r+12]=e[12],t[16*r+13]=e[13],t[16*r+14]=e[14],t[16*r+15]=e[15]}};const Bm=e=>void 0!==e;function Rm(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy");const i=t.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?function(e,t){let r,n,i;const a=e.instancesLength,o=e.classes;let s,u=e.classIds,c=e.parentCounts,l=e.parentIds,h=a;Bm(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(t.buffer,t.byteOffset+u.byteOffset,a));if(Bm(c))for(Bm(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,a)),s=new Uint16Array(a),h=0,r=0;r<a;++r)s[r]=h,h+=c[r];Bm(l)&&Bm(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,i=getBinaryAccessor(l),l=i.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,h));const p=o.length;for(r=0;r<p;++r){const e=o[r].length,n=o[r].instances,i=getBinaryProperties(e,n,t);o[r].instances=combine(i,n)}const f=new Array(p).fill(0),d=new Uint16Array(a);for(r=0;r<a;++r)n=u[r],d[r]=f[n],++f[n];const m={classes:o,classIds:u,classIndexes:d,parentCounts:c,parentIndexes:s,parentIds:l};return function(e){const t=e.classIds.length;for(let r=0;r<t;++r)Im(e,r,stack)}(m),m}(n,r):null}function Om(e,t,r){if(!e)return;const n=e.parentCounts;return e.parentIds?r(e,t):n>0?function(e,t,r){const n=e.classIds,i=e.parentCounts,a=e.parentIds,o=e.parentIndexes,s=n.length,u=scratchVisited;u.length=Math.max(u.length,s);const c=++marker,l=scratchStack;l.length=0,l.push(t);for(;l.length>0;){if(t=l.pop(),u[t]===c)continue;u[t]=c;const n=r(e,t);if(Bm(n))return n;const s=i[t],h=o[t];for(let e=0;e<s;++e){const r=a[h+e];r!==t&&l.push(r)}}return null}(e,t,r):function(e,t,r){let n=!0;for(;n;){const i=r(e,t);if(Bm(i))return i;const a=e.parentIds[t];n=a!==t,t=a}throw new Error("traverseHierarchySingleParent")}(e,t,r)}function Im(e,t,r){const n=e.parentCounts,i=e.parentIds,a=e.parentIndexes,o=e.classIds.length;if(!Bm(i))return;assert(t<o,`Parent index ${t} exceeds the total number of instances: ${o}`),assert(-1===r.indexOf(t),"Circular dependency detected in the batch table hierarchy."),r.push(t);const s=Bm(n)?n[t]:1,u=Bm(n)?a[t]:t;for(let n=0;n<s;++n){const a=i[u+n];a!==t&&Im(e,a,r)}r.pop(t)}function Pm(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dm(e){return null!=e}const Mm=(e,t)=>e,Fm={HIERARCHY:!0,extensions:!0,extras:!0};class Lm{constructor(e,t,r,n={}){var i;Pm(this,"json",void 0),Pm(this,"binary",void 0),Pm(this,"featureCount",void 0),Pm(this,"_extensions",void 0),Pm(this,"_properties",void 0),Pm(this,"_binaryProperties",void 0),Pm(this,"_hierarchy",void 0),Vi(r>=0),this.json=e||{},this.binary=t,this.featureCount=r,this._extensions=(null===(i=this.json)||void 0===i?void 0:i.extensions)||{},this._properties={};for(const e in this.json)Fm[e]||(this._properties[e]=this.json[e]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Rm(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,t){if(this._checkBatchId(e),Vi("string"==typeof t,t),this._hierarchy){return Dm(Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return e.classes[n].name===t}))}return!1}isExactClass(e,t){return Vi("string"==typeof t,t),this.getExactClassName(e)===t}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){const t=this._hierarchy.classIds[e];return this._hierarchy.classes[t].name}}hasProperty(e,t){return this._checkBatchId(e),Vi("string"==typeof t,t),Dm(this._properties[t])||this._hasPropertyInHierarchy(e,t)}getPropertyNames(e,t){this._checkBatchId(e),(t=Dm(t)?t:[]).length=0;const r=Object.keys(this._properties);return t.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(e,t),t}getProperty(e,t){if(this._checkBatchId(e),Vi("string"==typeof t,t),this._binaryProperties){const r=this._binaryProperties[t];if(Dm(r))return this._getBinaryProperty(r,e)}const r=this._properties[t];if(Dm(r))return Mm(r[e]);if(this._hierarchy){const r=this._getHierarchyProperty(e,t);if(Dm(r))return r}}setProperty(e,t,r){const n=this.featureCount;if(this._checkBatchId(e),Vi("string"==typeof t,t),this._binaryProperties){const n=this._binaryProperties[t];if(n)return void this._setBinaryProperty(n,e,r)}if(this._hierarchy&&this._setHierarchyProperty(this,e,t,r))return;let i=this._properties[t];Dm(i)||(this._properties[t]=new Array(n),i=this._properties[t]),i[e]=Mm(r)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,t){return e.unpack(e.typedArray,t)}_setBinaryProperty(e,t,r){e.pack(r,e.typedArray,t)}_initializeBinaryProperties(){let e=null;for(const t in this._properties){const r=this._properties[t],n=this._initializeBinaryProperty(t,r);n&&(e=e||{},e[t]=n)}return e}_initializeBinaryProperty(e,t){if("byteOffset"in t){const r=t;Vi(this.binary,`Property ${e} requires a batch table binary.`),Vi(r.type,`Property ${e} requires a type.`);const n=function(e,t,r,n){const{componentType:i}=e;Vi(e.componentType);const a="string"==typeof i?Em.fromName(i):i,o=jm[e.type],s=Tm[e.type],u=Cm[e.type];return r+=e.byteOffset,{values:Em.createTypedArray(a,t,r,o*n),type:a,size:o,unpacker:s,packer:u}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(e,t){if(!this._hierarchy)return!1;const r=Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r];return Dm(e.classes[n].instances[t])});return Dm(r)}_getPropertyNamesInHierarchy(e,t){Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n].instances;for(const e in i)i.hasOwnProperty(e)&&-1===t.indexOf(e)&&t.push(e)})}_getHierarchyProperty(e,t){return Om(this._hierarchy,e,(e,r)=>{const n=e.classIds[r],i=e.classes[n],a=e.classIndexes[r],o=i.instances[t];return Dm(o)?Dm(o.typedArray)?this._getBinaryProperty(o,a):Mm(o[a]):null})}_setHierarchyProperty(e,t,r,n){const i=Om(this._hierarchy,t,(e,i)=>{const a=e.classIds[i],o=e.classes[a],s=e.classIndexes[i],u=o.instances[r];return!!Dm(u)&&(Vi(i===t,`Inherited property "${r}" is read-only.`),Dm(u.typedArray)?this._setBinaryProperty(u,s,n):u[s]=Mm(n),!0)});return Dm(i)}}function Nm(e,t,r=0){const n=new DataView(t);if(e.magic=n.getUint32(r,!0),r+=4,e.version=n.getUint32(r,!0),r+=4,e.byteLength=n.getUint32(r,!0),r+=4,1!==e.version)throw new Error(`3D Tile Version ${e.version} not supported`);return r}function zm(e,t,r){const n=new DataView(t);let i;e.header=e.header||{};let a=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let s=n.getUint32(r,!0);r+=4;let u=n.getUint32(r,!0);return r+=4,s>=570425344?(r-=8,i=a,s=o,u=0,a=0,o=0,console.warn("b3dm tile in legacy format.")):u>=570425344&&(r-=4,i=s,s=a,u=o,a=0,o=0,console.warn("b3dm tile in legacy format.")),e.header.featureTableJsonByteLength=a,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=s,e.header.batchTableBinaryByteLength=u,e.header.batchLength=i,r}function Um(e,t,r,n){return r=function(e,t,r,n){const{featureTableJsonByteLength:i,featureTableBinaryByteLength:a,batchLength:o}=e.header;if(e.featureTableJson={BATCH_LENGTH:o||0},i>0){const n=vm(t,r,i);e.featureTableJson=JSON.parse(n)}return r+=i,e.featureTableBinary=new Uint8Array(t,r,a),r+=a}(e,t,r),r=function(e,t,r,n){const{batchTableJsonByteLength:i,batchTableBinaryByteLength:a}=e.header;if(i>0){const n=vm(t,r,i);e.batchTableJson=JSON.parse(n),r+=i,a>0&&(e.batchTableBinary=new Uint8Array(t,r,a),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=a)}return r}(e,t,r)}function qm(e,t=[0,0,0]){const r=e>>11&31,n=e>>5&63,i=31&e;return t[0]=r<<3,t[1]=n<<2,t[2]=i<<3,t}function Hm(e,t,r){if(!(t||e&&e.batchIds&&r))return null;const{batchIds:n,isRGB565:i,pointCount:a}=e;if(n&&r){const e=new Uint8ClampedArray(3*a);for(let t=0;t<a;t++){const i=n[t],a=r.getProperty(i,"dimensions").map(e=>255*e);e[3*t]=a[0],e[3*t+1]=a[1],e[3*t+2]=a[2]}return{type:_m.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}if(i){const e=new Uint8ClampedArray(3*a);for(let r=0;r<a;r++){const n=qm(t[r]);e[3*r]=n[0],e[3*r+1]=n[1],e[3*r+2]=n[2]}return{type:_m.UNSIGNED_BYTE,value:e,size:3,normalized:!0}}return t&&t.length===3*a?{type:_m.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:_m.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}class Gm extends ys{constructor(e=0,t=0){super(2),as(e)&&1===arguments.length?this.copy(e):(ns.debug&&(fs(e),fs(t)),this[0]=e,this[1]=t)}set(e,t){return this[0]=e,this[1]=t,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Us(this,this,e),this.check()}transformAsVector(e){return Bs(this,this,e),this.check()}transformByMatrix3(e){return zs(this,this,e),this.check()}transformByMatrix2x3(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5]}(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){var n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i}(this,this,e),this.check()}}function Vm(e,t){if(!e)throw new Error("math.gl assertion failed. "+t)}new Gm,new Ds,new Gm,new Gm,new Uint8Array(1);function Wm(e,t=255){return ls(e,0,t)/t*2-1}function Km(e){return e<0?-1:1}function Jm(e,t,r,n){if(Vm(n),e<0||e>r||t<0||t>r)throw new Error("x and y must be unsigned normalized integers between 0 and "+r);if(n.x=Wm(e,r),n.y=Wm(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const e=n.x;n.x=(1-Math.abs(n.y))*Km(e),n.y=(1-Math.abs(e))*Km(n.y)}return n.normalize()}function Qm(e,t,r){return Jm(e,t,255,r)}const Ym=new Ds;function $m(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,function(e,t){const r=new Ds,n=new Float32Array(3*e.pointCount);for(let i=0;i<e.pointCount;i++)r.set(t[3*i],t[3*i+1],t[3*i+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,3*i);return n}(e,t)):{type:_m.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}async function Xm(e,t,r,n,i){r=Um(e,t,r=zm(e,t,r=Nm(e,t,r))),function(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}(e);const{featureTable:a,batchTable:o}=function(e){const t=new Sm(e.featureTableJson,e.featureTableBinary),r=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=r,e.featuresLength=r,e.pointsLength=r,e.pointCount=r,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",_m.FLOAT,3);const n=function(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",_m.UNSIGNED_SHORT,1),e.batchIds)){const n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:i,batchTableBinary:a}=e;r=new Lm(i,a,n)}return r}(e,t);return{featureTable:t,batchTable:n}}(e);return await async function(e,t,r,n,i){let a,o,s;const u=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];u&&(s=u.properties);const c=t.getExtension("3DTILES_draco_point_compression");if(c){o=c.properties;const t=c.byteOffset,r=c.byteLength;if(!o||!Number.isFinite(t)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");a=e.featureTableBinary.slice(t,t+r),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!a)return!0;const l={buffer:a,properties:{...o,...s},featureTableProperties:o,batchTableProperties:s,dequantizeInShader:!1};return await async function(e,t,r,n){const{parse:i}=n,a={...r,draco:{...r.draco,extraAttributes:t.batchTableProperties||{}}};delete a["3d-tiles"];const o=await i(t.buffer,Rc,a),s=o.attributes.POSITION&&o.attributes.POSITION.value,u=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,c=o.attributes.NORMAL&&o.attributes.NORMAL.value,l=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,h=s&&o.attributes.POSITION.value.quantization,p=c&&o.attributes.NORMAL.value.quantization;if(h){const t=o.POSITION.data.quantization,r=t.range;e.quantizedVolumeScale=new Ds(r,r,r),e.quantizedVolumeOffset=new Ds(t.minValues),e.quantizedRange=(1<<t.quantizationBits)-1,e.isQuantizedDraco=!0}p&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);const f={};if(t.batchTableProperties)for(const e of Object.keys(t.batchTableProperties))o.attributes[e]&&o.attributes[e].value&&(f[e.toLowerCase()]=o.attributes[e].value);e.attributes={positions:s,colors:Hm(e,u,void 0),normals:c,batchIds:l,...f}}(e,l,n,i)}(e,a,0,n,i),function(e,t,r){if(!e.attributes.positions)if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",_m.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){const n=t.getPropertyArray("POSITION_QUANTIZED",_m.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=65535,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",_m.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",_m.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=$m(e,n,r)}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(e,a,n),function(e,t,r){if(!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",_m.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",_m.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",_m.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Hm(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",_m.UNSIGNED_BYTE,4))}(e,a,o),function(e,t){if(!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",_m.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",_m.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=function(e,t){if(!t)return null;if(e.isOctEncoded16P){const r=new Float32Array(3*e.pointsLength);for(let n=0;n<e.pointsLength;n++)Qm(t[2*n],t[2*n+1],Ym),Ym.toArray(r,3*n);return{type:_m.FLOAT,size:2,value:r}}return{type:_m.FLOAT,size:2,value:t}}(e,r)}}(e,a),r}function Zm(e,t,r){if(e.byteLength<=t+r)return"";const n=new DataView(e);let i="";for(let e=0;e<r;e++)i+=String.fromCharCode(n.getUint8(t+e));return i}function eg(e){try{return JSON.parse(e)}catch(t){throw new Error(`Failed to parse JSON from data starting with "${function(e,t=5){if("string"==typeof e)return e.slice(0,t);if(ArrayBuffer.isView(e))return Zm(e.buffer,e.byteOffset,t);if(e instanceof ArrayBuffer){return Zm(e,0,t)}return""}(e)}"`)}}function tg(e,t){if(!e)throw new Error(t||"assert failed: gltf")}function rg(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;const r=t.baseUri||t.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url "+e);return r.substr(0,r.lastIndexOf("/")+1)+e}function ng(e,t,r){const n=e.bufferViews[r];tg(n);const i=t[n.buffer];tg(i);const a=(n.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,a,n.byteLength)}function ig(e,t){return Vi(e>=0),Vi(t>0),e+(t-1)&~(t-1)}function ag(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{const t=e.byteOffset,r=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,t,r)}return t.set(n,r),r+ig(n.byteLength,4)}const og=["SCALAR","VEC2","VEC3","VEC4"],sg=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ug=new Map(sg),cg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},lg={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},hg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function pg(e){return og[e-1]||og[0]}function fg(e){const t=ug.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function dg(e,t){const r=hg[e.componentType],n=cg[e.type],i=lg[e.componentType],a=e.count*n,o=e.count*n*i;return tg(o>=0&&o<=t.byteLength),{ArrayType:r,length:a,byteLength:o}}function mg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const gg={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class yg{constructor(e){mg(this,"gltf",void 0),mg(this,"sourceBuffers",void 0),mg(this,"byteLength",void 0),this.gltf=e||{json:{...gg},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];if(!r)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return r}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,r=this.gltf.buffers[t];tg(r);const n=(e.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,{ArrayType:n,length:i}=dg(e,t);return new n(r,t.byteOffset+e.byteOffset,i)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBufferView(e.bufferView),r=this.getBuffer(t.buffer).data,n=t.byteOffset||0;return new Uint8Array(r,n,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addObjectExtension(e,t,r){return e.extensions=e.extensions||{},e.extensions[t]=r,this.registerUsedExtension(t),this}setObjectExtension(e,t,r){(e.extensions||{})[t]=r}removeObjectExtension(e,t){const r=e.extensions||{},n=r[t];return delete r[t],n}addExtension(e,t={}){return tg(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),t}addRequiredExtension(e,t={}){return tg(t),this.addExtension(e,t),this.registerRequiredExtension(e),t}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setDefaultScene(e){this.json.scene=e}addScene(e){const{nodeIndices:t}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:t}),this.json.scenes.length-1}addNode(e){const{meshIndex:t,matrix:r}=e;this.json.nodes=this.json.nodes||[];const n={mesh:t};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(e){const{attributes:t,indices:r,material:n,mode:i=4}=e,a={primitives:[{attributes:this._addAttributes(t),mode:i}]};if(r){const e=this._addIndices(r);a.primitives[0].indices=e}return Number.isFinite(n)&&(a.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){const r=Lu(e),n=t||(null==r?void 0:r.mimeType),i={bufferView:this.addBufferView(e),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(e){const t=e.byteLength;tg(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=ig(t,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(e,t){const r={bufferView:e,type:pg(t.size),componentType:t.componentType,count:t.count,max:t.max,min:t.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const r=this.addBufferView(e);let n={min:t.min,max:t.max};n.min&&n.max||(n=this._getAccessorMinMax(e,t.size));const i={size:t.size,componentType:fg(e),count:Math.round(e.length/t.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(i,t))}addTexture(e){const{imageIndex:t}=e,r={source:t};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,t;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),i=new Uint8Array(n);let a=0;for(const e of this.sourceBuffers||[])a=ag(e,i,a);null!==(e=this.json)&&void 0!==e&&null!==(t=e.buffers)&&void 0!==t&&t[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(e,t){let r=!0;for(;r;){const n=e.indexOf(t);n>-1?e.splice(n,1):r=!1}}_addAttributes(e={}){const t={};for(const r in e){const n=e[r],i=this._getGltfAttributeName(r),a=this.addBinaryBuffer(n.value,n);t[i]=a}return t}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,t){const r={min:null,max:null};if(e.length<t)return r;r.min=[],r.max=[];const n=e.subarray(0,t);for(const e of n)r.min.push(e),r.max.push(e);for(let n=t;n<e.length;n+=t)for(let i=0;i<t;i++)r.min[0+i]=Math.min(r.min[0+i],e[n+i]),r.max[0+i]=Math.max(r.max[0+i],e[n+i]);return r}}const bg=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),vg=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),wg={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},_g={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};let kg;async function xg(){return kg||(kg=async function(){let e="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";WebAssembly.validate(bg)&&(e="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support"));const t=await WebAssembly.instantiate(function(e){const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?vg[t[n]]:64*(t[n]-60)+t[++n];return t.buffer.slice(0,r)}(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}()),kg}function Eg(e,t,r,n,i,a,o){const s=e.exports.sbrk,u=n+3&-4,c=s(u*i),l=s(a.length),h=new Uint8Array(e.exports.memory.buffer);h.set(a,l);const p=t(c,n,i,l,a.length);if(0===p&&o&&o(c,u,i),r.set(h.subarray(c,c+n*i)),s(c-s(0)),0!==p)throw new Error("Malformed buffer data: "+p)}const Ag="EXT_meshopt_compression";async function Sg(e,t){var r;const n=new yg(e);if(null==t||null===(r=t.gltf)||void 0===r||!r.decompressMeshes)return;const i=[];for(const t of e.json.bufferViews||[])i.push(jg(n,t));await Promise.all(i),n.removeExtension("EXT_meshopt_compression")}async function jg(e,t){const r=e.getObjectExtension(t,"EXT_meshopt_compression");if(r){const{byteOffset:n=0,byteLength:i=0,byteStride:a,count:o,mode:s,filter:u="NONE",buffer:c}=r,l=e.gltf.buffers[c],h=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);return await async function(e,t,r,n,i,a="NONE"){const o=await xg();Eg(o,o.exports[_g[i]],e,t,r,n,o.exports[wg[a||"NONE"]])}(p,o,a,h,s,u),p}return null}const Tg=["image/png","image/jpeg","image/gif"],Cg={};function Bg(e){return void 0===Cg[e]&&(Cg[e]=function(e){switch(e){case"image/webp":return function(){if(!Pi)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return Pi;default:if(!Pi){const{_parseImageNode:t}=globalThis;return Boolean(t)&&Tg.includes(e)}return!0}}(e)),Cg[e]}const Rg="EXT_texture_webp";function Og(e,t){const r=new yg(e);if(!Bg("image/webp")){if(r.getRequiredExtensions().includes("EXT_texture_webp"))throw new Error("gltf: Required extension EXT_texture_webp not supported by browser");return}const{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"EXT_texture_webp");t&&(e.source=t.source),r.removeObjectExtension(e,"EXT_texture_webp")}r.removeExtension("EXT_texture_webp")}const Ig="KHR_texture_basisu";function Pg(e,t){const r=new yg(e),{json:n}=r;for(const e of n.textures||[]){const t=r.getObjectExtension(e,"KHR_texture_basisu");t&&(e.source=t.source),r.removeObjectExtension(e,"KHR_texture_basisu")}r.removeExtension("KHR_texture_basisu")}function Dg(e){const{buffer:t,size:r,count:n}=function(e){let t=e,r=1,n=0;e&&e.value&&(t=e.value,r=e.size||1);t&&(ArrayBuffer.isView(t)||(t=function(e,t,r=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(r&&!(e instanceof t))return new t(e);return e}(t,Float32Array)),n=t.length/r);return{buffer:t,size:r,count:n}}(e);return{value:t,size:r,byteOffset:0,count:n,type:pg(r),componentType:fg(t)}}const Mg="KHR_draco_mesh_compression";function Fg(e,t,r){const n=new yg(e);for(const e of qg(n))n.getObjectExtension(e,"KHR_draco_mesh_compression")}async function Lg(e,t,r){var n;if(null==t||null===(n=t.gltf)||void 0===n||!n.decompressMeshes)return;const i=new yg(e),a=[];for(const e of qg(i))i.getObjectExtension(e,"KHR_draco_mesh_compression")&&a.push(zg(i,e,t,r));await Promise.all(a),i.removeExtension("KHR_draco_mesh_compression")}function Ng(e,t={}){const r=new yg(e);for(const e of r.json.meshes||[])Ug(e,t),r.addRequiredExtension("KHR_draco_mesh_compression")}async function zg(e,t,r,n){const i=e.getObjectExtension(t,"KHR_draco_mesh_compression");if(!i)return;const a=e.getTypedArrayForBufferView(i.bufferView),o=Ya(a.buffer,a.byteOffset),{parse:s}=n,u={...r};delete u["3d-tiles"];const c=await s(o,Rc,u,n),l=function(e){const t={};for(const r in e){const n=e[r];if("indices"!==r){const e=Dg(n);t[r]=e}}return t}(c.attributes);for(const[r,n]of Object.entries(l))if(r in t.attributes){const i=t.attributes[r],a=e.getAccessor(i);null!=a&&a.min&&null!=a&&a.max&&(n.min=a.min,n.max=a.max)}t.attributes=l,c.indices&&(t.indices=Dg(c.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(t)}function Ug(e,t,r=4,n,i){var a;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:e}),s=null==i||null===(a=i.parseSync)||void 0===a?void 0:a.call(i,{attributes:e}),u=n._addFauxAttributes(s.attributes);return{primitives:[{attributes:u,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(o),attributes:u}}}]}}function*qg(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}const Hg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Gg={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};const Vg="KHR_texture_transform",Wg=new Ds,Kg=new Dh,Jg=new Dh;async function Qg(e,t){if(!new yg(e).getExtension("KHR_texture_transform"))return;const r=e.json.materials||[];for(let t=0;t<r.length;t++)Yg(t,e)}function Yg(e,t){var r,n,i;const a=[],o=null===(r=t.json.materials)||void 0===r?void 0:r[e],s=null==o||null===(n=o.pbrMetallicRoughness)||void 0===n?void 0:n.baseColorTexture;s&&$g(t,e,s,a);const u=null==o?void 0:o.emissiveTexture;u&&$g(t,e,u,a);const c=null==o?void 0:o.normalTexture;c&&$g(t,e,c,a);const l=null==o?void 0:o.occlusionTexture;l&&$g(t,e,l,a);const h=null==o||null===(i=o.pbrMetallicRoughness)||void 0===i?void 0:i.metallicRoughnessTexture;h&&$g(t,e,h,a)}function $g(e,t,r,n){const i=function(e,t){var r;const n=null===(r=e.extensions)||void 0===r?void 0:r.KHR_texture_transform,{texCoord:i=0}=e,{texCoord:a=i}=n;if(-1===t.findIndex(([e,t])=>e===i&&t===a)){const r=function(e){const{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,i=(new Dh).set(1,0,0,0,1,0,t[0],t[1],1),a=Kg.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),o=Jg.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(a).multiplyRight(o)}(n);return i!==a&&(e.texCoord=a),t.push([i,a]),{originalTexCoord:i,texCoord:a,matrix:r}}return null}(r,n);if(!i)return;const a=e.json.meshes||[];for(const r of a)for(const n of r.primitives){const r=n.material;Number.isFinite(r)&&t===r&&Xg(e,n,i)}}function Xg(e,t,r){const{originalTexCoord:n,texCoord:i,matrix:a}=r,o=t.attributes["TEXCOORD_"+n];if(Number.isFinite(o)){var s;const r=null===(s=e.json.accessors)||void 0===s?void 0:s[o];if(r&&r.bufferView){var u;const o=null===(u=e.json.bufferViews)||void 0===u?void 0:u[r.bufferView];if(o){const{arrayBuffer:s,byteOffset:u}=e.buffers[o.buffer],c=(u||0)+(r.byteOffset||0)+(o.byteOffset||0),{ArrayType:l,length:h}=dg(r,o),p=Gg[r.componentType],f=Hg[r.type],d=o.byteStride||p*f,m=new Float32Array(h);for(let e=0;e<r.count;e++){const t=new l(s,c+e*d,2);Wg.set(t[0],t[1],1),Wg.transformByMatrix3(a),m.set([Wg[0],Wg[1]],e*f)}n===i?function(e,t,r,n){e.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),t.buffer=r.length-1,t.byteLength=n.buffer.byteLength,t.byteOffset=0,delete t.byteStride}(r,o,e.buffers,m):function(e,t,r,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});const a=n.json.bufferViews;if(!a)return;a.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});const o=n.json.accessors;if(!o)return;o.push({bufferView:(null==a?void 0:a.length)-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes["TEXCOORD_"+e]=o.length-1}(i,r,t,e,m)}}}}const Zg="KHR_lights_punctual";async function ey(e){const t=new yg(e),{json:r}=t,n=t.getExtension("KHR_lights_punctual");n&&(t.json.lights=n.lights,t.removeExtension("KHR_lights_punctual"));for(const e of r.nodes||[]){const r=t.getObjectExtension(e,"KHR_lights_punctual");r&&(e.light=r.light),t.removeObjectExtension(e,"KHR_lights_punctual")}}async function ty(e){const t=new yg(e),{json:r}=t;if(r.lights){const e=t.addExtension("KHR_lights_punctual");tg(!e.lights),e.lights=r.lights,delete r.lights}if(t.json.lights){for(const e of t.json.lights){const r=e.node;t.addObjectExtension(r,"KHR_lights_punctual",e)}delete t.json.lights}}const ry="KHR_materials_unlit";async function ny(e){const t=new yg(e),{json:r}=t;t.removeExtension("KHR_materials_unlit");for(const e of r.materials||[]){e.extensions&&e.extensions.KHR_materials_unlit&&(e.unlit=!0),t.removeObjectExtension(e,"KHR_materials_unlit")}}function iy(e){const t=new yg(e),{json:r}=t;if(t.materials)for(const e of r.materials||[])e.unlit&&(delete e.unlit,t.addObjectExtension(e,"KHR_materials_unlit",{}),t.addExtension("KHR_materials_unlit"))}const ay="KHR_techniques_webgl";async function oy(e){const t=new yg(e),{json:r}=t,n=t.getExtension("KHR_techniques_webgl");if(n){const e=function(e,t){const{programs:r=[],shaders:n=[],techniques:i=[]}=e,a=new TextDecoder;return n.forEach(e=>{if(!Number.isFinite(e.bufferView))throw new Error("KHR_techniques_webgl: no shader code");e.code=a.decode(t.getTypedArrayForBufferView(e.bufferView))}),r.forEach(e=>{e.fragmentShader=n[e.fragmentShader],e.vertexShader=n[e.vertexShader]}),i.forEach(e=>{e.program=r[e.program]}),i}(n,t);for(const n of r.materials||[]){const r=t.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,e[r.technique]),n.technique.values=uy(n.technique,t)),t.removeObjectExtension(n,"KHR_techniques_webgl")}t.removeExtension("KHR_techniques_webgl")}}async function sy(e,t){}function uy(e,t){const r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(t=>{e.uniforms[t].value&&!(t in r)&&(r[t]=e.uniforms[t].value)}),Object.keys(r).forEach(e=>{"object"==typeof r[e]&&void 0!==r[e].index&&(r[e].texture=t.getTexture(r[e].index))}),r}const cy="EXT_feature_metadata";async function ly(e){!function(e){var t;const r=e.getExtension("EXT_feature_metadata"),n=null==r||null===(t=r.schema)||void 0===t?void 0:t.classes,i=null==r?void 0:r.featureTables;(null==r?void 0:r.featureTextures)&&console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');if(n&&i)for(const t in n){const r=n[t],a=fy(i,t);a&&hy(e,a,r)}}(new yg(e))}function hy(e,t,r){for(const i in r.properties){var n;const a=r.properties[i],o=null==t||null===(n=t.properties)||void 0===n?void 0:n[i],s=t.count;if(o){const t=py(e,a,s,o);o.data=t}}}function py(e,t,r,n){const i=n.bufferView;let a=e.getTypedArrayForBufferView(i);switch(t.type){case"STRING":{const t=n.stringOffsetBufferView;a=function(e,t,r){const n=[],i=new TextDecoder("utf8");let a=0;for(let o=0;o<r;o++){const r=t[4*(o+1)]-t[4*o],s=e.subarray(a,r+a),u=i.decode(s);n.push(u),a+=r}return n}(a,e.getTypedArrayForBufferView(t),r);break}}return a}function fy(e,t){for(const r in e){const n=e[r];if(n.class===t)return n}return null}const dy=[a,o,s,u,l,h,p,c,f];function my(e,t){var r;const n=(null==t||null===(r=t.gltf)||void 0===r?void 0:r.excludeExtensions)||{};return!(e in n&&!n[e])}function gy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const yy={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},by={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class vy{constructor(){gy(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),gy(this,"json",void 0)}normalize(e,t){this.json=e.json;const r=e.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version "+r.asset.version)}if(!t.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),function(e){const t=new yg(e),{json:r}=t;for(const e of r.images||[]){const r=t.getObjectExtension(e,"KHR_binary_glTF");r&&Object.assign(e,r),t.removeObjectExtension(e,"KHR_binary_glTF")}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension("KHR_binary_glTF")}(e),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(const t in yy)this._convertTopLevelObjectToArray(e,t)}_convertTopLevelObjectToArray(e,t){const r=e[t];if(r&&!Array.isArray(r)){e[t]=[];for(const n in r){const i=r[n];i.id=i.id||n;const a=e[t].length;e[t].push(i),this.idToIndexMap[t][n]=a}}}_convertObjectIdsToArrayIndices(e){for(const t in yy)this._convertIdsToIndices(e,t);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(const t of e.textures)this._convertTextureIds(t);for(const t of e.meshes)this._convertMeshIds(t);for(const t of e.nodes)this._convertNodeIds(t);for(const t of e.scenes)this._convertSceneIds(t)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(const t of e.primitives){const{attributes:e,indices:r,material:n}=t;for(const t in e)e[t]=this._convertIdToIndex(e[t],"accessor");r&&(t.indices=this._convertIdToIndex(r,"accessor")),n&&(t.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(e=>this._convertIdToIndex(e,"node"))),e.meshes&&(e.meshes=e.meshes.map(e=>this._convertIdToIndex(e,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(e=>this._convertIdToIndex(e,"node")))}_convertIdsToIndices(e,t){e[t]||(console.warn("gltf v1: json doesn't contain attribute "+t),e[t]=[]);for(const r of e[t])for(const e in r){const t=r[e],n=this._convertIdToIndex(t,e);r[e]=n}}_convertIdToIndex(e,t){const r=by[t];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][e];if(!Number.isFinite(n))throw new Error(`gltf v1: failed to resolve ${t} with id ${e}`);return n}return e}_updateObjects(e){for(const e of this.json.buffers)delete e.type}_updateMaterial(e){for(const i of e.materials){var t,r,n;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const a=(null===(t=i.values)||void 0===t?void 0:t.tex)||(null===(r=i.values)||void 0===r?void 0:r.texture2d_0)||(null===(n=i.values)||void 0===n?void 0:n.diffuseTex),o=e.textures.findIndex(e=>e.id===a);-1!==o&&(i.pbrMetallicRoughness.baseColorTexture={index:o})}}}function wy(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const _y={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ky={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},xy=10240,Ey=10241,Ay=10242,Sy=10243,jy=10497,Ty={magFilter:xy,minFilter:Ey,wrapS:Ay,wrapT:Sy},Cy={[xy]:9729,[Ey]:9986,[Ay]:jy,[Sy]:jy};class By{constructor(){wy(this,"baseUri",""),wy(this,"json",{}),wy(this,"buffers",[]),wy(this,"images",[])}postProcess(e,t={}){const{json:r,buffers:n=[],images:i=[],baseUri:a=""}=e;return tg(r),this.baseUri=a,this.json=r,this.buffers=n,this.images=i,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,t)=>this._resolveImage(e,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){return e.id=e.id||"scene-"+t,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||"node-"+t,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh?e.mesh=this.getMesh(e.mesh):void 0!==e.meshes&&e.meshes.length&&(e.mesh=e.meshes.reduce((e,t)=>{const r=this.getMesh(t);return e.id=r.id,e.primitives=e.primitives.concat(r.primitives),e},{primitives:[]})),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||"skin-"+t,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||"mesh-"+t,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const r in t)e.attributes[r]=this.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||"material-"+t,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.emissiveFactor||(e.emissiveFactor=e.emmisiveTexture?[1,1,1]:[0,0,0]),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var r,n;if(e.id=e.id||"accessor-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(r=e.componentType,ky[r]),e.components=(n=e.type,_y[n]),e.bytesPerElement=e.bytesPerComponent*e.components,e.bufferView){const t=e.bufferView.buffer,{ArrayType:r,byteLength:n}=dg(e,e.bufferView),i=(e.bufferView.byteOffset||0)+(e.byteOffset||0)+t.byteOffset;let a=t.arrayBuffer.slice(i,i+n);e.bufferView.byteStride&&(a=this._getValueFromInterleavedBuffer(t,i,e.bufferView.byteStride,e.bytesPerElement,e.count)),e.value=new r(a)}return e}_getValueFromInterleavedBuffer(e,t,r,n,i){const a=new Uint8Array(i*n);for(let o=0;o<i;o++){const i=t+o*r;a.set(new Uint8Array(e.arrayBuffer.slice(i,i+n)),o*n)}return a.buffer}_resolveTexture(e,t){return e.id=e.id||"texture-"+t,e.sampler="sampler"in e?this.getSampler(e.sampler):Cy,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||"sampler-"+t,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}return e}_enumSamplerParameter(e){return Ty[e]}_resolveImage(e,t){e.id=e.id||"image-"+t,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const r=this.images[t];return r&&(e.image=r),e}_resolveBufferView(e,t){const r=e.buffer,n={id:"bufferView-"+t,...e,buffer:this.buffers[r]},i=this.buffers[r].arrayBuffer;let a=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(a+=e.byteOffset),n.data=new Uint8Array(i,a,e.byteLength),n}_resolveCamera(e,t){return e.id=e.id||"camera-"+t,e.perspective,e.orthographic,e}}const Ry=1735152710;function Oy(e,t=0,r={}){const n=new DataView(e),{magic:i=Ry}=r,a=n.getUint32(t,!1);return a===i||a===Ry}function Iy(e,t,r=0,n={}){const i=new DataView(t),a=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(i,r+0),o=i.getUint32(r+4,!0),s=i.getUint32(r+8,!0);switch(Object.assign(e,{header:{byteOffset:r,byteLength:s,hasBinChunk:!1},type:a,version:o,json:{},binChunks:[]}),r+=12,e.version){case 1:return function(e,t,r){Vi(e.header.byteLength>20);const n=t.getUint32(r+0,!0),i=t.getUint32(r+4,!0);return r+=8,Vi(0===i),Py(e,t,r,n),r+=n,r+=Dy(e,t,r,e.header.byteLength)}(e,i,r);case 2:return function(e,t,r,n){return Vi(e.header.byteLength>20),function(e,t,r,n){for(;r+8<=e.header.byteLength;){const i=t.getUint32(r+0,!0),a=t.getUint32(r+4,!0);switch(r+=8,a){case 1313821514:Py(e,t,r,i);break;case 5130562:Dy(e,t,r,i);break;case 0:n.strict||Py(e,t,r,i);break;case 1:n.strict||Dy(e,t,r,i)}r+=ig(i,4)}}(e,t,r,n),r+e.header.byteLength}(e,i,r,{});default:throw new Error(`Invalid GLB version ${e.version}. Only supports v1 and v2.`)}}function Py(e,t,r,n){const i=new Uint8Array(t.buffer,r,n),a=new TextDecoder("utf8").decode(i);return e.json=JSON.parse(a),ig(n,4)}function Dy(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),ig(n,4)}async function My(e,t,r=0,n,i){var a,o,s,u;!function(e,t,r,n){n.uri&&(e.baseUri=n.uri);if(t instanceof ArrayBuffer&&!Oy(t,r,n)){const e=new TextDecoder;t=e.decode(t)}if("string"==typeof t)e.json=eg(t);else if(t instanceof ArrayBuffer){const i={};r=Iy(i,t,r,n.glb),tg("glTF"===i.type,"Invalid GLB magic string "+i.type),e._glb=i,e.json=i.json}else tg(!1,"GLTF: must be ArrayBuffer or string");const i=e.json.buffers||[];if(e.buffers=new Array(i.length).fill(null),e._glb&&e._glb.header.hasBinChunk){const{binChunks:t}=e._glb;e.buffers[0]={arrayBuffer:t[0].arrayBuffer,byteOffset:t[0].byteOffset,byteLength:t[0].byteLength}}const a=e.json.images||[];e.images=new Array(a.length).fill({})}(e,t,r,n),function(e,t={}){(new vy).normalize(e,t)}(e,{normalize:null==n||null===(a=n.gltf)||void 0===a?void 0:a.normalize}),function(e,t={},r){const n=dy.filter(e=>my(e.name,t));for(const a of n){var i;null===(i=a.preprocess)||void 0===i||i.call(a,e,t,r)}}(e,n,i);const c=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&e.json.buffers&&await async function(e,t,r){const n=e.json.buffers||[];for(let o=0;o<n.length;++o){const s=n[o];if(s.uri){var i,a;const{fetch:n}=r;tg(n);const u=rg(s.uri,t),c=await(null==r||null===(i=r.fetch)||void 0===i?void 0:i.call(r,u)),l=await(null==c||null===(a=c.arrayBuffer)||void 0===a?void 0:a.call(c));e.buffers[o]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete s.uri}else null===e.buffers[o]&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(s.byteLength),byteOffset:0,byteLength:s.byteLength})}}(e,n,i),null!=n&&null!==(s=n.gltf)&&void 0!==s&&s.loadImages){const t=async function(e,t,r){const n=function(e){const t=new Set,r=e.json.textures||[];for(const e of r)void 0!==e.source&&t.add(e.source);return Array.from(t).sort()}(e),i=e.json.images||[],a=[];for(const o of n)a.push(Fy(e,i[o],o,t,r));return await Promise.all(a)}(e,n,i);c.push(t)}const l=async function(e,t={},r){const n=dy.filter(e=>my(e.name,t));for(const a of n){var i;await(null===(i=a.decode)||void 0===i?void 0:i.call(a,e,t,r))}}(e,n,i);return c.push(l),await Promise.all(c),null!=n&&null!==(u=n.gltf)&&void 0!==u&&u.postProcess?function(e,t){return(new By).postProcess(e,t)}(e,n):e}async function Fy(e,t,r,n,i){const{fetch:a,parse:o}=i;let s;if(t.uri&&!t.hasOwnProperty("bufferView")){const e=rg(t.uri,n),r=await a(e);s=await r.arrayBuffer(),t.bufferView={data:s}}if(Number.isFinite(t.bufferView)){const r=ng(e.json,e.buffers,t.bufferView);s=Ya(r.buffer,r.byteOffset,r.byteLength)}tg(s,"glTF image has no data");let u=await o(s,[zu,Zl],{mimeType:t.mimeType,basis:n.basis||{format:Ql()}},i);u&&u[0]&&(u={compressed:!0,mipmaps:!1,width:u[0].width,height:u[0].height,data:u[0]}),e.images=e.images||[],e.images[r]=u}const Ly={name:"glTF",id:"gltf",module:"gltf",version:"3.3.0-alpha.5",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(e,t={},r){(t={...Ly.options,...t}).gltf={...Ly.options.gltf,...t.gltf};const{byteOffset:n=0}=t;return await My({},e,n,t,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const Ny=0,zy=1;function Uy(e,t,r,n){e.rotateYtoZ=!0;const i=e.byteOffset+e.byteLength-r;if(0===i)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Ya(t,r,i),e.gltfByteOffset=0,e.gltfByteLength=i,r%4==0||console.warn(e.type+": embedded glb is not aligned to a 4-byte boundary."),e.byteOffset+e.byteLength}async function qy(e,t,r,n){const i=r["3d-tiles"]||{};if(function(e,t,r){switch(t){case Ny:const t=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),r=(new TextDecoder).decode(t);e.gltfUrl=r.replace(/[\s\0]+$/,""),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case zy:break;default:throw new Error("b3dm: Illegal glTF format field")}}(e,t),i.loadGLTF){const{parse:t,fetch:i}=n;e.gltfUrl&&(e.gltfArrayBuffer=await i(e.gltfUrl,r),e.gltfByteOffset=0),e.gltfArrayBuffer&&(e.gltf=await t(e.gltfArrayBuffer,Ly,r,n),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength)}}async function Hy(e,t,r,n,i){var a;r=function(e,t,r,n,i){r=Nm(e,t,r),r=zm(e,t,r),r=Um(e,t,r),r=Uy(e,t,r,n);const a=new Sm(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=a.getGlobalProperty("RTC_CENTER",_m.FLOAT,3),r}(e,t,r,n),await qy(e,zy,n,i);const o=null==e||null===(a=e.gltf)||void 0===a?void 0:a.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}async function Gy(e,t,r,n,i){return r=function(e,t,r,n,i){if(r=Nm(e,t,r),1!==e.version)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=zm(e,t,r);const a=new DataView(t);if(e.gltfFormat=a.getUint32(r,!0),r=Um(e,t,r+=4),r=Uy(e,t,r,n),0===e.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new Sm(e.featureTableJson,e.featureTableBinary),s=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=s,!Number.isFinite(s))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",_m.FLOAT,3);new Lm(e.batchTableJson,e.batchTableBinary,s);return function(e,t,r,n){const i=[new Array(n),e._batchTable][0],a=new Ds,o=new Ds,s=new Ds,u=new Ds,c=new Dh,l=new np,h=new Ds,p={},f=new Js,d=[],m=[],g=new Ds,y=new Ds;for(let r=0;r<n;r++){let n;if(t.hasProperty("POSITION"))n=t.getProperty("POSITION",_m.FLOAT,3,r,a);else if(t.hasProperty("POSITION_QUANTIZED")){n=t.getProperty("POSITION_QUANTIZED",_m.UNSIGNED_SHORT,3,r,a);const e=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",_m.FLOAT,3,g);if(!e)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const i=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",_m.FLOAT,3,y);if(!i)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=65535;for(let t=0;t<3;t++)n[t]=n[t]/o*i[t]+e[t]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");a.copy(n),p.translation=a,e.normalUp=t.getProperty("NORMAL_UP",_m.FLOAT,3,r,d),e.normalRight=t.getProperty("NORMAL_RIGHT",_m.FLOAT,3,r,m);const b=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",_m.UNSIGNED_SHORT,2,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",_m.UNSIGNED_SHORT,2,m),e.octNormalUp){if(!e.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}e.eastNorthUp?(_u.WGS84.eastNorthUpToFixedFrame(a,f),f.getRotationMatrix3(c)):c.identity()}b&&(u.copy(o).cross(s).normalize(),c.setColumn(0,o),c.setColumn(1,s),c.setColumn(2,u)),l.fromMatrix3(c),p.rotation=l,h.set(1,1,1);const v=t.getProperty("SCALE",_m.FLOAT,1,r);Number.isFinite(v)&&h.multiplyByScalar(v);const w=t.getProperty("SCALE_NON_UNIFORM",_m.FLOAT,3,r,d);w&&h.scale(w),p.scale=h;let _=t.getProperty("BATCH_ID",_m.UNSIGNED_SHORT,1,r);void 0===_&&(_=r);const k=(new Js).fromQuaternion(p.rotation);f.identity(),f.translate(p.translation),f.multiplyRight(k),f.scale(p.scale);const x=f.clone();i[r]={modelMatrix:x,batchId:_}}e.instances=i}(e,o,0,s),r}(e,t,r,n),await qy(e,e.gltfFormat,n,i),r}async function Vy(e,t=0,r,n,i={}){switch(i.byteOffset=t,i.type=function(e,t=0){const r=new DataView(e);return`${String.fromCharCode(r.getUint8(t+0))}${String.fromCharCode(r.getUint8(t+1))}${String.fromCharCode(r.getUint8(t+2))}${String.fromCharCode(r.getUint8(t+3))}`}(e,t),i.type){case bm.COMPOSITE:return await async function(e,t,r,n,i,a){r=Nm(e,t,r);const o=new DataView(t);for(e.tilesLength=o.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&e.byteLength-r>12;){const o={};e.tiles.push(o),r=await a(t,r,n,i,o)}return r}(i,e,t,r,n,Vy);case bm.BATCHED_3D_MODEL:return await Hy(i,e,t,r,n);case bm.GLTF:return await async function(e,t,r,n){e.rotateYtoZ=!0,e.gltfUpAxis=r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y";const{parse:i}=n;e.gltf=await i(t,Ly,r,n)}(i,e,r,n);case bm.INSTANCED_3D_MODEL:return await Gy(i,e,t,r,n);case bm.POINT_CLOUD:return await Xm(i,e,t,r,n);default:throw new Error("3DTileLoader: unknown type "+i.type)}}async function Wy(e,t,r,n){const i=e[t].bufferView,a=e.bufferViews[i],o=e.buffers[a.buffer];if(null==n||!n.url||!n.fetch)throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(o.uri){const e=function(e,t){if(t.startsWith("http")){const r=new URL(e,t);return decodeURI(r.toString())}const r=new URL(e,"http://"+t);return`/${r.host}${r.pathname}`}(o.uri,null==n?void 0:n.url),t=await n.fetch(e),r=await t.arrayBuffer();return new Uint8Array(r,a.byteOffset,a.byteLength)}return new Uint8Array(r,a.byteOffset,a.byteLength)}function Ky(e){const t=new DataView(e);return t.getUint32(0,!0)+2**32*t.getUint32(4,!0)}const Jy={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.3.0-alpha.5",extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(e,t,r){if(1952609651!==new Uint32Array(e.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(e.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const n=Ky(e.slice(8,16)),i=new Uint8Array(e,24,n),a=new TextDecoder("utf8").decode(i),o=JSON.parse(a),s=Ky(e.slice(16,24));let u=new ArrayBuffer(0);return s&&(u=e.slice(24+n)),"bufferView"in o.tileAvailability&&(o.tileAvailability.explicitBitstream=await Wy(o,"tileAvailability",u,r)),"bufferView"in o.contentAvailability&&(o.contentAvailability.explicitBitstream=await Wy(o,"contentAvailability",u,r)),"bufferView"in o.childSubtreeAvailability&&(o.childSubtreeAvailability.explicitBitstream=await Wy(o,"childSubtreeAvailability",u,r)),o},options:{}},Qy={QUADTREE:4,OCTREE:8};function Yy(e,t){return"constant"in e?Boolean(e.constant):!!e.explicitBitstream&&function(e,t){const r=Math.floor(e/8),n=e%8;return 1==(t[r]>>n&1)}(t,e.explicitBitstream)}function $y(e,t,r,n){const{basePath:i,refine:a,getRefine:o,lodMetricType:s,getTileType:u,rootLodMetricValue:c,rootBoundingVolume:l}=n,h=e.contentUrl&&e.contentUrl.replace(i+"/",""),p=c/2**t,f=function(e,t,r){if(t.region){const{childTileX:n,childTileY:i,childTileZ:a}=r,[o,s,u,c,l,h]=t.region,p=2**e,f=(u-o)/p,d=(c-s)/p,m=(h-l)/p,[g,y]=[o+f*n,o+f*(n+1)],[b,v]=[s+d*i,s+d*(i+1)],[w,_]=[l+m*a,l+m*(a+1)];return{region:[g,b,y,v,w,_]}}return console.warn("Unsupported bounding volume type: ",t),null}(t,l,r);return{children:e.children,contentUrl:e.contentUrl,content:{uri:h},id:e.contentUrl,refine:o(a),type:u(e),lodMetricType:s,lodMetricValue:p,geometricError:p,transform:e.transform,boundingVolume:f}}function Xy(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function Zy(e,t,r,n,i){const a=function(e){const t={};for(const r in e)t[`{${r}}`]=e[r];return t}({level:t,x:r,y:n,z:i});return e.replace(/{level}|{x}|{y}|{z}/gi,e=>a[e])}function eb(e){if(!e.contentUrl)return hf;const t=e.contentUrl.split(".").pop();switch(t){case"pnts":return ff;case"i3dm":case"b3dm":case"glb":case"gltf":return pf;default:return t}}function tb(e){switch(e){case"REPLACE":case"replace":return lf;case"ADD":case"add":return cf;default:return e}}function rb(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){const r=new URL(e,t+"/");return decodeURI(r.toString())}return e.startsWith("/")?e:`${t}/${e}`}function nb(e,t){if(!e)return null;if(e.content){const r=e.content.uri||e.content.url;e.contentUrl=rb(r,t.basePath)}return e.id=e.contentUrl,e.lodMetricType=yf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=eb(e),e.refine=tb(e.refine),e}async function ib(e,t,r,n){var i;const a=t.basePath,{subdivisionScheme:o,maximumLevel:s,subtreeLevels:u,subtrees:{uri:c}}=r,l=rb(Zy(c,0,0,0,0),a),h=await Zo(l,Jy,n),p=rb(e.content.uri,a),f=null==t||null===(i=t.root)||void 0===i?void 0:i.refine,d=e.geometricError,m=e.boundingVolume,g={contentUrlTemplate:p,subtreesUriTemplate:c,subdivisionScheme:o,subtreeLevels:u,maximumLevel:s,refine:f,basePath:a,lodMetricType:yf,rootLodMetricValue:d,rootBoundingVolume:m,getTileType:eb,getRefine:tb};return await async function(e,t,r){if(!e)return null;e.lodMetricType=yf,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform;const{children:n,contentUrl:i}=await async function e(t){const{options:r,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:i=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=t;let{subtree:o,level:s=0}=t;const{subdivisionScheme:u,subtreeLevels:c,maximumLevel:l,contentUrlTemplate:h,subtreesUriTemplate:p,basePath:f}=r,d={children:[],lodMetricValue:0,contentUrl:""},m=Qy[u],g=1&i,y=i>>1&1,b=i>>2&1,v=(m**s-1)/(m-1);let w=Xy(n.mortonIndex,i),_=v+w,k=Xy(n.x,g),x=Xy(n.y,y),E=Xy(n.z,b),A=!1;s+1>c&&(A=Yy(o.childSubtreeAvailability,w));const S=Xy(a.x,k),j=Xy(a.y,x),T=Xy(a.z,E),C=s+a.level;if(A){const e=Zy(`${f}/${p}`,C,S,j,T);o=await Zo(e,Jy),a.mortonIndex=w,a.x=k,a.y=x,a.z=E,a.level=s,w=0,_=0,k=0,x=0,E=0,s=0}if(!Yy(o.tileAvailability,_)||s>l)return d;Yy(o.contentAvailability,_)&&(d.contentUrl=Zy(h,C,S,j,T));const B=s+1,R={mortonIndex:w,x:k,y:x,z:E};for(let t=0;t<m;t++){const n=await e({subtree:o,options:r,parentData:R,childIndex:t,level:B,globalData:a});if(n.contentUrl||n.children.length){const e=$y(n,C+1,{childTileX:k,childTileY:x,childTileZ:E},r);d.children.push(e)}}return d}({subtree:t,options:r});i&&(e.contentUrl=i,e.content={uri:i.replace(r.basePath+"/","")});return e.refine=tb(e.refine),e.type=eb(e),e.children=n,e.id=e.contentUrl,e}(e,h,g)}function ab(e){var t;return(null==e||null===(t=e.extensions)||void 0===t?void 0:t["3DTILES_implicit_tiling"])||(null==e?void 0:e.implicitTiling)}const ob={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.3.0-alpha.5",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(e,t,r){const i=t["3d-tiles"]||{};let a;a="auto"===i.isTileset?r.url&&-1!==r.url.indexOf(".json"):i.isTileset;e=a?await async function(e,t,r){var i;const a=JSON.parse((new TextDecoder).decode(e));return a.loader=t.loader||ob,a.url=r.url,a.basePath=function(e){return n.dirname(e.url)}(a),a.root=await async function(e,t){const r=e.basePath;let n;const i=ab(null==e?void 0:e.root);n=i&&e.root?await ib(e.root,e,i,t):nb(e.root,e);const a=[];for(a.push(n);a.length>0;){const n=(a.pop()||{}).children||[];for(let i of n){const n=ab(i);n?i=await ib(i,e,n,t):nb(i,{basePath:r}),a.push(i)}}return n}(a,t),a.type=gf,a.lodMetricType=yf,a.lodMetricValue=(null===(i=a.root)||void 0===i?void 0:i.lodMetricValue)||0,a}(e,t,r):await async function(e,t,r){const n={content:{featureIds:null}};return await Vy(e,0,t,r,n.content),n.content}(e,t,r);return e},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function sb(e,t){if(!t){const r=await async function(e){Vi(e);const t={Authorization:"Bearer "+e},r=await oa("https://api.cesium.com/v1/assets",{fetch:{headers:t}});if(!r.ok)throw new Error(r.statusText);return await r.json()}(e);for(const e of r.items)"3DTILES"===e.type&&(t=e.id)}const r=await async function(e,t){Vi(e,t);const r={Authorization:"Bearer "+e},n="https://api.cesium.com/v1/assets/"+t;let i=await oa(""+n,{fetch:{headers:r}});if(!i.ok)throw new Error(i.statusText);let a=await i.json();if(i=await oa(n+"/endpoint",{fetch:{headers:r}}),!i.ok)throw new Error(i.statusText);const o=await i.json();return a={...a,...o},a}(e,t),{type:n,url:i}=r;return Vi("3DTILES"===n&&i),r.headers={Authorization:"Bearer "+r.accessToken},r}const ub={...ob,id:"cesium-ion",name:"Cesium Ion",preload:async function(e,t={}){t=t["cesium-ion"]||{};const{accessToken:r}=t;let n=t.assetId;if(!Number.isFinite(n)){const t=e.match(/\/([0-9]+)\/tileset.json/);n=t&&t[1]}return sb(r,n)},parse:async(e,t,r)=>((t={...t})["3d-tiles"]=t["cesium-ion"],t.loader=ub,ob.parse(e,t,r)),options:{"cesium-ion":{...ob.options["3d-tiles"],accessToken:null}}};var cb=r(10),lb=r.n(cb);const hb=new Uint8Array(256);let pb=hb.length;function fb(){return pb>hb.length-16&&(lb.a.randomFillSync(hb),pb=0),hb.slice(pb,pb+=16)}var db=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;var mb=function(e){return"string"==typeof e&&db.test(e)};const gb=[];for(let e=0;e<256;++e)gb.push((e+256).toString(16).substr(1));var yb=function(e,t=0){const r=(gb[e[t+0]]+gb[e[t+1]]+gb[e[t+2]]+gb[e[t+3]]+"-"+gb[e[t+4]]+gb[e[t+5]]+"-"+gb[e[t+6]]+gb[e[t+7]]+"-"+gb[e[t+8]]+gb[e[t+9]]+"-"+gb[e[t+10]]+gb[e[t+11]]+gb[e[t+12]]+gb[e[t+13]]+gb[e[t+14]]+gb[e[t+15]]).toLowerCase();if(!mb(r))throw TypeError("Stringified UUID is invalid");return r};var bb=function(e,t,r){const n=(e=e||{}).random||(e.rng||fb)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return yb(n)},vb=r(81),wb=r.n(vb);function _b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class kb{constructor(e,t){_b(this,"nodesPerPage",void 0),_b(this,"nodesCounter",void 0),_b(this,"writeFile",void 0),_b(this,"nodePages",void 0),this.nodesPerPage=t,this.nodesCounter=0,this.nodePages=[{}],this.nodePages[0].nodes=[],this.writeFile=e}useWriteFunction(e){this.writeFile=e}getNodeById(e){const t=Math.floor(e/this.nodesPerPage),r=e%this.nodesPerPage;return this.nodePages[t].nodes[r]}updateAll(e,t){const r=this.getNodeById(e);Object.assign(r,t,{index:r.index})}updateMaterialByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.material={definition:t,resource:r.index})}updateVertexCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.vertexCount=t)}updateNodeAttributeByNodeId(e){const t=this.getNodeById(e);t.mesh&&t.index&&(t.mesh.attribute.resource=t.index)}updateFeatureCountByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&(r.mesh.geometry.featureCount=t)}updateTexelCountHintByNodeId(e,t){const r=this.getNodeById(e);r.mesh&&r.mesh.material&&(r.mesh.material.texelCountHint=t)}addChildRelation(e,t){var r;if(null==e)return;null===(r=this.getNodeById(e).children)||void 0===r||r.push(t)}updateResourceInMesh(e){e.mesh&&isFinite(e.index)&&(e.mesh.geometry.resource=e.index)}push(e,t){let r=this.nodePages[this.nodePages.length-1];return r.nodes.length===this.nodesPerPage&&(r={nodes:[]},this.nodePages.push(r)),e.index=this.nodesCounter++,r.nodes.push(e),this.addChildRelation(t,e.index),this.updateResourceInMesh(e),e.index}async save(e,t,r=!1){if(r){for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(Ci.join)(e,"nodepages");await t.enqueue({archiveKey:`nodePages/${r.toString()}.json.gz`,writePromise:this.writeFile(a,i,r.toString()+".json")})}const r=Ii()({nodeCount:this.nodesCounter},{folderPattern:{path:"folderPattern",default:"BASIC"},archiveCompressionType:{path:"archiveCompressionType",default:"STORE"},resourceCompressionType:{path:"resourceCompressionType",default:"GZIP"},I3SVersion:{path:"I3SVersion",default:"1.8"},nodeCount:{path:"nodeCount"}}),n=!1;await t.enqueue({archiveKey:"metadata.json",writePromise:this.writeFile(e,JSON.stringify(r),"metadata.json",n)})}else for(const[r,n]of this.nodePages.entries()){const i=JSON.stringify(n),a=Object(Ci.join)(e,"nodepages",r.toString());await t.enqueue({writePromise:this.writeFile(a,i)})}}}const xb={};class Eb extends ys{static get ZERO(){return xb.ZERO=xb.ZERO||Object.freeze(new Eb(0,0,0,0))}constructor(e=0,t=0,r=0,n=0){super(-0,-0,-0,-0),as(e)&&1===arguments.length?this.copy(e):(ns.debug&&(fs(e),fs(t),fs(r),fs(n)),this[0]=e,this[1]=t,this[2]=r,this[3]=n)}set(e,t,r,n){return this[0]=e,this[1]=t,this[2]=r,this[3]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return ns.debug&&(fs(e.x),fs(e.y),fs(e.z),fs(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=fs(e)}get w(){return this[3]}set w(e){this[3]=fs(e)}transform(e){return As(this,this,e),this.check()}transformByMatrix3(e){return Os(this,this,e),this.check()}transformByMatrix2(e){return function(e,t,r){const n=t[0],i=t[1];e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e[3]=t[3]}(this,this,e),this.check()}transformByQuaternion(e){return js(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}}function Ab(e){const{positions:t,normals:r,texCoords:n,colors:i,featureIndices:a}=e,o=t.length/9;if(!a.length)return{faceRange:new Uint32Array([0,o-1]),featureIds:[0],featureCount:1,positions:t,normals:r,texCoords:n,colors:i};const s=function(e){let t=1,r=1,n=Sb(e.slice(0,3));const i=[],a=[],o=[n];i[0]=0,a[0]=n;for(let s=3;s<e.length;s+=3){const u=Sb(e.slice(s,s+3));n!==u&&(i[t]=s/3-1,i[t+1]=s/3,a[r]=u,o.includes(u)||o.push(u),t+=2,r+=1),n=u}i[t]=e.length/3-1;const s=new Uint32Array(i),u=o.length;return{faceRange:s,featureCount:u,featureIds:a}}(a);return function(e,t){const r=e[0],n=[r.featureId||0];let i=new Float32Array(r.positions),a=new Float32Array(r.normals),o=new Uint8Array(r.colors),s=new Float32Array(r.texCoords);const u=[0];let c=0,l=0;for(let t=1;t<e.length;t++){const r=e[t];n.push(r.featureId||0),i=Qa(i,r.positions),a=Qa(a,r.normals),o=Qa(o,r.colors),s=Qa(s,r.texCoords);const h=e[c];u.push(h.positions.length/9-1+l),u.push(h.positions.length/9+l),l+=h.positions.length/9,c+=1}u.push(i.length/9-1);return{faceRange:new Uint32Array(u),featureIds:n,positions:i,normals:a,colors:o,texCoords:s,featureCount:t}}(function(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r],i=t.find(e=>e.featureId===n.featureId);i?(i.positions=Qa(i.positions,n.positions),i.normals=Qa(i.normals,n.normals),i.colors=Qa(i.colors,n.colors),i.texCoords=Qa(i.texCoords,n.texCoords)):t.push(n)}return t}(function(e){const{featureIds:t,positions:r,normals:n,colors:i,texCoords:a,faceRange:o=new Uint32Array(0)}=e,s=[];let u=new Float32Array(r),c=new Float32Array(n),l=new Uint8Array(i),h=new Float32Array(a),p=0;for(let e=0;e<t.length;e++){const r=o[e+p],n=o[e+p+1],i=jb("positions",r,n),a=jb("normals",r,n),f=jb("colors",r,n),d=jb("texCoords",r,n);s.push({featureId:t[e],positions:u.slice(0,i),normals:c.slice(0,a),colors:l.slice(0,f),texCoords:h.slice(0,d)}),u=u.slice(i),c=c.slice(a),l=l.slice(f),h=h.slice(d),p+=1}return s.sort((e,t)=>e.featureId-t.featureId)}({...s,...e})),s.featureCount)}function Sb(e){const t={};let r=e[0],n=1;for(const i of e)t[i]=(t[i]||0)+1,n=n>t[i]?n:t[i],r=n>t[i]?r:i;return r}function jb(e,t,r){const n=r-t+1,i=3*n;switch(e){case"positions":case"normals":return 9*n;case"colors":return 4*i;case"texCoords":return 2*i;default:return 0}}function Tb(e){const t={};for(const r in e)t[r]={value:e[r].value};return t}function Cb(e){var t,r,n,i,a,o,s,u,c,l;const h=null===(t=e.gltf)||void 0===t||null===(r=t.materials)||void 0===r?void 0:r.map(e=>({id:e.id}));let p=(null===(n=e.gltf)||void 0===n||null===(i=n.scene)||void 0===i?void 0:i.nodes)||(null===(a=e.gltf)||void 0===a||null===(o=a.scenes)||void 0===o||null===(s=o[0])||void 0===s?void 0:s.nodes)||(null===(u=e.gltf)||void 0===u?void 0:u.nodes)||[];const f=(null===(c=e.gltf)||void 0===c||null===(l=c.images)||void 0===l?void 0:l.map(e=>{var t;if(null!=e&&null!==(t=e.image)&&void 0!==t&&t.compressed)return{data:null,compressed:!0};{var r;const t=null==e||null===(r=e.image)||void 0===r?void 0:r.data,n=new Uint8Array(t.length);return n.set(t),{data:n,compressed:!1,height:e.image.height,width:e.image.width,components:e.image.components,mimeType:e.mimeType}}}))||[];!function e(t){for(let n=0;n<t.length;n++){const i=t[n];var r;if(i.mesh)t[n]={...i,mesh:{...i.mesh,primitives:null===(r=i.mesh)||void 0===r?void 0:r.primitives.map(e=>{var t,r;return{...e,indices:{value:null==e||null===(t=e.indices)||void 0===t?void 0:t.value},attributes:Tb(e.attributes),material:{id:null==e||null===(r=e.material)||void 0===r?void 0:r.id}}})}};i.children&&e(i.children)}}(p);return{gltfMaterials:h,nodes:p,images:f,cartographicOrigin:e.cartographicOrigin,cartesianModelMatrix:e.cartesianModelMatrix}}function Bb(e,t,r){var n,i,a,o;const s=null==t||null===(n=t.featureIdAttributes)||void 0===n?void 0:n[0];if(null!=s&&null!==(i=s.featureIds)&&void 0!==i&&i.attribute){return e[s.featureIds.attribute].value}if(null!=s&&null!==(a=s.featureIds)&&void 0!==a&&a.hasOwnProperty("constant")&&null!=s&&null!==(o=s.featureIds)&&void 0!==o&&o.hasOwnProperty("divisor")){var u;return function(e,t=0,r=0){let n=[];if(r>0){let i=t,a=r;for(let t=0;t<e;t++)n.push(i),a-=1,0===a&&(i++,a=r)}else n=Array(e).fill(t,0,e);return n}((null==e||null===(u=e.POSITIONS)||void 0===u?void 0:u.value.length)/3||0,s.featureIds.constant,s.featureIds.divisor)}const c=(null==t?void 0:t.featureIdTextures)&&(null==t?void 0:t.featureIdTextures[0]);if(c){var l,h;return function(e,t,r){var n,i,a;if(null==r||!r.length)return[];const o=null==e||null===(n=e.featureIds)||void 0===n||null===(i=n.texture)||void 0===i?void 0:i.index,s=null==e||null===(a=e.featureIds)||void 0===a?void 0:a.channels;if(!s||void 0===o)return[];const u=r[o],c=[],l={r:0,g:1,b:2,a:3}[s];if(u.compressed)console.warn(`Can't get batch Ids from ${u.mimeType} compressed texture`);else for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1],i=Math.min(Rb(r)*u.width|0,u.width-1),a=(Math.min(Rb(n)*u.height|0,u.height-1)*u.width+i)*u.components+l,o=new Uint8Array(u.data)[a];c.push(o)}return c}(c,e["TEXCOORD_"+((null==c||null===(l=c.featureIds)||void 0===l||null===(h=l.texture)||void 0===h?void 0:h.texCoord)||0)].value,r)}return(null==t?void 0:t.featureTextures)&&(null==t?void 0:t.featureTextures[0])?(console.warn("EXT_feature_metadata doesn't yet support featureTextures in primitive"),[]):[]}function Rb(e){return(e%1+1)%1}function Ob(e,t){const r=[];for(const n of t){const t=e[n]||null;r.push(t)}return r}function Ib(e,t){return"OBJECTID"===e?"OBJECTID":"string"==typeof t?"string":"number"==typeof t?Number.isInteger(t)?"Int32":"double":"string"}function Pb(e,t,r){const n={key:"f_"+e,name:t,ordering:["attributeValues"],header:[{property:"count",valueType:"UInt32"}],attributeValues:{valueType:"Int32",valuesPerElement:1}};switch(r){case"OBJECTID":!function(e){e.attributeValues={valueType:"Oid32",valuesPerElement:1}}(n);break;case"string":Lb(n);break;case"double":!function(e){e.attributeValues={valueType:"Float64",valuesPerElement:1}}(n);break;case"Int32":break;default:Lb(n)}return n}function Db(e){switch(e){case"OBJECTID":return"esriFieldTypeOID";case"string":return"esriFieldTypeString";case"Int32":return"esriFieldTypeInteger";case"double":return"esriFieldTypeDouble";default:return"esriFieldTypeString"}}function Mb(e,t){return{name:e,type:t,alias:e}}function Fb(e){const t=[],r=[];for(const r in e)t.push({fieldName:r,visible:!0,isEditable:!1,label:r});return r.push({fieldInfos:t,type:"fields"}),{title:"{OBJECTID}",mediaInfos:[],popupElements:r,fieldInfos:t,expressionInfos:[]}}function Lb(e){e.ordering.unshift("attributeByteCounts"),e.header.push({property:"attributeValuesByteCount",valueType:"UInt32"}),e.attributeValues={valueType:"String",encoding:"UTF-8",valuesPerElement:1},e.attributeByteCounts={valueType:"UInt32",valuesPerElement:1}}const Nb=["CUSTOM_ATTRIBUTE_2","_BATCHID","BATCHID"];let zb=new Ds;async function Ub(e,t,r,n,i,a,o,s,u){var c;const l=o,h=function(e=[]){const t=[];for(const r of e)t.push(Xb(r));return t}(null===(c=e.gltf)||void 0===c?void 0:c.materials),p=Cb(e),f=await async function(e,t){const{gltfMaterials:r,nodes:n,images:i,cartographicOrigin:a,cartesianModelMatrix:o}=e,s=new Map;for(const e of r||[{id:"default"}])s.set(e.id,{positions:new Float32Array(0),normals:new Float32Array(0),texCoords:new Float32Array(0),colors:new Uint8Array(0),featureIndicesGroups:[],featureIndices:[],boundingVolumes:null});Hb(n,i,a,o,s,t);for(const e of s.keys()){const t=s.get(e);t&&(0!==t.positions.length?t.featureIndicesGroups&&(t.featureIndices=t.featureIndicesGroups.reduce((e,t)=>e.concat(t)),delete t.featureIndicesGroups):s.delete(e))}return s}(p,l);o&&function(e,t){for(const r of e.values()){const e=um(r.positions,t);r.boundingVolumes=e;const n=e.obb.center;for(let e=0;e<r.positions.length;e+=3){const i=r.positions.subarray(e,e+3);_u.WGS84.cartesianToCartographic(Array.from(i),zb),zb[2]=zb[2]-t.getHeight(zb[1],zb[0]),zb=zb.subtract(n),r.positions.set(zb,e)}}}(f,s),f.has("default")&&h.push({material:{alphaMode:"opaque",pbrMetallicRoughness:{metallicFactor:1,roughnessFactor:1}}});const d=[];let{materials:m=[]}=e.gltf||{materials:[]};null!=m&&m.length||m.push({id:"default"});for(let o=0;o<m.length;o++){const s=m[o];if(!f.has(s.id))continue;const c=f.get(s.id);if(!c)continue;const{material:l,texture:p}=h[o],g=t();d.push(await qb({convertedAttributes:c,material:l,texture:p,tileContent:e,nodeId:g,featuresHashArray:n,propertyTable:r,attributeStorageInfo:i,draco:a,workerSource:u}))}return d.length?d:null}async function qb({convertedAttributes:e,material:t,texture:r,tileContent:n,nodeId:i,featuresHashArray:a,propertyTable:o,attributeStorageInfo:s,draco:u,workerSource:c}){var l;const h=e.boundingVolumes,p=e.positions.length/3,{faceRange:f,featureIds:d,positions:m,normals:g,colors:y,texCoords:b,featureCount:v}=Ab(e);n.batchTableJson&&function(e,t,r,n){const i=function(e,t,r){const n={};for(let i=0;i<e.length;i++){const a=e[i],o=iv(i,t,r);n[a.toString()]=o}return n}(e,n,r);av(t,i),av(e,i)}(d,e.featureIndices,a,n.batchTableJson);const w=new Uint32Array(2),_=function(e){const t=new BigUint64Array(e.length);for(let r=0;r<e.length;r++)t[r]=BigInt(e[r]);return t}(d);w.set([p,v],0);const k=new Uint8Array(Ja(w.buffer,m.buffer,g.buffer,r?b.buffer:new ArrayBuffer(0),y.buffer,_.buffer,f.buffer)),x=u?async function(e,t,r,n){const{positions:i,normals:a,texCoords:o,colors:s,featureIds:u,faceRange:c}=r,l=new Uint32Array(e);for(let e=0;e<l.length;e++)l.set([e],e);const h=function(e,t){const r=new Uint32Array(e.length);let n=0,i=0;for(let e=1;e<t.length;e+=2){const a=3*(t[e]+1);r.fill(n,i,a),n++,i=a+1}return r}(new Uint32Array(t.featureIndices.length?t.featureIndices:e),c),p={positions:i,normals:a,colors:s,"feature-index":h};o.length&&(p.texCoords=o);const f={"feature-index":{"i3s-attribute-type":"feature-index","i3s-feature-ids":new Int32Array(u)}};return gm({attributes:p,indices:l},Bc,{...Bc.options,source:n,reuseWorkers:!0,_nodeWorkers:!0,draco:{method:"MESH_SEQUENTIAL_ENCODING",attributesMetadata:f}})}(p,e,{positions:m,normals:g,texCoords:r?b:new Float32Array(0),colors:y,featureIds:d,faceRange:f},c.draco):null;let E=[];return s&&o&&(E=function(e,t,r){const n=[],i=function(e,t){let r=!1;for(const n of Object.values(t))e.length!==n.length&&(r=!0);return r}(e,t)?function(e,t){const r={};for(const n in t){const i=t[n];r[n]=Ob(i,e)}return r}(e,t):t,a={OBJECTID:e,...i};for(const e in a){const t=sv(e,r),i=a[e],o=ov(t,i);n.push(o)}return n}(d,o,s)),{nodeId:i,geometry:k,compressedGeometry:x,texture:r,sharedResources:ev((null===(l=n.gltf)||void 0===l?void 0:l.materials)||[],i),meshMaterial:t,vertexCount:p,attributes:E,featureCount:v,boundingVolumes:h}}function Hb(e,t,r,n,i,a,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){if(e)for(const s of e)Gb(s,t,r,n,i,a,o)}function Gb(e,t,r,n,i,a,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){const s=function(e,t){let r=t;const{matrix:n,rotation:i,scale:a,translation:o}=e;return n&&(r=t.multiplyRight(n)),o&&(r=r.translate(o)),i&&(r=r.rotateXYZ(i)),a&&(r=r.scale(a)),r}(e,o),u=e.mesh;u&&function(e,t,r,n,i,a=!1,o=new Js([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])){for(const p of e.primitives){var s,u,c,l,h;let e=null;p.material?e=i.get(p.material.id):i.has("default")&&(e=i.get("default")),Vi(null!==e,"Primitive - material mapping failed");const f=p.attributes;e&&(e.positions=Qa(e.positions,Vb({vertices:f.POSITION.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:null===(s=p.indices)||void 0===s?void 0:s.value,attributeSpecificTransformation:Wb,useCartesianPositions:a})),e.normals=Qa(e.normals,Vb({vertices:f.NORMAL&&f.NORMAL.value,cartographicOrigin:r,cartesianModelMatrix:n,nodeMatrix:o,indices:null===(u=p.indices)||void 0===u?void 0:u.value,attributeSpecificTransformation:Kb,useCartesianPositions:!1})),e.texCoords=Qa(e.texCoords,Jb(f.TEXCOORD_0&&f.TEXCOORD_0.value,null===(c=p.indices)||void 0===c?void 0:c.value)),e.colors=Qa(e.colors,Qb(f.COLOR_0,null===(l=p.indices)||void 0===l?void 0:l.value)),e.featureIndicesGroups=e.featureIndicesGroups||[],e.featureIndicesGroups.push(Yb($b(f,p,t),null===(h=p.indices)||void 0===h?void 0:h.value)))}}(u,t,r,n,i,a,s),Hb(e.children||[],t,r,n,i,a,s)}function Vb(e){const{vertices:t,indices:r,attributeSpecificTransformation:n}=e,i=new Float32Array(3*r.length);if(!t)return i;for(let a=0;a<r.length;a++){const o=3*r[a],s=t.subarray(o,o+3);let u=new Ds(Array.from(s));u=n(u,e),i[3*a]=u.x,i[3*a+1]=u.y,i[3*a+2]=u.z}return i}function Wb(e,t){const{cartesianModelMatrix:r,cartographicOrigin:n,nodeMatrix:i,useCartesianPositions:a}=t;return i&&(e=e.transform(i)),e=e.transform(r),a?e:(_u.WGS84.cartesianToCartographic([e[0],e[1],e[2]],e),e=e.subtract(n))}function Kb(e,t){const{cartesianModelMatrix:r,nodeMatrix:n}=t;return n&&(e=e.transformAsVector(n)),e=e.transformAsVector(r)}function Jb(e,t){const r=new Float32Array(2*t.length);if(!e)return r.fill(1),r;for(let n=0;n<t.length;n++){const i=2*t[n],a=e.subarray(i,i+2);r[2*n]=a[0],r[2*n+1]=a[1]}return r}function Qb(e,t){const r=(null==e?void 0:e.components)||4,n=new Uint8Array(t.length*r);if(!e)return n.fill(255),n;const i=e.value;for(let e=0;e<t.length;e++){const a=t[e]*r,o=i.subarray(a,a+r),s=new Uint8Array(r);for(let e=0;e<o.length;e++)s[e]=255*o[e];n.set(s,e*r)}return n}function Yb(e,t){if(!e.length||!t.length)return[];const r=[];for(let n=0;n<t.length;n++){const i=t[n];r.push(e[i])}return r}function $b(e,t,r){const n=function(e,t,r){const n=null==t?void 0:t.extensions;if(!n)return[];for(const[t,i]of Object.entries(n||{}))switch(t){case"EXT_feature_metadata":return Bb(e,i,r);case"EXT_mesh_features":return console.warn("EXT_mesh_features extension is not supported yet"),[];default:return[]}return[]}(e,t,r);if(n.length)return n;for(let t=0;t<Nb.length;t++){const r=Nb[t];if(e[r]&&e[r].value)return e[r].value}return[]}function Xb(e){var t,r,n,i;const a={doubleSided:e.doubleSided,emissiveFactor:null===(t=e.emissiveFactor)||void 0===t?void 0:t.map(e=>Math.round(255*e)),alphaMode:Zb(e.alphaMode),pbrMetallicRoughness:{roughnessFactor:(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.roughnessFactor)||1,metallicFactor:(null==e||null===(n=e.pbrMetallicRoughness)||void 0===n?void 0:n.metallicFactor)||1}};let o;if(null!=e&&null!==(i=e.pbrMetallicRoughness)&&void 0!==i&&i.baseColorTexture?(o=e.pbrMetallicRoughness.baseColorTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}):e.emissiveTexture&&(o=e.emissiveTexture.texture.source,a.pbrMetallicRoughness.baseColorTexture={textureSetDefinitionId:0}),!o){var s;const t=null==e||null===(s=e.pbrMetallicRoughness)||void 0===s?void 0:s.baseColorFactor;a.pbrMetallicRoughness.baseColorFactor=t&&t.map(e=>Math.round(255*e))||void 0}return{material:a,texture:o}}function Zb(e){switch(e){case"OPAQUE":return"opaque";case"MASK":return"mask";case"BLEND":return"blend";default:return"opaque"}}function ev(e,t){const r={};if(!e||!e.length)return r;r.materialDefinitionInfos=[];for(const n of e){const{materialDefinitionInfo:e,textureDefinitionInfo:i}=tv(n,t);r.materialDefinitionInfos.push(e),i&&(r.textureDefinitionInfos=r.textureDefinitionInfos||[],r.textureDefinitionInfos.push(i))}return r}function tv(e,t){var r;const n=(null==e||null===(r=e.pbrMetallicRoughness)||void 0===r?void 0:r.baseColorTexture)||e.emissiveTexture;let i=null;n&&(i=function(e,t){var r,n,i;return{encoding:null!=e&&null!==(r=e.source)&&void 0!==r&&r.mimeType?[e.source.mimeType]:void 0,images:[{id:nv(e,t),size:null===(n=e.source)||void 0===n?void 0:n.image.width,length:[null===(i=e.source)||void 0===i?void 0:i.image.data.length]}]}}(n.texture,t));const{baseColorFactor:a,metallicFactor:o}=(null==e?void 0:e.pbrMetallicRoughness)||{};let s=a;return a&&0!==a[3]||!e.emissiveFactor||(s=e.emissiveFactor,s[3]=s[3]||1),{materialDefinitionInfo:rv(s||[1,1,1,1],o),textureDefinitionInfo:i}}function rv(e,t=1){const r=new Eb(0,0,0,1),n=new Eb(1,1,1,1),i=new Eb(.04/255,.04/255,.04/255,0),a=new Eb(e),o=n.subtract(i).multiply(a),s=o.lerp(o,r,t);i[3]=1;const u=i.lerp(i,a,t);return{params:{diffuse:s.toArray(),specular:u.toArray(),renderMode:"solid"}}}function nv(e,t){var r;const{width:n,height:i}=null===(r=e.source)||void 0===r?void 0:r.image,a=t+1,o=32-a.toString(2).length,s="0".repeat(o).concat(a.toString(2));return BigInt(`0b${(268435456+(n-1<<12)+(i-1<<0)).toString(2)}${s}`).toString()}function iv(e,t,r){const n=function(e,t){let r="";for(const n in e)r+=e[n][t];return r}(t,e),i=wb()(n);return r.includes(i)?r.indexOf(i):r.push(i)-1}function av(e,t){for(let r=0;r<e.length;r++)e[r]=t[e[r]]}function ov(e,t){let r;switch(e){case"Oid32":case"Int32":r=function(e){const t=new Uint32Array([e.length]),r=new Uint32Array(e);return Ja(t.buffer,r.buffer)}(t);break;case"Float64":r=function(e){const t=new Uint32Array([e.length]),r=new Uint8Array(4),n=new Float64Array(e);return Ja(t.buffer,r.buffer,n.buffer)}(t);break;case"string":r=uv(t);break;default:r=uv(t)}return r}function sv(e,t){return t.find(t=>t.name===e).attributeValues.valueType}function uv(e){const t=new Uint32Array([e.length]);let r=0;const n=new Uint32Array(e.length),i=[];for(let t=0;t<e.length;t++){const a=String(e[t])+"\0",o=Buffer.from(a),s=o.length;r+=s,n[t]=s,i.push(o)}const a=new Uint32Array([r]);return Ja(t.buffer,a.buffer,n.buffer,...i)}function cv(e){const t=null==e?void 0:e.batchTableJson;if(t)return t;const{extensionName:r,extension:n}=function(e){var t,r,n;const i=["EXT_feature_metadata","EXT_mesh_features"];if(!(null==e||null===(t=e.gltf)||void 0===t?void 0:t.extensionsUsed))return{extensionName:null,extension:null};let a="";for(const t of(null==e||null===(o=e.gltf)||void 0===o?void 0:o.extensionsUsed)||[]){var o;if(i.includes(t)){a=t;break}}const s=null==e||null===(r=e.gltf)||void 0===r||null===(n=r.extensions)||void 0===n?void 0:n[a];return{extensionName:a,extension:s}}(e);switch(r){case"EXT_mesh_features":return console.warn("The I3S converter does not yet support the EXT_mesh_features extension"),null;case"EXT_feature_metadata":return function(e){if(null!=e&&e.featureTextures)return console.warn("The I3S converter does not yet support the EXT_feature_metadata feature textures"),null;if(null!=e&&e.featureTables){var t;const r=null===(t=Object.keys(e.featureTables))||void 0===t?void 0:t[0];if(r){const t=null==e?void 0:e.featureTables[r],n={};for(const e in t.properties)n[e]=t.properties[e].data;return n}}return console.warn("The I3S converter couldn't handle EXT_feature_metadata extension"),null}(n);default:return null}}const lv={id:{path:"id",transform:e=>e.toUpperCase()},profile:{path:"profile",default:"meshpyramids"},version:{path:"version",default:"1.8"},resourcePattern:{path:"resourcePattern",default:["3dNodeIndexDocument","Attributes","SharedResource","Geometry"]},rootNode:{path:"rootNode",default:"./nodes/root"},extent:{path:"extent"},indexCRS:{path:"indexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},vertexCRS:{path:"vertexCRS",default:"http://www.opengis.net/def/crs/EPSG/0/4326"},normalReferenceFrame:{path:"normalReferenceFrame",default:"east-north-up"},attributeEncoding:{path:"attributeEncoding",default:"application/octet-stream; version=1.6"},textureEncoding:{path:"textureEncoding",default:["image/jpeg","image/ktx2"]},lodType:{path:"lodType",default:"MeshPyramid"},lodModel:{path:"lodModel",default:"node-switching"},defaultGeometrySchema:{path:"defaultGeometrySchema",default:{geometryType:"triangles",header:[{property:"vertexCount",type:"UInt32"},{property:"featureCount",type:"UInt32"}],topology:"PerAttributeArray",ordering:["position","normal","uv0","color"],vertexAttributes:{position:{valueType:"Float32",valuesPerElement:3},normal:{valueType:"Float32",valuesPerElement:3},uv0:{valueType:"Float32",valuesPerElement:2},color:{valueType:"UInt8",valuesPerElement:4}},featureAttributeOrder:["id","faceRange"],featureAttributes:{id:{valueType:"UInt64",valuesPerElement:1},faceRange:{valueType:"UInt32",valuesPerElement:2}}}}},hv=()=>({version:{path:"version"},id:{path:"id"},path:{path:"path"},level:{path:"level"},mbs:{path:"mbs"},obb:{path:"obb"},lodSelection:{path:"lodSelection",default:[{metricType:"maxScreenThresholdSQ",maxError:196349.54374999998},{metricType:"maxScreenThreshold",maxError:999.9999999999999}]},children:{path:"children",default:null},neighbors:{path:"neighbors",default:null},parentNode:{path:"parentNode",transform:e=>Ii()(e,{id:{path:"id"},href:{path:"href"},mbs:{path:"mbs"},obb:{path:"obb"}}),default:null},sharedResource:{path:"sharedResource",default:null},featureData:{path:"featureData",default:null},geometryData:{path:"geometryData",default:null},textureData:{path:"textureData",default:null},attributeData:{path:"attributeData",default:null}});function pv(e,t,r){const n={};for(const[t,i]of e.entries())n[`Mat${r.nodePath}${t}`]=Ii()(i,{name:{path:"name",default:"standard"},type:{path:"type",default:"standard"},params:{path:"params",transform:(e,t,r)=>Ii()(r,{renderMode:{path:"renderMode",default:"solid"},shininess:{path:"shininess",default:1},reflectivity:{path:"reflectivity",default:0},ambient:{path:"ambient",default:[1,1,1,1]},diffuse:{path:"diffuse",default:[1,1,1,1]},specular:{path:"specular",default:[0,0,0,0]},useVertexColorAlpha:{path:"useVertexColorAlpha",default:!1},vertexRegions:{path:"vertexRegions",default:!1},vertexColors:{path:"vertexColors",default:!0}})}});return n}function fv(e,t,r){if(!e)return null;const n={};for(const[t,i]of e.entries()){const e=`${r.nodePath}${t}`;i.imageIndex=e,n[e]=Ii()(i,{encoding:{path:"encoding"},wrap:{path:"wrap",default:["none"]},atlas:{path:"atlas",default:!1},uvSet:{path:"uvSet",default:"uv0"},channels:{path:"channels",default:"rgb"},images:{path:"images",transform:(e,t,r)=>e.map(e=>Ii()(e,{id:{path:"id"},size:{path:"size"},href:{path:"href",default:["../textures/0"]},length:{path:"length"}}))}})}return n}function dv(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}const mv={};function gv(e="id"){mv[e]=mv[e]||1;const t=mv[e]++;return"".concat(e,"-").concat(t)}const yv={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};const bv=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),vv=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),wv=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),_v=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),kv={POSITION:{size:3,value:new Float32Array(vv)},NORMAL:{size:3,value:new Float32Array(wv)},TEXCOORD_0:{size:2,value:new Float32Array(_v)}};class xv extends class{static get DRAW_MODE(){return yv}constructor(e={}){const{id:t=gv("geometry"),drawMode:r=yv.TRIANGLES,attributes:n={},indices:i=null,vertexCount:a=null}=e;this.id=t,this.drawMode=0|r,this.attributes={},this.userData={},this._setAttributes(n,i),this.vertexCount=a||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return"Geometry ".concat(this.id," attribute ").concat(e)}_setAttributes(e,t){t&&(this.indices=ArrayBuffer.isView(t)?{value:t,size:1}:t);for(const t in e){let r=e[t];r=ArrayBuffer.isView(r)?{value:r}:r,dv(ArrayBuffer.isView(r.value),"".concat(this._print(t),": must be typed array or object with value as typed array")),"POSITION"!==t&&"positions"!==t||r.size||(r.size=3),"indices"===t?(dv(!this.indices),this.indices=r):this.attributes[t]=r}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(e,t){if(t)return t.value.length;let r=1/0;for(const t in e){const n=e[t],{value:i,size:a,constant:o}=n;!o&&i&&a>=1&&(r=Math.min(r,i.length/a))}return dv(Number.isFinite(r)),r}}{constructor(e={}){const{id:t=gv("cube-geometry")}=e;super({...e,id:t,indices:{size:1,value:new Uint16Array(bv)},attributes:{...kv,...e.attributes}})}}function Ev(e){var t,r;if(null==e||null===(t=e.parentNode)||void 0===t||!t.obb||null==e||null===(r=e.parentNode)||void 0===r||!r.mbs)return[];const n=[];return function(e,t){var r;const n=function(e){const{center:t,halfSize:r,quaternion:n}=e;return(new wp).fromCenterHalfSizeQuaternion(t,r,n)}(t.parentNode.obb),i=function(e){const t=new xv,r=e.obb.halfSize,n=t.getAttributes(),i=new Float32Array(n.POSITION.value),a=_u.WGS84.cartographicToCartesian(e.obb.center);let o=[];for(let t=0;t<i.length;t+=3){const n=new Ds(i[t]*=r[0],i[t+1]*=r[1],i[t+2]*=r[2]).transformByQuaternion(e.obb.quaternion).add(a);o=o.concat(n)}return o}(t);if(function(e,t){let r=!0;for(let n=0;n<t.length/3;n+=3){const i=[t[n],t[n+1],t[n+2]],a=_u.WGS84.cartesianToCartographic(i);if(e.distanceTo(a)>0){r=!1;break}}return r}(n,i))return;const a=`OBB of Tile (${t.id}) doesn't fit into Parent (${null===(r=t.parentNode)||void 0===r?void 0:r.id}) tile OBB`;e.push(a)}(n,e),function(e,t){const r=Av(t.mbs),n=Av(t.parentNode.mbs);if(r.center.distanceTo(n.center)+r.radius>n.radius){var i;const r=`MBS of Tile (${t.id}) doesn't fit into Parent (${null===(i=t.parentNode)||void 0===i?void 0:i.id}) tile MBS`;e.push(r)}}(n,e),n}function Av(e){return new Th([e[0],e[1],e[2]],e[3])}const Sv={name:"Basis Universal Supercompressed GPU Texture",id:Pi?"ktx2-basis-writer":"ktx2-basis-writer-nodejs",module:"textures",version:"3.3.0-alpha.5",extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},{_encodeImageNode:jv}=globalThis;let Tv=!0;const Cv={name:"Images",id:"image",module:"images",version:"3.3.0-alpha.5",extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:async function(e,t){return(t=t||{}).image=t.image||{},jv?jv(e,{type:t.image.mimeType}):async function(e,t){const{mimeType:r,jpegQuality:n}=t.image,{width:i,height:a}=function(e){return Tu(e)}(e),o=document.createElement("canvas");o.width=i,o.height=a,function(e,t,r=0,n=0){if(0===r&&0===n&&"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t.getContext("bitmaprenderer");if(r)return r.transferFromImageBitmap(e),t}const i=t.getContext("2d");if(e.data){const r=new Uint8ClampedArray(e.data),n=new ImageData(r,e.width,e.height);return i.putImageData(n,0,0),t}i.drawImage(e,0,0)}(e,o);const s=await new Promise(e=>{if(n&&Tv)try{return void o.toBlob(e,r,n)}catch(e){Tv=!1}o.toBlob(e,r)});if(!s)throw new Error("image encoding failed");return await s.arrayBuffer()}(e,t)}};class Bv extends Array{enqueue(e){this.push(e)}dequeue(){return this.shift()}peek(){return this[0]}isEmpty(){return 0===this.length}}function Rv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ov extends Bv{constructor(e=2e3,t=400){super(),Rv(this,"intervalId",void 0),Rv(this,"writePromise",null),Rv(this,"fileMap",{}),Rv(this,"listeningInterval",void 0),Rv(this,"writeConcurrency",void 0),this.listeningInterval=e,this.writeConcurrency=t}async enqueue(e){super.enqueue(e),Ri.a.memoryUsage().rss>4294967296&&await this.startWrite()}startListening(){this.intervalId=setInterval(this.startWrite.bind(this),this.listeningInterval)}stopListening(){this.intervalId&&clearInterval(this.intervalId)}async startWrite(){if(this.writePromise)return await this.writePromise,void(this.writePromise=null);this.writePromise=this.doWrite(),await this.writePromise,this.writePromise=null}async finalize(){this.stopListening(),await this.startWrite()}async doWrite(){for(;this.length;){const e=[],t=[];for(let r=0;r<this.writeConcurrency;r++){const r=this.dequeue();if(!r)break;const{archiveKey:n,writePromise:i}=r;t.push(n),e.push(i)}const r=await Promise.allSettled(e);this.updateFileMap(t,r)}this.writePromise=null}updateFileMap(e,t){for(let r=0;r<e.length;r++){const n=e[r];n&&"value"in t[r]&&(this.fileMap[n]=t[r].value)}}}const Iv={id:"i3s-attributes",name:"I3S Attributes Worker",module:"tile-converter",version:"3.3.0-alpha.5",options:{useCartesianPositions:!1}};var Pv;function Dv(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Mv=(null===(Pv=Ri.a.env)||void 0===Pv?void 0:Pv.IonToken)||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";class Fv{constructor(){Dv(this,"nodePages",void 0),Dv(this,"options",void 0),Dv(this,"layers0Path",void 0),Dv(this,"materialMap",void 0),Dv(this,"materialDefinitions",void 0),Dv(this,"vertexCounter",void 0),Dv(this,"layers0",void 0),Dv(this,"featuresHashArray",void 0),Dv(this,"refinementCounter",void 0),Dv(this,"validate",void 0),Dv(this,"boundingVolumeWarnings",[]),Dv(this,"conversionStartTime",[0,0]),Dv(this,"refreshTokenTime",[0,0]),Dv(this,"sourceTileset",null),Dv(this,"geoidHeightModel",null),Dv(this,"Loader",ob),Dv(this,"generateTextures",void 0),Dv(this,"generateBoundingVolumes",void 0),Dv(this,"layersHasTexture",void 0),Dv(this,"workerSource",{}),Dv(this,"writeQueue",new Ov),this.nodePages=new kb(Zd,64),this.options={},this.layers0Path="",this.materialMap=new Map,this.materialDefinitions=[],this.vertexCounter=0,this.layers0=null,this.featuresHashArray=[],this.refinementCounter={tilesCount:0,tilesWithAddRefineCount:0},this.validate=!1,this.generateTextures=!1,this.generateBoundingVolumes=!1,this.layersHasTexture=!1}async convert(e){if(Pi)return console.log(fm),fm;this.conversionStartTime=Ri.a.hrtime();const{tilesetName:t,slpk:r,egmFilePath:n,inputUrl:i,validate:a,outputPath:o,draco:s,sevenZipExe:u,maxDepth:c,token:l,generateTextures:h,generateBoundingVolumes:p}=e;this.options={maxDepth:c,slpk:r,sevenZipExe:u,egmFilePath:n,draco:s,token:l,inputUrl:i},this.validate=Boolean(a),this.Loader=-1!==i.indexOf("https://")?ub:ob,this.generateTextures=Boolean(h),this.generateBoundingVolumes=Boolean(p),this.writeQueue=new Ov,this.writeQueue.startListening(),console.log("Loading egm file..."),this.geoidHeightModel=await Zo(n,Fd),console.log("Loading egm file completed!"),r&&this.nodePages.useWriteFunction(em),await this.loadWorkers();try{const e=await this._fetchPreloadOptions(),n={loadOptions:{_nodeWorkers:!0,reuseWorkers:!0,basis:{format:"rgba32"},"basis-nodejs":{format:"rgba32",workerUrl:"./modules/textures/dist/basis-nodejs-worker.js"},"draco-nodejs":{workerUrl:"./modules/draco/dist/draco-nodejs-worker.js"}}};e.headers&&(n.loadOptions.fetch={headers:e.headers}),Object.assign(n,e);const a=await Zo(i,this.Loader,n.loadOptions);return this.sourceTileset=new Cd(a,n),await this._createAndSaveTileset(o,t),await this._finishConversion({slpk:Boolean(r),outputPath:o,tilesetName:t}),a}catch(e){throw e}finally{za.getWorkerFarm({}).destroy()}}async _createAndSaveTileset(e,t){const r=Object(Ci.join)(""+e,""+t);try{await tm(r)}catch(e){}this.layers0Path=Object(Ci.join)(r,"SceneServer","layers","0"),this._formLayers0(t),this.materialDefinitions=[],this.materialMap=new Map;const n=this.sourceTileset.root,i=sm(n,this.geoidHeightModel),a=this.nodePages.push({index:0,lodThreshold:0,obb:i.obb,children:[]}),o=this.options.slpk,s=this._formRootNodeIndexDocument(i);await this._convertNodesTree(s,n,a,i),this.layers0.materialDefinitions=this.materialDefinitions,!1===this.layersHasTexture&&(this.layers0.store.defaultGeometrySchema.ordering=this.layers0.store.defaultGeometrySchema.ordering.filter(e=>"uv0"!==e)),await this._writeLayers0(),async function(e,t,r){const n={serviceItemId:bb().replace(/-/gi,""),layerName:e,layers0:t},i=Ii()(n,{serviceItemId:{path:"serviceItemId"},serviceName:{path:"layerName"},name:{path:"layerName"},currentVersion:{path:"currentVersion",default:10.7},serviceVersion:{path:"serviceVersion",default:"1.8"},supportedBindings:{path:"supportedBindings",default:["REST"]},layers:{path:"layers0",transform:e=>[e]}}),a=Object(Ci.join)(r,"SceneServer");await Zd(a,JSON.stringify(i))}(t,this.layers0,r),await this._writeNodeIndexDocument(s,"root",Object(Ci.join)(this.layers0Path,"nodes","root")),await this.nodePages.save(this.layers0Path,this.writeQueue,o),await this.writeQueue.finalize(),await this._createSlpk(r)}_formLayers0(e){var t,r,n;const i=function(e){let t;t=e instanceof Th?e:e.getBoundingSphere();const r=t.center,n=t.radius,i=_u.WGS84.cartesianToCartographic(new Ds(r[0]+n,r[1]+n,r[2]+n),new Ds),a=_u.WGS84.cartesianToCartographic(new Ds(r[0]-n,r[1]-n,r[2]-n),new Ds);return{xmin:a[0],xmax:i[0],ymin:a[1],ymax:i[1],zmin:a[2],zmax:i[2]}}((null===(t=this.sourceTileset)||void 0===t?void 0:t.boundingVolume)||(null===(r=this.sourceTileset)||void 0===r||null===(n=r.root)||void 0===n?void 0:n.boundingVolume)),a=[i.xmin,i.ymin,i.xmax,i.ymax],o={version:`{${bb().toUpperCase()}}`,id:0,name:e,href:"./layers/0",store:{id:`{${bb().toUpperCase()}}`,extent:a},nodePages:{nodesPerPage:64},compressGeometry:this.options.draco,fullExtent:i};this.layers0=Ii()(o,{version:{path:"version",transform:e=>e.toUpperCase()},id:{path:"id",default:0},name:{path:"name"},href:{path:"href",default:"./layers/0"},layerType:{path:"layerType",default:"IntegratedMesh"},spatialReference:{path:"spatialReference",transform:e=>Ii()(e,{wkid:{path:"wkid",default:4326},latestWkid:{path:"latestWkid",default:4326},vcsWkid:{path:"vcsWkid",default:5773},latestVcsWkid:{path:"latestVcsWkid",default:5773}})},capabilities:{path:"capabilities",default:["View","Query"]},store:{path:"store",transform:e=>Ii()(e,lv)},fullExtent:{path:"fullExtent",transform:e=>Ii()(e,{xmin:{path:"xmin"},ymin:{path:"ymin"},xmax:{path:"xmax"},ymax:{path:"ymax"},zmin:{path:"zmin"},zmax:{path:"zmax"}})},heightModelInfo:{path:"heightModelInfo",transform:e=>Ii()(e,{heightModel:{path:"heightModel",default:"gravity_related_height"},vertCRS:{path:"vertCRS",default:"EGM96_Geoid"},heightUnit:{path:"heightUnit",default:"meter"}})},nodePages:{path:"nodePages",transform:e=>Ii()(e,{nodesPerPage:{path:"nodesPerPage"},lodSelectionMetricType:{path:"lodSelectionMetricType",default:"maxScreenThresholdSQ"}})},materialDefinitions:{path:"materialDefinitions",default:[]},textureSetDefinitions:{path:"textureSetDefinitions",default:[]},geometryDefinitions:{path:"compressGeometry",transform:e=>{const t=[{geometryBuffers:[]},{geometryBuffers:[]}];return t[0].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),t[1].geometryBuffers.push({offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}),e&&(t[0].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","uv0","color","feature-index"]}}),t[1].geometryBuffers.push({compressedAttributes:{encoding:"draco",attributes:["position","normal","color","feature-index"]}})),t},default:[{geometryBuffers:[{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},uv0:{type:"Float32",component:2},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}},{offset:8,position:{type:"Float32",component:3},normal:{type:"Float32",component:3},color:{type:"UInt8",component:4},featureId:{binding:"per-feature",type:"UInt64",component:1},faceRange:{binding:"per-feature",type:"UInt32",component:2}}]}]},attributeStorageInfo:{path:"attributeStorageInfo",default:[]},fields:{path:"fields",default:[]},popupInfo:{path:"popupInfo",default:null}})}_formRootNodeIndexDocument(e){const t={version:`{${bb().toUpperCase()}}`,id:"root",level:0,lodSelection:[{metricType:"maxScreenThresholdSQ",maxError:0},{metricType:"maxScreenThreshold",maxError:0}],...e,children:[]};return Ii()(t,hv())}async _convertNodesTree(e,t,r,n){if(await this.sourceTileset._loadTile(t),this.isContentSupported(t)){e.children=e.children||[],e.children.push({id:"1",href:"./1",...n});const[i]=await this._createNode(e,t,r,0),a=Object(Ci.join)(this.layers0Path,"nodes",i.path);this.options.slpk?await this.writeQueue.enqueue({archiveKey:"nodes/1/3dNodeIndexDocument.json.gz",writePromise:em(a,JSON.stringify(i),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Zd(a,JSON.stringify(i))})}else await this._addChildrenWithNeighborsAndWriteFile({parentNode:e,sourceTiles:t.children,parentId:r,level:1});await t.unloadContent()}async _writeLayers0(){this.options.slpk?await this.writeQueue.enqueue({archiveKey:"3dSceneLayer.json.gz",writePromise:em(this.layers0Path,JSON.stringify(this.layers0),"3dSceneLayer.json")}):await this.writeQueue.enqueue({writePromise:Zd(this.layers0Path,JSON.stringify(this.layers0))})}async _writeNodeIndexDocument(e,t,r){this.options.slpk?await this.writeQueue.enqueue({archiveKey:`nodes/${t}/3dNodeIndexDocument.json.gz`,writePromise:em(r,JSON.stringify(e),"3dNodeIndexDocument.json")}):await this.writeQueue.enqueue({writePromise:Zd(r,JSON.stringify(e))})}async _createSlpk(e){if(this.options.slpk){const t=Object(Ci.join)(e,"SceneServer","layers","0"),r=e+".slpk";await Xd(t,r,0,".",this.options.sevenZipExe);try{await tm(e)}catch(e){}}}async _addChildrenWithNeighborsAndWriteFile(e){const t=[];await this._addChildren({...e,childNodes:t}),await this._addNeighborsAndWriteFile(e.parentNode,t)}async convertNestedTileset({sourceTile:e,parentNode:t,childNodes:r,parentId:n,level:i}){await this.sourceTileset._loadTile(e),await this._addChildren({parentNode:t,sourceTiles:e.children,childNodes:r,parentId:n,level:i+1}),await e.unloadContent()}async convertNode({sourceTile:e,parentNode:t,childNodes:r,parentId:n,level:i}){const a=await this._createNode(t,e,n,i);t.children=t.children||[];for(const e of a)t.children.push({id:e.id,href:"../"+e.path,obb:e.obb,mbs:e.mbs}),r.push(e)}async _addChildren(e){const{childNodes:t,sourceTiles:r,parentNode:n,parentId:i,level:a}=e;if(this.options.maxDepth&&a>this.options.maxDepth)return;const o=[];for(const e of r)"json"===e.type?o.push(this.convertNestedTileset({sourceTile:e,parentNode:n,childNodes:t,parentId:i,level:a})):o.push(this.convertNode({sourceTile:e,parentNode:n,childNodes:t,parentId:i,level:a})),await Promise.all(o),e.id&&console.log(e.id)}async _addNeighborsAndWriteFile(e,t){for(const n of t){var r;const t=Object(Ci.join)(this.layers0Path,"nodes",n.path),i=n.path;if(delete n.path,Number(null==e||null===(r=e.children)||void 0===r?void 0:r.length)<1e3)for(const t of e.children||[])n.id!==t.id&&n.neighbors&&n.neighbors.push({...t});else console.warn(`Node ${n.id}: neighbors attribute is omited because of large number of neigbors`),delete n.neighbors;await this._writeNodeIndexDocument(n,i,t),n.neighbors=[]}}async _createNode(e,t,r,n){var i,a;this.validate&&this._checkAddRefinementTypeForTile(t),await this._updateTilesetOptions(),await this.sourceTileset._loadTile(t);let o=sm(t,this.geoidHeightModel);const s=cv(t.content);!s||null!==(i=this.layers0)&&void 0!==i&&null!==(a=i.attributeStorageInfo)&&void 0!==a&&a.length||this._convertPropertyTableToNodeAttributes(s);const u=await this._convertResources(t,r,s),c=[],l=[],h={geometry:null,compressedGeometry:null,texture:null,sharedResources:null,meshMaterial:null,vertexCount:null,attributes:null,featureCount:null,boundingVolumes:null};for(const n of u||[h]){this.layersHasTexture=this.layersHasTexture||Boolean(n.texture),this.generateBoundingVolumes&&n.boundingVolumes&&(o=n.boundingVolumes);const i=Nd(t,o),a=i.find(e=>"maxScreenThresholdSQ"===e.metricType)||{maxError:0},s=this._updateNodeInNodePages(a,o,t,r,n),u=this._createNodeIndexDocument(e,o,i,s,n);s.mesh&&await this._writeResources(n,u.path),this.validate&&(this.boundingVolumeWarnings=Ev(u),this.boundingVolumeWarnings&&this.boundingVolumeWarnings.length&&console.warn("Bounding Volume Warnings: ",...this.boundingVolumeWarnings)),c.push(u),l.push(s)}return t.unloadContent(),await this._addChildrenWithNeighborsAndWriteFile({parentNode:c[0],sourceTiles:t.children,parentId:l[0].index,level:n+1}),c}async _convertResources(e,t,r){var n;if(!this.isContentSupported(e))return null;const i={center:[],halfSize:[],quaternion:[]};return await Ub(e.content,()=>this.nodePages.push({index:0,obb:i},t),r,this.featuresHashArray,null===(n=this.layers0)||void 0===n?void 0:n.attributeStorageInfo,this.options.draco,this.generateBoundingVolumes,this.geoidHeightModel,this.workerSource)}_updateNodeInNodePages(e,t,r,n,i){const{meshMaterial:a,texture:o,vertexCount:s,featureCount:u,geometry:c}=i,l={index:0,lodThreshold:e.maxError,obb:t.obb,children:[]};c&&this.isContentSupported(r)&&(l.mesh={geometry:{definition:o?0:1,resource:0},attribute:{resource:0},material:{definition:0}});let h=i.nodeId;if(h){this.nodePages.updateAll(h,l);const e=this.nodePages.getNodeById(h);this.nodePages.updateResourceInMesh(e)}else h=this.nodePages.push(l,n);if(a&&this.nodePages.updateMaterialByNodeId(h,this._findOrCreateMaterial(a)),o){const e=o.image.height*o.image.width;this.nodePages.updateTexelCountHintByNodeId(h,e)}return s&&(this.vertexCounter+=s,this.nodePages.updateVertexCountByNodeId(h,s)),this.nodePages.updateNodeAttributeByNodeId(h),u&&this.nodePages.updateFeatureCountByNodeId(h,u),this.nodePages.getNodeById(h)}_createNodeIndexDocument(e,t,r,n,i){const{texture:a,attributes:o}=i,s=n.index,u={version:e.version,id:s.toString(),path:s.toString(),level:e.level+1,...t,lodSelection:r,parentNode:{id:e.id,href:"../"+e.id,mbs:e.mbs,obb:e.obb},children:[],neighbors:[]},c=Ii()(u,hv());var l,h;if(n.mesh&&(c.geometryData=[{href:"./geometries/0"}],c.sharedResource={href:"./shared"},a&&(c.textureData=[{href:"./textures/0"},{href:"./textures/1"}]),o&&o.length&&null!==(l=this.layers0)&&void 0!==l&&null!==(h=l.attributeStorageInfo)&&void 0!==h&&h.length)){c.attributeData=[];for(let e=0;e<o.length;e++){const t=this.layers0.attributeStorageInfo[e].key;c.attributeData.push({href:`./attributes/${t}/0`})}}return c}async _writeResources(e,t){const{geometry:r,compressedGeometry:n,texture:i,sharedResources:a,attributes:o}=e,s=Object(Ci.join)(this.layers0Path,"nodes",t),u=Object(Ci.join)("nodes",t);await this._writeGeometries(r,n,s,u),await this._writeShared(a,s,u,t),await this._writeTexture(i,s,u),await this._writeAttributes(o,s,u)}async _writeGeometries(e,t,r,n){if(this.options.slpk){const t=Object(Ci.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/0.bin.gz",writePromise:em(t,e,"0.bin")})}else{const t=Object(Ci.join)(r,"geometries/0/");await this.writeQueue.enqueue({writePromise:Zd(t,e,"index.bin")})}if(this.options.draco)if(this.options.slpk){const e=Object(Ci.join)(r,"geometries");await this.writeQueue.enqueue({archiveKey:n+"/geometries/1.bin.gz",writePromise:em(e,t,"1.bin")})}else{const e=Object(Ci.join)(r,"geometries/1/");await this.writeQueue.enqueue({writePromise:Zd(e,t,"index.bin")})}}async _writeShared(e,t,r,n){if(!e)return;e.nodePath=n;const i=Ii()(e,{materialDefinitions:{path:"materialDefinitionInfos",transform:pv},textureDefinitions:{path:"textureDefinitionInfos",transform:fv}}),a=JSON.stringify(i);if(this.options.slpk){const e=Object(Ci.join)(t,"shared");await this.writeQueue.enqueue({archiveKey:r+"/shared/sharedResource.json.gz",writePromise:em(e,a,"sharedResource.json")})}else{const e=Object(Ci.join)(t,"shared/");await this.writeQueue.enqueue({writePromise:Zd(e,a)})}}async _writeTexture(e,t,r){if(e){const n=this._getFormatByMimeType(null==e?void 0:e.mimeType),i=[],a=e.bufferView.data;switch(n){case"jpg":case"png":if(i.push({name:"0",format:n}),await this.writeTextureFile(a,"0",n,t,r),this.generateTextures){i.push({name:"1",format:"ktx2"});const n=e.image.data.subarray(),a=new Uint8Array(n),o=gm({...e.image,data:a},Sv,{...Sv.options,source:this.workerSource.ktx2,reuseWorkers:!0,_nodeWorkers:!0});await this.writeTextureFile(o,"1","ktx2",t,r)}break;case"ktx2":if(i.push({name:"1",format:n}),await this.writeTextureFile(a,"1",n,t,r),this.generateTextures){i.push({name:"0",format:"jpg"});const n=gm(e.image.data[0],Cv);await this.writeTextureFile(n,"0","jpg",t,r)}}this.layers0.textureSetDefinitions.length||this.layers0.textureSetDefinitions.push({formats:i})}}async writeTextureFile(e,t,r,n,i){if(this.options.slpk){const a=Object(Ci.join)(n,"textures"),o=!1;await this.writeQueue.enqueue({archiveKey:`${i}/textures/${t}.${r}`,writePromise:em(a,e,`${t}.${r}`,o)})}else{const i=Object(Ci.join)(n,`textures/${t}/`);await this.writeQueue.enqueue({writePromise:Zd(i,e,"index."+r)})}}async _writeAttributes(e=[],t,r){var n,i;if(null!=e&&e.length&&null!==(n=this.layers0)&&void 0!==n&&null!==(i=n.attributeStorageInfo)&&void 0!==i&&i.length)for(let n=0;n<e.length;n++){const i=this.layers0.attributeStorageInfo[n].key,a=new Uint8Array(e[n]);if(this.options.slpk){const e=Object(Ci.join)(t,"attributes",i);await this.writeQueue.enqueue({archiveKey:`${r}/attributes/${i}.bin.gz`,writePromise:em(e,a,"0.bin")})}else{const e=Object(Ci.join)(t,`attributes/${i}/0`);await this.writeQueue.enqueue({writePromise:Zd(e,a,"index.bin")})}}}_getFormatByMimeType(e){switch(e){case"image/jpeg":return"jpg";case"image/png":return"png";case"image/ktx2":return"ktx2";default:return"jpg"}}_findOrCreateMaterial(e){const t=wb()(JSON.stringify(e));if(this.materialMap.has(t))return this.materialMap.get(t);const r=this.materialDefinitions.push(e)-1;return this.materialMap.set(t,r),r}_convertPropertyTableToNodeAttributes(e){let t=0;const r={OBJECTID:[0],...e};for(const e in r){const n=Ib(e,r[e][0]),i=Pb(t,e,n),a=Mb(e,Db(n)),o=Fb(r);this.layers0.attributeStorageInfo.push(i),this.layers0.fields.push(a),this.layers0.popupInfo=o,this.layers0.layerType="3DObject",t+=1}}async _finishConversion(e){const{tilesCount:t,tilesWithAddRefineCount:r}=this.refinementCounter,n=r?r/t*100:0,i=await am(e),a=im(Ri.a.hrtime(this.conversionStartTime));console.log("------------------------------------------------"),console.log("Finishing conversion of 3DTILES"),console.log("Total conversion time: "+a),console.log("Vertex count: ",this.vertexCounter),console.log("File(s) size: ",i," bytes"),console.log('Percentage of tiles with "ADD" refinement type:',n,"%"),console.log("------------------------------------------------")}async _fetchPreloadOptions(){if(!this.Loader.preload)return{};const e={"cesium-ion":{accessToken:this.options.token||Mv}},t=await this.Loader.preload(this.options.inputUrl,e);return this.refreshTokenTime=Ri.a.hrtime(),{...e,...t}}async _updateTilesetOptions(){if(Ri.a.hrtime(this.refreshTokenTime)[0]<1800)return;this.refreshTokenTime=Ri.a.hrtime();const e=await this._fetchPreloadOptions();this.sourceTileset.options={...this.sourceTileset.options,...e},e.headers&&(this.sourceTileset.loadOptions.fetch={...this.sourceTileset.loadOptions.fetch,headers:e.headers},console.log("Authorization Bearer token has been updated"))}_checkAddRefinementTypeForTile(e){1===e.refine&&(this.refinementCounter.tilesWithAddRefineCount+=1,console.warn('This tile uses "ADD" type of refinement')),this.refinementCounter.tilesCount+=1}isContentSupported(e){var t;return["b3dm","glTF"].includes(null==e||null===(t=e.content)||void 0===t?void 0:t.type)}async loadWorkers(){if(console.log("Loading workers source..."),this.options.draco){const e=Ua(Bc,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.draco=r}if(this.generateTextures){const e=Ua(Sv,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.ktx2=r}const e=Ua(Iv,{...pa()}),t=await oa(e),r=await t.text();this.workerSource.I3SAttributes=r,console.log("Loading workers source completed!")}}const Lv={id:"zip",module:"zip",name:"Zip Archive",version:"3.3.0-alpha.5",extensions:["zip"],mimeTypes:["application/zip"],category:"archive",tests:["PK"],options:{},parse:async function(e,t={}){const r=[],n={};try{const i=new Kd.a;return(await i.loadAsync(e,t)).forEach((e,a)=>{const o=a.name,s=async function(e,t,r={}){try{return await e.file(t).async(r.dataType||"arraybuffer")}catch(e){return r.log.error(`Unable to read ${t} from zip archive: ${e}`),e}}(i,o,t).then(t=>{n[e]=t});r.push(s)}),await Promise.all(r),n}catch(e){throw t.log.error("Unable to read zip archive: "+e),e}}};class Nv{async install(e="",t=""){console.log('Installing "EGM2008-5" model...');const r=await Zo("https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip",Lv,{});let n=process.cwd();e&&(n=Object(Ci.join)(n,e)),await Zd(n,new Uint8Array(r["geoids/egm2008-5.pgm"]),"egm2008-5.pgm"),console.log('Installing "I3S Content Loader worker"'),await this.installWorker("i3s","i3s-content-nodejs-worker.js",t),console.log('Installing "Draco Loader worker"'),await this.installWorker("draco","draco-nodejs-worker.js",t),console.log('Installing "Basis Loader worker"'),await this.installWorker("textures","basis-nodejs-worker.js",t),console.log("All dependencies were installed succesfully.")}async installWorker(e,t,r){const n=await oa(`https://unpkg.com/@loaders.gl/${e}@3.3.0-alpha.5/dist/${t}`),i=await n.arrayBuffer();if(!i)return;const a=Object(Ci.join)(process.cwd(),r,"modules",e,"dist");await Zd(a,i,t)}}const zv={I3S:"I3S",_3DTILES:"3DTILES"};function Uv(){console.log("cli: converter 3dTiles to I3S or I3S to 3dTiles..."),console.log('--install-dependencies [Run the script for installing dependencies. Run this options separate from others. Now "*.pgm" file installation is implemented]'),console.log("--max-depth [Maximal depth of hierarchical tiles tree traversal, default: infinite]"),console.log("--name [Tileset name]"),console.log('--output [Output folder, default: "data" folder]'),console.log("--slpk [Generate slpk (Scene Layer Packages) I3S output file]"),console.log("--tileset [tileset.json file (3DTiles) / http://..../SceneServer/layers/0 resource (I3S)]"),console.log("--input-type [tileset input type: I3S or 3DTILES]"),console.log('--7zExe [location of 7z.exe archiver to create slpk on Windows, default: "C:\\Program Files\\7-Zip\\7z.exe"]'),console.log('--egm [location of Earth Gravity Model *.pgm file to convert heights from ellipsoidal to gravity-related format. A model file can be loaded from GeographicLib https://geographiclib.sourceforge.io/html/geoid.html], default: "./deps/egm2008-5.zip"'),console.log("--token [Token for Cesium ION tilesets authentication]"),console.log("--no-draco [Disable draco compression for geometry]"),console.log("--generate-textures [Enable KTX2 textures generation if only one of (JPG, PNG) texture is provided or generate JPG texture if only KTX2 is provided]"),console.log("--generate-bounding-volumes [Will generate obb and mbs bounding volumes from geometry]"),console.log("--validate [Enable validation]"),process.exit(0)}function qv(e,t){if(e+1>=t.length)return"";const r=t[e+1];return 0===r.indexOf("--")?"":r}function Hv(e,t){const r=qv(e,t).toLowerCase().trim();return!("--no-draco"===t[e]&&!r)&&(!r||"true"===r)}(async function(){const[,,...e]=process.argv;0===e.length&&Uv();const t=function(e){const t={output:"data",sevenZipExe:"C:\\Program Files\\7-Zip\\7z.exe",egm:Object(Ci.join)(process.cwd(),"deps","egm2008-5.pgm"),draco:!0,installDependencies:!1,generateTextures:!1,generateBoundingVolumes:!1,validate:!1,slpk:!1};return e.forEach((r,n)=>{if(0===r.indexOf("--"))switch(r){case"--input-type":t.inputType=qv(n,e);break;case"--tileset":t.tileset=qv(n,e);break;case"--name":t.name=qv(n,e);break;case"--output":t.output=qv(n,e);break;case"--max-depth":t.maxDepth=function(e,t){const r=qv(e,t),n=Number.parseInt(r);if(isFinite(n))return n;return NaN}(n,e);break;case"--slpk":t.slpk=Hv(n,e);break;case"--7zExe":t.sevenZipExe=qv(n,e);break;case"--egm":t.egm=qv(n,e);break;case"--token":t.token=qv(n,e);break;case"--no-draco":t.draco=Hv(n,e);break;case"--validate":t.validate=Hv(n,e);break;case"--install-dependencies":t.installDependencies=Hv(n,e);break;case"--generate-textures":t.generateTextures=Hv(n,e);break;case"--generate-bounding-volumes":t.generateBoundingVolumes=Hv(n,e);break;case"--help":Uv();break;default:console.warn("Unknown option "+r),process.exit(0)}}),t}(function(e){return e.reduce((e,t)=>{const r=t.indexOf("="),n=t.slice(0,r),i=t.slice(r+1,t.length);return t.includes("=")&&t.startsWith("--")&&i?e.concat(n,i):e.concat(t)},[])}(e));if(t.installDependencies){return void(new Nv).install("deps")}const r=function(e){const t={name:()=>console.log("Missed: --name [Tileset name]"),output:()=>console.log("Missed: --output [Output path name]"),sevenZipExe:()=>console.log("Missed: --7zExe [7z archiver executable path]"),egm:()=>console.log("Missed: --egm [*.pgm earth gravity model file path]"),tileset:()=>console.log("Missed: --tileset [tileset.json file]"),inputType:()=>console.log("Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]")},r=[];for(const n in t){const i=e[n],a=Boolean(i)&&"inputType"===n&&!Object.values(zv).includes(i.toUpperCase());i&&!a||r.push(t[n])}r.length&&(r.forEach(e=>e()),process.exit(0));return e}(t);await async function(e){console.log("------------------------------------------------"),console.log("Starting conversion of "+e.inputType),console.log("------------------------------------------------");switch(e.inputType.toUpperCase()){case zv.I3S:(new mm).convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,egmFilePath:e.egm});break;case zv._3DTILES:const t=new Fv;await t.convert({inputUrl:e.tileset,outputPath:e.output,tilesetName:e.name,maxDepth:e.maxDepth,slpk:e.slpk,sevenZipExe:e.sevenZipExe,egmFilePath:e.egm,token:e.token,draco:e.draco,generateTextures:e.generateTextures,generateBoundingVolumes:e.generateBoundingVolumes,validate:e.validate});break;default:Uv()}}(r)})().catch(e=>{console.log(e),process.exit(1)})},,,,,,,,,,,function(e,t){e.exports=require("worker_threads")},function(e,t,r){"use strict";function n(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const t="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}()}r.d(t,"a",(function(){return _}));const i="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source",a=n();class o{constructor(e,t,r="sessionStorage"){this.storage=function(e){try{const t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config={},Object.assign(this.config,t),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){return this.config={},this.updateConfiguration(e)}updateConfiguration(e){if(Object.assign(this.config,e),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}_loadConfiguration(){let e={};if(this.storage){const t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function s(e,t,r,n=600){const i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));const a=e.width*r,o=e.height*r,s=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),s]}const u={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function c(e){return"string"==typeof e?u[e.toUpperCase()]||u.WHITE:e}function l(e,t){if(!e)throw new Error(t||"Assertion failed")}const h={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},p=h.window||h.self||h.global,f=h.process||{};console;function d(){let e;if(a&&p.performance)e=p.performance.now();else if(f.hrtime){const t=f.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}const m={debug:a&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},g={enabled:!0,level:0};function y(){}const b={},v={once:!0};function w(e){for(const t in e)for(const r in e[t])return r||"untitled";return"empty"}class _{constructor({id:e}={id:""}){this.id=e,this.VERSION=i,this._startTs=d(),this._deltaTs=d(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new o("__probe-".concat(this.id,"__"),g),this.userData={},this.timeStamp("".concat(this.id," started")),function(e,t=["constructor"]){const r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof e[r]&&(t.find(e=>r===e)||(e[r]=e[r].bind(e)))}(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((d()-this._startTs).toPrecision(10))}getDelta(){return Number((d()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.updateConfiguration({enabled:e}),this}setLevel(e){return this._storage.updateConfiguration({level:e}),this}assert(e,t){l(e,t)}warn(e){return this._getLogFunction(0,e,m.warn,arguments,v)}error(e){return this._getLogFunction(0,e,m.error,arguments)}deprecated(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}removed(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}probe(e,t){return this._getLogFunction(e,t,m.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,m.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,m.debug||m.info,arguments,v)}table(e,t,r){return t?this._getLogFunction(e,t,console.table||y,r&&[r],{tag:w(t)}):y}image({logLevel:e,priority:t,image:n,message:i="",scale:o=1}){return this._shouldLog(e||t)?a?function({image:e,message:t="",scale:r=1}){if("string"==typeof e){const n=new Image;return n.onload=()=>{const e=s(n,t,r);console.log(...e)},n.src=e,y}const n=e.nodeName||"";if("img"===n.toLowerCase())return console.log(...s(e,t,r)),y;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...s(n,t,r)),n.src=e.toDataURL(),y}return y}({image:n,message:i,scale:o}):function({image:e,message:t="",scale:n=1}){let i=null;try{i=r(!function(){var e=new Error("Cannot find module 'asciify-image'");throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}if(i)return()=>i(e,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(e=>console.log(e));return y}({image:n,message:i,scale:o}):y}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(e){return this._storage.config[e]}set(e,t){this._storage.updateConfiguration({[e]:t})}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||y)}group(e,t,r={collapsed:!1}){r=x({logLevel:e,message:t,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(e,t,r={}){return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||y)}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=k(e)}_getLogFunction(e,t,r,n=[],i){if(this._shouldLog(e)){i=x({logLevel:e,message:t,args:n,opts:i}),l(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=d();const o=i.tag||i.message;if(i.once){if(b[o])return y;b[o]=d()}return t=function(e,t,r){if("string"==typeof t){const s=r.time?function(e,t=8){const r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}(function(e){let t;return t=e<10?"".concat(e.toFixed(2),"ms"):e<100?"".concat(e.toFixed(1),"ms"):e<1e3?"".concat(e.toFixed(0),"ms"):"".concat((e/1e3).toFixed(2),"s"),t}(r.total)):"";t=r.time?"".concat(e,": ").concat(s," ").concat(t):"".concat(e,": ").concat(t),n=t,i=r.color,o=r.background,a||"string"!=typeof n||(i&&(i=c(i),n="[".concat(i,"m").concat(n,"[39m")),o&&(i=c(o),n="[".concat(o+10,"m").concat(n,"[49m"))),t=n}var n,i,o;return t}(this.id,i.message,i),r.bind(console,t,...i.args)}return y}}function k(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return l(Number.isFinite(t)&&t>=0),t}function x(e){const{logLevel:t,message:r}=e;e.logLevel=k(t);const n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(e.args=n,typeof t){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());const i=typeof e.message;return l("string"===i||"object"===i),Object.assign(e,e.opts)}_.VERSION=i}]);
|