@deck.gl/geo-layers 9.2.8 → 9.2.9
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/dist.dev.js +221 -131
- package/dist.min.js +11 -11
- package/package.json +2 -2
package/dist.min.js
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var d1=Object.create;var
|
|
8
|
-
`&&e[o]!=="\r";o++)c+=e[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!i_(c)){let u;return c.trim().length===0?u="Invalid space after '<'.":u="Tag '"+c+"' is an invalid name.",ot("InvalidTag",u,_t(e,o))}let l=e_(e,o);if(l===!1)return ot("InvalidAttr","Attributes for '"+c+"' have open quote.",_t(e,o));let f=l.value;if(o=l.index,f[f.length-1]==="/"){let u=o-f.length;f=f.substring(0,f.length-1);let h=
|
|
9
|
-
`||e==="\r"}function
|
|
10
|
-
`);let t=new
|
|
11
|
-
`;function J_(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=k_)
|
|
7
|
+
"use strict";var __exports__=(()=>{var d1=Object.create;var sn=Object.defineProperty;var p1=Object.getOwnPropertyDescriptor;var m1=Object.getOwnPropertyNames;var g1=Object.getPrototypeOf,A1=Object.prototype.hasOwnProperty;var x1=(e,t,r)=>t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var df=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var rt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pt=(e,t)=>{for(var r in t)sn(e,r,{get:t[r],enumerable:!0})},ys=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m1(t))!A1.call(e,s)&&s!==r&&sn(e,s,{get:()=>t[s],enumerable:!(n=p1(t,s))||n.enumerable});return e},ye=(e,t,r)=>(ys(e,t,"default"),r&&ys(r,t,"default")),D=(e,t,r)=>(r=e!=null?d1(g1(e)):{},ys(t||!e||!e.__esModule?sn(r,"default",{value:e,enumerable:!0}):r,e)),y1=e=>ys(sn({},"__esModule",{value:!0}),e);var on=(e,t,r)=>(x1(e,typeof t!="symbol"?t+"":t,r),r);var zt=rt((rL,pf)=>{pf.exports=globalThis.deck});var qt=rt((sL,gf)=>{gf.exports=globalThis.deck});var Ds=rt((ML,Ru)=>{Ru.exports=globalThis.h3||{}});var eo=rt(ce=>{"use strict";var Rh=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",WE=Rh+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Fh="["+Rh+"]["+WE+"]*",YE=new RegExp("^"+Fh+"$"),KE=function(e,t){let r=[],n=t.exec(e);for(;n;){let s=[];s.startIndex=t.lastIndex-n[0].length;let o=n.length;for(let i=0;i<o;i++)s.push(n[i]);r.push(s),n=t.exec(e)}return r},QE=function(e){let t=YE.exec(e);return!(t===null||typeof t>"u")};ce.isExist=function(e){return typeof e<"u"};ce.isEmptyObject=function(e){return Object.keys(e).length===0};ce.merge=function(e,t,r){if(t){let n=Object.keys(t),s=n.length;for(let o=0;o<s;o++)r==="strict"?e[n[o]]=[t[n[o]]]:e[n[o]]=t[n[o]]}};ce.getValue=function(e){return ce.isExist(e)?e:""};ce.isName=QE;ce.getAllMatches=KE;ce.nameRegexp=Fh});var La=rt(Gh=>{"use strict";var wa=eo(),ZE={allowBooleanAttributes:!1,unpairedTags:[]};Gh.validate=function(e,t){t=Object.assign({},ZE,t);let r=[],n=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=Oh(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=Nh(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let c="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
|
|
8
|
+
`&&e[o]!=="\r";o++)c+=e[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!i_(c)){let u;return c.trim().length===0?u="Invalid space after '<'.":u="Tag '"+c+"' is an invalid name.",ot("InvalidTag",u,_t(e,o))}let l=e_(e,o);if(l===!1)return ot("InvalidAttr","Attributes for '"+c+"' have open quote.",_t(e,o));let f=l.value;if(o=l.index,f[f.length-1]==="/"){let u=o-f.length;f=f.substring(0,f.length-1);let h=Dh(f,t);if(h===!0)n=!0;else return ot(h.err.code,h.err.msg,_t(e,u+h.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return ot("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",_t(e,i));if(r.length===0)return ot("InvalidTag","Closing tag '"+c+"' has not been opened.",_t(e,i));{let u=r.pop();if(c!==u.tagName){let h=_t(e,u.tagStartPos);return ot("InvalidTag","Expected closing tag '"+u.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+c+"'.",_t(e,i))}r.length==0&&(s=!0)}}else return ot("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",_t(e,o));else{let u=Dh(f,t);if(u!==!0)return ot(u.err.code,u.err.msg,_t(e,o-f.length+u.err.line));if(s===!0)return ot("InvalidXml","Multiple possible root nodes found.",_t(e,o));t.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:i}),n=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=Nh(e,o);continue}else if(e[o+1]==="?"){if(o=Oh(e,++o),o.err)return o}else break;else if(e[o]==="&"){let u=s_(e,o);if(u==-1)return ot("InvalidChar","char '&' is not expected.",_t(e,o));o=u}else if(s===!0&&!Ph(e[o]))return ot("InvalidXml","Extra text at the end",_t(e,o));e[o]==="<"&&o--}}else{if(Ph(e[o]))continue;return ot("InvalidChar","char '"+e[o]+"' is not expected.",_t(e,o))}if(n){if(r.length==1)return ot("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",_t(e,r[0].tagStartPos));if(r.length>0)return ot("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ot("InvalidXml","Start tag expected.",1);return!0};function Ph(e){return e===" "||e===" "||e===`
|
|
9
|
+
`||e==="\r"}function Oh(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="xml")return ot("InvalidXml","XML declaration allowed only at the start of the document.",_t(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Nh(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var $E='"',t_="'";function e_(e,t){let r="",n="",s=!1;for(;t<e.length;t++){if(e[t]===$E||e[t]===t_)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){s=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:s}}var r_=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Dh(e,t){let r=wa.getAllMatches(e,r_),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",En(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",En(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",En(r[s]));let o=r[s][2];if(!o_(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",En(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",En(r[s]))}return!0}function n_(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function s_(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,n_(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function ot(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function o_(e){return wa.isName(e)}function i_(e){return wa.isName(e)}function _t(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function En(e){return e.startIndex+e[1].length}});var Vh=rt(va=>{var Uh={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e}},a_=function(e){return Object.assign({},Uh,e)};va.buildOptions=a_;va.defaultOptions=Uh});var zh=rt((uR,Hh)=>{"use strict";var Ra=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};Hh.exports=Ra});var kh=rt((hR,qh)=>{var c_=eo();function l_(e,t){let r={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let n=1,s=!1,o=!1,i="";for(;t<e.length;t++)if(e[t]==="<"&&!o){if(s&&h_(e,t))t+=7,[entityName,val,t]=f_(e,t+1),val.indexOf("&")===-1&&(r[g_(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&d_(e,t))t+=8;else if(s&&p_(e,t))t+=8;else if(s&&m_(e,t))t+=9;else if(u_)o=!0;else throw new Error("Invalid DOCTYPE");n++,i=""}else if(e[t]===">"){if(o?e[t-1]==="-"&&e[t-2]==="-"&&(o=!1,n--):n--,n===0)break}else e[t]==="["?s=!0:i+=e[t];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}function f_(e,t){let r="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)r+=e[t];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=e[t++],s="";for(;t<e.length&&e[t]!==n;t++)s+=e[t];return[r,s,t]}function u_(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function h_(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function d_(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function p_(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function m_(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function g_(e){if(c_.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}qh.exports=l_});var jh=rt((dR,Jh)=>{var A_=/^[-+]?0x[a-fA-F0-9]+$/,x_=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var y_={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function T_(e,t={}){if(t=Object.assign({},y_,t),!e||typeof e!="string")return e;let r=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(t.hex&&A_.test(r))return Number.parseInt(r,16);{let n=x_.exec(r);if(n){let s=n[1],o=n[2],i=E_(n[3]),a=n[4]||n[6];if(!t.leadingZeros&&o.length>0&&s&&r[2]!==".")return e;if(!t.leadingZeros&&o.length>0&&!s&&r[1]!==".")return e;{let c=Number(r),l=""+c;return l.search(/[eE]/)!==-1||a?t.eNotation?c:e:r.indexOf(".")!==-1?l==="0"&&i===""||l===i||s&&l==="-"+i?c:e:o?i===l||s+i===l?c:e:r===l||r===s+l?c:e}}else return e}}function E_(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}Jh.exports=T_});var Yh=rt((pR,Wh)=>{"use strict";var Xh=eo(),_n=zh(),__=kh(),M_=jh(),Fa=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=b_,this.parseXml=w_,this.parseTextData=B_,this.resolveNameSpace=C_,this.buildAttributesMap=I_,this.isItStopNode=F_,this.replaceEntitiesValue=v_,this.readStopNodeData=O_,this.saveTextToParentTag=R_,this.addChild=L_}};function b_(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function B_(e,t,r,n,s,o,i){if(e!==void 0&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,r,s,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?Oa(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Oa(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function C_(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var S_=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function I_(e,t,r){if(!this.options.ignoreAttributes&&typeof e=="string"){let n=Xh.getAllMatches(e,S_),s=n.length,o={};for(let i=0;i<s;i++){let a=this.resolveNameSpace(n[i][1]),c=n[i][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);let f=this.options.attributeValueProcessor(a,c,t);f==null?o[l]=c:typeof f!=typeof c||f!==c?o[l]=f:o[l]=Oa(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[l]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let i={};return i[this.options.attributesGroupName]=o,i}return o}}var w_=function(e){e=e.replace(/\r\n?/g,`
|
|
10
|
+
`);let t=new _n("!xml"),r=t,n="",s="";for(let o=0;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="/"){let a=je(e,">",o,"Closing Tag is not closed."),c=e.substring(o+2,a).trim();if(this.options.removeNSPrefix){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&(n=this.saveTextToParentTag(n,r,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let f=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(f=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=s.lastIndexOf("."),s=s.substring(0,f),r=this.tagsNodeStack.pop(),n="",o=a}else if(e[o+1]==="?"){let a=Pa(e,o,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new _n(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(r,c,s)}o=a.closeIndex+1}else if(e.substr(o+1,3)==="!--"){let a=je(e,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){let c=e.substring(o+4,a-2);n=this.saveTextToParentTag(n,r,s),r.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}o=a}else if(e.substr(o+1,2)==="!D"){let a=__(e,o);this.docTypeEntities=a.entities,o=a.i}else if(e.substr(o+1,2)==="!["){let a=je(e,"]]>",o,"CDATA is not closed.")-2,c=e.substring(o+9,a);n=this.saveTextToParentTag(n,r,s);let l=this.parseTextData(c,r.tagname,s,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):r.add(this.options.textNodeName,l),o=a+2}else{let a=Pa(e,o,this.options.removeNSPrefix),c=a.tagName,l=a.rawTagName,f=a.tagExp,u=a.attrExpPresent,h=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,s,!1));let d=r;if(d&&this.options.unpairedTags.indexOf(d.tagname)!==-1&&(r=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let p="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),o=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)o=a.closeIndex;else{let m=this.readStopNodeData(e,l,h+1);if(!m)throw new Error(`Unexpected end of ${l}`);o=m.i,p=m.tagContent}let A=new _n(c);c!==f&&u&&(A[":@"]=this.buildAttributesMap(f,s,c)),p&&(p=this.parseTextData(p,c,s,!0,u,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),A.add(this.options.textNodeName,p),this.addChild(r,A,s)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let p=new _n(c);c!==f&&u&&(p[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(r,p,s),s=s.substr(0,s.lastIndexOf("."))}else{let p=new _n(c);this.tagsNodeStack.push(r),c!==f&&u&&(p[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(r,p,s),r=p}n="",o=h}}else n+=e[o];return t.child};function L_(e,t,r){let n=this.options.updateTag(t.tagname,r,t[":@"]);n===!1||(typeof n=="string"&&(t.tagname=n),e.addChild(t))}var v_=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let r=this.docTypeEntities[t];e=e.replace(r.regx,r.val)}for(let t in this.lastEntities){let r=this.lastEntities[t];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let r=this.htmlEntities[t];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function R_(e,t,r,n){return e&&(n===void 0&&(n=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function F_(e,t,r){let n="*."+r;for(let s in e){let o=e[s];if(n===o||t===o)return!0}return!1}function P_(e,t,r=">"){let n,s="";for(let o=t;o<e.length;o++){let i=e[o];if(n)i===n&&(n="");else if(i==='"'||i==="'")n=i;else if(i===r[0])if(r[1]){if(e[o+1]===r[1])return{data:s,index:o}}else return{data:s,index:o};else i===" "&&(i=" ");s+=i}}function je(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s+t.length-1}function Pa(e,t,r,n=">"){let s=P_(e,t+1,n);if(!s)return;let o=s.data,i=s.index,a=o.search(/\s/),c=o,l=!0;a!==-1&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());let f=c;if(r){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+1),l=c!==s.data.substr(u+1))}return{tagName:c,tagExp:o,closeIndex:i,attrExpPresent:l,rawTagName:f}}function O_(e,t,r){let n=r,s=1;for(;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){let o=je(e,">",r,`${t} is not closed`);if(e.substring(r+2,o).trim()===t&&(s--,s===0))return{tagContent:e.substring(n,r),i:o};r=o}else if(e[r+1]==="?")r=je(e,"?>",r+1,"StopNode is not closed.");else if(e.substr(r+1,3)==="!--")r=je(e,"-->",r+3,"StopNode is not closed.");else if(e.substr(r+1,2)==="![")r=je(e,"]]>",r,"StopNode is not closed.")-2;else{let o=Pa(e,r,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}function Oa(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:M_(e,r)}else return Xh.isExist(e)?e:""}Wh.exports=Fa});var Zh=rt(Qh=>{"use strict";function N_(e,t){return Kh(e,t)}function Kh(e,t,r){let n,s={};for(let o=0;o<e.length;o++){let i=e[o],a=D_(i),c="";if(r===void 0?c=a:c=r+"."+a,a===t.textNodeName)n===void 0?n=i[a]:n+=""+i[a];else{if(a===void 0)continue;if(i[a]){let l=Kh(i[a],t,c),f=U_(l,t);i[":@"]?G_(l,i[":@"],c,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):t.isArray(a,c,f)?s[a]=[l]:s[a]=l}}}return typeof n=="string"?n.length>0&&(s[t.textNodeName]=n):n!==void 0&&(s[t.textNodeName]=n),s}function D_(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function G_(e,t,r,n){if(t){let s=Object.keys(t),o=s.length;for(let i=0;i<o;i++){let a=s[i];n.isArray(a,r+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function U_(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}Qh.prettify=N_});var td=rt((gR,$h)=>{var{buildOptions:V_}=Vh(),H_=Yh(),{prettify:z_}=Zh(),q_=La(),Na=class{constructor(t){this.externalEntities={},this.options=V_(t)}parse(t,r){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let o=q_.validate(t,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new H_(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(t);return this.options.preserveOrder||s===void 0?s:z_(s,this.options)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}};$h.exports=Na});var od=rt((AR,sd)=>{var k_=`
|
|
11
|
+
`;function J_(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=k_),rd(e,t,"",r)}function rd(e,t,r,n){let s="",o=!1;for(let i=0;i<e.length;i++){let a=e[i],c=j_(a);if(c===void 0)continue;let l="";if(r.length===0?l=c:l=`${r}.${c}`,c===t.textNodeName){let p=a[c];X_(l,t)||(p=t.tagValueProcessor(c,p),p=nd(p,t)),o&&(s+=n),s+=p,o=!1;continue}else if(c===t.cdataPropName){o&&(s+=n),s+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,o=!1;continue}else if(c===t.commentPropName){s+=n+`<!--${a[c][0][t.textNodeName]}-->`,o=!0;continue}else if(c[0]==="?"){let p=ed(a[":@"],t),A=c==="?xml"?"":n,m=a[c][0][t.textNodeName];m=m.length!==0?" "+m:"",s+=A+`<${c}${m}${p}?>`,o=!0;continue}let f=n;f!==""&&(f+=t.indentBy);let u=ed(a[":@"],t),h=n+`<${c}${u}`,d=rd(a[c],t,l,f);t.unpairedTags.indexOf(c)!==-1?t.suppressUnpairedNode?s+=h+">":s+=h+"/>":(!d||d.length===0)&&t.suppressEmptyNode?s+=h+"/>":d&&d.endsWith(">")?s+=h+`>${d}${n}</${c}>`:(s+=h+">",d&&n!==""&&(d.includes("/>")||d.includes("</"))?s+=n+t.indentBy+d+n:s+=d,s+=`</${c}>`),o=!0}return s}function j_(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(e.hasOwnProperty(n)&&n!==":@")return n}}function ed(e,t){let r="";if(e&&!t.ignoreAttributes)for(let n in e){if(!e.hasOwnProperty(n))continue;let s=t.attributeValueProcessor(n,e[n]);s=nd(s,t),s===!0&&t.suppressBooleanAttributes?r+=` ${n.substr(t.attributeNamePrefix.length)}`:r+=` ${n.substr(t.attributeNamePrefix.length)}="${s}"`}return r}function X_(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let r=e.substr(e.lastIndexOf(".")+1);for(let n in t.stopNodes)if(t.stopNodes[n]===e||t.stopNodes[n]==="*."+r)return!0;return!1}function nd(e,t){if(e&&e.length>0&&t.processEntities)for(let r=0;r<t.entities.length;r++){let n=t.entities[r];e=e.replace(n.regex,n.val)}return e}sd.exports=J_});var ad=rt((xR,id)=>{"use strict";var W_=od(),Y_={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function be(e){this.options=Object.assign({},Y_,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Z_),this.processTextOrObjNode=K_,this.options.format?(this.indentate=Q_,this.tagEndChar=`>
|
|
12
12
|
`,this.newLine=`
|
|
13
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Me.prototype.build=function(e){return this.options.preserveOrder?W_(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};Me.prototype.j2x=function(e,t){let r="",n="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(n+="");else if(e[s]===null)this.isAttribute(s)?n+="":s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)n+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let o=this.isAttribute(s);if(o)r+=this.buildAttrPairStr(o,""+e[s]);else if(s===this.options.textNodeName){let i=this.options.tagValueProcessor(s,""+e[s]);n+=this.replaceEntitiesValue(i)}else n+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let o=e[s].length,i="",a="";for(let c=0;c<o;c++){let l=e[s][c];if(!(typeof l>"u"))if(l===null)s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let f=this.j2x(l,t+1);i+=f.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(a+=f.attrStr)}else i+=this.processTextOrObjNode(l,s,t);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(s,l);f=this.replaceEntitiesValue(f),i+=f}else i+=this.buildTextValNode(l,s,"",t)}this.options.oneListGroup&&(i=this.buildObjectNode(i,s,a,t)),n+=i}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let o=Object.keys(e[s]),i=o.length;for(let a=0;a<i;a++)r+=this.buildAttrPairStr(o[a],""+e[s][o[a]])}else n+=this.processTextOrObjNode(e[s],s,t);return{attrStr:r,val:n}};Me.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function K_(e,t,r){let n=this.j2x(e,r+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,n.attrStr,r):this.buildObjectNode(n.val,t,n.attrStr,r)}Me.prototype.buildObjectNode=function(e,t,r,n){if(e==="")return t[0]==="?"?this.indentate(n)+"<"+t+r+"?"+this.tagEndChar:this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",s=""),(r||r==="")&&e.indexOf("<")===-1?this.indentate(n)+"<"+t+r+o+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${e}-->`+this.newLine:this.indentate(n)+"<"+t+r+o+this.tagEndChar+e+this.indentate(n)+s}};Me.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};Me.prototype.buildTextValNode=function(e,t,r,n){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(n)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar:this.indentate(n)+"<"+t+r+">"+s+"</"+t+this.tagEndChar}};Me.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let r=this.options.entities[t];e=e.replace(r.regex,r.val)}return e};function Q_(e){return this.options.indentBy.repeat(e)}function Z_(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}nd.exports=Me});var id=rt((TR,od)=>{"use strict";var $_=wa(),tM=Qh(),eM=sd();od.exports={XMLParser:tM,XMLValidator:$_,XMLBuilder:eM}});var cc=rt(($d,Pn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof ff=="function"&&typeof Pn=="object"&&Pn&&Pn.exports?Pn.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})($d,function(){"use strict";function e(T,g,S){this.low=T|0,this.high=g|0,this.unsigned=!!S}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var r={},n={};function s(T,g){var S,R,F;return g?(T>>>=0,(F=0<=T&&T<256)&&(R=n[T],R)?R:(S=i(T,(T|0)<0?-1:0,!0),F&&(n[T]=S),S)):(T|=0,(F=-128<=T&&T<128)&&(R=r[T],R)?R:(S=i(T,T<0?-1:0,!1),F&&(r[T]=S),S))}e.fromInt=s;function o(T,g){if(isNaN(T)||!isFinite(T))return g?y:m;if(g){if(T<0)return y;if(T>=d)return C}else{if(T<=-p)return L;if(T+1>=p)return B}return T<0?o(-T,g).neg():i(T%h|0,T/h|0,g)}e.fromNumber=o;function i(T,g,S){return new e(T,g,S)}e.fromBits=i;var a=Math.pow;function c(T,g,S){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return m;if(typeof g=="number"?(S=g,g=!1):g=!!g,S=S||10,S<2||36<S)throw RangeError("radix");var R;if((R=T.indexOf("-"))>0)throw Error("interior hyphen");if(R===0)return c(T.substring(1),g,S).neg();for(var F=o(a(S,8)),v=m,G=0;G<T.length;G+=8){var X=Math.min(8,T.length-G),z=parseInt(T.substring(G,G+X),S);if(X<8){var et=o(a(S,X));v=v.mul(et).add(o(z))}else v=v.mul(F),v=v.add(o(z))}return v.unsigned=g,v}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?o(T):typeof T=="string"?c(T):i(T.low,T.high,T.unsigned)}e.fromValue=l;var f=1<<16,u=1<<24,h=f*f,d=h*h,p=d/2,A=s(u),m=s(0);e.ZERO=m;var y=s(0,!0);e.UZERO=y;var _=s(1);e.ONE=_;var E=s(1,!0);e.UONE=E;var M=s(-1);e.NEG_ONE=M;var B=i(-1,2147483647,!1);e.MAX_VALUE=B;var C=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=C;var L=i(0,-2147483648,!1);e.MIN_VALUE=L;var b=e.prototype;return b.toInt=function(){return this.unsigned?this.low>>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},b.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var S=o(g),R=this.div(S),F=R.mul(S).sub(this);return R.toString(g)+F.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var v=o(a(g,6),this.unsigned),G=this,X="";;){var z=G.div(v),et=G.sub(z.mul(v)).toInt()>>>0,K=et.toString(g);if(G=z,G.isZero())return K+X;for(;K.length<6;)K="0"+K;X=""+K+X}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,S=31;S>0&&!(g&1<<S);S--);return this.high!=0?S+33:S+1},b.isZero=function(){return this.high===0&&this.low===0},b.isNegative=function(){return!this.unsigned&&this.high<0},b.isPositive=function(){return this.unsigned||this.high>=0},b.isOdd=function(){return(this.low&1)===1},b.isEven=function(){return(this.low&1)===0},b.equals=function(g){return t(g)||(g=l(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},b.eq=b.equals,b.notEquals=function(g){return!this.eq(g)},b.neq=b.notEquals,b.lessThan=function(g){return this.comp(g)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(g){return this.comp(g)<=0},b.lte=b.lessThanOrEqual,b.greaterThan=function(g){return this.comp(g)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(g){return this.comp(g)>=0},b.gte=b.greaterThanOrEqual,b.compare=function(g){if(t(g)||(g=l(g)),this.eq(g))return 0;var S=this.isNegative(),R=g.isNegative();return S&&!R?-1:!S&&R?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(_)},b.neg=b.negate,b.add=function(g){t(g)||(g=l(g));var S=this.high>>>16,R=this.high&65535,F=this.low>>>16,v=this.low&65535,G=g.high>>>16,X=g.high&65535,z=g.low>>>16,et=g.low&65535,K=0,Y=0,$=0,bt=0;return bt+=v+et,$+=bt>>>16,bt&=65535,$+=F+z,Y+=$>>>16,$&=65535,Y+=R+X,K+=Y>>>16,Y&=65535,K+=S+G,K&=65535,i($<<16|bt,K<<16|Y,this.unsigned)},b.subtract=function(g){return t(g)||(g=l(g)),this.add(g.neg())},b.sub=b.subtract,b.multiply=function(g){if(this.isZero()||(t(g)||(g=l(g)),g.isZero()))return m;if(this.eq(L))return g.isOdd()?L:m;if(g.eq(L))return this.isOdd()?L:m;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(A)&&g.lt(A))return o(this.toNumber()*g.toNumber(),this.unsigned);var S=this.high>>>16,R=this.high&65535,F=this.low>>>16,v=this.low&65535,G=g.high>>>16,X=g.high&65535,z=g.low>>>16,et=g.low&65535,K=0,Y=0,$=0,bt=0;return bt+=v*et,$+=bt>>>16,bt&=65535,$+=F*et,Y+=$>>>16,$&=65535,$+=v*z,Y+=$>>>16,$&=65535,Y+=R*et,K+=Y>>>16,Y&=65535,Y+=F*z,K+=Y>>>16,Y&=65535,Y+=v*X,K+=Y>>>16,Y&=65535,K+=S*et+R*z+F*X+v*G,K&=65535,i($<<16|bt,K<<16|Y,this.unsigned)},b.mul=b.multiply,b.divide=function(g){if(t(g)||(g=l(g)),g.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:m;var S,R,F;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return y;if(g.gt(this.shru(1)))return E;F=y}else{if(this.eq(L)){if(g.eq(_)||g.eq(M))return L;if(g.eq(L))return _;var v=this.shr(1);return S=v.div(g).shl(1),S.eq(m)?g.isNegative()?_:M:(R=this.sub(g.mul(S)),F=S.add(R.div(g)),F)}else if(g.eq(L))return this.unsigned?y:m;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();F=m}for(R=this;R.gte(g);){S=Math.max(1,Math.floor(R.toNumber()/g.toNumber()));for(var G=Math.ceil(Math.log(S)/Math.LN2),X=G<=48?1:a(2,G-48),z=o(S),et=z.mul(g);et.isNegative()||et.gt(R);)S-=X,z=o(S,this.unsigned),et=z.mul(g);z.isZero()&&(z=_),F=F.add(z),R=R.sub(et)}return F},b.div=b.divide,b.modulo=function(g){return t(g)||(g=l(g)),this.sub(this.div(g).mul(g))},b.mod=b.modulo,b.not=function(){return i(~this.low,~this.high,this.unsigned)},b.and=function(g){return t(g)||(g=l(g)),i(this.low&g.low,this.high&g.high,this.unsigned)},b.or=function(g){return t(g)||(g=l(g)),i(this.low|g.low,this.high|g.high,this.unsigned)},b.xor=function(g){return t(g)||(g=l(g)),i(this.low^g.low,this.high^g.high,this.unsigned)},b.shiftLeft=function(g){return t(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):i(0,this.low<<g-32,this.unsigned)},b.shl=b.shiftLeft,b.shiftRight=function(g){return t(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):i(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(g){if(t(g)&&(g=g.toInt()),g&=63,g===0)return this;var S=this.high;if(g<32){var R=this.low;return i(R>>>g|S<<32-g,S>>>g,this.unsigned)}else return g===32?i(S,0,this.unsigned):i(S>>>g-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},b.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var T=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},b.toBytesBE=function(){var T=this.high,g=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255]},e})});var Tc=rt((BG,Dp)=>{Dp.exports=globalThis.luma});var Bo=rt((CG,Gp)=>{Gp.exports=globalThis.deck});var Ec=rt((SG,Up)=>{Up.exports=globalThis.luma});var Or=rt((nU,nm)=>{nm.exports=globalThis.loaders});var L0=rt((_z,w0)=>{w0.exports=globalThis.deck});var V0=rt(Ql=>{Ql.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,f=-7,u=r?s-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=n;f>0;i=i*256+e[t+u],u+=h,f-=8);if(o===0)o=1-l;else{if(o===c)return i?NaN:(d?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-l}return(d?-1:1)*i*Math.pow(2,o-n)};Ql.write=function(e,t,r,n,s,o){var i,a,c,l=o*8-s-1,f=(1<<l)-1,u=f>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=f):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+u>=1?t+=h/c:t+=h*Math.pow(2,1-u),t*c>=2&&(i++,c/=2),i+u>=f?(a=0,i=f):i+u>=1?(a=(t*c-1)*Math.pow(2,s),i=i+u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),i=0));s>=8;e[r+d]=a&255,d+=p,a/=256,s-=8);for(i=i<<s|a,l+=s;l>0;e[r+d]=i&255,d+=p,i/=256,l-=8);e[r+d-p]|=A*128}});var j0=rt((l5,J0)=>{"use strict";J0.exports=j;var bi=V0();function j(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}j.Varint=0;j.Fixed64=1;j.Bytes=2;j.Fixed32=5;var Zl=(1<<16)*(1<<16),H0=1/Zl,h3=12,k0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");j.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,o=this.pos;this.type=n&7,e(s,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Bi(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=q0(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Bi(this.buf,this.pos)+Bi(this.buf,this.pos+4)*Zl;return this.pos+=8,e},readSFixed64:function(){var e=Bi(this.buf,this.pos)+q0(this.buf,this.pos+4)*Zl;return this.pos+=8,e},readFloat:function(){var e=bi.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=bi.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,d3(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=h3&&k0?S3(this.buf,t,e):C3(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==j.Bytes)return e.push(this.readVarint(t));var r=Ae(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==j.Bytes)return e.push(this.readSVarint());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==j.Bytes)return e.push(this.readBoolean());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==j.Bytes)return e.push(this.readFloat());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==j.Bytes)return e.push(this.readDouble());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==j.Bytes)return e.push(this.readFixed32());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==j.Bytes)return e.push(this.readSFixed32());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==j.Bytes)return e.push(this.readFixed64());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==j.Bytes)return e.push(this.readSFixed64());var t=Ae(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===j.Varint)for(;this.buf[this.pos++]>127;);else if(t===j.Bytes)this.pos=this.readVarint()+this.pos;else if(t===j.Fixed32)this.pos+=4;else if(t===j.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),rn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),rn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),rn(this.buf,e&-1,this.pos),rn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),rn(this.buf,e&-1,this.pos),rn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){p3(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=I3(this.buf,e,this.pos);var r=this.pos-t;r>=128&&z0(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),bi.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),bi.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&z0(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,j.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,A3,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,x3,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,E3,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,y3,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,T3,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,_3,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,M3,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,b3,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,B3,t)},writeBytesField:function(e,t){this.writeTag(e,j.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,j.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,j.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,j.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,j.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,j.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,j.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,j.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,j.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,j.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function d3(e,t,r){var n=r.buf,s,o;if(o=n[r.pos++],s=(o&112)>>4,o<128||(o=n[r.pos++],s|=(o&127)<<3,o<128)||(o=n[r.pos++],s|=(o&127)<<10,o<128)||(o=n[r.pos++],s|=(o&127)<<17,o<128)||(o=n[r.pos++],s|=(o&127)<<24,o<128)||(o=n[r.pos++],s|=(o&1)<<31,o<128))return en(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function Ae(e){return e.type===j.Bytes?e.readVarint()+e.pos:e.pos+1}function en(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function p3(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),m3(r,n,t),g3(n,t)}function m3(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function g3(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function z0(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var s=r.pos-1;s>=e;s--)r.buf[s+n]=r.buf[s]}function A3(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function x3(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function y3(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function T3(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function E3(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function _3(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function M3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function b3(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function B3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Bi(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function rn(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function q0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function C3(e,t,r){for(var n="",s=t;s<r;){var o=e[s],i=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>r)break;var c,l,f;a===1?o<128&&(i=o):a===2?(c=e[s+1],(c&192)===128&&(i=(o&31)<<6|c&63,i<=127&&(i=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(i=(o&15)<<12|(c&63)<<6|l&63,(i<=2047||i>=55296&&i<=57343)&&(i=null))):a===4&&(c=e[s+1],l=e[s+2],f=e[s+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&63,(i<=65535||i>=1114112)&&(i=null))),i===null?(i=65533,a=1):i>65535&&(i-=65536,n+=String.fromCharCode(i>>>10&1023|55296),i=56320|i&1023),n+=String.fromCharCode(i),s+=a}return n}function S3(e,t,r){return k0.decode(e.subarray(t,r))}function I3(e,t,r){for(var n=0,s,o;n<t.length;n++){if(s=t.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=s;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);s<128?e[r++]=s:(s<2048?e[r++]=s>>6|192:(s<65536?e[r++]=s>>12|224:(e[r++]=s>>18|240,e[r++]=s>>12&63|128),e[r++]=s>>6&63|128),e[r++]=s&63|128)}return r}});var xs={};pt(xs,{A5Layer:()=>Ih,GeohashLayer:()=>h1,GreatCircleLayer:()=>Zd,H3ClusterLayer:()=>Np,H3HexagonLayer:()=>bo,MVTLayer:()=>c1,QuadkeyLayer:()=>hp,S2Layer:()=>fp,TerrainLayer:()=>I0,Tile3DLayer:()=>T0,TileLayer:()=>nr,TripsLayer:()=>Fp,_GeoCellLayer:()=>Ft,_Tile2DHeader:()=>er,_Tileset2D:()=>rr,_WMSLayer:()=>Fr,_getURLFromTemplate:()=>oe});var Qt={},hf=D(zt(),1);xe(Qt,D(zt(),1));if(!hf.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");xe(xs,Qt);var pf=D(qt(),1),wi=D(zt(),1),T1={...wi.PolygonLayer.defaultProps},on=class extends pf.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:r,wireframe:n,filled:s,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m}=this.props,{updateTriggers:y,material:_,transitions:E}=this.props,M=this.getSubLayerClass("cell",wi.PolygonLayer),{updateTriggers:B,...C}=this.indexToBounds()||{};return new M({filled:s,wireframe:n,extruded:r,elevationScale:t,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,material:_,transitions:E,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...B,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),C)}};on.layerName="GeoCellLayer";on.defaultProps=T1;var Ft=on;var E1=Object.defineProperty,fn=(e,t)=>{for(var r in t)E1(e,r,{get:t[r],enumerable:!0})},Tt={};fn(Tt,{ARRAY_TYPE:()=>st,EPSILON:()=>dt,RANDOM:()=>Ue,equals:()=>B1,setMatrixArrayType:()=>_1,toRadian:()=>b1});var dt=1e-6,st=typeof Float32Array<"u"?Float32Array:Array,Ue=Math.random;function _1(e){st=e}var M1=Math.PI/180;function b1(e){return e*M1}function B1(e,t){return Math.abs(e-t)<=dt*Math.max(1,Math.abs(e),Math.abs(t))}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ve={};fn(Ve,{LDU:()=>z1,add:()=>q1,adjoint:()=>P1,clone:()=>S1,copy:()=>I1,create:()=>C1,determinant:()=>O1,equals:()=>J1,exactEquals:()=>k1,frob:()=>H1,fromRotation:()=>G1,fromScaling:()=>U1,fromValues:()=>L1,identity:()=>w1,invert:()=>F1,mul:()=>W1,multiply:()=>Nf,multiplyScalar:()=>j1,multiplyScalarAndAdd:()=>X1,rotate:()=>N1,scale:()=>D1,set:()=>v1,str:()=>V1,sub:()=>Y1,subtract:()=>Df,transpose:()=>R1});function C1(){var e=new st(4);return st!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function S1(e){var t=new st(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function I1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function w1(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function L1(e,t,r,n){var s=new st(4);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function v1(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function R1(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function F1(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*o-s*n;return i?(i=1/i,e[0]=o*i,e[1]=-n*i,e[2]=-s*i,e[3]=r*i,e):null}function P1(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function O1(e){return e[0]*e[3]-e[2]*e[1]}function Nf(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*a+o*c,e[1]=s*a+i*c,e[2]=n*l+o*f,e[3]=s*l+i*f,e}function N1(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+o*a,e[1]=s*c+i*a,e[2]=n*-a+o*c,e[3]=s*-a+i*c,e}function D1(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1];return e[0]=n*a,e[1]=s*a,e[2]=o*c,e[3]=i*c,e}function G1(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=-r,e[3]=n,e}function U1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function V1(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function H1(e){return Math.hypot(e[0],e[1],e[2],e[3])}function z1(e,t,r,n){return e[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-e[2]*r[1],[e,t,r]}function q1(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}function Df(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}function k1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function J1(e,t){var r=e[0],n=e[1],s=e[2],o=e[3],i=t[0],a=t[1],c=t[2],l=t[3];return Math.abs(r-i)<=dt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=dt*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=dt*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=dt*Math.max(1,Math.abs(o),Math.abs(l))}function j1(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}function X1(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e}var W1=Nf,Y1=Df;function K1(){var e=new st(9);return st!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}var Fi={};fn(Fi,{add:()=>lx,calculateW:()=>ZA,clone:()=>ox,conjugate:()=>rx,copy:()=>ax,create:()=>Oi,dot:()=>$f,equals:()=>mx,exactEquals:()=>px,exp:()=>Yf,fromEuler:()=>nx,fromMat3:()=>Qf,fromValues:()=>ix,getAngle:()=>WA,getAxisAngle:()=>XA,identity:()=>jA,invert:()=>ex,len:()=>hx,length:()=>tu,lerp:()=>ux,ln:()=>Kf,mul:()=>fx,multiply:()=>Wf,normalize:()=>ki,pow:()=>$A,random:()=>tx,rotateX:()=>YA,rotateY:()=>KA,rotateZ:()=>QA,rotationTo:()=>gx,scale:()=>Zf,set:()=>cx,setAxes:()=>xx,setAxisAngle:()=>Xf,slerp:()=>ws,sqlerp:()=>Ax,sqrLen:()=>dx,squaredLength:()=>eu,str:()=>sx});var w={};fn(w,{add:()=>tA,angle:()=>TA,bezier:()=>hA,ceil:()=>eA,clone:()=>Q1,copy:()=>Z1,create:()=>zi,cross:()=>Is,dist:()=>IA,distance:()=>zf,div:()=>SA,divide:()=>Hf,dot:()=>qi,equals:()=>bA,exactEquals:()=>MA,floor:()=>rA,forEach:()=>vA,fromValues:()=>Pi,hermite:()=>uA,inverse:()=>lA,len:()=>jf,length:()=>Gf,lerp:()=>fA,max:()=>sA,min:()=>nA,mul:()=>CA,multiply:()=>Vf,negate:()=>cA,normalize:()=>Jf,random:()=>dA,rotateX:()=>AA,rotateY:()=>xA,rotateZ:()=>yA,round:()=>oA,scale:()=>iA,scaleAndAdd:()=>aA,set:()=>$1,sqrDist:()=>wA,sqrLen:()=>LA,squaredDistance:()=>qf,squaredLength:()=>kf,str:()=>_A,sub:()=>BA,subtract:()=>Uf,transformMat3:()=>mA,transformMat4:()=>pA,transformQuat:()=>gA,zero:()=>EA});function zi(){var e=new st(3);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Q1(e){var t=new st(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Gf(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function Pi(e,t,r){var n=new st(3);return n[0]=e,n[1]=t,n[2]=r,n}function Z1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function $1(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function tA(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Uf(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Vf(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Hf(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function eA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function rA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function nA(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function sA(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function oA(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function iA(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function aA(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function zf(e,t){var r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.hypot(r,n,s)}function qf(e,t){var r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function kf(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function cA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function lA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Jf(e,t){var r=t[0],n=t[1],s=t[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function qi(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Is(e,t,r){var n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2];return e[0]=s*c-o*a,e[1]=o*i-n*c,e[2]=n*a-s*i,e}function fA(e,t,r,n){var s=t[0],o=t[1],i=t[2];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e}function uA(e,t,r,n,s,o){var i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*f,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*f,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*f,e}function hA(e,t,r,n,s,o){var i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*f+n[0]*u+s[0]*h,e[1]=t[1]*l+r[1]*f+n[1]*u+s[1]*h,e[2]=t[2]*l+r[2]*f+n[2]*u+s[2]*h,e}function dA(e,t){t=t||1;var r=Ue()*2*Math.PI,n=Ue()*2-1,s=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*s,e[1]=Math.sin(r)*s,e[2]=n*t,e}function pA(e,t,r){var n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,e[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,e[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,e[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,e}function mA(e,t,r){var n=t[0],s=t[1],o=t[2];return e[0]=n*r[0]+s*r[3]+o*r[6],e[1]=n*r[1]+s*r[4]+o*r[7],e[2]=n*r[2]+s*r[5]+o*r[8],e}function gA(e,t,r){var n=r[0],s=r[1],o=r[2],i=r[3],a=t[0],c=t[1],l=t[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,e[0]=a+f+d,e[1]=c+u+p,e[2]=l+h+A,e}function AA(e,t,r,n){var s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0],o[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),o[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function xA(e,t,r,n){var s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),o[1]=s[1],o[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function yA(e,t,r,n){var s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),o[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),o[2]=s[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function TA(e,t){var r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2],c=Math.sqrt(r*r+n*n+s*s),l=Math.sqrt(o*o+i*i+a*a),f=c*l,u=f&&qi(e,t)/f;return Math.acos(Math.min(Math.max(u,-1),1))}function EA(e){return e[0]=0,e[1]=0,e[2]=0,e}function _A(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function MA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function bA(e,t){var r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2];return Math.abs(r-o)<=dt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=dt*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=dt*Math.max(1,Math.abs(s),Math.abs(a))}var BA=Uf,CA=Vf,SA=Hf,IA=zf,wA=qf,jf=Gf,LA=kf,vA=function(){var e=zi();return function(t,r,n,s,o,i){var a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();function RA(){var e=new st(4);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function FA(e){var t=new st(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function PA(e,t,r,n){var s=new st(4);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function OA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function NA(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function DA(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}function GA(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}function UA(e){var t=e[0],r=e[1],n=e[2],s=e[3];return Math.hypot(t,r,n,s)}function VA(e){var t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function HA(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=r*i,e[1]=n*i,e[2]=s*i,e[3]=o*i,e}function zA(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function qA(e,t,r,n){var s=t[0],o=t[1],i=t[2],a=t[3];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e[3]=a+n*(r[3]-a),e}function kA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function JA(e,t){var r=e[0],n=e[1],s=e[2],o=e[3],i=t[0],a=t[1],c=t[2],l=t[3];return Math.abs(r-i)<=dt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=dt*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=dt*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=dt*Math.max(1,Math.abs(o),Math.abs(l))}var aL=function(){var e=RA();return function(t,r,n,s,o,i){var a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();function Oi(){var e=new st(4);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function jA(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Xf(e,t,r){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 XA(e,t){var r=Math.acos(t[3])*2,n=Math.sin(r/2);return n>dt?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r}function WA(e,t){var r=$f(e,t);return Math.acos(2*r*r-1)}function Wf(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*f+i*a+s*l-o*c,e[1]=s*f+i*c+o*a-n*l,e[2]=o*f+i*l+n*c-s*a,e[3]=i*f-n*a-s*c-o*l,e}function YA(e,t,r){r*=.5;var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=s*c+o*a,e[2]=o*c-s*a,e[3]=i*c-n*a,e}function KA(e,t,r){r*=.5;var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=s*c+i*a,e[2]=o*c+n*a,e[3]=i*c-s*a,e}function QA(e,t,r){r*=.5;var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=s*c-n*a,e[2]=o*c+i*a,e[3]=i*c-o*a,e}function ZA(e,t){var r=t[0],n=t[1],s=t[2];return e[0]=r,e[1]=n,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),e}function Yf(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=Math.sqrt(r*r+n*n+s*s),a=Math.exp(o),c=i>0?a*Math.sin(i)/i:0;return e[0]=r*c,e[1]=n*c,e[2]=s*c,e[3]=a*Math.cos(i),e}function Kf(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=Math.sqrt(r*r+n*n+s*s),a=i>0?Math.atan2(i,o)/i:0;return e[0]=r*a,e[1]=n*a,e[2]=s*a,e[3]=.5*Math.log(r*r+n*n+s*s+o*o),e}function $A(e,t,r){return Kf(e,t),Zf(e,e,r),Yf(e,e),e}function ws(e,t,r,n){var s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return d=s*c+o*l+i*f+a*u,d<0&&(d=-d,c=-c,l=-l,f=-f,u=-u),1-d>dt?(h=Math.acos(d),p=Math.sin(h),A=Math.sin((1-n)*h)/p,m=Math.sin(n*h)/p):(A=1-n,m=n),e[0]=A*s+m*c,e[1]=A*o+m*l,e[2]=A*i+m*f,e[3]=A*a+m*u,e}function tx(e){var t=Ue(),r=Ue(),n=Ue(),s=Math.sqrt(1-t),o=Math.sqrt(t);return e[0]=s*Math.sin(2*Math.PI*r),e[1]=s*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*n),e[3]=o*Math.cos(2*Math.PI*n),e}function ex(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=o*a,e}function rx(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Qf(e,t){var r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*n,n=.5/n,e[3]=(t[o*3+i]-t[i*3+o])*n,e[o]=(t[o*3+s]+t[s*3+o])*n,e[i]=(t[i*3+s]+t[s*3+i])*n}return e}function nx(e,t,r,n){var s=.5*Math.PI/180;t*=s,r*=s,n*=s;var o=Math.sin(t),i=Math.cos(t),a=Math.sin(r),c=Math.cos(r),l=Math.sin(n),f=Math.cos(n);return e[0]=o*c*f-i*a*l,e[1]=i*a*f+o*c*l,e[2]=i*c*l-o*a*f,e[3]=i*c*f+o*a*l,e}function sx(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var ox=FA,ix=PA,ax=OA,cx=NA,lx=DA,fx=Wf,Zf=GA,$f=zA,ux=qA,tu=UA,hx=tu,eu=VA,dx=eu,ki=HA,px=kA,mx=JA,gx=function(){var e=zi(),t=Pi(1,0,0),r=Pi(0,1,0);return function(n,s,o){var i=qi(s,o);return i<-.999999?(Is(e,t,s),jf(e)<1e-6&&Is(e,r,s),Jf(e,e),Xf(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Is(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,ki(n,n))}}(),Ax=function(){var e=Oi(),t=Oi();return function(r,n,s,o,i,a){return ws(e,n,i,a),ws(t,s,o,a),ws(r,e,t,2*a*(1-a)),r}}(),xx=function(){var e=K1();return function(t,r,n,s){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],ki(t,Qf(t,e))}}(),P={};fn(P,{add:()=>Mx,angle:()=>qx,ceil:()=>bx,clone:()=>yx,copy:()=>Ex,create:()=>ru,cross:()=>Ox,dist:()=>Zx,distance:()=>iu,div:()=>Qx,divide:()=>ou,dot:()=>Px,equals:()=>Xx,exactEquals:()=>jx,floor:()=>Bx,forEach:()=>ey,fromValues:()=>Tx,inverse:()=>Rx,len:()=>Wx,length:()=>cu,lerp:()=>Nx,max:()=>Sx,min:()=>Cx,mul:()=>Kx,multiply:()=>su,negate:()=>vx,normalize:()=>Fx,random:()=>Dx,rotate:()=>zx,round:()=>Ix,scale:()=>wx,scaleAndAdd:()=>Lx,set:()=>_x,sqrDist:()=>$x,sqrLen:()=>ty,squaredDistance:()=>au,squaredLength:()=>lu,str:()=>Jx,sub:()=>Yx,subtract:()=>nu,transformMat2:()=>Gx,transformMat2d:()=>Ux,transformMat3:()=>Vx,transformMat4:()=>Hx,zero:()=>kx});function ru(){var e=new st(2);return st!=Float32Array&&(e[0]=0,e[1]=0),e}function yx(e){var t=new st(2);return t[0]=e[0],t[1]=e[1],t}function Tx(e,t){var r=new st(2);return r[0]=e,r[1]=t,r}function Ex(e,t){return e[0]=t[0],e[1]=t[1],e}function _x(e,t,r){return e[0]=t,e[1]=r,e}function Mx(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function nu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function su(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function ou(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function bx(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function Bx(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function Cx(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function Sx(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function Ix(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function wx(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Lx(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e}function iu(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.hypot(r,n)}function au(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function cu(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function lu(e){var t=e[0],r=e[1];return t*t+r*r}function vx(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Rx(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function Fx(e,t){var r=t[0],n=t[1],s=r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function Px(e,t){return e[0]*t[0]+e[1]*t[1]}function Ox(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e}function Nx(e,t,r,n){var s=t[0],o=t[1];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e}function Dx(e,t){t=t||1;var r=Ue()*2*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function Gx(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e}function Ux(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s+r[4],e[1]=r[1]*n+r[3]*s+r[5],e}function Vx(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[3]*s+r[6],e[1]=r[1]*n+r[4]*s+r[7],e}function Hx(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}function zx(e,t,r,n){var s=t[0]-r[0],o=t[1]-r[1],i=Math.sin(n),a=Math.cos(n);return e[0]=s*a-o*i+r[0],e[1]=s*i+o*a+r[1],e}function qx(e,t){var r=e[0],n=e[1],s=t[0],o=t[1],i=Math.sqrt(r*r+n*n)*Math.sqrt(s*s+o*o),a=i&&(r*s+n*o)/i;return Math.acos(Math.min(Math.max(a,-1),1))}function kx(e){return e[0]=0,e[1]=0,e}function Jx(e){return"vec2("+e[0]+", "+e[1]+")"}function jx(e,t){return e[0]===t[0]&&e[1]===t[1]}function Xx(e,t){var r=e[0],n=e[1],s=t[0],o=t[1];return Math.abs(r-s)<=dt*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-o)<=dt*Math.max(1,Math.abs(n),Math.abs(o))}var Wx=cu,Yx=nu,Kx=su,Qx=ou,Zx=iu,$x=au,ty=lu,ey=function(){var e=ru();return function(t,r,n,s,o,i){var a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],o(e,e,i),t[a]=e[0],t[a+1]=e[1];return t}}(),Fs=(1+Math.sqrt(5))/2,cL=2*Math.PI,Ls=2*Math.PI/5,Zt=Math.PI/5,mf=Math.PI/10,ry=2*Math.atan(Fs),Ni=Math.PI-ry,lL=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-Fs)),Ps=(Math.sqrt(5)-1)/2,ny=3-Math.sqrt(5),sy=Math.sqrt(3-Fs),fL=Math.sqrt(3)*sy/Fs;Tt.setMatrixArrayType(Float64Array);var Ji=class Di{constructor(t){this.vertices=t,this.isWindingCorrect()||this.vertices.reverse()}getArea(){let t=0,r=this.vertices.length;for(let n=0;n<r;n++){let s=(n+1)%r;t+=(this.vertices[s][0]-this.vertices[n][0])*(this.vertices[s][1]+this.vertices[n][1])}return t}isWindingCorrect(){return this.getArea()>=0}getVertices(){return this.vertices}scale(t){for(let r of this.vertices)P.scale(r,r,t);return this}rotate180(){for(let t of this.vertices)P.negate(t,t);return this}reflectY(){for(let t of this.vertices)t[1]=-t[1];return this.vertices.reverse(),this}translate(t){for(let r of this.vertices)P.add(r,r,t);return this}transform(t){for(let r of this.vertices)P.transformMat2(r,r,t);return this}transform2d(t){for(let r of this.vertices)P.transformMat2d(r,r,t);return this}clone(){return new Di(this.vertices.map(r=>P.clone(r)))}getCenter(){let t=this.vertices.length;return this.vertices.reduce((n,s)=>[n[0]+s[0]/t,n[1]+s[1]/t],[0,0])}containsPoint(t){if(!this.isWindingCorrect())throw new Error("Pentagon is not counter-clockwise");let r=this.vertices.length,n=1;for(let s=0;s<r;s++){let o=this.vertices[s],i=this.vertices[(s+1)%r],a=o[0]-i[0],c=o[1]-i[1],l=t[0]-o[0],f=t[1]-o[1],u=a*f-c*l;if(u<0){let h=Math.sqrt(l*l+f*f);n=Math.min(n,u/h)}}return n}splitEdges(t){if(t<=1)return this;let r=[],n=this.vertices.length;for(let s=0;s<n;s++){let o=this.vertices[s],i=this.vertices[(s+1)%n];r.push(P.clone(o));for(let a=1;a<t;a++){let c=a/t,l=P.create();P.lerp(l,o,i,c),r.push(l)}}return new Di(r)}};Tt.setMatrixArrayType(Float64Array);var fu=[0,0],uu=[0,1],He=[.7885966681787006,1.6149108024237764],hu=[1.6171013659387945,1.054928690397459],du=[Math.cos(mf),Math.sin(mf)],oy=2*P.length(He)*Math.cos(Zt),iy=Zt-Math.atan2(He[1],He[0]),ay=2*Ps/oy;[fu,uu,He,hu,du].forEach(e=>{P.scale(e,e,ay),P.rotate(e,e,[0,0],iy)});var cy=new Ji([fu,uu,He,hu,du]),pu=Math.atan2(He[1],He[0])-Zt,ly=[0,0],vs=Ps/Math.cos(Zt),gf=pu+Zt,Rs=[vs*Math.cos(gf),vs*Math.sin(gf)],Af=pu-Zt,ln=[vs*Math.cos(Af),vs*Math.sin(Af)],mu=new Ji([ly,Rs,ln]),gu=Ve.fromValues(Rs[0],Rs[1],ln[0],ln[1]),uL=Ve.invert(Ve.create(),gu),fy=new Float64Array([-.0022392098386786394,21308606513250217e-22,-2559257686421274e-24,33701965267802837e-28,-4667545312611249e-30,667492870384816e-32]),uy=new Float64Array([.0022392089963541657,28831978048607556e-22,508622073997266e-23,102018123778161e-25,21912872306767718e-30,49284235482523806e-33]),hy=class{applyCoefficients(e,t){let r=Math.sin(e),n=Math.cos(e),s=2*(n-r)*(n+r),o,i;return o=s*t[5]+t[4],i=s*o+t[3],o=s*i-o+t[2],i=s*o-i+t[1],o=s*i-o+t[0],e+2*r*n*o}forward(e){return this.applyCoefficients(e,fy)}inverse(e){return this.applyCoefficients(e,uy)}};Tt.setMatrixArrayType(Float64Array);var Au=new hy;function xf(e){return e*(Math.PI/180)}function yf(e){return e*(180/Math.PI)}function Tf(e){let t=P.length(e),r=Math.atan2(e[1],e[0]);return[t,r]}function dy([e,t]){let r=e*Math.cos(t),n=e*Math.sin(t);return[r,n]}function py(e,[t,r,n]){let s=[t[0]-n[0],t[1]-n[1]],o=[n[0]-r[0],n[1]-r[1]],i=[e[0]-n[0],e[1]-n[1]],a=o[0]*s[1]-o[1]*s[0],c=(o[0]*i[1]-o[1]*i[0])/a,l=(s[0]*i[1]-s[1]*i[0])/a,f=1-(c+l);return[c,l,f]}function my(e,[t,r,n]){return[e[0]*t[0]+e[1]*r[0]+e[2]*n[0],e[0]*t[1]+e[1]*r[1]+e[2]*n[1]]}function Gi(e){let t=Math.atan2(e[1],e[0]),r=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),n=Math.acos(e[2]/r);return[t,n]}function _r([e,t]){let r=Math.sin(t),n=r*Math.cos(e),s=r*Math.sin(e),o=Math.cos(t);return[n,s,o]}var xu=93;function gy([e,t]){let r=xf(e+xu),n=xf(t),s=Au.forward(n),o=Math.PI/2-s;return[r,o]}function yu([e,t]){let r=yf(e)-xu,n=Math.PI/2-t,s=Au.inverse(n),o=yf(s);return[r,o]}function Ay(e){let t=e.map(o=>_r(gy(o))),r=w.create();for(let o of t)w.add(r,r,o);w.normalize(r,r);let[n,s]=yu(Gi(r));return(s>89.99||s<-89.99)&&(n=e[0][0]),n=((n+180)%360+360)%360-180,e.map(o=>{let[i,a]=o;for(;i-n>180;)i=i-360;for(;i-n<-180;)i=i+360;return[i,a]})}Tt.setMatrixArrayType(Float64Array);var Os=Math.sqrt(5),Ns=Math.sqrt(.2),Tu=Math.sqrt((1-Ns)/2),Eu=Math.sqrt((1+Ns)/2),Ts=.5,Ef=Math.sqrt((2.5-Os)/10),_f=Math.sqrt((2.5+Os)/10),Mf=Math.sqrt((1+Ns)/8),bf=Math.sqrt((1-Ns)/8),Bf=Math.sqrt((3-Os)/8),Cf=Math.sqrt((3+Os)/8),xy=[[0,0],[Tu,0],[Ef,Ts],[-Mf,Bf],[-Mf,-Bf],[Ef,-Ts],[-Eu,0],[-bf,-Cf],[_f,-Ts],[_f,Ts],[-bf,Cf],[0,0]],yy=xy.map(([e,t])=>[-t,e]),Es=yy.map((e,t)=>t===0?[0,0,0,1]:t===11?[0,-1,0,0]:[...e,0,t<6?Eu:Tu]);Tt.setMatrixArrayType(Float64Array);var _u=["vu","uw","vw","vw","vw"],an=["wu","uw","vw","vu","uw"],Li=["wu","uv","wv","wu","uw"],_s=["vu","uv","wv","wu","uw"],Ty=[_u,_s,Li,an,Li,_s,Li,an,an,an,_s,_s],Ey=[4,2,3,2,0,4,3,2,2,0,3,0],Sf=[0,1,2,4,3,5,7,8,6,11,10,9],kt=[];function _y(){Ms([0,0],0,Es[0]);for(let e=0;e<5;e++){let t=e*Ls,r=t+Zt;Ms([t,Ni],Zt,Es[e+1]),Ms([r,Math.PI-Ni],Zt,Es[(e+3)%5+6])}Ms([0,Math.PI],0,Es[11])}var yr=0;function Ms(e,t,r){if(yr>11)throw new Error(`Too many origins: ${yr}`);let n=Fi.create();Fi.conjugate(n,r);let s={id:yr,axis:e,quat:r,inverseQuat:n,angle:t,orientation:Ty[yr],firstQuintant:Ey[yr]};kt.push(s),yr++}_y();kt.sort((e,t)=>Sf.indexOf(e.id)-Sf.indexOf(t.id));kt.forEach((e,t)=>e.id=t);function My(e,t){let r=t.orientation,n=r===_u||r===an?-1:1,s=(e-t.firstQuintant+5)%5,o=r[s];return{quintant:(t.firstQuintant+n*s+5)%5,orientation:o}}var by=class{forward([e,t]){return[Math.tan(t),e]}inverse([e,t]){return[t,Math.atan(e)]}},Tr=w.create(),cn=w.create(),If=w.create(),wf=w.create();function vi(e,t){w.lerp(Tr,e,t,.5),w.normalize(Tr,Tr),w.cross(Tr,e,Tr);let r=w.length(Tr);if(r<1e-8){let n=w.subtract(w.create(),e,t);return .5*w.length(n)}return r}function By(e,t,r){return w.cross(cn,t,r),w.dot(e,cn)}function Cy(e,t,r,n,s){w.cross(cn,n,s);let o=w.dot(t,cn),i=w.dot(r,cn);return w.scale(If,t,i),w.scale(wf,r,o),w.sub(e,wf,If)}function Ui(e,t,r,n){let s=w.angle(t,r);if(s<1e-12)return w.lerp(e,t,r,n);let o=Math.sin((1-n)*s)/Math.sin(s),i=Math.sin(n*s)/Math.sin(s),a=w.scale(w.create(),t,o),c=w.scale(w.create(),r,i);return w.add(e,a,c)}Tt.setMatrixArrayType(Float64Array);var bs=w.create(),Bs=w.create(),Cs=w.create(),Er=w.create(),Sy=class{constructor(e){this._area=null,this.vertices=e,Object.freeze(this.vertices)}getBoundary(e=1,t=!0){let r=[],n=this.vertices.length;for(let s=0;s<n*e;s++){let o=s/e;r.push(this.slerp(o))}return t&&r.push(r[0]),r}slerp(e){let t=this.vertices.length,r=e%1,n=Math.floor(e%t),s=(n+1)%t;return Ui(w.create(),this.vertices[n],this.vertices[s],r)}getTransformedVertices(e){let t=this.vertices.length,r=Math.floor(e%t),n=(r+1)%t,s=(r+t-1)%t,o=w.clone(this.vertices[r]),i=w.clone(this.vertices[n]),a=w.clone(this.vertices[s]);return w.sub(i,i,o),w.sub(a,a,o),[o,i,a]}containsPoint(e){let t=this.vertices.length,r=1/0;for(let n=0;n<t;n++){let[s,o,i]=this.getTransformedVertices(n),a=w.sub(w.create(),e,s);w.normalize(a,a),w.normalize(o,o),w.normalize(i,i);let c=w.cross(w.create(),o,a),l=w.cross(w.create(),a,i),f=w.dot(s,c),u=w.dot(s,l);r=Math.min(r,f,u)}return r}getTriangleArea(e,t,r){w.lerp(bs,t,r,.5),w.lerp(Bs,r,e,.5),w.lerp(Cs,e,t,.5),w.normalize(bs,bs),w.normalize(Bs,Bs),w.normalize(Cs,Cs);let n=By(bs,Bs,Cs),s=Math.max(-1,Math.min(1,n));return Math.abs(s)<1e-8?2*s:Math.asin(s)*2}getArea(){return this._area===null&&(this._area=this._getArea()),this._area}_getArea(){if(this.vertices.length<3)return 0;if(this.vertices.length===3)return this._area=this.getTriangleArea(this.vertices[0],this.vertices[1],this.vertices[2]),this._area;w.set(Er,0,0,0);for(let t of this.vertices)w.add(Er,Er,t);w.normalize(Er,Er);let e=0;for(let t=0;t<this.vertices.length;t++){let r=this.vertices[t],n=this.vertices[(t+1)%this.vertices.length],s=this.getTriangleArea(Er,r,n);isNaN(s)||(e+=s)}return this._area=e,this._area}isWindingCorrect(){if(!(this.getArea()>0))debugger}};Tt.setMatrixArrayType(Float64Array);var Ss=class extends Sy{constructor(e){if(e.length!==3)throw new Error("SphericalTriangleShape requires exactly 3 vertices");super(e)}};Tt.setMatrixArrayType(Float64Array);var Iy=class{forward(e,t,r){let[n,s,o]=t,i=new Ss([n,s,o]),a=w.subtract(w.create(),e,n);w.normalize(a,a);let c=Cy(w.create(),n,a,s,o);w.normalize(c,c);let l=vi(n,e)/vi(n,c),f=i.getArea(),u=l/f,h=[1-l,u*new Ss([n,c,o]).getArea(),u*new Ss([n,s,c]).getArea()];return my(h,r)}inverse(e,t,r){let[n,s,o]=r,i=new Ss([n,s,o]),a=py(e,t),c=1-1e-14;if(a[0]>c)return n;if(a[1]>c)return s;if(a[2]>c)return o;let l=w.create();w.cross(l,s,o);let f=i.getArea(),u=1-a[0],d=a[2]/u*f,p=Math.sin(d),A=Math.sin(d/2),m=2*A*A,y=w.dot(n,s),_=w.dot(s,o),E=w.dot(o,n),M=w.length(l),B=w.dot(n,l),C=p*B+m*(y*_-E),L=m*M*(1+y),b=2/Math.acos(_)*Math.atan2(L,C),T=Ui(w.create(),s,o,b),g=vi(n,T),S=this.safeAcos(u*g)/this.safeAcos(g);return Ui([0,0,0],n,T,S)}safeAcos(e){return e<.001?2*e+e*e*e/3:Math.acos(1-2*e*e)}};Tt.setMatrixArrayType(Float64Array);var It=-1,yt=1,wy=([e,t])=>P.fromValues(e-t,t),Vi=P.fromValues(1,0),Hi=P.fromValues(0,1),Lf=P.negate(P.create(),Vi),vf=P.negate(P.create(),Hi),Ri=P.fromValues(0,0),Ly=(e,[t,r])=>{let n=Ri,s=Ri;switch(t===yt&&r===yt?(n=Vi,s=Hi):t===It&&r===yt?(n=vf,s=Lf):t===yt&&r===It?(n=Hi,s=Vi):t===It&&r===It&&(n=Lf,s=vf),e){case 0:return Ri;case 1:return n;case 2:return P.add(P.create(),s,n);case 3:return P.scaleAndAdd(P.create(),s,n,2);default:throw new Error(`Invalid Quaternary value: ${e}`)}},Rf=e=>[[yt,yt],[yt,It],[yt,yt],[It,yt]][e],Ff=P.fromValues(-1,1);function Mu(e){return Array.from({length:e.length},(t,r)=>e.indexOf(r))}var bu=[0,1,3,4,5,6,7,2],Bu=[0,1,2,7,3,4,5,6],hL=Mu(bu),dL=Mu(Bu),vy=(e,t,r,n,s)=>{if(t<=0)return;let o=e[t]||0,i=e[t-1],a=r[0]+r[1],c=!0,l=!0;if(n!==(a===0)?(c=o===1||o===2,l=o===1):(c=o<2,l=o===0),!c)return;let f=l?i:i+4,u=s[f];e[t-1]=u%4,e[t]=(o+4+Math.floor(u/4)-Math.floor(f/4))%4},Ry=(e,t,r)=>{let n=BigInt(e),s=r==="vu"||r==="wu"||r==="vw",o=r==="wv"||r==="vw",i=r==="wu"||r==="uw";s&&(n=(1n<<BigInt(2*t))-n-1n);let a=Fy(n,t,o,i);if(i){let{offset:[c,l],flips:[f,u]}=a;a.offset=[l,c],f===It&&P.add(a.offset,a.offset,Ff),u===It&&P.subtract(a.offset,a.offset,Ff)}if(o){let{offset:[c,l],flips:f}=a,u=(1<<t)-(c+l);f[0]=-f[0],a.offset[1]=u,a.flips=f}return a},Fy=(e,t,r,n)=>{let s=P.create(),o=[yt,yt],i=BigInt(e),a=[];for(;i>0n||a.length<t;)a.push(Number(i%4n)),i=i>>2n;let c=n?Bu:bu;for(let f=a.length-1;f>=0;f--)vy(a,f,o,r,c),P.multiply(o,o,Rf(a[f]));o[0]=yt,o[1]=yt;for(let f=a.length-1;f>=0;f--){P.scale(s,s,2);let u=Ly(a[f],o);P.add(s,s,u),P.multiply(o,o,Rf(a[f]))}let l=a[0]||0;return{flips:o,k:l,offset:wy(s)}};Tt.setMatrixArrayType(Float64Array);var Py=!1,Oy=P.clone(ln),Ny=P.negate(P.create(),ln),ji=[0,1,2,3,4].map(e=>{let t=Ve.create();return Ve.fromRotation(t,Ls*e),t}),Pf=P.create();function Dy(e,t,r){let n=(Py?mu:cy).clone();P.transformMat2(Pf,r.offset,gu),r.flips[0]===yt&&r.flips[1]===It&&n.rotate180();let{k:s}=r,o=r.flips[0]+r.flips[1];return((o===-2||o===2)&&s>1||o===0&&(s===0||s===3))&&n.reflectY(),r.flips[0]===It&&r.flips[1]===It?n.rotate180():r.flips[0]===It?n.translate(Ny):r.flips[1]===It&&n.translate(Oy),n.translate(Pf),n.scale(1/2**e),n.transform(ji[t]),n}function Cu(e){let t=mu.clone();return t.transform(ji[e]),t}function Gy(){let e=[];for(let t of ji)e.push(P.transformMat2(P.create(),Rs,t));return e.reverse(),new Ji(e)}Tt.setMatrixArrayType(Float64Array);var Uy=class{constructor(){if(this.vertices=[],this.invocations=0,this.addFaceCenters(),this.addVertices(),this.addMidpoints(),this.vertices.length!==62)throw new Error("Failed to construct CRS: vertices length is not 62");Object.freeze(this.vertices)}getVertex(e){this.invocations++,this.invocations===1e4&&console.warn("Too many CRS invocations, results should be cached");for(let t of this.vertices)if(w.distance(e,t)<1e-5)return t;throw new Error("Failed to find vertex in CRS")}addFaceCenters(){kt.forEach(e=>this.add(_r(e.axis)))}addVertices(){let e=Math.atan(ny);for(let t of kt)for(let r=0;r<5;r++){let n=(2*r+1)*Math.PI/5,s=_r([n+t.angle,e]);w.transformQuat(s,s,t.quat),this.add(s)}}addMidpoints(){let e=Math.atan(Ps);for(let t of kt)for(let r=0;r<5;r++){let n=2*r*Math.PI/5,s=_r([n+t.angle,e]);w.transformQuat(s,s,t.quat),this.add(s)}}add(e){let t=w.normalize(w.create(),e);return this.vertices.find(n=>w.distance(t,n)<1e-5)?!1:(this.vertices.push(t),!0)}};Tt.setMatrixArrayType(Float64Array);var Vy=new Uy,Hy=class{constructor(){this.faceTriangles=[],this.sphericalTriangles=[],this.polyhedral=new Iy,this.gnomonic=new by}forward(e,t){let r=kt[t],n=_r(e),s=w.create();w.transformQuat(s,n,r.inverseQuat);let o=Gi(s),i=this.gnomonic.forward(o);i[1]=i[1]-r.angle;let a=this.getFaceTriangleIndex(i),c=this.shouldReflect(i),l=this.getFaceTriangle(a,c,!1),f=this.getSphericalTriangle(a,t,c);return this.polyhedral.forward(n,f,l)}inverse(e,t){let r=Tf(e),n=this.getFaceTriangleIndex(r),s=this.shouldReflect(r),o=this.getFaceTriangle(n,s,!1),i=this.getSphericalTriangle(n,t,s),a=this.polyhedral.inverse(e,o,i);return Gi(a)}shouldReflect(e){let[t,r]=e;return dy([t,this.normalizeGamma(r)])[0]>Ps}getFaceTriangleIndex([e,t]){return(Math.floor(t/Zt)+10)%10}getFaceTriangle(e,t=!1,r=!1){let n=e;return t&&(n+=r?20:10),this.faceTriangles[n]?this.faceTriangles[n]:(this.faceTriangles[n]=t?this._getReflectedFaceTriangle(e,r):this._getFaceTriangle(e),Object.freeze(this.faceTriangles[n]),this.faceTriangles[n])}_getFaceTriangle(e){let t=Math.floor((e+1)/2)%5,[r,n,s]=Cu(t).getVertices(),o=P.create();return P.lerp(o,n,s,.5),e%2===0?[r,o,n]:[r,s,o]}_getReflectedFaceTriangle(e,t=!1){let[r,n,s]=this._getFaceTriangle(e).map(a=>P.clone(a)),o=e%2===0;P.negate(r,r);let i=o?n:s;return P.scaleAndAdd(r,r,i,t?1+1/Math.cos(Ni):2),[r,s,n]}getSphericalTriangle(e,t,r=!1){let n=10*t+e;return r&&(n+=120),this.sphericalTriangles[n]?this.sphericalTriangles[n]:(this.sphericalTriangles[n]=this._getSphericalTriangle(e,t,r),Object.freeze(this.sphericalTriangles[n]),this.sphericalTriangles[n])}_getSphericalTriangle(e,t,r=!1){let n=kt[t];return this.getFaceTriangle(e,r,!0).map(i=>{let[a,c]=Tf(i),l=[a,c+n.angle],f=_r(this.gnomonic.inverse(l));return w.transformQuat(f,f,n.quat),Vy.getVertex(f)})}normalizeGamma(e){let t=e/Ls,r=Math.round(t);return(t-r)*Ls}},Mr=2,zy=30,qy=58n,ky=0x3ffffffffffffffn;function Jy(e){let t=zy-1,r=e>>1n;for(;t>-1&&(r&0b1n)===0n;)t-=1,r=r>>(t<Mr?1n:2n);return t}function jy(e){let t=Jy(e);if(t===-1)return{origin:kt[0],segment:0,S:0n,resolution:t};let r=Number(e>>58n),n,s;if(t===0)n=kt[r],s=0;else{let l=Math.floor(r/5);n=kt[l],s=(r+n.firstQuintant)%5}if(!n)throw new Error(`Could not parse origin: ${r}`);if(t<Mr)return{origin:n,segment:s,S:0n,resolution:t};let o=t-Mr+1,i=BigInt(2*o),a=qy-i,c=(e&ky)>>a;return{origin:n,segment:s,S:c,resolution:t}}Tt.setMatrixArrayType(Float64Array);var pL=Ve.create(),Xy=new Hy;function Wy({S:e,segment:t,origin:r,resolution:n}){let{quintant:s,orientation:o}=My(t,r);if(n===Mr-1)return Cu(s);if(n===Mr-2)return Gy();let i=n-Mr+1,a=Ry(e,i,o);return Dy(i,s,a)}function Su(e,{closedRing:t=!0,segments:r="auto"}={closedRing:!0,segments:"auto"}){let{S:n,segment:s,origin:o,resolution:i}=jy(e);r==="auto"&&(r=Math.max(1,Math.pow(2,6-i)));let u=Wy({S:n,segment:s,origin:o,resolution:i}).splitEdges(r).getVertices().map(d=>Xy.inverse(d,o.id)).map(d=>yu(d)),h=Ay(u);return t&&h.push(h[0]),h.reverse(),h}function Iu(e){return BigInt(`0x${e}`)}var Of=63710072e-1,mL=4*Math.PI*Of*Of;Tt.setMatrixArrayType(Float64Array);var xn=D(Ds(),1);var Yy=1/Math.PI*180,Ky=1/180*Math.PI,Qy={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Qy}};var Q=globalThis.mathgl.config;function Xi(e,{precision:t=Q.precision}={}){return e=Zy(e),`${parseFloat(e.toPrecision(t))}`}function wt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Wi(e){return Lu(e)}function Yi(e){return Lt(e)}function Lu(e,t){return Ki(e,r=>r*Ky,t)}function Lt(e,t){return Ki(e,r=>r*Yy,t)}function Gs(e,t,r){return Ki(e,n=>Math.max(t,Math.min(r,n)))}function ye(e,t,r){return wt(e)?e.map((n,s)=>ye(n,t[s],r)):r*t+(1-r)*e}function Et(e,t,r){let n=Q.EPSILON;r&&(Q.EPSILON=r);try{if(e===t)return!0;if(wt(e)&&wt(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Et(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=Q.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Q.EPSILON=n}}function Zy(e){return Math.round(e/Q.EPSILON)*Q.EPSILON}function $y(e){return e.clone?e.clone():new Array(e.length)}function Ki(e,t,r){if(wt(e)){let n=e;r=r||$y(n);for(let s=0;s<r.length&&s<n.length;++s){let o=typeof e=="number"?e:e[s];r[s]=t(o,s,r)}return r}return t(e)}var Te=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:wt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Q)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Xi(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Et(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof r=="number"?r:r[s];this[s]=o+n*(i-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(Q.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function tT(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function V(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Ee(e,t,r=""){if(Q.debug&&!tT(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function ft(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var _e=class extends Te{get x(){return this[0]}set x(t){this[0]=V(t)}get y(){return this[1]}set y(t){this[1]=V(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-t[n];r+=s*s}return V(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return V(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ft(t>=0&&t<this.ELEMENTS,"index is out of range"),V(this[t])}setComponent(t,r){return ft(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var tt=typeof Float32Array<"u"?Float32Array:Array,un=Math.random;function br(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var OL=Math.PI/180;function eT(){let e=new tt(2);return tt!=Float32Array&&(e[0]=0,e[1]=0),e}function vu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e}function Ru(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s+r[4],e[1]=r[1]*n+r[3]*s+r[5],e}function Us(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[3]*s+r[6],e[1]=r[1]*n+r[4]*s+r[7],e}function Vs(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}var NL=function(){let e=eT();return function(t,r,n,s,o,i){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],o(e,e,i),t[a]=e[0],t[a+1]=e[1];return t}}();function Hs(e,t,r){let n=t[0],s=t[1],o=r[3]*n+r[7]*s||1;return e[0]=(r[0]*n+r[4]*s)/o,e[1]=(r[1]*n+r[5]*s)/o,e}function zs(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o||1;return e[0]=(r[0]*n+r[4]*s+r[8]*o)/i,e[1]=(r[1]*n+r[5]*s+r[9]*o)/i,e[2]=(r[2]*n+r[6]*s+r[10]*o)/i,e}function Fu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e}function Pu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e[3]=t[3],e}function qs(e,t,r){let n=t[0],s=t[1],o=t[2];return e[0]=r[0]*n+r[3]*s+r[6]*o,e[1]=r[1]*n+r[4]*s+r[7]*o,e[2]=r[2]*n+r[5]*s+r[8]*o,e[3]=t[3],e}var ze=class extends _e{constructor(t=0,r=0){super(2),wt(t)&&arguments.length===1?this.copy(t):(Q.debug&&(V(t),V(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Q.debug&&(V(t.x),V(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Vs(this,this,t),this.check()}transformAsVector(t){return Hs(this,this,t),this.check()}transformByMatrix3(t){return Us(this,this,t),this.check()}transformByMatrix2x3(t){return Ru(this,this,t),this.check()}transformByMatrix2(t){return vu(this,this,t),this.check()}};var Je={};pt(Je,{add:()=>oT,angle:()=>ea,bezier:()=>xT,ceil:()=>iT,clone:()=>rT,copy:()=>nT,create:()=>ks,cross:()=>qe,dist:()=>ST,distance:()=>Uu,div:()=>CT,divide:()=>Gu,dot:()=>hn,equals:()=>MT,exactEquals:()=>_T,floor:()=>aT,forEach:()=>LT,fromValues:()=>Js,hermite:()=>AT,inverse:()=>pT,len:()=>ra,length:()=>Ou,lerp:()=>mT,max:()=>lT,min:()=>cT,mul:()=>BT,multiply:()=>Du,negate:()=>dT,normalize:()=>Qi,random:()=>yT,rotateX:()=>Zi,rotateY:()=>$i,rotateZ:()=>ta,round:()=>fT,scale:()=>uT,scaleAndAdd:()=>hT,set:()=>sT,slerp:()=>gT,sqrDist:()=>IT,sqrLen:()=>wT,squaredDistance:()=>Vu,squaredLength:()=>Hu,str:()=>ET,sub:()=>bT,subtract:()=>Nu,transformMat3:()=>dn,transformMat4:()=>ke,transformQuat:()=>pn,zero:()=>TT});function ks(){let e=new tt(3);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function rT(e){let t=new tt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ou(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function Js(e,t,r){let n=new tt(3);return n[0]=e,n[1]=t,n[2]=r,n}function nT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function sT(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function oT(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Nu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Du(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Gu(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function iT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function aT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function cT(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function lT(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function fT(e,t){return e[0]=br(t[0]),e[1]=br(t[1]),e[2]=br(t[2]),e}function uT(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function hT(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function Uu(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(r*r+n*n+s*s)}function Vu(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function Hu(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function dT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function pT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Qi(e,t){let r=t[0],n=t[1],s=t[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function hn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function qe(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2];return e[0]=s*c-o*a,e[1]=o*i-n*c,e[2]=n*a-s*i,e}function mT(e,t,r,n){let s=t[0],o=t[1],i=t[2];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e}function gT(e,t,r,n){let s=Math.acos(Math.min(Math.max(hn(t,r),-1),1)),o=Math.sin(s),i=Math.sin((1-n)*s)/o,a=Math.sin(n*s)/o;return e[0]=i*t[0]+a*r[0],e[1]=i*t[1]+a*r[1],e[2]=i*t[2]+a*r[2],e}function AT(e,t,r,n,s,o){let i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*f,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*f,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*f,e}function xT(e,t,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*f+n[0]*u+s[0]*h,e[1]=t[1]*l+r[1]*f+n[1]*u+s[1]*h,e[2]=t[2]*l+r[2]*f+n[2]*u+s[2]*h,e}function yT(e,t){t=t===void 0?1:t;let r=un()*2*Math.PI,n=un()*2-1,s=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*s,e[1]=Math.sin(r)*s,e[2]=n*t,e}function ke(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,e[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,e[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,e[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,e}function dn(e,t,r){let n=t[0],s=t[1],o=t[2];return e[0]=n*r[0]+s*r[3]+o*r[6],e[1]=n*r[1]+s*r[4]+o*r[7],e[2]=n*r[2]+s*r[5]+o*r[8],e}function pn(e,t,r){let n=r[0],s=r[1],o=r[2],i=r[3],a=t[0],c=t[1],l=t[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,e[0]=a+f+d,e[1]=c+u+p,e[2]=l+h+A,e}function Zi(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0],o[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),o[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function $i(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),o[1]=s[1],o[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ta(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),o[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),o[2]=s[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ea(e,t){let r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2],c=Math.sqrt((r*r+n*n+s*s)*(o*o+i*i+a*a)),l=c&&hn(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function TT(e){return e[0]=0,e[1]=0,e[2]=0,e}function ET(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function _T(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function MT(e,t){let r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2];return Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var bT=Nu,BT=Du,CT=Gu,ST=Uu,IT=Vu,ra=Ou,wT=Hu,LT=function(){let e=ks();return function(t,r,n,s,o,i){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var na=[0,0,0],js,x=class extends _e{static get ZERO(){return js||(js=new x(0,0,0),Object.freeze(js)),js}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&wt(t)?this.copy(t):(Q.debug&&(V(t),V(r),V(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Q.debug&&(V(t.x),V(t.y),V(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=V(t)}angle(t){return ea(this,t)}cross(t){return qe(this,this,t),this.check()}rotateX({radians:t,origin:r=na}){return Zi(this,this,r,t),this.check()}rotateY({radians:t,origin:r=na}){return $i(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=na}){return ta(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ke(this,this,t),this.check()}transformAsVector(t){return zs(this,this,t),this.check()}transformByMatrix3(t){return dn(this,this,t),this.check()}transformByMatrix2(t){return Fu(this,this,t),this.check()}transformByQuaternion(t){return pn(this,this,t),this.check()}};var Xs,Cr=class extends _e{static get ZERO(){return Xs||(Xs=new Cr(0,0,0,0),Object.freeze(Xs)),Xs}constructor(t=0,r=0,n=0,s=0){super(-0,-0,-0,-0),wt(t)&&arguments.length===1?this.copy(t):(Q.debug&&(V(t),V(r),V(n),V(s)),this[0]=t,this[1]=r,this[2]=n,this[3]=s)}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return Q.debug&&(V(t.x),V(t.y),V(t.z),V(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=V(t)}get w(){return this[3]}set w(t){this[3]=V(t)}transform(t){return ke(this,this,t),this.check()}transformByMatrix3(t){return qs(this,this,t),this.check()}transformByMatrix2(t){return Pu(this,this,t),this.check()}transformByQuaternion(t){return pn(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Sr=class extends Te{toString(){let t="[";if(Q.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=V(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(t,r){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function zu(){let e=new tt(9);return tt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function qu(e,t){if(e===t){let r=t[1],n=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=s}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];return e}function ku(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],f=t[8],u=f*i-a*l,h=-f*o+a*c,d=l*o-i*c,p=r*u+n*h+s*d;return p?(p=1/p,e[0]=u*p,e[1]=(-f*n+s*l)*p,e[2]=(a*n-s*i)*p,e[3]=h*p,e[4]=(f*r-s*c)*p,e[5]=(-a*r+s*o)*p,e[6]=d*p,e[7]=(-l*r+n*c)*p,e[8]=(i*r-n*o)*p,e):null}function Ju(e){let t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],i=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-i*c)+r*(-l*s+i*a)+n*(c*s-o*a)}function sa(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=r[0],d=r[1],p=r[2],A=r[3],m=r[4],y=r[5],_=r[6],E=r[7],M=r[8];return e[0]=h*n+d*i+p*l,e[1]=h*s+d*a+p*f,e[2]=h*o+d*c+p*u,e[3]=A*n+m*i+y*l,e[4]=A*s+m*a+y*f,e[5]=A*o+m*c+y*u,e[6]=_*n+E*i+M*l,e[7]=_*s+E*a+M*f,e[8]=_*o+E*c+M*u,e}function ju(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=r[0],d=r[1];return e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=a,e[5]=c,e[6]=h*n+d*i+l,e[7]=h*s+d*a+f,e[8]=h*o+d*c+u,e}function Xu(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=Math.sin(r),d=Math.cos(r);return e[0]=d*n+h*i,e[1]=d*s+h*a,e[2]=d*o+h*c,e[3]=d*i-h*n,e[4]=d*a-h*s,e[5]=d*c-h*o,e[6]=l,e[7]=f,e[8]=u,e}function oa(e,t,r){let n=r[0],s=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Wu(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r+r,a=n+n,c=s+s,l=r*i,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return e[0]=1-u-p,e[3]=f-y,e[6]=h+m,e[1]=f+y,e[4]=1-l-p,e[7]=d-A,e[2]=h-m,e[5]=d+A,e[8]=1-l-u,e}var ia;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(ia||(ia={}));var RT=Object.freeze([1,0,0,0,1,0,0,0,1]),J=class extends Sr{static get IDENTITY(){return PT()}static get ZERO(){return FT()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return ia}constructor(t,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):r.length>0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(RT)}fromObject(t){return this.check()}fromQuaternion(t){return Wu(this,t),this.check()}set(t,r,n,s,o,i,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=i,this[8]=l,this.check()}determinant(){return Ju(this)}transpose(){return qu(this,this),this.check()}invert(){return ku(this,this),this.check()}multiplyLeft(t){return sa(this,t,this),this.check()}multiplyRight(t){return sa(this,this,t),this.check()}rotate(t){return Xu(this,this,t),this.check()}scale(t){return Array.isArray(t)?oa(this,this,t):oa(this,this,[t,t]),this.check()}translate(t){return ju(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Us(r||[-0,-0],t,this);break;case 3:n=dn(r||[-0,-0,-0],t,this);break;case 4:n=qs(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},Ws,Ys=null;function FT(){return Ws||(Ws=new J([0,0,0,0,0,0,0,0,0]),Object.freeze(Ws)),Ws}function PT(){return Ys||(Ys=new J,Object.freeze(Ys)),Ys}var gn={};pt(gn,{add:()=>oE,adjoint:()=>VT,clone:()=>NT,copy:()=>DT,create:()=>OT,decompose:()=>KT,determinant:()=>la,equals:()=>lE,exactEquals:()=>cE,frob:()=>sE,fromQuat:()=>ga,fromQuat2:()=>XT,fromRotation:()=>qT,fromRotationTranslation:()=>Ku,fromRotationTranslationScale:()=>QT,fromRotationTranslationScaleOrigin:()=>ZT,fromScaling:()=>zT,fromTranslation:()=>HT,fromValues:()=>GT,fromXRotation:()=>kT,fromYRotation:()=>JT,fromZRotation:()=>jT,frustum:()=>Aa,getRotation:()=>YT,getScaling:()=>Qu,getTranslation:()=>WT,identity:()=>Yu,invert:()=>ca,lookAt:()=>Ta,mul:()=>fE,multiply:()=>mn,multiplyScalar:()=>iE,multiplyScalarAndAdd:()=>aE,ortho:()=>ya,orthoNO:()=>$u,orthoZO:()=>eE,perspective:()=>xa,perspectiveFromFieldOfView:()=>tE,perspectiveNO:()=>Zu,perspectiveZO:()=>$T,rotate:()=>ha,rotateX:()=>da,rotateY:()=>pa,rotateZ:()=>ma,scale:()=>ua,set:()=>UT,str:()=>nE,sub:()=>uE,subtract:()=>th,targetTo:()=>rE,translate:()=>fa,transpose:()=>aa});function OT(){let e=new tt(16);return tt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function NT(e){let t=new tt(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function DT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function GT(e,t,r,n,s,o,i,a,c,l,f,u,h,d,p,A){let m=new tt(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=s,m[5]=o,m[6]=i,m[7]=a,m[8]=c,m[9]=l,m[10]=f,m[11]=u,m[12]=h,m[13]=d,m[14]=p,m[15]=A,m}function UT(e,t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=i,e[6]=a,e[7]=c,e[8]=l,e[9]=f,e[10]=u,e[11]=h,e[12]=d,e[13]=p,e[14]=A,e[15]=m,e}function Yu(e){return 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}function aa(e,t){if(e===t){let r=t[1],n=t[2],s=t[3],o=t[6],i=t[7],a=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]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=a}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];return e}function ca(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],_=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,L=s*l-o*c,b=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,R=u*y-d*A,F=h*y-d*m,v=_*F-E*R+M*S+B*g-C*T+L*b;return v?(v=1/v,e[0]=(a*F-c*R+l*S)*v,e[1]=(s*R-n*F-o*S)*v,e[2]=(A*L-m*C+y*B)*v,e[3]=(h*C-u*L-d*B)*v,e[4]=(c*g-i*F-l*T)*v,e[5]=(r*F-s*g+o*T)*v,e[6]=(m*M-p*L-y*E)*v,e[7]=(f*L-h*M+d*E)*v,e[8]=(i*R-a*g+l*b)*v,e[9]=(n*g-r*R-o*b)*v,e[10]=(p*C-A*M+y*_)*v,e[11]=(u*M-f*C-d*_)*v,e[12]=(a*T-i*S-c*b)*v,e[13]=(r*S-n*T+s*b)*v,e[14]=(A*E-p*B-m*_)*v,e[15]=(f*B-u*E+h*_)*v,e):null}function VT(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],_=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,L=s*l-o*c,b=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,R=u*y-d*A,F=h*y-d*m;return e[0]=a*F-c*R+l*S,e[1]=s*R-n*F-o*S,e[2]=A*L-m*C+y*B,e[3]=h*C-u*L-d*B,e[4]=c*g-i*F-l*T,e[5]=r*F-s*g+o*T,e[6]=m*M-p*L-y*E,e[7]=f*L-h*M+d*E,e[8]=i*R-a*g+l*b,e[9]=n*g-r*R-o*b,e[10]=p*C-A*M+y*_,e[11]=u*M-f*C-d*_,e[12]=a*T-i*S-c*b,e[13]=r*S-n*T+s*b,e[14]=A*E-p*B-m*_,e[15]=f*B-u*E+h*_,e}function la(e){let t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],i=e[5],a=e[6],c=e[7],l=e[8],f=e[9],u=e[10],h=e[11],d=e[12],p=e[13],A=e[14],m=e[15],y=t*i-r*o,_=t*a-n*o,E=r*a-n*i,M=l*p-f*d,B=l*A-u*d,C=f*A-u*p,L=t*C-r*B+n*M,b=o*C-i*B+a*M,T=l*E-f*_+u*y,g=d*E-p*_+A*y;return c*L-s*b+m*T-h*g}function mn(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=t[9],d=t[10],p=t[11],A=t[12],m=t[13],y=t[14],_=t[15],E=r[0],M=r[1],B=r[2],C=r[3];return e[0]=E*n+M*a+B*u+C*A,e[1]=E*s+M*c+B*h+C*m,e[2]=E*o+M*l+B*d+C*y,e[3]=E*i+M*f+B*p+C*_,E=r[4],M=r[5],B=r[6],C=r[7],e[4]=E*n+M*a+B*u+C*A,e[5]=E*s+M*c+B*h+C*m,e[6]=E*o+M*l+B*d+C*y,e[7]=E*i+M*f+B*p+C*_,E=r[8],M=r[9],B=r[10],C=r[11],e[8]=E*n+M*a+B*u+C*A,e[9]=E*s+M*c+B*h+C*m,e[10]=E*o+M*l+B*d+C*y,e[11]=E*i+M*f+B*p+C*_,E=r[12],M=r[13],B=r[14],C=r[15],e[12]=E*n+M*a+B*u+C*A,e[13]=E*s+M*c+B*h+C*m,e[14]=E*o+M*l+B*d+C*y,e[15]=E*i+M*f+B*p+C*_,e}function fa(e,t,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,f,u,h,d,p,A,m,y;return t===e?(e[12]=t[0]*n+t[4]*s+t[8]*o+t[12],e[13]=t[1]*n+t[5]*s+t[9]*o+t[13],e[14]=t[2]*n+t[6]*s+t[10]*o+t[14],e[15]=t[3]*n+t[7]*s+t[11]*o+t[15]):(i=t[0],a=t[1],c=t[2],l=t[3],f=t[4],u=t[5],h=t[6],d=t[7],p=t[8],A=t[9],m=t[10],y=t[11],e[0]=i,e[1]=a,e[2]=c,e[3]=l,e[4]=f,e[5]=u,e[6]=h,e[7]=d,e[8]=p,e[9]=A,e[10]=m,e[11]=y,e[12]=i*n+f*s+p*o+t[12],e[13]=a*n+u*s+A*o+t[13],e[14]=c*n+h*s+m*o+t[14],e[15]=l*n+d*s+y*o+t[15]),e}function ua(e,t,r){let n=r[0],s=r[1],o=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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ha(e,t,r,n){let s=n[0],o=n[1],i=n[2],a=Math.sqrt(s*s+o*o+i*i),c,l,f,u,h,d,p,A,m,y,_,E,M,B,C,L,b,T,g,S,R,F,v,G;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),f=1-c,u=t[0],h=t[1],d=t[2],p=t[3],A=t[4],m=t[5],y=t[6],_=t[7],E=t[8],M=t[9],B=t[10],C=t[11],L=s*s*f+c,b=o*s*f+i*l,T=i*s*f-o*l,g=s*o*f-i*l,S=o*o*f+c,R=i*o*f+s*l,F=s*i*f+o*l,v=o*i*f-s*l,G=i*i*f+c,e[0]=u*L+A*b+E*T,e[1]=h*L+m*b+M*T,e[2]=d*L+y*b+B*T,e[3]=p*L+_*b+C*T,e[4]=u*g+A*S+E*R,e[5]=h*g+m*S+M*R,e[6]=d*g+y*S+B*R,e[7]=p*g+_*S+C*R,e[8]=u*F+A*v+E*G,e[9]=h*F+m*v+M*G,e[10]=d*F+y*v+B*G,e[11]=p*F+_*v+C*G,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function da(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[4],i=t[5],a=t[6],c=t[7],l=t[8],f=t[9],u=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+l*n,e[5]=i*s+f*n,e[6]=a*s+u*n,e[7]=c*s+h*n,e[8]=l*s-o*n,e[9]=f*s-i*n,e[10]=u*s-a*n,e[11]=h*s-c*n,e}function pa(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[0],i=t[1],a=t[2],c=t[3],l=t[8],f=t[9],u=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-l*n,e[1]=i*s-f*n,e[2]=a*s-u*n,e[3]=c*s-h*n,e[8]=o*n+l*s,e[9]=i*n+f*s,e[10]=a*n+u*s,e[11]=c*n+h*s,e}function ma(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[0],i=t[1],a=t[2],c=t[3],l=t[4],f=t[5],u=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+l*n,e[1]=i*s+f*n,e[2]=a*s+u*n,e[3]=c*s+h*n,e[4]=l*s-o*n,e[5]=f*s-i*n,e[6]=u*s-a*n,e[7]=h*s-c*n,e}function HT(e,t){return 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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function zT(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function qT(e,t,r){let n=r[0],s=r[1],o=r[2],i=Math.sqrt(n*n+s*s+o*o),a,c,l;return i<1e-6?null:(i=1/i,n*=i,s*=i,o*=i,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=n*n*l+a,e[1]=s*n*l+o*c,e[2]=o*n*l-s*c,e[3]=0,e[4]=n*s*l-o*c,e[5]=s*s*l+a,e[6]=o*s*l+n*c,e[7]=0,e[8]=n*o*l+s*c,e[9]=s*o*l-n*c,e[10]=o*o*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function kT(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function JT(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function jT(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,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}function Ku(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=n+n,c=s+s,l=o+o,f=n*a,u=n*c,h=n*l,d=s*c,p=s*l,A=o*l,m=i*a,y=i*c,_=i*l;return e[0]=1-(d+A),e[1]=u+_,e[2]=h-y,e[3]=0,e[4]=u-_,e[5]=1-(f+A),e[6]=p+m,e[7]=0,e[8]=h+y,e[9]=p-m,e[10]=1-(f+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function XT(e,t){let r=new tt(3),n=-t[0],s=-t[1],o=-t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=n*n+s*s+o*o+i*i;return u>0?(r[0]=(a*i+f*n+c*o-l*s)*2/u,r[1]=(c*i+f*s+l*n-a*o)*2/u,r[2]=(l*i+f*o+a*s-c*n)*2/u):(r[0]=(a*i+f*n+c*o-l*s)*2,r[1]=(c*i+f*s+l*n-a*o)*2,r[2]=(l*i+f*o+a*s-c*n)*2),Ku(e,t,r),e}function WT(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Qu(e,t){let r=t[0],n=t[1],s=t[2],o=t[4],i=t[5],a=t[6],c=t[8],l=t[9],f=t[10];return e[0]=Math.sqrt(r*r+n*n+s*s),e[1]=Math.sqrt(o*o+i*i+a*a),e[2]=Math.sqrt(c*c+l*l+f*f),e}function YT(e,t){let r=new tt(3);Qu(r,t);let n=1/r[0],s=1/r[1],o=1/r[2],i=t[0]*n,a=t[1]*s,c=t[2]*o,l=t[4]*n,f=t[5]*s,u=t[6]*o,h=t[8]*n,d=t[9]*s,p=t[10]*o,A=i+f+p,m=0;return A>0?(m=Math.sqrt(A+1)*2,e[3]=.25*m,e[0]=(u-d)/m,e[1]=(h-c)/m,e[2]=(a-l)/m):i>f&&i>p?(m=Math.sqrt(1+i-f-p)*2,e[3]=(u-d)/m,e[0]=.25*m,e[1]=(a+l)/m,e[2]=(h+c)/m):f>p?(m=Math.sqrt(1+f-i-p)*2,e[3]=(h-c)/m,e[0]=(a+l)/m,e[1]=.25*m,e[2]=(u+d)/m):(m=Math.sqrt(1+p-i-f)*2,e[3]=(a-l)/m,e[0]=(h+c)/m,e[1]=(u+d)/m,e[2]=.25*m),e}function KT(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let s=n[0],o=n[1],i=n[2],a=n[4],c=n[5],l=n[6],f=n[8],u=n[9],h=n[10];r[0]=Math.sqrt(s*s+o*o+i*i),r[1]=Math.sqrt(a*a+c*c+l*l),r[2]=Math.sqrt(f*f+u*u+h*h);let d=1/r[0],p=1/r[1],A=1/r[2],m=s*d,y=o*p,_=i*A,E=a*d,M=c*p,B=l*A,C=f*d,L=u*p,b=h*A,T=m+M+b,g=0;return T>0?(g=Math.sqrt(T+1)*2,e[3]=.25*g,e[0]=(B-L)/g,e[1]=(C-_)/g,e[2]=(y-E)/g):m>M&&m>b?(g=Math.sqrt(1+m-M-b)*2,e[3]=(B-L)/g,e[0]=.25*g,e[1]=(y+E)/g,e[2]=(C+_)/g):M>b?(g=Math.sqrt(1+M-m-b)*2,e[3]=(C-_)/g,e[0]=(y+E)/g,e[1]=.25*g,e[2]=(B+L)/g):(g=Math.sqrt(1+b-m-M)*2,e[3]=(y-E)/g,e[0]=(C+_)/g,e[1]=(B+L)/g,e[2]=.25*g),e}function QT(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=s+s,l=o+o,f=i+i,u=s*c,h=s*l,d=s*f,p=o*l,A=o*f,m=i*f,y=a*c,_=a*l,E=a*f,M=n[0],B=n[1],C=n[2];return e[0]=(1-(p+m))*M,e[1]=(h+E)*M,e[2]=(d-_)*M,e[3]=0,e[4]=(h-E)*B,e[5]=(1-(u+m))*B,e[6]=(A+y)*B,e[7]=0,e[8]=(d+_)*C,e[9]=(A-y)*C,e[10]=(1-(u+p))*C,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function ZT(e,t,r,n,s){let o=t[0],i=t[1],a=t[2],c=t[3],l=o+o,f=i+i,u=a+a,h=o*l,d=o*f,p=o*u,A=i*f,m=i*u,y=a*u,_=c*l,E=c*f,M=c*u,B=n[0],C=n[1],L=n[2],b=s[0],T=s[1],g=s[2],S=(1-(A+y))*B,R=(d+M)*B,F=(p-E)*B,v=(d-M)*C,G=(1-(h+y))*C,X=(m+_)*C,z=(p+E)*L,et=(m-_)*L,K=(1-(h+A))*L;return e[0]=S,e[1]=R,e[2]=F,e[3]=0,e[4]=v,e[5]=G,e[6]=X,e[7]=0,e[8]=z,e[9]=et,e[10]=K,e[11]=0,e[12]=r[0]+b-(S*b+v*T+z*g),e[13]=r[1]+T-(R*b+G*T+et*g),e[14]=r[2]+g-(F*b+X*T+K*g),e[15]=1,e}function ga(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r+r,a=n+n,c=s+s,l=r*i,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return e[0]=1-u-p,e[1]=f+y,e[2]=h-m,e[3]=0,e[4]=f-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=h+m,e[9]=d-A,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Aa(e,t,r,n,s,o,i){let a=1/(r-t),c=1/(s-n),l=1/(o-i);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(s+n)*c,e[10]=(i+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*l,e[15]=0,e}function Zu(e,t,r,n,s){let o=1/Math.tan(t/2);if(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,s!=null&&s!==1/0){let i=1/(n-s);e[10]=(s+n)*i,e[14]=2*s*n*i}else e[10]=-1,e[14]=-2*n;return e}var xa=Zu;function $T(e,t,r,n,s){let o=1/Math.tan(t/2);if(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,s!=null&&s!==1/0){let i=1/(n-s);e[10]=s*i,e[14]=s*n*i}else e[10]=-1,e[14]=-n;return e}function tE(e,t,r,n){let s=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(i+a),l=2/(s+o);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((i-a)*c*.5),e[9]=(s-o)*l*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function $u(e,t,r,n,s,o,i){let a=1/(t-r),c=1/(n-s),l=1/(o-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=(i+o)*l,e[15]=1,e}var ya=$u;function eE(e,t,r,n,s,o,i){let a=1/(t-r),c=1/(n-s),l=1/(o-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=o*l,e[15]=1,e}function Ta(e,t,r,n){let s,o,i,a,c,l,f,u,h,d,p=t[0],A=t[1],m=t[2],y=n[0],_=n[1],E=n[2],M=r[0],B=r[1],C=r[2];return Math.abs(p-M)<1e-6&&Math.abs(A-B)<1e-6&&Math.abs(m-C)<1e-6?Yu(e):(u=p-M,h=A-B,d=m-C,s=1/Math.sqrt(u*u+h*h+d*d),u*=s,h*=s,d*=s,o=_*d-E*h,i=E*u-y*d,a=y*h-_*u,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=h*a-d*i,l=d*o-u*a,f=u*i-h*o,s=Math.sqrt(c*c+l*l+f*f),s?(s=1/s,c*=s,l*=s,f*=s):(c=0,l=0,f=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=i,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=f,e[10]=d,e[11]=0,e[12]=-(o*p+i*A+a*m),e[13]=-(c*p+l*A+f*m),e[14]=-(u*p+h*A+d*m),e[15]=1,e)}function rE(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=n[0],c=n[1],l=n[2],f=s-r[0],u=o-r[1],h=i-r[2],d=f*f+u*u+h*h;d>0&&(d=1/Math.sqrt(d),f*=d,u*=d,h*=d);let p=c*h-l*u,A=l*f-a*h,m=a*u-c*f;return d=p*p+A*A+m*m,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,m*=d),e[0]=p,e[1]=A,e[2]=m,e[3]=0,e[4]=u*m-h*A,e[5]=h*p-f*m,e[6]=f*A-u*p,e[7]=0,e[8]=f,e[9]=u,e[10]=h,e[11]=0,e[12]=s,e[13]=o,e[14]=i,e[15]=1,e}function nE(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`}function sE(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function oE(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[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function th(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[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function iE(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[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function aE(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function cE(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function lE(e,t){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=e[9],h=e[10],d=e[11],p=e[12],A=e[13],m=e[14],y=e[15],_=t[0],E=t[1],M=t[2],B=t[3],C=t[4],L=t[5],b=t[6],T=t[7],g=t[8],S=t[9],R=t[10],F=t[11],v=t[12],G=t[13],X=t[14],z=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(i-C)<=1e-6*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))&&Math.abs(c-b)<=1e-6*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(f-g)<=1e-6*Math.max(1,Math.abs(f),Math.abs(g))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-R)<=1e-6*Math.max(1,Math.abs(h),Math.abs(R))&&Math.abs(d-F)<=1e-6*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(p-v)<=1e-6*Math.max(1,Math.abs(p),Math.abs(v))&&Math.abs(A-G)<=1e-6*Math.max(1,Math.abs(A),Math.abs(G))&&Math.abs(m-X)<=1e-6*Math.max(1,Math.abs(m),Math.abs(X))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var fE=mn,uE=th;function hE(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function eh(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}function rh(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}function nh(e){let t=e[0],r=e[1],n=e[2],s=e[3];return Math.sqrt(t*t+r*r+n*n+s*s)}function sh(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function oh(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=r*i,e[1]=n*i,e[2]=s*i,e[3]=o*i,e}function ih(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function ah(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e[3]=a+n*(r[3]-a),e}function ch(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3];return e[0]=r[0]*n+r[4]*s+r[8]*o+r[12]*i,e[1]=r[1]*n+r[5]*s+r[9]*o+r[13]*i,e[2]=r[2]*n+r[6]*s+r[10]*o+r[14]*i,e[3]=r[3]*n+r[7]*s+r[11]*o+r[15]*i,e}function lh(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2],l=r[3],f=l*n+a*o-c*s,u=l*s+c*n-i*o,h=l*o+i*s-a*n,d=-i*n-a*s-c*o;return e[0]=f*l+d*-i+u*-c-h*-a,e[1]=u*l+d*-a+h*-i-f*-c,e[2]=h*l+d*-c+f*-a-u*-i,e[3]=t[3],e}var mv=function(){let e=hE();return function(t,r,n,s,o,i){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var Ma;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(Ma||(Ma={}));var pE=45*Math.PI/180,mE=1,Ea=.1,_a=500,gE=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),O=class extends Sr{static get IDENTITY(){return xE()}static get ZERO(){return AE()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ma}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this[9]=f,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=A,this[15]=m,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=i,this[6]=f,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=A,this[12]=s,this[13]=c,this[14]=h,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(gE)}fromObject(t){return this.check()}fromQuaternion(t){return ga(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:s,top:o,near:i=Ea,far:a=_a}=t;return a===1/0?yE(this,r,n,s,o,i):Aa(this,r,n,s,o,i,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=t;return Ta(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:o,near:i=Ea,far:a=_a}=t;return ya(this,r,n,s,o,i,a),this.check()}orthographic(t){let{fovy:r=pE,aspect:n=mE,focalDistance:s=1,near:o=Ea,far:i=_a}=t;fh(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:i})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:o=500}=t;return fh(r),xa(this,r,n,s,o),this.check()}determinant(){return la(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return aa(this,this),this.check()}invert(){return ca(this,this),this.check()}multiplyLeft(t){return mn(this,t,this),this.check()}multiplyRight(t){return mn(this,this,t),this.check()}rotateX(t){return da(this,this,t),this.check()}rotateY(t){return pa(this,this,t),this.check()}rotateZ(t){return ma(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return ha(this,this,t,r),this.check()}scale(t){return ua(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return fa(this,this,t),this.check()}transform(t,r){return t.length===4?(r=ch(r||[-0,-0,-0,-0],t,this),Ee(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=Vs(r||[-0,-0],t,this);break;case 3:s=ke(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(s,t.length),s}transformAsVector(t,r){let n;switch(t.length){case 2:n=Hs(r||[-0,-0],t,this);break;case 3:n=zs(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ee(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},Ks,Qs;function AE(){return Ks||(Ks=new O([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ks)),Ks}function xE(){return Qs||(Qs=new O,Object.freeze(Qs)),Qs}function fh(e){if(e>Math.PI*2)throw Error("expected radians")}function yE(e,t,r,n,s,o){let i=2*o/(r-t),a=2*o/(s-n),c=(r+t)/(r-t),l=(s+n)/(s-n),f=-1,u=-1,h=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=f,e[11]=u,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}function uh(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function hh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ba(e,t,r){r=r*.5;let 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 Ba(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*f+i*a+s*l-o*c,e[1]=s*f+i*c+o*a-n*l,e[2]=o*f+i*l+n*c-s*a,e[3]=i*f-n*a-s*c-o*l,e}function dh(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=s*c+o*a,e[2]=o*c-s*a,e[3]=i*c-n*a,e}function ph(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=s*c+i*a,e[2]=o*c+n*a,e[3]=i*c-s*a,e}function mh(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=s*c-n*a,e[2]=o*c+i*a,e[3]=i*c-o*a,e}function gh(e,t){let r=t[0],n=t[1],s=t[2];return e[0]=r,e[1]=n,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),e}function An(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return h=s*c+o*l+i*f+a*u,h<0&&(h=-h,c=-c,l=-l,f=-f,u=-u),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-n)*d)/m,A=Math.sin(n*d)/m):(p=1-n,A=n),e[0]=p*s+A*c,e[1]=p*o+A*l,e[2]=p*i+A*f,e[3]=p*a+A*u,e}function Ah(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=o*a,e}function xh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ca(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*n,n=.5/n,e[3]=(t[o*3+i]-t[i*3+o])*n,e[o]=(t[o*3+s]+t[s*3+o])*n,e[i]=(t[i*3+s]+t[s*3+i])*n}return e}var yh=eh;var Th=rh,Eh=ih,_h=ah,Mh=nh;var bh=sh;var Bh=oh;var Ch=function(){let e=ks(),t=Js(1,0,0),r=Js(0,1,0);return function(n,s,o){let i=hn(s,o);return i<-.999999?(qe(e,t,s),ra(e)<1e-6&&qe(e,r,s),Qi(e,e),ba(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(qe(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,Bh(n,n))}}(),wv=function(){let e=uh(),t=uh();return function(r,n,s,o,i,a){return An(e,n,i,a),An(t,s,o,a),An(r,e,t,2*a*(1-a)),r}}(),Lv=function(){let e=zu();return function(t,r,n,s){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Bh(t,Ca(t,e))}}();var TE=[0,0,0,1],$t=class extends Te{constructor(t=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Ca(this,t),this.check()}fromAxisRotation(t,r){return ba(this,t,r),this.check()}identity(){return hh(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=V(t)}get y(){return this[1]}set y(t){this[1]=V(t)}get z(){return this[2]}set z(t){this[2]=V(t)}get w(){return this[3]}set w(t){this[3]=V(t)}len(){return Mh(this)}lengthSquared(){return bh(this)}dot(t){return Eh(this,t)}rotationTo(t,r){return Ch(this,t,r),this.check()}add(t){return yh(this,this,t),this.check()}calculateW(){return gh(this,this),this.check()}conjugate(){return xh(this,this),this.check()}invert(){return Ah(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(_h(this,t,r,n),this.check())}multiplyRight(t){return Ba(this,this,t),this.check()}multiplyLeft(t){return Ba(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return dh(this,this,t),this.check()}rotateY(t){return ph(this,this,t),this.check()}rotateZ(t){return mh(this,this,t),this.check()}scale(t){return Th(this,this,t),this.check()}slerp(t,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=TE,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=r;break;default:s=t,o=r,i=n}return An(this,s,o,i),this.check()}transformVector4(t,r=new Cr){return lh(r,t,this),Ee(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Pt={};pt(Pt,{EPSILON1:()=>EE,EPSILON10:()=>LE,EPSILON11:()=>vE,EPSILON12:()=>RE,EPSILON13:()=>FE,EPSILON14:()=>PE,EPSILON15:()=>OE,EPSILON16:()=>NE,EPSILON17:()=>DE,EPSILON18:()=>GE,EPSILON19:()=>UE,EPSILON2:()=>_E,EPSILON20:()=>VE,EPSILON3:()=>ME,EPSILON4:()=>bE,EPSILON5:()=>BE,EPSILON6:()=>CE,EPSILON7:()=>SE,EPSILON8:()=>IE,EPSILON9:()=>wE,PI_OVER_FOUR:()=>zE,PI_OVER_SIX:()=>qE,PI_OVER_TWO:()=>HE,TWO_PI:()=>kE});var EE=.1,_E=.01,ME=.001,bE=1e-4,BE=1e-5,CE=1e-6,SE=1e-7,IE=1e-8,wE=1e-9,LE=1e-10,vE=1e-11,RE=1e-12,FE=1e-13,PE=1e-14,OE=1e-15,NE=1e-16,DE=1e-17,GE=1e-18,UE=1e-19,VE=1e-20,HE=Math.PI/2,zE=Math.PI/4,qE=Math.PI/6,kE=Math.PI*2;function Zs(e,t){t=t===void 0?e[0][0]:t;for(let r of e){let n=r[0]-t;n>180?r[0]-=360:n<-180&&(r[0]+=360)}}function JE(e,t,r){let[n,s]=(0,xn.cellToLatLng)(e),o=t.length;Zs(t,s);let i=t[0]===t[o-1]?o-1:o;for(let a=0;a<i;a++)t[a][0]=ye(s,t[a][0],r),t[a][1]=ye(n,t[a][1],r)}function Sh(e,t,r){let n=e(t,r),[s,o]=(0,xn.cellToLatLng)(n);return[o,s]}function Sa(e,t=1){let r=(0,xn.cellToBoundary)(e,!0);return t!==1?JE(e,r,t):Zs(r),r}function $s(e){let t=new Float64Array(e.length*2),r=0;for(let n of e)t[r++]=n[0],t[r++]=n[1];return t}var jE={getPentagon:{type:"accessor",value:e=>e.pentagon}},yn=class extends Ft{indexToBounds(){let{data:t,getPentagon:r}=this.props;return{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(n,s)=>{let o=r(n,s),i=Su(typeof o=="string"?Iu(o):o,{closedRing:!0,segments:"auto"});return $s(i)}}}};yn.layerName="A5Layer";yn.defaultProps=jE;var Ih=yn;var tr=D(qt(),1),Kd=D(zt(),1);function XE(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function to(e){if(Array.isArray(e))return e.map(t=>to(t));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[XE(r)]=to(n);return t}return e}var ad=D(id(),1);function Na(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,o,i,a)=>Boolean(t?.arrayPaths?.some(l=>o===l)),...t?._fastXML},n=rM(e,r);return t?.uncapitalizeKeys?to(n):n}function rM(e,t){return new ad.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var nM="4.3.3",Jt={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:nM,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:sM,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Na(new TextDecoder().decode(e),{...Jt.options.xml,...t?.xml}),parseTextSync:(e,t)=>Na(e,{...Jt.options.xml,...t?.xml})};function sM(e){return e.startsWith("<?xml")}async function vt(e,t,r,n){return n._parse(e,t,r,n)}function H(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var te={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},oM=te.self||te.window||te.global||{},iM=te.window||te.self||te.global||{},aM=te.global||te.self||te.window||{},cM=te.document||{};var _n=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var cd=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),lM=cd&&parseFloat(cd[1])||0;var ro=globalThis,fM=globalThis.document||{},no=globalThis.process||{},uM=globalThis.console,IR=globalThis.navigator||{};function ld(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function Xe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||ld()}var Da="4.1.0";function dM(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var so=class{constructor(t,r,n="sessionStorage"){this.storage=dM(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function fd(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function ud(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var oo;(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"})(oo||(oo={}));var pM=10;function hd(e){return typeof e!="string"?e:(e=e.toUpperCase(),oo[e]||oo.WHITE)}function dd(e,t,r){return!Xe&&typeof e=="string"&&(t&&(e=`\x1B[${hd(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${hd(r)+pM}m${e}\x1B[49m`)),e}function pd(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),s=e;for(let o of n){let i=s[o];typeof i=="function"&&(t.find(a=>o===a)||(s[o]=i.bind(e)))}}function Mn(e,t){if(!e)throw new Error(t||"Assertion failed")}function We(){let e;if(Xe()&&ro.performance)e=ro?.performance?.now?.();else if("hrtime"in no){let t=no?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Ir={debug:Xe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},mM={enabled:!0,level:0};function wr(){}var md={},gd={once:!0},be=class{constructor({id:t}={id:""}){this.VERSION=Da,this._startTs=We(),this._deltaTs=We(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new so(`__probe-${this.id}__`,mM),this.timeStamp(`${this.id} started`),pd(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((We()-this._startTs).toPrecision(10))}getDelta(){return Number((We()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Ir.warn,arguments,gd)}error(t){return this._getLogFunction(0,t,Ir.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,Ir.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Ir.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Ir.debug||Ir.info,arguments,gd)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||wr,n&&[n],{tag:AM(r)}):wr}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||wr)}group(t,r,n={collapsed:!1}){let s=Ad({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return s.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||wr)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=xd(t)}_getLogFunction(t,r,n,s,o){if(this._shouldLog(t)){o=Ad({logLevel:t,message:r,args:s,opts:o}),n=n||o.method,Mn(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=We();let i=o.tag||o.message;if(o.once&&i)if(!md[i])md[i]=We();else return wr;return r=gM(this.id,o.message,o),n.bind(console,r,...o.args)}return wr}};be.VERSION=Da;function xd(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 Mn(Number.isFinite(t)&&t>=0),t}function Ad(e){let{logLevel:t,message:r}=e;e.logLevel=xd(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return Mn(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}function gM(e,t,r){if(typeof t=="string"){let n=r.time?ud(fd(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=dd(t,r.color,r.background)}return t}function AM(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Ga=new be({id:"@probe.gl/log"});var Ua="4.3.3",xM=Ua[0]>="0"&&Ua[0]<="9"?`v${Ua}`:"";function yM(){let e=new be({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=xM,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var Va=yM();function Ha(e,t){return yd(e||{},t)}function yd(e,t,r=0){if(r>3)return t;let n={...e};for(let[s,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)?n[s]=yd(n[s]||{},t[s],r+1):n[s]=t[s];return n}function za(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function qa(e){return globalThis.loaders?.modules?.[e]||null}function TM(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}var Td=TM();function Ed(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var ee={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},cF=ee.self||ee.window||ee.global||{},lF=ee.window||ee.self||ee.global||{},fF=ee.global||ee.self||ee.window||{},uF=ee.document||{};var Lr=typeof process!="object"||String(process)!=="[object process]"||process.browser,io=typeof importScripts=="function",hF=typeof window<"u"&&typeof window.orientation<"u",_d=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),dF=_d&&parseFloat(_d[1])||0;var ka={};async function re(e,t=null,r={},n=null){return t&&(e=Md(e,t,r,n)),ka[e]=ka[e]||EM(e),await ka[e]}function Md(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let s=r.modules||{};return s[n]?s[n]:Lr?r.CDN?(Ed(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Td}/dist/libs/${n}`):io?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function EM(e){if(e.endsWith("wasm"))return await MM(e);if(!Lr)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(io)return importScripts(e);let t=await bM(e);return _M(t,e)}function _M(e,t){if(!Lr){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(io)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function MM(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Lr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function bM(e){let{readFileAsText:t}=globalThis.loaders||{};return Lr||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function Bd(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?bd(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?bd(e,0,t):""}function bd(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),s="";for(let o=0;o<r;o++)s+=String.fromCharCode(n.getUint8(t+o));return s}function Ja(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Bd(e)}"`)}}function bn(...e){let 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');let n=t.reduce((i,a)=>i+a.length,0),s=new r(n),o=0;for(let i of t)s.set(i,o),o+=i.length;return s}function Ye(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function Be(e,t){return H(e>=0),H(t>0),e+(t-1)&~(t-1)}function ja(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let s=e.byteOffset,o=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,s,o)}return t.set(n,r),r+Be(n.byteLength,4)}function Bn(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Ke=class{constructor(t,r){this.sampleSize=1,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.name=t,this.type=r,this.reset()}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}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Bn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Bn()-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}_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)}};var Ce=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,s=this.stats[r];return s||(t instanceof Ke?s=t:s=new Ke(r,n),this.stats[r]=s),s}};var BM="Queued Requests",CM="Active Requests",SM="Cancelled Requests",IM="Queued Requests Ever",wM="Active Requests Ever",LM={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Se=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...LM,...t},this.stats=new Ce({id:this.props.id}),this.stats.get(BM),this.stats.get(CM),this.stats.get(SM),this.stats.get(IM),this.stats.get(wM)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:n}=t,s=!1,o=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Ie={};pt(Ie,{dirname:()=>RM,filename:()=>vM,join:()=>FM,resolve:()=>PM});function Cd(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function vM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function RM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function FM(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function PM(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,s;for(let o=t.length-1;o>=-1&&!n;o--){let i;o>=0?i=t[o]:(s===void 0&&(s=Cd()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Cn)}return r=OM(r,!n),n?`/${r}`:r.length>0?r:"."}var Cn=47,Xa=46;function OM(e,t){let r="",n=-1,s=0,o,i=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===Cn)break;o=Cn}if(o===Cn){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==Xa||r.charCodeAt(r.length-2)!==Xa){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Cn;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,i=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,i=!1;continue}}t&&(r.length>0?r+="/..":r="..",i=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,i=!1}n=a,s=0}else o===Xa&&s!==-1?++s:s=-1}return r}var ao=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=NM(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function NM(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,s)=>t(n,s);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Ot=class extends ao{};sn(Ot,"type","template"),sn(Ot,"testURL",t=>!1);function Sd(e,t){let r=Jt.parseTextSync?.(e,t),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var DM="4.3.3",Sn={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:DM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:GM,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Wa(new TextDecoder().decode(e),t),parseSync:(e,t)=>Wa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Wa(e,t)};function GM(e){return e.startsWith("<?xml")}function Wa(e,t){let r={...Sn.options.wms,...t?.wms},n=Sd(e,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function Qe(e){return Array.isArray(e)?e:e?[e]:[]}function In(e){let t=Qe(e);return t.length>0&&t.every(r=>typeof r=="string")?t:[]}function wn(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function co(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Ze(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Ya(e,t){let r=Jt.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=UM(n);if(t?.inheritedLayerProps)for(let o of s.layers)wd(o,null);return t?.includeRawJSON&&(s.json=n),t?.includeXMLText&&(s.xml=e),s}function UM(e){let t={version:String(e.version||""),name:String(e.Service?.Name||"unnamed"),title:e.Service?.Title?String(e.Service?.Title):void 0,abstract:e.Service?.Abstract?String(e.Service?.Abstract):void 0,keywords:In(e.Service?.KeywordList?.Keyword),fees:e.Service?.Fees?JSON.stringify(e.Service?.Fees):void 0,accessConstraints:e.Service?.AccessConstraints?JSON.stringify(e.Service?.AccessConstraints):void 0,layerLimit:co(e.Service?.LayerLimit),maxWidth:co(e.Service?.maxWidth),maxHeight:co(e.Service?.maxHeight),layers:[],requests:VM(e.Capability?.Request),exceptions:HM(e.Exception)},r=Qe(e.Capability?.Layer);for(let n of r)t.layers.push(Id(n));for(let[n,s]of Object.entries(t))s===void 0&&delete t[n];return t}function VM(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=In(n?.Format);t[r]={mimeTypes:s}}return t}function HM(e){if(Qe(e?.Format).length>0)return{mimeTypes:In(e)}}function Id(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:In(e.KeywordList?.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(l=>typeof l=="string")&&(t.crs=r);let n=e?.EX_GeographicBoundingBox&&zM(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&qM(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&kM(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let i=Qe(e?.Dimension).map(l=>jM(l));i.length&&(t.dimensions=i),e?.opaque&&(t.opaque=Ze(e?.opaque)),e?.cascaded&&(t.cascaded=Ze(e?.cascaded)),e?.queryable&&(t.queryable=Ze(e?.queryable));let a=Qe(e?.Layer),c=[];for(let l of a)c.push(Id(l));c.length>0&&(t.layers=c);for(let[l,f]of Object.entries(t))f===void 0&&delete t[l];return t}function zM(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function qM(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function kM(e){return Qe(e).map(r=>JM(r))}function JM(e){let{CRS:t,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=e,l={crs:t||r,boundingBox:[[wn(n),wn(s)],[wn(o),wn(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function jM(e){let{name:t,units:r,value:n}=e,s={name:t,units:r,extent:n};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=Ze(e.multipleValues)),e.nearestValue&&(s.nearestValue=Ze(e.nearestValue)),e.current&&(s.current=Ze(e.current)),s}function wd(e,t){t?.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t?.crs&&!e.crs&&(e.crs=[...t.crs]),t?.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t?.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let r of e.layers||[])wd(r,e)}var XM="4.3.3",vr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:XM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:WM,options:{wms:{}},parse:async(e,t)=>Ya(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Ya(e,t?.wms)};function WM(e){return e.startsWith("<?xml")}function Ka(e,t){let n=(Jt.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>YM(o))}}function YM(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Ld={...vr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>Ka(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Ka(e,t)};function Qa(e,t){return Jt.parseTextSync?.(e,t)}var vd={...vr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Qa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Qa(e,t)};var Rd="4.3.3";var KM=globalThis.loaders?.parseImageNode,Za=typeof Image<"u",$a=typeof ImageBitmap<"u",QM=Boolean(KM),tc=_n?!0:QM;function Fd(e){switch(e){case"auto":return $a||Za||tc;case"imagebitmap":return $a;case"image":return Za;case"data":return tc;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Pd(){if($a)return"imagebitmap";if(Za)return"image";if(tc)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Od(e){let t=ZM(e);if(!t)throw new Error("Not an image");return t}function Ln(e){switch(Od(e)){case"data":return e;case"image":case"imagebitmap":let 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 ZM(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var $M=/^data:image\/svg\+xml/,tb=/\.svg((\?|#).*)?$/;function lo(e){return e&&($M.test(e)||tb.test(e))}function Nd(e,t){if(lo(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return ec(e,t)}function ec(e,t){if(lo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function fo(e,t,r){let n=Nd(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await eb(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function eb(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var rb={},Dd=!0;async function Gd(e,t,r){let n;lo(r)?n=await fo(e,t,r):n=ec(e,r);let s=t&&t.imagebitmap;return await nb(n,s)}async function nb(e,t=null){if((sb(t)||!Dd)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Dd=!1}return await createImageBitmap(e)}function sb(e){for(let t in e||rb)return!1;return!0}function Ud(e){return!cb(e,"ftyp",4)||!(e[8]&96)?null:ob(e)}function ob(e){switch(ib(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ib(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ab(e){return[...e].map(t=>t.charCodeAt(0))}function cb(e,t,r=0){let n=ab(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var ne=!1,vn=!0;function $e(e){let t=Rn(e);return fb(t)||db(t)||ub(t)||hb(t)||lb(t)}function lb(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Ud(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function fb(e){let t=Rn(e);return t.byteLength>=24&&t.getUint32(0,ne)===2303741511?{mimeType:"image/png",width:t.getUint32(16,ne),height:t.getUint32(20,ne)}:null}function ub(e){let t=Rn(e);return t.byteLength>=10&&t.getUint32(0,ne)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,vn),height:t.getUint16(8,vn)}:null}function hb(e){let t=Rn(e);return t.byteLength>=14&&t.getUint16(0,ne)===16973&&t.getUint32(2,vn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,vn),height:t.getUint32(22,vn)}:null}function db(e){let t=Rn(e);if(!(t.byteLength>=3&&t.getUint16(0,ne)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=pb(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,ne);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,ne),width:t.getUint16(o+7,ne)};if(!n.has(i))return null;o+=2,o+=t.getUint16(o,ne)}return null}function pb(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Rn(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")}async function Vd(e,t){let{mimeType:r}=$e(e)||{},n=globalThis.loaders?.parseImageNode;return H(n),await n(e,r)}async function Hd(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=r||{},i=mb(s),a;switch(i){case"imagebitmap":a=await Gd(e,t,o);break;case"image":a=await fo(e,t,o);break;case"data":a=await Vd(e,t);break;default:H(!1)}return s==="data"&&(a=Ln(a)),a}function mb(e){switch(e){case"auto":case"data":return Pd();default:return Fd(e),e}}var gb=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Ab=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],xb={image:{type:"auto",decode:!0}},Rr={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Rd,mimeTypes:Ab,extensions:gb,parse:Hd,tests:[e=>Boolean($e(new DataView(e)))],options:xb};var rc={};function nc(e){if(rc[e]===void 0){let t=_n?Tb(e):yb(e);rc[e]=t}return rc[e]}function yb(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function Tb(e){switch(e){case"image/avif":case"image/webp":return Eb(e);default:return!0}}function Eb(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var zd={name:"Web Map Service (OGC WMS)",id:"wms",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],options:{wms:{}},type:"wms",fromUrl:!0,fromBlob:!1,testURL:e=>e.toLowerCase().includes("wms"),createDataSource:(e,t)=>new sc(e,t)},sc=class extends Ot{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t,r){super(r),this.url=t,this.data=t,this.substituteCRS84=r.wms?.substituteCRS84??r.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...r.wmsParameters,...r.wms?.wmsParameters},this.vendorParameters=r.wms?.vendorParameters||r.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:r,bbox:n,...s}=t,o={bbox:r?[...r[0],...r[1]]:n,...s};return await this.getMap(o)}normalizeMetadata(t){return t}async getCapabilities(t,r){let n=this.getCapabilitiesURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);let i=await vr.parse(o,this.loadOptions);return this.capabilities=i,i}async getMap(t,r){let n=this.getMapURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await Rr.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(t,r){let n=this.getFeatureInfoURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await Ld.parse(o,this.loadOptions)}async getFeatureInfoText(t,r){let n=this.getFeatureInfoURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),new TextDecoder().decode(o)}async describeLayer(t,r){let n=this.describeLayerURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await vd.parse(o,this.loadOptions)}async getLegendGraphic(t,r){let n=this.getLegendGraphicURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await Rr.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(t,r){t=this._getWMS130Parameters(t);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(t,r){t=this._getWMS130Parameters(t);let{boundingBox:n,bbox:s}=t;t.bbox=n?[...n[0],...n[1]]:s;let o={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",o,r)}describeLayerURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(t){let[r,n]=t.split("?"),s=n.split("&"),o={};for(let i of s){let[a,c]=i.split("=");o[a]=c}return{url:r,parameters:o}}_getWMSUrl(t,r,n){let s=this.url,o=!0,i={service:"WMS",version:r.version,request:t,...r,...this.vendorParameters,...n},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(i))(!a.includes(c)||l)&&(s+=o?"?":"&",o=!1,s+=this._getURLParameter(c,l,r));return encodeURI(s)}_getWMS130Parameters(t){let r={...t};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(t,r,n){switch(t){case"crs":n.version!=="1.3.0"?t="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(r,n);s&&(r=s);break;case"x":n.version==="1.3.0"&&(t="i");break;case"y":n.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(r)?`${t}=${r.join(",")}`:`${t}=${r?String(r):""}`}_flipBoundingBox(t,r){if(!Array.isArray(t)||t.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),s=t;return n?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let r=await this.fetch(t),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(t,r){let n=t.headers["content-type"];if(!t.ok||Sn.mimeTypes.includes(n)){let s=Ha(this.loadOptions,{wms:{throwOnError:!0}}),o=Sn.parseSync?.(r,s);throw new Error(o)}}_parseError(t){let r=Sn.parseSync?.(t,this.loadOptions);return new Error(r)}};var qd={name:"ArcGISImageServer",id:"arcgis-image-server",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],options:{"arcgis-image-server":{}},type:"arcgis-image-server",fromUrl:!0,fromBlob:!1,testURL:e=>e.toLowerCase().includes("ImageServer"),createDataSource:(e,t)=>new oc(e,t)},oc=class extends Ot{url;data;constructor(t,r){super(r),this.url=t,this.data=t}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.url}?f=pjson`}exportImageURL(t){let r=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,n=`size=${t.width},${t.height}`,s={...t,bbox:r,size:n};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,r,n){let s=`${this.url}/${t}`,o=!0;for(let[i,a]of Object.entries(r))s+=o?"?":"&",o=!1,Array.isArray(a)?s+=`${i.toUpperCase()}=${a.join(",")}`:s+=`${i.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}};var _b=[zd,qd];function ic(e,t=_b){let{type:r="auto"}=e,n=r==="auto"?bb(e.url,t):Mb(r,t);if(!n)throw new Error("Not a valid image source type");return n.createDataSource(e.url,e)}function Mb(e,t){for(let r of t)if(r.type===e)return r;return null}function bb(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}function uo(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var jt=Math.PI,Xd=jt/4,kd=jt/180,Jd=180/jt,ho=512;function le(e){let[t,r]=e;uo(Number.isFinite(t)),uo(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*kd,s=r*kd,o=ho*(n+jt)/(2*jt),i=ho*(jt+Math.log(Math.tan(Xd+s*.5)))/(2*jt);return[o,i]}function fe(e){let[t,r]=e,n=t/ho*(2*jt)-jt,s=2*(Math.atan(Math.exp(r/ho*(2*jt)-jt))-Xd);return[n*Jd,s*Jd]}var zO=Math.PI/180;var Yd=6378137*Math.PI;function ac(e){let t=le(e);return t[0]=(t[0]/256-1)*Yd,t[1]=(t[1]/256-1)*Yd,t}var Vb={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(e,t)=>console.error(t,e)}},Fr=class extends tr.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:t,props:r,oldProps:n}){let{viewport:s}=this.context;t.dataChanged||r.serviceType!==n.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,tr._deepEqual)(r.layers,n.layers,1)?t.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:t,image:r,lastRequestParameters:n}=this.state;return r&&new Kd.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?tr.COORDINATE_SYSTEM.LNGLAT:tr.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:r})}async getFeatureInfoText(t,r){let{lastRequestParameters:n}=this.state;return n?await this.state.imageSource.getFeatureInfoText?.({...n,query_layers:n.layers,x:t,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof Ot)return t.data;if(typeof t.data=="string")return ic({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let r=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(t,r){let{layers:n,serviceType:s}=this.props;if(s==="wms"&&n.length===0)return;let o=t.getBounds(),{width:i,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let f={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let u=ac([o[0],o[1]]),h=ac([o[2],o[3]]);f.boundingBox=[u,h]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let u=await this.state.imageSource.getImage(f);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:u,bounds:o,lastRequestParameters:f,lastRequestId:c}))}catch(u){this.raiseError(u,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,u)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),r)}};Fr.layerName="WMSLayer";Fr.defaultProps=Vb;var Qd=D(zt(),1),Hb={getHeight:{type:"accessor",value:0},greatCircle:!0},Fn=class extends Qd.ArcLayer{};Fn.layerName="GreatCircleLayer";Fn.defaultProps=Hb;var Zd=Fn;var po=D(cc(),1),zb=3,qb=30,kb=2*qb+1,tp=180/Math.PI;function rp(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function ep(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function np(e){return[ep(e[0]),ep(e[1])]}function sp(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function op([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*tp,n*tp]}function ip(e){let t=po.default.fromString(e,!0,10).toString(2);for(;t.length<zb+kb;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=po.default.fromString(n,!0,2).toString(10),a=po.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function Jb(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function ap(e){let t=e.split("/"),r=parseInt(t[0],10),n=t[1],s=n.length,o=[0,0],i;for(let a=s-1;a>=0;a--){i=s-a;let c=n[a],l=0,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,i-1);Jb(u,o,l,f),o[0]+=u*l,o[1]+=u*f}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var cp=D(cc(),1);function jb(e){let t=e.padEnd(16,"0");return cp.default.fromString(t,16)}var Xb=100;function Wb({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(Xb*Math.pow(2,-r))),o=new Float64Array(4*s*2+2),i=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),f=n[c+1],u=(f[0]-l[0])/s,h=(f[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=u,l[1]+=h;let p=rp(t,r,l),A=np(p),m=sp(e,A),y=op(m);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-180?360:0,o[i++]=y[0],o[i++]=y[1],a=y[0]}}return o[i++]=o[0],o[i++]=o[1],o}function Yb(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=jb(e)}return ip(e.toString())}function lp(e){let t=Yb(e),r=ap(t);return Wb(r)}var Kb={getS2Token:{type:"accessor",value:e=>e.token}},On=class extends Ft{indexToBounds(){let{data:t,getS2Token:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>lp(r(n,s))}}};On.layerName="S2Layer";On.defaultProps=Kb;var fp=On;var lc=512;function Qb(e,t){let r=0,n=0,s=1<<e.length,o=s/lc;for(let i=0;i<e.length;i++){s>>=1;let a=parseInt(e[i]);a%2&&(r|=s),a>1&&(n|=s)}return[[r/o,lc-n/o],[(r+t)/o,lc-(n+t)/o]]}function up(e,t=1){let[r,n]=Qb(e,t),[s,o]=fe(r),[i,a]=fe(n);return[i,o,i,a,s,a,s,o,i,o]}var Zb={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Nn=class extends Ft{indexToBounds(){let{data:t,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>up(n(o,i),s),updateTriggers:{getPolygon:s}}}};Nn.layerName="QuadkeyLayer";Nn.defaultProps=Zb;var hp=Nn;var _o=D(qt(),1),wp=D(zt(),1);var er=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:r,onLoad:n,onError:s}){let{index:o,id:i,bbox:a,userData:c,zoom:l}=this,f=this._loaderId;this._abortController=new AbortController;let{signal:u}=this._abortController,h=await r.scheduleRequest(this,A=>A.isSelected?1:-1);if(!h){this._isCancelled=!0;return}if(this._isCancelled){h.done();return}let d=null,p;try{d=await t({index:o,id:i,bbox:a,userData:c,zoom:l,signal:u})}catch(A){p=A||!0}finally{h.done()}if(f===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):n(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var Un=D(qt(),1);var it={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var dp=new x,$b=new x,we=class{constructor(t=[0,0,0],r=[0,0,0],n){n=n||dp.copy(t).add(r).scale(.5),this.center=new x(n),this.halfDiagonal=new x(r).subtract(this.center),this.minimum=new x(t),this.maximum=new x(r)}clone(){return new we(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,n=$b.from(t.normal),s=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),o=this.center.dot(n)+t.distance;return o-s>0?it.INSIDE:o+s<0?it.OUTSIDE:it.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=dp.from(t).subtract(this.center),{halfDiagonal:n}=this,s=0,o;return o=Math.abs(r.x)-n.x,o>0&&(s+=o*o),o=Math.abs(r.y)-n.y,o>0&&(s+=o*o),o=Math.abs(r.z)-n.z,o>0&&(s+=o*o),s}};var Dn=new x,pp=new x,Nt=class{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new x,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Dn.from(r),this.center=new x().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Nt(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,o=t.radius,i=Dn.copy(s).subtract(r),a=i.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return pp.copy(i).scale((-n+c)/a).add(r),this.center.copy(pp),this.radius=c,this}expand(t){let n=Dn.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=gn.getScaling(Dn,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=Dn.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?it.OUTSIDE:o<n?it.INTERSECTING:it.INSIDE}};var tB=new x,eB=new x,mo=new x,go=new x,Ao=new x,rB=new x,nB=new x,ue={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Xt=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new x().from(t),this.halfAxes=new J(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new x(t).len(),new x(r).len(),new x(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),s=new x(t).normalize(),o=new x(r).normalize(),i=new x(n).normalize();return new $t().fromMatrix3(new J([...s,...o,...i]))}fromCenterHalfSizeQuaternion(t,r,n){let s=new $t(n),o=new J().fromQuaternion(s);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new x().from(t),this.halfAxes=o,this}clone(){return new Xt(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Nt){let r=this.halfAxes,n=r.getColumn(0,mo),s=r.getColumn(1,go),o=r.getColumn(2,Ao),i=tB.copy(n).add(s).add(o);return t.center.copy(this.center),t.radius=i.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,s=this.halfAxes,o=n.x,i=n.y,a=n.z,c=Math.abs(o*s[ue.COLUMN0ROW0]+i*s[ue.COLUMN0ROW1]+a*s[ue.COLUMN0ROW2])+Math.abs(o*s[ue.COLUMN1ROW0]+i*s[ue.COLUMN1ROW1]+a*s[ue.COLUMN1ROW2])+Math.abs(o*s[ue.COLUMN2ROW0]+i*s[ue.COLUMN2ROW1]+a*s[ue.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?it.OUTSIDE:l>=c?it.INSIDE:it.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=eB.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,mo),o=n.getColumn(1,go),i=n.getColumn(2,Ao),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let f=0,u;return u=Math.abs(r.dot(s))-a,u>0&&(f+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(f+=u*u),u=Math.abs(r.dot(i))-l,u>0&&(f+=u*u),f}computePlaneDistances(t,r,n=[-0,-0]){let s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=this.center,a=this.halfAxes,c=a.getColumn(0,mo),l=a.getColumn(1,go),f=a.getColumn(2,Ao),u=rB.copy(c).add(l).add(f).add(i),h=nB.copy(u).subtract(t),d=r.dot(h);return s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).add(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),n[0]=s,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,mo);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,go);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Ao);return s.transformAsPoint(t),this.halfAxes=new J([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var mp=new x,gp=new x,ut=class{constructor(t=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return ft(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=mp.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,s){return this.normal.set(t,r,n),ft(Et(this.normal.len(),1)),this.distance=s,this}clone(){return new ut(this.normal,this.distance)}equals(t){return Et(this.distance,t.distance)&&Et(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=gp.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=mp.from(t),s=this.getPointDistance(n),o=gp.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var Ap=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],xp=new x,sB=new x,ct=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Ap.length;let r=t.center,n=t.radius,s=0;for(let o of Ap){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new ut),a||(a=this.planes[s+1]=new ut);let c=xp.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=xp.copy(o).scale(n).add(r),f=sB.copy(o).negate();a.fromPointNormal(l,f),s+=2}return this}computeVisibility(t){let r=it.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case it.OUTSIDE:return it.OUTSIDE;case it.INTERSECTING:r=it.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(ft(Number.isFinite(r),"parentPlaneMask is required."),r===ct.MASK_OUTSIDE||r===ct.MASK_INSIDE)return r;let n=ct.MASK_INSIDE,s=this.planes;for(let o=0;o<this.planes.length;++o){let i=o<31?1<<o:0;if(o<31&&!(r&i))continue;let a=s[o],c=t.intersectPlane(a);if(c===it.OUTSIDE)return ct.MASK_OUTSIDE;c===it.INTERSECTING&&(n|=i)}return n}};ct.MASK_OUTSIDE=4294967295;ct.MASK_INSIDE=0;ct.MASK_INDETERMINATE=2147483647;var sD=new x,oD=new x,iD=new x,aD=new x,cD=new x;var pD=new x,mD=new x,gD=new x,AD=new x,xD=new x,yD=new x,TD=new x,ED=new x,_D=new x,MD=new x,bD=new x,BD=new x;var se=new J,iB=new J,aB=new J,xo=new J,yp=new J;function hc(e,t={}){let r=Pt.EPSILON20,n=10,s=0,o=0,i=iB,a=aB;i.identity(),a.copy(e);let c=r*cB(a);for(;o<n&&lB(a)>c;)fB(a,xo),yp.copy(xo).transpose(),a.multiplyRight(xo),a.multiplyLeft(yp),i.multiplyRight(xo),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function cB(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var fc=[1,0,0],uc=[2,2,1];function lB(e){let t=0;for(let r=0;r<3;++r){let n=e[se.getElementIndex(uc[r],fc[r])];t+=2*n*n}return Math.sqrt(t)}function fB(e,t){let r=Pt.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let f=Math.abs(e[se.getElementIndex(uc[l],fc[l])]);f>n&&(s=l,n=f)}let o=fc[s],i=uc[s],a=1,c=0;if(Math.abs(e[se.getElementIndex(i,o)])>r){let l=e[se.getElementIndex(i,i)],f=e[se.getElementIndex(o,o)],u=e[se.getElementIndex(i,o)],h=(l-f)/2/u,d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),c=d*a}return J.IDENTITY.to(t),t[se.getElementIndex(o,o)]=t[se.getElementIndex(i,i)]=a,t[se.getElementIndex(i,o)]=c,t[se.getElementIndex(o,i)]=-c,t}var Le=new x,uB=new x,hB=new x,dB=new x,pB=new x,mB=new J,gB={diagonal:new J,unitary:new J};function Gn(e,t=new Xt){if(!e||e.length===0)return t.halfAxes=new J([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let r=e.length,n=new x(0,0,0);for(let T of e)n.add(T);let s=1/r;n.multiplyByScalar(s);let o=0,i=0,a=0,c=0,l=0,f=0;for(let T of e){let g=Le.copy(T).subtract(n);o+=g.x*g.x,i+=g.x*g.y,a+=g.x*g.z,c+=g.y*g.y,l+=g.y*g.z,f+=g.z*g.z}o*=s,i*=s,a*=s,c*=s,l*=s,f*=s;let u=mB;u[0]=o,u[1]=i,u[2]=a,u[3]=i,u[4]=c,u[5]=l,u[6]=a,u[7]=l,u[8]=f;let{unitary:h}=hc(u,gB),d=t.halfAxes.copy(h),p=d.getColumn(0,hB),A=d.getColumn(1,dB),m=d.getColumn(2,pB),y=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,M=Number.MAX_VALUE,B=Number.MAX_VALUE,C=Number.MAX_VALUE;for(let T of e)Le.copy(T),y=Math.max(Le.dot(p),y),_=Math.max(Le.dot(A),_),E=Math.max(Le.dot(m),E),M=Math.min(Le.dot(p),M),B=Math.min(Le.dot(A),B),C=Math.min(Le.dot(m),C);p=p.multiplyByScalar(.5*(M+y)),A=A.multiplyByScalar(.5*(B+_)),m=m.multiplyByScalar(.5*(C+E)),t.center.copy(p).add(A).add(m);let L=uB.set(y-M,_-B,E-C).multiplyByScalar(.5),b=new J([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(b),t}var Pr=512,Tp=3,Ep=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],_p=Ep.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),AB=_p.concat([[.25,.5],[.75,.5]]),ve=class{constructor(t,r,n){this.x=t,this.y=r,this.z=n}get children(){if(!this._children){let t=this.x*2,r=this.y*2,n=this.z+1;this._children=[new ve(t,r,n),new ve(t,r+1,n),new ve(t+1,r,n),new ve(t+1,r+1,n)]}return this._children}update(t){let{viewport:r,cullingVolume:n,elevationBounds:s,minZ:o,maxZ:i,bounds:a,offset:c,project:l}=t,f=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(f)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<i&&h>=o){let d=f.distanceTo(r.cameraPosition)*r.scale/r.height;h+=Math.floor(Math.log2(d))}if(h>=i)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let h of this.children)h.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}insideBounds([t,r,n,s]){let o=Math.pow(2,this.z),i=Pr/o;return this.x*i<n&&this.y*i<s&&(this.x+1)*i>t&&(this.y+1)*i>r}getBoundingVolume(t,r,n){if(n){let c=this.z<1?AB:this.z<2?_p:Ep,l=[];for(let f of c){let u=yo(this.x+f[0],this.y+f[1],this.z);u[2]=t[0],l.push(n(u)),t[0]!==t[1]&&(u[2]=t[1],l.push(n(u)))}return Gn(l)}let s=Math.pow(2,this.z),o=Pr/s,i=this.x*o+r*Pr,a=Pr-(this.y+1)*o;return new we([i,a,t[0]],[i+o,a+o,t[1]])}};function Mp(e,t,r,n){let s=e instanceof Un._GlobeViewport&&e.resolution?e.projectPosition:null,o=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new ut(d.clone().negate(),p)),i=new ct(o),a=e.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,f=e instanceof Un.WebMercatorViewport&&e.pitch<=60?t:0;if(n){let[d,p,A,m]=n,y=le([d,m]),_=le([A,p]);n=[y[0],Pr-y[1],_[0],Pr-_[1]]}let u=new ve(0,0,0),h={viewport:e,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:f,maxZ:t,bounds:n,offset:0};if(u.update(h),e instanceof Un.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(h.offset=-1;u.update(h)&&!(--h.offset<-Tp););for(h.offset=1;u.update(h)&&!(++h.offset>Tp););}return u.getSelected()}var he=512,xB=[-1/0,-1/0,1/0,1/0],Re={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(r=>typeof r=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}};function To(e,t){let r=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...r.map(s=>s[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function yB(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function oe(e,t){if(!e||!e.length)return null;let{index:r,id:n}=t;if(Array.isArray(e)){let o=yB(n)%e.length;e=e[o]}let s=e;for(let o of Object.keys(r)){let i=new RegExp(`{${o}}`,"g");s=s.replace(i,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),s}function TB(e,t,r){let n;if(t&&t.length===2){let[s,o]=t,i=e.getBounds({z:s}),a=e.getBounds({z:o});n=[Math.min(i[0],a[0]),Math.min(i[1],a[1]),Math.max(i[2],a[2]),Math.max(i[3],a[3])]}else n=e.getBounds();return e.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function Bp({viewport:e,z:t,cullRect:r}){return(e.subViewports||[e]).map(s=>dc(s,t||0,r))}function dc(e,t,r){if(!Array.isArray(t)){let o=r.x-e.x,i=r.y-e.y,{width:a,height:c}=r,l={targetZ:t},f=e.unproject([o,i],l),u=e.unproject([o+a,i],l),h=e.unproject([o,i+c],l),d=e.unproject([o+a,i+c],l);return[Math.min(f[0],u[0],h[0],d[0]),Math.min(f[1],u[1],h[1],d[1]),Math.max(f[0],u[0],h[0],d[0]),Math.max(f[1],u[1],h[1],d[1])]}let n=dc(e,t[0],r),s=dc(e,t[1],r);return[Math.min(n[0],s[0]),Math.min(n[1],s[1]),Math.max(n[2],s[2]),Math.max(n[3],s[3])]}function EB(e,t,r){return r?To(e,r).map(s=>s*t/he):e.map(n=>n*t/he)}function pc(e,t){return Math.pow(2,e)*he/t}function yo(e,t,r){let n=pc(r,he),s=e/n*360-180,o=Math.PI-2*Math.PI*t/n,i=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[s,i]}function bp(e,t,r,n){let s=pc(r,n);return[e/s*he,t/s*he]}function mc(e,t,r,n,s=he){if(e.isGeospatial){let[l,f]=yo(t,r,n),[u,h]=yo(t+1,r+1,n);return{west:l,north:f,east:u,south:h}}let[o,i]=bp(t,r,n,s),[a,c]=bp(t+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function _B(e,t,r,n,s){let o=TB(e,null,n),i=pc(t,r),[a,c,l,f]=EB(o,i,s),u=[];for(let h=Math.floor(a);h<l;h++)for(let d=Math.floor(c);d<f;d++)u.push({x:h,y:d,z:t});return u}function gc({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=he,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(he/o))+c:Math.ceil(e.zoom)+c;if(typeof r=="number"&&Number.isFinite(r)&&l<r){if(!s)return[];l=r}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let f=s;return i&&a&&s&&!e.isGeospatial&&(f=To(s,i)),e.isGeospatial?Mp(e,l,n,s):_B(e,l,o,f||xB,a)}function Ac(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function xc(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function Cp(e){let t={},r;return n=>{for(let s in n)if(!MB(n[s],t[s])){r=e(n),t=n;break}return r}}function MB(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}return!1}var Sp=1,Eo=2,bB="never",BB="no-overlap",Vn="best-available",CB=5,SB={[Vn]:wB,[BB]:LB,[bB]:()=>{}},IB={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},rr=class{constructor(t){this._getCullBounds=Cp(Bp),this.opts={...IB,...t},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new Se({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new O,this._modelMatrixInverse=new O}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:n}={zRange:null,modelMatrix:null}){let s=n?new O(n):new O,o=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Et(this._zRange,r)||o){o&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=r;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let i=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),i&&this._frameNumber++,this._frameNumber}isTileVisible(t,r,n){if(!t.isVisible)return!1;if(r&&this._viewport){let s=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:o}=t;for(let[i,a,c,l]of s){let f;if("west"in o)f=o.west<c&&o.east>i&&o.south<l&&o.north>a;else{if(n&&!O.IDENTITY.equals(n)){let[d,p,A,m]=To([o.left,o.top,o.right,o.bottom],n);o={left:d,top:p,right:A,bottom:m}}let u=Math.min(o.top,o.bottom),h=Math.max(o.top,o.bottom);f=o.left<c&&o.right>i&&u<l&&h>a}if(f)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:n,zRange:s,modelMatrix:o,modelMatrixInverse:i}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return gc({viewport:t,maxZoom:r,minZoom:n,zRange:s,tileSize:a,extent:c,modelMatrix:o,modelMatrixInverse:i,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;return{bbox:mc(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2),n=Math.floor(t.y/2),s=t.z-1;return{x:r,y:n,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||Vn,r=new Array(this._cache.size),n=0;for(let s of this._cache.values())r[n++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:SB[t])(Array.from(this._cache.values())),n=0;for(let s of this._cache.values())if(r[n++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],n=0;for(let s of this._cache.values())s.isLoading&&(n++,!s.isSelected&&!s.isVisible&&r.push(s));for(;t>0&&n>t&&r.length>0;)r.shift().abort(),n--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let n=this._getNearestAncestor(r);r.parent=n,n?.children&&n.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,n=r.maxCacheSize??(r.maxCacheByteSize!==null?1/0:CB*this.selectedTiles.length),s=r.maxCacheByteSize??1/0;if(t.size>n||this._cacheByteSize>s){for(let[i,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize!==null?a.byteLength:0,t.delete(i),this.opts.onTileUnload?.(a)),t.size<=n&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((i,a)=>i.zoom-a.zoom),this._dirty=!1)}_getTile(t,r){let n=this.getTileId(t),s=this._cache.get(n),o=!1;return!s&&r?(s=new er(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:n,zoom:this.getTileZoom(s.index)}),o=!0,this._cache.set(n,s),this._dirty=!0):s&&s.needsReload&&(o=!0),s&&o&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:r=0}=this,n=t.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let s=this._getTile(n);if(s)return s}return null}};function wB(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Ip(t)&&yc(t);for(let t of e)t.isVisible=Boolean(t.state&Eo)}function LB(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&Ip(r);let t=Array.from(e).sort((r,n)=>r.zoom-n.zoom);for(let r of t)if(r.isVisible=Boolean(r.state&Eo),r.children&&(r.isVisible||r.state&Sp))for(let n of r.children)n.state=Sp;else r.isSelected&&yc(r)}function Ip(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Eo,!0;t=t.parent}return!1}function yc(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Eo:yc(t)}var vB={TilesetClass:rr,data:{type:"data",value:[]},dataComparator:Re.equal,renderSubLayers:{type:"function",value:e=>new wp.GeoJsonLayer(e)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:e=>console.error(e)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Vn,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Hn=class extends _o.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,n=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?n&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:n,refinementStrategy:s,extent:o,maxZoom:i,minZoom:a,maxRequests:c,debounceTime:l,zoomOffset:f}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:t,refinementStrategy:s,extent:o,maxRequests:c,debounceTime:l,zoomOffset:f,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:r,modelMatrix:n}=this.props,s=t.update(this.context.viewport,{zRange:r,modelMatrix:n}),{isLoaded:o}=t,i=this.state.isLoaded!==o,a=this.state.frameNumber!==s;o&&(i||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:n,fetch:s}=this.props,{signal:o}=t;return t.url=typeof r=="string"||Array.isArray(r)?oe(r,t):null,n?n(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let r=t.sourceLayer,n=r.props.tile,s=t.info;return s.picked&&(s.tile=n),s.sourceTile=n,s.sourceTileSubLayer=r,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)r&&t.layers[0]&&Object.keys(r).some(n=>t.layers[0].props[n]!==r[n])&&(t.layers=t.layers.map(n=>n.clone(r)));else{let n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,_o._flatten)(n,Boolean).map(s=>s.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:n}=t.props,{modelMatrix:s}=this.props;return this.state.tileset.isTileVisible(n,r,s?new O(s):null)}};Hn.defaultProps=vB;Hn.layerName="TileLayer";var nr=Hn;var Rp=D(zt(),1);var Lp=`uniform tripsUniforms {
|
|
13
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}be.prototype.build=function(e){return this.options.preserveOrder?W_(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};be.prototype.j2x=function(e,t){let r="",n="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(n+="");else if(e[s]===null)this.isAttribute(s)?n+="":s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)n+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let o=this.isAttribute(s);if(o)r+=this.buildAttrPairStr(o,""+e[s]);else if(s===this.options.textNodeName){let i=this.options.tagValueProcessor(s,""+e[s]);n+=this.replaceEntitiesValue(i)}else n+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let o=e[s].length,i="",a="";for(let c=0;c<o;c++){let l=e[s][c];if(!(typeof l>"u"))if(l===null)s[0]==="?"?n+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let f=this.j2x(l,t+1);i+=f.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(a+=f.attrStr)}else i+=this.processTextOrObjNode(l,s,t);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(s,l);f=this.replaceEntitiesValue(f),i+=f}else i+=this.buildTextValNode(l,s,"",t)}this.options.oneListGroup&&(i=this.buildObjectNode(i,s,a,t)),n+=i}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let o=Object.keys(e[s]),i=o.length;for(let a=0;a<i;a++)r+=this.buildAttrPairStr(o[a],""+e[s][o[a]])}else n+=this.processTextOrObjNode(e[s],s,t);return{attrStr:r,val:n}};be.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function K_(e,t,r){let n=this.j2x(e,r+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,n.attrStr,r):this.buildObjectNode(n.val,t,n.attrStr,r)}be.prototype.buildObjectNode=function(e,t,r,n){if(e==="")return t[0]==="?"?this.indentate(n)+"<"+t+r+"?"+this.tagEndChar:this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",s=""),(r||r==="")&&e.indexOf("<")===-1?this.indentate(n)+"<"+t+r+o+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${e}-->`+this.newLine:this.indentate(n)+"<"+t+r+o+this.tagEndChar+e+this.indentate(n)+s}};be.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};be.prototype.buildTextValNode=function(e,t,r,n){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(n)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar:this.indentate(n)+"<"+t+r+">"+s+"</"+t+this.tagEndChar}};be.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let r=this.options.entities[t];e=e.replace(r.regex,r.val)}return e};function Q_(e){return this.options.indentBy.repeat(e)}function Z_(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}id.exports=be});var ld=rt((yR,cd)=>{"use strict";var $_=La(),tM=td(),eM=ad();cd.exports={XMLParser:tM,XMLValidator:$_,XMLBuilder:eM}});var uc=rt(($d,Pn)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof df=="function"&&typeof Pn=="object"&&Pn&&Pn.exports?Pn.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})($d,function(){"use strict";function e(T,g,S){this.low=T|0,this.high=g|0,this.unsigned=!!S}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var r={},n={};function s(T,g){var S,R,F;return g?(T>>>=0,(F=0<=T&&T<256)&&(R=n[T],R)?R:(S=i(T,(T|0)<0?-1:0,!0),F&&(n[T]=S),S)):(T|=0,(F=-128<=T&&T<128)&&(R=r[T],R)?R:(S=i(T,T<0?-1:0,!1),F&&(r[T]=S),S))}e.fromInt=s;function o(T,g){if(isNaN(T)||!isFinite(T))return g?y:m;if(g){if(T<0)return y;if(T>=d)return C}else{if(T<=-p)return L;if(T+1>=p)return B}return T<0?o(-T,g).neg():i(T%h|0,T/h|0,g)}e.fromNumber=o;function i(T,g,S){return new e(T,g,S)}e.fromBits=i;var a=Math.pow;function c(T,g,S){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return m;if(typeof g=="number"?(S=g,g=!1):g=!!g,S=S||10,S<2||36<S)throw RangeError("radix");var R;if((R=T.indexOf("-"))>0)throw Error("interior hyphen");if(R===0)return c(T.substring(1),g,S).neg();for(var F=o(a(S,8)),v=m,G=0;G<T.length;G+=8){var X=Math.min(8,T.length-G),z=parseInt(T.substring(G,G+X),S);if(X<8){var et=o(a(S,X));v=v.mul(et).add(o(z))}else v=v.mul(F),v=v.add(o(z))}return v.unsigned=g,v}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?o(T):typeof T=="string"?c(T):i(T.low,T.high,T.unsigned)}e.fromValue=l;var f=1<<16,u=1<<24,h=f*f,d=h*h,p=d/2,A=s(u),m=s(0);e.ZERO=m;var y=s(0,!0);e.UZERO=y;var _=s(1);e.ONE=_;var E=s(1,!0);e.UONE=E;var M=s(-1);e.NEG_ONE=M;var B=i(-1,2147483647,!1);e.MAX_VALUE=B;var C=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=C;var L=i(0,-2147483648,!1);e.MIN_VALUE=L;var b=e.prototype;return b.toInt=function(){return this.unsigned?this.low>>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},b.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var S=o(g),R=this.div(S),F=R.mul(S).sub(this);return R.toString(g)+F.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var v=o(a(g,6),this.unsigned),G=this,X="";;){var z=G.div(v),et=G.sub(z.mul(v)).toInt()>>>0,K=et.toString(g);if(G=z,G.isZero())return K+X;for(;K.length<6;)K="0"+K;X=""+K+X}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,S=31;S>0&&!(g&1<<S);S--);return this.high!=0?S+33:S+1},b.isZero=function(){return this.high===0&&this.low===0},b.isNegative=function(){return!this.unsigned&&this.high<0},b.isPositive=function(){return this.unsigned||this.high>=0},b.isOdd=function(){return(this.low&1)===1},b.isEven=function(){return(this.low&1)===0},b.equals=function(g){return t(g)||(g=l(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},b.eq=b.equals,b.notEquals=function(g){return!this.eq(g)},b.neq=b.notEquals,b.lessThan=function(g){return this.comp(g)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(g){return this.comp(g)<=0},b.lte=b.lessThanOrEqual,b.greaterThan=function(g){return this.comp(g)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(g){return this.comp(g)>=0},b.gte=b.greaterThanOrEqual,b.compare=function(g){if(t(g)||(g=l(g)),this.eq(g))return 0;var S=this.isNegative(),R=g.isNegative();return S&&!R?-1:!S&&R?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(_)},b.neg=b.negate,b.add=function(g){t(g)||(g=l(g));var S=this.high>>>16,R=this.high&65535,F=this.low>>>16,v=this.low&65535,G=g.high>>>16,X=g.high&65535,z=g.low>>>16,et=g.low&65535,K=0,Y=0,$=0,bt=0;return bt+=v+et,$+=bt>>>16,bt&=65535,$+=F+z,Y+=$>>>16,$&=65535,Y+=R+X,K+=Y>>>16,Y&=65535,K+=S+G,K&=65535,i($<<16|bt,K<<16|Y,this.unsigned)},b.subtract=function(g){return t(g)||(g=l(g)),this.add(g.neg())},b.sub=b.subtract,b.multiply=function(g){if(this.isZero()||(t(g)||(g=l(g)),g.isZero()))return m;if(this.eq(L))return g.isOdd()?L:m;if(g.eq(L))return this.isOdd()?L:m;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(A)&&g.lt(A))return o(this.toNumber()*g.toNumber(),this.unsigned);var S=this.high>>>16,R=this.high&65535,F=this.low>>>16,v=this.low&65535,G=g.high>>>16,X=g.high&65535,z=g.low>>>16,et=g.low&65535,K=0,Y=0,$=0,bt=0;return bt+=v*et,$+=bt>>>16,bt&=65535,$+=F*et,Y+=$>>>16,$&=65535,$+=v*z,Y+=$>>>16,$&=65535,Y+=R*et,K+=Y>>>16,Y&=65535,Y+=F*z,K+=Y>>>16,Y&=65535,Y+=v*X,K+=Y>>>16,Y&=65535,K+=S*et+R*z+F*X+v*G,K&=65535,i($<<16|bt,K<<16|Y,this.unsigned)},b.mul=b.multiply,b.divide=function(g){if(t(g)||(g=l(g)),g.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:m;var S,R,F;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return y;if(g.gt(this.shru(1)))return E;F=y}else{if(this.eq(L)){if(g.eq(_)||g.eq(M))return L;if(g.eq(L))return _;var v=this.shr(1);return S=v.div(g).shl(1),S.eq(m)?g.isNegative()?_:M:(R=this.sub(g.mul(S)),F=S.add(R.div(g)),F)}else if(g.eq(L))return this.unsigned?y:m;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();F=m}for(R=this;R.gte(g);){S=Math.max(1,Math.floor(R.toNumber()/g.toNumber()));for(var G=Math.ceil(Math.log(S)/Math.LN2),X=G<=48?1:a(2,G-48),z=o(S),et=z.mul(g);et.isNegative()||et.gt(R);)S-=X,z=o(S,this.unsigned),et=z.mul(g);z.isZero()&&(z=_),F=F.add(z),R=R.sub(et)}return F},b.div=b.divide,b.modulo=function(g){return t(g)||(g=l(g)),this.sub(this.div(g).mul(g))},b.mod=b.modulo,b.not=function(){return i(~this.low,~this.high,this.unsigned)},b.and=function(g){return t(g)||(g=l(g)),i(this.low&g.low,this.high&g.high,this.unsigned)},b.or=function(g){return t(g)||(g=l(g)),i(this.low|g.low,this.high|g.high,this.unsigned)},b.xor=function(g){return t(g)||(g=l(g)),i(this.low^g.low,this.high^g.high,this.unsigned)},b.shiftLeft=function(g){return t(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):i(0,this.low<<g-32,this.unsigned)},b.shl=b.shiftLeft,b.shiftRight=function(g){return t(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?i(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):i(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(g){if(t(g)&&(g=g.toInt()),g&=63,g===0)return this;var S=this.high;if(g<32){var R=this.low;return i(R>>>g|S<<32-g,S>>>g,this.unsigned)}else return g===32?i(S,0,this.unsigned):i(S>>>g-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},b.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var T=this.high,g=this.low;return[g&255,g>>>8&255,g>>>16&255,g>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},b.toBytesBE=function(){var T=this.high,g=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255]},e})});var Mc=rt((wG,Dp)=>{Dp.exports=globalThis.luma});var Co=rt((LG,Gp)=>{Gp.exports=globalThis.deck});var bc=rt((vG,Up)=>{Up.exports=globalThis.luma});var Nr=rt((aU,nm)=>{nm.exports=globalThis.loaders});var L0=rt((Cz,w0)=>{w0.exports=globalThis.deck});var V0=rt(tf=>{tf.read=function(e,t,r,n,s){var o,i,a=s*8-n-1,c=(1<<a)-1,l=c>>1,f=-7,u=r?s-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(i=o&(1<<-f)-1,o>>=-f,f+=n;f>0;i=i*256+e[t+u],u+=h,f-=8);if(o===0)o=1-l;else{if(o===c)return i?NaN:(d?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-l}return(d?-1:1)*i*Math.pow(2,o-n)};tf.write=function(e,t,r,n,s,o){var i,a,c,l=o*8-s-1,f=(1<<l)-1,u=f>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=f):(i=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-i))<1&&(i--,c*=2),i+u>=1?t+=h/c:t+=h*Math.pow(2,1-u),t*c>=2&&(i++,c/=2),i+u>=f?(a=0,i=f):i+u>=1?(a=(t*c-1)*Math.pow(2,s),i=i+u):(a=t*Math.pow(2,u-1)*Math.pow(2,s),i=0));s>=8;e[r+d]=a&255,d+=p,a/=256,s-=8);for(i=i<<s|a,l+=s;l>0;e[r+d]=i&255,d+=p,i/=256,l-=8);e[r+d-p]|=A*128}});var j0=rt((d5,J0)=>{"use strict";J0.exports=j;var Bi=V0();function j(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}j.Varint=0;j.Fixed64=1;j.Bytes=2;j.Fixed32=5;var ef=(1<<16)*(1<<16),H0=1/ef,u3=12,k0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");j.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),s=n>>3,o=this.pos;this.type=n&7,e(s,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ci(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=q0(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ci(this.buf,this.pos)+Ci(this.buf,this.pos+4)*ef;return this.pos+=8,e},readSFixed64:function(){var e=Ci(this.buf,this.pos)+q0(this.buf,this.pos+4)*ef;return this.pos+=8,e},readFloat:function(){var e=Bi.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Bi.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,h3(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=u3&&k0?C3(this.buf,t,e):B3(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==j.Bytes)return e.push(this.readVarint(t));var r=xe(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==j.Bytes)return e.push(this.readSVarint());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==j.Bytes)return e.push(this.readBoolean());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==j.Bytes)return e.push(this.readFloat());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==j.Bytes)return e.push(this.readDouble());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==j.Bytes)return e.push(this.readFixed32());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==j.Bytes)return e.push(this.readSFixed32());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==j.Bytes)return e.push(this.readFixed64());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==j.Bytes)return e.push(this.readSFixed64());var t=xe(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===j.Varint)for(;this.buf[this.pos++]>127;);else if(t===j.Bytes)this.pos=this.readVarint()+this.pos;else if(t===j.Fixed32)this.pos+=4;else if(t===j.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),nn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),nn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),nn(this.buf,e&-1,this.pos),nn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),nn(this.buf,e&-1,this.pos),nn(this.buf,Math.floor(e*H0),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){d3(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=S3(this.buf,e,this.pos);var r=this.pos-t;r>=128&&z0(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Bi.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Bi.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&z0(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,j.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,g3,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,A3,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,T3,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,x3,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,y3,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,E3,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,_3,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,M3,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,b3,t)},writeBytesField:function(e,t){this.writeTag(e,j.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,j.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,j.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,j.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,j.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,j.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,j.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,j.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,j.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,j.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function h3(e,t,r){var n=r.buf,s,o;if(o=n[r.pos++],s=(o&112)>>4,o<128||(o=n[r.pos++],s|=(o&127)<<3,o<128)||(o=n[r.pos++],s|=(o&127)<<10,o<128)||(o=n[r.pos++],s|=(o&127)<<17,o<128)||(o=n[r.pos++],s|=(o&127)<<24,o<128)||(o=n[r.pos++],s|=(o&1)<<31,o<128))return rn(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function xe(e){return e.type===j.Bytes?e.readVarint()+e.pos:e.pos+1}function rn(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function d3(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),p3(r,n,t),m3(n,t)}function p3(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function m3(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function z0(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var s=r.pos-1;s>=e;s--)r.buf[s+n]=r.buf[s]}function g3(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function A3(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function x3(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function y3(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function T3(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function E3(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function _3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function M3(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function b3(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Ci(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function nn(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function q0(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function B3(e,t,r){for(var n="",s=t;s<r;){var o=e[s],i=null,a=o>239?4:o>223?3:o>191?2:1;if(s+a>r)break;var c,l,f;a===1?o<128&&(i=o):a===2?(c=e[s+1],(c&192)===128&&(i=(o&31)<<6|c&63,i<=127&&(i=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(i=(o&15)<<12|(c&63)<<6|l&63,(i<=2047||i>=55296&&i<=57343)&&(i=null))):a===4&&(c=e[s+1],l=e[s+2],f=e[s+3],(c&192)===128&&(l&192)===128&&(f&192)===128&&(i=(o&15)<<18|(c&63)<<12|(l&63)<<6|f&63,(i<=65535||i>=1114112)&&(i=null))),i===null?(i=65533,a=1):i>65535&&(i-=65536,n+=String.fromCharCode(i>>>10&1023|55296),i=56320|i&1023),n+=String.fromCharCode(i),s+=a}return n}function C3(e,t,r){return k0.decode(e.subarray(t,r))}function S3(e,t,r){for(var n=0,s,o;n<t.length;n++){if(s=t.charCodeAt(n),s>55295&&s<57344)if(o)if(s<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=s;continue}else s=o-55296<<10|s-56320|65536,o=null;else{s>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=s;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);s<128?e[r++]=s:(s<2048?e[r++]=s>>6|192:(s<65536?e[r++]=s>>12|224:(e[r++]=s>>18|240,e[r++]=s>>12&63|128),e[r++]=s>>6&63|128),e[r++]=s&63|128)}return r}});var xs={};pt(xs,{A5Layer:()=>vh,GeohashLayer:()=>h1,GreatCircleLayer:()=>Zd,H3ClusterLayer:()=>Np,H3HexagonLayer:()=>Bo,MVTLayer:()=>c1,QuadkeyLayer:()=>hp,S2Layer:()=>fp,TerrainLayer:()=>I0,Tile3DLayer:()=>T0,TileLayer:()=>nr,TripsLayer:()=>Fp,_GeoCellLayer:()=>Ft,_Tile2DHeader:()=>er,_Tileset2D:()=>rr,_WMSLayer:()=>Pr,_getURLFromTemplate:()=>oe});var Qt={},mf=D(zt(),1);ye(Qt,D(zt(),1));if(!mf.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");ye(xs,Qt);var Af=D(qt(),1),Li=D(zt(),1),T1={...Li.PolygonLayer.defaultProps},an=class extends Af.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:r,wireframe:n,filled:s,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m}=this.props,{updateTriggers:y,material:_,transitions:E}=this.props,M=this.getSubLayerClass("cell",Li.PolygonLayer),{updateTriggers:B,...C}=this.indexToBounds()||{};return new M({filled:s,wireframe:n,extruded:r,elevationScale:t,stroked:o,lineWidthUnits:i,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:f,lineMiterLimit:u,lineDashJustified:h,material:_,transitions:E,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...B,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),C)}};an.layerName="GeoCellLayer";an.defaultProps=T1;var Ft=an;var E1=Object.defineProperty,un=(e,t)=>{for(var r in t)E1(e,r,{get:t[r],enumerable:!0})},Tt={};un(Tt,{ARRAY_TYPE:()=>st,EPSILON:()=>dt,RANDOM:()=>Ue,equals:()=>B1,setMatrixArrayType:()=>_1,toRadian:()=>b1});var dt=1e-6,st=typeof Float32Array<"u"?Float32Array:Array,Ue=Math.random;function _1(e){st=e}var M1=Math.PI/180;function b1(e){return e*M1}function B1(e,t){return Math.abs(e-t)<=dt*Math.max(1,Math.abs(e),Math.abs(t))}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ve={};un(Ve,{LDU:()=>z1,add:()=>q1,adjoint:()=>P1,clone:()=>S1,copy:()=>I1,create:()=>C1,determinant:()=>O1,equals:()=>J1,exactEquals:()=>k1,frob:()=>H1,fromRotation:()=>G1,fromScaling:()=>U1,fromValues:()=>L1,identity:()=>w1,invert:()=>F1,mul:()=>W1,multiply:()=>Uf,multiplyScalar:()=>j1,multiplyScalarAndAdd:()=>X1,rotate:()=>N1,scale:()=>D1,set:()=>v1,str:()=>V1,sub:()=>Y1,subtract:()=>Vf,transpose:()=>R1});function C1(){var e=new st(4);return st!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function S1(e){var t=new st(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function I1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function w1(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function L1(e,t,r,n){var s=new st(4);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function v1(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function R1(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function F1(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*o-s*n;return i?(i=1/i,e[0]=o*i,e[1]=-n*i,e[2]=-s*i,e[3]=r*i,e):null}function P1(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function O1(e){return e[0]*e[3]-e[2]*e[1]}function Uf(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*a+o*c,e[1]=s*a+i*c,e[2]=n*l+o*f,e[3]=s*l+i*f,e}function N1(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+o*a,e[1]=s*c+i*a,e[2]=n*-a+o*c,e[3]=s*-a+i*c,e}function D1(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1];return e[0]=n*a,e[1]=s*a,e[2]=o*c,e[3]=i*c,e}function G1(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=-r,e[3]=n,e}function U1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function V1(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function H1(e){return Math.hypot(e[0],e[1],e[2],e[3])}function z1(e,t,r,n){return e[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-e[2]*r[1],[e,t,r]}function q1(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}function Vf(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}function k1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function J1(e,t){var r=e[0],n=e[1],s=e[2],o=e[3],i=t[0],a=t[1],c=t[2],l=t[3];return Math.abs(r-i)<=dt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=dt*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=dt*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=dt*Math.max(1,Math.abs(o),Math.abs(l))}function j1(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}function X1(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e}var W1=Uf,Y1=Vf;function K1(){var e=new st(9);return st!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}var Pi={};un(Pi,{add:()=>lx,calculateW:()=>ZA,clone:()=>ox,conjugate:()=>rx,copy:()=>ax,create:()=>Ni,dot:()=>ru,equals:()=>mx,exactEquals:()=>px,exp:()=>Zf,fromEuler:()=>nx,fromMat3:()=>tu,fromValues:()=>ix,getAngle:()=>WA,getAxisAngle:()=>XA,identity:()=>jA,invert:()=>ex,len:()=>hx,length:()=>nu,lerp:()=>ux,ln:()=>$f,mul:()=>fx,multiply:()=>Qf,normalize:()=>Ji,pow:()=>$A,random:()=>tx,rotateX:()=>YA,rotateY:()=>KA,rotateZ:()=>QA,rotationTo:()=>gx,scale:()=>eu,set:()=>cx,setAxes:()=>xx,setAxisAngle:()=>Kf,slerp:()=>ws,sqlerp:()=>Ax,sqrLen:()=>dx,squaredLength:()=>su,str:()=>sx});var w={};un(w,{add:()=>tA,angle:()=>TA,bezier:()=>hA,ceil:()=>eA,clone:()=>Q1,copy:()=>Z1,create:()=>qi,cross:()=>Is,dist:()=>IA,distance:()=>Jf,div:()=>SA,divide:()=>kf,dot:()=>ki,equals:()=>bA,exactEquals:()=>MA,floor:()=>rA,forEach:()=>vA,fromValues:()=>Oi,hermite:()=>uA,inverse:()=>lA,len:()=>Yf,length:()=>Hf,lerp:()=>fA,max:()=>sA,min:()=>nA,mul:()=>CA,multiply:()=>qf,negate:()=>cA,normalize:()=>Wf,random:()=>dA,rotateX:()=>AA,rotateY:()=>xA,rotateZ:()=>yA,round:()=>oA,scale:()=>iA,scaleAndAdd:()=>aA,set:()=>$1,sqrDist:()=>wA,sqrLen:()=>LA,squaredDistance:()=>jf,squaredLength:()=>Xf,str:()=>_A,sub:()=>BA,subtract:()=>zf,transformMat3:()=>mA,transformMat4:()=>pA,transformQuat:()=>gA,zero:()=>EA});function qi(){var e=new st(3);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Q1(e){var t=new st(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Hf(e){var t=e[0],r=e[1],n=e[2];return Math.hypot(t,r,n)}function Oi(e,t,r){var n=new st(3);return n[0]=e,n[1]=t,n[2]=r,n}function Z1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function $1(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function tA(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function zf(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function qf(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function kf(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function eA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function rA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function nA(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function sA(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function oA(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function iA(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function aA(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function Jf(e,t){var r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.hypot(r,n,s)}function jf(e,t){var r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function Xf(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function cA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function lA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Wf(e,t){var r=t[0],n=t[1],s=t[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function ki(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Is(e,t,r){var n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2];return e[0]=s*c-o*a,e[1]=o*i-n*c,e[2]=n*a-s*i,e}function fA(e,t,r,n){var s=t[0],o=t[1],i=t[2];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e}function uA(e,t,r,n,s,o){var i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*f,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*f,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*f,e}function hA(e,t,r,n,s,o){var i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*f+n[0]*u+s[0]*h,e[1]=t[1]*l+r[1]*f+n[1]*u+s[1]*h,e[2]=t[2]*l+r[2]*f+n[2]*u+s[2]*h,e}function dA(e,t){t=t||1;var r=Ue()*2*Math.PI,n=Ue()*2-1,s=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*s,e[1]=Math.sin(r)*s,e[2]=n*t,e}function pA(e,t,r){var n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,e[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,e[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,e[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,e}function mA(e,t,r){var n=t[0],s=t[1],o=t[2];return e[0]=n*r[0]+s*r[3]+o*r[6],e[1]=n*r[1]+s*r[4]+o*r[7],e[2]=n*r[2]+s*r[5]+o*r[8],e}function gA(e,t,r){var n=r[0],s=r[1],o=r[2],i=r[3],a=t[0],c=t[1],l=t[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,e[0]=a+f+d,e[1]=c+u+p,e[2]=l+h+A,e}function AA(e,t,r,n){var s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0],o[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),o[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function xA(e,t,r,n){var s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),o[1]=s[1],o[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function yA(e,t,r,n){var s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),o[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),o[2]=s[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function TA(e,t){var r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2],c=Math.sqrt(r*r+n*n+s*s),l=Math.sqrt(o*o+i*i+a*a),f=c*l,u=f&&ki(e,t)/f;return Math.acos(Math.min(Math.max(u,-1),1))}function EA(e){return e[0]=0,e[1]=0,e[2]=0,e}function _A(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function MA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function bA(e,t){var r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2];return Math.abs(r-o)<=dt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=dt*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=dt*Math.max(1,Math.abs(s),Math.abs(a))}var BA=zf,CA=qf,SA=kf,IA=Jf,wA=jf,Yf=Hf,LA=Xf,vA=function(){var e=qi();return function(t,r,n,s,o,i){var a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();function RA(){var e=new st(4);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function FA(e){var t=new st(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function PA(e,t,r,n){var s=new st(4);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s}function OA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function NA(e,t,r,n,s){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e}function DA(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}function GA(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}function UA(e){var t=e[0],r=e[1],n=e[2],s=e[3];return Math.hypot(t,r,n,s)}function VA(e){var t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function HA(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=r*i,e[1]=n*i,e[2]=s*i,e[3]=o*i,e}function zA(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function qA(e,t,r,n){var s=t[0],o=t[1],i=t[2],a=t[3];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e[3]=a+n*(r[3]-a),e}function kA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function JA(e,t){var r=e[0],n=e[1],s=e[2],o=e[3],i=t[0],a=t[1],c=t[2],l=t[3];return Math.abs(r-i)<=dt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=dt*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(s-c)<=dt*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-l)<=dt*Math.max(1,Math.abs(o),Math.abs(l))}var iL=function(){var e=RA();return function(t,r,n,s,o,i){var a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();function Ni(){var e=new st(4);return st!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function jA(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Kf(e,t,r){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 XA(e,t){var r=Math.acos(t[3])*2,n=Math.sin(r/2);return n>dt?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r}function WA(e,t){var r=ru(e,t);return Math.acos(2*r*r-1)}function Qf(e,t,r){var n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*f+i*a+s*l-o*c,e[1]=s*f+i*c+o*a-n*l,e[2]=o*f+i*l+n*c-s*a,e[3]=i*f-n*a-s*c-o*l,e}function YA(e,t,r){r*=.5;var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=s*c+o*a,e[2]=o*c-s*a,e[3]=i*c-n*a,e}function KA(e,t,r){r*=.5;var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=s*c+i*a,e[2]=o*c+n*a,e[3]=i*c-s*a,e}function QA(e,t,r){r*=.5;var n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=s*c-n*a,e[2]=o*c+i*a,e[3]=i*c-o*a,e}function ZA(e,t){var r=t[0],n=t[1],s=t[2];return e[0]=r,e[1]=n,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),e}function Zf(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=Math.sqrt(r*r+n*n+s*s),a=Math.exp(o),c=i>0?a*Math.sin(i)/i:0;return e[0]=r*c,e[1]=n*c,e[2]=s*c,e[3]=a*Math.cos(i),e}function $f(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=Math.sqrt(r*r+n*n+s*s),a=i>0?Math.atan2(i,o)/i:0;return e[0]=r*a,e[1]=n*a,e[2]=s*a,e[3]=.5*Math.log(r*r+n*n+s*s+o*o),e}function $A(e,t,r){return $f(e,t),eu(e,e,r),Zf(e,e),e}function ws(e,t,r,n){var s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return d=s*c+o*l+i*f+a*u,d<0&&(d=-d,c=-c,l=-l,f=-f,u=-u),1-d>dt?(h=Math.acos(d),p=Math.sin(h),A=Math.sin((1-n)*h)/p,m=Math.sin(n*h)/p):(A=1-n,m=n),e[0]=A*s+m*c,e[1]=A*o+m*l,e[2]=A*i+m*f,e[3]=A*a+m*u,e}function tx(e){var t=Ue(),r=Ue(),n=Ue(),s=Math.sqrt(1-t),o=Math.sqrt(t);return e[0]=s*Math.sin(2*Math.PI*r),e[1]=s*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*n),e[3]=o*Math.cos(2*Math.PI*n),e}function ex(e,t){var r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=o*a,e}function rx(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function tu(e,t){var r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*n,n=.5/n,e[3]=(t[o*3+i]-t[i*3+o])*n,e[o]=(t[o*3+s]+t[s*3+o])*n,e[i]=(t[i*3+s]+t[s*3+i])*n}return e}function nx(e,t,r,n){var s=.5*Math.PI/180;t*=s,r*=s,n*=s;var o=Math.sin(t),i=Math.cos(t),a=Math.sin(r),c=Math.cos(r),l=Math.sin(n),f=Math.cos(n);return e[0]=o*c*f-i*a*l,e[1]=i*a*f+o*c*l,e[2]=i*c*l-o*a*f,e[3]=i*c*f+o*a*l,e}function sx(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var ox=FA,ix=PA,ax=OA,cx=NA,lx=DA,fx=Qf,eu=GA,ru=zA,ux=qA,nu=UA,hx=nu,su=VA,dx=su,Ji=HA,px=kA,mx=JA,gx=function(){var e=qi(),t=Oi(1,0,0),r=Oi(0,1,0);return function(n,s,o){var i=ki(s,o);return i<-.999999?(Is(e,t,s),Yf(e)<1e-6&&Is(e,r,s),Wf(e,e),Kf(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Is(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,Ji(n,n))}}(),Ax=function(){var e=Ni(),t=Ni();return function(r,n,s,o,i,a){return ws(e,n,i,a),ws(t,s,o,a),ws(r,e,t,2*a*(1-a)),r}}(),xx=function(){var e=K1();return function(t,r,n,s){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Ji(t,tu(t,e))}}(),P={};un(P,{add:()=>Mx,angle:()=>qx,ceil:()=>bx,clone:()=>yx,copy:()=>Ex,create:()=>ou,cross:()=>Ox,dist:()=>Zx,distance:()=>lu,div:()=>Qx,divide:()=>cu,dot:()=>Px,equals:()=>Xx,exactEquals:()=>jx,floor:()=>Bx,forEach:()=>ey,fromValues:()=>Tx,inverse:()=>Rx,len:()=>Wx,length:()=>uu,lerp:()=>Nx,max:()=>Sx,min:()=>Cx,mul:()=>Kx,multiply:()=>au,negate:()=>vx,normalize:()=>Fx,random:()=>Dx,rotate:()=>zx,round:()=>Ix,scale:()=>wx,scaleAndAdd:()=>Lx,set:()=>_x,sqrDist:()=>$x,sqrLen:()=>ty,squaredDistance:()=>fu,squaredLength:()=>hu,str:()=>Jx,sub:()=>Yx,subtract:()=>iu,transformMat2:()=>Gx,transformMat2d:()=>Ux,transformMat3:()=>Vx,transformMat4:()=>Hx,zero:()=>kx});function ou(){var e=new st(2);return st!=Float32Array&&(e[0]=0,e[1]=0),e}function yx(e){var t=new st(2);return t[0]=e[0],t[1]=e[1],t}function Tx(e,t){var r=new st(2);return r[0]=e,r[1]=t,r}function Ex(e,t){return e[0]=t[0],e[1]=t[1],e}function _x(e,t,r){return e[0]=t,e[1]=r,e}function Mx(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function iu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function au(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function cu(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function bx(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function Bx(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function Cx(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function Sx(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function Ix(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function wx(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Lx(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e}function lu(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.hypot(r,n)}function fu(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function uu(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function hu(e){var t=e[0],r=e[1];return t*t+r*r}function vx(e,t){return e[0]=-t[0],e[1]=-t[1],e}function Rx(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function Fx(e,t){var r=t[0],n=t[1],s=r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function Px(e,t){return e[0]*t[0]+e[1]*t[1]}function Ox(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e}function Nx(e,t,r,n){var s=t[0],o=t[1];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e}function Dx(e,t){t=t||1;var r=Ue()*2*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function Gx(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e}function Ux(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s+r[4],e[1]=r[1]*n+r[3]*s+r[5],e}function Vx(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[3]*s+r[6],e[1]=r[1]*n+r[4]*s+r[7],e}function Hx(e,t,r){var n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}function zx(e,t,r,n){var s=t[0]-r[0],o=t[1]-r[1],i=Math.sin(n),a=Math.cos(n);return e[0]=s*a-o*i+r[0],e[1]=s*i+o*a+r[1],e}function qx(e,t){var r=e[0],n=e[1],s=t[0],o=t[1],i=Math.sqrt(r*r+n*n)*Math.sqrt(s*s+o*o),a=i&&(r*s+n*o)/i;return Math.acos(Math.min(Math.max(a,-1),1))}function kx(e){return e[0]=0,e[1]=0,e}function Jx(e){return"vec2("+e[0]+", "+e[1]+")"}function jx(e,t){return e[0]===t[0]&&e[1]===t[1]}function Xx(e,t){var r=e[0],n=e[1],s=t[0],o=t[1];return Math.abs(r-s)<=dt*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-o)<=dt*Math.max(1,Math.abs(n),Math.abs(o))}var Wx=uu,Yx=iu,Kx=au,Qx=cu,Zx=lu,$x=fu,ty=hu,ey=function(){var e=ou();return function(t,r,n,s,o,i){var a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],o(e,e,i),t[a]=e[0],t[a+1]=e[1];return t}}(),Fs=(1+Math.sqrt(5))/2,aL=2*Math.PI,Ls=2*Math.PI/5,Zt=Math.PI/5,xf=Math.PI/10,ry=2*Math.atan(Fs),Di=Math.PI-ry,cL=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-Fs)),Ps=(Math.sqrt(5)-1)/2,ny=3-Math.sqrt(5),sy=Math.sqrt(3-Fs),lL=Math.sqrt(3)*sy/Fs;Tt.setMatrixArrayType(Float64Array);var ji=class Gi{constructor(t){this.vertices=t,this.isWindingCorrect()||this.vertices.reverse()}getArea(){let t=0,r=this.vertices.length;for(let n=0;n<r;n++){let s=(n+1)%r;t+=(this.vertices[s][0]-this.vertices[n][0])*(this.vertices[s][1]+this.vertices[n][1])}return t}isWindingCorrect(){return this.getArea()>=0}getVertices(){return this.vertices}scale(t){for(let r of this.vertices)P.scale(r,r,t);return this}rotate180(){for(let t of this.vertices)P.negate(t,t);return this}reflectY(){for(let t of this.vertices)t[1]=-t[1];return this.vertices.reverse(),this}translate(t){for(let r of this.vertices)P.add(r,r,t);return this}transform(t){for(let r of this.vertices)P.transformMat2(r,r,t);return this}transform2d(t){for(let r of this.vertices)P.transformMat2d(r,r,t);return this}clone(){return new Gi(this.vertices.map(r=>P.clone(r)))}getCenter(){let t=this.vertices.length;return this.vertices.reduce((n,s)=>[n[0]+s[0]/t,n[1]+s[1]/t],[0,0])}containsPoint(t){if(!this.isWindingCorrect())throw new Error("Pentagon is not counter-clockwise");let r=this.vertices.length,n=1;for(let s=0;s<r;s++){let o=this.vertices[s],i=this.vertices[(s+1)%r],a=o[0]-i[0],c=o[1]-i[1],l=t[0]-o[0],f=t[1]-o[1],u=a*f-c*l;if(u<0){let h=Math.sqrt(l*l+f*f);n=Math.min(n,u/h)}}return n}splitEdges(t){if(t<=1)return this;let r=[],n=this.vertices.length;for(let s=0;s<n;s++){let o=this.vertices[s],i=this.vertices[(s+1)%n];r.push(P.clone(o));for(let a=1;a<t;a++){let c=a/t,l=P.create();P.lerp(l,o,i,c),r.push(l)}}return new Gi(r)}};Tt.setMatrixArrayType(Float64Array);var du=[0,0],pu=[0,1],He=[.7885966681787006,1.6149108024237764],mu=[1.6171013659387945,1.054928690397459],gu=[Math.cos(xf),Math.sin(xf)],oy=2*P.length(He)*Math.cos(Zt),iy=Zt-Math.atan2(He[1],He[0]),ay=2*Ps/oy;[du,pu,He,mu,gu].forEach(e=>{P.scale(e,e,ay),P.rotate(e,e,[0,0],iy)});var cy=new ji([du,pu,He,mu,gu]),Au=Math.atan2(He[1],He[0])-Zt,ly=[0,0],vs=Ps/Math.cos(Zt),yf=Au+Zt,Rs=[vs*Math.cos(yf),vs*Math.sin(yf)],Tf=Au-Zt,fn=[vs*Math.cos(Tf),vs*Math.sin(Tf)],xu=new ji([ly,Rs,fn]),yu=Ve.fromValues(Rs[0],Rs[1],fn[0],fn[1]),fL=Ve.invert(Ve.create(),yu),fy=new Float64Array([-.0022392098386786394,21308606513250217e-22,-2559257686421274e-24,33701965267802837e-28,-4667545312611249e-30,667492870384816e-32]),uy=new Float64Array([.0022392089963541657,28831978048607556e-22,508622073997266e-23,102018123778161e-25,21912872306767718e-30,49284235482523806e-33]),hy=class{applyCoefficients(e,t){let r=Math.sin(e),n=Math.cos(e),s=2*(n-r)*(n+r),o,i;return o=s*t[5]+t[4],i=s*o+t[3],o=s*i-o+t[2],i=s*o-i+t[1],o=s*i-o+t[0],e+2*r*n*o}forward(e){return this.applyCoefficients(e,fy)}inverse(e){return this.applyCoefficients(e,uy)}};Tt.setMatrixArrayType(Float64Array);var Tu=new hy;function Ef(e){return e*(Math.PI/180)}function _f(e){return e*(180/Math.PI)}function Mf(e){let t=P.length(e),r=Math.atan2(e[1],e[0]);return[t,r]}function dy([e,t]){let r=e*Math.cos(t),n=e*Math.sin(t);return[r,n]}function py(e,[t,r,n]){let s=[t[0]-n[0],t[1]-n[1]],o=[n[0]-r[0],n[1]-r[1]],i=[e[0]-n[0],e[1]-n[1]],a=o[0]*s[1]-o[1]*s[0],c=(o[0]*i[1]-o[1]*i[0])/a,l=(s[0]*i[1]-s[1]*i[0])/a,f=1-(c+l);return[c,l,f]}function my(e,[t,r,n]){return[e[0]*t[0]+e[1]*r[0]+e[2]*n[0],e[0]*t[1]+e[1]*r[1]+e[2]*n[1]]}function Ui(e){let t=Math.atan2(e[1],e[0]),r=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),n=Math.acos(e[2]/r);return[t,n]}function _r([e,t]){let r=Math.sin(t),n=r*Math.cos(e),s=r*Math.sin(e),o=Math.cos(t);return[n,s,o]}var Eu=93;function gy([e,t]){let r=Ef(e+Eu),n=Ef(t),s=Tu.forward(n),o=Math.PI/2-s;return[r,o]}function _u([e,t]){let r=_f(e)-Eu,n=Math.PI/2-t,s=Tu.inverse(n),o=_f(s);return[r,o]}function Ay(e){let t=e.map(o=>_r(gy(o))),r=w.create();for(let o of t)w.add(r,r,o);w.normalize(r,r);let[n,s]=_u(Ui(r));return(s>89.99||s<-89.99)&&(n=e[0][0]),n=((n+180)%360+360)%360-180,e.map(o=>{let[i,a]=o;for(;i-n>180;)i=i-360;for(;i-n<-180;)i=i+360;return[i,a]})}Tt.setMatrixArrayType(Float64Array);var Os=Math.sqrt(5),Ns=Math.sqrt(.2),Mu=Math.sqrt((1-Ns)/2),bu=Math.sqrt((1+Ns)/2),Ts=.5,bf=Math.sqrt((2.5-Os)/10),Bf=Math.sqrt((2.5+Os)/10),Cf=Math.sqrt((1+Ns)/8),Sf=Math.sqrt((1-Ns)/8),If=Math.sqrt((3-Os)/8),wf=Math.sqrt((3+Os)/8),xy=[[0,0],[Mu,0],[bf,Ts],[-Cf,If],[-Cf,-If],[bf,-Ts],[-bu,0],[-Sf,-wf],[Bf,-Ts],[Bf,Ts],[-Sf,wf],[0,0]],yy=xy.map(([e,t])=>[-t,e]),Es=yy.map((e,t)=>t===0?[0,0,0,1]:t===11?[0,-1,0,0]:[...e,0,t<6?bu:Mu]);Tt.setMatrixArrayType(Float64Array);var Bu=["vu","uw","vw","vw","vw"],cn=["wu","uw","vw","vu","uw"],vi=["wu","uv","wv","wu","uw"],_s=["vu","uv","wv","wu","uw"],Ty=[Bu,_s,vi,cn,vi,_s,vi,cn,cn,cn,_s,_s],Ey=[4,2,3,2,0,4,3,2,2,0,3,0],Lf=[0,1,2,4,3,5,7,8,6,11,10,9],kt=[];function _y(){Ms([0,0],0,Es[0]);for(let e=0;e<5;e++){let t=e*Ls,r=t+Zt;Ms([t,Di],Zt,Es[e+1]),Ms([r,Math.PI-Di],Zt,Es[(e+3)%5+6])}Ms([0,Math.PI],0,Es[11])}var yr=0;function Ms(e,t,r){if(yr>11)throw new Error(`Too many origins: ${yr}`);let n=Pi.create();Pi.conjugate(n,r);let s={id:yr,axis:e,quat:r,inverseQuat:n,angle:t,orientation:Ty[yr],firstQuintant:Ey[yr]};kt.push(s),yr++}_y();kt.sort((e,t)=>Lf.indexOf(e.id)-Lf.indexOf(t.id));kt.forEach((e,t)=>e.id=t);function My(e,t){let r=t.orientation,n=r===Bu||r===cn?-1:1,s=(e-t.firstQuintant+5)%5,o=r[s];return{quintant:(t.firstQuintant+n*s+5)%5,orientation:o}}var by=class{forward([e,t]){return[Math.tan(t),e]}inverse([e,t]){return[t,Math.atan(e)]}},Tr=w.create(),ln=w.create(),vf=w.create(),Rf=w.create();function Ri(e,t){w.lerp(Tr,e,t,.5),w.normalize(Tr,Tr),w.cross(Tr,e,Tr);let r=w.length(Tr);if(r<1e-8){let n=w.subtract(w.create(),e,t);return .5*w.length(n)}return r}function By(e,t,r){return w.cross(ln,t,r),w.dot(e,ln)}function Cy(e,t,r,n,s){w.cross(ln,n,s);let o=w.dot(t,ln),i=w.dot(r,ln);return w.scale(vf,t,i),w.scale(Rf,r,o),w.sub(e,Rf,vf)}function Vi(e,t,r,n){let s=w.angle(t,r);if(s<1e-12)return w.lerp(e,t,r,n);let o=Math.sin((1-n)*s)/Math.sin(s),i=Math.sin(n*s)/Math.sin(s),a=w.scale(w.create(),t,o),c=w.scale(w.create(),r,i);return w.add(e,a,c)}Tt.setMatrixArrayType(Float64Array);var bs=w.create(),Bs=w.create(),Cs=w.create(),Er=w.create(),Sy=class{constructor(e){this._area=null,this.vertices=e,Object.freeze(this.vertices)}getBoundary(e=1,t=!0){let r=[],n=this.vertices.length;for(let s=0;s<n*e;s++){let o=s/e;r.push(this.slerp(o))}return t&&r.push(r[0]),r}slerp(e){let t=this.vertices.length,r=e%1,n=Math.floor(e%t),s=(n+1)%t;return Vi(w.create(),this.vertices[n],this.vertices[s],r)}getTransformedVertices(e){let t=this.vertices.length,r=Math.floor(e%t),n=(r+1)%t,s=(r+t-1)%t,o=w.clone(this.vertices[r]),i=w.clone(this.vertices[n]),a=w.clone(this.vertices[s]);return w.sub(i,i,o),w.sub(a,a,o),[o,i,a]}containsPoint(e){let t=this.vertices.length,r=1/0;for(let n=0;n<t;n++){let[s,o,i]=this.getTransformedVertices(n),a=w.sub(w.create(),e,s);w.normalize(a,a),w.normalize(o,o),w.normalize(i,i);let c=w.cross(w.create(),o,a),l=w.cross(w.create(),a,i),f=w.dot(s,c),u=w.dot(s,l);r=Math.min(r,f,u)}return r}getTriangleArea(e,t,r){w.lerp(bs,t,r,.5),w.lerp(Bs,r,e,.5),w.lerp(Cs,e,t,.5),w.normalize(bs,bs),w.normalize(Bs,Bs),w.normalize(Cs,Cs);let n=By(bs,Bs,Cs),s=Math.max(-1,Math.min(1,n));return Math.abs(s)<1e-8?2*s:Math.asin(s)*2}getArea(){return this._area===null&&(this._area=this._getArea()),this._area}_getArea(){if(this.vertices.length<3)return 0;if(this.vertices.length===3)return this._area=this.getTriangleArea(this.vertices[0],this.vertices[1],this.vertices[2]),this._area;w.set(Er,0,0,0);for(let t of this.vertices)w.add(Er,Er,t);w.normalize(Er,Er);let e=0;for(let t=0;t<this.vertices.length;t++){let r=this.vertices[t],n=this.vertices[(t+1)%this.vertices.length],s=this.getTriangleArea(Er,r,n);isNaN(s)||(e+=s)}return this._area=e,this._area}isWindingCorrect(){if(!(this.getArea()>0))debugger}};Tt.setMatrixArrayType(Float64Array);var Ss=class extends Sy{constructor(e){if(e.length!==3)throw new Error("SphericalTriangleShape requires exactly 3 vertices");super(e)}};Tt.setMatrixArrayType(Float64Array);var Iy=class{forward(e,t,r){let[n,s,o]=t,i=new Ss([n,s,o]),a=w.subtract(w.create(),e,n);w.normalize(a,a);let c=Cy(w.create(),n,a,s,o);w.normalize(c,c);let l=Ri(n,e)/Ri(n,c),f=i.getArea(),u=l/f,h=[1-l,u*new Ss([n,c,o]).getArea(),u*new Ss([n,s,c]).getArea()];return my(h,r)}inverse(e,t,r){let[n,s,o]=r,i=new Ss([n,s,o]),a=py(e,t),c=1-1e-14;if(a[0]>c)return n;if(a[1]>c)return s;if(a[2]>c)return o;let l=w.create();w.cross(l,s,o);let f=i.getArea(),u=1-a[0],d=a[2]/u*f,p=Math.sin(d),A=Math.sin(d/2),m=2*A*A,y=w.dot(n,s),_=w.dot(s,o),E=w.dot(o,n),M=w.length(l),B=w.dot(n,l),C=p*B+m*(y*_-E),L=m*M*(1+y),b=2/Math.acos(_)*Math.atan2(L,C),T=Vi(w.create(),s,o,b),g=Ri(n,T),S=this.safeAcos(u*g)/this.safeAcos(g);return Vi([0,0,0],n,T,S)}safeAcos(e){return e<.001?2*e+e*e*e/3:Math.acos(1-2*e*e)}};Tt.setMatrixArrayType(Float64Array);var It=-1,yt=1,wy=([e,t])=>P.fromValues(e-t,t),Hi=P.fromValues(1,0),zi=P.fromValues(0,1),Ff=P.negate(P.create(),Hi),Pf=P.negate(P.create(),zi),Fi=P.fromValues(0,0),Ly=(e,[t,r])=>{let n=Fi,s=Fi;switch(t===yt&&r===yt?(n=Hi,s=zi):t===It&&r===yt?(n=Pf,s=Ff):t===yt&&r===It?(n=zi,s=Hi):t===It&&r===It&&(n=Ff,s=Pf),e){case 0:return Fi;case 1:return n;case 2:return P.add(P.create(),s,n);case 3:return P.scaleAndAdd(P.create(),s,n,2);default:throw new Error(`Invalid Quaternary value: ${e}`)}},Of=e=>[[yt,yt],[yt,It],[yt,yt],[It,yt]][e],Nf=P.fromValues(-1,1);function Cu(e){return Array.from({length:e.length},(t,r)=>e.indexOf(r))}var Su=[0,1,3,4,5,6,7,2],Iu=[0,1,2,7,3,4,5,6],uL=Cu(Su),hL=Cu(Iu),vy=(e,t,r,n,s)=>{if(t<=0)return;let o=e[t]||0,i=e[t-1],a=r[0]+r[1],c=!0,l=!0;if(n!==(a===0)?(c=o===1||o===2,l=o===1):(c=o<2,l=o===0),!c)return;let f=l?i:i+4,u=s[f];e[t-1]=u%4,e[t]=(o+4+Math.floor(u/4)-Math.floor(f/4))%4},Ry=(e,t,r)=>{let n=BigInt(e),s=r==="vu"||r==="wu"||r==="vw",o=r==="wv"||r==="vw",i=r==="wu"||r==="uw";s&&(n=(1n<<BigInt(2*t))-n-1n);let a=Fy(n,t,o,i);if(i){let{offset:[c,l],flips:[f,u]}=a;a.offset=[l,c],f===It&&P.add(a.offset,a.offset,Nf),u===It&&P.subtract(a.offset,a.offset,Nf)}if(o){let{offset:[c,l],flips:f}=a,u=(1<<t)-(c+l);f[0]=-f[0],a.offset[1]=u,a.flips=f}return a},Fy=(e,t,r,n)=>{let s=P.create(),o=[yt,yt],i=BigInt(e),a=[];for(;i>0n||a.length<t;)a.push(Number(i%4n)),i=i>>2n;let c=n?Iu:Su;for(let f=a.length-1;f>=0;f--)vy(a,f,o,r,c),P.multiply(o,o,Of(a[f]));o[0]=yt,o[1]=yt;for(let f=a.length-1;f>=0;f--){P.scale(s,s,2);let u=Ly(a[f],o);P.add(s,s,u),P.multiply(o,o,Of(a[f]))}let l=a[0]||0;return{flips:o,k:l,offset:wy(s)}};Tt.setMatrixArrayType(Float64Array);var Py=!1,Oy=P.clone(fn),Ny=P.negate(P.create(),fn),Xi=[0,1,2,3,4].map(e=>{let t=Ve.create();return Ve.fromRotation(t,Ls*e),t}),Df=P.create();function Dy(e,t,r){let n=(Py?xu:cy).clone();P.transformMat2(Df,r.offset,yu),r.flips[0]===yt&&r.flips[1]===It&&n.rotate180();let{k:s}=r,o=r.flips[0]+r.flips[1];return((o===-2||o===2)&&s>1||o===0&&(s===0||s===3))&&n.reflectY(),r.flips[0]===It&&r.flips[1]===It?n.rotate180():r.flips[0]===It?n.translate(Ny):r.flips[1]===It&&n.translate(Oy),n.translate(Df),n.scale(1/2**e),n.transform(Xi[t]),n}function wu(e){let t=xu.clone();return t.transform(Xi[e]),t}function Gy(){let e=[];for(let t of Xi)e.push(P.transformMat2(P.create(),Rs,t));return e.reverse(),new ji(e)}Tt.setMatrixArrayType(Float64Array);var Uy=class{constructor(){if(this.vertices=[],this.invocations=0,this.addFaceCenters(),this.addVertices(),this.addMidpoints(),this.vertices.length!==62)throw new Error("Failed to construct CRS: vertices length is not 62");Object.freeze(this.vertices)}getVertex(e){this.invocations++,this.invocations===1e4&&console.warn("Too many CRS invocations, results should be cached");for(let t of this.vertices)if(w.distance(e,t)<1e-5)return t;throw new Error("Failed to find vertex in CRS")}addFaceCenters(){kt.forEach(e=>this.add(_r(e.axis)))}addVertices(){let e=Math.atan(ny);for(let t of kt)for(let r=0;r<5;r++){let n=(2*r+1)*Math.PI/5,s=_r([n+t.angle,e]);w.transformQuat(s,s,t.quat),this.add(s)}}addMidpoints(){let e=Math.atan(Ps);for(let t of kt)for(let r=0;r<5;r++){let n=2*r*Math.PI/5,s=_r([n+t.angle,e]);w.transformQuat(s,s,t.quat),this.add(s)}}add(e){let t=w.normalize(w.create(),e);return this.vertices.find(n=>w.distance(t,n)<1e-5)?!1:(this.vertices.push(t),!0)}};Tt.setMatrixArrayType(Float64Array);var Vy=new Uy,Hy=class{constructor(){this.faceTriangles=[],this.sphericalTriangles=[],this.polyhedral=new Iy,this.gnomonic=new by}forward(e,t){let r=kt[t],n=_r(e),s=w.create();w.transformQuat(s,n,r.inverseQuat);let o=Ui(s),i=this.gnomonic.forward(o);i[1]=i[1]-r.angle;let a=this.getFaceTriangleIndex(i),c=this.shouldReflect(i),l=this.getFaceTriangle(a,c,!1),f=this.getSphericalTriangle(a,t,c);return this.polyhedral.forward(n,f,l)}inverse(e,t){let r=Mf(e),n=this.getFaceTriangleIndex(r),s=this.shouldReflect(r),o=this.getFaceTriangle(n,s,!1),i=this.getSphericalTriangle(n,t,s),a=this.polyhedral.inverse(e,o,i);return Ui(a)}shouldReflect(e){let[t,r]=e;return dy([t,this.normalizeGamma(r)])[0]>Ps}getFaceTriangleIndex([e,t]){return(Math.floor(t/Zt)+10)%10}getFaceTriangle(e,t=!1,r=!1){let n=e;return t&&(n+=r?20:10),this.faceTriangles[n]?this.faceTriangles[n]:(this.faceTriangles[n]=t?this._getReflectedFaceTriangle(e,r):this._getFaceTriangle(e),Object.freeze(this.faceTriangles[n]),this.faceTriangles[n])}_getFaceTriangle(e){let t=Math.floor((e+1)/2)%5,[r,n,s]=wu(t).getVertices(),o=P.create();return P.lerp(o,n,s,.5),e%2===0?[r,o,n]:[r,s,o]}_getReflectedFaceTriangle(e,t=!1){let[r,n,s]=this._getFaceTriangle(e).map(a=>P.clone(a)),o=e%2===0;P.negate(r,r);let i=o?n:s;return P.scaleAndAdd(r,r,i,t?1+1/Math.cos(Di):2),[r,s,n]}getSphericalTriangle(e,t,r=!1){let n=10*t+e;return r&&(n+=120),this.sphericalTriangles[n]?this.sphericalTriangles[n]:(this.sphericalTriangles[n]=this._getSphericalTriangle(e,t,r),Object.freeze(this.sphericalTriangles[n]),this.sphericalTriangles[n])}_getSphericalTriangle(e,t,r=!1){let n=kt[t];return this.getFaceTriangle(e,r,!0).map(i=>{let[a,c]=Mf(i),l=[a,c+n.angle],f=_r(this.gnomonic.inverse(l));return w.transformQuat(f,f,n.quat),Vy.getVertex(f)})}normalizeGamma(e){let t=e/Ls,r=Math.round(t);return(t-r)*Ls}},Mr=2,zy=30,qy=58n,ky=0x3ffffffffffffffn;function Jy(e){let t=zy-1,r=e>>1n;for(;t>-1&&(r&0b1n)===0n;)t-=1,r=r>>(t<Mr?1n:2n);return t}function jy(e){let t=Jy(e);if(t===-1)return{origin:kt[0],segment:0,S:0n,resolution:t};let r=Number(e>>58n),n,s;if(t===0)n=kt[r],s=0;else{let l=Math.floor(r/5);n=kt[l],s=(r+n.firstQuintant)%5}if(!n)throw new Error(`Could not parse origin: ${r}`);if(t<Mr)return{origin:n,segment:s,S:0n,resolution:t};let o=t-Mr+1,i=BigInt(2*o),a=qy-i,c=(e&ky)>>a;return{origin:n,segment:s,S:c,resolution:t}}Tt.setMatrixArrayType(Float64Array);var dL=Ve.create(),Xy=new Hy;function Wy({S:e,segment:t,origin:r,resolution:n}){let{quintant:s,orientation:o}=My(t,r);if(n===Mr-1)return wu(s);if(n===Mr-2)return Gy();let i=n-Mr+1,a=Ry(e,i,o);return Dy(i,s,a)}function Lu(e,{closedRing:t=!0,segments:r="auto"}={closedRing:!0,segments:"auto"}){let{S:n,segment:s,origin:o,resolution:i}=jy(e);r==="auto"&&(r=Math.max(1,Math.pow(2,6-i)));let u=Wy({S:n,segment:s,origin:o,resolution:i}).splitEdges(r).getVertices().map(d=>Xy.inverse(d,o.id)).map(d=>_u(d)),h=Ay(u);return t&&h.push(h[0]),h.reverse(),h}function vu(e){return BigInt(`0x${e}`)}var Gf=63710072e-1,pL=4*Math.PI*Gf*Gf;Tt.setMatrixArrayType(Float64Array);var yn=D(Ds(),1);var Yy=1/Math.PI*180,Ky=1/180*Math.PI,Qy={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Qy}};var Q=globalThis.mathgl.config;function Wi(e,{precision:t=Q.precision}={}){return e=Zy(e),`${parseFloat(e.toPrecision(t))}`}function wt(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Yi(e){return Fu(e)}function Ki(e){return Lt(e)}function Fu(e,t){return Qi(e,r=>r*Ky,t)}function Lt(e,t){return Qi(e,r=>r*Yy,t)}function Gs(e,t,r){return Qi(e,n=>Math.max(t,Math.min(r,n)))}function Te(e,t,r){return wt(e)?e.map((n,s)=>Te(n,t[s],r)):r*t+(1-r)*e}function Et(e,t,r){let n=Q.EPSILON;r&&(Q.EPSILON=r);try{if(e===t)return!0;if(wt(e)&&wt(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Et(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=Q.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Q.EPSILON=n}}function Zy(e){return Math.round(e/Q.EPSILON)*Q.EPSILON}function $y(e){return e.clone?e.clone():new Array(e.length)}function Qi(e,t,r){if(wt(e)){let n=e;r=r||$y(n);for(let s=0;s<r.length&&s<n.length;++s){let o=typeof e=="number"?e:e[s];r[s]=t(o,s,r)}return r}return t(e)}var Ee=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:wt(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Q)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Wi(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Et(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let s=0;s<this.ELEMENTS;++s){let o=t[s],i=typeof r=="number"?r:r[s];this[s]=o+n*(i-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(Q.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=t;return this.check()}addScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t),r);return this.check()}get elements(){return this}};function tT(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function V(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function _e(e,t,r=""){if(Q.debug&&!tT(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}function ft(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Me=class extends Ee{get x(){return this[0]}set x(t){this[0]=V(t)}get y(){return this[1]}set y(t){this[1]=V(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let s=this[n]-t[n];r+=s*s}return V(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return V(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ft(t>=0&&t<this.ELEMENTS,"index is out of range"),V(this[t])}setComponent(t,r){return ft(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){return this.add(new this.constructor(t).multiplyScalar(r))}};var tt=typeof Float32Array<"u"?Float32Array:Array,hn=Math.random;function br(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var PL=Math.PI/180;function eT(){let e=new tt(2);return tt!=Float32Array&&(e[0]=0,e[1]=0),e}function Pu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e}function Ou(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s+r[4],e[1]=r[1]*n+r[3]*s+r[5],e}function Us(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[3]*s+r[6],e[1]=r[1]*n+r[4]*s+r[7],e}function Vs(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[4]*s+r[12],e[1]=r[1]*n+r[5]*s+r[13],e}var OL=function(){let e=eT();return function(t,r,n,s,o,i){let a,c;for(r||(r=2),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],o(e,e,i),t[a]=e[0],t[a+1]=e[1];return t}}();function Hs(e,t,r){let n=t[0],s=t[1],o=r[3]*n+r[7]*s||1;return e[0]=(r[0]*n+r[4]*s)/o,e[1]=(r[1]*n+r[5]*s)/o,e}function zs(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o||1;return e[0]=(r[0]*n+r[4]*s+r[8]*o)/i,e[1]=(r[1]*n+r[5]*s+r[9]*o)/i,e[2]=(r[2]*n+r[6]*s+r[10]*o)/i,e}function Nu(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e}function Du(e,t,r){let n=t[0],s=t[1];return e[0]=r[0]*n+r[2]*s,e[1]=r[1]*n+r[3]*s,e[2]=t[2],e[3]=t[3],e}function qs(e,t,r){let n=t[0],s=t[1],o=t[2];return e[0]=r[0]*n+r[3]*s+r[6]*o,e[1]=r[1]*n+r[4]*s+r[7]*o,e[2]=r[2]*n+r[5]*s+r[8]*o,e[3]=t[3],e}var ze=class extends Me{constructor(t=0,r=0){super(2),wt(t)&&arguments.length===1?this.copy(t):(Q.debug&&(V(t),V(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Q.debug&&(V(t.x),V(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Vs(this,this,t),this.check()}transformAsVector(t){return Hs(this,this,t),this.check()}transformByMatrix3(t){return Us(this,this,t),this.check()}transformByMatrix2x3(t){return Ou(this,this,t),this.check()}transformByMatrix2(t){return Pu(this,this,t),this.check()}};var Je={};pt(Je,{add:()=>oT,angle:()=>ra,bezier:()=>xT,ceil:()=>iT,clone:()=>rT,copy:()=>nT,create:()=>ks,cross:()=>qe,dist:()=>ST,distance:()=>zu,div:()=>CT,divide:()=>Hu,dot:()=>dn,equals:()=>MT,exactEquals:()=>_T,floor:()=>aT,forEach:()=>LT,fromValues:()=>Js,hermite:()=>AT,inverse:()=>pT,len:()=>na,length:()=>Gu,lerp:()=>mT,max:()=>lT,min:()=>cT,mul:()=>BT,multiply:()=>Vu,negate:()=>dT,normalize:()=>Zi,random:()=>yT,rotateX:()=>$i,rotateY:()=>ta,rotateZ:()=>ea,round:()=>fT,scale:()=>uT,scaleAndAdd:()=>hT,set:()=>sT,slerp:()=>gT,sqrDist:()=>IT,sqrLen:()=>wT,squaredDistance:()=>qu,squaredLength:()=>ku,str:()=>ET,sub:()=>bT,subtract:()=>Uu,transformMat3:()=>pn,transformMat4:()=>ke,transformQuat:()=>mn,zero:()=>TT});function ks(){let e=new tt(3);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function rT(e){let t=new tt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Gu(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function Js(e,t,r){let n=new tt(3);return n[0]=e,n[1]=t,n[2]=r,n}function nT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function sT(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function oT(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Uu(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Vu(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Hu(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function iT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function aT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function cT(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function lT(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function fT(e,t){return e[0]=br(t[0]),e[1]=br(t[1]),e[2]=br(t[2]),e}function uT(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function hT(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function zu(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(r*r+n*n+s*s)}function qu(e,t){let r=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return r*r+n*n+s*s}function ku(e){let t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function dT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function pT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Zi(e,t){let r=t[0],n=t[1],s=t[2],o=r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function dn(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function qe(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2];return e[0]=s*c-o*a,e[1]=o*i-n*c,e[2]=n*a-s*i,e}function mT(e,t,r,n){let s=t[0],o=t[1],i=t[2];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e}function gT(e,t,r,n){let s=Math.acos(Math.min(Math.max(dn(t,r),-1),1)),o=Math.sin(s),i=Math.sin((1-n)*s)/o,a=Math.sin(n*s)/o;return e[0]=i*t[0]+a*r[0],e[1]=i*t[1]+a*r[1],e[2]=i*t[2]+a*r[2],e}function AT(e,t,r,n,s,o){let i=o*o,a=i*(2*o-3)+1,c=i*(o-2)+o,l=i*(o-1),f=i*(3-2*o);return e[0]=t[0]*a+r[0]*c+n[0]*l+s[0]*f,e[1]=t[1]*a+r[1]*c+n[1]*l+s[1]*f,e[2]=t[2]*a+r[2]*c+n[2]*l+s[2]*f,e}function xT(e,t,r,n,s,o){let i=1-o,a=i*i,c=o*o,l=a*i,f=3*o*a,u=3*c*i,h=c*o;return e[0]=t[0]*l+r[0]*f+n[0]*u+s[0]*h,e[1]=t[1]*l+r[1]*f+n[1]*u+s[1]*h,e[2]=t[2]*l+r[2]*f+n[2]*u+s[2]*h,e}function yT(e,t){t=t===void 0?1:t;let r=hn()*2*Math.PI,n=hn()*2-1,s=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*s,e[1]=Math.sin(r)*s,e[2]=n*t,e}function ke(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[3]*n+r[7]*s+r[11]*o+r[15];return i=i||1,e[0]=(r[0]*n+r[4]*s+r[8]*o+r[12])/i,e[1]=(r[1]*n+r[5]*s+r[9]*o+r[13])/i,e[2]=(r[2]*n+r[6]*s+r[10]*o+r[14])/i,e}function pn(e,t,r){let n=t[0],s=t[1],o=t[2];return e[0]=n*r[0]+s*r[3]+o*r[6],e[1]=n*r[1]+s*r[4]+o*r[7],e[2]=n*r[2]+s*r[5]+o*r[8],e}function mn(e,t,r){let n=r[0],s=r[1],o=r[2],i=r[3],a=t[0],c=t[1],l=t[2],f=s*l-o*c,u=o*a-n*l,h=n*c-s*a,d=s*h-o*u,p=o*f-n*h,A=n*u-s*f,m=i*2;return f*=m,u*=m,h*=m,d*=2,p*=2,A*=2,e[0]=a+f+d,e[1]=c+u+p,e[2]=l+h+A,e}function $i(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0],o[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),o[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ta(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),o[1]=s[1],o[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ea(e,t,r,n){let s=[],o=[];return s[0]=t[0]-r[0],s[1]=t[1]-r[1],s[2]=t[2]-r[2],o[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),o[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),o[2]=s[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function ra(e,t){let r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2],c=Math.sqrt((r*r+n*n+s*s)*(o*o+i*i+a*a)),l=c&&dn(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function TT(e){return e[0]=0,e[1]=0,e[2]=0,e}function ET(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function _T(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function MT(e,t){let r=e[0],n=e[1],s=e[2],o=t[0],i=t[1],a=t[2];return Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var bT=Uu,BT=Vu,CT=Hu,ST=zu,IT=qu,na=Gu,wT=ku,LT=function(){let e=ks();return function(t,r,n,s,o,i){let a,c;for(r||(r=3),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var sa=[0,0,0],js,x=class extends Me{static get ZERO(){return js||(js=new x(0,0,0),Object.freeze(js)),js}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&wt(t)?this.copy(t):(Q.debug&&(V(t),V(r),V(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Q.debug&&(V(t.x),V(t.y),V(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=V(t)}angle(t){return ra(this,t)}cross(t){return qe(this,this,t),this.check()}rotateX({radians:t,origin:r=sa}){return $i(this,this,r,t),this.check()}rotateY({radians:t,origin:r=sa}){return ta(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=sa}){return ea(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ke(this,this,t),this.check()}transformAsVector(t){return zs(this,this,t),this.check()}transformByMatrix3(t){return pn(this,this,t),this.check()}transformByMatrix2(t){return Nu(this,this,t),this.check()}transformByQuaternion(t){return mn(this,this,t),this.check()}};var Xs,Cr=class extends Me{static get ZERO(){return Xs||(Xs=new Cr(0,0,0,0),Object.freeze(Xs)),Xs}constructor(t=0,r=0,n=0,s=0){super(-0,-0,-0,-0),wt(t)&&arguments.length===1?this.copy(t):(Q.debug&&(V(t),V(r),V(n),V(s)),this[0]=t,this[1]=r,this[2]=n,this[3]=s)}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return Q.debug&&(V(t.x),V(t.y),V(t.z),V(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=V(t)}get w(){return this[3]}set w(t){this[3]=V(t)}transform(t){return ke(this,this,t),this.check()}transformByMatrix3(t){return qs(this,this,t),this.check()}transformByMatrix2(t){return Du(this,this,t),this.check()}transformByQuaternion(t){return mn(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Sr=class extends Ee{toString(){let t="[";if(Q.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=V(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)r[s]=this[n+s];return r}setColumn(t,r){let n=t*this.RANK;for(let s=0;s<this.RANK;++s)this[n+s]=r[s];return this}};function Ju(){let e=new tt(9);return tt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ju(e,t){if(e===t){let r=t[1],n=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=s}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];return e}function Xu(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],f=t[8],u=f*i-a*l,h=-f*o+a*c,d=l*o-i*c,p=r*u+n*h+s*d;return p?(p=1/p,e[0]=u*p,e[1]=(-f*n+s*l)*p,e[2]=(a*n-s*i)*p,e[3]=h*p,e[4]=(f*r-s*c)*p,e[5]=(-a*r+s*o)*p,e[6]=d*p,e[7]=(-l*r+n*c)*p,e[8]=(i*r-n*o)*p,e):null}function Wu(e){let t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],i=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-i*c)+r*(-l*s+i*a)+n*(c*s-o*a)}function oa(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=r[0],d=r[1],p=r[2],A=r[3],m=r[4],y=r[5],_=r[6],E=r[7],M=r[8];return e[0]=h*n+d*i+p*l,e[1]=h*s+d*a+p*f,e[2]=h*o+d*c+p*u,e[3]=A*n+m*i+y*l,e[4]=A*s+m*a+y*f,e[5]=A*o+m*c+y*u,e[6]=_*n+E*i+M*l,e[7]=_*s+E*a+M*f,e[8]=_*o+E*c+M*u,e}function Yu(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=r[0],d=r[1];return e[0]=n,e[1]=s,e[2]=o,e[3]=i,e[4]=a,e[5]=c,e[6]=h*n+d*i+l,e[7]=h*s+d*a+f,e[8]=h*o+d*c+u,e}function Ku(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=Math.sin(r),d=Math.cos(r);return e[0]=d*n+h*i,e[1]=d*s+h*a,e[2]=d*o+h*c,e[3]=d*i-h*n,e[4]=d*a-h*s,e[5]=d*c-h*o,e[6]=l,e[7]=f,e[8]=u,e}function ia(e,t,r){let n=r[0],s=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Qu(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r+r,a=n+n,c=s+s,l=r*i,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return e[0]=1-u-p,e[3]=f-y,e[6]=h+m,e[1]=f+y,e[4]=1-l-p,e[7]=d-A,e[2]=h-m,e[5]=d+A,e[8]=1-l-u,e}var aa;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(aa||(aa={}));var RT=Object.freeze([1,0,0,0,1,0,0,0,1]),J=class extends Sr{static get IDENTITY(){return PT()}static get ZERO(){return FT()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return aa}constructor(t,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):r.length>0?this.copy([t,...r]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(RT)}fromObject(t){return this.check()}fromQuaternion(t){return Qu(this,t),this.check()}set(t,r,n,s,o,i,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=i,this[8]=l,this.check()}determinant(){return Wu(this)}transpose(){return ju(this,this),this.check()}invert(){return Xu(this,this),this.check()}multiplyLeft(t){return oa(this,t,this),this.check()}multiplyRight(t){return oa(this,this,t),this.check()}rotate(t){return Ku(this,this,t),this.check()}scale(t){return Array.isArray(t)?ia(this,this,t):ia(this,this,[t,t]),this.check()}translate(t){return Yu(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=Us(r||[-0,-0],t,this);break;case 3:n=pn(r||[-0,-0,-0],t,this);break;case 4:n=qs(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(n,t.length),n}transformVector(t,r){return this.transform(t,r)}transformVector2(t,r){return this.transform(t,r)}transformVector3(t,r){return this.transform(t,r)}},Ws,Ys=null;function FT(){return Ws||(Ws=new J([0,0,0,0,0,0,0,0,0]),Object.freeze(Ws)),Ws}function PT(){return Ys||(Ys=new J,Object.freeze(Ys)),Ys}var An={};pt(An,{add:()=>oE,adjoint:()=>VT,clone:()=>NT,copy:()=>DT,create:()=>OT,decompose:()=>KT,determinant:()=>fa,equals:()=>lE,exactEquals:()=>cE,frob:()=>sE,fromQuat:()=>Aa,fromQuat2:()=>XT,fromRotation:()=>qT,fromRotationTranslation:()=>$u,fromRotationTranslationScale:()=>QT,fromRotationTranslationScaleOrigin:()=>ZT,fromScaling:()=>zT,fromTranslation:()=>HT,fromValues:()=>GT,fromXRotation:()=>kT,fromYRotation:()=>JT,fromZRotation:()=>jT,frustum:()=>xa,getRotation:()=>YT,getScaling:()=>th,getTranslation:()=>WT,identity:()=>Zu,invert:()=>la,lookAt:()=>Ea,mul:()=>fE,multiply:()=>gn,multiplyScalar:()=>iE,multiplyScalarAndAdd:()=>aE,ortho:()=>Ta,orthoNO:()=>rh,orthoZO:()=>eE,perspective:()=>ya,perspectiveFromFieldOfView:()=>tE,perspectiveNO:()=>eh,perspectiveZO:()=>$T,rotate:()=>da,rotateX:()=>pa,rotateY:()=>ma,rotateZ:()=>ga,scale:()=>ha,set:()=>UT,str:()=>nE,sub:()=>uE,subtract:()=>nh,targetTo:()=>rE,translate:()=>ua,transpose:()=>ca});function OT(){let e=new tt(16);return tt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function NT(e){let t=new tt(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function DT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function GT(e,t,r,n,s,o,i,a,c,l,f,u,h,d,p,A){let m=new tt(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=s,m[5]=o,m[6]=i,m[7]=a,m[8]=c,m[9]=l,m[10]=f,m[11]=u,m[12]=h,m[13]=d,m[14]=p,m[15]=A,m}function UT(e,t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return e[0]=t,e[1]=r,e[2]=n,e[3]=s,e[4]=o,e[5]=i,e[6]=a,e[7]=c,e[8]=l,e[9]=f,e[10]=u,e[11]=h,e[12]=d,e[13]=p,e[14]=A,e[15]=m,e}function Zu(e){return 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}function ca(e,t){if(e===t){let r=t[1],n=t[2],s=t[3],o=t[6],i=t[7],a=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]=o,e[11]=t[14],e[12]=s,e[13]=i,e[14]=a}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];return e}function la(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],_=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,L=s*l-o*c,b=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,R=u*y-d*A,F=h*y-d*m,v=_*F-E*R+M*S+B*g-C*T+L*b;return v?(v=1/v,e[0]=(a*F-c*R+l*S)*v,e[1]=(s*R-n*F-o*S)*v,e[2]=(A*L-m*C+y*B)*v,e[3]=(h*C-u*L-d*B)*v,e[4]=(c*g-i*F-l*T)*v,e[5]=(r*F-s*g+o*T)*v,e[6]=(m*M-p*L-y*E)*v,e[7]=(f*L-h*M+d*E)*v,e[8]=(i*R-a*g+l*b)*v,e[9]=(n*g-r*R-o*b)*v,e[10]=(p*C-A*M+y*_)*v,e[11]=(u*M-f*C-d*_)*v,e[12]=(a*T-i*S-c*b)*v,e[13]=(r*S-n*T+s*b)*v,e[14]=(A*E-p*B-m*_)*v,e[15]=(f*B-u*E+h*_)*v,e):null}function VT(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],a=t[5],c=t[6],l=t[7],f=t[8],u=t[9],h=t[10],d=t[11],p=t[12],A=t[13],m=t[14],y=t[15],_=r*a-n*i,E=r*c-s*i,M=r*l-o*i,B=n*c-s*a,C=n*l-o*a,L=s*l-o*c,b=f*A-u*p,T=f*m-h*p,g=f*y-d*p,S=u*m-h*A,R=u*y-d*A,F=h*y-d*m;return e[0]=a*F-c*R+l*S,e[1]=s*R-n*F-o*S,e[2]=A*L-m*C+y*B,e[3]=h*C-u*L-d*B,e[4]=c*g-i*F-l*T,e[5]=r*F-s*g+o*T,e[6]=m*M-p*L-y*E,e[7]=f*L-h*M+d*E,e[8]=i*R-a*g+l*b,e[9]=n*g-r*R-o*b,e[10]=p*C-A*M+y*_,e[11]=u*M-f*C-d*_,e[12]=a*T-i*S-c*b,e[13]=r*S-n*T+s*b,e[14]=A*E-p*B-m*_,e[15]=f*B-u*E+h*_,e}function fa(e){let t=e[0],r=e[1],n=e[2],s=e[3],o=e[4],i=e[5],a=e[6],c=e[7],l=e[8],f=e[9],u=e[10],h=e[11],d=e[12],p=e[13],A=e[14],m=e[15],y=t*i-r*o,_=t*a-n*o,E=r*a-n*i,M=l*p-f*d,B=l*A-u*d,C=f*A-u*p,L=t*C-r*B+n*M,b=o*C-i*B+a*M,T=l*E-f*_+u*y,g=d*E-p*_+A*y;return c*L-s*b+m*T-h*g}function gn(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=t[8],h=t[9],d=t[10],p=t[11],A=t[12],m=t[13],y=t[14],_=t[15],E=r[0],M=r[1],B=r[2],C=r[3];return e[0]=E*n+M*a+B*u+C*A,e[1]=E*s+M*c+B*h+C*m,e[2]=E*o+M*l+B*d+C*y,e[3]=E*i+M*f+B*p+C*_,E=r[4],M=r[5],B=r[6],C=r[7],e[4]=E*n+M*a+B*u+C*A,e[5]=E*s+M*c+B*h+C*m,e[6]=E*o+M*l+B*d+C*y,e[7]=E*i+M*f+B*p+C*_,E=r[8],M=r[9],B=r[10],C=r[11],e[8]=E*n+M*a+B*u+C*A,e[9]=E*s+M*c+B*h+C*m,e[10]=E*o+M*l+B*d+C*y,e[11]=E*i+M*f+B*p+C*_,E=r[12],M=r[13],B=r[14],C=r[15],e[12]=E*n+M*a+B*u+C*A,e[13]=E*s+M*c+B*h+C*m,e[14]=E*o+M*l+B*d+C*y,e[15]=E*i+M*f+B*p+C*_,e}function ua(e,t,r){let n=r[0],s=r[1],o=r[2],i,a,c,l,f,u,h,d,p,A,m,y;return t===e?(e[12]=t[0]*n+t[4]*s+t[8]*o+t[12],e[13]=t[1]*n+t[5]*s+t[9]*o+t[13],e[14]=t[2]*n+t[6]*s+t[10]*o+t[14],e[15]=t[3]*n+t[7]*s+t[11]*o+t[15]):(i=t[0],a=t[1],c=t[2],l=t[3],f=t[4],u=t[5],h=t[6],d=t[7],p=t[8],A=t[9],m=t[10],y=t[11],e[0]=i,e[1]=a,e[2]=c,e[3]=l,e[4]=f,e[5]=u,e[6]=h,e[7]=d,e[8]=p,e[9]=A,e[10]=m,e[11]=y,e[12]=i*n+f*s+p*o+t[12],e[13]=a*n+u*s+A*o+t[13],e[14]=c*n+h*s+m*o+t[14],e[15]=l*n+d*s+y*o+t[15]),e}function ha(e,t,r){let n=r[0],s=r[1],o=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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function da(e,t,r,n){let s=n[0],o=n[1],i=n[2],a=Math.sqrt(s*s+o*o+i*i),c,l,f,u,h,d,p,A,m,y,_,E,M,B,C,L,b,T,g,S,R,F,v,G;return a<1e-6?null:(a=1/a,s*=a,o*=a,i*=a,l=Math.sin(r),c=Math.cos(r),f=1-c,u=t[0],h=t[1],d=t[2],p=t[3],A=t[4],m=t[5],y=t[6],_=t[7],E=t[8],M=t[9],B=t[10],C=t[11],L=s*s*f+c,b=o*s*f+i*l,T=i*s*f-o*l,g=s*o*f-i*l,S=o*o*f+c,R=i*o*f+s*l,F=s*i*f+o*l,v=o*i*f-s*l,G=i*i*f+c,e[0]=u*L+A*b+E*T,e[1]=h*L+m*b+M*T,e[2]=d*L+y*b+B*T,e[3]=p*L+_*b+C*T,e[4]=u*g+A*S+E*R,e[5]=h*g+m*S+M*R,e[6]=d*g+y*S+B*R,e[7]=p*g+_*S+C*R,e[8]=u*F+A*v+E*G,e[9]=h*F+m*v+M*G,e[10]=d*F+y*v+B*G,e[11]=p*F+_*v+C*G,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function pa(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[4],i=t[5],a=t[6],c=t[7],l=t[8],f=t[9],u=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*s+l*n,e[5]=i*s+f*n,e[6]=a*s+u*n,e[7]=c*s+h*n,e[8]=l*s-o*n,e[9]=f*s-i*n,e[10]=u*s-a*n,e[11]=h*s-c*n,e}function ma(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[0],i=t[1],a=t[2],c=t[3],l=t[8],f=t[9],u=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s-l*n,e[1]=i*s-f*n,e[2]=a*s-u*n,e[3]=c*s-h*n,e[8]=o*n+l*s,e[9]=i*n+f*s,e[10]=a*n+u*s,e[11]=c*n+h*s,e}function ga(e,t,r){let n=Math.sin(r),s=Math.cos(r),o=t[0],i=t[1],a=t[2],c=t[3],l=t[4],f=t[5],u=t[6],h=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*s+l*n,e[1]=i*s+f*n,e[2]=a*s+u*n,e[3]=c*s+h*n,e[4]=l*s-o*n,e[5]=f*s-i*n,e[6]=u*s-a*n,e[7]=h*s-c*n,e}function HT(e,t){return 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]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function zT(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function qT(e,t,r){let n=r[0],s=r[1],o=r[2],i=Math.sqrt(n*n+s*s+o*o),a,c,l;return i<1e-6?null:(i=1/i,n*=i,s*=i,o*=i,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=n*n*l+a,e[1]=s*n*l+o*c,e[2]=o*n*l-s*c,e[3]=0,e[4]=n*s*l-o*c,e[5]=s*s*l+a,e[6]=o*s*l+n*c,e[7]=0,e[8]=n*o*l+s*c,e[9]=s*o*l-n*c,e[10]=o*o*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function kT(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function JT(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function jT(e,t){let r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,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}function $u(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=n+n,c=s+s,l=o+o,f=n*a,u=n*c,h=n*l,d=s*c,p=s*l,A=o*l,m=i*a,y=i*c,_=i*l;return e[0]=1-(d+A),e[1]=u+_,e[2]=h-y,e[3]=0,e[4]=u-_,e[5]=1-(f+A),e[6]=p+m,e[7]=0,e[8]=h+y,e[9]=p-m,e[10]=1-(f+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function XT(e,t){let r=new tt(3),n=-t[0],s=-t[1],o=-t[2],i=t[3],a=t[4],c=t[5],l=t[6],f=t[7],u=n*n+s*s+o*o+i*i;return u>0?(r[0]=(a*i+f*n+c*o-l*s)*2/u,r[1]=(c*i+f*s+l*n-a*o)*2/u,r[2]=(l*i+f*o+a*s-c*n)*2/u):(r[0]=(a*i+f*n+c*o-l*s)*2,r[1]=(c*i+f*s+l*n-a*o)*2,r[2]=(l*i+f*o+a*s-c*n)*2),$u(e,t,r),e}function WT(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function th(e,t){let r=t[0],n=t[1],s=t[2],o=t[4],i=t[5],a=t[6],c=t[8],l=t[9],f=t[10];return e[0]=Math.sqrt(r*r+n*n+s*s),e[1]=Math.sqrt(o*o+i*i+a*a),e[2]=Math.sqrt(c*c+l*l+f*f),e}function YT(e,t){let r=new tt(3);th(r,t);let n=1/r[0],s=1/r[1],o=1/r[2],i=t[0]*n,a=t[1]*s,c=t[2]*o,l=t[4]*n,f=t[5]*s,u=t[6]*o,h=t[8]*n,d=t[9]*s,p=t[10]*o,A=i+f+p,m=0;return A>0?(m=Math.sqrt(A+1)*2,e[3]=.25*m,e[0]=(u-d)/m,e[1]=(h-c)/m,e[2]=(a-l)/m):i>f&&i>p?(m=Math.sqrt(1+i-f-p)*2,e[3]=(u-d)/m,e[0]=.25*m,e[1]=(a+l)/m,e[2]=(h+c)/m):f>p?(m=Math.sqrt(1+f-i-p)*2,e[3]=(h-c)/m,e[0]=(a+l)/m,e[1]=.25*m,e[2]=(u+d)/m):(m=Math.sqrt(1+p-i-f)*2,e[3]=(a-l)/m,e[0]=(h+c)/m,e[1]=(u+d)/m,e[2]=.25*m),e}function KT(e,t,r,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];let s=n[0],o=n[1],i=n[2],a=n[4],c=n[5],l=n[6],f=n[8],u=n[9],h=n[10];r[0]=Math.sqrt(s*s+o*o+i*i),r[1]=Math.sqrt(a*a+c*c+l*l),r[2]=Math.sqrt(f*f+u*u+h*h);let d=1/r[0],p=1/r[1],A=1/r[2],m=s*d,y=o*p,_=i*A,E=a*d,M=c*p,B=l*A,C=f*d,L=u*p,b=h*A,T=m+M+b,g=0;return T>0?(g=Math.sqrt(T+1)*2,e[3]=.25*g,e[0]=(B-L)/g,e[1]=(C-_)/g,e[2]=(y-E)/g):m>M&&m>b?(g=Math.sqrt(1+m-M-b)*2,e[3]=(B-L)/g,e[0]=.25*g,e[1]=(y+E)/g,e[2]=(C+_)/g):M>b?(g=Math.sqrt(1+M-m-b)*2,e[3]=(C-_)/g,e[0]=(y+E)/g,e[1]=.25*g,e[2]=(B+L)/g):(g=Math.sqrt(1+b-m-M)*2,e[3]=(y-E)/g,e[0]=(C+_)/g,e[1]=(B+L)/g,e[2]=.25*g),e}function QT(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=s+s,l=o+o,f=i+i,u=s*c,h=s*l,d=s*f,p=o*l,A=o*f,m=i*f,y=a*c,_=a*l,E=a*f,M=n[0],B=n[1],C=n[2];return e[0]=(1-(p+m))*M,e[1]=(h+E)*M,e[2]=(d-_)*M,e[3]=0,e[4]=(h-E)*B,e[5]=(1-(u+m))*B,e[6]=(A+y)*B,e[7]=0,e[8]=(d+_)*C,e[9]=(A-y)*C,e[10]=(1-(u+p))*C,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function ZT(e,t,r,n,s){let o=t[0],i=t[1],a=t[2],c=t[3],l=o+o,f=i+i,u=a+a,h=o*l,d=o*f,p=o*u,A=i*f,m=i*u,y=a*u,_=c*l,E=c*f,M=c*u,B=n[0],C=n[1],L=n[2],b=s[0],T=s[1],g=s[2],S=(1-(A+y))*B,R=(d+M)*B,F=(p-E)*B,v=(d-M)*C,G=(1-(h+y))*C,X=(m+_)*C,z=(p+E)*L,et=(m-_)*L,K=(1-(h+A))*L;return e[0]=S,e[1]=R,e[2]=F,e[3]=0,e[4]=v,e[5]=G,e[6]=X,e[7]=0,e[8]=z,e[9]=et,e[10]=K,e[11]=0,e[12]=r[0]+b-(S*b+v*T+z*g),e[13]=r[1]+T-(R*b+G*T+et*g),e[14]=r[2]+g-(F*b+X*T+K*g),e[15]=1,e}function Aa(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r+r,a=n+n,c=s+s,l=r*i,f=n*i,u=n*a,h=s*i,d=s*a,p=s*c,A=o*i,m=o*a,y=o*c;return e[0]=1-u-p,e[1]=f+y,e[2]=h-m,e[3]=0,e[4]=f-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=h+m,e[9]=d-A,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function xa(e,t,r,n,s,o,i){let a=1/(r-t),c=1/(s-n),l=1/(o-i);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(s+n)*c,e[10]=(i+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*o*2*l,e[15]=0,e}function eh(e,t,r,n,s){let o=1/Math.tan(t/2);if(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,s!=null&&s!==1/0){let i=1/(n-s);e[10]=(s+n)*i,e[14]=2*s*n*i}else e[10]=-1,e[14]=-2*n;return e}var ya=eh;function $T(e,t,r,n,s){let o=1/Math.tan(t/2);if(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,s!=null&&s!==1/0){let i=1/(n-s);e[10]=s*i,e[14]=s*n*i}else e[10]=-1,e[14]=-n;return e}function tE(e,t,r,n){let s=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(i+a),l=2/(s+o);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((i-a)*c*.5),e[9]=(s-o)*l*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function rh(e,t,r,n,s,o,i){let a=1/(t-r),c=1/(n-s),l=1/(o-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=(i+o)*l,e[15]=1,e}var Ta=rh;function eE(e,t,r,n,s,o,i){let a=1/(t-r),c=1/(n-s),l=1/(o-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+r)*a,e[13]=(s+n)*c,e[14]=o*l,e[15]=1,e}function Ea(e,t,r,n){let s,o,i,a,c,l,f,u,h,d,p=t[0],A=t[1],m=t[2],y=n[0],_=n[1],E=n[2],M=r[0],B=r[1],C=r[2];return Math.abs(p-M)<1e-6&&Math.abs(A-B)<1e-6&&Math.abs(m-C)<1e-6?Zu(e):(u=p-M,h=A-B,d=m-C,s=1/Math.sqrt(u*u+h*h+d*d),u*=s,h*=s,d*=s,o=_*d-E*h,i=E*u-y*d,a=y*h-_*u,s=Math.sqrt(o*o+i*i+a*a),s?(s=1/s,o*=s,i*=s,a*=s):(o=0,i=0,a=0),c=h*a-d*i,l=d*o-u*a,f=u*i-h*o,s=Math.sqrt(c*c+l*l+f*f),s?(s=1/s,c*=s,l*=s,f*=s):(c=0,l=0,f=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=i,e[5]=l,e[6]=h,e[7]=0,e[8]=a,e[9]=f,e[10]=d,e[11]=0,e[12]=-(o*p+i*A+a*m),e[13]=-(c*p+l*A+f*m),e[14]=-(u*p+h*A+d*m),e[15]=1,e)}function rE(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=n[0],c=n[1],l=n[2],f=s-r[0],u=o-r[1],h=i-r[2],d=f*f+u*u+h*h;d>0&&(d=1/Math.sqrt(d),f*=d,u*=d,h*=d);let p=c*h-l*u,A=l*f-a*h,m=a*u-c*f;return d=p*p+A*A+m*m,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,m*=d),e[0]=p,e[1]=A,e[2]=m,e[3]=0,e[4]=u*m-h*A,e[5]=h*p-f*m,e[6]=f*A-u*p,e[7]=0,e[8]=f,e[9]=u,e[10]=h,e[11]=0,e[12]=s,e[13]=o,e[14]=i,e[15]=1,e}function nE(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`}function sE(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function oE(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[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function nh(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[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function iE(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[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function aE(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function cE(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function lE(e,t){let r=e[0],n=e[1],s=e[2],o=e[3],i=e[4],a=e[5],c=e[6],l=e[7],f=e[8],u=e[9],h=e[10],d=e[11],p=e[12],A=e[13],m=e[14],y=e[15],_=t[0],E=t[1],M=t[2],B=t[3],C=t[4],L=t[5],b=t[6],T=t[7],g=t[8],S=t[9],R=t[10],F=t[11],v=t[12],G=t[13],X=t[14],z=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(s-M)<=1e-6*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(i-C)<=1e-6*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(a-L)<=1e-6*Math.max(1,Math.abs(a),Math.abs(L))&&Math.abs(c-b)<=1e-6*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(f-g)<=1e-6*Math.max(1,Math.abs(f),Math.abs(g))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-R)<=1e-6*Math.max(1,Math.abs(h),Math.abs(R))&&Math.abs(d-F)<=1e-6*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(p-v)<=1e-6*Math.max(1,Math.abs(p),Math.abs(v))&&Math.abs(A-G)<=1e-6*Math.max(1,Math.abs(A),Math.abs(G))&&Math.abs(m-X)<=1e-6*Math.max(1,Math.abs(m),Math.abs(X))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var fE=gn,uE=nh;function hE(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function sh(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}function oh(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}function ih(e){let t=e[0],r=e[1],n=e[2],s=e[3];return Math.sqrt(t*t+r*r+n*n+s*s)}function ah(e){let t=e[0],r=e[1],n=e[2],s=e[3];return t*t+r*r+n*n+s*s}function ch(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o;return i>0&&(i=1/Math.sqrt(i)),e[0]=r*i,e[1]=n*i,e[2]=s*i,e[3]=o*i,e}function lh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function fh(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3];return e[0]=s+n*(r[0]-s),e[1]=o+n*(r[1]-o),e[2]=i+n*(r[2]-i),e[3]=a+n*(r[3]-a),e}function uh(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3];return e[0]=r[0]*n+r[4]*s+r[8]*o+r[12]*i,e[1]=r[1]*n+r[5]*s+r[9]*o+r[13]*i,e[2]=r[2]*n+r[6]*s+r[10]*o+r[14]*i,e[3]=r[3]*n+r[7]*s+r[11]*o+r[15]*i,e}function hh(e,t,r){let n=t[0],s=t[1],o=t[2],i=r[0],a=r[1],c=r[2],l=r[3],f=l*n+a*o-c*s,u=l*s+c*n-i*o,h=l*o+i*s-a*n,d=-i*n-a*s-c*o;return e[0]=f*l+d*-i+u*-c-h*-a,e[1]=u*l+d*-a+h*-i-f*-c,e[2]=h*l+d*-c+f*-a-u*-i,e[3]=t[3],e}var pv=function(){let e=hE();return function(t,r,n,s,o,i){let a,c;for(r||(r=4),n||(n=0),s?c=Math.min(s*r+n,t.length):c=t.length,a=n;a<c;a+=r)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],o(e,e,i),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var ba;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(ba||(ba={}));var pE=45*Math.PI/180,mE=1,_a=.1,Ma=500,gE=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),O=class extends Sr{static get IDENTITY(){return xE()}static get ZERO(){return AE()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ba}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this[4]=o,this[5]=i,this[6]=a,this[7]=c,this[8]=l,this[9]=f,this[10]=u,this[11]=h,this[12]=d,this[13]=p,this[14]=A,this[15]=m,this.check()}setRowMajor(t,r,n,s,o,i,a,c,l,f,u,h,d,p,A,m){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=i,this[6]=f,this[7]=p,this[8]=n,this[9]=a,this[10]=u,this[11]=A,this[12]=s,this[13]=c,this[14]=h,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(gE)}fromObject(t){return this.check()}fromQuaternion(t){return Aa(this,t),this.check()}frustum(t){let{left:r,right:n,bottom:s,top:o,near:i=_a,far:a=Ma}=t;return a===1/0?yE(this,r,n,s,o,i):xa(this,r,n,s,o,i,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:s=[0,1,0]}=t;return Ea(this,r,n,s),this.check()}ortho(t){let{left:r,right:n,bottom:s,top:o,near:i=_a,far:a=Ma}=t;return Ta(this,r,n,s,o,i,a),this.check()}orthographic(t){let{fovy:r=pE,aspect:n=mE,focalDistance:s=1,near:o=_a,far:i=Ma}=t;dh(r);let a=r/2,c=s*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:i})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:s=.1,far:o=500}=t;return dh(r),ya(this,r,n,s,o),this.check()}determinant(){return fa(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*o,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*o,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),s=1/n[0],o=1/n[1],i=1/n[2];return t[0]=this[0]*s,t[1]=this[1]*o,t[2]=this[2]*i,t[3]=this[4]*s,t[4]=this[5]*o,t[5]=this[6]*i,t[6]=this[8]*s,t[7]=this[9]*o,t[8]=this[10]*i,t}transpose(){return ca(this,this),this.check()}invert(){return la(this,this),this.check()}multiplyLeft(t){return gn(this,t,this),this.check()}multiplyRight(t){return gn(this,this,t),this.check()}rotateX(t){return pa(this,this,t),this.check()}rotateY(t){return ma(this,this,t),this.check()}rotateZ(t){return ga(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return da(this,this,t,r),this.check()}scale(t){return ha(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ua(this,this,t),this.check()}transform(t,r){return t.length===4?(r=uh(r||[-0,-0,-0,-0],t,this),_e(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,s;switch(n){case 2:s=Vs(r||[-0,-0],t,this);break;case 3:s=ke(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(s,t.length),s}transformAsVector(t,r){let n;switch(t.length){case 2:n=Hs(r||[-0,-0],t,this);break;case 3:n=zs(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(n,t.length),n}transformPoint(t,r){return this.transformAsPoint(t,r)}transformVector(t,r){return this.transformAsPoint(t,r)}transformDirection(t,r){return this.transformAsVector(t,r)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}},Ks,Qs;function AE(){return Ks||(Ks=new O([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Ks)),Ks}function xE(){return Qs||(Qs=new O,Object.freeze(Qs)),Qs}function dh(e){if(e>Math.PI*2)throw Error("expected radians")}function yE(e,t,r,n,s,o){let i=2*o/(r-t),a=2*o/(s-n),c=(r+t)/(r-t),l=(s+n)/(s-n),f=-1,u=-1,h=-2*o;return e[0]=i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=f,e[11]=u,e[12]=0,e[13]=0,e[14]=h,e[15]=0,e}function ph(){let e=new tt(4);return tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function mh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ba(e,t,r){r=r*.5;let 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 Ca(e,t,r){let n=t[0],s=t[1],o=t[2],i=t[3],a=r[0],c=r[1],l=r[2],f=r[3];return e[0]=n*f+i*a+s*l-o*c,e[1]=s*f+i*c+o*a-n*l,e[2]=o*f+i*l+n*c-s*a,e[3]=i*f-n*a-s*c-o*l,e}function gh(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=s*c+o*a,e[2]=o*c-s*a,e[3]=i*c-n*a,e}function Ah(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=s*c+i*a,e[2]=o*c+n*a,e[3]=i*c-s*a,e}function xh(e,t,r){r*=.5;let n=t[0],s=t[1],o=t[2],i=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=s*c-n*a,e[2]=o*c+i*a,e[3]=i*c-o*a,e}function yh(e,t){let r=t[0],n=t[1],s=t[2];return e[0]=r,e[1]=n,e[2]=s,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s)),e}function xn(e,t,r,n){let s=t[0],o=t[1],i=t[2],a=t[3],c=r[0],l=r[1],f=r[2],u=r[3],h,d,p,A,m;return h=s*c+o*l+i*f+a*u,h<0&&(h=-h,c=-c,l=-l,f=-f,u=-u),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-n)*d)/m,A=Math.sin(n*d)/m):(p=1-n,A=n),e[0]=p*s+A*c,e[1]=p*o+A*l,e[2]=p*i+A*f,e[3]=p*a+A*u,e}function Th(e,t){let r=t[0],n=t[1],s=t[2],o=t[3],i=r*r+n*n+s*s+o*o,a=i?1/i:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-s*a,e[3]=o*a,e}function Eh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Sa(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let o=(s+1)%3,i=(s+2)%3;n=Math.sqrt(t[s*3+s]-t[o*3+o]-t[i*3+i]+1),e[s]=.5*n,n=.5/n,e[3]=(t[o*3+i]-t[i*3+o])*n,e[o]=(t[o*3+s]+t[s*3+o])*n,e[i]=(t[i*3+s]+t[s*3+i])*n}return e}var _h=sh;var Mh=oh,bh=lh,Bh=fh,Ch=ih;var Sh=ah;var Ih=ch;var wh=function(){let e=ks(),t=Js(1,0,0),r=Js(0,1,0);return function(n,s,o){let i=dn(s,o);return i<-.999999?(qe(e,t,s),na(e)<1e-6&&qe(e,r,s),Zi(e,e),Ba(n,e,Math.PI),n):i>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(qe(e,s,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+i,Ih(n,n))}}(),Iv=function(){let e=ph(),t=ph();return function(r,n,s,o,i,a){return xn(e,n,i,a),xn(t,s,o,a),xn(r,e,t,2*a*(1-a)),r}}(),wv=function(){let e=Ju();return function(t,r,n,s){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Ih(t,Sa(t,e))}}();var TE=[0,0,0,1],$t=class extends Ee{constructor(t=0,r=0,n=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,s){return this[0]=t,this[1]=r,this[2]=n,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return Sa(this,t),this.check()}fromAxisRotation(t,r){return Ba(this,t,r),this.check()}identity(){return mh(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=V(t)}get y(){return this[1]}set y(t){this[1]=V(t)}get z(){return this[2]}set z(t){this[2]=V(t)}get w(){return this[3]}set w(t){this[3]=V(t)}len(){return Ch(this)}lengthSquared(){return Sh(this)}dot(t){return bh(this,t)}rotationTo(t,r){return wh(this,t,r),this.check()}add(t){return _h(this,this,t),this.check()}calculateW(){return yh(this,this),this.check()}conjugate(){return Eh(this,this),this.check()}invert(){return Th(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(Bh(this,t,r,n),this.check())}multiplyRight(t){return Ca(this,this,t),this.check()}multiplyLeft(t){return Ca(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return gh(this,this,t),this.check()}rotateY(t){return Ah(this,this,t),this.check()}rotateZ(t){return xh(this,this,t),this.check()}scale(t){return Mh(this,this,t),this.check()}slerp(t,r,n){let s,o,i;switch(arguments.length){case 1:({start:s=TE,target:o,ratio:i}=t);break;case 2:s=this,o=t,i=r;break;default:s=t,o=r,i=n}return xn(this,s,o,i),this.check()}transformVector4(t,r=new Cr){return hh(r,t,this),_e(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Pt={};pt(Pt,{EPSILON1:()=>EE,EPSILON10:()=>LE,EPSILON11:()=>vE,EPSILON12:()=>RE,EPSILON13:()=>FE,EPSILON14:()=>PE,EPSILON15:()=>OE,EPSILON16:()=>NE,EPSILON17:()=>DE,EPSILON18:()=>GE,EPSILON19:()=>UE,EPSILON2:()=>_E,EPSILON20:()=>VE,EPSILON3:()=>ME,EPSILON4:()=>bE,EPSILON5:()=>BE,EPSILON6:()=>CE,EPSILON7:()=>SE,EPSILON8:()=>IE,EPSILON9:()=>wE,PI_OVER_FOUR:()=>zE,PI_OVER_SIX:()=>qE,PI_OVER_TWO:()=>HE,TWO_PI:()=>kE});var EE=.1,_E=.01,ME=.001,bE=1e-4,BE=1e-5,CE=1e-6,SE=1e-7,IE=1e-8,wE=1e-9,LE=1e-10,vE=1e-11,RE=1e-12,FE=1e-13,PE=1e-14,OE=1e-15,NE=1e-16,DE=1e-17,GE=1e-18,UE=1e-19,VE=1e-20,HE=Math.PI/2,zE=Math.PI/4,qE=Math.PI/6,kE=Math.PI*2;function Zs(e,t){t=t===void 0?e[0][0]:t;for(let r of e){let n=r[0]-t;n>180?r[0]-=360:n<-180&&(r[0]+=360)}}function JE(e,t,r){let[n,s]=(0,yn.cellToLatLng)(e),o=t.length;Zs(t,s);let i=t[0]===t[o-1]?o-1:o;for(let a=0;a<i;a++)t[a][0]=Te(s,t[a][0],r),t[a][1]=Te(n,t[a][1],r)}function Lh(e,t,r){let n=e(t,r),[s,o]=(0,yn.cellToLatLng)(n);return[o,s]}function Ia(e,t=1){let r=(0,yn.cellToBoundary)(e,!0);return t!==1?JE(e,r,t):Zs(r),r}function $s(e){let t=new Float64Array(e.length*2),r=0;for(let n of e)t[r++]=n[0],t[r++]=n[1];return t}var jE={getPentagon:{type:"accessor",value:e=>e.pentagon}},Tn=class extends Ft{indexToBounds(){let{data:t,getPentagon:r}=this.props;return{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(n,s)=>{let o=r(n,s),i=Lu(typeof o=="string"?vu(o):o,{closedRing:!0,segments:"auto"});return $s(i)}}}};Tn.layerName="A5Layer";Tn.defaultProps=jE;var vh=Tn;var tr=D(qt(),1),Kd=D(zt(),1);function XE(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function to(e){if(Array.isArray(e))return e.map(t=>to(t));if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[XE(r)]=to(n);return t}return e}var fd=D(ld(),1);function Da(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,o,i,a)=>Boolean(t?.arrayPaths?.some(l=>o===l)),...t?._fastXML},n=rM(e,r);return t?.uncapitalizeKeys?to(n):n}function rM(e,t){return new fd.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var nM="4.3.3",Jt={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:nM,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:sM,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>Da(new TextDecoder().decode(e),{...Jt.options.xml,...t?.xml}),parseTextSync:(e,t)=>Da(e,{...Jt.options.xml,...t?.xml})};function sM(e){return e.startsWith("<?xml")}async function vt(e,t,r,n){return n._parse(e,t,r,n)}function H(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var te={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},oM=te.self||te.window||te.global||{},iM=te.window||te.self||te.global||{},aM=te.global||te.self||te.window||{},cM=te.document||{};var Mn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var ud=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),lM=ud&&parseFloat(ud[1])||0;var ro=globalThis,fM=globalThis.document||{},no=globalThis.process||{},uM=globalThis.console,SR=globalThis.navigator||{};function hd(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function Xe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||hd()}var Ga="4.1.1";function Ir(e,t){if(!e)throw new Error(t||"Assertion failed")}function Ua(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 Ir(Number.isFinite(t)&&t>=0),t}function dd(e){let{logLevel:t,message:r}=e;e.logLevel=Ua(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return Ir(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}var We=()=>{},so=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,s,o={}){let i=dd({logLevel:r,message:n,args:this._buildArgs(r,n,s),opts:o});return this._createLogFunction(t,i,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return We;let s=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&s!==void 0){if(this._onceCache.has(s))return We;this._onceCache.add(s)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=Ua(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}};function dM(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var oo=class{constructor(t,r,n="sessionStorage"){this.storage=dM(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function pd(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function md(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var io;(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"})(io||(io={}));var pM=10;function gd(e){return typeof e!="string"?e:(e=e.toUpperCase(),io[e]||io.WHITE)}function Ad(e,t,r){return!Xe&&typeof e=="string"&&(t&&(e=`\x1B[${gd(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${gd(r)+pM}m${e}\x1B[49m`)),e}function xd(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),s=e;for(let o of n){let i=s[o];typeof i=="function"&&(t.find(a=>o===a)||(s[o]=i.bind(e)))}}function wr(){let e;if(Xe()&&ro.performance)e=ro?.performance?.now?.();else if("hrtime"in no){let t=no?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Lr={debug:Xe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Va={enabled:!0,level:0},le=class extends so{constructor({id:t}={id:""}){super({level:0}),this.VERSION=Ga,this._startTs=wr(),this._deltaTs=wr(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new oo(`__probe-${this.id}__`,{[this.id]:Va}),this.timeStamp(`${this.id} started`),xd(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((wr()-this._startTs).toPrecision(10))}getDelta(){return Number((wr()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:Lr.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:Lr.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){return this._log("log",t,r,n,{method:Lr.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:Lr.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:Lr.debug||Lr.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||We,tag:gM(r)}):We}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||We})}group(t,r,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:s})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||We})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;Ir(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=wr();let s=mM(this.id,r.message,r);return n.bind(console,s,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(Va),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...Va};this._storage.setConfiguration({[this.id]:{...r,...t}})}};le.VERSION=Ga;function mM(e,t,r){if(typeof t=="string"){let n=r.time?md(pd(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Ad(t,r.color,r.background)}return t}function gM(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var Ha=new le({id:"@probe.gl/log"});var za="4.3.3",AM=za[0]>="0"&&za[0]<="9"?`v${za}`:"";function xM(){let e=new le({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=AM,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var qa=xM();function ka(e,t){return yd(e||{},t)}function yd(e,t,r=0){if(r>3)return t;let n={...e};for(let[s,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)?n[s]=yd(n[s]||{},t[s],r+1):n[s]=t[s];return n}function Ja(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function ja(e){return globalThis.loaders?.modules?.[e]||null}function yM(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.3"),globalThis._loadersgl_.version}var Td=yM();function Ed(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var ee={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},hF=ee.self||ee.window||ee.global||{},dF=ee.window||ee.self||ee.global||{},pF=ee.global||ee.self||ee.window||{},mF=ee.document||{};var vr=typeof process!="object"||String(process)!=="[object process]"||process.browser,ao=typeof importScripts=="function",gF=typeof window<"u"&&typeof window.orientation<"u",_d=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),AF=_d&&parseFloat(_d[1])||0;var Xa={};async function re(e,t=null,r={},n=null){return t&&(e=Md(e,t,r,n)),Xa[e]=Xa[e]||TM(e),await Xa[e]}function Md(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let s=r.modules||{};return s[n]?s[n]:vr?r.CDN?(Ed(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Td}/dist/libs/${n}`):ao?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function TM(e){if(e.endsWith("wasm"))return await _M(e);if(!vr)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(ao)return importScripts(e);let t=await MM(e);return EM(t,e)}function EM(e,t){if(!vr){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(ao)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function _M(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return vr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function MM(e){let{readFileAsText:t}=globalThis.loaders||{};return vr||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function Bd(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?bd(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?bd(e,0,t):""}function bd(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),s="";for(let o=0;o<r;o++)s+=String.fromCharCode(n.getUint8(t+o));return s}function Wa(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Bd(e)}"`)}}function bn(...e){let 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');let n=t.reduce((i,a)=>i+a.length,0),s=new r(n),o=0;for(let i of t)s.set(i,o),o+=i.length;return s}function Ye(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function Be(e,t){return H(e>=0),H(t>0),e+(t-1)&~(t-1)}function Ya(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let s=e.byteOffset,o=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,s,o)}return t.set(n,r),r+Be(n.byteLength,4)}function Bn(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Ke=class{constructor(t,r){this.sampleSize=1,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.name=t,this.type=r,this.reset()}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}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Bn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Bn()-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}_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)}};var Ce=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,s=this.stats[r];return s||(t instanceof Ke?s=t:s=new Ke(r,n),this.stats[r]=s),s}};var bM="Queued Requests",BM="Active Requests",CM="Cancelled Requests",SM="Queued Requests Ever",IM="Active Requests Ever",wM={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},Se=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...wM,...t},this.stats=new Ce({id:this.props.id}),this.stats.get(bM),this.stats.get(BM),this.stats.get(CM),this.stats.get(SM),this.stats.get(IM)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:n}=t,s=!1,o=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Ie={};pt(Ie,{dirname:()=>vM,filename:()=>LM,join:()=>RM,resolve:()=>FM});function Cd(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function LM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function vM(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function RM(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function FM(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,s;for(let o=t.length-1;o>=-1&&!n;o--){let i;o>=0?i=t[o]:(s===void 0&&(s=Cd()),i=s),i.length!==0&&(r=`${i}/${r}`,n=i.charCodeAt(0)===Cn)}return r=PM(r,!n),n?`/${r}`:r.length>0?r:"."}var Cn=47,Ka=46;function PM(e,t){let r="",n=-1,s=0,o,i=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===Cn)break;o=Cn}if(o===Cn){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!i||r.charCodeAt(r.length-1)!==Ka||r.charCodeAt(r.length-2)!==Ka){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Cn;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,i=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,i=!1;continue}}t&&(r.length>0?r+="/..":r="..",i=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,i=!1}n=a,s=0}else o===Ka&&s!==-1?++s:s=-1}return r}var co=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=OM(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function OM(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,s)=>t(n,s);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Ot=class extends co{};on(Ot,"type","template"),on(Ot,"testURL",t=>!1);function Sd(e,t){let r=Jt.parseTextSync?.(e,t),n=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof n=="string"?n:n.value||n.code||"Unknown error"}var NM="4.3.3",Sn={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:NM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:DM,options:{wms:{throwOnError:!1}},parse:async(e,t)=>Qa(new TextDecoder().decode(e),t),parseSync:(e,t)=>Qa(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Qa(e,t)};function DM(e){return e.startsWith("<?xml")}function Qa(e,t){let r={...Sn.options.wms,...t?.wms},n=Sd(e,r),s=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(s);return s}function Qe(e){return Array.isArray(e)?e:e?[e]:[]}function In(e){let t=Qe(e);return t.length>0&&t.every(r=>typeof r=="string")?t:[]}function wn(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function lo(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Ze(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Za(e,t){let r=Jt.parseTextSync?.(e,t),n=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,s=GM(n);if(t?.inheritedLayerProps)for(let o of s.layers)wd(o,null);return t?.includeRawJSON&&(s.json=n),t?.includeXMLText&&(s.xml=e),s}function GM(e){let t={version:String(e.version||""),name:String(e.Service?.Name||"unnamed"),title:e.Service?.Title?String(e.Service?.Title):void 0,abstract:e.Service?.Abstract?String(e.Service?.Abstract):void 0,keywords:In(e.Service?.KeywordList?.Keyword),fees:e.Service?.Fees?JSON.stringify(e.Service?.Fees):void 0,accessConstraints:e.Service?.AccessConstraints?JSON.stringify(e.Service?.AccessConstraints):void 0,layerLimit:lo(e.Service?.LayerLimit),maxWidth:lo(e.Service?.maxWidth),maxHeight:lo(e.Service?.maxHeight),layers:[],requests:UM(e.Capability?.Request),exceptions:VM(e.Exception)},r=Qe(e.Capability?.Layer);for(let n of r)t.layers.push(Id(n));for(let[n,s]of Object.entries(t))s===void 0&&delete t[n];return t}function UM(e){let t={};for(let[r,n]of Object.entries(e||{})){let s=In(n?.Format);t[r]={mimeTypes:s}}return t}function VM(e){if(Qe(e?.Format).length>0)return{mimeTypes:In(e)}}function Id(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:In(e.KeywordList?.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(l=>typeof l=="string")&&(t.crs=r);let n=e?.EX_GeographicBoundingBox&&HM(e?.EX_GeographicBoundingBox);n&&(t.geographicBoundingBox=n),n=e?.LatLonBoundingBox&&zM(e?.LatLonBoundingBox),n&&(t.geographicBoundingBox=n);let s=e?.BoundingBox&&qM(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let i=Qe(e?.Dimension).map(l=>JM(l));i.length&&(t.dimensions=i),e?.opaque&&(t.opaque=Ze(e?.opaque)),e?.cascaded&&(t.cascaded=Ze(e?.cascaded)),e?.queryable&&(t.queryable=Ze(e?.queryable));let a=Qe(e?.Layer),c=[];for(let l of a)c.push(Id(l));c.length>0&&(t.layers=c);for(let[l,f]of Object.entries(t))f===void 0&&delete t[l];return t}function HM(e){let{westBoundLongitude:t,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:s}=e;return[[t,s],[n,r]]}function zM(e){let{minx:t,miny:r,maxx:n,maxy:s}=e;return[[t,r],[n,s]]}function qM(e){return Qe(e).map(r=>kM(r))}function kM(e){let{CRS:t,SRS:r,minx:n,miny:s,maxx:o,maxy:i,resx:a,resy:c}=e,l={crs:t||r,boundingBox:[[wn(n),wn(s)],[wn(o),wn(i)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function JM(e){let{name:t,units:r,value:n}=e,s={name:t,units:r,extent:n};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=Ze(e.multipleValues)),e.nearestValue&&(s.nearestValue=Ze(e.nearestValue)),e.current&&(s.current=Ze(e.current)),s}function wd(e,t){t?.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t?.crs&&!e.crs&&(e.crs=[...t.crs]),t?.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t?.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let r of e.layers||[])wd(r,e)}var jM="4.3.3",Rr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:jM,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:XM,options:{wms:{}},parse:async(e,t)=>Za(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Za(e,t?.wms)};function XM(e){return e.startsWith("<?xml")}function $a(e,t){let n=(Jt.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(n)?n:[n]).map(o=>WM(o))}}function WM(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Ld={...Rr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>$a(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>$a(e,t)};function tc(e,t){return Jt.parseTextSync?.(e,t)}var vd={...Rr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>tc(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>tc(e,t)};var Rd="4.3.3";var YM=globalThis.loaders?.parseImageNode,ec=typeof Image<"u",rc=typeof ImageBitmap<"u",KM=Boolean(YM),nc=Mn?!0:KM;function Fd(e){switch(e){case"auto":return rc||ec||nc;case"imagebitmap":return rc;case"image":return ec;case"data":return nc;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Pd(){if(rc)return"imagebitmap";if(ec)return"image";if(nc)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Od(e){let t=QM(e);if(!t)throw new Error("Not an image");return t}function Ln(e){switch(Od(e)){case"data":return e;case"image":case"imagebitmap":let 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 QM(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var ZM=/^data:image\/svg\+xml/,$M=/\.svg((\?|#).*)?$/;function fo(e){return e&&(ZM.test(e)||$M.test(e))}function Nd(e,t){if(fo(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return sc(e,t)}function sc(e,t){if(fo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function uo(e,t,r){let n=Nd(e,r),s=self.URL||self.webkitURL,o=typeof n!="string"&&s.createObjectURL(n);try{return await tb(o||n,t)}finally{o&&s.revokeObjectURL(o)}}async function tb(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=o=>{let i=o instanceof Error?o.message:"error";s(new Error(i))}}catch(o){s(o)}})}var eb={},Dd=!0;async function Gd(e,t,r){let n;fo(r)?n=await uo(e,t,r):n=sc(e,r);let s=t&&t.imagebitmap;return await rb(n,s)}async function rb(e,t=null){if((nb(t)||!Dd)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Dd=!1}return await createImageBitmap(e)}function nb(e){for(let t in e||eb)return!1;return!0}function Ud(e){return!ab(e,"ftyp",4)||!(e[8]&96)?null:sb(e)}function sb(e){switch(ob(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ob(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ib(e){return[...e].map(t=>t.charCodeAt(0))}function ab(e,t,r=0){let n=ib(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var ne=!1,vn=!0;function $e(e){let t=Rn(e);return lb(t)||hb(t)||fb(t)||ub(t)||cb(t)}function cb(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Ud(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function lb(e){let t=Rn(e);return t.byteLength>=24&&t.getUint32(0,ne)===2303741511?{mimeType:"image/png",width:t.getUint32(16,ne),height:t.getUint32(20,ne)}:null}function fb(e){let t=Rn(e);return t.byteLength>=10&&t.getUint32(0,ne)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,vn),height:t.getUint16(8,vn)}:null}function ub(e){let t=Rn(e);return t.byteLength>=14&&t.getUint16(0,ne)===16973&&t.getUint32(2,vn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,vn),height:t.getUint32(22,vn)}:null}function hb(e){let t=Rn(e);if(!(t.byteLength>=3&&t.getUint16(0,ne)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=db(),o=2;for(;o+9<t.byteLength;){let i=t.getUint16(o,ne);if(s.has(i))return{mimeType:"image/jpeg",height:t.getUint16(o+5,ne),width:t.getUint16(o+7,ne)};if(!n.has(i))return null;o+=2,o+=t.getUint16(o,ne)}return null}function db(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Rn(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")}async function Vd(e,t){let{mimeType:r}=$e(e)||{},n=globalThis.loaders?.parseImageNode;return H(n),await n(e,r)}async function Hd(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:o}=r||{},i=pb(s),a;switch(i){case"imagebitmap":a=await Gd(e,t,o);break;case"image":a=await uo(e,t,o);break;case"data":a=await Vd(e,t);break;default:H(!1)}return s==="data"&&(a=Ln(a)),a}function pb(e){switch(e){case"auto":case"data":return Pd();default:return Fd(e),e}}var mb=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],gb=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Ab={image:{type:"auto",decode:!0}},Fr={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Rd,mimeTypes:gb,extensions:mb,parse:Hd,tests:[e=>Boolean($e(new DataView(e)))],options:Ab};var oc={};function ic(e){if(oc[e]===void 0){let t=Mn?yb(e):xb(e);oc[e]=t}return oc[e]}function xb(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function yb(e){switch(e){case"image/avif":case"image/webp":return Tb(e);default:return!0}}function Tb(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var zd={name:"Web Map Service (OGC WMS)",id:"wms",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],options:{wms:{}},type:"wms",fromUrl:!0,fromBlob:!1,testURL:e=>e.toLowerCase().includes("wms"),createDataSource:(e,t)=>new ac(e,t)},ac=class extends Ot{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t,r){super(r),this.url=t,this.data=t,this.substituteCRS84=r.wms?.substituteCRS84??r.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...r.wmsParameters,...r.wms?.wmsParameters},this.vendorParameters=r.wms?.vendorParameters||r.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:r,bbox:n,...s}=t,o={bbox:r?[...r[0],...r[1]]:n,...s};return await this.getMap(o)}normalizeMetadata(t){return t}async getCapabilities(t,r){let n=this.getCapabilitiesURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);let i=await Rr.parse(o,this.loadOptions);return this.capabilities=i,i}async getMap(t,r){let n=this.getMapURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await Fr.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(t,r){let n=this.getFeatureInfoURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await Ld.parse(o,this.loadOptions)}async getFeatureInfoText(t,r){let n=this.getFeatureInfoURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),new TextDecoder().decode(o)}async describeLayer(t,r){let n=this.describeLayerURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();return this._checkResponse(s,o),await vd.parse(o,this.loadOptions)}async getLegendGraphic(t,r){let n=this.getLegendGraphicURL(t,r),s=await this.fetch(n),o=await s.arrayBuffer();this._checkResponse(s,o);try{return await Fr.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(t,r){t=this._getWMS130Parameters(t);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(t,r){t=this._getWMS130Parameters(t);let{boundingBox:n,bbox:s}=t;t.bbox=n?[...n[0],...n[1]]:s;let o={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",o,r)}describeLayerURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(t,r){let n={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(t){let[r,n]=t.split("?"),s=n.split("&"),o={};for(let i of s){let[a,c]=i.split("=");o[a]=c}return{url:r,parameters:o}}_getWMSUrl(t,r,n){let s=this.url,o=!0,i={service:"WMS",version:r.version,request:t,...r,...this.vendorParameters,...n},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(i))(!a.includes(c)||l)&&(s+=o?"?":"&",o=!1,s+=this._getURLParameter(c,l,r));return encodeURI(s)}_getWMS130Parameters(t){let r={...t};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(t,r,n){switch(t){case"crs":n.version!=="1.3.0"?t="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(r,n);s&&(r=s);break;case"x":n.version==="1.3.0"&&(t="i");break;case"y":n.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(r)?`${t}=${r.join(",")}`:`${t}=${r?String(r):""}`}_flipBoundingBox(t,r){if(!Array.isArray(t)||t.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),s=t;return n?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let r=await this.fetch(t),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(t,r){let n=t.headers["content-type"];if(!t.ok||Sn.mimeTypes.includes(n)){let s=ka(this.loadOptions,{wms:{throwOnError:!0}}),o=Sn.parseSync?.(r,s);throw new Error(o)}}_parseError(t){let r=Sn.parseSync?.(t,this.loadOptions);return new Error(r)}};var qd={name:"ArcGISImageServer",id:"arcgis-image-server",module:"wms",version:"0.0.0",extensions:[],mimeTypes:[],options:{"arcgis-image-server":{}},type:"arcgis-image-server",fromUrl:!0,fromBlob:!1,testURL:e=>e.toLowerCase().includes("ImageServer"),createDataSource:(e,t)=>new cc(e,t)},cc=class extends Ot{url;data;constructor(t,r){super(r),this.url=t,this.data=t}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.url}?f=pjson`}exportImageURL(t){let r=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,n=`size=${t.width},${t.height}`,s={...t,bbox:r,size:n};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,r,n){let s=`${this.url}/${t}`,o=!0;for(let[i,a]of Object.entries(r))s+=o?"?":"&",o=!1,Array.isArray(a)?s+=`${i.toUpperCase()}=${a.join(",")}`:s+=`${i.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}};var Eb=[zd,qd];function lc(e,t=Eb){let{type:r="auto"}=e,n=r==="auto"?Mb(e.url,t):_b(r,t);if(!n)throw new Error("Not a valid image source type");return n.createDataSource(e.url,e)}function _b(e,t){for(let r of t)if(r.type===e)return r;return null}function Mb(e,t){for(let r of t)if(r.testURL&&r.testURL(e))return r;return null}function ho(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var jt=Math.PI,Xd=jt/4,kd=jt/180,Jd=180/jt,po=512;function fe(e){let[t,r]=e;ho(Number.isFinite(t)),ho(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*kd,s=r*kd,o=po*(n+jt)/(2*jt),i=po*(jt+Math.log(Math.tan(Xd+s*.5)))/(2*jt);return[o,i]}function ue(e){let[t,r]=e,n=t/po*(2*jt)-jt,s=2*(Math.atan(Math.exp(r/po*(2*jt)-jt))-Xd);return[n*Jd,s*Jd]}var jO=Math.PI/180;var Yd=6378137*Math.PI;function fc(e){let t=fe(e);return t[0]=(t[0]/256-1)*Yd,t[1]=(t[1]/256-1)*Yd,t}var Ub={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(e,t)=>console.error(t,e)}},Pr=class extends tr.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:t,props:r,oldProps:n}){let{viewport:s}=this.context;t.dataChanged||r.serviceType!==n.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,tr._deepEqual)(r.layers,n.layers,1)?t.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:t,image:r,lastRequestParameters:n}=this.state;return r&&new Kd.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:n.srs==="EPSG:4326"?tr.COORDINATE_SYSTEM.LNGLAT:tr.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:r})}async getFeatureInfoText(t,r){let{lastRequestParameters:n}=this.state;return n?await this.state.imageSource.getFeatureInfoText?.({...n,query_layers:n.layers,x:t,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof Ot)return t.data;if(typeof t.data=="string")return lc({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let r=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(t,r){let{layers:n,serviceType:s}=this.props;if(s==="wms"&&n.length===0)return;let o=t.getBounds(),{width:i,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let f={width:i,height:a,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:n,crs:l};if(l==="EPSG:3857"){let u=fc([o[0],o[1]]),h=fc([o[2],o[3]]);f.boundingBox=[u,h]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let u=await this.state.imageSource.getImage(f);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:u,bounds:o,lastRequestParameters:f,lastRequestId:c}))}catch(u){this.raiseError(u,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,u)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),r)}};Pr.layerName="WMSLayer";Pr.defaultProps=Ub;var Qd=D(zt(),1),Vb={getHeight:{type:"accessor",value:0},greatCircle:!0},Fn=class extends Qd.ArcLayer{};Fn.layerName="GreatCircleLayer";Fn.defaultProps=Vb;var Zd=Fn;var mo=D(uc(),1),Hb=3,zb=30,qb=2*zb+1,tp=180/Math.PI;function rp(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function ep(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function np(e){return[ep(e[0]),ep(e[1])]}function sp(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function op([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*tp,n*tp]}function ip(e){let t=mo.default.fromString(e,!0,10).toString(2);for(;t.length<Hb+qb;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=mo.default.fromString(n,!0,2).toString(10),a=mo.default.fromString(s,!0,2).toString(4);for(;a.length<o;)a="0"+a;return`${i}/${a}`}function kb(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function ap(e){let t=e.split("/"),r=parseInt(t[0],10),n=t[1],s=n.length,o=[0,0],i;for(let a=s-1;a>=0;a--){i=s-a;let c=n[a],l=0,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,i-1);kb(u,o,l,f),o[0]+=u*l,o[1]+=u*f}if(r%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:r,ij:o,level:i}}var cp=D(uc(),1);function Jb(e){let t=e.padEnd(16,"0");return cp.default.fromString(t,16)}var jb=100;function Xb({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(jb*Math.pow(2,-r))),o=new Float64Array(4*s*2+2),i=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),f=n[c+1],u=(f[0]-l[0])/s,h=(f[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=u,l[1]+=h;let p=rp(t,r,l),A=np(p),m=sp(e,A),y=op(m);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-180?360:0,o[i++]=y[0],o[i++]=y[1],a=y[0]}}return o[i++]=o[0],o[i++]=o[1],o}function Wb(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Jb(e)}return ip(e.toString())}function lp(e){let t=Wb(e),r=ap(t);return Xb(r)}var Yb={getS2Token:{type:"accessor",value:e=>e.token}},On=class extends Ft{indexToBounds(){let{data:t,getS2Token:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>lp(r(n,s))}}};On.layerName="S2Layer";On.defaultProps=Yb;var fp=On;var hc=512;function Kb(e,t){let r=0,n=0,s=1<<e.length,o=s/hc;for(let i=0;i<e.length;i++){s>>=1;let a=parseInt(e[i]);a%2&&(r|=s),a>1&&(n|=s)}return[[r/o,hc-n/o],[(r+t)/o,hc-(n+t)/o]]}function up(e,t=1){let[r,n]=Kb(e,t),[s,o]=ue(r),[i,a]=ue(n);return[i,o,i,a,s,a,s,o,i,o]}var Qb={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Nn=class extends Ft{indexToBounds(){let{data:t,extruded:r,getQuadkey:n}=this.props,s=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,i)=>up(n(o,i),s),updateTriggers:{getPolygon:s}}}};Nn.layerName="QuadkeyLayer";Nn.defaultProps=Qb;var hp=Nn;var Mo=D(qt(),1),wp=D(zt(),1);var er=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:r,onLoad:n,onError:s}){let{index:o,id:i,bbox:a,userData:c,zoom:l}=this,f=this._loaderId;this._abortController=new AbortController;let{signal:u}=this._abortController,h=await r.scheduleRequest(this,A=>A.isSelected?1:-1);if(!h){this._isCancelled=!0;return}if(this._isCancelled){h.done();return}let d=null,p;try{d=await t({index:o,id:i,bbox:a,userData:c,zoom:l,signal:u})}catch(A){p=A||!0}finally{h.done()}if(f===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):n(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var Un=D(qt(),1);var it={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var dp=new x,Zb=new x,we=class{constructor(t=[0,0,0],r=[0,0,0],n){n=n||dp.copy(t).add(r).scale(.5),this.center=new x(n),this.halfDiagonal=new x(r).subtract(this.center),this.minimum=new x(t),this.maximum=new x(r)}clone(){return new we(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:r}=this,n=Zb.from(t.normal),s=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),o=this.center.dot(n)+t.distance;return o-s>0?it.INSIDE:o+s<0?it.OUTSIDE:it.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=dp.from(t).subtract(this.center),{halfDiagonal:n}=this,s=0,o;return o=Math.abs(r.x)-n.x,o>0&&(s+=o*o),o=Math.abs(r.y)-n.y,o>0&&(s+=o*o),o=Math.abs(r.z)-n.z,o>0&&(s+=o*o),s}};var Dn=new x,pp=new x,Nt=class{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new x,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=Dn.from(r),this.center=new x().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Nt(this.center,this.radius)}union(t){let r=this.center,n=this.radius,s=t.center,o=t.radius,i=Dn.copy(s).subtract(r),a=i.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return pp.copy(i).scale((-n+c)/a).add(r),this.center.copy(pp),this.radius=c,this}expand(t){let n=Dn.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=An.getScaling(Dn,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=Dn.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?it.OUTSIDE:o<n?it.INTERSECTING:it.INSIDE}};var $b=new x,tB=new x,go=new x,Ao=new x,xo=new x,eB=new x,rB=new x,he={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Xt=class{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new x().from(t),this.halfAxes=new J(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new x(t).len(),new x(r).len(),new x(n).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),s=new x(t).normalize(),o=new x(r).normalize(),i=new x(n).normalize();return new $t().fromMatrix3(new J([...s,...o,...i]))}fromCenterHalfSizeQuaternion(t,r,n){let s=new $t(n),o=new J().fromQuaternion(s);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new x().from(t),this.halfAxes=o,this}clone(){return new Xt(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Nt){let r=this.halfAxes,n=r.getColumn(0,go),s=r.getColumn(1,Ao),o=r.getColumn(2,xo),i=$b.copy(n).add(s).add(o);return t.center.copy(this.center),t.radius=i.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,s=this.halfAxes,o=n.x,i=n.y,a=n.z,c=Math.abs(o*s[he.COLUMN0ROW0]+i*s[he.COLUMN0ROW1]+a*s[he.COLUMN0ROW2])+Math.abs(o*s[he.COLUMN1ROW0]+i*s[he.COLUMN1ROW1]+a*s[he.COLUMN1ROW2])+Math.abs(o*s[he.COLUMN2ROW0]+i*s[he.COLUMN2ROW1]+a*s[he.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?it.OUTSIDE:l>=c?it.INSIDE:it.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=tB.from(t).subtract(this.center),n=this.halfAxes,s=n.getColumn(0,go),o=n.getColumn(1,Ao),i=n.getColumn(2,xo),a=s.magnitude(),c=o.magnitude(),l=i.magnitude();s.normalize(),o.normalize(),i.normalize();let f=0,u;return u=Math.abs(r.dot(s))-a,u>0&&(f+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(f+=u*u),u=Math.abs(r.dot(i))-l,u>0&&(f+=u*u),f}computePlaneDistances(t,r,n=[-0,-0]){let s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=this.center,a=this.halfAxes,c=a.getColumn(0,go),l=a.getColumn(1,Ao),f=a.getColumn(2,xo),u=eB.copy(c).add(l).add(f).add(i),h=rB.copy(u).subtract(t),d=r.dot(h);return s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).add(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),u.copy(i).add(c).subtract(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).add(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).add(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),i.copy(u).subtract(c).subtract(l).subtract(f),h.copy(u).subtract(t),d=r.dot(h),s=Math.min(d,s),o=Math.max(d,o),n[0]=s,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,go);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,Ao);n.transformAsPoint(t);let s=this.halfAxes.getColumn(2,xo);return s.transformAsPoint(t),this.halfAxes=new J([...r,...n,...s]),this}getTransform(){throw new Error("not implemented")}};var mp=new x,gp=new x,ut=class{constructor(t=[0,0,1],r=0){this.normal=new x,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return ft(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=mp.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,s){return this.normal.set(t,r,n),ft(Et(this.normal.len(),1)),this.distance=s,this}clone(){return new ut(this.normal,this.distance)}equals(t){return Et(this.distance,t.distance)&&Et(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=gp.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=mp.from(t),s=this.getPointDistance(n),o=gp.copy(this.normal).scale(s);return n.subtract(o).to(r)}};var Ap=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],xp=new x,nB=new x,ct=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Ap.length;let r=t.center,n=t.radius,s=0;for(let o of Ap){let i=this.planes[s],a=this.planes[s+1];i||(i=this.planes[s]=new ut),a||(a=this.planes[s+1]=new ut);let c=xp.copy(o).scale(-n).add(r);i.fromPointNormal(c,o);let l=xp.copy(o).scale(n).add(r),f=nB.copy(o).negate();a.fromPointNormal(l,f),s+=2}return this}computeVisibility(t){let r=it.INSIDE;for(let n of this.planes)switch(t.intersectPlane(n)){case it.OUTSIDE:return it.OUTSIDE;case it.INTERSECTING:r=it.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(ft(Number.isFinite(r),"parentPlaneMask is required."),r===ct.MASK_OUTSIDE||r===ct.MASK_INSIDE)return r;let n=ct.MASK_INSIDE,s=this.planes;for(let o=0;o<this.planes.length;++o){let i=o<31?1<<o:0;if(o<31&&!(r&i))continue;let a=s[o],c=t.intersectPlane(a);if(c===it.OUTSIDE)return ct.MASK_OUTSIDE;c===it.INTERSECTING&&(n|=i)}return n}};ct.MASK_OUTSIDE=4294967295;ct.MASK_INSIDE=0;ct.MASK_INDETERMINATE=2147483647;var cD=new x,lD=new x,fD=new x,uD=new x,hD=new x;var xD=new x,yD=new x,TD=new x,ED=new x,_D=new x,MD=new x,bD=new x,BD=new x,CD=new x,SD=new x,ID=new x,wD=new x;var se=new J,oB=new J,iB=new J,yo=new J,yp=new J;function mc(e,t={}){let r=Pt.EPSILON20,n=10,s=0,o=0,i=oB,a=iB;i.identity(),a.copy(e);let c=r*aB(a);for(;o<n&&cB(a)>c;)lB(a,yo),yp.copy(yo).transpose(),a.multiplyRight(yo),a.multiplyLeft(yp),i.multiplyRight(yo),++s>2&&(++o,s=0);return t.unitary=i.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function aB(e){let t=0;for(let r=0;r<9;++r){let n=e[r];t+=n*n}return Math.sqrt(t)}var dc=[1,0,0],pc=[2,2,1];function cB(e){let t=0;for(let r=0;r<3;++r){let n=e[se.getElementIndex(pc[r],dc[r])];t+=2*n*n}return Math.sqrt(t)}function lB(e,t){let r=Pt.EPSILON15,n=0,s=1;for(let l=0;l<3;++l){let f=Math.abs(e[se.getElementIndex(pc[l],dc[l])]);f>n&&(s=l,n=f)}let o=dc[s],i=pc[s],a=1,c=0;if(Math.abs(e[se.getElementIndex(i,o)])>r){let l=e[se.getElementIndex(i,i)],f=e[se.getElementIndex(o,o)],u=e[se.getElementIndex(i,o)],h=(l-f)/2/u,d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),c=d*a}return J.IDENTITY.to(t),t[se.getElementIndex(o,o)]=t[se.getElementIndex(i,i)]=a,t[se.getElementIndex(i,o)]=c,t[se.getElementIndex(o,i)]=-c,t}var Le=new x,fB=new x,uB=new x,hB=new x,dB=new x,pB=new J,mB={diagonal:new J,unitary:new J};function Gn(e,t=new Xt){if(!e||e.length===0)return t.halfAxes=new J([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let r=e.length,n=new x(0,0,0);for(let T of e)n.add(T);let s=1/r;n.multiplyByScalar(s);let o=0,i=0,a=0,c=0,l=0,f=0;for(let T of e){let g=Le.copy(T).subtract(n);o+=g.x*g.x,i+=g.x*g.y,a+=g.x*g.z,c+=g.y*g.y,l+=g.y*g.z,f+=g.z*g.z}o*=s,i*=s,a*=s,c*=s,l*=s,f*=s;let u=pB;u[0]=o,u[1]=i,u[2]=a,u[3]=i,u[4]=c,u[5]=l,u[6]=a,u[7]=l,u[8]=f;let{unitary:h}=mc(u,mB),d=t.halfAxes.copy(h),p=d.getColumn(0,uB),A=d.getColumn(1,hB),m=d.getColumn(2,dB),y=-Number.MAX_VALUE,_=-Number.MAX_VALUE,E=-Number.MAX_VALUE,M=Number.MAX_VALUE,B=Number.MAX_VALUE,C=Number.MAX_VALUE;for(let T of e)Le.copy(T),y=Math.max(Le.dot(p),y),_=Math.max(Le.dot(A),_),E=Math.max(Le.dot(m),E),M=Math.min(Le.dot(p),M),B=Math.min(Le.dot(A),B),C=Math.min(Le.dot(m),C);p=p.multiplyByScalar(.5*(M+y)),A=A.multiplyByScalar(.5*(B+_)),m=m.multiplyByScalar(.5*(C+E)),t.center.copy(p).add(A).add(m);let L=fB.set(y-M,_-B,E-C).multiplyByScalar(.5),b=new J([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(b),t}var Or=512,Tp=3,Ep=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],_p=Ep.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),gB=_p.concat([[.25,.5],[.75,.5]]),ve=class{constructor(t,r,n){this.x=t,this.y=r,this.z=n}get children(){if(!this._children){let t=this.x*2,r=this.y*2,n=this.z+1;this._children=[new ve(t,r,n),new ve(t,r+1,n),new ve(t+1,r,n),new ve(t+1,r+1,n)]}return this._children}update(t){let{viewport:r,cullingVolume:n,elevationBounds:s,minZ:o,maxZ:i,bounds:a,offset:c,project:l}=t,f=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||n.computeVisibility(f)<0)return!1;if(!this.childVisible){let{z:h}=this;if(h<i&&h>=o){let d=f.distanceTo(r.cameraPosition)*r.scale/r.height;h+=Math.floor(Math.log2(d))}if(h>=i)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let h of this.children)h.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let r of this._children)r.getSelected(t);return t}insideBounds([t,r,n,s]){let o=Math.pow(2,this.z),i=Or/o;return this.x*i<n&&this.y*i<s&&(this.x+1)*i>t&&(this.y+1)*i>r}getBoundingVolume(t,r,n){if(n){let c=this.z<1?gB:this.z<2?_p:Ep,l=[];for(let f of c){let u=To(this.x+f[0],this.y+f[1],this.z);u[2]=t[0],l.push(n(u)),t[0]!==t[1]&&(u[2]=t[1],l.push(n(u)))}return Gn(l)}let s=Math.pow(2,this.z),o=Or/s,i=this.x*o+r*Or,a=Or-(this.y+1)*o;return new we([i,a,t[0]],[i+o,a+o,t[1]])}};function Mp(e,t,r,n){let s=e instanceof Un._GlobeViewport&&e.resolution?e.projectPosition:null,o=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new ut(d.clone().negate(),p)),i=new ct(o),a=e.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,l=r&&r[1]*a||0,f=e instanceof Un.WebMercatorViewport&&e.pitch<=60?t:0;if(n){let[d,p,A,m]=n,y=fe([d,m]),_=fe([A,p]);n=[y[0],Or-y[1],_[0],Or-_[1]]}let u=new ve(0,0,0),h={viewport:e,project:s,cullingVolume:i,elevationBounds:[c,l],minZ:f,maxZ:t,bounds:n,offset:0};if(u.update(h),e instanceof Un.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(h.offset=-1;u.update(h)&&!(--h.offset<-Tp););for(h.offset=1;u.update(h)&&!(++h.offset>Tp););}return u.getSelected()}var de=512,AB=[-1/0,-1/0,1/0,1/0],Re={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(r=>typeof r=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}};function Eo(e,t){let r=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...r.map(s=>s[0])),Math.min(...r.map(s=>s[1])),Math.max(...r.map(s=>s[0])),Math.max(...r.map(s=>s[1]))]}function xB(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function oe(e,t){if(!e||!e.length)return null;let{index:r,id:n}=t;if(Array.isArray(e)){let o=xB(n)%e.length;e=e[o]}let s=e;for(let o of Object.keys(r)){let i=new RegExp(`{${o}}`,"g");s=s.replace(i,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),s}function yB(e,t,r){let n;if(t&&t.length===2){let[s,o]=t,i=e.getBounds({z:s}),a=e.getBounds({z:o});n=[Math.min(i[0],a[0]),Math.min(i[1],a[1]),Math.max(i[2],a[2]),Math.max(i[3],a[3])]}else n=e.getBounds();return e.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function Bp({viewport:e,z:t,cullRect:r}){return(e.subViewports||[e]).map(s=>gc(s,t||0,r))}function gc(e,t,r){if(!Array.isArray(t)){let o=r.x-e.x,i=r.y-e.y,{width:a,height:c}=r,l={targetZ:t},f=e.unproject([o,i],l),u=e.unproject([o+a,i],l),h=e.unproject([o,i+c],l),d=e.unproject([o+a,i+c],l);return[Math.min(f[0],u[0],h[0],d[0]),Math.min(f[1],u[1],h[1],d[1]),Math.max(f[0],u[0],h[0],d[0]),Math.max(f[1],u[1],h[1],d[1])]}let n=gc(e,t[0],r),s=gc(e,t[1],r);return[Math.min(n[0],s[0]),Math.min(n[1],s[1]),Math.max(n[2],s[2]),Math.max(n[3],s[3])]}function TB(e,t,r){return r?Eo(e,r).map(s=>s*t/de):e.map(n=>n*t/de)}function Ac(e,t){return Math.pow(2,e)*de/t}function To(e,t,r){let n=Ac(r,de),s=e/n*360-180,o=Math.PI-2*Math.PI*t/n,i=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[s,i]}function bp(e,t,r,n){let s=Ac(r,n);return[e/s*de,t/s*de]}function xc(e,t,r,n,s=de){if(e.isGeospatial){let[l,f]=To(t,r,n),[u,h]=To(t+1,r+1,n);return{west:l,north:f,east:u,south:h}}let[o,i]=bp(t,r,n,s),[a,c]=bp(t+1,r+1,n,s);return{left:o,top:i,right:a,bottom:c}}function EB(e,t,r,n,s){let o=yB(e,null,n),i=Ac(t,r),[a,c,l,f]=TB(o,i,s),u=[];for(let h=Math.floor(a);h<l;h++)for(let d=Math.floor(c);d<f;d++)u.push({x:h,y:d,z:t});return u}function yc({viewport:e,maxZoom:t,minZoom:r,zRange:n,extent:s,tileSize:o=de,modelMatrix:i,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(de/o))+c:Math.ceil(e.zoom)+c;if(typeof r=="number"&&Number.isFinite(r)&&l<r){if(!s)return[];l=r}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let f=s;return i&&a&&s&&!e.isGeospatial&&(f=Eo(s,i)),e.isGeospatial?Mp(e,l,n,s):EB(e,l,o,f||AB,a)}function Tc(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Ec(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function Cp(e){let t={},r;return n=>{for(let s in n)if(!_B(n[s],t[s])){r=e(n),t=n;break}return r}}function _B(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}return!1}var Sp=1,_o=2,MB="never",bB="no-overlap",Vn="best-available",BB=5,CB={[Vn]:IB,[bB]:wB,[MB]:()=>{}},SB={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},rr=class{constructor(t){this._getCullBounds=Cp(Bp),this.opts={...SB,...t},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new Se({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new O,this._modelMatrixInverse=new O}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let r=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(t):r.setNeedsReload()}}update(t,{zRange:r,modelMatrix:n}={zRange:null,modelMatrix:null}){let s=n?new O(n):new O,o=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Et(this._zRange,r)||o){o&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=r;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let i=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),i&&this._frameNumber++,this._frameNumber}isTileVisible(t,r,n){if(!t.isVisible)return!1;if(r&&this._viewport){let s=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:o}=t;for(let[i,a,c,l]of s){let f;if("west"in o)f=o.west<c&&o.east>i&&o.south<l&&o.north>a;else{if(n&&!O.IDENTITY.equals(n)){let[d,p,A,m]=Eo([o.left,o.top,o.right,o.bottom],n);o={left:d,top:p,right:A,bottom:m}}let u=Math.min(o.top,o.bottom),h=Math.max(o.top,o.bottom);f=o.left<c&&o.right>i&&u<l&&h>a}if(f)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:r,minZoom:n,zRange:s,modelMatrix:o,modelMatrixInverse:i}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return yc({viewport:t,maxZoom:r,minZoom:n,zRange:s,tileSize:a,extent:c,modelMatrix:o,modelMatrixInverse:i,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:r}=this.opts;return{bbox:xc(this._viewport,t.x,t.y,t.z,r)}}getParentIndex(t){let r=Math.floor(t.x/2),n=Math.floor(t.y/2),s=t.z-1;return{x:r,y:n,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||Vn,r=new Array(this._cache.size),n=0;for(let s of this._cache.values())r[n++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:CB[t])(Array.from(this._cache.values())),n=0;for(let s of this._cache.values())if(r[n++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,r=[],n=0;for(let s of this._cache.values())s.isLoading&&(n++,!s.isSelected&&!s.isVisible&&r.push(s));for(;t>0&&n>t&&r.length>0;)r.shift().abort(),n--}_rebuildTree(){let{_cache:t}=this;for(let r of t.values())r.parent=null,r.children&&(r.children.length=0);for(let r of t.values()){let n=this._getNearestAncestor(r);r.parent=n,n?.children&&n.children.push(r)}}_resizeCache(){let{_cache:t,opts:r}=this,n=r.maxCacheSize??(r.maxCacheByteSize!==null?1/0:BB*this.selectedTiles.length),s=r.maxCacheByteSize??1/0;if(t.size>n||this._cacheByteSize>s){for(let[i,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize!==null?a.byteLength:0,t.delete(i),this.opts.onTileUnload?.(a)),t.size<=n&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((i,a)=>i.zoom-a.zoom),this._dirty=!1)}_getTile(t,r){let n=this.getTileId(t),s=this._cache.get(n),o=!1;return!s&&r?(s=new er(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:n,zoom:this.getTileZoom(s.index)}),o=!0,this._cache.set(n,s),this._dirty=!0):s&&s.needsReload&&(o=!0),s&&o&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:r=0}=this,n=t.index;for(;this.getTileZoom(n)>r;){n=this.getParentIndex(n);let s=this._getTile(n);if(s)return s}return null}};function IB(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Ip(t)&&_c(t);for(let t of e)t.isVisible=Boolean(t.state&_o)}function wB(e){for(let r of e)r.state=0;for(let r of e)r.isSelected&&Ip(r);let t=Array.from(e).sort((r,n)=>r.zoom-n.zoom);for(let r of t)if(r.isVisible=Boolean(r.state&_o),r.children&&(r.isVisible||r.state&Sp))for(let n of r.children)n.state=Sp;else r.isSelected&&_c(r)}function Ip(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=_o,!0;t=t.parent}return!1}function _c(e){for(let t of e.children)t.isLoaded||t.content?t.state|=_o:_c(t)}var LB={TilesetClass:rr,data:{type:"data",value:[]},dataComparator:Re.equal,renderSubLayers:{type:"function",value:e=>new wp.GeoJsonLayer(e)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:e=>console.error(e)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Vn,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Hn=class extends Mo.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:r}=this.state,n=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);r?n&&(r.setOptions(this._getTilesetOptions()),s?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:r,maxCacheByteSize:n,refinementStrategy:s,extent:o,maxZoom:i,minZoom:a,maxRequests:c,debounceTime:l,zoomOffset:f}=this.props;return{maxCacheSize:r,maxCacheByteSize:n,maxZoom:i,minZoom:a,tileSize:t,refinementStrategy:s,extent:o,maxRequests:c,debounceTime:l,zoomOffset:f,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:r,modelMatrix:n}=this.props,s=t.update(this.context.viewport,{zRange:r,modelMatrix:n}),{isLoaded:o}=t,i=this.state.isLoaded!==o,a=this.state.frameNumber!==s;o&&(i||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:r}=this.props;r&&r(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,r){this.props.onTileError(t),r.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:r,getTileData:n,fetch:s}=this.props,{signal:o}=t;return t.url=typeof r=="string"||Array.isArray(r)?oe(r,t):null,n?n(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let r=t.sourceLayer,n=r.props.tile,s=t.info;return s.picked&&(s.tile=n),s.sourceTile=n,s.sourceTileSubLayer=r,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let r=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)r&&t.layers[0]&&Object.keys(r).some(n=>t.layers[0].props[n]!==r[n])&&(t.layers=t.layers.map(n=>n.clone(r)));else{let n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,Mo._flatten)(n,Boolean).map(s=>s.clone({tile:t,...r}))}return t.layers})}filterSubLayer({layer:t,cullRect:r}){let{tile:n}=t.props,{modelMatrix:s}=this.props;return this.state.tileset.isTileVisible(n,r,s?new O(s):null)}};Hn.defaultProps=LB;Hn.layerName="TileLayer";var nr=Hn;var Rp=D(zt(),1);var Lp=`uniform tripsUniforms {
|
|
14
14
|
bool fadeTrail;
|
|
15
15
|
float trailLength;
|
|
16
16
|
float currentTime;
|
|
17
17
|
} trips;
|
|
18
|
-
`,vp={name:"trips",vs:Lp,fs:Lp,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var
|
|
18
|
+
`,vp={name:"trips",vs:Lp,fs:Lp,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var vB={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},zn=class extends Rp.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`in float instanceTimestamps;
|
|
19
19
|
in float instanceNextTimestamps;
|
|
20
20
|
out float vTime;
|
|
21
21
|
`,"vs:#main-end":`vTime = instanceTimestamps + (instanceNextTimestamps - instanceTimestamps) * vPathPosition.y / vPathLength;
|
|
@@ -26,7 +26,7 @@ out float vTime;
|
|
|
26
26
|
`,"fs:DECKGL_FILTER_COLOR":`if(trips.fadeTrail) {
|
|
27
27
|
color.a *= 1.0 - (trips.currentTime - vTime) / trips.trailLength;
|
|
28
28
|
}
|
|
29
|
-
`},t.modules=[...t.modules,vp],t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:r,trailLength:n,currentTime:s}=this.props,o={fadeTrail:r,trailLength:n,currentTime:s};this.state.model.shaderInputs.setProps({trips:o}),super.draw(t)}};zn.layerName="TripsLayer";zn.defaultProps=
|
|
29
|
+
`},t.modules=[...t.modules,vp],t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:r,trailLength:n,currentTime:s}=this.props,o={fadeTrail:r,trailLength:n,currentTime:s};this.state.model.shaderInputs.setProps({trips:o}),super.draw(t)}};zn.layerName="TripsLayer";zn.defaultProps=vB;var Fp=zn;var Pp=D(Ds(),1),Op=D(qt(),1);var Dt=D(Ds(),1),bo=D(qt(),1),qn=D(zt(),1);var RB=10;function FB(e,t){let r;return e==null?r=t:typeof e=="object"?r={...e,coverage:t}:r={getHexagon:e,coverage:t},r}var PB={...qn.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},Fe=class extends bo.CompositeLayer{initializeState(){Fe._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:r}){if(t.highPrecision!==!0&&(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagon)){let n=this._calculateH3DataProps();this.setState(n)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,r=!1,n=!1,{iterable:s,objectInfo:o}=(0,bo.createIterable)(this.props.data);for(let i of s){o.index++;let a=this.props.getHexagon(i,o),c=(0,Dt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){n=!0;break}if((0,Dt.isPentagon)(a)){r=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Dt.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:n,hasPentagon:r}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:r,hasMultipleRes:n}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||n||r||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:r,edgeLengthKM:n,centerHex:s}=this.state;if(r<0)return;let o=this.props.centerHexagon||(0,Dt.latLngToCell)(t.latitude,t.longitude,r);if(s===o)return;if(s)try{if((0,Dt.gridDistance)(s,o)*n<RB)return}catch{}let{unitsPerMeter:i}=t.distanceScales,a=Ia(o),[c,l]=(0,Dt.cellToLatLng)(o),[f,u]=t.projectFlat([l,c]);a=a.map(h=>{let d=t.projectFlat(h);return[(d[0]-f)/i[0],(d[1]-u)/i[1]]}),this.setState({centerHex:o,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:r,coverage:n,extruded:s,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:u,getFillColor:h,getElevation:d,getLineColor:p,getLineWidth:A,transitions:m,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:n,wireframe:o,stroked:i,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:f,lineWidthMaxPixels:u,material:r,getElevation:d,getFillColor:h,getLineColor:p,getLineWidth:A,transitions:m,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:r,updateTriggers:n,coverage:s}=this.props,o=this.getSubLayerClass("hexagon-cell-hifi",qn.PolygonLayer),i=this._getForwardProps();return i.updateTriggers.getPolygon=FB(n.getHexagon,s),new o(i,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:i.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=r(a,c);return $s(Ia(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:r,updateTriggers:n}=this.props,s=this.getSubLayerClass("hexagon-cell",qn.ColumnLayer),o=this._getForwardProps();return o.updateTriggers.getPosition=n.getHexagon,new s(o,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:o.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Lh.bind(null,r)})}};Fe.defaultProps=PB;Fe.layerName="H3HexagonLayer";Fe._checkH3Lib=()=>{};var Bo=Fe;var OB={getHexagons:{type:"accessor",value:e=>e.hexagons}},kn=class extends Ft{initializeState(){Bo._checkH3Lib()}updateState({props:t,changeFlags:r}){if(r.dataChanged||r.updateTriggersChanged&&r.updateTriggersChanged.getHexagons){let{data:n,getHexagons:s}=t,o=[],{iterable:i,objectInfo:a}=(0,Op.createIterable)(n);for(let c of i){a.index++;let l=s(c,a),f=(0,Pp.cellsToMultiPolygon)(l,!0);for(let u of f){for(let h of u)Zs(h);o.push(this.getSubLayerRow({polygon:u},c,a.index))}}this.setState({polygons:o})}}indexToBounds(){let{getElevation:t,getFillColor:r,getLineColor:n,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:o=>o.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(r),getLineColor:this.getSubLayerAccessor(n),getLineWidth:this.getSubLayerAccessor(s)}}};kn.layerName="H3ClusterLayer";kn.defaultProps=OB;var Np=kn;var g0=D(Mc(),1),Ge=D(qt(),1),A0=D(zt(),1),x0=D(Co(),1);var zp=D(bc(),1);function Hp(e){return{addressModeU:Vp(e.wrapS),addressModeV:Vp(e.wrapT),magFilter:NB(e.magFilter),...DB(e.minFilter)}}function Vp(e){switch(e){case 33071:return"clamp-to-edge";case 10497:return"repeat";case 33648:return"mirror-repeat";default:return}}function NB(e){switch(e){case 9728:return"nearest";case 9729:return"linear";default:return}}function DB(e){switch(e){case 9728:return{minFilter:"nearest"};case 9729:return{minFilter:"linear"};case 9984:return{minFilter:"nearest",mipmapFilter:"nearest"};case 9985:return{minFilter:"linear",mipmapFilter:"nearest"};case 9986:return{minFilter:"nearest",mipmapFilter:"linear"};case 9987:return{minFilter:"linear",mipmapFilter:"linear"};default:return{}}}function Bc(e,t,r,n){let s={defines:{MANUAL_SRGB:!0,SRGB_FAST_APPROXIMATION:!0},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=!0;let{imageBasedLightingEnvironment:o}=n;return o&&(s.bindings.pbr_diffuseEnvSampler=o.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=o.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=o.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),n?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),r.NORMAL&&(s.defines.HAS_NORMALS=!0),r.TANGENT&&n?.useTangents&&(s.defines.HAS_TANGENTS=!0),r.TEXCOORD_0&&(s.defines.HAS_UV=!0),n?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),n?.lights&&(s.defines.USE_LIGHTS=!0),t&&GB(e,t,s),s}function GB(e,t,r){if(r.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&UB(e,t.pbrMetallicRoughness,r),t.normalTexture){Jn(e,t.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",r);let{scale:n=1}=t.normalTexture;r.uniforms.normalScale=n}if(t.occlusionTexture){Jn(e,t.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=t.occlusionTexture;r.uniforms.occlusionStrength=n}switch(t.emissiveTexture&&(Jn(e,t.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.emissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode||"MASK"){case"MASK":let{alphaCutoff:n=.5}=t;r.defines.ALPHA_CUTOFF=!0,r.uniforms.alphaCutoff=n;break;case"BLEND":zp.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blend=!0,r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=32774,r.glParameters.blendFunc=[770,771,1,771];break}}function UB(e,t,r){t.baseColorTexture&&Jn(e,t.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.baseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&Jn(e,t.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:s=1}=t;r.uniforms.metallicRoughnessValues=[n,s]}function Jn(e,t,r,n,s){let o=t.texture.source.image,i;o.compressed?i=o:i={data:o};let a={wrapS:10497,wrapT:10497,...t?.texture?.sampler},c=e.createTexture({id:t.uniformName||t.id,sampler:Hp(a),...i});s.bindings[r]=c,n&&(s.defines[n]=!0),s.generatedTextures.push(c)}var kp=D(bc(),1);var Cc=`precision highp int;
|
|
30
30
|
|
|
31
31
|
// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
32
32
|
struct AmbientLight {
|
|
@@ -151,7 +151,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
|
|
|
151
151
|
+ pointLight.attenuation.y * distance
|
|
152
152
|
+ pointLight.attenuation.z * distance * distance;
|
|
153
153
|
}
|
|
154
|
-
`;var
|
|
154
|
+
`;var VB=5,HB=255,Xn;(function(e){e[e.POINT=0]="POINT",e[e.DIRECTIONAL=1]="DIRECTIONAL"})(Xn||(Xn={}));var jn={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:Xn.POINT,directionalLightCount:0,pointLightCount:0,ambientColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:qp,vs:Cc,fs:Cc,getUniforms:zB};function zB(e,t={}){if(e=e&&{...e},!e)return{...jn.defaultUniforms};e.lights&&(e={...e,...kB(e.lights),lights:void 0});let{ambientLight:r,pointLights:n,directionalLights:s}=e||{};if(!(r||n&&n.length>0||s&&s.length>0))return{...jn.defaultUniforms,enabled:0};let i={...jn.defaultUniforms,...t,...qB({ambientLight:r,pointLights:n,directionalLights:s})};return e.enabled!==void 0&&(i.enabled=e.enabled?1:0),i}function qB({ambientLight:e,pointLights:t=[],directionalLights:r=[]}){let n={};n.ambientColor=Sc(e);let s=0;for(let o of t){n.lightType=Xn.POINT;let i=s;n[`lightColor${i}`]=Sc(o),n[`lightPosition${i}`]=o.position,n[`lightAttenuation${i}`]=o.attenuation||[1,0,0],s++}for(let o of r){n.lightType=Xn.DIRECTIONAL;let i=s;n[`lightColor${i}`]=Sc(o),n[`lightDirection${i}`]=o.direction,s++}return s>VB&&kp.log.warn("MAX_LIGHTS exceeded")(),n.directionalLightCount=r.length,n.pointLightCount=t.length,n}function kB(e){let t={pointLights:[],directionalLights:[]};for(let r of e||[])switch(r.type){case"ambient":t.ambientLight=r;break;case"directional":t.directionalLights?.push(r);break;case"point":t.pointLights?.push(r);break;default:}return t}function Sc(e={}){let{color:t=[0,0,0],intensity:r=1}=e;return t.map(n=>n*r/HB)}var Jp=`out vec3 pbr_vPosition;
|
|
155
155
|
out vec2 pbr_vUV;
|
|
156
156
|
|
|
157
157
|
#ifdef HAS_NORMALS
|
|
@@ -1004,7 +1004,7 @@ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
|
|
|
1004
1004
|
mat4 normalMatrix;
|
|
1005
1005
|
vec3 camera;
|
|
1006
1006
|
} pbrProjection;
|
|
1007
|
-
`,Yp={name:"pbrProjection",vs:Wp,fs:Wp,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var
|
|
1007
|
+
`,Yp={name:"pbrProjection",vs:Wp,fs:Wp,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var Ic={props:{},uniforms:{},name:"pbrMaterial",dependencies:[jn,Yp],source:Xp,vs:Jp,fs:jp,defines:{LIGHTING_FRAGMENT:!0,HAS_NORMALMAP:!1,HAS_EMISSIVEMAP:!1,HAS_OCCLUSIONMAP:!1,HAS_BASECOLORMAP:!1,HAS_METALROUGHNESSMAP:!1,ALPHA_CUTOFF:!1,USE_IBL:!1,PBR_DEBUG:!1},getUniforms:e=>e,uniformTypes:{unlit:"i32",baseColorMapEnabled:"i32",baseColorFactor:"vec4<f32>",normalMapEnabled:"i32",normalScale:"f32",emissiveMapEnabled:"i32",emissiveFactor:"vec3<f32>",metallicRoughnessValues:"vec2<f32>",metallicRoughnessMapEnabled:"i32",occlusionMapEnabled:"i32",occlusionStrength:"f32",alphaCutoffEnabled:"i32",alphaCutoff:"f32",IBLenabled:"i32",scaleIBLAmbient:"vec2<f32>",scaleDiffBaseMR:"vec4<f32>",scaleFGDSpec:"vec4<f32>"}};var tm=D(Mc(),1),em=D(Co(),1);var Kp=`uniform meshUniforms {
|
|
1008
1008
|
bool pickFeatureIds;
|
|
1009
1009
|
} mesh;
|
|
1010
1010
|
`,Qp={name:"mesh",vs:Kp,fs:Kp,uniformTypes:{pickFeatureIds:"f32"}};var Zp=`#version 300 es
|
|
@@ -1095,7 +1095,7 @@ fragColor = vec4(lightColor, color.a * layer.opacity);
|
|
|
1095
1095
|
#endif
|
|
1096
1096
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
1097
1097
|
}
|
|
1098
|
-
`;function jB(e){let t=e.positions||e.POSITION,r=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var XB={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Wn=class extends em.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Bc,Qp),{...t,vs:Zp,fs:$p}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let r=this.getAttributeManager();t&&r.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:r,oldProps:n}=t;r.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(t){let{featureIds:r}=this.props,{model:n}=this.state;if(!n)return;let s={pickFeatureIds:Boolean(r)},o={camera:this.context.viewport.cameraPosition};n.shaderInputs.setProps({pbrProjection:o,mesh:s}),super.draw(t)}getModel(t){let{id:r}=this.props,n=this.parseMaterial(this.props.pbrMaterial,t);this.setState({parsedPBRMaterial:n});let s=this.getShaders();return jB(t.attributes),new tm.Model(this.context.device,{...this.getShaders(),id:r,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...n?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:n?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:r}=this.state;if(r){let{mesh:n}=this.props,s=this.parseMaterial(t,n);this.setState({parsedPBRMaterial:s});let{pbr_baseColorSampler:o}=s.bindings,{emptyTexture:i}=this.state,a={sampler:o||i,hasTexture:Boolean(o)},{camera:c,...l}={...s.bindings,...s.uniforms};r.shaderInputs.setProps({simpleMesh:a,pbrMaterial:l})}}parseMaterial(t,r){let n=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return _c(this.context.device,{unlit:n,...t},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let r=this.props.featureIds,n=new Uint8ClampedArray(r.length*t.size),s=[];for(let o=0;o<r.length;o++)this.encodePickingColor(r[o],s),n[o*3]=s[0],n[o*3+1]=s[1],n[o*3+2]=s[2];t.value=n}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}};Wn.layerName="MeshLayer";Wn.defaultProps=XB;var rm=Wn;var y0=D(Or(),1);var de=6356752314245179e-9,WB={radii:[6378137,6378137,de],radiiSquared:[6378137*6378137,6378137*6378137,de*de],oneOverRadii:[1/6378137,1/6378137,1/de],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(de*de)],maximumRadius:Math.max(6378137,6378137,de),centerToleranceSquared:.1};function Co(e){return e}var aU=new x;function YB(e,t=[],r=Co){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function sm(e,t=[]){return YB(e,t,Q._cartographicRadians?Co:Wi)}function KB(e,t,r=Co){return"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):"x"in t?(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function om(e,t){return KB(e,t,Q._cartographicRadians?Co:Yi)}var im=1e-14,QB=new x,am={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"}},Cc={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Yn={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},ZB=new x,$B=new x,tC=new x;function Sc(e,t,r,n,s,o){let i=am[t]&&am[t][r];ft(i&&(!n||n===i));let a,c,l,f=QB.copy(s);if(Et(f.x,0,im)&&Et(f.y,0,im)){let h=Math.sign(f.z);a=ZB.fromArray(Cc[t]),t!=="east"&&t!=="west"&&a.scale(h),c=$B.fromArray(Cc[r]),r!=="east"&&r!=="west"&&c.scale(h),l=tC.fromArray(Cc[n]),n!=="east"&&n!=="west"&&l.scale(h)}else{let{up:h,east:d,north:p}=Yn;d.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,h),p.copy(h).cross(d);let{down:A,west:m,south:y}=Yn;A.copy(h).scale(-1),m.copy(d).scale(-1),y.copy(p).scale(-1),a=Yn[t],c=Yn[r],l=Yn[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=f.x,o[13]=f.y,o[14]=f.z,o[15]=1,o}var Nr=new x,eC=new x,rC=new x;function cm(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:o}=t;Nr.from(e);let i=Nr.x,a=Nr.y,c=Nr.z,l=n.x,f=n.y,u=n.z,h=i*i*l*l,d=a*a*f*f,p=c*c*u*u,A=h+d+p,m=Math.sqrt(1/A);if(!Number.isFinite(m))return;let y=eC;if(y.copy(e).scale(m),A<o)return y.to(r);let _=s.x,E=s.y,M=s.z,B=rC;B.set(y.x*_*2,y.y*E*2,y.z*M*2);let C=(1-m)*Nr.len()/(.5*B.len()),L=0,b,T,g,S;do{C-=L,b=1/(1+C*_),T=1/(1+C*E),g=1/(1+C*M);let R=b*b,F=T*T,v=g*g,G=R*b,X=F*T,z=v*g;S=h*R+d*F+p*v-1;let K=-2*(h*G*_+d*X*E+p*z*M);L=S/K}while(Math.abs(S)>Pt.EPSILON12);return Nr.scale([b,T,g]).to(r)}var So=new x,lm=new x,oC=new x,Wt=new x,iC=new x,Io=new x,U=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=Pt.EPSILON1,ft(t>=0),ft(r>=0),ft(n>=0),this.radii=new x(t,r,n),this.radiiSquared=new x(t*t,r*r,n*n),this.radiiToTheFourth=new x(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new x(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=lm,s=oC,[,,o]=t;this.geodeticSurfaceNormalCartographic(t,n),s.copy(this.radiiSquared).scale(n);let i=Math.sqrt(n.dot(s));return s.scale(1/i),n.scale(o),s.add(n),s.to(r)}cartesianToCartographic(t,r=[0,0,0]){Io.from(t);let n=this.scaleToGeodeticSurface(Io,Wt);if(!n)return;let s=this.geodeticSurfaceNormal(n,lm),o=iC;o.copy(Io).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Je.dot(o,Io))*Je.length(o);return om([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new O){return Sc(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new O){return Sc(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return So.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=sm(t),s=n[0],o=n[1],i=Math.cos(o);return So.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),So.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return So.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return cm(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Wt.from(t);let n=Wt.x,s=Wt.y,o=Wt.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return Wt.multiplyScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Wt.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Wt.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){ft(Et(this.radii.x,this.radii.y,Pt.EPSILON15)),ft(this.radii.z>0),Wt.from(t);let s=Wt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return Wt.set(0,0,s).to(n)}};U.WGS84=new U(6378137,6378137,de);var wo=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Lo=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new wo(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var vo=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Lo,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,o=t.maximumMemoryUsage*1024*1024,i=this._sentinel,a=s.head;for(;a!==i&&(t.gpuMemoryUsageInBytes>o||n);){let c=a.item;a=a.next,this.unloadTile(t,c,r)}}trim(){this._trimTiles=!0}};function fm(e,t){H(e),H(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:o}}=e,i=new O(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let u=new O().rotateX(Math.PI/2);i=i.multiplyRight(u);break;case"X":let h=new O().rotateY(-Math.PI/2);i=i.multiplyRight(h);break;default:break}t.isQuantized&&i.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(o);t.cartesianModelMatrix=i,t.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),f=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=f.multiplyRight(i),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var um=new x,Ic=new x,wc=new ct([new ut,new ut,new ut,new ut,new ut,new ut]);function dm(e,t){let{cameraDirection:r,cameraUp:n,height:s}=e,{metersPerUnit:o}=e.distanceScales,i=Ro(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(i),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),f=new x(a.transformAsVector(new x(r).scale(o))).normalize(),u=new x(a.transformAsVector(new x(n).scale(o))).normalize();aC(e);let h=e.constructor,{longitude:d,latitude:p,width:A,bearing:m,zoom:y}=e,_=new h({longitude:d,latitude:p,height:s,width:A,bearing:m,zoom:y,pitch:0});return{camera:{position:l,direction:f,up:u},viewport:e,topDownViewport:_,height:s,cullingVolume:wc,frameNumber:t,sseDenominator:1.15}}function pm(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:o}=t.viewport;for(let[l,f]of e.entries()){let[u,h]=f.header.mbs,d=Math.abs(s-u),p=Math.abs(o-h),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,f)=>l[1]-f[1]),a=[];for(let l=0;l<r;l++)a.push(e[i[l][0]]);let c=[];for(let l=r;l<i.length;l++)c.push(e[i[l][0]]);return[a,c]}function aC(e){let t=e.getFrustumPlanes(),r=hm(t.near,e.cameraPosition),n=Ro(e,r),s=Ro(e,e.cameraPosition,Ic),o=0;wc.planes[o++].fromPointNormal(n,um.copy(n).subtract(s));for(let i in t){if(i==="near")continue;let a=t[i],c=hm(a,r,Ic),l=Ro(e,c,Ic);wc.planes[o++].fromPointNormal(l,um.copy(n).subtract(l))}}function hm(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Ro(e,t,r=new x){let n=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(n,r)}var cC=6378137,lC=6378137,Lc=6356752314245179e-9,Dr=new x;function mm(e,t){if(e instanceof Xt){let{halfAxes:r}=e,n=fC(r);return Math.log2(Lc/(n+t[2]))}else if(e instanceof Nt){let{radius:r}=e;return Math.log2(Lc/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(cC/r),o=Math.log2(lC/n);return(s+o)/2}return 1}function vc(e,t,r){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Dr);let n=Math.sqrt(Math.pow(Dr[0]-r[0],2)+Math.pow(Dr[1]-r[1],2)+Math.pow(Dr[2]-r[2],2));return Math.log2(Lc/(n+t[2]))}function gm(e,t,r){let[n,s,o,i]=e;return vc({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function fC(e){e.getColumn(0,Dr);let t=e.getColumn(1),r=e.getColumn(2);return Dr.add(t).add(r).len()}var Fm=D(Or(),1);var Mt={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},mt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(mt||(mt={}));var Gt;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Gt||(Gt={}));var ht;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(ht||(ht={}));var pe;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(pe||(pe={}));var Am={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function Em(e){return e!=null}var gt=new x,Fo=new x,uC=new x,hC=new x,sr=new x,xm=new x,ym=new x,Tm=new x;function Po(e,t,r){if(H(e,"3D Tile: boundingVolume must be defined"),e.box)return Mm(e.box,t,r);if(e.region)return pC(e.region);if(e.sphere)return dC(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function _m(e,t){if(e.box)return mC(t);if(e.region){let[r,n,s,o,i,a]=e.region;return[[Lt(r),Lt(n),i],[Lt(s),Lt(o),a]]}if(e.sphere)return gC(t);throw new Error("Unkown boundingVolume type")}function Mm(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=[];if(e.length===10){let l=e.slice(3,6),f=new $t;f.fromArray(e,6);let u=new x([1,0,0]),h=new x([0,1,0]),d=new x([0,0,1]);u.transformByQuaternion(f),u.scale(l[0]),h.transformByQuaternion(f),h.scale(l[1]),d.transformByQuaternion(f),d.scale(l[2]),s=[...u.toArray(),...h.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(s.slice(0,3)),i=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new J([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return Em(r)?(r.center=n,r.halfAxes=c,r):new Xt(n,c)}function dC(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(Fo),o=Math.max(Math.max(s[0],s[1]),s[2]),i=e[3]*o;return Em(r)?(r.center=n,r.radius=i,r):new Nt(n,i)}function pC(e){let[t,r,n,s,o,i]=e,a=U.WGS84.cartographicToCartesian([Lt(t),Lt(s),o],uC),c=U.WGS84.cartographicToCartesian([Lt(n),Lt(r),i],hC),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,sr),U.WGS84.cartographicToCartesian([Lt(n),sr[1],sr[2]],xm),U.WGS84.cartographicToCartesian([sr[0],Lt(s),sr[2]],ym),U.WGS84.cartographicToCartesian([sr[0],sr[1],i],Tm),Mm([...l,...xm.subtract(l),...ym.subtract(l),...Tm.subtract(l)],new O)}function mC(e){let t=bm(),{halfAxes:r}=e,n=new x(r.getColumn(0)),s=new x(r.getColumn(1)),o=new x(r.getColumn(2));for(let i=0;i<2;i++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)gt.copy(e.center),gt.add(n),gt.add(s),gt.add(o),Bm(t,gt),o.negate();s.negate()}n.negate()}return t}function gC(e){let t=bm(),{center:r,radius:n}=e,s=U.WGS84.scaleToGeodeticSurface(r,gt),o;s?o=U.WGS84.geodeticSurfaceNormal(s):o=new x(0,0,1);let i=new x(o[2],-o[1],0);i.len()>0?i.normalize():i=new x(0,1,0);let a=i.clone().cross(o);for(let c of[i,a,o]){Fo.copy(c).scale(n);for(let l=0;l<2;l++)gt.copy(r),gt.add(Fo),Bm(t,gt),Fo.negate()}return t}function bm(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Bm(e,t){U.WGS84.cartesianToCartographic(t,gt),e[0][0]=Math.min(e[0][0],gt[0]),e[0][1]=Math.min(e[0][1],gt[1]),e[0][2]=Math.min(e[0][2],gt[2]),e[1][0]=Math.max(e[1][0],gt[0]),e[1][1]=Math.max(e[1][1],gt[1]),e[1][2]=Math.max(e[1][2],gt[2])}var XU=new x,WU=new x,YU=new O,KU=new x,QU=new x,ZU=new x;function AC(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function xC(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return AC(t,r)*n}return 0}function Cm(e,t,r){let n=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=r?s:e.lodMetricValue;if(o===0)return 0;let i=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=n.options,f=o*a*(l||1)/(i*c);return f-=xC(n,i),f}var Rc=new x,Sm=new x,Pe=new x,Im=new x,yC=new x,Fc=new O,wm=new O;function Lm(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*Pc(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Pc(e,t){let{topDownViewport:r}=t,n=e.header.mbs[1],s=e.header.mbs[0],o=e.header.mbs[2],i=e.header.mbs[3],a=[...e.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);U.WGS84.cartographicToCartesian(c,Rc),Sm.copy(Rc).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Fc),wm.copy(Fc).invert(),Pe.copy(Rc).transform(wm);let l=Math.sqrt(Pe[0]*Pe[0]+Pe[1]*Pe[1]),f=l*l/Pe[2];Im.copy([Pe[0],Pe[1],f]);let h=Im.transform(Fc).subtract(a).normalize(),p=Sm.cross(h).normalize().scale(i).add(a),A=U.WGS84.cartesianToCartographic(p),m=r.project([s,n,o]),y=r.project(A);return yC.copy(m).subtract(y).magnitude()}function vm(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Kn=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return H(t<this._array.length),this._array[t]}set(t,r){H(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){H(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){H(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var TC={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ie=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Kn;_emptyTraversalStack=new Kn;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...TC,...t}}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let o=n.pop(),i=!1;this.canTraverse(o,r)&&(this.updateChildTiles(o,r),i=this.updateAndPushChildren(o,r,n,o.hasRenderContent?o._selectionDepth+1:o._selectionDepth));let a=o.parent,c=Boolean(!a||a._shouldRefine),l=!i;o.hasRenderContent?o.refine===mt.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===mt.REPLACE&&(this.loadTile(o,r),l&&this.selectTile(o,r)):(this.emptyTiles[o.id]=o,this.loadTile(o,r),l&&this.selectTile(o,r)),this.touchTile(o,r),o._shouldRefine=i&&c}let s=new Date().getTime();(this.traversalFinished(r)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(r))}updateChildTiles(t,r){let n=t.children;for(let s of n)this.updateTile(s,r)}updateAndPushChildren(t,r,n,s){let{loadSiblings:o,skipLevelOfDetail:i}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===mt.REPLACE&&t.hasRenderContent&&!i,l=!1,f=!0;for(let u of a)if(u._selectionDepth=s,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&(this.loadTile(u,r),this.touchTile(u,r)),c){let h;if(u._inRequestVolume?u.hasRenderContent?h=u.contentAvailable:h=this.executeEmptyTraversal(u,r):h=!1,f=f&&h,!f)return!1}return l||(f=!1),f}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){this.shouldLoadTile(t)&&(t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,r,n=!1){let s=t._screenSpaceError;return n&&(s=t.getScreenSpaceError(r,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===r.viewport.id&&n.push(s);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let s of t.children)s.updateVisibility(r),n=n||s.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let o=s.pop(),i=!o.hasRenderContent&&this.canTraverse(o,r),a=!o.hasRenderContent&&o.children.length===0;if(!i&&!o.contentAvailable&&!a&&(n=!1),this.updateTile(o,r),o.isVisibleAndInRequestVolume||(this.loadTile(o,r),this.touchTile(o,r)),i){let c=o.children;for(let l of c)s.push(l)}}return n}};var Rm=new x;function EC(e){return e!=null}var or=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=Mt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new O;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new ie({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new O;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,r,n,s=""){this.header=r,this.tileset=t,this.id=s||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}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===Mt.READY||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===Mt.UNLOADED}get contentExpired(){return this.contentState===Mt.EXPIRED}get contentFailed(){return this.contentState===Mt.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=_m(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case ht.I3S:return Pc(this,t);case ht.TILES3D:return Cm(this,t,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:r}=t.options,n=this.refine===mt.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Mt.UNLOADED)return-1;let s=this.parent,i=s&&(!n||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.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=Mt.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Mt.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,o={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,Fm.load)(n,s,o),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Mt.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=Mt.FAILED,n}finally{r.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=Mt.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ct.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==ct.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:s}=this;return n.computeVisibilityWithPlaneMask(s,r)}contentVisibility(){return!0}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return Rm.subVectors(r.center,t.position),t.direction.dot(Rm)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(EC(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Mt.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.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 t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new O(t.transform):new O;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new O(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new O;this._initialTransform=new O(o).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Mt.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ct.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(t){return t||this.parent&&this.parent.refine||mt.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=Po(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=Po(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Po(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new O){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){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 vm(this.tileset.tileset)}}};var Oo=class extends ie{compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let i=t.children[0];this.updateTileVisibility(i,r),t._visible=i._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let s=t.refine===mt.REPLACE,o=t._optimChildrenWithinParent===Am.USE_OPTIMIZATION;if(s&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==mt.ADD?!1:!this.shouldRefine(t,r,!0)}};var Pm=D(Or(),1);var No=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var Oc={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Do=class{_statusMap;pendingTilesRegister=new No;constructor(){this._statusMap={}}add(t,r,n,s){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:i}}=s;this._statusMap[r]={request:t,callback:n,key:r,frameState:s,status:Oc.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=Oc.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,s)}).catch(a=>{this._statusMap[r].status=Oc.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,n);let{frameNumber:o,viewport:{id:i}}=r;this.pendingTilesRegister.register(i,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var Go=class extends ie{_tileManager;constructor(t){super(t),this._tileManager=new Do}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Lm(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],s=t.children,o=t.tileset;for(let i of n){let a=`${i.id}-${r.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,r);else{let l=()=>this._loadTile(i.id,o);this._tileManager.find(a)?this._tileManager.update(a,r):(o.tileset.nodePages&&(l=()=>o.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(l,a,u=>this._onTileLoad(u,t,a),r))}}return!1}async _loadTile(t,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${t}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,Pm.load)(s,n,o)}_onTileLoad(t,r,n){let s=new or(r.tileset,t,r,n);r.children.push(s);let o=this._tileManager.find(s.id).frameState;this.updateTile(s,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,o)}};var _C={description:"",ellipsoid:U.WGS84,modelMatrix:new O,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Uo="Tiles In Tileset(s)",Nc="Tiles In Memory",Om="Tiles In View",Nm="Tiles To Render",Dm="Tiles Loaded",Dc="Tiles Loading",Gm="Tiles Unloaded",Um="Failed Tile Loads",Vm="Points/Vertices",Gc="Tile Memory Use",Hm="Maximum Screen Space Error",Qn=class{options;loadOptions;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};description="";properties;extras=null;attributions={};credits={};stats;contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;maximumMemoryUsage=32;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=0;_cacheOverflowBytes=0;_frameNumber=0;_queryParams={};_extensionsUsed=[];_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_traverser;_cache=new vo;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,r){this.options={..._C,...r},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Ie.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Se({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new Ce({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let n=t;return this.queryParams.length&&(n=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let s of r){let o=s.id;this._needTraverse(o)?n.push(o):this.traverseCounter--}for(let s of r){let o=s.id;if(this.roots[o]||(this.roots[o]=this._initializeTileHeaders(this.tileset,null)),!n.includes(o))continue;let i=dm(s,this._frameNumber);this._traverser.traverse(this.roots[o],i,this.options)}}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[o,i]=pm(s,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of i)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let r=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(i=>i.id)),s=new Set(r.map(i=>i.id)),o=t.filter(i=>!s.has(i.id)).length>0;return o=o||r.filter(i=>!n.has(i.id)).length>0,o}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r))}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(Om).count=this.selectedTiles.length,this.stats.get(Nm).count=t,this.stats.get(Vm).count=r,this.stats.get(Hm).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===ht.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===ht.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===ht.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:n,xmax:s,ymin:o,ymax:i,zmin:a,zmax:c}=t;this.cartographicCenter=new x(n+(s-n)/2,o+(i-o)/2,a+(c-a)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=vc(t,this.cartographicCenter,this.cartesianCenter);return}let r=this.tileset.store?.extent;if(r){let[n,s,o,i]=r;this.cartographicCenter=new x(n+(o-n)/2,s+(i-s)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=gm(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:r}=t.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=mm(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Uo),this.stats.get(Dc),this.stats.get(Nc),this.stats.get(Om),this.stats.get(Nm),this.stats.get(Dm),this.stats.get(Gm),this.stats.get(Um),this.stats.get(Vm),this.stats.get(Gc,"memory"),this.stats.get(Hm)}_initializeTileHeaders(t,r){let n=new or(this,t.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===ht.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get(Uo).incrementCount();let i=o.header.children||[];for(let a of i){let c=new or(this,a,o);if(c.contentUrl?.includes("?session=")){let f=new URL(c.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=Oo;break;case ht.I3S:t=Go;break;default:t=ie}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){this._onTileLoadError(t,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}_onTileLoadError(t,r){this.stats.get(Um).incrementCount();let n=r.message||r.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,s)}_onTileLoad(t,r){if(r){if(this.type===ht.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(Uo).reset(),this.stats.get(Uo).addCount(n)}t&&t.content&&fm(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===ht.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ht.TILES3D){let{extensionsRemoved:r=[]}=t.content?.gltf||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Dc).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Dc).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Dm).incrementCount(),this.stats.get(Nc).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Gc).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Nc).decrementCount(),this.stats.get(Gm).incrementCount(),this.stats.get(Gc).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[];for(n.push(r);n.length>0;){t=n.pop();for(let s of t.children)n.push(s);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let r=new URLSearchParams(t.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var Vo="4.3.3";var ir={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},X4=Object.keys(ir);function Uc(e,t,r){H(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(e,t,r);return n.decode(s)}function zm(e,t=0){let 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))}`}var qm="4.3.3";var km={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:qm,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jm(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function ar(e){let t=1/0,r=1/0,n=1/0,s=-1/0,o=-1/0,i=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let f=a[l],u=a[l+1],h=a[l+2];t=f<t?f:t,r=u<r?u:r,n=h<n?h:n,s=f>s?f:s,o=u>o?u:o,i=h>i?h:i}return[[t,r,n],[s,o,i]]}function Vc(e,t,r){let n=Jm(t.value),s=r||jm(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function jm(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function Wm(e,t,r){let n=Ym(t.metadata),s=[],o=MC(t.attributes);for(let i in e){let a=e[i],c=Xm(i,a,o[i]);s.push(c)}if(r){let i=Xm("indices",r);s.push(i)}return{fields:s,metadata:n}}function MC(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Xm(e,t,r){let n=r?Ym(r.metadata):void 0;return Vc(e,t,n)}function Ym(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Km={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},bC={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},BC=4,Zn=class{draco;decoder;metadataQuerier;constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let s=this.decoder.GetEncodedGeometryType(n),o=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(s){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(n,o);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(n,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!o.ptr){let h=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(h)}let a=this._getDracoLoaderData(o,s,r),c=this._getMeshData(o,a,r),l=ar(c.attributes),f=Wm(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:f}}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}_getDracoLoaderData(t,r,n){let s=this._getTopLevelMetadata(t),o=this._getDracoAttributes(t,n);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:o}}_getDracoAttributes(t,r){let n={};for(let s=0;s<t.num_attributes();s++){let o=this.decoder.GetAttribute(t,s),i=this._getAttributeMetadata(t,s);n[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:s,metadata:i};let a=this._getQuantizationTransform(o,r);a&&(n[o.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(o,r);c&&(n[o.unique_id()].octahedron_transform=c)}return n}_getMeshData(t,r,n){let s=this._getMeshAttributes(r,t,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,r,n){let s={};for(let o of Object.values(t.attributes)){let i=this._deduceAttributeName(o,n);o.name=i;let a=this._getAttributeValues(r,o);if(a){let{value:c,size:l}=a;s[i]={value:c,size:l,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}}return s}_getTriangleListIndices(t){let n=t.num_faces()*3,s=n*BC,o=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,o),new Uint32Array(this.draco.HEAPF32.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),IC(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=bC[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let s=r.num_components,i=t.num_points()*s,a=i*n.BYTES_PER_ELEMENT,c=CC(this.draco,n),l,f=this.draco._malloc(a);try{let u=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,u,c,a,f),l=new n(this.draco.HEAPF32.buffer,f,i).slice()}finally{this.draco._free(f)}return{value:l,size:s}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[i,a]of Object.entries(r.extraAttributes||{}))if(a===n)return i;let s=t.attribute_type;for(let i in Km)if(this.draco[i]===s)return Km[i];let o=r.attributeNameEntry||"name";return t.metadata[o]?t.metadata[o].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let n=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(n)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(t);for(let s=0;s<n;s++){let o=this.metadataQuerier.GetEntryName(t,s);r[o]=this._getDracoMetadataField(t,o)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let s=SC(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,s=[...r,...n];for(let o of s)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,s=t.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(a=>i.min_value(a))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:n=[]}=r,s=t.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}};function CC(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}}function SC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function IC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var wC="1.5.6",LC="1.4.1",Hc=`https://www.gstatic.com/draco/versioned/decoders/${wC}`,Bt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},zc={[Bt.DECODER]:`${Hc}/${Bt.DECODER}`,[Bt.DECODER_WASM]:`${Hc}/${Bt.DECODER_WASM}`,[Bt.FALLBACK_DECODER]:`${Hc}/${Bt.FALLBACK_DECODER}`,[Bt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${LC}/javascript/${Bt.ENCODER}`},qc;async function Qm(e){let t=e.modules||{};return t.draco3d?qc||=t.draco3d.createDecoderModule({}).then(r=>({draco:r})):qc||=vC(e),await qc}async function vC(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await re(zc[Bt.FALLBACK_DECODER],"draco",e,Bt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await re(zc[Bt.DECODER],"draco",e,Bt.DECODER),await re(zc[Bt.DECODER_WASM],"draco",e,Bt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await RC(t,r)}function RC(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var Ho={...km,parse:FC};async function FC(e,t){let{draco:r}=await Qm(t),n=new Zn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var PC={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},at={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},N={...PC,...at};var kc={[at.DOUBLE]:Float64Array,[at.FLOAT]:Float32Array,[at.UNSIGNED_SHORT]:Uint16Array,[at.UNSIGNED_INT]:Uint32Array,[at.UNSIGNED_BYTE]:Uint8Array,[at.BYTE]:Int8Array,[at.SHORT]:Int16Array,[at.INT]:Int32Array},OC={DOUBLE:at.DOUBLE,FLOAT:at.FLOAT,UNSIGNED_SHORT:at.UNSIGNED_SHORT,UNSIGNED_INT:at.UNSIGNED_INT,UNSIGNED_BYTE:at.UNSIGNED_BYTE,BYTE:at.BYTE,SHORT:at.SHORT,INT:at.INT},Jc="Failed to convert GL type",At=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in kc)if(kc[r]===t)return r;throw new Error(Jc)}static fromName(t){let r=OC[t];if(!r)throw new Error(Jc);return r}static getArrayType(t){switch(t){case at.UNSIGNED_SHORT_5_6_5:case at.UNSIGNED_SHORT_4_4_4_4:case at.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=kc[t];if(!r)throw new Error(Jc);return r}}static getByteSize(t){return At.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(At.getArrayType(t))}static createTypedArray(t,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/At.getByteSize(t));let o=At.getArrayType(t);return new o(r,n,s)}};function Zm(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function jc(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,s=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=s<<3,t}var S9=1/256;var I9=new ze,w9=new x,L9=new ze,v9=new ze,R9=new Uint8Array(1);function $m(e,t=255){return Gs(e,0,t)/t*2-1}function tg(e){return e<0?-1:1}function eg(e,t,r,n){if(Zm(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=$m(e,r),n.y=$m(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let s=n.x;n.x=(1-Math.abs(n.y))*tg(s),n.y=(1-Math.abs(s))*tg(n.y)}return n.normalize()}function Xc(e,t,r){return eg(e,t,255,r)}var me=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,r){this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=N.UNSIGNED_INT,n=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,s.byteOffset):s}getPropertyArray(t,r,n){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=At.fromName(s.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,r,s)}getProperty(t,r,n,s,o){let i=this.json[t];if(!i)return i;let a=this.getPropertyArray(t,r,n);if(n===1)return a[s];for(let c=0;c<n;++c)o[c]=a[n*s+c];return o}_getTypedArrayFromBinary(t,r,n,s,o){let i=this._cachedTypedArrays,a=i[t];return a||(a=At.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+o,s*n),i[t]=a),a}_getTypedArrayFromArray(t,r,n){let s=this._cachedTypedArrays,o=s[t];return o||(o=At.createTypedArray(r,n),s[t]=o),o}};var NC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},DC={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]]},GC={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]}};function rg(e,t,r,n){let{componentType:s}=e;H(e.componentType);let o=typeof s=="string"?At.fromName(s):s,i=NC[e.type],a=DC[e.type],c=GC[e.type];return r+=e.byteOffset,{values:At.createTypedArray(o,t,r,i*n),type:o,size:i,unpacker:a,packer:c}}var ae=e=>e!==void 0;function ng(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),s=t.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?UC(n,r):null}function UC(e,t){let r,n,s,o=e.instancesLength,i=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,f=o;ae(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,o));let u;if(ae(c))for(ae(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,o)),u=new Uint16Array(o),f=0,r=0;r<o;++r)u[r]=f,f+=c[r];ae(l)&&ae(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,f));let h=i.length;for(r=0;r<h;++r){let m=i[r].length,y=i[r].instances,_=getBinaryProperties(m,y,t);i[r].instances=combine(_,y)}let d=new Array(h).fill(0),p=new Uint16Array(o);for(r=0;r<o;++r)n=a[r],p[r]=d[n],++d[n];let A={classes:i,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:u,parentIds:l};return zC(A),A}function Gr(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?VC(e,t,r):HC(e,t,r)}function VC(e,t,r){let n=e.classIds,s=e.parentCounts,o=e.parentIds,i=e.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,f=scratchStack;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),c[t]===l)continue;c[t]=l;let u=r(e,t);if(ae(u))return u;let h=s[t],d=i[t];for(let p=0;p<h;++p){let A=o[d+p];A!==t&&f.push(A)}}return null}function HC(e,t,r){let n=!0;for(;n;){let s=r(e,t);if(ae(s))return s;let o=e.parentIds[t];n=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}function zC(e){let t=[],n=e.classIds.length;for(let s=0;s<n;++s)sg(e,s,stack)}function sg(e,t,r){let n=e.parentCounts,s=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(!ae(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let c=ae(n)?n[t]:1,l=ae(n)?o[t]:t;for(let f=0;f<c;++f){let u=s[l+f];u!==t&&sg(e,u,r)}r.pop(t)}function Ct(e){return e!=null}var zo=(e,t)=>e,qC={HIERARCHY:!0,extensions:!0,extras:!0},cr=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,s={}){H(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)qC[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ng(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),H(typeof r=="string",r),this._hierarchy){let n=Gr(this._hierarchy,t,(s,o)=>{let i=s.classIds[o];return s.classes[i].name===r});return Ct(n)}return!1}isExactClass(t,r){return H(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),H(typeof r=="string",r),Ct(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Ct(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),H(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Ct(s))return this._getBinaryProperty(s,t)}let n=this._properties[r];if(Ct(n))return zo(n[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,r);if(Ct(s))return s}}setProperty(t,r,n){let s=this.featureCount;if(this._checkBatchId(t),H(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(i){this._setBinaryProperty(i,t,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,n))return;let o=this._properties[r];Ct(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[t]=zo(n,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,n){t.pack(n,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let n=this._properties[r],s=this._initializeBinaryProperty(r,n);s&&(t=t||{},t[r]=s)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;H(this.binary,`Property ${t} requires a batch table binary.`),H(n.type,`Property ${t} requires a type.`);let s=rg(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=Gr(this._hierarchy,t,(s,o)=>{let i=s.classIds[o],a=s.classes[i].instances;return Ct(a[r])});return Ct(n)}_getPropertyNamesInHierarchy(t,r){Gr(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o].instances;for(let a in i)i.hasOwnProperty(a)&&r.indexOf(a)===-1&&r.push(a)})}_getHierarchyProperty(t,r){return Gr(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o],a=n.classIndexes[s],c=i.instances[r];return Ct(c)?Ct(c.typedArray)?this._getBinaryProperty(c,a):zo(c[a],!0):null})}_setHierarchyProperty(t,r,n,s){let o=Gr(this._hierarchy,r,(i,a)=>{let c=i.classIds[a],l=i.classes[c],f=i.classIndexes[a],u=l.instances[n];return Ct(u)?(H(a===r,`Inherited property "${n}" is read-only.`),Ct(u.typedArray)?this._setBinaryProperty(u,f,s):u[f]=zo(s,!0),!0):!1});return Ct(o)}};function Oe(e,t,r=0){let 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,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var Ur=4,og="b3dm tile in legacy format.";function Vr(e,t,r){let n=new DataView(t),s;e.header=e.header||{};let o=n.getUint32(r,!0);r+=Ur;let i=n.getUint32(r,!0);r+=Ur;let a=n.getUint32(r,!0);r+=Ur;let c=n.getUint32(r,!0);return r+=Ur,a>=570425344?(r-=Ur*2,s=o,a=i,c=0,o=0,i=0,console.warn(og)):c>=570425344&&(r-=Ur,s=a,a=o,c=i,o=0,i=0,console.warn(og)),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=i,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,r}function Hr(e,t,r,n){return r=kC(e,t,r,n),r=JC(e,t,r,n),r}function kC(e,t,r,n){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:o,batchLength:i}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:i||0},s&&s>0){let a=Uc(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function JC(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=Uc(t,r,s);e.batchTableJson=JSON.parse(i),r+=s,o&&o>0&&(e.batchTableBinary=new Uint8Array(t,r,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=o)}return r}function Wc(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:s,pointCount:o=0}=e;if(n&&r){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=n[a],f=r.getProperty(c,"dimensions").map(u=>u*255);i[a*3]=f[0],i[a*3+1]=f[1],i[a*3+2]=f[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}if(t&&s){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=jc(t[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return t&&t.length===o*3?{type:N.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:N.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var ig=new x;function ag(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let n=0;n<(e.pointsLength||0);n++)Xc(t[n*2],t[n*2+1],ig),ig.toArray(r,n*3);return{type:N.FLOAT,size:2,value:r}}return{type:N.FLOAT,size:2,value:t}}function cg(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,jC(e,t)):{type:N.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function jC(e,t){let r=new x,n=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)r.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,s*3);return n}async function lg(e,t,r,n,s){r=Oe(e,t,r),r=Vr(e,t,r),r=Hr(e,t,r,n),XC(e);let{featureTable:o,batchTable:i}=WC(e);return await $C(e,o,i,n,s),YC(e,o,n),KC(e,o,i),QC(e,o),r}function XC(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function WC(e){let t=new me(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",N.FLOAT,3);let n=ZC(e,t);return{featureTable:t,batchTable:n}}function YC(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",N.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=cg(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function KC(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",N.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",N.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",N.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Wc(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function QC(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",N.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",N.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=ag(e,r)}}function ZC(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",N.UNSIGNED_SHORT,1),e.batchIds)){let n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:o}=e;r=new cr(s,o,n)}return r}async function $C(e,t,r,n,s){let o,i,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){i=l.properties;let u=l.byteOffset,h=l.byteLength;if(!i||!Number.isFinite(u)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(e.featureTableBinary||[]).slice(u,u+h),e.hasPositions=Number.isFinite(i.POSITION),e.hasColors=Number.isFinite(i.RGB)||Number.isFinite(i.RGBA),e.hasNormals=Number.isFinite(i.NORMAL),e.hasBatchIds=Number.isFinite(i.BATCH_ID),e.isTranslucent=Number.isFinite(i.RGBA)}if(!o)return!0;let f={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await tS(e,f,n,s)}async function tS(e,t,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let o=await vt(t.buffer,Ho,s,n),i=o.attributes.POSITION&&o.attributes.POSITION.value,a=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,f=i&&o.attributes.POSITION.value.quantization,u=c&&o.attributes.NORMAL.value.quantization;if(f){let d=o.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}u&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let h={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(h[d.toLowerCase()]=o.attributes[d].value);e.attributes={positions:i,colors:Wc(e,a,void 0),normals:c,batchIds:l,...h}}var Yc={};pt(Yc,{createExtMeshFeatures:()=>AS,decode:()=>hS,encode:()=>dS,name:()=>uS});function lt(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var qo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ko={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var eS=1.33,fg=["SCALAR","VEC2","VEC3","VEC4"],rS=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],nS=new Map(rS),sS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},oS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},iS={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function Jo(e){return fg[e-1]||fg[0]}function Ne(e){let t=nS.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function zr(e,t){let r=iS[e.componentType],n=sS[e.type],s=oS[e.componentType],o=e.count*n,i=e.count*n*s;lt(i>=0&&i<=t.byteLength);let a=ko[e.componentType],c=qo[e.type];return{ArrayType:r,length:o,byteLength:i,componentByteSize:a,numberOfComponentsInElement:c}}function $n(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let n=t.map(i=>i.bufferView);r=r.filter(i=>!n.includes(i));let s=r.reduce((i,a)=>i+a.byteLength,0),o=t.reduce((i,a)=>{let{width:c,height:l}=a.image;return i+c*l},0);return s+Math.ceil(4*o*eS)}function ug(e,t,r){let n=e.bufferViews[r];lt(n);let s=n.buffer,o=t[s];lt(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function hg(e,t,r){let n=typeof r=="number"?e.accessors?.[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let s=e.bufferViews?.[n.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:o,byteOffset:i}=t[s.buffer],a=(i||0)+(n.byteOffset||0)+(s.byteOffset||0),{ArrayType:c,length:l,componentByteSize:f,numberOfComponentsInElement:u}=zr(n,s),h=f*u,d=s.byteStride||h;if(typeof s.byteStride>"u"||s.byteStride===h)return new c(o,a,l);let p=new c(l);for(let A=0;A<n.count;A++){let m=new c(o,a+A*d,u);p.set(m,A*u)}return p}function aS(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var q=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:t?.json||aS(),buffers:t?.buffers||[],images:t?.images||[]},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(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(s=>s===t),n=this.getRequiredExtensions().find(s=>s===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(s=>s===t),n=this.json.extensions||{};return r?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(n=>n===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let n=this.json[t]&&this.json[t][r];if(!n)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return n}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,n=this.gltf.buffers[r];lt(n);let s=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return hg(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),s=this.getBuffer(r.buffer).data,o=r.byteOffset||0;return new Uint8Array(s,o,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,n){return t.extensions=t.extensions||{},t.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(t,r,n){let s=t.extensions||{};s[r]=n}removeObjectExtension(t,r){let n=t?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(r)||s.push(r)}delete n[r]}addExtension(t,r={}){return lt(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return lt(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:n}=t;this.json.nodes=this.json.nodes||[];let s={mesh:r};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:s,mode:o=4}=t,a={primitives:[{attributes:this._addAttributes(r),mode:o}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let n={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(t,r){let n=$e(t),s=r||n?.mimeType,i={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t,r=0,n=this.byteLength){let s=t.byteLength;lt(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=Be(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:Jo(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let n=this.addBufferView(t),s={min:r.min,max:r.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,r.size));let o={size:r.size,componentType:Ne(t),count:Math.round(t.length/r.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(o,r))}addTexture(t){let{imageIndex:r}=t,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),s=0;for(let o of this.sourceBuffers||[])s=ja(o,n,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r],this.gltf.buffers=[{arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}]}_removeStringFromArray(t,r){let n=!0;for(;n;){let s=t.indexOf(r);s>-1?t.splice(s,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let s=t[n],o=this._getGltfAttributeName(n),i=this.addBinaryBuffer(s.value,s);r[o]=i}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.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 t}}_getAccessorMinMax(t,r){let n={min:null,max:null};if(t.length<r)return n;n.min=[],n.max=[];let s=t.subarray(0,r);for(let o of s)n.min.push(o),n.max.push(o);for(let o=r;o<t.length;o+=r)for(let i=0;i<r;i++)n.min[0+i]=Math.min(n.min[0+i],t[o+i]),n.max[0+i]=Math.max(n.max[0+i],t[o+i]);return n}};function dg(e){return(e%1+1)%1}var pg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},cS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},mg={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function ts(e,t){return mg[t]*pg[e]}function qr(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),o=kr(s,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function kr(e,t,r,n=1){let s=pg[t],o=cS[r],i=mg[r],a=n*s,c=a*i,l=e.buffer,f=e.byteOffset;return f%i!==0&&(l=new Uint8Array(l).slice(f,f+c).buffer,f=0),new o(l,f,a)}function Jr(e,t,r){let n=`TEXCOORD_${t.texCoord||0}`,s=r.attributes[n],o=e.getTypedArrayForAccessor(s),i=e.gltf.json,a=t.index,c=i.textures?.[a]?.source;if(typeof c<"u"){let l=i.images?.[c]?.mimeType,f=e.gltf.images?.[c];if(f&&typeof f.width<"u"){let u=[];for(let h=0;h<o.length;h+=2){let d=lS(f,l,o,h,t.channels);u.push(d)}return u}}return[]}function jo(e,t,r,n,s){if(!r?.length)return;let o=[];for(let f of r){let u=n.findIndex(h=>h===f);u===-1&&(u=n.push(f)-1),o.push(u)}let i=new Uint32Array(o),a=e.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,c=e.addBufferView(i,a,0),l=e.addAccessor(c,{size:1,componentType:Ne(i),count:i.length});s.attributes[t]=l}function lS(e,t,r,n,s=[0]){let o={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},i=r[n],a=r[n+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=fS(i,a,e,c),f=0;for(let u of s){let h=typeof u=="number"?Object.values(o)[u]:o[u],d=l+h.offset,p=Ln(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];f|=A<<h.shift}return f}function fS(e,t,r,n=1){let s=r.width,o=dg(e)*(s-1),i=Math.round(o),a=r.height,c=dg(t)*(a-1),l=Math.round(c),f=r.components?r.components:n;return(l*s+i)*f}function Xo(e,t,r,n,s){let o=[];for(let i=0;i<t;i++){let a=r[i],c=r[i+1]-r[i];if(c+a>n)break;let l=a/s,f=c/s;o.push(e.slice(l,l+f))}return o}function Wo(e,t,r){let n=[];for(let s=0;s<t;s++){let o=s*r;n.push(e.slice(o,o+r))}return n}function Yo(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let s=[],o=new TextDecoder("utf8"),i=0;for(let a=0;a<e;a++){let c=n[a+1]-n[a];if(c+i<=t.length){let l=t.subarray(i,c+i),f=o.decode(l);s.push(f),i+=c}}return s}return[]}var jr="EXT_mesh_features",uS=jr;async function hS(e,t){let r=new q(e);pS(r,t)}function dS(e,t){let r=new q(e);return gS(r,t),r.createBinaryChunk(),r.gltf}function pS(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)mS(e,s,t)}function mS(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[jr]?.featureIds;if(s)for(let o of s){let i;if(typeof o.attribute<"u"){let a=`_FEATURE_ID_${o.attribute}`,c=t.attributes[a];i=e.getTypedArrayForAccessor(c)}else typeof o.texture<"u"&&r?.gltf?.loadImages?i=Jr(e,o.texture,t):i=[];o.data=i}}function gS(e,t){let r=e.gltf.json.meshes;if(r)for(let n of r)for(let s of n.primitives)xS(e,s)}function AS(e,t,r,n){t.extensions||(t.extensions={});let s=t.extensions[jr];s||(s={featureIds:[]},t.extensions[jr]=s);let{featureIds:o}=s,i={featureCount:r.length,propertyTable:n,data:r};o.push(i),e.addObjectExtension(t,jr,s)}function xS(e,t){let r=t.extensions?.[jr];if(!r)return;let n=r.featureIds;n.forEach((s,o)=>{if(s.data){let{accessorKey:i,index:a}=yS(t.attributes),c=new Uint32Array(s.data);n[o]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a},e.gltf.buffers.push({arrayBuffer:c.buffer,byteOffset:c.byteOffset,byteLength:c.byteLength});let l=e.addBufferView(c),f=e.addAccessor(l,{size:1,componentType:Ne(c),count:c.length});t.attributes[i]=f}})}function yS(e){let t="_FEATURE_ID_",r=Object.keys(e).filter(o=>o.indexOf(t)===0),n=-1;for(let o of r){let i=Number(o.substring(t.length));i>n&&(n=i)}return n++,{accessorKey:`${t}${n}`,index:n}}var Zc={};pt(Zc,{createExtStructuralMetadata:()=>HS,decode:()=>ES,encode:()=>_S,name:()=>TS});var Xr="EXT_structural_metadata",TS=Xr;async function ES(e,t){let r=new q(e);MS(r,t)}function _S(e,t){let r=new q(e);return US(r,t),r.createBinaryChunk(),r.gltf}function MS(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(Xr);r&&(t.gltf?.loadImages&&bS(e,r),BS(e,r))}function bS(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let s of n.meshes)for(let o of s.primitives)SS(e,r,o,t)}function BS(e,t){let r=t.schema;if(!r)return;let n=r.classes,s=t.propertyTables;if(n&&s)for(let o in n){let i=CS(s,o);i&&wS(e,r,i)}}function CS(e,t){for(let r of e)if(r.class===t)return r;return null}function SS(e,t,r,n){if(!t)return;let o=r.extensions?.[Xr]?.propertyTextures;if(o)for(let i of o){let a=t[i];IS(e,a,r,n)}}function IS(e,t,r,n){if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){let i=`${s}_${o}`,a=t.properties?.[o];if(!a)continue;a.data||(a.data=[]);let c=a.data,l=Jr(e,a,r);l!==null&&(jo(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function wS(e,t,r){let n=t.classes?.[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let s=r.count;for(let o in n.properties){let i=n.properties[o],a=r.properties?.[o];if(a){let c=LS(e,t,i,s,a);a.data=c}}}function LS(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=vS(e,r,s,n),l=RS(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=FS(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=Yo(n,a,c,l);break}case"ENUM":{o=PS(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function vS(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?qr(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function RS(e,t,r){return typeof t.stringOffsets<"u"?qr(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function FS(e,t,r,n){let s=e.array,o=e.count,i=ts(e.type,e.componentType),a=r.byteLength/i,c;return e.componentType?c=kr(r,e.type,e.componentType,a):c=r,s?n?Xo(c,t,n,r.length,i):o?Wo(c,t,o):[]:c}function PS(e,t,r,n,s){let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let i=e.enums?.[o];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let a=i.valueType||"UINT16",c=ts(t.type,a),l=n.byteLength/c,f=kr(n,t.type,a,l);if(f||(f=n),t.array){if(s)return OS({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let u=t.count;return u?NS(f,r,u,i):[]}return Qc(f,0,r,i)}function OS(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:s,elementSize:o,enumEntry:i}=e,a=[];for(let c=0;c<r;c++){let l=n[c],f=n[c+1]-n[c];if(f+l>s)break;let u=l/o,h=f/o,d=Qc(t,u,h,i);a.push(d)}return a}function NS(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=Qc(e,i,r,n);s.push(a)}return s}function Qc(e,t,r,n){let s=[];for(let o=0;o<r;o++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let i=e[t+o],a=DS(n,i);a?s.push(a.name):s.push("")}return s}function DS(e,t){for(let r of e.values)if(r.value===t)return r;return null}var GS="schemaClassId";function US(e,t){let r=e.getExtension(Xr);if(r&&r.propertyTables)for(let n of r.propertyTables){let s=n.class,o=r.schema?.classes?.[s];n.properties&&o&&VS(n,o,e)}}function VS(e,t,r){for(let n in e.properties){let s=e.properties[n].data;if(s){let o=t.properties[n];if(o){let i=kS(s,o,r);e.properties[n]=i}}}}function HS(e,t,r=GS){let n=e.getExtension(Xr);n||(n=e.addExtension(Xr)),n.schema=zS(t,r,n.schema);let s=qS(t,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function zS(e,t,r){let n=r??{id:"schema_id"},s={properties:{}};for(let o of e){let i={type:o.elementType,componentType:o.componentType};s.properties[o.name]=i}return n.classes={},n.classes[t]=s,n}function qS(e,t,r){let n={class:t,count:0},s=0,o=r.classes?.[t];for(let i of e){if(s===0&&(s=i.values.length),s!==i.values.length&&i.values.length)throw new Error("Illegal values in attributes");o?.properties[i.name]&&(n.properties||(n.properties={}),n.properties[i.name]={values:0,data:i.values})}return n.count=s,n}function kS(e,t,r){let n={values:0};if(t.type==="STRING"){let{stringData:s,stringOffsets:o}=XS(e);n.stringOffsets=Kc(o,r),n.values=Kc(s,r)}else if(t.type==="SCALAR"&&t.componentType){let s=jS(e,t.componentType);n.values=Kc(s,r)}return n}var JS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function jS(e,t){let r=[];for(let s of e)r.push(Number(s));let n=JS[t];if(!n)throw new Error("Illegal component type");return new n(r)}function XS(e){let t=new TextEncoder,r=[],n=0;for(let c of e){let l=t.encode(c);n+=l.length,r.push(l)}let s=new Uint8Array(n),o=[],i=0;for(let c of r)s.set(c,i),o.push(i),i+=c.length;o.push(i);let a=new Uint32Array(o);return{stringData:s,stringOffsets:a}}function Kc(e,t){return t.gltf.buffers.push({arrayBuffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}),t.addBufferView(e)}var $c={};pt($c,{decode:()=>YS,name:()=>WS});var gg="EXT_feature_metadata",WS=gg;async function YS(e,t){let r=new q(e);KS(r,t)}function KS(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(gg);r&&(t.gltf?.loadImages&&QS(e,r),ZS(e,r))}function QS(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:s}=t;if(n&&s)for(let o in n){let i=n[o],a=tI(s,o);a&&rI(e,a,i)}}function ZS(e,t){let r=t.schema;if(!r)return;let n=r.classes,s=t.featureTables;if(n&&s)for(let o in n){let i=$S(s,o);i&&eI(e,r,i)}}function $S(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function tI(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function eI(e,t,r){if(!r.class)return;let n=t.classes?.[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let s=r.count;for(let o in n.properties){let i=n.properties[o],a=r.properties?.[o];if(a){let c=nI(e,t,i,s,a);a.data=c}}}function rI(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=cI(e,o,n);o.data=i}}}function nI(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=sI(e,r,s,n),l=oI(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=Yo(n,a,c,l):iI(r)&&(o=aI(r,n,a,c)),o}function sI(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?qr(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function oI(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?qr(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function iI(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function aI(e,t,r,n){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",a=e.componentType||e.type,c=ts(i,a),l=r.byteLength/c,f=kr(r,i,a,l);return s?n?Xo(f,t,n,r.length,c):o?Wo(f,t,o):[]:f}function cI(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let s=[];for(let o of n.meshes)for(let i of o.primitives)lI(e,r,t,s,i);return s}function lI(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=Jr(e,o,s);i&&jo(e,t,i,n,s)}var Ag="4.3.3";var xg="4.3.3";var Ko={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},yg;async function el(e){za(e.modules);let t=qa("basis");return t||(yg||=fI(e),await yg)}async function fI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Ko.TRANSCODER,"textures",e),await re(Ko.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await uI(t,r)}function uI(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(s=>{let{BasisFile:o,initializeBasis:i}=s;i(),n({BasisFile:o})})})}var tl;async function rl(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(tl=tl||hI(e),await tl)}async function hI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Ko.ENCODER,"textures",e),await re(Ko.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await dI(t,r)}function dI(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(s=>{let{BasisFile:o,KTX2File:i,initializeBasis:a,BasisEncoder:c}=s;a(),n({BasisFile:o,KTX2File:i,BasisEncoder:c})})})}var lr={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};var pI=["","WEBKIT_","MOZ_"],Tg={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"},Qo=null;function Eg(e){if(!Qo){e=e||mI()||void 0,Qo=new Set;for(let t of pI)for(let r in Tg)if(e&&e.getExtension(`${t}${r}`)){let n=Tg[r];Qo.add(n)}}return Qo}function mI(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Rt=[171,75,84,88,32,50,48,187,13,10,26,10];function _g(e){let t=new Uint8Array(e);return!(t.byteLength<Rt.length||t[0]!==Rt[0]||t[1]!==Rt[1]||t[2]!==Rt[2]||t[3]!==Rt[3]||t[4]!==Rt[4]||t[5]!==Rt[5]||t[6]!==Rt[6]||t[7]!==Rt[7]||t[8]!==Rt[8]||t[9]!==Rt[9]||t[10]!==Rt[10]||t[11]!==Rt[11])}var gI={etc1:{basisFormat:0,compressed:!0,format:lr.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:lr.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:lr.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:lr.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:lr.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:lr.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 bg(e,t){if(t.basis.containerFormat==="auto"){if(_g(e)){let n=await rl(t);return Mg(n.KTX2File,e,t)}let{BasisFile:r}=await el(t);return nl(r,e,t)}switch(t.basis.module){case"encoder":let r=await rl(t);switch(t.basis.containerFormat){case"ktx2":return Mg(r.KTX2File,e,t);case"basis":default:return nl(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await el(t);return nl(n,e,t)}}function nl(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let s=n.getNumImages(),o=[];for(let i=0;i<s;i++){let a=n.getNumLevels(i),c=[];for(let l=0;l<a;l++)c.push(AI(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function AI(e,t,r,n){let s=e.getImageWidth(t,r),o=e.getImageHeight(t,r),i=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Bg(n,i),f=e.getImageTranscodedSizeInBytes(t,r,l),u=new Uint8Array(f);if(!e.transcodeImage(u,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:u,compressed:a,format:c,hasAlpha:i}}function Mg(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=n.getLevels(),o=[];for(let i=0;i<s;i++)o.push(xI(n,i,r));return[o]}finally{n.close(),n.delete()}}function xI(e,t,r){let{alphaFlag:n,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:a,basisFormat:c}=Bg(r,n),l=e.getImageTranscodedSizeInBytes(t,0,0,c),f=new Uint8Array(l);if(!e.transcodeImage(f,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:s,data:f,compressed:i,levelSize:l,hasAlpha:n,format:a}}function Bg(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=Zo()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),gI[r]}function Zo(){let e=Eg();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"}var Cg={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:xg,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"}}},sl={...Cg,parse:bg};var Wr=!0,Sg=1735152710,al=12,$o=8,yI=1313821514,TI=5130562,EI=0,_I=0,MI=1;function bI(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))}`}function Ig(e,t=0,r={}){let n=new DataView(e),{magic:s=Sg}=r,o=n.getUint32(t,!1);return o===s||o===Sg}function wg(e,t,r=0,n={}){let s=new DataView(t),o=bI(s,r+0),i=s.getUint32(r+4,Wr),a=s.getUint32(r+8,Wr);switch(Object.assign(e,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=al,e.version){case 1:return BI(e,s,r);case 2:return CI(e,s,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function BI(e,t,r){H(e.header.byteLength>al+$o);let n=t.getUint32(r+0,Wr),s=t.getUint32(r+4,Wr);return r+=$o,H(s===EI),ol(e,t,r,n),r+=n,r+=il(e,t,r,e.header.byteLength),r}function CI(e,t,r,n){return H(e.header.byteLength>al+$o),SI(e,t,r,n),r+e.header.byteLength}function SI(e,t,r,n){for(;r+8<=e.header.byteLength;){let s=t.getUint32(r+0,Wr),o=t.getUint32(r+4,Wr);switch(r+=$o,o){case yI:ol(e,t,r,s);break;case TI:il(e,t,r,s);break;case _I:n.strict||ol(e,t,r,s);break;case MI:n.strict||il(e,t,r,s);break;default:break}r+=Be(s,4)}return r}function ol(e,t,r,n){let s=new Uint8Array(t.buffer,r,n),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),Be(n,4)}function il(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),Be(n,4)}function cl(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let n=t.baseUri||t.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return n.substr(0,n.lastIndexOf("/")+1)+e}var fl={};pt(fl,{decode:()=>UI,name:()=>GI});var II="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",wI="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",LI=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]),vI=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]),RI={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},FI={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Lg(e,t,r,n,s,o="NONE"){let i=await PI();DI(i,i.exports[FI[s]],e,t,r,n,i.exports[RI[o||"NONE"]])}var ll;async function PI(){return ll||(ll=OI()),ll}async function OI(){let e=II;WebAssembly.validate(LI)&&(e=wI,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(NI(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function NI(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let s=e.charCodeAt(n);t[n]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?vI[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function DI(e,t,r,n,s,o,i){let a=e.exports.sbrk,c=n+3&-4,l=a(c*s),f=a(o.length),u=new Uint8Array(e.exports.memory.buffer);u.set(o,f);let h=t(l,n,s,f,o.length);if(h===0&&i&&i(l,c,s),r.set(u.subarray(l,l+n*s)),a(l-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var ti="EXT_meshopt_compression",GI=ti;async function UI(e,t){let r=new q(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let n=[];for(let s of e.json.bufferViews||[])n.push(VI(r,s));await Promise.all(n),r.removeExtension(ti)}async function VI(e,t){let r=e.getObjectExtension(t,ti);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,f=e.gltf.buffers[l],u=new Uint8Array(f.arrayBuffer,f.byteOffset+n,s),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await Lg(h,i,o,u,a,c),e.removeObjectExtension(t,ti)}}var ul={};pt(ul,{name:()=>HI,preprocess:()=>zI});var Yr="EXT_texture_webp",HI=Yr;function zI(e,t){let r=new q(e);if(!nc("image/webp")){if(r.getRequiredExtensions().includes(Yr))throw new Error(`gltf: Required extension ${Yr} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Yr);o&&(s.source=o.source),r.removeObjectExtension(s,Yr)}r.removeExtension(Yr)}var hl={};pt(hl,{name:()=>qI,preprocess:()=>kI});var ei="KHR_texture_basisu",qI=ei;function kI(e,t){let r=new q(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,ei);o&&(s.source=o.source,r.removeObjectExtension(s,ei))}r.removeExtension(ei)}var pl={};pt(pl,{decode:()=>YI,encode:()=>KI,name:()=>XI,preprocess:()=>WI});function vg(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let s=dl(n);t[r]=s}}return t}function dl(e){let{buffer:t,size:r,count:n}=JI(e);return{value:t,size:r,byteOffset:0,count:n,type:Jo(r),componentType:Ne(t)}}function JI(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=jI(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function jI(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var De="KHR_draco_mesh_compression",XI=De;function WI(e,t,r){let n=new q(e);for(let s of Rg(n))n.getObjectExtension(s,De)}async function YI(e,t,r){if(!t?.gltf?.decompressMeshes)return;let n=new q(e),s=[];for(let o of Rg(n))n.getObjectExtension(o,De)&&s.push(QI(n,o,t,r));await Promise.all(s),n.removeExtension(De)}function KI(e,t={}){let r=new q(e);for(let n of r.json.meshes||[])ZI(n,t),r.addRequiredExtension(De)}async function QI(e,t,r,n){let s=e.getObjectExtension(t,De);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Ye(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await vt(i,Ho,a,n),l=vg(c.attributes);for(let[f,u]of Object.entries(l))if(f in t.attributes){let h=t.attributes[f],d=e.getAccessor(h);d?.min&&d?.max&&(u.min=d.min,u.max=d.max)}t.attributes=l,c.indices&&(t.indices=dl(c.indices)),e.removeObjectExtension(t,De),$I(t)}function ZI(e,t,r=4,n,s){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=n.DracoWriter.encodeSync({attributes:e}),i=s?.parseSync?.({attributes:e}),a=n._addFauxAttributes(i.attributes),c=n.addBufferView(o);return{primitives:[{attributes:a,mode:r,extensions:{[De]:{bufferView:c,attributes:a}}}]}}function $I(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Rg(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var ml={};pt(ml,{decode:()=>n2,name:()=>t2});var ni="KHR_texture_transform",t2=ni,ri=new x,e2=new J,r2=new J;async function n2(e,t){if(!new q(e).hasExtension(ni)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)s2(o,e)}function s2(e,t){let r=t.json.materials?.[e],n=[r?.pbrMetallicRoughness?.baseColorTexture,r?.emissiveTexture,r?.normalTexture,r?.occlusionTexture,r?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let o of n)o&&o?.extensions?.[ni]&&o2(t,e,o,s)}function o2(e,t,r,n){let s=i2(r,n);if(!s)return;let o=e.json.meshes||[];for(let i of o)for(let a of i.primitives){let c=a.material;Number.isFinite(c)&&t===c&&a2(e,a,s)}}function i2(e,t){let r=e.extensions?.[ni],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=f2(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function a2(e,t,r){let{originalTexCoord:n,texCoord:s,matrix:o}=r,i=t.attributes[`TEXCOORD_${n}`];if(Number.isFinite(i)){let a=e.json.accessors?.[i];if(a&&a.bufferView){let c=e.json.bufferViews?.[a.bufferView];if(c){let{arrayBuffer:l,byteOffset:f}=e.buffers[c.buffer],u=(f||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:h,length:d}=zr(a,c),p=ko[a.componentType],A=qo[a.type],m=c.byteStride||p*A,y=new Float32Array(d);for(let _=0;_<a.count;_++){let E=new h(l,u+_*m,2);ri.set(E[0],E[1],1),ri.transformByMatrix3(o),y.set([ri[0],ri[1]],_*A)}n===s?c2(a,c,e.buffers,y):l2(s,a,t,e,y)}}}}function c2(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}function l2(e,t,r,n,s){n.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let o=n.json.bufferViews;if(!o)return;o.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let i=n.json.accessors;i&&(i.push({bufferView:o?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=i.length-1)}function f2(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,s=new J().set(1,0,0,0,1,0,t[0],t[1],1),o=e2.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=r2.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var gl={};pt(gl,{decode:()=>h2,encode:()=>d2,name:()=>u2});var fr="KHR_lights_punctual",u2=fr;async function h2(e){let t=new q(e),{json:r}=t,n=t.getExtension(fr);n&&(t.json.lights=n.lights,t.removeExtension(fr));for(let s of r.nodes||[]){let o=t.getObjectExtension(s,fr);o&&(s.light=o.light),t.removeObjectExtension(s,fr)}}async function d2(e){let t=new q(e),{json:r}=t;if(r.lights){let n=t.addExtension(fr);lt(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let s=n.node;t.addObjectExtension(s,fr,n)}delete t.json.lights}}var Al={};pt(Al,{decode:()=>m2,encode:()=>g2,name:()=>p2});var es="KHR_materials_unlit",p2=es;async function m2(e){let t=new q(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,es);t.removeExtension(es)}function g2(e){let t=new q(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,es,{}),t.addExtension(es))}var xl={};pt(xl,{decode:()=>x2,encode:()=>y2,name:()=>A2});var rs="KHR_techniques_webgl",A2=rs;async function x2(e){let t=new q(e),{json:r}=t,n=t.getExtension(rs);if(n){let s=T2(n,t);for(let o of r.materials||[]){let i=t.getObjectExtension(o,rs);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=E2(o.technique,t)),t.removeObjectExtension(o,rs)}t.removeExtension(rs)}}async function y2(e,t){}function T2(e,t){let{programs:r=[],shaders:n=[],techniques:s=[]}=e,o=new TextDecoder;return n.forEach(i=>{if(Number.isFinite(i.bufferView))i.code=o.decode(t.getTypedArrayForBufferView(i.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(i=>{i.fragmentShader=n[i.fragmentShader],i.vertexShader=n[i.vertexShader]}),s.forEach(i=>{i.program=r[i.program]}),s}function E2(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(n=>{e.uniforms[n].value&&!(n in r)&&(r[n]=e.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=t.getTexture(r[n].index))}),r}var Fg=[Zc,Yc,fl,ul,hl,pl,gl,Al,xl,ml,$c];function Pg(e,t={},r){let n=Fg.filter(s=>Ng(s.name,t));for(let s of n)s.preprocess?.(e,t,r)}async function Og(e,t={},r){let n=Fg.filter(s=>Ng(s.name,t));for(let s of n)await s.decode?.(e,t,r)}function Ng(e,t){let r=t?.gltf?.excludeExtensions||{};return!(e in r&&!r[e])}var yl="KHR_binary_glTF";function Dg(e){let t=new q(e),{json:r}=t;for(let n of r.images||[]){let s=t.getObjectExtension(n,yl);s&&Object.assign(n,s),t.removeObjectExtension(n,yl)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(yl)}var Gg={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},M2={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Tl=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,r){this.json=t.json;let n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.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(n),this._convertTopLevelObjectsToArrays(n),Dg(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in Gg)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let s in n){let o=n[s];o.id=o.id||s;let i=t[r].length;t[r].push(o),this.idToIndexMap[r][s]=i}}}_convertObjectIdsToArrayIndices(t){for(let r in Gg)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:n,indices:s,material:o}=r;for(let i in n)n[i]=this._convertIdToIndex(n[i],"accessor");s&&(r.indices=this._convertIdToIndex(s,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let n of t[r])for(let s in n){let o=n[s],i=this._convertIdToIndex(o,s);n[s]=i}}_convertIdToIndex(t,r){let n=M2[r];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return s}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){for(let r of t.materials){r.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let n=r.values?.tex||r.values?.texture2d_0||r.values?.diffuseTex,s=t.textures.findIndex(o=>o.id===n);s!==-1&&(r.pbrMetallicRoughness.baseColorTexture={index:s})}}};function Ug(e,t={}){return new Tl().normalize(e,t)}async function Vg(e,t,r=0,n,s){return b2(e,t,r,n),Ug(e,{normalize:n?.gltf?.normalize}),Pg(e,n,s),n?.gltf?.loadBuffers&&e.json.buffers&&await B2(e,n,s),n?.gltf?.loadImages&&await C2(e,n,s),await Og(e,n,s),e}function b2(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!Ig(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=Ja(t);else if(t instanceof ArrayBuffer){let i={};r=wg(i,t,r,n.glb),lt(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else lt(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:i}=e._glb;e.buffers[0]={arrayBuffer:i[0].arrayBuffer,byteOffset:i[0].byteOffset,byteLength:i[0].byteLength}}let o=e.json.images||[];e.images=new Array(o.length).fill({})}async function B2(e,t,r){let n=e.json.buffers||[];for(let s=0;s<n.length;++s){let o=n[s];if(o.uri){let{fetch:i}=r;lt(i);let a=cl(o.uri,t),l=await(await r?.fetch?.(a))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete o.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(o.byteLength),byteOffset:0,byteLength:o.byteLength})}}async function C2(e,t,r){let n=S2(e),s=e.json.images||[],o=[];for(let i of n)o.push(I2(e,s[i],i,t,r));return await Promise.all(o)}function S2(e){let t=new Set,r=e.json.textures||[];for(let n of r)n.source!==void 0&&t.add(n.source);return Array.from(t).sort()}async function I2(e,t,r,n,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=cl(t.uri,n),{fetch:c}=s;o=await(await c(a)).arrayBuffer(),t.bufferView={data:o}}if(Number.isFinite(t.bufferView)){let a=ug(e.json,e.buffers,t.bufferView);o=Ye(a.buffer,a.byteOffset,a.byteLength)}lt(o,"glTF image has no data");let i=await vt(o,[Rr,sl],{...n,mimeType:t.mimeType,basis:n.basis||{format:Zo()}},s);i&&i[0]&&(i={compressed:!0,mipmaps:!1,width:i[0].width,height:i[0].height,data:i[0]}),e.images=e.images||[],e.images[r]=i}var ur={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:Ag,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:w2,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function w2(e,t={},r){t={...ur.options,...t},t.gltf={...ur.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Vg({},e,n,t,r)}var L2={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},v2={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ut={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},R2={magFilter:Ut.TEXTURE_MAG_FILTER,minFilter:Ut.TEXTURE_MIN_FILTER,wrapS:Ut.TEXTURE_WRAP_S,wrapT:Ut.TEXTURE_WRAP_T},F2={[Ut.TEXTURE_MAG_FILTER]:Ut.LINEAR,[Ut.TEXTURE_MIN_FILTER]:Ut.NEAREST_MIPMAP_LINEAR,[Ut.TEXTURE_WRAP_S]:Ut.REPEAT,[Ut.TEXTURE_WRAP_T]:Ut.REPEAT};function P2(){return{id:"default-sampler",parameters:F2}}function O2(e){return v2[e]}function N2(e){return L2[e]}var El=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return lt(n),this.baseUri=i,this.buffers=s,this.images=o,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let n={...t};return this.json=n,t.bufferViews&&(n.bufferViews=t.bufferViews.map((s,o)=>this._resolveBufferView(s,o))),t.images&&(n.images=t.images.map((s,o)=>this._resolveImage(s,o))),t.samplers&&(n.samplers=t.samplers.map((s,o)=>this._resolveSampler(s,o))),t.textures&&(n.textures=t.textures.map((s,o)=>this._resolveTexture(s,o))),t.accessors&&(n.accessors=t.accessors.map((s,o)=>this._resolveAccessor(s,o))),t.materials&&(n.materials=t.materials.map((s,o)=>this._resolveMaterial(s,o))),t.meshes&&(n.meshes=t.meshes.map((s,o)=>this._resolveMesh(s,o))),t.nodes&&(n.nodes=t.nodes.map((s,o)=>this._resolveNode(s,o)),n.nodes=n.nodes.map((s,o)=>this._resolveNodeChildren(s))),t.skins&&(n.skins=t.skins.map((s,o)=>this._resolveSkin(s,o))),t.scenes&&(n.scenes=t.scenes.map((s,o)=>this._resolveScene(s,o))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let n=t&&t[r];return n||console.warn(`glTF file error: Could not find ${t}[${r}]`),n}_resolveScene(t,r){return{...t,id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(t,r){let n={...t,id:t?.id||`node-${r}`};return t.mesh!==void 0&&(n.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(n.camera=this.getCamera(t.camera)),t.skin!==void 0&&(n.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(n.mesh=t.meshes.reduce((s,o)=>{let i=this.getMesh(o);return s.id=i.id,s.primitives=s.primitives.concat(i.primitives),s},{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let n=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(t,r){let n={...t,id:t.id||`mesh-${r}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map(s=>{let o={...s,attributes:{},indices:void 0,material:void 0},i=s.attributes;for(let a in i)o.attributes[a]=this.getAccessor(i[a]);return s.indices!==void 0&&(o.indices=this.getAccessor(s.indices)),s.material!==void 0&&(o.material=this.getMaterial(s.material)),o})),n}_resolveMaterial(t,r){let n={...t,id:t.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let s=n.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=O2(t.componentType),s=N2(t.type),o=n*s,i={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:s,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(i.bufferView=this.getBufferView(t.bufferView)),i.bufferView){let a=i.bufferView.buffer,{ArrayType:c,byteLength:l}=zr(i,i.bufferView),f=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,u=a.arrayBuffer.slice(f,f+l);i.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(a,f,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(u)}return i}_getValueFromInterleavedBuffer(t,r,n,s,o){let i=new Uint8Array(o*s);for(let a=0;a<o;a++){let c=r+a*n;i.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return i.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):P2(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,r){let n={id:t.id||`sampler-${r}`,...t,parameters:{}};for(let s in n){let o=this._enumSamplerParameter(s);o!==void 0&&(n.parameters[o]=n[s])}return n}_enumSamplerParameter(t){return R2[t]}_resolveImage(t,r){let n={...t,id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[r];return s&&(n.image=s),n}_resolveBufferView(t,r){let n=t.buffer,s=this.buffers[n].arrayBuffer,o=this.buffers[n].byteOffset||0;return t.byteOffset&&(o+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(s,o,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function ns(e,t){return new El().postProcess(e,t)}var si={URI:0,EMBEDDED:1};function oi(e,t,r,n){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-r;if(s===0)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=Ye(t,r,s),e.gltfByteOffset=0,e.gltfByteLength=s,r%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function ii(e,t,r,n){let s=r?.["3d-tiles"]||{};if(D2(e,t,r),s.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:o}=n,i=await o(e.gltfUrl,r);e.gltfArrayBuffer=await i.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let o=await vt(e.gltfArrayBuffer,ur,r,n);e.gltf=ns(o),e.gpuMemoryUsageInBytes=$n(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function D2(e,t,r){switch(t){case si.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),o=new TextDecoder().decode(n);e.gltfUrl=o.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case si.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Hg(e,t,r,n,s){r=G2(e,t,r,n,s),await ii(e,si.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function G2(e,t,r,n,s){r=Oe(e,t,r),r=Vr(e,t,r),r=Hr(e,t,r,n),r=oi(e,t,r,n);let o=new me(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",N.FLOAT,3),r}async function zg(e,t,r,n,s){return r=U2(e,t,r,n,s),await ii(e,e.gltfFormat||0,n,s),r}function U2(e,t,r,n,s){if(r=Oe(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=Vr(e,t,r);let o=new DataView(t);if(e.gltfFormat=o.getUint32(r,!0),r+=4,r=Hr(e,t,r,n),r=oi(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new me(e.featureTableJson,e.featureTableBinary),a=i.getGlobalProperty("INSTANCES_LENGTH");if(i.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=i.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=i.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let c=new cr(e.batchTableJson,e.batchTableBinary,a);return V2(e,i,c,a),r}function V2(e,t,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new J,f=new $t,u=new x,h={},d=new O,p=[],A=[],m=[],y=[];for(let _=0;_<n;_++){let E;if(t.hasProperty("POSITION"))E=t.getProperty("POSITION",N.FLOAT,3,_,o);else if(t.hasProperty("POSITION_QUANTIZED")){E=t.getProperty("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3,_,o);let g=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let S=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3);if(!S)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let R=65535;for(let F=0;F<3;F++)E[F]=E[F]/R*S[F]+g[F]}if(!E)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(E),h.translation=o,e.normalUp=t.getProperty("NORMAL_UP",N.FLOAT,3,_,p),e.normalRight=t.getProperty("NORMAL_RIGHT",N.FLOAT,3,_,A);let M=!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",N.UNSIGNED_SHORT,2,_,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",N.UNSIGNED_SHORT,2,_,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(o,d),d.getRotationMatrix3(l)):l.identity()}M&&(c.copy(i).cross(a).normalize(),l.setColumn(0,i),l.setColumn(1,a),l.setColumn(2,c)),f.fromMatrix3(l),h.rotation=f,u.set(1,1,1);let B=t.getProperty("SCALE",N.FLOAT,1,_,m);Number.isFinite(B)&&u.multiplyByScalar(B);let C=t.getProperty("SCALE_NON_UNIFORM",N.FLOAT,3,_,p);C&&u.scale(C),h.scale=u;let L=t.getProperty("BATCH_ID",N.UNSIGNED_SHORT,1,_,y);L===void 0&&(L=_);let b=new O().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(b),d.scale(h.scale);let T=d.clone();s[_]={modelMatrix:T,batchId:L}}e.instances=s}async function qg(e,t,r,n,s,o){r=Oe(e,t,r);let i=new DataView(t);for(e.tilesLength=i.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let a={shape:"tile3d"};e.tiles.push(a),r=await o(t,r,n,s,a)}return r}async function kg(e,t,r,n){if(e.rotateYtoZ=!0,e.gltfUpAxis=r?.["3d-tiles"]?.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r?.["3d-tiles"]?.loadGLTF){if(!n)return t.byteLength;let s=await vt(t,ur,r,n);e.gltf=ns(s),e.gpuMemoryUsageInBytes=$n(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function _l(e,t=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=zm(e,t),s.type){case ir.COMPOSITE:return await qg(s,e,t,r,n,_l);case ir.BATCHED_3D_MODEL:return await Hg(s,e,t,r,n);case ir.GLTF:return await kg(s,e,r,n);case ir.INSTANCED_3D_MODEL:return await zg(s,e,t,r,n);case ir.POINT_CLOUD:return await lg(s,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Ml(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let o=Jg(e.slice(8,16)),i=new Uint8Array(e,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),f=Jg(e.slice(16,24)),u=new ArrayBuffer(0);if(f&&(u=e.slice(24+o)),await ai(l,l.tileAvailability,u,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await ai(l,h,u,r);else await ai(l,l.contentAvailability,u,r);return await ai(l,l.childSubtreeAvailability,u,r),l}async function ai(e,t,r,n){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let o=e.bufferViews[s],i=e.buffers[o.buffer];if(!n?.baseUrl)throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(i.uri){let c=`${n?.baseUrl||""}/${i.uri}`,f=await(await n.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(f,o.byteOffset,o.byteLength);return}let a=e.buffers.slice(0,o.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(a,a+i.byteLength),o.byteOffset,o.byteLength)}function Jg(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var ci={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Vo,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Ml,options:{}};var d0=D(Or(),1);var l0=D(Or(),1);var Vt=null;try{Vt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Z(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Z.prototype.__isLong__;Object.defineProperty(Z.prototype,"__isLong__",{value:!0});function xt(e){return(e&&e.__isLong__)===!0}function jg(e){var t=Math.clz32(e&-e);return e?31-t:t}Z.isLong=xt;var Xg={},Wg={};function hr(e,t){var r,n,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(n=Wg[e],n)?n:(r=k(e,0,!0),s&&(Wg[e]=r),r)):(e|=0,(s=-128<=e&&e<128)&&(n=Xg[e],n)?n:(r=k(e,e<0?-1:0,!1),s&&(Xg[e]=r),r))}Z.fromInt=hr;function Ht(e,t){if(isNaN(e))return t?ge:Yt;if(t){if(e<0)return ge;if(e>=Zg)return e0}else{if(e<=-Kg)return St;if(e+1>=Kg)return t0}return e<0?Ht(-e,t).neg():k(e%Qr|0,e/Qr|0,t)}Z.fromNumber=Ht;function k(e,t,r){return new Z(e,t,r)}Z.fromBits=k;var li=Math.pow;function Bl(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?ge:Yt;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return Bl(e.substring(1),t,r).neg();for(var s=Ht(li(r,8)),o=Yt,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),c=parseInt(e.substring(i,i+a),r);if(a<8){var l=Ht(li(r,a));o=o.mul(l).add(Ht(c))}else o=o.mul(s),o=o.add(Ht(c))}return o.unsigned=t,o}Z.fromString=Bl;function Kt(e,t){return typeof e=="number"?Ht(e,t):typeof e=="string"?Bl(e,t):k(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Z.fromValue=Kt;var Yg=1<<16,H2=1<<24,Qr=Yg*Yg,Zg=Qr*Qr,Kg=Zg/2,Qg=hr(H2),Yt=hr(0);Z.ZERO=Yt;var ge=hr(0,!0);Z.UZERO=ge;var Kr=hr(1);Z.ONE=Kr;var $g=hr(1,!0);Z.UONE=$g;var bl=hr(-1);Z.NEG_ONE=bl;var t0=k(-1,2147483647,!1);Z.MAX_VALUE=t0;var e0=k(-1,-1,!0);Z.MAX_UNSIGNED_VALUE=e0;var St=k(0,-2147483648,!1);Z.MIN_VALUE=St;var I=Z.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Qr+(this.low>>>0):this.high*Qr+(this.low>>>0)};I.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(St)){var r=Ht(t),n=this.div(r),s=n.mul(r).sub(this);return n.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var o=Ht(li(t,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,f=l.toString(t);if(i=c,i.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(St)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(t){return xt(t)||(t=Kt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(xt(t)||(t=Kt(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(St)?St:this.not().add(Kr)};I.neg=I.negate;I.add=function(t){xt(t)||(t=Kt(t));var r=this.high>>>16,n=this.high&65535,s=this.low>>>16,o=this.low&65535,i=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,f=0,u=0,h=0,d=0;return d+=o+l,h+=d>>>16,d&=65535,h+=s+c,u+=h>>>16,h&=65535,u+=n+a,f+=u>>>16,u&=65535,f+=r+i,f&=65535,k(h<<16|d,f<<16|u,this.unsigned)};I.subtract=function(t){return xt(t)||(t=Kt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(xt(t)||(t=Kt(t)),Vt){var r=Vt.mul(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ge:Yt;if(this.eq(St))return t.isOdd()?St:Yt;if(t.eq(St))return this.isOdd()?St:Yt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(Qg)&&t.lt(Qg))return Ht(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,s=this.high&65535,o=this.low>>>16,i=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,f=t.low&65535,u=0,h=0,d=0,p=0;return p+=i*f,d+=p>>>16,p&=65535,d+=o*f,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*f,u+=h>>>16,h&=65535,h+=o*l,u+=h>>>16,h&=65535,h+=i*c,u+=h>>>16,h&=65535,u+=n*f+s*l+o*c+i*a,u&=65535,k(d<<16|p,u<<16|h,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(xt(t)||(t=Kt(t)),t.isZero())throw Error("division by zero");if(Vt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Vt.div_u:Vt.div_s)(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ge:Yt;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ge;if(t.gt(this.shru(1)))return $g;o=ge}else{if(this.eq(St)){if(t.eq(Kr)||t.eq(bl))return St;if(t.eq(St))return Kr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(Yt)?t.isNegative()?Kr:bl:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(St))return this.unsigned?ge:Yt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=Yt}for(s=this;s.gte(t);){n=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:li(2,a-48),l=Ht(n),f=l.mul(t);f.isNegative()||f.gt(s);)n-=c,l=Ht(n,this.unsigned),f=l.mul(t);l.isZero()&&(l=Kr),o=o.add(l),s=s.sub(f)}return o};I.div=I.divide;I.modulo=function(t){if(xt(t)||(t=Kt(t)),Vt){var r=(this.unsigned?Vt.rem_u:Vt.rem_s)(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return k(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?jg(this.low):jg(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return xt(t)||(t=Kt(t)),k(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return xt(t)||(t=Kt(t)),k(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return xt(t)||(t=Kt(t)),k(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):k(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):k(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?k(this.high,0,this.unsigned):k(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var r;return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?k(this.high,this.low,this.unsigned):t<32?(r=32-t,k(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,k(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var r;return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?k(this.high,this.low,this.unsigned):t<32?(r=32-t,k(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,k(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?k(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:k(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Z.fromBytes=function(t,r,n){return n?Z.fromBytesLE(t,r):Z.fromBytesBE(t,r)};Z.fromBytesLE=function(t,r){return new Z(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Z.fromBytesBE=function(t,r){return new Z(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var Zr=Z;var z2=16;function ss(e){e==="X"&&(e="");let t=e.padEnd(z2,"0");return Zr.fromString(t,!0,16)}function Cl(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function Sl(e,t){let r=q2(e).shiftRightUnsigned(2);return e.add(Zr.fromNumber(2*t+1-4).multiply(r))}function q2(e){return e.and(e.not().add(1))}var k2=3,J2=30,j2=2*J2+1,r0=180/Math.PI;function s0(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1],s=n.length,o=0,i=[0,0];for(let a=s-1;a>=0;a--){o=s-a;let c=n[a],l=0,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);X2(u,i,l,f),i[0]+=u*l,i[1]+=u*f}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}function o0(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<k2+j2;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=Zr.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=Zr.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function Il(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function n0(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function wl(e){return[n0(e[0]),n0(e[1])]}function Ll(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function vl([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*r0,n*r0]}function X2(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function i0(e){let t=Il(e.ij,e.level,[.5,.5]),r=wl(t),n=Ll(e.face,r);return vl(n)}var W2=100;function Rl(e){let{face:t,ij:r,level:n}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(W2*Math.pow(2,-n))),i=new Float64Array(4*o*2+2),a=0,c=0;for(let l=0;l<4;l++){let f=s[l].slice(0),u=s[l+1],h=(u[0]-f[0])/o,d=(u[1]-f[1])/o;for(let p=0;p<o;p++){f[0]+=h,f[1]+=d;let A=Il(r,n,f),m=wl(A),y=Ll(t,m),_=vl(y);Math.abs(_[1])>89.999&&(_[0]=c);let E=_[0]-c;_[0]+=E>180?-360:E<-180?360:0,i[a++]=_[0],i[a++]=_[1],c=_[0]}}return i[a++]=i[0],i[a++]=i[1],i}function $r(e){let t=Y2(e);return s0(t)}function Y2(e){if(e.indexOf("/")>0)return e;let t=ss(e);return o0(t)}function Fl(e){let t=$r(e);return i0(t)}function c0(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let s=0;s<4;s++){let o=`${e.face}/${s}`,i=$r(o),a=Rl(i);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}t=a0(r)}else{let r=Rl(e);t=a0(r)}return t}function a0(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],r=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),r.push(e[n+1]);return t.sort((n,s)=>n-s),r.sort((n,s)=>n-s),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function Pl(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=$r(e),o=c0(s),i=o.west,a=o.south,c=o.east,l=o.north,f=[];return f.push(new x(i,l,r)),f.push(new x(c,l,r)),f.push(new x(c,a,r)),f.push(new x(i,a,r)),f.push(new x(i,l,n)),f.push(new x(c,l,n)),f.push(new x(c,a,n)),f.push(new x(i,a,n)),f}function fi(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=Pl(t,r),s=Fl(t),o=s[0],i=s[1],a=U.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=Gn(n);return[...l.center,...l.halfAxes]}var K2=4,Q2=8,Z2={QUADTREE:K2,OCTREE:Q2};function $2(e,t,r){if(e?.box){let n=ss(e.s2VolumeInfo.token),s=Sl(n,t),o=Cl(s),i={...e.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=e.s2VolumeInfo,f=l.maximumHeight-l.minimumHeight,u=f/2,h=l.minimumHeight+f/2;l.minimumHeight=h-u,l.maximumHeight=h+u;break;default:break}return{box:fi(i),s2VolumeInfo:i}}}async function Nl(e){let{subtree:t,subtreeData:r={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:s=0,implicitOptions:o,loaderOptions:i,s2VolumeBox:a}=e,{subdivisionScheme:c,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:u,subtreesUriTemplate:h,basePath:d}=o,p={children:[],lodMetricValue:0,contentUrl:""};if(!f)return Ga.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${u} won't be loaded...`),p;let A=n.localLevel+1,m=r.level+A;if(m>f)return p;let y=Z2[c],_=Math.log2(y),E=s&1,M=s>>1&1,B=s>>2&1,C=dr(n.localX,E,1),L=dr(n.localY,M,1),b=dr(n.localZ,B,1),T=dr(r.x,C,A),g=dr(r.y,L,A),S=dr(r.z,b,A),R=dr(n.mortonIndex,s,_),F=A===l&&Ol(t.childSubtreeAvailability,R),v,G,X,z;if(F){let Y=`${d}/${h}`,$=ui(Y,m,T,g,S);v=await(0,l0.load)($,ci,i),z=0,G={level:m,x:T,y:g,z:S},X={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else v=t,z=(y**A-1)/(y-1)+R,G=r,X={mortonIndex:R,localLevel:A,localX:C,localY:L,localZ:b};if(!Ol(v.tileAvailability,z))return p;Ol(v.contentAvailability,z)&&(p.contentUrl=ui(u,m,T,g,S));for(let Y=0;Y<y;Y++){let $=$2(a,Y,c),bt=await Nl({subtree:v,subtreeData:G,parentData:X,childIndex:Y,implicitOptions:o,loaderOptions:i,s2VolumeBox:$});(bt.contentUrl||bt.children.length)&&p.children.push(bt)}return p.contentUrl||p.children.length?tw(p,{level:m,x:T,y:g,z:S},o,a):p}function Ol(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&Ga.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?nw(t,r.explicitBitstream):!1}function tw(e,t,r,n){let{basePath:s,refine:o,getRefine:i,lodMetricType:a,getTileType:c,rootLodMetricValue:l,rootBoundingVolume:f}=r,u=e.contentUrl&&e.contentUrl.replace(`${s}/`,""),h=l/2**t.level,d=n?.box?{box:n.box}:f,p=ew(d,t,r.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:u},id:e.contentUrl,refine:i(o),type:c(e),lodMetricType:a,lodMetricValue:h,geometricError:h,transform:e.transform,boundingVolume:p}}function ew(e,t,r){if(e.region){let{level:n,x:s,y:o,z:i}=t,[a,c,l,f,u,h]=e.region,d=2**n,p=(l-a)/d,[A,m]=[a+p*s,a+p*(s+1)],y=(f-c)/d,[_,E]=[c+y*o,c+y*(o+1)],M,B;if(r==="OCTREE"){let C=(h-u)/d;[M,B]=[u+C*i,u+C*(i+1)]}else[M,B]=[u,h];return{region:[A,_,m,E,M,B]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function dr(e,t,r){return(e<<r)+t}function ui(e,t,r,n,s){let o=rw({level:t,x:r,y:n,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function rw(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function nw(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function Gl(e,t=""){if(!t)return Gt.EMPTY;let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return Gt.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Gt.SCENEGRAPH;default:return n||Gt.EMPTY}}function Ul(e){switch(e){case"REPLACE":case"replace":return mt.REPLACE;case"ADD":case"add":return mt.ADD;default:return e}}function Dl(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let n=new URL(e,`${t}/`);return decodeURI(n.toString())}else if(e.startsWith("/"))return e;return Ie.resolve(t,e)}function f0(e,t){if(!e)return null;let r;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(r=Dl(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:pe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Gl(e,r),refine:Ul(e.refine)}}async function p0(e,t,r){let n=null,s=h0(e.root);s&&e.root?n=await u0(e.root,e,t,s,r):n=f0(e.root,t);let o=[];for(o.push(n);o.length>0;){let i=o.pop()||{},a=i.children||[],c=[];for(let l of a){let f=h0(l),u;f?u=await u0(l,e,t,f,r):u=f0(l,t),u&&(c.push(u),o.push(u))}i.children=c}return n}async function u0(e,t,r,n,s){let{subdivisionScheme:o,maximumLevel:i,availableLevels:a,subtreeLevels:c,subtrees:{uri:l}}=n,f=ui(l,0,0,0,0),u=Dl(f,r),h=await(0,d0.load)(u,ci,s),d=e.content?.uri,p=d?Dl(d,r):"",A=t?.root?.refine,m=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let B={box:fi(y),s2VolumeInfo:y};e.boundingVolume=B}let _=e.boundingVolume,E={contentUrlTemplate:p,subtreesUriTemplate:l,subdivisionScheme:o,subtreeLevels:c,maximumLevel:Number.isFinite(a)?a-1:i,refine:A,basePath:r,lodMetricType:pe.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:_,getTileType:Gl,getRefine:Ul};return await sw(e,r,h,E,s)}async function sw(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await Nl({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:pe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Gl(e,a),refine:Ul(e.refine),content:c||e.content,children:o}}function h0(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var hi={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Vo,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:ow,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function ow(e,t={},r){let n=t["3d-tiles"]||{},s;return n.isTileset==="auto"?s=r?.url&&r.url.indexOf(".json")!==-1:s=n.isTileset,s?iw(e,t,r):aw(e,t,r)}async function iw(e,t,r){let n=JSON.parse(new TextDecoder().decode(e)),s=r?.url||"",o=cw(s),i=await p0(n,o,t||{});return{...n,shape:"tileset3d",loader:hi,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:ht.TILES3D,lodMetricType:pe.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function aw(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await _l(e,0,t,r,n.content),n.content}function cw(e){return Ie.dirname(e)}var m0=[0],lw={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:hi,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,r)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},os=class extends Ge.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Ge.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:r,changeFlags:n}){if(t.data&&t.data!==r.data&&this._loadTileset(t.data),n.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(n.propsChanged){let{layerMap:s}=this.state;for(let o in s)s[o].needsUpdate=!0}}activateViewport(t){let{activeViewports:r,lastUpdatedViewports:n}=this.state;this.internalState.viewport=t,r[t.id]=t;let s=n?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:r}){let n=r&&r.props.tile;return t.picked&&(t.object=n),t.sourceTile=n,t}filterSubLayer({layer:t,viewport:r}){let{tile:n}=t.props,{id:s}=r;return n.selected&&n.viewportIds.includes(s)}_updateAutoHighlight(t){let r=t.sourceTile,n=this.state.layerMap[r?.id];n&&n.layer&&n.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:r={}}=this.props,n=this.props.loader||this.props.loaders,s=Array.isArray(n)?n[0]:n,o={loadOptions:{...r}},i=t;if(s.preload){let l=await s.preload(t,r);l.url&&(i=l.url),l.headers&&(o.loadOptions.fetch={...o.loadOptions.fetch,headers:l.headers}),Object.assign(o,l)}let a=await(0,y0.load)(i,s,o.loadOptions),c=new Qn(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...o});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:r}=this.state;this.props.onTileLoad(t),this._updateTileset(r),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:r}=this.state,{timeline:n}=this.context,s=Object.keys(t).length;!n||!s||!r||r.selectTiles(Object.values(t)).then(o=>{this.state.frameNumber!==o&&this.setState({frameNumber:o})})}_getSubLayer(t,r){if(!t.content)return null;switch(t.type){case Gt.POINTCLOUD:return this._makePointCloudLayer(t,r);case Gt.SCENEGRAPH:return this._make3DModelLayer(t);case Gt.MESH:return this._makeSimpleMeshLayer(t,r);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,r){let{attributes:n,pointCount:s,constantRGBA:o,cartographicOrigin:i,modelMatrix:a}=t.content,{positions:c,normals:l,colors:f}=n;if(!c)return null;let u=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:f}},{pointSize:h,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",A0.PointCloudLayer);return new p({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:u,coordinateSystem:Ge.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:i,modelMatrix:a,getColor:o||d,_offset:0})}_make3DModelLayer(t){let{gltf:r,instances:n,cartographicOrigin:s,modelMatrix:o}=t.content,i=this.getSubLayerClass("scenegraph",x0.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:n||m0,scenegraph:r,coordinateSystem:Ge.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:o,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,r){let n=t.content,{attributes:s,indices:o,modelMatrix:i,cartographicOrigin:a,coordinateSystem:c=Ge.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:f}=n,{_getMeshColor:u}=this.props,h=r&&r.props.mesh||new g0.Geometry({topology:"triangle-list",attributes:fw(s),indices:o}),d=this.getSubLayerClass("mesh",rm);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:h,data:m0,getColor:u(t),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:f,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:r}=this.state;return t?t.tiles.map(n=>{let s=r[n.id]=r[n.id]||{tile:n},{layer:o}=s;return n.selected&&(o?s.needsUpdate&&(o=this._getSubLayer(n,o),s.needsUpdate=!1):o=this._getSubLayer(n)),s.layer=o,o}).filter(Boolean):null}};os.defaultProps=lw;os.layerName="Tile3DLayer";var T0=os;function fw(e){let t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}var Ai=D(qt(),1),kl=D(Bo(),1),S0=D(qt(),1);var uw=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function Vl(e){return e>>1^-(e&1)}function hw(e){let t=0,r={};for(let[n,s]of uw){let o=s===8?e.getFloat64:e.getFloat32;r[n]=o.call(e,t,!0),t+=s}return{header:r,headerEndPosition:t}}function dw(e,t){let r=t,n=3,s=e.getUint32(r,!0),o=new Uint16Array(s*n);r+=Uint32Array.BYTES_PER_ELEMENT;let i=Uint16Array.BYTES_PER_ELEMENT,a=s*i,c=r,l=c+a,f=l+a,u=0,h=0,d=0;for(let p=0;p<s;p++)u+=Vl(e.getUint16(c+i*p,!0)),h+=Vl(e.getUint16(l+i*p,!0)),d+=Vl(e.getUint16(f+i*p,!0)),o[p]=u,o[p+s]=h,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function is(e,t,r,n,s=!0){let o;if(n===2?o=new Uint16Array(e,t,r):o=new Uint32Array(e,t,r),!s)return o;let i=0;for(let a=0;a<o.length;++a){let c=o[a];o[a]=i-c,c===0&&++i}return o}function pw(e,t,r){let n=r,s=3,i=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%i!==0&&(n+=i-n%i);let a=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=is(e.buffer,n,c,i);return n+=c*i,{triangleIndicesEndPosition:n,triangleIndices:l}}function mw(e,t,r){let n=r,s=3,i=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=is(e.buffer,n,a,i,!1);n+=a*i;let l=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let f=is(e.buffer,n,l,i,!1);n+=l*i;let u=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=is(e.buffer,n,u,i,!1);n+=u*i;let d=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=is(e.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:f,eastIndices:h,northIndices:p}}function gw(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Aw(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function xw(e,t){let r={};if(e.byteLength<=t)return{extensions:r,extensionsEndPosition:t};let n=t;for(;n<e.byteLength;){let s=e.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let i=new DataView(e.buffer,n,o);switch(s){case 1:{r.vertexNormals=gw(i);break}case 2:{r.waterMask=Aw(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var pr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},yw={maxDecodingStep:pr.extensions};function Hl(e,t){let r=Object.assign({},yw,t),n=new DataView(e),{header:s,headerEndPosition:o}=hw(n);if(r.maxDecodingStep<pr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=dw(n,o);if(r.maxDecodingStep<pr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=pw(n,i,a);if(r.maxDecodingStep<pr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:f,southIndices:u,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=mw(n,i,l);if(r.maxDecodingStep<pr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u};let{extensions:A}=xw(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u,extensions:A}}function di(e,t,r,n){let s=n?Ew(n,e.POSITION.value):Tw(t),o=new e.POSITION.value.constructor(s.length*6),i=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let f=s[l];_w({edge:f,edgeIndex:l,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}e.POSITION.value=bn(e.POSITION.value,o),e.TEXCOORD_0.value=bn(e.TEXCOORD_0.value,i);let c=t instanceof Array?t.concat(a):bn(t,a);return{attributes:e,triangles:c}}function Tw(e){let t=[];for(let s=0;s<e.length;s+=3)t.push([e[s],e[s+1]]),t.push([e[s+1],e[s+2]]),t.push([e[s+2],e[s]]);t.sort((s,o)=>Math.min(...s)-Math.min(...o)||Math.max(...s)-Math.max(...o));let r=[],n=0;for(;n<t.length;)t[n][0]===t[n+1]?.[1]&&t[n][1]===t[n+1]?.[0]?n+=2:(r.push(t[n]),n++);return r}function Ew(e,t){e.westIndices.sort((n,s)=>t[3*n+1]-t[3*s+1]),e.eastIndices.sort((n,s)=>t[3*s+1]-t[3*n+1]),e.southIndices.sort((n,s)=>t[3*s]-t[3*n]),e.northIndices.sort((n,s)=>t[3*n]-t[3*s]);let r=[];for(let n in e){let s=e[n];for(let o=0;o<s.length-1;o++)r.push([s[o],s[o+1]])}return r}function _w({edge:e,edgeIndex:t,attributes:r,skirtHeight:n,newPosition:s,newTexcoord0:o,newTriangles:i}){let a=r.POSITION.value.length,c=t*2,l=t*2+1;s.set(r.POSITION.value.subarray(e[0]*3,e[0]*3+3),c*3),s[c*3+2]=s[c*3+2]-n,s.set(r.POSITION.value.subarray(e[1]*3,e[1]*3+3),l*3),s[l*3+2]=s[l*3+2]-n,o.set(r.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),c*2),o.set(r.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),l*2);let f=t*2*3;i[f]=e[0],i[f+1]=a/3+l,i[f+2]=e[1],i[f+3]=a/3+l,i[f+4]=e[0],i[f+5]=a/3+c}function zl(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=Hl(e,pr.triangleIndices),f=o,u=Mw(s,n,r),h=ar(u);if(t?.skirtHeight){let{attributes:d,triangles:p}=di(u,f,t.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});u=d,f=p}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:f,size:1},attributes:u}}function Mw(e,t,r){let{minHeight:n,maxHeight:s}=t,[o,i,a,c]=r||[0,0,1,1],l=a-o,f=c-i,u=s-n,h=e.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let A=0;A<h;A++){let m=e[A]/32767,y=e[A+h]/32767,_=e[A+h*2]/32767;d[3*A+0]=m*l+o,d[3*A+1]=y*f+i,d[3*A+2]=_*u+n,p[2*A+0]=m,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var as=class{constructor(t=257){this.gridSize=t;let r=t-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let s=n+2,o=0,i=0,a=0,c=0,l=0,f=0;for(s&1?a=c=l=r:o=i=f=r;(s>>=1)>1;){let h=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=f):(o=a,i=c,a=l,c=f),l=h,f=d}let u=n*4;this.coords[u+0]=o,this.coords[u+1]=i,this.coords[u+2]=a,this.coords[u+3]=c}}createTile(t){return new ql(t,this)}},ql=class{constructor(t,r){let n=r.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=r,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:r,coords:n,gridSize:s}=this.martini,{terrain:o,errors:i}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=n[c+0],f=n[c+1],u=n[c+2],h=n[c+3],d=l+u>>1,p=f+h>>1,A=d+p-f,m=p+l-d,y=(o[f*s+l]+o[h*s+u])/2,_=p*s+d,E=Math.abs(y-o[_]);if(i[_]=Math.max(i[_],E),a<r){let M=(f+m>>1)*s+(l+A>>1),B=(h+m>>1)*s+(u+A>>1);i[_]=Math.max(i[_],i[M],i[B])}}}getMesh(t=0){let{gridSize:r,indices:n}=this.martini,{errors:s}=this,o=0,i=0,a=r-1;n.fill(0);function c(d,p,A,m,y,_){let E=d+A>>1,M=p+m>>1;Math.abs(d-y)+Math.abs(p-_)>1&&s[M*r+E]>t?(c(y,_,d,p,E,M),c(A,m,y,_,E,M)):(n[p*r+d]=n[p*r+d]||++o,n[m*r+A]=n[m*r+A]||++o,n[_*r+y]=n[_*r+y]||++o,i++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(o*2),f=new Uint32Array(i*3),u=0;function h(d,p,A,m,y,_){let E=d+A>>1,M=p+m>>1;if(Math.abs(d-y)+Math.abs(p-_)>1&&s[M*r+E]>t)h(y,_,d,p,E,M),h(A,m,y,_,E,M);else{let B=n[p*r+d]-1,C=n[m*r+A]-1,L=n[_*r+y]-1;l[2*B]=d,l[2*B+1]=p,l[2*C]=A,l[2*C+1]=m,l[2*L]=y,l[2*L+1]=_,f[u++]=B,f[u++]=C,f[u++]=L}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:l,triangles:f}}};var cs=class{constructor(t,r,n=r){this.data=t,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=r-1,o=n-1,i=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,o),l=this._addPoint(s,o),f=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,f,-1,-1),this._flush()}run(t=1){for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,r){return this.data[this.width*r+t]}_flush(){let t=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],s=2*this.triangles[n*3+0],o=2*this.triangles[n*3+1],i=2*this.triangles[n*3+2];this._findCandidate(t[s],t[s+1],t[o],t[o+1],t[i],t[i+1],n)}this._pendingLen=0}_findCandidate(t,r,n,s,o,i,a){let c=Math.min(t,n,o),l=Math.min(r,s,i),f=Math.max(t,n,o),u=Math.max(r,s,i),h=mr(n,s,o,i,c,l),d=mr(o,i,t,r,c,l),p=mr(t,r,n,s,c,l),A=s-r,m=t-n,y=i-s,_=n-o,E=r-i,M=o-t,B=mr(t,r,n,s,o,i),C=this.heightAt(t,r)/B,L=this.heightAt(n,s)/B,b=this.heightAt(o,i)/B,T=0,g=0,S=0,R=0;for(let F=l;F<=u;F++){let v=0;h<0&&y!==0&&(v=Math.max(v,Math.floor(-h/y))),d<0&&E!==0&&(v=Math.max(v,Math.floor(-d/E))),p<0&&A!==0&&(v=Math.max(v,Math.floor(-p/A)));let G=h+y*v,X=d+E*v,z=p+A*v,et=!1;for(let K=c+v;K<=f;K++){if(G>=0&&X>=0&&z>=0){et=!0;let Y=C*G+L*X+b*z,$=Math.abs(Y-this.heightAt(K,F));R+=$*$,$>T&&(T=$,g=K,S=F)}else if(et)break;G+=y,X+=E,z+=A}h+=_,d+=M,p+=m}(g===t&&S===r||g===n&&S===s||g===o&&S===i)&&(T=0),this._candidates[2*a]=g,this._candidates[2*a+1]=S,this._rms[a]=R,this._queuePush(a,T,R)}_step(){let t=this._queuePop(),r=t*3+0,n=t*3+1,s=t*3+2,o=this.triangles[r],i=this.triangles[n],a=this.triangles[s],c=this.coords[2*o],l=this.coords[2*o+1],f=this.coords[2*i],u=this.coords[2*i+1],h=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*t],A=this._candidates[2*t+1],m=this._addPoint(p,A);if(mr(c,l,f,u,p,A)===0)this._handleCollinear(m,r);else if(mr(f,u,h,d,p,A)===0)this._handleCollinear(m,n);else if(mr(h,d,c,l,p,A)===0)this._handleCollinear(m,s);else{let y=this._halfedges[r],_=this._halfedges[n],E=this._halfedges[s],M=this._addTriangle(o,i,m,y,-1,-1,r),B=this._addTriangle(i,a,m,_,-1,M+1),C=this._addTriangle(a,o,m,E,M+2,B+1);this._legalize(M),this._legalize(B),this._legalize(C)}}_addPoint(t,r){let n=this.coords.length>>1;return this.coords.push(t,r),n}_addTriangle(t,r,n,s,o,i,a=this.triangles.length){let c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=s,this._halfedges[a+1]=o,this._halfedges[a+2]=i,s>=0&&(this._halfedges[s]=a+0),o>=0&&(this._halfedges[o]=a+1),i>=0&&(this._halfedges[i]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let r=this._halfedges[t];if(r<0)return;let n=t-t%3,s=r-r%3,o=n+(t+1)%3,i=n+(t+2)%3,a=s+(r+2)%3,c=s+(r+1)%3,l=this.triangles[i],f=this.triangles[t],u=this.triangles[o],h=this.triangles[a],d=this.coords;if(!bw(d[2*l],d[2*l+1],d[2*f],d[2*f+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1]))return;let p=this._halfedges[o],A=this._halfedges[i],m=this._halfedges[a],y=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let _=this._addTriangle(l,h,u,-1,m,p,n),E=this._addTriangle(h,l,f,_,A,y,s);this._legalize(_+1),this._legalize(E+2)}_handleCollinear(t,r){let n=r-r%3,s=n+(r+1)%3,o=n+(r+2)%3,i=this.triangles[o],a=this.triangles[r],c=this.triangles[s],l=this._halfedges[s],f=this._halfedges[o],u=this._halfedges[r];if(u<0){let C=this._addTriangle(t,i,a,-1,f,-1,n),L=this._addTriangle(i,t,c,C,-1,l);this._legalize(C+1),this._legalize(L+2);return}let h=u-u%3,d=h+(u+2)%3,p=h+(u+1)%3,A=this.triangles[d],m=this._halfedges[d],y=this._halfedges[p];this._queueRemove(h/3);let _=this._addTriangle(i,a,t,f,-1,-1,n),E=this._addTriangle(a,A,t,y,-1,_+1,h),M=this._addTriangle(A,c,t,m,-1,E+1),B=this._addTriangle(c,i,t,l,_+2,M+1);this._legalize(_),this._legalize(E),this._legalize(M),this._legalize(B)}_queuePush(t,r,n){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(r),this._rmsSum+=n,this._queueUp(s)}_queuePop(){let t=this._queue.length-1;return this._queueSwap(0,t),this._queueDown(0,t),this._queuePopBack()}_queuePopBack(){let t=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[t],this._queueIndices[t]=-1,t}_queueRemove(t){let r=this._queueIndices[t];if(r<0){let s=this._pending.indexOf(t);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(t,r){return this._errors[t]>this._errors[r]}_queueSwap(t,r){let n=this._queue[t],s=this._queue[r];this._queue[t]=s,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[s]=t;let o=this._errors[t];this._errors[t]=this._errors[r],this._errors[r]=o}_queueUp(t){let r=t;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(t,r){let n=t;for(;;){let s=2*n+1;if(s>=r||s<0)break;let o=s+1,i=s;if(o<r&&this._queueLess(o,s)&&(i=o),!this._queueLess(i,n))break;this._queueSwap(n,i),n=i}return n>t}};function mr(e,t,r,n,s,o){return(r-s)*(t-o)-(n-o)*(e-s)}function bw(e,t,r,n,s,o,i,a){let c=e-i,l=t-a,f=r-i,u=n-a,h=s-i,d=o-a,p=c*c+l*l,A=f*f+u*u,m=h*h+d*d;return c*(u*m-A*d)-l*(f*m-A*h)+p*(f*d-u*h)<0}function M0(e,t){let{meshMaxError:r,bounds:n,elevationDecoder:s}=t,{data:o,width:i,height:a}=e,c,l;switch(t.tesselator){case"martini":c=pi(o,i,a,s,t.tesselator),l=E0(r,i,c);break;case"delatin":c=pi(o,i,a,s,t.tesselator),l=_0(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=pi(o,i,a,s,"martini"),l=E0(r,i,c)):(c=pi(o,i,a,s,"delatin"),l=_0(r,i,a,c));break}let{vertices:f}=l,{triangles:u}=l,h=Bw(f,c,i,a,n),d=ar(h);if(t.skirtHeight){let{attributes:p,triangles:A}=di(h,u,t.skirtHeight);h=p,u=A}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(u),size:1},attributes:h}}function E0(e,t,r){let n=t+1,o=new as(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(e);return{vertices:i,triangles:a}}function _0(e,t,r,n){let s=new cs(n,t+1,r+1);s.run(e);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function pi(e,t,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((t+1)*(r+1));for(let f=0,u=0;u<r;u++)for(let h=0;h<t;h++,f++){let d=f*4,p=e[d+0],A=e[d+1],m=e[d+2];l[f+u]=p*o+A*a+m*i+c}if(s==="martini"){for(let f=(t+1)*t,u=0;u<t;u++,f++)l[f]=l[f-t-1];for(let f=r,u=0;u<r+1;u++,f+=r+1)l[f]=l[f-1]}return l}function Bw(e,t,r,n,s){let o=r+1,i=e.length/2,a=new Float32Array(i*3),c=new Float32Array(i*2),[l,f,u,h]=s||[0,0,r,n],d=(u-l)/r,p=(h-f)/n;for(let A=0;A<i;A++){let m=e[A*2],y=e[A*2+1],_=y*o+m;a[3*A+0]=m*d+l,a[3*A+1]=-y*p+h,a[3*A+2]=t[_],c[2*A+0]=m/r,c[2*A+1]=y/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var mi="4.3.3";var gi={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:mi,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var b0={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:mi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var Cw={...gi,parse:Sw};async function Sw(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await vt(e,[],n,r),o={...Cw.options.terrain,...t?.terrain};return M0(s,o)}var gz={...b0,parseSync:(e,t)=>zl(e,t?.["quantized-mesh"]),parse:async(e,t)=>zl(e,t?.["quantized-mesh"])};var B0=[1],Iw={...nr.defaultProps,elevationData:Re,texture:{...Re,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[gi]};function C0(e){return Array.isArray(e)?e.join(";"):e||""}var ls=class extends Ai.CompositeLayer{updateState({props:t,oldProps:r}){let n=t.elevationData!==r.elevationData;if(n){let{elevationData:o}=t,i=o&&(Array.isArray(o)||ww(o));this.setState({isTiled:i})}let s=n||t.meshMaxError!==r.meshMaxError||t.elevationDecoder!==r.elevationDecoder||t.bounds!==r.bounds;if(!this.state.isTiled&&s){let o=this.loadTerrain(t);this.setState({terrain:o})}t.workerUrl&&Ai.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:r,elevationDecoder:n,meshMaxError:s,signal:o}){if(!t)return null;let i=this.getLoadOptions();i={...i,terrain:{skirtHeight:this.state.isTiled?s*2:0,...i?.terrain,bounds:r,meshMaxError:s,elevationDecoder:n}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:i,signal:o})}getTiledTerrainData(t){let{elevationData:r,fetch:n,texture:s,elevationDecoder:o,meshMaxError:i}=this.props,{viewport:a}=this.context,c=oe(r,t),l=s&&oe(s,t),{signal:f}=t,u=[0,0],h=[0,0];if(a.isGeospatial){let m=t.bbox;u=a.projectFlat([m.west,m.south]),h=a.projectFlat([m.east,m.north])}else{let m=t.bbox;u=[m.left,m.bottom],h=[m.right,m.top]}let d=[u[0],u[1],h[0],h[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:f}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:f}).catch(m=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let r=this.getSubLayerClass("mesh",kl.SimpleMeshLayer),{color:n,wireframe:s,material:o}=this.props,{data:i}=t;if(!i)return null;let[a,c]=i;return new r(t,{data:B0,mesh:a,texture:c,_instanced:!1,coordinateSystem:S0.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:n,wireframe:s,material:o})}onViewportLoad(t){if(!t)return;let{zRange:r}=this.state,n=t.map(i=>i.content).filter(Boolean).map(i=>i[0].header.boundingBox.map(c=>c[2]));if(n.length===0)return;let s=Math.min(...n.map(i=>i[0])),o=Math.max(...n.map(i=>i[1]));(!r||s<r[0]||o>r[1])&&this.setState({zRange:[s,o]})}renderLayers(){let{color:t,material:r,elevationData:n,texture:s,wireframe:o,meshMaxError:i,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:_}=this.props;if(this.state.isTiled)return new nr(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:C0(n),texture:C0(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:_});if(!n)return null;let E=this.getSubLayerClass("mesh",kl.SimpleMeshLayer);return new E(this.getSubLayerProps({id:"mesh"}),{data:B0,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:M=>[0,0,0],getColor:t,material:r,wireframe:o})}};ls.defaultProps=Iw;ls.layerName="TerrainLayer";var I0=ls,ww=e=>e.includes("{x}")&&(e.includes("{y}")||e.includes("{-y}"));var Ii=D(qt(),1),lf=D(zt(),1),a1=D(L0(),1);var fs={x:0,y:1,z:2};function gr(e,t={}){let{start:r=0,end:n=e.length,plane:s="xy"}=t,o=t.size||2,i=0,a=fs[s[0]],c=fs[s[1]];for(let l=r,f=n-o;l<n;l+=o)i+=(e[l+a]-e[f+a])*(e[l+c]+e[f+c]),f=l;return i/2}function jl(e,t,r=2,n,s="xy"){let o=t&&t.length,i=o?t[0]*r:e.length,a=R0(e,0,i,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,f,u,h,d,p,A;if(o&&(a=Nw(e,t,a,r,n,s)),e.length>80*r){h=f=e[0],d=u=e[1];for(let m=r;m<i;m+=r)p=e[m],A=e[m+1],p<h&&(h=p),A<d&&(d=A),p>f&&(f=p),A>u&&(u=A);l=Math.max(f-h,u-d),l=l!==0?32767/l:0}return us(a,c,r,h,d,l,0),c}function R0(e,t,r,n,s,o,i){let a,c;o===void 0&&(o=gr(e,{start:t,end:r,size:n,plane:i}));let l=fs[i[0]],f=fs[i[1]];if(s===o<0)for(a=t;a<r;a+=n)c=v0(a,e[a+l],e[a+f],c);else for(a=r-n;a>=t;a-=n)c=v0(a,e[a+l],e[a+f],c);return c&&Ti(c,c.next)&&(ds(c),c=c.next),c}function Ar(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ti(r,r.next)||nt(r.prev,r,r.next)===0)){if(ds(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function us(e,t,r,n,s,o,i){if(!e)return;!i&&o&&Hw(e,n,s,o);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,o?Fw(e,n,s,o):Rw(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),ds(e),e=l.next,a=l.next;continue}if(e=l,e===a){i?i===1?(e=Pw(Ar(e),t,r),us(e,t,r,n,s,o,2)):i===2&&Ow(e,t,r,n,s,o):us(Ar(e),t,r,n,s,o,1);break}}}function Rw(e){let t=e.prev,r=e,n=e.next;if(nt(t,r,n)>=0)return!1;let s=t.x,o=r.x,i=n.x,a=t.y,c=r.y,l=n.y,f=s<o?s<i?s:i:o<i?o:i,u=a<c?a<l?a:l:c<l?c:l,h=s>o?s>i?s:i:o>i?o:i,d=a>c?a>l?a:l:c>l?c:l,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&tn(s,a,o,c,i,l,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Fw(e,t,r,n){let s=e.prev,o=e,i=e.next;if(nt(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,f=s.y,u=o.y,h=i.y,d=a<c?a<l?a:l:c<l?c:l,p=f<u?f<h?f:h:u<h?u:h,A=a>c?a>l?a:l:c>l?c:l,m=f>u?f>h?f:h:u>h?u:h,y=Jl(d,p,t,r,n),_=Jl(A,m,t,r,n),E=e.prevZ,M=e.nextZ;for(;E&&E.z>=y&&M&&M.z<=_;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&tn(a,f,c,u,l,h,E.x,E.y)&&nt(E.prev,E,E.next)>=0||(E=E.prevZ,M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&tn(a,f,c,u,l,h,M.x,M.y)&&nt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;E&&E.z>=y;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&tn(a,f,c,u,l,h,E.x,E.y)&&nt(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;M&&M.z<=_;){if(M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&tn(a,f,c,u,l,h,M.x,M.y)&&nt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Pw(e,t,r){let n=e;do{let s=n.prev,o=n.next.next;!Ti(s,o)&&F0(s,n,n.next,o)&&hs(s,o)&&hs(o,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ds(n),ds(n.next),n=e=o),n=n.next}while(n!==e);return Ar(n)}function Ow(e,t,r,n,s,o){let i=e;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&kw(i,a)){let c=P0(i,a);i=Ar(i,i.next),c=Ar(c,c.next),us(i,t,r,n,s,o,0),us(c,t,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==e)}function Nw(e,t,r,n,s,o){let i=[],a,c,l,f,u;for(a=0,c=t.length;a<c;a++)l=t[a]*n,f=a<c-1?t[a+1]*n:e.length,u=R0(e,l,f,n,!1,s&&s[a+1],o),u===u.next&&(u.steiner=!0),i.push(qw(u));for(i.sort(Dw),a=0;a<i.length;a++)r=Gw(i[a],r);return r}function Dw(e,t){return e.x-t.x}function Gw(e,t){let r=Uw(e,t);if(!r)return t;let n=P0(r,e);return Ar(n,n.next),Ar(r,r.next)}function Uw(e,t){let r=t,n=e.x,s=e.y,o=-1/0,i;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let h=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,i=r.x<r.next.x?r:r.next,h===n))return i}r=r.next}while(r!==t);if(!i)return null;let a=i,c=i.x,l=i.y,f=1/0,u;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&tn(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),hs(r,e)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&Vw(i,r)))&&(i=r,f=u)),r=r.next;while(r!==a);return i}function Vw(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function Hw(e,t,r,n){let s=e;do s.z===0&&(s.z=Jl(s.x,s.y,t,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,zw(s)}function zw(e){let t,r,n=1,s,o,i,a,c,l;do{for(o=e,e=null,l=null,s=0;o;){for(s++,a=o,i=0,r=0;r<n&&(i++,a=a.nextZ,!!a);r++);for(c=n;i>0||c>0&&a;)i!==0&&(c===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,i--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;o=a}l.nextZ=null,n*=2}while(s>1);return e}function Jl(e,t,r,n,s){return e=(e-r)*s|0,t=(t-n)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function qw(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function tn(e,t,r,n,s,o,i,a){return(s-i)*(t-a)>=(e-i)*(o-a)&&(e-i)*(n-a)>=(r-i)*(t-a)&&(r-i)*(o-a)>=(s-i)*(n-a)}function kw(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Jw(e,t)&&(hs(e,t)&&hs(t,e)&&jw(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Ti(e,t)&&nt(e.prev,e,e.next)>0&&nt(t.prev,t,t.next)>0)}function nt(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ti(e,t){return e.x===t.x&&e.y===t.y}function F0(e,t,r,n){let s=yi(nt(e,t,r)),o=yi(nt(e,t,n)),i=yi(nt(r,n,e)),a=yi(nt(r,n,t));return!!(s!==o&&i!==a||s===0&&xi(e,r,t)||o===0&&xi(e,n,t)||i===0&&xi(r,e,n)||a===0&&xi(r,t,n))}function xi(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function yi(e){return e>0?1:e<0?-1:0}function Jw(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&F0(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function hs(e,t){return nt(e.prev,e,e.next)<0?nt(e,t,e.next)>=0&&nt(e,e.prev,t)>=0:nt(e,t,e.prev)<0||nt(e,e.next,t)<0}function jw(e,t){let r=e,n=!1,s=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&s<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function P0(e,t){let r=new ps(e.i,e.x,e.y),n=new ps(t.i,t.x,t.y),s=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function v0(e,t,r,n){let s=new ps(e,t,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function ds(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var ps=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function Yl(e,t,r){let n=Qw(e),s=Object.keys(n).filter(o=>n[o]!==Array);return Zw(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Qw(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let s=r.properties[n];t[n]=s3(s,t[n])}return t}function Zw(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:i,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:m=!0}=r,y=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,E={type:"Point",positions:new A(n*d),globalFeatureIds:new _(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},M={type:"LineString",pathIndices:o>65535?new Uint32Array(i+1):new Uint16Array(i+1),positions:new A(o*d),globalFeatureIds:new _(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new A(c*d),globalFeatureIds:new _(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};m&&(B.triangles=[]);for(let L of[E,M,B])for(let b of p){let T=h[b];L.numericProps[b]=new T(L.positions.length/d)}M.pathIndices[i]=o,B.polygonIndices[l]=c,B.primitivePolygonIndices[f]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let L of e){let b=L.geometry,T=L.properties||{};switch(b.type){case"Point":$w(b,E,C,d,T),E.properties.push(Wl(T,p)),y&&E.fields.push({id:L.id}),C.pointFeature++;break;case"LineString":t3(b,M,C,d,T),M.properties.push(Wl(T,p)),y&&M.fields.push({id:L.id}),C.lineFeature++;break;case"Polygon":e3(b,B,C,d,T),B.properties.push(Wl(T,p)),y&&B.fields.push({id:L.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return n3(E,M,B,d)}function $w(e,t,r,n,s){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;Kl(t,s,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function t3(e,t,r,n,s){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;Kl(t,s,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let i=0,a=e.indices.length;i<a;++i){let c=e.indices[i],l=i===a-1?e.data.length:e.indices[i+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/n}}function e3(e,t,r,n,s){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;Kl(t,s,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let i=0,a=e.indices.length;i<a;++i){let c=r.polygonPosition;t.polygonIndices[r.polygonObject++]=c;let l=e.areas[i],f=e.indices[i],u=e.indices[i+1];for(let d=0,p=f.length;d<p;++d){let A=f[d],m=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(m-A)/n}let h=r.polygonPosition;r3(t,l,f,{startPosition:c,endPosition:h,coordLength:n})}}function r3(e,t,r,{startPosition:n,endPosition:s,coordLength:o}){if(!e.triangles)return;let i=n*o,a=s*o,c=e.positions.subarray(i,a),l=r[0],f=r.slice(1).map(h=>(h-l)/o),u=jl(c,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function Xl(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function n3(e,t,r,n){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Xl(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Xl(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Xl(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function Kl(e,t,r,n){for(let s in e.numericProps)if(s in t){let o=t[s];e.numericProps[s].fill(o,r,r+n)}}function Wl(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function s3(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Mi(e,t){let r=t?.globalFeatureId;return r!==void 0?o3(e,r):i3(e,t?.type)}function o3(e,t){let r=G0(e);for(let n of r){let s=0,o=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let a=n.featureIds.value[i];if(a!==o){if(t===n.globalFeatureIds.value[s])return Ei(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return Ei(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function i3(e,t){let r=G0(e,t);return a3(r)}function D0(e,t,r){switch(e.type){case"Point":return u3(e,t,r);case"LineString":return f3(e,t,r);case"Polygon":return U0(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function G0(e,t){let r=[];return e.points&&(e.points.type="Point",r.push(e.points)),e.lines&&(e.lines.type="LineString",r.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",r.push(e.polygons)),r}function a3(e){let t=[];for(let r of e){if(r.featureIds.value.length===0)continue;let n=0,s=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let i=r.featureIds.value[o];i!==s&&(t.push(Ei(r,n,o)),n=o,s=i)}t.push(Ei(r,n,r.featureIds.value.length))}return t}function Ei(e,t,r){let n=D0(e,t,r),s=l3(e,t,r),o=c3(e,t,r);return{type:"Feature",geometry:n,properties:s,...o}}function c3(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function l3(e,t=0,r){let n=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)n[s]=e.numericProps[s].value[t];return n}function U0(e,t=-1/0,r=1/0){let{positions:n}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=r),o=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=r);if(!(s.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],u=o[l+1],h=_i(n,f,u);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],f=s[c+1],u=U0(e,l,f).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function f3(e,t=-1/0,r=1/0){let{positions:n}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:_i(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=_i(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function u3(e,t,r){let{positions:n}=e,s=_i(n,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function _i(e,t,r){t=t||0,r=r||e.value.length/e.size;let n=[];for(let s=t;s<r;s++){let o=Array();for(let i=s*e.size;i<(s+1)*e.size;i++)o.push(Number(e.value[i]));n.push(o)}return n}var rf=D(j0(),1);function w3(e){let t=0;for(let r=0,n=e.length-1,s,o;r<e.length;n=r++)s=e[r],o=e[n],t+=(o[0]-s[0])*(s[1]+o[1]);return t}function $l(e,t){if(Array.isArray(e[0])){for(let n of e)$l(n,t);return}let r=e;r[0]/=t,r[1]/=t}function X0(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function tf(e,t,r){if(typeof e[0][0]!="number"){for(let i of e)tf(i,t,r);return}let n=r*Math.pow(2,t.z),s=r*t.x,o=r*t.y;for(let i=0;i<e.length;i++){let a=e[i];a[0]=(a[0]+s)*360/n-180;let c=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(c*Math.PI/180))-90}}function W0(e,t,r){let{x:n,y:s,z:o}=t,i=r*Math.pow(2,o),a=r*n,c=r*s;for(let l=0,f=e.length;l<f;l+=2){e[l]=(e[l]+a)*360/i-180;let u=180-(e[l+1]+c)*360/i;e[l+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Y0(e){let t=e.length;if(t<=1)return[e];let r=[],n,s;for(let o=0;o<t;o++){let i=w3(e[o]);i!==0&&(s===void 0&&(s=i<0),s===i<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function K0(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[gr(e.data)]],indices:[e.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,f=0,u;f<t;f++){u=e.indices[f]-c,l=e.indices[f+1]-c||e.data.length;let h=e.data.slice(u,l),d=gr(h);if(d===0){let p=e.data.slice(0,u),A=e.data.slice(l);e.data=p.concat(A),c+=l-u;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[u],o=[d]):(o.push(d),i.push(u))}return o&&n.push(o),i.length&&s.push(i),{type:r,areas:n,indices:s,data:e.data}}var xr=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,s,o,i){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=o,this._geometryInfo=i,t.readFields(L3,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Q0(this,n,s=>tf(s,r,this.extent));default:return Q0(this,n,$l)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,s=>W0(s,r,this.extent));default:return this._toBinaryCoordinates(n,X0)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s=0,o=0,i=0,a=1/0,c=-1/0,l=1/0,f=-1/0;for(;t.pos<r;){if(s<=0){let u=t.readVarint();n=u&7,s=u>>3}if(s--,n===1||n===2)o+=t.readSVarint(),i+=t.readSVarint(),o<a&&(a=o),o>c&&(c=o),i<l&&(l=i),i>f&&(f=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/s,n={type:"LineString",...t};break;case 3:n=K0(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let i of n.indices)this._geometryInfo.polygonRingsCount+=i.length;this._geometryInfo.polygonPositionsCount+=n.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s=0,o=0,i=0,a=[],c;for(;t.pos<r;){if(s<=0){let l=t.readVarint();n=l&7,s=l>>3}switch(s--,n){case 1:case 2:o+=t.readSVarint(),i+=t.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([o,i]);break;case 7:c&&c.push(c[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return c&&a.push(c),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s,o=0,i=0,a=0,c=0,l=[],f=[];for(;t.pos<r;)if(o<=0&&(s=t.readVarint(),n=s&7,o=s>>3),o--,n===1||n===2)i+=t.readSVarint(),a+=t.readSVarint(),n===1&&l.push(c),f.push(i,a),c+=2;else if(n===7){if(c>0){let u=l[l.length-1];f.push(f[u],f[u+1]),c+=2}}else throw new Error(`unknown command ${n}`);return{data:f,indices:l}}};sn(xr,"types",["Unknown","Point","LineString","Polygon"]);function Q0(e,t,r){let n=xr.types[e.type],s,o,i;switch(e.type){case 1:let c=[];for(s=0;s<t.length;s++)c[s]=t[s][0];i=c,r(i,e.extent);break;case 2:for(i=t,s=0;s<i.length;s++)r(i[s],e.extent);break;case 3:for(i=Y0(t),s=0;s<i.length;s++)for(o=0;o<i[s].length;o++)r(i[s][o],e.extent);break;default:throw new Error("illegal vector tile type")}i.length===1?i=i[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:i},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function L3(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?v3(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function v3(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[n]=s}}var Ci=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(R3,this,r),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new xr(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new xr(this._pbf,n,this.extent,this._keys,this._values,r)}};function R3(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(F3(r)))}function F3(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var ms=class{layers;constructor(t,r){this.layers=t.readFields(P3,{},r)}};function P3(e,t,r){if(e===3&&r){let n=new Ci(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function nf(e,t){let r=N3(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:ef(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Z0(e,r)};case"geojson":return Z0(e,r);case"binary-geometry":return ef(e,r);case"binary":return ef(e,r);default:throw new Error(n||"undefined shape")}}function ef(e,t){let[r,n]=O3(e,t),s=Yl(r,n);return s.byteLength=e.byteLength,s}function O3(e,t){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[r,n];let s=new ms(new rf.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(i=>{let a=s.layers[i];if(a)for(let c=0;c<a.length;c++){let l=a.getBinaryFeature(c,n),f=G3(l,t,i);r.push(f)}}),[r,n]}function Z0(e,t){if(e.byteLength<=0)return[];let r=[],n=new ms(new rf.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let i=n.layers[o];if(i)for(let a=0;a<i.length;a++){let c=i.getGeoJSONFeature(a),l=D3(c,t,o);r.push(l)}}),r}function N3(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&Va.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function D3(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function G3(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var U3="4.3.3",Si={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:U3,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},V3={...Si,parse:async(e,t)=>nf(e,t),parseSync:nf,binary:!0};var H3={Point:$0,MultiPoint:z3,LineString:t1,MultiLineString:q3,Polygon:e1,MultiPolygon:k3};function $0([e,t],[r,n],s){let o=ye(r[0],n[0],e),i=ye(r[1],n[1],t);return s.unprojectFlat([o,i])}function sf(e,t,r){return e.map(n=>$0(n,t,r))}function z3(e,t,r){return sf(e,t,r)}function t1(e,t,r){return sf(e,t,r)}function q3(e,t,r){return e.map(n=>t1(n,t,r))}function e1(e,t,r){return e.map(n=>sf(n,t,r))}function k3(e,t,r){return e.map(n=>e1(n,t,r))}function r1(e,t,r){let n=r.projectFlat([t.west,t.north]),s=r.projectFlat([t.east,t.south]),o=[n,s];return{...e,coordinates:H3[e.type](e.coordinates,o,r)}}var J3=["points","lines","polygons"];function of(e,t,r,n){for(let s of J3){let o=e[s]&&j3(e[s],t,r,n);if(o>=0)return o}return-1}function j3(e,t,r,n){let s=e.featureIds.value;if(!s.length)return-1;let o=0,i=s[s.length-1]+1;if(n){let c=X3(e,n);if(c)o=c[0],i=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,f)=>l===r&&s[f]>=o&&s[f]<i);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=n1(e.properties,c=>c[t]===r,o,i):e.fields&&(a=n1(e.fields,c=>c.id===r,o,i));return a>=0?W3(e,a):-1}function X3(e,t){if(!e.__layers){let r={},{properties:n}=e;for(let s=0;s<n.length;s++){let{layerName:o}=n[s];o&&(r[o]?r[o][1]=s:r[o]=[s,s])}e.__layers=r}return e.__layers[t]}function W3(e,t){if(!e.__ids){let r=[],n=e.featureIds.value,s=e.globalFeatureIds.value;for(let o=0;o<n.length;o++)r[n[o]]=s[o];e.__ids=r}return e.__ids[t]}function n1(e,t,r,n){for(let s=r;s<n;s++)if(t(e[s],s))return s;return-1}var af=512,Y3={...lf.GeoJsonLayer.defaultProps,data:Re,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Si],binary:!0},gs=class extends nr{initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:r,context:n,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:r,context:n,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:o}=t;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let t=this.props.data,r=null;if(typeof t=="string"&&!Ac(t)){let{onDataLoad:n,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{r=await s(t,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),t=null}n&&n(r,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(r=t);r&&(t=r.tiles),this.setState({data:t,tileJSON:r})}_getTilesetOptions(){let t=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:n,maxZoom:s}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>n&&(t.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(s)||r.maxzoom<s)&&(t.maxZoom=r.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:r,binary:n}=this.state,{index:s,signal:o}=t,i=oe(r,t);if(!i)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:n?{format:"binary"}:{}},c(i,{propName:"data",layer:this,loadOptions:a,signal:o})}renderSubLayers(t){let{x:r,y:n,z:s}=t.tile.index,o=Math.pow(2,s),i=af/o,a=-i,c=af*r/o,l=af*(1-n/o),f=new O().scale([i,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=f,t.coordinateOrigin=[c,l,0],t.coordinateSystem=Ii.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new a1.ClipExtension]);let u=super.renderSubLayers(t);return this.state.binary&&!(u instanceof lf.GeoJsonLayer)&&Ii.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),u}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=t.object,i=null,a=null;o&&(i=cf(o,r),a=s1(o));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(n!==i||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:i,hoveredFeatureLayerName:a})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let r=super.getPickingInfo(t);if(this.state.binary&&r.index!==-1){let{data:n}=t.sourceLayer.props;r.object=Mi(n,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(r.object=i1(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:r,hoveredFeatureLayerName:n,binary:s}=this.state,{uniqueIdProperty:o,highlightedFeatureId:i}=this.props,a=t.content,c=o1(i);if(!(o1(r)||c))return-1;let f=c?i:r;return Array.isArray(a)?a.findIndex(u=>{let h=cf(u,o)===f,d=c||s1(u)===n;return h&&d}):a&&s?of(a,o,f,c?"":n):-1}_pickObjects(t){let{deck:r,viewport:n}=this.context,s=n.width,o=n.height,i=n.x,a=n.y,c=[this.id];return r.pickObjects({x:i,y:a,width:s,height:o,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let r=this._pickObjects(t),n=new Set,s=[];for(let o of r){let i=cf(o.object,this.props.uniqueIdProperty);i===void 0?s.push(o.object):n.has(i)||(n.add(i),s.push(o.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(n=>{n.hasOwnProperty(t)||Object.defineProperty(n,t,{get:()=>{if(!n.content)return null;if(this.state.binary&&Array.isArray(n.content)&&!n.content.length)return[];let{bbox:s}=n;if(n._contentWGS84===void 0&&xc(s)){let o=this.state.binary?Mi(n.content):n.content;n._contentWGS84=o.map(i=>i1(i,s,this.context.viewport))}return n._contentWGS84}})})}};gs.layerName="MVTLayer";gs.defaultProps=Y3;var c1=gs;function cf(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function s1(e){return e.properties?.layerName||null}function o1(e){return e!=null&&e!==""}function i1(e,t,r){let n={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>r1(e.geometry,t,r).coordinates}),n}var l1="0123456789bcdefghjkmnpqrstuvwxyz",f1={};for(let e=0;e<l1.length;e++)f1[l1.charAt(e)]=e;var K3=-90,Q3=90,Z3=-180,$3=180;function tL(e){let t=!0,r=Q3,n=K3,s=$3,o=Z3,i,a=0;for(let c=0,l=e.length;c<l;c++){let f=e[c].toLowerCase();a=f1[f];for(let u=4;u>=0;u--){let h=a>>u&1;t?(i=(s+o)/2,h===1?o=i:s=i):(i=(r+n)/2,h===1?n=i:r=i),t=!t}}return[n,o,r,s]}function u1(e){let[t,r,n,s]=tL(e);return[s,n,s,t,r,t,r,n,s,n]}var eL={getGeohash:{type:"accessor",value:e=>e.geohash}},As=class extends Ft{indexToBounds(){let{data:t,getGeohash:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>u1(r(n,s))}}};As.layerName="GeohashLayer";As.defaultProps=eL;var h1=As;return y1(xs);})();
|
|
1098
|
+
`;function JB(e){let t=e.positions||e.POSITION,r=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var jB={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Wn=class extends em.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Ic,Qp),{...t,vs:Zp,fs:$p}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let r=this.getAttributeManager();t&&r.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:r,oldProps:n}=t;r.pbrMaterial!==n.pbrMaterial&&this.updatePbrMaterialUniforms(r.pbrMaterial)}draw(t){let{featureIds:r}=this.props,{model:n}=this.state;if(!n)return;let s={pickFeatureIds:Boolean(r)},o={camera:this.context.viewport.cameraPosition};n.shaderInputs.setProps({pbrProjection:o,mesh:s}),super.draw(t)}getModel(t){let{id:r}=this.props,n=this.parseMaterial(this.props.pbrMaterial,t);this.setState({parsedPBRMaterial:n});let s=this.getShaders();return JB(t.attributes),new tm.Model(this.context.device,{...this.getShaders(),id:r,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...n?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:n?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:r}=this.state;if(r){let{mesh:n}=this.props,s=this.parseMaterial(t,n);this.setState({parsedPBRMaterial:s});let{pbr_baseColorSampler:o}=s.bindings,{emptyTexture:i}=this.state,a={sampler:o||i,hasTexture:Boolean(o)},{camera:c,...l}={...s.bindings,...s.uniforms};r.shaderInputs.setProps({simpleMesh:a,pbrMaterial:l})}}parseMaterial(t,r){let n=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Bc(this.context.device,{unlit:n,...t},{NORMAL:r.attributes.normals,TEXCOORD_0:r.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let r=this.props.featureIds,n=new Uint8ClampedArray(r.length*t.size),s=[];for(let o=0;o<r.length;o++)this.encodePickingColor(r[o],s),n[o*3]=s[0],n[o*3+1]=s[1],n[o*3+2]=s[2];t.value=n}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(r=>r.destroy()),this.setState({parsedPBRMaterial:null})}};Wn.layerName="MeshLayer";Wn.defaultProps=jB;var rm=Wn;var y0=D(Nr(),1);var pe=6356752314245179e-9,XB={radii:[6378137,6378137,pe],radiiSquared:[6378137*6378137,6378137*6378137,pe*pe],oneOverRadii:[1/6378137,1/6378137,1/pe],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(pe*pe)],maximumRadius:Math.max(6378137,6378137,pe),centerToleranceSquared:.1};function So(e){return e}var uU=new x;function WB(e,t=[],r=So){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function sm(e,t=[]){return WB(e,t,Q._cartographicRadians?So:Yi)}function YB(e,t,r=So){return"longitude"in t?(t.longitude=r(e[0]),t.latitude=r(e[1]),t.height=e[2]):"x"in t?(t.x=r(e[0]),t.y=r(e[1]),t.z=e[2]):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function om(e,t){return YB(e,t,Q._cartographicRadians?So:Ki)}var im=1e-14,KB=new x,am={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"}},wc={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Yn={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},QB=new x,ZB=new x,$B=new x;function Lc(e,t,r,n,s,o){let i=am[t]&&am[t][r];ft(i&&(!n||n===i));let a,c,l,f=KB.copy(s);if(Et(f.x,0,im)&&Et(f.y,0,im)){let h=Math.sign(f.z);a=QB.fromArray(wc[t]),t!=="east"&&t!=="west"&&a.scale(h),c=ZB.fromArray(wc[r]),r!=="east"&&r!=="west"&&c.scale(h),l=$B.fromArray(wc[n]),n!=="east"&&n!=="west"&&l.scale(h)}else{let{up:h,east:d,north:p}=Yn;d.set(-f.y,f.x,0).normalize(),e.geodeticSurfaceNormal(f,h),p.copy(h).cross(d);let{down:A,west:m,south:y}=Yn;A.copy(h).scale(-1),m.copy(d).scale(-1),y.copy(p).scale(-1),a=Yn[t],c=Yn[r],l=Yn[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=l.x,o[9]=l.y,o[10]=l.z,o[11]=0,o[12]=f.x,o[13]=f.y,o[14]=f.z,o[15]=1,o}var Dr=new x,tC=new x,eC=new x;function cm(e,t,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:o}=t;Dr.from(e);let i=Dr.x,a=Dr.y,c=Dr.z,l=n.x,f=n.y,u=n.z,h=i*i*l*l,d=a*a*f*f,p=c*c*u*u,A=h+d+p,m=Math.sqrt(1/A);if(!Number.isFinite(m))return;let y=tC;if(y.copy(e).scale(m),A<o)return y.to(r);let _=s.x,E=s.y,M=s.z,B=eC;B.set(y.x*_*2,y.y*E*2,y.z*M*2);let C=(1-m)*Dr.len()/(.5*B.len()),L=0,b,T,g,S;do{C-=L,b=1/(1+C*_),T=1/(1+C*E),g=1/(1+C*M);let R=b*b,F=T*T,v=g*g,G=R*b,X=F*T,z=v*g;S=h*R+d*F+p*v-1;let K=-2*(h*G*_+d*X*E+p*z*M);L=S/K}while(Math.abs(S)>Pt.EPSILON12);return Dr.scale([b,T,g]).to(r)}var Io=new x,lm=new x,sC=new x,Wt=new x,oC=new x,wo=new x,U=class{constructor(t=0,r=0,n=0){this.centerToleranceSquared=Pt.EPSILON1,ft(t>=0),ft(r>=0),ft(n>=0),this.radii=new x(t,r,n),this.radiiSquared=new x(t*t,r*r,n*n),this.radiiToTheFourth=new x(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new x(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=lm,s=sC,[,,o]=t;this.geodeticSurfaceNormalCartographic(t,n),s.copy(this.radiiSquared).scale(n);let i=Math.sqrt(n.dot(s));return s.scale(1/i),n.scale(o),s.add(n),s.to(r)}cartesianToCartographic(t,r=[0,0,0]){wo.from(t);let n=this.scaleToGeodeticSurface(wo,Wt);if(!n)return;let s=this.geodeticSurfaceNormal(n,lm),o=oC;o.copy(wo).subtract(n);let i=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(Je.dot(o,wo))*Je.length(o);return om([i,a,c],r)}eastNorthUpToFixedFrame(t,r=new O){return Lc(this,"east","north","up",t,r)}localFrameToFixedFrame(t,r,n,s,o=new O){return Lc(this,t,r,n,s,o)}geocentricSurfaceNormal(t,r=[0,0,0]){return Io.from(t).normalize().to(r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=sm(t),s=n[0],o=n[1],i=Math.cos(o);return Io.set(i*Math.cos(s),i*Math.sin(s),Math.sin(o)).normalize(),Io.to(r)}geodeticSurfaceNormal(t,r=[0,0,0]){return Io.from(t).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(t,r){return cm(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Wt.from(t);let n=Wt.x,s=Wt.y,o=Wt.z,i=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*i.x+s*s*i.y+o*o*i.z);return Wt.multiplyScalar(a).to(r)}transformPositionToScaledSpace(t,r=[0,0,0]){return Wt.from(t).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(t,r=[0,0,0]){return Wt.from(t).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){ft(Et(this.radii.x,this.radii.y,Pt.EPSILON15)),ft(this.radii.z>0),Wt.from(t);let s=Wt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-r))return Wt.set(0,0,s).to(n)}};U.WGS84=new U(6378137,6378137,pe);var Lo=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var vo=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Lo(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var Ro=class{_list;_sentinel;_trimTiles;constructor(){this._list=new vo,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let s=r._cacheNode;s&&(this._list.remove(s),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let s=this._list,o=t.maximumMemoryUsage*1024*1024,i=this._sentinel,a=s.head;for(;a!==i&&(t.gpuMemoryUsageInBytes>o||n);){let c=a.item;a=a.next,this.unloadTile(t,c,r)}}trim(){this._trimTiles=!0}};function fm(e,t){H(e),H(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:s,boundingVolume:{center:o}}=e,i=new O(s);switch(r&&i.translate(r),n){case"Z":break;case"Y":let u=new O().rotateX(Math.PI/2);i=i.multiplyRight(u);break;case"X":let h=new O().rotateY(-Math.PI/2);i=i.multiplyRight(h);break;default:break}t.isQuantized&&i.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(o);t.cartesianModelMatrix=i,t.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),f=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=f.multiplyRight(i),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var um=new x,vc=new x,Rc=new ct([new ut,new ut,new ut,new ut,new ut,new ut]);function dm(e,t){let{cameraDirection:r,cameraUp:n,height:s}=e,{metersPerUnit:o}=e.distanceScales,i=Fo(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(i),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),f=new x(a.transformAsVector(new x(r).scale(o))).normalize(),u=new x(a.transformAsVector(new x(n).scale(o))).normalize();iC(e);let h=e.constructor,{longitude:d,latitude:p,width:A,bearing:m,zoom:y}=e,_=new h({longitude:d,latitude:p,height:s,width:A,bearing:m,zoom:y,pitch:0});return{camera:{position:l,direction:f,up:u},viewport:e,topDownViewport:_,height:s,cullingVolume:Rc,frameNumber:t,sseDenominator:1.15}}function pm(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:s,latitude:o}=t.viewport;for(let[l,f]of e.entries()){let[u,h]=f.header.mbs,d=Math.abs(s-u),p=Math.abs(o-h),A=Math.sqrt(p*p+d*d);n.push([l,A])}let i=n.sort((l,f)=>l[1]-f[1]),a=[];for(let l=0;l<r;l++)a.push(e[i[l][0]]);let c=[];for(let l=r;l<i.length;l++)c.push(e[i[l][0]]);return[a,c]}function iC(e){let t=e.getFrustumPlanes(),r=hm(t.near,e.cameraPosition),n=Fo(e,r),s=Fo(e,e.cameraPosition,vc),o=0;Rc.planes[o++].fromPointNormal(n,um.copy(n).subtract(s));for(let i in t){if(i==="near")continue;let a=t[i],c=hm(a,r,vc),l=Fo(e,c,vc);Rc.planes[o++].fromPointNormal(l,um.copy(n).subtract(l))}}function hm(e,t,r=new x){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Fo(e,t,r=new x){let n=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(n,r)}var aC=6378137,cC=6378137,Fc=6356752314245179e-9,Gr=new x;function mm(e,t){if(e instanceof Xt){let{halfAxes:r}=e,n=lC(r);return Math.log2(Fc/(n+t[2]))}else if(e instanceof Nt){let{radius:r}=e;return Math.log2(Fc/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,s=Math.log2(aC/r),o=Math.log2(cC/n);return(s+o)/2}return 1}function Pc(e,t,r){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Gr);let n=Math.sqrt(Math.pow(Gr[0]-r[0],2)+Math.pow(Gr[1]-r[1],2)+Math.pow(Gr[2]-r[2],2));return Math.log2(Fc/(n+t[2]))}function gm(e,t,r){let[n,s,o,i]=e;return Pc({xmin:n,xmax:o,ymin:s,ymax:i,zmin:0,zmax:0},t,r)}function lC(e){e.getColumn(0,Gr);let t=e.getColumn(1),r=e.getColumn(2);return Gr.add(t).add(r).len()}var Fm=D(Nr(),1);var Mt={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},mt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(mt||(mt={}));var Gt;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Gt||(Gt={}));var ht;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(ht||(ht={}));var me;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(me||(me={}));var Am={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function Em(e){return e!=null}var gt=new x,Po=new x,fC=new x,uC=new x,sr=new x,xm=new x,ym=new x,Tm=new x;function Oo(e,t,r){if(H(e,"3D Tile: boundingVolume must be defined"),e.box)return Mm(e.box,t,r);if(e.region)return dC(e.region);if(e.sphere)return hC(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function _m(e,t){if(e.box)return pC(t);if(e.region){let[r,n,s,o,i,a]=e.region;return[[Lt(r),Lt(n),i],[Lt(s),Lt(o),a]]}if(e.sphere)return mC(t);throw new Error("Unkown boundingVolume type")}function Mm(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=[];if(e.length===10){let l=e.slice(3,6),f=new $t;f.fromArray(e,6);let u=new x([1,0,0]),h=new x([0,1,0]),d=new x([0,0,1]);u.transformByQuaternion(f),u.scale(l[0]),h.transformByQuaternion(f),h.scale(l[1]),d.transformByQuaternion(f),d.scale(l[2]),s=[...u.toArray(),...h.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(s.slice(0,3)),i=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new J([o[0],o[1],o[2],i[0],i[1],i[2],a[0],a[1],a[2]]);return Em(r)?(r.center=n,r.halfAxes=c,r):new Xt(n,c)}function hC(e,t,r){let n=new x(e[0],e[1],e[2]);t.transform(n,n);let s=t.getScale(Po),o=Math.max(Math.max(s[0],s[1]),s[2]),i=e[3]*o;return Em(r)?(r.center=n,r.radius=i,r):new Nt(n,i)}function dC(e){let[t,r,n,s,o,i]=e,a=U.WGS84.cartographicToCartesian([Lt(t),Lt(s),o],fC),c=U.WGS84.cartographicToCartesian([Lt(n),Lt(r),i],uC),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,sr),U.WGS84.cartographicToCartesian([Lt(n),sr[1],sr[2]],xm),U.WGS84.cartographicToCartesian([sr[0],Lt(s),sr[2]],ym),U.WGS84.cartographicToCartesian([sr[0],sr[1],i],Tm),Mm([...l,...xm.subtract(l),...ym.subtract(l),...Tm.subtract(l)],new O)}function pC(e){let t=bm(),{halfAxes:r}=e,n=new x(r.getColumn(0)),s=new x(r.getColumn(1)),o=new x(r.getColumn(2));for(let i=0;i<2;i++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)gt.copy(e.center),gt.add(n),gt.add(s),gt.add(o),Bm(t,gt),o.negate();s.negate()}n.negate()}return t}function mC(e){let t=bm(),{center:r,radius:n}=e,s=U.WGS84.scaleToGeodeticSurface(r,gt),o;s?o=U.WGS84.geodeticSurfaceNormal(s):o=new x(0,0,1);let i=new x(o[2],-o[1],0);i.len()>0?i.normalize():i=new x(0,1,0);let a=i.clone().cross(o);for(let c of[i,a,o]){Po.copy(c).scale(n);for(let l=0;l<2;l++)gt.copy(r),gt.add(Po),Bm(t,gt),Po.negate()}return t}function bm(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Bm(e,t){U.WGS84.cartesianToCartographic(t,gt),e[0][0]=Math.min(e[0][0],gt[0]),e[0][1]=Math.min(e[0][1],gt[1]),e[0][2]=Math.min(e[0][2],gt[2]),e[1][0]=Math.max(e[1][0],gt[0]),e[1][1]=Math.max(e[1][1],gt[1]),e[1][2]=Math.max(e[1][2],gt[2])}var QU=new x,ZU=new x,$U=new O,t4=new x,e4=new x,r4=new x;function gC(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function AC(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let r=e.dynamicScreenSpaceErrorComputedDensity,n=e.dynamicScreenSpaceErrorFactor;return gC(t,r)*n}return 0}function Cm(e,t,r){let n=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,o=r?s:e.lodMetricValue;if(o===0)return 0;let i=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=n.options,f=o*a*(l||1)/(i*c);return f-=AC(n,i),f}var Oc=new x,Sm=new x,Pe=new x,Im=new x,xC=new x,Nc=new O,wm=new O;function Lm(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let r=2*Dc(e,t);return r<2?"OUT":!e.header.children||r<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Dc(e,t){let{topDownViewport:r}=t,n=e.header.mbs[1],s=e.header.mbs[0],o=e.header.mbs[2],i=e.header.mbs[3],a=[...e.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);U.WGS84.cartographicToCartesian(c,Oc),Sm.copy(Oc).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,Nc),wm.copy(Nc).invert(),Pe.copy(Oc).transform(wm);let l=Math.sqrt(Pe[0]*Pe[0]+Pe[1]*Pe[1]),f=l*l/Pe[2];Im.copy([Pe[0],Pe[1],f]);let h=Im.transform(Nc).subtract(a).normalize(),p=Sm.cross(h).normalize().scale(i).add(a),A=U.WGS84.cartesianToCartographic(p),m=r.project([s,n,o]),y=r.project(A);return xC.copy(m).subtract(y).magnitude()}function vm(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Kn=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return H(t<this._array.length),this._array[t]}set(t,r){H(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){H(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){H(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var yC={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ie=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Kn;_emptyTraversalStack=new Kn;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...yC,...t}}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let o=n.pop(),i=!1;this.canTraverse(o,r)&&(this.updateChildTiles(o,r),i=this.updateAndPushChildren(o,r,n,o.hasRenderContent?o._selectionDepth+1:o._selectionDepth));let a=o.parent,c=Boolean(!a||a._shouldRefine),l=!i;o.hasRenderContent?o.refine===mt.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===mt.REPLACE&&(this.loadTile(o,r),l&&this.selectTile(o,r)):(this.emptyTiles[o.id]=o,this.loadTile(o,r),l&&this.selectTile(o,r)),this.touchTile(o,r),o._shouldRefine=i&&c}let s=new Date().getTime();(this.traversalFinished(r)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(r))}updateChildTiles(t,r){let n=t.children;for(let s of n)this.updateTile(s,r)}updateAndPushChildren(t,r,n,s){let{loadSiblings:o,skipLevelOfDetail:i}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===mt.REPLACE&&t.hasRenderContent&&!i,l=!1,f=!0;for(let u of a)if(u._selectionDepth=s,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&(this.loadTile(u,r),this.touchTile(u,r)),c){let h;if(u._inRequestVolume?u.hasRenderContent?h=u.contentAvailable:h=this.executeEmptyTraversal(u,r):h=!1,f=f&&h,!f)return!1}return l||(f=!1),f}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){this.shouldLoadTile(t)&&(t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,r,n=!1){let s=t._screenSpaceError;return n&&(s=t.getScreenSpaceError(r,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===r.viewport.id&&n.push(s);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let s of t.children)s.updateVisibility(r),n=n||s.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let o=s.pop(),i=!o.hasRenderContent&&this.canTraverse(o,r),a=!o.hasRenderContent&&o.children.length===0;if(!i&&!o.contentAvailable&&!a&&(n=!1),this.updateTile(o,r),o.isVisibleAndInRequestVolume||(this.loadTile(o,r),this.touchTile(o,r)),i){let c=o.children;for(let l of c)s.push(l)}}return n}};var Rm=new x;function TC(e){return e!=null}var or=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=Mt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new O;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new ie({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new O;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,r,n,s=""){this.header=r,this.tileset=t,this.id=s||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}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===Mt.READY||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===Mt.UNLOADED}get contentExpired(){return this.contentState===Mt.EXPIRED}get contentFailed(){return this.contentState===Mt.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=_m(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,r){switch(this.tileset.type){case ht.I3S:return Dc(this,t);case ht.TILES3D:return Cm(this,t,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:r}=t.options,n=this.refine===mt.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===Mt.UNLOADED)return-1;let s=this.parent,i=s&&(!n||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.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=Mt.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=Mt.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,o={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,Fm.load)(n,s,o),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=Mt.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=Mt.FAILED,n}finally{r.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=Mt.UNLOADED,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,s=n?n._visibilityPlaneMask:ct.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==ct.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:s}=this;return n.computeVisibilityWithPlaneMask(s,r)}contentVisibility(){return!0}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return Rm.subVectors(r.center,t.position),t.direction.dot(Rm)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(TC(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=Mt.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.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 t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new O(t.transform):new O;let r=this.parent,n=this.tileset,s=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new O(s).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new O;this._initialTransform=new O(o).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=Mt.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ct.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(t){return t||this.parent&&this.parent.refine||mt.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=Oo(t.boundingVolume,this.computedTransform,this.boundingVolume);let r=t.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=Oo(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Oo(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new O){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){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 vm(this.tileset.tileset)}}};var No=class extends ie{compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let i=t.children[0];this.updateTileVisibility(i,r),t._visible=i._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let s=t.refine===mt.REPLACE,o=t._optimChildrenWithinParent===Am.USE_OPTIMIZATION;if(s&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==mt.ADD?!1:!this.shouldRefine(t,r,!0)}};var Pm=D(Nr(),1);var Do=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,s=n.get(r)||0;n.set(r,s+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let s=n.get(r)||1;n.set(r,s-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var Gc={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Go=class{_statusMap;pendingTilesRegister=new Do;constructor(){this._statusMap={}}add(t,r,n,s){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:i}}=s;this._statusMap[r]={request:t,callback:n,key:r,frameState:s,status:Gc.REQUESTED},this.pendingTilesRegister.register(i,o),t().then(a=>{this._statusMap[r].status=Gc.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,s)}).catch(a=>{this._statusMap[r].status=Gc.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,n);let{frameNumber:o,viewport:{id:i}}=r;this.pendingTilesRegister.register(i,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var Uo=class extends ie{_tileManager;constructor(t){super(t),this._tileManager=new Go}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Lm(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],s=t.children,o=t.tileset;for(let i of n){let a=`${i.id}-${r.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,r);else{let l=()=>this._loadTile(i.id,o);this._tileManager.find(a)?this._tileManager.update(a,r):(o.tileset.nodePages&&(l=()=>o.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(l,a,u=>this._onTileLoad(u,t,a),r))}}return!1}async _loadTile(t,r){let{loader:n}=r,s=r.getTileUrl(`${r.url}/nodes/${t}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,Pm.load)(s,n,o)}_onTileLoad(t,r,n){let s=new or(r.tileset,t,r,n);r.children.push(s);let o=this._tileManager.find(s.id).frameState;this.updateTile(s,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,o)}};var EC={description:"",ellipsoid:U.WGS84,modelMatrix:new O,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},Vo="Tiles In Tileset(s)",Uc="Tiles In Memory",Om="Tiles In View",Nm="Tiles To Render",Dm="Tiles Loaded",Vc="Tiles Loading",Gm="Tiles Unloaded",Um="Failed Tile Loads",Vm="Points/Vertices",Hc="Tile Memory Use",Hm="Maximum Screen Space Error",Qn=class{options;loadOptions;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};description="";properties;extras=null;attributions={};credits={};stats;contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1};cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;maximumMemoryUsage=32;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=0;_cacheOverflowBytes=0;_frameNumber=0;_queryParams={};_extensionsUsed=[];_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_traverser;_cache=new Ro;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,r){this.options={...EC,...r},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Ie.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new Se({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new Ce({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let n=t;return this.queryParams.length&&(n=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let s of r){let o=s.id;this._needTraverse(o)?n.push(o):this.traverseCounter--}for(let s of r){let o=s.id;if(this.roots[o]||(this.roots[o]=this._initializeTileHeaders(this.tileset,null)),!n.includes(o))continue;let i=dm(s,this._frameNumber);this._traverser.traverse(this.roots[o],i,this.options)}}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],s=Object.values(this._traverser.selectedTiles),[o,i]=pm(s,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of i)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let r=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(i=>i.id)),s=new Set(r.map(i=>i.id)),o=t.filter(i=>!s.has(i.id)).length>0;return o=o||r.filter(i=>!n.has(i.id)).length>0,o}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r))}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(t++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(Om).count=this.selectedTiles.length,this.stats.get(Nm).count=t,this.stats.get(Vm).count=r,this.stats.get(Hm).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===ht.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===ht.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===ht.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:n,xmax:s,ymin:o,ymax:i,zmin:a,zmax:c}=t;this.cartographicCenter=new x(n+(s-n)/2,o+(i-o)/2,a+(c-a)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Pc(t,this.cartographicCenter,this.cartesianCenter);return}let r=this.tileset.store?.extent;if(r){let[n,s,o,i]=r;this.cartographicCenter=new x(n+(o-n)/2,s+(i-s)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=gm(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:r}=t.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=mm(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Vo),this.stats.get(Vc),this.stats.get(Uc),this.stats.get(Om),this.stats.get(Nm),this.stats.get(Dm),this.stats.get(Gm),this.stats.get(Um),this.stats.get(Vm),this.stats.get(Hc,"memory"),this.stats.get(Hm)}_initializeTileHeaders(t,r){let n=new or(this,t.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===ht.TILES3D){let s=[];for(s.push(n);s.length>0;){let o=s.pop();this.stats.get(Vo).incrementCount();let i=o.header.children||[];for(let a of i){let c=new or(this,a,o);if(c.contentUrl?.includes("?session=")){let f=new URL(c.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}o.children.push(c),c.depth=o.depth+1,s.push(c)}}}return n}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=No;break;case ht.I3S:t=Uo;break;default:t=ie}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){this._onTileLoadError(t,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}_onTileLoadError(t,r){this.stats.get(Um).incrementCount();let n=r.message||r.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,s)}_onTileLoad(t,r){if(r){if(this.type===ht.I3S){let n=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(Vo).reset(),this.stats.get(Vo).addCount(n)}t&&t.content&&fm(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===ht.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ht.TILES3D){let{extensionsRemoved:r=[]}=t.content?.gltf||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Vc).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Vc).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(Dm).incrementCount(),this.stats.get(Uc).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Hc).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(Uc).decrementCount(),this.stats.get(Gm).incrementCount(),this.stats.get(Hc).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[];for(n.push(r);n.length>0;){t=n.pop();for(let s of t.children)n.push(s);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let r=new URLSearchParams(t.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var Ho="4.3.3";var ir={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Q4=Object.keys(ir);function zc(e,t,r){H(e instanceof ArrayBuffer);let n=new TextDecoder("utf8"),s=new Uint8Array(e,t,r);return n.decode(s)}function zm(e,t=0){let 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))}`}var qm="4.3.3";var km={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:qm,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function Jm(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function ar(e){let t=1/0,r=1/0,n=1/0,s=-1/0,o=-1/0,i=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let f=a[l],u=a[l+1],h=a[l+2];t=f<t?f:t,r=u<r?u:r,n=h<n?h:n,s=f>s?f:s,o=u>o?u:o,i=h>i?h:i}return[[t,r,n],[s,o,i]]}function qc(e,t,r){let n=Jm(t.value),s=r||jm(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function jm(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function Wm(e,t,r){let n=Ym(t.metadata),s=[],o=_C(t.attributes);for(let i in e){let a=e[i],c=Xm(i,a,o[i]);s.push(c)}if(r){let i=Xm("indices",r);s.push(i)}return{fields:s,metadata:n}}function _C(e){let t={};for(let r in e){let n=e[r];t[n.name||"undefined"]=n}return t}function Xm(e,t,r){let n=r?Ym(r.metadata):void 0;return qc(e,t,n)}function Ym(e){Object.entries(e);let t={};for(let r in e)t[`${r}.string`]=JSON.stringify(e[r]);return t}var Km={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},MC={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},bC=4,Zn=class{draco;decoder;metadataQuerier;constructor(t){this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,r={}){let n=new this.draco.DecoderBuffer;n.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(r);let s=this.decoder.GetEncodedGeometryType(n),o=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let i;switch(s){case this.draco.TRIANGULAR_MESH:i=this.decoder.DecodeBufferToMesh(n,o);break;case this.draco.POINT_CLOUD:i=this.decoder.DecodeBufferToPointCloud(n,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!i.ok()||!o.ptr){let h=`DRACO decompression failed: ${i.error_msg()}`;throw new Error(h)}let a=this._getDracoLoaderData(o,s,r),c=this._getMeshData(o,a,r),l=ar(c.attributes),f=Wm(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:l},...c,schema:f}}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}_getDracoLoaderData(t,r,n){let s=this._getTopLevelMetadata(t),o=this._getDracoAttributes(t,n);return{geometry_type:r,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:o}}_getDracoAttributes(t,r){let n={};for(let s=0;s<t.num_attributes();s++){let o=this.decoder.GetAttribute(t,s),i=this._getAttributeMetadata(t,s);n[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:s,metadata:i};let a=this._getQuantizationTransform(o,r);a&&(n[o.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(o,r);c&&(n[o.unique_id()].octahedron_transform=c)}return n}_getMeshData(t,r,n){let s=this._getMeshAttributes(r,t,n);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,r,n){let s={};for(let o of Object.values(t.attributes)){let i=this._deduceAttributeName(o,n);o.name=i;let a=this._getAttributeValues(r,o);if(a){let{value:c,size:l}=a;s[i]={value:c,size:l,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}}return s}_getTriangleListIndices(t){let n=t.num_faces()*3,s=n*bC,o=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,o),new Uint32Array(this.draco.HEAPF32.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(t){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,r),SC(r)}finally{this.draco.destroy(r)}}_getAttributeValues(t,r){let n=MC[r.data_type];if(!n)return console.warn(`DRACO: Unsupported attribute type ${r.data_type}`),null;let s=r.num_components,i=t.num_points()*s,a=i*n.BYTES_PER_ELEMENT,c=BC(this.draco,n),l,f=this.draco._malloc(a);try{let u=this.decoder.GetAttribute(t,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,u,c,a,f),l=new n(this.draco.HEAPF32.buffer,f,i).slice()}finally{this.draco._free(f)}return{value:l,size:s}}_deduceAttributeName(t,r){let n=t.unique_id;for(let[i,a]of Object.entries(r.extraAttributes||{}))if(a===n)return i;let s=t.attribute_type;for(let i in Km)if(this.draco[i]===s)return Km[i];let o=r.attributeNameEntry||"name";return t.metadata[o]?t.metadata[o].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(t){let r=this.decoder.GetMetadata(t);return this._getDracoMetadata(r)}_getAttributeMetadata(t,r){let n=this.decoder.GetAttributeMetadata(t,r);return this._getDracoMetadata(n)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(t);for(let s=0;s<n;s++){let o=this.metadataQuerier.GetEntryName(t,s);r[o]=this._getDracoMetadataField(t,o)}return r}_getDracoMetadataField(t,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,r,n);let s=CC(n);return{int:this.metadataQuerier.GetIntEntry(t,r),string:this.metadataQuerier.GetStringEntry(t,r),double:this.metadataQuerier.GetDoubleEntry(t,r),intArray:s}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(t){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=t,s=[...r,...n];for(let o of s)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(t,r){let{quantizedAttributes:n=[]}=r,s=t.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits(),range:i.range(),min_values:new Float32Array([1,2,3]).map(a=>i.min_value(a))}}finally{this.draco.destroy(i)}}return null}_getOctahedronTransform(t,r){let{octahedronAttributes:n=[]}=r,s=t.attribute_type();if(n.map(i=>this.decoder[i]).includes(s)){let i=new this.draco.AttributeQuantizationTransform;try{if(i.InitFromAttribute(t))return{quantization_bits:i.quantization_bits()}}finally{this.draco.destroy(i)}}return null}};function BC(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}}function CC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}function SC(e){let t=e.size(),r=new Int32Array(t);for(let n=0;n<t;n++)r[n]=e.GetValue(n);return r}var IC="1.5.6",wC="1.4.1",kc=`https://www.gstatic.com/draco/versioned/decoders/${IC}`,Bt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Jc={[Bt.DECODER]:`${kc}/${Bt.DECODER}`,[Bt.DECODER_WASM]:`${kc}/${Bt.DECODER_WASM}`,[Bt.FALLBACK_DECODER]:`${kc}/${Bt.FALLBACK_DECODER}`,[Bt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${wC}/javascript/${Bt.ENCODER}`},jc;async function Qm(e){let t=e.modules||{};return t.draco3d?jc||=t.draco3d.createDecoderModule({}).then(r=>({draco:r})):jc||=LC(e),await jc}async function LC(e){let t,r;switch(e.draco&&e.draco.decoderType){case"js":t=await re(Jc[Bt.FALLBACK_DECODER],"draco",e,Bt.FALLBACK_DECODER);break;case"wasm":default:[t,r]=await Promise.all([await re(Jc[Bt.DECODER],"draco",e,Bt.DECODER),await re(Jc[Bt.DECODER_WASM],"draco",e,Bt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await vC(t,r)}function vC(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e({...r,onModuleLoaded:s=>n({draco:s})})})}var zo={...km,parse:RC};async function RC(e,t){let{draco:r}=await Qm(t),n=new Zn(r);try{return n.parseSync(e,t?.draco)}finally{n.destroy()}}var FC={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},at={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},N={...FC,...at};var Xc={[at.DOUBLE]:Float64Array,[at.FLOAT]:Float32Array,[at.UNSIGNED_SHORT]:Uint16Array,[at.UNSIGNED_INT]:Uint32Array,[at.UNSIGNED_BYTE]:Uint8Array,[at.BYTE]:Int8Array,[at.SHORT]:Int16Array,[at.INT]:Int32Array},PC={DOUBLE:at.DOUBLE,FLOAT:at.FLOAT,UNSIGNED_SHORT:at.UNSIGNED_SHORT,UNSIGNED_INT:at.UNSIGNED_INT,UNSIGNED_BYTE:at.UNSIGNED_BYTE,BYTE:at.BYTE,SHORT:at.SHORT,INT:at.INT},Wc="Failed to convert GL type",At=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let r in Xc)if(Xc[r]===t)return r;throw new Error(Wc)}static fromName(t){let r=PC[t];if(!r)throw new Error(Wc);return r}static getArrayType(t){switch(t){case at.UNSIGNED_SHORT_5_6_5:case at.UNSIGNED_SHORT_4_4_4_4:case at.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=Xc[t];if(!r)throw new Error(Wc);return r}}static getByteSize(t){return At.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(At.getArrayType(t))}static createTypedArray(t,r,n=0,s){s===void 0&&(s=(r.byteLength-n)/At.getByteSize(t));let o=At.getArrayType(t);return new o(r,n,s)}};function Zm(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function Yc(e,t=[0,0,0]){let r=e>>11&31,n=e>>5&63,s=e&31;return t[0]=r<<3,t[1]=n<<2,t[2]=s<<3,t}var v9=1/256;var R9=new ze,F9=new x,P9=new ze,O9=new ze,N9=new Uint8Array(1);function $m(e,t=255){return Gs(e,0,t)/t*2-1}function tg(e){return e<0?-1:1}function eg(e,t,r,n){if(Zm(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=$m(e,r),n.y=$m(t,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let s=n.x;n.x=(1-Math.abs(n.y))*tg(s),n.y=(1-Math.abs(s))*tg(n.y)}return n.normalize()}function Kc(e,t,r){return eg(e,t,255,r)}var ge=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,r){this.json=t,this.buffer=r}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,r=N.UNSIGNED_INT,n=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,r,n,1,s.byteOffset):s}getPropertyArray(t,r,n){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(r=At.fromName(s.componentType)),this._getTypedArrayFromBinary(t,r,n,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,r,s)}getProperty(t,r,n,s,o){let i=this.json[t];if(!i)return i;let a=this.getPropertyArray(t,r,n);if(n===1)return a[s];for(let c=0;c<n;++c)o[c]=a[n*s+c];return o}_getTypedArrayFromBinary(t,r,n,s,o){let i=this._cachedTypedArrays,a=i[t];return a||(a=At.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+o,s*n),i[t]=a),a}_getTypedArrayFromArray(t,r,n){let s=this._cachedTypedArrays,o=s[t];return o||(o=At.createTypedArray(r,n),s[t]=o),o}};var OC={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},NC={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]]},DC={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]}};function rg(e,t,r,n){let{componentType:s}=e;H(e.componentType);let o=typeof s=="string"?At.fromName(s):s,i=OC[e.type],a=NC[e.type],c=DC[e.type];return r+=e.byteOffset,{values:At.createTypedArray(o,t,r,i*n),type:o,size:i,unpacker:a,packer:c}}var ae=e=>e!==void 0;function ng(e,t,r){if(!t)return null;let n=e.getExtension("3DTILES_batch_table_hierarchy"),s=t.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?GC(n,r):null}function GC(e,t){let r,n,s,o=e.instancesLength,i=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,f=o;ae(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,o));let u;if(ae(c))for(ae(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,o)),u=new Uint16Array(o),f=0,r=0;r<o;++r)u[r]=f,f+=c[r];ae(l)&&ae(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,f));let h=i.length;for(r=0;r<h;++r){let m=i[r].length,y=i[r].instances,_=getBinaryProperties(m,y,t);i[r].instances=combine(_,y)}let d=new Array(h).fill(0),p=new Uint16Array(o);for(r=0;r<o;++r)n=a[r],p[r]=d[n],++d[n];let A={classes:i,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:u,parentIds:l};return HC(A),A}function Ur(e,t,r){if(!e)return;let n=e.parentCounts;return e.parentIds?r(e,t):n>0?UC(e,t,r):VC(e,t,r)}function UC(e,t,r){let n=e.classIds,s=e.parentCounts,o=e.parentIds,i=e.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,f=scratchStack;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),c[t]===l)continue;c[t]=l;let u=r(e,t);if(ae(u))return u;let h=s[t],d=i[t];for(let p=0;p<h;++p){let A=o[d+p];A!==t&&f.push(A)}}return null}function VC(e,t,r){let n=!0;for(;n;){let s=r(e,t);if(ae(s))return s;let o=e.parentIds[t];n=o!==t,t=o}throw new Error("traverseHierarchySingleParent")}function HC(e){let t=[],n=e.classIds.length;for(let s=0;s<n;++s)sg(e,s,stack)}function sg(e,t,r){let n=e.parentCounts,s=e.parentIds,o=e.parentIndexes,a=e.classIds.length;if(!ae(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(r.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(t);let c=ae(n)?n[t]:1,l=ae(n)?o[t]:t;for(let f=0;f<c;++f){let u=s[l+f];u!==t&&sg(e,u,r)}r.pop(t)}function Ct(e){return e!=null}var qo=(e,t)=>e,zC={HIERARCHY:!0,extensions:!0,extras:!0},cr=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,r,n,s={}){H(n>=0),this.json=t||{},this.binary=r,this.featureCount=n,this._extensions=this.json?.extensions||{},this._properties={};for(let o in this.json)zC[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ng(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,r){if(this._checkBatchId(t),H(typeof r=="string",r),this._hierarchy){let n=Ur(this._hierarchy,t,(s,o)=>{let i=s.classIds[o];return s.classes[i].name===r});return Ct(n)}return!1}isExactClass(t,r){return H(typeof r=="string",r),this.getExactClassName(t)===r}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let r=this._hierarchy.classIds[t];return this._hierarchy.classes[r].name}}hasProperty(t,r){return this._checkBatchId(t),H(typeof r=="string",r),Ct(this._properties[r])||this._hasPropertyInHierarchy(t,r)}getPropertyNames(t,r){this._checkBatchId(t),r=Ct(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(t,r),r}getProperty(t,r){if(this._checkBatchId(t),H(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(Ct(s))return this._getBinaryProperty(s,t)}let n=this._properties[r];if(Ct(n))return qo(n[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,r);if(Ct(s))return s}}setProperty(t,r,n){let s=this.featureCount;if(this._checkBatchId(t),H(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(i){this._setBinaryProperty(i,t,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,r,n))return;let o=this._properties[r];Ct(o)||(this._properties[r]=new Array(s),o=this._properties[r]),o[t]=qo(n,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,r){return t.unpack(t.typedArray,r)}_setBinaryProperty(t,r,n){t.pack(n,t.typedArray,r)}_initializeBinaryProperties(){let t=null;for(let r in this._properties){let n=this._properties[r],s=this._initializeBinaryProperty(r,n);s&&(t=t||{},t[r]=s)}return t}_initializeBinaryProperty(t,r){if("byteOffset"in r){let n=r;H(this.binary,`Property ${t} requires a batch table binary.`),H(n.type,`Property ${t} requires a type.`);let s=rg(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(t,r){if(!this._hierarchy)return!1;let n=Ur(this._hierarchy,t,(s,o)=>{let i=s.classIds[o],a=s.classes[i].instances;return Ct(a[r])});return Ct(n)}_getPropertyNamesInHierarchy(t,r){Ur(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o].instances;for(let a in i)i.hasOwnProperty(a)&&r.indexOf(a)===-1&&r.push(a)})}_getHierarchyProperty(t,r){return Ur(this._hierarchy,t,(n,s)=>{let o=n.classIds[s],i=n.classes[o],a=n.classIndexes[s],c=i.instances[r];return Ct(c)?Ct(c.typedArray)?this._getBinaryProperty(c,a):qo(c[a],!0):null})}_setHierarchyProperty(t,r,n,s){let o=Ur(this._hierarchy,r,(i,a)=>{let c=i.classIds[a],l=i.classes[c],f=i.classIndexes[a],u=l.instances[n];return Ct(u)?(H(a===r,`Inherited property "${n}" is read-only.`),Ct(u.typedArray)?this._setBinaryProperty(u,f,s):u[f]=qo(s,!0),!0):!1});return Ct(o)}};function Oe(e,t,r=0){let 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,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return r}var Vr=4,og="b3dm tile in legacy format.";function Hr(e,t,r){let n=new DataView(t),s;e.header=e.header||{};let o=n.getUint32(r,!0);r+=Vr;let i=n.getUint32(r,!0);r+=Vr;let a=n.getUint32(r,!0);r+=Vr;let c=n.getUint32(r,!0);return r+=Vr,a>=570425344?(r-=Vr*2,s=o,a=i,c=0,o=0,i=0,console.warn(og)):c>=570425344&&(r-=Vr,s=a,a=o,c=i,o=0,i=0,console.warn(og)),e.header.featureTableJsonByteLength=o,e.header.featureTableBinaryByteLength=i,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,r}function zr(e,t,r,n){return r=qC(e,t,r,n),r=kC(e,t,r,n),r}function qC(e,t,r,n){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:o,batchLength:i}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:i||0},s&&s>0){let a=zc(t,r,s);e.featureTableJson=JSON.parse(a)}return r+=s||0,e.featureTableBinary=new Uint8Array(t,r,o),r+=o||0,r}function kC(e,t,r,n){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:o}=e.header||{};if(s&&s>0){let i=zc(t,r,s);e.batchTableJson=JSON.parse(i),r+=s,o&&o>0&&(e.batchTableBinary=new Uint8Array(t,r,o),e.batchTableBinary=new Uint8Array(e.batchTableBinary),r+=o)}return r}function Qc(e,t,r){if(!t&&(!e||!e.batchIds||!r))return null;let{batchIds:n,isRGB565:s,pointCount:o=0}=e;if(n&&r){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=n[a],f=r.getProperty(c,"dimensions").map(u=>u*255);i[a*3]=f[0],i[a*3+1]=f[1],i[a*3+2]=f[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}if(t&&s){let i=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=Yc(t[a]);i[a*3]=c[0],i[a*3+1]=c[1],i[a*3+2]=c[2]}return{type:N.UNSIGNED_BYTE,value:i,size:3,normalized:!0}}return t&&t.length===o*3?{type:N.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:N.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var ig=new x;function ag(e,t){if(!t)return null;if(e.isOctEncoded16P){let r=new Float32Array((e.pointsLength||0)*3);for(let n=0;n<(e.pointsLength||0);n++)Kc(t[n*2],t[n*2+1],ig),ig.toArray(r,n*3);return{type:N.FLOAT,size:2,value:r}}return{type:N.FLOAT,size:2,value:t}}function cg(e,t,r){return e.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,JC(e,t)):{type:N.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function JC(e,t){let r=new x,n=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)r.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(n,s*3);return n}async function lg(e,t,r,n,s){r=Oe(e,t,r),r=Hr(e,t,r),r=zr(e,t,r,n),jC(e);let{featureTable:o,batchTable:i}=XC(e);return await ZC(e,o,i,n,s),WC(e,o,n),YC(e,o,i),KC(e,o),r}function jC(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function XC(e){let t=new ge(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",N.FLOAT,3);let n=QC(e,t);return{featureTable:t,batchTable:n}}function WC(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",N.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let n=t.getPropertyArray("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=cg(e,n,r)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function YC(e,t,r){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let n=null;t.hasProperty("RGBA")?(n=t.getPropertyArray("RGBA",N.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?n=t.getPropertyArray("RGB",N.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(n=t.getPropertyArray("RGB565",N.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=Qc(e,n,r)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function KC(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let r=null;t.hasProperty("NORMAL")?r=t.getPropertyArray("NORMAL",N.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(r=t.getPropertyArray("NORMAL_OCT16P",N.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=ag(e,r)}}function QC(e,t){let r=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",N.UNSIGNED_SHORT,1),e.batchIds)){let n=t.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:o}=e;r=new cr(s,o,n)}return r}async function ZC(e,t,r,n,s){let o,i,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){i=l.properties;let u=l.byteOffset,h=l.byteLength;if(!i||!Number.isFinite(u)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(e.featureTableBinary||[]).slice(u,u+h),e.hasPositions=Number.isFinite(i.POSITION),e.hasColors=Number.isFinite(i.RGB)||Number.isFinite(i.RGBA),e.hasNormals=Number.isFinite(i.NORMAL),e.hasBatchIds=Number.isFinite(i.BATCH_ID),e.isTranslucent=Number.isFinite(i.RGBA)}if(!o)return!0;let f={buffer:o,properties:{...i,...a},featureTableProperties:i,batchTableProperties:a,dequantizeInShader:!1};return await $C(e,f,n,s)}async function $C(e,t,r,n){if(!n)return;let s={...r,draco:{...r?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let o=await vt(t.buffer,zo,s,n),i=o.attributes.POSITION&&o.attributes.POSITION.value,a=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,f=i&&o.attributes.POSITION.value.quantization,u=c&&o.attributes.NORMAL.value.quantization;if(f){let d=o.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}u&&(e.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let h={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(h[d.toLowerCase()]=o.attributes[d].value);e.attributes={positions:i,colors:Qc(e,a,void 0),normals:c,batchIds:l,...h}}var Zc={};pt(Zc,{createExtMeshFeatures:()=>gS,decode:()=>uS,encode:()=>hS,name:()=>fS});function lt(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var ko={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jo={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var tS=1.33,fg=["SCALAR","VEC2","VEC3","VEC4"],eS=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],rS=new Map(eS),nS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},sS={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},oS={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function jo(e){return fg[e-1]||fg[0]}function Ne(e){let t=rS.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function qr(e,t){let r=oS[e.componentType],n=nS[e.type],s=sS[e.componentType],o=e.count*n,i=e.count*n*s;lt(i>=0&&i<=t.byteLength);let a=Jo[e.componentType],c=ko[e.type];return{ArrayType:r,length:o,byteLength:i,componentByteSize:a,numberOfComponentsInElement:c}}function $n(e){let{images:t,bufferViews:r}=e;t=t||[],r=r||[];let n=t.map(i=>i.bufferView);r=r.filter(i=>!n.includes(i));let s=r.reduce((i,a)=>i+a.byteLength,0),o=t.reduce((i,a)=>{let{width:c,height:l}=a.image;return i+c*l},0);return s+Math.ceil(4*o*tS)}function ug(e,t,r){let n=e.bufferViews[r];lt(n);let s=n.buffer,o=t[s];lt(o);let i=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,i,n.byteLength)}function hg(e,t,r){let n=typeof r=="number"?e.accessors?.[r]:r;if(!n)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let s=e.bufferViews?.[n.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:o,byteOffset:i}=t[s.buffer],a=(i||0)+(n.byteOffset||0)+(s.byteOffset||0),{ArrayType:c,length:l,componentByteSize:f,numberOfComponentsInElement:u}=qr(n,s),h=f*u,d=s.byteStride||h;if(typeof s.byteStride>"u"||s.byteStride===h)return new c(o,a,l);let p=new c(l);for(let A=0;A<n.count;A++){let m=new c(o,a+A*d,u);p.set(m,A*u)}return p}function iS(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var q=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:t?.json||iS(),buffers:t?.buffers||[],images:t?.images||[]},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(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let r=this.getUsedExtensions().find(s=>s===t),n=this.getRequiredExtensions().find(s=>s===t);return typeof r=="string"||typeof n=="string"}getExtension(t){let r=this.getUsedExtensions().find(s=>s===t),n=this.json.extensions||{};return r?n[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(n=>n===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,r){return(t.extensions||{})[r]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,r){if(typeof r=="object")return r;let n=this.json[t]&&this.json[t][r];if(!n)throw new Error(`glTF file error: Could not find ${t}[${r}]`);return n}getTypedArrayForBufferView(t){t=this.getBufferView(t);let r=t.buffer,n=this.gltf.buffers[r];lt(n);let s=(t.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let r=this.getAccessor(t);return hg(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(t){t=this.getAccessor(t);let r=this.getBufferView(t.bufferView),s=this.getBuffer(r.buffer).data,o=r.byteOffset||0;return new Uint8Array(s,o,r.byteLength)}addApplicationData(t,r){return this.json[t]=r,this}addExtraData(t,r){return this.json.extras=this.json.extras||{},this.json.extras[t]=r,this}addObjectExtension(t,r,n){return t.extensions=t.extensions||{},t.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(t,r,n){let s=t.extensions||{};s[r]=n}removeObjectExtension(t,r){let n=t?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(r)||s.push(r)}delete n[r]}addExtension(t,r={}){return lt(r),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=r,this.registerUsedExtension(t),r}addRequiredExtension(t,r={}){return lt(r),this.addExtension(t,r),this.registerRequiredExtension(t),r}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:r}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(t){let{meshIndex:r,matrix:n}=t;this.json.nodes=this.json.nodes||[];let s={mesh:r};return n&&(s.matrix=n),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:r,indices:n,material:s,mode:o=4}=t,a={primitives:[{attributes:this._addAttributes(r),mode:o}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let n={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(t,r){let n=$e(t),s=r||n?.mimeType,i={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(i),this.json.images.length-1}addBufferView(t,r=0,n=this.byteLength){let s=t.byteLength;lt(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let o={buffer:r,byteOffset:n,byteLength:s};return this.byteLength+=Be(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(t,r){let n={bufferView:t,type:jo(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(t,r={size:3}){let n=this.addBufferView(t),s={min:r.min,max:r.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,r.size));let o={size:r.size,componentType:Ne(t),count:Math.round(t.length/r.size),min:s.min,max:s.max};return this.addAccessor(n,Object.assign(o,r))}addTexture(t){let{imageIndex:r}=t,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){let t=this.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r),s=0;for(let o of this.sourceBuffers||[])s=Ya(o,n,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=r,this.sourceBuffers=[r],this.gltf.buffers=[{arrayBuffer:r,byteOffset:0,byteLength:r.byteLength}]}_removeStringFromArray(t,r){let n=!0;for(;n;){let s=t.indexOf(r);s>-1?t.splice(s,1):n=!1}}_addAttributes(t={}){let r={};for(let n in t){let s=t[n],o=this._getGltfAttributeName(n),i=this.addBinaryBuffer(s.value,s);r[o]=i}return r}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.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 t}}_getAccessorMinMax(t,r){let n={min:null,max:null};if(t.length<r)return n;n.min=[],n.max=[];let s=t.subarray(0,r);for(let o of s)n.min.push(o),n.max.push(o);for(let o=r;o<t.length;o+=r)for(let i=0;i<r;i++)n.min[0+i]=Math.min(n.min[0+i],t[o+i]),n.max[0+i]=Math.max(n.max[0+i],t[o+i]);return n}};function dg(e){return(e%1+1)%1}var pg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},aS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},mg={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function ts(e,t){return mg[t]*pg[e]}function kr(e,t,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),o=Jr(s,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function Jr(e,t,r,n=1){let s=pg[t],o=aS[r],i=mg[r],a=n*s,c=a*i,l=e.buffer,f=e.byteOffset;return f%i!==0&&(l=new Uint8Array(l).slice(f,f+c).buffer,f=0),new o(l,f,a)}function jr(e,t,r){let n=`TEXCOORD_${t.texCoord||0}`,s=r.attributes[n],o=e.getTypedArrayForAccessor(s),i=e.gltf.json,a=t.index,c=i.textures?.[a]?.source;if(typeof c<"u"){let l=i.images?.[c]?.mimeType,f=e.gltf.images?.[c];if(f&&typeof f.width<"u"){let u=[];for(let h=0;h<o.length;h+=2){let d=cS(f,l,o,h,t.channels);u.push(d)}return u}}return[]}function Xo(e,t,r,n,s){if(!r?.length)return;let o=[];for(let f of r){let u=n.findIndex(h=>h===f);u===-1&&(u=n.push(f)-1),o.push(u)}let i=new Uint32Array(o),a=e.gltf.buffers.push({arrayBuffer:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength})-1,c=e.addBufferView(i,a,0),l=e.addAccessor(c,{size:1,componentType:Ne(i),count:i.length});s.attributes[t]=l}function cS(e,t,r,n,s=[0]){let o={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},i=r[n],a=r[n+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=lS(i,a,e,c),f=0;for(let u of s){let h=typeof u=="number"?Object.values(o)[u]:o[u],d=l+h.offset,p=Ln(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];f|=A<<h.shift}return f}function lS(e,t,r,n=1){let s=r.width,o=dg(e)*(s-1),i=Math.round(o),a=r.height,c=dg(t)*(a-1),l=Math.round(c),f=r.components?r.components:n;return(l*s+i)*f}function Wo(e,t,r,n,s){let o=[];for(let i=0;i<t;i++){let a=r[i],c=r[i+1]-r[i];if(c+a>n)break;let l=a/s,f=c/s;o.push(e.slice(l,l+f))}return o}function Yo(e,t,r){let n=[];for(let s=0;s<t;s++){let o=s*r;n.push(e.slice(o,o+r))}return n}function Ko(e,t,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let s=[],o=new TextDecoder("utf8"),i=0;for(let a=0;a<e;a++){let c=n[a+1]-n[a];if(c+i<=t.length){let l=t.subarray(i,c+i),f=o.decode(l);s.push(f),i+=c}}return s}return[]}var Xr="EXT_mesh_features",fS=Xr;async function uS(e,t){let r=new q(e);dS(r,t)}function hS(e,t){let r=new q(e);return mS(r,t),r.createBinaryChunk(),r.gltf}function dS(e,t){let r=e.gltf.json;if(r.meshes)for(let n of r.meshes)for(let s of n.primitives)pS(e,s,t)}function pS(e,t,r){if(!r?.gltf?.loadBuffers)return;let s=t.extensions?.[Xr]?.featureIds;if(s)for(let o of s){let i;if(typeof o.attribute<"u"){let a=`_FEATURE_ID_${o.attribute}`,c=t.attributes[a];i=e.getTypedArrayForAccessor(c)}else typeof o.texture<"u"&&r?.gltf?.loadImages?i=jr(e,o.texture,t):i=[];o.data=i}}function mS(e,t){let r=e.gltf.json.meshes;if(r)for(let n of r)for(let s of n.primitives)AS(e,s)}function gS(e,t,r,n){t.extensions||(t.extensions={});let s=t.extensions[Xr];s||(s={featureIds:[]},t.extensions[Xr]=s);let{featureIds:o}=s,i={featureCount:r.length,propertyTable:n,data:r};o.push(i),e.addObjectExtension(t,Xr,s)}function AS(e,t){let r=t.extensions?.[Xr];if(!r)return;let n=r.featureIds;n.forEach((s,o)=>{if(s.data){let{accessorKey:i,index:a}=xS(t.attributes),c=new Uint32Array(s.data);n[o]={featureCount:c.length,propertyTable:s.propertyTable,attribute:a},e.gltf.buffers.push({arrayBuffer:c.buffer,byteOffset:c.byteOffset,byteLength:c.byteLength});let l=e.addBufferView(c),f=e.addAccessor(l,{size:1,componentType:Ne(c),count:c.length});t.attributes[i]=f}})}function xS(e){let t="_FEATURE_ID_",r=Object.keys(e).filter(o=>o.indexOf(t)===0),n=-1;for(let o of r){let i=Number(o.substring(t.length));i>n&&(n=i)}return n++,{accessorKey:`${t}${n}`,index:n}}var el={};pt(el,{createExtStructuralMetadata:()=>VS,decode:()=>TS,encode:()=>ES,name:()=>yS});var Wr="EXT_structural_metadata",yS=Wr;async function TS(e,t){let r=new q(e);_S(r,t)}function ES(e,t){let r=new q(e);return GS(r,t),r.createBinaryChunk(),r.gltf}function _S(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(Wr);r&&(t.gltf?.loadImages&&MS(e,r),bS(e,r))}function MS(e,t){let r=t.propertyTextures,n=e.gltf.json;if(r&&n.meshes)for(let s of n.meshes)for(let o of s.primitives)CS(e,r,o,t)}function bS(e,t){let r=t.schema;if(!r)return;let n=r.classes,s=t.propertyTables;if(n&&s)for(let o in n){let i=BS(s,o);i&&IS(e,r,i)}}function BS(e,t){for(let r of e)if(r.class===t)return r;return null}function CS(e,t,r,n){if(!t)return;let o=r.extensions?.[Wr]?.propertyTextures;if(o)for(let i of o){let a=t[i];SS(e,a,r,n)}}function SS(e,t,r,n){if(!t.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){let i=`${s}_${o}`,a=t.properties?.[o];if(!a)continue;a.data||(a.data=[]);let c=a.data,l=jr(e,a,r);l!==null&&(Xo(e,i,l,c,r),a.data=c,n.dataAttributeNames.push(i))}}function IS(e,t,r){let n=t.classes?.[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let s=r.count;for(let o in n.properties){let i=n.properties[o],a=r.properties?.[o];if(a){let c=wS(e,t,i,s,a);a.data=c}}}function wS(e,t,r,n,s){let o=[],i=s.values,a=e.getTypedArrayForBufferView(i),c=LS(e,r,s,n),l=vS(e,s,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=RS(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=Ko(n,a,c,l);break}case"ENUM":{o=FS(t,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function LS(e,t,r,n){return t.array&&typeof t.count>"u"&&typeof r.arrayOffsets<"u"?kr(e,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function vS(e,t,r){return typeof t.stringOffsets<"u"?kr(e,t.stringOffsets,t.stringOffsetType||"UINT32",r):null}function RS(e,t,r,n){let s=e.array,o=e.count,i=ts(e.type,e.componentType),a=r.byteLength/i,c;return e.componentType?c=Jr(r,e.type,e.componentType,a):c=r,s?n?Wo(c,t,n,r.length,i):o?Yo(c,t,o):[]:c}function FS(e,t,r,n,s){let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let i=e.enums?.[o];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let a=i.valueType||"UINT16",c=ts(t.type,a),l=n.byteLength/c,f=Jr(n,t.type,a,l);if(f||(f=n),t.array){if(s)return PS({valuesData:f,numberOfElements:r,arrayOffsets:s,valuesDataBytesLength:n.length,elementSize:c,enumEntry:i});let u=t.count;return u?OS(f,r,u,i):[]}return tl(f,0,r,i)}function PS(e){let{valuesData:t,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:s,elementSize:o,enumEntry:i}=e,a=[];for(let c=0;c<r;c++){let l=n[c],f=n[c+1]-n[c];if(f+l>s)break;let u=l/o,h=f/o,d=tl(t,u,h,i);a.push(d)}return a}function OS(e,t,r,n){let s=[];for(let o=0;o<t;o++){let i=r*o,a=tl(e,i,r,n);s.push(a)}return s}function tl(e,t,r,n){let s=[];for(let o=0;o<r;o++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let i=e[t+o],a=NS(n,i);a?s.push(a.name):s.push("")}return s}function NS(e,t){for(let r of e.values)if(r.value===t)return r;return null}var DS="schemaClassId";function GS(e,t){let r=e.getExtension(Wr);if(r&&r.propertyTables)for(let n of r.propertyTables){let s=n.class,o=r.schema?.classes?.[s];n.properties&&o&&US(n,o,e)}}function US(e,t,r){for(let n in e.properties){let s=e.properties[n].data;if(s){let o=t.properties[n];if(o){let i=qS(s,o,r);e.properties[n]=i}}}}function VS(e,t,r=DS){let n=e.getExtension(Wr);n||(n=e.addExtension(Wr)),n.schema=HS(t,r,n.schema);let s=zS(t,r,n.schema);return n.propertyTables||(n.propertyTables=[]),n.propertyTables.push(s)-1}function HS(e,t,r){let n=r??{id:"schema_id"},s={properties:{}};for(let o of e){let i={type:o.elementType,componentType:o.componentType};s.properties[o.name]=i}return n.classes={},n.classes[t]=s,n}function zS(e,t,r){let n={class:t,count:0},s=0,o=r.classes?.[t];for(let i of e){if(s===0&&(s=i.values.length),s!==i.values.length&&i.values.length)throw new Error("Illegal values in attributes");o?.properties[i.name]&&(n.properties||(n.properties={}),n.properties[i.name]={values:0,data:i.values})}return n.count=s,n}function qS(e,t,r){let n={values:0};if(t.type==="STRING"){let{stringData:s,stringOffsets:o}=jS(e);n.stringOffsets=$c(o,r),n.values=$c(s,r)}else if(t.type==="SCALAR"&&t.componentType){let s=JS(e,t.componentType);n.values=$c(s,r)}return n}var kS={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:Int32Array,UINT64:Uint32Array,FLOAT32:Float32Array,FLOAT64:Float64Array};function JS(e,t){let r=[];for(let s of e)r.push(Number(s));let n=kS[t];if(!n)throw new Error("Illegal component type");return new n(r)}function jS(e){let t=new TextEncoder,r=[],n=0;for(let c of e){let l=t.encode(c);n+=l.length,r.push(l)}let s=new Uint8Array(n),o=[],i=0;for(let c of r)s.set(c,i),o.push(i),i+=c.length;o.push(i);let a=new Uint32Array(o);return{stringData:s,stringOffsets:a}}function $c(e,t){return t.gltf.buffers.push({arrayBuffer:e.buffer,byteOffset:e.byteOffset,byteLength:e.byteLength}),t.addBufferView(e)}var rl={};pt(rl,{decode:()=>WS,name:()=>XS});var gg="EXT_feature_metadata",XS=gg;async function WS(e,t){let r=new q(e);YS(r,t)}function YS(e,t){if(!t.gltf?.loadBuffers)return;let r=e.getExtension(gg);r&&(t.gltf?.loadImages&&KS(e,r),QS(e,r))}function KS(e,t){let r=t.schema;if(!r)return;let n=r.classes,{featureTextures:s}=t;if(n&&s)for(let o in n){let i=n[o],a=$S(s,o);a&&eI(e,a,i)}}function QS(e,t){let r=t.schema;if(!r)return;let n=r.classes,s=t.featureTables;if(n&&s)for(let o in n){let i=ZS(s,o);i&&tI(e,r,i)}}function ZS(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function $S(e,t){for(let r in e){let n=e[r];if(n.class===t)return n}return null}function tI(e,t,r){if(!r.class)return;let n=t.classes?.[r.class];if(!n)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let s=r.count;for(let o in n.properties){let i=n.properties[o],a=r.properties?.[o];if(a){let c=rI(e,t,i,s,a);a.data=c}}}function eI(e,t,r){let n=t.class;for(let s in r.properties){let o=t?.properties?.[s];if(o){let i=aI(e,o,n);o.data=i}}}function rI(e,t,r,n,s){let o=[],i=s.bufferView,a=e.getTypedArrayForBufferView(i),c=nI(e,r,s,n),l=sI(e,r,s,n);return r.type==="STRING"||r.componentType==="STRING"?o=Ko(n,a,c,l):oI(r)&&(o=iI(r,n,a,c)),o}function nI(e,t,r,n){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?kr(e,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function sI(e,t,r,n){return typeof r.stringOffsetBufferView<"u"?kr(e,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function oI(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function iI(e,t,r,n){let s=e.type==="ARRAY",o=e.componentCount,i="SCALAR",a=e.componentType||e.type,c=ts(i,a),l=r.byteLength/c,f=Jr(r,i,a,l);return s?n?Wo(f,t,n,r.length,c):o?Yo(f,t,o):[]:f}function aI(e,t,r){let n=e.gltf.json;if(!n.meshes)return[];let s=[];for(let o of n.meshes)for(let i of o.primitives)cI(e,r,t,s,i);return s}function cI(e,t,r,n,s){let o={channels:r.channels,...r.texture},i=jr(e,o,s);i&&Xo(e,t,i,n,s)}var Ag="4.3.3";var xg="4.3.3";var Qo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},yg;async function sl(e){Ja(e.modules);let t=ja("basis");return t||(yg||=lI(e),await yg)}async function lI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Qo.TRANSCODER,"textures",e),await re(Qo.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await fI(t,r)}function fI(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(s=>{let{BasisFile:o,initializeBasis:i}=s;i(),n({BasisFile:o})})})}var nl;async function ol(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(nl=nl||uI(e),await nl)}async function uI(e){let t=null,r=null;return[t,r]=await Promise.all([await re(Qo.ENCODER,"textures",e),await re(Qo.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await hI(t,r)}function hI(e,t){let r={};return t&&(r.wasmBinary=t),new Promise(n=>{e(r).then(s=>{let{BasisFile:o,KTX2File:i,initializeBasis:a,BasisEncoder:c}=s;a(),n({BasisFile:o,KTX2File:i,BasisEncoder:c})})})}var lr={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};var dI=["","WEBKIT_","MOZ_"],Tg={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"},Zo=null;function Eg(e){if(!Zo){e=e||pI()||void 0,Zo=new Set;for(let t of dI)for(let r in Tg)if(e&&e.getExtension(`${t}${r}`)){let n=Tg[r];Zo.add(n)}}return Zo}function pI(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Rt=[171,75,84,88,32,50,48,187,13,10,26,10];function _g(e){let t=new Uint8Array(e);return!(t.byteLength<Rt.length||t[0]!==Rt[0]||t[1]!==Rt[1]||t[2]!==Rt[2]||t[3]!==Rt[3]||t[4]!==Rt[4]||t[5]!==Rt[5]||t[6]!==Rt[6]||t[7]!==Rt[7]||t[8]!==Rt[8]||t[9]!==Rt[9]||t[10]!==Rt[10]||t[11]!==Rt[11])}var mI={etc1:{basisFormat:0,compressed:!0,format:lr.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:lr.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:lr.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:lr.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:lr.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:lr.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 bg(e,t){if(t.basis.containerFormat==="auto"){if(_g(e)){let n=await ol(t);return Mg(n.KTX2File,e,t)}let{BasisFile:r}=await sl(t);return il(r,e,t)}switch(t.basis.module){case"encoder":let r=await ol(t);switch(t.basis.containerFormat){case"ktx2":return Mg(r.KTX2File,e,t);case"basis":default:return il(r.BasisFile,e,t)}case"transcoder":default:let{BasisFile:n}=await sl(t);return il(n,e,t)}}function il(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let s=n.getNumImages(),o=[];for(let i=0;i<s;i++){let a=n.getNumLevels(i),c=[];for(let l=0;l<a;l++)c.push(gI(n,i,l,r));o.push(c)}return o}finally{n.close(),n.delete()}}function gI(e,t,r,n){let s=e.getImageWidth(t,r),o=e.getImageHeight(t,r),i=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=Bg(n,i),f=e.getImageTranscodedSizeInBytes(t,r,l),u=new Uint8Array(f);if(!e.transcodeImage(u,t,r,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:o,data:u,compressed:a,format:c,hasAlpha:i}}function Mg(e,t,r){let n=new e(new Uint8Array(t));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=n.getLevels(),o=[];for(let i=0;i<s;i++)o.push(AI(n,i,r));return[o]}finally{n.close(),n.delete()}}function AI(e,t,r){let{alphaFlag:n,height:s,width:o}=e.getImageLevelInfo(t,0,0),{compressed:i,format:a,basisFormat:c}=Bg(r,n),l=e.getImageTranscodedSizeInBytes(t,0,0,c),f=new Uint8Array(l);if(!e.transcodeImage(f,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:s,data:f,compressed:i,levelSize:l,hasAlpha:n,format:a}}function Bg(e,t){let r=e&&e.basis&&e.basis.format;return r==="auto"&&(r=$o()),typeof r=="object"&&(r=t?r.alpha:r.noAlpha),r=r.toLowerCase(),mI[r]}function $o(){let e=Eg();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"}var Cg={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:xg,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"}}},al={...Cg,parse:bg};var Yr=!0,Sg=1735152710,fl=12,ti=8,xI=1313821514,yI=5130562,TI=0,EI=0,_I=1;function MI(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))}`}function Ig(e,t=0,r={}){let n=new DataView(e),{magic:s=Sg}=r,o=n.getUint32(t,!1);return o===s||o===Sg}function wg(e,t,r=0,n={}){let s=new DataView(t),o=MI(s,r+0),i=s.getUint32(r+4,Yr),a=s.getUint32(r+8,Yr);switch(Object.assign(e,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:i,json:{},binChunks:[]}),r+=fl,e.version){case 1:return bI(e,s,r);case 2:return BI(e,s,r,n={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function bI(e,t,r){H(e.header.byteLength>fl+ti);let n=t.getUint32(r+0,Yr),s=t.getUint32(r+4,Yr);return r+=ti,H(s===TI),cl(e,t,r,n),r+=n,r+=ll(e,t,r,e.header.byteLength),r}function BI(e,t,r,n){return H(e.header.byteLength>fl+ti),CI(e,t,r,n),r+e.header.byteLength}function CI(e,t,r,n){for(;r+8<=e.header.byteLength;){let s=t.getUint32(r+0,Yr),o=t.getUint32(r+4,Yr);switch(r+=ti,o){case xI:cl(e,t,r,s);break;case yI:ll(e,t,r,s);break;case EI:n.strict||cl(e,t,r,s);break;case _I:n.strict||ll(e,t,r,s);break;default:break}r+=Be(s,4)}return r}function cl(e,t,r,n){let s=new Uint8Array(t.buffer,r,n),i=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(i),Be(n,4)}function ll(e,t,r,n){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:t.buffer}),Be(n,4)}function ul(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let n=t.baseUri||t.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return n.substr(0,n.lastIndexOf("/")+1)+e}var dl={};pt(dl,{decode:()=>GI,name:()=>DI});var SI="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",II="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",wI=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]),LI=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]),vI={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},RI={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function Lg(e,t,r,n,s,o="NONE"){let i=await FI();NI(i,i.exports[RI[s]],e,t,r,n,i.exports[vI[o||"NONE"]])}var hl;async function FI(){return hl||(hl=PI()),hl}async function PI(){let e=SI;WebAssembly.validate(wI)&&(e=II,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(OI(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function OI(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n){let s=e.charCodeAt(n);t[n]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?LI[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}function NI(e,t,r,n,s,o,i){let a=e.exports.sbrk,c=n+3&-4,l=a(c*s),f=a(o.length),u=new Uint8Array(e.exports.memory.buffer);u.set(o,f);let h=t(l,n,s,f,o.length);if(h===0&&i&&i(l,c,s),r.set(u.subarray(l,l+n*s)),a(l-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var ei="EXT_meshopt_compression",DI=ei;async function GI(e,t){let r=new q(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let n=[];for(let s of e.json.bufferViews||[])n.push(UI(r,s));await Promise.all(n),r.removeExtension(ei)}async function UI(e,t){let r=e.getObjectExtension(t,ei);if(r){let{byteOffset:n=0,byteLength:s=0,byteStride:o,count:i,mode:a,filter:c="NONE",buffer:l}=r,f=e.gltf.buffers[l],u=new Uint8Array(f.arrayBuffer,f.byteOffset+n,s),h=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await Lg(h,i,o,u,a,c),e.removeObjectExtension(t,ei)}}var pl={};pt(pl,{name:()=>VI,preprocess:()=>HI});var Kr="EXT_texture_webp",VI=Kr;function HI(e,t){let r=new q(e);if(!ic("image/webp")){if(r.getRequiredExtensions().includes(Kr))throw new Error(`gltf: Required extension ${Kr} not supported by browser`);return}let{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,Kr);o&&(s.source=o.source),r.removeObjectExtension(s,Kr)}r.removeExtension(Kr)}var ml={};pt(ml,{name:()=>zI,preprocess:()=>qI});var ri="KHR_texture_basisu",zI=ri;function qI(e,t){let r=new q(e),{json:n}=r;for(let s of n.textures||[]){let o=r.getObjectExtension(s,ri);o&&(s.source=o.source,r.removeObjectExtension(s,ri))}r.removeExtension(ri)}var Al={};pt(Al,{decode:()=>WI,encode:()=>YI,name:()=>jI,preprocess:()=>XI});function vg(e){let t={};for(let r in e){let n=e[r];if(r!=="indices"){let s=gl(n);t[r]=s}}return t}function gl(e){let{buffer:t,size:r,count:n}=kI(e);return{value:t,size:r,byteOffset:0,count:n,type:jo(r),componentType:Ne(t)}}function kI(e){let t=e,r=1,n=0;return e&&e.value&&(t=e.value,r=e.size||1),t&&(ArrayBuffer.isView(t)||(t=JI(t,Float32Array)),n=t.length/r),{buffer:t,size:r,count:n}}function JI(e,t,r=!1){return e?Array.isArray(e)?new t(e):r&&!(e instanceof t)?new t(e):e:null}var De="KHR_draco_mesh_compression",jI=De;function XI(e,t,r){let n=new q(e);for(let s of Rg(n))n.getObjectExtension(s,De)}async function WI(e,t,r){if(!t?.gltf?.decompressMeshes)return;let n=new q(e),s=[];for(let o of Rg(n))n.getObjectExtension(o,De)&&s.push(KI(n,o,t,r));await Promise.all(s),n.removeExtension(De)}function YI(e,t={}){let r=new q(e);for(let n of r.json.meshes||[])QI(n,t),r.addRequiredExtension(De)}async function KI(e,t,r,n){let s=e.getObjectExtension(t,De);if(!s)return;let o=e.getTypedArrayForBufferView(s.bufferView),i=Ye(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await vt(i,zo,a,n),l=vg(c.attributes);for(let[f,u]of Object.entries(l))if(f in t.attributes){let h=t.attributes[f],d=e.getAccessor(h);d?.min&&d?.max&&(u.min=d.min,u.max=d.max)}t.attributes=l,c.indices&&(t.indices=gl(c.indices)),e.removeObjectExtension(t,De),ZI(t)}function QI(e,t,r=4,n,s){if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=n.DracoWriter.encodeSync({attributes:e}),i=s?.parseSync?.({attributes:e}),a=n._addFauxAttributes(i.attributes),c=n.addBufferView(o);return{primitives:[{attributes:a,mode:r,extensions:{[De]:{bufferView:c,attributes:a}}}]}}function ZI(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Rg(e){for(let t of e.json.meshes||[])for(let r of t.primitives)yield r}var xl={};pt(xl,{decode:()=>r2,name:()=>$I});var si="KHR_texture_transform",$I=si,ni=new x,t2=new J,e2=new J;async function r2(e,t){if(!new q(e).hasExtension(si)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let o=0;o<s.length;o++)n2(o,e)}function n2(e,t){let r=t.json.materials?.[e],n=[r?.pbrMetallicRoughness?.baseColorTexture,r?.emissiveTexture,r?.normalTexture,r?.occlusionTexture,r?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let o of n)o&&o?.extensions?.[si]&&s2(t,e,o,s)}function s2(e,t,r,n){let s=o2(r,n);if(!s)return;let o=e.json.meshes||[];for(let i of o)for(let a of i.primitives){let c=a.material;Number.isFinite(c)&&t===c&&i2(e,a,s)}}function o2(e,t){let r=e.extensions?.[si],{texCoord:n=0}=e,{texCoord:s=n}=r;if(!(t.findIndex(([i,a])=>i===n&&a===s)!==-1)){let i=l2(r);return n!==s&&(e.texCoord=s),t.push([n,s]),{originalTexCoord:n,texCoord:s,matrix:i}}return null}function i2(e,t,r){let{originalTexCoord:n,texCoord:s,matrix:o}=r,i=t.attributes[`TEXCOORD_${n}`];if(Number.isFinite(i)){let a=e.json.accessors?.[i];if(a&&a.bufferView){let c=e.json.bufferViews?.[a.bufferView];if(c){let{arrayBuffer:l,byteOffset:f}=e.buffers[c.buffer],u=(f||0)+(a.byteOffset||0)+(c.byteOffset||0),{ArrayType:h,length:d}=qr(a,c),p=Jo[a.componentType],A=ko[a.type],m=c.byteStride||p*A,y=new Float32Array(d);for(let _=0;_<a.count;_++){let E=new h(l,u+_*m,2);ni.set(E[0],E[1],1),ni.transformByMatrix3(o),y.set([ni[0],ni[1]],_*A)}n===s?a2(a,c,e.buffers,y):c2(s,a,t,e,y)}}}}function a2(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}function c2(e,t,r,n,s){n.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let o=n.json.bufferViews;if(!o)return;o.push({buffer:n.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let i=n.json.accessors;i&&(i.push({bufferView:o?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),r.attributes[`TEXCOORD_${e}`]=i.length-1)}function l2(e){let{offset:t=[0,0],rotation:r=0,scale:n=[1,1]}=e,s=new J().set(1,0,0,0,1,0,t[0],t[1],1),o=t2.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),i=e2.set(n[0],0,0,0,n[1],0,0,0,1);return s.multiplyRight(o).multiplyRight(i)}var yl={};pt(yl,{decode:()=>u2,encode:()=>h2,name:()=>f2});var fr="KHR_lights_punctual",f2=fr;async function u2(e){let t=new q(e),{json:r}=t,n=t.getExtension(fr);n&&(t.json.lights=n.lights,t.removeExtension(fr));for(let s of r.nodes||[]){let o=t.getObjectExtension(s,fr);o&&(s.light=o.light),t.removeObjectExtension(s,fr)}}async function h2(e){let t=new q(e),{json:r}=t;if(r.lights){let n=t.addExtension(fr);lt(!n.lights),n.lights=r.lights,delete r.lights}if(t.json.lights){for(let n of t.json.lights){let s=n.node;t.addObjectExtension(s,fr,n)}delete t.json.lights}}var Tl={};pt(Tl,{decode:()=>p2,encode:()=>m2,name:()=>d2});var es="KHR_materials_unlit",d2=es;async function p2(e){let t=new q(e),{json:r}=t;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),t.removeObjectExtension(n,es);t.removeExtension(es)}function m2(e){let t=new q(e),{json:r}=t;if(t.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,t.addObjectExtension(n,es,{}),t.addExtension(es))}var El={};pt(El,{decode:()=>A2,encode:()=>x2,name:()=>g2});var rs="KHR_techniques_webgl",g2=rs;async function A2(e){let t=new q(e),{json:r}=t,n=t.getExtension(rs);if(n){let s=y2(n,t);for(let o of r.materials||[]){let i=t.getObjectExtension(o,rs);i&&(o.technique=Object.assign({},i,s[i.technique]),o.technique.values=T2(o.technique,t)),t.removeObjectExtension(o,rs)}t.removeExtension(rs)}}async function x2(e,t){}function y2(e,t){let{programs:r=[],shaders:n=[],techniques:s=[]}=e,o=new TextDecoder;return n.forEach(i=>{if(Number.isFinite(i.bufferView))i.code=o.decode(t.getTypedArrayForBufferView(i.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(i=>{i.fragmentShader=n[i.fragmentShader],i.vertexShader=n[i.vertexShader]}),s.forEach(i=>{i.program=r[i.program]}),s}function T2(e,t){let r=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(n=>{e.uniforms[n].value&&!(n in r)&&(r[n]=e.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=t.getTexture(r[n].index))}),r}var Fg=[el,Zc,dl,pl,ml,Al,yl,Tl,El,xl,rl];function Pg(e,t={},r){let n=Fg.filter(s=>Ng(s.name,t));for(let s of n)s.preprocess?.(e,t,r)}async function Og(e,t={},r){let n=Fg.filter(s=>Ng(s.name,t));for(let s of n)await s.decode?.(e,t,r)}function Ng(e,t){let r=t?.gltf?.excludeExtensions||{};return!(e in r&&!r[e])}var _l="KHR_binary_glTF";function Dg(e){let t=new q(e),{json:r}=t;for(let n of r.images||[]){let s=t.getObjectExtension(n,_l);s&&Object.assign(n,s),t.removeObjectExtension(n,_l)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,t.removeExtension(_l)}var Gg={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},_2={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Ml=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,r){this.json=t.json;let n=t.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.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(n),this._convertTopLevelObjectsToArrays(n),Dg(t),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let r in Gg)this._convertTopLevelObjectToArray(t,r)}_convertTopLevelObjectToArray(t,r){let n=t[r];if(!(!n||Array.isArray(n))){t[r]=[];for(let s in n){let o=n[s];o.id=o.id||s;let i=t[r].length;t[r].push(o),this.idToIndexMap[r][s]=i}}}_convertObjectIdsToArrayIndices(t){for(let r in Gg)this._convertIdsToIndices(t,r);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let r of t.textures)this._convertTextureIds(r);for(let r of t.meshes)this._convertMeshIds(r);for(let r of t.nodes)this._convertNodeIds(r);for(let r of t.scenes)this._convertSceneIds(r)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let r of t.primitives){let{attributes:n,indices:s,material:o}=r;for(let i in n)n[i]=this._convertIdToIndex(n[i],"accessor");s&&(r.indices=this._convertIdToIndex(s,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(r=>this._convertIdToIndex(r,"node"))),t.meshes&&(t.meshes=t.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(t,r){t[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),t[r]=[]);for(let n of t[r])for(let s in n){let o=n[s],i=this._convertIdToIndex(o,s);n[s]=i}}_convertIdToIndex(t,r){let n=_2[r];if(n in this.idToIndexMap){let s=this.idToIndexMap[n][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${r} with id ${t}`);return s}return t}_updateObjects(t){for(let r of this.json.buffers)delete r.type}_updateMaterial(t){for(let r of t.materials){r.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let n=r.values?.tex||r.values?.texture2d_0||r.values?.diffuseTex,s=t.textures.findIndex(o=>o.id===n);s!==-1&&(r.pbrMetallicRoughness.baseColorTexture={index:s})}}};function Ug(e,t={}){return new Ml().normalize(e,t)}async function Vg(e,t,r=0,n,s){return M2(e,t,r,n),Ug(e,{normalize:n?.gltf?.normalize}),Pg(e,n,s),n?.gltf?.loadBuffers&&e.json.buffers&&await b2(e,n,s),n?.gltf?.loadImages&&await B2(e,n,s),await Og(e,n,s),e}function M2(e,t,r,n){if(n.uri&&(e.baseUri=n.uri),t instanceof ArrayBuffer&&!Ig(t,r,n)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=Wa(t);else if(t instanceof ArrayBuffer){let i={};r=wg(i,t,r,n.glb),lt(i.type==="glTF",`Invalid GLB magic string ${i.type}`),e._glb=i,e.json=i.json}else lt(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:i}=e._glb;e.buffers[0]={arrayBuffer:i[0].arrayBuffer,byteOffset:i[0].byteOffset,byteLength:i[0].byteLength}}let o=e.json.images||[];e.images=new Array(o.length).fill({})}async function b2(e,t,r){let n=e.json.buffers||[];for(let s=0;s<n.length;++s){let o=n[s];if(o.uri){let{fetch:i}=r;lt(i);let a=ul(o.uri,t),l=await(await r?.fetch?.(a))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete o.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(o.byteLength),byteOffset:0,byteLength:o.byteLength})}}async function B2(e,t,r){let n=C2(e),s=e.json.images||[],o=[];for(let i of n)o.push(S2(e,s[i],i,t,r));return await Promise.all(o)}function C2(e){let t=new Set,r=e.json.textures||[];for(let n of r)n.source!==void 0&&t.add(n.source);return Array.from(t).sort()}async function S2(e,t,r,n,s){let o;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=ul(t.uri,n),{fetch:c}=s;o=await(await c(a)).arrayBuffer(),t.bufferView={data:o}}if(Number.isFinite(t.bufferView)){let a=ug(e.json,e.buffers,t.bufferView);o=Ye(a.buffer,a.byteOffset,a.byteLength)}lt(o,"glTF image has no data");let i=await vt(o,[Fr,al],{...n,mimeType:t.mimeType,basis:n.basis||{format:$o()}},s);i&&i[0]&&(i={compressed:!0,mipmaps:!1,width:i[0].width,height:i[0].height,data:i[0]}),e.images=e.images||[],e.images[r]=i}var ur={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:Ag,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:I2,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function I2(e,t={},r){t={...ur.options,...t},t.gltf={...ur.options.gltf,...t.gltf};let{byteOffset:n=0}=t;return await Vg({},e,n,t,r)}var w2={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},L2={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Ut={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},v2={magFilter:Ut.TEXTURE_MAG_FILTER,minFilter:Ut.TEXTURE_MIN_FILTER,wrapS:Ut.TEXTURE_WRAP_S,wrapT:Ut.TEXTURE_WRAP_T},R2={[Ut.TEXTURE_MAG_FILTER]:Ut.LINEAR,[Ut.TEXTURE_MIN_FILTER]:Ut.NEAREST_MIPMAP_LINEAR,[Ut.TEXTURE_WRAP_S]:Ut.REPEAT,[Ut.TEXTURE_WRAP_T]:Ut.REPEAT};function F2(){return{id:"default-sampler",parameters:R2}}function P2(e){return L2[e]}function O2(e){return w2[e]}var bl=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,r={}){let{json:n,buffers:s=[],images:o=[]}=t,{baseUri:i=""}=t;return lt(n),this.baseUri=i,this.buffers=s,this.images=o,this.jsonUnprocessed=n,this.json=this._resolveTree(t.json,r),this.json}_resolveTree(t,r={}){let n={...t};return this.json=n,t.bufferViews&&(n.bufferViews=t.bufferViews.map((s,o)=>this._resolveBufferView(s,o))),t.images&&(n.images=t.images.map((s,o)=>this._resolveImage(s,o))),t.samplers&&(n.samplers=t.samplers.map((s,o)=>this._resolveSampler(s,o))),t.textures&&(n.textures=t.textures.map((s,o)=>this._resolveTexture(s,o))),t.accessors&&(n.accessors=t.accessors.map((s,o)=>this._resolveAccessor(s,o))),t.materials&&(n.materials=t.materials.map((s,o)=>this._resolveMaterial(s,o))),t.meshes&&(n.meshes=t.meshes.map((s,o)=>this._resolveMesh(s,o))),t.nodes&&(n.nodes=t.nodes.map((s,o)=>this._resolveNode(s,o)),n.nodes=n.nodes.map((s,o)=>this._resolveNodeChildren(s))),t.skins&&(n.skins=t.skins.map((s,o)=>this._resolveSkin(s,o))),t.scenes&&(n.scenes=t.scenes.map((s,o)=>this._resolveScene(s,o))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,r){if(typeof r=="object")return r;let n=t&&t[r];return n||console.warn(`glTF file error: Could not find ${t}[${r}]`),n}_resolveScene(t,r){return{...t,id:t.id||`scene-${r}`,nodes:(t.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(t,r){let n={...t,id:t?.id||`node-${r}`};return t.mesh!==void 0&&(n.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(n.camera=this.getCamera(t.camera)),t.skin!==void 0&&(n.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(n.mesh=t.meshes.reduce((s,o)=>{let i=this.getMesh(o);return s.id=i.id,s.primitives=s.primitives.concat(i.primitives),s},{primitives:[]})),n}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(r=>this.getNode(r))),t}_resolveSkin(t,r){let n=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(t,r){let n={...t,id:t.id||`mesh-${r}`,primitives:[]};return t.primitives&&(n.primitives=t.primitives.map(s=>{let o={...s,attributes:{},indices:void 0,material:void 0},i=s.attributes;for(let a in i)o.attributes[a]=this.getAccessor(i[a]);return s.indices!==void 0&&(o.indices=this.getAccessor(s.indices)),s.material!==void 0&&(o.material=this.getMaterial(s.material)),o})),n}_resolveMaterial(t,r){let n={...t,id:t.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let s=n.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return n}_resolveAccessor(t,r){let n=P2(t.componentType),s=O2(t.type),o=n*s,i={...t,id:t.id||`accessor-${r}`,bytesPerComponent:n,components:s,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(i.bufferView=this.getBufferView(t.bufferView)),i.bufferView){let a=i.bufferView.buffer,{ArrayType:c,byteLength:l}=qr(i,i.bufferView),f=(i.bufferView.byteOffset||0)+(i.byteOffset||0)+a.byteOffset,u=a.arrayBuffer.slice(f,f+l);i.bufferView.byteStride&&(u=this._getValueFromInterleavedBuffer(a,f,i.bufferView.byteStride,i.bytesPerElement,i.count)),i.value=new c(u)}return i}_getValueFromInterleavedBuffer(t,r,n,s,o){let i=new Uint8Array(o*s);for(let a=0;a<o;a++){let c=r+a*n;i.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return i.buffer}_resolveTexture(t,r){return{...t,id:t.id||`texture-${r}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):F2(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,r){let n={id:t.id||`sampler-${r}`,...t,parameters:{}};for(let s in n){let o=this._enumSamplerParameter(s);o!==void 0&&(n.parameters[o]=n[s])}return n}_enumSamplerParameter(t){return v2[t]}_resolveImage(t,r){let n={...t,id:t.id||`image-${r}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[r];return s&&(n.image=s),n}_resolveBufferView(t,r){let n=t.buffer,s=this.buffers[n].arrayBuffer,o=this.buffers[n].byteOffset||0;return t.byteOffset&&(o+=t.byteOffset),{id:`bufferView-${r}`,...t,buffer:this.buffers[n],data:new Uint8Array(s,o,t.byteLength)}}_resolveCamera(t,r){let n={...t,id:t.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function ns(e,t){return new bl().postProcess(e,t)}var oi={URI:0,EMBEDDED:1};function ii(e,t,r,n){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-r;if(s===0)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=Ye(t,r,s),e.gltfByteOffset=0,e.gltfByteLength=s,r%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function ai(e,t,r,n){let s=r?.["3d-tiles"]||{};if(N2(e,t,r),s.loadGLTF){if(!n)return;if(e.gltfUrl){let{fetch:o}=n,i=await o(e.gltfUrl,r);e.gltfArrayBuffer=await i.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let o=await vt(e.gltfArrayBuffer,ur,r,n);e.gltf=ns(o),e.gpuMemoryUsageInBytes=$n(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function N2(e,t,r){switch(t){case oi.URI:if(e.gltfArrayBuffer){let n=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),o=new TextDecoder().decode(n);e.gltfUrl=o.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case oi.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Hg(e,t,r,n,s){r=D2(e,t,r,n,s),await ai(e,oi.EMBEDDED,n,s);let o=e?.gltf?.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),r}function D2(e,t,r,n,s){r=Oe(e,t,r),r=Hr(e,t,r),r=zr(e,t,r,n),r=ii(e,t,r,n);let o=new ge(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=o.getGlobalProperty("RTC_CENTER",N.FLOAT,3),r}async function zg(e,t,r,n,s){return r=G2(e,t,r,n,s),await ai(e,e.gltfFormat||0,n,s),r}function G2(e,t,r,n,s){if(r=Oe(e,t,r),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);r=Hr(e,t,r);let o=new DataView(t);if(e.gltfFormat=o.getUint32(r,!0),r+=4,r=zr(e,t,r,n),r=ii(e,t,r,n),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let i=new ge(e.featureTableJson,e.featureTableBinary),a=i.getGlobalProperty("INSTANCES_LENGTH");if(i.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=i.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=i.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let c=new cr(e.batchTableJson,e.batchTableBinary,a);return U2(e,i,c,a),r}function U2(e,t,r,n){let s=new Array(n),o=new x,i=new x,a=new x,c=new x,l=new J,f=new $t,u=new x,h={},d=new O,p=[],A=[],m=[],y=[];for(let _=0;_<n;_++){let E;if(t.hasProperty("POSITION"))E=t.getProperty("POSITION",N.FLOAT,3,_,o);else if(t.hasProperty("POSITION_QUANTIZED")){E=t.getProperty("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3,_,o);let g=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3);if(!g)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let S=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3);if(!S)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let R=65535;for(let F=0;F<3;F++)E[F]=E[F]/R*S[F]+g[F]}if(!E)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(E),h.translation=o,e.normalUp=t.getProperty("NORMAL_UP",N.FLOAT,3,_,p),e.normalRight=t.getProperty("NORMAL_RIGHT",N.FLOAT,3,_,A);let M=!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",N.UNSIGNED_SHORT,2,_,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",N.UNSIGNED_SHORT,2,_,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(o,d),d.getRotationMatrix3(l)):l.identity()}M&&(c.copy(i).cross(a).normalize(),l.setColumn(0,i),l.setColumn(1,a),l.setColumn(2,c)),f.fromMatrix3(l),h.rotation=f,u.set(1,1,1);let B=t.getProperty("SCALE",N.FLOAT,1,_,m);Number.isFinite(B)&&u.multiplyByScalar(B);let C=t.getProperty("SCALE_NON_UNIFORM",N.FLOAT,3,_,p);C&&u.scale(C),h.scale=u;let L=t.getProperty("BATCH_ID",N.UNSIGNED_SHORT,1,_,y);L===void 0&&(L=_);let b=new O().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(b),d.scale(h.scale);let T=d.clone();s[_]={modelMatrix:T,batchId:L}}e.instances=s}async function qg(e,t,r,n,s,o){r=Oe(e,t,r);let i=new DataView(t);for(e.tilesLength=i.getUint32(r,!0),r+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-r>12;){let a={shape:"tile3d"};e.tiles.push(a),r=await o(t,r,n,s,a)}return r}async function kg(e,t,r,n){if(e.rotateYtoZ=!0,e.gltfUpAxis=r?.["3d-tiles"]?.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r?.["3d-tiles"]?.loadGLTF){if(!n)return t.byteLength;let s=await vt(t,ur,r,n);e.gltf=ns(s),e.gpuMemoryUsageInBytes=$n(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Bl(e,t=0,r,n,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=zm(e,t),s.type){case ir.COMPOSITE:return await qg(s,e,t,r,n,Bl);case ir.BATCHED_3D_MODEL:return await Hg(s,e,t,r,n);case ir.GLTF:return await kg(s,e,r,n);case ir.INSTANCED_3D_MODEL:return await zg(s,e,t,r,n);case ir.POINT_CLOUD:return await lg(s,e,t,r,n);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Cl(e,t,r){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let o=Jg(e.slice(8,16)),i=new Uint8Array(e,24,o),c=new TextDecoder("utf8").decode(i),l=JSON.parse(c),f=Jg(e.slice(16,24)),u=new ArrayBuffer(0);if(f&&(u=e.slice(24+o)),await ci(l,l.tileAvailability,u,r),Array.isArray(l.contentAvailability))for(let h of l.contentAvailability)await ci(l,h,u,r);else await ci(l,l.contentAvailability,u,r);return await ci(l,l.childSubtreeAvailability,u,r),l}async function ci(e,t,r,n){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let o=e.bufferViews[s],i=e.buffers[o.buffer];if(!n?.baseUrl)throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(i.uri){let c=`${n?.baseUrl||""}/${i.uri}`,f=await(await n.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(f,o.byteOffset,o.byteLength);return}let a=e.buffers.slice(0,o.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(r.slice(a,a+i.byteLength),o.byteOffset,o.byteLength)}function Jg(e){let t=new DataView(e),r=t.getUint32(0,!0),n=t.getUint32(4,!0);return r+2**32*n}var li={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Ho,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Cl,options:{}};var d0=D(Nr(),1);var l0=D(Nr(),1);var Vt=null;try{Vt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Z(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Z.prototype.__isLong__;Object.defineProperty(Z.prototype,"__isLong__",{value:!0});function xt(e){return(e&&e.__isLong__)===!0}function jg(e){var t=Math.clz32(e&-e);return e?31-t:t}Z.isLong=xt;var Xg={},Wg={};function hr(e,t){var r,n,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(n=Wg[e],n)?n:(r=k(e,0,!0),s&&(Wg[e]=r),r)):(e|=0,(s=-128<=e&&e<128)&&(n=Xg[e],n)?n:(r=k(e,e<0?-1:0,!1),s&&(Xg[e]=r),r))}Z.fromInt=hr;function Ht(e,t){if(isNaN(e))return t?Ae:Yt;if(t){if(e<0)return Ae;if(e>=Zg)return e0}else{if(e<=-Kg)return St;if(e+1>=Kg)return t0}return e<0?Ht(-e,t).neg():k(e%Zr|0,e/Zr|0,t)}Z.fromNumber=Ht;function k(e,t,r){return new Z(e,t,r)}Z.fromBits=k;var fi=Math.pow;function Il(e,t,r){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(r=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Ae:Yt;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return Il(e.substring(1),t,r).neg();for(var s=Ht(fi(r,8)),o=Yt,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),c=parseInt(e.substring(i,i+a),r);if(a<8){var l=Ht(fi(r,a));o=o.mul(l).add(Ht(c))}else o=o.mul(s),o=o.add(Ht(c))}return o.unsigned=t,o}Z.fromString=Il;function Kt(e,t){return typeof e=="number"?Ht(e,t):typeof e=="string"?Il(e,t):k(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Z.fromValue=Kt;var Yg=1<<16,V2=1<<24,Zr=Yg*Yg,Zg=Zr*Zr,Kg=Zg/2,Qg=hr(V2),Yt=hr(0);Z.ZERO=Yt;var Ae=hr(0,!0);Z.UZERO=Ae;var Qr=hr(1);Z.ONE=Qr;var $g=hr(1,!0);Z.UONE=$g;var Sl=hr(-1);Z.NEG_ONE=Sl;var t0=k(-1,2147483647,!1);Z.MAX_VALUE=t0;var e0=k(-1,-1,!0);Z.MAX_UNSIGNED_VALUE=e0;var St=k(0,-2147483648,!1);Z.MIN_VALUE=St;var I=Z.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Zr+(this.low>>>0):this.high*Zr+(this.low>>>0)};I.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(St)){var r=Ht(t),n=this.div(r),s=n.mul(r).sub(this);return n.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var o=Ht(fi(t,6),this.unsigned),i=this,a="";;){var c=i.div(o),l=i.sub(c.mul(o)).toInt()>>>0,f=l.toString(t);if(i=c,i.isZero())return f+a;for(;f.length<6;)f="0"+f;a=""+f+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(St)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(t){return xt(t)||(t=Kt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(xt(t)||(t=Kt(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(St)?St:this.not().add(Qr)};I.neg=I.negate;I.add=function(t){xt(t)||(t=Kt(t));var r=this.high>>>16,n=this.high&65535,s=this.low>>>16,o=this.low&65535,i=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,f=0,u=0,h=0,d=0;return d+=o+l,h+=d>>>16,d&=65535,h+=s+c,u+=h>>>16,h&=65535,u+=n+a,f+=u>>>16,u&=65535,f+=r+i,f&=65535,k(h<<16|d,f<<16|u,this.unsigned)};I.subtract=function(t){return xt(t)||(t=Kt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(xt(t)||(t=Kt(t)),Vt){var r=Vt.mul(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ae:Yt;if(this.eq(St))return t.isOdd()?St:Yt;if(t.eq(St))return this.isOdd()?St:Yt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(Qg)&&t.lt(Qg))return Ht(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,s=this.high&65535,o=this.low>>>16,i=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,f=t.low&65535,u=0,h=0,d=0,p=0;return p+=i*f,d+=p>>>16,p&=65535,d+=o*f,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*f,u+=h>>>16,h&=65535,h+=o*l,u+=h>>>16,h&=65535,h+=i*c,u+=h>>>16,h&=65535,u+=n*f+s*l+o*c+i*a,u&=65535,k(d<<16|p,u<<16|h,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(xt(t)||(t=Kt(t)),t.isZero())throw Error("division by zero");if(Vt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?Vt.div_u:Vt.div_s)(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ae:Yt;var n,s,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ae;if(t.gt(this.shru(1)))return $g;o=Ae}else{if(this.eq(St)){if(t.eq(Qr)||t.eq(Sl))return St;if(t.eq(St))return Qr;var i=this.shr(1);return n=i.div(t).shl(1),n.eq(Yt)?t.isNegative()?Qr:Sl:(s=this.sub(t.mul(n)),o=n.add(s.div(t)),o)}else if(t.eq(St))return this.unsigned?Ae:Yt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=Yt}for(s=this;s.gte(t);){n=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:fi(2,a-48),l=Ht(n),f=l.mul(t);f.isNegative()||f.gt(s);)n-=c,l=Ht(n,this.unsigned),f=l.mul(t);l.isZero()&&(l=Qr),o=o.add(l),s=s.sub(f)}return o};I.div=I.divide;I.modulo=function(t){if(xt(t)||(t=Kt(t)),Vt){var r=(this.unsigned?Vt.rem_u:Vt.rem_s)(this.low,this.high,t.low,t.high);return k(r,Vt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return k(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?jg(this.low):jg(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return xt(t)||(t=Kt(t)),k(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return xt(t)||(t=Kt(t)),k(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return xt(t)||(t=Kt(t)),k(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):k(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):k(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?k(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?k(this.high,0,this.unsigned):k(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var r;return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?k(this.high,this.low,this.unsigned):t<32?(r=32-t,k(this.low<<t|this.high>>>r,this.high<<t|this.low>>>r,this.unsigned)):(t-=32,r=32-t,k(this.high<<t|this.low>>>r,this.low<<t|this.high>>>r,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var r;return xt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?k(this.high,this.low,this.unsigned):t<32?(r=32-t,k(this.high<<r|this.low>>>t,this.low<<r|this.high>>>t,this.unsigned)):(t-=32,r=32-t,k(this.low<<r|this.high>>>t,this.high<<r|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?k(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:k(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Z.fromBytes=function(t,r,n){return n?Z.fromBytesLE(t,r):Z.fromBytesBE(t,r)};Z.fromBytesLE=function(t,r){return new Z(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Z.fromBytesBE=function(t,r){return new Z(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var $r=Z;var H2=16;function ss(e){e==="X"&&(e="");let t=e.padEnd(H2,"0");return $r.fromString(t,!0,16)}function wl(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function Ll(e,t){let r=z2(e).shiftRightUnsigned(2);return e.add($r.fromNumber(2*t+1-4).multiply(r))}function z2(e){return e.and(e.not().add(1))}var q2=3,k2=30,J2=2*k2+1,r0=180/Math.PI;function s0(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1],s=n.length,o=0,i=[0,0];for(let a=s-1;a>=0;a--){o=s-a;let c=n[a],l=0,f=0;c==="1"?f=1:c==="2"?(l=1,f=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);j2(u,i,l,f),i[0]+=u*l,i[1]+=u*f}if(r%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:r,ij:i,level:o}}function o0(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<q2+J2;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),s=t.substring(3,r),o=s.length/2,i=$r.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=$r.fromString(s,!0,2).toString(4);a.length<o;)a="0"+a;return`${i}/${a}`}function vl(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function n0(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Rl(e){return[n0(e[0]),n0(e[1])]}function Fl(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function Pl([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*r0,n*r0]}function j2(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function i0(e){let t=vl(e.ij,e.level,[.5,.5]),r=Rl(t),n=Fl(e.face,r);return Pl(n)}var X2=100;function Ol(e){let{face:t,ij:r,level:n}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(X2*Math.pow(2,-n))),i=new Float64Array(4*o*2+2),a=0,c=0;for(let l=0;l<4;l++){let f=s[l].slice(0),u=s[l+1],h=(u[0]-f[0])/o,d=(u[1]-f[1])/o;for(let p=0;p<o;p++){f[0]+=h,f[1]+=d;let A=vl(r,n,f),m=Rl(A),y=Fl(t,m),_=Pl(y);Math.abs(_[1])>89.999&&(_[0]=c);let E=_[0]-c;_[0]+=E>180?-360:E<-180?360:0,i[a++]=_[0],i[a++]=_[1],c=_[0]}}return i[a++]=i[0],i[a++]=i[1],i}function tn(e){let t=W2(e);return s0(t)}function W2(e){if(e.indexOf("/")>0)return e;let t=ss(e);return o0(t)}function Nl(e){let t=tn(e);return i0(t)}function c0(e){let t;if(e.face===2||e.face===5){let r=null,n=0;for(let s=0;s<4;s++){let o=`${e.face}/${s}`,i=tn(o),a=Ol(i);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}t=a0(r)}else{let r=Ol(e);t=a0(r)}return t}function a0(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],r=[];for(let n=0;n<e.length;n+=2)t.push(e[n]),r.push(e[n+1]);return t.sort((n,s)=>n-s),r.sort((n,s)=>n-s),{west:t[0],east:t[t.length-1],north:r[r.length-1],south:r[0]}}function Dl(e,t){let r=t?.minimumHeight||0,n=t?.maximumHeight||0,s=tn(e),o=c0(s),i=o.west,a=o.south,c=o.east,l=o.north,f=[];return f.push(new x(i,l,r)),f.push(new x(c,l,r)),f.push(new x(c,a,r)),f.push(new x(i,a,r)),f.push(new x(i,l,n)),f.push(new x(c,l,n)),f.push(new x(c,a,n)),f.push(new x(i,a,n)),f}function ui(e){let t=e.token,r={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},n=Dl(t,r),s=Nl(t),o=s[0],i=s[1],a=U.WGS84.cartographicToCartesian([o,i,r.maximumHeight]),c=new x(a[0],a[1],a[2]);n.push(c);let l=Gn(n);return[...l.center,...l.halfAxes]}var Y2=4,K2=8,Q2={QUADTREE:Y2,OCTREE:K2};function Z2(e,t,r){if(e?.box){let n=ss(e.s2VolumeInfo.token),s=Ll(n,t),o=wl(s),i={...e.s2VolumeInfo};switch(i.token=o,r){case"OCTREE":let l=e.s2VolumeInfo,f=l.maximumHeight-l.minimumHeight,u=f/2,h=l.minimumHeight+f/2;l.minimumHeight=h-u,l.maximumHeight=h+u;break;default:break}return{box:ui(i),s2VolumeInfo:i}}}async function Ul(e){let{subtree:t,subtreeData:r={level:0,x:0,y:0,z:0},parentData:n={mortonIndex:0,localLevel:-1,localX:0,localY:0,localZ:0},childIndex:s=0,implicitOptions:o,loaderOptions:i,s2VolumeBox:a}=e,{subdivisionScheme:c,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:u,subtreesUriTemplate:h,basePath:d}=o,p={children:[],lodMetricValue:0,contentUrl:""};if(!f)return Ha.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${u} won't be loaded...`),p;let A=n.localLevel+1,m=r.level+A;if(m>f)return p;let y=Q2[c],_=Math.log2(y),E=s&1,M=s>>1&1,B=s>>2&1,C=dr(n.localX,E,1),L=dr(n.localY,M,1),b=dr(n.localZ,B,1),T=dr(r.x,C,A),g=dr(r.y,L,A),S=dr(r.z,b,A),R=dr(n.mortonIndex,s,_),F=A===l&&Gl(t.childSubtreeAvailability,R),v,G,X,z;if(F){let Y=`${d}/${h}`,$=hi(Y,m,T,g,S);v=await(0,l0.load)($,li,i),z=0,G={level:m,x:T,y:g,z:S},X={mortonIndex:0,localLevel:0,localX:0,localY:0,localZ:0}}else v=t,z=(y**A-1)/(y-1)+R,G=r,X={mortonIndex:R,localLevel:A,localX:C,localY:L,localZ:b};if(!Gl(v.tileAvailability,z))return p;Gl(v.contentAvailability,z)&&(p.contentUrl=hi(u,m,T,g,S));for(let Y=0;Y<y;Y++){let $=Z2(a,Y,c),bt=await Ul({subtree:v,subtreeData:G,parentData:X,childIndex:Y,implicitOptions:o,loaderOptions:i,s2VolumeBox:$});(bt.contentUrl||bt.children.length)&&p.children.push(bt)}return p.contentUrl||p.children.length?$2(p,{level:m,x:T,y:g,z:S},o,a):p}function Gl(e,t){let r;return Array.isArray(e)?(r=e[0],e.length>1&&Ha.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=e,"constant"in r?Boolean(r.constant):r.explicitBitstream?rw(t,r.explicitBitstream):!1}function $2(e,t,r,n){let{basePath:s,refine:o,getRefine:i,lodMetricType:a,getTileType:c,rootLodMetricValue:l,rootBoundingVolume:f}=r,u=e.contentUrl&&e.contentUrl.replace(`${s}/`,""),h=l/2**t.level,d=n?.box?{box:n.box}:f,p=tw(d,t,r.subdivisionScheme);return{children:e.children,contentUrl:e.contentUrl,content:{uri:u},id:e.contentUrl,refine:i(o),type:c(e),lodMetricType:a,lodMetricValue:h,geometricError:h,transform:e.transform,boundingVolume:p}}function tw(e,t,r){if(e.region){let{level:n,x:s,y:o,z:i}=t,[a,c,l,f,u,h]=e.region,d=2**n,p=(l-a)/d,[A,m]=[a+p*s,a+p*(s+1)],y=(f-c)/d,[_,E]=[c+y*o,c+y*(o+1)],M,B;if(r==="OCTREE"){let C=(h-u)/d;[M,B]=[u+C*i,u+C*(i+1)]}else[M,B]=[u,h];return{region:[A,_,m,E,M,B]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${JSON.stringify(e)}`)}function dr(e,t,r){return(e<<r)+t}function hi(e,t,r,n,s){let o=ew({level:t,x:r,y:n,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,i=>o[i])}function ew(e){let t={};for(let r in e)t[`{${r}}`]=e[r];return t}function rw(e,t){let r=Math.floor(e/8),n=e%8;return(t[r]>>n&1)===1}function Hl(e,t=""){if(!t)return Gt.EMPTY;let n=t.split("?")[0].split(".").pop();switch(n){case"pnts":return Gt.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Gt.SCENEGRAPH;default:return n||Gt.EMPTY}}function zl(e){switch(e){case"REPLACE":case"replace":return mt.REPLACE;case"ADD":case"add":return mt.ADD;default:return e}}function Vl(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let n=new URL(e,`${t}/`);return decodeURI(n.toString())}else if(e.startsWith("/"))return e;return Ie.resolve(t,e)}function f0(e,t){if(!e)return null;let r;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(r=Vl(s,t))}return{...e,id:r,contentUrl:r,lodMetricType:me.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Hl(e,r),refine:zl(e.refine)}}async function p0(e,t,r){let n=null,s=h0(e.root);s&&e.root?n=await u0(e.root,e,t,s,r):n=f0(e.root,t);let o=[];for(o.push(n);o.length>0;){let i=o.pop()||{},a=i.children||[],c=[];for(let l of a){let f=h0(l),u;f?u=await u0(l,e,t,f,r):u=f0(l,t),u&&(c.push(u),o.push(u))}i.children=c}return n}async function u0(e,t,r,n,s){let{subdivisionScheme:o,maximumLevel:i,availableLevels:a,subtreeLevels:c,subtrees:{uri:l}}=n,f=hi(l,0,0,0,0),u=Vl(f,r),h=await(0,d0.load)(u,li,s),d=e.content?.uri,p=d?Vl(d,r):"",A=t?.root?.refine,m=e.geometricError,y=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(y){let B={box:ui(y),s2VolumeInfo:y};e.boundingVolume=B}let _=e.boundingVolume,E={contentUrlTemplate:p,subtreesUriTemplate:l,subdivisionScheme:o,subtreeLevels:c,maximumLevel:Number.isFinite(a)?a-1:i,refine:A,basePath:r,lodMetricType:me.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:_,getTileType:Hl,getRefine:zl};return await nw(e,r,h,E,s)}async function nw(e,t,r,n,s){if(!e)return null;let{children:o,contentUrl:i}=await Ul({subtree:r,implicitOptions:n,loaderOptions:s}),a,c=null;return i&&(a=i,c={uri:i.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:me.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Hl(e,a),refine:zl(e.refine),content:c||e.content,children:o}}function h0(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var di={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Ho,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:sw,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function sw(e,t={},r){let n=t["3d-tiles"]||{},s;return n.isTileset==="auto"?s=r?.url&&r.url.indexOf(".json")!==-1:s=n.isTileset,s?ow(e,t,r):iw(e,t,r)}async function ow(e,t,r){let n=JSON.parse(new TextDecoder().decode(e)),s=r?.url||"",o=aw(s),i=await p0(n,o,t||{});return{...n,shape:"tileset3d",loader:di,url:s,queryString:r?.queryString||"",basePath:o,root:i||n.root,type:ht.TILES3D,lodMetricType:me.GEOMETRIC_ERROR,lodMetricValue:n.root?.geometricError||0}}async function iw(e,t,r){let n={content:{shape:"tile3d",featureIds:null}};return await Bl(e,0,t,r,n.content),n.content}function aw(e){return Ie.dirname(e)}var m0=[0],cw={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:di,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,r)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},os=class extends Ge.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Ge.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:r,changeFlags:n}){if(t.data&&t.data!==r.data&&this._loadTileset(t.data),n.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(n.propsChanged){let{layerMap:s}=this.state;for(let o in s)s[o].needsUpdate=!0}}activateViewport(t){let{activeViewports:r,lastUpdatedViewports:n}=this.state;this.internalState.viewport=t,r[t.id]=t;let s=n?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:r}){let n=r&&r.props.tile;return t.picked&&(t.object=n),t.sourceTile=n,t}filterSubLayer({layer:t,viewport:r}){let{tile:n}=t.props,{id:s}=r;return n.selected&&n.viewportIds.includes(s)}_updateAutoHighlight(t){let r=t.sourceTile,n=this.state.layerMap[r?.id];n&&n.layer&&n.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:r={}}=this.props,n=this.props.loader||this.props.loaders,s=Array.isArray(n)?n[0]:n,o={loadOptions:{...r}},i=t;if(s.preload){let l=await s.preload(t,r);l.url&&(i=l.url),l.headers&&(o.loadOptions.fetch={...o.loadOptions.fetch,headers:l.headers}),Object.assign(o,l)}let a=await(0,y0.load)(i,s,o.loadOptions),c=new Qn(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...o});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:r}=this.state;this.props.onTileLoad(t),this._updateTileset(r),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:r}=this.state,{timeline:n}=this.context,s=Object.keys(t).length;!n||!s||!r||r.selectTiles(Object.values(t)).then(o=>{this.state.frameNumber!==o&&this.setState({frameNumber:o})})}_getSubLayer(t,r){if(!t.content)return null;switch(t.type){case Gt.POINTCLOUD:return this._makePointCloudLayer(t,r);case Gt.SCENEGRAPH:return this._make3DModelLayer(t);case Gt.MESH:return this._makeSimpleMeshLayer(t,r);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,r){let{attributes:n,pointCount:s,constantRGBA:o,cartographicOrigin:i,modelMatrix:a}=t.content,{positions:c,normals:l,colors:f}=n;if(!c)return null;let u=r&&r.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:f}},{pointSize:h,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",A0.PointCloudLayer);return new p({pointSize:h},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:u,coordinateSystem:Ge.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:i,modelMatrix:a,getColor:o||d,_offset:0})}_make3DModelLayer(t){let{gltf:r,instances:n,cartographicOrigin:s,modelMatrix:o}=t.content,i=this.getSubLayerClass("scenegraph",x0.ScenegraphLayer);return new i({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:n||m0,scenegraph:r,coordinateSystem:Ge.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:o,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,r){let n=t.content,{attributes:s,indices:o,modelMatrix:i,cartographicOrigin:a,coordinateSystem:c=Ge.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:f}=n,{_getMeshColor:u}=this.props,h=r&&r.props.mesh||new g0.Geometry({topology:"triangle-list",attributes:lw(s),indices:o}),d=this.getSubLayerClass("mesh",rm);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:h,data:m0,getColor:u(t),pbrMaterial:l,modelMatrix:i,coordinateOrigin:a,coordinateSystem:c,featureIds:f,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:r}=this.state;return t?t.tiles.map(n=>{let s=r[n.id]=r[n.id]||{tile:n},{layer:o}=s;return n.selected&&(o?s.needsUpdate&&(o=this._getSubLayer(n,o),s.needsUpdate=!1):o=this._getSubLayer(n)),s.layer=o,o}).filter(Boolean):null}};os.defaultProps=cw;os.layerName="Tile3DLayer";var T0=os;function lw(e){let t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}var xi=D(qt(),1),Xl=D(Co(),1),S0=D(qt(),1);var fw=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function ql(e){return e>>1^-(e&1)}function uw(e){let t=0,r={};for(let[n,s]of fw){let o=s===8?e.getFloat64:e.getFloat32;r[n]=o.call(e,t,!0),t+=s}return{header:r,headerEndPosition:t}}function hw(e,t){let r=t,n=3,s=e.getUint32(r,!0),o=new Uint16Array(s*n);r+=Uint32Array.BYTES_PER_ELEMENT;let i=Uint16Array.BYTES_PER_ELEMENT,a=s*i,c=r,l=c+a,f=l+a,u=0,h=0,d=0;for(let p=0;p<s;p++)u+=ql(e.getUint16(c+i*p,!0)),h+=ql(e.getUint16(l+i*p,!0)),d+=ql(e.getUint16(f+i*p,!0)),o[p]=u,o[p+s]=h,o[p+s*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function is(e,t,r,n,s=!0){let o;if(n===2?o=new Uint16Array(e,t,r):o=new Uint32Array(e,t,r),!s)return o;let i=0;for(let a=0;a<o.length;++a){let c=o[a];o[a]=i-c,c===0&&++i}return o}function dw(e,t,r){let n=r,s=3,i=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%i!==0&&(n+=i-n%i);let a=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=is(e.buffer,n,c,i);return n+=c*i,{triangleIndicesEndPosition:n,triangleIndices:l}}function pw(e,t,r){let n=r,s=3,i=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=is(e.buffer,n,a,i,!1);n+=a*i;let l=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let f=is(e.buffer,n,l,i,!1);n+=l*i;let u=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=is(e.buffer,n,u,i,!1);n+=u*i;let d=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=is(e.buffer,n,d,i,!1);return n+=d*i,{edgeIndicesEndPosition:n,westIndices:c,southIndices:f,eastIndices:h,northIndices:p}}function mw(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function gw(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function Aw(e,t){let r={};if(e.byteLength<=t)return{extensions:r,extensionsEndPosition:t};let n=t;for(;n<e.byteLength;){let s=e.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let o=e.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let i=new DataView(e.buffer,n,o);switch(s){case 1:{r.vertexNormals=mw(i);break}case 2:{r.waterMask=gw(i);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var pr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},xw={maxDecodingStep:pr.extensions};function kl(e,t){let r=Object.assign({},xw,t),n=new DataView(e),{header:s,headerEndPosition:o}=uw(n);if(r.maxDecodingStep<pr.vertices)return{header:s};let{vertexData:i,vertexDataEndPosition:a}=hw(n,o);if(r.maxDecodingStep<pr.triangleIndices)return{header:s,vertexData:i};let{triangleIndices:c,triangleIndicesEndPosition:l}=dw(n,i,a);if(r.maxDecodingStep<pr.edgeIndices)return{header:s,vertexData:i,triangleIndices:c};let{westIndices:f,southIndices:u,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=pw(n,i,l);if(r.maxDecodingStep<pr.extensions)return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u};let{extensions:A}=Aw(n,p);return{header:s,vertexData:i,triangleIndices:c,westIndices:f,northIndices:d,eastIndices:h,southIndices:u,extensions:A}}function pi(e,t,r,n){let s=n?Tw(n,e.POSITION.value):yw(t),o=new e.POSITION.value.constructor(s.length*6),i=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let f=s[l];Ew({edge:f,edgeIndex:l,attributes:e,skirtHeight:r,newPosition:o,newTexcoord0:i,newTriangles:a})}e.POSITION.value=bn(e.POSITION.value,o),e.TEXCOORD_0.value=bn(e.TEXCOORD_0.value,i);let c=t instanceof Array?t.concat(a):bn(t,a);return{attributes:e,triangles:c}}function yw(e){let t=[];for(let s=0;s<e.length;s+=3)t.push([e[s],e[s+1]]),t.push([e[s+1],e[s+2]]),t.push([e[s+2],e[s]]);t.sort((s,o)=>Math.min(...s)-Math.min(...o)||Math.max(...s)-Math.max(...o));let r=[],n=0;for(;n<t.length;)t[n][0]===t[n+1]?.[1]&&t[n][1]===t[n+1]?.[0]?n+=2:(r.push(t[n]),n++);return r}function Tw(e,t){e.westIndices.sort((n,s)=>t[3*n+1]-t[3*s+1]),e.eastIndices.sort((n,s)=>t[3*s+1]-t[3*n+1]),e.southIndices.sort((n,s)=>t[3*s]-t[3*n]),e.northIndices.sort((n,s)=>t[3*n]-t[3*s]);let r=[];for(let n in e){let s=e[n];for(let o=0;o<s.length-1;o++)r.push([s[o],s[o+1]])}return r}function Ew({edge:e,edgeIndex:t,attributes:r,skirtHeight:n,newPosition:s,newTexcoord0:o,newTriangles:i}){let a=r.POSITION.value.length,c=t*2,l=t*2+1;s.set(r.POSITION.value.subarray(e[0]*3,e[0]*3+3),c*3),s[c*3+2]=s[c*3+2]-n,s.set(r.POSITION.value.subarray(e[1]*3,e[1]*3+3),l*3),s[l*3+2]=s[l*3+2]-n,o.set(r.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),c*2),o.set(r.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),l*2);let f=t*2*3;i[f]=e[0],i[f+1]=a/3+l,i[f+2]=e[1],i[f+3]=a/3+l,i[f+4]=e[0],i[f+5]=a/3+c}function Jl(e,t={}){let{bounds:r}=t,{header:n,vertexData:s,triangleIndices:o,westIndices:i,northIndices:a,eastIndices:c,southIndices:l}=kl(e,pr.triangleIndices),f=o,u=_w(s,n,r),h=ar(u);if(t?.skirtHeight){let{attributes:d,triangles:p}=pi(u,f,t.skirtHeight,{westIndices:i,northIndices:a,eastIndices:c,southIndices:l});u=d,f=p}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:f,size:1},attributes:u}}function _w(e,t,r){let{minHeight:n,maxHeight:s}=t,[o,i,a,c]=r||[0,0,1,1],l=a-o,f=c-i,u=s-n,h=e.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let A=0;A<h;A++){let m=e[A]/32767,y=e[A+h]/32767,_=e[A+h*2]/32767;d[3*A+0]=m*l+o,d[3*A+1]=y*f+i,d[3*A+2]=_*u+n,p[2*A+0]=m,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var as=class{constructor(t=257){this.gridSize=t;let r=t-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let s=n+2,o=0,i=0,a=0,c=0,l=0,f=0;for(s&1?a=c=l=r:o=i=f=r;(s>>=1)>1;){let h=o+a>>1,d=i+c>>1;s&1?(a=o,c=i,o=l,i=f):(o=a,i=c,a=l,c=f),l=h,f=d}let u=n*4;this.coords[u+0]=o,this.coords[u+1]=i,this.coords[u+2]=a,this.coords[u+3]=c}}createTile(t){return new jl(t,this)}},jl=class{constructor(t,r){let n=r.gridSize;if(t.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${t.length}.`);this.terrain=t,this.martini=r,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:r,coords:n,gridSize:s}=this.martini,{terrain:o,errors:i}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=n[c+0],f=n[c+1],u=n[c+2],h=n[c+3],d=l+u>>1,p=f+h>>1,A=d+p-f,m=p+l-d,y=(o[f*s+l]+o[h*s+u])/2,_=p*s+d,E=Math.abs(y-o[_]);if(i[_]=Math.max(i[_],E),a<r){let M=(f+m>>1)*s+(l+A>>1),B=(h+m>>1)*s+(u+A>>1);i[_]=Math.max(i[_],i[M],i[B])}}}getMesh(t=0){let{gridSize:r,indices:n}=this.martini,{errors:s}=this,o=0,i=0,a=r-1;n.fill(0);function c(d,p,A,m,y,_){let E=d+A>>1,M=p+m>>1;Math.abs(d-y)+Math.abs(p-_)>1&&s[M*r+E]>t?(c(y,_,d,p,E,M),c(A,m,y,_,E,M)):(n[p*r+d]=n[p*r+d]||++o,n[m*r+A]=n[m*r+A]||++o,n[_*r+y]=n[_*r+y]||++o,i++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(o*2),f=new Uint32Array(i*3),u=0;function h(d,p,A,m,y,_){let E=d+A>>1,M=p+m>>1;if(Math.abs(d-y)+Math.abs(p-_)>1&&s[M*r+E]>t)h(y,_,d,p,E,M),h(A,m,y,_,E,M);else{let B=n[p*r+d]-1,C=n[m*r+A]-1,L=n[_*r+y]-1;l[2*B]=d,l[2*B+1]=p,l[2*C]=A,l[2*C+1]=m,l[2*L]=y,l[2*L+1]=_,f[u++]=B,f[u++]=C,f[u++]=L}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:l,triangles:f}}};var cs=class{constructor(t,r,n=r){this.data=t,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=r-1,o=n-1,i=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,o),l=this._addPoint(s,o),f=this._addTriangle(l,i,c,-1,-1,-1);this._addTriangle(i,l,a,f,-1,-1),this._flush()}run(t=1){for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,r){return this.data[this.width*r+t]}_flush(){let t=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],s=2*this.triangles[n*3+0],o=2*this.triangles[n*3+1],i=2*this.triangles[n*3+2];this._findCandidate(t[s],t[s+1],t[o],t[o+1],t[i],t[i+1],n)}this._pendingLen=0}_findCandidate(t,r,n,s,o,i,a){let c=Math.min(t,n,o),l=Math.min(r,s,i),f=Math.max(t,n,o),u=Math.max(r,s,i),h=mr(n,s,o,i,c,l),d=mr(o,i,t,r,c,l),p=mr(t,r,n,s,c,l),A=s-r,m=t-n,y=i-s,_=n-o,E=r-i,M=o-t,B=mr(t,r,n,s,o,i),C=this.heightAt(t,r)/B,L=this.heightAt(n,s)/B,b=this.heightAt(o,i)/B,T=0,g=0,S=0,R=0;for(let F=l;F<=u;F++){let v=0;h<0&&y!==0&&(v=Math.max(v,Math.floor(-h/y))),d<0&&E!==0&&(v=Math.max(v,Math.floor(-d/E))),p<0&&A!==0&&(v=Math.max(v,Math.floor(-p/A)));let G=h+y*v,X=d+E*v,z=p+A*v,et=!1;for(let K=c+v;K<=f;K++){if(G>=0&&X>=0&&z>=0){et=!0;let Y=C*G+L*X+b*z,$=Math.abs(Y-this.heightAt(K,F));R+=$*$,$>T&&(T=$,g=K,S=F)}else if(et)break;G+=y,X+=E,z+=A}h+=_,d+=M,p+=m}(g===t&&S===r||g===n&&S===s||g===o&&S===i)&&(T=0),this._candidates[2*a]=g,this._candidates[2*a+1]=S,this._rms[a]=R,this._queuePush(a,T,R)}_step(){let t=this._queuePop(),r=t*3+0,n=t*3+1,s=t*3+2,o=this.triangles[r],i=this.triangles[n],a=this.triangles[s],c=this.coords[2*o],l=this.coords[2*o+1],f=this.coords[2*i],u=this.coords[2*i+1],h=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*t],A=this._candidates[2*t+1],m=this._addPoint(p,A);if(mr(c,l,f,u,p,A)===0)this._handleCollinear(m,r);else if(mr(f,u,h,d,p,A)===0)this._handleCollinear(m,n);else if(mr(h,d,c,l,p,A)===0)this._handleCollinear(m,s);else{let y=this._halfedges[r],_=this._halfedges[n],E=this._halfedges[s],M=this._addTriangle(o,i,m,y,-1,-1,r),B=this._addTriangle(i,a,m,_,-1,M+1),C=this._addTriangle(a,o,m,E,M+2,B+1);this._legalize(M),this._legalize(B),this._legalize(C)}}_addPoint(t,r){let n=this.coords.length>>1;return this.coords.push(t,r),n}_addTriangle(t,r,n,s,o,i,a=this.triangles.length){let c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=s,this._halfedges[a+1]=o,this._halfedges[a+2]=i,s>=0&&(this._halfedges[s]=a+0),o>=0&&(this._halfedges[o]=a+1),i>=0&&(this._halfedges[i]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let r=this._halfedges[t];if(r<0)return;let n=t-t%3,s=r-r%3,o=n+(t+1)%3,i=n+(t+2)%3,a=s+(r+2)%3,c=s+(r+1)%3,l=this.triangles[i],f=this.triangles[t],u=this.triangles[o],h=this.triangles[a],d=this.coords;if(!Mw(d[2*l],d[2*l+1],d[2*f],d[2*f+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1]))return;let p=this._halfedges[o],A=this._halfedges[i],m=this._halfedges[a],y=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(s/3);let _=this._addTriangle(l,h,u,-1,m,p,n),E=this._addTriangle(h,l,f,_,A,y,s);this._legalize(_+1),this._legalize(E+2)}_handleCollinear(t,r){let n=r-r%3,s=n+(r+1)%3,o=n+(r+2)%3,i=this.triangles[o],a=this.triangles[r],c=this.triangles[s],l=this._halfedges[s],f=this._halfedges[o],u=this._halfedges[r];if(u<0){let C=this._addTriangle(t,i,a,-1,f,-1,n),L=this._addTriangle(i,t,c,C,-1,l);this._legalize(C+1),this._legalize(L+2);return}let h=u-u%3,d=h+(u+2)%3,p=h+(u+1)%3,A=this.triangles[d],m=this._halfedges[d],y=this._halfedges[p];this._queueRemove(h/3);let _=this._addTriangle(i,a,t,f,-1,-1,n),E=this._addTriangle(a,A,t,y,-1,_+1,h),M=this._addTriangle(A,c,t,m,-1,E+1),B=this._addTriangle(c,i,t,l,_+2,M+1);this._legalize(_),this._legalize(E),this._legalize(M),this._legalize(B)}_queuePush(t,r,n){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(r),this._rmsSum+=n,this._queueUp(s)}_queuePop(){let t=this._queue.length-1;return this._queueSwap(0,t),this._queueDown(0,t),this._queuePopBack()}_queuePopBack(){let t=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[t],this._queueIndices[t]=-1,t}_queueRemove(t){let r=this._queueIndices[t];if(r<0){let s=this._pending.indexOf(t);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(t,r){return this._errors[t]>this._errors[r]}_queueSwap(t,r){let n=this._queue[t],s=this._queue[r];this._queue[t]=s,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[s]=t;let o=this._errors[t];this._errors[t]=this._errors[r],this._errors[r]=o}_queueUp(t){let r=t;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(t,r){let n=t;for(;;){let s=2*n+1;if(s>=r||s<0)break;let o=s+1,i=s;if(o<r&&this._queueLess(o,s)&&(i=o),!this._queueLess(i,n))break;this._queueSwap(n,i),n=i}return n>t}};function mr(e,t,r,n,s,o){return(r-s)*(t-o)-(n-o)*(e-s)}function Mw(e,t,r,n,s,o,i,a){let c=e-i,l=t-a,f=r-i,u=n-a,h=s-i,d=o-a,p=c*c+l*l,A=f*f+u*u,m=h*h+d*d;return c*(u*m-A*d)-l*(f*m-A*h)+p*(f*d-u*h)<0}function M0(e,t){let{meshMaxError:r,bounds:n,elevationDecoder:s}=t,{data:o,width:i,height:a}=e,c,l;switch(t.tesselator){case"martini":c=mi(o,i,a,s,t.tesselator),l=E0(r,i,c);break;case"delatin":c=mi(o,i,a,s,t.tesselator),l=_0(r,i,a,c);break;default:i===a&&!(a&i-1)?(c=mi(o,i,a,s,"martini"),l=E0(r,i,c)):(c=mi(o,i,a,s,"delatin"),l=_0(r,i,a,c));break}let{vertices:f}=l,{triangles:u}=l,h=bw(f,c,i,a,n),d=ar(h);if(t.skirtHeight){let{attributes:p,triangles:A}=pi(h,u,t.skirtHeight);h=p,u=A}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(u),size:1},attributes:h}}function E0(e,t,r){let n=t+1,o=new as(n).createTile(r),{vertices:i,triangles:a}=o.getMesh(e);return{vertices:i,triangles:a}}function _0(e,t,r,n){let s=new cs(n,t+1,r+1);s.run(e);let{coords:o,triangles:i}=s;return{vertices:o,triangles:i}}function mi(e,t,r,n,s){let{rScaler:o,bScaler:i,gScaler:a,offset:c}=n,l=new Float32Array((t+1)*(r+1));for(let f=0,u=0;u<r;u++)for(let h=0;h<t;h++,f++){let d=f*4,p=e[d+0],A=e[d+1],m=e[d+2];l[f+u]=p*o+A*a+m*i+c}if(s==="martini"){for(let f=(t+1)*t,u=0;u<t;u++,f++)l[f]=l[f-t-1];for(let f=r,u=0;u<r+1;u++,f+=r+1)l[f]=l[f-1]}return l}function bw(e,t,r,n,s){let o=r+1,i=e.length/2,a=new Float32Array(i*3),c=new Float32Array(i*2),[l,f,u,h]=s||[0,0,r,n],d=(u-l)/r,p=(h-f)/n;for(let A=0;A<i;A++){let m=e[A*2],y=e[A*2+1],_=y*o+m;a[3*A+0]=m*d+l,a[3*A+1]=-y*p+h,a[3*A+2]=t[_],c[2*A+0]=m/r,c[2*A+1]=y/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var gi="4.3.3";var Ai={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:gi,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var b0={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:gi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var Bw={...Ai,parse:Cw};async function Cw(e,t,r){let n={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await vt(e,[],n,r),o={...Bw.options.terrain,...t?.terrain};return M0(s,o)}var Tz={...b0,parseSync:(e,t)=>Jl(e,t?.["quantized-mesh"]),parse:async(e,t)=>Jl(e,t?.["quantized-mesh"])};var B0=[1],Sw={...nr.defaultProps,elevationData:Re,texture:{...Re,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[Ai]};function C0(e){return Array.isArray(e)?e.join(";"):e||""}var ls=class extends xi.CompositeLayer{updateState({props:t,oldProps:r}){let n=t.elevationData!==r.elevationData;if(n){let{elevationData:o}=t,i=o&&(Array.isArray(o)||Iw(o));this.setState({isTiled:i})}let s=n||t.meshMaxError!==r.meshMaxError||t.elevationDecoder!==r.elevationDecoder||t.bounds!==r.bounds;if(!this.state.isTiled&&s){let o=this.loadTerrain(t);this.setState({terrain:o})}t.workerUrl&&xi.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:r,elevationDecoder:n,meshMaxError:s,signal:o}){if(!t)return null;let i=this.getLoadOptions();i={...i,terrain:{skirtHeight:this.state.isTiled?s*2:0,...i?.terrain,bounds:r,meshMaxError:s,elevationDecoder:n}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:i,signal:o})}getTiledTerrainData(t){let{elevationData:r,fetch:n,texture:s,elevationDecoder:o,meshMaxError:i}=this.props,{viewport:a}=this.context,c=oe(r,t),l=s&&oe(s,t),{signal:f}=t,u=[0,0],h=[0,0];if(a.isGeospatial){let m=t.bbox;u=a.projectFlat([m.west,m.south]),h=a.projectFlat([m.east,m.north])}else{let m=t.bbox;u=[m.left,m.bottom],h=[m.right,m.top]}let d=[u[0],u[1],h[0],h[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:o,meshMaxError:i,signal:f}),A=l?n(l,{propName:"texture",layer:this,loaders:[],signal:f}).catch(m=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let r=this.getSubLayerClass("mesh",Xl.SimpleMeshLayer),{color:n,wireframe:s,material:o}=this.props,{data:i}=t;if(!i)return null;let[a,c]=i;return new r(t,{data:B0,mesh:a,texture:c,_instanced:!1,coordinateSystem:S0.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:n,wireframe:s,material:o})}onViewportLoad(t){if(!t)return;let{zRange:r}=this.state,n=t.map(i=>i.content).filter(Boolean).map(i=>i[0].header.boundingBox.map(c=>c[2]));if(n.length===0)return;let s=Math.min(...n.map(i=>i[0])),o=Math.max(...n.map(i=>i[1]));(!r||s<r[0]||o>r[1])&&this.setState({zRange:[s,o]})}renderLayers(){let{color:t,material:r,elevationData:n,texture:s,wireframe:o,meshMaxError:i,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:_}=this.props;if(this.state.isTiled)return new nr(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:C0(n),texture:C0(s),meshMaxError:i,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:f,extent:u,maxRequests:h,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:m,maxCacheByteSize:y,refinementStrategy:_});if(!n)return null;let E=this.getSubLayerClass("mesh",Xl.SimpleMeshLayer);return new E(this.getSubLayerProps({id:"mesh"}),{data:B0,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:M=>[0,0,0],getColor:t,material:r,wireframe:o})}};ls.defaultProps=Sw;ls.layerName="TerrainLayer";var I0=ls,Iw=e=>e.includes("{x}")&&(e.includes("{y}")||e.includes("{-y}"));var wi=D(qt(),1),hf=D(zt(),1),a1=D(L0(),1);var fs={x:0,y:1,z:2};function gr(e,t={}){let{start:r=0,end:n=e.length,plane:s="xy"}=t,o=t.size||2,i=0,a=fs[s[0]],c=fs[s[1]];for(let l=r,f=n-o;l<n;l+=o)i+=(e[l+a]-e[f+a])*(e[l+c]+e[f+c]),f=l;return i/2}function Yl(e,t,r=2,n,s="xy"){let o=t&&t.length,i=o?t[0]*r:e.length,a=R0(e,0,i,r,!0,n&&n[0],s),c=[];if(!a||a.next===a.prev)return c;let l,f,u,h,d,p,A;if(o&&(a=Ow(e,t,a,r,n,s)),e.length>80*r){h=f=e[0],d=u=e[1];for(let m=r;m<i;m+=r)p=e[m],A=e[m+1],p<h&&(h=p),A<d&&(d=A),p>f&&(f=p),A>u&&(u=A);l=Math.max(f-h,u-d),l=l!==0?32767/l:0}return us(a,c,r,h,d,l,0),c}function R0(e,t,r,n,s,o,i){let a,c;o===void 0&&(o=gr(e,{start:t,end:r,size:n,plane:i}));let l=fs[i[0]],f=fs[i[1]];if(s===o<0)for(a=t;a<r;a+=n)c=v0(a,e[a+l],e[a+f],c);else for(a=r-n;a>=t;a-=n)c=v0(a,e[a+l],e[a+f],c);return c&&Ei(c,c.next)&&(ds(c),c=c.next),c}function Ar(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ei(r,r.next)||nt(r.prev,r,r.next)===0)){if(ds(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function us(e,t,r,n,s,o,i){if(!e)return;!i&&o&&Vw(e,n,s,o);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,o?Rw(e,n,s,o):vw(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),ds(e),e=l.next,a=l.next;continue}if(e=l,e===a){i?i===1?(e=Fw(Ar(e),t,r),us(e,t,r,n,s,o,2)):i===2&&Pw(e,t,r,n,s,o):us(Ar(e),t,r,n,s,o,1);break}}}function vw(e){let t=e.prev,r=e,n=e.next;if(nt(t,r,n)>=0)return!1;let s=t.x,o=r.x,i=n.x,a=t.y,c=r.y,l=n.y,f=s<o?s<i?s:i:o<i?o:i,u=a<c?a<l?a:l:c<l?c:l,h=s>o?s>i?s:i:o>i?o:i,d=a>c?a>l?a:l:c>l?c:l,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&en(s,a,o,c,i,l,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Rw(e,t,r,n){let s=e.prev,o=e,i=e.next;if(nt(s,o,i)>=0)return!1;let a=s.x,c=o.x,l=i.x,f=s.y,u=o.y,h=i.y,d=a<c?a<l?a:l:c<l?c:l,p=f<u?f<h?f:h:u<h?u:h,A=a>c?a>l?a:l:c>l?c:l,m=f>u?f>h?f:h:u>h?u:h,y=Wl(d,p,t,r,n),_=Wl(A,m,t,r,n),E=e.prevZ,M=e.nextZ;for(;E&&E.z>=y&&M&&M.z<=_;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&en(a,f,c,u,l,h,E.x,E.y)&&nt(E.prev,E,E.next)>=0||(E=E.prevZ,M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&en(a,f,c,u,l,h,M.x,M.y)&&nt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;E&&E.z>=y;){if(E.x>=d&&E.x<=A&&E.y>=p&&E.y<=m&&E!==s&&E!==i&&en(a,f,c,u,l,h,E.x,E.y)&&nt(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;M&&M.z<=_;){if(M.x>=d&&M.x<=A&&M.y>=p&&M.y<=m&&M!==s&&M!==i&&en(a,f,c,u,l,h,M.x,M.y)&&nt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Fw(e,t,r){let n=e;do{let s=n.prev,o=n.next.next;!Ei(s,o)&&F0(s,n,n.next,o)&&hs(s,o)&&hs(o,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ds(n),ds(n.next),n=e=o),n=n.next}while(n!==e);return Ar(n)}function Pw(e,t,r,n,s,o){let i=e;do{let a=i.next.next;for(;a!==i.prev;){if(i.i!==a.i&&qw(i,a)){let c=P0(i,a);i=Ar(i,i.next),c=Ar(c,c.next),us(i,t,r,n,s,o,0),us(c,t,r,n,s,o,0);return}a=a.next}i=i.next}while(i!==e)}function Ow(e,t,r,n,s,o){let i=[],a,c,l,f,u;for(a=0,c=t.length;a<c;a++)l=t[a]*n,f=a<c-1?t[a+1]*n:e.length,u=R0(e,l,f,n,!1,s&&s[a+1],o),u===u.next&&(u.steiner=!0),i.push(zw(u));for(i.sort(Nw),a=0;a<i.length;a++)r=Dw(i[a],r);return r}function Nw(e,t){return e.x-t.x}function Dw(e,t){let r=Gw(e,t);if(!r)return t;let n=P0(r,e);return Ar(n,n.next),Ar(r,r.next)}function Gw(e,t){let r=t,n=e.x,s=e.y,o=-1/0,i;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let h=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,i=r.x<r.next.x?r:r.next,h===n))return i}r=r.next}while(r!==t);if(!i)return null;let a=i,c=i.x,l=i.y,f=1/0,u;r=i;do n>=r.x&&r.x>=c&&n!==r.x&&en(s<l?n:o,s,c,l,s<l?o:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),hs(r,e)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&Uw(i,r)))&&(i=r,f=u)),r=r.next;while(r!==a);return i}function Uw(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function Vw(e,t,r,n){let s=e;do s.z===0&&(s.z=Wl(s.x,s.y,t,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,Hw(s)}function Hw(e){let t,r,n=1,s,o,i,a,c,l;do{for(o=e,e=null,l=null,s=0;o;){for(s++,a=o,i=0,r=0;r<n&&(i++,a=a.nextZ,!!a);r++);for(c=n;i>0||c>0&&a;)i!==0&&(c===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,i--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;o=a}l.nextZ=null,n*=2}while(s>1);return e}function Wl(e,t,r,n,s){return e=(e-r)*s|0,t=(t-n)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function zw(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function en(e,t,r,n,s,o,i,a){return(s-i)*(t-a)>=(e-i)*(o-a)&&(e-i)*(n-a)>=(r-i)*(t-a)&&(r-i)*(o-a)>=(s-i)*(n-a)}function qw(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!kw(e,t)&&(hs(e,t)&&hs(t,e)&&Jw(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Ei(e,t)&&nt(e.prev,e,e.next)>0&&nt(t.prev,t,t.next)>0)}function nt(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ei(e,t){return e.x===t.x&&e.y===t.y}function F0(e,t,r,n){let s=Ti(nt(e,t,r)),o=Ti(nt(e,t,n)),i=Ti(nt(r,n,e)),a=Ti(nt(r,n,t));return!!(s!==o&&i!==a||s===0&&yi(e,r,t)||o===0&&yi(e,n,t)||i===0&&yi(r,e,n)||a===0&&yi(r,t,n))}function yi(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Ti(e){return e>0?1:e<0?-1:0}function kw(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&F0(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function hs(e,t){return nt(e.prev,e,e.next)<0?nt(e,t,e.next)>=0&&nt(e,e.prev,t)>=0:nt(e,t,e.prev)<0||nt(e,e.next,t)<0}function Jw(e,t){let r=e,n=!1,s=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&s<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function P0(e,t){let r=new ps(e.i,e.x,e.y),n=new ps(t.i,t.x,t.y),s=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function v0(e,t,r,n){let s=new ps(e,t,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function ds(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var ps=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function Zl(e,t,r){let n=Kw(e),s=Object.keys(n).filter(o=>n[o]!==Array);return Qw(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||s,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Kw(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let s=r.properties[n];t[n]=n3(s,t[n])}return t}function Qw(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:i,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:m=!0}=r,y=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,E={type:"Point",positions:new A(n*d),globalFeatureIds:new _(n),featureIds:s>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},M={type:"LineString",pathIndices:o>65535?new Uint32Array(i+1):new Uint16Array(i+1),positions:new A(o*d),globalFeatureIds:new _(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new A(c*d),globalFeatureIds:new _(c),featureIds:u>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};m&&(B.triangles=[]);for(let L of[E,M,B])for(let b of p){let T=h[b];L.numericProps[b]=new T(L.positions.length/d)}M.pathIndices[i]=o,B.polygonIndices[l]=c,B.primitivePolygonIndices[f]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let L of e){let b=L.geometry,T=L.properties||{};switch(b.type){case"Point":Zw(b,E,C,d,T),E.properties.push(Ql(T,p)),y&&E.fields.push({id:L.id}),C.pointFeature++;break;case"LineString":$w(b,M,C,d,T),M.properties.push(Ql(T,p)),y&&M.fields.push({id:L.id}),C.lineFeature++;break;case"Polygon":t3(b,B,C,d,T),B.properties.push(Ql(T,p)),y&&B.fields.push({id:L.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return r3(E,M,B,d)}function Zw(e,t,r,n,s){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;$l(t,s,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function $w(e,t,r,n,s){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;$l(t,s,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let i=0,a=e.indices.length;i<a;++i){let c=e.indices[i],l=i===a-1?e.data.length:e.indices[i+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/n}}function t3(e,t,r,n,s){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;$l(t,s,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let i=0,a=e.indices.length;i<a;++i){let c=r.polygonPosition;t.polygonIndices[r.polygonObject++]=c;let l=e.areas[i],f=e.indices[i],u=e.indices[i+1];for(let d=0,p=f.length;d<p;++d){let A=f[d],m=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(m-A)/n}let h=r.polygonPosition;e3(t,l,f,{startPosition:c,endPosition:h,coordLength:n})}}function e3(e,t,r,{startPosition:n,endPosition:s,coordLength:o}){if(!e.triangles)return;let i=n*o,a=s*o,c=e.positions.subarray(i,a),l=r[0],f=r.slice(1).map(h=>(h-l)/o),u=Yl(c,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function Kl(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function r3(e,t,r,n){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Kl(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Kl(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Kl(r.numericProps,1)}};return s.polygons&&r.triangles&&(s.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),s}function $l(e,t,r,n){for(let s in e.numericProps)if(s in t){let o=t[s];e.numericProps[s].fill(o,r,r+n)}}function Ql(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function n3(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function bi(e,t){let r=t?.globalFeatureId;return r!==void 0?s3(e,r):o3(e,t?.type)}function s3(e,t){let r=G0(e);for(let n of r){let s=0,o=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let a=n.featureIds.value[i];if(a!==o){if(t===n.globalFeatureIds.value[s])return _i(n,s,i);s=i,o=a}}if(t===n.globalFeatureIds.value[s])return _i(n,s,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function o3(e,t){let r=G0(e,t);return i3(r)}function D0(e,t,r){switch(e.type){case"Point":return f3(e,t,r);case"LineString":return l3(e,t,r);case"Polygon":return U0(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function G0(e,t){let r=[];return e.points&&(e.points.type="Point",r.push(e.points)),e.lines&&(e.lines.type="LineString",r.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",r.push(e.polygons)),r}function i3(e){let t=[];for(let r of e){if(r.featureIds.value.length===0)continue;let n=0,s=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let i=r.featureIds.value[o];i!==s&&(t.push(_i(r,n,o)),n=o,s=i)}t.push(_i(r,n,r.featureIds.value.length))}return t}function _i(e,t,r){let n=D0(e,t,r),s=c3(e,t,r),o=a3(e,t,r);return{type:"Feature",geometry:n,properties:s,...o}}function a3(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function c3(e,t=0,r){let n=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)n[s]=e.numericProps[s].value[t];return n}function U0(e,t=-1/0,r=1/0){let{positions:n}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=r),o=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=r);if(!(s.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],u=o[l+1],h=Mi(n,f,u);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],f=s[c+1],u=U0(e,l,f).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function l3(e,t=-1/0,r=1/0){let{positions:n}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:Mi(n,s[0],s[1])};let i=[];for(let a=0;a<s.length-1;a++){let c=Mi(n,s[a],s[a+1]);i.push(c)}return{type:"MultiLineString",coordinates:i}}function f3(e,t,r){let{positions:n}=e,s=Mi(n,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Mi(e,t,r){t=t||0,r=r||e.value.length/e.size;let n=[];for(let s=t;s<r;s++){let o=Array();for(let i=s*e.size;i<(s+1)*e.size;i++)o.push(Number(e.value[i]));n.push(o)}return n}var of=D(j0(),1);function I3(e){let t=0;for(let r=0,n=e.length-1,s,o;r<e.length;n=r++)s=e[r],o=e[n],t+=(o[0]-s[0])*(s[1]+o[1]);return t}function rf(e,t){if(Array.isArray(e[0])){for(let n of e)rf(n,t);return}let r=e;r[0]/=t,r[1]/=t}function X0(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function nf(e,t,r){if(typeof e[0][0]!="number"){for(let i of e)nf(i,t,r);return}let n=r*Math.pow(2,t.z),s=r*t.x,o=r*t.y;for(let i=0;i<e.length;i++){let a=e[i];a[0]=(a[0]+s)*360/n-180;let c=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(c*Math.PI/180))-90}}function W0(e,t,r){let{x:n,y:s,z:o}=t,i=r*Math.pow(2,o),a=r*n,c=r*s;for(let l=0,f=e.length;l<f;l+=2){e[l]=(e[l]+a)*360/i-180;let u=180-(e[l+1]+c)*360/i;e[l+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Y0(e){let t=e.length;if(t<=1)return[e];let r=[],n,s;for(let o=0;o<t;o++){let i=I3(e[o]);i!==0&&(s===void 0&&(s=i<0),s===i<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function K0(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[gr(e.data)]],indices:[e.indices]};let n=[],s=[],o=[],i=[],a,c=0;for(let l,f=0,u;f<t;f++){u=e.indices[f]-c,l=e.indices[f+1]-c||e.data.length;let h=e.data.slice(u,l),d=gr(h);if(d===0){let p=e.data.slice(0,u),A=e.data.slice(l);e.data=p.concat(A),c+=l-u;continue}a===void 0&&(a=d<0),a===d<0?(i.length&&(n.push(o),s.push(i)),i=[u],o=[d]):(o.push(d),i.push(u))}return o&&n.push(o),i.length&&s.push(i),{type:r,areas:n,indices:s,data:e.data}}var xr=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,s,o,i){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=o,this._geometryInfo=i,t.readFields(w3,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Q0(this,n,s=>nf(s,r,this.extent));default:return Q0(this,n,rf)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,s=>W0(s,r,this.extent));default:return this._toBinaryCoordinates(n,X0)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s=0,o=0,i=0,a=1/0,c=-1/0,l=1/0,f=-1/0;for(;t.pos<r;){if(s<=0){let u=t.readVarint();n=u&7,s=u>>3}if(s--,n===1||n===2)o+=t.readSVarint(),i+=t.readSVarint(),o<a&&(a=o),o>c&&(c=o),i<l&&(l=i),i>f&&(f=i);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,l,c,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/s,n={type:"LineString",...t};break;case 3:n=K0(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let i of n.indices)this._geometryInfo.polygonRingsCount+=i.length;this._geometryInfo.polygonPositionsCount+=n.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s=0,o=0,i=0,a=[],c;for(;t.pos<r;){if(s<=0){let l=t.readVarint();n=l&7,s=l>>3}switch(s--,n){case 1:case 2:o+=t.readSVarint(),i+=t.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([o,i]);break;case 7:c&&c.push(c[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return c&&a.push(c),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,s,o=0,i=0,a=0,c=0,l=[],f=[];for(;t.pos<r;)if(o<=0&&(s=t.readVarint(),n=s&7,o=s>>3),o--,n===1||n===2)i+=t.readSVarint(),a+=t.readSVarint(),n===1&&l.push(c),f.push(i,a),c+=2;else if(n===7){if(c>0){let u=l[l.length-1];f.push(f[u],f[u+1]),c+=2}}else throw new Error(`unknown command ${n}`);return{data:f,indices:l}}};on(xr,"types",["Unknown","Point","LineString","Polygon"]);function Q0(e,t,r){let n=xr.types[e.type],s,o,i;switch(e.type){case 1:let c=[];for(s=0;s<t.length;s++)c[s]=t[s][0];i=c,r(i,e.extent);break;case 2:for(i=t,s=0;s<i.length;s++)r(i[s],e.extent);break;case 3:for(i=Y0(t),s=0;s<i.length;s++)for(o=0;o<i[s].length;o++)r(i[s][o],e.extent);break;default:throw new Error("illegal vector tile type")}i.length===1?i=i[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:i},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function w3(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?L3(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function L3(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[n]=s}}var Si=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(v3,this,r),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new xr(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new xr(this._pbf,n,this.extent,this._keys,this._values,r)}};function v3(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(R3(r)))}function R3(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var ms=class{layers;constructor(t,r){this.layers=t.readFields(F3,{},r)}};function F3(e,t,r){if(e===3&&r){let n=new Si(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function af(e,t){let r=O3(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:sf(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Z0(e,r)};case"geojson":return Z0(e,r);case"binary-geometry":return sf(e,r);case"binary":return sf(e,r);default:throw new Error(n||"undefined shape")}}function sf(e,t){let[r,n]=P3(e,t),s=Zl(r,n);return s.byteLength=e.byteLength,s}function P3(e,t){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[r,n];let s=new ms(new of.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(i=>{let a=s.layers[i];if(a)for(let c=0;c<a.length;c++){let l=a.getBinaryFeature(c,n),f=D3(l,t,i);r.push(f)}}),[r,n]}function Z0(e,t){if(e.byteLength<=0)return[];let r=[],n=new ms(new of.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let i=n.layers[o];if(i)for(let a=0;a<i.length;a++){let c=i.getGeoJSONFeature(a),l=N3(c,t,o);r.push(l)}}),r}function O3(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&qa.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function N3(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function D3(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var G3="4.3.3",Ii={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:G3,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},U3={...Ii,parse:async(e,t)=>af(e,t),parseSync:af,binary:!0};var V3={Point:$0,MultiPoint:H3,LineString:t1,MultiLineString:z3,Polygon:e1,MultiPolygon:q3};function $0([e,t],[r,n],s){let o=Te(r[0],n[0],e),i=Te(r[1],n[1],t);return s.unprojectFlat([o,i])}function cf(e,t,r){return e.map(n=>$0(n,t,r))}function H3(e,t,r){return cf(e,t,r)}function t1(e,t,r){return cf(e,t,r)}function z3(e,t,r){return e.map(n=>t1(n,t,r))}function e1(e,t,r){return e.map(n=>cf(n,t,r))}function q3(e,t,r){return e.map(n=>e1(n,t,r))}function r1(e,t,r){let n=r.projectFlat([t.west,t.north]),s=r.projectFlat([t.east,t.south]),o=[n,s];return{...e,coordinates:V3[e.type](e.coordinates,o,r)}}var k3=["points","lines","polygons"];function lf(e,t,r,n){for(let s of k3){let o=e[s]&&J3(e[s],t,r,n);if(o>=0)return o}return-1}function J3(e,t,r,n){let s=e.featureIds.value;if(!s.length)return-1;let o=0,i=s[s.length-1]+1;if(n){let c=j3(e,n);if(c)o=c[0],i=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,f)=>l===r&&s[f]>=o&&s[f]<i);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=n1(e.properties,c=>c[t]===r,o,i):e.fields&&(a=n1(e.fields,c=>c.id===r,o,i));return a>=0?X3(e,a):-1}function j3(e,t){if(!e.__layers){let r={},{properties:n}=e;for(let s=0;s<n.length;s++){let{layerName:o}=n[s];o&&(r[o]?r[o][1]=s:r[o]=[s,s])}e.__layers=r}return e.__layers[t]}function X3(e,t){if(!e.__ids){let r=[],n=e.featureIds.value,s=e.globalFeatureIds.value;for(let o=0;o<n.length;o++)r[n[o]]=s[o];e.__ids=r}return e.__ids[t]}function n1(e,t,r,n){for(let s=r;s<n;s++)if(t(e[s],s))return s;return-1}var ff=512,W3={...hf.GeoJsonLayer.defaultProps,data:Re,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Ii],binary:!0},gs=class extends nr{initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:r,context:n,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:r,context:n,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:o}=t;o!==r.highlightColor&&Array.isArray(o)&&this.setState({highlightColor:o})}async _updateTileData(){let t=this.props.data,r=null;if(typeof t=="string"&&!Tc(t)){let{onDataLoad:n,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{r=await s(t,{propName:"data",layer:this,loaders:[]})}catch(o){this.raiseError(o,"loading TileJSON"),t=null}n&&n(r,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(r=t);r&&(t=r.tiles),this.setState({data:t,tileJSON:r})}_getTilesetOptions(){let t=super._getTilesetOptions(),r=this.state.tileJSON,{minZoom:n,maxZoom:s}=this.props;return r&&(Number.isFinite(r.minzoom)&&r.minzoom>n&&(t.minZoom=r.minzoom),Number.isFinite(r.maxzoom)&&(!Number.isFinite(s)||r.maxzoom<s)&&(t.maxZoom=r.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:r,binary:n}=this.state,{index:s,signal:o}=t,i=oe(r,t);if(!i)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:n?{format:"binary"}:{}},c(i,{propName:"data",layer:this,loadOptions:a,signal:o})}renderSubLayers(t){let{x:r,y:n,z:s}=t.tile.index,o=Math.pow(2,s),i=ff/o,a=-i,c=ff*r/o,l=ff*(1-n/o),f=new O().scale([i,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=f,t.coordinateOrigin=[c,l,0],t.coordinateSystem=wi.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new a1.ClipExtension]);let u=super.renderSubLayers(t);return this.state.binary&&!(u instanceof hf.GeoJsonLayer)&&wi.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),u}_updateAutoHighlight(t){let{uniqueIdProperty:r}=this.props,{hoveredFeatureId:n,hoveredFeatureLayerName:s}=this.state,o=t.object,i=null,a=null;o&&(i=uf(o,r),a=s1(o));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(n!==i||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:i,hoveredFeatureLayerName:a})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let r=super.getPickingInfo(t);if(this.state.binary&&r.index!==-1){let{data:n}=t.sourceLayer.props;r.object=bi(n,{globalFeatureId:r.index})}return r.object&&!this._isWGS84()&&(r.object=i1(r.object,r.tile.bbox,this.context.viewport)),r}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:r,hoveredFeatureLayerName:n,binary:s}=this.state,{uniqueIdProperty:o,highlightedFeatureId:i}=this.props,a=t.content,c=o1(i);if(!(o1(r)||c))return-1;let f=c?i:r;return Array.isArray(a)?a.findIndex(u=>{let h=uf(u,o)===f,d=c||s1(u)===n;return h&&d}):a&&s?lf(a,o,f,c?"":n):-1}_pickObjects(t){let{deck:r,viewport:n}=this.context,s=n.width,o=n.height,i=n.x,a=n.y,c=[this.id];return r.pickObjects({x:i,y:a,width:s,height:o,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let r=this._pickObjects(t),n=new Set,s=[];for(let o of r){let i=uf(o.object,this.props.uniqueIdProperty);i===void 0?s.push(o.object):n.has(i)||(n.add(i),s.push(o.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(n=>{n.hasOwnProperty(t)||Object.defineProperty(n,t,{get:()=>{if(!n.content)return null;if(this.state.binary&&Array.isArray(n.content)&&!n.content.length)return[];let{bbox:s}=n;if(n._contentWGS84===void 0&&Ec(s)){let o=this.state.binary?bi(n.content):n.content;n._contentWGS84=o.map(i=>i1(i,s,this.context.viewport))}return n._contentWGS84}})})}};gs.layerName="MVTLayer";gs.defaultProps=W3;var c1=gs;function uf(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function s1(e){return e.properties?.layerName||null}function o1(e){return e!=null&&e!==""}function i1(e,t,r){let n={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(n.geometry,"coordinates",{get:()=>r1(e.geometry,t,r).coordinates}),n}var l1="0123456789bcdefghjkmnpqrstuvwxyz",f1={};for(let e=0;e<l1.length;e++)f1[l1.charAt(e)]=e;var Y3=-90,K3=90,Q3=-180,Z3=180;function $3(e){let t=!0,r=K3,n=Y3,s=Z3,o=Q3,i,a=0;for(let c=0,l=e.length;c<l;c++){let f=e[c].toLowerCase();a=f1[f];for(let u=4;u>=0;u--){let h=a>>u&1;t?(i=(s+o)/2,h===1?o=i:s=i):(i=(r+n)/2,h===1?n=i:r=i),t=!t}}return[n,o,r,s]}function u1(e){let[t,r,n,s]=$3(e);return[s,n,s,t,r,t,r,n,s,n]}var tL={getGeohash:{type:"accessor",value:e=>e.geohash}},As=class extends Ft{indexToBounds(){let{data:t,getGeohash:r}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(n,s)=>u1(r(n,s))}}};As.layerName="GeohashLayer";As.defaultProps=tL;var h1=As;return y1(xs);})();
|
|
1099
1099
|
/*! Bundled license information:
|
|
1100
1100
|
|
|
1101
1101
|
long/dist/long.js:
|