-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbgeigie_viewer.js
More file actions
1 lines (1 loc) · 62 KB
/
Copy pathbgeigie_viewer.js
File metadata and controls
1 lines (1 loc) · 62 KB
1
var BVM=function(){function i(t,e){if(this.mapRef=t,this.isMobile=r(),this.xfm=null,this.mks=null,this.wwm=null,this.did_add_gmaps_listeners=!1,this.zoom_to_log_extent=!0,this.Init_DataBindDefaults(),null!=e)for(var s in e)this.dataBinds[s]=e[s];this.Init()}i.prototype.Init=function(){this.Init_XFM(),this.Init_MKS(),this.Init_WWM()},i.prototype.Init_DataBindDefaults=function(){this.dataBinds={elementIds:{bv_transferBar:"bv_transferBar"},cssClasses:{bv_hline:"bv_hline",bv_FuturaFont:"bv_FuturaFont",bv_transferBarHidden:"bv_transferBarHidden",bv_transferBarVisible:"bv_transferBarVisible"},urls:{world_155a_z0:"world_155a_z0.png",bv_worker_min:"bgeigie_viewer_worker_min.js"}}},i.prototype.AddGmapsListener_Idle=function(){var t=function(){this.mks.RemoveMarkersFromMapForCurrentVisibleExtent(),this.mks.AddMarkersToMapForCurrentVisibleExtent()}.bind(this);google.maps.event.addListener(this.mapRef,"idle",t)},i.prototype.AddGmapsListener_OnStreetViewExit=function(){var o=this.mapRef.getStreetView(),t=function(){if(o.getVisible()){this.mks.RemoveAllMarkersFromMap();var t=o.getPosition(),e=t.lat(),s=t.lng(),i=s-.005,r=e-.005,n=s+.005,a=e+.005;this.mks.RemoveAllMarkersFromMap(),this.mks.AddMarkersToMapForExtentTimer(i,r,n,a,-9e3,-9e3,21,[0,0,0,0,0,0,0],0,500,0,null,null)}else this.mks.RemoveMarkersFromMapForCurrentVisibleExtent(),this.mks.AddMarkersToMapForCurrentVisibleExtent()}.bind(this);google.maps.event.addListener(o,"visible_changed",t)},i.prototype.AddGmapsListener_OnStreetViewPositionChanged=function(){var o=this.mapRef.getStreetView(),t=function(){if(o.getVisible()){var t=o.getPosition(),e=t.lat(),s=t.lng(),i=s-.005,r=e-.005,n=s+.005,a=e+.005;this.mks.RemoveAllMarkersFromMap(),this.mks.AddMarkersToMapForExtentTimer(i,r,n,a,-9e3,-9e3,21,[0,0,0,0,0,0,0],0,500,0,null,null)}}.bind(this);google.maps.event.addListener(o,"position_changed",t)},i.prototype.AddGmapsListeners_IfNeeded=function(){this.did_add_gmaps_listeners||(this.AddGmapsListener_Idle(),this.AddGmapsListener_OnStreetViewExit(),this.AddGmapsListener_OnStreetViewPositionChanged(),this.did_add_gmaps_listeners=!0)},i.prototype.Init_XFM=function(){var t=function(t){this.TransferBar_SetHidden(!1)}.bind(this),e=function(t){this.xfm.ChangeMode(XFM.ModeCPU);var e=function(){this.wwm.TerminateWorkers(),this.zoom_to_log_extent&&this.mks.ApplyMapVisibleExtentForMarkers(),this.mks.AddMarkersToMapForCurrentVisibleExtent(),this.AddGmapsListeners_IfNeeded(),setTimeout(function(){this.TransferBar_SetHidden(!0),this.xfm.ChangeMode(XFM.ModeXF)}.bind(this),2500)}.bind(this),s=null==this.mks.cpms?0:this.mks.cpms.length;0<s&&(s<5e6||this.isMobile&&s<1e4)?(this.wwm.SetFxReportDoneSortByQuadKey(e),this.mks.SortByQuadKey()):e()}.bind(this),s=document.getElementById(this.dataBinds.elementIds.bv_transferBar);this.xfm=new XFM(t,e,null,"Data Transfer",this.dataBinds.cssClasses.bv_hline,s,this.dataBinds.cssClasses.bv_FuturaFont,this.isMobile,this.dataBinds.urls.world_155a_z0)},i.prototype.Init_MKS=function(){var t=function(){return this.wwm.GetWorkerForDispatch()}.bind(this),e=function(){this.xfm.ClearAllLogIds()}.bind(this),s=function(t){this.xfm.ReportResultsSuccessForLogId(t)}.bind(this);this.mks=new MKS(this.mapRef,ICO.IconStyleMd,1.5<window.devicePixelRatio,this.isMobile,this.dataBinds.cssClasses.bv_FuturaFont,t,e,s)},i.prototype.Init_WWM=function(){var t=function(t){this.xfm.ReportResultsSuccessForLogId(t)}.bind(this),e=function(t){this.xfm.ReportStartParsingForLogId(t)}.bind(this),s=function(t){this.xfm.ReportDoneParsingForLogId(t)}.bind(this),i=function(t){this.xfm.UpdateGlobalImage(t)}.bind(this),r=function(t){this.xfm.ReportDoneAssignZForLogId(t)}.bind(this),n=function(t,e,s,i,r,n,a,o,l,h,d,u){this.mks.GetDataAndDispatchPrefilterVec(t,e,s,i,r,n,a,o,l,h,d,u)}.bind(this),a=function(t,e,s,i,r,n,a,o,l,h,d){this.mks.AddData(t,e,s,i,r,n,a,o,l,h,d)}.bind(this),o=function(t,e,s,i){this.mks.UpdateMarkerExtent(t,e,s,i)}.bind(this),l=function(){return null==this.mks.logids}.bind(this),h=function(t){this.mks.CopySummaryStats(t)}.bind(this);this.wwm=new WWM(this.isMobile,0,t,e,s,i,r,n,a,o,l,h,this.dataBinds.urls.bv_worker_min)},i.prototype.GetJSONAsyncByQuery_AllPages=function(t,e,s,i,r){var n="API Query, Page "+s,a=function(t,e){var s=null!=t&&0<t.length;if(s){for(var i=JSON.parse(t),r=0,n=0;n<i.length;n++)if(null!=i[n]&&0!=i[n].measurements_count){var a=i[n].id,o=null!=window.TextDecoder?"arraybuffer":null,l=function(t,e){this.wwm.DispatchLogParseToVec(t,a,e)}.bind(this);this.xfm.AddTask(i[n].source.url,o,l,[i[n].id],"bGeigie Log",XF.TypeLog,i[n].id),r++}else console.log("BVM.GetJSONAsyncByQuery_AllPages: Log ID=%d had 0 measurements, skipping.",i[n].id);(s=0<r&&e[2]<e[3])&&this.GetJSONAsyncByQuery_AllPages(e[0],e[1],e[2]+1,e[3],e[4])}if(!s){var h=e[0]+(1<e[2]?"&page="+e[2]:"")+(null!=e[4]?e[4]:"");this.xfm.ReportResultsErrorForURL(h)}}.bind(this),o=t+(1<s?"&page="+s:"")+(null!=r?r:"");this.xfm.AddTask(o,null,a,[t,e,s,i,r],n,e,0)},i.prototype.GetJSONAsync=function(a){var t=function(t,e){var s=null!=t&&0<t.length;if(s){var i=JSON.parse(t);if(null!=i&&null!=i.source&&null!=i.source.url&&0<i.source.url.length){var r=i.id,n=null!=window.TextDecoder?"arraybuffer":null;this.xfm.AddTask(i.source.url,n,function(t,e){this.wwm.DispatchLogParseToVec(t,r,e)}.bind(this),[i.id],"bGeigie Log",XF.TypeLog,i.id)}else s=!1}s||this.xfm.ReportResultsErrorForURL(a)}.bind(this);this.xfm.AddTask(a,null,t,null,"API Query - Log",XF.TypeLogQueryByLog,0)},i.prototype.GetLogFileDirectFromUrlAsync=function(t,s,e){var i=null!=window.TextDecoder?"arraybuffer":null;this.xfm.AddTask(t,i,function(t,e){0<e.length&&null!=e[1]&&(e[1](),e=[e[0]]),this.wwm.DispatchLogParseToVec(t,s,e)}.bind(this),[s,e],"bGeigie Log",XF.TypeLog,s)},i.prototype.AddLogsByQueryFromString=function(t,e,s){if(null==t||0==t.length){var i="https://api.safecast.org/bgeigie_imports.json?order=created_at+desc";this.GetJSONAsyncByQuery_AllPages(i,XF.TypeLogQueryByUser,1,s,e)}if(null!=t&&0<t.length&&"c"==t.substring(0,1)&&0==t.indexOf("cosmic")){s=250;i="https://api.safecast.org/bgeigie_imports.json?subtype=Cosmic";this.GetJSONAsyncByQuery_AllPages(i,XF.TypeLogQueryByUser,1,s,e)}if(null!=t&&0<t.length&&"u"==t.substring(0,1)){s=250;i=o(t);this.GetJSONAsyncByQuery_AllPages(i,XF.TypeLogQueryByUser,1,s,e)}if(null!=t&&0<t.length&&"q"==t.substring(0,1)){s=250;i=a(t);this.GetJSONAsyncByQuery_AllPages(i,XF.TypeLogQueryByText,1,s,e)}for(var r=l(t),n=0;n<r.length;n++){i="https://api.safecast.org/bgeigie_imports/"+r[n]+".json";this.GetJSONAsync(i)}},i.prototype.AddLogsFromQueryTextWithOptions=function(t,e,s,i){1==e&&null!=t&&0<t.length?t="u"+t:2==e&&null!=t&&0<t.length&&(t="q"+t),this.AddLogsByQueryFromString(t,s,i)},i.prototype.RemoveAllMarkersFromMapAndPurgeData=function(){this.mks.RemoveAllMarkersFromMapAndPurgeData()},i.prototype.TransferBar_SetHidden=function(t){e(this.dataBinds.elementIds.bv_transferBar,this.dataBinds.cssClasses.bv_transferBarHidden,this.dataBinds.cssClasses.bv_transferBarVisible,t)},i.prototype.SetParallelism=function(t){this.wwm.SetParallelism(t),this.xfm.SetParallelism(t)},i.prototype.SetZoomToLogExtent=function(t){this.zoom_to_log_extent=t},i.prototype.SetOpenInfowindowOnHover=function(t){this.mks.hover_iw=t},i.prototype.SetNewCustomMarkerOptions=function(t,e,s,i,r,n){this.mks.SetNewCustomMarkerOptions(t,e,s,i,r,n)},i.prototype.SetNewMarkerType=function(t){this.mks.SetNewMarkerType(t)},i.prototype.GetLogIdsEncoded=function(){return this.xfm.GetLogIdsEncoded()},i.prototype.GetAllLogIdsEncoded=function(){return this.xfm.GetAllLogIdsEncoded()},i.prototype.GetLogCount=function(){return null==this.xfm||null==this.xfm.logIds?0:this.xfm.logIds.length};var r=function(){var t,e=!1,s=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(window.location.href);return null==e?"":e[1]}("mobile");return null!=s&&0<s.length?e=1==parseInt(s):(t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte|android|ipad|playbook|silk\-/i.test(t.substr(0,4)))&&(e=!0),e||(e=navigator.userAgent.match(/iPad/i)),e||(e=navigator.userAgent.match(/Android/i)),e||(e=0<window.navigator.userAgent.indexOf("iPad")),e||(e=0<window.navigator.userAgent.indexOf("Android"))),e},e=function(t,e,s,i){var r=document.getElementById(t);null!=r&&i&&r.className==s?r.className=e:null==r||i||r.className!=e||(r.className=s)},a=function(t){var e=1<t.length?t.substring(1,t.length):null;return null!=e?"https://api.safecast.org/bgeigie_imports.json?q="+e+"&order=created_at+desc":null},o=function(t){var e=1<t.length?t.substring(1,t.length):null;return null!=e?"https://api.safecast.org/bgeigie_imports.json?by_user_id="+e+"&order=created_at+desc":null},l=function(t){var e=new Array;if(null!=t&&0<t.length)for(var s=t.split(","),i=0;i<s.length;i++){var r=parseInt(s[i]);null!=r&&0<r&&e.push(r)}return e};return i.ApiStatus={Null:0,Uploaded:1,Unprocessed:2,Processed:3,MetadataAdded:4,Submitted:5,Approved:6,Done:7},i.prototype._ApiStatusGet=function(){for(var t=document.getElementsByTagName("ul"),e=null,s=0;s<t.length;s++)if("progress"==t[s].getAttribute("id")){e=t[s].getAttribute("data-status");break}return e},i.prototype._ApiStatusGetIsEq=function(t){var e=this._ApiStatusGet();return null!=t&&null!=e&&e.toLowerCase()==t.toLowerCase()},i.prototype._ApiStatusCheck=function(t){_DebugToStorage("_ApiStatusCheck: START!");var e=!1,s=null;switch(t){case i.ApiStatus.Uploaded:s="uploaded";break;case i.ApiStatus.Unprocessed:s="unprocessed";break;case i.ApiStatus.Processed:s="processed";break;case i.ApiStatus.MetadataAdded:s="metadata_added";break;case i.ApiStatus.Submitted:s="submitted";break;case i.ApiStatus.Approved:s="approved";break;case i.ApiStatus.Done:s="done"}return null!=s&&(e=this._ApiStatusGetIsEq(s)),_DebugToStorage("_ApiStatusCheck: Input="+t+", txt=["+(null==s?"<NULL>":s)+"]"),e},i.prototype._ApiMetadataFieldCheck=function(t){return null!=t&&0<t.length&&"none"!=t.toLowerCase()&&"not set"!=t.toLowerCase()},i.prototype._ApiMetadataCheck=function(){var t=!1,e=this._ApiMetadataGet();return this._ApiMetadataFieldCheck(e.credits)&&this._ApiMetadataFieldCheck(e.cities)&&(t=!0),t},i.prototype._ApiMetadataGet=function(){var t={uploader:null,filename:null,lines:null,n:null,title:null,desc:null,credits:null,height:null,orientation:null,subtype:null,cities:null,comment:null},e=document.getElementById("metadata");if(null!=e){var s=e.firstElementChild.firstElementChild,i=s.getElementsByTagName("dd");t.uploader=i[0].innerHTML.trim(),t.filename=i[1].innerHTML.trim(),t.lines=i[2].innerHTML.trim(),t.n=i[3].innerHTML.trim(),i=s.nextElementSibling.getElementsByTagName("dd"),t.title=i[0].innerHTML.trim(),t.desc=i[1].firstElementChild.innerHTML.trim(),t.credits=i[2].innerHTML.trim(),t.height=i[3].innerHTML.trim(),t.orientation=i[4].innerHTML.trim(),t.subtype=i[5].innerHTML.trim(),t.cities=i[6].innerHTML.trim(),t.comment=i[7].firstElementChild.innerHTML.trim()}return t},i.prototype._ApiShouldShowOnBeforeUnload=function(){var t=!1,e="";return this._ApiStatusCheck(i.ApiStatus.Uploaded)||this._ApiStatusCheck(i.ApiStatus.Unprocessed)?(e="You've submitted the log file, but you must wait for it to be processed, have metadata entered, and manually submit the file to the system.",t=!0):this._ApiStatusCheck(i.ApiStatus.Processed)?(e=this._ApiMetadataCheck()?"You must click the [SUBMIT FOR APPROVAL] button manually or this log will never make it into the system.":"You must enter metadata, then click [SUBMIT FOR APPROVAL] manually or this will never make it into the system.",t=!0):this._ApiStatusCheck(i.ApiStatus.MetadataAdded)?(e="You must enter metadata, then click [SUBMIT FOR APPROVAL] manually or this will never make it into the system.",t=!0):e="[DEBUG] _ApiShouldShowOnBeforeUnload - all checks passed!",_DebugToStorage(e),t},i.prototype._ApiListenerBeforeUnload_Callback=function(t){if(this._ApiShouldShowOnBeforeUnload())return _DebugToStorage("_ApiListenerBeforeUnload_Callback: _ApiShouldShowOnBeforeUnload was TRUE!"),t.returnValue="Discard changes?";_DebugToStorage("_ApiListenerBeforeUnload_Callback: _ApiShouldShowOnBeforeUnload was FALSE!")},i.prototype._IsPlatformEmbeddedSafecastApi=function(){var t=!1,e=document.getElementById("done");return null!=e&&(0<=e.className.indexOf("bar-warning")||0<=e.className.indexOf("bar-success"))&&(t=!0),t},i.prototype.ApiListenerBeforeUnload_AddRemove=function(t){if(this._IsPlatformEmbeddedSafecastApi()){var e=function(t){_DebugToStorage("FX - beforeunload event wrapper fired!"),this._ApiListenerBeforeUnload_Callback(t)}.bind(this);t?(_DebugToStorage("ApiListenerBeforeUnload_AddRemove: Enabling beforeunload handler!"),window.addEventListener("beforeunload",e,!1)):window.removeEventListener("beforeunload",e)}},_DebugToStorage=function(t){},i}(),WWM=function(){function t(t,e,s,i,r,n,a,o,l,h,d,u,p){this.n=0<e?e:null!=navigator.hardwareConcurrency?navigator.hardwareConcurrency:t?2:4,this.workers=new Array(this.n),this.isBusy=new Uint8Array(this.n),this.index=0,this.fxReportResultsSuccessForLogId=s,this.fxReportStartParsingForLogId=i,this.fxReportDoneParsingForLogId=r,this.fxUpdateGlobalImage=n,this.fxReportDoneAssignZForLogId=a,this.fxReportDoneSortByQuadKey=null,this.fxGetDataAndDispatchPrefilter=o,this.fxAddData=l,this.fxUpdateMarkerExtent=h,this.fxGetIsMoreFields=d,this.fxCopySummaryStats=u,this.workerSrcUrl=p,this.summary_stats=new Array;for(var m=0;m<this.n;m++)this.workers[m]=null}t.prototype.SetFxReportDoneSortByQuadKey=function(t){this.fxReportDoneSortByQuadKey=t},t.prototype.SetParallelism=function(t){var e=s(this.isBusy,0,Math.min(this.n,this.workers.length));this.n=t,0==e&&this.TerminateWorkers()},t.prototype.DispatchLogParseToVec=function(t,e,s){var i=this.GetWorkerForDispatch(),r=null,n={op:"PARSE_LOG_TO_VEC",log:t,logId:e,userData:s,is_more_fields:this.fxGetIsMoreFields(),deci:0,worker_id:i[1]};"string"!=typeof t&&(n.log=null,r=[n.logbuffer=t]),i[0].postMessage(n,r),s=t=null},t.prototype.GetWorkerForDispatch=function(){for(var t=-1,e=Math.min(this.n,this.workers.length),s=0;s<e;s++)0==this.isBusy[s]&&(t=s);if(-1==t&&(this.index=this.index<e-1?this.index+1:0,t=this.index),this.isBusy[t]=1,null==this.workers[t]){var i=new Worker(this.workerSrcUrl);this.AddWorkerCallback(i),this.workers[t]=i}return[this.workers[t],t]},t.prototype.ReportWorkerIsDone=function(t){null!=t&&0<t&&t<this.isBusy.length&&(this.isBusy[t]=0)},t.prototype.TerminateWorkers=function(){if(null!=this.workers){for(var t=0;t<this.workers.length;t++)this.isBusy[t]=1,null!=this.workers[t]&&this.workers[t].terminate();this.isBusy=new Uint8Array(this.n),this.workers=new Array(this.n);for(t=this.index=0;t<this.n;t++)this.workers[t]=null}},t.prototype.AddWorkerCallback=function(t){t.onerror=function(t){var e=null!=t&&null!=t.lineno?t.lineno:"<NULL>",s=null!=t&&null!=t.filename?t.filename:"<NULL>",i=null!=t&&null!=t.message?t.message:"<NULL>";console.log("WMM: ERROR from worker: Line "+e+" in "+s+": "+i)}.bind(this),t.onmessage=function(t){if(null==t||null==t.data||null==t.data.op)console.log("WWM: Message from worker: unknown.");else if("PARSE_LOG_TO_VEC"==t.data.op){var e=new Int8Array(t.data.minzs),s=new Float32Array(t.data.cpms),i=new Int16Array(t.data.alts),r=new Int8Array(t.data.degs),n=new Uint32Array(t.data.times),a=new Uint32Array(t.data.mxs),o=new Uint32Array(t.data.mys),l=new Float32Array(t.data.litcpms),h=new Float32Array(t.data.litcp5s),d=new Uint8Array(t.data.valids),u=t.data.userData[0];t.data.ex;this.fxReportDoneAssignZForLogId(u),this.fxUpdateMarkerExtent(t.data.ex[0],t.data.ex[1],t.data.ex[2],t.data.ex[3]),this.ReportWorkerIsDone(t.data.worker_id),this.fxGetDataAndDispatchPrefilter(a,o,e,s,i,r,n,l,h,d,u,t.data.userData)}else if("MSG_START_PARSING"==t.data.op)this.fxReportStartParsingForLogId(t.data.userData[0]);else if("TILE_CALLBACK"==t.data.op){this.fxReportDoneParsingForLogId(t.data.userData[0]);var p=new Uint8Array(t.data.buffer);this.fxUpdateGlobalImage(p)}else if("DATA_FOR_PARSED_LOG"==t.data.op){e=new Int8Array(t.data.minzs),s=new Float32Array(t.data.cpms),i=new Int16Array(t.data.alts),r=new Int8Array(t.data.degs);var m=new Int32Array(t.data.logids);n=new Uint32Array(t.data.times),a=new Uint32Array(t.data.mxs),o=new Uint32Array(t.data.mys);0<t.data.shouldAdd_c&&this.fxAddData(e,s,i,r,m,n,a,o),this.ReportWorkerIsDone(t.data.worker_id),this.fxReportResultsSuccessForLogId(t.data.logId)}else if("ORDER_BY_QUADKEY_ASC"==t.data.op){e=new Int8Array(t.data.minzs),s=new Float32Array(t.data.cpms),i=new Int16Array(t.data.alts),r=new Int8Array(t.data.degs),m=new Int32Array(t.data.logids),n=new Uint32Array(t.data.times),a=new Uint32Array(t.data.mxs),o=new Uint32Array(t.data.mys),l=new Float32Array(t.data.litcpms),h=new Float32Array(t.data.litcp5s),d=new Uint8Array(t.data.valids);for(var _=!0,c=0<m.length?m[0]:-1,f=0;f<m.length;f++){if(m[f]!=c){_=!1;break}c=m[f]}_||(d=h=l=null),this.fxAddData(e,s,i,r,m,n,a,o,l,h,d),this.ReportWorkerIsDone(t.data.worker_id),this.fxReportDoneSortByQuadKey()}else if("SUMMARY_STATS"==t.data.op){this.summary_stats.push(t.data.summary_stats),this.fxCopySummaryStats(t.data.summary_stats);var g={n:0,dist_meters:0,time_ss:0,sum_usvh:0,mean_usvh:0,de_usv:0,min_usvh:9e3,max_usvh:-9e3,min_kph:9e3,max_kph:-9e3,min_alt_meters:9e3,max_alt_meters:-9e3};for(f=0;f<this.summary_stats.length;f++){var y=this.summary_stats[f];g.n+=y.n,g.dist_meters+=y.dist_meters,g.time_ss+=y.time_ss,g.sum_usvh+=y.sum_usvh,g.de_usv+=y.de_usv,y.min_usvh<g.min_usvh&&(g.min_usvh=y.min_usvh),y.max_usvh>g.max_usvh&&(g.max_usvh=y.max_usvh),y.min_kph<g.min_kph&&(g.min_kph=y.min_kph),y.max_kph>g.max_kph&&(g.max_kph=y.max_kph),y.min_alt_meters<g.min_alt_meters&&(g.min_alt_meters=y.min_alt_meters),y.max_alt_meters>g.max_alt_meters&&(g.max_alt_meters=y.max_alt_meters)}g.mean_usvh=g.sum_usvh/g.n,console.log("WWM: Aggregate [%d] summary stats: { n:%d, dist_km:%s, time_hh:%s, mean_usvh:%s, de_usv:%s, min_usvh:%s, max_usvh:%s, min_kph:%s, max_kph:%s, min_alt_meters:%s, max_alt_meters:%s };",this.summary_stats.length,g.n,(g.dist_meters/1e3).toFixed(2),(g.time_ss/3600).toFixed(2),g.mean_usvh.toFixed(2),g.de_usv.toFixed(2),g.min_usvh.toFixed(2),g.max_usvh.toFixed(2),g.min_kph.toFixed(0),g.max_kph.toFixed(0),g.min_alt_meters.toFixed(0),g.max_alt_meters.toFixed(0))}else console.log("WWM: Worker: %s",t.data.txt)}.bind(this)};var s=function(t,e,s){for(var i=0,r=e;r<e+s;r++)i+=t[r];return i};return t}(),XF=function(){function d(t,e,s,i,r,n,a,o,l,h){this.xfId=t,this.ordinal=s,this.url=i,this.bytes=0,this.bytes_max=0,this.fxCallback=r,this.userData=n,this.xfTitle=a+(o==d.TypeLog?" "+e:""),this.xfType=o,this.done=!1,this.error=!1,this.callbackDone=!1,this.tagId=e,this.responseType=l,this.time_started=new Date,this.time_done=null,this.XFM_progress=h,this.statusText="Connecting",this._last_pct=0,this.isStarted=!1,this.isStartParsing=!1,this.isDoneParsing=!1,this.isDoneAssignZ=!1}return d.prototype.SetSuccess=function(){this.callbackDone=!0,this.time_done=new Date,this.XFM_progress(this)},d.prototype.HttpEventReadyStateChange=function(t,e,s){var i=this.bytes,r=null==t?0:"arraybuffer"==this.responseType?t.byteLength:t.length;if(r>this.bytes&&(this.bytes=r),4===e&&200==s)this.done=!0,this.statusText="Done",this.XFM_progress(this),this.fxCallback(t,this.userData),this.fxCallback=null,this.userData=null,this.xfType!=d.TypeLog&&this.SetSuccess();else if(4===e&&200!=s)this.statusText="Error",this.done=!0,this.error=!0,this.fxCallback=null,this.userData=null,this.time_done=new Date,this.XFM_progress(this);else if(i!=this.bytes){var n=parseFloat(this.bytes)/parseFloat(this.bytes_max);n>1.01*this._last_pct&&this.XFM_progress(this),this._last_pct=n}},d.prototype.HttpEventProgress=function(t){if(t.lengthComputable&&0==this.bytes_max&&(this.bytes_max=t.total,this.statusText="Downloading"),t.loaded>this.bytes){this.bytes=t.loaded;var e=parseFloat(this.bytes)/parseFloat(this.bytes_max);e>1.01*this._last_pct&&this.XFM_progress(this),this._last_pct=e}},d.prototype.HttpEventError=function(t,e){this.statusText="error"==e?"Error":"Aborted",this.done=!0,this.error=!0,this.fxCallback=null,this.userData=null,this.time_done=new Date,this.XFM_progress(this)},d.prototype.HttpGet=function(){this.isStarted=!0;var t=new XMLHttpRequest;t.open("GET",this.url,!0),null!=this.responseType&&(t.responseType=this.responseType);var e=function(t){this.HttpEventProgress(t)}.bind(this),s=function(t){this.HttpEventError(t,"error")}.bind(this),i=function(t){this.HttpEventError(t,"abort")}.bind(this);t.addEventListener("progress",e,!1),t.addEventListener("error",s,!1),t.addEventListener("abort",i,!1),t.onreadystatechange=function(){this.HttpEventReadyStateChange(t.response,t.readyState,t.status)}.bind(this),t.send(null),this.XFM_progress(this)},d.prototype.GetProgressBytesText=function(){var t=d.GetKbOrMbWithLabelFor2xBytes(this.bytes,this.bytes_max);return t[0]+" / "+t[1]+" "+t[2]},d.prototype.GetProgressPercentText=function(){return(100*this.GetProgressNormalized()).toFixed(0)+"%"},d.prototype.GetProgressNormalized=function(){return 0<this.bytes_max?parseFloat(this.bytes)/parseFloat(this.bytes_max):0},d.prototype.GetElapsedSinceDoneSS=function(){return null!=this.time_done?this.time_done.getTime()-this.time_started.getTime():0},d.prototype.GetElapsedTimeSS=function(){var t=new Date;return this.time_started.getTime()-t.getTime()},d.GetKbOrMbWithLabelFor2xBytes=function(t,e){var s,i,r;return r=1048576<=t||1048576<=e?(s=9.5367431640625e-7*parseFloat(t),i=9.5367431640625e-7*parseFloat(e),"MB"):(s=.0009765625*parseFloat(t),i=.0009765625*parseFloat(e),"KB"),[s.toFixed(2),i.toFixed(2),r]},d.TypeLog=0,d.TypeLogQueryByUser=1,d.TypeLogQueryByLog=2,d.TypeLogQueryByText=3,d}(),XFM=function(){function h(t,e,s,i,r,n,a,o,l){this.fxCallbackStart=t,this.fxCallbackEnd=e,this.userData=s,this.tasks=new Array,this.xfmId="xfm"+parseInt(65535*Math.random()+1),this.title=i,this.tiClass=r,this.tbClass=a,this.div=n,this.hTbl=null,this.bTbl=null,this.cvx=null,this.xf_div=null,this.cpu_div=null,this.xf_n=0,this.mode=h.ModeXF,this.logIds=new Array,this.queue=new Array,this.noUI=null==this.div,this.para=null!=navigator.hardwareConcurrency?navigator.hardwareConcurrency+4:o?6:8,this.world_png_url=l,this.noUI||(this.NewHeaderTableElement(),this.NewBodyElements())}h.prototype.ChangeMode=function(t){this.mode==h.ModeXF&&t==h.ModeCPU?(this.noUI||(this.xf_div.style.visibility="hidden",this.cpu_div.style.visibility="visible"),this.mode=t):this.mode==h.ModeCPU&&t==h.ModeXF&&(this.noUI||(this.cpu_div.style.visibility="hidden",this.xf_div.style.visibility="visible"),this.mode=t)},h.prototype.GetXFByTagIdAndType=function(t,e){for(var s=null,i=0;i<this.tasks.length;i++)if(this.tasks[i].tagId==t&&this.tasks[i].xfType==e){s=this.tasks[i];break}return s},h.prototype.SetParallelism=function(t){this.para=t+4},h.prototype.ProcessNextInQueue=function(){0<this.queue.length&&this.queue.pop().HttpGet()},h.prototype.GetActiveTaskCount=function(){for(var t=0,e=0;e<this.tasks.length;e++)!this.tasks[e].isStarted||this.tasks[e].callbackDone||this.tasks[e].isError||t++;return t},h.prototype.StartTask=function(t){this.GetActiveTaskCount()<=this.para||t.xfType!=XF.TypeLog?t.HttpGet():this.queue.push(t)},h.prototype.AddTask=function(t,e,s,i,r,n,a){if(n==XF.TypeLog)for(var o=0;o<this.logIds.length;o++)if(this.logIds[o]==a)return void console.log("XFM: logId=%d already on map, request denied.",a);var l=function(t){this.XFCallback(t)}.bind(this),h=new XF(this.xfmId+"_"+this.xf_n,a,this.xf_n+1,t,s,i,r,n,e,l);this.tasks.push(h),this.xf_n=this.xf_n+1,this.fxCallbackStart(this.userData),requestAnimationFrame(function(){this.DataBindRow(h)}.bind(this)),this.StartTask(h)},h.prototype.GetLogIdsEncoded=function(t){var e="";null==t&&(t=25);for(var s=0<=t&&this.logIds.length>t?t:this.logIds.length,i=0;i<s;i++)0<this.logIds[i]&&(e+=this.logIds[i]+(i<this.logIds.length-1?",":""));return e},h.prototype.GetAllLogIdsEncoded=function(){return this.GetLogIdsEncoded(-1)},h.prototype.GetLogIds=function(){return this.logIds},h.prototype.ClearAllLogIds=function(){0<this.logIds.length&&this.ClearGlobalImage(),this.logIds=new Array},h.prototype.ClearGlobalImage=function(){this.cvx.getContext("2d").clearRect(0,0,this.cvx.width,this.cvx.height)},h.prototype.UpdateGlobalImage=function(t){if(!this.noUI)for(var e,s,i=this.cvx.getContext("2d"),r=0;r<256;r++)for(s=256*r,e=0;e<256;e++)if(0<t[s+e]){i.beginPath();var n=i.createRadialGradient(e,r,1,e,r,7);n.addColorStop(0,"rgba(0,0,255,1.0)"),n.addColorStop(1,"rgba(0,0,255,0.0)"),i.arc(e,r,7,0,2*Math.PI),i.fillStyle=n,i.fill()}},h.prototype.ReportDoneParsingForLogId=function(t){var e=this.GetXFByTagIdAndType(t,XF.TypeLog);e.isDoneParsing=!0,this.DataBindRow(e)},h.prototype.ReportDoneAssignZForLogId=function(t){var e=this.GetXFByTagIdAndType(t,XF.TypeLog);e.isDoneAssignZ=!0,this.DataBindRow(e)},h.prototype.ReportStartParsingForLogId=function(t){var e=this.GetXFByTagIdAndType(t,XF.TypeLog);e.isStartParsing=!0,this.DataBindRow(e)},h.prototype.ReportResultsSuccessForLogId=function(t){for(var e=-1,s=0;s<this.tasks.length;s++)if(this.tasks[s].xfType==XF.TypeLog&&!this.tasks[s].callbackDone&&this.tasks[s].done&&!this.tasks[s].error&&this.tasks[s].tagId==t){this.tasks[s].SetSuccess(),e=s;break}-1<e&&this.ProcessNextInQueue()},h.prototype.ReportResultsErrorForURL=function(t){console.log("XFM: error reported for url: %s",t);for(var e=-1,s=0;s<this.tasks.length;s++)if(this.tasks[s].done&&!this.tasks[s].error&&this.tasks[s].url==t){this.tasks[s].error=!0,this.tasks[s].statusText="Error",this.tasks[s].xfType==XF.TypeLog,e=s;break}-1<e&&this.XFCallback(this.tasks[e])},h.prototype.UpdateLogIdsFromXF=function(t){if(null!=t&&t.callbackDone&&!t.error&&t.xfType==XF.TypeLog&&0!=t.tagId){for(var e=!1,s=0;s<this.logIds.length;s++)if(this.logIds[s]==t.tagId){e=!0;break}e||this.logIds.push(t.tagId)}},h.prototype.XFCallback=function(t){var e=!0;null!=t&&(this.DataBindRow(t),this.UpdateLogIdsFromXF(t),t.xfType==XF.TypeLog&&t.error&&this.ProcessNextInQueue());for(var s=0;s<this.tasks.length;s++)this.tasks[s].callbackDone||this.tasks[s].error||(e=!1);e&&this.fxCallbackEnd(this.userData)},h.prototype.RemoveAllRows=function(){for(var t=0;t<this.bTbl.rows.length;t++)this.bTbl.deleteRow(-1)},h.prototype.DataBindRow=function(t){if(null!=t&&!this.noUI){for(var e=-1,s=0;s<this.bTbl.rows.length;s++)if(this.bTbl.rows[s].id==t.xfId){e=s;break}if(-1==e&&t.GetElapsedSinceDoneSS()<3){var i=this.bTbl.insertRow(0);i.id=t.xfId;var r=i.insertCell(-1);r.innerHTML=t.ordinal+".",r.style.textAlign="right",r.style.width="30px",i.insertCell(-1).innerHTML=t.xfTitle;var n=i.insertCell(-1);n.style.textAlign="right",n.innerHTML=a(t)}else t.GetElapsedSinceDoneSS()<3?this.bTbl.rows[e].cells[2].innerHTML=a(t):-1!=e&&3<=t.GetElapsedSinceDoneSS()&&this.bTbl.deleteRow(e)}},h.prototype.NewHeaderTableElement=function(){this.hTbl=document.createElement("table"),this.hTbl.style.cssText="width:256px;border:0px;padding:0px 0px 10px 0px;border-spacing:0px;",this.hTbl.className=this.tbClass;var t=document.createElement("div");t.className=this.tiClass,t.style.cssText="font-size:120%;left:0;right:0;",t.innerHTML=this.title;var e=this.hTbl.insertRow(0).insertCell(0);e.style.textAlign="center",e.appendChild(t),this.div.appendChild(this.hTbl)},h.prototype.NewBodyElements=function(){var t=document.createElement("div");t.style.cssText="position:relative;width:276px;height:256px;";var e=document.createElement("div");e.style.cssText="position:absolute;top:0;left:0;width:256px;height:256px;background:url('"+this.world_png_url+"') no-repeat;opacity:0.4;-webkit-filter:blur(2px);-moz-filter:blur(2px);-o-filter:blur(2px);-ms-filter:blur(2px);filter:blur(2px);",this.xf_div=document.createElement("div"),this.xf_div.style.cssText="position:absolute;top:0;left:0;width:276px;height:256px;overflow-x:hidden;overflow-y:auto;",this.cpu_div=document.createElement("div"),this.cpu_div.style.cssText="position:absolute;top:0;left:0;width:256px;height:256px;display:table;visibility:hidden;",this.cvx=document.createElement("canvas"),this.cvx.width=256,this.cvx.height=256,this.bTbl=document.createElement("table"),this.bTbl.style.cssText="width:256px;border:0px;padding:0px;border-spacing:0px;",this.bTbl.className=this.tbClass,t.appendChild(e),t.appendChild(this.xf_div),t.appendChild(this.cpu_div),e.appendChild(this.cvx),this.xf_div.appendChild(this.bTbl);this.cpu_div.innerHTML="<div style='display:table-cell;vertical-align:middle;text-align:center;'><span style='font-size:140%'>- Please Wait -</span><br/><span style='font-size:60%'>Finalizing Data</span></div>",this.cpu_div.className=this.tbClass,this.div.appendChild(t)};var a=function(t){return t.error?t.statusText:t.isStarted?t.callbackDone?"100%":t.isDoneAssignZ?"Merging":t.isDoneParsing?"Processing":t.isStartParsing?"Parsing":t.done&&t.xfType==XF.TypeLog?"[WAIT]":t.GetProgressPercentText():"Queued"};return h.ModeXF=0,h.ModeCPU=1,h}(),LUT=function(){function t(t,e){this.min=t,this.max=e,this.r=new Uint8Array([1,8,9,10,12,14,16,16,18,18,19,20,21,22,22,24,24,25,25,25,26,26,26,26,25,26,27,26,25,26,26,24,24,25,24,21,21,21,17,16,9,7,0,7,15,23,28,32,34,38,40,43,45,46,50,51,54,55,56,56,56,58,59,59,59,59,59,59,59,59,57,56,56,56,54,51,48,45,43,39,37,33,29,23,10,0,29,39,60,67,84,90,97,105,110,120,124,133,137,143,148,153,161,163,171,173,178,181,185,191,194,200,202,208,210,214,217,220,225,226,233,235,240,242,245,249,251,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]),this.g=new Uint8Array([1,7,7,8,10,11,12,12,13,13,13,13,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,14,14,14,13,13,12,11,11,10,9,5,4,0,9,19,30,36,43,46,56,59,65,70,74,82,85,94,96,103,107,112,118,121,130,132,140,144,150,156,160,167,170,181,184,191,195,200,208,213,221,224,233,237,243,250,255,252,251,242,240,235,231,226,221,219,212,210,204,202,197,192,187,182,180,172,170,163,160,156,151,148,137,134,128,124,117,112,107,100,97,87,83,71,64,56,44,38,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,25,36,42,53,57,68,73,81,85,89,96,98,106,109,119,123,128,133,136,144,146,153,156,162,166,170,180,183,191,193,200,204,208,214,217,224,226,234,239,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]),this.b=new Uint8Array([1,10,12,15,19,23,29,31,38,39,43,48,54,59,61,70,72,79,83,89,94,99,109,112,122,125,135,140,145,153,158,169,173,186,191,199,206,212,223,228,239,244,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,247,242,234,227,221,211,207,196,192,183,179,174,166,161,154,151,140,136,128,123,119,113,111,102,100,94,88,81,75,72,65,63,55,52,47,42,38,32,29,18,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,10,20,23,31,36,41,47,51,62,65,74,78,84,90,94,102,105,115,118,128,133,138,145,148,157,159,168,172,179,186,191,198,202,211,215,222,226,232,238,242,253]),this.n=this.r.length,this.rdiff=1/(this.max-this.min),this.nsb1=parseFloat(this.n-1)}return t.prototype.GetRgbForIdx=function(t){return[this.r[t],this.g[t],this.b[t]]},t.prototype.GetIdxForValue=function(t,e){1<(t=(t-this.min)*this.rdiff)?t=1:t<0&&(t=0),t=.43429448190325176*Math.log(9*t+1),t=.43429448190325176*Math.log(9*t+1),t=.43429448190325176*Math.log(9*t+1),t=.43429448190325176*Math.log(9*t+1);var s=parseInt(t*this.nsb1);return 0<e?s>>e<<e:s},t.prototype.GetRgbForValue=function(t,e){var s=this.GetIdxForValue(t,e);return[this.r[s],this.g[s],this.b[s]]},t}(),ICO=function(){function s(t,e,s,i,r,n,a,o,l,h,d){this.width=t,this.height=e,this.deg=s,this.btick=i,this.lutidx=r,this.red=n,this.green=a,this.blue=o,this.alpha0=l,this.alpha1=h,this.shd_r=d,this.url=null,this.Render()}return s.prototype.Render=function(){var t=document.createElement("canvas"),e=2*(this.shd_r-(this.width>>1)),s=2*(this.shd_r-(this.height>>1)),i=this.width+Math.max(0,e),r=this.height+Math.max(0,s);t.width=i,t.height=r;var n=t.getContext("2d"),a=((this.width<this.height?this.width:this.height)>>1)-1,o=i>>1,l=r>>1;if(a<=0&&(a=1),0<this.alpha0)n.beginPath(),n.arc(o,l,a,0,2*Math.PI),n.fillStyle="rgba("+this.red+", "+this.green+", "+this.blue+", "+this.alpha0+")",0<this.shd_r&&(n.shadowBlur=this.shd_r,n.shadowColor="rgba("+this.red+", "+this.green+", "+this.blue+", 1.0)"),n.fill();else if(0<this.shd_r){n.beginPath();var h=n.createRadialGradient(o,l,1,o,l,this.shd_r);h.addColorStop(0,"rgba("+this.red+", "+this.green+", "+this.blue+", 0.25)"),h.addColorStop(1,"rgba("+this.red+", "+this.green+", "+this.blue+", 0.0)"),n.arc(o,l,this.shd_r,0,2*Math.PI),n.fillStyle=h,n.fill()}if(0<this.alpha1&&3<this.width&&(n.beginPath(),n.arc(o,l,a,0,2*Math.PI),n.strokeStyle="rgba(0, 0, 0, "+this.alpha1+")",n.lineWidth=.5,n.stroke()),0<this.deg&&5<this.width&&this.btick){var d=parseFloat(a),u=parseFloat(this.deg);u=.017453292519943295*(u-90);var p=o+Math.cos(u)*d*1,m=l+Math.sin(u)*d*1;p=Math.round(p),m=Math.round(m),n.beginPath(),n.strokeStyle="rgba(0, 0, 0, "+Math.max(this.alpha0,this.alpha1)+")",n.lineWidth=1,n.moveTo(o,l),n.lineTo(p,m),n.stroke()}this.url=t.toDataURL("image/png")},s.GetIconOptionsForIconStyle=function(t){var e;switch(t){case s.IconStyleSm:e=[7,7,.75,.75,0,!1];break;case s.IconStyleMdB:e=[10,10,.75,.75,0,!0];break;case s.IconStyleLgB:e=[16,16,.75,.75,0,!0];break;case s.IconStyleLg:e=[16,16,.75,.75,0,!1];break;case s.IconStyleMd:e=[10,10,.75,.75,0,!1];break;default:e=[10,10,.75,.75,0,!0]}return{width:e[0],height:e[1],fill_alpha:e[2],stroke_alpha:e[3],shadow_radius:e[4],show_bearing_tick:e[5]}},s.IconStyleSm=0,s.IconStyleMdB=1,s.IconStyleMd=2,s.IconStyleLgB=3,s.IconStyleLg=4,s.IconStyleCustom=5,s}(),MKS=function(){function t(t,e,s,i,r,n,a,o){this.minzs=null,this.cpms=null,this.alts=null,this.degs=null,this.logids=null,this.times=null,this.onmaps=null,this.mxs=null,this.mys=null,this.litcpms=null,this.litcp5s=null,this.valids=null,this.isMobile=i,this.fontCssClass=r,this.isSPARTAAAAAAA=!1,this.mkType=e,this.isRetina=s,this.width=10,this.height=10,this.alpha0=.75,this.alpha1=.75,this.shd_r=0,this.btick=!0,this.icons=new Array,this.lut=new LUT(10.5,22937.25),this.mapref=t,this.inforef=null,this.last_ex=new Float64Array(7),this.last_rm_ex=new Float64Array(7),this.markers=new Array,this.rmpool=new Array,this.m_n=512,this.m_ids=new Int32Array(this.m_n),this.m_idxs=new Uint32Array(this.m_n),this.mk_ex=new Float64Array([9e3,9e3,-9e3,-9e3]),this.hover_iw=!1,this.summary_stats=new Array,this.fxGetWorkerForDispatch=n,this.fxClearAllLogIds=a,this.fxReportResultsSuccessForLogId=o,this.ApplyMarkerType()}t.prototype.CopySummaryStats=function(t){this.summary_stats.push(t)},t.prototype.GetSummaryStatsForLogId=function(t){for(var e=null,s=0;s<this.summary_stats.length;s++)if(this.summary_stats[s].logId==t){e=this.summary_stats[s];break}return e},t.prototype.SetNewCustomMarkerOptions=function(t,e,s,i,r,n){0<this.icons.length&&(this.icons=new Array),this.RemoveAllMarkersFromMap(),this.mkType=ICO.IconStyleCustom,this.width=t,this.height=e,this.alpha0=s,this.alpha1=i,this.shd_r=r,this.btick=n,null!=this.mxs&&this.AddMarkersToMapForCurrentVisibleExtent()},t.prototype.SetNewMarkerType=function(t){t!=this.mkType&&(0<this.icons.length&&(this.icons=new Array),this.mkType=t,this.RemoveAllMarkersFromMap(),this.ApplyMarkerType(),this.AddMarkersToMapForCurrentVisibleExtent())},t.prototype.ApplyMarkerType=function(){var t=ICO.GetIconOptionsForIconStyle(this.mkType);this.width=t.width,this.height=t.height,this.alpha0=t.fill_alpha,this.alpha1=t.stroke_alpha,this.shd_r=t.shadow_radius,this.btick=t.show_bearing_tick},t.prototype.UpdateMarkerExtent=function(t,e,s,i){this.mk_ex[0]=Math.min(this.mk_ex[0],t),this.mk_ex[1]=Math.min(this.mk_ex[1],e),this.mk_ex[2]=Math.max(this.mk_ex[2],s),this.mk_ex[3]=Math.max(this.mk_ex[3],i)},t.prototype.IsMarkerExtentValid=function(){return-180<=this.mk_ex[0]&&this.mk_ex[0]<=180&&-90<=this.mk_ex[1]&&this.mk_ex[1]<=90&&-180<=this.mk_ex[2]&&this.mk_ex[2]<=180&&-90<=this.mk_ex[3]&&this.mk_ex[3]<=90},t.prototype.IsMarkerExtentZero=function(){return 0==this.mk_ex[0]&&0==this.mk_ex[1]&&0==this.mk_ex[2]&&0==this.mk_ex[3]},t.prototype.ApplyMapVisibleExtentForMarkers=function(){if(this.IsMarkerExtentValid()&&!this.IsMarkerExtentZero()){var t=r(this.mk_ex[0],this.mk_ex[1],this.mk_ex[2],this.mk_ex[3],this.mapref);if(this.mapref.panTo(t[0]),this.mapref.setZoom(t[1]),null!=this.logids&&0<this.logids.length&&null!=this.litcpms){var e=document.getElementById("done");if(null!=e&&0<=e.className.indexOf("bar-warning")){var s=this.GetSummaryStatsForLogId(this.logids[0]);i(s,this.times,this.valids)}}}else console.log("MKS.ApplyMapVisibleExtentForMarkers: Invalid marker extent: (%1.8f, %1.8f) - (%1.8f, %1.8f)",this.mk_ex[0],this.mk_ex[1],this.mk_ex[2],this.mk_ex[3])},t.prototype.ReallocMarkerIndexBuffersIfNeeded=function(t){if(t>this.m_n){var e=this.m_n,s=e+t,i=new Int32Array(s),r=new Uint32Array(s);o(i,0,this.m_ids,0,e),D(r,0,this.m_idxs,0,e),this.m_ids=i,this.m_idxs=r,this.m_n=s}},t.prototype.PurgeData=function(){this.minzs=null,this.cpms=null,this.alts=null,this.degs=null,this.logids=null,this.times=null,this.lutidxs=null,this.onmaps=null,this.mxs=null,this.mys=null,this.litcpms=null,this.litcp5s=null,this.valids=null,this.rmpool=new Array,this.mk_ex=new Float64Array([9e3,9e3,-9e3,-9e3]),this.fxClearAllLogIds()},t.prototype.RemoveAllMarkersFromMapAndPurgeData=function(){this.RemoveAllMarkersFromMap(),this.PurgeData()},t.prototype.RemoveAllMarkersFromMap=function(){for(var t,e=0;e<this.markers.length;e++)google.maps.event.clearInstanceListeners(this.markers[e]),this.markers[e].setMap(null),t=this.m_idxs[e],this.onmaps[t]=0;this.markers=new Array,this.last_ex=new Float64Array(7)},t.prototype.GetCurrentVisibleExtent=function(){var t=this.mapref.getBounds(),e=t.getSouthWest().lat(),s=t.getSouthWest().lng(),i=t.getNorthEast().lat(),r=t.getNorthEast().lng(),n=-9e3,a=-9e3;return r<s&&(a=r,n=-(r=180)),[s,e,r,i,n,a,this.mapref.getZoom()]},t.prototype.RemoveMarkersFromMapForCurrentVisibleExtent=function(){if(!(this.markers.length<1||null==this.cpms)){var t=this.GetCurrentVisibleExtent();this.RemoveMarkersFromMapForExtent(t[0],t[1],t[2],t[3],t[4],t[5],t[6]);for(var e=0;e<7;e++)this.last_rm_ex[e]=t[e]}},t.prototype.RecycleMarker=function(t){google.maps.event.clearInstanceListeners(t),t.setMap(null),this.rmpool.length<(this.isMobile?1e3:1e4)&&(t.setIcon(null),this.rmpool.push(t))},t.prototype.RemoveMarkersFromMapForExtent=function(t,e,s,i,r,n,a){var o,l,h,d,u=new Array,p=0,m=this.GetMercExtentForLatLonExtent(this.last_rm_ex),_=this.GetMercExtentForLatLonExtent([t,e,s,i,r,n,a]);t=_[0],e=_[1],s=_[2],i=_[3],r=_[4],n=_[5];m[0],m[1],m[2],m[3],m[4],m[5],m[6];for(var c=0;c<this.markers.length;c++)o=this.m_idxs[c],d=this.minzs[o],l=this.mxs[o],h=this.mys[o],a<d||h<e||i<h||l<t&&(4294967295==r||l<r)||s<l&&(4294967295==n||n<l)?(this.RecycleMarker(this.markers[c]),this.markers[c]=null,this.onmaps[o]=0):(u.push(this.markers[c]),p>=this.m_n&&this.ReallocMarkerIndexBuffersIfNeeded(p+16384),this.m_ids[p]=o,this.m_idxs[p]=o,p++);this.markers=u},t.prototype.AddMarkersToMapForCurrentVisibleExtent=function(){var t=this.GetCurrentVisibleExtent();!this.IsMarkerExtentValid()||this.IsIntersectingExtents(t,this.mk_ex)||-9e3!=t[4]&&this.IsIntersectingExtents([t[4],t[1],t[5],t[3]],this.mk_ex)?this.AddMarkersToMapForExtentTimer(t[0],t[1],t[2],t[3],t[4],t[5],t[6],this.last_ex,0,this.isMobile?500:2e3,0,null,null):w(0,this.last_ex,0,this.last_ex.length)},t.prototype.GetMercExtentForLatLonExtent=function(t){var e=new Uint32Array(7);return e[0]=a(t[0]),e[1]=n(s(t[3])),e[2]=a(t[2]),e[3]=n(s(t[1])),e[4]=-9e3==t[4]?4294967295:a(t[4]),e[5]=-9e3==t[5]?4294967295:a(t[5]),e[6]=t[6],e},t.prototype.IsIntersectingExtents=function(t,e){return!(t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3])},t.prototype.IsExtentEqual=function(t,e){for(var s=!0,i=0;i<t.length;i++)if(t[i]!=e[i]){s=!1;break}return s},t.prototype.AddMarkersToMapForExtentTimer=function(s,i,r,n,a,o,l,h,d,u,p,m,_){if(null!=this.cpms)if(null==m){var t=new Date;m=this.GetCandidatesForAddMarkers(s,i,r,n,a,o,l,h,u);var e=Date.now()-t.getTime();200<=e&&console.log("GetCandidates: %d ms for n=%d",e,m[1]),p=this.markers.length,_=null,-1!=d&&requestAnimationFrame(function(){this.AddMarkersToMapForExtentTimer(s,i,r,n,a,o,l,h,d,u,p,m,_)}.bind(this))}else{if(!(this.IsExtentEqual([s,i,r,n,a,o,l],this.GetCurrentVisibleExtent())||21==l))return void w(0,this.last_ex,0,this.last_ex.length);requestAnimationFrame(function(){var t=new Date;d=this.AddMarkersToMapForExtentLimited(s,i,r,n,a,o,l,d,u,p,m,_);var e=Date.now()-t.getTime();200<=e&&console.log("AddCandidates: %d ms. (idx=%d/%d)%s",e,d,null!=m&&null!=m[1]?m[1]:0,-1==d?"[End]":""),-1!=d&&this.AddMarkersToMapForExtentTimer(s,i,r,n,a,o,l,h,d,u,p,m,_)}.bind(this))}},t.prototype.GetCandidatesForAddMarkers=function(t,e,s,i,r,n,a,o,l){if(null==this.cpms)return[null,-1];var h=this.markers.length,d=this.GetMercExtentForLatLonExtent(o),u=this.GetMercExtentForLatLonExtent([t,e,s,i,r,n,a]);t=u[0],e=u[1],s=u[2],i=u[3],r=u[4],n=u[5];var p,m,_,c,f,g=d[0],y=d[1],A=d[2],x=d[3],L=d[4],b=d[5],v=d[6],k=32768,T=new Uint32Array(k),w=0;for(f=0;f<this.cpms.length;f++)if(p=this.mxs[f],m=this.mys[f],_=this.onmaps[f],c=this.minzs[f],0==_&&c<=a&&e<=m&&m<=i&&(t<=p&&p<=s||r<=p&&p<=n)&&(a!=v||m<y||x<m||p<g||4294967295!=L&&p<L||A<p||4294967295!=b&&b<p)&&(T[w++]=f,w>=T.length-1)){var I=new Uint32Array(T.length+k);D(I,0,T,0,T.length),T=I,k*=2}var M=21-a>>>0;0<a&&(M=M+1>>>0),1<a&&(M=M+1>>>0);var E=null,B=null,S=null,F=null,V=null,C=null,R=0;if(this.SortCandidatesIdxOnlyByQuadKey(T,w,a),this.isMobile&&(R=256<<(21>>>M)<65536?2:4,R+=2*R*w+2*R*h,R=(R+=2*w+2*h)/1024/1024),!this.isMobile||R<=8){for(E=256<<(21>>>M)<=65536?new Uint16Array(h):new Uint32Array(h),B=256<<(21>>>M)<=65536?new Uint16Array(h):new Uint32Array(h),S=new Uint16Array(h),f=0;f<h;f++)E[f]=this.mxs[this.m_idxs[f]]>>>M,B[f]=this.mys[this.m_idxs[f]]>>>M,S[f]=.18724571*this.cpms[this.m_idxs[f]];for(F=256<<(21>>>M)<=65536?new Uint16Array(w):new Uint32Array(w),V=256<<(21>>>M)<=65536?new Uint16Array(w):new Uint32Array(w),C=new Uint16Array(w),f=0;f<w;f++)F[f]=this.mxs[T[f]]>>>M,V[f]=this.mys[T[f]]>>>M,C[f]=.18724571*this.cpms[T[f]]}return[T,w,E,B,S,F,V,C,new Uint32Array(4096)]},t.prototype.AddMarkersToMapForExtentLimited=function(t,e,s,i,r,n,a,o,l,h,d,u){if(null==d[2])return this.AddMarkersToMapForExtentLimitedLowMem(t,e,s,i,r,n,a,o,l,h,d,u);var p,m,_,c,f,g,y,A,x,L=21-a>>>0;0<a&&(L=L+1>>>0),1<a&&(L=L+1>>>0);var b=0,v=-1,k=-1,T=-1,w=-1,I=B+1,M=I,E=d[0],B=d[1],S=d[2],F=d[3],V=d[4],C=d[5],R=d[6],D=d[7],G=d[8];for(p=o;p<B;p++)if(x=E[p],f=!1,0==this.onmaps[x]){if(v=C[p]<<L>>>29-a,k=R[p]<<L>>>29-a,0<b&&(v!=T||k!=w))break;if(M==I)for(m=p+1;m<B;m++)if(C[m]<<L>>>29-a!=v||R[m]<<L>>>29-a!=k){M=m;break}for(A=D[p]>>>1,g=C[p],y=R[p],m=p+1;m<B;m++){if(g==C[m]&&y==R[m]){if(A>D[m])for(c=E[m],_=0;_<b;_++)if(G[_]==c){G[_]=x;break}f=!0;break}if(M<=m)break}if(!f){for(A>>>=2,m=0;m<h;m++)if(g==S[m]&&y==F[m]&&A<V[m]){f=!0;break}if(!f&&(G[b]=x,4096<=++b))break}T=v,w=k}return this.AddMarkersToMapForIdxAddList(G,b),o+1<p&&p--,B-2<=p&&(this.last_ex[0]=t,this.last_ex[1]=e,this.last_ex[2]=s,this.last_ex[3]=i,this.last_ex[4]=r,this.last_ex[5]=n,this.last_ex[6]=a),B-2<=p?-1:p},t.prototype.AddMarkersToMapForExtentLimitedLowMem=function(t,e,s,i,r,n,a,o,l,h,d,u){var p,m,_,c,f,g,y,A,x,L=0,b=d[0],v=d[1],k=d[8],T=-1,w=-1,I=-1,M=-1,E=v+1,B=E,S=21-a>>>0;for(0<a&&(S=S+1>>>0),1<a&&(S=S+1>>>0),p=o;p<v;p++)if(x=b[p],f=!1,0==this.onmaps[x]){if(T=this.mxs[x]>>>21-a+8,w=this.mys[x]>>>21-a+8,0<L&&(T!=I||w!=M))break;if(B==E)for(m=p+1;m<v;m++)if(this.mxs[b[m]]>>>29-a!=T||this.mys[b[m]]>>>29-a!=w){B=m;break}for(A=.5*this.cpms[x],g=this.mxs[x]>>>S,y=this.mys[x]>>>S,m=p+1;m<v;m++){if(g==this.mxs[b[m]]>>>S&&y==this.mys[b[m]]>>>S){if(A>this.cpms[b[m]])for(c=b[m],_=0;_<L;_++)if(k[_]==c){k[_]=x;break}f=!0;break}if(B<=m)break}if(!f){for(A*=.2,m=0;m<h;m++)if(g==this.mxs[this.m_idxs[m]]>>>S&&y==this.mys[this.m_idxs[m]]>>>S&&A<this.cpms[this.m_idxs[m]]){f=!0;break}if(!f&&(k[L]=x,4096<=++L))break}I=T,M=w}return this.AddMarkersToMapForIdxAddList(k,L),o+1<p&&p--,v-2<=p&&(this.last_ex[0]=t,this.last_ex[1]=e,this.last_ex[2]=s,this.last_ex[3]=i,this.last_ex[4]=r,this.last_ex[5]=n,this.last_ex[6]=a),v-2<=p?-1:p},t.prototype.AddMarkersToMapForIdxAddList=function(t,e){var s,i,r,n,a,o=this.markers.length,l=o,h=(this.isMobile,2),d=new Array(e);for(d.sort(function(t,e){return this.cpms[t[0]]>this.cpms[e[0]]?1:this.cpms[t[0]]<this.cpms[e[0]]?-1:0}),s=0;s<e;s++)i=t[s],this.onmaps[i]=1,r=p(this.mys[i]),n=m(this.mxs[i]),a=this.lut.GetIdxForValue(this.cpms[i],h),d[s]=this.GetNewMarker(i,r,n,this.degs[i],a),l>=this.m_n&&this.ReallocMarkerIndexBuffersIfNeeded(o+l+16384),this.m_ids[l]=i,this.m_idxs[l]=i,l++;for(s=0;s<e;s++)d[s].setMap(this.mapref)},t.prototype.GetNewMarker=function(t,e,s,i,r){var n=this.GetIconCached(i,r),a=2*(this.shd_r-(this.width>>1)),o=2*(this.shd_r-(this.height>>1)),l=this.width+Math.max(0,a),h=this.height+Math.max(0,o),d={url:n,size:new google.maps.Size(l,h),anchor:new google.maps.Point(l>>1,h>>1)};this.isRetina&&(d.scaledSize=new google.maps.Size(l,h));var u=new google.maps.LatLng(e,s),p=0<this.rmpool.length?this.rmpool.pop():new google.maps.Marker;return p.setPosition(u),p.setIcon(d),p.setZIndex(r),p.ext_id=t,this.AttachInfoWindow(p),this.markers.push(p),p},t.prototype.AddMarker=function(t,e,s,i,r){var n=this.GetIconCached(i,r),a=2*(this.shd_r-(this.width>>1)),o=2*(this.shd_r-(this.height>>1)),l=this.width+Math.max(0,a),h=this.height+Math.max(0,o),d={url:n,size:new google.maps.Size(l,h),anchor:new google.maps.Point(l>>1,h>>1)};this.isRetina&&(d.scaledSize=new google.maps.Size(l,h));var u=new google.maps.LatLng(e,s),p=0<this.rmpool.length?this.rmpool.pop():new google.maps.Marker;p.setPosition(u),p.setIcon(d),p.setZIndex(r),p.ext_id=t,p.setMap(this.mapref),this.AttachInfoWindow(p),this.markers.push(p)},t.prototype.GetIconCached=function(t,e){var s=null,i=this.isRetina?this.width<<1:this.width,r=this.isRetina?this.height<<1:this.height,n=this.isRetina?this.shd_r<<1:this.shd_r;t=0==(t=parseInt(30*Math.round(.03333333333333333*parseFloat(f(t)))))?360:t;for(var a=0;a<this.icons.length;a++)if(this.icons[a].lutidx==e&&(this.icons[a].deg==t||!this.btick)&&this.icons[a].btick==this.btick&&this.icons[a].width==i&&this.icons[a].height==r&&this.icons[a].alpha0==this.alpha0&&this.icons[a].alpha1==this.alpha1&&this.icons[a].shd_r==n){s=this.icons[a].url;break}if(null==s){var o=this.lut.r[e],l=this.lut.g[e],h=this.lut.b[e],d=new ICO(i,r,t,this.btick,e,o,l,h,this.alpha0,this.alpha1,n);this.icons.push(d),s=d.url}return s},t.prototype.GetIdxForMarkerId=function(t){return t},t.prototype.GetInfoWindowContentForId=function(t){var e=this.GetIdxForMarkerId(t);if(null==this.cpms||e<0||e>this.cpms.length)return"";var s=1e3*parseFloat(this.times[e]),i=new Date(s),r=i.toISOString().substring(0,10),n=i.toISOString().substring(11,19),a=0<this.degs[e]?""+parseInt(f(this.degs[e])):"N/A",o=(.0029940119760479*this.cpms[e]).toFixed(2),l=null!=this.litcpms?this.litcpms[e]:null,h=null!=this.litcp5s?this.litcp5s[e]:null,d=null,u=null,p=null;null!=this.valids&&(d=A(this.valids[e]),u=x(this.valids[e]),p=L(this.valids[e]));var m=this.GetSummaryStatsForLogId(this.logids[e]),_=-1<window.location.href.indexOf("api.safecast.org");return c(o,this.cpms[e],this.alts[e],a,r,n,this.logids[e],l,h,d,u,p,m,_,this.fontCssClass)},t.prototype.AttachInfoWindow=function(t){this.hover_iw&&!this.isMobile?(google.maps.event.addListener(t,"mouseover",function(){this.OpenRetainedInfoWindow(t),google.maps.event.clearListeners(t,"mouseout"),google.maps.event.addListener(t,"mouseout",function(){this.inforef.close()}.bind(this))}.bind(this)),google.maps.event.addListener(t,"click",function(){this.OpenRetainedInfoWindow(t),google.maps.event.clearListeners(t,"mouseout")}.bind(this))):google.maps.event.addListener(t,"click",function(){this.OpenRetainedInfoWindow(t)}.bind(this))},t.prototype.OpenRetainedInfoWindow=function(t){null==this.inforef?this.inforef=new google.maps.InfoWindow({size:new google.maps.Size(60,40)}):this.inforef.close(),this.inforef.setContent(this.GetInfoWindowContentForId(t.ext_id)),this.inforef.open(this.mapref,t)},t.prototype.GetDataAndDispatchPrefilterVec=function(t,e,s,i,r,n,a,o,l,h,d,u){if(null!=this.cpms&&9e4<this.cpms.length&&(this.isSPARTAAAAAAA=!0),null==this.cpms||0==this.cpms.length||this.isSPARTAAAAAAA||null!=this.litcpms){if(null!=t&&0<t.length){var p=new Int32Array(t.length);w(d,p,0,p.length),this.AddData(s,i,r,n,p,a,t,e,o,l,h)}this.fxReportResultsSuccessForLogId(d)}else{var m=this.GetDataCopyForPrefilter(),_=m[0],c=m[1],f=m[2],g=m[3],y=this.fxGetWorkerForDispatch(),A=null!=this.litcpms,x={op:"PREFILTER_VECS",mxs:t.buffer,mys:e.buffer,minzs:s.buffer,cpms:i.buffer,times:a.buffer,alts:r.buffer,degs:n.buffer,oldmxs:_.buffer,oldmys:c.buffer,oldzs:f.buffer,olddres:g.buffer,logId:d,userData:u,isMobile:!0,noproc:A,worker_id:y[1]},L=[t.buffer,e.buffer,s.buffer,i.buffer,a.buffer,r.buffer,n.buffer,_.buffer,c.buffer,f.buffer,g.buffer];y[0].postMessage(x,L)}},t.prototype.GetDataCopyForPrefilter=function(){var t=this.cpms.length,e=new Uint32Array(t),s=new Uint32Array(t),i=new Int8Array(t),r=new Uint16Array(t);return D(e,0,this.mxs,0,t),D(s,0,this.mys,0,t),d(i,0,this.minzs,0,t),T(this.cpms,.18724571,r,t),[e,s,i,r]},t.prototype.AddData=function(t,e,s,i,r,n,a,o,l,h,d){null==e||e.length<2||(null==this.logids&&null!=l&&null==this.litcpms?(this.litcpms=_(this.litcpms,l),this.litcp5s=_(this.litcp5s,h),this.valids=v(this.valids,d),console.log("MKS.AddData: Adding extra fields.")):null!=this.litcpms&&(this.litcpms=null,this.litcp5s=null,this.valids=null,console.log("MKS.AddData: Purging extra fields.")),this.minzs=k(this.minzs,t),this.cpms=_(this.cpms,e),this.alts=b(this.alts,s),this.degs=k(this.degs,i),this.logids=y(this.logids,r),this.times=g(this.times,n),this.mxs=g(this.mxs,a),this.mys=g(this.mys,o),this.onmaps=v(this.onmaps,new Uint8Array(e.length)),console.log("MKS.AddData: Added %d items, new total = %d.",e.length,this.cpms.length),d=h=l=o=a=n=r=i=s=e=t=null)},t.prototype.SortCandidatesIdxOnlyByQuadKey=function(t,e,s){var i,r,n,a=new Array(e);s>>>=0;for(var o=0;o<e;o++){var l,h,d="";n=t[o],i=this.mxs[n]>>>29-s,r=this.mys[n]>>>29-s;for(var u=s;0<u;u--)l=48,0!=(i&(h=1<<u-1))&&l++,0!=(r&h)&&(l+=2),d+=String.fromCharCode(l);a[o]=[d,o,this.cpms[n]]}if(a.sort(function(t,e){return t[0]<e[0]?-1:t[0]>e[0]?1:t[2]<e[2]?-1:e[2]<t[2]?1:0}),this.isMobile&&1e3<e){for(o=0;o<e;o++)a[o]=a[o][1];var p=new Uint32Array(e);for(o=0;o<e;o++)p[o]=t[a[o]];for(o=0;o<e;o++)t[o]=p[o];p=null}else{for(p=new Uint32Array(e),o=0;o<e;o++)p[o]=t[a[o][1]];for(o=0;o<e;o++)t[o]=p[o];p=null}},t.prototype.SortByQuadKey=function(){var t=this.fxGetWorkerForDispatch(),e=null!=this.litcpms;e||(this.litcpms=new Float32Array(1),this.litcp5s=new Float32Array(1),this.valids=new Uint8Array(1));var s={op:"ORDER_BY_QUADKEY_ASC",userData:null,isMobile:this.isMobile,worker_id:t[1],noproc:e,mxs:this.mxs.buffer,mys:this.mys.buffer,minzs:this.minzs.buffer,cpms:this.cpms.buffer,times:this.times.buffer,alts:this.alts.buffer,degs:this.degs.buffer,logids:this.logids.buffer,litcpms:this.litcpms.buffer,litcp5s:this.litcp5s.buffer,valids:this.valids.buffer},i=[this.mxs.buffer,this.mys.buffer,this.minzs.buffer,this.cpms.buffer,this.times.buffer,this.alts.buffer,this.degs.buffer,this.logids.buffer,this.litcpms.buffer,this.litcp5s.buffer,this.valids.buffer];t[0].postMessage(s,i),this.mxs=null,this.mys=null,this.minzs=null,this.cpms=null,this.times=null,this.alts=null,this.degs=null,this.logids=null,this.onmaps=null,this.litcpms=null,this.litcp5s=null,this.valids=null};var i=function(t,e,s){if(null!=t&&null!=e&&null!=s){function i(t,e){return(""+t).replace(/{x}/g,e)}var r={BV_ALERT_ATTENTION_TITLE:"Attention",BV_ALERT_ATTENTION_SUBTITLE:"This log file contains",BV_ALERT_RAD_MAX_TEXT:"A possible radiological anomaly. Max µSv/h: {x}.",BV_ALERT_RAD_ZERO_TEXT:"One or more measurements of 0.00 CPM/µSv/h.",BV_ALERT_GPS_NOMOVE_TEXT:"No appearent movement.",BV_ALERT_LOG_TINY_TEXT:"Very few line(s): {x} parseable.",BV_ALERT_INVALID_CLK_TEXT:"Invalid timestamp(s): {x}, which may signify spatial error.",BV_ALERT_INVALID_RAD_TEXT:"Invalid measurement(s): {x} flagged by device.",BV_ALERT_INVALID_GPS_TEXT:"Invalid GPS location(s): {x} flagged by device.",BV_ALERT_INVALID_CHK_TEXT:"Invalid checksum(s): {x} lines.",BV_USVH_LABEL:"µSv/h",BV_CPM_LABEL:"CPM",BV_LOG_CPM_LABEL:"Log CPM",BV_LOG_CP5S_LABEL:"Log CP5s",BV_M_LABEL:"m",BV_ALT_LABEL:"alt",BV_DEG_LABEL:"°",BV_HEADING_LABEL:"heading",BV_UTC_LABEL:"UTC",BV_VALID_LABEL:"Valid",BV_INVALID_LABEL:"Invalid",BV_RADIATION_LABEL:"Radiation",BV_GPS_LABEL:"GPS",BV_CHECKSUM_LABEL:"Checksum",BV_LOG_FILE_STATS_TITLE:"Log File Stats",BV_LOG_FILE_API_LINK_LABEL:"More Info",BV_CPM_MAX_LABEL:"CPM, max",BV_CPM_AVG_LABEL:"CPM, mean",BV_CPM_MIN_LABEL:"CPM, min",BV_USVH_MAX_LABEL:"µSv/h, max",BV_USVH_AVG_LABEL:"µSv/h, mean",BV_USVH_MIN_LABEL:"µSv/h, min",BV_USV_DOSE_LABEL:"µSv, total dose",BV_KM_TOTAL_LABEL:"km, total",BV_KPH_MAX_LABEL:"kph, max",BV_KPH_MIN_LABEL:"kph, min",BV_M_ALT_MAX_LABEL:"m, max alt.",BV_M_ALT_MIN_LABEL:"m, min alt.",BV_HH_TOTAL_LABEL:"hours",BV_LINES_TOTAL_LABEL:"lines"},n=t,a=new Array;.5<n.max_usvh&&a.push(i(r.BV_ALERT_RAD_MAX_TEXT,n.max_usvh.toFixed(2))),n.min_usvh<=0&&a.push(r.BV_ALERT_RAD_ZERO_TEXT),n.dist_meters<=0&&a.push(r.BV_ALERT_GPS_NOMOVE_TEXT),n.n<=10&&a.push(i(r.BV_ALERT_LOG_TINY_TEXT,t.n.toFixed(0)));for(var o=Date.parse("2011-03-11T00:00:00Z")/1e3>>>0,l=Date.now()/1e3+86400>>>0,h=0,d=0,u=0;u<e.length;u++)(e[u]<o||e[u]>l)&&(d++,15<u&&h++);0<h&&h+3<d&&a.push(i(r.BV_ALERT_INVALID_CLK_TEXT,d.toFixed(0)));var p=0,m=0,_=0,c=0,f=0,g=0;for(u=0;u<s.length;u++)A(s[u])||(c++,15<u&&p++),x(s[u])||(f++,15<u&&m++),L(s[u])||(g++,15<u&&_++);if(0<p&&p+3<c&&a.push(i(r.BV_ALERT_INVALID_RAD_TEXT,c.toFixed(0))),0<m&&m+3<f&&a.push(i(r.BV_ALERT_INVALID_GPS_TEXT,f.toFixed(0))),0<_&&_+3<g&&a.push(i(r.BV_ALERT_INVALID_CHK_TEXT,g.toFixed(0))),0<a.length){var y="";y+=r.BV_ALERT_ATTENTION_TITLE+"!",y+=" "+r.BV_ALERT_ATTENTION_SUBTITLE+":",y+="";for(u=0;u<a.length;u++)y+=" 「"+a[u]+"」";y+="",alert(y)}}},c=function(t,e,s,i,r,n,a,o,l,h,d,u,p,m,_){var c=null!=_?' class="'+_+'"':"",f={BV_ALERT_ATTENTION_TITLE:"Attention",BV_ALERT_ATTENTION_SUBTITLE:"This log file contains",BV_ALERT_RAD_MAX_TEXT:"A possible radiological anomaly. Max µSv/h: {x}.",BV_ALERT_RAD_ZERO_TEXT:"One or more measurements of 0.00 CPM/µSv/h.",BV_ALERT_GPS_NOMOVE_TEXT:"No appearent movement.",BV_ALERT_LOG_TINY_TEXT:"Very few line(s): {x} parseable.",BV_ALERT_INVALID_CLK_TEXT:"Invalid timestamp(s): {x}, which may signify spatial error.",BV_ALERT_INVALID_RAD_TEXT:"Invalid measurement(s): {x} flagged by device.",BV_ALERT_INVALID_GPS_TEXT:"Invalid GPS location(s): {x} flagged by device.",BV_ALERT_INVALID_CHK_TEXT:"Invalid checksum(s): {x} lines.",BV_USVH_LABEL:"µSv/h",BV_CPM_LABEL:"CPM",BV_LOG_CPM_LABEL:"Log CPM",BV_LOG_CP5S_LABEL:"Log CP5s",BV_M_LABEL:"m",BV_ALT_LABEL:"alt",BV_DEG_LABEL:"°",BV_HEADING_LABEL:"heading",BV_UTC_LABEL:"UTC",BV_VALID_LABEL:"Valid",BV_INVALID_LABEL:"Invalid",BV_RADIATION_LABEL:"Radiation",BV_GPS_LABEL:"GPS",BV_CHECKSUM_LABEL:"Checksum",BV_LOG_FILE_STATS_TITLE:"Log File Stats",BV_LOG_FILE_API_LINK_LABEL:"More Info",BV_CPM_MAX_LABEL:"CPM, max",BV_CPM_AVG_LABEL:"CPM, mean",BV_CPM_MIN_LABEL:"CPM, min",BV_USVH_MAX_LABEL:"µSv/h, max",BV_USVH_AVG_LABEL:"µSv/h, mean",BV_USVH_MIN_LABEL:"µSv/h, min",BV_USV_DOSE_LABEL:"µSv, total dose",BV_KM_TOTAL_LABEL:"km, total",BV_KPH_MAX_LABEL:"kph, max",BV_KPH_MIN_LABEL:"kph, min",BV_M_ALT_MAX_LABEL:"m, max alt.",BV_M_ALT_MIN_LABEL:"m, min alt.",BV_HH_TOTAL_LABEL:"hours",BV_LINES_TOTAL_LABEL:"lines"},g="",y="<tr><td align=right>",A="</td><td>",x="</td><td nowrap>",L="</td></tr>";if(g+='<div id="bv_iw_div_pt">',g+="<table"+c+' style="border:0; border-collapse:collapse;">',g+=y+t+A+f.BV_USVH_LABEL+L,g+=y+e.toFixed(0)+A+f.BV_CPM_LABEL+L,null!=o&&(g+=y+o.toFixed(0)+A+f.BV_LOG_CPM_LABEL+L),null!=l&&(g+=y+l.toFixed(0)+A+f.BV_LOG_CP5S_LABEL+L),g+=y+s+x+f.BV_M_LABEL+" "+f.BV_ALT_LABEL+L,g+=y+i+x+f.BV_DEG_LABEL+" "+f.BV_HEADING_LABEL+L,g+="<tr><td align=right nowrap>"+r+"<br/>"+n+A+f.BV_UTC_LABEL+L,null==h||h||(g+=y+(h?f.BV_VALID_LABEL:f.BV_INVALID_LABEL)+x+f.BV_RADIATION_LABEL+L),null==d||d||(g+=y+(d?f.BV_VALID_LABEL:f.BV_INVALID_LABEL)+x+f.BV_GPS_LABEL+L),null==u||u||(g+=y+(u?f.BV_VALID_LABEL:f.BV_INVALID_LABEL)+x+f.BV_CHECKSUM_LABEL+L),g+="</table>",g+="</div>",null!=p){var b=p,v=.01<b.de_usv?b.de_usv.toFixed(2):b.de_usv.toFixed(4),k="https://api.safecast.org/en-US/bgeigie_imports/"+Math.abs(a),T='<tr><td align=right style="padding-top:5px;">',w='</td><td style="padding-top:5px;">';g+='<div id="bv_iw_div_ss" style="display:none; padding-top:10px;">',g+="<table"+c+' style="border:0; border-collapse:collapse;">',g+='<tr><td align=center style="font-size:16px;" colspan=2>'+f.BV_LOG_FILE_STATS_TITLE+L,!m&&0<a&&(g+='<tr><td align=center style="padding-top:5px;" colspan=2><a target="_blank" href="'+k+'" style="color:#9999FF;">'+f.BV_LOG_FILE_API_LINK_LABEL+"</a></td></tr>"),g+=T+(334*b.max_usvh).toFixed(0)+w+f.BV_CPM_MAX_LABEL+L,g+=y+(334*b.mean_usvh).toFixed(0)+A+f.BV_CPM_AVG_LABEL+L,g+=y+(334*b.min_usvh).toFixed(0)+A+f.BV_CPM_MIN_LABEL+L,g+=T+b.max_usvh.toFixed(2)+w+f.BV_USVH_MAX_LABEL+L,g+=y+b.mean_usvh.toFixed(2)+A+f.BV_USVH_AVG_LABEL+L,g+=y+b.min_usvh.toFixed(2)+A+f.BV_USVH_MIN_LABEL+L,g+=T+v+w+f.BV_USV_DOSE_LABEL+L,g+=T+(b.dist_meters/1e3).toFixed(1)+w+f.BV_KM_TOTAL_LABEL+L,g+=y+b.max_kph.toFixed(0)+A+f.BV_KPH_MAX_LABEL+L,g+=y+b.min_kph.toFixed(0)+A+f.BV_KPH_MIN_LABEL+L,g+=T+b.max_alt_meters.toFixed(0)+w+f.BV_M_ALT_MAX_LABEL+L,g+=y+b.min_alt_meters.toFixed(0)+A+f.BV_M_ALT_MIN_LABEL+L,g+=T+(b.time_ss/3600).toFixed(1)+w+f.BV_HH_TOTAL_LABEL+L,g+=y+b.n+A+f.BV_LINES_TOTAL_LABEL+L,g+="</table>",g+="</div>"}return g+="<div"+c+" style=\"cursor:pointer; position:absolute; top:0; left:5px; font-size:9px; color:#9999FF;\" onclick=\"var bids = document.getElementById('bv_iw_div_ss');var bidp = document.getElementById('bv_iw_div_pt');if (bids != null && bidp != null){bids.style.display = bids.style.display == 'none' ? 'block' : 'none';bidp.style.display = bidp.style.display == 'none' ? 'block' : 'none';}\">",g+=Math.abs(a),g+="</div>"},r=function(t,e,s,i,r){var n=h(),a=null!=r?r.getDiv().clientWidth:0,o=null!=r?r.getDiv().clientHeight:0;return l(t,e,s,i,0<a?a:n[0],0<o?o:n[1])},l=function(t,e,s,i,r,n){for(var a=new google.maps.LatLng(e+.5*(i-e),t+.5*(s-t)),o=3,l=20;0<=l;l--){var h=u(i,t,l),d=u(e,s,l);if(Math.abs(d[0]-h[0])<r&&Math.abs(d[1]-h[1])<n){o=l;break}}return 256<<o<r&&o++,[a,o]},h=function(){var t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0];return[t.innerWidth||s.clientWidth||i.clientWidth,t.innerHeight||s.clientHeight||i.clientHeight]},s=function(t){return 85.05112878<t?85.05112878:t<-85.05112878?-85.05112878:t},u=function(t,e,s){var i=.002777778*(e+180),r=Math.sin(.0174532925199*t),n=.5-.0795774715459*Math.log((1+r)/(1-r)),a=256<<s;return[parseInt(i*a+.5),parseInt(n*a+.5)]},p=function(t){return 90-360*Math.atan(Math.exp(6.283185307179586*-(.5-1.862645149230957e-9*t)))*.3183098861837907},m=function(t){return 360*(1.862645149230957e-9*t-.5)},n=function(t){var e=Math.sin(.0174532925199*t),s=.5-.0795774715459*Math.log((1+e)/(1-e));return parseInt(536870912*s+.5)},a=function(t){return parseInt(.002777778*(t+180)*536870912+.5)},f=function(t){return-1==t?-1:2.8346456692913384*parseFloat(t)},A=function(t){return(4&t)>>>2},x=function(t){return(2&t)>>>1},L=function(t){return(1&t)>>>0},_=function(t,e){if(null==t)return e;if(null==e)return t;var s=new Float32Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},g=function(t,e){if(null==t)return e;if(null==e)return t;var s=new Uint32Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},y=function(t,e){if(null==t)return e;if(null==e)return t;var s=new Int32Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},b=function(t,e){if(null==t)return e;if(null==e)return t;var s=new Int16Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},v=function(t,e){if(null==t)return e;if(null==e)return t;var s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},k=function(t,e){if(null==t)return e;if(null==e)return t;var s=new Int8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},D=function(t,e,s,i,r){t.subarray(e,e+r).set(s.subarray(i,i+r))},o=function(t,e,s,i,r){t.subarray(e,e+r).set(s.subarray(i,i+r))},d=function(t,e,s,i,r){t.subarray(e,e+r).set(s.subarray(i,i+r))},T=function(t,e,s,i){var r,n=i-i%4;for(r=0;r<n;r+=4)s[r]=t[r]*e,s[r+1]=t[r+1]*e,s[r+2]=t[r+2]*e,s[r+3]=t[r+3]*e;for(r=n;r<n+i%4;r++)s[r]=t[r]*e},w=function(t,e,s,i){var r,n=s+i-(s+i)%4;for(r=s;r<n;r+=4)e[r]=t,e[r+1]=t,e[r+2]=t,e[r+3]=t;for(r=n;r<n+i%4;r++)e[r]=t};return t}();