@alextheman/components 5.2.1 → 5.4.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.
package/dist/index.d.cts CHANGED
@@ -8,7 +8,6 @@ import { LinkProps } from '@mui/material/Link';
8
8
  import { OverridableComponent, CommonProps } from '@mui/material/OverridableComponent';
9
9
  import { SvgIconTypeMap } from '@mui/material/SvgIcon';
10
10
  import { ListItemButtonProps } from '@mui/material/ListItemButton';
11
- import { DisallowUndefined } from '@alextheman/utility';
12
11
  import { TypographyProps } from '@mui/material/Typography';
13
12
  import { SwitchProps } from '@mui/material/Switch';
14
13
  import { AlertColor } from '@mui/material/Alert';
@@ -106,7 +105,7 @@ interface LoaderProviderBaseProps<T> {
106
105
  /** The data being loaded. */
107
106
  data?: T;
108
107
  /** A parser for the data. */
109
- dataParser?: (data: unknown) => T;
108
+ dataParser?: (data: unknown) => NonNullable<T>;
110
109
  /** The component to show when loading. */
111
110
  loadingComponent?: ReactNode;
112
111
  }
@@ -130,25 +129,58 @@ declare function useLoader<T>(): LoaderContextValue<T>;
130
129
  */
131
130
  declare function LoaderProvider<T>({ children, loadingComponent, ...contextProps }: LoaderProviderProps<T>): react_jsx_runtime.JSX.Element;
132
131
 
133
- interface LoaderDataProps<T> {
132
+ interface LoaderDataBaseProps<T> {
134
133
  /** The elements to show after data has been loaded.
135
134
  * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
136
135
  */
137
- children: ReactNode | ((data: DisallowUndefined<T>) => ReactNode);
136
+ children: ReactNode | ((data: NonNullable<T>) => ReactNode);
138
137
  /** A parser for the data. */
139
- dataParser?: (data: unknown) => T;
138
+ dataParser?: (data: unknown) => NonNullable<T>;
140
139
  /** The component to show when the data is being fetched. */
141
140
  loadingComponent?: ReactNode;
142
- /** A function to run if the data is undefined and not loading. This may either return React components or nothing. */
143
- onUndefined?: () => ReactNode | void;
144
141
  /** An option to show the children of this component if an error has been thrown. */
145
142
  showOnError?: boolean;
146
143
  }
144
+ interface LoaderDataPropsOnNullable<T> extends LoaderDataBaseProps<T> {
145
+ onUndefined?: never;
146
+ onNull?: never;
147
+ /** A function to run if the data is undefined or null, and not loading. This may either return React components or nothing.
148
+ * @deprecated Please use the nullableComponent prop on LoaderError instead */
149
+ onNullable: () => ReactNode | void;
150
+ }
151
+ interface LoaderDataPropsOnUndefinedOrNull<T> extends LoaderDataBaseProps<T> {
152
+ /** A function to run if the data is undefined and not loading. This may either return React components or nothing.
153
+ * @deprecated Please use the nullableComponent prop on LoaderError instead */
154
+ onUndefined?: () => ReactNode | void;
155
+ /** A function to run if the data is null and not loading. This may either return React components or nothing.
156
+ * @deprecated Please use the nullableComponent prop on LoaderError instead */
157
+ onNull?: () => ReactNode | void;
158
+ onNullable?: never;
159
+ }
160
+ type LoaderDataProps<T> = LoaderDataPropsOnUndefinedOrNull<T> | LoaderDataPropsOnNullable<T>;
147
161
  /** The component responsible for showing the data provided by LoaderProvider. */
148
- declare function LoaderData<T>({ children, dataParser: loaderDataParser, loadingComponent, onUndefined, showOnError, }: LoaderDataProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
162
+ declare function LoaderData<T>({ children, dataParser: loaderDataParser, loadingComponent, onNullable, onUndefined, onNull, showOnError, }: LoaderDataProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
149
163
 
164
+ interface LoaderErrorBaseProps {
165
+ /** The component to show if an error has been thrown. */
166
+ errorComponent?: ReactNode | ((error: unknown) => ReactNode);
167
+ }
168
+ interface LoaderErrorPropsWithUndefinedOrNull extends LoaderErrorBaseProps {
169
+ /** The component to show if no error was thrown but data is undefined */
170
+ undefinedComponent?: ReactNode;
171
+ /** The component to show if no error was thrown but data is null */
172
+ nullComponent?: ReactNode;
173
+ /** The component to show if no error was thrown but data is undefined or null */
174
+ nullableComponent?: never;
175
+ }
176
+ interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
177
+ undefinedComponent?: never;
178
+ nullComponent?: never;
179
+ nullableComponent?: ReactNode;
180
+ }
181
+ type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
150
182
  /** The component responsible for showing any errors provided by LoaderProvider. */
151
- declare function LoaderError(): string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
183
+ declare function LoaderError({ errorComponent: propsErrorComponent, undefinedComponent, nullComponent, nullableComponent, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
152
184
 
153
185
  declare function useMode(): {
154
186
  toggleMode: () => void;
@@ -184,18 +216,11 @@ interface SnackbarContextValue {
184
216
  declare function useSnackbar(): SnackbarContextValue;
185
217
  declare function SnackbarProvider({ children, autoHideDuration }: SnackbarProviderProps): react_jsx_runtime.JSX.Element;
186
218
 
187
- type LoaderProps<T> = Omit<LoaderProviderProps<T>, "children"> & {
188
- /** The elements to show after data has been loaded.
189
- * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
190
- */
191
- children: ReactNode | ((data: DisallowUndefined<T>) => ReactNode);
192
- /** A function to run if the data is undefined and not loading. This may either return React components or nothing. */
193
- onUndefined?: () => ReactNode | void;
194
- };
219
+ type LoaderProps<T> = Omit<LoaderProviderProps<T>, "children" | "errorComponent"> & LoaderErrorProps & Omit<LoaderDataProps<T>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
195
220
  /** An in-line component that deals with state management when fetching data from an API.
196
221
  * This may be used over LoaderProvider if you don't require as much control over the placement of the error message and data display.
197
222
  */
198
- declare function Loader<T>({ children, onUndefined, loadingComponent, ...loaderProviderProps }: LoaderProps<T>): react_jsx_runtime.JSX.Element;
223
+ declare function Loader<T>({ children, undefinedComponent, nullComponent, nullableComponent, loadingComponent, ...loaderProviderProps }: LoaderProps<T>): react_jsx_runtime.JSX.Element;
199
224
 
200
225
  interface NavItemBottom {
201
226
  value: string;
@@ -265,4 +290,4 @@ declare function SwitchWithIcons({ checkedIcon: CheckedIcon, checkedIconStyles,
265
290
 
266
291
  declare function useHash<S extends string>(initialHash: S | undefined): [S, Dispatch<SetStateAction<S>>];
267
292
 
268
- export { CollapsableItem, type CollapsableItemProps, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataProps, LoaderError, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
293
+ export { CollapsableItem, type CollapsableItemProps, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataBaseProps, type LoaderDataProps, type LoaderDataPropsOnNullable, type LoaderDataPropsOnUndefinedOrNull, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ import { LinkProps } from '@mui/material/Link';
8
8
  import { OverridableComponent, CommonProps } from '@mui/material/OverridableComponent';
9
9
  import { SvgIconTypeMap } from '@mui/material/SvgIcon';
10
10
  import { ListItemButtonProps } from '@mui/material/ListItemButton';
11
- import { DisallowUndefined } from '@alextheman/utility';
12
11
  import { TypographyProps } from '@mui/material/Typography';
13
12
  import { SwitchProps } from '@mui/material/Switch';
14
13
  import { AlertColor } from '@mui/material/Alert';
@@ -106,7 +105,7 @@ interface LoaderProviderBaseProps<T> {
106
105
  /** The data being loaded. */
107
106
  data?: T;
108
107
  /** A parser for the data. */
109
- dataParser?: (data: unknown) => T;
108
+ dataParser?: (data: unknown) => NonNullable<T>;
110
109
  /** The component to show when loading. */
111
110
  loadingComponent?: ReactNode;
112
111
  }
@@ -130,25 +129,58 @@ declare function useLoader<T>(): LoaderContextValue<T>;
130
129
  */
131
130
  declare function LoaderProvider<T>({ children, loadingComponent, ...contextProps }: LoaderProviderProps<T>): react_jsx_runtime.JSX.Element;
132
131
 
133
- interface LoaderDataProps<T> {
132
+ interface LoaderDataBaseProps<T> {
134
133
  /** The elements to show after data has been loaded.
135
134
  * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
136
135
  */
137
- children: ReactNode | ((data: DisallowUndefined<T>) => ReactNode);
136
+ children: ReactNode | ((data: NonNullable<T>) => ReactNode);
138
137
  /** A parser for the data. */
139
- dataParser?: (data: unknown) => T;
138
+ dataParser?: (data: unknown) => NonNullable<T>;
140
139
  /** The component to show when the data is being fetched. */
141
140
  loadingComponent?: ReactNode;
142
- /** A function to run if the data is undefined and not loading. This may either return React components or nothing. */
143
- onUndefined?: () => ReactNode | void;
144
141
  /** An option to show the children of this component if an error has been thrown. */
145
142
  showOnError?: boolean;
146
143
  }
144
+ interface LoaderDataPropsOnNullable<T> extends LoaderDataBaseProps<T> {
145
+ onUndefined?: never;
146
+ onNull?: never;
147
+ /** A function to run if the data is undefined or null, and not loading. This may either return React components or nothing.
148
+ * @deprecated Please use the nullableComponent prop on LoaderError instead */
149
+ onNullable: () => ReactNode | void;
150
+ }
151
+ interface LoaderDataPropsOnUndefinedOrNull<T> extends LoaderDataBaseProps<T> {
152
+ /** A function to run if the data is undefined and not loading. This may either return React components or nothing.
153
+ * @deprecated Please use the nullableComponent prop on LoaderError instead */
154
+ onUndefined?: () => ReactNode | void;
155
+ /** A function to run if the data is null and not loading. This may either return React components or nothing.
156
+ * @deprecated Please use the nullableComponent prop on LoaderError instead */
157
+ onNull?: () => ReactNode | void;
158
+ onNullable?: never;
159
+ }
160
+ type LoaderDataProps<T> = LoaderDataPropsOnUndefinedOrNull<T> | LoaderDataPropsOnNullable<T>;
147
161
  /** The component responsible for showing the data provided by LoaderProvider. */
148
- declare function LoaderData<T>({ children, dataParser: loaderDataParser, loadingComponent, onUndefined, showOnError, }: LoaderDataProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
162
+ declare function LoaderData<T>({ children, dataParser: loaderDataParser, loadingComponent, onNullable, onUndefined, onNull, showOnError, }: LoaderDataProps<T>): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element;
149
163
 
164
+ interface LoaderErrorBaseProps {
165
+ /** The component to show if an error has been thrown. */
166
+ errorComponent?: ReactNode | ((error: unknown) => ReactNode);
167
+ }
168
+ interface LoaderErrorPropsWithUndefinedOrNull extends LoaderErrorBaseProps {
169
+ /** The component to show if no error was thrown but data is undefined */
170
+ undefinedComponent?: ReactNode;
171
+ /** The component to show if no error was thrown but data is null */
172
+ nullComponent?: ReactNode;
173
+ /** The component to show if no error was thrown but data is undefined or null */
174
+ nullableComponent?: never;
175
+ }
176
+ interface LoaderErrorPropsWithNullable extends LoaderErrorBaseProps {
177
+ undefinedComponent?: never;
178
+ nullComponent?: never;
179
+ nullableComponent?: ReactNode;
180
+ }
181
+ type LoaderErrorProps = LoaderErrorPropsWithUndefinedOrNull | LoaderErrorPropsWithNullable;
150
182
  /** The component responsible for showing any errors provided by LoaderProvider. */
151
- declare function LoaderError(): string | number | bigint | boolean | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
183
+ declare function LoaderError({ errorComponent: propsErrorComponent, undefinedComponent, nullComponent, nullableComponent, }: LoaderErrorProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
152
184
 
153
185
  declare function useMode(): {
154
186
  toggleMode: () => void;
@@ -184,18 +216,11 @@ interface SnackbarContextValue {
184
216
  declare function useSnackbar(): SnackbarContextValue;
185
217
  declare function SnackbarProvider({ children, autoHideDuration }: SnackbarProviderProps): react_jsx_runtime.JSX.Element;
186
218
 
187
- type LoaderProps<T> = Omit<LoaderProviderProps<T>, "children"> & {
188
- /** The elements to show after data has been loaded.
189
- * This is best provided as a function with a data argument that guarantees the data will not be undefined by the time you receive it here.
190
- */
191
- children: ReactNode | ((data: DisallowUndefined<T>) => ReactNode);
192
- /** A function to run if the data is undefined and not loading. This may either return React components or nothing. */
193
- onUndefined?: () => ReactNode | void;
194
- };
219
+ type LoaderProps<T> = Omit<LoaderProviderProps<T>, "children" | "errorComponent"> & LoaderErrorProps & Omit<LoaderDataProps<T>, "showOnError" | "onUndefined" | "onNull" | "onNullable">;
195
220
  /** An in-line component that deals with state management when fetching data from an API.
196
221
  * This may be used over LoaderProvider if you don't require as much control over the placement of the error message and data display.
197
222
  */
198
- declare function Loader<T>({ children, onUndefined, loadingComponent, ...loaderProviderProps }: LoaderProps<T>): react_jsx_runtime.JSX.Element;
223
+ declare function Loader<T>({ children, undefinedComponent, nullComponent, nullableComponent, loadingComponent, ...loaderProviderProps }: LoaderProps<T>): react_jsx_runtime.JSX.Element;
199
224
 
200
225
  interface NavItemBottom {
201
226
  value: string;
@@ -265,4 +290,4 @@ declare function SwitchWithIcons({ checkedIcon: CheckedIcon, checkedIconStyles,
265
290
 
266
291
  declare function useHash<S extends string>(initialHash: S | undefined): [S, Dispatch<SetStateAction<S>>];
267
292
 
268
- export { CollapsableItem, type CollapsableItemProps, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataProps, LoaderError, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
293
+ export { CollapsableItem, type CollapsableItemProps, DarkModeToggle, DropdownMenu, type DropdownMenuProps, ExternalLink, type ExternalLinkProps, FileInput, FileInputList, type FileInputListProps, type FileInputProps, FileType, IconWithPopover, type IconWithPopoverProps, InternalLink, type InternalLinkProps, ListItemInternalLink, type ListItemInternalLinkProps, Loader, type LoaderContextValue, LoaderData, type LoaderDataBaseProps, type LoaderDataProps, type LoaderDataPropsOnNullable, type LoaderDataPropsOnUndefinedOrNull, LoaderError, type LoaderErrorBaseProps, type LoaderErrorProps, type LoaderErrorPropsWithNullable, type LoaderErrorPropsWithUndefinedOrNull, type LoaderProps, LoaderProvider, type LoaderProviderBaseProps, type LoaderProviderProps, type LoaderProviderPropsWithError, type LoaderProviderPropsWithNoError, type Mode, ModeProvider, type ModeProviderProps, type NavItemBottom, type NavMenuItem, NavigationBottom, type NavigationBottomProps, NavigationDrawer, type NavigationDrawerProps, PopoverText, type PopoverTextProps, ReactPlayground, type ReactPlaygroundProps, type ScreenSizeContextValue, type ScreenSizeProps, ScreenSizeProvider, SkeletonRow, type SkeletonRowProps, SnackbarProvider, type SnackbarProviderProps, SubmitButton, type SubmitButtonProps, SwitchWithIcons, type SwitchWithIconsProps, useHash, useLoader, useMode, useScreenSize, useSnackbar };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- var Le=Object.defineProperty,Ie=Object.defineProperties;var ke=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var K=(e,o,r)=>o in e?Le(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,a=(e,o)=>{for(var r in o||(o={}))Y.call(o,r)&&K(e,r,o[r]);if(T)for(var r of T(o))q.call(o,r)&&K(e,r,o[r]);return e},c=(e,o)=>Ie(e,ke(o));var x=(e,o)=>{var r={};for(var n in e)Y.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&T)for(var n of T(e))o.indexOf(n)<0&&q.call(e,n)&&(r[n]=e[n]);return r};var Q=(e,o,r)=>new Promise((n,i)=>{var t=d=>{try{s(r.next(d))}catch(u){i(u)}},p=d=>{try{s(r.throw(d))}catch(u){i(u)}},s=d=>d.done?n(d.value):Promise.resolve(d.value).then(t,p);s((r=r.apply(e,o)).next())});import Ce from"@mui/icons-material/ArrowDropDown";import Te from"@mui/icons-material/ArrowDropUp";import Be from"@mui/material/Box";import M from"@mui/material/ButtonBase";import Re from"@mui/material/Collapse";import{useEffect as Ne,useState as De}from"react";import{jsx as E,jsxs as Z}from"react/jsx-runtime";function Me({isInitiallyOpen:e,onOpen:o,onClose:r,children:n,buttonStyles:i,buttonContents:t,buttonComponent:p=M,collapseProps:s,openIcon:d=E(Te,{}),closedIcon:u=E(Ce,{}),useDefaultStyling:m=p===M}){let[l,f]=De(!!e);return Ne(()=>{l&&o?o():!l&&r&&r()},[l]),Z(Be,{children:[Z(p,{onClick:()=>{f(g=>!g)},sx:m?a({width:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingY:1.5,paddingX:2,textAlign:"center","&:hover":p===M?{backgroundColor:"action.hover"}:null},i):i,"aria-expanded":l,children:[t,l?d:u]}),E(Re,c(a({in:l},s),{children:n}))]})}var Ee=Me;import xo from"@mui/icons-material/DarkMode";import Po from"@mui/icons-material/LightMode";import go from"@mui/material/IconButton";import yo from"@mui/material/Tooltip";import Ae from"@mui/material/CircularProgress";import{createContext as Oe,useContext as Fe}from"react";import{jsx as j}from"react/jsx-runtime";var ee=Oe(void 0);function L(){let e=Fe(ee);if(!e)throw new Error("LOADER_CONTEXT_NOT_SET");return e}function We(n){var i=n,{children:e,loadingComponent:o=j(Ae,{})}=i,r=x(i,["children","loadingComponent"]);return j(ee.Provider,{value:a({loadingComponent:o},r),children:e})}var A=We;import{useRef as ze}from"react";import{Fragment as h,jsx as v}from"react/jsx-runtime";function Ue({children:e,dataParser:o,loadingComponent:r,onUndefined:n,showOnError:i}){let{isLoading:t,data:p,dataParser:s,loadingComponent:d,error:u}=L(),m=ze(!1),l=o!=null?o:s;if(t)return v(h,{children:r!=null?r:d});if(u&&!i)return v(h,{});if(p===void 0){if(m.current||(console.warn("Data is undefined after loading. This could either be an issue with the query or you have not passed in the data to LoaderProvider. Please double-check that you have provided data."),m.current=!0),n){let f=n();return f!=null?f:v(h,{})}return v(h,{})}return l?typeof e=="function"?v(h,{children:e(l(p))}):v(h,{children:e}):typeof e=="function"?v(h,{children:e(p)}):v(h,{children:e})}var O=Ue;import He from"@mui/material/Alert";import{Fragment as oe,jsx as F}from"react/jsx-runtime";function Ve(){var r;let{error:e,errorComponent:o}=L();return e?typeof o=="function"?o(e):o?F(oe,{children:o}):F(He,{severity:"error",children:(r=e==null?void 0:e.message)!=null?r:"An unknown error has occured. Please try again later."}):F(oe,{})}var W=Ve;import Xe from"@mui/material/CssBaseline";import{createTheme as $e,ThemeProvider as _e}from"@mui/material/styles";import{createContext as Ge,useContext as Je,useMemo as Ke,useState as Ye}from"react";import{jsx as re,jsxs as Ze}from"react/jsx-runtime";var te=Ge({toggleMode:()=>{},mode:"dark"});function I(){return Je(te)}function qe({children:e,mode:o="dark"}){let[r,n]=Ye(o),i=Ke(()=>$e({palette:{mode:r}}),[r]);return re(te.Provider,{value:{mode:r,toggleMode:()=>{n(t=>t==="light"?"dark":"light")}},children:Ze(_e,{theme:i,children:[re(Xe,{}),e]})})}var Qe=qe;import{createContext as je,useContext as eo,useEffect as ne,useState as z}from"react";import{jsx as no}from"react/jsx-runtime";var ie=je({windowWidth:0,windowHeight:0,isLargeScreen:!1});function oo(){return eo(ie)}function ro({children:e,largeScreenWidth:o,largeScreenHeight:r}){let[n,i]=z(window.innerWidth),[t,p]=z(window.innerHeight);function s(m,l,f=669,g=600){return m>f&&l>g}let[d,u]=z(s(window.innerWidth,window.innerHeight,o,r));return ne(()=>{function m(){i(window.innerWidth),p(window.innerHeight)}return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[]),ne(()=>{u(s(n,t,o,r))},[n,t,o,r]),no(ie.Provider,{value:{isLargeScreen:d,windowWidth:n,windowHeight:t},children:e})}var to=ro;import{wait as io}from"@alextheman/utility";import ao from"@mui/material/Alert";import po from"@mui/material/Snackbar";import{createContext as so,useContext as mo,useState as B}from"react";import{jsx as ae,jsxs as fo}from"react/jsx-runtime";var pe=so(void 0);function lo(){let e=mo(pe);if(!e)throw new Error("SNACKBAR_CONTEXT_NOT_SET");return e}function co({children:e,autoHideDuration:o=5e3}){let[r,n]=B(!1),[i,t]=B(o),[p,s]=B(""),[d,u]=B("info");function m(f,g,y){n(!0),t(y!=null?y:o),u(g!=null?g:"info"),s(f)}function l(){return Q(this,null,function*(){n(!1),yield io(.2),s("")})}return fo(pe.Provider,{value:{addSnackbar:m},children:[ae(po,{open:r,autoHideDuration:i,onClose:l,children:ae(ao,{onClose:l,severity:d,children:p})}),e]})}var uo=co;import{jsx as R}from"react/jsx-runtime";function ho(){let{mode:e,toggleMode:o}=I();return R(yo,{title:`Enable ${e==="dark"?"light":"dark"} mode`,children:R(go,{sx:{marginLeft:"auto"},onClick:o,"aria-label":`Enable ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?R(Po,{}):R(xo,{})})})}var vo=ho;import wo from"@mui/icons-material/ArrowDropDown";import So from"@mui/icons-material/ArrowDropUp";import se from"@mui/material/Box";import de from"@mui/material/Button";import bo from"@mui/material/Menu";import{useEffect as Lo,useMemo as Io,useState as ko}from"react";import{jsx as k,jsxs as Bo}from"react/jsx-runtime";function Co({children:e,button:o=de,buttonChildren:r="Menu",buttonProps:n,isOpenIcon:i=k(So,{}),isClosedIcon:t=k(wo,{}),onOpen:p,onClose:s}){let[d,u]=ko(null),m=Io(()=>!!d,[d]),l=c(a({},n),{onClick:f=>{u(f.currentTarget)},"aria-controls":m?"dropdown-menu":void 0,"aria-haspopup":"true","aria-expanded":m});return o===de&&(l.endIcon=m?i:t),Lo(()=>{m&&p?p():!m&&s&&s()},[m,p,s]),Bo(se,{children:[k(o,c(a({},l),{children:r})),k(bo,{id:"dropdown-menu",anchorEl:d,open:m,onClose:()=>{u(null)},children:typeof e=="function"?k(se,{children:e(()=>{u(null)})}):e})]})}var To=Co;import Ro from"@mui/material/Link";import{jsx as Mo}from"react/jsx-runtime";function No(n){var i=n,{href:e,children:o}=i,r=x(i,["href","children"]);return Mo(Ro,c(a({component:"a",href:e,target:"_blank",rel:"noopener noreferrer"},r),{children:o}))}var Do=No;import Eo from"@mui/icons-material/CloudUpload";import Ao from"@mui/material/Button";import{styled as me}from"@mui/material/styles";import{useState as Oo}from"react";import{jsx as U,jsxs as Ho}from"react/jsx-runtime";var Fo={PDF:"application/pdf",PNG:"image/png",JPEG:"image/jpeg",JPG:"image/jpg",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",MP3:"audio/mp3",MP4:"video/mp4",WAV:"audio/wav"},Wo=me("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),zo=me("div")(({theme:e,$dragging:o})=>({border:"2px dashed",borderColor:o?e.palette.primary.main:"#ccc",backgroundColor:o?e.palette.action.hover:"transparent",borderRadius:8,padding:"1.5rem",textAlign:"center",transition:"border-color 0.2s",cursor:"pointer"}));function Uo(p){var s=p,{onFileInput:e,label:o="Upload files",multiple:r,accept:n,useDropzone:i}=s,t=x(s,["onFileInput","label","multiple","accept","useDropzone"]);var l;let[d,u]=Oo(!1),m=Ho(Ao,c(a({variant:"contained",component:"label","aria-label":"File upload button",onKeyDown:f=>{var g;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(g=document.getElementById("file-input"))==null||g.click())}},t),{startIcon:(l=t.startIcon)!=null?l:U(Eo,{}),children:[o,U(Wo,{id:"file-input",type:"file",onChange:f=>{var y;let g=f.target;e(Array.from((y=g.files)!=null?y:[])),g.value=""},multiple:r,accept:n==null?void 0:n.join(","),disabled:t.disabled})]}));return i?U(zo,{$dragging:d,onDragOver:f=>{f.preventDefault(),!t.disabled&&u(!0)},onDragLeave:f=>{f.preventDefault(),u(!1)},onDrop:f=>{var y;if(f.preventDefault(),u(!1),t.disabled)return;let g=Array.from((y=f.dataTransfer.files)!=null?y:[]);e(g)},children:m}):m}var H=Uo;import Vo from"@mui/icons-material/Delete";import Xo from"@mui/material/Box";import $o from"@mui/material/IconButton";import _o from"@mui/material/List";import Go from"@mui/material/ListItem";import Jo from"@mui/material/ListItemText";import{jsx as b,jsxs as qo}from"react/jsx-runtime";function Ko(n){var i=n,{files:e,setFiles:o}=i,r=x(i,["files","setFiles"]);function t(s){o(d=>[...d,...s])}let p=c(a({},r),{onFileInput:t});return(p==null?void 0:p.multiple)===void 0&&(p.multiple=!0),qo(Xo,{children:[b(H,a({},p)),b(_o,{children:e.map(s=>b(Go,{secondaryAction:b($o,{"aria-label":"Delete",edge:"end",onClick:()=>{o(d=>d.filter(u=>u!==s))},children:b(Vo,{})}),children:b(Jo,{primary:s.name})},s.name))})]})}var Yo=Ko;import Qo from"@mui/material/Box";import Zo from"@mui/material/Popover";import{useId as jo,useState as er}from"react";import{jsx as le,jsxs as tr}from"react/jsx-runtime";function or({icon:e,onOpen:o,onClose:r,iconProps:n,children:i}){let[t,p]=er(null),s=!!t,d=jo();function u(l){p(l.currentTarget),o&&o()}function m(){p(null),r&&r()}return tr(Qo,{children:[le(e,a({"aria-owns":s?d:void 0,"aria-haspopup":"true",onMouseEnter:u,onMouseLeave:m},n)),le(Zo,{id:d,sx:{pointerEvents:"none"},open:s,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:m,disableRestoreFocus:!0,children:i})]})}var rr=or;import nr from"@mui/material/Link";import{Link as ir}from"react-router-dom";import{jsx as pr}from"react/jsx-runtime";function ar(n){var i=n,{to:e,children:o}=i,r=x(i,["to","children"]);return pr(nr,c(a({component:ir,to:e},r),{children:o}))}var V=ar;import sr from"@mui/material/ListItemButton";import{jsx as lr}from"react/jsx-runtime";function dr(r){var n=r,{children:e}=n,o=x(n,["children"]);return lr(sr,c(a({component:V},o),{children:e}))}var mr=dr;import cr from"@mui/material/CircularProgress";import{jsx as X,jsxs as xr}from"react/jsx-runtime";function ur(i){var t=i,{children:e,onUndefined:o,loadingComponent:r=X(cr,{})}=t,n=x(t,["children","onUndefined","loadingComponent"]);return xr(A,c(a({loadingComponent:r},n),{children:[X(W,{}),X(O,{onUndefined:o,children:e})]}))}var fr=ur;import Pr from"@mui/material/BottomNavigation";import gr from"@mui/material/BottomNavigationAction";import yr from"@mui/material/Box";import hr from"@mui/material/Paper";import{useState as vr}from"react";import{Link as wr}from"react-router-dom";import{Fragment as Lr,jsx as N,jsxs as Ir}from"react/jsx-runtime";function Sr({children:e,navItems:o}){let[r,n]=vr("");return Ir(Lr,{children:[N(yr,{sx:{paddingBottom:7},children:e}),N(hr,{sx:{position:"fixed",bottom:0,left:0,right:0},children:N(Pr,{showLabels:!0,value:r,onChange:(i,t)=>{n(t)},children:o.map(i=>N(gr,c(a({},i),{component:wr}),i.value))})})]})}var br=Sr;import{truncate as ce}from"@alextheman/utility";import kr from"@mui/icons-material/ChevronLeft";import Cr from"@mui/icons-material/ChevronRight";import Tr from"@mui/icons-material/Menu";import Br from"@mui/material/AppBar";import ue from"@mui/material/Box";import Rr from"@mui/material/CssBaseline";import fe from"@mui/material/Divider";import Nr from"@mui/material/Drawer";import xe from"@mui/material/IconButton";import Dr from"@mui/material/List";import Mr from"@mui/material/ListItem";import Er from"@mui/material/ListItemButton";import Ar from"@mui/material/ListItemIcon";import Or from"@mui/material/ListItemText";import{styled as _,useTheme as Fr}from"@mui/material/styles";import Wr from"@mui/material/Toolbar";import $ from"@mui/material/Typography";import{Fragment as zr,useState as Ur}from"react";import{Link as Hr,useLocation as Vr}from"react-router-dom";import{jsx as P,jsxs as S}from"react/jsx-runtime";var D=240;function Pe(e){return{width:D,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}}function ge(e){return{transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up("sm")]:{width:`calc(${e.spacing(8)} + 1px)`}}}var ye=_("div")(({theme:e})=>a({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),Xr=_(Br,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:o})=>o,style:{marginLeft:D,width:`calc(100% - ${D}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),$r=_(Nr,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({width:D,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",variants:[{props:({open:o})=>o,style:c(a({},Pe(e)),{"& .MuiDrawer-paper":Pe(e)})},{props:({open:o})=>!o,style:c(a({},ge(e)),{"& .MuiDrawer-paper":ge(e)})}]}));function _r({title:e,navItems:o,children:r,headerElements:n}){let i=Fr(),[t,p]=Ur(!0),s=Vr();function d(){p(!0)}function u(){p(!1)}return S(ue,{sx:{display:"flex"},children:[P(Rr,{}),P(Xr,{position:"fixed",open:t,children:S(Wr,{children:[P(xe,{color:"inherit","aria-label":"open drawer",onClick:d,edge:"start",sx:[{marginRight:5},t&&{display:"none"}],children:P(Tr,{})}),P($,{variant:"h6",noWrap:!0,component:"div",children:e}),n]})}),S($r,{variant:"permanent",open:t,children:[P(ye,{children:P(xe,{onClick:u,children:i.direction==="rtl"?P(Cr,{}):P(kr,{})})}),P(fe,{}),o.map(m=>S(zr,{children:[S(Dr,{children:[P($,{variant:t?"h5":"h6",paddingLeft:t?2:1,children:t?m.category:ce(m.category,4)}),m.options.map(l=>P(Mr,{disablePadding:!0,sx:{display:"block"},children:S(Er,{sx:[{minHeight:48,px:2.5},t?{justifyContent:"initial"}:{justifyContent:"center"}],component:Hr,to:l.to,selected:s.pathname===l.to,children:[P(Ar,{sx:[{minWidth:0,justifyContent:"center"},t?{mr:3}:{mr:"auto"}],children:l.icon?l.icon:t?null:P($,{children:ce(l.label,4)})}),P(Or,{primary:l.label,sx:[t?{opacity:1}:{opacity:0}]})]})},l.to))]}),P(fe,{})]},m.category))]}),S(ue,{component:"main",sx:{flexGrow:1,p:3},children:[P(ye,{}),r]})]})}var Gr=_r;import Jr from"@mui/material/Typography";import{Fragment as qr,jsx as he}from"react/jsx-runtime";function Kr(n){var i=n,{text:e,sx:o}=i,r=x(i,["text","sx"]);return he(qr,{children:e.split(`
2
- `).map((t,p)=>he(Jr,c(a({sx:a({margin:1},o)},r),{children:t}),p))})}var Yr=Kr;import G from"@mui/material/Box";import ve from"@mui/material/Typography";import{stripIndent as Qr}from"common-tags";import{LiveEditor as Zr,LiveError as jr,LivePreview as et,LiveProvider as ot}from"react-live";import{jsx as w,jsxs as we}from"react/jsx-runtime";function rt({code:e,scope:o,previewStyles:r,noInline:n,enableTypeScript:i,language:t}){let{mode:p}=I(),s={backgroundColor:p==="dark"?"black":"white",border:.3,borderRadius:1,padding:2,borderColor:"darkgray"},d=r?a(a({},s),r):a({},s);return w(G,{sx:{borderRadius:1,border:.5,padding:2},children:we(ot,{code:Qr(e),scope:o,noInline:n,enableTypeScript:i,language:t,children:[w(ve,{variant:"h5",children:"Code"}),w(G,{sx:{border:.3,borderRadius:.3,borderColor:"darkgray"},children:w(Zr,{})}),w("br",{}),w(ve,{variant:"h5",children:"Result"}),we(G,{sx:d,children:[w(et,{}),w(jr,{})]})]})})}var tt=rt;import{fillArray as nt}from"@alextheman/utility";import it from"@mui/material/Skeleton";import at from"@mui/material/TableCell";import pt from"@mui/material/TableRow";import{jsx as J}from"react/jsx-runtime";function st({columns:e}){return J(pt,{children:nt(o=>J(at,{children:J(it,{})},o),e)})}var dt=st;import mt from"@mui/material/Button";import{useFormContext as lt}from"react-hook-form";import{jsx as ft}from"react/jsx-runtime";function ct(n){var i=n,{disableClean:e,label:o}=i,r=x(i,["disableClean","label"]);let{formState:{disabled:t,isDirty:p,isSubmitting:s}}=lt();return ft(mt,c(a({color:"primary",disabled:r.disabled||e&&!p||t,loading:s,type:"submit",variant:"contained"},r),{children:o}))}var ut=ct;import Se from"@mui/material/Box";import{styled as xt}from"@mui/material/styles";import Pt from"@mui/material/Switch";import{jsx as C}from"react/jsx-runtime";var gt=xt(Pt)(()=>({padding:8,"& .MuiSwitch-track":{borderRadius:11,"&::before, &::after":{content:'""',position:"absolute",top:"50%",transform:"translateY(-50%)",fontSize:16,width:28,height:28}}}));function yt(t){var p=t,{checkedIcon:e,checkedIconStyles:o,uncheckedIcon:r,uncheckedIconStyles:n}=p,i=x(p,["checkedIcon","checkedIconStyles","uncheckedIcon","uncheckedIconStyles"]);let s={borderRadius:"50%",borderColor:"white",backgroundColor:"white",display:"flex",alignItems:"center",justifyContent:"center",padding:.25},d={color:"black",maxWidth:16.5,maxHeight:16.5};return C(gt,a({checkedIcon:C(Se,{sx:s,children:C(e,{style:a(a({},d),o)})}),icon:C(Se,{sx:s,children:C(r,{style:a(a({},d),n)})})},i))}var ht=yt;import{useCallback as be,useEffect as vt,useState as wt}from"react";function St(e){let[o,r]=wt(()=>{let t=window.location.hash.replace("#","");return e&&t===""?e:t}),n=be(()=>{let t=window.location.hash.replace("#","");r(e&&t===""?e:t)},[r,e]);vt(()=>(window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}),[n]);let i=be(t=>{let p=typeof t=="function"?t(o):t;p!==o&&(window.location.hash=p)},[o]);return[o,i]}var bt=St;export{Ee as CollapsableItem,vo as DarkModeToggle,To as DropdownMenu,Do as ExternalLink,H as FileInput,Yo as FileInputList,Fo as FileType,rr as IconWithPopover,V as InternalLink,mr as ListItemInternalLink,fr as Loader,O as LoaderData,W as LoaderError,A as LoaderProvider,Qe as ModeProvider,br as NavigationBottom,Gr as NavigationDrawer,Yr as PopoverText,tt as ReactPlayground,to as ScreenSizeProvider,dt as SkeletonRow,uo as SnackbarProvider,ut as SubmitButton,ht as SwitchWithIcons,bt as useHash,L as useLoader,I as useMode,oo as useScreenSize,lo as useSnackbar};
1
+ var we=Object.defineProperty,Ie=Object.defineProperties;var Ce=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var Y=(e,o,r)=>o in e?we(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,s=(e,o)=>{for(var r in o||(o={}))q.call(o,r)&&Y(e,r,o[r]);if(B)for(var r of B(o))Q.call(o,r)&&Y(e,r,o[r]);return e},f=(e,o)=>Ie(e,Ce(o));var P=(e,o)=>{var r={};for(var n in e)q.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&B)for(var n of B(e))o.indexOf(n)<0&&Q.call(e,n)&&(r[n]=e[n]);return r};var Z=(e,o,r)=>new Promise((n,a)=>{var t=p=>{try{i(r.next(p))}catch(c){a(c)}},d=p=>{try{i(r.throw(p))}catch(c){a(c)}},i=p=>p.done?n(p.value):Promise.resolve(p.value).then(t,d);i((r=r.apply(e,o)).next())});import ke from"@mui/icons-material/ArrowDropDown";import Te from"@mui/icons-material/ArrowDropUp";import Ne from"@mui/material/Box";import O from"@mui/material/ButtonBase";import Be from"@mui/material/Collapse";import{useEffect as Ee,useState as Re}from"react";import{jsx as A,jsxs as j}from"react/jsx-runtime";function De({isInitiallyOpen:e,onOpen:o,onClose:r,children:n,buttonStyles:a,buttonContents:t,buttonComponent:d=O,collapseProps:i,openIcon:p=A(Te,{}),closedIcon:c=A(ke,{}),useDefaultStyling:l=d===O}){let[m,x]=Re(!!e);return Ee(()=>{m&&o?o():!m&&r&&r()},[m]),j(Ne,{children:[j(d,{onClick:()=>{x(u=>!u)},sx:l?s({width:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingY:1.5,paddingX:2,textAlign:"center","&:hover":d===O?{backgroundColor:"action.hover"}:null},a):a,"aria-expanded":m,children:[t,m?p:c]}),A(Be,f(s({in:m},i),{children:n}))]})}var Me=De;import Po from"@mui/icons-material/DarkMode";import vo from"@mui/icons-material/LightMode";import go from"@mui/material/IconButton";import ho from"@mui/material/Tooltip";import Oe from"@mui/material/CircularProgress";import{createContext as Ae,useContext as We}from"react";import{jsx as ee}from"react/jsx-runtime";var oe=Ae(void 0);function I(){let e=We(oe);if(!e)throw new Error("LOADER_CONTEXT_NOT_SET");return e}function Fe(n){var a=n,{children:e,loadingComponent:o=ee(Oe,{})}=a,r=P(a,["children","loadingComponent"]);return ee(oe.Provider,{value:s({loadingComponent:o},r),children:e})}var W=Fe;import{Fragment as g,jsx as h}from"react/jsx-runtime";function ze({children:e,dataParser:o,loadingComponent:r,onNullable:n,onUndefined:a,onNull:t,showOnError:d}){let{isLoading:i,data:p,dataParser:c,loadingComponent:l,error:m}=I(),x=o!=null?o:c;if(i)return h(g,{children:r!=null?r:l});if(m&&!d)return h(g,{});if(p==null){if(n){let u=n();return u!=null?u:h(g,{})}if(p===void 0&&a){let u=a();return u!=null?u:h(g,{})}if(p===null&&t){let u=t();return u!=null?u:h(g,{})}return h(g,{})}return x?typeof e=="function"?h(g,{children:e(x(p))}):h(g,{children:e}):typeof e=="function"?h(g,{children:e(p)}):h(g,{children:e})}var F=ze;import Ue from"@mui/material/Alert";import{useRef as He}from"react";import{Fragment as C,jsx as S}from"react/jsx-runtime";var Ve="Data is undefined after loading. This could either be an issue with the query or you have not passed in the data to LoaderProvider. Please double-check that you have provided data.";function Xe({errorComponent:e,undefinedComponent:o,nullComponent:r,nullableComponent:n}){var c;let{data:a,error:t,errorComponent:d}=I(),i=He(!1),p=e!=null?e:d;if(t)return typeof p=="function"?p(t):p?S(C,{children:p}):S(Ue,{severity:"error",children:(c=t==null?void 0:t.message)!=null?c:"An unknown error has occured. Please try again later."});if(a==null){if(n)return S(C,{children:n});if(a===void 0&&o)return i.current||(console.warn(Ve),i.current=!0),S(C,{children:o});if(a===null&&r)return S(C,{children:r})}return S(C,{})}var z=Xe;import $e from"@mui/material/CssBaseline";import{createTheme as _e,ThemeProvider as Ge}from"@mui/material/styles";import{createContext as Je,useContext as Ke,useMemo as Ye,useState as qe}from"react";import{jsx as re,jsxs as je}from"react/jsx-runtime";var te=Je({toggleMode:()=>{},mode:"dark"});function k(){return Ke(te)}function Qe({children:e,mode:o="dark"}){let[r,n]=qe(o),a=Ye(()=>_e({palette:{mode:r}}),[r]);return re(te.Provider,{value:{mode:r,toggleMode:()=>{n(t=>t==="light"?"dark":"light")}},children:je(Ge,{theme:a,children:[re($e,{}),e]})})}var Ze=Qe;import{createContext as eo,useContext as oo,useEffect as ne,useState as U}from"react";import{jsx as ao}from"react/jsx-runtime";var ae=eo({windowWidth:0,windowHeight:0,isLargeScreen:!1});function ro(){return oo(ae)}function to({children:e,largeScreenWidth:o,largeScreenHeight:r}){let[n,a]=U(window.innerWidth),[t,d]=U(window.innerHeight);function i(l,m,x=669,u=600){return l>x&&m>u}let[p,c]=U(i(window.innerWidth,window.innerHeight,o,r));return ne(()=>{function l(){a(window.innerWidth),d(window.innerHeight)}return l(),window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)}},[]),ne(()=>{c(i(n,t,o,r))},[n,t,o,r]),ao(ae.Provider,{value:{isLargeScreen:p,windowWidth:n,windowHeight:t},children:e})}var no=to;import{wait as io}from"@alextheman/utility";import po from"@mui/material/Alert";import so from"@mui/material/Snackbar";import{createContext as lo,useContext as mo,useState as E}from"react";import{jsx as ie,jsxs as xo}from"react/jsx-runtime";var pe=lo(void 0);function co(){let e=mo(pe);if(!e)throw new Error("SNACKBAR_CONTEXT_NOT_SET");return e}function uo({children:e,autoHideDuration:o=5e3}){let[r,n]=E(!1),[a,t]=E(o),[d,i]=E(""),[p,c]=E("info");function l(x,u,y){n(!0),t(y!=null?y:o),c(u!=null?u:"info"),i(x)}function m(){return Z(this,null,function*(){n(!1),yield io(.2),i("")})}return xo(pe.Provider,{value:{addSnackbar:l},children:[ie(so,{open:r,autoHideDuration:a,onClose:m,children:ie(po,{onClose:m,severity:p,children:d})}),e]})}var fo=uo;import{jsx as R}from"react/jsx-runtime";function yo(){let{mode:e,toggleMode:o}=k();return R(ho,{title:`Enable ${e==="dark"?"light":"dark"} mode`,children:R(go,{sx:{marginLeft:"auto"},onClick:o,"aria-label":`Enable ${e==="dark"?"light":"dark"} mode`,children:e==="dark"?R(vo,{}):R(Po,{})})})}var Lo=yo;import bo from"@mui/icons-material/ArrowDropDown";import So from"@mui/icons-material/ArrowDropUp";import se from"@mui/material/Box";import de from"@mui/material/Button";import wo from"@mui/material/Menu";import{useEffect as Io,useMemo as Co,useState as ko}from"react";import{jsx as T,jsxs as Bo}from"react/jsx-runtime";function To({children:e,button:o=de,buttonChildren:r="Menu",buttonProps:n,isOpenIcon:a=T(So,{}),isClosedIcon:t=T(bo,{}),onOpen:d,onClose:i}){let[p,c]=ko(null),l=Co(()=>!!p,[p]),m=f(s({},n),{onClick:x=>{c(x.currentTarget)},"aria-controls":l?"dropdown-menu":void 0,"aria-haspopup":"true","aria-expanded":l});return o===de&&(m.endIcon=l?a:t),Io(()=>{l&&d?d():!l&&i&&i()},[l,d,i]),Bo(se,{children:[T(o,f(s({},m),{children:r})),T(wo,{id:"dropdown-menu",anchorEl:p,open:l,onClose:()=>{c(null)},children:typeof e=="function"?T(se,{children:e(()=>{c(null)})}):e})]})}var No=To;import Eo from"@mui/material/Link";import{jsx as Mo}from"react/jsx-runtime";function Ro(n){var a=n,{href:e,children:o}=a,r=P(a,["href","children"]);return Mo(Eo,f(s({component:"a",href:e,target:"_blank",rel:"noopener noreferrer"},r),{children:o}))}var Do=Ro;import Oo from"@mui/icons-material/CloudUpload";import Ao from"@mui/material/Button";import{styled as le}from"@mui/material/styles";import{useState as Wo}from"react";import{jsx as H,jsxs as Vo}from"react/jsx-runtime";var Fo={PDF:"application/pdf",PNG:"image/png",JPEG:"image/jpeg",JPG:"image/jpg",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",MP3:"audio/mp3",MP4:"video/mp4",WAV:"audio/wav"},zo=le("input")({clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:1,overflow:"hidden",position:"absolute",bottom:0,left:0,whiteSpace:"nowrap",width:1}),Uo=le("div")(({theme:e,$dragging:o})=>({border:"2px dashed",borderColor:o?e.palette.primary.main:"#ccc",backgroundColor:o?e.palette.action.hover:"transparent",borderRadius:8,padding:"1.5rem",textAlign:"center",transition:"border-color 0.2s",cursor:"pointer"}));function Ho(d){var i=d,{onFileInput:e,label:o="Upload files",multiple:r,accept:n,useDropzone:a}=i,t=P(i,["onFileInput","label","multiple","accept","useDropzone"]);var m;let[p,c]=Wo(!1),l=Vo(Ao,f(s({variant:"contained",component:"label","aria-label":"File upload button",onKeyDown:x=>{var u;(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),(u=document.getElementById("file-input"))==null||u.click())}},t),{startIcon:(m=t.startIcon)!=null?m:H(Oo,{}),children:[o,H(zo,{id:"file-input",type:"file",onChange:x=>{var y;let u=x.target;e(Array.from((y=u.files)!=null?y:[])),u.value=""},multiple:r,accept:n==null?void 0:n.join(","),disabled:t.disabled})]}));return a?H(Uo,{$dragging:p,onDragOver:x=>{x.preventDefault(),!t.disabled&&c(!0)},onDragLeave:x=>{x.preventDefault(),c(!1)},onDrop:x=>{var y;if(x.preventDefault(),c(!1),t.disabled)return;let u=Array.from((y=x.dataTransfer.files)!=null?y:[]);e(u)},children:l}):l}var V=Ho;import Xo from"@mui/icons-material/Delete";import $o from"@mui/material/Box";import _o from"@mui/material/IconButton";import Go from"@mui/material/List";import Jo from"@mui/material/ListItem";import Ko from"@mui/material/ListItemText";import{jsx as w,jsxs as Qo}from"react/jsx-runtime";function Yo(n){var a=n,{files:e,setFiles:o}=a,r=P(a,["files","setFiles"]);function t(i){o(p=>[...p,...i])}let d=f(s({},r),{onFileInput:t});return(d==null?void 0:d.multiple)===void 0&&(d.multiple=!0),Qo($o,{children:[w(V,s({},d)),w(Go,{children:e.map(i=>w(Jo,{secondaryAction:w(_o,{"aria-label":"Delete",edge:"end",onClick:()=>{o(p=>p.filter(c=>c!==i))},children:w(Xo,{})}),children:w(Ko,{primary:i.name})},i.name))})]})}var qo=Yo;import Zo from"@mui/material/Box";import jo from"@mui/material/Popover";import{useId as er,useState as or}from"react";import{jsx as me,jsxs as nr}from"react/jsx-runtime";function rr({icon:e,onOpen:o,onClose:r,iconProps:n,children:a}){let[t,d]=or(null),i=!!t,p=er();function c(m){d(m.currentTarget),o&&o()}function l(){d(null),r&&r()}return nr(Zo,{children:[me(e,s({"aria-owns":i?p:void 0,"aria-haspopup":"true",onMouseEnter:c,onMouseLeave:l},n)),me(jo,{id:p,sx:{pointerEvents:"none"},open:i,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:a})]})}var tr=rr;import ar from"@mui/material/Link";import{Link as ir}from"react-router-dom";import{jsx as sr}from"react/jsx-runtime";function pr(n){var a=n,{to:e,children:o}=a,r=P(a,["to","children"]);return sr(ar,f(s({component:ir,to:e},r),{children:o}))}var X=pr;import dr from"@mui/material/ListItemButton";import{jsx as cr}from"react/jsx-runtime";function lr(r){var n=r,{children:e}=n,o=P(n,["children"]);return cr(dr,f(s({component:X},o),{children:e}))}var mr=lr;import ur from"@mui/material/CircularProgress";import{jsx as $,jsxs as Pr}from"react/jsx-runtime";function fr(d){var i=d,{children:e,undefinedComponent:o,nullComponent:r,nullableComponent:n,loadingComponent:a=$(ur,{})}=i,t=P(i,["children","undefinedComponent","nullComponent","nullableComponent","loadingComponent"]);return Pr(W,f(s({loadingComponent:a},t),{children:[$(z,{undefinedComponent:o,nullComponent:r,nullableComponent:n}),$(F,{children:e})]}))}var xr=fr;import vr from"@mui/material/BottomNavigation";import gr from"@mui/material/BottomNavigationAction";import hr from"@mui/material/Box";import yr from"@mui/material/Paper";import{useState as Lr}from"react";import{Link as br}from"react-router-dom";import{Fragment as Ir,jsx as D,jsxs as Cr}from"react/jsx-runtime";function Sr({children:e,navItems:o}){let[r,n]=Lr("");return Cr(Ir,{children:[D(hr,{sx:{paddingBottom:7},children:e}),D(yr,{sx:{position:"fixed",bottom:0,left:0,right:0},children:D(vr,{showLabels:!0,value:r,onChange:(a,t)=>{n(t)},children:o.map(a=>D(gr,f(s({},a),{component:br}),a.value))})})]})}var wr=Sr;import{truncate as ce}from"@alextheman/utility";import kr from"@mui/icons-material/ChevronLeft";import Tr from"@mui/icons-material/ChevronRight";import Nr from"@mui/icons-material/Menu";import Br from"@mui/material/AppBar";import ue from"@mui/material/Box";import Er from"@mui/material/CssBaseline";import fe from"@mui/material/Divider";import Rr from"@mui/material/Drawer";import xe from"@mui/material/IconButton";import Dr from"@mui/material/List";import Mr from"@mui/material/ListItem";import Or from"@mui/material/ListItemButton";import Ar from"@mui/material/ListItemIcon";import Wr from"@mui/material/ListItemText";import{styled as G,useTheme as Fr}from"@mui/material/styles";import zr from"@mui/material/Toolbar";import _ from"@mui/material/Typography";import{Fragment as Ur,useState as Hr}from"react";import{Link as Vr,useLocation as Xr}from"react-router-dom";import{jsx as v,jsxs as b}from"react/jsx-runtime";var M=240;function Pe(e){return{width:M,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen}),overflowX:"hidden"}}function ve(e){return{transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:`calc(${e.spacing(7)} + 1px)`,[e.breakpoints.up("sm")]:{width:`calc(${e.spacing(8)} + 1px)`}}}var ge=G("div")(({theme:e})=>s({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),$r=G(Br,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),variants:[{props:({open:o})=>o,style:{marginLeft:M,width:`calc(100% - ${M}px)`,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}}]})),_r=G(Rr,{shouldForwardProp:e=>e!=="open"})(({theme:e})=>({width:M,flexShrink:0,whiteSpace:"nowrap",boxSizing:"border-box",variants:[{props:({open:o})=>o,style:f(s({},Pe(e)),{"& .MuiDrawer-paper":Pe(e)})},{props:({open:o})=>!o,style:f(s({},ve(e)),{"& .MuiDrawer-paper":ve(e)})}]}));function Gr({title:e,navItems:o,children:r,headerElements:n}){let a=Fr(),[t,d]=Hr(!0),i=Xr();function p(){d(!0)}function c(){d(!1)}return b(ue,{sx:{display:"flex"},children:[v(Er,{}),v($r,{position:"fixed",open:t,children:b(zr,{children:[v(xe,{color:"inherit","aria-label":"open drawer",onClick:p,edge:"start",sx:[{marginRight:5},t&&{display:"none"}],children:v(Nr,{})}),v(_,{variant:"h6",noWrap:!0,component:"div",children:e}),n]})}),b(_r,{variant:"permanent",open:t,children:[v(ge,{children:v(xe,{onClick:c,children:a.direction==="rtl"?v(Tr,{}):v(kr,{})})}),v(fe,{}),o.map(l=>b(Ur,{children:[b(Dr,{children:[v(_,{variant:t?"h5":"h6",paddingLeft:t?2:1,children:t?l.category:ce(l.category,4)}),l.options.map(m=>v(Mr,{disablePadding:!0,sx:{display:"block"},children:b(Or,{sx:[{minHeight:48,px:2.5},t?{justifyContent:"initial"}:{justifyContent:"center"}],component:Vr,to:m.to,selected:i.pathname===m.to,children:[v(Ar,{sx:[{minWidth:0,justifyContent:"center"},t?{mr:3}:{mr:"auto"}],children:m.icon?m.icon:t?null:v(_,{children:ce(m.label,4)})}),v(Wr,{primary:m.label,sx:[t?{opacity:1}:{opacity:0}]})]})},m.to))]}),v(fe,{})]},l.category))]}),b(ue,{component:"main",sx:{flexGrow:1,p:3},children:[v(ge,{}),r]})]})}var Jr=Gr;import Kr from"@mui/material/Typography";import{Fragment as Qr,jsx as he}from"react/jsx-runtime";function Yr(n){var a=n,{text:e,sx:o}=a,r=P(a,["text","sx"]);return he(Qr,{children:e.split(`
2
+ `).map((t,d)=>he(Kr,f(s({sx:s({margin:1},o)},r),{children:t}),d))})}var qr=Yr;import J from"@mui/material/Box";import ye from"@mui/material/Typography";import{stripIndent as Zr}from"common-tags";import{LiveEditor as jr,LiveError as et,LivePreview as ot,LiveProvider as rt}from"react-live";import{jsx as L,jsxs as Le}from"react/jsx-runtime";function tt({code:e,scope:o,previewStyles:r,noInline:n,enableTypeScript:a,language:t}){let{mode:d}=k(),i={backgroundColor:d==="dark"?"black":"white",border:.3,borderRadius:1,padding:2,borderColor:"darkgray"},p=r?s(s({},i),r):s({},i);return L(J,{sx:{borderRadius:1,border:.5,padding:2},children:Le(rt,{code:Zr(e),scope:o,noInline:n,enableTypeScript:a,language:t,children:[L(ye,{variant:"h5",children:"Code"}),L(J,{sx:{border:.3,borderRadius:.3,borderColor:"darkgray"},children:L(jr,{})}),L("br",{}),L(ye,{variant:"h5",children:"Result"}),Le(J,{sx:p,children:[L(ot,{}),L(et,{})]})]})})}var nt=tt;import{fillArray as at}from"@alextheman/utility";import it from"@mui/material/Skeleton";import pt from"@mui/material/TableCell";import st from"@mui/material/TableRow";import{jsx as K}from"react/jsx-runtime";function dt({columns:e}){return K(st,{children:at(o=>K(pt,{children:K(it,{})},o),e)})}var lt=dt;import mt from"@mui/material/Button";import{useFormContext as ct}from"react-hook-form";import{jsx as xt}from"react/jsx-runtime";function ut(n){var a=n,{disableClean:e,label:o}=a,r=P(a,["disableClean","label"]);let{formState:{disabled:t,isDirty:d,isSubmitting:i}}=ct();return xt(mt,f(s({color:"primary",disabled:r.disabled||e&&!d||t,loading:i,type:"submit",variant:"contained"},r),{children:o}))}var ft=ut;import be from"@mui/material/Box";import{styled as Pt}from"@mui/material/styles";import vt from"@mui/material/Switch";import{jsx as N}from"react/jsx-runtime";var gt=Pt(vt)(()=>({padding:8,"& .MuiSwitch-track":{borderRadius:11,"&::before, &::after":{content:'""',position:"absolute",top:"50%",transform:"translateY(-50%)",fontSize:16,width:28,height:28}}}));function ht(t){var d=t,{checkedIcon:e,checkedIconStyles:o,uncheckedIcon:r,uncheckedIconStyles:n}=d,a=P(d,["checkedIcon","checkedIconStyles","uncheckedIcon","uncheckedIconStyles"]);let i={borderRadius:"50%",borderColor:"white",backgroundColor:"white",display:"flex",alignItems:"center",justifyContent:"center",padding:.25},p={color:"black",maxWidth:16.5,maxHeight:16.5};return N(gt,s({checkedIcon:N(be,{sx:i,children:N(e,{style:s(s({},p),o)})}),icon:N(be,{sx:i,children:N(r,{style:s(s({},p),n)})})},a))}var yt=ht;import{useCallback as Se,useEffect as Lt,useState as bt}from"react";function St(e){let[o,r]=bt(()=>{let t=window.location.hash.replace("#","");return e&&t===""?e:t}),n=Se(()=>{let t=window.location.hash.replace("#","");r(e&&t===""?e:t)},[r,e]);Lt(()=>(window.addEventListener("hashchange",n),()=>{window.removeEventListener("hashchange",n)}),[n]);let a=Se(t=>{let d=typeof t=="function"?t(o):t;d!==o&&(window.location.hash=d)},[o]);return[o,a]}var wt=St;export{Me as CollapsableItem,Lo as DarkModeToggle,No as DropdownMenu,Do as ExternalLink,V as FileInput,qo as FileInputList,Fo as FileType,tr as IconWithPopover,X as InternalLink,mr as ListItemInternalLink,xr as Loader,F as LoaderData,z as LoaderError,W as LoaderProvider,Ze as ModeProvider,wr as NavigationBottom,Jr as NavigationDrawer,qr as PopoverText,nt as ReactPlayground,no as ScreenSizeProvider,lt as SkeletonRow,fo as SnackbarProvider,ft as SubmitButton,yt as SwitchWithIcons,wt as useHash,I as useLoader,k as useMode,ro as useScreenSize,co as useSnackbar};
3
3
  //# sourceMappingURL=index.js.map