@deck.gl/geo-layers 9.2.0-alpha.1 → 9.2.0-alpha.3

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.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 dT=Object.create;var Cs=Object.defineProperty;var mT=Object.getOwnPropertyDescriptor;var gT=Object.getOwnPropertyNames;var xT=Object.getPrototypeOf,MT=Object.prototype.hasOwnProperty;var AT=(e,t,n)=>t in e?Cs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var U1=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var ot=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Et=(e,t)=>{for(var n in t)Cs(e,n,{get:t[n],enumerable:!0})},Ji=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of gT(t))!MT.call(e,s)&&s!==n&&Cs(e,s,{get:()=>t[s],enumerable:!(r=mT(t,s))||r.enumerable});return e},tn=(e,t,n)=>(Ji(e,t,"default"),n&&Ji(n,t,"default")),U=(e,t,n)=>(n=e!=null?dT(xT(e)):{},Ji(t||!e||!e.__esModule?Cs(n,"default",{value:e,enumerable:!0}):n,e)),yT=e=>Ji(Cs({},"__esModule",{value:!0}),e);var xr=(e,t,n)=>(AT(e,typeof t!="symbol"?t+"":t,n),n);var he=ot((D6,G1)=>{G1.exports=globalThis.deck});var le=ot((G6,q1)=>{q1.exports=globalThis.deck});var so=ot((K6,Yp)=>{Yp.exports=globalThis.h3||{}});var Ao=ot(De=>{"use strict";var Wu=":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",gL=Wu+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ju="["+Wu+"]["+gL+"]*",xL=new RegExp("^"+Ju+"$"),ML=function(e,t){let n=[],r=t.exec(e);for(;r;){let s=[];s.startIndex=t.lastIndex-r[0].length;let i=r.length;for(let o=0;o<i;o++)s.push(r[o]);n.push(s),r=t.exec(e)}return n},AL=function(e){let t=xL.exec(e);return!(t===null||typeof t>"u")};De.isExist=function(e){return typeof e<"u"};De.isEmptyObject=function(e){return Object.keys(e).length===0};De.merge=function(e,t,n){if(t){let r=Object.keys(t),s=r.length;for(let i=0;i<s;i++)n==="strict"?e[r[i]]=[t[r[i]]]:e[r[i]]=t[r[i]]}};De.getValue=function(e){return De.isExist(e)?e:""};De.isName=AL;De.getAllMatches=ML;De.nameRegexp=Ju});var Fh=ot(Zu=>{"use strict";var vh=Ao(),yL={allowBooleanAttributes:!1,unpairedTags:[]};Zu.validate=function(e,t){t=Object.assign({},yL,t);let n=[],r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=Xu(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=Ku(e,i);continue}else{let c=!1;e[i]==="/"&&(c=!0,i++);let a="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
8
- `&&e[i]!=="\r";i++)a+=e[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!wL(a)){let f;return a.trim().length===0?f="Invalid space after '<'.":f="Tag '"+a+"' is an invalid name.",dt("InvalidTag",f,Gt(e,i))}let h=_L(e,i);if(h===!1)return dt("InvalidAttr","Attributes for '"+a+"' have open quote.",Gt(e,i));let l=h.value;if(i=h.index,l[l.length-1]==="/"){let f=i-l.length;l=l.substring(0,l.length-1);let p=Qu(l,t);if(p===!0)r=!0;else return dt(p.err.code,p.err.msg,Gt(e,f+p.err.line))}else if(c)if(h.tagClosed){if(l.trim().length>0)return dt("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",Gt(e,o));if(n.length===0)return dt("InvalidTag","Closing tag '"+a+"' has not been opened.",Gt(e,o));{let f=n.pop();if(a!==f.tagName){let p=Gt(e,f.tagStartPos);return dt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+a+"'.",Gt(e,o))}n.length==0&&(s=!0)}}else return dt("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",Gt(e,i));else{let f=Qu(l,t);if(f!==!0)return dt(f.err.code,f.err.msg,Gt(e,i-l.length+f.err.line));if(s===!0)return dt("InvalidXml","Multiple possible root nodes found.",Gt(e,i));t.unpairedTags.indexOf(a)!==-1||n.push({tagName:a,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Ku(e,i);continue}else if(e[i+1]==="?"){if(i=Xu(e,++i),i.err)return i}else break;else if(e[i]==="&"){let f=CL(e,i);if(f==-1)return dt("InvalidChar","char '&' is not expected.",Gt(e,i));i=f}else if(s===!0&&!ju(e[i]))return dt("InvalidXml","Extra text at the end",Gt(e,i));e[i]==="<"&&i--}}else{if(ju(e[i]))continue;return dt("InvalidChar","char '"+e[i]+"' is not expected.",Gt(e,i))}if(r){if(n.length==1)return dt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Gt(e,n[0].tagStartPos));if(n.length>0)return dt("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return dt("InvalidXml","Start tag expected.",1);return!0};function ju(e){return e===" "||e===" "||e===`
9
- `||e==="\r"}function Xu(e,t){let n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let r=e.substr(n,t-n);if(t>5&&r==="xml")return dt("InvalidXml","XML declaration allowed only at the start of the document.",Gt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Ku(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 n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===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 EL='"',TL="'";function _L(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===EL||e[t]===TL)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}var SL=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Qu(e,t){let n=vh.getAllMatches(e,SL),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return dt("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Ds(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return dt("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Ds(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return dt("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Ds(n[s]));let i=n[s][2];if(!LL(i))return dt("InvalidAttr","Attribute '"+i+"' is an invalid name.",Ds(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return dt("InvalidAttr","Attribute '"+i+"' is repeated.",Ds(n[s]))}return!0}function BL(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function CL(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,BL(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function dt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function LL(e){return vh.isName(e)}function wL(e){return vh.isName(e)}function Gt(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Ds(e){return e.startIndex+e[1].length}});var td=ot(Dh=>{var $u={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,n){return e}},RL=function(e){return Object.assign({},$u,e)};Dh.buildOptions=RL;Dh.defaultOptions=$u});var nd=ot((UG,ed)=>{"use strict";var Uh=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}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})}};ed.exports=Uh});var sd=ot((GG,rd)=>{var IL=Ao();function bL(e,t){let n={};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 r=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&NL(e,t))t+=7,[entityName,val,t]=OL(e,t+1),val.indexOf("&")===-1&&(n[UL(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&vL(e,t))t+=8;else if(s&&FL(e,t))t+=8;else if(s&&DL(e,t))t+=9;else if(PL)i=!0;else throw new Error("Invalid DOCTYPE");r++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,r--):r--,r===0)break}else e[t]==="["?s=!0:o+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function OL(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");let r=e[t++],s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function PL(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function NL(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 vL(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 FL(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 DL(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 UL(e){if(IL.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}rd.exports=bL});var od=ot((zG,id)=>{var zL=/^[-+]?0x[a-fA-F0-9]+$/,qL=/^([\-\+])?(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 VL={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function kL(e,t={}){if(t=Object.assign({},VL,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(t.hex&&zL.test(n))return Number.parseInt(n,16);{let r=qL.exec(n);if(r){let s=r[1],i=r[2],o=HL(r[3]),c=r[4]||r[6];if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;{let a=Number(n),h=""+a;return h.search(/[eE]/)!==-1||c?t.eNotation?a:e:n.indexOf(".")!==-1?h==="0"&&o===""||h===o||s&&h==="-"+o?a:e:i?o===h||s+o===h?a:e:n===h||n===s+h?a:e}}else return e}}function HL(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}id.exports=kL});var hd=ot((qG,ad)=>{"use strict";var cd=Ao(),Us=nd(),YL=sd(),WL=od(),Gh=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:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=JL,this.parseXml=ZL,this.parseTextData=jL,this.resolveNameSpace=XL,this.buildAttributesMap=QL,this.isItStopNode=nw,this.replaceEntitiesValue=tw,this.readStopNodeData=sw,this.saveTextToParentTag=ew,this.addChild=$L}};function JL(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function jL(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let c=this.options.tagValueProcessor(t,e,n,s,i);return c==null?e:typeof c!=typeof e||c!==e?c:this.options.trimValues?qh(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?qh(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function XL(e){if(this.options.removeNSPrefix){let t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}var KL=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function QL(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){let r=cd.getAllMatches(e,KL),s=r.length,i={};for(let o=0;o<s;o++){let c=this.resolveNameSpace(r[o][1]),a=r[o][4],h=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(h=this.options.transformAttributeName(h)),h==="__proto__"&&(h="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);let l=this.options.attributeValueProcessor(c,a,t);l==null?i[h]=a:typeof l!=typeof a||l!==a?i[h]=l:i[h]=qh(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[h]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var ZL=function(e){e=e.replace(/\r\n?/g,`
10
- `);let t=new Us("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let c=Un(e,">",i,"Closing Tag is not closed."),a=e.substring(i+2,c).trim();if(this.options.removeNSPrefix){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&(r=this.saveTextToParentTag(r,n,s));let h=s.substring(s.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let l=0;h&&this.options.unpairedTags.indexOf(h)!==-1?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),n=this.tagsNodeStack.pop(),r="",i=c}else if(e[i+1]==="?"){let c=zh(e,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let a=new Us(c.tagName);a.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(a[":@"]=this.buildAttributesMap(c.tagExp,s,c.tagName)),this.addChild(n,a,s)}i=c.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let c=Un(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let a=e.substring(i+4,c-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=c}else if(e.substr(i+1,2)==="!D"){let c=YL(e,i);this.docTypeEntities=c.entities,i=c.i}else if(e.substr(i+1,2)==="!["){let c=Un(e,"]]>",i,"CDATA is not closed.")-2,a=e.substring(i+9,c);r=this.saveTextToParentTag(r,n,s);let h=this.parseTextData(a,n.tagname,s,!0,!1,!0,!0);h==null&&(h=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):n.add(this.options.textNodeName,h),i=c+2}else{let c=zh(e,i,this.options.removeNSPrefix),a=c.tagName,h=c.rawTagName,l=c.tagExp,f=c.attrExpPresent,p=c.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let u=n;if(u&&this.options.unpairedTags.indexOf(u.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==t.tagname&&(s+=s?"."+a:a),this.isItStopNode(this.options.stopNodes,s,a)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=c.closeIndex;else{let m=this.readStopNodeData(e,h,p+1);if(!m)throw new Error(`Unexpected end of ${h}`);i=m.i,d=m.tagContent}let g=new Us(a);a!==l&&f&&(g[":@"]=this.buildAttributesMap(l,s,a)),d&&(d=this.parseTextData(d,a,s,!0,f,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),g.add(this.options.textNodeName,d),this.addChild(n,g,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));let d=new Us(a);a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new Us(a);this.tagsNodeStack.push(n),a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),n=d}r="",i=p}}else r+=e[i];return t.child};function $L(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var tw=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){let n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function ew(e,t,n,r){return e&&(r===void 0&&(r=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function nw(e,t,n){let r="*."+n;for(let s in e){let i=e[s];if(r===i||t===i)return!0}return!1}function rw(e,t,n=">"){let r,s="";for(let i=t;i<e.length;i++){let o=e[i];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function Un(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function zh(e,t,n,r=">"){let s=rw(e,t+1,r);if(!s)return;let i=s.data,o=s.index,c=i.search(/\s/),a=i,h=!0;c!==-1&&(a=i.substring(0,c),i=i.substring(c+1).trimStart());let l=a;if(n){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1),h=a!==s.data.substr(f+1))}return{tagName:a,tagExp:i,closeIndex:o,attrExpPresent:h,rawTagName:l}}function sw(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Un(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Un(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Un(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Un(e,"]]>",n,"StopNode is not closed.")-2;else{let i=zh(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function qh(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:WL(e,n)}else return cd.isExist(e)?e:""}ad.exports=Gh});var pd=ot(fd=>{"use strict";function iw(e,t){return ld(e,t)}function ld(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],c=ow(o),a="";if(n===void 0?a=c:a=n+"."+c,c===t.textNodeName)r===void 0?r=o[c]:r+=""+o[c];else{if(c===void 0)continue;if(o[c]){let h=ld(o[c],t,a),l=aw(h,t);o[":@"]?cw(h,o[":@"],a,t):Object.keys(h).length===1&&h[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?h=h[t.textNodeName]:Object.keys(h).length===0&&(t.alwaysCreateTextNode?h[t.textNodeName]="":h=""),s[c]!==void 0&&s.hasOwnProperty(c)?(Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(h)):t.isArray(c,a,l)?s[c]=[h]:s[c]=h}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function ow(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function cw(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let c=s[o];r.isArray(c,n+"."+c,!0,!0)?e[c]=[t[c]]:e[c]=t[c]}}}function aw(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}fd.prettify=iw});var dd=ot((kG,ud)=>{var{buildOptions:hw}=td(),lw=hd(),{prettify:fw}=pd(),pw=Fh(),Vh=class{constructor(t){this.externalEntities={},this.options=hw(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});let i=pw.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new lw(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:fw(s,this.options)}addEntity(t,n){if(n.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 '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};ud.exports=Vh});var Ad=ot((HG,Md)=>{var uw=`
11
- `;function dw(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=uw),gd(e,t,"",n)}function gd(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let c=e[o],a=mw(c);if(a===void 0)continue;let h="";if(n.length===0?h=a:h=`${n}.${a}`,a===t.textNodeName){let d=c[a];gw(h,t)||(d=t.tagValueProcessor(a,d),d=xd(d,t)),i&&(s+=r),s+=d,i=!1;continue}else if(a===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${c[a][0][t.textNodeName]}]]>`,i=!1;continue}else if(a===t.commentPropName){s+=r+`<!--${c[a][0][t.textNodeName]}-->`,i=!0;continue}else if(a[0]==="?"){let d=md(c[":@"],t),g=a==="?xml"?"":r,m=c[a][0][t.textNodeName];m=m.length!==0?" "+m:"",s+=g+`<${a}${m}${d}?>`,i=!0;continue}let l=r;l!==""&&(l+=t.indentBy);let f=md(c[":@"],t),p=r+`<${a}${f}`,u=gd(c[a],t,h,l);t.unpairedTags.indexOf(a)!==-1?t.suppressUnpairedNode?s+=p+">":s+=p+"/>":(!u||u.length===0)&&t.suppressEmptyNode?s+=p+"/>":u&&u.endsWith(">")?s+=p+`>${u}${r}</${a}>`:(s+=p+">",u&&r!==""&&(u.includes("/>")||u.includes("</"))?s+=r+t.indentBy+u+r:s+=u,s+=`</${a}>`),i=!0}return s}function mw(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function md(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let s=t.attributeValueProcessor(r,e[r]);s=xd(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function gw(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function xd(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}Md.exports=dw});var Ed=ot((YG,yd)=>{"use strict";var xw=Ad(),Mw={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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function cn(e){this.options=Object.assign({},Mw,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ew),this.processTextOrObjNode=Aw,this.options.format?(this.indentate=yw,this.tagEndChar=`>
7
+ "use strict";var __exports__=(()=>{var wT=Object.create;var Rs=Object.defineProperty;var IT=Object.getOwnPropertyDescriptor;var PT=Object.getOwnPropertyNames;var OT=Object.getPrototypeOf,vT=Object.prototype.hasOwnProperty;var NT=(e,t,n)=>t in e?Rs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j1=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var ct=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Tt=(e,t)=>{for(var n in t)Rs(e,n,{get:t[n],enumerable:!0})},Ki=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of PT(t))!vT.call(e,s)&&s!==n&&Rs(e,s,{get:()=>t[s],enumerable:!(r=IT(t,s))||r.enumerable});return e},tn=(e,t,n)=>(Ki(e,t,"default"),n&&Ki(n,t,"default")),G=(e,t,n)=>(n=e!=null?wT(OT(e)):{},Ki(t||!e||!e.__esModule?Rs(n,"default",{value:e,enumerable:!0}):n,e)),FT=e=>Ki(Rs({},"__esModule",{value:!0}),e);var gr=(e,t,n)=>(NT(e,typeof t!="symbol"?t+"":t,n),n);var he=ct((iU,X1)=>{X1.exports=globalThis.deck});var le=ct((cU,Q1)=>{Q1.exports=globalThis.deck});var lo=ct((BU,iu)=>{iu.exports=globalThis.h3||{}});var Co=ct(De=>{"use strict";var od=":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",vL=od+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",cd="["+od+"]["+vL+"]*",NL=new RegExp("^"+cd+"$"),FL=function(e,t){let n=[],r=t.exec(e);for(;r;){let s=[];s.startIndex=t.lastIndex-r[0].length;let i=r.length;for(let o=0;o<i;o++)s.push(r[o]);n.push(s),r=t.exec(e)}return n},DL=function(e){let t=NL.exec(e);return!(t===null||typeof t>"u")};De.isExist=function(e){return typeof e<"u"};De.isEmptyObject=function(e){return Object.keys(e).length===0};De.merge=function(e,t,n){if(t){let r=Object.keys(t),s=r.length;for(let i=0;i<s;i++)n==="strict"?e[r[i]]=[t[r[i]]]:e[r[i]]=t[r[i]]}};De.getValue=function(e){return De.isExist(e)?e:""};De.isName=DL;De.getAllMatches=FL;De.nameRegexp=cd});var Wh=ct(pd=>{"use strict";var Yh=Co(),UL={allowBooleanAttributes:!1,unpairedTags:[]};pd.validate=function(e,t){t=Object.assign({},UL,t);let n=[],r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=hd(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=ld(e,i);continue}else{let c=!1;e[i]==="/"&&(c=!0,i++);let a="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
8
+ `&&e[i]!=="\r";i++)a+=e[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!JL(a)){let f;return a.trim().length===0?f="Invalid space after '<'.":f="Tag '"+a+"' is an invalid name.",mt("InvalidTag",f,Vt(e,i))}let h=qL(e,i);if(h===!1)return mt("InvalidAttr","Attributes for '"+a+"' have open quote.",Vt(e,i));let l=h.value;if(i=h.index,l[l.length-1]==="/"){let f=i-l.length;l=l.substring(0,l.length-1);let p=fd(l,t);if(p===!0)r=!0;else return mt(p.err.code,p.err.msg,Vt(e,f+p.err.line))}else if(c)if(h.tagClosed){if(l.trim().length>0)return mt("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",Vt(e,o));if(n.length===0)return mt("InvalidTag","Closing tag '"+a+"' has not been opened.",Vt(e,o));{let f=n.pop();if(a!==f.tagName){let p=Vt(e,f.tagStartPos);return mt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+a+"'.",Vt(e,o))}n.length==0&&(s=!0)}}else return mt("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",Vt(e,i));else{let f=fd(l,t);if(f!==!0)return mt(f.err.code,f.err.msg,Vt(e,i-l.length+f.err.line));if(s===!0)return mt("InvalidXml","Multiple possible root nodes found.",Vt(e,i));t.unpairedTags.indexOf(a)!==-1||n.push({tagName:a,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=ld(e,i);continue}else if(e[i+1]==="?"){if(i=hd(e,++i),i.err)return i}else break;else if(e[i]==="&"){let f=YL(e,i);if(f==-1)return mt("InvalidChar","char '&' is not expected.",Vt(e,i));i=f}else if(s===!0&&!ad(e[i]))return mt("InvalidXml","Extra text at the end",Vt(e,i));e[i]==="<"&&i--}}else{if(ad(e[i]))continue;return mt("InvalidChar","char '"+e[i]+"' is not expected.",Vt(e,i))}if(r){if(n.length==1)return mt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Vt(e,n[0].tagStartPos));if(n.length>0)return mt("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return mt("InvalidXml","Start tag expected.",1);return!0};function ad(e){return e===" "||e===" "||e===`
9
+ `||e==="\r"}function hd(e,t){let n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let r=e.substr(n,t-n);if(t>5&&r==="xml")return mt("InvalidXml","XML declaration allowed only at the start of the document.",Vt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function ld(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 n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===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 zL='"',VL="'";function qL(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===zL||e[t]===VL)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}var kL=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function fd(e,t){let n=Yh.getAllMatches(e,kL),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return mt("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",zs(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return mt("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",zs(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return mt("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",zs(n[s]));let i=n[s][2];if(!WL(i))return mt("InvalidAttr","Attribute '"+i+"' is an invalid name.",zs(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return mt("InvalidAttr","Attribute '"+i+"' is repeated.",zs(n[s]))}return!0}function HL(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function YL(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,HL(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function mt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function WL(e){return Yh.isName(e)}function JL(e){return Yh.isName(e)}function Vt(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function zs(e){return e.startIndex+e[1].length}});var dd=ct(Jh=>{var ud={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,n){return e}},jL=function(e){return Object.assign({},ud,e)};Jh.buildOptions=jL;Jh.defaultOptions=ud});var gd=ct((d9,md)=>{"use strict";var jh=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}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})}};md.exports=jh});var Md=ct((m9,xd)=>{var XL=Co();function KL(e,t){let n={};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 r=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&$L(e,t))t+=7,[entityName,val,t]=QL(e,t+1),val.indexOf("&")===-1&&(n[rR(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&tR(e,t))t+=8;else if(s&&eR(e,t))t+=8;else if(s&&nR(e,t))t+=9;else if(ZL)i=!0;else throw new Error("Invalid DOCTYPE");r++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,r--):r--,r===0)break}else e[t]==="["?s=!0:o+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function QL(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");let r=e[t++],s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function ZL(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function $L(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 tR(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 eR(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 nR(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 rR(e){if(XL.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}xd.exports=KL});var yd=ct((g9,Ad)=>{var sR=/^[-+]?0x[a-fA-F0-9]+$/,iR=/^([\-\+])?(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 oR={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function cR(e,t={}){if(t=Object.assign({},oR,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(t.hex&&sR.test(n))return Number.parseInt(n,16);{let r=iR.exec(n);if(r){let s=r[1],i=r[2],o=aR(r[3]),c=r[4]||r[6];if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;{let a=Number(n),h=""+a;return h.search(/[eE]/)!==-1||c?t.eNotation?a:e:n.indexOf(".")!==-1?h==="0"&&o===""||h===o||s&&h==="-"+o?a:e:i?o===h||s+o===h?a:e:n===h||n===s+h?a:e}}else return e}}function aR(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}Ad.exports=cR});var _d=ct((x9,Td)=>{"use strict";var Ed=Co(),Vs=gd(),hR=Md(),lR=yd(),Xh=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:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=fR,this.parseXml=gR,this.parseTextData=pR,this.resolveNameSpace=uR,this.buildAttributesMap=mR,this.isItStopNode=yR,this.replaceEntitiesValue=MR,this.readStopNodeData=TR,this.saveTextToParentTag=AR,this.addChild=xR}};function fR(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function pR(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let c=this.options.tagValueProcessor(t,e,n,s,i);return c==null?e:typeof c!=typeof e||c!==e?c:this.options.trimValues?Qh(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Qh(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function uR(e){if(this.options.removeNSPrefix){let t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}var dR=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function mR(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){let r=Ed.getAllMatches(e,dR),s=r.length,i={};for(let o=0;o<s;o++){let c=this.resolveNameSpace(r[o][1]),a=r[o][4],h=this.options.attributeNamePrefix+c;if(c.length)if(this.options.transformAttributeName&&(h=this.options.transformAttributeName(h)),h==="__proto__"&&(h="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);let l=this.options.attributeValueProcessor(c,a,t);l==null?i[h]=a:typeof l!=typeof a||l!==a?i[h]=l:i[h]=Qh(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[h]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var gR=function(e){e=e.replace(/\r\n?/g,`
10
+ `);let t=new Vs("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let c=Dn(e,">",i,"Closing Tag is not closed."),a=e.substring(i+2,c).trim();if(this.options.removeNSPrefix){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&(r=this.saveTextToParentTag(r,n,s));let h=s.substring(s.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let l=0;h&&this.options.unpairedTags.indexOf(h)!==-1?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),n=this.tagsNodeStack.pop(),r="",i=c}else if(e[i+1]==="?"){let c=Kh(e,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let a=new Vs(c.tagName);a.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(a[":@"]=this.buildAttributesMap(c.tagExp,s,c.tagName)),this.addChild(n,a,s)}i=c.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let c=Dn(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let a=e.substring(i+4,c-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=c}else if(e.substr(i+1,2)==="!D"){let c=hR(e,i);this.docTypeEntities=c.entities,i=c.i}else if(e.substr(i+1,2)==="!["){let c=Dn(e,"]]>",i,"CDATA is not closed.")-2,a=e.substring(i+9,c);r=this.saveTextToParentTag(r,n,s);let h=this.parseTextData(a,n.tagname,s,!0,!1,!0,!0);h==null&&(h=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):n.add(this.options.textNodeName,h),i=c+2}else{let c=Kh(e,i,this.options.removeNSPrefix),a=c.tagName,h=c.rawTagName,l=c.tagExp,f=c.attrExpPresent,p=c.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let u=n;if(u&&this.options.unpairedTags.indexOf(u.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),a!==t.tagname&&(s+=s?"."+a:a),this.isItStopNode(this.options.stopNodes,s,a)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=c.closeIndex;else{let m=this.readStopNodeData(e,h,p+1);if(!m)throw new Error(`Unexpected end of ${h}`);i=m.i,d=m.tagContent}let g=new Vs(a);a!==l&&f&&(g[":@"]=this.buildAttributesMap(l,s,a)),d&&(d=this.parseTextData(d,a,s,!0,f,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),g.add(this.options.textNodeName,d),this.addChild(n,g,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),s=s.substr(0,s.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));let d=new Vs(a);a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new Vs(a);this.tagsNodeStack.push(n),a!==l&&f&&(d[":@"]=this.buildAttributesMap(l,s,a)),this.addChild(n,d,s),n=d}r="",i=p}}else r+=e[i];return t.child};function xR(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var MR=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){let n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function AR(e,t,n,r){return e&&(r===void 0&&(r=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function yR(e,t,n){let r="*."+n;for(let s in e){let i=e[s];if(r===i||t===i)return!0}return!1}function ER(e,t,n=">"){let r,s="";for(let i=t;i<e.length;i++){let o=e[i];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function Dn(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function Kh(e,t,n,r=">"){let s=ER(e,t+1,r);if(!s)return;let i=s.data,o=s.index,c=i.search(/\s/),a=i,h=!0;c!==-1&&(a=i.substring(0,c),i=i.substring(c+1).trimStart());let l=a;if(n){let f=a.indexOf(":");f!==-1&&(a=a.substr(f+1),h=a!==s.data.substr(f+1))}return{tagName:a,tagExp:i,closeIndex:o,attrExpPresent:h,rawTagName:l}}function TR(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Dn(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Dn(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Dn(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Dn(e,"]]>",n,"StopNode is not closed.")-2;else{let i=Kh(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function Qh(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:lR(e,n)}else return Ed.isExist(e)?e:""}Td.exports=Xh});var Bd=ct(Cd=>{"use strict";function _R(e,t){return Sd(e,t)}function Sd(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],c=SR(o),a="";if(n===void 0?a=c:a=n+"."+c,c===t.textNodeName)r===void 0?r=o[c]:r+=""+o[c];else{if(c===void 0)continue;if(o[c]){let h=Sd(o[c],t,a),l=BR(h,t);o[":@"]?CR(h,o[":@"],a,t):Object.keys(h).length===1&&h[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?h=h[t.textNodeName]:Object.keys(h).length===0&&(t.alwaysCreateTextNode?h[t.textNodeName]="":h=""),s[c]!==void 0&&s.hasOwnProperty(c)?(Array.isArray(s[c])||(s[c]=[s[c]]),s[c].push(h)):t.isArray(c,a,l)?s[c]=[h]:s[c]=h}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function SR(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function CR(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let c=s[o];r.isArray(c,n+"."+c,!0,!0)?e[c]=[t[c]]:e[c]=t[c]}}}function BR(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}Cd.prettify=_R});var Rd=ct((A9,Ld)=>{var{buildOptions:LR}=dd(),RR=_d(),{prettify:bR}=Bd(),wR=Wh(),Zh=class{constructor(t){this.externalEntities={},this.options=LR(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});let i=wR.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new RR(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:bR(s,this.options)}addEntity(t,n){if(n.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 '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};Ld.exports=Zh});var Od=ct((y9,Pd)=>{var IR=`
11
+ `;function PR(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=IR),wd(e,t,"",n)}function wd(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let c=e[o],a=OR(c);if(a===void 0)continue;let h="";if(n.length===0?h=a:h=`${n}.${a}`,a===t.textNodeName){let d=c[a];vR(h,t)||(d=t.tagValueProcessor(a,d),d=Id(d,t)),i&&(s+=r),s+=d,i=!1;continue}else if(a===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${c[a][0][t.textNodeName]}]]>`,i=!1;continue}else if(a===t.commentPropName){s+=r+`<!--${c[a][0][t.textNodeName]}-->`,i=!0;continue}else if(a[0]==="?"){let d=bd(c[":@"],t),g=a==="?xml"?"":r,m=c[a][0][t.textNodeName];m=m.length!==0?" "+m:"",s+=g+`<${a}${m}${d}?>`,i=!0;continue}let l=r;l!==""&&(l+=t.indentBy);let f=bd(c[":@"],t),p=r+`<${a}${f}`,u=wd(c[a],t,h,l);t.unpairedTags.indexOf(a)!==-1?t.suppressUnpairedNode?s+=p+">":s+=p+"/>":(!u||u.length===0)&&t.suppressEmptyNode?s+=p+"/>":u&&u.endsWith(">")?s+=p+`>${u}${r}</${a}>`:(s+=p+">",u&&r!==""&&(u.includes("/>")||u.includes("</"))?s+=r+t.indentBy+u+r:s+=u,s+=`</${a}>`),i=!0}return s}function OR(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function bd(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let s=t.attributeValueProcessor(r,e[r]);s=Id(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function vR(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Id(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}Pd.exports=PR});var Nd=ct((E9,vd)=>{"use strict";var NR=Od(),FR={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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function sn(e){this.options=Object.assign({},FR,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=GR),this.processTextOrObjNode=DR,this.options.format?(this.indentate=UR,this.tagEndChar=`>
12
12
  `,this.newLine=`
13
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}cn.prototype.build=function(e){return this.options.preserveOrder?xw(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};cn.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="",c="";for(let a=0;a<i;a++){let h=e[s][a];if(!(typeof h>"u"))if(h===null)s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){let l=this.j2x(h,t+1);o+=l.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=l.attrStr)}else o+=this.processTextOrObjNode(h,s,t);else if(this.options.oneListGroup){let l=this.options.tagValueProcessor(s,h);l=this.replaceEntitiesValue(l),o+=l}else o+=this.buildTextValNode(h,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,c,t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let c=0;c<o;c++)n+=this.buildAttrPairStr(i[c],""+e[s][i[c]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};cn.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 Aw(e,t,n){let r=this.j2x(e,n+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}cn.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",s=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+s}};cn.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};cn.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}};cn.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function yw(e){return this.options.indentBy.repeat(e)}function Ew(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}yd.exports=cn});var _d=ot((WG,Td)=>{"use strict";var Tw=Fh(),_w=dd(),Sw=Ed();Td.exports={XMLParser:_w,XMLValidator:Tw,XMLBuilder:Sw}});var ul=ot((xm,Zs)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof U1=="function"&&typeof Zs=="object"&&Zs&&Zs.exports?Zs.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(xm,function(){"use strict";function e(S,x,w){this.low=S|0,this.high=x|0,this.unsigned=!!w}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(S){return(S&&S.__isLong__)===!0}e.isLong=t;var n={},r={};function s(S,x){var w,R,I;return x?(S>>>=0,(I=0<=S&&S<256)&&(R=r[S],R)?R:(w=o(S,(S|0)<0?-1:0,!0),I&&(r[S]=w),w)):(S|=0,(I=-128<=S&&S<128)&&(R=n[S],R)?R:(w=o(S,S<0?-1:0,!1),I&&(n[S]=w),w))}e.fromInt=s;function i(S,x){if(isNaN(S)||!isFinite(S))return x?M:m;if(x){if(S<0)return M;if(S>=u)return _}else{if(S<=-d)return L;if(S+1>=d)return T}return S<0?i(-S,x).neg():o(S%p|0,S/p|0,x)}e.fromNumber=i;function o(S,x,w){return new e(S,x,w)}e.fromBits=o;var c=Math.pow;function a(S,x,w){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m;if(typeof x=="number"?(w=x,x=!1):x=!!x,w=w||10,w<2||36<w)throw RangeError("radix");var R;if((R=S.indexOf("-"))>0)throw Error("interior hyphen");if(R===0)return a(S.substring(1),x,w).neg();for(var I=i(c(w,8)),C=m,P=0;P<S.length;P+=8){var k=Math.min(8,S.length-P),z=parseInt(S.substring(P,P+k),w);if(k<8){var $=i(c(w,k));C=C.mul($).add(i(z))}else C=C.mul(I),C=C.add(i(z))}return C.unsigned=x,C}e.fromString=a;function h(S){return S instanceof e?S:typeof S=="number"?i(S):typeof S=="string"?a(S):o(S.low,S.high,S.unsigned)}e.fromValue=h;var l=1<<16,f=1<<24,p=l*l,u=p*p,d=u/2,g=s(f),m=s(0);e.ZERO=m;var M=s(0,!0);e.UZERO=M;var E=s(1);e.ONE=E;var A=s(1,!0);e.UONE=A;var y=s(-1);e.NEG_ONE=y;var T=o(-1,2147483647,!1);e.MAX_VALUE=T;var _=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var L=o(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)*p+(this.low>>>0):this.high*p+(this.low>>>0)},B.toString=function(x){if(x=x||10,x<2||36<x)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var w=i(x),R=this.div(w),I=R.mul(w).sub(this);return R.toString(x)+I.toInt().toString(x)}else return"-"+this.neg().toString(x);for(var C=i(c(x,6),this.unsigned),P=this,k="";;){var z=P.div(C),$=P.sub(z.mul(C)).toInt()>>>0,H=$.toString(x);if(P=z,P.isZero())return H+k;for(;H.length<6;)H="0"+H;k=""+H+k}},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 x=this.high!=0?this.high:this.low,w=31;w>0&&!(x&1<<w);w--);return this.high!=0?w+33:w+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(x){return t(x)||(x=h(x)),this.unsigned!==x.unsigned&&this.high>>>31===1&&x.high>>>31===1?!1:this.high===x.high&&this.low===x.low},B.eq=B.equals,B.notEquals=function(x){return!this.eq(x)},B.neq=B.notEquals,B.lessThan=function(x){return this.comp(x)<0},B.lt=B.lessThan,B.lessThanOrEqual=function(x){return this.comp(x)<=0},B.lte=B.lessThanOrEqual,B.greaterThan=function(x){return this.comp(x)>0},B.gt=B.greaterThan,B.greaterThanOrEqual=function(x){return this.comp(x)>=0},B.gte=B.greaterThanOrEqual,B.compare=function(x){if(t(x)||(x=h(x)),this.eq(x))return 0;var w=this.isNegative(),R=x.isNegative();return w&&!R?-1:!w&&R?1:this.unsigned?x.high>>>0>this.high>>>0||x.high===this.high&&x.low>>>0>this.low>>>0?-1:1:this.sub(x).isNegative()?-1:1},B.comp=B.compare,B.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(E)},B.neg=B.negate,B.add=function(x){t(x)||(x=h(x));var w=this.high>>>16,R=this.high&65535,I=this.low>>>16,C=this.low&65535,P=x.high>>>16,k=x.high&65535,z=x.low>>>16,$=x.low&65535,H=0,tt=0,it=0,qt=0;return qt+=C+$,it+=qt>>>16,qt&=65535,it+=I+z,tt+=it>>>16,it&=65535,tt+=R+k,H+=tt>>>16,tt&=65535,H+=w+P,H&=65535,o(it<<16|qt,H<<16|tt,this.unsigned)},B.subtract=function(x){return t(x)||(x=h(x)),this.add(x.neg())},B.sub=B.subtract,B.multiply=function(x){if(this.isZero()||(t(x)||(x=h(x)),x.isZero()))return m;if(this.eq(L))return x.isOdd()?L:m;if(x.eq(L))return this.isOdd()?L:m;if(this.isNegative())return x.isNegative()?this.neg().mul(x.neg()):this.neg().mul(x).neg();if(x.isNegative())return this.mul(x.neg()).neg();if(this.lt(g)&&x.lt(g))return i(this.toNumber()*x.toNumber(),this.unsigned);var w=this.high>>>16,R=this.high&65535,I=this.low>>>16,C=this.low&65535,P=x.high>>>16,k=x.high&65535,z=x.low>>>16,$=x.low&65535,H=0,tt=0,it=0,qt=0;return qt+=C*$,it+=qt>>>16,qt&=65535,it+=I*$,tt+=it>>>16,it&=65535,it+=C*z,tt+=it>>>16,it&=65535,tt+=R*$,H+=tt>>>16,tt&=65535,tt+=I*z,H+=tt>>>16,tt&=65535,tt+=C*k,H+=tt>>>16,tt&=65535,H+=w*$+R*z+I*k+C*P,H&=65535,o(it<<16|qt,H<<16|tt,this.unsigned)},B.mul=B.multiply,B.divide=function(x){if(t(x)||(x=h(x)),x.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?M:m;var w,R,I;if(this.unsigned){if(x.unsigned||(x=x.toUnsigned()),x.gt(this))return M;if(x.gt(this.shru(1)))return A;I=M}else{if(this.eq(L)){if(x.eq(E)||x.eq(y))return L;if(x.eq(L))return E;var C=this.shr(1);return w=C.div(x).shl(1),w.eq(m)?x.isNegative()?E:y:(R=this.sub(x.mul(w)),I=w.add(R.div(x)),I)}else if(x.eq(L))return this.unsigned?M:m;if(this.isNegative())return x.isNegative()?this.neg().div(x.neg()):this.neg().div(x).neg();if(x.isNegative())return this.div(x.neg()).neg();I=m}for(R=this;R.gte(x);){w=Math.max(1,Math.floor(R.toNumber()/x.toNumber()));for(var P=Math.ceil(Math.log(w)/Math.LN2),k=P<=48?1:c(2,P-48),z=i(w),$=z.mul(x);$.isNegative()||$.gt(R);)w-=k,z=i(w,this.unsigned),$=z.mul(x);z.isZero()&&(z=E),I=I.add(z),R=R.sub($)}return I},B.div=B.divide,B.modulo=function(x){return t(x)||(x=h(x)),this.sub(this.div(x).mul(x))},B.mod=B.modulo,B.not=function(){return o(~this.low,~this.high,this.unsigned)},B.and=function(x){return t(x)||(x=h(x)),o(this.low&x.low,this.high&x.high,this.unsigned)},B.or=function(x){return t(x)||(x=h(x)),o(this.low|x.low,this.high|x.high,this.unsigned)},B.xor=function(x){return t(x)||(x=h(x)),o(this.low^x.low,this.high^x.high,this.unsigned)},B.shiftLeft=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low<<x,this.high<<x|this.low>>>32-x,this.unsigned):o(0,this.low<<x-32,this.unsigned)},B.shl=B.shiftLeft,B.shiftRight=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low>>>x|this.high<<32-x,this.high>>x,this.unsigned):o(this.high>>x-32,this.high>=0?0:-1,this.unsigned)},B.shr=B.shiftRight,B.shiftRightUnsigned=function(x){if(t(x)&&(x=x.toInt()),x&=63,x===0)return this;var w=this.high;if(x<32){var R=this.low;return o(R>>>x|w<<32-x,w>>>x,this.unsigned)}else return x===32?o(w,0,this.unsigned):o(w>>>x-32,0,this.unsigned)},B.shru=B.shiftRightUnsigned,B.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},B.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},B.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},B.toBytesLE=function(){var S=this.high,x=this.low;return[x&255,x>>>8&255,x>>>16&255,x>>>24&255,S&255,S>>>8&255,S>>>16&255,S>>>24&255]},B.toBytesBE=function(){var S=this.high,x=this.low;return[S>>>24&255,S>>>16&255,S>>>8&255,S&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255]},e})});var Cl=ot(($7,ng)=>{ng.exports=globalThis.luma});var qo=ot((tH,rg)=>{rg.exports=globalThis.deck});var Ll=ot((eH,sg)=>{sg.exports=globalThis.luma});var Nr=ot((QH,Fg)=>{Fg.exports=globalThis.loaders});var wE=ot((iot,LE)=>{LE.exports=globalThis.deck});var UE=ot(B1=>{B1.read=function(e,t,n,r,s){var i,o,c=s*8-r-1,a=(1<<c)-1,h=a>>1,l=-7,f=n?s-1:0,p=n?-1:1,u=e[t+f];for(f+=p,i=u&(1<<-l)-1,u>>=-l,l+=c;l>0;i=i*256+e[t+f],f+=p,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=r;l>0;o=o*256+e[t+f],f+=p,l-=8);if(i===0)i=1-h;else{if(i===a)return o?NaN:(u?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-h}return(u?-1:1)*o*Math.pow(2,i-r)};B1.write=function(e,t,n,r,s,i){var o,c,a,h=i*8-s-1,l=(1<<h)-1,f=l>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:i-1,d=r?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+f>=1?t+=p/a:t+=p*Math.pow(2,1-f),t*a>=2&&(o++,a/=2),o+f>=l?(c=0,o=l):o+f>=1?(c=(t*a-1)*Math.pow(2,s),o=o+f):(c=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+u]=c&255,u+=d,c/=256,s-=8);for(o=o<<s|c,h+=s;h>0;e[n+u]=o&255,u+=d,o/=256,h-=8);e[n+u-d]|=g*128}});var HE=ot((Wot,kE)=>{"use strict";kE.exports=K;var Da=UE();function K(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}K.Varint=0;K.Fixed64=1;K.Bytes=2;K.Fixed32=5;var C1=(1<<16)*(1<<16),GE=1/C1,zD=12,VE=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");K.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),s=r>>3,i=this.pos;this.type=r&7,e(s,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ua(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=qE(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ua(this.buf,this.pos)+Ua(this.buf,this.pos+4)*C1;return this.pos+=8,e},readSFixed64:function(){var e=Ua(this.buf,this.pos)+qE(this.buf,this.pos+4)*C1;return this.pos+=8,e},readFloat:function(){var e=Da.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Da.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,qD(n,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>=zD&&VE?e6(this.buf,t,e):t6(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!==K.Bytes)return e.push(this.readVarint(t));var n=$e(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==K.Bytes)return e.push(this.readSVarint());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==K.Bytes)return e.push(this.readBoolean());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==K.Bytes)return e.push(this.readFloat());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==K.Bytes)return e.push(this.readDouble());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==K.Bytes)return e.push(this.readFixed32());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==K.Bytes)return e.push(this.readSFixed32());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==K.Bytes)return e.push(this.readFixed64());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==K.Bytes)return e.push(this.readSFixed64());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===K.Varint)for(;this.buf[this.pos++]>127;);else if(t===K.Bytes)this.pos=this.readVarint()+this.pos;else if(t===K.Fixed32)this.pos+=4;else if(t===K.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 n=new Uint8Array(t);n.set(this.buf),this.buf=n,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),Ss(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Ss(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Ss(this.buf,e&-1,this.pos),Ss(this.buf,Math.floor(e*GE),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Ss(this.buf,e&-1,this.pos),Ss(this.buf,Math.floor(e*GE),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){VD(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=n6(this.buf,e,this.pos);var n=this.pos-t;n>=128&&zE(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Da.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Da.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 n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&zE(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,K.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,YD,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,WD,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,XD,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,JD,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,jD,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,KD,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,QD,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,ZD,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,$D,t)},writeBytesField:function(e,t){this.writeTag(e,K.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,K.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,K.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,K.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,K.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,K.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,K.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,K.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,K.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,K.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function qD(e,t,n){var r=n.buf,s,i;if(i=r[n.pos++],s=(i&112)>>4,i<128||(i=r[n.pos++],s|=(i&127)<<3,i<128)||(i=r[n.pos++],s|=(i&127)<<10,i<128)||(i=r[n.pos++],s|=(i&127)<<17,i<128)||(i=r[n.pos++],s|=(i&127)<<24,i<128)||(i=r[n.pos++],s|=(i&1)<<31,i<128))return _s(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function $e(e){return e.type===K.Bytes?e.readVarint()+e.pos:e.pos+1}function _s(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function VD(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),kD(n,r,t),HD(r,t)}function kD(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function HD(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((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 zE(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var s=n.pos-1;s>=e;s--)n.buf[s+r]=n.buf[s]}function YD(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function WD(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function JD(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function jD(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function XD(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function KD(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function QD(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function ZD(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function $D(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ua(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Ss(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function qE(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function t6(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,c=i>239?4:i>223?3:i>191?2:1;if(s+c>n)break;var a,h,l;c===1?i<128&&(o=i):c===2?(a=e[s+1],(a&192)===128&&(o=(i&31)<<6|a&63,o<=127&&(o=null))):c===3?(a=e[s+1],h=e[s+2],(a&192)===128&&(h&192)===128&&(o=(i&15)<<12|(a&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):c===4&&(a=e[s+1],h=e[s+2],l=e[s+3],(a&192)===128&&(h&192)===128&&(l&192)===128&&(o=(i&15)<<18|(a&63)<<12|(h&63)<<6|l&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,c=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=c}return r}function e6(e,t,n){return VE.decode(e.subarray(t,n))}function n6(e,t,n){for(var r=0,s,i;r<t.length;r++){if(s=t.charCodeAt(r),s>55295&&s<57344)if(i)if(s<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=s;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);s<128?e[n++]=s:(s<2048?e[n++]=s>>6|192:(s<65536?e[n++]=s>>12|224:(e[n++]=s>>18|240,e[n++]=s>>12&63|128),e[n++]=s>>6&63|128),e[n++]=s&63|128)}return n}});var Wi={};Et(Wi,{A5Layer:()=>Yu,GeohashLayer:()=>fT,GreatCircleLayer:()=>gm,H3ClusterLayer:()=>eg,H3HexagonLayer:()=>zo,MVTLayer:()=>cT,QuadkeyLayer:()=>Im,S2Layer:()=>wm,TerrainLayer:()=>CE,Tile3DLayer:()=>ME,TileLayer:()=>Kn,TripsLayer:()=>Zm,_GeoCellLayer:()=>Qt,_Tile2DHeader:()=>Jn,_Tileset2D:()=>Xn,_WMSLayer:()=>Or,_getURLFromTemplate:()=>Re});var ye={},z1=U(he(),1);tn(ye,U(he(),1));if(!z1.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");tn(Wi,ye);var V1=U(le(),1),Ja=U(he(),1),ET={...Ja.PolygonLayer.defaultProps},Ls=class extends V1.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m}=this.props,{updateTriggers:M,material:E,transitions:A}=this.props,y=this.getSubLayerClass("cell",Ja.PolygonLayer),{updateTriggers:T,..._}=this.indexToBounds()||{};return new y({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,material:E,transitions:A,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:M&&{...T,getElevation:M.getElevation,getFillColor:M.getFillColor,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}),_)}};Ls.layerName="GeoCellLayer";Ls.defaultProps=ET;var Qt=Ls;var TT=Object.defineProperty,Rs=(e,t)=>{for(var n in t)TT(e,n,{get:t[n],enumerable:!0})},$t={};Rs($t,{ARRAY_TYPE:()=>pt,EPSILON:()=>Lt,RANDOM:()=>vn,equals:()=>CT,setMatrixArrayType:()=>_T,toRadian:()=>BT});var Lt=1e-6,pt=typeof Float32Array<"u"?Float32Array:Array,vn=Math.random;function _T(e){pt=e}var ST=Math.PI/180;function BT(e){return e*ST}function CT(e,t){return Math.abs(e-t)<=Lt*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 Fe={};Rs(Fe,{LDU:()=>kT,add:()=>HT,adjoint:()=>vT,clone:()=>wT,copy:()=>RT,create:()=>LT,determinant:()=>FT,equals:()=>WT,exactEquals:()=>YT,frob:()=>VT,fromRotation:()=>GT,fromScaling:()=>zT,fromValues:()=>bT,identity:()=>IT,invert:()=>NT,mul:()=>XT,multiply:()=>sp,multiplyScalar:()=>JT,multiplyScalarAndAdd:()=>jT,rotate:()=>DT,scale:()=>UT,set:()=>OT,str:()=>qT,sub:()=>KT,subtract:()=>ip,transpose:()=>PT});function LT(){var e=new pt(4);return pt!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function wT(e){var t=new pt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function RT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function IT(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function bT(e,t,n,r){var s=new pt(4);return s[0]=e,s[1]=t,s[2]=n,s[3]=r,s}function OT(e,t,n,r,s){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e}function PT(e,t){if(e===t){var n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function NT(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*i-s*r;return o?(o=1/o,e[0]=i*o,e[1]=-r*o,e[2]=-s*o,e[3]=n*o,e):null}function vT(e,t){var n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}function FT(e){return e[0]*e[3]-e[2]*e[1]}function sp(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*c+i*a,e[1]=s*c+o*a,e[2]=r*h+i*l,e[3]=s*h+o*l,e}function DT(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=r*-c+i*a,e[3]=s*-c+o*a,e}function UT(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1];return e[0]=r*c,e[1]=s*c,e[2]=i*a,e[3]=o*a,e}function GT(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=-n,e[3]=r,e}function zT(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function qT(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function VT(e){return Math.hypot(e[0],e[1],e[2],e[3])}function kT(e,t,n,r){return e[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-e[2]*n[1],[e,t,n]}function HT(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function ip(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function YT(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function WT(e,t){var n=e[0],r=e[1],s=e[2],i=e[3],o=t[0],c=t[1],a=t[2],h=t[3];return Math.abs(n-o)<=Lt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-c)<=Lt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-a)<=Lt*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-h)<=Lt*Math.max(1,Math.abs(i),Math.abs(h))}function JT(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function jT(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e}var XT=sp,KT=ip;function QT(){var e=new pt(9);return pt!=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 en={};Rs(en,{add:()=>lS,calculateW:()=>$_,clone:()=>oS,conjugate:()=>rS,copy:()=>aS,create:()=>Qa,dot:()=>Ep,equals:()=>gS,exactEquals:()=>mS,exp:()=>xp,fromEuler:()=>sS,fromMat3:()=>Ap,fromValues:()=>cS,getAngle:()=>X_,getAxisAngle:()=>j_,identity:()=>J_,invert:()=>nS,len:()=>uS,length:()=>Tp,lerp:()=>pS,ln:()=>Mp,mul:()=>fS,multiply:()=>gp,normalize:()=>rh,pow:()=>tS,random:()=>eS,rotateX:()=>K_,rotateY:()=>Q_,rotateZ:()=>Z_,rotationTo:()=>xS,scale:()=>yp,set:()=>hS,setAxes:()=>AS,setAxisAngle:()=>mp,slerp:()=>Zi,sqlerp:()=>MS,sqrLen:()=>dS,squaredLength:()=>_p,str:()=>iS});var $i={};Rs($i,{add:()=>e_,angle:()=>E_,bezier:()=>u_,ceil:()=>n_,clone:()=>ZT,copy:()=>$T,create:()=>eh,cross:()=>Qi,dist:()=>R_,distance:()=>lp,div:()=>w_,divide:()=>hp,dot:()=>nh,equals:()=>B_,exactEquals:()=>S_,floor:()=>r_,forEach:()=>O_,fromValues:()=>Ka,hermite:()=>p_,inverse:()=>l_,len:()=>dp,length:()=>op,lerp:()=>f_,max:()=>i_,min:()=>s_,mul:()=>L_,multiply:()=>ap,negate:()=>h_,normalize:()=>up,random:()=>d_,rotateX:()=>M_,rotateY:()=>A_,rotateZ:()=>y_,round:()=>o_,scale:()=>c_,scaleAndAdd:()=>a_,set:()=>t_,sqrDist:()=>I_,sqrLen:()=>b_,squaredDistance:()=>fp,squaredLength:()=>pp,str:()=>__,sub:()=>C_,subtract:()=>cp,transformMat3:()=>g_,transformMat4:()=>m_,transformQuat:()=>x_,zero:()=>T_});function eh(){var e=new pt(3);return pt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ZT(e){var t=new pt(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function op(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function Ka(e,t,n){var r=new pt(3);return r[0]=e,r[1]=t,r[2]=n,r}function $T(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function t_(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function e_(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function cp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function ap(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function hp(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function n_(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function r_(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function s_(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function i_(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function o_(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function c_(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function a_(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function lp(e,t){var n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.hypot(n,r,s)}function fp(e,t){var n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function pp(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function h_(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function l_(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function up(e,t){var n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function nh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Qi(e,t,n){var r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function f_(e,t,n,r){var s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function p_(e,t,n,r,s,i){var o=i*i,c=o*(2*i-3)+1,a=o*(i-2)+i,h=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*c+n[0]*a+r[0]*h+s[0]*l,e[1]=t[1]*c+n[1]*a+r[1]*h+s[1]*l,e[2]=t[2]*c+n[2]*a+r[2]*h+s[2]*l,e}function u_(e,t,n,r,s,i){var o=1-i,c=o*o,a=i*i,h=c*o,l=3*i*c,f=3*a*o,p=a*i;return e[0]=t[0]*h+n[0]*l+r[0]*f+s[0]*p,e[1]=t[1]*h+n[1]*l+r[1]*f+s[1]*p,e[2]=t[2]*h+n[2]*l+r[2]*f+s[2]*p,e}function d_(e,t){t=t||1;var n=vn()*2*Math.PI,r=vn()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function m_(e,t,n){var r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function g_(e,t,n){var r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function x_(e,t,n){var r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function M_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function A_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function y_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function E_(e,t){var n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt(n*n+r*r+s*s),h=Math.sqrt(i*i+o*o+c*c),l=a*h,f=l&&nh(e,t)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function T_(e){return e[0]=0,e[1]=0,e[2]=0,e}function __(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function S_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function B_(e,t){var n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2];return Math.abs(n-i)<=Lt*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=Lt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-c)<=Lt*Math.max(1,Math.abs(s),Math.abs(c))}var C_=cp,L_=ap,w_=hp,R_=lp,I_=fp,dp=op,b_=pp,O_=function(){var e=eh();return function(t,n,r,s,i,o){var c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();function P_(){var e=new pt(4);return pt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function N_(e){var t=new pt(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function v_(e,t,n,r){var s=new pt(4);return s[0]=e,s[1]=t,s[2]=n,s[3]=r,s}function F_(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function D_(e,t,n,r,s){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e}function U_(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function G_(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function z_(e){var t=e[0],n=e[1],r=e[2],s=e[3];return Math.hypot(t,n,r,s)}function q_(e){var t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function V_(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function k_(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function H_(e,t,n,r){var s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Y_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function W_(e,t){var n=e[0],r=e[1],s=e[2],i=e[3],o=t[0],c=t[1],a=t[2],h=t[3];return Math.abs(n-o)<=Lt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-c)<=Lt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-a)<=Lt*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-h)<=Lt*Math.max(1,Math.abs(i),Math.abs(h))}var q6=function(){var e=P_();return function(t,n,r,s,i,o){var c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();function Qa(){var e=new pt(4);return pt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function J_(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function mp(e,t,n){n=n*.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function j_(e,t){var n=Math.acos(t[3])*2,r=Math.sin(n/2);return r>Lt?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}function X_(e,t){var n=Ep(e,t);return Math.acos(2*n*n-1)}function gp(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function K_(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Q_(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Z_(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function $_(e,t){var n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function xp(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=Math.sqrt(n*n+r*r+s*s),c=Math.exp(i),a=o>0?c*Math.sin(o)/o:0;return e[0]=n*a,e[1]=r*a,e[2]=s*a,e[3]=c*Math.cos(o),e}function Mp(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=Math.sqrt(n*n+r*r+s*s),c=o>0?Math.atan2(o,i)/o:0;return e[0]=n*c,e[1]=r*c,e[2]=s*c,e[3]=.5*Math.log(n*n+r*r+s*s+i*i),e}function tS(e,t,n){return Mp(e,t),yp(e,e,n),xp(e,e),e}function Zi(e,t,n,r){var s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return u=s*a+i*h+o*l+c*f,u<0&&(u=-u,a=-a,h=-h,l=-l,f=-f),1-u>Lt?(p=Math.acos(u),d=Math.sin(p),g=Math.sin((1-r)*p)/d,m=Math.sin(r*p)/d):(g=1-r,m=r),e[0]=g*s+m*a,e[1]=g*i+m*h,e[2]=g*o+m*l,e[3]=g*c+m*f,e}function eS(e){var t=vn(),n=vn(),r=vn(),s=Math.sqrt(1-t),i=Math.sqrt(t);return e[0]=s*Math.sin(2*Math.PI*n),e[1]=s*Math.cos(2*Math.PI*n),e[2]=i*Math.sin(2*Math.PI*r),e[3]=i*Math.cos(2*Math.PI*r),e}function nS(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function rS(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ap(e,t){var n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}function sS(e,t,n,r){var s=.5*Math.PI/180;t*=s,n*=s,r*=s;var i=Math.sin(t),o=Math.cos(t),c=Math.sin(n),a=Math.cos(n),h=Math.sin(r),l=Math.cos(r);return e[0]=i*a*l-o*c*h,e[1]=o*c*l+i*a*h,e[2]=o*a*h-i*c*l,e[3]=o*a*l+i*c*h,e}function iS(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var oS=N_,cS=v_,aS=F_,hS=D_,lS=U_,fS=gp,yp=G_,Ep=k_,pS=H_,Tp=z_,uS=Tp,_p=q_,dS=_p,rh=V_,mS=Y_,gS=W_,xS=function(){var e=eh(),t=Ka(1,0,0),n=Ka(0,1,0);return function(r,s,i){var o=nh(s,i);return o<-.999999?(Qi(e,t,s),dp(e)<1e-6&&Qi(e,n,s),up(e,e),mp(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Qi(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,rh(r,r))}}(),MS=function(){var e=Qa(),t=Qa();return function(n,r,s,i,o,c){return Zi(e,r,o,c),Zi(t,s,i,c),Zi(n,e,t,2*c*(1-c)),n}}(),AS=function(){var e=QT();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],rh(t,Ap(t,e))}}(),F={};Rs(F,{add:()=>SS,angle:()=>HS,ceil:()=>BS,clone:()=>yS,copy:()=>TS,create:()=>Sp,cross:()=>FS,dist:()=>$S,distance:()=>wp,div:()=>ZS,divide:()=>Lp,dot:()=>vS,equals:()=>jS,exactEquals:()=>JS,floor:()=>CS,forEach:()=>nB,fromValues:()=>ES,inverse:()=>PS,len:()=>XS,length:()=>Ip,lerp:()=>DS,max:()=>wS,min:()=>LS,mul:()=>QS,multiply:()=>Cp,negate:()=>OS,normalize:()=>NS,random:()=>US,rotate:()=>kS,round:()=>RS,scale:()=>IS,scaleAndAdd:()=>bS,set:()=>_S,sqrDist:()=>tB,sqrLen:()=>eB,squaredDistance:()=>Rp,squaredLength:()=>bp,str:()=>WS,sub:()=>KS,subtract:()=>Bp,transformMat2:()=>GS,transformMat2d:()=>zS,transformMat3:()=>qS,transformMat4:()=>VS,zero:()=>YS});function Sp(){var e=new pt(2);return pt!=Float32Array&&(e[0]=0,e[1]=0),e}function yS(e){var t=new pt(2);return t[0]=e[0],t[1]=e[1],t}function ES(e,t){var n=new pt(2);return n[0]=e,n[1]=t,n}function TS(e,t){return e[0]=t[0],e[1]=t[1],e}function _S(e,t,n){return e[0]=t,e[1]=n,e}function SS(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Bp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Cp(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}function Lp(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}function BS(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function CS(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function LS(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function wS(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}function RS(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function IS(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function bS(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e}function wp(e,t){var n=t[0]-e[0],r=t[1]-e[1];return Math.hypot(n,r)}function Rp(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Ip(e){var t=e[0],n=e[1];return Math.hypot(t,n)}function bp(e){var t=e[0],n=e[1];return t*t+n*n}function OS(e,t){return e[0]=-t[0],e[1]=-t[1],e}function PS(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function NS(e,t){var n=t[0],r=t[1],s=n*n+r*r;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function vS(e,t){return e[0]*t[0]+e[1]*t[1]}function FS(e,t,n){var r=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=r,e}function DS(e,t,n,r){var s=t[0],i=t[1];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e}function US(e,t){t=t||1;var n=vn()*2*Math.PI;return e[0]=Math.cos(n)*t,e[1]=Math.sin(n)*t,e}function GS(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function zS(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function qS(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function VS(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}function kS(e,t,n,r){var s=t[0]-n[0],i=t[1]-n[1],o=Math.sin(r),c=Math.cos(r);return e[0]=s*c-i*o+n[0],e[1]=s*o+i*c+n[1],e}function HS(e,t){var n=e[0],r=e[1],s=t[0],i=t[1],o=Math.sqrt(n*n+r*r)*Math.sqrt(s*s+i*i),c=o&&(n*s+r*i)/o;return Math.acos(Math.min(Math.max(c,-1),1))}function YS(e){return e[0]=0,e[1]=0,e}function WS(e){return"vec2("+e[0]+", "+e[1]+")"}function JS(e,t){return e[0]===t[0]&&e[1]===t[1]}function jS(e,t){var n=e[0],r=e[1],s=t[0],i=t[1];return Math.abs(n-s)<=Lt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(r-i)<=Lt*Math.max(1,Math.abs(r),Math.abs(i))}var XS=Ip,KS=Bp,QS=Cp,ZS=Lp,$S=wp,tB=Rp,eB=bp,nB=function(){var e=Sp();return function(t,n,r,s,i,o){var c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}(),Is=(1+Math.sqrt(5))/2,V6=2*Math.PI,to=2*Math.PI/5,Zt=Math.PI/5,k1=Math.PI/10,rB=2*Math.atan(Is),H1=Math.PI-rB,k6=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-Is)),bs=Is-1,H6=bs/Math.cos(Zt),sB=.515,iB=Math.sqrt(3-Is),Y6=Math.sqrt(3)*iB/Is;$t.setMatrixArrayType(Float64Array);var oB=class{constructor(e,t,n){this.origin=F.clone(e),this.edge1=F.subtract(F.create(),t,this.origin),this.edge2=F.subtract(F.create(),n,this.origin),this.testPoint=F.create(),this.dot11=F.dot(this.edge1,this.edge1),this.dot12=F.dot(this.edge1,this.edge2),this.dot22=F.dot(this.edge2,this.edge2);let r=1/(this.dot11*this.dot22-this.dot12*this.dot12);this.dot11*=r,this.dot12*=r,this.dot22*=r}containsPoint(e){F.subtract(this.testPoint,e,this.origin);let t=F.dot(this.testPoint,this.edge1),n=F.dot(this.testPoint,this.edge2),r=this.dot22*t-this.dot12*n;if(r<0)return!1;let s=this.dot11*n-this.dot12*t;return s>=0&&r+s<=1}};$t.setMatrixArrayType(Float64Array);var ro=class Op{constructor(t){this.vertices=t,this.id={i:0,j:0,k:0,resolution:1}}getVertices(){return this.vertices}scale(t){for(let n of this.vertices)F.scale(n,n,t);return this}rotate180(){for(let t of this.vertices)F.negate(t,t);return this}reflectY(){for(let t of this.vertices)t[1]=-t[1];return this}translate(t){for(let n of this.vertices)F.add(n,n,t);return this}transform(t){for(let n of this.vertices)F.transformMat2(n,n,t);return this}transform2d(t){for(let n of this.vertices)F.transformMat2d(n,n,t);return this}clone(){return new Op(this.vertices.map(n=>F.clone(n)))}getCenter(){return this.vertices.reduce((t,n)=>[t[0]+n[0]/5,t[1]+n[1]/5],[0,0])}containsPoint(t){let n=this.vertices[0];if(!this.triangles){this.triangles=[];for(let r of[2,1,3]){let s=this.vertices[r],i=this.vertices[r+1];this.triangles.push(new oB(n,s,i))}}for(let r of this.triangles)if(r.containsPoint(t))return!0;return!1}static normalizeLongitudes(t){let n=t.map(([s])=>((s+180)%360+360)%360-180),r=n.reduce((s,i)=>s+i,0)/n.length;return r=((r+180)%360+360)%360-180,t.map(s=>{let[i,o]=s;for(;i-r>180;)i=i-360;for(;i-r<-180;)i=i+360;return[i,o]})}};$t.setMatrixArrayType(Float64Array);var Pp=[0,0],Np=[0,1],Dn=[.7885966681787006,1.6149108024237764],vp=[1.6171013659387945,1.054928690397459],Fp=[Math.cos(k1),Math.sin(k1)],cB=2*F.length(Dn)*Math.cos(Zt),aB=Zt-Math.atan2(Dn[1],Dn[0]),hB=2*bs/cB;[Pp,Np,Dn,vp,Fp].forEach(e=>{F.scale(e,e,hB),F.rotate(e,e,[0,0],aB)});var lB=new ro([Pp,Np,Dn,vp,Fp]),Dp=Math.atan2(Dn[1],Dn[0])-Zt,fB=[0,0],eo=bs/Math.cos(Zt),Y1=Dp+Zt,no=[eo*Math.cos(Y1),eo*Math.sin(Y1)],W1=Dp-Zt,Fn=[eo*Math.cos(W1),eo*Math.sin(W1)],Up=new ro([fB,no,Fn,Fn,Fn]),Gp=Fe.fromValues(no[0],no[1],Fn[0],Fn[1]),W6=Fe.invert(Fe.create(),Gp);$t.setMatrixArrayType(Float64Array);function J1(e){return e*(180/Math.PI)}function j1(e){let t=F.length(e),n=Math.atan2(e[1],e[0]);return[t,n]}function pB(e){let t=Math.atan2(e[1],e[0]),n=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=Math.acos(e[2]/n);return[t,r]}function sh([e,t]){let n=Math.sin(t)*Math.cos(e),r=Math.sin(t)*Math.sin(e),s=Math.cos(t);return[n,r,s]}var uB=93;function dB([e,t]){let n=J1(e)-uB,r=90-J1(t);return[n,r]}function mB(e){let t=sh(e),n=en.create();return en.rotationTo(n,[0,0,1],t),n}$t.setMatrixArrayType(Float64Array);var gB=[0,0,1],zp=["vu","uw","vw","vw","vw"],ws=["wu","uw","vw","vu","uw"],ja=["wu","uv","wv","wu","uw"],ji=["vu","uv","wv","wu","uw"],xB=[zp,ji,ja,ws,ja,ji,ja,ws,ws,ws,ji,ji],MB=[4,2,3,2,0,4,3,2,2,0,3,0],X1=[0,1,2,4,3,5,7,8,6,11,10,9],nn=[];function AB(){Ki([0,0],0);for(let e=0;e<5;e++){let t=e*to,n=t+Zt;Ki([t,H1],Zt),Ki([n,Math.PI-H1],Zt)}Ki([0,Math.PI],0)}var Xi=0;function Ki(e,t){let n={id:Xi,axis:e,quat:mB(e),angle:t,orientation:xB[Xi],firstQuintant:MB[Xi]};nn.push(n),Xi++}AB();nn.sort((e,t)=>X1.indexOf(e.id)-X1.indexOf(t.id));nn.forEach((e,t)=>e.id=t);function yB(e,t){let n=t.orientation,r=n===zp||n===ws?-1:1,s=(e-t.firstQuintant+5)%5,i=n[s];return{quintant:(t.firstQuintant+r*s+5)%5,orientation:i}}function EB(e,t,n){let r=en.create();en.invert(r,t.quat);let s=sh(n.axis),i=$i.create();$i.transformQuat(i,s,r);let o=F.create();F.normalize(o,[i[0],i[1]]),F.scale(o,o,2*bs);let c=F.create();F.subtract(c,e,o);let a=en.create();return en.rotationTo(a,gB,i),en.multiply(a,t.quat,a),{point:c,quat:a}}function TB(e){let t=1/0,n=nn[0];for(let r of nn){let s=qp(e,r.axis);s<t&&(t=s,n=r)}return n}function _B(e,t){return qp(e,t.axis)>.49}function qp(e,t){let[n,r]=e,[s,i]=t,o=s-n,c=i-r,a=Math.sin(c/2),h=Math.sin(o/2);return a*a+h*h*Math.sin(r)*Math.sin(i)}function K1(e){let t=e/to,n=Math.round(t);return(t-n)*to}function Vp(e){let t=e*sB;return Math.tan(t)}var Za=Zt,SB=Vp(Za)/Za;function BB(e){return Vp(e)/SB}function Q1(e,t){let n=Math.abs(t)/Za,r=e*(.95-.05*n);return Math.tan(r)}function CB([e,t]){let n=K1(t),r=BB(K1(t)),s=r-n,o=Math.cos(n)/Math.cos(r)*e,c=bs/Math.cos(r),a=Q1(c,r)/c;return[Q1(o,r)/a,t+s]}function LB([e,t]){return[t,Math.atan(e)]}$t.setMatrixArrayType(Float64Array);function Z1(e,t,n){let[r,s]=CB(e),i=[r,s+n],o=LB(i),c=sh(o);return $i.transformQuat(c,c,t),pB(c)}$t.setMatrixArrayType(Float64Array);var Jt=-1,Wt=1,wB=([e,t])=>F.fromValues(e-t,t),$a=F.fromValues(1,0),th=F.fromValues(0,1),$1=F.negate(F.create(),$a),tp=F.negate(F.create(),th),Xa=F.fromValues(0,0),RB=(e,[t,n])=>{let r=Xa,s=Xa;switch(t===Wt&&n===Wt?(r=$a,s=th):t===Jt&&n===Wt?(r=tp,s=$1):t===Wt&&n===Jt?(r=th,s=$a):t===Jt&&n===Jt&&(r=$1,s=tp),e){case 0:return Xa;case 1:return r;case 2:return F.add(F.create(),s,r);case 3:return F.scaleAndAdd(F.create(),s,r,2);default:throw new Error(`Invalid Quaternary value: ${e}`)}},IB=e=>[[Wt,Wt],[Wt,Jt],[Wt,Wt],[Jt,Wt]][e],ep=F.fromValues(-1,1),bB=(e,t,n)=>{let r=BigInt(e),s=n==="vu"||n==="wu"||n==="vw",i=n==="wv"||n==="vw",o=n==="wu"||n==="uw";s&&(r=(1n<<BigInt(2*t))-r-1n);let c=OB(r);if(o){let{offset:[a,h],flips:[l,f]}=c;c.offset=[h,a],l===Jt&&F.add(c.offset,c.offset,ep),f===Jt&&F.subtract(c.offset,c.offset,ep)}if(i){let{offset:[a,h],flips:l}=c,f=(1<<t)-(a+h);l[0]=-l[0],c.offset[1]=f,c.flips=l}return c},OB=e=>{let t=Number(e)%4,n=F.create(),r=[Wt,Wt],s=BigInt(e),i=[];for(;s>0n;)i.push(Number(s%4n)),s=s>>2n;for(let o=i.length-1;o>=0;o--){F.scale(n,n,2);let c=RB(i[o],r);F.add(n,n,c),F.multiply(r,r,IB(i[o]))}return{flips:r,k:t,offset:wB(n)}};$t.setMatrixArrayType(Float64Array);var PB=!1,NB=F.clone(Fn),vB=F.negate(F.create(),Fn),ih=[0,1,2,3,4].map(e=>{let t=Fe.create();return Fe.fromRotation(t,to*e),t}),np=F.create();function FB(e,t,n){let r=(PB?Up:lB).clone();F.transformMat2(np,n.offset,Gp),n.flips[0]===Wt&&n.flips[1]===Jt&&r.rotate180();let{k:s}=n,i=n.flips[0]+n.flips[1];return((i===-2||i===2)&&s>1||i===0&&(s===0||s===3))&&r.reflectY(),n.flips[0]===Jt&&n.flips[1]===Jt?r.rotate180():n.flips[0]===Jt?r.translate(vB):n.flips[1]===Jt&&r.translate(NB),r.translate(np),r.scale(1/2**e),r.transform(ih[t]),r}function DB(e){let t=Up.clone();return t.transform(ih[e]),t}function UB(){let e=[];for(let t of ih)e.push(F.transformMat2(F.create(),no,t));return new ro(e)}$t.setMatrixArrayType(Float64Array);var rp=Fe.create();function GB(e,t){let n=j1(e),r=Z1(n,t.quat,t.angle),s=_B(r,t)?t:TB(r);if(s.id!==t.id){let i=F.create();Fe.fromRotation(rp,t.angle),F.transformMat2(i,e,rp);let{point:o,quat:c}=EB(i,t,s),a=0;t.angle!==s.angle&&s.angle!==0&&(a=-Zt);let h=j1(o);h[1]=h[1]-a;let l=Z1(h,c,a);r[0]=l[0],r[1]=l[1]}return dB(r)}function zB(e,t){let r=e.getVertices().map(i=>GB(i,t));return ro.normalizeLongitudes(r)}var Mr=3,qB=31,VB=58n,kB=0x3ffffffffffffffn;function HB(e){let t=qB-1,n=e>>1n;for(;t>0&&(n&0b1n)===0n;)t-=1,n=n>>(t<Mr?1n:2n);return t}function YB(e){let t=HB(e);if(t===0)return{origin:nn[0],segment:0,S:0n,resolution:t};let n=Number(e>>58n),r,s;if(t===1)r=nn[n],s=0;else{let h=Math.floor(n/5);r=nn[h],s=(n+r.firstQuintant)%5}if(!r)throw new Error(`Could not parse origin: ${n}`);if(t<Mr)return{origin:r,segment:s,S:0n,resolution:t};let i=t-Mr+1,o=BigInt(2*i),c=VB-o,a=(e&kB)>>c;return{origin:r,segment:s,S:a,resolution:t}}$t.setMatrixArrayType(Float64Array);var J6=Fe.create();function WB({S:e,segment:t,origin:n,resolution:r}){let{quintant:s,orientation:i}=yB(t,n);if(r===Mr-1)return DB(s);if(r===Mr-2)return UB();let o=r-Mr+1,c=bB(e,o,i);return FB(o,s,c)}function kp(e){let{S:t,segment:n,origin:r,resolution:s}=YB(e),i=WB({S:t,segment:n,origin:r,resolution:s});return zB(i,r)}function Hp(e){return BigInt(`0x${e}`)}$t.setMatrixArrayType(Float64Array);var vs=U(so(),1);var Q6=1/Math.PI*180,Z6=1/180*Math.PI,JB={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...JB}};var ut=globalThis.mathgl.config;function oh(e,{precision:t=ut.precision}={}){return e=jB(e),`${parseFloat(e.toPrecision(t))}`}function Ee(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function rn(e,t,n){return Ee(e)?e.map((r,s)=>rn(r,t[s],n)):n*t+(1-n)*e}function Te(e,t,n){let r=ut.EPSILON;n&&(ut.EPSILON=n);try{if(e===t)return!0;if(Ee(e)&&Ee(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Te(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)<=ut.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{ut.EPSILON=r}}function jB(e){return Math.round(e/ut.EPSILON)*ut.EPSILON}var sn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ee(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(ut)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+oh(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Te(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(ut.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function XB(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Y(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function on(e,t,n=""){if(ut.debug&&!XB(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function _e(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Ar=class extends sn{get x(){return this[0]}set x(t){this[0]=Y(t)}get y(){return this[1]}set y(t){this[1]=Y(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Y(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Y(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return _e(t>=0&&t<this.ELEMENTS,"index is out of range"),Y(this[t])}setComponent(t,n){return _e(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var ct=typeof Float32Array<"u"?Float32Array:Array;var hU=Math.PI/180;function KB(){let e=new ct(2);return ct!=Float32Array&&(e[0]=0,e[1]=0),e}function jp(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function Xp(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var lU=function(){let e=KB();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function Kp(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function io(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Qp(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function Zp(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function oo(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function ch(){let e=new ct(3);return ct!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function QB(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function ah(e,t,n){let r=new ct(3);return r[0]=e,r[1]=t,r[2]=n,r}function $p(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function hh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Er(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Tr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function co(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function ao(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function tu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function eu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function nu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ru(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&hh(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var su=QB;var uU=function(){let e=ch();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var lh=[0,0,0],ho,O=class extends Ar{static get ZERO(){return ho||(ho=new O(0,0,0),Object.freeze(ho)),ho}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ee(t)?this.copy(t):(ut.debug&&(Y(t),Y(n),Y(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return ut.debug&&(Y(t.x),Y(t.y),Y(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]=Y(t)}angle(t){return ru(this,t)}cross(t){return Er(this,this,t),this.check()}rotateX({radians:t,origin:n=lh}){return tu(this,this,n,t),this.check()}rotateY({radians:t,origin:n=lh}){return eu(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=lh}){return nu(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Tr(this,this,t),this.check()}transformAsVector(t){return io(this,this,t),this.check()}transformByMatrix3(t){return co(this,this,t),this.check()}transformByMatrix2(t){return Qp(this,this,t),this.check()}transformByQuaternion(t){return ao(this,this,t),this.check()}};var lo,_r=class extends Ar{static get ZERO(){return lo||(lo=new _r(0,0,0,0),Object.freeze(lo)),lo}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Ee(t)&&arguments.length===1?this.copy(t):(ut.debug&&(Y(t),Y(n),Y(r),Y(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 ut.debug&&(Y(t.x),Y(t.y),Y(t.z),Y(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]=Y(t)}get w(){return this[3]}set w(t){this[3]=Y(t)}transform(t){return Tr(this,this,t),this.check()}transformByMatrix3(t){return oo(this,this,t),this.check()}transformByMatrix2(t){return Zp(this,this,t),this.check()}transformByQuaternion(t){return ao(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Sr=class extends sn{toString(){let t="[";if(ut.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=Y(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function iu(){let e=new ct(9);return ct!=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 ou(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 cu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function au(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function fh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function hu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function lu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function ph(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 fu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var uh;(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"})(uh||(uh={}));var tC=Object.freeze([1,0,0,0,1,0,0,0,1]),at=class extends Sr{static get IDENTITY(){return nC()}static get ZERO(){return eC()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return uh}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(tC)}fromObject(t){return this.check()}fromQuaternion(t){return fu(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return au(this)}transpose(){return ou(this,this),this.check()}invert(){return cu(this,this),this.check()}multiplyLeft(t){return fh(this,t,this),this.check()}multiplyRight(t){return fh(this,this,t),this.check()}rotate(t){return lu(this,this,t),this.check()}scale(t){return Array.isArray(t)?ph(this,this,t):ph(this,this,[t,t]),this.check()}translate(t){return hu(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=jp(n||[-0,-0],t,this);break;case 3:r=co(n||[-0,-0,-0],t,this);break;case 4:r=oo(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return on(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},fo,po=null;function eC(){return fo||(fo=new at([0,0,0,0,0,0,0,0,0]),Object.freeze(fo)),fo}function nC(){return po||(po=new at,Object.freeze(po)),po}var Ps={};Et(Ps,{add:()=>LC,adjoint:()=>aC,clone:()=>sC,copy:()=>iC,create:()=>rC,decompose:()=>MC,determinant:()=>gh,equals:()=>bC,exactEquals:()=>IC,frob:()=>CC,fromQuat:()=>_h,fromQuat2:()=>mC,fromRotation:()=>fC,fromRotationTranslation:()=>uu,fromRotationTranslationScale:()=>AC,fromRotationTranslationScaleOrigin:()=>yC,fromScaling:()=>lC,fromTranslation:()=>hC,fromValues:()=>oC,fromXRotation:()=>pC,fromYRotation:()=>uC,fromZRotation:()=>dC,frustum:()=>Sh,getRotation:()=>xC,getScaling:()=>du,getTranslation:()=>gC,identity:()=>pu,invert:()=>mh,lookAt:()=>Lh,mul:()=>OC,multiply:()=>Os,multiplyScalar:()=>wC,multiplyScalarAndAdd:()=>RC,ortho:()=>Ch,orthoNO:()=>gu,orthoZO:()=>_C,perspective:()=>Bh,perspectiveFromFieldOfView:()=>TC,perspectiveNO:()=>mu,perspectiveZO:()=>EC,rotate:()=>Ah,rotateX:()=>yh,rotateY:()=>Eh,rotateZ:()=>Th,scale:()=>Mh,set:()=>cC,str:()=>BC,sub:()=>PC,subtract:()=>xu,targetTo:()=>SC,translate:()=>xh,transpose:()=>dh});function rC(){let e=new ct(16);return ct!=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 sC(e){let t=new ct(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 iC(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 oC(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new ct(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function cC(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function pu(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 dh(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 mh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m,C=E*I-A*R+y*w+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*R+h*w)*C,e[1]=(s*R-r*I-i*w)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*R-c*x+h*B)*C,e[9]=(r*x-n*R-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*w-a*B)*C,e[13]=(n*w-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function aC(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m;return e[0]=c*I-a*R+h*w,e[1]=s*R-r*I-i*w,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*I-h*S,e[5]=n*I-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*R-c*x+h*B,e[9]=r*x-n*R-i*B,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*w-a*B,e[13]=n*w-r*S+s*B,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function gh(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function Os(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function xh(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function Mh(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ah(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,w,R,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,w=i*i*l+a,R=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*w+A*R,e[5]=p*x+m*w+y*R,e[6]=u*x+M*w+T*R,e[7]=d*x+E*w+_*R,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function yh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Eh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function Th(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function hC(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 lC(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 fC(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function pC(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function uC(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function dC(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,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 uu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function mC(e,t){let n=new ct(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),uu(e,t,n),e}function gC(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function du(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function xC(e,t){let n=new ct(3);du(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function MC(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,B=p*g,S=m+y+B,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>B?(x=Math.sqrt(1+m-y-B)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>B?(x=Math.sqrt(1+y-m-B)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+B-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function AC(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function yC(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],B=s[0],S=s[1],x=s[2],w=(1-(g+M))*T,R=(u+y)*T,I=(d-A)*T,C=(u-y)*_,P=(1-(p+M))*_,k=(m+E)*_,z=(d+A)*L,$=(m-E)*L,H=(1-(p+g))*L;return e[0]=w,e[1]=R,e[2]=I,e[3]=0,e[4]=C,e[5]=P,e[6]=k,e[7]=0,e[8]=z,e[9]=$,e[10]=H,e[11]=0,e[12]=n[0]+B-(w*B+C*S+z*x),e[13]=n[1]+S-(R*B+P*S+$*x),e[14]=n[2]+x-(I*B+k*S+H*x),e[15]=1,e}function _h(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Sh(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function mu(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var Bh=mu;function EC(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function TC(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function gu(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var Ch=gu;function _C(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function Lh(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?pu(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function SC(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function BC(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 CC(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 LC(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function xu(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function wC(e,t,n){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]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function RC(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function IC(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 bC(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],B=t[6],S=t[7],x=t[8],w=t[9],R=t[10],I=t[11],C=t[12],P=t[13],k=t[14],z=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-B)<=1e-6*Math.max(1,Math.abs(a),Math.abs(B))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-w)<=1e-6*Math.max(1,Math.abs(f),Math.abs(w))&&Math.abs(p-R)<=1e-6*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(u-I)<=1e-6*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(g-P)<=1e-6*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(m-k)<=1e-6*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(M-z)<=1e-6*Math.max(1,Math.abs(M),Math.abs(z))}var OC=Os,PC=xu;function NC(){let e=new ct(4);return ct!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Mu(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Au(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function yu(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Eu(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Tu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function _u(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Su(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Bu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function Cu(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var DU=function(){let e=NC();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Ih;(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"})(Ih||(Ih={}));var FC=45*Math.PI/180,DC=1,wh=.1,Rh=500,UC=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),jt=class extends Sr{static get IDENTITY(){return zC()}static get ZERO(){return GC()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Ih}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(UC)}fromObject(t){return this.check()}fromQuaternion(t){return _h(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=wh,far:c=Rh}=t;return c===1/0?qC(this,n,r,s,i,o):Sh(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return Lh(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=wh,far:c=Rh}=t;return Ch(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=FC,aspect:r=DC,focalDistance:s=1,near:i=wh,far:o=Rh}=t;Lu(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Lu(n),Bh(this,n,r,s,i),this.check()}determinant(){return gh(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return dh(this,this),this.check()}invert(){return mh(this,this),this.check()}multiplyLeft(t){return Os(this,t,this),this.check()}multiplyRight(t){return Os(this,this,t),this.check()}rotateX(t){return yh(this,this,t),this.check()}rotateY(t){return Eh(this,this,t),this.check()}rotateZ(t){return Th(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Ah(this,this,t,n),this.check()}scale(t){return Mh(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return xh(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Bu(n||[-0,-0,-0,-0],t,this),on(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=Xp(n||[-0,-0],t,this);break;case 3:s=Tr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return on(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=Kp(n||[-0,-0],t,this);break;case 3:r=io(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return on(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},uo,mo;function GC(){return uo||(uo=new jt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(uo)),uo}function zC(){return mo||(mo=new jt,Object.freeze(mo)),mo}function Lu(e){if(e>Math.PI*2)throw Error("expected radians")}function qC(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function wu(){let e=new ct(4);return ct!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ru(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function bh(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Oh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function Iu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function bu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Ou(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function Pu(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Ns(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function Nu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function vu(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Ph(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var Fu=Mu;var Du=Au,Uu=_u,Gu=Su,zu=yu;var qu=Eu;var Vu=Tu;var ku=function(){let e=ch(),t=ah(1,0,0),n=ah(0,1,0);return function(r,s,i){let o=hh(s,i);return o<-.999999?(Er(e,t,s),su(e)<1e-6&&Er(e,n,s),$p(e,e),bh(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Er(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Vu(r,r))}}(),QU=function(){let e=wu(),t=wu();return function(n,r,s,i,o,c){return Ns(e,r,o,c),Ns(t,s,i,c),Ns(n,e,t,2*c*(1-c)),n}}(),ZU=function(){let e=iu();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],Vu(t,Ph(t,e))}}();var VC=[0,0,0,1],Br=class extends sn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 Ph(this,t),this.check()}fromAxisRotation(t,n){return bh(this,t,n),this.check()}identity(){return Ru(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Y(t)}get y(){return this[1]}set y(t){this[1]=Y(t)}get z(){return this[2]}set z(t){this[2]=Y(t)}get w(){return this[3]}set w(t){this[3]=Y(t)}len(){return zu(this)}lengthSquared(){return qu(this)}dot(t){return Uu(this,t)}rotationTo(t,n){return ku(this,t,n),this.check()}add(t){return Fu(this,this,t),this.check()}calculateW(){return Pu(this,this),this.check()}conjugate(){return vu(this,this),this.check()}invert(){return Nu(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(Gu(this,t,n,r),this.check())}multiplyRight(t){return Oh(this,this,t),this.check()}multiplyLeft(t){return Oh(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return Iu(this,this,t),this.check()}rotateY(t){return bu(this,this,t),this.check()}rotateZ(t){return Ou(this,this,t),this.check()}scale(t){return Du(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=VC,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Ns(this,s,i,o),this.check()}transformVector4(t,n=new _r){return Cu(n,t,this),on(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Cr={};Et(Cr,{EPSILON1:()=>kC,EPSILON10:()=>ZC,EPSILON11:()=>$C,EPSILON12:()=>tL,EPSILON13:()=>eL,EPSILON14:()=>nL,EPSILON15:()=>rL,EPSILON16:()=>sL,EPSILON17:()=>iL,EPSILON18:()=>oL,EPSILON19:()=>cL,EPSILON2:()=>HC,EPSILON20:()=>aL,EPSILON3:()=>YC,EPSILON4:()=>WC,EPSILON5:()=>JC,EPSILON6:()=>jC,EPSILON7:()=>XC,EPSILON8:()=>KC,EPSILON9:()=>QC,PI_OVER_FOUR:()=>lL,PI_OVER_SIX:()=>fL,PI_OVER_TWO:()=>hL,TWO_PI:()=>pL});var kC=.1,HC=.01,YC=.001,WC=1e-4,JC=1e-5,jC=1e-6,XC=1e-7,KC=1e-8,QC=1e-9,ZC=1e-10,$C=1e-11,tL=1e-12,eL=1e-13,nL=1e-14,rL=1e-15,sL=1e-16,iL=1e-17,oL=1e-18,cL=1e-19,aL=1e-20,hL=Math.PI/2,lL=Math.PI/4,fL=Math.PI/6,pL=Math.PI*2;function go(e,t){t=t===void 0?e[0][0]:t;for(let n of e){let r=n[0]-t;r>180?n[0]-=360:r<-180&&(n[0]+=360)}}function uL(e,t,n){let[r,s]=(0,vs.cellToLatLng)(e),i=t.length;go(t,s);let o=t[0]===t[i-1]?i-1:i;for(let c=0;c<o;c++)t[c][0]=rn(s,t[c][0],n),t[c][1]=rn(r,t[c][1],n)}function Hu(e,t,n){let r=e(t,n),[s,i]=(0,vs.cellToLatLng)(r);return[i,s]}function Nh(e,t=1){let n=(0,vs.cellToBoundary)(e,!0);return t!==1?uL(e,n,t):go(n),n}function xo(e){let t=new Float64Array(e.length*2),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1];return t}var dL={getPentagon:{type:"accessor",value:e=>e.pentagon}},Fs=class extends Qt{indexToBounds(){let{data:t,getPentagon:n}=this.props;return{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(r,s)=>{let i=n(r,s),o=kp(typeof i=="string"?Hp(i):i);return o.push(o[0]),xo(o)}}}};Fs.layerName="A5Layer";Fs.defaultProps=dL;var Yu=Fs;var Wn=U(le(),1),dm=U(he(),1);function mL(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function Mo(e){if(Array.isArray(e))return e.map(t=>Mo(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[mL(n)]=Mo(r);return t}return e}var Sd=U(_d(),1);function kh(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,c)=>Boolean(t?.arrayPaths?.some(h=>i===h)),...t?._fastXML},r=Bw(e,n);return t?.uncapitalizeKeys?Mo(r):r}function Bw(e,t){return new Sd.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var Cw="4.2.1",fe={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:Cw,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:Lw,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>kh(new TextDecoder().decode(e),{...fe.options.xml,...t?.xml}),parseTextSync:(e,t)=>kh(e,{...fe.options.xml,...t?.xml})};function Lw(e){return e.startsWith("<?xml")}async function Xt(e,t,n,r){return r._parse(e,t,n,r)}function q(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Se={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ww=Se.self||Se.window||Se.global||{},Rw=Se.window||Se.self||Se.global||{},Iw=Se.global||Se.self||Se.window||{},bw=Se.document||{};var Gs=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Bd=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ow=Bd&&parseFloat(Bd[1])||0;var yo=globalThis,Pw=globalThis.document||{},Eo=globalThis.process||{},Nw=globalThis.console,t9=globalThis.navigator||{};function Cd(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,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function Gn(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Cd()}var Hh="4.1.0";function Fw(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var To=class{constructor(t,n,r="sessionStorage"){this.storage=Fw(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Ld(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 wd(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var _o;(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"})(_o||(_o={}));var Dw=10;function Rd(e){return typeof e!="string"?e:(e=e.toUpperCase(),_o[e]||_o.WHITE)}function Id(e,t,n){return!Gn&&typeof e=="string"&&(t&&(e=`\x1B[${Rd(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${Rd(n)+Dw}m${e}\x1B[49m`)),e}function bd(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(c=>i===c)||(s[i]=o.bind(e)))}}function zs(e,t){if(!e)throw new Error(t||"Assertion failed")}function zn(){let e;if(Gn()&&yo.performance)e=yo?.performance?.now?.();else if("hrtime"in Eo){let t=Eo?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Lr={debug:Gn()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Uw={enabled:!0,level:0};function wr(){}var Od={},Pd={once:!0},qs=class{constructor({id:t}={id:""}){this.VERSION=Hh,this._startTs=zn(),this._deltaTs=zn(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new To(`__probe-${this.id}__`,Uw),this.timeStamp(`${this.id} started`),bd(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((zn()-this._startTs).toPrecision(10))}getDelta(){return Number((zn()-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,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Lr.warn,arguments,Pd)}error(t){return this._getLogFunction(0,t,Lr.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,Lr.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,Lr.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,Lr.debug||Lr.info,arguments,Pd)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||wr,r&&[r],{tag:zw(n)}):wr}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||wr)}group(t,n,r={collapsed:!1}){let s=Nd({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||wr)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=vd(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=Nd({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,zs(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=zn();let o=i.tag||i.message;if(i.once&&o)if(!Od[o])Od[o]=zn();else return wr;return n=Gw(this.id,i.message,i),r.bind(console,n,...i.args)}return wr}};qs.VERSION=Hh;function vd(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 zs(Number.isFinite(t)&&t>=0),t}function Nd(e){let{logLevel:t,message:n}=e;e.logLevel=vd(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),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 zs(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function Gw(e,t,n){if(typeof t=="string"){let r=n.time?wd(Ld(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Id(t,n.color,n.background)}return t}function zw(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Yh=new qs({id:"@probe.gl/log"});function Wh(e,t){return Fd(e||{},t)}function Fd(e,t,n=0){if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=Fd(r[s]||{},t[s],n+1):r[s]=t[s];return r}function Jh(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function jh(e){return globalThis.loaders?.modules?.[e]||null}function qw(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var Dd=qw();function Ud(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Be={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},b9=Be.self||Be.window||Be.global||{},O9=Be.window||Be.self||Be.global||{},P9=Be.global||Be.self||Be.window||{},N9=Be.document||{};var Rr=typeof process!="object"||String(process)!=="[object process]"||process.browser,So=typeof importScripts=="function",v9=typeof window<"u"&&typeof window.orientation<"u",Gd=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),F9=Gd&&parseFloat(Gd[1])||0;var Xh={};async function Ce(e,t=null,n={},r=null){return t&&(e=zd(e,t,n,r)),Xh[e]=Xh[e]||Vw(e),await Xh[e]}function zd(e,t,n={},r=null){if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:Rr?n.CDN?(Ud(n.CDN.startsWith("http")),`${n.CDN}/${t}@${Dd}/dist/libs/${r}`):So?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function Vw(e){if(e.endsWith("wasm"))return await Hw(e);if(!Rr)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(e)}catch(n){return console.error(n),null}if(So)return importScripts(e);let t=await Yw(e);return kw(t,e)}function kw(e,t){if(!Rr){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(So)return eval.call(globalThis,e),null;let n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch{n.text=e}return document.body.appendChild(n),null}async function Hw(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Rr||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function Yw(e){let{readFileAsText:t}=globalThis.loaders||{};return Rr||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function Vd(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?qd(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?qd(e,0,t):""}function qd(e,t,n){if(e.byteLength<=t+n)return"";let r=new DataView(e),s="";for(let i=0;i<n;i++)s+=String.fromCharCode(r.getUint8(t+i));return s}function Kh(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Vd(e)}"`)}}function Vs(...e){let t=e,n=t&&t.length>1&&t[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let r=t.reduce((o,c)=>o+c.length,0),s=new n(r),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function qn(e,t,n){let r=n!==void 0?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function an(e,t){return q(e>=0),q(t>0),e+(t-1)&~(t-1)}function Qh(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(r,n),n+an(r.byteLength,4)}function ks(){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 Vn=class{constructor(t,n){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=n,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=ks(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(ks()-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 hn=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}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 n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof Vn?s=t:s=new Vn(n,r),this.stats[n]=s),s}};var Ww="Queued Requests",Jw="Active Requests",jw="Cancelled Requests",Xw="Queued Requests Ever",Kw="Active Requests Ever",Qw={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},ln=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...Qw,...t},this.stats=new hn({id:this.props.id}),this.stats.get(Ww),this.stats.get(Jw),this.stats.get(jw),this.stats.get(Xw),this.stats.get(Kw)}scheduleRequest(t,n=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_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 n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var fn={};Et(fn,{dirname:()=>$w,filename:()=>Zw,join:()=>tR,resolve:()=>eR});function kd(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function Zw(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function $w(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function tR(...e){let t="/";return e=e.map((n,r)=>(r&&(n=n.replace(new RegExp(`^${t}`),"")),r!==e.length-1&&(n=n.replace(new RegExp(`${t}$`),"")),n)),e.join(t)}function eR(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let n="",r=!1,s;for(let i=t.length-1;i>=-1&&!r;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=kd()),o=s),o.length!==0&&(n=`${o}/${n}`,r=o.charCodeAt(0)===Hs)}return n=nR(n,!r),r?`/${n}`:n.length>0?n:"."}var Hs=47,Zh=46;function nR(e,t){let n="",r=-1,s=0,i,o=!1;for(let c=0;c<=e.length;++c){if(c<e.length)i=e.charCodeAt(c);else{if(i===Hs)break;i=Hs}if(i===Hs){if(!(r===c-1||s===1))if(r!==c-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==Zh||n.charCodeAt(n.length-2)!==Zh){if(n.length>2){let a=n.length-1,h=a;for(;h>=0&&n.charCodeAt(h)!==Hs;--h);if(h!==a){n=h===-1?"":n.slice(0,h),r=c,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=c,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let a=e.slice(r+1,c);n.length>0?n+=`/${a}`:n=a,o=!1}r=c,s=0}else i===Zh&&s!==-1?++s:s=-1}return n}var Bo=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=rR(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function rR(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var te=class extends Bo{};xr(te,"type","template"),xr(te,"testURL",t=>!1);function Hd(e,t){let n=fe.parseTextSync?.(e,t),r=n?.ServiceExceptionReport?.ServiceException||n?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof r=="string"?r:r.value||r.code||"Unknown error"}var sR="4.2.1",Ys={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:sR,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:iR,options:{wms:{throwOnError:!1}},parse:async(e,t)=>$h(new TextDecoder().decode(e),t),parseSync:(e,t)=>$h(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>$h(e,t)};function iR(e){return e.startsWith("<?xml")}function $h(e,t){let n={...Ys.options.wms,...t?.wms},r=Hd(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function kn(e){return Array.isArray(e)?e:e?[e]:[]}function Ws(e){let t=kn(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function Js(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 Hn(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function tl(e,t){let n=fe.parseTextSync?.(e,t),r=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,s=oR(r);if(t?.inheritedLayerProps)for(let i of s.layers)Wd(i,null);return t?.includeRawJSON&&(s.json=r),t?.includeXMLText&&(s.xml=e),s}function oR(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:Ws(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:cR(e.Capability?.Request),exceptions:aR(e.Exception)},n=kn(e.Capability?.Layer);for(let r of n)t.layers.push(Yd(r));for(let[r,s]of Object.entries(t))s===void 0&&delete t[r];return t}function cR(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=Ws(r?.Format);t[n]={mimeTypes:s}}return t}function aR(e){if(kn(e?.Format).length>0)return{mimeTypes:Ws(e)}}function Yd(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Ws(e.KeywordList?.Keyword)},n=e?.CRS||e?.SRS;n&&Array.isArray(n)&&n.every(h=>typeof h=="string")&&(t.crs=n);let r=e?.EX_GeographicBoundingBox&&hR(e?.EX_GeographicBoundingBox);r&&(t.geographicBoundingBox=r),r=e?.LatLonBoundingBox&&lR(e?.LatLonBoundingBox),r&&(t.geographicBoundingBox=r);let s=e?.BoundingBox&&fR(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let o=kn(e?.Dimension).map(h=>uR(h));o.length&&(t.dimensions=o),e?.opaque&&(t.opaque=Hn(e?.opaque)),e?.cascaded&&(t.cascaded=Hn(e?.cascaded)),e?.queryable&&(t.queryable=Hn(e?.queryable));let c=kn(e?.Layer),a=[];for(let h of c)a.push(Yd(h));a.length>0&&(t.layers=a);for(let[h,l]of Object.entries(t))l===void 0&&delete t[h];return t}function hR(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function lR(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function fR(e){return kn(e).map(n=>pR(n))}function pR(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:c,resy:a}=e,h={crs:t||n,boundingBox:[[Js(r),Js(s)],[Js(i),Js(o)]]};return c&&(h.xResolution=c),a&&(h.yResolution=a),h}function uR(e){let{name:t,units:n,value:r}=e,s={name:t,units:n,extent:r};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=Hn(e.multipleValues)),e.nearestValue&&(s.nearestValue=Hn(e.nearestValue)),e.current&&(s.current=Hn(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 n of e.layers||[])Wd(n,e)}var dR="4.2.1",Ir={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:dR,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:mR,options:{wms:{}},parse:async(e,t)=>tl(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>tl(e,t?.wms)};function mR(e){return e.startsWith("<?xml")}function el(e,t){let r=(fe.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(r)?r:[r]).map(i=>gR(i))}}function gR(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var Jd={...Ir,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>el(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>el(e,t)};function nl(e,t){return fe.parseTextSync?.(e,t)}var jd={...Ir,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>nl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>nl(e,t)};function Xd(e,t){let{type:n="auto"}=e,r=n==="auto"?MR(e.url,t):xR(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function xR(e,t){for(let n of t)if(n.type===e)return n;return null}function MR(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var Kd="4.2.1";var AR=globalThis.loaders?.parseImageNode,rl=typeof Image<"u",sl=typeof ImageBitmap<"u",yR=Boolean(AR),il=Gs?!0:yR;function Qd(e){switch(e){case"auto":return sl||rl||il;case"imagebitmap":return sl;case"image":return rl;case"data":return il;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Zd(){if(sl)return"imagebitmap";if(rl)return"image";if(il)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function $d(e){let t=ER(e);if(!t)throw new Error("Not an image");return t}function js(e){switch($d(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function ER(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 TR=/^data:image\/svg\+xml/,_R=/\.svg((\?|#).*)?$/;function Lo(e){return e&&(TR.test(e)||_R.test(e))}function tm(e,t){if(Lo(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return ol(e,t)}function ol(e,t){if(Lo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function wo(e,t,n){let r=tm(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await SR(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function SR(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var BR={},em=!0;async function nm(e,t,n){let r;Lo(n)?r=await wo(e,t,n):r=ol(e,n);let s=t&&t.imagebitmap;return await CR(r,s)}async function CR(e,t=null){if((LR(t)||!em)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),em=!1}return await createImageBitmap(e)}function LR(e){for(let t in e||BR)return!1;return!0}function rm(e){return!bR(e,"ftyp",4)||!(e[8]&96)?null:wR(e)}function wR(e){switch(RR(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function RR(e,t,n){return String.fromCharCode(...e.slice(t,n))}function IR(e){return[...e].map(t=>t.charCodeAt(0))}function bR(e,t,n=0){let r=IR(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Le=!1,Xs=!0;function Yn(e){let t=Ks(e);return PR(t)||FR(t)||NR(t)||vR(t)||OR(t)}function OR(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=rm(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function PR(e){let t=Ks(e);return t.byteLength>=24&&t.getUint32(0,Le)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Le),height:t.getUint32(20,Le)}:null}function NR(e){let t=Ks(e);return t.byteLength>=10&&t.getUint32(0,Le)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Xs),height:t.getUint16(8,Xs)}:null}function vR(e){let t=Ks(e);return t.byteLength>=14&&t.getUint16(0,Le)===16973&&t.getUint32(2,Xs)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Xs),height:t.getUint32(22,Xs)}:null}function FR(e){let t=Ks(e);if(!(t.byteLength>=3&&t.getUint16(0,Le)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=DR(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Le);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Le),width:t.getUint16(i+7,Le)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Le)}return null}function DR(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Ks(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 sm(e,t){let{mimeType:n}=Yn(e)||{},r=globalThis.loaders?.parseImageNode;return q(r),await r(e,n)}async function im(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=UR(s),c;switch(o){case"imagebitmap":c=await nm(e,t,i);break;case"image":c=await wo(e,t,i);break;case"data":c=await sm(e,t);break;default:q(!1)}return s==="data"&&(c=js(c)),c}function UR(e){switch(e){case"auto":case"data":return Zd();default:return Qd(e),e}}var GR=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],zR=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],qR={image:{type:"auto",decode:!0}},pn={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Kd,mimeTypes:zR,extensions:GR,parse:im,tests:[e=>Boolean(Yn(new DataView(e)))],options:qR};var cl={};function al(e){if(cl[e]===void 0){let t=Gs?kR(e):VR(e);cl[e]=t}return cl[e]}function VR(e){let t=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||t,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(e)}function kR(e){switch(e){case"image/avif":case"image/webp":return HR(e);default:return!0}}function HR(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var om={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new hl(e)},hl=class extends te{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),this.url=t.url,this.data=t.url,this.substituteCRS84=t.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,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await Ir.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(t,n){let r=this.getMapURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await pn.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await Jd.parse(i,this.loadOptions)}async getFeatureInfoText(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(t,n){let r=this.describeLayerURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await jd.parse(i,this.loadOptions)}async getLegendGraphic(t,n){let r=this.getLegendGraphicURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await pn.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={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",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let{boundingBox:r,bbox:s}=t;t.bbox=r?[...r[0],...r[1]]:s;let i={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",i,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[c,a]=o.split("=");i[c]=a}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},c=["transparent","time","elevation"];for(let[a,h]of Object.entries(o))(!c.includes(a)||h)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(a,h,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;case"x":r.version==="1.3.0"&&(t="i");break;case"y":r.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Ys.mimeTypes.includes(r)){let s=Wh(this.loadOptions,{wms:{throwOnError:!0}}),i=Ys.parseSync?.(n,s);throw new Error(i)}}_parseError(t){let n=Ys.parseSync?.(t,this.loadOptions);return new Error(n)}};var br=class extends te{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await pn.parse(i)}getGranularParameters(t){let[[n,r],[s,i]]=t.boundingBox;return{...t,east:n,north:r,south:i,west:s}}getURLFromTemplate(t){let n=this.props.url;for(let[r,s]of Object.entries(t))n=n.replace(`\${${r}}`,String(s)),n=n.replace(`{${r}}`,String(s));return n}};xr(br,"type","template"),xr(br,"testURL",t=>t.toLowerCase().includes("{"));var ll=class extends br{data;constructor(t){super(t),this.data=t.url}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.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,c]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(c)?s+=`${o.toUpperCase()}=${c.join(",")}`:s+=`${o.toUpperCase()}=${c?String(c):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},cm={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new ll(e)};var YR=[om,cm];function fl(e){return Xd(e,YR)}function Ro(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var pe=Math.PI,fm=pe/4,am=pe/180,hm=180/pe,Io=512;function Ue(e){let[t,n]=e;Ro(Number.isFinite(t)),Ro(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*am,s=n*am,i=Io*(r+pe)/(2*pe),o=Io*(pe+Math.log(Math.tan(fm+s*.5)))/(2*pe);return[i,o]}function Ge(e){let[t,n]=e,r=t/Io*(2*pe)-pe,s=2*(Math.atan(Math.exp(n/Io*(2*pe)-pe))-fm);return[r*hm,s*hm]}var xV=Math.PI/180;var um=6378137*Math.PI;function pl(e){let t=Ue(e);return t[0]=(t[0]/256-1)*um,t[1]=(t[1]/256-1)*um,t}var cI={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)}},Or=class extends Wn.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:n,oldProps:r}){let{viewport:s}=this.context;t.dataChanged||n.serviceType!==r.serviceType?(this.state.imageSource=this._createImageSource(n),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,Wn._deepEqual)(n.layers,r.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:n,lastRequestParameters:r}=this.state;return n&&new dm.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?Wn.COORDINATE_SYSTEM.LNGLAT:Wn.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof te)return t.data;if(typeof t.data=="string")return fl({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 n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:c}=t,a=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=t.resolution?"EPSG:4326":"EPSG:3857");let l={width:o,height:c,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:h};if(h==="EPSG:3857"){let f=pl([i[0],i[1]]),p=pl([i[2],i[3]]);l.boundingBox=[f,p]}try{this.state.loadCounter++,this.props.onImageLoadStart(a);let f=await this.state.imageSource.getImage(l);this.state.lastRequestId<a&&(this.getCurrentLayer()?.props.onImageLoad(a),this.setState({image:f,bounds:i,lastRequestParameters:l,lastRequestId:a}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(a,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}};Or.layerName="WMSLayer";Or.defaultProps=cI;var mm=U(he(),1),aI={getHeight:{type:"accessor",value:0},greatCircle:!0},Qs=class extends mm.ArcLayer{};Qs.layerName="GreatCircleLayer";Qs.defaultProps=aI;var gm=Qs;var bo=U(ul(),1),hI=3,lI=30,fI=2*lI+1,Mm=180/Math.PI;function ym(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Am(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Em(e){return[Am(e[0]),Am(e[1])]}function Tm(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function _m([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Mm,r*Mm]}function Sm(e){let t=bo.default.fromString(e,!0,10).toString(2);for(;t.length<hI+fI;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=bo.default.fromString(r,!0,2).toString(10),c=bo.default.fromString(s,!0,2).toString(4);for(;c.length<i;)c="0"+c;return`${o}/${c}`}function pI(e,t,n,r){if(r===0){n===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 Bm(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let c=s-1;c>=0;c--){o=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,o-1);pI(f,i,h,l),i[0]+=f*h,i[1]+=f*l}if(n%2===1){let c=i[0];i[0]=i[1],i[1]=c}return{face:n,ij:i,level:o}}var Cm=U(ul(),1);function uI(e){let t=e.padEnd(16,"0");return Cm.default.fromString(t,16)}var dI=100;function mI({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(dI*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,c=0;for(let a=0;a<4;a++){let h=r[a].slice(0),l=r[a+1],f=(l[0]-h[0])/s,p=(l[1]-h[1])/s;for(let u=0;u<s;u++){h[0]+=f,h[1]+=p;let d=ym(t,n,h),g=Em(d),m=Tm(e,g),M=_m(m);Math.abs(M[1])>89.999&&(M[0]=c);let E=M[0]-c;M[0]+=E>180?-360:E<-180?360:0,i[o++]=M[0],i[o++]=M[1],c=M[0]}}return i[o++]=i[0],i[o++]=i[1],i}function gI(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=uI(e)}return Sm(e.toString())}function Lm(e){let t=gI(e),n=Bm(t);return mI(n)}var xI={getS2Token:{type:"accessor",value:e=>e.token}},$s=class extends Qt{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Lm(n(r,s))}}};$s.layerName="S2Layer";$s.defaultProps=xI;var wm=$s;var dl=512;function MI(e,t){let n=0,r=0,s=1<<e.length,i=s/dl;for(let o=0;o<e.length;o++){s>>=1;let c=parseInt(e[o]);c%2&&(n|=s),c>1&&(r|=s)}return[[n/i,dl-r/i],[(n+t)/i,dl-(r+t)/i]]}function Rm(e,t=1){let[n,r]=MI(e,t),[s,i]=Ge(n),[o,c]=Ge(r);return[o,i,o,c,s,c,s,i,o,i]}var AI={getQuadkey:{type:"accessor",value:e=>e.quadkey}},ti=class extends Qt{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>Rm(r(i,o),s),updateTriggers:{getPolygon:s}}}};ti.layerName="QuadkeyLayer";ti.defaultProps=AI;var Im=ti;var Uo=U(le(),1),jm=U(he(),1);var Jn=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:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:c,userData:a,zoom:h}=this,l=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,p=await n.scheduleRequest(this,g=>g.isSelected?1:-1);if(!p){this._isCancelled=!0;return}if(this._isCancelled){p.done();return}let u=null,d;try{u=await t({index:i,id:o,bbox:c,userData:a,zoom:h,signal:f})}catch(g){d=g||!0}finally{p.done()}if(l===this._loaderId){if(this._loader=void 0,this.content=u,this._isCancelled&&!u){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,d?s(d,this):r(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 ni=U(le(),1);var mt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var bm=new O,yI=new O,un=class{constructor(t=[0,0,0],n=[0,0,0],r){r=r||bm.copy(t).add(n).scale(.5),this.center=new O(r),this.halfDiagonal=new O(n).subtract(this.center),this.minimum=new O(t),this.maximum=new O(n)}clone(){return new un(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:n}=this,r=yI.from(t.normal),s=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),i=this.center.dot(r)+t.distance;return i-s>0?mt.INSIDE:i+s<0?mt.OUTSIDE:mt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=bm.from(t).subtract(this.center),{halfDiagonal:r}=this,s=0,i;return i=Math.abs(n.x)-r.x,i>0&&(s+=i*i),i=Math.abs(n.y)-r.y,i>0&&(s+=i*i),i=Math.abs(n.z)-r.z,i>0&&(s+=i*i),s}};var ei=new O,Om=new O,dn=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new O,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=ei.from(n),this.center=new O().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new dn(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=ei.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return Om.copy(o).scale((-r+a)/c).add(n),this.center.copy(Om),this.radius=a,this}expand(t){let r=ei.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Ps.getScaling(ei,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=ei.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?mt.OUTSIDE:i<r?mt.INTERSECTING:mt.INSIDE}};var EI=new O,TI=new O,Oo=new O,Po=new O,No=new O,_I=new O,SI=new O,ze={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},jn=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new O().from(t),this.halfAxes=new at(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new O(t).len(),new O(n).len(),new O(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new O(t).normalize(),i=new O(n).normalize(),o=new O(r).normalize();return new Br().fromMatrix3(new at([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Br(r),i=new at().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new O().from(t),this.halfAxes=i,this}clone(){return new jn(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new dn){let n=this.halfAxes,r=n.getColumn(0,Oo),s=n.getColumn(1,Po),i=n.getColumn(2,No),o=EI.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[ze.COLUMN0ROW0]+o*s[ze.COLUMN0ROW1]+c*s[ze.COLUMN0ROW2])+Math.abs(i*s[ze.COLUMN1ROW0]+o*s[ze.COLUMN1ROW1]+c*s[ze.COLUMN1ROW2])+Math.abs(i*s[ze.COLUMN2ROW0]+o*s[ze.COLUMN2ROW1]+c*s[ze.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?mt.OUTSIDE:h>=a?mt.INSIDE:mt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=TI.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Oo),i=r.getColumn(1,Po),o=r.getColumn(2,No),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,Oo),h=c.getColumn(1,Po),l=c.getColumn(2,No),f=_I.copy(a).add(h).add(l).add(o),p=SI.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Oo);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Po);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,No);return s.transformAsPoint(t),this.halfAxes=new at([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var Pm=new O,Nm=new O,ue=class{constructor(t=[0,0,1],n=0){this.normal=new O,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return _e(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=Pm.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),_e(Te(this.normal.len(),1)),this.distance=s,this}clone(){return new ue(this.normal,this.distance)}equals(t){return Te(this.distance,t.distance)&&Te(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=Nm.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=Pm.from(t),s=this.getPointDistance(r),i=Nm.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var vm=[new O([1,0,0]),new O([0,1,0]),new O([0,0,1])],Fm=new O,BI=new O,Vt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*vm.length;let n=t.center,r=t.radius,s=0;for(let i of vm){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new ue),c||(c=this.planes[s+1]=new ue);let a=Fm.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=Fm.copy(i).scale(r).add(n),l=BI.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=mt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case mt.OUTSIDE:return mt.OUTSIDE;case mt.INTERSECTING:n=mt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(_e(Number.isFinite(n),"parentPlaneMask is required."),n===Vt.MASK_OUTSIDE||n===Vt.MASK_INSIDE)return n;let r=Vt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===mt.OUTSIDE)return Vt.MASK_OUTSIDE;a===mt.INTERSECTING&&(r|=o)}return r}};Vt.MASK_OUTSIDE=4294967295;Vt.MASK_INSIDE=0;Vt.MASK_INDETERMINATE=2147483647;var Pk=new O,Nk=new O,vk=new O,Fk=new O,Dk=new O;var kk=new O,Hk=new O,Yk=new O,Wk=new O,Jk=new O,jk=new O,Xk=new O,Kk=new O,Qk=new O,Zk=new O,$k=new O,t7=new O;var we=new at,LI=new at,wI=new at,vo=new at,Dm=new at;function xl(e,t={}){let n=Cr.EPSILON20,r=10,s=0,i=0,o=LI,c=wI;o.identity(),c.copy(e);let a=n*RI(c);for(;i<r&&II(c)>a;)bI(c,vo),Dm.copy(vo).transpose(),c.multiplyRight(vo),c.multiplyLeft(Dm),o.multiplyRight(vo),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function RI(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var ml=[1,0,0],gl=[2,2,1];function II(e){let t=0;for(let n=0;n<3;++n){let r=e[we.getElementIndex(gl[n],ml[n])];t+=2*r*r}return Math.sqrt(t)}function bI(e,t){let n=Cr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[we.getElementIndex(gl[h],ml[h])]);l>r&&(s=h,r=l)}let i=ml[s],o=gl[s],c=1,a=0;if(Math.abs(e[we.getElementIndex(o,i)])>n){let h=e[we.getElementIndex(o,o)],l=e[we.getElementIndex(i,i)],f=e[we.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return at.IDENTITY.to(t),t[we.getElementIndex(i,i)]=t[we.getElementIndex(o,o)]=c,t[we.getElementIndex(o,i)]=a,t[we.getElementIndex(i,o)]=-a,t}var mn=new O,OI=new O,PI=new O,NI=new O,vI=new O,FI=new at,DI={diagonal:new at,unitary:new at};function Ml(e,t=new jn){if(!e||e.length===0)return t.halfAxes=new at([0,0,0,0,0,0,0,0,0]),t.center=new O,t;let n=e.length,r=new O(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=mn.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=FI;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=xl(f,DI),u=t.halfAxes.copy(p),d=u.getColumn(0,PI),g=u.getColumn(1,NI),m=u.getColumn(2,vI),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)mn.copy(S),M=Math.max(mn.dot(d),M),E=Math.max(mn.dot(g),E),A=Math.max(mn.dot(m),A),y=Math.min(mn.dot(d),y),T=Math.min(mn.dot(g),T),_=Math.min(mn.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=OI.set(M-y,E-T,A-_).multiplyByScalar(.5),B=new at([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(B),t}var Pr=512,Um=3,Gm=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],zm=Gm.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),UI=zm.concat([[.25,.5],[.75,.5]]),gn=class{constructor(t,n,r){this.x=t,this.y=n,this.z=r}get children(){if(!this._children){let t=this.x*2,n=this.y*2,r=this.z+1;this._children=[new gn(t,n,r),new gn(t,n+1,r),new gn(t+1,n,r),new gn(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:c,offset:a,project:h}=t,l=this.getBoundingVolume(s,a,h);if(c&&!this.insideBounds(c)||r.computeVisibility(l)<0)return!1;if(!this.childVisible){let{z:p}=this;if(p<o&&p>=i){let u=l.distanceTo(n.cameraPosition)*n.scale/n.height;p+=Math.floor(Math.log2(u))}if(p>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let p of this.children)p.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=Pr/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let a=this.z<1?UI:this.z<2?zm:Gm,h=[];for(let l of a){let f=Fo(this.x+l[0],this.y+l[1],this.z);f[2]=t[0],h.push(r(f)),t[0]!==t[1]&&(f[2]=t[1],h.push(r(f)))}return Ml(h)}let s=Math.pow(2,this.z),i=Pr/s,o=this.x*i+n*Pr,c=Pr-(this.y+1)*i;return new un([o,c,t[0]],[o+i,c+i,t[1]])}};function qm(e,t,n,r){let s=e instanceof ni._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:u,distance:d})=>new ue(u.clone().negate(),d)),o=new Vt(i),c=e.distanceScales.unitsPerMeter[2],a=n&&n[0]*c||0,h=n&&n[1]*c||0,l=e instanceof ni.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[u,d,g,m]=r,M=Ue([u,m]),E=Ue([g,d]);r=[M[0],Pr-M[1],E[0],Pr-E[1]]}let f=new gn(0,0,0),p={viewport:e,project:s,cullingVolume:o,elevationBounds:[a,h],minZ:l,maxZ:t,bounds:r,offset:0};if(f.update(p),e instanceof ni.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(p.offset=-1;f.update(p)&&!(--p.offset<-Um););for(p.offset=1;f.update(p)&&!(++p.offset>Um););}return f.getSelected()}var qe=512,GI=[-1/0,-1/0,1/0,1/0],xn={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(n=>typeof n=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}};function km(e,t){let n=[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(...n.map(s=>s[0])),Math.min(...n.map(s=>s[1])),Math.max(...n.map(s=>s[0])),Math.max(...n.map(s=>s[1]))]}function zI(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function Re(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=zI(r)%e.length;e=e[i]}let s=e;for(let i of Object.keys(n)){let o=new RegExp(`{${i}}`,"g");s=s.replace(o,String(n[i]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),s}function qI(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),c=e.getBounds({z:i});r=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function Hm({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>Al(s,t||0,n))}function Al(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:c,height:a}=n,h={targetZ:t},l=e.unproject([i,o],h),f=e.unproject([i+c,o],h),p=e.unproject([i,o+a],h),u=e.unproject([i+c,o+a],h);return[Math.min(l[0],f[0],p[0],u[0]),Math.min(l[1],f[1],p[1],u[1]),Math.max(l[0],f[0],p[0],u[0]),Math.max(l[1],f[1],p[1],u[1])]}let r=Al(e,t[0],n),s=Al(e,t[1],n);return[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]}function VI(e,t,n){return n?km(e,n).map(s=>s*t/qe):e.map(r=>r*t/qe)}function yl(e,t){return Math.pow(2,e)*qe/t}function Fo(e,t,n){let r=yl(n,qe),s=e/r*360-180,i=Math.PI-2*Math.PI*t/r,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function Vm(e,t,n,r){let s=yl(n,r);return[e/s*qe,t/s*qe]}function El(e,t,n,r,s=qe){if(e.isGeospatial){let[h,l]=Fo(t,n,r),[f,p]=Fo(t+1,n+1,r);return{west:h,north:l,east:f,south:p}}let[i,o]=Vm(t,n,r,s),[c,a]=Vm(t+1,n+1,r,s);return{left:i,top:o,right:c,bottom:a}}function kI(e,t,n,r,s){let i=qI(e,null,r),o=yl(t,n),[c,a,h,l]=VI(i,o,s),f=[];for(let p=Math.floor(c);p<h;p++)for(let u=Math.floor(a);u<l;u++)f.push({x:p,y:u,z:t});return f}function Tl({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=qe,modelMatrix:o,modelMatrixInverse:c,zoomOffset:a=0}){let h=e.isGeospatial?Math.round(e.zoom+Math.log2(qe/i))+a:Math.ceil(e.zoom)+a;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!s)return[];h=n}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let l=s;return o&&c&&s&&!e.isGeospatial&&(l=km(s,o)),e.isGeospatial?qm(e,h,r,s):kI(e,h,i,l||GI,c)}function _l(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Sl(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function Ym(e){let t={},n;return r=>{for(let s in r)if(!HI(r[s],t[s])){n=e(r),t=r;break}return n}}function HI(e,t){if(e===t)return!0;if(Array.isArray(e)){let n=e.length;if(!t||t.length!==n)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}return!1}var Wm=1,Do=2,YI="never",WI="no-overlap",ri="best-available",JI=5,jI={[ri]:KI,[WI]:QI,[YI]:()=>{}},XI={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:()=>{}},Xn=class{constructor(t){this._getCullBounds=Ym(Hm),this.opts={...XI,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new ln({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 jt,this._modelMatrixInverse=new jt}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 n=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(t):n.setNeedsReload()}}update(t,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){let s=r?new jt(r):new jt,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!Te(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(a=>this._getTile(a,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){if(!t.isVisible)return!1;if(n&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:s}=t;for(let[i,o,c,a]of r){let h;if("west"in s)h=s.west<c&&s.east>i&&s.south<a&&s.north>o;else{let l=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);h=s.left<c&&s.right>i&&l<a&&f>o}if(h)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:c,extent:a,zoomOffset:h}=this.opts;return Tl({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:c,extent:a,modelMatrix:i,modelMatrixInverse:o,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:El(this._viewport,t.x,t.y,t.z,n)}}getParentIndex(t){let n=Math.floor(t.x/2),r=Math.floor(t.y/2),s=t.z-1;return{x:n,y:r,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||ri,n=new Array(this._cache.size),r=0;for(let s of this._cache.values())n[r++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:jI[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!==null?1/0:JI*this.selectedTiles.length),s=n.maxCacheByteSize??1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,c]of t)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!==null?c.byteLength:0,t.delete(o),this.opts.onTileUnload?.(c)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Jn(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:r,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(r,s),this._dirty=!0):s&&s.needsReload&&(i=!0),s&&i&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:n=0}=this,r=t.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);let s=this._getTile(r);if(s)return s}return null}};function KI(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!Jm(t)&&Bl(t);for(let t of e)t.isVisible=Boolean(t.state&Do)}function QI(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&Jm(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&Do),n.children&&(n.isVisible||n.state&Wm))for(let r of n.children)r.state=Wm;else n.isSelected&&Bl(n)}function Jm(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Do,!0;t=t.parent}return!1}function Bl(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Do:Bl(t)}var ZI={TilesetClass:Xn,data:{type:"data",value:[]},dataComparator:xn.equal,renderSubLayers:{type:"function",value:e=>new jm.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:ri,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},si=class extends Uo.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(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:c,maxRequests:a,debounceTime:h,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:i,maxRequests:a,debounceTime:h,zoomOffset:l,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:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,c=this.state.frameNumber!==s;i&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?Re(n,t):null,r?r(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let n=t.sourceLayer,r=n.props.tile,s=t.info;return s.picked&&(s.tile=r),s.sourceTile=r,s.sourceTileSubLayer=n,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,Uo._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props;return this.state.tileset.isTileVisible(r,n)}};si.defaultProps=ZI;si.layerName="TileLayer";var Kn=si;var Qm=U(he(),1);var Xm=`uniform tripsUniforms {
13
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}sn.prototype.build=function(e){return this.options.preserveOrder?NR(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};sn.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="",c="";for(let a=0;a<i;a++){let h=e[s][a];if(!(typeof h>"u"))if(h===null)s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){let l=this.j2x(h,t+1);o+=l.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=l.attrStr)}else o+=this.processTextOrObjNode(h,s,t);else if(this.options.oneListGroup){let l=this.options.tagValueProcessor(s,h);l=this.replaceEntitiesValue(l),o+=l}else o+=this.buildTextValNode(h,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,c,t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let c=0;c<o;c++)n+=this.buildAttrPairStr(i[c],""+e[s][i[c]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};sn.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 DR(e,t,n){let r=this.j2x(e,n+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}sn.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",s=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+s}};sn.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};sn.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}};sn.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function UR(e){return this.options.indentBy.repeat(e)}function GR(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}vd.exports=sn});var Dd=ct((T9,Fd)=>{"use strict";var zR=Wh(),VR=Rd(),qR=Nd();Fd.exports={XMLParser:VR,XMLValidator:zR,XMLBuilder:qR}});var _l=ct((Im,ei)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof j1=="function"&&typeof ei=="object"&&ei&&ei.exports?ei.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Im,function(){"use strict";function e(S,x,R){this.low=S|0,this.high=x|0,this.unsigned=!!R}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(S){return(S&&S.__isLong__)===!0}e.isLong=t;var n={},r={};function s(S,x){var R,b,w;return x?(S>>>=0,(w=0<=S&&S<256)&&(b=r[S],b)?b:(R=o(S,(S|0)<0?-1:0,!0),w&&(r[S]=R),R)):(S|=0,(w=-128<=S&&S<128)&&(b=n[S],b)?b:(R=o(S,S<0?-1:0,!1),w&&(n[S]=R),R))}e.fromInt=s;function i(S,x){if(isNaN(S)||!isFinite(S))return x?M:m;if(x){if(S<0)return M;if(S>=u)return _}else{if(S<=-d)return L;if(S+1>=d)return T}return S<0?i(-S,x).neg():o(S%p|0,S/p|0,x)}e.fromNumber=i;function o(S,x,R){return new e(S,x,R)}e.fromBits=o;var c=Math.pow;function a(S,x,R){if(S.length===0)throw Error("empty string");if(S==="NaN"||S==="Infinity"||S==="+Infinity"||S==="-Infinity")return m;if(typeof x=="number"?(R=x,x=!1):x=!!x,R=R||10,R<2||36<R)throw RangeError("radix");var b;if((b=S.indexOf("-"))>0)throw Error("interior hyphen");if(b===0)return a(S.substring(1),x,R).neg();for(var w=i(c(R,8)),B=m,v=0;v<S.length;v+=8){var H=Math.min(8,S.length-v),V=parseInt(S.substring(v,v+H),R);if(H<8){var tt=i(c(R,H));B=B.mul(tt).add(i(V))}else B=B.mul(w),B=B.add(i(V))}return B.unsigned=x,B}e.fromString=a;function h(S){return S instanceof e?S:typeof S=="number"?i(S):typeof S=="string"?a(S):o(S.low,S.high,S.unsigned)}e.fromValue=h;var l=1<<16,f=1<<24,p=l*l,u=p*p,d=u/2,g=s(f),m=s(0);e.ZERO=m;var M=s(0,!0);e.UZERO=M;var E=s(1);e.ONE=E;var A=s(1,!0);e.UONE=A;var y=s(-1);e.NEG_ONE=y;var T=o(-1,2147483647,!1);e.MAX_VALUE=T;var _=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var L=o(0,-2147483648,!1);e.MIN_VALUE=L;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},C.toString=function(x){if(x=x||10,x<2||36<x)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(L)){var R=i(x),b=this.div(R),w=b.mul(R).sub(this);return b.toString(x)+w.toInt().toString(x)}else return"-"+this.neg().toString(x);for(var B=i(c(x,6),this.unsigned),v=this,H="";;){var V=v.div(B),tt=v.sub(V.mul(B)).toInt()>>>0,Y=tt.toString(x);if(v=V,v.isZero())return Y+H;for(;Y.length<6;)Y="0"+Y;H=""+Y+H}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(L)?64:this.neg().getNumBitsAbs();for(var x=this.high!=0?this.high:this.low,R=31;R>0&&!(x&1<<R);R--);return this.high!=0?R+33:R+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(x){return t(x)||(x=h(x)),this.unsigned!==x.unsigned&&this.high>>>31===1&&x.high>>>31===1?!1:this.high===x.high&&this.low===x.low},C.eq=C.equals,C.notEquals=function(x){return!this.eq(x)},C.neq=C.notEquals,C.lessThan=function(x){return this.comp(x)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(x){return this.comp(x)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(x){return this.comp(x)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(x){return this.comp(x)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(x){if(t(x)||(x=h(x)),this.eq(x))return 0;var R=this.isNegative(),b=x.isNegative();return R&&!b?-1:!R&&b?1:this.unsigned?x.high>>>0>this.high>>>0||x.high===this.high&&x.low>>>0>this.low>>>0?-1:1:this.sub(x).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(L)?L:this.not().add(E)},C.neg=C.negate,C.add=function(x){t(x)||(x=h(x));var R=this.high>>>16,b=this.high&65535,w=this.low>>>16,B=this.low&65535,v=x.high>>>16,H=x.high&65535,V=x.low>>>16,tt=x.low&65535,Y=0,et=0,ot=0,kt=0;return kt+=B+tt,ot+=kt>>>16,kt&=65535,ot+=w+V,et+=ot>>>16,ot&=65535,et+=b+H,Y+=et>>>16,et&=65535,Y+=R+v,Y&=65535,o(ot<<16|kt,Y<<16|et,this.unsigned)},C.subtract=function(x){return t(x)||(x=h(x)),this.add(x.neg())},C.sub=C.subtract,C.multiply=function(x){if(this.isZero()||(t(x)||(x=h(x)),x.isZero()))return m;if(this.eq(L))return x.isOdd()?L:m;if(x.eq(L))return this.isOdd()?L:m;if(this.isNegative())return x.isNegative()?this.neg().mul(x.neg()):this.neg().mul(x).neg();if(x.isNegative())return this.mul(x.neg()).neg();if(this.lt(g)&&x.lt(g))return i(this.toNumber()*x.toNumber(),this.unsigned);var R=this.high>>>16,b=this.high&65535,w=this.low>>>16,B=this.low&65535,v=x.high>>>16,H=x.high&65535,V=x.low>>>16,tt=x.low&65535,Y=0,et=0,ot=0,kt=0;return kt+=B*tt,ot+=kt>>>16,kt&=65535,ot+=w*tt,et+=ot>>>16,ot&=65535,ot+=B*V,et+=ot>>>16,ot&=65535,et+=b*tt,Y+=et>>>16,et&=65535,et+=w*V,Y+=et>>>16,et&=65535,et+=B*H,Y+=et>>>16,et&=65535,Y+=R*tt+b*V+w*H+B*v,Y&=65535,o(ot<<16|kt,Y<<16|et,this.unsigned)},C.mul=C.multiply,C.divide=function(x){if(t(x)||(x=h(x)),x.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?M:m;var R,b,w;if(this.unsigned){if(x.unsigned||(x=x.toUnsigned()),x.gt(this))return M;if(x.gt(this.shru(1)))return A;w=M}else{if(this.eq(L)){if(x.eq(E)||x.eq(y))return L;if(x.eq(L))return E;var B=this.shr(1);return R=B.div(x).shl(1),R.eq(m)?x.isNegative()?E:y:(b=this.sub(x.mul(R)),w=R.add(b.div(x)),w)}else if(x.eq(L))return this.unsigned?M:m;if(this.isNegative())return x.isNegative()?this.neg().div(x.neg()):this.neg().div(x).neg();if(x.isNegative())return this.div(x.neg()).neg();w=m}for(b=this;b.gte(x);){R=Math.max(1,Math.floor(b.toNumber()/x.toNumber()));for(var v=Math.ceil(Math.log(R)/Math.LN2),H=v<=48?1:c(2,v-48),V=i(R),tt=V.mul(x);tt.isNegative()||tt.gt(b);)R-=H,V=i(R,this.unsigned),tt=V.mul(x);V.isZero()&&(V=E),w=w.add(V),b=b.sub(tt)}return w},C.div=C.divide,C.modulo=function(x){return t(x)||(x=h(x)),this.sub(this.div(x).mul(x))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(x){return t(x)||(x=h(x)),o(this.low&x.low,this.high&x.high,this.unsigned)},C.or=function(x){return t(x)||(x=h(x)),o(this.low|x.low,this.high|x.high,this.unsigned)},C.xor=function(x){return t(x)||(x=h(x)),o(this.low^x.low,this.high^x.high,this.unsigned)},C.shiftLeft=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low<<x,this.high<<x|this.low>>>32-x,this.unsigned):o(0,this.low<<x-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(x){return t(x)&&(x=x.toInt()),(x&=63)===0?this:x<32?o(this.low>>>x|this.high<<32-x,this.high>>x,this.unsigned):o(this.high>>x-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(x){if(t(x)&&(x=x.toInt()),x&=63,x===0)return this;var R=this.high;if(x<32){var b=this.low;return o(b>>>x|R<<32-x,R>>>x,this.unsigned)}else return x===32?o(R,0,this.unsigned):o(R>>>x-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(S){return S?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var S=this.high,x=this.low;return[x&255,x>>>8&255,x>>>16&255,x>>>24&255,S&255,S>>>8&255,S>>>16&255,S>>>24&255]},C.toBytesBE=function(){var S=this.high,x=this.low;return[S>>>24&255,S>>>16&255,S>>>8&255,S&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255]},e})});var Fl=ct((bH,gg)=>{gg.exports=globalThis.luma});var Jo=ct((wH,xg)=>{xg.exports=globalThis.deck});var kl=ct(($H,vg)=>{vg.exports=globalThis.luma});var Fr=ct((bY,Zg)=>{Zg.exports=globalThis.loaders});var HE=ct((Dot,kE)=>{kE.exports=globalThis.deck});var tT=ct(N1=>{N1.read=function(e,t,n,r,s){var i,o,c=s*8-r-1,a=(1<<c)-1,h=a>>1,l=-7,f=n?s-1:0,p=n?-1:1,u=e[t+f];for(f+=p,i=u&(1<<-l)-1,u>>=-l,l+=c;l>0;i=i*256+e[t+f],f+=p,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=r;l>0;o=o*256+e[t+f],f+=p,l-=8);if(i===0)i=1-h;else{if(i===a)return o?NaN:(u?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-h}return(u?-1:1)*o*Math.pow(2,i-r)};N1.write=function(e,t,n,r,s,i){var o,c,a,h=i*8-s-1,l=(1<<h)-1,f=l>>1,p=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:i-1,d=r?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+f>=1?t+=p/a:t+=p*Math.pow(2,1-f),t*a>=2&&(o++,a/=2),o+f>=l?(c=0,o=l):o+f>=1?(c=(t*a-1)*Math.pow(2,s),o=o+f):(c=t*Math.pow(2,f-1)*Math.pow(2,s),o=0));s>=8;e[n+u]=c&255,u+=d,c/=256,s-=8);for(o=o<<s|c,h+=s;h>0;e[n+u]=o&255,u+=d,o/=256,h-=8);e[n+u-d]|=g*128}});var oT=ct((Sct,iT)=>{"use strict";iT.exports=Q;var ka=tT();function Q(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Q.Varint=0;Q.Fixed64=1;Q.Bytes=2;Q.Fixed32=5;var F1=(1<<16)*(1<<16),eT=1/F1,a6=12,sT=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Q.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),s=r>>3,i=this.pos;this.type=r&7,e(s,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ha(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=rT(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ha(this.buf,this.pos)+Ha(this.buf,this.pos+4)*F1;return this.pos+=8,e},readSFixed64:function(){var e=Ha(this.buf,this.pos)+rT(this.buf,this.pos+4)*F1;return this.pos+=8,e},readFloat:function(){var e=ka.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ka.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,h6(n,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>=a6&&sT?_6(this.buf,t,e):T6(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!==Q.Bytes)return e.push(this.readVarint(t));var n=$e(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==Q.Bytes)return e.push(this.readSVarint());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==Q.Bytes)return e.push(this.readBoolean());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==Q.Bytes)return e.push(this.readFloat());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==Q.Bytes)return e.push(this.readDouble());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==Q.Bytes)return e.push(this.readFixed32());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==Q.Bytes)return e.push(this.readSFixed32());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==Q.Bytes)return e.push(this.readFixed64());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==Q.Bytes)return e.push(this.readSFixed64());var t=$e(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===Q.Varint)for(;this.buf[this.pos++]>127;);else if(t===Q.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Q.Fixed32)this.pos+=4;else if(t===Q.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 n=new Uint8Array(t);n.set(this.buf),this.buf=n,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),Bs(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Bs(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Bs(this.buf,e&-1,this.pos),Bs(this.buf,Math.floor(e*eT),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Bs(this.buf,e&-1,this.pos),Bs(this.buf,Math.floor(e*eT),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){l6(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=S6(this.buf,e,this.pos);var n=this.pos-t;n>=128&&nT(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),ka.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ka.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 n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&nT(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,Q.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,u6,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,d6,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,x6,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,m6,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,g6,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,M6,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,A6,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,y6,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,E6,t)},writeBytesField:function(e,t){this.writeTag(e,Q.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Q.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Q.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Q.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Q.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Q.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Q.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Q.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Q.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Q.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function h6(e,t,n){var r=n.buf,s,i;if(i=r[n.pos++],s=(i&112)>>4,i<128||(i=r[n.pos++],s|=(i&127)<<3,i<128)||(i=r[n.pos++],s|=(i&127)<<10,i<128)||(i=r[n.pos++],s|=(i&127)<<17,i<128)||(i=r[n.pos++],s|=(i&127)<<24,i<128)||(i=r[n.pos++],s|=(i&1)<<31,i<128))return Cs(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function $e(e){return e.type===Q.Bytes?e.readVarint()+e.pos:e.pos+1}function Cs(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function l6(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),f6(n,r,t),p6(r,t)}function f6(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function p6(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((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 nT(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var s=n.pos-1;s>=e;s--)n.buf[s+r]=n.buf[s]}function u6(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function d6(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function m6(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function g6(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function x6(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function M6(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function A6(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function y6(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function E6(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ha(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Bs(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function rT(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function T6(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,c=i>239?4:i>223?3:i>191?2:1;if(s+c>n)break;var a,h,l;c===1?i<128&&(o=i):c===2?(a=e[s+1],(a&192)===128&&(o=(i&31)<<6|a&63,o<=127&&(o=null))):c===3?(a=e[s+1],h=e[s+2],(a&192)===128&&(h&192)===128&&(o=(i&15)<<12|(a&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):c===4&&(a=e[s+1],h=e[s+2],l=e[s+3],(a&192)===128&&(h&192)===128&&(l&192)===128&&(o=(i&15)<<18|(a&63)<<12|(h&63)<<6|l&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,c=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=c}return r}function _6(e,t,n){return sT.decode(e.subarray(t,n))}function S6(e,t,n){for(var r=0,s,i;r<t.length;r++){if(s=t.charCodeAt(r),s>55295&&s<57344)if(i)if(s<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=s;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);s<128?e[n++]=s:(s<2048?e[n++]=s>>6|192:(s<65536?e[n++]=s>>12|224:(e[n++]=s>>18|240,e[n++]=s>>12&63|128),e[n++]=s>>6&63|128),e[n++]=s&63|128)}return n}});var Xi={};Tt(Xi,{A5Layer:()=>id,GeohashLayer:()=>LT,GreatCircleLayer:()=>wm,H3ClusterLayer:()=>mg,H3HexagonLayer:()=>Wo,MVTLayer:()=>_T,QuadkeyLayer:()=>Hm,S2Layer:()=>qm,TerrainLayer:()=>qE,Tile3DLayer:()=>vE,TileLayer:()=>Xn,TripsLayer:()=>pg,_GeoCellLayer:()=>$t,_Tile2DHeader:()=>Wn,_Tileset2D:()=>jn,_WMSLayer:()=>vr,_getURLFromTemplate:()=>we});var ye={},K1=G(he(),1);tn(ye,G(he(),1));if(!K1.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");tn(Xi,ye);var Z1=G(le(),1),$a=G(he(),1),DT={...$a.PolygonLayer.defaultProps},bs=class extends Z1.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m}=this.props,{updateTriggers:M,material:E,transitions:A}=this.props,y=this.getSubLayerClass("cell",$a.PolygonLayer),{updateTriggers:T,..._}=this.indexToBounds()||{};return new y({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:c,lineWidthMinPixels:a,lineWidthMaxPixels:h,lineJointRounded:l,lineMiterLimit:f,lineDashJustified:p,material:E,transitions:A,getElevation:u,getFillColor:d,getLineColor:g,getLineWidth:m},this.getSubLayerProps({id:"cell",updateTriggers:M&&{...T,getElevation:M.getElevation,getFillColor:M.getFillColor,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}),_)}};bs.layerName="GeoCellLayer";bs.defaultProps=DT;var $t=bs;var UT=Object.defineProperty,vs=(e,t)=>{for(var n in t)UT(e,n,{get:t[n],enumerable:!0})},Ht={};vs(Ht,{ARRAY_TYPE:()=>ut,EPSILON:()=>Rt,RANDOM:()=>On,equals:()=>qT,setMatrixArrayType:()=>GT,toRadian:()=>VT});var Rt=1e-6,ut=typeof Float32Array<"u"?Float32Array:Array,On=Math.random;function GT(e){ut=e}var zT=Math.PI/180;function VT(e){return e*zT}function qT(e,t){return Math.abs(e-t)<=Rt*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 Nn={};vs(Nn,{LDU:()=>i_,add:()=>o_,adjoint:()=>QT,clone:()=>HT,copy:()=>YT,create:()=>kT,determinant:()=>ZT,equals:()=>a_,exactEquals:()=>c_,frob:()=>s_,fromRotation:()=>e_,fromScaling:()=>n_,fromValues:()=>JT,identity:()=>WT,invert:()=>KT,mul:()=>f_,multiply:()=>dp,multiplyScalar:()=>h_,multiplyScalarAndAdd:()=>l_,rotate:()=>$T,scale:()=>t_,set:()=>jT,str:()=>r_,sub:()=>p_,subtract:()=>mp,transpose:()=>XT});function kT(){var e=new ut(4);return ut!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function HT(e){var t=new ut(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function YT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function WT(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function JT(e,t,n,r){var s=new ut(4);return s[0]=e,s[1]=t,s[2]=n,s[3]=r,s}function jT(e,t,n,r,s){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e}function XT(e,t){if(e===t){var n=t[1];e[1]=t[2],e[2]=n}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function KT(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*i-s*r;return o?(o=1/o,e[0]=i*o,e[1]=-r*o,e[2]=-s*o,e[3]=n*o,e):null}function QT(e,t){var n=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=n,e}function ZT(e){return e[0]*e[3]-e[2]*e[1]}function dp(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*c+i*a,e[1]=s*c+o*a,e[2]=r*h+i*l,e[3]=s*h+o*l,e}function $T(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+i*c,e[1]=s*a+o*c,e[2]=r*-c+i*a,e[3]=s*-c+o*a,e}function t_(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1];return e[0]=r*c,e[1]=s*c,e[2]=i*a,e[3]=o*a,e}function e_(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=-n,e[3]=r,e}function n_(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function r_(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function s_(e){return Math.hypot(e[0],e[1],e[2],e[3])}function i_(e,t,n,r){return e[2]=r[2]/r[0],n[0]=r[0],n[1]=r[1],n[3]=r[3]-e[2]*n[1],[e,t,n]}function o_(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function mp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e}function c_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function a_(e,t){var n=e[0],r=e[1],s=e[2],i=e[3],o=t[0],c=t[1],a=t[2],h=t[3];return Math.abs(n-o)<=Rt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-c)<=Rt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-a)<=Rt*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-h)<=Rt*Math.max(1,Math.abs(i),Math.abs(h))}function h_(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function l_(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e}var f_=dp,p_=mp;function u_(){var e=new ut(9);return ut!=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 Ps={};vs(Ps,{add:()=>BS,calculateW:()=>mS,clone:()=>TS,conjugate:()=>AS,copy:()=>SS,create:()=>sh,dot:()=>Ip,equals:()=>PS,exactEquals:()=>IS,exp:()=>Lp,fromEuler:()=>yS,fromMat3:()=>bp,fromValues:()=>_S,getAngle:()=>fS,getAxisAngle:()=>lS,identity:()=>hS,invert:()=>MS,len:()=>bS,length:()=>Pp,lerp:()=>RS,ln:()=>Rp,mul:()=>LS,multiply:()=>Bp,normalize:()=>uh,pow:()=>gS,random:()=>xS,rotateX:()=>pS,rotateY:()=>uS,rotateZ:()=>dS,rotationTo:()=>OS,scale:()=>wp,set:()=>CS,setAxes:()=>NS,setAxisAngle:()=>Cp,slerp:()=>so,sqlerp:()=>vS,sqrLen:()=>wS,squaredLength:()=>Op,str:()=>ES});var P={};vs(P,{add:()=>x_,angle:()=>D_,bezier:()=>b_,ceil:()=>M_,clone:()=>d_,copy:()=>m_,create:()=>fh,cross:()=>ro,dist:()=>Y_,distance:()=>yp,div:()=>H_,divide:()=>Ap,dot:()=>ph,equals:()=>V_,exactEquals:()=>z_,floor:()=>A_,forEach:()=>j_,fromValues:()=>rh,hermite:()=>R_,inverse:()=>B_,len:()=>Sp,length:()=>gp,lerp:()=>L_,max:()=>E_,min:()=>y_,mul:()=>k_,multiply:()=>Mp,negate:()=>C_,normalize:()=>_p,random:()=>w_,rotateX:()=>v_,rotateY:()=>N_,rotateZ:()=>F_,round:()=>T_,scale:()=>__,scaleAndAdd:()=>S_,set:()=>g_,sqrDist:()=>W_,sqrLen:()=>J_,squaredDistance:()=>Ep,squaredLength:()=>Tp,str:()=>G_,sub:()=>q_,subtract:()=>xp,transformMat3:()=>P_,transformMat4:()=>I_,transformQuat:()=>O_,zero:()=>U_});function fh(){var e=new ut(3);return ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function d_(e){var t=new ut(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function gp(e){var t=e[0],n=e[1],r=e[2];return Math.hypot(t,n,r)}function rh(e,t,n){var r=new ut(3);return r[0]=e,r[1]=t,r[2]=n,r}function m_(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function g_(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function x_(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function xp(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Mp(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function Ap(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function M_(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function A_(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function y_(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function E_(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function T_(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function __(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function S_(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function yp(e,t){var n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.hypot(n,r,s)}function Ep(e,t){var n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function Tp(e){var t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function C_(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function B_(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function _p(e,t){var n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function ph(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ro(e,t,n){var r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function L_(e,t,n,r){var s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function R_(e,t,n,r,s,i){var o=i*i,c=o*(2*i-3)+1,a=o*(i-2)+i,h=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*c+n[0]*a+r[0]*h+s[0]*l,e[1]=t[1]*c+n[1]*a+r[1]*h+s[1]*l,e[2]=t[2]*c+n[2]*a+r[2]*h+s[2]*l,e}function b_(e,t,n,r,s,i){var o=1-i,c=o*o,a=i*i,h=c*o,l=3*i*c,f=3*a*o,p=a*i;return e[0]=t[0]*h+n[0]*l+r[0]*f+s[0]*p,e[1]=t[1]*h+n[1]*l+r[1]*f+s[1]*p,e[2]=t[2]*h+n[2]*l+r[2]*f+s[2]*p,e}function w_(e,t){t=t||1;var n=On()*2*Math.PI,r=On()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function I_(e,t,n){var r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function P_(e,t,n){var r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function O_(e,t,n){var r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function v_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function N_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function F_(e,t,n,r){var s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function D_(e,t){var n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt(n*n+r*r+s*s),h=Math.sqrt(i*i+o*o+c*c),l=a*h,f=l&&ph(e,t)/l;return Math.acos(Math.min(Math.max(f,-1),1))}function U_(e){return e[0]=0,e[1]=0,e[2]=0,e}function G_(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function z_(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function V_(e,t){var n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2];return Math.abs(n-i)<=Rt*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=Rt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-c)<=Rt*Math.max(1,Math.abs(s),Math.abs(c))}var q_=xp,k_=Mp,H_=Ap,Y_=yp,W_=Ep,Sp=gp,J_=Tp,j_=function(){var e=fh();return function(t,n,r,s,i,o){var c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();function X_(){var e=new ut(4);return ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function K_(e){var t=new ut(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Q_(e,t,n,r){var s=new ut(4);return s[0]=e,s[1]=t,s[2]=n,s[3]=r,s}function Z_(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function $_(e,t,n,r,s){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e}function tS(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function eS(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function nS(e){var t=e[0],n=e[1],r=e[2],s=e[3];return Math.hypot(t,n,r,s)}function rS(e){var t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function sS(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function iS(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function oS(e,t,n,r){var s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function cS(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function aS(e,t){var n=e[0],r=e[1],s=e[2],i=e[3],o=t[0],c=t[1],a=t[2],h=t[3];return Math.abs(n-o)<=Rt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-c)<=Rt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(s-a)<=Rt*Math.max(1,Math.abs(s),Math.abs(a))&&Math.abs(i-h)<=Rt*Math.max(1,Math.abs(i),Math.abs(h))}var hU=function(){var e=X_();return function(t,n,r,s,i,o){var c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();function sh(){var e=new ut(4);return ut!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function hS(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Cp(e,t,n){n=n*.5;var r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function lS(e,t){var n=Math.acos(t[3])*2,r=Math.sin(n/2);return r>Rt?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),n}function fS(e,t){var n=Ip(e,t);return Math.acos(2*n*n-1)}function Bp(e,t,n){var r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function pS(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function uS(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function dS(e,t,n){n*=.5;var r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function mS(e,t){var n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Lp(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=Math.sqrt(n*n+r*r+s*s),c=Math.exp(i),a=o>0?c*Math.sin(o)/o:0;return e[0]=n*a,e[1]=r*a,e[2]=s*a,e[3]=c*Math.cos(o),e}function Rp(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=Math.sqrt(n*n+r*r+s*s),c=o>0?Math.atan2(o,i)/o:0;return e[0]=n*c,e[1]=r*c,e[2]=s*c,e[3]=.5*Math.log(n*n+r*r+s*s+i*i),e}function gS(e,t,n){return Rp(e,t),wp(e,e,n),Lp(e,e),e}function so(e,t,n,r){var s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return u=s*a+i*h+o*l+c*f,u<0&&(u=-u,a=-a,h=-h,l=-l,f=-f),1-u>Rt?(p=Math.acos(u),d=Math.sin(p),g=Math.sin((1-r)*p)/d,m=Math.sin(r*p)/d):(g=1-r,m=r),e[0]=g*s+m*a,e[1]=g*i+m*h,e[2]=g*o+m*l,e[3]=g*c+m*f,e}function xS(e){var t=On(),n=On(),r=On(),s=Math.sqrt(1-t),i=Math.sqrt(t);return e[0]=s*Math.sin(2*Math.PI*n),e[1]=s*Math.cos(2*Math.PI*n),e[2]=i*Math.sin(2*Math.PI*r),e[3]=i*Math.cos(2*Math.PI*r),e}function MS(e,t){var n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function AS(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function bp(e,t){var n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);var i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}function yS(e,t,n,r){var s=.5*Math.PI/180;t*=s,n*=s,r*=s;var i=Math.sin(t),o=Math.cos(t),c=Math.sin(n),a=Math.cos(n),h=Math.sin(r),l=Math.cos(r);return e[0]=i*a*l-o*c*h,e[1]=o*c*l+i*a*h,e[2]=o*a*h-i*c*l,e[3]=o*a*l+i*c*h,e}function ES(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var TS=K_,_S=Q_,SS=Z_,CS=$_,BS=tS,LS=Bp,wp=eS,Ip=iS,RS=oS,Pp=nS,bS=Pp,Op=rS,wS=Op,uh=sS,IS=cS,PS=aS,OS=function(){var e=fh(),t=rh(1,0,0),n=rh(0,1,0);return function(r,s,i){var o=ph(s,i);return o<-.999999?(ro(e,t,s),Sp(e)<1e-6&&ro(e,n,s),_p(e,e),Cp(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(ro(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,uh(r,r))}}(),vS=function(){var e=sh(),t=sh();return function(n,r,s,i,o,c){return so(e,r,o,c),so(t,s,i,c),so(n,e,t,2*c*(1-c)),n}}(),NS=function(){var e=u_();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],uh(t,bp(t,e))}}(),D={};vs(D,{add:()=>zS,angle:()=>oC,ceil:()=>VS,clone:()=>FS,copy:()=>US,create:()=>vp,cross:()=>ZS,dist:()=>mC,distance:()=>Up,div:()=>dC,divide:()=>Dp,dot:()=>QS,equals:()=>lC,exactEquals:()=>hC,floor:()=>qS,forEach:()=>MC,fromValues:()=>DS,inverse:()=>XS,len:()=>fC,length:()=>zp,lerp:()=>$S,max:()=>HS,min:()=>kS,mul:()=>uC,multiply:()=>Fp,negate:()=>jS,normalize:()=>KS,random:()=>tC,rotate:()=>iC,round:()=>YS,scale:()=>WS,scaleAndAdd:()=>JS,set:()=>GS,sqrDist:()=>gC,sqrLen:()=>xC,squaredDistance:()=>Gp,squaredLength:()=>Vp,str:()=>aC,sub:()=>pC,subtract:()=>Np,transformMat2:()=>eC,transformMat2d:()=>nC,transformMat3:()=>rC,transformMat4:()=>sC,zero:()=>cC});function vp(){var e=new ut(2);return ut!=Float32Array&&(e[0]=0,e[1]=0),e}function FS(e){var t=new ut(2);return t[0]=e[0],t[1]=e[1],t}function DS(e,t){var n=new ut(2);return n[0]=e,n[1]=t,n}function US(e,t){return e[0]=t[0],e[1]=t[1],e}function GS(e,t,n){return e[0]=t,e[1]=n,e}function zS(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e}function Np(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e}function Fp(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e}function Dp(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e}function VS(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function qS(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function kS(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e}function HS(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e}function YS(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function WS(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e}function JS(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e}function Up(e,t){var n=t[0]-e[0],r=t[1]-e[1];return Math.hypot(n,r)}function Gp(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function zp(e){var t=e[0],n=e[1];return Math.hypot(t,n)}function Vp(e){var t=e[0],n=e[1];return t*t+n*n}function jS(e,t){return e[0]=-t[0],e[1]=-t[1],e}function XS(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function KS(e,t){var n=t[0],r=t[1],s=n*n+r*r;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e}function QS(e,t){return e[0]*t[0]+e[1]*t[1]}function ZS(e,t,n){var r=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=r,e}function $S(e,t,n,r){var s=t[0],i=t[1];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e}function tC(e,t){t=t||1;var n=On()*2*Math.PI;return e[0]=Math.cos(n)*t,e[1]=Math.sin(n)*t,e}function eC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function nC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function rC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function sC(e,t,n){var r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}function iC(e,t,n,r){var s=t[0]-n[0],i=t[1]-n[1],o=Math.sin(r),c=Math.cos(r);return e[0]=s*c-i*o+n[0],e[1]=s*o+i*c+n[1],e}function oC(e,t){var n=e[0],r=e[1],s=t[0],i=t[1],o=Math.sqrt(n*n+r*r)*Math.sqrt(s*s+i*i),c=o&&(n*s+r*i)/o;return Math.acos(Math.min(Math.max(c,-1),1))}function cC(e){return e[0]=0,e[1]=0,e}function aC(e){return"vec2("+e[0]+", "+e[1]+")"}function hC(e,t){return e[0]===t[0]&&e[1]===t[1]}function lC(e,t){var n=e[0],r=e[1],s=t[0],i=t[1];return Math.abs(n-s)<=Rt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(r-i)<=Rt*Math.max(1,Math.abs(r),Math.abs(i))}var fC=zp,pC=Np,uC=Fp,dC=Dp,mC=Up,gC=Gp,xC=Vp,MC=function(){var e=vp();return function(t,n,r,s,i,o){var c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}(),ao=(1+Math.sqrt(5))/2,lU=2*Math.PI,io=2*Math.PI/5,Ee=Math.PI/5,$1=Math.PI/10,AC=2*Math.atan(ao),ih=Math.PI-AC,fU=-.5*Math.PI+Math.acos(-1/Math.sqrt(3-ao)),ho=(Math.sqrt(5)-1)/2,yC=3-Math.sqrt(5),EC=Math.sqrt(3-ao),pU=Math.sqrt(3)*EC/ao;Ht.setMatrixArrayType(Float64Array);var dh=class oh{constructor(t){this.vertices=t,this.id={i:0,j:0,k:0,resolution:1},this.isWindingCorrect()||this.vertices.reverse()}getArea(){let t=0,n=this.vertices.length;for(let r=0;r<n;r++){let s=(r+1)%n;t+=(this.vertices[s][0]-this.vertices[r][0])*(this.vertices[s][1]+this.vertices[r][1])}return t}isWindingCorrect(){return this.getArea()>=0}getVertices(){return this.vertices}scale(t){for(let n of this.vertices)D.scale(n,n,t);return this}rotate180(){for(let t of this.vertices)D.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 n of this.vertices)D.add(n,n,t);return this}transform(t){for(let n of this.vertices)D.transformMat2(n,n,t);return this}transform2d(t){for(let n of this.vertices)D.transformMat2d(n,n,t);return this}clone(){return new oh(this.vertices.map(n=>D.clone(n)))}getCenter(){return this.vertices.reduce((t,n)=>[t[0]+n[0]/5,t[1]+n[1]/5],[0,0])}containsPoint(t){if(!this.isWindingCorrect())throw new Error("Pentagon is not counter-clockwise");let n=this.vertices.length;for(let r=0;r<n;r++){let s=this.vertices[r],i=this.vertices[(r+1)%n],o=i[0]-s[0],c=i[1]-s[1],a=t[0]-s[0],h=t[1]-s[1],l=o*h-c*a;if(l>0){let f=Math.sqrt(a*a+h*h);return l/f}}return-1}splitEdges(t){if(t<=1)return this;let n=[],r=this.vertices.length;for(let s=0;s<r;s++){let i=this.vertices[s],o=this.vertices[(s+1)%r];n.push(D.clone(i));for(let c=1;c<t;c++){let a=c/t,h=D.create();D.lerp(h,i,o,a),n.push(h)}}return new oh(n)}};Ht.setMatrixArrayType(Float64Array);var qp=[0,0],kp=[0,1],Fn=[.7885966681787006,1.6149108024237764],Hp=[1.6171013659387945,1.054928690397459],Yp=[Math.cos($1),Math.sin($1)],TC=2*D.length(Fn)*Math.cos(Ee),_C=Ee-Math.atan2(Fn[1],Fn[0]),SC=2*ho/TC;[qp,kp,Fn,Hp,Yp].forEach(e=>{D.scale(e,e,SC),D.rotate(e,e,[0,0],_C)});var CC=new dh([qp,kp,Fn,Hp,Yp]),Wp=Math.atan2(Fn[1],Fn[0])-Ee,BC=[0,0],oo=ho/Math.cos(Ee),tp=Wp+Ee,co=[oo*Math.cos(tp),oo*Math.sin(tp)],ep=Wp-Ee,Os=[oo*Math.cos(ep),oo*Math.sin(ep)],Jp=new dh([BC,co,Os]),jp=Nn.fromValues(co[0],co[1],Os[0],Os[1]),uU=Nn.invert(Nn.create(),jp),LC=new Float64Array([-.0022392098386786394,21308606513250217e-22,-2559257686421274e-24,33701965267802837e-28,-4667545312611249e-30,667492870384816e-32]),RC=new Float64Array([.0022392089963541657,28831978048607556e-22,508622073997266e-23,102018123778161e-25,21912872306767718e-30,49284235482523806e-33]),bC=class{applyCoefficients(e,t){let n=Math.sin(e),r=Math.cos(e),s=2*(r-n)*(r+n),i,o;return i=s*t[5]+t[4],o=s*i+t[3],i=s*o-i+t[2],o=s*i-o+t[1],i=s*o-i+t[0],e+2*n*r*i}forward(e){return this.applyCoefficients(e,LC)}inverse(e){return this.applyCoefficients(e,RC)}};Ht.setMatrixArrayType(Float64Array);var Xp=new bC;function np(e){return e*(Math.PI/180)}function rp(e){return e*(180/Math.PI)}function sp(e){let t=D.length(e),n=Math.atan2(e[1],e[0]);return[t,n]}function wC([e,t]){let n=e*Math.cos(t),r=e*Math.sin(t);return[n,r]}function IC(e,[t,n,r]){let s=[t[0]-r[0],t[1]-r[1]],i=[r[0]-n[0],r[1]-n[1]],o=[e[0]-r[0],e[1]-r[1]],c=i[0]*s[1]-i[1]*s[0],a=(i[0]*o[1]-i[1]*o[0])/c,h=(s[0]*o[1]-s[1]*o[0])/c,l=1-(a+h);return[a,h,l]}function PC(e,[t,n,r]){return[e[0]*t[0]+e[1]*n[0]+e[2]*r[0],e[0]*t[1]+e[1]*n[1]+e[2]*r[1]]}function ch(e){let t=Math.atan2(e[1],e[0]),n=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=Math.acos(e[2]/n);return[t,r]}function vn([e,t]){let n=Math.sin(t),r=n*Math.cos(e),s=n*Math.sin(e),i=Math.cos(t);return[r,s,i]}var Kp=93;function OC([e,t]){let n=np(e+Kp),r=np(t),s=Xp.forward(r),i=Math.PI/2-s;return[n,i]}function Qp([e,t]){let n=rp(e)-Kp,r=Math.PI/2-t,s=Xp.inverse(r),i=rp(s);return[n,i]}function vC(e){let t=vn(e),n=Ps.create();return Ps.rotationTo(n,[0,0,1],t),n}function NC(e){let t=e.map(i=>vn(OC(i))),n=P.create();for(let i of t)P.add(n,n,i);P.normalize(n,n);let[r,s]=Qp(ch(n));return(s>89.99||s<-89.99)&&(r=e[0][0]),r=((r+180)%360+360)%360-180,e.map(i=>{let[o,c]=i;for(;o-r>180;)o=o-360;for(;o-r<-180;)o=o+360;return[o,c]})}Ht.setMatrixArrayType(Float64Array);var Zp=["vu","uw","vw","vw","vw"],ws=["wu","uw","vw","vu","uw"],th=["wu","uv","wv","wu","uw"],Qi=["vu","uv","wv","wu","uw"],FC=[Zp,Qi,th,ws,th,Qi,th,ws,ws,ws,Qi,Qi],DC=[4,2,3,2,0,4,3,2,2,0,3,0],ip=[0,1,2,4,3,5,7,8,6,11,10,9],fe=[];function UC(){Zi([0,0],0);for(let e=0;e<5;e++){let t=e*io,n=t+Ee;Zi([t,ih],Ee),Zi([n,Math.PI-ih],Ee)}Zi([0,Math.PI],0)}var xr=0;function Zi(e,t){if(xr>11)throw new Error(`Too many origins: ${xr}`);let n={id:xr,axis:e,quat:vC(e),angle:t,orientation:FC[xr],firstQuintant:DC[xr]};fe.push(n),xr++}UC();fe.sort((e,t)=>ip.indexOf(e.id)-ip.indexOf(t.id));fe.forEach((e,t)=>e.id=t);function GC(e,t){let n=t.orientation,r=n===Zp||n===ws?-1:1,s=(e-t.firstQuintant+5)%5,i=n[s];return{quintant:(t.firstQuintant+r*s+5)%5,orientation:i}}var zC=class{forward([e,t]){return[Math.tan(t),e]}inverse([e,t]){return[t,Math.atan(e)]}},Mr=P.create(),Is=P.create(),op=P.create(),cp=P.create();function eh(e,t){P.lerp(Mr,e,t,.5),P.normalize(Mr,Mr),P.cross(Mr,e,Mr);let n=P.length(Mr);if(n<1e-8){let r=P.subtract(P.create(),e,t);return .5*P.length(r)}return n}function VC(e,t,n){return P.cross(Is,t,n),P.dot(e,Is)}function qC(e,t,n,r,s){P.cross(Is,r,s);let i=P.dot(t,Is),o=P.dot(n,Is);return P.scale(op,t,o),P.scale(cp,n,i),P.sub(e,cp,op)}function ah(e,t,n,r){let s=P.angle(t,n);if(s<1e-12)return P.lerp(e,t,n,r);let i=Math.sin((1-r)*s)/Math.sin(s),o=Math.sin(r*s)/Math.sin(s),c=P.scale(P.create(),t,i),a=P.scale(P.create(),n,o);return P.add(e,c,a)}Ht.setMatrixArrayType(Float64Array);var $i=P.create(),to=P.create(),eo=P.create(),Ar=P.create(),kC=class{constructor(e){this._area=null,this.vertices=e,Object.freeze(this.vertices)}getBoundary(e=1,t=!0){let n=[],r=this.vertices.length;for(let s=0;s<r*e;s++){let i=s/e;n.push(this.slerp(i))}return t&&n.push(n[0]),n}slerp(e){let t=this.vertices.length,n=e%1,r=Math.floor(e%t),s=(r+1)%t;return ah(P.create(),this.vertices[r],this.vertices[s],n)}getTransformedVertices(e){let t=this.vertices.length,n=Math.floor(e%t),r=(n+1)%t,s=(n+t-1)%t,i=P.clone(this.vertices[n]),o=P.clone(this.vertices[r]),c=P.clone(this.vertices[s]);return P.sub(o,o,i),P.sub(c,c,i),[i,o,c]}containsPoint(e){let t=this.vertices.length,n=1/0;for(let r=0;r<t;r++){let[s,i,o]=this.getTransformedVertices(r),c=P.sub(P.create(),e,s);P.normalize(c,c),P.normalize(i,i),P.normalize(o,o);let a=P.cross(P.create(),i,c),h=P.cross(P.create(),c,o),l=P.dot(s,a),f=P.dot(s,h);n=Math.min(n,l,f)}return n}getTriangleArea(e,t,n){P.lerp($i,t,n,.5),P.lerp(to,n,e,.5),P.lerp(eo,e,t,.5),P.normalize($i,$i),P.normalize(to,to),P.normalize(eo,eo);let r=VC($i,to,eo),s=Math.max(-1,Math.min(1,r));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;P.set(Ar,0,0,0);for(let t of this.vertices)P.add(Ar,Ar,t);P.normalize(Ar,Ar);let e=0;for(let t=0;t<this.vertices.length;t++){let n=this.vertices[t],r=this.vertices[(t+1)%this.vertices.length],s=this.getTriangleArea(Ar,n,r);isNaN(s)||(e+=s)}return this._area=e,this._area}isWindingCorrect(){if(!(this.getArea()>0))debugger}};Ht.setMatrixArrayType(Float64Array);var no=class extends kC{constructor(e){if(e.length!==3)throw new Error("SphericalTriangleShape requires exactly 3 vertices");super(e)}};Ht.setMatrixArrayType(Float64Array);var HC=class{forward(e,t,n){let[r,s,i]=t,o=new no([r,s,i]),c=P.subtract(P.create(),e,r);P.normalize(c,c);let a=qC(P.create(),r,c,s,i);P.normalize(a,a);let h=eh(r,e)/eh(r,a),l=o.getArea(),f=h/l,p=[1-h,f*new no([r,a,i]).getArea(),f*new no([r,s,a]).getArea()];return PC(p,n)}inverse(e,t,n){let[r,s,i]=n,o=new no([r,s,i]),c=IC(e,t),a=1-1e-14;if(c[0]>a)return r;if(c[1]>a)return s;if(c[2]>a)return i;let h=P.create();P.cross(h,s,i);let l=o.getArea(),f=1-c[0],u=c[2]/f*l,d=Math.sin(u),g=Math.sin(u/2),m=2*g*g,M=P.dot(r,s),E=P.dot(s,i),A=P.dot(i,r),y=P.length(h),T=P.dot(r,h),_=d*T+m*(M*E-A),L=m*y*(1+M),C=2/Math.acos(E)*Math.atan2(L,_),S=ah(P.create(),s,i,C),x=eh(r,S),R=this.safeAcos(f*x)/this.safeAcos(x);return ah([0,0,0],r,S,R)}safeAcos(e){return e<.001?2*e+e*e*e/3:Math.acos(1-2*e*e)}};Ht.setMatrixArrayType(Float64Array);var Xt=-1,zt=1,YC=([e,t])=>D.fromValues(e-t,t),hh=D.fromValues(1,0),lh=D.fromValues(0,1),ap=D.negate(D.create(),hh),hp=D.negate(D.create(),lh),nh=D.fromValues(0,0),WC=(e,[t,n])=>{let r=nh,s=nh;switch(t===zt&&n===zt?(r=hh,s=lh):t===Xt&&n===zt?(r=hp,s=ap):t===zt&&n===Xt?(r=lh,s=hh):t===Xt&&n===Xt&&(r=ap,s=hp),e){case 0:return nh;case 1:return r;case 2:return D.add(D.create(),s,r);case 3:return D.scaleAndAdd(D.create(),s,r,2);default:throw new Error(`Invalid Quaternary value: ${e}`)}},lp=e=>[[zt,zt],[zt,Xt],[zt,zt],[Xt,zt]][e],fp=D.fromValues(-1,1);function $p(e){return Array.from({length:e.length},(t,n)=>e.indexOf(n))}var tu=[0,1,3,4,5,6,7,2],eu=[0,1,2,7,3,4,5,6],dU=$p(tu),mU=$p(eu),JC=(e,t,n,r,s)=>{if(t<=0)return;let i=e[t]||0,o=e[t-1],c=n[0]+n[1],a=!0,h=!0;if(r!==(c===0)?(a=i===1||i===2,h=i===1):(a=i<2,h=i===0),!a)return;let l=h?o:o+4,f=s[l];e[t-1]=f%4,e[t]=(i+4+Math.floor(f/4)-Math.floor(l/4))%4},jC=(e,t,n)=>{let r=BigInt(e),s=n==="vu"||n==="wu"||n==="vw",i=n==="wv"||n==="vw",o=n==="wu"||n==="uw";s&&(r=(1n<<BigInt(2*t))-r-1n);let c=XC(r,t,i,o);if(o){let{offset:[a,h],flips:[l,f]}=c;c.offset=[h,a],l===Xt&&D.add(c.offset,c.offset,fp),f===Xt&&D.subtract(c.offset,c.offset,fp)}if(i){let{offset:[a,h],flips:l}=c,f=(1<<t)-(a+h);l[0]=-l[0],c.offset[1]=f,c.flips=l}return c},XC=(e,t,n,r)=>{let s=D.create(),i=[zt,zt],o=BigInt(e),c=[];for(;o>0n||c.length<t;)c.push(Number(o%4n)),o=o>>2n;let a=r?eu:tu;for(let l=c.length-1;l>=0;l--)JC(c,l,i,n,a),D.multiply(i,i,lp(c[l]));i[0]=zt,i[1]=zt;for(let l=c.length-1;l>=0;l--){D.scale(s,s,2);let f=WC(c[l],i);D.add(s,s,f),D.multiply(i,i,lp(c[l]))}let h=c[0]||0;return{flips:i,k:h,offset:YC(s)}};Ht.setMatrixArrayType(Float64Array);var KC=!1,QC=D.clone(Os),ZC=D.negate(D.create(),Os),mh=[0,1,2,3,4].map(e=>{let t=Nn.create();return Nn.fromRotation(t,io*e),t}),pp=D.create();function $C(e,t,n){let r=(KC?Jp:CC).clone();D.transformMat2(pp,n.offset,jp),n.flips[0]===zt&&n.flips[1]===Xt&&r.rotate180();let{k:s}=n,i=n.flips[0]+n.flips[1];return((i===-2||i===2)&&s>1||i===0&&(s===0||s===3))&&r.reflectY(),n.flips[0]===Xt&&n.flips[1]===Xt?r.rotate180():n.flips[0]===Xt?r.translate(ZC):n.flips[1]===Xt&&r.translate(QC),r.translate(pp),r.scale(1/2**e),r.transform(mh[t]),r}function nu(e){let t=Jp.clone();return t.transform(mh[e]),t}function tB(){let e=[];for(let t of mh)e.push(D.transformMat2(D.create(),co,t));return e.reverse(),new dh(e)}Ht.setMatrixArrayType(Float64Array);var eB=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(P.distance(e,t)<1e-5)return t;throw new Error("Failed to find vertex in CRS")}addFaceCenters(){fe.forEach(e=>this.add(vn(e.axis)))}addVertices(){let e=Math.atan(yC);for(let t of fe)for(let n=0;n<5;n++){let r=(2*n+1)*Math.PI/5,s=vn([r+t.angle,e]);P.transformQuat(s,s,t.quat),this.add(s)}}addMidpoints(){let e=Math.atan(ho);for(let t of fe)for(let n=0;n<5;n++){let r=2*n*Math.PI/5,s=vn([r+t.angle,e]);P.transformQuat(s,s,t.quat),this.add(s)}}add(e){let t=P.normalize(P.create(),e);return this.vertices.find(r=>P.distance(t,r)<1e-5)?!1:(this.vertices.push(t),!0)}};Ht.setMatrixArrayType(Float64Array);var nB=new eB,rB=class{constructor(){this.faceTriangles=[],this.sphericalTriangles=[],this.polyhedral=new HC,this.gnomonic=new zC}forward(e,t){let n=fe[t],r=vn(e),s=Ps.create();Ps.invert(s,n.quat);let i=P.create();P.transformQuat(i,r,s);let o=ch(i),c=this.gnomonic.forward(o);c[1]=c[1]-n.angle;let a=this.getFaceTriangleIndex(c),h=this.getFaceTriangle(a),l=this.getSphericalTriangle(a,t,!1);return this.polyhedral.forward(r,l,h)}inverse(e,t){let n=sp(e),r=this.getFaceTriangleIndex(n),[s,i]=n,c=wC([s,this.normalizeGamma(i)])[0]>ho,a=this.getFaceTriangle(r,c,!1),h=this.getSphericalTriangle(r,t,c),l=this.polyhedral.inverse(e,a,h);return ch(l)}getFaceTriangleIndex([e,t]){return(Math.floor(t/Ee)+10)%10}getFaceTriangle(e,t=!1,n=!1){let r=e;return t&&(r+=n?20:10),this.faceTriangles[r]?this.faceTriangles[r]:(this.faceTriangles[r]=t?this._getReflectedFaceTriangle(e,n):this._getFaceTriangle(e),Object.freeze(this.faceTriangles[r]),this.faceTriangles[r])}_getFaceTriangle(e){let t=Math.floor((e+1)/2)%5,[n,r,s]=nu(t).getVertices(),i=D.create();return D.lerp(i,r,s,.5),e%2===0?[n,i,r]:[n,s,i]}_getReflectedFaceTriangle(e,t=!1){let[n,r,s]=this._getFaceTriangle(e).map(c=>D.clone(c)),i=e%2===0;D.negate(n,n);let o=i?r:s;return D.scaleAndAdd(n,n,o,t?1+1/Math.cos(ih):2),[n,s,r]}getSphericalTriangle(e,t,n=!1){let r=10*t+e;return n&&(r+=120),this.sphericalTriangles[r]?this.sphericalTriangles[r]:(this.sphericalTriangles[r]=this._getSphericalTriangle(e,t,n),Object.freeze(this.sphericalTriangles[r]),this.sphericalTriangles[r])}_getSphericalTriangle(e,t,n=!1){let r=fe[t];return this.getFaceTriangle(e,n,!0).map(o=>{let[c,a]=sp(o),h=[c,a+r.angle],l=vn(this.gnomonic.inverse(h));return P.transformQuat(l,l,r.quat),nB.getVertex(l)})}normalizeGamma(e){let t=e/io,n=Math.round(t);return(t-n)*io}},yr=2,sB=30,iB=58n,oB=0x3ffffffffffffffn;function cB(e){let t=sB-1,n=e>>1n;for(;t>-1&&(n&0b1n)===0n;)t-=1,n=n>>(t<yr?1n:2n);return t}function aB(e){let t=cB(e);if(t===-1)return{origin:fe[0],segment:0,S:0n,resolution:t};let n=Number(e>>58n),r,s;if(t===0)r=fe[n],s=0;else{let h=Math.floor(n/5);r=fe[h],s=(n+r.firstQuintant)%5}if(!r)throw new Error(`Could not parse origin: ${n}`);if(t<yr)return{origin:r,segment:s,S:0n,resolution:t};let i=t-yr+1,o=BigInt(2*i),c=iB-o,a=(e&oB)>>c;return{origin:r,segment:s,S:a,resolution:t}}Ht.setMatrixArrayType(Float64Array);var gU=Nn.create(),hB=new rB;function lB({S:e,segment:t,origin:n,resolution:r}){let{quintant:s,orientation:i}=GC(t,n);if(r===yr-1)return nu(s);if(r===yr-2)return tB();let o=r-yr+1,c=jC(e,o,i);return $C(o,s,c)}function ru(e,{closedRing:t=!0,segments:n="auto"}={closedRing:!0,segments:"auto"}){let{S:r,segment:s,origin:i,resolution:o}=aB(e);n==="auto"&&(n=Math.max(1,Math.pow(2,6-o)));let f=lB({S:r,segment:s,origin:i,resolution:o}).splitEdges(n).getVertices().map(u=>hB.inverse(u,i.id)).map(u=>Qp(u)),p=NC(f);return t&&p.push(p[0]),p.reverse(),p}function su(e){return BigInt(`0x${e}`)}var up=63710072e-1,xU=4*Math.PI*up*up;Ht.setMatrixArrayType(Float64Array);var Us=G(lo(),1);var LU=1/Math.PI*180,RU=1/180*Math.PI,fB={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fB}};var dt=globalThis.mathgl.config;function gh(e,{precision:t=dt.precision}={}){return e=pB(e),`${parseFloat(e.toPrecision(t))}`}function Te(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function en(e,t,n){return Te(e)?e.map((r,s)=>en(r,t[s],n)):n*t+(1-n)*e}function _e(e,t,n){let r=dt.EPSILON;n&&(dt.EPSILON=n);try{if(e===t)return!0;if(Te(e)&&Te(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!_e(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)<=dt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{dt.EPSILON=r}}function pB(e){return Math.round(e/dt.EPSILON)*dt.EPSILON}var nn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Te(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(dt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+gh(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!_e(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(dt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function uB(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function W(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function rn(e,t,n=""){if(dt.debug&&!uB(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Se(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Er=class extends nn{get x(){return this[0]}set x(t){this[0]=W(t)}get y(){return this[1]}set y(t){this[1]=W(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return W(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return W(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Se(t>=0&&t<this.ELEMENTS,"index is out of range"),W(this[t])}setComponent(t,n){return Se(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var at=typeof Float32Array<"u"?Float32Array:Array;var GU=Math.PI/180;function dB(){let e=new at(2);return at!=Float32Array&&(e[0]=0,e[1]=0),e}function au(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function hu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var zU=function(){let e=dB();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function lu(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function fo(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function fu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function pu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function po(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function xh(){let e=new at(3);return at!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function mB(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Mh(e,t,n){let r=new at(3);return r[0]=e,r[1]=t,r[2]=n,r}function uu(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Ah(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function _r(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Sr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function uo(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function mo(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function du(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function mu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function gu(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function xu(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Ah(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Mu=mB;var kU=function(){let e=xh();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var yh=[0,0,0],go,O=class extends Er{static get ZERO(){return go||(go=new O(0,0,0),Object.freeze(go)),go}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Te(t)?this.copy(t):(dt.debug&&(W(t),W(n),W(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return dt.debug&&(W(t.x),W(t.y),W(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]=W(t)}angle(t){return xu(this,t)}cross(t){return _r(this,this,t),this.check()}rotateX({radians:t,origin:n=yh}){return du(this,this,n,t),this.check()}rotateY({radians:t,origin:n=yh}){return mu(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=yh}){return gu(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Sr(this,this,t),this.check()}transformAsVector(t){return fo(this,this,t),this.check()}transformByMatrix3(t){return uo(this,this,t),this.check()}transformByMatrix2(t){return fu(this,this,t),this.check()}transformByQuaternion(t){return mo(this,this,t),this.check()}};var xo,Cr=class extends Er{static get ZERO(){return xo||(xo=new Cr(0,0,0,0),Object.freeze(xo)),xo}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Te(t)&&arguments.length===1?this.copy(t):(dt.debug&&(W(t),W(n),W(r),W(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 dt.debug&&(W(t.x),W(t.y),W(t.z),W(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]=W(t)}get w(){return this[3]}set w(t){this[3]=W(t)}transform(t){return Sr(this,this,t),this.check()}transformByMatrix3(t){return po(this,this,t),this.check()}transformByMatrix2(t){return pu(this,this,t),this.check()}transformByQuaternion(t){return mo(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Br=class extends nn{toString(){let t="[";if(dt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=W(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function Au(){let e=new at(9);return at!=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 yu(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 Eu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function Tu(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function Eh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function _u(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function Su(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Th(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 Cu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var _h;(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"})(_h||(_h={}));var MB=Object.freeze([1,0,0,0,1,0,0,0,1]),ht=class extends Br{static get IDENTITY(){return yB()}static get ZERO(){return AB()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return _h}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(MB)}fromObject(t){return this.check()}fromQuaternion(t){return Cu(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return Tu(this)}transpose(){return yu(this,this),this.check()}invert(){return Eu(this,this),this.check()}multiplyLeft(t){return Eh(this,t,this),this.check()}multiplyRight(t){return Eh(this,this,t),this.check()}rotate(t){return Su(this,this,t),this.check()}scale(t){return Array.isArray(t)?Th(this,this,t):Th(this,this,[t,t]),this.check()}translate(t){return _u(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=au(n||[-0,-0],t,this);break;case 3:r=uo(n||[-0,-0,-0],t,this);break;case 4:r=po(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},Mo,Ao=null;function AB(){return Mo||(Mo=new ht([0,0,0,0,0,0,0,0,0]),Object.freeze(Mo)),Mo}function yB(){return Ao||(Ao=new ht,Object.freeze(Ao)),Ao}var Fs={};Tt(Fs,{add:()=>YB,adjoint:()=>BB,clone:()=>TB,copy:()=>_B,create:()=>EB,decompose:()=>FB,determinant:()=>Bh,equals:()=>XB,exactEquals:()=>jB,frob:()=>HB,fromQuat:()=>Oh,fromQuat2:()=>OB,fromRotation:()=>bB,fromRotationTranslation:()=>Lu,fromRotationTranslationScale:()=>DB,fromRotationTranslationScaleOrigin:()=>UB,fromScaling:()=>RB,fromTranslation:()=>LB,fromValues:()=>SB,fromXRotation:()=>wB,fromYRotation:()=>IB,fromZRotation:()=>PB,frustum:()=>vh,getRotation:()=>NB,getScaling:()=>Ru,getTranslation:()=>vB,identity:()=>Bu,invert:()=>Ch,lookAt:()=>Dh,mul:()=>KB,multiply:()=>Ns,multiplyScalar:()=>WB,multiplyScalarAndAdd:()=>JB,ortho:()=>Fh,orthoNO:()=>wu,orthoZO:()=>VB,perspective:()=>Nh,perspectiveFromFieldOfView:()=>zB,perspectiveNO:()=>bu,perspectiveZO:()=>GB,rotate:()=>bh,rotateX:()=>wh,rotateY:()=>Ih,rotateZ:()=>Ph,scale:()=>Rh,set:()=>CB,str:()=>kB,sub:()=>QB,subtract:()=>Iu,targetTo:()=>qB,translate:()=>Lh,transpose:()=>Sh});function EB(){let e=new at(16);return at!=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 TB(e){let t=new at(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 _B(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 SB(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new at(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function CB(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function Bu(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 Sh(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 Ch(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function BB(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m;return e[0]=c*w-a*b+h*R,e[1]=s*b-r*w-i*R,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*w-h*S,e[5]=n*w-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*b-c*x+h*C,e[9]=r*x-n*b-i*C,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*R-a*C,e[13]=n*R-r*S+s*C,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function Bh(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function Ns(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function Lh(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function Rh(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function bh(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function wh(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Ih(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function Ph(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function LB(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 RB(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 bB(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function wB(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function IB(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function PB(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,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 Lu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function OB(e,t){let n=new at(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),Lu(e,t,n),e}function vB(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Ru(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function NB(e,t){let n=new at(3);Ru(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function FB(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,C=p*g,S=m+y+C,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>C?(x=Math.sqrt(1+m-y-C)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>C?(x=Math.sqrt(1+y-m-C)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+C-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function DB(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function UB(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],C=s[0],S=s[1],x=s[2],R=(1-(g+M))*T,b=(u+y)*T,w=(d-A)*T,B=(u-y)*_,v=(1-(p+M))*_,H=(m+E)*_,V=(d+A)*L,tt=(m-E)*L,Y=(1-(p+g))*L;return e[0]=R,e[1]=b,e[2]=w,e[3]=0,e[4]=B,e[5]=v,e[6]=H,e[7]=0,e[8]=V,e[9]=tt,e[10]=Y,e[11]=0,e[12]=n[0]+C-(R*C+B*S+V*x),e[13]=n[1]+S-(b*C+v*S+tt*x),e[14]=n[2]+x-(w*C+H*S+Y*x),e[15]=1,e}function Oh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function vh(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function bu(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var Nh=bu;function GB(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function zB(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function wu(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var Fh=wu;function VB(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function Dh(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?Bu(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function qB(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function kB(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 HB(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 YB(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Iu(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function WB(e,t,n){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]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function JB(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function jB(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 XB(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],C=t[6],S=t[7],x=t[8],R=t[9],b=t[10],w=t[11],B=t[12],v=t[13],H=t[14],V=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-C)<=1e-6*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-b)<=1e-6*Math.max(1,Math.abs(p),Math.abs(b))&&Math.abs(u-w)<=1e-6*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(d-B)<=1e-6*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(g-v)<=1e-6*Math.max(1,Math.abs(g),Math.abs(v))&&Math.abs(m-H)<=1e-6*Math.max(1,Math.abs(m),Math.abs(H))&&Math.abs(M-V)<=1e-6*Math.max(1,Math.abs(M),Math.abs(V))}var KB=Ns,QB=Iu;function ZB(){let e=new at(4);return at!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Pu(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Ou(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function vu(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Nu(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Fu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Du(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Uu(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Gu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function zu(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var uG=function(){let e=ZB();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var zh;(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"})(zh||(zh={}));var tL=45*Math.PI/180,eL=1,Uh=.1,Gh=500,nL=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Kt=class extends Br{static get IDENTITY(){return sL()}static get ZERO(){return rL()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return zh}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(nL)}fromObject(t){return this.check()}fromQuaternion(t){return Oh(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=Uh,far:c=Gh}=t;return c===1/0?iL(this,n,r,s,i,o):vh(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return Dh(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=Uh,far:c=Gh}=t;return Fh(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=tL,aspect:r=eL,focalDistance:s=1,near:i=Uh,far:o=Gh}=t;Vu(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Vu(n),Nh(this,n,r,s,i),this.check()}determinant(){return Bh(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Sh(this,this),this.check()}invert(){return Ch(this,this),this.check()}multiplyLeft(t){return Ns(this,t,this),this.check()}multiplyRight(t){return Ns(this,this,t),this.check()}rotateX(t){return wh(this,this,t),this.check()}rotateY(t){return Ih(this,this,t),this.check()}rotateZ(t){return Ph(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return bh(this,this,t,n),this.check()}scale(t){return Rh(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Lh(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Gu(n||[-0,-0,-0,-0],t,this),rn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=hu(n||[-0,-0],t,this);break;case 3:s=Sr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=lu(n||[-0,-0],t,this);break;case 3:r=fo(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return rn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},yo,Eo;function rL(){return yo||(yo=new Kt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(yo)),yo}function sL(){return Eo||(Eo=new Kt,Object.freeze(Eo)),Eo}function Vu(e){if(e>Math.PI*2)throw Error("expected radians")}function iL(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function qu(){let e=new at(4);return at!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ku(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Vh(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function qh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function Hu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Yu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Wu(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function Ju(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Ds(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function ju(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function Xu(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function kh(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var Ku=Pu;var Qu=Ou,Zu=Du,$u=Uu,td=vu;var ed=Nu;var nd=Fu;var rd=function(){let e=xh(),t=Mh(1,0,0),n=Mh(0,1,0);return function(r,s,i){let o=Ah(s,i);return o<-.999999?(_r(e,t,s),Mu(e)<1e-6&&_r(e,n,s),uu(e,e),Vh(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(_r(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,nd(r,r))}}(),LG=function(){let e=qu(),t=qu();return function(n,r,s,i,o,c){return Ds(e,r,o,c),Ds(t,s,i,c),Ds(n,e,t,2*c*(1-c)),n}}(),RG=function(){let e=Au();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],nd(t,kh(t,e))}}();var oL=[0,0,0,1],Lr=class extends nn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 kh(this,t),this.check()}fromAxisRotation(t,n){return Vh(this,t,n),this.check()}identity(){return ku(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=W(t)}get y(){return this[1]}set y(t){this[1]=W(t)}get z(){return this[2]}set z(t){this[2]=W(t)}get w(){return this[3]}set w(t){this[3]=W(t)}len(){return td(this)}lengthSquared(){return ed(this)}dot(t){return Zu(this,t)}rotationTo(t,n){return rd(this,t,n),this.check()}add(t){return Ku(this,this,t),this.check()}calculateW(){return Ju(this,this),this.check()}conjugate(){return Xu(this,this),this.check()}invert(){return ju(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):($u(this,t,n,r),this.check())}multiplyRight(t){return qh(this,this,t),this.check()}multiplyLeft(t){return qh(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return Hu(this,this,t),this.check()}rotateY(t){return Yu(this,this,t),this.check()}rotateZ(t){return Wu(this,this,t),this.check()}scale(t){return Qu(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=oL,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Ds(this,s,i,o),this.check()}transformVector4(t,n=new Cr){return zu(n,t,this),rn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Rr={};Tt(Rr,{EPSILON1:()=>cL,EPSILON10:()=>gL,EPSILON11:()=>xL,EPSILON12:()=>ML,EPSILON13:()=>AL,EPSILON14:()=>yL,EPSILON15:()=>EL,EPSILON16:()=>TL,EPSILON17:()=>_L,EPSILON18:()=>SL,EPSILON19:()=>CL,EPSILON2:()=>aL,EPSILON20:()=>BL,EPSILON3:()=>hL,EPSILON4:()=>lL,EPSILON5:()=>fL,EPSILON6:()=>pL,EPSILON7:()=>uL,EPSILON8:()=>dL,EPSILON9:()=>mL,PI_OVER_FOUR:()=>RL,PI_OVER_SIX:()=>bL,PI_OVER_TWO:()=>LL,TWO_PI:()=>wL});var cL=.1,aL=.01,hL=.001,lL=1e-4,fL=1e-5,pL=1e-6,uL=1e-7,dL=1e-8,mL=1e-9,gL=1e-10,xL=1e-11,ML=1e-12,AL=1e-13,yL=1e-14,EL=1e-15,TL=1e-16,_L=1e-17,SL=1e-18,CL=1e-19,BL=1e-20,LL=Math.PI/2,RL=Math.PI/4,bL=Math.PI/6,wL=Math.PI*2;function To(e,t){t=t===void 0?e[0][0]:t;for(let n of e){let r=n[0]-t;r>180?n[0]-=360:r<-180&&(n[0]+=360)}}function IL(e,t,n){let[r,s]=(0,Us.cellToLatLng)(e),i=t.length;To(t,s);let o=t[0]===t[i-1]?i-1:i;for(let c=0;c<o;c++)t[c][0]=en(s,t[c][0],n),t[c][1]=en(r,t[c][1],n)}function sd(e,t,n){let r=e(t,n),[s,i]=(0,Us.cellToLatLng)(r);return[i,s]}function Hh(e,t=1){let n=(0,Us.cellToBoundary)(e,!0);return t!==1?IL(e,n,t):To(n),n}function _o(e){let t=new Float64Array(e.length*2),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1];return t}var PL={getPentagon:{type:"accessor",value:e=>e.pentagon}},Gs=class extends $t{indexToBounds(){let{data:t,getPentagon:n}=this.props;return{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(r,s)=>{let i=n(r,s),o=ru(typeof i=="string"?su(i):i,{closedRing:!0,segments:"auto"});return _o(o)}}}};Gs.layerName="A5Layer";Gs.defaultProps=PL;var id=Gs;var Yn=G(le(),1),Rm=G(he(),1);function OL(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function So(e){if(Array.isArray(e))return e.map(t=>So(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[OL(n)]=So(r);return t}return e}var Ud=G(Dd(),1);function $h(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,c)=>Boolean(t?.arrayPaths?.some(h=>i===h)),...t?._fastXML},r=kR(e,n);return t?.uncapitalizeKeys?So(r):r}function kR(e,t){return new Ud.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var HR="4.2.1",pe={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:HR,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:YR,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>$h(new TextDecoder().decode(e),{...pe.options.xml,...t?.xml}),parseTextSync:(e,t)=>$h(e,{...pe.options.xml,...t?.xml})};function YR(e){return e.startsWith("<?xml")}async function Qt(e,t,n,r){return r._parse(e,t,n,r)}function q(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Ce={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},WR=Ce.self||Ce.window||Ce.global||{},JR=Ce.window||Ce.self||Ce.global||{},jR=Ce.global||Ce.self||Ce.window||{},XR=Ce.document||{};var qs=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Gd=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),KR=Gd&&parseFloat(Gd[1])||0;var Bo=globalThis,QR=globalThis.document||{},Lo=globalThis.process||{},ZR=globalThis.console,w9=globalThis.navigator||{};function zd(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,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function Un(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||zd()}var tl="4.1.0";function tb(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Ro=class{constructor(t,n,r="sessionStorage"){this.storage=tb(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Vd(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 qd(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var bo;(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"})(bo||(bo={}));var eb=10;function kd(e){return typeof e!="string"?e:(e=e.toUpperCase(),bo[e]||bo.WHITE)}function Hd(e,t,n){return!Un&&typeof e=="string"&&(t&&(e=`\x1B[${kd(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${kd(n)+eb}m${e}\x1B[49m`)),e}function Yd(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(c=>i===c)||(s[i]=o.bind(e)))}}function ks(e,t){if(!e)throw new Error(t||"Assertion failed")}function Gn(){let e;if(Un()&&Bo.performance)e=Bo?.performance?.now?.();else if("hrtime"in Lo){let t=Lo?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var br={debug:Un()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},nb={enabled:!0,level:0};function wr(){}var Wd={},Jd={once:!0},Hs=class{constructor({id:t}={id:""}){this.VERSION=tl,this._startTs=Gn(),this._deltaTs=Gn(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Ro(`__probe-${this.id}__`,nb),this.timeStamp(`${this.id} started`),Yd(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((Gn()-this._startTs).toPrecision(10))}getDelta(){return Number((Gn()-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,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,br.warn,arguments,Jd)}error(t){return this._getLogFunction(0,t,br.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,br.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,br.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,br.debug||br.info,arguments,Jd)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||wr,r&&[r],{tag:sb(n)}):wr}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||wr)}group(t,n,r={collapsed:!1}){let s=jd({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||wr)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Xd(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=jd({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,ks(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Gn();let o=i.tag||i.message;if(i.once&&o)if(!Wd[o])Wd[o]=Gn();else return wr;return n=rb(this.id,i.message,i),r.bind(console,n,...i.args)}return wr}};Hs.VERSION=tl;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 ks(Number.isFinite(t)&&t>=0),t}function jd(e){let{logLevel:t,message:n}=e;e.logLevel=Xd(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),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 ks(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function rb(e,t,n){if(typeof t=="string"){let r=n.time?qd(Vd(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Hd(t,n.color,n.background)}return t}function sb(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var el=new Hs({id:"@probe.gl/log"});function nl(e,t){return Kd(e||{},t)}function Kd(e,t,n=0){if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=Kd(r[s]||{},t[s],n+1):r[s]=t[s];return r}function rl(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function sl(e){return globalThis.loaders?.modules?.[e]||null}function ib(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.1"),globalThis._loadersgl_.version}var Qd=ib();function Zd(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Be={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},cz=Be.self||Be.window||Be.global||{},az=Be.window||Be.self||Be.global||{},hz=Be.global||Be.self||Be.window||{},lz=Be.document||{};var Ir=typeof process!="object"||String(process)!=="[object process]"||process.browser,wo=typeof importScripts=="function",fz=typeof window<"u"&&typeof window.orientation<"u",$d=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),pz=$d&&parseFloat($d[1])||0;var il={};async function Le(e,t=null,n={},r=null){return t&&(e=tm(e,t,n,r)),il[e]=il[e]||ob(e),await il[e]}function tm(e,t,n={},r=null){if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:Ir?n.CDN?(Zd(n.CDN.startsWith("http")),`${n.CDN}/${t}@${Qd}/dist/libs/${r}`):wo?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function ob(e){if(e.endsWith("wasm"))return await ab(e);if(!Ir)try{let{requireFromFile:n}=globalThis.loaders||{};return await n?.(e)}catch(n){return console.error(n),null}if(wo)return importScripts(e);let t=await hb(e);return cb(t,e)}function cb(e,t){if(!Ir){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(wo)return eval.call(globalThis,e),null;let n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch{n.text=e}return document.body.appendChild(n),null}async function ab(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Ir||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function hb(e){let{readFileAsText:t}=globalThis.loaders||{};return Ir||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function nm(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?em(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?em(e,0,t):""}function em(e,t,n){if(e.byteLength<=t+n)return"";let r=new DataView(e),s="";for(let i=0;i<n;i++)s+=String.fromCharCode(r.getUint8(t+i));return s}function ol(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${nm(e)}"`)}}function Ys(...e){let t=e,n=t&&t.length>1&&t[0].constructor||null;if(!n)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let r=t.reduce((o,c)=>o+c.length,0),s=new n(r),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function zn(e,t,n){let r=n!==void 0?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function on(e,t){return q(e>=0),q(t>0),e+(t-1)&~(t-1)}function cl(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(r,n),n+on(r.byteLength,4)}function Ws(){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 Vn=class{constructor(t,n){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=n,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=Ws(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ws()-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 cn=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}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 n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof Vn?s=t:s=new Vn(n,r),this.stats[n]=s),s}};var lb="Queued Requests",fb="Active Requests",pb="Cancelled Requests",ub="Queued Requests Ever",db="Active Requests Ever",mb={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},an=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...mb,...t},this.stats=new cn({id:this.props.id}),this.stats.get(lb),this.stats.get(fb),this.stats.get(pb),this.stats.get(ub),this.stats.get(db)}scheduleRequest(t,n=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_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 n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var hn={};Tt(hn,{dirname:()=>xb,filename:()=>gb,join:()=>Mb,resolve:()=>Ab});function rm(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function gb(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function xb(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function Mb(...e){let t="/";return e=e.map((n,r)=>(r&&(n=n.replace(new RegExp(`^${t}`),"")),r!==e.length-1&&(n=n.replace(new RegExp(`${t}$`),"")),n)),e.join(t)}function Ab(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let n="",r=!1,s;for(let i=t.length-1;i>=-1&&!r;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=rm()),o=s),o.length!==0&&(n=`${o}/${n}`,r=o.charCodeAt(0)===Js)}return n=yb(n,!r),r?`/${n}`:n.length>0?n:"."}var Js=47,al=46;function yb(e,t){let n="",r=-1,s=0,i,o=!1;for(let c=0;c<=e.length;++c){if(c<e.length)i=e.charCodeAt(c);else{if(i===Js)break;i=Js}if(i===Js){if(!(r===c-1||s===1))if(r!==c-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==al||n.charCodeAt(n.length-2)!==al){if(n.length>2){let a=n.length-1,h=a;for(;h>=0&&n.charCodeAt(h)!==Js;--h);if(h!==a){n=h===-1?"":n.slice(0,h),r=c,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=c,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let a=e.slice(r+1,c);n.length>0?n+=`/${a}`:n=a,o=!1}r=c,s=0}else i===al&&s!==-1?++s:s=-1}return n}var Io=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Eb(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function Eb(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var te=class extends Io{};gr(te,"type","template"),gr(te,"testURL",t=>!1);function sm(e,t){let n=pe.parseTextSync?.(e,t),r=n?.ServiceExceptionReport?.ServiceException||n?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof r=="string"?r:r.value||r.code||"Unknown error"}var Tb="4.2.1",js={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:Tb,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:_b,options:{wms:{throwOnError:!1}},parse:async(e,t)=>hl(new TextDecoder().decode(e),t),parseSync:(e,t)=>hl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>hl(e,t)};function _b(e){return e.startsWith("<?xml")}function hl(e,t){let n={...js.options.wms,...t?.wms},r=sm(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function qn(e){return Array.isArray(e)?e:e?[e]:[]}function Xs(e){let t=qn(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function Ks(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function Po(e,t=void 0){switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function kn(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function ll(e,t){let n=pe.parseTextSync?.(e,t),r=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,s=Sb(r);if(t?.inheritedLayerProps)for(let i of s.layers)om(i,null);return t?.includeRawJSON&&(s.json=r),t?.includeXMLText&&(s.xml=e),s}function Sb(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:Xs(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:Po(e.Service?.LayerLimit),maxWidth:Po(e.Service?.maxWidth),maxHeight:Po(e.Service?.maxHeight),layers:[],requests:Cb(e.Capability?.Request),exceptions:Bb(e.Exception)},n=qn(e.Capability?.Layer);for(let r of n)t.layers.push(im(r));for(let[r,s]of Object.entries(t))s===void 0&&delete t[r];return t}function Cb(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=Xs(r?.Format);t[n]={mimeTypes:s}}return t}function Bb(e){if(qn(e?.Format).length>0)return{mimeTypes:Xs(e)}}function im(e){let t={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Xs(e.KeywordList?.Keyword)},n=e?.CRS||e?.SRS;n&&Array.isArray(n)&&n.every(h=>typeof h=="string")&&(t.crs=n);let r=e?.EX_GeographicBoundingBox&&Lb(e?.EX_GeographicBoundingBox);r&&(t.geographicBoundingBox=r),r=e?.LatLonBoundingBox&&Rb(e?.LatLonBoundingBox),r&&(t.geographicBoundingBox=r);let s=e?.BoundingBox&&bb(e?.BoundingBox);s&&s.length>0&&(t.boundingBoxes=s);let o=qn(e?.Dimension).map(h=>Ib(h));o.length&&(t.dimensions=o),e?.opaque&&(t.opaque=kn(e?.opaque)),e?.cascaded&&(t.cascaded=kn(e?.cascaded)),e?.queryable&&(t.queryable=kn(e?.queryable));let c=qn(e?.Layer),a=[];for(let h of c)a.push(im(h));a.length>0&&(t.layers=a);for(let[h,l]of Object.entries(t))l===void 0&&delete t[h];return t}function Lb(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function Rb(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function bb(e){return qn(e).map(n=>wb(n))}function wb(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:c,resy:a}=e,h={crs:t||n,boundingBox:[[Ks(r),Ks(s)],[Ks(i),Ks(o)]]};return c&&(h.xResolution=c),a&&(h.yResolution=a),h}function Ib(e){let{name:t,units:n,value:r}=e,s={name:t,units:n,extent:r};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=kn(e.multipleValues)),e.nearestValue&&(s.nearestValue=kn(e.nearestValue)),e.current&&(s.current=kn(e.current)),s}function om(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 n of e.layers||[])om(n,e)}var Pb="4.2.1",Pr={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:Pb,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Ob,options:{wms:{}},parse:async(e,t)=>ll(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>ll(e,t?.wms)};function Ob(e){return e.startsWith("<?xml")}function fl(e,t){let r=(pe.parseTextSync?.(e,t)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(r)?r:[r]).map(i=>vb(i))}}function vb(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var cm={...Pr,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>fl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>fl(e,t)};function pl(e,t){return pe.parseTextSync?.(e,t)}var am={...Pr,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>pl(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>pl(e,t)};function hm(e,t){let{type:n="auto"}=e,r=n==="auto"?Fb(e.url,t):Nb(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function Nb(e,t){for(let n of t)if(n.type===e)return n;return null}function Fb(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var lm="4.2.1";var Db=globalThis.loaders?.parseImageNode,ul=typeof Image<"u",dl=typeof ImageBitmap<"u",Ub=Boolean(Db),ml=qs?!0:Ub;function fm(e){switch(e){case"auto":return dl||ul||ml;case"imagebitmap":return dl;case"image":return ul;case"data":return ml;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function pm(){if(dl)return"imagebitmap";if(ul)return"image";if(ml)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function um(e){let t=Gb(e);if(!t)throw new Error("Not an image");return t}function Qs(e){switch(um(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Gb(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 zb=/^data:image\/svg\+xml/,Vb=/\.svg((\?|#).*)?$/;function Oo(e){return e&&(zb.test(e)||Vb.test(e))}function dm(e,t){if(Oo(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return gl(e,t)}function gl(e,t){if(Oo(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function vo(e,t,n){let r=dm(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await qb(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function qb(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var kb={},mm=!0;async function gm(e,t,n){let r;Oo(n)?r=await vo(e,t,n):r=gl(e,n);let s=t&&t.imagebitmap;return await Hb(r,s)}async function Hb(e,t=null){if((Yb(t)||!mm)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),mm=!1}return await createImageBitmap(e)}function Yb(e){for(let t in e||kb)return!1;return!0}function xm(e){return!Xb(e,"ftyp",4)||!(e[8]&96)?null:Wb(e)}function Wb(e){switch(Jb(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Jb(e,t,n){return String.fromCharCode(...e.slice(t,n))}function jb(e){return[...e].map(t=>t.charCodeAt(0))}function Xb(e,t,n=0){let r=jb(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Re=!1,Zs=!0;function Hn(e){let t=$s(e);return Qb(t)||tw(t)||Zb(t)||$b(t)||Kb(t)}function Kb(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=xm(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Qb(e){let t=$s(e);return t.byteLength>=24&&t.getUint32(0,Re)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Re),height:t.getUint32(20,Re)}:null}function Zb(e){let t=$s(e);return t.byteLength>=10&&t.getUint32(0,Re)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Zs),height:t.getUint16(8,Zs)}:null}function $b(e){let t=$s(e);return t.byteLength>=14&&t.getUint16(0,Re)===16973&&t.getUint32(2,Zs)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Zs),height:t.getUint32(22,Zs)}:null}function tw(e){let t=$s(e);if(!(t.byteLength>=3&&t.getUint16(0,Re)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=ew(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Re);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Re),width:t.getUint16(i+7,Re)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Re)}return null}function ew(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function $s(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 Mm(e,t){let{mimeType:n}=Hn(e)||{},r=globalThis.loaders?.parseImageNode;return q(r),await r(e,n)}async function Am(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=nw(s),c;switch(o){case"imagebitmap":c=await gm(e,t,i);break;case"image":c=await vo(e,t,i);break;case"data":c=await Mm(e,t);break;default:q(!1)}return s==="data"&&(c=Qs(c)),c}function nw(e){switch(e){case"auto":case"data":return pm();default:return fm(e),e}}var rw=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],sw=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],iw={image:{type:"auto",decode:!0}},ln={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:lm,mimeTypes:sw,extensions:rw,parse:Am,tests:[e=>Boolean(Hn(new DataView(e)))],options:iw};var xl={};function Ml(e){if(xl[e]===void 0){let t=qs?cw(e):ow(e);xl[e]=t}return xl[e]}function ow(e){let t=["image/png","image/jpeg","image/gif"],n=globalThis.loaders?.imageFormatsNode||t,r=globalThis.loaders?.parseImageNode;return Boolean(r)&&n.includes(e)}function cw(e){switch(e){case"image/avif":case"image/webp":return aw(e);default:return!0}}function aw(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var ym={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Al(e)},Al=class extends te{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(t){super(t),this.url=t.url,this.data=t.url,this.substituteCRS84=t.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,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await Pr.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(t,n){let r=this.getMapURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await ln.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await cm.parse(i,this.loadOptions)}async getFeatureInfoText(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(t,n){let r=this.describeLayerURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await am.parse(i,this.loadOptions)}async getLegendGraphic(t,n){let r=this.getLegendGraphicURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await ln.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={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",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let{boundingBox:r,bbox:s}=t;t.bbox=r?[...r[0],...r[1]]:s;let i={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",i,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[c,a]=o.split("=");i[c]=a}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},c=["transparent","time","elevation"];for(let[a,h]of Object.entries(o))(!c.includes(a)||h)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(a,h,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;case"x":r.version==="1.3.0"&&(t="i");break;case"y":r.version==="1.3.0"&&(t="j");break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||js.mimeTypes.includes(r)){let s=nl(this.loadOptions,{wms:{throwOnError:!0}}),i=js.parseSync?.(n,s);throw new Error(i)}}_parseError(t){let n=js.parseSync?.(t,this.loadOptions);return new Error(n)}};var Or=class extends te{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await ln.parse(i)}getGranularParameters(t){let[[n,r],[s,i]]=t.boundingBox;return{...t,east:n,north:r,south:i,west:s}}getURLFromTemplate(t){let n=this.props.url;for(let[r,s]of Object.entries(t))n=n.replace(`\${${r}}`,String(s)),n=n.replace(`{${r}}`,String(s));return n}};gr(Or,"type","template"),gr(Or,"testURL",t=>t.toLowerCase().includes("{"));var yl=class extends Or{data;constructor(t){super(t),this.data=t.url}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.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,c]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(c)?s+=`${o.toUpperCase()}=${c.join(",")}`:s+=`${o.toUpperCase()}=${c?String(c):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},Em={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new yl(e)};var hw=[ym,Em];function El(e){return hm(e,hw)}function No(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var ue=Math.PI,Cm=ue/4,Tm=ue/180,_m=180/ue,Fo=512;function Ue(e){let[t,n]=e;No(Number.isFinite(t)),No(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*Tm,s=n*Tm,i=Fo*(r+ue)/(2*ue),o=Fo*(ue+Math.log(Math.tan(Cm+s*.5)))/(2*ue);return[i,o]}function Ge(e){let[t,n]=e,r=t/Fo*(2*ue)-ue,s=2*(Math.atan(Math.exp(n/Fo*(2*ue)-ue))-Cm);return[r*_m,s*_m]}var Jq=Math.PI/180;var Lm=6378137*Math.PI;function Tl(e){let t=Ue(e);return t[0]=(t[0]/256-1)*Lm,t[1]=(t[1]/256-1)*Lm,t}var Cw={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)}},vr=class extends Yn.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:n,oldProps:r}){let{viewport:s}=this.context;t.dataChanged||n.serviceType!==r.serviceType?(this.state.imageSource=this._createImageSource(n),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,Yn._deepEqual)(n.layers,r.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:n,lastRequestParameters:r}=this.state;return n&&new Rm.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?Yn.COORDINATE_SYSTEM.LNGLAT:Yn.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof te)return t.data;if(typeof t.data=="string")return El({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 n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:c}=t,a=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=t.resolution?"EPSG:4326":"EPSG:3857");let l={width:o,height:c,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:h};if(h==="EPSG:3857"){let f=Tl([i[0],i[1]]),p=Tl([i[2],i[3]]);l.boundingBox=[f,p]}try{this.state.loadCounter++,this.props.onImageLoadStart(a);let f=await this.state.imageSource.getImage(l);this.state.lastRequestId<a&&(this.getCurrentLayer()?.props.onImageLoad(a),this.setState({image:f,bounds:i,lastRequestParameters:l,lastRequestId:a}))}catch(f){this.raiseError(f,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(a,f)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}};vr.layerName="WMSLayer";vr.defaultProps=Cw;var bm=G(he(),1),Bw={getHeight:{type:"accessor",value:0},greatCircle:!0},ti=class extends bm.ArcLayer{};ti.layerName="GreatCircleLayer";ti.defaultProps=Bw;var wm=ti;var Do=G(_l(),1),Lw=3,Rw=30,bw=2*Rw+1,Pm=180/Math.PI;function vm(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Om(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Nm(e){return[Om(e[0]),Om(e[1])]}function Fm(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function Dm([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Pm,r*Pm]}function Um(e){let t=Do.default.fromString(e,!0,10).toString(2);for(;t.length<Lw+bw;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Do.default.fromString(r,!0,2).toString(10),c=Do.default.fromString(s,!0,2).toString(4);for(;c.length<i;)c="0"+c;return`${o}/${c}`}function ww(e,t,n,r){if(r===0){n===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 Gm(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let c=s-1;c>=0;c--){o=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,o-1);ww(f,i,h,l),i[0]+=f*h,i[1]+=f*l}if(n%2===1){let c=i[0];i[0]=i[1],i[1]=c}return{face:n,ij:i,level:o}}var zm=G(_l(),1);function Iw(e){let t=e.padEnd(16,"0");return zm.default.fromString(t,16)}var Pw=100;function Ow({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil(Pw*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,c=0;for(let a=0;a<4;a++){let h=r[a].slice(0),l=r[a+1],f=(l[0]-h[0])/s,p=(l[1]-h[1])/s;for(let u=0;u<s;u++){h[0]+=f,h[1]+=p;let d=vm(t,n,h),g=Nm(d),m=Fm(e,g),M=Dm(m);Math.abs(M[1])>89.999&&(M[0]=c);let E=M[0]-c;M[0]+=E>180?-360:E<-180?360:0,i[o++]=M[0],i[o++]=M[1],c=M[0]}}return i[o++]=i[0],i[o++]=i[1],i}function vw(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Iw(e)}return Um(e.toString())}function Vm(e){let t=vw(e),n=Gm(t);return Ow(n)}var Nw={getS2Token:{type:"accessor",value:e=>e.token}},ni=class extends $t{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Vm(n(r,s))}}};ni.layerName="S2Layer";ni.defaultProps=Nw;var qm=ni;var Sl=512;function Fw(e,t){let n=0,r=0,s=1<<e.length,i=s/Sl;for(let o=0;o<e.length;o++){s>>=1;let c=parseInt(e[o]);c%2&&(n|=s),c>1&&(r|=s)}return[[n/i,Sl-r/i],[(n+t)/i,Sl-(r+t)/i]]}function km(e,t=1){let[n,r]=Fw(e,t),[s,i]=Ge(n),[o,c]=Ge(r);return[o,i,o,c,s,c,s,i,o,i]}var Dw={getQuadkey:{type:"accessor",value:e=>e.quadkey}},ri=class extends $t{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>km(r(i,o),s),updateTriggers:{getPolygon:s}}}};ri.layerName="QuadkeyLayer";ri.defaultProps=Dw;var Hm=ri;var Ho=G(le(),1),ag=G(he(),1);var Wn=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:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:c,userData:a,zoom:h}=this,l=this._loaderId;this._abortController=new AbortController;let{signal:f}=this._abortController,p=await n.scheduleRequest(this,g=>g.isSelected?1:-1);if(!p){this._isCancelled=!0;return}if(this._isCancelled){p.done();return}let u=null,d;try{u=await t({index:i,id:o,bbox:c,userData:a,zoom:h,signal:f})}catch(g){d=g||!0}finally{p.done()}if(l===this._loaderId){if(this._loader=void 0,this.content=u,this._isCancelled&&!u){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,d?s(d,this):r(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 ii=G(le(),1);var gt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Ym=new O,Uw=new O,fn=class{constructor(t=[0,0,0],n=[0,0,0],r){r=r||Ym.copy(t).add(n).scale(.5),this.center=new O(r),this.halfDiagonal=new O(n).subtract(this.center),this.minimum=new O(t),this.maximum=new O(n)}clone(){return new fn(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:n}=this,r=Uw.from(t.normal),s=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),i=this.center.dot(r)+t.distance;return i-s>0?gt.INSIDE:i+s<0?gt.OUTSIDE:gt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Ym.from(t).subtract(this.center),{halfDiagonal:r}=this,s=0,i;return i=Math.abs(n.x)-r.x,i>0&&(s+=i*i),i=Math.abs(n.y)-r.y,i>0&&(s+=i*i),i=Math.abs(n.z)-r.z,i>0&&(s+=i*i),s}};var si=new O,Wm=new O,pn=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new O,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=si.from(n),this.center=new O().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new pn(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=si.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return Wm.copy(o).scale((-r+a)/c).add(n),this.center.copy(Wm),this.radius=a,this}expand(t){let r=si.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Fs.getScaling(si,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=si.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?gt.OUTSIDE:i<r?gt.INTERSECTING:gt.INSIDE}};var Gw=new O,zw=new O,Uo=new O,Go=new O,zo=new O,Vw=new O,qw=new O,ze={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Jn=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new O().from(t),this.halfAxes=new ht(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new O(t).len(),new O(n).len(),new O(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new O(t).normalize(),i=new O(n).normalize(),o=new O(r).normalize();return new Lr().fromMatrix3(new ht([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Lr(r),i=new ht().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new O().from(t),this.halfAxes=i,this}clone(){return new Jn(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new pn){let n=this.halfAxes,r=n.getColumn(0,Uo),s=n.getColumn(1,Go),i=n.getColumn(2,zo),o=Gw.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[ze.COLUMN0ROW0]+o*s[ze.COLUMN0ROW1]+c*s[ze.COLUMN0ROW2])+Math.abs(i*s[ze.COLUMN1ROW0]+o*s[ze.COLUMN1ROW1]+c*s[ze.COLUMN1ROW2])+Math.abs(i*s[ze.COLUMN2ROW0]+o*s[ze.COLUMN2ROW1]+c*s[ze.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?gt.OUTSIDE:h>=a?gt.INSIDE:gt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=zw.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Uo),i=r.getColumn(1,Go),o=r.getColumn(2,zo),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,Uo),h=c.getColumn(1,Go),l=c.getColumn(2,zo),f=Vw.copy(a).add(h).add(l).add(o),p=qw.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Uo);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Go);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,zo);return s.transformAsPoint(t),this.halfAxes=new ht([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var Jm=new O,jm=new O,de=class{constructor(t=[0,0,1],n=0){this.normal=new O,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return Se(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=Jm.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),Se(_e(this.normal.len(),1)),this.distance=s,this}clone(){return new de(this.normal,this.distance)}equals(t){return _e(this.distance,t.distance)&&_e(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=jm.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=Jm.from(t),s=this.getPointDistance(r),i=jm.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var Xm=[new O([1,0,0]),new O([0,1,0]),new O([0,0,1])],Km=new O,kw=new O,Yt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Xm.length;let n=t.center,r=t.radius,s=0;for(let i of Xm){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new de),c||(c=this.planes[s+1]=new de);let a=Km.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=Km.copy(i).scale(r).add(n),l=kw.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=gt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case gt.OUTSIDE:return gt.OUTSIDE;case gt.INTERSECTING:n=gt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(Se(Number.isFinite(n),"parentPlaneMask is required."),n===Yt.MASK_OUTSIDE||n===Yt.MASK_INSIDE)return n;let r=Yt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===gt.OUTSIDE)return Yt.MASK_OUTSIDE;a===gt.INTERSECTING&&(r|=o)}return r}};Yt.MASK_OUTSIDE=4294967295;Yt.MASK_INSIDE=0;Yt.MASK_INDETERMINATE=2147483647;var h7=new O,l7=new O,f7=new O,p7=new O,u7=new O;var A7=new O,y7=new O,E7=new O,T7=new O,_7=new O,S7=new O,C7=new O,B7=new O,L7=new O,R7=new O,b7=new O,w7=new O;var be=new ht,Yw=new ht,Ww=new ht,Vo=new ht,Qm=new ht;function Ll(e,t={}){let n=Rr.EPSILON20,r=10,s=0,i=0,o=Yw,c=Ww;o.identity(),c.copy(e);let a=n*Jw(c);for(;i<r&&jw(c)>a;)Xw(c,Vo),Qm.copy(Vo).transpose(),c.multiplyRight(Vo),c.multiplyLeft(Qm),o.multiplyRight(Vo),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function Jw(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Cl=[1,0,0],Bl=[2,2,1];function jw(e){let t=0;for(let n=0;n<3;++n){let r=e[be.getElementIndex(Bl[n],Cl[n])];t+=2*r*r}return Math.sqrt(t)}function Xw(e,t){let n=Rr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[be.getElementIndex(Bl[h],Cl[h])]);l>r&&(s=h,r=l)}let i=Cl[s],o=Bl[s],c=1,a=0;if(Math.abs(e[be.getElementIndex(o,i)])>n){let h=e[be.getElementIndex(o,o)],l=e[be.getElementIndex(i,i)],f=e[be.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return ht.IDENTITY.to(t),t[be.getElementIndex(i,i)]=t[be.getElementIndex(o,o)]=c,t[be.getElementIndex(o,i)]=a,t[be.getElementIndex(i,o)]=-a,t}var un=new O,Kw=new O,Qw=new O,Zw=new O,$w=new O,tI=new ht,eI={diagonal:new ht,unitary:new ht};function Rl(e,t=new Jn){if(!e||e.length===0)return t.halfAxes=new ht([0,0,0,0,0,0,0,0,0]),t.center=new O,t;let n=e.length,r=new O(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=un.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=tI;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=Ll(f,eI),u=t.halfAxes.copy(p),d=u.getColumn(0,Qw),g=u.getColumn(1,Zw),m=u.getColumn(2,$w),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)un.copy(S),M=Math.max(un.dot(d),M),E=Math.max(un.dot(g),E),A=Math.max(un.dot(m),A),y=Math.min(un.dot(d),y),T=Math.min(un.dot(g),T),_=Math.min(un.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=Kw.set(M-y,E-T,A-_).multiplyByScalar(.5),C=new ht([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(C),t}var Nr=512,Zm=3,$m=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],tg=$m.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),nI=tg.concat([[.25,.5],[.75,.5]]),dn=class{constructor(t,n,r){this.x=t,this.y=n,this.z=r}get children(){if(!this._children){let t=this.x*2,n=this.y*2,r=this.z+1;this._children=[new dn(t,n,r),new dn(t,n+1,r),new dn(t+1,n,r),new dn(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:c,offset:a,project:h}=t,l=this.getBoundingVolume(s,a,h);if(c&&!this.insideBounds(c)||r.computeVisibility(l)<0)return!1;if(!this.childVisible){let{z:p}=this;if(p<o&&p>=i){let u=l.distanceTo(n.cameraPosition)*n.scale/n.height;p+=Math.floor(Math.log2(u))}if(p>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let p of this.children)p.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=Nr/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let a=this.z<1?nI:this.z<2?tg:$m,h=[];for(let l of a){let f=qo(this.x+l[0],this.y+l[1],this.z);f[2]=t[0],h.push(r(f)),t[0]!==t[1]&&(f[2]=t[1],h.push(r(f)))}return Rl(h)}let s=Math.pow(2,this.z),i=Nr/s,o=this.x*i+n*Nr,c=Nr-(this.y+1)*i;return new fn([o,c,t[0]],[o+i,c+i,t[1]])}};function eg(e,t,n,r){let s=e instanceof ii._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:u,distance:d})=>new de(u.clone().negate(),d)),o=new Yt(i),c=e.distanceScales.unitsPerMeter[2],a=n&&n[0]*c||0,h=n&&n[1]*c||0,l=e instanceof ii.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[u,d,g,m]=r,M=Ue([u,m]),E=Ue([g,d]);r=[M[0],Nr-M[1],E[0],Nr-E[1]]}let f=new dn(0,0,0),p={viewport:e,project:s,cullingVolume:o,elevationBounds:[a,h],minZ:l,maxZ:t,bounds:r,offset:0};if(f.update(p),e instanceof ii.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(p.offset=-1;f.update(p)&&!(--p.offset<-Zm););for(p.offset=1;f.update(p)&&!(++p.offset>Zm););}return f.getSelected()}var Ve=512,rI=[-1/0,-1/0,1/0,1/0],mn={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(n=>typeof n=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}};function rg(e,t){let n=[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(...n.map(s=>s[0])),Math.min(...n.map(s=>s[1])),Math.max(...n.map(s=>s[0])),Math.max(...n.map(s=>s[1]))]}function sI(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function we(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=sI(r)%e.length;e=e[i]}let s=e;for(let i of Object.keys(n)){let o=new RegExp(`{${i}}`,"g");s=s.replace(o,String(n[i]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),s}function iI(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),c=e.getBounds({z:i});r=[Math.min(o[0],c[0]),Math.min(o[1],c[1]),Math.max(o[2],c[2]),Math.max(o[3],c[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function sg({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>bl(s,t||0,n))}function bl(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:c,height:a}=n,h={targetZ:t},l=e.unproject([i,o],h),f=e.unproject([i+c,o],h),p=e.unproject([i,o+a],h),u=e.unproject([i+c,o+a],h);return[Math.min(l[0],f[0],p[0],u[0]),Math.min(l[1],f[1],p[1],u[1]),Math.max(l[0],f[0],p[0],u[0]),Math.max(l[1],f[1],p[1],u[1])]}let r=bl(e,t[0],n),s=bl(e,t[1],n);return[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]}function oI(e,t,n){return n?rg(e,n).map(s=>s*t/Ve):e.map(r=>r*t/Ve)}function wl(e,t){return Math.pow(2,e)*Ve/t}function qo(e,t,n){let r=wl(n,Ve),s=e/r*360-180,i=Math.PI-2*Math.PI*t/r,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function ng(e,t,n,r){let s=wl(n,r);return[e/s*Ve,t/s*Ve]}function Il(e,t,n,r,s=Ve){if(e.isGeospatial){let[h,l]=qo(t,n,r),[f,p]=qo(t+1,n+1,r);return{west:h,north:l,east:f,south:p}}let[i,o]=ng(t,n,r,s),[c,a]=ng(t+1,n+1,r,s);return{left:i,top:o,right:c,bottom:a}}function cI(e,t,n,r,s){let i=iI(e,null,r),o=wl(t,n),[c,a,h,l]=oI(i,o,s),f=[];for(let p=Math.floor(c);p<h;p++)for(let u=Math.floor(a);u<l;u++)f.push({x:p,y:u,z:t});return f}function Pl({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=Ve,modelMatrix:o,modelMatrixInverse:c,zoomOffset:a=0}){let h=e.isGeospatial?Math.round(e.zoom+Math.log2(Ve/i))+a:Math.ceil(e.zoom)+a;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!s)return[];h=n}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let l=s;return o&&c&&s&&!e.isGeospatial&&(l=rg(s,o)),e.isGeospatial?eg(e,h,r,s):cI(e,h,i,l||rI,c)}function Ol(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function vl(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function ig(e){let t={},n;return r=>{for(let s in r)if(!aI(r[s],t[s])){n=e(r),t=r;break}return n}}function aI(e,t){if(e===t)return!0;if(Array.isArray(e)){let n=e.length;if(!t||t.length!==n)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}return!1}var og=1,ko=2,hI="never",lI="no-overlap",oi="best-available",fI=5,pI={[oi]:dI,[lI]:mI,[hI]:()=>{}},uI={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:()=>{}},jn=class{constructor(t){this._getCullBounds=ig(sg),this.opts={...uI,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new an({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 Kt,this._modelMatrixInverse=new Kt}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 n=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(t):n.setNeedsReload()}}update(t,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){let s=r?new Kt(r):new Kt,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!_e(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let c=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=c.map(a=>this._getTile(a,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(c=>this._getTile(c.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){if(!t.isVisible)return!1;if(n&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:s}=t;for(let[i,o,c,a]of r){let h;if("west"in s)h=s.west<c&&s.east>i&&s.south<a&&s.north>o;else{let l=Math.min(s.top,s.bottom),f=Math.max(s.top,s.bottom);h=s.left<c&&s.right>i&&l<a&&f>o}if(h)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:c,extent:a,zoomOffset:h}=this.opts;return Pl({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:c,extent:a,modelMatrix:i,modelMatrixInverse:o,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Il(this._viewport,t.x,t.y,t.z,n)}}getParentIndex(t){let n=Math.floor(t.x/2),r=Math.floor(t.y/2),s=t.z-1;return{x:n,y:r,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||oi,n=new Array(this._cache.size),r=0;for(let s of this._cache.values())n[r++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:pI[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize??(n.maxCacheByteSize!==null?1/0:fI*this.selectedTiles.length),s=n.maxCacheByteSize??1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,c]of t)if(!c.isVisible&&!c.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize!==null?c.byteLength:0,t.delete(o),this.opts.onTileUnload?.(c)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,c)=>o.zoom-c.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new Wn(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:r,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(r,s),this._dirty=!0):s&&s.needsReload&&(i=!0),s&&i&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:n=0}=this,r=t.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);let s=this._getTile(r);if(s)return s}return null}};function dI(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!cg(t)&&Nl(t);for(let t of e)t.isVisible=Boolean(t.state&ko)}function mI(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&cg(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&ko),n.children&&(n.isVisible||n.state&og))for(let r of n.children)r.state=og;else n.isSelected&&Nl(n)}function cg(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=ko,!0;t=t.parent}return!1}function Nl(e){for(let t of e.children)t.isLoaded||t.content?t.state|=ko:Nl(t)}var gI={TilesetClass:jn,data:{type:"data",value:[]},dataComparator:mn.equal,renderSubLayers:{type:"function",value:e=>new ag.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:oi,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},ci=class extends Ho.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(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:c,maxRequests:a,debounceTime:h,zoomOffset:l}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:c,tileSize:t,refinementStrategy:s,extent:i,maxRequests:a,debounceTime:h,zoomOffset:l,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:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,c=this.state.frameNumber!==s;i&&(o||c)&&this._onViewportLoad(),c&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?we(n,t):null,r?r(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let n=t.sourceLayer,r=n.props.tile,s=t.info;return s.picked&&(s.tile=r),s.sourceTile=r,s.sourceTileSubLayer=n,s}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,Ho._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props;return this.state.tileset.isTileVisible(r,n)}};ci.defaultProps=gI;ci.layerName="TileLayer";var Xn=ci;var fg=G(he(),1);var hg=`uniform tripsUniforms {
14
14
  bool fadeTrail;
15
15
  float trailLength;
16
16
  float currentTime;
17
17
  } trips;
18
- `,Km={name:"trips",vs:Xm,fs:Xm,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var $I={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},ii=class extends Qm.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`in float instanceTimestamps;
18
+ `,lg={name:"trips",vs:hg,fs:hg,uniformTypes:{fadeTrail:"f32",trailLength:"f32",currentTime:"f32"}};var xI={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},ai=class extends fg.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,Km],t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props,i={fadeTrail:n,trailLength:r,currentTime:s};this.state.model.shaderInputs.setProps({trips:i}),super.draw(t)}};ii.layerName="TripsLayer";ii.defaultProps=$I;var Zm=ii;var $m=U(so(),1),tg=U(le(),1);var ee=U(so(),1),Go=U(le(),1),oi=U(he(),1);var tb=10;function eb(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var nb={...oi.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},Mn=class extends Go.CompositeLayer{initializeState(){Mn._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:n}){if(t.highPrecision!==!0&&(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagon)){let r=this._calculateH3DataProps();this.setState(r)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,n=!1,r=!1,{iterable:s,objectInfo:i}=(0,Go.createIterable)(this.props.data);for(let o of s){i.index++;let c=this.props.getHexagon(o,i),a=(0,ee.getResolution)(c);if(t<0){if(t=a,!this.props.highPrecision)break}else if(t!==a){r=!0;break}if((0,ee.isPentagon)(c)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,ee.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,ee.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,ee.gridDistance)(s,i)*r<tb)return}catch{}let{unitsPerMeter:o}=t.distanceScales,c=Nh(i),[a,h]=(0,ee.cellToLatLng)(i),[l,f]=t.projectFlat([h,a]);c=c.map(p=>{let u=t.projectFlat(p);return[(u[0]-l)/o[0],(u[1]-f)/o[1]]}),this.setState({centerHex:i,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:c,lineWidthUnits:a,lineWidthScale:h,lineWidthMinPixels:l,lineWidthMaxPixels:f,getFillColor:p,getElevation:u,getLineColor:d,getLineWidth:g,transitions:m,updateTriggers:M}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:c,lineWidthUnits:a,lineWidthScale:h,lineWidthMinPixels:l,lineWidthMaxPixels:f,material:n,getElevation:u,getFillColor:p,getLineColor:d,getLineWidth:g,transitions:m,updateTriggers:{getFillColor:M.getFillColor,getElevation:M.getElevation,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",oi.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=eb(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(c,a)=>{let h=n(c,a);return xo(Nh(h,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",oi.ColumnLayer),i=this._getForwardProps();return i.updateTriggers.getPosition=r.getHexagon,new s(i,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:i.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Hu.bind(null,n)})}};Mn.defaultProps=nb;Mn.layerName="H3HexagonLayer";Mn._checkH3Lib=()=>{};var zo=Mn;var rb={getHexagons:{type:"accessor",value:e=>e.hexagons}},ci=class extends Qt{initializeState(){zo._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:c}=(0,tg.createIterable)(r);for(let a of o){c.index++;let h=s(a,c),l=(0,$m.cellsToMultiPolygon)(h,!0);for(let f of l){for(let p of f)go(p);i.push(this.getSubLayerRow({polygon:f},a,c.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}};ci.layerName="H3ClusterLayer";ci.defaultProps=rb;var eg=ci;var dE=U(Cl(),1),Nn=U(le(),1),mE=U(he(),1),gE=U(qo(),1);var ig=U(Ll(),1),de;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(de||(de={}));function wl(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{camera:[0,0,0],metallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.pbr_diffuseEnvSampler=i.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=i.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=i.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&sb(e,t,s),s}function sb(e,t,n){if(n.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&ib(e,t.pbrMetallicRoughness,n),t.normalTexture){ai(e,t.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.normalScale=r}if(t.occlusionTexture){ai(e,t.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.occlusionStrength=r}switch(t.emissiveTexture&&(ai(e,t.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.emissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.alphaCutoff=r;break;case"BLEND":ig.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=de.FUNC_ADD,n.glParameters.blendFunc=[de.SRC_ALPHA,de.ONE_MINUS_SRC_ALPHA,de.ONE,de.ONE_MINUS_SRC_ALPHA];break}}function ib(e,t,n){t.baseColorTexture&&ai(e,t.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.baseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&ai(e,t.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.metallicRoughnessValues=[r,s]}function ai(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,c,a={};o.compressed?(c=o,a={[de.TEXTURE_MIN_FILTER]:o.data.length>1?de.LINEAR_MIPMAP_NEAREST:de.LINEAR}):c={data:o};let h=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...a},pixelStore:{[de.UNPACK_FLIP_Y_WEBGL]:!1},...c});s.bindings[n]=h,r&&(s.defines[r]=1),s.generatedTextures.push(h)}var og="4.2.1";var Vo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},cg;async function Il(e){Jh(e.modules);let t=jh("basis");return t||(cg||=ob(e),await cg)}async function ob(e){let t=null,n=null;return[t,n]=await Promise.all([await Ce(Vo.TRANSCODER,"textures",e),await Ce(Vo.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await cb(t,n)}function cb(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),r({BasisFile:i})})})}var Rl;async function bl(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Rl=Rl||ab(e),await Rl)}async function ab(e){let t=null,n=null;return[t,n]=await Promise.all([await Ce(Vo.ENCODER,"textures",e),await Ce(Vo.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await hb(t,n)}function hb(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:c,BasisEncoder:a}=s;c(),r({BasisFile:i,KTX2File:o,BasisEncoder:a})})})}var Qn={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 lb=["","WEBKIT_","MOZ_"],ag={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"},ko=null;function hg(e){if(!ko){e=e||fb()||void 0,ko=new Set;for(let t of lb)for(let n in ag)if(e&&e.getExtension(`${t}${n}`)){let r=ag[n];ko.add(r)}}return ko}function fb(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var hH=new Uint8Array([0]);var lg,fg,pg,ug,dg,mg,gg,xg;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(lg||(lg={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(fg||(fg={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(pg||(pg={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(ug||(ug={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(dg||(dg={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(mg||(mg={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(gg||(gg={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(xg||(xg={}));var Kt=[171,75,84,88,32,50,48,187,13,10,26,10];function Mg(e){let t=new Uint8Array(e);return!(t.byteLength<Kt.length||t[0]!==Kt[0]||t[1]!==Kt[1]||t[2]!==Kt[2]||t[3]!==Kt[3]||t[4]!==Kt[4]||t[5]!==Kt[5]||t[6]!==Kt[6]||t[7]!==Kt[7]||t[8]!==Kt[8]||t[9]!==Kt[9]||t[10]!==Kt[10]||t[11]!==Kt[11])}var pb={etc1:{basisFormat:0,compressed:!0,format:Qn.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Qn.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Qn.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:Qn.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Qn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Qn.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 Pl(e,t){if(t.basis.containerFormat==="auto"){if(Mg(e)){let r=await bl(t);return Ag(r.KTX2File,e,t)}let{BasisFile:n}=await Il(t);return Ol(n,e,t)}switch(t.basis.module){case"encoder":let n=await bl(t);switch(t.basis.containerFormat){case"ktx2":return Ag(n.KTX2File,e,t);case"basis":default:return Ol(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await Il(t);return Ol(r,e,t)}}function Ol(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let c=r.getNumLevels(o),a=[];for(let h=0;h<c;h++)a.push(ub(r,o,h,n));i.push(a)}return i}finally{r.close(),r.delete()}}function ub(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:c,format:a,basisFormat:h}=yg(r,o),l=e.getImageTranscodedSizeInBytes(t,n,h),f=new Uint8Array(l);if(!e.transcodeImage(f,t,n,h,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:f,compressed:c,format:a,hasAlpha:o}}function Ag(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),i=[];for(let o=0;o<s;o++){i.push(db(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function db(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:c,basisFormat:a}=yg(n,r),h=e.getImageTranscodedSizeInBytes(t,0,0,a),l=new Uint8Array(h);if(!e.transcodeImage(l,t,0,0,a,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:l,compressed:o,levelSize:h,hasAlpha:r,format:c}}function yg(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=Ho()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),pb[n]}function Ho(){let e=hg();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 Eg={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:og,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"}}},Nl={...Eg,parse:Pl};var _g=U(Ll(),1);var vl=`precision highp int;
29
+ `},t.modules=[...t.modules,lg],t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props,i={fadeTrail:n,trailLength:r,currentTime:s};this.state.model.shaderInputs.setProps({trips:i}),super.draw(t)}};ai.layerName="TripsLayer";ai.defaultProps=xI;var pg=ai;var ug=G(lo(),1),dg=G(le(),1);var ee=G(lo(),1),Yo=G(le(),1),hi=G(he(),1);var MI=10;function AI(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var yI={...hi.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},gn=class extends Yo.CompositeLayer{initializeState(){gn._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:n}){if(t.highPrecision!==!0&&(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagon)){let r=this._calculateH3DataProps();this.setState(r)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,n=!1,r=!1,{iterable:s,objectInfo:i}=(0,Yo.createIterable)(this.props.data);for(let o of s){i.index++;let c=this.props.getHexagon(o,i),a=(0,ee.getResolution)(c);if(t<0){if(t=a,!this.props.highPrecision)break}else if(t!==a){r=!0;break}if((0,ee.isPentagon)(c)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,ee.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,ee.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,ee.gridDistance)(s,i)*r<MI)return}catch{}let{unitsPerMeter:o}=t.distanceScales,c=Hh(i),[a,h]=(0,ee.cellToLatLng)(i),[l,f]=t.projectFlat([h,a]);c=c.map(p=>{let u=t.projectFlat(p);return[(u[0]-l)/o[0],(u[1]-f)/o[1]]}),this.setState({centerHex:i,vertices:c})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:c,lineWidthUnits:a,lineWidthScale:h,lineWidthMinPixels:l,lineWidthMaxPixels:f,getFillColor:p,getElevation:u,getLineColor:d,getLineWidth:g,transitions:m,updateTriggers:M}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:c,lineWidthUnits:a,lineWidthScale:h,lineWidthMinPixels:l,lineWidthMaxPixels:f,material:n,getElevation:u,getFillColor:p,getLineColor:d,getLineWidth:g,transitions:m,updateTriggers:{getFillColor:M.getFillColor,getElevation:M.getElevation,getLineColor:M.getLineColor,getLineWidth:M.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",hi.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=AI(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(c,a)=>{let h=n(c,a);return _o(Hh(h,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",hi.ColumnLayer),i=this._getForwardProps();return i.updateTriggers.getPosition=r.getHexagon,new s(i,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:i.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:sd.bind(null,n)})}};gn.defaultProps=yI;gn.layerName="H3HexagonLayer";gn._checkH3Lib=()=>{};var Wo=gn;var EI={getHexagons:{type:"accessor",value:e=>e.hexagons}},li=class extends $t{initializeState(){Wo._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:c}=(0,dg.createIterable)(r);for(let a of o){c.index++;let h=s(a,c),l=(0,ug.cellsToMultiPolygon)(h,!0);for(let f of l){for(let p of f)To(p);i.push(this.getSubLayerRow({polygon:f},a,c.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}};li.layerName="H3ClusterLayer";li.defaultProps=EI;var mg=li;var wE=G(Fl(),1),Pn=G(le(),1),IE=G(he(),1),PE=G(Jo(),1);var Mg="4.2.1";var jo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Ag;async function Ul(e){rl(e.modules);let t=sl("basis");return t||(Ag||=TI(e),await Ag)}async function TI(e){let t=null,n=null;return[t,n]=await Promise.all([await Le(jo.TRANSCODER,"textures",e),await Le(jo.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await _I(t,n)}function _I(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),r({BasisFile:i})})})}var Dl;async function Gl(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(Dl=Dl||SI(e),await Dl)}async function SI(e){let t=null,n=null;return[t,n]=await Promise.all([await Le(jo.ENCODER,"textures",e),await Le(jo.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await CI(t,n)}function CI(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:c,BasisEncoder:a}=s;c(),r({BasisFile:i,KTX2File:o,BasisEncoder:a})})})}var Kn={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 BI=["","WEBKIT_","MOZ_"],yg={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"},Xo=null;function Eg(e){if(!Xo){e=e||LI()||void 0,Xo=new Set;for(let t of BI)for(let n in yg)if(e&&e.getExtension(`${t}${n}`)){let r=yg[n];Xo.add(r)}}return Xo}function LI(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var DH=new Uint8Array([0]);var Tg,_g,Sg,Cg,Bg,Lg,Rg,bg;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(Tg||(Tg={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(_g||(_g={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Sg||(Sg={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(Cg||(Cg={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(Bg||(Bg={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Lg||(Lg={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Rg||(Rg={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(bg||(bg={}));var Zt=[171,75,84,88,32,50,48,187,13,10,26,10];function wg(e){let t=new Uint8Array(e);return!(t.byteLength<Zt.length||t[0]!==Zt[0]||t[1]!==Zt[1]||t[2]!==Zt[2]||t[3]!==Zt[3]||t[4]!==Zt[4]||t[5]!==Zt[5]||t[6]!==Zt[6]||t[7]!==Zt[7]||t[8]!==Zt[8]||t[9]!==Zt[9]||t[10]!==Zt[10]||t[11]!==Zt[11])}var RI={etc1:{basisFormat:0,compressed:!0,format:Kn.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Kn.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Kn.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:Kn.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Kn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Kn.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 Vl(e,t){if(t.basis.containerFormat==="auto"){if(wg(e)){let r=await Gl(t);return Ig(r.KTX2File,e,t)}let{BasisFile:n}=await Ul(t);return zl(n,e,t)}switch(t.basis.module){case"encoder":let n=await Gl(t);switch(t.basis.containerFormat){case"ktx2":return Ig(n.KTX2File,e,t);case"basis":default:return zl(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await Ul(t);return zl(r,e,t)}}function zl(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let c=r.getNumLevels(o),a=[];for(let h=0;h<c;h++)a.push(bI(r,o,h,n));i.push(a)}return i}finally{r.close(),r.delete()}}function bI(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:c,format:a,basisFormat:h}=Pg(r,o),l=e.getImageTranscodedSizeInBytes(t,n,h),f=new Uint8Array(l);if(!e.transcodeImage(f,t,n,h,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:f,compressed:c,format:a,hasAlpha:o}}function Ig(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),i=[];for(let o=0;o<s;o++){i.push(wI(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function wI(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:c,basisFormat:a}=Pg(n,r),h=e.getImageTranscodedSizeInBytes(t,0,0,a),l=new Uint8Array(h);if(!e.transcodeImage(l,t,0,0,a,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:l,compressed:o,levelSize:h,hasAlpha:r,format:c}}function Pg(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=Ko()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),RI[n]}function Ko(){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 Og={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:Mg,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"}}},ql={...Og,parse:Vl};var Dg=G(kl(),1);function Fg(e){return{addressModeU:Ng(e.wrapS),addressModeV:Ng(e.wrapT),magFilter:II(e.magFilter),...PI(e.minFilter)}}function Ng(e){switch(e){case 33071:return"clamp-to-edge";case 10497:return"repeat";case 33648:return"mirror-repeat";default:return}}function II(e){switch(e){case 9728:return"nearest";case 9729:return"linear";default:return}}function PI(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 Hl(e,t,n,r){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:i}=r;return i&&(s.bindings.pbr_diffuseEnvSampler=i.diffuseEnvSampler.texture,s.bindings.pbr_specularEnvSampler=i.specularEnvSampler.texture,s.bindings.pbr_BrdfLUT=i.brdfLutTexture.texture,s.uniforms.scaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=!0,s.uniforms.scaleDiffBaseMR=[0,0,0,0],s.uniforms.scaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=!0),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=!0),n.TEXCOORD_0&&(s.defines.HAS_UV=!0),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=!0),r?.lights&&(s.defines.USE_LIGHTS=!0),t&&OI(e,t,s),s}function OI(e,t,n){if(n.uniforms.unlit=Boolean(t.unlit),t.pbrMetallicRoughness&&vI(e,t.pbrMetallicRoughness,n),t.normalTexture){fi(e,t.normalTexture,"pbr_normalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.normalScale=r}if(t.occlusionTexture){fi(e,t.occlusionTexture,"pbr_occlusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.occlusionStrength=r}switch(t.emissiveTexture&&(fi(e,t.emissiveTexture,"pbr_emissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.emissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode||"MASK"){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=!0,n.uniforms.alphaCutoff=r;break;case"BLEND":Dg.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blend=!0,n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=32774,n.glParameters.blendFunc=[770,771,1,771];break}}function vI(e,t,n){t.baseColorTexture&&fi(e,t.baseColorTexture,"pbr_baseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.baseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&fi(e,t.metallicRoughnessTexture,"pbr_metallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.metallicRoughnessValues=[r,s]}function fi(e,t,n,r,s){let i=t.texture.source.image,o;i.compressed?o=i:o={data:i};let c={wrapS:10497,wrapT:10497,...t?.texture?.sampler},a=e.createTexture({id:t.uniformName||t.id,sampler:Fg(c),...o});s.bindings[n]=a,r&&(s.defines[r]=!0),s.generatedTextures.push(a)}var Gg=G(kl(),1);var Yl=`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 {
@@ -100,7 +100,7 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
100
100
  }
101
101
 
102
102
  // #endif
103
- `;var Tg=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
103
+ `;var Ug=`// #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
104
104
  struct AmbientLight {
105
105
  color: vec3<f32>,
106
106
  };
@@ -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 Sg=3,mb=255,li;(function(e){e[e.POINT=0]="POINT",e[e.DIRECTIONAL=1]="DIRECTIONAL"})(li||(li={}));var hi={props:{},uniforms:{},name:"lighting",defines:{MAX_LIGHTS:Sg},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientLightColor:"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:li.POINT,directionalLightCount:0,pointLightCount:0,ambientLightColor:[.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:Tg,vs:vl,fs:vl,getUniforms:gb};function gb(e,t={}){if(e=e&&{...e},!e)return{...hi.defaultUniforms};e.lights&&(e={...e,...Mb(e.lights),lights:void 0});let{ambientLight:n,pointLights:r,directionalLights:s}=e||{};if(!(n||r&&r.length>0||s&&s.length>0))return{...hi.defaultUniforms,enabled:0};let o={...hi.defaultUniforms,...t,...xb({ambientLight:n,pointLights:r,directionalLights:s})};return e.enabled!==void 0&&(o.enabled=e.enabled?1:0),o}function xb({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};r.ambientLightColor=Fl(e);let s=0;for(let i of t){r.lightType=li.POINT;let o=s;r[`lightColor${o}`]=Fl(i),r[`lightPosition${o}`]=i.position,r[`lightAttenuation${o}`]=i.attenuation||[1,0,0],s++}for(let i of n){r.lightType=li.DIRECTIONAL;let o=s;r[`lightColor${o}`]=Fl(i),r[`lightDirection${o}`]=i.direction,s++}return s>Sg&&_g.log.warn("MAX_LIGHTS exceeded")(),r.directionalLightCount=n.length,r.pointLightCount=t.length,r}function Mb(e){let t={pointLights:[],directionalLights:[]};for(let n of e||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return t}function Fl(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/mb)}var Bg=`out vec3 pbr_vPosition;
154
+ `;var NI=5,FI=255,ui;(function(e){e[e.POINT=0]="POINT",e[e.DIRECTIONAL=1]="DIRECTIONAL"})(ui||(ui={}));var pi={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:ui.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:Ug,vs:Yl,fs:Yl,getUniforms:DI};function DI(e,t={}){if(e=e&&{...e},!e)return{...pi.defaultUniforms};e.lights&&(e={...e,...GI(e.lights),lights:void 0});let{ambientLight:n,pointLights:r,directionalLights:s}=e||{};if(!(n||r&&r.length>0||s&&s.length>0))return{...pi.defaultUniforms,enabled:0};let o={...pi.defaultUniforms,...t,...UI({ambientLight:n,pointLights:r,directionalLights:s})};return e.enabled!==void 0&&(o.enabled=e.enabled?1:0),o}function UI({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};r.ambientColor=Wl(e);let s=0;for(let i of t){r.lightType=ui.POINT;let o=s;r[`lightColor${o}`]=Wl(i),r[`lightPosition${o}`]=i.position,r[`lightAttenuation${o}`]=i.attenuation||[1,0,0],s++}for(let i of n){r.lightType=ui.DIRECTIONAL;let o=s;r[`lightColor${o}`]=Wl(i),r[`lightDirection${o}`]=i.direction,s++}return s>NI&&Gg.log.warn("MAX_LIGHTS exceeded")(),r.directionalLightCount=n.length,r.pointLightCount=t.length,r}function GI(e){let t={pointLights:[],directionalLights:[]};for(let n of e||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return t}function Wl(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/FI)}var zg=`out vec3 pbr_vPosition;
155
155
  out vec2 pbr_vUV;
156
156
 
157
157
  #ifdef HAS_NORMALS
@@ -184,7 +184,7 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
184
184
  pbr_vUV = vec2(0.,0.);
185
185
  #endif
186
186
  }
187
- `;var Cg=`precision highp float;
187
+ `,Vg=`precision highp float;
188
188
 
189
189
  uniform pbrMaterialUniforms {
190
190
  // Material is unlit
@@ -585,16 +585,429 @@ vec4 pbr_filterColor(vec4 colorUnused)
585
585
 
586
586
  return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
587
587
  }
588
- `;var Lg=`uniform pbrProjectionUniforms {
588
+ `;var qg=`struct PBRFragmentInputs {
589
+ pbr_vPosition: vec3f,
590
+ pbr_vUV: vec2f,
591
+ pbr_vTBN: mat3f,
592
+ pbr_vNormal: vec3f
593
+ };
594
+
595
+ var fragmentInputs: PBRFragmentInputs;
596
+
597
+ fn pbr_setPositionNormalTangentUV(position: vec4f, normal: vec4f, tangent: vec4f, uv: vec2f)
598
+ {
599
+ var pos: vec4f = pbrProjection.modelMatrix * position;
600
+ pbr_vPosition = vec3(pos.xyz) / pos.w;
601
+
602
+ #ifdef HAS_NORMALS
603
+ #ifdef HAS_TANGENTS
604
+ let normalW: vec3f = normalize(vec3(pbrProjection.normalMatrix * vec4(normal.xyz, 0.0)));
605
+ let tangentW: vec3f = normalize(vec3(pbrProjection.modelMatrix * vec4(tangent.xyz, 0.0)));
606
+ let bitangentW: vec3f = cross(normalW, tangentW) * tangent.w;
607
+ fragmentInputs,pbr_vTBN = mat3(tangentW, bitangentW, normalW);
608
+ #else // HAS_TANGENTS != 1
609
+ fragmentInputs.pbr_vNormal = normalize(vec3(pbrProjection.modelMatrix * vec4(normal.xyz, 0.0)));
610
+ #endif
611
+ #endif
612
+
613
+ #ifdef HAS_UV
614
+ pbr_vUV = uv;
615
+ #else
616
+ pbr_vUV = vec2(0.,0.);
617
+ #endif
618
+ }
619
+
620
+ struct pbrMaterialUniforms {
621
+ // Material is unlit
622
+ unlit: uint32,
623
+
624
+ // Base color map
625
+ baseColorMapEnabled: uint32,
626
+ baseColorFactor: vec4f,
627
+
628
+ normalMapEnabled : uint32,
629
+ normalScale: f32, // #ifdef HAS_NORMALMAP
630
+
631
+ emissiveMapEnabled: uint32,
632
+ emissiveFactor: vec3f, // #ifdef HAS_EMISSIVEMAP
633
+
634
+ metallicRoughnessValues: vec2f,
635
+ metallicRoughnessMapEnabled: uint32,
636
+
637
+ occlusionMapEnabled: i32,
638
+ occlusionStrength: f32, // #ifdef HAS_OCCLUSIONMAP
639
+
640
+ alphaCutoffEnabled: i32,
641
+ alphaCutoff: f32, // #ifdef ALPHA_CUTOFF
642
+
643
+ // IBL
644
+ IBLenabled: i32,
645
+ scaleIBLAmbient: vec2f, // #ifdef USE_IBL
646
+
647
+ // debugging flags used for shader output of intermediate PBR variables
648
+ // #ifdef PBR_DEBUG
649
+ scaleDiffBaseMR: vec4f,
650
+ scaleFGDSpec: vec4f
651
+ // #endif
652
+ }
653
+
654
+ @binding(2) @group(0) var<uniform> material : pbrMaterialUniforms;
655
+
656
+ // Samplers
657
+ #ifdef HAS_BASECOLORMAP
658
+ uniform sampler2D pbr_baseColorSampler;
659
+ #endif
660
+ #ifdef HAS_NORMALMAP
661
+ uniform sampler2D pbr_normalSampler;
662
+ #endif
663
+ #ifdef HAS_EMISSIVEMAP
664
+ uniform sampler2D pbr_emissiveSampler;
665
+ #endif
666
+ #ifdef HAS_METALROUGHNESSMAP
667
+ uniform sampler2D pbr_metallicRoughnessSampler;
668
+ #endif
669
+ #ifdef HAS_OCCLUSIONMAP
670
+ uniform sampler2D pbr_occlusionSampler;
671
+ #endif
672
+ #ifdef USE_IBL
673
+ uniform samplerCube pbr_diffuseEnvSampler;
674
+ uniform samplerCube pbr_specularEnvSampler;
675
+ uniform sampler2D pbr_brdfLUT;
676
+ #endif
677
+
678
+ // Encapsulate the various inputs used by the various functions in the shading equation
679
+ // We store values in this struct to simplify the integration of alternative implementations
680
+ // of the shading terms, outlined in the Readme.MD Appendix.
681
+ struct PBRInfo {
682
+ NdotL: f32, // cos angle between normal and light direction
683
+ NdotV: f32, // cos angle between normal and view direction
684
+ NdotH: f32, // cos angle between normal and half vector
685
+ LdotH: f32, // cos angle between light direction and half vector
686
+ VdotH: f32, // cos angle between view direction and half vector
687
+ perceptualRoughness: f32, // roughness value, as authored by the model creator (input to shader)
688
+ metalness: f32, // metallic value at the surface
689
+ reflectance0: vec3f, // full reflectance color (normal incidence angle)
690
+ reflectance90: vec3f, // reflectance color at grazing angle
691
+ alphaRoughness: f32, // roughness mapped to a more linear change in the roughness (proposed by [2])
692
+ diffuseColor: vec3f, // color contribution from diffuse lighting
693
+ specularColor: vec3f, // color contribution from specular lighting
694
+ n: vec3f, // normal at surface point
695
+ v: vec3f, // vector from surface point to camera
696
+ };
697
+
698
+ const M_PI = 3.141592653589793;
699
+ const c_MinRoughness = 0.04;
700
+
701
+ fn SRGBtoLINEAR(srgbIn: vec4f ) -> vec4f
702
+ {
703
+ #ifdef MANUAL_SRGB
704
+ #ifdef SRGB_FAST_APPROXIMATION
705
+ var linOut: vec3f = pow(srgbIn.xyz,vec3(2.2));
706
+ #else // SRGB_FAST_APPROXIMATION
707
+ var bLess: vec3f = step(vec3(0.04045),srgbIn.xyz);
708
+ var linOut: vec3f = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
709
+ #endif //SRGB_FAST_APPROXIMATION
710
+ return vec4f(linOut,srgbIn.w);;
711
+ #else //MANUAL_SRGB
712
+ return srgbIn;
713
+ #endif //MANUAL_SRGB
714
+ }
715
+
716
+ // Find the normal for this fragment, pulling either from a predefined normal map
717
+ // or from the interpolated mesh normal and tangent attributes.
718
+ fn getNormal() -> vec3f
719
+ {
720
+ // Retrieve the tangent space matrix
721
+ #ifndef HAS_TANGENTS
722
+ var pos_dx: vec3f = dFdx(pbr_vPosition);
723
+ var pos_dy: vec3f = dFdy(pbr_vPosition);
724
+ var tex_dx: vec3f = dFdx(vec3(pbr_vUV, 0.0));
725
+ var tex_dy: vec3f = dFdy(vec3(pbr_vUV, 0.0));
726
+ var t: vec3f = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
727
+
728
+ #ifdef HAS_NORMALS
729
+ var ng: vec3f = normalize(pbr_vNormal);
730
+ #else
731
+ var ng: vec3f = cross(pos_dx, pos_dy);
732
+ #endif
733
+
734
+ t = normalize(t - ng * dot(ng, t));
735
+ var b: vec3f = normalize(cross(ng, t));
736
+ var tbn: mat3f = mat3f(t, b, ng);
737
+ #else // HAS_TANGENTS
738
+ var tbn: mat3f = pbr_vTBN;
739
+ #endif
740
+
741
+ #ifdef HAS_NORMALMAP
742
+ vec3 n = texture(pbr_normalSampler, pbr_vUV).rgb;
743
+ n = normalize(tbn * ((2.0 * n - 1.0) * vec3(pbrMaterial.normalScale, pbrMaterial.normalScale, 1.0)));
744
+ #else
745
+ // The tbn matrix is linearly interpolated, so we need to re-normalize
746
+ vec3 n = normalize(tbn[2].xyz);
747
+ #endif
748
+
749
+ return n;
750
+ }
751
+
752
+ // Calculation of the lighting contribution from an optional Image Based Light source.
753
+ // Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
754
+ // See our README.md on Environment Maps [3] for additional discussion.
755
+ #ifdef USE_IBL
756
+ fn getIBLContribution(PBRInfo pbrInfo, vec3 n, vec3 reflection) -> vec3f
757
+ {
758
+ float mipCount = 9.0; // resolution of 512x512
759
+ float lod = (pbrInfo.perceptualRoughness * mipCount);
760
+ // retrieve a scale and bias to F0. See [1], Figure 3
761
+ vec3 brdf = SRGBtoLINEAR(texture(pbr_brdfLUT,
762
+ vec2(pbrInfo.NdotV, 1.0 - pbrInfo.perceptualRoughness))).rgb;
763
+ vec3 diffuseLight = SRGBtoLINEAR(texture(pbr_diffuseEnvSampler, n)).rgb;
764
+
765
+ #ifdef USE_TEX_LOD
766
+ vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection, lod)).rgb;
767
+ #else
768
+ vec3 specularLight = SRGBtoLINEAR(texture(pbr_specularEnvSampler, reflection)).rgb;
769
+ #endif
770
+
771
+ vec3 diffuse = diffuseLight * pbrInfo.diffuseColor;
772
+ vec3 specular = specularLight * (pbrInfo.specularColor * brdf.x + brdf.y);
773
+
774
+ // For presentation, this allows us to disable IBL terms
775
+ diffuse *= pbrMaterial.scaleIBLAmbient.x;
776
+ specular *= pbrMaterial.scaleIBLAmbient.y;
777
+
778
+ return diffuse + specular;
779
+ }
780
+ #endif
781
+
782
+ // Basic Lambertian diffuse
783
+ // Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
784
+ // See also [1], Equation 1
785
+ fn diffuse(pbrInfo: PBRInfo) -> vec3<f32> {
786
+ return pbrInfo.diffuseColor / PI;
787
+ }
788
+
789
+ // The following equation models the Fresnel reflectance term of the spec equation (aka F())
790
+ // Implementation of fresnel from [4], Equation 15
791
+ fn specularReflection(pbrInfo: PBRInfo) -> vec3<f32> {
792
+ return pbrInfo.reflectance0 +
793
+ (pbrInfo.reflectance90 - pbrInfo.reflectance0) *
794
+ pow(clamp(1.0 - pbrInfo.VdotH, 0.0, 1.0), 5.0);
795
+ }
796
+
797
+ // This calculates the specular geometric attenuation (aka G()),
798
+ // where rougher material will reflect less light back to the viewer.
799
+ // This implementation is based on [1] Equation 4, and we adopt their modifications to
800
+ // alphaRoughness as input as originally proposed in [2].
801
+ fn geometricOcclusion(pbrInfo: PBRInfo) -> f32 {
802
+ let NdotL: f32 = pbrInfo.NdotL;
803
+ let NdotV: f32 = pbrInfo.NdotV;
804
+ let r: f32 = pbrInfo.alphaRoughness;
805
+
806
+ let attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
807
+ let attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
808
+ return attenuationL * attenuationV;
809
+ }
810
+
811
+ // The following equation(s) model the distribution of microfacet normals across
812
+ // the area being drawn (aka D())
813
+ // Implementation from "Average Irregularity Representation of a Roughened Surface
814
+ // for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
815
+ // Follows the distribution function recommended in the SIGGRAPH 2013 course notes
816
+ // from EPIC Games [1], Equation 3.
817
+ fn microfacetDistribution(pbrInfo: PBRInfo) -> f32 {
818
+ let roughnessSq = pbrInfo.alphaRoughness * pbrInfo.alphaRoughness;
819
+ let f = (pbrInfo.NdotH * roughnessSq - pbrInfo.NdotH) * pbrInfo.NdotH + 1.0;
820
+ return roughnessSq / (PI * f * f);
821
+ }
822
+
823
+ fn PBRInfo_setAmbientLight(pbrInfo: ptr<function, PBRInfo>) {
824
+ (*pbrInfo).NdotL = 1.0;
825
+ (*pbrInfo).NdotH = 0.0;
826
+ (*pbrInfo).LdotH = 0.0;
827
+ (*pbrInfo).VdotH = 1.0;
828
+ }
829
+
830
+ fn PBRInfo_setDirectionalLight(pbrInfo: ptr<function, PBRInfo>, lightDirection: vec3<f32>) {
831
+ let n = (*pbrInfo).n;
832
+ let v = (*pbrInfo).v;
833
+ let l = normalize(lightDirection); // Vector from surface point to light
834
+ let h = normalize(l + v); // Half vector between both l and v
835
+
836
+ (*pbrInfo).NdotL = clamp(dot(n, l), 0.001, 1.0);
837
+ (*pbrInfo).NdotH = clamp(dot(n, h), 0.0, 1.0);
838
+ (*pbrInfo).LdotH = clamp(dot(l, h), 0.0, 1.0);
839
+ (*pbrInfo).VdotH = clamp(dot(v, h), 0.0, 1.0);
840
+ }
841
+
842
+ fn PBRInfo_setPointLight(pbrInfo: ptr<function, PBRInfo>, pointLight: PointLight) {
843
+ let light_direction = normalize(pointLight.position - pbr_vPosition);
844
+ PBRInfo_setDirectionalLight(pbrInfo, light_direction);
845
+ }
846
+
847
+ fn calculateFinalColor(pbrInfo: PBRInfo, lightColor: vec3<f32>) -> vec3<f32> {
848
+ // Calculate the shading terms for the microfacet specular shading model
849
+ let F = specularReflection(pbrInfo);
850
+ let G = geometricOcclusion(pbrInfo);
851
+ let D = microfacetDistribution(pbrInfo);
852
+
853
+ // Calculation of analytical lighting contribution
854
+ let diffuseContrib = (1.0 - F) * diffuse(pbrInfo);
855
+ let specContrib = F * G * D / (4.0 * pbrInfo.NdotL * pbrInfo.NdotV);
856
+ // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
857
+ return pbrInfo.NdotL * lightColor * (diffuseContrib + specContrib);
858
+ }
859
+
860
+ fn pbr_filterColor(colorUnused: vec4<f32>) -> vec4<f32> {
861
+ // The albedo may be defined from a base texture or a flat color
862
+ var baseColor: vec4<f32>;
863
+ #ifdef HAS_BASECOLORMAP
864
+ baseColor = SRGBtoLINEAR(textureSample(pbr_baseColorSampler, pbr_baseColorSampler, pbr_vUV)) * pbrMaterial.baseColorFactor;
865
+ #else
866
+ baseColor = pbrMaterial.baseColorFactor;
867
+ #endif
868
+
869
+ #ifdef ALPHA_CUTOFF
870
+ if (baseColor.a < pbrMaterial.alphaCutoff) {
871
+ discard;
872
+ }
873
+ #endif
874
+
875
+ var color = vec3<f32>(0.0, 0.0, 0.0);
876
+
877
+ if (pbrMaterial.unlit) {
878
+ color = baseColor.rgb;
879
+ } else {
880
+ // Metallic and Roughness material properties are packed together
881
+ // In glTF, these factors can be specified by fixed scalar values
882
+ // or from a metallic-roughness map
883
+ var perceptualRoughness = pbrMaterial.metallicRoughnessValues.y;
884
+ var metallic = pbrMaterial.metallicRoughnessValues.x;
885
+ #ifdef HAS_METALROUGHNESSMAP
886
+ // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
887
+ // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
888
+ let mrSample = textureSample(pbr_metallicRoughnessSampler, pbr_metallicRoughnessSampler, pbr_vUV);
889
+ perceptualRoughness = mrSample.g * perceptualRoughness;
890
+ metallic = mrSample.b * metallic;
891
+ #endif
892
+ perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
893
+ metallic = clamp(metallic, 0.0, 1.0);
894
+ // Roughness is authored as perceptual roughness; as is convention,
895
+ // convert to material roughness by squaring the perceptual roughness [2].
896
+ let alphaRoughness = perceptualRoughness * perceptualRoughness;
897
+
898
+ let f0 = vec3<f32>(0.04);
899
+ var diffuseColor = baseColor.rgb * (vec3<f32>(1.0) - f0);
900
+ diffuseColor *= 1.0 - metallic;
901
+ let specularColor = mix(f0, baseColor.rgb, metallic);
902
+
903
+ // Compute reflectance.
904
+ let reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
905
+
906
+ // For typical incident reflectance range (between 4% to 100%) set the grazing
907
+ // reflectance to 100% for typical fresnel effect.
908
+ // For very low reflectance range on highly diffuse objects (below 4%),
909
+ // incrementally reduce grazing reflectance to 0%.
910
+ let reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
911
+ let specularEnvironmentR0 = specularColor;
912
+ let specularEnvironmentR90 = vec3<f32>(1.0, 1.0, 1.0) * reflectance90;
913
+
914
+ let n = getNormal(); // normal at surface point
915
+ let v = normalize(pbrProjection.camera - pbr_vPosition); // Vector from surface point to camera
916
+
917
+ let NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
918
+ let reflection = -normalize(reflect(v, n));
919
+
920
+ var pbrInfo = PBRInfo(
921
+ 0.0, // NdotL
922
+ NdotV,
923
+ 0.0, // NdotH
924
+ 0.0, // LdotH
925
+ 0.0, // VdotH
926
+ perceptualRoughness,
927
+ metallic,
928
+ specularEnvironmentR0,
929
+ specularEnvironmentR90,
930
+ alphaRoughness,
931
+ diffuseColor,
932
+ specularColor,
933
+ n,
934
+ v
935
+ );
936
+
937
+ #ifdef USE_LIGHTS
938
+ // Apply ambient light
939
+ PBRInfo_setAmbientLight(&pbrInfo);
940
+ color += calculateFinalColor(pbrInfo, lighting.ambientColor);
941
+
942
+ // Apply directional light
943
+ for (var i = 0; i < lighting.directionalLightCount; i++) {
944
+ if (i < lighting.directionalLightCount) {
945
+ PBRInfo_setDirectionalLight(&pbrInfo, lighting_getDirectionalLight(i).direction);
946
+ color += calculateFinalColor(pbrInfo, lighting_getDirectionalLight(i).color);
947
+ }
948
+ }
949
+
950
+ // Apply point light
951
+ for (var i = 0; i < lighting.pointLightCount; i++) {
952
+ if (i < lighting.pointLightCount) {
953
+ PBRInfo_setPointLight(&pbrInfo, lighting_getPointLight(i));
954
+ let attenuation = getPointLightAttenuation(lighting_getPointLight(i), distance(lighting_getPointLight(i).position, pbr_vPosition));
955
+ color += calculateFinalColor(pbrInfo, lighting_getPointLight(i).color / attenuation);
956
+ }
957
+ }
958
+ #endif
959
+
960
+ // Calculate lighting contribution from image based lighting source (IBL)
961
+ #ifdef USE_IBL
962
+ if (pbrMaterial.IBLenabled) {
963
+ color += getIBLContribution(pbrInfo, n, reflection);
964
+ }
965
+ #endif
966
+
967
+ // Apply optional PBR terms for additional (optional) shading
968
+ #ifdef HAS_OCCLUSIONMAP
969
+ if (pbrMaterial.occlusionMapEnabled) {
970
+ let ao = textureSample(pbr_occlusionSampler, pbr_occlusionSampler, pbr_vUV).r;
971
+ color = mix(color, color * ao, pbrMaterial.occlusionStrength);
972
+ }
973
+ #endif
974
+
975
+ #ifdef HAS_EMISSIVEMAP
976
+ if (pbrMaterial.emissiveMapEnabled) {
977
+ let emissive = SRGBtoLINEAR(textureSample(pbr_emissiveSampler, pbr_emissiveSampler, pbr_vUV)).rgb * pbrMaterial.emissiveFactor;
978
+ color += emissive;
979
+ }
980
+ #endif
981
+
982
+ // This section uses mix to override final color for reference app visualization
983
+ // of various parameters in the lighting equation.
984
+ #ifdef PBR_DEBUG
985
+ // TODO: Figure out how to debug multiple lights
986
+
987
+ // color = mix(color, F, pbr_scaleFGDSpec.x);
988
+ // color = mix(color, vec3(G), pbr_scaleFGDSpec.y);
989
+ // color = mix(color, vec3(D), pbr_scaleFGDSpec.z);
990
+ // color = mix(color, specContrib, pbr_scaleFGDSpec.w);
991
+
992
+ // color = mix(color, diffuseContrib, pbr_scaleDiffBaseMR.x);
993
+ color = mix(color, baseColor.rgb, pbrMaterial.scaleDiffBaseMR.y);
994
+ color = mix(color, vec3<f32>(metallic), pbrMaterial.scaleDiffBaseMR.z);
995
+ color = mix(color, vec3<f32>(perceptualRoughness), pbrMaterial.scaleDiffBaseMR.w);
996
+ #endif
997
+ }
998
+
999
+ return vec4<f32>(pow(color, vec3<f32>(1.0 / 2.2)), baseColor.a);
1000
+ }
1001
+ `;var kg=`uniform pbrProjectionUniforms {
589
1002
  mat4 modelViewProjectionMatrix;
590
1003
  mat4 modelMatrix;
591
1004
  mat4 normalMatrix;
592
1005
  vec3 camera;
593
1006
  } pbrProjection;
594
- `,wg={name:"pbrProjection",vs:Lg,fs:Lg,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var Dl={props:{},uniforms:{},name:"pbrMaterial",dependencies:[hi,wg],vs:Bg,fs:Cg,defines:{LIGHTING_FRAGMENT: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 Pg=U(Cl(),1),Ng=U(qo(),1);var Rg=`uniform meshUniforms {
1007
+ `,Hg={name:"pbrProjection",vs:kg,fs:kg,getUniforms:e=>e,uniformTypes:{modelViewProjectionMatrix:"mat4x4<f32>",modelMatrix:"mat4x4<f32>",normalMatrix:"mat4x4<f32>",camera:"vec3<i32>"}};var Jl={props:{},uniforms:{},name:"pbrMaterial",dependencies:[pi,Hg],source:qg,vs:zg,fs:Vg,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 Xg=G(Fl(),1),Kg=G(Jo(),1);var Yg=`uniform meshUniforms {
595
1008
  bool pickFeatureIds;
596
1009
  } mesh;
597
- `,Ig={name:"mesh",vs:Rg,fs:Rg,uniformTypes:{pickFeatureIds:"f32"}};var bg=`#version 300 es
1010
+ `,Wg={name:"mesh",vs:Yg,fs:Yg,uniformTypes:{pickFeatureIds:"f32"}};var Jg=`#version 300 es
598
1011
  #define SHADER_NAME simple-mesh-layer-vs
599
1012
  in vec3 positions;
600
1013
  in vec3 normals;
@@ -653,7 +1066,7 @@ geometry.uv = pbr_vUV;
653
1066
  #endif
654
1067
  DECKGL_FILTER_COLOR(vColor, geometry);
655
1068
  }
656
- `;var Og=`#version 300 es
1069
+ `;var jg=`#version 300 es
657
1070
  #define SHADER_NAME simple-mesh-layer-fs
658
1071
  precision highp float;
659
1072
  uniform sampler2D sampler;
@@ -682,7 +1095,7 @@ fragColor = vec4(lightColor, color.a * layer.opacity);
682
1095
  #endif
683
1096
  DECKGL_FILTER_COLOR(fragColor, geometry);
684
1097
  }
685
- `;function Ab(e){let t=e.positions||e.POSITION,n=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(n*4).fill(255),normalized:!0})}var yb={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},fi=class extends Ng.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Dl,Ig),{...t,vs:bg,fs:Og}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props,{model:r}=this.state;if(!r)return;let s={pickFeatureIds:Boolean(n)},i={camera:r.uniforms.cameraPosition};r.shaderInputs.setProps({pbrProjection:i,mesh:s}),super.draw(t)}getModel(t){let{id:n}=this.props,r=this.parseMaterial(this.props.pbrMaterial,t);this.setState({parsedPBRMaterial:r});let s=this.getShaders();return Ab(t.attributes),new Pg.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...r?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:r?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s});let{pbr_baseColorSampler:i}=s.bindings,{emptyTexture:o}=this.state,c={sampler:i||o,hasTexture:Boolean(i)},{camera:a,...h}={...s.bindings,...s.uniforms};n.shaderInputs.setProps({simpleMesh:c,pbrMaterial:h})}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return wl(this.context.device,{unlit:r,...t},{NORMAL:n.attributes.normals,TEXCOORD_0:n.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let n=this.props.featureIds,r=new Uint8ClampedArray(n.length*t.size),s=[];for(let i=0;i<n.length;i++)this.encodePickingColor(n[i],s),r[i*3]=s[0],r[i*3+1]=s[1],r[i*3+2]=s[2];t.value=r}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(n=>n.destroy()),this.setState({parsedPBRMaterial:null})}};fi.layerName="MeshLayer";fi.defaultProps=yb;var vg=fi;var xE=U(Nr(),1);var Eb=1/Math.PI*180,ZH=1/180*Math.PI,Tb={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Tb}};var gt=globalThis.mathgl.config;function Ul(e,{precision:t=gt.precision}={}){return e=_b(e),`${parseFloat(e.toPrecision(t))}`}function Ie(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ne(e,t){return Bb(e,n=>n*Eb,t)}function Yo(e,t,n){let r=gt.EPSILON;n&&(gt.EPSILON=n);try{if(e===t)return!0;if(Ie(e)&&Ie(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Yo(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)<=gt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{gt.EPSILON=r}}function _b(e){return Math.round(e/gt.EPSILON)*gt.EPSILON}function Sb(e){return e.clone?e.clone():new Array(e.length)}function Bb(e,t,n){if(Ie(e)){let r=e;n=n||Sb(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var An=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ie(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(gt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Ul(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Yo(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(gt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function Cb(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function W(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function yn(e,t,n=""){if(gt.debug&&!Cb(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Gl(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var vr=class extends An{get x(){return this[0]}set x(t){this[0]=W(t)}get y(){return this[1]}set y(t){this[1]=W(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return W(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return W(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Gl(t>=0&&t<this.ELEMENTS,"index is out of range"),W(this[t])}setComponent(t,n){return Gl(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var It=typeof Float32Array<"u"?Float32Array:Array;var hY=Math.PI/180;function Lb(){let e=new It(2);return It!=Float32Array&&(e[0]=0,e[1]=0),e}function Gg(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function zg(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var lY=function(){let e=Lb();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function qg(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function Wo(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Vg(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function kg(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function Jo(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function zl(){let e=new It(3);return It!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function wb(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function ql(e,t,n){let r=new It(3);return r[0]=e,r[1]=t,r[2]=n,r}function Hg(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Vl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Fr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Dr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function jo(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Xo(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Yg(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Wg(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Jg(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function jg(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Vl(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Xg=wb;var uY=function(){let e=zl();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var kl=[0,0,0],Ko,v=class extends vr{static get ZERO(){return Ko||(Ko=new v(0,0,0),Object.freeze(Ko)),Ko}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ie(t)?this.copy(t):(gt.debug&&(W(t),W(n),W(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return gt.debug&&(W(t.x),W(t.y),W(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]=W(t)}angle(t){return jg(this,t)}cross(t){return Fr(this,this,t),this.check()}rotateX({radians:t,origin:n=kl}){return Yg(this,this,n,t),this.check()}rotateY({radians:t,origin:n=kl}){return Wg(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=kl}){return Jg(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Dr(this,this,t),this.check()}transformAsVector(t){return Wo(this,this,t),this.check()}transformByMatrix3(t){return jo(this,this,t),this.check()}transformByMatrix2(t){return Vg(this,this,t),this.check()}transformByQuaternion(t){return Xo(this,this,t),this.check()}};var Qo,Ur=class extends vr{static get ZERO(){return Qo||(Qo=new Ur(0,0,0,0),Object.freeze(Qo)),Qo}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Ie(t)&&arguments.length===1?this.copy(t):(gt.debug&&(W(t),W(n),W(r),W(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 gt.debug&&(W(t.x),W(t.y),W(t.z),W(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]=W(t)}get w(){return this[3]}set w(t){this[3]=W(t)}transform(t){return Dr(this,this,t),this.check()}transformByMatrix3(t){return Jo(this,this,t),this.check()}transformByMatrix2(t){return kg(this,this,t),this.check()}transformByQuaternion(t){return Xo(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Gr=class extends An{toString(){let t="[";if(gt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=W(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function Kg(){let e=new It(9);return It!=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 Qg(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 Zg(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function $g(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function Hl(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function tx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function ex(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Yl(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 nx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var Wl;(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"})(Wl||(Wl={}));var bb=Object.freeze([1,0,0,0,1,0,0,0,1]),Zn=class extends Gr{static get IDENTITY(){return Pb()}static get ZERO(){return Ob()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Wl}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(bb)}fromObject(t){return this.check()}fromQuaternion(t){return nx(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return $g(this)}transpose(){return Qg(this,this),this.check()}invert(){return Zg(this,this),this.check()}multiplyLeft(t){return Hl(this,t,this),this.check()}multiplyRight(t){return Hl(this,this,t),this.check()}rotate(t){return ex(this,this,t),this.check()}scale(t){return Array.isArray(t)?Yl(this,this,t):Yl(this,this,[t,t]),this.check()}translate(t){return tx(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=Gg(n||[-0,-0],t,this);break;case 3:r=jo(n||[-0,-0,-0],t,this);break;case 4:r=Jo(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return yn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},Zo,$o=null;function Ob(){return Zo||(Zo=new Zn([0,0,0,0,0,0,0,0,0]),Object.freeze(Zo)),Zo}function Pb(){return $o||($o=new Zn,Object.freeze($o)),$o}function Nb(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 rx(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 sx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m,C=E*I-A*R+y*w+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*R+h*w)*C,e[1]=(s*R-r*I-i*w)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*R-c*x+h*B)*C,e[9]=(r*x-n*R-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*w-a*B)*C,e[13]=(n*w-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function ix(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function Jl(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function ox(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function cx(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ax(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,w,R,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,w=i*i*l+a,R=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*w+A*R,e[5]=p*x+m*w+y*R,e[6]=u*x+M*w+T*R,e[7]=d*x+E*w+_*R,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function hx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function lx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function fx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function px(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ux(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function vb(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var dx=vb;function Fb(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var mx=Fb;function gx(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?Nb(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function Db(){let e=new It(4);return It!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function xx(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Mx(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Ax(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function yx(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Ex(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Tx(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function _x(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Sx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function Bx(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var UY=function(){let e=Db();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Kl;(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"})(Kl||(Kl={}));var Gb=45*Math.PI/180,zb=1,jl=.1,Xl=500,qb=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),nt=class extends Gr{static get IDENTITY(){return kb()}static get ZERO(){return Vb()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Kl}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(qb)}fromObject(t){return this.check()}fromQuaternion(t){return px(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=jl,far:c=Xl}=t;return c===1/0?Hb(this,n,r,s,i,o):ux(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return gx(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=jl,far:c=Xl}=t;return mx(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=Gb,aspect:r=zb,focalDistance:s=1,near:i=jl,far:o=Xl}=t;Cx(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Cx(n),dx(this,n,r,s,i),this.check()}determinant(){return ix(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return rx(this,this),this.check()}invert(){return sx(this,this),this.check()}multiplyLeft(t){return Jl(this,t,this),this.check()}multiplyRight(t){return Jl(this,this,t),this.check()}rotateX(t){return hx(this,this,t),this.check()}rotateY(t){return lx(this,this,t),this.check()}rotateZ(t){return fx(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return ax(this,this,t,n),this.check()}scale(t){return cx(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ox(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Sx(n||[-0,-0,-0,-0],t,this),yn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=zg(n||[-0,-0],t,this);break;case 3:s=Dr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return yn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=qg(n||[-0,-0],t,this);break;case 3:r=Wo(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return yn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},tc,ec;function Vb(){return tc||(tc=new nt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(tc)),tc}function kb(){return ec||(ec=new nt,Object.freeze(ec)),ec}function Cx(e){if(e>Math.PI*2)throw Error("expected radians")}function Hb(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Lx(){let e=new It(4);return It!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function wx(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ql(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Zl(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function Rx(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Ix(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function bx(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function Ox(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function ui(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function Px(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function Nx(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function $l(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var vx=xx;var Fx=Mx,Dx=Tx,Ux=_x,Gx=Ax;var zx=yx;var qx=Ex;var Vx=function(){let e=zl(),t=ql(1,0,0),n=ql(0,1,0);return function(r,s,i){let o=Vl(s,i);return o<-.999999?(Fr(e,t,s),Xg(e)<1e-6&&Fr(e,n,s),Hg(e,e),Ql(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Fr(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,qx(r,r))}}(),ZY=function(){let e=Lx(),t=Lx();return function(n,r,s,i,o,c){return ui(e,r,o,c),ui(t,s,i,c),ui(n,e,t,2*c*(1-c)),n}}(),$Y=function(){let e=Kg();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],qx(t,$l(t,e))}}();var Yb=[0,0,0,1],di=class extends An{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 $l(this,t),this.check()}fromAxisRotation(t,n){return Ql(this,t,n),this.check()}identity(){return wx(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=W(t)}get y(){return this[1]}set y(t){this[1]=W(t)}get z(){return this[2]}set z(t){this[2]=W(t)}get w(){return this[3]}set w(t){this[3]=W(t)}len(){return Gx(this)}lengthSquared(){return zx(this)}dot(t){return Dx(this,t)}rotationTo(t,n){return Vx(this,t,n),this.check()}add(t){return vx(this,this,t),this.check()}calculateW(){return Ox(this,this),this.check()}conjugate(){return Nx(this,this),this.check()}invert(){return Px(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(Ux(this,t,n,r),this.check())}multiplyRight(t){return Zl(this,this,t),this.check()}multiplyLeft(t){return Zl(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return Rx(this,this,t),this.check()}rotateY(t){return Ix(this,this,t),this.check()}rotateZ(t){return bx(this,this,t),this.check()}scale(t){return Fx(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=Yb,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return ui(this,s,i,o),this.check()}transformVector4(t,n=new Ur){return Bx(n,t,this),yn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Jb=1/Math.PI*180,jb=1/180*Math.PI,Xb={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Xb}};var xt=globalThis.mathgl.config;function tf(e,{precision:t=xt.precision}={}){return e=Kb(e),`${parseFloat(e.toPrecision(t))}`}function En(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ef(e){return kx(e)}function nf(e){return Hx(e)}function kx(e,t){return Yx(e,n=>n*jb,t)}function Hx(e,t){return Yx(e,n=>n*Jb,t)}function ke(e,t,n){let r=xt.EPSILON;n&&(xt.EPSILON=n);try{if(e===t)return!0;if(En(e)&&En(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!ke(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)<=xt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{xt.EPSILON=r}}function Kb(e){return Math.round(e/xt.EPSILON)*xt.EPSILON}function Qb(e){return e.clone?e.clone():new Array(e.length)}function Yx(e,t,n){if(En(e)){let r=e;n=n||Qb(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var zr=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:En(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(xt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+tf(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!ke(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(xt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function Zb(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function bt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function nc(e,t,n=""){if(xt.debug&&!Zb(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function re(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var rc=class extends zr{get x(){return this[0]}set x(t){this[0]=bt(t)}get y(){return this[1]}set y(t){this[1]=bt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return bt(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return bt(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return re(t>=0&&t<this.ELEMENTS,"index is out of range"),bt(this[t])}setComponent(t,n){return re(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var me=typeof Float32Array<"u"?Float32Array:Array,mi=Math.random;function qr(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var DW=Math.PI/180;function $b(){let e=new me(2);return me!=Float32Array&&(e[0]=0,e[1]=0),e}function Wx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var UW=function(){let e=$b();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function Jx(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function sc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function jx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}var Vr={};Et(Vr,{add:()=>sO,angle:()=>pf,bezier:()=>MO,ceil:()=>iO,clone:()=>tO,copy:()=>nO,create:()=>Xx,cross:()=>of,dist:()=>LO,distance:()=>t2,div:()=>CO,divide:()=>$x,dot:()=>sf,equals:()=>_O,exactEquals:()=>TO,floor:()=>oO,forEach:()=>bO,fromValues:()=>eO,hermite:()=>xO,inverse:()=>uO,len:()=>RO,length:()=>Kx,lerp:()=>mO,max:()=>aO,min:()=>cO,mul:()=>BO,multiply:()=>Zx,negate:()=>pO,normalize:()=>dO,random:()=>AO,rotateX:()=>hf,rotateY:()=>lf,rotateZ:()=>ff,round:()=>hO,scale:()=>lO,scaleAndAdd:()=>fO,set:()=>rO,slerp:()=>gO,sqrDist:()=>wO,sqrLen:()=>IO,squaredDistance:()=>e2,squaredLength:()=>n2,str:()=>EO,sub:()=>SO,subtract:()=>Qx,transformMat3:()=>cf,transformMat4:()=>gi,transformQuat:()=>af,zero:()=>yO});function Xx(){let e=new me(3);return me!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function tO(e){let t=new me(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Kx(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function eO(e,t,n){let r=new me(3);return r[0]=e,r[1]=t,r[2]=n,r}function nO(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function rO(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function sO(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Qx(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Zx(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function $x(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function iO(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function oO(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function cO(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function aO(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function hO(e,t){return e[0]=qr(t[0]),e[1]=qr(t[1]),e[2]=qr(t[2]),e}function lO(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function fO(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function t2(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(n*n+r*r+s*s)}function e2(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function n2(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function pO(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function uO(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function dO(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function sf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function of(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function mO(e,t,n,r){let s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function gO(e,t,n,r){let s=Math.acos(Math.min(Math.max(sf(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,c=Math.sin(r*s)/i;return e[0]=o*t[0]+c*n[0],e[1]=o*t[1]+c*n[1],e[2]=o*t[2]+c*n[2],e}function xO(e,t,n,r,s,i){let o=i*i,c=o*(2*i-3)+1,a=o*(i-2)+i,h=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*c+n[0]*a+r[0]*h+s[0]*l,e[1]=t[1]*c+n[1]*a+r[1]*h+s[1]*l,e[2]=t[2]*c+n[2]*a+r[2]*h+s[2]*l,e}function MO(e,t,n,r,s,i){let o=1-i,c=o*o,a=i*i,h=c*o,l=3*i*c,f=3*a*o,p=a*i;return e[0]=t[0]*h+n[0]*l+r[0]*f+s[0]*p,e[1]=t[1]*h+n[1]*l+r[1]*f+s[1]*p,e[2]=t[2]*h+n[2]*l+r[2]*f+s[2]*p,e}function AO(e,t){t=t===void 0?1:t;let n=mi()*2*Math.PI,r=mi()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function gi(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function cf(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function af(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function hf(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function lf(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ff(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function pf(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&sf(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}function yO(e){return e[0]=0,e[1]=0,e[2]=0,e}function EO(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function TO(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function _O(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))}var SO=Qx,BO=Zx,CO=$x,LO=t2,wO=e2,RO=Kx,IO=n2,bO=function(){let e=Xx();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var uf=[0,0,0],ic,V=class extends rc{static get ZERO(){return ic||(ic=new V(0,0,0),Object.freeze(ic)),ic}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&En(t)?this.copy(t):(xt.debug&&(bt(t),bt(n),bt(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return xt.debug&&(bt(t.x),bt(t.y),bt(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]=bt(t)}angle(t){return pf(this,t)}cross(t){return of(this,this,t),this.check()}rotateX({radians:t,origin:n=uf}){return hf(this,this,n,t),this.check()}rotateY({radians:t,origin:n=uf}){return lf(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=uf}){return ff(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return gi(this,this,t),this.check()}transformAsVector(t){return sc(this,this,t),this.check()}transformByMatrix3(t){return cf(this,this,t),this.check()}transformByMatrix2(t){return jx(this,this,t),this.check()}transformByQuaternion(t){return af(this,this,t),this.check()}};var oc=class extends zr{toString(){let t="[";if(xt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=bt(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function OO(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 r2(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 s2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m,C=E*I-A*R+y*w+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*R+h*w)*C,e[1]=(s*R-r*I-i*w)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*R-c*x+h*B)*C,e[9]=(r*x-n*R-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*w-a*B)*C,e[13]=(n*w-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function i2(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function df(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function o2(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function c2(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function a2(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,w,R,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,w=i*i*l+a,R=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*w+A*R,e[5]=p*x+m*w+y*R,e[6]=u*x+M*w+T*R,e[7]=d*x+E*w+_*R,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function h2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function l2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function f2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function p2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u2(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function PO(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var d2=PO;function NO(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var m2=NO;function g2(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?OO(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function vO(){let e=new me(4);return me!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function x2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}var ZW=function(){let e=vO();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var xf;(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"})(xf||(xf={}));var FO=45*Math.PI/180,DO=1,mf=.1,gf=500,UO=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Tn=class extends oc{static get IDENTITY(){return zO()}static get ZERO(){return GO()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return xf}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(UO)}fromObject(t){return this.check()}fromQuaternion(t){return p2(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=mf,far:c=gf}=t;return c===1/0?qO(this,n,r,s,i,o):u2(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return g2(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=mf,far:c=gf}=t;return m2(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=FO,aspect:r=DO,focalDistance:s=1,near:i=mf,far:o=gf}=t;M2(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return M2(n),d2(this,n,r,s,i),this.check()}determinant(){return i2(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return r2(this,this),this.check()}invert(){return s2(this,this),this.check()}multiplyLeft(t){return df(this,t,this),this.check()}multiplyRight(t){return df(this,this,t),this.check()}rotateX(t){return h2(this,this,t),this.check()}rotateY(t){return l2(this,this,t),this.check()}rotateZ(t){return f2(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return a2(this,this,t,n),this.check()}scale(t){return c2(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return o2(this,this,t),this.check()}transform(t,n){return t.length===4?(n=x2(n||[-0,-0,-0,-0],t,this),nc(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=Wx(n||[-0,-0],t,this);break;case 3:s=gi(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return nc(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=Jx(n||[-0,-0],t,this);break;case 3:r=sc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return nc(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},cc,ac;function GO(){return cc||(cc=new Tn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(cc)),cc}function zO(){return ac||(ac=new Tn,Object.freeze(ac)),ac}function M2(e){if(e>Math.PI*2)throw Error("expected radians")}function qO(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}var _n={};Et(_n,{EPSILON1:()=>VO,EPSILON10:()=>QO,EPSILON11:()=>ZO,EPSILON12:()=>$O,EPSILON13:()=>tP,EPSILON14:()=>eP,EPSILON15:()=>nP,EPSILON16:()=>rP,EPSILON17:()=>sP,EPSILON18:()=>iP,EPSILON19:()=>oP,EPSILON2:()=>kO,EPSILON20:()=>cP,EPSILON3:()=>HO,EPSILON4:()=>YO,EPSILON5:()=>WO,EPSILON6:()=>JO,EPSILON7:()=>jO,EPSILON8:()=>XO,EPSILON9:()=>KO,PI_OVER_FOUR:()=>hP,PI_OVER_SIX:()=>lP,PI_OVER_TWO:()=>aP,TWO_PI:()=>fP});var VO=.1,kO=.01,HO=.001,YO=1e-4,WO=1e-5,JO=1e-6,jO=1e-7,XO=1e-8,KO=1e-9,QO=1e-10,ZO=1e-11,$O=1e-12,tP=1e-13,eP=1e-14,nP=1e-15,rP=1e-16,sP=1e-17,iP=1e-18,oP=1e-19,cP=1e-20,aP=Math.PI/2,hP=Math.PI/4,lP=Math.PI/6,fP=Math.PI*2;var Ye=6356752314245179e-9,pP={radii:[6378137,6378137,Ye],radiiSquared:[6378137*6378137,6378137*6378137,Ye*Ye],oneOverRadii:[1/6378137,1/6378137,1/Ye],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Ye*Ye)],maximumRadius:Math.max(6378137,6378137,Ye),centerToleranceSquared:.1};function hc(e){return e}var wJ=new V;function uP(e,t=[],n=hc){return"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):"x"in e?(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function A2(e,t=[]){return uP(e,t,xt._cartographicRadians?hc:ef)}function dP(e,t,n=hc){return"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):"x"in t?(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function y2(e,t){return dP(e,t,xt._cartographicRadians?hc:nf)}var E2=1e-14,mP=new V,T2={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"}},Mf={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},xi={east:new V,north:new V,up:new V,west:new V,south:new V,down:new V},gP=new V,xP=new V,MP=new V;function Af(e,t,n,r,s,i){let o=T2[t]&&T2[t][n];re(o&&(!r||r===o));let c,a,h,l=mP.copy(s);if(ke(l.x,0,E2)&&ke(l.y,0,E2)){let p=Math.sign(l.z);c=gP.fromArray(Mf[t]),t!=="east"&&t!=="west"&&c.scale(p),a=xP.fromArray(Mf[n]),n!=="east"&&n!=="west"&&a.scale(p),h=MP.fromArray(Mf[r]),r!=="east"&&r!=="west"&&h.scale(p)}else{let{up:p,east:u,north:d}=xi;u.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),d.copy(p).cross(u);let{down:g,west:m,south:M}=xi;g.copy(p).scale(-1),m.copy(u).scale(-1),M.copy(d).scale(-1),c=xi[t],a=xi[n],h=xi[r]}return i[0]=c.x,i[1]=c.y,i[2]=c.z,i[3]=0,i[4]=a.x,i[5]=a.y,i[6]=a.z,i[7]=0,i[8]=h.x,i[9]=h.y,i[10]=h.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}var kr=new V,AP=new V,yP=new V;function _2(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;kr.from(e);let o=kr.x,c=kr.y,a=kr.z,h=r.x,l=r.y,f=r.z,p=o*o*h*h,u=c*c*l*l,d=a*a*f*f,g=p+u+d,m=Math.sqrt(1/g);if(!Number.isFinite(m))return;let M=AP;if(M.copy(e).scale(m),g<i)return M.to(n);let E=s.x,A=s.y,y=s.z,T=yP;T.set(M.x*E*2,M.y*A*2,M.z*y*2);let _=(1-m)*kr.len()/(.5*T.len()),L=0,B,S,x,w;do{_-=L,B=1/(1+_*E),S=1/(1+_*A),x=1/(1+_*y);let R=B*B,I=S*S,C=x*x,P=R*B,k=I*S,z=C*x;w=p*R+u*I+d*C-1;let H=-2*(p*P*E+u*k*A+d*z*y);L=w/H}while(Math.abs(w)>_n.EPSILON12);return kr.scale([B,S,x]).to(n)}var lc=new V,S2=new V,_P=new V,ge=new V,SP=new V,fc=new V,G=class{constructor(t=0,n=0,r=0){this.centerToleranceSquared=_n.EPSILON1,re(t>=0),re(n>=0),re(r>=0),this.radii=new V(t,n,r),this.radiiSquared=new V(t*t,n*n,r*r),this.radiiToTheFourth=new V(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new V(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new V(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),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,n=[0,0,0]){let r=S2,s=_P,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),s.copy(this.radiiSquared).scale(r);let o=Math.sqrt(r.dot(s));return s.scale(1/o),r.scale(i),s.add(r),s.to(n)}cartesianToCartographic(t,n=[0,0,0]){fc.from(t);let r=this.scaleToGeodeticSurface(fc,ge);if(!r)return;let s=this.geodeticSurfaceNormal(r,S2),i=SP;i.copy(fc).subtract(r);let o=Math.atan2(s.y,s.x),c=Math.asin(s.z),a=Math.sign(Vr.dot(i,fc))*Vr.length(i);return y2([o,c,a],n)}eastNorthUpToFixedFrame(t,n=new Tn){return Af(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new Tn){return Af(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return lc.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=A2(t),s=r[0],i=r[1],o=Math.cos(i);return lc.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),lc.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return lc.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return _2(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){ge.from(t);let r=ge.x,s=ge.y,i=ge.z,o=this.oneOverRadiiSquared,c=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return ge.multiplyScalar(c).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return ge.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return ge.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){re(ke(this.radii.x,this.radii.y,_n.EPSILON15)),re(this.radii.z>0),ge.from(t);let s=ge.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return ge.set(0,0,s).to(r)}};G.WGS84=new G(6378137,6378137,Ye);var pc=class{item;previous;next;constructor(t,n,r){this.item=t,this.previous=n,this.next=r}};var uc=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let n=new pc(t,this.tail,null);return this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),++this._length,n}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,n){t!==n&&(this.remove(n),this._insert(t,n))}_insert(t,n){let r=t.next;t.next=n,this.tail===t?this.tail=n:r.previous=n,n.next=r,n.previous=t,++this._length}};var dc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new uc,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,c=s.head;for(;c!==o&&(t.gpuMemoryUsageInBytes>i||r);){let a=c.item;c=c.next,this.unloadTile(t,a,n)}}trim(){this._trimTiles=!0}};function B2(e,t){q(e),q(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new nt(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let f=new nt().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let p=new nt().rotateY(-Math.PI/2);o=o.multiplyRight(p);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let c=new v(i);t.cartesianModelMatrix=o,t.cartesianOrigin=c;let a=G.WGS84.cartesianToCartographic(c,new v),l=G.WGS84.eastNorthUpToFixedFrame(c).invert();t.cartographicModelMatrix=l.multiplyRight(o),t.cartographicOrigin=a,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var St={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var tj=1/Math.PI*180,ej=1/180*Math.PI,BP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...BP}};var Mt=globalThis.mathgl.config;function yf(e,{precision:t=Mt.precision}={}){return e=CP(e),`${parseFloat(e.toPrecision(t))}`}function We(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Sn(e,t,n){let r=Mt.EPSILON;n&&(Mt.EPSILON=n);try{if(e===t)return!0;if(We(e)&&We(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Sn(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)<=Mt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Mt.EPSILON=r}}function CP(e){return Math.round(e/Mt.EPSILON)*Mt.EPSILON}var Bn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:We(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Mt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+yf(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Sn(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Mt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function LP(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function J(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function mc(e,t,n=""){if(Mt.debug&&!LP(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function be(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Hr=class extends Bn{get x(){return this[0]}set x(t){this[0]=J(t)}get y(){return this[1]}set y(t){this[1]=J(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return J(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return J(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return be(t>=0&&t<this.ELEMENTS,"index is out of range"),J(this[t])}setComponent(t,n){return be(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var ht=typeof Float32Array<"u"?Float32Array:Array;var pj=Math.PI/180;function wP(){let e=new ht(2);return ht!=Float32Array&&(e[0]=0,e[1]=0),e}function w2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var uj=function(){let e=wP();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function R2(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function I2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function b2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function gc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function Ef(){let e=new ht(3);return ht!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function RP(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Tf(e,t,n){let r=new ht(3);return r[0]=e,r[1]=t,r[2]=n,r}function O2(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function _f(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Wr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function xc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Mc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Ac(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function P2(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function N2(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function v2(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function F2(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&_f(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var D2=RP;var gj=function(){let e=Ef();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var Sf=[0,0,0],yc,N=class extends Hr{static get ZERO(){return yc||(yc=new N(0,0,0),Object.freeze(yc)),yc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&We(t)?this.copy(t):(Mt.debug&&(J(t),J(n),J(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Mt.debug&&(J(t.x),J(t.y),J(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]=J(t)}angle(t){return F2(this,t)}cross(t){return Wr(this,this,t),this.check()}rotateX({radians:t,origin:n=Sf}){return P2(this,this,n,t),this.check()}rotateY({radians:t,origin:n=Sf}){return N2(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=Sf}){return v2(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return xc(this,this,t),this.check()}transformAsVector(t){return R2(this,this,t),this.check()}transformByMatrix3(t){return Mc(this,this,t),this.check()}transformByMatrix2(t){return I2(this,this,t),this.check()}transformByQuaternion(t){return Ac(this,this,t),this.check()}};var Ec,Jr=class extends Hr{static get ZERO(){return Ec||(Ec=new Jr(0,0,0,0),Object.freeze(Ec)),Ec}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),We(t)&&arguments.length===1?this.copy(t):(Mt.debug&&(J(t),J(n),J(r),J(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 Mt.debug&&(J(t.x),J(t.y),J(t.z),J(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]=J(t)}get w(){return this[3]}set w(t){this[3]=J(t)}transform(t){return xc(this,this,t),this.check()}transformByMatrix3(t){return gc(this,this,t),this.check()}transformByMatrix2(t){return b2(this,this,t),this.check()}transformByQuaternion(t){return Ac(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Tc=class extends Bn{toString(){let t="[";if(Mt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=J(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function U2(){let e=new ht(9);return ht!=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 G2(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 z2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function q2(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function Bf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function V2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function k2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Cf(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 H2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var Lf;(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"})(Lf||(Lf={}));var OP=Object.freeze([1,0,0,0,1,0,0,0,1]),lt=class extends Tc{static get IDENTITY(){return NP()}static get ZERO(){return PP()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Lf}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(OP)}fromObject(t){return this.check()}fromQuaternion(t){return H2(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return q2(this)}transpose(){return G2(this,this),this.check()}invert(){return z2(this,this),this.check()}multiplyLeft(t){return Bf(this,t,this),this.check()}multiplyRight(t){return Bf(this,this,t),this.check()}rotate(t){return k2(this,this,t),this.check()}scale(t){return Array.isArray(t)?Cf(this,this,t):Cf(this,this,[t,t]),this.check()}translate(t){return V2(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=w2(n||[-0,-0],t,this);break;case 3:r=Mc(n||[-0,-0,-0],t,this);break;case 4:r=gc(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return mc(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},_c,Sc=null;function PP(){return _c||(_c=new lt([0,0,0,0,0,0,0,0,0]),Object.freeze(_c)),_c}function NP(){return Sc||(Sc=new lt,Object.freeze(Sc)),Sc}var Mi={};Et(Mi,{add:()=>A4,adjoint:()=>VP,clone:()=>FP,copy:()=>DP,create:()=>vP,decompose:()=>i4,determinant:()=>kP,equals:()=>_4,exactEquals:()=>T4,frob:()=>M4,fromQuat:()=>a4,fromQuat2:()=>n4,fromRotation:()=>ZP,fromRotationTranslation:()=>J2,fromRotationTranslationScale:()=>o4,fromRotationTranslationScaleOrigin:()=>c4,fromScaling:()=>QP,fromTranslation:()=>KP,fromValues:()=>UP,fromXRotation:()=>$P,fromYRotation:()=>t4,fromZRotation:()=>e4,frustum:()=>h4,getRotation:()=>s4,getScaling:()=>j2,getTranslation:()=>r4,identity:()=>Y2,invert:()=>qP,lookAt:()=>m4,mul:()=>S4,multiply:()=>W2,multiplyScalar:()=>y4,multiplyScalarAndAdd:()=>E4,ortho:()=>u4,orthoNO:()=>K2,orthoZO:()=>d4,perspective:()=>l4,perspectiveFromFieldOfView:()=>p4,perspectiveNO:()=>X2,perspectiveZO:()=>f4,rotate:()=>WP,rotateX:()=>JP,rotateY:()=>jP,rotateZ:()=>XP,scale:()=>YP,set:()=>GP,str:()=>x4,sub:()=>B4,subtract:()=>Q2,targetTo:()=>g4,translate:()=>HP,transpose:()=>zP});function vP(){let e=new ht(16);return ht!=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 FP(e){let t=new ht(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 DP(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 UP(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new ht(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function GP(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function Y2(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 zP(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 qP(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m,C=E*I-A*R+y*w+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*R+h*w)*C,e[1]=(s*R-r*I-i*w)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*R-c*x+h*B)*C,e[9]=(r*x-n*R-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*w-a*B)*C,e[13]=(n*w-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function VP(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m;return e[0]=c*I-a*R+h*w,e[1]=s*R-r*I-i*w,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*I-h*S,e[5]=n*I-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*R-c*x+h*B,e[9]=r*x-n*R-i*B,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*w-a*B,e[13]=n*w-r*S+s*B,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function kP(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function W2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function HP(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function YP(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function WP(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,w,R,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,w=i*i*l+a,R=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*w+A*R,e[5]=p*x+m*w+y*R,e[6]=u*x+M*w+T*R,e[7]=d*x+E*w+_*R,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function JP(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function jP(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function XP(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function KP(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 QP(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 ZP(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function $P(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function t4(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function e4(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,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 J2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function n4(e,t){let n=new ht(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),J2(e,t,n),e}function r4(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function j2(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function s4(e,t){let n=new ht(3);j2(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function i4(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,B=p*g,S=m+y+B,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>B?(x=Math.sqrt(1+m-y-B)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>B?(x=Math.sqrt(1+y-m-B)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+B-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function o4(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function c4(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],B=s[0],S=s[1],x=s[2],w=(1-(g+M))*T,R=(u+y)*T,I=(d-A)*T,C=(u-y)*_,P=(1-(p+M))*_,k=(m+E)*_,z=(d+A)*L,$=(m-E)*L,H=(1-(p+g))*L;return e[0]=w,e[1]=R,e[2]=I,e[3]=0,e[4]=C,e[5]=P,e[6]=k,e[7]=0,e[8]=z,e[9]=$,e[10]=H,e[11]=0,e[12]=n[0]+B-(w*B+C*S+z*x),e[13]=n[1]+S-(R*B+P*S+$*x),e[14]=n[2]+x-(I*B+k*S+H*x),e[15]=1,e}function a4(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h4(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function X2(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var l4=X2;function f4(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function p4(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function K2(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var u4=K2;function d4(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function m4(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?Y2(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function g4(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function x4(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 M4(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 A4(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function Q2(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function y4(e,t,n){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]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function E4(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function T4(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 _4(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],B=t[6],S=t[7],x=t[8],w=t[9],R=t[10],I=t[11],C=t[12],P=t[13],k=t[14],z=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-B)<=1e-6*Math.max(1,Math.abs(a),Math.abs(B))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-w)<=1e-6*Math.max(1,Math.abs(f),Math.abs(w))&&Math.abs(p-R)<=1e-6*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(u-I)<=1e-6*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(d-C)<=1e-6*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(g-P)<=1e-6*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(m-k)<=1e-6*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(M-z)<=1e-6*Math.max(1,Math.abs(M),Math.abs(z))}var S4=W2,B4=Q2;function C4(){let e=new ht(4);return ht!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Z2(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function $2(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function tM(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function eM(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function nM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function rM(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function sM(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function iM(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var zj=function(){let e=C4();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();function oM(){let e=new ht(4);return ht!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function cM(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function wf(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Rf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function aM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function hM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function lM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function fM(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Ai(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function pM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function uM(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function If(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var dM=Z2;var mM=$2,gM=rM,xM=sM,MM=tM;var AM=eM;var yM=nM;var EM=function(){let e=Ef(),t=Tf(1,0,0),n=Tf(0,1,0);return function(r,s,i){let o=_f(s,i);return o<-.999999?(Wr(e,t,s),D2(e)<1e-6&&Wr(e,n,s),O2(e,e),wf(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Wr(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,yM(r,r))}}(),Wj=function(){let e=oM(),t=oM();return function(n,r,s,i,o,c){return Ai(e,r,o,c),Ai(t,s,i,c),Ai(n,e,t,2*c*(1-c)),n}}(),Jj=function(){let e=U2();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],yM(t,If(t,e))}}();var w4=[0,0,0,1],jr=class extends Bn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 If(this,t),this.check()}fromAxisRotation(t,n){return wf(this,t,n),this.check()}identity(){return cM(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=J(t)}get y(){return this[1]}set y(t){this[1]=J(t)}get z(){return this[2]}set z(t){this[2]=J(t)}get w(){return this[3]}set w(t){this[3]=J(t)}len(){return MM(this)}lengthSquared(){return AM(this)}dot(t){return gM(this,t)}rotationTo(t,n){return EM(this,t,n),this.check()}add(t){return dM(this,this,t),this.check()}calculateW(){return fM(this,this),this.check()}conjugate(){return uM(this,this),this.check()}invert(){return pM(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(xM(this,t,n,r),this.check())}multiplyRight(t){return Rf(this,this,t),this.check()}multiplyLeft(t){return Rf(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return aM(this,this,t),this.check()}rotateY(t){return hM(this,this,t),this.check()}rotateZ(t){return lM(this,this,t),this.check()}scale(t){return mM(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=w4,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Ai(this,s,i,o),this.check()}transformVector4(t,n=new Jr){return iM(n,t,this),mc(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Xr={};Et(Xr,{EPSILON1:()=>R4,EPSILON10:()=>U4,EPSILON11:()=>G4,EPSILON12:()=>z4,EPSILON13:()=>q4,EPSILON14:()=>V4,EPSILON15:()=>k4,EPSILON16:()=>H4,EPSILON17:()=>Y4,EPSILON18:()=>W4,EPSILON19:()=>J4,EPSILON2:()=>I4,EPSILON20:()=>j4,EPSILON3:()=>b4,EPSILON4:()=>O4,EPSILON5:()=>P4,EPSILON6:()=>N4,EPSILON7:()=>v4,EPSILON8:()=>F4,EPSILON9:()=>D4,PI_OVER_FOUR:()=>K4,PI_OVER_SIX:()=>Q4,PI_OVER_TWO:()=>X4,TWO_PI:()=>Z4});var R4=.1,I4=.01,b4=.001,O4=1e-4,P4=1e-5,N4=1e-6,v4=1e-7,F4=1e-8,D4=1e-9,U4=1e-10,G4=1e-11,z4=1e-12,q4=1e-13,V4=1e-14,k4=1e-15,H4=1e-16,Y4=1e-17,W4=1e-18,J4=1e-19,j4=1e-20,X4=Math.PI/2,K4=Math.PI/4,Q4=Math.PI/6,Z4=Math.PI*2;var BX=new N,CX=new N;var yi=new N,TM=new N,se=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new N,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=yi.from(n),this.center=new N().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new se(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=yi.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return TM.copy(o).scale((-r+a)/c).add(n),this.center.copy(TM),this.radius=a,this}expand(t){let r=yi.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Mi.getScaling(yi,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=yi.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?St.OUTSIDE:i<r?St.INTERSECTING:St.INSIDE}};var $4=new N,tN=new N,Bc=new N,Cc=new N,Lc=new N,eN=new N,nN=new N,Je={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},xe=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new N().from(t),this.halfAxes=new lt(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new N(t).len(),new N(n).len(),new N(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new N(t).normalize(),i=new N(n).normalize(),o=new N(r).normalize();return new jr().fromMatrix3(new lt([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new jr(r),i=new lt().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new N().from(t),this.halfAxes=i,this}clone(){return new xe(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new se){let n=this.halfAxes,r=n.getColumn(0,Bc),s=n.getColumn(1,Cc),i=n.getColumn(2,Lc),o=$4.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[Je.COLUMN0ROW0]+o*s[Je.COLUMN0ROW1]+c*s[Je.COLUMN0ROW2])+Math.abs(i*s[Je.COLUMN1ROW0]+o*s[Je.COLUMN1ROW1]+c*s[Je.COLUMN1ROW2])+Math.abs(i*s[Je.COLUMN2ROW0]+o*s[Je.COLUMN2ROW1]+c*s[Je.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?St.OUTSIDE:h>=a?St.INSIDE:St.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=tN.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Bc),i=r.getColumn(1,Cc),o=r.getColumn(2,Lc),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,Bc),h=c.getColumn(1,Cc),l=c.getColumn(2,Lc),f=eN.copy(a).add(h).add(l).add(o),p=nN.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Bc);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Cc);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Lc);return s.transformAsPoint(t),this.halfAxes=new lt([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var _M=new N,SM=new N,Ot=class{constructor(t=[0,0,1],n=0){this.normal=new N,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return be(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=_M.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),be(Sn(this.normal.len(),1)),this.distance=s,this}clone(){return new Ot(this.normal,this.distance)}equals(t){return Sn(this.distance,t.distance)&&Sn(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=SM.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=_M.from(t),s=this.getPointDistance(r),i=SM.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var BM=[new N([1,0,0]),new N([0,1,0]),new N([0,0,1])],CM=new N,rN=new N,Bt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*BM.length;let n=t.center,r=t.radius,s=0;for(let i of BM){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new Ot),c||(c=this.planes[s+1]=new Ot);let a=CM.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=CM.copy(i).scale(r).add(n),l=rN.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=St.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case St.OUTSIDE:return St.OUTSIDE;case St.INTERSECTING:n=St.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(be(Number.isFinite(n),"parentPlaneMask is required."),n===Bt.MASK_OUTSIDE||n===Bt.MASK_INSIDE)return n;let r=Bt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===St.OUTSIDE)return Bt.MASK_OUTSIDE;a===St.INTERSECTING&&(r|=o)}return r}};Bt.MASK_OUTSIDE=4294967295;Bt.MASK_INSIDE=0;Bt.MASK_INDETERMINATE=2147483647;var YX=new N,WX=new N,JX=new N,jX=new N,XX=new N;var eK=new N,nK=new N,rK=new N,sK=new N,iK=new N,oK=new N,cK=new N,aK=new N,hK=new N,lK=new N,fK=new N,pK=new N;var Oe=new lt,iN=new lt,oN=new lt,wc=new lt,LM=new lt;function Pf(e,t={}){let n=Xr.EPSILON20,r=10,s=0,i=0,o=iN,c=oN;o.identity(),c.copy(e);let a=n*cN(c);for(;i<r&&aN(c)>a;)hN(c,wc),LM.copy(wc).transpose(),c.multiplyRight(wc),c.multiplyLeft(LM),o.multiplyRight(wc),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function cN(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var bf=[1,0,0],Of=[2,2,1];function aN(e){let t=0;for(let n=0;n<3;++n){let r=e[Oe.getElementIndex(Of[n],bf[n])];t+=2*r*r}return Math.sqrt(t)}function hN(e,t){let n=Xr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[Oe.getElementIndex(Of[h],bf[h])]);l>r&&(s=h,r=l)}let i=bf[s],o=Of[s],c=1,a=0;if(Math.abs(e[Oe.getElementIndex(o,i)])>n){let h=e[Oe.getElementIndex(o,o)],l=e[Oe.getElementIndex(i,i)],f=e[Oe.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return lt.IDENTITY.to(t),t[Oe.getElementIndex(i,i)]=t[Oe.getElementIndex(o,o)]=c,t[Oe.getElementIndex(o,i)]=a,t[Oe.getElementIndex(i,o)]=-a,t}var Cn=new N,fN=new N,pN=new N,uN=new N,dN=new N,mN=new lt,gN={diagonal:new lt,unitary:new lt};function Nf(e,t=new xe){if(!e||e.length===0)return t.halfAxes=new lt([0,0,0,0,0,0,0,0,0]),t.center=new N,t;let n=e.length,r=new N(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=Cn.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=mN;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=Pf(f,gN),u=t.halfAxes.copy(p),d=u.getColumn(0,pN),g=u.getColumn(1,uN),m=u.getColumn(2,dN),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)Cn.copy(S),M=Math.max(Cn.dot(d),M),E=Math.max(Cn.dot(g),E),A=Math.max(Cn.dot(m),A),y=Math.min(Cn.dot(d),y),T=Math.min(Cn.dot(g),T),_=Math.min(Cn.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=fN.set(M-y,E-T,A-_).multiplyByScalar(.5),B=new lt([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(B),t}var wM=new v,vf=new v,Ff=new Bt([new Ot,new Ot,new Ot,new Ot,new Ot,new Ot]);function IM(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=Rc(e,e.center),c=G.WGS84.eastNorthUpToFixedFrame(o),a=e.unprojectPosition(e.cameraPosition),h=G.WGS84.cartographicToCartesian(a,new v),l=new v(c.transformAsVector(new v(n).scale(i))).normalize(),f=new v(c.transformAsVector(new v(r).scale(i))).normalize();xN(e);let p=e.constructor,{longitude:u,latitude:d,width:g,bearing:m,zoom:M}=e,E=new p({longitude:u,latitude:d,height:s,width:g,bearing:m,zoom:M,pitch:0});return{camera:{position:h,direction:l,up:f},viewport:e,topDownViewport:E,height:s,cullingVolume:Ff,frameNumber:t,sseDenominator:1.15}}function bM(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[h,l]of e.entries()){let[f,p]=l.header.mbs,u=Math.abs(s-f),d=Math.abs(i-p),g=Math.sqrt(d*d+u*u);r.push([h,g])}let o=r.sort((h,l)=>h[1]-l[1]),c=[];for(let h=0;h<n;h++)c.push(e[o[h][0]]);let a=[];for(let h=n;h<o.length;h++)a.push(e[o[h][0]]);return[c,a]}function xN(e){let t=e.getFrustumPlanes(),n=RM(t.near,e.cameraPosition),r=Rc(e,n),s=Rc(e,e.cameraPosition,vf),i=0;Ff.planes[i++].fromPointNormal(r,wM.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let c=t[o],a=RM(c,n,vf),h=Rc(e,a,vf);Ff.planes[i++].fromPointNormal(h,wM.copy(r).subtract(h))}}function RM(e,t,n=new v){let r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function Rc(e,t,n=new v){let r=e.unprojectPosition(t);return G.WGS84.cartographicToCartesian(r,n)}var MN=6378137,AN=6378137,Df=6356752314245179e-9,Kr=new v;function OM(e,t){if(e instanceof xe){let{halfAxes:n}=e,r=yN(n);return Math.log2(Df/(r+t[2]))}else if(e instanceof se){let{radius:n}=e;return Math.log2(Df/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(MN/n),i=Math.log2(AN/r);return(s+i)/2}return 1}function Uf(e,t,n){G.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Kr);let r=Math.sqrt(Math.pow(Kr[0]-n[0],2)+Math.pow(Kr[1]-n[1],2)+Math.pow(Kr[2]-n[2],2));return Math.log2(Df/(r+t[2]))}function PM(e,t,n){let[r,s,i,o]=e;return Uf({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function yN(e){e.getColumn(0,Kr);let t=e.getColumn(1),n=e.getColumn(2);return Kr.add(t).add(n).len()}var KM=U(Nr(),1);var zt={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Pt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(Pt||(Pt={}));var ie;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(ie||(ie={}));var Ct;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(Ct||(Ct={}));var je;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(je||(je={}));var NM={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function UM(e){return e!=null}var Nt=new v,Ic=new v,EN=new v,TN=new v,$n=new v,vM=new v,FM=new v,DM=new v;function bc(e,t,n){if(q(e,"3D Tile: boundingVolume must be defined"),e.box)return zM(e.box,t,n);if(e.region)return SN(e.region);if(e.sphere)return _N(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function GM(e,t){if(e.box)return BN(t);if(e.region){let[n,r,s,i,o,c]=e.region;return[[ne(n),ne(r),o],[ne(s),ne(i),c]]}if(e.sphere)return CN(t);throw new Error("Unkown boundingVolume type")}function zM(e,t,n){let r=new v(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let h=e.slice(3,6),l=new di;l.fromArray(e,6);let f=new v([1,0,0]),p=new v([0,1,0]),u=new v([0,0,1]);f.transformByQuaternion(l),f.scale(h[0]),p.transformByQuaternion(l),p.scale(h[1]),u.transformByQuaternion(l),u.scale(h[2]),s=[...f.toArray(),...p.toArray(),...u.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),c=t.transformAsVector(s.slice(6,9)),a=new Zn([i[0],i[1],i[2],o[0],o[1],o[2],c[0],c[1],c[2]]);return UM(n)?(n.center=r,n.halfAxes=a,n):new xe(r,a)}function _N(e,t,n){let r=new v(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(Ic),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return UM(n)?(n.center=r,n.radius=o,n):new se(r,o)}function SN(e){let[t,n,r,s,i,o]=e,c=G.WGS84.cartographicToCartesian([ne(t),ne(s),i],EN),a=G.WGS84.cartographicToCartesian([ne(r),ne(n),o],TN),h=new v().addVectors(c,a).multiplyByScalar(.5);return G.WGS84.cartesianToCartographic(h,$n),G.WGS84.cartographicToCartesian([ne(r),$n[1],$n[2]],vM),G.WGS84.cartographicToCartesian([$n[0],ne(s),$n[2]],FM),G.WGS84.cartographicToCartesian([$n[0],$n[1],o],DM),zM([...h,...vM.subtract(h),...FM.subtract(h),...DM.subtract(h)],new nt)}function BN(e){let t=qM(),{halfAxes:n}=e,r=new v(n.getColumn(0)),s=new v(n.getColumn(1)),i=new v(n.getColumn(2));for(let o=0;o<2;o++){for(let c=0;c<2;c++){for(let a=0;a<2;a++)Nt.copy(e.center),Nt.add(r),Nt.add(s),Nt.add(i),VM(t,Nt),i.negate();s.negate()}r.negate()}return t}function CN(e){let t=qM(),{center:n,radius:r}=e,s=G.WGS84.scaleToGeodeticSurface(n,Nt),i;s?i=G.WGS84.geodeticSurfaceNormal(s):i=new v(0,0,1);let o=new v(i[2],-i[1],0);o.len()>0?o.normalize():o=new v(0,1,0);let c=o.clone().cross(i);for(let a of[o,c,i]){Ic.copy(a).scale(r);for(let h=0;h<2;h++)Nt.copy(n),Nt.add(Ic),VM(t,Nt),Ic.negate()}return t}function qM(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function VM(e,t){G.WGS84.cartesianToCartographic(t,Nt),e[0][0]=Math.min(e[0][0],Nt[0]),e[0][1]=Math.min(e[0][1],Nt[1]),e[0][2]=Math.min(e[0][2],Nt[2]),e[1][0]=Math.max(e[1][0],Nt[0]),e[1][1]=Math.max(e[1][1],Nt[1]),e[1][2]=Math.max(e[1][2],Nt[2])}var QK=new v,ZK=new v,$K=new nt,tQ=new v,eQ=new v,nQ=new v;function LN(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function wN(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return LN(t,n)*r}return 0}function kM(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:c,sseDenominator:a}=t,{viewDistanceScale:h}=r.options,l=i*c*(h||1)/(o*a);return l-=wN(r,o),l}var Gf=new v,HM=new v,Ln=new v,YM=new v,RN=new v,zf=new nt,WM=new nt;function JM(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*qf(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function qf(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],c=[...e.boundingVolume.center],a=n.unprojectPosition(n.cameraPosition);G.WGS84.cartographicToCartesian(a,Gf),HM.copy(Gf).subtract(c).normalize(),G.WGS84.eastNorthUpToFixedFrame(c,zf),WM.copy(zf).invert(),Ln.copy(Gf).transform(WM);let h=Math.sqrt(Ln[0]*Ln[0]+Ln[1]*Ln[1]),l=h*h/Ln[2];YM.copy([Ln[0],Ln[1],l]);let p=YM.transform(zf).subtract(c).normalize(),d=HM.cross(p).normalize().scale(o).add(c),g=G.WGS84.cartesianToCartographic(d),m=n.project([s,r,i]),M=n.project(g);return RN.copy(m).subtract(M).magnitude()}function jM(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Ei=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 q(t<this._array.length),this._array[t]}set(t,n){q(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=n,this._map.set(n,t)}delete(t){let n=this._map.get(t);n>=0&&(this._array.splice(n,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let n=this.length++;this._array[n]=t,this._map.set(t,n)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){q(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){q(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 IN={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},Pe=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Ei;_emptyTraversalStack=new Ei;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...IN,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let c=i.parent,a=Boolean(!c||c._shouldRefine),h=!o;i.hasRenderContent?i.refine===Pt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===Pt.REPLACE&&(this.loadTile(i,n),h&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),h&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&a}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,c=t.children;c.sort(this.compareDistanceToCamera.bind(this));let a=t.refine===Pt.REPLACE&&t.hasRenderContent&&!o,h=!1,l=!0;for(let f of c)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(r.find(f)&&r.delete(f),r.push(f),h=!0):(a||i)&&(this.loadTile(f,n),this.touchTile(f,n)),a){let p;if(f._inRequestVolume?f.hasRenderContent?p=f.contentAvailable:p=this.executeEmptyTraversal(f,n):p=!1,l=l&&p,!l)return!1}return h||(l=!1),l}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n,r=!1,s=!1){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n,r=!1){let s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),c=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!c&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let a=i.children;for(let h of a)s.push(h)}}return r}};var XM=new v;function bN(e){return e!=null}var tr=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=zt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new nt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new Pe({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new nt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,n,r,s=""){this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),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===zt.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===zt.UNLOADED}get contentExpired(){return this.contentState===zt.EXPIRED}get contentFailed(){return this.contentState===zt.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=GM(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case Ct.I3S:return qf(this,t);case Ct.TILES3D:return kM(this,t,n);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:n}=t.options,r=this.refine===Pt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===zt.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,c=t.root?t.root._screenSpaceError:0;return Math.max(c-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=zt.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=zt.UNLOADED,!1;try{let r=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,KM.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=zt.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=zt.FAILED,r}finally{n.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=zt.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:Bt.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==Bt.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let n=this.boundingVolume;return XM.subVectors(n.center,t.position),t.direction.dot(XM)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(bN(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=zt.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 nt(t.transform):new nt;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new nt(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new nt;this._initialTransform=new nt(i).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=zt.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=Bt.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||Pt.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=bc(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=bc(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=bc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new nt){let n=t.clone().multiplyRight(this.transform);n.equals(this.computedTransform)||(this.computedTransform=n,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 jM(this.tileset.tileset)}}};var Oc=class extends Pe{compareDistanceToCamera(t,n){return n._distanceToCamera===0&&t._distanceToCamera===0?n._centerZDepth-t._centerZDepth:n._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,n){if(super.updateTileVisibility(t,n),!t.isVisibleAndInRequestVolume)return;let r=t.children.length>0;if(t.hasTilesetContent&&r){let o=t.children[0];this.updateTileVisibility(o,n),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,n)){t._visible=!1;return}let s=t.refine===Pt.REPLACE,i=t._optimChildrenWithinParent===NM.USE_OPTIMIZATION;if(s&&i&&r&&!this.anyChildrenVisible(t,n)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,n){let{parent:r}=t;return!r||r.hasTilesetContent||r.refine!==Pt.ADD?!1:!this.shouldRefine(t,n,!0)}};var QM=U(Nr(),1);var Pc=class{frameNumberMap=new Map;register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){return(this.frameNumberMap.get(t)?.get(n)||0)===0}};var Vf={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Nc=class{_statusMap;pendingTilesRegister=new Pc;constructor(){this._statusMap={}}add(t,n,r,s){if(!this._statusMap[n]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[n]={request:t,callback:r,key:n,frameState:s,status:Vf.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(c=>{this._statusMap[n].status=Vf.COMPLETED;let{frameNumber:a,viewport:{id:h}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(h,a),this._statusMap[n].callback(c,s)}).catch(c=>{this._statusMap[n].status=Vf.ERROR;let{frameNumber:a,viewport:{id:h}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(h,a),r(c)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var vc=class extends Pe{_tileManager;constructor(t){super(t),this._tileManager=new Nc}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=JM(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let c=`${o.id}-${n.viewport.id}`,a=s&&s.find(h=>h.id===c);if(a)a&&this.updateTile(a,n);else{let h=()=>this._loadTile(o.id,i);this._tileManager.find(c)?this._tileManager.update(c,n):(i.tileset.nodePages&&(h=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(h,c,f=>this._onTileLoad(f,t,c),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,QM.load)(s,r,i)}_onTileLoad(t,n,r){let s=new tr(n.tileset,t,n,r);n.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var ON={description:"",ellipsoid:G.WGS84,modelMatrix:new nt,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:{}},Fc="Tiles In Tileset(s)",kf="Tiles In Memory",ZM="Tiles In View",$M="Tiles To Render",tA="Tiles Loaded",Hf="Tiles Loading",eA="Tiles Unloaded",nA="Failed Tile Loads",rA="Points/Vertices",Yf="Tile Memory Use",sA="Maximum Screen Space Error",Ti=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 dc;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,n){this.options={...ON,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||fn.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 ln({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 hn({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 r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}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(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(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 n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=IM(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(t){let n=t;return this.options.viewportTraversersMap&&(n=this.options.viewportTraversersMap[t]),n===t}_onTraversalEnd(t){let n=t.viewport.id;this.frameStateData[n]||(this.frameStateData[n]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let r=this.frameStateData[n],s=Object.values(this._traverser.selectedTiles),[i,o]=bM(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let c of o)c.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._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,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(ZM).count=this.selectedTiles.length,this.stats.get($M).count=t,this.stats.get(rA).count=n,this.stats.get(sA).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===Ct.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===Ct.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===Ct.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:r,xmax:s,ymin:i,ymax:o,zmin:c,zmax:a}=t;this.cartographicCenter=new v(r+(s-r)/2,i+(o-i)/2,c+(a-c)/2),this.cartesianCenter=new v,G.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Uf(t,this.cartographicCenter,this.cartesianCenter);return}let n=this.tileset.store?.extent;if(n){let[r,s,i,o]=n;this.cartographicCenter=new v(r+(i-r)/2,s+(o-s)/2,0),this.cartesianCenter=new v,G.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=PM(n,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new v,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new v,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new v,G.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new v(0,0,-G.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=OM(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(Fc),this.stats.get(Hf),this.stats.get(kf),this.stats.get(ZM),this.stats.get($M),this.stats.get(tA),this.stats.get(eA),this.stats.get(nA),this.stats.get(rA),this.stats.get(Yf,"memory"),this.stats.get(sA)}_initializeTileHeaders(t,n){let r=new tr(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===Ct.TILES3D){let s=[];for(s.push(r);s.length>0;){let i=s.pop();this.stats.get(Fc).incrementCount();let o=i.header.children||[];for(let c of o){let a=new tr(this,c,i);if(a.contentUrl?.includes("?session=")){let l=new URL(a.contentUrl).searchParams.get("session");l&&(this._queryParams.session=l)}i.children.push(a),a.depth=i.depth+1,s.push(a)}}}return r}_initializeTraverser(){let t;switch(this.type){case Ct.TILES3D:t=Oc;break;case Ct.I3S:t=vc;break;default:t=Pe}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let n;try{this._onStartTileLoading(),n=await t.loadContent()}catch(r){this._onTileLoadError(t,r instanceof Error?r:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,n)}}_onTileLoadError(t,n){this.stats.get(nA).incrementCount();let r=n.message||n.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,s)}_onTileLoad(t,n){if(n){if(this.type===Ct.I3S){let r=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(Fc).reset(),this.stats.get(Fc).addCount(r)}t&&t.content&&B2(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===Ct.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===Ct.TILES3D){let{extensionsRemoved:n=[]}=t.content?.gltf||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(Hf).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(Hf).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(tA).incrementCount(),this.stats.get(kf).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Yf).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(kf).decrementCount(),this.stats.get(eA).incrementCount(),this.stats.get(Yf).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let n=t.pop();for(let r of n.children)t.push(r);this._destroyTile(n)}this.root=null}_destroySubtree(t){let n=t,r=[];for(r.push(n);r.length>0;){t=r.pop();for(let s of t.children)r.push(s);t!==n&&this._destroyTile(t)}n.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let n=new URLSearchParams(t.queryString),r=Object.fromEntries(n.entries());this._queryParams={...this._queryParams,...r}}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 Dc="4.2.1";var er={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},QQ=Object.keys(er);function Wf(e,t,n){q(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function iA(e,t=0){let n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var oA="4.2.1";var cA={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:oA,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 aA(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 nr(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,c=e.POSITION?e.POSITION.value:[],a=c&&c.length;for(let h=0;h<a;h+=3){let l=c[h],f=c[h+1],p=c[h+2];t=l<t?l:t,n=f<n?f:n,r=p<r?p:r,s=l>s?l:s,i=f>i?f:i,o=p>o?p:o}return[[t,n,r],[s,i,o]]}function Jf(e,t,n){let r=aA(t.value),s=n||hA(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function hA(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 fA(e,t,n){let r=pA(t.metadata),s=[],i=PN(t.attributes);for(let o in e){let c=e[o],a=lA(o,c,i[o]);s.push(a)}if(n){let o=lA("indices",n);s.push(o)}return{fields:s,metadata:r}}function PN(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function lA(e,t,n){let r=n?pA(n.metadata):void 0;return Jf(e,t,r)}function pA(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var uA={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},NN={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},vN=4,_i=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,n={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let c=this._getDracoLoaderData(i,s,n),a=this._getMeshData(i,c,n),h=nr(a.attributes),l=fA(a.attributes,c,a.indices);return{loader:"draco",loaderData:c,header:{vertexCount:i.num_points(),boundingBox:h},...a,schema:l}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let c=this._getQuantizationTransform(i,n);c&&(r[i.unique_id()].quantization_transform=c);let a=this._getOctahedronTransform(i,n);a&&(r[i.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.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,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let c=this._getAttributeValues(n,i);if(c){let{value:a,size:h}=c;s[o]={value:a,size:h,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*vN,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,r).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let n=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,n),UN(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=NN[n.data_type];if(!r)return console.warn(`DRACO: Unsupported attribute type ${n.data_type}`),null;let s=n.num_components,o=t.num_points()*s,c=o*r.BYTES_PER_ELEMENT,a=FN(this.draco,r),h,l=this.draco._malloc(c);try{let f=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,a,c,l),h=new r(this.draco.HEAPF32.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:h,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,c]of Object.entries(n.extraAttributes||{}))if(c===r)return o;let s=t.attribute_type;for(let o in uA)if(this.draco[o]===s)return uA[o];let i=n.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let n=this.decoder.GetMetadata(t);return this._getDracoMetadata(n)}_getAttributeMetadata(t,n){let r=this.decoder.GetAttributeMetadata(t,n);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let n={},r=this.metadataQuerier.NumEntries(t);for(let s=0;s<r;s++){let i=this.metadataQuerier.GetEntryName(t,s);n[i]=this._getDracoMetadataField(t,i)}return n}_getDracoMetadataField(t,n){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,n,r);let s=DN(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(c=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function FN(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 DN(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function UN(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var GN="1.5.6",zN="1.4.1",jf=`https://www.gstatic.com/draco/versioned/decoders/${GN}`,kt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Xf={[kt.DECODER]:`${jf}/${kt.DECODER}`,[kt.DECODER_WASM]:`${jf}/${kt.DECODER_WASM}`,[kt.FALLBACK_DECODER]:`${jf}/${kt.FALLBACK_DECODER}`,[kt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${zN}/javascript/${kt.ENCODER}`},Kf;async function dA(e){let t=e.modules||{};return t.draco3d?Kf||=t.draco3d.createDecoderModule({}).then(n=>({draco:n})):Kf||=qN(e),await Kf}async function qN(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Ce(Xf[kt.FALLBACK_DECODER],"draco",e,kt.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Ce(Xf[kt.DECODER],"draco",e,kt.DECODER),await Ce(Xf[kt.DECODER_WASM],"draco",e,kt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await VN(t,n)}function VN(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var Uc={...cA,parse:kN};async function kN(e,t){let{draco:n}=await dA(t),r=new _i(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var HN={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},D={...HN,...At};var Qf={[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},YN={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},Zf="Failed to convert GL type",vt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in Qf)if(Qf[n]===t)return n;throw new Error(Zf)}static fromName(t){let n=YN[t];if(!n)throw new Error(Zf);return n}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 n=Qf[t];if(!n)throw new Error(Zf);return n}}static getByteSize(t){return vt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(vt.getArrayType(t))}static createTypedArray(t,n,r=0,s){s===void 0&&(s=(n.byteLength-r)/vt.getByteSize(t));let i=vt.getArrayType(t);return new i(n,r,s)}};var LZ=1/Math.PI*180,wZ=1/180*Math.PI,WN={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...WN}};var wt=globalThis.mathgl.config;function $f(e,{precision:t=wt.precision}={}){return e=JN(e),`${parseFloat(e.toPrecision(t))}`}function Ne(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function t0(e,t,n){return XN(e,r=>Math.max(t,Math.min(n,r)))}function Gc(e,t,n){let r=wt.EPSILON;n&&(wt.EPSILON=n);try{if(e===t)return!0;if(Ne(e)&&Ne(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Gc(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)<=wt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{wt.EPSILON=r}}function JN(e){return Math.round(e/wt.EPSILON)*wt.EPSILON}function jN(e){return e.clone?e.clone():new Array(e.length)}function XN(e,t,n){if(Ne(e)){let r=e;n=n||jN(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var zc=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ne(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(wt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+$f(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Gc(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(wt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function Tt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function e0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Qr=class extends zc{get x(){return this[0]}set x(t){this[0]=Tt(t)}get y(){return this[1]}set y(t){this[1]=Tt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Tt(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Tt(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return e0(t>=0&&t<this.ELEMENTS,"index is out of range"),Tt(this[t])}setComponent(t,n){return e0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Zr=typeof Float32Array<"u"?Float32Array:Array;var UZ=Math.PI/180;function $N(){let e=new Zr(2);return Zr!=Float32Array&&(e[0]=0,e[1]=0),e}function gA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function xA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function MA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function AA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var GZ=function(){let e=$N();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function yA(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function EA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function TA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}var rr=class extends Qr{constructor(t=0,n=0){super(2),Ne(t)&&arguments.length===1?this.copy(t):(wt.debug&&(Tt(t),Tt(n)),this[0]=t,this[1]=n)}set(t,n){return this[0]=t,this[1]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return wt.debug&&(Tt(t.x),Tt(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 AA(this,this,t),this.check()}transformAsVector(t){return yA(this,this,t),this.check()}transformByMatrix3(t){return MA(this,this,t),this.check()}transformByMatrix2x3(t){return xA(this,this,t),this.check()}transformByMatrix2(t){return gA(this,this,t),this.check()}};function tv(){let e=new Zr(3);return Zr!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ev(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function _A(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function SA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function BA(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function CA(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function LA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function wA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function RA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function IA(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&ev(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var jZ=function(){let e=tv();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var n0=[0,0,0],qc,sr=class extends Qr{static get ZERO(){return qc||(qc=new sr(0,0,0),Object.freeze(qc)),qc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ne(t)?this.copy(t):(wt.debug&&(Tt(t),Tt(n),Tt(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return wt.debug&&(Tt(t.x),Tt(t.y),Tt(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]=Tt(t)}angle(t){return IA(this,t)}cross(t){return _A(this,this,t),this.check()}rotateX({radians:t,origin:n=n0}){return LA(this,this,n,t),this.check()}rotateY({radians:t,origin:n=n0}){return wA(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=n0}){return RA(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return SA(this,this,t),this.check()}transformAsVector(t){return EA(this,this,t),this.check()}transformByMatrix3(t){return BA(this,this,t),this.check()}transformByMatrix2(t){return TA(this,this,t),this.check()}transformByQuaternion(t){return CA(this,this,t),this.check()}};function bA(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function r0(e,t=[0,0,0]){let n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var C$=1/256;var L$=new rr,w$=new sr,R$=new rr,I$=new rr,b$=new Uint8Array(1);function OA(e,t=255){return t0(e,0,t)/t*2-1}function PA(e){return e<0?-1:1}function NA(e,t,n,r){if(bA(r),e<0||e>n||t<0||t>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=OA(e,n),r.y=OA(t,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){let s=r.x;r.x=(1-Math.abs(r.y))*PA(s),r.y=(1-Math.abs(s))*PA(r.y)}return r.normalize()}function s0(e,t,n){return NA(e,t,255,n)}var Q$=1/Math.PI*180,Z$=1/180*Math.PI,nv={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...nv}};var yt=globalThis.mathgl.config;function vA(e,{precision:t=yt.precision}={}){return e=rv(e),`${parseFloat(e.toPrecision(t))}`}function wn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function i0(e,t,n){let r=yt.EPSILON;n&&(yt.EPSILON=n);try{if(e===t)return!0;if(wn(e)&&wn(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!i0(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)<=yt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{yt.EPSILON=r}}function rv(e){return Math.round(e/yt.EPSILON)*yt.EPSILON}var Rn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:wn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(yt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+vA(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!i0(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(yt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function sv(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function j(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function In(e,t,n=""){if(yt.debug&&!sv(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function o0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var $r=class extends Rn{get x(){return this[0]}set x(t){this[0]=j(t)}get y(){return this[1]}set y(t){this[1]=j(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return j(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return j(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return o0(t>=0&&t<this.ELEMENTS,"index is out of range"),j(this[t])}setComponent(t,n){return o0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Ft=typeof Float32Array<"u"?Float32Array:Array;var htt=Math.PI/180;function iv(){let e=new Ft(2);return Ft!=Float32Array&&(e[0]=0,e[1]=0),e}function UA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function GA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var ltt=function(){let e=iv();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function zA(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function Vc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function qA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function VA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function kc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function c0(){let e=new Ft(3);return Ft!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ov(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function a0(e,t,n){let r=new Ft(3);return r[0]=e,r[1]=t,r[2]=n,r}function kA(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function h0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ts(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function es(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Hc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Yc(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function HA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function YA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function WA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function JA(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&h0(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var jA=ov;var utt=function(){let e=c0();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var l0=[0,0,0],Wc,Z=class extends $r{static get ZERO(){return Wc||(Wc=new Z(0,0,0),Object.freeze(Wc)),Wc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&wn(t)?this.copy(t):(yt.debug&&(j(t),j(n),j(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return yt.debug&&(j(t.x),j(t.y),j(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]=j(t)}angle(t){return JA(this,t)}cross(t){return ts(this,this,t),this.check()}rotateX({radians:t,origin:n=l0}){return HA(this,this,n,t),this.check()}rotateY({radians:t,origin:n=l0}){return YA(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=l0}){return WA(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return es(this,this,t),this.check()}transformAsVector(t){return Vc(this,this,t),this.check()}transformByMatrix3(t){return Hc(this,this,t),this.check()}transformByMatrix2(t){return qA(this,this,t),this.check()}transformByQuaternion(t){return Yc(this,this,t),this.check()}};var Jc,ns=class extends $r{static get ZERO(){return Jc||(Jc=new ns(0,0,0,0),Object.freeze(Jc)),Jc}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),wn(t)&&arguments.length===1?this.copy(t):(yt.debug&&(j(t),j(n),j(r),j(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 yt.debug&&(j(t.x),j(t.y),j(t.z),j(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]=j(t)}get w(){return this[3]}set w(t){this[3]=j(t)}transform(t){return es(this,this,t),this.check()}transformByMatrix3(t){return kc(this,this,t),this.check()}transformByMatrix2(t){return VA(this,this,t),this.check()}transformByQuaternion(t){return Yc(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var rs=class extends Rn{toString(){let t="[";if(yt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=j(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function XA(){let e=new Ft(9);return Ft!=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 KA(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 QA(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function ZA(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function f0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function $A(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function ty(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function p0(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 ey(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var u0;(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"})(u0||(u0={}));var hv=Object.freeze([1,0,0,0,1,0,0,0,1]),ir=class extends rs{static get IDENTITY(){return fv()}static get ZERO(){return lv()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return u0}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(hv)}fromObject(t){return this.check()}fromQuaternion(t){return ey(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return ZA(this)}transpose(){return KA(this,this),this.check()}invert(){return QA(this,this),this.check()}multiplyLeft(t){return f0(this,t,this),this.check()}multiplyRight(t){return f0(this,this,t),this.check()}rotate(t){return ty(this,this,t),this.check()}scale(t){return Array.isArray(t)?p0(this,this,t):p0(this,this,[t,t]),this.check()}translate(t){return $A(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=UA(n||[-0,-0],t,this);break;case 3:r=Hc(n||[-0,-0,-0],t,this);break;case 4:r=kc(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return In(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},jc,Xc=null;function lv(){return jc||(jc=new ir([0,0,0,0,0,0,0,0,0]),Object.freeze(jc)),jc}function fv(){return Xc||(Xc=new ir,Object.freeze(Xc)),Xc}function pv(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 ny(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 ry(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,B=l*g-f*d,S=l*m-p*d,x=l*M-u*d,w=f*m-p*g,R=f*M-u*g,I=p*M-u*m,C=E*I-A*R+y*w+T*x-_*S+L*B;return C?(C=1/C,e[0]=(c*I-a*R+h*w)*C,e[1]=(s*R-r*I-i*w)*C,e[2]=(g*L-m*_+M*T)*C,e[3]=(p*_-f*L-u*T)*C,e[4]=(a*x-o*I-h*S)*C,e[5]=(n*I-s*x+i*S)*C,e[6]=(m*y-d*L-M*A)*C,e[7]=(l*L-p*y+u*A)*C,e[8]=(o*R-c*x+h*B)*C,e[9]=(r*x-n*R-i*B)*C,e[10]=(d*_-g*y+M*E)*C,e[11]=(f*y-l*_-u*E)*C,e[12]=(c*S-o*w-a*B)*C,e[13]=(n*w-r*S+s*B)*C,e[14]=(g*A-d*T-m*E)*C,e[15]=(l*T-f*A+p*E)*C,e):null}function sy(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,B=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*B+m*S-p*x}function d0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function iy(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function oy(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function cy(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,B,S,x,w,R,I,C,P;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,B=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,w=i*i*l+a,R=o*i*l+s*h,I=s*o*l+i*h,C=i*o*l-s*h,P=o*o*l+a,e[0]=f*L+g*B+A*S,e[1]=p*L+m*B+y*S,e[2]=u*L+M*B+T*S,e[3]=d*L+E*B+_*S,e[4]=f*x+g*w+A*R,e[5]=p*x+m*w+y*R,e[6]=u*x+M*w+T*R,e[7]=d*x+E*w+_*R,e[8]=f*I+g*C+A*P,e[9]=p*I+m*C+y*P,e[10]=u*I+M*C+T*P,e[11]=d*I+E*C+_*P,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ay(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function hy(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function ly(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function fy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function py(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function uv(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var uy=uv;function dv(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var dy=dv;function my(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?pv(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function mv(){let e=new Ft(4);return Ft!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function gy(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function xy(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function My(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Ay(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function yy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Ey(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Ty(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function _y(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function Sy(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var Utt=function(){let e=mv();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var x0;(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"})(x0||(x0={}));var xv=45*Math.PI/180,Mv=1,m0=.1,g0=500,Av=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bn=class extends rs{static get IDENTITY(){return Ev()}static get ZERO(){return yv()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return x0}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(Av)}fromObject(t){return this.check()}fromQuaternion(t){return fy(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=m0,far:c=g0}=t;return c===1/0?Tv(this,n,r,s,i,o):py(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return my(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=m0,far:c=g0}=t;return dy(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=xv,aspect:r=Mv,focalDistance:s=1,near:i=m0,far:o=g0}=t;By(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return By(n),uy(this,n,r,s,i),this.check()}determinant(){return sy(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return ny(this,this),this.check()}invert(){return ry(this,this),this.check()}multiplyLeft(t){return d0(this,t,this),this.check()}multiplyRight(t){return d0(this,this,t),this.check()}rotateX(t){return ay(this,this,t),this.check()}rotateY(t){return hy(this,this,t),this.check()}rotateZ(t){return ly(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return cy(this,this,t,n),this.check()}scale(t){return oy(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return iy(this,this,t),this.check()}transform(t,n){return t.length===4?(n=_y(n||[-0,-0,-0,-0],t,this),In(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=GA(n||[-0,-0],t,this);break;case 3:s=es(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return In(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=zA(n||[-0,-0],t,this);break;case 3:r=Vc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return In(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},Kc,Qc;function yv(){return Kc||(Kc=new bn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Kc)),Kc}function Ev(){return Qc||(Qc=new bn,Object.freeze(Qc)),Qc}function By(e){if(e>Math.PI*2)throw Error("expected radians")}function Tv(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function Cy(){let e=new Ft(4);return Ft!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Ly(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function M0(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function A0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function wy(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Ry(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Iy(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function by(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Bi(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function Oy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function Py(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function y0(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var Ny=gy;var vy=xy,Fy=Ey,Dy=Ty,Uy=My;var Gy=Ay;var zy=yy;var qy=function(){let e=c0(),t=a0(1,0,0),n=a0(0,1,0);return function(r,s,i){let o=h0(s,i);return o<-.999999?(ts(e,t,s),jA(e)<1e-6&&ts(e,n,s),kA(e,e),M0(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(ts(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,zy(r,r))}}(),Ztt=function(){let e=Cy(),t=Cy();return function(n,r,s,i,o,c){return Bi(e,r,o,c),Bi(t,s,i,c),Bi(n,e,t,2*c*(1-c)),n}}(),$tt=function(){let e=XA();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],zy(t,y0(t,e))}}();var _v=[0,0,0,1],Ci=class extends Rn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 y0(this,t),this.check()}fromAxisRotation(t,n){return M0(this,t,n),this.check()}identity(){return Ly(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=j(t)}get y(){return this[1]}set y(t){this[1]=j(t)}get z(){return this[2]}set z(t){this[2]=j(t)}get w(){return this[3]}set w(t){this[3]=j(t)}len(){return Uy(this)}lengthSquared(){return Gy(this)}dot(t){return Fy(this,t)}rotationTo(t,n){return qy(this,t,n),this.check()}add(t){return Ny(this,this,t),this.check()}calculateW(){return by(this,this),this.check()}conjugate(){return Py(this,this),this.check()}invert(){return Oy(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(Dy(this,t,n,r),this.check())}multiplyRight(t){return A0(this,this,t),this.check()}multiplyLeft(t){return A0(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return wy(this,this,t),this.check()}rotateY(t){return Ry(this,this,t),this.check()}rotateZ(t){return Iy(this,this,t),this.check()}scale(t){return vy(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=_v,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Bi(this,s,i,o),this.check()}transformVector4(t,n=new ns){return Sy(n,t,this),In(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Ke=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,n){this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,n=D.UNSIGNED_INT,r=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=vt.fromName(s.componentType)),this._getTypedArrayFromBinary(t,n,r,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,n,s)}getProperty(t,n,r,s,i){let o=this.json[t];if(!o)return o;let c=this.getPropertyArray(t,n,r);if(r===1)return c[s];for(let a=0;a<r;++a)i[a]=c[r*s+a];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,c=o[t];return c||(c=vt.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=c),c}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=vt.createTypedArray(n,r),s[t]=i),i}};var Sv={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Bv={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]]},Cv={SCALAR:(e,t,n)=>{t[n]=e},VEC2:(e,t,n)=>{t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:(e,t,n)=>{t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:(e,t,n)=>{t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:(e,t,n)=>{t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};function Vy(e,t,n,r){let{componentType:s}=e;q(e.componentType);let i=typeof s=="string"?vt.fromName(s):s,o=Sv[e.type],c=Bv[e.type],a=Cv[e.type];return n+=e.byteOffset,{values:vt.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:c,packer:a}}var ve=e=>e!==void 0;function ky(e,t,n){if(!t)return null;let r=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,r=s),r?Lv(r,n):null}function Lv(e,t){let n,r,s,i=e.instancesLength,o=e.classes,c=e.classIds,a=e.parentCounts,h=e.parentIds,l=i;ve(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,i));let f;if(ve(a))for(ve(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,i)),f=new Uint16Array(i),l=0,n=0;n<i;++n)f[n]=l,l+=a[n];ve(h)&&ve(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,s=getBinaryAccessor(h),h=s.createArrayBufferView(t.buffer,t.byteOffset+h.byteOffset,l));let p=o.length;for(n=0;n<p;++n){let m=o[n].length,M=o[n].instances,E=getBinaryProperties(m,M,t);o[n].instances=combine(E,M)}let u=new Array(p).fill(0),d=new Uint16Array(i);for(n=0;n<i;++n)r=c[n],d[n]=u[r],++u[r];let g={classes:o,classIds:c,classIndexes:d,parentCounts:a,parentIndexes:f,parentIds:h};return Iv(g),g}function ss(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?wv(e,t,n):Rv(e,t,n)}function wv(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,c=r.length,a=scratchVisited;a.length=Math.max(a.length,c);let h=++marker,l=scratchStack;for(l.length=0,l.push(t);l.length>0;){if(t=l.pop(),a[t]===h)continue;a[t]=h;let f=n(e,t);if(ve(f))return f;let p=s[t],u=o[t];for(let d=0;d<p;++d){let g=i[u+d];g!==t&&l.push(g)}}return null}function Rv(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(ve(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function Iv(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)Hy(e,s,stack)}function Hy(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,c=e.classIds.length;if(!ve(s))return;assert(t<c,`Parent index ${t} exceeds the total number of instances: ${c}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let a=ve(r)?r[t]:1,h=ve(r)?i[t]:t;for(let l=0;l<a;++l){let f=s[h+l];f!==t&&Hy(e,f,n)}n.pop(t)}function Ht(e){return e!=null}var Zc=(e,t)=>e,bv={HIERARCHY:!0,extensions:!0,extras:!0},or=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,n,r,s={}){q(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=this.json?.extensions||{},this._properties={};for(let i in this.json)bv[i]||(this._properties[i]=this.json[i]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=ky(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,n){if(this._checkBatchId(t),q(typeof n=="string",n),this._hierarchy){let r=ss(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return Ht(r)}return!1}isExactClass(t,n){return q(typeof n=="string",n),this.getExactClassName(t)===n}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let n=this._hierarchy.classIds[t];return this._hierarchy.classes[n].name}}hasProperty(t,n){return this._checkBatchId(t),q(typeof n=="string",n),Ht(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=Ht(n)?n:[],n.length=0;let r=Object.keys(this._properties);return n.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,n),n}getProperty(t,n){if(this._checkBatchId(t),q(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(Ht(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(Ht(r))return Zc(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(Ht(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),q(typeof n=="string",n),this._binaryProperties){let o=this._binaryProperties[n];if(o){this._setBinaryProperty(o,t,r);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,n,r))return;let i=this._properties[n];Ht(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=Zc(r,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,n){return t.unpack(t.typedArray,n)}_setBinaryProperty(t,n,r){t.pack(r,t.typedArray,n)}_initializeBinaryProperties(){let t=null;for(let n in this._properties){let r=this._properties[n],s=this._initializeBinaryProperty(n,r);s&&(t=t||{},t[n]=s)}return t}_initializeBinaryProperty(t,n){if("byteOffset"in n){let r=n;q(this.binary,`Property ${t} requires a batch table binary.`),q(r.type,`Property ${t} requires a type.`);let s=Vy(r,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,n){if(!this._hierarchy)return!1;let r=ss(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],c=s.classes[o].instances;return Ht(c[n])});return Ht(r)}_getPropertyNamesInHierarchy(t,n){ss(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let c in o)o.hasOwnProperty(c)&&n.indexOf(c)===-1&&n.push(c)})}_getHierarchyProperty(t,n){return ss(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],c=r.classIndexes[s],a=o.instances[n];return Ht(a)?Ht(a.typedArray)?this._getBinaryProperty(a,c):Zc(a[c],!0):null})}_setHierarchyProperty(t,n,r,s){let i=ss(this._hierarchy,n,(o,c)=>{let a=o.classIds[c],h=o.classes[a],l=o.classIndexes[c],f=h.instances[r];return Ht(f)?(q(c===n,`Inherited property "${r}" is read-only.`),Ht(f.typedArray)?this._setBinaryProperty(f,l,s):f[l]=Zc(s,!0),!0):!1});return Ht(i)}};function On(e,t,n=0){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var is=4,Yy="b3dm tile in legacy format.";function os(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=is;let o=r.getUint32(n,!0);n+=is;let c=r.getUint32(n,!0);n+=is;let a=r.getUint32(n,!0);return n+=is,c>=570425344?(n-=is*2,s=i,c=o,a=0,i=0,o=0,console.warn(Yy)):a>=570425344&&(n-=is,s=c,c=i,a=o,i=0,o=0,console.warn(Yy)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=c,e.header.batchTableBinaryByteLength=a,e.header.batchLength=s,n}function cs(e,t,n,r){return n=Ov(e,t,n,r),n=Pv(e,t,n,r),n}function Ov(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let c=Wf(t,n,s);e.featureTableJson=JSON.parse(c)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function Pv(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=Wf(t,n,s);e.batchTableJson=JSON.parse(o),n+=s,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function E0(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let c=0;c<i;c++){let a=r[c],l=n.getProperty(a,"dimensions").map(f=>f*255);o[c*3]=l[0],o[c*3+1]=l[1],o[c*3+2]=l[2]}return{type:D.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let c=0;c<i;c++){let a=r0(t[c]);o[c*3]=a[0],o[c*3+1]=a[1],o[c*3+2]=a[2]}return{type:D.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:D.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:D.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var Wy=new Z;function Jy(e,t){if(!t)return null;if(e.isOctEncoded16P){let n=new Float32Array((e.pointsLength||0)*3);for(let r=0;r<(e.pointsLength||0);r++)s0(t[r*2],t[r*2+1],Wy),Wy.toArray(n,r*3);return{type:D.FLOAT,size:2,value:n}}return{type:D.FLOAT,size:2,value:t}}function jy(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,Nv(e,t)):{type:D.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function Nv(e,t){let n=new Z,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function Xy(e,t,n,r,s){n=On(e,t,n),n=os(e,t,n),n=cs(e,t,n,r),vv(e);let{featureTable:i,batchTable:o}=Fv(e);return await qv(e,i,o,r,s),Dv(e,i,r),Uv(e,i,o),Gv(e,i),n}function vv(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function Fv(e){let t=new Ke(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",D.FLOAT,3);let r=zv(e,t);return{featureTable:t,batchTable:r}}function Dv(e,t,n){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",D.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",D.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",D.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",D.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=jy(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function Uv(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let r=null;t.hasProperty("RGBA")?(r=t.getPropertyArray("RGBA",D.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",D.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",D.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=E0(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",D.UNSIGNED_BYTE,4))}function Gv(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",D.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",D.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=Jy(e,n)}}function zv(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",D.UNSIGNED_SHORT,1),e.batchIds)){let r=t.getGlobalProperty("BATCH_LENGTH");if(!r)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=e;n=new or(s,i,r)}return n}async function qv(e,t,n,r,s){let i,o,c,a=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];a&&(c=a.properties);let h=t.getExtension("3DTILES_draco_point_compression");if(h){o=h.properties;let f=h.byteOffset,p=h.byteLength;if(!o||!Number.isFinite(f)||!p)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(f,f+p),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let l={buffer:i,properties:{...o,...c},featureTableProperties:o,batchTableProperties:c,dequantizeInShader:!1};return await Vv(e,l,r,s)}async function Vv(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Xt(t.buffer,Uc,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,c=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,a=i.attributes.NORMAL&&i.attributes.NORMAL.value,h=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,l=o&&i.attributes.POSITION.value.quantization,f=a&&i.attributes.NORMAL.value.quantization;if(l){let u=i.POSITION.data.quantization,d=u.range;e.quantizedVolumeScale=new Z(d,d,d),e.quantizedVolumeOffset=new Z(u.minValues),e.quantizedRange=(1<<u.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let u of Object.keys(t.batchTableProperties))i.attributes[u]&&i.attributes[u].value&&(p[u.toLowerCase()]=i.attributes[u].value);e.attributes={positions:o,colors:E0(e,c,void 0),normals:a,batchIds:h,...p}}var T0={};Et(T0,{decode:()=>tF,name:()=>$v});function _t(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var $c={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ta={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var kv=1.33,Ky=["SCALAR","VEC2","VEC3","VEC4"],Hv=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],Yv=new Map(Hv),Wv={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Jv={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},jv={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function ea(e){return Ky[e-1]||Ky[0]}function as(e){let t=Yv.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function hs(e,t){let n=jv[e.componentType],r=Wv[e.type],s=Jv[e.componentType],i=e.count*r,o=e.count*r*s;_t(o>=0&&o<=t.byteLength);let c=ta[e.componentType],a=$c[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:c,numberOfComponentsInElement:a}}function Li(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,c)=>o+c.byteLength,0),i=t.reduce((o,c)=>{let{width:a,height:h}=c.image;return o+a*h},0);return s+Math.ceil(4*i*kv)}function Qy(e,t,n){let r=e.bufferViews[n];_t(r);let s=r.buffer,i=t[s];_t(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function Zy(e,t,n){let r=typeof n=="number"?e.accessors?.[n]:n;if(!r)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let s=e.bufferViews?.[r.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:i,byteOffset:o}=t[s.buffer],c=(o||0)+(r.byteOffset||0)+(s.byteOffset||0),{ArrayType:a,length:h,componentByteSize:l,numberOfComponentsInElement:f}=hs(r,s),p=l*f,u=s.byteStride||p;if(typeof s.byteStride>"u"||s.byteStride===p)return new a(i,c,h);let d=new a(h);for(let g=0;g<r.count;g++){let m=new a(i,c+g*u,f);d.set(m,g*f)}return d}function Xv(){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||Xv(),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 n=this.getUsedExtensions().find(s=>s===t),r=this.getRequiredExtensions().find(s=>s===t);return typeof n=="string"||typeof r=="string"}getExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.json.extensions||{};return n?r[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(r=>r===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,n){return(t.extensions||{})[n]}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,n){if(typeof n=="object")return n;let r=this.json[t]&&this.json[t][n];if(!r)throw new Error(`glTF file error: Could not find ${t}[${n}]`);return r}getTypedArrayForBufferView(t){t=this.getBufferView(t);let n=t.buffer,r=this.gltf.buffers[n];_t(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return Zy(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t,n={}){return _t(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t,n={}){return _t(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(t)||n.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:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,c={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let a=this._addIndices(r);c.primitives[0].indices=a}return Number.isFinite(s)&&(c.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=Yn(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,n=0,r=this.byteLength){let s=t.byteLength;_t(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=an(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:ea(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,n={size:3}){let r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:as(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),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(){this.gltf.buffers=[];let t=this.byteLength,n=new ArrayBuffer(t),r=new Uint8Array(n),s=0;for(let i of this.sourceBuffers||[])s=Qh(i,r,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(t={}){let n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_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,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function $y(e){return(e%1+1)%1}var t3={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},Kv={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},e3={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function wi(e,t){return e3[t]*t3[e]}function ls(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=fs(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function fs(e,t,n,r=1){let s=t3[t],i=Kv[n],o=e3[n],c=r*s,a=c*o,h=e.buffer,l=e.byteOffset;return l%o!==0&&(h=new Uint8Array(h).slice(l,l+a).buffer,l=0),new i(h,l,c)}function ps(e,t,n){let r=`TEXCOORD_${t.texCoord||0}`,s=n.attributes[r],i=e.getTypedArrayForAccessor(s),o=e.gltf.json,c=t.index,a=o.textures?.[c]?.source;if(typeof a<"u"){let h=o.images?.[a]?.mimeType,l=e.gltf.images?.[a];if(l&&typeof l.width<"u"){let f=[];for(let p=0;p<i.length;p+=2){let u=Qv(l,h,i,p,t.channels);f.push(u)}return f}}return[]}function na(e,t,n,r,s){if(!n?.length)return;let i=[];for(let l of n){let f=r.findIndex(p=>p===l);f===-1&&(f=r.push(l)-1),i.push(f)}let o=new Uint32Array(i),c=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,a=e.addBufferView(o,c,0),h=e.addAccessor(a,{size:1,componentType:as(o),count:o.length});s.attributes[t]=h}function Qv(e,t,n,r,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],c=n[r+1],a=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(a=4);let h=Zv(o,c,e,a),l=0;for(let f of s){let p=typeof f=="number"?Object.values(i)[f]:i[f],u=h+p.offset,d=js(e);if(d.data.length<=u)throw new Error(`${d.data.length} <= ${u}`);let g=d.data[u];l|=g<<p.shift}return l}function Zv(e,t,n,r=1){let s=n.width,i=$y(e)*(s-1),o=Math.round(i),c=n.height,a=$y(t)*(c-1),h=Math.round(a),l=n.components?n.components:r;return(h*s+o)*l}function ra(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let c=n[o],a=n[o+1]-n[o];if(a+c>r)break;let h=c/s,l=a/s;i.push(e.slice(h,h+l))}return i}function sa(e,t,n){let r=[];for(let s=0;s<t;s++){let i=s*n;r.push(e.slice(i,i+n))}return r}function ia(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let c=0;c<e;c++){let a=r[c+1]-r[c];if(a+o<=t.length){let h=t.subarray(o,a+o),l=i.decode(h);s.push(l),o+=a}}return s}return[]}var n3="EXT_mesh_features",$v=n3;async function tF(e,t){let n=new Q(e);eF(n,t)}function eF(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)nF(e,s,t)}function nF(e,t,n){if(!n?.gltf?.loadBuffers)return;let s=t.extensions?.[n3]?.featureIds;if(s)for(let i of s){let o;if(typeof i.attribute<"u"){let c=`_FEATURE_ID_${i.attribute}`,a=t.attributes[c];o=e.getTypedArrayForAccessor(a)}else typeof i.texture<"u"&&n?.gltf?.loadImages?o=ps(e,i.texture,t):o=[];i.data=o}}var B0={};Et(B0,{decode:()=>sF,name:()=>rF});var _0="EXT_structural_metadata",rF=_0;async function sF(e,t){let n=new Q(e);iF(n,t)}function iF(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(_0);n&&(t.gltf?.loadImages&&oF(e,n),cF(e,n))}function oF(e,t){let n=t.propertyTextures,r=e.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let i of s.primitives)hF(e,n,i,t)}function cF(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.propertyTables;if(r&&s)for(let i in r){let o=aF(s,i);o&&fF(e,n,o)}}function aF(e,t){for(let n of e)if(n.class===t)return n;return null}function hF(e,t,n,r){if(!t)return;let i=n.extensions?.[_0]?.propertyTextures;if(i)for(let o of i){let c=t[o];lF(e,c,n,r)}}function lF(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let i in t.properties){let o=`${s}_${i}`,c=t.properties?.[i];if(!c)continue;c.data||(c.data=[]);let a=c.data,h=ps(e,c,n);h!==null&&(na(e,o,h,a,n),c.data=a,r.dataAttributeNames.push(o))}}function fF(e,t,n){let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let i in r.properties){let o=r.properties[i],c=n.properties?.[i];if(c){let a=pF(e,t,o,s,c);c.data=a}}}function pF(e,t,n,r,s){let i=[],o=s.values,c=e.getTypedArrayForBufferView(o),a=uF(e,n,s,r),h=dF(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=mF(n,r,c,a);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=ia(r,c,a,h);break}case"ENUM":{i=gF(t,n,r,c,a);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function uF(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?ls(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function dF(e,t,n){return typeof t.stringOffsets<"u"?ls(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function mF(e,t,n,r){let s=e.array,i=e.count,o=wi(e.type,e.componentType),c=n.byteLength/o,a;return e.componentType?a=fs(n,e.type,e.componentType,c):a=n,s?r?ra(a,t,r,n.length,o):i?sa(a,t,i):[]:a}function gF(e,t,n,r,s){let i=t.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=e.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let c=o.valueType||"UINT16",a=wi(t.type,c),h=r.byteLength/a,l=fs(r,t.type,c,h);if(l||(l=r),t.array){if(s)return xF({valuesData:l,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:a,enumEntry:o});let f=t.count;return f?MF(l,n,f,o):[]}return S0(l,0,n,o)}function xF(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,c=[];for(let a=0;a<n;a++){let h=r[a],l=r[a+1]-r[a];if(l+h>s)break;let f=h/i,p=l/i,u=S0(t,f,p,o);c.push(u)}return c}function MF(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,c=S0(e,o,n,r);s.push(c)}return s}function S0(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],c=AF(r,o);c?s.push(c.name):s.push("")}return s}function AF(e,t){for(let n of e.values)if(n.value===t)return n;return null}var C0={};Et(C0,{decode:()=>EF,name:()=>yF});var r3="EXT_feature_metadata",yF=r3;async function EF(e,t){let n=new Q(e);TF(n,t)}function TF(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(r3);n&&(t.gltf?.loadImages&&_F(e,n),SF(e,n))}function _F(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],c=CF(s,i);c&&wF(e,c,o)}}function SF(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.featureTables;if(r&&s)for(let i in r){let o=BF(s,i);o&&LF(e,n,o)}}function BF(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function CF(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function LF(e,t,n){if(!n.class)return;let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let i in r.properties){let o=r.properties[i],c=n.properties?.[i];if(c){let a=RF(e,t,o,s,c);c.data=a}}}function wF(e,t,n){let r=t.class;for(let s in n.properties){let i=t?.properties?.[s];if(i){let o=NF(e,i,r);i.data=o}}}function RF(e,t,n,r,s){let i=[],o=s.bufferView,c=e.getTypedArrayForBufferView(o),a=IF(e,n,s,r),h=bF(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=ia(r,c,a,h):OF(n)&&(i=PF(n,r,c,a)),i}function IF(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?ls(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function bF(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?ls(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function OF(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 PF(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",c=e.componentType||e.type,a=wi(o,c),h=n.byteLength/a,l=fs(n,o,c,h);return s?r?ra(l,t,r,n.length,a):i?sa(l,t,i):[]:l}function NF(e,t,n){let r=e.gltf.json;if(!r.meshes)return[];let s=[];for(let i of r.meshes)for(let o of i.primitives)vF(e,n,t,s,o);return s}function vF(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=ps(e,i,s);o&&na(e,t,o,r,s)}var s3="4.2.1";var us=!0,i3=1735152710,R0=12,oa=8,FF=1313821514,DF=5130562,UF=0,GF=0,zF=1;function qF(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 o3(e,t=0,n={}){let r=new DataView(e),{magic:s=i3}=n,i=r.getUint32(t,!1);return i===s||i===i3}function c3(e,t,n=0,r={}){let s=new DataView(t),i=qF(s,n+0),o=s.getUint32(n+4,us),c=s.getUint32(n+8,us);switch(Object.assign(e,{header:{byteOffset:n,byteLength:c,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=R0,e.version){case 1:return VF(e,s,n);case 2:return kF(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function VF(e,t,n){q(e.header.byteLength>R0+oa);let r=t.getUint32(n+0,us),s=t.getUint32(n+4,us);return n+=oa,q(s===UF),L0(e,t,n,r),n+=r,n+=w0(e,t,n,e.header.byteLength),n}function kF(e,t,n,r){return q(e.header.byteLength>R0+oa),HF(e,t,n,r),n+e.header.byteLength}function HF(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,us),i=t.getUint32(n+4,us);switch(n+=oa,i){case FF:L0(e,t,n,s);break;case DF:w0(e,t,n,s);break;case GF:r.strict||L0(e,t,n,s);break;case zF:r.strict||w0(e,t,n,s);break;default:break}n+=an(s,4)}return n}function L0(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),an(r,4)}function w0(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),an(r,4)}function I0(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let r=t.baseUri||t.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return r.substr(0,r.lastIndexOf("/")+1)+e}var O0={};Et(O0,{decode:()=>n5,name:()=>e5});var YF="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",WF="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",JF=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]),jF=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]),XF={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},KF={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function a3(e,t,n,r,s,i="NONE"){let o=await QF();t5(o,o.exports[KF[s]],e,t,n,r,o.exports[XF[i||"NONE"]])}var b0;async function QF(){return b0||(b0=ZF()),b0}async function ZF(){let e=YF;WebAssembly.validate(JF)&&(e=WF,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate($F(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function $F(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);t[r]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;r<e.length;++r)t[n++]=t[r]<60?jF[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function t5(e,t,n,r,s,i,o){let c=e.exports.sbrk,a=r+3&-4,h=c(a*s),l=c(i.length),f=new Uint8Array(e.exports.memory.buffer);f.set(i,l);let p=t(h,r,s,l,i.length);if(p===0&&o&&o(h,a,s),n.set(f.subarray(h,h+r*s)),c(h-c(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var ca="EXT_meshopt_compression",e5=ca;async function n5(e,t){let n=new Q(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let r=[];for(let s of e.json.bufferViews||[])r.push(r5(n,s));await Promise.all(r),n.removeExtension(ca)}async function r5(e,t){let n=e.getObjectExtension(t,ca);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:c,filter:a="NONE",buffer:h}=n,l=e.gltf.buffers[h],f=new Uint8Array(l.arrayBuffer,l.byteOffset+r,s),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await a3(p,o,i,f,c,a),e.removeObjectExtension(t,ca)}}var P0={};Et(P0,{name:()=>s5,preprocess:()=>i5});var ds="EXT_texture_webp",s5=ds;function i5(e,t){let n=new Q(e);if(!al("image/webp")){if(n.getRequiredExtensions().includes(ds))throw new Error(`gltf: Required extension ${ds} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,ds);i&&(s.source=i.source),n.removeObjectExtension(s,ds)}n.removeExtension(ds)}var N0={};Et(N0,{name:()=>o5,preprocess:()=>c5});var aa="KHR_texture_basisu",o5=aa;function c5(e,t){let n=new Q(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,aa);i&&(s.source=i.source,n.removeObjectExtension(s,aa))}n.removeExtension(aa)}var F0={};Et(F0,{decode:()=>p5,encode:()=>u5,name:()=>l5,preprocess:()=>f5});function h3(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=v0(r);t[n]=s}}return t}function v0(e){let{buffer:t,size:n,count:r}=a5(e);return{value:t,size:n,byteOffset:0,count:r,type:ea(n),componentType:as(t)}}function a5(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=h5(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function h5(e,t,n=!1){return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var Pn="KHR_draco_mesh_compression",l5=Pn;function f5(e,t,n){let r=new Q(e);for(let s of l3(r))r.getObjectExtension(s,Pn)}async function p5(e,t,n){if(!t?.gltf?.decompressMeshes)return;let r=new Q(e),s=[];for(let i of l3(r))r.getObjectExtension(i,Pn)&&s.push(d5(r,i,t,n));await Promise.all(s),r.removeExtension(Pn)}function u5(e,t={}){let n=new Q(e);for(let r of n.json.meshes||[])m5(r,t),n.addRequiredExtension(Pn)}async function d5(e,t,n,r){let s=e.getObjectExtension(t,Pn);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=qn(i.buffer,i.byteOffset),c={...n};delete c["3d-tiles"];let a=await Xt(o,Uc,c,r),h=h3(a.attributes);for(let[l,f]of Object.entries(h))if(l in t.attributes){let p=t.attributes[l],u=e.getAccessor(p);u?.min&&u?.max&&(f.min=u.min,f.max=u.max)}t.attributes=h,a.indices&&(t.indices=v0(a.indices)),e.removeObjectExtension(t,Pn),g5(t)}function m5(e,t,n=4,r,s){if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let i=r.DracoWriter.encodeSync({attributes:e}),o=s?.parseSync?.({attributes:e}),c=r._addFauxAttributes(o.attributes),a=r.addBufferView(i);return{primitives:[{attributes:c,mode:n,extensions:{[Pn]:{bufferView:a,attributes:c}}}]}}function g5(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*l3(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var k0={};Et(k0,{decode:()=>O5,name:()=>R5});var Ont=1/Math.PI*180,Pnt=1/180*Math.PI,x5={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...x5}};var Rt=globalThis.mathgl.config;function f3(e,{precision:t=Rt.precision}={}){return e=M5(e),`${parseFloat(e.toPrecision(t))}`}function ms(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function D0(e,t,n){let r=Rt.EPSILON;n&&(Rt.EPSILON=n);try{if(e===t)return!0;if(ms(e)&&ms(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!D0(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)<=Rt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Rt.EPSILON=r}}function M5(e){return Math.round(e/Rt.EPSILON)*Rt.EPSILON}var gs=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:ms(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Rt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+f3(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!D0(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Rt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function A5(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Dt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function p3(e,t,n=""){if(Rt.debug&&!A5(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function U0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var ha=class extends gs{get x(){return this[0]}set x(t){this[0]=Dt(t)}get y(){return this[1]}set y(t){this[1]=Dt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Dt(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Dt(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return U0(t>=0&&t<this.ELEMENTS,"index is out of range"),Dt(this[t])}setComponent(t,n){return U0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var xs=typeof Float32Array<"u"?Float32Array:Array;var Hnt=Math.PI/180;function _5(){let e=new xs(2);return xs!=Float32Array&&(e[0]=0,e[1]=0),e}function d3(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var Ynt=function(){let e=_5();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function m3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function g3(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function x3(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function S5(){let e=new xs(3);return xs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function B5(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function M3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function A3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function la(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function y3(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function E3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function T3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function _3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function S3(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&B5(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var jnt=function(){let e=S5();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var G0=[0,0,0],fa,cr=class extends ha{static get ZERO(){return fa||(fa=new cr(0,0,0),Object.freeze(fa)),fa}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&ms(t)?this.copy(t):(Rt.debug&&(Dt(t),Dt(n),Dt(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Rt.debug&&(Dt(t.x),Dt(t.y),Dt(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]=Dt(t)}angle(t){return S3(this,t)}cross(t){return M3(this,this,t),this.check()}rotateX({radians:t,origin:n=G0}){return E3(this,this,n,t),this.check()}rotateY({radians:t,origin:n=G0}){return T3(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=G0}){return _3(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return A3(this,this,t),this.check()}transformAsVector(t){return m3(this,this,t),this.check()}transformByMatrix3(t){return la(this,this,t),this.check()}transformByMatrix2(t){return g3(this,this,t),this.check()}transformByQuaternion(t){return y3(this,this,t),this.check()}};var pa=class extends gs{toString(){let t="[";if(Rt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=Dt(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function B3(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 C3(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function L3(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function z0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function w3(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function R3(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function q0(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 I3(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var V0;(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"})(V0||(V0={}));var C5=Object.freeze([1,0,0,0,1,0,0,0,1]),Qe=class extends pa{static get IDENTITY(){return w5()}static get ZERO(){return L5()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return V0}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(C5)}fromObject(t){return this.check()}fromQuaternion(t){return I3(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return L3(this)}transpose(){return B3(this,this),this.check()}invert(){return C3(this,this),this.check()}multiplyLeft(t){return z0(this,t,this),this.check()}multiplyRight(t){return z0(this,this,t),this.check()}rotate(t){return R3(this,this,t),this.check()}scale(t){return Array.isArray(t)?q0(this,this,t):q0(this,this,[t,t]),this.check()}translate(t){return w3(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=d3(n||[-0,-0],t,this);break;case 3:r=la(n||[-0,-0,-0],t,this);break;case 4:r=x3(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return p3(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},ua,da=null;function L5(){return ua||(ua=new Qe([0,0,0,0,0,0,0,0,0]),Object.freeze(ua)),ua}function w5(){return da||(da=new Qe,Object.freeze(da)),da}var ga="KHR_texture_transform",R5=ga,ma=new cr,I5=new Qe,b5=new Qe;async function O5(e,t){if(!new Q(e).hasExtension(ga)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let i=0;i<s.length;i++)P5(i,e)}function P5(e,t){let n=t.json.materials?.[e],r=[n?.pbrMetallicRoughness?.baseColorTexture,n?.emissiveTexture,n?.normalTexture,n?.occlusionTexture,n?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let i of r)i&&i?.extensions?.[ga]&&N5(t,e,i,s)}function N5(e,t,n,r){let s=v5(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let c of o.primitives){let a=c.material;Number.isFinite(a)&&t===a&&F5(e,c,s)}}function v5(e,t){let n=e.extensions?.[ga],{texCoord:r=0}=e,{texCoord:s=r}=n;if(!(t.findIndex(([o,c])=>o===r&&c===s)!==-1)){let o=G5(n);return r!==s&&(e.texCoord=s),t.push([r,s]),{originalTexCoord:r,texCoord:s,matrix:o}}return null}function F5(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){let c=e.json.accessors?.[o];if(c&&c.bufferView){let a=e.json.bufferViews?.[c.bufferView];if(a){let{arrayBuffer:h,byteOffset:l}=e.buffers[a.buffer],f=(l||0)+(c.byteOffset||0)+(a.byteOffset||0),{ArrayType:p,length:u}=hs(c,a),d=ta[c.componentType],g=$c[c.type],m=a.byteStride||d*g,M=new Float32Array(u);for(let E=0;E<c.count;E++){let A=new p(h,f+E*m,2);ma.set(A[0],A[1],1),ma.transformByMatrix3(i),M.set([ma[0],ma[1]],E*g)}r===s?D5(c,a,e.buffers,M):U5(s,c,t,e,M)}}}}function D5(e,t,n,r){e.componentType=5126,n.push({arrayBuffer:r.buffer,byteOffset:0,byteLength:r.buffer.byteLength}),t.buffer=n.length-1,t.byteLength=r.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function U5(e,t,n,r,s){r.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=r.json.bufferViews;if(!i)return;i.push({buffer:r.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=r.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),n.attributes[`TEXCOORD_${e}`]=o.length-1)}function G5(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new Qe().set(1,0,0,0,1,0,t[0],t[1],1),i=I5.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=b5.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var H0={};Et(H0,{decode:()=>q5,encode:()=>V5,name:()=>z5});var ar="KHR_lights_punctual",z5=ar;async function q5(e){let t=new Q(e),{json:n}=t,r=t.getExtension(ar);r&&(t.json.lights=r.lights,t.removeExtension(ar));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,ar);i&&(s.light=i.light),t.removeObjectExtension(s,ar)}}async function V5(e){let t=new Q(e),{json:n}=t;if(n.lights){let r=t.addExtension(ar);_t(!r.lights),r.lights=n.lights,delete n.lights}if(t.json.lights){for(let r of t.json.lights){let s=r.node;t.addObjectExtension(s,ar,r)}delete t.json.lights}}var Y0={};Et(Y0,{decode:()=>H5,encode:()=>Y5,name:()=>k5});var Ri="KHR_materials_unlit",k5=Ri;async function H5(e){let t=new Q(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,Ri);t.removeExtension(Ri)}function Y5(e){let t=new Q(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,Ri,{}),t.addExtension(Ri))}var W0={};Et(W0,{decode:()=>J5,encode:()=>j5,name:()=>W5});var Ii="KHR_techniques_webgl",W5=Ii;async function J5(e){let t=new Q(e),{json:n}=t,r=t.getExtension(Ii);if(r){let s=X5(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,Ii);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=K5(i.technique,t)),t.removeObjectExtension(i,Ii)}t.removeExtension(Ii)}}async function j5(e,t){}function X5(e,t){let{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),n.forEach(o=>{o.fragmentShader=r[o.fragmentShader],o.vertexShader=r[o.vertexShader]}),s.forEach(o=>{o.program=n[o.program]}),s}function K5(e,t){let n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(r=>{e.uniforms[r].value&&!(r in n)&&(n[r]=e.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=t.getTexture(n[r].index))}),n}var b3=[B0,T0,O0,P0,N0,F0,H0,Y0,W0,k0,C0];function O3(e,t={},n){let r=b3.filter(s=>N3(s.name,t));for(let s of r)s.preprocess?.(e,t,n)}async function P3(e,t={},n){let r=b3.filter(s=>N3(s.name,t));for(let s of r)await s.decode?.(e,t,n)}function N3(e,t){let n=t?.gltf?.excludeExtensions||{};return!(e in n&&!n[e])}var J0="KHR_binary_glTF";function v3(e){let t=new Q(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,J0);s&&Object.assign(r,s),t.removeObjectExtension(r,J0)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(J0)}var F3={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Z5={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},j0=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),v3(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_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 n in F3)this._convertTopLevelObjectToArray(t,n)}_convertTopLevelObjectToArray(t,n){let r=t[n];if(!(!r||Array.isArray(r))){t[n]=[];for(let s in r){let i=r[s];i.id=i.id||s;let o=t[n].length;t[n].push(i),this.idToIndexMap[n][s]=o}}}_convertObjectIdsToArrayIndices(t){for(let n in F3)this._convertIdsToIndices(t,n);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let n of t.textures)this._convertTextureIds(n);for(let n of t.meshes)this._convertMeshIds(n);for(let n of t.nodes)this._convertNodeIds(n);for(let n of t.scenes)this._convertSceneIds(n)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let n of t.primitives){let{attributes:r,indices:s,material:i}=n;for(let o in r)r[o]=this._convertIdToIndex(r[o],"accessor");s&&(n.indices=this._convertIdToIndex(s,"accessor")),i&&(n.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(n=>this._convertIdToIndex(n,"node"))),t.meshes&&(t.meshes=t.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(t,n){t[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),t[n]=[]);for(let r of t[n])for(let s in r){let i=r[s],o=this._convertIdToIndex(i,s);r[s]=o}}_convertIdToIndex(t,n){let r=Z5[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let n of t.materials){n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let r=n.values?.tex||n.values?.texture2d_0||n.values?.diffuseTex,s=t.textures.findIndex(i=>i.id===r);s!==-1&&(n.pbrMetallicRoughness.baseColorTexture={index:s})}}};function D3(e,t={}){return new j0().normalize(e,t)}async function U3(e,t,n=0,r,s){return $5(e,t,n,r),D3(e,{normalize:r?.gltf?.normalize}),O3(e,r,s),r?.gltf?.loadBuffers&&e.json.buffers&&await t8(e,r,s),r?.gltf?.loadImages&&await e8(e,r,s),await P3(e,r,s),e}function $5(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!o3(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=Kh(t);else if(t instanceof ArrayBuffer){let o={};n=c3(o,t,n,r.glb),_t(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else _t(!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:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function t8(e,t,n){let r=e.json.buffers||[];for(let s=0;s<r.length;++s){let i=r[s];if(i.uri){let{fetch:o}=n;_t(o);let c=I0(i.uri,t),h=await(await n?.fetch?.(c))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete i.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(i.byteLength),byteOffset:0,byteLength:i.byteLength})}}async function e8(e,t,n){let r=n8(e),s=e.json.images||[],i=[];for(let o of r)i.push(r8(e,s[o],o,t,n));return await Promise.all(i)}function n8(e){let t=new Set,n=e.json.textures||[];for(let r of n)r.source!==void 0&&t.add(r.source);return Array.from(t).sort()}async function r8(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let c=I0(t.uri,r),{fetch:a}=s;i=await(await a(c)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let c=Qy(e.json,e.buffers,t.bufferView);i=qn(c.buffer,c.byteOffset,c.byteLength)}_t(i,"glTF image has no data");let o=await Xt(i,[pn,Nl],{...r,mimeType:t.mimeType,basis:r.basis||{format:Ho()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[n]=o}var hr={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:s3,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:s8,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function s8(e,t={},n){t={...hr.options,...t},t.gltf={...hr.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await U3({},e,r,t,n)}var i8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},o8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},oe={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},c8={magFilter:oe.TEXTURE_MAG_FILTER,minFilter:oe.TEXTURE_MIN_FILTER,wrapS:oe.TEXTURE_WRAP_S,wrapT:oe.TEXTURE_WRAP_T},a8={[oe.TEXTURE_MAG_FILTER]:oe.LINEAR,[oe.TEXTURE_MIN_FILTER]:oe.NEAREST_MIPMAP_LINEAR,[oe.TEXTURE_WRAP_S]:oe.REPEAT,[oe.TEXTURE_WRAP_T]:oe.REPEAT};function h8(){return{id:"default-sampler",parameters:a8}}function l8(e){return o8[e]}function f8(e){return i8[e]}var X0=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,n={}){let{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return _t(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t,n={}){let r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}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,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let c in o)i.attributes[c]=this.getAccessor(o[c]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.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 r}_resolveAccessor(t,n){let r=l8(t.componentType),s=f8(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let c=o.bufferView.buffer,{ArrayType:a,byteLength:h}=hs(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+c.byteOffset,f=c.arrayBuffer.slice(l,l+h);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(c,l,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new a(f)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let c=0;c<i;c++){let a=n+c*r;o.set(new Uint8Array(t.arrayBuffer.slice(a,a+s)),c*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):h8(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,n){let r={id:t.id||`sampler-${n}`,...t,parameters:{}};for(let s in r){let i=this._enumSamplerParameter(s);i!==void 0&&(r.parameters[i]=r[s])}return r}_enumSamplerParameter(t){return c8[t]}_resolveImage(t,n){let r={...t,id:t.id||`image-${n}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[n];return s&&(r.image=s),r}_resolveBufferView(t,n){let r=t.buffer,s=this.buffers[r].arrayBuffer,i=this.buffers[r].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${n}`,...t,buffer:this.buffers[r],data:new Uint8Array(s,i,t.byteLength)}}_resolveCamera(t,n){let r={...t,id:t.id||`camera-${n}`};return r.perspective,r.orthographic,r}};function bi(e,t){return new X0().postProcess(e,t)}var xa={URI:0,EMBEDDED:1};function Ma(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r?.["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=qn(t,n,s),e.gltfByteOffset=0,e.gltfByteLength=s,n%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function Aa(e,t,n,r){let s=n?.["3d-tiles"]||{};if(p8(e,t,n),s.loadGLTF){if(!r)return;if(e.gltfUrl){let{fetch:i}=r,o=await i(e.gltfUrl,n);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Xt(e.gltfArrayBuffer,hr,n,r);e.gltf=bi(i),e.gpuMemoryUsageInBytes=Li(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function p8(e,t,n){switch(t){case xa.URI:if(e.gltfArrayBuffer){let r=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(r);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case xa.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function G3(e,t,n,r,s){n=u8(e,t,n,r,s),await Aa(e,xa.EMBEDDED,r,s);let i=e?.gltf?.extensions;return i&&i.CESIUM_RTC&&(e.rtcCenter=i.CESIUM_RTC.center),n}function u8(e,t,n,r,s){n=On(e,t,n),n=os(e,t,n),n=cs(e,t,n,r),n=Ma(e,t,n,r);let i=new Ke(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",D.FLOAT,3),n}async function z3(e,t,n,r,s){return n=d8(e,t,n,r,s),await Aa(e,e.gltfFormat||0,r,s),n}function d8(e,t,n,r,s){if(n=On(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=os(e,t,n);let i=new DataView(t);if(e.gltfFormat=i.getUint32(n,!0),n+=4,n=cs(e,t,n,r),n=Ma(e,t,n,r),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Ke(e.featureTableJson,e.featureTableBinary),c=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",D.FLOAT,3);let a=new or(e.batchTableJson,e.batchTableBinary,c);return m8(e,o,a,c),n}function m8(e,t,n,r){let s=new Array(r),i=new Z,o=new Z,c=new Z,a=new Z,h=new ir,l=new Ci,f=new Z,p={},u=new bn,d=[],g=[],m=[],M=[];for(let E=0;E<r;E++){let A;if(t.hasProperty("POSITION"))A=t.getProperty("POSITION",D.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){A=t.getProperty("POSITION_QUANTIZED",D.UNSIGNED_SHORT,3,E,i);let x=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",D.FLOAT,3);if(!x)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let w=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",D.FLOAT,3);if(!w)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let R=65535;for(let I=0;I<3;I++)A[I]=A[I]/R*w[I]+x[I]}if(!A)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(A),p.translation=i,e.normalUp=t.getProperty("NORMAL_UP",D.FLOAT,3,E,d),e.normalRight=t.getProperty("NORMAL_RIGHT",D.FLOAT,3,E,g);let y=!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",D.UNSIGNED_SHORT,2,E,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",D.UNSIGNED_SHORT,2,E,g),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?(G.WGS84.eastNorthUpToFixedFrame(i,u),u.getRotationMatrix3(h)):h.identity()}y&&(a.copy(o).cross(c).normalize(),h.setColumn(0,o),h.setColumn(1,c),h.setColumn(2,a)),l.fromMatrix3(h),p.rotation=l,f.set(1,1,1);let T=t.getProperty("SCALE",D.FLOAT,1,E,m);Number.isFinite(T)&&f.multiplyByScalar(T);let _=t.getProperty("SCALE_NON_UNIFORM",D.FLOAT,3,E,d);_&&f.scale(_),p.scale=f;let L=t.getProperty("BATCH_ID",D.UNSIGNED_SHORT,1,E,M);L===void 0&&(L=E);let B=new bn().fromQuaternion(p.rotation);u.identity(),u.translate(p.translation),u.multiplyRight(B),u.scale(p.scale);let S=u.clone();s[E]={modelMatrix:S,batchId:L}}e.instances=s}async function q3(e,t,n,r,s,i){n=On(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let c={shape:"tile3d"};e.tiles.push(c),n=await i(t,n,r,s,c)}return n}async function V3(e,t,n,r){if(e.rotateYtoZ=!0,e.gltfUpAxis=n?.["3d-tiles"]?.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n?.["3d-tiles"]?.loadGLTF){if(!r)return t.byteLength;let s=await Xt(t,hr,n,r);e.gltf=bi(s),e.gpuMemoryUsageInBytes=Li(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function K0(e,t=0,n,r,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=iA(e,t),s.type){case er.COMPOSITE:return await q3(s,e,t,n,r,K0);case er.BATCHED_3D_MODEL:return await G3(s,e,t,n,r);case er.GLTF:return await V3(s,e,n,r);case er.INSTANCED_3D_MODEL:return await z3(s,e,t,n,r);case er.POINT_CLOUD:return await Xy(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Q0(e,t,n){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 i=k3(e.slice(8,16)),o=new Uint8Array(e,24,i),a=new TextDecoder("utf8").decode(o),h=JSON.parse(a),l=k3(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+i)),await ya(h,h.tileAvailability,f,n),Array.isArray(h.contentAvailability))for(let p of h.contentAvailability)await ya(h,p,f,n);else await ya(h,h.contentAvailability,f,n);return await ya(h,h.childSubtreeAvailability,f,n),h}async function ya(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!r?.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let a=`${r?.baseUrl||""}/${o.uri}`,l=await(await r.fetch(a)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,i.byteOffset,i.byteLength);return}let c=e.buffers.slice(0,i.buffer).reduce((a,h)=>a+h.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(c,c+o.byteLength),i.byteOffset,i.byteLength)}function k3(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var Ea={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:Dc,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Q0,options:{}};var fE=U(Nr(),1);var cE=U(Nr(),1);var ce=null;try{ce=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 st(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}st.prototype.__isLong__;Object.defineProperty(st.prototype,"__isLong__",{value:!0});function Ut(e){return(e&&e.__isLong__)===!0}function H3(e){var t=Math.clz32(e&-e);return e?31-t:t}st.isLong=Ut;var Y3={},W3={};function lr(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=W3[e],r)?r:(n=X(e,0,!0),s&&(W3[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=Y3[e],r)?r:(n=X(e,e<0?-1:0,!1),s&&(Y3[e]=n),n))}st.fromInt=lr;function ae(e,t){if(isNaN(e))return t?Ze:Me;if(t){if(e<0)return Ze;if(e>=K3)return $3}else{if(e<=-j3)return Yt;if(e+1>=j3)return Z3}return e<0?ae(-e,t).neg():X(e%As|0,e/As|0,t)}st.fromNumber=ae;function X(e,t,n){return new st(e,t,n)}st.fromBits=X;var Ta=Math.pow;function $0(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Ze:Me;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return $0(e.substring(1),t,n).neg();for(var s=ae(Ta(n,8)),i=Me,o=0;o<e.length;o+=8){var c=Math.min(8,e.length-o),a=parseInt(e.substring(o,o+c),n);if(c<8){var h=ae(Ta(n,c));i=i.mul(h).add(ae(a))}else i=i.mul(s),i=i.add(ae(a))}return i.unsigned=t,i}st.fromString=$0;function Ae(e,t){return typeof e=="number"?ae(e,t):typeof e=="string"?$0(e,t):X(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}st.fromValue=Ae;var J3=1<<16,g8=1<<24,As=J3*J3,K3=As*As,j3=K3/2,X3=lr(g8),Me=lr(0);st.ZERO=Me;var Ze=lr(0,!0);st.UZERO=Ze;var Ms=lr(1);st.ONE=Ms;var Q3=lr(1,!0);st.UONE=Q3;var Z0=lr(-1);st.NEG_ONE=Z0;var Z3=X(-1,2147483647,!1);st.MAX_VALUE=Z3;var $3=X(-1,-1,!0);st.MAX_UNSIGNED_VALUE=$3;var Yt=X(0,-2147483648,!1);st.MIN_VALUE=Yt;var b=st.prototype;b.toInt=function(){return this.unsigned?this.low>>>0:this.low};b.toNumber=function(){return this.unsigned?(this.high>>>0)*As+(this.low>>>0):this.high*As+(this.low>>>0)};b.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(Yt)){var n=ae(t),r=this.div(n),s=r.mul(n).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=ae(Ta(t,6),this.unsigned),o=this,c="";;){var a=o.div(i),h=o.sub(a.mul(i)).toInt()>>>0,l=h.toString(t);if(o=a,o.isZero())return l+c;for(;l.length<6;)l="0"+l;c=""+l+c}};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(Yt)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+1};b.isZero=function(){return this.high===0&&this.low===0};b.eqz=b.isZero;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(t){return Ut(t)||(t=Ae(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};b.eq=b.equals;b.notEquals=function(t){return!this.eq(t)};b.neq=b.notEquals;b.ne=b.notEquals;b.lessThan=function(t){return this.comp(t)<0};b.lt=b.lessThan;b.lessThanOrEqual=function(t){return this.comp(t)<=0};b.lte=b.lessThanOrEqual;b.le=b.lessThanOrEqual;b.greaterThan=function(t){return this.comp(t)>0};b.gt=b.greaterThan;b.greaterThanOrEqual=function(t){return this.comp(t)>=0};b.gte=b.greaterThanOrEqual;b.ge=b.greaterThanOrEqual;b.compare=function(t){if(Ut(t)||(t=Ae(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?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};b.comp=b.compare;b.negate=function(){return!this.unsigned&&this.eq(Yt)?Yt:this.not().add(Ms)};b.neg=b.negate;b.add=function(t){Ut(t)||(t=Ae(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,c=t.high&65535,a=t.low>>>16,h=t.low&65535,l=0,f=0,p=0,u=0;return u+=i+h,p+=u>>>16,u&=65535,p+=s+a,f+=p>>>16,p&=65535,f+=r+c,l+=f>>>16,f&=65535,l+=n+o,l&=65535,X(p<<16|u,l<<16|f,this.unsigned)};b.subtract=function(t){return Ut(t)||(t=Ae(t)),this.add(t.neg())};b.sub=b.subtract;b.multiply=function(t){if(this.isZero())return this;if(Ut(t)||(t=Ae(t)),ce){var n=ce.mul(this.low,this.high,t.low,t.high);return X(n,ce.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ze:Me;if(this.eq(Yt))return t.isOdd()?Yt:Me;if(t.eq(Yt))return this.isOdd()?Yt:Me;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(X3)&&t.lt(X3))return ae(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,c=t.high>>>16,a=t.high&65535,h=t.low>>>16,l=t.low&65535,f=0,p=0,u=0,d=0;return d+=o*l,u+=d>>>16,d&=65535,u+=i*l,p+=u>>>16,u&=65535,u+=o*h,p+=u>>>16,u&=65535,p+=s*l,f+=p>>>16,p&=65535,p+=i*h,f+=p>>>16,p&=65535,p+=o*a,f+=p>>>16,p&=65535,f+=r*l+s*h+i*a+o*c,f&=65535,X(u<<16|d,f<<16|p,this.unsigned)};b.mul=b.multiply;b.divide=function(t){if(Ut(t)||(t=Ae(t)),t.isZero())throw Error("division by zero");if(ce){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?ce.div_u:ce.div_s)(this.low,this.high,t.low,t.high);return X(n,ce.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ze:Me;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ze;if(t.gt(this.shru(1)))return Q3;i=Ze}else{if(this.eq(Yt)){if(t.eq(Ms)||t.eq(Z0))return Yt;if(t.eq(Yt))return Ms;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(Me)?t.isNegative()?Ms:Z0:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(Yt))return this.unsigned?Ze:Me;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();i=Me}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(r)/Math.LN2),a=c<=48?1:Ta(2,c-48),h=ae(r),l=h.mul(t);l.isNegative()||l.gt(s);)r-=a,h=ae(r,this.unsigned),l=h.mul(t);h.isZero()&&(h=Ms),i=i.add(h),s=s.sub(l)}return i};b.div=b.divide;b.modulo=function(t){if(Ut(t)||(t=Ae(t)),ce){var n=(this.unsigned?ce.rem_u:ce.rem_s)(this.low,this.high,t.low,t.high);return X(n,ce.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};b.mod=b.modulo;b.rem=b.modulo;b.not=function(){return X(~this.low,~this.high,this.unsigned)};b.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};b.clz=b.countLeadingZeros;b.countTrailingZeros=function(){return this.low?H3(this.low):H3(this.high)+32};b.ctz=b.countTrailingZeros;b.and=function(t){return Ut(t)||(t=Ae(t)),X(this.low&t.low,this.high&t.high,this.unsigned)};b.or=function(t){return Ut(t)||(t=Ae(t)),X(this.low|t.low,this.high|t.high,this.unsigned)};b.xor=function(t){return Ut(t)||(t=Ae(t)),X(this.low^t.low,this.high^t.high,this.unsigned)};b.shiftLeft=function(t){return Ut(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?X(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):X(0,this.low<<t-32,this.unsigned)};b.shl=b.shiftLeft;b.shiftRight=function(t){return Ut(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?X(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):X(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};b.shr=b.shiftRight;b.shiftRightUnsigned=function(t){return Ut(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?X(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?X(this.high,0,this.unsigned):X(this.high>>>t-32,0,this.unsigned)};b.shru=b.shiftRightUnsigned;b.shr_u=b.shiftRightUnsigned;b.rotateLeft=function(t){var n;return Ut(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?X(this.high,this.low,this.unsigned):t<32?(n=32-t,X(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,X(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};b.rotl=b.rotateLeft;b.rotateRight=function(t){var n;return Ut(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?X(this.high,this.low,this.unsigned):t<32?(n=32-t,X(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,X(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};b.rotr=b.rotateRight;b.toSigned=function(){return this.unsigned?X(this.low,this.high,!1):this};b.toUnsigned=function(){return this.unsigned?this:X(this.low,this.high,!0)};b.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};b.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};b.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};st.fromBytes=function(t,n,r){return r?st.fromBytesLE(t,n):st.fromBytesBE(t,n)};st.fromBytesLE=function(t,n){return new st(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};st.fromBytesBE=function(t,n){return new st(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var ys=st;var x8=16;function Oi(e){e==="X"&&(e="");let t=e.padEnd(x8,"0");return ys.fromString(t,!0,16)}function t1(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),n=t%4;t=(t-n)/4;let r=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-r-i.length).join("0")+i}function e1(e,t){let n=M8(e).shiftRightUnsigned(2);return e.add(ys.fromNumber(2*t+1-4).multiply(n))}function M8(e){return e.and(e.not().add(1))}var A8=3,y8=30,E8=2*y8+1,tE=180/Math.PI;function nE(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let c=s-1;c>=0;c--){i=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,i-1);T8(f,o,h,l),o[0]+=f*h,o[1]+=f*l}if(n%2===1){let c=o[0];o[0]=o[1],o[1]=c}return{face:n,ij:o,level:i}}function rE(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<A8+E8;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=ys.fromString(r,!0,2).toString(10),c="";if(i!==0)for(c=ys.fromString(s,!0,2).toString(4);c.length<i;)c="0"+c;return`${o}/${c}`}function n1(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function eE(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function r1(e){return[eE(e[0]),eE(e[1])]}function s1(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function i1([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*tE,r*tE]}function T8(e,t,n,r){if(r===0){n===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 sE(e){let t=n1(e.ij,e.level,[.5,.5]),n=r1(t),r=s1(e.face,n);return i1(r)}var _8=100;function o1(e){let{face:t,ij:n,level:r}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(_8*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),c=0,a=0;for(let h=0;h<4;h++){let l=s[h].slice(0),f=s[h+1],p=(f[0]-l[0])/i,u=(f[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=p,l[1]+=u;let g=n1(n,r,l),m=r1(g),M=s1(t,m),E=i1(M);Math.abs(E[1])>89.999&&(E[0]=a);let A=E[0]-a;E[0]+=A>180?-360:A<-180?360:0,o[c++]=E[0],o[c++]=E[1],a=E[0]}}return o[c++]=o[0],o[c++]=o[1],o}function Es(e){let t=S8(e);return nE(t)}function S8(e){if(e.indexOf("/")>0)return e;let t=Oi(e);return rE(t)}function c1(e){let t=Es(e);return sE(t)}function oE(e){let t;if(e.face===2||e.face===5){let n=null,r=0;for(let s=0;s<4;s++){let i=`${e.face}/${s}`,o=Es(i),c=o1(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*c.length)),n.set(c,r),r+=c.length}t=iE(n)}else{let n=o1(e);t=iE(n)}return t}function iE(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],n=[];for(let r=0;r<e.length;r+=2)t.push(e[r]),n.push(e[r+1]);return t.sort((r,s)=>r-s),n.sort((r,s)=>r-s),{west:t[0],east:t[t.length-1],north:n[n.length-1],south:n[0]}}function a1(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=Es(e),i=oE(s),o=i.west,c=i.south,a=i.east,h=i.north,l=[];return l.push(new Z(o,h,n)),l.push(new Z(a,h,n)),l.push(new Z(a,c,n)),l.push(new Z(o,c,n)),l.push(new Z(o,h,r)),l.push(new Z(a,h,r)),l.push(new Z(a,c,r)),l.push(new Z(o,c,r)),l}function _a(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=a1(t,n),s=c1(t),i=s[0],o=s[1],c=G.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),a=new Z(c[0],c[1],c[2]);r.push(a);let h=Nf(r);return[...h.center,...h.halfAxes]}var B8=4,C8=8,L8={QUADTREE:B8,OCTREE:C8};function w8(e,t,n){if(e?.box){let r=Oi(e.s2VolumeInfo.token),s=e1(r,t),i=t1(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let h=e.s2VolumeInfo,l=h.maximumHeight-h.minimumHeight,f=l/2,p=h.minimumHeight+l/2;h.minimumHeight=p-f,h.maximumHeight=p+f;break;default:break}return{box:_a(o),s2VolumeInfo:o}}}async function l1(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:c=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:h,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:p,subtreesUriTemplate:u,basePath:d}=t,g={children:[],lodMetricValue:0,contentUrl:""};if(!f)return Yh.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${p} won't be loaded...`),g;let m=c+a.level;if(m>f)return g;let M=L8[h],E=Math.log2(M),A=r&1,y=r>>1&1,T=r>>2&1,_=(M**c-1)/(M-1),L=fr(n.mortonIndex,r,E),B=_+L,S=fr(n.x,A,1),x=fr(n.y,y,1),w=fr(n.z,T,1),R=!1;c>=l&&(R=h1(o.childSubtreeAvailability,L));let I=fr(a.x,S,c),C=fr(a.y,x,c),P=fr(a.z,w,c);if(R){let tt=`${d}/${u}`,it=Sa(tt,m,I,C,P);o=await(0,cE.load)(it,Ea,i),a={mortonIndex:L,x:S,y:x,z:w,level:c},L=0,B=0,S=0,x=0,w=0,c=0}if(!h1(o.tileAvailability,B))return g;h1(o.contentAvailability,B)&&(g.contentUrl=Sa(p,m,I,C,P));let $=c+1,H={mortonIndex:L,x:S,y:x,z:w};for(let tt=0;tt<M;tt++){let it=w8(s,tt,h),qt=await l1({subtree:o,implicitOptions:t,loaderOptions:i,parentData:H,childIndex:tt,level:$,globalData:{...a},s2VolumeBox:it});if(qt.contentUrl||qt.children.length){let pT=m+1,uT=R8(qt,pT,{childTileX:S,childTileY:x,childTileZ:w},t,s);g.children.push(uT)}}return g}function h1(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&Yh.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?O8(t,n.explicitBitstream):!1}function R8(e,t,n,r,s){let{basePath:i,refine:o,getRefine:c,lodMetricType:a,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:f}=r,p=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),u=l/2**t,d=s?.box?{box:s.box}:f,g=I8(t,d,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:p},id:e.contentUrl,refine:c(o),type:h(e),lodMetricType:a,lodMetricValue:u,geometricError:u,transform:e.transform,boundingVolume:g}}function I8(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,c,a,h,l,f]=t.region,p=2**e,u=(a-o)/p,d=(h-c)/p,g=(f-l)/p,[m,M]=[o+u*r,o+u*(r+1)],[E,A]=[c+d*s,c+d*(s+1)],[y,T]=[l+g*i,l+g*(i+1)];return{region:[m,E,M,A,y,T]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function fr(e,t,n){return(e<<n)+t}function Sa(e,t,n,r,s){let i=b8({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function b8(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function O8(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function p1(e,t=""){if(!t)return ie.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return ie.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ie.SCENEGRAPH;default:return r||ie.EMPTY}}function u1(e){switch(e){case"REPLACE":case"replace":return Pt.REPLACE;case"ADD":case"add":return Pt.ADD;default:return e}}function f1(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let r=new URL(e,`${t}/`);return decodeURI(r.toString())}else if(e.startsWith("/"))return e;return fn.resolve(t,e)}function aE(e,t){if(!e)return null;let n;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(n=f1(s,t))}return{...e,id:n,contentUrl:n,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:p1(e,n),refine:u1(e.refine)}}async function pE(e,t,n){let r=null,s=lE(e.root);s&&e.root?r=await hE(e.root,e,t,s,n):r=aE(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},c=o.children||[],a=[];for(let h of c){let l=lE(h),f;l?f=await hE(h,e,t,l,n):f=aE(h,t),f&&(a.push(f),i.push(f))}o.children=a}return r}async function hE(e,t,n,r,s){let{subdivisionScheme:i,maximumLevel:o,availableLevels:c,subtreeLevels:a,subtrees:{uri:h}}=r,l=Sa(h,0,0,0,0),f=f1(l,n),p=await(0,fE.load)(f,Ea,s),u=e.content?.uri,d=u?f1(u,n):"",g=t?.root?.refine,m=e.geometricError,M=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(M){let T={box:_a(M),s2VolumeInfo:M};e.boundingVolume=T}let E=e.boundingVolume,A={contentUrlTemplate:d,subtreesUriTemplate:h,subdivisionScheme:i,subtreeLevels:a,maximumLevel:Number.isFinite(c)?c-1:o,refine:g,basePath:n,lodMetricType:je.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:E,getTileType:p1,getRefine:u1};return await P8(e,n,p,A,s)}async function P8(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await l1({subtree:n,implicitOptions:r,loaderOptions:s}),c,a=null;return o&&(c=o,a={uri:o.replace(`${t}/`,"")}),{...e,id:c,contentUrl:c,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:p1(e,c),refine:u1(e.refine),content:a||e.content,children:i}}function lE(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var Ba={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:Dc,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:N8,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function N8(e,t={},n){let r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?v8(e,t,n):F8(e,t,n)}async function v8(e,t,n){let r=JSON.parse(new TextDecoder().decode(e)),s=n?.url||"",i=D8(s),o=await pE(r,i,t||{});return{...r,shape:"tileset3d",loader:Ba,url:s,queryString:n?.queryString||"",basePath:i,root:o||r.root,type:Ct.TILES3D,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:r.root?.geometricError||0}}async function F8(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await K0(e,0,t,n,r.content),r.content}function D8(e){return fn.dirname(e)}var uE=[0],U8={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Ba,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,n)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},Pi=class extends Nn.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Nn.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:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let h=await s.preload(t,n);h.url&&(o=h.url),h.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:h.headers}),Object.assign(i,h)}let c=await(0,xE.load)(o,s,i.loadOptions),a=new Ti(c,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:a,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(a)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case ie.POINTCLOUD:return this._makePointCloudLayer(t,n);case ie.SCENEGRAPH:return this._make3DModelLayer(t);case ie.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:c}=t.content,{positions:a,normals:h,colors:l}=r;if(!a)return null;let f=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:a,NORMAL:h,COLOR_0:l}},{pointSize:p,getPointColor:u}=this.props,d=this.getSubLayerClass("pointcloud",mE.PointCloudLayer);return new d({pointSize:p},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:f,coordinateSystem:Nn.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:c,getColor:i||u,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",gE.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||uE,scenegraph:n,coordinateSystem:Nn.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:c=>c.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:c,coordinateSystem:a=Nn.COORDINATE_SYSTEM.METER_OFFSETS,material:h,featureIds:l}=r,{_getMeshColor:f}=this.props,p=n&&n.props.mesh||new dE.Geometry({topology:"triangle-list",attributes:G8(s),indices:i}),u=this.getSubLayerClass("mesh",vg);return new u(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:p,data:uE,getColor:f(t),pbrMaterial:h,modelMatrix:o,coordinateOrigin:c,coordinateSystem:a,featureIds:l,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}};Pi.defaultProps=U8;Pi.layerName="Tile3DLayer";var ME=Pi;function G8(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 Ia=U(le(),1),M1=U(qo(),1),BE=U(le(),1);var z8=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 d1(e){return e>>1^-(e&1)}function q8(e){let t=0,n={};for(let[r,s]of z8){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function V8(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,c=s*o,a=n,h=a+c,l=h+c,f=0,p=0,u=0;for(let d=0;d<s;d++)f+=d1(e.getUint16(a+o*d,!0)),p+=d1(e.getUint16(h+o*d,!0)),u+=d1(e.getUint16(l+o*d,!0)),i[d]=f,i[d+s]=p,i[d+s*2]=u;return n+=c*3,{vertexData:i,vertexDataEndPosition:n}}function Ni(e,t,n,r,s=!0){let i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let c=0;c<i.length;++c){let a=i[c];i[c]=o-a,a===0&&++o}return i}function k8(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=c*3,h=Ni(e.buffer,r,a,o);return r+=a*o,{triangleIndicesEndPosition:r,triangleIndices:h}}function H8(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=Ni(e.buffer,r,c,o,!1);r+=c*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let l=Ni(e.buffer,r,h,o,!1);r+=h*o;let f=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let p=Ni(e.buffer,r,f,o,!1);r+=f*o;let u=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let d=Ni(e.buffer,r,u,o,!1);return r+=u*o,{edgeIndicesEndPosition:r,westIndices:a,southIndices:l,eastIndices:p,northIndices:d}}function Y8(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function W8(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function J8(e,t){let n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(e.buffer,r,i);switch(s){case 1:{n.vertexNormals=Y8(o);break}case 2:{n.waterMask=W8(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var pr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},j8={maxDecodingStep:pr.extensions};function m1(e,t){let n=Object.assign({},j8,t),r=new DataView(e),{header:s,headerEndPosition:i}=q8(r);if(n.maxDecodingStep<pr.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:c}=V8(r,i);if(n.maxDecodingStep<pr.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:a,triangleIndicesEndPosition:h}=k8(r,o,c);if(n.maxDecodingStep<pr.edgeIndices)return{header:s,vertexData:o,triangleIndices:a};let{westIndices:l,southIndices:f,eastIndices:p,northIndices:u,edgeIndicesEndPosition:d}=H8(r,o,h);if(n.maxDecodingStep<pr.extensions)return{header:s,vertexData:o,triangleIndices:a,westIndices:l,northIndices:u,eastIndices:p,southIndices:f};let{extensions:g}=J8(r,d);return{header:s,vertexData:o,triangleIndices:a,westIndices:l,northIndices:u,eastIndices:p,southIndices:f,extensions:g}}function Ca(e,t,n,r){let s=r?K8(r,e.POSITION.value):X8(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),c=new t.constructor(s.length*6);for(let h=0;h<s.length;h++){let l=s[h];Q8({edge:l,edgeIndex:h,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:c})}e.POSITION.value=Vs(e.POSITION.value,i),e.TEXCOORD_0.value=Vs(e.TEXCOORD_0.value,o);let a=t instanceof Array?t.concat(c):Vs(t,c);return{attributes:e,triangles:a}}function X8(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,i)=>Math.min(...s)-Math.min(...i)||Math.max(...s)-Math.max(...i));let n=[],r=0;for(;r<t.length;)t[r][0]===t[r+1]?.[1]&&t[r][1]===t[r+1]?.[0]?r+=2:(n.push(t[r]),r++);return n}function K8(e,t){e.westIndices.sort((r,s)=>t[3*r+1]-t[3*s+1]),e.eastIndices.sort((r,s)=>t[3*s+1]-t[3*r+1]),e.southIndices.sort((r,s)=>t[3*s]-t[3*r]),e.northIndices.sort((r,s)=>t[3*r]-t[3*s]);let n=[];for(let r in e){let s=e[r];for(let i=0;i<s.length-1;i++)n.push([s[i],s[i+1]])}return n}function Q8({edge:e,edgeIndex:t,attributes:n,skirtHeight:r,newPosition:s,newTexcoord0:i,newTriangles:o}){let c=n.POSITION.value.length,a=t*2,h=t*2+1;s.set(n.POSITION.value.subarray(e[0]*3,e[0]*3+3),a*3),s[a*3+2]=s[a*3+2]-r,s.set(n.POSITION.value.subarray(e[1]*3,e[1]*3+3),h*3),s[h*3+2]=s[h*3+2]-r,i.set(n.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),a*2),i.set(n.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),h*2);let l=t*2*3;o[l]=e[0],o[l+1]=c/3+h,o[l+2]=e[1],o[l+3]=c/3+h,o[l+4]=e[0],o[l+5]=c/3+a}function g1(e,t={}){let{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:c,eastIndices:a,southIndices:h}=m1(e,pr.triangleIndices),l=i,f=Z8(s,r,n),p=nr(f);if(t?.skirtHeight){let{attributes:u,triangles:d}=Ca(f,l,t.skirtHeight,{westIndices:o,northIndices:c,eastIndices:a,southIndices:h});f=u,l=d}return{loaderData:{header:{}},header:{vertexCount:l.length,boundingBox:p},schema:void 0,topology:"triangle-list",mode:4,indices:{value:l,size:1},attributes:f}}function Z8(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,c,a]=n||[0,0,1,1],h=c-i,l=a-o,f=s-r,p=e.length/3,u=new Float32Array(p*3),d=new Float32Array(p*2);for(let g=0;g<p;g++){let m=e[g]/32767,M=e[g+p]/32767,E=e[g+p*2]/32767;u[3*g+0]=m*h+i,u[3*g+1]=M*l+o,u[3*g+2]=E*f+r,d[2*g+0]=m,d[2*g+1]=M}return{POSITION:{value:u,size:3},TEXCOORD_0:{value:d,size:2}}}var vi=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,c=0,a=0,h=0,l=0;for(s&1?c=a=h=n:i=o=l=n;(s>>=1)>1;){let p=i+c>>1,u=o+a>>1;s&1?(c=i,a=o,i=h,o=l):(i=c,o=a,c=h,a=l),h=p,l=u}let f=r*4;this.coords[f+0]=i,this.coords[f+1]=o,this.coords[f+2]=c,this.coords[f+3]=a}}createTile(t){return new x1(t,this)}},x1=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let c=t-1;c>=0;c--){let a=c*4,h=r[a+0],l=r[a+1],f=r[a+2],p=r[a+3],u=h+f>>1,d=l+p>>1,g=u+d-l,m=d+h-u,M=(i[l*s+h]+i[p*s+f])/2,E=d*s+u,A=Math.abs(M-i[E]);if(o[E]=Math.max(o[E],A),c<n){let y=(l+m>>1)*s+(h+g>>1),T=(p+m>>1)*s+(f+g>>1);o[E]=Math.max(o[E],o[y],o[T])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,c=n-1;r.fill(0);function a(u,d,g,m,M,E){let A=u+g>>1,y=d+m>>1;Math.abs(u-M)+Math.abs(d-E)>1&&s[y*n+A]>t?(a(M,E,u,d,A,y),a(g,m,M,E,A,y)):(r[d*n+u]=r[d*n+u]||++i,r[m*n+g]=r[m*n+g]||++i,r[E*n+M]=r[E*n+M]||++i,o++)}a(0,0,c,c,c,0),a(c,c,0,0,0,c);let h=new Uint16Array(i*2),l=new Uint32Array(o*3),f=0;function p(u,d,g,m,M,E){let A=u+g>>1,y=d+m>>1;if(Math.abs(u-M)+Math.abs(d-E)>1&&s[y*n+A]>t)p(M,E,u,d,A,y),p(g,m,M,E,A,y);else{let T=r[d*n+u]-1,_=r[m*n+g]-1,L=r[E*n+M]-1;h[2*T]=u,h[2*T+1]=d,h[2*_]=g,h[2*_+1]=m,h[2*L]=M,h[2*L+1]=E,l[f++]=T,l[f++]=_,l[f++]=L}}return p(0,0,c,c,c,0),p(c,c,0,0,0,c),{vertices:h,triangles:l}}};var Fi=class{constructor(t,n,r=n){this.data=t,this.width=n,this.height=r,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=n-1,i=r-1,o=this._addPoint(0,0),c=this._addPoint(s,0),a=this._addPoint(0,i),h=this._addPoint(s,i),l=this._addTriangle(h,o,a,-1,-1,-1);this._addTriangle(o,h,c,l,-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,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,c){let a=Math.min(t,r,i),h=Math.min(n,s,o),l=Math.max(t,r,i),f=Math.max(n,s,o),p=ur(r,s,i,o,a,h),u=ur(i,o,t,n,a,h),d=ur(t,n,r,s,a,h),g=s-n,m=t-r,M=o-s,E=r-i,A=n-o,y=i-t,T=ur(t,n,r,s,i,o),_=this.heightAt(t,n)/T,L=this.heightAt(r,s)/T,B=this.heightAt(i,o)/T,S=0,x=0,w=0,R=0;for(let I=h;I<=f;I++){let C=0;p<0&&M!==0&&(C=Math.max(C,Math.floor(-p/M))),u<0&&A!==0&&(C=Math.max(C,Math.floor(-u/A))),d<0&&g!==0&&(C=Math.max(C,Math.floor(-d/g)));let P=p+M*C,k=u+A*C,z=d+g*C,$=!1;for(let H=a+C;H<=l;H++){if(P>=0&&k>=0&&z>=0){$=!0;let tt=_*P+L*k+B*z,it=Math.abs(tt-this.heightAt(H,I));R+=it*it,it>S&&(S=it,x=H,w=I)}else if($)break;P+=M,k+=A,z+=g}p+=E,u+=y,d+=m}(x===t&&w===n||x===r&&w===s||x===i&&w===o)&&(S=0),this._candidates[2*c]=x,this._candidates[2*c+1]=w,this._rms[c]=R,this._queuePush(c,S,R)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],c=this.triangles[s],a=this.coords[2*i],h=this.coords[2*i+1],l=this.coords[2*o],f=this.coords[2*o+1],p=this.coords[2*c],u=this.coords[2*c+1],d=this._candidates[2*t],g=this._candidates[2*t+1],m=this._addPoint(d,g);if(ur(a,h,l,f,d,g)===0)this._handleCollinear(m,n);else if(ur(l,f,p,u,d,g)===0)this._handleCollinear(m,r);else if(ur(p,u,a,h,d,g)===0)this._handleCollinear(m,s);else{let M=this._halfedges[n],E=this._halfedges[r],A=this._halfedges[s],y=this._addTriangle(i,o,m,M,-1,-1,n),T=this._addTriangle(o,c,m,E,-1,y+1),_=this._addTriangle(c,i,m,A,y+2,T+1);this._legalize(y),this._legalize(T),this._legalize(_)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o,c=this.triangles.length){let a=c/3;return this.triangles[c+0]=t,this.triangles[c+1]=n,this.triangles[c+2]=r,this._halfedges[c+0]=s,this._halfedges[c+1]=i,this._halfedges[c+2]=o,s>=0&&(this._halfedges[s]=c+0),i>=0&&(this._halfedges[i]=c+1),o>=0&&(this._halfedges[o]=c+2),this._candidates[2*a+0]=0,this._candidates[2*a+1]=0,this._queueIndices[a]=-1,this._rms[a]=0,this._pending[this._pendingLen++]=a,c}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,c=s+(n+2)%3,a=s+(n+1)%3,h=this.triangles[o],l=this.triangles[t],f=this.triangles[i],p=this.triangles[c],u=this.coords;if(!$8(u[2*h],u[2*h+1],u[2*l],u[2*l+1],u[2*f],u[2*f+1],u[2*p],u[2*p+1]))return;let d=this._halfedges[i],g=this._halfedges[o],m=this._halfedges[c],M=this._halfedges[a];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(h,p,f,-1,m,d,r),A=this._addTriangle(p,h,l,E,g,M,s);this._legalize(E+1),this._legalize(A+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],c=this.triangles[n],a=this.triangles[s],h=this._halfedges[s],l=this._halfedges[i],f=this._halfedges[n];if(f<0){let _=this._addTriangle(t,o,c,-1,l,-1,r),L=this._addTriangle(o,t,a,_,-1,h);this._legalize(_+1),this._legalize(L+2);return}let p=f-f%3,u=p+(f+2)%3,d=p+(f+1)%3,g=this.triangles[u],m=this._halfedges[u],M=this._halfedges[d];this._queueRemove(p/3);let E=this._addTriangle(o,c,t,l,-1,-1,r),A=this._addTriangle(c,g,t,M,-1,E+1,p),y=this._addTriangle(g,a,t,m,-1,A+1),T=this._addTriangle(a,o,t,h,E+2,y+1);this._legalize(E),this._legalize(A),this._legalize(y),this._legalize(T)}_queuePush(t,n,r){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(n),this._rmsSum+=r,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 n=this._queueIndices[t];if(n<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 r=this._queue.length-1;r!==n&&(this._queueSwap(n,r),this._queueDown(n,r)||this._queueUp(n)),this._queuePopBack()}_queueLess(t,n){return this._errors[t]>this._errors[n]}_queueSwap(t,n){let r=this._queue[t],s=this._queue[n];this._queue[t]=s,this._queue[n]=r,this._queueIndices[r]=n,this._queueIndices[s]=t;let i=this._errors[t];this._errors[t]=this._errors[n],this._errors[n]=i}_queueUp(t){let n=t;for(;;){let r=n-1>>1;if(r===n||!this._queueLess(n,r))break;this._queueSwap(r,n),n=r}}_queueDown(t,n){let r=t;for(;;){let s=2*r+1;if(s>=n||s<0)break;let i=s+1,o=s;if(i<n&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>t}};function ur(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function $8(e,t,n,r,s,i,o,c){let a=e-o,h=t-c,l=n-o,f=r-c,p=s-o,u=i-c,d=a*a+h*h,g=l*l+f*f,m=p*p+u*u;return a*(f*m-g*u)-h*(l*m-g*p)+d*(l*u-f*p)<0}function EE(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:c}=e,a,h;switch(t.tesselator){case"martini":a=La(i,o,c,s,t.tesselator),h=AE(n,o,a);break;case"delatin":a=La(i,o,c,s,t.tesselator),h=yE(n,o,c,a);break;default:o===c&&!(c&o-1)?(a=La(i,o,c,s,"martini"),h=AE(n,o,a)):(a=La(i,o,c,s,"delatin"),h=yE(n,o,c,a));break}let{vertices:l}=h,{triangles:f}=h,p=tD(l,a,o,c,r),u=nr(p);if(t.skirtHeight){let{attributes:d,triangles:g}=Ca(p,f,t.skirtHeight);p=d,f=g}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:u},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:p}}function AE(e,t,n){let r=t+1,i=new vi(r).createTile(n),{vertices:o,triangles:c}=i.getMesh(e);return{vertices:o,triangles:c}}function yE(e,t,n,r){let s=new Fi(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function La(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:c,offset:a}=r,h=new Float32Array((t+1)*(n+1));for(let l=0,f=0;f<n;f++)for(let p=0;p<t;p++,l++){let u=l*4,d=e[u+0],g=e[u+1],m=e[u+2];h[l+f]=d*i+g*c+m*o+a}if(s==="martini"){for(let l=(t+1)*t,f=0;f<t;f++,l++)h[l]=h[l-t-1];for(let l=n,f=0;f<n+1;f++,l+=n+1)h[l]=h[l-1]}return h}function tD(e,t,n,r,s){let i=n+1,o=e.length/2,c=new Float32Array(o*3),a=new Float32Array(o*2),[h,l,f,p]=s||[0,0,n,r],u=(f-h)/n,d=(p-l)/r;for(let g=0;g<o;g++){let m=e[g*2],M=e[g*2+1],E=M*i+m;c[3*g+0]=m*u+h,c[3*g+1]=-M*d+p,c[3*g+2]=t[E],a[2*g+0]=m/n,a[2*g+1]=M/r}return{POSITION:{value:c,size:3},TEXCOORD_0:{value:a,size:2}}}var wa="4.2.1";var Ra={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:wa,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 TE={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:wa,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var eD={...Ra,parse:nD};async function nD(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Xt(e,[],r,n),i={...eD.options.terrain,...t?.terrain};return EE(s,i)}var $it={...TE,parseSync:(e,t)=>g1(e,t?.["quantized-mesh"]),parse:async(e,t)=>g1(e,t?.["quantized-mesh"])};var _E=[1],rD={...Kn.defaultProps,elevationData:xn,texture:{...xn,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:[Ra]};function SE(e){return Array.isArray(e)?e.join(";"):e||""}var Di=class extends Ia.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&Ia.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:c}=this.props;return c(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:c}=this.context,a=Re(n,t),h=s&&Re(s,t),{signal:l}=t,f=[0,0],p=[0,0];if(c.isGeospatial){let m=t.bbox;f=c.projectFlat([m.west,m.south]),p=c.projectFlat([m.east,m.north])}else{let m=t.bbox;f=[m.left,m.bottom],p=[m.right,m.top]}let u=[f[0],f[1],p[0],p[1]],d=this.loadTerrain({elevationData:a,bounds:u,elevationDecoder:i,meshMaxError:o,signal:l}),g=h?r(h,{propName:"texture",layer:this,loaders:[],signal:l}).catch(m=>null):Promise.resolve(null);return Promise.all([d,g])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",M1.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[c,a]=o;return new n(t,{data:_E,mesh:c,texture:a,_instanced:!1,coordinateSystem:BE.COORDINATE_SYSTEM.CARTESIAN,getPosition:h=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(a=>a[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:c,tileSize:a,maxZoom:h,minZoom:l,extent:f,maxRequests:p,onTileLoad:u,onTileUnload:d,onTileError:g,maxCacheSize:m,maxCacheByteSize:M,refinementStrategy:E}=this.props;if(this.state.isTiled)return new Kn(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:SE(r),texture:SE(s),meshMaxError:o,elevationDecoder:c}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:a,maxZoom:h,minZoom:l,extent:f,maxRequests:p,onTileLoad:u,onTileUnload:d,onTileError:g,maxCacheSize:m,maxCacheByteSize:M,refinementStrategy:E});if(!r)return null;let A=this.getSubLayerClass("mesh",M1.SimpleMeshLayer);return new A(this.getSubLayerProps({id:"mesh"}),{data:_E,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:y=>[0,0,0],getColor:t,material:n,wireframe:i})}};Di.defaultProps=rD;Di.layerName="TerrainLayer";var CE=Di;var Wa=U(le(),1),D1=U(he(),1),oT=U(wE(),1);var Ui={x:0,y:1,z:2};function dr(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,c=Ui[s[0]],a=Ui[s[1]];for(let h=n,l=r-i;h<r;h+=i)o+=(e[h+c]-e[l+c])*(e[h+a]+e[l+a]),l=h;return o/2}function y1(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,c=IE(e,0,o,n,!0,r&&r[0],s),a=[];if(!c||c.next===c.prev)return a;let h,l,f,p,u,d,g;if(i&&(c=lD(e,t,c,n,r,s)),e.length>80*n){p=l=e[0],u=f=e[1];for(let m=n;m<o;m+=n)d=e[m],g=e[m+1],d<p&&(p=d),g<u&&(u=g),d>l&&(l=d),g>f&&(f=g);h=Math.max(l-p,f-u),h=h!==0?32767/h:0}return Gi(c,a,n,p,u,h,0),a}function IE(e,t,n,r,s,i,o){let c,a;i===void 0&&(i=dr(e,{start:t,end:n,size:r,plane:o}));let h=Ui[o[0]],l=Ui[o[1]];if(s===i<0)for(c=t;c<n;c+=r)a=RE(c,e[c+h],e[c+l],a);else for(c=n-r;c>=t;c-=r)a=RE(c,e[c+h],e[c+l],a);return a&&Pa(a,a.next)&&(qi(a),a=a.next),a}function mr(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Pa(n,n.next)||ft(n.prev,n,n.next)===0)){if(qi(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Gi(e,t,n,r,s,i,o){if(!e)return;!o&&i&&mD(e,r,s,i);let c=e,a,h;for(;e.prev!==e.next;){if(a=e.prev,h=e.next,i?cD(e,r,s,i):oD(e)){t.push(a.i/n|0),t.push(e.i/n|0),t.push(h.i/n|0),qi(e),e=h.next,c=h.next;continue}if(e=h,e===c){o?o===1?(e=aD(mr(e),t,n),Gi(e,t,n,r,s,i,2)):o===2&&hD(e,t,n,r,s,i):Gi(mr(e),t,n,r,s,i,1);break}}}function oD(e){let t=e.prev,n=e,r=e.next;if(ft(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,c=t.y,a=n.y,h=r.y,l=s<i?s<o?s:o:i<o?i:o,f=c<a?c<h?c:h:a<h?a:h,p=s>i?s>o?s:o:i>o?i:o,u=c>a?c>h?c:h:a>h?a:h,d=r.next;for(;d!==t;){if(d.x>=l&&d.x<=p&&d.y>=f&&d.y<=u&&Ts(s,c,i,a,o,h,d.x,d.y)&&ft(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function cD(e,t,n,r){let s=e.prev,i=e,o=e.next;if(ft(s,i,o)>=0)return!1;let c=s.x,a=i.x,h=o.x,l=s.y,f=i.y,p=o.y,u=c<a?c<h?c:h:a<h?a:h,d=l<f?l<p?l:p:f<p?f:p,g=c>a?c>h?c:h:a>h?a:h,m=l>f?l>p?l:p:f>p?f:p,M=A1(u,d,t,n,r),E=A1(g,m,t,n,r),A=e.prevZ,y=e.nextZ;for(;A&&A.z>=M&&y&&y.z<=E;){if(A.x>=u&&A.x<=g&&A.y>=d&&A.y<=m&&A!==s&&A!==o&&Ts(c,l,a,f,h,p,A.x,A.y)&&ft(A.prev,A,A.next)>=0||(A=A.prevZ,y.x>=u&&y.x<=g&&y.y>=d&&y.y<=m&&y!==s&&y!==o&&Ts(c,l,a,f,h,p,y.x,y.y)&&ft(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;A&&A.z>=M;){if(A.x>=u&&A.x<=g&&A.y>=d&&A.y<=m&&A!==s&&A!==o&&Ts(c,l,a,f,h,p,A.x,A.y)&&ft(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;y&&y.z<=E;){if(y.x>=u&&y.x<=g&&y.y>=d&&y.y<=m&&y!==s&&y!==o&&Ts(c,l,a,f,h,p,y.x,y.y)&&ft(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function aD(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!Pa(s,i)&&bE(s,r,r.next,i)&&zi(s,i)&&zi(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),qi(r),qi(r.next),r=e=i),r=r.next}while(r!==e);return mr(r)}function hD(e,t,n,r,s,i){let o=e;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&MD(o,c)){let a=OE(o,c);o=mr(o,o.next),a=mr(a,a.next),Gi(o,t,n,r,s,i,0),Gi(a,t,n,r,s,i,0);return}c=c.next}o=o.next}while(o!==e)}function lD(e,t,n,r,s,i){let o=[],c,a,h,l,f;for(c=0,a=t.length;c<a;c++)h=t[c]*r,l=c<a-1?t[c+1]*r:e.length,f=IE(e,h,l,r,!1,s&&s[c+1],i),f===f.next&&(f.steiner=!0),o.push(xD(f));for(o.sort(fD),c=0;c<o.length;c++)n=pD(o[c],n);return n}function fD(e,t){return e.x-t.x}function pD(e,t){let n=uD(e,t);if(!n)return t;let r=OE(n,e);return mr(r,r.next),mr(n,n.next)}function uD(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let p=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=r&&p>i&&(i=p,o=n.x<n.next.x?n:n.next,p===r))return o}n=n.next}while(n!==t);if(!o)return null;let c=o,a=o.x,h=o.y,l=1/0,f;n=o;do r>=n.x&&n.x>=a&&r!==n.x&&Ts(s<h?r:i,s,a,h,s<h?i:r,s,n.x,n.y)&&(f=Math.abs(s-n.y)/(r-n.x),zi(n,e)&&(f<l||f===l&&(n.x>o.x||n.x===o.x&&dD(o,n)))&&(o=n,l=f)),n=n.next;while(n!==c);return o}function dD(e,t){return ft(e.prev,e,t.prev)<0&&ft(t.next,e,e.next)<0}function mD(e,t,n,r){let s=e;do s.z===0&&(s.z=A1(s.x,s.y,t,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,gD(s)}function gD(e){let t,n,r=1,s,i,o,c,a,h;do{for(i=e,e=null,h=null,s=0;i;){for(s++,c=i,o=0,n=0;n<r&&(o++,c=c.nextZ,!!c);n++);for(a=r;o>0||a>0&&c;)o!==0&&(a===0||!c||i.z<=c.z)?(t=i,i=i.nextZ,o--):(t=c,c=c.nextZ,a--),h?h.nextZ=t:e=t,t.prevZ=h,h=t;i=c}h.nextZ=null,r*=2}while(s>1);return e}function A1(e,t,n,r,s){return e=(e-n)*s|0,t=(t-r)*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 xD(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Ts(e,t,n,r,s,i,o,c){return(s-o)*(t-c)>=(e-o)*(i-c)&&(e-o)*(r-c)>=(n-o)*(t-c)&&(n-o)*(i-c)>=(s-o)*(r-c)}function MD(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!AD(e,t)&&(zi(e,t)&&zi(t,e)&&yD(e,t)&&(ft(e.prev,e,t.prev)||ft(e,t.prev,t))||Pa(e,t)&&ft(e.prev,e,e.next)>0&&ft(t.prev,t,t.next)>0)}function ft(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Pa(e,t){return e.x===t.x&&e.y===t.y}function bE(e,t,n,r){let s=Oa(ft(e,t,n)),i=Oa(ft(e,t,r)),o=Oa(ft(n,r,e)),c=Oa(ft(n,r,t));return!!(s!==i&&o!==c||s===0&&ba(e,n,t)||i===0&&ba(e,r,t)||o===0&&ba(n,e,r)||c===0&&ba(n,t,r))}function ba(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Oa(e){return e>0?1:e<0?-1:0}function AD(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&bE(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function zi(e,t){return ft(e.prev,e,e.next)<0?ft(e,t,e.next)>=0&&ft(e,e.prev,t)>=0:ft(e,t,e.prev)<0||ft(e,e.next,t)<0}function yD(e,t){let n=e,r=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function OE(e,t){let n=new Vi(e.i,e.x,e.y),r=new Vi(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function RE(e,t,n,r){let s=new Vi(e,t,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function qi(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 Vi=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function _1(e,t,n){let r=BD(e),s=Object.keys(r).filter(i=>r[i]!==Array);return CD(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function BD(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=OD(s,t[r])}return t}function CD(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:c,polygonPositionsCount:a,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:f,propArrayTypes:p,coordLength:u}=t,{numericPropKeys:d=[],PositionDataType:g=Float32Array,triangulate:m=!0}=n,M=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,A={type:"Point",positions:new g(r*u),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},y={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new g(i*u),globalFeatureIds:new E(i),featureIds:c>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},T={type:"Polygon",polygonIndices:a>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:a>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new g(a*u),globalFeatureIds:new E(a),featureIds:f>65535?new Uint32Array(a):new Uint16Array(a),numericProps:{},properties:[],fields:[]};m&&(T.triangles=[]);for(let L of[A,y,T])for(let B of d){let S=p[B];L.numericProps[B]=new S(L.positions.length/u)}y.pathIndices[o]=i,T.polygonIndices[h]=a,T.primitivePolygonIndices[l]=a;let _={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,S=L.properties||{};switch(B.type){case"Point":LD(B,A,_,u,S),A.properties.push(T1(S,d)),M&&A.fields.push({id:L.id}),_.pointFeature++;break;case"LineString":wD(B,y,_,u,S),y.properties.push(T1(S,d)),M&&y.fields.push({id:L.id}),_.lineFeature++;break;case"Polygon":RD(B,T,_,u,S),T.properties.push(T1(S,d)),M&&T.fields.push({id:L.id}),_.polygonFeature++;break;default:throw new Error("Invalid geometry type")}_.feature++}return bD(A,y,T,u)}function LD(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;S1(t,s,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function wD(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;S1(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,c=e.indices.length;o<c;++o){let a=e.indices[o],h=o===c-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(h-a)/r}}function RD(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;S1(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,c=e.indices.length;o<c;++o){let a=n.polygonPosition;t.polygonIndices[n.polygonObject++]=a;let h=e.areas[o],l=e.indices[o],f=e.indices[o+1];for(let u=0,d=l.length;u<d;++u){let g=l[u],m=u===d-1?f===void 0?e.data.length:f[0]:l[u+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(m-g)/r}let p=n.polygonPosition;ID(t,h,l,{startPosition:a,endPosition:p,coordLength:r})}}function ID(e,t,n,{startPosition:r,endPosition:s,coordLength:i}){if(!e.triangles)return;let o=r*i,c=s*i,a=e.positions.subarray(o,c),h=n[0],l=n.slice(1).map(p=>(p-h)/i),f=y1(a,l,i,t);for(let p=0,u=f.length;p<u;++p)e.triangles.push(r+f[p])}function E1(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function bD(e,t,n,r){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:E1(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:E1(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:E1(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function S1(e,t,n,r){for(let s in e.numericProps)if(s in t){let i=t[s];e.numericProps[s].fill(i,n,n+r)}}function T1(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function OD(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Fa(e,t){let n=t?.globalFeatureId;return n!==void 0?PD(e,n):ND(e,t?.type)}function PD(e,t){let n=FE(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let c=r.featureIds.value[o];if(c!==i){if(t===r.globalFeatureIds.value[s])return Na(r,s,o);s=o,i=c}}if(t===r.globalFeatureIds.value[s])return Na(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function ND(e,t){let n=FE(e,t);return vD(n)}function vE(e,t,n){switch(e.type){case"Point":return GD(e,t,n);case"LineString":return UD(e,t,n);case"Polygon":return DE(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function FE(e,t){let n=[];return e.points&&(e.points.type="Point",n.push(e.points)),e.lines&&(e.lines.type="LineString",n.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",n.push(e.polygons)),n}function vD(e){let t=[];for(let n of e){if(n.featureIds.value.length===0)continue;let r=0,s=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let o=n.featureIds.value[i];o!==s&&(t.push(Na(n,r,i)),r=i,s=o)}t.push(Na(n,r,n.featureIds.value.length))}return t}function Na(e,t,n){let r=vE(e,t,n),s=DD(e,t,n),i=FD(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function FD(e,t=0,n){return e.fields&&e.fields[e.featureIds.value[t]]}function DD(e,t=0,n){let r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function DE(e,t=-1/0,n=1/0){let{positions:r}=e,s=e.polygonIndices.value.filter(a=>a>=t&&a<=n),i=e.primitivePolygonIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2)){let a=[];for(let h=0;h<i.length-1;h++){let l=i[h],f=i[h+1],p=va(r,l,f);a.push(p)}return{type:"Polygon",coordinates:a}}let c=[];for(let a=0;a<s.length-1;a++){let h=s[a],l=s[a+1],f=DE(e,h,l).coordinates;c.push(f)}return{type:"MultiPolygon",coordinates:c}}function UD(e,t=-1/0,n=1/0){let{positions:r}=e,s=e.pathIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2))return{type:"LineString",coordinates:va(r,s[0],s[1])};let o=[];for(let c=0;c<s.length-1;c++){let a=va(r,s[c],s[c+1]);o.push(a)}return{type:"MultiLineString",coordinates:o}}function GD(e,t,n){let{positions:r}=e,s=va(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function va(e,t,n){t=t||0,n=n||e.value.length/e.size;let r=[];for(let s=t;s<n;s++){let i=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)i.push(Number(e.value[o]));r.push(i)}return r}var b1=U(HE(),1);function YE(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=r6(e[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function r6(e){let t=0;for(let n=0,r=e.length-1,s,i;n<e.length;r=n++)s=e[n],i=e[r],t+=(i[0]-s[0])*(s[1]+i[1]);return t}function WE(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?s6(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function s6(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var Bs=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(WE,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,c=[],a;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(a&&c.push(a),a=[]),a&&a.push([i,o]);else if(r===7)a&&a.push(a[0].slice());else throw new Error(`unknown command ${r}`)}return a&&c.push(a),c}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,c=1/0,a=-1/0,h=1/0,l=-1/0;for(;t.pos<n;){if(s<=0){let f=t.readVarint();r=f&7,s=f>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<c&&(c=i),i>a&&(a=i),o<h&&(h=o),o>l&&(l=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[c,h,a,l]}_toGeoJSON(t){let n=this.loadGeometry(),r=Bs.types[this.type],s,i;switch(this.type){case 1:let c=[];for(s=0;s<n.length;s++)c[s]=n[s][0];n=c,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=YE(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,c=this.extent*r;function a(h){for(let l=0;l<h.length;l++){let f=h[l];f[0]=(f[0]+o)*360/i-180;let p=180-(f[1]+c)*360/i;f[1]=360/Math.PI*Math.atan(Math.exp(p*Math.PI/180))-90}}return this._toGeoJSON(a)}};var Ga=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(i6,this,n),this.length=this._features.length}feature(t){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 Bs(this._pbf,n,this.extent,this._keys,this._values)}};function i6(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(o6(n)))}function o6(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var za=class{layers;constructor(t,n){this.layers=t.readFields(c6,{},n)}};function c6(e,t,n){if(e===3&&n){let r=new Ga(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function JE(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[dr(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],c,a=0;for(let h,l=0,f;l<t;l++){f=e.indices[l]-a,h=e.indices[l+1]-a||e.data.length;let p=e.data.slice(f,h),u=dr(p);if(u===0){let d=e.data.slice(0,f),g=e.data.slice(h);e.data=d.concat(g),a+=h-f;continue}c===void 0&&(c=u<0),c===u<0?(o.length&&(r.push(i),s.push(o)),o=[f],i=[u]):(i.push(u),o.push(f))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function jE(e,t,n,r){for(let s=0,i=e.length;s<i;s+=2){e[s]=(e[s]+t)*360/r-180;let o=180-(e[s+1]+n)*360/r;e[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function XE(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?a6(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function a6(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var KE,gr,L1,qa,w1,R1,ki;var Va=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,s,i,o){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(XE,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,KE=t.readVarint()+t.pos,gr=1,qa=0,w1=0,R1=0,ki=0;let n=[],r=[];for(;t.pos<KE;)if(qa<=0&&(L1=t.readVarint(),gr=L1&7,qa=L1>>3),qa--,gr===1||gr===2)w1+=t.readSVarint(),R1+=t.readSVarint(),gr===1&&n.push(ki),r.push(w1,R1),ki+=2;else if(gr===7){if(ki>0){let s=n[n.length-1];r.push(r[s],r[s+1]),ki+=2}}else throw new Error(`unknown command ${gr}`);return{data:r,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),r;t(n.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/s,r={type:"LineString",...n};break;case 3:r=JE(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,c=this.extent*r;return this._toBinaryCoordinates(a=>jE(a,o,c,i))}};var ka=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(h6,this,n),this.length=this._features.length}feature(t,n){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 Va(this._pbf,r,this.extent,this._keys,this._values,n)}};function h6(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(l6(n)))}function l6(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Ha=class{layers;constructor(t,n){this.layers=t.readFields(f6,{},n)}};function f6(e,t,n){if(e===3&&n){let r=new ka(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function O1(e,t){let n=u6(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:I1(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:QE(e,n)};case"geojson":return QE(e,n);case"binary-geometry":return I1(e,n);case"binary":return I1(e,n);default:throw new Error(r||"undefined shape")}}function I1(e,t){let[n,r]=p6(e,t),s=_1(n,r);return s.byteLength=e.byteLength,s}function p6(e,t){let n=[],r={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[n,r];let s=new Ha(new b1.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let c=s.layers[o];if(c)for(let a=0;a<c.length;a++){let h=c.feature(a,r),l=m6(h,t,o);n.push(l)}}),[n,r]}function QE(e,t){if(e.byteLength<=0)return[];let n=[],r=new za(new b1.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let c=0;c<o.length;c++){let a=o.feature(c),h=d6(a,t,i);n.push(h)}}),n}function u6(e){if(!e?.mvt)throw new Error("mvt options required");let t=e.mvt?.coordinates==="wgs84",{tileIndex:n}=e.mvt,r=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(t&&!r)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function d6(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:g6);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function m6(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:x6);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function g6(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let s=e[r];s[0]/=n,s[1]/=n}}function x6(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var M6="4.2.1",Ya={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:M6,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:null}}},A6={...Ya,parse:async(e,t)=>O1(e,t),parseSync:O1,binary:!0};var y6={Point:ZE,MultiPoint:E6,LineString:$E,MultiLineString:T6,Polygon:tT,MultiPolygon:_6};function ZE([e,t],[n,r],s){let i=rn(n[0],r[0],e),o=rn(n[1],r[1],t);return s.unprojectFlat([i,o])}function P1(e,t,n){return e.map(r=>ZE(r,t,n))}function E6(e,t,n){return P1(e,t,n)}function $E(e,t,n){return P1(e,t,n)}function T6(e,t,n){return e.map(r=>$E(r,t,n))}function tT(e,t,n){return e.map(r=>P1(r,t,n))}function _6(e,t,n){return e.map(r=>tT(r,t,n))}function eT(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:y6[e.type](e.coordinates,i,n)}}var S6=["points","lines","polygons"];function N1(e,t,n,r){for(let s of S6){let i=e[s]&&B6(e[s],t,n,r);if(i>=0)return i}return-1}function B6(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let a=C6(e,r);if(a)i=a[0],o=a[1]+1;else return-1}let c=-1;if(t in e.numericProps){let a=e.numericProps[t].value.findIndex((h,l)=>h===n&&s[l]>=i&&s[l]<o);return a>=0?e.globalFeatureIds.value[a]:-1}else t?c=nT(e.properties,a=>a[t]===n,i,o):e.fields&&(c=nT(e.fields,a=>a.id===n,i,o));return c>=0?L6(e,c):-1}function C6(e,t){if(!e.__layers){let n={},{properties:r}=e;for(let s=0;s<r.length;s++){let{layerName:i}=r[s];i&&(n[i]?n[i][1]=s:n[i]=[s,s])}e.__layers=n}return e.__layers[t]}function L6(e,t){if(!e.__ids){let n=[],r=e.featureIds.value,s=e.globalFeatureIds.value;for(let i=0;i<r.length;i++)n[r[i]]=s[i];e.__ids=n}return e.__ids[t]}function nT(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var v1=512,w6={...D1.GeoJsonLayer.defaultProps,data:xn,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Ya],binary:!0},Hi=class extends Kn{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:n,context:r,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:n,context:r,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:i}=t;i!==n.highlightColor&&Array.isArray(i)&&this.setState({highlightColor:i})}async _updateTileData(){let t=this.props.data,n=null;if(typeof t=="string"&&!_l(t)){let{onDataLoad:r,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{n=await s(t,{propName:"data",layer:this,loaders:[]})}catch(i){this.raiseError(i,"loading TileJSON"),t=null}r&&r(n,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(n=t);n&&(t=n.tiles),this.setState({data:t,tileJSON:n})}_getTilesetOptions(){let t=super._getTilesetOptions(),n=this.state.tileJSON,{minZoom:r,maxZoom:s}=this.props;return n&&(Number.isFinite(n.minzoom)&&n.minzoom>r&&(t.minZoom=n.minzoom),Number.isFinite(n.maxzoom)&&(!Number.isFinite(s)||n.maxzoom<s)&&(t.maxZoom=n.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:n,binary:r}=this.state,{index:s,signal:i}=t,o=Re(n,t);if(!o)return Promise.reject("Invalid URL");let c=this.getLoadOptions(),{fetch:a}=this.props;return c={...c,mimeType:"application/x-protobuf",mvt:{...c?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},a(o,{propName:"data",layer:this,loadOptions:c,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=v1/i,c=-o,a=v1*n/i,h=v1*(1-r/i),l=new jt().scale([o,c,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=l,t.coordinateOrigin=[a,h,0],t.coordinateSystem=Wa.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new oT.ClipExtension]);let f=super.renderSubLayers(t);return this.state.binary&&!(f instanceof D1.GeoJsonLayer)&&Wa.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),f}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,c=null;i&&(o=F1(i,n),c=rT(i));let{highlightColor:a}=this.props;typeof a=="function"&&(a=a(t)),(r!==o||s!==c)&&this.setState({highlightColor:a,hoveredFeatureId:o,hoveredFeatureLayerName:c})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let n=super.getPickingInfo(t);if(this.state.binary&&n.index!==-1){let{data:r}=t.sourceLayer.props;n.object=Fa(r,{globalFeatureId:n.index})}return n.object&&!this._isWGS84()&&(n.object=iT(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,c=t.content,a=sT(o);if(!(sT(n)||a))return-1;let l=a?o:n;return Array.isArray(c)?c.findIndex(f=>{let p=F1(f,i)===l,u=a||rT(f)===r;return p&&u}):c&&s?N1(c,i,l,a?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,c=r.y,a=[this.id];return n.pickObjects({x:o,y:c,width:s,height:i,layerIds:a,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=F1(i.object,this.props.uniqueIdProperty);o===void 0?s.push(i.object):r.has(o)||(r.add(o),s.push(i.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(r=>{r.hasOwnProperty(t)||Object.defineProperty(r,t,{get:()=>{if(!r.content)return null;if(this.state.binary&&Array.isArray(r.content)&&!r.content.length)return[];let{bbox:s}=r;if(r._contentWGS84===void 0&&Sl(s)){let i=this.state.binary?Fa(r.content):r.content;r._contentWGS84=i.map(o=>iT(o,s,this.context.viewport))}return r._contentWGS84}})})}};Hi.layerName="MVTLayer";Hi.defaultProps=w6;var cT=Hi;function F1(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function rT(e){return e.properties?.layerName||null}function sT(e){return e!=null&&e!==""}function iT(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>eT(e.geometry,t,n).coordinates}),r}var aT="0123456789bcdefghjkmnpqrstuvwxyz",hT={};for(let e=0;e<aT.length;e++)hT[aT.charAt(e)]=e;var R6=-90,I6=90,b6=-180,O6=180;function P6(e){let t=!0,n=I6,r=R6,s=O6,i=b6,o,c=0;for(let a=0,h=e.length;a<h;a++){let l=e[a].toLowerCase();c=hT[l];for(let f=4;f>=0;f--){let p=c>>f&1;t?(o=(s+i)/2,p===1?i=o:s=o):(o=(n+r)/2,p===1?r=o:n=o),t=!t}}return[r,i,n,s]}function lT(e){let[t,n,r,s]=P6(e);return[s,r,s,t,n,t,n,r,s,r]}var N6={getGeohash:{type:"accessor",value:e=>e.geohash}},Yi=class extends Qt{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>lT(n(r,s))}}};Yi.layerName="GeohashLayer";Yi.defaultProps=N6;var fT=Yi;return yT(Wi);})();
1098
+ `;function zI(e){let t=e.positions||e.POSITION,n=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(n*4).fill(255),normalized:!0})}var VI={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},di=class extends Kg.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Jl,Wg),{...t,vs:Jg,fs:jg}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props,{model:r}=this.state;if(!r)return;let s={pickFeatureIds:Boolean(n)},i={camera:this.context.viewport.cameraPosition};r.shaderInputs.setProps({pbrProjection:i,mesh:s}),super.draw(t)}getModel(t){let{id:n}=this.props,r=this.parseMaterial(this.props.pbrMaterial,t);this.setState({parsedPBRMaterial:r});let s=this.getShaders();return zI(t.attributes),new Xg.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...s.defines,...r?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:r?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s});let{pbr_baseColorSampler:i}=s.bindings,{emptyTexture:o}=this.state,c={sampler:i||o,hasTexture:Boolean(i)},{camera:a,...h}={...s.bindings,...s.uniforms};n.shaderInputs.setProps({simpleMesh:c,pbrMaterial:h})}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Hl(this.context.device,{unlit:r,...t},{NORMAL:n.attributes.normals,TEXCOORD_0:n.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let n=this.props.featureIds,r=new Uint8ClampedArray(n.length*t.size),s=[];for(let i=0;i<n.length;i++)this.encodePickingColor(n[i],s),r[i*3]=s[0],r[i*3+1]=s[1],r[i*3+2]=s[2];t.value=r}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(n=>n.destroy()),this.setState({parsedPBRMaterial:null})}};di.layerName="MeshLayer";di.defaultProps=VI;var Qg=di;var OE=G(Fr(),1);var qI=1/Math.PI*180,wY=1/180*Math.PI,kI={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...kI}};var xt=globalThis.mathgl.config;function jl(e,{precision:t=xt.precision}={}){return e=HI(e),`${parseFloat(e.toPrecision(t))}`}function Ie(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ne(e,t){return WI(e,n=>n*qI,t)}function Qo(e,t,n){let r=xt.EPSILON;n&&(xt.EPSILON=n);try{if(e===t)return!0;if(Ie(e)&&Ie(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Qo(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)<=xt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{xt.EPSILON=r}}function HI(e){return Math.round(e/xt.EPSILON)*xt.EPSILON}function YI(e){return e.clone?e.clone():new Array(e.length)}function WI(e,t,n){if(Ie(e)){let r=e;n=n||YI(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var xn=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ie(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(xt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+jl(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Qo(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(xt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function JI(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function J(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Mn(e,t,n=""){if(xt.debug&&!JI(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Xl(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Dr=class extends xn{get x(){return this[0]}set x(t){this[0]=J(t)}get y(){return this[1]}set y(t){this[1]=J(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return J(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return J(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Xl(t>=0&&t<this.ELEMENTS,"index is out of range"),J(this[t])}setComponent(t,n){return Xl(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var It=typeof Float32Array<"u"?Float32Array:Array;var VY=Math.PI/180;function jI(){let e=new It(2);return It!=Float32Array&&(e[0]=0,e[1]=0),e}function ex(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function nx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var qY=function(){let e=jI();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function rx(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function Zo(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function sx(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function ix(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function $o(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function Kl(){let e=new It(3);return It!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function XI(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Ql(e,t,n){let r=new It(3);return r[0]=e,r[1]=t,r[2]=n,r}function ox(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Zl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ur(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function Gr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function tc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function ec(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function cx(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ax(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function hx(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function lx(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Zl(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var fx=XI;var YY=function(){let e=Kl();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var $l=[0,0,0],nc,F=class extends Dr{static get ZERO(){return nc||(nc=new F(0,0,0),Object.freeze(nc)),nc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ie(t)?this.copy(t):(xt.debug&&(J(t),J(n),J(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return xt.debug&&(J(t.x),J(t.y),J(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]=J(t)}angle(t){return lx(this,t)}cross(t){return Ur(this,this,t),this.check()}rotateX({radians:t,origin:n=$l}){return cx(this,this,n,t),this.check()}rotateY({radians:t,origin:n=$l}){return ax(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=$l}){return hx(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Gr(this,this,t),this.check()}transformAsVector(t){return Zo(this,this,t),this.check()}transformByMatrix3(t){return tc(this,this,t),this.check()}transformByMatrix2(t){return sx(this,this,t),this.check()}transformByQuaternion(t){return ec(this,this,t),this.check()}};var rc,zr=class extends Dr{static get ZERO(){return rc||(rc=new zr(0,0,0,0),Object.freeze(rc)),rc}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Ie(t)&&arguments.length===1?this.copy(t):(xt.debug&&(J(t),J(n),J(r),J(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 xt.debug&&(J(t.x),J(t.y),J(t.z),J(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]=J(t)}get w(){return this[3]}set w(t){this[3]=J(t)}transform(t){return Gr(this,this,t),this.check()}transformByMatrix3(t){return $o(this,this,t),this.check()}transformByMatrix2(t){return ix(this,this,t),this.check()}transformByQuaternion(t){return ec(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Vr=class extends xn{toString(){let t="[";if(xt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=J(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function px(){let e=new It(9);return It!=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 ux(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 dx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function mx(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function tf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function gx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function xx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function ef(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 Mx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var nf;(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"})(nf||(nf={}));var ZI=Object.freeze([1,0,0,0,1,0,0,0,1]),Qn=class extends Vr{static get IDENTITY(){return tP()}static get ZERO(){return $I()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return nf}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(ZI)}fromObject(t){return this.check()}fromQuaternion(t){return Mx(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return mx(this)}transpose(){return ux(this,this),this.check()}invert(){return dx(this,this),this.check()}multiplyLeft(t){return tf(this,t,this),this.check()}multiplyRight(t){return tf(this,this,t),this.check()}rotate(t){return xx(this,this,t),this.check()}scale(t){return Array.isArray(t)?ef(this,this,t):ef(this,this,[t,t]),this.check()}translate(t){return gx(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=ex(n||[-0,-0],t,this);break;case 3:r=tc(n||[-0,-0,-0],t,this);break;case 4:r=$o(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Mn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},sc,ic=null;function $I(){return sc||(sc=new Qn([0,0,0,0,0,0,0,0,0]),Object.freeze(sc)),sc}function tP(){return ic||(ic=new Qn,Object.freeze(ic)),ic}function eP(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 Ax(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 yx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function Ex(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function rf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function Tx(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function _x(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Sx(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Cx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Bx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function Lx(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function Rx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function bx(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function nP(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var wx=nP;function rP(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var Ix=rP;function Px(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?eP(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function sP(){let e=new It(4);return It!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Ox(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function vx(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function Nx(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Fx(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Dx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Ux(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Gx(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function zx(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function Vx(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var gW=function(){let e=sP();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var cf;(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"})(cf||(cf={}));var oP=45*Math.PI/180,cP=1,sf=.1,of=500,aP=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),rt=class extends Vr{static get IDENTITY(){return lP()}static get ZERO(){return hP()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return cf}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(aP)}fromObject(t){return this.check()}fromQuaternion(t){return Rx(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=sf,far:c=of}=t;return c===1/0?fP(this,n,r,s,i,o):bx(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return Px(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=sf,far:c=of}=t;return Ix(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=oP,aspect:r=cP,focalDistance:s=1,near:i=sf,far:o=of}=t;qx(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return qx(n),wx(this,n,r,s,i),this.check()}determinant(){return Ex(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Ax(this,this),this.check()}invert(){return yx(this,this),this.check()}multiplyLeft(t){return rf(this,t,this),this.check()}multiplyRight(t){return rf(this,this,t),this.check()}rotateX(t){return Cx(this,this,t),this.check()}rotateY(t){return Bx(this,this,t),this.check()}rotateZ(t){return Lx(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return Sx(this,this,t,n),this.check()}scale(t){return _x(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Tx(this,this,t),this.check()}transform(t,n){return t.length===4?(n=zx(n||[-0,-0,-0,-0],t,this),Mn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=nx(n||[-0,-0],t,this);break;case 3:s=Gr(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Mn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=rx(n||[-0,-0],t,this);break;case 3:r=Zo(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Mn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},oc,cc;function hP(){return oc||(oc=new rt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(oc)),oc}function lP(){return cc||(cc=new rt,Object.freeze(cc)),cc}function qx(e){if(e>Math.PI*2)throw Error("expected radians")}function fP(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function kx(){let e=new It(4);return It!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Hx(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function af(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function hf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function Yx(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Wx(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Jx(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function jx(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function gi(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function Xx(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function Kx(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function lf(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var Qx=Ox;var Zx=vx,$x=Ux,t2=Gx,e2=Nx;var n2=Fx;var r2=Dx;var s2=function(){let e=Kl(),t=Ql(1,0,0),n=Ql(0,1,0);return function(r,s,i){let o=Zl(s,i);return o<-.999999?(Ur(e,t,s),fx(e)<1e-6&&Ur(e,n,s),ox(e,e),af(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ur(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,r2(r,r))}}(),wW=function(){let e=kx(),t=kx();return function(n,r,s,i,o,c){return gi(e,r,o,c),gi(t,s,i,c),gi(n,e,t,2*c*(1-c)),n}}(),IW=function(){let e=px();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],r2(t,lf(t,e))}}();var pP=[0,0,0,1],xi=class extends xn{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 lf(this,t),this.check()}fromAxisRotation(t,n){return af(this,t,n),this.check()}identity(){return Hx(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=J(t)}get y(){return this[1]}set y(t){this[1]=J(t)}get z(){return this[2]}set z(t){this[2]=J(t)}get w(){return this[3]}set w(t){this[3]=J(t)}len(){return e2(this)}lengthSquared(){return n2(this)}dot(t){return $x(this,t)}rotationTo(t,n){return s2(this,t,n),this.check()}add(t){return Qx(this,this,t),this.check()}calculateW(){return jx(this,this),this.check()}conjugate(){return Kx(this,this),this.check()}invert(){return Xx(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(t2(this,t,n,r),this.check())}multiplyRight(t){return hf(this,this,t),this.check()}multiplyLeft(t){return hf(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return Yx(this,this,t),this.check()}rotateY(t){return Wx(this,this,t),this.check()}rotateZ(t){return Jx(this,this,t),this.check()}scale(t){return Zx(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=pP,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return gi(this,s,i,o),this.check()}transformVector4(t,n=new zr){return Vx(n,t,this),Mn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var dP=1/Math.PI*180,mP=1/180*Math.PI,gP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...gP}};var Mt=globalThis.mathgl.config;function ff(e,{precision:t=Mt.precision}={}){return e=xP(e),`${parseFloat(e.toPrecision(t))}`}function An(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function pf(e){return i2(e)}function uf(e){return o2(e)}function i2(e,t){return c2(e,n=>n*mP,t)}function o2(e,t){return c2(e,n=>n*dP,t)}function ke(e,t,n){let r=Mt.EPSILON;n&&(Mt.EPSILON=n);try{if(e===t)return!0;if(An(e)&&An(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!ke(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)<=Mt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Mt.EPSILON=r}}function xP(e){return Math.round(e/Mt.EPSILON)*Mt.EPSILON}function MP(e){return e.clone?e.clone():new Array(e.length)}function c2(e,t,n){if(An(e)){let r=e;n=n||MP(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var qr=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:An(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Mt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+ff(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!ke(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Mt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function AP(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Pt(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function ac(e,t,n=""){if(Mt.debug&&!AP(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function re(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var hc=class extends qr{get x(){return this[0]}set x(t){this[0]=Pt(t)}get y(){return this[1]}set y(t){this[1]=Pt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Pt(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Pt(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return re(t>=0&&t<this.ELEMENTS,"index is out of range"),Pt(this[t])}setComponent(t,n){return re(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var me=typeof Float32Array<"u"?Float32Array:Array,Mi=Math.random;function kr(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var mJ=Math.PI/180;function yP(){let e=new me(2);return me!=Float32Array&&(e[0]=0,e[1]=0),e}function a2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var gJ=function(){let e=yP();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function h2(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function lc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function l2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}var Hr={};Tt(Hr,{add:()=>CP,angle:()=>Tf,bezier:()=>GP,ceil:()=>BP,clone:()=>EP,copy:()=>_P,create:()=>f2,cross:()=>gf,dist:()=>jP,distance:()=>g2,div:()=>JP,divide:()=>m2,dot:()=>mf,equals:()=>HP,exactEquals:()=>kP,floor:()=>LP,forEach:()=>ZP,fromValues:()=>TP,hermite:()=>UP,inverse:()=>vP,len:()=>KP,length:()=>p2,lerp:()=>FP,max:()=>bP,min:()=>RP,mul:()=>WP,multiply:()=>d2,negate:()=>OP,normalize:()=>NP,random:()=>zP,rotateX:()=>Af,rotateY:()=>yf,rotateZ:()=>Ef,round:()=>wP,scale:()=>IP,scaleAndAdd:()=>PP,set:()=>SP,slerp:()=>DP,sqrDist:()=>XP,sqrLen:()=>QP,squaredDistance:()=>x2,squaredLength:()=>M2,str:()=>qP,sub:()=>YP,subtract:()=>u2,transformMat3:()=>xf,transformMat4:()=>Ai,transformQuat:()=>Mf,zero:()=>VP});function f2(){let e=new me(3);return me!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function EP(e){let t=new me(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function p2(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function TP(e,t,n){let r=new me(3);return r[0]=e,r[1]=t,r[2]=n,r}function _P(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function SP(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function CP(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function u2(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function d2(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function m2(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function BP(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function LP(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function RP(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function bP(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function wP(e,t){return e[0]=kr(t[0]),e[1]=kr(t[1]),e[2]=kr(t[2]),e}function IP(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function PP(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function g2(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(n*n+r*r+s*s)}function x2(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function M2(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function OP(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function vP(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function NP(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function mf(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function gf(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function FP(e,t,n,r){let s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function DP(e,t,n,r){let s=Math.acos(Math.min(Math.max(mf(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,c=Math.sin(r*s)/i;return e[0]=o*t[0]+c*n[0],e[1]=o*t[1]+c*n[1],e[2]=o*t[2]+c*n[2],e}function UP(e,t,n,r,s,i){let o=i*i,c=o*(2*i-3)+1,a=o*(i-2)+i,h=o*(i-1),l=o*(3-2*i);return e[0]=t[0]*c+n[0]*a+r[0]*h+s[0]*l,e[1]=t[1]*c+n[1]*a+r[1]*h+s[1]*l,e[2]=t[2]*c+n[2]*a+r[2]*h+s[2]*l,e}function GP(e,t,n,r,s,i){let o=1-i,c=o*o,a=i*i,h=c*o,l=3*i*c,f=3*a*o,p=a*i;return e[0]=t[0]*h+n[0]*l+r[0]*f+s[0]*p,e[1]=t[1]*h+n[1]*l+r[1]*f+s[1]*p,e[2]=t[2]*h+n[2]*l+r[2]*f+s[2]*p,e}function zP(e,t){t=t===void 0?1:t;let n=Mi()*2*Math.PI,r=Mi()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function Ai(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function xf(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Mf(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function Af(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function yf(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ef(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Tf(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&mf(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}function VP(e){return e[0]=0,e[1]=0,e[2]=0,e}function qP(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`}function kP(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function HP(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-c)<=1e-6*Math.max(1,Math.abs(s),Math.abs(c))}var YP=u2,WP=d2,JP=m2,jP=g2,XP=x2,KP=p2,QP=M2,ZP=function(){let e=f2();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var _f=[0,0,0],fc,k=class extends hc{static get ZERO(){return fc||(fc=new k(0,0,0),Object.freeze(fc)),fc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&An(t)?this.copy(t):(Mt.debug&&(Pt(t),Pt(n),Pt(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Mt.debug&&(Pt(t.x),Pt(t.y),Pt(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]=Pt(t)}angle(t){return Tf(this,t)}cross(t){return gf(this,this,t),this.check()}rotateX({radians:t,origin:n=_f}){return Af(this,this,n,t),this.check()}rotateY({radians:t,origin:n=_f}){return yf(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=_f}){return Ef(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ai(this,this,t),this.check()}transformAsVector(t){return lc(this,this,t),this.check()}transformByMatrix3(t){return xf(this,this,t),this.check()}transformByMatrix2(t){return l2(this,this,t),this.check()}transformByQuaternion(t){return Mf(this,this,t),this.check()}};var pc=class extends qr{toString(){let t="[";if(Mt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=Pt(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function $P(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 A2(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 y2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function E2(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function Sf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function T2(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function _2(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function S2(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function C2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function B2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function L2(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function R2(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b2(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function tO(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var w2=tO;function eO(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var I2=eO;function P2(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?$P(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function nO(){let e=new me(4);return me!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function O2(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}var wJ=function(){let e=nO();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var Lf;(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"})(Lf||(Lf={}));var rO=45*Math.PI/180,sO=1,Cf=.1,Bf=500,iO=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),yn=class extends pc{static get IDENTITY(){return cO()}static get ZERO(){return oO()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Lf}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(iO)}fromObject(t){return this.check()}fromQuaternion(t){return R2(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=Cf,far:c=Bf}=t;return c===1/0?aO(this,n,r,s,i,o):b2(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return P2(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=Cf,far:c=Bf}=t;return I2(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=rO,aspect:r=sO,focalDistance:s=1,near:i=Cf,far:o=Bf}=t;v2(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return v2(n),w2(this,n,r,s,i),this.check()}determinant(){return E2(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return A2(this,this),this.check()}invert(){return y2(this,this),this.check()}multiplyLeft(t){return Sf(this,t,this),this.check()}multiplyRight(t){return Sf(this,this,t),this.check()}rotateX(t){return C2(this,this,t),this.check()}rotateY(t){return B2(this,this,t),this.check()}rotateZ(t){return L2(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return S2(this,this,t,n),this.check()}scale(t){return _2(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return T2(this,this,t),this.check()}transform(t,n){return t.length===4?(n=O2(n||[-0,-0,-0,-0],t,this),ac(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=a2(n||[-0,-0],t,this);break;case 3:s=Ai(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ac(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=h2(n||[-0,-0],t,this);break;case 3:r=lc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return ac(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},uc,dc;function oO(){return uc||(uc=new yn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(uc)),uc}function cO(){return dc||(dc=new yn,Object.freeze(dc)),dc}function v2(e){if(e>Math.PI*2)throw Error("expected radians")}function aO(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}var En={};Tt(En,{EPSILON1:()=>hO,EPSILON10:()=>MO,EPSILON11:()=>AO,EPSILON12:()=>yO,EPSILON13:()=>EO,EPSILON14:()=>TO,EPSILON15:()=>_O,EPSILON16:()=>SO,EPSILON17:()=>CO,EPSILON18:()=>BO,EPSILON19:()=>LO,EPSILON2:()=>lO,EPSILON20:()=>RO,EPSILON3:()=>fO,EPSILON4:()=>pO,EPSILON5:()=>uO,EPSILON6:()=>dO,EPSILON7:()=>mO,EPSILON8:()=>gO,EPSILON9:()=>xO,PI_OVER_FOUR:()=>wO,PI_OVER_SIX:()=>IO,PI_OVER_TWO:()=>bO,TWO_PI:()=>PO});var hO=.1,lO=.01,fO=.001,pO=1e-4,uO=1e-5,dO=1e-6,mO=1e-7,gO=1e-8,xO=1e-9,MO=1e-10,AO=1e-11,yO=1e-12,EO=1e-13,TO=1e-14,_O=1e-15,SO=1e-16,CO=1e-17,BO=1e-18,LO=1e-19,RO=1e-20,bO=Math.PI/2,wO=Math.PI/4,IO=Math.PI/6,PO=Math.PI*2;var Ye=6356752314245179e-9,OO={radii:[6378137,6378137,Ye],radiiSquared:[6378137*6378137,6378137*6378137,Ye*Ye],oneOverRadii:[1/6378137,1/6378137,1/Ye],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Ye*Ye)],maximumRadius:Math.max(6378137,6378137,Ye),centerToleranceSquared:.1};function mc(e){return e}var oj=new k;function vO(e,t=[],n=mc){return"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):"x"in e?(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function N2(e,t=[]){return vO(e,t,Mt._cartographicRadians?mc:pf)}function NO(e,t,n=mc){return"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):"x"in t?(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function F2(e,t){return NO(e,t,Mt._cartographicRadians?mc:uf)}var D2=1e-14,FO=new k,U2={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"}},Rf={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},yi={east:new k,north:new k,up:new k,west:new k,south:new k,down:new k},DO=new k,UO=new k,GO=new k;function bf(e,t,n,r,s,i){let o=U2[t]&&U2[t][n];re(o&&(!r||r===o));let c,a,h,l=FO.copy(s);if(ke(l.x,0,D2)&&ke(l.y,0,D2)){let p=Math.sign(l.z);c=DO.fromArray(Rf[t]),t!=="east"&&t!=="west"&&c.scale(p),a=UO.fromArray(Rf[n]),n!=="east"&&n!=="west"&&a.scale(p),h=GO.fromArray(Rf[r]),r!=="east"&&r!=="west"&&h.scale(p)}else{let{up:p,east:u,north:d}=yi;u.set(-l.y,l.x,0).normalize(),e.geodeticSurfaceNormal(l,p),d.copy(p).cross(u);let{down:g,west:m,south:M}=yi;g.copy(p).scale(-1),m.copy(u).scale(-1),M.copy(d).scale(-1),c=yi[t],a=yi[n],h=yi[r]}return i[0]=c.x,i[1]=c.y,i[2]=c.z,i[3]=0,i[4]=a.x,i[5]=a.y,i[6]=a.z,i[7]=0,i[8]=h.x,i[9]=h.y,i[10]=h.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}var Yr=new k,zO=new k,VO=new k;function G2(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;Yr.from(e);let o=Yr.x,c=Yr.y,a=Yr.z,h=r.x,l=r.y,f=r.z,p=o*o*h*h,u=c*c*l*l,d=a*a*f*f,g=p+u+d,m=Math.sqrt(1/g);if(!Number.isFinite(m))return;let M=zO;if(M.copy(e).scale(m),g<i)return M.to(n);let E=s.x,A=s.y,y=s.z,T=VO;T.set(M.x*E*2,M.y*A*2,M.z*y*2);let _=(1-m)*Yr.len()/(.5*T.len()),L=0,C,S,x,R;do{_-=L,C=1/(1+_*E),S=1/(1+_*A),x=1/(1+_*y);let b=C*C,w=S*S,B=x*x,v=b*C,H=w*S,V=B*x;R=p*b+u*w+d*B-1;let Y=-2*(p*v*E+u*H*A+d*V*y);L=R/Y}while(Math.abs(R)>En.EPSILON12);return Yr.scale([C,S,x]).to(n)}var gc=new k,z2=new k,HO=new k,ge=new k,YO=new k,xc=new k,z=class{constructor(t=0,n=0,r=0){this.centerToleranceSquared=En.EPSILON1,re(t>=0),re(n>=0),re(r>=0),this.radii=new k(t,n,r),this.radiiSquared=new k(t*t,n*n,r*r),this.radiiToTheFourth=new k(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new k(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new k(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),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,n=[0,0,0]){let r=z2,s=HO,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),s.copy(this.radiiSquared).scale(r);let o=Math.sqrt(r.dot(s));return s.scale(1/o),r.scale(i),s.add(r),s.to(n)}cartesianToCartographic(t,n=[0,0,0]){xc.from(t);let r=this.scaleToGeodeticSurface(xc,ge);if(!r)return;let s=this.geodeticSurfaceNormal(r,z2),i=YO;i.copy(xc).subtract(r);let o=Math.atan2(s.y,s.x),c=Math.asin(s.z),a=Math.sign(Hr.dot(i,xc))*Hr.length(i);return F2([o,c,a],n)}eastNorthUpToFixedFrame(t,n=new yn){return bf(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new yn){return bf(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return gc.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=N2(t),s=r[0],i=r[1],o=Math.cos(i);return gc.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),gc.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return gc.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return G2(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){ge.from(t);let r=ge.x,s=ge.y,i=ge.z,o=this.oneOverRadiiSquared,c=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return ge.multiplyScalar(c).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return ge.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return ge.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){re(ke(this.radii.x,this.radii.y,En.EPSILON15)),re(this.radii.z>0),ge.from(t);let s=ge.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return ge.set(0,0,s).to(r)}};z.WGS84=new z(6378137,6378137,Ye);var Mc=class{item;previous;next;constructor(t,n,r){this.item=t,this.previous=n,this.next=r}};var Ac=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let n=new Mc(t,this.tail,null);return this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),++this._length,n}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,n){t!==n&&(this.remove(n),this._insert(t,n))}_insert(t,n){let r=t.next;t.next=n,this.tail===t?this.tail=n:r.previous=n,n.next=r,n.previous=t,++this._length}};var yc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Ac,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,c=s.head;for(;c!==o&&(t.gpuMemoryUsageInBytes>i||r);){let a=c.item;c=c.next,this.unloadTile(t,a,n)}}trim(){this._trimTiles=!0}};function V2(e,t){q(e),q(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new rt(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let f=new rt().rotateX(Math.PI/2);o=o.multiplyRight(f);break;case"X":let p=new rt().rotateY(-Math.PI/2);o=o.multiplyRight(p);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let c=new F(i);t.cartesianModelMatrix=o,t.cartesianOrigin=c;let a=z.WGS84.cartesianToCartographic(c,new F),l=z.WGS84.eastNorthUpToFixedFrame(c).invert();t.cartographicModelMatrix=l.multiplyRight(o),t.cartographicOrigin=a,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var Ct={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Pj=1/Math.PI*180,Oj=1/180*Math.PI,WO={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...WO}};var At=globalThis.mathgl.config;function wf(e,{precision:t=At.precision}={}){return e=JO(e),`${parseFloat(e.toPrecision(t))}`}function We(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Tn(e,t,n){let r=At.EPSILON;n&&(At.EPSILON=n);try{if(e===t)return!0;if(We(e)&&We(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Tn(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)<=At.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{At.EPSILON=r}}function JO(e){return Math.round(e/At.EPSILON)*At.EPSILON}var _n=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:We(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(At)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+wf(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Tn(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(At.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function jO(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function j(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Ec(e,t,n=""){if(At.debug&&!jO(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function Pe(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var Wr=class extends _n{get x(){return this[0]}set x(t){this[0]=j(t)}get y(){return this[1]}set y(t){this[1]=j(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return j(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return j(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Pe(t>=0&&t<this.ELEMENTS,"index is out of range"),j(this[t])}setComponent(t,n){return Pe(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var lt=typeof Float32Array<"u"?Float32Array:Array;var Hj=Math.PI/180;function XO(){let e=new lt(2);return lt!=Float32Array&&(e[0]=0,e[1]=0),e}function H2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var Yj=function(){let e=XO();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function Y2(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function W2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function J2(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function Tc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function If(){let e=new lt(3);return lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function KO(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function Pf(e,t,n){let r=new lt(3);return r[0]=e,r[1]=t,r[2]=n,r}function j2(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function Of(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function jr(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function _c(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Sc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Cc(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function X2(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function K2(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Q2(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Z2(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&Of(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var $2=KO;var jj=function(){let e=If();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var vf=[0,0,0],Bc,N=class extends Wr{static get ZERO(){return Bc||(Bc=new N(0,0,0),Object.freeze(Bc)),Bc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&We(t)?this.copy(t):(At.debug&&(j(t),j(n),j(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return At.debug&&(j(t.x),j(t.y),j(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]=j(t)}angle(t){return Z2(this,t)}cross(t){return jr(this,this,t),this.check()}rotateX({radians:t,origin:n=vf}){return X2(this,this,n,t),this.check()}rotateY({radians:t,origin:n=vf}){return K2(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=vf}){return Q2(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return _c(this,this,t),this.check()}transformAsVector(t){return Y2(this,this,t),this.check()}transformByMatrix3(t){return Sc(this,this,t),this.check()}transformByMatrix2(t){return W2(this,this,t),this.check()}transformByQuaternion(t){return Cc(this,this,t),this.check()}};var Lc,Xr=class extends Wr{static get ZERO(){return Lc||(Lc=new Xr(0,0,0,0),Object.freeze(Lc)),Lc}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),We(t)&&arguments.length===1?this.copy(t):(At.debug&&(j(t),j(n),j(r),j(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 At.debug&&(j(t.x),j(t.y),j(t.z),j(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]=j(t)}get w(){return this[3]}set w(t){this[3]=j(t)}transform(t){return _c(this,this,t),this.check()}transformByMatrix3(t){return Tc(this,this,t),this.check()}transformByMatrix2(t){return J2(this,this,t),this.check()}transformByQuaternion(t){return Cc(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var Rc=class extends _n{toString(){let t="[";if(At.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=j(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function tM(){let e=new lt(9);return lt!=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 eM(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 nM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function rM(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function Nf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function sM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function iM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Ff(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 oM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var Df;(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"})(Df||(Df={}));var $O=Object.freeze([1,0,0,0,1,0,0,0,1]),ft=class extends Rc{static get IDENTITY(){return ev()}static get ZERO(){return tv()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Df}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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($O)}fromObject(t){return this.check()}fromQuaternion(t){return oM(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return rM(this)}transpose(){return eM(this,this),this.check()}invert(){return nM(this,this),this.check()}multiplyLeft(t){return Nf(this,t,this),this.check()}multiplyRight(t){return Nf(this,this,t),this.check()}rotate(t){return iM(this,this,t),this.check()}scale(t){return Array.isArray(t)?Ff(this,this,t):Ff(this,this,[t,t]),this.check()}translate(t){return sM(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=H2(n||[-0,-0],t,this);break;case 3:r=Sc(n||[-0,-0,-0],t,this);break;case 4:r=Tc(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Ec(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},bc,wc=null;function tv(){return bc||(bc=new ft([0,0,0,0,0,0,0,0,0]),Object.freeze(bc)),bc}function ev(){return wc||(wc=new ft,Object.freeze(wc)),wc}var Ei={};Tt(Ei,{add:()=>zv,adjoint:()=>hv,clone:()=>rv,copy:()=>sv,create:()=>nv,decompose:()=>Bv,determinant:()=>lv,equals:()=>Hv,exactEquals:()=>kv,frob:()=>Gv,fromQuat:()=>bv,fromQuat2:()=>_v,fromRotation:()=>Av,fromRotationTranslation:()=>hM,fromRotationTranslationScale:()=>Lv,fromRotationTranslationScaleOrigin:()=>Rv,fromScaling:()=>Mv,fromTranslation:()=>xv,fromValues:()=>iv,fromXRotation:()=>yv,fromYRotation:()=>Ev,fromZRotation:()=>Tv,frustum:()=>wv,getRotation:()=>Cv,getScaling:()=>lM,getTranslation:()=>Sv,identity:()=>cM,invert:()=>av,lookAt:()=>Fv,mul:()=>Yv,multiply:()=>aM,multiplyScalar:()=>Vv,multiplyScalarAndAdd:()=>qv,ortho:()=>vv,orthoNO:()=>pM,orthoZO:()=>Nv,perspective:()=>Iv,perspectiveFromFieldOfView:()=>Ov,perspectiveNO:()=>fM,perspectiveZO:()=>Pv,rotate:()=>uv,rotateX:()=>dv,rotateY:()=>mv,rotateZ:()=>gv,scale:()=>pv,set:()=>ov,str:()=>Uv,sub:()=>Wv,subtract:()=>uM,targetTo:()=>Dv,translate:()=>fv,transpose:()=>cv});function nv(){let e=new lt(16);return lt!=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 rv(e){let t=new lt(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 sv(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 iv(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g){let m=new lt(16);return m[0]=e,m[1]=t,m[2]=n,m[3]=r,m[4]=s,m[5]=i,m[6]=o,m[7]=c,m[8]=a,m[9]=h,m[10]=l,m[11]=f,m[12]=p,m[13]=u,m[14]=d,m[15]=g,m}function ov(e,t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=c,e[7]=a,e[8]=h,e[9]=l,e[10]=f,e[11]=p,e[12]=u,e[13]=d,e[14]=g,e[15]=m,e}function cM(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 cv(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 av(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function hv(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m;return e[0]=c*w-a*b+h*R,e[1]=s*b-r*w-i*R,e[2]=g*L-m*_+M*T,e[3]=p*_-f*L-u*T,e[4]=a*x-o*w-h*S,e[5]=n*w-s*x+i*S,e[6]=m*y-d*L-M*A,e[7]=l*L-p*y+u*A,e[8]=o*b-c*x+h*C,e[9]=r*x-n*b-i*C,e[10]=d*_-g*y+M*E,e[11]=f*y-l*_-u*E,e[12]=c*S-o*R-a*C,e[13]=n*R-r*S+s*C,e[14]=g*A-d*T-m*E,e[15]=l*T-f*A+p*E,e}function lv(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function aM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function fv(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function pv(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function uv(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function dv(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function mv(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function gv(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function xv(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 Mv(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 Av(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),c,a,h;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,a=Math.sin(t),c=Math.cos(t),h=1-c,e[0]=r*r*h+c,e[1]=s*r*h+i*a,e[2]=i*r*h-s*a,e[3]=0,e[4]=r*s*h-i*a,e[5]=s*s*h+c,e[6]=i*s*h+r*a,e[7]=0,e[8]=r*i*h+s*a,e[9]=s*i*h-r*a,e[10]=i*i*h+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function yv(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ev(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Tv(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,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 hM(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=r+r,a=s+s,h=i+i,l=r*c,f=r*a,p=r*h,u=s*a,d=s*h,g=i*h,m=o*c,M=o*a,E=o*h;return e[0]=1-(u+g),e[1]=f+E,e[2]=p-M,e[3]=0,e[4]=f-E,e[5]=1-(l+g),e[6]=d+m,e[7]=0,e[8]=p+M,e[9]=d-m,e[10]=1-(l+u),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function _v(e,t){let n=new lt(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=r*r+s*s+i*i+o*o;return f>0?(n[0]=(c*o+l*r+a*i-h*s)*2/f,n[1]=(a*o+l*s+h*r-c*i)*2/f,n[2]=(h*o+l*i+c*s-a*r)*2/f):(n[0]=(c*o+l*r+a*i-h*s)*2,n[1]=(a*o+l*s+h*r-c*i)*2,n[2]=(h*o+l*i+c*s-a*r)*2),hM(e,t,n),e}function Sv(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function lM(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],c=t[6],a=t[8],h=t[9],l=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+c*c),e[2]=Math.sqrt(a*a+h*h+l*l),e}function Cv(e,t){let n=new lt(3);lM(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,c=t[1]*s,a=t[2]*i,h=t[4]*r,l=t[5]*s,f=t[6]*i,p=t[8]*r,u=t[9]*s,d=t[10]*i,g=o+l+d,m=0;return g>0?(m=Math.sqrt(g+1)*2,e[3]=.25*m,e[0]=(f-u)/m,e[1]=(p-a)/m,e[2]=(c-h)/m):o>l&&o>d?(m=Math.sqrt(1+o-l-d)*2,e[3]=(f-u)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(p+a)/m):l>d?(m=Math.sqrt(1+l-o-d)*2,e[3]=(p-a)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(f+u)/m):(m=Math.sqrt(1+d-o-l)*2,e[3]=(c-h)/m,e[0]=(p+a)/m,e[1]=(f+u)/m,e[2]=.25*m),e}function Bv(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],c=r[4],a=r[5],h=r[6],l=r[8],f=r[9],p=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(c*c+a*a+h*h),n[2]=Math.sqrt(l*l+f*f+p*p);let u=1/n[0],d=1/n[1],g=1/n[2],m=s*u,M=i*d,E=o*g,A=c*u,y=a*d,T=h*g,_=l*u,L=f*d,C=p*g,S=m+y+C,x=0;return S>0?(x=Math.sqrt(S+1)*2,e[3]=.25*x,e[0]=(T-L)/x,e[1]=(_-E)/x,e[2]=(M-A)/x):m>y&&m>C?(x=Math.sqrt(1+m-y-C)*2,e[3]=(T-L)/x,e[0]=.25*x,e[1]=(M+A)/x,e[2]=(_+E)/x):y>C?(x=Math.sqrt(1+y-m-C)*2,e[3]=(_-E)/x,e[0]=(M+A)/x,e[1]=.25*x,e[2]=(T+L)/x):(x=Math.sqrt(1+C-m-y)*2,e[3]=(M-A)/x,e[0]=(_+E)/x,e[1]=(T+L)/x,e[2]=.25*x),e}function Lv(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=s+s,h=i+i,l=o+o,f=s*a,p=s*h,u=s*l,d=i*h,g=i*l,m=o*l,M=c*a,E=c*h,A=c*l,y=r[0],T=r[1],_=r[2];return e[0]=(1-(d+m))*y,e[1]=(p+A)*y,e[2]=(u-E)*y,e[3]=0,e[4]=(p-A)*T,e[5]=(1-(f+m))*T,e[6]=(g+M)*T,e[7]=0,e[8]=(u+E)*_,e[9]=(g-M)*_,e[10]=(1-(f+d))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function Rv(e,t,n,r,s){let i=t[0],o=t[1],c=t[2],a=t[3],h=i+i,l=o+o,f=c+c,p=i*h,u=i*l,d=i*f,g=o*l,m=o*f,M=c*f,E=a*h,A=a*l,y=a*f,T=r[0],_=r[1],L=r[2],C=s[0],S=s[1],x=s[2],R=(1-(g+M))*T,b=(u+y)*T,w=(d-A)*T,B=(u-y)*_,v=(1-(p+M))*_,H=(m+E)*_,V=(d+A)*L,tt=(m-E)*L,Y=(1-(p+g))*L;return e[0]=R,e[1]=b,e[2]=w,e[3]=0,e[4]=B,e[5]=v,e[6]=H,e[7]=0,e[8]=V,e[9]=tt,e[10]=Y,e[11]=0,e[12]=n[0]+C-(R*C+B*S+V*x),e[13]=n[1]+S-(b*C+v*S+tt*x),e[14]=n[2]+x-(w*C+H*S+Y*x),e[15]=1,e}function bv(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function wv(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function fM(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var Iv=fM;function Pv(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function Ov(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),c=Math.tan(t.rightDegrees*Math.PI/180),a=2/(o+c),h=2/(s+i);return e[0]=a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=h,e[6]=0,e[7]=0,e[8]=-((o-c)*a*.5),e[9]=(s-i)*h*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function pM(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var vv=pM;function Nv(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=i*h,e[15]=1,e}function Fv(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?cM(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function Dv(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=r[0],a=r[1],h=r[2],l=s-n[0],f=i-n[1],p=o-n[2],u=l*l+f*f+p*p;u>0&&(u=1/Math.sqrt(u),l*=u,f*=u,p*=u);let d=a*p-h*f,g=h*l-c*p,m=c*f-a*l;return u=d*d+g*g+m*m,u>0&&(u=1/Math.sqrt(u),d*=u,g*=u,m*=u),e[0]=d,e[1]=g,e[2]=m,e[3]=0,e[4]=f*m-p*g,e[5]=p*d-l*m,e[6]=l*g-f*d,e[7]=0,e[8]=l,e[9]=f,e[10]=p,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function Uv(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 Gv(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 zv(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function uM(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function Vv(e,t,n){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]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function qv(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function kv(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 Hv(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],c=e[5],a=e[6],h=e[7],l=e[8],f=e[9],p=e[10],u=e[11],d=e[12],g=e[13],m=e[14],M=e[15],E=t[0],A=t[1],y=t[2],T=t[3],_=t[4],L=t[5],C=t[6],S=t[7],x=t[8],R=t[9],b=t[10],w=t[11],B=t[12],v=t[13],H=t[14],V=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-A)<=1e-6*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(s-y)<=1e-6*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(i-T)<=1e-6*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(c-L)<=1e-6*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(a-C)<=1e-6*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(l-x)<=1e-6*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(f-R)<=1e-6*Math.max(1,Math.abs(f),Math.abs(R))&&Math.abs(p-b)<=1e-6*Math.max(1,Math.abs(p),Math.abs(b))&&Math.abs(u-w)<=1e-6*Math.max(1,Math.abs(u),Math.abs(w))&&Math.abs(d-B)<=1e-6*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(g-v)<=1e-6*Math.max(1,Math.abs(g),Math.abs(v))&&Math.abs(m-H)<=1e-6*Math.max(1,Math.abs(m),Math.abs(H))&&Math.abs(M-V)<=1e-6*Math.max(1,Math.abs(M),Math.abs(V))}var Yv=aM,Wv=uM;function Jv(){let e=new lt(4);return lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function dM(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function mM(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function gM(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function xM(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function MM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function AM(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function yM(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function EM(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var MX=function(){let e=Jv();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();function TM(){let e=new lt(4);return lt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function _M(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Uf(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function Gf(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function SM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function CM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function BM(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function LM(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Ti(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function RM(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function bM(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function zf(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var wM=dM;var IM=mM,PM=AM,OM=yM,vM=gM;var NM=xM;var FM=MM;var DM=function(){let e=If(),t=Pf(1,0,0),n=Pf(0,1,0);return function(r,s,i){let o=Of(s,i);return o<-.999999?(jr(e,t,s),$2(e)<1e-6&&jr(e,n,s),j2(e,e),Uf(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(jr(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,FM(r,r))}}(),SX=function(){let e=TM(),t=TM();return function(n,r,s,i,o,c){return Ti(e,r,o,c),Ti(t,s,i,c),Ti(n,e,t,2*c*(1-c)),n}}(),CX=function(){let e=tM();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],FM(t,zf(t,e))}}();var Xv=[0,0,0,1],Kr=class extends _n{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 zf(this,t),this.check()}fromAxisRotation(t,n){return Uf(this,t,n),this.check()}identity(){return _M(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=j(t)}get y(){return this[1]}set y(t){this[1]=j(t)}get z(){return this[2]}set z(t){this[2]=j(t)}get w(){return this[3]}set w(t){this[3]=j(t)}len(){return vM(this)}lengthSquared(){return NM(this)}dot(t){return PM(this,t)}rotationTo(t,n){return DM(this,t,n),this.check()}add(t){return wM(this,this,t),this.check()}calculateW(){return LM(this,this),this.check()}conjugate(){return bM(this,this),this.check()}invert(){return RM(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(OM(this,t,n,r),this.check())}multiplyRight(t){return Gf(this,this,t),this.check()}multiplyLeft(t){return Gf(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return SM(this,this,t),this.check()}rotateY(t){return CM(this,this,t),this.check()}rotateZ(t){return BM(this,this,t),this.check()}scale(t){return IM(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=Xv,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Ti(this,s,i,o),this.check()}transformVector4(t,n=new Xr){return EM(n,t,this),Ec(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Qr={};Tt(Qr,{EPSILON1:()=>Kv,EPSILON10:()=>i4,EPSILON11:()=>o4,EPSILON12:()=>c4,EPSILON13:()=>a4,EPSILON14:()=>h4,EPSILON15:()=>l4,EPSILON16:()=>f4,EPSILON17:()=>p4,EPSILON18:()=>u4,EPSILON19:()=>d4,EPSILON2:()=>Qv,EPSILON20:()=>m4,EPSILON3:()=>Zv,EPSILON4:()=>$v,EPSILON5:()=>t4,EPSILON6:()=>e4,EPSILON7:()=>n4,EPSILON8:()=>r4,EPSILON9:()=>s4,PI_OVER_FOUR:()=>x4,PI_OVER_SIX:()=>M4,PI_OVER_TWO:()=>g4,TWO_PI:()=>A4});var Kv=.1,Qv=.01,Zv=.001,$v=1e-4,t4=1e-5,e4=1e-6,n4=1e-7,r4=1e-8,s4=1e-9,i4=1e-10,o4=1e-11,c4=1e-12,a4=1e-13,h4=1e-14,l4=1e-15,f4=1e-16,p4=1e-17,u4=1e-18,d4=1e-19,m4=1e-20,g4=Math.PI/2,x4=Math.PI/4,M4=Math.PI/6,A4=Math.PI*2;var rK=new N,sK=new N;var _i=new N,UM=new N,se=class{constructor(t=[0,0,0],n=0){this.radius=-0,this.center=new N,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=_i.from(n),this.center=new N().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new se(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=_i.copy(s).subtract(n),c=o.magnitude();if(r>=c+i)return this.clone();if(i>=c+r)return t.clone();let a=(r+c+i)*.5;return UM.copy(o).scale((-r+a)/c).add(n),this.center.copy(UM),this.radius=a,this}expand(t){let r=_i.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=Ei.getScaling(_i,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=_i.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?Ct.OUTSIDE:i<r?Ct.INTERSECTING:Ct.INSIDE}};var y4=new N,E4=new N,Ic=new N,Pc=new N,Oc=new N,T4=new N,_4=new N,Je={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},xe=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){this.center=new N().from(t),this.halfAxes=new ft(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new N(t).len(),new N(n).len(),new N(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new N(t).normalize(),i=new N(n).normalize(),o=new N(r).normalize();return new Kr().fromMatrix3(new ft([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Kr(r),i=new ft().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new N().from(t),this.halfAxes=i,this}clone(){return new xe(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new se){let n=this.halfAxes,r=n.getColumn(0,Ic),s=n.getColumn(1,Pc),i=n.getColumn(2,Oc),o=y4.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,c=r.z,a=Math.abs(i*s[Je.COLUMN0ROW0]+o*s[Je.COLUMN0ROW1]+c*s[Je.COLUMN0ROW2])+Math.abs(i*s[Je.COLUMN1ROW0]+o*s[Je.COLUMN1ROW1]+c*s[Je.COLUMN1ROW2])+Math.abs(i*s[Je.COLUMN2ROW0]+o*s[Je.COLUMN2ROW1]+c*s[Je.COLUMN2ROW2]),h=r.dot(n)+t.distance;return h<=-a?Ct.OUTSIDE:h>=a?Ct.INSIDE:Ct.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=E4.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Ic),i=r.getColumn(1,Pc),o=r.getColumn(2,Oc),c=s.magnitude(),a=i.magnitude(),h=o.magnitude();s.normalize(),i.normalize(),o.normalize();let l=0,f;return f=Math.abs(n.dot(s))-c,f>0&&(l+=f*f),f=Math.abs(n.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(n.dot(o))-h,f>0&&(l+=f*f),l}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,c=this.halfAxes,a=c.getColumn(0,Ic),h=c.getColumn(1,Pc),l=c.getColumn(2,Oc),f=T4.copy(a).add(h).add(l).add(o),p=_4.copy(f).subtract(t),u=n.dot(p);return s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),f.copy(o).add(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).add(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).add(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),o.copy(f).subtract(a).subtract(h).subtract(l),p.copy(f).subtract(t),u=n.dot(p),s=Math.min(u,s),i=Math.max(u,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Ic);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Pc);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Oc);return s.transformAsPoint(t),this.halfAxes=new ft([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var GM=new N,zM=new N,Ot=class{constructor(t=[0,0,1],n=0){this.normal=new N,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return Pe(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=GM.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),Pe(Tn(this.normal.len(),1)),this.distance=s,this}clone(){return new Ot(this.normal,this.distance)}equals(t){return Tn(this.distance,t.distance)&&Tn(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=zM.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=GM.from(t),s=this.getPointDistance(r),i=zM.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var VM=[new N([1,0,0]),new N([0,1,0]),new N([0,0,1])],qM=new N,S4=new N,Bt=class{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*VM.length;let n=t.center,r=t.radius,s=0;for(let i of VM){let o=this.planes[s],c=this.planes[s+1];o||(o=this.planes[s]=new Ot),c||(c=this.planes[s+1]=new Ot);let a=qM.copy(i).scale(-r).add(n);o.fromPointNormal(a,i);let h=qM.copy(i).scale(r).add(n),l=S4.copy(i).negate();c.fromPointNormal(h,l),s+=2}return this}computeVisibility(t){let n=Ct.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case Ct.OUTSIDE:return Ct.OUTSIDE;case Ct.INTERSECTING:n=Ct.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(Pe(Number.isFinite(n),"parentPlaneMask is required."),n===Bt.MASK_OUTSIDE||n===Bt.MASK_INSIDE)return n;let r=Bt.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let c=s[i],a=t.intersectPlane(c);if(a===Ct.OUTSIDE)return Bt.MASK_OUTSIDE;a===Ct.INTERSECTING&&(r|=o)}return r}};Bt.MASK_OUTSIDE=4294967295;Bt.MASK_INSIDE=0;Bt.MASK_INDETERMINATE=2147483647;var _K=new N,SK=new N,CK=new N,BK=new N,LK=new N;var OK=new N,vK=new N,NK=new N,FK=new N,DK=new N,UK=new N,GK=new N,zK=new N,VK=new N,qK=new N,kK=new N,HK=new N;var Oe=new ft,B4=new ft,L4=new ft,vc=new ft,kM=new ft;function kf(e,t={}){let n=Qr.EPSILON20,r=10,s=0,i=0,o=B4,c=L4;o.identity(),c.copy(e);let a=n*R4(c);for(;i<r&&b4(c)>a;)w4(c,vc),kM.copy(vc).transpose(),c.multiplyRight(vc),c.multiplyLeft(kM),o.multiplyRight(vc),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=c.toTarget(t.diagonal),t}function R4(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var Vf=[1,0,0],qf=[2,2,1];function b4(e){let t=0;for(let n=0;n<3;++n){let r=e[Oe.getElementIndex(qf[n],Vf[n])];t+=2*r*r}return Math.sqrt(t)}function w4(e,t){let n=Qr.EPSILON15,r=0,s=1;for(let h=0;h<3;++h){let l=Math.abs(e[Oe.getElementIndex(qf[h],Vf[h])]);l>r&&(s=h,r=l)}let i=Vf[s],o=qf[s],c=1,a=0;if(Math.abs(e[Oe.getElementIndex(o,i)])>n){let h=e[Oe.getElementIndex(o,o)],l=e[Oe.getElementIndex(i,i)],f=e[Oe.getElementIndex(o,i)],p=(h-l)/2/f,u;p<0?u=-1/(-p+Math.sqrt(1+p*p)):u=1/(p+Math.sqrt(1+p*p)),c=1/Math.sqrt(1+u*u),a=u*c}return ft.IDENTITY.to(t),t[Oe.getElementIndex(i,i)]=t[Oe.getElementIndex(o,o)]=c,t[Oe.getElementIndex(o,i)]=a,t[Oe.getElementIndex(i,o)]=-a,t}var Sn=new N,P4=new N,O4=new N,v4=new N,N4=new N,F4=new ft,D4={diagonal:new ft,unitary:new ft};function Hf(e,t=new xe){if(!e||e.length===0)return t.halfAxes=new ft([0,0,0,0,0,0,0,0,0]),t.center=new N,t;let n=e.length,r=new N(0,0,0);for(let S of e)r.add(S);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,c=0,a=0,h=0,l=0;for(let S of e){let x=Sn.copy(S).subtract(r);i+=x.x*x.x,o+=x.x*x.y,c+=x.x*x.z,a+=x.y*x.y,h+=x.y*x.z,l+=x.z*x.z}i*=s,o*=s,c*=s,a*=s,h*=s,l*=s;let f=F4;f[0]=i,f[1]=o,f[2]=c,f[3]=o,f[4]=a,f[5]=h,f[6]=c,f[7]=h,f[8]=l;let{unitary:p}=kf(f,D4),u=t.halfAxes.copy(p),d=u.getColumn(0,O4),g=u.getColumn(1,v4),m=u.getColumn(2,N4),M=-Number.MAX_VALUE,E=-Number.MAX_VALUE,A=-Number.MAX_VALUE,y=Number.MAX_VALUE,T=Number.MAX_VALUE,_=Number.MAX_VALUE;for(let S of e)Sn.copy(S),M=Math.max(Sn.dot(d),M),E=Math.max(Sn.dot(g),E),A=Math.max(Sn.dot(m),A),y=Math.min(Sn.dot(d),y),T=Math.min(Sn.dot(g),T),_=Math.min(Sn.dot(m),_);d=d.multiplyByScalar(.5*(y+M)),g=g.multiplyByScalar(.5*(T+E)),m=m.multiplyByScalar(.5*(_+A)),t.center.copy(d).add(g).add(m);let L=P4.set(M-y,E-T,A-_).multiplyByScalar(.5),C=new ft([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(C),t}var HM=new F,Yf=new F,Wf=new Bt([new Ot,new Ot,new Ot,new Ot,new Ot,new Ot]);function WM(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=Nc(e,e.center),c=z.WGS84.eastNorthUpToFixedFrame(o),a=e.unprojectPosition(e.cameraPosition),h=z.WGS84.cartographicToCartesian(a,new F),l=new F(c.transformAsVector(new F(n).scale(i))).normalize(),f=new F(c.transformAsVector(new F(r).scale(i))).normalize();U4(e);let p=e.constructor,{longitude:u,latitude:d,width:g,bearing:m,zoom:M}=e,E=new p({longitude:u,latitude:d,height:s,width:g,bearing:m,zoom:M,pitch:0});return{camera:{position:h,direction:l,up:f},viewport:e,topDownViewport:E,height:s,cullingVolume:Wf,frameNumber:t,sseDenominator:1.15}}function JM(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[h,l]of e.entries()){let[f,p]=l.header.mbs,u=Math.abs(s-f),d=Math.abs(i-p),g=Math.sqrt(d*d+u*u);r.push([h,g])}let o=r.sort((h,l)=>h[1]-l[1]),c=[];for(let h=0;h<n;h++)c.push(e[o[h][0]]);let a=[];for(let h=n;h<o.length;h++)a.push(e[o[h][0]]);return[c,a]}function U4(e){let t=e.getFrustumPlanes(),n=YM(t.near,e.cameraPosition),r=Nc(e,n),s=Nc(e,e.cameraPosition,Yf),i=0;Wf.planes[i++].fromPointNormal(r,HM.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let c=t[o],a=YM(c,n,Yf),h=Nc(e,a,Yf);Wf.planes[i++].fromPointNormal(h,HM.copy(r).subtract(h))}}function YM(e,t,n=new F){let r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function Nc(e,t,n=new F){let r=e.unprojectPosition(t);return z.WGS84.cartographicToCartesian(r,n)}var G4=6378137,z4=6378137,Jf=6356752314245179e-9,Zr=new F;function jM(e,t){if(e instanceof xe){let{halfAxes:n}=e,r=V4(n);return Math.log2(Jf/(r+t[2]))}else if(e instanceof se){let{radius:n}=e;return Math.log2(Jf/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(G4/n),i=Math.log2(z4/r);return(s+i)/2}return 1}function jf(e,t,n){z.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Zr);let r=Math.sqrt(Math.pow(Zr[0]-n[0],2)+Math.pow(Zr[1]-n[1],2)+Math.pow(Zr[2]-n[2],2));return Math.log2(Jf/(r+t[2]))}function XM(e,t,n){let[r,s,i,o]=e;return jf({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function V4(e){e.getColumn(0,Zr);let t=e.getColumn(1),n=e.getColumn(2);return Zr.add(t).add(n).len()}var pA=G(Fr(),1);var qt={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},vt;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(vt||(vt={}));var ie;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(ie||(ie={}));var Lt;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(Lt||(Lt={}));var je;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(je||(je={}));var KM={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function tA(e){return e!=null}var Nt=new F,Fc=new F,q4=new F,k4=new F,Zn=new F,QM=new F,ZM=new F,$M=new F;function Dc(e,t,n){if(q(e,"3D Tile: boundingVolume must be defined"),e.box)return nA(e.box,t,n);if(e.region)return Y4(e.region);if(e.sphere)return H4(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function eA(e,t){if(e.box)return W4(t);if(e.region){let[n,r,s,i,o,c]=e.region;return[[ne(n),ne(r),o],[ne(s),ne(i),c]]}if(e.sphere)return J4(t);throw new Error("Unkown boundingVolume type")}function nA(e,t,n){let r=new F(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let h=e.slice(3,6),l=new xi;l.fromArray(e,6);let f=new F([1,0,0]),p=new F([0,1,0]),u=new F([0,0,1]);f.transformByQuaternion(l),f.scale(h[0]),p.transformByQuaternion(l),p.scale(h[1]),u.transformByQuaternion(l),u.scale(h[2]),s=[...f.toArray(),...p.toArray(),...u.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),c=t.transformAsVector(s.slice(6,9)),a=new Qn([i[0],i[1],i[2],o[0],o[1],o[2],c[0],c[1],c[2]]);return tA(n)?(n.center=r,n.halfAxes=a,n):new xe(r,a)}function H4(e,t,n){let r=new F(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(Fc),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return tA(n)?(n.center=r,n.radius=o,n):new se(r,o)}function Y4(e){let[t,n,r,s,i,o]=e,c=z.WGS84.cartographicToCartesian([ne(t),ne(s),i],q4),a=z.WGS84.cartographicToCartesian([ne(r),ne(n),o],k4),h=new F().addVectors(c,a).multiplyByScalar(.5);return z.WGS84.cartesianToCartographic(h,Zn),z.WGS84.cartographicToCartesian([ne(r),Zn[1],Zn[2]],QM),z.WGS84.cartographicToCartesian([Zn[0],ne(s),Zn[2]],ZM),z.WGS84.cartographicToCartesian([Zn[0],Zn[1],o],$M),nA([...h,...QM.subtract(h),...ZM.subtract(h),...$M.subtract(h)],new rt)}function W4(e){let t=rA(),{halfAxes:n}=e,r=new F(n.getColumn(0)),s=new F(n.getColumn(1)),i=new F(n.getColumn(2));for(let o=0;o<2;o++){for(let c=0;c<2;c++){for(let a=0;a<2;a++)Nt.copy(e.center),Nt.add(r),Nt.add(s),Nt.add(i),sA(t,Nt),i.negate();s.negate()}r.negate()}return t}function J4(e){let t=rA(),{center:n,radius:r}=e,s=z.WGS84.scaleToGeodeticSurface(n,Nt),i;s?i=z.WGS84.geodeticSurfaceNormal(s):i=new F(0,0,1);let o=new F(i[2],-i[1],0);o.len()>0?o.normalize():o=new F(0,1,0);let c=o.clone().cross(i);for(let a of[o,c,i]){Fc.copy(a).scale(r);for(let h=0;h<2;h++)Nt.copy(n),Nt.add(Fc),sA(t,Nt),Fc.negate()}return t}function rA(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function sA(e,t){z.WGS84.cartesianToCartographic(t,Nt),e[0][0]=Math.min(e[0][0],Nt[0]),e[0][1]=Math.min(e[0][1],Nt[1]),e[0][2]=Math.min(e[0][2],Nt[2]),e[1][0]=Math.max(e[1][0],Nt[0]),e[1][1]=Math.max(e[1][1],Nt[1]),e[1][2]=Math.max(e[1][2],Nt[2])}var bQ=new F,wQ=new F,IQ=new rt,PQ=new F,OQ=new F,vQ=new F;function j4(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function X4(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return j4(t,n)*r}return 0}function iA(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:c,sseDenominator:a}=t,{viewDistanceScale:h}=r.options,l=i*c*(h||1)/(o*a);return l-=X4(r,o),l}var Xf=new F,oA=new F,Cn=new F,cA=new F,K4=new F,Kf=new rt,aA=new rt;function hA(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*Qf(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function Qf(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],c=[...e.boundingVolume.center],a=n.unprojectPosition(n.cameraPosition);z.WGS84.cartographicToCartesian(a,Xf),oA.copy(Xf).subtract(c).normalize(),z.WGS84.eastNorthUpToFixedFrame(c,Kf),aA.copy(Kf).invert(),Cn.copy(Xf).transform(aA);let h=Math.sqrt(Cn[0]*Cn[0]+Cn[1]*Cn[1]),l=h*h/Cn[2];cA.copy([Cn[0],Cn[1],l]);let p=cA.transform(Kf).subtract(c).normalize(),d=oA.cross(p).normalize().scale(o).add(c),g=z.WGS84.cartesianToCartographic(d),m=n.project([s,r,i]),M=n.project(g);return K4.copy(m).subtract(M).magnitude()}function lA(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Si=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 q(t<this._array.length),this._array[t]}set(t,n){q(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=n,this._map.set(n,t)}delete(t){let n=this._map.get(t);n>=0&&(this._array.splice(n,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let n=this.length++;this._array[n]=t,this._map.set(t,n)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){q(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){q(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 Q4={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ve=class{options;root=null;selectedTiles={};requestedTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Si;_emptyTraversalStack=new Si;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...Q4,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let c=i.parent,a=Boolean(!c||c._shouldRefine),h=!o;i.hasRenderContent?i.refine===vt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===vt.REPLACE&&(this.loadTile(i,n),h&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),h&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&a}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,c=t.children;c.sort(this.compareDistanceToCamera.bind(this));let a=t.refine===vt.REPLACE&&t.hasRenderContent&&!o,h=!1,l=!0;for(let f of c)if(f._selectionDepth=s,f.isVisibleAndInRequestVolume?(r.find(f)&&r.delete(f),r.push(f),h=!0):(a||i)&&(this.loadTile(f,n),this.touchTile(f,n)),a){let p;if(f._inRequestVolume?f.hasRenderContent?p=f.contentAvailable:p=this.executeEmptyTraversal(f,n):p=!1,l=l&&p,!l)return!1}return h||(l=!1),l}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n,r=!1,s=!1){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n,r=!1){let s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),c=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!c&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let a=i.children;for(let h of a)s.push(h)}}return r}};var fA=new F;function Z4(e){return e!=null}var $n=class{tileset;header;id;url;parent;refine;type;contentUrl;lodMetricType="geometricError";lodMetricValue=0;boundingVolume=null;content=null;contentState=qt.UNLOADED;gpuMemoryUsageInBytes=0;children=[];depth=0;viewportIds=[];transform=new rt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new ve({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_viewerRequestVolume;_initialTransform=new rt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;constructor(t,n,r,s=""){this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),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===qt.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===qt.UNLOADED}get contentExpired(){return this.contentState===qt.EXPIRED}get contentFailed(){return this.contentState===qt.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=eA(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case Lt.I3S:return Qf(this,t);case Lt.TILES3D:return iA(this,t,n);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:n}=t.options,r=this.refine===vt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===qt.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,c=t.root?t.root._screenSpaceError:0;return Math.max(c-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=qt.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=qt.UNLOADED,!1;try{let r=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,pA.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=qt.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=qt.FAILED,r}finally{n.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=qt.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:Bt.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==Bt.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let n=this.boundingVolume;return fA.subVectors(n.center,t.position),t.direction.dot(fA)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(Z4(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=qt.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 rt(t.transform):new rt;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new rt(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new rt;this._initialTransform=new rt(i).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=qt.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=Bt.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||vt.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=Dc(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=Dc(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=Dc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new rt){let n=t.clone().multiplyRight(this.transform);n.equals(this.computedTransform)||(this.computedTransform=n,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 lA(this.tileset.tileset)}}};var Uc=class extends ve{compareDistanceToCamera(t,n){return n._distanceToCamera===0&&t._distanceToCamera===0?n._centerZDepth-t._centerZDepth:n._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,n){if(super.updateTileVisibility(t,n),!t.isVisibleAndInRequestVolume)return;let r=t.children.length>0;if(t.hasTilesetContent&&r){let o=t.children[0];this.updateTileVisibility(o,n),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,n)){t._visible=!1;return}let s=t.refine===vt.REPLACE,i=t._optimChildrenWithinParent===KM.USE_OPTIMIZATION;if(s&&i&&r&&!this.anyChildrenVisible(t,n)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,n){let{parent:r}=t;return!r||r.hasTilesetContent||r.refine!==vt.ADD?!1:!this.shouldRefine(t,n,!0)}};var uA=G(Fr(),1);var Gc=class{frameNumberMap=new Map;register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){return(this.frameNumberMap.get(t)?.get(n)||0)===0}};var Zf={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},zc=class{_statusMap;pendingTilesRegister=new Gc;constructor(){this._statusMap={}}add(t,n,r,s){if(!this._statusMap[n]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[n]={request:t,callback:r,key:n,frameState:s,status:Zf.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(c=>{this._statusMap[n].status=Zf.COMPLETED;let{frameNumber:a,viewport:{id:h}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(h,a),this._statusMap[n].callback(c,s)}).catch(c=>{this._statusMap[n].status=Zf.ERROR;let{frameNumber:a,viewport:{id:h}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(h,a),r(c)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var Vc=class extends ve{_tileManager;constructor(t){super(t),this._tileManager=new zc}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=hA(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let c=`${o.id}-${n.viewport.id}`,a=s&&s.find(h=>h.id===c);if(a)a&&this.updateTile(a,n);else{let h=()=>this._loadTile(o.id,i);this._tileManager.find(c)?this._tileManager.update(c,n):(i.tileset.nodePages&&(h=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(h,c,f=>this._onTileLoad(f,t,c),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,uA.load)(s,r,i)}_onTileLoad(t,n,r){let s=new $n(n.tileset,t,n,r);n.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var $4={description:"",ellipsoid:z.WGS84,modelMatrix:new rt,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:{}},qc="Tiles In Tileset(s)",$f="Tiles In Memory",dA="Tiles In View",mA="Tiles To Render",gA="Tiles Loaded",t0="Tiles Loading",xA="Tiles Unloaded",MA="Failed Tile Loads",AA="Points/Vertices",e0="Tile Memory Use",yA="Maximum Screen Space Error",Ci=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 yc;_requestScheduler;updatePromise=null;tilesetInitializationPromise;constructor(t,n){this.options={...$4,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||hn.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 an({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 cn({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 r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}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(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(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 n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=WM(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(t){let n=t;return this.options.viewportTraversersMap&&(n=this.options.viewportTraversersMap[t]),n===t}_onTraversalEnd(t){let n=t.viewport.id;this.frameStateData[n]||(this.frameStateData[n]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let r=this.frameStateData[n],s=Object.values(this._traverser.selectedTiles),[i,o]=JM(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let c of o)c.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._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,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(dA).count=this.selectedTiles.length,this.stats.get(mA).count=t,this.stats.get(AA).count=n,this.stats.get(yA).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===Lt.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===Lt.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===Lt.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){let t=this.tileset.fullExtent;if(t){let{xmin:r,xmax:s,ymin:i,ymax:o,zmin:c,zmax:a}=t;this.cartographicCenter=new F(r+(s-r)/2,i+(o-i)/2,c+(a-c)/2),this.cartesianCenter=new F,z.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=jf(t,this.cartographicCenter,this.cartesianCenter);return}let n=this.tileset.store?.extent;if(n){let[r,s,i,o]=n;this.cartographicCenter=new F(r+(i-r)/2,s+(o-s)/2,0),this.cartesianCenter=new F,z.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=XM(n,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new F,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new F,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new F,z.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new F(0,0,-z.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=jM(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(qc),this.stats.get(t0),this.stats.get($f),this.stats.get(dA),this.stats.get(mA),this.stats.get(gA),this.stats.get(xA),this.stats.get(MA),this.stats.get(AA),this.stats.get(e0,"memory"),this.stats.get(yA)}_initializeTileHeaders(t,n){let r=new $n(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===Lt.TILES3D){let s=[];for(s.push(r);s.length>0;){let i=s.pop();this.stats.get(qc).incrementCount();let o=i.header.children||[];for(let c of o){let a=new $n(this,c,i);if(a.contentUrl?.includes("?session=")){let l=new URL(a.contentUrl).searchParams.get("session");l&&(this._queryParams.session=l)}i.children.push(a),a.depth=i.depth+1,s.push(a)}}}return r}_initializeTraverser(){let t;switch(this.type){case Lt.TILES3D:t=Uc;break;case Lt.I3S:t=Vc;break;default:t=ve}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let n;try{this._onStartTileLoading(),n=await t.loadContent()}catch(r){this._onTileLoadError(t,r instanceof Error?r:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,n)}}_onTileLoadError(t,n){this.stats.get(MA).incrementCount();let r=n.message||n.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,s)}_onTileLoad(t,n){if(n){if(this.type===Lt.I3S){let r=this.tileset?.nodePagesTile?.nodesInNodePages||0;this.stats.get(qc).reset(),this.stats.get(qc).addCount(r)}t&&t.content&&V2(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===Lt.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===Lt.TILES3D){let{extensionsRemoved:n=[]}=t.content?.gltf||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(t0).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(t0).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(gA).incrementCount(),this.stats.get($f).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(e0).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get($f).decrementCount(),this.stats.get(xA).incrementCount(),this.stats.get(e0).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let n=t.pop();for(let r of n.children)t.push(r);this._destroyTile(n)}this.root=null}_destroySubtree(t){let n=t,r=[];for(r.push(n);r.length>0;){t=r.pop();for(let s of t.children)r.push(s);t!==n&&this._destroyTile(t)}n.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let n=new URLSearchParams(t.queryString),r=Object.fromEntries(n.entries());this._queryParams={...this._queryParams,...r}}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 kc="4.2.1";var tr={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},bZ=Object.keys(tr);function n0(e,t,n){q(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function EA(e,t=0){let n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var TA="4.2.1";var _A={dataType:null,batchType:null,name:"Draco",id:"draco",module:"draco",version:TA,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 SA(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 er(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,c=e.POSITION?e.POSITION.value:[],a=c&&c.length;for(let h=0;h<a;h+=3){let l=c[h],f=c[h+1],p=c[h+2];t=l<t?l:t,n=f<n?f:n,r=p<r?p:r,s=l>s?l:s,i=f>i?f:i,o=p>o?p:o}return[[t,n,r],[s,i,o]]}function r0(e,t,n){let r=SA(t.value),s=n||CA(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function CA(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 LA(e,t,n){let r=RA(t.metadata),s=[],i=tN(t.attributes);for(let o in e){let c=e[o],a=BA(o,c,i[o]);s.push(a)}if(n){let o=BA("indices",n);s.push(o)}return{fields:s,metadata:r}}function tN(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function BA(e,t,n){let r=n?RA(n.metadata):void 0;return r0(e,t,r)}function RA(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var bA={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},eN={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},nN=4,Bi=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,n={}){let r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let p=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(p)}let c=this._getDracoLoaderData(i,s,n),a=this._getMeshData(i,c,n),h=er(a.attributes),l=LA(a.attributes,c,a.indices);return{loader:"draco",loaderData:c,header:{vertexCount:i.num_points(),boundingBox:h},...a,schema:l}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let c=this._getQuantizationTransform(i,n);c&&(r[i.unique_id()].quantization_transform=c);let a=this._getOctahedronTransform(i,n);a&&(r[i.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.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,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let c=this._getAttributeValues(n,i);if(c){let{value:a,size:h}=c;s[o]={value:a,size:h,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*nN,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,r).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let n=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,n),iN(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=eN[n.data_type];if(!r)return console.warn(`DRACO: Unsupported attribute type ${n.data_type}`),null;let s=n.num_components,o=t.num_points()*s,c=o*r.BYTES_PER_ELEMENT,a=rN(this.draco,r),h,l=this.draco._malloc(c);try{let f=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,f,a,c,l),h=new r(this.draco.HEAPF32.buffer,l,o).slice()}finally{this.draco._free(l)}return{value:h,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,c]of Object.entries(n.extraAttributes||{}))if(c===r)return o;let s=t.attribute_type;for(let o in bA)if(this.draco[o]===s)return bA[o];let i=n.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let n=this.decoder.GetMetadata(t);return this._getDracoMetadata(n)}_getAttributeMetadata(t,n){let r=this.decoder.GetAttributeMetadata(t,n);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let n={},r=this.metadataQuerier.NumEntries(t);for(let s=0;s<r;s++){let i=this.metadataQuerier.GetEntryName(t,s);n[i]=this._getDracoMetadataField(t,i)}return n}_getDracoMetadataField(t,n){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,n,r);let s=sN(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(c=>o.min_value(c))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function rN(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 sN(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function iN(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var oN="1.5.6",cN="1.4.1",s0=`https://www.gstatic.com/draco/versioned/decoders/${oN}`,Wt={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},i0={[Wt.DECODER]:`${s0}/${Wt.DECODER}`,[Wt.DECODER_WASM]:`${s0}/${Wt.DECODER_WASM}`,[Wt.FALLBACK_DECODER]:`${s0}/${Wt.FALLBACK_DECODER}`,[Wt.ENCODER]:`https://raw.githubusercontent.com/google/draco/${cN}/javascript/${Wt.ENCODER}`},o0;async function wA(e){let t=e.modules||{};return t.draco3d?o0||=t.draco3d.createDecoderModule({}).then(n=>({draco:n})):o0||=aN(e),await o0}async function aN(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Le(i0[Wt.FALLBACK_DECODER],"draco",e,Wt.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Le(i0[Wt.DECODER],"draco",e,Wt.DECODER),await Le(i0[Wt.DECODER_WASM],"draco",e,Wt.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await hN(t,n)}function hN(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var Hc={..._A,parse:lN};async function lN(e,t){let{draco:n}=await wA(t),r=new Bi(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var fN={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},yt={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},U={...fN,...yt};var c0={[yt.DOUBLE]:Float64Array,[yt.FLOAT]:Float32Array,[yt.UNSIGNED_SHORT]:Uint16Array,[yt.UNSIGNED_INT]:Uint32Array,[yt.UNSIGNED_BYTE]:Uint8Array,[yt.BYTE]:Int8Array,[yt.SHORT]:Int16Array,[yt.INT]:Int32Array},pN={DOUBLE:yt.DOUBLE,FLOAT:yt.FLOAT,UNSIGNED_SHORT:yt.UNSIGNED_SHORT,UNSIGNED_INT:yt.UNSIGNED_INT,UNSIGNED_BYTE:yt.UNSIGNED_BYTE,BYTE:yt.BYTE,SHORT:yt.SHORT,INT:yt.INT},a0="Failed to convert GL type",Ft=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in c0)if(c0[n]===t)return n;throw new Error(a0)}static fromName(t){let n=pN[t];if(!n)throw new Error(a0);return n}static getArrayType(t){switch(t){case yt.UNSIGNED_SHORT_5_6_5:case yt.UNSIGNED_SHORT_4_4_4_4:case yt.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let n=c0[t];if(!n)throw new Error(a0);return n}}static getByteSize(t){return Ft.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Ft.getArrayType(t))}static createTypedArray(t,n,r=0,s){s===void 0&&(s=(n.byteLength-r)/Ft.getByteSize(t));let i=Ft.getArrayType(t);return new i(n,r,s)}};var i$=1/Math.PI*180,o$=1/180*Math.PI,uN={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...uN}};var bt=globalThis.mathgl.config;function h0(e,{precision:t=bt.precision}={}){return e=dN(e),`${parseFloat(e.toPrecision(t))}`}function Ne(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function l0(e,t,n){return gN(e,r=>Math.max(t,Math.min(n,r)))}function Yc(e,t,n){let r=bt.EPSILON;n&&(bt.EPSILON=n);try{if(e===t)return!0;if(Ne(e)&&Ne(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!Yc(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)<=bt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{bt.EPSILON=r}}function dN(e){return Math.round(e/bt.EPSILON)*bt.EPSILON}function mN(e){return e.clone?e.clone():new Array(e.length)}function gN(e,t,n){if(Ne(e)){let r=e;n=n||mN(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}var Wc=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Ne(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(bt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+h0(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!Yc(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(bt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function _t(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function f0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var $r=class extends Wc{get x(){return this[0]}set x(t){this[0]=_t(t)}get y(){return this[1]}set y(t){this[1]=_t(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return _t(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return _t(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return f0(t>=0&&t<this.ELEMENTS,"index is out of range"),_t(this[t])}setComponent(t,n){return f0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var ts=typeof Float32Array<"u"?Float32Array:Array;var g$=Math.PI/180;function yN(){let e=new ts(2);return ts!=Float32Array&&(e[0]=0,e[1]=0),e}function PA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function OA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function vA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function NA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var x$=function(){let e=yN();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function FA(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function DA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function UA(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}var nr=class extends $r{constructor(t=0,n=0){super(2),Ne(t)&&arguments.length===1?this.copy(t):(bt.debug&&(_t(t),_t(n)),this[0]=t,this[1]=n)}set(t,n){return this[0]=t,this[1]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return bt.debug&&(_t(t.x),_t(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 NA(this,this,t),this.check()}transformAsVector(t){return FA(this,this,t),this.check()}transformByMatrix3(t){return vA(this,this,t),this.check()}transformByMatrix2x3(t){return OA(this,this,t),this.check()}transformByMatrix2(t){return PA(this,this,t),this.check()}};function EN(){let e=new ts(3);return ts!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function TN(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function GA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function zA(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function VA(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function qA(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function kA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function HA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function YA(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function WA(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&TN(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var B$=function(){let e=EN();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var p0=[0,0,0],Jc,rr=class extends $r{static get ZERO(){return Jc||(Jc=new rr(0,0,0),Object.freeze(Jc)),Jc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Ne(t)?this.copy(t):(bt.debug&&(_t(t),_t(n),_t(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return bt.debug&&(_t(t.x),_t(t.y),_t(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]=_t(t)}angle(t){return WA(this,t)}cross(t){return GA(this,this,t),this.check()}rotateX({radians:t,origin:n=p0}){return kA(this,this,n,t),this.check()}rotateY({radians:t,origin:n=p0}){return HA(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=p0}){return YA(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return zA(this,this,t),this.check()}transformAsVector(t){return DA(this,this,t),this.check()}transformByMatrix3(t){return VA(this,this,t),this.check()}transformByMatrix2(t){return UA(this,this,t),this.check()}transformByQuaternion(t){return qA(this,this,t),this.check()}};function JA(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function u0(e,t=[0,0,0]){let n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var stt=1/256;var itt=new nr,ott=new rr,ctt=new nr,att=new nr,htt=new Uint8Array(1);function jA(e,t=255){return l0(e,0,t)/t*2-1}function XA(e){return e<0?-1:1}function KA(e,t,n,r){if(JA(r),e<0||e>n||t<0||t>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=jA(e,n),r.y=jA(t,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){let s=r.x;r.x=(1-Math.abs(r.y))*XA(s),r.y=(1-Math.abs(s))*XA(r.y)}return r.normalize()}function d0(e,t,n){return KA(e,t,255,n)}var btt=1/Math.PI*180,wtt=1/180*Math.PI,_N={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{..._N}};var Et=globalThis.mathgl.config;function QA(e,{precision:t=Et.precision}={}){return e=SN(e),`${parseFloat(e.toPrecision(t))}`}function Bn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function m0(e,t,n){let r=Et.EPSILON;n&&(Et.EPSILON=n);try{if(e===t)return!0;if(Bn(e)&&Bn(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!m0(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)<=Et.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{Et.EPSILON=r}}function SN(e){return Math.round(e/Et.EPSILON)*Et.EPSILON}var Ln=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Bn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Et)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+QA(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!m0(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(Et.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function CN(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function X(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function Rn(e,t,n=""){if(Et.debug&&!CN(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function g0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var es=class extends Ln{get x(){return this[0]}set x(t){this[0]=X(t)}get y(){return this[1]}set y(t){this[1]=X(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return X(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return X(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return g0(t>=0&&t<this.ELEMENTS,"index is out of range"),X(this[t])}setComponent(t,n){return g0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var Dt=typeof Float32Array<"u"?Float32Array:Array;var Vtt=Math.PI/180;function BN(){let e=new Dt(2);return Dt!=Float32Array&&(e[0]=0,e[1]=0),e}function ty(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function ey(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var qtt=function(){let e=BN();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function ny(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function jc(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function ry(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function sy(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function Xc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function x0(){let e=new Dt(3);return Dt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function LN(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function M0(e,t,n){let r=new Dt(3);return r[0]=e,r[1]=t,r[2]=n,r}function iy(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function A0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ns(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function rs(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function Kc(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function Qc(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function oy(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function cy(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ay(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function hy(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&A0(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var ly=LN;var Ytt=function(){let e=x0();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var y0=[0,0,0],Zc,$=class extends es{static get ZERO(){return Zc||(Zc=new $(0,0,0),Object.freeze(Zc)),Zc}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&Bn(t)?this.copy(t):(Et.debug&&(X(t),X(n),X(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Et.debug&&(X(t.x),X(t.y),X(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]=X(t)}angle(t){return hy(this,t)}cross(t){return ns(this,this,t),this.check()}rotateX({radians:t,origin:n=y0}){return oy(this,this,n,t),this.check()}rotateY({radians:t,origin:n=y0}){return cy(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=y0}){return ay(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return rs(this,this,t),this.check()}transformAsVector(t){return jc(this,this,t),this.check()}transformByMatrix3(t){return Kc(this,this,t),this.check()}transformByMatrix2(t){return ry(this,this,t),this.check()}transformByQuaternion(t){return Qc(this,this,t),this.check()}};var $c,ss=class extends es{static get ZERO(){return $c||($c=new ss(0,0,0,0),Object.freeze($c)),$c}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),Bn(t)&&arguments.length===1?this.copy(t):(Et.debug&&(X(t),X(n),X(r),X(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 Et.debug&&(X(t.x),X(t.y),X(t.z),X(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]=X(t)}get w(){return this[3]}set w(t){this[3]=X(t)}transform(t){return rs(this,this,t),this.check()}transformByMatrix3(t){return Xc(this,this,t),this.check()}transformByMatrix2(t){return sy(this,this,t),this.check()}transformByQuaternion(t){return Qc(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var is=class extends Ln{toString(){let t="[";if(Et.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=X(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function fy(){let e=new Dt(9);return Dt!=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 py(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 uy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function dy(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function E0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function my(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function gy(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function T0(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 xy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var _0;(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"})(_0||(_0={}));var wN=Object.freeze([1,0,0,0,1,0,0,0,1]),sr=class extends is{static get IDENTITY(){return PN()}static get ZERO(){return IN()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return _0}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(wN)}fromObject(t){return this.check()}fromQuaternion(t){return xy(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return dy(this)}transpose(){return py(this,this),this.check()}invert(){return uy(this,this),this.check()}multiplyLeft(t){return E0(this,t,this),this.check()}multiplyRight(t){return E0(this,this,t),this.check()}rotate(t){return gy(this,this,t),this.check()}scale(t){return Array.isArray(t)?T0(this,this,t):T0(this,this,[t,t]),this.check()}translate(t){return my(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=ty(n||[-0,-0],t,this);break;case 3:r=Kc(n||[-0,-0,-0],t,this);break;case 4:r=Xc(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rn(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},ta,ea=null;function IN(){return ta||(ta=new sr([0,0,0,0,0,0,0,0,0]),Object.freeze(ta)),ta}function PN(){return ea||(ea=new sr,Object.freeze(ea)),ea}function ON(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 My(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],c=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=c}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 Ay(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=t[9],p=t[10],u=t[11],d=t[12],g=t[13],m=t[14],M=t[15],E=n*c-r*o,A=n*a-s*o,y=n*h-i*o,T=r*a-s*c,_=r*h-i*c,L=s*h-i*a,C=l*g-f*d,S=l*m-p*d,x=l*M-u*d,R=f*m-p*g,b=f*M-u*g,w=p*M-u*m,B=E*w-A*b+y*R+T*x-_*S+L*C;return B?(B=1/B,e[0]=(c*w-a*b+h*R)*B,e[1]=(s*b-r*w-i*R)*B,e[2]=(g*L-m*_+M*T)*B,e[3]=(p*_-f*L-u*T)*B,e[4]=(a*x-o*w-h*S)*B,e[5]=(n*w-s*x+i*S)*B,e[6]=(m*y-d*L-M*A)*B,e[7]=(l*L-p*y+u*A)*B,e[8]=(o*b-c*x+h*C)*B,e[9]=(r*x-n*b-i*C)*B,e[10]=(d*_-g*y+M*E)*B,e[11]=(f*y-l*_-u*E)*B,e[12]=(c*S-o*R-a*C)*B,e[13]=(n*R-r*S+s*C)*B,e[14]=(g*A-d*T-m*E)*B,e[15]=(l*T-f*A+p*E)*B,e):null}function yy(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8],l=e[9],f=e[10],p=e[11],u=e[12],d=e[13],g=e[14],m=e[15],M=t*o-n*i,E=t*c-r*i,A=n*c-r*o,y=h*d-l*u,T=h*g-f*u,_=l*g-f*d,L=t*_-n*T+r*y,C=i*_-o*T+c*y,S=h*A-l*E+f*M,x=u*A-d*E+g*M;return a*L-s*C+m*S-p*x}function S0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=t[9],u=t[10],d=t[11],g=t[12],m=t[13],M=t[14],E=t[15],A=n[0],y=n[1],T=n[2],_=n[3];return e[0]=A*r+y*c+T*f+_*g,e[1]=A*s+y*a+T*p+_*m,e[2]=A*i+y*h+T*u+_*M,e[3]=A*o+y*l+T*d+_*E,A=n[4],y=n[5],T=n[6],_=n[7],e[4]=A*r+y*c+T*f+_*g,e[5]=A*s+y*a+T*p+_*m,e[6]=A*i+y*h+T*u+_*M,e[7]=A*o+y*l+T*d+_*E,A=n[8],y=n[9],T=n[10],_=n[11],e[8]=A*r+y*c+T*f+_*g,e[9]=A*s+y*a+T*p+_*m,e[10]=A*i+y*h+T*u+_*M,e[11]=A*o+y*l+T*d+_*E,A=n[12],y=n[13],T=n[14],_=n[15],e[12]=A*r+y*c+T*f+_*g,e[13]=A*s+y*a+T*p+_*m,e[14]=A*i+y*h+T*u+_*M,e[15]=A*o+y*l+T*d+_*E,e}function Ey(e,t,n){let r=n[0],s=n[1],i=n[2],o,c,a,h,l,f,p,u,d,g,m,M;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],c=t[1],a=t[2],h=t[3],l=t[4],f=t[5],p=t[6],u=t[7],d=t[8],g=t[9],m=t[10],M=t[11],e[0]=o,e[1]=c,e[2]=a,e[3]=h,e[4]=l,e[5]=f,e[6]=p,e[7]=u,e[8]=d,e[9]=g,e[10]=m,e[11]=M,e[12]=o*r+l*s+d*i+t[12],e[13]=c*r+f*s+g*i+t[13],e[14]=a*r+p*s+m*i+t[14],e[15]=h*r+u*s+M*i+t[15]),e}function Ty(e,t,n){let r=n[0],s=n[1],i=n[2];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]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function _y(e,t,n,r){let s=r[0],i=r[1],o=r[2],c=Math.sqrt(s*s+i*i+o*o),a,h,l,f,p,u,d,g,m,M,E,A,y,T,_,L,C,S,x,R,b,w,B,v;return c<1e-6?null:(c=1/c,s*=c,i*=c,o*=c,h=Math.sin(n),a=Math.cos(n),l=1-a,f=t[0],p=t[1],u=t[2],d=t[3],g=t[4],m=t[5],M=t[6],E=t[7],A=t[8],y=t[9],T=t[10],_=t[11],L=s*s*l+a,C=i*s*l+o*h,S=o*s*l-i*h,x=s*i*l-o*h,R=i*i*l+a,b=o*i*l+s*h,w=s*o*l+i*h,B=i*o*l-s*h,v=o*o*l+a,e[0]=f*L+g*C+A*S,e[1]=p*L+m*C+y*S,e[2]=u*L+M*C+T*S,e[3]=d*L+E*C+_*S,e[4]=f*x+g*R+A*b,e[5]=p*x+m*R+y*b,e[6]=u*x+M*R+T*b,e[7]=d*x+E*R+_*b,e[8]=f*w+g*B+A*v,e[9]=p*w+m*B+y*v,e[10]=u*w+M*B+T*v,e[11]=d*w+E*B+_*v,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function Sy(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],c=t[6],a=t[7],h=t[8],l=t[9],f=t[10],p=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]=i*s+h*r,e[5]=o*s+l*r,e[6]=c*s+f*r,e[7]=a*s+p*r,e[8]=h*s-i*r,e[9]=l*s-o*r,e[10]=f*s-c*r,e[11]=p*s-a*r,e}function Cy(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[8],l=t[9],f=t[10],p=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]=i*s-h*r,e[1]=o*s-l*r,e[2]=c*s-f*r,e[3]=a*s-p*r,e[8]=i*r+h*s,e[9]=o*r+l*s,e[10]=c*r+f*s,e[11]=a*r+p*s,e}function By(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],c=t[2],a=t[3],h=t[4],l=t[5],f=t[6],p=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]=i*s+h*r,e[1]=o*s+l*r,e[2]=c*s+f*r,e[3]=a*s+p*r,e[4]=h*s-i*r,e[5]=l*s-o*r,e[6]=f*s-c*r,e[7]=p*s-a*r,e}function Ly(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[1]=l+M,e[2]=p-m,e[3]=0,e[4]=l-M,e[5]=1-h-d,e[6]=u+g,e[7]=0,e[8]=p+m,e[9]=u-g,e[10]=1-h-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ry(e,t,n,r,s,i,o){let c=1/(n-t),a=1/(s-r),h=1/(i-o);return e[0]=i*2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*a,e[6]=0,e[7]=0,e[8]=(n+t)*c,e[9]=(s+r)*a,e[10]=(o+i)*h,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*h,e[15]=0,e}function vN(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,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 o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var by=vN;function NN(e,t,n,r,s,i,o){let c=1/(t-n),a=1/(r-s),h=1/(i-o);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*h,e[11]=0,e[12]=(t+n)*c,e[13]=(s+r)*a,e[14]=(o+i)*h,e[15]=1,e}var wy=NN;function Iy(e,t,n,r){let s,i,o,c,a,h,l,f,p,u,d=t[0],g=t[1],m=t[2],M=r[0],E=r[1],A=r[2],y=n[0],T=n[1],_=n[2];return Math.abs(d-y)<1e-6&&Math.abs(g-T)<1e-6&&Math.abs(m-_)<1e-6?ON(e):(f=d-y,p=g-T,u=m-_,s=1/Math.sqrt(f*f+p*p+u*u),f*=s,p*=s,u*=s,i=E*u-A*p,o=A*f-M*u,c=M*p-E*f,s=Math.sqrt(i*i+o*o+c*c),s?(s=1/s,i*=s,o*=s,c*=s):(i=0,o=0,c=0),a=p*c-u*o,h=u*i-f*c,l=f*o-p*i,s=Math.sqrt(a*a+h*h+l*l),s?(s=1/s,a*=s,h*=s,l*=s):(a=0,h=0,l=0),e[0]=i,e[1]=a,e[2]=f,e[3]=0,e[4]=o,e[5]=h,e[6]=p,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=0,e[12]=-(i*d+o*g+c*m),e[13]=-(a*d+h*g+l*m),e[14]=-(f*d+p*g+u*m),e[15]=1,e)}function FN(){let e=new Dt(4);return Dt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Py(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function Oy(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function vy(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function Ny(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function Fy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function Dy(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function Uy(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=c+r*(n[3]-c),e}function Gy(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function zy(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2],h=n[3],l=h*r+c*i-a*s,f=h*s+a*r-o*i,p=h*i+o*s-c*r,u=-o*r-c*s-a*i;return e[0]=l*h+u*-o+f*-a-p*-c,e[1]=f*h+u*-c+p*-o-l*-a,e[2]=p*h+u*-a+l*-c-f*-o,e[3]=t[3],e}var xet=function(){let e=FN();return function(t,n,r,s,i,o){let c,a;for(n||(n=4),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],e[3]=t[c+3],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2],t[c+3]=e[3];return t}}();var L0;(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"})(L0||(L0={}));var UN=45*Math.PI/180,GN=1,C0=.1,B0=500,zN=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bn=class extends is{static get IDENTITY(){return qN()}static get ZERO(){return VN()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return L0}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,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this[9]=l,this[10]=f,this[11]=p,this[12]=u,this[13]=d,this[14]=g,this[15]=m,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h,l,f,p,u,d,g,m){return this[0]=t,this[1]=i,this[2]=h,this[3]=u,this[4]=n,this[5]=o,this[6]=l,this[7]=d,this[8]=r,this[9]=c,this[10]=f,this[11]=g,this[12]=s,this[13]=a,this[14]=p,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(zN)}fromObject(t){return this.check()}fromQuaternion(t){return Ly(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=C0,far:c=B0}=t;return c===1/0?kN(this,n,r,s,i,o):Ry(this,n,r,s,i,o,c),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return Iy(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=C0,far:c=B0}=t;return wy(this,n,r,s,i,o,c),this.check()}orthographic(t){let{fovy:n=UN,aspect:r=GN,focalDistance:s=1,near:i=C0,far:o=B0}=t;Vy(n);let c=n/2,a=s*Math.tan(c),h=a*r;return this.ortho({left:-h,right:h,bottom:-a,top:a,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return Vy(n),by(this,n,r,s,i),this.check()}determinant(){return yy(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,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return My(this,this),this.check()}invert(){return Ay(this,this),this.check()}multiplyLeft(t){return S0(this,t,this),this.check()}multiplyRight(t){return S0(this,this,t),this.check()}rotateX(t){return Sy(this,this,t),this.check()}rotateY(t){return Cy(this,this,t),this.check()}rotateZ(t){return By(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return _y(this,this,t,n),this.check()}scale(t){return Ty(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Ey(this,this,t),this.check()}transform(t,n){return t.length===4?(n=Gy(n||[-0,-0,-0,-0],t,this),Rn(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=ey(n||[-0,-0],t,this);break;case 3:s=rs(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rn(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=ny(n||[-0,-0],t,this);break;case 3:r=jc(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rn(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},na,ra;function VN(){return na||(na=new bn([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(na)),na}function qN(){return ra||(ra=new bn,Object.freeze(ra)),ra}function Vy(e){if(e>Math.PI*2)throw Error("expected radians")}function kN(e,t,n,r,s,i){let o=2*i/(n-t),c=2*i/(s-r),a=(n+t)/(n-t),h=(s+r)/(s-r),l=-1,f=-1,p=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=a,e[9]=h,e[10]=l,e[11]=f,e[12]=0,e[13]=0,e[14]=p,e[15]=0,e}function qy(){let e=new Dt(4);return Dt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ky(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function R0(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function b0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=n[0],a=n[1],h=n[2],l=n[3];return e[0]=r*l+o*c+s*h-i*a,e[1]=s*l+o*a+i*c-r*h,e[2]=i*l+o*h+r*a-s*c,e[3]=o*l-r*c-s*a-i*h,e}function Hy(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+o*c,e[1]=s*a+i*c,e[2]=i*a-s*c,e[3]=o*a-r*c,e}function Yy(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a-i*c,e[1]=s*a+o*c,e[2]=i*a+r*c,e[3]=o*a-s*c,e}function Wy(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],c=Math.sin(n),a=Math.cos(n);return e[0]=r*a+s*c,e[1]=s*a-r*c,e[2]=i*a+o*c,e[3]=o*a-i*c,e}function Jy(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function Ri(e,t,n,r){let s=t[0],i=t[1],o=t[2],c=t[3],a=n[0],h=n[1],l=n[2],f=n[3],p,u,d,g,m;return p=s*a+i*h+o*l+c*f,p<0&&(p=-p,a=-a,h=-h,l=-l,f=-f),1-p>1e-6?(u=Math.acos(p),m=Math.sin(u),d=Math.sin((1-r)*u)/m,g=Math.sin(r*u)/m):(d=1-r,g=r),e[0]=d*s+g*a,e[1]=d*i+g*h,e[2]=d*o+g*l,e[3]=d*c+g*f,e}function jy(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,c=o?1/o:0;return e[0]=-n*c,e[1]=-r*c,e[2]=-s*c,e[3]=i*c,e}function Xy(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function w0(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var Ky=Py;var Qy=Oy,Zy=Dy,$y=Uy,t3=vy;var e3=Ny;var n3=Fy;var r3=function(){let e=x0(),t=M0(1,0,0),n=M0(0,1,0);return function(r,s,i){let o=A0(s,i);return o<-.999999?(ns(e,t,s),ly(e)<1e-6&&ns(e,n,s),iy(e,e),R0(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(ns(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,n3(r,r))}}(),Pet=function(){let e=qy(),t=qy();return function(n,r,s,i,o,c){return Ri(e,r,o,c),Ri(t,s,i,c),Ri(n,e,t,2*c*(1-c)),n}}(),Oet=function(){let e=fy();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],n3(t,w0(t,e))}}();var HN=[0,0,0,1],bi=class extends Ln{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,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 w0(this,t),this.check()}fromAxisRotation(t,n){return R0(this,t,n),this.check()}identity(){return ky(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=X(t)}get y(){return this[1]}set y(t){this[1]=X(t)}get z(){return this[2]}set z(t){this[2]=X(t)}get w(){return this[3]}set w(t){this[3]=X(t)}len(){return t3(this)}lengthSquared(){return e3(this)}dot(t){return Zy(this,t)}rotationTo(t,n){return r3(this,t,n),this.check()}add(t){return Ky(this,this,t),this.check()}calculateW(){return Jy(this,this),this.check()}conjugate(){return Xy(this,this),this.check()}invert(){return jy(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):($y(this,t,n,r),this.check())}multiplyRight(t){return b0(this,this,t),this.check()}multiplyLeft(t){return b0(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return Hy(this,this,t),this.check()}rotateY(t){return Yy(this,this,t),this.check()}rotateZ(t){return Wy(this,this,t),this.check()}scale(t){return Qy(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=HN,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return Ri(this,s,i,o),this.check()}transformVector4(t,n=new ss){return zy(n,t,this),Rn(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Ke=class{json;buffer;featuresLength=0;_cachedTypedArrays={};constructor(t,n){this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,n=U.UNSIGNED_INT,r=1){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=Ft.fromName(s.componentType)),this._getTypedArrayFromBinary(t,n,r,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,n,s)}getProperty(t,n,r,s,i){let o=this.json[t];if(!o)return o;let c=this.getPropertyArray(t,n,r);if(r===1)return c[s];for(let a=0;a<r;++a)i[a]=c[r*s+a];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,c=o[t];return c||(c=Ft.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=c),c}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=Ft.createTypedArray(n,r),s[t]=i),i}};var YN={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},WN={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]]},JN={SCALAR:(e,t,n)=>{t[n]=e},VEC2:(e,t,n)=>{t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:(e,t,n)=>{t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:(e,t,n)=>{t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:(e,t,n)=>{t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};function s3(e,t,n,r){let{componentType:s}=e;q(e.componentType);let i=typeof s=="string"?Ft.fromName(s):s,o=YN[e.type],c=WN[e.type],a=JN[e.type];return n+=e.byteOffset,{values:Ft.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:c,packer:a}}var Fe=e=>e!==void 0;function i3(e,t,n){if(!t)return null;let r=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,r=s),r?jN(r,n):null}function jN(e,t){let n,r,s,i=e.instancesLength,o=e.classes,c=e.classIds,a=e.parentCounts,h=e.parentIds,l=i;Fe(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,i));let f;if(Fe(a))for(Fe(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,i)),f=new Uint16Array(i),l=0,n=0;n<i;++n)f[n]=l,l+=a[n];Fe(h)&&Fe(h.byteOffset)&&(h.componentType=defaultValue(h.componentType,GL.UNSIGNED_SHORT),h.type=AttributeType.SCALAR,s=getBinaryAccessor(h),h=s.createArrayBufferView(t.buffer,t.byteOffset+h.byteOffset,l));let p=o.length;for(n=0;n<p;++n){let m=o[n].length,M=o[n].instances,E=getBinaryProperties(m,M,t);o[n].instances=combine(E,M)}let u=new Array(p).fill(0),d=new Uint16Array(i);for(n=0;n<i;++n)r=c[n],d[n]=u[r],++u[r];let g={classes:o,classIds:c,classIndexes:d,parentCounts:a,parentIndexes:f,parentIds:h};return QN(g),g}function os(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?XN(e,t,n):KN(e,t,n)}function XN(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,c=r.length,a=scratchVisited;a.length=Math.max(a.length,c);let h=++marker,l=scratchStack;for(l.length=0,l.push(t);l.length>0;){if(t=l.pop(),a[t]===h)continue;a[t]=h;let f=n(e,t);if(Fe(f))return f;let p=s[t],u=o[t];for(let d=0;d<p;++d){let g=i[u+d];g!==t&&l.push(g)}}return null}function KN(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(Fe(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function QN(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)o3(e,s,stack)}function o3(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,c=e.classIds.length;if(!Fe(s))return;assert(t<c,`Parent index ${t} exceeds the total number of instances: ${c}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let a=Fe(r)?r[t]:1,h=Fe(r)?i[t]:t;for(let l=0;l<a;++l){let f=s[h+l];f!==t&&o3(e,f,n)}n.pop(t)}function Jt(e){return e!=null}var sa=(e,t)=>e,ZN={HIERARCHY:!0,extensions:!0,extras:!0},ir=class{json;binary;featureCount;_extensions;_properties;_binaryProperties;_hierarchy;constructor(t,n,r,s={}){q(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=this.json?.extensions||{},this._properties={};for(let i in this.json)ZN[i]||(this._properties[i]=this.json[i]);this._binaryProperties=this._initializeBinaryProperties(),s["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=i3(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,n){if(this._checkBatchId(t),q(typeof n=="string",n),this._hierarchy){let r=os(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return Jt(r)}return!1}isExactClass(t,n){return q(typeof n=="string",n),this.getExactClassName(t)===n}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let n=this._hierarchy.classIds[t];return this._hierarchy.classes[n].name}}hasProperty(t,n){return this._checkBatchId(t),q(typeof n=="string",n),Jt(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=Jt(n)?n:[],n.length=0;let r=Object.keys(this._properties);return n.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,n),n}getProperty(t,n){if(this._checkBatchId(t),q(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(Jt(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(Jt(r))return sa(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(Jt(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),q(typeof n=="string",n),this._binaryProperties){let o=this._binaryProperties[n];if(o){this._setBinaryProperty(o,t,r);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,n,r))return;let i=this._properties[n];Jt(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=sa(r,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,n){return t.unpack(t.typedArray,n)}_setBinaryProperty(t,n,r){t.pack(r,t.typedArray,n)}_initializeBinaryProperties(){let t=null;for(let n in this._properties){let r=this._properties[n],s=this._initializeBinaryProperty(n,r);s&&(t=t||{},t[n]=s)}return t}_initializeBinaryProperty(t,n){if("byteOffset"in n){let r=n;q(this.binary,`Property ${t} requires a batch table binary.`),q(r.type,`Property ${t} requires a type.`);let s=s3(r,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,n){if(!this._hierarchy)return!1;let r=os(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],c=s.classes[o].instances;return Jt(c[n])});return Jt(r)}_getPropertyNamesInHierarchy(t,n){os(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let c in o)o.hasOwnProperty(c)&&n.indexOf(c)===-1&&n.push(c)})}_getHierarchyProperty(t,n){return os(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],c=r.classIndexes[s],a=o.instances[n];return Jt(a)?Jt(a.typedArray)?this._getBinaryProperty(a,c):sa(a[c],!0):null})}_setHierarchyProperty(t,n,r,s){let i=os(this._hierarchy,n,(o,c)=>{let a=o.classIds[c],h=o.classes[a],l=o.classIndexes[c],f=h.instances[r];return Jt(f)?(q(c===n,`Inherited property "${r}" is read-only.`),Jt(f.typedArray)?this._setBinaryProperty(f,l,s):f[l]=sa(s,!0),!0):!1});return Jt(i)}};function wn(e,t,n=0){let r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var cs=4,c3="b3dm tile in legacy format.";function as(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=cs;let o=r.getUint32(n,!0);n+=cs;let c=r.getUint32(n,!0);n+=cs;let a=r.getUint32(n,!0);return n+=cs,c>=570425344?(n-=cs*2,s=i,c=o,a=0,i=0,o=0,console.warn(c3)):a>=570425344&&(n-=cs,s=c,c=i,a=o,i=0,o=0,console.warn(c3)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=c,e.header.batchTableBinaryByteLength=a,e.header.batchLength=s,n}function hs(e,t,n,r){return n=$N(e,t,n,r),n=tF(e,t,n,r),n}function $N(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let c=n0(t,n,s);e.featureTableJson=JSON.parse(c)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function tF(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=n0(t,n,s);e.batchTableJson=JSON.parse(o),n+=s,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function I0(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let c=0;c<i;c++){let a=r[c],l=n.getProperty(a,"dimensions").map(f=>f*255);o[c*3]=l[0],o[c*3+1]=l[1],o[c*3+2]=l[2]}return{type:U.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let c=0;c<i;c++){let a=u0(t[c]);o[c*3]=a[0],o[c*3+1]=a[1],o[c*3+2]=a[2]}return{type:U.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:U.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:U.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var a3=new $;function h3(e,t){if(!t)return null;if(e.isOctEncoded16P){let n=new Float32Array((e.pointsLength||0)*3);for(let r=0;r<(e.pointsLength||0);r++)d0(t[r*2],t[r*2+1],a3),a3.toArray(n,r*3);return{type:U.FLOAT,size:2,value:n}}return{type:U.FLOAT,size:2,value:t}}function l3(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,eF(e,t)):{type:U.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function eF(e,t){let n=new $,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function f3(e,t,n,r,s){n=wn(e,t,n),n=as(e,t,n),n=hs(e,t,n,r),nF(e);let{featureTable:i,batchTable:o}=rF(e);return await aF(e,i,o,r,s),sF(e,i,r),iF(e,i,o),oF(e,i),n}function nF(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function rF(e){let t=new Ke(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",U.FLOAT,3);let r=cF(e,t);return{featureTable:t,batchTable:r}}function sF(e,t,n){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",U.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",U.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",U.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",U.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=l3(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function iF(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let r=null;t.hasProperty("RGBA")?(r=t.getPropertyArray("RGBA",U.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",U.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",U.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=I0(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",U.UNSIGNED_BYTE,4))}function oF(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",U.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",U.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=h3(e,n)}}function cF(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",U.UNSIGNED_SHORT,1),e.batchIds)){let r=t.getGlobalProperty("BATCH_LENGTH");if(!r)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=e;n=new ir(s,i,r)}return n}async function aF(e,t,n,r,s){let i,o,c,a=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];a&&(c=a.properties);let h=t.getExtension("3DTILES_draco_point_compression");if(h){o=h.properties;let f=h.byteOffset,p=h.byteLength;if(!o||!Number.isFinite(f)||!p)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(f,f+p),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let l={buffer:i,properties:{...o,...c},featureTableProperties:o,batchTableProperties:c,dequantizeInShader:!1};return await hF(e,l,r,s)}async function hF(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Qt(t.buffer,Hc,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,c=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,a=i.attributes.NORMAL&&i.attributes.NORMAL.value,h=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,l=o&&i.attributes.POSITION.value.quantization,f=a&&i.attributes.NORMAL.value.quantization;if(l){let u=i.POSITION.data.quantization,d=u.range;e.quantizedVolumeScale=new $(d,d,d),e.quantizedVolumeOffset=new $(u.minValues),e.quantizedRange=(1<<u.quantizationBits)-1,e.isQuantizedDraco=!0}f&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let p={};if(t.batchTableProperties)for(let u of Object.keys(t.batchTableProperties))i.attributes[u]&&i.attributes[u].value&&(p[u.toLowerCase()]=i.attributes[u].value);e.attributes={positions:o,colors:I0(e,c,void 0),normals:a,batchIds:h,...p}}var P0={};Tt(P0,{decode:()=>EF,name:()=>yF});function St(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var ia={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},oa={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var lF=1.33,p3=["SCALAR","VEC2","VEC3","VEC4"],fF=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],pF=new Map(fF),uF={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},dF={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},mF={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function ca(e){return p3[e-1]||p3[0]}function ls(e){let t=pF.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function fs(e,t){let n=mF[e.componentType],r=uF[e.type],s=dF[e.componentType],i=e.count*r,o=e.count*r*s;St(o>=0&&o<=t.byteLength);let c=oa[e.componentType],a=ia[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:c,numberOfComponentsInElement:a}}function wi(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,c)=>o+c.byteLength,0),i=t.reduce((o,c)=>{let{width:a,height:h}=c.image;return o+a*h},0);return s+Math.ceil(4*i*lF)}function u3(e,t,n){let r=e.bufferViews[n];St(r);let s=r.buffer,i=t[s];St(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function d3(e,t,n){let r=typeof n=="number"?e.accessors?.[n]:n;if(!r)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let s=e.bufferViews?.[r.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:i,byteOffset:o}=t[s.buffer],c=(o||0)+(r.byteOffset||0)+(s.byteOffset||0),{ArrayType:a,length:h,componentByteSize:l,numberOfComponentsInElement:f}=fs(r,s),p=l*f,u=s.byteStride||p;if(typeof s.byteStride>"u"||s.byteStride===p)return new a(i,c,h);let d=new a(h);for(let g=0;g<r.count;g++){let m=new a(i,c+g*u,f);d.set(m,g*f)}return d}function gF(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var Z=class{gltf;sourceBuffers;byteLength;constructor(t){this.gltf={json:t?.json||gF(),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 n=this.getUsedExtensions().find(s=>s===t),r=this.getRequiredExtensions().find(s=>s===t);return typeof n=="string"||typeof r=="string"}getExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.json.extensions||{};return n?r[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(r=>r===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,n){return(t.extensions||{})[n]}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,n){if(typeof n=="object")return n;let r=this.json[t]&&this.json[t][n];if(!r)throw new Error(`glTF file error: Could not find ${t}[${n}]`);return r}getTypedArrayForBufferView(t){t=this.getBufferView(t);let n=t.buffer,r=this.gltf.buffers[n];St(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return d3(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t,n={}){return St(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t,n={}){return St(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){if(this.json.extensions?.[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(t)||n.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:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,c={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let a=this._addIndices(r);c.primitives[0].indices=a}return Number.isFinite(s)&&(c.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(c),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=Hn(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t,n=0,r=this.byteLength){let s=t.byteLength;St(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=on(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:ca(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,n={size:3}){let r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:ls(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),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(){this.gltf.buffers=[];let t=this.byteLength,n=new ArrayBuffer(t),r=new Uint8Array(n),s=0;for(let i of this.sourceBuffers||[])s=cl(i,r,s);this.json?.buffers?.[0]?this.json.buffers[0].byteLength=t:this.json.buffers=[{byteLength:t}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(t={}){let n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_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,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function m3(e){return(e%1+1)%1}var g3={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},xF={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},x3={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Ii(e,t){return x3[t]*g3[e]}function ps(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=us(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function us(e,t,n,r=1){let s=g3[t],i=xF[n],o=x3[n],c=r*s,a=c*o,h=e.buffer,l=e.byteOffset;return l%o!==0&&(h=new Uint8Array(h).slice(l,l+a).buffer,l=0),new i(h,l,c)}function ds(e,t,n){let r=`TEXCOORD_${t.texCoord||0}`,s=n.attributes[r],i=e.getTypedArrayForAccessor(s),o=e.gltf.json,c=t.index,a=o.textures?.[c]?.source;if(typeof a<"u"){let h=o.images?.[a]?.mimeType,l=e.gltf.images?.[a];if(l&&typeof l.width<"u"){let f=[];for(let p=0;p<i.length;p+=2){let u=MF(l,h,i,p,t.channels);f.push(u)}return f}}return[]}function aa(e,t,n,r,s){if(!n?.length)return;let i=[];for(let l of n){let f=r.findIndex(p=>p===l);f===-1&&(f=r.push(l)-1),i.push(f)}let o=new Uint32Array(i),c=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,a=e.addBufferView(o,c,0),h=e.addAccessor(a,{size:1,componentType:ls(o),count:o.length});s.attributes[t]=h}function MF(e,t,n,r,s=[0]){let i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],c=n[r+1],a=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(a=4);let h=AF(o,c,e,a),l=0;for(let f of s){let p=typeof f=="number"?Object.values(i)[f]:i[f],u=h+p.offset,d=Qs(e);if(d.data.length<=u)throw new Error(`${d.data.length} <= ${u}`);let g=d.data[u];l|=g<<p.shift}return l}function AF(e,t,n,r=1){let s=n.width,i=m3(e)*(s-1),o=Math.round(i),c=n.height,a=m3(t)*(c-1),h=Math.round(a),l=n.components?n.components:r;return(h*s+o)*l}function ha(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let c=n[o],a=n[o+1]-n[o];if(a+c>r)break;let h=c/s,l=a/s;i.push(e.slice(h,h+l))}return i}function la(e,t,n){let r=[];for(let s=0;s<t;s++){let i=s*n;r.push(e.slice(i,i+n))}return r}function fa(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let c=0;c<e;c++){let a=r[c+1]-r[c];if(a+o<=t.length){let h=t.subarray(o,a+o),l=i.decode(h);s.push(l),o+=a}}return s}return[]}var M3="EXT_mesh_features",yF=M3;async function EF(e,t){let n=new Z(e);TF(n,t)}function TF(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)_F(e,s,t)}function _F(e,t,n){if(!n?.gltf?.loadBuffers)return;let s=t.extensions?.[M3]?.featureIds;if(s)for(let i of s){let o;if(typeof i.attribute<"u"){let c=`_FEATURE_ID_${i.attribute}`,a=t.attributes[c];o=e.getTypedArrayForAccessor(a)}else typeof i.texture<"u"&&n?.gltf?.loadImages?o=ds(e,i.texture,t):o=[];i.data=o}}var N0={};Tt(N0,{decode:()=>CF,name:()=>SF});var O0="EXT_structural_metadata",SF=O0;async function CF(e,t){let n=new Z(e);BF(n,t)}function BF(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(O0);n&&(t.gltf?.loadImages&&LF(e,n),RF(e,n))}function LF(e,t){let n=t.propertyTextures,r=e.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let i of s.primitives)wF(e,n,i,t)}function RF(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.propertyTables;if(r&&s)for(let i in r){let o=bF(s,i);o&&PF(e,n,o)}}function bF(e,t){for(let n of e)if(n.class===t)return n;return null}function wF(e,t,n,r){if(!t)return;let i=n.extensions?.[O0]?.propertyTextures;if(i)for(let o of i){let c=t[o];IF(e,c,n,r)}}function IF(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let i in t.properties){let o=`${s}_${i}`,c=t.properties?.[i];if(!c)continue;c.data||(c.data=[]);let a=c.data,h=ds(e,c,n);h!==null&&(aa(e,o,h,a,n),c.data=a,r.dataAttributeNames.push(o))}}function PF(e,t,n){let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let i in r.properties){let o=r.properties[i],c=n.properties?.[i];if(c){let a=OF(e,t,o,s,c);c.data=a}}}function OF(e,t,n,r,s){let i=[],o=s.values,c=e.getTypedArrayForBufferView(o),a=vF(e,n,s,r),h=NF(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=FF(n,r,c,a);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=fa(r,c,a,h);break}case"ENUM":{i=DF(t,n,r,c,a);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function vF(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?ps(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function NF(e,t,n){return typeof t.stringOffsets<"u"?ps(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function FF(e,t,n,r){let s=e.array,i=e.count,o=Ii(e.type,e.componentType),c=n.byteLength/o,a;return e.componentType?a=us(n,e.type,e.componentType,c):a=n,s?r?ha(a,t,r,n.length,o):i?la(a,t,i):[]:a}function DF(e,t,n,r,s){let i=t.enumType;if(!i)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let o=e.enums?.[i];if(!o)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${i}`);let c=o.valueType||"UINT16",a=Ii(t.type,c),h=r.byteLength/a,l=us(r,t.type,c,h);if(l||(l=r),t.array){if(s)return UF({valuesData:l,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:a,enumEntry:o});let f=t.count;return f?GF(l,n,f,o):[]}return v0(l,0,n,o)}function UF(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,c=[];for(let a=0;a<n;a++){let h=r[a],l=r[a+1]-r[a];if(l+h>s)break;let f=h/i,p=l/i,u=v0(t,f,p,o);c.push(u)}return c}function GF(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,c=v0(e,o,n,r);s.push(c)}return s}function v0(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],c=zF(r,o);c?s.push(c.name):s.push("")}return s}function zF(e,t){for(let n of e.values)if(n.value===t)return n;return null}var F0={};Tt(F0,{decode:()=>qF,name:()=>VF});var A3="EXT_feature_metadata",VF=A3;async function qF(e,t){let n=new Z(e);kF(n,t)}function kF(e,t){if(!t.gltf?.loadBuffers)return;let n=e.getExtension(A3);n&&(t.gltf?.loadImages&&HF(e,n),YF(e,n))}function HF(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],c=JF(s,i);c&&XF(e,c,o)}}function YF(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.featureTables;if(r&&s)for(let i in r){let o=WF(s,i);o&&jF(e,n,o)}}function WF(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function JF(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function jF(e,t,n){if(!n.class)return;let r=t.classes?.[n.class];if(!r)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let s=n.count;for(let i in r.properties){let o=r.properties[i],c=n.properties?.[i];if(c){let a=KF(e,t,o,s,c);c.data=a}}}function XF(e,t,n){let r=t.class;for(let s in n.properties){let i=t?.properties?.[s];if(i){let o=e5(e,i,r);i.data=o}}}function KF(e,t,n,r,s){let i=[],o=s.bufferView,c=e.getTypedArrayForBufferView(o),a=QF(e,n,s,r),h=ZF(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=fa(r,c,a,h):$F(n)&&(i=t5(n,r,c,a)),i}function QF(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?ps(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function ZF(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?ps(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function $F(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 t5(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",c=e.componentType||e.type,a=Ii(o,c),h=n.byteLength/a,l=us(n,o,c,h);return s?r?ha(l,t,r,n.length,a):i?la(l,t,i):[]:l}function e5(e,t,n){let r=e.gltf.json;if(!r.meshes)return[];let s=[];for(let i of r.meshes)for(let o of i.primitives)n5(e,n,t,s,o);return s}function n5(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=ds(e,i,s);o&&aa(e,t,o,r,s)}var y3="4.2.1";var ms=!0,E3=1735152710,G0=12,pa=8,r5=1313821514,s5=5130562,i5=0,o5=0,c5=1;function a5(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 T3(e,t=0,n={}){let r=new DataView(e),{magic:s=E3}=n,i=r.getUint32(t,!1);return i===s||i===E3}function _3(e,t,n=0,r={}){let s=new DataView(t),i=a5(s,n+0),o=s.getUint32(n+4,ms),c=s.getUint32(n+8,ms);switch(Object.assign(e,{header:{byteOffset:n,byteLength:c,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=G0,e.version){case 1:return h5(e,s,n);case 2:return l5(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function h5(e,t,n){q(e.header.byteLength>G0+pa);let r=t.getUint32(n+0,ms),s=t.getUint32(n+4,ms);return n+=pa,q(s===i5),D0(e,t,n,r),n+=r,n+=U0(e,t,n,e.header.byteLength),n}function l5(e,t,n,r){return q(e.header.byteLength>G0+pa),f5(e,t,n,r),n+e.header.byteLength}function f5(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,ms),i=t.getUint32(n+4,ms);switch(n+=pa,i){case r5:D0(e,t,n,s);break;case s5:U0(e,t,n,s);break;case o5:r.strict||D0(e,t,n,s);break;case c5:r.strict||U0(e,t,n,s);break;default:break}n+=on(s,4)}return n}function D0(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),on(r,4)}function U0(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),on(r,4)}function z0(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let r=t.baseUri||t.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return r.substr(0,r.lastIndexOf("/")+1)+e}var q0={};Tt(q0,{decode:()=>_5,name:()=>T5});var p5="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",u5="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",d5=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]),m5=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]),g5={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},x5={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function S3(e,t,n,r,s,i="NONE"){let o=await M5();E5(o,o.exports[x5[s]],e,t,n,r,o.exports[g5[i||"NONE"]])}var V0;async function M5(){return V0||(V0=A5()),V0}async function A5(){let e=p5;WebAssembly.validate(d5)&&(e=u5,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(y5(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function y5(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);t[r]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;r<e.length;++r)t[n++]=t[r]<60?m5[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function E5(e,t,n,r,s,i,o){let c=e.exports.sbrk,a=r+3&-4,h=c(a*s),l=c(i.length),f=new Uint8Array(e.exports.memory.buffer);f.set(i,l);let p=t(h,r,s,l,i.length);if(p===0&&o&&o(h,a,s),n.set(f.subarray(h,h+r*s)),c(h-c(0)),p!==0)throw new Error(`Malformed buffer data: ${p}`)}var ua="EXT_meshopt_compression",T5=ua;async function _5(e,t){let n=new Z(e);if(!t?.gltf?.decompressMeshes||!t.gltf?.loadBuffers)return;let r=[];for(let s of e.json.bufferViews||[])r.push(S5(n,s));await Promise.all(r),n.removeExtension(ua)}async function S5(e,t){let n=e.getObjectExtension(t,ua);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:c,filter:a="NONE",buffer:h}=n,l=e.gltf.buffers[h],f=new Uint8Array(l.arrayBuffer,l.byteOffset+r,s),p=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await S3(p,o,i,f,c,a),e.removeObjectExtension(t,ua)}}var k0={};Tt(k0,{name:()=>C5,preprocess:()=>B5});var gs="EXT_texture_webp",C5=gs;function B5(e,t){let n=new Z(e);if(!Ml("image/webp")){if(n.getRequiredExtensions().includes(gs))throw new Error(`gltf: Required extension ${gs} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,gs);i&&(s.source=i.source),n.removeObjectExtension(s,gs)}n.removeExtension(gs)}var H0={};Tt(H0,{name:()=>L5,preprocess:()=>R5});var da="KHR_texture_basisu",L5=da;function R5(e,t){let n=new Z(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,da);i&&(s.source=i.source,n.removeObjectExtension(s,da))}n.removeExtension(da)}var W0={};Tt(W0,{decode:()=>O5,encode:()=>v5,name:()=>I5,preprocess:()=>P5});function C3(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=Y0(r);t[n]=s}}return t}function Y0(e){let{buffer:t,size:n,count:r}=b5(e);return{value:t,size:n,byteOffset:0,count:r,type:ca(n),componentType:ls(t)}}function b5(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=w5(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function w5(e,t,n=!1){return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var In="KHR_draco_mesh_compression",I5=In;function P5(e,t,n){let r=new Z(e);for(let s of B3(r))r.getObjectExtension(s,In)}async function O5(e,t,n){if(!t?.gltf?.decompressMeshes)return;let r=new Z(e),s=[];for(let i of B3(r))r.getObjectExtension(i,In)&&s.push(N5(r,i,t,n));await Promise.all(s),r.removeExtension(In)}function v5(e,t={}){let n=new Z(e);for(let r of n.json.meshes||[])F5(r,t),n.addRequiredExtension(In)}async function N5(e,t,n,r){let s=e.getObjectExtension(t,In);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=zn(i.buffer,i.byteOffset),c={...n};delete c["3d-tiles"];let a=await Qt(o,Hc,c,r),h=C3(a.attributes);for(let[l,f]of Object.entries(h))if(l in t.attributes){let p=t.attributes[l],u=e.getAccessor(p);u?.min&&u?.max&&(f.min=u.min,f.max=u.max)}t.attributes=h,a.indices&&(t.indices=Y0(a.indices)),e.removeObjectExtension(t,In),D5(t)}function F5(e,t,n=4,r,s){if(!r.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let i=r.DracoWriter.encodeSync({attributes:e}),o=s?.parseSync?.({attributes:e}),c=r._addFauxAttributes(o.attributes),a=r.addBufferView(i);return{primitives:[{attributes:c,mode:n,extensions:{[In]:{bufferView:a,attributes:c}}}]}}function D5(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*B3(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var $0={};Tt($0,{decode:()=>$5,name:()=>K5});var lrt=1/Math.PI*180,frt=1/180*Math.PI,U5={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...U5}};var wt=globalThis.mathgl.config;function L3(e,{precision:t=wt.precision}={}){return e=G5(e),`${parseFloat(e.toPrecision(t))}`}function xs(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function J0(e,t,n){let r=wt.EPSILON;n&&(wt.EPSILON=n);try{if(e===t)return!0;if(xs(e)&&xs(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!J0(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)<=wt.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{wt.EPSILON=r}}function G5(e){return Math.round(e/wt.EPSILON)*wt.EPSILON}var Ms=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:xs(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(wt)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+L3(this[r],t);return`${t.printTypes?this.constructor.name:""}[${n}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!J0(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(wt.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 n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function z5(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function Ut(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function R3(e,t,n=""){if(wt.debug&&!z5(e,t))throw new Error(`math.gl: ${n} some fields set to invalid numbers'`);return e}function j0(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var ma=class extends Ms{get x(){return this[0]}set x(t){this[0]=Ut(t)}get y(){return this[1]}set y(t){this[1]=Ut(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return Ut(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return Ut(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return j0(t>=0&&t<this.ELEMENTS,"index is out of range"),Ut(this[t])}setComponent(t,n){return j0(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var As=typeof Float32Array<"u"?Float32Array:Array;var Trt=Math.PI/180;function H5(){let e=new As(2);return As!=Float32Array&&(e[0]=0,e[1]=0),e}function w3(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}var _rt=function(){let e=H5();return function(t,n,r,s,i,o){let c,a;for(n||(n=2),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],i(e,e,o),t[c]=e[0],t[c+1]=e[1];return t}}();function I3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function P3(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function O3(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}function Y5(){let e=new As(3);return As!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function W5(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function v3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],c=n[1],a=n[2];return e[0]=s*a-i*c,e[1]=i*o-r*a,e[2]=r*c-s*o,e}function N3(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function ga(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function F3(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],c=t[0],a=t[1],h=t[2],l=s*h-i*a,f=i*c-r*h,p=r*a-s*c,u=s*p-i*f,d=i*l-r*p,g=r*f-s*l,m=o*2;return l*=m,f*=m,p*=m,u*=2,d*=2,g*=2,e[0]=c+l+u,e[1]=a+f+d,e[2]=h+p+g,e}function D3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function U3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function G3(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function z3(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],c=t[2],a=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+c*c)),h=a&&W5(e,t)/a;return Math.acos(Math.min(Math.max(h,-1),1))}var Brt=function(){let e=Y5();return function(t,n,r,s,i,o){let c,a;for(n||(n=3),r||(r=0),s?a=Math.min(s*n+r,t.length):a=t.length,c=r;c<a;c+=n)e[0]=t[c],e[1]=t[c+1],e[2]=t[c+2],i(e,e,o),t[c]=e[0],t[c+1]=e[1],t[c+2]=e[2];return t}}();var X0=[0,0,0],xa,or=class extends ma{static get ZERO(){return xa||(xa=new or(0,0,0),Object.freeze(xa)),xa}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&xs(t)?this.copy(t):(wt.debug&&(Ut(t),Ut(n),Ut(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return wt.debug&&(Ut(t.x),Ut(t.y),Ut(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]=Ut(t)}angle(t){return z3(this,t)}cross(t){return v3(this,this,t),this.check()}rotateX({radians:t,origin:n=X0}){return D3(this,this,n,t),this.check()}rotateY({radians:t,origin:n=X0}){return U3(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=X0}){return G3(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return N3(this,this,t),this.check()}transformAsVector(t){return I3(this,this,t),this.check()}transformByMatrix3(t){return ga(this,this,t),this.check()}transformByMatrix2(t){return P3(this,this,t),this.check()}transformByQuaternion(t){return F3(this,this,t),this.check()}};var Ma=class extends Ms{toString(){let t="[";if(wt.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=` ${this[r*this.RANK+n]}`}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=` ${this[n]}`}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=Ut(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function V3(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,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 q3(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],c=t[5],a=t[6],h=t[7],l=t[8],f=l*o-c*h,p=-l*i+c*a,u=h*i-o*a,d=n*f+r*p+s*u;return d?(d=1/d,e[0]=f*d,e[1]=(-l*r+s*h)*d,e[2]=(c*r-s*o)*d,e[3]=p*d,e[4]=(l*n-s*a)*d,e[5]=(-c*n+s*i)*d,e[6]=u*d,e[7]=(-h*n+r*a)*d,e[8]=(o*n-r*i)*d,e):null}function k3(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],c=e[6],a=e[7],h=e[8];return t*(h*i-o*a)+n*(-h*s+o*c)+r*(a*s-i*c)}function K0(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1],d=n[2],g=n[3],m=n[4],M=n[5],E=n[6],A=n[7],y=n[8];return e[0]=p*r+u*o+d*h,e[1]=p*s+u*c+d*l,e[2]=p*i+u*a+d*f,e[3]=g*r+m*o+M*h,e[4]=g*s+m*c+M*l,e[5]=g*i+m*a+M*f,e[6]=E*r+A*o+y*h,e[7]=E*s+A*c+y*l,e[8]=E*i+A*a+y*f,e}function H3(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=n[0],u=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=c,e[5]=a,e[6]=p*r+u*o+h,e[7]=p*s+u*c+l,e[8]=p*i+u*a+f,e}function Y3(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],c=t[4],a=t[5],h=t[6],l=t[7],f=t[8],p=Math.sin(n),u=Math.cos(n);return e[0]=u*r+p*o,e[1]=u*s+p*c,e[2]=u*i+p*a,e[3]=u*o-p*r,e[4]=u*c-p*s,e[5]=u*a-p*i,e[6]=h,e[7]=l,e[8]=f,e}function Q0(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*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 W3(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,c=r+r,a=s+s,h=n*o,l=r*o,f=r*c,p=s*o,u=s*c,d=s*a,g=i*o,m=i*c,M=i*a;return e[0]=1-f-d,e[3]=l-M,e[6]=p+m,e[1]=l+M,e[4]=1-h-d,e[7]=u-g,e[2]=p-m,e[5]=u+g,e[8]=1-h-f,e}var Z0;(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"})(Z0||(Z0={}));var J5=Object.freeze([1,0,0,0,1,0,0,0,1]),Qe=class extends Ma{static get IDENTITY(){return X5()}static get ZERO(){return j5()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Z0}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):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(J5)}fromObject(t){return this.check()}fromQuaternion(t){return W3(this,t),this.check()}set(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=c,this[7]=a,this[8]=h,this.check()}setRowMajor(t,n,r,s,i,o,c,a,h){return this[0]=t,this[1]=s,this[2]=c,this[3]=n,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=h,this.check()}determinant(){return k3(this)}transpose(){return V3(this,this),this.check()}invert(){return q3(this,this),this.check()}multiplyLeft(t){return K0(this,t,this),this.check()}multiplyRight(t){return K0(this,this,t),this.check()}rotate(t){return Y3(this,this,t),this.check()}scale(t){return Array.isArray(t)?Q0(this,this,t):Q0(this,this,[t,t]),this.check()}translate(t){return H3(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=w3(n||[-0,-0],t,this);break;case 3:r=ga(n||[-0,-0,-0],t,this);break;case 4:r=O3(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return R3(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},Aa,ya=null;function j5(){return Aa||(Aa=new Qe([0,0,0,0,0,0,0,0,0]),Object.freeze(Aa)),Aa}function X5(){return ya||(ya=new Qe,Object.freeze(ya)),ya}var Ta="KHR_texture_transform",K5=Ta,Ea=new or,Q5=new Qe,Z5=new Qe;async function $5(e,t){if(!new Z(e).hasExtension(Ta)||!t.gltf?.loadBuffers)return;let s=e.json.materials||[];for(let i=0;i<s.length;i++)t8(i,e)}function t8(e,t){let n=t.json.materials?.[e],r=[n?.pbrMetallicRoughness?.baseColorTexture,n?.emissiveTexture,n?.normalTexture,n?.occlusionTexture,n?.pbrMetallicRoughness?.metallicRoughnessTexture],s=[];for(let i of r)i&&i?.extensions?.[Ta]&&e8(t,e,i,s)}function e8(e,t,n,r){let s=n8(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let c of o.primitives){let a=c.material;Number.isFinite(a)&&t===a&&r8(e,c,s)}}function n8(e,t){let n=e.extensions?.[Ta],{texCoord:r=0}=e,{texCoord:s=r}=n;if(!(t.findIndex(([o,c])=>o===r&&c===s)!==-1)){let o=o8(n);return r!==s&&(e.texCoord=s),t.push([r,s]),{originalTexCoord:r,texCoord:s,matrix:o}}return null}function r8(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){let c=e.json.accessors?.[o];if(c&&c.bufferView){let a=e.json.bufferViews?.[c.bufferView];if(a){let{arrayBuffer:h,byteOffset:l}=e.buffers[a.buffer],f=(l||0)+(c.byteOffset||0)+(a.byteOffset||0),{ArrayType:p,length:u}=fs(c,a),d=oa[c.componentType],g=ia[c.type],m=a.byteStride||d*g,M=new Float32Array(u);for(let E=0;E<c.count;E++){let A=new p(h,f+E*m,2);Ea.set(A[0],A[1],1),Ea.transformByMatrix3(i),M.set([Ea[0],Ea[1]],E*g)}r===s?s8(c,a,e.buffers,M):i8(s,c,t,e,M)}}}}function s8(e,t,n,r){e.componentType=5126,n.push({arrayBuffer:r.buffer,byteOffset:0,byteLength:r.buffer.byteLength}),t.buffer=n.length-1,t.byteLength=r.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function i8(e,t,n,r,s){r.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=r.json.bufferViews;if(!i)return;i.push({buffer:r.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=r.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),n.attributes[`TEXCOORD_${e}`]=o.length-1)}function o8(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new Qe().set(1,0,0,0,1,0,t[0],t[1],1),i=Q5.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=Z5.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var t1={};Tt(t1,{decode:()=>a8,encode:()=>h8,name:()=>c8});var cr="KHR_lights_punctual",c8=cr;async function a8(e){let t=new Z(e),{json:n}=t,r=t.getExtension(cr);r&&(t.json.lights=r.lights,t.removeExtension(cr));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,cr);i&&(s.light=i.light),t.removeObjectExtension(s,cr)}}async function h8(e){let t=new Z(e),{json:n}=t;if(n.lights){let r=t.addExtension(cr);St(!r.lights),r.lights=n.lights,delete n.lights}if(t.json.lights){for(let r of t.json.lights){let s=r.node;t.addObjectExtension(s,cr,r)}delete t.json.lights}}var e1={};Tt(e1,{decode:()=>f8,encode:()=>p8,name:()=>l8});var Pi="KHR_materials_unlit",l8=Pi;async function f8(e){let t=new Z(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,Pi);t.removeExtension(Pi)}function p8(e){let t=new Z(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,Pi,{}),t.addExtension(Pi))}var n1={};Tt(n1,{decode:()=>d8,encode:()=>m8,name:()=>u8});var Oi="KHR_techniques_webgl",u8=Oi;async function d8(e){let t=new Z(e),{json:n}=t,r=t.getExtension(Oi);if(r){let s=g8(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,Oi);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=x8(i.technique,t)),t.removeObjectExtension(i,Oi)}t.removeExtension(Oi)}}async function m8(e,t){}function g8(e,t){let{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),n.forEach(o=>{o.fragmentShader=r[o.fragmentShader],o.vertexShader=r[o.vertexShader]}),s.forEach(o=>{o.program=n[o.program]}),s}function x8(e,t){let n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(r=>{e.uniforms[r].value&&!(r in n)&&(n[r]=e.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=t.getTexture(n[r].index))}),n}var J3=[N0,P0,q0,k0,H0,W0,t1,e1,n1,$0,F0];function j3(e,t={},n){let r=J3.filter(s=>K3(s.name,t));for(let s of r)s.preprocess?.(e,t,n)}async function X3(e,t={},n){let r=J3.filter(s=>K3(s.name,t));for(let s of r)await s.decode?.(e,t,n)}function K3(e,t){let n=t?.gltf?.excludeExtensions||{};return!(e in n&&!n[e])}var r1="KHR_binary_glTF";function Q3(e){let t=new Z(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,r1);s&&Object.assign(r,s),t.removeObjectExtension(r,r1)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(r1)}var Z3={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},A8={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},s1=class{idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}};json;normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),Q3(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_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 n in Z3)this._convertTopLevelObjectToArray(t,n)}_convertTopLevelObjectToArray(t,n){let r=t[n];if(!(!r||Array.isArray(r))){t[n]=[];for(let s in r){let i=r[s];i.id=i.id||s;let o=t[n].length;t[n].push(i),this.idToIndexMap[n][s]=o}}}_convertObjectIdsToArrayIndices(t){for(let n in Z3)this._convertIdsToIndices(t,n);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let n of t.textures)this._convertTextureIds(n);for(let n of t.meshes)this._convertMeshIds(n);for(let n of t.nodes)this._convertNodeIds(n);for(let n of t.scenes)this._convertSceneIds(n)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let n of t.primitives){let{attributes:r,indices:s,material:i}=n;for(let o in r)r[o]=this._convertIdToIndex(r[o],"accessor");s&&(n.indices=this._convertIdToIndex(s,"accessor")),i&&(n.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(n=>this._convertIdToIndex(n,"node"))),t.meshes&&(t.meshes=t.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(t,n){t[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),t[n]=[]);for(let r of t[n])for(let s in r){let i=r[s],o=this._convertIdToIndex(i,s);r[s]=o}}_convertIdToIndex(t,n){let r=A8[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let n of t.materials){n.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let r=n.values?.tex||n.values?.texture2d_0||n.values?.diffuseTex,s=t.textures.findIndex(i=>i.id===r);s!==-1&&(n.pbrMetallicRoughness.baseColorTexture={index:s})}}};function $3(e,t={}){return new s1().normalize(e,t)}async function tE(e,t,n=0,r,s){return y8(e,t,n,r),$3(e,{normalize:r?.gltf?.normalize}),j3(e,r,s),r?.gltf?.loadBuffers&&e.json.buffers&&await E8(e,r,s),r?.gltf?.loadImages&&await T8(e,r,s),await X3(e,r,s),e}function y8(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!T3(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=ol(t);else if(t instanceof ArrayBuffer){let o={};n=_3(o,t,n,r.glb),St(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else St(!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:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function E8(e,t,n){let r=e.json.buffers||[];for(let s=0;s<r.length;++s){let i=r[s];if(i.uri){let{fetch:o}=n;St(o);let c=z0(i.uri,t),h=await(await n?.fetch?.(c))?.arrayBuffer?.();e.buffers[s]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete i.uri}else e.buffers[s]===null&&(e.buffers[s]={arrayBuffer:new ArrayBuffer(i.byteLength),byteOffset:0,byteLength:i.byteLength})}}async function T8(e,t,n){let r=_8(e),s=e.json.images||[],i=[];for(let o of r)i.push(S8(e,s[o],o,t,n));return await Promise.all(i)}function _8(e){let t=new Set,n=e.json.textures||[];for(let r of n)r.source!==void 0&&t.add(r.source);return Array.from(t).sort()}async function S8(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let c=z0(t.uri,r),{fetch:a}=s;i=await(await a(c)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let c=u3(e.json,e.buffers,t.bufferView);i=zn(c.buffer,c.byteOffset,c.byteLength)}St(i,"glTF image has no data");let o=await Qt(i,[ln,ql],{...r,mimeType:t.mimeType,basis:r.basis||{format:Ko()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[n]=o}var ar={dataType:null,batchType:null,name:"glTF",id:"gltf",module:"gltf",version:y3,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:C8,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function C8(e,t={},n){t={...ar.options,...t},t.gltf={...ar.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await tE({},e,r,t,n)}var B8={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},L8={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},oe={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},R8={magFilter:oe.TEXTURE_MAG_FILTER,minFilter:oe.TEXTURE_MIN_FILTER,wrapS:oe.TEXTURE_WRAP_S,wrapT:oe.TEXTURE_WRAP_T},b8={[oe.TEXTURE_MAG_FILTER]:oe.LINEAR,[oe.TEXTURE_MIN_FILTER]:oe.NEAREST_MIPMAP_LINEAR,[oe.TEXTURE_WRAP_S]:oe.REPEAT,[oe.TEXTURE_WRAP_T]:oe.REPEAT};function w8(){return{id:"default-sampler",parameters:b8}}function I8(e){return L8[e]}function P8(e){return B8[e]}var i1=class{baseUri="";jsonUnprocessed;json;buffers=[];images=[];postProcess(t,n={}){let{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return St(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t,n={}){let r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}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,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let c in o)i.attributes[c]=this.getAccessor(o[c]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.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 r}_resolveAccessor(t,n){let r=I8(t.componentType),s=P8(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let c=o.bufferView.buffer,{ArrayType:a,byteLength:h}=fs(o,o.bufferView),l=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+c.byteOffset,f=c.arrayBuffer.slice(l,l+h);o.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(c,l,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new a(f)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let c=0;c<i;c++){let a=n+c*r;o.set(new Uint8Array(t.arrayBuffer.slice(a,a+s)),c*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):w8(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,n){let r={id:t.id||`sampler-${n}`,...t,parameters:{}};for(let s in r){let i=this._enumSamplerParameter(s);i!==void 0&&(r.parameters[i]=r[s])}return r}_enumSamplerParameter(t){return R8[t]}_resolveImage(t,n){let r={...t,id:t.id||`image-${n}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[n];return s&&(r.image=s),r}_resolveBufferView(t,n){let r=t.buffer,s=this.buffers[r].arrayBuffer,i=this.buffers[r].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${n}`,...t,buffer:this.buffers[r],data:new Uint8Array(s,i,t.byteLength)}}_resolveCamera(t,n){let r={...t,id:t.id||`camera-${n}`};return r.perspective,r.orthographic,r}};function vi(e,t){return new i1().postProcess(e,t)}var _a={URI:0,EMBEDDED:1};function Sa(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r?.["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=zn(t,n,s),e.gltfByteOffset=0,e.gltfByteLength=s,n%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function Ca(e,t,n,r){let s=n?.["3d-tiles"]||{};if(O8(e,t,n),s.loadGLTF){if(!r)return;if(e.gltfUrl){let{fetch:i}=r,o=await i(e.gltfUrl,n);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Qt(e.gltfArrayBuffer,ar,n,r);e.gltf=vi(i),e.gpuMemoryUsageInBytes=wi(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function O8(e,t,n){switch(t){case _a.URI:if(e.gltfArrayBuffer){let r=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(r);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case _a.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function eE(e,t,n,r,s){n=v8(e,t,n,r,s),await Ca(e,_a.EMBEDDED,r,s);let i=e?.gltf?.extensions;return i&&i.CESIUM_RTC&&(e.rtcCenter=i.CESIUM_RTC.center),n}function v8(e,t,n,r,s){n=wn(e,t,n),n=as(e,t,n),n=hs(e,t,n,r),n=Sa(e,t,n,r);let i=new Ke(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",U.FLOAT,3),n}async function nE(e,t,n,r,s){return n=N8(e,t,n,r,s),await Ca(e,e.gltfFormat||0,r,s),n}function N8(e,t,n,r,s){if(n=wn(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=as(e,t,n);let i=new DataView(t);if(e.gltfFormat=i.getUint32(n,!0),n+=4,n=hs(e,t,n,r),n=Sa(e,t,n,r),!e?.header?.featureTableJsonByteLength||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let o=new Ke(e.featureTableJson,e.featureTableBinary),c=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=o.getGlobalProperty("RTC_CENTER",U.FLOAT,3);let a=new ir(e.batchTableJson,e.batchTableBinary,c);return F8(e,o,a,c),n}function F8(e,t,n,r){let s=new Array(r),i=new $,o=new $,c=new $,a=new $,h=new sr,l=new bi,f=new $,p={},u=new bn,d=[],g=[],m=[],M=[];for(let E=0;E<r;E++){let A;if(t.hasProperty("POSITION"))A=t.getProperty("POSITION",U.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){A=t.getProperty("POSITION_QUANTIZED",U.UNSIGNED_SHORT,3,E,i);let x=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",U.FLOAT,3);if(!x)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let R=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",U.FLOAT,3);if(!R)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let b=65535;for(let w=0;w<3;w++)A[w]=A[w]/b*R[w]+x[w]}if(!A)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(A),p.translation=i,e.normalUp=t.getProperty("NORMAL_UP",U.FLOAT,3,E,d),e.normalRight=t.getProperty("NORMAL_RIGHT",U.FLOAT,3,E,g);let y=!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",U.UNSIGNED_SHORT,2,E,d),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",U.UNSIGNED_SHORT,2,E,g),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?(z.WGS84.eastNorthUpToFixedFrame(i,u),u.getRotationMatrix3(h)):h.identity()}y&&(a.copy(o).cross(c).normalize(),h.setColumn(0,o),h.setColumn(1,c),h.setColumn(2,a)),l.fromMatrix3(h),p.rotation=l,f.set(1,1,1);let T=t.getProperty("SCALE",U.FLOAT,1,E,m);Number.isFinite(T)&&f.multiplyByScalar(T);let _=t.getProperty("SCALE_NON_UNIFORM",U.FLOAT,3,E,d);_&&f.scale(_),p.scale=f;let L=t.getProperty("BATCH_ID",U.UNSIGNED_SHORT,1,E,M);L===void 0&&(L=E);let C=new bn().fromQuaternion(p.rotation);u.identity(),u.translate(p.translation),u.multiplyRight(C),u.scale(p.scale);let S=u.clone();s[E]={modelMatrix:S,batchId:L}}e.instances=s}async function rE(e,t,n,r,s,i){n=wn(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let c={shape:"tile3d"};e.tiles.push(c),n=await i(t,n,r,s,c)}return n}async function sE(e,t,n,r){if(e.rotateYtoZ=!0,e.gltfUpAxis=n?.["3d-tiles"]?.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n?.["3d-tiles"]?.loadGLTF){if(!r)return t.byteLength;let s=await Qt(t,ar,n,r);e.gltf=vi(s),e.gpuMemoryUsageInBytes=wi(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function o1(e,t=0,n,r,s={shape:"tile3d"}){switch(s.byteOffset=t,s.type=EA(e,t),s.type){case tr.COMPOSITE:return await rE(s,e,t,n,r,o1);case tr.BATCHED_3D_MODEL:return await eE(s,e,t,n,r);case tr.GLTF:return await sE(s,e,n,r);case tr.INSTANCED_3D_MODEL:return await nE(s,e,t,n,r);case tr.POINT_CLOUD:return await f3(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function c1(e,t,n){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 i=iE(e.slice(8,16)),o=new Uint8Array(e,24,i),a=new TextDecoder("utf8").decode(o),h=JSON.parse(a),l=iE(e.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=e.slice(24+i)),await Ba(h,h.tileAvailability,f,n),Array.isArray(h.contentAvailability))for(let p of h.contentAvailability)await Ba(h,p,f,n);else await Ba(h,h.contentAvailability,f,n);return await Ba(h,h.childSubtreeAvailability,f,n),h}async function Ba(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!r?.baseUrl)throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let a=`${r?.baseUrl||""}/${o.uri}`,l=await(await r.fetch(a)).arrayBuffer();t.explicitBitstream=new Uint8Array(l,i.byteOffset,i.byteLength);return}let c=e.buffers.slice(0,i.buffer).reduce((a,h)=>a+h.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(c,c+o.byteLength),i.byteOffset,i.byteLength)}function iE(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var La={dataType:null,batchType:null,id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:kc,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:c1,options:{}};var LE=G(Fr(),1);var _E=G(Fr(),1);var ce=null;try{ce=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 it(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}it.prototype.__isLong__;Object.defineProperty(it.prototype,"__isLong__",{value:!0});function Gt(e){return(e&&e.__isLong__)===!0}function oE(e){var t=Math.clz32(e&-e);return e?31-t:t}it.isLong=Gt;var cE={},aE={};function hr(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=aE[e],r)?r:(n=K(e,0,!0),s&&(aE[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=cE[e],r)?r:(n=K(e,e<0?-1:0,!1),s&&(cE[e]=n),n))}it.fromInt=hr;function ae(e,t){if(isNaN(e))return t?Ze:Me;if(t){if(e<0)return Ze;if(e>=pE)return mE}else{if(e<=-lE)return jt;if(e+1>=lE)return dE}return e<0?ae(-e,t).neg():K(e%Es|0,e/Es|0,t)}it.fromNumber=ae;function K(e,t,n){return new it(e,t,n)}it.fromBits=K;var Ra=Math.pow;function h1(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?Ze:Me;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return h1(e.substring(1),t,n).neg();for(var s=ae(Ra(n,8)),i=Me,o=0;o<e.length;o+=8){var c=Math.min(8,e.length-o),a=parseInt(e.substring(o,o+c),n);if(c<8){var h=ae(Ra(n,c));i=i.mul(h).add(ae(a))}else i=i.mul(s),i=i.add(ae(a))}return i.unsigned=t,i}it.fromString=h1;function Ae(e,t){return typeof e=="number"?ae(e,t):typeof e=="string"?h1(e,t):K(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}it.fromValue=Ae;var hE=1<<16,D8=1<<24,Es=hE*hE,pE=Es*Es,lE=pE/2,fE=hr(D8),Me=hr(0);it.ZERO=Me;var Ze=hr(0,!0);it.UZERO=Ze;var ys=hr(1);it.ONE=ys;var uE=hr(1,!0);it.UONE=uE;var a1=hr(-1);it.NEG_ONE=a1;var dE=K(-1,2147483647,!1);it.MAX_VALUE=dE;var mE=K(-1,-1,!0);it.MAX_UNSIGNED_VALUE=mE;var jt=K(0,-2147483648,!1);it.MIN_VALUE=jt;var I=it.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Es+(this.low>>>0):this.high*Es+(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(jt)){var n=ae(t),r=this.div(n),s=r.mul(n).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=ae(Ra(t,6),this.unsigned),o=this,c="";;){var a=o.div(i),h=o.sub(a.mul(i)).toInt()>>>0,l=h.toString(t);if(o=a,o.isZero())return l+c;for(;l.length<6;)l="0"+l;c=""+l+c}};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(jt)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+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 Gt(t)||(t=Ae(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(Gt(t)||(t=Ae(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?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(jt)?jt:this.not().add(ys)};I.neg=I.negate;I.add=function(t){Gt(t)||(t=Ae(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,c=t.high&65535,a=t.low>>>16,h=t.low&65535,l=0,f=0,p=0,u=0;return u+=i+h,p+=u>>>16,u&=65535,p+=s+a,f+=p>>>16,p&=65535,f+=r+c,l+=f>>>16,f&=65535,l+=n+o,l&=65535,K(p<<16|u,l<<16|f,this.unsigned)};I.subtract=function(t){return Gt(t)||(t=Ae(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(Gt(t)||(t=Ae(t)),ce){var n=ce.mul(this.low,this.high,t.low,t.high);return K(n,ce.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?Ze:Me;if(this.eq(jt))return t.isOdd()?jt:Me;if(t.eq(jt))return this.isOdd()?jt:Me;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(fE)&&t.lt(fE))return ae(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,c=t.high>>>16,a=t.high&65535,h=t.low>>>16,l=t.low&65535,f=0,p=0,u=0,d=0;return d+=o*l,u+=d>>>16,d&=65535,u+=i*l,p+=u>>>16,u&=65535,u+=o*h,p+=u>>>16,u&=65535,p+=s*l,f+=p>>>16,p&=65535,p+=i*h,f+=p>>>16,p&=65535,p+=o*a,f+=p>>>16,p&=65535,f+=r*l+s*h+i*a+o*c,f&=65535,K(u<<16|d,f<<16|p,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(Gt(t)||(t=Ae(t)),t.isZero())throw Error("division by zero");if(ce){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?ce.div_u:ce.div_s)(this.low,this.high,t.low,t.high);return K(n,ce.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Ze:Me;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return Ze;if(t.gt(this.shru(1)))return uE;i=Ze}else{if(this.eq(jt)){if(t.eq(ys)||t.eq(a1))return jt;if(t.eq(jt))return ys;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(Me)?t.isNegative()?ys:a1:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(jt))return this.unsigned?Ze:Me;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();i=Me}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var c=Math.ceil(Math.log(r)/Math.LN2),a=c<=48?1:Ra(2,c-48),h=ae(r),l=h.mul(t);l.isNegative()||l.gt(s);)r-=a,h=ae(r,this.unsigned),l=h.mul(t);h.isZero()&&(h=ys),i=i.add(h),s=s.sub(l)}return i};I.div=I.divide;I.modulo=function(t){if(Gt(t)||(t=Ae(t)),ce){var n=(this.unsigned?ce.rem_u:ce.rem_s)(this.low,this.high,t.low,t.high);return K(n,ce.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?oE(this.low):oE(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return Gt(t)||(t=Ae(t)),K(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return Gt(t)||(t=Ae(t)),K(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return Gt(t)||(t=Ae(t)),K(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return Gt(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 Gt(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 Gt(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 n;return Gt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?K(this.high,this.low,this.unsigned):t<32?(n=32-t,K(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,K(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var n;return Gt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?K(this.high,this.low,this.unsigned):t<32?(n=32-t,K(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,K(this.low<<n|this.high>>>t,this.high<<n|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,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};it.fromBytes=function(t,n,r){return r?it.fromBytesLE(t,n):it.fromBytesBE(t,n)};it.fromBytesLE=function(t,n){return new it(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};it.fromBytesBE=function(t,n){return new it(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var Ts=it;var U8=16;function Ni(e){e==="X"&&(e="");let t=e.padEnd(U8,"0");return Ts.fromString(t,!0,16)}function l1(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),n=t%4;t=(t-n)/4;let r=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-r-i.length).join("0")+i}function f1(e,t){let n=G8(e).shiftRightUnsigned(2);return e.add(Ts.fromNumber(2*t+1-4).multiply(n))}function G8(e){return e.and(e.not().add(1))}var z8=3,V8=30,q8=2*V8+1,gE=180/Math.PI;function ME(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let c=s-1;c>=0;c--){i=s-c;let a=r[c],h=0,l=0;a==="1"?l=1:a==="2"?(h=1,l=1):a==="3"&&(h=1);let f=Math.pow(2,i-1);k8(f,o,h,l),o[0]+=f*h,o[1]+=f*l}if(n%2===1){let c=o[0];o[0]=o[1],o[1]=c}return{face:n,ij:o,level:i}}function AE(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<z8+q8;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Ts.fromString(r,!0,2).toString(10),c="";if(i!==0)for(c=Ts.fromString(s,!0,2).toString(4);c.length<i;)c="0"+c;return`${o}/${c}`}function p1(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function xE(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function u1(e){return[xE(e[0]),xE(e[1])]}function d1(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function m1([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*gE,r*gE]}function k8(e,t,n,r){if(r===0){n===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 yE(e){let t=p1(e.ij,e.level,[.5,.5]),n=u1(t),r=d1(e.face,n);return m1(r)}var H8=100;function g1(e){let{face:t,ij:n,level:r}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(H8*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),c=0,a=0;for(let h=0;h<4;h++){let l=s[h].slice(0),f=s[h+1],p=(f[0]-l[0])/i,u=(f[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=p,l[1]+=u;let g=p1(n,r,l),m=u1(g),M=d1(t,m),E=m1(M);Math.abs(E[1])>89.999&&(E[0]=a);let A=E[0]-a;E[0]+=A>180?-360:A<-180?360:0,o[c++]=E[0],o[c++]=E[1],a=E[0]}}return o[c++]=o[0],o[c++]=o[1],o}function _s(e){let t=Y8(e);return ME(t)}function Y8(e){if(e.indexOf("/")>0)return e;let t=Ni(e);return AE(t)}function x1(e){let t=_s(e);return yE(t)}function TE(e){let t;if(e.face===2||e.face===5){let n=null,r=0;for(let s=0;s<4;s++){let i=`${e.face}/${s}`,o=_s(i),c=g1(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*c.length)),n.set(c,r),r+=c.length}t=EE(n)}else{let n=g1(e);t=EE(n)}return t}function EE(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],n=[];for(let r=0;r<e.length;r+=2)t.push(e[r]),n.push(e[r+1]);return t.sort((r,s)=>r-s),n.sort((r,s)=>r-s),{west:t[0],east:t[t.length-1],north:n[n.length-1],south:n[0]}}function M1(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=_s(e),i=TE(s),o=i.west,c=i.south,a=i.east,h=i.north,l=[];return l.push(new $(o,h,n)),l.push(new $(a,h,n)),l.push(new $(a,c,n)),l.push(new $(o,c,n)),l.push(new $(o,h,r)),l.push(new $(a,h,r)),l.push(new $(a,c,r)),l.push(new $(o,c,r)),l}function ba(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=M1(t,n),s=x1(t),i=s[0],o=s[1],c=z.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),a=new $(c[0],c[1],c[2]);r.push(a);let h=Hf(r);return[...h.center,...h.halfAxes]}var W8=4,J8=8,j8={QUADTREE:W8,OCTREE:J8};function X8(e,t,n){if(e?.box){let r=Ni(e.s2VolumeInfo.token),s=f1(r,t),i=l1(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let h=e.s2VolumeInfo,l=h.maximumHeight-h.minimumHeight,f=l/2,p=h.minimumHeight+l/2;h.minimumHeight=p-f,h.maximumHeight=p+f;break;default:break}return{box:ba(o),s2VolumeInfo:o}}}async function y1(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:c=0,globalData:a={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:h,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:p,subtreesUriTemplate:u,basePath:d}=t,g={children:[],lodMetricValue:0,contentUrl:""};if(!f)return el.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${p} won't be loaded...`),g;let m=c+a.level;if(m>f)return g;let M=j8[h],E=Math.log2(M),A=r&1,y=r>>1&1,T=r>>2&1,_=(M**c-1)/(M-1),L=lr(n.mortonIndex,r,E),C=_+L,S=lr(n.x,A,1),x=lr(n.y,y,1),R=lr(n.z,T,1),b=!1;c>=l&&(b=A1(o.childSubtreeAvailability,L));let w=lr(a.x,S,c),B=lr(a.y,x,c),v=lr(a.z,R,c);if(b){let et=`${d}/${u}`,ot=wa(et,m,w,B,v);o=await(0,_E.load)(ot,La,i),a={mortonIndex:L,x:S,y:x,z:R,level:c},L=0,C=0,S=0,x=0,R=0,c=0}if(!A1(o.tileAvailability,C))return g;A1(o.contentAvailability,C)&&(g.contentUrl=wa(p,m,w,B,v));let tt=c+1,Y={mortonIndex:L,x:S,y:x,z:R};for(let et=0;et<M;et++){let ot=X8(s,et,h),kt=await y1({subtree:o,implicitOptions:t,loaderOptions:i,parentData:Y,childIndex:et,level:tt,globalData:{...a},s2VolumeBox:ot});if(kt.contentUrl||kt.children.length){let RT=m+1,bT=K8(kt,RT,{childTileX:S,childTileY:x,childTileZ:R},t,s);g.children.push(bT)}}return g}function A1(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&el.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?$8(t,n.explicitBitstream):!1}function K8(e,t,n,r,s){let{basePath:i,refine:o,getRefine:c,lodMetricType:a,getTileType:h,rootLodMetricValue:l,rootBoundingVolume:f}=r,p=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),u=l/2**t,d=s?.box?{box:s.box}:f,g=Q8(t,d,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:p},id:e.contentUrl,refine:c(o),type:h(e),lodMetricType:a,lodMetricValue:u,geometricError:u,transform:e.transform,boundingVolume:g}}function Q8(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,c,a,h,l,f]=t.region,p=2**e,u=(a-o)/p,d=(h-c)/p,g=(f-l)/p,[m,M]=[o+u*r,o+u*(r+1)],[E,A]=[c+d*s,c+d*(s+1)],[y,T]=[l+g*i,l+g*(i+1)];return{region:[m,E,M,A,y,T]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${JSON.stringify(t)}`)}function lr(e,t,n){return(e<<n)+t}function wa(e,t,n,r,s){let i=Z8({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function Z8(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function $8(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function T1(e,t=""){if(!t)return ie.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return ie.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ie.SCENEGRAPH;default:return r||ie.EMPTY}}function _1(e){switch(e){case"REPLACE":case"replace":return vt.REPLACE;case"ADD":case"add":return vt.ADD;default:return e}}function E1(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let r=new URL(e,`${t}/`);return decodeURI(r.toString())}else if(e.startsWith("/"))return e;return hn.resolve(t,e)}function SE(e,t){if(!e)return null;let n;if(e.content){let s=e.content.uri||e.content?.url;typeof s<"u"&&(n=E1(s,t))}return{...e,id:n,contentUrl:n,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:T1(e,n),refine:_1(e.refine)}}async function RE(e,t,n){let r=null,s=BE(e.root);s&&e.root?r=await CE(e.root,e,t,s,n):r=SE(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},c=o.children||[],a=[];for(let h of c){let l=BE(h),f;l?f=await CE(h,e,t,l,n):f=SE(h,t),f&&(a.push(f),i.push(f))}o.children=a}return r}async function CE(e,t,n,r,s){let{subdivisionScheme:i,maximumLevel:o,availableLevels:c,subtreeLevels:a,subtrees:{uri:h}}=r,l=wa(h,0,0,0,0),f=E1(l,n),p=await(0,LE.load)(f,La,s),u=e.content?.uri,d=u?E1(u,n):"",g=t?.root?.refine,m=e.geometricError,M=e.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];if(M){let T={box:ba(M),s2VolumeInfo:M};e.boundingVolume=T}let E=e.boundingVolume,A={contentUrlTemplate:d,subtreesUriTemplate:h,subdivisionScheme:i,subtreeLevels:a,maximumLevel:Number.isFinite(c)?c-1:o,refine:g,basePath:n,lodMetricType:je.GEOMETRIC_ERROR,rootLodMetricValue:m,rootBoundingVolume:E,getTileType:T1,getRefine:_1};return await tD(e,n,p,A,s)}async function tD(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await y1({subtree:n,implicitOptions:r,loaderOptions:s}),c,a=null;return o&&(c=o,a={uri:o.replace(`${t}/`,"")}),{...e,id:c,contentUrl:c,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:T1(e,c),refine:_1(e.refine),content:a||e.content,children:i}}function BE(e){return e?.extensions?.["3DTILES_implicit_tiling"]||e?.implicitTiling}var Ia={dataType:null,batchType:null,id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:kc,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:eD,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function eD(e,t={},n){let r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?nD(e,t,n):rD(e,t,n)}async function nD(e,t,n){let r=JSON.parse(new TextDecoder().decode(e)),s=n?.url||"",i=sD(s),o=await RE(r,i,t||{});return{...r,shape:"tileset3d",loader:Ia,url:s,queryString:n?.queryString||"",basePath:i,root:o||r.root,type:Lt.TILES3D,lodMetricType:je.GEOMETRIC_ERROR,lodMetricValue:r.root?.geometricError||0}}async function rD(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await o1(e,0,t,n,r.content),r.content}function sD(e){return hn.dirname(e)}var bE=[0],iD={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Ia,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,n)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},Fi=class extends Pn.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&Pn.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:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let h=await s.preload(t,n);h.url&&(o=h.url),h.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:h.headers}),Object.assign(i,h)}let c=await(0,OE.load)(o,s,i.loadOptions),a=new Ci(c,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:a,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(a)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case ie.POINTCLOUD:return this._makePointCloudLayer(t,n);case ie.SCENEGRAPH:return this._make3DModelLayer(t);case ie.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:c}=t.content,{positions:a,normals:h,colors:l}=r;if(!a)return null;let f=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:a,NORMAL:h,COLOR_0:l}},{pointSize:p,getPointColor:u}=this.props,d=this.getSubLayerClass("pointcloud",IE.PointCloudLayer);return new d({pointSize:p},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:f,coordinateSystem:Pn.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:c,getColor:i||u,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",PE.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||bE,scenegraph:n,coordinateSystem:Pn.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:c=>c.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:c,coordinateSystem:a=Pn.COORDINATE_SYSTEM.METER_OFFSETS,material:h,featureIds:l}=r,{_getMeshColor:f}=this.props,p=n&&n.props.mesh||new wE.Geometry({topology:"triangle-list",attributes:oD(s),indices:i}),u=this.getSubLayerClass("mesh",Qg);return new u(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:p,data:bE,getColor:f(t),pbrMaterial:h,modelMatrix:o,coordinateOrigin:c,coordinateSystem:a,featureIds:l,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}};Fi.defaultProps=iD;Fi.layerName="Tile3DLayer";var vE=Fi;function oD(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 Fa=G(le(),1),R1=G(Jo(),1),VE=G(le(),1);var cD=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 S1(e){return e>>1^-(e&1)}function aD(e){let t=0,n={};for(let[r,s]of cD){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function hD(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,c=s*o,a=n,h=a+c,l=h+c,f=0,p=0,u=0;for(let d=0;d<s;d++)f+=S1(e.getUint16(a+o*d,!0)),p+=S1(e.getUint16(h+o*d,!0)),u+=S1(e.getUint16(l+o*d,!0)),i[d]=f,i[d+s]=p,i[d+s*2]=u;return n+=c*3,{vertexData:i,vertexDataEndPosition:n}}function Di(e,t,n,r,s=!0){let i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let c=0;c<i.length;++c){let a=i[c];i[c]=o-a,a===0&&++o}return i}function lD(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=c*3,h=Di(e.buffer,r,a,o);return r+=a*o,{triangleIndicesEndPosition:r,triangleIndices:h}}function fD(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,c=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let a=Di(e.buffer,r,c,o,!1);r+=c*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let l=Di(e.buffer,r,h,o,!1);r+=h*o;let f=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let p=Di(e.buffer,r,f,o,!1);r+=f*o;let u=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let d=Di(e.buffer,r,u,o,!1);return r+=u*o,{edgeIndicesEndPosition:r,westIndices:a,southIndices:l,eastIndices:p,northIndices:d}}function pD(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function uD(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function dD(e,t){let n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(e.buffer,r,i);switch(s){case 1:{n.vertexNormals=pD(o);break}case 2:{n.waterMask=uD(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var fr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},mD={maxDecodingStep:fr.extensions};function C1(e,t){let n=Object.assign({},mD,t),r=new DataView(e),{header:s,headerEndPosition:i}=aD(r);if(n.maxDecodingStep<fr.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:c}=hD(r,i);if(n.maxDecodingStep<fr.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:a,triangleIndicesEndPosition:h}=lD(r,o,c);if(n.maxDecodingStep<fr.edgeIndices)return{header:s,vertexData:o,triangleIndices:a};let{westIndices:l,southIndices:f,eastIndices:p,northIndices:u,edgeIndicesEndPosition:d}=fD(r,o,h);if(n.maxDecodingStep<fr.extensions)return{header:s,vertexData:o,triangleIndices:a,westIndices:l,northIndices:u,eastIndices:p,southIndices:f};let{extensions:g}=dD(r,d);return{header:s,vertexData:o,triangleIndices:a,westIndices:l,northIndices:u,eastIndices:p,southIndices:f,extensions:g}}function Pa(e,t,n,r){let s=r?xD(r,e.POSITION.value):gD(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),c=new t.constructor(s.length*6);for(let h=0;h<s.length;h++){let l=s[h];MD({edge:l,edgeIndex:h,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:c})}e.POSITION.value=Ys(e.POSITION.value,i),e.TEXCOORD_0.value=Ys(e.TEXCOORD_0.value,o);let a=t instanceof Array?t.concat(c):Ys(t,c);return{attributes:e,triangles:a}}function gD(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,i)=>Math.min(...s)-Math.min(...i)||Math.max(...s)-Math.max(...i));let n=[],r=0;for(;r<t.length;)t[r][0]===t[r+1]?.[1]&&t[r][1]===t[r+1]?.[0]?r+=2:(n.push(t[r]),r++);return n}function xD(e,t){e.westIndices.sort((r,s)=>t[3*r+1]-t[3*s+1]),e.eastIndices.sort((r,s)=>t[3*s+1]-t[3*r+1]),e.southIndices.sort((r,s)=>t[3*s]-t[3*r]),e.northIndices.sort((r,s)=>t[3*r]-t[3*s]);let n=[];for(let r in e){let s=e[r];for(let i=0;i<s.length-1;i++)n.push([s[i],s[i+1]])}return n}function MD({edge:e,edgeIndex:t,attributes:n,skirtHeight:r,newPosition:s,newTexcoord0:i,newTriangles:o}){let c=n.POSITION.value.length,a=t*2,h=t*2+1;s.set(n.POSITION.value.subarray(e[0]*3,e[0]*3+3),a*3),s[a*3+2]=s[a*3+2]-r,s.set(n.POSITION.value.subarray(e[1]*3,e[1]*3+3),h*3),s[h*3+2]=s[h*3+2]-r,i.set(n.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),a*2),i.set(n.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),h*2);let l=t*2*3;o[l]=e[0],o[l+1]=c/3+h,o[l+2]=e[1],o[l+3]=c/3+h,o[l+4]=e[0],o[l+5]=c/3+a}function B1(e,t={}){let{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:c,eastIndices:a,southIndices:h}=C1(e,fr.triangleIndices),l=i,f=AD(s,r,n),p=er(f);if(t?.skirtHeight){let{attributes:u,triangles:d}=Pa(f,l,t.skirtHeight,{westIndices:o,northIndices:c,eastIndices:a,southIndices:h});f=u,l=d}return{loaderData:{header:{}},header:{vertexCount:l.length,boundingBox:p},schema:void 0,topology:"triangle-list",mode:4,indices:{value:l,size:1},attributes:f}}function AD(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,c,a]=n||[0,0,1,1],h=c-i,l=a-o,f=s-r,p=e.length/3,u=new Float32Array(p*3),d=new Float32Array(p*2);for(let g=0;g<p;g++){let m=e[g]/32767,M=e[g+p]/32767,E=e[g+p*2]/32767;u[3*g+0]=m*h+i,u[3*g+1]=M*l+o,u[3*g+2]=E*f+r,d[2*g+0]=m,d[2*g+1]=M}return{POSITION:{value:u,size:3},TEXCOORD_0:{value:d,size:2}}}var Ui=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,c=0,a=0,h=0,l=0;for(s&1?c=a=h=n:i=o=l=n;(s>>=1)>1;){let p=i+c>>1,u=o+a>>1;s&1?(c=i,a=o,i=h,o=l):(i=c,o=a,c=h,a=l),h=p,l=u}let f=r*4;this.coords[f+0]=i,this.coords[f+1]=o,this.coords[f+2]=c,this.coords[f+3]=a}}createTile(t){return new L1(t,this)}},L1=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let c=t-1;c>=0;c--){let a=c*4,h=r[a+0],l=r[a+1],f=r[a+2],p=r[a+3],u=h+f>>1,d=l+p>>1,g=u+d-l,m=d+h-u,M=(i[l*s+h]+i[p*s+f])/2,E=d*s+u,A=Math.abs(M-i[E]);if(o[E]=Math.max(o[E],A),c<n){let y=(l+m>>1)*s+(h+g>>1),T=(p+m>>1)*s+(f+g>>1);o[E]=Math.max(o[E],o[y],o[T])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,c=n-1;r.fill(0);function a(u,d,g,m,M,E){let A=u+g>>1,y=d+m>>1;Math.abs(u-M)+Math.abs(d-E)>1&&s[y*n+A]>t?(a(M,E,u,d,A,y),a(g,m,M,E,A,y)):(r[d*n+u]=r[d*n+u]||++i,r[m*n+g]=r[m*n+g]||++i,r[E*n+M]=r[E*n+M]||++i,o++)}a(0,0,c,c,c,0),a(c,c,0,0,0,c);let h=new Uint16Array(i*2),l=new Uint32Array(o*3),f=0;function p(u,d,g,m,M,E){let A=u+g>>1,y=d+m>>1;if(Math.abs(u-M)+Math.abs(d-E)>1&&s[y*n+A]>t)p(M,E,u,d,A,y),p(g,m,M,E,A,y);else{let T=r[d*n+u]-1,_=r[m*n+g]-1,L=r[E*n+M]-1;h[2*T]=u,h[2*T+1]=d,h[2*_]=g,h[2*_+1]=m,h[2*L]=M,h[2*L+1]=E,l[f++]=T,l[f++]=_,l[f++]=L}}return p(0,0,c,c,c,0),p(c,c,0,0,0,c),{vertices:h,triangles:l}}};var Gi=class{constructor(t,n,r=n){this.data=t,this.width=n,this.height=r,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=n-1,i=r-1,o=this._addPoint(0,0),c=this._addPoint(s,0),a=this._addPoint(0,i),h=this._addPoint(s,i),l=this._addTriangle(h,o,a,-1,-1,-1);this._addTriangle(o,h,c,l,-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,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,c){let a=Math.min(t,r,i),h=Math.min(n,s,o),l=Math.max(t,r,i),f=Math.max(n,s,o),p=pr(r,s,i,o,a,h),u=pr(i,o,t,n,a,h),d=pr(t,n,r,s,a,h),g=s-n,m=t-r,M=o-s,E=r-i,A=n-o,y=i-t,T=pr(t,n,r,s,i,o),_=this.heightAt(t,n)/T,L=this.heightAt(r,s)/T,C=this.heightAt(i,o)/T,S=0,x=0,R=0,b=0;for(let w=h;w<=f;w++){let B=0;p<0&&M!==0&&(B=Math.max(B,Math.floor(-p/M))),u<0&&A!==0&&(B=Math.max(B,Math.floor(-u/A))),d<0&&g!==0&&(B=Math.max(B,Math.floor(-d/g)));let v=p+M*B,H=u+A*B,V=d+g*B,tt=!1;for(let Y=a+B;Y<=l;Y++){if(v>=0&&H>=0&&V>=0){tt=!0;let et=_*v+L*H+C*V,ot=Math.abs(et-this.heightAt(Y,w));b+=ot*ot,ot>S&&(S=ot,x=Y,R=w)}else if(tt)break;v+=M,H+=A,V+=g}p+=E,u+=y,d+=m}(x===t&&R===n||x===r&&R===s||x===i&&R===o)&&(S=0),this._candidates[2*c]=x,this._candidates[2*c+1]=R,this._rms[c]=b,this._queuePush(c,S,b)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],c=this.triangles[s],a=this.coords[2*i],h=this.coords[2*i+1],l=this.coords[2*o],f=this.coords[2*o+1],p=this.coords[2*c],u=this.coords[2*c+1],d=this._candidates[2*t],g=this._candidates[2*t+1],m=this._addPoint(d,g);if(pr(a,h,l,f,d,g)===0)this._handleCollinear(m,n);else if(pr(l,f,p,u,d,g)===0)this._handleCollinear(m,r);else if(pr(p,u,a,h,d,g)===0)this._handleCollinear(m,s);else{let M=this._halfedges[n],E=this._halfedges[r],A=this._halfedges[s],y=this._addTriangle(i,o,m,M,-1,-1,n),T=this._addTriangle(o,c,m,E,-1,y+1),_=this._addTriangle(c,i,m,A,y+2,T+1);this._legalize(y),this._legalize(T),this._legalize(_)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o,c=this.triangles.length){let a=c/3;return this.triangles[c+0]=t,this.triangles[c+1]=n,this.triangles[c+2]=r,this._halfedges[c+0]=s,this._halfedges[c+1]=i,this._halfedges[c+2]=o,s>=0&&(this._halfedges[s]=c+0),i>=0&&(this._halfedges[i]=c+1),o>=0&&(this._halfedges[o]=c+2),this._candidates[2*a+0]=0,this._candidates[2*a+1]=0,this._queueIndices[a]=-1,this._rms[a]=0,this._pending[this._pendingLen++]=a,c}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,c=s+(n+2)%3,a=s+(n+1)%3,h=this.triangles[o],l=this.triangles[t],f=this.triangles[i],p=this.triangles[c],u=this.coords;if(!yD(u[2*h],u[2*h+1],u[2*l],u[2*l+1],u[2*f],u[2*f+1],u[2*p],u[2*p+1]))return;let d=this._halfedges[i],g=this._halfedges[o],m=this._halfedges[c],M=this._halfedges[a];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(h,p,f,-1,m,d,r),A=this._addTriangle(p,h,l,E,g,M,s);this._legalize(E+1),this._legalize(A+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],c=this.triangles[n],a=this.triangles[s],h=this._halfedges[s],l=this._halfedges[i],f=this._halfedges[n];if(f<0){let _=this._addTriangle(t,o,c,-1,l,-1,r),L=this._addTriangle(o,t,a,_,-1,h);this._legalize(_+1),this._legalize(L+2);return}let p=f-f%3,u=p+(f+2)%3,d=p+(f+1)%3,g=this.triangles[u],m=this._halfedges[u],M=this._halfedges[d];this._queueRemove(p/3);let E=this._addTriangle(o,c,t,l,-1,-1,r),A=this._addTriangle(c,g,t,M,-1,E+1,p),y=this._addTriangle(g,a,t,m,-1,A+1),T=this._addTriangle(a,o,t,h,E+2,y+1);this._legalize(E),this._legalize(A),this._legalize(y),this._legalize(T)}_queuePush(t,n,r){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(n),this._rmsSum+=r,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 n=this._queueIndices[t];if(n<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 r=this._queue.length-1;r!==n&&(this._queueSwap(n,r),this._queueDown(n,r)||this._queueUp(n)),this._queuePopBack()}_queueLess(t,n){return this._errors[t]>this._errors[n]}_queueSwap(t,n){let r=this._queue[t],s=this._queue[n];this._queue[t]=s,this._queue[n]=r,this._queueIndices[r]=n,this._queueIndices[s]=t;let i=this._errors[t];this._errors[t]=this._errors[n],this._errors[n]=i}_queueUp(t){let n=t;for(;;){let r=n-1>>1;if(r===n||!this._queueLess(n,r))break;this._queueSwap(r,n),n=r}}_queueDown(t,n){let r=t;for(;;){let s=2*r+1;if(s>=n||s<0)break;let i=s+1,o=s;if(i<n&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>t}};function pr(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function yD(e,t,n,r,s,i,o,c){let a=e-o,h=t-c,l=n-o,f=r-c,p=s-o,u=i-c,d=a*a+h*h,g=l*l+f*f,m=p*p+u*u;return a*(f*m-g*u)-h*(l*m-g*p)+d*(l*u-f*p)<0}function DE(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:c}=e,a,h;switch(t.tesselator){case"martini":a=Oa(i,o,c,s,t.tesselator),h=NE(n,o,a);break;case"delatin":a=Oa(i,o,c,s,t.tesselator),h=FE(n,o,c,a);break;default:o===c&&!(c&o-1)?(a=Oa(i,o,c,s,"martini"),h=NE(n,o,a)):(a=Oa(i,o,c,s,"delatin"),h=FE(n,o,c,a));break}let{vertices:l}=h,{triangles:f}=h,p=ED(l,a,o,c,r),u=er(p);if(t.skirtHeight){let{attributes:d,triangles:g}=Pa(p,f,t.skirtHeight);p=d,f=g}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:u},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:p}}function NE(e,t,n){let r=t+1,i=new Ui(r).createTile(n),{vertices:o,triangles:c}=i.getMesh(e);return{vertices:o,triangles:c}}function FE(e,t,n,r){let s=new Gi(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function Oa(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:c,offset:a}=r,h=new Float32Array((t+1)*(n+1));for(let l=0,f=0;f<n;f++)for(let p=0;p<t;p++,l++){let u=l*4,d=e[u+0],g=e[u+1],m=e[u+2];h[l+f]=d*i+g*c+m*o+a}if(s==="martini"){for(let l=(t+1)*t,f=0;f<t;f++,l++)h[l]=h[l-t-1];for(let l=n,f=0;f<n+1;f++,l+=n+1)h[l]=h[l-1]}return h}function ED(e,t,n,r,s){let i=n+1,o=e.length/2,c=new Float32Array(o*3),a=new Float32Array(o*2),[h,l,f,p]=s||[0,0,n,r],u=(f-h)/n,d=(p-l)/r;for(let g=0;g<o;g++){let m=e[g*2],M=e[g*2+1],E=M*i+m;c[3*g+0]=m*u+h,c[3*g+1]=-M*d+p,c[3*g+2]=t[E],a[2*g+0]=m/n,a[2*g+1]=M/r}return{POSITION:{value:c,size:3},TEXCOORD_0:{value:a,size:2}}}var va="4.2.1";var Na={dataType:null,batchType:null,name:"Terrain",id:"terrain",module:"terrain",version:va,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 UE={dataType:null,batchType:null,name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:va,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var TD={...Na,parse:_D};async function _D(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Qt(e,[],r,n),i={...TD.options.terrain,...t?.terrain};return DE(s,i)}var Iot={...UE,parseSync:(e,t)=>B1(e,t?.["quantized-mesh"]),parse:async(e,t)=>B1(e,t?.["quantized-mesh"])};var GE=[1],SD={...Xn.defaultProps,elevationData:mn,texture:{...mn,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:[Na]};function zE(e){return Array.isArray(e)?e.join(";"):e||""}var zi=class extends Fa.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||CD(i));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&Fa.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:c}=this.props;return c(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:c}=this.context,a=we(n,t),h=s&&we(s,t),{signal:l}=t,f=[0,0],p=[0,0];if(c.isGeospatial){let m=t.bbox;f=c.projectFlat([m.west,m.south]),p=c.projectFlat([m.east,m.north])}else{let m=t.bbox;f=[m.left,m.bottom],p=[m.right,m.top]}let u=[f[0],f[1],p[0],p[1]],d=this.loadTerrain({elevationData:a,bounds:u,elevationDecoder:i,meshMaxError:o,signal:l}),g=h?r(h,{propName:"texture",layer:this,loaders:[],signal:l}).catch(m=>null):Promise.resolve(null);return Promise.all([d,g])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",R1.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[c,a]=o;return new n(t,{data:GE,mesh:c,texture:a,_instanced:!1,coordinateSystem:VE.COORDINATE_SYSTEM.CARTESIAN,getPosition:h=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(a=>a[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:c,tileSize:a,maxZoom:h,minZoom:l,extent:f,maxRequests:p,onTileLoad:u,onTileUnload:d,onTileError:g,maxCacheSize:m,maxCacheByteSize:M,refinementStrategy:E}=this.props;if(this.state.isTiled)return new Xn(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:zE(r),texture:zE(s),meshMaxError:o,elevationDecoder:c}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:a,maxZoom:h,minZoom:l,extent:f,maxRequests:p,onTileLoad:u,onTileUnload:d,onTileError:g,maxCacheSize:m,maxCacheByteSize:M,refinementStrategy:E});if(!r)return null;let A=this.getSubLayerClass("mesh",R1.SimpleMeshLayer);return new A(this.getSubLayerProps({id:"mesh"}),{data:GE,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:y=>[0,0,0],getColor:t,material:n,wireframe:i})}};zi.defaultProps=SD;zi.layerName="TerrainLayer";var qE=zi,CD=e=>e.includes("{x}")&&(e.includes("{y}")||e.includes("{-y}"));var Za=G(le(),1),J1=G(he(),1),TT=G(HE(),1);var Vi={x:0,y:1,z:2};function ur(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,c=Vi[s[0]],a=Vi[s[1]];for(let h=n,l=r-i;h<r;h+=i)o+=(e[h+c]-e[l+c])*(e[h+a]+e[l+a]),l=h;return o/2}function w1(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,c=WE(e,0,o,n,!0,r&&r[0],s),a=[];if(!c||c.next===c.prev)return a;let h,l,f,p,u,d,g;if(i&&(c=PD(e,t,c,n,r,s)),e.length>80*n){p=l=e[0],u=f=e[1];for(let m=n;m<o;m+=n)d=e[m],g=e[m+1],d<p&&(p=d),g<u&&(u=g),d>l&&(l=d),g>f&&(f=g);h=Math.max(l-p,f-u),h=h!==0?32767/h:0}return qi(c,a,n,p,u,h,0),a}function WE(e,t,n,r,s,i,o){let c,a;i===void 0&&(i=ur(e,{start:t,end:n,size:r,plane:o}));let h=Vi[o[0]],l=Vi[o[1]];if(s===i<0)for(c=t;c<n;c+=r)a=YE(c,e[c+h],e[c+l],a);else for(c=n-r;c>=t;c-=r)a=YE(c,e[c+h],e[c+l],a);return a&&Ga(a,a.next)&&(Hi(a),a=a.next),a}function dr(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Ga(n,n.next)||pt(n.prev,n,n.next)===0)){if(Hi(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function qi(e,t,n,r,s,i,o){if(!e)return;!o&&i&&DD(e,r,s,i);let c=e,a,h;for(;e.prev!==e.next;){if(a=e.prev,h=e.next,i?bD(e,r,s,i):RD(e)){t.push(a.i/n|0),t.push(e.i/n|0),t.push(h.i/n|0),Hi(e),e=h.next,c=h.next;continue}if(e=h,e===c){o?o===1?(e=wD(dr(e),t,n),qi(e,t,n,r,s,i,2)):o===2&&ID(e,t,n,r,s,i):qi(dr(e),t,n,r,s,i,1);break}}}function RD(e){let t=e.prev,n=e,r=e.next;if(pt(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,c=t.y,a=n.y,h=r.y,l=s<i?s<o?s:o:i<o?i:o,f=c<a?c<h?c:h:a<h?a:h,p=s>i?s>o?s:o:i>o?i:o,u=c>a?c>h?c:h:a>h?a:h,d=r.next;for(;d!==t;){if(d.x>=l&&d.x<=p&&d.y>=f&&d.y<=u&&Ss(s,c,i,a,o,h,d.x,d.y)&&pt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function bD(e,t,n,r){let s=e.prev,i=e,o=e.next;if(pt(s,i,o)>=0)return!1;let c=s.x,a=i.x,h=o.x,l=s.y,f=i.y,p=o.y,u=c<a?c<h?c:h:a<h?a:h,d=l<f?l<p?l:p:f<p?f:p,g=c>a?c>h?c:h:a>h?a:h,m=l>f?l>p?l:p:f>p?f:p,M=b1(u,d,t,n,r),E=b1(g,m,t,n,r),A=e.prevZ,y=e.nextZ;for(;A&&A.z>=M&&y&&y.z<=E;){if(A.x>=u&&A.x<=g&&A.y>=d&&A.y<=m&&A!==s&&A!==o&&Ss(c,l,a,f,h,p,A.x,A.y)&&pt(A.prev,A,A.next)>=0||(A=A.prevZ,y.x>=u&&y.x<=g&&y.y>=d&&y.y<=m&&y!==s&&y!==o&&Ss(c,l,a,f,h,p,y.x,y.y)&&pt(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;A&&A.z>=M;){if(A.x>=u&&A.x<=g&&A.y>=d&&A.y<=m&&A!==s&&A!==o&&Ss(c,l,a,f,h,p,A.x,A.y)&&pt(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;y&&y.z<=E;){if(y.x>=u&&y.x<=g&&y.y>=d&&y.y<=m&&y!==s&&y!==o&&Ss(c,l,a,f,h,p,y.x,y.y)&&pt(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function wD(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!Ga(s,i)&&JE(s,r,r.next,i)&&ki(s,i)&&ki(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),Hi(r),Hi(r.next),r=e=i),r=r.next}while(r!==e);return dr(r)}function ID(e,t,n,r,s,i){let o=e;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&zD(o,c)){let a=jE(o,c);o=dr(o,o.next),a=dr(a,a.next),qi(o,t,n,r,s,i,0),qi(a,t,n,r,s,i,0);return}c=c.next}o=o.next}while(o!==e)}function PD(e,t,n,r,s,i){let o=[],c,a,h,l,f;for(c=0,a=t.length;c<a;c++)h=t[c]*r,l=c<a-1?t[c+1]*r:e.length,f=WE(e,h,l,r,!1,s&&s[c+1],i),f===f.next&&(f.steiner=!0),o.push(GD(f));for(o.sort(OD),c=0;c<o.length;c++)n=vD(o[c],n);return n}function OD(e,t){return e.x-t.x}function vD(e,t){let n=ND(e,t);if(!n)return t;let r=jE(n,e);return dr(r,r.next),dr(n,n.next)}function ND(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let p=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=r&&p>i&&(i=p,o=n.x<n.next.x?n:n.next,p===r))return o}n=n.next}while(n!==t);if(!o)return null;let c=o,a=o.x,h=o.y,l=1/0,f;n=o;do r>=n.x&&n.x>=a&&r!==n.x&&Ss(s<h?r:i,s,a,h,s<h?i:r,s,n.x,n.y)&&(f=Math.abs(s-n.y)/(r-n.x),ki(n,e)&&(f<l||f===l&&(n.x>o.x||n.x===o.x&&FD(o,n)))&&(o=n,l=f)),n=n.next;while(n!==c);return o}function FD(e,t){return pt(e.prev,e,t.prev)<0&&pt(t.next,e,e.next)<0}function DD(e,t,n,r){let s=e;do s.z===0&&(s.z=b1(s.x,s.y,t,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,UD(s)}function UD(e){let t,n,r=1,s,i,o,c,a,h;do{for(i=e,e=null,h=null,s=0;i;){for(s++,c=i,o=0,n=0;n<r&&(o++,c=c.nextZ,!!c);n++);for(a=r;o>0||a>0&&c;)o!==0&&(a===0||!c||i.z<=c.z)?(t=i,i=i.nextZ,o--):(t=c,c=c.nextZ,a--),h?h.nextZ=t:e=t,t.prevZ=h,h=t;i=c}h.nextZ=null,r*=2}while(s>1);return e}function b1(e,t,n,r,s){return e=(e-n)*s|0,t=(t-r)*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 GD(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Ss(e,t,n,r,s,i,o,c){return(s-o)*(t-c)>=(e-o)*(i-c)&&(e-o)*(r-c)>=(n-o)*(t-c)&&(n-o)*(i-c)>=(s-o)*(r-c)}function zD(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!VD(e,t)&&(ki(e,t)&&ki(t,e)&&qD(e,t)&&(pt(e.prev,e,t.prev)||pt(e,t.prev,t))||Ga(e,t)&&pt(e.prev,e,e.next)>0&&pt(t.prev,t,t.next)>0)}function pt(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ga(e,t){return e.x===t.x&&e.y===t.y}function JE(e,t,n,r){let s=Ua(pt(e,t,n)),i=Ua(pt(e,t,r)),o=Ua(pt(n,r,e)),c=Ua(pt(n,r,t));return!!(s!==i&&o!==c||s===0&&Da(e,n,t)||i===0&&Da(e,r,t)||o===0&&Da(n,e,r)||c===0&&Da(n,t,r))}function Da(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ua(e){return e>0?1:e<0?-1:0}function VD(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&JE(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ki(e,t){return pt(e.prev,e,e.next)<0?pt(e,t,e.next)>=0&&pt(e,e.prev,t)>=0:pt(e,t,e.prev)<0||pt(e,e.next,t)<0}function qD(e,t){let n=e,r=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function jE(e,t){let n=new Yi(e.i,e.x,e.y),r=new Yi(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function YE(e,t,n,r){let s=new Yi(e,t,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Hi(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 Yi=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function O1(e,t,n){let r=JD(e),s=Object.keys(r).filter(i=>r[i]!==Array);return jD(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function JD(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=t6(s,t[r])}return t}function jD(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:c,polygonPositionsCount:a,polygonObjectsCount:h,polygonRingsCount:l,polygonFeaturesCount:f,propArrayTypes:p,coordLength:u}=t,{numericPropKeys:d=[],PositionDataType:g=Float32Array,triangulate:m=!0}=n,M=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,A={type:"Point",positions:new g(r*u),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},y={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new g(i*u),globalFeatureIds:new E(i),featureIds:c>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},T={type:"Polygon",polygonIndices:a>65535?new Uint32Array(h+1):new Uint16Array(h+1),primitivePolygonIndices:a>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new g(a*u),globalFeatureIds:new E(a),featureIds:f>65535?new Uint32Array(a):new Uint16Array(a),numericProps:{},properties:[],fields:[]};m&&(T.triangles=[]);for(let L of[A,y,T])for(let C of d){let S=p[C];L.numericProps[C]=new S(L.positions.length/u)}y.pathIndices[o]=i,T.polygonIndices[h]=a,T.primitivePolygonIndices[l]=a;let _={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 C=L.geometry,S=L.properties||{};switch(C.type){case"Point":XD(C,A,_,u,S),A.properties.push(P1(S,d)),M&&A.fields.push({id:L.id}),_.pointFeature++;break;case"LineString":KD(C,y,_,u,S),y.properties.push(P1(S,d)),M&&y.fields.push({id:L.id}),_.lineFeature++;break;case"Polygon":QD(C,T,_,u,S),T.properties.push(P1(S,d)),M&&T.fields.push({id:L.id}),_.polygonFeature++;break;default:throw new Error("Invalid geometry type")}_.feature++}return $D(A,y,T,u)}function XD(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;v1(t,s,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function KD(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;v1(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,c=e.indices.length;o<c;++o){let a=e.indices[o],h=o===c-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(h-a)/r}}function QD(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;v1(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,c=e.indices.length;o<c;++o){let a=n.polygonPosition;t.polygonIndices[n.polygonObject++]=a;let h=e.areas[o],l=e.indices[o],f=e.indices[o+1];for(let u=0,d=l.length;u<d;++u){let g=l[u],m=u===d-1?f===void 0?e.data.length:f[0]:l[u+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(m-g)/r}let p=n.polygonPosition;ZD(t,h,l,{startPosition:a,endPosition:p,coordLength:r})}}function ZD(e,t,n,{startPosition:r,endPosition:s,coordLength:i}){if(!e.triangles)return;let o=r*i,c=s*i,a=e.positions.subarray(o,c),h=n[0],l=n.slice(1).map(p=>(p-h)/i),f=w1(a,l,i,t);for(let p=0,u=f.length;p<u;++p)e.triangles.push(r+f[p])}function I1(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function $D(e,t,n,r){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:I1(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:I1(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:I1(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function v1(e,t,n,r){for(let s in e.numericProps)if(s in t){let i=t[s];e.numericProps[s].fill(i,n,n+r)}}function P1(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function t6(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function qa(e,t){let n=t?.globalFeatureId;return n!==void 0?e6(e,n):n6(e,t?.type)}function e6(e,t){let n=ZE(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let c=r.featureIds.value[o];if(c!==i){if(t===r.globalFeatureIds.value[s])return za(r,s,o);s=o,i=c}}if(t===r.globalFeatureIds.value[s])return za(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function n6(e,t){let n=ZE(e,t);return r6(n)}function QE(e,t,n){switch(e.type){case"Point":return c6(e,t,n);case"LineString":return o6(e,t,n);case"Polygon":return $E(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function ZE(e,t){let n=[];return e.points&&(e.points.type="Point",n.push(e.points)),e.lines&&(e.lines.type="LineString",n.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",n.push(e.polygons)),n}function r6(e){let t=[];for(let n of e){if(n.featureIds.value.length===0)continue;let r=0,s=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let o=n.featureIds.value[i];o!==s&&(t.push(za(n,r,i)),r=i,s=o)}t.push(za(n,r,n.featureIds.value.length))}return t}function za(e,t,n){let r=QE(e,t,n),s=i6(e,t,n),i=s6(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function s6(e,t=0,n){return e.fields&&e.fields[e.featureIds.value[t]]}function i6(e,t=0,n){let r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function $E(e,t=-1/0,n=1/0){let{positions:r}=e,s=e.polygonIndices.value.filter(a=>a>=t&&a<=n),i=e.primitivePolygonIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2)){let a=[];for(let h=0;h<i.length-1;h++){let l=i[h],f=i[h+1],p=Va(r,l,f);a.push(p)}return{type:"Polygon",coordinates:a}}let c=[];for(let a=0;a<s.length-1;a++){let h=s[a],l=s[a+1],f=$E(e,h,l).coordinates;c.push(f)}return{type:"MultiPolygon",coordinates:c}}function o6(e,t=-1/0,n=1/0){let{positions:r}=e,s=e.pathIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2))return{type:"LineString",coordinates:Va(r,s[0],s[1])};let o=[];for(let c=0;c<s.length-1;c++){let a=Va(r,s[c],s[c+1]);o.push(a)}return{type:"MultiLineString",coordinates:o}}function c6(e,t,n){let{positions:r}=e,s=Va(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Va(e,t,n){t=t||0,n=n||e.value.length/e.size;let r=[];for(let s=t;s<n;s++){let i=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)i.push(Number(e.value[o]));r.push(i)}return r}var V1=G(oT(),1);function cT(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=C6(e[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function C6(e){let t=0;for(let n=0,r=e.length-1,s,i;n<e.length;r=n++)s=e[n],i=e[r],t+=(i[0]-s[0])*(s[1]+i[1]);return t}function aT(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?B6(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function B6(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var Ls=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(aT,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,c=[],a;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(a&&c.push(a),a=[]),a&&a.push([i,o]);else if(r===7)a&&a.push(a[0].slice());else throw new Error(`unknown command ${r}`)}return a&&c.push(a),c}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,c=1/0,a=-1/0,h=1/0,l=-1/0;for(;t.pos<n;){if(s<=0){let f=t.readVarint();r=f&7,s=f>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<c&&(c=i),i>a&&(a=i),o<h&&(h=o),o>l&&(l=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[c,h,a,l]}_toGeoJSON(t){let n=this.loadGeometry(),r=Ls.types[this.type],s,i;switch(this.type){case 1:let c=[];for(s=0;s<n.length;s++)c[s]=n[s][0];n=c,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=cT(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,c=this.extent*r;function a(h){for(let l=0;l<h.length;l++){let f=h[l];f[0]=(f[0]+o)*360/i-180;let p=180-(f[1]+c)*360/i;f[1]=360/Math.PI*Math.atan(Math.exp(p*Math.PI/180))-90}}return this._toGeoJSON(a)}};var Ya=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(L6,this,n),this.length=this._features.length}feature(t){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 Ls(this._pbf,n,this.extent,this._keys,this._values)}};function L6(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(R6(n)))}function R6(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Wa=class{layers;constructor(t,n){this.layers=t.readFields(b6,{},n)}};function b6(e,t,n){if(e===3&&n){let r=new Ya(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function hT(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[ur(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],c,a=0;for(let h,l=0,f;l<t;l++){f=e.indices[l]-a,h=e.indices[l+1]-a||e.data.length;let p=e.data.slice(f,h),u=ur(p);if(u===0){let d=e.data.slice(0,f),g=e.data.slice(h);e.data=d.concat(g),a+=h-f;continue}c===void 0&&(c=u<0),c===u<0?(o.length&&(r.push(i),s.push(o)),o=[f],i=[u]):(i.push(u),o.push(f))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function lT(e,t,n,r){for(let s=0,i=e.length;s<i;s+=2){e[s]=(e[s]+t)*360/r-180;let o=180-(e[s+1]+n)*360/r;e[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function fT(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?w6(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function w6(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var pT,mr,D1,Ja,U1,G1,Wi;var ja=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,s,i,o){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(fT,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,pT=t.readVarint()+t.pos,mr=1,Ja=0,U1=0,G1=0,Wi=0;let n=[],r=[];for(;t.pos<pT;)if(Ja<=0&&(D1=t.readVarint(),mr=D1&7,Ja=D1>>3),Ja--,mr===1||mr===2)U1+=t.readSVarint(),G1+=t.readSVarint(),mr===1&&n.push(Wi),r.push(U1,G1),Wi+=2;else if(mr===7){if(Wi>0){let s=n[n.length-1];r.push(r[s],r[s+1]),Wi+=2}}else throw new Error(`unknown command ${mr}`);return{data:r,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),r;t(n.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/s,r={type:"LineString",...n};break;case 3:r=hT(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,c=this.extent*r;return this._toBinaryCoordinates(a=>lT(a,o,c,i))}};var Xa=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(I6,this,n),this.length=this._features.length}feature(t,n){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 ja(this._pbf,r,this.extent,this._keys,this._values,n)}};function I6(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(P6(n)))}function P6(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Ka=class{layers;constructor(t,n){this.layers=t.readFields(O6,{},n)}};function O6(e,t,n){if(e===3&&n){let r=new Xa(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function q1(e,t){let n=N6(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:z1(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:uT(e,n)};case"geojson":return uT(e,n);case"binary-geometry":return z1(e,n);case"binary":return z1(e,n);default:throw new Error(r||"undefined shape")}}function z1(e,t){let[n,r]=v6(e,t),s=O1(n,r);return s.byteLength=e.byteLength,s}function v6(e,t){let n=[],r={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[n,r];let s=new Ka(new V1.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let c=s.layers[o];if(c)for(let a=0;a<c.length;a++){let h=c.feature(a,r),l=D6(h,t,o);n.push(l)}}),[n,r]}function uT(e,t){if(e.byteLength<=0)return[];let n=[],r=new Wa(new V1.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let c=0;c<o.length;c++){let a=o.feature(c),h=F6(a,t,i);n.push(h)}}),n}function N6(e){if(!e?.mvt)throw new Error("mvt options required");let t=e.mvt?.coordinates==="wgs84",{tileIndex:n}=e.mvt,r=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(t&&!r)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function F6(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:U6);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function D6(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:G6);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function U6(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let s=e[r];s[0]/=n,s[1]/=n}}function G6(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var z6="4.2.1",Qa={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:z6,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:null}}},V6={...Qa,parse:async(e,t)=>q1(e,t),parseSync:q1,binary:!0};var q6={Point:dT,MultiPoint:k6,LineString:mT,MultiLineString:H6,Polygon:gT,MultiPolygon:Y6};function dT([e,t],[n,r],s){let i=en(n[0],r[0],e),o=en(n[1],r[1],t);return s.unprojectFlat([i,o])}function k1(e,t,n){return e.map(r=>dT(r,t,n))}function k6(e,t,n){return k1(e,t,n)}function mT(e,t,n){return k1(e,t,n)}function H6(e,t,n){return e.map(r=>mT(r,t,n))}function gT(e,t,n){return e.map(r=>k1(r,t,n))}function Y6(e,t,n){return e.map(r=>gT(r,t,n))}function xT(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:q6[e.type](e.coordinates,i,n)}}var W6=["points","lines","polygons"];function H1(e,t,n,r){for(let s of W6){let i=e[s]&&J6(e[s],t,n,r);if(i>=0)return i}return-1}function J6(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let a=j6(e,r);if(a)i=a[0],o=a[1]+1;else return-1}let c=-1;if(t in e.numericProps){let a=e.numericProps[t].value.findIndex((h,l)=>h===n&&s[l]>=i&&s[l]<o);return a>=0?e.globalFeatureIds.value[a]:-1}else t?c=MT(e.properties,a=>a[t]===n,i,o):e.fields&&(c=MT(e.fields,a=>a.id===n,i,o));return c>=0?X6(e,c):-1}function j6(e,t){if(!e.__layers){let n={},{properties:r}=e;for(let s=0;s<r.length;s++){let{layerName:i}=r[s];i&&(n[i]?n[i][1]=s:n[i]=[s,s])}e.__layers=n}return e.__layers[t]}function X6(e,t){if(!e.__ids){let n=[],r=e.featureIds.value,s=e.globalFeatureIds.value;for(let i=0;i<r.length;i++)n[r[i]]=s[i];e.__ids=n}return e.__ids[t]}function MT(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var Y1=512,K6={...J1.GeoJsonLayer.defaultProps,data:mn,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[Qa],binary:!0},Ji=class extends Xn{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:n,context:r,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:n,context:r,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:i}=t;i!==n.highlightColor&&Array.isArray(i)&&this.setState({highlightColor:i})}async _updateTileData(){let t=this.props.data,n=null;if(typeof t=="string"&&!Ol(t)){let{onDataLoad:r,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{n=await s(t,{propName:"data",layer:this,loaders:[]})}catch(i){this.raiseError(i,"loading TileJSON"),t=null}r&&r(n,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(n=t);n&&(t=n.tiles),this.setState({data:t,tileJSON:n})}_getTilesetOptions(){let t=super._getTilesetOptions(),n=this.state.tileJSON,{minZoom:r,maxZoom:s}=this.props;return n&&(Number.isFinite(n.minzoom)&&n.minzoom>r&&(t.minZoom=n.minzoom),Number.isFinite(n.maxzoom)&&(!Number.isFinite(s)||n.maxzoom<s)&&(t.maxZoom=n.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:n,binary:r}=this.state,{index:s,signal:i}=t,o=we(n,t);if(!o)return Promise.reject("Invalid URL");let c=this.getLoadOptions(),{fetch:a}=this.props;return c={...c,mimeType:"application/x-protobuf",mvt:{...c?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},a(o,{propName:"data",layer:this,loadOptions:c,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=Y1/i,c=-o,a=Y1*n/i,h=Y1*(1-r/i),l=new Kt().scale([o,c,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=l,t.coordinateOrigin=[a,h,0],t.coordinateSystem=Za.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new TT.ClipExtension]);let f=super.renderSubLayers(t);return this.state.binary&&!(f instanceof J1.GeoJsonLayer)&&Za.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),f}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,c=null;i&&(o=W1(i,n),c=AT(i));let{highlightColor:a}=this.props;typeof a=="function"&&(a=a(t)),(r!==o||s!==c)&&this.setState({highlightColor:a,hoveredFeatureId:o,hoveredFeatureLayerName:c})}_isWGS84(){return Boolean(this.context.viewport.resolution)}getPickingInfo(t){let n=super.getPickingInfo(t);if(this.state.binary&&n.index!==-1){let{data:r}=t.sourceLayer.props;n.object=qa(r,{globalFeatureId:n.index})}return n.object&&!this._isWGS84()&&(n.object=ET(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,c=t.content,a=yT(o);if(!(yT(n)||a))return-1;let l=a?o:n;return Array.isArray(c)?c.findIndex(f=>{let p=W1(f,i)===l,u=a||AT(f)===r;return p&&u}):c&&s?H1(c,i,l,a?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,c=r.y,a=[this.id];return n.pickObjects({x:o,y:c,width:s,height:i,layerIds:a,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=W1(i.object,this.props.uniqueIdProperty);o===void 0?s.push(i.object):r.has(o)||(r.add(o),s.push(i.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(r=>{r.hasOwnProperty(t)||Object.defineProperty(r,t,{get:()=>{if(!r.content)return null;if(this.state.binary&&Array.isArray(r.content)&&!r.content.length)return[];let{bbox:s}=r;if(r._contentWGS84===void 0&&vl(s)){let i=this.state.binary?qa(r.content):r.content;r._contentWGS84=i.map(o=>ET(o,s,this.context.viewport))}return r._contentWGS84}})})}};Ji.layerName="MVTLayer";Ji.defaultProps=K6;var _T=Ji;function W1(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function AT(e){return e.properties?.layerName||null}function yT(e){return e!=null&&e!==""}function ET(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>xT(e.geometry,t,n).coordinates}),r}var ST="0123456789bcdefghjkmnpqrstuvwxyz",CT={};for(let e=0;e<ST.length;e++)CT[ST.charAt(e)]=e;var Q6=-90,Z6=90,$6=-180,tU=180;function eU(e){let t=!0,n=Z6,r=Q6,s=tU,i=$6,o,c=0;for(let a=0,h=e.length;a<h;a++){let l=e[a].toLowerCase();c=CT[l];for(let f=4;f>=0;f--){let p=c>>f&1;t?(o=(s+i)/2,p===1?i=o:s=o):(o=(n+r)/2,p===1?r=o:n=o),t=!t}}return[r,i,n,s]}function BT(e){let[t,n,r,s]=eU(e);return[s,r,s,t,n,t,n,r,s,r]}var nU={getGeohash:{type:"accessor",value:e=>e.geohash}},ji=class extends $t{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>BT(n(r,s))}}};ji.layerName="GeohashLayer";ji.defaultProps=nU;var LT=ji;return FT(Xi);})();
686
1099
  /*! Bundled license information:
687
1100
 
688
1101
  long/dist/long.js: