text: "use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var RootCtrl=function t(e,n,r){var i=this;_classCallCheck(this,t),r.getMap().then(function(t){i.map=t}),n.getConfig().then(function(e){i.data=e;try{var t=document.createElement("canvas");e.modern=!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){e.modern=!1}})};RootCtrl.$invoke=["$http","configService","mapService"],angular.module("IcsmApp",["common.altthemes","common.baselayer.control","common.cc","common.featureinf","common.header","common.legend","common.navigation","common.reset","common.side-panel","common.slider","common.storage","common.templates","elvis.results","elvis.reviewing","explorer.config","explorer.confirm","explorer.drag","explorer.enter","explorer.flasher","explorer.httpdata","explorer.info","explorer.legend","explorer.message","explorer.modal","explorer.persist","explorer.projects","explorer.tabs","explorer.version","exp.ui.templates","explorer.map.templates","temp.elevation","geo.geosearch","geo.map","geo.maphelper","geo.measure","icsm.bounds","icsm.clip","icsm.contributors","icsm.coverage","icsm.elevation.point","icsm.glossary","icsm.header","icsm.help","icsm.imagery","icsm.layerswitch","icsm.mapevents","icsm.panes","icsm.parameters","icsm.polygon","icsm.point","icsm.products","icsm.preview","icsm.select","icsm.splash","icsm.templates","icsm.toolbar","icsm.view","ngAutocomplete","ngRoute","ngSanitize","page.footer","placenames.search","placenames.config","placenames.summary","ui.bootstrap","vcRecaptcha"]).config(["$locationProvider","configServiceProvider","placenamesConfigServiceProvider","projectsServiceProvider","persistServiceProvider","versionServiceProvider",function(t,e,n,r,i,a){t.html5Mode({enabled:!0,requireBase:!1}),e.location("icsm/resources/config/config.json?v=b"),n.location("icsm/resources/config/placenames.json"),a.url("icsm/assets/package.json"),r.setProject("icsm"),i.handler("local")}]).factory("userService",[function(){return{login:t,hasAcceptedTerms:t,setAcceptedTerms:t,getUsername:function(){return"anon"}};function t(){return!0}}]).controller("RootCtrl",RootCtrl);var fileSize=function(t){return t?-1<(""+t).indexOf(" ")?t:(t=parseFloat(t))<1e3?t+" bytes":t<1e6?(t/1e3).toFixed(1)+" kB":t<1e9?(t/1e6).toFixed(1)+" MB":t<1e12?(t/1e9).toFixed(1)+" GB":(t/1e12).toFixed(1)+" TB":"-"};angular.module("icsm.bounds",["icsm.message"]).directive("icsmBounds",["$rootScope","icsmMessageService","boundsService",function(t,e,n){return{restrict:"AE",link:function(){n.init().then(null,null,function(t){switch(e.removeFlash(),t.type){case"error":case"warn":case"info":e[t.type](t.text);break;case"wait":e.wait(t.text);break;default:e.flash(t.text,t.duration?t.duration:8e3,"wait"===t.type)}})}}}]).factory("boundsService",["$http","$q","$rootScope","$timeout","configService","flashService","messageService","parametersService",function(i,e,a,r,t,o,s,n){var l;return{init:function(){var t=e.defer();return n.hasValidBbox()&&(c("Checking for data ("+n.metadata+")..."),m(n.clip)),a.$on("icsm.clip.drawn",function(t,e){c("Area drawn. Checking for data..."),u(e).then(function(t){"success"===t.code&&m(e)})}),t.promise},cancelDraw:function(){drawService.cancelDraw()},checkSize:u};function c(t,e,n){o.remove(l),t&&("error"===e?s.error(t):l=o.add(t,n,!0))}function u(n){return e(function(t){var e=function(t){if(function(t){t.xMax=null===t.xMax?null:+t.xMax,t.xMin=null===t.xMin?null:+t.xMin,t.yMax=null===t.yMax?null:+t.yMax,t.yMin=null===t.yMin?null:+t.yMin}(t),p(t))return{code:"oversize"};if(d(t))return{code:"undersize"};if(null===t.xMax)return{code:"incomplete"};if(function(t){return t&&angular.isNumber(t.xMax)&&angular.isNumber(t.xMin)&&angular.isNumber(t.yMax)&&angular.isNumber(t.yMin)&&!p(t)&&!d(t)}(t))return{code:"success"};return{code:"invalid"}}(n);if(e&&e.code){switch(e.code){case"oversize":r(function(){c("","clear"),c("The selected area is too large to process. Please restrict to approximately 1.5 degrees square.","error")});break;case"undersize":r(function(){c("","clear"),c("X Min and Y Min should be smaller than X Max and Y Max, respectively. Please update the drawn area.","error")})}t(e)}})}function d(t){return(t.xMax-t.xMin)*(t.yMax-t.yMin)<1e-11||t.xMax<t.xMin}function p(t){return 2.25<Math.abs((t.xMax-t.xMin)*(t.yMax-t.yMin))}function m(r){t.getConfig("processing").then(function(t){var e,n=t.intersectsUrl;n&&(r.xMax.toFixed(5),r.xMin.toFixed(5),r.yMax.toFixed(5),r.yMin.toFixed(5),e=["polygon="+encodeURIComponent(r.polygon)],r.metadata&&e.push("metadata="+r.metadata),c("Checking there is data in your selected area...","wait",18e4),i.get(n+e.join("&")).then(function(t){var e;t.data&&t.data.available_data&&(e=!1,c("","clear"),t.data.available_data&&t.data.available_data.forEach(function(t){var n;t.downloadables&&(n=t.downloadables,Object.keys(n).forEach(function(t){var e=n[t];Object.keys(e).forEach(function(t){e[t].forEach(function(t){{var e;t.fileSize=fileSize(t.file_size),t.product&&(e=t.bbox.split(",").map(function(t){return+t}),t.bbox=[Math.max(e[0],r.xMin),Math.max(e[1],r.yMin),Math.min(e[2],r.xMax),Math.min(e[3],r.yMax)].join(","))}})})}),e=!0)}),e||c("There is no data held in your selected area. Please try another area.",null,4e3),a.$broadcast("site.selection",t.data))},function(t){c("The service that provides the list of datasets is currently unavailable. Please try again later.","error")}))})}}]);var CoverageService=function(t,e){var r={show:!1};return{getState:function(){return r},toggle:function(){r.show=!r.show,r.layers||t.getConfig("map").then(function(t){r.layers=t.layers.filter(function(t){return t.coverage}),e.getMap().then(function(n){r.map=n,r.lookup=r.layers.reduce(function(t,e){return(t[e.name]=e).visible=n.hasLayer(e.layer),t},{})})})},toggleVisibility:function(t){t.visible=!t.visible,t.visible?t.layer?r.map.addLayer(t.layer):e.addLayer(t):t.layer.remove()},hide:function(){r.show=!1}}};function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}angular.module("icsm.coverage",[]).directive("coverageToggle",["coverageService",function(e){return{templateUrl:"icsm/coverage/trigger.html",restrict:"AE",link:function(t){t.toggle=function(){e.toggle()}}}}]).directive("icsmCoverageLayersSelector",["$document","$timeout","coverageService",function(i,a,o){return{templateUrl:"icsm/coverage/popup.html",scope:{},link:function(e,n){function r(t){27===t.which&&(t.stopPropagation(),t.preventDefault(),e.$apply(function(){o.hide()}))}e.state=o.getState(),e.$watch("state.show",function(t){t?(i.on("keyup",r),a(function(){return n.find("button").focus()},50)):i.off("keyup",r),e.$on("$destroy",function(){i.off("keyup",r)})}),e.hide=function(){o.hide()},e.toggleVisibility=function(t){o.toggleVisibility(t)}}}}]).factory("coverageService",CoverageService),CoverageService.$inject=["configService","mapService"],angular.module("icsm.clip",["geo.draw","explorer.clip.modal"]).directive("icsmInfoBbox",function(){return{restrict:"AE",templateUrl:"icsm/clip/infobbox.html"}}).directive("icsmClip",["$rootScope","$timeout","clipService","messageService","mapService",function(t,r,e,i,a){return{templateUrl:"icsm/clip/clip.html",scope:{bounds:"=",trigger:"=",drawn:"&"},link:function(n){n.clip=e.data.clip,n.typing=!1,void 0===n.showBounds&&(n.showBounds=!1),a.getMap().then(function(t){n.$watch("bounds",function(t){t&&n.trigger?r(function(){n.initiateDraw()}):t||e.cancelDraw()})}),t.$on("icsm.clip.draw",function(t,e){e&&"oversize"===e.message?(n.oversize=!0,r(function(){delete n.oversize},6e3)):delete n.oversize}),t.$on("icsm.clip.drawn",function(){return n.typing=!1}),n.initiateDraw=function(){i.info("Click on the map and drag to define your area of interest."),e.initiateDraw()},n.initiatePolygon=function(){i.info("Click on map for each vertex. Click on the first vertex to close the polygon.",6),e.initiatePolygon()}}}}]).directive("icsmManualClip",["$rootScope","clipService",function(i){return{restrict:"AE",templateUrl:"icsm/clip/manual.html",scope:{},link:function(n){function r(t){n.xMin=t.xMin,n.yMin=t.yMin,n.xMax=t.xMax,n.yMax=t.yMax}i.$on("icsm.polygon.drawn",function(t,e){return r(e)}),i.$on("icsm.clip.drawn",function(t,e){return r(e)}),n.allowSearch=function(){return!(isNan(n.xMin)||isNan(n.xMax)||isNan(n.yMin)||isNan(n.yMax)||+n.xMin==+n.xMax||+n.yMin==+n.yMax)},n.search=function(){var t=n.xMin,e=n.xMax;n.xMin=Math.min(t,e),n.xMax=Math.max(t,e),t=n.yMin,e=n.yMax,n.yMin=Math.min(t,e),n.yMax=Math.max(t,e),i.$broadcast("bounds.drawn",{bounds:L.latLngBounds(L.latLng(+n.yMin,+n.xMin),L.latLng(+n.yMax,+n.xMax))})}}}}]).factory("clipService",["$rootScope","drawService","parametersService",function(i,e,t){var a={data:{clip:{}},initiateDraw:function(){this.cancelDraw(),i.$broadcast("clip.initiate.draw",{started:!0});var t=this.data.clip;return delete t.xMin,delete t.xMax,delete t.yMin,delete t.yMax,delete t.area,delete t.type,delete t.polygon,e.drawRectangle({retryOnOversize:!1})},initiatePolygon:function(){this.cancelDraw(),i.$broadcast("clip.initiate.draw",{started:!0});var t=this.data.clip;return delete t.xMin,delete t.xMax,delete t.yMin,delete t.yMax,delete t.area,delete t.type,delete t.polygon,e.drawPolygon({retryOnOversize:!1})},cancelDraw:function(){e.cancelDraw()},setClip:function(t){return e=t,(n=a.data.clip).xMax=e.bounds.getEast().toFixed(5),n.xMin=e.bounds.getWest().toFixed(5),n.yMax=e.bounds.getNorth().toFixed(5),n.yMin=e.bounds.getSouth().toFixed(5),n.type="bbox",n.polygon="POLYGON(("+n.xMin+" "+n.yMin+","+n.xMin+" "+n.yMax+","+n.xMax+" "+n.yMax+","+n.xMax+" "+n.yMin+","+n.xMin+" "+n.yMin+"))",a.data.area=(n.xMax-n.xMin)*(n.yMax-n.yMin),a.data;var e,n}};i.$on("bounds.drawn",function(t,e){r(e)}),i.$on("polygon.drawn",function(t,e){i.$broadcast("icsm.poly.draw",e[0]);var n=a.data.clip,r=e[0];n.type="polygon",n.xMax=Math.max.apply(Math,_toConsumableArray(r.map(function(t){return t.lng}))),n.xMin=Math.min.apply(Math,_toConsumableArray(r.map(function(t){return t.lng}))),n.yMax=Math.max.apply(Math,_toConsumableArray(r.map(function(t){return t.lat}))),n.yMin=Math.min.apply(Math,_toConsumableArray(r.map(function(t){return t.lat}))),n.polygon="POLYGON(("+[].concat(_toConsumableArray(r),[r[0]]).map(function(t){return t.lng.toFixed(5)+" "+t.lat.toFixed(5)}).join(",")+"))",i.$broadcast("icsm.polygon.drawn",n)});var n=t.data;return n&&(r(n,!0),a.data.clip.type="bbox"),a;function r(t,e){console.log("data",t),a.setClip(t);var n=a.data.clip;i.$broadcast("icsm.bounds.draw",[n.xMin,n.yMin,n.xMax,n.yMax,!!e]),i.$broadcast("icsm.clip.drawn",n)}}]),angular.module("explorer.clip.modal",[]).directive("clipModal",["$document","$animate",function(r,t){return{restrict:"EA",transclude:!0,replace:!0,scope:{title:"@",isOpen:"=",showClose:"="},templateUrl:"icsm/clip/modal.html",link:function(e){function n(t){27===t.which&&(t.stopPropagation(),t.preventDefault(),e.$apply(function(){e.isOpen=!1}))}e.$watch("isOpen",function(t){t?r.on("keyup",n):r.off("keyup",n),e.$on("$destroy",function(){r.off("keyup",n)})})}}}]);var ContributorsService=function(t){var e={show:!1,ingroup:!1,stick:!1};return t.get("icsm/resources/config/contributors.json").then(function(t){e.orgs=t.data}),{getState:function(){return e}}};function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _iterableToArrayLimit(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}}function _arrayWithHoles(t){if(Array.isArray(t))return t}angular.module("icsm.contributors",[]).directive("icsmContributors",["$interval","contributorsService",function(r,i){return{templateUrl:"icsm/contributors/contributors.html",scope:{},link:function(t,e){var n;t.contributors=i.getState(),t.over=function(){r.cancel(n),t.contributors.ingroup=!0},t.out=function(){n=r(function(){t.contributors.ingroup=!1},1e3)},t.unstick=function(){t.contributors.ingroup=t.contributors.show=t.contributors.stick=!1,e.find("a").blur()}}}}]).directive("icsmContributorsLink",["$interval","contributorsService",function(n,r){return{restrict:"AE",templateUrl:"icsm/contributors/show.html",scope:{},link:function(t){var e;t.contributors=r.getState(),t.over=function(){n.cancel(e),t.contributors.show=!0},t.toggleStick=function(){t.contributors.stick=!t.contributors.stick,t.contributors.stick||(t.contributors.show=t.contributors.ingroup=!1)},t.out=function(){e=n(function(){t.contributors.show=!1},700)}}}}]).factory("contributorsService",ContributorsService).filter("activeContributors",function(){return function(t){return t?t.filter(function(t){return t.enabled}):[]}}),ContributorsService.$inject=["$http"],angular.module("icsm.elevation.point",[]).factory("elevationPointsService",["$http","$q","configService",function(n,t,r){return{getElevation:function(l){return t(function(o,s){r.getConfig("elevation").then(function(t){var e=_slicedToArray(l,2),n=e[0],r=e[1],i=[r-1e-6,n-1e-6,r+1e-6,n+1e-6],a=t.elevationTemplate.replace("{bbox}",i.join(","));(new TerrainLoader).load(a,function(t){o(t)},function(t){s(t)})})})},getHiResElevation:function(e){return r.getConfig("elevation").then(function(t){return n({method:"GET",url:t.hiResElevationTemplate.replace("{lng}",e.lng).replace("{lat}",e.lat)})})}}}]);var GlossaryCtrl=function(t,e){var n=this;t.info("GlossaryCtrl"),e.getTerms().then(function(t){n.terms=t})},GlossaryService=function(t){return{getTerms:function(){return t.get("icsm/resources/config/glossary.json",{cache:!0}).then(function(t){return t.data})}}};angular.module("icsm.glossary",[]).directive("icsmGlossary",[function(){return{templateUrl:"icsm/glossary/glossary.html"}}]).controller("GlossaryCtrl",GlossaryCtrl).factory("glossaryService",GlossaryService),GlossaryCtrl.$inject=["$log","glossaryService"],GlossaryService.$inject=["$http"],angular.module("icsm.header",[]).controller("headerController",["$scope","$q","$timeout",function(n,t,e){n.$on("headerUpdated",function(t,e){n.headerConfig=e})}]).directive("elvisHeader",[function(){var t={current:"none",heading:"ICSM",headingtitle:"ICSM",helpurl:"help.html",helptitle:"Get help about ICSM",helpalttext:"Get help about ICSM",skiptocontenttitle:"Skip to content",skiptocontent:"Skip to content",quicklinksurl:"/search/api/quickLinks/json?lang=en-US"};return{transclude:!0,restrict:"EA",templateUrl:"icsm/header/header.html",scope:{current:"=",breadcrumbs:"=",heading:"=",headingtitle:"=",helpurl:"=",helptitle:"=",helpalttext:"=",skiptocontenttitle:"=",skiptocontent:"=",quicklinksurl:"="},link:function(n){angular.copy(t);angular.forEach(t,function(t,e){e in n||(n[e]=t)})}}}]).factory("headerService",["$http",function(){}]);var HelpCtrl=function(t,e){var n=this;t.info("HelpCtrl"),e.getFaqs().then(function(t){n.faqs=t})},HelpService=function(t){return{getFaqs:function(){return t.get("icsm/resources/config/faqs.json",{cache:!0}).then(function(t){return t.data})}}};angular.module("icsm.help",[]).directive("icsmHelp",[function(){return{templateUrl:"icsm/help/help.html"}}]).directive("icsmFaqs",[function(){return{restrict:"AE",templateUrl:"icsm/help/faqs.html",scope:{faqs:"="},link:function(t){t.focus=function(t){$("#faqs_"+t).focus()}}}}]).controller("HelpCtrl",HelpCtrl).factory("helpService",HelpService),HelpCtrl.$inject=["$log","helpService"],HelpService.$inject=["$http"];var showButton=function(t){return t.file_url&&0<t.file_url.lastIndexOf(".zip")};angular.module("icsm.imagery",[]).directive("launchImage",["$rootScope","configService",function(r,e){return{templateUrl:"icsm/imagery/launch.html",restrict:"AE",link:function(t){var n=t.item;t.show=showButton(n),t.preview=function(){e.getConfig("imagery").then(function(t){var e=n.thumb_url;console.log(e,n),r.$broadcast("icsm-preview",{url:e,item:n})})}}}}]);var insidePolygon=function(t,e){for(var n=t.lat,r=t.lng,i=!1,a=0,o=e.length-1;a<e.length;o=a++){var s=e[a].lat,l=e[a].lng,c=e[o].lat,u=e[o].lng;r<l!=r<u&&n<(c-s)*(r-l)/(u-l)+s&&(i=!i)}return i};angular.module("icsm.layerswitch",[]).directive("icsmLayerswitch",["$http","configService","mapService",function(e,t,n){return{restrict:"AE",link:function(){var i,a;t.getConfig("layerSwitch").then(function(t){i=t,e.get(i.extentUrl,{cache:!0}).then(function(t){var e=L.geoJson(t.data).getLayers()[0];e&&(a=e.getLatLngs()),n.getMap().then(function(n){function t(t){var e=n.getBounds();insidePolygon({lng:e.getWest(),lat:e.getSouth()},a)&&insidePolygon({lng:e.getWest(),lat:e.getNorth()},a)&&insidePolygon({lng:e.getEast(),lat:e.getSouth()},a)&&insidePolygon({lng:e.getEast(),lat:e.getNorth()},a)?r({outside:!1,inside:!0}):r({outside:!0,inside:!1})}function r(e){n.eachLayer(function(t){t.options&&t.options.switch&&(t.options.switch===i.inside&&(t._container.style.display=e.inside?"block":"none"),t.options.switch===i.outside&&(t._container.style.display=e.outside?"block":"none"))})}n.on("moveend",t),t()})})})}}}]),angular.module("icsm.mapevents",["geo.map"]).directive("icsmMapevents",["icsmMapeventsService",function(t){return{restrict:"AE",link:function(){t.tickle()}}}]).factory("icsmMapeventsService",["$rootScope","$timeout","configService","mapService",function(i,a,t,o){var r,s,l,e=t.getConfig("mapConfig");function c(t,n){o.getMap().then(function(e){l&&e.removeLayer(l),t&&(l=L.geoJson(t,{style:function(){return{opacity:1,clickable:!1,fillOpacity:0,color:"red"}}}).addTo(e),n&&a(function(){var t=l.getBounds();e.fitBounds(t,{animate:!0,padding:L.point(100,100)})},50))})}function u(t,n){o.getMap().then(function(e){s&&e.removeLayer(s),t&&(s=L.geoJson(t,{style:function(){return{opacity:1,clickable:!1,fillOpacity:0,color:"black"}}}).addTo(e),n&&a(function(){var t=s.getBounds();e.fitBounds(t,{animate:!0,padding:L.point(100,100)})},50))})}return i.$on("icsm.bounds.draw",function(t,e){var n,r,i,a,o;e?(n=!1,r=e[2],i=e[0],a=e[3],o=e[1],4<e.length&&(n=e[4]),u({type:"Feature",geometry:{type:"Polygon",coordinates:[[[i,o],[r,o],[r,a],[i,a],[i,o]]]},properties:{}},n)):u(null)}),i.$on("icsm.bbox.draw",function(t,e){var n,r,i,a;e?(n=e[2],r=e[0],i=e[3],c({type:"Feature",geometry:{type:"Polygon",coordinates:[[[r,a=e[1]],[n,a],[n,i],[r,i],[r,a]]]},properties:{}},!1)):c(null)}),i.$on("icsm.poly.draw",function(t,e){var n,r;n=e,r=!0,o.getMap().then(function(e){s&&e.removeLayer(s),n&&(s=L.polygon(n,{opacity:1,clickable:!1,fillOpacity:0,color:"black"}).addTo(e),r&&a(function(){var t=s.getBounds();e.fitBounds(t,{animate:!0,padding:L.point(100,100)})},50))})}),e.listenForMarkerEvent&&i.$on(e.listenForMarkerEvent,function(t,e){var n;n=e,o.getMap().then(function(t){var e;r&&t.removeLayer(r),n&&(e=void 0!==n.properties.SAMPLE_LONGITUDE?{type:"Point",coordinates:[n.properties.SAMPLE_LONGITUDE,n.properties.SAMPLE_LATITUDE]}:n.geometry,r=L.geoJson({type:"Feature",geometry:e,id:n.id}).addTo(t),n.properties.html&&r.bindPopup(n.properties.html).openPopup())})}),{tickle:function(){o.getMap().then(function(r){r.on("click",function(t){var e=r.getZoom(),n=t.latlng;i.$broadcast("zoom.to",{zoom:e,latlng:n})})})}}}]);var PaneCtrl=function(t){var e=this;t.data().then(function(t){e.data=t})},PaneService=function(){return{add:function(){},remove:function(){}}};function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}angular.module("icsm.panes",[]).directive("icsmPanes",["$rootScope","$timeout","mapService",function(i,a,o){return{templateUrl:"icsm/panes/panes.html",transclude:!0,scope:{defaultItem:"@",data:"="},controller:["$scope",function(n){var r=!1;i.$on("side.panel.change",function(t){function e(){var t=document.createEvent("HTMLEvents");t.initEvent("resize",!1,!0),window.dispatchEvent(t)}e(),a(e,100),a(e,200),a(e,300),a(e,500)}),n.view=n.defaultItem,i.$broadcast("view.changed",n.view,null),n.setView=function(t){var e=n.view;n.view===t?(t&&(r=!0),n.view=""):(t||(r=!0),n.view=t),i.$broadcast("view.changed",n.view,e),r&&o.getMap().then(function(t){t._onResize()})},a(function(){i.$broadcast("view.changed",n.view,null)},50)}]}}]).directive("icsmTabs",[function(){return{templateUrl:"icsm/panes/tabs.html",require:"^icsmPanes"}}]).controller("PaneCtrl",PaneCtrl).factory("paneService",PaneService),PaneCtrl.$inject=["paneService"],PaneService.$inject=[],angular.module("icsm.message",[]).directive("icsmMessage",["icsmMessageService",function(e){return{templateUrl:"icsm/message/message.html",link:function(t){t.message=e.data}}}]).factory("icsmMessageService",["$timeout",function(n){var r={},i={get data(){return r},wait:function(t){return i.message("wait",t)},info:function(t){return i.message("info",t)},warn:function(t){return i.message("warn",t)},error:function(t){return i.message("error",t)},clear:function(){return i.message(null,null)},message:function(t,e){r.type=t,r.text=e,n(function(){i.removeFlash()},1e5)},flash:function(t){return i.message("flash",t)},removeFlash:function(){r.type=null}};return i}]),angular.module("icsm.parameters",[]).factory("parametersService",["$location",function(t){return new(function(){function e(t){_classCallCheck(this,e),this.search=t}return _createClass(e,[{key:"ignoreSizeLimit",value:function(){return!!this.search.metadata}},{key:"hasValidBbox",value:function(){var t=this.search;return!(isNaN(t.minx)||isNaN(t.maxx)||isNaN(t.miny)||isNaN(t.maxy))}},{key:"clear",value:function(){this.search={}}},{key:"bbox",get:function(){return this.hasValidBbox()?{minx:+this.search.minx,maxx:+this.search.maxx,miny:+this.search.miny,maxy:+this.search.maxy}:null}},{key:"clip",get:function(){return this.hasValidBbox()?{xMin:+this.search.minx,xMax:+this.search.maxx,yMin:+this.search.miny,yMax:+this.search.maxy,metadata:this.search.metadata,polygon:this.polygon}:null}},{key:"bounds",get:function(){var t=this.search;return this.hasValidBbox()?L.latLngBounds([t.miny,t.minx],[t.maxy,t.maxx]):null}},{key:"polygon",get:function(){return"POLYGON(("+this.search.minx+" "+this.search.miny+","+this.search.minx+" "+this.search.maxy+","+this.search.maxx+" "+this.search.maxy+","+this.search.maxx+" "+this.search.miny+","+this.search.minx+" "+this.search.miny+"))"}},{key:"data",get:function(){return this.hasValidBbox()?{bounds:this.bounds,metadata:this.metadata,polygon:this.polygon}:null}},{key:"metadata",get:function(){return this.search.metadata}}]),e}())(t.search())}]),L.Control.ElevationControl=L.Control.extend({statics:{TITLE:"Find elevation at a point",ALT_TITLE:"Disable elevation at a point",CLASS_NAME:"leaflet-control-elevation",ALT_CLASS_NAME:"leaflet-control-alt-elevation"},options:{position:"topleft",handler:{}},toggle:function(){var t=this.options.handler,e=this.handleClick;t.enabled()?(this._map._container.style.cursor="",this._map.fire(L.Control.ElevationControl.Event.POINTEND,{}),this._map.off("click",e),this.link.title=L.Control.ElevationControl.TITLE,L.DomUtil.removeClass(this.link,L.Control.ElevationControl.ALT_CLASS_NAME),L.DomUtil.addClass(this.link,L.Control.ElevationControl.CLASS_NAME),t.disable()):(this._map.fire(L.Control.ElevationControl.Event.POINTSTART,{}),this._map._container.style.cursor="crosshair",this._map.on("click",e),this.link.title=L.Control.ElevationControl.ALT_TITLE,L.DomUtil.removeClass(this.link,L.Control.ElevationControl.CLASS_NAME),L.DomUtil.addClass(this.link,L.Control.ElevationControl.ALT_CLASS_NAME),t.enable())},onAdd:function(t){var e=this,n=L.Control.ElevationControl.CLASS_NAME;this._container=L.DomUtil.create("div","leaflet-bar");var r,i=this.link=L.DomUtil.create("a",n,this._container);return i.href="#",i.title=L.Control.ElevationControl.TITLE,L.DomEvent.addListener(i,"click",L.DomEvent.stopPropagation).addListener(i,"click",L.DomEvent.preventDefault).addListener(i,"click",this.toggle,this),t.on("draw:drawstart",function(){e.clear()}),this.clear=function(){this.options.handler.enabled()&&this.toggle()},this.handleClick=(r=this.options.handler,function(t){r.searching(t.latlng)}),this._container}}),L.Map.mergeOptions({elevationControl:!1}),L.Control.elevationControl=function(t){return new L.Control.ElevationControl(t)},L.Control.ElevationControl.Event={POINTSTART:"point:start",POINTEND:"point:end"},angular.module("icsm.point",[]).directive("pointElevation",["elevationPointsService","flashService","mapService",function(t,m,n){return{restrict:"AE",link:function(d){var p=null;n.getMap().then(function(t){d.map=t,L.Control.ElevationControl.ALT_TITLE="Find features around a point",d.control=L.Control.elevationControl({handler:e}).addTo(t),console.log("Point signing in")});var e={disable:function(){d.enabled=!1,console.log("Disable elevation handler here"),m.remove(p),map.closePopup(),p=m.add("Click map for datasets surrounding a point.",4e3)},enable:function(){d.enabled=!0,d.$apply(function(){m.remove(p),p=m.add("Click map for detailed elevation information at point",4e3)})},enabled:function(){return d.enabled},searching:function(c){function u(t){return"<strong>"+t+":</strong> "}m.remove(p),d.elevation=d.error=null,p=m.add("Retrieving elevation data",2e4,!0),t.getHiResElevation(c).then(function(t){var e=t.data,n=d.map;m.remove(p);var r,i,a=e["HEIGHT AT LOCATION"],o=[],s=c.lat.toFixed(5)+"&deg;",l=c.lng.toFixed(5)+"&deg;";"m"===a||void 0===a||"No data"===a?(o.push(u("Lat/Lng")+s+"/"+l),o.push("<strong>No data available at this point</strong>")):(o.push(u("Elevation")+a),o.push(u("Lat/Lng")+s+"/"+l),o.push(u("Source")+e.SOURCE),o.push(u("Dataset")+"<span class='elevation-popup ellipsis' title='"+e.DATASET+"'>"+(r=e.DATASET,(i=e["METADATA URL"])?"<a href='"+i+"' target='_blank'>"+r+"</a>":r)+"</span>"),o.push(u("DEM Resolution")+e["DEM RESOLUTION"])),L.popup({maxWidth:400}).setLatLng(c).setContent("<div class='fi-popup'>"+o.join("<br/>")+"</div>").openOn(n),d.elevation=e}).catch(function(t){m.remove(p),d.error="No data available at this point"})}}}}}]);fileSize=function(t){return t?-1<(""+t).indexOf(" ")?t:(t=parseFloat(t))<1e3?t+" bytes":t<1e6?(t/1e3).toFixed(1)+" kB":t<1e9?(t/1e6).toFixed(1)+" MB":t<1e12?(t/1e9).toFixed(1)+" GB":(t/1e12).toFixed(1)+" TB":"-"};angular.module("icsm.polygon",["icsm.message"]).directive("icsmPolygon",["$rootScope","icsmMessageService","polygonService",function(t,e,n){return{restrict:"AE",link:function(){n.init().then(null,null,function(t){switch(e.removeFlash(),t.type){case"error":case"warn":case"info":e[t.type](t.text);break;case"wait":e.wait(t.text);break;default:e.flash(t.text,t.duration?t.duration:8e3,"wait"===t.type)}})}}}]).factory("polygonService",["$http","$q","$rootScope","$timeout","configService","flashService","messageService",function(o,r,s,i,n,a,l){var c;return{init:function(){return r(function(t,e){s.$on("icsm.polygon.drawn",function(t,e){u("Area drawn. Checking for data..."),d(e).then(function(t){function i(n){Object.keys(n).forEach(function(t){var e=n[t];Object.keys(e).forEach(function(t){e[t].forEach(function(t){{var e;t.fileSize=fileSize(t.file_size),t.product&&(e=t.bbox.split(",").map(function(t){return+t}),t.bbox=[Math.max(e[0],a.xMin),Math.max(e[1],a.yMin),Math.min(e[2],a.xMax),Math.min(e[3],a.yMax)].join(","))}})})})}var a;"success"===t.code&&(a=e,n.getConfig("processing").then(function(t){var e,n,r=t.intersectsUrl;r&&(e=a.polygon,n=["polygon="+encodeURIComponent(e)],a.metadata&&n.push("metadata="+a.metadata),u("Checking there is data in your selected area...","wait",18e4),o.get(r+n.join("&")).then(function(t){var e;t.data&&t.data.available_data&&(e=!1,u("","clear"),t.data.available_data&&t.data.available_data.forEach(function(t){t.downloadables&&(i(t.downloadables),e=!0)}),e||u("There is no data held in your selected area. Please try another area.",null,4e3),s.$broadcast("site.selection",t.data))},function(t){u("The service that provides the list of datasets is currently unavailable. Please try again later.","error")}))}))})})})},cancelDraw:function(){drawService.cancelDraw()},checkSize:d};function u(t,e,n){a.remove(c),t&&("error"===e?l.error(t):c=a.add(t,n,!0))}function d(t){var e=r.defer(),n=function(t){if(m(t))return{code:"oversize"};if(p(t))return{code:"undersize"};if(null===t.xMax)return{code:"incomplete"};if(function(t){return t&&angular.isNumber(t.xMax)&&angular.isNumber(t.xMin)&&angular.isNumber(t.yMax)&&angular.isNumber(t.yMin)&&!m(t)&&!p(t)}(t))return{code:"success"};return{code:"invalid"}}(t);if(n&&n.code)switch(n.code){case"oversize":i(function(){u("","clear"),u("The selected polygon's bounds exceeds the practical search size. Please confine your polygon within a bounds of approximately 1.5 degrees square.","error"),e.resolve(n)});break;case"undersize":i(function(){u("","clear"),u("X Min and Y Min should be smaller than X Max and Y Max, respectively. Please update the drawn area.","error"),e.resolve(n)});break;default:return r.when(n)}return e.promise}function p(t){return(t.xMax-t.xMin)*(t.yMax-t.yMin)<1e-11||t.xMax<t.xMin}function m(t){return 2.25<Math.abs((t.xMax-t.xMin)*(t.yMax-t.yMin))}}]);var validClip=function(t){var e=isFinite(t.yMax)&&isFinite(t.xMax)&&isFinite(t.yMin)&&isFinite(t.xMin);return e=(e=e&&t.yMax<90&&-90<t.yMin&&t.xMax<=180&&-180<=t.xMin)&&t.yMax>t.yMin&&t.xMax>t.xMin},DownloadService=function(n,e){var r="download_email",i={weight:2,opacity:.9,fill:!1,color:"#000000",width:3,clickable:!1};return{showClip:function(t){this.removeClip(t.layer);var e=[[t.yMin,t.xMin],[t.yMax,t.xMax]];t.layer=n.createBounds(e,i),n.showLayer(t.layer)},removeClip:function(t){t&&n.hideLayer(t)},setEmail:function(t){e.setItem(r,t)},getEmail:function(){return e.getItem(r).then(function(t){return t})},submit:function(t,e){var n=t;angular.forEach(e,function(t,e){n=n.replace("${"+e+"}",t)}),$("#launcher")[0].src=n}}},validSize=function(t,e){var n=1<arguments.length&&void 0!==e?e:16;return t&&angular.isNumber(t.xMax)&&angular.isNumber(t.xMin)&&angular.isNumber(t.yMax)&&angular.isNumber(t.yMin)&&!overSizeLimit(t,n)&&!underSizeLimit(t)},underSizeLimit=function(t){return(t.xMax-t.xMin)*(t.yMax-t.yMin)<1e-11||t.xMax<t.xMin},overSizeLimit=function(t,e){var n=Math.abs((t.xMax-t.xMin)*(t.yMax-t.yMin));return e&&e<n},constrainBounds=function(t,e){var n=!1,r=!1;return!(!e||i(t.xMax)||i(t.xMin)||i(t.yMax)||i(t.yMin))&&(r=n=+t.xMax<+e.xMin,n&&(t.xMax=+e.xMin),n=+t.xMax>+e.xMax,r=r||n,n&&(t.xMax=+e.xMax),n=+t.xMin<+e.xMin,r=r||n,n&&(t.xMin=+e.xMin),n=+t.xMin>+t.xMax,r=r||n,n&&(t.xMin=t.xMax),n=+t.yMax<+e.yMin,r=r||n,n&&(t.yMax=+e.yMin),n=+t.yMax>+e.yMax,r=r||n,n&&(t.yMax=+e.yMax),n=+t.yMin<+e.yMin,r=r||n,n&&(t.yMin=+e.yMin),n=+t.yMin>+t.yMax,r=r||n,n&&(t.yMin=+t.yMax),r);function i(t){return angular.isUndefined(t)||""===t||null===t}};angular.module("product.download",[]).directive("productDownloadButton",["configService",function(t){return{template:"<button ng-click='item.showDownload = !item.showDownload' type='button' class='undecorated' title='Click to start download'><i class='fa fa-lg fa-download' ng-class='{active:item.showDownload}'></i></button>",scope:{item:"="},link:function(){console.log("What's up item!")}}}]).directive("productDownloadPanel",["$rootScope","productDownloadService","flashService",function(t,r,e){return{templateUrl:"icsm/products/download.html",scope:{item:"="},link:function(n){n.processing={clip:{},get valid(){return this.validClipSize&&this.validEmail},get validClip(){return validClip(this.clip)},get validClipSize(){return validClip(this.clip)&&validSize(this.clip,n.item.restrictSize)},get validEmail(){return this.email},get validProjection(){return this.outCoordSys},get validFormat(){return this.outFormat},get percentComplete(){return(this.validClip?25:0)+(this.validEmail?25:0)+(this.validProjection?25:0)+(this.validFormat?25:0)}},n.item.processing=n.processing,n.drawn=function(){return draw()},t.$on("icsm.clip.drawn",function(t,e){n.processing.clip={xMax:e.xMax,xMin:e.xMin,yMax:e.yMax,yMin:e.yMin},n.processing.message="",n.processing.validClip?(constrainBounds(n.processing.clip,n.item.bounds)&&(n.processing.message="Bounds restricted to fit within product's extent"),validSize(n.processing.clip,n.item.restrictSize)||(n.processing.message="That exceeds the area you can clip for this dataset. Restrict to "+n.item.restrictSize+" square degrees.")):n.processing.message="That is not a valid area for this dataset"}),n.$watch("item.showDownload",function(t,e){t&&!n.processing.email&&r.getEmail().then(function(t){n.processing.email=t})})}}}]).directive("productDownloadSubmit",["configService","productDownloadService","messageService",function(t,n,r){return{templateUrl:"icsm/products/submit.html",scope:{item:"=",processing:"="},link:function(e){e.submit=function(){var t=e.processing;n.setEmail(t.email),n.submit(e.item.template,{id:e.item.primaryId,yMin:t.clip.yMin,yMax:t.clip.yMax,xMin:t.clip.xMin,xMax:t.clip.xMax,outFormat:t.outFormat.code,outCoordSys:t.outCoordSys.code,email:t.email,filename:""}),r.success("Submitted your job. An email will be delivered on completion.")}}}}]).factory("productDownloadService",DownloadService),DownloadService.$invoke=["productsMapUtilsService","persistService"];var intersecting=function(t,e){return e&&t&&angular.isNumber(e.xMin)&&angular.isNumber(e.xMax)&&angular.isNumber(e.yMin)&&angular.isNumber(e.yMax)?t.filter(function(t){return!t.extent||t.extent.xMin<=e.xMin&&t.extent.xMax>=e.xMax&&t.extent.yMin<=e.yMin&&t.extent.yMax>=e.yMax}):t};function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}angular.module("icsm.product",["product.download"]).directive("productProjection",["productsConfigService",function(t){return{templateUrl:"icsm/products/projection.html",scope:{processing:"="},link:function(e){t.config.then(function(t){e.config=t})}}}]).directive("productFormats",["productsConfigService",function(t){return{templateUrl:"icsm/products/formats.html",scope:{processing:"="},link:function(e){t.config.then(function(t){e.config=t}),console.log("What's up doc!")}}}]).directive("productEmail",[function(){return{templateUrl:"icsm/products/email.html",scope:{processing:"="}}}]).filter("productIntersect",function(){return intersecting}),angular.module("icsm.products",["icsm.product"]).provider("productsConfigService",[function(){var e="icsm/resources/config/download.json";this.setLocation=function(t){e=t},this.$get=["$http",function(t){return new DownloadConfig(e,t)}]}]);var DownloadConfig=function(){function n(t,e){_classCallCheck(this,n),this.$http=e,this.location=t}return _createClass(n,[{key:"child",value:function(e){return this.config.then(function(t){return t[e]})}},{key:"initiateServiceTemplates",get:function(){return child("initiateServiceTemplates")}},{key:"processingTemplates",get:function(){return this.child("processing")}},{key:"outputFormat",get:function(){return this.child("outFormat")}},{key:"defaultOutputFormat",get:function(){return this.outputFormat.then(function(t){return t.find(function(t){return t.default})})}},{key:"defaultOutputCoordinateSystem",get:function(){return this.outputCoordinateSystem.then(function(t){return t.find(function(t){return t.default})})}},{key:"outputCoordinateSystem",get:function(){return this.child("outCoordSys")}},{key:"datasets",get:function(){return this.child("datasets")}},{key:"config",get:function(){return this.$http.get(this.location,{cache:!0}).then(function(t){return t.data})}}]),n}();function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}angular.module("icsm.preview",[]).directive("previewImage",["$rootScope",function(t){return{templateUrl:"icsm/preview/preview.html",restrict:"AE",link:function(n){n.clear=function(){n.previewData=null},t.$on("icsm-preview",function(t,e){n.previewData=e})}}}]).factory("previewService",[function(){return new(function(){function e(t){_classCallCheck(this,e),this.search=t}return _createClass(e,[{key:"ignoreSizeLimit",value:function(){return!!this.search.metadata}},{key:"hasValidBbox",value:function(){var t=this.search;return!(isNaN(t.minx)||isNaN(t.maxx)||isNaN(t.miny)||isNaN(t.maxy))}},{key:"clear",value:function(){this.search={}}},{key:"bbox",get:function(){return this.hasValidBbox()?{minx:+this.search.minx,maxx:+this.search.maxx,miny:+this.search.miny,maxy:+this.search.maxy}:null}},{key:"clip",get:function(){return this.hasValidBbox()?{xMin:+this.search.minx,xMax:+this.search.maxx,yMin:+this.search.miny,yMax:+this.search.maxy,metadata:this.search.metadata}:null}},{key:"bounds",get:function(){var t=this.search;return this.hasValidBbox()?L.latLngBounds([t.miny,t.minx],[t.maxy,t.maxx]):null}},{key:"data",get:function(){return this.hasValidBbox()?{bounds:this.bounds,metadata:this.metadata}:null}},{key:"metadata",get:function(){return this.search.metadata}}]),e}())($location.search())}]),angular.module("elvis.results.continue",[]).directive("icsmSearchContinue",["configService","continueService",function(t,n){return{templateUrl:"icsm/results/continue.html",controller:"listCtrl",controllerAs:"ctrl",link:function(e){t.getConfig("downloadLimit").then(function(t){e.limit=t}),e.data=n.data}}}]).factory("continueService",["listService",function(t){var e={};return e.data=t.data,e}]).filter("someSelected",function(){return function(t){return t&&t.some(function(t){return t.selected})}}).filter("countSelected",function(){return function(t){return t?t.filter(function(t){return t.selected}).length:""}});var fileSize=function(t){return t?-1<(""+t).indexOf(" ")?t:(t=parseFloat(t))<1e3?t+" bytes":t<1e6?(t/1e3).toFixed(1)+" kB":t<1e9?(t/1e6).toFixed(1)+" MB":t<1e12?(t/1e9).toFixed(1)+" GB":(t/1e12).toFixed(1)+" TB":"-"},ListCtrl=function(t){this.service=t,this.checkChildren=function(t){var e=this.childrenChecked(t),n=t;e||(n=t.filter(function(t){return t.matched})),n.forEach(function(t){e?delete t.selected:t.selected=!0})},this.childrenChecked=function(t){return!t.filter(function(t){return t.matched}).some(function(t){return!t.selected})},this.someMatches=function(t){var e=!1;return angular.forEach(t.downloadables,function(t){angular.forEach(t,function(t){e|=t.some(function(t){return t.matched})})}),e},this.someChildMatches=function(t){var e=!1;return angular.forEach(group,function(t){e|=t.some(function(t){return t.matched})}),e},this.review=function(){this.service.data.reviewing=!0},this.cancelReview=function(){this.service.data.reviewing=!1}};angular.module("elvis.results",["elvis.results.continue","icsm.subtype","icsm.unreleased"]).directive("productsDialog",["productsConfigService","listService",function(n,r){return{restrict:"AE",link:function(t){var e=t.processing=r.data;n.defaultOutputCoordinateSystem.then(function(t){return e.outCoordSys=t}),n.defaultOutputFormat.then(function(t){return e.outFormat=t})}}}]).directive("icsmOrgHeading",[function(){return{templateUrl:"icsm/results/orgheading.html",restrict:"AE",scope:{org:"=",mappings:"="},link:function(n){n.heading=function(){var t=n.org.source,e=n.mappings[t];return e.displayName?e.displayName:t}}}}]).directive("icsmList",["$rootScope","listService",function(r,a){return{templateUrl:"icsm/results/results.html",link:function(i){function n(t){return angular.isArray(t)||!t?t:t.split(/,\s*/g).map(function(t){return+t})}a.getMappings().then(function(t){i.mappings=t}),i.filters=a.data,i.update=function(){var n,t,e=!!i.filters.filter,r=i.filters.types.some(function(t){return t.selected})&&!i.filters.types.every(function(t){return t.selected});i.products.forEach(function(t){t.matched=!e}),r&&i.products.forEach(function(e){e.matched=!1,i.filters.types.filter(function(t){return t.selected}).forEach(function(t){(t.match&&t.match[e.type]||t.noMatch&&!t.noMatch[e.type])&&(e.matched=!0)})}),e&&(n=i.filters.filter.toUpperCase(),t=i.products,r&&(t=t.filter(function(t){return t.matched})),t.forEach(function(t){var e=t.file_name||t.project_name||"";t.matched=-1<e.toUpperCase().indexOf(n)})),i.$broadcast("filter.changed")},i.show=function(t){var e=n(t.bbox);r.$broadcast("icsm.bbox.draw",e)},i.hide=function(t){r.$broadcast("icsm.bbox.draw",null)},r.$on("clip.initiate.draw",function(t,e){i.list=null,i.products=[],i.productsMap=[]}),r.$on("site.selection",function(t,e){i.list=null,i.products=[],i.productsMap=[],e.available_data&&(i.list=e.available_data.filter(function(t){return t.downloadables}),i.list.forEach(function(r){angular.forEach(r.downloadables,function(t,n){angular.forEach(t,function(t,e){t.forEach(function(t){t.source=r.source,t.group=e,t.type=n,i.productsMap[t.file_url]=t,i.products.push(t)})})})}),a.products=i.products),i.update()}),i.show=function(t){var e=n(t.bbox);r.$broadcast("icsm.bbox.draw",e)},i.hide=function(t){r.$broadcast("icsm.bbox.draw",null)}}}}]).directive("icsmAbstract",["listService",function(t){return{templateUrl:"icsm/results/abstractbutton.html",scope:{item:"="},link:function(e){e.show=t.hasMetadata(e.item),e.toggle=function(){e.item.showAbstract=!e.item.showAbstract,e.item.showAbstract&&(e.fetched||(e.fetched=!0,t.getMetadata(e.item).then(function(t){e.item.metadata=t})))}}}}]).directive("icsmAbstractHover",["$timeout","listService",function(i,a){return{restrict:"AE",scope:{item:"="},link:function(e,t){var n;function r(){e.fetched||(e.fetched=!0,a.getMetadata(e.item).then(function(t){e.item.metadata=t}))}t.on("mouseenter",function(){n&&i.cancel(n),n=i(r,250)}),t.on("mouseleave",function(){n&&(i.cancel(n),n=null)})}}}]).directive("icsmAbstractLink",["$timeout","listService",function(t,n){return{restrict:"AE",template:"<a target='_blank' ng-if='url' ng-href='{{url}}'>{{item[name]}}</a><span ng-if='!url' ng-bind='item.file_name'></span>",scope:{item:"=",name:"@?"},link:function(t){t.name||(t.name="file_name");var e={file_name:t.item[t.name],metadata_url:t.item.metadata_url,source:t.item.source};t.url=n.getLink(e)}}}]).controller("listCtrl",ListCtrl).factory("listService",["$http","$rootScope",function(t,e){var n={},r=new Strategies(t);return n.data={id:"listService_data",filter:"",types:[]},e.$on("icsm.clip.drawn",function(t,e){return n.data.clip=e}),t.get("icsm/resources/config/filetypes.json").then(function(t){n.data.typesMap=t.data,n.data.types=[],angular.forEach(t.data,function(t,e){n.data.types.push(t)})}),n.getMetadata=function(t){return r.strategy(t.source).requestMetadata(t)},n.hasMetadata=function(t){return r.strategy(t.source).hasMetadata(t)},n.getLink=function(t){return r.strategy(t.source).constructLink(t)},n.getMappings=function(){return t.get("icsm/resources/config/list.json").then(function(t){return t.data})},n}]).filter("allowedTypes",["listService",function(r){return function(t){if(!r.data.types.some(function(t){return t.selected}))return t;var n={};return angular.forEach(t,function(t,e){r.data.typesMap&&r.data.typesMap[e]&&r.data.typesMap[e].selected&&(n[e]=t)}),n}}]).filter("countMatchedDownloadables",function(){return function(t){if(t){var n=0;return angular.forEach(t,function(t,e){Array.isArray(t)||angular.forEach(t,function(t){n+=t.filter(function(t){return t.matched}).length})}),n}return"-"}}).filter("countMatchedItems",function(){return function(t){return t?t.filter(function(t){return t.matched}).length:""}}).filter("hasTypeMatches",function(){return function(e){if(!e)return!1;var n=0;return Object.keys(e).forEach(function(t){n+=e[t].filter(function(t){return t.matched}).length}),0<n}}).filter("matchedTypes",function(){return function(t){var n={};return angular.forEach(t,function(t,e){t.some(function(t){return t.matched})&&(n[e]=t)}),n}}).filter("matchedGroups",[function(){return function(t){var n={};return t&&angular.forEach(t,function(t,e){t.some(function(t){return t.matched})&&(n[e]=t)}),n}}]).filter("matchedItems",function(){return function(t){return t.filter(function(t){return t.matched})}}).filter("keysLength",[function(){return function(n){return n?Object.keys(n).reduce(function(t,e){return t+n[e].length},0):0}}]).filter("countDownloadables",function(){return function(t){if(t){var n=0;return angular.forEach(t,function(t,e){angular.forEach(t,function(t,e){n+=t.length})}),n}return"-"}}).filter("fileSize",function(){return fileSize}),ListCtrl.$inject=["listService"],ListCtrl.prototype={get products(){return this.service.products},get selectedSize(){var t=this.service.products;return(t?t.filter(function(t){return t.selected&&!t.removed}):[]).map(function(t){return t.file_size?+t.file_size:5e8}).reduce(function(t,e){return t+e},0)},get selected(){var t=this.service.products;return t?t.filter(function(t){return t.selected&&!t.removed}):[]}};var toNumberArray=function(t){return angular.isArray(t)||!t?t:t.split(/,\s*/g).map(function(t){return+t})};angular.module("icsm.subtype",["bw.paging"]).directive("subtype",["$rootScope",function(n){return{templateUrl:"icsm/results/subtype.html",scope:{items:"=",mappings:"="},link:function(r){r.paging={page:1,pageSize:20},r.$on("filter.changed",function(){console.log("Filter changed - Subtype"),r.setPage(1,20)}),r.setPage=function(t,e){var n=r.items.filter(function(t){return t.matched});r.data=n.slice(e*(t-1),t*e)},r.setPage(1,20),r.show=function(t){var e=toNumberArray(t.bbox);n.$broadcast("icsm.bbox.draw",e)},r.hide=function(t){n.$broadcast("icsm.bbox.draw",null)}}}}]).filter("hasProducts",function(){return function(t){return t.some(function(t){return t.product})}}).filter("hasTransformables",function(){return function(t){return t.some(function(t){return t.transformable})}}).filter("productsSummary",function(){return function(t){var e=t.filter(function(t){return t.product}).length,n=" including ";switch(e){case 1:n+="1 product";break;default:n+=e+" products"}return n}}).filter("productsCount",function(){return function(t){return t?t.filter(function(t){return t.product}).length:0}}).filter("transformablesCount",function(){return function(t){return t?t.filter(function(t){return t.transformable}).length:0}});var captured=function(t){if(!t)return t;var e=t.split(" - ");return 2!==e.length?t:formatDate(e[0])+" - "+formatDate(e[1])},formatDate=function(t){return 8!==t.length?t:t.substr(0,4)+"/"+t.substr(4,2)+"/"+t.substr(6,2)},toNumberArray=function(t){return angular.isArray(t)||!t?t:t.split(/,\s*/g).map(function(t){return+t})};angular.module("icsm.unreleased",[]).directive("icsmUnreleased",["$rootScope",function(n){return{templateUrl:"icsm/results/unreleased.html",scope:{types:"="},link:function(t){console.log("Unrelease me!"),t.show=function(t){var e=toNumberArray(t.bbox);n.$broadcast("icsm.bbox.draw",e)},t.hide=function(t){n.$broadcast("icsm.bbox.draw",null)}}}}]).directive("icsmProjectAbstract",["listService",function(t){return{templateUrl:"icsm/results/abstractbutton.html",scope:{project:"="},link:function(e){e.item={},e.show=t.hasMetadata(e.item),e.toggle=function(){e.item.showAbstract=!e.item.showAbstract,e.item.showAbstract&&(e.fetched||(e.fetched=!0,t.getMetadata(e.item).then(function(t){e.item.metadata=t})))}}}}]).filter("captured",function(){return captured}).filter("reverseDate",function(){return formatDate});var transformTemplate=function(t,e){var n=t;return angular.forEach(e,function(t,e){n=n.replace("{"+e+"}",encodeURIComponent(t))}),n},convertFlatToStructured=function(t){var a=["file_url","file_name","project_name","product","metadata_id","file_size","bbox"],e={available_data:[]},o=e.available_data,s={};return t.forEach(function(e){var n={};a.forEach(function(t){void 0!==e[t]&&(n[t]=e[t])});var t=s[e.source];t||(t={source:e.source,downloadables:{}},s[e.source]=t,o.push(t));var r=t.downloadables[e.type];r||(r={},t.downloadables[e.type]=r);var i=r[e.group];i||(i=[],r[e.group]=i),i.push(n)}),e};angular.module("elvis.reviewing",[]).directive("icsmReview",["$rootScope","$uibModal","$log","messageService","reviewService",function(t,e,n,r,i){return{link:function(o){o.data=i.data,o.$watch("data",function(t,e){e&&(console.log("Why?",t),o.data=i.data)}),o.$watch("data.reviewing",function(t){t&&e.open({templateUrl:"icsm/reviewing/reviewing.html",size:"lg",backdrop:"static",keyboard:!1,controller:["$scope","$uibModalInstance","listService","products","vcRecaptchaService",function(n,t,e,r,i){n.recaptchaKey="6LfUrFsUAAAAAKu4EJY_FSi3zFXvWm60RDVknRHf";var a=o.selected=r.filter(function(t){return t.selected});o.derived=a.filter(function(t){return t.product}),e.getMappings().then(function(t){n.mappings=t}),n.heading=function(t){if(!n.mappings)return t;var e=n.mappings[t];return e.displayName?e.displayName:t},n.products=convertFlatToStructured(a).available_data,n.accept=function(){t.close(n.recaptchaResponse,n.products)},n.cancel=function(){t.close(null)},n.setWidgetId=function(t){n.recaptchaId=t},n.setResponse=function(t){n.recaptchaResponse=t},n.cbExpiration=function(){i.reload(n.recaptchaId),n.recaptchaResponse=null}}],resolve:{products:function(){return i.products}}}).result.then(function(t){delete o.data.recaptchaResponse,t&&(o.data.recaptchaResponse=t,i.startExtract().then(function(t){r[t.status](t.message),i.removeRemoved(),o.data.reviewing=!1})),i.removeRemoved(),o.data.reviewing=!1},function(){n.info("Cancelled")})})}}}]).directive("reviewIndustry",["configService","reviewService",function(t,n){return{retrict:"AE",template:'<div class="input-group"><span class="input-group-addon" style="width:6em" id="nedf-industry">Industry</span><select required="required" type="text" ng-options="ind.text for ind in industries" ng-model="data.industry" class="form-control" placeholder="Industry of interest for this data" aria-describedby="nedf-industry"></select></div>',link:function(e){e.data=n.data,t.getConfig("industries").then(function(t){e.industries=t})}}}]).directive("reviewEmail",["reviewService",function(e){return{template:'<div class="input-group"><span class="input-group-addon" style="width:6em" id="nedf-email">Email</span><input required="required" type="email" ng-model="data.email" class="form-control" placeholder="Email address to send download link" aria-describedby="nedf-email"></div>',restrict:"AE",link:function(t){t.data=e.data}}}]).filter("reviewProductsSelected",function(){return function(t){return t.filter(function(t){return t.selected})}}).filter("reviewSumSize",function(){return function(t){return t.reduce(function(t,e){return t+(e.file_size?+e.file_size:e.product?5e8:0)},0)}}).factory("reviewService",["$http","$q","clipService","configService","listService","persistService",function(r,t,i,n,a,e){var o="elvis_download_email",s="elvis_download_industry",l=a.data,c={get data(){return l},set data(t){console.log("What the hell!")},get products(){return a.products},startExtract:function(){return this.setEmail(l.email),this.setIndustry(l.industry),n.getConfig("processing").then(function(e){var n=i.data.clip;return console.log("We are processing files"),function(){var t=convertFlatToStructured(a.products.filter(function(t){return t.selected}));t.parameters={polygon:n.polygon,email:l.email,industry:l.industry.code,recaptcha:l.recaptchaResponse},l.outCoordSys&&(t.parameters.outCoordSys=l.outCoordSys.code);l.outFormat&&(t.parameters.outFormat=l.outFormat.code);return a.products.forEach(function(t){t.selected=t.removed=!1}),r({method:"POST",url:e.postProcessingUrl,data:t,headers:{"Content-Type":"application/json"}}).then(function(t){return t.data},function(t){return{status:"error",message:"Sorry but the service failed to respond. Try again later."}})}()})},removeRemoved:function(){a.products.forEach(function(t){t.removed=!1})},setEmail:function(t){this.data.email=t,e.setItem(o,t)},setIndustry:function(t){(this.data.industry=t)&&t.code&&e.setItem(s,t.code)},clipProduct:function(){}};return e.getItem(o).then(function(t){c.data.email=t}),e.getItem(s).then(function(e){e&&n.getConfig("industries").then(function(t){c.data.industry=t.find(function(t){return t.code===e})})}),c}]);var SelectService=function(t,e,n,r,i){var o,l={text:"",daterange:{enabled:!1,upper:null,lower:null},bbox:{fromMap:!0,intersects:!0,yMax:null,yMin:null,xMax:null,xMin:null},defaultKeywords:[],keywords:[]},s={},a="#ff7800",c={getSelectCriteria:function(){return l},getLayerGroup:function(){return o=o||i.getGroup("Search Layers")},setKeywords:function(){},setFilter:function(){},refresh:function(){},getDaterange:function(){return l.daterange},more:function(){},_executeQuery:function(){t.get("icsm/resources/config/select.json",{cache:!0}).then(function(t){c.getLayerGroup();var e=t.data;e.response.docs.forEach(function(t){c._decorateDataset(t),"group"==t.type&&t.docs.forEach(function(t){c._decorateDataset(t)})}),n.$broadcast("select.facet.counts",e),n.$broadcast("select.results.received",e)})},createLayer:function(t){var e,n,r=t.bbox,i=t.primaryId,a=s[i];if(!a){if(!r)return null;if(4!=(e=r.split(" ")).length)return null;n=[[+e[1],+e[0]],[+e[3],+e[2]]],a=L.rectangle(n,{fill:!1,color:"#000000",width:3,clickable:!1}),s[i]=a}return this._decorateDataset(t),o.addLayer(a),a},_decorateDataset:function(t){var e,n,r=s[t.primaryId];r?(t.layer=r,t.showLayer=!0):(t.layer=null,t.showLayer=!1,t.services=servicesFactory(t.dcUris),t.bounds=(e=t.bbox)?{xMin:+(n=e.split(/\s/g))[0],xMax:+n[2],yMax:+n[3],yMin:+n[1]}:null)},showWithin:function(t){t.forEach(function(t){var e,n,r,i,a,o,s=t.bbox;s&&4===(e=s.split(" ")).length&&(n=+e[0],r=+e[1],i=+e[2],a=+e[3],n>(o=l.bbox).xMin&&i<o.xMax&&r>o.yMin&&a<o.yMax)?c.createLayer(t):c.removeLayer(t)})},toggle:function(t){t.showLayer?this.removeLayer(t):this.createLayer(t)},toggleAll:function(t){var e=this,n=t.some(function(t){return!t.showLayer});return t.forEach(function(t){n?t.showLayer||e.createLayer(t):t.showLayer&&e.removeLayer(t)}),!n},hideAll:function(t){t.forEach(function(t){t.showLayer&&c.removeLayer(t)})},hilight:function(t){t.setStyle({color:"darkblue"})},lolight:function(t){t.setStyle({color:a})},removeLayer:function(t){var e=t.primaryId,n=s[e];n&&(o.removeLayer(n),delete s[e]),this._decorateDataset(t)}};return r(function(){c._executeQuery()},100),c},servicesFactory=function(t){var n={WCS:"OGC:WCS",WFS:"OGC:WFS",WMS:"OGC:WMS"};function r(t){var e=$(t);this.protocol=e.attr("protocol"),this.url=e.text(),this.layerNames=e.attr("layerNames"),this.name=e.attr("name"),this.description=e.attr("description"),this.handlers=[],this.isWcs=function(){return this.protocol==n.WCS},this.isWfs=function(){return this.protocol==n.WFS},this.isWms=function(){return this.protocol==n.WMS},this.isSupported=function(){return void 0===n[this.protocol]},this.addHandler=function(t){this.handlers.push(t)},this.removeHandler=function(t){this.handlers.push(t)},this.remove=function(){this.handlers.forEach(function(t){this.callback.remove&&t.remove(this)}.bind(this)),this.handlers=[]}}return r.prototype={getUrl:function(){return url?url.indexOf("?")<0?void 0:url.substr(0,url.indexOf("?")):null}},new function(t){this.uris=t,this.container={wcs:null,wms:null},this.services=t?t.map(function(t){var e=new r(t);return this.container.wcs=e.isWcs()?e:this.container.wcs,this.container.wms=e.isWms()?e:this.container.wms,e}.bind(this)):[],this.hasWcs=function(){return null!==this.container.wcs},this.hasWms=function(){return null!==this.container.wms},this.getWcs=function(){return this.container.wcs},this.getWms=function(){return this.container.wms},this.remove=function(){this.services.forEach(function(t){t.remove()})}}(t)};angular.module("icsm.select.service",[]).factory("selectService",SelectService),SelectService.$inject=["$http","$q","$rootScope","$timeout","mapService","configService"];var SelectCriteriaCtrl=function(t){this.criteria=t.getSelectCriteria(),this.refresh=function(){t.refresh()}},SelectCtrl=function(t,e,n,r){var i,a=this;t.$on("select.results.received",function(t,e){n.remove(i),a.data=e}),e.getConfig("facets").then(function(t){this.hasKeywords=t&&t.keywordMapped&&0<t.keywordMapped.length}.bind(this)),this.select=function(){n.remove(i),i=n.add("Selecting",3e3,!0),r.setFilter(this.filter)},this.toggle=function(t){r.toggle(t)},this.toggleAll=function(){r.toggleAll(this.data.response.docs)},this.showWithin=function(){r.showWithin(this.data.response.docs)},this.allShowing=function(){return!(!this.data||!this.data.response)&&!this.data.response.docs.some(function(t){return!t.showLayer})},this.anyShowing=function(){return!(!this.data||!this.data.response)&&this.data.response.docs.some(function(t){return t.showLayer})},this.hideAll=function(){r.hideAll(this.data.response.docs)},this.hilight=function(t){t.layer&&r.hilight(t.layer)},this.lolight=function(t){t.layer&&r.lolight(t.layer)}};function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _createSuper(n){var r=_isNativeReflectConstruct();return function(){var t,e=_getPrototypeOf(n);return _possibleConstructorReturn(this,r?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _get(t,e,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=_superPropBase(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}angular.module("icsm.select",["icsm.select.service"]).controller("SelectCtrl",SelectCtrl).controller("SelectCriteriaCtrl",SelectCriteriaCtrl).directive("icsmSelect",[function(){return{templateUrl:"icsm/select/select.html",link:function(){}}}]).directive("selectDoc",[function(){return{templateUrl:"icsm/select/doc.html",link:function(){}}}]).directive("selectGroup",[function(){return{templateUrl:"icsm/select/group.html",scope:{group:"="},link:function(){}}}]).filter("pubDate",function(){return function(t){var e;return t?(e=new Date(t)).getDate()+"/"+(e.getMonth()+1)+"/"+e.getFullYear():"-"}}).filter("authors",function(){return function(t){return t?t.join(", "):"-"}}).filter("truncate",function(){return function(t,e){return t&&t.length>e-3?t.substr(0,e-3)+"...":t}}),SelectCriteriaCtrl.$inject=["selectService"],SelectCtrl.$inject=["$rootScope","configService","flashService","selectService"],angular.module("icsm.splash",[]).directive("icsmSplash",["$rootScope","$uibModal","$log","splashService",function(t,n,r,i){return{controller:["$scope","splashService",function(e,n){e.acceptedTerms=!0,n.getReleaseNotes().then(function(t){e.releaseMessages=t,e.acceptedTerms=n.hasViewedSplash()})}],link:function(e){e.$watch("acceptedTerms",function(t){!1===t&&n.open({templateUrl:"icsm/splash/splash.html",size:"lg",backdrop:"static",keyboard:!1,controller:["$scope","$uibModalInstance","acceptedTerms","messages",function(t,e,n,r){t.acceptedTerms=n,t.messages=r,t.accept=function(){e.close(!0)}}],resolve:{acceptedTerms:function(){return e.acceptedTerms},messages:function(){return e.releaseMessages}}}).result.then(function(t){r.info("Accepted terms"),e.acceptedTerms=t,i.setHasViewedSplash(t)},function(){r.info("Modal dismissed at: "+new Date)})}),t.$on("logoutRequest",function(){userService.setAcceptedTerms(!1)})}}}]).factory("splashService",["$http",function(t){var e="icsm.accepted.terms";return{getReleaseNotes:function(){return t({method:"GET",url:"icsm/resources/service/releaseNotes?t="+Date.now()}).then(function(t){return t.data})},hasViewedSplash:function(){return!!sessionStorage.getItem(e)},setHasViewedSplash:function(t){t?sessionStorage.setItem(e,!0):sessionStorage.removeItem(e)}}}]).filter("priorityColor",[function(){var e={IMPORTANT:"red",HIGH:"blue",MEDIUM:"orange",LOW:"gray"};return function(t){return t in e?e[t]:"black"}}]).filter("wordLowerCamel",function(){return function(t){return t.charAt(0)+t.substr(1).toLowerCase()}}).filter("sortNotes",[function(){return function(t){if(t)return t.slice(0).sort(function(t,e){return t.priority==e.priority?t.lastUpdate==e.lastUpdate?0:e.lastUpdate-t.lastUpdate:"IMPORTANT"==t.priority?-11:1})}}]),angular.module("icsm.state",[]).directive("icsmStateToggle",["downloadService",function(t){return{restrict:"AE",template:'<button ng-click="toggle(false)" ng-disabled="state.show" class="btn btn-default" title="Start downlaod selection."><i class="fa fa-lg fa-object-group"></i></button>',link:function(e){t.data().then(function(t){e.state=t}),e.toggle=function(){e.state.show=!e.state.show}}}}]),angular.module("temp.elevation",["graph","explorer.crosshair","explorer.flasher","geo.map","geo.path"]).directive("pathElevationPlot",["$log","$timeout","$rootScope","$filter","elevationService","crosshairService",function(r,t,e,i,a,o){var s={fill:"orange",fillOpacity:.4,stroke:"darkred",strokeWidth:1.5};return{templateUrl:"icsm/tempelevation/elevation.html",scope:!0,controller:["$scope",function(n){n.paths=[],n.config={xLabel:"Distance: 3000m"},e.$on("elevation.plot.data",function(t,e){n.length=e.length,n.geometry=e.geometry,n.config.xLabel="Path length: "+i("length")(e.length,!0),n.length&&n.geometry&&a.getElevation(n.geometry,n.length).then(function(t){n.elevation={style:s,data:t},n.config.leftText="Elevation Range: "+i("length")(d3.min(t,function(t){return t.z}),!0)+" to "+i("length")(d3.max(t,function(t){return t.z}),!0),n.paths=[n.elevation]})}),n.getInfoText=function(){n.infoText||(n.infoText='<span><img alt="Waiting..." src="resources/img/tinyloader.gif" ng-show="message.spinner" style="position:relative;top:2px;" width="12"></img></span>',a.getInfoText().then(function(t){n.infoText=t}))},n.close=function(){n.paths=n.geometry=n.length=null}}],link:function(n){n.graphClick=function(t){var e;t.position&&(e=t.position.points[0].point,a.panToPoint(e),n.point=e)},n.graphLeave=function(t){n.position=null,o.remove(),r.debug("Mouse left"),n.mapListener&&r.info("offMapMove")},n.graphEnter=function(t){r.debug("Graph be entered")},n.graphMove=function(t){var e;n.position=t.position,n.position&&(e=n.position.point,window.eve=t,n.position.markerLonlat=o.move(e)),r.debug("Mouse moving...")},n.$watch("geometry",function(){n.line&&(n.line=a.pathHide(n.line));n.geometry&&(n.line=a.pathShow(n.geometry))})}}}]).directive("marsPanTo",["$rootScope","mapService",function(t,i){var e={eventName:"elevation.plot.data",options:{paddingTopLeft:[50,50],paddingBottomRight:[50,250]}};return{restrict:"AE",scope:{eventName:"=",options:"="},link:function(r){angular.forEach(e,function(t,e){void 0===r[e]&&(r[e]=t)}),t.$on(r.eventName,function(t,e){var n=L.polyline(e.geometry).getBounds();i.getMap().then(function(t){t.fitBounds(n,r.options)})})}}}]).provider("elevationService",function(){var a,o={isWaterTableShowing:!1};this.setIntersectUrl=function(t){0},this.setKmlUrl=function(t){0},this.setElevationUrl=function(t){0},this.setWaterTableUrl=function(t){0},this.$get=["$log","httpData","$q","mapService","flashService",function(t,e,n,r,i){return r.getMap().then(function(t){a=t}),{panToPoint:function(t){r.zoomTo(t.y,t.x)},getState:function(){return o},getElevation:function(){return i.add("Elevation service is down for maintenance.",5e3),n.when({})},getInfoText:function(){return e.get("map/elevation/elevationInfo.html",{cache:!0}).then(function(t){return t.data})},pathShow:function(t){return L.polyline(t,{color:"red",weight:3,opacity:.8}).addTo(a)},pathHide:function(t){return a.removeLayer(t),null}}}]}),L.Control.ComingSoon=L.Control.extend({_active:!1,_map:null,includes:L.Mixin.Events,options:{position:"topleft",className:"fa fa-italic fa-rotate-270",modal:!1},onAdd:function(n){return this._map=n,this._container=L.DomUtil.create("div","leaflet-zoom-box-control leaflet-bar"),this._container.title="Elevation along a path (coming soon)",L.DomUtil.create("a",this.options.className,this._container).href="#",L.DomEvent.on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"click",L.DomEvent.stop).on(this._container,"click",function(){this._active=!this._active;var t,e=n.getZoom();e<=n.getMinZoom()||(t=e<10?e-1:e<13?e-2:e-3,n.setZoom(t))},this),this._container},activate:function(){L.DomUtil.addClass(this._container,"active")},deactivate:function(){L.DomUtil.removeClass(this._container,"active"),this._active=!1}}),L.control.comingSoon=function(t){return new L.Control.ComingSoon(t)};var BaseStrategy=function(){function o(t){_classCallCheck(this,o),this.http=t,this.NO_METADATA="Metadata",this.NO_METADATA_LINK="Metadata supplied with download"}return _createClass(o,[{key:"constructLink",value:function(t){return t.metadata_url?t.metadata_url:null}},{key:"hasMetadata",value:function(){return!1}},{key:"requestMetadata",value:function(t){var e=t.metadata_url?this.NO_METADATA:this.NO_METADATA_LINK;return o.resolvedPromise({title:e})}}],[{key:"resolvedPromise",value:function(t){var e={then:function(t){this.fn=t}};return setTimeout(function(){e.fn&&e.fn(t)},1),e}},{key:"extractData",value:function(t){var e,n=t.MD_Metadata,r={},i=n&&n.identificationInfo&&n.identificationInfo.MD_DataIdentification,a=i;return(i=(i=i&&i.citation&&i.citation.CI_Citation)&&i.title&&i.title.CharacterString)?(r.title=i.__text,e=a&&a.abstract&&a.abstract.CharacterString&&a.abstract.CharacterString.__text,r.abstract=r.abstractText=e):r.title=_get(_getPrototypeOf(o),"NO_METADATA",this),r}}]),o}(),UnknownStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),ActStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),GaStrategy=function(){_inherits(r,BaseStrategy);var n=_createSuper(r);function r(t){var e;return _classCallCheck(this,r),(e=n.call(this,t)).GA_LINK_METADATA_TEMPLATE="https://ecat.ga.gov.au/geonetwork/srv/eng/search#!${uuid}",e.GA_METADATA_TEMPLATE="https://ecat.ga.gov.au/geonetwork/srv/eng/xml.metadata.get?uuid=${uuid}",e.UUID_REG_EX=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/,e}return _createClass(r,[{key:"constructLink",value:function(t){if(t.metadata_url)return t.metadata_url;var e=t.metadata_id;return e?this.GA_LINK_METADATA_TEMPLATE.replace("${uuid}",e):null}},{key:"hasMetadata",value:function(t){return!!this.constructLink(t)}},{key:"requestMetadata",value:function(t){var e=this,n=t.metadata_id,r=n?"xml2js/"+this.GA_METADATA_TEMPLATE.replace("${uuid}",n):null;return r?this.http.get(r).then(function(t){return BaseStrategy.extractData(t.data)},function(t){return{title:e.NO_METADATA}}):BaseStrategy.resolvedPromise({title:this.NO_METADATA})}}]),r}(),EftfStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return _createClass(n,[{key:"constructLink",value:function(t){return t.metadata_url}},{key:"requestMetadata",value:function(){return BaseStrategy.resolvedPromise({title:"View metadata in new page"})}}]),n}(),NswStrategy=function(){_inherits(o,BaseStrategy);var n=_createSuper(o);function o(t){var e;return _classCallCheck(this,o),(e=n.call(this,t)).NSW_METADATA_TEMPLATE="https://s3-ap-southeast-2.amazonaws.com/nsw.elvis/z5${zone}/Metadata/",e}return _createClass(o,[{key:"constructLink",value:function(t){var e=t.file_name,n=e.search(/\_5\d\_/),r=6,i=this.NSW_METADATA_TEMPLATE;return-1!==n&&(r=e.substr(n+2,1)),i.replace("${zone}",r)+e.replace(".zip","_Metadata.html")}},{key:"hasMetadata",value:function(){return!0}},{key:"requestMetadata",value:function(t){var e=this,n=t.file_name,r=n.search(/\_5\d\_/),i=6,a=this.NSW_METADATA_TEMPLATE;return-1!==r&&(i=n.substr(r+2,1)),a="xml2js/"+a.replace("${zone}",i)+n.replace(".zip","_Metadata.xml"),this.http.get(a).then(function(t){return BaseStrategy.extractData(t.data)},function(t){return{title:_get(_getPrototypeOf(o.prototype),"NO_METADATA",e)}})}}]),o}(),NtStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),QldStrategy=function(){_inherits(i,BaseStrategy);var n=_createSuper(i);function i(t){var e;return _classCallCheck(this,i),(e=n.call(this,t)).XML_METADATA_TEMPLATE="http://qldspatial.information.qld.gov.au/catalogue/rest/document?id={metadata_id}&f=xml",e.QLD_METADATA_TEMPLATE="http://qldspatial.information.qld.gov.au/catalogue/rest/document?id={EB442CAB-D714-40D8-82C2-A01CA4661324}&f=xml",e.QLD_HTML_TEMPLATE="http://qldspatial.information.qld.gov.au/catalogue/custom/detail.page?fid={EB442CAB-D714-40D8-82C2-A01CA4661324}",e.FRASER_COAST_METADATA_TEMPLATE="http://qldspatial.information.qld.gov.au/catalogue/rest/document?id={E8CEF5BA-A1B7-4DE5-A703-8161FD9BD3CF}&f=xml",e.FRASER_COAST_HTML_TEMPLATE="http://qldspatial.information.qld.gov.au/catalogue/custom/detail.page?fid={E8CEF5BA-A1B7-4DE5-A703-8161FD9BD3CF}",e.FRASER_COAST_BOUNDS=[152.331,-26.003,153.37,-24.692],e}return _createClass(i,[{key:"constructLink",value:function(t){if(t.metadata_url)return t.metadata_url;var e=t.bbox.split(",").map(function(t){return parseFloat(t.trim())});return e[0]>=this.FRASER_COAST_BOUNDS[0]&&e[1]>=this.FRASER_COAST_BOUNDS[1]&&e[2]<=this.FRASER_COAST_BOUNDS[2]&&e[0]>=this.FRASER_COAST_BOUNDS[3]?this.FRASER_COAST_HTML_TEMPLATE:this.QLD_HTML_TEMPLATE}},{key:"hasMetadata",value:function(){return!0}},{key:"requestMetadata",value:function(t){var e,n,r=this;return t.metadata_id?e=this.XML_METADATA_TEMPLATE.replace("metadata_id",t.metadata_id):(e=this.QLD_METADATA_TEMPLATE,(n=t.bbox.split(",").map(function(t){return parseFloat(t.trim())}))[0]>=this.FRASER_COAST_BOUNDS[0]&&n[1]>=this.FRASER_COAST_BOUNDS[1]&&n[2]<=this.FRASER_COAST_BOUNDS[2]&&n[0]>=this.FRASER_COAST_BOUNDS[3]&&(e=this.FRASER_COAST_METADATA_TEMPLATE)),this.http.get("xml2js/"+e).then(function(t){return BaseStrategy.extractData(t.data)},function(t){return{title:_get(_getPrototypeOf(i.prototype),"NO_METADATA",r)}})}}]),i}(),SaStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),TasStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),VicStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),WaStrategy=function(){_inherits(n,BaseStrategy);var e=_createSuper(n);function n(t){return _classCallCheck(this,n),e.call(this,t)}return n}(),Strategies=function(){function n(t){_classCallCheck(this,n);var e=this.unknown=new UnknownStrategy;this.strategies=[{name:"NSW Government",strategy:new NswStrategy(t)},{name:"VIC Government",strategy:e},{name:"SA Government",strategy:e},{name:"WA Government",strategy:e},{name:"QLD Government",strategy:new QldStrategy(t)},{name:"ACT Government",strategy:e},{name:"NT Government",strategy:e},{name:"TAS Government",strategy:e},{name:"Geoscience Australia",strategy:new GaStrategy(t)},{name:"Exploring for the Future",strategy:new EftfStrategy(t)}]}return _createClass(n,[{key:"strategy",value:function(e){var t=this.strategies.find(function(t){return t.name&&0===e.indexOf(t.name)});return t?t.strategy:this.unknown}}]),n}();angular.module("icsm.themes",[]).directive("icsmThemes",["themesService",function(n){return{restrict:"AE",templateUrl:"icsm/themes/themes.html",link:function(e){n.getThemes().then(function(t){e.themes=t}),n.getCurrentTheme().then(function(t){e.theme=t}),e.changeTheme=function(t){e.theme=t,n.setTheme(t.key)}}}}]).controller("themesCtrl",["themesService",function(t){this.service=t}]).filter("themesFilter",function(){return function(t,e){var n=[];return e?(t&&t.forEach(function(t){t.themes&&t.themes.some(function(t){return t==e.key})&&n.push(t)}),n):t}}).factory("themesService",["$q","configService","storageService",function(e,t,n){var r="icsm.current.theme",i=[],a=this;return this.themes=[],this.theme=null,n.getItem(r).then(function(e){e=e||"All",t.getConfig("themes").then(function(t){a.themes=t,a.theme=t[e],angular.forEach(t,function(t,e){t.key=e}),i.forEach(function(t){t.resolve(a.theme)})})}),this.getCurrentTheme=function(){if(this.theme)return e.when(a.theme);var t=e.defer();return i.push(t),t.promise},this.getThemes=function(){return t.getConfig("themes")},this.setTheme=function(t){this.theme=this.themes[t],n.setItem(r,t)},this}]),angular.module("icsm.transect",[]).provider("transectService",function(){var a,w={},o={lngMin:112.99986111100009,lngMax:153.999861113351,latMin:-44.0001389004617,latMax:-10.00013890099995};this.extent=function(t){o.lngMin=angular.isUndefined(t.lngMin)?o.lngMin:t.lngMin,o.lngMax=angular.isUndefined(t.lngMax)?o.lngMax:t.lngMax,o.latMin=angular.isUndefined(t.latMin)?o.latMin:t.latMin,o.latMax=angular.isUndefined(t.latMax)?o.latMax:t.latMax},this.setServiceUrl=function(t,e){t=t.toLowerCase(),w[t]={urlTemplate:e},"elevation"===t&&(a=e.replace(/{height}|{width}/g,"1"))},this.$get=["$q",function(d){return{getElevation:function(t,e){return this.getServiceData("elevation",t,e)},getServiceData:function(e,t,n){var p=Exp.Util.toGeoJSONFeature(t),r=turf.extent(p),m={type:"FeatureCollection",features:[]},f=r[0],i=r[1],a=r[2],g=r[3];if(e=e.toLowerCase(),!(u=w[e]&&w[e].urlTemplate))return d.when(m);var h=(a=f<a?a:f+1e-4)-f,v=(g=i<g?g:i+1e-4)-i;i-=(n=n||0)*v,g+=n*v,f-=n*h,a+=n*h;var o,s,l,y=(o=500,s=h/v,l=Math.sqrt(o*o/(1+s*s)),{y:Math.ceil(l),x:Math.ceil(l*s)}),b=turf.lineDistance(p,"kilometers"),c=new TerrainLoader,x=d.defer(),u=u.replace("{bbox}",f+","+i+","+a+","+g).replace(/{width}/g,""+Math.ceil(y.x)).replace(/{height}/g,""+Math.ceil(y.y));return c.load(u,function(t){for(var e,n,r,i,a,o,s=b/499,l=0;l<500;l++){var c=l*s,u=turf.along(p,c,"kilometers"),d=(e=u.geometry.coordinates,0,n=e[0],r=e[1],i=f,a=Math.round((g-r)/v*(y.y-1)),o=Math.round((n-i)/h*(y.x-1)),t[a*y.x+o]);u.properties.distance=c,-32767<d&&(u.geometry.coordinates.push(d),m.features.push(u))}x.resolve(m)},function(t){console.log("Failed to load transect data for "+e),x.reject(t)}),x.promise},isServiceDataAvailable:function(t){return w[t]&&w[t].urlTemplate},getElevationAtPoint:function(t){var e=t.lng,n=t.lat;if(n<o.latMin||n>o.latMax||e<o.lngMin||e>o.lngMax)return d.when(null);var r=[e-1e-6,n-1e-6,e+1e-6,n+1e-6],i=d.defer();return(new TerrainLoader).load(a.replace("{bbox}",r.join(",")),function(t){i.resolve(t)},function(t){console.log("Error, probably out of bounds")}),i.promise}}}]}),angular.module("icsm.toolbar",[]).directive("elevationToolbar",[function(){return{restrict:"AE",templateUrl:"icsm/toolbar/toolbar.html",controller:"toolbarLinksCtrl",transclude:!0}}]).controller("toolbarLinksCtrl",["$scope","configService",function(e,t){var n=this;t.getConfig().then(function(t){n.links=t.toolbarLinks}),e.item="",e.toggleItem=function(t){e.item=e.item===t?"":t}}]);var DownloadCtrl=function(e){e.data().then(function(t){this.data=t}.bind(this)),this.remove=function(){e.clear()},this.changeEmail=function(t){e.setEmail(t)}},DownloadService=function(t,e,n,r,i){var a="download_email",o="Download Layers",s={zoom:null,center:null,layer:null},l=null,c={getLayerGroup:function(){return r.getGroup(o)},setState:function(t){t?function(){t.bounds.yMin,t.bounds.xMin,t.bounds.yMax,t.bounds.xMax;s.layer&&r.getGroup(o).removeLayer(s.layer)}():s.layer&&(r.clearGroup(o),s.layer=null)},decorate:function(){var t=l.item;l.item.download=!0,t.processsing||(t.processing={clip:{xMax:null,xMin:null,yMax:null,yMin:null}})},setEmail:function(t){i.setItem(a,t)},getEmail:function(){return i.getItem(a).then(function(t){return l.email=t})},data:function(){return l?e.when(l):t.get("icsm/resources/config/icsm.json").then(function(t){return l=t.data,c.decorate(),l})}};return c};angular.module("icsm.view",[]).directive("icsmView",["downloadService",function(n){return{templateUrl:"icsm/view/view.html",controller:"DownloadCtrl",link:function(e){n.data().then(function(t){e.data=t}),e.$watch("data.item",function(t,e){(t||e)&&n.setState(t)})}}}]).controller("DownloadCtrl",DownloadCtrl).factory("downloadService",DownloadService),DownloadCtrl.$inject=["downloadService"],DownloadService.$inject=["$http","$q","$rootScope","mapService","storageService"],angular.module("icsm.templates",[]).run(["$templateCache",function(t){t.put("icsm/app/app.html",'<div>\r\n\t\x3c!-- BEGIN: Sticky Header --\x3e\r\n\t<div explorer-header style="z-index:1"\r\n\t\t\tclass="navbar navbar-default navbar-fixed-top"\r\n\t\t\theading="\'Elevation\'"\r\n\t\t\theadingtitle="\'ICSM\'"\r\n\t\t\tbreadcrumbs="[{name:\'ICSM\', title: \'Reload Elevation\', url: \'.\'}]"\r\n\t\t\thelptitle="\'Get help about Elevation\'"\r\n\t\t\thelpalttext="\'Get help about Elevation\'">\r\n\t</div>\r\n\t\x3c!-- END: Sticky Header --\x3e\r\n\r\n\t\x3c!-- Messages go here. They are fixed to the tab bar. --\x3e\r\n\t<div explorer-messages class="marsMessages noPrint"></div>\r\n\t<icsm-panes data="root.data" default-item="download"></icsm-panes>\r\n</div>'),t.put("icsm/coverage/popup.html",'<span class="coverage" ng-class="state.show ? \'transitioned-down\' : \'transitioned-up\'">\r\n   <div style="padding-bottom:15px" class="coverage-off">\r\n      <button class="undecorated coverage-unstick" ng-click="hide()" style="float:right" title="Hide layer selections">X</button>\r\n   </div>\r\n   <div ng-repeat="layer in state.layers" class="coverage-layer" tooltip-placement="left"\r\n         uib-tooltip="Hint: To bring this layer to the top turn it off then on. The last clicked layer is always on top.">\r\n      <input type="checkbox" ng-checked="layer.visible" ng-click="toggleVisibility(layer)"></input>\r\n      <span ng-click="toggleVisibility(layer)">\r\n         <span class="coverage-title">{{layer.name}}</span><br/>\r\n         <img style="width:100px" ng-src="{{layer.coverage.thumb}}"></img>\r\n      </span>\r\n      <div class="pull-right">\r\n         <div style="width: 110px" ng-repeat="type in layer.coverage.types">\r\n            <span class="coverage-legend-color" ng-style="{\'background-color\':type.color}"></span>\r\n            {{type.name}}\r\n         </div>\r\n      </div>\r\n   </div>\r\n</span>'),t.put("icsm/coverage/trigger.html",'<button ng-click="toggle()" type="button" class="map-tool-toggle-btn" title="Select views of coverage, view legends and summaries of the coverage layers">\r\n      <span class="panel-sm">Layers</span>\r\n      <img src="icsm/resources/img/layers-16.png">\r\n</button>'),t.put("icsm/clip/clip.html",'<div class="well well-sm">\r\n   <div class="container-fluid">\r\n      <div class="row">\r\n         <div class="col-md-10">\r\n            <strong style="font-size:120%">Select area by:</strong>\r\n            <button ng-click="initiateDraw()" style="position:relative" ng-disable="client.drawing" tooltip-placement="right"\r\n               uib-tooltip="Drawing a bounding box. On enabling, click on the map and drag diagonally"\r\n               class="clip-btn">\r\n               <img style="height:24px;" src="icsm/resources/img/draw_rectangle.png"></img>\r\n               <div></div>\r\n            </button>\r\n            <button ng-click="initiatePolygon()" style="position:relative" ng-disable="client.drawing" tooltip-placement="right"\r\n               uib-tooltip="Drawing a polygon. On enabling, click vertices on the map, click on the first vertex to complete the loop."\r\n               class="clip-btn">\r\n               <img style="height:26px;" src="icsm/resources/img/draw_polygon.png"></img>\r\n               <div></div>\r\n            </button>\r\n            <button ng-click="typing = !typing" style="position:relative" tooltip-placement="right"\r\n               uib-tooltip="Type coordinates of a bounding box. Restricted to maximum of 2.25 square degrees."\r\n               class="clip-btn">\r\n               <i class="fa fa-keyboard-o fa-2x" aria-hidden="true"></i>\r\n               <div></div>\r\n            </button>\r\n         </div>\r\n         <div class="col-md-2">\r\n            <button style="float:right" ng-click="showInfo = !showInfo" tooltip-placement="left"\r\n               uib-tooltip="Information." class="btn btn-primary btn-default"><i class="fa fa-info"></i></button>\r\n            <exp-info title="Selecting an area" show-close="true"\r\n               style="width:450px;position:fixed;top:230px;right:40px" is-open="showInfo">\r\n               <icsm-info-bbox>\r\n         </div>\r\n         </exp-info>\r\n      </div>\r\n   </div>\r\n   <div class="row" ng-hide="typing || (!clip.xMin && clip.xMin !== 0) || oversize" style="padding-top:7px;">\r\n         <div class="col-md-12 ng-binding" ng-if="clip.type == \'polygon\'">\r\n            Polygon bounded by:\r\n            {{clip.xMin | number : 4}}° west,\r\n            {{clip.yMax | number : 4}}° north,\r\n            {{clip.xMax | number : 4}}° east,\r\n            {{clip.yMin | number : 4}}° south\r\n         </div>\r\n         <div class="col-md-12 ng-binding" ng-if="clip.type == \'bbox\'">\r\n            Selected bounds:\r\n            {{clip.xMin | number : 4}}° west,\r\n            {{clip.yMax | number : 4}}° north,\r\n            {{clip.xMax | number : 4}}° east,\r\n            {{clip.yMin | number : 4}}° south\r\n         </div>\r\n   </div>\r\n   <clip-modal title="Define search area" show-close="true" style="width:480px;position:fixed;top:110px;right:80px"\r\n      is-open="typing">\r\n      <icsm-manual-clip></icsm-manual-clip>\r\n   </clip-modal>\r\n</div>'),t.put("icsm/clip/infobbox.html",'<div class="">\r\n\t<strong style="font-size:120%">Select an area of interest.</strong>\r\n   By hitting one of the "Draw" buttons an area on the map can be selected with the mouse by drawing a bounding box, drawing a polygon or manually typing in the minimum and maximum of latitude and longitude. Hover over the buttons to see\r\n\tmore information.\r\n\t<br/>\r\n   Clicking one of the "Draw" buttons again allows replacing a previous area selection. <br/>\r\n   <strong>Notes:</strong>\r\n   <ul>\r\n      <li>The data does not cover all of Australia.</li>\r\n      <li>Restrict a search area to below 1.5 degrees square. eg 2x0.75 or 1x1.5</li>\r\n   </ul>\r\n\t<p style="padding-top:5px"><strong>Hint:</strong> If the map has focus, you can use the arrow keys to pan the map.\r\n\t\tYou can zoom in and out using the mouse wheel or the "+" and "-" map control on the top left of the map. If you\r\n\t\tdon\'t like the position of your drawn area, hit the one of the "Draw" buttons to draw a new search area.\r\n\t</p>\r\n</div>'),t.put("icsm/clip/manual.html",'<div class="container-fluid" style="padding-top:7px">\r\n   <div class="row">\r\n      <div class="col-md-3"> </div>\r\n      <div class="col-md-8">\r\n         <div style="font-weight:bold;width:3.5em;display:inline-block">Y Max:</div>\r\n         <span>\r\n            <input type="text" style="width:6em" ng-model="yMax" ng-change="check()"></input>\r\n         </span>\r\n      </div>\r\n   </div>\r\n   <div class="row">\r\n      <div class="col-md-6">\r\n         <div style="font-weight:bold;width:3.5em;display:inline-block">X Min:</div>\r\n         <span>\r\n            <input type="text" style="width:6em" ng-model="xMin" ng-change="check()"></input>\r\n         </span>\r\n      </div>\r\n      <div class="col-md-6">\r\n         <div style="font-weight:bold;width:3.5em;display:inline-block">X Max:</div>\r\n         <span>\r\n            <input type="text" style="width:6em" ng-model="xMax" ng-change="check()"></input>\r\n         </span>\r\n      </div>\r\n   </div>\r\n   <div class="row">\r\n      <div class="col-md-offset-3 col-md-5">\r\n         <div style="font-weight:bold;width:3.5em;display:inline-block">Y Min:</div>\r\n         <span>\r\n            <input type="text" style="width:6em" ng-model="yMin" ng-change="check()"></input>\r\n         </span>\r\n      </div>\r\n      <div class="col-md-4">\r\n         <button style="float:right" ng-disabled="!xMin || !xMax || !yMin || !yMax || isNan(xMin) || isNan(xMax) || isNan(yMin) || isNan(yMax) || (+xMin) === (+xMax) || (+yMin) === (+yMax)" class="btn btn-primary btn-default" ng-click="search()">Search</button>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/clip/modal.html",'<div class="clipmodal" ng-show="isOpen">\r\n\t<div class="clipmodal-inner">\r\n      <h3 ng-show="title" class="clipmodal-title">\r\n\t\t  \t<span  ng-bind="title"></span>\r\n\t\t  \t<span ng-show="showClose" class="pull-right">\r\n\t\t \t\t<button type="button" class="undecorated" ng-click="isOpen = false"><i class="fa fa-close"></i></button>\r\n\t\t\t</span>\r\n\t\t</h3>\r\n      <div class="clipmodal-content" ng-transclude></div>\r\n\t</div>\r\n</div>'),t.put("icsm/contributors/contributors.html",'<span class="contributors" \r\n      ng-class="(contributors.show || contributors.ingroup || contributors.stick) ? \'transitioned-down\' : \'transitioned-up\'">\r\n   <button class="undecorated contributors-unstick" ng-click="unstick()" style="float:right">X</button>\r\n   <div ng-repeat="contributor in contributors.orgs | activeContributors" style="text-align:center">\r\n      <a ng-href="{{contributor.href}}" name="contributors{{$index}}" title="{{contributor.title}}" target="_blank">\r\n         <img ng-src="{{contributor.image}}" alt="{{contributor.title}}" class="contributor-logo" ng-class="contributor.class"></img>\r\n      </a>\r\n   </div>\r\n</span>'),t.put("icsm/contributors/show.html",'<a class="contributors-link" title="View contributors list."\r\n      ng-click="toggleStick()" href="#contributors0">Contributors</a>'),t.put("icsm/glossary/glossary.html",'<div ng-controller="GlossaryCtrl as glossary">\r\n   <div style="position:relative;padding:5px;padding-left:10px;">\r\n      <div class="panel" style="padding:5px;">\r\n         <p style="text-align: left; margin: 10px; font-size: 14px;">\r\n\t         <strong>Glossary</strong>\r\n         </p>\r\n\r\n         <div class="panel-body">\r\n            <table class="table table-striped">\r\n               <thead>\r\n                  <tr>\r\n                     <th>Term</th>\r\n                     <th>Definition</th>\r\n                  </tr>\r\n               </thead>\r\n               <tbody>\r\n                  <tr ng-repeat="term in glossary.terms">\r\n                     <td>{{term.term}}</td>\r\n                     <td>{{term.definition}}</td>\r\n                  </tr>\r\n               </tbody>\r\n            </table>\r\n         </div>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/header/header.html",'<div class="container-full common-header" style="padding-right:10px; padding-left:10px">\r\n   <div class="navbar-collapse collapse ga-header-collapse">\r\n      <ul class="nav navbar-nav">\r\n         <li class="hidden-xs">\r\n            <a href="https://www.icsm.gov.au/" target="_blank" class="icsm-logo"\r\n               style="margin-top: -4px;display:inline-block;">\r\n               <img alt="ICSM - ANZLIC Committee on Surveying &amp; Mapping" class="header-logo"\r\n                  src="icsm/resources/img/icsm-logo-sml.gif">\r\n            </a>\r\n            <a href="/">\r\n               <h1 class="applicationTitle">{{heading}}</h1>\r\n            </a>\r\n         </li>\r\n      </ul>\r\n      <ul class="nav navbar-nav navbar-right nav-icons">\r\n         <li role="menuitem" style="padding-right:10px;position: relative;top: -3px;">\r\n            <span class="altthemes-container">\r\n               <span>\r\n                  <a title="Location INformation Knowledge platform (LINK)" href="http://fsdf.org.au/" target="_blank">\r\n                     <img alt="FSDF" src="icsm/resources/img/FSDFimagev4.0.png" style="height: 66px">\r\n                  </a>\r\n               </span>\r\n            </span>\r\n         </li>\r\n         <li common-navigation role="menuitem" current="current" style="padding-right:10px"></li>\r\n         <li mars-version-display role="menuitem"></li>\r\n         <li style="width:10px"></li>\r\n      </ul>\r\n   </div>\r\n   \x3c!--/.nav-collapse --\x3e\r\n</div>\r\n<div class="contributorsLink" style="position: absolute; right:7px; bottom:15px">\r\n   <icsm-contributors-link></icsm-contributors-link>\r\n</div>\r\n\x3c!-- Strap --\x3e\r\n<div class="row">\r\n   <div class="col-md-12">\r\n      <div class="strap-blue">\r\n      </div>\r\n      <div class="strap-white">\r\n      </div>\r\n      <div class="strap-red">\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/help/faqs.html",'<p style="text-align: left; margin: 10px; font-size: 14px;">\r\n   <strong>FAQS</strong>\r\n</p>\r\n\r\n<h5 ng-repeat="faq in faqs"><button type="button" class="undecorated" ng-click="focus(faq.key)">{{faq.question}}</button></h5>\r\n<hr/>\r\n<div class="row" ng-repeat="faq in faqs">\r\n   <div class="col-md-12">\r\n      <h5 tabindex="0" id="faqs_{{faq.key}}">{{faq.question}}</h5>\r\n      <span ng-bind-html="faq.answer"></span>\r\n      <hr/>\r\n   </div>\r\n</div>'),t.put("icsm/help/help.html",'<p style="text-align: left; margin: 10px; font-size: 14px;">\r\n\t<strong>Help</strong>\r\n</p>\r\n\r\n<div class="panel-body" ng-controller="HelpCtrl as help">\r\n\tThe steps to get data!\r\n\t<ol>\r\n\t\t<li>Define area of interest</li>\r\n\t\t<li>Select datasets</li>\r\n\t\t<li>Confirm selections</li>\r\n\t\t<li>Enter email address and industry</li>\r\n\t\t<li>Start extract</li>\r\n\t</ol>\r\n\tOne or more emails will be sent to you on completion of the data extract(s) with a link to your data.\r\n   <hr>\r\n\t<icsm-faqs faqs="help.faqs" ></icsm-faqs>\r\n</div>'),t.put("icsm/imagery/launch.html",'<button type="button" class="undecorated" title="View preview of imagery" ng-click="preview()" ng-if="show">\r\n\t<i class="fa fa-lg fa-eye"></i>\r\n</button>'),t.put("icsm/panes/panes.html",'<div class="mapContainer" class="col-md-12" style="padding-right:0"  ng-attr-style="right:{{right.width}}">\r\n   <span common-baselayer-control class="baselayer-slider" max-zoom="16" title="Satellite to Topography bias on base map."></span>\r\n   <div class="panesMapContainer" geo-map configuration="data.map">\r\n      <geo-extent></geo-extent>\r\n      <icsm-layerswitch></icsm-layerswitch>\r\n   </div>\r\n   <div class="base-layer-controller">\r\n      <div geo-draw data="data.map.drawOptions" line-event="elevation.plot.data" rectangle-event="bounds.drawn" polygon-event="polygon.drawn"></div>\r\n   </div>\r\n   <restrict-pan bounds="data.map.position.bounds"></restrict-pan>\r\n</div>\r\n'),t.put("icsm/panes/tabs.html",'\x3c!-- tabs go here --\x3e\r\n<div id="panesTabsContainer" class="paneRotateTabs" style="opacity:0.9" ng-style="{\'right\' : contentLeft +\'px\'}">\r\n\r\n   <div class="paneTabItem" style="width:60px; opacity:0">\r\n\r\n   </div>\r\n   <div class="paneTabItem" ng-class="{\'bold\': view == \'download\'}" ng-click="setView(\'download\')">\r\n      <button class="undecorated">Datasets Download</button>\r\n   </div>\r\n   \x3c!--\r\n\t<div class="paneTabItem" ng-class="{\'bold\': view == \'search\'}" ng-click="setView(\'search\')">\r\n\t\t<button class="undecorated">Search</button>\r\n\t</div>\r\n\t<div class="paneTabItem" ng-class="{\'bold\': view == \'maps\'}" ng-click="setView(\'maps\')">\r\n\t\t<button class="undecorated">Layers</button>\r\n\t</div>\r\n   --\x3e\r\n   <div class="paneTabItem" ng-class="{\'bold\': view == \'downloader\'}" ng-click="setView(\'downloader\')">\r\n      <button class="undecorated">Products Download</button>\r\n   </div>\r\n   <div class="paneTabItem" ng-class="{\'bold\': view == \'glossary\'}" ng-click="setView(\'glossary\')">\r\n      <button class="undecorated">Glossary</button>\r\n   </div>\r\n   <div class="paneTabItem" ng-class="{\'bold\': view == \'help\'}" ng-click="setView(\'help\')">\r\n      <button class="undecorated">Help</button>\r\n   </div>\r\n</div>'),t.put("icsm/message/message.html","<div class=\"well well-sm mess-container\" ng-show=\"message.type && message.text\"\r\n   ng-class=\"{'mess-error': message.type == 'error', 'mess-warn': message.type == 'warn', 'mess-info': (message.type == 'info' || message.type == 'wait')}\">\r\n   <i class=\"fa fa-spinner fa-spin fa-fw\" aria-hidden=\"true\" ng-if=\"message.type == 'wait'\"></i>\r\n   <span>{{message.text}}</span>\r\n</div>"),t.put("icsm/products/download.html",'<div class="well" ng-show="item.showDownload">\r\n\r\n   <div class="well">\r\n      <div ng-show="processing.validClip" class="product-restrict">\r\n         <span class="product-label">Bounds:</span> {{processing.clip.xMin|number : 4}}&deg; west, {{processing.clip.yMax|number : 4}}&deg; north, {{processing.clip.xMax|number\r\n         : 4}}&deg; east, {{processing.clip.yMin|number : 4}}&deg; south\r\n\r\n         <div ng-show="processing.message" class="product-warning">\r\n            {{processing.message}}\r\n         </div>\r\n      </div>\r\n      <product-projection processing="processing"></product-projection>\r\n      <br/>\r\n      <product-formats processing="processing"></product-formats>\r\n      <br/>\r\n      <product-email processing="processing"></product-email>\r\n   </div>\r\n   <product-download-submit processing="processing" item="item"></product-download-submit>\r\n</div>'),t.put("icsm/products/email.html",'<div class="input-group">\r\n      <span class="input-group-addon" id="nedf-email">Email</span>\r\n      <input required="required" type="email" ng-model="processing.email" class="form-control" placeholder="Email address to send download link">\r\n   </div>\r\n'),t.put("icsm/products/formats.html",'<div class="row">\r\n      <div class="col-md-4">\r\n         <label for="geoprocessOutputFormat">\r\n                  Output Format\r\n               </label>\r\n      </div>\r\n      <div class="col-md-8">\r\n         <select id="geoprocessOutputFormat" style="width:95%" ng-model="processing.outFormat" ng-options="opt.value for opt in config.outFormat track by opt.code"></select>\r\n      </div>\r\n   </div>'),t.put("icsm/products/projection.html",'<div class="row">\r\n   <div class="col-md-4">\r\n      <label for="geoprocessOutCoordSys">\r\n                  Coordinate System\r\n               </label>\r\n   </div>\r\n   <div class="col-md-8">\r\n      <select id="geoprocessOutCoordSys" style="width:95%" ng-model="processing.outCoordSys" ng-options="opt.value for opt in config.outCoordSys | productIntersect : processing.clip track by opt.code"></select>\r\n   </div>\r\n</div>'),t.put("icsm/products/submit.html",'<div class="well" style="padding-bottom:2px">\r\n   <div class="row">\r\n      <div class="col-md-6" style="padding-top:7px">\r\n         <div class="progress">\r\n            <div class="progress-bar" role="progressbar" aria-valuenow="{{processing.percentComplete}}" aria-valuemin="0" aria-valuemax="100"\r\n               style="width: {{processing.percentComplete}}%;">\r\n               <span class="sr-only">60% Complete</span>\r\n            </div>\r\n         </div>\r\n      </div>\r\n      <div class="col-md-4" style="padding-top:7px">\r\n         <span style="padding-right:10px" uib-tooltip="Draw a valid area to extract data." tooltip-placement="left">\r\n            <i class="fa fa-scissors fa-2x" ng-class="{\'product-valid\': processing.validClipSize, \'product-invalid\': !processing.validClipSize }"></i>\r\n         </span>\r\n         <span style="padding-right:10px" uib-tooltip="Select a valid coordinate system for area." tooltip-placement="left">\r\n            <i class="fa fa-file-video-o fa-2x" ng-class="{\'product-valid\': processing.validProjection, \'product-invalid\': !processing.validProjection}"></i>\r\n         </span>\r\n         <span style="padding-right:10px" uib-tooltip="Select a valid download format." tooltip-placement="left">\r\n            <i class="fa fa-files-o fa-2x" ng-class="{\'product-valid\': processing.validFormat, \'product-invalid\': !processing.validFormat}"></i>\r\n         </span>\r\n         <span style="padding-right:10px" uib-tooltip="Provide an email address." tooltip-placement="left">\r\n            <i class="fa fa-envelope fa-2x" ng-class="{\'product-valid\': processing.validEmail, \'product-invalid\': !processing.validEmail}"></i>\r\n         </span>\r\n      </div>\r\n      <div class="col-md-2">\r\n         <button class="btn btn-primary pull-right" ng-disabled="!processing.valid" ng-click="submit()">Submit</button>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/preview/preview.html",'<div class="preview-container" ng-if="previewData">\r\n   <div class="preview-blocker" ng-click="clear()"></div>\r\n\r\n   <div style="position:absolute; right: 10px; z-index: 1; top:20px">\r\n      <div class="pull-right">\r\n         <button type="button" class="btn btn-primary" ng-click="clear()" autofocus>Hide</button>\r\n      </div>\r\n   </div>\r\n   <img width="600" class="preview-image" ng-src="{{previewData.url}}"></img>\r\n</div>'),t.put("icsm/results/abstractbutton.html",'<button ng-show="show" type="button" class="undecorated" title="View full title and abstract of this dataset" ng-click="toggle()">\r\n\t<i class="fa fa-lg" ng-class="{\'fa-caret-down active\':item.showAbstract, \'fa-caret-right\':!item.showAbstract}"></i>\r\n</button>'),t.put("icsm/results/abstracttooltip.html","<div>\r\n{{item.metadata.title? item.metadata.title: 'Loading...'}}\r\n</div>"),t.put("icsm/results/continue.html",'<div class="continue-container" ng-show="ctrl.selected.length">\r\n   <div class="warn-limit alert-danger" ng-show="ctrl.selectedSize > limit">\r\n      There is a {{limit | fileSize}} limit per request.<br/>\r\n      Remove some selections or decrease the size of the selected area.\r\n   </div>\r\n   <button ng-disabled="ctrl.selectedSize > limit" class="btn btn-primary" ng-click="ctrl.review()">Download {{ctrl.selected.length | number}} selected datasets... (Approx: {{ctrl.selectedSize | fileSize}})</button>\r\n</div>\r\n\r\n'),t.put("icsm/results/orgheading.html",'<h5>\r\n   <img ng-src="{{mappings[org.source].image}}" ng-attr-style="height:{{mappings[org.source].height}}px"></img>\r\n      <strong>{{heading()}}</strong> (Showing {{org.downloadables | countMatchedDownloadables | number:0}} of {{org.downloadables\t| countDownloadables | number:0}})\r\n</h5>'),t.put("icsm/results/results.html",'<div ng-show="!list || !list.length">\r\n   <div class="alert alert-warning" role="alert">\r\n      <strong>Select an area</strong> to find datasets within.</div>\r\n</div>\r\n\r\n<div ng-show="list.length" class="results-list">\r\n   <div class="row">\r\n      <div class="col-md-12" uib-tooltip="Number of intersecting or very near datasets to your area of interest.">\r\n         <h4 style="display:inline-block; padding-left:7px">Found {{products.length | number:0}} datasets</h4>\r\n      </div>\r\n   </div>\r\n   <div class="panel panel-default" style="margin-bottom: 5px; margin-top: 0;">\r\n      <div class="panel-body" style="float:clear">\r\n         <span class="filter-text" style="float:left;width:50%">\r\n            <div class="input-group input-group-sm">\r\n               <span class="input-group-addon" id="names1">Filter:</span>\r\n               <input type="text" ng-model="filters.filter" class="form-control" ng-change="update()" placeholder="Filter names" aria-describedby="names1">\r\n            </div>\r\n         </span>\r\n         <span class="filter-type" style="padding:10px; float:right">\r\n            <span class="listTypeLabel">Filter by type:</span>\r\n            <span ng-repeat="type in filters.types" class="listType">\r\n               <input type="checkbox" ng-model="type.selected" ng-change="update()" />\r\n               <span uib-tooltip="{{type.description}}">{{type.label}}</span>\r\n            </span>\r\n         </span>\r\n      </div>\r\n   </div>\r\n\r\n   <div ng-repeat="available in list" class="well" style="padding-left:4px;padding-right:4px" ng-show="list.someMatches(available)"\r\n      ng-controller="listCtrl as list">\r\n      <icsm-org-heading org="available" mappings="mappings"></icsm-org-heading>\r\n      <div>\r\n         <div class="listRow" ng-class-odd="\'listEven\'" ng-repeat="(typeKey, types) in available.downloadables | allowedTypes" ng-show="types | hasTypeMatches">\r\n            <span>\r\n               <h5>{{typeKey}}</h5>\r\n            </span>\r\n\r\n            <div ng-if="typeKey === \'Unreleased Data\'">\r\n               <icsm-unreleased types="types">\r\n            </div>\r\n            <div ng-if="typeKey !== \'Unreleased Data\'">\r\n               <div ng-repeat="(key, items) in types" ng-show="(items | countMatchedItems) != 0">\r\n                  <div>\r\n                     <h5>\r\n                        <button ng-click="list.checkChildren(items)" style="width:7em" class="btn btn-xs btn-default">\r\n                           <span ng-show="!list.childrenChecked(items)">Select all</span>\r\n                           <span ng-show="list.childrenChecked(items)">Deselect all</span>\r\n                        </button>\r\n                        <span uib-tooltip="{{filter.types[key].description}}">{{key}} (Showing {{items | countMatchedItems | number:0}} of {{items.length | number:0}})</span>\r\n\r\n\r\n                        <button class="pull-right undecorated" ng-click="expansions[available.source + \'_\' + key] = !expansions[available.source + \'_\' + key]">\r\n                           [{{expansions[available.source + \'_\' + key]?"hide ":"show "}} list]\r\n                        </button>\r\n                     </h5>\r\n                  </div>\r\n                  <div ng-show="expansions[available.source + \'_\' + key]">\r\n                     <subtype items="items" mappings="mappings" show="show" hide="hide"></subtype>\r\n                     <div style="text-align:right">\r\n                        <button class="undecorated" ng-click="expansions[available.source + \'_\' + key] = false">[hide list]</button>\r\n                     </div>\r\n                  </div>\r\n               </div>\r\n            </div>\r\n         </div>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/results/subtype.html",'<div ng-show="(items | matchedItems).length > paging.pageSize"\r\n   paging page="paging.page" page-size="paging.pageSize"\r\n   total="(items | matchedItems).length"\r\n   paging-action="setPage(page, pageSize)">\r\n</div>\r\n<div>\r\n   <div ng-repeat="item in data" icsm-abstract-hover item="item">\r\n      <div tooltip-append-to-body="true" uib-tooltip-template="\'icsm/results/abstracttooltip.html\'" tooltip-popup-delay="400" data-ng-mouseenter="show(item)"\r\n         data-ng-mouseleave="hide(item)">\r\n         <input type="checkbox" ng-model="item.selected" />\r\n         <icsm-abstract item="item"></icsm-abstract>\r\n         <common-cc version="mappings[item.source].ccLicence"></common-cc>\r\n         <launch-image item="item" ng-if="item.thumb_url"></launch-image>\r\n         <span class="listItem" item="item" icsm-abstract-link></span>\r\n         <span ng-show="item.file_size" style="float:right;padding-top:3px">({{item.file_size | fileSize}})</span>\r\n         <span ng-show="item.product" style="float:right;padding-top:3px" title="Product size will depend on size of chosen area, data coverage and resolution. An email will be sent after the extraction giving the exact size of the extracted data and a link to the product.">(Product &lt; 500MB)</span>\r\n      </div>\r\n      <div ng-show="item.showAbstract" class="well">\r\n         <span ng-show="!item.metadata">\r\n            <i class="fa fa-spinner fa-spin fa-lg fa-fw"></i>\r\n            <span>Loading metadata...</span>\r\n         </span>\r\n         <div ng-show="item.metadata.abstract">\r\n            <strong>{{item.metadata.title}}</strong> -\r\n            <span class="icsm-abstract-body" ng-bind-html="item.metadata.abstractText"></span>\r\n         </div>\r\n         <div ng-show="!item.metadata.abstract">\r\n            <i class="fa fa-lg fa-exclamation-triangle" style="color:orange"></i>\r\n            Can\'t show abstract for this dataset.\r\n         </div>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/results/unreleased.html",'<div ng-repeat="(key, items) in types" ng-show="(items | countMatchedItems) != 0">\r\n   <div style="padding-left:8px">\r\n      <h5>\r\n         <span uib-tooltip="{{filter.types[key].description}}">{{key}} (Showing {{items | countMatchedItems | number:0}} of {{items.length | number:0}})</span>\r\n\r\n         <button class="pull-right undecorated" ng-click="expansions[\'unreleased_\' + items[0].source + \'_\' + key] = !expansions[\'unreleased_\' + items[0].source + \'_\' + key]">\r\n            [{{expansions[\'unreleased_\' + items[0].source + \'_\' + key]?"hide ":"show "}} list]\r\n         </button>\r\n      </h5>\r\n   </div>\r\n   <div ng-show="expansions[\'unreleased_\' + items[0].source + \'_\' + key]">\r\n      <div ng-repeat="item in items | matchedItems" icsm-abstract-hover item="item">\r\n         <div tooltip-append-to-body="true" uib-tooltip-template="\'icsm/results/abstracttooltip.html\'" tooltip-popup-delay="400" data-ng-mouseenter="show(item)"\r\n            data-ng-mouseleave="hide(item)" style="padding-left:8px;">\r\n            <icsm-abstract item="item"></icsm-abstract>\r\n            <button type="button" class="undecorated" disabled="disabled" title="Licence details pending release.">\r\n               <i class="fa fa-lg fa-gavel"></i>\r\n            </button>\r\n            <span class="listItem" name="project_name" item="item" icsm-abstract-link></span>\r\n            <span ng-show="item.file_size" style="float:right;padding-top:3px">({{item.file_size | fileSize}})</span>\r\n         </div>\r\n         <div ng-show="item.showAbstract" class="well" style="margin-bottom:0px">\r\n            <span ng-show="!item.metadata">\r\n               <i class="fa fa-spinner fa-spin fa-lg fa-fw"></i>\r\n               <span>Loading metadata...</span>\r\n            </span>\r\n            <div ng-show="item.metadata.abstract">\r\n               <strong>{{item.metadata.title}}</strong> -\r\n               <span class="icsm-abstract-body" ng-bind-html="item.metadata.abstractText"></span>\r\n            </div>\r\n            <div ng-show="!item.metadata.abstract">\r\n               <i class="fa fa-lg fa-exclamation-triangle" style="color:orange"></i>\r\n               There is no abstract available for this dataset.\r\n            </div>\r\n         </div>\r\n         <div style="padding-left:12px">\r\n            <div>\r\n               <strong style="width:7em">Captured: </strong>{{item.captured | captured}}\r\n            </div>\r\n            <div ng-if="item.available_date">\r\n               <strong style="width:7em">Available: </strong>{{item.available_date | reverseDate}}\r\n            </div>\r\n            <div>\r\n               <strong style="width:7em">Contact: </strong>\r\n               <a href="mailTo:{{item.contact}}">{{item.contact}}</a>\r\n            </div>\r\n         </div>\r\n      </div>\r\n\r\n      <div style="text-align:right">\r\n         <button class="undecorated" ng-click="expansions[\'unreleased_\' + items[0].source + \'_\' + key] = false">[hide list]</button>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/reviewing/reviewing.html",'<div class="modal-header">\r\n   <h3 class="modal-title splash">Download datasets by providing email address and start extract</h3>\r\n</div>\r\n<div class="modal-body" id="accept" ng-form exp-enter="accept()" icsm-splash-modal style="width: 100%; margin-left: auto; margin-right: auto;">\r\n   <div class="row bg-warning" ng-show="noneSelected(products)">\r\n      <div class="col-md-2">\r\n         <button type="button" style="float:right" class="btn btn-primary" ng-click="cancel()">Close</button>\r\n      </div>\r\n   </div>\r\n   <div ng-controller="listCtrl as list">\r\n      <div class="row">\r\n         <div class="col-md-12">\r\n            <strong>\r\n               {{list.selected.length}} Selected Datasets\r\n               <span ng-show="list.selectedSize">(Approx: {{list.selectedSize | fileSize}})</span>\r\n            </strong>\r\n         </div>\r\n      </div>\r\n   </div>\r\n   <div ng-repeat="org in products">\r\n      <h5>\r\n         <img ng-src="{{mappings[org.source].image}}" ng-attr-style="height:{{mappings[org.source].height}}px"></img>\r\n         <strong>{{heading(org.source)}}</strong>\r\n      </h5>\r\n      <div style="padding-left:10px" ng-repeat="(key, subGroup) in org.downloadables">\r\n         <h5>{{key}}</h5>\r\n         <div style="padding-left:10px;" ng-repeat="(name, items) in subGroup">\r\n            <h5 title="Clipped product using coordinate System: {{data.outCoordSys.value}}, Output Format: {{data.outFormat.value}}">\r\n               {{name}}\r\n               <span style="padding-left:25px;font-size:90%">\r\n                  {{items.length | number :0}} items\r\n                  <span ng-if="items | hasProducts">{{items | productsSummary}}</span>\r\n                  totalling {{items | reviewSumSize | fileSize}}</span>\r\n            </h5>\r\n         </div>\r\n      </div>\r\n\r\n   </div>\r\n\r\n   <div ng-controller="listCtrl as list">\r\n      <div ng-if="list.selected | hasTransformables" class="well" style="padding:7px">\r\n         <h5 style="margin-top:4px">{{list.selected | transformablesCount}} item(s) are downloads which you can elect to transform into a different coordinate system and file format</h5>\r\n         <span products-dialog>\r\n            <product-projection processing="data"></product-projection>\r\n            <product-formats processing="data"></product-formats>\r\n         </span>\r\n      </div>\r\n   </div>\r\n\r\n   <div class="row reviewing-divider">\r\n      <div class="col-md-12" style="padding-bottom: 8px">\r\n         <div review-industry></div>\r\n      </div>\r\n      <div class="col-md-12">\r\n         <div review-email></div>\r\n      </div>\r\n   </div>\r\n   <div class="row" ng-controller="listCtrl as list">\r\n      <div class="col-md-8">\r\n         <strong>Email notification</strong> The extract of data can take some time. By providing an email address we will be able\r\n         to notify you when the job is complete. The email will provide a link to the extracted data which will be packaged\r\n         up as a single compressed file.\r\n\r\n         <div\r\n            vc-recaptcha\r\n            theme="\'light\'"\r\n            key="recaptchaKey"\r\n            on-create="setWidgetId(widgetId)"\r\n            on-success="setResponse(response)"\r\n            on-expire="cbExpiration()"></div>\r\n      </div>\r\n      <div class="col-md-4">\r\n         <div class="pull-right" style="padding:8px;">\r\n            <button type="button" class="btn btn-primary" ng-click="accept()" ng-disabled="!data.industry || !data.email || !list.selected.length || !recaptchaResponse">Start extract of datasets\r\n            </button>\r\n            <button type="button" class="btn btn-primary" ng-click="cancel()">Cancel</button>\r\n         </div>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/select/doc.html",'<div ng-class-odd="\'odd\'" ng-class-even="\'even\'" ng-mouseleave="select.lolight(doc)" ng-mouseenter="select.hilight(doc)">\r\n\t<span ng-class="{ellipsis:!expanded}" tooltip-enable="!expanded" style="width:100%;display:inline-block;"\r\n\t\t\ttooltip-class="selectAbstractTooltip" tooltip="{{doc.abstract | truncate : 250}}" tooltip-placement="bottom">\r\n\t\t<button type="button" class="undecorated" ng-click="expanded = !expanded" title="Click to see more about this dataset">\r\n\t\t\t<i class="fa pad-right fa-lg" ng-class="{\'fa-caret-down\':expanded,\'fa-caret-right\':(!expanded)}"></i>\r\n\t\t</button>\r\n\t\t<download-add item="doc" group="group"></download-add>\r\n\t\t<icsm-wms data="doc"></icsm-wms>\r\n\t\t<icsm-bbox data="doc" ng-if="doc.showExtent"></icsm-bbox>\r\n\t\t<a href="https://ecat.ga.gov.au/geonetwork/srv/eng/search#!{{doc.primaryId}}" target="_blank" ><strong>{{doc.title}}</strong></a>\r\n\t</span>\r\n\t<span ng-class="{ellipsis:!expanded}" style="width:100%;display:inline-block;padding-right:15px;">\r\n\t\t{{doc.abstract}}\r\n\t</span>\r\n\t<div ng-show="expanded" style="padding-bottom: 5px;">\r\n\t\t<h5>Keywords</h5>\r\n\t\t<div>\r\n\t\t\t<span class="badge" ng-repeat="keyword in doc.keywords track by $index">{{keyword}}</span>\r\n\t\t</div>\r\n\t</div>\r\n</div>'),t.put("icsm/select/group.html",'<div class="panel panel-default" style="margin-bottom:-5px;" >\r\n\t<div class="panel-heading"><icsm-wms data="group"></icsm-wms> <strong>{{group.title}}</strong></div>\r\n\t<div class="panel-body">\r\n   \t\t<div ng-repeat="doc in group.docs">\r\n   \t\t\t<div select-doc doc="doc" group="group"></div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n'),t.put("icsm/select/select.html",'<div>\r\n\t<div style="position:relative;padding:5px;padding-left:10px;" ng-controller="SelectCtrl as select" class="scrollPanel">\r\n\t\t<div class="panel panel-default" style="margin-bottom:-5px">\r\n  \t\t\t<div class="panel-heading">\r\n  \t\t\t\t<h3 class="panel-title">Available datasets</h3>\r\n  \t\t\t</div>\r\n  \t\t\t<div class="panel-body">\r\n\t\t\t\t<div ng-repeat="doc in select.data.response.docs" style="padding-bottom:7px">\r\n\t\t\t\t\t<div select-doc ng-if="doc.type == \'dataset\'" doc="doc"></div>\r\n\t\t\t\t\t<select-group ng-if="doc.type == \'group\'" group="doc"></select-group>\r\n\t\t\t\t</div>\r\n  \t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>'),t.put("icsm/side-panel/side-panel-left.html",'<div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" style="width: {{left.width}}px;" ng-class="{\'cbp-spmenu-open\': left.active}">\r\n    <a href="" title="Close panel" ng-click="closeLeft()" style="z-index: 1200">\r\n        <span class="glyphicon glyphicon-chevron-left pull-right"></span>\r\n    </a>\r\n    <div ng-show="left.active === \'legend\'" class="left-side-menu-container">\r\n        <legend url="\'img/AustralianTopogaphyLegend.png\'" title="\'Map Legend\'"></legend>\r\n    </div>\r\n</div>'),t.put("icsm/side-panel/side-panel-right.html",'<div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-right noPrint" ng-attr-style="width:{{right.width}}" ng-class="{\'cbp-spmenu-open\': right.active}">\r\n    <a href="" title="Close panel" ng-click="closePanel()" style="z-index: 1">\r\n        <span class="glyphicon glyphicon-chevron-right pull-left"></span>\r\n    </a>\r\n\r\n    <div class="right-side-menu-container" ng-show="right.active === \'download\'" icsm-view></div>\r\n    <div class="right-side-menu-container" ng-show="right.active === \'maps\'" icsm-maps></div>\r\n    <div class="right-side-menu-container" ng-show="right.active === \'glossary\'" icsm-glossary></div>\r\n    <div class="right-side-menu-container" ng-show="right.active === \'help\'" icsm-help></div>\r\n    <panel-close-on-event only-on="search" event-name="clear.button.fired"></panel-close-on-event>\r\n</div>\r\n'),t.put("icsm/splash/splash.html",'<div class="modal-header">\r\n   <h3 class="modal-title splash">Elevation - Foundation Spatial Data</h3>\r\n</div>\r\n<div class="modal-body" id="accept" ng-form exp-enter="accept()" icsm-splash-modal style="width: 100%; margin-left: auto; margin-right: auto;">\r\n\t<div>\r\n\t\t<p>\r\n\t\t\tHere you can download point cloud and elevation datasets sourced from jurisdictions.\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<a href="http://www.ga.gov.au/topographic-mapping/digital-elevation-data.html" target="_blank">Find out more on our Elevation page.</a>\r\n\t\t</p>\r\n\t\t<p>\r\n         Data can be downloaded at <strong>no charge</strong> but note that there is a <strong>15GB limit per request</strong> (please check the file size before you download your files).\r\n\t\t</p>\r\n\t\t<p>\r\n\t\t\t<a href="http://opentopo.sdsc.edu/gridsphere/gridsphere?cid=contributeframeportlet&gs_action=listTools" target="_blank">Click here for Free GIS Tools.</a>\r\n\t\t</p>\r\n      <h5>How to use</h5>\r\n      <p>\r\n         <ul>\r\n            <li>Pan and zoom the map to your area of interest,</li>\r\n            <li>Click on one of the "Select area by..." buttons to define your area of interest,\r\n               <ul>\r\n                  <li>\r\n                        <img style="height:26px;padding-right:10px" src="icsm/resources/img/draw_rectangle.png">Drawing a bounding box. On enabling, click on the map and drag diagonally. There is a limit of roughly 2 square degrees or 200 square km.\r\n                  </li>\r\n                  <li>\r\n                     <img style="height:26px;padding-right:10px" src="icsm/resources/img/draw_polygon.png">\r\n                     Drawing a polygon. On enabling, click on the map for each vertex, click on the first vertex to close the polygon. Don\'t do too many vertices, it will not afford you greater accuracy and will slow down your search.\r\n                  </li>\r\n                  <li>\r\n                     <i class="fa fa-keyboard-o fa-2x" style="padding-right:10px" aria-hidden="true"></i>\r\n                      Manually entering the minimum and maximum latitudes and longitudes. The same area restrictions apply to drawing the bounds.\r\n                  </li>\r\n               </ul>\r\n            </li>\r\n            <li>On drawing complete we will check for data within or very near your area of interest</li>\r\n            <li>If the list is large you can filter:\r\n               <ul>\r\n                  <li>Partial text match by typing in the filter field and/or</li>\r\n                  <li>You can restrict the display to either elevation (DEM) or point cloud file types</li>\r\n               </ul>\r\n            </li>\r\n            <li>Check against any file you would like to download. To reiterate, these files can be huge so take note of the file size before downloading</li>\r\n            <li>Review your selected datasets and submit.</li>\r\n            <li>An email will be sent to you with a link to all your data, zipped into a single file.</li>\r\n            <li>These files can be huge so take note of the file size before submitting or downloading</li>\r\n         </ul>\r\n      </p>\r\n      <h5>Hints</h5>\r\n      <p>\r\n         <ul>\r\n            <li>Hovering over many items will give you further information about the purpose of the item</li>\r\n            <li>Drawing a polyline allows you to measure distance along the polyline.</li>\r\n            <li>On completion on drawing a line the elevation along that line is plotted.</li>\r\n            <li>While the tool to draw your area of interest is enabled it is easiest to pan the map using the arrow keys.</li>\r\n            <li>There are many areas where there is no data though the coverage is improving all the time.</li\r\n         </ul>\r\n      </p>\r\n\t</div>\r\n   <div style="padding:30px; padding-top:0; padding-bottom:40px; width:100%">\r\n\t\t<div class="pull-right">\r\n\t\t  \t<button type="button" class="btn btn-primary" ng-model="seenSplash" ng-click="accept()" autofocus>Continue</button>\r\n\t\t</div>\r\n\t</div>\r\n</div>'),t.put("icsm/tempelevation/elevation.html",'<div class="container-full elevationContainer" ng-show="geometry"\n    style="background-color:white; opacity:0.9;padding:2px">\n    <div class="row">\n        <div class="col-md-4" mars-point-info>\n            <span class="graph-brand">{{config.xLabel}}</span>\n        </div>\n        <div class="col-md-8">\n            <div class="btn-toolbar pull-right" role="toolbar" style="margin-right: 3px;">\n                <div class="btn-group">\n                    <button type="button" class="btn btn-default" title="Close graphs" ng-click="close()">\n                        <i class="fa fa-times-circle" role="presentation" style="font-size:16px; color:black"></i>\n                    </button>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>\n'),t.put("icsm/themes/themes.html",'<div class="dropdown themesdropdown">\r\n  <button class="btn btn-default dropdown-toggle themescurrent" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">\r\n    Theme\r\n    <span class="caret"></span>\r\n  </button>\r\n  <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">\r\n    <li ng-repeat="item in themes">\r\n       <a href="#" title="{{item.title}}" ng-href="{{item.url}}" class="themesItemCompact">\r\n         <span class="icsm-icon" ng-class="item.className"></span>\r\n         <strong style="vertical-align:top;font-size:110%">{{item.label}}</strong>\r\n       </a>\r\n    </li>\r\n  </ul>\r\n</div>'),t.put("icsm/toolbar/toolbar.html",'<div class="elevation-toolbar noPrint">\r\n   <div class="toolBarContainer">\r\n      <div>\r\n         <ul class="left-toolbar-items">\r\n            <li>\r\n               <div class="btn-group searchBar" ng-show="root.whichSearch != \'region\'">\r\n                  <div class="input-group input-group-custom" geo-search>\r\n                     <input type="text" ng-autocomplete ng-model="values.from.description" options=\'{country:"au"}\'\r\n                        size="32" title="Select a locality to pan the map to." class="form-control" aria-label="...">\r\n                     <div class="input-group-btn">\r\n                        <button ng-click="zoom(false)"\r\n                           class="btn btn-default" title="Pan and potentially zoom to location.">\r\n                           <i class="fa fa-search"></i>\r\n                        </button>\r\n                     </div>\r\n                  </div>\r\n               </div>\r\n            </li>\r\n         </ul>\r\n         <ul class="right-toolbar-items">\r\n            <li coverage-toggle></li>\r\n            <li>\r\n               <panel-trigger panel-id="download" panel-width="590px" name="Download" default="default"\r\n                  icon-class="fa-list" title="Select an area of interest and select datasets for download">\r\n               </panel-trigger>\r\n            </li>\r\n            <li>\r\n               <panel-trigger panel-id="help" panel-width="590px" name="Help" icon-class="fa-question-circle-o"\r\n                  title="Show help"></panel-trigger>\r\n            </li>\r\n            <li>\r\n               <panel-trigger panel-id="glossary" panel-width="590px" name="Glossary" icon-class="fa-book"\r\n                  title="Show glossary"></panel-trigger>\r\n            </li>\r\n            <li reset-page></li>\r\n         </ul>\r\n      </div>\r\n   </div>\r\n</div>'),t.put("icsm/view/view.html",'<div class="container-fluid downloadPane">\r\n   <icsm-clip data="data.item"></icsm-clip>\r\n   <div class="list-container">\r\n      <icsm-list></icsm-list>\r\n   </div>\r\n   <div class="downloadCont" icsm-search-continue></div>\r\n</div>')}]);