PageSourceSearch

https://resourcewatch.org/_next/static/chunks/pages/embed/text/[id]-b41af46c84910e1f.js

js resourcewatch.org collected 2026-09-24 08:54:40 UTC 9,940 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4232],{90095:function(t,e,n){"use strict";var r=n(92777),i=n(82262),o=n(45959),a=n(63553),c=n(37247),s=n(59499),u=n(67294),l=(n(94301),n(47539)),d=n(85893);function f(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.Z)(t);if(e){var i=(0,c.Z)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,a.Z)(this,n)}}var g=function(t){(0,o.Z)(n,t);var e=f(n);function n(t){var i;return(0,r.Z)(this,n),(i=e.call(this,t)).state={loading:!1,error:null,data:null},i}return(0,i.Z)(n,[{key:"componentDidMount",value:function(){this.getData()}},{key:"getData",value:function(){var t=this,e=this.props.widgetConfig.data.url;this.props.toggleLoading(!0),this.setState({loading:!0}),fetch(e).then((function(t){if(t.ok)return t.json();throw new Error(t.statusText)})).then((function(e){var n=e.data&&e.data.length&&e.data[0]||e.rows&&e.rows.length&&e.rows[0];n&&t.setState({data:n,error:null})})).catch((function(e){return t.setState({error:e.message})})).then((function(){t.props.toggleLoading(!1),t.setState({loading:!1})}))}},{key:"getContent",value:function(){var t=this,e=this.props.widgetConfig,n=e.template_config,r=e.template,i=[],o=n.reduce((function(e,n){var r=n.key,o=t.state.data[r];if(!o)return i.push(r),e;var a=n.suffix||"",c=n.format&&!isNaN(parseInt(o,10))?function(t){return(0,l.WU)(n.format)(parseInt(t,10))}:function(t){return t},s=!isNaN(parseInt(o,10))||c(o).length?'<span class="token">'.concat(c(o)).concat(a,"</span>"):"";return e.replace(new RegExp("{{".concat(r,"}}"),"g"),s)}),r);return i.length&&this.setState({error:"The widget is malformed: the key".concat(i.length>1?"s":""," ").concat(i.join(", ")," can't be found in the data")}),o}},{key:"render",value:function(){return(0,d.jsxs)("div",{className:"c-text-chart",children:[this.state.error&&(0,d.jsxs)("div",{className:"error",children:["Unable to load the widget",(0,d.jsx)("span",{children:this.state.error})]}),!this.state.error&&this.state.data&&(0,d.jsx)("div",{className:"content",dangerouslySetInnerHTML:{__html:this.getContent()}}),!this.state.error&&!this.state.loading&&!this.state.data&&(0,d.jsx)("div",{className:"no-data",children:"No data"})]})}}]),n}(u.Component);(0,s.Z)(g,"defaultProps",{toggleLoading:function(){}}),e.Z=g},22543:function(t,e,n){"use strict";n.d(e,{Z:function(){return d}});var r=n(59499),i=(n(67294),n(94184)),o=n.n(i),a=n(58350),c=n(60307),s=n(96602),u=n(85893),l=function(t){var e=t.title,n=t.description,i=t.className,l=t.thumbnailUrl,d=t.children;return(0,u.jsxs)("div",{className:o()("l-page",(0,r.Z)({},i,!!i)),children:[(0,u.jsx)(c.Z,{title:e,description:n,thumbnail:l}),(0,u.jsx)(a.Icons,{}),(0,u.jsx)(s.Z,{}),d]})};l.defaultProps={thumbnailUrl:null,className:null};var d=l},68669:function(t,e,n){"use strict";n.r(e),n.d(e,{__N_SSP:function(){return j},default:function(){return O}});var r=n(59499),i=n(14416),o=n(92777),a=n(82262),c=n(10748),s=n(45959),u=n(63553),l=n(37247),d=n(67294),f=n(22543),g=n(90095),p=n(52202),h=n(60718),v=n(85893);function w(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,l.Z)(t);if(e){var i=(0,l.Z)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.Z)(this,n)}}var y=function(t){(0,s.Z)(n,t);var e=w(n);function n(t){var i;return(0,o.Z)(this,n),i=e.call(this,t),(0,r.Z)((0,c.Z)(i),"handleToggleLoading",(function(t){i.setState({isLoading:t},(function(){window.WEBSHOT_READY=!0}))})),i.state={isLoading:t.loading},i}return(0,a.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.widget,n=t.loading,r=this.state.isLoading,i=(0,h.M)(),o=e.name,a=e.description,c=e.widgetConfig;return n?(0,v.jsx)(f.Z,{title:"Loading widget...",description:"",children:(0,v.jsx)(p.Z,{isLoading:!0,className:"-light"})}):(0,v.jsx)(f.Z,{title:o,description:a||"",children:(0,v.jsxs)("div",{className:"c-embed-widget",children:[(0,v.jsxs)("div",{className:"visualization",children:[(0,v.jsx)(p.Z,{isLoading:r,className:"-light"}),(0,v.jsx)("div",{className:"widget-title",children:(0,v.jsx)("h4",{children:o})}),(0,v.jsx)("div",{className:"widget-content",children:(0,v.jsx)(g.Z,{widgetConfig:c,toggleLoading:this.handleToggleLoading})}),(0,v.jsx)("p",{className:"widget-description",children:a})]}),i&&(0,v.jsx)("img",{className:"embed-logo",height:21,width:129,src:"/static/images/logo-embed.png",alt:"Resource Watch"})]})})}}]),n}
1(d.PureComponent),m=(0,i.connect)((function(t){return{widget:t.widget.data,loading:t.widget.loading,bandDescription:t.widget.bandDescription,bandStats:t.widget.bandStats,webshot:t.common.webshot}}),null)(y);function b(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var j=!0;function O(t){return(0,v.jsx)(m,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?b(Object(n),!0).forEach((function(e){(0,r.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t))}},60718:function(t,e,n){"use strict";n.d(e,{M:function(){return l},s:function(){return d}});var r=n(59499),i=n(6192);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){(0,r.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var c=["aoi","type","geostore_env","geostore_id"],s=["aoi","type","geostore_env","geostore_id"],u=["geostore_env","geostore_id","country"],l=function(){return"undefined"!==typeof document&&""!==document.referrer&&!/localhost|(staging\.)?resourcewatch.org/.test(document.referrer)},d=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.id,o=(0,i.h$)(t),l=u;"map-swipe"===o&&(l=s),"map"===o&&(l=c);var d=Object.keys(e).filter((function(t){return l.includes(t)})).reduce((function(t,n){return a(a({},t),{},(0,r.Z)({},n,e[n]))}),{}),f=new URLSearchParams(d);return{link:"".concat(window.location.origin,"/data/widget/").concat(n).concat(f.toString().length?"?".concat(f.toString()):""),embed:"".concat(window.location.origin,"/embed/").concat(o,"/").concat(n).concat(f.toString().length?"?".concat(f.toString()):"")}}},6192:function(t,e,n){"use strict";n.d(e,{Lu:function(){return u},_U:function(){return l},h$:function(){return f},pR:function(){return c},tA:function(){return d},uG:function(){return s}});var r=n(59499),i=n(22109);function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){(0,r.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var c=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"type"in t&&"map"===t.type},s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!(!t||!(t.paramsConfig&&"embed"===t.paramsConfig.visualizationType||t.type&&"embed"===t.type))},u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"type"in t&&"text"===t.type},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!!Object.prototype.hasOwnProperty.call(t,"widgetConfig")&&(!(!t.widgetConfig||null===t.widgetConfig)&&(t.widgetConfig instanceof Object&&!(t.widgetConfig instanceof Array)))},d=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a(a({},t),{},{name:(0,i.replace)(t.name,n),widgetConfig:a(a({},(null===t||void 0===t?void 0:t.widgetConfig)||{}),{},{data:((null===t||void 0===t||null===(e=t.widgetConfig)||void 0===e?void 0:e.data)||[]).map((function(t){return null!==t&&void 0!==t&&t.url?a(a({},t),{},{url:r?window.encodeURI((0,i.replace)(t.url,n)):(0,i.replace)(t.url,n)}):t}))})})},f=function(t){if(!t)throw new Error("getWidgetType: widget not found");var e=t.widgetConfig;return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c(t)&&"layersLeft"in(t.paramsConfig||{})&&"layersRight"in(t.paramsConfig||{})}(e)?"map-swipe":c(e)?"map":s(e)?"embed":function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"type"in t&&"ranking"===t.type}(e)?"ranking":"widget"}},72213:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/embed/text/[id]",function(){return n(68669)}])}},function(t){t.O(0,[9774,2888,179],(function(){return e=72213,t(t.s=e);var e}));var e=t.O();_N_E=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.