1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 08:28:36 -05:00
sdrangel/plugins/feature/map/Cesium/Cesium.js

91 lines
3.9 MiB
JavaScript
Raw Normal View History

2022-02-04 15:41:22 -05:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Cesium={})}(this,(function(exports){"use strict";function appendForwardSlash(e){return 0!==e.length&&"/"===e[e.length-1]||(e+="/"),e}function defined(e){return null!=e}function DeveloperError(e){let t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(e){t=e.stack}this.stack=t}defined(Object.create)&&(DeveloperError.prototype=Object.create(Error.prototype),DeveloperError.prototype.constructor=DeveloperError),DeveloperError.prototype.toString=function(){let e=this.name+": "+this.message;return defined(this.stack)&&(e+="\n"+this.stack.toString()),e},DeveloperError.throwInstantiationError=function(){throw new DeveloperError("This function defines an interface and should not be called directly.")};const Check={};function getUndefinedErrorMessage(e){return e+" is required, actual value was undefined"}function getFailedTypeErrorMessage(e,t,n){return"Expected "+n+" to be typeof "+t+", actual typeof was "+e}function defaultValue(e,t){return null!=e?e:t}Check.typeOf={},Check.defined=function(e,t){if(!defined(t))throw new DeveloperError(getUndefinedErrorMessage(e))},Check.typeOf.func=function(e,t){if("function"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"function",e))},Check.typeOf.string=function(e,t){if("string"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"string",e))},Check.typeOf.number=function(e,t){if("number"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"number",e))},Check.typeOf.number.lessThan=function(e,t,n){if(Check.typeOf.number(e,t),t>=n)throw new DeveloperError("Expected "+e+" to be less than "+n+", actual value was "+t)},Check.typeOf.number.lessThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t>n)throw new DeveloperError("Expected "+e+" to be less than or equal to "+n+", actual value was "+t)},Check.typeOf.number.greaterThan=function(e,t,n){if(Check.typeOf.number(e,t),t<=n)throw new DeveloperError("Expected "+e+" to be greater than "+n+", actual value was "+t)},Check.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Check.typeOf.number(e,t),t<n)throw new DeveloperError("Expected "+e+" to be greater than or equal to "+n+", actual value was "+t)},Check.typeOf.object=function(e,t){if("object"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"object",e))},Check.typeOf.bool=function(e,t){if("boolean"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"boolean",e))},Check.typeOf.bigint=function(e,t){if("bigint"!=typeof t)throw new DeveloperError(getFailedTypeErrorMessage(typeof t,"bigint",e))},Check.typeOf.number.equals=function(e,t,n,i){if(Check.typeOf.number(e,n),Check.typeOf.number(t,i),n!==i)throw new DeveloperError(e+" must be equal to "+t+", the actual values are "+n+" and "+i)},defaultValue.EMPTY_OBJECT=Object.freeze({});var MersenneTwister=function(e){null==e&&(e=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};MersenneTwister.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},MersenneTwister.prototype.init_by_array=function(e,t){var n,i,r;for(this.init_seed(19650218),n=1,i=0,r=this.N>t?this.N:t;r;r--){var o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1664525*((4294901760&o)>>>16)<<16)+1664525*(65535&o))+e[i]+i,this.mt[n]>>>=0,i++,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(r=this.N-1;r;r--){o=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(1566083941*((4294901760&o)>>>16)<<16)+1566083941*(65535&o))-n,this.mt[n]>>>=0,++n>=this.N&&(this.mt[0]=this.mt[this.N-1],
/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.7
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/var t,n;t=commonjsGlobal,n=function(e){var t=e&&e.IPv6;return{best:function(e){var t,n,i=e.toLowerCase().split(":"),r=i.length,o=8;for(""===i[0]&&""===i[1]&&""===i[2]?(i.shift(),i.shift()):""===i[0]&&""===i[1]?i.shift():""===i[r-1]&&""===i[r-2]&&i.pop(),-1!==i[(r=i.length)-1].indexOf(".")&&(o=7),t=0;t<r&&""!==i[t];t++);if(t<o)for(i.splice(t,1,"0000");i.length<o;)i.splice(t,0,"0000");for(var a=0;a<o;a++){n=i[a].split("");for(var s=0;s<3&&"0"===n[0]&&n.length>1;s++)n.splice(0,1);i[a]=n.join("")}var c=-1,l=0,u=0,d=-1,h=!1;for(a=0;a<o;a++)h?"0"===i[a]?u+=1:(h=!1,u>l&&(c=d,l=u)):"0"===i[a]&&(h=!0,d=a,u=1);u>l&&(c=d,l=u),l>1&&i.splice(c,l,""),r=i.length;var p="";for(""===i[0]&&(p=":"),a=0;a<r&&(p+=i[a],a!==r-1);a++)p+=":";return""===i[r-1]&&(p+=":"),p},noConflict:function(){return e.IPv6===this&&(e.IPv6=t),this}}},e.exports?e.exports=n():t.IPv6=n(t)})),SecondLevelDomains=createCommonjsModule((function(e){
/*!
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.19.7
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/var t,n;t=commonjsGlobal,n=function(e){var t=e&&e.SecondLevelDomains,n={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov in
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.7
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/var t,n;t=commonjsGlobal,n=function(e,t,n,i){var r=i&&i.URI;function o(e,t){var n=arguments.length>=1,i=arguments.length>=2;if(!(this instanceof o))return n?i?new o(e,t):new o(e):new o;if(void 0===e){if(n)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}o.version="1.19.7";var a=o.prototype,s=Object.prototype.hasOwnProperty;function c(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function u(e){return"Array"===l(e)}function d(e,t){var n,i,r={};if("RegExp"===l(t))r=null;else if(u(t))for(n=0,i=t.length;n<i;n++)r[t[n]]=!0;else r[t]=!0;for(n=0,i=e.length;n<i;n++)(r&&void 0!==r[e[n]]||!r&&t.test(e[n]))&&(e.splice(n,1),i--,n--);return e}function h(e,t){var n,i;if(u(t)){for(n=0,i=t.length;n<i;n++)if(!h(e,t[n]))return!1;return!0}var r=l(t);for(n=0,i=e.length;n<i;n++)if("RegExp"===r){if("string"==typeof e[n]&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function p(e,t){if(!u(e)||!u(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function f(e){return e.replace(/^\/+|\/+$/g,"")}function m(e){return escape(e)}function g(e){return encodeURIComponent(e).replace(/[!'()*]/g,m).replace(/\*/g,"%2A")}o._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:o.preventInvalidHostname,duplicateQueryParameters:o.duplicateQueryParameters,escapeQuerySpace:o.escapeQuerySpace}},o.preventInvalidHostname=!1,o.duplicateQueryParameters=!1,o.escapeQuerySpace=!0,o.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,o.idn_expression=/[^a-z0-9\._-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o.encode=g,o.decode=decodeURIComponent,o.iso8859=fun
/** @license MIT License (c) copyright B Cavalier & J Hann */
var n;n=function(){var e,t,n;function i(e,t,n,i){return r(e).then(t,n,i)}function r(e){var t,n;return e instanceof o?t=e:c(e)?(n=s(),e.then((function(e){n.resolve(e)}),(function(e){n.reject(e)}),(function(e){n.progress(e)})),t=n.promise):t=function(e){var t=new o((function(t){try{return r(t?t(e):e)}catch(e){return a(e)}}));return t}(e),t}function o(e){this.then=e}function a(e){var t=new o((function(t,n){try{return n?r(n(e)):a(e)}catch(e){return a(e)}}));return t}function s(){var e,t,i,c,l,u;return e=new o(d),t=[],i=[],c=function(e,n,r){var o,a;return o=s(),a="function"==typeof r?function(e){try{o.progress(r(e))}catch(e){o.progress(e)}}:function(e){o.progress(e)},t.push((function(t){t.then(e,n).then(o.resolve,o.reject,a)})),i.push(a),o.promise},l=function(e){return h(i,e),e},u=function(e){return e=r(e),c=e.then,u=r,l=f,h(t,e),i=t=n,e},{then:d,resolve:p,reject:m,progress:g,promise:e,resolver:{resolve:p,reject:m,progress:g}};function d(e,t,n){return c(e,t,n)}function p(e){return u(e)}function m(e){return u(a(e))}function g(e){return l(e)}}function c(e){return e&&"function"==typeof e.then}function l(e,t,n,r,o){return p(2,arguments),i(e,(function(e){var a,c,l,u,d,h,p,m,g,_;if(g=e.length>>>0,a=Math.max(0,Math.min(t,g)),l=[],c=g-a+1,u=[],d=s(),a)for(m=d.progress,p=function(e){u.push(e),--c||(h=p=f,d.reject(u))},h=function(e){l.push(e),--a||(h=p=f,d.resolve(l))},_=0;_<g;++_)_ in e&&i(e[_],C,y,m);else d.resolve(l);return d.then(n,r,o);function y(e){p(e)}function C(e){h(e)}}))}function u(e,t,n,i){return p(1,arguments),d(e,m).then(t,n,i)}function d(e,t){return i(e,(function(e){var n,r,o,a,c,l;if(o=r=e.length>>>0,n=[],l=s(),o)for(a=function(e,r){i(e,t).then((function(e){n[r]=e,--o||l.resolve(n)}),l.reject)},c=0;c<r;c++)c in e?a(e[c],c):--o;else l.resolve(n);return l.promise}))}function h(e,t){for(var n,i=0;n=e[i++];)n(t)}function p(e,t){for(var n,i=t.length;i>e;)if(null!=(n=t[--i])&&"function"!=typeof n)throw new Error("arg "+i+" must be a function")}function f(){}function m(e){return e}return i.defer=s,i.resolve=r,i.reject=function(e){return i(e,a)},i.join=function(){return d(arguments,m)},i.all=u,i.map=d,i.reduce=function(n,r){var o=t.call(arguments,1);return i(n,(function(t){var n;return n=t.length,o[0]=function(e,t,o){return i(e,(function(e){return i(t,(function(t){return r(e,t,o,n)}))}))},e.apply(t,o)}))},i.any=function(e,t,n,i){return l(e,1,(function(e){return t?t(e[0]):e[0]}),n,i)},i.some=l,i.chain=function(e,t,n){var r=arguments.length>2;return i(e,(function(e){return e=r?n:e,t.resolve(e),e}),(function(e){return t.reject(e),a(e)}),t.progress)},i.isPromise=c,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then((function(){return e}))},spread:function(e){return this.then((function(t){return u(t,(function(t){return e.apply(n,t)}))}))}},t=[].slice,e=[].reduce||function(e){var t,n,i,r,o;if(o=0,r=(t=Object(this)).length>>>0,(n=arguments).length<=1)for(;;){if(o in t){i=t[o++];break}if(++o>=r)throw new TypeError}else i=n[1];for(;o<r;++o)o in t&&(i=e(i,t[o],o,t));return i},i},e.exports=n()}));function clone$1(e,t){if(null===e||"object"!=typeof e)return e;t=defaultValue(t,!1);const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let r=e[i];t&&(r=clone$1(r,t)),n[i]=r}return n}function combine$2(e,t,n){n=defaultValue(n,!1);const i={},r=defined(e),o=defined(t);let a,s,c;if(r)for(a in e)e.hasOwnProperty(a)&&(s=e[a],o&&n&&"object"==typeof s&&t.hasOwnProperty(a)?(c=t[a],i[a]="object"==typeof c?combine$2(s,c,n):s):i[a]=s);if(o)for(a in t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(c=t[a],i[a]=c);return i}function getBaseUri(e,t){let n="";const i=e.lastIndexOf("/");return-1!==i&&(n=e.substring(0,i+1)),t?(0!==(e=new URI(e)).query().length&&(n+="?"+e.query()),0!==e.fragment().length&&(n+="#"+e.fragment()),n):n}function getExtensionFromUri(e){const t=new URI(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return-1!==i&&(n=n.substr(i+1)),i=n.lastIndexOf("."),n=-1===i?"":n.substr(i+1),n}const blobUriRegex=/^blob:/i;function isBlobUri(e){return
/*! @license DOMPurify 2.3.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.4/LICENSE */
function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}ApproximateTerrainHeights.initialize=function(){let e=ApproximateTerrainHeights._initPromise;return defined(e)||(e=Resource.fetchJson(buildModuleUrl("Assets/approximateTerrainHeights.json")).then((function(e){ApproximateTerrainHeights._terrainHeights=e})),ApproximateTerrainHeights._initPromise=e),e},ApproximateTerrainHeights.getMinimumMaximumHeights=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);const n=getTileXYLevel(e);let i=ApproximateTerrainHeights._defaultMinTerrainHeight,r=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(n)){const o=n.level+"-"+n.x+"-"+n.y,a=ApproximateTerrainHeights._terrainHeights[o];defined(a)&&(i=a[0],r=a[1]),t.cartographicToCartesian(Rectangle.northeast(e,scratchDiagonalCartographic),scratchDiagonalCartesianNE),t.cartographicToCartesian(Rectangle.southwest(e,scratchDiagonalCartographic),scratchDiagonalCartesianSW),Cartesian3.midpoint(scratchDiagonalCartesianSW,scratchDiagonalCartesianNE,scratchCenterCartesian);const s=t.scaleToGeodeticSurface(scratchCenterCartesian,scratchSurfaceCartesian);if(defined(s)){const e=Cartesian3.distance(scratchCenterCartesian,s);i=Math.min(i,-e)}else i=ApproximateTerrainHeights._defaultMinTerrainHeight}return i=Math.max(ApproximateTerrainHeights._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:r}},ApproximateTerrainHeights.getBoundingSphere=function(e,t){t=defaultValue(t,Ellipsoid.WGS84);const n=getTileXYLevel(e);let i=ApproximateTerrainHeights._defaultMaxTerrainHeight;if(defined(n)){const e=n.level+"-"+n.x+"-"+n.y,t=ApproximateTerrainHeights._terrainHeights[e];defined(t)&&(i=t[1])}const r=BoundingSphere.fromRectangle3D(e,t,0);return BoundingSphere.fromRectangle3D(e,t,i,scratchBoundingSphere$4),BoundingSphere.union(r,scratchBoundingSphere$4,r)},ApproximateTerrainHeights._terrainHeightsMaxLevel=6,ApproximateTerrainHeights._defaultMaxTerrainHeight=9e3,ApproximateTerrainHeights._defaultMinTerrainHeight=-1e5,ApproximateTerrainHeights._terrainHeights=void 0,ApproximateTerrainHeights._initPromise=void 0,Object.defineProperties(ApproximateTerrainHeights,{initialized:{get:function(){return defined(ApproximateTerrainHeights._terrainHeights)}}});var hasOwnProperty=Object.hasOwnProperty,setPrototypeOf=Object.setPrototypeOf,isFrozen=Object.isFrozen,getPrototypeOf=Object.getPrototypeOf,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,freeze=Object.freeze,seal=Object.seal,create=Object.create,_ref="undefined"!=typeof Reflect&&Reflect,apply=_ref.apply,construct=_ref.construct;apply||(apply=function(e,t,n){return e.apply(t,n)}),freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),construct||(construct=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(_toConsumableArray(t))))});var arrayForEach=unapply(Array.prototype.forEach),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),stringToLowerCase=unapply(String.prototype.toLowerCase),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(e){return function(t){for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return apply(e,t,i)}}function unconstruct(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return construct(e,n)}}function addToSet(e,t){setPrototypeOf&&setPrototypeOf(e,null);for(var n=t.length;n--;){var i=t[n];if("string"==typeof i){var r=stringToLowerCase(i);r!==i&&(isFrozen(t)||(t[n]=r),i=r)}e[i]=!0}return e}function clone(e){var t=create(null),n=void 0;for(n in e)apply(hasOwnProperty,e,[n])&&(t[n]=e[n]);return t}function lookupGetter(e,t){for(;null!==e;){var n=getOwnPropertyDescriptor(e,t);if(n){if(n.get)return unapply(n.get);if("function"==typeof n.value)return unapply(n.value)}e=getProto
/*!
* protobuf.js v6.7.0 (c) 2016, Daniel Wirtz
* Compiled Sun, 02 Apr 2017 11:28:29 UTC
* Licensed under the BSD-3-Clause License
* see: https://github.com/dcodeIO/protobuf.js for details
*/
(function(global,undefined$1){!function(e,t,n){var i=global.protobuf=function n(i){var r=t[i];return r||e[i][0].call(r=t[i]={exports:{}},n,r,r.exports),r.exports}(n[0]);"function"==typeof undefined$1&&undefined$1.amd&&undefined$1(["long"],(function(e){return e&&e.isLong&&(i.util.Long=e,i.configure()),i})),module&&module.exports&&(module.exports=i)}({1:[function(e,t,n){t.exports=function(e,t){for(var n=[],i=2;i<arguments.length;)n.push(arguments[i++]);var r=!0;return new Promise((function(i,o){n.push((function(e){if(r)if(r=!1,e)o(e);else{for(var t=[],n=1;n<arguments.length;)t.push(arguments[n++]);i.apply(null,t)}}));try{e.apply(t||this,n)}catch(e){r&&(r=!1,o(e))}}))}},{}],2:[function(e,t,n){var i=n;i.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),o=new Array(123),a=0;a<64;)o[r[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;i.encode=function(e,t,n){for(var i,o=[],a=0,s=0;t<n;){var c=e[t++];switch(s){case 0:o[a++]=r[c>>2],i=(3&c)<<4,s=1;break;case 1:o[a++]=r[i|c>>4],i=(15&c)<<2,s=2;break;case 2:o[a++]=r[i|c>>6],o[a++]=r[63&c],s=0}}return s&&(o[a++]=r[i],o[a]=61,1===s&&(o[a+1]=61)),String.fromCharCode.apply(String,o)};var s="invalid encoding";i.decode=function(e,t,n){for(var i,r=n,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if((l=o[l])===undefined$1)throw Error(s);switch(a){case 0:i=l,a=1;break;case 1:t[n++]=i<<2|(48&l)>>4,i=l,a=2;break;case 2:t[n++]=(15&i)<<4|(60&l)>>2,i=l,a=3;break;case 3:t[n++]=(3&i)<<6|l,a=0}}if(1===a)throw Error(s);return n-r},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},{}],3:[function(e,t,n){function i(){this._listeners={}}t.exports=i,i.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this},i.prototype.off=function(e,t){if(e===undefined$1)this._listeners={};else if(t===undefined$1)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this},i.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}},{}],4:[function(e,t,n){function i(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),i=128===n[3];function r(e,i,r){t[0]=e,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3]}function o(e,i,r){t[0]=e,i[r]=n[3],i[r+1]=n[2],i[r+2]=n[1],i[r+3]=n[0]}function a(e,i){return n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=e[i+3],t[0]}function s(e,i){return n[3]=e[i],n[2]=e[i+1],n[1]=e[i+2],n[0]=e[i+3],t[0]}e.writeFloatLE=i?r:o,e.writeFloatBE=i?o:r,e.readFloatLE=i?a:s,e.readFloatBE=i?s:a}():function(){function t(e,t,n,i){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,n,i);else if(isNaN(t))e(2143289344,n,i);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,n,i);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,n,i);else{var o=Math.floor(Math.log(t)/Math.LN2);e((r<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,i)}}function n(e,t,n){var i=e(t,n),r=2*(i>>31)+1,o=i>>>23&255,a=8388607&i;return 255===o?a?NaN:r*(1/0):0===o?1401298464324817e-60*r*a:r*Math.pow(2,o-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,o),e.readFloatLE=n.bind(null,a),e.readFloatBE=n.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),i=128===n[7];function r(e,i,r){t[0]=e,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3],i[r+4]=n[4],i[r+5]=n[5],i[r+6]=n[6],i[r+7]=n[7]}function o(e,i,r){t[0]=e,i[r]=n[7],i[r+1]=n[6],i[r+2]=n[5],i[r+3]=n[4],i[r+4]=n[3],i[r+5]=n[2],i[r+6]=n[1],i[r+7]=n[0]}function a(e,i){return n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=e[i+3],n[4]=e[i+4],n[5]=e[i+5],n[6]=e[i+6],n[7]=e[i+7],t[0]}function s(e,i){return n[7]=e[i],n[6]=e[i+1],n[5]=e[i+2],n[4]=e[i+3],n[3]=e[i+4],n[2]=e[i+5],n[1]=e[i+6],n[0]=e[i+7],t[0]}e.writeDoubleLE=i?r:o,e.writeD
/**
* @license
* Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the project nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Modifications made by Cesium GS, Inc.
*/
var SkyAtmosphereCommon="const float Kr = 0.0025;\nconst float Kr4PI = Kr * 4.0 * czm_pi;\nconst float Km = 0.0015;\nconst float Km4PI = Km * 4.0 * czm_pi;\nconst float ESun = 15.0;\nconst float KmESun = Km * ESun;\nconst float KrESun = Kr * ESun;\nconst vec3 InvWavelength = vec3(\n5.60204474633241,\n9.473284437923038,\n19.643802610477206);\nconst float rayleighScaleDepth = 0.25;\nconst int nSamples = 2;\nconst float fSamples = 2.0;\nconst float g = -0.95;\nconst float g2 = g * g;\n#ifdef COLOR_CORRECT\nuniform vec3 u_hsbShift;\n#endif\nuniform vec3 u_radiiAndDynamicAtmosphereColor;\nfloat scale(float cosAngle)\n{\nfloat x = 1.0 - cosAngle;\nreturn rayleighScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\nvec3 getLightDirection(vec3 positionWC)\n{\nfloat lightEnum = u_radiiAndDynamicAtmosphereColor.z;\nvec3 lightDirection =\npositionWC * float(lightEnum == 0.0) +\nczm_lightDirectionWC * float(lightEnum == 1.0) +\nczm_sunDirectionWC * float(lightEnum == 2.0);\nreturn normalize(lightDirection);\n}\nvoid calculateRayScatteringFromSpace(in vec3 positionWC, in vec3 ray, in float innerRadius, in float outerRadius, inout float far, out vec3 start, out float startOffset)\n{\nfloat cameraHeight = length(positionWC);\nfloat B = 2.0 * dot(positionWC, ray);\nfloat C = cameraHeight * cameraHeight - outerRadius * outerRadius;\nfloat det = max(0.0, B * B - 4.0 * C);\nfloat near = 0.5 * (-B - sqrt(det));\nstart = positionWC + ray * near;\nfar -= near;\nfloat startAngle = dot(ray, start) / outerRadius;\nfloat startDepth = exp(-1.0 / rayleighScaleDepth);\nstartOffset = startDepth * scale(startAngle);\n}\nvoid calculateRayScatteringFromGround(in vec3 positionWC, in vec3 ray, in float atmosphereScale, in float innerRadius, out vec3 start, out float startOffset)\n{\nfloat cameraHeight = length(positionWC);\nstart = positionWC;\nfloat height = length(start);\nfloat depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));\nfloat startAngle = dot(ray, start) / height;\nstartOffset = depth*scale(startAngle);\n}\nczm_raySegment rayEllipsoidIntersection(czm_ray ray, vec3 inverseRadii)\n{\nvec3 o = inverseRadii * (czm_inverseView * vec4(ray.origin, 1.0)).xyz;\nvec3 d = inverseRadii * (czm_inverseView * vec4(ray.direction, 0.0)).xyz;\nfloat a = dot(d, d);\nfloat b = dot(d, o);\nfloat c = dot(o, o) - 1.0;\nfloat discriminant = b * b - a * c;\nif (discriminant < 0.0)\n{\nreturn czm_emptyRaySegment;\n}\ndiscriminant = sqrt(discriminant);\nfloat t1 = (-b - discriminant) / a;\nfloat t2 = (-b + discriminant) / a;\nif (t1 < 0.0 && t2 < 0.0)\n{\nreturn czm_emptyRaySegment;\n}\nif (t1 < 0.0 && t2 >= 0.0)\n{\nt1 = 0.0;\n}\nreturn czm_raySegment(t1, t2);\n}\nvec3 getAdjustedPosition(vec3 positionWC, float innerRadius)\n{\nfloat cameraHeight = czm_eyeHeight + innerRadius;\nreturn normalize(positionWC) * cameraHeight;\n}\nvec3 getTranslucentPosition(vec3 positionWC, vec3 outerPositionWC, float innerRadius, out bool intersectsEllipsoid)\n{\nvec3 directionWC = normalize(outerPositionWC - positionWC);\nvec3 directionEC = czm_viewRotation * directionWC;\nczm_ray viewRay = czm_ray(vec3(0.0), directionEC);\nczm_raySegment raySegment = rayEllipsoidIntersection(viewRay, czm_ellipsoidInverseRadii);\nintersectsEllipsoid = raySegment.start >= 0.0;\nif (intersectsEllipsoid)\n{\nreturn positionWC + raySegment.stop * directionWC;\n}\nreturn getAdjustedPosition(positionWC, innerRadius);\n}\nvoid calculateMieColorAndRayleighColor(vec3 outerPositionWC, out vec3 mieColor, out vec3 rayleighColor)\n{\nfloat outerRadius = u_radiiAndDynamicAtmosphereColor.x;\nfloat innerRadius = u_radiiAndDynamicAtmosphereColor.y;\n#ifdef GLOBE_TRANSLUCENT\nbool intersectsEllipsoid = false;\nvec3 startPositionWC = getTranslucentPosition(czm_viewerPositionWC, outerPositionWC, innerRadius, intersectsEllipsoid);\n#else\nvec3 startPositionWC = getAdjustedPosition(czm_viewerPositionWC, innerRadius);\n#endif\nvec3 lightDirection = getLightDirection(startPositionWC);\nvec3 ray = outerPositionWC - startPositionWC;\nfloat far = length(ray);\nray /= far;\
/**
* @license
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
* Copyright (c) Steve Sanderson
* MIT license
*/;var OBSERVABLES_PROPERTY="__knockoutObservables",SUBSCRIBABLE_PROPERTY="__knockoutSubscribable";function track(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=getAllObservablesForObject(e,!0);return(t=t||Object.getOwnPropertyNames(e)).forEach((function(t){if(t!==OBSERVABLES_PROPERTY&&t!==SUBSCRIBABLE_PROPERTY&&!(t in i)){var r=e[t],o=r instanceof Array,a=n.isObservable(r)?r:o?n.observableArray(r):n.observable(r);Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[t]=a,o&&notifyWhenPresentOrFutureArrayValuesMutate(n,a)}})),e}function getAllObservablesForObject(e,t){var n=e[OBSERVABLES_PROPERTY];return!n&&t&&(n={},Object.defineProperty(e,OBSERVABLES_PROPERTY,{value:n})),n}function defineComputedProperty(e,t,n){var i={owner:e,deferEvaluation:!0};if("function"==typeof n)i.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if("function"!=typeof n.get)throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');i.read=n.get,i.write=n.set}return e[t]=this.computed(i),track.call(this,e,[t]),e}function notifyWhenPresentOrFutureArrayValuesMutate(e,t){var n=null;e.computed((function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=startWatchingArrayInstance(e,t,i))}))}function startWatchingArrayInstance(e,t,n){return getSubscribableForArray(e,n).subscribe(t)}function getSubscribableForArray(e,t){var n=t[SUBSCRIBABLE_PROPERTY];if(!n){n=new e.subscribable,Object.defineProperty(t,SUBSCRIBABLE_PROPERTY,{value:n});var i={};wrapStandardArrayMutators(t,n,i),addKnockoutArrayMutators(e,t,n,i)}return n}function wrapStandardArrayMutators(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach((function(i){var r=e[i];e[i]=function(){var e=r.apply(this,arguments);return!0!==n.pause&&t.notifySubscribers(this),e}}))}function addKnockoutArrayMutators(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach((function(r){Object.defineProperty(t,r,{enumerable:!1,value:function(){var o;i.pause=!0;try{o=e.observableArray.fn[r].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),o}})}))}function getObservable(e,t){if(!e)return null;var n=getAllObservablesForObject(e,!1);return n&&n[t]||null}function valueHasMutated(e,t){var n=getObservable(e,t);n&&n.valueHasMutated()}function attachToKo(e){e.track=track,e.getObservable=getObservable,e.valueHasMutated=valueHasMutated,e.defineProperty=defineComputedProperty}var knockout_es5={attachToKo:attachToKo};const svgNS$1="http://www.w3.org/2000/svg",svgClassName="cesium-svgPath-svg",SvgPathBindingHandler={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(svgNS$1,"svg:svg");i.setAttribute("class",svgClassName);const r=document.createElementNS(svgNS$1,"path");return i.appendChild(r),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const t=e.unwrap(n());r.setAttribute("d",e.unwrap(t.path));const o=e.unwrap(t.width),a=e.unwrap(t.height);i.setAttribute("width",o),i.setAttribute("height",a),i.setAttribute("viewBox","0 0 "+o+" "+a),t.css&&i.setAttribute("class",svgClassName+" "+e.unwrap(t.css))},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}};knockout_es5.attachToKo(knockout),SvgPathBindingHandler.register(knockout);const e=[171,75,84,88,32,50,48,187,13,10,26,10];var n,i,s,a,r,o,l,f,t;t=n||(n={}),t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB",function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(i||(i={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(s||(s={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(a||(a={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.S
/* Copyright 2015-2018 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
!function(){var t=function(){var e={defaultNoDataValue:-34027999387901484e22,decode:function(o,a){var s=(a=a||{}).encodedMaskData||null===a.encodedMaskData,c=r(o,a.inputOffset||0,s),l=null!==a.noDataValue?a.noDataValue:e.defaultNoDataValue,u=t(c,a.pixelType||Float32Array,a.encodedMaskData,l,a.returnMask),d={width:c.width,height:c.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:c.pixels.maxValue,noDataValue:l};return u.resultMask&&(d.maskData=u.resultMask),a.returnEncodedMask&&c.mask&&(d.encodedMaskData=c.mask.bitset?c.mask.bitset:null),a.returnFileInfo&&(d.fileInfo=n(c),a.computeUsedBitDepths&&(d.fileInfo.bitDepths=i(c))),d}},t=function(e,t,n,i,r){var a,s,c,l=0,u=e.pixels.numBlocksX,d=e.pixels.numBlocksY,h=Math.floor(e.width/u),p=Math.floor(e.height/d),f=2*e.maxZError,m=Number.MAX_VALUE;n=n||(e.mask?e.mask.bitset:null),s=new t(e.width*e.height),r&&n&&(c=new Uint8Array(e.width*e.height));for(var g,_,y=new Float32Array(h*p),C=0;C<=d;C++){var T=C!==d?p:e.height%d;if(0!==T)for(var S=0;S<=u;S++){var A=S!==u?h:e.width%u;if(0!==A){var v,E,b,x,P=C*e.width*p+S*h,D=e.width-A,w=e.pixels.blocks[l];if(w.encoding<2?(0===w.encoding?v=w.rawData:(o(w.stuffedData,w.bitsPerPixel,w.numValidPixels,w.offset,f,y,e.pixels.maxValue),v=y),E=0):b=2===w.encoding?0:w.offset,n)for(_=0;_<T;_++){for(7&P&&(x=n[P>>3],x<<=7&P),g=0;g<A;g++)7&P||(x=n[P>>3]),128&x?(c&&(c[P]=1),m=m>(a=w.encoding<2?v[E++]:b)?a:m,s[P++]=a):(c&&(c[P]=0),s[P++]=i),x<<=1;P+=D}else if(w.encoding<2)for(_=0;_<T;_++){for(g=0;g<A;g++)m=m>(a=v[E++])?a:m,s[P++]=a;P+=D}else for(m=m>b?b:m,_=0;_<T;_++){for(g=0;g<A;g++)s[P++]=b;P+=D}if(1===w.encoding&&E!==w.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:s,resultMask:c,minValue:m}},n=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},i=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,n={},i=0;i<t;i++){var r=e.pixels.blocks[i];0===r.encoding?n.float32=!0:1===r.encoding?n[r.bitsPerPixel]=!0:n[0]=!0}return Object.keys(n)},r=function(e,t,n){var i={},r=new Uint8Array(e,t,10);if(i.fileIdentifierString=String.fromCharCode.apply(null,r),"CntZImage"!==i.fileIdentifierString.trim())throw"Unexpected file identifier string: "+i.fileIdentifierString;t+=10;var o=new DataView(e,t,24);if(i.fileVersion=o.getInt32(0,!0),i.imageType=o.getInt32(4,!0),i.height=o.getUint32(8,!0),i.width=o.getUint32(12,!0),i.maxZError=o.getFloat64(16,!0),t+=24,!n)if(o=new DataView(e,t,16),i.mask={},i.mask.numBlocksY=o.getUint32(0,!0),i.mask.numBlocksX=o.getUint32(4,!0),i.mask.numBytes=o.getUint32(8,!0),i.mask.maxValue=o.getFloat32(12,!0),t+=16,i.mask.numBytes>0){var a=new Uint8Array(Math.ceil(i.width*i.height/8)),s=(o=new DataView(e,t,i.mask.numBytes)).getInt16(0,!0),c=2,l=0;do{if(s>0)for(;s--;)a[l++]=o.getUint8(c++);else{var u=o.getUint8(c++);for(s=-s;s--;)a[l++]=u}s=o.getInt16(c,!0),c+=2}while(c<i.mask.numBytes);if(-32768!==s||l<a.length)throw"Unexpected end of mask RLE encoding";i.mask.bitset=a,t+=i.mask.numBytes}else 0==(i.mask.numBytes|i.mask.numBlocksY|i.mask.maxValue)&&(i.mask.bitset=new Uint8Array(Math.ceil(i.width*i.height/8)));o=new DataView(e,t,16),i.pixels={},i.pixels.numBlocksY=o.getUint32(0,!0),i.pixels.numBlocksX=o.getUint32(4,!0),i.pixels.numBytes=o.getUint32(8,!0),i.pixels.maxValue=o.getFloat32(12,!0),t+=16;var d=i.pixels.numBlocksX,h=i.pixels.numBlocksY,p=d+(i.width%d>0?1:0),f=h+(i.height%h>0?1:0);i.pixels.blocks=new Array(p*f);for(var m=0,g=0;g<f;g++)for(var _=0;_<p;_++){var y=0,C=e.byteLength-t;o=new DataView(e,t,Math.min(10,C));var T={};i.pixels.blocks[m++]=T;var S=o.getUint8(0);if(y++,T.encoding=63&S,T.encoding>3)throw"Invalid block encoding ("+T.encoding+")";if(2!==T.encoding){if(0!==S&&2!==S){if(S