{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "core-modal",
  "type": "registry:lib",
  "title": "core/modal",
  "description": "Framework-free behaviour shared by the ui-* components (modal); no DOM, no lit. Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/core/modal.ts",
      "type": "registry:lib",
      "target": "components/ui/core/modal.ts",
      "content": "/**\n * Modal rules (Carbon Modal): when a click outside closes it, whether a pointer is outside the\n * panel, and which footer action an alert dialog focuses first.\n */\n\nexport type ModalCloseReason = 'escape' | 'backdrop' | 'close-button' | 'api';\n\n/** Natively focusable controls (a renderer checks its own custom elements separately). */\nexport const FOCUSABLE =\n    'input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), a[href], [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\n/** Carbon: a transactional modal (footer buttons) never closes on an outside click, so typed input isn't lost; a passive one does unless `persistent`. */\nexport const closesOnOutsideClick = (persistent: boolean, hasFooter: boolean) => !persistent && !hasFooter;\n\n/** Whether the point lies outside the box (a click on the backdrop of a `<dialog>` targets the dialog itself). */\nexport function isOutside(box: { top: number; left: number; width: number; height: number }, x: number, y: number) {\n    return x < box.left || x > box.left + box.width || y < box.top || y > box.top + box.height;\n}\n\n/** Index of the least destructive action (not primary, not danger — e.g. Cancel) among the footer buttons' kinds; -1 for none. */\nexport const leastDestructive = (kinds: readonly (string | null | undefined)[]) => kinds.findIndex((kind) => !/^(primary|danger)/.test(kind ?? 'primary'));\n"
    }
  ]
}
