{"version":3,"sources":["../../../../src/components/notifications/match-icon.tsx","../../../../src/context/cerberus.tsx","../../../../src/components/spinner/spinner.tsx"],"sourcesContent":["'use client'\n\nimport { ark } from '@ark-ui/react/factory'\nimport { toast } from 'styled-system/recipes'\nimport { useCerberusContext } from '../../context/cerberus'\nimport { Spinner } from '../spinner/index'\nimport type { NotifyOptions } from './types'\n\n/**\n * This private module contains a component that returns the correct icon for a\n * notification based on the palette. If there is no result, it is assumed to\n * be a 'loading' type.\n * @module 'notification/match-icon'\n */\n\ninterface MatchNotificationIconProps {\n  type?: NotifyOptions['palette']\n}\n\nexport function MatchNotificationIcon(props: MatchNotificationIconProps) {\n  const { icons } = useCerberusContext()\n  const type = props.type || 'info'\n  const styles = toast()\n\n  const key = `${type}Notification` as keyof typeof icons\n  const Icon = icons[key] || ToastLoadingIcon\n\n  return (\n    <ark.div className={styles.icon}>\n      <Icon />\n    </ark.div>\n  )\n}\n\nfunction ToastLoadingIcon() {\n  return <Spinner size=\"1rem\" />\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This  module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n  config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n  props: PropsWithChildren<CerberusProviderProps>,\n) {\n  return (\n    <CerberusContext.Provider value={props.config}>\n      {props.children}\n    </CerberusContext.Provider>\n  )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n  const context = useContext(CerberusContext)\n  if (!context) {\n    throw new Error('useCerberus must be used within a CerberusProvider')\n  }\n  return context\n}\n","/**\n * This module contains the Spinner component.\n * @module\n */\n\nexport interface SpinnerProps {\n  /**\n   * The size of the spinner\n   */\n  size?: number | string\n}\n\n/**\n * The Spinner component is used to display a loading indicator. Typically used\n * in buttons, modals, and other components that require a loading state.\n * @see https://cerberus.digitalu.design/react/loading-states/\n * @example\n * ```tsx\n * <Button>\n *   <Show when={loading} fallback={<>Save</>}>\n *      Saving\n *      <Spinner size={24} />\n *   </Show>\n * </Button>\n * ```\n */\nexport function Spinner(props: SpinnerProps) {\n  return (\n    <svg\n      aria-busy=\"true\"\n      data-scope=\"spinner\"\n      data-part=\"root\"\n      role=\"status\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      height={props.size}\n      width={props.size}\n      viewBox=\"0 0 24 24\"\n    >\n      <g\n        fill=\"none\"\n        stroke=\"currentColor\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n        strokeWidth={2}\n      >\n        <path\n          strokeDasharray={16}\n          strokeDashoffset={16}\n          d=\"M12 3c4.97 0 9 4.03 9 9\"\n        >\n          <animate\n            fill=\"freeze\"\n            attributeName=\"stroke-dashoffset\"\n            dur=\"0.15s\"\n            values=\"16;0\"\n          ></animate>\n          <animateTransform\n            attributeName=\"transform\"\n            dur=\"0.75s\"\n            repeatCount=\"indefinite\"\n            type=\"rotate\"\n            values=\"0 12 12;360 12 12\"\n          ></animateTransform>\n        </path>\n        <path\n          strokeDasharray={64}\n          strokeDashoffset={64}\n          strokeOpacity={0.3}\n          d=\"M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z\"\n        >\n          <animate\n            fill=\"freeze\"\n            attributeName=\"stroke-dashoffset\"\n            dur=\"0.6s\"\n            values=\"64;0\"\n          ></animate>\n        </path>\n      </g>\n    </svg>\n  )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAAoB;AACpB,qBAAsB;;;ACDtB,mBAAkE;AAyB9D;AAfJ,IAAM,sBAAkB,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