@carbonplan/components 11.1.0 → 11.1.4-develop.0

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,2871 +1,2 @@
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
- display: 'block',
1277
- width: 'fit-content'
1278
- }
1279
- }, (mode == 'homepage' || mode == 'local') && /*#__PURE__*/React.createElement(NextLink, {
1280
- href: "/",
1281
- passHref: true
1282
- }, /*#__PURE__*/React.createElement(Link$2, {
1283
- "aria-label": "CarbonPlan Homepage",
1284
- sx: {
1285
- display: 'block'
1286
- }
1287
- }, /*#__PURE__*/React.createElement(Logo, {
1288
- id: "logo",
1289
- sx: {
1290
- cursor: 'pointer',
1291
- color: 'primary'
1292
- }
1293
- }))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$2, {
1294
- href: "https://carbonplan.org",
1295
- "aria-label": "CarbonPlan Homepage",
1296
- sx: {
1297
- display: 'block'
1298
- }
1299
- }, /*#__PURE__*/React.createElement(Logo, {
1300
- sx: {
1301
- cursor: 'pointer',
1302
- color: 'primary'
1303
- }
1304
- })))), /*#__PURE__*/React.createElement(Column, {
1305
- start: [4, 9],
1306
- width: [2, 2],
1307
- dr: 1,
1308
- sx: {
1309
- display: [status ? 'flex' : 'none', 'flex', 'flex', 'flex'],
1310
- alignItems: 'center'
1311
- }
1312
- }, /*#__PURE__*/React.createElement(Box, {
1313
- sx: {
1314
- fontSize: [1, 2, 3],
1315
- position: 'relative',
1316
- top: ['-2px', '-3px', '-3px']
1317
- }
1318
- }, status ? `(${status})` : '')), /*#__PURE__*/React.createElement(Column, {
1319
- start: [status ? 6 : 4, 6, 11, 11],
1320
- width: [status ? 1 : 3, 3, 2, 2],
1321
- sx: {
1322
- zIndex: 5000
1323
- }
1324
- }, /*#__PURE__*/React.createElement(Flex, {
1325
- sx: {
1326
- justifyContent: 'flex-end'
1327
- }
1328
- }, /*#__PURE__*/React.createElement(Flex, {
1329
- sx: {
1330
- mr: '18px',
1331
- gap: '18px',
1332
- opacity: expanded ? 0 : 1,
1333
- transition: 'opacity 0.15s',
1334
- justifyContent: 'space-between',
1335
- alignItems: 'center'
1336
- }
1337
- }, menuItems), /*#__PURE__*/React.createElement(Menu, {
1338
- sx: {
1339
- mr: ['-2px']
1340
- },
1341
- value: expanded,
1342
- onClick: toggle
1343
- }))), /*#__PURE__*/React.createElement(Box, {
1344
- sx: {
1345
- opacity: expanded ? 1 : 0,
1346
- pointerEvents: expanded ? 'all' : 'none',
1347
- position: 'fixed',
1348
- top: '0px',
1349
- right: '0px',
1350
- bottom: '0px',
1351
- minWidth: '0px',
1352
- maxHeight: '100vh',
1353
- width: '100vw',
1354
- backgroundColor: 'background',
1355
- zIndex: 4000,
1356
- pt: ['79px'],
1357
- transition: 'opacity 0.25s'
1358
- }
1359
- }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
1360
- start: [2, 4, 7, 7],
1361
- width: [5, 4, 5, 5]
1362
- }, /*#__PURE__*/React.createElement(Box, {
1363
- as: "nav",
1364
- sx: {
1365
- display: expanded ? 'inherit' : 'none',
1366
- mt: [5, 5, 5, 6]
1367
- }
1368
- }, /*#__PURE__*/React.createElement(NavGroup, {
1369
- links: links,
1370
- nav: nav,
1371
- mode: mode,
1372
- setExpanded: setExpanded
1373
- })))))));
1374
- };
1375
-
1376
- const Monogram = _ref => {
1377
- let props = _extends({}, _ref);
1378
-
1379
- return /*#__PURE__*/React.createElement(Box, _extends({
1380
- as: "svg",
1381
- width: "80",
1382
- stroke: "none",
1383
- fill: "currentColor",
1384
- viewBox: "0 0 32 32"
1385
- }, props), /*#__PURE__*/React.createElement("path", {
1386
- 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"
1387
- }), /*#__PURE__*/React.createElement("path", {
1388
- 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"
1389
- }), /*#__PURE__*/React.createElement("path", {
1390
- 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"
1391
- }));
1392
- };
1393
-
1394
- const Footer = () => {
1395
- return /*#__PURE__*/React.createElement(Box, {
1396
- sx: {
1397
- mt: [7, 7, 7, 8],
1398
- mb: [7, 7, 7, 8],
1399
- pb: [2, 1, 0, 0]
1400
- }
1401
- }, /*#__PURE__*/React.createElement(Row, {
1402
- sx: {
1403
- mb: [0, 0, 4, 5]
1404
- }
1405
- }, /*#__PURE__*/React.createElement(Column, {
1406
- start: [1, 2],
1407
- width: [3, 3]
1408
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
1409
- sx: {
1410
- fontSize: [2, 2, 2, 3],
1411
- fontFamily: 'heading',
1412
- letterSpacing: 'mono',
1413
- mb: [2]
1414
- }
1415
- }, "EMAIL"), /*#__PURE__*/React.createElement(Link$2, {
1416
- href: "mailto:hello@carbonplan.org",
1417
- sx: {
1418
- textDecoration: 'none',
1419
- fontSize: [2, 2, 2, 3]
1420
- }
1421
- }, "hello@carbonplan.org"))), /*#__PURE__*/React.createElement(Column, {
1422
- start: [5],
1423
- width: [1],
1424
- dl: 1,
1425
- dr: 1,
1426
- sx: {
1427
- display: ['flex', 'none', 'none', 'none'],
1428
- justifyContent: ['center']
1429
- }
1430
- }, /*#__PURE__*/React.createElement(Monogram, {
1431
- sx: {
1432
- mt: ['-4px'],
1433
- width: '60px',
1434
- height: '60px'
1435
- }
1436
- })), /*#__PURE__*/React.createElement(Column, {
1437
- start: [1, 5, 5, 5],
1438
- width: [3, 3],
1439
- sx: {
1440
- mt: [3, 0, 0, 0]
1441
- }
1442
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
1443
- sx: {
1444
- fontSize: [2, 2, 2, 3],
1445
- fontFamily: 'heading',
1446
- letterSpacing: 'mono',
1447
- mb: [2]
1448
- }
1449
- }, "FOLLOW"), /*#__PURE__*/React.createElement(Link$2, {
1450
- href: "https://twitter.com/carbonplanorg",
1451
- sx: {
1452
- textDecoration: 'none',
1453
- fontSize: [2, 2, 2, 3]
1454
- }
1455
- }, "@carbonplanorg"))), /*#__PURE__*/React.createElement(Column, {
1456
- start: [1, 9],
1457
- width: [5, 4, 3, 3],
1458
- sx: {
1459
- mt: ['42px', '42px', 0, 0],
1460
- mb: [3, 3, 0, 0]
1461
- }
1462
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Box, {
1463
- sx: {
1464
- fontSize: [2, 2, 2, 3],
1465
- fontFamily: 'body',
1466
- color: 'secondary'
1467
- }
1468
- }, "CarbonPlan is a registered non-profit public benefit corporation in California with 501(c)(3) status.")))), /*#__PURE__*/React.createElement(Row, {
1469
- sx: {
1470
- mb: ['2px'],
1471
- mt: [5, 5, 4]
1472
- }
1473
- }, /*#__PURE__*/React.createElement(Column, {
1474
- start: [1, 1, 2, 2],
1475
- width: [3, 2, 3, 3],
1476
- sx: {
1477
- display: 'flex',
1478
- alignItems: ['flex-start', 'flex-start', 'flex-end']
1479
- }
1480
- }, /*#__PURE__*/React.createElement(Box, {
1481
- sx: {
1482
- bottom: '0px',
1483
- borderStyle: 'solid',
1484
- borderColor: 'muted',
1485
- borderWidth: '0px',
1486
- borderTopWidth: '1px',
1487
- pt: [2]
1488
- }
1489
- }, /*#__PURE__*/React.createElement(Box, {
1490
- sx: {
1491
- color: 'secondary',
1492
- fontSize: [1, 1, 1, 2],
1493
- fontFamily: 'mono',
1494
- letterSpacing: 'mono'
1495
- }
1496
- }, "(c) 2021 CARBONPLAN"))), /*#__PURE__*/React.createElement(Column, {
1497
- start: [4, 3, 5, 5],
1498
- width: [2, 2, 3, 3],
1499
- sx: {
1500
- display: 'flex',
1501
- alignItems: ['flex-start', 'flex-start', 'flex-end'],
1502
- mt: [0, 0, 0, 0]
1503
- }
1504
- }, /*#__PURE__*/React.createElement(Box, {
1505
- sx: {
1506
- bottom: '0px',
1507
- borderStyle: 'solid',
1508
- borderColor: 'muted',
1509
- borderWidth: '0px',
1510
- borderTopWidth: '1px',
1511
- width: ['100%', 'auto', 'auto', 'auto'],
1512
- pt: [2]
1513
- }
1514
- }, /*#__PURE__*/React.createElement(NextLink, {
1515
- href: "/terms",
1516
- passHref: true
1517
- }, /*#__PURE__*/React.createElement(Box, {
1518
- as: "a",
1519
- sx: {
1520
- textDecoration: 'none',
1521
- fontSize: [1, 1, 1, 2],
1522
- color: 'secondary',
1523
- fontFamily: 'mono',
1524
- letterSpacing: 'mono',
1525
- display: 'block'
1526
- }
1527
- }, "READ OUR TERMS")))), /*#__PURE__*/React.createElement(Column, {
1528
- start: [5, 7, 9, 9],
1529
- width: [2, 3, 3, 3],
1530
- sx: {
1531
- display: ['none', 'initial', 'initial', 'initial']
1532
- }
1533
- }, /*#__PURE__*/React.createElement(Monogram, {
1534
- sx: {
1535
- width: 80,
1536
- height: 80,
1537
- mt: [0, '-10px', 4, 5],
1538
- mb: ['-12px']
1539
- }
1540
- }))));
1541
- };
1542
-
1543
- const _excluded$8 = ["sx"];
1544
-
1545
- const Dimmer = _ref => {
1546
- let {
1547
- sx
1548
- } = _ref,
1549
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
1550
-
1551
- const [colorMode, setColorMode] = useColorMode();
1552
- const toggle = useCallback(() => {
1553
- setColorMode(colorMode === 'light' ? 'dark' : 'light');
1554
- }, [colorMode]);
1555
- return /*#__PURE__*/React.createElement(IconButton, _extends({
1556
- "aria-label": "Toggle dark mode",
1557
- onClick: toggle,
1558
- role: "checkbox",
1559
- sx: _extends({
1560
- width: 32,
1561
- height: 32,
1562
- display: 'inline-block',
1563
- cursor: 'pointer',
1564
- color: 'secondary'
1565
- }, sx)
1566
- }, props), /*#__PURE__*/React.createElement(Sun, {
1567
- sx: {
1568
- strokeWidth: '1.75',
1569
- transition: 'stroke 0.15s',
1570
- '@media (hover: hover) and (pointer: fine)': {
1571
- '&:hover': {
1572
- stroke: 'primary'
1573
- }
1574
- }
1575
- }
1576
- }));
1577
- };
1578
-
1579
- const GitSha = () => {
1580
- const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
1581
- const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
1582
- const slug = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG;
1583
- const {
1584
- theme
1585
- } = useThemeUI();
1586
- const color = theme.rawColors.secondary;
1587
-
1588
- if (sha && owner && slug) {
1589
- const shortSha = sha.substring(0, 7);
1590
- const href = 'https://github.com/' + owner + '/' + slug + '/tree/' + sha;
1591
- return /*#__PURE__*/React.createElement(Box, {
1592
- sx: {
1593
- display: 'inline-block',
1594
- width: '87px'
1595
- }
1596
- }, /*#__PURE__*/React.createElement(Separator, {
1597
- color: color
1598
- }), /*#__PURE__*/React.createElement(Link$2, {
1599
- href: href,
1600
- sx: {
1601
- whiteSpace: 'nowrap',
1602
- display: 'inline-block',
1603
- ml: [2],
1604
- fontFamily: 'mono',
1605
- letterSpacing: 'body',
1606
- color: color,
1607
- fontSize: [1],
1608
- textTransform: 'uppercase',
1609
- textDecoration: 'none'
1610
- }
1611
- }, shortSha));
1612
- } else {
1613
- // fallback
1614
- return /*#__PURE__*/React.createElement(Box, {
1615
- sx: {
1616
- display: 'inline-block',
1617
- width: '87px'
1618
- }
1619
- }, /*#__PURE__*/React.createElement(Separator, {
1620
- color: color
1621
- }), /*#__PURE__*/React.createElement(Text, {
1622
- sx: {
1623
- whiteSpace: 'nowrap',
1624
- display: 'inline-block',
1625
- ml: [2],
1626
- fontFamily: 'mono',
1627
- letterSpacing: 'body',
1628
- color: color,
1629
- fontSize: [1],
1630
- textTransform: 'uppercase'
1631
- }
1632
- }, color));
1633
- }
1634
- };
1635
-
1636
- const Separator = ({
1637
- color
1638
- }) => {
1639
- return /*#__PURE__*/React.createElement("svg", {
1640
- fill: color,
1641
- opacity: "0.8",
1642
- viewBox: "0 0 24 24",
1643
- width: "24",
1644
- height: "24"
1645
- }, /*#__PURE__*/React.createElement("circle", {
1646
- r: 5,
1647
- cx: 19,
1648
- cy: 19
1649
- }));
1650
- };
1651
-
1652
- const Value = ({
1653
- mode
1654
- }) => {
1655
- const [display, setDisplay] = useState(init(mode));
1656
- useEffect(() => {
1657
- if (mode === 'mouse') {
1658
- const setFromEvent = e => {
1659
- const x = format(e.clientX, 4);
1660
- const y = format(e.clientY, 4);
1661
- setDisplay(`X,Y: ${x},${y}`);
1662
- };
1663
-
1664
- window.addEventListener('mousemove', setFromEvent);
1665
- return () => {
1666
- window.removeEventListener('mousemove', setFromEvent);
1667
- };
1668
- }
1669
-
1670
- if (mode === 'scroll') {
1671
- const setFromEvent = e => {
1672
- const y = scrollFraction(window);
1673
- setDisplay(`SCROLL: 0.${format((y * 100).toFixed(0), 2)}`);
1674
- };
1675
-
1676
- window.addEventListener('scroll', setFromEvent);
1677
- return () => {
1678
- window.removeEventListener('scroll', setFromEvent);
1679
- };
1680
- }
1681
- }, []);
1682
- return /*#__PURE__*/React.createElement(Text, {
1683
- sx: {
1684
- whiteSpace: 'nowrap',
1685
- display: 'inline-block',
1686
- mr: '-6px',
1687
- fontFamily: 'mono',
1688
- letterSpacing: 'body',
1689
- color: 'secondary',
1690
- fontSize: [1],
1691
- textTransform: 'uppercase'
1692
- }
1693
- }, display);
1694
- };
1695
-
1696
- const Metadata = ({
1697
- mode
1698
- }) => {
1699
- return /*#__PURE__*/React.createElement(Box, {
1700
- sx: {
1701
- userSelect: 'none',
1702
- position: 'fixed',
1703
- bottom: '42px',
1704
- right: '24px',
1705
- transformOrigin: 'right',
1706
- transform: 'rotate(90deg)',
1707
- display: ['none', 'none', 'initial']
1708
- }
1709
- }, /*#__PURE__*/React.createElement(Value, {
1710
- mode: mode
1711
- }), /*#__PURE__*/React.createElement(GitSha, null));
1712
- };
1713
-
1714
- function init(mode) {
1715
- if (mode === 'mouse') {
1716
- return `X,Y: ${format(0, 4)},${format(0, 4)}`;
1717
- } else if (mode === 'scroll') {
1718
- return `SCROLL: 0.${format(0 .toFixed(0), 2)}`;
1719
- } else {
1720
- return mode;
1721
- }
1722
- }
1723
-
1724
- function format(num, pad) {
1725
- return num.toString().padStart(pad, '0');
1726
- }
1727
-
1728
- function scrollFraction(window, documnt) {
1729
- return Math.min(window.scrollY / (document.body.offsetHeight - 770), 0.99);
1730
- }
1731
-
1732
- const _excluded$7 = ["duration", "delay", "children"];
1733
- const fade = keyframes({
1734
- from: {
1735
- opacity: 0
1736
- },
1737
- to: {
1738
- opacity: 1
1739
- }
1740
- });
1741
-
1742
- const FadeIn = _ref => {
1743
- let {
1744
- duration = 300,
1745
- delay = 0,
1746
- children
1747
- } = _ref,
1748
- delegated = _objectWithoutPropertiesLoose(_ref, _excluded$7);
1749
-
1750
- return /*#__PURE__*/React.createElement(Box, _extends({}, delegated, {
1751
- sx: {
1752
- animationDuration: duration + 'ms',
1753
- animationDelay: delay + 'ms',
1754
- animationName: fade.toString(),
1755
- animationFillMode: 'backwards'
1756
- }
1757
- }), children);
1758
- };
1759
-
1760
- const getScrollbarWidth = document => {
1761
- const outer = document.createElement('div');
1762
- outer.style.visibility = 'hidden';
1763
- outer.style.width = '100px';
1764
- document.body.appendChild(outer);
1765
- outer.style.overflow = 'scroll';
1766
- const inner = document.createElement('div');
1767
- inner.style.width = '100%';
1768
- outer.appendChild(inner);
1769
- const delta = outer.offsetWidth - inner.offsetWidth;
1770
- outer.parentNode.removeChild(outer);
1771
- return delta;
1772
- };
1773
-
1774
- const Scrollbar = () => {
1775
- useEffect(() => {
1776
- if (typeof document !== 'undefined') {
1777
- const delta = getScrollbarWidth(document);
1778
-
1779
- if (delta > 0) {
1780
- document.body.classList.add('custom-scrollbar');
1781
- document.getElementsByTagName('html')[0].classList.add('custom-scrollbar');
1782
- }
1783
- }
1784
- }, []);
1785
- return null;
1786
- };
1787
-
1788
- const Guide = ({
1789
- color: _color = 'muted'
1790
- }) => {
1791
- const [display, setDisplay] = useState(false);
1792
- useEffect(() => {
1793
- function handler(event) {
1794
- const {
1795
- key,
1796
- keyCode,
1797
- metaKey
1798
- } = event;
1799
-
1800
- if (key === ';' && metaKey) {
1801
- setDisplay(prev => !prev);
1802
- }
1803
- }
1804
-
1805
- document.addEventListener('keydown', handler);
1806
- return () => {
1807
- document.removeEventListener('keydown', handler);
1808
- };
1809
- }, []);
1810
- return /*#__PURE__*/React.createElement(Box, {
1811
- sx: {
1812
- position: 'fixed',
1813
- width: '100%',
1814
- left: 0,
1815
- top: 0,
1816
- zIndex: _color === 'teal' ? 5000 : -1,
1817
- pointerEvents: 'none',
1818
- display: display ? 'initial' : 'none'
1819
- }
1820
- }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Box, {
1821
- sx: {
1822
- display: ['none', 'none', 'initial', 'initial']
1823
- }
1824
- }, /*#__PURE__*/React.createElement(GuideColumns, {
1825
- indices: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
1826
- color: _color
1827
- })), /*#__PURE__*/React.createElement(Box, {
1828
- sx: {
1829
- display: ['none', 'initial', 'none', 'none']
1830
- }
1831
- }, /*#__PURE__*/React.createElement(GuideColumns, {
1832
- indices: [1, 2, 3, 4, 5, 6, 7, 8],
1833
- color: _color
1834
- })), /*#__PURE__*/React.createElement(Box, {
1835
- sx: {
1836
- display: ['initial', 'none', 'none', 'none']
1837
- }
1838
- }, /*#__PURE__*/React.createElement(GuideColumns, {
1839
- indices: [1, 2, 3, 4, 5, 6],
1840
- color: _color
1841
- }))));
1842
- };
1843
-
1844
- const colorCycle = ['red', 'orange', 'yellow', 'green', 'teal', 'blue', 'purple', 'pink'];
1845
-
1846
- function GuideColumns({
1847
- indices,
1848
- color
1849
- }) {
1850
- const sx = {
1851
- outerGuideColumn: {
1852
- borderStyle: 'solid',
1853
- borderWidth: '0px',
1854
- borderLeftWidth: color === 'teal' ? '0px' : '1px',
1855
- borderRightWidth: color === 'teal' ? '0px' : '1px',
1856
- opacity: color == 'teal' ? 0.4 : 1
1857
- },
1858
- innerGuideColumn: {
1859
- borderStyle: 'solid',
1860
- borderWidth: '0px',
1861
- borderLeftWidth: '0px',
1862
- borderRightWidth: '0px',
1863
- opacity: color == 'teal' ? 0.4 : 1
1864
- }
1865
- };
1866
- return /*#__PURE__*/React.createElement(Row, null, indices.map(i => {
1867
- return /*#__PURE__*/React.createElement(Column, {
1868
- key: i,
1869
- start: [i],
1870
- width: [1, 1],
1871
- dl: 0.5,
1872
- dr: 0.5,
1873
- sx: _extends({
1874
- bg: color === 'teal' ? 'teal' : 'transparent',
1875
- height: '100vh'
1876
- }, sx.innerGuideColumn)
1877
- }, /*#__PURE__*/React.createElement(Box, {
1878
- sx: _extends({
1879
- mx: ['12px', 3, 3, 4],
1880
- bg: color === 'teal' ? 'background' : 'transparent',
1881
- height: '100%',
1882
- borderLeftColor: color === 'rainbow' ? colorCycle[i % 8] : 'muted',
1883
- borderRightColor: color === 'rainbow' ? colorCycle[i % 8] : 'muted'
1884
- }, sx.outerGuideColumn)
1885
- }));
1886
- }));
1887
- }
1888
-
1889
- const _excluded$6 = ["value", "sx"];
1890
-
1891
- const Settings = _ref => {
1892
- let {
1893
- value,
1894
- sx
1895
- } = _ref,
1896
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1897
-
1898
- return /*#__PURE__*/React.createElement(IconButton, _extends({
1899
- sx: _extends({
1900
- cursor: 'pointer',
1901
- fill: 'none',
1902
- strokeWidth: '2px',
1903
- stroke: 'text',
1904
- '.paren': {
1905
- opacity: '0'
1906
- },
1907
- '@media (hover: hover) and (pointer: fine)': {
1908
- '&:hover .paren': {
1909
- opacity: '1'
1910
- }
1911
- }
1912
- }, sx),
1913
- "aria-label": "Toggle Menu"
1914
- }, props), !value && /*#__PURE__*/React.createElement("svg", {
1915
- style: {
1916
- width: '50px',
1917
- height: '30px',
1918
- transform: 'scale(2)',
1919
- marginTop: '-3px'
1920
- },
1921
- xmlns: "http://www.w3.org/2000/svg",
1922
- viewBox: "0 0 68 36"
1923
- }, /*#__PURE__*/React.createElement("line", {
1924
- x1: "24",
1925
- y1: "2.1",
1926
- x2: "24",
1927
- y2: "6.1"
1928
- }), /*#__PURE__*/React.createElement("line", {
1929
- x1: "24",
1930
- y1: "24.1",
1931
- x2: "24",
1932
- y2: "33.9"
1933
- }), /*#__PURE__*/React.createElement("line", {
1934
- x1: "44",
1935
- y1: "2.1",
1936
- x2: "44",
1937
- y2: "12.1"
1938
- }), /*#__PURE__*/React.createElement("line", {
1939
- x1: "44",
1940
- y1: "30.1",
1941
- x2: "44",
1942
- y2: "33.9"
1943
- }), /*#__PURE__*/React.createElement("circle", {
1944
- cx: "24",
1945
- cy: "15.1",
1946
- r: "5"
1947
- }), /*#__PURE__*/React.createElement("circle", {
1948
- cx: "44",
1949
- cy: "21.1",
1950
- r: "5"
1951
- }), /*#__PURE__*/React.createElement("path", {
1952
- style: {
1953
- transition: 'all 0.2s'
1954
- },
1955
- className: "paren",
1956
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1957
- }), /*#__PURE__*/React.createElement("path", {
1958
- style: {
1959
- transition: 'all 0.2s'
1960
- },
1961
- className: "paren",
1962
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1963
- })), value && /*#__PURE__*/React.createElement("svg", {
1964
- style: {
1965
- width: '50px',
1966
- height: '30px',
1967
- transform: 'scale(2)',
1968
- marginTop: '-3px'
1969
- },
1970
- xmlns: "http://www.w3.org/2000/svg",
1971
- viewBox: "0 0 68 36"
1972
- }, /*#__PURE__*/React.createElement("line", {
1973
- x1: "50.85",
1974
- y1: "29.79",
1975
- x2: "17.15",
1976
- y2: "6.21"
1977
- }), /*#__PURE__*/React.createElement("line", {
1978
- x1: "17.15",
1979
- y1: "29.79",
1980
- x2: "50.85",
1981
- y2: "6.21"
1982
- }), /*#__PURE__*/React.createElement("path", {
1983
- style: {
1984
- transition: 'all 0.2s'
1985
- },
1986
- className: "paren",
1987
- d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1988
- }), /*#__PURE__*/React.createElement("path", {
1989
- style: {
1990
- transition: 'all 0.2s'
1991
- },
1992
- className: "paren",
1993
- d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1994
- })));
1995
- };
1996
-
1997
- const Layout = ({
1998
- title,
1999
- description,
2000
- card,
2001
- children,
2002
- status,
2003
- nav,
2004
- settings,
2005
- footer: _footer = true,
2006
- header: _header = true,
2007
- metadata: _metadata = 'mouse',
2008
- links: _links = 'remote',
2009
- dimmer: _dimmer = 'bottom',
2010
- guide: _guide = true,
2011
- scrollbar: _scrollbar = true,
2012
- fade: _fade = true,
2013
- container: _container = true
2014
- }) => {
2015
- let content = children;
2016
-
2017
- if (_fade) {
2018
- content = /*#__PURE__*/React.createElement(FadeIn, {
2019
- duration: 250
2020
- }, content);
2021
- }
2022
-
2023
- if (_container) {
2024
- content = /*#__PURE__*/React.createElement(Box, {
2025
- sx: {
2026
- mb: [8, 8, 9, 10]
2027
- }
2028
- }, /*#__PURE__*/React.createElement(Container, null, content));
2029
- }
2030
-
2031
- const {
2032
- theme
2033
- } = useThemeUI();
2034
- useEffect(() => {
2035
- if (!theme) return;
2036
-
2037
- const handler = e => {
2038
- if (e.matches && settings != null && settings.value && settings != null && settings.onClick) {
2039
- settings == null ? void 0 : settings.onClick();
2040
- }
2041
- };
2042
-
2043
- const query = window.matchMedia(`(min-width: ${theme.breakpoints[1]})`);
2044
- query.onchange = handler;
2045
- return () => {
2046
- query.onchange = null;
2047
- };
2048
- }, [theme == null ? void 0 : theme.breakpoints, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2049
- const menuItems = [/*#__PURE__*/React.createElement(Dimmer, {
2050
- key: "dimmer",
2051
- sx: {
2052
- color: 'primary',
2053
- mt: '-2px',
2054
- display: ['block', 'block', _dimmer === 'top' ? 'block' : 'none', _dimmer === 'top' ? 'block' : 'none']
2055
- }
2056
- })];
2057
-
2058
- if (settings) {
2059
- menuItems.push( /*#__PURE__*/React.createElement(Settings, _extends({
2060
- key: "settings",
2061
- sx: {
2062
- mr: ['2px'],
2063
- display: ['inherit', 'inherit', 'none', 'none']
2064
- }
2065
- }, settings)));
2066
- }
2067
-
2068
- return /*#__PURE__*/React.createElement(React.Fragment, null, _guide && /*#__PURE__*/React.createElement(Guide, {
2069
- color: _guide
2070
- }), _scrollbar && /*#__PURE__*/React.createElement(Scrollbar, null), /*#__PURE__*/React.createElement(Meta, {
2071
- card: card,
2072
- description: description,
2073
- title: title
2074
- }), /*#__PURE__*/React.createElement(Flex, {
2075
- sx: {
2076
- flexDirection: 'column',
2077
- minHeight: '100vh'
2078
- }
2079
- }, _header && /*#__PURE__*/React.createElement(Box, {
2080
- as: "header",
2081
- sx: {
2082
- width: '100%',
2083
- borderStyle: 'solid',
2084
- borderColor: 'muted',
2085
- borderWidth: '0px',
2086
- borderBottomWidth: '1px',
2087
- position: 'sticky',
2088
- top: 0,
2089
- bg: 'background',
2090
- height: '56px',
2091
- zIndex: 2000
2092
- }
2093
- }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Header, {
2094
- mode: _links,
2095
- status: status,
2096
- nav: nav,
2097
- menuItems: menuItems
2098
- }))), /*#__PURE__*/React.createElement(Box, {
2099
- sx: {
2100
- width: '100%',
2101
- flex: '1 1 auto'
2102
- }
2103
- }, content), _footer && /*#__PURE__*/React.createElement(Box, {
2104
- as: "footer",
2105
- sx: {
2106
- width: '100%',
2107
- borderStyle: 'solid',
2108
- borderColor: 'muted',
2109
- borderWidth: '0px',
2110
- borderTopWidth: '1px'
2111
- }
2112
- }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Footer, null))), _dimmer === 'bottom' && /*#__PURE__*/React.createElement(Box, {
2113
- sx: {
2114
- display: ['none', 'none', 'initial', 'initial'],
2115
- position: ['fixed'],
2116
- right: [13],
2117
- bottom: [17, 17, 15, 15]
2118
- }
2119
- }, /*#__PURE__*/React.createElement(Dimmer, null)), _metadata && /*#__PURE__*/React.createElement(Metadata, {
2120
- mode: _metadata
2121
- })));
2122
- };
2123
-
2124
- const Custom404 = () => {
2125
- return /*#__PURE__*/React.createElement(Layout, {
2126
- footer: false,
2127
- title: '404 / carbonplan'
2128
- }, /*#__PURE__*/React.createElement(Row, {
2129
- sx: {
2130
- mb: [5, 0, 0],
2131
- pt: [0, 0, 6]
2132
- }
2133
- }, /*#__PURE__*/React.createElement(Column, {
2134
- start: [1, 1, 3, 3],
2135
- width: [6, 4, 4, 4]
2136
- }, /*#__PURE__*/React.createElement(Styled.h1, null, "Oops!"), /*#__PURE__*/React.createElement(Box, {
2137
- sx: {
2138
- fontSize: [4, 4, 4, 5],
2139
- lineHeight: 'h3',
2140
- mt: [3, 4, 4],
2141
- mb: [2, 3, 3],
2142
- maxWidth: ['90%', '90%', '400px']
2143
- }
2144
- }, "Sorry but we can't seem to find the page you are looking for."), /*#__PURE__*/React.createElement(Box, {
2145
- sx: {
2146
- color: 'secondary',
2147
- fontFamily: 'mono',
2148
- letterSpacing: 'mono',
2149
- fontSize: [2, 2, 2, 3],
2150
- mt: [4, 5, 5]
2151
- }
2152
- }, "ERROR CODE 404")), /*#__PURE__*/React.createElement(Column, {
2153
- start: [2, 5, 7, 7],
2154
- width: [4, 4, 4, 4]
2155
- }, /*#__PURE__*/React.createElement(Box, {
2156
- sx: {
2157
- width: ['100%'],
2158
- mt: [2, 4, 4, 5],
2159
- fill: 'primary'
2160
- }
2161
- }, /*#__PURE__*/React.createElement(PoopSad, {
2162
- sx: {
2163
- width: '100%',
2164
- height: 'auto'
2165
- }
2166
- })))));
2167
- };
2168
-
2169
- const Expander = ({
2170
- value,
2171
- id,
2172
- onClick,
2173
- sx
2174
- }) => {
2175
- return /*#__PURE__*/React.createElement(IconButton, {
2176
- onClick: onClick,
2177
- id: id,
2178
- role: "checkbox",
2179
- "aria-checked": value,
2180
- "aria-label": "Expand",
2181
- sx: _extends({
2182
- display: 'inline-block',
2183
- width: 24,
2184
- height: 24,
2185
- p: [1],
2186
- cursor: 'pointer',
2187
- fill: 'secondary',
2188
- stroke: 'secondary',
2189
- '@media (hover: hover) and (pointer: fine)': {
2190
- '&:hover': {
2191
- fill: 'primary',
2192
- stroke: 'primary'
2193
- }
2194
- }
2195
- }, sx)
2196
- }, /*#__PURE__*/React.createElement("svg", {
2197
- viewBox: "0 0 16 16"
2198
- }, /*#__PURE__*/React.createElement("path", {
2199
- d: "M8,0 V16 M0,8 H16",
2200
- style: {
2201
- strokeWidth: 2,
2202
- transition: '0.25s all',
2203
- transformOrigin: '8px 8px',
2204
- transform: value ? 'rotate(45deg)' : ''
2205
- }
2206
- })));
2207
- };
2208
-
2209
- const _excluded$5 = ["label", "value", "sx", "children"];
2210
-
2211
- const Tag = _ref => {
2212
- let {
2213
- label,
2214
- value,
2215
- sx,
2216
- children
2217
- } = _ref,
2218
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2219
-
2220
- const color = sx && sx.color ? sx.color : 'primary';
2221
- const isClickable = props && (props.onClick || props.onDoubleClick);
2222
- return /*#__PURE__*/React.createElement(Box, _extends({
2223
- as: isClickable ? 'button' : 'span',
2224
- role: "checkbox",
2225
- "aria-checked": value,
2226
- "aria-label": label,
2227
- sx: _extends({
2228
- display: 'inline-block',
2229
- fontSize: [1, 1, 1, 2],
2230
- fontFamily: 'mono',
2231
- letterSpacing: 'mono',
2232
- cursor: isClickable ? 'pointer' : 'inherit',
2233
- color: color,
2234
- backgroundColor: 'transparent',
2235
- borderStyle: 'solid',
2236
- borderColor: color,
2237
- lineHeight: 'body',
2238
- borderWidth: '0px',
2239
- borderBottomWidth: '1px',
2240
- textTransform: 'uppercase',
2241
- userSelect: 'none',
2242
- transition: 'opacity 0.05s',
2243
- pt: ['1px'],
2244
- pb: ['2px'],
2245
- px: [0],
2246
- m: [0],
2247
- opacity: value == null || value ? 1 : color == 'primary' ? 0.24 : 0.33
2248
- }, sx)
2249
- }, props), children);
2250
- };
2251
-
2252
- const _excluded$4 = ["values", "setValues", "label", "colors", "showAll", "multiSelect"];
2253
- const sx = {
2254
- label: {
2255
- fontFamily: 'mono',
2256
- letterSpacing: 'mono',
2257
- fontSize: [1, 1, 1, 2],
2258
- color: 'secondary',
2259
- userSelect: 'none',
2260
- textTransform: 'uppercase'
2261
- }
2262
- };
2263
-
2264
- const duplicateOptions = (options, defaultValue, overrides = {}) => {
2265
- return Object.keys(options).reduce((o, key) => Object.assign(o, {
2266
- [key]: overrides[key] || defaultValue
2267
- }), {});
2268
- };
2269
-
2270
- const isAll = option => {
2271
- return Object.keys(option).filter(d => option[d]).length == Object.keys(option).length;
2272
- };
2273
-
2274
- const updateValues = ({
2275
- values,
2276
- multiSelect,
2277
- setValues,
2278
- value
2279
- }) => {
2280
- const isAllAlreadySelected = isAll(values);
2281
- const isSelectingAll = value === 'all';
2282
- let updatedToggle;
2283
-
2284
- if (multiSelect) {
2285
- if (isSelectingAll && !isAllAlreadySelected) {
2286
- // select all
2287
- updatedToggle = duplicateOptions(values, true);
2288
- } else if (isSelectingAll && isAllAlreadySelected) {
2289
- // deselect all
2290
- updatedToggle = duplicateOptions(values, false);
2291
- } else {
2292
- // de/select value, inherit other values
2293
- updatedToggle = _extends({}, values, {
2294
- [value]: !values[value]
2295
- });
2296
- }
2297
- } else {
2298
- if (isSelectingAll && !isAllAlreadySelected) {
2299
- // select all
2300
- updatedToggle = duplicateOptions(values, true);
2301
- } else if (isSelectingAll && isAllAlreadySelected) ; else {
2302
- // select only value
2303
- updatedToggle = duplicateOptions(values, false, {
2304
- [value]: true
2305
- });
2306
- }
2307
- }
2308
-
2309
- if (updatedToggle) {
2310
- setValues(updatedToggle);
2311
- }
2312
- };
2313
-
2314
- const Filter = _ref => {
2315
- let {
2316
- values,
2317
- setValues,
2318
- label,
2319
- colors,
2320
- showAll = false,
2321
- multiSelect = false
2322
- } = _ref,
2323
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2324
-
2325
- return /*#__PURE__*/React.createElement(Box, props, label && /*#__PURE__*/React.createElement(Box, {
2326
- sx: sx.label
2327
- }, label), /*#__PURE__*/React.createElement(Box, {
2328
- sx: {
2329
- mt: label ? [3] : 0
2330
- }
2331
- }, showAll && /*#__PURE__*/React.createElement(Tag, {
2332
- onClick: () => updateValues({
2333
- values: values,
2334
- multiSelect,
2335
- setValues: setValues,
2336
- value: 'all'
2337
- }),
2338
- value: isAll(values),
2339
- sx: {
2340
- mr: [2]
2341
- }
2342
- }, "All"), Object.keys(values).map((d, i) => /*#__PURE__*/React.createElement(Tag, {
2343
- onClick: () => updateValues({
2344
- values: values,
2345
- multiSelect,
2346
- setValues: setValues,
2347
- value: d
2348
- }),
2349
- onDoubleClick: () => updateValues({
2350
- values: values,
2351
- multiSelect: false,
2352
- setValues: setValues,
2353
- value: d
2354
- }),
2355
- key: i,
2356
- value: values[d],
2357
- sx: {
2358
- width: 'max-content',
2359
- color: colors ? colors[d] : 'primary',
2360
- mr: [2],
2361
- mb: [1]
2362
- }
2363
- }, d))));
2364
- };
2365
-
2366
- const sizes = {
2367
- xs: [1],
2368
- sm: [3],
2369
- md: [5],
2370
- lg: [7],
2371
- xl: [9]
2372
- };
2373
-
2374
- const Group = ({
2375
- children,
2376
- direction: _direction = 'vertical',
2377
- spacing: _spacing = 'md'
2378
- }) => {
2379
- let marginValue;
2380
-
2381
- if (typeof _spacing === 'string') {
2382
- marginValue = sizes[_spacing];
2383
- } else if (typeof _spacing === 'number') {
2384
- marginValue = [_spacing];
2385
- } else if (Array.isArray(_spacing) && _spacing.every(el => typeof el === 'number')) {
2386
- marginValue = _spacing;
2387
- }
2388
-
2389
- if (!marginValue) {
2390
- throw new Error('Invalid spacing size. Must be numeric value(s) or one of xs, sm, md, lg, or xl');
2391
- }
2392
-
2393
- if (!['horizontal', 'vertical'].includes(_direction)) {
2394
- throw new Error('Invalid direction value. Must be either horizontal or vertical');
2395
- }
2396
-
2397
- const marginProperty = _direction === 'vertical' ? 'mt' : 'ml';
2398
- const additionalStyles = _direction === 'horizontal' ? {
2399
- display: 'inline-block'
2400
- } : {};
2401
- return /*#__PURE__*/React.createElement(Box, null, React.Children.map(children, (child, i) => {
2402
- return /*#__PURE__*/React.createElement(Box, {
2403
- sx: _extends({
2404
- [marginProperty]: i > 0 ? marginValue : 0
2405
- }, additionalStyles)
2406
- }, child);
2407
- }));
2408
- };
2409
-
2410
- const _excluded$3 = ["size", "inverted", "sx"];
2411
-
2412
- const Input = (_ref, ref) => {
2413
- let {
2414
- size = 'sm',
2415
- inverted,
2416
- sx
2417
- } = _ref,
2418
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2419
-
2420
- const defaultColor = inverted ? 'secondary' : 'primary';
2421
-
2422
- const styles = _extends({
2423
- color: defaultColor,
2424
- borderColor: 'secondary',
2425
- borderStyle: 'solid',
2426
- borderWidth: '0px',
2427
- borderBottomWidth: '1px',
2428
- borderRadius: '0px',
2429
- transition: 'border 0.15s',
2430
- borderBottomWidth: '1px',
2431
- width: 'calc(min(15ch, 100%))',
2432
- p: [0],
2433
- py: ['2px'],
2434
- 'input::-webkit-outer-spin-button': {
2435
- WebkitAppearance: 'none',
2436
- margin: 0
2437
- },
2438
- 'input::-webkit-inner-spin-button': {
2439
- WebkitAppearance: 'none',
2440
- margin: 0
2441
- },
2442
- ':focus': {
2443
- borderColor: 'primary'
2444
- },
2445
- ':focus-visible': {
2446
- outline: 'none !important',
2447
- background: 'none !important'
2448
- }
2449
- }, getSizeStyles(size), sx);
2450
-
2451
- return /*#__PURE__*/React.createElement(Input$1, _extends({}, props, {
2452
- ref: ref,
2453
- sx: styles
2454
- }));
2455
- };
2456
-
2457
- var input = forwardRef(Input);
2458
-
2459
- const getProps = test => props => {
2460
- const next = {};
2461
-
2462
- for (const key in props) {
2463
- if (test(key || '')) next[key] = props[key];
2464
- }
2465
-
2466
- return next;
2467
- };
2468
-
2469
- const _excluded$2 = ["children", "size", "sx", "sxSelect"];
2470
-
2471
- const Select = _ref => {
2472
- let {
2473
- children,
2474
- size = 'sm',
2475
- sx,
2476
- sxSelect
2477
- } = _ref,
2478
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2479
-
2480
- const color = sx && sx.color ? sx.color : 'primary';
2481
- const sizeStyles = getSizeStyles(size);
2482
- const ref = useRef(null);
2483
- const {
2484
- onChange
2485
- } = props;
2486
- const omitOnChange = getProps(k => k !== 'onChange')(props);
2487
-
2488
- if (!['xs', 'sm', 'md'].includes(size)) {
2489
- throw new Error('Size must be xs, sm, or md');
2490
- }
2491
-
2492
- let pr, height, width, ml, top;
2493
-
2494
- if (size === 'xs') {
2495
- height = [14, 14, 14, 16];
2496
- width = [14, 14, 14, 14];
2497
- top = ['1px'];
2498
- ml = ['-14px', '-14px', '-14px', '-16px'];
2499
- }
2500
-
2501
- if (size === 'sm') {
2502
- height = [15, 15, 15, 20];
2503
- width = [15, 15, 15, 20];
2504
- top = ['1px'];
2505
- ml = ['-16px', '-16px', '-16px', '-20px'];
2506
- }
2507
-
2508
- if (size === 'md') {
2509
- height = [20, 20, 20, 20];
2510
- width = [20, 20, 20, 20];
2511
- top = ['2px'];
2512
- ml = ['-20px', '-20px', '-20px', '-20px'];
2513
- }
2514
-
2515
- pr = width.map(d => d + 12);
2516
- return /*#__PURE__*/React.createElement(Box, {
2517
- sx: _extends({
2518
- display: 'inline-block'
2519
- }, sx)
2520
- }, /*#__PURE__*/React.createElement(Box, _extends({
2521
- as: "select",
2522
- ref: ref,
2523
- onChange: e => {
2524
- ref.current.blur();
2525
- if (onChange) onChange(e);
2526
- },
2527
- sx: _extends({}, sizeStyles, {
2528
- lineHeight: 'normal',
2529
- cursor: 'pointer',
2530
- WebkitAppearance: 'none',
2531
- MozAppearance: 'none',
2532
- pb: ['5px'],
2533
- bg: 'transparent',
2534
- pr: pr,
2535
- border: 'none',
2536
- borderBottomStyle: 'solid',
2537
- borderBottomWidth: '1px',
2538
- borderBottomColor: 'primary',
2539
- borderRadius: '0px',
2540
- color: 'text',
2541
- width: 'fit-content',
2542
- color: color,
2543
- userSelect: 'none',
2544
- '@media (hover: none) and (pointer: coarse)': {
2545
- '&:focus-visible': {
2546
- outline: 'none !important',
2547
- background: 'transparent !important'
2548
- }
2549
- }
2550
- }, sxSelect)
2551
- }, omitOnChange), children), /*#__PURE__*/React.createElement(Arrow, {
2552
- sx: {
2553
- width: width,
2554
- height: height,
2555
- position: 'relative',
2556
- ml: ml,
2557
- top: top,
2558
- fill: 'secondary',
2559
- transform: 'rotate(135deg)',
2560
- pointerEvents: 'none'
2561
- }
2562
- }));
2563
- };
2564
-
2565
- const _excluded$1 = ["sx"];
2566
-
2567
- const Slider = (_ref, ref) => {
2568
- let {
2569
- sx
2570
- } = _ref,
2571
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2572
-
2573
- const color = sx && sx.color ? sx.color : 'primary';
2574
- const {
2575
- theme: {
2576
- rawColors: colors
2577
- }
2578
- } = useThemeUI();
2579
- return /*#__PURE__*/React.createElement(Slider$1, _extends({
2580
- ref: ref,
2581
- sx: _extends({
2582
- '&::-webkit-slider-thumb': {
2583
- height: [22, 18, 16],
2584
- width: [22, 18, 16],
2585
- boxShadow: `0 0 0 0px ${colors.secondary}`,
2586
- transition: 'box-shadow .15s ease'
2587
- },
2588
- '&::-moz-range-thumb': {
2589
- height: [22, 18, 16],
2590
- width: [22, 18, 16],
2591
- boxShadow: `0 0 0 0px ${colors.secondary}`,
2592
- transition: 'box-shadow .15s ease'
2593
- },
2594
- ':focus-visible': {
2595
- outline: 'none !important',
2596
- background: `${colors.secondary} !important`
2597
- },
2598
- ':focus': {
2599
- color: color,
2600
- '&::-webkit-slider-thumb': {
2601
- boxShadow: `0 0 0 4px ${colors.secondary}`
2602
- },
2603
- '&::-moz-range-thumb': {
2604
- boxShadow: `0 0 0 4px ${colors.secondary}`
2605
- }
2606
- },
2607
- color: color
2608
- }, sx)
2609
- }, props));
2610
- };
2611
-
2612
- var slider = forwardRef(Slider);
2613
-
2614
- const styles = {
2615
- reset: {
2616
- verticalAlign: 'baseline',
2617
- border: 0,
2618
- outline: 0,
2619
- margin: 0,
2620
- padding: 0
2621
- },
2622
- row: {
2623
- borderStyle: 'solid',
2624
- borderWidth: '0px',
2625
- borderTopWidth: '1px',
2626
- borderColor: 'muted',
2627
- pt: [3, 3, 3, '20px'],
2628
- pb: [3, 3, 3, '20px'],
2629
- mb: ['2px']
2630
- },
2631
- header: {
2632
- display: 'block',
2633
- textTransform: 'uppercase',
2634
- letterSpacing: 'smallcaps',
2635
- fontFamily: 'heading',
2636
- fontSize: [2, 2, 2, 3]
2637
- },
2638
- index: {
2639
- display: 'block',
2640
- textTransform: 'uppercase',
2641
- letterSpacing: 'smallcaps',
2642
- fontFamily: 'heading',
2643
- fontSize: [2, 2, 2, 3]
2644
- },
2645
- entry: {
2646
- display: 'block',
2647
- fontSize: [2, 2, 2, 3],
2648
- fontFamily: 'faux',
2649
- letterSpacing: 'faux',
2650
- mb: ['1px'],
2651
- mt: [2, 0, 0, 0]
2652
- }
2653
- };
2654
-
2655
- const Table = ({
2656
- data,
2657
- sx,
2658
- color,
2659
- header,
2660
- columns,
2661
- start,
2662
- width,
2663
- index: _index = true,
2664
- borderBottom: _borderBottom = true,
2665
- borderTop: _borderTop = true
2666
- }) => {
2667
- if (!start || !columns || !width) {
2668
- throw new Error('Must provide columns, start, and width');
2669
- }
2670
-
2671
- return /*#__PURE__*/React.createElement(Box, {
2672
- as: "table",
2673
- sx: _extends({
2674
- display: 'block'
2675
- }, sx)
2676
- }, /*#__PURE__*/React.createElement(Box, {
2677
- as: "tbody",
2678
- sx: {
2679
- display: 'block'
2680
- }
2681
- }, header && /*#__PURE__*/React.createElement(Row, {
2682
- as: "tr",
2683
- sx: _extends({}, styles.reset, styles.header, styles.row, {
2684
- color: color,
2685
- borderTopWidth: !_borderTop ? '0px' : '1px'
2686
- })
2687
- }, /*#__PURE__*/React.createElement(Column, {
2688
- as: "td",
2689
- start: [1],
2690
- width: columns,
2691
- sx: styles.index
2692
- }, header)), data.map((row, i) => {
2693
- return /*#__PURE__*/React.createElement(Row, {
2694
- as: "tr",
2695
- columns: columns,
2696
- key: i,
2697
- sx: _extends({}, styles.reset, styles.row, {
2698
- pb: _borderBottom && i === data.length - 1 ? ['18px', '18px', '18px', '22px'] : [3, 3, 3, '20px'],
2699
- borderBottomWidth: _borderBottom && i === data.length - 1 ? '1px' : '0px',
2700
- borderTopWidth: !_borderTop && i === 0 && !header ? '0px' : '1px'
2701
- })
2702
- }, row.map((column, j) => {
2703
- return /*#__PURE__*/React.createElement(Column, {
2704
- as: "td",
2705
- key: j,
2706
- start: start[j],
2707
- width: width[j],
2708
- sx: j == 0 && _index ? _extends({}, styles.reset, styles.index) : _extends({}, styles.reset, styles.entry)
2709
- }, column);
2710
- }));
2711
- })));
2712
- };
2713
-
2714
- const _excluded = ["value", "onClick", "disabled", "sx"];
2715
-
2716
- const Toggle = (_ref, ref) => {
2717
- let {
2718
- value,
2719
- onClick,
2720
- disabled,
2721
- sx
2722
- } = _ref,
2723
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
2724
-
2725
- const color = sx && sx.color ? sx.color : 'primary';
2726
- value = disabled ? false : value;
2727
- return /*#__PURE__*/React.createElement(Box, _extends({
2728
- ref: ref,
2729
- as: "button",
2730
- onClick: onClick,
2731
- role: "checkbox",
2732
- "aria-checked": value,
2733
- "aria-label": "Toggle",
2734
- sx: _extends({
2735
- border: 'none',
2736
- background: 'none',
2737
- cursor: disabled ? 'default' : 'pointer',
2738
- p: [0],
2739
- m: [0],
2740
- display: 'inline-block'
2741
- }, sx)
2742
- }, props), /*#__PURE__*/React.createElement(Box, {
2743
- sx: {
2744
- width: '50px',
2745
- height: '20px',
2746
- borderRadius: '20px',
2747
- backgroundColor: value ? transparentize(color, color == 'primary' ? 0.5 : 0.45) : 'muted',
2748
- position: 'relative',
2749
- transition: '0.15s',
2750
- display: 'inline-block'
2751
- }
2752
- }, /*#__PURE__*/React.createElement(Box, {
2753
- sx: {
2754
- width: '14px',
2755
- height: '14px',
2756
- borderRadius: '7px',
2757
- position: 'absolute',
2758
- left: value ? '32px' : '4px',
2759
- top: '3px',
2760
- backgroundColor: value ? color : 'secondary',
2761
- transition: '0.15s'
2762
- }
2763
- })));
2764
- };
2765
-
2766
- var toggle = forwardRef(Toggle);
2767
-
2768
- const Tracking = ({
2769
- id
2770
- }) => {
2771
- if (!id) {
2772
- return null;
2773
- }
2774
-
2775
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("script", {
2776
- async: true,
2777
- src: `https://www.googletagmanager.com/gtag/js?id=${id}`
2778
- }), /*#__PURE__*/React.createElement("script", {
2779
- dangerouslySetInnerHTML: {
2780
- __html: `
2781
- window.dataLayer = window.dataLayer || [];
2782
- function gtag(){dataLayer.push(arguments);}
2783
- gtag('js', new Date());
2784
- gtag('config', '${id}', {
2785
- page_path: window.location.pathname,
2786
- });
2787
- `
2788
- }
2789
- }));
2790
- };
2791
-
2792
- const Tray = ({
2793
- expanded,
2794
- sx,
2795
- children
2796
- }) => {
2797
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
2798
- sx: {
2799
- position: 'fixed',
2800
- top: '56px',
2801
- bottom: '0px',
2802
- left: '0px',
2803
- width: 'calc(100vw)',
2804
- mt: ['56px'],
2805
- bg: 'background',
2806
- zIndex: 1000,
2807
- transition: 'opacity 0.15s',
2808
- opacity: expanded ? 0.9 : 0,
2809
- pointerEvents: expanded ? 'all' : 'none'
2810
- }
2811
- }), /*#__PURE__*/React.createElement(Box, {
2812
- sx: _extends({
2813
- position: 'fixed',
2814
- width: 'calc(100vw)',
2815
- top: '0px',
2816
- mt: ['56px'],
2817
- pb: [6, 7, 7, 8],
2818
- pt: [5, 6, 7, 8],
2819
- bg: 'background',
2820
- zIndex: 1100,
2821
- borderStyle: 'solid',
2822
- borderColor: 'muted',
2823
- borderWidth: '0px',
2824
- borderBottomWidth: '1px',
2825
- transition: 'transform 0.15s',
2826
- ml: [-3, -4, -5, -6],
2827
- pl: [3, 4, 5, 6],
2828
- pr: [3, 4, 5, 6],
2829
- transform: expanded ? 'translateY(0)' : 'translateY(-100%)'
2830
- }, sx)
2831
- }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
2832
- start: [1, 1, 1, 1],
2833
- width: [6, 8, 10, 10]
2834
- }, children))));
2835
- };
2836
-
2837
- const defaultOptions = {
2838
- month: 'short',
2839
- day: 'numeric',
2840
- year: 'numeric'
2841
- };
2842
-
2843
- const formatDateElement = (date, element, option) => {
2844
- if (!option) {
2845
- return null;
2846
- }
2847
-
2848
- const format = typeof option === 'string' ? option : defaultOptions[element];
2849
- const result = date.toLocaleString('default', {
2850
- [element]: format
2851
- });
2852
-
2853
- if (format === 'numeric' && element === 'day') {
2854
- return result.padStart(2, '0');
2855
- } else {
2856
- return result;
2857
- }
2858
- };
2859
-
2860
- const formatDate = (date, options = defaultOptions) => {
2861
- var _options$separator;
2862
-
2863
- const d = new Date(date.replace(/-/g, '/'));
2864
- const month = formatDateElement(d, 'month', options.month);
2865
- const day = formatDateElement(d, 'day', options.day);
2866
- const year = formatDateElement(d, 'year', options.year);
2867
- return [month, day, year].filter(Boolean).join((_options$separator = options.separator) != null ? _options$separator : ' ');
2868
- };
2869
-
2870
- 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 };
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 E}from"@theme-ui/color";import b 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":E(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=({children:t})=>{const r=t.props.children.slice(0,1);return e.createElement(i,{variant:"styles.blockquote",sx:{textIndent:"“"===r?["-0.4em"]:[0]}},t)},T=["href","children","internal","tracking"];var F=t((t,r)=>{let{href:n,children:o,internal:a=!1,tracking:l=!1}=t,i=M(t,T);if(a||n&&n.startsWith("/"))return e.createElement(b,{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 I=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 D=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:E}=t,b=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,T;"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,T="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({},I(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"},T)},d&&d));return g?e.createElement(F,z({ref:n,href:g,internal:y,tracking:E,sx:z({},D,{textDecoration:"none"})},b),O):e.createElement(i,z({ref:n,as:"button",sx:D},b),O)});const O=["label","children","inverted","color","href","internal","tracking","sx"];var $=t((t,r)=>{let{label:n,children:o,inverted:a,color:l,href:c,internal:s,tracking:m,sx:p}=t,d=M(t,O);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(F,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 R=["colormap","label","clim","setClim","setClimStep","discrete","units","width","height","format","horizontal","bottom","sx","sxClim"],H=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"}),_={width:["10px","16px","16px","17px"],height:["80px","110px","110px","130px"]},j=({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||_.height,height:a||_.width}:{width:o||_.width,minHeight:a||_.height},{mt:n?["1px","1px","1px",0]:0,border:({colors:e})=>`solid 1px ${e.hinted}`,background:c})})},V=({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))),N=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:E,sxClim:b}=t,w=M(t,R);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,I=null,B=[0,0],D=p;const O=e=>{"min"!==I||k||C(!0),"max"!==I||S||A(!0),T=e.pageX-L,F=e.pageY-W,g?("min"===I&&m(e=>[Math.min(B[0]+T*D,B[1]),e[1]]),"max"===I&&m(e=>[e[0],Math.max(B[1]+T*D,B[0])])):("min"===I&&m(e=>[Math.min(B[0]-F*D,B[1]),e[1]]),"max"===I&&m(e=>[e[0],Math.max(B[1]-F*D,B[0])]))},$=e=>{W=e.pageY,L=e.pageX,I=e.target.id,B=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"===I&&C(!1),"max"===I&&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({},H(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"},b),onMouseDown:m?$:()=>{},onClick:()=>v[0].current.focus()},f(c[0])),P=()=>e.createElement(i,{id:"max",ref:v[1],tabIndex:0,sx:z({},H(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"},b),onMouseDown:m?$:()=>{},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%"},E)}),l&&e.createElement(V,{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(j,{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||_.height}},c&&e.createElement(N,null),c&&e.createElement(P,null)))},P=["start","width","dl","dr","children","sx"],G=t=>{let{start:r,width:n,dl:o,dr:a,children:l,sx:c}=t,s=M(t,P);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)},Y=({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"}))),X=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"})))},U=["children","sx","columns","gap"],q=t=>{let{children:r,sx:n,columns:o,gap:a}=t,l=M(t,U);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"})))},J=(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"}}),Q=[{url:"about",display:"About"},{url:"research",display:"Research"},{url:"blog",display:"Blog"},{url:"press",display:"Press"}],ee=()=>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]}}),te=({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(b,{href:s,passHref:!0},e.createElement(c,{onClick:()=>{n===l&&a(!1)},sx:J(n,l,o)},e.createElement(ee,null),i)):e.createElement(c,{href:s,sx:J(n,l,o)},e.createElement(ee,null),i)},re=({links:t,nav:r,mode:n,setExpanded:o})=>t.map((t,a)=>e.createElement(te,{key:a,link:t,mode:n,nav:r,first:0===a,setExpanded:o})),ne=({status:t,mode:r,nav:n,menuItems:a})=>{const[l,m]=o(!1);return e.createElement(q,{sx:{pt:["12px"],pb:[3]}},e.createElement(G,{start:[1],width:[2]},e.createElement(i,{sx:{pointerEvents:"all",display:"block",width:"fit-content"}},("homepage"==r||"local"==r)&&e.createElement(b,{href:"/",passHref:!0},e.createElement(c,{"aria-label":"CarbonPlan Homepage",sx:{display:"block"}},e.createElement(X,{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(X,{sx:{cursor:"pointer",color:"primary"}})))),e.createElement(G,{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(G,{start:[t?6:4,6,11,11],width:[t?1:3,3,2,2],sx:{zIndex:5e3}},e.createElement(s,{sx:{pointerEvents:"all",justifyContent:"flex-end"}},e.createElement(i,{sx:{display:[t?"none":"flex","flex","flex","flex"],mr:"18px",gap:"18px",opacity:l?0:1,transition:"opacity 0.15s",justifyContent:"space-between",alignItems:"center"}},a),e.createElement(Z,{sx:{flexShrink:0,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(q,null,e.createElement(G,{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(re,{links:Q,nav:n,mode:r,setExpanded:m})))))))},oe=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"}))},ae=()=>e.createElement(i,{sx:{mt:[7,7,7,8],mb:[7,7,7,8],pb:[2,1,0,0]}},e.createElement(q,{sx:{mb:[0,0,4,5]}},e.createElement(G,{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(G,{start:[5],width:[1],dl:1,dr:1,sx:{display:["flex","none","none","none"],justifyContent:["center"]}},e.createElement(oe,{sx:{mt:["-4px"],width:"60px",height:"60px"}})),e.createElement(G,{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(G,{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(q,{sx:{mb:["2px"],mt:[5,5,4]}},e.createElement(G,{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(G,{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(b,{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(G,{start:[5,7,9,9],width:[2,3,3,3],sx:{display:["none","initial","initial","initial"]}},e.createElement(oe,{sx:{width:80,height:80,mt:[0,"-10px",4,5],mb:["-12px"]}})))),le=["sx"],ie=t=>{let{sx:r}=t,n=M(t,le);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"}}}}))},ce=()=>{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(se,{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(se,{color:a}),e.createElement(u,{sx:{whiteSpace:"nowrap",display:"inline-block",ml:[2],fontFamily:"mono",letterSpacing:"body",color:a,fontSize:[1],textTransform:"uppercase"}},a))},se=({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})),me=({mode:t})=>{const[r,n]=o(function(e){return"mouse"===e?`X,Y: ${de(0,4)},${de(0,4)}`:"scroll"===e?`SCROLL: 0.${de((0).toFixed(0),2)}`:e}(t));return a(()=>{if("mouse"===t){const e=e=>{const t=de(e.clientX,4),r=de(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.${de((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)},pe=({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(me,{mode:t}),e.createElement(ce,null));function de(e,t){return e.toString().padStart(t,"0")}const xe=["duration","delay","children"],he=S({from:{opacity:0},to:{opacity:1}}),ue=t=>{let{duration:r=300,delay:n=0,children:o}=t,a=M(t,xe);return e.createElement(i,z({},a,{sx:{animationDuration:r+"ms",animationDelay:n+"ms",animationName:he.toString(),animationFillMode:"backwards"}}),o)},fe=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},ge=()=>(a(()=>{"undefined"!=typeof document&&fe(document)>0&&(document.body.classList.add("custom-scrollbar"),document.getElementsByTagName("html")[0].classList.add("custom-scrollbar"))},[]),null),ye=({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}))))},Ee=["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(q,null,t.map(t=>e.createElement(G,{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?Ee[t%8]:"muted",borderRightColor:"rainbow"===r?Ee[t%8]:"muted"},n.outerGuideColumn)}))))}const we=["value","sx"],ve=t=>{let{value:r,sx:n}=t,o=M(t,we);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"})))},ke=({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:E=!0,fade:b=!0,container:w=!0})=>{let v=o;b&&(v=e.createElement(ue,{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(ie,{key:"dimmer",sx:{color:"primary",mt:"-2px",display:["block","block","top"===g?"block":"none","top"===g?"block":"none"]}})];return m&&C.push(e.createElement(ve,z({key:"settings",sx:{mr:["2px"],display:["inherit","inherit","none","none"]}},m))),e.createElement(e.Fragment,null,y&&e.createElement(ye,{color:y}),E&&e.createElement(ge,null),e.createElement(Y,{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(ne,{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(ae,null))),"bottom"===g&&e.createElement(i,{sx:{display:["none","none","initial","initial"],position:["fixed"],right:[13],bottom:[17,17,15,15]}},e.createElement(ie,null)),u&&e.createElement(pe,{mode:u})))},Ce=()=>e.createElement(ke,{footer:!1,title:"404 / carbonplan"},e.createElement(q,{sx:{mb:[5,0,0],pt:[0,0,6]}},e.createElement(G,{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(G,{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"}}))))),Se=({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)":""}}))),ze=["label","value","sx","children"],Me=t=>{let{label:r,value:n,sx:o,children:a}=t,l=M(t,ze);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)},Ae=["values","setValues","label","colors","showAll","multiSelect"],Le={label:{fontFamily:"mono",letterSpacing:"mono",fontSize:[1,1,1,2],color:"secondary",userSelect:"none",textTransform:"uppercase"}},We=(e,t,r={})=>Object.keys(e).reduce((e,n)=>Object.assign(e,{[n]:r[n]||t}),{}),Te=e=>Object.keys(e).filter(t=>e[t]).length==Object.keys(e).length,Fe=({values:e,multiSelect:t,setValues:r,value:n})=>{const o=Te(e),a="all"===n;let l;t?l=a&&!o?We(e,!0):a&&o?We(e,!1):z({},e,{[n]:!e[n]}):a&&!o?l=We(e,!0):a&&o||(l=We(e,!1,{[n]:!0})),l&&r(l)},Ie=t=>{let{values:r,setValues:n,label:o,colors:a,showAll:l=!1,multiSelect:c=!1}=t,s=M(t,Ae);return e.createElement(i,s,o&&e.createElement(i,{sx:Le.label},o),e.createElement(i,{sx:{mt:o?[3]:0}},l&&e.createElement(Me,{onClick:()=>Fe({values:r,multiSelect:c,setValues:n,value:"all"}),value:Te(r),sx:{mr:[2]}},"All"),Object.keys(r).map((t,o)=>e.createElement(Me,{onClick:()=>Fe({values:r,multiSelect:c,setValues:n,value:t}),onDoubleClick:()=>Fe({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]},De=({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)))},Oe=({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(G,{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(G,{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)))},$e=({children:t,sidenote:r,description:n,descriptionStart:o=[1,3,5,5],descriptionWidth:a=[5,5,5,4],sx:l})=>e.createElement(q,{sx:{mt:[5,6,7,8],mb:[5,6,7,8]}},e.createElement(G,{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(Oe,null,r),n&&e.createElement(G,{start:o,width:a},e.createElement(i,{sx:{mt:[4,"5px","20px","31px"],fontSize:[2,2,2,3]}},n))),Re=["size","inverted","sx"];var He=t((t,r)=>{let{size:n="sm",inverted:o,sx:a}=t,l=M(t,Re);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"}},I(n),a);return e.createElement(g,z({},l,{ref:r,sx:i}))});const _e=["children","size","sx","sxSelect"],je=t=>{let{children:r,size:o="sm",sx:a,sxSelect:l}=t,c=M(t,_e);const s=a&&a.color?a.color:"primary",m=I(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,E;return"xs"===o&&(f=[14,14,14,16],g=[14,14,14,14],E=["1px"],y=["-14px","-14px","-14px","-16px"]),"sm"===o&&(f=[15,15,15,20],g=[15,15,15,20],E=["1px"],y=["-16px","-16px","-16px","-20px"]),"md"===o&&(f=[20,20,20,20],g=[20,20,20,20],E=["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:E,fill:"secondary",transform:"rotate(135deg)",pointerEvents:"none"}}))},Ve=["sx"];var Ne=t((t,r)=>{let{sx:n}=t,o=M(t,Ve);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 Pe={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]}},Ge=({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(q,{as:"tr",sx:z({},Pe.reset,Pe.header,Pe.row,{color:n,borderTopWidth:p?"1px":"0px"})},e.createElement(G,{as:"td",start:[1],width:a,sx:Pe.index},o)),t.map((r,n)=>e.createElement(q,{as:"tr",columns:a,key:n,sx:z({},Pe.reset,Pe.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(G,{as:"td",key:r,start:l[r],width:c[r],sx:z({},Pe.reset,0==r&&s?Pe.index:Pe.entry)},t))))))},Ye=["value","onClick","disabled","sx"];var Xe=t((t,r)=>{let{value:n,onClick:o,disabled:a,sx:l}=t,c=M(t,Ye);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?E(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 Ue=({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,qe=({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(q,null,e.createElement(G,{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","month"].includes(t)?o.padStart(2,"0"):o},Je=(e,t=Ke)=>{var r;const n=new Date(e.replace(/-/g,"/"));return[Ze(n,"month",t.month),Ze(n,"day",t.day),Ze(n,"year",t.year)].filter(Boolean).join(null!=(r=t.separator)?r:" ")};export{L as Badge,W as Blockquote,D as Button,$ as Callout,N as Colorbar,G as Column,Ce as Custom404,ie as Dimmer,Se as Expander,ue as FadeIn,Ie as Filter,ae as Footer,De as Group,ye as Guide,ne as Header,$e as Heading,He as Input,ke as Layout,F as Link,X as Logo,Z as Menu,Y as Meta,oe as Monogram,q as Row,ge as Scrollbar,je as Select,ve as Settings,Oe as Sidenote,Ne as Slider,Ge as Table,Me as Tag,Xe as Toggle,Ue as Tracking,qe as Tray,Je as formatDate,fe as getScrollbarWidth};
2871
2
  //# sourceMappingURL=index.modern.js.map