@carbonplan/components 11.1.0-develop.0 → 11.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2873 @@
1
- import e,{forwardRef as t,cloneElement as r,useRef as n,useState as o,useEffect as a,useCallback as l}from"react";import{Box as i,Link as c,Flex as s,Grid as m,IconButton as p,Container as d,useColorMode as x,useThemeUI as h,Text as u,Styled as f,Input as g,Slider as y}from"theme-ui";import{transparentize as b}from"@theme-ui/color";import E from"next/link";import{Arrow as w,Sun as v}from"@carbonplan/icons";import{PoopSad as k}from"@carbonplan/emoji";import C from"next/head";import{keyframes as S}from"@emotion/react";function z(){return z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},z.apply(this,arguments)}function M(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}const A=["sx","children"],L=t=>{let{sx:r,children:n}=t,o=M(t,A);const a=r&&r.color?r.color:"primary";return e.createElement(i,z({sx:z({display:"inline-block",width:"fit-content",height:["24px","24px","24px","26px"],borderRadius:"5px",backgroundColor:"primary"==a||"secondary"==a?"muted":b(a,.7),textAlign:"center",userSelect:"none",fontSize:[2,2,2,3]},r)},o),e.createElement(i,{sx:{letterSpacing:"0.02em",fontFamily:"mono",mt:["1px","1px","1px","0px"],px:[1,1,1,"5px"],color:a}},n))},W=["href","children","internal","tracking"];var T=t((t,r)=>{let{href:n,children:o,internal:a=!1,tracking:l=!1}=t,i=M(t,W);if(a||n&&n.startsWith("/"))return e.createElement(E,{href:n,passHref:!0},e.createElement(c,z({ref:r},i),o));if(l){let t,a;n&&n.includes("pdf")?(t="PDF",a="download"):(t="website",a="external");const l=e=>{(({action:e,category:t,label:r,value:n})=>{"function"==typeof window.gtag?window.gtag("event",e,{event_category:t,event_label:r,value:n}):console.warn(`Missing window.gtag, skipping analytics action: '${e}'.`)})({action:t,category:a,label:n})};return e.createElement(c,z({ref:r,onClick:l,onContextMenu:l,href:n},i),o)}return e.createElement(c,z({ref:r,href:n},i),o)});const F=e=>{if(!["xs","sm","md","lg","xl"].includes(e))throw new Error("Size must be xs, sm, md, lg, or xl");let t,r,n,o;return"xs"===e&&(t=[2,2,2,3],r="body",n="body",o=[1.2]),"sm"===e&&(t=[3,3,3,4],r="body",n="body",o=[1.2]),"md"===e&&(t=[4,4,4,5],r="body",n="body",o=[1.2]),"lg"===e&&(t=[5,5,6,7],r="heading",n="heading",o=[1.2,1.2,1.25,1.25]),"xl"===e&&(t=[6,7,8,9],r="heading",n="heading",o=[1.25]),{fontSize:t,fontFamily:r,letterSpacing:n,lineHeight:o}},B=["size","prefix","suffix","inverted","sx","children","align","href","internal","tracking"];var I=t((t,n)=>{let o,a,l,c,s,{size:m="sm",prefix:p,suffix:d,inverted:x,sx:h,children:u,align:f,href:g,internal:y,tracking:b}=t,E=M(t,B);if(!["xs","sm","md","lg","xl"].includes(m))throw new Error("Size must be xs, sm, md, lg, or xl");const w=h&&h.color?h.color:null,v=w||(x?"secondary":"primary"),k=w||x?"primary":"secondary";let C,S,A,L,W,I;"xs"===m&&(a=["6px","6px","6px","6px"],l=[12,12,12,13],c=[12,12,12,13],s=[1.5,1.5,1.5,1.5],o={transform:"translateY(0.25px)"}),"sm"===m&&(a=["7px","7px","7px","7px"],l=[13,13,13,18],c=[13,13,13,18],s=[1.5,1.5,1.5,2],o={transform:"translateY(0.25px)"}),"md"===m&&(a=["8px","8px","8px","8px"],l=[18,18,18,24],c=[18,18,18,24],s=[2,2,2,3]),"lg"===m&&(a=["10px","10px","12px","16px"],l=[24,24,34,46],c=[24,24,34,46],s=[3,3,4,5]),"xl"===m&&(a=["12px","16px","18px","20px"],l=[34,46,56,68],c=[34,46,56,68],s=[4,5,6,7]),f?(A=f,L=f):p&&d?(A="initial",L="initial"):p?A="initial":d&&(L="middle"),W="middle"===A?{}:o,I="middle"===L?{}:o,p&&(C={"&:hover > #prefix-span > #prefix":z({color:k},p.type.hover)},p=r(p,{id:"prefix",sx:z({position:"relative",height:l,width:c,mr:u?a:[0],strokeWidth:s,verticalAlign:A,transition:"color 0.15s, transform 0.15s"},p.props.sx)})),d&&(S={"&:hover > #suffix-span >#suffix":z({color:k},d.type.hover)},d=r(d,{id:"suffix",sx:z({height:l,width:c,ml:u?a:[0],strokeWidth:s,verticalAlign:L,transition:"color 0.15s, transform 0.15s"},d.props.sx)}));const D=z({},F(m),{lineHeight:1.05,border:"none",background:"transparent",display:"block",color:v,padding:[0],textAlign:"left",cursor:"pointer",width:"fit-content","@media (hover: hover) and (pointer: fine)":z({"&:hover":{color:k}},S,C)},h),O=e.createElement(e.Fragment,null,e.createElement(i,{as:"span",id:"prefix-span",sx:z({display:"inline-block"},W)},p&&p),e.createElement(i,{as:"span",sx:{transition:"color 0.15s"}},u),e.createElement(i,{as:"span",id:"suffix-span",sx:z({display:"inline-block"},I)},d&&d));return g?e.createElement(T,z({ref:n,href:g,internal:y,tracking:b,sx:z({},D,{textDecoration:"none"})},E),O):e.createElement(i,z({ref:n,as:"button",sx:D},E),O)});const D=["label","children","inverted","color","href","internal","tracking","sx"];var O=t((t,r)=>{let{label:n,children:o,inverted:a,color:l,href:c,internal:s,tracking:m,sx:p}=t,d=M(t,D);const x=l||(a?"secondary":"primary"),h=l||a?"primary":"secondary",u=z({border:"none",padding:[0],fontSize:[3,3,3,4],color:x,background:"transparent",textDecoration:"none",fontFamily:"body",lineHeight:"h3",letterSpacing:"body",width:"fit-content",cursor:"pointer",textAlign:"left",mb:[1],"@media (hover: hover) and (pointer: fine)":{"&:hover > #container > #arrow":{transform:"rotate(45deg)",fill:h},"&:hover":{color:h}}},p),f=e.createElement(e.Fragment,null,e.createElement(i,{sx:{transition:"0.15s",letterSpacing:"body",pb:["6px"]}},o),e.createElement(i,{sx:{transition:"0.15s",display:"inline-block",textTransform:"uppercase",letterSpacing:"smallcaps",fontFamily:"heading",fontSize:[2,2,2,3]}},n),e.createElement(i,{as:"span",id:"container",sx:{ml:[2],display:"inline-block"}},e.createElement(w,{id:"arrow",sx:{transition:"fill 0.15s, transform 0.15s",position:"relative",top:["2px"],color:x,height:[15,15,15,17],width:[15,15,15,17]}})));return c?e.createElement(T,z({ref:r,href:c,internal:s,tracking:m,sx:u},d),f):e.createElement(i,z({ref:r,as:"button",sx:u},d),f)});const $=["colormap","label","clim","setClim","setClimStep","discrete","units","width","height","format","horizontal","bottom","sx","sxClim"],R=e=>({fontFamily:"mono",fontSize:["9px",0,0,1],letterSpacing:"smallcaps",textTransform:"uppercase","@media (hover: hover) and (pointer: fine)":{"&:hover":{borderBottom:e?({colors:e})=>`solid 1px ${e.primary} !important`:"unset"}},"&:focus":{outline:"none",borderBottom:e?({colors:e})=>`solid 1px ${e.primary} !important`:"unset"},transition:"border 0.15s",userSelect:e?"none !important":"unset",width:"fit-content",minWidth:"fit-content"}),H={width:["10px","16px","16px","17px"],height:["80px","110px","110px","130px"]},_=({colormap:t,discrete:r,horizontal:n,width:o,height:a})=>{const l=1/t.length*100,c=`linear-gradient(to ${n?"right":"top"}, ${t.map((e,n)=>`rgb(${e}) ${n*l}% ${r&&n<t.length-1?(n+1)*l+"%":""}`).join(",")})`;return e.createElement(i,{sx:z({},n?{width:o||H.height,height:a||H.width}:{width:o||H.width,minHeight:a||H.height},{mt:n?["1px","1px","1px",0]:0,border:({colors:e})=>`solid 1px ${e.hinted}`,background:c})})},j=({label:t,units:r,horizontal:n})=>e.createElement(i,{sx:!n&&{width:["13px","17px","17px","19px"],alignSelf:"flex-end"}},e.createElement(i,{sx:z({mb:n?0:["-4px","-4px","-4px","-3px"],fontFamily:"mono",fontSize:["9px",0,0,1],letterSpacing:"smallcaps",textTransform:"uppercase"},n?{}:{writingMode:"vertical-rl",transform:"rotate(180deg)",whiteSpace:"nowrap",display:"inline-block",overflow:"visible"})},t," ",e.createElement(i,{as:"span",sx:{textTransform:"none",color:"secondary",display:"inline-block"}},r))),V=t=>{let{colormap:r,label:l,clim:c,setClim:m,setClimStep:p=1,discrete:d,units:x,width:h,height:u,format:f=(e=>e),horizontal:g=!1,bottom:y=!1,sx:b,sxClim:E}=t,w=M(t,$);if(!Array.isArray(r))throw new Error(`expected array for colormap, got '${r}'.`);const v=[n(),n()],[k,C]=o(!1),[S,A]=o(!1);let L,W,T,F=0,B=null,I=[0,0],D=p;const O=e=>{"min"!==B||k||C(!0),"max"!==B||S||A(!0),T=e.pageX-L,F=e.pageY-W,g?("min"===B&&m(e=>[Math.min(I[0]+T*D,I[1]),e[1]]),"max"===B&&m(e=>[e[0],Math.max(I[1]+T*D,I[0])])):("min"===B&&m(e=>[Math.min(I[0]-F*D,I[1]),e[1]]),"max"===B&&m(e=>[e[0],Math.max(I[1]-F*D,I[0])]))},V=e=>{W=e.pageY,L=e.pageX,B=e.target.id,I=c,document.body.setAttribute("style",g?"cursor: ew-resize !important":"cursor: ns-resize !important"),document.addEventListener("mousemove",O);const t=()=>{document.body.setAttribute("style","cursor: unset"),document.removeEventListener("mousemove",O),window.removeEventListener("mouseup",t),"min"===B&&C(!1),"max"===B&&A(!1)};window.addEventListener("mouseup",t)};a(()=>{const e=e=>{(["ArrowUp","ArrowRight"].includes(e.code)||["ArrowUp","ArrowRight"].includes(e.key))&&(e=>{v[0].current===document.activeElement&&(e.preventDefault(),m(e=>[Math.min(e[0]+D,e[1]),e[1]]),v[0].current.focus()),v[1].current===document.activeElement&&(e.preventDefault(),m(e=>[e[0],Math.max(e[1]+D,e[0])]),v[1].current.focus())})(e),(["ArrowDown","ArrowLeft"].includes(e.code)||["ArrowDown","ArrowLeft"].includes(e.key))&&(e=>{v[0].current===document.activeElement&&(e.preventDefault(),m(e=>[Math.min(e[0]-D,e[1]),e[1]]),v[0].current.focus()),v[1].current===document.activeElement&&(e.preventDefault(),m(e=>[e[0],Math.max(e[1]-D,e[0])]),v[1].current.focus())})(e)};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[c]);const N=()=>e.createElement(i,{id:"min",ref:v[0],tabIndex:0,sx:z({},R(m),{ml:l?g?y?"0px":"10px":["2px","1px","1px","2px"]:0,mr:g?["2px","1px","1px","2px"]:0,mb:g?0:["-2px","-2px","-2px","-3px"],borderBottom:m?k?({colors:e})=>`solid 1px ${e.primary}`:({colors:e})=>`solid 1px ${e.secondary}`:"unset",cursor:m?g?"ew-resize":"ns-resize":"default"},E),onMouseDown:m?V:()=>{},onClick:()=>v[0].current.focus()},f(c[0])),P=()=>e.createElement(i,{id:"max",ref:v[1],tabIndex:0,sx:z({},R(m),{ml:["2px","1px","1px","2px"],mt:g?0:["-2px","-3px","-3px","-3px"],borderBottom:m?S?({colors:e})=>`solid 1px ${e.primary}`:({colors:e})=>`solid 1px ${e.secondary}`:"unset",cursor:m?g?"ew-resize":"ns-resize":"default"},E),onMouseDown:m?V:()=>{},onClick:()=>v[1].current.focus()},f(c[1]));return e.createElement(s,z({},w,{sx:z({flexDirection:"row",alignItems:"start",justifyContent:"flex-start",gap:["3px","6px","6px","7px"],height:g?"unset":"100%"},b)}),l&&e.createElement(j,{label:l,units:x,horizontal:g}),e.createElement(s,{sx:{flexGrow:g?1:"unset",flexDirection:"column",ml:y&&l?"4px":"0px",height:g?"unset":"100%"}},e.createElement(s,{sx:{gap:["3px","6px","6px","7px"],height:g?"unset":"100%"}},g&&c&&!y&&e.createElement(N,null),e.createElement(_,{colormap:r,horizontal:g,discrete:d,width:h,height:u}),g&&c&&!y&&e.createElement(P,null)),g&&c&&y&&e.createElement(s,{sx:{justifyContent:"space-between"}},e.createElement(N,null),e.createElement(P,null))),!g&&e.createElement(s,{sx:{flexDirection:"column-reverse",justifyContent:"space-between",height:u||H.height}},c&&e.createElement(N,null),c&&e.createElement(P,null)))},N=["start","width","dl","dr","children","sx"],P=t=>{let{start:r,width:n,dl:o,dr:a,children:l,sx:c}=t,s=M(t,N);r=r||"auto",n=n||"auto";const m=e=>{if(e&&!Array.isArray(e)&&(e=[e]),![1,2,4].includes(e.length))throw new Error("Array length must be 1, 2, or 4");return Array.isArray(e)&&1==e.length?e=e.map(e=>[e,e,e,e]).flat():Array.isArray(e)&&2==e.length&&(e=e.map(e=>[e,e]).flat()),e};r=m(r),n=m(n);const p=r.map((e,t)=>"auto"==e?"auto":e+n[t]);let d,x;if(o){if(![.5,1].includes(o))throw new Error("dl must be 0.5 or 1");.5===o&&(d=["-12px",-3,-3,-4]),1===o&&(d=[-4,-5,-5,-6])}if(a){if(![.5,1].includes(a))throw new Error("dr must be 0.5 or 1");.5===a&&(x=["-12px",-3,-3,-4]),1===a&&(x=[-4,-5,-5,-6])}return e.createElement(i,z({},s,{sx:z({gridColumnStart:r,gridColumnEnd:p,ml:d,mr:x},c)}),l)},G=({title:t,description:r,card:n})=>(r=r||"Data and science for climate action.",n=n||"https://images.carbonplan.org/social/homepage.png",e.createElement(C,null,e.createElement("title",null,t=t||"carbonplan"),e.createElement("meta",{name:"description",content:r}),e.createElement("meta",{name:"viewport",content:"initial-scale=1.0, width=device-width"}),e.createElement("link",{rel:"canonical",content:"https://carbonplan.org/"}),e.createElement("link",{rel:"icon",type:"image/svg+xml",href:"https://images.carbonplan.org/favicon.svg"}),e.createElement("link",{rel:"preload",href:"https://fonts.carbonplan.org/relative/relative-book-pro.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),e.createElement("link",{rel:"preload",href:"https://fonts.carbonplan.org/relative/relative-medium-pro.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),e.createElement("link",{rel:"preload",href:"https://fonts.carbonplan.org/relative/relative-mono-11-pitch-pro.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),e.createElement("link",{rel:"preload",href:"https://fonts.carbonplan.org/relative/relative-faux-book-pro.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),e.createElement("link",{rel:"manifest",href:"https://images.carbonplan.org/manifest.json"}),e.createElement("meta",{name:"theme-color",content:"#1b1e23"}),e.createElement("link",{rel:"alternate icon",type:"image/png",href:"https://images.carbonplan.org/favicon.png"}),e.createElement("link",{rel:"mask-icon",href:"https://images.carbonplan.org/safari-pinned-tab.svg",color:"#000000"}),e.createElement("link",{rel:"apple-touch-icon",sizes:"180x180",href:"https://images.carbonplan.org/apple-touch-icon.png"}),e.createElement("meta",{name:"msapplication-TileColor",content:"#1b1e23"}),e.createElement("meta",{name:"msapplication-TileImage",content:"https://images.carbonplan.org/mstile-144x144.png"}),e.createElement("meta",{name:"msapplication-config",content:"https://images.carbonplan.org/browserconfig.xml"}),e.createElement("meta",{property:"og:title",content:t}),e.createElement("meta",{property:"og:description",content:r}),e.createElement("meta",{property:"og:image",content:n}),e.createElement("meta",{property:"og:url",content:"https://carbonplan.org"}),e.createElement("meta",{name:"twitter:title",content:t}),e.createElement("meta",{name:"twitter:description",content:r}),e.createElement("meta",{name:"twitter:image",content:n}),e.createElement("meta",{name:"twitter:card",content:"summary_large_image"}))),Y=t=>{let r=z({},t);return e.createElement(i,z({as:"svg",width:"150",fill:"currentColor",stroke:"none",viewBox:"0 0 151.1 28.8"},r),e.createElement("g",null,e.createElement("g",null,e.createElement("path",{d:"M9.7,20.1c-1.3-1.4-2-3.1-2-5.2c0-2.1,0.7-3.9,2-5.2c1.3-1.4,3-2,5.1-2c1.7,0,3.1,0.4,4.3,1.3 c1.1,0.9,1.8,2.1,2.1,3.5c0,0.1,0,0.2,0,0.3s-0.1,0.2-0.2,0.2h-2.3c-0.2,0-0.3-0.1-0.4-0.2c-0.3-0.8-0.7-1.4-1.3-1.8 c-0.6-0.4-1.4-0.6-2.2-0.6c-1.3,0-2.3,0.4-3,1.2c-0.8,0.8-1.1,1.9-1.1,3.4c0,1.5,0.4,2.6,1.1,3.4c0.8,0.8,1.8,1.2,3,1.2 c0.8,0,1.6-0.2,2.2-0.6c0.6-0.4,1.1-1,1.3-1.8c0.1-0.2,0.2-0.2,0.4-0.3H21c0.1,0,0.2,0.1,0.2,0.2c0,0.1,0,0.2,0,0.3 c-0.3,1.4-1,2.6-2.1,3.5c-1.1,0.9-2.5,1.3-4.3,1.3C12.7,22.1,11,21.4,9.7,20.1z"})),e.createElement("g",null,e.createElement("path",{d:"M22.5,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1 c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3 c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1C30.6,7.6,32,8.1,33,9c1,0.9,1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6 c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2 C23,20.1,22.5,19,22.5,17.6z M25.4,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9 c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C25.7,16.3,25.4,16.8,25.4,17.5z"})),e.createElement("g",null,e.createElement("path",{d:"M37,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.1c1-1.1,2.3-1.6,3.7-1.6 c0.8,0,1.7,0.1,2.5,0.4c0.2,0.1,0.3,0.3,0.3,0.5v2.2c0,0.2-0.1,0.3-0.2,0.3c0,0-0.1,0-0.2-0.1c-1.1-0.5-2-0.8-2.9-0.8 c-0.9,0-1.7,0.4-2.3,1.1c-0.6,0.7-0.9,1.7-0.9,3v7.3c0,0.2-0.1,0.3-0.3,0.3h-2.2C37.1,21.8,37,21.7,37,21.6z"})),e.createElement("g",null,e.createElement("path",{d:"M47.6,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3H50c0.2,0,0.3,0.1,0.3,0.3v6.5c1.3-1.1,2.7-1.6,4.3-1.6 c1.9,0,3.4,0.7,4.6,2c1.1,1.3,1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.8,0-3.2-0.5-4.3-1.6v1 c0,0.2-0.1,0.3-0.3,0.3h-2.2C47.7,21.8,47.6,21.7,47.6,21.6z M51.2,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3 s1.7,1.3,2.9,1.3c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3 C52.9,10.2,51.9,10.7,51.2,11.5z"})),e.createElement("g",null,e.createElement("path",{d:"M64.3,20.1c-1.4-1.4-2.1-3.1-2.1-5.2c0-2.1,0.7-3.9,2.1-5.2c1.4-1.4,3.1-2,5.2-2c2.1,0,3.8,0.7,5.2,2 c1.4,1.4,2.1,3.1,2.1,5.2c0,2.1-0.7,3.9-2.1,5.2c-1.4,1.4-3.1,2-5.2,2C67.4,22.1,65.7,21.4,64.3,20.1z M66.4,11.5 c-0.8,0.8-1.2,2-1.2,3.4c0,1.4,0.4,2.5,1.2,3.4s1.9,1.3,3.1,1.3c1.3,0,2.3-0.4,3.1-1.3c0.8-0.8,1.2-2,1.2-3.4 c0-1.4-0.4-2.5-1.2-3.4c-0.8-0.8-1.9-1.3-3.1-1.3C68.2,10.2,67.2,10.7,66.4,11.5z"})),e.createElement("g",null,e.createElement("path",{d:"M78.7,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8 c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1 c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C78.7,21.8,78.7,21.7,78.7,21.6z"})),e.createElement("g",null,e.createElement("path",{d:"M101.7,27.1V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1c1.1-1.1,2.5-1.6,4.3-1.6 c1.9,0,3.4,0.7,4.6,2s1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.5,0-3-0.5-4.3-1.6v6.6c0,0.2-0.1,0.3-0.3,0.3 H102C101.8,27.3,101.7,27.2,101.7,27.1z M105.3,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3s1.7,1.3,2.9,1.3 c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3C107,10.2,106,10.7,105.3,11.5z"})),e.createElement("g",null,e.createElement("path",{d:"M117.2,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v18.9c0,0.2-0.1,0.3-0.3,0.3h-2.2 C117.3,21.8,117.2,21.7,117.2,21.6z"})),e.createElement("g",null,e.createElement("path",{d:"M122,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1 c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3 c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1c1.7,0,3.1,0.5,4.2,1.4s1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6 c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2 C122.5,20.1,122,19,122,17.6z M124.9,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9 c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C125.2,16.3,124.9,16.8,124.9,17.5z"})),e.createElement("g",null,e.createElement("path",{d:"M136.9,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8 c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1 c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C137,21.8,136.9,21.7,136.9,21.6z"})),e.createElement("path",{d:"M97.6,14.9c0,4.2-0.6,8.3-1.6,12.3c0,0.1-0.1,0.2-0.2,0.2h-2.4c-0.1,0-0.2-0.1-0.2-0.3c1.1-3.9,1.7-8,1.7-12.2 s-0.6-8.3-1.7-12.2c0-0.1,0.1-0.3,0.2-0.3l2.4,0c0.1,0,0.2,0.1,0.2,0.2C97.1,6.5,97.6,10.6,97.6,14.9z"}),e.createElement("path",{d:"M1.4,14.9C1.4,10.6,2,6.5,3,2.6c0-0.1,0.1-0.2,0.2-0.2l2.4,0c0.1,0,0.2,0.1,0.2,0.3c-1.1,3.9-1.7,8-1.7,12.2 s0.6,8.3,1.7,12.2c0,0.1-0.1,0.3-0.2,0.3H3.3c-0.1,0-0.2-0.1-0.2-0.2C2,23.2,1.4,19.1,1.4,14.9z"})))},X=["children","sx","columns","gap"],U=t=>{let{children:r,sx:n,columns:o,gap:a}=t,l=M(t,X);const i=e=>{if(Array.isArray(e)||(e=[e,e,e,e]),Array.isArray(e)&&![1,2,4].includes(e.length))throw new Error("Array length must be 1, 2, or 4");return Array.isArray(e)&&1==e.length&&(e=e.map(e=>[e]).flat()),Array.isArray(e)&&2==e.length&&(e=e.map(e=>[e,e]).flat()),e};let c,s;return Number.isInteger(a)||Array.isArray(a)?(a=i(a),c=a,s=a):(c=[4,5,5,6],s=[0,0,0,0]),o=Number.isInteger(o)||Array.isArray(o)?i(o):[6,8,12,12],e.createElement(m,z({},l,{columns:o,sx:z({columnGap:c,rowGap:s},n)}),r)},K=["value","sx"],Z=t=>{let{value:r,sx:n}=t,o=M(t,K);return e.createElement(p,z({sx:z({cursor:"pointer",fill:"none",strokeWidth:"2px",stroke:"text",".paren":{opacity:"0"},"@media (hover: hover) and (pointer: fine)":{"&:hover .paren":{opacity:"1"}}},n),"aria-label":"Toggle Menu"},o),!r&&e.createElement("svg",{style:{width:"50px",height:"30px",transform:"scale(2)",marginTop:"-3px"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 68 36"},e.createElement("line",{x1:"52",y1:"29.9",x2:"16",y2:"29.9"}),e.createElement("line",{x1:"52",y1:"6.1",x2:"16",y2:"6.1"}),e.createElement("line",{x1:"52",y1:"18",x2:"16",y2:"18"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"})),r&&e.createElement("svg",{style:{width:"50px",height:"30px",transform:"scale(2)",marginTop:"-3px"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 68 36"},e.createElement("line",{x1:"50.85",y1:"29.79",x2:"17.15",y2:"6.21"}),e.createElement("line",{x1:"17.15",y1:"29.79",x2:"50.85",y2:"6.21"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"})))},q=(e,t,r=!1)=>({width:"auto",color:e===t?"secondary":"text",fontSize:[6,6,7,8],fontFamily:"heading",letterSpacing:"heading",borderStyle:"solid",borderColor:"muted",borderWidth:"0px",borderBottomWidth:"1px",borderTopWidth:r?"1px":"0px",py:[3,3,4,5],textDecoration:"none",display:"block",position:"relative",transition:"color 0.15s","@media (hover: hover) and (pointer: fine)":{"&:hover > #arrow":{opacity:1}},"&:hover":{color:e==t?"secondary":"text"}}),J=[{url:"about",display:"About"},{url:"research",display:"Research"},{url:"blog",display:"Blog"},{url:"press",display:"Press"}],Q=()=>e.createElement(w,{id:"arrow",sx:{pointerEvents:"none",display:"inline-block",position:"absolute",left:["-60px","-68px","-80px","-104px"],top:["32px","32px","46px","62px"],opacity:0,transition:"opacity 0.2s ease-out",transform:"rotate(45deg)",width:[36,36,48,56],height:[36,36,48,56]}}),ee=({link:t,mode:r,nav:n,first:o,setExpanded:a})=>{const{url:l,display:i}=t,s="remote"===r?"https://carbonplan.org/"+l:"/"+l;return"homepage"===r||"local"===r&&n===l?e.createElement(E,{href:s,passHref:!0},e.createElement(c,{onClick:()=>{n===l&&a(!1)},sx:q(n,l,o)},e.createElement(Q,null),i)):e.createElement(c,{href:s,sx:q(n,l,o)},e.createElement(Q,null),i)},te=({links:t,nav:r,mode:n,setExpanded:o})=>t.map((t,a)=>e.createElement(ee,{key:a,link:t,mode:n,nav:r,first:0===a,setExpanded:o})),re=({status:t,mode:r,nav:n,menuItems:a})=>{const[l,m]=o(!1);return e.createElement(U,{sx:{pt:["12px"],pb:[3]}},e.createElement(P,{start:[1],width:[2]},e.createElement(i,{sx:{display:"block",width:"fit-content"}},("homepage"==r||"local"==r)&&e.createElement(E,{href:"/",passHref:!0},e.createElement(c,{"aria-label":"CarbonPlan Homepage",sx:{display:"block"}},e.createElement(Y,{id:"logo",sx:{cursor:"pointer",color:"primary"}}))),(null==r||"remote"==r)&&e.createElement(c,{href:"https://carbonplan.org","aria-label":"CarbonPlan Homepage",sx:{display:"block"}},e.createElement(Y,{sx:{cursor:"pointer",color:"primary"}})))),e.createElement(P,{start:[4,9],width:[2,2],dr:1,sx:{display:[t?"flex":"none","flex","flex","flex"],alignItems:"center"}},e.createElement(i,{sx:{fontSize:[1,2,3],position:"relative",top:["-2px","-3px","-3px"]}},t?`(${t})`:"")),e.createElement(P,{start:[t?6:4,6,11,11],width:[t?1:3,3,2,2],sx:{zIndex:5e3}},e.createElement(s,{sx:{justifyContent:"flex-end"}},e.createElement(s,{sx:{mr:"18px",gap:"18px",opacity:l?0:1,transition:"opacity 0.15s",justifyContent:"space-between",alignItems:"center"}},a),e.createElement(Z,{sx:{mr:["-2px"]},value:l,onClick:e=>{m(!l)}}))),e.createElement(i,{sx:{opacity:l?1:0,pointerEvents:l?"all":"none",position:"fixed",top:"0px",right:"0px",bottom:"0px",minWidth:"0px",maxHeight:"100vh",width:"100vw",backgroundColor:"background",zIndex:4e3,pt:["79px"],transition:"opacity 0.25s"}},e.createElement(d,null,e.createElement(U,null,e.createElement(P,{start:[2,4,7,7],width:[5,4,5,5]},e.createElement(i,{as:"nav",sx:{display:l?"inherit":"none",mt:[5,5,5,6]}},e.createElement(te,{links:J,nav:n,mode:r,setExpanded:m})))))))},ne=t=>{let r=z({},t);return e.createElement(i,z({as:"svg",width:"80",stroke:"none",fill:"currentColor",viewBox:"0 0 32 32"},r),e.createElement("path",{d:"M21.9395,14.9395 L17.5005,19.3785 L17.5005,7.0005 L14.5005,7.0005 L14.5005,19.3785 L10.0605,14.9395 L7.9395,17.0605 L14.9395,24.0605 C15.2325,24.3535 15.6165,24.5005 16.0005,24.5005 C16.3835,24.5005 16.7675,24.3535 17.0605,24.0605 L24.0605,17.0605 L21.9395,14.9395 Z"}),e.createElement("path",{d:"M27.5986,4 L22.8966,4 C26.5556,6.303 28.9996,10.366 28.9996,15 C28.9996,20.4 25.6896,25.039 20.9926,27 L26.5586,27 C29.8886,24.068 31.9996,19.785 31.9996,15 C31.9996,10.734 30.3196,6.868 27.5986,4"}),e.createElement("path",{d:"M3,15 C3,10.366 5.444,6.303 9.104,4 L4.401,4 C1.68,6.868 0,10.734 0,15 C0,19.785 2.112,24.068 5.441,27 L11.008,27 C6.311,25.039 3,20.4 3,15"}))},oe=()=>e.createElement(i,{sx:{mt:[7,7,7,8],mb:[7,7,7,8],pb:[2,1,0,0]}},e.createElement(U,{sx:{mb:[0,0,4,5]}},e.createElement(P,{start:[1,2],width:[3,3]},e.createElement(i,null,e.createElement(i,{sx:{fontSize:[2,2,2,3],fontFamily:"heading",letterSpacing:"mono",mb:[2]}},"EMAIL"),e.createElement(c,{href:"mailto:hello@carbonplan.org",sx:{textDecoration:"none",fontSize:[2,2,2,3]}},"hello@carbonplan.org"))),e.createElement(P,{start:[5],width:[1],dl:1,dr:1,sx:{display:["flex","none","none","none"],justifyContent:["center"]}},e.createElement(ne,{sx:{mt:["-4px"],width:"60px",height:"60px"}})),e.createElement(P,{start:[1,5,5,5],width:[3,3],sx:{mt:[3,0,0,0]}},e.createElement(i,null,e.createElement(i,{sx:{fontSize:[2,2,2,3],fontFamily:"heading",letterSpacing:"mono",mb:[2]}},"FOLLOW"),e.createElement(c,{href:"https://twitter.com/carbonplanorg",sx:{textDecoration:"none",fontSize:[2,2,2,3]}},"@carbonplanorg"))),e.createElement(P,{start:[1,9],width:[5,4,3,3],sx:{mt:["42px","42px",0,0],mb:[3,3,0,0]}},e.createElement(i,null,e.createElement(i,{sx:{fontSize:[2,2,2,3],fontFamily:"body",color:"secondary"}},"CarbonPlan is a registered non-profit public benefit corporation in California with 501(c)(3) status.")))),e.createElement(U,{sx:{mb:["2px"],mt:[5,5,4]}},e.createElement(P,{start:[1,1,2,2],width:[3,2,3,3],sx:{display:"flex",alignItems:["flex-start","flex-start","flex-end"]}},e.createElement(i,{sx:{bottom:"0px",borderStyle:"solid",borderColor:"muted",borderWidth:"0px",borderTopWidth:"1px",pt:[2]}},e.createElement(i,{sx:{color:"secondary",fontSize:[1,1,1,2],fontFamily:"mono",letterSpacing:"mono"}},"(c) 2021 CARBONPLAN"))),e.createElement(P,{start:[4,3,5,5],width:[2,2,3,3],sx:{display:"flex",alignItems:["flex-start","flex-start","flex-end"],mt:[0,0,0,0]}},e.createElement(i,{sx:{bottom:"0px",borderStyle:"solid",borderColor:"muted",borderWidth:"0px",borderTopWidth:"1px",width:["100%","auto","auto","auto"],pt:[2]}},e.createElement(E,{href:"/terms",passHref:!0},e.createElement(i,{as:"a",sx:{textDecoration:"none",fontSize:[1,1,1,2],color:"secondary",fontFamily:"mono",letterSpacing:"mono",display:"block"}},"READ OUR TERMS")))),e.createElement(P,{start:[5,7,9,9],width:[2,3,3,3],sx:{display:["none","initial","initial","initial"]}},e.createElement(ne,{sx:{width:80,height:80,mt:[0,"-10px",4,5],mb:["-12px"]}})))),ae=["sx"],le=t=>{let{sx:r}=t,n=M(t,ae);const[o,a]=x(),i=l(()=>{a("light"===o?"dark":"light")},[o]);return e.createElement(p,z({"aria-label":"Toggle dark mode",onClick:i,role:"checkbox",sx:z({width:32,height:32,display:"inline-block",cursor:"pointer",color:"secondary"},r)},n),e.createElement(v,{sx:{strokeWidth:"1.75",transition:"stroke 0.15s","@media (hover: hover) and (pointer: fine)":{"&:hover":{stroke:"primary"}}}}))},ie=()=>{const t=process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,r=process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER,n=process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG,{theme:o}=h(),a=o.rawColors.secondary;if(t&&r&&n){const o=t.substring(0,7),l="https://github.com/"+r+"/"+n+"/tree/"+t;return e.createElement(i,{sx:{display:"inline-block",width:"87px"}},e.createElement(ce,{color:a}),e.createElement(c,{href:l,sx:{whiteSpace:"nowrap",display:"inline-block",ml:[2],fontFamily:"mono",letterSpacing:"body",color:a,fontSize:[1],textTransform:"uppercase",textDecoration:"none"}},o))}return e.createElement(i,{sx:{display:"inline-block",width:"87px"}},e.createElement(ce,{color:a}),e.createElement(u,{sx:{whiteSpace:"nowrap",display:"inline-block",ml:[2],fontFamily:"mono",letterSpacing:"body",color:a,fontSize:[1],textTransform:"uppercase"}},a))},ce=({color:t})=>e.createElement("svg",{fill:t,opacity:"0.8",viewBox:"0 0 24 24",width:"24",height:"24"},e.createElement("circle",{r:5,cx:19,cy:19})),se=({mode:t})=>{const[r,n]=o(function(e){return"mouse"===e?`X,Y: ${pe(0,4)},${pe(0,4)}`:"scroll"===e?`SCROLL: 0.${pe((0).toFixed(0),2)}`:e}(t));return a(()=>{if("mouse"===t){const e=e=>{const t=pe(e.clientX,4),r=pe(e.clientY,4);n(`X,Y: ${t},${r}`)};return window.addEventListener("mousemove",e),()=>{window.removeEventListener("mousemove",e)}}if("scroll"===t){const e=e=>{const t=function(e,t){return Math.min(e.scrollY/(document.body.offsetHeight-770),.99)}(window);n(`SCROLL: 0.${pe((100*t).toFixed(0),2)}`)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}},[]),e.createElement(u,{sx:{whiteSpace:"nowrap",display:"inline-block",mr:"-6px",fontFamily:"mono",letterSpacing:"body",color:"secondary",fontSize:[1],textTransform:"uppercase"}},r)},me=({mode:t})=>e.createElement(i,{sx:{userSelect:"none",position:"fixed",bottom:"42px",right:"24px",transformOrigin:"right",transform:"rotate(90deg)",display:["none","none","initial"]}},e.createElement(se,{mode:t}),e.createElement(ie,null));function pe(e,t){return e.toString().padStart(t,"0")}const de=["duration","delay","children"],xe=S({from:{opacity:0},to:{opacity:1}}),he=t=>{let{duration:r=300,delay:n=0,children:o}=t,a=M(t,de);return e.createElement(i,z({},a,{sx:{animationDuration:r+"ms",animationDelay:n+"ms",animationName:xe.toString(),animationFillMode:"backwards"}}),o)},ue=e=>{const t=e.createElement("div");t.style.visibility="hidden",t.style.width="100px",e.body.appendChild(t),t.style.overflow="scroll";const r=e.createElement("div");r.style.width="100%",t.appendChild(r);const n=t.offsetWidth-r.offsetWidth;return t.parentNode.removeChild(t),n},fe=()=>(a(()=>{"undefined"!=typeof document&&ue(document)>0&&(document.body.classList.add("custom-scrollbar"),document.getElementsByTagName("html")[0].classList.add("custom-scrollbar"))},[]),null),ge=({color:t="muted"})=>{const[r,n]=o(!1);return a(()=>{function e(e){const{key:t,metaKey:r}=e;";"===t&&r&&n(e=>!e)}return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[]),e.createElement(i,{sx:{position:"fixed",width:"100%",left:0,top:0,zIndex:"teal"===t?5e3:-1,pointerEvents:"none",display:r?"initial":"none"}},e.createElement(d,null,e.createElement(i,{sx:{display:["none","none","initial","initial"]}},e.createElement(be,{indices:[1,2,3,4,5,6,7,8,9,10,11,12],color:t})),e.createElement(i,{sx:{display:["none","initial","none","none"]}},e.createElement(be,{indices:[1,2,3,4,5,6,7,8],color:t})),e.createElement(i,{sx:{display:["initial","none","none","none"]}},e.createElement(be,{indices:[1,2,3,4,5,6],color:t}))))},ye=["red","orange","yellow","green","teal","blue","purple","pink"];function be({indices:t,color:r}){const n={outerGuideColumn:{borderStyle:"solid",borderWidth:"0px",borderLeftWidth:"teal"===r?"0px":"1px",borderRightWidth:"teal"===r?"0px":"1px",opacity:"teal"==r?.4:1},innerGuideColumn:{borderStyle:"solid",borderWidth:"0px",borderLeftWidth:"0px",borderRightWidth:"0px",opacity:"teal"==r?.4:1}};return e.createElement(U,null,t.map(t=>e.createElement(P,{key:t,start:[t],width:[1,1],dl:.5,dr:.5,sx:z({bg:"teal"===r?"teal":"transparent",height:"100vh"},n.innerGuideColumn)},e.createElement(i,{sx:z({mx:["12px",3,3,4],bg:"teal"===r?"background":"transparent",height:"100%",borderLeftColor:"rainbow"===r?ye[t%8]:"muted",borderRightColor:"rainbow"===r?ye[t%8]:"muted"},n.outerGuideColumn)}))))}const Ee=["value","sx"],we=t=>{let{value:r,sx:n}=t,o=M(t,Ee);return e.createElement(p,z({sx:z({cursor:"pointer",fill:"none",strokeWidth:"2px",stroke:"text",".paren":{opacity:"0"},"@media (hover: hover) and (pointer: fine)":{"&:hover .paren":{opacity:"1"}}},n),"aria-label":"Toggle Menu"},o),!r&&e.createElement("svg",{style:{width:"50px",height:"30px",transform:"scale(2)",marginTop:"-3px"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 68 36"},e.createElement("line",{x1:"24",y1:"2.1",x2:"24",y2:"6.1"}),e.createElement("line",{x1:"24",y1:"24.1",x2:"24",y2:"33.9"}),e.createElement("line",{x1:"44",y1:"2.1",x2:"44",y2:"12.1"}),e.createElement("line",{x1:"44",y1:"30.1",x2:"44",y2:"33.9"}),e.createElement("circle",{cx:"24",cy:"15.1",r:"5"}),e.createElement("circle",{cx:"44",cy:"21.1",r:"5"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"})),r&&e.createElement("svg",{style:{width:"50px",height:"30px",transform:"scale(2)",marginTop:"-3px"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 68 36"},e.createElement("line",{x1:"50.85",y1:"29.79",x2:"17.15",y2:"6.21"}),e.createElement("line",{x1:"17.15",y1:"29.79",x2:"50.85",y2:"6.21"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"}),e.createElement("path",{style:{transition:"all 0.2s"},className:"paren",d:"M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"})))},ve=({title:t,description:r,card:n,children:o,status:l,nav:c,settings:m,footer:p=!0,header:x=!0,metadata:u="mouse",links:f="remote",dimmer:g="bottom",guide:y=!0,scrollbar:b=!0,fade:E=!0,container:w=!0})=>{let v=o;E&&(v=e.createElement(he,{duration:250},v)),w&&(v=e.createElement(i,{sx:{mb:[8,8,9,10]}},e.createElement(d,null,v)));const{theme:k}=h();a(()=>{if(!k)return;const e=window.matchMedia(`(min-width: ${k.breakpoints[1]})`);return e.onchange=e=>{e.matches&&null!=m&&m.value&&null!=m&&m.onClick&&(null==m||m.onClick())},()=>{e.onchange=null}},[null==k?void 0:k.breakpoints,null==m?void 0:m.value,null==m?void 0:m.onClick]);const C=[e.createElement(le,{key:"dimmer",sx:{color:"primary",mt:"-2px",display:["block","block","top"===g?"block":"none","top"===g?"block":"none"]}})];return m&&C.push(e.createElement(we,z({key:"settings",sx:{mr:["2px"],display:["inherit","inherit","none","none"]}},m))),e.createElement(e.Fragment,null,y&&e.createElement(ge,{color:y}),b&&e.createElement(fe,null),e.createElement(G,{card:n,description:r,title:t}),e.createElement(s,{sx:{flexDirection:"column",minHeight:"100vh"}},x&&e.createElement(i,{as:"header",sx:{width:"100%",borderStyle:"solid",borderColor:"muted",borderWidth:"0px",borderBottomWidth:"1px",position:"sticky",top:0,bg:"background",height:"56px",zIndex:2e3}},e.createElement(d,null,e.createElement(re,{mode:f,status:l,nav:c,menuItems:C}))),e.createElement(i,{sx:{width:"100%",flex:"1 1 auto"}},v),p&&e.createElement(i,{as:"footer",sx:{width:"100%",borderStyle:"solid",borderColor:"muted",borderWidth:"0px",borderTopWidth:"1px"}},e.createElement(d,null,e.createElement(oe,null))),"bottom"===g&&e.createElement(i,{sx:{display:["none","none","initial","initial"],position:["fixed"],right:[13],bottom:[17,17,15,15]}},e.createElement(le,null)),u&&e.createElement(me,{mode:u})))},ke=()=>e.createElement(ve,{footer:!1,title:"404 / carbonplan"},e.createElement(U,{sx:{mb:[5,0,0],pt:[0,0,6]}},e.createElement(P,{start:[1,1,3,3],width:[6,4,4,4]},e.createElement(f.h1,null,"Oops!"),e.createElement(i,{sx:{fontSize:[4,4,4,5],lineHeight:"h3",mt:[3,4,4],mb:[2,3,3],maxWidth:["90%","90%","400px"]}},"Sorry but we can't seem to find the page you are looking for."),e.createElement(i,{sx:{color:"secondary",fontFamily:"mono",letterSpacing:"mono",fontSize:[2,2,2,3],mt:[4,5,5]}},"ERROR CODE 404")),e.createElement(P,{start:[2,5,7,7],width:[4,4,4,4]},e.createElement(i,{sx:{width:["100%"],mt:[2,4,4,5],fill:"primary"}},e.createElement(k,{sx:{width:"100%",height:"auto"}}))))),Ce=({value:t,id:r,onClick:n,sx:o})=>e.createElement(p,{onClick:n,id:r,role:"checkbox","aria-checked":t,"aria-label":"Expand",sx:z({display:"inline-block",width:24,height:24,p:[1],cursor:"pointer",fill:"secondary",stroke:"secondary","@media (hover: hover) and (pointer: fine)":{"&:hover":{fill:"primary",stroke:"primary"}}},o)},e.createElement("svg",{viewBox:"0 0 16 16"},e.createElement("path",{d:"M8,0 V16 M0,8 H16",style:{strokeWidth:2,transition:"0.25s all",transformOrigin:"8px 8px",transform:t?"rotate(45deg)":""}}))),Se=["label","value","sx","children"],ze=t=>{let{label:r,value:n,sx:o,children:a}=t,l=M(t,Se);const c=o&&o.color?o.color:"primary",s=l&&(l.onClick||l.onDoubleClick);return e.createElement(i,z({as:s?"button":"span",role:"checkbox","aria-checked":n,"aria-label":r,sx:z({display:"inline-block",fontSize:[1,1,1,2],fontFamily:"mono",letterSpacing:"mono",cursor:s?"pointer":"inherit",color:c,backgroundColor:"transparent",borderStyle:"solid",borderColor:c,lineHeight:"body",borderWidth:"0px",borderBottomWidth:"1px",textTransform:"uppercase",userSelect:"none",transition:"opacity 0.05s",pt:["1px"],pb:["2px"],px:[0],m:[0],opacity:null==n||n?1:"primary"==c?.24:.33},o)},l),a)},Me=["values","setValues","label","colors","showAll","multiSelect"],Ae={label:{fontFamily:"mono",letterSpacing:"mono",fontSize:[1,1,1,2],color:"secondary",userSelect:"none",textTransform:"uppercase"}},Le=(e,t,r={})=>Object.keys(e).reduce((e,n)=>Object.assign(e,{[n]:r[n]||t}),{}),We=e=>Object.keys(e).filter(t=>e[t]).length==Object.keys(e).length,Te=({values:e,multiSelect:t,setValues:r,value:n})=>{const o=We(e),a="all"===n;let l;t?l=a&&!o?Le(e,!0):a&&o?Le(e,!1):z({},e,{[n]:!e[n]}):a&&!o?l=Le(e,!0):a&&o||(l=Le(e,!1,{[n]:!0})),l&&r(l)},Fe=t=>{let{values:r,setValues:n,label:o,colors:a,showAll:l=!1,multiSelect:c=!1}=t,s=M(t,Me);return e.createElement(i,s,o&&e.createElement(i,{sx:Ae.label},o),e.createElement(i,{sx:{mt:o?[3]:0}},l&&e.createElement(ze,{onClick:()=>Te({values:r,multiSelect:c,setValues:n,value:"all"}),value:We(r),sx:{mr:[2]}},"All"),Object.keys(r).map((t,o)=>e.createElement(ze,{onClick:()=>Te({values:r,multiSelect:c,setValues:n,value:t}),onDoubleClick:()=>Te({values:r,multiSelect:!1,setValues:n,value:t}),key:o,value:r[t],sx:{width:"max-content",color:a?a[t]:"primary",mr:[2],mb:[1]}},t))))},Be={xs:[1],sm:[3],md:[5],lg:[7],xl:[9]},Ie=({children:t,direction:r="vertical",spacing:n="md"})=>{let o;if("string"==typeof n?o=Be[n]:"number"==typeof n?o=[n]:Array.isArray(n)&&n.every(e=>"number"==typeof e)&&(o=n),!o)throw new Error("Invalid spacing size. Must be numeric value(s) or one of xs, sm, md, lg, or xl");if(!["horizontal","vertical"].includes(r))throw new Error("Invalid direction value. Must be either horizontal or vertical");const a="vertical"===r?"mt":"ml",l="horizontal"===r?{display:"inline-block"}:{};return e.createElement(i,null,e.Children.map(t,(t,r)=>e.createElement(i,{sx:z({[a]:r>0?o:0},l)},t)))},De=({children:t,variant:r="h1"})=>{let n;return"h1"===r&&(n=[4,"27px","42px","54px"]),"h2"===r&&(n=[4,4,"14px","54px"]),e.createElement(e.Fragment,null,e.createElement(P,{start:[1,4,8,8],width:[1,1,1,1]},e.createElement(i,{sx:{mt:n,fontFamily:"faux",letterSpacing:"faux",fontSize:[2,2,2,3],textAlign:"right"}},"/")),e.createElement(P,{start:[2,5,9,9],width:[3,3,2,2]},e.createElement(i,{sx:{mt:n,fontFamily:"faux",letterSpacing:"faux",fontSize:[2,2,2,3],height:["100%","0px","0px","0px"]}},t)))},Oe=({children:t,sidenote:r,description:n,descriptionStart:o=[1,3,5,5],descriptionWidth:a=[5,5,5,4],sx:l})=>e.createElement(U,{sx:{mt:[5,6,7,8],mb:[5,6,7,8]}},e.createElement(P,{start:[1,1,2,2],width:[6,2,3,3]},e.createElement(i,{as:"h1",variant:"styles.h1",sx:z({my:[0,0,0,0]},l)},t)),r&&e.createElement(De,null,r),n&&e.createElement(P,{start:o,width:a},e.createElement(i,{sx:{mt:[4,"5px","20px","31px"],fontSize:[2,2,2,3]}},n))),$e=["size","inverted","sx"];var Re=t((t,r)=>{let{size:n="sm",inverted:o,sx:a}=t,l=M(t,$e);const i=z({color:o?"secondary":"primary",borderColor:"secondary",borderStyle:"solid",borderWidth:"0px",borderBottomWidth:"1px",borderRadius:"0px",transition:"border 0.15s",borderBottomWidth:"1px",width:"calc(min(15ch, 100%))",p:[0],py:["2px"],"input::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0},"input::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},":focus":{borderColor:"primary"},":focus-visible":{outline:"none !important",background:"none !important"}},F(n),a);return e.createElement(g,z({},l,{ref:r,sx:i}))});const He=["children","size","sx","sxSelect"],_e=t=>{let{children:r,size:o="sm",sx:a,sxSelect:l}=t,c=M(t,He);const s=a&&a.color?a.color:"primary",m=F(o),p=n(null),{onChange:d}=c,x=(h=e=>"onChange"!==e,e=>{const t={};for(const r in e)h(r||"")&&(t[r]=e[r]);return t})(c);var h;if(!["xs","sm","md"].includes(o))throw new Error("Size must be xs, sm, or md");let u,f,g,y,b;return"xs"===o&&(f=[14,14,14,16],g=[14,14,14,14],b=["1px"],y=["-14px","-14px","-14px","-16px"]),"sm"===o&&(f=[15,15,15,20],g=[15,15,15,20],b=["1px"],y=["-16px","-16px","-16px","-20px"]),"md"===o&&(f=[20,20,20,20],g=[20,20,20,20],b=["2px"],y=["-20px","-20px","-20px","-20px"]),u=g.map(e=>e+12),e.createElement(i,{sx:z({display:"inline-block"},a)},e.createElement(i,z({as:"select",ref:p,onChange:e=>{p.current.blur(),d&&d(e)},sx:z({},m,{lineHeight:"normal",cursor:"pointer",WebkitAppearance:"none",MozAppearance:"none",pb:["5px"],bg:"transparent",pr:u,border:"none",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"primary",borderRadius:"0px",color:"text",width:"fit-content",color:s,userSelect:"none","@media (hover: none) and (pointer: coarse)":{"&:focus-visible":{outline:"none !important",background:"transparent !important"}}},l)},x),r),e.createElement(w,{sx:{width:g,height:f,position:"relative",ml:y,top:b,fill:"secondary",transform:"rotate(135deg)",pointerEvents:"none"}}))},je=["sx"];var Ve=t((t,r)=>{let{sx:n}=t,o=M(t,je);const a=n&&n.color?n.color:"primary",{theme:{rawColors:l}}=h();return e.createElement(y,z({ref:r,sx:z({"&::-webkit-slider-thumb":{height:[22,18,16],width:[22,18,16],boxShadow:`0 0 0 0px ${l.secondary}`,transition:"box-shadow .15s ease"},"&::-moz-range-thumb":{height:[22,18,16],width:[22,18,16],boxShadow:`0 0 0 0px ${l.secondary}`,transition:"box-shadow .15s ease"},":focus-visible":{outline:"none !important",background:`${l.secondary} !important`},":focus":{color:a,"&::-webkit-slider-thumb":{boxShadow:`0 0 0 4px ${l.secondary}`},"&::-moz-range-thumb":{boxShadow:`0 0 0 4px ${l.secondary}`}},color:a},n)},o))});const Ne={reset:{verticalAlign:"baseline",border:0,outline:0,margin:0,padding:0},row:{borderStyle:"solid",borderWidth:"0px",borderTopWidth:"1px",borderColor:"muted",pt:[3,3,3,"20px"],pb:[3,3,3,"20px"],mb:["2px"]},header:{display:"block",textTransform:"uppercase",letterSpacing:"smallcaps",fontFamily:"heading",fontSize:[2,2,2,3]},index:{display:"block",textTransform:"uppercase",letterSpacing:"smallcaps",fontFamily:"heading",fontSize:[2,2,2,3]},entry:{display:"block",fontSize:[2,2,2,3],fontFamily:"faux",letterSpacing:"faux",mb:["1px"],mt:[2,0,0,0]}},Pe=({data:t,sx:r,color:n,header:o,columns:a,start:l,width:c,index:s=!0,borderBottom:m=!0,borderTop:p=!0})=>{if(!l||!a||!c)throw new Error("Must provide columns, start, and width");return e.createElement(i,{as:"table",sx:z({display:"block"},r)},e.createElement(i,{as:"tbody",sx:{display:"block"}},o&&e.createElement(U,{as:"tr",sx:z({},Ne.reset,Ne.header,Ne.row,{color:n,borderTopWidth:p?"1px":"0px"})},e.createElement(P,{as:"td",start:[1],width:a,sx:Ne.index},o)),t.map((r,n)=>e.createElement(U,{as:"tr",columns:a,key:n,sx:z({},Ne.reset,Ne.row,{pb:m&&n===t.length-1?["18px","18px","18px","22px"]:[3,3,3,"20px"],borderBottomWidth:m&&n===t.length-1?"1px":"0px",borderTopWidth:p||0!==n||o?"1px":"0px"})},r.map((t,r)=>e.createElement(P,{as:"td",key:r,start:l[r],width:c[r],sx:z({},Ne.reset,0==r&&s?Ne.index:Ne.entry)},t))))))},Ge=["value","onClick","disabled","sx"];var Ye=t((t,r)=>{let{value:n,onClick:o,disabled:a,sx:l}=t,c=M(t,Ge);const s=l&&l.color?l.color:"primary";return n=!a&&n,e.createElement(i,z({ref:r,as:"button",onClick:o,role:"checkbox","aria-checked":n,"aria-label":"Toggle",sx:z({border:"none",background:"none",cursor:a?"default":"pointer",p:[0],m:[0],display:"inline-block"},l)},c),e.createElement(i,{sx:{width:"50px",height:"20px",borderRadius:"20px",backgroundColor:n?b(s,"primary"==s?.5:.45):"muted",position:"relative",transition:"0.15s",display:"inline-block"}},e.createElement(i,{sx:{width:"14px",height:"14px",borderRadius:"7px",position:"absolute",left:n?"32px":"4px",top:"3px",backgroundColor:n?s:"secondary",transition:"0.15s"}})))});const Xe=({id:t})=>t?e.createElement(e.Fragment,null,e.createElement("script",{async:!0,src:`https://www.googletagmanager.com/gtag/js?id=${t}`}),e.createElement("script",{dangerouslySetInnerHTML:{__html:`\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n gtag('config', '${t}', {\n page_path: window.location.pathname,\n });\n `}})):null,Ue=({expanded:t,sx:r,children:n})=>e.createElement(e.Fragment,null,e.createElement(i,{sx:{position:"fixed",top:"56px",bottom:"0px",left:"0px",width:"calc(100vw)",mt:["56px"],bg:"background",zIndex:1e3,transition:"opacity 0.15s",opacity:t?.9:0,pointerEvents:t?"all":"none"}}),e.createElement(i,{sx:z({position:"fixed",width:"calc(100vw)",top:"0px",mt:["56px"],pb:[6,7,7,8],pt:[5,6,7,8],bg:"background",zIndex:1100,borderStyle:"solid",borderColor:"muted",borderWidth:"0px",borderBottomWidth:"1px",transition:"transform 0.15s",ml:[-3,-4,-5,-6],pl:[3,4,5,6],pr:[3,4,5,6],transform:t?"translateY(0)":"translateY(-100%)"},r)},e.createElement(U,null,e.createElement(P,{start:[1,1,1,1],width:[6,8,10,10]},n)))),Ke={month:"short",day:"numeric",year:"numeric"},Ze=(e,t,r)=>{if(!r)return null;const n="string"==typeof r?r:Ke[t],o=e.toLocaleString("default",{[t]:n});return"numeric"===n&&"day"===t?o.padStart(2,"0"):o},qe=(e,t=Ke)=>{const r=new Date(e.replace(/-/g,"/"));return[Ze(r,"month",t.month),Ze(r,"day",t.day),Ze(r,"year",t.year)].filter(Boolean).join(" ")};export{L as Badge,I as Button,O as Callout,V as Colorbar,P as Column,ke as Custom404,le as Dimmer,Ce as Expander,he as FadeIn,Fe as Filter,oe as Footer,Ie as Group,ge as Guide,re as Header,Oe as Heading,Re as Input,ve as Layout,T as Link,Y as Logo,Z as Menu,G as Meta,ne as Monogram,U as Row,fe as Scrollbar,_e as Select,we as Settings,De as Sidenote,Ve as Slider,Pe as Table,ze as Tag,Ye as Toggle,Xe as Tracking,Ue as Tray,qe as formatDate,ue as getScrollbarWidth};
1
+ import React, { forwardRef, cloneElement, useRef, useState, useEffect, useCallback } from 'react';
2
+ import { Box, Link as Link$2, Flex, Grid, IconButton, Container, useColorMode, useThemeUI, Text, Styled, Input as Input$1, Slider as Slider$1 } from 'theme-ui';
3
+ import { transparentize } from '@theme-ui/color';
4
+ import NextLink from 'next/link';
5
+ import { Arrow, Sun } from '@carbonplan/icons';
6
+ import { PoopSad } from '@carbonplan/emoji';
7
+ import Head from 'next/head';
8
+ import { keyframes } from '@emotion/react';
9
+
10
+ function _extends() {
11
+ _extends = Object.assign || function (target) {
12
+ for (var i = 1; i < arguments.length; i++) {
13
+ var source = arguments[i];
14
+
15
+ for (var key in source) {
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
19
+ }
20
+ }
21
+
22
+ return target;
23
+ };
24
+
25
+ return _extends.apply(this, arguments);
26
+ }
27
+
28
+ function _objectWithoutPropertiesLoose(source, excluded) {
29
+ if (source == null) return {};
30
+ var target = {};
31
+ var sourceKeys = Object.keys(source);
32
+ var key, i;
33
+
34
+ for (i = 0; i < sourceKeys.length; i++) {
35
+ key = sourceKeys[i];
36
+ if (excluded.indexOf(key) >= 0) continue;
37
+ target[key] = source[key];
38
+ }
39
+
40
+ return target;
41
+ }
42
+
43
+ const _excluded$g = ["sx", "children"];
44
+
45
+ const Badge = _ref => {
46
+ let {
47
+ sx,
48
+ children
49
+ } = _ref,
50
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
51
+
52
+ const color = sx && sx.color ? sx.color : 'primary';
53
+ return /*#__PURE__*/React.createElement(Box, _extends({
54
+ sx: _extends({
55
+ display: 'inline-block',
56
+ width: 'fit-content',
57
+ height: ['24px', '24px', '24px', '26px'],
58
+ borderRadius: '5px',
59
+ backgroundColor: color == 'primary' || color == 'secondary' ? 'muted' : transparentize(color, 0.7),
60
+ textAlign: 'center',
61
+ userSelect: 'none',
62
+ fontSize: [2, 2, 2, 3]
63
+ }, sx)
64
+ }, props), /*#__PURE__*/React.createElement(Box, {
65
+ sx: {
66
+ letterSpacing: '0.02em',
67
+ fontFamily: 'mono',
68
+ mt: ['1px', '1px', '1px', '0px'],
69
+ px: [1, 1, 1, '5px'],
70
+ color: color
71
+ }
72
+ }, children));
73
+ };
74
+
75
+ const _excluded$f = ["href", "children", "internal", "tracking"];
76
+
77
+ const event = ({
78
+ action,
79
+ category,
80
+ label,
81
+ value
82
+ }) => {
83
+ if (typeof window.gtag !== 'function') {
84
+ console.warn(`Missing window.gtag, skipping analytics action: '${action}'.`);
85
+ return;
86
+ }
87
+
88
+ window.gtag('event', action, {
89
+ event_category: category,
90
+ event_label: label,
91
+ value: value
92
+ });
93
+ };
94
+
95
+ const Link = (_ref, ref) => {
96
+ let {
97
+ href,
98
+ children,
99
+ internal = false,
100
+ tracking = false
101
+ } = _ref,
102
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
103
+
104
+ if (internal || href && href.startsWith('/')) {
105
+ return /*#__PURE__*/React.createElement(NextLink, {
106
+ href: href,
107
+ passHref: true
108
+ }, /*#__PURE__*/React.createElement(Link$2, _extends({
109
+ ref: ref
110
+ }, props), children));
111
+ } else if (tracking) {
112
+ let action;
113
+ let category;
114
+
115
+ if (href && href.includes('pdf')) {
116
+ action = 'PDF';
117
+ category = 'download';
118
+ } else {
119
+ action = 'website';
120
+ category = 'external';
121
+ }
122
+
123
+ const track = e => {
124
+ event({
125
+ action: action,
126
+ category: category,
127
+ label: href
128
+ });
129
+ };
130
+
131
+ return /*#__PURE__*/React.createElement(Link$2, _extends({
132
+ ref: ref,
133
+ onClick: track,
134
+ onContextMenu: track,
135
+ href: href
136
+ }, props), children);
137
+ } else {
138
+ return /*#__PURE__*/React.createElement(Link$2, _extends({
139
+ ref: ref,
140
+ href: href
141
+ }, props), children);
142
+ }
143
+ };
144
+
145
+ var Link$1 = forwardRef(Link);
146
+
147
+ const getSizeStyles = size => {
148
+ if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
149
+ throw new Error('Size must be xs, sm, md, lg, or xl');
150
+ }
151
+
152
+ let fontSize, fontFamily, letterSpacing, lineHeight;
153
+
154
+ if (size === 'xs') {
155
+ fontSize = [2, 2, 2, 3];
156
+ fontFamily = 'body';
157
+ letterSpacing = 'body';
158
+ lineHeight = [1.2];
159
+ }
160
+
161
+ if (size === 'sm') {
162
+ fontSize = [3, 3, 3, 4];
163
+ fontFamily = 'body';
164
+ letterSpacing = 'body';
165
+ lineHeight = [1.2];
166
+ }
167
+
168
+ if (size === 'md') {
169
+ fontSize = [4, 4, 4, 5];
170
+ fontFamily = 'body';
171
+ letterSpacing = 'body';
172
+ lineHeight = [1.2];
173
+ }
174
+
175
+ if (size === 'lg') {
176
+ fontSize = [5, 5, 6, 7];
177
+ fontFamily = 'heading';
178
+ letterSpacing = 'heading';
179
+ lineHeight = [1.2, 1.2, 1.25, 1.25];
180
+ }
181
+
182
+ if (size === 'xl') {
183
+ fontSize = [6, 7, 8, 9];
184
+ fontFamily = 'heading';
185
+ letterSpacing = 'heading';
186
+ lineHeight = [1.25];
187
+ }
188
+
189
+ return {
190
+ fontSize,
191
+ fontFamily,
192
+ letterSpacing,
193
+ lineHeight
194
+ };
195
+ };
196
+
197
+ const _excluded$e = ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"];
198
+
199
+ const Button = (_ref, ref) => {
200
+ let {
201
+ size = 'sm',
202
+ prefix,
203
+ suffix,
204
+ inverted,
205
+ sx,
206
+ children,
207
+ align,
208
+ href,
209
+ internal,
210
+ tracking
211
+ } = _ref,
212
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
213
+
214
+ if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
215
+ throw new Error('Size must be xs, sm, md, lg, or xl');
216
+ }
217
+
218
+ let offset, margin, height, width, strokeWidth;
219
+ const color = sx && sx.color ? sx.color : null;
220
+ const baseColor = color || (inverted ? 'secondary' : 'primary');
221
+ const hoverColor = color ? 'primary' : inverted ? 'primary' : 'secondary';
222
+
223
+ if (size === 'xs') {
224
+ margin = ['6px', '6px', '6px', '6px'];
225
+ height = [12, 12, 12, 13];
226
+ width = [12, 12, 12, 13];
227
+ strokeWidth = [1.5, 1.5, 1.5, 1.5];
228
+ offset = {
229
+ transform: 'translateY(0.25px)'
230
+ };
231
+ }
232
+
233
+ if (size === 'sm') {
234
+ margin = ['7px', '7px', '7px', '7px'];
235
+ height = [13, 13, 13, 18];
236
+ width = [13, 13, 13, 18];
237
+ strokeWidth = [1.5, 1.5, 1.5, 2];
238
+ offset = {
239
+ transform: 'translateY(0.25px)'
240
+ };
241
+ }
242
+
243
+ if (size === 'md') {
244
+ margin = ['8px', '8px', '8px', '8px'];
245
+ height = [18, 18, 18, 24];
246
+ width = [18, 18, 18, 24];
247
+ strokeWidth = [2, 2, 2, 3];
248
+ }
249
+
250
+ if (size === 'lg') {
251
+ margin = ['10px', '10px', '12px', '16px'];
252
+ height = [24, 24, 34, 46];
253
+ width = [24, 24, 34, 46];
254
+ strokeWidth = [3, 3, 4, 5];
255
+ }
256
+
257
+ if (size === 'xl') {
258
+ margin = ['12px', '16px', '18px', '20px'];
259
+ height = [34, 46, 56, 68];
260
+ width = [34, 46, 56, 68];
261
+ strokeWidth = [4, 5, 6, 7];
262
+ }
263
+
264
+ let prefixHover, suffixHover, prefixAlign, suffixAlign, prefixOffset, suffixOffset;
265
+
266
+ if (align) {
267
+ prefixAlign = align;
268
+ suffixAlign = align;
269
+ } else {
270
+ if (prefix && suffix) {
271
+ prefixAlign = 'initial';
272
+ suffixAlign = 'initial';
273
+ } else if (prefix) {
274
+ prefixAlign = 'initial';
275
+ } else if (suffix) {
276
+ suffixAlign = 'middle';
277
+ }
278
+ }
279
+
280
+ if (prefixAlign === 'middle') {
281
+ prefixOffset = {};
282
+ } else {
283
+ prefixOffset = offset;
284
+ }
285
+
286
+ if (suffixAlign === 'middle') {
287
+ suffixOffset = {};
288
+ } else {
289
+ suffixOffset = offset;
290
+ }
291
+
292
+ if (prefix) {
293
+ prefixHover = {
294
+ '&:hover > #prefix-span > #prefix': _extends({
295
+ color: hoverColor
296
+ }, prefix.type.hover)
297
+ };
298
+ prefix = cloneElement(prefix, {
299
+ id: 'prefix',
300
+ sx: _extends({
301
+ position: 'relative',
302
+ height: height,
303
+ width: width,
304
+ mr: children ? margin : [0],
305
+ strokeWidth: strokeWidth,
306
+ verticalAlign: prefixAlign,
307
+ transition: 'color 0.15s, transform 0.15s'
308
+ }, prefix.props.sx)
309
+ });
310
+ }
311
+
312
+ if (suffix) {
313
+ suffixHover = {
314
+ '&:hover > #suffix-span >#suffix': _extends({
315
+ color: hoverColor
316
+ }, suffix.type.hover)
317
+ };
318
+ suffix = cloneElement(suffix, {
319
+ id: 'suffix',
320
+ sx: _extends({
321
+ height: height,
322
+ width: width,
323
+ ml: children ? margin : [0],
324
+ strokeWidth: strokeWidth,
325
+ verticalAlign: suffixAlign,
326
+ transition: 'color 0.15s, transform 0.15s'
327
+ }, suffix.props.sx)
328
+ });
329
+ }
330
+
331
+ let sizeStyles = getSizeStyles(size);
332
+
333
+ const style = _extends({}, sizeStyles, {
334
+ lineHeight: 1.05,
335
+ border: 'none',
336
+ background: 'transparent',
337
+ display: 'block',
338
+ color: baseColor,
339
+ padding: [0],
340
+ textAlign: 'left',
341
+ cursor: 'pointer',
342
+ width: 'fit-content',
343
+ '@media (hover: hover) and (pointer: fine)': _extends({
344
+ '&:hover': {
345
+ color: hoverColor
346
+ }
347
+ }, suffixHover, prefixHover)
348
+ }, sx);
349
+
350
+ const Inner = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
351
+ as: "span",
352
+ id: "prefix-span",
353
+ sx: _extends({
354
+ display: 'inline-block'
355
+ }, prefixOffset)
356
+ }, prefix && prefix), /*#__PURE__*/React.createElement(Box, {
357
+ as: "span",
358
+ sx: {
359
+ transition: 'color 0.15s'
360
+ }
361
+ }, children), /*#__PURE__*/React.createElement(Box, {
362
+ as: "span",
363
+ id: "suffix-span",
364
+ sx: _extends({
365
+ display: 'inline-block'
366
+ }, suffixOffset)
367
+ }, suffix && suffix));
368
+
369
+ if (href) {
370
+ return /*#__PURE__*/React.createElement(Link$1, _extends({
371
+ ref: ref,
372
+ href: href,
373
+ internal: internal,
374
+ tracking: tracking,
375
+ sx: _extends({}, style, {
376
+ textDecoration: 'none'
377
+ })
378
+ }, props), Inner);
379
+ } else {
380
+ return /*#__PURE__*/React.createElement(Box, _extends({
381
+ ref: ref,
382
+ as: "button",
383
+ sx: style
384
+ }, props), Inner);
385
+ }
386
+ };
387
+
388
+ var button = forwardRef(Button);
389
+
390
+ const _excluded$d = ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"];
391
+
392
+ const Callout = (_ref, ref) => {
393
+ let {
394
+ label,
395
+ children,
396
+ inverted,
397
+ color,
398
+ href,
399
+ internal,
400
+ tracking,
401
+ sx
402
+ } = _ref,
403
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
404
+
405
+ const baseColor = color || (inverted ? 'secondary' : 'primary');
406
+ const hoverColor = color ? 'primary' : inverted ? 'primary' : 'secondary';
407
+
408
+ const style = _extends({
409
+ border: 'none',
410
+ padding: [0],
411
+ fontSize: [3, 3, 3, 4],
412
+ color: baseColor,
413
+ background: 'transparent',
414
+ textDecoration: 'none',
415
+ fontFamily: 'body',
416
+ lineHeight: 'h3',
417
+ letterSpacing: 'body',
418
+ width: 'fit-content',
419
+ cursor: 'pointer',
420
+ textAlign: 'left',
421
+ mb: [1],
422
+ '@media (hover: hover) and (pointer: fine)': {
423
+ '&:hover > #container > #arrow': {
424
+ transform: 'rotate(45deg)',
425
+ fill: hoverColor
426
+ },
427
+ '&:hover': {
428
+ color: hoverColor
429
+ }
430
+ }
431
+ }, sx);
432
+
433
+ const Inner = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
434
+ sx: {
435
+ transition: '0.15s',
436
+ letterSpacing: 'body',
437
+ pb: ['6px']
438
+ }
439
+ }, children), /*#__PURE__*/React.createElement(Box, {
440
+ sx: {
441
+ transition: '0.15s',
442
+ display: 'inline-block',
443
+ textTransform: 'uppercase',
444
+ letterSpacing: 'smallcaps',
445
+ fontFamily: 'heading',
446
+ fontSize: [2, 2, 2, 3]
447
+ }
448
+ }, label), /*#__PURE__*/React.createElement(Box, {
449
+ as: "span",
450
+ id: "container",
451
+ sx: {
452
+ ml: [2],
453
+ display: 'inline-block'
454
+ }
455
+ }, /*#__PURE__*/React.createElement(Arrow, {
456
+ id: "arrow",
457
+ sx: {
458
+ transition: 'fill 0.15s, transform 0.15s',
459
+ position: 'relative',
460
+ top: ['2px'],
461
+ color: baseColor,
462
+ height: [15, 15, 15, 17],
463
+ width: [15, 15, 15, 17]
464
+ }
465
+ })));
466
+
467
+ if (href) {
468
+ return /*#__PURE__*/React.createElement(Link$1, _extends({
469
+ ref: ref,
470
+ href: href,
471
+ internal: internal,
472
+ tracking: tracking,
473
+ sx: style
474
+ }, props), Inner);
475
+ } else {
476
+ return /*#__PURE__*/React.createElement(Box, _extends({
477
+ ref: ref,
478
+ as: "button",
479
+ sx: style
480
+ }, props), Inner);
481
+ }
482
+ };
483
+
484
+ var callout = forwardRef(Callout);
485
+
486
+ const _excluded$c = ["colormap", "label", "clim", "setClim", "setClimStep", "discrete", "units", "width", "height", "format", "horizontal", "bottom", "sx", "sxClim"];
487
+ const styles$1 = {
488
+ clim: setClim => {
489
+ return {
490
+ fontFamily: 'mono',
491
+ fontSize: ['9px', 0, 0, 1],
492
+ letterSpacing: 'smallcaps',
493
+ textTransform: 'uppercase',
494
+ '@media (hover: hover) and (pointer: fine)': {
495
+ '&:hover': {
496
+ borderBottom: setClim ? ({
497
+ colors
498
+ }) => `solid 1px ${colors.primary} !important` : 'unset'
499
+ }
500
+ },
501
+ '&:focus': {
502
+ outline: 'none',
503
+ borderBottom: setClim ? ({
504
+ colors
505
+ }) => `solid 1px ${colors.primary} !important` : 'unset'
506
+ },
507
+ transition: 'border 0.15s',
508
+ userSelect: setClim ? 'none !important' : 'unset',
509
+ width: 'fit-content',
510
+ minWidth: 'fit-content'
511
+ };
512
+ }
513
+ };
514
+ const DIMENSIONS = {
515
+ width: ['10px', '16px', '16px', '17px'],
516
+ height: ['80px', '110px', '110px', '130px']
517
+ };
518
+
519
+ const Gradient = ({
520
+ colormap,
521
+ discrete,
522
+ horizontal,
523
+ width,
524
+ height
525
+ }) => {
526
+ const step = 1 / colormap.length * 100;
527
+ const values = colormap.map((d, i) => {
528
+ return `rgb(${d}) ${i * step}% ${discrete && i < colormap.length - 1 ? `${(i + 1) * step}%` : ''}`;
529
+ });
530
+ const css = `linear-gradient(to ${horizontal ? 'right' : 'top'}, ${values.join(',')})`;
531
+ return /*#__PURE__*/React.createElement(Box, {
532
+ sx: _extends({}, horizontal ? {
533
+ width: width || DIMENSIONS.height,
534
+ height: height || DIMENSIONS.width
535
+ } : {
536
+ width: width || DIMENSIONS.width,
537
+ minHeight: height || DIMENSIONS.height
538
+ }, {
539
+ mt: horizontal ? ['1px', '1px', '1px', 0] : 0,
540
+ border: ({
541
+ colors
542
+ }) => `solid 1px ${colors.hinted}`,
543
+ background: css
544
+ })
545
+ });
546
+ };
547
+
548
+ const Label = ({
549
+ label,
550
+ units,
551
+ horizontal
552
+ }) => /*#__PURE__*/React.createElement(Box, {
553
+ sx: !horizontal && {
554
+ width: ['13px', '17px', '17px', '19px'],
555
+ alignSelf: 'flex-end'
556
+ }
557
+ }, /*#__PURE__*/React.createElement(Box, {
558
+ sx: _extends({
559
+ mb: horizontal ? 0 : ['-4px', '-4px', '-4px', '-3px'],
560
+ fontFamily: 'mono',
561
+ fontSize: ['9px', 0, 0, 1],
562
+ letterSpacing: 'smallcaps',
563
+ textTransform: 'uppercase'
564
+ }, horizontal ? {} : {
565
+ writingMode: 'vertical-rl',
566
+ transform: 'rotate(180deg)',
567
+ whiteSpace: 'nowrap',
568
+ display: 'inline-block',
569
+ overflow: 'visible'
570
+ })
571
+ }, label, ' ', /*#__PURE__*/React.createElement(Box, {
572
+ as: "span",
573
+ sx: {
574
+ textTransform: 'none',
575
+ color: 'secondary',
576
+ display: 'inline-block'
577
+ }
578
+ }, units)));
579
+
580
+ const Colorbar = _ref => {
581
+ let {
582
+ colormap,
583
+ label,
584
+ clim,
585
+ setClim,
586
+ setClimStep = 1,
587
+ discrete,
588
+ units,
589
+ width,
590
+ height,
591
+ format = d => d,
592
+ horizontal = false,
593
+ bottom = false,
594
+ sx,
595
+ sxClim
596
+ } = _ref,
597
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
598
+
599
+ if (!Array.isArray(colormap)) {
600
+ throw new Error(`expected array for colormap, got '${colormap}'.`);
601
+ }
602
+
603
+ const climRef = [useRef(), useRef()];
604
+ const [climMinDragging, setClimMinDragging] = useState(false);
605
+ const [climMaxDragging, setClimMaxDragging] = useState(false);
606
+ let x,
607
+ y,
608
+ dx,
609
+ dy = 0;
610
+ let id = null;
611
+ let init = [0, 0];
612
+ let scale = setClimStep;
613
+
614
+ const draggingFunction = e => {
615
+ if (id === 'min' && !climMinDragging) setClimMinDragging(true);
616
+ if (id === 'max' && !climMaxDragging) setClimMaxDragging(true);
617
+ dx = e.pageX - x;
618
+ dy = e.pageY - y;
619
+
620
+ if (horizontal) {
621
+ if (id === 'min') setClim(prev => [Math.min(init[0] + dx * scale, init[1]), prev[1]]);
622
+ if (id === 'max') setClim(prev => [prev[0], Math.max(init[1] + dx * scale, init[0])]);
623
+ } else {
624
+ if (id === 'min') setClim(prev => [Math.min(init[0] - dy * scale, init[1]), prev[1]]);
625
+ if (id === 'max') setClim(prev => [prev[0], Math.max(init[1] - dy * scale, init[0])]);
626
+ }
627
+ };
628
+
629
+ const handleMouseDown = e => {
630
+ y = e.pageY;
631
+ x = e.pageX;
632
+ id = e.target.id;
633
+ init = clim;
634
+ document.body.setAttribute('style', horizontal ? 'cursor: ew-resize !important' : 'cursor: ns-resize !important');
635
+ document.addEventListener('mousemove', draggingFunction);
636
+
637
+ const updater = () => {
638
+ document.body.setAttribute('style', 'cursor: unset');
639
+ document.removeEventListener('mousemove', draggingFunction);
640
+ window.removeEventListener('mouseup', updater);
641
+ if (id === 'min') setClimMinDragging(false);
642
+ if (id === 'max') setClimMaxDragging(false);
643
+ };
644
+
645
+ window.addEventListener('mouseup', updater);
646
+ };
647
+
648
+ const increment = e => {
649
+ if (climRef[0].current === document.activeElement) {
650
+ e.preventDefault();
651
+ setClim(prev => [Math.min(prev[0] + scale, prev[1]), prev[1]]);
652
+ climRef[0].current.focus();
653
+ }
654
+
655
+ if (climRef[1].current === document.activeElement) {
656
+ e.preventDefault();
657
+ setClim(prev => [prev[0], Math.max(prev[1] + scale, prev[0])]);
658
+ climRef[1].current.focus();
659
+ }
660
+ };
661
+
662
+ const decrement = e => {
663
+ if (climRef[0].current === document.activeElement) {
664
+ e.preventDefault();
665
+ setClim(prev => [Math.min(prev[0] - scale, prev[1]), prev[1]]);
666
+ climRef[0].current.focus();
667
+ }
668
+
669
+ if (climRef[1].current === document.activeElement) {
670
+ e.preventDefault();
671
+ setClim(prev => [prev[0], Math.max(prev[1] - scale, prev[0])]);
672
+ climRef[1].current.focus();
673
+ }
674
+ };
675
+
676
+ useEffect(() => {
677
+ const listener = e => {
678
+ if (['ArrowUp', 'ArrowRight'].includes(e.code) || ['ArrowUp', 'ArrowRight'].includes(e.key)) {
679
+ increment(e);
680
+ }
681
+
682
+ if (['ArrowDown', 'ArrowLeft'].includes(e.code) || ['ArrowDown', 'ArrowLeft'].includes(e.key)) {
683
+ decrement(e);
684
+ }
685
+ };
686
+
687
+ window.addEventListener('keydown', listener);
688
+ return () => {
689
+ window.removeEventListener('keydown', listener);
690
+ };
691
+ }, [clim]);
692
+
693
+ const ClimMin = () => {
694
+ return /*#__PURE__*/React.createElement(Box, {
695
+ id: "min",
696
+ ref: climRef[0],
697
+ tabIndex: 0,
698
+ sx: _extends({}, styles$1.clim(setClim), {
699
+ ml: label ? horizontal ? bottom ? '0px' : '10px' : ['2px', '1px', '1px', '2px'] : 0,
700
+ mr: horizontal ? ['2px', '1px', '1px', '2px'] : 0,
701
+ mb: horizontal ? 0 : ['-2px', '-2px', '-2px', '-3px'],
702
+ borderBottom: setClim ? climMinDragging ? ({
703
+ colors
704
+ }) => `solid 1px ${colors.primary}` : ({
705
+ colors
706
+ }) => `solid 1px ${colors.secondary}` : 'unset',
707
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
708
+ }, sxClim),
709
+ onMouseDown: setClim ? handleMouseDown : () => {},
710
+ onClick: () => climRef[0].current.focus()
711
+ }, format(clim[0]));
712
+ };
713
+
714
+ const ClimMax = () => {
715
+ return /*#__PURE__*/React.createElement(Box, {
716
+ id: "max",
717
+ ref: climRef[1],
718
+ tabIndex: 0,
719
+ sx: _extends({}, styles$1.clim(setClim), {
720
+ ml: horizontal ? ['2px', '1px', '1px', '2px'] : ['2px', '1px', '1px', '2px'],
721
+ mt: horizontal ? 0 : ['-2px', '-3px', '-3px', '-3px'],
722
+ borderBottom: setClim ? climMaxDragging ? ({
723
+ colors
724
+ }) => `solid 1px ${colors.primary}` : ({
725
+ colors
726
+ }) => `solid 1px ${colors.secondary}` : 'unset',
727
+ cursor: setClim ? horizontal ? 'ew-resize' : 'ns-resize' : 'default'
728
+ }, sxClim),
729
+ onMouseDown: setClim ? handleMouseDown : () => {},
730
+ onClick: () => climRef[1].current.focus()
731
+ }, format(clim[1]));
732
+ };
733
+
734
+ return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
735
+ sx: _extends({
736
+ flexDirection: 'row',
737
+ alignItems: 'start',
738
+ justifyContent: 'flex-start',
739
+ gap: ['3px', '6px', '6px', '7px'],
740
+ height: !horizontal ? '100%' : 'unset'
741
+ }, sx)
742
+ }), label && /*#__PURE__*/React.createElement(Label, {
743
+ label: label,
744
+ units: units,
745
+ horizontal: horizontal
746
+ }), /*#__PURE__*/React.createElement(Flex, {
747
+ sx: {
748
+ flexGrow: horizontal ? 1 : 'unset',
749
+ flexDirection: 'column',
750
+ ml: bottom && label ? '4px' : '0px',
751
+ height: !horizontal ? '100%' : 'unset'
752
+ }
753
+ }, /*#__PURE__*/React.createElement(Flex, {
754
+ sx: {
755
+ gap: ['3px', '6px', '6px', '7px'],
756
+ height: !horizontal ? '100%' : 'unset'
757
+ }
758
+ }, horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(Gradient, {
759
+ colormap: colormap,
760
+ horizontal: horizontal,
761
+ discrete: discrete,
762
+ width: width,
763
+ height: height
764
+ }), horizontal && clim && !bottom && /*#__PURE__*/React.createElement(ClimMax, null)), horizontal && clim && bottom && /*#__PURE__*/React.createElement(Flex, {
765
+ sx: {
766
+ justifyContent: 'space-between'
767
+ }
768
+ }, /*#__PURE__*/React.createElement(ClimMin, null), /*#__PURE__*/React.createElement(ClimMax, null))), !horizontal && /*#__PURE__*/React.createElement(Flex, {
769
+ sx: {
770
+ flexDirection: 'column-reverse',
771
+ justifyContent: 'space-between',
772
+ height: height || DIMENSIONS.height
773
+ }
774
+ }, clim && /*#__PURE__*/React.createElement(ClimMin, null), clim && /*#__PURE__*/React.createElement(ClimMax, null)));
775
+ };
776
+
777
+ const _excluded$b = ["start", "width", "dl", "dr", "children", "sx"];
778
+
779
+ const Column = _ref => {
780
+ let {
781
+ start,
782
+ width,
783
+ dl,
784
+ dr,
785
+ children,
786
+ sx
787
+ } = _ref,
788
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
789
+
790
+ start = start || 'auto';
791
+ width = width || 'auto';
792
+
793
+ const makeArray = input => {
794
+ if (input && !Array.isArray(input)) {
795
+ input = [input];
796
+ }
797
+
798
+ if (![1, 2, 4].includes(input.length)) {
799
+ throw new Error('Array length must be 1, 2, or 4');
800
+ }
801
+
802
+ if (Array.isArray(input) && input.length == 1) {
803
+ input = input.map(d => [d, d, d, d]).flat();
804
+ } else if (Array.isArray(input) && input.length == 2) {
805
+ input = input.map(d => [d, d]).flat();
806
+ }
807
+
808
+ return input;
809
+ };
810
+
811
+ start = makeArray(start);
812
+ width = makeArray(width);
813
+ const end = start.map((d, i) => {
814
+ if (d == 'auto') return 'auto';
815
+ return d + width[i];
816
+ });
817
+ let ml, mr;
818
+
819
+ if (dl) {
820
+ if (![0.5, 1].includes(dl)) {
821
+ throw new Error('dl must be 0.5 or 1');
822
+ }
823
+
824
+ if (dl === 0.5) {
825
+ ml = ['-12px', -3, -3, -4];
826
+ }
827
+
828
+ if (dl === 1) {
829
+ ml = [-4, -5, -5, -6];
830
+ }
831
+ }
832
+
833
+ if (dr) {
834
+ if (![0.5, 1].includes(dr)) {
835
+ throw new Error('dr must be 0.5 or 1');
836
+ }
837
+
838
+ if (dr === 0.5) {
839
+ mr = ['-12px', -3, -3, -4];
840
+ }
841
+
842
+ if (dr === 1) {
843
+ mr = [-4, -5, -5, -6];
844
+ }
845
+ }
846
+
847
+ return /*#__PURE__*/React.createElement(Box, _extends({}, props, {
848
+ sx: _extends({
849
+ gridColumnStart: start,
850
+ gridColumnEnd: end,
851
+ ml: ml,
852
+ mr: mr
853
+ }, sx)
854
+ }), children);
855
+ };
856
+
857
+ const Meta = ({
858
+ title,
859
+ description,
860
+ card
861
+ }) => {
862
+ title = title ? title : 'carbonplan';
863
+ description = description ? description : 'Data and science for climate action.';
864
+ card = card ? card : 'https://images.carbonplan.org/social/homepage.png';
865
+ return /*#__PURE__*/React.createElement(Head, null, /*#__PURE__*/React.createElement("title", null, title), /*#__PURE__*/React.createElement("meta", {
866
+ name: "description",
867
+ content: description
868
+ }), /*#__PURE__*/React.createElement("meta", {
869
+ name: "viewport",
870
+ content: "initial-scale=1.0, width=device-width"
871
+ }), /*#__PURE__*/React.createElement("link", {
872
+ rel: "canonical",
873
+ content: "https://carbonplan.org/"
874
+ }), /*#__PURE__*/React.createElement("link", {
875
+ rel: "icon",
876
+ type: "image/svg+xml",
877
+ href: "https://images.carbonplan.org/favicon.svg"
878
+ }), /*#__PURE__*/React.createElement("link", {
879
+ rel: "preload",
880
+ href: "https://fonts.carbonplan.org/relative/relative-book-pro.woff2",
881
+ as: "font",
882
+ type: "font/woff2",
883
+ crossOrigin: "anonymous"
884
+ }), /*#__PURE__*/React.createElement("link", {
885
+ rel: "preload",
886
+ href: "https://fonts.carbonplan.org/relative/relative-medium-pro.woff2",
887
+ as: "font",
888
+ type: "font/woff2",
889
+ crossOrigin: "anonymous"
890
+ }), /*#__PURE__*/React.createElement("link", {
891
+ rel: "preload",
892
+ href: "https://fonts.carbonplan.org/relative/relative-mono-11-pitch-pro.woff2",
893
+ as: "font",
894
+ type: "font/woff2",
895
+ crossOrigin: "anonymous"
896
+ }), /*#__PURE__*/React.createElement("link", {
897
+ rel: "preload",
898
+ href: "https://fonts.carbonplan.org/relative/relative-faux-book-pro.woff2",
899
+ as: "font",
900
+ type: "font/woff2",
901
+ crossOrigin: "anonymous"
902
+ }), /*#__PURE__*/React.createElement("link", {
903
+ rel: "manifest",
904
+ href: "https://images.carbonplan.org/manifest.json"
905
+ }), /*#__PURE__*/React.createElement("meta", {
906
+ name: "theme-color",
907
+ content: "#1b1e23"
908
+ }), /*#__PURE__*/React.createElement("link", {
909
+ rel: "alternate icon",
910
+ type: "image/png",
911
+ href: "https://images.carbonplan.org/favicon.png"
912
+ }), /*#__PURE__*/React.createElement("link", {
913
+ rel: "mask-icon",
914
+ href: "https://images.carbonplan.org/safari-pinned-tab.svg",
915
+ color: "#000000"
916
+ }), /*#__PURE__*/React.createElement("link", {
917
+ rel: "apple-touch-icon",
918
+ sizes: "180x180",
919
+ href: "https://images.carbonplan.org/apple-touch-icon.png"
920
+ }), /*#__PURE__*/React.createElement("meta", {
921
+ name: "msapplication-TileColor",
922
+ content: "#1b1e23"
923
+ }), /*#__PURE__*/React.createElement("meta", {
924
+ name: "msapplication-TileImage",
925
+ content: "https://images.carbonplan.org/mstile-144x144.png"
926
+ }), /*#__PURE__*/React.createElement("meta", {
927
+ name: "msapplication-config",
928
+ content: "https://images.carbonplan.org/browserconfig.xml"
929
+ }), /*#__PURE__*/React.createElement("meta", {
930
+ property: "og:title",
931
+ content: title
932
+ }), /*#__PURE__*/React.createElement("meta", {
933
+ property: "og:description",
934
+ content: description
935
+ }), /*#__PURE__*/React.createElement("meta", {
936
+ property: "og:image",
937
+ content: card
938
+ }), /*#__PURE__*/React.createElement("meta", {
939
+ property: "og:url",
940
+ content: "https://carbonplan.org"
941
+ }), /*#__PURE__*/React.createElement("meta", {
942
+ name: "twitter:title",
943
+ content: title
944
+ }), /*#__PURE__*/React.createElement("meta", {
945
+ name: "twitter:description",
946
+ content: description
947
+ }), /*#__PURE__*/React.createElement("meta", {
948
+ name: "twitter:image",
949
+ content: card
950
+ }), /*#__PURE__*/React.createElement("meta", {
951
+ name: "twitter:card",
952
+ content: "summary_large_image"
953
+ }));
954
+ };
955
+
956
+ const Logo = _ref => {
957
+ let props = _extends({}, _ref);
958
+
959
+ return /*#__PURE__*/React.createElement(Box, _extends({
960
+ as: "svg",
961
+ width: "150",
962
+ fill: "currentColor",
963
+ stroke: "none",
964
+ viewBox: "0 0 151.1 28.8"
965
+ }, props), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
966
+ d: "M9.7,20.1c-1.3-1.4-2-3.1-2-5.2c0-2.1,0.7-3.9,2-5.2c1.3-1.4,3-2,5.1-2c1.7,0,3.1,0.4,4.3,1.3 c1.1,0.9,1.8,2.1,2.1,3.5c0,0.1,0,0.2,0,0.3s-0.1,0.2-0.2,0.2h-2.3c-0.2,0-0.3-0.1-0.4-0.2c-0.3-0.8-0.7-1.4-1.3-1.8 c-0.6-0.4-1.4-0.6-2.2-0.6c-1.3,0-2.3,0.4-3,1.2c-0.8,0.8-1.1,1.9-1.1,3.4c0,1.5,0.4,2.6,1.1,3.4c0.8,0.8,1.8,1.2,3,1.2 c0.8,0,1.6-0.2,2.2-0.6c0.6-0.4,1.1-1,1.3-1.8c0.1-0.2,0.2-0.2,0.4-0.3H21c0.1,0,0.2,0.1,0.2,0.2c0,0.1,0,0.2,0,0.3 c-0.3,1.4-1,2.6-2.1,3.5c-1.1,0.9-2.5,1.3-4.3,1.3C12.7,22.1,11,21.4,9.7,20.1z"
967
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
968
+ d: "M22.5,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1 c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3 c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1C30.6,7.6,32,8.1,33,9c1,0.9,1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6 c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2 C23,20.1,22.5,19,22.5,17.6z M25.4,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9 c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C25.7,16.3,25.4,16.8,25.4,17.5z"
969
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
970
+ d: "M37,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.1c1-1.1,2.3-1.6,3.7-1.6 c0.8,0,1.7,0.1,2.5,0.4c0.2,0.1,0.3,0.3,0.3,0.5v2.2c0,0.2-0.1,0.3-0.2,0.3c0,0-0.1,0-0.2-0.1c-1.1-0.5-2-0.8-2.9-0.8 c-0.9,0-1.7,0.4-2.3,1.1c-0.6,0.7-0.9,1.7-0.9,3v7.3c0,0.2-0.1,0.3-0.3,0.3h-2.2C37.1,21.8,37,21.7,37,21.6z"
971
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
972
+ d: "M47.6,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3H50c0.2,0,0.3,0.1,0.3,0.3v6.5c1.3-1.1,2.7-1.6,4.3-1.6 c1.9,0,3.4,0.7,4.6,2c1.1,1.3,1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.8,0-3.2-0.5-4.3-1.6v1 c0,0.2-0.1,0.3-0.3,0.3h-2.2C47.7,21.8,47.6,21.7,47.6,21.6z M51.2,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3 s1.7,1.3,2.9,1.3c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3 C52.9,10.2,51.9,10.7,51.2,11.5z"
973
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
974
+ d: "M64.3,20.1c-1.4-1.4-2.1-3.1-2.1-5.2c0-2.1,0.7-3.9,2.1-5.2c1.4-1.4,3.1-2,5.2-2c2.1,0,3.8,0.7,5.2,2 c1.4,1.4,2.1,3.1,2.1,5.2c0,2.1-0.7,3.9-2.1,5.2c-1.4,1.4-3.1,2-5.2,2C67.4,22.1,65.7,21.4,64.3,20.1z M66.4,11.5 c-0.8,0.8-1.2,2-1.2,3.4c0,1.4,0.4,2.5,1.2,3.4s1.9,1.3,3.1,1.3c1.3,0,2.3-0.4,3.1-1.3c0.8-0.8,1.2-2,1.2-3.4 c0-1.4-0.4-2.5-1.2-3.4c-0.8-0.8-1.9-1.3-3.1-1.3C68.2,10.2,67.2,10.7,66.4,11.5z"
975
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
976
+ d: "M78.7,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8 c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1 c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C78.7,21.8,78.7,21.7,78.7,21.6z"
977
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
978
+ d: "M101.7,27.1V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1c1.1-1.1,2.5-1.6,4.3-1.6 c1.9,0,3.4,0.7,4.6,2s1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.5,0-3-0.5-4.3-1.6v6.6c0,0.2-0.1,0.3-0.3,0.3 H102C101.8,27.3,101.7,27.2,101.7,27.1z M105.3,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3s1.7,1.3,2.9,1.3 c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3C107,10.2,106,10.7,105.3,11.5z"
979
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
980
+ d: "M117.2,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v18.9c0,0.2-0.1,0.3-0.3,0.3h-2.2 C117.3,21.8,117.2,21.7,117.2,21.6z"
981
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
982
+ d: "M122,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1 c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3 c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1c1.7,0,3.1,0.5,4.2,1.4s1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6 c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2 C122.5,20.1,122,19,122,17.6z M124.9,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9 c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C125.2,16.3,124.9,16.8,124.9,17.5z"
983
+ })), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
984
+ d: "M136.9,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8 c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1 c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C137,21.8,136.9,21.7,136.9,21.6z"
985
+ })), /*#__PURE__*/React.createElement("path", {
986
+ d: "M97.6,14.9c0,4.2-0.6,8.3-1.6,12.3c0,0.1-0.1,0.2-0.2,0.2h-2.4c-0.1,0-0.2-0.1-0.2-0.3c1.1-3.9,1.7-8,1.7-12.2 s-0.6-8.3-1.7-12.2c0-0.1,0.1-0.3,0.2-0.3l2.4,0c0.1,0,0.2,0.1,0.2,0.2C97.1,6.5,97.6,10.6,97.6,14.9z"
987
+ }), /*#__PURE__*/React.createElement("path", {
988
+ d: "M1.4,14.9C1.4,10.6,2,6.5,3,2.6c0-0.1,0.1-0.2,0.2-0.2l2.4,0c0.1,0,0.2,0.1,0.2,0.3c-1.1,3.9-1.7,8-1.7,12.2 s0.6,8.3,1.7,12.2c0,0.1-0.1,0.3-0.2,0.3H3.3c-0.1,0-0.2-0.1-0.2-0.2C2,23.2,1.4,19.1,1.4,14.9z"
989
+ })));
990
+ };
991
+
992
+ const _excluded$a = ["children", "sx", "columns", "gap"];
993
+
994
+ const Row = _ref => {
995
+ let {
996
+ children,
997
+ sx,
998
+ columns,
999
+ gap
1000
+ } = _ref,
1001
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
1002
+
1003
+ const makeArray = input => {
1004
+ if (!Array.isArray(input)) {
1005
+ input = [input, input, input, input];
1006
+ }
1007
+
1008
+ if (Array.isArray(input) && ![1, 2, 4].includes(input.length)) {
1009
+ throw new Error('Array length must be 1, 2, or 4');
1010
+ }
1011
+
1012
+ if (Array.isArray(input) && input.length == 1) {
1013
+ input = input.map(d => [d]).flat();
1014
+ }
1015
+
1016
+ if (Array.isArray(input) && input.length == 2) {
1017
+ input = input.map(d => [d, d]).flat();
1018
+ }
1019
+
1020
+ return input;
1021
+ };
1022
+
1023
+ let columnGap, rowGap;
1024
+
1025
+ if (Number.isInteger(gap) || Array.isArray(gap)) {
1026
+ gap = makeArray(gap);
1027
+ columnGap = gap;
1028
+ rowGap = gap;
1029
+ } else {
1030
+ columnGap = [4, 5, 5, 6];
1031
+ rowGap = [0, 0, 0, 0];
1032
+ }
1033
+
1034
+ if (Number.isInteger(columns) || Array.isArray(columns)) {
1035
+ columns = makeArray(columns);
1036
+ } else {
1037
+ columns = [6, 8, 12, 12];
1038
+ }
1039
+
1040
+ return /*#__PURE__*/React.createElement(Grid, _extends({}, props, {
1041
+ columns: columns,
1042
+ sx: _extends({
1043
+ columnGap: columnGap,
1044
+ rowGap: rowGap
1045
+ }, sx)
1046
+ }), children);
1047
+ };
1048
+
1049
+ const _excluded$9 = ["value", "sx"];
1050
+
1051
+ const Menu = _ref => {
1052
+ let {
1053
+ value,
1054
+ sx
1055
+ } = _ref,
1056
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
1057
+
1058
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1059
+ sx: _extends({
1060
+ cursor: 'pointer',
1061
+ fill: 'none',
1062
+ strokeWidth: '2px',
1063
+ stroke: 'text',
1064
+ '.paren': {
1065
+ opacity: '0'
1066
+ },
1067
+ '@media (hover: hover) and (pointer: fine)': {
1068
+ '&:hover .paren': {
1069
+ opacity: '1'
1070
+ }
1071
+ }
1072
+ }, sx),
1073
+ "aria-label": "Toggle Menu"
1074
+ }, props), !value && /*#__PURE__*/React.createElement("svg", {
1075
+ style: {
1076
+ width: '50px',
1077
+ height: '30px',
1078
+ transform: 'scale(2)',
1079
+ marginTop: '-3px'
1080
+ },
1081
+ xmlns: "http://www.w3.org/2000/svg",
1082
+ viewBox: "0 0 68 36"
1083
+ }, /*#__PURE__*/React.createElement("line", {
1084
+ x1: "52",
1085
+ y1: "29.9",
1086
+ x2: "16",
1087
+ y2: "29.9"
1088
+ }), /*#__PURE__*/React.createElement("line", {
1089
+ x1: "52",
1090
+ y1: "6.1",
1091
+ x2: "16",
1092
+ y2: "6.1"
1093
+ }), /*#__PURE__*/React.createElement("line", {
1094
+ x1: "52",
1095
+ y1: "18",
1096
+ x2: "16",
1097
+ y2: "18"
1098
+ }), /*#__PURE__*/React.createElement("path", {
1099
+ style: {
1100
+ transition: 'all 0.2s'
1101
+ },
1102
+ className: "paren",
1103
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1104
+ }), /*#__PURE__*/React.createElement("path", {
1105
+ style: {
1106
+ transition: 'all 0.2s'
1107
+ },
1108
+ className: "paren",
1109
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1110
+ })), value && /*#__PURE__*/React.createElement("svg", {
1111
+ style: {
1112
+ width: '50px',
1113
+ height: '30px',
1114
+ transform: 'scale(2)',
1115
+ marginTop: '-3px'
1116
+ },
1117
+ xmlns: "http://www.w3.org/2000/svg",
1118
+ viewBox: "0 0 68 36"
1119
+ }, /*#__PURE__*/React.createElement("line", {
1120
+ x1: "50.85",
1121
+ y1: "29.79",
1122
+ x2: "17.15",
1123
+ y2: "6.21"
1124
+ }), /*#__PURE__*/React.createElement("line", {
1125
+ x1: "17.15",
1126
+ y1: "29.79",
1127
+ x2: "50.85",
1128
+ y2: "6.21"
1129
+ }), /*#__PURE__*/React.createElement("path", {
1130
+ style: {
1131
+ transition: 'all 0.2s'
1132
+ },
1133
+ className: "paren",
1134
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1135
+ }), /*#__PURE__*/React.createElement("path", {
1136
+ style: {
1137
+ transition: 'all 0.2s'
1138
+ },
1139
+ className: "paren",
1140
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1141
+ })));
1142
+ };
1143
+
1144
+ const sx$1 = {
1145
+ link: (current, label, first = false) => {
1146
+ return {
1147
+ width: 'auto',
1148
+ color: current === label ? 'secondary' : 'text',
1149
+ fontSize: [6, 6, 7, 8],
1150
+ fontFamily: 'heading',
1151
+ letterSpacing: 'heading',
1152
+ borderStyle: 'solid',
1153
+ borderColor: 'muted',
1154
+ borderWidth: '0px',
1155
+ borderBottomWidth: '1px',
1156
+ borderTopWidth: first ? '1px' : '0px',
1157
+ py: [3, 3, 4, 5],
1158
+ textDecoration: 'none',
1159
+ display: 'block',
1160
+ position: 'relative',
1161
+ transition: 'color 0.15s',
1162
+ '@media (hover: hover) and (pointer: fine)': {
1163
+ '&:hover > #arrow': {
1164
+ opacity: 1
1165
+ }
1166
+ },
1167
+ '&:hover': {
1168
+ color: current == label ? 'secondary' : 'text'
1169
+ }
1170
+ };
1171
+ }
1172
+ };
1173
+ const links = [{
1174
+ url: 'about',
1175
+ display: 'About'
1176
+ }, {
1177
+ url: 'research',
1178
+ display: 'Research'
1179
+ }, {
1180
+ url: 'blog',
1181
+ display: 'Blog'
1182
+ }, {
1183
+ url: 'press',
1184
+ display: 'Press'
1185
+ }];
1186
+
1187
+ const HoverArrow = () => {
1188
+ return /*#__PURE__*/React.createElement(Arrow, {
1189
+ id: "arrow",
1190
+ sx: {
1191
+ pointerEvents: 'none',
1192
+ display: 'inline-block',
1193
+ position: 'absolute',
1194
+ left: ['-60px', '-68px', '-80px', '-104px'],
1195
+ top: ['32px', '32px', '46px', '62px'],
1196
+ opacity: 0,
1197
+ transition: 'opacity 0.2s ease-out',
1198
+ transform: 'rotate(45deg)',
1199
+ width: [36, 36, 48, 56],
1200
+ height: [36, 36, 48, 56]
1201
+ }
1202
+ });
1203
+ };
1204
+
1205
+ const Nav = ({
1206
+ link,
1207
+ mode,
1208
+ nav,
1209
+ first,
1210
+ setExpanded
1211
+ }) => {
1212
+ const {
1213
+ url,
1214
+ display
1215
+ } = link;
1216
+ const href = mode === 'remote' ? 'https://carbonplan.org/' + url : '/' + url;
1217
+
1218
+ if (mode === 'homepage' || mode === 'local' && nav === url) {
1219
+ return /*#__PURE__*/React.createElement(NextLink, {
1220
+ href: href,
1221
+ passHref: true
1222
+ }, /*#__PURE__*/React.createElement(Link$2, {
1223
+ onClick: () => {
1224
+ if (nav === url) setExpanded(false);
1225
+ },
1226
+ sx: sx$1.link(nav, url, first)
1227
+ }, /*#__PURE__*/React.createElement(HoverArrow, null), display));
1228
+ } else {
1229
+ return /*#__PURE__*/React.createElement(Link$2, {
1230
+ href: href,
1231
+ sx: sx$1.link(nav, url, first)
1232
+ }, /*#__PURE__*/React.createElement(HoverArrow, null), display);
1233
+ }
1234
+ };
1235
+
1236
+ const NavGroup = ({
1237
+ links,
1238
+ nav,
1239
+ mode,
1240
+ setExpanded
1241
+ }) => {
1242
+ return links.map((d, i) => {
1243
+ return /*#__PURE__*/React.createElement(Nav, {
1244
+ key: i,
1245
+ link: d,
1246
+ mode: mode,
1247
+ nav: nav,
1248
+ first: i === 0,
1249
+ setExpanded: setExpanded
1250
+ });
1251
+ });
1252
+ };
1253
+
1254
+ const Header = ({
1255
+ status,
1256
+ mode,
1257
+ nav,
1258
+ menuItems
1259
+ }) => {
1260
+ const [expanded, setExpanded] = useState(false);
1261
+
1262
+ const toggle = e => {
1263
+ setExpanded(!expanded);
1264
+ };
1265
+
1266
+ return /*#__PURE__*/React.createElement(Row, {
1267
+ sx: {
1268
+ pt: ['12px'],
1269
+ pb: [3]
1270
+ }
1271
+ }, /*#__PURE__*/React.createElement(Column, {
1272
+ start: [1],
1273
+ width: [2]
1274
+ }, /*#__PURE__*/React.createElement(Box, {
1275
+ sx: {
1276
+ pointerEvents: 'all',
1277
+ display: 'block',
1278
+ width: 'fit-content'
1279
+ }
1280
+ }, (mode == 'homepage' || mode == 'local') && /*#__PURE__*/React.createElement(NextLink, {
1281
+ href: "/",
1282
+ passHref: true
1283
+ }, /*#__PURE__*/React.createElement(Link$2, {
1284
+ "aria-label": "CarbonPlan Homepage",
1285
+ sx: {
1286
+ display: 'block'
1287
+ }
1288
+ }, /*#__PURE__*/React.createElement(Logo, {
1289
+ id: "logo",
1290
+ sx: {
1291
+ cursor: 'pointer',
1292
+ color: 'primary'
1293
+ }
1294
+ }))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$2, {
1295
+ href: "https://carbonplan.org",
1296
+ "aria-label": "CarbonPlan Homepage",
1297
+ sx: {
1298
+ display: 'block'
1299
+ }
1300
+ }, /*#__PURE__*/React.createElement(Logo, {
1301
+ sx: {
1302
+ cursor: 'pointer',
1303
+ color: 'primary'
1304
+ }
1305
+ })))), /*#__PURE__*/React.createElement(Column, {
1306
+ start: [4, 9],
1307
+ width: [2, 2],
1308
+ dr: 1,
1309
+ sx: {
1310
+ display: [status ? 'flex' : 'none', 'flex', 'flex', 'flex'],
1311
+ alignItems: 'center'
1312
+ }
1313
+ }, /*#__PURE__*/React.createElement(Box, {
1314
+ sx: {
1315
+ fontSize: [1, 2, 3],
1316
+ position: 'relative',
1317
+ top: ['-2px', '-3px', '-3px']
1318
+ }
1319
+ }, status ? `(${status})` : '')), /*#__PURE__*/React.createElement(Column, {
1320
+ start: [status ? 6 : 4, 6, 11, 11],
1321
+ width: [status ? 1 : 3, 3, 2, 2],
1322
+ sx: {
1323
+ zIndex: 5000
1324
+ }
1325
+ }, /*#__PURE__*/React.createElement(Flex, {
1326
+ sx: {
1327
+ pointerEvents: 'all',
1328
+ justifyContent: 'flex-end'
1329
+ }
1330
+ }, /*#__PURE__*/React.createElement(Flex, {
1331
+ sx: {
1332
+ mr: '18px',
1333
+ gap: '18px',
1334
+ opacity: expanded ? 0 : 1,
1335
+ transition: 'opacity 0.15s',
1336
+ justifyContent: 'space-between',
1337
+ alignItems: 'center'
1338
+ }
1339
+ }, menuItems), /*#__PURE__*/React.createElement(Menu, {
1340
+ sx: {
1341
+ mr: ['-2px']
1342
+ },
1343
+ value: expanded,
1344
+ onClick: toggle
1345
+ }))), /*#__PURE__*/React.createElement(Box, {
1346
+ sx: {
1347
+ opacity: expanded ? 1 : 0,
1348
+ pointerEvents: expanded ? 'all' : 'none',
1349
+ position: 'fixed',
1350
+ top: '0px',
1351
+ right: '0px',
1352
+ bottom: '0px',
1353
+ minWidth: '0px',
1354
+ maxHeight: '100vh',
1355
+ width: '100vw',
1356
+ backgroundColor: 'background',
1357
+ zIndex: 4000,
1358
+ pt: ['79px'],
1359
+ transition: 'opacity 0.25s'
1360
+ }
1361
+ }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
1362
+ start: [2, 4, 7, 7],
1363
+ width: [5, 4, 5, 5]
1364
+ }, /*#__PURE__*/React.createElement(Box, {
1365
+ as: "nav",
1366
+ sx: {
1367
+ display: expanded ? 'inherit' : 'none',
1368
+ mt: [5, 5, 5, 6]
1369
+ }
1370
+ }, /*#__PURE__*/React.createElement(NavGroup, {
1371
+ links: links,
1372
+ nav: nav,
1373
+ mode: mode,
1374
+ setExpanded: setExpanded
1375
+ })))))));
1376
+ };
1377
+
1378
+ const Monogram = _ref => {
1379
+ let props = _extends({}, _ref);
1380
+
1381
+ return /*#__PURE__*/React.createElement(Box, _extends({
1382
+ as: "svg",
1383
+ width: "80",
1384
+ stroke: "none",
1385
+ fill: "currentColor",
1386
+ viewBox: "0 0 32 32"
1387
+ }, props), /*#__PURE__*/React.createElement("path", {
1388
+ d: "M21.9395,14.9395 L17.5005,19.3785 L17.5005,7.0005 L14.5005,7.0005 L14.5005,19.3785 L10.0605,14.9395 L7.9395,17.0605 L14.9395,24.0605 C15.2325,24.3535 15.6165,24.5005 16.0005,24.5005 C16.3835,24.5005 16.7675,24.3535 17.0605,24.0605 L24.0605,17.0605 L21.9395,14.9395 Z"
1389
+ }), /*#__PURE__*/React.createElement("path", {
1390
+ d: "M27.5986,4 L22.8966,4 C26.5556,6.303 28.9996,10.366 28.9996,15 C28.9996,20.4 25.6896,25.039 20.9926,27 L26.5586,27 C29.8886,24.068 31.9996,19.785 31.9996,15 C31.9996,10.734 30.3196,6.868 27.5986,4"
1391
+ }), /*#__PURE__*/React.createElement("path", {
1392
+ d: "M3,15 C3,10.366 5.444,6.303 9.104,4 L4.401,4 C1.68,6.868 0,10.734 0,15 C0,19.785 2.112,24.068 5.441,27 L11.008,27 C6.311,25.039 3,20.4 3,15"
1393
+ }));
1394
+ };
1395
+
1396
+ const Footer = () => {
1397
+ return /*#__PURE__*/React.createElement(Box, {
1398
+ sx: {
1399
+ mt: [7, 7, 7, 8],
1400
+ mb: [7, 7, 7, 8],
1401
+ pb: [2, 1, 0, 0]
1402
+ }
1403
+ }, /*#__PURE__*/React.createElement(Row, {
1404
+ sx: {
1405
+ mb: [0, 0, 4, 5]
1406
+ }
1407
+ }, /*#__PURE__*/React.createElement(Column, {
1408
+ start: [1, 2],
1409
+ width: [3, 3]
1410
+ }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
1411
+ sx: {
1412
+ fontSize: [2, 2, 2, 3],
1413
+ fontFamily: 'heading',
1414
+ letterSpacing: 'mono',
1415
+ mb: [2]
1416
+ }
1417
+ }, "EMAIL"), /*#__PURE__*/React.createElement(Link$2, {
1418
+ href: "mailto:hello@carbonplan.org",
1419
+ sx: {
1420
+ textDecoration: 'none',
1421
+ fontSize: [2, 2, 2, 3]
1422
+ }
1423
+ }, "hello@carbonplan.org"))), /*#__PURE__*/React.createElement(Column, {
1424
+ start: [5],
1425
+ width: [1],
1426
+ dl: 1,
1427
+ dr: 1,
1428
+ sx: {
1429
+ display: ['flex', 'none', 'none', 'none'],
1430
+ justifyContent: ['center']
1431
+ }
1432
+ }, /*#__PURE__*/React.createElement(Monogram, {
1433
+ sx: {
1434
+ mt: ['-4px'],
1435
+ width: '60px',
1436
+ height: '60px'
1437
+ }
1438
+ })), /*#__PURE__*/React.createElement(Column, {
1439
+ start: [1, 5, 5, 5],
1440
+ width: [3, 3],
1441
+ sx: {
1442
+ mt: [3, 0, 0, 0]
1443
+ }
1444
+ }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
1445
+ sx: {
1446
+ fontSize: [2, 2, 2, 3],
1447
+ fontFamily: 'heading',
1448
+ letterSpacing: 'mono',
1449
+ mb: [2]
1450
+ }
1451
+ }, "FOLLOW"), /*#__PURE__*/React.createElement(Link$2, {
1452
+ href: "https://twitter.com/carbonplanorg",
1453
+ sx: {
1454
+ textDecoration: 'none',
1455
+ fontSize: [2, 2, 2, 3]
1456
+ }
1457
+ }, "@carbonplanorg"))), /*#__PURE__*/React.createElement(Column, {
1458
+ start: [1, 9],
1459
+ width: [5, 4, 3, 3],
1460
+ sx: {
1461
+ mt: ['42px', '42px', 0, 0],
1462
+ mb: [3, 3, 0, 0]
1463
+ }
1464
+ }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
1465
+ sx: {
1466
+ fontSize: [2, 2, 2, 3],
1467
+ fontFamily: 'body',
1468
+ color: 'secondary'
1469
+ }
1470
+ }, "CarbonPlan is a registered non-profit public benefit corporation in California with 501(c)(3) status.")))), /*#__PURE__*/React.createElement(Row, {
1471
+ sx: {
1472
+ mb: ['2px'],
1473
+ mt: [5, 5, 4]
1474
+ }
1475
+ }, /*#__PURE__*/React.createElement(Column, {
1476
+ start: [1, 1, 2, 2],
1477
+ width: [3, 2, 3, 3],
1478
+ sx: {
1479
+ display: 'flex',
1480
+ alignItems: ['flex-start', 'flex-start', 'flex-end']
1481
+ }
1482
+ }, /*#__PURE__*/React.createElement(Box, {
1483
+ sx: {
1484
+ bottom: '0px',
1485
+ borderStyle: 'solid',
1486
+ borderColor: 'muted',
1487
+ borderWidth: '0px',
1488
+ borderTopWidth: '1px',
1489
+ pt: [2]
1490
+ }
1491
+ }, /*#__PURE__*/React.createElement(Box, {
1492
+ sx: {
1493
+ color: 'secondary',
1494
+ fontSize: [1, 1, 1, 2],
1495
+ fontFamily: 'mono',
1496
+ letterSpacing: 'mono'
1497
+ }
1498
+ }, "(c) 2021 CARBONPLAN"))), /*#__PURE__*/React.createElement(Column, {
1499
+ start: [4, 3, 5, 5],
1500
+ width: [2, 2, 3, 3],
1501
+ sx: {
1502
+ display: 'flex',
1503
+ alignItems: ['flex-start', 'flex-start', 'flex-end'],
1504
+ mt: [0, 0, 0, 0]
1505
+ }
1506
+ }, /*#__PURE__*/React.createElement(Box, {
1507
+ sx: {
1508
+ bottom: '0px',
1509
+ borderStyle: 'solid',
1510
+ borderColor: 'muted',
1511
+ borderWidth: '0px',
1512
+ borderTopWidth: '1px',
1513
+ width: ['100%', 'auto', 'auto', 'auto'],
1514
+ pt: [2]
1515
+ }
1516
+ }, /*#__PURE__*/React.createElement(NextLink, {
1517
+ href: "/terms",
1518
+ passHref: true
1519
+ }, /*#__PURE__*/React.createElement(Box, {
1520
+ as: "a",
1521
+ sx: {
1522
+ textDecoration: 'none',
1523
+ fontSize: [1, 1, 1, 2],
1524
+ color: 'secondary',
1525
+ fontFamily: 'mono',
1526
+ letterSpacing: 'mono',
1527
+ display: 'block'
1528
+ }
1529
+ }, "READ OUR TERMS")))), /*#__PURE__*/React.createElement(Column, {
1530
+ start: [5, 7, 9, 9],
1531
+ width: [2, 3, 3, 3],
1532
+ sx: {
1533
+ display: ['none', 'initial', 'initial', 'initial']
1534
+ }
1535
+ }, /*#__PURE__*/React.createElement(Monogram, {
1536
+ sx: {
1537
+ width: 80,
1538
+ height: 80,
1539
+ mt: [0, '-10px', 4, 5],
1540
+ mb: ['-12px']
1541
+ }
1542
+ }))));
1543
+ };
1544
+
1545
+ const _excluded$8 = ["sx"];
1546
+
1547
+ const Dimmer = _ref => {
1548
+ let {
1549
+ sx
1550
+ } = _ref,
1551
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
1552
+
1553
+ const [colorMode, setColorMode] = useColorMode();
1554
+ const toggle = useCallback(() => {
1555
+ setColorMode(colorMode === 'light' ? 'dark' : 'light');
1556
+ }, [colorMode]);
1557
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1558
+ "aria-label": "Toggle dark mode",
1559
+ onClick: toggle,
1560
+ role: "checkbox",
1561
+ sx: _extends({
1562
+ width: 32,
1563
+ height: 32,
1564
+ display: 'inline-block',
1565
+ cursor: 'pointer',
1566
+ color: 'secondary'
1567
+ }, sx)
1568
+ }, props), /*#__PURE__*/React.createElement(Sun, {
1569
+ sx: {
1570
+ strokeWidth: '1.75',
1571
+ transition: 'stroke 0.15s',
1572
+ '@media (hover: hover) and (pointer: fine)': {
1573
+ '&:hover': {
1574
+ stroke: 'primary'
1575
+ }
1576
+ }
1577
+ }
1578
+ }));
1579
+ };
1580
+
1581
+ const GitSha = () => {
1582
+ const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
1583
+ const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
1584
+ const slug = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG;
1585
+ const {
1586
+ theme
1587
+ } = useThemeUI();
1588
+ const color = theme.rawColors.secondary;
1589
+
1590
+ if (sha && owner && slug) {
1591
+ const shortSha = sha.substring(0, 7);
1592
+ const href = 'https://github.com/' + owner + '/' + slug + '/tree/' + sha;
1593
+ return /*#__PURE__*/React.createElement(Box, {
1594
+ sx: {
1595
+ display: 'inline-block',
1596
+ width: '87px'
1597
+ }
1598
+ }, /*#__PURE__*/React.createElement(Separator, {
1599
+ color: color
1600
+ }), /*#__PURE__*/React.createElement(Link$2, {
1601
+ href: href,
1602
+ sx: {
1603
+ whiteSpace: 'nowrap',
1604
+ display: 'inline-block',
1605
+ ml: [2],
1606
+ fontFamily: 'mono',
1607
+ letterSpacing: 'body',
1608
+ color: color,
1609
+ fontSize: [1],
1610
+ textTransform: 'uppercase',
1611
+ textDecoration: 'none'
1612
+ }
1613
+ }, shortSha));
1614
+ } else {
1615
+ // fallback
1616
+ return /*#__PURE__*/React.createElement(Box, {
1617
+ sx: {
1618
+ display: 'inline-block',
1619
+ width: '87px'
1620
+ }
1621
+ }, /*#__PURE__*/React.createElement(Separator, {
1622
+ color: color
1623
+ }), /*#__PURE__*/React.createElement(Text, {
1624
+ sx: {
1625
+ whiteSpace: 'nowrap',
1626
+ display: 'inline-block',
1627
+ ml: [2],
1628
+ fontFamily: 'mono',
1629
+ letterSpacing: 'body',
1630
+ color: color,
1631
+ fontSize: [1],
1632
+ textTransform: 'uppercase'
1633
+ }
1634
+ }, color));
1635
+ }
1636
+ };
1637
+
1638
+ const Separator = ({
1639
+ color
1640
+ }) => {
1641
+ return /*#__PURE__*/React.createElement("svg", {
1642
+ fill: color,
1643
+ opacity: "0.8",
1644
+ viewBox: "0 0 24 24",
1645
+ width: "24",
1646
+ height: "24"
1647
+ }, /*#__PURE__*/React.createElement("circle", {
1648
+ r: 5,
1649
+ cx: 19,
1650
+ cy: 19
1651
+ }));
1652
+ };
1653
+
1654
+ const Value = ({
1655
+ mode
1656
+ }) => {
1657
+ const [display, setDisplay] = useState(init(mode));
1658
+ useEffect(() => {
1659
+ if (mode === 'mouse') {
1660
+ const setFromEvent = e => {
1661
+ const x = format(e.clientX, 4);
1662
+ const y = format(e.clientY, 4);
1663
+ setDisplay(`X,Y: ${x},${y}`);
1664
+ };
1665
+
1666
+ window.addEventListener('mousemove', setFromEvent);
1667
+ return () => {
1668
+ window.removeEventListener('mousemove', setFromEvent);
1669
+ };
1670
+ }
1671
+
1672
+ if (mode === 'scroll') {
1673
+ const setFromEvent = e => {
1674
+ const y = scrollFraction(window);
1675
+ setDisplay(`SCROLL: 0.${format((y * 100).toFixed(0), 2)}`);
1676
+ };
1677
+
1678
+ window.addEventListener('scroll', setFromEvent);
1679
+ return () => {
1680
+ window.removeEventListener('scroll', setFromEvent);
1681
+ };
1682
+ }
1683
+ }, []);
1684
+ return /*#__PURE__*/React.createElement(Text, {
1685
+ sx: {
1686
+ whiteSpace: 'nowrap',
1687
+ display: 'inline-block',
1688
+ mr: '-6px',
1689
+ fontFamily: 'mono',
1690
+ letterSpacing: 'body',
1691
+ color: 'secondary',
1692
+ fontSize: [1],
1693
+ textTransform: 'uppercase'
1694
+ }
1695
+ }, display);
1696
+ };
1697
+
1698
+ const Metadata = ({
1699
+ mode
1700
+ }) => {
1701
+ return /*#__PURE__*/React.createElement(Box, {
1702
+ sx: {
1703
+ userSelect: 'none',
1704
+ position: 'fixed',
1705
+ bottom: '42px',
1706
+ right: '24px',
1707
+ transformOrigin: 'right',
1708
+ transform: 'rotate(90deg)',
1709
+ display: ['none', 'none', 'initial']
1710
+ }
1711
+ }, /*#__PURE__*/React.createElement(Value, {
1712
+ mode: mode
1713
+ }), /*#__PURE__*/React.createElement(GitSha, null));
1714
+ };
1715
+
1716
+ function init(mode) {
1717
+ if (mode === 'mouse') {
1718
+ return `X,Y: ${format(0, 4)},${format(0, 4)}`;
1719
+ } else if (mode === 'scroll') {
1720
+ return `SCROLL: 0.${format(0 .toFixed(0), 2)}`;
1721
+ } else {
1722
+ return mode;
1723
+ }
1724
+ }
1725
+
1726
+ function format(num, pad) {
1727
+ return num.toString().padStart(pad, '0');
1728
+ }
1729
+
1730
+ function scrollFraction(window, documnt) {
1731
+ return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1732
+ }
1733
+
1734
+ const _excluded$7 = ["duration", "delay", "children"];
1735
+ const fade = keyframes({
1736
+ from: {
1737
+ opacity: 0
1738
+ },
1739
+ to: {
1740
+ opacity: 1
1741
+ }
1742
+ });
1743
+
1744
+ const FadeIn = _ref => {
1745
+ let {
1746
+ duration = 300,
1747
+ delay = 0,
1748
+ children
1749
+ } = _ref,
1750
+ delegated = _objectWithoutPropertiesLoose(_ref, _excluded$7);
1751
+
1752
+ return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1753
+ sx: {
1754
+ animationDuration: duration + 'ms',
1755
+ animationDelay: delay + 'ms',
1756
+ animationName: fade.toString(),
1757
+ animationFillMode: 'backwards'
1758
+ }
1759
+ }), children);
1760
+ };
1761
+
1762
+ const getScrollbarWidth = document => {
1763
+ const outer = document.createElement('div');
1764
+ outer.style.visibility = 'hidden';
1765
+ outer.style.width = '100px';
1766
+ document.body.appendChild(outer);
1767
+ outer.style.overflow = 'scroll';
1768
+ const inner = document.createElement('div');
1769
+ inner.style.width = '100%';
1770
+ outer.appendChild(inner);
1771
+ const delta = outer.offsetWidth - inner.offsetWidth;
1772
+ outer.parentNode.removeChild(outer);
1773
+ return delta;
1774
+ };
1775
+
1776
+ const Scrollbar = () => {
1777
+ useEffect(() => {
1778
+ if (typeof document !== 'undefined') {
1779
+ const delta = getScrollbarWidth(document);
1780
+
1781
+ if (delta > 0) {
1782
+ document.body.classList.add('custom-scrollbar');
1783
+ document.getElementsByTagName('html')[0].classList.add('custom-scrollbar');
1784
+ }
1785
+ }
1786
+ }, []);
1787
+ return null;
1788
+ };
1789
+
1790
+ const Guide = ({
1791
+ color: _color = 'muted'
1792
+ }) => {
1793
+ const [display, setDisplay] = useState(false);
1794
+ useEffect(() => {
1795
+ function handler(event) {
1796
+ const {
1797
+ key,
1798
+ keyCode,
1799
+ metaKey
1800
+ } = event;
1801
+
1802
+ if (key === ';' && metaKey) {
1803
+ setDisplay(prev => !prev);
1804
+ }
1805
+ }
1806
+
1807
+ document.addEventListener('keydown', handler);
1808
+ return () => {
1809
+ document.removeEventListener('keydown', handler);
1810
+ };
1811
+ }, []);
1812
+ return /*#__PURE__*/React.createElement(Box, {
1813
+ sx: {
1814
+ position: 'fixed',
1815
+ width: '100%',
1816
+ left: 0,
1817
+ top: 0,
1818
+ zIndex: _color === 'teal' ? 5000 : -1,
1819
+ pointerEvents: 'none',
1820
+ display: display ? 'initial' : 'none'
1821
+ }
1822
+ }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Box, {
1823
+ sx: {
1824
+ display: ['none', 'none', 'initial', 'initial']
1825
+ }
1826
+ }, /*#__PURE__*/React.createElement(GuideColumns, {
1827
+ indices: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
1828
+ color: _color
1829
+ })), /*#__PURE__*/React.createElement(Box, {
1830
+ sx: {
1831
+ display: ['none', 'initial', 'none', 'none']
1832
+ }
1833
+ }, /*#__PURE__*/React.createElement(GuideColumns, {
1834
+ indices: [1, 2, 3, 4, 5, 6, 7, 8],
1835
+ color: _color
1836
+ })), /*#__PURE__*/React.createElement(Box, {
1837
+ sx: {
1838
+ display: ['initial', 'none', 'none', 'none']
1839
+ }
1840
+ }, /*#__PURE__*/React.createElement(GuideColumns, {
1841
+ indices: [1, 2, 3, 4, 5, 6],
1842
+ color: _color
1843
+ }))));
1844
+ };
1845
+
1846
+ const colorCycle = ['red', 'orange', 'yellow', 'green', 'teal', 'blue', 'purple', 'pink'];
1847
+
1848
+ function GuideColumns({
1849
+ indices,
1850
+ color
1851
+ }) {
1852
+ const sx = {
1853
+ outerGuideColumn: {
1854
+ borderStyle: 'solid',
1855
+ borderWidth: '0px',
1856
+ borderLeftWidth: color === 'teal' ? '0px' : '1px',
1857
+ borderRightWidth: color === 'teal' ? '0px' : '1px',
1858
+ opacity: color == 'teal' ? 0.4 : 1
1859
+ },
1860
+ innerGuideColumn: {
1861
+ borderStyle: 'solid',
1862
+ borderWidth: '0px',
1863
+ borderLeftWidth: '0px',
1864
+ borderRightWidth: '0px',
1865
+ opacity: color == 'teal' ? 0.4 : 1
1866
+ }
1867
+ };
1868
+ return /*#__PURE__*/React.createElement(Row, null, indices.map(i => {
1869
+ return /*#__PURE__*/React.createElement(Column, {
1870
+ key: i,
1871
+ start: [i],
1872
+ width: [1, 1],
1873
+ dl: 0.5,
1874
+ dr: 0.5,
1875
+ sx: _extends({
1876
+ bg: color === 'teal' ? 'teal' : 'transparent',
1877
+ height: '100vh'
1878
+ }, sx.innerGuideColumn)
1879
+ }, /*#__PURE__*/React.createElement(Box, {
1880
+ sx: _extends({
1881
+ mx: ['12px', 3, 3, 4],
1882
+ bg: color === 'teal' ? 'background' : 'transparent',
1883
+ height: '100%',
1884
+ borderLeftColor: color === 'rainbow' ? colorCycle[i % 8] : 'muted',
1885
+ borderRightColor: color === 'rainbow' ? colorCycle[i % 8] : 'muted'
1886
+ }, sx.outerGuideColumn)
1887
+ }));
1888
+ }));
1889
+ }
1890
+
1891
+ const _excluded$6 = ["value", "sx"];
1892
+
1893
+ const Settings = _ref => {
1894
+ let {
1895
+ value,
1896
+ sx
1897
+ } = _ref,
1898
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1899
+
1900
+ return /*#__PURE__*/React.createElement(IconButton, _extends({
1901
+ sx: _extends({
1902
+ cursor: 'pointer',
1903
+ fill: 'none',
1904
+ strokeWidth: '2px',
1905
+ stroke: 'text',
1906
+ '.paren': {
1907
+ opacity: '0'
1908
+ },
1909
+ '@media (hover: hover) and (pointer: fine)': {
1910
+ '&:hover .paren': {
1911
+ opacity: '1'
1912
+ }
1913
+ }
1914
+ }, sx),
1915
+ "aria-label": "Toggle Menu"
1916
+ }, props), !value && /*#__PURE__*/React.createElement("svg", {
1917
+ style: {
1918
+ width: '50px',
1919
+ height: '30px',
1920
+ transform: 'scale(2)',
1921
+ marginTop: '-3px'
1922
+ },
1923
+ xmlns: "http://www.w3.org/2000/svg",
1924
+ viewBox: "0 0 68 36"
1925
+ }, /*#__PURE__*/React.createElement("line", {
1926
+ x1: "24",
1927
+ y1: "2.1",
1928
+ x2: "24",
1929
+ y2: "6.1"
1930
+ }), /*#__PURE__*/React.createElement("line", {
1931
+ x1: "24",
1932
+ y1: "24.1",
1933
+ x2: "24",
1934
+ y2: "33.9"
1935
+ }), /*#__PURE__*/React.createElement("line", {
1936
+ x1: "44",
1937
+ y1: "2.1",
1938
+ x2: "44",
1939
+ y2: "12.1"
1940
+ }), /*#__PURE__*/React.createElement("line", {
1941
+ x1: "44",
1942
+ y1: "30.1",
1943
+ x2: "44",
1944
+ y2: "33.9"
1945
+ }), /*#__PURE__*/React.createElement("circle", {
1946
+ cx: "24",
1947
+ cy: "15.1",
1948
+ r: "5"
1949
+ }), /*#__PURE__*/React.createElement("circle", {
1950
+ cx: "44",
1951
+ cy: "21.1",
1952
+ r: "5"
1953
+ }), /*#__PURE__*/React.createElement("path", {
1954
+ style: {
1955
+ transition: 'all 0.2s'
1956
+ },
1957
+ className: "paren",
1958
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1959
+ }), /*#__PURE__*/React.createElement("path", {
1960
+ style: {
1961
+ transition: 'all 0.2s'
1962
+ },
1963
+ className: "paren",
1964
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1965
+ })), value && /*#__PURE__*/React.createElement("svg", {
1966
+ style: {
1967
+ width: '50px',
1968
+ height: '30px',
1969
+ transform: 'scale(2)',
1970
+ marginTop: '-3px'
1971
+ },
1972
+ xmlns: "http://www.w3.org/2000/svg",
1973
+ viewBox: "0 0 68 36"
1974
+ }, /*#__PURE__*/React.createElement("line", {
1975
+ x1: "50.85",
1976
+ y1: "29.79",
1977
+ x2: "17.15",
1978
+ y2: "6.21"
1979
+ }), /*#__PURE__*/React.createElement("line", {
1980
+ x1: "17.15",
1981
+ y1: "29.79",
1982
+ x2: "50.85",
1983
+ y2: "6.21"
1984
+ }), /*#__PURE__*/React.createElement("path", {
1985
+ style: {
1986
+ transition: 'all 0.2s'
1987
+ },
1988
+ className: "paren",
1989
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1990
+ }), /*#__PURE__*/React.createElement("path", {
1991
+ style: {
1992
+ transition: 'all 0.2s'
1993
+ },
1994
+ className: "paren",
1995
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1996
+ })));
1997
+ };
1998
+
1999
+ const Layout = ({
2000
+ title,
2001
+ description,
2002
+ card,
2003
+ children,
2004
+ status,
2005
+ nav,
2006
+ settings,
2007
+ footer: _footer = true,
2008
+ header: _header = true,
2009
+ metadata: _metadata = 'mouse',
2010
+ links: _links = 'remote',
2011
+ dimmer: _dimmer = 'bottom',
2012
+ guide: _guide = true,
2013
+ scrollbar: _scrollbar = true,
2014
+ fade: _fade = true,
2015
+ container: _container = true
2016
+ }) => {
2017
+ let content = children;
2018
+
2019
+ if (_fade) {
2020
+ content = /*#__PURE__*/React.createElement(FadeIn, {
2021
+ duration: 250
2022
+ }, content);
2023
+ }
2024
+
2025
+ if (_container) {
2026
+ content = /*#__PURE__*/React.createElement(Box, {
2027
+ sx: {
2028
+ mb: [8, 8, 9, 10]
2029
+ }
2030
+ }, /*#__PURE__*/React.createElement(Container, null, content));
2031
+ }
2032
+
2033
+ const {
2034
+ theme
2035
+ } = useThemeUI();
2036
+ useEffect(() => {
2037
+ if (!theme) return;
2038
+
2039
+ const handler = e => {
2040
+ if (e.matches && settings != null && settings.value && settings != null && settings.onClick) {
2041
+ settings == null ? void 0 : settings.onClick();
2042
+ }
2043
+ };
2044
+
2045
+ const query = window.matchMedia(`(min-width: ${theme.breakpoints[1]})`);
2046
+ query.onchange = handler;
2047
+ return () => {
2048
+ query.onchange = null;
2049
+ };
2050
+ }, [theme == null ? void 0 : theme.breakpoints, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2051
+ const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2052
+ key: "dimmer",
2053
+ sx: {
2054
+ color: 'primary',
2055
+ mt: '-2px',
2056
+ display: ['block', 'block', _dimmer === 'top' ? 'block' : 'none', _dimmer === 'top' ? 'block' : 'none']
2057
+ }
2058
+ })];
2059
+
2060
+ if (settings) {
2061
+ menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2062
+ key: "settings",
2063
+ sx: {
2064
+ mr: ['2px'],
2065
+ display: ['inherit', 'inherit', 'none', 'none']
2066
+ }
2067
+ }, settings)));
2068
+ }
2069
+
2070
+ return /*#__PURE__*/React.createElement(React.Fragment, null, _guide && /*#__PURE__*/React.createElement(Guide, {
2071
+ color: _guide
2072
+ }), _scrollbar && /*#__PURE__*/React.createElement(Scrollbar, null), /*#__PURE__*/React.createElement(Meta, {
2073
+ card: card,
2074
+ description: description,
2075
+ title: title
2076
+ }), /*#__PURE__*/React.createElement(Flex, {
2077
+ sx: {
2078
+ flexDirection: 'column',
2079
+ minHeight: '100vh'
2080
+ }
2081
+ }, _header && /*#__PURE__*/React.createElement(Box, {
2082
+ as: "header",
2083
+ sx: {
2084
+ width: '100%',
2085
+ borderStyle: 'solid',
2086
+ borderColor: 'muted',
2087
+ borderWidth: '0px',
2088
+ borderBottomWidth: '1px',
2089
+ position: 'sticky',
2090
+ top: 0,
2091
+ bg: 'background',
2092
+ height: '56px',
2093
+ zIndex: 2000
2094
+ }
2095
+ }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Header, {
2096
+ mode: _links,
2097
+ status: status,
2098
+ nav: nav,
2099
+ menuItems: menuItems
2100
+ }))), /*#__PURE__*/React.createElement(Box, {
2101
+ sx: {
2102
+ width: '100%',
2103
+ flex: '1 1 auto'
2104
+ }
2105
+ }, content), _footer && /*#__PURE__*/React.createElement(Box, {
2106
+ as: "footer",
2107
+ sx: {
2108
+ width: '100%',
2109
+ borderStyle: 'solid',
2110
+ borderColor: 'muted',
2111
+ borderWidth: '0px',
2112
+ borderTopWidth: '1px'
2113
+ }
2114
+ }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Footer, null))), _dimmer === 'bottom' && /*#__PURE__*/React.createElement(Box, {
2115
+ sx: {
2116
+ display: ['none', 'none', 'initial', 'initial'],
2117
+ position: ['fixed'],
2118
+ right: [13],
2119
+ bottom: [17, 17, 15, 15]
2120
+ }
2121
+ }, /*#__PURE__*/React.createElement(Dimmer, null)), _metadata && /*#__PURE__*/React.createElement(Metadata, {
2122
+ mode: _metadata
2123
+ })));
2124
+ };
2125
+
2126
+ const Custom404 = () => {
2127
+ return /*#__PURE__*/React.createElement(Layout, {
2128
+ footer: false,
2129
+ title: '404 / carbonplan'
2130
+ }, /*#__PURE__*/React.createElement(Row, {
2131
+ sx: {
2132
+ mb: [5, 0, 0],
2133
+ pt: [0, 0, 6]
2134
+ }
2135
+ }, /*#__PURE__*/React.createElement(Column, {
2136
+ start: [1, 1, 3, 3],
2137
+ width: [6, 4, 4, 4]
2138
+ }, /*#__PURE__*/React.createElement(Styled.h1, null, "Oops!"), /*#__PURE__*/React.createElement(Box, {
2139
+ sx: {
2140
+ fontSize: [4, 4, 4, 5],
2141
+ lineHeight: 'h3',
2142
+ mt: [3, 4, 4],
2143
+ mb: [2, 3, 3],
2144
+ maxWidth: ['90%', '90%', '400px']
2145
+ }
2146
+ }, "Sorry but we can't seem to find the page you are looking for."), /*#__PURE__*/React.createElement(Box, {
2147
+ sx: {
2148
+ color: 'secondary',
2149
+ fontFamily: 'mono',
2150
+ letterSpacing: 'mono',
2151
+ fontSize: [2, 2, 2, 3],
2152
+ mt: [4, 5, 5]
2153
+ }
2154
+ }, "ERROR CODE 404")), /*#__PURE__*/React.createElement(Column, {
2155
+ start: [2, 5, 7, 7],
2156
+ width: [4, 4, 4, 4]
2157
+ }, /*#__PURE__*/React.createElement(Box, {
2158
+ sx: {
2159
+ width: ['100%'],
2160
+ mt: [2, 4, 4, 5],
2161
+ fill: 'primary'
2162
+ }
2163
+ }, /*#__PURE__*/React.createElement(PoopSad, {
2164
+ sx: {
2165
+ width: '100%',
2166
+ height: 'auto'
2167
+ }
2168
+ })))));
2169
+ };
2170
+
2171
+ const Expander = ({
2172
+ value,
2173
+ id,
2174
+ onClick,
2175
+ sx
2176
+ }) => {
2177
+ return /*#__PURE__*/React.createElement(IconButton, {
2178
+ onClick: onClick,
2179
+ id: id,
2180
+ role: "checkbox",
2181
+ "aria-checked": value,
2182
+ "aria-label": "Expand",
2183
+ sx: _extends({
2184
+ display: 'inline-block',
2185
+ width: 24,
2186
+ height: 24,
2187
+ p: [1],
2188
+ cursor: 'pointer',
2189
+ fill: 'secondary',
2190
+ stroke: 'secondary',
2191
+ '@media (hover: hover) and (pointer: fine)': {
2192
+ '&:hover': {
2193
+ fill: 'primary',
2194
+ stroke: 'primary'
2195
+ }
2196
+ }
2197
+ }, sx)
2198
+ }, /*#__PURE__*/React.createElement("svg", {
2199
+ viewBox: "0 0 16 16"
2200
+ }, /*#__PURE__*/React.createElement("path", {
2201
+ d: "M8,0 V16 M0,8 H16",
2202
+ style: {
2203
+ strokeWidth: 2,
2204
+ transition: '0.25s all',
2205
+ transformOrigin: '8px 8px',
2206
+ transform: value ? 'rotate(45deg)' : ''
2207
+ }
2208
+ })));
2209
+ };
2210
+
2211
+ const _excluded$5 = ["label", "value", "sx", "children"];
2212
+
2213
+ const Tag = _ref => {
2214
+ let {
2215
+ label,
2216
+ value,
2217
+ sx,
2218
+ children
2219
+ } = _ref,
2220
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2221
+
2222
+ const color = sx && sx.color ? sx.color : 'primary';
2223
+ const isClickable = props && (props.onClick || props.onDoubleClick);
2224
+ return /*#__PURE__*/React.createElement(Box, _extends({
2225
+ as: isClickable ? 'button' : 'span',
2226
+ role: "checkbox",
2227
+ "aria-checked": value,
2228
+ "aria-label": label,
2229
+ sx: _extends({
2230
+ display: 'inline-block',
2231
+ fontSize: [1, 1, 1, 2],
2232
+ fontFamily: 'mono',
2233
+ letterSpacing: 'mono',
2234
+ cursor: isClickable ? 'pointer' : 'inherit',
2235
+ color: color,
2236
+ backgroundColor: 'transparent',
2237
+ borderStyle: 'solid',
2238
+ borderColor: color,
2239
+ lineHeight: 'body',
2240
+ borderWidth: '0px',
2241
+ borderBottomWidth: '1px',
2242
+ textTransform: 'uppercase',
2243
+ userSelect: 'none',
2244
+ transition: 'opacity 0.05s',
2245
+ pt: ['1px'],
2246
+ pb: ['2px'],
2247
+ px: [0],
2248
+ m: [0],
2249
+ opacity: value == null || value ? 1 : color == 'primary' ? 0.24 : 0.33
2250
+ }, sx)
2251
+ }, props), children);
2252
+ };
2253
+
2254
+ const _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2255
+ const sx = {
2256
+ label: {
2257
+ fontFamily: 'mono',
2258
+ letterSpacing: 'mono',
2259
+ fontSize: [1, 1, 1, 2],
2260
+ color: 'secondary',
2261
+ userSelect: 'none',
2262
+ textTransform: 'uppercase'
2263
+ }
2264
+ };
2265
+
2266
+ const duplicateOptions = (options, defaultValue, overrides = {}) => {
2267
+ return Object.keys(options).reduce((o, key) => Object.assign(o, {
2268
+ [key]: overrides[key] || defaultValue
2269
+ }), {});
2270
+ };
2271
+
2272
+ const isAll = option => {
2273
+ return Object.keys(option).filter(d => option[d]).length == Object.keys(option).length;
2274
+ };
2275
+
2276
+ const updateValues = ({
2277
+ values,
2278
+ multiSelect,
2279
+ setValues,
2280
+ value
2281
+ }) => {
2282
+ const isAllAlreadySelected = isAll(values);
2283
+ const isSelectingAll = value === 'all';
2284
+ let updatedToggle;
2285
+
2286
+ if (multiSelect) {
2287
+ if (isSelectingAll && !isAllAlreadySelected) {
2288
+ // select all
2289
+ updatedToggle = duplicateOptions(values, true);
2290
+ } else if (isSelectingAll && isAllAlreadySelected) {
2291
+ // deselect all
2292
+ updatedToggle = duplicateOptions(values, false);
2293
+ } else {
2294
+ // de/select value, inherit other values
2295
+ updatedToggle = _extends({}, values, {
2296
+ [value]: !values[value]
2297
+ });
2298
+ }
2299
+ } else {
2300
+ if (isSelectingAll && !isAllAlreadySelected) {
2301
+ // select all
2302
+ updatedToggle = duplicateOptions(values, true);
2303
+ } else if (isSelectingAll && isAllAlreadySelected) ; else {
2304
+ // select only value
2305
+ updatedToggle = duplicateOptions(values, false, {
2306
+ [value]: true
2307
+ });
2308
+ }
2309
+ }
2310
+
2311
+ if (updatedToggle) {
2312
+ setValues(updatedToggle);
2313
+ }
2314
+ };
2315
+
2316
+ const Filter = _ref => {
2317
+ let {
2318
+ values,
2319
+ setValues,
2320
+ label,
2321
+ colors,
2322
+ showAll = false,
2323
+ multiSelect = false
2324
+ } = _ref,
2325
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2326
+
2327
+ return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2328
+ sx: sx.label
2329
+ }, label), /*#__PURE__*/React.createElement(Box, {
2330
+ sx: {
2331
+ mt: label ? [3] : 0
2332
+ }
2333
+ }, showAll && /*#__PURE__*/React.createElement(Tag, {
2334
+ onClick: () => updateValues({
2335
+ values: values,
2336
+ multiSelect,
2337
+ setValues: setValues,
2338
+ value: 'all'
2339
+ }),
2340
+ value: isAll(values),
2341
+ sx: {
2342
+ mr: [2]
2343
+ }
2344
+ }, "All"), Object.keys(values).map((d, i) => /*#__PURE__*/React.createElement(Tag, {
2345
+ onClick: () => updateValues({
2346
+ values: values,
2347
+ multiSelect,
2348
+ setValues: setValues,
2349
+ value: d
2350
+ }),
2351
+ onDoubleClick: () => updateValues({
2352
+ values: values,
2353
+ multiSelect: false,
2354
+ setValues: setValues,
2355
+ value: d
2356
+ }),
2357
+ key: i,
2358
+ value: values[d],
2359
+ sx: {
2360
+ width: 'max-content',
2361
+ color: colors ? colors[d] : 'primary',
2362
+ mr: [2],
2363
+ mb: [1]
2364
+ }
2365
+ }, d))));
2366
+ };
2367
+
2368
+ const sizes = {
2369
+ xs: [1],
2370
+ sm: [3],
2371
+ md: [5],
2372
+ lg: [7],
2373
+ xl: [9]
2374
+ };
2375
+
2376
+ const Group = ({
2377
+ children,
2378
+ direction: _direction = 'vertical',
2379
+ spacing: _spacing = 'md'
2380
+ }) => {
2381
+ let marginValue;
2382
+
2383
+ if (typeof _spacing === 'string') {
2384
+ marginValue = sizes[_spacing];
2385
+ } else if (typeof _spacing === 'number') {
2386
+ marginValue = [_spacing];
2387
+ } else if (Array.isArray(_spacing) && _spacing.every(el => typeof el === 'number')) {
2388
+ marginValue = _spacing;
2389
+ }
2390
+
2391
+ if (!marginValue) {
2392
+ throw new Error('Invalid spacing size. Must be numeric value(s) or one of xs, sm, md, lg, or xl');
2393
+ }
2394
+
2395
+ if (!['horizontal', 'vertical'].includes(_direction)) {
2396
+ throw new Error('Invalid direction value. Must be either horizontal or vertical');
2397
+ }
2398
+
2399
+ const marginProperty = _direction === 'vertical' ? 'mt' : 'ml';
2400
+ const additionalStyles = _direction === 'horizontal' ? {
2401
+ display: 'inline-block'
2402
+ } : {};
2403
+ return /*#__PURE__*/React.createElement(Box, null, React.Children.map(children, (child, i) => {
2404
+ return /*#__PURE__*/React.createElement(Box, {
2405
+ sx: _extends({
2406
+ [marginProperty]: i > 0 ? marginValue : 0
2407
+ }, additionalStyles)
2408
+ }, child);
2409
+ }));
2410
+ };
2411
+
2412
+ const _excluded$3 = ["size", "inverted", "sx"];
2413
+
2414
+ const Input = (_ref, ref) => {
2415
+ let {
2416
+ size = 'sm',
2417
+ inverted,
2418
+ sx
2419
+ } = _ref,
2420
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2421
+
2422
+ const defaultColor = inverted ? 'secondary' : 'primary';
2423
+
2424
+ const styles = _extends({
2425
+ color: defaultColor,
2426
+ borderColor: 'secondary',
2427
+ borderStyle: 'solid',
2428
+ borderWidth: '0px',
2429
+ borderBottomWidth: '1px',
2430
+ borderRadius: '0px',
2431
+ transition: 'border 0.15s',
2432
+ borderBottomWidth: '1px',
2433
+ width: 'calc(min(15ch, 100%))',
2434
+ p: [0],
2435
+ py: ['2px'],
2436
+ 'input::-webkit-outer-spin-button': {
2437
+ WebkitAppearance: 'none',
2438
+ margin: 0
2439
+ },
2440
+ 'input::-webkit-inner-spin-button': {
2441
+ WebkitAppearance: 'none',
2442
+ margin: 0
2443
+ },
2444
+ ':focus': {
2445
+ borderColor: 'primary'
2446
+ },
2447
+ ':focus-visible': {
2448
+ outline: 'none !important',
2449
+ background: 'none !important'
2450
+ }
2451
+ }, getSizeStyles(size), sx);
2452
+
2453
+ return /*#__PURE__*/React.createElement(Input$1, _extends({}, props, {
2454
+ ref: ref,
2455
+ sx: styles
2456
+ }));
2457
+ };
2458
+
2459
+ var input = forwardRef(Input);
2460
+
2461
+ const getProps = test => props => {
2462
+ const next = {};
2463
+
2464
+ for (const key in props) {
2465
+ if (test(key || '')) next[key] = props[key];
2466
+ }
2467
+
2468
+ return next;
2469
+ };
2470
+
2471
+ const _excluded$2 = ["children", "size", "sx", "sxSelect"];
2472
+
2473
+ const Select = _ref => {
2474
+ let {
2475
+ children,
2476
+ size = 'sm',
2477
+ sx,
2478
+ sxSelect
2479
+ } = _ref,
2480
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2481
+
2482
+ const color = sx && sx.color ? sx.color : 'primary';
2483
+ const sizeStyles = getSizeStyles(size);
2484
+ const ref = useRef(null);
2485
+ const {
2486
+ onChange
2487
+ } = props;
2488
+ const omitOnChange = getProps(k => k !== 'onChange')(props);
2489
+
2490
+ if (!['xs', 'sm', 'md'].includes(size)) {
2491
+ throw new Error('Size must be xs, sm, or md');
2492
+ }
2493
+
2494
+ let pr, height, width, ml, top;
2495
+
2496
+ if (size === 'xs') {
2497
+ height = [14, 14, 14, 16];
2498
+ width = [14, 14, 14, 14];
2499
+ top = ['1px'];
2500
+ ml = ['-14px', '-14px', '-14px', '-16px'];
2501
+ }
2502
+
2503
+ if (size === 'sm') {
2504
+ height = [15, 15, 15, 20];
2505
+ width = [15, 15, 15, 20];
2506
+ top = ['1px'];
2507
+ ml = ['-16px', '-16px', '-16px', '-20px'];
2508
+ }
2509
+
2510
+ if (size === 'md') {
2511
+ height = [20, 20, 20, 20];
2512
+ width = [20, 20, 20, 20];
2513
+ top = ['2px'];
2514
+ ml = ['-20px', '-20px', '-20px', '-20px'];
2515
+ }
2516
+
2517
+ pr = width.map(d => d + 12);
2518
+ return /*#__PURE__*/React.createElement(Box, {
2519
+ sx: _extends({
2520
+ display: 'inline-block'
2521
+ }, sx)
2522
+ }, /*#__PURE__*/React.createElement(Box, _extends({
2523
+ as: "select",
2524
+ ref: ref,
2525
+ onChange: e => {
2526
+ ref.current.blur();
2527
+ if (onChange) onChange(e);
2528
+ },
2529
+ sx: _extends({}, sizeStyles, {
2530
+ lineHeight: 'normal',
2531
+ cursor: 'pointer',
2532
+ WebkitAppearance: 'none',
2533
+ MozAppearance: 'none',
2534
+ pb: ['5px'],
2535
+ bg: 'transparent',
2536
+ pr: pr,
2537
+ border: 'none',
2538
+ borderBottomStyle: 'solid',
2539
+ borderBottomWidth: '1px',
2540
+ borderBottomColor: 'primary',
2541
+ borderRadius: '0px',
2542
+ color: 'text',
2543
+ width: 'fit-content',
2544
+ color: color,
2545
+ userSelect: 'none',
2546
+ '@media (hover: none) and (pointer: coarse)': {
2547
+ '&:focus-visible': {
2548
+ outline: 'none !important',
2549
+ background: 'transparent !important'
2550
+ }
2551
+ }
2552
+ }, sxSelect)
2553
+ }, omitOnChange), children), /*#__PURE__*/React.createElement(Arrow, {
2554
+ sx: {
2555
+ width: width,
2556
+ height: height,
2557
+ position: 'relative',
2558
+ ml: ml,
2559
+ top: top,
2560
+ fill: 'secondary',
2561
+ transform: 'rotate(135deg)',
2562
+ pointerEvents: 'none'
2563
+ }
2564
+ }));
2565
+ };
2566
+
2567
+ const _excluded$1 = ["sx"];
2568
+
2569
+ const Slider = (_ref, ref) => {
2570
+ let {
2571
+ sx
2572
+ } = _ref,
2573
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2574
+
2575
+ const color = sx && sx.color ? sx.color : 'primary';
2576
+ const {
2577
+ theme: {
2578
+ rawColors: colors
2579
+ }
2580
+ } = useThemeUI();
2581
+ return /*#__PURE__*/React.createElement(Slider$1, _extends({
2582
+ ref: ref,
2583
+ sx: _extends({
2584
+ '&::-webkit-slider-thumb': {
2585
+ height: [22, 18, 16],
2586
+ width: [22, 18, 16],
2587
+ boxShadow: `0 0 0 0px ${colors.secondary}`,
2588
+ transition: 'box-shadow .15s ease'
2589
+ },
2590
+ '&::-moz-range-thumb': {
2591
+ height: [22, 18, 16],
2592
+ width: [22, 18, 16],
2593
+ boxShadow: `0 0 0 0px ${colors.secondary}`,
2594
+ transition: 'box-shadow .15s ease'
2595
+ },
2596
+ ':focus-visible': {
2597
+ outline: 'none !important',
2598
+ background: `${colors.secondary} !important`
2599
+ },
2600
+ ':focus': {
2601
+ color: color,
2602
+ '&::-webkit-slider-thumb': {
2603
+ boxShadow: `0 0 0 4px ${colors.secondary}`
2604
+ },
2605
+ '&::-moz-range-thumb': {
2606
+ boxShadow: `0 0 0 4px ${colors.secondary}`
2607
+ }
2608
+ },
2609
+ color: color
2610
+ }, sx)
2611
+ }, props));
2612
+ };
2613
+
2614
+ var slider = forwardRef(Slider);
2615
+
2616
+ const styles = {
2617
+ reset: {
2618
+ verticalAlign: 'baseline',
2619
+ border: 0,
2620
+ outline: 0,
2621
+ margin: 0,
2622
+ padding: 0
2623
+ },
2624
+ row: {
2625
+ borderStyle: 'solid',
2626
+ borderWidth: '0px',
2627
+ borderTopWidth: '1px',
2628
+ borderColor: 'muted',
2629
+ pt: [3, 3, 3, '20px'],
2630
+ pb: [3, 3, 3, '20px'],
2631
+ mb: ['2px']
2632
+ },
2633
+ header: {
2634
+ display: 'block',
2635
+ textTransform: 'uppercase',
2636
+ letterSpacing: 'smallcaps',
2637
+ fontFamily: 'heading',
2638
+ fontSize: [2, 2, 2, 3]
2639
+ },
2640
+ index: {
2641
+ display: 'block',
2642
+ textTransform: 'uppercase',
2643
+ letterSpacing: 'smallcaps',
2644
+ fontFamily: 'heading',
2645
+ fontSize: [2, 2, 2, 3]
2646
+ },
2647
+ entry: {
2648
+ display: 'block',
2649
+ fontSize: [2, 2, 2, 3],
2650
+ fontFamily: 'faux',
2651
+ letterSpacing: 'faux',
2652
+ mb: ['1px'],
2653
+ mt: [2, 0, 0, 0]
2654
+ }
2655
+ };
2656
+
2657
+ const Table = ({
2658
+ data,
2659
+ sx,
2660
+ color,
2661
+ header,
2662
+ columns,
2663
+ start,
2664
+ width,
2665
+ index: _index = true,
2666
+ borderBottom: _borderBottom = true,
2667
+ borderTop: _borderTop = true
2668
+ }) => {
2669
+ if (!start || !columns || !width) {
2670
+ throw new Error('Must provide columns, start, and width');
2671
+ }
2672
+
2673
+ return /*#__PURE__*/React.createElement(Box, {
2674
+ as: "table",
2675
+ sx: _extends({
2676
+ display: 'block'
2677
+ }, sx)
2678
+ }, /*#__PURE__*/React.createElement(Box, {
2679
+ as: "tbody",
2680
+ sx: {
2681
+ display: 'block'
2682
+ }
2683
+ }, header && /*#__PURE__*/React.createElement(Row, {
2684
+ as: "tr",
2685
+ sx: _extends({}, styles.reset, styles.header, styles.row, {
2686
+ color: color,
2687
+ borderTopWidth: !_borderTop ? '0px' : '1px'
2688
+ })
2689
+ }, /*#__PURE__*/React.createElement(Column, {
2690
+ as: "td",
2691
+ start: [1],
2692
+ width: columns,
2693
+ sx: styles.index
2694
+ }, header)), data.map((row, i) => {
2695
+ return /*#__PURE__*/React.createElement(Row, {
2696
+ as: "tr",
2697
+ columns: columns,
2698
+ key: i,
2699
+ sx: _extends({}, styles.reset, styles.row, {
2700
+ pb: _borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2701
+ borderBottomWidth: _borderBottom && i === data.length - 1 ? '1px' : '0px',
2702
+ borderTopWidth: !_borderTop && i === 0 && !header ? '0px' : '1px'
2703
+ })
2704
+ }, row.map((column, j) => {
2705
+ return /*#__PURE__*/React.createElement(Column, {
2706
+ as: "td",
2707
+ key: j,
2708
+ start: start[j],
2709
+ width: width[j],
2710
+ sx: j == 0 && _index ? _extends({}, styles.reset, styles.index) : _extends({}, styles.reset, styles.entry)
2711
+ }, column);
2712
+ }));
2713
+ })));
2714
+ };
2715
+
2716
+ const _excluded = ["value", "onClick", "disabled", "sx"];
2717
+
2718
+ const Toggle = (_ref, ref) => {
2719
+ let {
2720
+ value,
2721
+ onClick,
2722
+ disabled,
2723
+ sx
2724
+ } = _ref,
2725
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
2726
+
2727
+ const color = sx && sx.color ? sx.color : 'primary';
2728
+ value = disabled ? false : value;
2729
+ return /*#__PURE__*/React.createElement(Box, _extends({
2730
+ ref: ref,
2731
+ as: "button",
2732
+ onClick: onClick,
2733
+ role: "checkbox",
2734
+ "aria-checked": value,
2735
+ "aria-label": "Toggle",
2736
+ sx: _extends({
2737
+ border: 'none',
2738
+ background: 'none',
2739
+ cursor: disabled ? 'default' : 'pointer',
2740
+ p: [0],
2741
+ m: [0],
2742
+ display: 'inline-block'
2743
+ }, sx)
2744
+ }, props), /*#__PURE__*/React.createElement(Box, {
2745
+ sx: {
2746
+ width: '50px',
2747
+ height: '20px',
2748
+ borderRadius: '20px',
2749
+ backgroundColor: value ? transparentize(color, color == 'primary' ? 0.5 : 0.45) : 'muted',
2750
+ position: 'relative',
2751
+ transition: '0.15s',
2752
+ display: 'inline-block'
2753
+ }
2754
+ }, /*#__PURE__*/React.createElement(Box, {
2755
+ sx: {
2756
+ width: '14px',
2757
+ height: '14px',
2758
+ borderRadius: '7px',
2759
+ position: 'absolute',
2760
+ left: value ? '32px' : '4px',
2761
+ top: '3px',
2762
+ backgroundColor: value ? color : 'secondary',
2763
+ transition: '0.15s'
2764
+ }
2765
+ })));
2766
+ };
2767
+
2768
+ var toggle = forwardRef(Toggle);
2769
+
2770
+ const Tracking = ({
2771
+ id
2772
+ }) => {
2773
+ if (!id) {
2774
+ return null;
2775
+ }
2776
+
2777
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("script", {
2778
+ async: true,
2779
+ src: `https://www.googletagmanager.com/gtag/js?id=${id}`
2780
+ }), /*#__PURE__*/React.createElement("script", {
2781
+ dangerouslySetInnerHTML: {
2782
+ __html: `
2783
+ window.dataLayer = window.dataLayer || [];
2784
+ function gtag(){dataLayer.push(arguments);}
2785
+ gtag('js', new Date());
2786
+ gtag('config', '${id}', {
2787
+ page_path: window.location.pathname,
2788
+ });
2789
+ `
2790
+ }
2791
+ }));
2792
+ };
2793
+
2794
+ const Tray = ({
2795
+ expanded,
2796
+ sx,
2797
+ children
2798
+ }) => {
2799
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
2800
+ sx: {
2801
+ position: 'fixed',
2802
+ top: '56px',
2803
+ bottom: '0px',
2804
+ left: '0px',
2805
+ width: 'calc(100vw)',
2806
+ mt: ['56px'],
2807
+ bg: 'background',
2808
+ zIndex: 1000,
2809
+ transition: 'opacity 0.15s',
2810
+ opacity: expanded ? 0.9 : 0,
2811
+ pointerEvents: expanded ? 'all' : 'none'
2812
+ }
2813
+ }), /*#__PURE__*/React.createElement(Box, {
2814
+ sx: _extends({
2815
+ position: 'fixed',
2816
+ width: 'calc(100vw)',
2817
+ top: '0px',
2818
+ mt: ['56px'],
2819
+ pb: [6, 7, 7, 8],
2820
+ pt: [5, 6, 7, 8],
2821
+ bg: 'background',
2822
+ zIndex: 1100,
2823
+ borderStyle: 'solid',
2824
+ borderColor: 'muted',
2825
+ borderWidth: '0px',
2826
+ borderBottomWidth: '1px',
2827
+ transition: 'transform 0.15s',
2828
+ ml: [-3, -4, -5, -6],
2829
+ pl: [3, 4, 5, 6],
2830
+ pr: [3, 4, 5, 6],
2831
+ transform: expanded ? 'translateY(0)' : 'translateY(-100%)'
2832
+ }, sx)
2833
+ }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
2834
+ start: [1, 1, 1, 1],
2835
+ width: [6, 8, 10, 10]
2836
+ }, children))));
2837
+ };
2838
+
2839
+ const defaultOptions = {
2840
+ month: 'short',
2841
+ day: 'numeric',
2842
+ year: 'numeric'
2843
+ };
2844
+
2845
+ const formatDateElement = (date, element, option) => {
2846
+ if (!option) {
2847
+ return null;
2848
+ }
2849
+
2850
+ const format = typeof option === 'string' ? option : defaultOptions[element];
2851
+ const result = date.toLocaleString('default', {
2852
+ [element]: format
2853
+ });
2854
+
2855
+ if (format === 'numeric' && ['day', 'month'].includes(element)) {
2856
+ return result.padStart(2, '0');
2857
+ } else {
2858
+ return result;
2859
+ }
2860
+ };
2861
+
2862
+ const formatDate = (date, options = defaultOptions) => {
2863
+ var _options$separator;
2864
+
2865
+ const d = new Date(date.replace(/-/g, '/'));
2866
+ const month = formatDateElement(d, 'month', options.month);
2867
+ const day = formatDateElement(d, 'day', options.day);
2868
+ const year = formatDateElement(d, 'year', options.year);
2869
+ return [month, day, year].filter(Boolean).join((_options$separator = options.separator) != null ? _options$separator : ' ');
2870
+ };
2871
+
2872
+ export { Badge, button as Button, callout as Callout, Colorbar, Column, Custom404, Dimmer, Expander, FadeIn, Filter, Footer, Group, Guide, Header, input as Input, Layout, Link$1 as Link, Logo, Menu, Meta, Monogram, Row, Scrollbar, Select, Settings, slider as Slider, Table, Tag, toggle as Toggle, Tracking, Tray, formatDate, getScrollbarWidth };
2
2873
  //# sourceMappingURL=index.modern.js.map