// Ol3-Cesium. See https://github.com/openlayers/ol3-cesium/
// License: https://github.com/openlayers/ol3-cesium/blob/master/LICENSE
// Version: v1.9-39-g2619a3e

(function (root, factory) {
  if (typeof exports === "object") {
    module.exports = factory();
  } else if (typeof define === "function" && define.amd) {
    define([], factory);
  } else {
    root.olcs = factory();
  }
}(this, function () {
  var OL3CESIUM = {};
  var k,m=this;function n(a){return void 0!==a}
function p(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function aa(a){var b=p(a);return"array"==b||"object"==b&&"number"==typeof a.length}function q(a){return"string"==typeof a}function ba(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function t(a){return a[ca]||(a[ca]=++da)}var ca="closure_uid_"+(1E9*Math.random()>>>0),da=0;function ea(a,b,c){return a.call.apply(a.bind,arguments)}
function fa(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function ga(a,b,c){ga=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ea:fa;return ga.apply(null,arguments)}var ha=Date.now||function(){return+new Date};
function u(a,b){var c=a.split("."),d=OL3CESIUM||m;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&n(b)?d[e]=b:d[e]?d=d[e]:d=d[e]={}}function v(a,b){function c(){}c.prototype=b.prototype;a.Qa=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Ta=function(a,c,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[c].apply(a,g)}};function ia(a,b){for(var c in a)b.call(void 0,a[c],c,a)}var ja="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ka(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<ja.length;f++)c=ja[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function w(a,b){this.map=a;this.i=a.getView();this.scene=b;a.getLayerGroup().getLayers();this.b=a.getLayerGroup();this.A={};this.g={};this.c={}}w.prototype.Z=function(){la(this);ma(this,this.b)};w.prototype.W=function(){};
function ma(a,b){for(var c=[b];0<c.length;){var d=c.splice(0,1)[0],e=t(d),f=null;d instanceof ol.layer.Group?(na(a,d),(f=a.T(d))||d.getLayers().forEach(function(a){c.push(a)})):f=a.T(d);null!==f&&(a.A[e]=f,a.g[e]=d.on("change:zIndex",a.W,a),f.forEach(function(a){this.aa(a)},a))}a.W()}function oa(a,b){var c=t(b),d=a.A[c];d&&(d.forEach(function(a){this.la(a,!1);this.da(a)},a),ol.Observable.unByKey(a.g[c]),delete a.g[c]);delete a.A[c]}
function pa(a,b){if(b!==a.b){var c=t(b);a.c[c].forEach(function(a){ol.Observable.unByKey(a)});delete a.c[c];delete a.A[c]}}function qa(a,b){if(b)for(var c=[b];0<c.length;){var d=c.splice(0,1)[0];d instanceof ol.layer.Group?(pa(a,d),d.getLayers().forEach(function(a){c.push(a)})):oa(a,d)}}
function na(a,b){var c=t(b),d=[];a.c[c]=d;var e=[],f=function(){var a=b.getLayers();n(a)&&(e=[a.on("add",function(a){ma(this,a.element)},this),a.on("remove",function(a){qa(this,a.element)},this)],d.push.apply(d,e))}.bind(a);f();d.push(b.on("change:layers",function(){e.forEach(function(a){var b=d.indexOf(a);0<=b&&d.splice(b,1);ol.Observable.unByKey(a)});f()}))}function la(a){a.ka(!0);ia(a.j,function(a){a.forEach(ol.Observable.unByKey)});ia(a.l,ol.Observable.unByKey);a.j={};a.l={};a.A={}};function x(a,b){this.c=a;this.f=a.f;this.h=b;this.b=this.a.bind(this);this.l=new Cesium.Matrix4;this.j=0;this.g=!1;this.f.postRender.addEventListener(this.pa.bind(this));this.i="";this.i="onwheel"in this.f.canvas?"wheel":document.onmousewheel?"mousewheel":"DOMMouseScroll";this.na=Cesium.loadWithXhr.load;this.oa=Cesium.TaskProcessor.prototype.b;this.ma=Cesium.Camera.prototype.setView;this.$=Cesium.Camera.prototype.move;this.Ra=Cesium.Camera.prototype.rotate;this.H=Cesium.Camera.prototype.lookAt;this.D=
Cesium.Camera.prototype.flyTo;ra(this)}function y(a,b){a.f.canvas.addEventListener(b,a.b,!1)}
function ra(a){y(a,"mousemove");y(a,"mousedown");y(a,"mouseup");y(a,"touchstart");y(a,"touchend");y(a,"touchmove");window.PointerEvent&&(y(a,"pointerdown"),y(a,"pointerup"),y(a,"pointermove"));y(a,a.i);window.addEventListener("resize",a.b,!1);Cesium.loadWithXhr.load=function(b,c,d,e,f,g,h,l,r){g.promise.always(a.b);a.na(b,c,d,e,f,g,h,l,r)};Cesium.TaskProcessor.prototype.b=function(b,c){var d=a.oa.call(this,b,c),e=this;if(!e.a){var f=e._worker;e.a=f.onmessage;f.onmessage=function(b){e.a(b);a.a()}}return d};
Cesium.Camera.prototype.setView=function(){a.ma.apply(this,arguments);a.a()};Cesium.Camera.prototype.move=function(){a.$.apply(this,arguments);a.a()};Cesium.Camera.prototype.rotate=function(){a.Ra.apply(this,arguments);a.a()};Cesium.Camera.prototype.lookAt=function(){a.H.apply(this,arguments);a.a()};Cesium.Camera.prototype.flyTo=function(){a.D.apply(this,arguments);a.a()};a.c.o.getLayerGroup().on("change",a.b)}
x.prototype.pa=function(){var a=Date.now(),b=this.f,c=b.camera;Cesium.Matrix4.equalsEpsilon(this.l,c.viewMatrix,1E-5)||(this.j=a);var d=b.globe._surface,d=!d._tileProvider.ready||0<d._tileLoadQueue.length||0<d._debug.tilesWaitingForChildren,b=b.tweens;1E3>a-this.j||d||0!=b.length||(this.h&&console.log("stopping rendering @ "+Date.now()),this.c.Y(!0),this.g=!0);Cesium.Matrix4.clone(c.viewMatrix,this.l)};x.prototype.s=function(){this.a()};
x.prototype.a=function(){this.h&&this.g&&console.log("starting rendering @ "+Date.now());Date.now();this.c.Y(!1);this.g=!1};x.prototype.qa=function(a){this.h=a};var sa=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function ta(a){if(!ua.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(va,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(wa,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(xa,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(ya,"&quot;"));-1!=a.indexOf("'")&&(a=a.replace(za,"&#39;"));-1!=a.indexOf("\x00")&&(a=a.replace(Aa,"&#0;"));return a}var va=/&/g,wa=/</g,xa=/>/g,ya=/"/g,za=/'/g,Aa=/\x00/g,ua=/[\x00&<>"']/;
function Ba(a,b){return a<b?-1:a>b?1:0};function Ca(){};var A=Array.prototype;function Da(a,b){A.forEach.call(a,b,void 0)}function Ea(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]}function Fa(a,b){a.sort(b||Ga)}function Ha(a,b){for(var c=0;c<a.length;c++)a[c]={index:c,value:a[c]};var d=b||Ga;Fa(a,function(a,b){return d(a.value,b.value)||a.index-b.index});for(c=0;c<a.length;c++)a[c]=a[c].value}function Ga(a,b){return a>b?1:a<b?-1:0};var B;a:{var Ia=m.navigator;if(Ia){var Ja=Ia.userAgent;if(Ja){B=Ja;break a}}B=""}function C(a){return-1!=B.indexOf(a)};var Ka=C("Opera")||C("OPR"),D=C("Trident")||C("MSIE"),La=C("Edge"),E=C("Gecko")&&!(-1!=B.toLowerCase().indexOf("webkit")&&!C("Edge"))&&!(C("Trident")||C("MSIE"))&&!C("Edge"),G=-1!=B.toLowerCase().indexOf("webkit")&&!C("Edge");G&&C("Mobile");C("Macintosh");C("Windows");C("Linux")||C("CrOS");var Ma=m.navigator||null;Ma&&(Ma.appVersion||"").indexOf("X11");C("Android");!C("iPhone")||C("iPod")||C("iPad");C("iPad");
function Na(){var a=B;if(E)return/rv\:([^\);]+)(\)|;)/.exec(a);if(La)return/Edge\/([\d\.]+)/.exec(a);if(D)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(G)return/WebKit\/(\S+)/.exec(a)}function Oa(){var a=m.document;return a?a.documentMode:void 0}var Pa=function(){if(Ka&&m.opera){var a=m.opera.version;return"function"==p(a)?a():a}var a="",b=Na();b&&(a=b?b[1]:"");return D&&(b=Oa(),b>parseFloat(a))?String(b):a}(),Qa={};
function H(a){var b;if(!(b=Qa[a])){b=0;for(var c=sa(String(Pa)).split("."),d=sa(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",l=RegExp("(\\d*)(\\D*)","g"),r=RegExp("(\\d*)(\\D*)","g");do{var z=l.exec(g)||["","",""],F=r.exec(h)||["","",""];if(0==z[0].length&&0==F[0].length)break;b=Ba(0==z[1].length?0:parseInt(z[1],10),0==F[1].length?0:parseInt(F[1],10))||Ba(0==z[2].length,0==F[2].length)||Ba(z[2],F[2])}while(0==b)}b=Qa[a]=0<=b}return b}
var Ra=m.document,Sa=Ra&&D?Oa()||("CSS1Compat"==Ra.compatMode?parseInt(Pa,10):5):void 0;var Ta=!D||9<=Sa,Ua=D&&!H("9");!G||H("528");E&&H("1.9b")||D&&H("8")||Ka&&H("9.5")||G&&H("528");E&&!H("8")||D&&H("9");function I(){0!=Va&&t(this);this.h=this.h;this.H=this.H}var Va=0;I.prototype.h=!1;function J(a,b){this.type=a;this.a=this.target=b}J.prototype.b=function(){};function Wa(a){Wa[" "](a);return a}Wa[" "]=function(){};function K(a,b){J.call(this,a?a.type:"");this.c=this.state=this.a=this.target=null;if(a){this.type=a.type;this.target=a.target||a.srcElement;this.a=b;var c=a.relatedTarget;if(c&&E)try{Wa(c.nodeName)}catch(d){}this.state=a.state;this.c=a;a.defaultPrevented&&this.b()}}v(K,J);K.prototype.b=function(){K.Qa.b.call(this);var a=this.c;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Ua)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var L="closure_listenable_"+(1E6*Math.random()|0),Xa=0;function Ya(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.M=!!d;this.O=e;++Xa;this.G=this.L=!1}function Za(a){a.G=!0;a.listener=null;a.proxy=null;a.src=null;a.O=null};function M(a){this.src=a;this.a={};this.b=0}M.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=$a(a,b,d,e);-1<g?(b=a[g],c||(b.L=!1)):(b=new Ya(b,this.src,f,!!d,e),b.L=c,a.push(b));return b};M.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=$a(e,b,c,d);return-1<b?(Za(e[b]),A.splice.call(e,b,1),0==e.length&&(delete this.a[a],this.b--),!0):!1};
function cb(a,b){var c=b.type;if(c in a.a){var d=a.a[c],e=A.indexOf.call(d,b,void 0),f;(f=0<=e)&&A.splice.call(d,e,1);f&&(Za(b),0==a.a[c].length&&(delete a.a[c],a.b--))}}function $a(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.G&&f.listener==b&&f.M==!!c&&f.O==d)return e}return-1};var db="closure_lm_"+(1E6*Math.random()|0),eb={},fb=0;function gb(a,b,c,d,e){if("array"==p(b)){for(var f=0;f<b.length;f++)gb(a,b[f],c,d,e);return null}c=hb(c);return a&&a[L]?a.l(b,c,d,e):ib(a,b,c,!1,d,e)}
function ib(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=!!e,h=N(a);h||(a[db]=h=new M(a));c=h.add(b,c,d,e,f);if(c.proxy)return c;d=jb();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(kb(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");fb++;return c}
function jb(){var a=lb,b=Ta?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b}function mb(a,b,c,d,e){if("array"==p(b))for(var f=0;f<b.length;f++)mb(a,b[f],c,d,e);else c=hb(c),a&&a[L]?a.C.add(String(b),c,!0,d,e):ib(a,b,c,!0,d,e)}
function nb(a,b,c,d,e){if("array"==p(b))for(var f=0;f<b.length;f++)nb(a,b[f],c,d,e);else(c=hb(c),a&&a[L])?a.C.remove(String(b),c,d,e):a&&(a=N(a))&&(b=a.a[b.toString()],a=-1,b&&(a=$a(b,c,!!d,e)),(c=-1<a?b[a]:null)&&O(c))}function O(a){if("number"!=typeof a&&a&&!a.G){var b=a.src;if(b&&b[L])cb(b.C,a);else{var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.M):b.detachEvent&&b.detachEvent(kb(c),d);fb--;(c=N(b))?(cb(c,a),0==c.b&&(c.src=null,b[db]=null)):Za(a)}}}
function kb(a){return a in eb?eb[a]:eb[a]="on"+a}function ob(a,b,c,d){var e=!0;if(a=N(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.M==c&&!f.G&&(f=pb(f,d),e=e&&!1!==f)}return e}function pb(a,b){var c=a.listener,d=a.O||a.src;a.L&&O(a);return c.call(d,b)}
function lb(a,b){if(a.G)return!0;if(!Ta){var c;if(!(c=b))a:{c=["window","event"];for(var d=m,e;e=c.shift();)if(null!=d[e])d=d[e];else{c=null;break a}c=d}e=c;c=new K(e,this);d=!0;if(!(0>e.keyCode||void 0!=e.returnValue)){a:{var f=!1;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(l){f=!0}if(f||void 0==e.returnValue)e.returnValue=!0}e=[];for(f=c.a;f;f=f.parentNode)e.push(f);for(var f=a.type,g=e.length-1;0<=g;g--){c.a=e[g];var h=ob(e[g],f,!0,c),d=d&&h}for(g=0;g<e.length;g++)c.a=e[g],h=ob(e[g],f,!1,c),
d=d&&h}return d}return pb(a,new K(b,this))}function N(a){a=a[db];return a instanceof M?a:null}var qb="__closure_events_fn_"+(1E9*Math.random()>>>0);function hb(a){if("function"==p(a))return a;a[qb]||(a[qb]=function(b){return a.handleEvent(b)});return a[qb]};function rb(a){var b;b=b||0;return function(){return a.apply(this,Array.prototype.slice.call(arguments,0,b))}};function P(a,b,c){I.call(this);this.a=null;this.g=!1;this.l=a;this.j=c;this.b=b||window;this.c=ga(this.i,this)}v(P,I);P.prototype.start=function(){sb(this);this.g=!1;var a=tb(this),b=ub(this);a&&!b&&this.b.mozRequestAnimationFrame?(this.a=gb(this.b,"MozBeforePaint",this.c),this.b.mozRequestAnimationFrame(null),this.g=!0):this.a=a&&b?a.call(this.b,this.c):this.b.setTimeout(rb(this.c),20)};
function sb(a){if(null!=a.a){var b=tb(a),c=ub(a);b&&!c&&a.b.mozRequestAnimationFrame?O(a.a):b&&c?c.call(a.b,a.a):a.b.clearTimeout(a.a)}a.a=null}P.prototype.i=function(){this.g&&this.a&&O(this.a);this.a=null;this.l.call(this.j,ha())};function tb(a){a=a.b;return a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||null}
function ub(a){a=a.b;return a.cancelAnimationFrame||a.cancelRequestAnimationFrame||a.webkitCancelRequestAnimationFrame||a.mozCancelRequestAnimationFrame||a.oCancelRequestAnimationFrame||a.msCancelRequestAnimationFrame||null};function Q(a,b){this.a=a;this.b=null;this.l=n(b)?b:null;this.h=!1;this.j=new Cesium.Event;this.c=document.createElement(vb);this.c.width=1;this.c.height=1;this.a.on("change",function(){wb(this)},this);wb(this)}
Object.defineProperties(Q.prototype,{ready:{get:function(){return this.h}},rectangle:{get:function(){return this.s}},tileWidth:{get:function(){var a=this.a.getTileGrid();return null===a?256:a.getTileSize(0)}},tileHeight:{get:function(){return this.tileWidth}},maximumLevel:{get:function(){var a=this.a.getTileGrid();return null===a?18:a.getMaxZoom()}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this.g}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this.j}},
credit:{get:function(){return this.i}},proxy:{get:function(){}},hasAlphaChannel:{get:function(){return!0}},Ua:{get:function(){}}});function wb(a){if(!a.h&&"ready"==a.a.getState()){var b=a.a.getProjection();a.b=null!=b?b:a.l;if(a.b==ol.proj.get("EPSG:4326"))a.g=new Cesium.GeographicTilingScheme;else if(a.b==ol.proj.get("EPSG:3857"))a.g=new Cesium.WebMercatorTilingScheme;else return;a.s=a.g.rectangle;b=xb(a.a);a.i=null===b?void 0:b;a.h=!0}}
function xb(a){var b="",c=a.getAttributions();null===c||c.forEach(function(a){b+=a.getHTML().replace(/<\/?[^>]+(>|$)/g,"")+" "});var d,e;0==b.length&&(a=a.getLogo(),n(a)&&("string"==typeof a?d=a:(d=a.src,e=a.href)));return n(d)||0<b.length?new Cesium.Credit(b,d,e):null}Q.prototype.getTileCredits=function(){};Q.prototype.getTileCredits=Q.prototype.getTileCredits;
Q.prototype.requestImage=function(a,b,c){var d=this.a.getTileUrlFunction();if(null===d||null===this.b)return this.c;a=d([this.g instanceof Cesium.GeographicTilingScheme?c+1:c,a,-b-1],1,this.b);return n(a)?Cesium.ImageryProvider.loadImage(this,a):this.c};Q.prototype.requestImage=Q.prototype.requestImage;function yb(a,b,c,d,e){var f=Cesium.Math.clamp,g=Cesium.defaultValue;e=e||{};var h=g(e.duration,500),l=g(e.easing,ol.easing.linear),r=e.callback,z=ha(),F=0,ab=new Cesium.Matrix4,bb=new P(function(e){e=l(f((e-z)/h,0,1));a.transform.clone(ab);var g=(e-F)*b;F=e;a.lookAtTransform(d);a.rotate(c,g);a.lookAtTransform(ab);1>e?bb.start():r&&r()});bb.start()}function zb(a,b){var c=a.camera.getPickRay(b);return a.globe.pick(c,a)||a.camera.pickEllipsoid(b)}
function Ab(a){var b=a.canvas,b=new Cesium.Cartesian2(b.clientWidth/2,b.clientHeight/2);return zb(a,b)}function Bb(a,b,c){var d=new Cesium.Cartesian3,e=new Cesium.Cartesian3,f=new Cesium.Cartesian3;Cesium.Cartesian3.normalize(a,d);Cesium.Cartesian3.normalize(b,e);Cesium.Cartesian3.cross(d,e,f);a=Cesium.Cartesian3.dot(d,e);b=Cesium.Cartesian3.magnitude(f);c=Cesium.Cartesian3.dot(c,f);f=Math.atan2(b,a);return 0<=c?f:-f}
function Cb(a,b){var c=a.camera,d=c.frustum.fovy/2,e;e=a.camera;var f=e.direction,g=Cesium.Quaternion.fromAxisAngle(e.right,e.frustum.fovy/2),g=Cesium.Matrix3.fromQuaternion(g),h=new Cesium.Cartesian3;Cesium.Matrix3.multiplyByVector(g,f,h);e=new Cesium.Ray(e.position,h);e=Cesium.Cartesian3.clone(e.direction);Cesium.Cartesian3.negate(e,e);f=new Cesium.Cartesian3;Cesium.Ellipsoid.WGS84.geocentricSurfaceNormal(b,f);g=new Cesium.Cartesian3;Cesium.Cartesian3.negate(c.right,g);return Bb(f,e,g)+d}
function Db(a,b,c){n(c)&&(c=c.getHeight(b),b.height=n(c)?c:0);c=Cesium.Ellipsoid.WGS84;b=c.cartographicToCartesian(b);var d=a.position,e=new Cesium.Cartesian3;c.geocentricSurfaceNormal(d,e);a.lookAt(d,b,e)}function Eb(a,b){if(null===a||null===b)return null;var c=ol.proj.transformExtent(a,b,"EPSG:4326");return Cesium.Rectangle.fromDegrees(c[0],c[1],c[2],c[3])}
function Fb(a,b){if(!(a instanceof ol.layer.Tile))return null;var c=null,c=a.getSource();if(!(c instanceof ol.source.WMTS)&&c instanceof ol.source.TileImage){var d=c.getProjection();if(null===d)d=b;else if(d!==b)return null;var e=d===ol.proj.get("EPSG:3857"),d=d===ol.proj.get("EPSG:4326");if(e||d)c=new Q(c,b);else return null}else return null;e={};d=a.getExtent();null!=d&&null!==b&&(e.rectangle=Eb(d,b));return new Cesium.ImageryLayer(c,e)}
function Gb(a,b){var c=a.getOpacity();n(c)&&(b.alpha=c);c=a.getVisible();n(c)&&(b.show=c)}function R(a){return 2<a.length?Cesium.Cartesian3.fromDegrees(a[0],a[1],a[2]):Cesium.Cartesian3.fromDegrees(a[0],a[1])}function Hb(a){for(var b=[],c=0;c<a.length;++c)b.push(R(a[c]));return b}function S(a,b){var c=ol.proj.get("EPSG:4326"),d=ol.proj.get(b);if(d!==c){var e=a.getProperties();a=a.clone();a.transform(d,c);a.setProperties(e)}return a}
function Ib(a){a=a||"black";if(Array.isArray(a))return new Cesium.Color(Cesium.Color.byteToFloat(a[0]),Cesium.Color.byteToFloat(a[1]),Cesium.Color.byteToFloat(a[2]),a[3]);if("string"==typeof a)return Cesium.Color.fromCssColorString(a)};function T(a,b){this.f=a;this.b=a.camera;this.o=b;this.j=this.a=null;this.h=this.c=Jb;this.g=this.i=0;this.s=null;this.l=!1;this.o.on("change:view",function(){Kb(this,this.o.getView())},this);Kb(this,this.o.getView())}function Jb(a,b,c){c=c||a.length;if(b)for(var d=0;d<c;++d)b[d]=a[d];return a}
function Kb(a,b){null!==a.a&&(ol.Observable.unByKey(a.j),a.j=null);a.a=b;if(null===b)a.c=Jb,a.h=Jb;else{var c=ol.proj.getTransform(b.getProjection(),"EPSG:4326"),d=ol.proj.getTransform("EPSG:4326",b.getProjection());a.c=c;a.h=d;a.j=b.on("propertychange",a.Ba,a);a.K()}}k=T.prototype;k.Ba=function(){this.l||this.K()};k.Na=function(a){null===this.a||this.a.setRotation(a)};k.Da=function(){if(null!==this.a){var a=this.a.getRotation();return n(a)?a:0}};k.Pa=function(a){this.i=a;Lb(this)};k.Aa=function(){return this.i};
k.La=function(a){this.g=a;Lb(this);this.B()};k.xa=function(){return this.g};k.Ga=function(a){null===this.a||this.a.setCenter(a)};k.getCenter=function(){return null===this.a?void 0:this.a.getCenter()};k.Ha=function(a){null!==this.c&&(a=this.c(a),a=new Cesium.Cartographic(a[0]*Math.PI/180,a[1]*Math.PI/180,this.ja()),this.b.position=Cesium.Ellipsoid.WGS84.cartographicToCartesian(a),this.B())};
k.Ea=function(){if(null!==this.h){var a=Cesium.Ellipsoid.WGS84.cartesianToCartographic(this.b.position);return this.h([180*a.longitude/Math.PI,180*a.latitude/Math.PI])}};k.Ka=function(a){var b=Cesium.Ellipsoid.WGS84.cartesianToCartographic(this.b.position);b.height=a;this.b.position=Cesium.Ellipsoid.WGS84.cartographicToCartesian(b);this.B()};k.ja=function(){return Cesium.Ellipsoid.WGS84.cartesianToCartographic(this.b.position).height};
k.Fa=function(a){null!==this.c&&(a=this.c(a),a=Cesium.Cartographic.fromDegrees(a[0],a[1]),Db(this.b,a,this.f.globe),this.B())};
function Lb(a){if(null!==a.a&&null!==a.c){var b=a.a.getCenter();if(b){b=a.c(b);b=new Cesium.Cartographic(b[0]*Math.PI/180,b[1]*Math.PI/180);if(a.f.globe){var c=a.f.globe.getHeight(b);b.height=n(c)?c:0}b=Cesium.Ellipsoid.WGS84.cartographicToCartesian(b);c={pitch:a.i-Cesium.Math.PI_OVER_TWO,heading:-a.a.getRotation(),roll:void 0};a.b.setView({destination:b,orientation:c});a.b.moveBackward(a.g);Mb(a,!0)}}}
k.K=function(){if(null!==this.a&&null!==this.c){var a=this.a.getCenter();if(null!=a){var b=this.c(a),a=this.a.getResolution(),a=n(a)?a:0,b=b[1]*Math.PI/180,c=this.f.canvas,d=this.b.frustum.fovy,e=this.a.getProjection().getMetersPerUnit();this.g=a*c.clientHeight*e*Math.cos(Math.abs(b))/2/Math.tan(d/2);Lb(this)}}};
k.B=function(){if(null!==this.a&&null!==this.h){this.l=!0;var a=Cesium.Ellipsoid.WGS84,b=this.f,c=Ab(b),d=c;d||(d=b.globe,b=this.b.positionCartographic.clone(),d=d.getHeight(b),b.height=n(d)?d:0,d=Cesium.Ellipsoid.WGS84.cartographicToCartesian(b));this.g=Cesium.Cartesian3.distance(d,this.b.position);b=a.cartesianToCartographic(d);this.a.setCenter(this.h([180*b.longitude/Math.PI,180*b.latitude/Math.PI]));this.a.setResolution(Nb(this,this.g,b?b.latitude:0));if(c){d=this.b.position;b=new Cesium.Cartesian3;
a.geocentricSurfaceNormal(c,b);a=new Cesium.Cartesian3;Cesium.Cartesian3.subtract(d,c,a);Cesium.Cartesian3.normalize(a,a);var d=this.b.up,e=this.b.right,f=new Cesium.Cartesian3(-c.y,c.x,0),e=Cesium.Cartesian3.angleBetween(e,f),c=Cesium.Cartesian3.cross(c,d,new Cesium.Cartesian3).z;this.a.setRotation(0>c?e:-e);c=Math.acos(Cesium.Cartesian3.dot(b,a));this.i=isNaN(c)?0:c}else this.a.setRotation(this.b.heading),this.i=-this.b.pitch+Math.PI/2;this.l=!1}};
function Mb(a,b){var c=a.s,d=a.b.viewMatrix;c&&Cesium.Matrix4.equalsEpsilon(c,d,1E-5)||(a.s=d.clone(),!0!==b&&a.B())}function Nb(a,b,c){var d=a.f.canvas,e=a.b.frustum.fovy;a=a.a.getProjection().getMetersPerUnit();return 2*b*Math.tan(e/2)/a/Math.cos(Math.abs(c))/d.clientHeight};function Ob(a,b){var c=new Cesium.BillboardCollection({scene:b}),d=new Cesium.PrimitiveCollection;this.b=[];this.a=new Cesium.PrimitiveCollection;this.c={projection:a,billboards:c,featureToCesiumMap:{},primitives:d};this.a.add(c);this.a.add(d)}Ob.prototype.destroy=function(){this.b.forEach(ol.Observable.unByKey);this.b.length=0};function U(){I.call(this);this.C=new M(this);this.s=this}v(U,I);U.prototype[L]=!0;U.prototype.removeEventListener=function(a,b,c,d){nb(this,a,b,c,d)};function Pb(a,b){var c=a.s,d=b,e=d.type||d;if(q(d))d=new J(d,c);else if(d instanceof J)d.target=d.target||c;else{var f=d,d=new J(e,c);ka(d,f)}c=d.a=c;Qb(c,e,!0,d);Qb(c,e,!1,d)}U.prototype.l=function(a,b,c,d){return this.C.add(String(a),b,!1,c,d)};
function Qb(a,b,c,d){if(b=a.C.a[String(b)]){b=b.concat();for(var e=!0,f=0;f<b.length;++f){var g=b[f];if(g&&!g.G&&g.M==c){var h=g.listener,l=g.O||g.src;g.L&&cb(a.C,g);e=!1!==h.call(l,d)&&e}}}};function V(a){a=n(a)?a:{};U.call(this);this.b=this.f=null;this.a=new Cesium.RectanglePrimitive({asynchronous:!1,rectangle:new Cesium.Rectangle,material:Cesium.Material.fromType(Cesium.Material.ColorType)});this.a.material.uniforms.color=new Cesium.Color(0,0,1,.5);this.c=n(a.Ca)?a.Ca:Cesium.KeyboardEventModifier.SHIFT;this.g=null}v(V,U);
V.prototype.D=function(a){var b=this.f.globe.ellipsoid;a=this.f.camera.getPickRay(a.position);a=this.f.globe.pick(a,this.f);n(a)&&(this.b.setInputAction(this.i.bind(this),Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.b.setInputAction(this.j.bind(this),Cesium.ScreenSpaceEventType.LEFT_UP),n(this.c)&&(this.b.setInputAction(this.i.bind(this),Cesium.ScreenSpaceEventType.MOUSE_MOVE,this.c),this.b.setInputAction(this.j.bind(this),Cesium.ScreenSpaceEventType.LEFT_UP,this.c)),b=b.cartesianToCartographic(a),
a=this.a.rectangle,a.north=a.south=b.latitude,a.east=a.west=b.longitude,this.a.height=b.height,this.a.show=!0,Pb(this,{type:"boxstart",position:b}),this.f.primitives.contains(this.a)||this.f.primitives.add(this.a),this.f.screenSpaceCameraController.enableInputs=!1,this.g=b)};
V.prototype.i=function(a){var b=this.f.globe.ellipsoid;a=this.f.camera.getPickRay(a.endPosition);a=this.f.globe.pick(a,this.f);n(a)&&(b=b.cartesianToCartographic(a),this.a.height=Math.max(this.a.height,b.height),b.latitude<this.g.latitude?this.a.rectangle.south=b.latitude:this.a.rectangle.north=b.latitude,b.longitude<this.g.longitude?this.a.rectangle.west=b.longitude:this.a.rectangle.east=b.longitude)};
V.prototype.j=function(a){var b=this.f.globe.ellipsoid;a=this.f.camera.getPickRay(a.position);a=this.f.globe.pick(a,this.f);n(a)&&(b=b.cartesianToCartographic(a),this.a.show=!1,Pb(this,{type:"boxend",position:b}),this.b.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP),this.b.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE),n(this.c)&&(this.b.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP,this.c),this.b.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE,this.c)));this.f.screenSpaceCameraController.enableInputs=
!0};V.prototype.$=function(a){null===a?(this.f.primitives.contains(this.a)&&this.f.primitives.remove(this.a),null!==this.b&&(this.b.destroy(),this.b=null)):(this.b=new Cesium.ScreenSpaceEventHandler(a.canvas),this.b.setInputAction(this.D.bind(this),Cesium.ScreenSpaceEventType.LEFT_DOWN,this.c));this.f=a};function W(a){this.scene=a;this.a=this.Ja.bind(this)}k=W.prototype;k.Ja=function(a){var b=a.target,c=b.olcs_cancellers;if(c)if(a=a.feature,n(a)){var b=t(a),d=c[b];d&&(d(),delete c[b])}else{for(d in c)if(c.hasOwnProperty(d))c[d]();b.olcs_cancellers={}}};
function Rb(a,b,c,d,e,f,g){var h={flat:!0,renderState:{depthTest:{enabled:!0}}};n(g)&&(h.renderState||(h.renderState={}),h.renderState.lineWidth=g);e=new Cesium.GeometryInstance({geometry:e,attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(f)}});a.N(b,c,d)==Cesium.HeightReference.CLAMP_TO_GROUND?a=new Cesium.GroundPrimitive({geometryInstance:e}):(a=new Cesium.PerInstanceColorAppearance(h),a=new Cesium.Primitive({geometryInstances:e,appearance:a}));d=a;d.olLayer=b;d.olFeature=c;return a}
function X(a,b){var c=a.getFill()?a.getFill().getColor():null,d=a.getStroke()?a.getStroke().getColor():null,e="black";d&&b?e=d:c&&(e=c);return Ib(e)}function Sb(a,b){var c=b.getStroke()?b.getStroke().getWidth():1;return Math.min(c,a.scene.maximumAliasedLineWidth)}function Tb(a,b,c,d,e,f,g){var h=X(g,!1),l=X(g,!0),r=new Cesium.PrimitiveCollection;g.getFill()&&(e=Rb(a,b,c,d,e,h),r.add(e));g.getStroke()&&(g=Sb(a,g),e=Rb(a,b,c,d,f,l,g),r.add(e));return r}
function Y(a,b,c,d,e,f){var g;f instanceof Cesium.PrimitiveCollection?g=f:(g=new Cesium.PrimitiveCollection,g.add(f));if(!e.getText())return g;e=e.getText();(a=a.fa(b,c,d,e))&&g.add(a);return g}k.ca=function(a,b,c,d){a=a.add(b);a.olLayer=c;a.olFeature=d;return a};
k.ea=function(a,b,c,d,e){c=S(c,d);d=c.getCenter();var f=3==d.length?d[2]:0,g=d.slice();g[0]+=c.getRadius();d=R(d);var g=R(g),h=Cesium.Cartesian3.distance(d,g),g=new Cesium.CircleGeometry({center:d,radius:h,height:f});d=new Cesium.CircleOutlineGeometry({center:d,radius:h,extrudedHeight:f,height:f});d=Tb(this,a,b,c,g,d,e);return Y(this,a,b,c,e,d)};
k.U=function(a,b,c,d,e){c=S(c,d);var f=Hb(c.getCoordinates());d=new Cesium.PolylineMaterialAppearance({material:this.ha(0,e,!0)});f=new Cesium.PolylineGeometry({positions:f,width:Sb(this,e),vertexFormat:d.vertexFormat});d=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:f}),appearance:d});d.olLayer=a;d.olFeature=b;return Y(this,a,b,c,e,d)};
k.V=function(a,b,c,d,e){c=S(c,d);for(var f=c.getLinearRings(),g=d={},h=0;h<f.length;++h){var l=f[h].getCoordinates(),l=Hb(l);0==h?d.positions=l:(d.holes={positions:l},d=d.holes)}f=new Cesium.PolygonGeometry({polygonHierarchy:g,perPositionHeight:!0});d=new Cesium.PolygonOutlineGeometry({polygonHierarchy:d,perPositionHeight:!0});d=Tb(this,a,b,c,f,d,e);return Y(this,a,b,c,e,d)};
k.N=function(a,b,c){c=c.get("altitudeMode");n(c)||(c=b.get("altitudeMode"));n(c)||(c=a.get("altitudeMode"));a=Cesium.HeightReference.NONE;"clampToGround"===c?a=Cesium.HeightReference.CLAMP_TO_GROUND:"relativeToGround"===c&&(a=Cesium.HeightReference.RELATIVE_TO_GROUND);return a};
k.R=function(a,b,c,d,e,f,g){c=S(c,d);var h=e.getImage();if(h){h instanceof ol.style.Icon&&h.load();var l=h.getImage(1),r=function(){if(null!==l&&(l instanceof HTMLCanvasElement||l instanceof Image||l instanceof HTMLImageElement)){var d=c.getCoordinates(),d=R(d),e,r=h.getOpacity();n(r)&&(e=new Cesium.Color(1,1,1,r));r=this.N(a,b,c);e={image:l,scale:h.getScale(),color:e,heightReference:r,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,position:d};e=this.ca(f,e,a,b);g&&g(e)}}.bind(this);if(l instanceof Image&&
(""==l.src||0==l.naturalHeight||0==l.naturalWidth||!l.complete)){var z=!1;d=a.getSource();d instanceof ol.source.ImageVector&&(d=d.getSource());d.on(["removefeature","clear"],this.a);d.olcs_cancellers=d.olcs_cancellers||{};d.olcs_cancellers[t(b)]=function(){z=!0};mb(l,"load",function(){f.isDestroyed()||z||r()})}else r()}return e.getText()?Y(this,a,b,c,e,new Cesium.Primitive):null};
k.ga=function(a,b,c,d,e,f,g){function h(c,f){var g=new Cesium.PrimitiveCollection;c.forEach(function(c){g.add(f(a,b,c,d,e))});return g}switch(c.getType()){case "MultiPoint":c=c.getPoints();if(e.getText()){var l=new Cesium.PrimitiveCollection;c.forEach(function(c){(c=this.R(a,b,c,d,e,f,g))&&l.add(c)}.bind(this));return l}c.forEach(function(c){this.R(a,b,c,d,e,f,g)});return null;case "MultiLineString":return c=c.getLineStrings(),h(c,this.U.bind(this));case "MultiPolygon":return c=c.getPolygons(),h(c,
this.V.bind(this));default:Ca("Unhandled multi geometry type"+c.getType())}};
k.fa=function(a,b,c,d){var e=d.getText(),f=new Cesium.LabelCollection({scene:this.scene}),g=ol.extent.getCenter(c.getExtent());if(c instanceof ol.geom.SimpleGeometry){var h=c.getFirstCoordinate();g[2]=3==h.length?h[2]:0}h={};h.position=R(g);h.text=e;h.heightReference=this.N(a,b,c);c=d.getOffsetX();e=d.getOffsetY();0!=c&&0!=e&&(c=new Cesium.Cartesian2(c,e),h.pixelOffset=c);c=d.getFont();null!=c&&(h.font=c);c=void 0;d.getFill()&&(h.fillColor=X(d,!1),c=Cesium.LabelStyle.FILL);d.getStroke()&&(h.outlineWidth=
Sb(this,d),h.outlineColor=X(d,!0),c=Cesium.LabelStyle.OUTLINE);d.getFill()&&d.getStroke()&&(c=Cesium.LabelStyle.FILL_AND_OUTLINE);h.style=c;switch(d.getTextAlign()){case "left":c=Cesium.HorizontalOrigin.LEFT;break;case "right":c=Cesium.HorizontalOrigin.RIGHT;break;default:c=Cesium.HorizontalOrigin.CENTER}h.horizontalOrigin=c;if(d.getTextBaseline()){var l;switch(d.getTextBaseline()){case "top":l=Cesium.VerticalOrigin.TOP;break;case "middle":l=Cesium.VerticalOrigin.CENTER;break;case "bottom":l=Cesium.VerticalOrigin.BOTTOM;
break;case "alphabetic":l=Cesium.VerticalOrigin.TOP;break;case "hanging":l=Cesium.VerticalOrigin.BOTTOM;break;default:d.getTextBaseline()}h.verticalOrigin=l}d=f.add(h);d.olLayer=a;d.olFeature=b;return f};k.ha=function(a,b,c){a=b.getFill();b=b.getStroke();if(c&&!b||!c&&!a)return null;a=c?b.getColor():a.getColor();a=Ib(a);return c&&b.getLineDash()?Cesium.Material.fromType("Stripe",{horizontal:!1,repeat:500,evenColor:a,oddColor:new Cesium.Color(0,0,0,0)}):Cesium.Material.fromType("Color",{color:a})};
k.S=function(a,b,c,d){a=b.getStyleFunction();var e=null;a&&(e=a.call(b,d));!e&&c&&(e=c(b,d));return e?Array.isArray(e)?e[0]:e:null};
k.P=function(a,b,c,d,e){function f(a){d.featureToCesiumMap[t(b)]=a}e=e||b.getGeometry();var g=d.projection;if(!e)return null;switch(e.getType()){case "GeometryCollection":var h=new Cesium.PrimitiveCollection;e.getGeometries().forEach(function(e){e&&(e=this.P(a,b,c,d,e))&&h.add(e)}.bind(this));return h;case "Point":return(e=this.R(a,b,e,g,c,d.billboards,f))?e:null;case "Circle":return this.ea(a,b,e,g,c);case "LineString":return this.U(a,b,e,g,c);case "Polygon":return this.V(a,b,e,g,c);case "MultiPoint":case "MultiLineString":case "MultiPolygon":return(e=
this.ga(a,b,e,g,c,d.billboards,f))?e:null;case "LinearRing":throw Error("LinearRing should only be part of polygon.");default:throw Error("Ol geom type not handled : "+e.getType());}};
k.ia=function(a,b,c){var d=a.getSource();d instanceof ol.source.ImageVector&&(d=d.getSource());var d=d.getFeatures(),e=b.getProjection();b=b.getResolution();if(!n(b)||!e)throw Error("View not ready");for(var e=new Ob(e,this.scene),f=e.c,g=0;g<d.length;++g){var h=d[g];if(null!=h){var l;a instanceof ol.layer.Image?l=a.getSource().getStyleFunction():l=a.getStyleFunction();var r=this.S(0,h,l,b);r&&(r=this.P(a,h,r,f))&&(c[t(h)]=r,e.a.add(r))}}return e};
k.convert=function(a,b,c,d){var e=b.getProjection();b=b.getResolution();if(!n(b)||!e)return null;var f;a instanceof ol.layer.Image?f=a.getSource().getStyleFunction():f=a.getStyleFunction();f=this.S(0,c,f,b);if(!f)return null;d.projection=e;return this.P(a,c,f,d)};var Ub=!D||9<=Sa;!E&&!D||D&&9<=Sa||E&&H("1.9.1");D&&H("9");var vb="CANVAS";function Vb(a){var b=document;return q(a)?b.getElementById(a):a}
function Wb(a){var b=a||document,c=null;if(b.getElementsByClassName)c=b.getElementsByClassName("ol-overlaycontainer")[0];else if(b.querySelectorAll&&b.querySelector)c=b.querySelector(".ol-overlaycontainer");else{var d,b=document;a=a||b;if(a.querySelectorAll&&a.querySelector)a=a.querySelectorAll(".ol-overlaycontainer");else if(a.getElementsByClassName){var e=a.getElementsByClassName("ol-overlaycontainer");a=e}else{e=a.getElementsByTagName("*");d={};for(b=c=0;a=e[b];b++){var f=a.className,g;if(g="function"==
typeof f.split)g=0<=A.indexOf.call(f.split(/\s+/),"ol-overlaycontainer",void 0);g&&(d[c++]=a)}d.length=c;a=d}c=a[0]}return c||null}function Xb(a,b){ia(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:Yb.hasOwnProperty(d)?a.setAttribute(Yb[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})}
var Yb={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};
function Zb(a,b,c){var d=arguments,e=document,f=d[0],g=d[1];if(!Ub&&g&&(g.name||g.type)){f=["<",f];g.name&&f.push(' name="',ta(g.name),'"');if(g.type){f.push(' type="',ta(g.type),'"');var h={};ka(h,g);delete h.type;g=h}f.push(">");f=f.join("")}f=e.createElement(f);g&&(q(g)?f.className=g:"array"==p(g)?f.className=g.join(" "):Xb(f,g));2<d.length&&$b(e,f,d);return f}
function $b(a,b,c){function d(c){c&&b.appendChild(q(c)?a.createTextNode(c):c)}for(var e=2;e<c.length;e++){var f=c[e];if(!aa(f)||ba(f)&&0<f.nodeType)d(f);else{var g;a:{if(f&&"number"==typeof f.length){if(ba(f)){g="function"==typeof f.item||"string"==typeof f.item;break a}if("function"==p(f)){g="function"==typeof f.item;break a}}g=!1}Da(g?Ea(f):f,d)}}}function ac(a){if(n(a.nextElementSibling))a=a.nextElementSibling;else for(a=a.nextSibling;a&&1!=a.nodeType;)a=a.nextSibling;return a};function bc(a,b){this.u=b.imageryLayers;this.F=new Cesium.ImageryLayerCollection;w.call(this,a,b)}v(bc,w);k=bc.prototype;k.aa=function(a){this.u.add(a);this.F.add(a)};k.da=function(a){a.destroy()};k.la=function(a,b){this.u.remove(a,b);this.F.remove(a,!1)};k.ka=function(a){for(var b=0;b<this.F.length;++b)this.u.remove(this.F.get(b),a);this.F.removeAll(!1)};function cc(a,b){var c=Fb(a,b);return c?[c]:null}
k.T=function(a){var b=this.i.getProjection(),c=cc(a,b);if(null!==c){a.on(["change:opacity","change:visible"],function(){for(var b=0;b<c.length;++b)Gb(a,c[b])});for(b=0;b<c.length;++b)Gb(a,c[b]);a.on("change:extent",function(){for(var b=0;b<c.length;++b)this.u.remove(c[b],!0),this.F.remove(c[b],!1);delete this.A[t(a)];this.Z()},this);a.on("change",function(){for(var a=0;a<c.length;++a){var b=this.u.indexOf(c[a]);0<=b&&(this.u.remove(c[a],!1),this.u.add(c[a],b))}},this)}return Array.isArray(c)?c:null};
k.W=function(){for(var a=[],b={},c=[this.b];0<c.length;){var d=c.splice(0,1)[0];a.push(d);b[t(d)]=d.getZIndex();d instanceof ol.layer.Group&&(d=d.getLayers())&&c.unshift.apply(c,d.getArray())}Ha(a,function(a,c){return b[t(a)]-b[t(c)]});a.forEach(function(a){a=t(a);(a=this.A[a])&&a.forEach(this.Ia,this)},this)};k.Ia=function(a){this.u.raiseToTop(a)};function dc(a,b,c){this.h=c||new W(b);this.a=new Cesium.PrimitiveCollection;b.primitives.add(this.a);this.a.destroyPrimitives=!1;w.call(this,a,b)}v(dc,w);k=dc.prototype;k.aa=function(a){a.a.counterpart=a;this.a.add(a.a)};k.da=function(a){a.a.destroy()};k.la=function(a,b){a.destroy();this.a.destroyPrimitives=b;this.a.remove(a.a);this.a.destroyPrimitives=!1};
k.ka=function(a){if(this.a.destroyPrimitives=a)for(a=0;a<this.a.length;++a)this.a.get(a).counterpart.destroy();this.a.removeAll();this.a.destroyPrimitives=!1};
k.T=function(a){if(!(a instanceof ol.layer.Vector||a instanceof ol.layer.Image&&a.getSource()instanceof ol.source.ImageVector))return null;var b=a.getSource();a.getSource()instanceof ol.source.ImageVector&&(b=a.getSource().getSource());var c=this.i,d={},e=this.h.ia(a,c,d),f=e.a,g=e.b;f.show=a.getVisible();g.push(a.on("change:visible",function(){f.show=a.getVisible()}));var h=function(b){var g=this.h.convert(a,c,b,e.c);g&&(d[t(b)]=g,f.add(g))}.bind(this),l=function(a){var b=a.getGeometry();a=t(a);
if(!b||"Point"==b.getType()){var b=e.c,c=b.featureToCesiumMap[a];delete b.featureToCesiumMap[a];c instanceof Cesium.Billboard&&b.billboards.remove(c)}b=d[a];delete d[a];null!=b&&f.remove(b)}.bind(this);g.push(b.on("addfeature",function(a){h(a.feature)},this));g.push(b.on("removefeature",function(a){l(a.feature)},this));g.push(b.on("changefeature",function(a){a=a.feature;l(a);h(a)},this));return e?[e]:null};function Z(a){this.b=null;this.o=a.map;this.j=1;this.l=this.s=0;this.i=!0;this.g=Zb("DIV",{style:"position:absolute;top:0;left:0;width:100%;height:100%;visibility:hidden;"});var b=Vb(a.target||null);if(b)b.appendChild(this.g);else{var c=this.o.getViewport();(c=Wb(c))&&c.parentNode&&c.parentNode.insertBefore(this.g,c)}this.h=null==b;this.a=Zb(vb,{style:"position:absolute;top:0;left:0;width:100%;height:100%;"});this.a.oncontextmenu=function(){return!1};this.a.onselectstart=function(){return!1};this.g.appendChild(this.a);
this.v=!1;this.X=[];this.c=null;this.f=new Cesium.Scene({canvas:this.a,scene3DOnly:!0});b=this.f.screenSpaceCameraController;b.inertiaSpin=0;b.inertiaTranslate=0;b.inertiaZoom=0;b.tiltEventTypes.push({eventType:Cesium.CameraEventType.LEFT_DRAG,modifier:Cesium.KeyboardEventModifier.SHIFT});b.tiltEventTypes.push({eventType:Cesium.CameraEventType.LEFT_DRAG,modifier:Cesium.KeyboardEventModifier.ALT});b.enableLook=!1;this.f.camera.constrainedAxis=Cesium.Cartesian3.UNIT_Z;this.I=new T(this.f,this.o);this.H=
new Cesium.Globe(Cesium.Ellipsoid.WGS84);this.f.globe=this.H;this.f.skyAtmosphere=new Cesium.SkyAtmosphere;this.D=new Cesium.DataSourceCollection;this.ra=new Cesium.DataSourceDisplay({scene:this.f,dataSourceCollection:this.D});a=n(a.createSynchronizers)?a.createSynchronizers(this.o,this.f):[new bc(this.o,this.f),new dc(this.o,this.f)];ec(this);for(b=a.length-1;0<=b;--b)a[b].Z();this.h&&(a=ac(this.a),null!=a&&(a.style.display="none"));this.J=new P(function(){if(!this.ba){var a=Cesium.JulianDate.now();
this.f.initializeFrame();ec(this);this.ra.update(a);this.f.render(a);this.v&&Mb(this.I)}this.J.start()},void 0,this);this.ba=!1}function ec(a){var b=a.a.clientWidth,c=a.a.clientHeight;if(b!==a.s||c!==a.l||a.i){var d=(window.devicePixelRatio||1)*a.j;a.i=!1;a.s=b;a.l=c;b*=d;c*=d;a.a.width=b;a.a.height=c;a.f.camera.frustum.aspectRatio=b/c}}k=Z.prototype;k.ua=function(){return this.I};k.za=function(){return this.o};k.va=function(){return this.f};k.wa=function(){return this.D};k.ya=function(){return this.v};
k.Ma=function(a){if(this.v!=a)if(this.v=a,this.g.style.visibility=this.v?"visible":"hidden",this.v){if(this.h){var b=this.o.getInteractions();b.forEach(function(a){this.X.push(a)},this);b.clear();a=this.o.getLayerGroup();a.getVisible()&&(this.c=a,this.c.setVisible(!1))}this.I.K();this.J.start()}else this.h&&(b=this.o.getInteractions(),this.X.forEach(function(a){b.push(a)}),this.X.length=0,null!==this.c&&(this.c.setVisible(!0),this.c=null)),this.I.B(),sb(this.J)};
k.Sa=function(a,b){if(!this.v){this.I.K();var c=this.H.ellipsoid,d=this.f.camera,e=c.cartesianToCartographic(d.position);e.height<a&&(e.height=a,d.position=c.cartographicToCartesian(e));this.J.start();var f=this;setTimeout(function(){!f.v&&sb(f.J)},b)}};k.Y=function(a){this.ba=a};k.sa=function(){this.b||(this.b=new x(this,!1))};k.ta=function(){return this.b};k.Oa=function(a){a=Math.max(0,a);a!==this.j&&(this.j=Math.max(0,a),this.i=!0,this.b&&this.b.s())};u("olcs.AbstractSynchronizer",w);w.prototype.synchronize=w.prototype.Z;x.prototype.restartRenderLoop=x.prototype.s;x.prototype.setDebug=x.prototype.qa;u("olcs.Camera",T);T.prototype.setHeading=T.prototype.Na;T.prototype.getHeading=T.prototype.Da;T.prototype.setTilt=T.prototype.Pa;T.prototype.getTilt=T.prototype.Aa;T.prototype.setDistance=T.prototype.La;T.prototype.getDistance=T.prototype.xa;T.prototype.setCenter=T.prototype.Ga;T.prototype.getCenter=T.prototype.getCenter;T.prototype.setPosition=T.prototype.Ha;
T.prototype.getPosition=T.prototype.Ea;T.prototype.setAltitude=T.prototype.Ka;T.prototype.getAltitude=T.prototype.ja;T.prototype.lookAt=T.prototype.Fa;T.prototype.readFromView=T.prototype.K;T.prototype.updateView=T.prototype.B;u("olcs.core.computePixelSizeAtCoordinate",function(a,b){var c=a.camera,d=a.canvas,e=c.frustum,d=new Cesium.Cartesian2(d.clientWidth,d.clientHeight),c=Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(c.position,b,new Cesium.Cartesian3));return e.getPixelSize(d,c)});
u("olcs.core.applyHeightOffsetToGeometry",function(a,b){a.applyTransform(function(a,d,e){if(n(e)&&3<=e)for(a=0;a<d.length;a+=e)d[a+2]+=b;return d})});u("olcs.core.rotateAroundAxis",yb);
u("olcs.core.setHeadingUsingBottomCenter",function(a,b,c,d){var e=a.camera;a=Cb(a,c);a=Cesium.Quaternion.fromAxisAngle(e.right,a);var f=Cesium.Matrix3.fromQuaternion(a),g=new Cesium.Cartesian3;Cesium.Cartesian3.subtract(e.position,c,g);a=new Cesium.Cartesian3;Cesium.Matrix3.multiplyByVector(f,g,a);Cesium.Cartesian3.add(a,c,a);c=Cesium.Matrix4.fromTranslation(a);yb(e,b,a,c,d)});u("olcs.core.pickOnTerrainOrEllipsoid",zb);
u("olcs.core.pickBottomPoint",function(a){var b=a.canvas,b=new Cesium.Cartesian2(b.clientWidth/2,b.clientHeight);return zb(a,b)});u("olcs.core.pickCenterPoint",Ab);
u("olcs.core.computeSignedTiltAngleOnGlobe",function(a){var b=a.camera,c=new Cesium.Ray(b.position,b.direction);a=a.globe.pick(c,a);if(!a){var d=Cesium.IntersectionTests.rayEllipsoid(c,Cesium.Ellipsoid.WGS84);d&&(a=Cesium.Ray.getPoint(c,d.start))}if(a)return c=new Cesium.Cartesian3,Cesium.Ellipsoid.WGS84.geocentricSurfaceNormal(a,c),b=Bb(b.direction,c,b.right)-Math.PI,Cesium.Math.convertLongitudeRange(b)});u("olcs.core.computeAngleToZenith",Cb);u("olcs.core.lookAt",Db);
u("olcs.core.extentToRectangle",Eb);u("olcs.core.tileLayerToImageryLayer",Fb);u("olcs.core.updateCesiumLayerProperties",Gb);u("olcs.core.ol4326CoordinateToCesiumCartesian",R);u("olcs.core.ol4326CoordinateArrayToCsCartesians",Hb);u("olcs.core.olGeometryCloneTo4326",S);u("olcs.core.convertColorToCesium",Ib);u("olcs.DragBox",V);V.prototype.setScene=V.prototype.$;V.prototype.listen=V.prototype.l;u("olcs.FeatureConverter",W);W.prototype.csAddBillboard=W.prototype.ca;
W.prototype.olCircleGeometryToCesium=W.prototype.ea;W.prototype.olLineStringGeometryToCesium=W.prototype.U;W.prototype.olPolygonGeometryToCesium=W.prototype.V;W.prototype.getHeightReference=W.prototype.N;W.prototype.olPointGeometryToCesium=W.prototype.R;W.prototype.olMultiGeometryToCesium=W.prototype.ga;W.prototype.olGeometry4326TextPartToCesium=W.prototype.fa;W.prototype.olStyleToCesium=W.prototype.ha;W.prototype.computePlainStyle=W.prototype.S;W.prototype.olFeatureToCesium=W.prototype.P;
W.prototype.olVectorLayerToCesium=W.prototype.ia;W.prototype.convert=W.prototype.convert;u("olcs.OLCesium",Z);Z.prototype.getCamera=Z.prototype.ua;Z.prototype.getOlMap=Z.prototype.za;Z.prototype.getCesiumScene=Z.prototype.va;Z.prototype.getDataSources=Z.prototype.wa;Z.prototype.getEnabled=Z.prototype.ya;Z.prototype.setEnabled=Z.prototype.Ma;Z.prototype.warmUp=Z.prototype.Sa;Z.prototype.setBlockCesiumRendering=Z.prototype.Y;Z.prototype.enableAutoRenderLoop=Z.prototype.sa;
Z.prototype.getAutoRenderLoop=Z.prototype.ta;Z.prototype.setResolutionScale=Z.prototype.Oa;u("olcs.RasterSynchronizer",bc);u("olcs.VectorSynchronizer",dc);
  return OL3CESIUM.olcs;
}));

