1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9081],{92716:function(e,t,a){"use strict";a.d(t,{d:function(){return U}});var n=a(67294),l=a(64761);let[o,i]=(0,a(68216).R)("Drawer component was not found in tree");var s=a(96768),r=a(56817),c=a(14258);let u={xs:(0,s.h)(320),sm:(0,s.h)(380),md:(0,s.h)(440),lg:(0,s.h)(620),xl:(0,s.h)(780)};var d=(0,r.k)((e,{position:t},{size:a})=>({header:{zIndex:1e3},content:{flex:"right"===t||"left"===t?`0 0 ${(0,c.a)({size:a,sizes:u})}`:"0 0 100%",maxWidth:"100%",maxHeight:"100%",height:"right"===t||"left"===t?"100%":(0,c.a)({size:a,sizes:u}),borderRadius:0,overflowY:"auto"},inner:{display:"flex",justifyContent:"right"===t?"flex-end":"flex-start",alignItems:"bottom"===t?"flex-end":"flex-start"}})),p=a(12335),m=Object.defineProperty,g=Object.defineProperties,h=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,_=(e,t,a)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,x=(e,t)=>{for(var a in t||(t={}))f.call(t,a)&&_(e,a,t[a]);if(b)for(var a of b(t))v.call(t,a)&&_(e,a,t[a]);return e},y=(e,t)=>g(e,h(t)),C=(e,t)=>{var a={};for(var n in e)f.call(e,n)&&0>t.indexOf(n)&&(a[n]=e[n]);if(null!=e&&b)for(var n of b(e))0>t.indexOf(n)&&v.call(e,n)&&(a[n]=e[n]);return a};let S={top:"slide-down",bottom:"slide-up",left:"slide-right",right:"slide-left"},w={top:"slide-down",bottom:"slide-up",right:"slide-right",left:"slide-left"},j=y(x({},p.K),{position:"left"});function I(e){let t=(0,l.N4)("DrawerRoot",j,e),{classNames:a,variant:i,size:s,scrollAreaComponent:r,position:c,transitionProps:u}=t,m=C(t,["classNames","variant","size","scrollAreaComponent","position","transitionProps"]),{classes:g,cx:h,theme:b}=d({position:c},{name:"Drawer",variant:i,size:s}),f=("rtl"===b.dir?w:S)[c];return n.createElement(o,{value:{scrollAreaComponent:r}},n.createElement(p.e,x({__staticSelector:"Drawer",size:s,variant:i,transitionProps:x({transition:f,duration:200},u),classNames:y(x({},a),{content:h(g.content,null==a?void 0:a.content),inner:h(g.inner,null==a?void 0:a.inner)})},m)))}var T=Object.defineProperty,k=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,E=(e,t,a)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,O=(e,t)=>{for(var a in t||(t={}))D.call(t,a)&&E(e,a,t[a]);if(k)for(var a of k(t))L.call(t,a)&&E(e,a,t[a]);return e},P=(e,t)=>{var a={};for(var n in e)D.call(e,n)&&0>t.indexOf(n)&&(a[n]=e[n]);if(null!=e&&k)for(var n of k(e))0>t.indexOf(n)&&L.call(e,n)&&(a[n]=e[n]);return a};let A={shadow:"xl"},R=(0,n.forwardRef)((e,t)=>{let a=(0,l.N4)("ModalContent",A,e),{children:o,scrollAreaComponent:s}=a,r=P(a,["children","scrollAreaComponent"]),c=i(),u=s||c.scrollAreaComponent||p.e.NativeScrollArea;return n.createElement(p.e.Content,O({ref:t,radius:0},r),n.createElement(u,{style:{height:"100vh"}},o))});var G=Object.defineProperty,N=Object.defineProperties,Z=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,B=(e,t,a)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,H=(e,t)=>{for(var a in t||(t={}))M.call(t,a)&&B(e,a,t[a]);if(Y)for(var a of Y(t))z.call(t,a)&&B(e,a,t[a]);return e},F=(e,t)=>{var a={};for(var n in e)M.call(e,n)&&0>t.indexOf(n)&&(a[n]=e[n]);if(null!=e&&Y)for(var n of Y(e))0>t.indexOf(n)&&z.call(e,n)&&(a[n]=e[n]);return a};let V=N(H({},p.K),Z({withOverlay:!0,withCloseButton:!0}));function U(e){let t=(0,l.N4)("Drawer",V,e),{title:a,withOverlay:o,overlayProps:i,withCloseButton:s,closeButtonProps:r,children:c}=t,u=F(t,["title","withOverlay","overlayProps","withCloseButton","closeButtonProps","children"]),d=!!a||s;return n.createElement(I,H({},u),o&&n.createElement(p.e.Overlay,H({},i)),n.createElement(R,null,d&&n.createElement(p.e.Header,null,a&&n.createElement(p.e.Title,null,a),s&&n.createElement(p.e.CloseButton,H({},r))),n.createElement(p.e.Body,null,c)))}U.Root=I,U.CloseButton=p.e.CloseButton,U.Overlay=p.e.Overlay,U.Content=R,U.Header=p.e.Header,U.Title=p.e.Title,U.Body=p.e.Body,U.NativeScrollArea=p.e.NativeScrollArea},93162:function(e,t,a){var n,l,o;l=[],void 0!==(o="function"==typeof(n=function(){"use strict";function t(e,t,a){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){s(n.response,t,a)},n.onerror=function(){console.error("could not download file")},n.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function l(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(a){var t=document.createEvent("MouseEvents");
1t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof a.g&&a.g.global===a.g?a.g:void 0,i=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!i?function(e,a,i){var s=o.URL||o.webkitURL,r=document.createElement("a");a=a||e.name||"download",r.download=a,r.rel="noopener","string"==typeof e?(r.href=e,r.origin===location.origin?l(r):n(r.href)?t(e,a,i):l(r,r.target="_blank")):(r.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(r.href)},4e4),setTimeout(function(){l(r)},0))}:"msSaveOrOpenBlob"in navigator?function(e,a,o){if(a=a||e.name||"download","string"!=typeof e){var i;navigator.msSaveOrOpenBlob((void 0===(i=o)?i={autoBom:!1}:"object"!=typeof i&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),a)}else if(n(e))t(e,a,o);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){l(s)})}}:function(e,a,n,l){if((l=l||open("","_blank"))&&(l.document.title=l.document.body.innerText="downloading..."),"string"==typeof e)return t(e,a,n);var s="application/octet-stream"===e.type,r=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&r||i)&&"undefined"!=typeof FileReader){var u=new FileReader;u.onloadend=function(){var e=u.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),l?l.location.href=e:location=e,l=null},u.readAsDataURL(e)}else{var d=o.URL||o.webkitURL,p=d.createObjectURL(e);l?l.location=p:location.href=p,l=null,setTimeout(function(){d.revokeObjectURL(p)},4e4)}});o.saveAs=s.saveAs=s,e.exports=s})?n.apply(t,l):n)&&(e.exports=o)},57170:function(e,t,a){"use strict";a.d(t,{Z:function(){return h}});var n=a(85893),l=a(64523),o=a(96768),i=a(80971),s=a(69876),r=a(22870),c=a(71232),u=a(95117),d=a(31194),p=a(62014);
1function m(e){let{color:t,label:a,onRemove:s,...r}=e;return(0,n.jsx)("div",{...r,children:(0,n.jsxs)(l.x,{sx:e=>({display:"flex",cursor:"default",alignItems:"center",backgroundColor:null!=t?t:"dark"===e.colorScheme?e.colors.dark[5]:e.colors.gray[5],paddingLeft:e.spacing.xs,borderRadius:e.radius.sm}),children:[(0,n.jsx)(l.x,{sx:{lineHeight:1,fontSize:(0,o.h)(12),color:t?(0,p.Z)(t):"white"},children:a}),(0,n.jsx)(i.P,{onMouseDown:s,variant:"transparent",size:22,c:t?(0,p.Z)(t):"white",iconSize:14,tabIndex:-1})]})})}let g=(0,a(67294).forwardRef)((e,t)=>{let{label:a,value:o,itemType:i,...d}=e;return(0,n.jsx)(l.x,{ref:t,...d,children:(0,n.jsxs)(s.k,{direction:"row",gap:"xs",children:["country"===i&&(0,n.jsx)(r.E,{src:"/images/icons/country/country_".concat(o,".png"),width:24}),(0,n.jsxs)(c.Z,{position:"apart",sx:{flexGrow:1},children:[(0,n.jsx)(u.x,{children:a}),(0,n.jsx)(u.x,{tt:"uppercase",children:o})]})]})})});function h(e){let{className:t="oec-multi-select",items:a,itemType:l,selectedItems:o,placeholder:i,title:s,callback:r,valueAcc:c="label",labelAcc:u="title",limit:p=20}=e;return(0,n.jsx)(d.NU,{className:t,label:s,placeholder:i,valueComponent:m,itemComponent:g,data:a.map(e=>({...e,label:String(e[u]),value:String(e[c]),itemType:l})),value:o.map(e=>String(e[c])),onChange:e=>{r(e.map(e=>a.find(t=>String(t[c])===e)))},limit:p,searchable:!0,clearable:!0})}},41787:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(85893),l=a(64523);function o(e){let{sidebarContent:t,children:a,sticky:o=!1,disablePaddingX:i=!1,disablePaddingY:s=!1}=e;return(0,n.jsxs)(l.x,{sx:e=>({display:"grid",gridTemplateColumns:"300px auto",gridTemplateRows:"auto",[e.fn.smallerThan("sm")]:{display:"block"}}),children:[(0,n.jsx)(l.x,{component:"aside",mih:{base:"auto",sm:"calc(100vh - var(--main-distance-top))"},w:{base:"auto",sm:300},bg:"var(--oec-toolbar-bg)",px:i?0:25,pt:s?0:"xl",pos:{base:"static",sm:o&&"sticky"},top:"var(--main-distance-top)",sx:{alignSelf:o&&"start",gridRowStart:1,gridRowEnd:1},children:t}),(0,n.jsx)(l.x,{maw:"calc(100vw - 315px)",sx:e=>
1({gridRowStart:1,gridRowEnd:1,[e.fn.smallerThan("sm")]:{maxWidth:"100vw"}}),children:a})]})}},98981:function(e,t,a){"use strict";a.d(t,{Z:function(){return D}});var n=a(85893),l=a(64523),o=a(67841),i=a(92716),s=a(71232),r=a(19236),c=a(95117),u=a(58654),d=a(73819),p=a(55733),m=a.n(p),g=a(73946),h=a(8574),b=a(63815),f=a(55977),v=a(54130),_=a(66088),x=a(67294),y=a(93162),C=a(23838),S=a(47852),w=a(25361),j=a(72336);let I=e=>(0,S.Z)(e.replace(/<[^>]+>/g,"")).replace(/^\\-/g,"").replace(/\\-$/g,""),T=e=>{let t=(0,C.Z)(e).style("background-color");return"rgba(0, 0, 0, 0)"!==t&&"transparent"!==t?t:e===document.body?"white":T(e.parentNode)};function k(e){let{data:t}=e,a=(0,x.useMemo)(()=>t.slice(),[]),o=(0,x.useMemo)(()=>(a.length?[...new Set(t.reduce((e,t)=>[...e,...Object.keys(t)],[]))].sort((e,t)=>e.localeCompare(t)):[]).map(e=>({header:e,accessorKey:e})),[]),i=(0,_.Un)({columns:o,data:a.slice(0,5),enablePagination:!1,enableBottomToolbar:!1,enableTopToolbar:!1});return(0,n.jsx)(l.x,{mt:"sm",children:(0,n.jsx)(_.ZO,{table:i})})}function D(e){let{data:t,customAPI:a,title:p,saveViz:_=!0,includeOrigin:x=!0}=e,[S,D]=(0,g.v)({isOpen:!1,separator:",",imageProcessing:!1,imageFormat:"svg"}),{store:L}=(0,j.V)(),{t:E}=(0,v.$G)("viz-builder"),O=L.API,P=a||O;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.z,{onClick:()=>D({isOpen:!0}),leftIcon:(0,n.jsx)(b.Z,{}),children:E(p)}),(0,n.jsxs)(i.d,{position:"right",title:(0,n.jsxs)(s.Z,{children:[(0,n.jsx)(b.Z,{}),(0,n.jsx)(r.D,{order:3,children:E("Download")})]}),opened:S.isOpen,onClose:()=>D({isOpen:!1}),children:[(0,n.jsx)("div",{children:("string"==typeof P?[P]:void 0===P?[]:P).map((e,t,a)=>{let{length:l}=a,o="".concat(x?origin:"").concat(e);return(0,n.jsxs)("div",{children:[(0,n.jsx)(c.x,{fw:"bold",children:E("API")}),(0,n.jsx)(h.p,{style:l>1&&t<l-1?{marginBottom:5}:{},children:o},"vb_download_api_".concat(o))]},o)})}),(0,n.jsxs)("div",{children:[(0,n.jsx)(c.x,{fw:"bold",children:E("Preview data")}),S.isOpen&&(0,n.jsx)(k,{data:t}),(0,n.jsx)(o.z,{mt:"sm",leftIcon:(0,n.jsx)(b.Z,{}),onClick:()=>{let{title:t,data:a}=e,{dropCols:n}=e,l=S.separator,o=" "===S.separator?"tsv":"csv",i=a&&a.length?[...new Set(a.reduce((e,t)=>[...e,...Object.keys(t)],[]))].sort((e,t)=>e.localeCompare(t)):[],s=(i=n?i.filter(e=>!n.includes(e)):i).map(e=>'"'.concat(e,'"')).join(l);for(let e=0;e<a.length;e++){let t=a[e];s+="\r\n"+i.map(e=>{let a=t[e];return"number"==typeof a?a:a?'"'.concat(a,'"'):""}).join(l)}let r=new(m());r.file("".concat(I(t),".").concat(o),s),r.generateAsync({type:"blob"}).then(e=>(0,y.saveAs)(e,"".concat(I(t),".zip")))},children:" "===S.separator?E("Download TSV"):E("Download CSV")}),(0,n.jsx)(u.Y.Group,{value:S.separator,onChange:e=>D({separator:e}),styles:{root:{marginTop:"0.4rem"},label:{fontWeight:700,fontSize:"1rem",marginBottom:"0.4rem"}},label:"Separator",children:(0,n.jsxs)(s.Z,{children:[(0,n.jsx)(u.Y,{label:"Semicolon",value:";"}),(0,n.jsx)(u.Y,{label:"Comma",value:","}),(0,n.jsx)(u.Y,{label:"Tab",value:" "})]})}),_&&(0,n.jsxs)(l.x,{mt:"sm",children:[(0,n.jsx)(c.x,{size:"1rem",fw:"bold",children:E("Save visualization")}),(0,n.jsx)(o.z,{mt:"sm",onClick:()=>{let{title:t}=e,{backgroundColor:a,imageFormat:n}=S;D({imageProcessing:!0});let l=document.body.querySelector(".viz");if(l){let e;a&&(e=T(l)),l=(0,C.Z)(l).select(".d3plus-viz").node(),(0,w.Z)(l,{filename:I(t),type:n},{background:e,callback:()=>D({imageProcessing:!1})})}else D({imageProcessing:!1})},loading:S.imageProcessing,fullWidth:!0,leftIcon:(0,n.jsx)(f.Z,{size:"0.8rem"}),children:S.imageProcessing?E("Processing image"):"Download ".concat(S.imageFormat.toUpperCase())}),(0,n.jsxs)(s.Z,{grow:!0,mt:"sm",children:[(0,n.jsx)(c.x,{children:E("Image format")}),(0,n.jsx)(d.s,{value:S.imageFormat,onChange:e=>D({imageFormat:e}),fullWidth:!0,data:[{label:"PNG",value:"png"},{label:"SVG",value:"svg"}]})]})]})]})]})]})}},94236:function(e,t,a){"use strict";let n;a.d(t,{Z:function(){return e4}});var l=a(85893),o=a(20966),i=a(69876),s=a(64523),r=a(97564),c=a(71232),u=a(67841),d=a(34736),p=a(43523),m=a(95117),g=a(92729),h=a(94611),b=a(67294),f=a(11163),v=a(54130),_=a(64816),x=a(77531),y=a(5152),C=a.n(y),S=a(2962),w=a(27171),j=a(23386),I=a(74498),T=a.n(I),k=a(62751),D=a.n(k),L=a(51405),E=a(51220),O=a(57170),P=a(28855);function A(e){let{disabled:t,items:a,title:n,stateKey:o,selectedItem:i,callback:s,label:r="title",value:c="value"}=e;return(0,l.jsx)(P.Ph,{label:n,value:String(i[c]),data:a.map(e=>({...e,label:String(e[r]),value:String(e[c])})),onChange:e=>s(o,a.find(t=>String(t[c])===e)),disabled:t})}var R=a(73819);function G(e){let{items:t,selectedItem:a,run:n,scale:o,stateKey:i,title:s,callbackButton:c,limit:u=20,label:d="title",value:p="value"}=e;return(0,l.jsxs)(r.K,{children:[(0,l.jsx)(P.Ph,{label:s,value:String(a[p]),data:t.map(e=>({...e,label:String(e[d]),value:String(e[p])})),onChange:e=>n(i,t.find(t=>String(t[p])===e)),limit:u,searchable:!0}),o&&(0,l.jsx)(R.s,{data:["Log","Linear"],onChange:e=>c("".concat(i),e),value:a.selected})]})}function N(e){let{items:t,loading:a,selected:n,title:s,callback:r,label:c="title",value:u="value",...d}=e;return a?(0,l.jsx)(o.a,{size:30}):(0,l.jsxs)(i.k,{gap:"xs",align:"center",children:[s&&(0,l.jsx)(m.x,{component:"label",tt:"uppercase",fw:700,children:s}),(0,l.jsx)(R.s,{value:String(n[u]),data:t.map(e=>({...e,label:String(e[c]),value:String(e[u])})),onChange:e=>r(t.find(t=>String(t[u])===e)),...d})]})}var Z=a(19236);function Y(e){let{params:t,title:a}=e,{t:n}=(0,v.$G)("viz-builder");return(0,l.jsx)(Z.D,{align:"center",size:"h2",children:n(a,t)})}var M=a(64761),z=a(49834),B=a(78740),H=a(25601),F=a(33207),V=a(74389),U=a(66418),W=a(98065),$=a(65478),K=a(69985),Q=a(1582),q=a(73946);function J(e){for(var t=arguments.length,a=Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];let[l,o]=(0,q.v)(e),i=(0,b.useRef)(null);return(0,b.useEffect)(()=>{"function"==typeof i.current&&(i.current(l,...a),i.current=void 0)},[l]),[l,(e,t)=>{i.current=t,o(e)}]}
1var X=a(8134),ee=a(54685),et=a(92716),ea=a(54777),en=a(65386),el=a(30381),eo=a.n(el),ei=a(25675),es=a.n(ei),er=a(60321);let ec=e=>eu(e).reduce((t,a,n)=>(n?n===e.length-1&&1===n?t+=" and ".concat(a):n===e.length-1?t+=", and ".concat(a):t+=", ".concat(a):t+=a,t),""),eu=e=>e.map(e=>e?"string"==typeof e?e:e.name||e.title:""),ed=(e,t,a)=>{let{geo:n,geoPartner:l,product:o,isWorld:i,datasetName:s,isPort:r}=e,{x:c,y:u}=t,{cube:d,chart:p,flow:m,country:g,partner:h,viztype:b,time:f}=a,v=i?"the World":ec(n),_=ec(l),x=ec(o||[]),y=new RegExp(/(export|import)/).test(m),C=new RegExp(/(stacked|line)/).test(p),S=new RegExp(/^(?!(all|show)).*$/).test(g),w=new RegExp(/^(?!(all|show)).*$/).test(h),j=new RegExp(/show/).test(h),I=new RegExp(/^(?!(all|show)).*$/).test(b),T="show"===m,k=d.includes("subnational"),D=r?"ports":"states/provinces";i&&k&&(v="".concat(s,"'s ").concat(D));let E={country:v,flow:m,partner:_,prep:{export:"to",import:"from",uspto:""}[m],product:x,subnatName:D,time:(0,L.vC)(f,C)},O="vb_title_what_country_flow";if("network"===p){let e={country:v,time:f},t={export:["vb_title_network_rca",e],ogi:["vb_title_network_ogi",e],relatedness:["vb_title_network_relatedness",e]};O=t[m][0]||t.export[0]}else"rings"===p?O="vb_title_rings":"scatter"===p?(O="vb_title_scatter",E={measure:c.title,compare:u.title,time:f}):T?O=w?"vb_title_trade_balance_partner":"vb_title_trade_balance":y?!S&&I?O=k?"vb_title_which_subnat_flow_product":"vb_title_which_countries_flow_product":S&&I?O="vb_title_where_country_flow_product":j?O="vb_title_where_country_flow":S&&w&&(O="vb_title_what_country_flow_partner"):S?O="vb_title_what_country_patent":!S&&I&&(O="vb_title_which_countries_patent");return{vbTitle:O,vbParams:E}};var ep=a(72336);let em=(0,en.WU)(",.0f"),eg=e=>({header:{background:e.colors["oec-toolbar-bg"],alignItems:"flex-start"},content:{background:e.colors["oec-toolbar-bg"]}}),eh={closeOnEscape:!0,closeOnClickOutside:!0,autoFocus:!0,position:"bottom",size:100};function eb(e){let{title:t,fullValue:a,value:n}=e;return(0,l.jsxs)(c.Z,{className:"vb-drawer-stat",my:"xs",position:"apart",spacing:72,children:[(0,l.jsx)(m.x,{fw:700,span:!0,className:"title",children:t}),a?(0,l.jsx)("abbr",{className:"value",title:a,children:n}):(0,l.jsx)("span",{className:"value",children:n})]})}function ef(e){let{permalink:t,t:a,titleName:n,titleConfig:o,callback:i}=e,s=(0,f.useRouter)(),r="/en/visualize/tree_map".concat(t),{colorScheme:u}=(0,M.rZ)();return(0,l.jsx)(ee.e,{className:"vb-related-viz",href:r,sx:{color:"unset"},onClick:e=>{e.preventDefault(),s.push(r,void 0,{shallow:!0}),i(r)},children:(0,l.jsxs)(c.Z,{sx:e=>({backgroundColor:e.colors["oec-sidebar-lv2"],":hover":{backgroundColor:e.fn.darken(e.colors["oec-sidebar-lv2"],.1)}}),p:"xs",my:"sm",noWrap:!0,children:[(0,l.jsx)(es(),{className:"icon",height:36,width:36,src:"dark"===u?"/images/icons/app/app_tree_map.png":"/images/icons/app/app_tree_map_black.png",alt:""}),(0,l.jsx)(m.x,{fw:700,children:a(n,Object.assign(o,{interpolation:{escapeValue:!1}}))})]})})}function ev(e){let{isOpen:t,children:a,callback:n}=e;return(0,l.jsx)(et.d,{styles:{content:{display:"flex",alignItems:"center",justifyContent:"center"}},...eh,opened:t,onClose:()=>n(!1),withCloseButton:!1,children:a})}function e_(e){let{isOpen:t=!1,callback:a,groupBy:n,relatedItems:o,routeParams:i,run:r,selectedProducts:u}=e,{store:d}=(0,ep.V)(),{cubeSelected:p,countryMembers:m}=d,{t:g}=(0,v.$G)("viz-builder"),h=["HS6","HS4","HS2","Section","Country","Continent"],{cube:b,chart:f,country:_,partner:x,viztype:y,time:C}=i,{geoLevels:S}=p,w={export:"to",import:"from",uspto:""},j=n&&h.includes(n)?n[n.length-1]:h.find(e=>e in o),I=n?n[0]:h.find(e=>e in o),T=o["".concat(j," ID")],k=o[j],E=(p.productLevels||["HS6","HS4","HS2","Section"]).some(e=>o[e])&&o["Trade Value"],O=["Time ID","Year"].find(e=>Object.keys(o).includes(e))||"Year",P=o[O],A=new RegExp(/^(?!(all|show)).*$/).test(_)||new RegExp(/(Country)/).test(j),R=new RegExp(/^(?!(all|show)).*$/).test(_),G=new RegExp(/show/).test(x),N=new RegExp(/^(?!(all|show)).*$/).test(x),Y=new RegExp(/^(?!(all|show)).*$/).test(y),M=n?o["".concat(n[0]," ID")]:o["Section ID"]||o["Continent ID"],z=n[0];"scatter"===f&&(R=!1);let H=n.includes("Subnat Geography"),F=b.includes("subnational"),V=!["EGW1"].includes(n[0]),U=Object.keys(o),W=o["Continent ID"],$=W?T.slice(2,5):T,
1K=U.includes("Country ID"),Q=K?o["Country ID"].slice(2,5):void 0,q=[].concat(S).reverse().find(e=>U.includes(e)),J=q?o["".concat(q," ID")].toString():void 0;!Q&&q&&(Q=J);let X=["Continent","Country"].includes(j)?"/images/icons/country/country_".concat(T.slice(2,5),".png"):(0,er.backgroundImageV2)(I,o),en=(0,er.findColorV2)(I,o)||D().Section[M]||D().Continent[M],el=(e,t)=>ec(t.reduce((t,a)=>(e.split(".").includes(a.label||a.id)&&t.push(a.title||a.name),t),[])),{geoItems:ei}=p,eu=F?[...ei,...m]:ei,ed=A?el(_,eu):"",eh=N?el(x,eu):"",ev=Q?el(Q,eu):"",e_=[];R&&e_.push({id:_,name:ed}),Q&&e_.push({id:Q,name:ev,type:K?"Country":"Subnational"});let ex=(0,L.vC)(C),ey=(0,l.jsx)("div",{className:"vb-drawer-icon",style:{backgroundColor:W?"transparent":en},children:(0,l.jsx)(es(),{alt:"",width:48,height:48,fit:"contain",src:X})}),eC=(0,l.jsxs)("div",{className:"vb-drawer-title",children:[(0,l.jsx)(Z.D,{order:3,className:"vb-drawer-title-name",children:k}),V&&(0,l.jsx)(ee.e,{className:"vb-drawer-title-link",fw:700,sx:{color:en},href:"/en/profile/".concat(H?b:G?"country":"Section"===z?"hs92":K?"country":b,"/").concat($),children:g("View profile")})]}),eS=p.port?"ports":"states/provinces";return(0,l.jsxs)(et.d,{className:"vb-drawer",opened:t,title:(0,l.jsxs)(c.Z,{align:"flex-start",children:[ey,eC]}),position:"right",styles:eg,onClose:()=>a(!1),children:[(0,l.jsxs)(s.x,{children:[(0,l.jsx)(eb,{title:"".concat(j," ID"),value:E?(0,L.Pp)(T):T}),(0,l.jsx)(ea.i,{}),(0,l.jsx)(eb,{title:g("Trade Value"),value:"".concat(p.currency||"$").concat((0,B.Z)(o["Trade Value"])),fullValue:"".concat(p.currency||"$").concat(em(o["Trade Value"]))}),(0,l.jsx)(ea.i,{}),(0,l.jsx)(eb,{title:O,value:"Time ID"===O?eo()(P).format("L"):P})]}),(0,l.jsx)(Z.D,{order:4,className:"vb-related-viz-title",children:g("Related Visualizations")}),["export","import"].reduce((e,t)=>{if(N){let a="/".concat(b,"/").concat(t,"/").concat(x,"/").concat(_,"/show/").concat(C,"/"),n="/".concat(b,"/").concat(t,"/").concat(x,"/show/").concat(T,"/").concat(C,"/");if(!F){e.push((0,l.jsx)(ef,{permalink:a,titleConfig:{country:eh,partner:ed,product:k,flow:t,time:ex,prep:w[t]},titleName:"vb_title_what_country_flow_partner",callback:e=>r(e),t:g},a)),e.push((0,l.jsx)(ef,{permalink:n,titleConfig:{country:eh,product:k,flow:t,time:ex,prep:w[t]},titleName:"vb_title_where_country_flow_product",callback:e=>r(e),t:g},n));let o="/".concat(b,"/").concat(t,"/").concat(x,"/all/show/").concat(C,"/");e.push((0,l.jsx)(ef,{permalink:o,titleConfig:{country:eh,flow:t,time:ex,prep:w[t]},titleName:"vb_title_what_country_flow",callback:e=>r(e),t:g}))}}if(Q!==_&&Q&&R){let a="/".concat(b,"/").concat(t,"/").concat(Q,"/").concat(_,"/show/").concat(C,"/"),n="/".concat(b,"/").concat(t,"/").concat(_,"/").concat(Q,"/show/").concat(C,"/");K&&!F&&e.push((0,l.jsx)(ef,{permalink:a,titleConfig:{country:ev,product:k,partner:ed,flow:t,time:ex,prep:w[t]},titleName:"vb_title_what_country_flow_partner",callback:e=>r(e),t:g},a)),e.push((0,l.jsx)(ef,{permalink:n,titleConfig:{country:ed,product:k,partner:ev,flow:t,time:ex,prep:w[t]},titleName:"vb_title_what_country_flow_partner",callback:e=>r(e),t:g},n))}if(E){let a="/".concat(b,"/").concat(t,"/show/all/").concat(T,"/").concat(C,"/");e.push((0,l.jsx)(ef,{permalink:a,titleConfig:{country:ed,subnatName:eS,product:k,flow:t,time:ex,prep:w[t]},titleName:F?"vb_title_which_subnat_flow_product":"vb_title_which_countries_flow_product",callback:e=>r(e),t:g},a))}if(Y){let a="/".concat(b,"/").concat(t,"/show/all/").concat(y,"/").concat(C,"/");if(e.push((0,l.jsx)(ef,{permalink:a,titleConfig:{subnatName:eS,product:u.map(e=>e.name),flow:t,time:ex,prep:w[t]},titleName:F?"vb_title_which_subnat_flow_product":"vb_title_which_countries_flow_product",callback:e=>r(e),t:g},a)),K&&!F){let a="/".concat(b,"/").concat(t,"/").concat(Q,"/all/").concat(y,"/").concat(C,"/");e.push((0,l.jsx)(ef,{permalink:a,titleConfig:{product:u.map(e=>e.name),country:ev,flow:t,time:ex,prep:w[t]},titleName:"vb_title_where_country_flow_product",callback:e=>r(e),t:g},a))}}return e_.forEach(a=>{let n="/".concat(b,"/").concat(t,"/").concat(a.id,"/all/show/").concat(C,"/"),o="/".concat(b,"/").concat(t,"/").concat(a.id,"/show/all/").concat(C,"/"),i=!0;if(a.type&&"Country"===a.type&&F&&(i=!1),i&&(e.push((0,l.jsx)(ef,{permalink:n,titleConfig:{country:a.name,flow:t,time:ex,prep:w[t]},titleName:"vb_title_what_country_flow",callback:e=>r(e),t:g},n)),e.push((0,l.jsx)(ef,{permalink:o,titleConfig:{country:a.name,flow:t,time:ex,prep:w[t]},titleName:"vb_title_where_country_flow",callback:e=>r(e),t:g},o)),E)){let n="/".concat(b,"/").concat(t,"/").concat(a.id,"/show/").concat(T,"/").concat(C,"/");e.push((0,l.jsx)(ef,{permalink:n,titleConfig:{country:a.name,flow:t,product:k,time:ex,prep:w[t]},titleName:"vb_title_where_country_flow_product",callback:e=>r(e),t:g},n))}}),e},[])]})}
1var ex=a(8574),ey=a(56514),eC=a(74481),eS=a(99799),ew=a(70819),ej=a(92791);let eI=e=>({code:{background:"".concat(e.colors["oec-toolbar-bg"]," !important")}});function eT(){let[e,t]=(0,q.v)({isOpen:!1}),{t:a}=(0,v.$G)("viz-builder"),n=window.location.href,o=n&&'<iframe width="560" height="315" src="'.concat(n.replace("/visualize-legacy/","/visualize-legacy/embed/"),'?controls=false" frameborder="0"></iframe>'),i="https://www.facebook.com/sharer/sharer.php?u=".concat(n),r="http://www.linkedin.com/shareArticle?mini=true&url=".concat(n),d="http://twitter.com/share?text=&url=".concat(n,"&hashtags=OEC,OECworld"),p="https://wa.me/?text=".concat(n);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.z,{onClick:()=>t({isOpen:!0}),leftIcon:(0,l.jsx)(ey.Z,{}),children:"Share"}),(0,l.jsxs)(et.d,{position:"right",opened:e.isOpen,onClose:()=>t({isOpen:!1}),title:(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(ey.Z,{}),(0,l.jsx)(Z.D,{order:3,children:a("Share")})]}),children:[(0,l.jsx)(Z.D,{my:"md",order:5,children:a("Short URL")}),(0,l.jsx)(ex.p,{styles:eI,children:n}),(0,l.jsx)(Z.D,{my:"md",order:5,children:a("Embed URL")}),(0,l.jsx)(ex.p,{styles:eI,children:o}),(0,l.jsxs)(s.x,{className:"vb-share-option",mt:"xl",children:[(0,l.jsx)(Z.D,{order:5,className:"title",children:a("Share on social media")}),(0,l.jsxs)(c.Z,{mt:"md",children:[(0,l.jsx)(z.A,{fw:700,component:"a",radius:"xl",sx:e=>({color:"dark"===e.colorScheme?e.colors["oec-of-white"]:e.colors["oec-off-black"]}),variant:"outline",href:d,className:"vb-share-social",target:"_blank",rel:"noopener noreferrer",children:(0,l.jsx)(c.Z,{children:(0,l.jsx)(eC.Z,{size:"1rem"})})}),(0,l.jsx)(z.A,{fw:700,component:"a",radius:"xl",sx:e=>({color:"dark"===e.colorScheme?e.colors["oec-of-white"]:e.colors["oec-off-black"]}),variant:"outline",href:i,className:"vb-share-social",target:"_blank",rel:"noopener noreferrer",children:(0,l.jsx)(c.Z,{children:(0,l.jsx)(eS.Z,{size:"1rem"})})}),(0,l.jsx)(z.A,{fw:700,component:"a",radius:"xl",sx:e=>({color:"dark"===e.colorScheme?e.colors["oec-of-white"]:e.colors["oec-off-black"]}),variant:"outline",href:r,className:"vb-share-social",target:"_blank",rel:"noopener noreferrer",children:(0,l.jsx)(c.Z,{children:(0,l.jsx)(ew.Z,{size:"1rem"})})}),(0,l.jsx)(z.A,{fw:700,component:"a",radius:"xl",sx:e=>({color:"dark"===e.colorScheme?e.colors["oec-of-white"]:e.colors["oec-off-black"]}),variant:"outline",href:p,className:"vb-share-social",target:"_blank",rel:"noopener noreferrer",children:(0,l.jsx)(c.Z,{children:(0,l.jsx)(ej.Z,{size:"1rem"})})})]})]})]})]})}var ek=a(98981);let eD=["#FF3534","#F18989","#EEA9A9","#E6E6E6","#A9A9EE","#8989F1","#3435FF"],eL=["#364658","#3C71A6","#20928C","#38B977","#FDE725"];function eE(){let[e,{loading:t}]=(0,w.a)(),[a,n]=(0,b.useState)(null),[l,o]=(0,b.useState)(null),i=!t&&!!e,s=async()=>{let e=await fetch("/api/get-user-token"),t=await e.json();n(t.token),o(t.expiresAt)};return(0,b.useEffect)(()=>{if(!i)return;if(!a){s();return}let e=setTimeout(()=>{let e=new Date;new Date(l)<=e&&s()},new Date(l)-new Date);return()=>clearTimeout(e)},[i,a,l]),a}let eO=C()(()=>a.e(745).then(a.bind(a,60745)),{loadableGenerated:{webpack:()=>[60745]},ssr:!1}),eP=["Trade Value","Growth","Growth (%)"],eA=(e,t)=>t.split(".").includes(e.value.slice(2,5)),eR=e=>e.map(e=>e.value).join(),eG="".concat("https://api-v2.oec.world/","tesseract/data.jsonrecords"),eN=g.Z.CancelToken;function eZ(e){let{isEmbed:t,routeParams:a,selectedProducts:o}=e,{store:i,updateData:r}=(0,ep.V)(),[u,d]=function(e,t,a){let{query:n}=(0,f.useRouter)(),{click:l,controls:o,layout:i}=n,[s,r]=J({auth:!0,data:[],depth:"HS4",isOpenDrawer:!1,isOpenMoreDetails:!1,loading:!0,relatedItems:{},routeParams:e,scale:"Log",selected:eP[0],subnatGeoDepth:void 0,showControls:!o||(0,h.Z)(o),allowClick:!l||(0,h.Z)(l),stackLayout:i||"Value"},t,a);return[s,r]}(a,i,e),{query:p}=(0,f.useRouter)(),{colorScheme:m}=(0,M.rZ)(),{t:_}=(0,v.$G)("viz-builder"),x=(0,b.useRef)(null),{allowClick:y,loading:C,selected:S,auth:j,showControls:I}=u,{data:k,cubeSelected:L}=i,{depth:E}=p,{chart:O,cube:P,flow:A,country:R,partner:G,viztype:Z,time:Y}=a,{currency:q}=i.cubeSelected,[ee]=(0,w.a)(),et=eE();(0,b.useEffect)(()=>{x.current=JSON.stringify(a)});let ea=(e,t,a)=>{let{depth:l,subnatGeoDepth:o}
1=e,{routeParams:i}=a,{cubeSelected:s}=t,{timeItems:c}=s,{cube:u,chart:p,flow:m,country:h,partner:b,viztype:f,time:v}=i,_=Object.values(T()).find(e=>e.cube===s.name);if(_&&_.value!==u)return;let{productLevels:x,geoLevels:y}=T()[u],C={export:2,import:1},S=["stacked","line"].includes(p),w=T()[u],j=["show","all"].includes(b)?void 0:t.countryMembers.filter(e=>eA(e,b)),I=!["show","all"].includes(f),k=[],D=[],L=v.split(".")[0].toString().length,E={4:"Year",5:"Time",6:"Time"}[L]||"Year",O=["show","all"].includes(h)?void 0:h.replace(/\./g,",");O?O&&"show"===f?k.push(["line"].includes(p)?x[0]:l):(O&&"all"===f||O&&I)&&k.push("Country"):k.push(o||y[y.length-1]),k.push(E);let P={cube:w.cube,drilldowns:k.join(),measures:w.measure,parents:!0},A=v.replace(/\./g,",");if(S){let e=v.split("."),t=c.findIndex(t=>t.value===e[0]),a=c.findIndex(t=>t.value===e[1]);A=c.slice(a,t+1).map(e=>e.value).join()}D.push("Time:".concat(A)),C[m]?D.push("Trade Flow:".concat(C[m])):P.drilldowns="Trade Flow,".concat(E),j&&D.push("Country:".concat(j.map(e=>e.value).join())),O&&u.slice(-3)!==O&&D.push("Subnat Geography:".concat(O)),I&&D.push("Product:".concat(f)),P.drilldowns.includes("Country")&&(P.properties="ISO 3");let R=v.split("."),G="".concat(E,".").concat("Trade Value",".period.1");if(e.selected.includes("Growth")){let e=c.findIndex(e=>1*e.value==1*R[0]);D=D.filter(e=>!e.includes("Time")),P.growth=G,P.drilldowns.includes(E)||(P.drilldowns+=",".concat(E)),D.push("".concat(E,":").concat(c[e+1].value,",").concat(1*v))}let N="".concat(eG,"?").concat((0,X.parseURL)(ee&&ee.apikey?{...P,include:D.join(";"),token:ee.apikey}:{...P,include:D.join(";")}));void 0!==n&&n(),g.Z.get(eG,{cancelToken:new eN(e=>{n=e}),params:{...P,include:D.join(";")},headers:{authorization:"Bearer ".concat(et)}}).then(t=>{let a=t.data.data;e.selected.includes("Growth")&&(a=a.filter(e=>e[E]===1*R[0])),a[0]&&a[0].Time&&(a=a.map(e=>{let t=e.Time.toString(),a=t.slice(0,4),n=t.slice(4,L);return 5===L&&(n=3*n-2),Object.assign(e,{"Time ID":new Date("".concat(a,"/").concat(n,"/").concat("01")).getTime()})})),r({API:N,data:a,loading:!1});let n={data:a,auth:!0,loading:!1,routeParams:i};o||(n.subnatGeoDepth=y[y.length-1]),d(n)}).catch(e=>{let t={data:[],loading:!1,routeParams:i};r({API:void 0,data:[],loading:!1}),e.response&&401===e.response.status&&(t.auth=!1),d(t)})},en=(e,t,a)=>{let{routeParams:l}=a,{countryMembers:o,cubeSelected:i}=t,{geoLevels:s}=t.cubeSelected,{cube:c,chart:u,flow:p,partner:m,viztype:h,time:b}=l,{country:f}=l;if("wld"===f&&(f="all"),T()[c]&&(Object.values(T()).find(e=>e.cube===i.name)||T().datasets.find(e=>e.cubeName===i.name)).value!==c)return null;let v={API:void 0,data:[],loading:!0};if(r(v),["tree_map"].includes(u)||(v.selected=eP[0]),d(v),T()[c])return(Object.values(T()).find(e=>e.cube===i.name)||T().datasets.find(e=>e.cubeName===i.name)).value===c?ea(e,t,a):(d({loading:!1,data:[]}),null);let _=o.filter(e=>eA(e,f)),x=["show","all"].includes(m)?void 0:o.filter(e=>eA(e,m)),y=eR(_),C=!["show","all"].includes(h),S=h.split(".").every(isFinite),w="show"===p,j=b.split("."),I=["line","stacked"].includes(u)?(0,X.range)(j[0],j[j.length-1]).join():j.join();1===j.length&&j.push(j[0]);let k=i.name,D=i.measure,L="Year",{productLevels:E}=i,O="".concat(L,".").concat(D,".period.1"),P=s[0],A=s[1];if(w){let e={cube:k,drilldowns:L,measures:D,parents:!0},t=["Year:".concat(I)],a={...e},n={...e},o=[...t,"".concat(P,":").concat(y)],i=[...t,"".concat(A,":").concat(y)];if(x){let e=x.map(e=>e.value).join();o.push("".concat(A,":").concat(e)),i.push("".concat(P,":").concat(e))}return g.Z.all([g.Z.get(eG,{params:{...a,include:o.join(";")}}),g.Z.get(eG,{params:{...n,include:i.join(";")}})]).then(g.Z.spread(function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];let c=t[0].data.data,u=t[1].data.data;c.forEach(e=>{e["Trade Flow ID"]=1,e["Trade Flow"]="Exports"}),u.forEach(e=>{e["Trade Flow ID"]=2,e["Trade Flow"]="Imports"});let p=[...c,...u];r({API:["".concat(eG,"?").concat(V({...a,include:o.join(";")})),"".concat(eG,"?").concat(V({...n,include:i.join(";")}))],data:p,loading:!1}
1),d({auth:!0,data:p,loading:!1,routeParams:l,scale:"Linear"})}))}let R="export"===p,G=R?P:A,N=R?A:P,Z=R?A:P,Y={show:0===_.length||S?N:e.depth,all:N,wildcard:S&&0===_.length?G:N};"line"===u&&(Y.show=C?G:E[0]);let M=new RegExp(/^(?!(all|show)).*$/).test(f),z=new RegExp(/^(?!(all|show)).*$/).test(m),B=[L];"all"===f&&"all"===m?B.push(e.depth):M||z?B.push(Y[h]?Y[h]||N:Y.wildcard):B.push(G);let H={cube:k,drilldowns:B.join(),measures:D,parents:!0},F=["Year:".concat(I)];if(e.selected.includes("Growth")){H.growth=O;let e=1*b;(F=F.filter(e=>!e.includes("Year"))).push("Year:".concat(e-1,",").concat(e))}if(_&&_.length>0){if("Exporter Country"!==G&&"Importer Country"!==G){let e=o.map(e=>e.value);_.map(e=>e.value).filter(t=>e.includes(t)).length||F.push("".concat(G,":").concat(eR(_)))}else F.push("".concat(G,":").concat(eR(_)))}if(x&&F.push("".concat(Z,":").concat(eR(x))),S&&i.productItems){let e=h.split(".")[0],t=i.productItems[e]||{type:"HS4"};F.push("".concat(t.type,":").concat(h.replace(/\./g,",")))}if(H.drilldowns.includes(G)&&(H.properties="".concat(G," ISO 3")),H.drilldowns.includes(N)&&(H.properties="".concat(N," ISO 3")),"network"===u){for(let e in H)delete H[e];let e={cube:k,location:"Exporter Country",activity:"trade_i_oec_a_sitc2"!==k?"HS4":"Subgroup",measure:D,filter:"Exporter Country:".concat(_.map(e=>e.value)[0]),cuts:"Year:".concat(I),parents:!0},t="ogi"===p?"complexity/opportunity_gain.jsonrecords":"complexity/relatedness.jsonrecords";return g.Z.get("".concat("https://api-v2.oec.world/").concat(t),{params:e}).then(a=>{let n=a.data.data;r({API:"".concat("https://api-v2.oec.world/").concat(t).concat(V(e)),data:n,loading:!1}),d({data:n,auth:!0,loading:!1,routeParams:l})})}if("rings"===u){let e={Country:_.map(e=>e.value)[0],Year:I};return g.Z.get("/api/connections/hs4",{params:e}).then(t=>{let a=t.data;a.forEach(e=>{e.x=e.source,e.y=e.target,e.id=e["HS4 ID"].toString()}),r({API:"/api/connections/hs4?".concat(V(e)),data:a,loading:!1}),d({data:a,auth:!0,loading:!1,routeParams:l})}).catch(()=>void 0)}function V(e){return Object.keys(e).map(t=>"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e[t]))).join("&")}if("scatter"===u){let e={Year:b.replace(/\./g,","),x:p,y:f};return g.Z.get("/api/gdp/eci",{params:e}).then(t=>{let a=t.data.filter(t=>t[e.y]&&t[e.x]).reduce((e,t)=>{let a=e.find(e=>e["Country ID"]===t["Country ID"]);return(!a||a.Year<t.Year)&&(e=e.filter(e=>e["Country ID"]!==t["Country ID"])).push(t),e},[]);r({API:"/api/gdp/eci?".concat(V(e)),data:a,loading:!1}),d({data:a,loading:!1,routeParams:l})})}return void 0!==n&&n(),g.Z.get(eG,{cancelToken:new eN(e=>{n=e}),params:{...H,include:F.join(";")}}).then(t=>{let a=t.data.data;a.forEach(e=>{let t=Object.keys(e);t.includes("Importer Country")?(e.Continent=e["Importer Continent"],e["Continent ID"]=e["Importer Continent ID"],e.Country=e["Importer Country"],e["Country ID"]=e["Importer Country ID"],e["ISO 3"]=e["Importer Country ISO 3"],delete e["Importer Country"],delete e["Importer Country ID"],delete e["Importer Country ISO 3"],delete e["Importer Continent"],delete e["Importer Continent ID"],delete e["Importer Continental Region"],delete e["Importer Continental Region ID"]):t.includes("Exporter Country")&&(e.Continent=e["Exporter Continent"],e["Continent ID"]=e["Exporter Continent ID"],e.Country=e["Exporter Country"],e["Country ID"]=e["Exporter Country ID"],e["ISO 3"]=e["Exporter Country ISO 3"],delete e["Exporter Country"],delete e["Exporter Country ID"],delete e["Exporter Country ISO 3"],delete e["Exporter Continent"],delete e["Exporter Continent ID"],delete e["Exporter Continental Region"],delete e["Exporter Continental Region ID"])}),e.selected.includes("Growth")&&(a=a.filter(e=>e.Year===1*b)),r({API:"".concat(eG,"?").concat(V({...H,include:F.join(";")})),data:a,loading:!1}),d({data:a,auth:!0,loading:!1,routeParams:l})}).catch(e=>{console.error("Error fetching data",e),r({API:void 0,data:[],loading:!1}),d({data:[],loading:!1,routeParams:l})})};if((0,b.useEffect)(()=>{let e={location:window.location};if(T()[P]){let t=T()[P].productLevels,a=t.length,n=t.includes(E)?E:a>3?t[2]:t[a-1];e.depth=n}else if("trade_i_oec_a_sitc2"===L){let t=L.productLevels;e.depth=t.includes(E)?E:t.includes("Subgroup")?"Subgroup":t[t.length-1]}else{let t=L.productLevels;e.depth=t.includes(E)?E:t.includes("HS4")?"HS4":t[t.length-1]}L.name&&d(e,en)},[JSON.stringify(L),JSON.stringify(a)]),C||x.current!==JSON.stringify(a))return(0,l.jsx)(s.x,{mih:"70vh",children:(0,l.jsx)(eO,{position:"static",pageTitle:!1,visible:!0})});if(!j)return(0,l.jsx)("div",{children:"Paywall Chart"});let el=!["show","all"].includes(Z),eo=!["show","all"].includes(R),ei=window.innerWidth<500,es=e=>"".concat(q||"$").concat((0,B.Z)(e)),ec=T()[P],eu=i.cubeSelected.productLevels[0],ed={data:i.data||[],groupBy:"all"===Z||Z.split(".").every(isFinite)||el?["Continent","Country"]:[eu,u.depth],legendConfig:{padding:ei?2:5},theme:m,totalFormat:e=>"Total: ".concat(es(e))},em="Trade Value";if(S.includes("Growth")){let e=S===eP[2],t=e?"".concat(em," Growth"):"".concat(em," Growth Value");ed.colorScale=t,ed.colorScaleConfig={axisConfig:{tickFormat:t=>e?"".concat((0,B.Z)(100*t),"%"):es(t)},scale:e?"linear":"log",midpoint:0},ed.shapeConfig={fill:"D3PLUS-COMMON-RESET"}}let eg={on:{}},eh={};y&&(eg.on.click=e=>d({isOpenDrawer:!0,relatedItems:e}),eh.footer=_("tooltip.more"));let eb=i.cubeSelected.productLevels.slice(1),ef=!1,ex={};if(ec){let e=["show","all"].includes(R)?void 0:R.replace(/\./g,","),t=!!("show"===R&&"all"===G),{productLevels:a}=ec,n=a.length>3?[a[0],u.depth]:a;eb=a.slice(1),e?e&&"show"===Z?ed.groupBy=n:(e&&"all"===Z||e&&el)&&(ed.groupBy=["Continent","Country"]):(ed.groupBy=ec.geoLevels,ef=!0),t&&(ex=i.cubeSelected.d3plusConfig)}
1let ey=I?(0,l.jsxs)(c.Z,{className:"oec-button-group",children:[(0,l.jsx)(eT,{}),(0,l.jsx)(ek.Z,{data:i.data,title:"download",includeOrigin:!1})]}):null,eC=t&&I?(0,l.jsx)(s.x,{className:"vb-chart-cog",children:(0,l.jsx)(z.A,{ml:"auto",onClick:()=>d({isOpenMoreDetails:!u.isOpenMoreDetails}),children:(0,l.jsx)(H.Z,{})})}):null;if("tree_map"===O&&k&&k.length){let e="Continent"===ed.groupBy[0],n=(0,l.jsx)(c.Z,{className:"vb-chart-options",position:"center",w:"100%",children:(0,l.jsxs)(c.Z,{className:"vb-chart-options-config",children:[!e&&!ef&&eb.length>1&&(0,l.jsx)(N,{callback:e=>d({depth:e.value},en),items:eb.map(e=>({title:e,value:e})),selected:{title:u.depth,value:u.depth},title:"Depth"}),(0,l.jsx)(N,{items:eP.map(e=>({title:e,value:e})),selected:{title:S,value:S},title:"",callback:e=>d({selected:e.value},en)}),ey]})});return(0,l.jsxs)(l.Fragment,{children:[eC,(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(F.Z,{config:{...ed,...eg,...ex.all,...ex.treemap,sum:em,total:em,tooltipConfig:eh}})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:n}):n,(0,l.jsx)(e_,{isOpen:u.isOpenDrawer,callback:e=>d({isOpenDrawer:e}),groupBy:ed.groupBy,relatedItems:u.relatedItems,routeParams:a,selectedProducts:o})]})}if("stacked"===O&&k&&k.length){"Share"===u.stackLayout?ed.stackOffset="expand":ed.stackOffset="descending";let e=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:(0,l.jsxs)(c.Z,{className:"vb-chart-options-config",children:[(0,l.jsx)(N,{callback:e=>d({depth:e.value},en),items:eb.map(e=>({title:e,value:e})),selected:{value:u.depth},title:"Depth"}),(0,l.jsx)(N,{callback:e=>d({stackLayout:e.value}),items:["Value","Share"].map(e=>({title:e,value:e})),selected:{value:u.stackLayout},title:"Layout"}),ey]})});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(V.Z,{config:{...ed,...eg,...ex.all,...ex.stacked,colorScale:void 0,tooltipConfig:eh,total:void 0,timeline:!1,x:ec&&k[0]["Time ID"]?"Time ID":"Year",time:ec&&k[0]["Time ID"]?"Time ID":"Year",xConfig:{title:t?"":ec?_("Time"):_("Year")},y:em,yConfig:{tickFormat:e=>"Share"===u.stackLayout?"".concat((0,B.Z)(100*e),"%"):es(e),scale:"linear"}}})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:e}):e,(0,l.jsx)(e_,{isOpen:u.isOpenDrawer,callback:e=>d({isOpenDrawer:e}),groupBy:ed.groupBy,relatedItems:u.relatedItems,routeParams:a,selectedProducts:o})]})}if("network"===O&&k&&k.length>0&&"sitc"!==P){let e="ogi"===A?"Trade Value Opportunity Gain":"export"===A?"Trade Value RCA":"Trade Value Relatedness",a={shapeConfig:{Circle:{fill:e=>e["Trade Value RCA"]>1&&D().Section[e["Section ID"]]||"gray"},Path:{sort:(e,t)=>e.size-t.size,stroke:()=>"#585D6B"}},colorScaleConfig:{scale:"jenks"}};"export"!==A&&(a.colorScale=e,a.colorScaleConfig={scale:"linear",colorMin:"#0128E0",colorMid:"#96F7C6",colorMax:"#EEFF2F"},a.shapeConfig={fill:"D3PLUS-COMMON-RESET",Circle:{fill:"D3PLUS-COMMON-RESET"},Path:{sort:(e,t)=>e.size-t.size,stroke:()=>"#585D6B"}}),"relatedness"===A&&(a.colorScale=e,a.colorScaleConfig={scale:"linear",colorMin:"#0128E0",colorMid:"#96F7C6",colorMax:"#EEFF2F"},a.shapeConfig={fill:"D3PLUS-COMMON-RESET",Circle:{fill:"D3PLUS-COMMON-RESET"},Path:{sort:(e,t)=>e.size-t.size,stroke:()=>"#585D6B"}});let n=window.innerWidth<768?.5:1,o=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:ey});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(U.Z,{config:{...ed,...a,nodes:"/network/network_hs4.json",links:"/network/network_hs4.json",groupBy:["Section ID","HS4 ID"],size:e=>1*e["Trade Value"]||1,sizeMin:2*n,sizeMax:10*n,legendTooltip:{tbody:[]},colorScaleConfig:{colorMin:"#0128E0",colorMid:"#96F7C6",colorMax:"#EEFF2F"},total:void 0,tooltipConfig:{tbody:e=>"ogi"!==A?[[_("Trade Value"),"$".concat((0,B.Z)(e["Trade Value"]))],[_("Relatedness"),(0,B.Z)(e["Trade Value Relatedness"])],[_("RCA"),(0,B.Z)(e["Trade Value RCA"])],[_("Year"),Y]]:[[_("Trade Value"),"$".concat((0,B.Z)(e["Trade Value"]))],[_("Opportunity Gain"),(0,B.Z)(e["Trade Value Opportunity Gain"])],[_("Year"),Y]]}},nodesFormat:e=>e.nodes,linksFormat:e=>e.edges,dataFormat:e=>e.map(e=>Object.assign(e,{id:e["HS4 ID"]}))})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:o}):o]})}if("network"===O&&k&&k.length>0&&"sitc"===P){let e={shapeConfig:{Circle:{fill:e=>e["Trade Value RCA"]>1&&D().Category[e["Category ID"]]||"gray"},Path:{sort:(e,t)=>e.size-t.size},Line:{strokeWidth:.1}},colorScaleConfig:{scale:"jenks"}};"export"!==A&&(e.colorScale="ogi"===A?"Trade Value Opportunity Gain":"export"===A?"Trade Value RCA":"Trade Value Relatedness",e.shapeConfig={fill:"D3PLUS-COMMON-RESET",Circle:{fill:"D3PLUS-COMMON-RESET"},Path:{sort:(e,t)=>e.size-t.size,stroke:()=>"#585D6B"}});let a=window.innerWidth<768?.5:1,n=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:ey});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(U.Z,{config:{...ed,...e,nodes:"/network/net
1work_sitc.json",links:"/network/network_sitc.json",linkSize:1,groupBy:["Category ID","Subgroup ID"],size:e=>1*e["Trade Value"]||1,sizeMin:2*a,sizeMax:10*a,legendTooltip:{tbody:[]},tooltipConfig:{tbody:e=>"ogi"!==A?[[_("Trade Value"),"$".concat((0,B.Z)(e["Trade Value"]))],[_("Relatedness"),(0,B.Z)(e["Trade Value Relatedness"])],[_("RCA"),(0,B.Z)(e["Trade Value RCA"])],[_("Year"),Y]]:[[_("Trade Value"),"$".concat((0,B.Z)(e["Trade Value"]))],[_("Opportunity Gain"),(0,B.Z)(e["Trade Value Opportunity Gain"])],[_("Year"),Y]]},total:void 0},nodesFormat:e=>e.nodes,linksFormat:e=>e.edges,dataFormat:e=>e.map(e=>Object.assign(e,{id:e["Subgroup ID"]}))})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:n}):n]})}if("rings"===O&&k&&k.length>0){let e=Z.split(".")[0];if(![5,6].includes(e.length)){let t=(o.find(t=>t.id===1*e)||{}).name;return(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)("div",{className:"vb-chart-no-data",children:(0,l.jsx)("h3",{className:"title",children:_('No connections available for "'.concat(t,",").concat(e,'".'))})})})}let a=L.productItems,n=k.reduce((e,t)=>(e[t.id]||(e[t.id]=t),e),{}),i=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:ey});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(W.Z,{config:{data:k.filter(e=>e["Trade Value"]),center:e,label:e=>
1a[e.id]?a[e.id].name:"",legend:!1,links:k,total:void 0,tooltip:e=>!!e["Trade Value"],tooltipConfig:{title:e=>{let t=e.id.slice(0,-4),n=D().Section[t]||"gray",l=a[e.id]?a[e.id].name:"";return(0,er.tooltipTitle)(n,"/images/icons/hs/hs_".concat(t,".svg"),l||"")},tbody:e=>{let t=n[e.id],a=[];return t&&(a.push([_("HS4 ID"),t["HS4 ID"].toString().slice(-4)]),a.push([_("Relatedness"),(0,B.Z)(t["Trade Value Relatedness"])]),a.push([_("RCA"),(0,B.Z)(t["Trade Value RCA"])]),a.push([_("Exports Value"),"$".concat((0,B.Z)(t["Trade Value"]))])),a}},shapeConfig:{Circle:{fill:e=>e.id&&e["Trade Value"]&&D().Section[e.id.slice(0,-4)]||"gray"}}}})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:i}):i]})}if("geomap"===O&&k&&!C){let e=ec?ec.geoLevels.indexOf(u.subnatGeoDepth):-1,n=ec&&!eo?ec.topojson[-1===e?ec.topojson.length-1:e]:"/topojson/world-50m.json",i=ec&&!eo?"".concat(u.subnatGeoDepth," ID"):"ISO 3",s=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:(0,l.jsxs)("div",{className:"vb-chart-options-config",children:[ec&&ec.geoLevels.length>1&&(0,l.jsx)(N,{items:ec.geoLevels,selected:u.subnatGeoDepth,title:"Depth",callback:e=>d({subnatGeoDepth:e},en)}),ey]})});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)($.Z,{forceUpdate:!0,config:{...ed,...eg,colorScale:em,colorScaleConfig:{axisConfig:{tickFormat:e=>es(e)},color:u.selected.includes("Growth")?eD:eL,scale:ec?"quantile":"log"},shapeConfig:{Path:{fill:"D3PLUS-COMMON-RESET"}},groupBy:i,legend:!1,ocean:!1,tiles:!1,tooltipConfig:eh,topojson:n,topojsonId:ec&&!eo?e=>e.properties.id:"id",topojsonKey:ec&&!eo?"objects":"id",total:!1}})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:s}):s,(0,l.jsx)(e_,{isOpen:u.isOpenDrawer,callback:e=>d({isOpenDrawer:e}),groupBy:i,relatedItems:u.relatedItems,routeParams:a,selectedProducts:o})]})}if("line"===O&&k&&k.length>0){let{geoLevels:e,productLevels:n}=i.cubeSelected,s="all"===Z||Z.split(".").every(isFinite),r=["Trade Flow ID"];if("show"!==A){r=s?["Continent","Country"]:ec?[n[0]]:["Section"];let t=e=>["all","show"].includes(e);t(R)&&t(G)&&ec&&(r=[e[e.length-1]])}let p=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:(0,l.jsxs)(c.Z,{position:"center",className:"vb-chart-options-config",children:[(0,l.jsx)(N,{items:["Log","Linear"].map(e=>({title:e,value:e})),selected:{value:u.scale},title:"Scale",callback:e=>d({scale:e.value})}),ey]})});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(K.Z,{config:{...ed,...eg,...ex.all,...ex.line,colorScale:void 0,discrete:"x",groupBy:r,time:ec?"Time ID":"Year",timeline:!1,tooltipConfig:eh,total:void 0,x:ec?"Time ID":"Year",y:em,yConfig:{scale:u.scale.toLowerCase(),tickFormat:e=>es(e)}}})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:p}):p,(0,l.jsx)(e_,{isOpen:u.isOpenDrawer,callback:e=>d({isOpenDrawer:e}),groupBy:r,relatedItems:u.relatedItems,routeParams:a,selectedProducts:o})]})}if("scatter"===O){let{xConfig:e,yConfig:n}=i.axisConfig,s=e.title||"",r=n.title||"",p=e.selected.toLowerCase(),m=n.selected.toLowerCase(),g=[...new Set(k.map(e=>e[R]))],h=(0,l.jsx)(c.Z,{position:"center",className:"vb-chart-options",children:ey});return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"vb-chart",children:(0,l.jsx)(Q.Z,{config:{...eg,data:k,groupBy:["Continent","Country"],legend:!1,x:A,y:R,size:"Trade Value",sizeMin:5,sizeMax:40,shapeConfig:{Circle:{backgroundImage:e=>"/images/icons/country/country_".concat(e["Country ID"].slice(2,5),"_circle.png"),label:""}},tooltipConfig:{tbody:e=>[["Country ID",e["Country ID"].slice(-3).toUpperCase()],["Trade Value","$".concat((0,B.Z)(e["Trade Value"]))],[r,(0,B.Z)(e[R])],[s,(0,B.Z)(e[A])],["Year",e.Year]],tooltipFooterConfig:eh},total:void 0,xConfig:{scale:p,title:s},yConfig:{scale:m,domain:[.8*Math.min(...g),1.2*Math.max(...g)],title:r}}})}),t?(0,l.jsx)(ev,{callback:e=>d({isOpenMoreDetails:e}),isOpen:u.isOpenMoreDetails,children:h}):h,(0,l.jsx)(e_,{isOpen:u.isOpenDrawer,callback:e=>d({isOpenDrawer:e}),groupBy:["Continent","Country"],relatedItems:u.relatedItems,routeParam
1s:a,selectedProducts:o})]})}}let eY=["ago","ben","bfa","civ","cmr","cod","cog","dza","egy","eth","gab","gha","gin","gnq","ken","lbr","lby","mar","mdg","mli","moz","mrt","mus","mwi","ner","nga","sdn","sen","sle","ssd","tcd","tgo","tun","tza","uga","zaf","zmb","zwe","afg","are","arm","aze","bgd","bhr","chn","cyp","geo","hkg","idn","ind","irn","irq","isr","jor","jpn","kaz","kgz","khm","kor","kwt","lao","lbn","lka","mmr","mng","mys","omn","pak","phl","prk","qat","sau","sgp","syr","tha","tkm","tur","uzb","vnm","twn","yem","alb","aut","bgr","bih","blr","che","cze","deu","dnk","esp","est","fin","fra","gbr","grc","hrv","hun","irl","ita","ltu","lva","mda","mkd","nld","nor","pol","prt","rou","rus","srb","svk","svn","swe","ukr","can","cri","cub","dom","gtm","hnd","hti","jam","mex","nic","pan","slv","tto","usa","aus","nzl","png","arg","bol","bra","chl","col","ecu","per","pry","ury","ven"],eM=["52709","178703","52710","168542","168471","178708","63004","52711","168525","147108","168473","168517","178802","178704","147102","168411","168544","52701","168479","189018","168541","168536","63002","178901","168528","168504","52601","209403","178803","168481","168529","74011","62933","168443","168414","73901","209401","168409","73926","116204","147113","189013","168431","168413","157403","126403","116110","157208","157601","168421"],ez=[{value:"export",title:"Exports"},{value:"import",title:"Imports"}],eB=e=>"/".concat(e.join("/"),"/"),eH=e=>{let[t,a,n,l,o,i,s,r,c]=e.split("/").filter(e=>""!==e);return{lang:t,link:a,chart:n,cube:l,flow:o,country:i,partner:s,viztype:r,time:c}},eF=e=>e&&e.length,eV=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"id";return e.map(e=>e?e[t]:"").join(".")},eU=(e,t)=>e.length?Object.values(e.reduce((e,a)=>{for(let n of t){let t=a["".concat(n," ID")].toString();if(!e[t]){let l={id:t,name:a[n],type:n};e[t]=l}}return e},{})):[],{datasets:eW}=T(),e$=(e,t)=>{let{permalinkCube:a,_selectedItemsCountryTitle:n,_selectedItemsPartnerTitle:l,_selectedItemsProductTitle:o,_dataset:i,_flow:s,_xAxis:r,_yAxis:c,_startYearTitle:u,_endYearTitle:d,_selectedItemsYearTitle:p,selectedSubnatGeo:m,selectedSubnatProduct:g}=e,{chart:h,country:b,partner:f}=t,v=a||t.cube,_=new RegExp(/^(?!all).*$/).test(b),x=new RegExp(/^(?!(all|show)).*$/).test(f),y=new RegExp(/(stacked|line)/).test(h),C=!_&&!x,S=(0,X.getRandom)(eY),w=(0,X.getRandom)(eY);for(;S===w;)w=(0,X.getRandom)(eY);let j=eF(n)?eV(n,"label"):C?"all":S,I=eF(l)?eV(l,"label"):C&&!eF(n)?"all":w,k=eF(o)?eV(o):(0,X.getRandom)(eM),D=i.value||i.id,L=s.value,E=D.includes("subnational")||v.includes("subnational")?e.selectedSubnatTimeTemp.map(e=>e.value).sort((e,t)=>e>t?1:-1):p.map(e=>e.value).sort((e,t)=>e>t?1:-1),O=E.join(".");y&&(O=E[E.length-1]);let P=r.value,A=c.value,R=u&&void 0!==u.value?"".concat(u.value,".").concat(d.value):" ";if(v.includes("subnational")){let{subnatGeoItems:t,subnatProductItems:a,selectedSubnatTimeTemp:n,startTime:o,endTime:i}=e,{productLevels:s}=T().cubeSelector.find(e=>e.value===v),r=(0,X.getRandom)(t.map(e=>e.id)),c=(0,X.getRandom)(eU(a,s).map(e=>e.id));j=v.slice(-3)===b?b:eF(m)?eV(m,"id"):r,D=v,O=n.map(e=>e.value).sort((e,t)=>e>t?1:-1).slice(-1),R=o&&o.value?"".concat(o.value,".").concat(i.value):R,k=eF(g)?eV(g,"id"):c,eF(l)&&(I=w||"deu")}return Object.assign({cube:D,country:j,partner:I,flow:L,viztype:k,time:O,timePlot:R},{scatterFlow:P,scatterCountry:A,scatterPartner:"all",scatterViztype:"all"})};function eK(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"svg",l=t[0];return e.reduce((e,o)=>(t.forEach(t=>{let i=o["".concat(t," ID")];if(!(i in e)){let s=o["".concat(l," ID")];e[i]={color:D()[l][s],icon:"".concat(a).concat(s,".").concat(n),id:i,name:o[t],type:t}}}),e),{})}var eQ=a(41787);let eq="".concat("https://api-v2.oec.world/","tesseract/data.jsonrecords"),eJ=C()(()=>a.e(5718).then(a.bind(a,35718)),{loadableGenerated:{webpack:()=>[35718]},loading:()=>(0,l.jsx)(o.a,{}),ssr:!1});function eX(e){let{vbHelmet:t,vbParams:a,vbTitle:n,vbChartComponent:o,showTitle:r}=e,c=(0,b.useRef)(null);return(0,l.jsxs)("div",{className:"vb-embed",children:[t,(0,l.jsxs)(i.k,{px:0,direction:"column",h:"100vh",w:"100vw",align:"center",sx:{overflow:"hidden"},children:[(0,l.jsx)(s.x,{ref:c,children:r?(0,l.jsx)(Y,{params:a,title:n}):null}),(0,l.jsx)(s.x,{h:c.current?"calc(100vh - 28px - ".concat(c.current.offsetHeight,"px)"):"100vh",w:"100%",children:o})]})]})}let e0=(e,t)=>e.length?Object.values(e.reduce((e,a)=>{for(let n of t){let t=a["".concat(n," ID")].toString();if(!e[t]){let l={id:t,name:a[n],type:n};e[t]=l}}return e},{})):[],e1=(e,t,a)=>{let n=e.filter(e=>t.split(".").includes(e.id||e.value));return{[a]:n,["".concat(a,"Temp")]:n}},e2=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id",n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=e.filter(e=>t.split(".").includes(e[a]));return n?l.length>0?l:n&&e[0]?[e[0]]:[]:l},e3={4:"Year",5:"Quarter",6:"Month"};function e4(e){let{query:t,isEmbed:a}=e,{t:n}=(0,v.$G)("viz-builder"),y=(0,f.useRouter)(),[C,I,k,P,R,Z,M]=y.query.slug,z={chart:C,cube:I,flow:k,country:P,partner:R,viztype:Z,time:M},B=eE(),[H,F]=function(e,t,a){for(var n=arguments.length,l=Array(n>3?n-3:0),o=3;o<n;o++)l[o-3]=arguments[o];let[i,s]=J(()=>{let{cube:n,country:l}=t,{title:o}=a,i=e.find(e=>e.value===n)||T()[n]||e[0];return{activeTab:t?t.chart:"tree_map",product:[],productLevel:i.productLevel||i.productLevels[i.productLevels.length-1],technology:[],permalink:void 0,permalinkCube:void 0,cubeSelected:i,loading:!0,_dataset:i,_flow:ez[0],_partner:void 0,_endYear:{title:j.BACI_LAST_YEAR,value:j.BACI_LAST_YEAR},_endYearTitle:{title:j.BACI_LAST_YEAR,value:j.BACI_LAST_YEAR},_startYear:{title:2013,value:2013},_startYearTitle:{title:2013,value:2013},scrolled:!1,_selectedItemsProduct:[],_selectedItemsCountry:[],_selectedItemsPartner:[],_selectedItemsTechnology:[],_selectedItemsYear:[],_selectedItemsProductTitle:[],_selectedItemsCountryTitle:[],_selectedItemsPartnerTitle:[],_selectedItemsTechnologyTitle:[],_selectedItemsYearTitle:[],startTime:{},endTime:{},startTimeTemp:{},endTimeTemp:{},_yAxis:{},_xAxis:{},subnatItem:{},subnatCubeSelected:T()[n]||T().cubeSelector.find(e=>e.id===l)||T().cubeSelector[0],subnatGeography:[],subnatGeoItems:[],subnatProductItems:[],subnatProduct:[],subnatTime:[],subnatTimeLevels:[],subnatTimeLevelSelected:"",subnatTimeItems:[],subnatGeoLevels:[],subnatProductLevels:[],selectedSubnatGeoTemp:[],selectedSubnatGeo:[],selectedSubnatProductTemp:[],selectedSubnatProduct:[],selectedSubnatTimeTemp:[],selectedSubnatTime:[],showTitle:!o||(0,h.Z)(o)}},...l);return[i,s]}(eW,z,t),{store:V,updateCubeSelectedTemp:U,updateAxisConfig:W,updateTitle:$,updateCubeSelected:K}=(0,ep.V)(),{vbTitle:Q,vbParams:q}=V.title,[X,{loading:ee}]=(0,w.a)(),et=(0,b.useRef)({...e,userLoading:ee,params:z}),ea=(0,b.useRef)(H),en=(0,b.useRef)(V),el=X&&X.role>=2,eo=new RegExp(/^(?!(all|show)).*$/).test(P),ei=new RegExp(/^(?!(all|show)).*$/).test(R),es=Number.isFinite(parseInt(Z.split(".")[0],10)),er=["geomap"].includes(C),ec=["scatter"].includes(C),eu=["network"].includes(C),em=["line","stacked"].includes(C),eg=I.includes("subnational"),eh=!eo&&!ei||"wld"===P,eb="show"===k,{activeTab:ef,cubeSelected:ev,showTitle:e_}=H;function ex(e){let{chart:t,time:a}=z,n=e.includes("subnational"),l=n?T()[e]:H._dataset,o=n?H.subnatTimeItems:l.timeItems,i=V.cubeSelected.name;n&&i!==l.cube?K({currency:l.currency,d3plusConfig:l.d3plusConfig||{},geoItems:H.subnatGeoItems,geoLevels:l.geoLevels,measure:l.measure,name:l.cube,productItems:H.subnatProductItems,productLevels:l.productLevels,port:l.port,title:l.name,timeLevels:l.timeLevels,timeItems:o}):n||i===l.cubeName||K({name:l.cubeName,title:l.title,measure:l.measure,geoLevels:l.geoLevels,productItems:H.productKeys,productLevels:l.productLevels,timeLevels:l.timeLevels,timeItems:o,geoItems:V.countryMembers});let s=["line","stacked"].includes(t),r=[].concat(o).reverse().filter(e=>a.split(".").includes(e.value.toString())),c=s?r[0]:n?o[3]||{}:H._startYear,u=s&&r[1]?r[1]:n?o[0]||{}:H._endYear;F({loading:!1,_endYear:u,_startYear:c,_endYearTitle:u,_startYearTitle:c,startTime:c,startTimeTemp:c,endTime:u,endTimeTemp:u})}function ey(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0,l=t?e.technology:H.technology,o=t&&void 0!==e.productKeys?e.productKeys:H.productKeys,{countryMembers:i,wdiIndicators:s}={...V,...n},{country:r,chart:c,cube:u,flow:d,partner:p,time:m,viztype:g}=z;e&&e.permalink&&([c,u,d,r,p,g,m]=e.permalink.match(/visualize-legacy\/(.*)/)[1].split("/"));let h=["line","stacked"].includes(c),b=u.includes("subnational"),f=s.find(e=>e.value===d)||s.find(e=>"OEC.ECI"===e.value),v=s.find(e=>e.value===r)||s.find(e=>"NY.GDP.PCAP.CD"===e.value);W({xConfig:Object.assign(f,{selected:H._xAxis.scale||"Linear"})}),W({yConfig:Object.assign(v,{selected:H._yAxis.scale||"Log"})});let _=e=>i.filter(t=>e.split(".").includes(t.label)),x=_(r);a&&(x=H._selectedItemsCountry);let y=H._dataset.timeItems||V.cubeSelected.timeItems,C=y.filter(e=>m.split(".").includes(e.value.toString())),S={Country:x.length?x:eF(H.selectedSubnatGeoTemp)||b?i.filter(e=>e.label===H.subnatCubeSelected.id):[],Partner:_(p),Product:Number.isFinite(parseInt(g.split(".")[0],10))?g.split(".").map(e=>o[e]):[],Technology:["cpc"].includes(u)?l.filter(e=>g.split(".").includes(e.value)):[],Year:C.length?C:[y[0]]},w=b?H.subnatTimeItems:y,j=[].concat(w).reverse().filter(e=>m.split(".").includes(e.value.toString())),I=h&&j[0]?j[0]:b?w[0]||{}:H._startYear,k=h&&j[1]?j[1]:b?w[3]||{}:H._endYear;["export","import"].includes(d)&&(e._flow=ez.find(e=>e.value===d));let D={Geo:e2(H.subnatGeoItems,r),Product:Number.isFinite(parseInt(g.split(".")[0],10))?[o[g]]:[],Time:e2(H.subnatTimeItems,m,"value",!0)};if(t){let t=e.subnatGeoItems||H.subnatGeoItems,a=e.subnatTimeItems||H.subnatTimeItems;D={Geo:e2(t,r),Product:Number.isFinite(parseInt(g.split(".")[0],10))?[o[g]]:[],Time:e2(a,m,"value",!0)}}let L=["Geo","Product","Time"].reduce((e,t)=>
1{let a="selectedSubnat".concat(t);if(!e[a]){let n=D[t];e[a]=n,e["".concat(a,"Temp")]=n}return e},{}),E=Object.keys(S).reduce((e,t)=>{let a="_selectedItems".concat(t);if(!e[a]){let n=S[t];e[a]=n,n.length>0&&(e["".concat(a,"Title")]=n)}return e},{});if(e&&e.permalinkCube&&u.includes("subnational")&&(null==e?void 0:e.permalinkCube.includes("subnational"))&&(k=e.selectedSubnatTimeTemp[0],I=e.selectedSubnatTimeTemp[1],u=e.permalinkCube),e&&e.cubeSelected){let t=T().cubeSelector.find(t=>t.cube===e.cubeSelected.cube);t&&u.includes("subnational")&&t.value.includes("subnational")&&(k={},I={},u=e.permalinkCube)}F({...e,...E,...L,_xAxis:f,_yAxis:v,_endYear:k,_startYear:I,_endYearTitle:k,_startYearTitle:I,startTime:I,startTimeTemp:I,endTime:k,endTimeTemp:k,permalinkCube:u,subnatTimeLevelSelected:e3[m.split(".")[0].length]})}let eC=(e,t)=>{F({[e]:t,["".concat(e,"Id")]:t.value||t.id})},eS=async function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];if(a){ew(ea,!0);return}let o=T().cubeSelector.find(t=>t.cube===e),{geoLevels:i,productLevels:s,timeLevels:r}=o,{country:c,chart:u,time:d,viztype:p}=z,m="wildcard"===n[0],h="wildcard"===n[0],b=n[0]||c,f=n[1]||d,v=n[2]||p,_={cube:H._dataset.cube||e,measures:"Trade Value",parents:!0},x=(0,L.$F)({..._,drilldowns:i[i.length-1]}),y=await g.Z.get("".concat(eq,"?").concat(x),{headers:{authorization:"Bearer ".concat(B)}}).then(e=>e.data).catch(()=>({data:[]})),C=(0,L.$F)({..._,drilldowns:s[s.length-1]}),S=await g.Z.get("".concat(eq,"?").concat(C),{headers:{authorization:"Bearer ".concat(B)}}).then(e=>e.data).catch(()=>({data:[]})),w=(0,L.$F)({..._,drilldowns:r[r.length-1]}),j=(await g.Z.get("".concat(eq,"?").concat(w),{headers:{authorization:"Bearer ".concat(B)}}).then(e=>e.data).catch(()=>({data:[]}))).data.map(e=>{let t=e.Year;return{"Year ID":t,Year:t,"Quarter ID":10*t+e["Quarter ID"],Quarter:"".concat(t," ").concat(e.Quarter),"Month ID":100*t+e["Month ID"],Month:"".concat(t," ").concat(e.Month)}}),I=e0(y.data,i),k=S.data,D=e0(S.data,s),E=e0(j,r),O=m?[]:e1(I,b,"selectedSubnatGeo"),P=e1(D,v,"selectedSubnatProduct"),A=E.map(e=>({value:e.id,title:e.name,type:e.type})).sort((e,t)=>t.value-e.value),R="wildcard"===f?[A[0]]:A.filter(e=>f.split(".").includes(e.value.toString())),G=window.location.toString();window.location.href.indexOf("undefined.")>-1||window.location.href.indexOf(".undefined")>-1||"false"===d&&["line","stacked"].includes(u)?window.location=G.replace("/".concat(d,"/"),"/".concat(A[1].value,".").concat(A[0].value,"/")):(window.location.href.indexOf("undefined.")>-1||window.location.href.indexOf(".undefined")>-1||" "===d&&["line","stacked"].includes(u))&&(window.location=G.replace("/%20/","/".concat(A[1].value,".").concat(A[0].value,"/")));let N={permalinkCube:o.value,subnatItem:o,subnatGeography:y.data,subnatGeoItems:I,subnatTimeItems:A,subnatGeoLevels:i,subnatProductLevels:s,subnatTimeLevels:r,subnatProductItems:k,selectedSubnatTimeTemp:R,...O,...P};m&&(N.selectedSubnatGeo=H.selectedSubnatGeo),ew(N,!0,h)};function ew(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{productLevel:n,_dataset:l}=H,o=l.cubeName||l.cube,{countryMembers:i,wdiIndicators:s}=V,r="rings"===C?"HS4":n;g.Z.all([g.Z.get("".concat(eq,"?cube=").concat(o,"&drilldowns=").concat(r,"&measures=Trade+Value&parents=true&sparse=false"),{headers:{authorization:"Bearer ".concat(B)}})]).then(g.Z.spread(function(){for(var n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];let c=o[0].data.data,{productLevels:u}=l,d=eK(c,u,"sitc"===I?"/images/icons/sitc/sitc_":"/images/icons/hs/hs_","sitc"===I?"png":"svg");ey({...e,product:c,productKeys:d,technology:[],cacheIsLoaded:!0},t,a,{countryMembers:i,wdiIndicators:s})}))}let ej=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:H._dataset.cube,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H.productLevel,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["Section","HS2","HS4","HS6"];if(a)return;let{cube:l,viztype:o}=z,i=(0,L.$F)({cube:e,drilldowns:t,measures:"Trade Value",parents:!0,sparse:!1}),s=(await g.Z.get("".concat(eq,"?").concat(i),{headers:{authorization:"Bearer ".concat(B)}}).then(e=>e.data)).data,r=eK(s,n,"sitc"===l?"/images/icons/sitc/sitc_":"/images/icons/hs/hs_","sitc"===l?"png":"svg"),c=isFinite(o.split(".")[0])?o.split(".").map(e=>r[e]):[];K({...V.cubeSelected,productItems:r}),F({product:s,productKeys:r,_selectedItemsProduct:c,_selectedItemsProductTitle:c})};(0,b.useEffect)(()=>{let e=X&&X.role>=2,{country:t,cube:a,viztype:n,time:l}=z,o=t.split(".").filter(e=>T().cubeSelector.find(t=>
1t.id===e));a.includes("subnational")&&e?eS(H.subnatCubeSelected.cube):1===o.length?eS(T().cubeSelector.find(e=>e.id===o[0]).cube,t,l,n):window.location.href.indexOf("subnational")>-1?eS(H.subnatCubeSelected.cube):ew({},!0)},[]),(0,b.useEffect)(()=>{var t;if(!ee&&et.current.userLoading!==ee&&H.cacheIsLoaded||!ee&&ea.current.cacheIsLoaded!==H.cacheIsLoaded&&H.cacheIsLoaded){ex(I);let e=P.split(".").filter(e=>T().cubeSelector.find(t=>t.id===e)),t=X&&X.role>=2;I.includes("subnational")&&t?eS(H.subnatCubeSelected.cube):1===e.length?eS(T().cubeSelector.find(t=>t.id===e[0]).cube,P,M,Z):H.cacheIsLoaded||ew({},!0);let{cubeName:a,productLevel:n,productLevels:l}=H.cubeSelected;ej(a,n||l[l.length-1]||"HS6",l)}if(H.cubeSelected.cubeName!==ea.current.cubeSelected.cubeName){let{cubeName:e,productLevel:t,productLevels:a}=H.cubeSelected;ej(e,t||a[a.length-1]||"HS6",a)}et.current.params.cube!==z.cube&&F({permalinkCube:z.cube},()=>ex(H.permalinkCube)),H.permalinkCube&&(H.permalinkCube!==ea.current.permalinkCube&&!(null==H?void 0:null===(t=H.permalinkCube)||void 0===t?void 0:t.includes("subnational"))||H.subnatGeoItems.length!==ea.current.subnatGeoItems.length&&H.permalinkCube.includes("subnational"))&&ex(H.permalinkCube),ea.current=H,et.current={...e,userLoading:ee,params:z},en.current=V});let eI=el&&(T().cubeSelector.some(e=>P.split(".").includes(e.id))||T().cubeSelector.some(e=>H._selectedItemsCountry.map(e=>e.label).includes(e.id))||eg),eT=es&&!ec,ek=eo&&!ec||eg,eD=ek&&!eT&&!eu,eL=H.subnatTimeItems.filter(e=>e.type===H.subnatTimeLevelSelected),{timeItems:eO}=ev,eP=eg?eL:eO,eA=eP.findIndex(e=>1*e.value==1*M.split(".")[0]),eR=em?void 0:eP[eA+1],eG=em?void 0:eP[eA-1],eN=T()[I]||{},{productLevels:eY}=eN,eM=eF(H.selectedSubnatGeoTemp),eU=T()[I],e4=I.slice(-3)===P,e6=T()["subnational_".concat(P)]||T()[I]||{},e7=H._dataset.value.includes("subnational"),e5=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];F({loading:!0,...e});let{chart:a,cube:n,flow:l,country:o,partner:i,viztype:s}=z,{_dataset:r,_endYear:c,_flow:u,_selectedItemsCountry:d,_selectedItemsPartner:p,_selectedItemsProduct:m,_selectedItemsYear:g,_startYear:h,_xAxis:b,_yAxis:f}={...H,...e},v=r.value||r.id,_=eF(d)?eV(d,"label"):["show","all"].includes(o)?o:"all",x=eF(p)?eV(p,"label"):["show","all"].includes(i)?i:"all",C=eF(m)?eV(m):s,S="show"===l?l:u.value;"scatter"===a&&(S=b.value,_=f.value,x="all",C="all");let w=["line","stacked"].includes(a),j=w?v.includes("subnational")?"".concat(H.startTimeTemp.value,".").concat(H.endTimeTemp.value):"".concat(h.value,".").concat(c.value):v.includes("subnational")?eV(H.selectedSubnatTimeTemp,"value"):g.map(e=>e.value).sort((e,t)=>e>t?1:-1).join(".");if(eF(H.selectedSubnatGeoTemp)||n.includes("subnational")){let{selectedSubnatGeoTemp:e,selectedSubnatProductTemp:t,selectedSubnatTimeTemp:a,subnatCubeSelected:n}=H;v="subnational_".concat(n.id),_=eF(e)?eV(e,"id"):eF(t)?"show":r.id===_?o:"all",j=w?"".concat(H.startTimeTemp.value,".").concat(H.endTimeTemp.value):eV(a,"value"),eF(t)&&(C=eV(t,"id"))}let I=eB(t?["visualize-legacy",a,n,l,o,i,s,j]:["visualize-legacy",a,v,S,_,x,C,j]);y.push(I,void 0,{shallow:!0}).then(()=>ey({permalink:I,cubeSelected:r}))},e8=(e,t)=>{F(a=>{let n=a[e].filter(e=>e.type===t.type&&e.id!==t.id).concat(t);return{[e]:n}})};(0,b.useEffect)(()=>{var e,t,a,n;if(!(null===(e=H._selectedItemsCountryTitle)||void 0===e?void 0:e.length)&&!H.selectedSubnatGeo.length&&!(null===(t=H._selectedItemsPartnerTitle)||void 0===t?void 0:t.length)&&!H.selectedSubnatProduct.length&&!(null===(a=H.selectedItemsSubnatProductTitle)||void 0===a?void 0:a.length)&&!(null===(n=V.cubeSelected)||void 0===n?void 0:n.name))return;let{vbTitle:l,vbParams:o}=ed({geo:eU?e4?H._selectedItemsCountryTitle:H.selectedSubnatGeo:H._selectedItemsCountryTitle,geoPartner:H._selectedItemsPartnerTitle,product:eU?H.selectedSubnatProduct:H._selectedItemsProduct,isWorld:eh,datasetName:V.cubeSelected.title,isPort:eN.port},{x:V.axisConfig.xConfig,y:V.axisConfig.yConfig},z);$({vbTitle:l,vbParams:o})},[z,eU,e4,H._selectedItemsCountryTitle,H.selectedSubnatGeo,H._selectedItemsCountryTitle,H._selectedItemsPartnerTitle,H.selectedSubnatProduct,H._selectedItemProductTitle,H._selectedItemProduct,eh,V.cubeSelected.title,eN.port,V.axisConfig.xConfig,V.axisConfig.yConfig]),(0,b.useEffect)(()=>{a||"scatter"!==C||g.Z.all([g.Z.get("".concat(eq,"?cube=indicators_i_wdi_a&drilldowns=Year,Indicator&measures=Measure&include=Indicator:").concat(P))]).then(g.Z.spread(function(){for(var e,t=arguments.length,a=Array(t),n=0;n<t;n++)a[n]=arguments[n];let l=a[0].data.data,o=l.reduce((e,t)=>
1t.Year>e?t.Year:e,l[0].Year),i=[...[,,,,,].keys()].map(e=>String(o-e)).reverse().join(".");if(M>o){let e=[C,I,k,P,R,Z,i];y.push("/visualize-legacy/".concat(e.join("/")),void 0,{shallow:!0})}(null===(e=H._selectedItemsYear[0])||void 0===e?void 0:e.value)!==M&&F({_selectedItemsYear:i.split(".").map(e=>({value:parseInt(e,10),title:parseInt(e,10)}))})}))},[y.query.slug]);let e9=(0,l.jsx)(eZ,{isEmbed:a,permalink:H.permalink,routeParams:z,router:y,selectedProducts:eg?H.selectedSubnatProduct:H._selectedItemsProductTitle,callback:e=>{let t=eH(e),a={permalink:e,activeTab:t.chart||"tree_map"};F(a,()=>ey(a))}}),te=(e,t)=>{let a;let n=X&&X.role>=2,l={[e]:t},o=t.length?t[t.length-1].label:void 0;if("_selectedItemsCountry"===e&&o&&n&&T().cubeSelector.map(e=>e.id).includes(o)&&"network"!==C){let{isAuth:e}=V,t=T().cubeSelector.find(e=>o===e.id);l.subnatCubeSelected=t,l.selectedSubnatGeoTemp=[],e&&(l._dataset=t,l.subnatTimeLevelSelected=t.timeLevels.slice(-1)[0],l.productLevel=t.productLevels[t.productLevels.length-1])}else"_selectedItemsCountry"===e&&o&&n&&T().cubeSelector.find(e=>e.value===z.cube)&&T().cubeSelector.find(e=>e.value===z.cube).id!==o&&(l._dataset=eW[0],l._endYear={title:2018,value:2018},l._startYear={title:2013,value:2013},l._selectedItemsYear=[eW[0].timeItems[0]],l.productLevel=["Section","HS2","HS4","HS6"]);F(l,a)},tt=n(Q,Object.assign(q,{interpolation:{escapeValue:!1}})),ta=(0,l.jsx)(S.PB,{title:tt});return a?(0,l.jsx)(eX,{vbHelmet:ta,vbParams:q,vbTitle:Q,vbChartComponent:e9,showTitle:e_}):(0,l.jsxs)(l.Fragment,{children:[ta,(0,l.jsxs)(eQ.Z,{disablePaddingY:!0,sidebarContent:(0,l.jsxs)(s.x,{children:[(0,l.jsx)(eJ,{activeOption:y.asPath,activeTab:ef,permalinkIds:e$(H,z),callback:e=>{let{permalink:t}=e;t?(ey({permalink:t}),y.push(t,void 0,{shallow:!0})):F(e)},isSubnat:eg}),(0,l.jsxs)(r.K,{spacing:"xs",children:[eg&&eT&&(0,l.jsx)("div",{className:"columns",children:(0,l.jsx)("div",{className:"column-1",children:(0,l.jsxs)("div",{className:"selector select-multi-section-wrapper",children:[(0,l.jsx)("h4",{className:"title",children:n("Product")}),(0,l.jsx)(E.Z,{getColor:eN.productColor,getIcon:eN.productIcon,getLabel:T().productLabel,items:H.subnatProductItems,levels:eY,onItemSelect:e=>e8("selectedSubnatProductTemp",e),onItemRemove:(e,t)=>{F({selectedSubnatProductTemp:H.selectedSubnatProductTemp.filter(e=>e!==t)})},onClear:()=>{F({selectedSubnatProductTemp:[]})},selectedItems:H.selectedSubnatProductTemp})]})})}),!eg&&eT&&(0,l.jsx)("div",{className:"columns",children:(0,l.jsx)("div",{className:"column-1",children:(0,l.jsxs)("div",{className:"selector select-multi-section-wrapper",children:[(0,l.jsx)("h4",{className:"title",children:n("Product")}),(0,l.jsx)(E.Z,{getColor:"sitc"===I?e=>D().Category[e["Category ID"]]:e=>D().Section[e["Section ID"]],getIcon:"sitc"===I?e=>"/images/icons/sitc/sitc_".concat(e["Category ID"],".png"):e=>"/images/icons/hs/hs_".concat(e["Section ID"],".svg"),getLabel:T().productLabel,items:H.product,levels:"rings"===C?["HS4"]:H._dataset.productLevels,onItemSelect:e=>e8("_selectedItemsProduct",e),onItemRemove:e=>{F({_selectedItemsProduct:H._selectedItemsProduct.filter(t=>t!==e)})},onClear:()=>{F({_selectedItemsProduct:[]})},selectedItems:H._selectedItemsProduct})]})})}),(ek||eh)&&(0,l.jsx)("div",{className:"columns",children:(0,l.jsx)("div",{className:"column-1",children:(0,l.jsx)(O.Z,{items:V.countryMembers,itemType:"country",selectedItems:H._selectedItemsCountry,placeholder:n("Select a country..."),title:n("Country"),callback:e=>{te("_selectedItemsCountry",e)}})})}),eI&&e7&&"network"!==C?(0,l.jsx)("div",{className:"columns",children:(0,l.jsx)("div",{className:"column-1",children:(0,l.jsxs)("div",{className:"selector select-multi-section-wrapper",children:[(0,l.jsx)("h4",{className:"title",children:n("State/Province")}),H.subnatGeoLevels.length?(0,l.jsx)(E.Z,{getIcon:H.subnatItem.geoIcon,getLabel:T().productLabel,items:H.subnatGeography,levels:H.subnatGeoLevels||[],onItemSelect:e=>{let t={selectedSubnatGeoTemp:H.selectedSubnatGeoTemp.filter(t=>t.type===e.type&&t.id!==e.id).concat(e)};if(0===H.selectedSubnatGeoTemp.length){let e=H.subnatTimeLevels,a=H.subnatTimeItems;t.subnatTimeLevelSelected=e[e.length-1],t.selectedSubnatTimeTemp=[a[0]],t.endTimeTemp=a[0],t.startTimeTemp=a[3]}F(t)},onItemRemove:(e,t)=>
1{e.stopPropagation(),F({selectedSubnatGeoTemp:H.selectedSubnatGeoTemp.filter(e=>e!==t)})},onClear:()=>{F({selectedSubnatGeoTemp:[]})},placeholder:n("Select a state/province..."),selectedItems:H.selectedSubnatGeoTemp}):(0,l.jsx)(o.a,{size:30})]})})}):null,eD&&!er&&(0,l.jsx)("div",{className:"columns",children:(0,l.jsx)("div",{className:"column-1",children:(0,l.jsx)(O.Z,{items:V.countryMembers,itemType:"country",placeholder:n("Select a partner..."),selectedItems:H._selectedItemsPartner,title:n("Partner"),callback:e=>te("_selectedItemsPartner",e)})})}),ec&&(0,l.jsx)("div",{className:"column-1-2",children:(0,l.jsx)(G,{items:V.wdiIndicators,run:eC,scale:!0,selectedItem:H._xAxis,stateKey:"_xAxis",title:n("X Axis"),callbackButton:(e,t)=>{W({xConfig:{selected:t}}),F({[e]:{...H[e],selected:t}})}})}),ec&&(0,l.jsx)("div",{className:"column-1-2",children:(0,l.jsx)(G,{items:V.wdiIndicators,run:eC,scale:!0,selectedItem:H._yAxis,stateKey:"_yAxis",title:n("Y Axis"),callbackButton:(e,t)=>{W({yConfig:{selected:t}}),F({[e]:{...H[e],selected:t}})}})}),(0,l.jsxs)(c.Z,{grow:!0,noWrap:!0,children:[!ec&&!eM&&(0,l.jsx)(A,{items:eI&&X?[{...e6,title:e6.name}].concat(eW):eW,title:n("Dataset"),stateKey:"_dataset",selectedItem:H._dataset,callback:(e,t)=>{let a=t.value.includes("subnational")?H.subnatTimeItems:t.timeItems;if(eI)U({currency:t.currency,d3plusConfig:t.d3plusConfig||{},geoItems:H.subnatGeoItems,measure:t.measure,name:t.cube,geoLevels:t.geoLevels,port:t.port,productItems:H.subnatProductItems,productLevels:t.productLevels,timeLevels:t.timeLevels,timeItems:a}),F({subnatTimeLevelSelected:a[0].type,selectedSubnatTimeTemp:[a[0]],startTimeTemp:a[1],endTimeTemp:a[0]});else{let e={_selectedItemsYear:[a[0]],_startYear:a[1],_endYear:a[0]};H._selectedItemsYearTitle[0]||(e._selectedItemsYearTitle=[a[0]]),F(e),U({name:t.cubeName,measure:t.measure,geoLevels:t.geoLevels,productItems:H.product,productLevels:t.productLevels,timeLevels:t.timeLevels,timeItems:a,geoItems:V.countryMembers})}eC(e,t)}}),!ec&&!eb&&(0,l.jsx)(A,{items:ez,title:n("Trade Flow"),stateKey:"_flow",selectedItem:H._flow,callback:eC})]}),e7?(0,l.jsxs)("div",{className:"columns",children:[(0,l.jsx)("div",{className:"column-1",children:(0,l.jsxs)("div",{className:"selector select-multi-section-wrapper",children:[(0,l.jsx)("h4",{className:"title",children:n("Time Dimension")}),(0,l.jsx)(N,{items:H.subnatTimeLevels.map(e=>({title:e,value:e})),loading:0===H.subnatTimeLevels.length,selected:{value:H.subnatTimeLevelSelected},title:void 0,callback:e=>{let t=H.subnatTimeItems.filter(t=>t.type===e.value);F({subnatTimeLevelSelected:e.value,startTimeTemp:t[1],endTimeTemp:t[0],selectedSubnatTimeTemp:t[0]?[t[0]]:[]})},fullWidth:!0})]})}),!em&&(0,l.jsx)(O.Z,{items:eL,selectedItems:H.selectedSubnatTimeTemp,title:n(H.subnatTimeLevelSelected),valueAcc:"value",labelAcc:"title",callback:e=>{te("selectedSubnatTimeTemp",e)}})]}):null,!em&&!e7&&(0,l.jsx)("div",{className:"columns",children:(0,l.jsx)("div",{className:"column-1",children:(0,l.jsx)(O.Z,{items:V.cubeSelectedTemp.timeItems,selectedItems:H._selectedItemsYear,title:n("Year"),callback:e=>te("_selectedItemsYear",e),valueAcc:"value",labelAcc:"title"})})}),em&&!e7&&H._startYear&&H._endYear?(0,l.jsxs)(c.Z,{noWrap:!0,children:[(0,l.jsx)(A,{items:V.cubeSelectedTemp.timeItems,title:n("Start Year"),stateKey:"_startYear",selectedItem:H._startYear,callback:eC}),(0,l.jsx)(A,{items:V.cubeSelectedTemp.timeItems,title:n("End Year"),stateKey:"_endYear",selectedItem:H._endYear,callback:eC})]}):null,em&&e7&&H.startTimeTemp&&H.endTimeTemp?(0,l.jsxs)(c.Z,{noWrap:!0,children:[(0,l.jsx)(A,{items:eL,title:n("Start ".concat(H.subnatTimeLevelSelected)),stateKey:"startTimeTemp",selectedItem:H.startTimeTemp,callback:eC}),(0,l.jsx)(A,{items:eL,title:n("End ".concat(H.subnatTimeLevelSelected)),stateKey:"endTimeTemp",selectedItem:H.endTimeTemp,callback:eC})]}):null,(0,l.jsx)(u.z,{className:"button build click",onClick:e5,fw:700,tt:"uppercase",loading:eI&&"network"!==C&&!H.subnatGeoLevels.length,fullWidth:!0,children:n("Build Visualization")})]})]}),children:[" ",(0,l.jsxs)(s.x,{mt:"xl",sx:{flexGrow:1},px:"xs",children:[(0,l.jsxs)(i.k,{gap:"xl",py:"xs",justify:"center",align:"center",pos:"sticky",top:"var(--main-distance-top)",bg:"var(--oec-background)",sx:{zIndex:88},children:[(0,l.jsx)(s.x,{mr:"auto",sx:{visibility:eR?"visible":"hidden"},children:eR&&(0,l.jsx)(d.k,{onClick:()=>{let e={};eg?e.selectedSubnatTimeTemp=[eR]:e._selectedItemsYear=[eR],F(e,e=>e5(e,!0))},children:(0,l.jsxs)(p.M,{children:[(0,l.jsx)(_.Z,{}),(0,l.jsx)(m.x,{size:"xl",fw:500,span:!0,children:eR.title})]})})}),(0,l.jsx)(Y,{title:Q,params:q}),(0,l.jsx)(s.x,{ml:"auto",sx:{visibility:eG?"visible":"hidden"},children:eG&&(0,l.jsx)(d.k,{onClick:()=>{let e={};eg?e.selectedSubnatTimeTemp=[eG]:e._selectedItemsYear=[eG],F(e,e=>e5(e,!0))},ml:"auto",children:(0,l.jsxs)(p.M,{children:[(0,l.jsx)(m.x,{size:"xl",fw:500,span:!0,children:eG.title}),(0,l.jsx)(x.Z,{})]})})})]}
1),(0,l.jsx)(s.x,{sx:{".vb-chart":{minHeight:"70vh"}},my:"sm",pos:"relative",children:e9})]})]})]})}},72336:function(e,t,a){"use strict";a.d(t,{Z:function(){return d},V:function(){return u}});var n=a(85893),l=a(67294);let o={id:"",title:"",scale:"",selected:"Log"};function i(e){var t,a,n;let l={currency:void 0,measure:void 0,geoItems:[],geoLevels:[],name:"",port:!1,productItems:[],productLevels:[],timeItems:[],timeLevels:[],title:""};return{API:void 0,data:[],loading:!0,status:200,countryMembers:null!==(t=null==e?void 0:e.countryMembers)&&void 0!==t?t:[],wdiIndicators:null!==(a=null==e?void 0:e.wdiIndicators)&&void 0!==a?a:[],title:null!==(n=null==e?void 0:e.title)&&void 0!==n?n:void 0,cubeSelected:l,cubeSelectedTemp:l,axisConfig:{xConfig:o,yConfig:o}}}var s=a(33793);function r(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i(),a=arguments.length>1?arguments[1]:void 0;switch(a.type){case"VB_UPDATE_CUBE_SELECTED":return(e=t).cubeSelected=a.payload,e.cubeSelectedTemp=a.payload,e;case"VB_UPDATE_CUBE_SELECTED_TEMP":return(e=t).cubeSelectedTemp=a.payload,e;case"VB_UPDATE_AXIS_CONFIG":{let n={...(e=t).axisConfig};return e.axisConfig=(0,s.Z)(n,a.payload),e}case"VB_UPDATE_DATA":return(e=t).data=a.payload.data,e.loading=a.payload.loading,e.API=a.payload.API,e.cubeSelected=t.cubeSelectedTemp,e;case"VB_UPDATE_COUNTRY_MEMBERS":return(e=t).countryMembers=a.payload,e;case"VB_UPDATE_WDI":return(e=t).wdiIndicators=a.payload,e;case"VB_UPDATE_TITLE":return(e=t).title=a.payload,e;default:return t}}let c=(0,l.createContext)({store:i(),addCountryMembers:()=>void 0,addWdiIndicators:()=>void 0,updateAxisConfig:()=>void 0,updateCubeSelected:()=>void 0});function u(){return(0,l.useContext)(c)}function d(e){let{initialData:t,children:a}=e,[o,s]=(0,l.useReducer)(r,i(t));return(0,n.jsx)(c.Provider,{value:{store:o,addCountryMembers:e=>s({type:"VB_UPDATE_COUNTRY_MEMBERS",payload:e}),addWdiIndicators:e=>s({type:"VB_UPDATE_WDI",payload:e}),updateAxisConfig:e=>s({type:"VB_UPDATE_AXIS_CONFIG",payload:e}),updateData:e=>s({type:"VB_UPDATE_DATA",payload:e}),updateCubeSelected:e=>s({type:"VB_UPDATE_CUBE_SELECTED",payload:e}),updateCubeSelectedTemp:e=>s({type:"VB_UPDATE_CUBE_SELECTED_TEMP",payload:e}),updateTitle:e=>s({type:"VB_UPDATE_TITLE",payload:e})},children:a})}},74498:function(e,t,a){"use strict";let{range:n}=a(8134),l=a(62751),{tooltipTitle:o}=a(60321),{BACI_LAST_YEAR:i}=a(23386),s={measure:"Trade Value"},r={subnational_bra:{cube:"trade_s_bra_mun_m_hs",d3plusConfig:{all:{legendConfig:{label:e=>e.Region,shapeConfig:{backgroundImage:()=>null,labelConfig:{fontColor:()=>"#fff"}}},legendTooltip:{title:e=>o(l["Region BRA"][e["Region ID"]],null,e.Region)},tooltipConfig:{title:e=>Array.isArray(e["Subnat Geography"])?o("transparent","/images/icons/subnational/bra/flag_".concat(e["State ID"],".png"),"Other ".concat(e.State)):o("transparent","/images/icons/subnational/bra/flag_".concat(e["State ID"],".png"),e["Subnat Geography"])}},treemap:{shapeConfig:{fill:e=>l["Region BRA"][e["Region ID"]]||l.colorGrey}},stacked:{shapeConfig:{Area:{fill:e=>l["Region BRA"][e["Region ID"]]||l.colorGrey}}},line:{shapeConfig:{Line:{stroke:e=>l["Region BRA"][e["Region ID"]]||l.colorGrey}}}},geoIcon:e=>"/images/icons/subnational/bra/flag_".concat(e["State ID"],".png"),geoLevels:["Region","State","Subnat Geography"],id:"bra",name:"Brazil",productLevels:["Section","HS2","HS4"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_bra_municipalities.topojson"],value:"subnational_bra",...s},subnational_bol:{cube:"trade_s_bol_m_sitc3",d3plusConfig:{all:{tooltipConfig:{title:e=>o(null,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.sa}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.sa,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.sa}}}},geoLevels:["Subnat Geography"],id:"bol",name:"Bolivia",productLevels:["Section","Division","Group","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_bol_departments.topojson"],value:"subnational_bol",...s},subnational_can:{cube:"trade_s_can_m_hs",d3plusConfig:{all:{tooltipConfig:{title:e=>o("transparent","/images/icons/subnational/can/flag_".concat(e["Subnat Geography ID"],".png"),e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.na}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.na,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.na}}}},currency:"CAD ",geoIcon:e=>"/images/icons/subnational/can/flag_".concat(e["Subnat Geography ID"],".png"),geoLevels:["Subnat Geography"],id:"can",name:"Canada",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_can_provinces.topojson"],value:"subnational_can",...s},subnational_chl:{cube:"trade_s_chl_m_hs",d3plusConfig:{all:{tooltipConfig:{title:e=>o(null,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.sa}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.sa,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.sa}}}},geoLevels:["Region","Subnat Geography"],id:"chl",name:"Chile",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_chl_comunas.topojson"],value:"subnational_chl",...s},subnational_chn:{cube:"trade_s_chn_m_hs",d3plusConfig:{all:{tooltipConfig:{title:e=>o(null,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.as}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.as,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.as}}}},geoLevels:["Subnat Geography"],id:"chn",name:"China",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_chn_provinces.topojson"],value:"subnational_chn",...s},subnational_deu:{cube:"trade_s_deu_m_egw",d3plusConfig:{all:{tooltipConfig:{title:e=>o("transparent","/images/icons/subnational/deu/flag_".concat(e["Subnat Geography ID"],".png"),e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.eu}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.eu,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.eu}}}},currency:"â¬",geoIcon:e=>"/images/icons/subnational/deu/flag_".concat(e["Subnat Geography ID"],".png"),geoLevels:["Subnat Geography"],id:"deu",name:"Germany",productC
1olor:e=>l.EGW1[e["EGW1 ID"]],productIcon:e=>"/images/icons/egw/egw_".concat(e["EGW1 ID"],".svg"),productLevels:["EGW1","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_deu_regions.topojson"],value:"subnational_deu",...s},subnational_ecu:{cube:"trade_s_ecu_m_hs",d3plusConfig:{all:{tooltipConfig:{title:e=>o(null,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.sa}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.sa,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.sa}}}},geoLevels:["Subnat Geography"],id:"ecu",name:"Ecuador",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_ecu_ports.topojson"],value:"subnational_ecu",...s},subnational_esp:{cube:"trade_s_esp_m_hs",d3plusConfig:{all:{legendConfig:{label:e=>e["Autonomous Communities"],shapeConfig:{backgroundImage:e=>"/images/icons/subnational/esp/flag_".concat(e["Autonomous Communities ID"],".png"),fill:()=>"transparent",labelConfig:{fontColor:()=>"#fff"}}},legendTooltip:{title:e=>o("transparent","/images/icons/subnational/esp/flag_".concat(e["Autonomous Communities ID"],".png"),e["Autonomous Communities"])},tooltipConfig:{title:e=>Array.isArray(e["Subnat Geography"])?o("transparent","/images/icons/subnational/esp/flag_".concat(e["Autonomous Communities ID"],".png"),"Other ".concat(e["Autonomous Communities"])):o("transparent","/images/icons/subnational/esp/flag_".concat(e["Autonomous Communities ID"],".png"),e["Subnat Geography"])}},treemap:{shapeConfig:{fill:e=>l["Autonomous Communities"][e["Autonomous Communities ID"]]||l.colorGrey}},stacked:{shapeConfig:{Area:{fill:e=>l["Autonomous Communities"][e["Autonomous Communities ID"]]||l.colorGrey}}},line:{shapeConfig:{Line:{stroke:e=>l["Autonomous Communities"][e["Autonomous Communities ID"]]||l.colorGrey}}}},geoIcon:e=>"/images/icons/subnational/esp/flag_".concat(e["Autonomous Communities ID"],".png"),geoLevels:["Autonomous Communities","Subnat Geography"],id:"esp",name:"Spain",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_esp_autonomous.topojson","/shapes/subnational_esp_provinces.topojson"],value:"subnational_esp",...s},subnational_fra:{cube:"trade_s_fra_q_cpf",d3plusConfig:{all:{legendConfig:{label:e=>e.Region,shapeConfig:{backgroundImage:()=>null,labelConfig:{fontColor:()=>"#fff"}}},legendTooltip:{title:e=>o(l["Region FRA"][e["Region ID"]],null,e.Region)},tooltipConfig:{title:e=>o(l["Region FRA"][e["Region ID"]]||l.colorGrey,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:e=>l["Region FRA"][e["Region ID"]]||l.colorGrey}},stacked:{shapeConfig:{Area:{fill:e=>l["Region FRA"][e["Region ID"]]||l.colorGrey}}},line:{shapeConfig:{Line:{stroke:e=>l["Region FRA"][e["Region ID"]]||l.colorGrey}}}},currency:"â¬",geoLevels:["Region","Subnat Geography"],id:"fra",name:"France",productColor:e=>l["Level 1"][e["Level 1 ID"]],productLevels:["Level 1","Level 2","Level 3","Product"],timeLevels:["Year","Quarter"],topojson:["/shapes/subnational_fra_regions.topojson","/shapes/subnational_fra_departments.topojson"],value:"subnational_fra",...s},subnational_gbr:{cube:"trade_s_gbr_m_hs",d3plusConfig:{all:{tooltipConfig:{title:e=>o(null,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.eu}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.eu,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.eu}}}},currency:"\xa3",geoIcon:()=>"/images/icons/country/country_gbr.png",geoLevels:["Subnat Geography"],id:"gbr",name:"United Kingdom",port:!0,productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_gbr_ports.topojson"],value:"subnational_gbr",...s},subnational_jpn:{cube:"trade_s_jpn_m_hs",d3plusConfig:{all:{legendConfig:{label:e=>e.Region,shapeConfig:{backgroundImage:()=>null,labelConfig:{fontColor:()=>"#fff"}}},legendTooltip:{title:e=>o(l["Region JPN"][e["Region ID"]],null,e.Region)},tooltipConfig:{title:e=>o(l["Region JPN"][e["Region ID"]]||l.colorGrey,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:e=>l["Region JPN"][e["Region ID"]]||l.colorGrey}},stacked:{shapeConfig:{Area:{fill:e=>l["Region JPN"][e["Region ID"]]||l.colorGrey}}},line:{shapeConfig:{Line:{stroke:e=>l["Region JPN"][e["Region ID"]]||l.colorGrey}}}},currency:"\xa5",geoLevels:["Region","Subnat Geography"],id:"jpn",name:"Japan",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_jpn_regi
1ons.topojson","/shapes/subnational_jpn_prefectures.topojson"],value:"subnational_jpn",...s},subnational_rus:{cube:"trade_s_rus_m_hs",d3plusConfig:{all:{legendConfig:{label:e=>e.District,shapeConfig:{backgroundImage:()=>null,labelConfig:{fontColor:()=>"#fff"}}},legendTooltip:{title:e=>o(l.District[e["District ID"]],null,e.District)},tooltipConfig:{title:e=>o("transparent","/images/icons/subnational/rus/flag_".concat(e["Subnat Geography ID"],".png"),e["Subnat Geography"])}},treemap:{shapeConfig:{fill:e=>l.District[e["District ID"]]||l.colorGrey}},stacked:{shapeConfig:{Area:{fill:e=>l.District[e["District ID"]]||l.colorGrey}}},line:{shapeConfig:{Line:{stroke:e=>l.District[e["District ID"]]||l.colorGrey}}}},geoLevels:["District","Subnat Geography"],id:"rus",name:"Russia",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_rus_districts.topojson","/shapes/subnational_rus_regions.topojson"],value:"subnational_rus",...s},subnational_usa:{cube:"trade_s_usa_port_m_hs",d3plusConfig:{all:{legendConfig:{label:e=>e.State,shapeConfig:{backgroundImage:e=>"/images/icons/subnational/usa/flag_".concat(e["State ID"],".png"),fill:()=>"transparent",labelConfig:{fontColor:()=>"#fff"}}},legendTooltip:{title:e=>o("transparent","/images/icons/subnational/usa/flag_".concat(e["State ID"],".png"),e.State)},tooltipConfig:{title:e=>Array.isArray(e["Subnat Geography"])?o("transparent","/images/icons/subnational/usa/flag_".concat(e["State ID"],".png"),"Other ".concat(e.State)):o("transparent","/images/icons/subnational/usa/flag_".concat(e["State ID"],".png"),e["Subnat Geography"])}},treemap:{shapeConfig:{fill:e=>l["State USA"][e["State ID"]]||l.colorGrey}},stacked:{shapeConfig:{Area:{fill:e=>l["State USA"][e["State ID"]]||l.colorGrey}}},line:{shapeConfig:{Line:{stroke:e=>l["State USA"][e["State ID"]]||l.colorGrey}}}},geoLevels:["State","District","Subnat Geography"],id:"usa",name:"United States",productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_usa_districts.topojson","/shapes/subnational_usa_states.topojson"],value:"subnational_usa",...s},subnational_zaf:{cube:"trade_s_zaf_m_hs",d3plusConfig:{all:{tooltipConfig:{title:e=>o(null,null,e["Subnat Geography"])}},treemap:{shapeConfig:{fill:()=>l.Continent.af}},stacked:{shapeConfig:{Area:{fill:()=>l.Continent.af,stroke:()=>"#dddddd",strokeWidth:()=>1}}},line:{shapeConfig:{Line:{stroke:()=>l.Continent.af}}}},currency:"ZAR $",geoIcon:e=>"/images/icons/country/country_zaf.png",geoLevels:["Subnat Geography"],id:"zaf",name:"South Africa",port:!0,productLevels:["Section","HS2","HS4","Product"],timeLevels:["Year","Quarter","Month"],topojson:["/shapes/subnational_zaf_ports.topojson"],value:"subnational_zaf",...s}},c=Object.keys(r).map(e=>r[e]),u=(e,t)=>n(e,t).map(e=>({value:e,title:e})).reverse(),d={geoLevels:["Exporter Country","Importer Country"],productLevels:["Section","HS2","HS4","HS6"],timeLevels:["Year"]},p=[{...s,value:"hs92",cubeName:"trade_i_baci_a_92",title:"HS92",timeItems:u(1995,i),productLevel:"HS6",...d},{...s,value:"hs96",cubeName:"trade_i_baci_a_96",title:"HS96",timeItems:u(1998,i),productLevel:"HS6",...d},{...s,value:"hs02",cubeName:"trade_i_baci_a_02",title:"HS02",timeItems:u(2003,i),productLevel:"HS6",...d},{...s,value:"hs07",cubeName:"trade_i_baci_a_07",title:"HS07",timeItems:u(2008,i),productLevel:"HS6",...d},{...s,value:"hs12",cubeName:"trade_i_baci_a_12",title:"HS12",timeItems:u(2012,i),productLevel:"HS6",...d},{...s,value:"hs17",cubeName:"trade_i_baci_a_17",title:"HS17",timeItems:u(2018,i),productLevel:"HS6",...d},{...s,value:"hs22",cubeName:"trade_i_baci_a_22",title:"HS22",timeItems:u(2022,i),productLevel:"HS6",...d},{...s,value:"sitc",cubeName:"trade_i_oec_a_sitc2",title:"SITC",timeItems:u(1962,2018),productLevel:"Subgroup",geoLevels:["Exporter Country","Importer Country"],productLevels:["Category","Section","Division","Group","Subgroup"],timeLevels:["Year"]}];e.exports={...r,cubeSelector:c,datasets:p,productLabel:(e,t)=>["HS2","HS4","HS6"].includes(t)?"".concat(e["".concat(t," ID")]).slice(-(1*t.slice(-1))):"".concat(e["".concat(t," ID")])}},91933:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var n=(0,a(71301).Z)("arrow-narrow-left","IconArrowNarrowLeft",[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l4 4",key:"svg-1"}],["path",{d:"M5 12l4 -4",key:"svg-2"}]])},99799:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var n=(0,a(71301).Z)("brand-facebook","IconBrandFacebook",[["path",{d:"M7 10v4h3v7h4v-7h3l1 -4h-4v-2a1 1 0 0 1 1 -1h3v-4h-3a5 5 0 0 0 -5 5v2h-3",key:"svg-0"}]])},92791:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var n=(0,a(71301).Z)("brand-whatsapp","IconBrandWhatsapp",[["path",{d:"M3 21l1.65 -3.8a9 9 0 1 1 3.4 2.9l-5.05 .9",key:"svg-0"}],["path",{d:"M9 10a.5 .5 0 0 0 1 0v-1a.5 .5 0 0 0 -1 0v1a5 5 0 0 0 5 5h1a.5 .5 0 0 0 0 -1h-1a.5 .5 0 0 0 0 1",key:"svg-1"}]])},25601:function(e,t,a){"use strict";a.d(t,{Z:function(){return n}});var n=(0,a(71301).Z)("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]])}}]);
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.