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