!function(){"use strict";angular.module("indicators",[])}(),function(){"use strict";angular.module("indicators.template",[])}(),function(){"use strict";angular.module("underscore",[]).factory("underscore",["$window",function(t){return t._}])}(),function(){"use strict";angular.module("indicators.basket",[])}(),function(){"use strict";angular.module("indicators.map",[])}(),function(){"use strict";angular.module("filters",[])}(),function(){"use strict";angular.module("indicators.chart",[])}(),function(){"use strict";angular.module("indicators.search",[])}(),$(function(){"use strict";angular.module("indicators").factory("IndicatorFactory",["$http",function(t){function e(e){return void 0!==e?t.get("/api/indicators/visibility/"+e):t.get("/api/indicators")}function r(){return t.get("/api/indicators/geos")}function n(e,r,n){return t.get("/api/indicators/chart?geography="+e+"&concept="+r+"&adjustment="+(n||""))}return{fetchIndicators:e,fetchGeos:r,fetchChart:n}}])}()),$(function(){"use strict";angular.module("indicators.basket").factory("BasketFactory",["$http","$rootScope",function(t,e){function r(e){return t({method:"POST",url:"/store/cart_handler.ashx",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:$.param({cmd:6,pid:"m_"+e})}).then(a)}function n(e){return t({method:"POST",url:"/store/cart_handler.ashx",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:$.param({cmd:1,pid:"m_"+e})}).then(a)}function i(){return t.post("/account/cartcount")}function a(){return t.get("/api/basket").then(function(t){o.items=t.data.listItems,e.$broadcast("basket-retrieved")})}var o={addSeries:r,removeSeries:n,getItemCount:i,getItems:a,items:[{pid:"PPsI.IUSA"}]};return o}])}()),$(function(){"use strict";angular.module("indicators.basket").directive("basketItem",[function(){return{restrict:"E",scope:{mnemonic:"@",price:"@"},templateUrl:"basket/basketItem.html",controller:"BasketCtrl"}}])}()),$(function(){"use strict";angular.module("indicators.basket").directive("checkOut",[function(){return{restrict:"E",templateUrl:"basket/checkout.html",controller:"CheckoutCtrl"}}])}()),$(function(){"use strict";angular.module("indicators.search").directive("indicatorSearch",[function(){return{restrict:"E",templateUrl:"search/search.html",controller:"SearchCtrl"}}])}()),$(function(){"use strict";angular.module("filters").filter("hyphenate",[function(){return function(t){var e=/\s+/g;return t.replace(e,"-").trim()}}])}()),$(function(){"use strict";angular.module("filters").filter("pluck",["underscore",function(t){return function(e,r){return t.pluck(e,r)}}])}()),$(function(){"use strict";angular.module("filters").filter("splitTermsFilter",["$filter",function(t){return function(e,r,n,i){var a=/\./g;if(r=r||"",r=r.replace(a," "),void 0!==n&&r.length<n)return e;if(!r||0===r.length)return e;var o=r.split(" "),c=[];return o.forEach(function(r){if(r&&r.length)if(i){var n=t("filter")(e,r);e=n.length||!n.length&&!c.length?n:e,n.length&&c.push(r)}else e=t("filter")(e,r)}),e}}])}()),$(function(){"use strict";angular.module("filters").filter("startFrom",[function(){return function(t,e){return e=+e,e<0?input:t.slice(e)}}])}()),$(function(){"use strict";angular.module("filters").filter("unique",["$filter","underscore",function(t,e){return function(t,r,n){if(r===!1)return t;if((r||angular.isUndefined(r))&&angular.isArray(t)){var i=[],a=function(t){return angular.isObject(t)&&angular.isString(r)?t[r]:t};angular.forEach(t,function(t){for(var e=!1,r=0;r<i.length;r++)if(angular.equals(a(i[r]),a(t))){e=!0;break}e||i.push(t)}),t=i}return n&&(t=e.pluck(t,r)),t}}])}()),$(function(){"use strict";angular.module("filters").filter("visibility",["underscore",function(t){return function(e,r,n){return e=t.filter(e,function(t){var e=n?~t.concept.visibility:t.concept.visibility;return 0!=(e&r)})}}])}()),$(function(){"use strict";angular.module("indicators.basket").controller("BasketCtrl",["$scope","$filter","$rootScope","BasketFactory",function(t,e,r,n){function i(){t.price<o?t.listPrice=void 0:Number(t.price)===o?t.listPrice="Free<br/>":t.listPrice=t.price}function a(){var r=e("filter")(n.items,{pid:c}).length>0;r?t.button={styles:["btn-default"],text:"Remove From Cart",disabled:!1,action:l}:t.price<o?t.button={styles:["btn-danger"],text:"Not Available For Purchase",disabled:!0,action:function(){}}:t.button={styles:["btn-secondary","action-request","btn-buy"],text:"Add To Cart",disabled:!1,action:s}}var o=0,c=t.mnemonic,s=function(){n.addSeries(c).then(function(t){r.$broadcast("basket-modified")})},l=function(){n.removeSeries(c).then(function(t){r.$broadcast("basket-modified")})};t.$on("basket-retrieved",function(){a()}),n.getItems().then(function(){a(),i()})}])}()),$(function(){"use strict";angular.module("indicators.basket").controller("CheckoutCtrl",["$scope","BasketFactory",function(t,e){function r(){e.getItemCount().then(function(e){t.cartcount=e.data.count})}t.cartcount,t.$on("basket-modified",r),r()}])}()),$(function(){"use strict";angular.module("indicators.map").controller("WorldMapCtrl",["IndicatorFactory",function(t){t.fetchGeos().then(function(t){var e=t.data;$("#world").highcharts("Map",{title:{text:""},mapNavigation:{enabled:!0,buttonOptions:{verticalAlign:"bottom"}},chart:{backgroundColor:"#f2f2f2"},xAxis:{minPadding:.025},yAxis:{minPadding:.025},legend:{enabled:!1},tooltip:{borderWidth:0,shadow:!0,useHTML:!0,padding:10,headerFormat:void 0,pointFormat:'<span class="center sprite sprite-{point.flag}"></span><span>{point.title}</span>'},credits:{enabled:!1},series:[{color:"#B4B4B7",borderColor:"#999999",cursor:"pointer",data:e,mapData:Highcharts.maps["custom/world-highres"],joinBy:["iso-a3","geoCode"],dataLabels:{enabled:!0,formatter:function(){return this.point.name}},states:{hover:{color:"#0089C7"}},point:{events:{click:function(t){window.location="/"+t.point.url+"/indicators"}}}}]})})}])}()),$(function(){"use strict";angular.module("indicators.chart").controller("ChartCtrl",["IndicatorFactory","$window",function(t,e){var r=e.location.pathname.split("/");t.fetchChart(r[1],r[2],r[3]).then(function(t){var e=t.data;if(e.xAxisLabels.length>1){Highcharts.setOptions({lang:{thousandsSep:","}});Highcharts.chart("chart",{credits:{enabled:!1},chart:{zoomType:"xy"},title:{text:""},subtitle:{text:""},xAxis:[{categories:e.xAxisLabels,crosshair:!0}],yAxis:[{minRange:3,labels:{format:"{value:,.0f}",style:{color:e.firstYAxis.color}},title:{text:e.firstYAxis.title,style:{color:e.firstYAxis.color}}},{minRange:3,title:{text:e.secondYAxis.title,style:{color:e.secondYAxis.color}},labels:{format:"{value}%",style:{color:e.secondYAxis.color}},opposite:!0}],tooltip:{shared:!0},legend:{enabled:!1,layout:"vertical",align:"left",x:580,verticalAlign:"top",y:50,floating:!0,backgroundColor:Highcharts.theme&&Highcharts.theme.legendBackgroundColor||"#FFFFFF"},series:[{color:e.secondYAxis.color,name:e.secondYAxis.title,type:e.secondYAxis.type,data:e.secondYAxis.values,yAxis:1,tooltip:{valueSuffix:e.secondYAxis.Unit}},{negativeColor:"#be0f34",color:e.firstYAxis.color,connectNulls:!0,zoneAxis:"x",zones:e.zones,name:e.firstYAxis.unit,type:e.firstYAxis.type,data:e.firstYAxis.values,tooltip:{valueSuffix:""}}]})}})}])}()),$(function(){"use strict";angular.module("indicators.search").controller("SearchCtrl",["$scope","$filter","$window","underscore","IndicatorFactory",function(t,e,r,n,i){var a=[],o=[];t.indicators=[],t.geos=[],t.concepts=[];var c={NOWHERE:0,MENU:1,CONCEPT:2,GEOGRAPHY:4,INDICATOR:8,RELATED:16,CALENDAR:32};c.LOW=c.RELATED|c.INDICATOR,c.EVERYWHERE=~c.NOWHERE,t.range=function(t,e){var r,n;for(r=[],e||(e=t,t=0),n=t;n<e;n++)r.push(n);return r},i.fetchIndicators(c.EVERYWHERE).then(function(i){var s=n.chain(i.data).map(function(t){return n.omit(t,"free","chartTemplate")}).value();t.visibility=c,t.indicators=s,a=n.chain(s).pluck("geography").value(),o=n.chain(s).pluck("concept").filter(function(t){return 0!=(t.visibility&c.CONCEPT)}).value(),t.geos=e("unique")(a,"geoCode"),t.concepts=e("unique")(o,"mnemonic"),t.googleSearch=function(t,e){var n=13;void 0==e?r.location="/indicators/search?q="+t:e.keyCode===n&&(r.location="/indicators/search?q="+t)}})}])}()),function(){"use strict";angular.module("indicatorApp",["indicators","indicators.template","indicators.search","indicators.basket","indicators.chart","indicators.map","filters","ngSanitize","underscore"])}(),angular.module("indicators.template").run(["$templateCache",function(t){t.put("basket/basketItem.html",'<a title="{{button.text}}" href="javascript:void(0)" ng-click="button.action()" class="pull-right btn" ng-disabled="button.disabled" ng-class="button.styles">\r\n    <span ng-switch="price <= 0">\r\n        <span ng-switch-when="true" ng-bind-html="listPrice"></span>\r\n        <span ng-switch-when="false">{{listPrice | currency : \'$\': 2}}<br></span>\r\n    </span>\r\n    {{button.text}}\r\n</a>\r\n'),t.put("basket/checkout.html",'<a href="/store/checkout-cart.aspx" title="Check Out" ng-if="cartcount > 0" class="btn btn-default" style="color:black;margin-top:10px">\r\n\r\n    <span class="h5" ng-bind-html="cartcount">\r\n    </span> Item(s) <br class="hidden-xs">\r\n    <i class="fa fa-shopping-cart"></i>\r\n    <span class="hidden-xs">View Cart</span>\r\n</a>'),t.put("search/search.html",'<div>\r\n    <div class="search row visible-xs visible-sm">\r\n        <div class="col-xs-1"></div>\r\n        <div class="col-xs-11">\r\n            <div class="row">\r\n                <div class="search-input-group">\r\n\r\n                    <input ng-model="searchTerm" type="search" class="form-control-search" placeholder="What are you looking for?" ng-keyup="googleSearch(searchTerm, $event)" id="searchBox">\r\n                    <div><a ng-click="googleSearch(searchTerm)" class="btn btn-secondary form-btn-search"><i class="fa fa-search fa-lg"></i></a></div>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <div id="search" class="search-hidden visible-lg visible-md">\r\n        <a href="#" class="search-link pull-right hidden-xs" style="font-size:48px; display:block;color:#1e1d1e;padding-right:30px">&times;</a>\r\n        <div class="search row">\r\n            <div class="col-md-3"></div>\r\n            <div class="col-md-6">\r\n                <div class="row">\r\n                    <div class="search-input-group">\r\n\r\n                        <input ng-model="searchTerm" type="search" class="form-control-search" placeholder="What are you looking for?" ng-keyup="googleSearch(searchTerm, $event)" id="searchBox">\r\n                        <div><a ng-click="googleSearch(searchTerm)" class="btn btn-secondary form-btn-search"><i class="fa fa-search fa-lg"></i></a></div>\r\n                    </div>\r\n                </div>\r\n\r\n                <div class="row">\r\n\r\n                    <!-- Countries per search Term-->\r\n                    <div class="col-md-12" ng-show="searchTerm && gView.length > 1">\r\n                        <div class="row">\r\n                            <div class="col-md-12 h4">Countries</div>\r\n                            <div id="onne" class="col-md-3 col-sm-4 col-xs-6" style="padding-bottom:5px" ng-repeat="geo in gView = (geos | splitTermsFilter:searchTerm) | orderBy : [\'rank\',\'title\'] track by geo.geoCode">\r\n                                <a title="{{geo.title}}" href="/{{geo.titleURL}}/indicators">\r\n                                    <i class="sprite sprite-{{geo.geoCode}}"></i>\r\n                                    {{geo.title}}\r\n                                </a>\r\n                            </div>\r\n                        </div>\r\n                    </div>\r\n                    <br>\r\n\r\n                    <!-- Indicators per search Term-->\r\n                    <div class="col-md-12" ng-show="searchTerm && cView.length > 1 ">\r\n                        <div class="row">\r\n                            <div class="col-md-12 h4">Indicators</div>\r\n                            <div class="col-md-3 col-xs-6" style="padding-bottom:5px" ng-repeat="con in cView =(concepts | splitTermsFilter:searchTerm) | orderBy : \'title\' track by con.mnemonic">\r\n                                <a title="{{con.title}}" href="/indicators/{{con.titleURL}}">{{con.title}}</a>\r\n                            </div>\r\n                        </div>\r\n                    </div>\r\n\r\n                    <!-- Indicators per  Geography per Search Term-->\r\n                    <div class="col-md-12" ng-if="searchTerm && !cView.length && !gView.length">\r\n                        <span ng-show="!iView.length" class="h4">&nbsp;</span>\r\n                        <div class="row" style="padding: 10px 0" ng-repeat="geo in iView = (indicators | splitTermsFilter:searchTerm:undefined:true) | pluck : \'geography\' | unique : \'geoCode\' | orderBy : [\'rank\',\'title\'] | limitTo : 20 track by geo.geoCode">\r\n                            <div class="col-md-3">\r\n                                <table>\r\n                                    <tr>\r\n                                        <th class="sprite sprite-{{geo.geoCode}}"></th>\r\n                                        <th class="h4">{{geo.title}}</th>\r\n                                    </tr>\r\n                                </table><br>\r\n                            </div>\r\n                            <div class="col-md-9">\r\n                                <div class="row" ng-repeat="con in iView | filter : geo.title | pluck : \'concept\' | unique : \'category\' ">\r\n\r\n                                    <h5>{{con.category| uppercase}}</h5>\r\n\r\n                                    <div class="col-sm-6" style="padding-bottom:5px" ng-repeat="ind in anyIndicators = ( iView | filter : geo.title | visibility: visibility.CONCEPT | filter : {concept: {category: con.category}} ) track by $index">\r\n                                        <a title="{{ind.geography.title}}: {{ind.concept.title}}" href="/{{ind.geography.titleURL}}/{{ind.concept.titleURL}}">\r\n                                            {{ind.concept.title}}\r\n                                        </a>\r\n                                    </div>\r\n                                    <!--<div class="col-sm-6" style="padding-bottom:5px;"\r\n                                           ng-repeat="cat in anyCategories= (iView | filter :{ geography: {title: geo.title}} | visibility: visibility.CONCEPT:true | filter : {concept: {category: con.category}} | pluck : \'concept\' | unique: \'subCategory\')  track by $index">\r\n                                        <a title="{{geo.title}}: {{cat.subCategory}}" href="/{{geo.titleURL}}/{{cat.category | hyphenate | lowercase}}/{{cat.subCategoryURL}}">\r\n                                            {{cat.subCategory}}\r\n                                        </a>\r\n                                    </div>-->\r\n                                </div>\r\n                            </div>\r\n                        </div>\r\n                    </div>\r\n\r\n                    <!-- Concepts for a particular geography per search term-->\r\n                    <div class="col-md-12" ng-if="searchTerm && (gView.length <=1)">\r\n                        <div ng-repeat="geo in gView | orderBy : \'rank\' | limitTo : 20">\r\n                            <table>\r\n                                <tr>\r\n                                    <th class="sprite sprite-{{geo.geoCode}}"></th>\r\n                                    <th class="h4"><a title="{{geo.title}} Indicators" href="/{{geo.titleURL}}/indicators">{{geo.title}}</a></th>\r\n                                </tr>\r\n                            </table><br>\r\n                            <div class="row" ng-repeat="con in xView = (indicators | splitTermsFilter:searchTerm:undefined:true | filter : geo.geoCode) | filter : geo.title | pluck : \'concept\' | unique : \'category\'">\r\n                                <div class="col-md-12">\r\n\r\n                                    <h5>{{con.category| uppercase}}</h5>\r\n\r\n                                </div>\r\n                                <div class="col-md-4" style="padding-bottom:5px" ng-repeat="ind in anyIndicators = (xView | visibility: visibility.CONCEPT | filter : {concept: {category: con.category}} | orderBy : \'concept.title\') track by $index">\r\n                                    <a title="{{ind.geography.title}}: {{ind.concept.title}}" href="/{{ind.geography.titleURL}}/{{ind.concept.titleURL}}">\r\n                                        {{ind.concept.title}}\r\n                                    </a>\r\n                                </div>\r\n                                <!--<div class="col-sm-4" style="padding-bottom:5px;"\r\n                                       ng-repeat="cat in anyCategories= (xView | visibility: visibility.CONCEPT: true | filter : {concept: {category: con.category}}  | pluck : \'concept\' | unique: \'subCategory\')  track by $index">\r\n                                    <a title="{{geo.title}}: {{cat.subCategory}}" href="/{{geo.titleURL}}/{{cat.category | hyphenate | lowercase}}/{{cat.subCategoryURL}}">\r\n                                        {{cat.subCategory}}\r\n                                    </a>\r\n                                </div>-->\r\n                            </div>\r\n                        </div>\r\n                    </div>\r\n\r\n                    <!-- Geographies for a particular concept per Search Term -->\r\n                    <div class="col-md-12" ng-if="searchTerm && (cView.length <=1)">\r\n                        <ul class="list-unstyled" ng-repeat="concept in cView">\r\n                            <li class="h4"><a title="{{concept.title}}" href="/indicators/{{concept.titleURL}}">{{concept.title}}</a></li>\r\n                            <li>\r\n                                <div class="row">\r\n                                    <div class="col-md-3 col-sm-4 col-xs-6" ng-repeat="ind in indicators | splitTermsFilter:searchTerm :undefined:true | filter: concept.mnemonic :true | visibility: visibility.CONCEPT  | orderBy : [\'geography.rank\',\'geography.title\'] track by ind.concept.mnemonic + ind.geography.geoCode ">\r\n                                        <a title="{{ind.geography.title}}: {{ind.concept.title}}" href="/{{ind.geography.titleURL}}/{{ind.concept.titleURL}}">\r\n                                            {{ind.geography.title}}\r\n                                        </a>\r\n                                    </div>\r\n                                </div>\r\n                            </li>\r\n                        </ul>\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <div class="col-md-3"></div>\r\n        </div>\r\n    </div>\r\n</div>')}]);
