Tyler Erickson b6bc527937 JavaScript API: added examples.
Python API: added support for specifying a geometry column when accessing
a Fusion Table as a vector data source.
2012-11-16 14:33:08 -08:00

74 lines
42 KiB
JavaScript

(function() {function h(a){throw a;}
var j=void 0,k=!0,l=null,n=!1,p,aa=aa||{},q=this,ba=function(a){a=a.split(".");for(var b=q,c;c=a.shift();)if(b[c]!=l)b=b[c];else return l;return b},ca=function(){},da=function(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},r=function(a){return"array"==da(a)},ea=function(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length},s=function(a){return"string"==typeof a},fa=function(a){return"number"==typeof a},ga=function(a){return"function"==da(a)},ja=function(a){return a[ha]||
(a[ha]=++ia)},ha="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ia=0,ka=function(a,b,c){return a.call.apply(a.bind,arguments)},la=function(a,b,c){a||h(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)}},t=function(a,b,c){t=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?
ka:la;return t.apply(l,arguments)},ma=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}},na=Date.now||function(){return+new Date},u=function(a,b){var c=a.split("."),d=q;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var f;c.length&&(f=c.shift());)!c.length&&b!==j?d[f]=b:d=d[f]?d[f]:d[f]={}},v=function(a,b){function c(){}c.prototype=b.prototype;a.M=b.prototype;a.prototype=
new c;a.prototype.constructor=a};Function.prototype.bind=Function.prototype.bind||function(a,b){if(1<arguments.length){var c=Array.prototype.slice.call(arguments,1);c.unshift(this,a);return t.apply(l,c)}return t(this,a)};var oa=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},pa=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},qa=function(a){var b={},c;for(c in a)b[c]=a[c];return b},ra="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),sa=function(a,b){for(var c,d,f=1;f<arguments.length;f++){d=arguments[f];for(c in d)a[c]=d[c];for(var e=0;e<ra.length;e++)c=ra[e],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}},ta=function(a){var b=
arguments.length;if(1==b&&r(arguments[0]))return ta.apply(l,arguments[0]);b%2&&h(Error("Uneven number of arguments"));for(var c={},d=0;d<b;d+=2)c[arguments[d]]=arguments[d+1];return c};var ua=function(a){a=String(a);if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}h(Error("Invalid JSON string: "+a))},va=function(a){this.F=a};va.prototype.d=function(a){var b=[];wa(this,a,b);return b.join("")};
var wa=function(a,b,c){switch(typeof b){case "string":xa(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==l){c.push("null");break}if(r(b)){var d=b.length;c.push("[");for(var f="",e=0;e<d;e++)c.push(f),f=b[e],wa(a,a.F?a.F.call(b,String(e),f):f,c),f=",";c.push("]");break}a.Y(b,c);break;case "function":break;default:h(Error("Unknown type: "+typeof b))}},ya={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b",
"\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},za=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,xa=function(a,b){b.push('"',a.replace(za,function(a){if(a in ya)return ya[a];var b=a.charCodeAt(0),f="\\u";16>b?f+="000":256>b?f+="00":4096>b&&(f+="0");return ya[a]=f+b.toString(16)}),'"')};
va.prototype.Y=function(a,b){b.push("{");var c="",d;for(d in a)if(Object.prototype.hasOwnProperty.call(a,d)){var f=a[d];"function"!=typeof f&&(b.push(c),xa(d,b),b.push(":"),wa(this,this.F?this.F.call(a,d,f):f,b),c=",")}b.push("}")};var Aa=function(a){Error.captureStackTrace?Error.captureStackTrace(this,Aa):this.stack=Error().stack||"";a&&(this.message=String(a))};v(Aa,Error);Aa.prototype.name="CustomError";var Ba=function(a,b){for(var c=1;c<arguments.length;c++){var d=String(arguments[c]).replace(/\$/g,"$$$$");a=a.replace(/\%s/,d)}return a},Ha=function(a){if(!Ca.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Da,"&amp;"));-1!=a.indexOf("<")&&(a=a.replace(Ea,"&lt;"));-1!=a.indexOf(">")&&(a=a.replace(Fa,"&gt;"));-1!=a.indexOf('"')&&(a=a.replace(Ga,"&quot;"));return a},Da=/&/g,Ea=/</g,Fa=/>/g,Ga=/\"/g,Ca=/[&<>\"]/;var Ia=function(a,b){b.unshift(a);Aa.call(this,Ba.apply(l,b));b.shift()};v(Ia,Aa);Ia.prototype.name="AssertionError";var Ja=function(a,b,c){if(!a){var d=Array.prototype.slice.call(arguments,2),f="Assertion failed";if(b)var f=f+(": "+b),e=d;h(new Ia(""+f,e||[]))}},Ka=function(a,b){h(new Ia("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1)))};var w=Array.prototype,La=w.indexOf?function(a,b,c){Ja(a.length!=l);return w.indexOf.call(a,b,c)}:function(a,b,c){c=c==l?0:0>c?Math.max(0,a.length+c):c;if(s(a))return!s(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Ma=w.forEach?function(a,b,c){Ja(a.length!=l);w.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=s(a)?a.split(""):a,e=0;e<d;e++)e in f&&b.call(c,f[e],e,a)},Na=w.map?function(a,b,c){Ja(a.length!=l);return w.map.call(a,b,c)}:function(a,
b,c){for(var d=a.length,f=Array(d),e=s(a)?a.split(""):a,g=0;g<d;g++)g in e&&(f[g]=b.call(c,e[g],g,a));return f},Oa=function(a,b){var c=La(a,b);0<=c&&(Ja(a.length!=l),w.splice.call(a,c,1))},Pa=function(a){return w.concat.apply(w,arguments)},Qa=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c],f;if(r(d)||(f=ea(d))&&d.hasOwnProperty("callee"))a.push.apply(a,d);else if(f)for(var e=a.length,g=d.length,m=0;m<g;m++)a[e+m]=d[m];else a.push(d)}};var Ra="StopIteration"in q?q.StopIteration:Error("StopIteration"),Sa=function(){};Sa.prototype.next=function(){h(Ra)};Sa.prototype.Oa=function(){return this};var Ta=function(a){if("function"==typeof a.l)return a.l();if(s(a))return a.split("");if(ea(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return oa(a)},Ua=function(a,b,c){if("function"==typeof a.forEach)a.forEach(b,c);else if(ea(a)||s(a))Ma(a,b,c);else{var d;if("function"==typeof a.s)d=a.s();else if("function"!=typeof a.l)if(ea(a)||s(a)){d=[];for(var f=a.length,e=0;e<f;e++)d.push(e)}else d=pa(a);else d=j;for(var f=Ta(a),e=f.length,g=0;g<e;g++)b.call(c,f[g],d&&d[g],a)}};var x=function(a,b){this.n={};this.f=[];var c=arguments.length;if(1<c){c%2&&h(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else if(a){a instanceof x?(c=a.s(),d=a.l()):(c=pa(a),d=oa(a));for(var f=0;f<c.length;f++)this.set(c[f],d[f])}};p=x.prototype;p.b=0;p.X=0;p.l=function(){Va(this);for(var a=[],b=0;b<this.f.length;b++)a.push(this.n[this.f[b]]);return a};p.s=function(){Va(this);return this.f.concat()};
p.u=function(a){return Object.prototype.hasOwnProperty.call(this.n,a)};var Va=function(a){if(a.b!=a.f.length){for(var b=0,c=0;b<a.f.length;){var d=a.f[b];Object.prototype.hasOwnProperty.call(a.n,d)&&(a.f[c++]=d);b++}a.f.length=c}if(a.b!=a.f.length){for(var f={},c=b=0;b<a.f.length;)d=a.f[b],Object.prototype.hasOwnProperty.call(f,d)||(a.f[c++]=d,f[d]=1),b++;a.f.length=c}};x.prototype.get=function(a,b){return Object.prototype.hasOwnProperty.call(this.n,a)?this.n[a]:b};
x.prototype.set=function(a,b){Object.prototype.hasOwnProperty.call(this.n,a)||(this.b++,this.f.push(a),this.X++);this.n[a]=b};x.prototype.R=function(){return new x(this)};x.prototype.Oa=function(a){Va(this);var b=0,c=this.f,d=this.n,f=this.X,e=this,g=new Sa;g.next=function(){for(;;){f!=e.X&&h(Error("The map has changed since the iterator was created"));b>=c.length&&h(Ra);var g=c[b++];return a?g:d[g]}};return g};var z,Wa,Xa,Ya,Za=function(){return q.navigator?q.navigator.userAgent:l};Ya=Xa=Wa=z=n;var $a;if($a=Za()){var ab=q.navigator;z=0==$a.indexOf("Opera");Wa=!z&&-1!=$a.indexOf("MSIE");Xa=!z&&-1!=$a.indexOf("WebKit");Ya=!z&&!Xa&&"Gecko"==ab.product}var bb=z,D=Wa,cb=Ya,F=Xa,db=function(){var a=q.document;return a?a.documentMode:j},eb;
a:{var fb="",gb;if(bb&&q.opera)var hb=q.opera.version,fb="function"==typeof hb?hb():hb;else if(cb?gb=/rv\:([^\);]+)(\)|;)/:D?gb=/MSIE\s+([^\);]+)(\)|;)/:F&&(gb=/WebKit\/(\S+)/),gb)var ib=gb.exec(Za()),fb=ib?ib[1]:"";if(D){var jb=db();if(jb>parseFloat(fb)){eb=String(jb);break a}}eb=fb}
var kb=eb,lb={},G=function(a){var b;if(!(b=lb[a])){b=0;for(var c=String(kb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=Math.max(c.length,d.length),e=0;0==b&&e<f;e++){var g=c[e]||"",m=d[e]||"",C=RegExp("(\\d*)(\\D*)","g"),y=RegExp("(\\d*)(\\D*)","g");do{var A=C.exec(g)||["","",""],B=y.exec(m)||["","",""];if(0==A[0].length&&0==B[0].length)break;b=((0==A[1].length?0:parseInt(A[1],10))<(0==B[1].length?0:parseInt(B[1],10))?-1:(0==A[1].length?
0:parseInt(A[1],10))>(0==B[1].length?0:parseInt(B[1],10))?1:0)||((0==A[2].length)<(0==B[2].length)?-1:(0==A[2].length)>(0==B[2].length)?1:0)||(A[2]<B[2]?-1:A[2]>B[2]?1:0)}while(0==b)}b=lb[a]=0<=b}return b},mb=q.document,nb=!mb||!D?j:db()||("CSS1Compat"==mb.compatMode?parseInt(kb,10):5);var pb=function(a){return ob(a||arguments.callee.caller,[])},ob=function(a,b){var c=[];if(0<=La(b,a))c.push("[...circular reference...]");else if(a&&50>b.length){c.push(qb(a)+"(");for(var d=a.arguments,f=0;f<d.length;f++){0<f&&c.push(", ");var e;e=d[f];switch(typeof e){case "object":e=e?"object":"null";break;case "string":break;case "number":e=String(e);break;case "boolean":e=e?"true":"false";break;case "function":e=(e=qb(e))?e:"[fn]";break;default:e=typeof e}40<e.length&&(e=e.substr(0,40)+"...");
c.push(e)}b.push(a);c.push(")\n");try{c.push(ob(a.caller,b))}catch(g){c.push("[exception trying to get caller]\n")}}else a?c.push("[...long stack...]"):c.push("[end]");return c.join("")},qb=function(a){if(rb[a])return rb[a];a=String(a);if(!rb[a]){var b=/function ([^\(]+)/.exec(a);rb[a]=b?b[1]:"[Anonymous]"}return rb[a]},rb={};var sb=function(a,b,c,d,f){this.reset(a,b,c,d,f)};sb.prototype.oa=l;sb.prototype.na=l;var tb=0;sb.prototype.reset=function(a,b,c,d,f){"number"==typeof f||tb++;d||na();this.B=a;this.Fa=b;delete this.oa;delete this.na};sb.prototype.ta=function(a){this.B=a};var H=function(a){this.Ia=a};H.prototype.P=l;H.prototype.B=l;H.prototype.Z=l;H.prototype.wa=l;var ub=function(a,b){this.name=a;this.value=b};ub.prototype.toString=function(){return this.name};var vb=new ub("SEVERE",1E3),wb=new ub("WARNING",900),xb=new ub("CONFIG",700),yb=new ub("FINE",500);H.prototype.getParent=function(){return this.P};H.prototype.ta=function(a){this.B=a};var zb=function(a){if(a.B)return a.B;if(a.P)return zb(a.P);Ka("Root logger has no level set.");return l};
H.prototype.log=function(a,b,c){if(a.value>=zb(this).value){a=this.Ja(a,b,c);b="log:"+a.Fa;q.console&&(q.console.timeStamp?q.console.timeStamp(b):q.console.markTimeline&&q.console.markTimeline(b));q.msWriteProfilerMark&&q.msWriteProfilerMark(b);for(b=this;b;){c=b;var d=a;if(c.wa)for(var f=0,e=j;e=c.wa[f];f++)e(d);b=b.getParent()}}};
H.prototype.Ja=function(a,b,c){var d=new sb(a,String(b),this.Ia);if(c){d.oa=c;var f;var e=arguments.callee.caller;try{var g;var m=ba("window.location.href");if(s(c))g={message:c,name:"Unknown error",lineNumber:"Not available",fileName:m,stack:"Not available"};else{var C,y,A=n;try{C=c.lineNumber||c.eb||"Not available"}catch(B){C="Not available",A=k}try{y=c.fileName||c.filename||c.sourceURL||m}catch(Z){y="Not available",A=k}g=A||!c.lineNumber||!c.fileName||!c.stack?{message:c.message,name:c.name,lineNumber:C,
fileName:y,stack:c.stack||"Not available"}:c}f="Message: "+Ha(g.message)+'\nUrl: <a href="view-source:'+g.fileName+'" target="_new">'+g.fileName+"</a>\nLine: "+g.lineNumber+"\n\nBrowser stack:\n"+Ha(g.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+Ha(pb(e)+"-> ")}catch(E){f="Exception trying to expose exception! You win, we lose. "+E}d.na=f}return d};
var I=function(a,b){a.log(yb,b,j)},Ab={},Bb=l,Cb=function(a){Bb||(Bb=new H(""),Ab[""]=Bb,Bb.ta(xb));var b;if(!(b=Ab[a])){b=new H(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=Cb(a.substr(0,c));c.Z||(c.Z={});c.Z[d]=b;b.P=c;Ab[a]=b}return b};var Db=function(){};Db.prototype.ua=n;Db.prototype.Q=function(){this.ua||(this.ua=k,this.q())};Db.prototype.q=function(){this.La&&Eb.apply(l,this.La);if(this.ya)for(;this.ya.length;)this.ya.shift()()};var Eb=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];ea(d)?Eb.apply(l,d):d&&"function"==typeof d.Q&&d.Q()}};var Fb=function(a){Fb[" "](a);return a};Fb[" "]=ca;var Gb;if(!(Gb=!D))Gb=D&&9<=nb;var Hb=Gb,Ib=D&&!G("9");!F||G("528");cb&&G("1.9b")||D&&G("8")||bb&&G("9.5")||F&&G("528");cb&&!G("8")||D&&G("9");var J=function(a,b){this.type=a;this.currentTarget=this.target=b};p=J.prototype;p.q=function(){};p.Q=function(){};p.t=n;p.defaultPrevented=n;p.O=k;p.preventDefault=function(){this.defaultPrevented=k;this.O=n};var Jb=function(a,b){a&&this.j(a,b)};v(Jb,J);p=Jb.prototype;p.target=l;p.relatedTarget=l;p.offsetX=0;p.offsetY=0;p.clientX=0;p.clientY=0;p.screenX=0;p.screenY=0;p.button=0;p.keyCode=0;p.charCode=0;p.ctrlKey=n;p.altKey=n;p.shiftKey=n;p.metaKey=n;p.ra=l;
p.j=function(a,b){var c=this.type=a.type;J.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(cb){var f;a:{try{Fb(d.nodeName);f=k;break a}catch(e){}f=n}f||(d=l)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=F||a.offsetX!==j?a.offsetX:a.layerX;this.offsetY=F||a.offsetY!==j?a.offsetY:a.layerY;this.clientX=a.clientX!==j?a.clientX:a.pageX;this.clientY=a.clientY!==j?a.clientY:a.pageY;this.screenX=a.screenX||
0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.ra=a;a.defaultPrevented&&this.preventDefault();delete this.t};
p.preventDefault=function(){Jb.M.preventDefault.call(this);var a=this.ra;if(a.preventDefault)a.preventDefault();else if(a.returnValue=n,Ib)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};p.q=function(){};var Kb=function(){},Lb=0;p=Kb.prototype;p.key=0;p.r=n;p.la=n;p.j=function(a,b,c,d,f,e){ga(a)?this.ka=k:a&&a.handleEvent&&ga(a.handleEvent)?this.ka=n:h(Error("Invalid listener argument"));this.A=a;this.ia=b;this.src=c;this.type=d;this.capture=!!f;this.V=e;this.la=n;this.key=++Lb;this.r=n};p.handleEvent=function(a){return this.ka?this.A.call(this.V||this.src,a):this.A.handleEvent.call(this.A,a)};var Mb={},K={},L={},Nb={},Ob=function(a,b,c,d,f){if(b)if(r(b))for(var e=0;e<b.length;e++)Ob(a,b[e],c,d,f);else{d=!!d;var g=K;b in g||(g[b]={b:0,h:0});g=g[b];d in g||(g[d]={b:0,h:0},g.b++);var g=g[d],m=ja(a),C;g.h++;if(g[m]){C=g[m];for(e=0;e<C.length;e++)if(g=C[e],g.A==c&&g.V==f){if(g.r)break;return}}else C=g[m]=[],g.b++;var y=Pb,A=Hb?function(a){return y.call(A.src,A.key,a)}:function(a){a=y.call(A.src,A.key,a);if(!a)return a},e=A;e.src=a;g=new Kb;g.j(c,e,a,b,d,f);c=g.key;e.key=c;C.push(g);Mb[c]=g;
L[m]||(L[m]=[]);L[m].push(g);a.addEventListener?(a==q||!a.ha)&&a.addEventListener(b,e,d):a.attachEvent(b in Nb?Nb[b]:Nb[b]="on"+b,e)}else h(Error("Invalid event type"))},Qb=function(a,b,c,d,f){if(r(b))for(var e=0;e<b.length;e++)Qb(a,b[e],c,d,f);else{d=!!d;a:{e=K;if(b in e&&(e=e[b],d in e&&(e=e[d],a=ja(a),e[a]))){a=e[a];break a}a=l}if(a)for(e=0;e<a.length;e++)if(a[e].A==c&&a[e].capture==d&&a[e].V==f){Rb(a[e].key);break}}},Rb=function(a){if(Mb[a]){var b=Mb[a];if(!b.r){var c=b.src,d=b.type,f=b.ia,e=
b.capture;c.removeEventListener?(c==q||!c.ha)&&c.removeEventListener(d,f,e):c.detachEvent&&c.detachEvent(d in Nb?Nb[d]:Nb[d]="on"+d,f);c=ja(c);L[c]&&(f=L[c],Oa(f,b),0==f.length&&delete L[c]);b.r=k;if(b=K[d][e][c])b.ja=k,Sb(d,e,c,b);delete Mb[a]}}},Sb=function(a,b,c,d){if(!d.N&&d.ja){for(var f=0,e=0;f<d.length;f++)d[f].r?d[f].ia.src=l:(f!=e&&(d[e]=d[f]),e++);d.length=e;d.ja=n;0==e&&(delete K[a][b][c],K[a][b].b--,0==K[a][b].b&&(delete K[a][b],K[a].b--),0==K[a].b&&delete K[a])}},Ub=function(a,b,c,d,
f){var e=1;b=ja(b);if(a[b]){a.h--;a=a[b];a.N?a.N++:a.N=1;try{for(var g=a.length,m=0;m<g;m++){var C=a[m];C&&!C.r&&(e&=Tb(C,f)!==n)}}finally{a.N--,Sb(c,d,b,a)}}return Boolean(e)},Tb=function(a,b){a.la&&Rb(a.key);return a.handleEvent(b)},Pb=function(a,b){if(!Mb[a])return k;var c=Mb[a],d=c.type,f=K;if(!(d in f))return k;var f=f[d],e,g;if(!Hb){e=b||ba("window.event");var m=k in f,C=n in f;if(m){if(0>e.keyCode||e.returnValue!=j)return k;a:{var y=n;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(A){y=k}if(y||
e.returnValue==j)e.returnValue=k}}y=new Jb;y.j(e,this);e=k;try{if(m){for(var B=[],Z=y.currentTarget;Z;Z=Z.parentNode)B.push(Z);g=f[k];g.h=g.b;for(var E=B.length-1;!y.t&&0<=E&&g.h;E--)y.currentTarget=B[E],e&=Ub(g,B[E],d,k,y);if(C){g=f[n];g.h=g.b;for(E=0;!y.t&&E<B.length&&g.h;E++)y.currentTarget=B[E],e&=Ub(g,B[E],d,n,y)}}else e=Tb(c,y)}finally{B&&(B.length=0)}return e}d=new Jb(b,this);return e=Tb(c,d)};var Vb=function(){};v(Vb,Db);p=Vb.prototype;p.ha=k;p.W=l;p.addEventListener=function(a,b,c,d){Ob(this,a,b,c,d)};p.removeEventListener=function(a,b,c,d){Qb(this,a,b,c,d)};
p.dispatchEvent=function(a){var b=a.type||a,c=K;if(b in c){if(s(a))a=new J(a,this);else if(a instanceof J)a.target=a.target||this;else{var d=a;a=new J(b,this);sa(a,d)}var d=1,f,c=c[b],b=k in c,e;if(b){f=[];for(e=this;e;e=e.W)f.push(e);e=c[k];e.h=e.b;for(var g=f.length-1;!a.t&&0<=g&&e.h;g--)a.currentTarget=f[g],d&=Ub(e,f[g],a.type,k,a)&&a.O!=n}if(n in c)if(e=c[n],e.h=e.b,b)for(g=0;!a.t&&g<f.length&&e.h;g++)a.currentTarget=f[g],d&=Ub(e,f[g],a.type,n,a)&&a.O!=n;else for(f=this;!a.t&&f&&e.h;f=f.W)a.currentTarget=
f,d&=Ub(e,f,a.type,n,a)&&a.O!=n;a=Boolean(d)}else a=k;return a};p.q=function(){Vb.M.q.call(this);var a,b=0,c=a==l;a=!!a;if(this==l){var d=function(d){for(var e=d.length-1;0<=e;e--){var f=d[e];if(c||a==f.capture)Rb(f.key),b++}},f;for(f in L)d.call(j,L[f])}else if(d=ja(this),L[d]){d=L[d];for(f=d.length-1;0<=f;f--){var e=d[f];if(c||a==e.capture)Rb(e.key),b++}}this.W=l};var Wb=q.window;var Xb=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),Yb=F,Zb=function(a,b){if(Yb){Yb=n;var c=q.location;if(c){var d=c.href;if(d&&(d=(d=Zb(3,d))&&decodeURIComponent(d))&&d!=c.hostname)Yb=k,h(Error())}}return b.match(Xb)[a]||l};var $b=function(){};$b.prototype.za=l;$b.prototype.w=function(){var a;if(!(a=this.za))a={},ac(this)&&(a[0]=k,a[1]=k),a=this.za=a;return a};var bc=function(a,b){this.Na=a;this.Ma=b};v(bc,$b);bc.prototype.T=function(){return this.Na()};bc.prototype.w=function(){return this.Ma()};var M=function(){return M.sa.T()};M.Ka=n;M.w=function(){return M.sa.w()};M.hb=function(a,b){M.Ca(new bc(a,b))};M.Ca=function(a){M.sa=a};var cc=function(){};v(cc,$b);cc.prototype.T=function(){var a=ac(this);return a?new ActiveXObject(a):new XMLHttpRequest};
var ac=function(a){if(M.Ka)return"";if(!a.xa&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.xa=d}catch(f){}}h(Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed"))}return a.xa};M.Ca(new cc);var N=function(a){this.headers=new x;this.L=a||l};v(N,Vb);N.prototype.g=Cb("goog.net.XhrIo");var dc=/^https?$/i,ec=[],gc=function(a,b,c,d,f,e,g){var m=new N;ec.push(m);b&&Ob(m,"complete",b);Ob(m,"ready",ma(fc,m));e&&(m.z=Math.max(0,e));g&&(m.fa=g);m.send(a,c,d,f)},fc=function(a){a.Q();Oa(ec,a)};p=N.prototype;p.m=n;p.a=l;p.J=l;p.K="";p.ea="";p.v="";p.U=n;p.I=n;p.S=n;p.p=n;p.z=0;p.o=l;p.ga="";p.fa=n;
p.send=function(a,b,c,d){this.a&&h(Error("[goog.net.XhrIo] Object is active with another request="+this.K+"; newUri="+a));b=b?b.toUpperCase():"GET";this.K=a;this.v="";this.ea=b;this.U=n;this.m=k;this.a=this.L?this.L.T():M();this.J=this.L?this.L.w():M.w();this.a.onreadystatechange=t(this.da,this);try{I(this.g,O(this,"Opening Xhr")),this.S=k,this.a.open(b,a,k),this.S=n}catch(f){I(this.g,O(this,"Error opening Xhr: "+f.message));hc(this,f);return}a=c||"";var e=this.headers.R();d&&Ua(d,function(a,b){e.set(b,
a)});d=q.FormData&&a instanceof q.FormData;"POST"==b&&(!e.u("Content-Type")&&!d)&&e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");Ua(e,function(a,b){this.a.setRequestHeader(b,a)},this);this.ga&&(this.a.responseType=this.ga);"withCredentials"in this.a&&(this.a.withCredentials=this.fa);try{this.o&&(Wb.clearTimeout(this.o),this.o=l),0<this.z&&(I(this.g,O(this,"Will abort after "+this.z+"ms if incomplete")),this.o=Wb.setTimeout(t(this.Da,this),this.z)),I(this.g,O(this,"Sending request")),
this.I=k,this.a.send(a),this.I=n}catch(g){I(this.g,O(this,"Send error: "+g.message)),hc(this,g)}};p.Da=function(){"undefined"!=typeof aa&&this.a&&(this.v="Timed out after "+this.z+"ms, aborting",I(this.g,O(this,this.v)),this.dispatchEvent("timeout"),this.abort(8))};var hc=function(a,b){a.m=n;a.a&&(a.p=k,a.a.abort(),a.p=n);a.v=b;ic(a);jc(a)},ic=function(a){a.U||(a.U=k,a.dispatchEvent("complete"),a.dispatchEvent("error"))};
N.prototype.abort=function(){this.a&&this.m&&(I(this.g,O(this,"Aborting")),this.m=n,this.p=k,this.a.abort(),this.p=n,this.dispatchEvent("complete"),this.dispatchEvent("abort"),jc(this))};N.prototype.q=function(){this.a&&(this.m&&(this.m=n,this.p=k,this.a.abort(),this.p=n),jc(this,k));N.M.q.call(this)};N.prototype.da=function(){!this.S&&!this.I&&!this.p?this.Ga():kc(this)};N.prototype.Ga=function(){kc(this)};
var kc=function(a){if(a.m&&"undefined"!=typeof aa)if(a.J[1]&&4==lc(a)&&2==mc(a))I(a.g,O(a,"Local request error detected and ignored"));else if(a.I&&4==lc(a))Wb.setTimeout(t(a.da,a),0);else if(a.dispatchEvent("readystatechange"),4==lc(a)){I(a.g,O(a,"Request complete"));a.m=n;try{var b=mc(a),c,d;a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:d=k;break a;default:d=n}if(!(c=d)){var f;if(f=0===b){var e=Zb(1,String(a.K));if(!e&&self.location)var g=self.location.protocol,e=g.substr(0,
g.length-1);f=!dc.test(e?e.toLowerCase():"")}c=f}if(c)a.dispatchEvent("complete"),a.dispatchEvent("success");else{var m;try{m=2<lc(a)?a.a.statusText:""}catch(C){I(a.g,"Can not get status: "+C.message),m=""}a.v=m+" ["+mc(a)+"]";ic(a)}}finally{jc(a)}}},jc=function(a,b){if(a.a){var c=a.a,d=a.J[0]?ca:l;a.a=l;a.J=l;a.o&&(Wb.clearTimeout(a.o),a.o=l);b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(f){a.g.log(vb,"Problem encountered resetting onreadystatechange: "+f.message,j)}}},lc=function(a){return a.a?
a.a.readyState:0},mc=function(a){try{return 2<lc(a)?a.a.status:-1}catch(b){return a.g.log(wb,"Can not get status: "+b.message,j),-1}};N.prototype.pa=function(){try{return this.a?this.a.responseText:""}catch(a){return I(this.g,"Can not get responseText: "+a.message),""}};var O=function(a,b){return b+" ["+a.ea+" "+a.K+" "+mc(a)+"]"};var nc=function(a,b,c){this.k=a||l;this.Ha=!!c},pc=function(a){if(!a.e&&(a.e=new x,a.b=0,a.k))for(var b=a.k.split("&"),c=0;c<b.length;c++){var d=b[c].indexOf("="),f=l,e=l;0<=d?(f=b[c].substring(0,d),e=b[c].substring(d+1)):f=b[c];f=decodeURIComponent(f.replace(/\+/g," "));f=oc(a,f);a.add(f,e?decodeURIComponent(e.replace(/\+/g," ")):"")}};p=nc.prototype;p.e=l;p.b=l;p.add=function(a,b){pc(this);this.k=l;a=oc(this,a);var c=this.e.get(a);c||this.e.set(a,c=[]);c.push(b);this.b++;return this};
p.u=function(a){pc(this);a=oc(this,a);return this.e.u(a)};p.s=function(){pc(this);for(var a=this.e.l(),b=this.e.s(),c=[],d=0;d<b.length;d++)for(var f=a[d],e=0;e<f.length;e++)c.push(b[d]);return c};p.l=function(a){pc(this);var b=[];if(a)this.u(a)&&(b=Pa(b,this.e.get(oc(this,a))));else{a=this.e.l();for(var c=0;c<a.length;c++)b=Pa(b,a[c])}return b};p.set=function(a,b){pc(this);this.k=l;a=oc(this,a);this.u(a)&&(this.b-=this.e.get(a).length);this.e.set(a,[b]);this.b++;return this};
p.get=function(a,b){var c=a?this.l(a):[];return 0<c.length?String(c[0]):b};p.toString=function(){if(this.k)return this.k;if(!this.e)return"";for(var a=[],b=this.e.s(),c=0;c<b.length;c++)for(var d=b[c],f=encodeURIComponent(String(d)),d=this.l(d),e=0;e<d.length;e++){var g=f;""!==d[e]&&(g+="="+encodeURIComponent(String(d[e])));a.push(g)}return this.k=a.join("&")};p.R=function(){var a=new nc;a.k=this.k;this.e&&(a.e=this.e.R(),a.b=this.b);return a};
var oc=function(a,b){var c=String(b);a.Ha&&(c=c.toLowerCase());return c};var sc=function(a,b,c){if(!("ready"==qc&&!a&&!b))if("loading"==qc&&h(Error("Already loading.")),qc="loading",rc=a||"/api",a=function(){P.i(Q,"Image");P.i(R,"Feature");P.i(S,"FeatureCollection");P.i(Q,"Window","focal_");P.i(T,"ImageCollection");P.i(T,"reduce");P.i(U,"Collection");P.i(U,"AggregateFeatureCollection","aggregate_",P.Ea);P.i(T,"Image","map_",P.ma);P.i(S,"Feature","map_",P.ma);qc="ready";c&&c()},c)P.j(a);else try{P.j(),a()}catch(d){alert("Could not read algorithm list.")}},qc="not_ready",
rc=l,tc=function(a,b){var c={c:{type:"Variable",name:b}};c.__proto__=a.prototype;return c},uc=function(a,b){return{type:"Algorithm",args:a,body:b}};u("ee.initialize",sc);u("ee.InitState",{fb:"not_ready",LOADING:"loading",gb:"ready"});u("ee.InitState.NOT_READY","not_ready");u("ee.InitState.LOADING","loading");u("ee.InitState.READY","ready");u("ee.ready",function(){return qc});
u("ee.call",function(a,b){if(s(a)){var c=P.get(a),d=Array.prototype.slice.call(arguments,1);return P.D(c,d,{})}c=a.args;(!c||c.length>arguments.length-1)&&h(Error("Missing lambda arguments: "+c.slice(arguments.length-1)));for(var d={algorithm:a},f=1;f<arguments.length;f++)d[c[f-1]]=arguments[f];return d});u("ee.apply",function(a,b){if(s(a)){var c=P.get(a);return P.D(c,[],b)}c=qa(b);c.algorithm=a;return c});u("ee.variable",tc);u("ee.lambda",uc);u("ee.TILE_SIZE",256);var wc=function(a,b){return V("/mapid",vc(a),b)},xc=function(a,b){return V("/value",vc(a),b)},yc=function(a,b){return V("/download",vc(a),b)},zc=function(a){return rc+"/download?docid="+a.docid+"&token="+a.token},V=function(a,b,c,d){function f(a,b){var c=n;try{var d=ua(a),e=d.data,f=d.error}catch(Z){c=k}var E=j;c||!e&&!f?E="Malformed request: "+a:f&&(E=d.error.message);if(b)b(e,E);else{if(!E)return e;h(Error(E))}}d=d||"POST";a=rc+a;b=b?b.toString():"";if(c)gc(a,function(a){return f(a.target.pa(),
c)},d,b);else{var e=M();e.open(d,a,n);e.setRequestHeader("Content-type","application/x-www-form-urlencoded");e.send(b);return f(e.responseText,l)}},vc=function(a){var b=new nc,c;for(c in a)b.set(c,a[c]);return b};u("ee.data",function(){});u("ee.data.getInfo",function(a,b){return V("/info",(new nc).add("id",a),b)});u("ee.data.getList",function(a,b){return V("/list",(new nc).add("id",a),b)});u("ee.data.getMapId",wc);u("ee.data.getValue",xc);
u("ee.data.getThumbId",function(a,b){var c=vc(a).add("getid","1");return V("/thumb",c,b)});u("ee.data.getDownloadId",yc);u("ee.data.makeDownloadUrl",zc);u("ee.data.send_",V);
u("ee.data.setupMockSend",function(a){var b=a||{};gc=function(a,c,e,g){var m=new function(){};m.target={};m.target.pa=function(){return a in b?s(b[a])?b[a]:b[a](a,c,e,g):'{"error": {}}'};setTimeout(t(c,m,m),0)};var c=function(){};c.prototype.open=function(a,b){this.url=b;this.method=a};c.prototype.setRequestHeader=function(){};c.prototype.send=function(a){this.responseText=this.url in b?s(b[this.url])?b[this.url]:b[this.url](this.url,this.method,a):(new va(j)).d({data:{url:this.url,method:this.method,
data:a}})};M=function(){return new c}});u("ee.data.parse",function(a){return ua(a)});var Ac=function(a){this.F=a};v(Ac,va);var W=function(a){return(new Ac).d(a)},Bc=function(a){a=W(a);return"JSON"in window?window.JSON.stringify(window.JSON.parse(a),l," "):a};Ac.prototype.Y=function(a,b){"serialize"in a?b.push(a.d()):Ac.M.Y.call(this,a,b)};u("ee.Serializer",Ac);u("ee.Serializer.toJSON",W);u("ee.Serializer.toReadableJSON",Bc);var X=function(a){if(!(this instanceof X))return new X(a);sc();if(a instanceof X)return a;this.G=a instanceof Array?a:a?[a]:[]};X.prototype.length=function(){return this.G.length};
var Y=function(a,b){var c=a.G.slice(0);b instanceof X?Qa(c,b.G):b instanceof Array?Qa(c,b):c.push(b);return new X(c)},$=function(a,b,c){return new X(ta("property",a,b,c))},Cc=function(a,b){return $(a,"equals",b)},Dc=function(a,b){return $(a,"not_equals",b)},Ec=function(a,b){return $(a,"less_than",b)},Fc=function(a,b){return $(a,"not_less_than",b)},Gc=function(a,b){return $(a,"greater_than",b)},Hc=function(a,b){return $(a,"not_greater_than",b)},Ic=function(a,b){return $(a,"contains",b)},Jc=function(a,
b){return $(a,"not_contains",b)},Kc=function(a,b){return $(a,"starts_with",b)},Lc=function(a,b){return $(a,"not_starts_with",b)},Mc=function(a,b){return $(a,"ends_with",b)},Nc=function(a,b){return $(a,"not_ends_with",b)},Oc=function(a){var b=Array.prototype.slice.call(arguments);return new X({and:b})},Pc=function(a,b){var c=function(a){return a instanceof Date?a.getTime():"string"==typeof a?(new Date(a)).getTime():a},d={property:"system:time_start",not_less_than:c(a)};b&&(d=[d,{property:"system:time_start",
not_greater_than:c(b)}]);return new X(d)},Qc=function(a){a instanceof S&&(a={algorithm:"ExtractGeometry",collection:a});return new X({geometry:a})};p=X.prototype;p.Ta=function(){return Y(this,Cc.apply(l,[].slice.call(arguments)))};p.Za=function(){return Y(this,Dc.apply(l,[].slice.call(arguments)))};p.Xa=function(){return Y(this,Ec.apply(l,[].slice.call(arguments)))};p.Wa=function(){return Y(this,Fc.apply(l,[].slice.call(arguments)))};p.Va=function(){return Y(this,Gc.apply(l,[].slice.call(arguments)))};
p.Ya=function(){return Y(this,Hc.apply(l,[].slice.call(arguments)))};p.contains=function(){return Y(this,Ic.apply(l,[].slice.call(arguments)))};p.$a=function(){return Y(this,Jc.apply(l,[].slice.call(arguments)))};p.cb=function(){return Y(this,Kc.apply(l,[].slice.call(arguments)))};p.bb=function(){return Y(this,Lc.apply(l,[].slice.call(arguments)))};p.Sa=function(){return Y(this,Mc.apply(l,[].slice.call(arguments)))};p.ab=function(){return Y(this,Nc.apply(l,[].slice.call(arguments)))};
p.Pa=function(){return Y(this,Oc.apply(l,[].slice.call(arguments)))};p.Ra=function(){return Y(this,Pc.apply(l,[].slice.call(arguments)))};p.bounds=function(){return Y(this,Qc.apply(l,[].slice.call(arguments)))};p.d=function(){return W(this.G)};p.toString=function(){return"ee.Filter("+Bc(this.G)+")"};u("ee.Filter",X);X.prototype.length=X.prototype.length;X.prototype.and=X.prototype.Pa;X.prototype.eq=X.prototype.Ta;X.prototype.neq=X.prototype.Za;X.prototype.lt=X.prototype.Xa;X.prototype.gte=X.prototype.Wa;
X.prototype.gt=X.prototype.Va;X.prototype.lte=X.prototype.Ya;X.prototype.contains=X.prototype.contains;X.prototype.not_contains=X.prototype.$a;X.prototype.starts_with=X.prototype.cb;X.prototype.not_starts_with=X.prototype.bb;X.prototype.ends_with=X.prototype.Sa;X.prototype.not_ends_with=X.prototype.ab;X.prototype.bounds=X.prototype.bounds;X.prototype.date=X.prototype.Ra;X.prototype.serialize=X.prototype.d;X.prototype.toString=X.prototype.toString;X.and=Oc;
X.or=function(a){var b=Array.prototype.slice.call(arguments);return new X({or:b})};X.eq=Cc;X.neq=Dc;X.lt=Ec;X.gte=Fc;X.gt=Gc;X.lte=Hc;X.contains=Ic;X.not_contains=Jc;X.starts_with=Kc;X.not_starts_with=Lc;X.ends_with=Mc;X.not_ends_with=Nc;X.bounds=Qc;X.date=Pc;var U=function(a){this.c=a};U.prototype.filter=function(a){a||h(Error("Empty filters."));var b;Rc(this)?(b=this.c.collection,a=Y(this.c.filters,a)):b=this.c;return new this.constructor({algorithm:"FilterFeatureCollection",collection:b,filters:a})};var Rc=function(a){return"FilterFeatureCollection"==a.c.algorithm};p=U.prototype;p.ba=function(a,b,c){return this.filter($(a,b,c))};p.$=function(a){return this.filter(Qc(a))};p.aa=function(a,b){return this.filter(Pc(a,b))};
p.H=function(a){return xc({json:this.d()},a)};p.d=function(){for(var a=this;Rc(a)&&0==a.c.filters.length();)a=a.c.collection;return W(a.c)};p.ca=function(a,b,c){a={algorithm:"LimitFeatureCollection",collection:this,limit:a};b&&(a.key=b,c&&(a.ascending=c));return new this.constructor(a)};p.sort=function(a,b){var c={algorithm:"LimitFeatureCollection",collection:this,key:a};b&&(c.ascending=b);return new this.constructor(c)};p.geometry=function(){return{algorithm:"ExtractGeometry",collection:this}};
u("ee.Collection",U);U.prototype.filter=U.prototype.filter;U.prototype.filterMetadata=U.prototype.ba;U.prototype.filterBounds=U.prototype.$;U.prototype.filterDate=U.prototype.aa;U.prototype.getInfo=U.prototype.H;U.prototype.serialize=U.prototype.d;U.prototype.limit=U.prototype.ca;U.prototype.sort=U.prototype.sort;U.isFilterFeatureCollection_=Rc;var Q=function(a){if(!(this instanceof Q))return new Q(a);sc();if(fa(a))a={algorithm:"Constant",value:a};else if(s(a))a={type:"Image",id:a};else{if(r(a))return Sc(Na(a,function(a){return new Q(a)}));if(a instanceof Q)return a}this.c=a};Q.prototype.H=function(){return xc({json:this.d()})};Q.prototype.getMap=function(a,b){var c=a||{};c.image=this.d();if(b)wc(c,t(function(a,c){a&&(a.image=this);b(a,c)},this));else return c=wc(c),c.image=this,c};
Q.prototype.Ua=function(a){a=a||{};a.image=this.d();a=yc(a);return zc(a)};Q.prototype.d=function(){return W(this.c)};var Sc=function(a,b){0==a.length&&h(Error("Can't combine 0 images."));for(var c=new Q(a[0]),d=1;d<a.length;d++)c=new Q({algorithm:"Image.addBands",dstImg:c,srcImg:new Q(a[d])});b&&(c=c.select([".*"],b));return c};
Q.prototype.select=function(a,b){var c={algorithm:"Image.select",input:this,bandSelectors:a};if(r(a))b&&(c.newNames=b);else{a=Array.prototype.slice.call(arguments);for(var d=0;d<a.length;d++)!s(a[d])&&!fa(a[d])&&h(Error("Illegal argument to select(): "+a[d]));c.bandSelectors=a}return new Q(c)};Q.prototype.toString=function(){return"ee.Image("+Bc(this.c)+")"};u("ee.Image",Q);Q.prototype.getInfo=Q.prototype.H;Q.prototype.getDownloadURL=Q.prototype.Ua;Q.prototype.getMap=Q.prototype.getMap;
Q.prototype.select=Q.prototype.select;Q.prototype.serialize=Q.prototype.d;Q.cat=function(a){var b=Array.prototype.slice.call(arguments);return Sc(b,l)};Q.combine_=Sc;Q.rgb=function(a,b,c){return Sc([a,b,c],["vis-red","vis-green","vis-blue"])};Q.toString=Q.toString;var R=function(a,b){if(!(this instanceof R))return new R(a,b);sc();if(a instanceof R)return b&&h(Error("Can't create Feature out of a Feature and properties.")),a;a.coordinates&&Tc(a)?this.c={type:"Feature",geometry:a,properties:b}:"Feature"==a.type||"algorithm"in a&&b===j?this.c=a:h(Error("Not a geometry, feature or JSON description."))};
R.prototype.getMap=function(a,b){var c=new Q({algorithm:"DrawVector",collection:{type:"FeatureCollection",features:[this]},color:(a||{}).color||"000000"});if(b)c.getMap(l,b);else return c.getMap()};
var Tc=function(a){var b=a.type;a=Uc(a.coordinates);return"Point"==b&&1==a||"MultiPoint"==b&&2==a||"LineString"==b&&2==a||"LinearRing"==b&&2==a||"MultiLine"==b&&3==a||"Polygon"==b&&3==a||"MultiPolygon"==b&&4==a},Uc=function(a){if(!r(a))return-1;if(r(a[0])){for(var b=Uc(a[0]),c=1;c<a.length;c++)if(Uc(a[c])!=b)return-1;return b+1}for(c=0;c<a.length;c++)if(!fa(a[c]))return-1;return 0==a.length%2?1:-1},Vc=function(a,b,c){(2>b||4<b)&&h(Error("Unexpected nesting level."));if(!r(a)&&c&&(a=Array.prototype.slice.call(c),
"number"==typeof a[0])){0!=a.length%2&&h(Error("Invalid number of coordinates: "+a.length));c=[];for(var d=0;d<a.length;d+=2)c.push([a[d],a[d+1]]);a=c}c=a;for(d=0;r(c);)c=c[0],d++;for(;d<b;)a=[a],d++;Uc(a)!=b&&h(Error("Invalid geometry"));return a};R.prototype.d=function(){return W(this.c)};R.prototype.toString=function(){return"ee.Feature("+Bc(this.c)+")"};u("ee.Feature",R);R.validGeometry=Tc;R.validCoordinates=Uc;R.Point=function(a,b){return{type:"Point",coordinates:[a,b]}};
R.MultiPoint=function(a){return{type:"MultiPoint",coordinates:Vc(a,2,arguments)}};R.Rectangle=function(a,b,c,d){r(a)&&(d=a,a=d[0],b=d[1],c=d[2],d=d[3]);return{type:"Polygon",coordinates:[[[a,d],[a,b],[c,b],[c,d]]]}};R.LineString=function(a){return{type:"LineString",coordinates:Vc(a,2,arguments)}};R.LinearRing=function(a){return{type:"LinearRing",coordinates:Vc(a,2,arguments)}};R.MultiLine=function(a){return{type:"MultiLine",coordinates:Vc(a,3,arguments)}};
R.Polygon=function(a){return{type:"Polygon",coordinates:Vc(a,3,arguments)}};R.MultiPolygon=function(a){return{type:"MultiPolygon",coordinates:Vc(a,4,arguments)}};R.getMap=R.prototype.getMap;R.prototype.serialize=R.prototype.d;R.prototype.toString=R.prototype.toString;var S=function(a,b){if(!(this instanceof S))return new S(a,b);sc();a instanceof R&&(a=[a]);if(s(a))a={type:"FeatureCollection",id:a},b&&(a.geo_column=b);else if(fa(a))a={type:"FeatureCollection",table_id:a},b&&(a.geo_column=b);else if(r(a))a={type:"FeatureCollection",features:Na(a,function(a){return new R(a)})};else if(a instanceof S)return a;this.c=a};v(S,U);S.prototype.getMap=function(a,b){var c=new Q({algorithm:"DrawVector",collection:this,color:(a||{}).color||"000000"});if(b)c.getMap(l,b);else return c.getMap()};
S.prototype.toString=function(){return"ee.FeatureCollection("+Bc(this.c)+")"};S.prototype.map=function(a,b,c,d){var f;ga(a)?(b&&h(Error("Can't use dynamicArgs with a mapped JS function.")),f=[uc(["FC_GEN_VAR"],a(tc(R,"FC_GEN_VAR"))),{FC_GEN_VAR:".all"},c,d]):f=arguments;return U.prototype.map.apply(this,f)};u("ee.FeatureCollection",S);S.prototype.filter=S.prototype.filter;S.prototype.filterDate=S.prototype.aa;S.prototype.filterMetadata=S.prototype.ba;S.prototype.filterBounds=S.prototype.$;
S.prototype.getInfo=S.prototype.H;S.prototype.limit=S.prototype.ca;S.prototype.serialize=S.prototype.d;S.prototype.sort=S.prototype.sort;S.prototype.geometry=S.prototype.geometry;S.prototype.getMap=S.prototype.getMap;S.prototype.toString=S.prototype.toString;var T=function(a){if(!(this instanceof T))return new T(a);sc();a instanceof Q&&(a=[a]);if(s(a))a={type:"ImageCollection",id:a};else if(r(a))a={type:"ImageCollection",images:Na(a,function(a){return new Q(a)})};else if(a instanceof T)return a;this.c=a};v(T,U);p=T.prototype;p.getMap=function(a,b){var c=this.Aa();if(b)c.getMap(a,b);else return c.getMap(a)};p.Aa=function(){return new Q({creator:"SimpleMosaic",args:[this]})};
p.Qa=function(a){return new T({algorithm:"CombineCollectionBands",primary:this,secondary:a})};p.toString=function(){return"ee.ImageCollection("+Bc(this.c)+")"};p.map=function(a,b,c,d){var f;ga(a)?(b&&h(Error("Can't use dynamicArgs with a mapped JS function.")),f=[uc(["IC_GEN_VAR"],a(tc(Q,"FC_GEN_VAR"))),{IC_GEN_VAR:".all"},c,d]):f=arguments;return new T(U.prototype.map.apply(this,f).c)};u("ee.ImageCollection",T);T.prototype.getMap=T.prototype.getMap;T.prototype.mosaic=T.prototype.Aa;
T.prototype.combine=T.prototype.Qa;T.prototype.filter=T.prototype.filter;T.prototype.filterDate=T.prototype.aa;T.prototype.filterMetadata=T.prototype.ba;T.prototype.filterBounds=T.prototype.$;T.prototype.getInfo=T.prototype.H;T.prototype.limit=T.prototype.ca;T.prototype.serialize=T.prototype.d;T.prototype.sort=T.prototype.sort;T.prototype.toString=T.prototype.toString;var P={j:function(a){P.C||(a?V("/algorithms",vc({}),function(b){P.C=b;a()},"GET"):P.C=V("/algorithms",vc({}),j,"GET"))},get:function(a){P.j();var b=P.C[a];b||h(Error("Unknown algorithm"));a in b||(b.name=a);return b},D:function(a,b,c){b=b||[];c=c||{};var d=a.args,f=b.length+c.length;f>d.length&&h(Error("Incorrect number of arguments: "+a.name+" expects no more than "+d.length+" arguments, got "+f+"."));for(var f={},e=0;e<d.length;e++)f[d[e].name]=k;var e=[],g;for(g in c)g in f||e.push(g);0<e.length&&
h(Error("Unrecognized arguments: "+a.name+"("+e+")"));for(e=0;e<b.length;e++)g=d[e].name,g in c&&h(Error("Argument already set: "+a.name+"("+g+")")),c[g]=b[e];for(e=0;e<d.length;e++)g=d[e].name,g in c?c[g]=P.Ba(d[e].type,c[g]):d[e].optional||h("Missing required argument: "+g);c.algorithm=a.name;return P.Ba(a.returns,c)},qa:function(a,b){var c=function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(this);return P.D(a,c,b)};P.va(c,a);return c},Ea:function(a,b){var c=P.qa(a,b),d=function(){var a=
arguments,b=j,d=arguments[arguments.length-1];d&&ga(d)&&(b=d,a=Array.prototype.slice.call(arguments,0,arguments.length-1));a=c.apply(this,a);return xc({json:W(a)},b)};d.signature=c.signature;d.toString=c.toString;return d},ma:function(a,b){var c=function(){var c=Array.prototype.slice.call(arguments,0),d=qa(a);d.returns=l;d.args=a.args.slice(1);d=P.D(d,c,b);"algorithm"in d&&delete d.algorithm;var g={};g[a.args[0].name]=".all";c="Image"==a.returns?T:S;d={constantArgs:d,baseAlgorithm:a.name,collection:this,
dynamicArgs:g,algorithm:"MapAlgorithm"};"Image"==a.returns||("EEObject"==a.returns||"Feature"==a.returns)||(d.destination=a.name.split(".").pop());return new c(d)},d=qa(a);d.name="Map("+a.name+", this)";d.args=d.args.slice();d.args[0]=qa(d.args[0]);d.args[0].name="["+d.args[0].name+"]";d.args[0].type+="Collection";P.va(c,d);return c},va:function(a,b){a.signature=b;a.toString=function(){var a=[];a.push(b.name);a.push("(");a.push(Na(b.args.slice(1),function(a){return a.name}).join(", "));a.push(")\n\n");
a.push(b.description);a.push("\n\nArgs:\n");for(var d=0;d<b.args.length;d++){0==d?a.push(" this:"):a.push("\n ");var f=b.args[d];a.push(f.name);a.push(" (");a.push(f.type);f.optional&&a.push(", optional");a.push("): ");a.push(f.description)}return a.join("")}},i:function(a,b,c,d){P.j();c=c||"";d=d||P.qa;for(var f in P.C){var e=f.split(".");if(2==e.length&&e[0]==b){var e=c+e[1],g=P.C[f];g.name=f;e in a.prototype&&(e+="_");a.prototype[e]=d(g)}}},Ba:function(a,b){switch(a){case "Image":return new Q(b);
case "ImageCollection":return new T(b);case "Feature":case "EEObject":return b instanceof U?{type:"Feature",geometry:b.geometry(),properties:{}}:new R(b);case "FeatureCollection":case "EECollection":return new S(b);case "ErrorMargin":return fa(b)?{type:"ErrorMargin",unit:"meters",value:b}:b;default:return b}}};u("ee.Algorithms",P);u("ee.Algorithms.addFunctions",P.i);u("ee.Algorithms.applySignature_",P.D);u("ee.Algorithms.init",P.j);u("ee.Algorithms.get",P.get);})();