{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "prescription-refill-manager",
  "title": "Prescription Refill Manager",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-react/blocks/prescription-refill-manager/PrescriptionRefillManager.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport {\n  AlertCircle,\n  ArrowLeftRight,\n  Building2,\n  Calendar,\n  Check,\n  CheckCircle2,\n  Clock,\n  FileText,\n  Info,\n  MapPin,\n  MoreHorizontal,\n  Phone,\n  Pill,\n  Plus,\n  RefreshCw,\n  Search,\n  ShieldAlert,\n  Store,\n  Truck,\n} from 'lucide-react'\nimport { cn } from '@/lib/utils'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n} from '@/components/ui/dialog'\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/components/ui/dropdown-menu'\nimport { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'\nimport { Separator } from '@/components/ui/separator'\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'\nimport { ChangePharmacyDialog, PriorAuthDialog, TrackingDialog, TransferDialog } from './PrescriptionDialogs'\nimport { type Pharmacy, type Prescription, type TransferFormState } from './prescription-refill-manager-types'\n\nexport type { Pharmacy, Prescription, PrescriptionStatus } from './prescription-refill-manager-types'\n\nconst defaultPrescriptions: Prescription[] = [\n  {\n    id: 'rx-1',\n    rxNumber: 'RX-849201',\n    name: 'Metformin HCl 500mg',\n    genericFor: 'Generic for Glucophage',\n    dosageForm: 'Oral Tablet',\n    instructions: 'Take 1 tablet by mouth twice daily with meals',\n    refillsRemaining: 2,\n    totalRefills: 5,\n    lastFilledDate: 'Jul 24, 2026',\n    nextDueDate: 'Aug 24, 2026',\n    isDue: true,\n    prescriber: {\n      name: 'Dr. Emily Vance, MD',\n      specialty: 'Internal Medicine',\n      clinic: 'Wilshire Medical Center',\n      phone: '(310) 555-0142',\n    },\n    status: 'ready',\n    daysSupply: 30,\n    copayEst: 10,\n    ndc: '50090-0819-0',\n  },\n  {\n    id: 'rx-2',\n    rxNumber: 'RX-849202',\n    name: 'Lisinopril 20mg',\n    genericFor: 'Generic for Prinivil / Zestril',\n    dosageForm: 'Oral Tablet',\n    instructions: 'Take 1 tablet by mouth daily in the morning',\n    refillsRemaining: 3,\n    totalRefills: 6,\n    lastFilledDate: 'Jul 10, 2026',\n    nextDueDate: 'Aug 10, 2026',\n    isDue: true,\n    prescriber: {\n      name: 'Dr. Marcus Chen, MD',\n      specialty: 'Cardiology',\n      clinic: 'Pacific Heart & Vascular Institute',\n      phone: '(310) 555-0188',\n    },\n    status: 'ready',\n    daysSupply: 30,\n    copayEst: 10,\n    ndc: '68180-0518-01',\n  },\n  {\n    id: 'rx-3',\n    rxNumber: 'RX-774920',\n    name: 'Albuterol HFA Inhaler',\n    genericFor: 'ProAir HFA 90mcg Inhalation Aerosol',\n    dosageForm: 'Inhalation Aerosol (8.5g canister)',\n    instructions: 'Inhale 2 puffs every 4-6 hours as needed for wheezing or shortness of breath',\n    refillsRemaining: 0,\n    totalRefills: 3,\n    lastFilledDate: 'Jun 15, 2026',\n    nextDueDate: 'Aug 18, 2026',\n    isDue: false,\n    prescriber: {\n      name: 'Dr. Sarah Lin, MD',\n      specialty: 'Pulmonology',\n      clinic: 'Westside Respiratory Clinic',\n      phone: '(310) 555-0195',\n    },\n    status: 'needs_auth',\n    daysSupply: 30,\n    copayEst: 15,\n    ndc: '59310-0579-22',\n  },\n  {\n    id: 'rx-4',\n    rxNumber: 'RX-910384',\n    name: 'Atorvastatin Calcium 40mg',\n    genericFor: 'Generic for Lipitor',\n    dosageForm: 'Oral Tablet',\n    instructions: 'Take 1 tablet by mouth once daily at bedtime',\n    refillsRemaining: 1,\n    totalRefills: 4,\n    lastFilledDate: 'Aug 19, 2026',\n    nextDueDate: 'Nov 19, 2026',\n    isDue: false,\n    prescriber: {\n      name: 'Dr. Marcus Chen, MD',\n      specialty: 'Cardiology',\n      clinic: 'Pacific Heart & Vascular Institute',\n      phone: '(310) 555-0188',\n    },\n    status: 'in_transit',\n    daysSupply: 90,\n    copayEst: 20,\n    ndc: '00071-0157-23',\n    packageTracking: {\n      carrier: 'USPS Priority Rx Express',\n      trackingNumber: '9400 1118 9956 2831 4092 11',\n      status: 'Out for Delivery',\n      estimatedArrival: 'Today by 6:00 PM',\n      steps: [\n        { title: 'Prescription Refill Ordered', time: 'Aug 19, 9:30 AM', done: true },\n        { title: 'Verified & Dispensed by Pharmacist', time: 'Aug 19, 2:15 PM', done: true },\n        { title: 'Shipped from Regional Fulfillment', time: 'Aug 20, 8:00 AM', done: true },\n        { title: 'Out for Delivery', time: 'Aug 21, 8:45 AM', done: true, current: true },\n      ],\n    },\n  },\n]\n\nconst availablePharmacies: Pharmacy[] = [\n  {\n    id: 'cvs-4829',\n    name: 'CVS Pharmacy #4829',\n    subtitle: '24-Hour Drive-Thru',\n    address: '4500 Wilshire Blvd, Los Angeles, CA 90010',\n    phone: '(213) 555-0198',\n    fax: '(213) 555-0199',\n    hours: 'Open 24 Hours · Drive-Thru Open',\n    isDriveThru: true,\n  },\n  {\n    id: 'walgreens-1204',\n    name: 'Walgreens Pharmacy #1204',\n    subtitle: 'Full Service Pharmacy',\n    address: '3724 W Olympic Blvd, Los Angeles, CA 90019',\n    phone: '(323) 555-0144',\n    fax: '(323) 555-0145',\n    hours: 'Mon-Sun: 8:00 AM – 10:00 PM',\n    isDriveThru: false,\n  },\n  {\n    id: 'kaiser-sunset',\n    name: 'Kaiser Sunset Medical Center Pharmacy',\n    subtitle: 'Specialty & Mail Hub',\n    address: '4760 Sunset Blvd, Los Angeles, CA 90027',\n    phone: '(323) 555-0177',\n    fax: '(323) 555-0178',\n    hours: 'Mon-Fri: 7:00 AM – 9:00 PM · Sat-Sun: 8:00 AM – 6:00 PM',\n    isDriveThru: true,\n  },\n]\n\nexport function PrescriptionRefillManager({ className }: { className?: string }) {\n  const [prescriptions] = React.useState<Prescription[]>(defaultPrescriptions)\n  const [searchQuery, setSearchQuery] = React.useState('')\n  const [statusFilter, setStatusFilter] = React.useState<'all' | 'ready' | 'needs_auth' | 'in_transit'>('all')\n  const [activePharmacy, setActivePharmacy] = React.useState<Pharmacy>(availablePharmacies[0])\n\n  // Refill Modal state\n  const [isRefillOpen, setIsRefillOpen] = React.useState(false)\n  const [selectedPrescriptionId, setSelectedPrescriptionId] = React.useState<string>('rx-1')\n  const [supplyDuration, setSupplyDuration] = React.useState<'30' | '90'>('90')\n  const [deliveryMethod, setDeliveryMethod] = React.useState<'pickup' | 'delivery'>('delivery')\n  const [orderSubmitted, setOrderSubmitted] = React.useState(false)\n\n  // Tracking Modal state\n  const [isTrackingOpen, setIsTrackingOpen] = React.useState(false)\n  const [trackingPrescription, setTrackingPrescription] = React.useState<Prescription | null>(null)\n\n  // Transfer Modal state\n  const [isTransferOpen, setIsTransferOpen] = React.useState(false)\n  const [transferForm, setTransferForm] = React.useState<TransferFormState>({\n    pharmacyName: '',\n    phone: '',\n    rxNumber: '',\n    medicationName: '',\n    notes: '',\n  })\n  const [transferSubmitted, setTransferSubmitted] = React.useState(false)\n\n  // Change Pharmacy state\n  const [isChangePharmacyOpen, setIsChangePharmacyOpen] = React.useState(false)\n  const [tempSelectedPharmacyId, setTempSelectedPharmacyId] = React.useState(activePharmacy.id)\n\n  // Prescribing MD Auth Request state\n  const [isAuthRequestOpen, setIsAuthRequestOpen] = React.useState(false)\n  const [authRequestedRx, setAuthRequestedRx] = React.useState<Prescription | null>(null)\n  const [authRequestSubmitted, setAuthRequestSubmitted] = React.useState(false)\n\n  const filteredPrescriptions = prescriptions.filter((rx) => {\n    const matchesSearch =\n      rx.name.toLowerCase().includes(searchQuery.toLowerCase()) ||\n      rx.rxNumber.toLowerCase().includes(searchQuery.toLowerCase()) ||\n      rx.genericFor.toLowerCase().includes(searchQuery.toLowerCase()) ||\n      rx.prescriber.name.toLowerCase().includes(searchQuery.toLowerCase())\n\n    if (!matchesSearch) return false\n    if (statusFilter === 'all') return true\n    return rx.status === statusFilter\n  })\n\n  const selectedPrescription = prescriptions.find((rx) => rx.id === selectedPrescriptionId) || prescriptions[0]\n\n  const estimatedCopay = supplyDuration === '90' ? 20.0 : selectedPrescription.copayEst\n  const estimatedInsuranceSavings = supplyDuration === '90' ? 75.0 : 35.0\n\n  const openRefillModal = (prescriptionId?: string) => {\n    if (prescriptionId) {\n      setSelectedPrescriptionId(prescriptionId)\n    } else {\n      const readyMed = prescriptions.find((r) => r.status === 'ready')\n      setSelectedPrescriptionId(readyMed ? readyMed.id : prescriptions[0].id)\n    }\n    setOrderSubmitted(false)\n    setIsRefillOpen(true)\n  }\n\n  const handleOpenTracking = (rx: Prescription) => {\n    setTrackingPrescription(rx)\n    setIsTrackingOpen(true)\n  }\n\n  const handleOpenAuthRequest = (rx: Prescription) => {\n    setAuthRequestedRx(rx)\n    setAuthRequestSubmitted(false)\n    setIsAuthRequestOpen(true)\n  }\n\n  const handleOpenTransfer = () => {\n    setTransferForm({\n      pharmacyName: '',\n      phone: '',\n      rxNumber: '',\n      medicationName: '',\n      notes: '',\n    })\n    setTransferSubmitted(false)\n    setIsTransferOpen(true)\n  }\n\n  const handleChangePharmacy = () => {\n    setTempSelectedPharmacyId(activePharmacy.id)\n    setIsChangePharmacyOpen(true)\n  }\n\n  const savePharmacyChange = () => {\n    const chosen = availablePharmacies.find((p) => p.id === tempSelectedPharmacyId)\n    if (chosen) {\n      setActivePharmacy(chosen)\n    }\n    setIsChangePharmacyOpen(false)\n  }\n\n  return (\n    <div\n      data-slot=\"prescription-refill-manager\"\n      className={cn('bg-background text-foreground w-full space-y-6', className)}\n    >\n      {/* Header Section */}\n      <header className=\"bg-card border-border flex flex-col justify-between gap-4 rounded-xl border p-5 shadow-xs sm:p-6 md:flex-row md:items-center\">\n        <div className=\"space-y-1\">\n          <div className=\"flex flex-wrap items-center gap-2.5\">\n            <div className=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg\">\n              <Pill className=\"size-4\" />\n            </div>\n            <h1 className=\"text-foreground text-xl font-bold tracking-tight sm:text-2xl\">\n              Prescriptions & Medications\n            </h1>\n            <Badge variant=\"outline\" className=\"border-primary/20 bg-primary/5 text-primary text-xs font-medium\">\n              Active Care Plan\n            </Badge>\n          </div>\n          <p className=\"text-muted-foreground text-sm\">\n            Manage recurring refills, dosage schedules, and home delivery tracking.\n          </p>\n        </div>\n\n        <div className=\"flex flex-wrap items-center gap-2.5\">\n          <Button variant=\"outline\" className=\"gap-1.5 text-xs font-medium\" onClick={handleOpenTransfer}>\n            <ArrowLeftRight className=\"size-3.5\" />\n            Transfer Prescription\n          </Button>\n          <Button variant=\"default\" className=\"gap-1.5 text-xs font-medium shadow-xs\" onClick={() => openRefillModal()}>\n            <Plus className=\"size-3.5\" />\n            Request Refill\n          </Button>\n        </div>\n      </header>\n\n      {/* 3 Medication Status Metric Cards */}\n      <section className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3\">\n        {/* Active Prescriptions */}\n        <Card className=\"shadow-xs\">\n          <CardContent className=\"flex items-center justify-between p-5\">\n            <div className=\"space-y-1\">\n              <p className=\"text-muted-foreground text-xs font-medium\">Active Prescriptions</p>\n              <div className=\"flex items-baseline gap-2\">\n                <span className=\"text-foreground text-2xl font-bold tracking-tight tabular-nums\">4</span>\n                <span className=\"text-muted-foreground text-xs\">Total on file</span>\n              </div>\n              <p className=\"text-muted-foreground text-xs\">All active maintenance therapies</p>\n            </div>\n            <div className=\"bg-primary/10 text-primary flex size-11 shrink-0 items-center justify-center rounded-xl\">\n              <Pill className=\"size-5\" />\n            </div>\n          </CardContent>\n        </Card>\n\n        {/* Refills Ready for Order */}\n        <Card className=\"border-warning/30 bg-warning/5 bg-warning/10 shadow-xs\">\n          <CardContent className=\"flex items-center justify-between p-5\">\n            <div className=\"space-y-1\">\n              <div className=\"flex items-center gap-1.5\">\n                <p className=\"text-warning text-xs font-semibold\">Refills Ready for Order</p>\n                <Badge variant=\"outline\" className=\"border-warning/40 bg-warning/15 text-warning text-xs font-medium\">\n                  2 Action Needed\n                </Badge>\n              </div>\n              <div className=\"flex items-baseline gap-2\">\n                <span className=\"text-warning text-warning text-2xl font-bold tracking-tight tabular-nums\">2</span>\n                <span className=\"text-warning/80 text-xs\">Meds eligible now</span>\n              </div>\n              <p className=\"text-warning/80 text-xs\">Metformin HCl & Lisinopril due</p>\n            </div>\n            <div className=\"bg-warning/20 text-warning flex size-11 shrink-0 items-center justify-center rounded-xl\">\n              <AlertCircle className=\"size-5\" />\n            </div>\n          </CardContent>\n        </Card>\n\n        {/* In Delivery / Transit */}\n        <Card className=\"shadow-xs sm:col-span-2 lg:col-span-1\">\n          <CardContent className=\"flex items-center justify-between p-5\">\n            <div className=\"space-y-1\">\n              <div className=\"flex items-center gap-1.5\">\n                <p className=\"text-muted-foreground text-xs font-medium\">In Delivery / Transit</p>\n                <Badge variant=\"outline\" className=\"border-info/30 bg-info/10 text-info gap-1 text-xs font-medium\">\n                  <span className=\"bg-info size-1.5 animate-pulse rounded-full\" />1 En Route\n                </Badge>\n              </div>\n              <div className=\"flex items-baseline gap-2\">\n                <span className=\"text-foreground text-2xl font-bold tracking-tight tabular-nums\">1</span>\n                <span className=\"text-muted-foreground text-xs\">Package tracked</span>\n              </div>\n              <p className=\"text-muted-foreground text-xs\">Atorvastatin 40mg · USPS Priority</p>\n            </div>\n            <div className=\"bg-info/10 text-info flex size-11 shrink-0 items-center justify-center rounded-xl\">\n              <Truck className=\"size-5\" />\n            </div>\n          </CardContent>\n        </Card>\n      </section>\n\n      {/* Preferred Pharmacy Card */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"pb-3\">\n          <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n            <div className=\"flex items-start gap-3\">\n              <div className=\"bg-muted text-foreground mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border\">\n                <Store className=\"text-primary size-4\" />\n              </div>\n              <div className=\"space-y-0.5\">\n                <div className=\"flex flex-wrap items-center gap-2\">\n                  <CardTitle className=\"text-base font-semibold\">\n                    {activePharmacy.name} · {activePharmacy.subtitle}\n                  </CardTitle>\n                  <Badge variant=\"secondary\" className=\"gap-1 text-xs font-medium\">\n                    <CheckCircle2 className=\"text-success size-3\" />\n                    Preferred Pharmacy\n                  </Badge>\n                  <Badge variant=\"outline\" className=\"border-success/30 bg-success/10 text-success text-xs font-medium\">\n                    {activePharmacy.hours}\n                  </Badge>\n                </div>\n                <CardDescription className=\"text-xs\">\n                  Default location for prescription fulfillment, drive-thru pick-ups, and transfers.\n                </CardDescription>\n              </div>\n            </div>\n\n            <Button\n              variant=\"outline\"\n              size=\"sm\"\n              className=\"shrink-0 gap-1.5 text-xs font-medium\"\n              onClick={handleChangePharmacy}\n            >\n              <Building2 className=\"size-3.5\" />\n              Change Pharmacy\n            </Button>\n          </div>\n        </CardHeader>\n        <Separator />\n        <CardContent className=\"pt-3\">\n          <div className=\"grid grid-cols-1 gap-3 text-xs sm:grid-cols-3\">\n            <div className=\"text-muted-foreground flex items-center gap-2\">\n              <MapPin className=\"text-primary size-3.5 shrink-0\" />\n              <span className=\"text-foreground truncate font-medium\">{activePharmacy.address}</span>\n            </div>\n            <div className=\"text-muted-foreground flex items-center gap-2\">\n              <Phone className=\"text-primary size-3.5 shrink-0\" />\n              <span>\n                Phone: <strong className=\"text-foreground font-medium\">{activePharmacy.phone}</strong>\n              </span>\n            </div>\n            <div className=\"text-muted-foreground flex items-center gap-2\">\n              <Clock className=\"text-primary size-3.5 shrink-0\" />\n              <span>\n                Rx Counter: <strong className=\"text-foreground font-medium\">Ready in 2 hrs</strong>\n              </span>\n            </div>\n          </div>\n        </CardContent>\n      </Card>\n\n      {/* Prescriptions List Table Section */}\n      <Card className=\"border-border shadow-xs\">\n        <CardHeader className=\"pb-3\">\n          <div className=\"flex flex-col gap-4 md:flex-row md:items-center md:justify-between\">\n            <div>\n              <CardTitle className=\"text-lg font-bold\">Active Prescriptions ({filteredPrescriptions.length})</CardTitle>\n              <CardDescription className=\"text-xs\">\n                Review remaining refills, dosage instructions, and ordering eligibility.\n              </CardDescription>\n            </div>\n\n            {/* Search and Filter Bar */}\n            <div className=\"flex flex-wrap items-center gap-2\">\n              <div className=\"relative w-full sm:w-64\">\n                <Search className=\"text-muted-foreground absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2\" />\n                <input\n                  type=\"text\"\n                  placeholder=\"Search medication, Rx#, doctor...\"\n                  value={searchQuery}\n                  onChange={(e) => setSearchQuery(e.target.value)}\n                  className=\"border-input bg-background text-foreground focus-visible:ring-ring h-8 w-full rounded-md border pr-3 pl-8 text-xs shadow-xs focus-visible:ring-2 focus-visible:outline-none\"\n                />\n              </div>\n\n              <div className=\"flex items-center gap-1\">\n                <Button\n                  variant=\"ghost\"\n                  size=\"sm\"\n                  className={cn(\n                    'h-8 text-xs font-medium',\n                    statusFilter === 'all' && 'bg-accent text-accent-foreground',\n                  )}\n                  onClick={() => setStatusFilter('all')}\n                >\n                  All ({prescriptions.length})\n                </Button>\n                <Button\n                  variant=\"ghost\"\n                  size=\"sm\"\n                  className={cn(\n                    'h-8 text-xs font-medium',\n                    statusFilter === 'ready' && 'bg-accent text-accent-foreground text-warning',\n                  )}\n                  onClick={() => setStatusFilter('ready')}\n                >\n                  Ready for Refill (2)\n                </Button>\n                <Button\n                  variant=\"ghost\"\n                  size=\"sm\"\n                  className={cn(\n                    'h-8 text-xs font-medium',\n                    statusFilter === 'in_transit' && 'bg-accent text-accent-foreground',\n                  )}\n                  onClick={() => setStatusFilter('in_transit')}\n                >\n                  In Transit (1)\n                </Button>\n                <Button\n                  variant=\"ghost\"\n                  size=\"sm\"\n                  className={cn(\n                    'h-8 text-xs font-medium',\n                    statusFilter === 'needs_auth' && 'bg-accent text-accent-foreground text-destructive',\n                  )}\n                  onClick={() => setStatusFilter('needs_auth')}\n                >\n                  Needs Auth (1)\n                </Button>\n              </div>\n            </div>\n          </div>\n        </CardHeader>\n\n        <div className=\"overflow-x-auto\">\n          <Table>\n            <TableHeader>\n              <TableRow className=\"hover:bg-transparent\">\n                <TableHead className=\"min-w-[220px] text-xs font-semibold\">Medication & Rx#</TableHead>\n                <TableHead className=\"min-w-[240px] text-xs font-semibold\">Directions & Dosage</TableHead>\n                <TableHead className=\"min-w-[170px] text-xs font-semibold\">Refill Status</TableHead>\n                <TableHead className=\"min-w-[160px] text-xs font-semibold\">Fill Dates / Schedule</TableHead>\n                <TableHead className=\"min-w-[180px] text-xs font-semibold\">Prescribing Doctor</TableHead>\n                <TableHead className=\"min-w-[150px] text-right text-xs font-semibold\">Quick Action</TableHead>\n              </TableRow>\n            </TableHeader>\n            <TableBody>\n              {filteredPrescriptions.map((rx) => (\n                <TableRow\n                  key={rx.id}\n                  className={cn('transition-colors', rx.status === 'ready' && 'bg-warning/[0.02] bg-warning/[0.04]')}\n                >\n                  {/* Medication Name & Rx# */}\n                  <TableCell className=\"py-4 align-top\">\n                    <div className=\"space-y-1\">\n                      <div className=\"flex items-center gap-1.5\">\n                        <span className=\"text-foreground text-sm font-semibold\">{rx.name}</span>\n                      </div>\n                      <p className=\"text-muted-foreground text-xs\">{rx.genericFor}</p>\n                      <div className=\"flex items-center gap-2 pt-0.5\">\n                        <span className=\"bg-muted text-muted-foreground rounded px-1.5 py-0.5 font-mono text-xs font-medium\">\n                          {rx.rxNumber}\n                        </span>\n                        <span className=\"text-muted-foreground text-xs\">NDC: {rx.ndc}</span>\n                      </div>\n                    </div>\n                  </TableCell>\n\n                  {/* Directions & Dosage */}\n                  <TableCell className=\"py-4 align-top\">\n                    <div className=\"space-y-1\">\n                      <p className=\"text-foreground text-xs leading-relaxed font-medium\">{rx.instructions}</p>\n                      <p className=\"text-muted-foreground text-xs\">\n                        Form: <span className=\"text-foreground font-medium\">{rx.dosageForm}</span> · Qty:{' '}\n                        <span className=\"font-mono tabular-nums\">{rx.daysSupply} Days</span>\n                      </p>\n                    </div>\n                  </TableCell>\n\n                  {/* Refill Status Badge */}\n                  <TableCell className=\"py-4 align-top\">\n                    <div className=\"space-y-1.5\">\n                      {rx.status === 'ready' && (\n                        <div>\n                          <Badge\n                            variant=\"outline\"\n                            className=\"border-warning/40 bg-warning/10 text-warning gap-1 text-xs font-medium\"\n                          >\n                            <AlertCircle className=\"size-3\" />\n                            {rx.refillsRemaining} refills remaining\n                          </Badge>\n                        </div>\n                      )}\n                      {rx.status === 'needs_auth' && (\n                        <div>\n                          <Badge\n                            variant=\"destructive\"\n                            className=\"bg-destructive/15 text-destructive dark:text-destructive-foreground dark:bg-destructive/30 gap-1 border-transparent text-xs font-medium\"\n                          >\n                            <ShieldAlert className=\"size-3\" />0 refills - Needs MD authorization\n                          </Badge>\n                        </div>\n                      )}\n                      {rx.status === 'in_transit' && (\n                        <div>\n                          <Badge\n                            variant=\"outline\"\n                            className=\"border-info/30 bg-info/10 text-info gap-1 text-xs font-medium\"\n                          >\n                            <Truck className=\"size-3\" />\n                            In Transit · Est. Arrival Today\n                          </Badge>\n                        </div>\n                      )}\n                      {rx.status === 'active' && (\n                        <div>\n                          <Badge variant=\"secondary\" className=\"text-xs font-medium\">\n                            {rx.refillsRemaining} of {rx.totalRefills} remaining\n                          </Badge>\n                        </div>\n                      )}\n\n                      <p className=\"text-muted-foreground text-xs tabular-nums\">\n                        Est. Copay: <strong className=\"text-foreground\">${rx.copayEst}.00</strong>\n                      </p>\n                    </div>\n                  </TableCell>\n\n                  {/* Fill Dates / Schedule */}\n                  <TableCell className=\"py-4 align-top text-xs\">\n                    <div className=\"space-y-1\">\n                      <div className=\"text-muted-foreground flex items-center gap-1.5\">\n                        <Calendar className=\"size-3 shrink-0\" />\n                        <span>\n                          Last Filled:{' '}\n                          <strong className=\"text-foreground font-medium tabular-nums\">{rx.lastFilledDate}</strong>\n                        </span>\n                      </div>\n                      <div\n                        className={cn(\n                          'flex items-center gap-1.5 font-medium tabular-nums',\n                          rx.isDue ? 'text-warning font-semibold' : 'text-muted-foreground',\n                        )}\n                      >\n                        <Clock className=\"size-3 shrink-0\" />\n                        <span>Next Due: {rx.nextDueDate}</span>\n                      </div>\n                      {rx.isDue && (\n                        <span className=\"text-warning inline-block text-xs font-medium\">Refill window open</span>\n                      )}\n                    </div>\n                  </TableCell>\n\n                  {/* Prescribing Doctor */}\n                  <TableCell className=\"py-4 align-top text-xs\">\n                    <div className=\"space-y-0.5\">\n                      <p className=\"text-foreground font-medium\">{rx.prescriber.name}</p>\n                      <p className=\"text-muted-foreground\">{rx.prescriber.specialty}</p>\n                      <p className=\"text-muted-foreground truncate text-xs\">{rx.prescriber.clinic}</p>\n                    </div>\n                  </TableCell>\n\n                  {/* Quick Action & Dropdown Menu */}\n                  <TableCell className=\"py-4 text-right align-top\">\n                    <div className=\"flex items-center justify-end gap-1.5\">\n                      {/* Ready state: Order Refill Button */}\n                      {rx.status === 'ready' && (\n                        <Button\n                          variant=\"default\"\n                          size=\"sm\"\n                          className=\"h-8 gap-1 text-xs font-medium shadow-xs\"\n                          onClick={() => openRefillModal(rx.id)}\n                        >\n                          <RefreshCw className=\"size-3\" />\n                          Order Refill\n                        </Button>\n                      )}\n\n                      {/* Needs Auth State: Request MD Auth */}\n                      {rx.status === 'needs_auth' && (\n                        <Button\n                          variant=\"outline\"\n                          size=\"sm\"\n                          className=\"border-destructive/30 text-destructive hover:bg-destructive/10 h-8 gap-1 text-xs font-medium\"\n                          onClick={() => handleOpenAuthRequest(rx)}\n                        >\n                          <Clock className=\"size-3\" />\n                          Request Auth\n                        </Button>\n                      )}\n\n                      {/* In Transit State: Track Package */}\n                      {rx.status === 'in_transit' && (\n                        <Button\n                          variant=\"secondary\"\n                          size=\"sm\"\n                          className=\"h-8 gap-1 text-xs font-medium\"\n                          onClick={() => handleOpenTracking(rx)}\n                        >\n                          <Truck className=\"text-info size-3\" />\n                          Track\n                        </Button>\n                      )}\n\n                      {/* Row Dropdown Menu */}\n                      <DropdownMenu>\n                        <DropdownMenuTrigger asChild>\n                          <Button variant=\"ghost\" size=\"icon\" className=\"size-8\" aria-label=\"Prescription options\">\n                            <MoreHorizontal className=\"size-4\" />\n                          </Button>\n                        </DropdownMenuTrigger>\n                        <DropdownMenuContent align=\"end\" className=\"w-52\">\n                          <DropdownMenuLabel className=\"text-xs font-semibold\">Rx Options</DropdownMenuLabel>\n                          <DropdownMenuSeparator />\n                          {rx.status === 'ready' && (\n                            <DropdownMenuItem className=\"gap-2 text-xs\" onClick={() => openRefillModal(rx.id)}>\n                              <RefreshCw className=\"text-primary size-3.5\" />\n                              Order Refill (30/90 Days)\n                            </DropdownMenuItem>\n                          )}\n                          {rx.status === 'needs_auth' && (\n                            <DropdownMenuItem\n                              className=\"text-destructive gap-2 text-xs\"\n                              onClick={() => handleOpenAuthRequest(rx)}\n                            >\n                              <ShieldAlert className=\"size-3.5\" />\n                              Request MD Renewal\n                            </DropdownMenuItem>\n                          )}\n                          {rx.packageTracking && (\n                            <DropdownMenuItem className=\"gap-2 text-xs\" onClick={() => handleOpenTracking(rx)}>\n                              <Truck className=\"text-info size-3.5\" />\n                              Track USPS Delivery\n                            </DropdownMenuItem>\n                          )}\n                          <DropdownMenuItem className=\"gap-2 text-xs\" onClick={handleOpenTransfer}>\n                            <ArrowLeftRight className=\"size-3.5\" />\n                            Transfer to Another Pharmacy\n                          </DropdownMenuItem>\n                          <DropdownMenuSeparator />\n                          <DropdownMenuItem className=\"gap-2 text-xs\">\n                            <FileText className=\"text-muted-foreground size-3.5\" />\n                            View Full Drug Monograph\n                          </DropdownMenuItem>\n                          <DropdownMenuItem className=\"gap-2 text-xs\">\n                            <Phone className=\"text-muted-foreground size-3.5\" />\n                            Call Prescriber ({rx.prescriber.phone})\n                          </DropdownMenuItem>\n                        </DropdownMenuContent>\n                      </DropdownMenu>\n                    </div>\n                  </TableCell>\n                </TableRow>\n              ))}\n            </TableBody>\n          </Table>\n        </div>\n\n        <CardFooter className=\"bg-muted/30 border-border text-muted-foreground flex flex-col justify-between gap-3 border-t p-4 text-xs sm:flex-row sm:items-center\">\n          <div className=\"flex items-center gap-2\">\n            <Info className=\"text-primary size-3.5 shrink-0\" />\n            <span>Refills requested before 3:00 PM are processed same-day by our clinical pharmacy team.</span>\n          </div>\n          <div className=\"flex items-center gap-3\">\n            <span>\n              Automatic Refill Program: <strong className=\"text-foreground font-medium\">Enabled</strong>\n            </span>\n          </div>\n        </CardFooter>\n      </Card>\n\n      {/* Refill Request Modal / Dialog */}\n      <Dialog open={isRefillOpen} onOpenChange={setIsRefillOpen}>\n        <DialogContent className=\"sm:max-w-xl\">\n          <DialogHeader>\n            <div className=\"flex items-center gap-2\">\n              <div className=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg\">\n                <RefreshCw className=\"size-4\" />\n              </div>\n              <div>\n                <DialogTitle className=\"text-lg font-bold\">Request Prescription Refill</DialogTitle>\n                <DialogDescription className=\"text-xs\">\n                  Select your supply duration, delivery method, and confirm your copay.\n                </DialogDescription>\n              </div>\n            </div>\n          </DialogHeader>\n\n          {/* If order submitted success view */}\n          {orderSubmitted ? (\n            <div className=\"space-y-4 py-4\">\n              <div className=\"border-success/30 bg-success/10 text-success space-y-2 rounded-xl border p-5 text-center\">\n                <div className=\"bg-success/20 text-success mx-auto flex size-12 items-center justify-center rounded-full\">\n                  <CheckCircle2 className=\"size-6\" />\n                </div>\n                <h3 className=\"text-base font-bold\">Refill Order Successfully Placed!</h3>\n                <p className=\"text-success/90 mx-auto max-w-md text-xs\">\n                  Your order for <strong>{selectedPrescription.name}</strong> ({supplyDuration}-day supply) has been\n                  sent to {activePharmacy.name}.\n                </p>\n                <p className=\"pt-1 font-mono text-xs font-medium\">Order Ref: #ORD-849302</p>\n              </div>\n\n              <div className=\"bg-muted/40 text-muted-foreground space-y-1.5 rounded-lg border p-3 text-xs\">\n                <div className=\"flex justify-between\">\n                  <span>Fulfillment Method:</span>\n                  <strong className=\"text-foreground\">\n                    {deliveryMethod === 'delivery' ? 'Express Home Delivery (1-2 Days)' : 'In-Store Pickup'}\n                  </strong>\n                </div>\n                <div className=\"flex justify-between\">\n                  <span>Estimated Copay:</span>\n                  <strong className=\"text-foreground font-mono tabular-nums\">${estimatedCopay.toFixed(2)}</strong>\n                </div>\n                <div className=\"flex justify-between\">\n                  <span>Remaining Refills After This Order:</span>\n                  <strong className=\"text-foreground tabular-nums\">\n                    {Math.max(0, selectedPrescription.refillsRemaining - 1)}\n                  </strong>\n                </div>\n              </div>\n\n              <DialogFooter className=\"pt-2\">\n                <Button variant=\"default\" className=\"w-full\" onClick={() => setIsRefillOpen(false)}>\n                  Done & Return to Prescriptions\n                </Button>\n              </DialogFooter>\n            </div>\n          ) : (\n            <div className=\"space-y-5 py-2\">\n              {/* Medication Selector / Summary Box */}\n              <div className=\"bg-muted/40 border-border space-y-3 rounded-xl border p-4\">\n                <div className=\"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between\">\n                  <div className=\"space-y-0.5\">\n                    <p className=\"text-muted-foreground text-xs font-semibold\">Selected Prescription</p>\n                    <h4 className=\"text-foreground text-sm font-bold\">{selectedPrescription.name}</h4>\n                    <p className=\"text-muted-foreground text-xs\">{selectedPrescription.genericFor}</p>\n                  </div>\n                  <div className=\"space-y-0.5 text-left sm:text-right\">\n                    <span className=\"bg-background rounded border px-2 py-0.5 font-mono text-xs font-medium\">\n                      {selectedPrescription.rxNumber}\n                    </span>\n                    <p className=\"text-success text-xs font-medium\">\n                      {selectedPrescription.refillsRemaining} refills remaining\n                    </p>\n                  </div>\n                </div>\n\n                <div className=\"text-muted-foreground flex items-center justify-between border-t pt-2.5 text-xs\">\n                  <span>\n                    Prescriber:{' '}\n                    <strong className=\"text-foreground font-medium\">{selectedPrescription.prescriber.name}</strong>\n                  </span>\n                  <span>\n                    Directions:{' '}\n                    <strong className=\"text-foreground font-medium\">{selectedPrescription.instructions}</strong>\n                  </span>\n                </div>\n              </div>\n\n              {/* Quantity / Supply Selector */}\n              <div className=\"space-y-2.5\">\n                <label className=\"text-foreground flex items-center justify-between text-xs font-semibold\">\n                  <span>Choose Supply Quantity</span>\n                  <span className=\"text-muted-foreground font-normal\">Insurance Tier 1 Preferred</span>\n                </label>\n\n                <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n                  {/* 30-Day Supply Option */}\n                  <button\n                    type=\"button\"\n                    className={cn(\n                      'flex cursor-pointer flex-col items-start rounded-xl border p-3.5 text-left transition-colors duration-150',\n                      supplyDuration === '30'\n                        ? 'border-primary bg-primary/5 ring-primary ring-1'\n                        : 'border-border bg-card hover:bg-muted/50',\n                    )}\n                    onClick={() => setSupplyDuration('30')}\n                  >\n                    <div className=\"mb-1 flex w-full items-center justify-between\">\n                      <span className=\"text-foreground text-xs font-bold\">30-Day Supply</span>\n                      <span className=\"text-foreground font-mono text-xs font-bold tabular-nums\">$10.00</span>\n                    </div>\n                    <p className=\"text-muted-foreground text-xs\">Standard monthly bottle (30 tablets)</p>\n                    <span className=\"text-muted-foreground mt-2 text-xs\">Local pickup or standard mail</span>\n                  </button>\n\n                  {/* 90-Day Supply Option (Recommended) */}\n                  <button\n                    type=\"button\"\n                    className={cn(\n                      'relative flex cursor-pointer flex-col items-start rounded-xl border p-3.5 text-left transition-colors duration-150',\n                      supplyDuration === '90'\n                        ? 'border-primary bg-primary/5 ring-primary ring-1'\n                        : 'border-border bg-card hover:bg-muted/50',\n                    )}\n                    onClick={() => setSupplyDuration('90')}\n                  >\n                    <div className=\"mb-1 flex w-full items-center justify-between\">\n                      <span className=\"text-foreground text-xs font-bold\">90-Day Mail Order</span>\n                      <span className=\"text-foreground font-mono text-xs font-bold tabular-nums\">$20.00</span>\n                    </div>\n                    <p className=\"text-muted-foreground text-xs\">3-Month Supply (90 tablets)</p>\n                    <Badge\n                      variant=\"outline\"\n                      className=\"border-success/40 bg-success/10 text-success mt-2 text-xs font-semibold\"\n                    >\n                      Save $10 on Copay\n                    </Badge>\n                  </button>\n                </div>\n              </div>\n\n              {/* Delivery Method Selector */}\n              <div className=\"space-y-2.5\">\n                <label className=\"text-foreground text-xs font-semibold\">Select Delivery & Fulfillment Method</label>\n\n                <RadioGroup\n                  value={deliveryMethod}\n                  onValueChange={(val) => setDeliveryMethod(val as 'pickup' | 'delivery')}\n                  className=\"gap-2.5\"\n                >\n                  {/* Free Express Home Delivery */}\n                  <label\n                    htmlFor=\"delivery-option\"\n                    className={cn(\n                      'flex cursor-pointer items-start gap-3 rounded-xl border p-3 transition-colors',\n                      deliveryMethod === 'delivery'\n                        ? 'border-primary bg-primary/5 ring-primary ring-1'\n                        : 'border-border bg-card hover:bg-muted/30',\n                    )}\n                  >\n                    <RadioGroupItem value=\"delivery\" id=\"delivery-option\" className=\"mt-0.5\" />\n                    <div className=\"flex-1 space-y-0.5\">\n                      <div className=\"flex items-center justify-between\">\n                        <span className=\"text-foreground flex items-center gap-1.5 text-xs font-bold\">\n                          <Truck className=\"text-primary size-3.5\" />\n                          Free Express Home Delivery\n                        </span>\n                        <Badge variant=\"outline\" className=\"border-primary/30 bg-primary/10 text-primary text-xs\">\n                          FREE 2-Day\n                        </Badge>\n                      </div>\n                      <p className=\"text-muted-foreground text-xs\">\n                        Ships to: <strong>1420 Ocean Ave, Apt 4B, Santa Monica, CA</strong>\n                      </p>\n                      <p className=\"text-muted-foreground text-xs\">\n                        Estimated arrival in 1–2 business days via USPS Priority\n                      </p>\n                    </div>\n                  </label>\n\n                  {/* Pharmacy Pickup */}\n                  <label\n                    htmlFor=\"pickup-option\"\n                    className={cn(\n                      'flex cursor-pointer items-start gap-3 rounded-xl border p-3 transition-colors',\n                      deliveryMethod === 'pickup'\n                        ? 'border-primary bg-primary/5 ring-primary ring-1'\n                        : 'border-border bg-card hover:bg-muted/30',\n                    )}\n                  >\n                    <RadioGroupItem value=\"pickup\" id=\"pickup-option\" className=\"mt-0.5\" />\n                    <div className=\"flex-1 space-y-0.5\">\n                      <div className=\"flex items-center justify-between\">\n                        <span className=\"text-foreground flex items-center gap-1.5 text-xs font-bold\">\n                          <Store className=\"text-primary size-3.5\" />\n                          In-Store / Drive-Thru Pickup\n                        </span>\n                        <span className=\"text-success text-xs font-bold\">Ready Today</span>\n                      </div>\n                      <p className=\"text-muted-foreground text-xs\">\n                        {activePharmacy.name} · {activePharmacy.address}\n                      </p>\n                      <p className=\"text-muted-foreground text-xs\">\n                        Ready for pickup in ~2 hours. 24-Hour drive-thru accessible.\n                      </p>\n                    </div>\n                  </label>\n                </RadioGroup>\n              </div>\n\n              {/* Copay and Cost Breakdown */}\n              <div className=\"bg-muted/50 space-y-2 rounded-xl border p-3.5 text-xs\">\n                <div className=\"text-muted-foreground flex justify-between\">\n                  <span>Medication Retail Cost:</span>\n                  <span className=\"font-mono tabular-nums line-through\">\n                    ${(estimatedCopay + estimatedInsuranceSavings).toFixed(2)}\n                  </span>\n                </div>\n                <div className=\"text-success flex justify-between\">\n                  <span>Insurance Coverage (Aetna Choice POS II):</span>\n                  <span className=\"font-mono tabular-nums\">-${estimatedInsuranceSavings.toFixed(2)}</span>\n                </div>\n                <div className=\"text-muted-foreground flex justify-between\">\n                  <span>Shipping & Handling:</span>\n                  <span className=\"text-success font-medium\">FREE</span>\n                </div>\n                <Separator />\n                <div className=\"text-foreground flex items-center justify-between pt-0.5 text-sm font-bold\">\n                  <span>Estimated Out-of-Pocket:</span>\n                  <span className=\"text-primary font-mono text-base tabular-nums\">${estimatedCopay.toFixed(2)}</span>\n                </div>\n              </div>\n\n              <DialogFooter className=\"flex items-center justify-between gap-2 pt-2 sm:justify-end\">\n                <Button variant=\"outline\" onClick={() => setIsRefillOpen(false)}>\n                  Cancel\n                </Button>\n                <Button variant=\"default\" className=\"gap-1.5 shadow-xs\" onClick={() => setOrderSubmitted(true)}>\n                  <Check className=\"size-4\" />\n                  Submit Refill Order\n                </Button>\n              </DialogFooter>\n            </div>\n          )}\n        </DialogContent>\n      </Dialog>\n\n      {/* Tracking Modal / Dialog */}\n      <TrackingDialog open={isTrackingOpen} onOpenChange={setIsTrackingOpen} prescription={trackingPrescription} />\n\n      {/* Transfer Prescription Modal / Dialog */}\n      <TransferDialog\n        open={isTransferOpen}\n        onOpenChange={setIsTransferOpen}\n        pharmacyName={activePharmacy.name}\n        form={transferForm}\n        onFormChange={setTransferForm}\n        submitted={transferSubmitted}\n        onSubmit={() => setTransferSubmitted(true)}\n      />\n\n      {/* Change Preferred Pharmacy Modal / Dialog */}\n      <ChangePharmacyDialog\n        open={isChangePharmacyOpen}\n        onOpenChange={setIsChangePharmacyOpen}\n        pharmacies={availablePharmacies}\n        activePharmacyId={activePharmacy.id}\n        selectedId={tempSelectedPharmacyId}\n        onSelect={setTempSelectedPharmacyId}\n        onSave={savePharmacyChange}\n      />\n\n      {/* Request MD Authorization Modal / Dialog */}\n      <PriorAuthDialog\n        open={isAuthRequestOpen}\n        onOpenChange={setIsAuthRequestOpen}\n        prescription={authRequestedRx}\n        submitted={authRequestSubmitted}\n        onSubmit={() => setAuthRequestSubmitted(true)}\n      />\n    </div>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/prescription-refill-manager/PrescriptionRefillManager.tsx"
    },
    {
      "path": "packages/registry-react/blocks/prescription-refill-manager/PrescriptionDialogs.tsx",
      "content": "'use client'\n\nimport { ArrowLeftRight, Building2, Check, CheckCircle2, ShieldAlert, Truck } from 'lucide-react'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n} from '@/components/ui/dialog'\nimport { cn } from '@/lib/utils'\nimport { type Pharmacy, type Prescription, type TransferFormState } from './prescription-refill-manager-types'\n\nexport function TrackingDialog({\n  open,\n  onOpenChange,\n  prescription,\n}: {\n  open: boolean\n  onOpenChange: (open: boolean) => void\n  prescription: Prescription | null\n}) {\n  return (\n    <>\n      {/* Tracking Modal / Dialog */}\n      <Dialog open={open} onOpenChange={onOpenChange}>\n        <DialogContent className=\"sm:max-w-lg\">\n          {prescription && (\n            <>\n              <DialogHeader>\n                <div className=\"flex items-center gap-2\">\n                  <div className=\"bg-info/10 text-info flex size-8 items-center justify-center rounded-lg\">\n                    <Truck className=\"size-4\" />\n                  </div>\n                  <div>\n                    <DialogTitle className=\"text-lg font-bold\">Delivery & Tracking Status</DialogTitle>\n                    <DialogDescription className=\"text-xs\">Tracking details for {prescription.name}</DialogDescription>\n                  </div>\n                </div>\n              </DialogHeader>\n\n              {prescription.packageTracking && (\n                <div className=\"space-y-4 py-2 text-xs\">\n                  {/* Tracking Header Banner */}\n                  <div className=\"bg-muted/40 border-border space-y-2 rounded-xl border p-4\">\n                    <div className=\"flex items-center justify-between\">\n                      <span className=\"text-muted-foreground\">Carrier & Service:</span>\n                      <strong className=\"text-foreground\">{prescription.packageTracking.carrier}</strong>\n                    </div>\n                    <div className=\"flex items-center justify-between\">\n                      <span className=\"text-muted-foreground\">Tracking Number:</span>\n                      <strong className=\"text-foreground font-mono\">\n                        {prescription.packageTracking.trackingNumber}\n                      </strong>\n                    </div>\n                    <div className=\"flex items-center justify-between\">\n                      <span className=\"text-muted-foreground\">Status:</span>\n                      <Badge variant=\"outline\" className=\"border-info/30 bg-info/10 text-info text-xs font-semibold\">\n                        {prescription.packageTracking.status}\n                      </Badge>\n                    </div>\n                    <div className=\"flex items-center justify-between border-t pt-1\">\n                      <span className=\"text-muted-foreground\">Estimated Delivery:</span>\n                      <strong className=\"text-foreground font-bold\">\n                        {prescription.packageTracking.estimatedArrival}\n                      </strong>\n                    </div>\n                  </div>\n\n                  {/* Step Timeline Tracker */}\n                  <div className=\"space-y-3 pl-2\">\n                    <p className=\"text-foreground text-xs font-semibold\">Package History Timeline</p>\n                    <div className=\"border-border relative ml-2 space-y-4 border-l pl-4\">\n                      {prescription.packageTracking.steps.map((step, idx) => (\n                        <div key={idx} className=\"relative space-y-0.5\">\n                          <div\n                            className={cn(\n                              'ring-background absolute top-0.5 -left-[23px] flex size-3.5 items-center justify-center rounded-full ring-2',\n                              step.current\n                                ? 'bg-info ring-info animate-pulse'\n                                : step.done\n                                  ? 'bg-primary text-primary-foreground'\n                                  : 'bg-muted border',\n                            )}\n                          />\n                          <p className={cn('text-xs font-semibold', step.current ? 'text-info' : 'text-foreground')}>\n                            {step.title}\n                          </p>\n                          <p className=\"text-muted-foreground text-xs tabular-nums\">{step.time}</p>\n                        </div>\n                      ))}\n                    </div>\n                  </div>\n                </div>\n              )}\n\n              <DialogFooter>\n                <Button variant=\"outline\" className=\"w-full sm:w-auto\" onClick={() => onOpenChange(false)}>\n                  Close Tracking\n                </Button>\n              </DialogFooter>\n            </>\n          )}\n        </DialogContent>\n      </Dialog>\n    </>\n  )\n}\n\nexport function TransferDialog({\n  open,\n  onOpenChange,\n  pharmacyName,\n  form,\n  onFormChange,\n  submitted,\n  onSubmit,\n}: {\n  open: boolean\n  onOpenChange: (open: boolean) => void\n  pharmacyName: string\n  form: TransferFormState\n  onFormChange: (form: TransferFormState) => void\n  submitted: boolean\n  onSubmit: () => void\n}) {\n  return (\n    <>\n      {/* Transfer Prescription Modal / Dialog */}\n      <Dialog open={open} onOpenChange={onOpenChange}>\n        <DialogContent className=\"sm:max-w-lg\">\n          <DialogHeader>\n            <div className=\"flex items-center gap-2\">\n              <div className=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg\">\n                <ArrowLeftRight className=\"size-4\" />\n              </div>\n              <div>\n                <DialogTitle className=\"text-lg font-bold\">Transfer Prescription</DialogTitle>\n                <DialogDescription className=\"text-xs\">\n                  Move an existing prescription from another pharmacy to {pharmacyName}.\n                </DialogDescription>\n              </div>\n            </div>\n          </DialogHeader>\n\n          {submitted ? (\n            <div className=\"space-y-4 py-4\">\n              <div className=\"border-success/30 bg-success/10 text-success space-y-2 rounded-xl border p-5 text-center\">\n                <div className=\"bg-success/20 text-success mx-auto flex size-12 items-center justify-center rounded-full\">\n                  <CheckCircle2 className=\"size-6\" />\n                </div>\n                <h3 className=\"text-base font-bold\">Transfer Request Submitted!</h3>\n                <p className=\"text-success/90 mx-auto max-w-sm text-xs\">\n                  Our clinical pharmacy team will contact your previous pharmacy to transfer the prescription. This\n                  typically takes 24–48 hours.\n                </p>\n              </div>\n              <DialogFooter>\n                <Button variant=\"default\" className=\"w-full\" onClick={() => onOpenChange(false)}>\n                  Done\n                </Button>\n              </DialogFooter>\n            </div>\n          ) : (\n            <div className=\"space-y-3.5 py-2 text-xs\">\n              <div className=\"space-y-1\">\n                <label className=\"text-foreground text-xs font-medium\">Current / Previous Pharmacy Name</label>\n                <input\n                  type=\"text\"\n                  placeholder=\"e.g. Walgreens, Rite Aid, Walmart...\"\n                  value={form.pharmacyName}\n                  onChange={(e) => onFormChange({ ...form, pharmacyName: e.target.value })}\n                  className=\"border-input bg-background text-foreground focus-visible:ring-ring h-9 w-full rounded-md border px-3 text-xs shadow-xs focus-visible:ring-2 focus-visible:outline-none\"\n                />\n              </div>\n\n              <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n                <div className=\"space-y-1\">\n                  <label className=\"text-foreground text-xs font-medium\">Pharmacy Phone Number</label>\n                  <input\n                    type=\"tel\"\n                    placeholder=\"(555) 000-0000\"\n                    value={form.phone}\n                    onChange={(e) => onFormChange({ ...form, phone: e.target.value })}\n                    className=\"border-input bg-background text-foreground focus-visible:ring-ring h-9 w-full rounded-md border px-3 text-xs shadow-xs focus-visible:ring-2 focus-visible:outline-none\"\n                  />\n                </div>\n                <div className=\"space-y-1\">\n                  <label className=\"text-foreground text-xs font-medium\">Existing Rx Number (if known)</label>\n                  <input\n                    type=\"text\"\n                    placeholder=\"e.g. RX-123456\"\n                    value={form.rxNumber}\n                    onChange={(e) => onFormChange({ ...form, rxNumber: e.target.value })}\n                    className=\"border-input bg-background text-foreground focus-visible:ring-ring h-9 w-full rounded-md border px-3 font-mono text-xs shadow-xs focus-visible:ring-2 focus-visible:outline-none\"\n                  />\n                </div>\n              </div>\n\n              <div className=\"space-y-1\">\n                <label className=\"text-foreground text-xs font-medium\">Medication Name & Strength</label>\n                <input\n                  type=\"text\"\n                  placeholder=\"e.g. Lipitor 20mg or Levothyroxine 50mcg\"\n                  value={form.medicationName}\n                  onChange={(e) => onFormChange({ ...form, medicationName: e.target.value })}\n                  className=\"border-input bg-background text-foreground focus-visible:ring-ring h-9 w-full rounded-md border px-3 text-xs shadow-xs focus-visible:ring-2 focus-visible:outline-none\"\n                />\n              </div>\n\n              <div className=\"space-y-1\">\n                <label className=\"text-foreground text-xs font-medium\">\n                  Special Instructions / Prescriber Notes (Optional)\n                </label>\n                <textarea\n                  rows={2}\n                  placeholder=\"Any additional notes for the receiving pharmacist...\"\n                  value={form.notes}\n                  onChange={(e) => onFormChange({ ...form, notes: e.target.value })}\n                  className=\"border-input bg-background text-foreground focus-visible:ring-ring w-full rounded-md border p-2 text-xs shadow-xs focus-visible:ring-2 focus-visible:outline-none\"\n                />\n              </div>\n\n              <DialogFooter className=\"pt-2\">\n                <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n                  Cancel\n                </Button>\n                <Button variant=\"default\" className=\"gap-1.5 shadow-xs\" onClick={() => onSubmit()}>\n                  <ArrowLeftRight className=\"size-3.5\" />\n                  Initiate Transfer\n                </Button>\n              </DialogFooter>\n            </div>\n          )}\n        </DialogContent>\n      </Dialog>\n    </>\n  )\n}\n\nexport function ChangePharmacyDialog({\n  open,\n  onOpenChange,\n  pharmacies,\n  activePharmacyId,\n  selectedId,\n  onSelect,\n  onSave,\n}: {\n  open: boolean\n  onOpenChange: (open: boolean) => void\n  pharmacies: Pharmacy[]\n  activePharmacyId: string\n  selectedId: string\n  onSelect: (pharmacyId: string) => void\n  onSave: () => void\n}) {\n  return (\n    <>\n      {/* Change Preferred Pharmacy Modal / Dialog */}\n      <Dialog open={open} onOpenChange={onOpenChange}>\n        <DialogContent className=\"sm:max-w-lg\">\n          <DialogHeader>\n            <div className=\"flex items-center gap-2\">\n              <div className=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg\">\n                <Building2 className=\"size-4\" />\n              </div>\n              <div>\n                <DialogTitle className=\"text-lg font-bold\">Select Preferred Pharmacy</DialogTitle>\n                <DialogDescription className=\"text-xs\">\n                  Choose the location where your local orders and drive-thru pickups are routed.\n                </DialogDescription>\n              </div>\n            </div>\n          </DialogHeader>\n\n          <div className=\"space-y-3 py-2 text-xs\">\n            {pharmacies.map((pharmacy) => (\n              <div\n                key={pharmacy.id}\n                className={cn(\n                  'flex cursor-pointer items-start justify-between rounded-xl border p-3.5 transition-colors',\n                  selectedId === pharmacy.id\n                    ? 'border-primary bg-primary/5 ring-primary ring-1'\n                    : 'border-border bg-card hover:bg-muted/40',\n                )}\n                onClick={() => onSelect(pharmacy.id)}\n              >\n                <div className=\"space-y-1\">\n                  <div className=\"flex items-center gap-2\">\n                    <span className=\"text-foreground font-bold\">{pharmacy.name}</span>\n                    {pharmacy.id === activePharmacyId && (\n                      <Badge variant=\"secondary\" className=\"text-xs\">\n                        Current\n                      </Badge>\n                    )}\n                  </div>\n                  <p className=\"text-muted-foreground\">{pharmacy.address}</p>\n                  <div className=\"text-muted-foreground flex items-center gap-3 pt-1\">\n                    <span>\n                      Phone: <strong className=\"text-foreground font-medium\">{pharmacy.phone}</strong>\n                    </span>\n                    <span>{pharmacy.hours}</span>\n                  </div>\n                </div>\n                <div className=\"pt-0.5\">\n                  <div\n                    className={cn(\n                      'flex size-4 items-center justify-center rounded-full border',\n                      selectedId === pharmacy.id\n                        ? 'border-primary bg-primary text-primary-foreground'\n                        : 'border-muted-foreground/40',\n                    )}\n                  >\n                    {selectedId === pharmacy.id && <div className=\"bg-background size-1.5 rounded-full\" />}\n                  </div>\n                </div>\n              </div>\n            ))}\n          </div>\n\n          <DialogFooter className=\"pt-2\">\n            <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n              Cancel\n            </Button>\n            <Button variant=\"default\" onClick={onSave}>\n              Save Preferred Pharmacy\n            </Button>\n          </DialogFooter>\n        </DialogContent>\n      </Dialog>\n    </>\n  )\n}\n\nexport function PriorAuthDialog({\n  open,\n  onOpenChange,\n  prescription,\n  submitted,\n  onSubmit,\n}: {\n  open: boolean\n  onOpenChange: (open: boolean) => void\n  prescription: Prescription | null\n  submitted: boolean\n  onSubmit: () => void\n}) {\n  return (\n    <>\n      {/* Request MD Authorization Modal / Dialog */}\n      <Dialog open={open} onOpenChange={onOpenChange}>\n        <DialogContent className=\"sm:max-w-md\">\n          {prescription && (\n            <>\n              <DialogHeader>\n                <div className=\"flex items-center gap-2\">\n                  <div className=\"bg-destructive/10 text-destructive flex size-8 items-center justify-center rounded-lg\">\n                    <ShieldAlert className=\"size-4\" />\n                  </div>\n                  <div>\n                    <DialogTitle className=\"text-lg font-bold\">Request Prescriber Authorization</DialogTitle>\n                    <DialogDescription className=\"text-xs\">\n                      Renew zero-refill prescription with your physician.\n                    </DialogDescription>\n                  </div>\n                </div>\n              </DialogHeader>\n\n              {submitted ? (\n                <div className=\"space-y-3 py-4 text-center\">\n                  <div className=\"bg-success/20 text-success mx-auto flex size-12 items-center justify-center rounded-full\">\n                    <CheckCircle2 className=\"size-6\" />\n                  </div>\n                  <h3 className=\"text-foreground text-sm font-bold\">Authorization Request Sent!</h3>\n                  <p className=\"text-muted-foreground text-xs\">\n                    A renewal request for <strong>{prescription.name}</strong> has been electronically transmitted to{' '}\n                    <strong>{prescription.prescriber.name}</strong>.\n                  </p>\n                  <DialogFooter className=\"pt-2\">\n                    <Button variant=\"default\" className=\"w-full\" onClick={() => onOpenChange(false)}>\n                      Done\n                    </Button>\n                  </DialogFooter>\n                </div>\n              ) : (\n                <div className=\"space-y-4 py-2 text-xs\">\n                  <div className=\"bg-muted/40 space-y-1.5 rounded-xl border p-3.5\">\n                    <p className=\"text-foreground font-bold\">{prescription.name}</p>\n                    <p className=\"text-muted-foreground\">{prescription.genericFor}</p>\n                    <p className=\"text-muted-foreground\">\n                      Prescribing Physician: <strong className=\"text-foreground\">{prescription.prescriber.name}</strong>\n                    </p>\n                    <p className=\"text-muted-foreground\">\n                      Clinic: {prescription.prescriber.clinic} ({prescription.prescriber.phone})\n                    </p>\n                  </div>\n\n                  <p className=\"text-muted-foreground leading-relaxed\">\n                    Because this prescription has 0 refills remaining, we will send an electronic request\n                    (e-Prescription Renewal) directly to your doctor&apos;s office.\n                  </p>\n\n                  <DialogFooter>\n                    <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n                      Cancel\n                    </Button>\n                    <Button variant=\"default\" className=\"gap-1.5\" onClick={() => onSubmit()}>\n                      <Check className=\"size-3.5\" />\n                      Send Renewal Request\n                    </Button>\n                  </DialogFooter>\n                </div>\n              )}\n            </>\n          )}\n        </DialogContent>\n      </Dialog>\n    </>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/prescription-refill-manager/PrescriptionDialogs.tsx"
    },
    {
      "path": "packages/registry-react/blocks/prescription-refill-manager/prescription-refill-manager-types.ts",
      "content": "export type PrescriptionStatus = 'ready' | 'needs_auth' | 'in_transit' | 'active'\n\nexport interface Prescription {\n  id: string\n  rxNumber: string\n  name: string\n  genericFor: string\n  dosageForm: string\n  instructions: string\n  refillsRemaining: number\n  totalRefills: number\n  lastFilledDate: string\n  nextDueDate: string\n  isDue: boolean\n  prescriber: {\n    name: string\n    specialty: string\n    clinic: string\n    phone: string\n  }\n  status: PrescriptionStatus\n  daysSupply: number\n  copayEst: number\n  ndc: string\n  packageTracking?: {\n    carrier: string\n    trackingNumber: string\n    status: string\n    estimatedArrival: string\n    steps: { title: string; time: string; done: boolean; current?: boolean }[]\n  }\n}\n\nexport interface Pharmacy {\n  id: string\n  name: string\n  subtitle: string\n  address: string\n  phone: string\n  fax: string\n  hours: string\n  isDriveThru: boolean\n}\n\nexport interface TransferFormState {\n  pharmacyName: string\n  phone: string\n  rxNumber: string\n  medicationName: string\n  notes: string\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/prescription-refill-manager/prescription-refill-manager-types.ts"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/react/badge.json",
    "https://uipkge.dev/r/react/button.json",
    "https://uipkge.dev/r/react/card.json",
    "https://uipkge.dev/r/react/dialog.json",
    "https://uipkge.dev/r/react/dropdown-menu.json",
    "https://uipkge.dev/r/react/radio-group.json",
    "https://uipkge.dev/r/react/separator.json",
    "https://uipkge.dev/r/react/table.json"
  ],
  "description": "Pharmacy patient portal for managing active prescriptions, refill requests, dosage schedules, delivery tracking, and preferred pharmacy details with an integrated refill order dialog.",
  "categories": [
    "healthcare",
    "app"
  ]
}