{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "unexpectedly-quit",
  "title": "Unexpectedly Quit",
  "description": "The classic Mac OS 9 “application has unexpectedly quit” Stop alert with OK, plus a “Sorry, a system error occurred” bomb variant with Restart.",
  "registryDependencies": [
    "https://nostalgia-ui.com/r/nostalgia-theme.json",
    "https://nostalgia-ui.com/r/retro-button.json",
    "https://nostalgia-ui.com/r/retro-icons.json"
  ],
  "files": [
    {
      "path": "registry/new-york/blocks/unexpectedly-quit.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { RetroButton } from \"@/registry/new-york/ui/retro-button\"\nimport { RetroIconBomb, RetroIconStop } from \"@/registry/new-york/ui/retro-icons\"\n\n/* ------------------------------------------------------------------ */\n/*  UnexpectedlyQuitBlock                                              */\n/* ------------------------------------------------------------------ */\n\ntype UnexpectedlyQuitVariant = \"quit\" | \"system-error\"\n\ninterface UnexpectedlyQuitBlockProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n  /**\n   * \"quit\" — the application unexpectedly quit (Stop icon, OK button).\n   * \"system-error\" — \"Sorry, a system error occurred.\" (bomb, Restart button).\n   */\n  variant?: UnexpectedlyQuitVariant\n  /** Name of the application that crashed. */\n  appName?: string\n  /**\n   * Error description. For \"quit\" this is the error type (e.g. `1`, `-1`,\n   * `\"unimplemented trap\"`); for \"system-error\" it is shown on its own line.\n   * Defaults to `1` / `\"unimplemented trap\"`.\n   */\n  errorType?: string | number\n  /** Called when OK is clicked (or Return/Enter is pressed) in the \"quit\" variant. */\n  onOk?: () => void\n  /** Called when Restart is clicked (or Return/Enter is pressed) in the \"system-error\" variant. */\n  onRestart?: () => void\n  /** Show the (always disabled) Resume button in the \"system-error\" variant. Defaults to true. */\n  showResume?: boolean\n}\n\nconst UnexpectedlyQuitBlock = React.forwardRef<\n  HTMLDivElement,\n  UnexpectedlyQuitBlockProps\n>(function UnexpectedlyQuitBlock(\n  {\n    variant = \"quit\",\n    appName = \"SimpleText\",\n    errorType,\n    onOk,\n    onRestart,\n    showResume = true,\n    className,\n    onKeyDown,\n    ...props\n  },\n  ref\n) {\n  const messageId = React.useId()\n  const isSystemError = variant === \"system-error\"\n  const error = errorType ?? (isSystemError ? \"unimplemented trap\" : 1)\n  const onDefault = isSystemError ? onRestart : onOk\n\n  return (\n    <div\n      ref={ref}\n      role=\"alertdialog\"\n      aria-modal=\"false\"\n      aria-describedby={messageId}\n      aria-label={isSystemError ? \"System error\" : `${appName} has unexpectedly quit`}\n      onKeyDown={(e) => {\n        onKeyDown?.(e)\n        if (e.defaultPrevented) return\n        // Return/Enter activates the default button from anywhere in the alert\n        if (e.key === \"Enter\" && e.target === e.currentTarget) {\n          e.preventDefault()\n          onDefault?.()\n        }\n      }}\n      tabIndex={-1}\n      className={cn(\n        \"w-full max-w-[420px] outline-none\",\n        /* Modal frame: black line, platinum bevel band, inner line */\n        \"border border-os9-black bg-os9-gray-200 p-[3px] shadow-[var(--os9-shadow-window)]\",\n        className\n      )}\n      {...props}\n    >\n      <div className=\"border border-os9-gray-600 shadow-[inset_1px_1px_0_var(--os9-white)]\">\n        <div className=\"flex gap-4 px-4 pb-3 pt-4 max-[380px]:gap-3 max-[380px]:px-3\">\n          <div className=\"shrink-0 pt-0.5\">\n            {isSystemError ? <RetroIconBomb /> : <RetroIconStop />}\n          </div>\n\n          <div\n            id={messageId}\n            className=\"min-w-0 flex-1 font-[family-name:var(--os9-font-heading)] text-[12px] leading-[1.35] tracking-[0.42px] text-os9-black\"\n          >\n            {isSystemError ? (\n              <>\n                <p>Sorry, a system error occurred.</p>\n                <p className=\"mt-3 break-words\">&ldquo;{appName}&rdquo;</p>\n                <p className=\"mt-1 break-words\">{String(error)}</p>\n              </>\n            ) : (\n              <p className=\"break-words\">\n                The application &ldquo;{appName}&rdquo; has unexpectedly quit,\n                because an error of type {String(error)} occurred.\n              </p>\n            )}\n          </div>\n        </div>\n\n        <div className=\"flex flex-wrap items-center justify-end gap-3 px-4 pb-4\">\n          {isSystemError && showResume && (\n            <RetroButton type=\"button\" disabled className=\"min-w-[70px]\">\n              Resume\n            </RetroButton>\n          )}\n          <RetroButton\n            type=\"button\"\n            isDefault\n            className=\"min-w-[70px]\"\n            onClick={onDefault}\n          >\n            {isSystemError ? \"Restart\" : \"OK\"}\n          </RetroButton>\n        </div>\n      </div>\n    </div>\n  )\n})\nUnexpectedlyQuitBlock.displayName = \"UnexpectedlyQuitBlock\"\n\nexport { UnexpectedlyQuitBlock }\nexport type { UnexpectedlyQuitBlockProps, UnexpectedlyQuitVariant }\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:block"
}