PageSourceSearch

https://www.worldpolicycenter.org/modules/custom/wpc_angularjs_app/dist/scripts/scripts.e260e735.js

js worldpolicycenter.org collected 2026-10-02 03:56:32 UTC 299,957 bytes, 1 lines download raw bytes

1window.$clamp=function(n,e){e=e||{};var o,i=window,s={clamp:e.clamp||2,useNativeClamp:void 0===e.useNativeClamp||e.useNativeClamp,splitOnChars:e.splitOnChars||[".","-","–","—"," "],animate:e.animate||!1,truncationChar:e.truncationChar||"…",truncationHTML:e.truncationHTML},t=n.style,a=n.innerHTML,r=void 0!==n.style.webkitLineClamp,l=s.clamp,e=l.indexOf&&(-1<l.indexOf("px")||-1<l.indexOf("em"));function c(e,t){return i.getComputedStyle||(i.getComputedStyle=function(i,e){return this.el=i,this.getPropertyValue=function(e){var t=/(\-([a-z]){1})/g;return t.test(e="float"==e?"styleFloat":e)&&(e=e.replace(t,function(){return arguments[2].toUpperCase()})),i.currentStyle&&i.currentStyle[e]?i.currentStyle[e]:null},this}),i.getComputedStyle(e,null).getPropertyValue(t)}function u(e){var t=e||n.clientHeight,e=d(n);return Math.max(Math.floor(t/e),0)}function d(e){var t=c(e,"line-height");return"normal"==t&&(t=1.2*parseInt(c(e,"font-size"))),parseInt(t)}s.truncationHTML&&((o=document.createElement("span")).innerHTML=s.truncationHTML);var p,h,g,m=s.splitOnChars.slice(0),f=m[0];function v(e){return e.lastChild.children&&0<e.lastChild.children.length?v(Array.prototype.slice.call(e.children).pop()):e.lastChild&&e.lastChild.nodeValue&&""!=e.lastChild.nodeValue&&e.lastChild.nodeValue!=s.truncationChar?e.lastChild:(e.lastChild.parentNode.removeChild(e.lastChild),v(n))}function y(e,t){if(t){var i=e.nodeValue.replace(s.truncationChar,"");if(p||(f=0<m.length?m.shift():"",p=i.split(f)),1<p.length?(h=p.pop(),b(e,p.join(f))):p=null,o&&(e.nodeValue=e.nodeValue.replace(s.truncationChar,""),n.innerHTML=e.nodeValue+" "+o.innerHTML+s.truncationChar),p){if(n.clientHeight<=t){if(!(0<=m.length&&""!=f))return n.innerHTML;b(e,p.join(f)+f+h),p=null}}else""==f&&(b(e,""),e=v(n),m=s.splitOnChars.slice(0),f=m[0],h=p=null);if(!s.animate)return y(e,t);setTimeout(function(){y(e,t)},!0===s.animate?10:s.animate)}}function b(e,t){e.nodeValue=t+s.truncationChar}return"auto"==l?l=u():e&&(l=u(parseInt(l))),r&&s.useNativeClamp?(t.overflow="hidden",t.textOverflow="ellipsis",t.webkitBoxOrient="vertical",t.display="-webkit-box",t.webkitLineClamp=l,e&&(t.height=s.clamp+"px")):(l=(t=l,d(n)*t))<=n.clientHeight&&(g=y(v(n),l)),{original:a,clamped:g}},angular.module("worldPolicyForumApp",["ngAnimate","ngCookies","ngResource","ngSanitize","ngTagsInput","ngTouch","ui.bootstrap","ui.router","toggle-switch","middle","vcRecaptcha","socialLinks","matchmedia-ng","chart.js","angular-click-outside"]).config(["ChartJsProvider",function(e){e.setOptions("Bar",{scaleLabel:"<%if(value>1000000000){%><%=value/1000000000%>B<%}else if(value>1000000){%><%=value/1000000%>M<%}else if(value>1000){%><%=value/1000%>K<%}else{%><%=value%><%}%>",scaleBeginAtZero:!0,scaleFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:12,maintainAspectRatio:!1,legendTemplate:'<%if(datasets[0].label){%><ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul><%}%>',customTooltips:function(e){var t=$("#chartjs-tooltip");if(t.length||($("body").append('<div id="chartjs-tooltip"></div>'),t=$("#chartjs-tooltip")),e){t.removeClass("above below"),t.addClass(e.yAlign);var i="";if(void 0!==e.text)var n=e.text.split(": "),i=['<div class="chartjs-tooltip-section" style="text-align: center">',' <span class="chartjs-tooltip-value"><b>'+n[0]+"</b><br>"+n[1]+"%</span>","</div>"].join("");else{i+='<div style="font-weight: bold">'+e.title+"</div>";for(var o=0;o<e.labels.length;o++){var s=e.labels[o].split(":"),a=function(t,e){if(/\%/.test(t))return t;var i=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"B"},{value:1e12,symbol:"T"},{value:1e15,symbol:"P"},{value:1e18,symbol:"E"}].slice().reverse().find(function(e){return t>=e.value});return i?(t/i.value).toFixed(e).replace(/\.0+$|(\.[0-9]*[1-9])0+$/,"$1")+i.symbol:"0"}
1(s[1],1),a=s[0]+" "+a;i+=['<div class="chartjs-tooltip-section">',' <span class="chartjs-tooltip-key" style="background-color:'+e.legendColors[o].fill+'"></span>',' <span class="chartjs-tooltip-value">'+a+"</span>","</div>"].join("")}}t.html(i);n=$(e.chart.canvas).offset();$(window).width()<450?t.css({opacity:1,left:n.left+50+"px",top:n.top+e.y+"px",fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle}):t.css({opacity:1,left:n.left+e.x+"px",top:n.top+e.y+"px",fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle})}else t.css({opacity:0})}}),e.setOptions("Line",{scaleOverride:!0,scaleSteps:10,scaleStepWidth:10,scaleStartValue:0,bezierCurve:!1,multiTooltipTemplate:"<%= value %>%",scaleLabel:"<%=value%>%",scaleBeginAtZero:!0,scaleFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:12,maintainAspectRatio:!1,legendTemplate:'<%if(datasets[0].label){%><ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul><%}%>',customTooltips:function(e){var t,i=$("#chartjs-tooltip");i.length||($("body").append('<div id="chartjs-tooltip"></div>'),i=$("#chartjs-tooltip")),e?(i.removeClass("above below"),i.addClass(e.yAlign),t=e.text.split(": "),i.html(['<div class="chartjs-tooltip-section" style="text-align: center">',' <span class="chartjs-tooltip-value"><b>'+t[0]+"</b><br>"+t[1]+"%</span>","</div>"].join("")),t=$(e.chart.canvas).offset(),i.css({opacity:1,left:t.left+e.x+"px",top:t.top+e.y+"px",fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle})):i.css({opacity:0})}});function t(e,arguments){Chart.types[e].prototype.draw.apply(this,arguments);var i=$(this.chart.canvas).closest(".chart-wrapper"),n=$(i).find(".chart-convas-wrapper");0==n.length&&(n=$('<div class="chart-convas-wrapper"></div>')),$(this.chart.canvas).parent()[0]!=n[0]&&$(this.chart.canvas).wrap(n);var t=$(this.chart.canvas).parent().find("chart-legend");t.length&&(e=$(i).find("chart-legend"),$(e).not(t).remove(),$(t).appendTo($(i).find(".chart-container")));var o=$(i).find(".chart-container > chart-legend");
1i.each(function(){var e=$(i).find(".x-axis"),t=$(i).find(".y-axis");1<e.length?($(e[1]).remove(),$(e[0]).clone().removeClass("notranslate").insertBefore(o).show()):e.length&&e.clone().removeClass("notranslate").insertBefore(o).show(),1<t.length?($(t[1]).remove(),$(t[0]).clone().removeClass("notranslate").insertBefore(n).show()):t.length&&t.clone().removeClass("notranslate").insertBefore(n).show()}.bind(this))}Chart.types.Bar=Chart.types.Bar.extend({buildScale:function(e){var i=this,e={templateString:this.options.Bar.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:e.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(e){var t,e=Chart.helpers.calculateScaleRange((t=[],i.eachBars(function(e){t.push(e.value)}),t),e,this.fontSize,this.beginAtZero,this.integersOnly);Chart.helpers.extend(this,e)},xLabels:e,font:Chart.helpers.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:!this.options.showScale&&this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&Chart.helpers.extend(e,{calculateYRange:Chart.helpers.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(e)},draw:function(){t.call(this,"Bar",arguments)}}),Chart.types.Line=Chart.types.Line.extend({draw:function(){t.call(this,"Line",arguments)}}),Chart.types.BarTruncateXLabels=Chart.types.Bar.extend({name:"BarTruncateXLabels",draw:function(){t.call(this,"BarTruncateXLabels",arguments)},makeScaleClass:function(){this._oldScaleClass=this.ScaleClass;this.ScaleClass=this._oldScaleClass.extend({draw:function(){var a=window.innerWidth<1e3?120:150,c=this.ctx,s=(this.endPoint-this.startPoint)/this.steps,r=Math.round(this.xScalePaddingLeft);this.display&&(c.fillStyle=this.textColor,c.font=this.font,Chart.helpers.each(this.yLabels,function(e,t){var i=this.endPoint-s*t,n=Math.round(i),o=this.showHorizontalLines;c.textAlign="right",c.textBaseline="middle",this.showLabels&&c.fillText(e,r-10,i),(o=0===t&&!o?!0:o)&&c.beginPath(),0<t?(c.lineWidth=this.gridLineWidth,c.strokeStyle=this.gridLineColor):(c.lineWidth=this.lineWidth,c.strokeStyle=this.lineColor),n+=Chart.helpers.aliasPixel(c.lineWidth),o&&(c.moveTo(r,n),c.lineTo(this.width,n),c.stroke(),c.closePath()),c.lineWidth=this.lineWidth,c.strokeStyle=this.lineColor,c.beginPath(),c.moveTo(r-5,n),c.lineTo(r,n),c.stroke(),c.closePath()},this),Chart.helpers.each(this.xLabels,function(e,t){var i=this.calculateX(t)+Chart.helpers.aliasPixel(this.lineWidth),n=this.calculateX(t-(this.offsetGridLines?.5:0))+Chart.helpers.aliasPixel(this.lineWidth),o=0<this.xLabelRotation,s=this.showVerticalLines;(s=0===t&&!s?!0:s)&&c.beginPath(),0<t?(c.lineWidth=this.gridLineWidth,c.strokeStyle=this.gridLineColor):(c.lineWidth=this.lineWidth,c.strokeStyle=this.lineColor),s&&(c.moveTo(n,this.endPoint),c.lineTo(n,this.startPoint-3),c.stroke(),c.closePath()),c.lineWidth=this.lineWidth,c.strokeStyle=this.lineColor,c.beginPath(),c.moveTo(n,this.endPoint),c.lineTo(n,this.endPoint+5),c.stroke(),c.closePath(),c.save(),c.translate(i,o?this.endPoint+12:this.endPoint-10),c.rotate(-1*Chart.helpers.radians(this.xLabelRotation)),c.font=this.font,c.textAlign=o?"right":"center",c.textBaseline=o?"middle":"top";!function(e,t,i,n,o){for(var s=e.split(" "),a="",r=0;r<s.length;r++){var l=a+s[r]+" ";n<c.measureText(l).width&&0<r?(c.fillText(a,t,i),a=s[r]+" ",i+=o):a=l}c.fillText(a,t,i)}
1(e,0,15,a,12),c.restore()},this))},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-3.5*this.fontSize-15:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var e,t=this.endPoint-this.startPoint;this.calculateYRange(t),this.buildYLabels();var i=function(){var e=window.innerWidth<1e3?120:150;this.ctx.font=this.font;var t=e,i=e;if(this.xScalePaddingRight=i/2+3,this.xScalePaddingLeft=this.yLabelWidth+10,this.xLabelRotation=0,this.display){var n,o=30+e;this.xLabelWidth=o;for(var s=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>s&&0===this.xLabelRotation||this.xLabelWidth>s&&this.xLabelRotation<=90&&0<this.xLabelRotation;)n=Math.cos(Chart.helpers.radians(this.xLabelRotation)),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;0<this.xLabelRotation&&(this.endPoint-=Math.sin(Chart.helpers.radians(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding}.bind(this);for(i();t>this.endPoint-this.startPoint;)t=this.endPoint-this.startPoint,e=this.yLabelWidth,this.calculateYRange(t),this.buildYLabels(),e<this.yLabelWidth&&i()}})},buildScale:function(){return this.makeScaleClass(),Chart.types.Bar.prototype.buildScale.apply(this,arguments)}}),e.setOptions("BarTruncateXLabels",{scaleLabel:"<%if(value>1000000000){%><%=value/1000000000%>B<%}else if(value>1000000){%><%=value/1000000%>M<%}else if(value>1000){%><%=value/1000%>K<%}else{%><%=value%><%}%>",scaleBeginAtZero:!0,scaleFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontFamily:"'Lato', 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:12,maintainAspectRatio:!1,legendTemplate:'<%if(datasets[0].label){%><ul class="bar-legend <%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul><%}%>',customTooltips:function(e){var t=$("#chartjs-tooltip");if(t.length||($("body").append('<div id="chartjs-tooltip"></div>'),t=$("#chartjs-tooltip")),e){t.removeClass("above below"),t.addClass(e.yAlign);var i="";if(void 0!==e.text)var n=e.text.split(": "),i=['<div class="chartjs-tooltip-section" style="text-align: center">',' <span class="chartjs-tooltip-value"><b>'+n[0]+"</b><br>"+n[1]+"%</span>","</div>"].join("");else{i+='<div style="font-weight: bold">'+e.title+"</div>";for(var o=0;o<e.labels.length;o++){var s=e.labels[o].split(": "),a=function(t,e){if(/\%/.test(t))return t;var i=[{value:1,symbol:""},{value:1e3,symbol:"k"},{value:1e6,symbol:"M"},{value:1e9,symbol:"B"},{value:1e12,symbol:"T"},{value:1e15,symbol:"P"},{value:1e18,symbol:"E"}].slice().reverse().find(function(e){return t>=e.value});return i?(t/i.value).toFixed(e).replace(/\.0+$|(\.[0-9]*[1-9])0+$/,"$1")+i.symbol:"0"}(s[1],1),a=s[0]+" "+a;i+=['<div class="chartjs-tooltip-section">',' <span class="chartjs-tooltip-key" style="background-color:'+e.legendColors[o].fill+'"></span>',' <span class="chartjs-tooltip-value">'+a+"</span>","</div>"].join("")}}t.html(i);n=$(e.chart.canvas).offset();$(window).width()<450?t.css({opacity:1,left:n.left+50+"px",top:n.top+e.y+"px",fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle}):t.css({opacity:1,left:n.left+e.x+"px",top:n.top+e.y+"px",fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle})}else t.css({opacity:0})}})}]).config(["$stateProvider","$urlRouterProvider","$locationProvider","$sceDelegateProvider","configs",function(e,t,i,n,o){n.resourceUrlWhitelist(["self","http://d3kdz30gfbuqra.cloudfront.net/views/**"]),i.html5Mode({enabled:!0,requireBase:!1}),t.when("/maps-data","/maps-data/overview").when("/news/28-02-2015_cedaw-and-beijing-20","/").when("/news/28-02-2015_no-ceilings","/").when("/news/28-02-2015_crc-at-25","/global-agreements/crc-25th-anniversary").when(/index.html?/,"/").otherwise("/"),e.state("404",{url:"/404",templateUrl:o.env.APP_PATH+"/views/404.html",pageTitle:"404",params:{showSearchBar:!1,showHeader:!0,showFooter:!0}}).state("index",{url:"/",templateUrl:o.env.APP_PATH+"/views/main.html",controller:"MainCtrl",controllerAs:"mainController",pageTitle:"",params:{showSearchBar:!0,showHeader:!0,showFooter:!0,mode:"home"}}).state("index.comparecountries",{url:"compare-countries",pageTitle:"Compare Countries",params:{showSearchBar:!1,showHeader:!0,showFooter:!0,mode:"country"}}).state("topic",{url:"/topics/:topic",templateUrl:o.env.APP_PATH+"/views/topic.html",controller:"TopicCtrl",controllerAs:"topicController",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("topic.policies",{url:"/policies",templateUrl:o.env.APP_PATH+"/views/topic-
1policies.html",controller:"TopicPoliciesController",controllerAs:"topicPoliciesController",params:{tab:"policies"}}).state("topic.resources",{url:"/resources",templateUrl:o.env.APP_PATH+"/views/topic-resources.html",controller:"TopicResourcesController",controllerAs:"topicResourcesController",params:{tab:"resources"},resolve:{pages:["$stateParams","api",function(e,t){return t.getTopicResources(e.topic)}]}}).state("topic.resources.resource",{url:"/:resource"}).state("topic.resources.resource.page",{url:"/:page"}).state("topic.resources.resource.page.subpage",{url:"/:subpage"}).state("topic.methods",{url:"/methods",templateUrl:o.env.APP_PATH+"/views/topic-methods.html",controller:"TopicMethodsController",controllerAs:"topicMethodsController",params:{tab:"methods"}}).state("topic.global-agreements",{url:"/global-agreements",templateUrl:o.env.APP_PATH+"/views/topic-global-agreements.html",params:{tab:"global-agreements"}}).state("topic.rankings",{url:"/rankings",templateUrl:o.env.APP_PATH+"/views/topic-rankings.html",controller:"TopicRankingsController",controllerAs:"topicRankingsController",params:{tab:"rankings"}}).state("topic.rankings.ranking",{template:"<ui-view/>",url:"/:ranking"}).state("topic.rankings.ranking.embedded",{url:"/embedded",template:"<ui-view/>",params:{embeddedVersion:!0}}).state("topic.subtopic",{url:"/:subtopic",template:"<ui-view/>"}).state("topic.subtopic.policies",{url:"/policies",templateUrl:o.env.APP_PATH+"/views/topic-policies.html",controller:"TopicPoliciesController",controllerAs:"topicPoliciesController",params:{tab:"policies"}}).state("topic.subtopic.resources",{url:"/resources",templateUrl:o.env.APP_PATH+"/views/topic-resources.html",controller:"TopicResourcesController",controllerAs:"topicResourcesController",params:{tab:"resources"}}).state("topic.subtopic.resources.resource",{url:"/:resource"}).state("topic.subtopic.resources.resource.file",{url:"/:file"}).state("topic.subtopic.methods",{url:"/methods",templateUrl:o.env.APP_PATH+"/views/topic-methods.html",controller:"TopicMethodsController",controllerAs:"topicMethodsController",params:{tab:"methods"}}).state("topic.subtopic.global-agreements",{url:"/global-agreements",templateUrl:o.env.APP_PATH+"/views/topic-global-agreements.html",controller:"TopicGlobalAgreementsController",controllerAs:"topicGlobalAgreementsController",params:{tab:"global-agreements"}}).state("topic.subtopic.global-agreements.agreement",{url:"/:agreement"}).state("topic.subtopic.global-agreements.agreement.topic-agreement",{url:"/:topicAgreement"}).state("topic.subtopic.global-agreements.agreement.topic-agreement.policy",{url:"/:policy"}).state("topic.subtopic.rankings",{url:"/rankings",templateUrl:o.env.APP_PATH+"/views/topic-rankings.html",controller:"TopicRankingsController",controllerAs:"topicRankingsController",params:{tab:"rankings"}}).state("policy",{url:"/policies/:policy?filter",templateUrl:o.env.APP_PATH+"/views/policy.html",controller:"PolicyCtrl",controllerAs:"policyController",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("policy.subpolicy",{url:"/:subpolicy"}).state("compare-policies",{url:"/compare-policies",templateUrl:o.env.APP_PATH+"/views/compare-policies.html",controller:"ComparePoliciesCtrl",controllerAs:"comparePoliciesController",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("embedded-policy",{url:"/embedded/policies/:policy",templateUrl:o.env.APP_PATH+"/views/policy.html",controller:"PolicyCtrl",controllerAs:"policyController",params:{showSearchBar:!1,showHeader:!1,embeddedVersion:!0,showFooter:!1}}).state("embedded-policy.subpolicy",{url:"/:subpolicy"}).state("country",{url:"/countries/:country",templateUrl:o.env.APP_PATH+"/views/country.html",controller:"CountryCtrl",controllerAs:"countryController",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("country.policies",{url:"/policies",templateUrl:o.env.APP_PATH+"/views/country-policies.html",controller:"CountryPoliciesController",controllerAs:"countryPoliciesController",params:{tab:"policies"}}).state("country.policies.topic",{url:"/:topic"}).state("country.policies.topic.subtopic",{url:"/:subtopic"}).state("country.global-agreements",{url:"/global-agreements",templateUrl:o.env.APP_PATH+"/views/country-global-agreements.html",controller:"CountryGlobalAgreementsController",controllerAs:"countryGlobalAgreementsController",params:{tab:"global-agreements"}}).state("country.global-agreements.agreement",{url:"/:agreement"}).state("country.global-agreements.agreement.topic-agreement",{url:"/:topicAgreement"}).state("country.global-agreements.agreement.topic-agreement.policy",{url:"/:policy"}).state("country.compare-countries",{url:"/compare-countries",templateUrl:o.env.APP_PATH+"/views/country-compare-countries.html",controller:"CountryCompareCountriesController",controllerAs:"countryCompareCountriesController",params:{tab:"compare-countries"}}).state("data-tables",{url:"/data-tables",templateUrl:o.env.APP_PATH+"/views/d
1ata-tables.html",controller:"DataTablesController",pageTitle:"Data Tables",params:{tab:"data-tables",showSearchBar:!0,showHeader:!0,showFooter:!0},resolve:{countries:["api",function(e){return e.getCountries()}],topics:["api",function(e){return e.getTopics()}]}}).state("data-tables.topic",{url:"/topic/:topic/:subtopic?",pageTitle:"Data Tables"}).state("data-tables.policy",{url:"/policy/:policy?second",pageTitle:"Data Tables"}).state("data-tables.policy.subnational",{url:"/subnational/:subnational",pageTitle:"Data Tables"}).state("country.rankings.topic",{url:"/:topic"}).state("methodology",{url:"/methodology",templateUrl:o.env.APP_PATH+"/views/methodology.html",controller:"MethodologyCtrl",controllerAs:"methodologyController",pageTitle:"Methodology",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("global-agreements",{url:"/global-agreements",templateUrl:o.env.APP_PATH+"/views/global-agreements.html",controller:"GlobalAgreementsCtrl",controllerAs:"globalAgreementsController",globalAgreements:"Global Agreements",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("global-agreements.agreement",{url:"/:agreement"}).state("global-agreements.agreement.topic-agreement",{url:"/:topic"}).state("global-agreements.agreement.topic-agreement.policy",{url:"/:policy"}).state("maps-data",{abstract:!0,url:"/maps-data",template:"<ui-view/>",pageTitle:"Maps & Data",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("maps-data.overview",{url:"/overview",templateUrl:o.env.APP_PATH+"/views/maps-data/overview.html",controller:"MapsDataOverviewCtrl",controllerAs:"mapsDataOverviewController",pageTitle:"Maps & Data"}).state("maps-data.global-maps",{url:"/global-maps",templateUrl:o.env.APP_PATH+"/views/maps-data/global-maps.html",controller:"MapsDataGlobalMapsCtrl",controllerAs:"mapsDataGlobaController",pageTitle:"Global Maps"}).state("maps-data.data-download",{url:"/data-download",templateUrl:o.env.APP_PATH+"/views/maps-data/data-download.html",controller:"MapsDataDataDownloadCtrl",controllerAs:"mapsDataDataDownloadController",pageTitle:"Data Download"}).state("maps-data.data-download.download",{url:"/:download"}).state("publications",{url:"/publications",templateUrl:o.env.APP_PATH+"/views/publications.html",controller:"PublicationsCtrl",controllerAs:"publicationsController",pageTitle:"Publications",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("publications.publication",{url:"/:publication"}).state("publications.publication.page",{url:"/:page"}).state("resources",{url:"/resources",templateUrl:o.env.APP_PATH+"/views/resources.html",controller:"ResourcesCtrl",controllerAs:"resourcesController",pageTitle:"Resources",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("resources.resource",{url:"/:resource"}).state("resources.resource.file",{url:"/:file"}).state("image-generator-rankings",{url:"/image-generator/topics/:topic/rankings/:ranking",templateUrl:o.env.APP_PATH+"/views/image-generator.html",controller:"ImageGeneratorCtrl",controllerAs:"imageGeneratorController",params:{showSearchBar:!1,showHeader:!1,showFooter:!1,subpolicySkipRedirect:!0,isRanking:!0}}).state("image-generator",{url:"/image-generator/:policyId",templateUrl:o.env.APP_PATH+"/views/image-generator.html",controller:"ImageGeneratorCtrl",controllerAs:"imageGeneratorController",params:{showSearchBar:!1,showHeader:!1,showFooter:!1,subpolicySkipRedirect:!0}}).state("cards",{url:"/equality-in-the-cards",templateUrl:o.env.APP_PATH+"/views/greeting-cards.html",controller:"GreetingCardsCtrl",controllerAs:"greetingCardsController",pageTitle:"Equality in the Cards",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("card",{url:"/card/:card/:slug",templateUrl:o.env.APP_PATH+"/views/greeting-card-detail.html",controller:"GreetingCardDetailCtrl",controllerAs:"greetingCardDetailController",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("events-launches",{url:"/events-launches",templateUrl:o.env.APP_PATH+"/views/events-launches.html",controller:"EventsLaunchesCtrl",controllerAs:"eventsLaunchesController",pageTitle:"Events & Launches",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("events-launches-events",{url:"/events-launches/{alias:.+}",templateUrl:o.env.APP_PATH+"/views/page.html",controller:"PageCtrl",controllerAs:"pageController",pageTitle:"Events & Launches",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("sitemap",{url:"/sitemap",templateUrl:o.env.APP_PATH+"/views/sitemap.html",controller:"SiteMapCtrl",controllerAs:"siteMapCtrl",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("section",{url:"/:section",templateUrl:o.env.APP_PATH+"/views/section.html",controller:"SectionCtrl",controllerAs:"sectionController",params:{showSearchBar:!0,showHeader:!0,showFooter:!0}}).state("section.pages",{url:"/:pages",templateUrl:o.env.APP_PATH+"/views/pages.html",controller:"PagesCtrl",controllerAs:"pagesController"}).state("section.pages.page",{url:"/:page"})}]).run(["configs","utils",function(e,t){for(var i=0;i<e.countries.length;i++){var n=e.countries[i];n.segment=angular.lowercase(n.name).replace(/\s/g,"-")}e.countrySegmentMap=t.createMap(e.countries,"segment"),e.countryIsoMap=t.createMap(e.countries,"iso"),e.countryNameMap=t.createMap(e.countries,"name")}]).run(["$rootScope","$anchorScroll","$document","$timeout",function(e,n,o,s){var a;e.$watch(function(){var e=window.location.hash;if(e===a)return!1;var t='[name="'+e.slice(1,e.length)+'"]',i=$(t),t=o.find("body");
10<i.length&&t&&t.scrollTop!==i.offset().top&&(a=e,s(n,100,!1))})}]).run(["analytics",function(e){e.init()}]).run(["$rootScope",function(e){e.currentYear=(new Date).getFullYear(),$(".copyright .year").text(e.currentYear)}]).run(["comparePolicies",function(e){e.init()}]),angular.module("worldPolicyForumApp").controller("MainCtrl",["$scope","$location","$log","$filter","$state","$anchorScroll","api","pageTitle",function(t,n,e,i,o,s,a,r){t.$location=n,t.$log=e,t.homepage=null,t.topics=null,t.$state=o,this.switchMode=function(e){o.current.params.mode!==e&&(o.transitionTo("country"===e?"index.comparecountries":"index"),"country"===e&&window.scrollTo(0,0))},this.navigateTo=function(e){var t,i;if(e.match(/^\//))return n.path(e),void window.scrollTo(0,0);try{t=new URL(e),i=new URL(window.location),t.host!==i.host&&(window.location.href=e)}catch(e){console.log(e)}},this.selectCountry=function(e){n.path("/countries/"+i("countryIdToSegment")(e))},o.params.showSearchBar=!1,a.getHomepage().then(function(e){t.homepage=e}),a.getTopics().then(function(e){t.topics=e}),r.set()}]),angular.module("worldPolicyForumApp").controller("AboutCtrl",["$scope",function(e){}]),angular.module("worldPolicyForumApp").controller("TopicCtrl",["$scope","$state","$location","$timeout","api","configs","pageTitle",function(i,t,e,n,o,s,a){i.showModal=!0,i.buttonClicked="",i.toggleModal=function(e){i.buttonClicked=e,i.showModal=!0},i.topicDetails=null,i.loading={detail:!0},i.selected={tab:t.params.tab},i.$watchGroup(["topicDetails","selected.tab"],function(){var e;0===t.current.name.indexOf("topic")&&i.topicDetails&&(e=i.topicDetails.name||i.topicDetails.title,"global-agreements"===i.selected.tab&&(e+=" - Global Agreements"),a.set(e))});var r,l=function(){i.selected.tab=t.params.tab}.bind(this),c=function(e){t.params.topic&&e!==t.params.tab&&(e=t.params.subtopic?"topic.subtopic."+e:"topic."+e,t.transitionTo(e,{},{location:void 0!==t.params.tab||"replace",inherit:!0}))}.bind(this);i.selected.tab||(i.selected.tab="policies"),i.$watch("selected.tab",c),r=t.params.topic,o.getTopicDetails(r).then(function(e){i.loading.detail=!1,i.topicDetails=e,i.$broadcast("topicDetailsLoaded");var t=e.tabs;e.rankings.length||t.splice(4,1),e.global_agreements.length||t.splice(3,1),e.methods||t.splice(2,1),e.resources.length||t.splice(1,1),i.tabs=t,i.$on("$stateChangeSuccess",l)})}]),angular.module("worldPolicyForumApp").service("comparePolicies",["$rootScope","$cookies",function(i,n){this.policiesIds=[],this.init=function(){this.policiesIds=n["compare-policies-ids"]?n["compare-policies-ids"].split(","):[]},this.canBeAddedToCompare=function(){return this.policiesIds.length<2},this.existsInCompare=function(e){return this.policiesIds.includes(e)},this.addToCompare=function(e){this.canBeAddedToCompare()&&(this.policiesIds.push(e),n["compare-policies-ids"]=this.policiesIds,i.$emit("comparePoliciesChanged",this.policiesIds))},this.removeFromCompare=function(t){this.existsInCompare(t)&&(this.policiesIds=this.policiesIds.filter(e=>t!==e),n["compare-policies-ids"]=this.policiesIds,i.$emit("comparePoliciesChanged",this.policiesIds))},this.clearCompare=function(){this.policiesIds=[],n["compare-policies-ids"]=this.policiesIds,i.$emit("comparePoliciesChanged",this.policiesIds)},this.getPoliciesIdsForCompare=function(){return this.policiesIds}}]),angular.module("worldPolicyForumApp").controller("ComparePoliciesCtrl",["$scope","$state","$location","$q","api","utils","comparePolicies",function(i,e,t,n,o,s,a){i.policies=[];var r=function(e,t){e.forEach(e=>{l(t,e),i.policies.push(e)})},l=function(e,t){if(e&&t.countries){var i,n=s.createMap(t.countries,"iso"),o=s.createMap(e,"iso");for(i in n)$.extend(!0,n[i],o[i])}};i.goToDataTables=function(){e.go("data-tables.policy",{policy:i.policies[0].segment,second:i.policies[1].segment})},function(){let e=a.getPoliciesIdsForCompare(),t=[];t.push(o.comparePolicies(e).then(function(e){return e.data})),t.push(o.getCountries().then(function(e){return e})),n.all(t).then(function(e){r(e[0],e[1])})}()}]).directive("comparePolicyBlock",function(){return{restrict:"A",scope:!0,controllerAs:"comparePolicyBlockController",controller:["$scope","configs",function(r,t){r.selectedTab="map",r.tabs=[{id:"map",title:"Global Map"},{id:"chart",title:"Charts"}],r.graphs=[],r.selectedGraph=!1,r.selectedScale=null,r.selectedPercent={scale:!1},r.yAxisLabel="";function n(e,t){return e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),"rgba("+[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)].join(",")+","+t+")"}r.$watch("policy",function(e){e&&(r.graphs=[],r.selectedGraph=!1,r.selectedScale=!1,e.charts.length&&($.each(e.charts,function(e,i){i._data=[],i.label=i.name,i._series=[],i._colours=[],i.isChartMedia=!0,$.each(i.colours,function(e,t){i._colours.push({f
1illColor:n(t,"1"),pointColor:n(t,"1"),pointHighlightFill:"#fff",pointHighlightStroke:n(t,"0.8"),pointStrokeColor:"#fff",strokeColor:n(t,"0")})}),$.each(i.datasets,function(e,t){i._series.push(t.label),i._data.push(t.data)})}),r.graphs=e.charts),e.graphs.length&&($.each(e.graphs,function(e,i){i._colours=[],i._cbm_colours=[],i.isChartMedia=!1,$.each(i.colours,function(e,t){i._colours.push({fillColor:n(t,"1"),pointColor:n(t,"1"),pointHighlightFill:"#fff",pointHighlightStroke:n(t,"0.8"),pointStrokeColor:"#fff",strokeColor:n(t,"0")})}),$.each(i.cbm_colours,function(e,t){i._cbm_colours.push({fillColor:n(t,"1"),pointColor:n(t,"1"),pointHighlightFill:"#fff",pointHighlightStroke:n(t,"0.8"),pointStrokeColor:"#fff",strokeColor:n(t,"0")})})}),r.graphs=r.graphs.concat(e.graphs)),r.graphs.length&&(r.selectedGraph=r.graphs[0],r.selectedScale=r.selectedGraph.isChartMedia?null:r.selectedGraph.scales[0],o(),s()))}),r.barGraphType=function(e){return 30<i(e)?"BarTruncateXLabels":"Bar"},r.getGraphLabel=function(e){var t=r.policy,e=[t.name||t.title,e.label];return t.chart_alt_text&&e.push(t.chart_alt_text),e.join(", ")};var i=function(e){var t=0;if(e.options||(e.options={}),e.labels&&e.labels.length)for(var i=0;i<e.labels.length;i++)e.labels[i].length>t&&(t=e.labels[i].length);return t},o=function(){if(!r.selectedGraph.isChartMedia){let i=r.selectedScale.id,n=[],o=0;for(const e of r.selectedGraph.data){var s=e.total[i],a=e.count;for(let t=0;t<a.length;t++){void 0===n[t]&&(n[t]=[]);let e;e=r.selectedPercent.scale?(e=100*a[t][i]/s,i.match(/^(pop_)/)?Math.round(10*e)/10:Math.round(e)):a[t][i],e>o&&(o=e),n[t].push(e)}}if(r.selectedGraph=Object.assign({},r.selectedGraph,{graphData:n}),r.selectedPercent.scale)r.selectedGraph=Object.assign({},r.selectedGraph,{options:{scaleOverride:!0,scaleSteps:10,scaleStepWidth:10,scaleStartValue:0,scaleLabel:"<%=value%>%",multiTooltipTemplate:"<%=datasetLabel%>: <%= value %>%"}});else{var t=3*parseInt(o.toString().length/3,10);let e;e=t<=3?10*Math.ceil(o/10):o.toString().length===t?(parseInt(o/Math.pow(10,t-1),10)+1)*Math.pow(10,t-1):(parseInt(o/Math.pow(10,t),10)+1)*Math.pow(10,t),r.selectedGraph=Object.assign({},r.selectedGraph,{options:{scaleOverride:!0,scaleSteps:10,scaleStepWidth:parseInt(e/10),scaleStartValue:0,scaleLabel:"<%=value%>",multiTooltipTemplate:"<%=datasetLabel%>: <%= value %>"}})}}};r.selectGraph=function(e){r.selectedGraph=e,null===r.selectedScale&&(r.selectedScale=r.selectedGraph.scales[0]),o(),s()},r.selectScale=function(e){r.selectedScale=e,o(),s()},r.$watch("selectedScale",function(){e()});var e=function(){var e=r.selectedPercent.scale;const t=r.selectedScale;t&&(r.yAxisLabel=(e?"Percentage":"Number")+" of "+t.label.toLowerCase(),$(".y-axis span").text(r.yAxisLabel))};r.changePercentage=function(){e(),o()};var s=function(){var e;r.selectedGraph&&(e=r.selectedGraph,r.selectedGraph=Object.assign({},e,{_active_colours:t.colorBlind?e._cbm_colours:e._colours}))}}]}}),angular.module("worldPolicyForumApp").controller("PolicyCtrl",["$scope","$state","$q","$http","api","utils","settings","configs","pageTitle","comparePolicies",function(r,i,t,o,s,a,l,n,e,c){r.filter=void 0!==i.params.filter?i.params.filter:"",i.params.filter=null,r.embeddedVersion=void 0!==i.params.embeddedVersion,r.policyDetails=null,r.selected={policy:null},r.graphs=[],r.stuckToTop=null,r.compareIcon="add",r.compareText="Add Map to compare",r.relatedTopics=[],r.selectedSubnational=null,r.selectedDataset=null,r.selectedTab="map",r.tabs=[{id:"map",title:"Global Map",subtabs:[]},{id:"chart",title:"Charts"},{id:"table",title:"Tables",label:"Access Map Data in a Table"}],r.selectedPercent={scale:!1},r.yAxisLabel="";var u=this;r.$watch("selectedTab",function(e){"table"===e&&u.goToDataTable()}),r.$on("combinedIndexUpdate",function(){r.selectedTab="map"}),r.$watch("policyDetails",function(t){t&&(e.set(t.name||t.title),r.relatedTopics=t.related_topics.map(e=>e.name),"combined_policies"===t.sub_type&&(r.tabs=r.tabs.map(e=>("map"===e.id&&(e.subtabs=t.combined_policies.map(e=>({id:e.key,title:e.combined_variable,selected:e.segment===i.params.subpolicy}))),e))))}),r.$on("SelectSubtab",function(e,t,i){r.selectedDataset=r.policyDetails.combined_policies.findIndex(e=>e.key===i),r.$emit("combinedIndexUpdate",r.selectedDataset)}),r.$on("OnSelectedSubnational",function(e,t){r.selectedSubnational=t}),r.$on("$destroy",function(){$("#chartjs-tooltip").remove()}),r.$on("stickToTopStart",function(){r.stuckToTop=!0}),r.$on("stickToTopEnd",function(){r.stuckToTop=!1});var d=function(){if(!r.selectedGraph.isChartMedia){let i=r.selectedScale.id,n=[],o=0;for(const e of r.selectedGraph.data){var s=e.total[i],a=e.count;for(let t=0;t<a.length;t++){void 0===n[t]&&(n[t]=[]);let e;e=r.selectedPercent.scale?(e=100*a[t][i]/s,i.match(/^(pop_)/)?Math.round(10*e)/10:Math.round(e)):a[t][i],e>o&&(o=e),n[t].push(e)}}if(r.selectedGraph=Object.assign({},r.selectedGraph,{graphData:n}),r.selectedPercent.scale)r.selectedGraph=Object.assign({},r.selectedGraph,{options:{scaleOverride:!0,scaleSteps:10,scaleStepWidth:10,scaleStartValue:0,scaleLabel:"<%=value%>%",multiTooltipTemplate:"<%=datasetLabel%>: <%= value %>%"}});
1else{var t=3*parseInt(o.toString().length/3,10);let e;e=t<=3?10*Math.ceil(o/10):o.toString().length===t?(parseInt(o/Math.pow(10,t-1),10)+1)*Math.pow(10,t-1):(parseInt(o/Math.pow(10,t),10)+1)*Math.pow(10,t),r.selectedGraph=Object.assign({},r.selectedGraph,{options:{scaleOverride:!0,scaleSteps:10,scaleStepWidth:parseInt(e/10),scaleStartValue:0,scaleLabel:"<%if(value>1000000000){%><%=value/1000000000%>B<%}else if(value>1000000){%><%=value/1000000%>M<%}else if(value>1000){%><%=value/1000%>K<%}else{%><%=value%><%}%>",multiTooltipTemplate:"<%=datasetLabel%>: <%= value %>"}})}}},p=function(){var e;r.selectedGraph&&(e=r.selectedGraph,r.selectedGraph=Object.assign({},e,{_active_colours:n.colorBlind?e._cbm_colours:e._colours}))};r.getGraphLabel=function(e){var t=r.selected.policy,e=[t.name||t.title,e.label];return t.chart_alt_text&&e.push(t.chart_alt_text),e.join(", ")};r.barGraphType=function(e){return 30<function(e){var t=0;e.options||(e.options={});for(var i=0;i<e.labels.length;i++)e.labels[i].length>t&&(t=e.labels[i].length);return t}(e)?"BarTruncateXLabels":"Bar"},r.$watch("selectedScale",function(){h()});var h=function(){var e=r.selectedPercent.scale;const t=r.selectedScale;var i=r.selectedGraph;i&&"23"===i.id?r.yAxisLabel="":i&&"Trends over time"===i.name?(r.yAxisLabel="Number of Countries",t&&(r.yAxisLabel=(e?"Percentage":"Number")+" of Countries")):t&&(r.yAxisLabel=(e?"Percentage":"Number")+" of "+t.label.toLowerCase()),$(".y-axis span").text(r.yAxisLabel)};r.changePercentage=function(){h(),d()};var g=function(e,t){var i=[];if("combined_policies"===e.sub_type)for(const n of e.combined_policies)m(t,n),i.push(n.key);else m(t,e),i.push(e.key);r.policyDetails=e,r.policyDetails.excerpts={},o.get("/api/excerpts?policies="+i.join()).then(function(e){r.policyDetails.excerpts=e.data.data})},m=function(e,t){if(e&&t.countries){var i,n=a.createMap(t.countries,"iso"),o=a.createMap(e,"iso");for(i in n)$.extend(!0,n[i],o[i])}};this.isCombinedPolicies=function(){if(r.policyDetails)return"combined_policies"===r.policyDetails.sub_type},this.goToDataTable=function(){r.selectedSubnational?i.go("data-tables.policy.subnational",{policy:r.selected.policy.segment,subnational:r.selectedSubnational}):i.go("data-tables.policy",{policy:r.selected.policy.segment})},r.getDataTableUrl=function(){return r.policyDetails?"/data-tables/policy/"+r.selected.policy.segment:"#"},r.toggleCompare=function(){var e=r.selected.policy?r.selected.policy.key:0;!c.existsInCompare(e)&&r.isCompareAvailable()?(c.addToCompare(e),r.compareIcon="remove",r.compareText="Remove Map from compare"):(c.removeFromCompare(e),r.compareIcon="add",r.compareText="Add Map to compare")},r.isCompareAvailable=function(){var e=r.selected.policy?r.selected.policy.key:0;return c.canBeAddedToCompare()||c.existsInCompare(e)},function(){new IntersectionObserver(function(e){0===e[0].intersectionRatio?($(".sticky-title-bar").addClass("is-pinned"),$(".policy-title-normal, .add-to-compare").hide(),$(".policy-title-sticky").show(500)):1===e[0].intersectionRatio&&($(".sticky-title-bar").removeClass("is-pinned"),$(".policy-title-normal, .add-to-compare").show(500),$(".policy-title-sticky").hide())},{threshold:[0,1]}).observe(document.querySelector(".tabpanel.title")),$(document.body).scrollTop(0);function n(e,t){return e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),"rgba("+[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)].join(",")+","+t+")"}var e=[];i.params.topicAgreement?e.push(s.getTopicAgreementPolicy(i.params.policy).then(function(e){return e})):e.push(s.getPolicyDetails(i.params.policy,l.lastTopic).then(function(e){return e})),e.push(s.getCountries().then(function(e){return e})),t.all(e).then(function(e){g(e[0],e[1])}),r.selectGraph=function(e){r.selectedGraph=e,null===r.selectedScale&&(r.selectedScale=r.selectedGraph.scales[0]),d(),p(),h()},r.selectScale=function(e){r.selectedScale=e,d(),p()},r.$watch("selected.policy",function(e){e&&(r.compareIcon=c.existsInCompare(e.key)?"remove":"add",r.compareText=c.existsInCompare(e.key)?"Remove Map from compare":"Add Map to compare",r.graphs=[],r.selectedGraph=!1,r.selectedScale=!1,e.charts.length&&($.each(e.charts,function(e,i){i._data=[],i.label=i.name,i._series=[],i._colours=[],i.isChartMedia=!0,$.each(i.colours,function(e,t){i._colours.push({f
1illColor:n(t,"1"),pointColor:n(t,"1"),pointHighlightFill:"#fff",pointHighlightStroke:n(t,"0.8"),pointStrokeColor:"#fff",strokeColor:n(t,"0")})}),$.each(i.datasets,function(e,t){i._series.push(t.label),i._data.push(t.data)})}),r.graphs=e.charts),e.graphs.length&&($.each(e.graphs,function(e,i){i._colours=[],i._cbm_colours=[],i.isChartMedia=!1,$.each(i.colours,function(e,t){i._colours.push({fillColor:n(t,"1"),pointColor:n(t,"1"),pointHighlightFill:"#fff",pointHighlightStroke:n(t,"0.8"),pointStrokeColor:"#fff",strokeColor:n(t,"0")})}),$.each(i.cbm_colours,function(e,t){i._cbm_colours.push({fillColor:n(t,"1"),pointColor:n(t,"1"),pointHighlightFill:"#fff",pointHighlightStroke:n(t,"0.8"),pointStrokeColor:"#fff",strokeColor:n(t,"0")})})}),r.graphs=r.graphs.concat(e.graphs)),r.graphs.length&&(r.selectedGraph=r.graphs[0],r.selectedScale=r.selectedGraph.isChartMedia?null:r.selectedGraph.scales[0],d(),p()))})}()}]),function(l){l.extend(l.fn,{validate:function(e){if(this.length){var i=l.data(this[0],"validator");return i||(this.attr("novalidate","novalidate"),i=new l.validator(e,this[0]),l.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),l(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==l(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(t){function e(){var e;return!i.settings.submitHandler||(i.submitButton&&(e=l("<input type='hidden'/>").attr("name",i.submitButton.name).val(l(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,t),i.submitButton&&e.remove(),!1)}return i.settings.debug&&t.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,e()):i.form()?i.pendingRequest?!(i.formSubmitted=!0):e():(i.focusInvalid(),!1)})),i)}e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.")},valid:function(){if(l(this[0]).is("form"))return this.validate().form();var e=!0,t=l(this[0].form).validate();return this.each(function(){e=e&&t.element(this)}),e},removeAttrs:function(e){var i={},n=this;return l.each(e.split(/\s/),function(e,t){i[t]=n.attr(t),n.removeAttr(t)}),i},rules:function(e,t){var i=this[0];if(e){var n=l.data(i.form,"validator").settings,o=n.rules,s=l.validator.staticRules(i);switch(e){case"add":l.extend(s,l.validator.normalizeRule(t)),delete s.messages,o[i.name]=s,t.messages&&(n.messages[i.name]=l.extend(n.messages[i.name],t.messages));break;case"remove":if(!t)return delete o[i.name],s;var a={};return l.each(t.split(/\s/),function(e,t){a[t]=s[t],delete s[t]}),a}}var r=l.validator.normalizeRules(l.extend({},l.validator.classRules(i),l.validator.attributeRules(i),l.validator.dataRules(i),l.validator.staticRules(i)),i);return r.required&&(e=r.required,delete r.required,r=l.extend({required:e},r)),r}}),l.extend(l.expr[":"],{blank:function(e){return!l.trim(""+l(e).val())},filled:function(e){return!!l.trim(""+l(e).val())},unchecked:function(e){return!l(e).prop("checked")}}),l.validator=function(e,t){this.settings=l.extend(!0,{},l.validator.defaults,e),this.currentForm=t,this.init()},l.validator.format=function(i,e){return 1===arguments.length?function(){var e=l.makeArray(arguments);return e.unshift(i),l.validator.format.apply(this,e)}:((e=2<arguments.length&&e.constructor!==Array?l.makeArray(arguments).slice(1):e).constructor!==Array&&(e=[e]),l.each(e,function(e,t){i=i.replace(RegExp("\\{"+e+"\\}","g"),function(){return t})}),i)},l.extend(l.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:l([]),errorLabelContainer:l([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e){this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||this.element(e)},onkeyup:function(e,t){9===t.which&&""===this.elementValue(e)||!(e.name in this.submitted||e===this.lastElement)||this.element
1(e)},onclick:function(e){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(e,t,i){("radio"===e.type?this.findByName(e.name):l(e)).addClass(t).removeClass(i)},unhighlight:function(e,t,i){("radio"===e.type?this.findByName(e.name):l(e)).removeClass(t).addClass(i)}},setDefaults:function(e){l.extend(l.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:l.validator.format("Please enter no more than {0} characters."),minlength:l.validator.format("Please enter at least {0} characters."),rangelength:l.validator.format("Please enter a value between {0} and {1} characters long."),range:l.validator.format("Please enter a value between {0} and {1}."),max:l.validator.format("Please enter a value less than or equal to {0}."),min:l.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var t=l.data(this[0].form,"validator"),i="on"+e.type.replace(/^validate/,"");t.settings[i]&&t.settings[i].call(t,this[0],e)}this.labelContainer=l(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||l(this.currentForm),this.containers=l(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var n=this.groups={};l.each(this.settings.groups,function(i,e){"string"==typeof e&&(e=e.split(/\s/)),l.each(e,function(e,t){n[t]=i})});var i=this.settings.rules;l.each(i,function(e,t){i[e]=l.validator.normalizeRule(t)}),l(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&l(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),l.extend(this.submitted,this.errorMap),this.invalid=l.extend({},this.errorMap),this.valid()||l(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=l(e);var t=!1!==this.check(e);return t?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),t},showErrors:function(t){if(t){for(var e in l.extend(this.errorMap,t),this.errorList=[],t)this.errorList.push({message:t[e],element:this.findByName(e)[0]});this.successList=l.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){l.fn.resetForm&&l(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t,i=0;for(t in e)i++;return i},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length}
1,focusInvalid:function(){if(this.settings.focusInvalid)try{l(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var t=this.lastActive;return t&&1===l.grep(this.errorList,function(e){return e.element.name===t.name}).length&&t},elements:function(){var e=this,t={};return l(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),!(this.name in t||!e.objectLength(l(this).rules()))&&(t[this.name]=!0)})},clean:function(e){return l(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return l(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=l([]),this.toHide=l([]),this.currentElements=l([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(e){var t=l(e).attr("type"),i=l(e).val();return"radio"===t||"checkbox"===t?l("input[name='"+l(e).attr("name")+"']:checked").val():"string"==typeof i?i.replace(/\r/g,""):i},check:function(t){t=this.validationTargetFor(this.clean(t));var e,i,n=l(t).rules(),o=!1,s=this.elementValue(t);for(i in n){var a={method:i,parameters:n[i]};try{if("dependency-mismatch"===(e=l.validator.methods[i].call(this,s,t,a.parameters))){o=!0;continue}if(o=!1,"pending"===e)return void(this.toHide=this.toHide.not(this.errorsFor(t)));if(!e)return this.formatAndAdd(t,a),!1}catch(e){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+a.method+"' method.",e),e}}return o?void 0:(this.objectLength(n)&&this.successList.push(t),!0)},customDataMessage:function(e,t){return l(e).data("msg-"+t.toLowerCase())||e.attributes&&l(e).attr("data-msg-"+t.toLowerCase())},customMessage:function(e,t){e=this.settings.messages[e];return e&&(e.constructor===String?e:e[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]},defaultMessage:function(e,t){return this.findDefined(this.customMessage(e.name,t),this.customDataMessage(e,t),!this.settings.ignoreTitle&&e.title||void 0,l.validator.messages[t],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,t){var i=this.defaultMessage(e,t.method),n=/\$?\{(\d+)\}/g;"function"==typeof i?i=i.call(this,t.parameters,e):n.test(i)&&(i=l.validator.format(i.replace(n,"{$1}"),t.parameters)),this.errorList.push({message:i,element:e}),this.errorMap[e.name]=i,this.submitted[e.name]=i},addWrapper:function(e){return e=this.settings.wrapper?e.add(e.parent(this.settings.wrapper)):e},defaultShowErrors:function(){for(var e,t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return l(this.errorList).map(function(){return this.element})},showLabel:function(e,t){var i=this.errorsFor(e);i.length?(i.removeClass(this.settings.validClass).addClass(this.settings.errorClass),i.html(t)):(i=l("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(t||""),this.settings.wrapper&&(i=i.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(i).length||(this.settings.errorPlacement?this.settings.errorPlacement(i,l(e)):i.insertAfter(e))),!t&&this.settings.success&&(i.text(""),"string"==typeof this.settings.success?i.addClass(this.settings.success):this.settings.success(i,e)),this.toShow=this.toShow.add(i)},errorsFor:function(e){var t=this.idOrName(e);return this.errors().filter(function(){return l(this).attr("for")===t})},idOrName:function(e){return this.groups[e.name]||!this.checkable(e)&&e.id||e.name},validationTargetFor:function(e){return e=this.checkable(e)?this.findByName(e.name).not(this.settings.ignore)[0]:e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(e){return l(this.currentForm).find("[name='"+e+"']")},getLength:function(e,t){switch(t.nodeName.toLowerCase()){case"select":return l("option:selected",t).length;case"input":if(this.checkable(t))return this.findByName(t.name).filter(":checked").length}return e.length},depend:function(e,t){return!this.dependTypes[typeof e]||this.dependTypes[typeof e](e,t)},dependTypes:{boolean:function(e){return e},string:function(e,t){return!!l(e,t.form).length},function:function(e,t){return e(t)}},optional:function(e){var t=this.elementValue(e);
1return!l.validator.methods.required.call(this,t,e)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(e,t){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[e.name],t&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(l(this.currentForm).submit(),this.formSubmitted=!1):!t&&0===this.pendingRequest&&this.formSubmitted&&(l(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return l.data(e,"previousValue")||l.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,t){e.constructor===String?this.classRuleSettings[e]=t:l.extend(this.classRuleSettings,e)},classRules:function(e){var t={},e=l(e).attr("class");return e&&l.each(e.split(" "),function(){this in l.validator.classRuleSettings&&l.extend(t,l.validator.classRuleSettings[this])}),t},attributeRules:function(e){var t,i={},n=l(e),o=n[0].getAttribute("type");for(t in l.validator.methods){var s="required"===t?!!(s=""===(s=n.get(0).getAttribute(t))?!0:s):n.attr(t);(s=/min|max/.test(t)&&(null===o||/number|range|text/.test(o))?Number(s):s)?i[t]=s:o===t&&"range"!==o&&(i[t]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var t,i,n={},o=l(e);for(t in l.validator.methods)i=o.data("rule-"+t.toLowerCase()),void 0!==i&&(n[t]=i);return n},staticRules:function(e){var t={},i=l.data(e.form,"validator");return t=i.settings.rules?l.validator.normalizeRule(i.settings.rules[e.name])||{}:t},normalizeRules:function(n,o){return l.each(n,function(e,t){if(!1!==t){if(t.param||t.depends){var i=!0;switch(typeof t.depends){case"string":i=!!l(t.depends,o.form).length;break;case"function":i=t.depends.call(o,o)}i?n[e]=void 0===t.param||t.param:delete n[e]}}else delete n[e]}),l.each(n,function(e,t){n[e]=l.isFunction(t)?t(o):t}
1),l.each(["minlength","maxlength"],function(){n[this]&&(n[this]=Number(n[this]))}),l.each(["rangelength","range"],function(){var e;n[this]&&(l.isArray(n[this])?n[this]=[Number(n[this][0]),Number(n[this][1])]:"string"==typeof n[this]&&(e=n[this].split(/[\s,]+/),n[this]=[Number(e[0]),Number(e[1])]))}),l.validator.autoCreateRanges&&(n.min&&n.max&&(n.range=[n.min,n.max],delete n.min,delete n.max),n.minlength&&n.maxlength&&(n.rangelength=[n.minlength,n.maxlength],delete n.minlength,delete n.maxlength)),n},normalizeRule:function(e){var t;return"string"==typeof e&&(t={},l.each(e.split(/\s/),function(){t[this]=!0}),e=t),e},addMethod:function(e,t,i){l.validator.methods[e]=t,l.validator.messages[e]=void 0!==i?i:l.validator.messages[e],t.length<3&&l.validator.addClassRules(e,l.validator.normalizeRule(e))},methods:{required:function(e,t,i){if(!this.depend(i,t))return"dependency-mismatch";if("select"!==t.nodeName.toLowerCase())return this.checkable(t)?0<this.getLength(e,t):0<l.trim(e).length;t=l(t).val();return t&&0<t.length},email:function(e,t){return this.optional(t)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test(""+new Date(e))},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;for(var i=0,n=0,o=!1,s=(e=e.replace(/\D/g,"")).length-1;0<=s;s--){var a=e.charAt(s),n=parseInt(a,10);o&&9<(n*=2)&&(n-=9),i+=n,o=!o}return 0==i%10},minlength:function(e,t,i){e=l.isArray(e)?e.length:this.getLength(l.trim(e),t);return this.optional(t)||i<=e},maxlength:function(e,t,i){e=l.isArray(e)?e.length:this.getLength(l.trim(e),t);return this.optional(t)||e<=i},rangelength:function(e,t,i){e=l.isArray(e)?e.length:this.getLength(l.trim(e),t);return this.optional(t)||e>=i[0]&&i[1]>=e},min:function(e,t,i){return this.optional(t)||i<=e},max:function(e,t,i){return this.optional(t)||e<=i},range:function(e,t,i){return this.optional(t)||e>=i[0]&&i[1]>=e},equalTo:function(e,t,i){i=l(i);return this.settings.onfocusout&&i.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){l(t).valid()}),e===i.val()},remote:function(n,o,e){if(this.optional(o))return"dependency-mismatch";var s=this.previousValue(o);if(this.settings.messages[o.name]||(this.settings.messages[o.name]={}),s.originalMessage=this.settings.messages[o.name].remote,this.settings.messages[o.name].remote=s.message,e="string"==typeof e?{url:e}:e,s.old===n)return s.valid;s.old=n;var a=this;
1this.startRequest(o);var t={};return t[o.name]=n,l.ajax(l.extend(!0,{url:e,mode:"abort",port:"validate"+o.name,dataType:"json",data:t,success:function(e){a.settings.messages[o.name].remote=s.originalMessage;var t,i=!0===e||"true"===e;i?(t=a.formSubmitted,a.prepareElement(o),a.formSubmitted=t,a.successList.push(o),delete a.invalid[o.name],a.showErrors()):(t={},e=e||a.defaultMessage(o,"remote"),t[o.name]=s.message=l.isFunction(e)?e(n):e,a.invalid[o.name]=!0,a.showErrors(t)),s.valid=i,a.stopRequest(o,i)}},e)),"pending"}}}),l.format=l.validator.format}(jQuery),function(n){var o,s={};n.ajaxPrefilter?n.ajaxPrefilter(function(e,t,i){var n=e.port;"abort"===e.mode&&(s[n]&&s[n].abort(),s[n]=i)}):(o=n.ajax,n.ajax=function(e){var t=("mode"in e?e:n.ajaxSettings).mode,i=("port"in e?e:n.ajaxSettings).port;return"abort"===t?(s[i]&&s[i].abort(),s[i]=o.apply(this,arguments),s[i]):o.apply(this,arguments)})}(jQuery),function(o){o.extend(o.fn,{validateDelegate:function(i,e,n){return this.bind(e,function(e){var t=o(e.target);return t.is(i)?n.apply(t,arguments):void 0})}})}(jQuery),function(B){var j={},W={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};B.fn.bxSlider=function(t){if(0==this.length)return this;if(1<this.length)return this.each(function(){B(this).bxSlider(t)}),this;var a={},r=this;j.el=this;function n(){a.settings=B.extend({},W,t),a.settings.slideWidth=parseInt(a.settings.slideWidth),a.children=r.children(a.settings.slideSelector),a.children.length<a.settings.minSlides&&(a.settings.minSlides=a.children.length),a.children.length<a.settings.maxSlides&&(a.settings.maxSlides=a.children.length),a.settings.randomStart&&(a.settings.startSlide=Math.floor(Math.random()*a.children.length)),a.active={index:a.settings.startSlide},a.carousel=1<a.settings.minSlides||1<a.settings.maxSlides,a.carousel&&(a.settings.preloadImages="all"),a.minThreshold=a.settings.minSlides*a.settings.slideWidth+(a.settings.minSlides-1)*a.settings.slideMargin,a.maxThreshold=a.settings.maxSlides*a.settings.slideWidth+(a.settings.maxSlides-1)*a.settings.slideMargin,a.working=!1,a.controls={},a.interval=null,a.animProp="vertical"==a.settings.mode?"top":"left",a.usingCSS=a.settings.useCSS&&"fade"!=a.settings.mode&&function(){var e,t=document.createElement("div"),i=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(e in i)if(void 0!==t.style[i[e]])return a.cssPrefix=i[e].replace("Perspective","").toLowerCase(),a.animProp="-"+a.cssPrefix+"-transform",!0;return!1}(),"vertical"==a.settings.mode&&(a.settings.maxSlides=a.settings.minSlides),r.data("origStyle",r.attr("style")),r.children(a.settings.slideSelector).each(function(){B(this).data("origStyle",B(this).attr("style"))}),l()}function e(){for(var e="",t=m(),i=0;i<t;i++){var n="";a.settings.buildPager&&B.isFunction(a.settings.buildPager)?(n=a.settings.buildPager(i),a.pagerEl.addClass("bx-custom-pager")):(n=i+1,a.pagerEl.addClass("bx-default-pager")),e+='<div class="bx-pager-item"><a href="" data-slide-index="'+i+'" class="bx-pager-link">'+n+"</a></div>"}a.pagerEl.html(e)}var o=B(window).width(),s=B(window).height(),l=function(){r.wrap('<div class="bx-wrapper"><div class="bx-viewport"></div></div>'),a.viewport=r.parent(),a.loader=B('<div class="bx-loading" />'),a.viewport.prepend(a.loader),r.css({width:"horizontal"==a.settings.mode?100*a.children.length+215+"%":"auto",position:"relative"}),a.usingCSS&&a.settings.easing?r.css("-"+a.cssPrefix+"-transition-timing-function",a.settings.easing):a.settings.easing||(a.settings.easing="swing"),g(),a.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),a.viewport.parent().css({maxWidth:p()}),a.settings.pager||a.viewport.parent().css({margin:"0 auto 0px"}
1),a.children.css({float:"horizontal"==a.settings.mode?"left":"none",listStyle:"none",position:"relative"}),a.children.css("width",h()),"horizontal"==a.settings.mode&&0<a.settings.slideMargin&&a.children.css("marginRight",a.settings.slideMargin),"vertical"==a.settings.mode&&0<a.settings.slideMargin&&a.children.css("marginBottom",a.settings.slideMargin),"fade"==a.settings.mode&&(a.children.css({position:"absolute",zIndex:0,display:"none"}),a.children.eq(a.settings.startSlide).css({zIndex:a.settings.slideZIndex,display:"block"})),a.controls.el=B('<div class="bx-controls" />'),a.settings.captions&&x(),a.active.last=a.settings.startSlide==m()-1,a.settings.video&&r.fitVids();var e=a.children.eq(a.settings.startSlide);"all"==a.settings.preloadImages&&(e=a.children),a.settings.ticker?a.settings.pager=!1:(a.settings.pager&&b(),a.settings.controls&&w(),a.settings.auto&&a.settings.autoControls&&P(),(a.settings.controls||a.settings.autoControls||a.settings.pager)&&a.viewport.after(a.controls.el)),c(e,u)},c=function(e,t){var i,n=e.find("img, iframe").length;0!=n?(i=0,e.find("img, iframe").each(function(){B(this).one("load",function(){++i==n&&t()}).each(function(){this.complete&&B(this).load()})})):t()},u=function(){var e,t;a.settings.infiniteLoop&&"fade"!=a.settings.mode&&!a.settings.ticker&&(t="vertical"==a.settings.mode?a.settings.minSlides:a.settings.maxSlides,e=a.children.slice(0,t).clone().addClass("bx-clone"),t=a.children.slice(-t).clone().addClass("bx-clone"),r.append(e).prepend(t)),a.loader.remove(),v(),"vertical"==a.settings.mode&&(a.settings.adaptiveHeight=!0),a.viewport.height(d()),r.redrawSlider(),a.settings.onSliderLoad(a.active.index),a.initialized=!0,a.settings.responsive&&B(window).bind("resize",R),a.settings.auto&&a.settings.autoStart&&D(),a.settings.ticker&&E(),a.settings.pager&&T(a.settings.startSlide),a.settings.controls&&F(),a.settings.touchEnabled&&!a.settings.ticker&&z()},d=function(){var e=0,t=B();if("vertical"==a.settings.mode||a.settings.adaptiveHeight)if(a.carousel){var n=1==a.settings.moveSlides?a.active.index:a.active.index*f(),t=a.children.eq(n);for(i=1;i<=a.settings.maxSlides-1;i++)t=n+i>=a.children.length?t.add(a.children.eq(i-1)):t.add(a.children.eq(n+i))}else t=a.children.eq(a.active.index);else t=a.children;return"vertical"==a.settings.mode?(t.each(function(){e+=B(this).outerHeight()}),0<a.settings.slideMargin&&(e+=a.settings.slideMargin*(a.settings.minSlides-1))):e=Math.max.apply(Math,t.map(function(){return B(this).outerHeight(!1)}).get()),e},p=function(){var e="100%";return e=0<a.settings.slideWidth?"horizontal"==a.settings.mode?a.settings.maxSlides*a.settings.slideWidth+(a.settings.maxSlides-1)*a.settings.slideMargin:a.settings.slideWidth:e},h=function(){var e=a.settings.slideWidth,t=a.viewport.width();return 0==a.settings.slideWidth||a.settings.slideWidth>t&&!a.carousel||"vertical"==a.settings.mode?e=t:1<a.settings.maxSlides&&"horizontal"==a.settings.mode&&(t>a.maxThreshold||t<a.minThreshold&&(e=(t-a.settings.slideMargin*(a.settings.minSlides-1))/a.settings.minSlides)),e},g=function(){var e,t=1;return"horizontal"==a.settings.mode&&0<a.settings.slideWidth?t=a.viewport.width()<a.minThreshold?a.settings.minSlides:a.viewport.width()>a.maxThreshold?a.settings.maxSlides:(e=a.children.first().width(),Math.floor(a.viewport.width()/e)):"vertical"==a.settings.mode&&(t=a.settings.minSlides),t},m=function(){var e=0;if(0<a.settings.moveSlides)if(a.settings.infiniteLoop)e=a.children.length/f();else for(var t=0,i=0;t<a.children.length;)++e,t=i+g(),i+=a.settings.moveSlides<=g()?a.settings.moveSlides:g();else e=Math.ceil(a.children.length/g());return e},f=function(){return 0<a.settings.moveSlides&&a.settings.moveSlides<=g()?a.settings.moveSlides:g()},v=function(){var e,t;a.children.length>a.settings.maxSlides&&a.active.last&&!a.settings.infiniteLoop?"horizontal"==a.settings.mode?(t=(e=a.children.last()).position(),y(-(t.left-(a.viewport.width()-e.width())),"reset",0)):"vertical"==a.settings.mode&&(e=a.children.length-a.settings.minSlides,t=a.children.eq(e).position(),y(-t.top,"reset",0)):(t=a.children.eq(a.active.index*f()).position(),a.active.index==m()-1&&(a.active.last=!0),null!=t&&("horizontal"==a.settings.mode?y(-t.left,"reset",0):"vertical"==a.settings.mode&&y(-t.to
1p,"reset",0)))},y=function(e,t,i,n){var o;a.usingCSS?(o="vertical"==a.settings.mode?"translate3d(0, "+e+"px, 0)":"translate3d("+e+"px, 0, 0)",r.css("-"+a.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==t?(r.css(a.animProp,o),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),M()})):"reset"==t?r.css(a.animProp,o):"ticker"==t&&(r.css("-"+a.cssPrefix+"-transition-timing-function","linear"),r.css(a.animProp,o),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),y(n.resetValue,"reset",0),L()}))):((o={})[a.animProp]=e,"slide"==t?r.animate(o,i,a.settings.easing,function(){M()}):"reset"==t?r.css(a.animProp,e):"ticker"==t&&r.animate(o,speed,"linear",function(){y(n.resetValue,"reset",0),L()}))},b=function(){a.settings.pagerCustom?a.pagerEl=B(a.settings.pagerCustom):(a.pagerEl=B('<div class="bx-pager" />'),a.settings.pagerSelector?B(a.settings.pagerSelector).html(a.pagerEl):a.controls.el.addClass("bx-has-pager").append(a.pagerEl),e()),a.pagerEl.on("click","a",S)},w=function(){a.controls.next=B('<a class="bx-next" href="">'+a.settings.nextText+"</a>"),a.controls.prev=B('<a class="bx-prev" href="">'+a.settings.prevText+"</a>"),a.controls.next.bind("click",C),a.controls.prev.bind("click",$),a.settings.nextSelector&&B(a.settings.nextSelector).append(a.controls.next),a.settings.prevSelector&&B(a.settings.prevSelector).append(a.controls.prev),a.settings.nextSelector||a.settings.prevSelector||(a.controls.directionEl=B('<div class="bx-controls-direction" />'),a.controls.directionEl.append(a.controls.prev).append(a.controls.next),a.controls.el.addClass("bx-has-controls-direction").append(a.controls.directionEl))},P=function(){a.controls.start=B('<div class="bx-controls-auto-item"><a class="bx-start" href="">'+a.settings.startText+"</a></div>"),a.controls.stop=B('<div class="bx-controls-auto-item"><a class="bx-stop" href="">'+a.settings.stopText+"</a></div>"),a.controls.autoEl=B('<div class="bx-controls-auto" />'),a.controls.autoEl.on("click",".bx-start",_),a.controls.autoEl.on("click",".bx-stop",A),a.settings.autoControlsCombine?a.controls.autoEl.append(a.controls.start):a.controls.autoEl.append(a.controls.start).append(a.controls.stop),a.settings.autoControlsSelector?B(a.settings.autoControlsSelector).html(a.controls.autoEl):a.controls.el.addClass("bx-has-controls-auto").append(a.controls.autoEl),k(a.settings.autoStart?"stop":"start")},x=function(){a.children.each(function(){var e=B(this).find("img:first").attr("title");null!=e&&(""+e).length&&B(this).append('<div class="bx-caption"><span>'+e+"</span></div>")})},C=function(e){a.settings.auto&&r.stopAuto(),r.goToNextSlide(),e.preventDefault()},$=function(e){a.settings.auto&&r.stopAuto(),r.goToPrevSlide(),e.preventDefault()},_=function(e){r.startAuto(),e.preventDefault()},A=function(e){r.stopAuto(),e.preventDefault()},S=function(e){a.settings.auto&&r.stopAuto();var t=B(e.currentTarget),t=parseInt(t.attr("data-slide-index"));t!=a.active.index&&r.goToSlide(t),e.preventDefault()},T=function(i){var e=a.children.length;return"short"==a.settings.pagerType?(1<a.settings.maxSlides&&(e=Math.ceil(a.children.length/a.settings.maxSlides)),void a.pagerEl.html(i+1+a.settings.pagerShortSeparator+e)):(a.pagerEl.find("a").removeClass("active"),void a.pagerEl.each(function(e,t){B(t).find("a").eq(i).addClass("active")}))},M=function(){var e;a.settings.infiniteLoop&&(e="",0==a.active.index?e=a.children.eq(0).position():a.active.index==m()-1&&a.carousel?e=a.children.eq((m()-1)*f()).position():a.active.index==a.children.length-1&&(e=a.children.eq(a.children.length-1).position()),e&&("horizontal"==a.settings.mode?y(-e.left,"reset",0):"vertical"==a.settings.mode&&y(-e.top,"reset",0))),a.working=!1,a.settings.onSlideAfter(a.children.eq(a.active.index),a.oldIndex,a.active.index)},k=function(e){a.settings.autoControlsCombine?a.controls.autoEl.html(a.controls[e]):(a.controls.autoEl.find("a").removeClass("active"),a.controls.autoEl.find("a:not(.bx-"+e+")").addClass("active"))},F=function(){1==m()?(a.controls.prev.addClass("disabled"),a.controls.next.addClass("disabled")):!a.settings.infiniteLoop&&a.settings.hideControlOnEnd&&(0==a.active.index?(a.controls.prev.addClass("disabled"),a.controls.next.removeClass("disabled")):a.active.index==m()-1?(a.controls.next.addClass("disabled"),a.controls.prev.removeClass("disabled")):(a.c
1ontrols.prev.removeClass("disabled"),a.controls.next.removeClass("disabled")))},D=function(){0<a.settings.autoDelay?setTimeout(r.startAuto,a.settings.autoDelay):r.startAuto(),a.settings.autoHover&&r.hover(function(){a.interval&&(r.stopAuto(!0),a.autoPaused=!0)},function(){a.autoPaused&&(r.startAuto(!0),a.autoPaused=null)})},E=function(){var e,t=0;"next"==a.settings.autoDirection?r.append(a.children.clone().addClass("bx-clone")):(r.prepend(a.children.clone().addClass("bx-clone")),e=a.children.first().position(),t="horizontal"==a.settings.mode?-e.left:-e.top),y(t,"reset",0),a.settings.pager=!1,a.settings.controls=!1,a.settings.autoControls=!1,a.settings.tickerHover&&!a.usingCSS&&a.viewport.hover(function(){r.stop()},function(){var e=0;a.children.each(function(){e+="horizontal"==a.settings.mode?B(this).outerWidth(!0):B(this).outerHeight(!0)});var t=a.settings.speed/e,i="horizontal"==a.settings.mode?"left":"top",i=t*(e-Math.abs(parseInt(r.css(i))));L(i)}),L()},L=function(e){speed=e||a.settings.speed;var t={left:0,top:0},e={left:0,top:0};"next"==a.settings.autoDirection?t=r.find(".bx-clone").first().position():e=a.children.first().position();t="horizontal"==a.settings.mode?-t.left:-t.top,e="horizontal"==a.settings.mode?-e.left:-e.top;y(t,"ticker",speed,{resetValue:e})},z=function(){a.touch={start:{x:0,y:0},end:{x:0,y:0}},a.viewport.bind("touchstart",I)},I=function(e){a.working?e.preventDefault():(a.touch.originalPos=r.position(),e=e.originalEvent,a.touch.start.x=e.changedTouches[0].pageX,a.touch.start.y=e.changedTouches[0].pageY,a.viewport.bind("touchmove",O),a.viewport.bind("touchend",H))},O=function(e){var t,i=e.originalEvent,n=Math.abs(i.changedTouches[0].pageX-a.touch.start.x),o=Math.abs(i.changedTouches[0].pageY-a.touch.start.y);(o<3*n&&a.settings.preventDefaultSwipeX||n<3*o&&a.settings.preventDefaultSwipeY)&&e.preventDefault(),"fade"!=a.settings.mode&&a.settings.oneToOneTouch&&(e=0,e="horizontal"==a.settings.mode?(t=i.changedTouches[0].pageX-a.touch.start.x,a.touch.originalPos.left+t):(t=i.changedTouches[0].pageY-a.touch.start.y,a.touch.originalPos.top+t),y(e,"reset",0))},H=function(e){a.viewport.unbind("touchmove",O);var t,i=e.originalEvent,e=0;a.touch.end.x=i.changedTouches[0].pageX,a.touch.end.y=i.changedTouches[0].pageY,"fade"==a.settings.mode?(t=Math.abs(a.touch.start.x-a.touch.end.x))>=a.settings.swipeThreshold&&(a.touch.start.x>a.touch.end.x?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):(t=0,e="horizontal"==a.settings.mode?(t=a.touch.end.x-a.touch.start.x,a.touch.originalPos.left):(t=a.touch.end.y-a.touch.start.y,a.touch.originalPos.top),(a.settings.infiniteLoop||!(0==a.active.index&&0<t||a.active.last&&t<0))&&Math.abs(t)>=a.settings.swipeThreshold?(t<0?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):y(e,"reset",200)),a.viewport.unbind("touchend",H)},R=function(){var e=B(window).width(),t=B(window).height();o==e&&s==t||(o=e,s=t,r.redrawSlider(),a.settings.onSliderResize.call(r,a.active.index))};return r.goToSlide=function(e,t){var i,n,o,s;a.working||a.active.index==e||(a.working=!0,a.oldIndex=a.active.index,a.active.index=e<0?m()-1:e>=m()?0:e,a.settings.onSlideBefore(a.children.eq(a.active.index),a.oldIndex,a.active.index),"next"==t?a.settings.onSlideNext(a.children.eq(a.active.index),a.oldIndex,a.active.index):"prev"==t&&a.settings.onSlidePrev(a.children.eq(a.active.index),a.oldIndex,a.active.index),a.active.last=a.active.index>=m()-1,a.settings.pager&&T(a.active.index),a.settings.controls&&F(),"fade"==a.settings.mode?(a.settings.adaptiveHeight&&a.viewport.height()!=d()&&a.viewport.animate({height:d()},a.settings.adaptiveHeightSpeed),a.children.filter(":visible").fadeOut(a.settings.speed).css({zIndex:0}),a.children.eq(a.active.index).css("zIndex",a.settings.slideZIndex+1).fadeIn(a.settings.speed,function(){B(this).css("zIndex",a.settings.slideZIndex),M()})):(a.settings.adaptiveHeight&&a.viewport.height()!=d()&&a.viewport.animate({height:d()},a.settings.adaptiveHeightSpeed),s={left:i=0,top:0},!a.settings.infiniteLoop&&a.carousel&&a.active.last?"horizontal"==a.settings.mode?(s=(o=a.children.eq(a.children.length-1)).position(),i=a.viewport.width()-o.outerWidth()):(n=a.children.length-a.settings.minSlides,s=a.children.eq(n).position()):a.carousel&&a.active.last&&"prev"==t?(n=1==a.settings.moveSlides?a.settings.maxSlides-f():(m()-1)*f()-(a.children.length-a.settings.maxSlides),s=(o=r.children(".bx-clone").eq(n)).position()):"next"==t&&0==a.active.index?(s=r.find("> .bx-clone").eq(a.settings.maxSlides).position(),a.active.last=!1):0<=e&&(e=e*f(),s=a.children.eq(e).position()),void 0!==s&&(s="horizontal"==a.settings.mode?-(s.left-i):-s.top,y(s,"slide",a.settings.speed))))},r.goToNextSlide=function(){var e;!a.settings.infiniteLoop&&a.active.last||(e=parseInt(a.active.index)+1,r.goToSlide(e,"next"))},r.goToPrevSlide=function(){var e;!a.settings.infiniteLoop&&0==a.active.index||(e=parseInt(a.active.index)-1,r.goToSlide(e,"prev"))},r.startAuto=function(e){a.interval||(a.interval=setInterval(function(){"next"==a.settings.autoDirection?r.goToNextSlide():r.goToPrevSlide()},a.settings.pause),a.settings.autoControls&&1!=e&&k("stop"))},r.stopAuto=function(e){a.interval&&(clearInterval(a.interval),a.interval=null,a.settings.autoControls&&1!=e&&k("start"))},r.getCurrentSlide=function(){return a.active.index},r.getCurrentSlideElement=function(){return a.children.eq(a.active.index)},r.getSlideCount=function(){return a.children.length},r.redrawSlider=function(){a.children.add(r.find(".bx-clone")).outerWidth(h()),a.viewport.css("height",d()),a.settings.ticker||v(),a.active.last&&(a.active.index=m()-1),a.active.index>=m()&&(a.active.last=!0),a.settings.pager&&!a.settings.pagerCustom&&(e(),T(a.active.index))},r.destroySlider=function(){a.initialized&&(a.initialized=!1,B(".bx-clone",this).remove(),a.children.each(function(){null!=B(this).data("origStyle")?B(this).attr("style",B(this).data("origStyle")):B(this).removeAttr("style")}),null!=B(this).data("origStyle")?this.attr("style",B(this).data("origStyle")):B(this).removeAttr("style"),B(this).unwrap().unwrap(),a.controls.el&&a.controls.el.remove(),a.controls.next&&a.controls.next.remove(),a.controls.prev&&a.controls.prev.remove(),a.pagerEl&&a.settings.controls&&a.pagerEl.remove(),B(".bx-caption",this).remove(),a.controls.autoEl&&a.controls.autoEl.remove(),clearInterval(a.interval),a.settings.responsive&&B(window).unbind("resize",R))},r.reloadSlider=function(e){null!=e&&(t=e),r.destroySlider(),n()},n(),this}}(jQuery),function(l,c,s,a){var i,n,o;function r(e,t){this.settings=null,this.options=l.extend({},r.Defaults,t),this.$element=l(e),this.drag=l.extend({},i),this.state=l.extend({},n),this.e=l.extend({},o),this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._invalidated={},this._pipe=[],l.each(r.Plugins,l.proxy(function(e,t){this._plugins[e[0].toLowerCase()+e.slice(1)]=new t(this)},this)),l.each(r.Pipe,l.proxy(function(e,t){this._pipe.push({filter:t.filter,run:l.proxy(t.run,this)})},this)),this.setup(),this.initialize()}function u(e){return e.touches!==a?{x:e.touches[0].pageX,y:e.touches[0].pageY}:e.touches===a?e.pageX!==a?{x:e.pageX,y:e.pageY}:e.pageX===a?{x:e.clientX,y:e.clientY}:void 0:void 0}function e(e){var t,i,n=s.createElement("div"),o=e;
1for(t in o)if(i=o[t],void 0!==n.style[i])return n=null,[i,t];return[!1]}r.Defaults={items:3,loop:!(o={_onDragStart:null,_onDragMove:null,_onDragEnd:null,_transitionEnd:null,_resizer:null,_responsiveCall:null,_goToLoop:null,_checkVisibile:null}),center:!(n={isTouch:!(i={start:0,startX:0,startY:0,current:0,currentX:0,currentY:0,offsetX:0,offsetY:0,distance:null,startTime:0,endTime:0,updatedX:0,targetEl:null}),isScrolling:!1,isSwiping:!1,direction:!1,inMotion:!1}),mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:c,responsiveClass:!1,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",themeClass:"owl-theme",baseClass:"owl-carousel",itemClass:"owl-item",centerClass:"center",activeClass:"active"},r.Width={Default:"default",Inner:"inner",Outer:"outer"},r.Plugins={},r.Pipe=[{filter:["width","items","settings"],run:function(e){e.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){var e=this._clones;(this.$stage.children(".cloned").length!==e.length||!this.settings.loop&&0<e.length)&&(this.$stage.children(".cloned").remove(),this._clones=[])}},{filter:["items","settings"],run:function(){for(var e=this._clones,t=this._items,i=this.settings.loop?e.length-Math.max(2*this.settings.items,4):0,n=0,o=Math.abs(i/2);n<o;n++)0<i?(this.$stage.children().eq(t.length+e.length-1).remove(),e.pop(),this.$stage.children().eq(0).remove(),e.pop()):(e.push(e.length/2),this.$stage.append(t[e[e.length-1]].clone().addClass("cloned")),e.push(t.length-1-(e.length-1)/2),this.$stage.prepend(t[e[e.length-1]].clone().addClass("cloned")))}},{filter:["width","items","settings"],run:function(){var e,t,i,n=this.settings.rtl?1:-1,o=(this.width()/this.settings.items).toFixed(3),s=0;for(this._coordinates=[],t=0,i=this._clones.length+this._items.length;t<i;t++)e=this._mergers[this.relative(t)],e=this.settings.mergeFit&&Math.min(e,this.settings.items)||e,s+=(this.settings.autoWidth?this._items[this.relative(t)].width()+this.settings.margin:o*e)*n,this._coordinates.push(s)}},{filter:["width","items","settings"],run:function(){var e,t,i=(this.width()/this.settings.items).toFixed(3),n={width:Math.abs(this._coordinates[this._coordinates.length-1])+2*this.settings.stagePadding,"padding-left":this.settings.stagePadding||"","padding-right":this.settings.stagePadding||""};if(this.$stage.css(n),(n={width:this.settings.autoWidth?"auto":i-this.settings.margin})[this.settings.rtl?"margin-left":"margin-right"]=this.settings.margin,!this.settings.autoWidth&&0<l.grep(this._mergers,function(e){return 1<e}).length)for(e=0,t=this._coordinates.length;e<t;e++)n.width=Math.abs(this._coordinates[e])-Math.abs(this._coordinates[e-1]||0)-this.settings.margin,this.$stage.children().eq(e).css(n);else this.$stage.children().css(n)}},{filter:["width","items","settings"],run:function(e){e.current&&this.reset(this.$stage.children().index(e.current))}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){for(var e,t,i=this.settings.rtl?1:-1,n=2*this.settings.stagePadding,o=this.coordinates(this.current())+n,s=o+this.width()*i,a=[],r=0,l=this._coordinates.length;r<l;r++)e=this._coordinates[r-1]||0,t=Math.abs(this._coordinates[r])+n*i,(this.op(e,"<=",o)&&this.op(e,">",s)||this.op(t,"<",o)&&this.op(t,">",s))&&a.push(r);this.$stage.children("."+this.settings.activeClass).removeClass(this.settings.activeClass),this.$stage.children(":eq("+a.join("), :eq(")+")").addClass(this.settings.activeClass),this.settings.center&&(this.$stage.children("."+this.settings.centerClass).removeClass(this.settings.centerClass),this.$stage.children().eq(this.current()).addClass(this.settings.centerClass))}}],r.prototype.initialize=function(){if(this.trigger("initialize"),this.$element.addClass(this.settings.baseClass).addClass(this.settings.themeClass).toggleClass("owl-rtl",this.settings.rtl),this.browserSupport(),this.settings.autoWidth&&!0!==this.state.imagesLoaded){var e=this.$element.find("img"),t=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:a,t=this.$element.children(t).width();if(e.length&&t<=0)return this.preloadAutoWidthImages(e),!1}
1this.$element.addClass("owl-loading"),this.$stage=l("<"+this.settings.stageElement+' class="owl-stage"/>').wrap('<div class="owl-stage-outer">'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this._width=this.$element.width(),this.refresh(),this.$element.removeClass("owl-loading").addClass("owl-loaded"),this.eventsCall(),this.internalEvents(),this.addTriggerableEvents(),this.trigger("initialized")},r.prototype.setup=function(){var t=this.viewport(),e=this.options.responsive,i=-1,n=null;e?(l.each(e,function(e){e<=t&&i<e&&(i=Number(e))}),delete(n=l.extend({},this.options,e[i])).responsive,n.responsiveClass&&this.$element.attr("class",function(e,t){return t.replace(/\b owl-responsive-\S+/g,"")}).addClass("owl-responsive-"+i)):n=l.extend({},this.options),null!==this.settings&&this._breakpoint===i||(this.trigger("change",{property:{name:"settings",value:n}}),this._breakpoint=i,this.settings=n,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}}))},r.prototype.optionsLogic=function(){this.$element.toggleClass("owl-center",this.settings.center),this.settings.loop&&this._items.length<this.settings.items&&(this.settings.loop=!1),this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},r.prototype.prepare=function(e){var t=this.trigger("prepare",{content:e});return t.data||(t.data=l("<"+this.settings.itemElement+"/>").addClass(this.settings.itemClass).append(e)),this.trigger("prepared",{content:t.data}),t.data},r.prototype.update=function(){for(var e=0,t=this._pipe.length,i=l.proxy(function(e){return this[e]},this._invalidated),n={};e<t;)(this._invalidated.all||0<l.grep(this._pipe[e].filter,i).length)&&this._pipe[e].run(n),e++;this._invalidated={}},r.prototype.width=function(e){switch(e=e||r.Width.Default){case r.Width.Inner:case r.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},r.prototype.refresh=function(){if(0===this._items.length)return!1;(new Date).getTime();this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$stage.addClass("owl-refresh"),this.update(),this.$stage.removeClass("owl-refresh"),this.state.orientation=c.orientation,this.watchVisibility(),this.trigger("refreshed")},r.prototype.eventsCall=function(){this.e._onDragStart=l.proxy(function(e){this.onDragStart(e)},this),this.e._onDragMove=l.proxy(function(e){this.onDragMove(e)},this),this.e._onDragEnd=l.proxy(function(e){this.onDragEnd(e)},this),this.e._onResize=l.proxy(function(e){this.onResize(e)},this),this.e._transitionEnd=l.proxy(function(e){this.transitionEnd(e)},this),this.e._preventClick=l.proxy(function(e){this.preventClick(e)},this)},r.prototype.onThrottledResize=function(){c.clearTimeout(this.resizeTimer),this.resizeTimer=c.setTimeout(this.e._onResize,this.settings.responsiveRefreshRate)},r.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!this.trigger("resize").isDefaultPrevented()&&(this._width=this.$element.width(),this.invalidate("width"),this.refresh(),void this.trigger("resized"))))},r.prototype.eventsRouter=function(e){var t=e.type;"mousedown"===t||"touchstart"===t?this.onDragStart(e):"mousemove"===t||"touchmove"===t?this.onDragMove(e):"mouseup"!==t&&"touchend"!==t&&"touchcancel"!==t||this.onDragEnd(e)},r.prototype.internalEvents=function(){"ontouchstart"in c||navigator.msMaxTouchPoints;var e=c.navigator.msPointerEnabled;this.settings.mouseDrag?(this.$stage.on("mousedown",l.proxy(function(e){this.eventsRouter(e)},this)),this.$stage.on("dragstart",function(){return!1}),this.$stage.get(0).onselectstart=function(){return!1}):this.$element.addClass("owl-text-select-on"),this.settings.touchDrag&&!e&&this.$stage.on("touchstart touchcancel",l.proxy(function(e){this.eventsRouter(e)},this)),this.transitionEndVendor&&this.on(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd,!1),!1!==this.settings.responsive&&this.on(c,"resize",l.proxy(this.onThrottledResize,this))},r.prototype.onDragStart=function(e){var t,i,n=e.originalEvent||e||c.event;if(3===n.which||this.state.isTouch)return!1;if("mousedown"===n.type&&this.$stage.addClass("owl-grab"),this.trigger("drag"),this.drag.startTime=(new Date).getTime(),this.speed(0),this.state.isTouch=!0,this.state.isScrolling=!1,this.state.isSwiping=!1,this.drag.distance=0,t=u(n).x,i=u(n).y,this.drag.offsetX=this.$stage.position().left,this.drag.offsetY=this.$stage.position().top,this.settings.rtl&&(this.drag.offsetX=this.$stage.position().left+this.$stage.width()-this.width()+this.settings.margin),this.state.inMotion&&this.support3d)e=this.getTransformProperty(),this.drag.offsetX=e,this.animate(e),this.state.inMotion=!0;else if(this.state.inMotion&&!this.support3d)return this.state.inMotion=!1;this.drag.startX=t-this.drag.offsetX,this.drag.startY=i-this.drag.offsetY,this.drag.start=t-this.drag.startX,this.drag.targetEl=n.target||n.srcElement,this.drag.updatedX=this.drag.start,"IMG"!==this.drag.targetEl.tagName&&"A"!==this.drag.targetEl.tagName||(this.drag.targetEl.draggable=!1),l(s).on("mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents",l.proxy(function(e){this.eventsRouter(e)},this))},r.prototype.onDragMove=function(e){var t,i,n;this.state.isTouch&&(this.state.isScrolling||(i=u(t=e.originalEvent||e||c.event).x,n=u(t).y,this.drag.currentX=i-this.drag.startX,this.drag.currentY=n-this.drag.startY,this.drag.distance=this.drag.currentX-this.drag.offsetX,this.drag.distance<0?this.state.direction=this.settings.rtl?"right":"left":0<this.drag.distance&&(this.state.direction=this.settings.rtl?"left":"right"),this.settings.loop?this.op(this.drag.currentX,">",this.coordinates(this.minimum()))&&"right"===this.state.direction?this.drag.currentX-=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length):this.op(this.drag.currentX,"<",this.coordinates(this.maximum()))&&"left"===this.state.direction&&(this.drag.currentX+=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length)):(e=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),i=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),n=this.settings.pullDrag?this.drag.distance/5:0,this.drag.currentX=Math.max(Math.min(this.drag.currentX,e+n),i+n)),(8<this.drag.distance||this.drag.distance<-8)&&(t.preventDefault!==a?t.preventDefault():t.returnValue=!1,this.state.isSwiping=!0),this.drag.updatedX=this.drag.currentX,(16<this.drag.currentY||this.drag.currentY<-16)&&
1!1===this.state.isSwiping&&(this.state.isScrolling=!0,this.drag.updatedX=this.drag.start),this.animate(this.drag.updatedX)))},r.prototype.onDragEnd=function(e){if(this.state.isTouch){if("mouseup"===e.type&&this.$stage.removeClass("owl-grab"),this.trigger("dragged"),this.drag.targetEl.removeAttribute("draggable"),this.state.isTouch=!1,this.state.isScrolling=!1,this.state.isSwiping=!1,0===this.drag.distance&&!0!==this.state.inMotion)return this.state.inMotion=!1;this.drag.endTime=(new Date).getTime(),e=this.drag.endTime-this.drag.startTime,(3<Math.abs(this.drag.distance)||300<e)&&this.removeClick(this.drag.targetEl),e=this.closest(this.drag.updatedX),this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(e),this.invalidate("position"),this.update(),this.settings.pullDrag||this.drag.updatedX!==this.coordinates(e)||this.transitionEnd(),this.drag.distance=0,l(s).off(".owl.dragEvents")}},r.prototype.removeClick=function(e){this.drag.targetEl=e,l(e).on("click.preventClick",this.e._preventClick),c.setTimeout(function(){l(e).off("click.preventClick")},300)},r.prototype.preventClick=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),l(e.target).off("click.preventClick")},r.prototype.getTransformProperty=function(){var e=c.getComputedStyle(this.$stage.get(0),null).getPropertyValue(this.vendorName+"transform");return!0!=(16===(e=e.replace(/matrix(3d)?\(|\)/g,"").split(",")).length)?e[4]:e[12]},r.prototype.closest=function(i){var n=-1,o=this.width(),s=this.coordinates();return this.settings.freeDrag||l.each(s,l.proxy(function(e,t){return t-30<i&&i<t+30?n=e:this.op(i,"<",t)&&this.op(i,">",s[e+1]||t-o)&&(n="left"===this.state.direction?e+1:e),-1===n},this)),this.settings.loop||(this.op(i,">",s[this.minimum()])?n=i=this.minimum():this.op(i,"<",s[this.maximum()])&&(n=i=this.maximum())),n},r.prototype.animate=function(e){this.trigger("translate"),this.state.inMotion=0<this.speed(),this.support3d?this.$stage.css({transform:"translate3d("+e+"px,0px, 0px)",transition:this.speed()/1e3+"s"}):this.state.isTouch?this.$stage.css({left:e+"px"}):this.$stage.animate({left:e},this.speed()/1e3,this.settings.fallbackEasing,l.proxy(function(){this.state.inMotion&&this.transitionEnd()},this))},r.prototype.current=function(e){return e===a?this._current:0===this._items.length?a:(e=this.normalize(e),this._current!==e&&((t=this.trigger("change",{property:{name:"position",value:e}})).data!==a&&(e=this.normalize(t.data)),this._current=e,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})),this._current);var t},r.prototype.invalidate=function(e){this._invalidated[e]=!0},r.prototype.reset=function(e){(e=this.normalize(e))!==a&&(this._speed=0,this._current=e,this.suppress(["translate","translated"]),this.animate(this.coordinates(e)),this.release(["translate","translated"]))},r.prototype.normalize=function(e,t){var i=t?this._items.length:this._items.length+this._clones.length;return!l.isNumeric(e)||i<1?a:e=this._clones.length?(e%i+i)%i:Math.max(this.minimum(t),Math.min(this.maximum(t),e))},r.prototype.relative=function(e){return e=this.normalize(e),e-=this._clones.length/2,this.normalize(e,!0)},r.prototype.maximum=function(e){var t,i,n,o=0,s=this.settings;if(e)return this._items.length-1;if(!s.loop&&s.center)t=this._items.length-1;else if(s.loop||s.center)if(s.loop||s.center)t=this._items.length+s.items;else{if(!s.autoWidth&&!s.merge)throw"Can not detect maximum absolute position.";for(revert=s.rtl?1:-1,i=this.$stage.width()-this.$element.width();(n=this.coordinates(o))&&!(n*revert>=i);)t=++o}else t=this._items.length-s.items;return t},r.prototype.minimum=function(e){return e?0:this._clones.length/2},r.prototype.items=function(e){return e===a?this._items.slice():(e=this.normalize(e,!0),this._items[e])},r.prototype.mergers=function(e){return e===a?this._mergers.slice():(e=this.normalize(e,!0),this._mergers[e])},r.prototype.clones=function(i){function n(e){return e%2==0?o+e/2:t-(e+1)/2}var t=this._clones.length/2,o=t+this._items.length;return i===a?l.map(this._clones,function(e,t){return n(t)}):l.map(this._clones,function(e,t){return e===i?n(t):null})},r.prototype.speed=function(e){return e!==a&&(this._speed=e),this._speed},r.prototype.coordinates=function(e){var t=null;return e===a?l.map(this._coordinates,l.proxy(function(e,t){return this.coordinates(t)},this)):(this.settings.center?(t=this._coordinates[e],t+=(this.width()-t+(this._coordinates[e-1]||0))/2*(this.settings.rtl?-1:1)):t=this._coordinates[e-1]||0,t)},r.prototype.duration=function(e,t,i){return Math.min(Math.max(Math.abs(t-e),1),6)*Math.abs(i||this.settings.smartSpeed)},r.prototype.to=function(e,t){var i,n,o,s,a,r;this.settings.loop?(i=e-this.relative(this.current()),n=this.current(),a=(o=this.current())-(s=this.current()+i)<0,r=this._clones.length+this._items.length,s<this.settings.items&&!1==a?(n=o+this._items.length,this.reset(n)):s>=r-this.settings.items&&!0==a&&(n=o-this._items.length,this.reset(n)),c.clearTimeout(this.e._goToLoop),this.e._goToLoop=c.setTimeout(l.proxy(function(){this.speed(this.duration(this.current(),n+i,t)),this.current(n+i),this.update()},this),30)):(this.speed(this.duration(this.current(),e,t)),this.current(e),this.update())},r.prototype.next=function(e){e=e||!1,this.to(this.relative(this.current())+1,e)},r.prototype.prev=function(e){e=e||!1,this.to(this.relative(this.current())-1,e)},r.prototype.transitionEnd=function(e){if(e!==a&&(e.stopPropagation(),(e.target||e.srcElement||e.originalTarget)!==this.$stage.get(0)))return!1;this.state.inMotion=!1,this.trigger("translated")},r.prototype.viewport=function(){var e;if(this.options.responsiveBaseElement!==c)e=l(this.options.responsiveBaseElement).width();else if(c.innerWidth)e=c.innerWidth;else{if(!s.documentElement||!s.documentElement.clientWidth)throw"Can not detect viewport width.";e=s.documentElement.clientWidth}return e},r.prototype.replace=function(e){this.$stage.empty(),this._items=[],e=e&&(e instanceof jQuery?e:l(e)),(e=this.settings.nestedItemSelector?e.find("."+this.settings.nestedItemSelector):e).filter(function(){return 1===this.nodeType}).each(l.proxy(function(e,t){t=this.prepare(t),this.$stage.append(t),this._items.push(t),this._mergers.push(+t.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)},this)),this.reset(l.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},r.prototype.add=function(e,t){t=t===a?this._items.length:this.normalize(t,!0),this.trigger("add",{content:e,position:t}),0===this._items.length||t===this._items.length?(this.$stage.append(e),this._items.push(e),this._mergers.push(+e.f
1ind("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)):(this._items[t].before(e),this._items.splice(t,0,e),this._mergers.splice(t,0,+e.find("[data-merge]").andSelf("[data-merge]").attr("data-merge")||1)),this.invalidate("items"),this.trigger("added",{content:e,position:t})},r.prototype.remove=function(e){(e=this.normalize(e,!0))!==a&&(this.trigger("remove",{content:this._items[e],position:e}),this._items[e].remove(),this._items.splice(e,1),this._mergers.splice(e,1),this.invalidate("items"),this.trigger("removed",{content:null,position:e}))},r.prototype.addTriggerableEvents=function(){var i=l.proxy(function(t,i){return l.proxy(function(e){e.relatedTarget!==this&&(this.suppress([i]),t.apply(this,[].slice.call(arguments,1)),this.release([i]))},this)},this);l.each({next:this.next,prev:this.prev,to:this.to,destroy:this.destroy,refresh:this.refresh,replace:this.replace,add:this.add,remove:this.remove},l.proxy(function(e,t){this.$element.on(e+".owl.carousel",i(t,e+".owl.carousel"))},this))},r.prototype.watchVisibility=function(){function e(e){return 0<e.offsetWidth&&0<e.offsetHeight}e(this.$element.get(0))||(this.$element.addClass("owl-hidden"),c.clearInterval(this.e._checkVisibile),this.e._checkVisibile=c.setInterval(l.proxy(function(){e(this.$element.get(0))&&(this.$element.removeClass("owl-hidden"),this.refresh(),c.clearInterval(this.e._checkVisibile))},this),500))},r.prototype.preloadAutoWidthImages=function(i){var n,o,s=0,a=this;i.each(function(e,t){n=l(t),(o=new Image).onload=function(){s++,n.attr("src",o.src),n.css("opacity",1),s>=i.length&&(a.state.imagesLoaded=!0,a.initialize())},o.src=n.attr("src")||n.attr("data-src")||n.attr("data-src-retina")})},r.prototype.destroy=function(){for(var e in this.$element.hasClass(this.settings.themeClass)&&this.$element.removeClass(this.settings.themeClass),!1!==this.settings.responsive&&l(c).off("resize.owl.carousel"),this.transitionEndVendor&&this.off(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd),this._plugins)this._plugins[e].destroy();(this.settings.mouseDrag||this.settings.touchDrag)&&(this.$stage.off("mousedown touchstart touchcancel"),l(s).off(".owl.dragEvents"),this.$stage.get(0).onselectstart=function(){},this.$stage.off("dragstart",function(){return!1})),this.$element.off(".owl"),this.$stage.children(".cloned").remove(),this.e=null,this.$element.removeData("owlCarousel"),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.unwrap()},r.prototype.op=function(e,t,i){var n=this.settings.rtl;switch(t){case"<":return n?i<e:e<i;case">":return n?e<i:i<e;case">=":return n?e<=i:i<=e;case"<=":return n?i<=e:e<=i}},r.prototype.on=function(e,t,i,n){e.addEventListener?e.addEventListener(t,i,n):e.attachEvent&&e.attachEvent("on"+t,i)},r.prototype.off=function(e,t,i,n){e.removeEventListener?e.removeEventListener(t,i,n):e.detachEvent&&e.detachEvent("on"+t,i)},r.prototype.trigger=function(e,t,i){var n={item:{count:this._items.length,index:this.current()}},o=l.camelCase(l.grep(["on",e,i],function(e){return e}).join("-").toLowerCase()),s=l.Event([e,"owl",i||"carousel"].join(".").toLowerCase(),l.extend({relatedTarget:this},n,t));return this._supress[e]||(l.each(this._plugins,function(e,t){t.onTrigger&&t.onTrigger(s)}),this.$element.trigger(s),this.settings&&"function"==typeof this.settings[o]&&this.settings[o].apply(this,s)),s},r.prototype.suppress=function(e){l.each(e,l.proxy(function(e,t){this._supress[t]=!0},this))},r.prototype.release=function(e){l.each(e,l.proxy(function(e,t){delete this._supress[t]},this))},r.prototype.browserSupport=function(){this.support3d=e(["perspective","webkitPerspective","MozPerspective","OPerspective","MsPerspective"])[0],this.support3d&&(this.transformVendor=e(["transform","WebkitTransform","MozTransform","OTransform","msTransform"])[0],this.transitionEndVendor=["transitionend","webkitTransitionEnd","transitionend","oTransitionEnd"][e(["transition","WebkitTransition","MozTransition","OTransition"])[1]],this.vendorName=this.transformVendor.replace(/Transform/i,""),this.vendorName=""!==this.vendorName?"-"+this.vendorName.toLowerCase()+"-":""),this.state.orientation=c.orientation},l.fn.owlCarousel=function(e){return this.each(function(){l(this).data("owlCarousel")||l(this).data("owlCarousel",new r(this,e))})},l.fn.owlCarousel.Constructor=r}(window.Zepto||window.jQuery,window,document),function(r,o){var t=function(e){this._core=e,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel":r.proxy(function(e){if(e.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(e.property&&"position"==e.property.name||"initialized"==e.type))for(var t=this._core.settings,i=t.center&&Math.ceil(t.items/2)||t.items,n=t.center&&-1*i||0,o=(e.property&&e.property.value||this._core.current())+n,s=this._core.clones().length,a=r.proxy(function(e,t){this.load(t)},this);n++<i;)this.load(s/2+this._core.relative(o)),s&&r.each(this._core.clones(this._core.relative(o++)),a)},this)},this._core.options=r.extend({},t.Defaults,this._core.options),this._core.$element.on(this._handlers)};t.Defaults={lazyLoad:!1},t.prototype.load=function(e){var t=this._core.$stage.children().eq(e),e=t&&t.find(".owl-lazy");!e||-1<r.inArray(t.get(0),this._loaded)||(e.each(r.proxy(function(e,t){var i=r(t),n=1<o.devicePixelRatio&&i.attr("data-src-retina")||i.attr("data-src");this._core.trigger("load",{element:i,url:n},"lazy"),i.is("img")?i.one("load.owl.lazy",r.proxy(function(){i.css("opacity",1),this._core.trigger("loaded",{element:i,url:n},"lazy")},this)).attr("src",n):((t=new Image).onload=r.proxy(function(){i.css({"background-image":"url("+n+")",opacity:"1"}),this._core.trigger("loaded",{element:i,url:n},"lazy")},this),t.src=n)},this)),this._loaded.push(t.get(0)))},t.prototype.destroy=function(){var e,t;for(e in this.handlers)this._core.$element.off(e,this.handlers[e]);for(t in Object.getOwnPropertyNames(this))"function"!=typeof this[t]&&(this[t]=null)},r.fn.owlCarousel.Constructor.Plugins.Lazy=t}(window.Zepto||window.jQuery,window,document),function(t){var i=function(e){this._core=e,this._handlers={"initialized.owl.carousel":t.proxy(function(){this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":t.proxy(function(e){this._core.settings.autoHeight&&"position"==e.property.name&&this.update()},this),"loaded.owl.lazy":t.proxy(function(e){this._core.settings.autoHeight&&e.element.closest("."+this._core.settings.itemClass)===this._core.$stage.children().eq(this._core.current())&&this.update()},this)},this._core.options=t.extend({},i.Defaults,this._core.options),this._core.$element.on(this._handlers)};i.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},i.prototype.update=function(){this._core.$stage.parent().height(this._core.$stage.children().eq(this._core.current()).height()).addClass(this._core.settings.autoHeightClass)},i.prototype.destroy=function(){var e,t;for(e in this._handlers)this._core.$element.off(e,this._handlers[e]);for(t in Object.getOwnPropertyNames(this))"function"!=typeof this[t]&&(this[t]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoHeight=i}(window.Zepto||window.jQuery,(window,document)),function(u,t,i){var n=function(e){this._core=e,this._videos={},this._playing=null,this._fullscreen=!1,this._handlers={"resize.owl.carousel":u.proxy(function(e){this._core.settings.video&&!this.isInFullScreen()&&e.preventDefault()},this),"refresh.owl.carousel changed.owl.carousel":u.proxy(function(e){this._playing&&this.stop()},this),"prepared.owl.carousel":u.proxy(function(e){var t=u(e.content).find(".owl-video");t.length&&(t.css("display","none"),this.fetch(t,u(e.content)))},this)},this._core.options=u.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",u.proxy(function(e){this.play(e)},this))};n.Defaults={video:!1,videoHeight:!1,videoWidth:!1},n.prototype.fetch=function(e,t){var i=e.attr("data-vimeo-id")?"vimeo":"youtube",n=e.attr("data-vimeo-id")||e.attr("data-youtube-id"),o=e.attr("data-width")||this._core.settings.videoWidth,s=e.attr("data-height")||this._core.settings.videoHeight,a=e.attr("href");if(!a)throw new Error("Missing video URL.");
1if(-1<(n=a.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/))[3].indexOf("youtu"))i="youtube";else{if(!(-1<n[3].indexOf("vimeo")))throw new Error("Video URL not supported.");i="vimeo"}n=n[6],this._videos[a]={type:i,id:n,width:o,height:s},t.attr("data-video",a),this.thumbnail(e,this._videos[a])},n.prototype.thumbnail=function(t,e){function i(e){n=c.lazyLoad?'<div class="owl-video-tn '+l+'" '+r+'="'+e+'"></div>':'<div class="owl-video-tn" style="opacity:1;background-image:url('+e+')"></div>',t.after(n),t.after('<div class="owl-video-play-icon"></div>')}var n,o,s=e.width&&e.height?'style="width:'+e.width+"px;height:"+e.height+'px;"':"",a=t.find("img"),r="src",l="",c=this._core.settings;if(t.wrap('<div class="owl-video-wrapper"'+s+"></div>"),this._core.settings.lazyLoad&&(r="data-src",l="owl-lazy"),a.length)return i(a.attr(r)),a.remove(),!1;"youtube"===e.type?(o="http://img.youtube.com/vi/"+e.id+"/hqdefault.jpg",i(o)):"vimeo"===e.type&&u.ajax({type:"GET",url:"http://vimeo.com/api/v2/video/"+e.id+".json",jsonp:"callback",dataType:"jsonp",success:function(e){o=e[0].thumbnail_large,i(o)}})},n.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null},n.prototype.play=function(e){this._core.trigger("play",null,"video"),this._playing&&this.stop();var t,i=u(e.target||e.srcElement),n=i.closest("."+this._core.settings.itemClass),o=this._videos[n.attr("data-video")],s=o.width||"100%",e=o.height||this._core.$stage.height();"youtube"===o.type?t='<iframe width="'+s+'" height="'+e+'" src="http://www.youtube.com/embed/'+o.id+"?autoplay=1&v="+o.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===o.type&&(t='<iframe src="http://player.vimeo.com/video/'+o.id+'?autoplay=1" width="'+s+'" height="'+e+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'),n.addClass("owl-video-playing"),this._playing=n,t=u('<div style="height:'+e+"px; width:"+s+'px" class="owl-video-frame">'+t+"</div>"),i.after(t)},n.prototype.isInFullScreen=function(){var e=i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement;return e&&u(e).parent().hasClass("owl-video-frame")&&(this._core.speed(0),this._fullscreen=!0),!(e&&this._fullscreen&&this._playing)&&(this._fullscreen?this._fullscreen=!1:!this._playing||this._core.state.orientation===t.orientation||(this._core.state.orientation=t.orientation,!1))},n.prototype.destroy=function(){var e,t;for(e in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(e,this._handlers[e]);for(t in Object.getOwnPropertyNames(this))"function"!=typeof this[t]&&(this[t]=null)},u.fn.owlCarousel.Constructor.Plugins.Video=n}(window.Zepto||window.jQuery,window,document),function(a){var t=function(e){this.core=e,this.core.options=a.extend({},t.Defaults,this.core.options),this.swapping=!0,this.previous=void 0,this.next=void 0,this.handlers={"change.owl.carousel":a.proxy(function(e){"position"==e.property.name&&(this.previous=this.core.current(),this.next=e.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(e){this.swapping="translated"==e.type},this),"translate.owl.carousel":a.proxy(function(e){this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};t.Defaults={animateOut:!1,animateIn:!1},t.prototype.swap=function(){var e,t,i,n,o,s;1===this.core.settings.items&&this.core.support3d&&(this.core.speed(0),t=a.proxy(this.clear,this),i=this.core.$stage.children().eq(this.previous),n=this.core.$stage.children().eq(this.next),o=this.core.settings.animateIn,s=this.core.settings.animateOut,this.core.current()!==this.previous&&(s&&(e=this.core.coordinates(this.previous)-this.core.coordinates(this.next),i.css({left:e+"px"}).addClass("animated owl-animated-out").addClass(s).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",t)),o&&n.addClass("animated owl-animated-in").addClass(o).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",t)))},t.prototype.clear=function(e){a(e.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.transitionEnd()},t.prototype.destroy=function(){var e,t;for(e in this.handlers)this.core.$element.off(e,this.handlers[e]);for(t in Object.getOwnPropertyNames(this))"function"!=typeof this[t]&&(this[t]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=t}(window.Zepto||window.jQuery,(window,document)),function(t,i,n){var o=function(e){this.core=e,this.core.options=t.extend({},o.Defaults,this.core.options),this.handlers={"translated.owl.carousel refreshed.owl.carousel":t.proxy(function(){this.autoplay()},this),"play.owl.autoplay":t.proxy(function(e,t,i){this.play(t,i)},this),"stop.owl.autoplay":t.proxy(function(){this.stop()},this),"mouseover.owl.autoplay":t.proxy(function(){this.core.settings.autoplayHoverPause&&this.pause()},this),"mouseleave.owl.autoplay":t.proxy(function(){this.core.settings.autoplayHoverPause&&this.autoplay()},this)},this.core.$element.on(this.handlers)};o.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},o.prototype.autoplay=function(){this.core.settings.autoplay&&!this.core.state.videoPlay?(i.clearInterval(this.interval),this.interval=i.setInterval(t.proxy(function(){this.play()},this),this.core.settings.autoplayTimeout)):i.clearInterval(this.interval)},o.prototype.play=function(e,t){!0!==n.hidden&&(this.core.state.isTouch||this.core.state.isScrolling||this.core.state.isSwiping||this.core.state.inMotion||(!1!==this.core.settings.autoplay?this.core.next(this.core.settings.autoplaySpeed):i.clearInterval(this.interval)))},o.prototype.stop=function(){i.clearInterval(this.interval)},o.prototype.pause=function(){i.clearInterval(this.interval)},o.prototype.destroy=function(){var e,t;for(e in i.clearInterval(this.interval),this.handlers)this.core.$element.off(e,this.handlers[e]);for(t in Object.getOwnPropertyNames(this))"function"!=typeof this[t]&&(this[t]=null)},t.fn.owlCarousel.Constructor.Plugins.autoplay=o}(window.Zepto||window.jQuery,window,document),function(o){"use strict";var t=function(e){this._core=e,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":o.proxy(function(e){this._core.settings.dotsData&&this._templates.push(o(e.content).find("[data-dot]").andSelf("[data-dot]").attr("data-dot"))},this),"add.owl.carousel":o.proxy(function(e){this._core.settings.dotsData&&this._templates.splice(e.position,0,o(e.content).find("[data-dot]").andSelf("[data-dot]").attr("data-dot"))},this),"remove.owl.carousel prepared.owl.carousel":o.proxy(function(e){this._core.settings.dotsData&&this._templates.splice(e.position,1)},this),"change.owl.carousel":o.proxy(function(e){var t,i,n;"position"==e.property.name&&(this._core.state.revert||this._core.settings.loop||!this._core.settings.navRewind||(t=this._core.current(),i=this._core.maximum(),n=this._core.minimum(),e.data=e.property.value>i?i<=t?n:i:e.property.value<n?i:e.property.value))},this),"changed.owl.carousel":o.proxy(function(e){"position"==e.property.name&&this.draw()},this),"refreshed.owl.carousel":o.proxy(function(){this._initialized||(this.initialize(),this._initialized=!0),this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation")},this)},this._core.options=o.extend({},t.Defaults,this._core.options),this.$element.on(this._handlers)};t.Defaults={nav:!1,navRewind:!0,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotData:!1,dotsSpeed:!1,dotsContainer:!1,controlsClass:"owl-control
1s"},t.prototype.initialize=function(){var e,t,i=this._core.settings;for(t in i.dotsData||(this._templates=[o("<div>").addClass(i.dotClass).append(o("<span>")).prop("outerHTML")]),i.navContainer&&i.dotsContainer||(this._controls.$container=o("<div>").addClass(i.controlsClass).appendTo(this.$element)),this._controls.$indicators=i.dotsContainer?o(i.dotsContainer):o("<div>").hide().addClass(i.dotsClass).appendTo(this._controls.$container),this._controls.$indicators.on("click","div",o.proxy(function(e){var t=(o(e.target).parent().is(this._controls.$indicators)?o(e.target):o(e.target).parent()).index();e.preventDefault(),this.to(t,i.dotsSpeed)},this)),e=i.navContainer?o(i.navContainer):o("<div>").addClass(i.navContainerClass).prependTo(this._controls.$container),this._controls.$next=o("<"+i.navElement+">"),this._controls.$previous=this._controls.$next.clone(),this._controls.$previous.addClass(i.navClass[0]).html(i.navText[0]).hide().prependTo(e).on("click",o.proxy(function(e){this.prev(i.navSpeed)},this)),this._controls.$next.addClass(i.navClass[1]).html(i.navText[1]).hide().appendTo(e).on("click",o.proxy(function(e){this.next(i.navSpeed)},this)),this._overrides)this._core[t]=o.proxy(this[t],this)},t.prototype.destroy=function(){var e,t,i,n;for(e in this._handlers)this.$element.off(e,this._handlers[e]);for(t in this._controls)this._controls[t].remove();for(n in this.overides)this._core[n]=this._overrides[n];for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&&(this[i]=null)},t.prototype.update=function(){var e,t,i=this._core.settings,n=this._core.clones().length/2,o=n+this._core.items().length,s=i.center||i.autoWidth||i.dotData?1:i.dotsEach||i.items;if("page"!==i.slideBy&&(i.slideBy=Math.min(i.slideBy,i.items)),i.dots||"page"==i.slideBy)for(this._pages=[],e=n,t=0;e<o;e++)(s<=t||0===t)&&(this._pages.push({start:e-n,end:e-n+s-1}),t=0,0),t+=this._core.mergers(this._core.relative(e))},t.prototype.draw=function(){var e,t="",i=this._core.settings,n=(this._core.$stage.children(),this._core.relative(this._core.current()));if(!i.nav||i.loop||i.navRewind||(this._controls.$previous.toggleClass("disabled",n<=0),this._controls.$next.toggleClass("disabled",n>=this._core.maximum())),this._controls.$previous.toggle(i.nav),this._controls.$next.toggle(i.nav),i.dots){if(n=this._pages.length-this._controls.$indicators.children().length,i.dotData&&0!=n){for(e=0;e<this._controls.$indicators.children().length;e++)t+=this._templates[this._core.relative(e)];this._controls.$indicators.html(t)}else 0<n?(t=new Array(1+n).join(this._templates[0]),this._controls.$indicators.append(t)):n<0&&this._controls.$indicators.children().slice(n).remove();this._controls.$indicators.find(".active").removeClass("active"),this._controls.$indicators.children().eq(o.inArray(this.current(),this._pages)).addClass("active")}this._controls.$indicators.toggle(i.dots)},t.prototype.onTrigger=function(e){var t=this._core.settings;e.page={index:o.inArray(this.current(),this._pages),count:this._pages.length,size:t&&(t.center||t.autoWidth||t.dotData?1:t.dotsEach||t.items)}},t.prototype.current=function(){var t=this._core.relative(this._core.current());return o.grep(this._pages,function(e){return e.start<=t&&e.end>=t}).pop()},t.prototype.getPosition=function(e){var t,i,n=this._core.settings;return"page"==n.slideBy?(t=o.inArray(this.current(),this._pages),i=this._pages.length,e?++t:--t,t=this._pages[(t%i+i)%i].start):(t=this._core.relative(this._core.current()),i=this._core.items().length,e?t+=n.slideBy:t-=n.slideBy),t},t.prototype.next=function(e){o.proxy(this._overrides.to,this._core)(this.getPosition(!0),e)},t.prototype.prev=function(e){o.proxy(this._overrides.to,this._core)(this.getPosition(!1),e)},t.prototype.to=function(e,t,i){i?o.proxy(this._overrides.to,this._core)(e,t):(i=this._pages.length,o.proxy(this._overrides.to,this._core)(this._pages[(e%i+i)%i].start,t))},o.fn.owlCarousel.Constructor.Plugins.Navigation=t}(window.Zepto||window.jQuery,(window,document)),function(i,n){"use strict";var t=function(e){this._core=e,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":i.proxy(function(){"URLHash"==this._core.settings.startPosition&&i(n).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":i.proxy(function(e){var t=i(e.content).find("[data-hash]").andSelf("[data-hash]").attr("data-hash");this._hashes[t]=e.content},this)},this._core.options=i.extend({},t.Defaults,this._core.options),this.$element.on(this._handlers),i(n).on("hashchange.owl.navigation",i.proxy(function(){var e=n.location.hash.substring(1),t=this._core.$stage.children(),t=this._hashes[e]&&t.index(this._hashes[e])||0;if(!e)return!1;this._core.to(t,!1,!0)},this))};t.Defaults={URLhashListener:!1},t.prototype.destroy=function(){var e,t;for(e in i(n).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(e,this._handlers[e]);for(t in Object.getOwnPropertyNames(this))"function"!=typeof this[t]&&(this[t]=null)},i.fn.owlCarousel.Constructor.Plugins.Hash=t}(window.Zepto||window.jQuery,window,document),function(_){_.fn.slabText=function(n){var $={fontRatio:.78,forceNewCharCount:!0,wrapAmpersand:!0,headerBreakp
1oint:null,viewportBreakpoint:null,noResizeEvent:!1,resizeThrottleTime:300,maxFontSize:999,postTweak:!0,precision:3,minCharsPerLine:0};return _("body").addClass("slabtexted"),this.each(function(){n&&_.extend($,n);var e,c=_(this),u=_("span.slabtext",c).length,d=u?[]:String(_.trim(c.text())).replace(/\s{2,}/g," ").split(" "),p=null,h=null,g=$.fontRatio,m=$.forceNewCharCount,f=$.headerBreakpoint,v=$.viewportBreakpoint,y=$.postTweak,b=$.precision,t=$.resizeThrottleTime,w=$.minCharsPerLine,i=null,P=_(window).width(),x=c.find("a:first").attr("href")||c.attr("href"),C=x?c.find("a:first").attr("title"):"";!u&&w&&d.join(" ").length<w||((e=function(){var e,s=c.width();if(0!==s)if(c.removeClass("slabtextdone slabtextinactive"),v&&P<v||f&&s<f)c.addClass("slabtextinactive");else{if(e=jQuery('<div style="display:none;font-size:1em;margin:0;padding:0;height:auto;line-height:1;border:0;">&nbsp;</div>').appendTo(c),i=e.height(),e.remove(),u||!m&&i==p)p=i;else{p=i;var t,i=Math.min(60,Math.floor(s/(p*g))),n=0,o=[],a="",r="",l="";if(0!=i&&i!=h){for(h=i;n<d.length;){for(r="";r.length<h&&(a=r,r+=d[n]+" ",!(++n>=d.length)););w&&(t=d.slice(n).join(" ")).length<w&&(a=r+=t,n=d.length+2),h-a.length<r.length-h&&a.length>=(w||2)?(l=a,n--):l=r,l=_("<div/>").text(l).html(),$.wrapAmpersand&&(l=l.replace(/&amp;/g,'<span class="amp">&amp;</span>')),l=_.trim(l),o.push('<span class="slabtext">'+l+"</span>")}c.html(o.join(" ")),x&&c.wrapInner('<a href="'+x+'" '+(C?'title="'+C+'" ':"")+"/>")}}_("span.slabtext",c).each(function(){var e,t,i=_(this),n=i.text(),o=1<n.split(" ").length;y&&i.css({"word-spacing":0,"letter-spacing":0}),e=s/i.width(),t=parseFloat(this.style.fontSize)||p,i.css("font-size",Math.min((t*e).toFixed(b),$.maxFontSize)+"px"),(e=!!y&&s-i.width())&&i.css((o?"word":"letter")+"-spacing",(e/(o?n.split(" ").length-1:n.length)).toFixed(b)+"px")}),c.addClass("slabtextdone")}})(),$.noResizeEvent||_(window).resize(function(){_(window).width()!=P&&(P=_(window).width(),clearTimeout(i),i=setTimeout(e,t))}))})}}(jQuery),function(d){function e(e,t,i){if(i[0]&&"object"!=typeof i[0]){if(t[i[0]])return t[i[0]].apply(e,Array.prototype.slice.call(i,1));throw a(i[0]+" is not a method or property")}return t.init.apply(e,i)}function r(e,t,i,n){return{css:{position:"absolute",top:e,left:t,overflow:n||"hidden",zIndex:i||"auto"}}}function l(e,t,i,n,o){var s=1-o,a=s*s*s,r=o*o*o;return L(Math.round(a*e.x+3*o*s*s*t.x+3*o*o*s*i.x+r*n.x),Math.round(a*e.y+3*o*s*s*t.y+3*o*o*s*i.y+r*n.y))}function L(e,t){return{x:e,y:t}}function z(e,t,i){return h&&i?" translate3d("+e+"px,"+t+"px, 0px) ":" translate("+e+"px, "+t+"px) "}function I(e){return" rotate("+e+"deg) "}function c(e,t){return Object.prototype.hasOwnProperty.call(t,e)}function s(){for(var e=["Moz","Webkit","Khtml","O","ms"],t=e.length,i="";t--;)e[t]+"Transform"in document.body.style&&(i="-"+e[t].toLowerCase()+"-");return i}function O(e,t,i,n,o){var s=[];if("-webkit-"==R){for(r=0;r<o;r++)s.push("color-stop("+n[r][0]+", "+n[r][1]+")");e.css({"background-image":"-webkit-gradient(linear, "+t.x+"% "+t.y+"%,"+i.x+"% "+i.y+"%, "+s.join(",")+" )"})}else{t={x:t.x/100*e.width(),y:t.y/100*e.height()};var a=(i={x:i.x/100*e.width(),y:i.y/100*e.height()}).x-t.x,r=i.y-t.y,l=Math.atan2(r,a),c=l-Math.PI/2,c=Math.abs(e.width()*Math.sin(c))+Math.abs(e.height()*Math.cos(c)),a=Math.sqrt(r*r+a*a);i=L(i.x<t.x?e.width():0,i.y<t.y?e.height():0);var u=((r=-1/(u=Math.tan(l)))*i.x-i.y-u*t.x+t.y)/(r-u);for(t=Math.sqrt(Math.pow(u-t.x,2)+Math.pow(r*u-r*i.x+i.y-t.y,2)),r=0;r<o;r++)s.push(" "+n[r][1]+" "+100*(t+a*n[r][0])/c+"%");e.css({"background-image":R+"linear-gradient("+-l+"rad,"+s.join(",")+")"})}}function u(e,t,i){return e=d.Event(e),t.trigger(e,i),e.isDefaultPrevented()?"prevented":e.isPropagationStopped()?"stopped":""}function a(e){function t(e){this.name="TurnJsError",this.message=e}return new((t.prototype=Error()).constructor=t)(e)}function p(e){for(var t={top:0,left:0};t.left+=e.offsetLeft,t.top+=e.offsetTop,e=e.offsetParent;);return t}var h,H,R="",B=Math.PI,j=B/2,g="ontouchstart"in window,m=g?{down:"touchstart mousedown",move:"touchmove mousemove",up:"touchend mouseup",over:"touchstart mouseover",out:"touchend mouseout"}
1:{down:"mousedown",move:"mousemove",up:"mouseup",over:"mouseover",out:"mouseout"},o={backward:["bl","tl"],forward:["br","tr"],all:"tl bl tr br l r".split(" ")},n=["single","double"],i=["ltr","rtl"],f={acceleration:!0,display:"double",duration:600,page:1,gradients:!0,turnCorners:"bl,br",when:null},v={cornerSize:100},y={init:function(e){h="WebKitCSSMatrix"in window||"MozPerspective"in document.body.style,H=!(t=/AppleWebkit\/([0-9\.]+)/i.exec(navigator.userAgent))||534.3<parseFloat(t[1]),R=s();var t=0,i=this.data(),n=this.children();if(e=d.extend({width:this.width(),height:this.height(),direction:this.attr("dir")||this.css("direction")||"ltr"},f,e),i.opts=e,i.pageObjs={},i.pages={},i.pageWrap={},i.pageZoom={},i.pagePlace={},i.pageMv=[],i.zoom=1,i.totalPages=e.pages||0,i.eventHandlers={touchStart:d.proxy(y._touchStart,this),touchMove:d.proxy(y._touchMove,this),touchEnd:d.proxy(y._touchEnd,this),start:d.proxy(y._eventStart,this)},e.when)for(var o in e.when)c(o,e.when)&&this.bind(o,e.when[o]);for(this.css({position:"relative",width:e.width,height:e.height}),this.turn("display",e.display),""!==e.direction&&this.turn("direction",e.direction),h&&!g&&e.acceleration&&this.transform(z(0,0,!0)),o=0;o<n.length;o++)"1"!=d(n[o]).attr("ignore")&&this.turn("addPage",n[o],++t);return d(this).bind(m.down,i.eventHandlers.touchStart).bind("end",y._eventEnd).bind("pressed",y._eventPressed).bind("released",y._eventReleased).bind("flip",y._flip),d(this).parent().bind("start",i.eventHandlers.start),d(document).bind(m.move,i.eventHandlers.touchMove).bind(m.up,i.eventHandlers.touchEnd),this.turn("page",e.page),i.done=!0,this},addPage:function(e,t){var i,n=!1,o=this.data(),s=o.totalPages+1;if(o.destroying)return!1;if(t=(i=/\bp([0-9]+)\b/.exec(d(e).attr("class")))?parseInt(i[1],10):t){if(t==s)n=!0;else if(s<t)throw a('Page "'+t+'" cannot be inserted')}else t=s,n=!0;return 1<=t&&t<=s&&(i="double"==o.display?t%2?" odd":" even":"",o.done&&this.turn("stop"),t in o.pageObjs&&y._movePages.call(this,t,1),n&&(o.totalPages=s),o.pageObjs[t]=d(e).css({float:"left"}).addClass("page p"+t+i),-1!=navigator.userAgent.indexOf("MSIE 9.0")&&o.pageObjs[t].hasClass("hard")&&o.pageObjs[t].removeClass("hard"),y._addPage.call(this,t),y._removeFromDOM.call(this)),this},_addPage:function(e){var t,i=this.data(),n=i.pageObjs[e];n&&(y._necessPage.call(this,e)?(i.pageWrap[e]||(i.pageWrap[e]=d("<div/>",{class:"page-wrapper",page:e,css:{position:"absolute",overflow:"hidden"}}),this.append(i.pageWrap[e]),i.pagePlace[e]||(i.pagePlace[e]=e,i.pageObjs[e].appendTo(i.pageWrap[e])),t=y._pageSize.call(this,e,!0),n.css({width:t.width,height:t.height}),i.pageWrap[e].css(t)),i.pagePlace[e]==e&&y._makeFlip.call(this,e)):(i.pagePlace[e]=0,i.pageObjs[e]&&i.pageObjs[e].remove()))},hasPage:function(e){return c(e,this.data().pageObjs)},center:function(e){var t=this.data(),i=d(this).turn("size"),n=0;return t.noCenter||("double"==t.display&&(e=this.turn("view",e||t.tpage||t.page),"ltr"==t.direction?e[0]?e[1]||(n+=i.width/4):n-=i.width/4:e[0]?e[1]||(n-=i.width/4):n+=i.width/4),d(this).css({marginLeft:n})),this},destroy:function(){var i=this,e=this.data(),t="end first flip last pressed released start turning turned zooming missing".split(" ");if("prevented"!=u("destroying",this)){for(e.destroying=!0,d.each(t,function(e,t){i.unbind(t)}),this.parent().unbind("start",e.eventHandlers.start),d(document).unbind(m.move,e.eventHandlers.touchMove).unbind(m.up,e.eventHandlers.touchEnd);0!==e.totalPages;)this.turn("removePage",e.totalPages);return e.fparent&&e.fparent.remove(),e.shadow&&e.shadow.remove(),this.removeData(),e=null,this}},is:function(){return"object"==typeof this.data().pages},zoom:function(e){var t=this.data();if("number"!=typeof e)return t.zoom;if(e<.001||100<e)throw a(e+" is not a value for zoom");if("prevented"==u("zooming",this,[e,t.zoom]))return this;var i=this.turn("size"),n=this.turn("view"),o=1/t.zoom,s=Math.round(i.width*o*e),i=Math.round(i.height*o*e);for(t.zoom=e,d(this).turn("stop").turn("size",s,i),t.opts.autoCenter&&this.turn("center"),y._updateShadow.call(this),e=0;e<n.length;e++)n[e]&&t.pageZoom[n[e]]!=t.zoom&&(this.trigger("zoomed",[n[e],n,t.pageZoom[n[e]],t.zoom]),t.pageZoom[n[e]]=t.zoom);return this},_pageSize:function(e,t){var i,n,o=this.data(),s={};return"single"==o.display?(s.width=this.width(),s.height=this.height(),t&&(s.top=0,s.left=0,s.right="auto")):(i=this.width()/2,n=this.height(),o.pageObjs[e].hasClass("own-size")?(s.width=o.pageObjs[e].width(),s.height=o.pageObjs[e].height()):(s.width=i,s.height=n),t&&(e=e%2,s.top=(n-s.height)/2,"ltr"==o.direction?(s[e?"right":"left"]=i-s.width,s[e?"left":"right"]="auto"):(s[e?"left":"right"]=i-s.width,s[e?"right":"left"]="auto"))),s},_makeFlip:function(e){var t,i,n=this.data();return n.pages[e]||n.pagePlace[e]!=e||(t="single"==n.display,i=e%2,n.pages[e]=n.pageObjs[e].css(y._pageSize.call(this,e)).flip({page:e,next:i||t?e+1:e-1,turn:this}).flip("disable",n.disabled),y._setPageLoc.call(this,e),n.pageZoom[e]=n.zoom),n.pages[e]},_makeRange:function(){var e,t;if(!(this.data().totalPages<1))for(e=(t=this.turn("range"))[0];e<=t[1];e++)y._addPage.call(this,e)},range:function(e){var t,i,n,o=this.data();if(e=e||o.tpage||o.page||1,n=y._view.call(this,e),e<1||e>o.totalPages)throw a('"'+e+'" is not a valid page');return n[1]=n[1]||n[0],1<=n[0]&&n[1]<=o.totalPages?(e=Math.floor(2),o.totalPages-n[1]>
1n[0]?i=2*e-(t=Math.min(n[0]-1,e)):t=2*e-(i=Math.min(o.totalPages-n[1],e))):i=t=5,[Math.max(1,n[0]-t),Math.min(o.totalPages,n[1]+i)]},_necessPage:function(e){if(0===e)return!0;var t=this.turn("range");return this.data().pageObjs[e].hasClass("fixed")||e>=t[0]&&e<=t[1]},_removeFromDOM:function(){var e,t=this.data();for(e in t.pageWrap)c(e,t.pageWrap)&&!y._necessPage.call(this,e)&&y._removePageFromDOM.call(this,e)},_removePageFromDOM:function(e){var t,i=this.data();i.pages[e]&&(t=i.pages[e].data(),W._moveFoldingPage.call(i.pages[e],!1),t.f&&t.f.fwrapper&&t.f.fwrapper.remove(),i.pages[e].removeData(),i.pages[e].remove(),delete i.pages[e]),i.pageObjs[e]&&i.pageObjs[e].remove(),i.pageWrap[e]&&(i.pageWrap[e].remove(),delete i.pageWrap[e]),y._removeMv.call(this,e),delete i.pagePlace[e],delete i.pageZoom[e]},removePage:function(e){var t=this.data();if("*"==e)for(;0!==t.totalPages;)this.turn("removePage",t.totalPages);else{if(e<1||e>t.totalPages)throw a("The page "+e+" doesn't exist");t.pageObjs[e]&&(this.turn("stop"),y._removePageFromDOM.call(this,e),delete t.pageObjs[e]),y._movePages.call(this,e,-1),--t.totalPages,t.page>t.totalPages?(t.page=null,y._fitPage.call(this,t.totalPages)):(y._makeRange.call(this),this.turn("update"))}return this},_movePages:function(e,o){function t(e){var t=e+o,i=t%2,n=i?" odd ":" even ";a.pageObjs[e]&&(a.pageObjs[t]=a.pageObjs[e].removeClass("p"+e+" odd even").addClass("p"+t+n)),a.pagePlace[e]&&a.pageWrap[e]&&(a.pagePlace[t]=t,a.pageObjs[t].hasClass("fixed")?a.pageWrap[t]=a.pageWrap[e].attr("page",t):a.pageWrap[t]=a.pageWrap[e].css(y._pageSize.call(s,t,!0)).attr("page",t),a.pages[e]&&(a.pages[t]=a.pages[e].flip("options",{page:t,next:r||i?t+1:t-1})),o&&(delete a.pages[e],delete a.pagePlace[e],delete a.pageZoom[e],delete a.pageObjs[e],delete a.pageWrap[e]))}var i,s=this,a=this.data(),r="single"==a.display;if(0<o)for(i=a.totalPages;e<=i;i--)t(i);else for(i=e;i<=a.totalPages;i++)t(i)},display:function(e){var t=this.data(),i=t.display;if(void 0===e)return i;if(-1==d.inArray(e,n))throw a('"'+e+'" is not a value for display');switch(e){case"single":t.pageObjs[0]||(this.turn("stop").css({overflow:"hidden"}),t.pageObjs[0]=d("<div />",{class:"page p-temporal"}).css({width:this.width(),height:this.height()}).appendTo(this)),this.addClass("shadow");break;case"double":t.pageObjs[0]&&(this.turn("stop").css({overflow:""}),t.pageObjs[0].remove(),delete t.pageObjs[0]),this.removeClass("shadow")}return t.display=e,i&&(e=this.turn("size"),y._movePages.call(this,1,0),this.turn("size",e.width,e.height).turn("update")),this},direction:function(e){var t=this.data();if(void 0===e)return t.direction;if(e=e.toLowerCase(),-1==d.inArray(e,i))throw a('"'+e+'" is not a value for direction');return"rtl"==e&&d(this).attr("dir","ltr").css({direction:"ltr"}),t.direction=e,t.done&&this.turn("size",d(this).width(),d(this).height()),this},animating:function(){return 0<this.data().pageMv.length},corner:function(){var e,t,i=this.data();for(t in i.pages)if(c(t,i.pages)&&(e=i.pages[t].flip("corner")))return e;return!1},data:function(){return this.data()},disable:function(e){var t,i=this.data(),n=this.turn("view");for(t in i.disabled=void 0===e||!0===e,i.pages)c(t,i.pages)&&i.pages[t].flip("disable",!!i.disabled||-1==d.inArray(parseInt(t,10),n));return this},disabled:function(e){return void 0===e?!0===this.data().disabled:this.turn("disable",e)},size:function(e,t){if(void 0===e||void 0===t)return{width:this.width(),height:this.height()};this.turn("stop");var i,n=this.data(),o="double"==n.display?e/2:e;for(i in this.css({width:e,height:t}),n.pageObjs[0]&&n.pageObjs[0].css({width:o,height:t}),n.pageWrap)c(i,n.pageWrap)&&(o=y._pageSize.call(this,i,!0),n.pageObjs[i].css({width:o.width,height:o.height}),n.pageWrap[i].css(o),n.pages[i]&&n.pages[i].css({width:o.width,height:o.height}));return this.turn("resize"),this},resize:function(){var e,t=this.data();for(t.pages[0]&&(t.pageWrap[0].css({left:-this.width()}),t.pages[0].flip("resize",!0)),e=1;e<=t.totalPages;e++)t.pages[e]&&t.pages[e].flip("resize",!0);y._updateShadow.call(this),t.opts.autoCenter&&this.turn("center")},_removeMv:function(e){for(var t=this.data(),i=0;i<t.pageMv.length;i++)if(t.pageMv[i]==e)return t.pageMv.splice(i,1),!0;return!1},_addMv:function(e){var t=this.data();y._removeMv.call(this,e),t.pageMv.push(e)},_view:function(e){var t=this.data();return e=e||t.page,"double"==t.display?e%2?[e-1,e]:[e,e+1]:[e]},view:function(e){var t=this.data();return e=y._view.call(this,e),"double"==t.display?[0<e[0]?e[0]:0,e[1]<=t.totalPages?e[1]:0]:[0<e[0]&&e[0]<=t.totalPages?e[0]:0]},stop:function(e,t){if(this.turn("animating")){var i,n,o,s=this.data();for(s.tpage&&(s.page=s.tpage,delete s.tpage),i=0;i<s.pageMv.length;i++)s.pageMv[i]&&s.pageMv[i]!==e&&(n=(o=s.pages[s.pageMv[i]]).data().f.opts,o.flip("hideFoldedPage",t),t||W._moveFoldingPage.call(o,!1),n.force&&(n.next=0==n.page%2?n.page-1:n.page+1,delete n.force))}return this.turn("update"),this},pages:function(e){var t=this.data();if(e){if(e<t.totalPages)for(var i=t.totalPages;e<i;i--)this.turn("removePage",i);return t.totalPages=e,y._fitPage.call(this,t.page),this}return t.totalPages},_missing:function(e){var t=this.data();if(!(t.totalPages<1)){var i=this.turn("range",e),n=[];for(e=i[0];e<=i[1];e++)t.pageObjs[e]||n.push(e);0<n.length&&this.trigger("missing",[n])}},_fitPage:function(e){var t=this.data(),i=this.turn("view",e);if(y._missing.call(this,e),t.pageObjs[e]){t.page=e,this.turn("stop");for(var n=0;n<i.length;n++)i[n]&&t.pageZoom[i[n]]!=t.zoom&&(this.trigger("zoomed",[i[n],i,t.pageZoom[i[n]],t.zoom]),t.pageZoom[i[n]]=t.zoom);y._removeFromDOM.call(this),y._makeRange.call(this),y._updateShadow.call(this),this.trigger("turned",[e,i]),this.turn("update"),t.opts.autoCenter&&this.turn("center")}},_turnPage:function(e){var t,i,n=this.data(),o=n.pagePlace[e],s=this.turn("view"),a=this.turn("view",e);if(n.page!=e){var r=n.page;if("prevented"==u("turning",this,[e,a]))return void(r==n.page&&-1!=d.inArray(o,n.pageMv)&&n.pages[o].flip("hideFoldedPage",!0));-1!=d.inArray(1,a)&&this.trigger("first"),-1!=d.inArray(n.totalPages,a)&&this.trigger("last")}"single"==n.display?(t=s[0],i=a[0]):s[1]&&e>s[1]?(t=s[1],i=a[0]):s[0]&&e<s[0]&&(t=s[0],i=a[1]),o=n.opts.turnCorners.split(","),a=(s=n.pages[t].data().f).opts,r=s.point,y._missing.call(this,e),n.pageObjs[e]&&(this.turn("stop"),n.page=e,y._makeRange.call(this),n.tpage=i,a.next!=i&&(a.next=i,a.force=!0),this.turn("update"),s.point=r,"hard"==s.effect?"ltr"==n.direction?n.pages[t].flip("turnPage",t<e?"r":"l"):n.pages[t].flip("turnPage",t<e?"l":"r"):"ltr"==n.direction?n.pages[t].flip("turnPage",o[t<e?1:0]):n.pages[t].flip("turnPage",o[t<e?0:1]))},page:function(e){var t=this.data();if(void 0===e)return t.page;if(!t.disabled&&!t.destroying){if(0<(e=parseInt(e,10))&&e<=t.totalPages)return e!=t.page&&(t.done&&-1==d.inArray(e,this.turn("view"))?y._turnPage:y._fitPage).call(this,e),this;throw a("The page "+e+" does not exist")}},next:function(){return this.turn("page",Math.min(this.data().totalPages,y._view.call(this,this.data().page).pop()+1))},previous:function(){return this.turn("page",Math.max(1,y._view.call(this,this.data().page).shift()-1))},peel:function(e,t){var i=this.data(),n=this.turn("view");return t=void 0===t||!0===t,!1===e?this.turn("stop",null,t):"single"==i.display?i.pages[i.page].flip("peel",e,t):(n="ltr"==i.direction?-1!=e.indexOf("l")?n[0]:n[1]:-1!=e.indexOf("l")?n[1]:n[0],i.pages[n]&&i.pages[n].flip("peel",e,t)),this},_addMotionPage:function(){var e=d(this).data().f.opts,t=e.turn;t.data(),y._addMv.call(t,e.page)},_eventStart:function(e,t,i){var n=t.turn.data(),o=n.pageZoom[t.page];e.isDefaultPrevented()||(o&&o!=n.zoom&&(t.turn.trigger("zoomed",[t.page,t.turn.turn("view",t.page),o,n.zoom]),n.pageZoom[t.page]=n.zoom),"single"==n.display&&i&&("l"==i.charAt(1)&&"ltr"==n.direction||"r"==i.charAt(1)&&"rtl"==n.direction?(t.next=t.next<t.page?t.next:t.page-1,t.force=!0):t.next=t.next>t.page?t.next:t.page+1),y._addMotionPage.call(e.target)),y._updateShadow.call(t.turn)},_eventEnd:function(e,t,i){d(e.target).data();var n=(e=t.turn).data();i?(i=n.tpage||n.page)!=t.next&&i!=t.page||(delete n.tpage,y._fitPage.call(e,i||t.next,!0)):(y._removeMv.call(e,t.page),y._updateShadow.call(e),e.turn("update"))},_eventPressed:function(e){var t=(e=d(e.target).data().f).opts.turn;return t.data().mouseAction=!0,t.turn("update"),e.time=(new Date).getTime()},_eventReleased:function(e,t){var i=d(e.target),n=i.data().f,o=n.opts.turn,s=o.data();i="single"==s.display?"br"==t.corner||"tr"==t.corner?t.x<i.width()/2:t.x>i.width()/2:t.x<0||t.x>i.width(),((new Date).getTime()-n.time<200||i)&&(e.preventDefault(),y._turnPage.call(o,n.opts.next)),s.mouseAction=!1},_flip:function(e){e.stopPropagation(),(e=d(e.target).data().f.opts).turn.trigger("turn",[e.next]),e.turn.data().opts.autoCenter&&e.turn.turn("center",e.next)},_touchStart:function(){var e,t=this.data();for(e in t.pages)if(c(e,t.pages)&&!1===W._eventStart.apply(t.pages[e],arguments))return!1},_touchMove:function(){var e,t=this.data();for(e in t.pages)c(e,t.pages)&&W._eventMove.apply(t.pages[e],arguments)},_touchEnd:function(){var e,t=this.data();for(e in t.pages)c(e,t.pages)&&W._eventEnd.apply(t.pages[e],arguments)},calculateZ:function(e){function t(e){(e=s.turn("view",e))[0]&&(u.pageV[e[0]]=!0),e[1]&&(u.pageV[e[1]]=!0)}var i,n,o,s=this,a=this.data(),r=this.turn("view"),l=r[0]||r[1],c=e.length-1,u={pageZ:{},partZ:{},pageV:{}};for(r=0;r<=c;r++)i=e[r],n=a.pages[i].data().f.opts.next,o=a.pagePlace[i],t(i),t(n),i=a.pagePlace[n]==n?n:i,u.pageZ[i]=a.totalPages-Math.abs(l-i),u.partZ[o]=2*a.totalPages-c+r;return u},update:function(){var e,t=this.data();if(this.turn("animating")&&0!==t.pageMv[0]){var i,n=this.turn("c
1alculateZ",t.pageMv),o=this.turn("corner"),s=this.turn("view"),a=this.turn("view",t.tpage);for(e in t.pageWrap)c(e,t.pageWrap)&&(i=t.pageObjs[e].hasClass("fixed"),t.pageWrap[e].css({display:n.pageV[e]||i?"":"none",zIndex:(t.pageObjs[e].hasClass("hard")?n.partZ:n.pageZ)[e]||(i?-1:0)}),i=t.pages[e])&&(i.flip("z",n.partZ[e]||null),n.pageV[e]&&i.flip("resize"),t.tpage?i.flip("hover",!1).flip("disable",-1==d.inArray(parseInt(e,10),t.pageMv)&&e!=a[0]&&e!=a[1]):i.flip("hover",!1===o).flip("disable",e!=s[0]&&e!=s[1]))}else for(e in t.pageWrap)c(e,t.pageWrap)&&(n=y._setPageLoc.call(this,e),t.pages[e]&&t.pages[e].flip("disable",t.disabled||1!=n).flip("hover",!0).flip("z",null));return this},_updateShadow:function(){var e,t=this.data(),i=this.width(),n=this.height(),o="single"==t.display?i:i/2,s=this.turn("view");t.shadow||(t.shadow=d("<div />",{class:"shadow",css:r(0,0,0).css}).appendTo(this));for(var a=0;a<t.pageMv.length&&s[0]&&s[1];a++)s=this.turn("view",t.pages[t.pageMv[a]].data().f.opts.next),e=this.turn("view",t.pageMv[a]),s[0]=s[0]&&e[0],s[1]=s[1]&&e[1];switch(s[0]?s[1]?3:"ltr"==t.direction?2:1:"ltr"==t.direction?1:2){case 1:t.shadow.css({width:o,height:n,top:0,left:o});break;case 2:t.shadow.css({width:o,height:n,top:0,left:0});break;case 3:t.shadow.css({width:i,height:n,top:0,left:0})}},_setPageLoc:function(e){var t=this.data(),i=this.turn("view"),n=0;if(e==i[0]||e==i[1]?n=1:("single"==t.display&&e==i[0]+1||"double"==t.display&&e==i[0]-2||e==i[1]+2)&&(n=2),!this.turn("animating"))switch(n){case 1:t.pageWrap[e].css({zIndex:t.totalPages,display:""});break;case 2:t.pageWrap[e].css({zIndex:t.totalPages-1,display:""});break;case 0:t.pageWrap[e].css({zIndex:0,display:t.pageObjs[e].hasClass("fixed")?"":"none"})}return n},options:function(e){if(void 0===e)return this.data().opts;var t=this.data();if(d.extend(t.opts,e),e.pages&&this.turn("pages",e.pages),e.page&&this.turn("page",e.page),e.display&&this.turn("display",e.display),e.direction&&this.turn("direction",e.direction),e.width&&e.height&&this.turn("size",e.width,e.height),e.when)for(var i in e.when)c(i,e.when)&&this.unbind(i).bind(i,e.when[i]);return this},version:function(){return"4.1.0"}},W={init:function(e){return this.data({f:{disabled:!1,hover:!1,effect:this.hasClass("hard")?"hard":"sheet"}}),this.flip("options",e),W._addPageWrapper.call(this),this},setData:function(e){var t=this.data();return t.f=d.extend(t.f,e),this},options:function(e){var t=this.data().f;return e?(W.setData.call(this,{opts:d.extend({},t.opts||v,e)}),this):t.opts},z:function(e){var t=this.data().f;return t.opts["z-index"]=e,t.fwrapper&&t.fwrapper.css({zIndex:e||parseInt(t.parent.css("z-index"),10)||0}),this},_cAllowed:function(){var e=this.data().f,t=e.opts.page,i=e.opts.turn.data(),n=t%2;return"hard"==e.effect?"ltr"==i.direction?[n?"r":"l"]:[n?"l":"r"]:"single"==i.display?1==t?"ltr"==i.direction?o.forward:o.backward:t==i.totalPages?"ltr"==i.direction?o.backward:o.forward:o.all:"ltr"==i.direction?o[n?"forward":"backward"]:o[n?"backward":"forward"]},_cornerActivated:function(e){var t=this.data().f,i=this.width(),n=this.height();e={x:e.x,y:e.y,corner:""};var o=t.opts.cornerSize;if(e.x<=0||e.y<=0||e.x>=i||e.y>=n)return!1;var s=W._cAllowed.call(this);switch(t.effect){case"hard":if(e.x>i-o)e.corner="r";else{if(!(e.x<o))return!1;e.corner="l"}break;case"sheet":if(e.y<o)e.corner+="t";else{if(!(e.y>=n-o))return!1;e.corner+="b"}if(e.x<=o)e.corner+="l";else{if(!(e.x>=i-o))return!1;e.corner+="r"}}return!(!e.corner||-1==d.inArray(e.corner,s))&&e},_isIArea:function(e){var t=this.data().f.parent.offset();return e=g&&e.originalEvent&&e.originalEvent.touches?e.originalEvent.touches[0]:e,W._cornerActivated.call(this,{x:e.pageX-t.left,y:e.pageY-t.top})},_c:function(e,t){switch(t=t||0,e){case"tl":return L(t,t);case"tr":return L(this.width()-t,t);case"bl":return L(t,this.height()-t);case"br":return L(this.width()-t,this.height()-t);case"l":return L(t,0);case"r":return L(this.width()-t,0)}},_c2:function(e){switch(e){case"tl":return L(2*this.width(),0);case"tr":return L(-this.width(),0);case"bl":return L(2*this.width(),this.height());case"br":return L(-this.width(),this.height());case"l":return L(2*this.width(),0);case"r":return L(-this.width(),0)}},_foldingPage:function(){var e=this.data().f;if(e){var t=e.opts;if(t.turn)return"single"==(e=t.turn.data()).display?1<t.next||1<t.page?e.pageObjs[0]:null:e.pageObjs[t.next]}},_backGradient:function(){var e=this.data().f,t=e.opts.turn.data();return(t=t.opts.gradients&&("single"==t.display||2!=e.opts.page&&e.opts.page!=t.totalPages-1))&&!e.bshadow&&(e.bshadow=d("<div/>",r(0,0,1)).css({position:"",width:this.width(),height:this.height()}).appendTo(e.parent)),t},type:function(){return this.data().f.effect},resize:function(e){var t=this.data().f,i=t.opts.turn.data(),n=this.width(),o=this.height();switch(t.effect){case"hard":e&&(t.wrapper.css({width:n,height:o}),t.fpage.css({width:n,height:o}),i.opts.gradients&&(t.ashadow.css({width:n,height:o}),t.bshadow.css({width:n,height:o})));break;case"sheet":e&&(e=Math.round(Math.sqrt(Math.pow(n,2)+Math.pow(o,2))),t.wrapper.css({width:e,height:e}),t.fwrapper.css({width:e,height:e}).children(":first-child").css({width:n,height:o}),t.fpage.css({width:n,height:o}),i.opts.gradients&&t.ashadow.css({width:n,height:o}),W._backGradient.call(this)&&t.bshadow.css({width:n,height:o})),t.parent.is(":visible")&&(i=p(t.parent[0]),t.fwrapper.css({top:i.top,left
1:i.left}),i=p(t.opts.turn[0]),t.fparent.css({top:-i.top,left:-i.left})),this.flip("z",t.opts["z-index"])}},_addPageWrapper:function(){var e=this.data().f,t=e.opts.turn.data(),i=this.parent();if(e.parent=i,!e.wrapper)switch(e.effect){case"hard":var n={};n[R+"transform-style"]="preserve-3d",n[R+"backface-visibility"]="hidden",e.wrapper=d("<div/>",r(0,0,2)).css(n).appendTo(i).prepend(this),e.fpage=d("<div/>",r(0,0,1)).css(n).appendTo(i),t.opts.gradients&&(e.ashadow=d("<div/>",r(0,0,0)).hide().appendTo(i),e.bshadow=d("<div/>",r(0,0,0)));break;case"sheet":this.width(),this.height(),e.fparent=e.opts.turn.data().fparent,e.fparent||((n=d("<div/>",{css:{"pointer-events":"none"}}).hide()).data().flips=0,n.css(r(0,0,"auto","visible").css).appendTo(e.opts.turn),e.opts.turn.data().fparent=n,e.fparent=n),this.css({position:"absolute",top:0,left:0,bottom:"auto",right:"auto"}),e.wrapper=d("<div/>",r(0,0,this.css("z-index"))).appendTo(i).prepend(this),e.fwrapper=d("<div/>",r(i.offset().top,i.offset().left)).hide().appendTo(e.fparent),e.fpage=d("<div/>",r(0,0,0,"visible")).css({cursor:"default"}).appendTo(e.fwrapper),t.opts.gradients&&(e.ashadow=d("<div/>",r(0,0,1)).appendTo(e.fpage)),W.setData.call(this,e)}W.resize.call(this,!0)},_fold:function(o){var c=this.data().f,u=c.opts.turn.data(),s=W._c.call(this,o.corner),d=this.width(),p=this.height();switch(c.effect){case"hard":o.x="l"==o.corner?Math.min(Math.max(o.x,0),2*d):Math.max(Math.min(o.x,d),-d);var e,t,i,n,a=u.totalPages,r=c.opts["z-index"]||a,l={overflow:"visible"},h=s.x?(s.x-o.x)/d:o.x/d,g=90*h,m=g<90;switch(o.corner){case"l":i="0% 50%",n="100% 50%",t=m?(e=(E=0)<c.opts.next-1,1):(E="100%",e=c.opts.page+1<a,0);break;case"r":i="100% 50%",n="0% 50%",g=-g,d=-d,t=m?(e=c.opts.next+1<a,E=0):(E="-100%",e=1!=c.opts.page,1)}l[R+"perspective-origin"]=n,c.wrapper.transform("rotateY("+g+"deg)translate3d(0px, 0px, "+(this.attr("depth")||0)+"px)",n),c.fpage.transform("translateX("+d+"px) rotateY("+(180+g)+"deg)",i),c.parent.css(l),m?(h=1-h,c.wrapper.css({zIndex:r+1}),c.fpage.css({zIndex:r})):(--h,c.wrapper.css({zIndex:r}),c.fpage.css({zIndex:r+1})),u.opts.gradients&&(e?c.ashadow.css({display:"",left:E,backgroundColor:"rgba(0,0,0,"+.5*h+")"}).transform("rotateY(0deg)"):c.ashadow.hide(),c.bshadow.css({opacity:1-h}),m?c.bshadow.parent()[0]!=c.wrapper[0]&&c.bshadow.appendTo(c.wrapper):c.bshadow.parent()[0]!=c.fpage[0]&&c.bshadow.appendTo(c.fpage),O(c.bshadow,L(100*t,0),L(100*(1-t),0),[[0,"rgba(0,0,0,0.3)"],[1,"rgba(0,0,0,0)"]],2));break;case"sheet":var f,v,y,b,w,P,x=this,C=0,$=L(0,0),_=L(0,0),A=L(0,0),S=W._foldingPage.call(this),T=u.opts.acceleration,M=c.wrapper.height(),k="t"==o.corner.substr(0,1),F="l"==o.corner.substr(1,1),D=function(){var e=L(0,0),t=L(0,0);e.x=s.x?s.x-o.x:o.x,e.y=H?s.y?s.y-o.y:o.y:0,t.x=F?d-e.x/2:o.x+e.x/2,t.y=e.y/2;var i=j-Math.atan2(e.y,e.x),n=Math.max(0,Math.sin(i-Math.atan2(t.y,t.x))*Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2)));return C=i/B*180,A=L(n*Math.sin(i),n*Math.cos(i)),j<i&&(A.x+=Math.abs(A.y*e.y/e.x),A.y=0,Math.round(A.x*Math.tan(B-i))<p)?(o.y=Math.sqrt(Math.pow(p,2)+2*t.x*e.x),k&&(o.y=p-o.y),D()):(j<i&&(e=B-i,t=M-p/Math.sin(e),$=L(Math.round(t*Math.cos(e)),Math.round(t*Math.sin(e))),F&&($.x=-$.x),k&&($.y=-$.y)),b=Math.round(A.y/Math.tan(i)+A.x),t=(e=d-b)*Math.cos(2*i),n=e*Math.sin(2*i),_=L(Math.round(F?e-t:b+t),Math.round(k?n:p-n)),u.opts.gradients&&(b=e*Math.sin(i),e=W._c2.call(x,o.corner),e=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2))/d,P=Math.sin(j*(1<e?2-e:e)),w=Math.min(e,1),y=100<b?(b-100)/b:0,f=L(b*Math.sin(i)/d*100,b*Math.cos(i)/p*100),W._backGradient.call(x)&&(v=L(1.2*b*Math.sin(i)/d*100,1.2*b*Math.cos(i)/p*100),F||(v.x=100-v.x),k||(v.y=100-v.y))),A.x=Math.round(A.x),A.y=Math.round(A.y),!0)},E=function(e,t,i,n){var o=(d-M)*i[0]/100,s=(p-M)*i[1]/100;t={left:(a=["0","auto"])[t[0]],top:a[t[1]],right:a[t[2]],bottom:a[t[3]]};var a={},r=90!=n&&-90!=n?F?-1:1:0,l=i[0]+"% "+i[1]+"%";x.css(t).transform(I(n)+z(e.x+r,e.y,T),l),c.fpage.css(t).transform(I(n)+z(e.x+_.x-$.x-d*i[0]/100,e.y+_.y-$.y-p*i[1]/100,T)+I((180/n-2)*n),l),c.wrapper.transform(z(-e.x+o-r,-e.y+s,T)+I(-n),l),c.fwrapper.transform(z(-e.x+$.x+o,-e.y+$.y+s,T)+I(-n),l),u.opts.gradients&&(i[0]&&(f.x=100-f.x),i[1]&&(f.y=100-f.y),a["box-shadow"]="0 0 20px rgba(0,0,0,"+.5*P+")",S.css(a),O(c.ashadow,L(F?100:0,k?0:100),L(f.x,f.y),[[y,"rgba(0,0,0,0)"],[.8*(1-y)+y,"rgba(0,0,0,"+.2*w+")"],[1,"rgba(255,255,255,"+.2*w+")"]],3),W._backGradient.call(x)&&O(c.bshadow,L(F?0:100,k?0:100),L(v.x,v.y),[[.6,"rgba(0,0,0,0)"],[.8,"rgba(0,0,0,"+.3*w+")"],[1,"rgba(0,0,0,0)"]],3))};switch(o.corner){case"tl":o.x=Math.max(o.x,1),D(),E(A,[1,0,0,1],[100,0],C);break;case"tr":o.x=Math.min(o.x,d-1),D(),E(L(-A.x,A.y),[0,0,0,1],[0,0],-C);break;case"bl":o.x=Math.max(o.x,1),D(),E(L(A.x,-A.y),[1,1,0,0],[100,100],-C);break;case"br":o.x=Math.min(o.x,d-1),D(),E(L(-A.x,-A.y),[0,1,1,0],[0,100],C)}}c.point=o},_moveFoldingPage:function(e){var t,i,n,o=this.data().f;o&&(n=(i=(t=o.opts.turn).data()).pagePlace,e?(n[i=o.opts.next]!=o.opts.page&&(o.folding&&W._moveFoldingPage.call(this,!1),W._foldingPage.call(this).appendTo(o.fpage),n[i]=o.opts.page,o.folding=i),t.turn("update")):o.folding&&(i.pages[o.folding]?(t=i.pages[o.folding].data().f,i.pageObjs[o.folding].appendTo(t.wrapper)):i.pageWrap[o.folding]&&i.pageObjs[o.folding].appendTo(i.pageWrap[o.folding]),o.folding in n&&(n[o.folding]=o.folding),delete o.folding))},_showFoldedPage:function(t,e){var i,n=W._foldingPage.call(this),o=this.data(),s=o.f,a=s.visible;if(n){if(!(a&&s.point&&s.point.corner==t.corner||(n="hover"==s.status||"peel"==s.status||s.opts.turn.data().mouseAction?t.corner:null,a=!1,"prevented"!=u("start",this,[s.opts,n]))))return!1;if(e?(i=this,o=s.point&&s.point.corner==t.corner?s.point:W._c.call(this,t.corner,1),this.animatef({from:[o.x,o.y],to:[t.x,t.y],duration:500,frame:function(e){t.x=Math.round(e[0]),t.y=Math.round(e[1]),W._fold.call(i,t)}})):(W._fold.call(this,t),o.effect&&!o.effect.turning&&this.animatef(!1)),!
1a)switch(s.effect){case"hard":s.visible=!0,W._moveFoldingPage.call(this,!0),s.fpage.show(),s.opts.shadows&&s.bshadow.show();break;case"sheet":s.visible=!0,s.fparent.show().data().flips++,W._moveFoldingPage.call(this,!0),s.fwrapper.show(),s.bshadow&&s.bshadow.show()}return!0}return!1},hide:function(){var e=this.data().f,t=e.opts.turn.data(),i=W._foldingPage.call(this);switch(e.effect){case"hard":t.opts.gradients&&(e.bshadowLoc=0,e.bshadow.remove(),e.ashadow.hide()),e.wrapper.transform(""),e.fpage.hide();break;case"sheet":0==--e.fparent.data().flips&&e.fparent.hide(),this.css({left:0,top:0,right:"auto",bottom:"auto"}).transform(""),e.wrapper.transform(""),e.fwrapper.hide(),e.bshadow&&e.bshadow.hide(),i.transform("")}return e.visible=!1,this},hideFoldedPage:function(e){var t,i,n,o,s,a,r=this.data().f;r.point&&(t=this,i=r.point,n=function(){r.point=null,r.status="",t.flip("hide"),t.trigger("end",[r.opts,!1])},e?(o=W._c.call(this,i.corner),e="t"==i.corner.substr(0,1)?Math.min(0,i.y-o.y)/2:Math.max(0,i.y-o.y)/2,s=L(i.x,i.y+e),a=L(o.x,o.y-e),this.animatef({from:0,to:1,frame:function(e){e=l(i,s,a,o,e),i.x=e.x,i.y=e.y,W._fold.call(t,i)},complete:n,duration:800,hiding:!0})):(this.animatef(!1),n()))},turnPage:function(t){var i=this,e=this.data().f,n=e.opts.turn.data();
1t={corner:e.corner?e.corner.corner:t||W._cAllowed.call(this)[0]};var o=e.point||W._c.call(this,t.corner,e.opts.turn?n.opts.elevation:0),s=W._c2.call(this,t.corner);this.trigger("flip").animatef({from:0,to:1,frame:function(e){e=l(o,o,s,s,e),t.x=e.x,t.y=e.y,W._showFoldedPage.call(i,t)},complete:function(){i.trigger("end",[e.opts,!0])},duration:n.opts.duration,turning:!0}),e.corner=null},moving:function(){return"effect"in this.data()},isTurning:function(){return this.flip("moving")&&this.data().effect.turning},corner:function(){return this.data().f.corner},_eventStart:function(e){var t=this.data().f,i=t.opts.turn;if(!t.corner&&!t.disabled&&!this.flip("isTurning")&&t.opts.page==i.data().pagePlace[t.opts.page]){if(t.corner=W._isIArea.call(this,e),t.corner&&W._foldingPage.call(this))return this.trigger("pressed",[t.point]),W._showFoldedPage.call(this,t.corner),!1;t.corner=null}},_eventMove:function(e){var t,i=this.data().f;i.disabled||(e=g&&e.originalEvent.touches?e.originalEvent.touches:[e],i.corner?(t=i.parent.offset(),i.corner.x=e[0].pageX-t.left,i.corner.y=e[0].pageY-t.top,W._showFoldedPage.call(this,i.corner)):i.hover&&!this.data().effect&&this.is(":visible")&&((e=W._isIArea.call(this,e[0]))?("sheet"==i.effect&&2==e.corner.length||"hard"==i.effect)&&(i.status="hover",i=W._c.call(this,e.corner,i.opts.cornerSize/2),e.x=i.x,e.y=i.y,W._showFoldedPage.call(this,e,!0)):"hover"==i.status&&(i.status="",W.hideFoldedPage.call(this,!0))))},_eventEnd:function(){var e=this.data().f,t=e.corner;!e.disabled&&t&&"prevented"!=u("released",this,[e.point||t])&&W.hideFoldedPage.call(this,!0),e.corner=null},disable:function(e){return W.setData.call(this,{disabled:e}),this},hover:function(e){return W.setData.call(this,{hover:e}),this},peel:function(e,t){var i,n=this.data().f;if(e){if(-1==d.inArray(e,o.all))throw a("Corner "+e+" is not permitted");-1!=d.inArray(e,W._cAllowed.call(this))&&(i=W._c.call(this,e,n.opts.cornerSize/2),n.status="peel",W._showFoldedPage.call(this,{corner:e,x:i.x,y:i.y},t))}else n.status="",W.hideFoldedPage.call(this,t);return this}};window.requestAnim=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)},d.extend(d.fn,{flip:function(){return e(d(this[0]),W,arguments)},turn:function(){return e(d(this[0]),y,arguments)},transform:function(e,t){var i={};return t&&(i[R+"transform-origin"]=t),i[R+"transform"]=e,this.css(i)},animatef:function(n){var o=this.data();if(o.effect&&o.effect.stop(),n){n.to.length||(n.to=[n.to]),n.from.length||(n.from=[n.from]);for(var s=[],a=n.to.length,r=!0,l=this,c=(new Date).getTime(),u=function(){if(o.effect&&r){for(var e=[],t=Math.min(n.duration,(new Date).getTime()-c),i=0;i<a;i++)e.push(o.effect.easing(1,t,n.from[i],s[i],n.duration));n.frame(1==a?e[0]:e),t==n.duration?(delete o.effect,l.data(o),n.complete&&n.complete()):window.requestAnim(u)}},e=0;e<a;e++)s.push(n.to[e]-n.from[e]);o.effect=d.extend({stop:function(){r=!1},easing:function(e,t,i,n,o){return n*Math.sqrt(1-(t=t/o-1)*t)+i}},n),this.data(o),u()}else delete o.effect}}),d.isTouch=g,d.mouseEvents=m,d.cssPrefix=s,d.cssTransitionEnd=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MSTransition:"transitionend",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]},d.findPos=p}(jQuery),angular.module("worldPolicyForumApp").service("api",["$http","$q","$timeout","utils",function(n,i,t,e){var o=null,s=null,a=null,r=null,l=null,c=null,u=null,d=function(e){if(e.preferredTitle=e.alt_title||e.title,e.pages)for(var t=0;t<e.pages.length;t++)d(e.pages[t]);return e};this.getHomepage=function(){return u=null===u?n.get("/api/v2/home.json").then(function(e){return e.data}):u},this.getNews=function(){return n.get("/api/news.json").then(function(e){return e.data.list})},this.getNewsDetails=function(e){return n.get("/api/news/"+e+".php")},this.getPolicies=function(){return n.get("/api/policies.json").then(function(e){return e.data.list})},this.getPoliciesOfTopic=function(e){this.cancelGetPoliciesOfTopic(),a=i.defer();var t=this;return n.get("/api"+e+".json",{timeout:a.promise}).then(function(e){return t.makePolicyGroups(e.data.data)})},this.makePolicyGroups=function(e){if(e){var t=[];e.policies&&e.policies.length&&t.push(e);for(var i=0;e.subtopics&&i<e.subtopics.length;i++){var n=e.subtopics[i];n.policies&&n.policies.length&&t.push(n)}return t}},this.cancelGetPoliciesOfTopic=function(){a&&(a.resolve(),a=null)},this.getPolicyDetails=function(e,t,i){return n({method:"GET",url:"/api/policies/"+e+".json",timeout:i,params:{topic:t}}).then(function(e){return e.data.data})},this.getTopics=function(){return o=o||n.get("/api/topics.json").then(function(e){return e.data.list})}
1,this.getTopicDetails=function(e,t){return n({method:"GET",url:"/api/topics/"+e+".json",timeout:t}).then(function(e){return e.data.data})},this.getCountries=function(){return s=s||n.get("/api/countries.json").then(function(e){return e.data.list})},this.getCountryDetails=function(e){return n.get("/api/countries/"+e).then(function(e){return e.data.data})},this.getAgreements=function(){var e=i.defer();return t(function(){e.resolve([{id:"crc",name:"CRD 25th Anniversary",body:'<p>On November 20, 1989, the U.N. General Assembly adopted the Convention on the Rights of the Child, a landmark agreement that laid the foundation for children’s rights around the globe. Today, the CRC is the most widely ratified human rights treaty in history; 190 UN Member States have committed to upholding its crucial rights and protections relating to education, child labor, child marriage, and a range of other issues central to children’s health and development.</p><p>But 25 years later, how much progress have countries made toward realizing the promise of the CRC?  WORLD’s data can help you see which countries have developed legal frameworks to help ensure equal opportunities for all children—and which are falling short. While effective implementation is equally essential, enacting laws and policies that embody the CRC’s principles is a vital step toward fulfilling its potential.</p><p>In this section, you’ll find public use data, fact sheets, maps, and infographics that will help you learn how laws can improve children’s lives, see how your country’s policies compare to the rest of the world, and spread the word about the importance of children’s rights on social media. </p><p>To dive into our new Childhood Public Use Dataset, <a href="/">click here</a> for access.</p><p>For further analysis, check out WORLD’s new reports, articles, and editorials highlighting key findings and reflecting on the CRC’s 25th anniversary:</p><p><a href="/">“The Convention on the Rights of the Child: What it would mean to fulfil its potential”</a> – UNICEF’s report on the 25th anniversary of the CRC</br><a href="/">“Assessing Compliance with the CRC: Indicators of Law and Policy in 191 Countries”</a> – The International Journal of Children’s Rights</br>Are American Children Better Off Today Than They Were in 1989? – Zócalo – 11/28/2014</br><a href="/">“Children’s Right to Education: Where Does the World Stand?”</a>  – Huffington Post – 11/06/2014</br><a href="/">“85 Million Children Work in Dangerous Conditions: Are Governments Fulfilling Their Promise to Prevent This?”</a> – Huffington Post – 11/13/2014</br><a href="/">“The Legal Loopholes That Perpetuate Child Marriage”</a> – Huffington Post – 11/18/2014</br><a href="/">“Strengthening Children’s Rights Through Better Data”</a> – Huffington Post – 11/20/2014</p>'},{id:"placeholder",name:"Agreement Placeholder"}])}),e.promise},this.getGlobalAgreements=function(){return r=r||n.get("/api/pages/global-agreements").then(function(e){return d(e.data.data)})},this.getTopicAgreementPolicy=function(e){return l&&(l.resolve(),l=null),l=i.defer(),n.get("/api"+e,{timeout:l.promise}).then(function(e){return e.data.data})},this.getTopicAgreement=function(e){return c&&(c.resolve(),c=null),c=i.defer(),n.get("/api"+e,{timeout:c.promise}).then(function(e){return e.data.data})},this.getRankingDetails=function(e){return n.get("/api"+e).then(function(e){return e.data.data})},this.getTopicResources=function(e){return n.get("/api/topics/"+e+"/resources").then(function(e){return e.data.data})},this.getPage=function(e){return n.get("/api/pages"+e).then(function(e){return d(e.data.data)})},this.getCards=function(){return n.get("/api/cards.json").then(function(e){return e.data.data})},this.getCardDetail=function(e){return n.get("/api/card/"+e+".json").then(function(e){return e.data.data})},this.comparePolicies=function(e){return n.get("/api/policies/compare?policies="+e.join()).then(function(e){return e.data})}}]),angular.module("worldPolicyForumApp").controller("AppController",["$rootScope","$scope","$http","$state","$anchorScroll","api","settings","configs","analytics","pageTitle",function(e,s,t,i,a,n,o,r,l,c){s.$state=i,s.settings=o,s.configs=r,s.showMenu=null,s.$watch("showMenu",function(t){null!==t&&setTimeout(function(){(t?$("header .navbar button.close-btn"):$("header .navbar button").first())[
10].focus()},100),setTimeout(function(){var e=$("body .weglot-container");e.detach().appendTo(".weglot-desktop"),t&&e.detach().appendTo(".weglot-mobile")},700),$("body").removeClass("menu-open"),t&&$("body").addClass("menu-open")}),s.homepage=null,s.submenuStates={},s.subscribeEmail="",s.subscribeState="waiting",n.getHomepage().then(function(e){s.homepage=e}),s.redirect=function(e,t,i){i=i||("/"!==t.uri[0]?e.uri+"/"+t.uri:t.uri),$(location).attr("href",i)};var u=function(e,t){return e.split(".")[0]===t.split(".")[0]};var d,p,h;s.toggleSubMenu=function(e){s.submenuStates[e.id]=!s.submenuStates[e.id]},s.toggleSubMenuByKey=function(e,t){13==e.which&&s.toggleSubMenu(t)},s.uiToggleSubMenu=(d=s.toggleSubMenu,p=500,h=new Date,function(){var e=new Date;if(!(e<h))return e.setMilliseconds(e.getMilliseconds()+p),h=e,d.apply(this,arguments)}),s.isSubmenuVisible=function(e){return!s.submenuStates[e.id]},s.mailingListSubscribe=function(){s.subscribeState="sending",t({method:"POST",url:"/api/mailing-list",data:$.param({email:s.subscribeEmail}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(){s.subscribeState="done",l.sendEvent("mailing-list","subscribe")}).error(function(){s.subscribeState="failed"})},s.$on("$stateChangeStart",function(e,t){t.pageTitleStrict?c.setStrict(t.pageTitleStrict):c.set(t.pageTitle)}),s.$on("$stateChangeSuccess",function(e,t,i,n,o){(t.name||n.name)&&u(t.name,n.name)&&i.alias==o.alias||(n.name&&(s.showMenu=!1),a())})}]).directive("keyEnter",function(){return function(t,e,i){e.bind("keypress",function(e){13===e.which&&(t.$apply(function(){t.$eval(i.keyEnter)}),e.preventDefault())})}}),angular.module("worldPolicyForumApp").service("settings",["$rootScope","$state","$stateParams","$location","utils",function(e,t,i,n,o){this.lastTopic=null,this.isSupportingPrintColorAdjust="webkitPrintColorAdjust"in document.body.style,this.isIos=o.isIos(),this.isIpad=o.isIos()&&768<=window.innerWidth,this.mediaServerHost="/sites/default/files/media-server"}]),angular.module("worldPolicyForumApp").directive("bxSlider",["$window","$timeout",function(e,n){return{template:'<ul class="bx-slider"><li ng-repeat="image in images"><img ng-src="{{image}}" alt=""/></li></ul>',restrict:"E",replace:!0,scope:{images:"=?"},link:function(e,t,i){imagesLoaded(t,function(e){$(t).fadeIn(500)}),n(function(){$(t).bxSlider({mode:"fade",auto:!0,speed:5e3,pause:4e3,pager:!1,controls:!1,easing:"linear",responsive:!1})})}}}]),angular.module("worldPolicyForumApp").directive("owlCarousel",function(){return{template:'<div class="owlcarousel-wrapper"><span class="card-nav-prev" ng-click="prev()"></span><span class="card-nav-next" ng-click="next()"></span><div class="owlcarousel"><owl-carousel-card class="item" ng-repeat="item in items"> </owl-carousel-card></div></div>',restrict:"E",replace:!0,transclude:!1,scope:{items:"=?"},link:function(e,t,i){imagesLoaded(t,function(e){t.fadeIn(500)}),e.$on("$destroy",function(){t.find(".owlcarousel").data("owlCarousel").destroy()}),e.prev=function(){t.find(".owlcarousel").data("owlCarousel").prev()},e.next=function(){t.find(".owlcarousel").data("owlCarousel").next()},e.initCarousel=function(e){$(e).owlCarousel({loop:!0,items:3,responsive:{1024:{items:3},768:{items:2},320:{items:1}},dotsEach:!0,nav:!0,navText:['<i class="icon-owl-left"></i>','<i class="icon-owl-right"></i>']})}}}}),angular.module("worldPolicyForumApp").directive("owlCarouselCard",["$window","$timeout","utils",function(e,i,n){return{template:'<a href="{{item.uri}}" title="{{item.title}}" ng-attr-style="-webkit-transform: scale({{item.scale}});-ms-transform: scale({{item.scale}});-o-transform: scale({{item.scale}});transform: scale({{item.scale}});"><div><span class="card-wrapper" ng-attr-style="background: {{item.thumb.indexOf(\'blank-card-bg\') >= 0 ? item.cover_front_color : \'transparent\'}};"><img src="{{item.thumb}}" alt="{{item.title}}" ng-hide="utils.isEmpty(item.thumb)" /><span class="card-title" ng-hide="utils.isEmpty(item.cover_title)" ng-attr-style="color: {{item.cover_title_color}}">{{item.cover_title}}</span></span></div></a>',restrict:"AE",transclude:!1,link:function(e,t){e.utils=n,e.$last&&i(function(){e.initCarousel(t.parent())},0)}}}]),angular.module("worldPolicyForumApp").directive("searchResult",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/search-result.html",restrict:"E",replace:!0,scope:!0,controllerAs:"searchResultController",controller:["$scope","$element","$document","$timeout","configs",function(r,l,e,t,c){$(".result-list",l);r.isOpen=!1,r.isLoading=!1,r.results={policies:null,others:null},r.searchGroup=null,this.init=function(e){r.searchGroup=e,r.$on("queryStarted-"+e,this.onQueryStarted),r.$on("queryResult-"+e,this.onQueryResult),r.$on("exitQuery-"+e,this.onExitQuery),r.$on("$stateChangeSuccess",this.onStateChangeSuccess),r.$on("$destroy",this.destroy)},this.destroy=function(){}.bind(this),this.onQueryStarted=function(){this.openResult()}.bind(this);this.onQueryResult=function(e,t){r.results.policies=[];for(var i=[],n=[],o=t.response.hits,s=0;s<o.length;s++){var a=o[s];("policy"===a.type?r.results.policies:!function(e){var t=c.search.prioritize;if(e.type&&0<=t.types.indexOf(e.type))return!0;
1if(e.search_category)for(var i=0;i<t.categories.length;i++)if(0===e.search_category.indexOf(t.categories[i]))return!0;return!1}(a)?i:n).push(a)}r.results.others=n.concat(i),setTimeout(function(){$(l).closest(".menu-header").length&&r.showMenu&&$(l).closest(".menu-header").closest(".menu-content").css("min-height",$(l).height()+150+"px")},500),r.isLoading=!1}.bind(this),this.onExitQuery=function(){r.results.policies=null,this.closeResult()}.bind(this),this.onDocumentClick=function(e){$(e.target).closest(".search-result").length||$(e.target).closest(".categories .btn").length||$(e.target).closest(".advanced-search .researcher").length||$(e.target).closest("input.search").length||this.closeResult()}.bind(this),this.onStateChangeSuccess=function(e){this.closeResult()}.bind(this),this.openResult=function(){$(l).closest(".menu-header").length&&r.showMenu&&$(l).closest(".menu-header").closest(".menu-content").css("min-height","100%"),r.isOpen||($(l).fadeIn(),$(e).on("click",this.onDocumentClick),r.isOpen=!0,r.isLoading=!0)},this.closeResult=function(){r.isOpen&&($(l).fadeOut(),$(e).off("click",this.onDocumentClick),r.isOpen=!1,$(l).closest(".menu-header").length&&$(l).closest(".menu-header").closest(".menu-content").css("min-height","100%"))},this.go=function(e){window.location.href=e}}],link:function(e,t,i,n){n.init(i.searchGroup)}}}]),angular.module("worldPolicyForumApp").service("search",["$rootScope","$timeout","$http","$q","analytics",function(i,n,o,s,a){new AlgoliaSearch("WW3PWX3WRX","4592f61d6a7d9d2c2c251525491021b6").initIndex("WorldPolicyForum");var r=null,l=null;this.query=function(e,t){c(),r=n(function(){i.$broadcast("queryStarted-"+t),a.sendEvent("input","search",e),l&&l.resolve(),l=s.defer(),o.get("/search.json",{params:{query:e},timeout:l.promise}).then(function(e){i.$broadcast("queryResult-"+t,{response:e.data})})},500)};var c=function(){r&&(n.cancel(r),r=null)};this.exit=function(e){console.log("exit query"),c(),i.$broadcast("exitQuery-"+e)}}]),angular.module("worldPolicyForumApp").directive("searchInput",["search",function(n){return{template:'<input aria-label="search" type="text" ng-model="query" ng-keyup="onKeyup($event)" ng-keydown="onKeydown($event)" class="search form-control" placeholder="Search rights, laws, policies, publications and resources..."><button type="button" aria-label="search" ng-click="onClick($event)"></button>',restrict:"E",scope:!0,link:function(i,e,t){i.query=null,i.searchGroup=t.searchGroup,i.$watch("query",function(e,t){e&&e.length?n.query(e,i.searchGroup):n.exit(i.searchGroup)}),i.onClick=function(e){e.preventDefault(),i.query&&i.query.length?n.query(i.query,i.searchGroup):n.exit(i.searchGroup)},i.onKeyup=function(e){13===e.keyCode&&e.preventDefault()},i.onKeydown=function(e){13===e.keyCode&&e.preventDefault()}}}}]),angular.module("worldPolicyForumApp").directive("promotedPolicy",["$timeout","configs",function(e,t){return{templateUrl:t.env.APP_PATH+"/views/directives/promoted-policy.html",restrict:"E",replace:!0,scope:{policy:"="},controllerAs:"promotedPolicyController",controller:["$scope","$location","settings",function(e,t,i){e.settings=i,this.navigateTo=function(e){event.stopPropagation(),event.preventDefault(),t.path(e)}.bind(this),this.init=function(){}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").controller("NewsCtrl",["$scope",function(e){}]),angular.module("worldPolicyForumApp").directive("topicAccordion",["api","configs",function(n,e){return{templateUrl:e.env.APP_PATH+"/views/directives/topic-accordion.html",restrict:"E",replace:!0,scope:{selectedTopic:"=?",selectedSubtopic:"=?"},controllerAs:"topicAccordionController",controller:["$scope","$element","utils",function(t,e,i){t.topics=null,t.isLoading=!0,t.topicMap=null;this.init=function(){n.getTopics().then(function(e){t.isLoading=!1,t.topics=e,t.topicMap=i.createMap(e,"segment")})},this.selectTopic=function(e){t.selectedTopic=e,t.selectedSubtopic=null},this.selectSubtopic=function(e){t.selectedSubtopic=e}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("policyList",["$timeout","configs",function(e,t){return{templateUrl:t.env.APP_PATH+"/views/directives/policy-list.html",restrict:"E",replace:!0,scope:{policies:"=",blockType:"@?"},controllerAs:"policyListController",controller:["$scope","$element","settings",function(e,t,i){e.settings=i,this.init=function(){}}],link:function(e,t,i,n){n.init()}}}]).directive("policyListBlock",function(){return{restrict:"A",scope:!0,controllerAs:"policyListBlockController",controller:["$scope","$rootScope","comparePolicies",function(n,e,o){n.selected={index:0},n.status={isDropdownOpen:!1},n.compare={icon:"add",text:"Add Map to Compare"},e.$on("comparePoliciesChanged",function(e,t){var i=this.currentPolicy()?this.currentPolicy().key:0;n.compare={icon:o.existsInCompare(i)?"remove":"add",text:o.existsInCompare(i)?"Remove Map from compare":"Add Map to compare"}}.bind(this)),n.$watch("policy",function(e){e&&(e=this.currentPolicy()?this.currentPolicy().key:0,n.compare={icon:o.existsInCompare(e)?"remove":"add",text:o.existsInCompare(e)?"Remove Map from compare":"Add Map to compare"})}.bind(this)),n.$watch("selected.index",function(e){var t;this.isCombinedPolicies()&&(t=this.currentPolicy()?this.currentPolicy().key:0,n.compare={icon:o.existsInCompare(t)?"remove":"add",text:o.existsInCompare(t)?"Remove Map from compare":"Add Map to compare"})}.bind(this)),n.getCombinedPolicies=function(){return this.isCombinedPolicies()?n.policy.
1combined_policies.map(e=>e.combined_variable):[]}.bind(this),n.selectCombinedPolicy=function(e){n.selected.index=e},n.nextPolicy=function(){var e=n.policy.combined_policies.length;this.isCombinedPolicies()&&n.selected.index<e-1&&(n.selected.index=n.selected.index+1)}.bind(this),n.previousPolicy=function(){this.isCombinedPolicies()&&0<n.selected.index&&(n.selected.index=n.selected.index-1)}.bind(this),this.isCombinedPolicies=function(){return"combined_policies"===n.policy.sub_type},this.toggleCompare=function(){var e=this.currentPolicy()?this.currentPolicy().key:0;!o.existsInCompare(e)&&this.isCompareAvailable()?(o.addToCompare(e),n.compare={icon:"remove",text:"Remove Map from compare"}):(o.removeFromCompare(e),n.compare={icon:"add",text:"Add Map to compare"})}.bind(this),this.isCompareAvailable=function(){var e=this.currentPolicy()?this.currentPolicy().key:0;return o.canBeAddedToCompare()||o.existsInCompare(e)},this.currentPolicy=function(){return this.isCombinedPolicies()?void 0===n.policy.combined_policies[n.selected.index]?{}:(n.policy.combined_policies[n.selected.index].url=n.policy.uri+"/"+n.policy.combined_policies[n.selected.index].segment,n.policy.combined_policies[n.selected.index]):n.policy||{}}}],link:function(e,t,i,n){}}}),angular.module("worldPolicyForumApp").directive("compareLayer",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/compare-layer.html",restrict:"E",replace:!0,scope:!0,controllerAs:"compareLayerController",controller:["$scope","$rootScope","$location","$state","comparePolicies",function(s,e,t,i,n){s.comparePoliciesIds=[],s.backState=!1,s.previousState=null,s.previousStateParams=null;function o(e,t){s.comparePoliciesIds=t}this.init=function(){s.comparePoliciesIds=n.getPoliciesIdsForCompare(),e.$on("comparePoliciesChanged",o),e.$on("$stateChangeStart",function(e,t,i,n,o){s.previousState=n,s.previousStateParams=o,s.backState="compare-policies"===t.name})},s.clickDiscard=function(){n.clearCompare()},s.clickCompareMaps=function(){i.go("compare-policies")},s.clickGoBack=function(){i.go(s.previousState,s.previousStateParams)}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("topicPoliciesFilter",["api","configs",function(e,t){return{templateUrl:t.env.APP_PATH+"/views/directives/topic-policies-filter.html",restrict:"E",replace:!0,scope:{topicName:"=?",searchKeywords:"=?",selectedSubtopic:"=?",subtopics:"=?"},controllerAs:"topicPoliciesFilterController",controller:["$scope","$element","utils",function(i,e,t){i.openSelect=!1,i.selectedSubtopicObject=null,i.$watchGroup(["selectedSubtopic","subtopics"],function(e){const t=e[0];e=e[1];t?i.selectedSubtopicObject=Array.from(e).find(e=>e.segment===t):i.selectedSubtopicObject=null}),i.$watch("searchKeywords",function(e){i.$emit("FilterByKeywords",e)}),i.filterByKeywords=function(e){13===e.which&&i.$emit("FilterByKeywords",i.searchKeywords)},i.selectSubtopic=function(e){i.selectedSubtopic=e?e.segment:null},i.toggleSelect=function(){i.openSelect=!i.openSelect}}],link:function(e,t,i,n){}}}]),angular.module("worldPolicyForumApp").directive("globalMap",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/global-map.html",restrict:"E",replace:!0,scope:{policyDetails:"=?",disableUi:"=?",selectedPolicy:"=?",stickyHeader:"=?",filter:"=?",selectedDataset:"=?",onDatasetUpdate:"=?"},controllerAs:"globalMapController",controller:["$scope","$state","$element","$window","$location","Map","MapResizer","MapPopover","MapBuilder","configs","analytics","utils",function(r,s,e,t,i,n,o,a,l,c,u,d){r.configs=c.globalMap,r.legends=null,r.blindMode=!1,r.countryMap=null,r.mode=r.mode||"policy",r.popover=null,r.isLoading=!0,r.filters=[],r.mobileFilters=[],r.filters_formatted={},r.filters_expanded={},r.selected={filters:[]},r.hover={filter:null,legend:null},r.now=new Date,r.combinedIndex=-1,r.disableUi=!!r.disableUi,r.disableUi&&(r.isLoading=!1),void 0===r.stickyHeader&&(r.stickyHeader=!1),r.slideOpen=!1,r.countryFilters=[],r.selectedSubnational={id:null,value:"Global"},r.subnationalOptions=[],r.zoomInto=function(){r.$broadcast("zoomInto",r.countryMap)}
1,this.init=function(){r.$watch("policyDetails",C),r.$watch("combinedIndex",S),r.$watch("selectedDataset",A),r.$watch("selected.filters",T),r.$watch("filters",_),r.$on("$destroy",b),r.$watch("onDatasetUpdate",m),r.$watch("countryFilters",f,!0),r.$watch("selectedSubnational",v);var i=setTimeout(function e(){var t=document.querySelector(".policy-filter .host");t?(t.addEventListener("touchstart",function(e){e.target instanceof HTMLInputElement&&(e.preventDefault(),e.target.focus())},!1),clearInterval(i)):i=setTimeout(e,200)},200)};function p(e){for(var t=[],t=e,i=null,n=0;n<t.length;n++)"groupTitle"===t[n].type?i=t[n]:t[n].group=i;return t}function h(e){let t=[{id:null,value:"Global"}];for(const i of e.countries)i.subnational&&i.subnational.data[0][e.key]&&t.push({id:i.iso,value:i.name});return t}function g(e){for(var t=[],i=0;i<e.length;i++)"groupTitle"!==e[i].type&&t.push(e[i]);return t}var m=function(e){null!==e&&0<=e&&this.updateDataset(e)}.bind(this),f=function(i){if(!r.disableUi&&r.selectedPolicy){r.countryMap={};const n={};for(const e of i)n[e.iso]=e;for(const o of r.selectedPolicy.countries){let e,t;t=o.iso in n||!i.length?(e=o.data[r.selectedPolicy.key].color,o.data[r.selectedPolicy.key].cbm_color):(e=r.configs.fill,r.configs.fill),r.countryMap[o.iso]={iso:o.iso,name:o.name,color:e,cbm_color:t,stripe:k(o.data,r.selectedPolicy.key),value:o.data[r.selectedPolicy.key].value,valueId:o.data[r.selectedPolicy.key].value_id,popoverValue:o.data[r.selectedPolicy.key].popover_value,text:"",filtered:o.iso in n}}r.zoomInto()}}.bind(this),v=function(e){r.$emit("OnSelectedSubnational",e.id)},y=function(){var i=this;r.filter&&$.each(r.filters,function(e,t){if(t.name_id===r.filter)return i.toggleFilter(t,!0),!1})}.bind(this),b=function(){}.bind(this);r.mobileFilters=g(r.filters);function w(){var e=r.selected.filters;if(e.length){var t={};for(const n of e){var i=n.name_id;t[i]||(t[i]=[]),t[i].push(n)}return t}return null}function P(e,t){if(t)for(const i in t)if(!1===function(e,t){for(const n of t){var i=n.value_id.split("__")[0];if(e.data[i]&&e.data[i].value_id===n.value_id)return!0}return!1}(e,t[i]))return!1;return!0}function x(e){var t=r.selected.filters;if(t)for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var C=function(e){e&&(r.isLoading=!1,this.isCombinedPolicy()?A(r.selectedDataset):(r.selectedPolicy=e,r.filters=p(r.selectedPolicy.filters),r.subnationalOptions=h(r.selectedPolicy),r.mobileFilters=g(r.filters),y(),F(),D()))}.bind(this),_=function(){var t=[];r.filters.forEach(function(e){return"groupTitle"==e.type?(r.filters_expanded[e.name_id]=!1,void t.push({name_id:e.name_id,name:e.name,list:[]})):void(r.shouldHideFilter(e)||t[t.length-1].list.push(e))}),r.filters_formatted=t},A=function(e){var t=r.policyDetails;if(function(e){e=e.split(".");return"policy"===e[0]||"embedded-policy"===e[0]}(s.current.name)&&t&&this.isCombinedPolicy()){if(!e&&!s.params.subpolicySkipRedirect){var i=s.params.embeddedVersion?"embedded-policy.subpolicy":"policy.subpolicy",n={};return t&&t.segment===s.params.policy&&(n.subpolicy=t.combined_policies[0].segment),s.go(i,n,{inherit:!0,location:"replace"})}for(var o=0;o<t.combined_policies.length;o++)if(t.combined_policies[o].segment===e)return void(r.combinedIndex=o.toString());r.combinedIndex="0"}}.bind(this),S=function(e){this.isCombinedPolicy()&&(r.selectedPolicy=r.policyDetails.combined_policies[parseInt(e,10)],r.filters=p(r.selectedPolicy.filters),r.subnationalOptions=h(r.selectedPolicy),r.mobileFilters=g(r.filters),y(),F(),r.selectedPolicy&&u.sendEvent("map","combination",r.selectedPolicy.name),D())}.bind(this),T=function(e,t){M(),F(),D(),r.zoomInto()},M=function(){for(var e=!1,t=0,i=r.selected.filters;t<i.length;){if("agreements"===i[t].group.name_id){if(e){r.selected.filters.splice(t,1);continue}e=!0}t++}},k=function(e,t){for(var i,n=[t+"_stripe",t+"_stripe2"],o=0,s=0;s<n.length;s++)e[i=n[s]]&&0<function(e,t){if(e&&t){e=e+"__";if(t.slice(0,e.length)===e)return parseInt(t.slice(e.length,t.length))}return 0}(i,e[i].value_id)&&(o+=Math.pow(2,s));return o},F=function(){if(r.selectedPolicy){r.legends=r.selectedPolicy.values,r.countryMap={};var e=w();for(const o of r.selectedPolicy.countries){var t,i=P(o,e),n=!1===i?(t=r.configs.fill,r.configs.fill):(t=o.data[r.selectedPolicy.key].color,o.data[r.selectedPolicy.key].cbm_color);r.countryMap[o.iso]={iso:o.iso,name:o.name,color:t,cbm_color:n,stripe:k(o.data,r.selectedPolicy.key),value:o.data[r.selectedPolicy.key].value,valueId:o.data[r.selectedPolicy.key].value_id,popoverValue:o.data[r.selectedPolicy.key].popover_value,text:"",filtered:!0===i}}}},D=function(){var e=null;"policy"!==s.current.name&&"policy.subpolicy"!==s.current.name||e===s.params.filter||s.transitionTo(s.current.name,{filter:e},{inherit:!0,notify:!1,reload:!1,location:"replace"})};this.hasFilter=function(e){return-1!==x(e)},this.toggleFilter=function(e,t){var i=x(e);-1===i?r.selected.filters.push(e):r.selected.filters.splice(i,1),F(),r.zoomInto(),t||D()},this.toggleSubnational=function(e){r.selectedSubnational=e,r.countryMap={},null===r.selectedSubnational.id&&(r.configs=c.globalMap);var t=w();for(const a of r.selectedPolicy.countries){a.subnational&&r.selectedSubnational.id===a.iso&&(r.configs=Object.assign({},c.globalMap,{svgFile:a.subnational.map}));var i,n=P(a,t),o=!1===n?(i=r.configs.fill,r.configs.fill):(i=a.data[r.selectedPolicy.key].color,a.data[r.selectedPolicy.key].cbm_color),s=a.subnational?{regions:d.createMap(a.subnational.data,"iso2"),map:a.subnational.map}:null;r.countryMap[a.iso]={iso:a.iso,name:a.name,color:i,cbm_color:o,stripe:k(a.data,r.selectedPolicy.key),value:a.data[r.selectedPolicy.key].value,valueId:a.data[r.selectedPolicy.key].value_id,popoverValue:a.data[r.selectedPolicy.key].popover_value,text:"",filtered:!0===n,subnational:s,enableSubnational:r.selectedSubnational.id===a.iso}}},this.updateDataset=function(e){var t=r.policyDetails.combined_policies[e];r.selected.filters=[];e={subpolicy:t.segment},t=s.params.embeddedVersion?"embedded-policy.subpolicy":"policy.subpolicy";s.go(t,e,{inherit:!0})},this.isCombinedPolicy=function(){if(r.policyDetails)return"combined_policies"===r.policyDetails.sub_type},this.stickToTopEnable=function(){return r.stickyHeader||s.params.embeddedVersion};r.shouldHideFilter=function(e){if("groupTitle"===e.type)return!function(e){var t=!1;for(const i of r.filters)if(i===e)t=!0;else{if(t&&"groupTitle"===i.type)return!1;if(t&&!r.shouldHideFilter(i))return!0}return!1}(e);if(e.checkFilters&&r.selectedPolicy&&r.selectedPolicy.filters)return!r.selectedPolicy.filters[e.check_i
1d||e.name_id];if(e.haveAny&&r.selectedPolicy){for(var t=0;t<e.haveAny.length;t++)if(r.selectedPolicy.filters[e.haveAny[t]])return!1;return!0}return!1},r.visibleFilters=function(e){for(var t=[],i=0;i<e.length;i++)r.shouldHideFilter(e[i])||t.push(e[i]);return t},r.toggleSlideState=function(){r.slideOpen=!r.slideOpen},r.loadCountries=function(t){let e=r.selectedPolicy?r.selectedPolicy.countries:[];return e.sort(function(e,t){e=e.name.toLowerCase(),t=t.name.toLowerCase();return e<t?-1:t<e?1:0}),e.filter(function(e){return-1!==e.name.toLowerCase().indexOf(t.toLowerCase())})}}],link:function(e,t,i,n){n.init()}}}]);const app_path="/modules/custom/wpc_angularjs_app/dist";angular.module("worldPolicyForumApp").constant("configs",{env:{APP_PATH:app_path},isDebugging:!0,recaptchaKey:"6Lcg_Z4cAAAAAOY5Y_2Nwxe_O4SjGvMF3Dtkkbau",pageTitle:{template:"{{title}} - WORLD Policy Analysis Center",auto:"WORLD Policy Analysis Center"},home:{sliderImages:[app_path+"/images/home/background/background-image-1.jpg",app_path+"/images/home/background/background-image-2.jpg"]},search:{prioritize:{types:["file","link"],categories:["Resources","Publications"]}},dataTables:{skipSize:2,printMaxColumns:5},country:{tabs:[{id:"compare-countries",title:"Compare countries",options:{hideOnMobile:!0}},{id:"policies",title:"Policies"}]},globalMap:{svgFile:app_path+"/svgs/world3.svg",zoomTweak:1.15,fill:"#e3e3e3",stroke:"#000",opacity:1,strokeOpacity:1,strokeWidth:.8,hoverStroke:"#fff",minScale:.5,maxScale:Math.pow(2,5),zoomStep:2,animate:!0},selectorMap:{svgFile:app_path+"/svgs/world3.svg",zoomTweak:1.15,fill:"#e3e3e3",stroke:"#263c4a",opacity:1,strokeOpacity:.3,strokeWidth:1,hoverStroke:"#000",hoverFill:"#7d8a92",minScale:1,maxScale:Math.pow(2,5),zoomStep:2,animate:!0},countryMap:{svgFile:app_path+"/svgs/world3.svg",zoomTweak:1.15,fill:"#3a4e5c",stroke:"#3a4e5c",opacity:1,strokeOpacity:1,strokeWidth:1,minScale:1,maxScale:Math.pow(2,5),zoomStep:2,animate:!0},internationalAgreementsMap:{svgFile:app_path+"/svgs/world3.svg",zoomTweak:1.15,fill:"#e3e3e3",stroke:"#000",opacity:1,strokeOpacity:.5,strokeWidth:1,hoverStroke:"#fff",minScale:1,maxScale:Math.pow(2,5),zoomStep:2,animate:!0},rankingsMap:{svgFile:app_path+"/svgs/world3.svg",zoomTweak:1.15,fill:"#e3e3e3",stroke:"#fff",opacity:1,strokeOpacity:.5,strokeWidth:1,hoverStroke:"#fff",minScale:1,maxScale:Math.pow(2,5),zoomStep:2,animate:!0},institutions:["Civil Society Organization / Non-Governmental Organization","Government","Healthcare","High School / Secondary","Higher Education","International Governmental Organization","Legal","Media / Journalism","Private Sector","Social Enterprise","Think Tank","Other"],countries:[{name:"Afghanistan",iso:"af"},{name:"Åland Islands",iso:"ax"},{name:"Albania",iso:"al"},{name:"Algeria",iso:"dz"},{name:"American Samoa",iso:"as"},{name:"Andorra",iso:"ad"},{name:"Angola",iso:"ao"},{name:"Anguilla",iso:"ai"},{name:"Antarctica",iso:"aq"},{name:"Antigua and Barbuda",iso:"ag"},{name:"Argentina",iso:"ar"},{name:"Armenia",iso:"am"},{name:"Aruba",iso:"aw"},{name:"Australia",iso:"au"},{name:"Austria",iso:"at"},{name:"Azerbaijan",iso:"az"},{name:"Bahamas",iso:"bs"},{name:"Bahrain",iso:"bh"},{name:"Bangladesh",iso:"bd"},{name:"Barbados",iso:"bb"},{name:"Belarus",iso:"by"},{name:"Belgium",iso:"be"},{name:"Belize",iso:"bz"},{name:"Benin",iso:"bj"},{name:"Bermuda",iso:"bm"},{name:"Bhutan",iso:"bt"},{name:"Bolivia, Plurinational State of",iso:"bo"},{name:"Bonaire, Sint Eustatius and Saba",iso:"bq"},{name:"Bosnia and Herzegovina",iso:"ba"},{name:"Botswana",iso:"bw"},{name:"Bouvet Island",iso:"bv"},{name:"Brazil",iso:"br"},{name:"British Indian Ocean Territory",iso:"io"},{name:"Brunei Darussalam",iso:"bn"},{name:"Bulgaria",iso:"bg"},{name:"Burkina Faso",iso:"bf"},{name:"Burundi",iso:"bi"},{name:"Cambodia",iso:"kh"},{name:"Cameroon",iso:"cm"},{name:"Canada",iso:"ca"},{name:"Cape Verde",iso:"cv"},{name:"Cayman Islands",iso:"ky"},{name:"Central African Republic",iso:"cf"},{name:"Chad",iso:"td"},{name:"Chile",iso:"cl"},{name:"China",iso:"cn"},{name:"Christmas Island",iso:"cx"},{name:"Cocos (Keeling) Islands",iso:"cc"}
1,{name:"Colombia",iso:"co"},{name:"Comoros",iso:"km"},{name:"Congo",iso:"cg"},{name:"Democratic Republic of the Congo",iso:"cd"},{name:"Cook Islands",iso:"ck"},{name:"Costa Rica",iso:"cr"},{name:"Côte d'Ivoire",iso:"ci"},{name:"Croatia",iso:"hr"},{name:"Cuba",iso:"cu"},{name:"Curaçao",iso:"cw"},{name:"Cyprus",iso:"cy"},{name:"Czech Republic",iso:"cz"},{name:"Denmark",iso:"dk"},{name:"Djibouti",iso:"dj"},{name:"Dominica",iso:"dm"},{name:"Dominican Republic",iso:"do"},{name:"Ecuador",iso:"eq"},{name:"Egypt",iso:"eg"},{name:"El Salvador",iso:"sv"},{name:"Equatorial Guinea",iso:"gq"},{name:"Eritrea",iso:"er"},{name:"Estonia",iso:"ee"},{name:"Ethiopia",iso:"et"},{name:"Falkland Islands (Malvinas)",iso:"fk"},{name:"Faroe Islands",iso:"fo"},{name:"Fiji",iso:"fj"},{name:"Finland",iso:"fi"},{name:"France",iso:"fr"},{name:"French Guiana",iso:"gf"},{name:"French Polynesia",iso:"pf"},{name:"French Southern Territories",iso:"tf"},{name:"Gabon",iso:"ga"},{name:"Gambia",iso:"gm"},{name:"Georgia",iso:"ge"},{name:"Germany",iso:"de"},{name:"Ghana",iso:"gh"},{name:"Gibraltar",iso:"gi"},{name:"Greece",iso:"gr"},{name:"Greenland",iso:"gl"},{name:"Grenada",iso:"gd"},{name:"Guadeloupe",iso:"gp"},{name:"Guam",iso:"gu"},{name:"Guatemala",iso:"gt"},{name:"Guernsey",iso:"gg"},{name:"Guinea",iso:"gn"},{name:"Guinea-Bissau",iso:"gw"},{name:"Guyana",iso:"gy"},{name:"Haiti",iso:"ht"},{name:"Heard Island and McDonald Islands",iso:"hm"},{name:"Holy See (Vatican City State)",iso:"va"},{name:"Honduras",iso:"hn"},{name:"Hong Kong",iso:"hk"},{name:"Hungary",iso:"hu"},{name:"Iceland",iso:"is"},{name:"India",iso:"in"},{name:"Indonesia",iso:"id"},{name:"Iran, Islamic Republic of",iso:"ir"},{name:"Iraq",iso:"iq"},{name:"Ireland",iso:"ie"},{name:"Isle of Man",iso:"im"},{name:"Israel",iso:"il"},{name:"Italy",iso:"it"},{name:"Jamaica",iso:"jm"},{name:"Japan",iso:"jp"},{name:"Jersey",iso:"je"},{name:"Jordan",iso:"jo"},{name:"Kazakhstan",iso:"kz"},{name:"Kenya",iso:"ke"},{name:"Kiribati",iso:"ki"},{name:"Korea, Democratic People's Republic of",iso:"kp"},{name:"Republic of Korea",iso:"kr"},{name:"Kuwait",iso:"kw"},{name:"Kyrgyzstan",iso:"kg"},{name:"Lao People's Democratic Republic",iso:"la"},{name:"Latvia",iso:"lv"},{name:"Lebanon",iso:"lb"},{name:"Lesotho",iso:"ls"},{name:"Liberia",iso:"lr"},{name:"Libya",iso:"ly"},{name:"Liechtenstein",iso:"li"},{name:"Lithuania",iso:"lt"},{name:"Luxembourg",iso:"lu"},{name:"Macao",iso:"mo"},{name:"Macedonia, the Former Yugoslav Republic of",iso:"mk"},{name:"Madagascar",iso:"mg"},{name:"Malawi",iso:"mw"},{name:"Malaysia",iso:"my"},{name:"Maldives",iso:"mv"},{name:"Mali",iso:"ml"},{name:"Malta",iso:"mt"},{name:"Marshall Islands",iso:"mh"},{name:"Martinique",iso:"mq"},{name:"Mauritania",iso:"mr"},{name:"Mauritius",iso:"mu"},{name:"Mayotte",iso:"yt"},{name:"Mexico",iso:"mx"},{name:"Micronesia, Federated States of",iso:"fm"},{name:"Moldova, Republic of",iso:"md"},{name:"Monaco",iso:"mc"},{name:"Mongolia",iso:"mn"},{name:"Montenegro",iso:"me"},{name:"Montserrat",iso:"ms"},{name:"Morocco",iso:"ma"},{name:"Mozambique",iso:"mz"},{name:"Myanmar",iso:"mm"},{name:"Namibia",iso:"na"},{name:"Nauru",iso:"nr"},{name:"Nepal",iso:"np"},{name:"Netherlands",iso:"nl"},{name:"New Caledonia",iso:"nc"},{name:"New Zealand",iso:"nz"},{name:"Nicaragua",iso:"ni"},{name:"Niger",iso:"ne"},{name:"Nigeria",iso:"ng"},{name:"Niue",iso:"nu"},{name:"Norfolk Island",iso:"nf"},{name:"Northern Mariana Islands",iso:"mp"},{name:"Norway",iso:"no"},{name:"Oman",iso:"om"},{name:"Pakistan",iso:"pk"},{name:"Palau",iso:"pw"},{name:"Palestine, State of",iso:"ps"},{name:"Panama",iso:"pa"},{name:"Papua New Guinea",iso:"pg"},{name:"Paraguay",iso:"py"},{name:"Peru",iso:"pe"},{name:"Philippines",iso:"ph"},{name:"Pitcairn",iso:"pn"},{name:"Poland",iso:"pl"},{name:"Portugal",iso:"pt"},{name:"Puerto Rico",iso:"pr"},{name:"Qatar",iso:"qa"},{name:"Réunion",iso:"re"},{name:"Romania",iso:"ro"},{name:"Russian Federation",iso:"ru"},{name:"Rwanda",iso:"rw"},{name:"Saint Barthélemy",iso:"bl"},{name:"Saint Helena, Ascension and Tristan da Cunha",iso:"sh"},{name:"Saint Kitts and Nevis",iso:"kn"},{name:"Saint Lucia",iso:"lc"},{name:"Saint Martin (French part)",iso:"mf"},{name:"Saint Pierre and Miquelon",iso:"pm"},{name:"Saint Vincent and the Grenadines",iso:"vc"},{name:"Samoa",iso:"ws"},{name:"San Marino",iso:"sm"},{name:"Sao Tome and Principe",iso:"st"},{name:"Saudi Arabia",iso:"sa"},{name:"Senegal",iso:"sn"},{name:"Serbia",iso:"rs"},{name:"Seychelles",iso:"sc"},{name:"Sierra Leone",iso:"sl"},{name:"Singapore",iso:"sg"},{name:"Sint Maarten (Dutch part)",iso:"sx"},{name:"Slovakia",iso:"sk"},{name:"Slovenia",iso:"si"},{name:"Solomon Islands",iso:"sb"}
1,{name:"Somalia",iso:"so"},{name:"South Africa",iso:"za"},{name:"South Georgia and the South Sandwich Islands",iso:"gs"},{name:"South Sudan",iso:"ss"},{name:"Spain",iso:"es"},{name:"Sri Lanka",iso:"lk"},{name:"Sudan",iso:"sd"},{name:"Suriname",iso:"sr"},{name:"Svalbard and Jan Mayen",iso:"sj"},{name:"Swaziland",iso:"sz"},{name:"Sweden",iso:"se"},{name:"Switzerland",iso:"ch"},{name:"Syrian Arab Republic",iso:"sy"},{name:"Taiwan, Province of China",iso:"tw"},{name:"Tajikistan",iso:"tj"},{name:"Tanzania, United Republic of",iso:"tz"},{name:"Thailand",iso:"th"},{name:"Timor-Leste",iso:"tl"},{name:"Togo",iso:"tg"},{name:"Tokelau",iso:"tk"},{name:"Tonga",iso:"to"},{name:"Trinidad and Tobago",iso:"tt"},{name:"Tunisia",iso:"tn"},{name:"Turkey",iso:"tr"},{name:"Turkmenistan",iso:"tm"},{name:"Turks and Caicos Islands",iso:"tc"},{name:"Tuvalu",iso:"tv"},{name:"Uganda",iso:"ug"},{name:"Ukraine",iso:"ua"},{name:"United Arab Emirates",iso:"ae"},{name:"United Kingdom",iso:"gb"},{name:"United States",iso:"us"},{name:"United States Minor Outlying Islands",iso:"um"},{name:"Uruguay",iso:"uy"},{name:"Uzbekistan",iso:"uz"},{name:"Vanuatu",iso:"vu"},{name:"Venezuela, Bolivarian Republic of",iso:"ve"},{name:"Vietnam",iso:"vn"},{name:"Virgin Islands, British",iso:"vg"},{name:"Virgin Islands, U.S.",iso:"vi"},{name:"Wallis and Futuna",iso:"wf"},{name:"Western Sahara",iso:"eh"},{name:"Yemen",iso:"ye"},{name:"Zambia",iso:"zm"},{name:"Zimbabwe",iso:"zw"}]}),angular.module("worldPolicyForumApp").factory("Map",["utils",function(t){function e(e,t){this.configs=t,this.pins={},this.countries={},this.scale=1,this.container=e,this.hoverElement=null,this.transform={x:0,y:0,scale:1},this.dragging={startX:0,startY:0,startTransformX:0,startTransformY:0,enabled:!1},this.loadSVG()}return e.prototype.destroy=function(){$(this.s.node).off("mousedown",this.startDraggingDelegate),$(this.s.node).off("mousemove",this.updateDraggingDelegate),$(this.s.node).off("mouseup",this.endDraggingDelegate),$(this.s.node).off("mouseleave",this.endDraggingDelegate)},e.prototype.loadSVG=function(){var t=this;Snap.load(this.configs.svgFile,function(e){t.initMap(e)})},e.prototype.initMap=function(e){$(this.container).html(e.node),this.s=Snap($(this.container).find("svg").get(0)),this.g=this.s.g(),this.viewBox=this.s.attr("viewBox");var i=window.map=this;this.s.selectAll("path,polygon").forEach(function(e){e.attr({fill:i.configs.fill,stroke:i.configs.stroke,opacity:1}),i.g.add(e),e.hover(i.onCountryMouseover.bind(i,e),i.onCountryMouseout.bind(i,e)),i.countries[e.node.id]=e}),this.set=this.g.selectAll("*"),this.bg=this.s.rect(0,0,"100%","100%").attr({"stroke-width":0,fill:"#00f",opacity:0}),this.bg.hover(this.onBgMouseover.bind(this)),this.s.prepend(this.bg),this.bg.click(this.onBgClick.bind(this)),this.startDraggingDelegate=this.startDragging.bind(this),this.updateDraggingDelegate=this.updateDragging.bind(this),this.endDraggingDelegate=this.endDragging.bind(this);var t={node:this.s.node.parentNode,hammer:new Hammer(this.s.node.parentNode),scale:1},n=null;t.hammer.on("tap",function(e){var t=new Date;n&&t-n<500||(n=t,"PATH"!==(t=e.target.tagName.toUpperCase())&&"POLYGON"!==t||i.onCountryClick(i.countries[e.target.id],e))}),t.hammer.get("pinch").set({enable:!0}),t.hammer.on("pinchstart",function(e){t.scale=this.transform.scale,$(this).trigger("pinchStart")}.bind(this)),t.hammer.on("pinchcancel",function(e){this.transform.scale=t.scale}.bind(this)),t.hammer.on("pinch",function(e){e=t.scale*e.scale/this.transform.scale;this.zoom(e,!1)}.bind(this)),t.hammer.on("panstart",this.startDraggingDelegate),t.hammer.on("panend",this.endDraggingDelegate),t.hammer.on("pan",this.updateDraggingDelegate),this.smartAdjust(),$(this).trigger("mapInitComplete")}
1,e.prototype.smartAdjust=function(){var e=$(".stuck-to-top").map(function(e,t){return $(t).height()}).toArray(),t=Math.max.apply(Math,e),e=$(this.container),t=e.height()-Math.max(0,t);this.adjust(e.width(),Math.min(e.height(),Math.max(120,t)))},e.prototype.setAriaTitle=function(e){this.container&&(this.container.setAttribute("aria-label",e),this.container.setAttribute("role","img"))},e.prototype.adjust=function(e,t){this.s&&(this.width=e,this.height=this.viewBox.height*this.width/this.viewBox.width,this.height=Math.round(Math.min(this.height,768)),this.s.attr({width:this.width,height:this.height,preserveAspectRatio:"xMidYMid meet"}),this.scale=this.height/this.viewBox.height,e=this.configs.zoomTweak||1,this.zoom(t/this.height/this.transform.scale*e))},e.prototype.focusCountry=function(e){this.countries[e].attr({fill:"#3f836c"});var t=this.getBBoxOfCountry(e),i=this.viewBox.width/t.width,e=this.viewBox.height/t.height;this.transform.scale=Math.min(i,e),this.transform.x=-t.x*this.transform.scale+(this.viewBox.width-t.width*this.transform.scale)/2,this.transform.y=-t.y*this.transform.scale+(this.viewBox.height-t.height*this.transform.scale)/2,this.applyTransform(!1)},e.prototype.getBBoxOfCountry=function(e){return this.countries[e]?this.countries[e].getBBox():null},e.prototype.localPositionToView=function(e,t){var i=$(this.container).height()/this.viewBox.height;return{x:e*i,y:t*i}},e.prototype.getCountryViewPosition=function(e){e=this.getBBoxOfCountry(e),e=this.localPositionToView(e.cx,e.cy);return{x:e.x,y:e.y-$(this.container).height()}},e.prototype.setCountryColor=function(e,t,i,n){e in this.countries&&((e=this.countries[e]).color=t,e.stripe=i,$(e.node).data("color",t),e.defaultStyle={stroke:this.configs.stroke,fill:this.getFill(t,i)},n&&!i?e.animate(e.defaultStyle,500):e.attr(e.defaultStyle))},e.prototype.getFill=function(e,t){if(t){for(var i=["M0,2H12M0,10H12","M2,0V12M10,0V12"],n="",o=0;o<i.length;o++)t&Math.pow(2,o)&&(n+=i[o]);return this.s.path(n).attr({fill:"none",stroke:e,strokeWidth:4}).pattern(0,0,12,12)}return e},e.prototype.zoom=function(e,t){void 0===t&&(t=!0);var i=(this.viewBox.width/2-this.transform.x)/(this.viewBox.width*this.transform.scale),n=(this.viewBox.height/2-this.transform.y)/(this.viewBox.height*this.transform.scale),o=this.transform.scale;this.transform.scale=Math.max(Math.min(this.transform.scale*e,this.configs.maxScale),this.configs.minScale),this.transform.x-=(this.transform.scale*this.viewBox.width-o*this.viewBox.width)/(1/i),this.transform.y-=(this.transform.scale*this.viewBox.height-o*this.viewBox.height)/(1/n),this.applyTransform(t&&this.configs.animate)},e.prototype.pan=function(e,t){this.transform.x+=e,this.transform.y+=t,this.applyTransform(!1)},e.prototype.applyTransform=function(e){var t="t"+this.transform.x+","+this.transform.y+"s"+this.transform.scale+","+this.transform.scale+",0,0";e?(this.g.stop(this.transformAnimation),this.g.animate({transform:t,"stroke-width":this.configs.strokeWidth/this.transform.scale},500)):this.g.transform(t).attr({"stroke-width":this.configs.strokeWidth/this.transform.scale})},e.prototype.startDragging=function(e){this.dragging.enabled=!0,this.dragging.startX=t.eventOffsetX(e),this.dragging.startY=t.eventOffsetY(e),this.dragging.startTransformX=this.transform.x,this.dragging.startTransformY=this.transform.y,$(this).trigger("mapDraggingStart")},e.prototype.updateDragging=function(e){this.dragging.enabled&&(t.eventOffsetX(e)&&(this.transform.x=this.dragging.startTransformX+(t.eventOffsetX(e)-this.dragging.startX)/this.scale),t.eventOffsetY(e)&&(this.transform.y=this.dragging.startTransformY+(t.eventOffsetY(e)-this.dragging.startY)/this.scale),this.applyTransform(!1),$(this).trigger("mapDragged")),e.preventDefault()},e.prototype.endDragging=function(e){this.dragging.enabled&&(this.dragging.enabled=!1,$(this).trigger("mapDraggingFinished"))},e.prototype.windowTouchMove=function(e){this.dragging.enabled&&e.preventDefault()},e.prototype.onCountryMouseover=function(e,t){this.hoverElement&&e!==this.hoverElement&&(this.onCountryMouseout(this.hoverElement),this.hoverElement=null);var i=this.configs.hoverFill||e.color;void 0===i&&e.node&&(i=e.node.getAttribute("fill"));i={stroke:this.configs.hoverStroke,fill:this.getFill(i,e.stripe)};e.stripe?e.attr(i):e.stop().animate(i,200),this.g.append(e),this.hoverElement=e,$(this).trigger("countryMouseover",e.node.id)},e.prototype.onCountryMouseout=function(e,t){var i=e.defaultStyle||{stroke:this.configs.stroke};e.stripe?e.attr(i):e.stop().animate(i,200),this.hoverElement=null,$(this).trigger("countryMouseout",e.node.id)},e.prototype.onBgMouseover=function(){this.hoverElement&&this.onCountryMouseout(this.hoverElement)},e.prototype.onCountryClick=function(e,t){$(this).trigger("countryClick",e.node.id)},e.prototype.onBgClick=function(e){$(this).trigger("mapBgClick")},e}]),angular.module("worldPolicyForumApp").directive("selector",function(){return{template:'<div class="selector" ng-transclude></div>',restrict:"E",replace:!0,transclude:!0,require:["selector","ngModel"],controllerAs:"selectorController",controller:["$scope","$element","$timeout",function(e,o,t){var s=[],i=0,n=this,a=null;this.init=function(e){(a=e).$render=this.render.bind(this)},this.addItem=function(e){s.push(e),i&&t.cancel(i),i=t(function(){n.layout(),n.update()},100)},this.layout=function(){for(var e=$(o).width()/(s.length-1),t=0,i=0;i<s.length;i++){var n=s[i];n.setPosition(e*i),n.setIndex(i),t=Math.max(t,n.getHeight())}$(o).height(t+10)},this.select=function(e){a.$setViewValue(e),this.update()},this.update=function(){for(var e=0;e<s.length;e++)s[e].setSelected(e===parseInt(a.$modelValue))},this.render=function(){this.update()}}],link:function(e,t,i,n){n[0].init(n[1])}}}).directive("selectorItem",function(){return{template:'<div class="selector-item" ng-class="{selected: selected}">
1<a href class="dot" ng-click="selectorItemController.select()" aria-hidden="true" tabindex="-1"></a><a href class="item-label" ng-click="selectorItemController.select()" ng-show="label" ng-bind="label"></a></div>',restrict:"E",replace:!0,scope:{label:"=?"},require:["selectorItem","^selector"],controllerAs:"selectorItemController",controller:["$scope","$element",function(t,i){t.selected=!1,t.index=-1;var n=null;this.init=function(e){(n=e).addItem(this)},this.select=function(){n.select(t.index)},this.setPosition=function(e){$(i).css("left",e)},this.setIndex=function(e){t.index=e},this.setSelected=function(e){t.selected=e},this.getHeight=function(){return $(i).height()}}],link:function(e,t,i,n){n[0].init(n[1])}}}),angular.module("worldPolicyForumApp").controller("CountryCtrl",["$scope","$state","$location","$timeout","$filter","api","utils","configs",function(t,i,e,n,o,s,a,r){t.countryId=o("countrySegmentToId")(i.params.country),t.configs=r,t.$state=i,t.countryDetails=null,t.policies=null,t.loading={detail:!0},t.selected={tab:i.params.tab},t.app_path=r.env.APP_PATH;var l=function(){t.selected.tab=i.params.tab}.bind(this),c=function(e,t){e!==i.params.tab&&i.transitionTo("country."+e,{},{location:void 0!==i.params.tab||"replace",inherit:!0})};t.selected.tab||(window.innerWidth<768?t.selected.tab="policies":t.selected.tab="compare-countries"),t.$watch("selected.tab",c),s.getCountryDetails(t.countryId).then(function(e){t.loading.detail=!1,t.countryDetails=e,t.$broadcast("countryDetailsLoaded"),t.$on("$stateChangeSuccess",l)})}]),angular.module("worldPolicyForumApp").controller("AboutContactCtrl",["$scope","$http","configs","api","analytics",function(t,e,i,n,o){t.fields={name:"",email:"",institution:"",institutionName:"",message:"",recaptcha:null},t.recaptchaKey=i.recaptchaKey,t.configs=i,t.page=null;n.getPage("/about/contact").then(function(e){t.page=e})}]),angular.module("worldPolicyForumApp").directive("ellipsis",function(){return{restrict:"A",link:function(e,t,i){}}}),angular.module("worldPolicyForumApp").controller("MethodologyCtrl",["$scope","$sce","api","configs",function(t,e,i,n){t.topics=null,t.page=null,t.getText=function(){return t.page?t.page.text:""};i.getTopics().then(function(e){t.topics=e}),i.getPage("/methodology").then(function(e){t.featureBanner=0<e.images.header.length?e.images.header[0].uri:n.env.APP_PATH+"/images/methodology-banner.jpg",t.page=e})}]),angular.module("worldPolicyForumApp").controller("GlobalAgreementsCtrl",["$scope","$state","$location","$timeout","api","utils","settings","pageTitle","configs",function(s,t,i,n,e,a,o,r,l){s.globalAgreements=null,s.selected={policy:t.params.policy,topicAgreement:t.params.topic,agreement:t.params.agreement},s.loading={globalAgreements:!0};var c={},u={};s.policyMap={};var d=function(e){c=a.createMap(e.pages,"segment");for(var t=0;t<e.pages.length;t++){var i=e.pages[t];angular.extend(u,a.createMap(i.topic_agreements,"segment"));for(var n=0;n<i.topic_agreements.length;n++){var o=i.topic_agreements[n];s.policyMap[o.segment]=a.createMap(o.policies,"segment")}}},p=function(){s.selected.topicAgreement=t.params.topic,s.selected.agreement=t.params.agreement}.bind(this),h=function(e){v()}.bind(this),g=function(e){v()}.bind(this);(function(e){var t=s.currentPolicy();if(t&&t.uri)return i.url(t.uri);v(),n(function(){s.$broadcast("map.resize")}),n(function(){console.log("loaded")},5e3)}).bind(this);this.currentPage=function(){return s.selected.topicAgreement?u[s.selected.topicAgreement]:s.selected.agreement?c[s.selected.agreement]:s.globalAgreements};var m=this,f=function(){var e=m.currentPage();e?r.set("Global Agreements - "+e.title):r.set()};s.currentPolicies=function(){var e=u[s.selected.topicAgreement],i=c[s.selected.agreement];if(e)return $.each(e.policies,function(e,t){t.uri="/policies/"+t.segment+"?filter="+i.agreement_type,t.agreementMapPreview=o.mediaServerHost+"/agreements/"+t.id+"-"+i.agreement_type+"-400x200.png"}),e.policies};var v=function(){var e;t.includes("global-agreements")&&(e=s.selected.topicAgreement?"global-agreements.agreement.topic-agreement":s.selected.agreement?"global-agreements.agreement":"global-agreements",t.transitionTo(e,{agreement:s.selected.agreement,topic:s.selected.topicAgreement},{location:!0,inherit:!1}))};e.getGlobalAgreements().then(function(e){s.featureBanner=0<e.images.header.length?e.images.header[0].uri:l.env.APP_PATH+"/images/resource-banner.jpg",s.loading.globalAgreements=!1,s.globalAgreements=angular.copy(e),d(e),s.$watch("selected.agreement",h),s.$watch("selected.topicAgreement",g),s.$watchGroup(["selected.agreement","selected.topicAgreement"],f),s.$on("$stateChangeSuccess",p)})}]),angular.module("worldPolicyForumApp").controller("MapsDataOverviewCtrl",["$scope","$location","configs",function(e,t,i){e.app_path=i.env.APP_PATH}]),angular.module("worldPolicyForumApp").controller("MapsDataGlobalMapsCtrl",["$scope","$location","$filter","configs",function(e,t,i,n){e.app_path=n.env.APP_PATH,e.selectCountry=function(e){t.path("/countries/"+i("countryIdToSegment")(e)+"/policies")}}]),angular.module("worldPolicyForumApp").controller("MapsDataDataDownloadCtrl",["$scope","$http","$state","$location","api","configs","analytics","pageTitle",function(o,e,t,s,i,n,a,r){o.app_path=n.env.APP_PATH,o.fields={first_name:"",surname:"",email:"",institution:"",institution_name:"",position:"",country:"",agree:!1,recaptcha:null},o.formState="waiting",o.formErrors={},o.recaptchaKey=n.recaptchaKey,o.dataDownloads=null,o.selectedDownload=null,o.selectedFiles=null,o.termsVisible=!1,o.configs=n,o.selected={download:t.params.download};var l=function(){var e=o.selectedDownload;r.set("Data Download"+(e?" - "+e.title:""))},c=function(e){e=[].concat(e);for(var t,i=[];0<e.length;)"data_download_file"===(t=e.pop()).sub_type?i.push(t):t.pages&&(e=e.concat(t.pages));return i},u=function(e,t){o.selectedDownload=function(e){if(o.dataDownloads)for(var t=0;t<o.dataDownloads.length;t++)if(o.dataDownloads[t].segment===e)return o.dataDownloads[t]}(e),o.selectedFiles={},p()},d=function(){o.selected.download=t.params.download};o.setResponse=function(e){o.fields.recaptcha=e},o.showForm=function(){o.formState="waiting"};o.submitForm=function(){return!!o.fields.recaptcha&&(!!o.selectedDownload&&void(o.fields.agree&&(o.formState="loading",e({method:"POST",url:o.selectedDownload.links.href,data:$.param(function(){var e=angular.copy(o.fields),t=o.selectedDownload.files_data_download;e.files=[];for(var i=0;i<t.length;i++)(t.length<2||o.selectedFiles[t[i].id])&&e.files.push(t[i].id);return e}()),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(e,t,i,n){a.sendEvent("data-download","submit",s.url()),e.status?o.formState="done":e.errors?(o.formState="waiting",o.formErrors=e.errors):o.formState="error"}).error(function(e,t,i,n){o.formState="error"}))))},o.toggleTerms=function(){o.termsVisible=!o.termsVisible},o.currentPage=function(){return o.selectedDownload||o.page},o.selectLoneFiles=function(e,t){var i=o.currentPage(),n=t.find('.form-group ul[data-formkey="files"]').closest(".form-group"),t=t.find("input");i&&i.form&&(1===function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i}(i.form.options.files||{})?(n.hide(),t.prop("checked","checked")):n.show())};var p=function(){var e=o.selected.download?"maps-data.data-download.download":"maps-data.data-download";t.transitionTo(e,{download:o.selected.download},{location:!0,inherit:!1})};i.getPage("/maps-data/data-download").then(function(e){o.page=e,o.dataDownloads=c(e.pages),o.$w
1atch("selected.download",u),o.$on("$stateChangeSuccess",d),o.$watchGroup(["selectedDownload","dataDownloads"],l)})}]),angular.module("worldPolicyForumApp").controller("PublicationsCtrl",["$scope","$state","$location","api","utils","pageTitle","configs",function(t,i,e,n,s,o,a){t.$state=i,t.publications=null,t.publicationMap=null,t.isLoading=!0,t.selected={publication:i.params.publication,page:i.params.page};var r=this,l=function(){var e=t.publicationMap[r.currentPage()];e&&o.set(e.title)},c=function(e){for(var t,i=s.createMap(e,"segment"),n=0;n<e.length;n++)for(var o in t=s.createMap(e[n].pages,"segment"))i[o]=t[o];return i},u=function(){t.selected.publication=i.params.publication,t.selected.page=i.params.page};this.selectPublication=function(e){t.selected.publication=e,t.selected.page=null},this.selectPage=function(e){t.selected.page=e},this.currentPage=function(){return t.selected.page||t.selected.publication};var d=function(){var e;i.includes("publications")&&(e=t.selected.page?"publications.publication.page":t.selected.publication?"publications.publication":"publications",i.transitionTo(e,{publication:t.selected.publication,page:t.selected.page},{location:"replace",inherit:!1}))}.bind(this);n.getPage("/publications").then(function(e){t.featureBanner=0<e.images.header.length?e.images.header[0].uri:a.env.APP_PATH+"/images/agreements-banner.jpg",t.isLoading=!1,t.publications=e,t.publicationMap=c(e.pages),i.params.publication||r.selectPublication(t.publications.pages[0].segment),t.$watch("selected.publication",d),t.$watch("selected.publication",l),t.$watch("selected.page",d),t.$on("$stateChangeSuccess",u)})}]),angular.module("worldPolicyForumApp").controller("ResourcesCtrl",["$scope","$state","$location","api","configs",function(t,i,e,n,o){t.pages=null,t.selected={resource:i.params.resource,file:i.params.file};var s=function(){t.selected.resource=i.params.resource,t.selected.file=i.params.file}.bind(this),a=function(e){l()}.bind(this),r=function(e){l()}.bind(this),l=function(){var e;i.includes("resources")&&(e=t.selected.file?"resources.resource.file":t.selected.resource?"resources.resource":"resources",i.transitionTo(e,{resource:t.selected.resource,file:t.selected.file},{location:!0,inherit:!1}))};n.getPage("/resources").then(function(e){t.page=e,t.featureBanner=0<e.images.header.length?e.images.header[0].uri:o.env.APP_PATH+"/images/resource-banner.jpg",t.pages=e.pages,t.selected.resource||(t.selected.resource=t.pages[0].segment),t.$watch("selected.resource",a),t.$watch("selected.file",r),t.$on("$stateChangeSuccess",s)})}]),angular.module("worldPolicyForumApp").controller("EventsLaunchesCtrl",["$scope","$state","api",function(t,e,i){t.page=null;i.getPage("/events-launches").then(function(e){t.page=e})}]),angular.module("worldPolicyForumApp").directive("mapsDataMenu",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/maps-data-menu.html",restrict:"E",controllerAs:"mapsDataMenuController",scope:{downloads:"=",selectedDownload:"=?"},controller:["$scope","$location",function(t,e){t.selectDownload=function(e){t.selectedDownload=e.segment},t.isSelectedDownload=function(e){return e.segment===t.selectedDownload}}],link:function(e,t,i){}}}]),angular.module("worldPolicyForumApp").directive("selectorMap",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/selector-map.html",restrict:"E",replace:!0,scope:{selected:"=?",select:"&?"},controllerAs:"selectorMapController",controller:["$scope","$element","$timeout","Map","MapResizer","MapPopover","MapBuilder","configs","api",function(i,e,t,n,o,s,a,r,l){i.configs=r,i.countryMap={},i.selected={dropdown:null};this.init=function(){u(),i.$watch("selected.dropdown",c),i.$on("$destroy",this.destroy)},this.destroy=function(e){}.bind(this),this.selectCountry=function(e){i.select&&i.select({countryId:e})}.bind(this);var c=function(e){i.select&&e&&i.select({countryId:e})}.bind(this),u=function(){for(var e=0;e<r.countries.length;e++){var t=r.countries[e];i.countryMap[t.iso]={iso:t.iso,name:t.name}}}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").factory("MapResizer",function(){function e(e,t){this.map=e,this.scope=t,this.resize(),this.onResizeDelegate=this.onResize.bind(this),angular.element(window).on("resize",this.onResizeDelegate),t&&t.$on("map.resize",this.onResizeDelegate),$(e).on("mapInitComplete",this.onResizeDelegate)}return e.prototype.destroy=function(){angular.element(window).off("resize",this.onResizeDelegate),$(this.map).off("resize",this.onResizeDelegate)},e.prototype.onResize=function(){this.resize()},e.prototype.resize=function(){this.map.adjust($(this.map.container).width(),$(this.map.container).height()),this.scope.$parent&&(this.scope.$parent.countryFilters&&this.scope.$parent.countryFilters.length||this.scope.$parent.selected&&this.scope.$parent.selected.filters&&this.scope.$parent.selected.filters.length)&&this.scope.$parent.zoomInto()},e}),angular.module("worldPolicyForumApp").factory("MapPopover",["$window","configs","utils",function(t,e,
1i){return function(o,s,e,a){this.mouse={x:0,y:0},this.popover={show:!1,x:0,y:0,countryId:null,showDetail:!1,hasDetail:e},this.init=function(){$(o).on("countryMouseover",this.onCountryMouseover),$(o).on("countryMouseout",this.onCountryMouseout),$(o).on("countryClick",this.onCountryClick),$(o).on("mapDragged",this.onMapDragged),$(o).on("mapDraggingFinished",this.onMapDraggingFinished),$(o).on("mapBgClick",this.onMapBgClick),$(o).on("pinchStart",this.onPinchStart),$(t).on("orientationchange",this.onOrientationChange),$(o.container).on("mousemove touchstart",this.onMouseMove)},this.destroy=function(){$(o).off("countryMouseover",this.onCountryMouseover),$(o).off("countryMouseout",this.onCountryMouseout),$(o).off("countryClick",this.onCountryClick),$(o).off("mapDragged",this.onMapDragged),$(o).off("mapDraggingFinished",this.onMapDraggingFinished),$(o).off("mapBgClick",this.onMapBgClick),$(t).off("orientationchange",this.onOrientationChange),$(o.container).off("mousemove touchstart",this.onMouseMove)},this.onMouseMove=function(e){this.mouse.x=i.eventOffsetX(e),this.mouse.y=i.eventOffsetY(e),"mousemove"!==e.type||this.popover.showDetail||this.movePopoverToCursor()}.bind(this),this.onCountryMouseover=function(e,t){if(!this.popover.showDetail&&s.countryMap&&s.countryMap[t])return this.popover.show=!0,this.popover.countryId=t,void s.$apply();for(var i in s.countryMap)s.countryMap[i].enableSubnational&&s.countryMap[i].subnational.regions[t]&&(this.popover.show=!0,this.popover.countryId=t,s.$apply())}.bind(this),this.onCountryMouseout=function(e,t){this.popover.showDetail||(this.popover.show=!1,this.popover.countryId=t,s.$apply())}.bind(this),this.onCountryClick=function(e,t){this.popover.show=!0,this.popover.show&&(this.popover.showExcerpts=!this.popover.showExcerpts,this.popover.countryId=t,this.movePopoverToCursor(),s.$apply())}.bind(this),this.onPinchStart=function(){this.popover.show=!1,s.$apply()}.bind(this),this.onMapDragged=function(e){this.closePopover(),s.$apply()}.bind(this),this.onMapDraggingFinished=function(e){}.bind(this),this.onMapBgClick=function(e){this.closePopover(),s.$apply()}.bind(this),this.onOrientationChange=function(){this.closePopover(),s.$apply()}.bind(this),this.closePopover=function(){this.popover.show=!1,this.popover.showDetail=!1},this.movePopoverToCursor=function(){if(isNaN(this.mouse.x)||isNaN(this.mouse.y))return!1;var e=$(o.container).width(),t=$(o.container).height(),i=$(a).width(),n=$(a).height();0<i?(this.popover.x=Math.min(Math.max(this.mouse.x-i/2,0),e-i),this.popover.y=this.mouse.y-t-2*n-10,this.popover.tipX=Math.min(Math.max(this.mouse.x-this.popover.x,15),i-15)):(this.popover.x=-1e4,this.popover.y=-1e4,this.popover.tipX=-1e4),s.$apply()},this.selectCountry=function(e){this.popover.show=!0,this.popover.countryId=e,this.popover.showDetail=!1;e=o.getCountryViewPosition(e);this.popover.x=e.x,this.popover.y=e.y},this.init()}}]),angular.module("worldPolicyForumApp").factory("MapBuilder",["utils",function(o){return function(t,e,i,n){t.$watch(e,function(e){e&&(t[i]=o.createMap(e,n))})}}]),angular.module("worldPolicyForumApp").controller("ImageGeneratorCtrl",["$scope","$state","$location","$timeout","$q","api","utils",function(i,n,e,t,o,s,a){i.policies=null,i.policy=null,i.countries=null,i.mode=e.search().mode,i.filter=e.search().filter;var r=function(e){for(var t=0;t<i.policies.length;t++)if(i.policies[t].id===e)return i.policies[t]},l=function(e){e=e.uri.split("/");return s.getPolicyDetails(e[e.length-1]).then(function(e){i.countries&&c(e,i.countries),i.policy=e,a.safeApply(i),console.log("PUMP"),t(function(){console.log("apply")}),t(function(){console.log("loaded")},1e4)})},c=function(e,t){var i=[];if("combined_policies"===e.sub_type)for(var n=0;n<e.combined_policies.length;n++){var o=e.combined_policies[n];u(t,o),i.push(o.key)}else u(t,e),i.push(e.key)},u=function(e,t){if(e&&t.countries){var i,n=a.createMap(t.countries,"iso"),o=a.createMap(e,"iso");for(i in n)$.extend(!0,n[i],o[i])}};!function(){var e=[];e.push(s.getPolicies().then(function(e){return i.policies=e,r(n.params.policyId)})),i.filter&&e.push(s.getCountries());var t=o.defer();i.$on("colorMapInitComplete",function(){console.log("colorMapInitComplete"),t.resolve()}),e.push(t.promise),o.all(e).then(function(e){i.filter&&(i.countries=e[1]),e[0]&&l(e[0])})}()}]),angular.module("worldPolicyForumApp").directive("internationalAgreementsMap",["api","configs",function(s,a){return{template:'<div class="international-agreements-map"><color-map class="legend-below" configs="configs" country-map="countryMap" legends="legends" country="{{country}}" is-loading="{{isLoading}}"></color-map></div>',restrict:"E",replace:!0,scope:{policy:"=?",country:"@?"},link:function(n,e,t){n.legends=null,n.countryMap=null,n.isLoading=!0,n.configs=a.internationalAgreementsMap;var i=function(e){e&&e.length&&(n.isLoading=!0,s.getTopicAgreementPolicy(e).then(function(e){o(e),n.isLoading=!1}))}.bind(this),o=function(e){if(e){n.legends=e.values,n.countryMap={};for(var t=0;t<e.countries.length;t++){var i=e.countries[t];n.countryMap[i.iso]={iso:i.iso,name:i.name,color:i.data[e.key].c
1olor,cbm_color:i.data[e.key].cbm_color,value:i.data[e.key].value,valueId:i.data[e.key].value_id,text:""}}}};n.$watch("policy",i)}}}]),angular.module("worldPolicyForumApp").service("utils",function(){this.removeDuplicatedEntry=function(e,t){for(var i={},n=e.length-1;0<=n;n--){var o=e[n];o[t]in i?e.splice(n,1):i[o[t]]=!0}},this.createMap=function(e,t,i){for(var n={},o=0;o<e.length;o++){var s=e[o];n[s[t]]=i?i(s):s}return n},this.eventOffsetX=function(e){if((e=e||window.event).hasOwnProperty("deltaX"))return e.deltaX;var t=(e.currentTarget||e.srcElement).getBoundingClientRect(),i=e.clientX;return(i=e.originalEvent&&e.originalEvent.touches&&1===e.originalEvent.touches.length?e.originalEvent.touches[0].clientX:i)-t.left},this.eventOffsetY=function(e){if((e=e||window.event).hasOwnProperty("deltaY"))return e.deltaY;var t=(e.currentTarget||e.srcElement).getBoundingClientRect(),i=e.clientY;return(i=e.originalEvent&&e.originalEvent.touches&&1===e.originalEvent.touches.length?e.originalEvent.touches[0].clientY:i)-t.top},this.isEmpty=function(e){return angular.isUndefined(e)||null===e||""===e},this.isIE=function(){return-1<navigator.userAgent.indexOf("MSIE")},this.ie=function(){var e=navigator.userAgent.toLowerCase();return-1!==e.indexOf("msie")?parseInt(e.split("msie")[1],10):void 0},this.isIE11=function(){return!window.ActiveXObject&&"ActiveXObject"in window},this.isChrome=function(){var e=-1<navigator.userAgent.indexOf("Chrome"),t=-1<navigator.userAgent.toLowerCase().indexOf("op");return e=e&&t?!1:e},this.isFirefox=function(){return-1<navigator.userAgent.indexOf("Firefox")},this.isSafari=function(){var e=-1<navigator.userAgent.indexOf("Safari");return e=-1<navigator.userAgent.indexOf("Chrome")&&e?!1:e},this.isOpera=function(){return-1<navigator.userAgent.toLowerCase().indexOf("op")},this.isIos=function(){return/iPad|iPhone|iPod/.test(navigator.platform)},this.safeApply=function(e,t){var i=e.$root.$$phase;"$apply"===i||"$digest"===i?t&&"function"==typeof t&&t():e.$apply(t)}}),angular.module("worldPolicyForumApp").directive("hoverColor",function(){return{restrict:"A",link:function(e,t,i){$(t).on("mouseover focus",function(){$(this).css({backgroundColor:i.hoverColor})}),$(t).on("mouseout blur",function(){$(this).css({backgroundColor:""})})}}}),angular.module("worldPolicyForumApp").directive("agreementAccordion",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/agreement-accordion.html",restrict:"E",replace:!0,scope:{selectedAgreement:"=?"},controllerAs:"agreementAccordionController",controller:["$scope","$element","$q","api",function(n,e,t,i){n.globalAgreements=null,n.isLoading=!0;var o=this;this.init=function(){i.getGlobalAgreements().then(function(e){n.isLoading=!1,n.globalAgreements=e,o.selectAgreement(n.globalAgreements.pages[0])})},this.selectAgreement=function(e){n.selectedAgreement=e;for(var t=0;t<n.globalAgreements.pages.length;t++){var i=n.globalAgreements.pages[t];i.isOpen=i===e}}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("loadingIndicator",function(){return{template:'<div ng-show="isLoading" class="loading-indicator"><div middle middle-horizontal><span class="icon icon-loading-white-large"></span></div></div>',restrict:"E",replace:!0,scope:{isLoading:"=?"},link:function(e,t,i){}}}),angular.module("worldPolicyForumApp").directive("tabMenu",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/tab-menu.html",restrict:"E",replace:!0,scope:{selectedTab:"=?",tabs:"=?",isLeft:"=?",isRight:"=?",policy:"=?",waitPolicy:"=?"},controllerAs:"tabMenuController",controller:["$scope","$element",function(i,t){this.init=function(){i.$watch("policy",function(e){}),angular.element(window).on("resize",e),setTimeout(function(){this.setArrows()}.bind(this),500)},this.setArrows=function(e){i.isRight=$(t).get(0).scrollLeft<parseInt($(t).find(".slider").width())-parseInt($(t).width()),i.isLeft=0<$(t).get(0).scrollLeft,setTimeout(function(){i.$apply()},0)},this.setRTLArrows=function(){i.isRight=$(t).get(0).scrollLeft!==parseInt($(t).width()-parseInt($(t).find(".slider").width())),i.isLeft=$(t).get(0).scrollLeft<0,setTimeout(function(){i.$apply()},0)};var e=function(){this.setArrows()}.bind(this);this.selectTab=function(e){!i.policy&&i.waitPolicy||(i.selectedTab=e,setTimeout(function(){window.dispatchEvent(new Event("resize"))},300))},this.selectSubtab=function(e,t){i.$emit("SelectSubtab",e,t)},this.selectedTab=function(){return i.selectedTab},this.scrollLeft=function(){var e=Math.max(0,$(t).scrollLeft()-100);$(t).animate({scrollLeft:e},500,"swing",function(){this.setArrows()}.bind(this))},this.scrollRight=function(){var e=Math.min($(t).get(0).scrollWidth,$(t).scrollLeft()+100);$(t).animate({scrollLeft:e},500,"swing",function(){this.setArrows()}.bind(this))},this.scrollRTLRight=function(){$(t).animate({scrollLeft:$(t).scrollLeft()-100},500,"swing",function(){this.setRTLArrows()}.bind(this))},this.scrollRTLLeft=function(){$(t).animate({scrollLeft:$(t).scrollLeft()+100},500,"swing",function(){this.setRTLArrows()}.bind(this))},this.isScrollable=function(){return $(t).get(0).scrollWidth>$(t).width()}}],link:function(e,t,i,n){n.init()}}}]).directive("tabItem",function(){return{restrict:"A",require:["tabItem","^tabMenu"],scope:!0,controllerAs:"tabItemController",controller:["$scope",function(t){this.init=function(e){t.tabMenuController=e,t.options=t.options||{}}}],link:function(e,t,i,n){n[0].init(n[1])}}}),angular.module("worldPolicyForumApp").directive("policyGroupList",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/policy-group-list.html",restrict:"E",replace:!0,scope:{policies:"=?",blockType:"@?"},controllerAs:"policyGroupListController",controller:["$scope",function(t){t.groups=[],t.$watch("policies",function(e){e&&(t.groups=e.map((e,t)=>Object.assign({openAccordion:0===t},e)))}
1),t.expandAllAccordions=function(){t.groups.forEach(e=>{e.openAccordion=!0})},t.collapseAllAccordions=function(){t.groups.forEach(e=>{e.openAccordion=!1})}}],link:function(e,t,i){}}}]),angular.module("worldPolicyForumApp").directive("countryMap",function(){return{template:'<div class="country-map"></div>',restrict:"E",replace:!0,scope:{selectedCountry:"@?"},controllerAs:"countryMapController",controller:["$scope","$element","Map","configs",function(t,e,i,n){var o;this.init=function(){o=new i($(e).get(0),n.countryMap),$(o).on("mapInitComplete",this.onMapInitComplete)},this.onMapInitComplete=function(e){o.s.attr({width:"100%",height:"100%"}),o.focusCountry(t.selectedCountry)}.bind(this)}],link:function(e,t,i,n){n.init()}}}),angular.module("worldPolicyForumApp").directive("policyAccordion",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/policy-accordion.html",restrict:"E",replace:!0,scope:{globalAgreements:"=?",selectedPolicy:"=?",selectedTopicAgreement:"=?",selectedAgreement:"=?",mainTopicId:"=?"},controllerAs:"policyAccordionController",controller:["$scope","$element","$q","api","utils",function(s,e,t,i,o){s.isLoading=!0,s.agreementMap=null,s.topicAgreementMap=null;this.init=function(){s.$watch("globalAgreements",n),s.$watch("mainTopicId",function(e){e&&s.globalAgreements&&n(s.globalAgreements)})};var n=function(e){if(e){s.agreementMap=o.createMap(e.pages,"segment"),s.topicAgreementMap={};for(var t=0;t<e.pages.length;t++){var i=e.pages[t];angular.extend(s.topicAgreementMap,o.createMap(i.topic_agreements,"segment"))}s.isLoading=!1}var n;s.mainTopicId&&($.each(s.agreementMap,function(e,i){var n,o=[];$.each(i.topic_agreements,function(e,t){t.topic.id===s.mainTopicId&&o.push(t)}),i.topic_agreements=o,0===i.topic_agreements.length&&(delete s.agreementMap[e],n=[],$.each(s.globalAgreements.pages,function(e,t){i.id!==t.id&&n.push(t)}),s.globalAgreements.pages=n)}),1===Object.keys(s.agreementMap).length&&(n=s.agreementMap[Object.keys(s.agreementMap)[0]],s.selectedAgreement=n.segment,n.topic_agreements.length&&(n=n.topic_agreements[Object.keys(n.topic_agreements)[0]],s.selectedTopicAgreement=n.segment)))}.bind(this);this.selectAgreement=function(e){s.selectedAgreement===e?s.selectedAgreement=null:s.selectedAgreement=e,s.selectedTopicAgreement=null,s.selectedPolicy=null},this.selectTopicAgreement=function(e){e===s.selectedTopicAgreement?(s.selectedTopicAgreement=null,s.selectedPolicy=null):(s.selectedTopicAgreement=e,s.selectedPolicy=s.topicAgreementMap[e].policies[0].segment)},this.selectPolicy=function(e){s.selectedPolicy=e.segment}}],link:function(e,t,i,n){n.init()}}}]).filter("filterTopicAgreements",function(){return function(e){var t=[];if(void 0!==e)for(var i,n=0;n<e.length;n++)void 0===e[n]||(i=e[n]).policies.length&&t.push(i);return t}}),angular.module("worldPolicyForumApp").directive("resources",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/resources.html",restrict:"E",replace:!0,scope:{pages:"=?",selectedResource:"=?",selectedPage:"=?",selectedSubPage:"=?",topic:"=?"},controllerAs:"resourcesController",controller:["$scope","$state","utils","pageTitle",function(o,n,s,a){o.currentPage=null,o.resourceMap=null,this.init=function(){o.$watch("pages",e),o.$watch("selectedResource",this.selectResource),o.$watch("selectedPage",this.selectResourcePage),o.$watch("selectedSubPage",this.selectResourceSubPage)};var e=function(e){function t(e){return{instance:e,children:{}}}if(e){o.resourceMap=s.createMap(e,"segment",t);for(var i=0;i<e.length;i++){o.resourceMap[e[i].segment].children=s.createMap(e[i].pages,"segment",t);for(var n=0;n<e[i].pages.length;n++)o.resourceMap[e[i].segment].children[e[i].pages[n].segment].children=s.createMap(e[i].pages[n].pages,"segment")}}r()}.bind(this);this.selectResource=function(e,t){e!==t&&(o.selectedResource=e,t&&e!==t&&(o.selectedPage=null,o.selectedSubPage=null),r())},this.selectResourcePage=function(e,t){e!==t&&(o.selectedPage=e,t&&e!==t&&(o.selectedSubPage=null),r())},this.selectResourceSubPage=function(e,t){e!==t&&(o.selectedSubPage=e,r())},this.trackFileDownload=function(e){var t;"undefined"!=typeof ga&&(t="Resources - "+this.currentPage().title,e=e.title+" - "+e.id,ga("send","event",t,"download",e))},this.preprocessSummaryLinkHTML=function(e){var t=$(document.createElement("div")),e=$(e.summary);t.append(e);for(var i,n=e.find("a"),o=0;o<n.length;o++)(i=$(n[o])).attr("href")&&i.attr("ng-click","resourcesController.trackLinkFollow(file)");return t.html()},this.trackLinkFollow=function(e){"undefined"!=typeof ga&&(e=this.currentPage().title+"-"+e.title+"-"+e.id,ga("send","event","Resources","follow-link",e))};var r=function(){var e,t,i;0<=n.current.name.indexOf("resources")&&(e=this.currentPage(),i=[],o.topic&&i.push(o.topic.name),e?(t=Array.from(e.parents).map(e=>e.title),(i=i.concat(t)).push(e.title)):i.push("Resources"),a.set(i.join(" - ")))}.bind(this);this.currentPage=function(){if(o.resourceMap){var e=function(){for(var e=[o.selectedResource,o.selectedPage,o.selectedSubpage],t=function(e,t){for(var i,n=[],o=e,s=0;s<t.length;s++){if(!(i=o[t[s]]))return n;n.push(i.instance),o=i.children}}(o.resourceMap,e),i=e.length-1;0<=i;i--)if(t[i])return t[i]}();return e&&e.files&&$.each(e.files,function(e,t){t.hasLink=$("<div>
1"+t.summary+"</div>").find("a").length}),e}}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("headerBanner",["configs",function(i){return{templateUrl:i.env.APP_PATH+"/views/directives/header-banner.html",restrict:"E",replace:!0,scope:{image:"=?",parents:"=?",current:"=?"},controllerAs:"headerBannerController",controller:["$scope",function(t){t.bannerImage=null,t.$watch("image",function(e){t.bannerImage=t.image||i.env.APP_PATH+"/images/resource-banner.jpg"})}]}}]),angular.module("worldPolicyForumApp").directive("pagesCardList",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/pages-card-list.html",restrict:"E",replace:!0,scope:{pages:"=?"},controllerAs:"pagesCardListController",controller:["$scope",function(t){t.processedPages=[];t.$watch("pages",function(e){e&&(t.processedPages=e.map(e=>{let t=e.text.replace(/<[^>]+>/g,"").replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)});return{id:e.id,image:e.images.header.length?e.images.header[0]:null,title:e.title,body:250<t.length?t.slice(0,250)+"...":t,url:e.uri}}))})}]}}]),angular.module("worldPolicyForumApp").directive("resourceLinks",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/resource-links.html",restrict:"E",replace:!0,scope:{resources:"=?"},controllerAs:"resourceLinksController",controller:["$scope",function(e){this.init=function(){}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").filter("legendFilter",function(){return function(e){if(e){for(var t=[],i=0;i<e.length;i++){var n=e[i];n.value_id&&n.value_id.length&&t.push(n)}return t}}}),angular.module("worldPolicyForumApp").filter("trustedHTML",["$sce",function(t){return function(e){return t.trustAsHtml(e)}}]),angular.module("worldPolicyForumApp").controller("CountryPoliciesController",["$scope","$state","settings","pageTitle",function(a,t,i,e){a.selected={topic:t.params.topic,subtopic:t.params.subtopic,topicOrSubtopic:null};var r={},l={};var n=function(e){if(e){for(var t=e.topics,i=0;i<t.length;i++){var n=t[i];r[n.segment]=n,l[n.segment]=[],n.policies.length&&(l[n.segment]=[angular.copy(n)]);for(var o=0;o<n.subtopics.length;o++){var s=n.subtopics[o];s.policies.length&&(l[s.segment]=[angular.copy(s)],l[n.segment].push(angular.copy(s)))}}a.selected.topic||(a.selected.topic=e.topics[0].segment,h()),a.$watch("selected.topic",u),a.$watch("selected.subtopic",d),a.$watch("selected.topicOrSubtopic",p),a.$on("$stateChangeSuccess",c)}}.bind(this),c=function(){a.selected.topic=t.params.topic,a.selected.subtopic=t.params.subtopic}.bind(this),u=function(e,t){o(),h()}.bind(this),d=function(e,t){o(),h()}.bind(this),o=function(){a.selected.topicOrSubtopic=a.selected.subtopic||a.selected.topic}.bind(this),p=function(e){e&&l&&(a.policies=l[e],i.lastTopic=e.split("/").splice(0,3).join("/"))}.bind(this),h=function(){var e;t.includes("country.policies")&&(e=a.selected.subtopic?"country.policies.topic.subtopic":a.selected.topic?"country.policies.topic":"country.policies",t.transitionTo(e,{topic:a.selected.topic,subtopic:a.selected.subtopic},{location:"replace",inherit:!0}))};a.$watch("countryDetails",n),a.$watchGroup(["countryDetails","selected.topicOrSubtopic"],function(){a.countryDetails&&r[a.selected.topic]&&e.set(a.countryDetails.name+" - Policies - "+r[a.selected.topic].name)})}]),angular.module("worldPolicyForumApp").controller("CountryGlobalAgreementsController",["$scope","$state","$timeout","api","configs","utils",function(s,t,i,e,n,a){s.globalAgreements=null,s.configs=n,s.selected={agreement:t.params.agreement,policy:t.params.policy,topicAgreement:t.params.topicAgreement},s.loading={globalAgreements:!0};var r={},l={};s.policyMap={};var o=function(e){r=a.createMap(e.pages,"segment");for(var t=0;t<e.pages.length;t++){var i=e.pages[t];angular.extend(l,a.createMap(i.topic_agreements,"segment"));for(var n=0;n<i.topic_agreements.length;n++){var o=i.topic_agreements[n];s.policyMap[o.segment]=a.createMap(o.policies,"segment")}}},c=function(){s.selected.policy=t.params.policy,s.selected.topicAgreement=t.params.topicAgreement,s.selected.agreement=t.params.agreement}.bind(this),u=function(e){h()}.bind(this),d=function(e){h()}.bind(this),p=function(e){h(),i(function(){s.$broadcast("map.resize")})}.bind(this);this.currentPage=function(){return s.selected.topicAgreement?l[s.selected.topicAgreement]:s.selected.agreement?r[s.selected.agreement]:s.globalAgreements},s.currentPolicy=function(){return s.policyMap[s.selected.topicAgreement]?s.policyMap[s.selected.topicAgreement][s.selected.policy]:{}};var h=function(){var e;t.includes("country.global-agreements")&&(e=s.selected.policy?"country.global-agreements.agreement.topic-agreement.policy":s.selected.topicAgreement?"country.global-agreements.agreement.topic-agreement":s.selected.agreement?"country.global-agreements.agreement":"country.global-agreements",t.transitionTo(e,{policy:s.selected.policy,topicAgreement:s.selected.topicAgreement,agreement:s.selected.agreement},{location:"replace",inherit:!0}))};e.getGlobalAgreements().then(function(e){s.loading.globalAgreements=!1,s.globalAgreements=angular.copy(e),o(e),s.$watch("selected.agreement",u),s.$watch("selected.topicAgreement",d),s.$watch("selected.policy",p),s.$on("$stateChangeSuccess",c)})}]),angular.module("worldPolicyForumApp").controller("CountryCompareCountriesController",["$scope","$rootScope","$http","api","pageTitle","configs",function(n,e,t,i,o,s){n.topics=null,n.activeTopic=null,n.activeSubtopic=null,n.countries=null,n.policies=null,n.otherCountry=null,n.otherCountryDetails=null,n.activeMenu=null,n.loadingTopics=!0,n.loadingCountries=!0,n.loadingPolicies=!0,n.loadingCountryDetails=!0,n.loadingOtherCountry=!1,n.overviewOpen=!1,n.savedPolicies=[],n.savedPopupOpen=!1,n.showSavedTooltip=null,n.excerpts={},n.app_path=s.env.APP_PATH,n.setOtherCountry=function(e){n.otherCountry=e,n.otherCountryDetails=null,n.loadingOtherCountry=!0,i.getCountryDetails(e.iso).then(function(e){n.otherCountryDetails=e,n.loadingOtherCountry=!1})},n.setActiveTopic=function(e){n.activeTopic!==e&&(n.activeTopic=e,n.setActiveSubtopic(null))},n.setActiveSubtopic=function(e){if(n.activeSubtopic===e)return!1;n.activeSubtopic=e},n.isLoading=function(){return n.loadingTopics||n.loadingCountries||n.loadingPolicies||n.loadingCountryDetails||n.loadingOtherCountry},n.isActiveMenu=function(e){return e===n.activeMenu},n.closeMenu=function(e){e&&n.activeMenu!==e||(n.activeMenu=null)},n.setActiveMenu=function(e,t){n.activeMenu=e},n.setOverviewOpen=function(e){n.overviewOpen=!!e},n.isTopicEnabled=function(e){return null===n.activeSubtopic||(e===n.activeTopic||e===n.activeSubtopic)},n.savedPolicyIndex=function(e){for(var t=0;t<n.savedPolicies.length;t++)if(n.savedPolicies[t]===e)return t},n.unsavePolicy=function(e){e=n.savedPolicyIndex(e);void 0!==e&&n.savedPolicies.splice(e,1)},n.savePolicy=function(e){if(void 0!==n.savedPolicyIndex(e))return!1;n.savedPolicies.push(e)},n.toggleSavedPopup=function(){n.savedPopupOpen=!n.savedPopupOpen},n.showingSavedTooltip=function(){return null!==n.showSavedTooltip}
1,n.chooseActive=function(e,t,i){e(t),n.setActiveMenu(null),i.stopPropagation()},n.savePdf=function(){window.print()},e.$on("compare-country.save-policy",function(e,t){n.savePolicy(t.policy),n.showSavedTooltip&&window.clearTimeout(n.showSavedTooltip),n.showSavedTooltip=window.setTimeout(function(){n.showSavedTooltip=null,n.$apply()},750)}),e.$on("compare-country.remove-policy",function(e,t){n.unsavePolicy(t.policy)}),i.getTopics().then(function(e){n.topics=e,n.loadingTopics=!1}),i.getCountries().then(function(e){n.countries=e,n.loadingCountries=!1,n.setOtherCountry(e[0])}),i.getPolicies().then(function(e){n.policies=e,n.loadingPolicies=!1}),n.$watchGroup(["countryDetails","otherCountryDetails"],function(){n.countryDetails&&o.set(n.countryDetails.name+" - Compare Countries"),n.countryDetails&&n.otherCountryDetails&&t.get("/api/excerpts?country="+n.countryDetails.iso+","+n.otherCountryDetails.iso).then(function(e){n.excerpts=e.data.data})}),null===n.$parent.countryDetails?n.$parent.$on("countryDetailsLoaded",function(){n.countryDetails=n.$parent.countryDetails,n.loadingCountryDetails=!1}):(n.countryDetails=n.$parent.countryDetails,n.loadingCountryDetails=!1)}]),angular.module("worldPolicyForumApp").directive("countryCompareOverview",["configs",function(i){return{templateUrl:i.env.APP_PATH+"/views/directives/country-compare-overview.html",restrict:"E",replace:!0,scope:{country:"=",side:"@"},controllerAs:"countryCompareOverviewController",controller:["$scope","$element",function(e,t){e.app_path=i.env.APP_PATH,e.ratifiedCRC=function(){return!!e.country&&"crc__1"===e.country.data.crc.value_id},e.ratifiedCEDAW=function(){return!!e.country&&"cedaw__1"===e.country.data.cedaw.value_id}}]}}]),angular.module("worldPolicyForumApp").directive("countryComparePolicy",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/country-compare-policy.html",restrict:"E",replace:!1,scope:{mainCountry:"=",otherCountry:"=",policy:"=",excerpts:"=",saved:"="},controllerAs:"countryComparePolicyController",controller:["$scope","$rootScope","api","excerpt",function(o,e,t,i){var n={};o.excerpt=i,o.getTopicPolicy=function(e,t){for(var i,n,o,s,a=[e];0<a.length;){for(i=a.shift(),n=0;n<i.policies.length;n++){if(i.policies[n].id===t.id)return i.policies[n];if(s=i.policies[n].combined_policies)for(o=0;o<s.length;o++)if(s[o].id===t.id)return s[o]}a=a.concat(i.subtopics)}};function s(e,t){if(e&&t)return n[e.iso]||(n[e.iso]={}),n[e.iso][t.id]||(n[e.iso][t.id]=function(e,t){for(var i,n=0;n<e.topics.length;n++)if(i=o.getTopicPolicy(e.topics[n],t))return i}(e,t)),n[e.iso][t.id]}o.getCountryPolicy=function(e,t){var i=s(e,t);if(i&&i.countries&&1===i.countries.length&&i.countries[0].iso===e.iso)return i.countries[0].data[t.key]},o.getCountryPolicyX=function(e,t,i,n){i=o.getCountryPolicy(t,i);if(i&&i[e]){e=i[e].replace(/^\s+|\s+$/g,"");if(e)return e}return n},o.getCountryPolicyValue=function(e,t){return o.getCountryPolicyX("popover_value",e,t,"Data is not available")},o.getCountryPolicyColor=function(e,t,i){t=o.getCountryPolicyX("color",e,t,"#000");return i&&"#E2E2E2"===t?"#000":t},o.savePolicy=function(){e.$broadcast("compare-country.save-policy",{policy:o.policy})},o.unsavePolicy=function(){e.$broadcast("compare-country.remove-policy",{policy:o.policy})}}]}}]),angular.module("worldPolicyForumApp").directive("countryCompareTopic",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/country-compare-topic.html",restrict:"E",replace:!1,scope:{mainCountry:"=main",otherCountry:"=other",topic:"=",excerpts:"=",topicPath:"=",activeSubtopic:"="},controllerAs:"CountryCompareTopicController",controller:["$scope",function(n){var o=function(e,t){for(var i,n=0;n<e.length;n++){if(e[n].id===t.id)return e[n];if(e[n].subtopics&&0<e[n].subtopics.length&&(i=o(e[n].subtopics,t)))return i}};n.getPolicies=function(){if(n.mainCountry){var e,t=[];n.mainCountry&&n.topic&&((e=o(n.mainCountry.topics,n.topic))&&(t=e.policies));for(var i=0;i<t.length;i++)t[i].combined_policies&&(t=t.concat(t[i].combined_policies));return function(e){if(n.activeSubtopic)return e;for(var t=[],i=0;i<e.length;i++)e[i].highlight_in_comparison&&t.push(e[i]);return t}(t)}}}]}}]),angular.module("worldPolicyForumApp").controller("TopicPoliciesController",["$scope","$location","$state","api","settings","pageTitle",function(o,e,s,n,t,i){o.filters={searchKeywords:"",subtopic:s.params.subtopic},o.loading={policies:!0}
1,o.policies=null,o.subtopics=[],o.topicName="";var a={},r={};var l=function(){i.set(r[o.filters.subtopic||s.params.topic])},c=function(e){if(e){a[e.segment]=n.makePolicyGroups(e),r[e.segment]=e.name;for(var t=0;t<e.subtopics.length;t++){var i=e.subtopics[t];a[i.segment]=n.makePolicyGroups(i),r[i.segment]=e.name+" - "+i.name}o.subtopics=a[e.segment],o.topicName=r[e.segment],o.loading.policies=!1,o.$watch("filters.subtopic",p),o.$on("$stateChangeSuccess",d)}}.bind(this),u=function(e,i){let t=JSON.parse(JSON.stringify(a[o.filters.subtopic||s.params.topic]||[])),n=[];t.forEach(e=>{var t;"policies"in e&&(t=e.policies.filter(e=>(e.title||e.name).toLowerCase().includes(i.toLowerCase())),e.policies=t,n.push(e))}),n=n.filter(e=>0<e.policies.length),o.policies=n}.bind(this),d=function(){o.filters.subtopic=s.params.subtopic}.bind(this),p=function(e,t){e!==t&&s.params.topic&&(t=o.filters.subtopic?"topic.subtopic.policies":"topic.policies",s.transitionTo(t,{topic:s.params.topic,subtopic:o.filters.subtopic},{reload:!1})),h()}.bind(this),h=function(){o.policies=a[o.filters.subtopic||s.params.topic]};t.lastTopic=s.params.topic,o.$watch("topicDetails",c),o.$watchGroup(["topicDetails","filters.subtopic"],l),o.$on("FilterByKeywords",u)}]),angular.module("worldPolicyForumApp").controller("TopicResourcesController",["$scope","$state",function(t,i){t.pages=null,t.selected={resource:i.params.resource,page:i.params.page,subpage:i.params.subpage};var e=function(e){e&&(t.pages=e.resources,t.selected.resource||(t.selected.resource=e.resources[0].segment),t.$watch("selected.resource",o),t.$watch("selected.page",s),t.$watch("selected.subpage",a),t.$on("$stateChangeSuccess",n))}.bind(this),n=function(){t.selected.resource=i.params.resource,t.selected.page=i.params.page,t.selected.subpage=i.params.subpage}.bind(this),o=function(e){r()}.bind(this),s=function(e){r()}.bind(this),a=function(e){r()}.bind(this),r=function(){var e;(i.includes("topic.resources")||i.includes("topic.subtopic.resources"))&&(e=i.params.subtopic?t.selected.file?"topic.subtopic.resources.resource.file":t.selected.resource?"topic.subtopic.resources.resource":"topic.subtopic.resources":t.selected.subpage?"topic.resources.resource.page.subpage":t.selected.page?"topic.resources.resource.page":t.selected.resource?"topic.resources.resource":"topic.resources",i.params.topic&&i.transitionTo(e,{resource:t.selected.resource,page:t.selected.page,subpage:t.selected.subpage},{location:"replace",inherit:!0}))};t.$watch("topicDetails",e)}]),angular.module("worldPolicyForumApp").controller("TopicMethodsController",["$scope","pageTitle",function(e,t){e.$watch("topicDetails",function(e){e&&t.set((e.name||e.title)+" - Methods")})}]),angular.module("worldPolicyForumApp").controller("TopicGlobalAgreementsController",["$scope","$state","$timeout","api","utils","settings",function(s,t,i,e,a,n){s.globalAgreements=null,s.selected={agreement:t.params.agreement,policy:t.params.policy,topicAgreement:t.params.topicAgreement},s.loading={globalAgreements:!0},s.$watch("topicDetails",function(e){e&&(s.mainTopicId=e.id)});var r={},l={};s.policyMap={};var o=function(e){r=a.createMap(e.pages,"segment");for(var t=0;t<e.pages.length;t++){var i=e.pages[t];angular.extend(l,a.createMap(i.topic_agreements,"segment"));for(var n=0;n<i.topic_agreements.length;n++){var o=i.topic_agreements[n];s.policyMap[o.segment]=a.createMap(o.policies,"segment")}}},c=function(){s.selected.policy=t.params.policy,s.selected.topicAgreement=t.params.topicAgreement,s.selected.agreement=t.params.agreement}.bind(this),u=function(e){h()}.bind(this),d=function(e){h()}.bind(this),p=function(e){h(),i(function(){s.$broadcast("map.resize")})}.bind(this);this.currentPage=function(){return s.selected.topicAgreement?l[s.selected.topicAgreement]:s.selected.agreement?r[s.selected.agreement]:s.globalAgreements},s.currentPolicies=function(){var e=l[s.selected.topicAgreement],i=r[s.selected.agreement];if(e)return $.each(e.policies,function(e,t){t.uri="/policies/"+t.segment+"/"+i.agreement_type,t.agreementMapPreview=n.mediaServerHost+"/agreements/"+t.id+"-"+i.agreement_type+"-400x200.png"}),e.policies},s.currentPolicy=function(){return s.policyMap[s.selected.topicAgreement]?s.policyMap[s.selected.topicAgreement][s.selected.policy]:{}};var h=function(){var e;(t.includes("topic.subtopic")||t.includes("topic.global-agreements"))&&(e=t.params.subtopic?s.selected.policy?"topic.subtopic.global-agreements.agreement.topic-agreement.policy":s.selected.topicAgreement?"topic.subtopic.global-agreements.agreement.topic-agreement":s.selected.agreement?"topic.subtopic.global-agreements.agreement":"topic.subtopic.global-agreements":s.selected.policy?"topic.global-agreements.agreement.topic-agreement.policy":s.selected.topicAgreement?"topic.global-agreements.agreement.topic-agreement":s.selected.agreement?"topic.global-agreements.agreement":"topic.global-agreements",t.params.topic&&t.transitionTo(e,{policy:s.selected.policy,topicAgreement:s.selected.topicAgreement,agreement:s.selected.agreement},{location:"replace",inherit:!0}))};e.getGlobalAgreements().then(function(e){s.loading.globalAgreements=!1,s.globalAgreements=angular.copy(e),o(e),s.$watch("selected.agreement",u),s.$watch("selected.topicAgreement",d),s.$watch("selected.policy",p),s.$on("$stateChangeSuccess",c)})}]),angular.module("worldPolicyForumApp").directive("paginationDots",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/pagination-dots.html",restrict:"E",replace:!0,scope:{index:"=?",length:"=?"},controllerAs:"paginationDotsController",controller:["$scope",function(t){this.goNext=function(){t.index=Math.min(t.index+1,t.length-1)},this.goPrev=function(){t.index=Math.max(t.index-1,0)},this.selectIndex=function(e){t.index=e}}],link:function(e,t,i){}}}]),angular.module("worldPolicyForumApp").filter("indexArray",function(){return function(e,t){for(var i=0;i<t;i++)e.push(i);return e}}),angular.module("worldPolicyForumApp").controller("TopicRankingsController",["$scope","$state","$window","$rootScope","utils","pageTitle",function(t,i,e,n,o,s){n.isPhantom=/PhantomJS/i.test(e.navigator.userAgent),t.rankings=null,t.rankingsMap=null,t.selected={ranking:i.params.ranking};var a=function(e){e&&(t.rankings=e.rankings,t.rankingsMap=o.createMap(e.rankings,"segment"),t.selected.ranking||(t.selected.ranking=e.rankings[0].segment),t.$watch("selected.ranking",l),t.$on("$stateChangeSuccess",r),t.$on("rankingsMapInitComplete",function(){s.set((e.name||e.title)+" - Rankings"),window.setTimeout(function(){console.log("loaded")},1e3)}))}.bind(this),r=function(){t.selected.ranking=i.params.ranking}.bind(this),l=function(e){c()},c=function(){var e;i.includes("topic.rankings")&&(e=t.selected.ranking?"topic.rankings.ranking":"topic.rankings",!i.params.embeddedVersion&&i.params.topic&&i.transitionTo(e,{ranking:t.selected.ranking},{location:"replace",inherit:!0}))};
1t.$watch("topicDetails",a)}]),angular.module("worldPolicyForumApp").directive("colorMap",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/color-map.html",restrict:"E",replace:!0,scope:{configs:"=",countryMap:"=",excerpts:"=",legends:"=?",country:"@?",isLoading:"@?",selectedPolicy:"=?",selectedFilters:"=?",selectedSubnational:"=?",policyDetails:"=?",select:"&?"},controllerAs:"colorMapController",controller:["$rootScope","$scope","$element","$window","$q","Map","MapResizer","MapPopover","configs","$uibModal","settings","excerpt",function(t,u,i,n,e,o,s,a,r,l,c,d){u.legendMap=null,u.popover=null,u.colorBlind=!!r.colorBlind,u.settings=c,u.app_path=r.env.APP_PATH;u.guid=function(){for(var e="",t=0;t<32;t++)e+=Math.floor(15*Math.random()).toString(15);return e}();var p=null,h=null,g=null;u.$on("zoomInto",function(e,t){var i,n,o,s,a,r,l,c;p&&(p.zoom(1,!1),c=Object.keys(t).filter(function(e){return t[e].filtered&&p.getBBoxOfCountry(e)}).map(function(e){e=p.getBBoxOfCountry(e);return{x:e.x,x2:e.x2,y:e.y,y2:e.y2}}),i=Math.min.apply(Math,c.map(function(e){return e.x})),n=Math.min.apply(Math,c.map(function(e){return e.y})),o=Math.max.apply(Math,c.map(function(e){return e.x2})),s=Math.max.apply(Math,c.map(function(e){return e.y2})),a=p.width,r=p.height,l=p.configs.minScale,c=p.configs.maxScale,viewScaleH=p.height/p.viewBox.height,viewScaleW=p.width/p.viewBox.width,dx=(o-i)*viewScaleW,dy=(s-n)*viewScaleH,x=(i+o)/2*viewScaleW,y=(n+s)/2*viewScaleH,x0=a/2,y0=r/2,realScale=.8/Math.max(dx/a,dy/r),scale=Math.min(Math.max(realScale,l),c),translateX=x0-x,translateY=y0-y,c=Snap.matrix(1,0,0,1,translateX/viewScaleW,translateY/viewScaleH),p.transform.scale=c.a,p.transform.x=c.e,p.transform.y=c.f,p.zoom(scale),g.closePopover())}),this.init=function(){u.$watch("configs",f),u.$watch("selectedPolicy",m)};var m=function(e){e=e||u.selectedPolicy,p&&e&&p.setAriaTitle(e.map_alt_text||e.title||e.name)},f=function(e){e&&(p=new o($(i).find(".map-container").get(0),u.configs),m(),h=new s(p,u),g=new a(p,u,!0,$(i).find(".map-popover")),u.popover=g.popover,e.isDebugging&&(n.map=p),$(p).on("mapInitComplete",v),$(p).on("mapDraggingStart",function(e){g.closePopover()}),$(p).on("countryClick",_))}.bind(this),v=function(){u.$watch("countryMap",P),u.$watch("colorBlind",C),u.$on("$destroy",w),u.$on("stickToTopStart",b),u.$on("stickToTopEnd",b),u.$emit("colorMapInitComplete")}.bind(this),b=function(e){},w=function(){$(p).off("mapInitComplete",this.onMapInitComplete),$(p).off("countryClick",_),g.destroy(),h.destroy(),p.destroy()}.bind(this),P=function(e){e&&(this.updateCountryColors(e,!0),u.country&&g.selectCountry(u.country))}.bind(this),C=function(e){r.colorBlind=e,t.$broadcast("cbm-change"),this.updateCountryColors(u.countryMap)}.bind(this),_=function(e,t){u.select&&(u.select({countryId:t}),u.$apply()),A(t)&&768<=window.innerWidth&&(g.closePopover(),S(t))}.bind(this),A=function(e){if(u.excerpts&&Object.keys(u.excerpts).length)return u.excerpts[u.selectedPolicy.key][e]},S=function(e){d.openExcerpt(A(e),u.countryMap[e].name,u.countryMap[e].popoverValue||u.countryMap[e].value,e)};this.zoomIn=function(){p.zoom(u.configs.zoomStep),g.closePopover()},this.zoomOut=function(){p.zoom(1/u.configs.zoomStep),g.closePopover()},this.zoomReset=function(){p.zoom(1/p.transform.scale),g.closePopover()};function T(e){return u.colorBlind?e.cbm_color:e.color}function M(e){if((e=e.split("__"))[0]){if(k(e[0],"_stripe"))return 1;if(k(e[0],"_stripe2"))return 2;if(k(e[0],"_stripe3"))return 3}return null}var k=function(e,t){var i=e.length-t.length,t=e.indexOf(t,i);return-1!==t&&t===i};u.getLegendColor=function(e){var t=M(e.value_id);return t?"url("+r.env.APP_PATH+"/images/legend/stripe"+t+".svg)":T(e)},u.getStripeLabels=function(){for(var e=[],t=0;t<u.legends.length;t++)M(u.legends[t].value_id)&&e.push(u.legends[t].value);return e},u.getLegendLabel=function(e){return e.value},this.updateCountryColors=function(e,t){if(e){var i,n=!1;for(i in e)if(u.selectedSubnational&&u.selectedSubnational.id===i){if(null!==e[i].subnational){const r=e[i].subnational.regions;for(const l in r){const c=u.selectedPolicy.key;var o=u.selectedPolicy.values.find(e=>e.value_id===`${c}__${r[l][c]}`);if(void 0!==o){const a=u.colorBlind?o.cbm_color:o.color;
1p.setCountryColor(r[l].iso2,a,0,t)}}}}else{var s=e[i],a=T(s)||u.configs.fill,s=s.stripe;p.setCountryColor(i,a,s,t),n=n||3===s}u.hatching=n}},u.getPopoverLegend=function(){if(u.selectedPolicy&&null!==u.selectedSubnational.id){const t=u.selectedPolicy.key,i=u.countryMap[u.selectedSubnational.id].subnational.regions[u.popover.countryId];if(i){var e=u.selectedPolicy.values.find(e=>e.value_id===`${t}__${i[t]}`);return e?e.value:""}return""}return u.countryMap&&u.popover&&u.popover.countryId&&u.countryMap[u.popover.countryId]?u.countryMap[u.popover.countryId].popoverValue||u.countryMap[u.popover.countryId].value||u.countryMap[u.popover.countryId].name:""}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("rankingsMap",function(){return{template:'<div><color-map class="legend-below" selected-policy="selectedRanking" configs="configs" country-map="countryMap" legends="legends" country="{{country}}" is-loading="{{isLoading}}"></color-map></div>',restrict:"E",replace:!0,scope:{rankingSrc:"=?",selectedRanking:"=?",defaultCountry:"@?"},controllerAs:"rankingsMapController",controller:["$scope","$q","configs","api",function(n,i,e,o){n.countryMap=null,n.legends=null,n.configs=e.rankingsMap,n.isLoading=!0;var s=null;this.init=function(){n.$watch("rankingSrc",t);var e=i.defer();n.$on("colorMapInitComplete",function(){e.resolve()}),s=e.promise};var t=function(e){var t;e&&e.length&&(n.isLoading=!0,(t=[s]).push(o.getRankingDetails(e).then(function(e){n.isLoading=!1,a(e)})),i.all(t).then(function(){n.$emit("rankingsMapInitComplete")}))}.bind(this),a=function(e){if(e){n.legends=e.values,n.countryMap={};for(var t=0;t<e.countries.length;t++){var i=e.countries[t];n.countryMap[i.iso]={iso:i.iso,name:i.name,color:i.data[e.key].color,cbm_color:i.data[e.key].cbm_color,value:i.data[e.key].value,valueId:i.data[e.key].value_id,text:""}}
1}}}],link:function(e,t,i,n){n.init()}}}),angular.module("worldPolicyForumApp").directive("rankingsMenu",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/rankings-menu.html",restrict:"E",replace:!0,scope:{rankings:"=",selectedRanking:"=?"},controllerAs:"rankingsMenuController",controller:["$scope",function(t){this.init=function(){},this.selectRanking=function(e){t.selectedRanking=e.segment}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("topicButtons",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/topic-buttons.html",replace:!0,scope:{exclude:"=?",include:"=?"},restrict:"E",controllerAs:"TopicButtonsController",controller:["$scope","$element","api",function(i,e,t){i.topics=[];function n(e,t,i){return e.filter(e=>!t.length||!t.includes(e.name)).filter(e=>!i.length||i.includes(e.name))}t.getTopics().then(function(e){return i.topics=n(e,i.exclude||[],i.include||[]),i.topics}),i.$watchGroup(["exclude","include"],function(e){var t=e[0]||[],e=e[1]||[];(t.length||e.length)&&(i.topics=n(i.topics,t,e))})}]}}]),angular.module("worldPolicyForumApp").directive("topicRankingsAccordion",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/topic-rankings-accordion.html",restrict:"E",replace:!0,scope:{topics:"=?",selectedTopic:"=?",selectedRanking:"=?"},controllerAs:"topicRankingsAccordionController",controller:["$scope","$element","utils",function(i,e,n){i.isLoading=!0,i.topicMap=null,this.init=function(){i.$watch("topics",t),i.$watch("selectedTopic",o)};var t=function(e){if(e){i.isLoading=!1,i.topicMap=n.createMap(e,"segment"),i.filteredTopics=[];for(var t=0;t<e.length;t++)e[t].rankings&&e[t].rankings.length&&i.filteredTopics.push(e[t])}}.bind(this),o=function(e,t){e&&e!==t&&(i.selectedRanking=i.topicMap[e].rankings[0].segment)}.bind(this);this.selectTopic=function(e){i.selectedTopic=e,i.selectedRanking=i.topicMap[e].rankings[0].segment},this.selectRanking=function(e){i.selectedRanking=e}}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").filter("countryIdToSegment",["configs",function(t){return function(e){if(e&&e.length)return t.countryIsoMap[e].segment}}]),angular.module("worldPolicyForumApp").filter("countrySegmentToId",["configs",function(t){return function(e){if(e)return t.countrySegmentMap[e].iso}}]),angular.module("worldPolicyForumApp").service("analytics",["$rootScope","$location",function(e,t){this.init=function(){e.$on("$stateChangeSuccess",this.trackPageview)},this.sendEvent=function(e,t,i,n){ga("send","event",e,t,i,n)},this.trackPageview=function(){ga("send","pageview",t.url())}}]),angular.module("worldPolicyForumApp").directive("socialShare",["configs",function(s){return{templateUrl:s.env.APP_PATH+"/views/directives/social-share.html",restrict:"E",replace:!0,scope:{direction:"=?",iconOnly:"=?",labelOnly:"=?",forMap:"=?",selectedPolicy:"=?",policyDetails:"="},controllerAs:"SocialShareController",controller:["$scope","$location","$timeout","settings",function(i,n,e,t){i.isOpen=!1,i.app_path=s.env.APP_PATH,i.direction=i.direction||"right",i.$location=n,i._={selectedPolicy:!1};i.getMailtoLink=function(){return"mailto:?subject="+encodeURI("WORLD Policy Analysis Center")+"&body="+encodeURI(n.absUrl())},i.getDownloadLink=function(){if(i._.selectedPolicy)return n.search().filter?t.mediaServerHost+"/agreements/"+i._.selectedPolicy.id+"-"+n.search().filter+"-1280x820.png":"ranking"===i._.selectedPolicy.type?t.mediaServerHost+"/rankings/"+i._.selectedPolicy.id+".png":t.mediaServerHost+"/maps/"+i._.selectedPolicy.id+".png"},i.$watch("selectedPolicy",function(e){i._.selectedPolicy=e});var o=null;i.waitHideEmbedBox=function(){o&&e.cancel(o),o=e(function(){i.showEmbedBox=!1},1e3)},i.cancelHideEmbedBox=function(){o&&e.cancel(o)},i.getEmbededCode=function(){if(i.selectedPolicy){var e,t="/embedded/policies/"+i._.selectedPolicy.segment;return"ranking"===i.selectedPolicy.type&&(6===(e=n.path().split("/")).length&&e.pop(),t=e.join("/")+"/embedded"),'<iframe width="900" height="600" src="http://'+n.$$host+t+'"  frameborder="0"></iframe>'}},i.isCombinedPolicy=function(){return i.policyDetails&&i._.selectedPolicy&&i.policyDetails.id!==i._.selectedPolicy.id},i.getCombinedPolicyEmbedCode=function(){return'<iframe width="900" height="600" src="http://'+n.$$host+"/embedded/policies/"+i.policyDetails.segment+'"  frameborder="0"></iframe>'},i.toggle=function(){i.isOpen=!i.isOpen},i.toggleEmbedBox=function(){i.showEmbedBox=!i.showEmbedBox,i.showEmbedBox&&i.gaTrack("embed")};i.gaTrack=function(e){ga("send","event","share",e,n.path())}}]}}]),angular.module("worldPolicyForumApp").directive("readMore",function(){return{template:'<div class="read-more"><div class="text" ng-class="{opened: isOpen}" ng-bind-html="text"></div><div class="text-right"><button class="read-more-button" ng-click="readMoreController.toggle(
1)" ng-bind="isOpen ? \'Read less\' : \'Read more\'">Read more</button></div></div>',restrict:"E",replace:!0,scope:{text:"=?"},controllerAs:"readMoreController",controller:["$scope",function(e){e.isOpen=!1,this.toggle=function(){e.isOpen=!e.isOpen}}],link:function(e,t,i){}}}),angular.module("worldPolicyForumApp").directive("stickToTop",function(){return{restrict:"A",scope:{stickToTopEnable:"=?",stickToTopLimit:"=?"},controllerAs:"stickToTopCtrl",controller:["$element","$scope","$rootScope","$state","$timeout","$window",function(i,t,n,e,o,s){i=$(i);function a(){return 0<i.closest("body").length}function r(e){var t=y();0===e?t.remove():t.css({"padding-bottom":e+"px"})}function l(e){e||h?i.removeClass("stick-to-top-hidden"):i.addClass("stick-to-top-hidden")}function c(){var e;p.isFixed||(p.isFixed=!0,b(),e={position:"fixed",top:"0",left:p.offsets.left,width:d.outerWidth,"background-color":i.css("background-color")||"#fff","z-index":90},!0==h&&(e.position="relative",e["z-index"]=1),i.css(e),i.addClass("stuck-to-top"),r(i.outerHeight()),e=i.parent(),p.parent={offsets:$(e).offset(),height:$(e).outerHeight()},n.$broadcast("stickToTopStart")),l(function(){if(t.stickToTopLimit&&p.parent){var e=p.parent.offsets.top+p.parent.height;return(window.scrollY||document.documentElement.scrollTop)<e-i.outerHeight()}return!0}())}var u=["position","top","left","width","background-color","z-index"],d={},p={offsets:{top:0,left:0},isFixed:!1},h=void 0!==e.params.embeddedVersion,g=function(e,t){function i(){void 0!==o&&(clearTimeout(o),o=void 0)}function n(){i(),e(),s=new Date}var o,s;return function(){if(!s||new Date-s>t)return n();i(),o=setTimeout(n,t)}},m=function(){a()?p.isFixed&&(y(),i.css({width:$(".policy-page").width()})):$(window).off("resize",m)},f=function(){var e;{if(((window.scrollY||document.documentElement.scrollTop)>p.offsets.top||h?P:w)(),a())return e=i.outerHeight(),i.parent().outerHeight()>e+200&&e<window.innerHeight&&(void 0===t.stickToTopEnable||t.stickToTopEnable)?void(p.isFixed||v()):w();$(window).off("scroll",f)}},v=function(){p.offsets=i.offset()},y=function(){var e=i.prev();return e.hasClass("stick-to-top-padding")||((e=$(document.createElement("div"))).addClass("stick-to-top-padding"),i.before(e)),e},b=function(e){for(var t=0;t<u.length;t++)d[u[t]]=i.css(u[t]);d.outerWidth=i.outerWidth(),e||r(i.outerHeight())},w=function(){P.proceed=!1,p.isFixed&&(function(){for(var e=0;e<u.length;e++)i.css(u[e],"");r(0)}(),i.removeClass("stuck-to-top"),p.isFixed=!1,l(!0),n.$broadcast("stickToTopEnd"))},P=function(){P.proceed=!0,o(function(){P.proceed&&c(),P.proceed=!1})};P.proceed=!1,function(){b(!0),f();var e=angular.element(s);e.on("scroll",f),e.on("resize",m),t.$watch(g(f,500))}()}]}}),angular.module("worldPolicyForumApp").directive("targetBlank",function(){return{restrict:"A",link:function(e,t,i){"true"===i.targetBlank&&t.attr("target","_blank")}}}),angular.module("worldPolicyForumApp").controller("AboutPageCtrl",["$scope","$state","api",function(t,e,i){t.page=null;i.getPage(e.params.page).then(function(e){t.page=e})}]),angular.module("worldPolicyForumApp").controller("PageCtrl",["$scope","$state","api",function(t,e,i){t.page=null;i.getPage("/events-launches/"+e.params.alias).then(function(e){t.page=e})}]),angular.module("worldPolicyForumApp").controller("SectionCtrl",["$scope","$state","api","configs",function(t,i,e,n){t.section=null;var o=function(e){"section"===i.current.name&&e.pages.length?i.transitionTo("section.pages",{pages:e.pages[0].segment},{location:"replace",inherit:!0}):0===e.pages.length&&i.transitionTo("section.pages",{pageTop:e},{location:!1,inherit:!0})};e.getPage("/"+i.params.section).then(function(e){t.featureBanner=0<e.images.header.length?e.images.header[0].uri:n.env.APP_PATH+"/images/resource-banner.jpg",t.section=e,o(e)})}]),angular.module("worldPolicyForumApp").controller("PagesCtrl",["$scope","$state","$http","configs","utils","$location","pageTitle",function(s,t,i,e,n,o,a){s.pagesMap=null,s.pageMap=null,s.app_path=e.env.APP_PATH,s.fields={first_name:"",last_name:"",email:"",recaptcha:null},s.formState="waiting",s.formErrors={},s.recaptchaKey=e.recaptchaKey,s.isContactPage=!1,"/about/contact"===o.url()&&
1(s.isContactPage=!0),s.selected={pages:t.params.pages,page:t.params.page},s.$watchGroup(["selected.pages","selected.page","pagesMap","pageMap"],function(){var e=s.currentPage();e&&a.set(e.title||e.name)});var r=function(e){if(e){s.pagesMap=n.createMap(e.pages,"segment"),s.pageMap={},s.pageTop=e;for(var t=0;t<e.pages.length;t++)angular.extend(s.pageMap,n.createMap(e.pages[t].pages,"segment"));s.$watch("selected.pages",c),s.$watch("selected.page",u),s.$on("$stateChangeSuccess",l)}},l=function(e,t,i,n,o){s.selected.pages=i.pages,s.selected.page=i.page},c=function(e,t){e&&e!==t&&(s.selected.page=null),d()},u=function(e,t){d()};this.selectPages=function(e){"/about/contact"===e.uri?o.url("/about/contact"):(s.selected.pages=e.segment,s.selected.page=null)},this.selectPage=function(e){s.selected.page=e.segment},s.currentPage=function(){return!s.selected||s.selected.pages&&s.selected.pages.length?s.pagesMap?s.pageMap[s.selected.page]||s.pagesMap[s.selected.pages]:void 0:s.pageTop};var d=function(){var e;t.includes("section.pages")&&(t.params.pages===s.selected.pages&&t.params.page===s.selected.page||(e=s.selected.page?"section.pages.page":"section.pages",t.transitionTo(e,{pages:s.selected.pages,page:s.selected.page},{location:!0,inherit:!0})),window.scrollTo(0,450))};s.submitForm=function(){if(!s.fields.recaptcha)return!1;var e=s.currentPage();if(!e)return!1;s.formState="loading",i({method:"POST",url:e.links.href,data:$.param(s.fields),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(e,t,i,n){e.status?(s.formState="done",s.formErrors={}):e.errors?(s.formState="waiting",s.formErrors=e.errors):s.formState="error"}).error(function(e,t,i,n){s.formState="error"})},s.setResponse=function(e){s.fields.recaptcha=e},s.showForm=function(){var e=s.currentPage();return e&&!!e.show_form&&!s.showConferenceForm()},s.showConferenceForm=function(){var e=s.currentPage();return e&&"NlD2Q6RzNBRoWJb9"===e.id},s.reshowForm=function(){s.formState="waiting"},s.$watch("section",r)}]),angular.module("worldPolicyForumApp").directive("compile",["$compile",function(o){return function(t,i,n){t.$watch(function(e){return e.$eval(n.compile)},function(e){$(i).html(e),o($(i).contents())(t)})}}]),angular.module("worldPolicyForumApp").directive("href",["analytics",function(o){return{restrict:"A",link:function(e,t,i){function n(){o.sendEvent("href","click",i.href)}t.on("click",n),e.$on("$destroy",function(){t.off("click",n)})}}}]),angular.module("worldPolicyForumApp").directive("conferenceForm",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/conference-form.html",restrict:"E",replace:!0,controllerAs:"conferenceFormController",scope:{title:"=?",postUrl:"="},controller:["$scope","$http","configs",function(o,e,t){o.recaptchaKey=t.recaptchaKey,o.selects={sector:[{label:"Academic",value:"Academic"},{label:"Government",value:"Government"},{label:"Non-Governmental",value:"Non-Governmental"},{label:"Private Sector",value:"Private Sector"},{label:"Other: please specify below",value:"Other"}],position:[{value:"Faculty",label:"Faculty"},{value:"Staff",label:"Staff"},{value:"Postdoctoral Student",label:"Postdoctoral Student"},{value:"Graduate Student",label:"Graduate Student"},{value:"Undergraduate Student",label:"Undergraduate Student"},{value:"Professional",label:"Professional"},{value:"Other",label:"Other: please specify below"}],participation:[{label:"Full day",value:"Full day"},{label:"Half day (morning)",value:"Half day (morning)"},{label:"Half day (afternoon)",value:"Half day (afternoon)"},{label:"Individual Session(s)",value:"Individual Session(s)"}],where_hear:[{label:"Email Newsletter",value:"Email Newsletter"},{label:"Student Association",value:"Student Association"},{label:"UCLA Campus Event Listing",value:"UCLA Campus Event Listing"},{label:"WORLD website",value:"WORLD website"},{label:"WORLD social media accounts",value:"WORLD social media accounts"},{label:"Word of Mouth",value:"Word of Mouth"},{label:"Other: please specify below",value:"Other"}],diet:[{label:"None",value:"None"},{label:"Vegan",value:"Vegan"},{label:"Vegetarian",value:"Vegetarian"},{label:"Other: please specify below",value:"Other"}]},o.fields={first_name:"",surname:"",sector:"",organisation:"",department:"",position:"",title:"",expertise:"",participation:"",email:"",confirm_email:"",where_hear:"",where_hear_source:"",diet:"",receive_updates:!0,recaptcha:null,other_sector:"",other_position:"",other_where_hear:"",other_diet:""},o.formErrors={},o.formState="waiting",o.wantMoreHearInfo=function(){var e=o.fields.where_hear;return e&&0<e.length&&"Other"!==e&&"Word of Mouth"!==e&&"WORLD website"!==e},o.setResponse=function(e){o.fields.recaptcha=e};o.submitForm=function(){return o.fields.recaptcha?o.fields.email!==o.fields.confirm_email?!(o.formErrors={confirm_email:"Emails do not match"}):(o.formState="loading",void e({method:"POST",url:o.postUrl,data:$.param({first_name:o.fields.first_name,surname:o.fields.surname,sector:0!==o.fields.other_sector.length?o.fields.sector+" - "+o.fields.other_sector:o.fields.sector,organisation:o.fields.organisation,department:o.fields.department,position:0!==o.fields.other_position.length?o.fields.position+" - "+o.fields.other_position:o.fields.position,title:o.fields.title,expertise:o.fields.expertise,participation:o.fields.participation,email:o.fields.email,confirm_email:o.fields.confirm_email,where_hear:o.fields.where_hear,where_hear_source:0!==o.fields.other_where_hear.length?o.fields.where_hear+" - "+o.fields.other_where_hear:o.fields.where_hear_source,diet:0!==o.fields.other_diet.length?o.fields.diet+" - "+o.fields.other_diet:o.fields.diet,receive_updates:o.fields.receive_updates,recaptcha:o.fields.recaptcha}),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(e,t,i,n){e.status?(o.formState="done",o.formErrors={}):e.errors?(o.formState="waiting",o.formErrors=e.errors):o.formState="error"}).error(function(e,t,i,n){o.formState="error"})):!(o.formErrors={recaptcha:"You must fill out the above captcha"})},o.reshowForm=function(){o.formState="waiting"},o.checkEmail=function(){var e=o.fields.email,t=o.fields.confirm_email;t&&e!==t?(o.formErrors||(o.formErrors={}),o.formErrors.email_match="Email addresses do not match"):o.formErrors&&o.formErrors.email_match&&delete o.formErrors.email_match}}],link:function(e,t,i){}}}]),angular.module("worldPolicyForumApp").directive("globalOverview",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/global-overview.html",restrict:"E",replace:!0,scope:{rankings:"=?",groupTitle:"=?"},controllerAs:"globalOverviewController",controller:["$scope","$element",function(a,e){a.selected={ranking:null};
1var r=Snap($(e).find(".chart-svg").get(0)),l=null,c=55,u=81,d=81;this.init=function(){a.$watch("rankings",t)};var t=function(e){e&&e.length&&this.selectRanking(e[0])}.bind(this);this.selectRanking=function(e){a.selected.ranking=e,i()};var i=function(){l&&l.remove();var e=a.selected.ranking;l=r.group();for(var t=-Math.PI/2,i=0;i<e.values.length;i++){var n=e.values[i],o=2*Math.PI*(n.percentage/100);h(t,o,n.color),g(n.percentage+"%",n.color,t,o);var s=t+o/2;n.left=u+Math.cos(s)*c+8,n.top=d+Math.sin(s)*c-10,t+=o}$(l.paper.node).attr("aria-label",p(e)).attr("role","img")}.bind(this),p=function(e){return a.groupTitle+", Rankings, "+e.name},h=function(e,t,i){var n=u+Math.cos(e)*c,o=d+Math.sin(e)*c,s=u+Math.cos(e+t+.01)*c,e=d+Math.sin(e+t+.01)*c,t=t>=Math.PI?1:0;l.path("M"+n+","+o+"A"+c+","+c+" 0 "+t+" 1 "+s+","+e).attr({stroke:i,strokeWidth:50,fill:"none"})}.bind(this),g=function(e,t,i,n){}.bind(this)}],link:function(e,t,i,n){n.init()}}}]),angular.module("worldPolicyForumApp").directive("clamp",function(){return{restrict:"A",link:function(e,t,i){$clamp($(t).get(0),{clamp:parseInt(i.clamp,10)})}}}),angular.module("worldPolicyForumApp").controller("GreetingCardsCtrl",["$scope","$rootScope","api","$stateParams",function(t,e,i,n){t.cards=null,t.title=null,t.description=null,t.message=null;var o=window.navigator.userAgent;t.devices=0<=o.indexOf("Mac OS")&&0<=o.indexOf("Mobile")?"ios_devies":"",i.getCards().then(function(e){t.cards=e.cards,t.title="<div slabtext>"+e.title.replace(/<p>/g,'<span class="slabtext">').replace(/<\/p>/g,"</span>")+"</div>",t.color=e.color,t.description=e.description,t.message=e.message})}]),angular.module("worldPolicyForumApp").directive("greetingCardPage",["$window","$timeout","utils",function(e,t,i){return{template:'<div class="hard page{{Math.ceil($index/2)+1}}" ng-class="{\'card-left\': $index%2===0, \'card-right\': $index%2!==0}"><div class="card-content"><img ng-src="{{page.image}}" alt="{{card.title}}" ng-show="$index%2===0 && !utils.isEmpty(page.image)"><div class="title" ng-bind-html="page.title" style="color: {{page.title_color}};"></div><div class="text" ng-bind-html="page.description" style="color: {{page.description_color}};"></div></div></div>',replace:!0,restrict:"AE",transclude:!1,link:function(e,t){e.$last&&e.initFlipbook()}}}]),angular.module("worldPolicyForumApp").directive("flipbook",["utils",function(e){return{template:'<div class="hard cover_first"><div class="cover_first-content" ng-attr-style="background: {{card.cover_front_color}};"><img ng-src="{{card.cover_front}}" alt="{{card.title}}" ng-hide="utils.isEmpty(card.cover_front)" /><span class="card-title" ng-hide="utils.isEmpty(card.cover_title)" ng-attr-style="color: {{card.cover_title_color}}">{{card.cover_title}}</span></div></div><greeting-card-page ng-repeat="page in card.pages"></greeting-card-page><div class="hard cover_last"><div class="cover_last-content" ng-attr-style="background: {{card.cover_back_color}};"><img src="{{card.logo_uri}}" alt="{{card.title}}"></div></div>',restrict:"AE",transclude:!1,scope:{card:"=?",turnedCallback:"="},link:function(i,s,a){i.utils=e;function t(){var n=$(s),o=(o=$(a.container).width())>a.maxwidth?a.maxwidth:o;n.get(0).style.width="",n.get(0).style.height="",n.find(".cover_first").css("font-size",n.width()/a.maxwidth*20+"px"),$(window).width()<=768&&setTimeout(function(){$(".page-wrapper:even:gt(0)").css("display","block").find(".card-content").each(function(e){for(var t=n.width()/a.maxwidth*20,i=parseInt(t);i<20;i++)if($(this).css("font-size",i+"px"),.7<=$(this).outerHeight()/o){$(this).css("font-size",i-1+"px");break}})},0),n.turn("size",o,o/a.proportion)}var n=null;imagesLoaded(s,function(e){$(s).fadeIn(500)}),i.$on("$destroy",function(){clearTimeout(n),$(window).off("resize.flipbook"),s.turn("destroy")}),i.initFlipbook=function(){var e=(e=$(a.container).width())>a.maxwidth?a.maxwidth:e;$(s).turn({width:836,height:584,gradients:!0,duration:720}).bind("start",function(e,t){t.turn.children().eq(t.page-1).addClass("hover")}).bind("end",function(e,t){t.turn.children().eq(t.page-1).removeClass("hover")}).bind("turning",function(e,t){clearTimeout(n),$(s).unbind("turning")}).bind("turned",function(e,t){void 0!==i.turnedCallback&&i.turnedCallback(t)}),t(),n=setTimeout(function(){$(s).turn("next")},1500),$(window).on("resize.flipbook",function(){t()})}}}}]),angular.module("worldPolicyForumApp").controller("GreetingCardDetailCtrl",["$scope","$rootScope","api","$stateParams","$state","configs","$http","pageTitle",function(i,e,t,n,o,s,a,r){i.returnUrl="#",i.returnTitle="Return to cards",i.card=null,i.selectedCountryText="Select Your Country",i.share={friendEmail:"",shareMessage:"",success:!1},i.returnToCards=function(){"#"===i.returnUrl&&o.go("cards")},i.sendShareContent=function(){var e={mail_to:i.share.friendEmail,message:i.share.shareMessage,card_id:n.card};a({method:"POST",url:"/api/card-invite",data:$.param(e),headers:{"Content-Type":"application/x-www-form-urlencoded"}}).success(function(e){!0===e.status?i.share.success=!0:i.share.success=!1,$("#card-share-by-mail-modal").modal("hide"),$("#card-share-status").modal("show"),"undefined"!=typeof ga&&ga("send","event","Clicks","Social sharing","Email sent")}).error(function(){i.share.success=!1,$("#card-share-by-mail-modal").modal("hide"),$("#card-share-status").modal("show")})},$("#card-share-by-mail-modal").on("show.bs.modal",function(){$("#card-share-status").modal("hide")}
1),t.getCardDetail(n.card).then(function(e){void 0!==(i.card=e).parentTopicAlias&&""!==e.parentTopicAlias?(i.topic=e.parentTopicAlias,i.subtopic=e.topicAlias):(i.topic=e.topicAlias,i.subtopic=""),void 0!==e.returnUrl&&""!==e.returnUrl&&void 0!==e.returnTitle&&""!==e.returnTitle?(i.returnUrl=e.returnUrl,i.returnTitle=e.returnTitle):(i.returnUrl="#",i.returnTitle="Return to cards")}),i.countries=s.countries,i.goToCountryTopic=function(){var e;i.countryId=i.selectedCountry,i.selectedCountryText=i.selectedCountry,e=i.subtopic?"country.policies.topic.subtopic":i.topic?"country.policies.topic":"country.policies","undefined"!=typeof ga&&ga("send","event","Clicks","Policy dropdown",i.card.id+" - "+i.countryId),o.transitionTo(e,{topic:i.topic,subtopic:i.subtopic,country:i.selectedCountry},{location:"replace",inherit:!0})},i.gaSocialSharingTrack=function(e){"undefined"!=typeof ga&&ga("send","event","Clicks","Social sharing",e)},i.gaUrlInTextClick=function(e){e=e.target;"a"===e.tagName.toLowerCase()&&""!==e.href&&"undefined"!=typeof ga&&ga("send","event","Clicks","URLs in the text",e.href)},i.gaPageFlip=function(e){var t="";switch(e){case 2:t="1st page";break;case 4:t="2nd page";break;case 6:t="last page"}"undefined"!=typeof ga&&ga("send","event","Cards","Flipping pages",i.card.id+" - "+t)},i.$watch("card",function(e){e&&e.title&&r.set(e.title)})}]),angular.module("worldPolicyForumApp").directive("slabtext",["$timeout",function(n){return{restrict:"A",transclude:!1,link:function(e,t,i){e.$on("$destroy",function(){}),n(function(){$(t).slabText()})}}}]),angular.module("worldPolicyForumApp").directive("tableWrapper",["$timeout","$window","matchmedia","configs","excerpt","$filter","$state",function(u,a,r,d,p,h,g){return{restrict:"E",templateUrl:d.env.APP_PATH+"/views/directives/table-wrapper.html",link:function(l,i){var n=$(".policy-column",i),o=$(".sticky-table",i),s=$(".sticky-table th",i);$(".weglot_switcher ul a").click(function(e){setTimeout(function(){c()},2e3)}),setTimeout(function(){c()},3e3),l.currentPage=1,l.itemsCount=0,l.itemsPerPage=r.isPrint()?500:25,l.pagedItems=[],l.sortedItems=[],l.sortReverse=!1,l.availableFilters={},l.selectedFilters={},l.printMode=!1,l.modalAddPolicy=function(){event.preventDefault(),l.showAddPolicy=!l.showAddPolicy};function e(){var i={};$.each(l.items,function(){$.map(this,function(e,t){"country"!==t&&(i[t]||(i[t]={}),[t][e.value_id]||(i[t][e.value_id]=e))})}),$.map(i,function(e,t){l.availableFilters[t]=$.map(e,function(e){return[e]}).sort(function(e,t){return e.value_id>t.value_id?1:-1})});var t,e,n,o,s,a,r=function(e){if(Object.keys(e).length){var t=$.map(e,function(e){return[e]}).sort(function(e,t){return e[l.sortBy]||t[l.sortBy]?(e[l.sortBy]||!t[l.sortBy])&&(e[l.sortBy]&&!t[l.sortBy]||e[l.sortBy].value_id>t[l.sortBy].value_id)?1:-1:e.country.value>t.country.value?1:-1});return!0===l.sortReverse&&t.reverse(),t}return e}(r=(e=l.items,t={},Object.keys(e).length&&Object.keys(l.selectedFilters).length?$.each(e,function(e,n){var o=!0;$.each(l.selectedFilters,function(e,t){var i="country"===e?"id":"value_id";if(!n[e]||-1===Object.keys(t).indexOf(n[e][i]))return o=!1}),!0===o&&(t[e]=n)}):t=angular.copy(e),l.itemsCount=Object.keys(t).length,t));e=r,n=0,o=l.printMode?-1:l.itemsPerPage,s=l.currentPage,a=[],$.each(e,function(){var e=s*o;if(-1===o||e-o<=n&&n<e)a.push(this);else if(e<n)return!1;n++}),u(c),l.pagedItems=r=a}var c=function(){var e=s.width();$(".content-table tbody tr td").height("auto"),$(".content-table").height()<600&&$(".content-table tbody tr:visible").length&&(t=(600-$(".content-table thead tr").height())/$(".content-table tbody tr:visible").length-20,$(".content-table tbody tr td").height(t)),$(".content-table .spacer div",i).width(e-20),$.each($(".content-table tr",i),function(e){$(".sticky-table tr").eq(e).height($(this).outerHeight())}),$(".shadow",i).css("left",e+parseInt(s.css("padding-left"))+parseInt(s.css("padding-right"))+2+"px").height(o.height()-1);var t=$(".table-wrapper").width()-$(".policy-column").width(),e=$(".content-table").height();$(".content-table thead tr:first-child th:last-child").width(t),$(".policy-table td > div",n).height(e+23),$("#add-policy").width(t).height(e)};l.removeFilter=function(e){delete l.selectedFilters[e]},l.addFilter=function(e,t){var i=void 0===t.iso?t.value_id:t.iso;void 0===l.selectedFilters[e]&&(l.selectedFilters[e]={}),void 0===l.selectedFilters[e][i]?l.selectedFilters[e][i]=t:(delete l.selectedFilters[e][i],angular.equals({},l.selectedFilters[e])&&delete l.selectedFilters[e])},l.clearFilter=function(e){delete l.selectedFilters[e]}
1,l.resetFilter=function(){l.selectedFilters={}},l.addCountryFilter=function(e,t,i){i.stopPropagation(),l.addFilter(e,t)},l.isSortedBy=function(e){return l.sortBy===e.id},l.setSortBy=function(e){e.id===l.sortBy?l.sortReverse=!l.sortReverse:l.sortReverse=!1,l.sortBy=e.id},l.resetSortBy=function(){l.sortBy="country"},l.openExcerpt=function(e,t,i){e=h("stripHtml")(l.excerpt(e,t.id));p.openExcerpt(e,t.value,i,t.id)};var t=angular.element(a);t.bind("resize",function(){l.$apply()}),l.$watchGroup(["currentPage","sortBy","sortReverse"],e),l.$watch("items",e,!0),l.$watch("selectedFilters",e,!0),l.$watch("showAddPolicy",c),l.$watch(function(){return{h:t.height(),w:t.width()}},c,!0),l.printTable=function(){return!l.printMode&&(l.columns.length>d.dataTables.printMaxColumns+1?(alert("You may only print up to "+d.dataTables.printMaxColumns+" columns at a time"),!1):($("#printModal").modal("show"),l.printMode=!0,void u(function(){e(),$("#printModal").modal("hide"),u(function(){window.print(),l.printMode=!1,e(),l.$apply()},0,!1)},0,!1)))},l.goToSubnational=function(e,t){g.go(e,t,{reload:!0})}}}}]),angular.module("worldPolicyForumApp").controller("DataTablesController",["$scope","$rootScope","$state","$http","api","$q","$modal","utils","countries","topics","configs",function(r,e,l,o,s,a,t,i,n,c,u){var d=[],p=[];r.selectedTopic=null,r.selectedSubTopic=null,r.selectedSubnational=null,l.params.topic&&s.getTopicDetails(l.params.topic).then(function(e){if(r.chooseActiveTopic(e),l.params.subtopic)for(var t=0;t<e.subtopics.length;t++)if(e.subtopics[t].segment===l.params.subtopic){r.chooseActiveSubTopic(e.subtopics[t]);break}}),l.params.policy&&s.getPolicyDetails(l.params.policy).then(function(e){m(e)}),l.params.second&&s.getPolicyDetails(l.params.second).then(function(e){m(e)}),r.activeMenu=null,r.topics=c,r.isLoading=!1,r.sortBy="country",r.countries=[];for(const _ of n)"gl"!==_.iso&&(l.params.subnational===_.iso&&(r.selectedSubnational=_.iso),r.countries.push({iso:_.iso,name:_.n
1ame,subnational:_.subnational?i.createMap(_.subnational.data,"iso2"):{}}));r.countries=i.createMap(r.countries,"iso"),r.excerpts={};r.excerpt=function(e,t){return'<div style="font-size: xx-small">'+r.excerpts[e][t]+"</div>"};function h(){r.items={};let e=[];null===r.selectedSubnational?(r.columns=[{id:"country",name:"Country"}],e=[{key:"region",name:"Region"},{key:"incomegrp",name:"Income group"}]):r.columns=[{id:"subnational",name:"Subnational"}];for(var t=0;t<e.length;t++)m({key:e[t].key,name:e[t].name,removable:!1,countries:n},!0)}function g(e){if("combined_policies"===e.sub_type)for(var t=0;t<e.combined_policies.length;t++)if(e.combined_policies[t].segment===e.segment)return e.combined_policies[t];return e}var m=function(e,t){var i,n=function(e){var t,i={columns:[],items:{}};if(!(e=g(e)).countries.length)return i;i.columns.push({id:e.key,name:e.name,removable:void 0===e.removable});for(const o of e.countries)if("gl"!==o.iso){if(null!==r.selectedSubnational&&r.selectedSubnational===o.iso)for(const s of Object.values(r.countries[o.iso].subnational))if(i.items[s.iso2]||(i.items[s.iso2]={}),i.items[s.iso2].country||(i.items[s.iso2].country={id:s.iso2,value:s.title,value_id:s.title,link:null}),!i.items[s.iso2][e.key]){const a=`${e.key}__${s[e.key]}`;var n=e.values.find(e=>e.value_id===a).value;i.items[s.iso2][e.key]={value_id:a,value:n,popover:n}}null===r.selectedSubnational&&(i.items[o.iso]||(i.items[o.iso]={}),i.items[o.iso].country||(i.items[o.iso].country={id:o.iso,value:o.name,value_id:o.name,link:r.countries[o.iso]&&!angular.equals({},r.countries[o.iso].subnational)?{state:"data-tables.policy.subnational",params:{policy:l.params.policy,second:l.params.second,subnational:o.iso}}:null}),i.items[o.iso][e.key]||(t=o.data[e.key],i.items[o.iso][e.key]={value_id:t.value_id,value:t.value,popover:t.popover_value}))}return i}(e);n.columns.length&&(null!=t?r.columns.push(n.columns[0]):(i=e.key,o.get("/api/policies/"+i+"/excerpts").then(function(e){r.excerpts[i]||(r.excerpts[i]={}),r.excerpts[i]=e.data.data}),r.columns.splice(1,0,n.columns[0])),r.items=$.extend(!0,r.items,n.items))};r.addPolicy=m,r.isActiveMenu=function(e){return e===r.activeMenu},r.closeMenu=function(e){e&&r.activeMenu!==e||setTimeout(function(){r.activeMenu=null},50)},r.setActiveMenu=function(e){"topic"===e&&!r.selectedTopic||(r.activeMenu=e)},r.removeColumn=function(i){var n=[];$.each(r.columns,function(e,t){t.id!==i.id&&n.push(t)}),$.each(r.items,function(e,t){delete t[i.id]}),r.columns=n,r.resetSortBy(),r.resetFilter()},r.removePolicy=function(t){$.each(r.columns,function(e){if(this.id===t)return r.columns.splice(e,1),!1})};function f(){for(var e=$(".table-wrapper"),t=e.find(".content-table th"),i=-parseInt(e.css("margin-left"),10)+t.outerWidth(),n=(e.offset().left,0),o=0;o<t.length;o++){if(0<o&&i<=n)return $(t.get(o));n+=$(t.get(o)).outerWidth()}return null}function v(){var e=$("table-wrapper .content-table th").last(),t=b(e);return Math.max(0,t-(e=$("table-wrapper .hide-scroll"),t=e.find(".policy-column"),e.outerWidth()-t.outerWidth()))}r.skipTo=function(e,t){for(var i=-$("table-wrapper .content-table th").width(),n=e.prev();n.length;)i+=n.width(),n=n.prev();i=Math.max(0,i),i=Math.min(i,v()),t?$(".table-wrapper").stop().animate({"margin-left":-i}):$(".table-wrapper").css({"margin-left":i})};function y(e,t){for(var i,n=e,o=Math.abs(t),s=0;s<o;s++){if(0===(i=0<t?n.next():n.prev()).length)return n;n=i}return n}var b=function(e){for(var t=0,i=e.prev();0!==i.length;)t+=i.outerWidth(),i=i.prev();return t};r.skipNext=function(e){var t=y(f(),u.dataTables.skipSize);t.length&&r.skipTo(t,!0)},r.skipPrev=function(){var e=y(f(),-u.dataTables.skipSize);e.length&&r.skipTo(e,!0)};function w(){p.map(function(e){e.resolve()}),p=[]}function P(e){(e=g(e)).countries.length&&r.policies.push(e)}function x(e){var n=[],t=a.defer(),i=a.defer();return p.push(i),s.getTopicDetails(r.selectedModalTopic.segment+"/"+e.segment,i.promise).then(function(e){$.each(e.policies,function(e,t){var i=a.defer();p.push(i),"combined_policies"===t.sub_type?$.each(t.combined_policies,function(e,t){n.push(s.getPolicyDetails(t.segment,null,i.promise))}):n.push(s.getPolicyDetails(t.segment,null,i.promise))}),a.all(n).then(function(e){t.resolve(e)})}),t.promise}r.chooseActiveModalTopic=function(e,t){r.closeMenu("modal_topic"),r.policies=[],r.selectedModalTopic=e,r.selectedModalSubTopic=null,r.setActiveMenu(null),w();var i=[];$.each(e.subtopics,function(){i.push(x(this))}),a.all(i).then(function(e){$.each(e,function(){$.each(this,function(){P(this)})})}),t&&t.stopPropagation()},r.chooseActiveModalSubTopic=function(e,t){r.closeMenu("modal_subto
1pic"),r.policies=[],r.selectedModalSubTopic=e,r.setActiveMenu(null),w();var i=[];i.push(x(e)),a.all(i).then(function(e){$.each(e,function(){$.each(this,function(e,t){P(this)})})}),t&&t.stopPropagation()},r.chooseActiveTopic=function(e,t){h(),r.selectedTopic=e,r.selectedSubTopic=null,r.setActiveMenu(null),t&&t.stopPropagation()},r.keyPressOnSelectItem=function(e,t,i){if("country"===t)switch(e.which){case 13:r.chooseActiveTopic(i);break;case 27:r.closeMenu("country");break;case 38:C(e,38);break;case 40:C(e,40)}else if("topic"===t)switch(e.which){case 13:r.chooseActiveSubTopic(i,e);break;case 27:r.closeMenu("topic");break;case 38:C(e,38);break;case 40:C(e,40)}};var C=function(e,t){const i=e.target;i.classList.contains("dropdown-button")?i.nextElementSibling.children[0].children[0].focus():40===t?i.nextElementSibling&&i.nextElementSibling.focus():38===t&&i.previousElementSibling&&i.previousElementSibling.focus()};r.isPolicyActive=function(e){var t=!1;return $.each(r.columns,function(){if(this.id===e.key)return t=!0}),t},r.chooseActiveSubTopic=function(e,t){r.isLoading=!0,h(),r.resetSortBy(),r.resetFilter(),r.selectedSubTopic=e,r.setActiveMenu(null),d=[],s.getTopicDetails(r.selectedTopic.segment+"/"+r.selectedSubTopic.segment).then(function(e){$.each(e.policies,function(e,t){"combined_policies"===t.sub_type?$.each(t.combined_policies,function(e,t){d.push(s.getPolicyDetails(t.segment))}):d.push(s.getPolicyDetails(t.segment)),h()}),a.all(d).then(function(e){e.reverse(),$.each(e,function(){m(this)}),r.isLoading=!1})}),t&&t.stopPropagation()},h()}]),angular.module("worldPolicyForumApp").directive("swipe",["$swipe",function(a){return{restrict:"A",link:function(e,t,i){var n,o,s;a.bind(t,{start:function(e){n=e.x,o=$(t).scrollLeft(),s=!0},move:function(e){s&&(e=o+(n-e.x),e=Math.min(Math.max(e,0),$(t).get(0).scrollWidth),$(t).scrollLeft(e))},end:function(){s=!1},cancel:function(){}})}}}]),angular.module("worldPolicyForumApp").directive("moreInfo",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/more-info.html",restrict:"E",transclude:!0,replace:!0,scope:{label:"=?"},controllerAs:"moreInfoController",controller:["$scope",function(e){e.isOpen=!1}],link:function(e,t,i){}}}]),angular.module("worldPolicyForumApp").service("excerpt",["$uibModal","configs",function(o,s){this.openExcerpt=function(e,t,i,n){o.open({templateUrl:s.env.APP_PATH+"/views/modal-excerpt.html",controller:["$scope","configs","excerpt","country","legend","countryId",function(e,t,i,n,o,s){e.excerpt=i,e.country=n,e.legend=o,e.countryId=s,e.app_path=t.env.APP_PATH}],size:"md",resolve:{excerpt:function(){return e},country:function(){return t},legend:function(){return i},countryId:function(){return n}},backdrop:"static"}).result.then(function(){},function(){})}}]),angular.module("worldPolicyForumApp").filter("stripHtml",function(){return function(e){return e=e&&$(e).text()}}),angular.module("worldPolicyForumApp").filter("addTargetBlank",function(){return function(e){e=angular.element("<div>"+e+"</div>");return e.find("a").attr("target","_blank"),angular.element("<div>").append(e).html()}}),angular.module("worldPolicyForumApp").directive("syncScroll",["$timeout",function(a){return{template:"<div>&nbsp;</div>",restrict:"E",link:function(e,t,i){var n,o;function s(){t.width(n.width()),t.find("div").width(o.width())}a(function(){n=$(i.target),o=$(i.targetContent),t.on("scroll",function(){n.scrollLeft(t.scrollLeft())}),n.on("scroll",function(){t.scrollLeft(n.scrollLeft())}),e.$watch(function(){return n.width()},s),e.$watch(function(){return o.width()},s)},100)}}}]),angular.module("worldPolicyForumApp").filter("uri",function(){return function(e){return e=e&&e.replace("public://","/sites/default/files/")}}),angular.module("worldPolicyForumApp").directive("heightRatio",["$window","$timeout",function(a,r){return{restrict:"A",link:function(e,t,i){var n=parseFloat(i.heightRatio,10);function o(){angular.element(a).off("resize",s)}function s(){var e=t.width();t.height(e*n)}r(function(){s()}),angular.element(a).on("resize",s),e.$on("$destroy",o)}}}]),angular.module("worldPolicyForumApp").filter("url",function(){return function(e){return e=e&&'url("'+e+'")'}}),angular.module("worldPolicyForumApp").service("pageTitle",["configs","$state",function(t,i){function n(e){$(document).find("head title").text(e)}return{set:function(e){e=e?t.pageTitle.template.replace(/\{\{\s*title\s*\}\}/g,e):t.pageTitle.auto;i.params.pageTitlePrefix&&(e=i.params.pageTitlePrefix+e),n(e)},setStrict:n}}]),angular.module("worldPolicyForumApp").directive("webform",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/webform.html",restrict:"E",replace:!0,scope:{form:"=",formUpdate:"=?"},controllerAs:"webformController",controller:["$scope","$element","$http","$timeout","configs","vcRecaptchaService",function(n,o,s,t,e,i){function a(){i.reload(n.recaptcha.id)}n.setResponse=function(e){n.recaptcha.response=e},n.setRecaptchaId=function(e){n.recaptcha.id=e},n.$watch("form",function(e){n.fields=r(e),n.formUpdate&&t(function(){n.formUpdate(e,o)},0)});var r=function(e){var t,i,n={};if(e&&e.fields)for(i in e.fields)n[(t=e.fields[i]).weight]=t;l(n);var o=[];for(i in n)o.push(n[i]);return o.sort(function(e,t){return parseInt(e.weight)-parseInt(t.weight)}),o},l=function(e){var t,i,n,o={};for(t in e)o[e[t].form_key]=t;var s=["more_info","blurb_top","blurb_bottom"];for(t in o)for(n in s)o[i=t+"__"+s[n]]&&"markup"===e[o[i]].type&&(e[o[t]].extra[s[n]]=e[o[i]],delete e[o[i]])},c=function(e,t){for(var i=t,n=0;n<e.length;
1n++)i.hasOwnProperty(e[n])||(i[e[n]]={}),i=i[e[n]];return i};n.submitForm=function(){if(!n.recaptcha.response)return!(n.errors={recaptcha:"Must complete recaptcha before submitting"});var e=$(o).find("form"),t={},i={};return i.headers={"x-recaptcha-response":n.recaptcha.response},function(e,t){for(var i=e.find('.webform-field-input:not([type="file"])'),n=0;n<i.length;n++)t[i[n].name]=$(i[n]).val()}(e,t),function(e,t){for(var i,n=e.find(".webform-field-wrapped :input"),o=0;o<n.length;o++)i=n[o].name.split("."),c(i.slice(0,i.length-1),t)[i[i.length-1]]=$(n[o]).val()}(e,t),function(e,t){for(var i,n,o,s,a=e.find(".webform-field-input-array"),r=0;r<a.length;r++){n=(i=$(a[r])).find(".webform-field-input-array-item"),t[o=i.data("formkey")]=[];for(var l=0;l<n.length;l++)(s=$(n[l])).is(":checkbox, :radio")&&!s.is(":checked")||t[o].push(s.val())}}(e,t),function(e,t){for(var i,n,o,s=e.find(".webform-field-input-other"),a=0;a<s.length;a++)if(n=(i=$(s[a])).val(),t[o=i.data("name")])if($.isArray(t[o])){var r=t[o];t[o]={select:{},other:n};for(var l=0;l<r.length;l++)t[o].select[r[l]]=r[l]}else t[o]={select:t[o],other:n}}(e,t),function(e){for(var t=["hour","minute","day","month"],i=0;i<t.length;i++){var n,o=t[i];for(n in e)e[n].hasOwnProperty(o)&&(e[n][o]=e[n][o].replace(/^0+/,""))}}(t),window.FormData,t=JSON.stringify(t),i.headers["x-form-encoding"]="JSON",n.state="sending",s.post(n.form.action,t,i).then(function(e){n.errors=e.data.errors,a(),e.data.success?n.state="done":n.state="idle"},function(e){n.errors={_:"Error submitting form"},a(),n.state="failed"}),!1},n.errors=null,n.recaptcha={key:e.recaptchaKey,id:null,response:null},n.state="idle",n.fields=r(n.form)}]}}]),angular.module("worldPolicyForumApp").directive("webformField",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/webform-field.html",restrict:"E",replace:!0,scope:{field:"="},controllerAs:"webformFieldController",controller:["$scope",function(o){o.$watch("field",function(e){var t;"string"==typeof e.required&&(t=!!parseInt(e.required),isNaN(t)||(e.required=t)),"select"===e.type&&(o.options=i())});var i=function(){for(var e,t=o.field.extra.items.split("\n"),i=[],n=0;n<t.length;n++)e=t[n].split("|"),i.push({value:e[0],label:e[1]});return i}}]}}]),angular.module("worldPolicyForumApp").directive("webformFieldInput",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/webform-field-input.html",restrict:"E",replace:!0,scope:{field:"="},controllerAs:"webformFieldInputController",controller:["$scope","$element",function(s,i){function a(){var e=s.field?s.field.type:"textfield";return n[e]||t}var t={type:"text"},n={textfield:{type:"text",attrs:{placeholder:"placeholder"}},email:{type:"email",attrs:{placeholder:"placeholder"}},file:{type:"file"},number:{type:"number",attrs:{min:"min",max:"max",step:"step"},attrDefault:{step:"any"}},hidden:{type:"hidden"},date:{type:"date",attrs:{min:"start_date",max:"end_date"}},time:{type:"time",attrs:{min:"start_time",max:"end_time"}}};s.getInputType=function(){return a().type};s.$watch("field",function(){var e,t=function(){var e,t=a(),i=s.field.extra,n={};if(t.attrs)for(var o in t.attrs)e=t.attrs[o],i.hasOwnProperty(e)&&i[e]?n[o]=s.field.extra[t.attrs[o]]:t.attrDefault&&(n[o]=t.attrDefault[o]);return n}();for(e in t)$(i).prop(e,t[e])})}]}}]),angular.module("worldPolicyForumApp").directive("webformFieldSelect",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/webform-field-select.html",restrict:"E",replace:!0,scope:{field:"="},controllerAs:"webformFieldSelectController",controller:["$scope",function(o){(o.actual=o).$watch("field",function(e){o.form=i("form"),o.options=n(),o.inputType=e.extra.multiple?"checkbox":"radio"}),o.value=null,o.values=[],o.toggleValue=function(e){var t=o.values.indexOf(e);0<=t?o.values.splice(t,1):o.values.push(e)};function t(e){return"string"==typeof e?"select_or_other"===e:"object"==typeof e&&(e&&"select_or_other"===e.value)}o.hasOther=function(){return o.field.extra.other_option},o.showOther=function(){return o.hasOther()&&function(){if(t(o.value))return!0;for(var e=0;e<o.values.length;e++)if(t(o.values[e]))return!0;return!1}()};var i=function(e){for(var t=o.$parent;t;){if(t.hasOwnProperty(e))return t[e];t=t.$parent}};var n=function(){if(o.form.options[o.field.form_key])i=s(o.form.options[o.field.form_key]);else for(var e,t=o.field.extra.items.split("\n"),i=[],n=0;n<t.length;n++)e=t[n].split("|"),i.push({value:e[0],label:e[1]});return o.field.extra.optrand&&function(e){for(var t=e.length;0<t;){var i=Math.floor(Math.random()*t),n=e[--t];e[t]=e[i],e[i]=n}}(i),1===o.field.extra.other_option&&i.push({value:"select_or_other",label:o.field.extra.other_text}),i},s=function(e){var t,i=[];for(t in e)i.push({value:t,label:e[t]});return i}}]}}]),angular.module("worldPolicyForumApp").directive("webformFieldDate",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/webform-field-date.html",restrict:"E",replace:!0,scope:{field:"="},controllerAs:"webformFieldDateController",controller:["$scope","$element",function(e,t){}]}}]),angular.module("worldPolicyForumApp").directive("webformFieldTime",["configs",function(e){return{templateUrl:e.env.APP_PATH+"/views/directives/webform-field-time.html",restrict:"E",replace:!0,scope:{field:"="},controllerAs:"webformFieldTimeController",controller:["$scope","$element",function(e,t){}]}}]),angular.module("worldPolicyForumApp").directive("modal",function(){return{template:'<div class="modal fade"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button><h4 class="modal-title">{{ buttonClicked }} clicked!!</h4></div><div class="modal-body" ng-transclude></div></div></div></div>',restrict:"E",transclude:!0,replace:!0,scope:!0,link:function(e,t,i){e.$watch(i.visible,function(e){1==e?$(t).modal("show"):$(t).modal("hide")})}}}),angular.module("worldPolicyForumApp").controller("SiteMapCtrl",["$scope","$state","$location","$timeout","api","configs","pageTitle",function(t,e,
1i,n,o,s,a){t.data="",t.bannerImage=s.env.APP_PATH+"/images/resource-banner.jpg",o.getPage("/sitemap").then(function(e){t.data=e})}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.