db-studio 1.10.0 → 1.12.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.
Files changed (98) hide show
  1. package/dist/index.js +29 -27
  2. package/dist/index.js.map +1 -1
  3. package/dist/web-dist/assets/_pathlessLayout-C6coCMpi.js +1 -0
  4. package/dist/web-dist/assets/{_pathlessLayout-CEv6uosT.js.map → _pathlessLayout-C6coCMpi.js.map} +1 -1
  5. package/dist/web-dist/assets/_pathlessLayout-DoBLI2ja.js +132 -0
  6. package/dist/web-dist/assets/_pathlessLayout-DoBLI2ja.js.map +1 -0
  7. package/dist/web-dist/assets/_queryId-Chj34V6b.js +1 -0
  8. package/dist/web-dist/assets/{_queryId-Bq64AuuI.js.map → _queryId-Chj34V6b.js.map} +1 -1
  9. package/dist/web-dist/assets/{_table-Bt9of1on.js → _table-Bg4NvAi4.js} +1 -1
  10. package/dist/web-dist/assets/{_table-Bt9of1on.js.map → _table-Bg4NvAi4.js.map} +1 -1
  11. package/dist/web-dist/assets/_table-CHFe8v3q.js +1 -0
  12. package/dist/web-dist/assets/{_table-CQhKMAcZ.js.map → _table-CHFe8v3q.js.map} +1 -1
  13. package/dist/web-dist/assets/ai-assistant-D2oc4TtC.js +1 -0
  14. package/dist/web-dist/assets/ai-assistant-D2oc4TtC.js.map +1 -0
  15. package/dist/web-dist/assets/browser-B3ZulIJb.js +1 -0
  16. package/dist/web-dist/assets/{browser-CFsrLhq1.js.map → browser-B3ZulIJb.js.map} +1 -1
  17. package/dist/web-dist/assets/code-editor-q3FlZk-L.js +9 -0
  18. package/dist/web-dist/assets/code-editor-q3FlZk-L.js.map +1 -0
  19. package/dist/web-dist/assets/database.store-O79u8Fhj.js +1 -0
  20. package/dist/web-dist/assets/database.store-O79u8Fhj.js.map +1 -0
  21. package/dist/web-dist/assets/{dist-B90HBock.js → dist-DBHqGKiG.js} +1 -1
  22. package/dist/web-dist/assets/{dist-B90HBock.js.map → dist-DBHqGKiG.js.map} +1 -1
  23. package/dist/web-dist/assets/{highlighted-body-OFNGDK62-BGFI1Y6G.js → highlighted-body-OFNGDK62-CFFJC4SW.js} +1 -1
  24. package/dist/web-dist/assets/{highlighted-body-OFNGDK62-BGFI1Y6G.js.map → highlighted-body-OFNGDK62-CFFJC4SW.js.map} +1 -1
  25. package/dist/web-dist/assets/icons-CtpwLWUI.js +1 -0
  26. package/dist/web-dist/assets/icons-CtpwLWUI.js.map +1 -0
  27. package/dist/web-dist/assets/index-Cyl_0l9I.css +2 -0
  28. package/dist/web-dist/assets/index-XoXxezo4.js +35 -0
  29. package/dist/web-dist/assets/index-XoXxezo4.js.map +1 -0
  30. package/dist/web-dist/assets/{indexes-BKOZUa9Z.js → indexes-C9QqJKhp.js} +1 -1
  31. package/dist/web-dist/assets/{indexes-BKOZUa9Z.js.map → indexes-C9QqJKhp.js.map} +1 -1
  32. package/dist/web-dist/assets/{logs-DHha3vDy.js → logs-B8ah8F7D.js} +1 -1
  33. package/dist/web-dist/assets/{logs-DHha3vDy.js.map → logs-B8ah8F7D.js.map} +1 -1
  34. package/dist/web-dist/assets/mermaid-GHXKKRXX-TpVEoP0K.js +1 -0
  35. package/dist/web-dist/assets/middleware-CCyr6cvp.js +1 -0
  36. package/dist/web-dist/assets/middleware-CCyr6cvp.js.map +1 -0
  37. package/dist/web-dist/assets/popover-wbdw6Hmx.js +1 -0
  38. package/dist/web-dist/assets/popover-wbdw6Hmx.js.map +1 -0
  39. package/dist/web-dist/assets/queries.store-CoJVGJKk.js +1 -0
  40. package/dist/web-dist/assets/queries.store-CoJVGJKk.js.map +1 -0
  41. package/dist/web-dist/assets/query-runner-Bgs0j50a.js +17 -0
  42. package/dist/web-dist/assets/query-runner-Bgs0j50a.js.map +1 -0
  43. package/dist/web-dist/assets/radix-ui-CgJOuzDv.js +51 -0
  44. package/dist/web-dist/assets/radix-ui-CgJOuzDv.js.map +1 -0
  45. package/dist/web-dist/assets/react-Cxb6eTZp.js +1 -0
  46. package/dist/web-dist/assets/react-Cxb6eTZp.js.map +1 -0
  47. package/dist/web-dist/assets/{react-dom-0lXVP1OR.js → react-dom-yg5bT29P.js} +1 -1
  48. package/dist/web-dist/assets/{react-dom-0lXVP1OR.js.map → react-dom-yg5bT29P.js.map} +1 -1
  49. package/dist/web-dist/assets/redis-value-COa6YzFD.js +1 -0
  50. package/dist/web-dist/assets/{redis-value-CJoRCZun.js.map → redis-value-COa6YzFD.js.map} +1 -1
  51. package/dist/web-dist/assets/runner-DW5iXMmq.js +1 -0
  52. package/dist/web-dist/assets/{runner-CZKDzRoU.js.map → runner-DW5iXMmq.js.map} +1 -1
  53. package/dist/web-dist/assets/schema-CtOicTEt.js +64 -0
  54. package/dist/web-dist/assets/schema-CtOicTEt.js.map +1 -0
  55. package/dist/web-dist/assets/{schema-0sozVL-z.js → schema-oy5o_4bt.js} +1 -1
  56. package/dist/web-dist/assets/{schema-0sozVL-z.js.map → schema-oy5o_4bt.js.map} +1 -1
  57. package/dist/web-dist/assets/{table-CPQhgD-a.js → table-CN9ZTCOi.js} +1 -1
  58. package/dist/web-dist/assets/{table-CPQhgD-a.js.map → table-CN9ZTCOi.js.map} +1 -1
  59. package/dist/web-dist/assets/tanstack-g1w0v_rJ.js +10 -0
  60. package/dist/web-dist/assets/tanstack-g1w0v_rJ.js.map +1 -0
  61. package/dist/web-dist/assets/tooltip-B7gM8xl3.js +9 -0
  62. package/dist/web-dist/assets/tooltip-B7gM8xl3.js.map +1 -0
  63. package/dist/web-dist/assets/{visualizer-DTPn0ywW.js → visualizer-DcEwqmuY.js} +1 -1
  64. package/dist/web-dist/assets/{visualizer-DTPn0ywW.js.map → visualizer-DcEwqmuY.js.map} +1 -1
  65. package/dist/web-dist/index.html +13 -11
  66. package/package.json +1 -1
  67. package/dist/web-dist/assets/_pathlessLayout-CEv6uosT.js +0 -1
  68. package/dist/web-dist/assets/_pathlessLayout-eo6iLvBo.js +0 -132
  69. package/dist/web-dist/assets/_pathlessLayout-eo6iLvBo.js.map +0 -1
  70. package/dist/web-dist/assets/_queryId-Bq64AuuI.js +0 -1
  71. package/dist/web-dist/assets/_table-CQhKMAcZ.js +0 -1
  72. package/dist/web-dist/assets/browser-CFsrLhq1.js +0 -1
  73. package/dist/web-dist/assets/code-editor-DQ86aZkm.js +0 -9
  74. package/dist/web-dist/assets/code-editor-DQ86aZkm.js.map +0 -1
  75. package/dist/web-dist/assets/database.store-KDHkiedw.js +0 -1
  76. package/dist/web-dist/assets/database.store-KDHkiedw.js.map +0 -1
  77. package/dist/web-dist/assets/icons-Bm7rSZLJ.js +0 -1
  78. package/dist/web-dist/assets/icons-Bm7rSZLJ.js.map +0 -1
  79. package/dist/web-dist/assets/index-BtqHnOp0.js +0 -23
  80. package/dist/web-dist/assets/index-BtqHnOp0.js.map +0 -1
  81. package/dist/web-dist/assets/index-ktDWx_UP.css +0 -2
  82. package/dist/web-dist/assets/mermaid-GHXKKRXX-DjR37lQN.js +0 -1
  83. package/dist/web-dist/assets/popover-Cm3PsrMh.js +0 -1
  84. package/dist/web-dist/assets/popover-Cm3PsrMh.js.map +0 -1
  85. package/dist/web-dist/assets/query-runner-6BhVPaC9.js +0 -9
  86. package/dist/web-dist/assets/query-runner-6BhVPaC9.js.map +0 -1
  87. package/dist/web-dist/assets/radix-ui-BUv2Nuc1.js +0 -51
  88. package/dist/web-dist/assets/radix-ui-BUv2Nuc1.js.map +0 -1
  89. package/dist/web-dist/assets/redis-value-CJoRCZun.js +0 -1
  90. package/dist/web-dist/assets/runner-CZKDzRoU.js +0 -1
  91. package/dist/web-dist/assets/schema-cZHeTHA0.js +0 -64
  92. package/dist/web-dist/assets/schema-cZHeTHA0.js.map +0 -1
  93. package/dist/web-dist/assets/tanstack-D6l4LIt3.js +0 -10
  94. package/dist/web-dist/assets/tanstack-D6l4LIt3.js.map +0 -1
  95. package/dist/web-dist/assets/toggle-group-BRWnLosM.js +0 -1
  96. package/dist/web-dist/assets/toggle-group-BRWnLosM.js.map +0 -1
  97. package/dist/web-d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AI,iBACJ,KAAM,iBACN,mBAAsB,EACxB,CAAQ,EAuMJ,GAA2D,CACnC,8BACA,8BACH,2BACM,iCACL,4BACQ,iCA3MlC,GAAuC,OAAO,CAC5C,GAAI,mBACJ,KAAM,mBACN,mBAAsB,EACxB,CAuMkC,EACF,kCACD,iCACC,kCACA,kCACD,gCACjC,EAMM,GAAuC,CAC3C,oBALsC,GAAoB,iBAC1D,EAIqB,CACvB,EACa,GAAY,GACtB,iBAAiB,EAAiB,EAClC,cAA8B,EClS3B,GAAS,GAAa,CAC3B,aACA,QAAS,CACR,YAAa,GAAe,CAC7B,EACA,eAAgB,SAChB,kBAAmB,GACnB,yBAA0B,EAC3B,CAAC,EAUK,GAAc,SAAS,eAAe,MAAM,EAClD,GAAI,IAAe,CAAC,GAAY,UAAW,CAC1C,MAAM,KAAgB,WAAW,EAAW,EACtC,EAAc,GAAe,EAEnC,EAAK,UACJ,OAAC,aAAD,aACC,OAAC,GAAD,CAAqB,OAAQ,EAC5B,mBAAC,GAAD,CAAwB,SAAS,EACb,EACV,EACb,CACD","names":["M","x","U","z","createContext","createElement","useContext","useCallback","useRef","useSyncExternalStore","emitter","useState","useMemo","useId","enUS","defaultLocale","re","dateFnsEnUS","Root","components","defaultFormatters","defaultLabels","defaultLabels.labelDayButton","defaultLabels.labelMonthDropdown","defaultLabels.labelNext","defaultLabels.labelPrevious","defaultLabels.labelWeekNumber","defaultLabels.labelYearDropdown","defaultLabels.labelGrid","defaultLabels.labelGridcell","defaultLabels.labelNav","defaultLabels.labelWeekNumberHeader","defaultLabels.labelWeekday","getWeekFn","getISOWeekFn","differenceInCalendarDaysFn","differenceInCalendarMonthsFn","targetMonth","useLayoutEffect","useEffect","setter","DialogPrimitive.Root","DialogPrimitive.Overlay","DialogPrimitive.Content","DialogPrimitive.Portal","Drawer","DialogPrimitive.Trigger","DialogPrimitive.Close","DialogPrimitive.Title","DialogPrimitive.Description","j","W","K","X","I","A","h","initialState","Context","reducer","useReducer","_excluded","_excluded2","_excluded3","_excluded4","_excluded5","_excluded6","_excluded7","_excluded8","_excluded9","Quote","ValueQuote","Colon","Arrow","Fragment","Copied","Date","Map","Set","Route","createFileRoute","component","lazyRouteComponent","$$splitComponentImporter","validateSearch","search","cmd"],"ignoreList":[1,3,4,5,6,7,8,18,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,202,204,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263],"sources":["../../src/lib/query-client.ts","../../../../node_modules/.bun/next-themes@0.4.6+21ccd8898788a04d/node_modules/next-themes/dist/index.mjs","../../../ui/src/primitives/sonner.tsx","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/context-C4spomkL.js","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/debounce-PSGthE_7.js","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/compare-Br3z3FUS.js","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/key-isolation-Y_bk4Yva.js","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/patch-history-CLy38Aj7.js","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/adapters/react.js","../../../ui/src/primitives/alert.tsx","../../../ui/src/primitives/select.tsx","../../src/features/table-builder/components/add-foreign-key/col-name-field.tsx","../../src/features/table-builder/components/add-foreign-key/referenced-col-field.tsx","../../src/features/table-builder/components/add-foreign-key/remove-action-selector.tsx","../../src/features/table-builder/components/add-foreign-key/update-action-selector.tsx","../../src/features/table-builder/components/add-foreign-key/foreign-key-selector-field.tsx","../../src/features/tables/hooks/use-delete-table.ts","../../src/features/tables/hooks/use-export-file.ts","../../../../node_modules/.bun/nuqs@2.8.9+2dad780bf8cc737c/node_modules/nuqs/dist/index.js","../../src/features/tables/hooks/use-tables-list.ts","../../src/features/records/hooks/use-create-record.ts","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/constants.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/constructFrom.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/toDate.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/addDays.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/addMonths.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfDay.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/addWeeks.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/addYears.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/max.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/min.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isSameDay.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isDate.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isValid.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarMonths.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/endOfMonth.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeInterval.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/eachMonthOfInterval.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfMonth.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/endOfYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/eachYearOfInterval.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/endOfWeek.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/endOfISOWeek.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/match.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getWeek.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/format.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getDaysInMonth.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getMonth.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isAfter.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isBefore.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isSameMonth.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isSameYear.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/setMonth.js","../../../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/setYear.js","../../../../node_modules/.bun/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js","../../../../node_modules/.bun/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js","../../../../node_modules/.bun/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js","../../../../node_modules/.bun/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/locale/en-US.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/classes/DateLib.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Chevron.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Day.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/DayButton.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/UI.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/useDayPicker.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Dropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/DropdownNav.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Footer.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Month.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/MonthCaption.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/MonthGrid.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Months.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Nav.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Option.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Root.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Select.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Week.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Weekday.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Weekdays.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/WeekNumber.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/Weeks.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/typeguards.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getComponents.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatDay.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelGrid.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelNav.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelNext.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getLabels.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/noonDateLib.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/useAnimation.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getDates.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getDays.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getMonths.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/useCalendar.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/useFocus.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/selection/useMulti.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/addToRange.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/selection/useRange.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/selection/useSingle.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/useSelection.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js","../../../../node_modules/.bun/react-day-picker@10.0.1+b2e33729a97476bf/node_modules/react-day-picker/dist/esm/DayPicker.js","../../../ui/src/primitives/calendar.tsx","../../../ui/src/primitives/scroll-area.tsx","../../../ui/src/primitives/date-picker.tsx","../../src/features/records/stores/record-reference.store.ts","../../src/features/records/components/add-record-field.tsx","../../../ui/src/primitives/table.tsx","../../src/features/tables/hooks/use-table-data.ts","../../../ui/src/primitives/kbd.tsx","../../src/features/records/components/referenced-table-filter-popup.tsx","../../../ui/src/primitives/switch.tsx","../../src/features/records/components/referenced-table-sort-popup.tsx","../../src/features/records/components/referenced-table.tsx","../../src/features/records/components/record-reference-sheet.tsx","../../src/features/records/components/add-record-form.tsx","../../../ui/src/primitives/tabs.tsx","../../src/utils/parse-bulk-data.ts","../../src/features/records/hooks/use-bulk-insert-records.ts","../../src/features/records/components/bulk-insert-csv-sheet.tsx","../../src/features/records/components/bulk-insert-excel-sheet.tsx","../../src/features/records/components/bulk-insert-json-sheet.tsx","../../src/features/records/components/bulk-insert-sheet.tsx","../../../../node_modules/.bun/vaul@1.1.2+119c4f3973a6d299/node_modules/vaul/dist/index.mjs","../../../ui/src/primitives/drawer.tsx","../../../../node_modules/.bun/react-hotkeys-hook@5.3.0+21ccd8898788a04d/node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js","../../src/features/tables/stores/update-cell.store.ts","../../src/features/tables/components/fk-drawer-content.tsx","../../src/features/tables/components/table-cell-wrapper.tsx","../../src/features/tables/components/table-cell-variant.tsx","../../src/features/tables/components/table-cell.tsx","../../src/features/tables/components/table-selector.tsx","../../src/features/tables/hooks/use-table-model.ts","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/store/ShowTools.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/store/Expands.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/store/Types.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/arrow/TriangleArrow.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/store/Symbols.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/store/Section.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/store.js","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/index.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/comps/NestedClose.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/index.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/comps/Value.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/utils/useRender.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/section/KeyName.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/section/Row.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/utils/useHighlight.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/comps/Copied.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/comps/useIdCompat.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/comps/KeyValues.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/section/CountInfoExtra.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/section/CountInfo.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/section/Ellipsis.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/comps/NestedOpen.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/Container.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/BraceLeft.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/BraceRight.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/BracketsLeft.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/BracketsRight.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/Arrow.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/Colon.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/Quote.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/symbol/ValueQuote.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Bigint.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Date.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/False.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Float.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Int.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Map.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Nan.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Null.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Set.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/String.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/True.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Undefined.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/types/Url.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/section/Copied.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/index.js","../../../../node_modules/.bun/@uiw+react-json-view@2.0.0-alpha.42+b516bd5fbc99b055/node_modules/@uiw/react-json-view/esm/theme/vscode.js","../../../ui/src/primitives/pagination.tsx","../../../../node_modules/.bun/zustand@5.0.12+5e3d5174673d7dcb/node_modules/zustand/esm/middleware.mjs","../../src/stores/personal-preferences.store.ts","../../src/features/tables/components/table-footer.tsx","../../src/features/tables/components/table-document-view.tsx","../../src/features/tables/components/header/add-record-menu.tsx","../../src/routes/_pathlessLayout/table/$table.tsx","../../src/features/tables/hooks/use-update-cell.ts","../../src/features/tables/components/header/clear-btn.tsx","../../../ui/src/primitives/alert-dialog.tsx","../../src/features/tables/hooks/use-delete-cell.ts","../../src/features/tables/components/header/force-delete-dialog.tsx","../../src/features/tables/components/header/delete-btn.tsx","../../src/features/tables/components/header/filter-popup.tsx","../../src/features/tables/components/header/refetch-btn.tsx","../../src/features/tables/components/header/save-btn.tsx","../../src/features/tables/components/header/table-header.tsx","../../src/features/tables/components/table-empty-state.tsx","../../src/features/tables/components/table-error-state.tsx","../../src/features/tables/components/table-body-row.tsx","../../src/features/tables/components/table-body.tsx","../../src/features/tables/components/table-col-resizer.tsx","../../src/features/tables/components/table-head-row.tsx","../../src/features/tables/components/table-head.tsx","../../src/features/tables/components/table-container.tsx","../../src/features/tables/components/table-grid.tsx","../../src/features/tables/components/table-loading-state.tsx","../../src/features/tables/components/table-tab-container.tsx","../../src/features/tables/components/table-tab.tsx","../../src/features/tables/screens/table-screen.tsx","../../src/features/table-builder/components/add-foreign-key/referenced-table-field.tsx","../../src/features/table-builder/components/add-foreign-key/add-foreign-key-form.tsx","../../src/features/table-builder/components/field-row.tsx","../../src/features/table-builder/components/form-content.tsx","../../../ui/src/primitives/field.tsx","../../src/features/table-builder/components/table-name-field.tsx","../../src/features/table-builder/hooks/use-create-table.ts","../../src/features/table-builder/types.ts","../../src/features/table-builder/screens/table-builder-overlay.tsx","../../src/hooks/use-databases-list.ts","../../src/hooks/use-theme.ts","../../src/routes/__root.tsx","../../src/routes/_pathlessLayout.tsx","../../src/routes/_pathlessLayout/index.tsx","../../src/routes/_pathlessLayout/visualizer.tsx","../../src/routes/_pathlessLayout/logs.tsx","../../src/routes/_pathlessLayout/indexes.tsx","../../src/routes/_pathlessLayout/browser.tsx","../../src/routes/_pathlessLayout/table/index.tsx","../../src/routes/_pathlessLayout/schema/index.tsx","../../src/routes/_pathlessLayout/runner/index.tsx","../../src/routes/_pathlessLayout/schema/$table.tsx","../../src/routes/_pathlessLayout/runner/$queryId.tsx","../../src/routeTree.gen.ts","../../src/main.tsx"],"sourcesContent":["import { defaultShouldDehydrateQuery, QueryClient } from \"@tanstack/react-query\";\n\nlet clientQueryClientSingleton: QueryClient | undefined;\n\nconst createQueryClient = () => {\n\treturn new QueryClient({\n\t\tdefaultOptions: {\n\t\t\tqueries: {\n\t\t\t\tstaleTime: 30 * 1000, // 30 seconds\n\t\t\t\tgcTime: 5 * 60 * 1000, // 5 minutes (was cacheTime)\n\t\t\t\tretry: 0,\n\t\t\t\tretryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000),\n\t\t\t\trefetchOnWindowFocus: false, // refetch on window focus\n\t\t\t\trefetchOnMount: false, // refetch on mount\n\t\t\t\trefetchOnReconnect: true, // refetch on reconnect\n\t\t\t},\n\t\t\tmutations: {\n\t\t\t\tretry: 0,\n\t\t\t\t// retryDelay: 1000, // retry delay 1 second\n\t\t\t\tnetworkMode: \"online\", // Only run mutations while online\n\t\t\t},\n\n\t\t\tdehydrate: {\n\t\t\t\tshouldDehydrateQuery: (query) =>\n\t\t\t\t\tdefaultShouldDehydrateQuery(query) || query.state.status === \"pending\",\n\t\t\t},\n\t\t},\n\t});\n};\n\nexport const getQueryClient = () => {\n\tif (typeof window === \"undefined\") {\n\t\t// Server-side: always create a new client\n\t\treturn createQueryClient();\n\t}\n\n\t// Client-side: use singleton pattern\n\tif (!clientQueryClientSingleton) {\n\t\tclientQueryClientSingleton = createQueryClient();\n\t}\n\n\treturn clientQueryClientSingleton;\n};\n","\"use client\";import*as t from\"react\";var M=(e,i,s,u,m,a,l,h)=>{let d=document.documentElement,w=[\"light\",\"dark\"];function p(n){(Array.isArray(e)?e:[e]).forEach(y=>{let k=y===\"class\",S=k&&a?m.map(f=>a[f]||f):m;k?(d.classList.remove(...S),d.classList.add(a&&a[n]?a[n]:n)):d.setAttribute(y,n)}),R(n)}function R(n){h&&w.includes(n)&&(d.style.colorScheme=n)}function c(){return window.matchMedia(\"(prefers-color-scheme: dark)\").matches?\"dark\":\"light\"}if(u)p(u);else try{let n=localStorage.getItem(i)||s,y=l&&n===\"system\"?c():n;p(y)}catch(n){}};var b=[\"light\",\"dark\"],I=\"(prefers-color-scheme: dark)\",O=typeof window==\"undefined\",x=t.createContext(void 0),U={setTheme:e=>{},themes:[]},z=()=>{var e;return(e=t.useContext(x))!=null?e:U},J=e=>t.useContext(x)?t.createElement(t.Fragment,null,e.children):t.createElement(V,{...e}),N=[\"light\",\"dark\"],V=({forcedTheme:e,disableTransitionOnChange:i=!1,enableSystem:s=!0,enableColorScheme:u=!0,storageKey:m=\"theme\",themes:a=N,defaultTheme:l=s?\"system\":\"light\",attribute:h=\"data-theme\",value:d,children:w,nonce:p,scriptProps:R})=>{let[c,n]=t.useState(()=>H(m,l)),[T,y]=t.useState(()=>c===\"system\"?E():c),k=d?Object.values(d):a,S=t.useCallback(o=>{let r=o;if(!r)return;o===\"system\"&&s&&(r=E());let v=d?d[r]:r,C=i?W(p):null,P=document.documentElement,L=g=>{g===\"class\"?(P.classList.remove(...k),v&&P.classList.add(v)):g.startsWith(\"data-\")&&(v?P.setAttribute(g,v):P.removeAttribute(g))};if(Array.isArray(h)?h.forEach(L):L(h),u){let g=b.includes(l)?l:null,D=b.includes(r)?r:g;P.style.colorScheme=D}C==null||C()},[p]),f=t.useCallback(o=>{let r=typeof o==\"function\"?o(c):o;n(r);try{localStorage.setItem(m,r)}catch(v){}},[c]),A=t.useCallback(o=>{let r=E(o);y(r),c===\"system\"&&s&&!e&&S(\"system\")},[c,e]);t.useEffect(()=>{let o=window.matchMedia(I);return o.addListener(A),A(o),()=>o.removeListener(A)},[A]),t.useEffect(()=>{let o=r=>{r.key===m&&(r.newValue?n(r.newValue):f(l))};return window.addEventListener(\"storage\",o),()=>window.removeEventListener(\"storage\",o)},[f]),t.useEffect(()=>{S(e!=null?e:c)},[e,c]);let Q=t.useMemo(()=>({theme:c,setTheme:f,forcedTheme:e,resolvedTheme:c===\"system\"?T:c,themes:s?[...a,\"system\"]:a,systemTheme:s?T:void 0}),[c,f,e,T,s,a]);return t.createElement(x.Provider,{value:Q},t.createElement(_,{forcedTheme:e,storageKey:m,attribute:h,enableSystem:s,enableColorScheme:u,defaultTheme:l,value:d,themes:a,nonce:p,scriptProps:R}),w)},_=t.memo(({forcedTheme:e,storageKey:i,attribute:s,enableSystem:u,enableColorScheme:m,defaultTheme:a,value:l,themes:h,nonce:d,scriptProps:w})=>{let p=JSON.stringify([s,i,a,e,h,l,u,m]).slice(1,-1);return t.createElement(\"script\",{...w,suppressHydrationWarning:!0,nonce:typeof window==\"undefined\"?d:\"\",dangerouslySetInnerHTML:{__html:`(${M.toString()})(${p})`}})}),H=(e,i)=>{if(O)return;let s;try{s=localStorage.getItem(e)||void 0}catch(u){}return s||i},W=e=>{let i=document.createElement(\"style\");return e&&i.setAttribute(\"nonce\",e),i.appendChild(document.createTextNode(\"*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}\")),document.head.appendChild(i),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(i)},1)}},E=e=>(e||(e=window.matchMedia(I)),e.matches?\"dark\":\"light\");export{J as ThemeProvider,z as useTheme};\n","import { CircleCheck, Info, Loader2, OctagonAlert, TriangleAlert } from \"lucide-react\";\nimport { useTheme } from \"next-themes\";\nimport { Toaster as Sonner, type ToasterProps } from \"sonner\";\n\nconst Toaster = ({ ...props }: ToasterProps) => {\n\tconst { theme = \"system\" } = useTheme();\n\n\treturn (\n\t\t<Sonner\n\t\t\ttheme={theme as ToasterProps[\"theme\"]}\n\t\t\tclassName=\"toaster group\"\n\t\t\ticons={{\n\t\t\t\tsuccess: <CircleCheck className=\"size-4 text-emerald-500\" />,\n\t\t\t\tinfo: <Info className=\"size-4 text-blue-500\" />,\n\t\t\t\twarning: <TriangleAlert className=\"size-4 text-amber-500\" />,\n\t\t\t\terror: <OctagonAlert className=\"size-4 text-red-500\" />,\n\t\t\t\tloading: <Loader2 className=\"size-4 animate-spin text-blue-500\" />,\n\t\t\t}}\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\t\"--normal-bg\": \"var(--popover)\",\n\t\t\t\t\t\"--normal-text\": \"var(--popover-foreground)\",\n\t\t\t\t\t\"--normal-border\": \"var(--border)\",\n\t\t\t\t\t\"--border-radius\": \"var(--radius)\",\n\t\t\t\t} as React.CSSProperties\n\t\t\t}\n\t\t\ttoastOptions={{\n\t\t\t\tclassNames: {\n\t\t\t\t\ttoast: \"cn-toast\",\n\t\t\t\t},\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\n\nexport { Toaster };\n","import { createContext, createElement, useContext } from \"react\";\n\n//#region src/lib/debug.ts\nconst debugEnabled = isDebugEnabled();\nfunction debug(message, ...args) {\n\tif (!debugEnabled) return;\n\tconst msg = sprintf(message, ...args);\n\tperformance.mark(msg);\n\ttry {\n\t\tconsole.log(message, ...args);\n\t} catch {\n\t\tconsole.log(msg);\n\t}\n}\nfunction warn(message, ...args) {\n\tif (!debugEnabled) return;\n\tconsole.warn(message, ...args);\n}\nfunction sprintf(base, ...args) {\n\treturn base.replace(/%[sfdO]/g, (match) => {\n\t\tconst arg = args.shift();\n\t\treturn match === \"%O\" && arg ? JSON.stringify(arg).replace(/\"([^\"]+)\":/g, \"$1:\") : String(arg);\n\t});\n}\nfunction isDebugEnabled() {\n\tif (typeof window === \"undefined\") return (process.env.DEBUG || \"\").includes(\"nuqs\");\n\ttry {\n\t\tconst test = \"nuqs-localStorage-test\";\n\t\tif (typeof localStorage === \"undefined\") return false;\n\t\tlocalStorage.setItem(test, test);\n\t\tconst isStorageAvailable = localStorage.getItem(test) === test;\n\t\tlocalStorage.removeItem(test);\n\t\treturn isStorageAvailable && (localStorage.getItem(\"debug\") || \"\").includes(\"nuqs\");\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n//#endregion\n//#region src/lib/errors.ts\nconst errors = {\n\t303: \"Multiple adapter contexts detected. This might happen in monorepos.\",\n\t404: \"nuqs requires an adapter to work with your framework.\",\n\t409: \"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.\",\n\t414: \"Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.\",\n\t422: \"Invalid options combination: `limitUrlUpdates: debounce` should be used in SSR scenarios, with `shallow: false`\",\n\t429: \"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O\",\n\t500: \"Empty search params cache. Search params can't be accessed in Layouts.\",\n\t501: \"Search params cache already populated. Have you called `parse` twice?\"\n};\nfunction error(code) {\n\treturn `[nuqs] ${errors[code]}\n See https://nuqs.dev/NUQS-${code}`;\n}\n\n//#endregion\n//#region src/lib/url-encoding.ts\nfunction renderQueryString(search) {\n\tif (search.size === 0) return \"\";\n\tconst query = [];\n\tfor (const [key, value] of search.entries()) {\n\t\tconst safeKey = key.replace(/#/g, \"%23\").replace(/&/g, \"%26\").replace(/\\+/g, \"%2B\").replace(/=/g, \"%3D\").replace(/\\?/g, \"%3F\");\n\t\tquery.push(`${safeKey}=${encodeQueryValue(value)}`);\n\t}\n\tconst queryString = \"?\" + query.join(\"&\");\n\twarnIfURLIsTooLong(queryString);\n\treturn queryString;\n}\nfunction encodeQueryValue(input) {\n\treturn input.replace(/%/g, \"%25\").replace(/\\+/g, \"%2B\").replace(/ /g, \"+\").replace(/#/g, \"%23\").replace(/&/g, \"%26\").replace(/\"/g, \"%22\").replace(/'/g, \"%27\").replace(/`/g, \"%60\").replace(/</g, \"%3C\").replace(/>/g, \"%3E\").replace(/[\\x00-\\x1F]/g, (char) => encodeURIComponent(char));\n}\nconst URL_MAX_LENGTH = 2e3;\nfunction warnIfURLIsTooLong(queryString) {\n\tif (process.env.NODE_ENV === \"production\") return;\n\tif (typeof location === \"undefined\") return;\n\tconst url = new URL(location.href);\n\turl.search = queryString;\n\tif (url.href.length > URL_MAX_LENGTH) console.warn(error(414));\n}\n\n//#endregion\n//#region src/adapters/lib/context.ts\nconst context = createContext({ useAdapter() {\n\tthrow new Error(error(404));\n} });\ncontext.displayName = \"NuqsAdapterContext\";\nif (debugEnabled && typeof window !== \"undefined\") {\n\tif (window.__NuqsAdapterContext && window.__NuqsAdapterContext !== context) console.error(error(303));\n\twindow.__NuqsAdapterContext = context;\n}\n/**\n* Create a custom adapter (context provider) for nuqs to work with your framework / router.\n*\n* Adapters are based on React Context,\n*\n* @param useAdapter\n* @returns\n*/\nfunction createAdapterProvider(useAdapter) {\n\treturn ({ children, defaultOptions, processUrlSearchParams, ...props }) => createElement(context.Provider, {\n\t\t...props,\n\t\tvalue: {\n\t\t\tuseAdapter,\n\t\t\tdefaultOptions,\n\t\t\tprocessUrlSearchParams\n\t\t}\n\t}, children);\n}\nfunction useAdapter(watchKeys) {\n\tconst value = useContext(context);\n\tif (!(\"useAdapter\" in value)) throw new Error(error(404));\n\treturn value.useAdapter(watchKeys);\n}\nconst useAdapterDefaultOptions = () => useContext(context).defaultOptions;\nconst useAdapterProcessUrlSearchParams = () => useContext(context).processUrlSearchParams;\n\n//#endregion\nexport { useAdapterProcessUrlSearchParams as a, debug as c, useAdapterDefaultOptions as i, warn as l, createAdapterProvider as n, renderQueryString as o, useAdapter as r, error as s, context as t };\n//# sourceMappingURL=context-C4spomkL.js.map","import { c as debug, s as error } from \"./context-C4spomkL.js\";\nimport { useCallback, useRef, useSyncExternalStore } from \"react\";\n\n//#region src/lib/queues/rate-limiting.ts\nfunction getDefaultThrottle() {\n\tif (typeof window === \"undefined\") return 50;\n\tif (!Boolean(window.GestureEvent)) return 50;\n\ttry {\n\t\tconst match = navigator.userAgent?.match(/version\\/([\\d\\.]+) safari/i);\n\t\treturn parseFloat(match[1]) >= 17 ? 120 : 320;\n\t} catch {\n\t\treturn 320;\n\t}\n}\nfunction throttle(timeMs) {\n\treturn {\n\t\tmethod: \"throttle\",\n\t\ttimeMs\n\t};\n}\nfunction debounce(timeMs) {\n\treturn {\n\t\tmethod: \"debounce\",\n\t\ttimeMs\n\t};\n}\nconst defaultRateLimit = throttle(getDefaultThrottle());\n\n//#endregion\n//#region src/lib/search-params.ts\nfunction isAbsentFromUrl(query) {\n\treturn query === null || Array.isArray(query) && query.length === 0;\n}\nfunction write(serialized, key, searchParams) {\n\tif (typeof serialized === \"string\") searchParams.set(key, serialized);\n\telse {\n\t\tsearchParams.delete(key);\n\t\tfor (const v of serialized) searchParams.append(key, v);\n\t\tif (!searchParams.has(key)) searchParams.set(key, \"\");\n\t}\n\treturn searchParams;\n}\n\n//#endregion\n//#region src/lib/emitter.ts\nfunction createEmitter() {\n\tconst all = /* @__PURE__ */ new Map();\n\treturn {\n\t\ton(type, handler) {\n\t\t\tconst handlers = all.get(type) || [];\n\t\t\thandlers.push(handler);\n\t\t\tall.set(type, handlers);\n\t\t\treturn () => this.off(type, handler);\n\t\t},\n\t\toff(type, handler) {\n\t\t\tconst handlers = all.get(type);\n\t\t\tif (handlers) all.set(type, handlers.filter((h) => h !== handler));\n\t\t},\n\t\temit(type, event) {\n\t\t\tall.get(type)?.forEach((handler) => handler(event));\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/lib/timeout.ts\nfunction timeout(callback, ms, signal) {\n\tfunction onTick() {\n\t\tcallback();\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t}\n\tconst id = setTimeout(onTick, ms);\n\tfunction onAbort() {\n\t\tclearTimeout(id);\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t}\n\tsignal.addEventListener(\"abort\", onAbort);\n}\n\n//#endregion\n//#region src/lib/with-resolvers.ts\nfunction withResolvers() {\n\tconst P = Promise;\n\tif (Promise.hasOwnProperty(\"withResolvers\")) return Promise.withResolvers();\n\tlet resolve = () => {};\n\tlet reject = () => {};\n\treturn {\n\t\tpromise: new P((res, rej) => {\n\t\t\tresolve = res;\n\t\t\treject = rej;\n\t\t}),\n\t\tresolve,\n\t\treject\n\t};\n}\n\n//#endregion\n//#region src/lib/compose.ts\nfunction compose(fns, final) {\n\tlet next = final;\n\tfor (let i = fns.length - 1; i >= 0; i--) {\n\t\tconst fn = fns[i];\n\t\tif (!fn) continue;\n\t\tconst prev = next;\n\t\tnext = () => fn(prev);\n\t}\n\tnext();\n}\n\n//#endregion\n//#region src/lib/queues/throttle.ts\nfunction getSearchParamsSnapshotFromLocation() {\n\treturn new URLSearchParams(location.search);\n}\nvar ThrottledQueue = class {\n\tupdateMap = /* @__PURE__ */ new Map();\n\toptions = {\n\t\thistory: \"replace\",\n\t\tscroll: false,\n\t\tshallow: true\n\t};\n\ttimeMs = defaultRateLimit.timeMs;\n\ttransitions = /* @__PURE__ */ new Set();\n\tresolvers = null;\n\tcontroller = null;\n\tlastFlushedAt = 0;\n\tresetQueueOnNextPush = false;\n\tpush({ key, query, options }, timeMs = defaultRateLimit.timeMs) {\n\t\tif (this.resetQueueOnNextPush) {\n\t\t\tthis.reset();\n\t\t\tthis.resetQueueOnNextPush = false;\n\t\t}\n\t\tdebug(\"[nuqs gtq] Enqueueing %s=%s %O\", key, query, options);\n\t\tthis.updateMap.set(key, query);\n\t\tif (options.history === \"push\") this.options.history = \"push\";\n\t\tif (options.scroll) this.options.scroll = true;\n\t\tif (options.shallow === false) this.options.shallow = false;\n\t\tif (options.startTransition) this.transitions.add(options.startTransition);\n\t\tif (!Number.isFinite(this.timeMs) || timeMs > this.timeMs) this.timeMs = timeMs;\n\t}\n\tgetQueuedQuery(key) {\n\t\treturn this.updateMap.get(key);\n\t}\n\tgetPendingPromise({ getSearchParamsSnapshot = getSearchParamsSnapshotFromLocation }) {\n\t\treturn this.resolvers?.promise ?? Promise.resolve(getSearchParamsSnapshot());\n\t}\n\tflush({ getSearchParamsSnapshot = getSearchParamsSnapshotFromLocation, rateLimitFactor = 1, ...adapter }, processUrlSearchParams) {\n\t\tthis.controller ??= new AbortController();\n\t\tif (!Number.isFinite(this.timeMs)) {\n\t\t\tdebug(\"[nuqs gtq] Skipping flush due to throttleMs=Infinity\");\n\t\t\treturn Promise.resolve(getSearchParamsSnapshot());\n\t\t}\n\t\tif (this.resolvers) return this.resolvers.promise;\n\t\tthis.resolvers = withResolvers();\n\t\tconst flushNow = () => {\n\t\t\tthis.lastFlushedAt = performance.now();\n\t\t\tconst [search, error] = this.applyPendingUpdates({\n\t\t\t\t...adapter,\n\t\t\t\tautoResetQueueOnUpdate: adapter.autoResetQueueOnUpdate ?? true,\n\t\t\t\tgetSearchParamsSnapshot\n\t\t\t}, processUrlSearchParams);\n\t\t\tif (error === null) {\n\t\t\t\tthis.resolvers.resolve(search);\n\t\t\t\tthis.resetQueueOnNextPush = true;\n\t\t\t} else this.resolvers.reject(search);\n\t\t\tthis.resolvers = null;\n\t\t};\n\t\tconst runOnNextTick = () => {\n\t\t\tconst timeSinceLastFlush = performance.now() - this.lastFlushedAt;\n\t\t\tconst timeMs = this.timeMs;\n\t\t\tconst flushInMs = rateLimitFactor * Math.max(0, timeMs - timeSinceLastFlush);\n\t\t\tdebug(`[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)`, flushInMs, timeMs, rateLimitFactor);\n\t\t\tif (flushInMs === 0) flushNow();\n\t\t\telse timeout(flushNow, flushInMs, this.controller.signal);\n\t\t};\n\t\ttimeout(runOnNextTick, 0, this.controller.signal);\n\t\treturn this.resolvers.promise;\n\t}\n\tabort() {\n\t\tthis.controller?.abort();\n\t\tthis.controller = new AbortController();\n\t\tthis.resolvers?.resolve(new URLSearchParams());\n\t\tthis.resolvers = null;\n\t\treturn this.reset();\n\t}\n\treset() {\n\t\tconst queuedKeys = Array.from(this.updateMap.keys());\n\t\tdebug(\"[nuqs gtq] Resetting queue %s\", JSON.stringify(Object.fromEntries(this.updateMap)));\n\t\tthis.updateMap.clear();\n\t\tthis.transitions.clear();\n\t\tthis.options = {\n\t\t\thistory: \"replace\",\n\t\t\tscroll: false,\n\t\t\tshallow: true\n\t\t};\n\t\tthis.timeMs = defaultRateLimit.timeMs;\n\t\treturn queuedKeys;\n\t}\n\tapplyPendingUpdates(adapter, processUrlSearchParams) {\n\t\tconst { updateUrl, getSearchParamsSnapshot } = adapter;\n\t\tlet search = getSearchParamsSnapshot();\n\t\tdebug(`[nuqs gtq] Applying %d pending update(s) on top of %s`, this.updateMap.size, search.toString());\n\t\tif (this.updateMap.size === 0) return [search, null];\n\t\tconst items = Array.from(this.updateMap.entries());\n\t\tconst options = { ...this.options };\n\t\tconst transitions = Array.from(this.transitions);\n\t\tif (adapter.autoResetQueueOnUpdate) this.reset();\n\t\tdebug(\"[nuqs gtq] Flushing queue %O with options %O\", items, options);\n\t\tfor (const [key, value] of items) if (value === null) search.delete(key);\n\t\telse search = write(value, key, search);\n\t\tif (processUrlSearchParams) search = processUrlSearchParams(search);\n\t\ttry {\n\t\t\tcompose(transitions, () => {\n\t\t\t\tupdateUrl(search, options);\n\t\t\t});\n\t\t\treturn [search, null];\n\t\t} catch (err) {\n\t\t\tconsole.error(error(429), items.map(([key]) => key).join(), err);\n\t\t\treturn [search, err];\n\t\t}\n\t}\n};\nconst globalThrottleQueue = new ThrottledQueue();\n\n//#endregion\n//#region src/lib/queues/useSyncExternalStores.ts\n/**\n* Like `useSyncExternalStore`, but for subscribing to multiple keys.\n*\n* Each key becomes the key of the returned object,\n* and the value is the result of calling `getKeySnapshot` with that key.\n*\n* @param keys - A list of keys to subscribe to.\n* @param subscribeKey - A function that takes a key and a callback,\n* subscribes to an external store using that key (calling the callback when\n* state changes occur), and returns a function to unsubscribe from that key.\n* @param getKeySnapshot - A function that takes a key and returns the snapshot for that key.\n* It will be called on the server and on the client, so it needs to handle both\n* environments.\n*/\nfunction useSyncExternalStores(keys, subscribeKey, getKeySnapshot) {\n\tconst snapshot = useCallback(() => {\n\t\tconst record = Object.fromEntries(keys.map((key) => [key, getKeySnapshot(key)]));\n\t\treturn [JSON.stringify(record), record];\n\t}, [keys.join(\",\"), getKeySnapshot]);\n\tconst cacheRef = useRef(null);\n\tif (cacheRef.current === null) cacheRef.current = snapshot();\n\treturn useSyncExternalStore(useCallback((callback) => {\n\t\tconst off = keys.map((key) => subscribeKey(key, callback));\n\t\treturn () => off.forEach((unsubscribe) => unsubscribe());\n\t}, [keys.join(\",\"), subscribeKey]), () => {\n\t\tconst [cacheKey, record] = snapshot();\n\t\tif (cacheRef.current[0] === cacheKey) return cacheRef.current[1];\n\t\tcacheRef.current = [cacheKey, record];\n\t\treturn record;\n\t}, () => cacheRef.current[1]);\n}\n\n//#endregion\n//#region src/lib/queues/debounce.ts\nvar DebouncedPromiseQueue = class {\n\tcallback;\n\tresolvers = withResolvers();\n\tcontroller = new AbortController();\n\tqueuedValue = void 0;\n\tconstructor(callback) {\n\t\tthis.callback = callback;\n\t}\n\tabort() {\n\t\tthis.controller.abort();\n\t\tthis.queuedValue = void 0;\n\t}\n\tpush(value, timeMs) {\n\t\tthis.queuedValue = value;\n\t\tthis.controller.abort();\n\t\tthis.controller = new AbortController();\n\t\ttimeout(() => {\n\t\t\tconst outputResolvers = this.resolvers;\n\t\t\ttry {\n\t\t\t\tdebug(\"[nuqs dq] Flushing debounce queue\", value);\n\t\t\t\tconst callbackPromise = this.callback(value);\n\t\t\t\tdebug(\"[nuqs dq] Reset debounce queue %O\", this.queuedValue);\n\t\t\t\tthis.queuedValue = void 0;\n\t\t\t\tthis.resolvers = withResolvers();\n\t\t\t\tcallbackPromise.then((output) => outputResolvers.resolve(output)).catch((error) => outputResolvers.reject(error));\n\t\t\t} catch (error) {\n\t\t\t\tthis.queuedValue = void 0;\n\t\t\t\toutputResolvers.reject(error);\n\t\t\t}\n\t\t}, timeMs, this.controller.signal);\n\t\treturn this.resolvers.promise;\n\t}\n};\nvar DebounceController = class {\n\tthrottleQueue;\n\tqueues = /* @__PURE__ */ new Map();\n\tqueuedQuerySync = createEmitter();\n\tconstructor(throttleQueue = new ThrottledQueue()) {\n\t\tthis.throttleQueue = throttleQueue;\n\t}\n\tuseQueuedQueries(keys) {\n\t\treturn useSyncExternalStores(keys, (key, callback) => this.queuedQuerySync.on(key, callback), (key) => this.getQueuedQuery(key));\n\t}\n\tpush(update, timeMs, adapter, processUrlSearchParams) {\n\t\tif (!Number.isFinite(timeMs)) {\n\t\t\tconst getSnapshot = adapter.getSearchParamsSnapshot ?? getSearchParamsSnapshotFromLocation;\n\t\t\treturn Promise.resolve(getSnapshot());\n\t\t}\n\t\tconst key = update.key;\n\t\tif (!this.queues.has(key)) {\n\t\t\tdebug(\"[nuqs dqc] Creating debounce queue for `%s`\", key);\n\t\t\tconst queue = new DebouncedPromiseQueue((update) => {\n\t\t\t\tthis.throttleQueue.push(update);\n\t\t\t\treturn this.throttleQueue.flush(adapter, processUrlSearchParams).finally(() => {\n\t\t\t\t\tif (this.queues.get(update.key)?.queuedValue === void 0) {\n\t\t\t\t\t\tdebug(\"[nuqs dqc] Cleaning up empty queue for `%s`\", update.key);\n\t\t\t\t\t\tthis.queues.delete(update.key);\n\t\t\t\t\t}\n\t\t\t\t\tthis.queuedQuerySync.emit(update.key);\n\t\t\t\t});\n\t\t\t});\n\t\t\tthis.queues.set(key, queue);\n\t\t}\n\t\tdebug(\"[nuqs dqc] Enqueueing debounce update %O\", update);\n\t\tconst promise = this.queues.get(key).push(update, timeMs);\n\t\tthis.queuedQuerySync.emit(key);\n\t\treturn promise;\n\t}\n\tabort(key) {\n\t\tconst queue = this.queues.get(key);\n\t\tif (!queue) return (passThrough) => passThrough;\n\t\tdebug(\"[nuqs dqc] Aborting debounce queue %s=%s\", key, queue.queuedValue?.query);\n\t\tthis.queues.delete(key);\n\t\tqueue.abort();\n\t\tthis.queuedQuerySync.emit(key);\n\t\treturn (promise) => {\n\t\t\tpromise.then(queue.resolvers.resolve, queue.resolvers.reject);\n\t\t\treturn promise;\n\t\t};\n\t}\n\tabortAll() {\n\t\tfor (const [key, queue] of this.queues.entries()) {\n\t\t\tdebug(\"[nuqs dqc] Aborting debounce queue %s=%s\", key, queue.queuedValue?.query);\n\t\t\tqueue.abort();\n\t\t\tqueue.resolvers.resolve(new URLSearchParams());\n\t\t\tthis.queuedQuerySync.emit(key);\n\t\t}\n\t\tthis.queues.clear();\n\t}\n\tgetQueuedQuery(key) {\n\t\tconst debouncedQueued = this.queues.get(key)?.queuedValue?.query;\n\t\tif (debouncedQueued !== void 0) return debouncedQueued;\n\t\treturn this.throttleQueue.getQueuedQuery(key);\n\t}\n};\nconst debounceController = new DebounceController(globalThrottleQueue);\n\n//#endregion\nexport { write as a, throttle as c, isAbsentFromUrl as i, globalThrottleQueue as n, debounce as o, createEmitter as r, defaultRateLimit as s, debounceController as t };\n//# sourceMappingURL=debounce-PSGthE_7.js.map","//#region src/lib/compare.ts\nfunction compareQuery(a, b) {\n\tif (a === b) return true;\n\tif (a === null || b === null) return false;\n\tif (typeof a === \"string\" || typeof b === \"string\") return false;\n\tif (a.length !== b.length) return false;\n\treturn a.every((value, index) => value === b[index]);\n}\n\n//#endregion\nexport { compareQuery as t };\n//# sourceMappingURL=compare-Br3z3FUS.js.map","import { c as debug } from \"./context-C4spomkL.js\";\nimport { t as compareQuery } from \"./compare-Br3z3FUS.js\";\n\n//#region src/adapters/lib/key-isolation.ts\nfunction applyChange(newValue, keys, copy) {\n\treturn (oldValue) => {\n\t\tif (!(keys.length === 0 ? true : keys.some((key) => !compareQuery(oldValue.getAll(key), newValue.getAll(key))))) {\n\t\t\tdebug(\"[nuqs `%s`] no change, returning previous\", keys.join(\",\"), oldValue);\n\t\t\treturn oldValue;\n\t\t}\n\t\tconst filtered = filterSearchParams(newValue, keys, copy);\n\t\tdebug(`[nuqs \\`%s\\`] subbed search params change\n from %O\n to %O`, keys.join(\",\"), oldValue, filtered);\n\t\treturn filtered;\n\t};\n}\nfunction filterSearchParams(search, keys, copy) {\n\tif (keys.length === 0) return search;\n\tconst filtered = copy ? new URLSearchParams(search) : search;\n\tfor (const key of search.keys()) if (!keys.includes(key)) filtered.delete(key);\n\treturn filtered;\n}\n\n//#endregion\nexport { filterSearchParams as n, applyChange as t };\n//# sourceMappingURL=key-isolation-Y_bk4Yva.js.map","import { c as debug, s as error } from \"./context-C4spomkL.js\";\nimport { r as spinQueueResetMutex, t as resetQueues } from \"./reset-p1J0pPAX.js\";\n\n//#region src/adapters/lib/patch-history.ts\nconst historyUpdateMarker = \"__nuqs__\";\nfunction getSearchParams(url) {\n\tif (url instanceof URL) return url.searchParams;\n\tif (url.startsWith(\"?\")) return new URLSearchParams(url);\n\ttry {\n\t\treturn new URL(url, location.origin).searchParams;\n\t} catch {\n\t\treturn new URLSearchParams(url);\n\t}\n}\nfunction shouldPatchHistory(adapter) {\n\tif (typeof history === \"undefined\") return false;\n\tif (history.nuqs?.version && history.nuqs.version !== \"2.8.9\") {\n\t\tconsole.error(error(409), history.nuqs.version, `2.8.9`, adapter);\n\t\treturn false;\n\t}\n\tif (history.nuqs?.adapters?.includes(adapter)) return false;\n\treturn true;\n}\nfunction markHistoryAsPatched(adapter) {\n\thistory.nuqs = history.nuqs ?? {\n\t\tversion: \"2.8.9\",\n\t\tadapters: []\n\t};\n\thistory.nuqs.adapters.push(adapter);\n}\nfunction patchHistory(emitter, adapter) {\n\tif (!shouldPatchHistory(adapter)) return;\n\tlet lastSearchSeen = typeof location === \"object\" ? location.search : \"\";\n\temitter.on(\"update\", (search) => {\n\t\tconst searchString = search.toString();\n\t\tlastSearchSeen = searchString.length ? \"?\" + searchString : \"\";\n\t});\n\twindow.addEventListener(\"popstate\", () => {\n\t\tlastSearchSeen = location.search;\n\t\tresetQueues();\n\t});\n\tdebug(\"[nuqs %s] Patching history (%s adapter)\", \"2.8.9\", adapter);\n\tfunction sync(url) {\n\t\tspinQueueResetMutex();\n\t\ttry {\n\t\t\tif (new URL(url, location.origin).search === lastSearchSeen) return;\n\t\t} catch {}\n\t\ttry {\n\t\t\temitter.emit(\"update\", getSearchParams(url));\n\t\t} catch (e) {\n\t\t\tconsole.error(e);\n\t\t}\n\t}\n\tconst originalPushState = history.pushState;\n\tconst originalReplaceState = history.replaceState;\n\thistory.pushState = function nuqs_pushState(state, marker, url) {\n\t\toriginalPushState.call(history, state, \"\", url);\n\t\tif (url && marker !== historyUpdateMarker) sync(url);\n\t};\n\thistory.replaceState = function nuqs_replaceState(state, marker, url) {\n\t\toriginalReplaceState.call(history, state, \"\", url);\n\t\tif (url && marker !== historyUpdateMarker) sync(url);\n\t};\n\tmarkHistoryAsPatched(adapter);\n}\n\n//#endregion\nexport { shouldPatchHistory as i, markHistoryAsPatched as n, patchHistory as r, historyUpdateMarker as t };\n//# sourceMappingURL=patch-history-CLy38Aj7.js.map","'use client';\n\nimport { r as createEmitter } from \"../debounce-PSGthE_7.js\";\nimport { c as debug, n as createAdapterProvider, o as renderQueryString } from \"../context-C4spomkL.js\";\nimport { n as filterSearchParams, t as applyChange } from \"../key-isolation-Y_bk4Yva.js\";\nimport { r as patchHistory, t as historyUpdateMarker } from \"../patch-history-CLy38Aj7.js\";\nimport { createContext, createElement, useContext, useEffect, useMemo, useState } from \"react\";\n\n//#region src/adapters/react.ts\nconst emitter = createEmitter();\nfunction generateUpdateUrlFn(fullPageNavigationOnShallowFalseUpdates) {\n\treturn function updateUrl(search, options) {\n\t\tconst url = new URL(location.href);\n\t\turl.search = renderQueryString(search);\n\t\tdebug(\"[nuqs react] Updating url: %s\", url);\n\t\tif (fullPageNavigationOnShallowFalseUpdates && options.shallow === false) (options.history === \"push\" ? location.assign : location.replace).call(location, url);\n\t\telse (options.history === \"push\" ? history.pushState : history.replaceState).call(history, history.state, historyUpdateMarker, url);\n\t\temitter.emit(\"update\", search);\n\t\tif (options.scroll === true) window.scrollTo({ top: 0 });\n\t};\n}\nconst NuqsReactAdapterContext = createContext({ fullPageNavigationOnShallowFalseUpdates: false });\nfunction useNuqsReactAdapter(watchKeys) {\n\tconst { fullPageNavigationOnShallowFalseUpdates } = useContext(NuqsReactAdapterContext);\n\tconst [searchParams, setSearchParams] = useState(() => {\n\t\tif (typeof location === \"undefined\") return new URLSearchParams();\n\t\treturn filterSearchParams(new URLSearchParams(location.search), watchKeys, false);\n\t});\n\tuseEffect(() => {\n\t\tconst onPopState = () => {\n\t\t\tsetSearchParams(applyChange(new URLSearchParams(location.search), watchKeys, false));\n\t\t};\n\t\tconst onEmitterUpdate = (search) => {\n\t\t\tsetSearchParams(applyChange(search, watchKeys, true));\n\t\t};\n\t\temitter.on(\"update\", onEmitterUpdate);\n\t\twindow.addEventListener(\"popstate\", onPopState);\n\t\treturn () => {\n\t\t\temitter.off(\"update\", onEmitterUpdate);\n\t\t\twindow.removeEventListener(\"popstate\", onPopState);\n\t\t};\n\t}, [watchKeys.join(\"&\")]);\n\treturn {\n\t\tsearchParams,\n\t\tupdateUrl: useMemo(() => generateUpdateUrlFn(fullPageNavigationOnShallowFalseUpdates), [fullPageNavigationOnShallowFalseUpdates])\n\t};\n}\nconst NuqsReactAdapter = createAdapterProvider(useNuqsReactAdapter);\nfunction NuqsAdapter({ children, fullPageNavigationOnShallowFalseUpdates = false, ...adapterProps }) {\n\treturn createElement(NuqsReactAdapterContext.Provider, { value: { fullPageNavigationOnShallowFalseUpdates } }, createElement(NuqsReactAdapter, {\n\t\t...adapterProps,\n\t\tchildren\n\t}));\n}\n/**\n* Opt-in to syncing shallow updates of the URL with the useOptimisticSearchParams hook.\n*\n* By default, the useOptimisticSearchParams hook will only react to internal nuqs updates.\n* If third party code updates the History API directly, use this function to\n* enable useOptimisticSearchParams to react to those changes.\n*/\nfunction enableHistorySync() {\n\tpatchHistory(emitter, \"react\");\n}\n\n//#endregion\nexport { NuqsAdapter, enableHistorySync };\n//# sourceMappingURL=react.js.map","import type { LucideIcon } from \"lucide-react\";\nimport { CircleAlert, CircleCheckIcon, InfoIcon, TriangleAlert } from \"lucide-react\";\nimport { cn } from \"../utils\";\n\ntype AlertVariant = \"info\" | \"warning\" | \"error\" | \"success\";\n\ninterface AlertProps {\n\tvariant: AlertVariant;\n\ttitle: string;\n\tmessage?: string;\n\tclassName?: string;\n}\n\nconst alertConfig: Record<\n\tAlertVariant,\n\t{\n\t\ticon: LucideIcon;\n\t\tcontainerClass: string;\n\t\ticonClass: string;\n\t}\n> = {\n\tinfo: {\n\t\ticon: InfoIcon,\n\t\tcontainerClass: \"border-blue-500/50 bg-blue-50/50 text-blue-600 dark:bg-blue-950/20\",\n\t\ticonClass: \"text-blue-500\",\n\t},\n\twarning: {\n\t\ticon: TriangleAlert,\n\t\tcontainerClass: \"border-amber-500/50 bg-amber-50/50 text-amber-600 dark:bg-amber-950/20\",\n\t\ticonClass: \"text-amber-500\",\n\t},\n\terror: {\n\t\ticon: CircleAlert,\n\t\tcontainerClass: \"border-red-500/50 bg-red-50/50 text-red-600 dark:bg-red-950/20\",\n\t\ticonClass: \"text-red-500\",\n\t},\n\tsuccess: {\n\t\ticon: CircleCheckIcon,\n\t\tcontainerClass:\n\t\t\t\"border-emerald-500/50 bg-emerald-50/50 text-emerald-600 dark:bg-emerald-950/20\",\n\t\ticonClass: \"text-emerald-500\",\n\t},\n};\n\nexport const Alert = ({ variant, title, message, className }: AlertProps) => {\n\tconst config = alertConfig[variant];\n\tconst Icon = config.icon;\n\n\treturn (\n\t\t<div className={cn(\"rounded-md border px-4 py-3\", config.containerClass, className)}>\n\t\t\t<p className={cn(\"text-sm flex items-center gap-2\", message ? \"mb-1\" : \"\")}>\n\t\t\t\t<Icon\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName={cn(\"-mt-0.5 inline-flex opacity-80\", config.iconClass)}\n\t\t\t\t\tsize={16}\n\t\t\t\t/>\n\t\t\t\t<span className=\"font-medium\">{title}</span>\n\t\t\t</p>\n\t\t\t{message && <p className=\"text-xs opacity-90 ml-7\">{message}</p>}\n\t\t</div>\n\t);\n};\n","\"use client\";\n\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown, ChevronsUpDown, ChevronUp } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { cn } from \"../utils\";\n\nfunction Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {\n\treturn (\n\t\t<SelectPrimitive.Root\n\t\t\tdata-slot=\"select\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _SelectGroup({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n\treturn (\n\t\t<SelectPrimitive.Group\n\t\t\tdata-slot=\"select-group\"\n\t\t\tclassName={cn(\"scroll-my-1 p-1\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {\n\treturn (\n\t\t<SelectPrimitive.Value\n\t\t\tdata-slot=\"select-value\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SelectTrigger({\n\tclassName,\n\tsize = \"default\",\n\tvariant = \"default\",\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n\tsize?: \"sm\" | \"default\";\n\tvariant?: \"default\" | \"outline\";\n}) {\n\treturn (\n\t\t<SelectPrimitive.Trigger\n\t\t\tdata-slot=\"select-trigger\"\n\t\t\tdata-size={size}\n\t\t\tdata-variant={variant}\n\t\t\tclassName={cn(\n\t\t\t\t\"border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-sm border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n\t\t\t\tvariant === \"default\" && \"bg-input/20 dark:bg-input/30 dark:hover:bg-input/50\",\n\t\t\t\tvariant === \"outline\" && \"bg-transparent\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<SelectPrimitive.Icon asChild>\n\t\t\t\t<ChevronsUpDown className=\"text-muted-foreground size-3.5 pointer-events-none\" />\n\t\t\t</SelectPrimitive.Icon>\n\t\t</SelectPrimitive.Trigger>\n\t);\n}\n\nfunction SelectContent({\n\tclassName,\n\tchildren,\n\tposition = \"item-aligned\",\n\talign = \"center\",\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n\treturn (\n\t\t<SelectPrimitive.Portal>\n\t\t\t<SelectPrimitive.Content\n\t\t\t\tdata-slot=\"select-content\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto\",\n\t\t\t\t\tposition === \"popper\" &&\n\t\t\t\t\t\t\"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tposition={position}\n\t\t\t\talign={align}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<SelectScrollUpButton />\n\t\t\t\t<SelectPrimitive.Viewport\n\t\t\t\t\tdata-position={position}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]\",\n\t\t\t\t\t\tposition === \"popper\" && \"\",\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</SelectPrimitive.Viewport>\n\t\t\t\t<SelectScrollDownButton />\n\t\t\t</SelectPrimitive.Content>\n\t\t</SelectPrimitive.Portal>\n\t);\n}\n\nfunction _SelectLabel({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n\treturn (\n\t\t<SelectPrimitive.Label\n\t\t\tdata-slot=\"select-label\"\n\t\t\tclassName={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SelectItem({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n\treturn (\n\t\t<SelectPrimitive.Item\n\t\t\tdata-slot=\"select-item\"\n\t\t\tclassName={cn(\n\t\t\t\t\"focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-sm px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span className=\"pointer-events-none absolute right-2 flex items-center justify-center\">\n\t\t\t\t<SelectPrimitive.ItemIndicator>\n\t\t\t\t\t<Check className=\"pointer-events-none\" />\n\t\t\t\t</SelectPrimitive.ItemIndicator>\n\t\t\t</span>\n\t\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t\t</SelectPrimitive.Item>\n\t);\n}\n\nfunction _SelectSeparator({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n\treturn (\n\t\t<SelectPrimitive.Separator\n\t\t\tdata-slot=\"select-separator\"\n\t\t\tclassName={cn(\"bg-border/50 -mx-1 my-1 h-px pointer-events-none\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction SelectScrollUpButton({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n\treturn (\n\t\t<SelectPrimitive.ScrollUpButton\n\t\t\tdata-slot=\"select-scroll-up-button\"\n\t\t\tclassName={cn(\n\t\t\t\t\"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ChevronUp />\n\t\t</SelectPrimitive.ScrollUpButton>\n\t);\n}\n\nfunction SelectScrollDownButton({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n\treturn (\n\t\t<SelectPrimitive.ScrollDownButton\n\t\t\tdata-slot=\"select-scroll-down-button\"\n\t\t\tclassName={cn(\n\t\t\t\t\"bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ChevronDown />\n\t\t</SelectPrimitive.ScrollDownButton>\n\t);\n}\n\nexport {\n\t_SelectGroup as SelectGroup,\n\t_SelectLabel as SelectLabel,\n\t_SelectSeparator as SelectSeparator,\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n};\n","import {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\n\nexport const ColNameField = ({ index }: { index: number }) => {\n\tconst { control, watch } = useFormContext<AddTableFormData>();\n\tconst columns = watch(\"fields\")?.filter((column) => column.columnName?.trim());\n\tconst columnName = watch(`fields.${index}.columnName`);\n\n\treturn (\n\t\t<Controller\n\t\t\tcontrol={control}\n\t\t\tname={`foreignKeys.${index}`}\n\t\t\trender={({ field }) => (\n\t\t\t\t<div className=\"flex flex-col gap-2 flex-1\">\n\t\t\t\t\t<Select\n\t\t\t\t\t\tdefaultValue={columnName || \"none\"}\n\t\t\t\t\t\tvalue={field.value?.columnName}\n\t\t\t\t\t\tonValueChange={(value) => field.onChange({ ...field.value, columnName: value })}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectTrigger className=\"w-full flex-1\">\n\t\t\t\t\t\t\t<SelectValue\n\t\t\t\t\t\t\t\tplaceholder={columns?.length ? \"Select a column\" : \"No columns found\"}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t{columns?.length > 0 ? (\n\t\t\t\t\t\t\t\tcolumns.map((column) => (\n\t\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\t\tkey={column.columnName}\n\t\t\t\t\t\t\t\t\t\tvalue={column.columnName}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{column.columnName}\n\t\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tNo columns found\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t</Select>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Controller, useFormContext, useWatch } from \"react-hook-form\";\nimport { useTableCols } from \"@/features/schema\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\n\nexport const ReferencedColField = ({\n\tindex,\n\ttableName,\n}: {\n\tindex: number;\n\ttableName: string;\n}) => {\n\tconst { tableCols, isLoadingTableCols } = useTableCols({ tableName });\n\tconst { control } = useFormContext<AddTableFormData>();\n\tconst foreignKeyData = useWatch({\n\t\tcontrol,\n\t\tname: `foreignKeys.${index}`,\n\t});\n\n\tif (!foreignKeyData) return null;\n\n\treturn (\n\t\t<Controller\n\t\t\tcontrol={control}\n\t\t\tname={`foreignKeys.${index}`}\n\t\t\trender={({ field }) => (\n\t\t\t\t<Select\n\t\t\t\t\tvalue={field.value?.referencedColumn}\n\t\t\t\t\tonValueChange={(value) =>\n\t\t\t\t\t\tfield.onChange({ ...field.value, referencedColumn: value })\n\t\t\t\t\t}\n\t\t\t\t\tdisabled={isLoadingTableCols}\n\t\t\t\t>\n\t\t\t\t\t<SelectTrigger\n\t\t\t\t\t\tclassName=\"w-full flex-1\"\n\t\t\t\t\t\tdisabled={isLoadingTableCols || !tableCols?.length}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectValue\n\t\t\t\t\t\t\tplaceholder={tableCols?.length ? \"Select a column\" : \"No columns found\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t{tableCols && tableCols.length > 0 && isLoadingTableCols ? (\n\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tNo columns found\n\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\ttableCols?.flatMap((column) =>\n\t\t\t\t\t\t\t\tcolumn.columnName?.trim()\n\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={column.columnName}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={column.columnName}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{column.columnName}\n\t\t\t\t\t\t\t\t\t\t\t</SelectItem>,\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t: [],\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SelectContent>\n\t\t\t\t</Select>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import { Label } from \"@db-studio/ui/label\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\nimport { FOREIGN_KEY_ACTION_OPTIONS } from \"@/utils/constants/add-table\";\n\nexport const RemoveActionSelector = ({ index }: { index: number }) => {\n\tconst { control } = useFormContext<AddTableFormData>();\n\n\treturn (\n\t\t<Controller\n\t\t\tcontrol={control}\n\t\t\tname={`foreignKeys.${index}.onDelete`}\n\t\t\tdefaultValue=\"NO ACTION\"\n\t\t\trender={({ field }) => (\n\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t<Label htmlFor={`foreignKeys.${index}.onDelete`}>\n\t\t\t\t\t\tAction if referenced row is deleted\n\t\t\t\t\t</Label>\n\t\t\t\t\t<Select\n\t\t\t\t\t\tvalue={field.value}\n\t\t\t\t\t\tonValueChange={(value) => field.onChange(value)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectTrigger className=\"w-full flex-1\">\n\t\t\t\t\t\t\t<SelectValue placeholder=\"Select an action\" />\n\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t{FOREIGN_KEY_ACTION_OPTIONS.map((option) => (\n\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t</Select>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import { Label } from \"@db-studio/ui/label\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\nimport { FOREIGN_KEY_ACTION_OPTIONS } from \"@/utils/constants/add-table\";\n\nexport const UpdateActionSelector = ({ index }: { index: number }) => {\n\tconst { control } = useFormContext<AddTableFormData>();\n\n\treturn (\n\t\t<Controller\n\t\t\tcontrol={control}\n\t\t\tname={`foreignKeys.${index}.onUpdate`}\n\t\t\tdefaultValue=\"NO ACTION\"\n\t\t\trender={({ field }) => (\n\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t<Label htmlFor={`foreignKeys.${index}.onUpdate`}>\n\t\t\t\t\t\tAction if referenced row is updated\n\t\t\t\t\t</Label>\n\t\t\t\t\t<Select\n\t\t\t\t\t\tvalue={field.value}\n\t\t\t\t\t\tonValueChange={(value) => field.onChange(value)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectTrigger className=\"w-full flex-1\">\n\t\t\t\t\t\t\t<SelectValue placeholder=\"Select an action\" />\n\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t{FOREIGN_KEY_ACTION_OPTIONS.map((option) => (\n\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\t\t\t\tvalue={option.value}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t</Select>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import { Label } from \"@db-studio/ui/label\";\nimport { ArrowRight } from \"lucide-react\";\nimport { useFormContext, useWatch } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\nimport { ColNameField } from \"./col-name-field\";\nimport { ReferencedColField } from \"./referenced-col-field\";\nimport { RemoveActionSelector } from \"./remove-action-selector\";\nimport { UpdateActionSelector } from \"./update-action-selector\";\n\nexport const ForeignKeySelectorField = ({ index }: { index: number }) => {\n\tconst { control, watch } = useFormContext<AddTableFormData>();\n\tconst referencedTable = watch(`foreignKeys.${index}.referencedTable`);\n\n\tconst foreignKeyData = useWatch({\n\t\tcontrol,\n\t\tname: `foreignKeys.${index}`,\n\t});\n\n\tif (!referencedTable || !foreignKeyData) return null;\n\n\treturn (\n\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t<p className=\"text-xs text-muted-foreground\">\n\t\t\t\tSelect columns from{\" \"}\n\t\t\t\t<span className=\"font-mono text-primary\">\n\t\t\t\t\t{foreignKeyData.referencedTable || \"Unnamed table\"}\n\t\t\t\t</span>{\" \"}\n\t\t\t\tto reference to\n\t\t\t</p>\n\n\t\t\t<div className=\"space-y-2\">\n\t\t\t\t<div className=\"grid grid-cols-2 gap-2\">\n\t\t\t\t\t<Label htmlFor={`foreignKeys.${index}.columnName`}>\n\t\t\t\t\t\t{watch(\"tableName\") || \"Unnamed table\"}\n\t\t\t\t\t</Label>\n\n\t\t\t\t\t<Label htmlFor={`foreignKeys.${index}.referencedColumn`}>\n\t\t\t\t\t\t{foreignKeyData.referencedTable || \"Unnamed table\"}\n\t\t\t\t\t</Label>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"grid grid-cols-2 gap-2\">\n\t\t\t\t\t<div className=\"flex items-center gap-2 flex-1\">\n\t\t\t\t\t\t<ColNameField index={index} />\n\t\t\t\t\t\t<ArrowRight className=\"size-4 aspect-square text-muted-foreground\" />\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div className=\"flex items-center gap-2 flex-1\">\n\t\t\t\t\t\t<ReferencedColField\n\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\ttableName={foreignKeyData.referencedTable}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<hr className=\"my-8 border-zinc-800\" />\n\n\t\t\t\t<div className=\"flex flex-col gap-6\">\n\t\t\t\t\t<UpdateActionSelector index={index} />\n\t\t\t\t\t<RemoveActionSelector index={index} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import type { DeleteTableResult, RelatedRecord } from \"@db-studio/shared/types\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { deleteTable as deleteTableRequest } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\nexport const useDeleteTable = () => {\n\tconst queryClient = useQueryClient();\n\tconst { selectedDatabase } = useDatabaseStore();\n\n\tconst {\n\t\tmutateAsync: deleteTableAsync,\n\t\tisPending: isDeletingTable,\n\t\treset: resetDeleteResult,\n\t} = useMutation({\n\t\tmutationFn: async ({\n\t\t\ttableName,\n\t\t\tcascade = false,\n\t\t}: {\n\t\t\ttableName: string;\n\t\t\tcascade?: boolean;\n\t\t}): Promise<DeleteTableResult> => {\n\t\t\tconst response = await deleteTableRequest({\n\t\t\t\ttableName,\n\t\t\t\tdb: selectedDatabase,\n\t\t\t\tcascade,\n\t\t\t});\n\t\t\treturn response.data.data;\n\t\t},\n\t\tonSuccess: async () => {\n\t\t\tawait queryClient.invalidateQueries({\n\t\t\t\tqueryKey: tableKeys.lists(),\n\t\t\t});\n\t\t},\n\t});\n\n\tconst deleteTable = async (tableName: string): Promise<DeleteTableResult> => {\n\t\tconst promise = deleteTableAsync({ tableName, cascade: false });\n\t\ttoast.promise(promise, {\n\t\t\tloading: \"Deleting table...\",\n\t\t\tsuccess: (result) =>\n\t\t\t\tresult.fkViolation\n\t\t\t\t\t? `Table \"${tableName}\" has related records`\n\t\t\t\t\t: `Deleted table \"${tableName}\" with ${result.deletedCount} rows`,\n\t\t\terror: (error: Error) => error.message || \"Failed to delete table\",\n\t\t});\n\t\treturn promise;\n\t};\n\n\tconst forceDeleteTable = async (tableName: string): Promise<DeleteTableResult> => {\n\t\tconst promise = deleteTableAsync({ tableName, cascade: true });\n\t\ttoast.promise(promise, {\n\t\t\tloading: \"Deleting table...\",\n\t\t\tsuccess: (result) =>\n\t\t\t\t`Force deleted table \"${tableName}\" with ${result.deletedCount} rows`,\n\t\t\terror: (error: Error) => error.message || \"Failed to delete table\",\n\t\t});\n\t\treturn promise;\n\t};\n\n\treturn {\n\t\tdeleteTable,\n\t\tforceDeleteTable,\n\t\tisDeletingTable,\n\t\tresetDeleteResult,\n\t};\n};\n\nexport type { RelatedRecord };\n","import type { FormatType } from \"@db-studio/shared/types\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { posthogAnalytics } from \"@/lib/posthog\";\nimport { exportTable } from \"@/shared/api\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\ntype ExportFileParams = {\n\ttableName: string;\n\tformat: FormatType;\n};\n\nexport const useExportFile = () => {\n\tconst { selectedDatabase, dbType } = useDatabaseStore();\n\n\tconst { mutateAsync: exportFileMutation, isPending: isExportingFile } = useMutation({\n\t\tmutationFn: async ({ tableName, format }: ExportFileParams) => {\n\t\t\tconst response = await exportTable({ tableName, format, db: selectedDatabase });\n\n\t\t\tconst contentDispositionHeader = response.headers[\"content-disposition\"];\n\t\t\tconst contentDisposition =\n\t\t\t\ttypeof contentDispositionHeader === \"string\" ? contentDispositionHeader : undefined;\n\t\t\tconst filenameMatch = contentDisposition?.match(/filename=\"(.+)\"/);\n\t\t\tconst filename = filenameMatch?.[1] || `${tableName}_export.${format}`;\n\t\t\tconst contentTypeHeader = response.headers[\"content-type\"];\n\t\t\tconst contentType =\n\t\t\t\ttypeof contentTypeHeader === \"string\" ? contentTypeHeader : \"application/octet-stream\";\n\n\t\t\tconst blob = new Blob([response.data], {\n\t\t\t\ttype: contentType,\n\t\t\t});\n\t\t\tconst url = window.URL.createObjectURL(blob);\n\t\t\tconst link = document.createElement(\"a\");\n\t\t\tlink.href = url;\n\t\t\tlink.download = filename;\n\t\t\tdocument.body.appendChild(link);\n\t\t\tlink.click();\n\t\t\tdocument.body.removeChild(link);\n\t\t\twindow.URL.revokeObjectURL(url);\n\n\t\t\tif (dbType) posthogAnalytics.capture(\"record_exported\", { db_type: dbType, format });\n\t\t},\n\t});\n\n\tconst exportFile = async ({ tableName, format }: ExportFileParams) => {\n\t\treturn toast.promise(exportFileMutation({ tableName, format }), {\n\t\t\tloading: \"Exporting file...\",\n\t\t\tsuccess: \"File exported successfully\",\n\t\t\terror: (error: Error) => error.message || \"Failed to export file\",\n\t\t});\n\t};\n\n\treturn {\n\t\texportFile,\n\t\tisExportingFile,\n\t};\n};\n","'use client';\n\nimport { a as write, c as throttle, i as isAbsentFromUrl, n as globalThrottleQueue, o as debounce, r as createEmitter, s as defaultRateLimit, t as debounceController } from \"./debounce-PSGthE_7.js\";\nimport { a as useAdapterProcessUrlSearchParams, c as debug, i as useAdapterDefaultOptions, l as warn, o as renderQueryString, r as useAdapter, s as error } from \"./context-C4spomkL.js\";\nimport { t as compareQuery } from \"./compare-Br3z3FUS.js\";\nimport { useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\n\n//#region src/loader.ts\nfunction createLoader(parsers, { urlKeys = {} } = {}) {\n\tfunction loadSearchParams(input, { strict = false } = {}) {\n\t\tif (input instanceof Promise) return input.then((i) => loadSearchParams(i, { strict }));\n\t\tconst searchParams = extractSearchParams(input);\n\t\tconst result = {};\n\t\tfor (const [key, parser] of Object.entries(parsers)) {\n\t\t\tconst urlKey = urlKeys[key] ?? key;\n\t\t\tconst query = parser.type === \"multi\" ? searchParams.getAll(urlKey) : searchParams.get(urlKey);\n\t\t\tif (isAbsentFromUrl(query)) {\n\t\t\t\tresult[key] = parser.defaultValue ?? null;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlet parsedValue;\n\t\t\ttry {\n\t\t\t\tparsedValue = parser.parse(query);\n\t\t\t} catch (error) {\n\t\t\t\tif (strict) throw new Error(`[nuqs] Error while parsing query \\`${query}\\` for key \\`${key}\\`: ${error}`);\n\t\t\t\tparsedValue = null;\n\t\t\t}\n\t\t\tif (strict && query && parsedValue === null) throw new Error(`[nuqs] Failed to parse query \\`${query}\\` for key \\`${key}\\` (got null)`);\n\t\t\tresult[key] = parsedValue ?? parser.defaultValue ?? null;\n\t\t}\n\t\treturn result;\n\t}\n\treturn loadSearchParams;\n}\nfunction extractSearchParams(input) {\n\ttry {\n\t\tif (input instanceof Request) return input.url ? new URL(input.url).searchParams : new URLSearchParams();\n\t\tif (input instanceof URL) return input.searchParams;\n\t\tif (input instanceof URLSearchParams) return input;\n\t\tif (typeof input === \"object\") {\n\t\t\tconst searchParams = new URLSearchParams();\n\t\t\tfor (const [key, value] of Object.entries(input)) if (Array.isArray(value)) for (const v of value) searchParams.append(key, v);\n\t\t\telse if (value !== void 0) searchParams.set(key, value);\n\t\t\treturn searchParams;\n\t\t}\n\t\tif (typeof input === \"string\") {\n\t\t\tif (URL.hasOwnProperty(\"canParse\") && URL.canParse(input)) return new URL(input).searchParams;\n\t\t\treturn new URLSearchParams(input);\n\t\t}\n\t} catch {}\n\treturn new URLSearchParams();\n}\n\n//#endregion\n//#region src/lib/safe-parse.ts\nfunction safeParse(parser, value, key) {\n\ttry {\n\t\treturn parser(value);\n\t} catch (error) {\n\t\twarn(\"[nuqs] Error while parsing value `%s`: %O\" + (key ? \" (for key `%s`)\" : \"\"), value, error, key);\n\t\treturn null;\n\t}\n}\n\n//#endregion\n//#region src/parsers.ts\n/**\n* Wrap a set of parse/serialize functions into a builder pattern parser\n* you can pass to one of the hooks, making its default value type safe.\n*/\nfunction createParser(parser) {\n\tfunction parseServerSideNullable(value) {\n\t\tif (typeof value === \"undefined\") return null;\n\t\tlet str = \"\";\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value[0] === void 0) return null;\n\t\t\tstr = value[0];\n\t\t}\n\t\tif (typeof value === \"string\") str = value;\n\t\treturn safeParse(parser.parse, str);\n\t}\n\treturn {\n\t\ttype: \"single\",\n\t\teq: (a, b) => a === b,\n\t\t...parser,\n\t\tparseServerSide: parseServerSideNullable,\n\t\twithDefault(defaultValue) {\n\t\t\treturn {\n\t\t\t\t...this,\n\t\t\t\tdefaultValue,\n\t\t\t\tparseServerSide(value) {\n\t\t\t\t\treturn parseServerSideNullable(value) ?? defaultValue;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\twithOptions(options) {\n\t\t\treturn {\n\t\t\t\t...this,\n\t\t\t\t...options\n\t\t\t};\n\t\t}\n\t};\n}\nfunction createMultiParser(parser) {\n\tfunction parseServerSideNullable(value) {\n\t\tif (typeof value === \"undefined\") return null;\n\t\treturn safeParse(parser.parse, Array.isArray(value) ? value : [value]);\n\t}\n\treturn {\n\t\ttype: \"multi\",\n\t\teq: (a, b) => a === b,\n\t\t...parser,\n\t\tparseServerSide: parseServerSideNullable,\n\t\twithDefault(defaultValue) {\n\t\t\treturn {\n\t\t\t\t...this,\n\t\t\t\tdefaultValue,\n\t\t\t\tparseServerSide(value) {\n\t\t\t\t\treturn parseServerSideNullable(value) ?? defaultValue;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\twithOptions(options) {\n\t\t\treturn {\n\t\t\t\t...this,\n\t\t\t\t...options\n\t\t\t};\n\t\t}\n\t};\n}\nconst parseAsString = createParser({\n\tparse: (v) => v,\n\tserialize: String\n});\nconst parseAsInteger = createParser({\n\tparse: (v) => {\n\t\tconst int = parseInt(v);\n\t\treturn int == int ? int : null;\n\t},\n\tserialize: (v) => \"\" + Math.round(v)\n});\nconst parseAsIndex = createParser({\n\tparse: (v) => {\n\t\tconst int = parseInt(v);\n\t\treturn int == int ? int - 1 : null;\n\t},\n\tserialize: (v) => \"\" + Math.round(v + 1)\n});\nconst parseAsHex = createParser({\n\tparse: (v) => {\n\t\tconst int = parseInt(v, 16);\n\t\treturn int == int ? int : null;\n\t},\n\tserialize: (v) => {\n\t\tconst hex = Math.round(v).toString(16);\n\t\treturn (hex.length & 1 ? \"0\" : \"\") + hex;\n\t}\n});\nconst parseAsFloat = createParser({\n\tparse: (v) => {\n\t\tconst float = parseFloat(v);\n\t\treturn float == float ? float : null;\n\t},\n\tserialize: String\n});\nconst parseAsBoolean = createParser({\n\tparse: (v) => v.toLowerCase() === \"true\",\n\tserialize: String\n});\nfunction compareDates(a, b) {\n\treturn a.valueOf() === b.valueOf();\n}\n/**\n* Querystring encoded as the number of milliseconds since epoch,\n* and returned as a Date object.\n*/\nconst parseAsTimestamp = createParser({\n\tparse: (v) => {\n\t\tconst ms = parseInt(v);\n\t\treturn ms == ms ? new Date(ms) : null;\n\t},\n\tserialize: (v) => \"\" + v.valueOf(),\n\teq: compareDates\n});\n/**\n* Querystring encoded as an ISO-8601 string (UTC),\n* and returned as a Date object.\n*/\nconst parseAsIsoDateTime = createParser({\n\tparse: (v) => {\n\t\tconst date = new Date(v);\n\t\treturn date.valueOf() == date.valueOf() ? date : null;\n\t},\n\tserialize: (v) => v.toISOString(),\n\teq: compareDates\n});\n/**\n* Querystring encoded as an ISO-8601 string (UTC)\n* without the time zone offset, and returned as\n* a Date object.\n*\n* The Date is parsed without the time zone offset,\n* making it at 00:00:00 UTC.\n*/\nconst parseAsIsoDate = createParser({\n\tparse: (v) => {\n\t\tconst date = new Date(v.slice(0, 10));\n\t\treturn date.valueOf() == date.valueOf() ? date : null;\n\t},\n\tserialize: (v) => v.toISOString().slice(0, 10),\n\teq: compareDates\n});\n/**\n* String-based enums provide better type-safety for known sets of values.\n* You will need to pass the parseAsStringEnum function a list of your enum values\n* in order to validate the query string. Anything else will return `null`,\n* or your default value if specified.\n*\n* Example:\n* ```ts\n* enum Direction {\n* up = 'UP',\n* down = 'DOWN',\n* left = 'LEFT',\n* right = 'RIGHT'\n* }\n*\n* const [direction, setDirection] = useQueryState(\n* 'direction',\n* parseAsStringEnum<Direction>(Object.values(Direction)) // pass a list of allowed values\n* .withDefault(Direction.up)\n* )\n* ```\n*\n* Note: the query string value will be the value of the enum, not its name\n* (example above: `direction=UP`).\n*\n* @param validValues The values you want to accept\n*/\nfunction parseAsStringEnum(validValues) {\n\treturn parseAsStringLiteral(validValues);\n}\n/**\n* String-based literals provide better type-safety for known sets of values.\n* You will need to pass the parseAsStringLiteral function a list of your string values\n* in order to validate the query string. Anything else will return `null`,\n* or your default value if specified.\n*\n* Example:\n* ```ts\n* const colors = [\"red\", \"green\", \"blue\"] as const\n*\n* const [color, setColor] = useQueryState(\n* 'color',\n* parseAsStringLiteral(colors) // pass a readonly list of allowed values\n* .withDefault(\"red\")\n* )\n* ```\n*\n* @param validValues The values you want to accept\n*/\nfunction parseAsStringLiteral(validValues) {\n\treturn createParser({\n\t\tparse: (query) => {\n\t\t\tconst asConst = query;\n\t\t\treturn validValues.includes(asConst) ? asConst : null;\n\t\t},\n\t\tserialize: String\n\t});\n}\n/**\n* Number-based literals provide better type-safety for known sets of values.\n* You will need to pass the parseAsNumberLiteral function a list of your number values\n* in order to validate the query string. Anything else will return `null`,\n* or your default value if specified.\n*\n* Example:\n* ```ts\n* const diceSides = [1, 2, 3, 4, 5, 6] as const\n*\n* const [side, setSide] = useQueryState(\n* 'side',\n* parseAsNumberLiteral(diceSides) // pass a readonly list of allowed values\n* .withDefault(4)\n* )\n* ```\n*\n* @param validValues The values you want to accept\n*/\nfunction parseAsNumberLiteral(validValues) {\n\treturn createParser({\n\t\tparse: (query) => {\n\t\t\tconst asConst = parseFloat(query);\n\t\t\tif (validValues.includes(asConst)) return asConst;\n\t\t\treturn null;\n\t\t},\n\t\tserialize: String\n\t});\n}\n/**\n* Encode any object shape into the querystring value as JSON.\n* Note: you may want to use `useQueryStates` for finer control over\n* multiple related query keys.\n*\n* @param runtimeParser Runtime parser (eg: Zod schema or Standard Schema) to validate after JSON.parse\n*/\nfunction parseAsJson(validator) {\n\treturn createParser({\n\t\tparse: (query) => {\n\t\t\ttry {\n\t\t\t\tconst obj = JSON.parse(query);\n\t\t\t\tif (\"~standard\" in validator) {\n\t\t\t\t\tconst result = validator[\"~standard\"].validate(obj);\n\t\t\t\t\tif (result instanceof Promise) throw new Error(\"[nuqs] Only synchronous Standard Schemas are supported in parseAsJson.\");\n\t\t\t\t\treturn result.issues ? null : result.value;\n\t\t\t\t}\n\t\t\t\treturn validator(obj);\n\t\t\t} catch {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t},\n\t\tserialize: (value) => JSON.stringify(value),\n\t\teq(a, b) {\n\t\t\treturn a === b || JSON.stringify(a) === JSON.stringify(b);\n\t\t}\n\t});\n}\n/**\n* A comma-separated list of items.\n* Items are URI-encoded for safety, so they may not look nice in the URL.\n*\n* @param itemParser Parser for each individual item in the array\n* @param separator The character to use to separate items (default ',')\n*/\nfunction parseAsArrayOf(itemParser, separator = \",\") {\n\tconst itemEq = itemParser.eq ?? ((a, b) => a === b);\n\tconst encodedSeparator = encodeURIComponent(separator);\n\treturn createParser({\n\t\tparse: (query) => {\n\t\t\tif (query === \"\") return [];\n\t\t\treturn query.split(separator).map((item, index) => safeParse(itemParser.parse, item.replaceAll(encodedSeparator, separator), `[${index}]`)).filter((value) => value !== null && value !== void 0);\n\t\t},\n\t\tserialize: (values) => values.map((value) => {\n\t\t\treturn (itemParser.serialize ? itemParser.serialize(value) : String(value)).replaceAll(separator, encodedSeparator);\n\t\t}).join(separator),\n\t\teq(a, b) {\n\t\t\tif (a === b) return true;\n\t\t\tif (a.length !== b.length) return false;\n\t\t\treturn a.every((value, index) => itemEq(value, b[index]));\n\t\t}\n\t});\n}\nfunction parseAsNativeArrayOf(itemParser) {\n\tconst itemEq = itemParser.eq ?? ((a, b) => a === b);\n\treturn createMultiParser({\n\t\tparse: (query) => {\n\t\t\tconst parsed = query.map((item, index) => safeParse(itemParser.parse, item, `[${index}]`)).filter((value) => value !== null && value !== void 0);\n\t\t\treturn parsed.length === 0 ? null : parsed;\n\t\t},\n\t\tserialize: (values) => {\n\t\t\treturn (Array.isArray(values) ? values : [values]).flatMap((value) => {\n\t\t\t\tconst serialized = itemParser.serialize?.(value) ?? String(value);\n\t\t\t\treturn typeof serialized === \"string\" ? [serialized] : [...serialized];\n\t\t\t});\n\t\t},\n\t\teq(a, b) {\n\t\t\tif (a === b) return true;\n\t\t\tif (a.length !== b.length) return false;\n\t\t\treturn a.every((value, index) => itemEq(value, b[index]));\n\t\t}\n\t}).withDefault([]);\n}\n\n//#endregion\n//#region src/serializer.ts\nfunction createSerializer(parsers, { clearOnDefault = true, urlKeys = {}, processUrlSearchParams } = {}) {\n\tfunction serialize(arg1BaseOrValues, arg2values = {}) {\n\t\tlet [base, search] = isBase(arg1BaseOrValues) ? splitBase(arg1BaseOrValues) : [\"\", new URLSearchParams()];\n\t\tconst values = isBase(arg1BaseOrValues) ? arg2values : arg1BaseOrValues;\n\t\tif (values === null) {\n\t\t\tfor (const key in parsers) {\n\t\t\t\tconst urlKey = urlKeys[key] ?? key;\n\t\t\t\tsearch.delete(urlKey);\n\t\t\t}\n\t\t\tif (processUrlSearchParams) search = processUrlSearchParams(search);\n\t\t\treturn base + renderQueryString(search);\n\t\t}\n\t\tfor (const key in parsers) {\n\t\t\tconst parser = parsers[key];\n\t\t\tconst value = values[key];\n\t\t\tif (!parser || value === void 0) continue;\n\t\t\tconst urlKey = urlKeys[key] ?? key;\n\t\t\tconst isMatchingDefault = parser.defaultValue !== void 0 && value !== null && (parser.eq ?? ((a, b) => a === b))(value, parser.defaultValue);\n\t\t\tif (value === null || (parser.clearOnDefault ?? clearOnDefault ?? true) && isMatchingDefault) search.delete(urlKey);\n\t\t\telse search = write(parser.serialize(value), urlKey, search);\n\t\t}\n\t\tif (processUrlSearchParams) search = processUrlSearchParams(search);\n\t\treturn base + renderQueryString(search);\n\t}\n\treturn serialize;\n}\nfunction isBase(base) {\n\treturn typeof base === \"string\" || base instanceof URLSearchParams || base instanceof URL;\n}\nfunction splitBase(base) {\n\tif (typeof base === \"string\") {\n\t\tconst [path = \"\", ...search] = base.split(\"?\");\n\t\treturn [path, new URLSearchParams(search.join(\"?\"))];\n\t} else if (base instanceof URLSearchParams) return [\"\", new URLSearchParams(base)];\n\telse return [base.origin + base.pathname, new URLSearchParams(base.searchParams)];\n}\n\n//#endregion\n//#region src/standard-schema.ts\nfunction createStandardSchemaV1(parsers, { urlKeys, partialOutput = false } = {}) {\n\tconst serialize = createSerializer(parsers, { urlKeys });\n\tconst load = createLoader(parsers, { urlKeys });\n\treturn { \"~standard\": {\n\t\tversion: 1,\n\t\tvendor: \"nuqs\",\n\t\tvalidate(input) {\n\t\t\ttry {\n\t\t\t\tconst value = load(serialize(input), { strict: true });\n\t\t\t\tif (partialOutput) {\n\t\t\t\t\tfor (const key in value) if (!(key in input)) delete value[key];\n\t\t\t\t}\n\t\t\t\treturn { value };\n\t\t\t} catch (error) {\n\t\t\t\treturn { issues: [{ message: error instanceof Error ? error.message : String(error) }] };\n\t\t\t}\n\t\t}\n\t} };\n}\n\n//#endregion\n//#region src/lib/sync.ts\nconst emitter = createEmitter();\n\n//#endregion\n//#region src/useQueryStates.ts\nconst defaultUrlKeys = {};\n/**\n* Synchronise multiple query string arguments to React state in Next.js\n*\n* @param keys - An object describing the keys to synchronise and how to\n* serialise and parse them.\n* Use `parseAs(String|Integer|Float|...)` for quick shorthands.\n* @param options - Optional history mode, shallow routing and scroll restoration options.\n*/\nfunction useQueryStates(keyMap, options = {}) {\n\tconst hookId = useId();\n\tconst defaultOptions = useAdapterDefaultOptions();\n\tconst processUrlSearchParams = useAdapterProcessUrlSearchParams();\n\tconst { history = \"replace\", scroll = defaultOptions?.scroll ?? false, shallow = defaultOptions?.shallow ?? true, throttleMs = defaultRateLimit.timeMs, limitUrlUpdates = defaultOptions?.limitUrlUpdates, clearOnDefault = defaultOptions?.clearOnDefault ?? true, startTransition, urlKeys = defaultUrlKeys } = options;\n\tconst stateKeys = Object.keys(keyMap).join(\",\");\n\tconst resolvedUrlKeys = useMemo(() => Object.fromEntries(Object.keys(keyMap).map((key) => [key, urlKeys[key] ?? key])), [stateKeys, JSON.stringify(urlKeys)]);\n\tconst adapter = useAdapter(Object.values(resolvedUrlKeys));\n\tconst initialSearchParams = adapter.searchParams;\n\tconst queryRef = useRef({});\n\tconst defaultValues = useMemo(() => Object.fromEntries(Object.keys(keyMap).map((key) => [key, keyMap[key].defaultValue ?? null])), [Object.values(keyMap).map(({ defaultValue }) => defaultValue).join(\",\")]);\n\tconst queuedQueries = debounceController.useQueuedQueries(Object.values(resolvedUrlKeys));\n\tconst [internalState, setInternalState] = useState(() => {\n\t\treturn parseMap(keyMap, urlKeys, initialSearchParams ?? new URLSearchParams(), queuedQueries).state;\n\t});\n\tconst stateRef = useRef(internalState);\n\tdebug(\"[nuq+ %s `%s`] render - state: %O, iSP: %s\", hookId, stateKeys, internalState, initialSearchParams);\n\tif (Object.keys(queryRef.current).join(\"&\") !== Object.values(resolvedUrlKeys).join(\"&\")) {\n\t\tconst { state, hasChanged } = parseMap(keyMap, urlKeys, initialSearchParams, queuedQueries, queryRef.current, stateRef.current);\n\t\tif (hasChanged) {\n\t\t\tdebug(\"[nuq+ %s `%s`] State changed: %O\", hookId, stateKeys, {\n\t\t\t\tstate,\n\t\t\t\tinitialSearchParams,\n\t\t\t\tqueuedQueries,\n\t\t\t\tqueryRef: queryRef.current,\n\t\t\t\tstateRef: stateRef.current\n\t\t\t});\n\t\t\tstateRef.current = state;\n\t\t\tsetInternalState(state);\n\t\t}\n\t\tqueryRef.current = Object.fromEntries(Object.entries(resolvedUrlKeys).map(([key, urlKey]) => {\n\t\t\treturn [urlKey, keyMap[key]?.type === \"multi\" ? initialSearchParams?.getAll(urlKey) : initialSearchParams?.get(urlKey) ?? null];\n\t\t}));\n\t}\n\tuseEffect(() => {\n\t\tconst { state, hasChanged } = parseMap(keyMap, urlKeys, initialSearchParams, queuedQueries, queryRef.current, stateRef.current);\n\t\tif (hasChanged) {\n\t\t\tdebug(\"[nuq+ %s `%s`] State changed: %O\", hookId, stateKeys, {\n\t\t\t\tstate,\n\t\t\t\tinitialSearchParams,\n\t\t\t\tqueuedQueries,\n\t\t\t\tqueryRef: queryRef.current,\n\t\t\t\tstateRef: stateRef.current\n\t\t\t});\n\t\t\tstateRef.current = state;\n\t\t\tsetInternalState(state);\n\t\t}\n\t}, [Object.values(resolvedUrlKeys).map((key) => `${key}=${initialSearchParams?.getAll(key)}`).join(\"&\"), JSON.stringify(queuedQueries)]);\n\tuseEffect(() => {\n\t\tconst handlers = Object.keys(keyMap).reduce((handlers, stateKey) => {\n\t\t\thandlers[stateKey] = ({ state, query }) => {\n\t\t\t\tsetInternalState((currentState) => {\n\t\t\t\t\tconst { defaultValue } = keyMap[stateKey];\n\t\t\t\t\tconst urlKey = resolvedUrlKeys[stateKey];\n\t\t\t\t\tconst nextValue = state ?? defaultValue ?? null;\n\t\t\t\t\tconst currentValue = currentState[stateKey] ?? defaultValue ?? null;\n\t\t\t\t\tif (Object.is(currentValue, nextValue)) {\n\t\t\t\t\t\tdebug(\"[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O\", hookId, stateKeys, urlKey, state, defaultValue, stateRef.current);\n\t\t\t\t\t\treturn currentState;\n\t\t\t\t\t}\n\t\t\t\t\tstateRef.current = {\n\t\t\t\t\t\t...stateRef.current,\n\t\t\t\t\t\t[stateKey]: nextValue\n\t\t\t\t\t};\n\t\t\t\t\tqueryRef.current[urlKey] = query;\n\t\t\t\t\tdebug(\"[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O\", hookId, stateKeys, urlKey, state, defaultValue, stateRef.current);\n\t\t\t\t\treturn stateRef.current;\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn handlers;\n\t\t}, {});\n\t\tfor (const stateKey of Object.keys(keyMap)) {\n\t\t\tconst urlKey = resolvedUrlKeys[stateKey];\n\t\t\tdebug(\"[nuq+ %s `%s`] Subscribing to sync for `%s`\", hookId, urlKey, stateKeys);\n\t\t\temitter.on(urlKey, handlers[stateKey]);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const stateKey of Object.keys(keyMap)) {\n\t\t\t\tconst urlKey = resolvedUrlKeys[stateKey];\n\t\t\t\tdebug(\"[nuq+ %s `%s`] Unsubscribing to sync for `%s`\", hookId, urlKey, stateKeys);\n\t\t\t\temitter.off(urlKey, handlers[stateKey]);\n\t\t\t}\n\t\t};\n\t}, [stateKeys, resolvedUrlKeys]);\n\tconst update = useCallback((stateUpdater, callOptions = {}) => {\n\t\tconst nullMap = Object.fromEntries(Object.keys(keyMap).map((key) => [key, null]));\n\t\tconst newState = typeof stateUpdater === \"function\" ? stateUpdater(applyDefaultValues(stateRef.current, defaultValues)) ?? nullMap : stateUpdater ?? nullMap;\n\t\tdebug(\"[nuq+ %s `%s`] setState: %O\", hookId, stateKeys, newState);\n\t\tlet returnedPromise = void 0;\n\t\tlet maxDebounceTime = 0;\n\t\tlet doFlush = false;\n\t\tconst debounceAborts = [];\n\t\tfor (let [stateKey, value] of Object.entries(newState)) {\n\t\t\tconst parser = keyMap[stateKey];\n\t\t\tconst urlKey = resolvedUrlKeys[stateKey];\n\t\t\tif (!parser || value === void 0) continue;\n\t\t\tif ((callOptions.clearOnDefault ?? parser.clearOnDefault ?? clearOnDefault) && value !== null && parser.defaultValue !== void 0 && (parser.eq ?? ((a, b) => a === b))(value, parser.defaultValue)) value = null;\n\t\t\tconst query = value === null ? null : (parser.serialize ?? String)(value);\n\t\t\temitter.emit(urlKey, {\n\t\t\t\tstate: value,\n\t\t\t\tquery\n\t\t\t});\n\t\t\tconst update = {\n\t\t\t\tkey: urlKey,\n\t\t\t\tquery,\n\t\t\t\toptions: {\n\t\t\t\t\thistory: callOptions.history ?? parser.history ?? history,\n\t\t\t\t\tshallow: callOptions.shallow ?? parser.shallow ?? shallow,\n\t\t\t\t\tscroll: callOptions.scroll ?? parser.scroll ?? scroll,\n\t\t\t\t\tstartTransition: callOptions.startTransition ?? parser.startTransition ?? startTransition\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (callOptions?.limitUrlUpdates?.method === \"debounce\" || limitUrlUpdates?.method === \"debounce\" || parser.limitUrlUpdates?.method === \"debounce\") {\n\t\t\t\tif (update.options.shallow === true) console.warn(error(422));\n\t\t\t\tconst timeMs = callOptions?.limitUrlUpdates?.timeMs ?? limitUrlUpdates?.timeMs ?? parser.limitUrlUpdates?.timeMs ?? defaultRateLimit.timeMs;\n\t\t\t\tconst debouncedPromise = debounceController.push(update, timeMs, adapter, processUrlSearchParams);\n\t\t\t\tif (maxDebounceTime < timeMs) {\n\t\t\t\t\treturnedPromise = debouncedPromise;\n\t\t\t\t\tmaxDebounceTime = timeMs;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst timeMs = callOptions?.limitUrlUpdates?.timeMs ?? parser?.limitUrlUpdates?.timeMs ?? limitUrlUpdates?.timeMs ?? callOptions.throttleMs ?? parser.throttleMs ?? throttleMs;\n\t\t\t\tdebounceAborts.push(debounceController.abort(urlKey));\n\t\t\t\tglobalThrottleQueue.push(update, timeMs);\n\t\t\t\tdoFlush = true;\n\t\t\t}\n\t\t}\n\t\tconst globalPromise = debounceAborts.reduce((previous, fn) => fn(previous), doFlush ? globalThrottleQueue.flush(adapter, processUrlSearchParams) : globalThrottleQueue.getPendingPromise(adapter));\n\t\treturn returnedPromise ?? globalPromise;\n\t}, [\n\t\tstateKeys,\n\t\thistory,\n\t\tshallow,\n\t\tscroll,\n\t\tthrottleMs,\n\t\tlimitUrlUpdates?.method,\n\t\tlimitUrlUpdates?.timeMs,\n\t\tstartTransition,\n\t\tresolvedUrlKeys,\n\t\tadapter.updateUrl,\n\t\tadapter.getSearchParamsSnapshot,\n\t\tadapter.rateLimitFactor,\n\t\tprocessUrlSearchParams,\n\t\tdefaultValues\n\t]);\n\treturn [useMemo(() => applyDefaultValues(internalState, defaultValues), [internalState, defaultValues]), update];\n}\nfunction parseMap(keyMap, urlKeys, searchParams, queuedQueries, cachedQuery, cachedState) {\n\tlet hasChanged = false;\n\tconst state = Object.entries(keyMap).reduce((out, [stateKey, parser]) => {\n\t\tconst urlKey = urlKeys?.[stateKey] ?? stateKey;\n\t\tconst queuedQuery = queuedQueries[urlKey];\n\t\tconst fallbackValue = parser.type === \"multi\" ? [] : null;\n\t\tconst query = queuedQuery === void 0 ? (parser.type === \"multi\" ? searchParams?.getAll(urlKey) : searchParams?.get(urlKey)) ?? fallbackValue : queuedQuery;\n\t\tif (cachedQuery && cachedState && compareQuery(cachedQuery[urlKey] ?? fallbackValue, query)) {\n\t\t\tout[stateKey] = cachedState[stateKey] ?? null;\n\t\t\treturn out;\n\t\t}\n\t\thasChanged = true;\n\t\tout[stateKey] = (isAbsentFromUrl(query) ? null : safeParse(parser.parse, query, urlKey)) ?? null;\n\t\tif (cachedQuery) cachedQuery[urlKey] = query;\n\t\treturn out;\n\t}, {});\n\tif (!hasChanged) {\n\t\tconst keyMapKeys = Object.keys(keyMap);\n\t\tconst cachedStateKeys = Object.keys(cachedState ?? {});\n\t\thasChanged = keyMapKeys.length !== cachedStateKeys.length || keyMapKeys.some((key) => !cachedStateKeys.includes(key));\n\t}\n\treturn {\n\t\tstate,\n\t\thasChanged\n\t};\n}\nfunction applyDefaultValues(state, defaults) {\n\treturn Object.fromEntries(Object.keys(state).map((key) => [key, state[key] ?? defaults[key] ?? null]));\n}\n\n//#endregion\n//#region src/useQueryState.ts\n/**\n* React state hook synchronized with a URL query string in Next.js\n*\n* If used without a `defaultValue` supplied in the options, and the query is\n* missing in the URL, the state will be `null`.\n*\n* ### Behaviour with default values:\n*\n* _Note: the URL will **not** be updated with the default value if the query\n* is missing._\n*\n* Setting the value to `null` will clear the query in the URL, and return\n* the default value as state.\n*\n* Example usage:\n* ```ts\n* // Blog posts filtering by tag\n* const [tag, selectTag] = useQueryState('tag')\n* const filteredPosts = posts.filter(post => tag ? post.tag === tag : true)\n* const clearTag = () => selectTag(null)\n*\n* // With default values\n*\n* const [count, setCount] = useQueryState(\n* 'count',\n* parseAsInteger.defaultValue(0)\n* )\n*\n* const increment = () => setCount(oldCount => oldCount + 1)\n* const decrement = () => setCount(oldCount => oldCount - 1)\n* const clearCountQuery = () => setCount(null)\n*\n* // --\n*\n* const [date, setDate] = useQueryState(\n* 'date',\n* parseAsIsoDateTime.withDefault(new Date('2021-01-01'))\n* )\n*\n* const setToNow = () => setDate(new Date())\n* const addOneHour = () => {\n* setDate(oldDate => new Date(oldDate.valueOf() + 3600_000))\n* }\n* ```\n* @param key The URL query string key to bind to\n* @param options - Parser (defines the state data type), optional default value and history mode.\n*/\nfunction useQueryState(key, options = {}) {\n\tconst { parse, type, serialize, eq, defaultValue, ...hookOptions } = options;\n\tconst [{ [key]: state }, setState] = useQueryStates({ [key]: {\n\t\tparse: parse ?? ((x) => x),\n\t\ttype,\n\t\tserialize,\n\t\teq,\n\t\tdefaultValue\n\t} }, hookOptions);\n\treturn [state, useCallback((stateUpdater, callOptions = {}) => setState((old) => ({ [key]: typeof stateUpdater === \"function\" ? stateUpdater(old[key]) : stateUpdater }), callOptions), [key, setState])];\n}\n\n//#endregion\nexport { createLoader, createMultiParser, createParser, createSerializer, createStandardSchemaV1, debounce, defaultRateLimit, parseAsArrayOf, parseAsBoolean, parseAsFloat, parseAsHex, parseAsIndex, parseAsInteger, parseAsIsoDate, parseAsIsoDateTime, parseAsJson, parseAsNativeArrayOf, parseAsNumberLiteral, parseAsString, parseAsStringEnum, parseAsStringLiteral, parseAsTimestamp, throttle, useQueryState, useQueryStates };\n//# sourceMappingURL=index.js.map","import { useQuery } from \"@tanstack/react-query\";\nimport { getTables } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\nexport const useTablesList = () => {\n\tconst { selectedDatabase } = useDatabaseStore();\n\n\tconst {\n\t\tdata: tablesList,\n\t\tisLoading: isLoadingTablesList,\n\t\terror: errorTablesList,\n\t} = useQuery({\n\t\tqueryKey: tableKeys.list(selectedDatabase),\n\t\tqueryFn: () => getTables(selectedDatabase),\n\t\tselect: (res) => res.data.data,\n\t\tenabled: !!selectedDatabase,\n\t});\n\n\treturn { tablesList, isLoadingTablesList, errorTablesList };\n};\n","import { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { posthogAnalytics } from \"@/lib/posthog\";\nimport { createRecord as createRecordRequest } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\n\nexport interface AddRecordFormData {\n\t[key: string]: string;\n}\n\nexport const useCreateRecord = ({ tableName }: { tableName: string }) => {\n\tconst queryClient = useQueryClient();\n\tconst { closeOverlay } = useOverlayStore();\n\tconst { selectedDatabase, dbType } = useDatabaseStore();\n\n\tconst { mutateAsync: createRecordMutation, isPending: isCreatingRecord } = useMutation({\n\t\tmutationFn: async (data: AddRecordFormData) => {\n\t\t\tconst res = await createRecordRequest({\n\t\t\t\ttableName,\n\t\t\t\tdata,\n\t\t\t\tdb: selectedDatabase,\n\t\t\t});\n\t\t\treturn res.data.data;\n\t\t},\n\t\tonSuccess: async () => {\n\t\t\tawait Promise.all([\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.dataByTable(tableName),\n\t\t\t\t\texact: false,\n\t\t\t\t}),\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.lists(),\n\t\t\t\t}),\n\t\t\t]);\n\t\t\tcloseOverlay(\"records.add-record\");\n\t\t\tif (dbType) posthogAnalytics.capture(\"record_created\", { db_type: dbType });\n\t\t},\n\t});\n\n\tconst createRecord = async (\n\t\tdata: AddRecordFormData,\n\t\toptions: {\n\t\t\tonSuccess?: () => void;\n\t\t\tonError?: (error: Error & { detail?: string }) => void;\n\t\t},\n\t) => {\n\t\tif (!data || Object.keys(data).length === 0) {\n\t\t\tthrow new Error(\"At least one field is required\");\n\t\t}\n\t\treturn toast.promise(createRecordMutation(data, options), {\n\t\t\tloading: \"Creating record...\",\n\t\t\tsuccess: (message) => message || \"Record created successfully\",\n\t\t\terror: (error: Error & { detail?: string }) =>\n\t\t\t\terror.detail || error.message || \"Failed to create record\",\n\t\t});\n\t};\n\n\treturn {\n\t\tcreateRecord,\n\t\tisCreatingRecord,\n\t};\n};\n","/**\n * @module constants\n * @summary Useful constants\n * @description\n * Collection of useful date constants.\n *\n * The constants could be imported from `date-fns/constants`:\n *\n * ```ts\n * import { maxTime, minTime } from \"./constants/date-fns/constants\";\n *\n * function isAllowedTime(time) {\n * return time <= maxTime && time >= minTime;\n * }\n * ```\n */\n\n/**\n * @constant\n * @name daysInWeek\n * @summary Days in 1 week.\n */\nexport const daysInWeek = 7;\n\n/**\n * @constant\n * @name daysInYear\n * @summary Days in 1 year.\n *\n * @description\n * How many days in a year.\n *\n * One years equals 365.2425 days according to the formula:\n *\n * > Leap year occurs every 4 years, except for years that are divisible by 100 and not divisible by 400.\n * > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days\n */\nexport const daysInYear = 365.2425;\n\n/**\n * @constant\n * @name maxTime\n * @summary Maximum allowed time.\n *\n * @example\n * import { maxTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = 8640000000000001 <= maxTime;\n * //=> false\n *\n * new Date(8640000000000001);\n * //=> Invalid Date\n */\nexport const maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;\n\n/**\n * @constant\n * @name minTime\n * @summary Minimum allowed time.\n *\n * @example\n * import { minTime } from \"./constants/date-fns/constants\";\n *\n * const isValid = -8640000000000001 >= minTime;\n * //=> false\n *\n * new Date(-8640000000000001)\n * //=> Invalid Date\n */\nexport const minTime = -maxTime;\n\n/**\n * @constant\n * @name millisecondsInWeek\n * @summary Milliseconds in 1 week.\n */\nexport const millisecondsInWeek = 604800000;\n\n/**\n * @constant\n * @name millisecondsInDay\n * @summary Milliseconds in 1 day.\n */\nexport const millisecondsInDay = 86400000;\n\n/**\n * @constant\n * @name millisecondsInMinute\n * @summary Milliseconds in 1 minute\n */\nexport const millisecondsInMinute = 60000;\n\n/**\n * @constant\n * @name millisecondsInHour\n * @summary Milliseconds in 1 hour\n */\nexport const millisecondsInHour = 3600000;\n\n/**\n * @constant\n * @name millisecondsInSecond\n * @summary Milliseconds in 1 second\n */\nexport const millisecondsInSecond = 1000;\n\n/**\n * @constant\n * @name minutesInYear\n * @summary Minutes in 1 year.\n */\nexport const minutesInYear = 525600;\n\n/**\n * @constant\n * @name minutesInMonth\n * @summary Minutes in 1 month.\n */\nexport const minutesInMonth = 43200;\n\n/**\n * @constant\n * @name minutesInDay\n * @summary Minutes in 1 day.\n */\nexport const minutesInDay = 1440;\n\n/**\n * @constant\n * @name minutesInHour\n * @summary Minutes in 1 hour.\n */\nexport const minutesInHour = 60;\n\n/**\n * @constant\n * @name monthsInQuarter\n * @summary Months in 1 quarter.\n */\nexport const monthsInQuarter = 3;\n\n/**\n * @constant\n * @name monthsInYear\n * @summary Months in 1 year.\n */\nexport const monthsInYear = 12;\n\n/**\n * @constant\n * @name quartersInYear\n * @summary Quarters in 1 year\n */\nexport const quartersInYear = 4;\n\n/**\n * @constant\n * @name secondsInHour\n * @summary Seconds in 1 hour.\n */\nexport const secondsInHour = 3600;\n\n/**\n * @constant\n * @name secondsInMinute\n * @summary Seconds in 1 minute.\n */\nexport const secondsInMinute = 60;\n\n/**\n * @constant\n * @name secondsInDay\n * @summary Seconds in 1 day.\n */\nexport const secondsInDay = secondsInHour * 24;\n\n/**\n * @constant\n * @name secondsInWeek\n * @summary Seconds in 1 week.\n */\nexport const secondsInWeek = secondsInDay * 7;\n\n/**\n * @constant\n * @name secondsInYear\n * @summary Seconds in 1 year.\n */\nexport const secondsInYear = secondsInDay * daysInYear;\n\n/**\n * @constant\n * @name secondsInMonth\n * @summary Seconds in 1 month\n */\nexport const secondsInMonth = secondsInYear / 12;\n\n/**\n * @constant\n * @name secondsInQuarter\n * @summary Seconds in 1 quarter.\n */\nexport const secondsInQuarter = secondsInMonth * 3;\n\n/**\n * @constant\n * @name constructFromSymbol\n * @summary Symbol enabling Date extensions to inherit properties from the reference date.\n *\n * The symbol is used to enable the `constructFrom` function to construct a date\n * using a reference date and a value. It allows to transfer extra properties\n * from the reference date to the new date. It's useful for extensions like\n * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as\n * a constructor argument.\n */\nexport const constructFromSymbol = Symbol.for(\"constructDateFrom\");\n","import { constructFromSymbol } from \"./constants.js\";\n\n/**\n * @name constructFrom\n * @category Generic Helpers\n * @summary Constructs a date using the reference date and the value\n *\n * @description\n * The function constructs a new date using the constructor from the reference\n * date and the given value. It helps to build generic functions that accept\n * date extensions.\n *\n * It defaults to `Date` if the passed reference date is a number or a string.\n *\n * Starting from v3.7.0, it allows to construct a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n *\n * @param date - The reference date to take constructor from\n * @param value - The value to create the date\n *\n * @returns Date initialized using the given date and value\n *\n * @example\n * import { constructFrom } from \"./constructFrom/date-fns\";\n *\n * // A function that clones a date preserving the original type\n * function cloneDate<DateType extends Date>(date: DateType): DateType {\n * return constructFrom(\n * date, // Use constructor from the given date\n * date.getTime() // Use the date value to create a new date\n * );\n * }\n */\nexport function constructFrom(date, value) {\n if (typeof date === \"function\") return date(value);\n\n if (date && typeof date === \"object\" && constructFromSymbol in date)\n return date[constructFromSymbol](value);\n\n if (date instanceof Date) return new date.constructor(value);\n\n return new Date(value);\n}\n\n// Fallback for modularized imports:\nexport default constructFrom;\n","import { constructFrom } from \"./constructFrom.js\";\n\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * Starting from v3.7.0, it clones a date using `[Symbol.for(\"constructDateFrom\")]`\n * enabling to transfer extra properties from the reference date to the new date.\n * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)\n * that accept a time zone as a constructor argument.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param argument - The value to convert\n *\n * @returns The parsed date in the local time zone\n *\n * @example\n * // Clone the date:\n * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * const result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport function toDate(argument, context) {\n // [TODO] Get rid of `toDate` or `constructFrom`?\n return constructFrom(context || argument, argument);\n}\n\n// Fallback for modularized imports:\nexport default toDate;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addDays} function options.\n */\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of days to be added.\n * @param options - An object with options\n *\n * @returns The new date with the days added\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport function addDays(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n if (!amount) return _date;\n\n _date.setDate(_date.getDate() + amount);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default addDays;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addMonths} function options.\n */\n\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of months to be added.\n * @param options - The options object\n *\n * @returns The new date with the months added\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n *\n * // Add one month to 30 January 2023:\n * const result = addMonths(new Date(2023, 0, 30), 1)\n * //=> Tue Feb 28 2023 00:00:00\n */\nexport function addMonths(date, amount, options) {\n const _date = toDate(date, options?.in);\n if (isNaN(amount)) return constructFrom(options?.in || date, NaN);\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return _date;\n }\n const dayOfMonth = _date.getDate();\n\n // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());\n endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);\n const daysInMonth = endOfDesiredMonth.getDate();\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n _date.setFullYear(\n endOfDesiredMonth.getFullYear(),\n endOfDesiredMonth.getMonth(),\n dayOfMonth,\n );\n return _date;\n }\n}\n\n// Fallback for modularized imports:\nexport default addMonths;\n","let defaultOptions = {};\n\nexport function getDefaultOptions() {\n return defaultOptions;\n}\n\nexport function setDefaultOptions(newOptions) {\n defaultOptions = newOptions;\n}\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfWeek} function options.\n */\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n\n _date.setDate(_date.getDate() - diff);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeek;\n","import { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfISOWeek} function options.\n */\n\n/**\n * @name startOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the start of an ISO week for the given date.\n *\n * @description\n * Return the start of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week\n *\n * @example\n * // The start of an ISO week for 2 September 2014 11:55:00:\n * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfISOWeek(date, options) {\n return startOfWeek(date, { ...options, weekStartsOn: 1 });\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeek;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeekYear} function options.\n */\n\n/**\n * @name getISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the ISO week-numbering year of the given date.\n *\n * @description\n * Get the ISO week-numbering year of the given date,\n * which always starts 3 days before the year's first Thursday.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n *\n * @returns The ISO week-numbering year\n *\n * @example\n * // Which ISO-week numbering year is 2 January 2005?\n * const result = getISOWeekYear(new Date(2005, 0, 2))\n * //=> 2004\n */\nexport function getISOWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);\n\n const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);\n fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);\n\n if (_date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (_date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getISOWeekYear;\n","import { toDate } from \"../toDate.js\";\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport function getTimezoneOffsetInMilliseconds(date) {\n const _date = toDate(date);\n const utcDate = new Date(\n Date.UTC(\n _date.getFullYear(),\n _date.getMonth(),\n _date.getDate(),\n _date.getHours(),\n _date.getMinutes(),\n _date.getSeconds(),\n _date.getMilliseconds(),\n ),\n );\n utcDate.setUTCFullYear(_date.getFullYear());\n return +date - +utcDate;\n}\n","import { constructFrom } from \"../constructFrom.js\";\n\nexport function normalizeDates(context, ...dates) {\n const normalize = constructFrom.bind(\n null,\n context || dates.find((date) => typeof date === \"object\"),\n );\n return dates.map(normalize);\n}\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfDay} function options.\n */\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a day\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport function startOfDay(date, options) {\n const _date = toDate(date, options?.in);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfDay;\n","import { getTimezoneOffsetInMilliseconds } from \"./_lib/getTimezoneOffsetInMilliseconds.js\";\nimport { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { millisecondsInDay } from \"./constants.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link differenceInCalendarDays} function options.\n */\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - The options object\n *\n * @returns The number of calendar days\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * const result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * const result = differenceInCalendarDays(\n * new Date(2011, 6, 3, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport function differenceInCalendarDays(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const laterStartOfDay = startOfDay(laterDate_);\n const earlierStartOfDay = startOfDay(earlierDate_);\n\n const laterTimestamp =\n +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);\n const earlierTimestamp =\n +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);\n\n // Round the number of days to the nearest integer because the number of\n // milliseconds in a day is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarDays;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { getISOWeekYear } from \"./getISOWeekYear.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\n\n/**\n * The {@link startOfISOWeekYear} function options.\n */\n\n/**\n * @name startOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the start of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the start of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of an ISO week-numbering year\n *\n * @example\n * // The start of an ISO week-numbering year for 2 July 2005:\n * const result = startOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfISOWeekYear(date, options) {\n const year = getISOWeekYear(date, options);\n const fourthOfJanuary = constructFrom(options?.in || date, 0);\n fourthOfJanuary.setFullYear(year, 0, 4);\n fourthOfJanuary.setHours(0, 0, 0, 0);\n return startOfISOWeek(fourthOfJanuary);\n}\n\n// Fallback for modularized imports:\nexport default startOfISOWeekYear;\n","import { addDays } from \"./addDays.js\";\n\n/**\n * The {@link addWeeks} function options.\n */\n\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of weeks to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of weeks to be added.\n * @param options - An object with options\n *\n * @returns The new date with the weeks added\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\nexport function addWeeks(date, amount, options) {\n return addDays(date, amount * 7, options);\n}\n\n// Fallback for modularized imports:\nexport default addWeeks;\n","import { addMonths } from \"./addMonths.js\";\n\n/**\n * The {@link addYears} function options.\n */\n\n/**\n * @name addYears\n * @category Year Helpers\n * @summary Add the specified number of years to the given date.\n *\n * @description\n * Add the specified number of years to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type.\n *\n * @param date - The date to be changed\n * @param amount - The amount of years to be added.\n * @param options - The options\n *\n * @returns The new date with the years added\n *\n * @example\n * // Add 5 years to 1 September 2014:\n * const result = addYears(new Date(2014, 8, 1), 5)\n * //=> Sun Sep 01 2019 00:00:00\n */\nexport function addYears(date, amount, options) {\n return addMonths(date, amount * 12, options);\n}\n\n// Fallback for modularized imports:\nexport default addYears;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link max} function options.\n */\n\n/**\n * @name max\n * @category Common Helpers\n * @summary Return the latest of the given dates.\n *\n * @description\n * Return the latest of the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param dates - The dates to compare\n *\n * @returns The latest of the dates\n *\n * @example\n * // Which of these dates is the latest?\n * const result = max([\n * new Date(1989, 6, 10),\n * new Date(1987, 1, 11),\n * new Date(1995, 6, 2),\n * new Date(1990, 0, 1)\n * ])\n * //=> Sun Jul 02 1995 00:00:00\n */\nexport function max(dates, options) {\n let result;\n let context = options?.in;\n\n dates.forEach((date) => {\n // Use the first date object as the context function\n if (!context && typeof date === \"object\")\n context = constructFrom.bind(null, date);\n\n const date_ = toDate(date, context);\n if (!result || result < date_ || isNaN(+date_)) result = date_;\n });\n\n return constructFrom(context, result || NaN);\n}\n\n// Fallback for modularized imports:\nexport default max;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link min} function options.\n */\n\n/**\n * @name min\n * @category Common Helpers\n * @summary Returns the earliest of the given dates.\n *\n * @description\n * Returns the earliest of the given dates.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param dates - The dates to compare\n *\n * @returns The earliest of the dates\n *\n * @example\n * // Which of these dates is the earliest?\n * const result = min([\n * new Date(1989, 6, 10),\n * new Date(1987, 1, 11),\n * new Date(1995, 6, 2),\n * new Date(1990, 0, 1)\n * ])\n * //=> Wed Feb 11 1987 00:00:00\n */\nexport function min(dates, options) {\n let result;\n let context = options?.in;\n\n dates.forEach((date) => {\n // Use the first date object as the context function\n if (!context && typeof date === \"object\")\n context = constructFrom.bind(null, date);\n\n const date_ = toDate(date, context);\n if (!result || result > date_ || isNaN(+date_)) result = date_;\n });\n\n return constructFrom(context, result || NaN);\n}\n\n// Fallback for modularized imports:\nexport default min;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\nimport { startOfDay } from \"./startOfDay.js\";\n\n/**\n * The {@link isSameDay} function options.\n */\n\n/**\n * @name isSameDay\n * @category Day Helpers\n * @summary Are the given dates in the same day (and year and month)?\n *\n * @description\n * Are the given dates in the same day (and year and month)?\n *\n * @param laterDate - The first date to check\n * @param earlierDate - The second date to check\n * @param options - An object with options\n *\n * @returns The dates are in the same day (and year and month)\n *\n * @example\n * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))\n * //=> true\n *\n * @example\n * // Are 4 September and 4 October in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))\n * //=> false\n *\n * @example\n * // Are 4 September, 2014 and 4 September, 2015 in the same day?\n * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))\n * //=> false\n */\nexport function isSameDay(laterDate, earlierDate, options) {\n const [dateLeft_, dateRight_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n return +startOfDay(dateLeft_) === +startOfDay(dateRight_);\n}\n\n// Fallback for modularized imports:\nexport default isSameDay;\n","/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * @param value - The value to check\n *\n * @returns True if the given value is a date\n *\n * @example\n * // For a valid date:\n * const result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * const result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * const result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * const result = isDate({})\n * //=> false\n */\nexport function isDate(value) {\n return (\n value instanceof Date ||\n (typeof value === \"object\" &&\n Object.prototype.toString.call(value) === \"[object Date]\")\n );\n}\n\n// Fallback for modularized imports:\nexport default isDate;\n","import { isDate } from \"./isDate.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param date - The date to check\n *\n * @returns The date is valid\n *\n * @example\n * // For the valid date:\n * const result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertible into a date:\n * const result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * const result = isValid(new Date(''))\n * //=> false\n */\nexport function isValid(date) {\n return !((!isDate(date) && typeof date !== \"number\") || isNaN(+toDate(date)));\n}\n\n// Fallback for modularized imports:\nexport default isValid;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link differenceInCalendarMonths} function options.\n */\n\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * @param laterDate - The later date\n * @param earlierDate - The earlier date\n * @param options - An object with options\n *\n * @returns The number of calendar months\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * const result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\nexport function differenceInCalendarMonths(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n\n const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();\n const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();\n\n return yearsDiff * 12 + monthsDiff;\n}\n\n// Fallback for modularized imports:\nexport default differenceInCalendarMonths;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link endOfMonth} function options.\n */\n\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The end of a month\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport function endOfMonth(date, options) {\n const _date = toDate(date, options?.in);\n const month = _date.getMonth();\n _date.setFullYear(_date.getFullYear(), month + 1, 0);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfMonth;\n","import { normalizeDates } from \"./normalizeDates.js\";\n\nexport function normalizeInterval(context, interval) {\n const [start, end] = normalizeDates(context, interval.start, interval.end);\n return { start, end };\n}\n","import { normalizeInterval } from \"./_lib/normalizeInterval.js\";\nimport { constructFrom } from \"./constructFrom.js\";\n\n/**\n * The {@link eachMonthOfInterval} function options.\n */\n\n/**\n * The {@link eachMonthOfInterval} function result type. It resolves the proper data type.\n */\n\n/**\n * @name eachMonthOfInterval\n * @category Interval Helpers\n * @summary Return the array of months within the specified time interval.\n *\n * @description\n * Return the array of months within the specified time interval.\n *\n * @typeParam IntervalType - Interval type.\n * @typeParam Options - Options type.\n *\n * @param interval - The interval.\n * @param options - An object with options.\n *\n * @returns The array with starts of months from the month of the interval start to the month of the interval end\n *\n * @example\n * // Each month between 6 February 2014 and 10 August 2014:\n * const result = eachMonthOfInterval({\n * start: new Date(2014, 1, 6),\n * end: new Date(2014, 7, 10)\n * })\n * //=> [\n * // Sat Feb 01 2014 00:00:00,\n * // Sat Mar 01 2014 00:00:00,\n * // Tue Apr 01 2014 00:00:00,\n * // Thu May 01 2014 00:00:00,\n * // Sun Jun 01 2014 00:00:00,\n * // Tue Jul 01 2014 00:00:00,\n * // Fri Aug 01 2014 00:00:00\n * // ]\n */\nexport function eachMonthOfInterval(interval, options) {\n const { start, end } = normalizeInterval(options?.in, interval);\n\n let reversed = +start > +end;\n const endTime = reversed ? +start : +end;\n const date = reversed ? end : start;\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n\n let step = options?.step ?? 1;\n if (!step) return [];\n if (step < 0) {\n step = -step;\n reversed = !reversed;\n }\n\n const dates = [];\n\n while (+date <= endTime) {\n dates.push(constructFrom(start, date));\n date.setMonth(date.getMonth() + step);\n }\n\n return reversed ? dates.reverse() : dates;\n}\n\n// Fallback for modularized imports:\nexport default eachMonthOfInterval;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfMonth} function options.\n */\n\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date. The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.\n * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,\n * or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a month\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport function startOfMonth(date, options) {\n const _date = toDate(date, options?.in);\n _date.setDate(1);\n _date.setHours(0, 0, 0, 0);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfMonth;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link endOfYear} function options.\n */\n\n/**\n * @name endOfYear\n * @category Year Helpers\n * @summary Return the end of a year for the given date.\n *\n * @description\n * Return the end of a year for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The end of a year\n *\n * @example\n * // The end of a year for 2 September 2014 11:55:00:\n * const result = endOfYear(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Wed Dec 31 2014 23:59:59.999\n */\nexport function endOfYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n _date.setFullYear(year + 1, 0, 0);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfYear;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link startOfYear} function options.\n */\n\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - The options\n *\n * @returns The start of a year\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\nexport function startOfYear(date, options) {\n const date_ = toDate(date, options?.in);\n date_.setFullYear(date_.getFullYear(), 0, 1);\n date_.setHours(0, 0, 0, 0);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default startOfYear;\n","import { normalizeInterval } from \"./_lib/normalizeInterval.js\";\nimport { constructFrom } from \"./constructFrom.js\";\n\n/**\n * The {@link eachYearOfInterval} function options.\n */\n\n/**\n * The {@link eachYearOfInterval} function result type. It resolves the proper data type.\n * It uses the first argument date object type, starting from the date argument,\n * then the start interval date, and finally the end interval date. If\n * a context function is passed, it uses the context function return type.\n */\n\n/**\n * @name eachYearOfInterval\n * @category Interval Helpers\n * @summary Return the array of yearly timestamps within the specified time interval.\n *\n * @description\n * Return the array of yearly timestamps within the specified time interval.\n *\n * @typeParam IntervalType - Interval type.\n * @typeParam Options - Options type.\n *\n * @param interval - The interval.\n * @param options - An object with options.\n *\n * @returns The array with starts of yearly timestamps from the month of the interval start to the month of the interval end\n *\n * @example\n * // Each year between 6 February 2014 and 10 August 2017:\n * const result = eachYearOfInterval({\n * start: new Date(2014, 1, 6),\n * end: new Date(2017, 7, 10)\n * })\n * //=> [\n * // Wed Jan 01 2014 00:00:00,\n * // Thu Jan 01 2015 00:00:00,\n * // Fri Jan 01 2016 00:00:00,\n * // Sun Jan 01 2017 00:00:00\n * // ]\n */\nexport function eachYearOfInterval(interval, options) {\n const { start, end } = normalizeInterval(options?.in, interval);\n\n let reversed = +start > +end;\n const endTime = reversed ? +start : +end;\n const date = reversed ? end : start;\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n\n let step = options?.step ?? 1;\n if (!step) return [];\n if (step < 0) {\n step = -step;\n reversed = !reversed;\n }\n\n const dates = [];\n\n while (+date <= endTime) {\n dates.push(constructFrom(start, date));\n date.setFullYear(date.getFullYear() + step);\n }\n\n return reversed ? dates.reverse() : dates;\n}\n\n// Fallback for modularized imports:\nexport default eachYearOfInterval;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link endOfWeek} function options.\n */\n\n/**\n * @name endOfWeek\n * @category Week Helpers\n * @summary Return the end of a week for the given date.\n *\n * @description\n * Return the end of a week for the given date.\n * The result will be in the local timezone.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The end of a week\n *\n * @example\n * // The end of a week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sat Sep 06 2014 23:59:59.999\n *\n * @example\n * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:\n * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport function endOfWeek(date, options) {\n const defaultOptions = getDefaultOptions();\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const _date = toDate(date, options?.in);\n const day = _date.getDay();\n const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);\n\n _date.setDate(_date.getDate() + diff);\n _date.setHours(23, 59, 59, 999);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default endOfWeek;\n","import { endOfWeek } from \"./endOfWeek.js\";\n\n/**\n * The {@link endOfISOWeek} function options.\n */\n\n/**\n * @name endOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the end of an ISO week for the given date.\n *\n * @description\n * Return the end of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The end of an ISO week\n *\n * @example\n * // The end of an ISO week for 2 September 2014 11:55:00:\n * const result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport function endOfISOWeek(date, options) {\n return endOfWeek(date, { ...options, weekStartsOn: 1 });\n}\n\n// Fallback for modularized imports:\nexport default endOfISOWeek;\n","const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n","export function buildFormatLongFn(args) {\n return (options = {}) => {\n // TODO: Remove String()\n const width = options.width ? String(options.width) : args.defaultWidth;\n const format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\n","import { buildFormatLongFn } from \"../../_lib/buildFormatLongFn.js\";\n\nconst dateFormats = {\n full: \"EEEE, MMMM do, y\",\n long: \"MMMM do, y\",\n medium: \"MMM d, y\",\n short: \"MM/dd/yyyy\",\n};\n\nconst timeFormats = {\n full: \"h:mm:ss a zzzz\",\n long: \"h:mm:ss a z\",\n medium: \"h:mm:ss a\",\n short: \"h:mm a\",\n};\n\nconst dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: \"{{date}}, {{time}}\",\n short: \"{{date}}, {{time}}\",\n};\n\nexport const formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: \"full\",\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: \"full\",\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: \"full\",\n }),\n};\n","const formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: \"P\",\n};\n\nexport const formatRelative = (token, _date, _baseDate, _options) =>\n formatRelativeLocale[token];\n","/**\n * The localize function argument callback which allows to convert raw value to\n * the actual type.\n *\n * @param value - The value to convert\n *\n * @returns The converted value\n */\n\n/**\n * The map of localized values for each width.\n */\n\n/**\n * The index type of the locale unit value. It types conversion of units of\n * values that don't start at 0 (i.e. quarters).\n */\n\n/**\n * Converts the unit value to the tuple of values.\n */\n\n/**\n * The tuple of localized era values. The first element represents BC,\n * the second element represents AD.\n */\n\n/**\n * The tuple of localized quarter values. The first element represents Q1.\n */\n\n/**\n * The tuple of localized day values. The first element represents Sunday.\n */\n\n/**\n * The tuple of localized month values. The first element represents January.\n */\n\nexport function buildLocalizeFn(args) {\n return (value, options) => {\n const context = options?.context ? String(options.context) : \"standalone\";\n\n let valuesArray;\n if (context === \"formatting\" && args.formattingValues) {\n const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;\n const width = options?.width ? String(options.width) : defaultWidth;\n\n valuesArray =\n args.formattingValues[width] || args.formattingValues[defaultWidth];\n } else {\n const defaultWidth = args.defaultWidth;\n const width = options?.width ? String(options.width) : args.defaultWidth;\n\n valuesArray = args.values[width] || args.values[defaultWidth];\n }\n const index = args.argumentCallback ? args.argumentCallback(value) : value;\n\n // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!\n return valuesArray[index];\n };\n}\n","import { buildLocalizeFn } from \"../../_lib/buildLocalizeFn.js\";\n\nconst eraValues = {\n narrow: [\"B\", \"A\"],\n abbreviated: [\"BC\", \"AD\"],\n wide: [\"Before Christ\", \"Anno Domini\"],\n};\n\nconst quarterValues = {\n narrow: [\"1\", \"2\", \"3\", \"4\"],\n abbreviated: [\"Q1\", \"Q2\", \"Q3\", \"Q4\"],\n wide: [\"1st quarter\", \"2nd quarter\", \"3rd quarter\", \"4th quarter\"],\n};\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nconst monthValues = {\n narrow: [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"],\n abbreviated: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n\n wide: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n};\n\nconst dayValues = {\n narrow: [\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"],\n short: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"],\n abbreviated: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n wide: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n};\n\nconst dayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n },\n};\n\nconst formattingDayPeriodValues = {\n narrow: {\n am: \"a\",\n pm: \"p\",\n midnight: \"mi\",\n noon: \"n\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n abbreviated: {\n am: \"AM\",\n pm: \"PM\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n wide: {\n am: \"a.m.\",\n pm: \"p.m.\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"in the morning\",\n afternoon: \"in the afternoon\",\n evening: \"in the evening\",\n night: \"at night\",\n },\n};\n\nconst ordinalNumber = (dirtyNumber, _options) => {\n const number = Number(dirtyNumber);\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`.\n //\n // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'.\n\n const rem100 = number % 100;\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + \"st\";\n case 2:\n return number + \"nd\";\n case 3:\n return number + \"rd\";\n }\n }\n return number + \"th\";\n};\n\nexport const localize = {\n ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: \"wide\",\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: \"wide\",\n argumentCallback: (quarter) => quarter - 1,\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: \"wide\",\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: \"wide\",\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: \"wide\",\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: \"wide\",\n }),\n};\n","export function buildMatchFn(args) {\n return (string, options = {}) => {\n const width = options.width;\n\n const matchPattern =\n (width && args.matchPatterns[width]) ||\n args.matchPatterns[args.defaultMatchWidth];\n const matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n const matchedString = matchResult[0];\n\n const parsePatterns =\n (width && args.parsePatterns[width]) ||\n args.parsePatterns[args.defaultParseWidth];\n\n const key = Array.isArray(parsePatterns)\n ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))\n : // [TODO] -- I challenge you to fix the type\n findKey(parsePatterns, (pattern) => pattern.test(matchedString));\n\n let value;\n\n value = args.valueCallback ? args.valueCallback(key) : key;\n value = options.valueCallback\n ? // [TODO] -- I challenge you to fix the type\n options.valueCallback(value)\n : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n\nfunction findKey(object, predicate) {\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) &&\n predicate(object[key])\n ) {\n return key;\n }\n }\n return undefined;\n}\n\nfunction findIndex(array, predicate) {\n for (let key = 0; key < array.length; key++) {\n if (predicate(array[key])) {\n return key;\n }\n }\n return undefined;\n}\n","export function buildMatchPatternFn(args) {\n return (string, options = {}) => {\n const matchResult = string.match(args.matchPattern);\n if (!matchResult) return null;\n const matchedString = matchResult[0];\n\n const parseResult = string.match(args.parsePattern);\n if (!parseResult) return null;\n let value = args.valueCallback\n ? args.valueCallback(parseResult[0])\n : parseResult[0];\n\n // [TODO] I challenge you to fix the type\n value = options.valueCallback ? options.valueCallback(value) : value;\n\n const rest = string.slice(matchedString.length);\n\n return { value, rest };\n };\n}\n","import { buildMatchFn } from \"../../_lib/buildMatchFn.js\";\nimport { buildMatchPatternFn } from \"../../_lib/buildMatchPatternFn.js\";\n\nconst matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nconst parseOrdinalNumberPattern = /\\d+/i;\n\nconst matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i,\n};\nconst parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i],\n};\n\nconst matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i,\n};\nconst parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i],\n};\n\nconst matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,\n};\nconst parseMonthPatterns = {\n narrow: [\n /^j/i,\n /^f/i,\n /^m/i,\n /^a/i,\n /^m/i,\n /^j/i,\n /^j/i,\n /^a/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n\n any: [\n /^ja/i,\n /^f/i,\n /^mar/i,\n /^ap/i,\n /^may/i,\n /^jun/i,\n /^jul/i,\n /^au/i,\n /^s/i,\n /^o/i,\n /^n/i,\n /^d/i,\n ],\n};\n\nconst matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,\n};\nconst parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],\n};\n\nconst matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,\n};\nconst parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i,\n },\n};\n\nexport const match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: (value) => parseInt(value, 10),\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseEraPatterns,\n defaultParseWidth: \"any\",\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: \"any\",\n valueCallback: (index) => index + 1,\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: \"any\",\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: \"wide\",\n parsePatterns: parseDayPatterns,\n defaultParseWidth: \"any\",\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: \"any\",\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: \"any\",\n }),\n};\n","import { formatDistance } from \"./en-US/_lib/formatDistance.js\";\nimport { formatLong } from \"./en-US/_lib/formatLong.js\";\nimport { formatRelative } from \"./en-US/_lib/formatRelative.js\";\nimport { localize } from \"./en-US/_lib/localize.js\";\nimport { match } from \"./en-US/_lib/match.js\";\n\n/**\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)\n * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)\n */\nexport const enUS = {\n code: \"en-US\",\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1,\n },\n};\n\n// Fallback for modularized imports:\nexport default enUS;\n","import { differenceInCalendarDays } from \"./differenceInCalendarDays.js\";\nimport { startOfYear } from \"./startOfYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDayOfYear} function options.\n */\n\n/**\n * @name getDayOfYear\n * @category Day Helpers\n * @summary Get the day of the year of the given date.\n *\n * @description\n * Get the day of the year of the given date.\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The day of year\n *\n * @example\n * // Which day of the year is 2 July 2014?\n * const result = getDayOfYear(new Date(2014, 6, 2))\n * //=> 183\n */\nexport function getDayOfYear(date, options) {\n const _date = toDate(date, options?.in);\n const diff = differenceInCalendarDays(_date, startOfYear(_date));\n const dayOfYear = diff + 1;\n return dayOfYear;\n}\n\n// Fallback for modularized imports:\nexport default getDayOfYear;\n","import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfISOWeek } from \"./startOfISOWeek.js\";\nimport { startOfISOWeekYear } from \"./startOfISOWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getISOWeek} function options.\n */\n\n/**\n * @name getISOWeek\n * @category ISO Week Helpers\n * @summary Get the ISO week of the given date.\n *\n * @description\n * Get the ISO week of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * @param date - The given date\n * @param options - The options\n *\n * @returns The ISO week\n *\n * @example\n * // Which week of the ISO-week numbering year is 2 January 2005?\n * const result = getISOWeek(new Date(2005, 0, 2))\n * //=> 53\n */\nexport function getISOWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getISOWeek;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeekYear} function options.\n */\n\n/**\n * @name getWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Get the local week-numbering year of the given date.\n *\n * @description\n * Get the local week-numbering year of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options.\n *\n * @returns The local week-numbering year\n *\n * @example\n * // Which week numbering year is 26 December 2004 with the default settings?\n * const result = getWeekYear(new Date(2004, 11, 26))\n * //=> 2005\n *\n * @example\n * // Which week numbering year is 26 December 2004 if week starts on Saturday?\n * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })\n * //=> 2004\n *\n * @example\n * // Which week numbering year is 26 December 2004 if the first week contains 4 January?\n * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })\n * //=> 2004\n */\nexport function getWeekYear(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const firstWeekOfNextYear = constructFrom(options?.in || date, 0);\n firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setHours(0, 0, 0, 0);\n const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);\n\n const firstWeekOfThisYear = constructFrom(options?.in || date, 0);\n firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setHours(0, 0, 0, 0);\n const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);\n\n if (+_date >= +startOfNextYear) {\n return year + 1;\n } else if (+_date >= +startOfThisYear) {\n return year;\n } else {\n return year - 1;\n }\n}\n\n// Fallback for modularized imports:\nexport default getWeekYear;\n","import { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { constructFrom } from \"./constructFrom.js\";\nimport { getWeekYear } from \"./getWeekYear.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\n\n/**\n * The {@link startOfWeekYear} function options.\n */\n\n/**\n * @name startOfWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Return the start of a local week-numbering year for the given date.\n *\n * @description\n * Return the start of a local week-numbering year.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type.\n *\n * @param date - The original date\n * @param options - An object with options\n *\n * @returns The start of a week-numbering year\n *\n * @example\n * // The start of an a week-numbering year for 2 July 2005 with default settings:\n * const result = startOfWeekYear(new Date(2005, 6, 2))\n * //=> Sun Dec 26 2004 00:00:00\n *\n * @example\n * // The start of a week-numbering year for 2 July 2005\n * // if Monday is the first day of week\n * // and 4 January is always in the first week of the year:\n * const result = startOfWeekYear(new Date(2005, 6, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport function startOfWeekYear(date, options) {\n const defaultOptions = getDefaultOptions();\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const year = getWeekYear(date, options);\n const firstWeek = constructFrom(options?.in || date, 0);\n firstWeek.setFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setHours(0, 0, 0, 0);\n const _date = startOfWeek(firstWeek, options);\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default startOfWeekYear;\n","import { millisecondsInWeek } from \"./constants.js\";\nimport { startOfWeek } from \"./startOfWeek.js\";\nimport { startOfWeekYear } from \"./startOfWeekYear.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getWeek} function options.\n */\n\n/**\n * @name getWeek\n * @category Week Helpers\n * @summary Get the local week index of the given date.\n *\n * @description\n * Get the local week index of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The week\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005 with default options?\n * const result = getWeek(new Date(2005, 0, 2))\n * //=> 2\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005,\n * // if Monday is the first day of the week,\n * // and the first week of the year always contains 4 January?\n * const result = getWeek(new Date(2005, 0, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> 53\n */\nexport function getWeek(date, options) {\n const _date = toDate(date, options?.in);\n const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);\n\n // Round the number of weeks to the nearest integer because the number of\n // milliseconds in a week is not constant (e.g. it's different in the week of\n // the daylight saving time clock shift).\n return Math.round(diff / millisecondsInWeek) + 1;\n}\n\n// Fallback for modularized imports:\nexport default getWeek;\n","export function addLeadingZeros(number, targetLength) {\n const sign = number < 0 ? \"-\" : \"\";\n const output = Math.abs(number).toString().padStart(targetLength, \"0\");\n return sign + output;\n}\n","import { addLeadingZeros } from \"../addLeadingZeros.js\";\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | |\n * | d | Day of month | D | |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | m | Minute | M | Month |\n * | s | Second | S | Fraction of second |\n * | y | Year (abs) | Y | |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n */\n\nexport const lightFormatters = {\n // Year\n y(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return addLeadingZeros(token === \"yy\" ? year % 100 : year, token.length);\n },\n\n // Month\n M(date, token) {\n const month = date.getMonth();\n return token === \"M\" ? String(month + 1) : addLeadingZeros(month + 1, 2);\n },\n\n // Day of the month\n d(date, token) {\n return addLeadingZeros(date.getDate(), token.length);\n },\n\n // AM or PM\n a(date, token) {\n const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return dayPeriodEnumValue.toUpperCase();\n case \"aaa\":\n return dayPeriodEnumValue;\n case \"aaaaa\":\n return dayPeriodEnumValue[0];\n case \"aaaa\":\n default:\n return dayPeriodEnumValue === \"am\" ? \"a.m.\" : \"p.m.\";\n }\n },\n\n // Hour [1-12]\n h(date, token) {\n return addLeadingZeros(date.getHours() % 12 || 12, token.length);\n },\n\n // Hour [0-23]\n H(date, token) {\n return addLeadingZeros(date.getHours(), token.length);\n },\n\n // Minute\n m(date, token) {\n return addLeadingZeros(date.getMinutes(), token.length);\n },\n\n // Second\n s(date, token) {\n return addLeadingZeros(date.getSeconds(), token.length);\n },\n\n // Fraction of second\n S(date, token) {\n const numberOfDigits = token.length;\n const milliseconds = date.getMilliseconds();\n const fractionalSeconds = Math.trunc(\n milliseconds * Math.pow(10, numberOfDigits - 3),\n );\n return addLeadingZeros(fractionalSeconds, token.length);\n },\n};\n","import { getDayOfYear } from \"../../getDayOfYear.js\";\nimport { getISOWeek } from \"../../getISOWeek.js\";\nimport { getISOWeekYear } from \"../../getISOWeekYear.js\";\nimport { getWeek } from \"../../getWeek.js\";\nimport { getWeekYear } from \"../../getWeekYear.js\";\n\nimport { addLeadingZeros } from \"../addLeadingZeros.js\";\nimport { lightFormatters } from \"./lightFormatters.js\";\n\nconst dayPeriodEnum = {\n am: \"am\",\n pm: \"pm\",\n midnight: \"midnight\",\n noon: \"noon\",\n morning: \"morning\",\n afternoon: \"afternoon\",\n evening: \"evening\",\n night: \"night\",\n};\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nexport const formatters = {\n // Era\n G: function (date, token, localize) {\n const era = date.getFullYear() > 0 ? 1 : 0;\n switch (token) {\n // AD, BC\n case \"G\":\n case \"GG\":\n case \"GGG\":\n return localize.era(era, { width: \"abbreviated\" });\n // A, B\n case \"GGGGG\":\n return localize.era(era, { width: \"narrow\" });\n // Anno Domini, Before Christ\n case \"GGGG\":\n default:\n return localize.era(era, { width: \"wide\" });\n }\n },\n\n // Year\n y: function (date, token, localize) {\n // Ordinal number\n if (token === \"yo\") {\n const signedYear = date.getFullYear();\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const year = signedYear > 0 ? signedYear : 1 - signedYear;\n return localize.ordinalNumber(year, { unit: \"year\" });\n }\n\n return lightFormatters.y(date, token);\n },\n\n // Local week-numbering year\n Y: function (date, token, localize, options) {\n const signedWeekYear = getWeekYear(date, options);\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;\n\n // Two digit year\n if (token === \"YY\") {\n const twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n }\n\n // Ordinal number\n if (token === \"Yo\") {\n return localize.ordinalNumber(weekYear, { unit: \"year\" });\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length);\n },\n\n // ISO week-numbering year\n R: function (date, token) {\n const isoWeekYear = getISOWeekYear(date);\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length);\n },\n\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function (date, token) {\n const year = date.getFullYear();\n return addLeadingZeros(year, token.length);\n },\n\n // Quarter\n Q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"Q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"QQ\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"Qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"QQQ\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"QQQQQ\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"QQQQ\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone quarter\n q: function (date, token, localize) {\n const quarter = Math.ceil((date.getMonth() + 1) / 3);\n switch (token) {\n // 1, 2, 3, 4\n case \"q\":\n return String(quarter);\n // 01, 02, 03, 04\n case \"qq\":\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n case \"qo\":\n return localize.ordinalNumber(quarter, { unit: \"quarter\" });\n // Q1, Q2, Q3, Q4\n case \"qqq\":\n return localize.quarter(quarter, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case \"qqqqq\":\n return localize.quarter(quarter, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // 1st quarter, 2nd quarter, ...\n case \"qqqq\":\n default:\n return localize.quarter(quarter, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // Month\n M: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n case \"M\":\n case \"MM\":\n return lightFormatters.M(date, token);\n // 1st, 2nd, ..., 12th\n case \"Mo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"MMM\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // J, F, ..., D\n case \"MMMMM\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // January, February, ..., December\n case \"MMMM\":\n default:\n return localize.month(month, { width: \"wide\", context: \"formatting\" });\n }\n },\n\n // Stand-alone month\n L: function (date, token, localize) {\n const month = date.getMonth();\n switch (token) {\n // 1, 2, ..., 12\n case \"L\":\n return String(month + 1);\n // 01, 02, ..., 12\n case \"LL\":\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n case \"Lo\":\n return localize.ordinalNumber(month + 1, { unit: \"month\" });\n // Jan, Feb, ..., Dec\n case \"LLL\":\n return localize.month(month, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // J, F, ..., D\n case \"LLLLL\":\n return localize.month(month, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // January, February, ..., December\n case \"LLLL\":\n default:\n return localize.month(month, { width: \"wide\", context: \"standalone\" });\n }\n },\n\n // Local week of year\n w: function (date, token, localize, options) {\n const week = getWeek(date, options);\n\n if (token === \"wo\") {\n return localize.ordinalNumber(week, { unit: \"week\" });\n }\n\n return addLeadingZeros(week, token.length);\n },\n\n // ISO week of year\n I: function (date, token, localize) {\n const isoWeek = getISOWeek(date);\n\n if (token === \"Io\") {\n return localize.ordinalNumber(isoWeek, { unit: \"week\" });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n\n // Day of the month\n d: function (date, token, localize) {\n if (token === \"do\") {\n return localize.ordinalNumber(date.getDate(), { unit: \"date\" });\n }\n\n return lightFormatters.d(date, token);\n },\n\n // Day of year\n D: function (date, token, localize) {\n const dayOfYear = getDayOfYear(date);\n\n if (token === \"Do\") {\n return localize.ordinalNumber(dayOfYear, { unit: \"dayOfYear\" });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n\n // Day of week\n E: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n switch (token) {\n // Tue\n case \"E\":\n case \"EE\":\n case \"EEE\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"EEEEE\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"EEEEEE\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"EEEE\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Local day of week\n e: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case \"e\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"ee\":\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n case \"eo\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"eee\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"eeeee\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"eeeeee\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"eeee\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Stand-alone local day of week\n c: function (date, token, localize, options) {\n const dayOfWeek = date.getDay();\n const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n switch (token) {\n // Numerical value (same as in `e`)\n case \"c\":\n return String(localDayOfWeek);\n // Padded numerical value\n case \"cc\":\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n case \"co\":\n return localize.ordinalNumber(localDayOfWeek, { unit: \"day\" });\n case \"ccc\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"standalone\",\n });\n // T\n case \"ccccc\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"standalone\",\n });\n // Tu\n case \"cccccc\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"standalone\",\n });\n // Tuesday\n case \"cccc\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"standalone\",\n });\n }\n },\n\n // ISO day of week\n i: function (date, token, localize) {\n const dayOfWeek = date.getDay();\n const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n switch (token) {\n // 2\n case \"i\":\n return String(isoDayOfWeek);\n // 02\n case \"ii\":\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n case \"io\":\n return localize.ordinalNumber(isoDayOfWeek, { unit: \"day\" });\n // Tue\n case \"iii\":\n return localize.day(dayOfWeek, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n // T\n case \"iiiii\":\n return localize.day(dayOfWeek, {\n width: \"narrow\",\n context: \"formatting\",\n });\n // Tu\n case \"iiiiii\":\n return localize.day(dayOfWeek, {\n width: \"short\",\n context: \"formatting\",\n });\n // Tuesday\n case \"iiii\":\n default:\n return localize.day(dayOfWeek, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM or PM\n a: function (date, token, localize) {\n const hours = date.getHours();\n const dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n\n switch (token) {\n case \"a\":\n case \"aa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"aaa\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"aaaaa\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"aaaa\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // AM, PM, midnight, noon\n b: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? \"pm\" : \"am\";\n }\n\n switch (token) {\n case \"b\":\n case \"bb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"bbb\":\n return localize\n .dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n })\n .toLowerCase();\n case \"bbbbb\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"bbbb\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: function (date, token, localize) {\n const hours = date.getHours();\n let dayPeriodEnumValue;\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case \"B\":\n case \"BB\":\n case \"BBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"abbreviated\",\n context: \"formatting\",\n });\n case \"BBBBB\":\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"narrow\",\n context: \"formatting\",\n });\n case \"BBBB\":\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: \"wide\",\n context: \"formatting\",\n });\n }\n },\n\n // Hour [1-12]\n h: function (date, token, localize) {\n if (token === \"ho\") {\n let hours = date.getHours() % 12;\n if (hours === 0) hours = 12;\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return lightFormatters.h(date, token);\n },\n\n // Hour [0-23]\n H: function (date, token, localize) {\n if (token === \"Ho\") {\n return localize.ordinalNumber(date.getHours(), { unit: \"hour\" });\n }\n\n return lightFormatters.H(date, token);\n },\n\n // Hour [0-11]\n K: function (date, token, localize) {\n const hours = date.getHours() % 12;\n\n if (token === \"Ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Hour [1-24]\n k: function (date, token, localize) {\n let hours = date.getHours();\n if (hours === 0) hours = 24;\n\n if (token === \"ko\") {\n return localize.ordinalNumber(hours, { unit: \"hour\" });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n\n // Minute\n m: function (date, token, localize) {\n if (token === \"mo\") {\n return localize.ordinalNumber(date.getMinutes(), { unit: \"minute\" });\n }\n\n return lightFormatters.m(date, token);\n },\n\n // Second\n s: function (date, token, localize) {\n if (token === \"so\") {\n return localize.ordinalNumber(date.getSeconds(), { unit: \"second\" });\n }\n\n return lightFormatters.s(date, token);\n },\n\n // Fraction of second\n S: function (date, token) {\n return lightFormatters.S(date, token);\n },\n\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return \"Z\";\n }\n\n switch (token) {\n // Hours and optional minutes\n case \"X\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case \"XXXX\":\n case \"XX\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case \"XXXXX\":\n case \"XXX\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case \"x\":\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case \"xxxx\":\n case \"xx\": // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset);\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case \"xxxxx\":\n case \"xxx\": // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (GMT)\n O: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"O\":\n case \"OO\":\n case \"OOO\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"OOOO\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Timezone (specific non-location)\n z: function (date, token, _localize) {\n const timezoneOffset = date.getTimezoneOffset();\n\n switch (token) {\n // Short\n case \"z\":\n case \"zz\":\n case \"zzz\":\n return \"GMT\" + formatTimezoneShort(timezoneOffset, \":\");\n // Long\n case \"zzzz\":\n default:\n return \"GMT\" + formatTimezone(timezoneOffset, \":\");\n }\n },\n\n // Seconds timestamp\n t: function (date, token, _localize) {\n const timestamp = Math.trunc(+date / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n\n // Milliseconds timestamp\n T: function (date, token, _localize) {\n return addLeadingZeros(+date, token.length);\n },\n};\n\nfunction formatTimezoneShort(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = Math.trunc(absOffset / 60);\n const minutes = absOffset % 60;\n if (minutes === 0) {\n return sign + String(hours);\n }\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, delimiter) {\n if (offset % 60 === 0) {\n const sign = offset > 0 ? \"-\" : \"+\";\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n return formatTimezone(offset, delimiter);\n}\n\nfunction formatTimezone(offset, delimiter = \"\") {\n const sign = offset > 0 ? \"-\" : \"+\";\n const absOffset = Math.abs(offset);\n const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);\n const minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimiter + minutes;\n}\n","const dateLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"P\":\n return formatLong.date({ width: \"short\" });\n case \"PP\":\n return formatLong.date({ width: \"medium\" });\n case \"PPP\":\n return formatLong.date({ width: \"long\" });\n case \"PPPP\":\n default:\n return formatLong.date({ width: \"full\" });\n }\n};\n\nconst timeLongFormatter = (pattern, formatLong) => {\n switch (pattern) {\n case \"p\":\n return formatLong.time({ width: \"short\" });\n case \"pp\":\n return formatLong.time({ width: \"medium\" });\n case \"ppp\":\n return formatLong.time({ width: \"long\" });\n case \"pppp\":\n default:\n return formatLong.time({ width: \"full\" });\n }\n};\n\nconst dateTimeLongFormatter = (pattern, formatLong) => {\n const matchResult = pattern.match(/(P+)(p+)?/) || [];\n const datePattern = matchResult[1];\n const timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n let dateTimeFormat;\n\n switch (datePattern) {\n case \"P\":\n dateTimeFormat = formatLong.dateTime({ width: \"short\" });\n break;\n case \"PP\":\n dateTimeFormat = formatLong.dateTime({ width: \"medium\" });\n break;\n case \"PPP\":\n dateTimeFormat = formatLong.dateTime({ width: \"long\" });\n break;\n case \"PPPP\":\n default:\n dateTimeFormat = formatLong.dateTime({ width: \"full\" });\n break;\n }\n\n return dateTimeFormat\n .replace(\"{{date}}\", dateLongFormatter(datePattern, formatLong))\n .replace(\"{{time}}\", timeLongFormatter(timePattern, formatLong));\n};\n\nexport const longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter,\n};\n","const dayOfYearTokenRE = /^D+$/;\nconst weekYearTokenRE = /^Y+$/;\n\nconst throwTokens = [\"D\", \"DD\", \"YY\", \"YYYY\"];\n\nexport function isProtectedDayOfYearToken(token) {\n return dayOfYearTokenRE.test(token);\n}\n\nexport function isProtectedWeekYearToken(token) {\n return weekYearTokenRE.test(token);\n}\n\nexport function warnOrThrowProtectedError(token, format, input) {\n const _message = message(token, format, input);\n console.warn(_message);\n if (throwTokens.includes(token)) throw new RangeError(_message);\n}\n\nfunction message(token, format, input) {\n const subject = token[0] === \"Y\" ? \"years\" : \"days of the month\";\n return `Use \\`${token.toLowerCase()}\\` instead of \\`${token}\\` (in \\`${format}\\`) for formatting ${subject} to the input \\`${input}\\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;\n}\n","import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { formatters } from \"./_lib/format/formatters.js\";\nimport { longFormatters } from \"./_lib/format/longFormatters.js\";\nimport {\n isProtectedDayOfYearToken,\n isProtectedWeekYearToken,\n warnOrThrowProtectedError,\n} from \"./_lib/protectedTokens.js\";\nimport { isValid } from \"./isValid.js\";\nimport { toDate } from \"./toDate.js\";\n\n// Rexports of internal for libraries to use.\n// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874\nexport { formatters, longFormatters };\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nconst formattingTokensRegExp =\n /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nconst longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nconst escapedStringRegExp = /^'([^]*?)'?$/;\nconst doubleQuoteRegExp = /''/g;\nconst unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\nexport { format as formatDate };\n\n/**\n * The {@link format} function options.\n */\n\n/**\n * @name format\n * @alias formatDate\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)\n * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param date - The original date\n * @param format - The string of tokens\n * @param options - An object with options\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `localize` property\n * @throws `options.locale` must contain `formatLong` property\n * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const originalDate = toDate(date, options?.in);\n\n if (!isValid(originalDate)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n let parts = formatStr\n .match(longFormattingTokensRegExp)\n .map((substring) => {\n const firstCharacter = substring[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n })\n .join(\"\")\n .match(formattingTokensRegExp)\n .map((substring) => {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return { isToken: false, value: \"'\" };\n }\n\n const firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return { isToken: false, value: cleanEscapedString(substring) };\n }\n\n if (formatters[firstCharacter]) {\n return { isToken: true, value: substring };\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError(\n \"Format string contains an unescaped latin alphabet character `\" +\n firstCharacter +\n \"`\",\n );\n }\n\n return { isToken: false, value: substring };\n });\n\n // invoke localize preprocessor (only for french locales at the moment)\n if (locale.localize.preprocessor) {\n parts = locale.localize.preprocessor(originalDate, parts);\n }\n\n const formatterOptions = {\n firstWeekContainsDate,\n weekStartsOn,\n locale,\n };\n\n return parts\n .map((part) => {\n if (!part.isToken) return part.value;\n\n const token = part.value;\n\n if (\n (!options?.useAdditionalWeekYearTokens &&\n isProtectedWeekYearToken(token)) ||\n (!options?.useAdditionalDayOfYearTokens &&\n isProtectedDayOfYearToken(token))\n ) {\n warnOrThrowProtectedError(token, formatStr, String(date));\n }\n\n const formatter = formatters[token[0]];\n return formatter(originalDate, token, locale.localize, formatterOptions);\n })\n .join(\"\");\n}\n\nfunction cleanEscapedString(input) {\n const matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\n\n// Fallback for modularized imports:\nexport default format;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getDaysInMonth} function options.\n */\n\n/**\n * @name getDaysInMonth\n * @category Month Helpers\n * @summary Get the number of days in a month of the given date.\n *\n * @description\n * Get the number of days in a month of the given date, considering the context if provided.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The number of days in a month\n *\n * @example\n * // How many days are in February 2000?\n * const result = getDaysInMonth(new Date(2000, 1))\n * //=> 29\n */\nexport function getDaysInMonth(date, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n const monthIndex = _date.getMonth();\n const lastDayOfMonth = constructFrom(_date, 0);\n lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);\n lastDayOfMonth.setHours(0, 0, 0, 0);\n return lastDayOfMonth.getDate();\n}\n\n// Fallback for modularized imports:\nexport default getDaysInMonth;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getMonth} function options.\n */\n\n/**\n * @name getMonth\n * @category Month Helpers\n * @summary Get the month of the given date.\n *\n * @description\n * Get the month of the given date.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The month index (0-11)\n *\n * @example\n * // Which month is 29 February 2012?\n * const result = getMonth(new Date(2012, 1, 29))\n * //=> 1\n */\nexport function getMonth(date, options) {\n return toDate(date, options?.in).getMonth();\n}\n\n// Fallback for modularized imports:\nexport default getMonth;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * The {@link getYear} function options.\n */\n\n/**\n * @name getYear\n * @category Year Helpers\n * @summary Get the year of the given date.\n *\n * @description\n * Get the year of the given date.\n *\n * @param date - The given date\n * @param options - An object with options\n *\n * @returns The year\n *\n * @example\n * // Which year is 2 July 2014?\n * const result = getYear(new Date(2014, 6, 2))\n * //=> 2014\n */\nexport function getYear(date, options) {\n return toDate(date, options?.in).getFullYear();\n}\n\n// Fallback for modularized imports:\nexport default getYear;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one?\n *\n * @description\n * Is the first date after the second one?\n *\n * @param date - The date that should be after the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is after the second date\n *\n * @example\n * // Is 10 July 1989 after 11 February 1987?\n * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> true\n */\nexport function isAfter(date, dateToCompare) {\n return +toDate(date) > +toDate(dateToCompare);\n}\n\n// Fallback for modularized imports:\nexport default isAfter;\n","import { toDate } from \"./toDate.js\";\n\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param date - The date that should be before the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is before the second date\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\nexport function isBefore(date, dateToCompare) {\n return +toDate(date) < +toDate(dateToCompare);\n}\n\n// Fallback for modularized imports:\nexport default isBefore;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link isSameMonth} function options.\n */\n\n/**\n * @name isSameMonth\n * @category Month Helpers\n * @summary Are the given dates in the same month (and year)?\n *\n * @description\n * Are the given dates in the same month (and year)?\n *\n * @param laterDate - The first date to check\n * @param earlierDate - The second date to check\n * @param options - An object with options\n *\n * @returns The dates are in the same month (and year)\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n *\n * @example\n * // Are 2 September 2014 and 25 September 2015 in the same month?\n * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))\n * //=> false\n */\nexport function isSameMonth(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n return (\n laterDate_.getFullYear() === earlierDate_.getFullYear() &&\n laterDate_.getMonth() === earlierDate_.getMonth()\n );\n}\n\n// Fallback for modularized imports:\nexport default isSameMonth;\n","import { normalizeDates } from \"./_lib/normalizeDates.js\";\n\n/**\n * The {@link isSameYear} function options.\n */\n\n/**\n * @name isSameYear\n * @category Year Helpers\n * @summary Are the given dates in the same year?\n *\n * @description\n * Are the given dates in the same year?\n *\n * @param laterDate - The first date to check\n * @param earlierDate - The second date to check\n * @param options - An object with options\n *\n * @returns The dates are in the same year\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same year?\n * const result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n */\nexport function isSameYear(laterDate, earlierDate, options) {\n const [laterDate_, earlierDate_] = normalizeDates(\n options?.in,\n laterDate,\n earlierDate,\n );\n return laterDate_.getFullYear() === earlierDate_.getFullYear();\n}\n\n// Fallback for modularized imports:\nexport default isSameYear;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { getDaysInMonth } from \"./getDaysInMonth.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link setMonth} function options.\n */\n\n/**\n * @name setMonth\n * @category Month Helpers\n * @summary Set the month to the given date.\n *\n * @description\n * Set the month to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param month - The month index to set (0-11)\n * @param options - The options\n *\n * @returns The new date with the month set\n *\n * @example\n * // Set February to 1 September 2014:\n * const result = setMonth(new Date(2014, 8, 1), 1)\n * //=> Sat Feb 01 2014 00:00:00\n */\nexport function setMonth(date, month, options) {\n const _date = toDate(date, options?.in);\n const year = _date.getFullYear();\n const day = _date.getDate();\n\n const midMonth = constructFrom(options?.in || date, 0);\n midMonth.setFullYear(year, month, 15);\n midMonth.setHours(0, 0, 0, 0);\n const daysInMonth = getDaysInMonth(midMonth);\n\n // Set the earlier date, allows to wrap Jan 31 to Feb 28\n _date.setMonth(month, Math.min(day, daysInMonth));\n return _date;\n}\n\n// Fallback for modularized imports:\nexport default setMonth;\n","import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link setYear} function options.\n */\n\n/**\n * @name setYear\n * @category Year Helpers\n * @summary Set the year to the given date.\n *\n * @description\n * Set the year to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param year - The year of the new date\n * @param options - An object with options.\n *\n * @returns The new date with the year set\n *\n * @example\n * // Set year 2013 to 1 September 2014:\n * const result = setYear(new Date(2014, 8, 1), 2013)\n * //=> Sun Sep 01 2013 00:00:00\n */\nexport function setYear(date, year, options) {\n const date_ = toDate(date, options?.in);\n\n // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date\n if (isNaN(+date_)) return constructFrom(options?.in || date, NaN);\n\n date_.setFullYear(year);\n return date_;\n}\n\n// Fallback for modularized imports:\nexport default setYear;\n","/**\n * Time zone name format.\n */\n\n/**\n * The function returns the time zone name for the given date in the specified\n * time zone.\n *\n * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone\n * name in a long format, e.g. \"Pacific Standard Time\" or\n * \"Singapore Standard Time\".\n *\n * It is possible to specify the format as the third argument using one of the following options\n *\n * - \"short\": e.g. \"EDT\" or \"GMT+8\".\n * - \"long\": e.g. \"Eastern Daylight Time\".\n * - \"shortGeneric\": e.g. \"ET\" or \"Singapore Time\".\n * - \"longGeneric\": e.g. \"Eastern Time\" or \"Singapore Standard Time\".\n *\n * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n * @param date - Date object to get the time zone name for\n * @param format - Optional format of the time zone name. Defaults to \"long\". Can be \"short\", \"long\", \"shortGeneric\", or \"longGeneric\".\n *\n * @returns Time zone name (e.g. \"Singapore Standard Time\")\n */\nexport function tzName(timeZone, date, format = \"long\") {\n return new Intl.DateTimeFormat(\"en-US\", {\n // Enforces engine to render the time. Without the option JavaScriptCore omits it.\n hour: \"numeric\",\n timeZone: timeZone,\n timeZoneName: format\n }).format(date).split(/\\s/g) // Format.JS uses non-breaking spaces\n .slice(2) // Skip the hour and AM/PM parts\n .join(\" \");\n}","const offsetFormatCache = {};\nconst offsetCache = {};\n\n/**\n * The function extracts UTC offset in minutes from the given date in specified\n * time zone.\n *\n * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value\n * mirrored to the sign of the offset in the time zone. For Asia/Singapore\n * (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n * @param date - Date to check the offset for\n *\n * @returns UTC offset in minutes\n */\nexport function tzOffset(timeZone, date) {\n try {\n const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n timeZoneName: \"longOffset\"\n }).format;\n const offsetStr = format(date).split(\"GMT\")[1];\n if (offsetStr in offsetCache) return offsetCache[offsetStr];\n return calcOffset(offsetStr, offsetStr.split(\":\"));\n } catch {\n // Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH\n // See: https://github.com/nodejs/node/issues/53419\n if (timeZone in offsetCache) return offsetCache[timeZone];\n const captures = timeZone?.match(offsetRe);\n if (captures) return calcOffset(timeZone, captures.slice(1));\n return NaN;\n }\n}\nconst offsetRe = /([+-]\\d\\d):?(\\d\\d)?/;\nfunction calcOffset(cacheStr, values) {\n const hours = +(values[0] || 0);\n const minutes = +(values[1] || 0);\n // Convert seconds to minutes by dividing by 60 to keep the function return in minutes.\n const seconds = +(values[2] || 0) / 60;\n return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;\n}","import { tzOffset } from \"../tzOffset/index.js\";\nexport class TZDateMini extends Date {\n //#region static\n\n constructor(...args) {\n super();\n if (args.length > 1 && typeof args[args.length - 1] === \"string\") {\n this.timeZone = args.pop();\n }\n this.internal = new Date();\n if (isNaN(tzOffset(this.timeZone, this))) {\n this.setTime(NaN);\n } else {\n if (!args.length) {\n this.setTime(Date.now());\n } else if (typeof args[0] === \"number\" && (args.length === 1 || args.length === 2 && typeof args[1] !== \"number\")) {\n this.setTime(args[0]);\n } else if (typeof args[0] === \"string\") {\n this.setTime(+new Date(args[0]));\n } else if (args[0] instanceof Date) {\n this.setTime(+args[0]);\n } else {\n this.setTime(+new Date(...args));\n adjustToSystemTZ(this, NaN);\n syncToInternal(this);\n }\n }\n }\n static tz(tz, ...args) {\n return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);\n }\n\n //#endregion\n\n //#region time zone\n\n withTimeZone(timeZone) {\n return new TZDateMini(+this, timeZone);\n }\n getTimezoneOffset() {\n const offset = -tzOffset(this.timeZone, this);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n return offset > 0 ? Math.floor(offset) : Math.ceil(offset);\n }\n\n //#endregion\n\n //#region time\n\n setTime(time) {\n Date.prototype.setTime.apply(this, arguments);\n syncToInternal(this);\n return +this;\n }\n\n //#endregion\n\n //#region date-fns integration\n\n [Symbol.for(\"constructDateFrom\")](date) {\n return new TZDateMini(+new Date(date), this.timeZone);\n }\n\n //#endregion\n}\n\n// Assign getters and setters\nconst re = /^(get|set)(?!UTC)/;\nObject.getOwnPropertyNames(Date.prototype).forEach(method => {\n if (!re.test(method)) return;\n const utcMethod = method.replace(re, \"$1UTC\");\n // Filter out methods without UTC counterparts\n if (!TZDateMini.prototype[utcMethod]) return;\n if (method.startsWith(\"get\")) {\n // Delegate to internal date's UTC method\n TZDateMini.prototype[method] = function () {\n return this.internal[utcMethod]();\n };\n } else {\n // Assign regular setter\n TZDateMini.prototype[method] = function () {\n Date.prototype[utcMethod].apply(this.internal, arguments);\n syncFromInternal(this);\n return +this;\n };\n\n // Assign UTC setter\n TZDateMini.prototype[utcMethod] = function () {\n Date.prototype[utcMethod].apply(this, arguments);\n syncToInternal(this);\n return +this;\n };\n }\n});\n\n/**\n * Function syncs time to internal date, applying the time zone offset.\n *\n * @param {Date} date - Date to sync\n */\nfunction syncToInternal(date) {\n date.internal.setTime(+date);\n date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));\n}\n\n/**\n * Function syncs the internal date UTC values to the date. It allows to get\n * accurate timestamp value.\n *\n * @param {Date} date - The date to sync\n */\nfunction syncFromInternal(date) {\n // First we transpose the internal values\n Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());\n Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());\n\n // Now we have to adjust the date to the system time zone\n adjustToSystemTZ(date);\n}\n\n/**\n * Function adjusts the date to the system time zone. It uses the time zone\n * differences to calculate the offset and adjust the date.\n *\n * @param {Date} date - Date to adjust\n */\nfunction adjustToSystemTZ(date) {\n // Save the time zone offset before all the adjustments\n const baseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);\n //#region System DST adjustment\n\n // The biggest problem with using the system time zone is that when we create\n // a date from internal values stored in UTC, the system time zone might end\n // up on the DST hour:\n //\n // $ TZ=America/New_York node\n // > new Date(2020, 2, 8, 1).toString()\n // 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'\n // > new Date(2020, 2, 8, 2).toString()\n // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'\n // > new Date(2020, 2, 8, 3).toString()\n // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'\n // > new Date(2020, 2, 8, 4).toString()\n // 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'\n //\n // Here we get the same hour for both 2 and 3, because the system time zone\n // has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have\n // to adjust the internal date to reflect that.\n //\n // However we want to adjust only if that's the DST hour the change happenes,\n // not the hour where DST moves to.\n\n // We calculate the previous hour to see if the time zone offset has changed\n // and we have landed on the DST hour.\n const prevHour = new Date(+date);\n // We use UTC methods here as we don't want to land on the same hour again\n // in case of DST.\n prevHour.setUTCHours(prevHour.getUTCHours() - 1);\n\n // Calculate if we are on the system DST hour.\n const systemOffset = -new Date(+date).getTimezoneOffset();\n const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();\n const systemDSTChange = systemOffset - prevHourSystemOffset;\n // Detect the DST shift. System DST change will occur both on\n const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();\n\n // Move the internal date when we are on the system DST hour.\n if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);\n\n //#endregion\n\n //#region System diff adjustment\n\n // Now we need to adjust the date, since we just applied internal values.\n // We need to calculate the difference between the system and date time zones\n // and apply it to the date.\n\n const offsetDiff = systemOffset - offset;\n if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);\n\n //#endregion\n\n //#region Seconds System diff adjustment\n\n const systemDate = new Date(+date);\n // Set the UTC seconds to 0 to isolate the timezone offset in seconds.\n systemDate.setUTCSeconds(0);\n // For negative systemOffset, invert the seconds.\n const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;\n\n // Calculate the seconds offset based on the timezone offset.\n const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;\n if (secondsOffset || systemSecondsOffset) {\n date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);\n Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);\n }\n\n //#endregion\n\n //#region Post-adjustment DST fix\n\n const postBaseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);\n const postSystemOffset = -new Date(+date).getTimezoneOffset();\n const postOffsetDiff = postSystemOffset - postOffset;\n const offsetChanged = postOffset !== offset;\n const postDiff = postOffsetDiff - offsetDiff;\n if (offsetChanged && postDiff) {\n Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);\n\n // Now we need to check if got offset change during the post-adjustment.\n // If so, we also need both dates to reflect that.\n\n const newBaseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);\n const offsetChange = postOffset - newOffset;\n if (offsetChange) {\n date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);\n Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);\n }\n }\n\n //#endregion\n}","import { tzName } from \"../tzName/index.js\";\nimport { TZDateMini } from \"./mini.js\";\nexport class TZDate extends TZDateMini {\n //#region static\n\n static tz(tz, ...args) {\n return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);\n }\n\n //#endregion\n\n //#region representation\n\n toISOString() {\n const [sign, hours, minutes] = this.tzComponents();\n const tz = `${sign}${hours}:${minutes}`;\n return this.internal.toISOString().slice(0, -1) + tz;\n }\n toString() {\n // \"Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)\";\n return `${this.toDateString()} ${this.toTimeString()}`;\n }\n toDateString() {\n // toUTCString returns RFC 7231 (\"Mon, 12 Aug 2024 23:36:08 GMT\")\n const [day, date, month, year] = this.internal.toUTCString().split(\" \");\n // \"Tue Aug 13 2024\"\n return `${day?.slice(0, -1) /* Remove \",\" */} ${month} ${date} ${year}`;\n }\n toTimeString() {\n // toUTCString returns RFC 7231 (\"Mon, 12 Aug 2024 23:36:08 GMT\")\n const time = this.internal.toUTCString().split(\" \")[4];\n const [sign, hours, minutes] = this.tzComponents();\n // \"07:42:23 GMT+0800 (Singapore Standard Time)\"\n return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;\n }\n toLocaleString(locales, options) {\n return Date.prototype.toLocaleString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n toLocaleDateString(locales, options) {\n return Date.prototype.toLocaleDateString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n toLocaleTimeString(locales, options) {\n return Date.prototype.toLocaleTimeString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n\n //#endregion\n\n //#region private\n\n tzComponents() {\n const offset = this.getTimezoneOffset();\n const sign = offset > 0 ? \"-\" : \"+\";\n const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, \"0\");\n const minutes = String(Math.abs(offset) % 60).padStart(2, \"0\");\n return [sign, hours, minutes];\n }\n\n //#endregion\n\n withTimeZone(timeZone) {\n return new TZDate(+this, timeZone);\n }\n\n //#region date-fns integration\n\n [Symbol.for(\"constructDateFrom\")](date) {\n return new TZDate(+new Date(date), this.timeZone);\n }\n\n //#endregion\n}","const FIVE_WEEKS = 5;\nconst FOUR_WEEKS = 4;\n/**\n * Returns the number of weeks to display in the broadcast calendar for a given\n * month.\n *\n * The broadcast calendar may have either 4 or 5 weeks in a month, depending on\n * the start and end dates of the broadcast weeks.\n *\n * @since 9.4.0\n * @param month The month for which to calculate the number of weeks.\n * @param dateLib The date library to use for date manipulation.\n * @returns The number of weeks in the broadcast calendar (4 or 5).\n */\nexport function getBroadcastWeeksInMonth(month, dateLib) {\n // Get the first day of the month\n const firstDayOfMonth = dateLib.startOfMonth(month);\n // Get the day of the week for the first day of the month (1-7, where 1 is Monday)\n const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;\n const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);\n const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);\n const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek)\n ? FIVE_WEEKS\n : FOUR_WEEKS;\n return numberOfWeeks;\n}\n","/**\n * Returns the start date of the week in the broadcast calendar.\n *\n * The broadcast week starts on Monday. If the first day of the month is not a\n * Monday, this function calculates the previous Monday as the start of the\n * broadcast week.\n *\n * @since 9.4.0\n * @param date The date for which to calculate the start of the broadcast week.\n * @param dateLib The date library to use for date manipulation.\n * @returns The start date of the broadcast week.\n */\nexport function startOfBroadcastWeek(date, dateLib) {\n const firstOfMonth = dateLib.startOfMonth(date);\n const dayOfWeek = firstOfMonth.getDay();\n if (dayOfWeek === 1) {\n return firstOfMonth;\n }\n else if (dayOfWeek === 0) {\n return dateLib.addDays(firstOfMonth, -1 * 6);\n }\n else {\n return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));\n }\n}\n","import { getBroadcastWeeksInMonth } from \"./getBroadcastWeeksInMonth.js\";\nimport { startOfBroadcastWeek } from \"./startOfBroadcastWeek.js\";\n/**\n * Returns the end date of the week in the broadcast calendar.\n *\n * The broadcast week ends on the last day of the last broadcast week for the\n * given date.\n *\n * @since 9.4.0\n * @param date The date for which to calculate the end of the broadcast week.\n * @param dateLib The date library to use for date manipulation.\n * @returns The end date of the broadcast week.\n */\nexport function endOfBroadcastWeek(date, dateLib) {\n const startDate = startOfBroadcastWeek(date, dateLib);\n const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);\n const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);\n return endDate;\n}\n","import { format } from \"date-fns\";\nimport { enUS as dateFnsEnUS } from \"date-fns/locale\";\n/** English (United States) locale extended with DayPicker-specific translations. */\nexport const enUS = {\n ...dateFnsEnUS,\n labels: {\n labelDayButton: (date, modifiers, options, dateLib) => {\n let formatDate;\n if (dateLib && typeof dateLib.format === \"function\") {\n formatDate = dateLib.format.bind(dateLib);\n }\n else {\n formatDate = (d, pattern) => format(d, pattern, { locale: dateFnsEnUS, ...options });\n }\n let label = formatDate(date, \"PPPP\");\n if (modifiers.today)\n label = `Today, ${label}`;\n if (modifiers.selected)\n label = `${label}, selected`;\n return label;\n },\n labelMonthDropdown: \"Choose the Month\",\n labelNext: \"Go to the Next Month\",\n labelPrevious: \"Go to the Previous Month\",\n labelWeekNumber: (weekNumber) => `Week ${weekNumber}`,\n labelYearDropdown: \"Choose the Year\",\n labelGrid: (date, options, dateLib) => {\n let formatDate;\n if (dateLib && typeof dateLib.format === \"function\") {\n formatDate = dateLib.format.bind(dateLib);\n }\n else {\n formatDate = (d, pattern) => format(d, pattern, { locale: dateFnsEnUS, ...options });\n }\n return formatDate(date, \"LLLL yyyy\");\n },\n labelGridcell: (date, modifiers, options, dateLib) => {\n let formatDate;\n if (dateLib && typeof dateLib.format === \"function\") {\n formatDate = dateLib.format.bind(dateLib);\n }\n else {\n formatDate = (d, pattern) => format(d, pattern, { locale: dateFnsEnUS, ...options });\n }\n let label = formatDate(date, \"PPPP\");\n if (modifiers?.today) {\n label = `Today, ${label}`;\n }\n return label;\n },\n labelNav: \"Navigation bar\",\n labelWeekNumberHeader: \"Week Number\",\n labelWeekday: (date, options, dateLib) => {\n let formatDate;\n if (dateLib && typeof dateLib.format === \"function\") {\n formatDate = dateLib.format.bind(dateLib);\n }\n else {\n formatDate = (d, pattern) => format(d, pattern, { locale: dateFnsEnUS, ...options });\n }\n return formatDate(date, \"cccc\");\n },\n },\n};\n","import { TZDate } from \"@date-fns/tz\";\nimport { addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarMonths, eachMonthOfInterval, eachYearOfInterval, endOfISOWeek, endOfMonth, endOfWeek, endOfYear, format, getISOWeek, getMonth, getWeek, getYear, isAfter, isBefore, isDate, isSameDay, isSameMonth, isSameYear, max, min, setMonth, setYear, startOfDay, startOfISOWeek, startOfMonth, startOfWeek, startOfYear, } from \"date-fns\";\nimport { endOfBroadcastWeek } from \"../helpers/endOfBroadcastWeek.js\";\nimport { startOfBroadcastWeek } from \"../helpers/startOfBroadcastWeek.js\";\nimport { enUS } from \"../locale/en-US.js\";\n/**\n * A wrapper class around [date-fns](http://date-fns.org) that provides utility\n * methods for date manipulation and formatting.\n *\n * @since 9.2.0\n * @example\n * const dateLib = new DateLib({ locale: es });\n * const newDate = dateLib.addDays(new Date(), 5);\n */\nexport class DateLib {\n /**\n * Creates an instance of `DateLib`.\n *\n * @param options Configuration options for the date library.\n * @param overrides Custom overrides for the date library functions.\n */\n constructor(options, overrides) {\n /**\n * Creates a new `Date` object representing today's date.\n *\n * @since 9.5.0\n * @returns A `Date` object for today's date.\n */\n this.today = () => {\n if (this.overrides?.today) {\n return this.overrides.today();\n }\n if (this.options.timeZone) {\n return TZDate.tz(this.options.timeZone);\n }\n const DateCtor = this.options.Date ?? Date;\n return new DateCtor();\n };\n /**\n * Creates a new `Date` object with the specified year, month, and day.\n *\n * @since 9.5.0\n * @param year The year.\n * @param monthIndex The month (0-11).\n * @param date The day of the month.\n * @returns A new `Date` object.\n */\n this.newDate = (year, monthIndex, date) => {\n if (this.overrides?.newDate) {\n return this.overrides.newDate(year, monthIndex, date);\n }\n if (this.options.timeZone) {\n return new TZDate(year, monthIndex, date, this.options.timeZone);\n }\n return new Date(year, monthIndex, date);\n };\n /**\n * Adds the specified number of days to the given date.\n *\n * @param date The date to add days to.\n * @param amount The number of days to add.\n * @returns The new date with the days added.\n */\n this.addDays = (date, amount) => {\n return this.overrides?.addDays\n ? this.overrides.addDays(date, amount)\n : addDays(date, amount);\n };\n /**\n * Adds the specified number of months to the given date.\n *\n * @param date The date to add months to.\n * @param amount The number of months to add.\n * @returns The new date with the months added.\n */\n this.addMonths = (date, amount) => {\n return this.overrides?.addMonths\n ? this.overrides.addMonths(date, amount)\n : addMonths(date, amount);\n };\n /**\n * Adds the specified number of weeks to the given date.\n *\n * @param date The date to add weeks to.\n * @param amount The number of weeks to add.\n * @returns The new date with the weeks added.\n */\n this.addWeeks = (date, amount) => {\n return this.overrides?.addWeeks\n ? this.overrides.addWeeks(date, amount)\n : addWeeks(date, amount);\n };\n /**\n * Adds the specified number of years to the given date.\n *\n * @param date The date to add years to.\n * @param amount The number of years to add.\n * @returns The new date with the years added.\n */\n this.addYears = (date, amount) => {\n return this.overrides?.addYears\n ? this.overrides.addYears(date, amount)\n : addYears(date, amount);\n };\n /**\n * Returns the number of calendar days between the given dates.\n *\n * @param dateLeft The later date.\n * @param dateRight The earlier date.\n * @returns The number of calendar days between the dates.\n */\n this.differenceInCalendarDays = (dateLeft, dateRight) => {\n return this.overrides?.differenceInCalendarDays\n ? this.overrides.differenceInCalendarDays(dateLeft, dateRight)\n : differenceInCalendarDays(dateLeft, dateRight);\n };\n /**\n * Returns the number of calendar months between the given dates.\n *\n * @param dateLeft The later date.\n * @param dateRight The earlier date.\n * @returns The number of calendar months between the dates.\n */\n this.differenceInCalendarMonths = (dateLeft, dateRight) => {\n return this.overrides?.differenceInCalendarMonths\n ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight)\n : differenceInCalendarMonths(dateLeft, dateRight);\n };\n /**\n * Returns the months between the given dates.\n *\n * @param interval The interval to get the months for.\n */\n this.eachMonthOfInterval = (interval) => {\n return this.overrides?.eachMonthOfInterval\n ? this.overrides.eachMonthOfInterval(interval)\n : eachMonthOfInterval(interval);\n };\n /**\n * Returns the years between the given dates.\n *\n * @since 9.11.1\n * @param interval The interval to get the years for.\n * @returns The array of years in the interval.\n */\n this.eachYearOfInterval = (interval) => {\n const years = this.overrides?.eachYearOfInterval\n ? this.overrides.eachYearOfInterval(interval)\n : eachYearOfInterval(interval);\n // Remove duplicates that may happen across DST transitions (e.g., \"America/Sao_Paulo\")\n // See https://github.com/date-fns/tz/issues/72\n const uniqueYears = new Set(years.map((d) => this.getYear(d)));\n if (uniqueYears.size === years.length) {\n // No duplicates, return as is\n return years;\n }\n // Rebuild the array to ensure one date per year\n const yearsArray = [];\n uniqueYears.forEach((y) => {\n yearsArray.push(new Date(y, 0, 1));\n });\n return yearsArray;\n };\n /**\n * Returns the end of the broadcast week for the given date.\n *\n * @param date The original date.\n * @returns The end of the broadcast week.\n */\n this.endOfBroadcastWeek = (date) => {\n return this.overrides?.endOfBroadcastWeek\n ? this.overrides.endOfBroadcastWeek(date)\n : endOfBroadcastWeek(date, this);\n };\n /**\n * Returns the end of the ISO week for the given date.\n *\n * @param date The original date.\n * @returns The end of the ISO week.\n */\n this.endOfISOWeek = (date) => {\n return this.overrides?.endOfISOWeek\n ? this.overrides.endOfISOWeek(date)\n : endOfISOWeek(date);\n };\n /**\n * Returns the end of the month for the given date.\n *\n * @param date The original date.\n * @returns The end of the month.\n */\n this.endOfMonth = (date) => {\n return this.overrides?.endOfMonth\n ? this.overrides.endOfMonth(date)\n : endOfMonth(date);\n };\n /**\n * Returns the end of the week for the given date.\n *\n * @param date The original date.\n * @returns The end of the week.\n */\n this.endOfWeek = (date, options) => {\n return this.overrides?.endOfWeek\n ? this.overrides.endOfWeek(date, options)\n : endOfWeek(date, this.options);\n };\n /**\n * Returns the end of the year for the given date.\n *\n * @param date The original date.\n * @returns The end of the year.\n */\n this.endOfYear = (date) => {\n return this.overrides?.endOfYear\n ? this.overrides.endOfYear(date)\n : endOfYear(date);\n };\n /**\n * Formats the given date using the specified format string.\n *\n * @param date The date to format.\n * @param formatStr The format string.\n * @returns The formatted date string.\n */\n this.format = (date, formatStr, _options) => {\n const formatted = this.overrides?.format\n ? this.overrides.format(date, formatStr, this.options)\n : format(date, formatStr, this.options);\n if (this.options.numerals && this.options.numerals !== \"latn\") {\n return this.replaceDigits(formatted);\n }\n return formatted;\n };\n /**\n * Returns the ISO week number for the given date.\n *\n * @param date The date to get the ISO week number for.\n * @returns The ISO week number.\n */\n this.getISOWeek = (date) => {\n return this.overrides?.getISOWeek\n ? this.overrides.getISOWeek(date)\n : getISOWeek(date);\n };\n /**\n * Returns the month of the given date.\n *\n * @param date The date to get the month for.\n * @returns The month.\n */\n this.getMonth = (date, _options) => {\n return this.overrides?.getMonth\n ? this.overrides.getMonth(date, this.options)\n : getMonth(date, this.options);\n };\n /**\n * Returns the year of the given date.\n *\n * @param date The date to get the year for.\n * @returns The year.\n */\n this.getYear = (date, _options) => {\n return this.overrides?.getYear\n ? this.overrides.getYear(date, this.options)\n : getYear(date, this.options);\n };\n /**\n * Returns the local week number for the given date.\n *\n * @param date The date to get the week number for.\n * @returns The week number.\n */\n this.getWeek = (date, _options) => {\n return this.overrides?.getWeek\n ? this.overrides.getWeek(date, this.options)\n : getWeek(date, this.options);\n };\n /**\n * Checks if the first date is after the second date.\n *\n * @param date The date to compare.\n * @param dateToCompare The date to compare with.\n * @returns True if the first date is after the second date.\n */\n this.isAfter = (date, dateToCompare) => {\n return this.overrides?.isAfter\n ? this.overrides.isAfter(date, dateToCompare)\n : isAfter(date, dateToCompare);\n };\n /**\n * Checks if the first date is before the second date.\n *\n * @param date The date to compare.\n * @param dateToCompare The date to compare with.\n * @returns True if the first date is before the second date.\n */\n this.isBefore = (date, dateToCompare) => {\n return this.overrides?.isBefore\n ? this.overrides.isBefore(date, dateToCompare)\n : isBefore(date, dateToCompare);\n };\n /**\n * Checks if the given value is a Date object.\n *\n * @param value The value to check.\n * @returns True if the value is a Date object.\n */\n this.isDate = (value) => {\n return this.overrides?.isDate\n ? this.overrides.isDate(value)\n : isDate(value);\n };\n /**\n * Checks if the given dates are on the same day.\n *\n * @param dateLeft The first date to compare.\n * @param dateRight The second date to compare.\n * @returns True if the dates are on the same day.\n */\n this.isSameDay = (dateLeft, dateRight) => {\n return this.overrides?.isSameDay\n ? this.overrides.isSameDay(dateLeft, dateRight)\n : isSameDay(dateLeft, dateRight);\n };\n /**\n * Checks if the given dates are in the same month.\n *\n * @param dateLeft The first date to compare.\n * @param dateRight The second date to compare.\n * @returns True if the dates are in the same month.\n */\n this.isSameMonth = (dateLeft, dateRight) => {\n return this.overrides?.isSameMonth\n ? this.overrides.isSameMonth(dateLeft, dateRight)\n : isSameMonth(dateLeft, dateRight);\n };\n /**\n * Checks if the given dates are in the same year.\n *\n * @param dateLeft The first date to compare.\n * @param dateRight The second date to compare.\n * @returns True if the dates are in the same year.\n */\n this.isSameYear = (dateLeft, dateRight) => {\n return this.overrides?.isSameYear\n ? this.overrides.isSameYear(dateLeft, dateRight)\n : isSameYear(dateLeft, dateRight);\n };\n /**\n * Returns the latest date in the given array of dates.\n *\n * @param dates The array of dates to compare.\n * @returns The latest date.\n */\n this.max = (dates) => {\n return this.overrides?.max ? this.overrides.max(dates) : max(dates);\n };\n /**\n * Returns the earliest date in the given array of dates.\n *\n * @param dates The array of dates to compare.\n * @returns The earliest date.\n */\n this.min = (dates) => {\n return this.overrides?.min ? this.overrides.min(dates) : min(dates);\n };\n /**\n * Sets the month of the given date.\n *\n * @param date The date to set the month on.\n * @param month The month to set (0-11).\n * @returns The new date with the month set.\n */\n this.setMonth = (date, month) => {\n return this.overrides?.setMonth\n ? this.overrides.setMonth(date, month)\n : setMonth(date, month);\n };\n /**\n * Sets the year of the given date.\n *\n * @param date The date to set the year on.\n * @param year The year to set.\n * @returns The new date with the year set.\n */\n this.setYear = (date, year) => {\n return this.overrides?.setYear\n ? this.overrides.setYear(date, year)\n : setYear(date, year);\n };\n /**\n * Returns the start of the broadcast week for the given date.\n *\n * @param date The original date.\n * @returns The start of the broadcast week.\n */\n this.startOfBroadcastWeek = (date, _dateLib) => {\n return this.overrides?.startOfBroadcastWeek\n ? this.overrides.startOfBroadcastWeek(date, this)\n : startOfBroadcastWeek(date, this);\n };\n /**\n * Returns the start of the day for the given date.\n *\n * @param date The original date.\n * @returns The start of the day.\n */\n this.startOfDay = (date) => {\n return this.overrides?.startOfDay\n ? this.overrides.startOfDay(date)\n : startOfDay(date);\n };\n /**\n * Returns the start of the ISO week for the given date.\n *\n * @param date The original date.\n * @returns The start of the ISO week.\n */\n this.startOfISOWeek = (date) => {\n return this.overrides?.startOfISOWeek\n ? this.overrides.startOfISOWeek(date)\n : startOfISOWeek(date);\n };\n /**\n * Returns the start of the month for the given date.\n *\n * @param date The original date.\n * @returns The start of the month.\n */\n this.startOfMonth = (date) => {\n return this.overrides?.startOfMonth\n ? this.overrides.startOfMonth(date)\n : startOfMonth(date);\n };\n /**\n * Returns the start of the week for the given date.\n *\n * @param date The original date.\n * @returns The start of the week.\n */\n this.startOfWeek = (date, _options) => {\n return this.overrides?.startOfWeek\n ? this.overrides.startOfWeek(date, this.options)\n : startOfWeek(date, this.options);\n };\n /**\n * Returns the start of the year for the given date.\n *\n * @param date The original date.\n * @returns The start of the year.\n */\n this.startOfYear = (date) => {\n return this.overrides?.startOfYear\n ? this.overrides.startOfYear(date)\n : startOfYear(date);\n };\n this.options = { locale: enUS, ...options };\n this.overrides = overrides;\n }\n /**\n * Generates a mapping of Arabic digits (0-9) to the target numbering system\n * digits.\n *\n * @since 9.5.0\n * @returns A record mapping Arabic digits to the target numerals.\n */\n getDigitMap() {\n const { numerals = \"latn\" } = this.options;\n // Use Intl.NumberFormat to create a formatter with the specified numbering system\n const formatter = new Intl.NumberFormat(\"en-US\", {\n numberingSystem: numerals,\n });\n // Map Arabic digits (0-9) to the target numerals\n const digitMap = {};\n for (let i = 0; i < 10; i++) {\n digitMap[i.toString()] = formatter.format(i);\n }\n return digitMap;\n }\n /**\n * Replaces Arabic digits in a string with the target numbering system digits.\n *\n * @since 9.5.0\n * @param input The string containing Arabic digits.\n * @returns The string with digits replaced.\n */\n replaceDigits(input) {\n const digitMap = this.getDigitMap();\n return input.replace(/\\d/g, (digit) => digitMap[digit] || digit);\n }\n /**\n * Formats a number using the configured numbering system.\n *\n * @since 9.5.0\n * @param value The number to format.\n * @returns The formatted number as a string.\n */\n formatNumber(value) {\n return this.replaceDigits(value.toString());\n }\n /**\n * Returns the preferred ordering for month and year labels for the current\n * locale.\n */\n getMonthYearOrder() {\n const code = this.options.locale?.code;\n if (!code) {\n return \"month-first\";\n }\n return DateLib.yearFirstLocales.has(code) ? \"year-first\" : \"month-first\";\n }\n /**\n * Formats the month/year pair respecting locale conventions.\n *\n * @since 9.11.0\n */\n formatMonthYear(date) {\n const { locale, timeZone, numerals } = this.options;\n const localeCode = locale?.code;\n if (localeCode && DateLib.yearFirstLocales.has(localeCode)) {\n try {\n const intl = new Intl.DateTimeFormat(localeCode, {\n month: \"long\",\n year: \"numeric\",\n timeZone,\n numberingSystem: numerals,\n });\n const formatted = intl.format(date);\n return formatted;\n }\n catch {\n // Fallback to date-fns formatting below.\n }\n }\n const pattern = this.getMonthYearOrder() === \"year-first\" ? \"y LLLL\" : \"LLLL y\";\n return this.format(date, pattern);\n }\n}\nDateLib.yearFirstLocales = new Set([\n \"eu\",\n \"hu\",\n \"ja\",\n \"ja-Hira\",\n \"ja-JP\",\n \"ko\",\n \"ko-KR\",\n \"lt\",\n \"lt-LT\",\n \"lv\",\n \"lv-LV\",\n \"mn\",\n \"mn-MN\",\n \"zh\",\n \"zh-CN\",\n \"zh-HK\",\n \"zh-TW\",\n]);\n/** The default locale (English). */\nexport { enUS as defaultLocale } from \"../locale/en-US.js\";\n/**\n * The default date library with English locale.\n *\n * @since 9.2.0\n */\nexport const defaultDateLib = new DateLib();\n","import { defaultDateLib } from \"./DateLib.js\";\n/**\n * Represents a day displayed in the calendar.\n *\n * In DayPicker, a `CalendarDay` is a wrapper around a `Date` object that\n * provides additional information about the day, such as whether it belongs to\n * the displayed month.\n */\nexport class CalendarDay {\n constructor(date, displayMonth, dateLib = defaultDateLib) {\n this.date = date;\n this.displayMonth = displayMonth;\n this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));\n this.dateLib = dateLib;\n this.isoDate = dateLib.format(date, \"yyyy-MM-dd\");\n this.displayMonthId = dateLib.format(displayMonth, \"yyyy-MM\");\n this.dateMonthId = dateLib.format(date, \"yyyy-MM\");\n }\n /**\n * Checks if this day is equal to another `CalendarDay`, considering both the\n * date and the displayed month.\n *\n * @param day The `CalendarDay` to compare with.\n * @returns `true` if the days are equal, otherwise `false`.\n */\n isEqualTo(day) {\n return (this.dateLib.isSameDay(day.date, this.date) &&\n this.dateLib.isSameMonth(day.displayMonth, this.displayMonth));\n }\n}\n","/**\n * Represents a month in a calendar year.\n *\n * A `CalendarMonth` contains the weeks within the month and the date of the\n * month.\n */\nexport class CalendarMonth {\n constructor(month, weeks) {\n this.date = month;\n this.weeks = weeks;\n }\n}\n","/**\n * Represents a week in a calendar month.\n *\n * A `CalendarWeek` contains the days within the week and the week number.\n */\nexport class CalendarWeek {\n constructor(weekNumber, days) {\n this.days = days;\n this.weekNumber = weekNumber;\n }\n}\n","import React from \"react\";\n/**\n * Render the label in the month caption.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function CaptionLabel(props) {\n return React.createElement(\"span\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the chevron icon used in the navigation buttons and dropdowns.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Chevron(props) {\n const { size = 24, orientation = \"left\", className, style } = props;\n return (React.createElement(\"svg\", { className: className, style: style, width: size, height: size, viewBox: \"0 0 24 24\" },\n orientation === \"up\" && (React.createElement(\"polygon\", { points: \"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28\" })),\n orientation === \"down\" && (React.createElement(\"polygon\", { points: \"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72\" })),\n orientation === \"left\" && (React.createElement(\"polygon\", { points: \"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20\" })),\n orientation === \"right\" && (React.createElement(\"polygon\", { points: \"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20\" }))));\n}\n","import React from \"react\";\n/**\n * Render a grid cell for a specific day in the calendar.\n *\n * Handles interaction and focus for the day. If you only need to change the\n * content of the day cell, consider swapping the `DayButton` component\n * instead.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Day(props) {\n const { day, modifiers, ...tdProps } = props;\n return React.createElement(\"td\", { ...tdProps });\n}\n","import React from \"react\";\n/**\n * Render a button for a specific day in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function DayButton(props) {\n const { day, modifiers, ...buttonProps } = props;\n const ref = React.useRef(null);\n React.useEffect(() => {\n if (modifiers.focused)\n ref.current?.focus();\n }, [modifiers.focused]);\n return React.createElement(\"button\", { ref: ref, ...buttonProps });\n}\n","/**\n * Enum representing the UI elements composing DayPicker. These elements are\n * mapped to {@link CustomComponents}, {@link ClassNames}, and {@link Styles}.\n *\n * Some elements are extended by flags and modifiers.\n */\nexport var UI;\n(function (UI) {\n /** The root component displaying the months and the navigation bar. */\n UI[\"Root\"] = \"root\";\n /** The Chevron SVG element used by navigation buttons and dropdowns. */\n UI[\"Chevron\"] = \"chevron\";\n /**\n * The grid cell with the day's date. Extended by {@link DayFlag} and\n * {@link SelectionState}.\n */\n UI[\"Day\"] = \"day\";\n /** The button containing the formatted day's date, inside the grid cell. */\n UI[\"DayButton\"] = \"day_button\";\n /** The caption label of the month (when not showing the dropdown navigation). */\n UI[\"CaptionLabel\"] = \"caption_label\";\n /** The container of the dropdown navigation (when enabled). */\n UI[\"Dropdowns\"] = \"dropdowns\";\n /** The dropdown element to select for years and months. */\n UI[\"Dropdown\"] = \"dropdown\";\n /** The container element of the dropdown. */\n UI[\"DropdownRoot\"] = \"dropdown_root\";\n /** The root element of the footer. */\n UI[\"Footer\"] = \"footer\";\n /** The month grid. */\n UI[\"MonthGrid\"] = \"month_grid\";\n /** Contains the dropdown navigation or the caption label. */\n UI[\"MonthCaption\"] = \"month_caption\";\n /** The dropdown with the months. */\n UI[\"MonthsDropdown\"] = \"months_dropdown\";\n /** Wrapper of the month grid. */\n UI[\"Month\"] = \"month\";\n /** The container of the displayed months. */\n UI[\"Months\"] = \"months\";\n /** The navigation bar with the previous and next buttons. */\n UI[\"Nav\"] = \"nav\";\n /**\n * The next month button in the navigation. *\n *\n * @since 9.1.0\n */\n UI[\"NextMonthButton\"] = \"button_next\";\n /**\n * The previous month button in the navigation.\n *\n * @since 9.1.0\n */\n UI[\"PreviousMonthButton\"] = \"button_previous\";\n /** The row containing the week. */\n UI[\"Week\"] = \"week\";\n /** The group of row weeks in a month (`tbody`). */\n UI[\"Weeks\"] = \"weeks\";\n /** The column header with the weekday. */\n UI[\"Weekday\"] = \"weekday\";\n /** The row grouping the weekdays in the column headers. */\n UI[\"Weekdays\"] = \"weekdays\";\n /** The cell containing the week number. */\n UI[\"WeekNumber\"] = \"week_number\";\n /** The cell header of the week numbers column. */\n UI[\"WeekNumberHeader\"] = \"week_number_header\";\n /** The dropdown with the years. */\n UI[\"YearsDropdown\"] = \"years_dropdown\";\n})(UI || (UI = {}));\n/** Enum representing flags for the {@link UI | UI.Day} element. */\nexport var DayFlag;\n(function (DayFlag) {\n /** The day is disabled. */\n DayFlag[\"disabled\"] = \"disabled\";\n /** The day is hidden. */\n DayFlag[\"hidden\"] = \"hidden\";\n /** The day is outside the current month. */\n DayFlag[\"outside\"] = \"outside\";\n /** The day is focused. */\n DayFlag[\"focused\"] = \"focused\";\n /** The day is today. */\n DayFlag[\"today\"] = \"today\";\n})(DayFlag || (DayFlag = {}));\n/**\n * Enum representing selection states that can be applied to the\n * {@link UI | UI.Day} element in selection mode.\n */\nexport var SelectionState;\n(function (SelectionState) {\n /** The day is at the end of a selected range. */\n SelectionState[\"range_end\"] = \"range_end\";\n /** The day is at the middle of a selected range. */\n SelectionState[\"range_middle\"] = \"range_middle\";\n /** The day is at the start of a selected range. */\n SelectionState[\"range_start\"] = \"range_start\";\n /** The day is selected. */\n SelectionState[\"selected\"] = \"selected\";\n})(SelectionState || (SelectionState = {}));\n/**\n * Enum representing different animation states for transitioning between\n * months.\n */\nexport var Animation;\n(function (Animation) {\n /** The entering weeks when they appear before the exiting month. */\n Animation[\"weeks_before_enter\"] = \"weeks_before_enter\";\n /** The exiting weeks when they disappear before the entering month. */\n Animation[\"weeks_before_exit\"] = \"weeks_before_exit\";\n /** The entering weeks when they appear after the exiting month. */\n Animation[\"weeks_after_enter\"] = \"weeks_after_enter\";\n /** The exiting weeks when they disappear after the entering month. */\n Animation[\"weeks_after_exit\"] = \"weeks_after_exit\";\n /** The entering caption when it appears after the exiting month. */\n Animation[\"caption_after_enter\"] = \"caption_after_enter\";\n /** The exiting caption when it disappears after the entering month. */\n Animation[\"caption_after_exit\"] = \"caption_after_exit\";\n /** The entering caption when it appears before the exiting month. */\n Animation[\"caption_before_enter\"] = \"caption_before_enter\";\n /** The exiting caption when it disappears before the entering month. */\n Animation[\"caption_before_exit\"] = \"caption_before_exit\";\n})(Animation || (Animation = {}));\n","import { createContext, useContext } from \"react\";\n/** @ignore */\nexport const dayPickerContext = createContext(undefined);\n/**\n * Provides access to the DayPicker context, which includes properties and\n * methods to interact with the DayPicker component. This hook must be used\n * within a custom component.\n *\n * @template T - Use this type to refine the returned context type with a\n * specific selection mode.\n * @returns The context to work with DayPicker.\n * @throws {Error} If the hook is used outside of a DayPicker provider.\n * @group Hooks\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function useDayPicker() {\n const context = useContext(dayPickerContext);\n if (context === undefined) {\n throw new Error(\"useDayPicker() must be used within a custom component.\");\n }\n return context;\n}\n","import React from \"react\";\nimport { UI } from \"../UI.js\";\nimport { useDayPicker } from \"../useDayPicker.js\";\n/**\n * Render a dropdown component for navigation in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Dropdown(props) {\n const { options, className, ...selectProps } = props;\n const { classNames, components, styles } = useDayPicker();\n const cssClassSelect = [classNames[UI.Dropdown], className].join(\" \");\n const selectedOption = options?.find(({ value }) => value === selectProps.value);\n return (React.createElement(\"span\", { \"data-disabled\": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] },\n React.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled }) => (React.createElement(components.Option, { key: value, value: value, disabled: disabled }, label)))),\n React.createElement(\"span\", { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], \"aria-hidden\": true },\n selectedOption?.label,\n React.createElement(components.Chevron, { orientation: \"down\", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }))));\n}\n","import React from \"react\";\n/**\n * Render the navigation dropdowns for the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function DropdownNav(props) {\n return React.createElement(\"div\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the footer of the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Footer(props) {\n return React.createElement(\"div\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the grid with the weekday header row and the weeks for a specific\n * month.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Month(props) {\n const { calendarMonth, displayIndex, ...divProps } = props;\n return React.createElement(\"div\", { ...divProps }, props.children);\n}\n","import React from \"react\";\n/**\n * Render the caption for a month in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function MonthCaption(props) {\n const { calendarMonth, displayIndex, ...divProps } = props;\n return React.createElement(\"div\", { ...divProps });\n}\n","import React from \"react\";\n/**\n * Render the grid of days for a specific month.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function MonthGrid(props) {\n return React.createElement(\"table\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render a container wrapping the month grids.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Months(props) {\n return React.createElement(\"div\", { ...props });\n}\n","import React from \"react\";\nimport { useDayPicker } from \"../useDayPicker.js\";\n/**\n * Render a dropdown to navigate between months in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function MonthsDropdown(props) {\n const { components } = useDayPicker();\n return React.createElement(components.Dropdown, { ...props });\n}\n","import React, { useCallback, } from \"react\";\nimport { UI } from \"../UI.js\";\nimport { useDayPicker } from \"../useDayPicker.js\";\n/**\n * Render the navigation toolbar with buttons to navigate between months.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Nav(props) {\n const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;\n const { components, classNames, styles, labels: { labelPrevious, labelNext }, } = useDayPicker();\n const handleNextClick = useCallback((e) => {\n if (nextMonth) {\n onNextClick?.(e);\n }\n }, [nextMonth, onNextClick]);\n const handlePreviousClick = useCallback((e) => {\n if (previousMonth) {\n onPreviousClick?.(e);\n }\n }, [previousMonth, onPreviousClick]);\n return (React.createElement(\"nav\", { ...navProps },\n React.createElement(components.PreviousMonthButton, { type: \"button\", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, \"aria-disabled\": previousMonth ? undefined : true, \"aria-label\": labelPrevious(previousMonth), onClick: handlePreviousClick },\n React.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: \"left\" })),\n React.createElement(components.NextMonthButton, { type: \"button\", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, \"aria-disabled\": nextMonth ? undefined : true, \"aria-label\": labelNext(nextMonth), onClick: handleNextClick },\n React.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, orientation: \"right\", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }))));\n}\n","import React from \"react\";\n/**\n * Render the button to navigate to the next month in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function NextMonthButton(props) {\n return React.createElement(\"button\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render an `option` element.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Option(props) {\n return React.createElement(\"option\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the button to navigate to the previous month in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function PreviousMonthButton(props) {\n return React.createElement(\"button\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the root element of the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Root(props) {\n const { rootRef, ...rest } = props;\n return React.createElement(\"div\", { ...rest, ref: rootRef });\n}\n","import React from \"react\";\n/**\n * Render a `select` element.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Select(props) {\n return React.createElement(\"select\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render a table row representing a week in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Week(props) {\n const { week, ...trProps } = props;\n return React.createElement(\"tr\", { ...trProps });\n}\n","import React from \"react\";\n/**\n * Render a table header cell with the name of a weekday (e.g., \"Mo\", \"Tu\").\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Weekday(props) {\n return React.createElement(\"th\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the table row containing the weekday names.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Weekdays(props) {\n return (React.createElement(\"thead\", { \"aria-hidden\": true },\n React.createElement(\"tr\", { ...props })));\n}\n","import React from \"react\";\n/**\n * Render a table cell displaying the number of the week.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function WeekNumber(props) {\n const { week, ...thProps } = props;\n return React.createElement(\"th\", { ...thProps });\n}\n","import React from \"react\";\n/**\n * Render the header cell for the week numbers column.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function WeekNumberHeader(props) {\n return React.createElement(\"th\", { ...props });\n}\n","import React from \"react\";\n/**\n * Render the container for the weeks in the month grid.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function Weeks(props) {\n return React.createElement(\"tbody\", { ...props });\n}\n","import React from \"react\";\nimport { useDayPicker } from \"../useDayPicker.js\";\n/**\n * Render a dropdown to navigate between years in the calendar.\n *\n * @group Components\n * @see https://daypicker.dev/guides/custom-components\n */\nexport function YearsDropdown(props) {\n const { components } = useDayPicker();\n return React.createElement(components.Dropdown, { ...props });\n}\n","import { defaultDateLib } from \"../classes/index.js\";\n/**\n * Checks if a given date is within a specified date range.\n *\n * @since 9.0.0\n * @param range - The date range to check against.\n * @param date - The date to check.\n * @param excludeEnds - If `true`, the range's start and end dates are excluded.\n * @param dateLib - The date utility library instance.\n * @returns `true` if the date is within the range, otherwise `false`.\n * @group Utilities\n */\nexport function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) {\n let { from, to } = range;\n const { differenceInCalendarDays, isSameDay } = dateLib;\n if (from && to) {\n const isRangeInverted = differenceInCalendarDays(to, from) < 0;\n if (isRangeInverted) {\n [from, to] = [to, from];\n }\n const isInRange = differenceInCalendarDays(date, from) >= (excludeEnds ? 1 : 0) &&\n differenceInCalendarDays(to, date) >= (excludeEnds ? 1 : 0);\n return isInRange;\n }\n if (!excludeEnds && to) {\n return isSameDay(to, date);\n }\n if (!excludeEnds && from) {\n return isSameDay(from, date);\n }\n return false;\n}\n","/**\n * Checks if the given value is of type {@link DateInterval}.\n *\n * @param matcher - The value to check.\n * @returns `true` if the value is a {@link DateInterval}, otherwise `false`.\n * @group Utilities\n */\nexport function isDateInterval(matcher) {\n return Boolean(matcher &&\n typeof matcher === \"object\" &&\n \"before\" in matcher &&\n \"after\" in matcher);\n}\n/**\n * Checks if the given value is of type {@link DateRange}.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link DateRange}, otherwise `false`.\n * @group Utilities\n */\nexport function isDateRange(value) {\n return Boolean(value && typeof value === \"object\" && \"from\" in value);\n}\n/**\n * Checks if the given value is of type {@link DateAfter}.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link DateAfter}, otherwise `false`.\n * @group Utilities\n */\nexport function isDateAfterType(value) {\n return Boolean(value && typeof value === \"object\" && \"after\" in value);\n}\n/**\n * Checks if the given value is of type {@link DateBefore}.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link DateBefore}, otherwise `false`.\n * @group Utilities\n */\nexport function isDateBeforeType(value) {\n return Boolean(value && typeof value === \"object\" && \"before\" in value);\n}\n/**\n * Checks if the given value is of type {@link DayOfWeek}.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link DayOfWeek}, otherwise `false`.\n * @group Utilities\n */\nexport function isDayOfWeekType(value) {\n return Boolean(value && typeof value === \"object\" && \"dayOfWeek\" in value);\n}\n/**\n * Checks if the given value is an array of valid dates.\n *\n * @private\n * @param value - The value to check.\n * @param dateLib - The date utility library instance.\n * @returns `true` if the value is an array of valid dates, otherwise `false`.\n */\nexport function isDatesArray(value, dateLib) {\n return Array.isArray(value) && value.every(dateLib.isDate);\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\nimport { rangeIncludesDate } from \"./rangeIncludesDate.js\";\nimport { isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDatesArray, isDayOfWeekType, } from \"./typeguards.js\";\n/**\n * Checks if a given date matches at least one of the specified {@link Matcher}.\n *\n * @param date - The date to check.\n * @param matchers - The matchers to check against.\n * @param dateLib - The date utility library instance.\n * @returns `true` if the date matches any of the matchers, otherwise `false`.\n * @group Utilities\n */\nexport function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {\n const matchersArr = !Array.isArray(matchers) ? [matchers] : matchers;\n const { isSameDay, differenceInCalendarDays, isAfter } = dateLib;\n return matchersArr.some((matcher) => {\n if (typeof matcher === \"boolean\") {\n return matcher;\n }\n if (dateLib.isDate(matcher)) {\n return isSameDay(date, matcher);\n }\n if (isDatesArray(matcher, dateLib)) {\n return matcher.some((matcherDate) => isSameDay(date, matcherDate));\n }\n if (isDateRange(matcher)) {\n return rangeIncludesDate(matcher, date, false, dateLib);\n }\n if (isDayOfWeekType(matcher)) {\n if (!Array.isArray(matcher.dayOfWeek)) {\n return matcher.dayOfWeek === date.getDay();\n }\n return matcher.dayOfWeek.includes(date.getDay());\n }\n if (isDateInterval(matcher)) {\n const diffBefore = differenceInCalendarDays(matcher.before, date);\n const diffAfter = differenceInCalendarDays(matcher.after, date);\n const isDayBefore = diffBefore > 0;\n const isDayAfter = diffAfter < 0;\n const isClosedInterval = isAfter(matcher.before, matcher.after);\n if (isClosedInterval) {\n return isDayAfter && isDayBefore;\n }\n else {\n return isDayBefore || isDayAfter;\n }\n }\n if (isDateAfterType(matcher)) {\n return differenceInCalendarDays(date, matcher.after) > 0;\n }\n if (isDateBeforeType(matcher)) {\n return differenceInCalendarDays(matcher.before, date) > 0;\n }\n if (typeof matcher === \"function\") {\n return matcher(date);\n }\n return false;\n });\n}\n","import { DayFlag } from \"../UI.js\";\nimport { dateMatchModifiers } from \"../utils/dateMatchModifiers.js\";\n/**\n * Creates a function to retrieve the modifiers for a given day.\n *\n * This function calculates both internal and custom modifiers for each day\n * based on the provided calendar days and DayPicker props.\n *\n * @private\n * @param days The array of `CalendarDay` objects to process.\n * @param props The DayPicker props, including modifiers and configuration\n * options.\n * @param dateLib The date library to use for date manipulation.\n * @returns A function that retrieves the modifiers for a given `CalendarDay`.\n */\nexport function createGetModifiers(days, props, navStart, navEnd, dateLib) {\n const { disabled, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today(), } = props;\n const { isSameDay, isSameMonth, startOfMonth, isBefore, endOfMonth, isAfter, } = dateLib;\n const computedNavStart = navStart && startOfMonth(navStart);\n const computedNavEnd = navEnd && endOfMonth(navEnd);\n const internalModifiersMap = {\n [DayFlag.focused]: [],\n [DayFlag.outside]: [],\n [DayFlag.disabled]: [],\n [DayFlag.hidden]: [],\n [DayFlag.today]: [],\n };\n const customModifiersMap = {};\n for (const day of days) {\n const { date, displayMonth } = day;\n const isOutside = Boolean(displayMonth && !isSameMonth(date, displayMonth));\n const isBeforeNavStart = Boolean(computedNavStart && isBefore(date, computedNavStart));\n const isAfterNavEnd = Boolean(computedNavEnd && isAfter(date, computedNavEnd));\n const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));\n const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) ||\n isBeforeNavStart ||\n isAfterNavEnd ||\n // Broadcast calendar will show outside days as default\n (!broadcastCalendar && !showOutsideDays && isOutside) ||\n (broadcastCalendar && showOutsideDays === false && isOutside);\n const isToday = isSameDay(date, today);\n if (isOutside)\n internalModifiersMap.outside.push(day);\n if (isDisabled)\n internalModifiersMap.disabled.push(day);\n if (isHidden)\n internalModifiersMap.hidden.push(day);\n if (isToday)\n internalModifiersMap.today.push(day);\n // Add custom modifiers\n if (modifiers) {\n Object.keys(modifiers).forEach((name) => {\n const modifierValue = modifiers?.[name];\n const isMatch = modifierValue\n ? dateMatchModifiers(date, modifierValue, dateLib)\n : false;\n if (!isMatch)\n return;\n if (customModifiersMap[name]) {\n customModifiersMap[name].push(day);\n }\n else {\n customModifiersMap[name] = [day];\n }\n });\n }\n }\n return (day) => {\n // Initialize all the modifiers to false\n const dayFlags = {\n [DayFlag.focused]: false,\n [DayFlag.disabled]: false,\n [DayFlag.hidden]: false,\n [DayFlag.outside]: false,\n [DayFlag.today]: false,\n };\n const customModifiers = {};\n // Find the modifiers for the given day\n for (const name in internalModifiersMap) {\n const days = internalModifiersMap[name];\n dayFlags[name] = days.some((d) => d === day);\n }\n for (const name in customModifiersMap) {\n customModifiers[name] = customModifiersMap[name].some((d) => d === day);\n }\n return {\n ...dayFlags,\n // custom modifiers should override all the previous ones\n ...customModifiers,\n };\n };\n}\n","import { DayFlag, SelectionState, UI } from \"../UI.js\";\n/**\n * Returns the class names for a day based on its modifiers.\n *\n * This function combines the base class name for the day with any class names\n * associated with active modifiers.\n *\n * @param modifiers The modifiers applied to the day.\n * @param classNames The base class names for the calendar elements.\n * @param modifiersClassNames The class names associated with specific\n * modifiers.\n * @returns An array of class names for the day.\n */\nexport function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) {\n const modifierClassNames = Object.entries(modifiers)\n .filter(([, active]) => active === true)\n .reduce((previousValue, [key]) => {\n if (modifiersClassNames[key]) {\n previousValue.push(modifiersClassNames[key]);\n }\n else if (classNames[DayFlag[key]]) {\n previousValue.push(classNames[DayFlag[key]]);\n }\n else if (classNames[SelectionState[key]]) {\n previousValue.push(classNames[SelectionState[key]]);\n }\n return previousValue;\n }, [classNames[UI.Day]]);\n return modifierClassNames;\n}\n","import * as components from \"../components/custom-components.js\";\n/**\n * Merges custom components from the props with the default components.\n *\n * This function ensures that any custom components provided in the props\n * override the default components.\n *\n * @param customComponents The custom components provided in the DayPicker\n * props.\n * @returns An object containing the merged components.\n */\nexport function getComponents(customComponents) {\n return {\n ...components,\n ...customComponents,\n };\n}\n","/**\n * Extracts `data-` attributes from the DayPicker props.\n *\n * This function collects all `data-` attributes from the props and adds\n * additional attributes based on the DayPicker configuration.\n *\n * @param props The DayPicker props.\n * @returns An object containing the `data-` attributes.\n */\nexport function getDataAttributes(props) {\n const dataAttributes = {\n \"data-mode\": props.mode ?? undefined,\n \"data-required\": \"required\" in props ? props.required : undefined,\n \"data-multiple-months\": (props.numberOfMonths && props.numberOfMonths > 1) || undefined,\n \"data-week-numbers\": props.showWeekNumber || undefined,\n \"data-broadcast-calendar\": props.broadcastCalendar || undefined,\n \"data-nav-layout\": props.navLayout || undefined,\n };\n Object.entries(props).forEach(([key, val]) => {\n if (key.startsWith(\"data-\")) {\n dataAttributes[key] = val;\n }\n });\n return dataAttributes;\n}\n","import { Animation, DayFlag, SelectionState, UI } from \"../UI.js\";\n/**\n * Returns the default class names for the UI elements.\n *\n * This function generates a mapping of default class names for various UI\n * elements, day flags, selection states, and animations.\n *\n * @returns An object containing the default class names.\n * @group Utilities\n */\nexport function getDefaultClassNames() {\n const classNames = {};\n for (const key in UI) {\n classNames[UI[key]] =\n `rdp-${UI[key]}`;\n }\n for (const key in DayFlag) {\n classNames[DayFlag[key]] =\n `rdp-${DayFlag[key]}`;\n }\n for (const key in SelectionState) {\n classNames[SelectionState[key]] =\n `rdp-${SelectionState[key]}`;\n }\n for (const key in Animation) {\n classNames[Animation[key]] =\n `rdp-${Animation[key]}`;\n }\n return classNames;\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Formats the caption of the month.\n *\n * @defaultValue Locale-specific month/year order (e.g., \"November 2022\").\n * @param month The date representing the month.\n * @param options Configuration options for the date library.\n * @param dateLib The date library to use for formatting. If not provided, a new\n * instance is created.\n * @returns The formatted caption as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatCaption(month, options, dateLib) {\n const lib = dateLib ?? new DateLib(options);\n return lib.formatMonthYear(month);\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Formats the day date shown in the day cell.\n *\n * @defaultValue `d` (e.g., \"1\").\n * @param date The date to format.\n * @param options Configuration options for the date library.\n * @param dateLib The date library to use for formatting. If not provided, a new\n * instance is created.\n * @returns The formatted day as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatDay(date, options, dateLib) {\n return (dateLib ?? new DateLib(options)).format(date, \"d\");\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\n/**\n * Formats the month for the dropdown option label.\n *\n * @defaultValue The localized full month name.\n * @param month The date representing the month.\n * @param dateLib The date library to use for formatting. Defaults to\n * `defaultDateLib`.\n * @returns The formatted month name as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatMonthDropdown(month, dateLib = defaultDateLib) {\n return dateLib.format(month, \"LLLL\");\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Formats the name of a weekday to be displayed in the weekdays header.\n *\n * @defaultValue `cccccc` (e.g., \"Mo\" for Monday).\n * @param weekday The date representing the weekday.\n * @param options Configuration options for the date library.\n * @param dateLib The date library to use for formatting. If not provided, a new\n * instance is created.\n * @returns The formatted weekday name as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatWeekdayName(weekday, options, dateLib) {\n return (dateLib ?? new DateLib(options)).format(weekday, \"cccccc\");\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\n/**\n * Formats the week number.\n *\n * @defaultValue The week number as a string, with a leading zero for single-digit numbers.\n * @param weekNumber The week number to format.\n * @param dateLib The date library to use for formatting. Defaults to\n * `defaultDateLib`.\n * @returns The formatted week number as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatWeekNumber(weekNumber, dateLib = defaultDateLib) {\n if (weekNumber < 10) {\n return dateLib.formatNumber(`0${weekNumber.toLocaleString()}`);\n }\n return dateLib.formatNumber(`${weekNumber.toLocaleString()}`);\n}\n","/**\n * Formats the header for the week number column.\n *\n * @defaultValue An empty string `\"\"`.\n * @returns The formatted week number header as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatWeekNumberHeader() {\n return ``;\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\n/**\n * Formats the year for the dropdown option label.\n *\n * @param year The year to format.\n * @param dateLib The date library to use for formatting. Defaults to\n * `defaultDateLib`.\n * @returns The formatted year as a string.\n * @group Formatters\n * @see https://daypicker.dev/docs/translation#custom-formatters\n */\nexport function formatYearDropdown(year, dateLib = defaultDateLib) {\n return dateLib.format(year, \"yyyy\");\n}\n","import * as defaultFormatters from \"../formatters/index.js\";\n/**\n * Merges custom formatters from the props with the default formatters.\n *\n * @param customFormatters The custom formatters provided in the DayPicker\n * props.\n * @returns The merged formatters object.\n */\nexport function getFormatters(customFormatters) {\n return {\n ...defaultFormatters,\n ...customFormatters,\n };\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Generates the ARIA label for a day button.\n *\n * Use the `modifiers` argument to provide additional context for the label,\n * such as indicating if the day is \"today\" or \"selected.\"\n *\n * @defaultValue The formatted date.\n * @param date - The date to format.\n * @param modifiers - The modifiers providing context for the day.\n * @param options - Optional configuration for the date formatting library.\n * @param dateLib - An optional instance of the date formatting library.\n * @returns The ARIA label for the day button.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelDayButton(date, modifiers, options, dateLib) {\n let label = (dateLib ?? new DateLib(options)).format(date, \"PPPP\");\n if (modifiers.today)\n label = `Today, ${label}`;\n if (modifiers.selected)\n label = `${label}, selected`;\n return label;\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Generates the ARIA label for the month grid, which is announced when entering\n * the grid.\n *\n * @defaultValue Locale-specific month/year order (e.g., \"November 2022\").\n * @param date - The date representing the month.\n * @param options - Optional configuration for the date formatting library.\n * @param dateLib - An optional instance of the date formatting library.\n * @returns The ARIA label for the month grid.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelGrid(date, options, dateLib) {\n const lib = dateLib ?? new DateLib(options);\n return lib.formatMonthYear(date);\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Generates the label for a day grid cell when the calendar is not interactive.\n *\n * @param date - The date to format.\n * @param modifiers - Optional modifiers providing context for the day.\n * @param options - Optional configuration for the date formatting library.\n * @param dateLib - An optional instance of the date formatting library.\n * @returns The label for the day grid cell.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelGridcell(date, modifiers, options, dateLib) {\n let label = (dateLib ?? new DateLib(options)).format(date, \"PPPP\");\n if (modifiers?.today) {\n label = `Today, ${label}`;\n }\n return label;\n}\n","/**\n * Generates the ARIA label for the months dropdown.\n *\n * @defaultValue `\"Choose the Month\"`\n * @param options - Optional configuration for the date formatting library.\n * @returns The ARIA label for the months dropdown.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelMonthDropdown(_options) {\n return \"Choose the Month\";\n}\n","/**\n * Generates the ARIA label for the navigation toolbar.\n *\n * @defaultValue `\"\"`\n * @returns The ARIA label for the navigation toolbar.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelNav() {\n return \"\";\n}\n","const defaultLabel = \"Go to the Next Month\";\n/**\n * Generates the ARIA label for the \"next month\" button.\n *\n * @defaultValue `\"Go to the Next Month\"`\n * @param month - The date representing the next month, or `undefined` if there\n * is no next month.\n * @returns The ARIA label for the \"next month\" button.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelNext(_month, _options) {\n return defaultLabel;\n}\n","/**\n * Generates the ARIA label for the \"previous month\" button.\n *\n * @defaultValue `\"Go to the Previous Month\"`\n * @param month - The date representing the previous month, or `undefined` if\n * there is no previous month.\n * @returns The ARIA label for the \"previous month\" button.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelPrevious(_month) {\n return \"Go to the Previous Month\";\n}\n","import { DateLib } from \"../classes/DateLib.js\";\n/**\n * Generates the ARIA label for a weekday column header.\n *\n * @defaultValue `\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"`\n * @param date - The date representing the weekday.\n * @param options - Optional configuration for the date formatting library.\n * @param dateLib - An optional instance of the date formatting library.\n * @returns The ARIA label for the weekday column header.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelWeekday(date, options, dateLib) {\n return (dateLib ?? new DateLib(options)).format(date, \"cccc\");\n}\n","/**\n * Generates the ARIA label for the week number cell (the first cell in a row).\n *\n * @defaultValue `Week ${weekNumber}`\n * @param weekNumber - The number of the week.\n * @param options - Optional configuration for the date formatting library.\n * @returns The ARIA label for the week number cell.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelWeekNumber(weekNumber, _options) {\n return `Week ${weekNumber}`;\n}\n","/**\n * Generates the ARIA label for the week number header element.\n *\n * @defaultValue `\"Week Number\"`\n * @param options - Optional configuration for the date formatting library.\n * @returns The ARIA label for the week number header.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelWeekNumberHeader(_options) {\n return \"Week Number\";\n}\n","/**\n * Generates the ARIA label for the years dropdown.\n *\n * @defaultValue `\"Choose the Year\"`\n * @param options - Optional configuration for the date formatting library.\n * @returns The ARIA label for the years dropdown.\n * @group Labels\n * @see https://daypicker.dev/docs/translation#aria-labels\n */\nexport function labelYearDropdown(_options) {\n return \"Choose the Year\";\n}\n","import * as defaultLabels from \"../labels/index.js\";\nconst resolveLabel = (defaultLabel, customLabel, localeLabel) => {\n if (customLabel)\n return customLabel;\n if (localeLabel) {\n return (typeof localeLabel === \"function\"\n ? localeLabel\n : (..._args) => localeLabel);\n }\n return defaultLabel;\n};\n/**\n * Merges custom labels from the props with the default labels.\n *\n * When available, uses the locale-provided translation for `labelNext`.\n *\n * @param customLabels The custom labels provided in the DayPicker props.\n * @param options Options from the date library, used to resolve locale\n * translations.\n * @returns The merged labels object with locale-aware defaults.\n */\nexport function getLabels(customLabels, options) {\n const localeLabels = options.locale?.labels ?? {};\n return {\n ...defaultLabels,\n ...(customLabels ?? {}),\n labelDayButton: resolveLabel(defaultLabels.labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton),\n labelMonthDropdown: resolveLabel(defaultLabels.labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown),\n labelNext: resolveLabel(defaultLabels.labelNext, customLabels?.labelNext, localeLabels.labelNext),\n labelPrevious: resolveLabel(defaultLabels.labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious),\n labelWeekNumber: resolveLabel(defaultLabels.labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber),\n labelYearDropdown: resolveLabel(defaultLabels.labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown),\n labelGrid: resolveLabel(defaultLabels.labelGrid, customLabels?.labelGrid, localeLabels.labelGrid),\n labelGridcell: resolveLabel(defaultLabels.labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell),\n labelNav: resolveLabel(defaultLabels.labelNav, customLabels?.labelNav, localeLabels.labelNav),\n labelWeekNumberHeader: resolveLabel(defaultLabels.labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader),\n labelWeekday: resolveLabel(defaultLabels.labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday),\n };\n}\n","/**\n * Returns the months to show in the dropdown.\n *\n * This function generates a list of months for the current year, formatted\n * using the provided formatter, and determines whether each month should be\n * disabled based on the navigation range.\n *\n * @param displayMonth The currently displayed month.\n * @param navStart The start date for navigation.\n * @param navEnd The end date for navigation.\n * @param formatters The formatters to use for formatting the month labels.\n * @param dateLib The date library to use for date manipulation.\n * @returns An array of dropdown options representing the months, or `undefined`\n * if no months are available.\n */\nexport function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {\n const { startOfMonth, startOfYear, endOfYear, eachMonthOfInterval, getMonth, } = dateLib;\n const months = eachMonthOfInterval({\n start: startOfYear(displayMonth),\n end: endOfYear(displayMonth),\n });\n const options = months.map((month) => {\n const label = formatters.formatMonthDropdown(month, dateLib);\n const value = getMonth(month);\n const disabled = (navStart && month < startOfMonth(navStart)) ||\n (navEnd && month > startOfMonth(navEnd)) ||\n false;\n return { value, label, disabled };\n });\n return options;\n}\n","import { UI } from \"../UI.js\";\n/**\n * Returns the computed style for a day based on its modifiers.\n *\n * This function merges the base styles for the day with any styles associated\n * with active modifiers.\n *\n * @param dayModifiers The modifiers applied to the day.\n * @param styles The base styles for the calendar elements.\n * @param modifiersStyles The styles associated with specific modifiers.\n * @returns The computed style for the day.\n */\nexport function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) {\n let style = { ...styles?.[UI.Day] };\n Object.entries(dayModifiers)\n .filter(([, active]) => active === true)\n .forEach(([modifier]) => {\n style = {\n ...style,\n ...modifiersStyles?.[modifier],\n };\n });\n return style;\n}\n","/**\n * Generates a series of 7 days, starting from the beginning of the week, to use\n * for formatting weekday names (e.g., Monday, Tuesday, etc.).\n *\n * @param dateLib The date library to use for date manipulation.\n * @param ISOWeek Whether to use ISO week numbering (weeks start on Monday).\n * @param broadcastCalendar Whether to use the broadcast calendar (weeks start\n * on Monday, but may include adjustments for broadcast-specific rules).\n * @returns An array of 7 dates representing the weekdays.\n */\nexport function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) {\n const referenceToday = today ?? dateLib.today();\n const start = broadcastCalendar\n ? dateLib.startOfBroadcastWeek(referenceToday, dateLib)\n : ISOWeek\n ? dateLib.startOfISOWeek(referenceToday)\n : dateLib.startOfWeek(referenceToday);\n const days = [];\n for (let i = 0; i < 7; i++) {\n const day = dateLib.addDays(start, i);\n days.push(day);\n }\n return days;\n}\n","/**\n * Returns the years to display in the dropdown.\n *\n * This function generates a list of years between the navigation start and end\n * dates, formatted using the provided formatter.\n *\n * @param navStart The start date for navigation.\n * @param navEnd The end date for navigation.\n * @param formatters The formatters to use for formatting the year labels.\n * @param dateLib The date library to use for date manipulation.\n * @param reverse If true, reverses the order of the years (descending).\n * @returns An array of dropdown options representing the years, or `undefined`\n * if `navStart` or `navEnd` is not provided.\n */\nexport function getYearOptions(navStart, navEnd, formatters, dateLib, reverse = false) {\n if (!navStart)\n return undefined;\n if (!navEnd)\n return undefined;\n const { startOfYear, endOfYear, eachYearOfInterval, getYear } = dateLib;\n const firstNavYear = startOfYear(navStart);\n const lastNavYear = endOfYear(navEnd);\n const years = eachYearOfInterval({ start: firstNavYear, end: lastNavYear });\n if (reverse)\n years.reverse();\n return years.map((year) => {\n const label = formatters.formatYearDropdown(year, dateLib);\n return {\n value: getYear(year),\n label,\n disabled: false,\n };\n });\n}\n","import { TZDate } from \"@date-fns/tz\";\nimport { differenceInCalendarDays as differenceInCalendarDaysFn, differenceInCalendarMonths as differenceInCalendarMonthsFn, getISOWeek as getISOWeekFn, getWeek as getWeekFn, } from \"date-fns\";\n/**\n * Creates `dateLib` overrides that keep all calendar math at noon in the target\n * time zone. This avoids second-level offset changes (e.g., historical zones\n * with +03:41:12) from pushing dates backward across midnight.\n */\nexport function createNoonOverrides(timeZone, options = {}) {\n const { weekStartsOn, locale } = options;\n const fallbackWeekStartsOn = (weekStartsOn ??\n locale?.options?.weekStartsOn ??\n 0);\n // Keep all internal math anchored at noon in the target zone to avoid\n // historical second-level offsets from crossing midnight.\n const toNoonTZDate = (date) => {\n const normalizedDate = typeof date === \"number\" || typeof date === \"string\"\n ? new Date(date)\n : date;\n return new TZDate(normalizedDate.getFullYear(), normalizedDate.getMonth(), normalizedDate.getDate(), 12, 0, 0, timeZone);\n };\n // Convert a value into a host `Date` that represents the same calendar day\n // as the target-zone noon. This is useful for helpers (e.g., date-fns week\n // utilities) that expect local `Date` instances rather than `TZDate`s.\n const toCalendarDate = (date) => {\n const zoned = toNoonTZDate(date);\n return new Date(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 0, 0, 0, 0);\n };\n return {\n today: () => {\n return toNoonTZDate(TZDate.tz(timeZone));\n },\n newDate: (year, monthIndex, date) => {\n return new TZDate(year, monthIndex, date, 12, 0, 0, timeZone);\n },\n startOfDay: (date) => {\n return toNoonTZDate(date);\n },\n startOfWeek: (date, options) => {\n const base = toNoonTZDate(date);\n const weekStartsOnValue = (options?.weekStartsOn ??\n fallbackWeekStartsOn);\n const diff = (base.getDay() - weekStartsOnValue + 7) % 7;\n base.setDate(base.getDate() - diff);\n return base;\n },\n startOfISOWeek: (date) => {\n const base = toNoonTZDate(date);\n const diff = (base.getDay() - 1 + 7) % 7;\n base.setDate(base.getDate() - diff);\n return base;\n },\n startOfMonth: (date) => {\n const base = toNoonTZDate(date);\n base.setDate(1);\n return base;\n },\n startOfYear: (date) => {\n const base = toNoonTZDate(date);\n base.setMonth(0, 1);\n return base;\n },\n endOfWeek: (date, options) => {\n const base = toNoonTZDate(date);\n const weekStartsOnValue = (options?.weekStartsOn ??\n fallbackWeekStartsOn);\n const endDow = (weekStartsOnValue + 6) % 7;\n const diff = (endDow - base.getDay() + 7) % 7;\n base.setDate(base.getDate() + diff);\n return base;\n },\n endOfISOWeek: (date) => {\n const base = toNoonTZDate(date);\n const diff = (7 - base.getDay()) % 7;\n base.setDate(base.getDate() + diff);\n return base;\n },\n endOfMonth: (date) => {\n const base = toNoonTZDate(date);\n base.setMonth(base.getMonth() + 1, 0);\n return base;\n },\n endOfYear: (date) => {\n const base = toNoonTZDate(date);\n base.setMonth(11, 31);\n return base;\n },\n eachMonthOfInterval: (interval) => {\n const start = toNoonTZDate(interval.start);\n const end = toNoonTZDate(interval.end);\n const result = [];\n const cursor = new TZDate(start.getFullYear(), start.getMonth(), 1, 12, 0, 0, timeZone);\n const endKey = end.getFullYear() * 12 + end.getMonth();\n while (cursor.getFullYear() * 12 + cursor.getMonth() <= endKey) {\n result.push(new TZDate(cursor, timeZone));\n cursor.setMonth(cursor.getMonth() + 1, 1);\n }\n return result;\n },\n // Normalize to noon once before arithmetic (avoid DST/midnight edge cases),\n // mutate the same TZDate, and return it.\n addDays: (date, amount) => {\n const base = toNoonTZDate(date);\n base.setDate(base.getDate() + amount);\n return base;\n },\n addWeeks: (date, amount) => {\n const base = toNoonTZDate(date);\n base.setDate(base.getDate() + amount * 7);\n return base;\n },\n addMonths: (date, amount) => {\n const base = toNoonTZDate(date);\n base.setMonth(base.getMonth() + amount);\n return base;\n },\n addYears: (date, amount) => {\n const base = toNoonTZDate(date);\n base.setFullYear(base.getFullYear() + amount);\n return base;\n },\n eachYearOfInterval: (interval) => {\n const start = toNoonTZDate(interval.start);\n const end = toNoonTZDate(interval.end);\n const years = [];\n const cursor = new TZDate(start.getFullYear(), 0, 1, 12, 0, 0, timeZone);\n while (cursor.getFullYear() <= end.getFullYear()) {\n years.push(new TZDate(cursor, timeZone));\n cursor.setFullYear(cursor.getFullYear() + 1, 0, 1);\n }\n return years;\n },\n getWeek: (date, options) => {\n const base = toCalendarDate(date);\n return getWeekFn(base, {\n weekStartsOn: options?.weekStartsOn ?? fallbackWeekStartsOn,\n firstWeekContainsDate: options?.firstWeekContainsDate ??\n locale?.options?.firstWeekContainsDate ??\n 1,\n });\n },\n getISOWeek: (date) => {\n const base = toCalendarDate(date);\n return getISOWeekFn(base);\n },\n differenceInCalendarDays: (dateLeft, dateRight) => {\n const left = toCalendarDate(dateLeft);\n const right = toCalendarDate(dateRight);\n return differenceInCalendarDaysFn(left, right);\n },\n differenceInCalendarMonths: (dateLeft, dateRight) => {\n const left = toCalendarDate(dateLeft);\n const right = toCalendarDate(dateRight);\n return differenceInCalendarMonthsFn(left, right);\n },\n };\n}\n","import { useLayoutEffect, useRef } from \"react\";\nimport { Animation } from \"./UI.js\";\nconst asHtmlElement = (element) => {\n if (element instanceof HTMLElement)\n return element;\n return null;\n};\nconst queryMonthEls = (element) => [\n ...(element.querySelectorAll(\"[data-animated-month]\") ?? []),\n];\nconst queryMonthEl = (element) => asHtmlElement(element.querySelector(\"[data-animated-month]\"));\nconst queryCaptionEl = (element) => asHtmlElement(element.querySelector(\"[data-animated-caption]\"));\nconst queryWeeksEl = (element) => asHtmlElement(element.querySelector(\"[data-animated-weeks]\"));\nconst queryNavEl = (element) => asHtmlElement(element.querySelector(\"[data-animated-nav]\"));\nconst queryWeekdaysEl = (element) => asHtmlElement(element.querySelector(\"[data-animated-weekdays]\"));\n/**\n * Handles animations for transitioning between months in the DayPicker\n * component.\n *\n * @private\n * @param rootElRef - A reference to the root element of the DayPicker\n * component.\n * @param enabled - Whether animations are enabled.\n * @param options - Configuration options for the animation, including class\n * names, months, focused day, and the date utility library.\n */\nexport function useAnimation(rootElRef, enabled, { classNames, months, focused, dateLib, }) {\n const previousRootElSnapshotRef = useRef(null);\n const previousMonthsRef = useRef(months);\n const animatingRef = useRef(false);\n useLayoutEffect(() => {\n // get previous months before updating the previous months ref\n const previousMonths = previousMonthsRef.current;\n // update previous months ref for next effect trigger\n previousMonthsRef.current = months;\n if (!enabled ||\n !rootElRef.current ||\n // safety check because the ref can be set to anything by consumers\n !(rootElRef.current instanceof HTMLElement) ||\n // validation required for the animation to work as expected\n months.length === 0 ||\n previousMonths.length === 0 ||\n months.length !== previousMonths.length) {\n return;\n }\n const isSameMonth = dateLib.isSameMonth(months[0].date, previousMonths[0].date);\n const isAfterPreviousMonth = dateLib.isAfter(months[0].date, previousMonths[0].date);\n const captionAnimationClass = isAfterPreviousMonth\n ? classNames[Animation.caption_after_enter]\n : classNames[Animation.caption_before_enter];\n const weeksAnimationClass = isAfterPreviousMonth\n ? classNames[Animation.weeks_after_enter]\n : classNames[Animation.weeks_before_enter];\n // get previous root element snapshot before updating the snapshot ref\n const previousRootElSnapshot = previousRootElSnapshotRef.current;\n // update snapshot for next effect trigger\n const rootElSnapshot = rootElRef.current.cloneNode(true);\n if (rootElSnapshot instanceof HTMLElement) {\n // if this effect is triggered while animating, we need to clean up the new root snapshot\n // to put it in the same state as when not animating, to correctly animate the next month change\n const currentMonthElsSnapshot = queryMonthEls(rootElSnapshot);\n currentMonthElsSnapshot.forEach((currentMonthElSnapshot) => {\n if (!(currentMonthElSnapshot instanceof HTMLElement))\n return;\n // remove the old month snapshots from the new root snapshot\n const previousMonthElSnapshot = queryMonthEl(currentMonthElSnapshot);\n if (previousMonthElSnapshot &&\n currentMonthElSnapshot.contains(previousMonthElSnapshot)) {\n currentMonthElSnapshot.removeChild(previousMonthElSnapshot);\n }\n // remove animation classes from the new month snapshots\n const captionEl = queryCaptionEl(currentMonthElSnapshot);\n if (captionEl) {\n captionEl.classList.remove(captionAnimationClass);\n }\n const weeksEl = queryWeeksEl(currentMonthElSnapshot);\n if (weeksEl) {\n weeksEl.classList.remove(weeksAnimationClass);\n }\n });\n previousRootElSnapshotRef.current = rootElSnapshot;\n }\n else {\n previousRootElSnapshotRef.current = null;\n }\n if (animatingRef.current ||\n isSameMonth ||\n // skip animation if a day is focused because it can cause issues to the animation and is better for a11y\n focused) {\n return;\n }\n const previousMonthEls = previousRootElSnapshot instanceof HTMLElement\n ? queryMonthEls(previousRootElSnapshot)\n : [];\n const currentMonthEls = queryMonthEls(rootElRef.current);\n if (currentMonthEls?.every((el) => el instanceof HTMLElement) &&\n previousMonthEls?.every((el) => el instanceof HTMLElement)) {\n animatingRef.current = true;\n const cleanUpFunctions = [];\n // set isolation to isolate to isolate the stacking context during animation\n rootElRef.current.style.isolation = \"isolate\";\n // set z-index to 1 to ensure the nav is clickable over the other elements being animated\n const navEl = queryNavEl(rootElRef.current);\n if (navEl) {\n navEl.style.zIndex = \"1\";\n }\n currentMonthEls.forEach((currentMonthEl, index) => {\n const previousMonthEl = previousMonthEls[index];\n if (!previousMonthEl) {\n return;\n }\n // animate new displayed month\n currentMonthEl.style.position = \"relative\";\n currentMonthEl.style.overflow = \"hidden\";\n const captionEl = queryCaptionEl(currentMonthEl);\n if (captionEl) {\n captionEl.classList.add(captionAnimationClass);\n }\n const weeksEl = queryWeeksEl(currentMonthEl);\n if (weeksEl) {\n weeksEl.classList.add(weeksAnimationClass);\n }\n // animate new displayed month end\n const cleanUp = () => {\n animatingRef.current = false;\n if (rootElRef.current) {\n rootElRef.current.style.isolation = \"\";\n }\n if (navEl) {\n navEl.style.zIndex = \"\";\n }\n if (captionEl) {\n captionEl.classList.remove(captionAnimationClass);\n }\n if (weeksEl) {\n weeksEl.classList.remove(weeksAnimationClass);\n }\n currentMonthEl.style.position = \"\";\n currentMonthEl.style.overflow = \"\";\n if (currentMonthEl.contains(previousMonthEl)) {\n currentMonthEl.removeChild(previousMonthEl);\n }\n };\n cleanUpFunctions.push(cleanUp);\n // animate old displayed month\n previousMonthEl.style.pointerEvents = \"none\";\n previousMonthEl.style.position = \"absolute\";\n previousMonthEl.style.overflow = \"hidden\";\n previousMonthEl.setAttribute(\"aria-hidden\", \"true\");\n // hide the weekdays container of the old month and only the new one\n const previousWeekdaysEl = queryWeekdaysEl(previousMonthEl);\n if (previousWeekdaysEl) {\n previousWeekdaysEl.style.opacity = \"0\";\n }\n const previousCaptionEl = queryCaptionEl(previousMonthEl);\n if (previousCaptionEl) {\n previousCaptionEl.classList.add(isAfterPreviousMonth\n ? classNames[Animation.caption_before_exit]\n : classNames[Animation.caption_after_exit]);\n previousCaptionEl.addEventListener(\"animationend\", cleanUp);\n }\n const previousWeeksEl = queryWeeksEl(previousMonthEl);\n if (previousWeeksEl) {\n previousWeeksEl.classList.add(isAfterPreviousMonth\n ? classNames[Animation.weeks_before_exit]\n : classNames[Animation.weeks_after_exit]);\n }\n currentMonthEl.insertBefore(previousMonthEl, currentMonthEl.firstChild);\n });\n }\n });\n}\n","/**\n * Returns all the dates to display in the calendar.\n *\n * This function calculates the range of dates to display based on the provided\n * display months, constraints, and calendar configuration.\n *\n * @param displayMonths The months to display in the calendar.\n * @param maxDate The maximum date to include in the range.\n * @param props The DayPicker props, including calendar configuration options.\n * @param dateLib The date library to use for date manipulation.\n * @returns An array of dates to display in the calendar.\n */\nexport function getDates(displayMonths, maxDate, props, dateLib) {\n const firstMonth = displayMonths[0];\n const lastMonth = displayMonths[displayMonths.length - 1];\n const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {};\n const { addDays, differenceInCalendarDays, differenceInCalendarMonths, endOfBroadcastWeek, endOfISOWeek, endOfMonth, endOfWeek, isAfter, startOfBroadcastWeek, startOfISOWeek, startOfWeek, } = dateLib;\n const startWeekFirstDate = broadcastCalendar\n ? startOfBroadcastWeek(firstMonth, dateLib)\n : ISOWeek\n ? startOfISOWeek(firstMonth)\n : startOfWeek(firstMonth);\n const displayMonthsWeekEnd = broadcastCalendar\n ? endOfBroadcastWeek(lastMonth)\n : ISOWeek\n ? endOfISOWeek(endOfMonth(lastMonth))\n : endOfWeek(endOfMonth(lastMonth));\n // If maxDate is set, clamp the grid to the end of that week.\n const constraintWeekEnd = maxDate &&\n (broadcastCalendar\n ? endOfBroadcastWeek(maxDate)\n : ISOWeek\n ? endOfISOWeek(maxDate)\n : endOfWeek(maxDate));\n // Pick the earliest week end between the displayed months and the constraint.\n const gridEndDate = constraintWeekEnd && isAfter(displayMonthsWeekEnd, constraintWeekEnd)\n ? constraintWeekEnd\n : displayMonthsWeekEnd;\n const nOfDays = differenceInCalendarDays(gridEndDate, startWeekFirstDate);\n const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;\n const dates = [];\n for (let i = 0; i <= nOfDays; i++) {\n const date = addDays(startWeekFirstDate, i);\n dates.push(date);\n }\n // If fixed weeks is enabled, add the extra dates to the array\n const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;\n const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;\n if (fixedWeeks && dates.length < extraDates) {\n const daysToAdd = extraDates - dates.length;\n for (let i = 0; i < daysToAdd; i++) {\n const date = addDays(dates[dates.length - 1], 1);\n dates.push(date);\n }\n }\n return dates;\n}\n","/**\n * Returns all the days belonging to the calendar by merging the days in the\n * weeks for each month.\n *\n * @param calendarMonths The array of calendar months.\n * @returns An array of `CalendarDay` objects representing all the days in the\n * calendar.\n */\nexport function getDays(calendarMonths) {\n const initialDays = [];\n return calendarMonths.reduce((days, month) => {\n const weekDays = month.weeks.reduce((weekDays, week) => {\n return weekDays.concat(week.days.slice());\n }, initialDays.slice());\n return days.concat(weekDays.slice());\n }, initialDays.slice());\n}\n","/**\n * Returns the months to display in the calendar.\n *\n * @param firstDisplayedMonth The first month currently displayed in the\n * calendar.\n * @param calendarEndMonth The latest month the user can navigate to.\n * @param props The DayPicker props, including `numberOfMonths`.\n * @param dateLib The date library to use for date manipulation.\n * @returns An array of dates representing the months to display.\n */\nexport function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) {\n const { numberOfMonths = 1 } = props;\n const months = [];\n for (let i = 0; i < numberOfMonths; i++) {\n const month = dateLib.addMonths(firstDisplayedMonth, i);\n if (calendarEndMonth && month > calendarEndMonth) {\n break;\n }\n months.push(month);\n }\n return months;\n}\n","/**\n * Determines the initial month to display in the calendar based on the provided\n * props.\n *\n * This function calculates the starting month, considering constraints such as\n * `startMonth`, `endMonth`, and the number of months to display.\n *\n * @param props The DayPicker props, including navigation and date constraints.\n * @param dateLib The date library to use for date manipulation.\n * @returns The initial month to display.\n */\nexport function getInitialMonth(props, navStart, navEnd, dateLib) {\n const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1, } = props;\n let initialMonth = month || defaultMonth || today;\n const { differenceInCalendarMonths, addMonths, startOfMonth } = dateLib;\n if (navEnd &&\n differenceInCalendarMonths(navEnd, initialMonth) < numberOfMonths - 1) {\n const offset = -1 * (numberOfMonths - 1);\n initialMonth = addMonths(navEnd, offset);\n }\n if (navStart && differenceInCalendarMonths(initialMonth, navStart) < 0) {\n initialMonth = navStart;\n }\n return startOfMonth(initialMonth);\n}\n","import { CalendarDay, CalendarMonth, CalendarWeek } from \"../classes/index.js\";\n/**\n * Returns the months to display in the calendar.\n *\n * This function generates `CalendarMonth` objects for each month to be\n * displayed, including their weeks and days, based on the provided display\n * months and dates.\n *\n * @param displayMonths The months (as dates) to display in the calendar.\n * @param dates The dates to display in the calendar.\n * @param props Options from the DayPicker props context.\n * @param dateLib The date library to use for date manipulation.\n * @returns An array of `CalendarMonth` objects representing the months to\n * display.\n */\nexport function getMonths(displayMonths, dates, props, dateLib) {\n const { addDays, endOfBroadcastWeek, endOfISOWeek, endOfMonth, endOfWeek, getISOWeek, getWeek, startOfBroadcastWeek, startOfISOWeek, startOfWeek, } = dateLib;\n const dayPickerMonths = displayMonths.reduce((months, month) => {\n const firstDateOfFirstWeek = props.broadcastCalendar\n ? startOfBroadcastWeek(month, dateLib)\n : props.ISOWeek\n ? startOfISOWeek(month)\n : startOfWeek(month);\n const lastDateOfLastWeek = props.broadcastCalendar\n ? endOfBroadcastWeek(month)\n : props.ISOWeek\n ? endOfISOWeek(endOfMonth(month))\n : endOfWeek(endOfMonth(month));\n /** The dates to display in the month. */\n const monthDates = dates.filter((date) => {\n return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;\n });\n const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;\n if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {\n const extraDates = dates.filter((date) => {\n const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;\n return (date > lastDateOfLastWeek &&\n date <= addDays(lastDateOfLastWeek, daysToAdd));\n });\n monthDates.push(...extraDates);\n }\n const weeks = monthDates.reduce((weeks, date) => {\n const weekNumber = props.ISOWeek ? getISOWeek(date) : getWeek(date);\n const week = weeks.find((week) => week.weekNumber === weekNumber);\n const day = new CalendarDay(date, month, dateLib);\n if (!week) {\n weeks.push(new CalendarWeek(weekNumber, [day]));\n }\n else {\n week.days.push(day);\n }\n return weeks;\n }, []);\n const dayPickerMonth = new CalendarMonth(month, weeks);\n months.push(dayPickerMonth);\n return months;\n }, []);\n if (!props.reverseMonths) {\n return dayPickerMonths;\n }\n else {\n return dayPickerMonths.reverse();\n }\n}\n","/**\n * Returns the start and end months for calendar navigation.\n *\n * @param props The DayPicker props, including navigation and layout options.\n * @param dateLib The date library to use for date manipulation.\n * @returns A tuple containing the start and end months for navigation.\n */\nexport function getNavMonths(props, dateLib) {\n let { startMonth, endMonth } = props;\n const { startOfYear, startOfDay, startOfMonth, endOfMonth, addYears, endOfYear, today, } = dateLib;\n const hasYearDropdown = props.captionLayout === \"dropdown\" ||\n props.captionLayout === \"dropdown-years\";\n if (startMonth) {\n startMonth = startOfMonth(startMonth);\n }\n else if (!startMonth && hasYearDropdown) {\n startMonth = startOfYear(addYears(props.today ?? today(), -100));\n }\n if (endMonth) {\n endMonth = endOfMonth(endMonth);\n }\n else if (!endMonth && hasYearDropdown) {\n endMonth = endOfYear(props.today ?? today());\n }\n return [\n startMonth ? startOfDay(startMonth) : startMonth,\n endMonth ? startOfDay(endMonth) : endMonth,\n ];\n}\n","/**\n * Returns the next month the user can navigate to, based on the given options.\n *\n * The next month is not always the next calendar month:\n *\n * - If it is after the `calendarEndMonth`, it returns `undefined`.\n * - If paged navigation is enabled, it skips forward by the number of displayed\n * months.\n *\n * @param firstDisplayedMonth The first month currently displayed in the\n * calendar.\n * @param calendarEndMonth The latest month the user can navigate to.\n * @param options Navigation options, including `numberOfMonths` and\n * `pagedNavigation`.\n * @param dateLib The date library to use for date manipulation.\n * @returns The next month, or `undefined` if navigation is not possible.\n */\nexport function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) {\n if (options.disableNavigation) {\n return undefined;\n }\n const { pagedNavigation, numberOfMonths = 1 } = options;\n const { startOfMonth, addMonths, differenceInCalendarMonths } = dateLib;\n const offset = pagedNavigation ? numberOfMonths : 1;\n const month = startOfMonth(firstDisplayedMonth);\n if (!calendarEndMonth) {\n return addMonths(month, offset);\n }\n const monthsDiff = differenceInCalendarMonths(calendarEndMonth, firstDisplayedMonth);\n if (monthsDiff < numberOfMonths) {\n return undefined;\n }\n return addMonths(month, offset);\n}\n","/**\n * Returns the previous month the user can navigate to, based on the given\n * options.\n *\n * The previous month is not always the previous calendar month:\n *\n * - If it is before the `calendarStartMonth`, it returns `undefined`.\n * - If paged navigation is enabled, it skips back by the number of displayed\n * months.\n *\n * @param firstDisplayedMonth The first month currently displayed in the\n * calendar.\n * @param calendarStartMonth The earliest month the user can navigate to.\n * @param options Navigation options, including `numberOfMonths` and\n * `pagedNavigation`.\n * @param dateLib The date library to use for date manipulation.\n * @returns The previous month, or `undefined` if navigation is not possible.\n */\nexport function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) {\n if (options.disableNavigation) {\n return undefined;\n }\n const { pagedNavigation, numberOfMonths } = options;\n const { startOfMonth, addMonths, differenceInCalendarMonths } = dateLib;\n const offset = pagedNavigation ? (numberOfMonths ?? 1) : 1;\n const month = startOfMonth(firstDisplayedMonth);\n if (!calendarStartMonth) {\n return addMonths(month, -offset);\n }\n const monthsDiff = differenceInCalendarMonths(month, calendarStartMonth);\n if (monthsDiff <= 0) {\n return undefined;\n }\n return addMonths(month, -offset);\n}\n","/**\n * Returns an array of calendar weeks from an array of calendar months.\n *\n * @param months The array of calendar months.\n * @returns An array of calendar weeks.\n */\nexport function getWeeks(months) {\n const initialWeeks = [];\n return months.reduce((weeks, month) => {\n return weeks.concat(month.weeks.slice());\n }, initialWeeks.slice());\n}\n","import { useState } from \"react\";\n/**\n * A custom hook for managing both controlled and uncontrolled component states.\n *\n * This hook allows a component to support both controlled and uncontrolled\n * states by determining whether the `controlledValue` is provided. If it is\n * undefined, the hook falls back to using the internal state.\n *\n * @example\n * // Uncontrolled usage\n * const [value, setValue] = useControlledValue(0, undefined);\n *\n * // Controlled usage\n * const [value, setValue] = useControlledValue(0, props.value);\n *\n * @template T - The type of the value.\n * @param defaultValue The initial value for the uncontrolled state.\n * @param controlledValue The value for the controlled state. If undefined, the\n * component will use the uncontrolled state.\n * @returns A tuple where the first element is the current value (either\n * controlled or uncontrolled) and the second element is a setter function to\n * update the value.\n */\nexport function useControlledValue(defaultValue, controlledValue) {\n const [uncontrolledValue, setValue] = useState(defaultValue);\n const value = controlledValue === undefined ? uncontrolledValue : controlledValue;\n return [value, setValue];\n}\n","import { useEffect, useMemo } from \"react\";\nimport { getDates } from \"./helpers/getDates.js\";\nimport { getDays } from \"./helpers/getDays.js\";\nimport { getDisplayMonths } from \"./helpers/getDisplayMonths.js\";\nimport { getInitialMonth } from \"./helpers/getInitialMonth.js\";\nimport { getMonths } from \"./helpers/getMonths.js\";\nimport { getNavMonths } from \"./helpers/getNavMonth.js\";\nimport { getNextMonth } from \"./helpers/getNextMonth.js\";\nimport { getPreviousMonth } from \"./helpers/getPreviousMonth.js\";\nimport { getWeeks } from \"./helpers/getWeeks.js\";\nimport { useControlledValue } from \"./helpers/useControlledValue.js\";\n/**\n * Provides the calendar object to work with the calendar in custom components.\n *\n * @private\n * @param props - The DayPicker props related to calendar configuration.\n * @param dateLib - The date utility library instance.\n * @returns The calendar object containing displayed days, weeks, months, and\n * navigation methods.\n */\nexport function useCalendar(props, dateLib) {\n const [navStart, navEnd] = getNavMonths(props, dateLib);\n const { startOfMonth, endOfMonth } = dateLib;\n const initialMonth = getInitialMonth(props, navStart, navEnd, dateLib);\n const [firstMonth, setFirstMonth] = useControlledValue(initialMonth, \n // initialMonth is always computed from props.month if provided\n props.month ? initialMonth : undefined);\n // biome-ignore lint/correctness/useExhaustiveDependencies: change the initial month when the time zone changes.\n useEffect(() => {\n const newInitialMonth = getInitialMonth(props, navStart, navEnd, dateLib);\n setFirstMonth(newInitialMonth);\n }, [props.timeZone]);\n /** The months displayed in the calendar. */\n // biome-ignore lint/correctness/useExhaustiveDependencies: We want to recompute only when specific props change.\n const { months, weeks, days, previousMonth, nextMonth } = useMemo(() => {\n const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib);\n const dates = getDates(displayMonths, props.endMonth ? endOfMonth(props.endMonth) : undefined, {\n ISOWeek: props.ISOWeek,\n fixedWeeks: props.fixedWeeks,\n broadcastCalendar: props.broadcastCalendar,\n }, dateLib);\n const months = getMonths(displayMonths, dates, {\n broadcastCalendar: props.broadcastCalendar,\n fixedWeeks: props.fixedWeeks,\n ISOWeek: props.ISOWeek,\n reverseMonths: props.reverseMonths,\n }, dateLib);\n const weeks = getWeeks(months);\n const days = getDays(months);\n const previousMonth = getPreviousMonth(firstMonth, navStart, props, dateLib);\n const nextMonth = getNextMonth(firstMonth, navEnd, props, dateLib);\n return {\n months,\n weeks,\n days,\n previousMonth,\n nextMonth,\n };\n }, [\n dateLib,\n firstMonth.getTime(),\n navEnd?.getTime(),\n navStart?.getTime(),\n props.disableNavigation,\n props.broadcastCalendar,\n props.endMonth?.getTime(),\n props.fixedWeeks,\n props.ISOWeek,\n props.numberOfMonths,\n props.pagedNavigation,\n props.reverseMonths,\n ]);\n const { disableNavigation, onMonthChange } = props;\n const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day)));\n const goToMonth = (date) => {\n if (disableNavigation) {\n return;\n }\n let newMonth = startOfMonth(date);\n // if month is before start, use the first month instead\n if (navStart && newMonth < startOfMonth(navStart)) {\n newMonth = startOfMonth(navStart);\n }\n // if month is after endMonth, use the last month instead\n if (navEnd && newMonth > startOfMonth(navEnd)) {\n newMonth = startOfMonth(navEnd);\n }\n setFirstMonth(newMonth);\n onMonthChange?.(newMonth);\n };\n const goToDay = (day) => {\n // is this check necessary?\n if (isDayInCalendar(day)) {\n return;\n }\n goToMonth(day.date);\n };\n const calendar = {\n months,\n weeks,\n days,\n navStart,\n navEnd,\n previousMonth,\n nextMonth,\n goToMonth,\n goToDay,\n };\n return calendar;\n}\n","import { DayFlag } from \"../UI.js\";\nvar FocusTargetPriority;\n(function (FocusTargetPriority) {\n FocusTargetPriority[FocusTargetPriority[\"Today\"] = 0] = \"Today\";\n FocusTargetPriority[FocusTargetPriority[\"Selected\"] = 1] = \"Selected\";\n FocusTargetPriority[FocusTargetPriority[\"LastFocused\"] = 2] = \"LastFocused\";\n FocusTargetPriority[FocusTargetPriority[\"FocusedModifier\"] = 3] = \"FocusedModifier\";\n})(FocusTargetPriority || (FocusTargetPriority = {}));\n/**\n * Determines if a day is focusable based on its modifiers.\n *\n * A day is considered focusable if it is not disabled, hidden, or outside the\n * displayed month.\n *\n * @param modifiers The modifiers applied to the day.\n * @returns `true` if the day is focusable, otherwise `false`.\n */\nfunction isFocusableDay(modifiers) {\n return (!modifiers[DayFlag.disabled] &&\n !modifiers[DayFlag.hidden] &&\n !modifiers[DayFlag.outside]);\n}\n/**\n * Calculates the focus target day based on priority.\n *\n * This function determines the day that should receive focus in the calendar,\n * prioritizing days with specific modifiers (e.g., \"focused\", \"today\") or\n * selection states.\n *\n * @param days The array of `CalendarDay` objects to evaluate.\n * @param getModifiers A function to retrieve the modifiers for a given day.\n * @param isSelected A function to determine if a day is selected.\n * @param lastFocused The last focused day, if any.\n * @returns The `CalendarDay` that should receive focus, or `undefined` if no\n * focusable day is found.\n */\nexport function calculateFocusTarget(days, getModifiers, isSelected, lastFocused) {\n let focusTarget;\n let foundFocusTargetPriority = -1;\n for (const day of days) {\n const modifiers = getModifiers(day);\n if (isFocusableDay(modifiers)) {\n if (modifiers[DayFlag.focused] &&\n foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.FocusedModifier;\n }\n else if (lastFocused?.isEqualTo(day) &&\n foundFocusTargetPriority < FocusTargetPriority.LastFocused) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.LastFocused;\n }\n else if (isSelected(day.date) &&\n foundFocusTargetPriority < FocusTargetPriority.Selected) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.Selected;\n }\n else if (modifiers[DayFlag.today] &&\n foundFocusTargetPriority < FocusTargetPriority.Today) {\n focusTarget = day;\n foundFocusTargetPriority = FocusTargetPriority.Today;\n }\n }\n }\n if (!focusTarget) {\n // Return the first day that is focusable\n focusTarget = days.find((day) => isFocusableDay(getModifiers(day)));\n }\n return focusTarget;\n}\n","/**\n * Calculates the next date that should be focused in the calendar.\n *\n * This function determines the next focusable date based on the movement\n * direction, constraints, and calendar configuration.\n *\n * @param moveBy The unit of movement (e.g., \"day\", \"week\").\n * @param moveDir The direction of movement (\"before\" or \"after\").\n * @param refDate The reference date from which to calculate the next focusable\n * date.\n * @param navStart The earliest date the user can navigate to.\n * @param navEnd The latest date the user can navigate to.\n * @param props The DayPicker props, including calendar configuration options.\n * @param dateLib The date library to use for date manipulation.\n * @returns The next focusable date.\n */\nexport function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {\n const { ISOWeek, broadcastCalendar } = props;\n const { addDays, addMonths, addWeeks, addYears, endOfBroadcastWeek, endOfISOWeek, endOfWeek, max, min, startOfBroadcastWeek, startOfISOWeek, startOfWeek, } = dateLib;\n const moveFns = {\n day: addDays,\n week: addWeeks,\n month: addMonths,\n year: addYears,\n startOfWeek: (date) => broadcastCalendar\n ? startOfBroadcastWeek(date, dateLib)\n : ISOWeek\n ? startOfISOWeek(date)\n : startOfWeek(date),\n endOfWeek: (date) => broadcastCalendar\n ? endOfBroadcastWeek(date)\n : ISOWeek\n ? endOfISOWeek(date)\n : endOfWeek(date),\n };\n let focusableDate = moveFns[moveBy](refDate, moveDir === \"after\" ? 1 : -1);\n if (moveDir === \"before\" && navStart) {\n focusableDate = max([navStart, focusableDate]);\n }\n else if (moveDir === \"after\" && navEnd) {\n focusableDate = min([navEnd, focusableDate]);\n }\n return focusableDate;\n}\n","import { CalendarDay } from \"../classes/index.js\";\nimport { dateMatchModifiers } from \"../utils/dateMatchModifiers.js\";\nimport { getFocusableDate } from \"./getFocusableDate.js\";\n/**\n * Determines the next focusable day in the calendar.\n *\n * This function recursively calculates the next focusable day based on the\n * movement direction and modifiers applied to the days.\n *\n * @param moveBy The unit of movement (e.g., \"day\", \"week\").\n * @param moveDir The direction of movement (\"before\" or \"after\").\n * @param refDay The currently focused day.\n * @param calendarStartMonth The earliest month the user can navigate to.\n * @param calendarEndMonth The latest month the user can navigate to.\n * @param props The DayPicker props, including modifiers and configuration\n * options.\n * @param dateLib The date library to use for date manipulation.\n * @param attempt The current recursion attempt (used to limit recursion depth).\n * @returns The next focusable day, or `undefined` if no focusable day is found.\n */\nexport function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) {\n if (attempt > 365) {\n // Limit the recursion to 365 attempts\n return undefined;\n }\n const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib);\n const isDisabled = Boolean(props.disabled &&\n dateMatchModifiers(focusableDate, props.disabled, dateLib));\n const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib));\n const targetMonth = focusableDate;\n const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib);\n if (!isDisabled && !isHidden) {\n return focusDay;\n }\n // Recursively attempt to find the next focusable date\n return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1);\n}\n","import { useState } from \"react\";\nimport { calculateFocusTarget } from \"./helpers/calculateFocusTarget.js\";\nimport { getNextFocus } from \"./helpers/getNextFocus.js\";\n/**\n * Manages focus behavior for the DayPicker component, including setting,\n * moving, and blurring focus on calendar days.\n *\n * @template T - The type of DayPicker props.\n * @param props - The DayPicker props.\n * @param calendar - The calendar object containing the displayed days and\n * months.\n * @param getModifiers - A function to retrieve modifiers for a given day.\n * @param isSelected - A function to check if a date is selected.\n * @param dateLib - The date utility library instance.\n * @returns An object containing focus-related methods and the currently focused\n * day.\n */\nexport function useFocus(props, calendar, getModifiers, isSelected, dateLib) {\n const { autoFocus } = props;\n const [lastFocused, setLastFocused] = useState();\n const focusTarget = calculateFocusTarget(calendar.days, getModifiers, isSelected || (() => false), lastFocused);\n const [focusedDay, setFocused] = useState(autoFocus ? focusTarget : undefined);\n const blur = () => {\n setLastFocused(focusedDay);\n setFocused(undefined);\n };\n const moveFocus = (moveBy, moveDir) => {\n if (!focusedDay)\n return;\n const nextFocus = getNextFocus(moveBy, moveDir, focusedDay, calendar.navStart, calendar.navEnd, props, dateLib);\n if (!nextFocus)\n return;\n if (props.disableNavigation) {\n const isNextInCalendar = calendar.days.some((day) => day.isEqualTo(nextFocus));\n if (!isNextInCalendar) {\n return;\n }\n }\n calendar.goToDay(nextFocus);\n setFocused(nextFocus);\n };\n const isFocusTarget = (day) => {\n return Boolean(focusTarget?.isEqualTo(day));\n };\n const useFocus = {\n isFocusTarget,\n setFocused,\n focused: focusedDay,\n blur,\n moveFocus,\n };\n return useFocus;\n}\n","import { useControlledValue } from \"../helpers/useControlledValue.js\";\n/**\n * Hook to manage multiple-date selection in the DayPicker component.\n *\n * @template T - The type of DayPicker props.\n * @param props - The DayPicker props.\n * @param dateLib - The date utility library instance.\n * @returns An object containing the selected dates, a function to select dates,\n * and a function to check if a date is selected.\n */\nexport function useMulti(props, dateLib) {\n const { selected: initiallySelected, required, onSelect, } = props;\n const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : undefined);\n const selected = !onSelect ? internallySelected : initiallySelected;\n const { isSameDay } = dateLib;\n const isSelected = (date) => {\n return selected?.some((d) => isSameDay(d, date)) ?? false;\n };\n const { min, max } = props;\n const select = (triggerDate, modifiers, e) => {\n let newDates = [...(selected ?? [])];\n if (isSelected(triggerDate)) {\n if (selected?.length === min) {\n // Min value reached, do nothing\n return;\n }\n if (required && selected?.length === 1) {\n // Required value already selected do nothing\n return;\n }\n newDates = selected?.filter((d) => !isSameDay(d, triggerDate));\n }\n else {\n if (selected?.length === max) {\n // Max value reached, reset the selection to date\n newDates = [triggerDate];\n }\n else {\n // Add the date to the selection\n newDates = [...newDates, triggerDate];\n }\n }\n if (!onSelect) {\n setSelected(newDates);\n }\n onSelect?.(newDates, triggerDate, modifiers, e);\n return newDates;\n };\n return {\n selected,\n select,\n isSelected,\n };\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\n/**\n * Adds a date to an existing range, considering constraints like minimum and\n * maximum range size.\n *\n * @param date - The date to add to the range.\n * @param initialRange - The initial range to which the date will be added.\n * @param min - The minimum number of days in the range.\n * @param max - The maximum number of days in the range.\n * @param required - Whether the range must always include at least one date.\n * @param dateLib - The date utility library instance.\n * @returns The updated date range, or `undefined` if the range is cleared.\n * @group Utilities\n */\nexport function addToRange(date, initialRange, min = 0, max = 0, required = false, dateLib = defaultDateLib) {\n const { from, to } = initialRange || {};\n const { isSameDay, isAfter, isBefore } = dateLib;\n let range;\n if (!from && !to) {\n // the range is empty, add the date\n range = { from: date, to: min > 0 ? undefined : date };\n }\n else if (from && !to) {\n // adding date to an incomplete range\n if (isSameDay(from, date)) {\n // adding a date equal to the start of the range\n if (min === 0) {\n range = { from, to: date };\n }\n else if (required) {\n range = { from, to: undefined };\n }\n else {\n range = undefined;\n }\n }\n else if (isBefore(date, from)) {\n // adding a date before the start of the range\n range = { from: date, to: from };\n }\n else {\n // adding a date after the start of the range\n range = { from, to: date };\n }\n }\n else if (from && to) {\n // adding date to a complete range\n if (isSameDay(from, date) && isSameDay(to, date)) {\n // adding a date that is equal to both start and end of the range\n if (required) {\n range = { from, to };\n }\n else {\n range = undefined;\n }\n }\n else if (isSameDay(from, date)) {\n // adding a date equal to the the start of the range\n range = { from, to: min > 0 ? undefined : date };\n }\n else if (isSameDay(to, date)) {\n // adding a dare equal to the end of the range\n range = { from: date, to: min > 0 ? undefined : date };\n }\n else if (isBefore(date, from)) {\n // adding a date before the start of the range\n range = { from: date, to: to };\n }\n else if (isAfter(date, from)) {\n // adding a date after the start of the range\n range = { from, to: date };\n }\n else if (isAfter(date, to)) {\n // adding a date after the end of the range\n range = { from, to: date };\n }\n else {\n throw new Error(\"Invalid range\");\n }\n }\n // check for min / max\n if (range?.from && range?.to) {\n const diff = dateLib.differenceInCalendarDays(range.to, range.from);\n if (max > 0 && diff > max) {\n range = { from: date, to: undefined };\n }\n else if (min > 1 && diff < min) {\n range = { from: date, to: undefined };\n }\n }\n return range;\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\n/**\n * Checks if a date range contains one or more specified days of the week.\n *\n * @since 9.2.2\n * @param range - The date range to check.\n * @param dayOfWeek - The day(s) of the week to check for (`0-6`, where `0` is\n * Sunday).\n * @param dateLib - The date utility library instance.\n * @returns `true` if the range contains the specified day(s) of the week,\n * otherwise `false`.\n * @group Utilities\n */\nexport function rangeContainsDayOfWeek(range, dayOfWeek, dateLib = defaultDateLib) {\n const dayOfWeekArr = !Array.isArray(dayOfWeek) ? [dayOfWeek] : dayOfWeek;\n let date = range.from;\n const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);\n // iterate at maximum one week or the total days if the range is shorter than one week\n const totalDaysLimit = Math.min(totalDays, 6);\n for (let i = 0; i <= totalDaysLimit; i++) {\n if (dayOfWeekArr.includes(date.getDay())) {\n return true;\n }\n date = dateLib.addDays(date, 1);\n }\n return false;\n}\n","import { defaultDateLib } from \"../classes/index.js\";\nimport { rangeIncludesDate } from \"./rangeIncludesDate.js\";\n/**\n * Determines if two date ranges overlap.\n *\n * @since 9.2.2\n * @param rangeLeft - The first date range.\n * @param rangeRight - The second date range.\n * @param dateLib - The date utility library instance.\n * @returns `true` if the ranges overlap, otherwise `false`.\n * @group Utilities\n */\nexport function rangeOverlaps(rangeLeft, rangeRight, dateLib = defaultDateLib) {\n return (rangeIncludesDate(rangeLeft, rangeRight.from, false, dateLib) ||\n rangeIncludesDate(rangeLeft, rangeRight.to, false, dateLib) ||\n rangeIncludesDate(rangeRight, rangeLeft.from, false, dateLib) ||\n rangeIncludesDate(rangeRight, rangeLeft.to, false, dateLib));\n}\n","import { defaultDateLib } from \"../classes/DateLib.js\";\nimport { dateMatchModifiers } from \"./dateMatchModifiers.js\";\nimport { rangeContainsDayOfWeek } from \"./rangeContainsDayOfWeek.js\";\nimport { rangeIncludesDate } from \"./rangeIncludesDate.js\";\nimport { rangeOverlaps } from \"./rangeOverlaps.js\";\nimport { isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDatesArray, isDayOfWeekType, } from \"./typeguards.js\";\n/**\n * Checks if a date range contains dates that match the given modifiers.\n *\n * @since 9.2.2\n * @param range - The date range to check.\n * @param modifiers - The modifiers to match against.\n * @param dateLib - The date utility library instance.\n * @returns `true` if the range contains matching dates, otherwise `false`.\n * @group Utilities\n */\nexport function rangeContainsModifiers(range, modifiers, dateLib = defaultDateLib) {\n const matchers = Array.isArray(modifiers) ? modifiers : [modifiers];\n // Defer function matchers evaluation as they are the least performant.\n const nonFunctionMatchers = matchers.filter((matcher) => typeof matcher !== \"function\");\n const nonFunctionMatchersResult = nonFunctionMatchers.some((matcher) => {\n if (typeof matcher === \"boolean\")\n return matcher;\n if (dateLib.isDate(matcher)) {\n return rangeIncludesDate(range, matcher, false, dateLib);\n }\n if (isDatesArray(matcher, dateLib)) {\n return matcher.some((date) => rangeIncludesDate(range, date, false, dateLib));\n }\n if (isDateRange(matcher)) {\n if (matcher.from && matcher.to) {\n return rangeOverlaps(range, { from: matcher.from, to: matcher.to }, dateLib);\n }\n return false;\n }\n if (isDayOfWeekType(matcher)) {\n return rangeContainsDayOfWeek(range, matcher.dayOfWeek, dateLib);\n }\n if (isDateInterval(matcher)) {\n const isClosedInterval = dateLib.isAfter(matcher.before, matcher.after);\n if (isClosedInterval) {\n return rangeOverlaps(range, {\n from: dateLib.addDays(matcher.after, 1),\n to: dateLib.addDays(matcher.before, -1),\n }, dateLib);\n }\n return (dateMatchModifiers(range.from, matcher, dateLib) ||\n dateMatchModifiers(range.to, matcher, dateLib));\n }\n if (isDateAfterType(matcher) || isDateBeforeType(matcher)) {\n return (dateMatchModifiers(range.from, matcher, dateLib) ||\n dateMatchModifiers(range.to, matcher, dateLib));\n }\n return false;\n });\n if (nonFunctionMatchersResult) {\n return true;\n }\n const functionMatchers = matchers.filter((matcher) => typeof matcher === \"function\");\n if (functionMatchers.length) {\n let date = range.from;\n const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);\n for (let i = 0; i <= totalDays; i++) {\n if (functionMatchers.some((matcher) => matcher(date))) {\n return true;\n }\n date = dateLib.addDays(date, 1);\n }\n }\n return false;\n}\n","import { useControlledValue } from \"../helpers/useControlledValue.js\";\nimport { addToRange, rangeContainsModifiers } from \"../utils/index.js\";\nimport { rangeIncludesDate } from \"../utils/rangeIncludesDate.js\";\n/**\n * Hook to manage range selection in the DayPicker component.\n *\n * @template T - The type of DayPicker props.\n * @param props - The DayPicker props.\n * @param dateLib - The date utility library instance.\n * @returns An object containing the selected range, a function to select a\n * range, and a function to check if a date is within the range.\n */\nexport function useRange(props, dateLib) {\n const { disabled, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect, } = props;\n const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : undefined);\n const selected = !onSelect ? internallySelected : initiallySelected;\n const isSelected = (date) => selected && rangeIncludesDate(selected, date, false, dateLib);\n const select = (triggerDate, modifiers, e) => {\n const { min, max } = props;\n let newRange;\n if (triggerDate) {\n const selectedFrom = selected?.from;\n const selectedTo = selected?.to;\n const hasFullRange = !!selectedFrom && !!selectedTo;\n const isClickingSingleDayRange = !!selectedFrom &&\n !!selectedTo &&\n dateLib.isSameDay(selectedFrom, selectedTo) &&\n dateLib.isSameDay(triggerDate, selectedFrom);\n if (resetOnSelect && (hasFullRange || !selected?.from)) {\n if (!required && isClickingSingleDayRange) {\n newRange = undefined;\n }\n else {\n newRange = { from: triggerDate, to: undefined };\n }\n }\n else {\n newRange = addToRange(triggerDate, selected, min, max, required, dateLib);\n }\n }\n if (excludeDisabled && disabled && newRange?.from && newRange.to) {\n if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled, dateLib)) {\n // if a disabled days is found, the range is reset\n newRange.from = triggerDate;\n newRange.to = undefined;\n }\n }\n if (!onSelect) {\n setSelected(newRange);\n }\n onSelect?.(newRange, triggerDate, modifiers, e);\n return newRange;\n };\n return {\n selected,\n select,\n isSelected,\n };\n}\n","import { useControlledValue } from \"../helpers/useControlledValue.js\";\n/**\n * Hook to manage single-date selection in the DayPicker component.\n *\n * @template T - The type of DayPicker props.\n * @param props - The DayPicker props.\n * @param dateLib - The date utility library instance.\n * @returns An object containing the selected date, a function to select a date,\n * and a function to check if a date is selected.\n */\nexport function useSingle(props, dateLib) {\n const { selected: initiallySelected, required, onSelect, } = props;\n const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : undefined);\n const selected = !onSelect ? internallySelected : initiallySelected;\n const { isSameDay } = dateLib;\n const isSelected = (compareDate) => {\n return selected ? isSameDay(selected, compareDate) : false;\n };\n const select = (triggerDate, modifiers, e) => {\n let newDate = triggerDate;\n if (!required && selected && selected && isSameDay(triggerDate, selected)) {\n // If the date is the same, clear the selection.\n newDate = undefined;\n }\n if (!onSelect) {\n setSelected(newDate);\n }\n if (required) {\n onSelect?.(newDate, triggerDate, modifiers, e);\n }\n else {\n onSelect?.(newDate, triggerDate, modifiers, e);\n }\n return newDate;\n };\n return {\n selected,\n select,\n isSelected,\n };\n}\n","import { useMulti } from \"./selection/useMulti.js\";\nimport { useRange } from \"./selection/useRange.js\";\nimport { useSingle } from \"./selection/useSingle.js\";\n/**\n * Determines the appropriate selection hook to use based on the selection mode\n * and returns the corresponding selection object.\n *\n * @template T - The type of DayPicker props.\n * @param props - The DayPicker props.\n * @param dateLib - The date utility library instance.\n * @returns The selection object for the specified mode, or `undefined` if no\n * mode is set.\n */\nexport function useSelection(props, dateLib) {\n const single = useSingle(props, dateLib);\n const multi = useMulti(props, dateLib);\n const range = useRange(props, dateLib);\n switch (props.mode) {\n case \"single\":\n return single;\n case \"multiple\":\n return multi;\n case \"range\":\n return range;\n default:\n return undefined;\n }\n}\n","import { TZDate } from \"@date-fns/tz\";\n/**\n * Convert a {@link Date} or {@link TZDate} instance to the given time zone.\n * Reuses the same instance when it is already a {@link TZDate} using the target\n * time zone to avoid extra allocations.\n */\nexport function toTimeZone(date, timeZone) {\n if (date instanceof TZDate && date.timeZone === timeZone) {\n return date;\n }\n return new TZDate(date, timeZone);\n}\n","import { TZDate } from \"@date-fns/tz\";\nimport { toTimeZone } from \"./toTimeZone.js\";\nimport { isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, } from \"./typeguards.js\";\nfunction toZoneNoon(date, timeZone, noonSafe) {\n if (!noonSafe)\n return toTimeZone(date, timeZone);\n const zoned = toTimeZone(date, timeZone);\n const noonZoned = new TZDate(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 12, 0, 0, timeZone);\n return new Date(noonZoned.getTime());\n}\nfunction convertMatcher(matcher, timeZone, noonSafe) {\n if (typeof matcher === \"boolean\" || typeof matcher === \"function\") {\n return matcher;\n }\n if (matcher instanceof Date) {\n return toZoneNoon(matcher, timeZone, noonSafe);\n }\n if (Array.isArray(matcher)) {\n return matcher.map((value) => value instanceof Date ? toZoneNoon(value, timeZone, noonSafe) : value);\n }\n if (isDateRange(matcher)) {\n return {\n ...matcher,\n from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from,\n to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to,\n };\n }\n if (isDateInterval(matcher)) {\n return {\n before: toZoneNoon(matcher.before, timeZone, noonSafe),\n after: toZoneNoon(matcher.after, timeZone, noonSafe),\n };\n }\n if (isDateAfterType(matcher)) {\n return {\n after: toZoneNoon(matcher.after, timeZone, noonSafe),\n };\n }\n if (isDateBeforeType(matcher)) {\n return {\n before: toZoneNoon(matcher.before, timeZone, noonSafe),\n };\n }\n return matcher;\n}\n/**\n * Convert any {@link Matcher} or array of matchers to the specified time zone.\n *\n * @param matchers - The matcher or matchers to convert.\n * @param timeZone - The target IANA time zone.\n * @returns The converted matcher(s).\n * @group Utilities\n */\nexport function convertMatchersToTimeZone(matchers, timeZone, noonSafe) {\n if (!matchers) {\n return matchers;\n }\n if (Array.isArray(matchers)) {\n return matchers.map((matcher) => convertMatcher(matcher, timeZone, noonSafe));\n }\n return convertMatcher(matchers, timeZone, noonSafe);\n}\n","import React, { useCallback, useMemo, useRef } from \"react\";\nimport { DateLib, defaultLocale } from \"./classes/DateLib.js\";\nimport { createGetModifiers } from \"./helpers/createGetModifiers.js\";\nimport { getClassNamesForModifiers } from \"./helpers/getClassNamesForModifiers.js\";\nimport { getComponents } from \"./helpers/getComponents.js\";\nimport { getDataAttributes } from \"./helpers/getDataAttributes.js\";\nimport { getDefaultClassNames } from \"./helpers/getDefaultClassNames.js\";\nimport { getFormatters } from \"./helpers/getFormatters.js\";\nimport { getLabels } from \"./helpers/getLabels.js\";\nimport { getMonthOptions } from \"./helpers/getMonthOptions.js\";\nimport { getStyleForModifiers } from \"./helpers/getStyleForModifiers.js\";\nimport { getWeekdays } from \"./helpers/getWeekdays.js\";\nimport { getYearOptions } from \"./helpers/getYearOptions.js\";\nimport { createNoonOverrides } from \"./noonDateLib.js\";\nimport { DayFlag, SelectionState, UI } from \"./UI.js\";\nimport { useAnimation } from \"./useAnimation.js\";\nimport { useCalendar } from \"./useCalendar.js\";\nimport { dayPickerContext } from \"./useDayPicker.js\";\nimport { useFocus } from \"./useFocus.js\";\nimport { useSelection } from \"./useSelection.js\";\nimport { convertMatchersToTimeZone } from \"./utils/convertMatchersToTimeZone.js\";\nimport { rangeIncludesDate } from \"./utils/rangeIncludesDate.js\";\nimport { toTimeZone } from \"./utils/toTimeZone.js\";\nimport { isDateRange } from \"./utils/typeguards.js\";\n/**\n * Renders the DayPicker calendar component.\n *\n * @param initialProps - The props for the DayPicker component.\n * @returns The rendered DayPicker component.\n * @group DayPicker\n * @see https://daypicker.dev\n */\nexport function DayPicker(initialProps) {\n let props = initialProps;\n const timeZone = props.timeZone;\n if (timeZone) {\n props = {\n ...initialProps,\n timeZone,\n };\n if (props.today) {\n props.today = toTimeZone(props.today, timeZone);\n }\n if (props.month) {\n props.month = toTimeZone(props.month, timeZone);\n }\n if (props.defaultMonth) {\n props.defaultMonth = toTimeZone(props.defaultMonth, timeZone);\n }\n if (props.startMonth) {\n props.startMonth = toTimeZone(props.startMonth, timeZone);\n }\n if (props.endMonth) {\n props.endMonth = toTimeZone(props.endMonth, timeZone);\n }\n if (props.mode === \"single\" && props.selected) {\n props.selected = toTimeZone(props.selected, timeZone);\n }\n else if (props.mode === \"multiple\" && props.selected) {\n props.selected = props.selected?.map((date) => toTimeZone(date, timeZone));\n }\n else if (props.mode === \"range\" && props.selected) {\n props.selected = {\n from: props.selected.from\n ? toTimeZone(props.selected.from, timeZone)\n : props.selected.from,\n to: props.selected.to\n ? toTimeZone(props.selected.to, timeZone)\n : props.selected.to,\n };\n }\n if (props.disabled !== undefined) {\n props.disabled = convertMatchersToTimeZone(props.disabled, timeZone);\n }\n if (props.hidden !== undefined) {\n props.hidden = convertMatchersToTimeZone(props.hidden, timeZone);\n }\n if (props.modifiers) {\n const nextModifiers = {};\n Object.keys(props.modifiers).forEach((key) => {\n nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone);\n });\n props.modifiers = nextModifiers;\n }\n }\n const { components, formatters, labels, dateLib, locale, classNames } = useMemo(() => {\n const locale = { ...defaultLocale, ...props.locale };\n const weekStartsOn = props.broadcastCalendar ? 1 : props.weekStartsOn;\n const noonOverrides = props.noonSafe && props.timeZone\n ? createNoonOverrides(props.timeZone, {\n weekStartsOn,\n locale,\n })\n : undefined;\n const overrides = props.dateLib && noonOverrides\n ? { ...noonOverrides, ...props.dateLib }\n : (props.dateLib ?? noonOverrides);\n const dateLib = new DateLib({\n locale,\n weekStartsOn,\n firstWeekContainsDate: props.firstWeekContainsDate,\n useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,\n useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,\n timeZone: props.timeZone,\n numerals: props.numerals,\n }, overrides);\n return {\n dateLib,\n components: getComponents(props.components),\n formatters: getFormatters(props.formatters),\n labels: getLabels(props.labels, dateLib.options),\n locale,\n classNames: { ...getDefaultClassNames(), ...props.classNames },\n };\n }, [\n props.locale,\n props.broadcastCalendar,\n props.weekStartsOn,\n props.firstWeekContainsDate,\n props.useAdditionalWeekYearTokens,\n props.useAdditionalDayOfYearTokens,\n props.timeZone,\n props.numerals,\n props.dateLib,\n props.noonSafe,\n props.components,\n props.formatters,\n props.labels,\n props.classNames,\n ]);\n if (!props.today) {\n props = { ...props, today: dateLib.today() };\n }\n const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles, } = props;\n const { formatCaption, formatDay, formatMonthDropdown, formatWeekNumber, formatWeekNumberHeader, formatWeekdayName, formatYearDropdown, } = formatters;\n const calendar = useCalendar(props, dateLib);\n const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth, } = calendar;\n const getModifiers = createGetModifiers(days, props, navStart, navEnd, dateLib);\n const { isSelected, select, selected: selectedValue, } = useSelection(props, dateLib) ?? {};\n const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus(props, calendar, getModifiers, isSelected ?? (() => false), dateLib);\n const { labelDayButton, labelGridcell, labelGrid, labelMonthDropdown, labelNav, labelPrevious, labelNext, labelWeekday, labelWeekNumber, labelWeekNumberHeader, labelYearDropdown, } = labels;\n const weekdays = useMemo(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [dateLib, props.ISOWeek, props.broadcastCalendar, props.today]);\n const isInteractive = mode !== undefined || onDayClick !== undefined;\n const handlePreviousClick = useCallback(() => {\n if (!previousMonth)\n return;\n goToMonth(previousMonth);\n onPrevClick?.(previousMonth);\n }, [previousMonth, goToMonth, onPrevClick]);\n const handleNextClick = useCallback(() => {\n if (!nextMonth)\n return;\n goToMonth(nextMonth);\n onNextClick?.(nextMonth);\n }, [goToMonth, nextMonth, onNextClick]);\n const handleDayClick = useCallback((day, m) => (e) => {\n e.preventDefault();\n e.stopPropagation();\n setFocused(day);\n if (m.disabled) {\n return;\n }\n select?.(day.date, m, e);\n onDayClick?.(day.date, m, e);\n }, [select, onDayClick, setFocused]);\n const handleDayFocus = useCallback((day, m) => (e) => {\n setFocused(day);\n onDayFocus?.(day.date, m, e);\n }, [onDayFocus, setFocused]);\n const handleDayBlur = useCallback((day, m) => (e) => {\n blur();\n onDayBlur?.(day.date, m, e);\n }, [blur, onDayBlur]);\n const handleDayKeyDown = useCallback((day, modifiers) => (e) => {\n const keyMap = {\n ArrowLeft: [\n e.shiftKey ? \"month\" : \"day\",\n props.dir === \"rtl\" ? \"after\" : \"before\",\n ],\n ArrowRight: [\n e.shiftKey ? \"month\" : \"day\",\n props.dir === \"rtl\" ? \"before\" : \"after\",\n ],\n ArrowDown: [e.shiftKey ? \"year\" : \"week\", \"after\"],\n ArrowUp: [e.shiftKey ? \"year\" : \"week\", \"before\"],\n PageUp: [e.shiftKey ? \"year\" : \"month\", \"before\"],\n PageDown: [e.shiftKey ? \"year\" : \"month\", \"after\"],\n Home: [\"startOfWeek\", \"before\"],\n End: [\"endOfWeek\", \"after\"],\n };\n if (keyMap[e.key]) {\n e.preventDefault();\n e.stopPropagation();\n const [moveBy, moveDir] = keyMap[e.key];\n moveFocus(moveBy, moveDir);\n }\n onDayKeyDown?.(day.date, modifiers, e);\n }, [moveFocus, onDayKeyDown, props.dir]);\n const handleDayMouseEnter = useCallback((day, modifiers) => (e) => {\n onDayMouseEnter?.(day.date, modifiers, e);\n }, [onDayMouseEnter]);\n const handleDayMouseLeave = useCallback((day, modifiers) => (e) => {\n onDayMouseLeave?.(day.date, modifiers, e);\n }, [onDayMouseLeave]);\n const handleMonthChange = useCallback((date, monthOffset) => (e) => {\n const selectedMonth = Number(e.target.value);\n const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);\n goToMonth(dateLib.addMonths(month, -monthOffset));\n }, [dateLib, goToMonth]);\n const handleYearChange = useCallback((date, monthOffset) => (e) => {\n const selectedYear = Number(e.target.value);\n const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);\n goToMonth(dateLib.addMonths(month, -monthOffset));\n }, [dateLib, goToMonth]);\n const { className, style } = useMemo(() => ({\n className: [classNames[UI.Root], props.className]\n .filter(Boolean)\n .join(\" \"),\n style: { ...styles?.[UI.Root], ...props.style },\n }), [classNames, props.className, props.style, styles]);\n const dataAttributes = getDataAttributes(props);\n const getDropdownStyle = (dropdown) => {\n const dropdownStyle = styles?.[UI.Dropdown];\n const specificDropdownStyle = styles?.[dropdown];\n if (!dropdownStyle && !specificDropdownStyle) {\n return undefined;\n }\n return {\n ...dropdownStyle,\n ...specificDropdownStyle,\n };\n };\n const rootElRef = useRef(null);\n useAnimation(rootElRef, Boolean(props.animate), {\n classNames,\n months,\n focused,\n dateLib,\n });\n const contextValue = {\n dayPickerProps: props,\n selected: selectedValue,\n select: select,\n isSelected,\n months,\n nextMonth,\n previousMonth,\n goToMonth,\n getModifiers,\n components,\n classNames,\n styles,\n labels,\n formatters,\n };\n return (React.createElement(dayPickerContext.Provider, { value: contextValue },\n React.createElement(components.Root, { rootRef: props.animate ? rootElRef : undefined, className: className, style: style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, \"aria-label\": props[\"aria-label\"], \"aria-labelledby\": props[\"aria-labelledby\"], ...dataAttributes },\n React.createElement(components.Months, { className: classNames[UI.Months], style: styles?.[UI.Months] },\n !props.hideNavigation && !navLayout && (React.createElement(components.Nav, { \"data-animated-nav\": props.animate ? \"true\" : undefined, className: classNames[UI.Nav], style: styles?.[UI.Nav], \"aria-label\": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),\n months.map((calendarMonth, displayIndex) => {\n const monthOffset = props.reverseMonths\n ? months.length - 1 - displayIndex\n : displayIndex;\n return (React.createElement(components.Month, { \"data-animated-month\": props.animate ? \"true\" : undefined, className: classNames[UI.Month], style: styles?.[UI.Month], \n // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation\n key: displayIndex, displayIndex: displayIndex, calendarMonth: calendarMonth },\n navLayout === \"around\" &&\n !props.hideNavigation &&\n displayIndex === 0 && (React.createElement(components.PreviousMonthButton, { type: \"button\", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, \"aria-disabled\": previousMonth ? undefined : true, \"aria-label\": labelPrevious(previousMonth), onClick: handlePreviousClick, \"data-animated-button\": props.animate ? \"true\" : undefined },\n React.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === \"rtl\" ? \"right\" : \"left\" }))),\n React.createElement(components.MonthCaption, { \"data-animated-caption\": props.animate ? \"true\" : undefined, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth: calendarMonth, displayIndex: displayIndex }, captionLayout?.startsWith(\"dropdown\") ? (React.createElement(components.DropdownNav, { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] },\n (() => {\n const monthControl = captionLayout === \"dropdown\" ||\n captionLayout === \"dropdown-months\" ? (React.createElement(components.MonthsDropdown, { key: \"month\", className: classNames[UI.MonthsDropdown], \"aria-label\": labelMonthDropdown(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) })) : (React.createElement(\"span\", { key: \"month\" }, formatMonthDropdown(calendarMonth.date, dateLib)));\n const yearControl = captionLayout === \"dropdown\" ||\n captionLayout === \"dropdown-years\" ? (React.createElement(components.YearsDropdown, { key: \"year\", className: classNames[UI.YearsDropdown], \"aria-label\": labelYearDropdown(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) })) : (React.createElement(\"span\", { key: \"year\" }, formatYearDropdown(calendarMonth.date, dateLib)));\n const controls = dateLib.getMonthYearOrder() === \"year-first\"\n ? [yearControl, monthControl]\n : [monthControl, yearControl];\n return controls;\n })(),\n React.createElement(\"span\", { role: \"status\", \"aria-live\": \"polite\", style: {\n border: 0,\n clip: \"rect(0 0 0 0)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: 0,\n position: \"absolute\",\n width: \"1px\",\n whiteSpace: \"nowrap\",\n wordWrap: \"normal\",\n } }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))) : (React.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: \"status\", \"aria-live\": \"polite\" }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))),\n navLayout === \"around\" &&\n !props.hideNavigation &&\n displayIndex === numberOfMonths - 1 && (React.createElement(components.NextMonthButton, { type: \"button\", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, \"aria-disabled\": nextMonth ? undefined : true, \"aria-label\": labelNext(nextMonth), onClick: handleNextClick, \"data-animated-button\": props.animate ? \"true\" : undefined },\n React.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === \"rtl\" ? \"left\" : \"right\" }))),\n displayIndex === numberOfMonths - 1 &&\n navLayout === \"after\" &&\n !props.hideNavigation && (React.createElement(components.Nav, { \"data-animated-nav\": props.animate ? \"true\" : undefined, className: classNames[UI.Nav], style: styles?.[UI.Nav], \"aria-label\": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),\n React.createElement(components.MonthGrid, { role: \"grid\", \"aria-multiselectable\": mode === \"multiple\" || mode === \"range\", \"aria-label\": labelGrid(calendarMonth.date, dateLib.options, dateLib) ||\n undefined, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },\n !props.hideWeekdays && (React.createElement(components.Weekdays, { \"data-animated-weekdays\": props.animate ? \"true\" : undefined, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },\n showWeekNumber && (React.createElement(components.WeekNumberHeader, { \"aria-label\": labelWeekNumberHeader(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: \"col\" }, formatWeekNumberHeader())),\n weekdays.map((weekday) => (React.createElement(components.Weekday, { \"aria-label\": labelWeekday(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: \"col\" }, formatWeekdayName(weekday, dateLib.options, dateLib)))))),\n React.createElement(components.Weeks, { \"data-animated-weeks\": props.animate ? \"true\" : undefined, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {\n return (React.createElement(components.Week, { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week: week },\n showWeekNumber && (React.createElement(components.WeekNumber, { week: week, style: styles?.[UI.WeekNumber], \"aria-label\": labelWeekNumber(week.weekNumber, {\n locale,\n }), className: classNames[UI.WeekNumber], scope: \"row\", role: \"rowheader\" }, formatWeekNumber(week.weekNumber, dateLib))),\n week.days.map((day) => {\n const { date } = day;\n const modifiers = getModifiers(day);\n modifiers[DayFlag.focused] =\n !modifiers.hidden &&\n Boolean(focused?.isEqualTo(day));\n modifiers[SelectionState.selected] =\n isSelected?.(date) || modifiers.selected;\n if (isDateRange(selectedValue)) {\n // add range modifiers\n const { from, to } = selectedValue;\n modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));\n modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));\n modifiers[SelectionState.range_middle] =\n rangeIncludesDate(selectedValue, date, true, dateLib);\n }\n const style = getStyleForModifiers(modifiers, styles, props.modifiersStyles);\n const className = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);\n const ariaLabel = !isInteractive && !modifiers.hidden\n ? labelGridcell(date, modifiers, dateLib.options, dateLib)\n : undefined;\n return (React.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day: day, modifiers: modifiers, className: className.join(\" \"), style: style, role: \"gridcell\", \"aria-selected\": modifiers.selected || undefined, \"aria-label\": ariaLabel, \"data-day\": day.isoDate, \"data-month\": day.outside ? day.dateMonthId : undefined, \"data-selected\": modifiers.selected || undefined, \"data-disabled\": modifiers.disabled || undefined, \"data-hidden\": modifiers.hidden || undefined, \"data-outside\": day.outside || undefined, \"data-focused\": modifiers.focused || undefined, \"data-today\": modifiers.today || undefined }, !modifiers.hidden && isInteractive ? (React.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: \"button\", day: day, modifiers: modifiers, disabled: (!modifiers.focused &&\n modifiers.disabled) ||\n undefined, \"aria-disabled\": (modifiers.focused &&\n modifiers.disabled) ||\n undefined, tabIndex: isFocusTarget(day) ? 0 : -1, \"aria-label\": labelDayButton(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay(date, dateLib.options, dateLib))) : (!modifiers.hidden &&\n formatDay(day.date, dateLib.options, dateLib))));\n })));\n })))));\n })),\n props.footer && (React.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: \"status\", \"aria-live\": \"polite\" }, props.footer)))));\n}\n","import { ChevronDown, ChevronLeft, ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\nimport { type DayButton, DayPicker, getDefaultClassNames } from \"react-day-picker\";\nimport { cn } from \"../utils\";\nimport { Button, buttonVariants } from \"./button\";\n\nfunction Calendar({\n\tclassName,\n\tclassNames,\n\tshowOutsideDays = true,\n\tcaptionLayout = \"label\",\n\tbuttonVariant = \"ghost\",\n\tformatters,\n\tcomponents,\n\t...props\n}: React.ComponentProps<typeof DayPicker> & {\n\tbuttonVariant?: React.ComponentProps<typeof Button>[\"variant\"];\n}) {\n\tconst defaultClassNames = getDefaultClassNames();\n\n\treturn (\n\t\t<DayPicker\n\t\t\tshowOutsideDays={showOutsideDays}\n\t\t\tclassName={cn(\n\t\t\t\t\"p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(6)] bg-background group/calendar [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent\",\n\t\t\t\tString.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n\t\t\t\tString.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tcaptionLayout={captionLayout}\n\t\t\tformatters={{\n\t\t\t\tformatMonthDropdown: (date) => date.toLocaleString(\"default\", { month: \"short\" }),\n\t\t\t\t...formatters,\n\t\t\t}}\n\t\t\tclassNames={{\n\t\t\t\troot: cn(\"w-fit\", defaultClassNames.root),\n\t\t\t\tmonths: cn(\"flex gap-4 flex-col md:flex-row relative\", defaultClassNames.months),\n\t\t\t\tmonth: cn(\"flex flex-col w-full gap-4\", defaultClassNames.month),\n\t\t\t\tnav: cn(\n\t\t\t\t\t\"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between\",\n\t\t\t\t\tdefaultClassNames.nav,\n\t\t\t\t),\n\t\t\t\tbutton_previous: cn(\n\t\t\t\t\tbuttonVariants({ variant: buttonVariant }),\n\t\t\t\t\t\"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none\",\n\t\t\t\t\tdefaultClassNames.button_previous,\n\t\t\t\t),\n\t\t\t\tbutton_next: cn(\n\t\t\t\t\tbuttonVariants({ variant: buttonVariant }),\n\t\t\t\t\t\"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none\",\n\t\t\t\t\tdefaultClassNames.button_next,\n\t\t\t\t),\n\t\t\t\tmonth_caption: cn(\n\t\t\t\t\t\"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)\",\n\t\t\t\t\tdefaultClassNames.month_caption,\n\t\t\t\t),\n\t\t\t\tdropdowns: cn(\n\t\t\t\t\t\"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5\",\n\t\t\t\t\tdefaultClassNames.dropdowns,\n\t\t\t\t),\n\t\t\t\tdropdown_root: cn(\n\t\t\t\t\t\"relative cn-calendar-dropdown-root rounded-(--cell-radius)\",\n\t\t\t\t\tdefaultClassNames.dropdown_root,\n\t\t\t\t),\n\t\t\t\tdropdown: cn(\"absolute bg-popover inset-0 opacity-0\", defaultClassNames.dropdown),\n\t\t\t\tcaption_label: cn(\n\t\t\t\t\t\"select-none font-medium\",\n\t\t\t\t\tcaptionLayout === \"label\"\n\t\t\t\t\t\t? \"text-sm\"\n\t\t\t\t\t\t: \"cn-calendar-caption-label rounded-(--cell-radius) flex items-center gap-1 text-sm [&>svg]:text-muted-foreground [&>svg]:size-3.5\",\n\t\t\t\t\tdefaultClassNames.caption_label,\n\t\t\t\t),\n\t\t\t\tmonth_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n\t\t\t\tweekdays: cn(\"flex\", defaultClassNames.weekdays),\n\t\t\t\tweekday: cn(\n\t\t\t\t\t\"text-muted-foreground rounded-(--cell-radius) flex-1 font-normal text-[0.8rem] select-none\",\n\t\t\t\t\tdefaultClassNames.weekday,\n\t\t\t\t),\n\t\t\t\tweek: cn(\"flex w-full mt-2\", defaultClassNames.week),\n\t\t\t\tweek_number_header: cn(\n\t\t\t\t\t\"select-none w-(--cell-size)\",\n\t\t\t\t\tdefaultClassNames.week_number_header,\n\t\t\t\t),\n\t\t\t\tweek_number: cn(\n\t\t\t\t\t\"text-[0.8rem] select-none text-muted-foreground\",\n\t\t\t\t\tdefaultClassNames.week_number,\n\t\t\t\t),\n\t\t\t\tday: cn(\n\t\t\t\t\t\"relative w-full rounded-(--cell-radius) h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius) group/day aspect-square select-none\",\n\t\t\t\t\tprops.showWeekNumber\n\t\t\t\t\t\t? \"[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)\"\n\t\t\t\t\t\t: \"[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)\",\n\t\t\t\t\tdefaultClassNames.day,\n\t\t\t\t),\n\t\t\t\trange_start: cn(\n\t\t\t\t\t\"rounded-l-(--cell-radius) bg-muted elative after:bg-muted after:absolute after:inset-y-0 after:w-4 after:right-0 -z-0 isolate\",\n\t\t\t\t\tdefaultClassNames.range_start,\n\t\t\t\t),\n\t\t\t\trange_middle: cn(\"rounded-none\", defaultClassNames.range_middle),\n\t\t\t\trange_end: cn(\n\t\t\t\t\t\"rounded-r-(--cell-radius) bg-muted relative after:bg-muted-200 after:absolute after:inset-y-0 after:w-4 after:left-0 -z-0 isolate\",\n\t\t\t\t\tdefaultClassNames.range_end,\n\t\t\t\t),\n\t\t\t\ttoday: cn(\n\t\t\t\t\t\"bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none\",\n\t\t\t\t\tdefaultClassNames.today,\n\t\t\t\t),\n\t\t\t\toutside: cn(\n\t\t\t\t\t\"text-muted-foreground aria-selected:text-muted-foreground\",\n\t\t\t\t\tdefaultClassNames.outside,\n\t\t\t\t),\n\t\t\t\tdisabled: cn(\"text-muted-foreground opacity-50\", defaultClassNames.disabled),\n\t\t\t\thidden: cn(\"invisible\", defaultClassNames.hidden),\n\t\t\t\t...classNames,\n\t\t\t}}\n\t\t\tcomponents={{\n\t\t\t\tRoot: ({ className, rootRef, ...props }) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tdata-slot=\"calendar\"\n\t\t\t\t\t\t\tref={rootRef}\n\t\t\t\t\t\t\tclassName={cn(className)}\n\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tChevron: ({ className, orientation, ...props }) => {\n\t\t\t\t\tif (orientation === \"left\") {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ChevronLeft\n\t\t\t\t\t\t\t\tclassName={cn(\"size-4\", className)}\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (orientation === \"right\") {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ChevronRight\n\t\t\t\t\t\t\t\tclassName={cn(\"size-4\", className)}\n\t\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ChevronDown\n\t\t\t\t\t\t\tclassName={cn(\"size-4\", className)}\n\t\t\t\t\t\t\t{...props}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tDayButton: CalendarDayButton,\n\t\t\t\tWeekNumber: ({ children, ...props }) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<td {...props}>\n\t\t\t\t\t\t\t<div className=\"flex size-(--cell-size) items-center justify-center text-center\">\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t...components,\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction CalendarDayButton({\n\tclassName,\n\tday,\n\tmodifiers,\n\t...props\n}: React.ComponentProps<typeof DayButton>) {\n\tconst defaultClassNames = getDefaultClassNames();\n\n\tconst ref = React.useRef<HTMLButtonElement>(null);\n\tReact.useEffect(() => {\n\t\tif (modifiers.focused) ref.current?.focus();\n\t}, [modifiers.focused]);\n\n\treturn (\n\t\t<Button\n\t\t\tref={ref}\n\t\t\tvariant=\"ghost\"\n\t\t\tsize=\"icon\"\n\t\t\tdata-day={day.date.toLocaleDateString()}\n\t\t\tdata-selected-single={\n\t\t\t\tmodifiers.selected &&\n\t\t\t\t!modifiers.range_start &&\n\t\t\t\t!modifiers.range_end &&\n\t\t\t\t!modifiers.range_middle\n\t\t\t}\n\t\t\tdata-range-start={modifiers.range_start}\n\t\t\tdata-range-end={modifiers.range_end}\n\t\t\tdata-range-middle={modifiers.range_middle}\n\t\t\tclassName={cn(\n\t\t\t\t\"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70\",\n\t\t\t\tdefaultClassNames.day,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Calendar };\n","import * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport type * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nfunction ScrollArea({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {\n\treturn (\n\t\t<ScrollAreaPrimitive.Root\n\t\t\tdata-slot=\"scroll-area\"\n\t\t\tclassName={cn(\"relative\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ScrollAreaPrimitive.Viewport\n\t\t\t\tdata-slot=\"scroll-area-viewport\"\n\t\t\t\tclassName=\"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</ScrollAreaPrimitive.Viewport>\n\t\t\t<ScrollBar />\n\t\t\t<ScrollAreaPrimitive.Corner />\n\t\t</ScrollAreaPrimitive.Root>\n\t);\n}\n\nfunction ScrollBar({\n\tclassName,\n\torientation = \"vertical\",\n\t...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n\treturn (\n\t\t<ScrollAreaPrimitive.ScrollAreaScrollbar\n\t\t\tdata-slot=\"scroll-area-scrollbar\"\n\t\t\torientation={orientation}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex touch-none p-px transition-colors select-none\",\n\t\t\t\torientation === \"vertical\" && \"h-full w-2.5 border-l border-l-transparent\",\n\t\t\t\torientation === \"horizontal\" && \"h-2.5 flex-col border-t border-t-transparent\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ScrollAreaPrimitive.ScrollAreaThumb\n\t\t\t\tdata-slot=\"scroll-area-thumb\"\n\t\t\t\tclassName=\"bg-border relative flex-1 rounded-full\"\n\t\t\t/>\n\t\t</ScrollAreaPrimitive.ScrollAreaScrollbar>\n\t);\n}\n\nexport { ScrollArea, ScrollBar };\n","import { addDays, format, startOfDay } from \"date-fns\";\nimport { CalendarIcon } from \"lucide-react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { DropdownNavProps, DropdownProps } from \"react-day-picker\";\nimport { cn } from \"../utils\";\nimport { Button } from \"./button\";\nimport { Calendar } from \"./calendar\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\nimport { ScrollArea } from \"./scroll-area\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"./select\";\n\ninterface DatePickerProps {\n\tvalue?: Date | null;\n\tonChange?: (date: Date | null | undefined) => void;\n\tplaceholder?: string;\n\tclassName?: string;\n\tdisabled?: boolean;\n\tstartYear?: number;\n\tendYear?: number;\n\ticon?: boolean;\n\tisFormatted?: boolean;\n\tshowTime?: boolean;\n}\n\nexport function DatePicker({\n\tvalue,\n\tonChange,\n\tplaceholder = \"Pick a date\",\n\tclassName,\n\tdisabled,\n\tstartYear = 1980,\n\tendYear = new Date().getFullYear() + 10,\n\ticon = true,\n\tisFormatted = true,\n\tshowTime = false,\n}: DatePickerProps) {\n\tconst [open, setOpen] = useState(false);\n\tconst [today] = useState<Date>(() => new Date());\n\n\tconst hours = value ? value.getHours() : 0;\n\tconst minutes = value ? value.getMinutes() : 0;\n\tconst seconds = value ? value.getSeconds() : 0;\n\n\tconst handleCalendarChange = (_value: string | number, _e: React.ChangeEventHandler) => {\n\t\tconst _event = {\n\t\t\ttarget: {\n\t\t\t\tvalue: String(_value),\n\t\t\t},\n\t\t} as React.ChangeEvent<HTMLSelectElement>;\n\t\t_e(_event);\n\t};\n\n\tconst handleSelect = (date: Date | undefined) => {\n\t\tif (date && value) {\n\t\t\tdate.setHours(value.getHours());\n\t\t\tdate.setMinutes(value.getMinutes());\n\t\t\tdate.setSeconds(value.getSeconds());\n\t\t}\n\t\tonChange?.(date);\n\t\tif (!showTime) {\n\t\t\tsetOpen(false);\n\t\t}\n\t};\n\n\tconst handleTimeChange = (type: \"hours\" | \"minutes\" | \"seconds\", val: number) => {\n\t\tconst newDate = value ? new Date(value) : new Date();\n\t\tif (type === \"hours\") newDate.setHours(val);\n\t\tif (type === \"minutes\") newDate.setMinutes(val);\n\t\tif (type === \"seconds\") newDate.setSeconds(val);\n\t\tonChange?.(newDate);\n\t};\n\n\tconst handlePreset = (preset: \"NULL\" | \"NOW\" | \"TODAY\" | \"YESTERDAY\" | \"TOMORROW\") => {\n\t\tconst today = startOfDay(new Date());\n\t\tswitch (preset) {\n\t\t\tcase \"NULL\":\n\t\t\t\tonChange?.(null);\n\t\t\t\tbreak;\n\t\t\tcase \"NOW\":\n\t\t\t\tonChange?.(new Date());\n\t\t\t\tbreak;\n\t\t\tcase \"TODAY\":\n\t\t\t\tonChange?.(today);\n\t\t\t\tbreak;\n\t\t\tcase \"YESTERDAY\":\n\t\t\t\tonChange?.(addDays(today, -1));\n\t\t\t\tbreak;\n\t\t\tcase \"TOMORROW\":\n\t\t\t\tonChange?.(addDays(today, 1));\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\tconst hoursArray = Array.from({ length: 24 }, (_, i) => i);\n\tconst minutesArray = Array.from({ length: 60 }, (_, i) => i);\n\tconst secondsArray = Array.from({ length: 60 }, (_, i) => i);\n\n\tconst displayValue =\n\t\tvalue && value instanceof Date && !Number.isNaN(value.getTime())\n\t\t\t? isFormatted\n\t\t\t\t? showTime\n\t\t\t\t\t? format(value, \"dd/MM/yyyy HH:mm:ss\")\n\t\t\t\t\t: format(value, \"dd/MM/yyyy\")\n\t\t\t\t: showTime\n\t\t\t\t\t? format(value, \"yyyy-MM-dd HH:mm:ss\")\n\t\t\t\t\t: format(value, \"yyyy-MM-dd\")\n\t\t\t: value === null\n\t\t\t\t? \"NULL\"\n\t\t\t\t: placeholder;\n\n\treturn (\n\t\t<Popover\n\t\t\topen={open}\n\t\t\tonOpenChange={setOpen}\n\t\t>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"w-[280px] justify-start text-left font-normal\",\n\t\t\t\t\t\t!value && \"text-muted-foreground\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t>\n\t\t\t\t\t{icon && <CalendarIcon className=\"mr-2 size-4\" />}\n\t\t\t\t\t{displayValue}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\t\t\t<PopoverContent\n\t\t\t\tclassName=\"w-auto p-0\"\n\t\t\t\talign=\"end\"\n\t\t\t>\n\t\t\t\t<div className=\"flex\">\n\t\t\t\t\t<div className=\"flex flex-col gap-1 p-2 border-r\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"justify-start text-xs h-7\"\n\t\t\t\t\t\t\tonClick={() => handlePreset(\"NULL\")}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tNULL\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"justify-start text-xs h-7\"\n\t\t\t\t\t\t\tonClick={() => handlePreset(\"NOW\")}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tNOW\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"justify-start text-xs h-7\"\n\t\t\t\t\t\t\tonClick={() => handlePreset(\"TODAY\")}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tTODAY\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"justify-start text-xs h-7\"\n\t\t\t\t\t\t\tonClick={() => handlePreset(\"YESTERDAY\")}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tYESTERDAY\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"justify-start text-xs h-7\"\n\t\t\t\t\t\t\tonClick={() => handlePreset(\"TOMORROW\")}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tTOMORROW\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Calendar\n\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\tDropdown: (props: DropdownProps) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\t\tonValueChange={(value) => {\n\t\t\t\t\t\t\t\t\t\t\tif (props.onChange) {\n\t\t\t\t\t\t\t\t\t\t\t\thandleCalendarChange(value, props.onChange);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\tvalue={String(props.value)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<SelectTrigger className=\"h-8 w-fit font-medium first-letter:capitalize focus:ring-0 focus:ring-offset-0\">\n\t\t\t\t\t\t\t\t\t\t\t<SelectValue />\n\t\t\t\t\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t\t\t\t\t{props.options?.map((option) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={option.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={String(option.value)}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{option.label}\n\t\t\t\t\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t\t\t\t\t</Select>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tDropdownNav: (props: DropdownNavProps) => {\n\t\t\t\t\t\t\t\treturn <div className=\"flex w-full items-center gap-2\">{props.children}</div>;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tdefaultMonth={value || today}\n\t\t\t\t\t\thideNavigation\n\t\t\t\t\t\tmode=\"single\"\n\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t\tselected={value || undefined}\n\t\t\t\t\t\tstartMonth={new Date(startYear, 0)}\n\t\t\t\t\t\tendMonth={new Date(endYear, 11)}\n\t\t\t\t\t/>\n\t\t\t\t\t{showTime && (\n\t\t\t\t\t\t<div className=\"flex border-l\">\n\t\t\t\t\t\t\t<TimeColumn\n\t\t\t\t\t\t\t\tlabel=\"H\"\n\t\t\t\t\t\t\t\tvalues={hoursArray}\n\t\t\t\t\t\t\t\tselected={hours}\n\t\t\t\t\t\t\t\tonChange={(val) => handleTimeChange(\"hours\", val)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TimeColumn\n\t\t\t\t\t\t\t\tlabel=\"M\"\n\t\t\t\t\t\t\t\tvalues={minutesArray}\n\t\t\t\t\t\t\t\tselected={minutes}\n\t\t\t\t\t\t\t\tonChange={(val) => handleTimeChange(\"minutes\", val)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TimeColumn\n\t\t\t\t\t\t\t\tlabel=\"S\"\n\t\t\t\t\t\t\t\tvalues={secondsArray}\n\t\t\t\t\t\t\t\tselected={seconds}\n\t\t\t\t\t\t\t\tonChange={(val) => handleTimeChange(\"seconds\", val)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n}\n\nfunction TimeColumn({\n\tlabel,\n\tvalues,\n\tselected,\n\tonChange,\n}: {\n\tlabel: string;\n\tvalues: number[];\n\tselected: number;\n\tonChange: (val: number) => void;\n}) {\n\tconst itemRefs = useRef<Map<number, HTMLButtonElement>>(new Map());\n\n\tuseEffect(() => {\n\t\tconst selectedRef = itemRefs.current.get(selected);\n\t\tif (selectedRef) {\n\t\t\tselectedRef.scrollIntoView({ block: \"center\", behavior: \"auto\" });\n\t\t}\n\t}, [selected]);\n\n\treturn (\n\t\t<div className=\"flex flex-col\">\n\t\t\t<div className=\"px-3 py-2 text-xs font-medium text-muted-foreground text-center border-b\">\n\t\t\t\t{label}\n\t\t\t</div>\n\t\t\t<ScrollArea className=\"h-[224px]\">\n\t\t\t\t<div className=\"flex flex-col p-1\">\n\t\t\t\t\t{values.map((val) => (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tkey={val}\n\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\tif (el) itemRefs.current.set(val, el);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={() => onChange(val)}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"w-10 h-8 text-sm rounded-md hover:bg-accent flex items-center justify-center\",\n\t\t\t\t\t\t\t\tselected === val && \"bg-primary text-primary-foreground hover:bg-primary\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{val.toString().padStart(2, \"0\")}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</ScrollArea>\n\t\t</div>\n\t);\n}\n","import { create } from \"zustand\";\n\ntype RecordReferenceStore = {\n\ttableName: string | null;\n\tcolumnName: string | null;\n\treferencedColumn: string | null;\n\tsetRecordReference: (\n\t\ttableName: string,\n\t\tcolumnName: string,\n\t\treferencedColumn: string,\n\t) => void;\n\tclearRecordReference: () => void;\n};\n\nexport const useRecordReferenceStore = create<RecordReferenceStore>()((set) => ({\n\ttableName: null,\n\tcolumnName: null,\n\treferencedColumn: null,\n\n\tsetRecordReference: (tableName, columnName, referencedColumn) =>\n\t\tset({ tableName, columnName, referencedColumn }),\n\n\tclearRecordReference: () =>\n\t\tset({ tableName: null, columnName: null, referencedColumn: null }),\n}));\n","import type { ColumnInfoSchemaType } from \"@db-studio/shared/types\";\nimport { DatePicker } from \"@db-studio/ui/date-picker\";\nimport { Input } from \"@db-studio/ui/input\";\nimport { Label } from \"@db-studio/ui/label\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Textarea } from \"@db-studio/ui/textarea\";\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipProvider,\n\tTooltipTrigger,\n} from \"@db-studio/ui/tooltip\";\nimport { Clock, Link, RefreshCw } from \"lucide-react\";\nimport { useQueryState } from \"nuqs\";\nimport { Controller, type ControllerRenderProps, useFormContext } from \"react-hook-form\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { CONSTANTS } from \"@/utils/constants\";\nimport type { AddRecordFormData } from \"../hooks/use-create-record\";\nimport { useRecordReferenceStore } from \"../stores/record-reference.store\";\n\nconst pad = (n: number): string => String(n).padStart(2, \"0\");\n\nconst formatLocalTimestamp = (date: Date): string => {\n\tconst yyyy = date.getFullYear();\n\tconst mm = pad(date.getMonth() + 1);\n\tconst dd = pad(date.getDate());\n\tconst hh = pad(date.getHours());\n\tconst min = pad(date.getMinutes());\n\treturn `${yyyy}-${mm}-${dd}T${hh}:${min}`;\n};\n\nexport const AddRecordField = ({\n\tcolumnName,\n\tdataTypeLabel,\n\tcolumnDefault,\n\tenumValues,\n\tisForeignKey,\n\treferencedTable,\n\treferencedColumn,\n}: ColumnInfoSchemaType) => {\n\tconst [, setReferencedActiveTable] = useQueryState(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.ACTIVE_TABLE,\n\t);\n\tconst { control } = useFormContext<AddRecordFormData>();\n\tconst { openOverlay } = useOverlayStore();\n\tconst { setRecordReference } = useRecordReferenceStore();\n\n\tconst renderInputField = (field: ControllerRenderProps<AddRecordFormData, string>) => {\n\t\tconst safeField = {\n\t\t\t...field,\n\t\t\tvalue: field.value ?? \"\",\n\t\t};\n\n\t\tif (isForeignKey) {\n\t\t\treturn (\n\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t<div className=\"flex\">\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tid={columnName}\n\t\t\t\t\t\t\tplaceholder={columnDefault ?? \"\"}\n\t\t\t\t\t\t\tclassName=\"-me-px flex-1 rounded-e-none shadow-none focus-visible:z-10\"\n\t\t\t\t\t\t\t{...safeField}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<TooltipProvider delayDuration={0}>\n\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\taria-label=\"Go to table\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-9 items-center justify-center rounded-e-md border border-input bg-background text-muted-foreground/80 text-sm outline-none transition-[color,box-shadow] hover:text-accent-foreground focus:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tif (referencedTable && columnName && referencedColumn) {\n\t\t\t\t\t\t\t\t\t\t\t\tsetRecordReference(referencedTable, columnName, referencedColumn);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\topenOverlay(\"records.record-reference\");\n\t\t\t\t\t\t\t\t\t\t\tsetReferencedActiveTable(referencedTable);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"size-4\"\n\t\t\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t<TooltipContent className=\"px-2 py-1 text-xs\">Go to table</TooltipContent>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</TooltipProvider>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\tHas a foreign key relation to{\" \"}\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName=\"font-mono text-primary\"\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tif (referencedTable && columnName && referencedColumn) {\n\t\t\t\t\t\t\t\t\tsetRecordReference(referencedTable, columnName, referencedColumn);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\topenOverlay(\"records.record-reference\");\n\t\t\t\t\t\t\t\tsetReferencedActiveTable(referencedTable);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{referencedTable}\n\t\t\t\t\t\t</button>{\" \"}\n\t\t\t\t\t\ttable\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tdataTypeLabel === \"int\" ||\n\t\t\tdataTypeLabel === \"bigint\" ||\n\t\t\tdataTypeLabel === \"smallint\" ||\n\t\t\tdataTypeLabel === \"numeric\" ||\n\t\t\tdataTypeLabel === \"float\" ||\n\t\t\tdataTypeLabel === \"double\" ||\n\t\t\tdataTypeLabel === \"money\"\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<Input\n\t\t\t\t\tid={columnName}\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tplaceholder={columnDefault ?? \"0\"}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"boolean\") {\n\t\t\treturn (\n\t\t\t\t<Select\n\t\t\t\t\tvalue={field.value}\n\t\t\t\t\tonValueChange={(value) => field.onChange(value)}\n\t\t\t\t>\n\t\t\t\t\t<SelectTrigger className=\"w-full\">\n\t\t\t\t\t\t<SelectValue placeholder={columnDefault ?? \"true\"} />\n\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t<SelectItem value=\"true\">true</SelectItem>\n\t\t\t\t\t\t<SelectItem value=\"false\">false</SelectItem>\n\t\t\t\t\t</SelectContent>\n\t\t\t\t</Select>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"text\" || dataTypeLabel === \"xml\") {\n\t\t\treturn (\n\t\t\t\t<Textarea\n\t\t\t\t\tid={columnName}\n\t\t\t\t\tplaceholder={columnDefault ?? \"\"}\n\t\t\t\t\trows={4}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"json\" || dataTypeLabel === \"jsonb\") {\n\t\t\treturn (\n\t\t\t\t<Textarea\n\t\t\t\t\tid={columnName}\n\t\t\t\t\tplaceholder={columnDefault ?? '{\"key\": \"value\"}'}\n\t\t\t\t\trows={6}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"date\") {\n\t\t\tconst hasDateDefault =\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"current_date\") ||\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"now()\") ||\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"curdate()\");\n\n\t\t\tif (hasDateDefault) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"flex\">\n\t\t\t\t\t\t<DatePicker\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tfield.value ? new Date(field.value) : field.value === \"\" ? null : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={(date) => field.onChange(date ? date.toISOString().split(\"T\")[0] : \"\")}\n\t\t\t\t\t\t\tplaceholder={columnDefault ?? \"Select a date\"}\n\t\t\t\t\t\t\tclassName=\"-me-px flex-1 rounded-e-none shadow-none focus-visible:z-10\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TooltipProvider delayDuration={0}>\n\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\taria-label=\"Set to now\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-7 items-center justify-center rounded-e-md border border-input bg-background text-muted-foreground/80 text-sm outline-none transition-[color,box-shadow] hover:text-accent-foreground focus:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tconst today = new Date().toISOString().split(\"T\")[0];\n\t\t\t\t\t\t\t\t\t\t\tfield.onChange(today);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Clock\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"size-4\"\n\t\t\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t<TooltipContent className=\"px-2 py-1 text-xs\">Set to now</TooltipContent>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</TooltipProvider>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<DatePicker\n\t\t\t\t\tvalue={field.value ? new Date(field.value) : field.value === \"\" ? null : undefined}\n\t\t\t\t\tonChange={(date) => field.onChange(date ? date.toISOString().split(\"T\")[0] : \"\")}\n\t\t\t\t\tplaceholder={columnDefault ?? \"Select a date\"}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"timestamptz\") {\n\t\t\tconst hasTimestampDefault =\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"current_timestamp\") ||\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"now()\") ||\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"localtimestamp\");\n\n\t\t\tif (hasTimestampDefault) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"flex\">\n\t\t\t\t\t\t<DatePicker\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tfield.value ? new Date(field.value) : field.value === \"\" ? null : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={(date) => field.onChange(date ? date.toISOString() : \"\")}\n\t\t\t\t\t\t\tshowTime={true}\n\t\t\t\t\t\t\tisFormatted={false}\n\t\t\t\t\t\t\tplaceholder={columnDefault ?? \"Select a date and time\"}\n\t\t\t\t\t\t\tclassName=\"-me-px flex-1 rounded-e-none shadow-none focus-visible:z-10\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TooltipProvider delayDuration={0}>\n\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\taria-label=\"Set to now\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-7 items-center justify-center rounded-e-md border border-input bg-background text-muted-foreground/80 text-sm outline-none transition-[color,box-shadow] hover:text-accent-foreground focus:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tconst today = new Date().toISOString();\n\t\t\t\t\t\t\t\t\t\t\tfield.onChange(today);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Clock\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"size-4\"\n\t\t\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t<TooltipContent className=\"px-2 py-1 text-xs\">Set to now</TooltipContent>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</TooltipProvider>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<DatePicker\n\t\t\t\t\tvalue={field.value ? new Date(field.value) : field.value === \"\" ? null : undefined}\n\t\t\t\t\tonChange={(date) => field.onChange(date ? date.toISOString() : \"\")}\n\t\t\t\t\tshowTime={true}\n\t\t\t\t\tisFormatted={false}\n\t\t\t\t\tplaceholder={columnDefault ?? \"Select a date and time\"}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"timestamp\") {\n\t\t\tconst hasTimestampDefault =\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"current_timestamp\") ||\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"now()\") ||\n\t\t\t\tcolumnDefault?.toLowerCase().includes(\"localtimestamp\");\n\n\t\t\tif (hasTimestampDefault) {\n\t\t\t\treturn (\n\t\t\t\t\t<div className=\"flex\">\n\t\t\t\t\t\t<DatePicker\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tfield.value ? new Date(field.value) : field.value === \"\" ? null : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={(date) => field.onChange(date ? formatLocalTimestamp(date) : \"\")}\n\t\t\t\t\t\t\tshowTime={true}\n\t\t\t\t\t\t\tisFormatted={false}\n\t\t\t\t\t\t\tplaceholder={columnDefault ?? \"Select a date and time\"}\n\t\t\t\t\t\t\tclassName=\"-me-px flex-1 rounded-e-none shadow-none focus-visible:z-10\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TooltipProvider delayDuration={0}>\n\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\taria-label=\"Set to now\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-7 items-center justify-center rounded-e-md border border-input bg-background text-muted-foreground/80 text-sm outline-none transition-[color,box-shadow] hover:text-accent-foreground focus:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tfield.onChange(formatLocalTimestamp(new Date()));\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Clock\n\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"size-4\"\n\t\t\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t<TooltipContent className=\"px-2 py-1 text-xs\">Set to now</TooltipContent>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</TooltipProvider>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<DatePicker\n\t\t\t\t\tvalue={field.value ? new Date(field.value) : field.value === \"\" ? null : undefined}\n\t\t\t\t\tonChange={(date) => field.onChange(date ? formatLocalTimestamp(date) : \"\")}\n\t\t\t\t\tshowTime={true}\n\t\t\t\t\tisFormatted={false}\n\t\t\t\t\tplaceholder={columnDefault ?? \"Select a date and time\"}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"uuid\") {\n\t\t\treturn (\n\t\t\t\t<div className=\"flex\">\n\t\t\t\t\t<Input\n\t\t\t\t\t\tid={columnName}\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tplaceholder={columnDefault ?? \"\"}\n\t\t\t\t\t\tpattern=\"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\"\n\t\t\t\t\t\tclassName=\"-me-px flex-1 rounded-e-none shadow-none focus-visible:z-10\"\n\t\t\t\t\t\t{...safeField}\n\t\t\t\t\t/>\n\t\t\t\t\t<TooltipProvider delayDuration={0}>\n\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\taria-label=\"Generate UUID\"\n\t\t\t\t\t\t\t\t\tclassName=\"inline-flex w-9 items-center justify-center rounded-e-md border border-input bg-background text-muted-foreground/80 text-sm outline-none transition-[color,box-shadow] hover:text-accent-foreground focus:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tconst generatedUUID = crypto.randomUUID();\n\t\t\t\t\t\t\t\t\t\tfield.onChange(generatedUUID);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<RefreshCw\n\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"size-4\"\n\t\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t<TooltipContent className=\"px-2 py-1 text-xs\">Generate UUID</TooltipContent>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t</TooltipProvider>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"array\") {\n\t\t\treturn (\n\t\t\t\t<Textarea\n\t\t\t\t\tid={columnName}\n\t\t\t\t\tplaceholder={columnDefault ?? '[\"item1\", \"item2\"]'}\n\t\t\t\t\trows={3}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"enum\") {\n\t\t\tif (enumValues && enumValues.length > 0) {\n\t\t\t\treturn (\n\t\t\t\t\t<Select\n\t\t\t\t\t\tvalue={field.value}\n\t\t\t\t\t\tonValueChange={(value) => field.onChange(value)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectTrigger className=\"w-full\">\n\t\t\t\t\t\t\t<SelectValue placeholder={columnDefault ?? \"Select a value\"} />\n\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t{enumValues.map((enumValue: string) => (\n\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\tkey={enumValue}\n\t\t\t\t\t\t\t\t\tvalue={enumValue}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{enumValue}\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t</Select>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<Input\n\t\t\t\t\tid={columnName}\n\t\t\t\t\tplaceholder={columnDefault ?? \"\"}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"interval\") {\n\t\t\treturn (\n\t\t\t\t<Input\n\t\t\t\t\tid={columnName}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tplaceholder={columnDefault ?? \"1 day\"}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"bytea\") {\n\t\t\treturn (\n\t\t\t\t<Input\n\t\t\t\t\tid={columnName}\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\tdataTypeLabel === \"inet\" ||\n\t\t\tdataTypeLabel === \"cidr\" ||\n\t\t\tdataTypeLabel === \"macaddr\" ||\n\t\t\tdataTypeLabel === \"macaddr8\"\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<Input\n\t\t\t\t\tid={columnName}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tdataTypeLabel === \"inet\"\n\t\t\t\t\t\t\t? \"192.168.1.1\"\n\t\t\t\t\t\t\t: dataTypeLabel === \"cidr\"\n\t\t\t\t\t\t\t\t? \"192.168.1.0/24\"\n\t\t\t\t\t\t\t\t: dataTypeLabel === \"macaddr\"\n\t\t\t\t\t\t\t\t\t? \"08:00:2b:01:02:03\"\n\t\t\t\t\t\t\t\t\t: \"08:00:2b:01:02:03:04:05\"\n\t\t\t\t\t}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\tif (dataTypeLabel === \"point\" || dataTypeLabel === \"line\" || dataTypeLabel === \"polygon\") {\n\t\t\treturn (\n\t\t\t\t<Input\n\t\t\t\t\tid={columnName}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tdataTypeLabel === \"point\"\n\t\t\t\t\t\t\t? \"(x,y)\"\n\t\t\t\t\t\t\t: dataTypeLabel === \"line\"\n\t\t\t\t\t\t\t\t? \"{A,B,C}\"\n\t\t\t\t\t\t\t\t: \"((x1,y1),(x2,y2),...)\"\n\t\t\t\t\t}\n\t\t\t\t\t{...safeField}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\tid={columnName}\n\t\t\t\ttype=\"text\"\n\t\t\t\tplaceholder={columnDefault ?? \"\"}\n\t\t\t\t{...safeField}\n\t\t\t/>\n\t\t);\n\t};\n\n\treturn (\n\t\t<Controller\n\t\t\tkey={columnName}\n\t\t\tcontrol={control}\n\t\t\tname={columnName}\n\t\t\trender={({ field }) => (\n\t\t\t\t<div className=\"grid grid-cols-3 gap-4\">\n\t\t\t\t\t<div className=\"col-span-1 flex flex-col gap-1\">\n\t\t\t\t\t\t<Label htmlFor={columnName}>{columnName}</Label>\n\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">{dataTypeLabel}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"col-span-2 w-full\">{renderInputField(field)}</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import type * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"table-container\"\n\t\t\tclassName=\"relative w-full overflow-x-auto\"\n\t\t>\n\t\t\t<table\n\t\t\t\tdata-slot=\"table\"\n\t\t\t\tclassName={cn(\"w-full caption-bottom text-xs\", className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\n\treturn (\n\t\t<thead\n\t\t\tdata-slot=\"table-header\"\n\t\t\tclassName={cn(\"[&_tr]:border-b\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\n\treturn (\n\t\t<tbody\n\t\t\tdata-slot=\"table-body\"\n\t\t\tclassName={cn(\"[&_tr:last-child]:border-0\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\n\treturn (\n\t\t<tfoot\n\t\t\tdata-slot=\"table-footer\"\n\t\t\tclassName={cn(\"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\n\treturn (\n\t\t<tr\n\t\t\tdata-slot=\"table-row\"\n\t\t\tclassName={cn(\n\t\t\t\t\"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<\"th\">) {\n\treturn (\n\t\t<th\n\t\t\tdata-slot=\"table-head\"\n\t\t\tclassName={cn(\n\t\t\t\t\"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<\"td\">) {\n\treturn (\n\t\t<td\n\t\t\tdata-slot=\"table-cell\"\n\t\t\tclassName={cn(\n\t\t\t\t\"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _TableCaption({ className, ...props }: React.ComponentProps<\"caption\">) {\n\treturn (\n\t\t<caption\n\t\t\tdata-slot=\"table-caption\"\n\t\t\tclassName={cn(\"text-muted-foreground mt-4 text-xs\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\t_TableCaption as TableCaption,\n\t_TableFooter as TableFooter,\n\tTable,\n\tTableBody,\n\tTableCell,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n};\n","import type { FilterType, SortType } from \"@db-studio/shared/types\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { parseAsJson, useQueryState } from \"nuqs\";\nimport { getTableData } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport { CONSTANTS } from \"@/utils/constants\";\n\nexport const useTableData = ({\n\ttableName,\n\tisReferencedTable = false,\n}: {\n\ttableName: string;\n\tisReferencedTable?: boolean;\n}) => {\n\tconst { selectedDatabase } = useDatabaseStore();\n\tconst [activeTable] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.ACTIVE_TABLE);\n\tconst activeTableName = tableName || activeTable || \"\";\n\n\t// Cursor-based pagination state\n\tconst [cursor] = useQueryState(\n\t\tisReferencedTable\n\t\t\t? CONSTANTS.REFERENCED_TABLE_STATE_KEYS.CURSOR\n\t\t\t: CONSTANTS.TABLE_STATE_KEYS.CURSOR,\n\t);\n\tconst [limit] = useQueryState(\n\t\tisReferencedTable\n\t\t\t? CONSTANTS.REFERENCED_TABLE_STATE_KEYS.LIMIT.toString()\n\t\t\t: CONSTANTS.TABLE_STATE_KEYS.LIMIT,\n\t);\n\tconst [direction] = useQueryState(\n\t\tisReferencedTable\n\t\t\t? CONSTANTS.REFERENCED_TABLE_STATE_KEYS.DIRECTION\n\t\t\t: CONSTANTS.TABLE_STATE_KEYS.DIRECTION,\n\t);\n\n\t// For referenced tables, sort is an array of Sort objects\n\tconst [referencedSort] = useQueryState<SortType[]>(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.SORT,\n\t\tparseAsJson((value) => value as SortType[])\n\t\t\t.withDefault([])\n\t\t\t.withOptions({ history: \"push\" }),\n\t);\n\n\t// For regular tables, sort is a string (column name)\n\tconst [regularSort] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.SORT);\n\tconst [order] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.ORDER);\n\n\tconst [filters] = useQueryState<FilterType[]>(\n\t\tisReferencedTable\n\t\t\t? CONSTANTS.REFERENCED_TABLE_STATE_KEYS.FILTERS\n\t\t\t: CONSTANTS.TABLE_STATE_KEYS.FILTERS,\n\t\tparseAsJson((value) => value as FilterType[])\n\t\t\t.withDefault([])\n\t\t\t.withOptions({ history: \"push\" }),\n\t);\n\n\tconst serializedSort =\n\t\tisReferencedTable && referencedSort?.length > 0\n\t\t\t? JSON.stringify(referencedSort)\n\t\t\t: regularSort;\n\tconst serializedFilters = filters?.length > 0 ? JSON.stringify(filters) : undefined;\n\n\tconst {\n\t\tdata: tableData,\n\t\tisLoading: isLoadingTableData,\n\t\tisRefetching: isRefetchingTableData,\n\t\trefetch: refetchTableData,\n\t\terror: errorTableData,\n\t} = useQuery({\n\t\tqueryKey: tableKeys.data({\n\t\t\ttableName: activeTableName,\n\t\t\tcursor,\n\t\t\tlimit,\n\t\t\tdirection,\n\t\t\tsort: serializedSort,\n\t\t\torder,\n\t\t\tfilters: serializedFilters,\n\t\t\tdb: selectedDatabase,\n\t\t}),\n\t\tqueryFn: async () => {\n\t\t\tconst defaultLimit = CONSTANTS.CACHE_KEYS.TABLE_DEFAULT_LIMIT.toString();\n\t\t\treturn getTableData({\n\t\t\t\ttableName: activeTableName,\n\t\t\t\tlimit: limit?.toString() || defaultLimit,\n\t\t\t\tdb: selectedDatabase ?? undefined,\n\t\t\t\tcursor,\n\t\t\t\tdirection,\n\t\t\t\tsort: serializedSort ?? undefined,\n\t\t\t\torder,\n\t\t\t\tfilters: serializedFilters,\n\t\t\t});\n\t\t},\n\t\tselect: (res) => res.data.data,\n\t\tenabled: !!activeTableName,\n\t});\n\n\treturn {\n\t\ttableData,\n\t\tisLoadingTableData,\n\t\tisRefetchingTableData,\n\t\terrorTableData,\n\t\trefetchTableData,\n\t};\n};\n","import { cn } from \"../utils\";\n\nfunction Kbd({ className, ...props }: React.ComponentProps<\"kbd\">) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"kbd\"\n\t\t\tclassName={cn(\n\t\t\t\t\"bg-muted text-muted-foreground border [[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-xs px-1 font-sans text-[0.625rem] font-medium [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction KbdGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<kbd\n\t\t\tdata-slot=\"kbd-group\"\n\t\t\tclassName={cn(\"gap-1 inline-flex items-center\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Kbd, KbdGroup };\n","import type { FilterType as FilterSchemaType } from \"@db-studio/shared/types\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Input } from \"@db-studio/ui/input\";\nimport { Kbd } from \"@db-studio/ui/kbd\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@db-studio/ui/popover\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Filter, X } from \"lucide-react\";\nimport { parseAsJson, useQueryState } from \"nuqs\";\nimport { useState } from \"react\";\nimport { useTableCols } from \"@/features/schema\";\nimport { CONSTANTS } from \"@/utils/constants\";\n\nexport const ReferencedTableFilterPopup = ({ tableName }: { tableName: string }) => {\n\tconst [filters, setFilters] = useQueryState<FilterSchemaType[]>(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.FILTERS,\n\t\tparseAsJson((value) => value as FilterSchemaType[])\n\t\t\t.withDefault([])\n\t\t\t.withOptions({ history: \"push\" }),\n\t);\n\tconst [, setCursor] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.CURSOR);\n\tconst [, setDirection] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.DIRECTION);\n\tconst { tableCols } = useTableCols({ tableName });\n\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [localFilters, setLocalFilters] = useState<FilterSchemaType[]>([]);\n\n\tconst handleAddFilter = () => {\n\t\tconst firstColumn = tableCols?.[0]?.columnName ?? \"\";\n\t\tsetLocalFilters((prev) => [\n\t\t\t...prev,\n\t\t\t{ columnName: firstColumn, operator: \"=\", value: \"\" },\n\t\t]);\n\t};\n\n\tconst handleRemoveFilter = (index: number) => {\n\t\tsetLocalFilters(localFilters.filter((_, i) => i !== index));\n\t};\n\n\tconst handleFilterColumnChange = (index: number, columnName: string) => {\n\t\tsetLocalFilters(\n\t\t\tlocalFilters.map((filter, i) => (i === index ? { ...filter, columnName } : filter)),\n\t\t);\n\t};\n\n\tconst handleFilterValueChange = (index: number, value: string) => {\n\t\tsetLocalFilters(\n\t\t\tlocalFilters.map((filter, i) => (i === index ? { ...filter, value } : filter)),\n\t\t);\n\t};\n\n\tconst handleFilterOperatorChange = (index: number, operator: string) => {\n\t\tsetLocalFilters(\n\t\t\tlocalFilters.map((filter, i) => (i === index ? { ...filter, operator } : filter)),\n\t\t);\n\t};\n\n\tconst handleReset = () => {\n\t\tsetLocalFilters([]);\n\t\tsetFilters([]);\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst applyFilters = () => {\n\t\tconst validFilters = localFilters.filter(\n\t\t\t(f) => f.columnName && f.operator && f.value !== \"\",\n\t\t);\n\t\tsetFilters(validFilters);\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst hasActiveFilters = filters.length > 0;\n\n\tconst handleOpenChange = (open: boolean) => {\n\t\tif (open) {\n\t\t\tsetLocalFilters(filters);\n\t\t}\n\t\tsetIsOpen(open);\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\topen={isOpen}\n\t\t\tonOpenChange={handleOpenChange}\n\t\t>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tclassName=\"border-r border-l-0 border-y-0 border-zinc-800 rounded-none text-xs h-full\"\n\t\t\t\t\taria-label=\"Filter table data\"\n\t\t\t\t\tdata-active={hasActiveFilters}\n\t\t\t\t>\n\t\t\t\t\t<Filter className=\"size-4\" />\n\t\t\t\t\tFilter\n\t\t\t\t\t{hasActiveFilters && (\n\t\t\t\t\t\t<Kbd className=\"text-[10px] font-normal text-white bg-primary/10 border border-primary/90 px-1.5 py-0.5\">\n\t\t\t\t\t\t\t{filters.length}\n\t\t\t\t\t\t</Kbd>\n\t\t\t\t\t)}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\n\t\t\t<PopoverContent\n\t\t\t\tclassName=\"w-md space-y-2\"\n\t\t\t\talign=\"start\"\n\t\t\t>\n\t\t\t\t<div className=\"flex items-center gap-4\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={handleAddFilter}\n\t\t\t\t\t>\n\t\t\t\t\t\tAdd filter\n\t\t\t\t\t\t{localFilters && localFilters.length > 0 && (\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal text-white bg-primary/10 border border-primary/90 px-1.5 py-0.5\">\n\t\t\t\t\t\t\t\t{localFilters.length}\n\t\t\t\t\t\t\t</Kbd>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t\t\t{localFilters.length > 0 ? (\n\t\t\t\t\t\tlocalFilters.map((filter, index) => (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={`${filter.columnName}-${index}`}\n\t\t\t\t\t\t\t\tclassName=\"flex-1 flex h-9 gap-2\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tvalue={filter.columnName}\n\t\t\t\t\t\t\t\t\tonValueChange={(value) => handleFilterColumnChange(index, value)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SelectTrigger className=\"w-full flex-1\">\n\t\t\t\t\t\t\t\t\t\t<SelectValue placeholder=\"Select column\" />\n\t\t\t\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t\t\t\t{tableCols?.map((col) => (\n\t\t\t\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t\t\t\t</Select>\n\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tvalue={filter.operator}\n\t\t\t\t\t\t\t\t\tonValueChange={(value) => handleFilterOperatorChange(index, value)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SelectTrigger>\n\t\t\t\t\t\t\t\t\t\t<SelectValue placeholder=\"Op\" />\n\t\t\t\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"=\">=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"!=\">!=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\">\">&gt;</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\">=\">&gt;=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"<\">&lt;</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"<=\">&lt;=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"is\">is</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"is not\">is not</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"like\">like</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"not like\">not like</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"ilike\">ilike</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"not ilike\">not ilike</SelectItem>\n\t\t\t\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t\t\t\t</Select>\n\n\t\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tplaceholder=\"Value\"\n\t\t\t\t\t\t\t\t\tvalue={filter.value as string}\n\t\t\t\t\t\t\t\t\tonChange={(e) => handleFilterValueChange(index, e.target.value)}\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\t\tclassName=\"text-xs\"\n\t\t\t\t\t\t\t\t\tonClick={() => handleRemoveFilter(index)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<X className=\"size-4\" />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"flex-1 flex h-9 gap-2 items-center justify-center\">\n\t\t\t\t\t\t\t<p className=\"text-sm text-muted-foreground text-center\">No filters applied</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"gap-2 flex justify-end\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={handleReset}\n\t\t\t\t\t>\n\t\t\t\t\t\tReset\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={applyFilters}\n\t\t\t\t\t>\n\t\t\t\t\t\tApply\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n};\n","import * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport type * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nfunction Switch({\n\tclassName,\n\tsize = \"default\",\n\t...props\n}: React.ComponentProps<typeof SwitchPrimitive.Root> & {\n\tsize?: \"sm\" | \"default\";\n}) {\n\treturn (\n\t\t<SwitchPrimitive.Root\n\t\t\tdata-slot=\"switch\"\n\t\t\tdata-size={size}\n\t\t\tclassName={cn(\n\t\t\t\t\"data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<SwitchPrimitive.Thumb\n\t\t\t\tdata-slot=\"switch-thumb\"\n\t\t\t\tclassName=\"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform\"\n\t\t\t/>\n\t\t</SwitchPrimitive.Root>\n\t);\n}\n\nexport { Switch };\n","import type { SortType as Sort, SortDirection } from \"@db-studio/shared/types\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Kbd } from \"@db-studio/ui/kbd\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@db-studio/ui/popover\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Switch } from \"@db-studio/ui/switch\";\nimport { ArrowUpDown, X } from \"lucide-react\";\nimport { parseAsJson, useQueryState } from \"nuqs\";\nimport { useState } from \"react\";\nimport { useTableCols } from \"@/features/schema\";\nimport { CONSTANTS } from \"@/utils/constants\";\n\nexport const ReferencedTableSortPopup = ({ tableName }: { tableName: string }) => {\n\tconst { tableCols } = useTableCols({ tableName });\n\tconst [sorts, setSorts] = useQueryState<Sort[]>(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.SORT,\n\t\tparseAsJson((value) => value as Sort[])\n\t\t\t.withDefault([])\n\t\t\t.withOptions({ history: \"push\" }),\n\t);\n\tconst [, setCursor] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.CURSOR);\n\tconst [, setDirection] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.DIRECTION);\n\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [localSort, setLocalSort] = useState<Sort[]>([]);\n\n\tconst handleAddSort = () => {\n\t\tconst firstColumn = tableCols?.[0]?.columnName ?? \"\";\n\t\tsetLocalSort((prev) => [...prev, { columnName: firstColumn, direction: \"asc\" }]);\n\t};\n\n\tconst handleRemoveSort = (index: number) => {\n\t\tsetLocalSort(localSort.filter((_, i) => i !== index));\n\t};\n\n\tconst handleSortColumnChange = (index: number, columnName: string) => {\n\t\tsetLocalSort(localSort.map((sort, i) => (i === index ? { ...sort, columnName } : sort)));\n\t};\n\n\tconst handleSortDirectionChange = (index: number, direction: SortDirection) => {\n\t\tsetLocalSort(localSort.map((sort, i) => (i === index ? { ...sort, direction } : sort)));\n\t};\n\n\tconst handleReset = () => {\n\t\tsetLocalSort([]);\n\t\tsetSorts([]);\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst applySorts = () => {\n\t\tconst validSorts = localSort.filter((s) => s.columnName);\n\t\tsetSorts(validSorts);\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst hasActiveSorts = sorts.length > 0;\n\n\tconst handleOpenChange = (open: boolean) => {\n\t\tif (open) {\n\t\t\tsetLocalSort(sorts);\n\t\t}\n\t\tsetIsOpen(open);\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\topen={isOpen}\n\t\t\tonOpenChange={handleOpenChange}\n\t\t>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tclassName=\"border-r border-l-0 border-y-0 border-zinc-800 rounded-none text-xs h-full\"\n\t\t\t\t>\n\t\t\t\t\t<ArrowUpDown className=\"size-4\" />\n\t\t\t\t\tSort\n\t\t\t\t\t{hasActiveSorts && (\n\t\t\t\t\t\t<Kbd className=\"text-[10px] font-normal text-white bg-primary/10 border border-primary/90 px-1.5 py-0.5\">\n\t\t\t\t\t\t\t{sorts.length}\n\t\t\t\t\t\t</Kbd>\n\t\t\t\t\t)}\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\n\t\t\t<PopoverContent\n\t\t\t\tclassName=\"w-md space-y-2\"\n\t\t\t\talign=\"start\"\n\t\t\t>\n\t\t\t\t<div className=\"flex items-center gap-4\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={handleAddSort}\n\t\t\t\t\t>\n\t\t\t\t\t\tAdd sort\n\t\t\t\t\t\t{localSort && localSort.length > 0 && (\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal text-white bg-primary/10 border border-primary/90 px-1.5 py-0.5\">\n\t\t\t\t\t\t\t\t{localSort.length}\n\t\t\t\t\t\t\t</Kbd>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t\t\t{localSort.length > 0 ? (\n\t\t\t\t\t\tlocalSort.map((sort, index) => (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={`${sort.columnName}-${index}`}\n\t\t\t\t\t\t\t\tclassName=\"flex-1 flex h-9 gap-2 items-center\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tvalue={sort.columnName}\n\t\t\t\t\t\t\t\t\tonValueChange={(value) => handleSortColumnChange(index, value)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SelectTrigger className=\"w-full flex-1\">\n\t\t\t\t\t\t\t\t\t\t<SelectValue placeholder=\"Select column\" />\n\t\t\t\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t\t\t\t{tableCols?.map((col) => (\n\t\t\t\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t\t\t\t</Select>\n\n\t\t\t\t\t\t\t\t<div className=\"flex items-center space-x-2\">\n\t\t\t\t\t\t\t\t\t<Label htmlFor={`sort-direction-${index}`}>Asc</Label>\n\t\t\t\t\t\t\t\t\t<Switch\n\t\t\t\t\t\t\t\t\t\tid={`sort-direction-${index}`}\n\t\t\t\t\t\t\t\t\t\tchecked={sort.direction === \"desc\"}\n\t\t\t\t\t\t\t\t\t\tonCheckedChange={(checked) =>\n\t\t\t\t\t\t\t\t\t\t\thandleSortDirectionChange(index, checked ? \"desc\" : \"asc\")\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Label htmlFor={`sort-direction-${index}`}>Desc</Label>\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\t\tclassName=\"text-xs\"\n\t\t\t\t\t\t\t\t\tonClick={() => handleRemoveSort(index)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<X className=\"size-4\" />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"flex-1 flex h-9 gap-2 items-center justify-center\">\n\t\t\t\t\t\t\t<p className=\"text-sm text-muted-foreground text-center\">No sorts applied</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"gap-2 flex justify-end\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={handleReset}\n\t\t\t\t\t>\n\t\t\t\t\t\tReset\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={applySorts}\n\t\t\t\t\t>\n\t\t\t\t\t\tApply\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport { Spinner } from \"@db-studio/ui/spinner\";\nimport {\n\tTable,\n\tTableBody,\n\tTableCell,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n} from \"@db-studio/ui/table\";\nimport { flexRender, getCoreRowModel, type Row, useReactTable } from \"@tanstack/react-table\";\nimport { ArrowLeftIcon, ArrowRightIcon } from \"lucide-react\";\nimport { useQueryState } from \"nuqs\";\nimport { useEffect, useMemo } from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { useTableCols } from \"@/features/schema\";\nimport { useTableData } from \"@/features/tables/hooks/use-table-data\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { CONSTANTS } from \"@/utils/constants\";\nimport { formatCellValue } from \"@/utils/format-cell-value\";\nimport type { AddRecordFormData } from \"../hooks/use-create-record\";\nimport { ReferencedTableFilterPopup } from \"./referenced-table-filter-popup\";\nimport { ReferencedTableSortPopup } from \"./referenced-table-sort-popup\";\n\nexport const ReferencedTable = ({\n\ttableName,\n\treferencedColumn,\n\tcolumnName,\n}: {\n\ttableName: string;\n\treferencedColumn: string | null;\n\tcolumnName: string;\n}) => {\n\tconst { setValue } = useFormContext<AddRecordFormData>();\n\tconst { closeOverlay } = useOverlayStore();\n\tconst { tableCols, isLoadingTableCols } = useTableCols({ tableName });\n\tconst [referencedActiveTable, setReferencedActiveTable] = useQueryState(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.ACTIVE_TABLE,\n\t);\n\tconst { tableData, isLoadingTableData } = useTableData({\n\t\ttableName,\n\t\tisReferencedTable: true,\n\t});\n\tconst [, setCursor] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.CURSOR);\n\tconst [, setDirection] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.DIRECTION);\n\tconst [limit, setLimit] = useQueryState(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.LIMIT.toString(),\n\t);\n\n\tuseEffect(() => {\n\t\tif (tableName && referencedActiveTable !== tableName) {\n\t\t\tsetReferencedActiveTable(tableName);\n\t\t}\n\t\tif (tableName && !limit) {\n\t\t\tsetLimit(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.DEFAULT_LIMIT.toString());\n\t\t}\n\t}, [tableName, referencedActiveTable, limit, setReferencedActiveTable, setLimit]);\n\n\tconst handleNextPage = () => {\n\t\tif (tableData?.meta?.nextCursor) {\n\t\t\tsetCursor(tableData.meta.nextCursor);\n\t\t\tsetDirection(\"forward\");\n\t\t}\n\t};\n\n\tconst handlePrevPage = () => {\n\t\tif (tableData?.meta?.prevCursor) {\n\t\t\tsetCursor(tableData.meta.prevCursor);\n\t\t\tsetDirection(\"backward\");\n\t\t}\n\t};\n\n\tconst columns = useMemo(() => {\n\t\treturn (\n\t\t\ttableCols?.map((item) => ({\n\t\t\t\tid: item.columnName,\n\t\t\t\taccessorKey: item.columnName,\n\t\t\t\theader: item.columnName,\n\t\t\t\tcell: ({ row }: { row: Row<Record<string, unknown>> }) => (\n\t\t\t\t\t<div className=\"font-medium max-w-[200px] truncate\">\n\t\t\t\t\t\t{formatCellValue(row.getValue(item.columnName))}\n\t\t\t\t\t</div>\n\t\t\t\t),\n\t\t\t})) ?? []\n\t\t);\n\t}, [tableCols]);\n\n\tconst table = useReactTable({\n\t\tcolumns: columns ?? [],\n\t\tdata: tableData?.data ?? [],\n\t\tgetCoreRowModel: getCoreRowModel(),\n\t});\n\n\tconst handleSelectRow = (row: Row<Record<string, unknown>>) => {\n\t\tsetValue(columnName ?? \"\", row.original[referencedColumn ?? \"\"] as string);\n\t\tcloseOverlay(\"records.record-reference\");\n\t};\n\n\tif (isLoadingTableCols || isLoadingTableData) {\n\t\treturn (\n\t\t\t<div className=\"flex items-center justify-center h-full\">\n\t\t\t\t<Spinner size=\"size-8\" />\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div>\n\t\t\t<div className=\"sticky top-0 left-0 right-0 h-8 border-b border-zinc-800 w-full flex items-center justify-between bg-background z-50\">\n\t\t\t\t<div className=\"flex items-center h-full\">\n\t\t\t\t\t<ReferencedTableFilterPopup tableName={tableName} />\n\t\t\t\t\t<ReferencedTableSortPopup tableName={tableName} />\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex items-center h-full\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\tclassName=\"border-l border-r-0 border-y-0 border-zinc-800 rounded-none text-xs h-full aspect-square size-8\"\n\t\t\t\t\t\tonClick={handlePrevPage}\n\t\t\t\t\t\tdisabled={!tableData?.meta?.hasPreviousPage}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ArrowLeftIcon className=\"size-3\" />\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\tclassName=\"border-r border-l border-y-0 border-zinc-800 rounded-none text-xs h-full aspect-square size-8\"\n\t\t\t\t\t\tonClick={handleNextPage}\n\t\t\t\t\t\tdisabled={!tableData?.meta?.hasNextPage}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ArrowRightIcon className=\"size-3\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<Table>\n\t\t\t\t<TableHeader>\n\t\t\t\t\t{table.getHeaderGroups().map((headerGroup) => (\n\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\tclassName=\"hover:bg-transparent text-xs sticky top-0 right-0 left-0\"\n\t\t\t\t\t\t\tkey={headerGroup.id}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{headerGroup.headers.map((header) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<TableHead\n\t\t\t\t\t\t\t\t\t\tkey={header.id}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-r border-zinc-800\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{header.isPlaceholder\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: flexRender(header.column.columnDef.header, header.getContext())}\n\t\t\t\t\t\t\t\t\t</TableHead>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t))}\n\t\t\t\t</TableHeader>\n\t\t\t\t<TableBody>\n\t\t\t\t\t{table.getRowModel().rows?.length ? (\n\t\t\t\t\t\ttable.getRowModel().rows.map((row) => (\n\t\t\t\t\t\t\t<TableRow\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\tclassName=\"text-xs cursor-pointer\"\n\t\t\t\t\t\t\t\tonClick={() => handleSelectRow(row)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{row.getVisibleCells().map((cell) => (\n\t\t\t\t\t\t\t\t\t<TableCell\n\t\t\t\t\t\t\t\t\t\tkey={cell.id}\n\t\t\t\t\t\t\t\t\t\tclassName=\"border-r border-zinc-800\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{flexRender(cell.column.columnDef.cell, cell.getContext())}\n\t\t\t\t\t\t\t\t\t</TableCell>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t\t))\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<TableRow>\n\t\t\t\t\t\t\t<TableCell\n\t\t\t\t\t\t\t\tclassName=\"h-24 text-center\"\n\t\t\t\t\t\t\t\tcolSpan={columns.length}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tNo results.\n\t\t\t\t\t\t\t</TableCell>\n\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t)}\n\t\t\t\t</TableBody>\n\t\t\t</Table>\n\t\t</div>\n\t);\n};\n","import type { FilterType } from \"@db-studio/shared/types\";\nimport { parseAsJson, useQueryState } from \"nuqs\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { CONSTANTS } from \"@/utils/constants\";\nimport { useRecordReferenceStore } from \"../stores/record-reference.store\";\nimport { ReferencedTable } from \"./referenced-table\";\n\nexport const RecordReferenceSheet = () => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { tableName, referencedColumn, columnName, clearRecordReference } =\n\t\tuseRecordReferenceStore();\n\n\tconst [, setReferencedActiveTable] = useQueryState(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.ACTIVE_TABLE,\n\t);\n\tconst [, setRCursor] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.CURSOR);\n\tconst [, setRDirection] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.DIRECTION);\n\tconst [, setRLimit] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.LIMIT.toString());\n\tconst [, setRSort] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.SORT.toString());\n\tconst [, setROrder] = useQueryState(CONSTANTS.REFERENCED_TABLE_STATE_KEYS.ORDER.toString());\n\tconst [, setRFilters] = useQueryState<FilterType[]>(\n\t\tCONSTANTS.REFERENCED_TABLE_STATE_KEYS.FILTERS,\n\t\tparseAsJson((value) => value as FilterType[])\n\t\t\t.withDefault([])\n\t\t\t.withOptions({ history: \"push\" }),\n\t);\n\n\tif (!tableName || !referencedColumn) {\n\t\treturn null;\n\t}\n\n\tconst handleClose = () => {\n\t\tcloseOverlay(\"records.record-reference\");\n\t\tclearRecordReference();\n\t\tsetReferencedActiveTable(null);\n\t\tsetRCursor(null);\n\t\tsetRDirection(null);\n\t\tsetRLimit(null);\n\t\tsetRSort(null);\n\t\tsetROrder(null);\n\t\tsetRFilters(null);\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle={`View records in the table ${tableName}`}\n\t\t\tsize=\"max-w-lg!\"\n\t\t\tcontentClassName=\"p-0\"\n\t\t\topen={isOverlayOpen(\"records.record-reference\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleClose();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<ReferencedTable\n\t\t\t\ttableName={tableName}\n\t\t\t\treferencedColumn={referencedColumn}\n\t\t\t\tcolumnName={columnName ?? \"\"}\n\t\t\t/>\n\t\t</SheetSidebar>\n\t);\n};\n","import { Alert } from \"@db-studio/ui/alert\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { SheetClose } from \"@db-studio/ui/sheet\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useTableCols } from \"@/features/schema\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { type AddRecordFormData, useCreateRecord } from \"../hooks/use-create-record\";\nimport { AddRecordField } from \"./add-record-field\";\nimport { RecordReferenceSheet } from \"./record-reference-sheet\";\n\nexport const AddRecordForm = ({ tableName }: { tableName: string }) => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { tableCols, isLoadingTableCols } = useTableCols({ tableName });\n\tconst { createRecord, isCreatingRecord } = useCreateRecord({ tableName });\n\tconst methods = useForm<AddRecordFormData>();\n\n\tconst onSubmit = async (data: AddRecordFormData) => {\n\t\tcreateRecord(data, {\n\t\t\tonSuccess: () => {\n\t\t\t\tmethods.reset();\n\t\t\t\tcloseOverlay(\"records.add-record\");\n\t\t\t},\n\t\t\tonError: (error) => {\n\t\t\t\tconsole.error(\"Failed to create record:\", error);\n\t\t\t},\n\t\t});\n\t};\n\n\tconst handleCancel = () => {\n\t\tmethods.reset();\n\t\tcloseOverlay(\"records.add-record\");\n\t};\n\n\tconst renderFormContent = () => {\n\t\tif (tableCols && tableCols.length > 0) {\n\t\t\treturn (\n\t\t\t\t<FormProvider {...methods}>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={methods.handleSubmit(onSubmit)}\n\t\t\t\t\t\tclassName=\"flex flex-col h-full\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"space-y-6\">\n\t\t\t\t\t\t\t{tableCols && tableCols.length > 0 && !isLoadingTableCols\n\t\t\t\t\t\t\t\t? tableCols.map((col) => (\n\t\t\t\t\t\t\t\t\t\t<AddRecordField\n\t\t\t\t\t\t\t\t\t\t\tkey={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t{...col}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t\t: null}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"flex justify-end gap-2 py-6\">\n\t\t\t\t\t\t\t<SheetClose\n\t\t\t\t\t\t\t\tasChild\n\t\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\t\tdisabled={isCreatingRecord}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tClose\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</SheetClose>\n\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\t\tdisabled={isCreatingRecord || !methods.formState.isDirty}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tSave\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\n\t\t\t\t\t<RecordReferenceSheet />\n\t\t\t\t</FormProvider>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div className=\"flex flex-col h-full\">\n\t\t\t\t<div className=\"space-y-6\">\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"info\"\n\t\t\t\t\t\ttitle=\"No columns found\"\n\t\t\t\t\t\tmessage=\"Please add at least one column to the table before adding a record.\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle={`Add a new record to the table: ${tableName}`}\n\t\t\topen={isOverlayOpen(\"records.add-record\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleCancel();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t{renderFormContent()}\n\t\t</SheetSidebar>\n\t);\n};\n","import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport type * as React from \"react\";\n\nimport { cn } from \"../utils\";\n\nconst Tabs = TabsPrimitive.Root;\n\nconst TabsList = ({\n\tclassName,\n\tref,\n\t...props\n}: React.ComponentPropsWithRef<typeof TabsPrimitive.List>) => (\n\t<TabsPrimitive.List\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"inline-flex h-10 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nconst TabsTrigger = ({\n\tclassName,\n\tref,\n\t...props\n}: React.ComponentPropsWithRef<typeof TabsPrimitive.Trigger>) => (\n\t<TabsPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\nconst TabsContent = ({\n\tclassName,\n\tref,\n\t...props\n}: React.ComponentPropsWithRef<typeof TabsPrimitive.Content>) => (\n\t<TabsPrimitive.Content\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n\nexport { Tabs, TabsContent, TabsList, TabsTrigger };\n","/**\n * Parse bulk data from CSV or JSON string\n * Supports CSV (comma/tab/semicolon separated) and JSON formats\n */\nexport const parseBulkData = (input: string): Record<string, unknown>[] => {\n\tconst trimmedInput = input.trim();\n\n\t// Try JSON first\n\tif (trimmedInput.startsWith(\"[\") || trimmedInput.startsWith(\"{\")) {\n\t\ttry {\n\t\t\tconst parsed = JSON.parse(trimmedInput);\n\t\t\t// Handle single object wrapped in array\n\t\t\tif (Array.isArray(parsed)) {\n\t\t\t\treturn parsed;\n\t\t\t}\n\t\t\tif (typeof parsed === \"object\" && parsed !== null) {\n\t\t\t\treturn [parsed];\n\t\t\t}\n\t\t\tthrow new Error(\"Invalid JSON format\");\n\t\t} catch (error) {\n\t\t\tif (error instanceof SyntaxError) {\n\t\t\t\tthrow new Error(`Invalid JSON format: ${error.message.replace(\"JSON.\", \"\")}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t// Try CSV format\n\treturn parseCSV(trimmedInput);\n};\n\n/**\n * Parse CSV data with automatic delimiter detection\n */\nconst parseCSV = (input: string): Record<string, unknown>[] => {\n\tconst lines = input.split(\"\\n\").filter((line) => line.trim());\n\n\tif (lines.length < 1) {\n\t\tthrow new Error(\"No data to parse\");\n\t}\n\n\t// Detect delimiter\n\tconst headerLine = lines[0];\n\tconst delimiter = detectDelimiter(headerLine);\n\n\tconst headers = parseCSVLine(headerLine, delimiter).map((h) => h.trim());\n\n\tif (headers.length === 0) {\n\t\tthrow new Error(\"No headers found in CSV\");\n\t}\n\n\tconst records: Record<string, unknown>[] = [];\n\n\tfor (let i = 1; i < lines.length; i++) {\n\t\tconst values = parseCSVLine(lines[i], delimiter);\n\n\t\tif (values.length !== headers.length) {\n\t\t\tconsole.warn(\n\t\t\t\t`Row ${i + 1} has ${values.length} values but ${headers.length} headers expected`,\n\t\t\t);\n\t\t}\n\n\t\tconst record: Record<string, unknown> = {};\n\t\theaders.forEach((header, index) => {\n\t\t\tconst value = values[index]?.trim() ?? \"\";\n\t\t\trecord[header] = parseValue(value);\n\t\t});\n\n\t\trecords.push(record);\n\t}\n\n\tif (records.length === 0) {\n\t\tthrow new Error(\"No records found in CSV\");\n\t}\n\n\treturn records;\n};\n\n/** Pre-compiled delimiter regexes for CSV detection */\nconst DELIMITER_REGEXES: Record<string, RegExp> = {\n\t\",\": /,/g,\n\t\"\\t\": /\\t/g,\n\t\";\": /;/g,\n};\n\n/**\n * Detect CSV delimiter (comma, tab, or semicolon)\n */\nconst detectDelimiter = (headerLine: string): string => {\n\tconst delimiters = [\",\", \"\\t\", \";\"];\n\tlet maxCount = 0;\n\tlet detectedDelimiter = \",\";\n\n\tfor (const delimiter of delimiters) {\n\t\tconst count = (headerLine.match(DELIMITER_REGEXES[delimiter]) || []).length;\n\t\tif (count > maxCount) {\n\t\t\tmaxCount = count;\n\t\t\tdetectedDelimiter = delimiter;\n\t\t}\n\t}\n\n\treturn detectedDelimiter;\n};\n\n/**\n * Parse a single CSV line respecting quotes\n */\nconst parseCSVLine = (line: string, delimiter: string): string[] => {\n\tconst result: string[] = [];\n\tlet current = \"\";\n\tlet insideQuotes = false;\n\n\tfor (let i = 0; i < line.length; i++) {\n\t\tconst char = line[i];\n\t\tconst nextChar = line[i + 1];\n\n\t\tif (char === '\"') {\n\t\t\tif (insideQuotes && nextChar === '\"') {\n\t\t\t\t// Escaped quote\n\t\t\t\tcurrent += '\"';\n\t\t\t\ti++; // Skip next quote\n\t\t\t} else {\n\t\t\t\t// Toggle quote state\n\t\t\t\tinsideQuotes = !insideQuotes;\n\t\t\t}\n\t\t} else if (char === delimiter && !insideQuotes) {\n\t\t\tresult.push(current);\n\t\t\tcurrent = \"\";\n\t\t} else {\n\t\t\tcurrent += char;\n\t\t}\n\t}\n\n\tresult.push(current);\n\treturn result;\n};\n\n/**\n * Convert string values to appropriate types\n */\nconst parseValue = (value: string): unknown => {\n\tif (value === \"\" || value === \"null\") {\n\t\treturn null;\n\t}\n\n\tif (value === \"true\") {\n\t\treturn true;\n\t}\n\n\tif (value === \"false\") {\n\t\treturn false;\n\t}\n\n\t// Try to parse as number\n\tif (!Number.isNaN(Number(value)) && value !== \"\") {\n\t\tconst num = Number(value);\n\t\t// Check if it's actually a number and not just a string that looks like one\n\t\tif (String(num) === value || (value.includes(\".\") && !Number.isNaN(parseFloat(value)))) {\n\t\t\treturn num;\n\t\t}\n\t}\n\n\t// Try to parse as JSON (for arrays/objects)\n\tif (\n\t\t(value.startsWith(\"{\") && value.endsWith(\"}\")) ||\n\t\t(value.startsWith(\"[\") && value.endsWith(\"]\"))\n\t) {\n\t\ttry {\n\t\t\treturn JSON.parse(value);\n\t\t} catch {\n\t\t\t// Not valid JSON, return as string\n\t\t}\n\t}\n\n\treturn value;\n};\n","import type { BulkInsertResult } from \"@db-studio/shared/types\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { posthogAnalytics } from \"@/lib/posthog\";\nimport { bulkInsertRecords as bulkInsertRecordsRequest } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\nexport const useBulkInsertRecords = ({ tableName }: { tableName: string }) => {\n\tconst queryClient = useQueryClient();\n\tconst { selectedDatabase, dbType } = useDatabaseStore();\n\n\tconst { mutateAsync: bulkInsertMutation, isPending: isInserting } = useMutation({\n\t\tmutationFn: async (records: Record<string, unknown>[]) => {\n\t\t\tconst res = await bulkInsertRecordsRequest({\n\t\t\t\ttableName,\n\t\t\t\trecords,\n\t\t\t\tdb: selectedDatabase,\n\t\t\t});\n\t\t\treturn res.data.data;\n\t\t},\n\t\tonSuccess: async () => {\n\t\t\tawait Promise.all([\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.dataByTable(tableName),\n\t\t\t\t\texact: false,\n\t\t\t\t}),\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.lists(),\n\t\t\t\t\texact: false,\n\t\t\t\t}),\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.columnsByTable(tableName),\n\t\t\t\t\texact: false,\n\t\t\t\t}),\n\t\t\t]);\n\t\t},\n\t});\n\n\tconst bulkInsertRecords = async (\n\t\trecords: Record<string, unknown>[],\n\t\toptions?: {\n\t\t\tonSuccess?: (result: BulkInsertResult) => void;\n\t\t\tonError?: (error: Error & { detail?: string }) => void;\n\t\t\tformat?: \"csv\" | \"json\" | \"excel\";\n\t\t},\n\t) => {\n\t\tif (!records || records.length === 0) {\n\t\t\tthrow new Error(\"At least one record is required\");\n\t\t}\n\n\t\treturn toast.promise(bulkInsertMutation(records), {\n\t\t\tloading: `Inserting ${records.length} record${records.length !== 1 ? \"s\" : \"\"}...`,\n\t\t\tsuccess: (result) => {\n\t\t\t\toptions?.onSuccess?.(result);\n\t\t\t\tif (dbType && options?.format) {\n\t\t\t\t\tposthogAnalytics.capture(\"bulk_insert\", { db_type: dbType, format: options.format });\n\t\t\t\t}\n\t\t\t\tif (result.failureCount > 0) {\n\t\t\t\t\treturn `${result.successCount} records inserted, ${result.failureCount} failed`;\n\t\t\t\t}\n\t\t\t\treturn result.message;\n\t\t\t},\n\t\t\terror: (error: Error & { detail?: string }) => {\n\t\t\t\toptions?.onError?.(error);\n\t\t\t\treturn error.detail || error.message || \"Failed to insert records\";\n\t\t\t},\n\t\t});\n\t};\n\n\treturn {\n\t\tbulkInsertRecords,\n\t\tisInserting,\n\t};\n};\n","import { Alert } from \"@db-studio/ui/alert\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { SheetClose } from \"@db-studio/ui/sheet\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@db-studio/ui/tabs\";\nimport { Textarea } from \"@db-studio/ui/textarea\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { parseBulkData } from \"@/utils/parse-bulk-data\";\nimport { useBulkInsertRecords } from \"../hooks/use-bulk-insert-records\";\n\nexport const BulkInsertCsvSheet = ({ tableName }: { tableName: string }) => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { bulkInsertRecords, isInserting } = useBulkInsertRecords({ tableName });\n\tconst fileInputRef = useRef<HTMLInputElement>(null);\n\n\tconst [textValue, setTextValue] = useState(\"\");\n\tconst [selectedFile, setSelectedFile] = useState<File | null>(null);\n\tconst [parsedRecords, setParsedRecords] = useState<Record<string, unknown>[]>([]);\n\tconst [parseError, setParseError] = useState<string | null>(null);\n\tconst [activeTab, setActiveTab] = useState<\"file\" | \"text\">(\"file\");\n\n\tconst handleFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst file = e.target.files?.[0];\n\t\tif (file) {\n\t\t\tsetSelectedFile(file);\n\t\t\tsetParsedRecords([]);\n\t\t\tsetParseError(null);\n\t\t}\n\t};\n\n\tconst handleFormat = useCallback(() => {\n\t\tsetParseError(null);\n\t\tsetParsedRecords([]);\n\n\t\ttry {\n\t\t\tif (activeTab === \"file\" && selectedFile) {\n\t\t\t\tconst reader = new FileReader();\n\t\t\t\treader.onload = (e) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst content = e.target?.result as string;\n\t\t\t\t\t\tconst records = parseBulkData(content);\n\t\t\t\t\t\tsetParsedRecords(records);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to parse file\");\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treader.readAsText(selectedFile);\n\t\t\t} else if (textValue.trim()) {\n\t\t\t\tconst records = parseBulkData(textValue);\n\t\t\t\tsetParsedRecords(records);\n\t\t\t} else {\n\t\t\t\tsetParseError(activeTab === \"file\" ? \"No file selected\" : \"Input is empty\");\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to format data\");\n\t\t}\n\t}, [textValue, selectedFile, activeTab]);\n\n\tconst handleInsert = async () => {\n\t\tif (parsedRecords.length === 0) {\n\t\t\tsetParseError(\"No records to insert\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait bulkInsertRecords(parsedRecords, {\n\t\t\t\tformat: \"csv\",\n\t\t\t\tonSuccess: () => {\n\t\t\t\t\tsetTextValue(\"\");\n\t\t\t\t\tsetSelectedFile(null);\n\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\tsetParseError(null);\n\t\t\t\t\tcloseOverlay(\"records.bulk-insert-csv\");\n\t\t\t\t},\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error inserting records:\", error);\n\t\t}\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetTextValue(\"\");\n\t\tsetSelectedFile(null);\n\t\tsetParsedRecords([]);\n\t\tsetParseError(null);\n\t\tcloseOverlay(\"records.bulk-insert-csv\");\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle={`Add data from CSV into: ${tableName}`}\n\t\t\topen={isOverlayOpen(\"records.bulk-insert-csv\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleCancel();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div className=\"flex flex-col h-full gap-4\">\n\t\t\t\t<Alert\n\t\t\t\t\tvariant=\"info\"\n\t\t\t\t\ttitle=\"CSV Import\"\n\t\t\t\t\tmessage=\"Enter CSV data with headers. Supports comma, tab, or semicolon delimiters. First row should be column names.\"\n\t\t\t\t/>\n\n\t\t\t\t<Tabs\n\t\t\t\t\tvalue={activeTab}\n\t\t\t\t\tonValueChange={(value) => setActiveTab(value as \"file\" | \"text\")}\n\t\t\t\t>\n\t\t\t\t\t<TabsList className=\"grid w-full grid-cols-2\">\n\t\t\t\t\t\t<TabsTrigger value=\"file\">File</TabsTrigger>\n\t\t\t\t\t\t<TabsTrigger value=\"text\">Text</TabsTrigger>\n\t\t\t\t\t</TabsList>\n\n\t\t\t\t\t<TabsContent\n\t\t\t\t\t\tvalue=\"file\"\n\t\t\t\t\t\tclassName=\"flex-1 flex flex-col gap-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\t\thtmlFor=\"file-input\"\n\t\t\t\t\t\t\t\tclassName=\"mb-2 text-sm font-medium text-zinc-300\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tSelect CSV file\n\t\t\t\t\t\t\t</Label>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tid=\"file-input\"\n\t\t\t\t\t\t\t\tref={fileInputRef}\n\t\t\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\t\t\taccept=\".csv\"\n\t\t\t\t\t\t\t\tonChange={handleFileSelect}\n\t\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t\t\tclassName=\"text-sm text-zinc-400 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-zinc-700 file:text-white hover:file:bg-zinc-600 cursor-pointer disabled:opacity-50\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TabsContent>\n\n\t\t\t\t\t<TabsContent\n\t\t\t\t\t\tvalue=\"text\"\n\t\t\t\t\t\tclassName=\"flex-1 flex flex-col gap-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex-1 flex flex-col\">\n\t\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\t\thtmlFor=\"text-input\"\n\t\t\t\t\t\t\t\tclassName=\"text-sm font-medium mb-2 text-zinc-300\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tData Input\n\t\t\t\t\t\t\t</Label>\n\t\t\t\t\t\t\t<Textarea\n\t\t\t\t\t\t\t\tid=\"text-input\"\n\t\t\t\t\t\t\t\tvalue={textValue}\n\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\tsetTextValue(e.target.value);\n\t\t\t\t\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\t\t\t\t\tsetParseError(null);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tplaceholder=\"column1,column2,column3\nvalue1,value2,value3\nvalue4,value5,value6\"\n\t\t\t\t\t\t\t\tclassName=\"flex-1 resize-none font-mono text-sm\"\n\t\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TabsContent>\n\t\t\t\t</Tabs>\n\n\t\t\t\t{parseError && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"error\"\n\t\t\t\t\t\ttitle=\"Parse Error\"\n\t\t\t\t\t\tmessage={parseError}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{parsedRecords.length > 0 && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"success\"\n\t\t\t\t\t\ttitle=\"Ready to Insert\"\n\t\t\t\t\t\tmessage={`${parsedRecords.length} record${parsedRecords.length !== 1 ? \"s\" : \"\"} parsed successfully`}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"flex justify-between gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tonClick={handleFormat}\n\t\t\t\t\t\tdisabled={activeTab === \"file\" ? !selectedFile : !textValue.trim() || isInserting}\n\t\t\t\t\t>\n\t\t\t\t\t\tFormat\n\t\t\t\t\t</Button>\n\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t<SheetClose\n\t\t\t\t\t\t\tasChild\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tClose\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</SheetClose>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\tonClick={handleInsert}\n\t\t\t\t\t\t\tdisabled={parsedRecords.length === 0 || isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{isInserting ? \"Inserting...\" : \"Insert\"}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</SheetSidebar>\n\t);\n};\n","import { Alert } from \"@db-studio/ui/alert\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { SheetClose } from \"@db-studio/ui/sheet\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@db-studio/ui/tabs\";\nimport { Textarea } from \"@db-studio/ui/textarea\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { parseBulkData } from \"@/utils/parse-bulk-data\";\nimport { useBulkInsertRecords } from \"../hooks/use-bulk-insert-records\";\n\nexport const BulkInsertExcelSheet = ({ tableName }: { tableName: string }) => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { bulkInsertRecords, isInserting } = useBulkInsertRecords({ tableName });\n\tconst fileInputRef = useRef<HTMLInputElement>(null);\n\n\tconst [textValue, setTextValue] = useState(\"\");\n\tconst [selectedFile, setSelectedFile] = useState<File | null>(null);\n\tconst [parsedRecords, setParsedRecords] = useState<Record<string, unknown>[]>([]);\n\tconst [parseError, setParseError] = useState<string | null>(null);\n\tconst [activeTab, setActiveTab] = useState<\"file\" | \"text\">(\"file\");\n\n\tconst handleFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst file = e.target.files?.[0];\n\t\tif (file) {\n\t\t\tsetSelectedFile(file);\n\t\t\tsetParsedRecords([]);\n\t\t\tsetParseError(null);\n\t\t}\n\t};\n\n\tconst handleFormat = useCallback(() => {\n\t\tsetParseError(null);\n\t\tsetParsedRecords([]);\n\n\t\ttry {\n\t\t\tif (activeTab === \"file\" && selectedFile) {\n\t\t\t\tconst reader = new FileReader();\n\t\t\t\treader.onload = (e) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst content = e.target?.result as string;\n\t\t\t\t\t\tconst records = parseBulkData(content);\n\t\t\t\t\t\tsetParsedRecords(records);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to parse file\");\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treader.readAsText(selectedFile);\n\t\t\t} else if (textValue.trim()) {\n\t\t\t\tconst records = parseBulkData(textValue);\n\t\t\t\tsetParsedRecords(records);\n\t\t\t} else {\n\t\t\t\tsetParseError(activeTab === \"file\" ? \"No file selected\" : \"Input is empty\");\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to format data\");\n\t\t}\n\t}, [textValue, selectedFile, activeTab]);\n\n\tconst handleInsert = async () => {\n\t\tif (parsedRecords.length === 0) {\n\t\t\tsetParseError(\"No records to insert\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait bulkInsertRecords(parsedRecords, {\n\t\t\t\tformat: \"excel\",\n\t\t\t\tonSuccess: () => {\n\t\t\t\t\tsetTextValue(\"\");\n\t\t\t\t\tsetSelectedFile(null);\n\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\tsetParseError(null);\n\t\t\t\t\tcloseOverlay(\"records.bulk-insert-excel\");\n\t\t\t\t},\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error inserting records:\", error);\n\t\t}\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetTextValue(\"\");\n\t\tsetSelectedFile(null);\n\t\tsetParsedRecords([]);\n\t\tsetParseError(null);\n\t\tcloseOverlay(\"records.bulk-insert-excel\");\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle={`Add data from Excel into: ${tableName}`}\n\t\t\topen={isOverlayOpen(\"records.bulk-insert-excel\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleCancel();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div className=\"flex flex-col h-full gap-4\">\n\t\t\t\t<Alert\n\t\t\t\t\tvariant=\"info\"\n\t\t\t\t\ttitle=\"Excel Import\"\n\t\t\t\t\tmessage=\"Upload an Excel file (.xlsx, .xls) with headers in the first row. Column names should match your table schema.\"\n\t\t\t\t/>\n\n\t\t\t\t<Tabs\n\t\t\t\t\tvalue={activeTab}\n\t\t\t\t\tonValueChange={(value) => setActiveTab(value as \"file\" | \"text\")}\n\t\t\t\t>\n\t\t\t\t\t<TabsList className=\"grid w-full grid-cols-2\">\n\t\t\t\t\t\t<TabsTrigger value=\"file\">File</TabsTrigger>\n\t\t\t\t\t\t<TabsTrigger value=\"text\">Text</TabsTrigger>\n\t\t\t\t\t</TabsList>\n\n\t\t\t\t\t<TabsContent\n\t\t\t\t\t\tvalue=\"file\"\n\t\t\t\t\t\tclassName=\"flex-1 flex flex-col gap-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\t\thtmlFor=\"file-input\"\n\t\t\t\t\t\t\t\tclassName=\"mb-2 text-sm font-medium text-zinc-300\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tSelect Excel file\n\t\t\t\t\t\t\t</Label>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tid=\"file-input\"\n\t\t\t\t\t\t\t\tref={fileInputRef}\n\t\t\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\t\t\taccept=\".xlsx,.xls\"\n\t\t\t\t\t\t\t\tonChange={handleFileSelect}\n\t\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t\t\tclassName=\"text-sm text-zinc-400 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-zinc-700 file:text-white hover:file:bg-zinc-600 cursor-pointer disabled:opacity-50\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TabsContent>\n\n\t\t\t\t\t<TabsContent\n\t\t\t\t\t\tvalue=\"text\"\n\t\t\t\t\t\tclassName=\"flex-1 flex flex-col gap-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex-1 flex flex-col\">\n\t\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\t\thtmlFor=\"text-input\"\n\t\t\t\t\t\t\t\tclassName=\"mb-2 text-sm font-medium text-zinc-300\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tData Input\n\t\t\t\t\t\t\t</Label>\n\t\t\t\t\t\t\t<Textarea\n\t\t\t\t\t\t\t\tid=\"text-input\"\n\t\t\t\t\t\t\t\tvalue={textValue}\n\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\tsetTextValue(e.target.value);\n\t\t\t\t\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\t\t\t\t\tsetParseError(null);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tplaceholder=\"column1\tcolumn2\tcolumn3\nvalue1\tvalue2\tvalue3\nvalue4\tvalue5\tvalue6\"\n\t\t\t\t\t\t\t\tclassName=\"flex-1 resize-none font-mono text-sm\"\n\t\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TabsContent>\n\t\t\t\t</Tabs>\n\n\t\t\t\t{parseError && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"error\"\n\t\t\t\t\t\ttitle=\"Parse Error\"\n\t\t\t\t\t\tmessage={parseError}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{parsedRecords.length > 0 && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"success\"\n\t\t\t\t\t\ttitle=\"Ready to Insert\"\n\t\t\t\t\t\tmessage={`${parsedRecords.length} record${parsedRecords.length !== 1 ? \"s\" : \"\"} parsed successfully`}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"flex justify-between gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tonClick={handleFormat}\n\t\t\t\t\t\tdisabled={activeTab === \"file\" ? !selectedFile : !textValue.trim() || isInserting}\n\t\t\t\t\t>\n\t\t\t\t\t\tFormat\n\t\t\t\t\t</Button>\n\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t<SheetClose\n\t\t\t\t\t\t\tasChild\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tClose\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</SheetClose>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\tonClick={handleInsert}\n\t\t\t\t\t\t\tdisabled={parsedRecords.length === 0 || isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{isInserting ? \"Inserting...\" : \"Insert\"}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</SheetSidebar>\n\t);\n};\n","import { Alert } from \"@db-studio/ui/alert\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { SheetClose } from \"@db-studio/ui/sheet\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@db-studio/ui/tabs\";\nimport { Textarea } from \"@db-studio/ui/textarea\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { parseBulkData } from \"@/utils/parse-bulk-data\";\nimport { useBulkInsertRecords } from \"../hooks/use-bulk-insert-records\";\n\nexport const BulkInsertJsonSheet = ({ tableName }: { tableName: string }) => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { bulkInsertRecords, isInserting } = useBulkInsertRecords({ tableName });\n\tconst fileInputRef = useRef<HTMLInputElement>(null);\n\n\tconst [textValue, setTextValue] = useState(\"\");\n\tconst [selectedFile, setSelectedFile] = useState<File | null>(null);\n\tconst [parsedRecords, setParsedRecords] = useState<Record<string, unknown>[]>([]);\n\tconst [parseError, setParseError] = useState<string | null>(null);\n\tconst [activeTab, setActiveTab] = useState<\"file\" | \"text\">(\"file\");\n\n\tconst handleFileSelect = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst file = e.target.files?.[0];\n\t\tif (file) {\n\t\t\tsetSelectedFile(file);\n\t\t\tsetParsedRecords([]);\n\t\t\tsetParseError(null);\n\t\t}\n\t};\n\n\tconst handleFormat = useCallback(() => {\n\t\tsetParseError(null);\n\t\tsetParsedRecords([]);\n\n\t\ttry {\n\t\t\tif (activeTab === \"file\" && selectedFile) {\n\t\t\t\tconst reader = new FileReader();\n\t\t\t\treader.onload = (e) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst content = e.target?.result as string;\n\t\t\t\t\t\tconst records = parseBulkData(content);\n\t\t\t\t\t\tsetParsedRecords(records);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to parse file\");\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treader.readAsText(selectedFile);\n\t\t\t} else if (textValue.trim()) {\n\t\t\t\tconst records = parseBulkData(textValue);\n\t\t\t\tsetParsedRecords(records);\n\t\t\t} else {\n\t\t\t\tsetParseError(activeTab === \"file\" ? \"No file selected\" : \"Input is empty\");\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to format data\");\n\t\t}\n\t}, [textValue, selectedFile, activeTab]);\n\n\tconst handleInsert = async () => {\n\t\tif (parsedRecords.length === 0) {\n\t\t\tsetParseError(\"No records to insert\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait bulkInsertRecords(parsedRecords, {\n\t\t\t\tformat: \"json\",\n\t\t\t\tonSuccess: () => {\n\t\t\t\t\tsetTextValue(\"\");\n\t\t\t\t\tsetSelectedFile(null);\n\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\tsetParseError(null);\n\t\t\t\t\tcloseOverlay(\"records.bulk-insert-json\");\n\t\t\t\t},\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error inserting records:\", error);\n\t\t}\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetTextValue(\"\");\n\t\tsetSelectedFile(null);\n\t\tsetParsedRecords([]);\n\t\tsetParseError(null);\n\t\tcloseOverlay(\"records.bulk-insert-json\");\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle={`Add data from JSON into: ${tableName}`}\n\t\t\topen={isOverlayOpen(\"records.bulk-insert-json\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleCancel();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div className=\"flex flex-col h-full gap-4\">\n\t\t\t\t<Alert\n\t\t\t\t\tvariant=\"info\"\n\t\t\t\t\ttitle=\"JSON Import\"\n\t\t\t\t\tmessage={\n\t\t\t\t\t\t'Enter JSON array or single object. Example: [{\"name\": \"John\", \"age\": 30}, {\"name\": \"Jane\", \"age\": 28}]'\n\t\t\t\t\t}\n\t\t\t\t/>\n\n\t\t\t\t<Tabs\n\t\t\t\t\tvalue={activeTab}\n\t\t\t\t\tonValueChange={(value) => setActiveTab(value as \"file\" | \"text\")}\n\t\t\t\t>\n\t\t\t\t\t<TabsList className=\"grid w-full grid-cols-2\">\n\t\t\t\t\t\t<TabsTrigger value=\"file\">File</TabsTrigger>\n\t\t\t\t\t\t<TabsTrigger value=\"text\">Text</TabsTrigger>\n\t\t\t\t\t</TabsList>\n\n\t\t\t\t\t<TabsContent\n\t\t\t\t\t\tvalue=\"file\"\n\t\t\t\t\t\tclassName=\"flex-1 flex flex-col gap-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\t\thtmlFor=\"file-input\"\n\t\t\t\t\t\t\t\tclassName=\"mb-2 text-sm font-medium text-zinc-300\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tSelect JSON file\n\t\t\t\t\t\t\t</Label>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tid=\"file-input\"\n\t\t\t\t\t\t\t\tref={fileInputRef}\n\t\t\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\t\t\taccept=\".json\"\n\t\t\t\t\t\t\t\tonChange={handleFileSelect}\n\t\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t\t\tclassName=\"text-sm text-zinc-400 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-zinc-700 file:text-white hover:file:bg-zinc-600 cursor-pointer disabled:opacity-50\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TabsContent>\n\n\t\t\t\t\t<TabsContent\n\t\t\t\t\t\tvalue=\"text\"\n\t\t\t\t\t\tclassName=\"flex-1 flex flex-col gap-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex-1 flex flex-col\">\n\t\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\t\thtmlFor=\"text-input\"\n\t\t\t\t\t\t\t\tclassName=\"mb-2 text-sm font-medium text-zinc-300\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tData Input\n\t\t\t\t\t\t\t</Label>\n\t\t\t\t\t\t\t<Textarea\n\t\t\t\t\t\t\t\tid=\"text-input\"\n\t\t\t\t\t\t\t\tvalue={textValue}\n\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\tsetTextValue(e.target.value);\n\t\t\t\t\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\t\t\t\t\tsetParseError(null);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tplaceholder={'[{\"column1\": \"value1\", \"column2\": \"value2\"}]'}\n\t\t\t\t\t\t\t\tclassName=\"flex-1 resize-none font-mono text-sm\"\n\t\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TabsContent>\n\t\t\t\t</Tabs>\n\n\t\t\t\t{parseError && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"error\"\n\t\t\t\t\t\ttitle=\"Parse Error\"\n\t\t\t\t\t\tmessage={parseError}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{parsedRecords.length > 0 && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"success\"\n\t\t\t\t\t\ttitle=\"Ready to Insert\"\n\t\t\t\t\t\tmessage={`${parsedRecords.length} record${parsedRecords.length !== 1 ? \"s\" : \"\"} parsed successfully`}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"flex justify-between gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tonClick={handleFormat}\n\t\t\t\t\t\tdisabled={activeTab === \"file\" ? !selectedFile : !textValue.trim() || isInserting}\n\t\t\t\t\t>\n\t\t\t\t\t\tFormat\n\t\t\t\t\t</Button>\n\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t<SheetClose\n\t\t\t\t\t\t\tasChild\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tClose\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</SheetClose>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\tonClick={handleInsert}\n\t\t\t\t\t\t\tdisabled={parsedRecords.length === 0 || isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{isInserting ? \"Inserting...\" : \"Insert\"}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</SheetSidebar>\n\t);\n};\n","import { Alert } from \"@db-studio/ui/alert\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { SheetClose } from \"@db-studio/ui/sheet\";\nimport { Textarea } from \"@db-studio/ui/textarea\";\nimport { useCallback, useState } from \"react\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { parseBulkData } from \"@/utils/parse-bulk-data\";\nimport { useBulkInsertRecords } from \"../hooks/use-bulk-insert-records\";\n\nexport const BulkInsertSheet = ({ tableName }: { tableName: string }) => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { bulkInsertRecords, isInserting } = useBulkInsertRecords({ tableName });\n\n\tconst [inputValue, setInputValue] = useState(\"\");\n\tconst [parsedRecords, setParsedRecords] = useState<Record<string, unknown>[]>([]);\n\tconst [parseError, setParseError] = useState<string | null>(null);\n\tconst [format, setFormat] = useState<\"auto\" | \"csv\" | \"json\">(\"auto\");\n\n\tconst handleParse = useCallback(() => {\n\t\tsetParseError(null);\n\t\tsetParsedRecords([]);\n\n\t\ttry {\n\t\t\tif (!inputValue.trim()) {\n\t\t\t\tsetParseError(\"Input is empty\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst records = parseBulkData(inputValue);\n\t\t\tsetParsedRecords(records);\n\t\t} catch (error) {\n\t\t\tsetParseError(error instanceof Error ? error.message : \"Failed to parse data\");\n\t\t}\n\t}, [inputValue]);\n\n\tconst handleInsert = async () => {\n\t\tif (parsedRecords.length === 0) {\n\t\t\tsetParseError(\"No records to insert\");\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait bulkInsertRecords(parsedRecords, {\n\t\t\t\tonSuccess: () => {\n\t\t\t\t\tsetInputValue(\"\");\n\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\tsetParseError(null);\n\t\t\t\t},\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error inserting records:\", error);\n\t\t}\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetInputValue(\"\");\n\t\tsetParsedRecords([]);\n\t\tsetParseError(null);\n\t\tcloseOverlay(\"records.bulk-insert\");\n\t};\n\n\tconst handleClear = () => {\n\t\tsetInputValue(\"\");\n\t\tsetParsedRecords([]);\n\t\tsetParseError(null);\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle={`Bulk Insert Records into: ${tableName}`}\n\t\t\topen={isOverlayOpen(\"records.bulk-insert\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleCancel();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div className=\"flex flex-col h-full gap-4\">\n\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tonClick={() => setFormat(\"auto\")}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={`px-3 py-1 text-sm rounded-md transition-colors ${\n\t\t\t\t\t\t\tformat === \"auto\"\n\t\t\t\t\t\t\t\t? \"bg-blue-600 text-white\"\n\t\t\t\t\t\t\t\t: \"bg-zinc-700 text-zinc-300 hover:bg-zinc-600\"\n\t\t\t\t\t\t}`}\n\t\t\t\t\t>\n\t\t\t\t\t\tAuto\n\t\t\t\t\t</button>\n\t\t\t\t\t<button\n\t\t\t\t\t\tonClick={() => setFormat(\"csv\")}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={`px-3 py-1 text-sm rounded-md transition-colors ${\n\t\t\t\t\t\t\tformat === \"csv\"\n\t\t\t\t\t\t\t\t? \"bg-blue-600 text-white\"\n\t\t\t\t\t\t\t\t: \"bg-zinc-700 text-zinc-300 hover:bg-zinc-600\"\n\t\t\t\t\t\t}`}\n\t\t\t\t\t>\n\t\t\t\t\t\tCSV\n\t\t\t\t\t</button>\n\t\t\t\t\t<button\n\t\t\t\t\t\tonClick={() => setFormat(\"json\")}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={`px-3 py-1 text-sm rounded-md transition-colors ${\n\t\t\t\t\t\t\tformat === \"json\"\n\t\t\t\t\t\t\t\t? \"bg-blue-600 text-white\"\n\t\t\t\t\t\t\t\t: \"bg-zinc-700 text-zinc-300 hover:bg-zinc-600\"\n\t\t\t\t\t\t}`}\n\t\t\t\t\t>\n\t\t\t\t\t\tJSON\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<Alert\n\t\t\t\t\tvariant=\"info\"\n\t\t\t\t\ttitle=\"Bulk Insert\"\n\t\t\t\t\tmessage={\n\t\t\t\t\t\tformat === \"json\"\n\t\t\t\t\t\t\t? 'Enter JSON array or single object. Example: [{\"name\": \"John\", \"age\": 30}, {\"name\": \"Jane\", \"age\": 28}]'\n\t\t\t\t\t\t\t: \"Enter CSV data with headers. Supports comma, tab, or semicolon delimiters. First row should be column names.\"\n\t\t\t\t\t}\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"flex-1 flex flex-col\">\n\t\t\t\t\t<Label\n\t\t\t\t\t\thtmlFor=\"text-input\"\n\t\t\t\t\t\tclassName=\"mb-2 text-sm font-medium text-zinc-300\"\n\t\t\t\t\t>\n\t\t\t\t\t\tData Input\n\t\t\t\t\t</Label>\n\t\t\t\t\t<Textarea\n\t\t\t\t\t\tid=\"text-input\"\n\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\tsetInputValue(e.target.value);\n\t\t\t\t\t\t\tsetParsedRecords([]);\n\t\t\t\t\t\t\tsetParseError(null);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\tformat === \"json\"\n\t\t\t\t\t\t\t\t? '[{\"column1\": \"value1\", \"column2\": \"value2\"}]'\n\t\t\t\t\t\t\t\t: \"column1,column2,column3\\nvalue1,value2,value3\\nvalue4,value5,value6\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"flex-1 resize-none font-mono text-sm\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{parseError && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"error\"\n\t\t\t\t\t\ttitle=\"Parse Error\"\n\t\t\t\t\t\tmessage={parseError}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{parsedRecords.length > 0 && (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tvariant=\"success\"\n\t\t\t\t\t\ttitle=\"Ready to Insert\"\n\t\t\t\t\t\tmessage={`${parsedRecords.length} record${parsedRecords.length !== 1 ? \"s\" : \"\"} parsed successfully`}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<div className=\"flex justify-between gap-2\">\n\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\tonClick={handleClear}\n\t\t\t\t\t\t\tdisabled={!inputValue || isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tClear\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\tonClick={handleParse}\n\t\t\t\t\t\t\tdisabled={!inputValue || isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tPreview\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t<SheetClose\n\t\t\t\t\t\t\tasChild\n\t\t\t\t\t\t\tonClick={handleCancel}\n\t\t\t\t\t\t\tdisabled={isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tClose\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</SheetClose>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\t\tonClick={handleInsert}\n\t\t\t\t\t\t\tdisabled={parsedRecords.length === 0 || isInserting}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{isInserting ? \"Inserting...\" : \"Insert\"}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</SheetSidebar>\n\t);\n};\n","'use client';\nfunction __insertCSS(code) {\n if (!code || typeof document == 'undefined') return\n let head = document.head || document.getElementsByTagName('head')[0]\n let style = document.createElement('style')\n style.type = 'text/css'\n head.appendChild(style)\n ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code))\n}\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport * as React from 'react';\nimport React__default, { useLayoutEffect, useEffect, useMemo } from 'react';\n\nconst DrawerContext = React__default.createContext({\n drawerRef: {\n current: null\n },\n overlayRef: {\n current: null\n },\n onPress: ()=>{},\n onRelease: ()=>{},\n onDrag: ()=>{},\n onNestedDrag: ()=>{},\n onNestedOpenChange: ()=>{},\n onNestedRelease: ()=>{},\n openProp: undefined,\n dismissible: false,\n isOpen: false,\n isDragging: false,\n keyboardIsOpen: {\n current: false\n },\n snapPointsOffset: null,\n snapPoints: null,\n handleOnly: false,\n modal: false,\n shouldFade: false,\n activeSnapPoint: null,\n onOpenChange: ()=>{},\n setActiveSnapPoint: ()=>{},\n closeDrawer: ()=>{},\n direction: 'bottom',\n shouldAnimate: {\n current: true\n },\n shouldScaleBackground: false,\n setBackgroundColorOnScale: true,\n noBodyStyles: false,\n container: null,\n autoFocus: false\n});\nconst useDrawerContext = ()=>{\n const context = React__default.useContext(DrawerContext);\n if (!context) {\n throw new Error('useDrawerContext must be used within a Drawer.Root');\n }\n return context;\n};\n\n__insertCSS(\"[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\\n[data-state=closed]\\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}\");\n\nfunction isMobileFirefox() {\n const userAgent = navigator.userAgent;\n return typeof window !== 'undefined' && (/Firefox/.test(userAgent) && /Mobile/.test(userAgent) || // Android Firefox\n /FxiOS/.test(userAgent) // iOS Firefox\n );\n}\nfunction isMac() {\n return testPlatform(/^Mac/);\n}\nfunction isIPhone() {\n return testPlatform(/^iPhone/);\n}\nfunction isSafari() {\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n}\nfunction isIPad() {\n return testPlatform(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n isMac() && navigator.maxTouchPoints > 1;\n}\nfunction isIOS() {\n return isIPhone() || isIPad();\n}\nfunction testPlatform(re) {\n return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : undefined;\n}\n\n// This code comes from https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/usePreventScroll.ts\nconst KEYBOARD_BUFFER = 24;\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\nfunction chain$1(...callbacks) {\n return (...args)=>{\n for (let callback of callbacks){\n if (typeof callback === 'function') {\n callback(...args);\n }\n }\n };\n}\n// @ts-ignore\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\nfunction isScrollable(node) {\n let style = window.getComputedStyle(node);\n return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);\n}\nfunction getScrollParent(node) {\n if (isScrollable(node)) {\n node = node.parentElement;\n }\n while(node && !isScrollable(node)){\n node = node.parentElement;\n }\n return node || document.scrollingElement || document.documentElement;\n}\n// HTML input types that do not cause the software keyboard to appear.\nconst nonTextInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset'\n]);\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */ function usePreventScroll(options = {}) {\n let { isDisabled } = options;\n useIsomorphicLayoutEffect(()=>{\n if (isDisabled) {\n return;\n }\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n }\n }\n return ()=>{\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore == null ? void 0 : restore();\n }\n };\n }, [\n isDisabled\n ]);\n}\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the\n// top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top\n// of the page, which prevents it from scrolling the page. After the input is focused, scroll the element\n// into view ourselves, without scrolling the whole page.\n// 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the\n// same visually, but makes the actual scroll position always zero. This is required to make all of the\n// above work or Safari will still try to scroll the page when focusing an input.\n// 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting\n// to navigate to an input with the next/previous buttons that's outside a modal.\nfunction preventScrollMobileSafari() {\n let scrollable;\n let lastY = 0;\n let onTouchStart = (e)=>{\n // Store the nearest scrollable parent element from the element that the user touched.\n scrollable = getScrollParent(e.target);\n if (scrollable === document.documentElement && scrollable === document.body) {\n return;\n }\n lastY = e.changedTouches[0].pageY;\n };\n let onTouchMove = (e)=>{\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead. Unfortunately, this disables bounce scrolling when at\n // the top but it's the best we can do.\n let y = e.changedTouches[0].pageY;\n let scrollTop = scrollable.scrollTop;\n let bottom = scrollable.scrollHeight - scrollable.clientHeight;\n if (bottom === 0) {\n return;\n }\n if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) {\n e.preventDefault();\n }\n lastY = y;\n };\n let onTouchEnd = (e)=>{\n let target = e.target;\n // Apply this change if we're not already focused on the target element\n if (isInput(target) && target !== document.activeElement) {\n e.preventDefault();\n // Apply a transform to trick Safari into thinking the input is at the top of the page\n // so it doesn't try to scroll it into view. When tapping on an input, this needs to\n // be done before the \"focus\" event, so we have to focus the element ourselves.\n target.style.transform = 'translateY(-2000px)';\n target.focus();\n requestAnimationFrame(()=>{\n target.style.transform = '';\n });\n }\n };\n let onFocus = (e)=>{\n let target = e.target;\n if (isInput(target)) {\n // Transform also needs to be applied in the focus event in cases where focus moves\n // other than tapping on an input directly, e.g. the next/previous buttons in the\n // software keyboard. In these cases, it seems applying the transform in the focus event\n // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️\n target.style.transform = 'translateY(-2000px)';\n requestAnimationFrame(()=>{\n target.style.transform = '';\n // This will have prevented the browser from scrolling the focused element into view,\n // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.\n if (visualViewport) {\n if (visualViewport.height < window.innerHeight) {\n // If the keyboard is already visible, do this after one additional frame\n // to wait for the transform to be removed.\n requestAnimationFrame(()=>{\n scrollIntoView(target);\n });\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', ()=>scrollIntoView(target), {\n once: true\n });\n }\n }\n });\n }\n };\n let onWindowScroll = ()=>{\n // Last resort. If the window scrolled, scroll it back to the top.\n // It should always be at the top because the body will have a negative margin (see below).\n window.scrollTo(0, 0);\n };\n // Record the original scroll position so we can restore it.\n // Then apply a negative margin to the body to offset it by the scroll position. This will\n // enable us to scroll the window to the top, which is required for the rest of this to work.\n let scrollX = window.pageXOffset;\n let scrollY = window.pageYOffset;\n let restoreStyles = chain$1(setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`));\n // Scroll to the top. The negative margin on the body will make this appear the same.\n window.scrollTo(0, 0);\n let removeEvents = chain$1(addEvent(document, 'touchstart', onTouchStart, {\n passive: false,\n capture: true\n }), addEvent(document, 'touchmove', onTouchMove, {\n passive: false,\n capture: true\n }), addEvent(document, 'touchend', onTouchEnd, {\n passive: false,\n capture: true\n }), addEvent(document, 'focus', onFocus, true), addEvent(window, 'scroll', onWindowScroll));\n return ()=>{\n // Restore styles and scroll the page back to where it was.\n restoreStyles();\n removeEvents();\n window.scrollTo(scrollX, scrollY);\n };\n}\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element, style, value) {\n // https://github.com/microsoft/TypeScript/issues/17827#issuecomment-391663310\n // @ts-ignore\n let cur = element.style[style];\n // @ts-ignore\n element.style[style] = value;\n return ()=>{\n // @ts-ignore\n element.style[style] = cur;\n };\n}\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent(target, event, handler, options) {\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return ()=>{\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\nfunction scrollIntoView(target) {\n let root = document.scrollingElement || document.documentElement;\n while(target && target !== root){\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(target);\n if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {\n let scrollableTop = scrollable.getBoundingClientRect().top;\n let targetTop = target.getBoundingClientRect().top;\n let targetBottom = target.getBoundingClientRect().bottom;\n // Buffer is needed for some edge cases\n const keyboardHeight = scrollable.getBoundingClientRect().bottom + KEYBOARD_BUFFER;\n if (targetBottom > keyboardHeight) {\n scrollable.scrollTop += targetTop - scrollableTop;\n }\n }\n // @ts-ignore\n target = scrollable.parentElement;\n }\n}\nfunction isInput(target) {\n return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;\n}\n\n// This code comes from https://github.com/radix-ui/primitives/tree/main/packages/react/compose-refs\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */ function setRef(ref, value) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */ function composeRefs(...refs) {\n return (node)=>refs.forEach((ref)=>setRef(ref, node));\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */ function useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nconst cache = new WeakMap();\nfunction set(el, styles, ignoreCache = false) {\n if (!el || !(el instanceof HTMLElement)) return;\n let originalStyles = {};\n Object.entries(styles).forEach(([key, value])=>{\n if (key.startsWith('--')) {\n el.style.setProperty(key, value);\n return;\n }\n originalStyles[key] = el.style[key];\n el.style[key] = value;\n });\n if (ignoreCache) return;\n cache.set(el, originalStyles);\n}\nfunction reset(el, prop) {\n if (!el || !(el instanceof HTMLElement)) return;\n let originalStyles = cache.get(el);\n if (!originalStyles) {\n return;\n }\n {\n el.style[prop] = originalStyles[prop];\n }\n}\nconst isVertical = (direction)=>{\n switch(direction){\n case 'top':\n case 'bottom':\n return true;\n case 'left':\n case 'right':\n return false;\n default:\n return direction;\n }\n};\nfunction getTranslate(element, direction) {\n if (!element) {\n return null;\n }\n const style = window.getComputedStyle(element);\n const transform = // @ts-ignore\n style.transform || style.webkitTransform || style.mozTransform;\n let mat = transform.match(/^matrix3d\\((.+)\\)$/);\n if (mat) {\n // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d\n return parseFloat(mat[1].split(', ')[isVertical(direction) ? 13 : 12]);\n }\n // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix\n mat = transform.match(/^matrix\\((.+)\\)$/);\n return mat ? parseFloat(mat[1].split(', ')[isVertical(direction) ? 5 : 4]) : null;\n}\nfunction dampenValue(v) {\n return 8 * (Math.log(v + 1) - 2);\n}\nfunction assignStyle(element, style) {\n if (!element) return ()=>{};\n const prevStyle = element.style.cssText;\n Object.assign(element.style, style);\n return ()=>{\n element.style.cssText = prevStyle;\n };\n}\n/**\n * Receives functions as arguments and returns a new function that calls all.\n */ function chain(...fns) {\n return (...args)=>{\n for (const fn of fns){\n if (typeof fn === 'function') {\n // @ts-ignore\n fn(...args);\n }\n }\n };\n}\n\nconst TRANSITIONS = {\n DURATION: 0.5,\n EASE: [\n 0.32,\n 0.72,\n 0,\n 1\n ]\n};\nconst VELOCITY_THRESHOLD = 0.4;\nconst CLOSE_THRESHOLD = 0.25;\nconst SCROLL_LOCK_TIMEOUT = 100;\nconst BORDER_RADIUS = 8;\nconst NESTED_DISPLACEMENT = 16;\nconst WINDOW_TOP_OFFSET = 26;\nconst DRAG_CLASS = 'vaul-dragging';\n\n// This code comes from https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx\nfunction useCallbackRef(callback) {\n const callbackRef = React__default.useRef(callback);\n React__default.useEffect(()=>{\n callbackRef.current = callback;\n });\n // https://github.com/facebook/react/issues/19240\n return React__default.useMemo(()=>(...args)=>callbackRef.current == null ? void 0 : callbackRef.current.call(callbackRef, ...args), []);\n}\nfunction useUncontrolledState({ defaultProp, onChange }) {\n const uncontrolledState = React__default.useState(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React__default.useRef(value);\n const handleChange = useCallbackRef(onChange);\n React__default.useEffect(()=>{\n if (prevValueRef.current !== value) {\n handleChange(value);\n prevValueRef.current = value;\n }\n }, [\n value,\n prevValueRef,\n handleChange\n ]);\n return uncontrolledState;\n}\nfunction useControllableState({ prop, defaultProp, onChange = ()=>{} }) {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({\n defaultProp,\n onChange\n });\n const isControlled = prop !== undefined;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useCallbackRef(onChange);\n const setValue = React__default.useCallback((nextValue)=>{\n if (isControlled) {\n const setter = nextValue;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) handleChange(value);\n } else {\n setUncontrolledProp(nextValue);\n }\n }, [\n isControlled,\n prop,\n setUncontrolledProp,\n handleChange\n ]);\n return [\n value,\n setValue\n ];\n}\n\nfunction useSnapPoints({ activeSnapPointProp, setActiveSnapPointProp, snapPoints, drawerRef, overlayRef, fadeFromIndex, onSnapPointChange, direction = 'bottom', container, snapToSequentialPoint }) {\n const [activeSnapPoint, setActiveSnapPoint] = useControllableState({\n prop: activeSnapPointProp,\n defaultProp: snapPoints == null ? void 0 : snapPoints[0],\n onChange: setActiveSnapPointProp\n });\n const [windowDimensions, setWindowDimensions] = React__default.useState(typeof window !== 'undefined' ? {\n innerWidth: window.innerWidth,\n innerHeight: window.innerHeight\n } : undefined);\n React__default.useEffect(()=>{\n function onResize() {\n setWindowDimensions({\n innerWidth: window.innerWidth,\n innerHeight: window.innerHeight\n });\n }\n window.addEventListener('resize', onResize);\n return ()=>window.removeEventListener('resize', onResize);\n }, []);\n const isLastSnapPoint = React__default.useMemo(()=>activeSnapPoint === (snapPoints == null ? void 0 : snapPoints[snapPoints.length - 1]) || null, [\n snapPoints,\n activeSnapPoint\n ]);\n const activeSnapPointIndex = React__default.useMemo(()=>{\n var _snapPoints_findIndex;\n return (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint)=>snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : null;\n }, [\n snapPoints,\n activeSnapPoint\n ]);\n const shouldFade = snapPoints && snapPoints.length > 0 && (fadeFromIndex || fadeFromIndex === 0) && !Number.isNaN(fadeFromIndex) && snapPoints[fadeFromIndex] === activeSnapPoint || !snapPoints;\n const snapPointsOffset = React__default.useMemo(()=>{\n const containerSize = container ? {\n width: container.getBoundingClientRect().width,\n height: container.getBoundingClientRect().height\n } : typeof window !== 'undefined' ? {\n width: window.innerWidth,\n height: window.innerHeight\n } : {\n width: 0,\n height: 0\n };\n var _snapPoints_map;\n return (_snapPoints_map = snapPoints == null ? void 0 : snapPoints.map((snapPoint)=>{\n const isPx = typeof snapPoint === 'string';\n let snapPointAsNumber = 0;\n if (isPx) {\n snapPointAsNumber = parseInt(snapPoint, 10);\n }\n if (isVertical(direction)) {\n const height = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.height : 0;\n if (windowDimensions) {\n return direction === 'bottom' ? containerSize.height - height : -containerSize.height + height;\n }\n return height;\n }\n const width = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.width : 0;\n if (windowDimensions) {\n return direction === 'right' ? containerSize.width - width : -containerSize.width + width;\n }\n return width;\n })) != null ? _snapPoints_map : [];\n }, [\n snapPoints,\n windowDimensions,\n container\n ]);\n const activeSnapPointOffset = React__default.useMemo(()=>activeSnapPointIndex !== null ? snapPointsOffset == null ? void 0 : snapPointsOffset[activeSnapPointIndex] : null, [\n snapPointsOffset,\n activeSnapPointIndex\n ]);\n const snapToPoint = React__default.useCallback((dimension)=>{\n var _snapPointsOffset_findIndex;\n const newSnapPointIndex = (_snapPointsOffset_findIndex = snapPointsOffset == null ? void 0 : snapPointsOffset.findIndex((snapPointDim)=>snapPointDim === dimension)) != null ? _snapPointsOffset_findIndex : null;\n onSnapPointChange(newSnapPointIndex);\n set(drawerRef.current, {\n transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n transform: isVertical(direction) ? `translate3d(0, ${dimension}px, 0)` : `translate3d(${dimension}px, 0, 0)`\n });\n if (snapPointsOffset && newSnapPointIndex !== snapPointsOffset.length - 1 && fadeFromIndex !== undefined && newSnapPointIndex !== fadeFromIndex && newSnapPointIndex < fadeFromIndex) {\n set(overlayRef.current, {\n transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n opacity: '0'\n });\n } else {\n set(overlayRef.current, {\n transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n opacity: '1'\n });\n }\n setActiveSnapPoint(snapPoints == null ? void 0 : snapPoints[Math.max(newSnapPointIndex, 0)]);\n }, [\n drawerRef.current,\n snapPoints,\n snapPointsOffset,\n fadeFromIndex,\n overlayRef,\n setActiveSnapPoint\n ]);\n React__default.useEffect(()=>{\n if (activeSnapPoint || activeSnapPointProp) {\n var _snapPoints_findIndex;\n const newIndex = (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint)=>snapPoint === activeSnapPointProp || snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : -1;\n if (snapPointsOffset && newIndex !== -1 && typeof snapPointsOffset[newIndex] === 'number') {\n snapToPoint(snapPointsOffset[newIndex]);\n }\n }\n }, [\n activeSnapPoint,\n activeSnapPointProp,\n snapPoints,\n snapPointsOffset,\n snapToPoint\n ]);\n function onRelease({ draggedDistance, closeDrawer, velocity, dismissible }) {\n if (fadeFromIndex === undefined) return;\n const currentPosition = direction === 'bottom' || direction === 'right' ? (activeSnapPointOffset != null ? activeSnapPointOffset : 0) - draggedDistance : (activeSnapPointOffset != null ? activeSnapPointOffset : 0) + draggedDistance;\n const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;\n const isFirst = activeSnapPointIndex === 0;\n const hasDraggedUp = draggedDistance > 0;\n if (isOverlaySnapPoint) {\n set(overlayRef.current, {\n transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`\n });\n }\n if (!snapToSequentialPoint && velocity > 2 && !hasDraggedUp) {\n if (dismissible) closeDrawer();\n else snapToPoint(snapPointsOffset[0]); // snap to initial point\n return;\n }\n if (!snapToSequentialPoint && velocity > 2 && hasDraggedUp && snapPointsOffset && snapPoints) {\n snapToPoint(snapPointsOffset[snapPoints.length - 1]);\n return;\n }\n // Find the closest snap point to the current position\n const closestSnapPoint = snapPointsOffset == null ? void 0 : snapPointsOffset.reduce((prev, curr)=>{\n if (typeof prev !== 'number' || typeof curr !== 'number') return prev;\n return Math.abs(curr - currentPosition) < Math.abs(prev - currentPosition) ? curr : prev;\n });\n const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;\n if (velocity > VELOCITY_THRESHOLD && Math.abs(draggedDistance) < dim * 0.4) {\n const dragDirection = hasDraggedUp ? 1 : -1; // 1 = up, -1 = down\n // Don't do anything if we swipe upwards while being on the last snap point\n if (dragDirection > 0 && isLastSnapPoint && snapPoints) {\n snapToPoint(snapPointsOffset[snapPoints.length - 1]);\n return;\n }\n if (isFirst && dragDirection < 0 && dismissible) {\n closeDrawer();\n }\n if (activeSnapPointIndex === null) return;\n snapToPoint(snapPointsOffset[activeSnapPointIndex + dragDirection]);\n return;\n }\n snapToPoint(closestSnapPoint);\n }\n function onDrag({ draggedDistance }) {\n if (activeSnapPointOffset === null) return;\n const newValue = direction === 'bottom' || direction === 'right' ? activeSnapPointOffset - draggedDistance : activeSnapPointOffset + draggedDistance;\n // Don't do anything if we exceed the last(biggest) snap point\n if ((direction === 'bottom' || direction === 'right') && newValue < snapPointsOffset[snapPointsOffset.length - 1]) {\n return;\n }\n if ((direction === 'top' || direction === 'left') && newValue > snapPointsOffset[snapPointsOffset.length - 1]) {\n return;\n }\n set(drawerRef.current, {\n transform: isVertical(direction) ? `translate3d(0, ${newValue}px, 0)` : `translate3d(${newValue}px, 0, 0)`\n });\n }\n function getPercentageDragged(absDraggedDistance, isDraggingDown) {\n if (!snapPoints || typeof activeSnapPointIndex !== 'number' || !snapPointsOffset || fadeFromIndex === undefined) return null;\n // If this is true we are dragging to a snap point that is supposed to have an overlay\n const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;\n const isOverlaySnapPointOrHigher = activeSnapPointIndex >= fadeFromIndex;\n if (isOverlaySnapPointOrHigher && isDraggingDown) {\n return 0;\n }\n // Don't animate, but still use this one if we are dragging away from the overlaySnapPoint\n if (isOverlaySnapPoint && !isDraggingDown) return 1;\n if (!shouldFade && !isOverlaySnapPoint) return null;\n // Either fadeFrom index or the one before\n const targetSnapPointIndex = isOverlaySnapPoint ? activeSnapPointIndex + 1 : activeSnapPointIndex - 1;\n // Get the distance from overlaySnapPoint to the one before or vice-versa to calculate the opacity percentage accordingly\n const snapPointDistance = isOverlaySnapPoint ? snapPointsOffset[targetSnapPointIndex] - snapPointsOffset[targetSnapPointIndex - 1] : snapPointsOffset[targetSnapPointIndex + 1] - snapPointsOffset[targetSnapPointIndex];\n const percentageDragged = absDraggedDistance / Math.abs(snapPointDistance);\n if (isOverlaySnapPoint) {\n return 1 - percentageDragged;\n } else {\n return percentageDragged;\n }\n }\n return {\n isLastSnapPoint,\n activeSnapPoint,\n shouldFade,\n getPercentageDragged,\n setActiveSnapPoint,\n activeSnapPointIndex,\n onRelease,\n onDrag,\n snapPointsOffset\n };\n}\n\nconst noop = ()=>()=>{};\nfunction useScaleBackground() {\n const { direction, isOpen, shouldScaleBackground, setBackgroundColorOnScale, noBodyStyles } = useDrawerContext();\n const timeoutIdRef = React__default.useRef(null);\n const initialBackgroundColor = useMemo(()=>document.body.style.backgroundColor, []);\n function getScale() {\n return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;\n }\n React__default.useEffect(()=>{\n if (isOpen && shouldScaleBackground) {\n if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);\n const wrapper = document.querySelector('[data-vaul-drawer-wrapper]') || document.querySelector('[vaul-drawer-wrapper]');\n if (!wrapper) return;\n chain(setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, {\n background: 'black'\n }) : noop, assignStyle(wrapper, {\n transformOrigin: isVertical(direction) ? 'top' : 'left',\n transitionProperty: 'transform, border-radius',\n transitionDuration: `${TRANSITIONS.DURATION}s`,\n transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(',')})`\n }));\n const wrapperStylesCleanup = assignStyle(wrapper, {\n borderRadius: `${BORDER_RADIUS}px`,\n overflow: 'hidden',\n ...isVertical(direction) ? {\n transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`\n } : {\n transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`\n }\n });\n return ()=>{\n wrapperStylesCleanup();\n timeoutIdRef.current = window.setTimeout(()=>{\n if (initialBackgroundColor) {\n document.body.style.background = initialBackgroundColor;\n } else {\n document.body.style.removeProperty('background');\n }\n }, TRANSITIONS.DURATION * 1000);\n };\n }\n }, [\n isOpen,\n shouldScaleBackground,\n initialBackgroundColor\n ]);\n}\n\nlet previousBodyPosition = null;\n/**\n * This hook is necessary to prevent buggy behavior on iOS devices (need to test on Android).\n * I won't get into too much detail about what bugs it solves, but so far I've found that setting the body to `position: fixed` is the most reliable way to prevent those bugs.\n * Issues that this hook solves:\n * https://github.com/emilkowalski/vaul/issues/435\n * https://github.com/emilkowalski/vaul/issues/433\n * And more that I discovered, but were just not reported.\n */ function usePositionFixed({ isOpen, modal, nested, hasBeenOpened, preventScrollRestoration, noBodyStyles }) {\n const [activeUrl, setActiveUrl] = React__default.useState(()=>typeof window !== 'undefined' ? window.location.href : '');\n const scrollPos = React__default.useRef(0);\n const setPositionFixed = React__default.useCallback(()=>{\n // All browsers on iOS will return true here.\n if (!isSafari()) return;\n // If previousBodyPosition is already set, don't set it again.\n if (previousBodyPosition === null && isOpen && !noBodyStyles) {\n previousBodyPosition = {\n position: document.body.style.position,\n top: document.body.style.top,\n left: document.body.style.left,\n height: document.body.style.height,\n right: 'unset'\n };\n // Update the dom inside an animation frame\n const { scrollX, innerHeight } = window;\n document.body.style.setProperty('position', 'fixed', 'important');\n Object.assign(document.body.style, {\n top: `${-scrollPos.current}px`,\n left: `${-scrollX}px`,\n right: '0px',\n height: 'auto'\n });\n window.setTimeout(()=>window.requestAnimationFrame(()=>{\n // Attempt to check if the bottom bar appeared due to the position change\n const bottomBarHeight = innerHeight - window.innerHeight;\n if (bottomBarHeight && scrollPos.current >= innerHeight) {\n // Move the content further up so that the bottom bar doesn't hide it\n document.body.style.top = `${-(scrollPos.current + bottomBarHeight)}px`;\n }\n }), 300);\n }\n }, [\n isOpen\n ]);\n const restorePositionSetting = React__default.useCallback(()=>{\n // All browsers on iOS will return true here.\n if (!isSafari()) return;\n if (previousBodyPosition !== null && !noBodyStyles) {\n // Convert the position from \"px\" to Int\n const y = -parseInt(document.body.style.top, 10);\n const x = -parseInt(document.body.style.left, 10);\n // Restore styles\n Object.assign(document.body.style, previousBodyPosition);\n window.requestAnimationFrame(()=>{\n if (preventScrollRestoration && activeUrl !== window.location.href) {\n setActiveUrl(window.location.href);\n return;\n }\n window.scrollTo(x, y);\n });\n previousBodyPosition = null;\n }\n }, [\n activeUrl\n ]);\n React__default.useEffect(()=>{\n function onScroll() {\n scrollPos.current = window.scrollY;\n }\n onScroll();\n window.addEventListener('scroll', onScroll);\n return ()=>{\n window.removeEventListener('scroll', onScroll);\n };\n }, []);\n React__default.useEffect(()=>{\n if (!modal) return;\n return ()=>{\n if (typeof document === 'undefined') return;\n // Another drawer is opened, safe to ignore the execution\n const hasDrawerOpened = !!document.querySelector('[data-vaul-drawer]');\n if (hasDrawerOpened) return;\n restorePositionSetting();\n };\n }, [\n modal,\n restorePositionSetting\n ]);\n React__default.useEffect(()=>{\n if (nested || !hasBeenOpened) return;\n // This is needed to force Safari toolbar to show **before** the drawer starts animating to prevent a gnarly shift from happening\n if (isOpen) {\n // avoid for standalone mode (PWA)\n const isStandalone = window.matchMedia('(display-mode: standalone)').matches;\n !isStandalone && setPositionFixed();\n if (!modal) {\n window.setTimeout(()=>{\n restorePositionSetting();\n }, 500);\n }\n } else {\n restorePositionSetting();\n }\n }, [\n isOpen,\n hasBeenOpened,\n activeUrl,\n modal,\n nested,\n setPositionFixed,\n restorePositionSetting\n ]);\n return {\n restorePositionSetting\n };\n}\n\nfunction Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, shouldScaleBackground = false, setBackgroundColorOnScale = true, closeThreshold = CLOSE_THRESHOLD, scrollLockTimeout = SCROLL_LOCK_TIMEOUT, dismissible = true, handleOnly = false, fadeFromIndex = snapPoints && snapPoints.length - 1, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal = true, onClose, nested, noBodyStyles = false, direction = 'bottom', defaultOpen = false, disablePreventScroll = true, snapToSequentialPoint = false, preventScrollRestoration = false, repositionInputs = true, onAnimationEnd, container, autoFocus = false }) {\n var _drawerRef_current, _drawerRef_current1;\n const [isOpen = false, setIsOpen] = useControllableState({\n defaultProp: defaultOpen,\n prop: openProp,\n onChange: (o)=>{\n onOpenChange == null ? void 0 : onOpenChange(o);\n if (!o && !nested) {\n restorePositionSetting();\n }\n setTimeout(()=>{\n onAnimationEnd == null ? void 0 : onAnimationEnd(o);\n }, TRANSITIONS.DURATION * 1000);\n if (o && !modal) {\n if (typeof window !== 'undefined') {\n window.requestAnimationFrame(()=>{\n document.body.style.pointerEvents = 'auto';\n });\n }\n }\n if (!o) {\n // This will be removed when the exit animation ends (`500ms`)\n document.body.style.pointerEvents = 'auto';\n }\n }\n });\n const [hasBeenOpened, setHasBeenOpened] = React__default.useState(false);\n const [isDragging, setIsDragging] = React__default.useState(false);\n const [justReleased, setJustReleased] = React__default.useState(false);\n const overlayRef = React__default.useRef(null);\n const openTime = React__default.useRef(null);\n const dragStartTime = React__default.useRef(null);\n const dragEndTime = React__default.useRef(null);\n const lastTimeDragPrevented = React__default.useRef(null);\n const isAllowedToDrag = React__default.useRef(false);\n const nestedOpenChangeTimer = React__default.useRef(null);\n const pointerStart = React__default.useRef(0);\n const keyboardIsOpen = React__default.useRef(false);\n const shouldAnimate = React__default.useRef(!defaultOpen);\n const previousDiffFromInitial = React__default.useRef(0);\n const drawerRef = React__default.useRef(null);\n const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);\n const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);\n const initialDrawerHeight = React__default.useRef(0);\n const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{\n // Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.\n if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();\n }, []);\n const { activeSnapPoint, activeSnapPointIndex, setActiveSnapPoint, onRelease: onReleaseSnapPoints, snapPointsOffset, onDrag: onDragSnapPoints, shouldFade, getPercentageDragged: getSnapPointsPercentageDragged } = useSnapPoints({\n snapPoints,\n activeSnapPointProp,\n setActiveSnapPointProp,\n drawerRef,\n fadeFromIndex,\n overlayRef,\n onSnapPointChange,\n direction,\n container,\n snapToSequentialPoint\n });\n usePreventScroll({\n isDisabled: !isOpen || isDragging || !modal || justReleased || !hasBeenOpened || !repositionInputs || !disablePreventScroll\n });\n const { restorePositionSetting } = usePositionFixed({\n isOpen,\n modal,\n nested: nested != null ? nested : false,\n hasBeenOpened,\n preventScrollRestoration,\n noBodyStyles\n });\n function getScale() {\n return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;\n }\n function onPress(event) {\n var _drawerRef_current, _drawerRef_current1;\n if (!dismissible && !snapPoints) return;\n if (drawerRef.current && !drawerRef.current.contains(event.target)) return;\n drawerHeightRef.current = ((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0;\n drawerWidthRef.current = ((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0;\n setIsDragging(true);\n dragStartTime.current = new Date();\n // iOS doesn't trigger mouseUp after scrolling so we need to listen to touched in order to disallow dragging\n if (isIOS()) {\n window.addEventListener('touchend', ()=>isAllowedToDrag.current = false, {\n once: true\n });\n }\n // Ensure we maintain correct pointer capture even when going outside of the drawer\n event.target.setPointerCapture(event.pointerId);\n pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;\n }\n function shouldDrag(el, isDraggingInDirection) {\n var _window_getSelection;\n let element = el;\n const highlightedText = (_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString();\n const swipeAmount = drawerRef.current ? getTranslate(drawerRef.current, direction) : null;\n const date = new Date();\n // Fixes https://github.com/emilkowalski/vaul/issues/483\n if (element.tagName === 'SELECT') {\n return false;\n }\n if (element.hasAttribute('data-vaul-no-drag') || element.closest('[data-vaul-no-drag]')) {\n return false;\n }\n if (direction === 'right' || direction === 'left') {\n return true;\n }\n // Allow scrolling when animating\n if (openTime.current && date.getTime() - openTime.current.getTime() < 500) {\n return false;\n }\n if (swipeAmount !== null) {\n if (direction === 'bottom' ? swipeAmount > 0 : swipeAmount < 0) {\n return true;\n }\n }\n // Don't drag if there's highlighted text\n if (highlightedText && highlightedText.length > 0) {\n return false;\n }\n // Disallow dragging if drawer was scrolled within `scrollLockTimeout`\n if (lastTimeDragPrevented.current && date.getTime() - lastTimeDragPrevented.current.getTime() < scrollLockTimeout && swipeAmount === 0) {\n lastTimeDragPrevented.current = date;\n return false;\n }\n if (isDraggingInDirection) {\n lastTimeDragPrevented.current = date;\n // We are dragging down so we should allow scrolling\n return false;\n }\n // Keep climbing up the DOM tree as long as there's a parent\n while(element){\n // Check if the element is scrollable\n if (element.scrollHeight > element.clientHeight) {\n if (element.scrollTop !== 0) {\n lastTimeDragPrevented.current = new Date();\n // The element is scrollable and not scrolled to the top, so don't drag\n return false;\n }\n if (element.getAttribute('role') === 'dialog') {\n return true;\n }\n }\n // Move up to the parent element\n element = element.parentNode;\n }\n // No scrollable parents not scrolled to the top found, so drag\n return true;\n }\n function onDrag(event) {\n if (!drawerRef.current) {\n return;\n }\n // We need to know how much of the drawer has been dragged in percentages so that we can transform background accordingly\n if (isDragging) {\n const directionMultiplier = direction === 'bottom' || direction === 'right' ? 1 : -1;\n const draggedDistance = (pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX)) * directionMultiplier;\n const isDraggingInDirection = draggedDistance > 0;\n // Pre condition for disallowing dragging in the close direction.\n const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;\n // Disallow dragging down to close when first snap point is the active one and dismissible prop is set to false.\n if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) return;\n // We need to capture last time when drag with scroll was triggered and have a timeout between\n const absDraggedDistance = Math.abs(draggedDistance);\n const wrapper = document.querySelector('[data-vaul-drawer-wrapper]');\n const drawerDimension = direction === 'bottom' || direction === 'top' ? drawerHeightRef.current : drawerWidthRef.current;\n // Calculate the percentage dragged, where 1 is the closed position\n let percentageDragged = absDraggedDistance / drawerDimension;\n const snapPointPercentageDragged = getSnapPointsPercentageDragged(absDraggedDistance, isDraggingInDirection);\n if (snapPointPercentageDragged !== null) {\n percentageDragged = snapPointPercentageDragged;\n }\n // Disallow close dragging beyond the smallest snap point.\n if (noCloseSnapPointsPreCondition && percentageDragged >= 1) {\n return;\n }\n if (!isAllowedToDrag.current && !shouldDrag(event.target, isDraggingInDirection)) return;\n drawerRef.current.classList.add(DRAG_CLASS);\n // If shouldDrag gave true once after pressing down on the drawer, we set isAllowedToDrag to true and it will remain true until we let go, there's no reason to disable dragging mid way, ever, and that's the solution to it\n isAllowedToDrag.current = true;\n set(drawerRef.current, {\n transition: 'none'\n });\n set(overlayRef.current, {\n transition: 'none'\n });\n if (snapPoints) {\n onDragSnapPoints({\n draggedDistance\n });\n }\n // Run this only if snapPoints are not defined or if we are at the last snap point (highest one)\n if (isDraggingInDirection && !snapPoints) {\n const dampenedDraggedDistance = dampenValue(draggedDistance);\n const translateValue = Math.min(dampenedDraggedDistance * -1, 0) * directionMultiplier;\n set(drawerRef.current, {\n transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`\n });\n return;\n }\n const opacityValue = 1 - percentageDragged;\n if (shouldFade || fadeFromIndex && activeSnapPointIndex === fadeFromIndex - 1) {\n onDragProp == null ? void 0 : onDragProp(event, percentageDragged);\n set(overlayRef.current, {\n opacity: `${opacityValue}`,\n transition: 'none'\n }, true);\n }\n if (wrapper && overlayRef.current && shouldScaleBackground) {\n // Calculate percentageDragged as a fraction (0 to 1)\n const scaleValue = Math.min(getScale() + percentageDragged * (1 - getScale()), 1);\n const borderRadiusValue = 8 - percentageDragged * 8;\n const translateValue = Math.max(0, 14 - percentageDragged * 14);\n set(wrapper, {\n borderRadius: `${borderRadiusValue}px`,\n transform: isVertical(direction) ? `scale(${scaleValue}) translate3d(0, ${translateValue}px, 0)` : `scale(${scaleValue}) translate3d(${translateValue}px, 0, 0)`,\n transition: 'none'\n }, true);\n }\n if (!snapPoints) {\n const translateValue = absDraggedDistance * directionMultiplier;\n set(drawerRef.current, {\n transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`\n });\n }\n }\n }\n React__default.useEffect(()=>{\n window.requestAnimationFrame(()=>{\n shouldAnimate.current = true;\n });\n }, []);\n React__default.useEffect(()=>{\n var _window_visualViewport;\n function onVisualViewportChange() {\n if (!drawerRef.current || !repositionInputs) return;\n const focusedElement = document.activeElement;\n if (isInput(focusedElement) || keyboardIsOpen.current) {\n var _window_visualViewport;\n const visualViewportHeight = ((_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.height) || 0;\n const totalHeight = window.innerHeight;\n // This is the height of the keyboard\n let diffFromInitial = totalHeight - visualViewportHeight;\n const drawerHeight = drawerRef.current.getBoundingClientRect().height || 0;\n // Adjust drawer height only if it's tall enough\n const isTallEnough = drawerHeight > totalHeight * 0.8;\n if (!initialDrawerHeight.current) {\n initialDrawerHeight.current = drawerHeight;\n }\n const offsetFromTop = drawerRef.current.getBoundingClientRect().top;\n // visualViewport height may change due to somq e subtle changes to the keyboard. Checking if the height changed by 60 or more will make sure that they keyboard really changed its open state.\n if (Math.abs(previousDiffFromInitial.current - diffFromInitial) > 60) {\n keyboardIsOpen.current = !keyboardIsOpen.current;\n }\n if (snapPoints && snapPoints.length > 0 && snapPointsOffset && activeSnapPointIndex) {\n const activeSnapPointHeight = snapPointsOffset[activeSnapPointIndex] || 0;\n diffFromInitial += activeSnapPointHeight;\n }\n previousDiffFromInitial.current = diffFromInitial;\n // We don't have to change the height if the input is in view, when we are here we are in the opened keyboard state so we can correctly check if the input is in view\n if (drawerHeight > visualViewportHeight || keyboardIsOpen.current) {\n const height = drawerRef.current.getBoundingClientRect().height;\n let newDrawerHeight = height;\n if (height > visualViewportHeight) {\n newDrawerHeight = visualViewportHeight - (isTallEnough ? offsetFromTop : WINDOW_TOP_OFFSET);\n }\n // When fixed, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open\n if (fixed) {\n drawerRef.current.style.height = `${height - Math.max(diffFromInitial, 0)}px`;\n } else {\n drawerRef.current.style.height = `${Math.max(newDrawerHeight, visualViewportHeight - offsetFromTop)}px`;\n }\n } else if (!isMobileFirefox()) {\n drawerRef.current.style.height = `${initialDrawerHeight.current}px`;\n }\n if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) {\n drawerRef.current.style.bottom = `0px`;\n } else {\n // Negative bottom value would never make sense\n drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;\n }\n }\n }\n (_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.addEventListener('resize', onVisualViewportChange);\n return ()=>{\n var _window_visualViewport;\n return (_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.removeEventListener('resize', onVisualViewportChange);\n };\n }, [\n activeSnapPointIndex,\n snapPoints,\n snapPointsOffset\n ]);\n function closeDrawer(fromWithin) {\n cancelDrag();\n onClose == null ? void 0 : onClose();\n if (!fromWithin) {\n setIsOpen(false);\n }\n setTimeout(()=>{\n if (snapPoints) {\n setActiveSnapPoint(snapPoints[0]);\n }\n }, TRANSITIONS.DURATION * 1000); // seconds to ms\n }\n function resetDrawer() {\n if (!drawerRef.current) return;\n const wrapper = document.querySelector('[data-vaul-drawer-wrapper]');\n const currentSwipeAmount = getTranslate(drawerRef.current, direction);\n set(drawerRef.current, {\n transform: 'translate3d(0, 0, 0)',\n transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`\n });\n set(overlayRef.current, {\n transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n opacity: '1'\n });\n // Don't reset background if swiped upwards\n if (shouldScaleBackground && currentSwipeAmount && currentSwipeAmount > 0 && isOpen) {\n set(wrapper, {\n borderRadius: `${BORDER_RADIUS}px`,\n overflow: 'hidden',\n ...isVertical(direction) ? {\n transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,\n transformOrigin: 'top'\n } : {\n transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,\n transformOrigin: 'left'\n },\n transitionProperty: 'transform, border-radius',\n transitionDuration: `${TRANSITIONS.DURATION}s`,\n transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(',')})`\n }, true);\n }\n }\n function cancelDrag() {\n if (!isDragging || !drawerRef.current) return;\n drawerRef.current.classList.remove(DRAG_CLASS);\n isAllowedToDrag.current = false;\n setIsDragging(false);\n dragEndTime.current = new Date();\n }\n function onRelease(event) {\n if (!isDragging || !drawerRef.current) return;\n drawerRef.current.classList.remove(DRAG_CLASS);\n isAllowedToDrag.current = false;\n setIsDragging(false);\n dragEndTime.current = new Date();\n const swipeAmount = getTranslate(drawerRef.current, direction);\n if (!event || !shouldDrag(event.target, false) || !swipeAmount || Number.isNaN(swipeAmount)) return;\n if (dragStartTime.current === null) return;\n const timeTaken = dragEndTime.current.getTime() - dragStartTime.current.getTime();\n const distMoved = pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX);\n const velocity = Math.abs(distMoved) / timeTaken;\n if (velocity > 0.05) {\n // `justReleased` is needed to prevent the drawer from focusing on an input when the drag ends, as it's not the intent most of the time.\n setJustReleased(true);\n setTimeout(()=>{\n setJustReleased(false);\n }, 200);\n }\n if (snapPoints) {\n const directionMultiplier = direction === 'bottom' || direction === 'right' ? 1 : -1;\n onReleaseSnapPoints({\n draggedDistance: distMoved * directionMultiplier,\n closeDrawer,\n velocity,\n dismissible\n });\n onReleaseProp == null ? void 0 : onReleaseProp(event, true);\n return;\n }\n // Moved upwards, don't do anything\n if (direction === 'bottom' || direction === 'right' ? distMoved > 0 : distMoved < 0) {\n resetDrawer();\n onReleaseProp == null ? void 0 : onReleaseProp(event, true);\n return;\n }\n if (velocity > VELOCITY_THRESHOLD) {\n closeDrawer();\n onReleaseProp == null ? void 0 : onReleaseProp(event, false);\n return;\n }\n var _drawerRef_current_getBoundingClientRect_height;\n const visibleDrawerHeight = Math.min((_drawerRef_current_getBoundingClientRect_height = drawerRef.current.getBoundingClientRect().height) != null ? _drawerRef_current_getBoundingClientRect_height : 0, window.innerHeight);\n var _drawerRef_current_getBoundingClientRect_width;\n const visibleDrawerWidth = Math.min((_drawerRef_current_getBoundingClientRect_width = drawerRef.current.getBoundingClientRect().width) != null ? _drawerRef_current_getBoundingClientRect_width : 0, window.innerWidth);\n const isHorizontalSwipe = direction === 'left' || direction === 'right';\n if (Math.abs(swipeAmount) >= (isHorizontalSwipe ? visibleDrawerWidth : visibleDrawerHeight) * closeThreshold) {\n closeDrawer();\n onReleaseProp == null ? void 0 : onReleaseProp(event, false);\n return;\n }\n onReleaseProp == null ? void 0 : onReleaseProp(event, true);\n resetDrawer();\n }\n React__default.useEffect(()=>{\n // Trigger enter animation without using CSS animation\n if (isOpen) {\n set(document.documentElement, {\n scrollBehavior: 'auto'\n });\n openTime.current = new Date();\n }\n return ()=>{\n reset(document.documentElement, 'scrollBehavior');\n };\n }, [\n isOpen\n ]);\n function onNestedOpenChange(o) {\n const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;\n const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;\n if (nestedOpenChangeTimer.current) {\n window.clearTimeout(nestedOpenChangeTimer.current);\n }\n set(drawerRef.current, {\n transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}px, 0, 0)`\n });\n if (!o && drawerRef.current) {\n nestedOpenChangeTimer.current = setTimeout(()=>{\n const translateValue = getTranslate(drawerRef.current, direction);\n set(drawerRef.current, {\n transition: 'none',\n transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`\n });\n }, 500);\n }\n }\n function onNestedDrag(_event, percentageDragged) {\n if (percentageDragged < 0) return;\n const initialScale = (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;\n const newScale = initialScale + percentageDragged * (1 - initialScale);\n const newTranslate = -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;\n set(drawerRef.current, {\n transform: isVertical(direction) ? `scale(${newScale}) translate3d(0, ${newTranslate}px, 0)` : `scale(${newScale}) translate3d(${newTranslate}px, 0, 0)`,\n transition: 'none'\n });\n }\n function onNestedRelease(_event, o) {\n const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;\n const scale = o ? (dim - NESTED_DISPLACEMENT) / dim : 1;\n const translate = o ? -NESTED_DISPLACEMENT : 0;\n if (o) {\n set(drawerRef.current, {\n transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${translate}px, 0)` : `scale(${scale}) translate3d(${translate}px, 0, 0)`\n });\n }\n }\n React__default.useEffect(()=>{\n if (!modal) {\n // Need to do this manually unfortunately\n window.requestAnimationFrame(()=>{\n document.body.style.pointerEvents = 'auto';\n });\n }\n }, [\n modal\n ]);\n return /*#__PURE__*/ React__default.createElement(DialogPrimitive.Root, {\n defaultOpen: defaultOpen,\n onOpenChange: (open)=>{\n if (!dismissible && !open) return;\n if (open) {\n setHasBeenOpened(true);\n } else {\n closeDrawer(true);\n }\n setIsOpen(open);\n },\n open: isOpen\n }, /*#__PURE__*/ React__default.createElement(DrawerContext.Provider, {\n value: {\n activeSnapPoint,\n snapPoints,\n setActiveSnapPoint,\n drawerRef,\n overlayRef,\n onOpenChange,\n onPress,\n onRelease,\n onDrag,\n dismissible,\n shouldAnimate,\n handleOnly,\n isOpen,\n isDragging,\n shouldFade,\n closeDrawer,\n onNestedDrag,\n onNestedOpenChange,\n onNestedRelease,\n keyboardIsOpen,\n modal,\n snapPointsOffset,\n activeSnapPointIndex,\n direction,\n shouldScaleBackground,\n setBackgroundColorOnScale,\n noBodyStyles,\n container,\n autoFocus\n }\n }, children));\n}\nconst Overlay = /*#__PURE__*/ React__default.forwardRef(function({ ...rest }, ref) {\n const { overlayRef, snapPoints, onRelease, shouldFade, isOpen, modal, shouldAnimate } = useDrawerContext();\n const composedRef = useComposedRefs(ref, overlayRef);\n const hasSnapPoints = snapPoints && snapPoints.length > 0;\n // Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog library\n if (!modal) {\n return null;\n }\n const onMouseUp = React__default.useCallback((event)=>onRelease(event), [\n onRelease\n ]);\n return /*#__PURE__*/ React__default.createElement(DialogPrimitive.Overlay, {\n onMouseUp: onMouseUp,\n ref: composedRef,\n \"data-vaul-overlay\": \"\",\n \"data-vaul-snap-points\": isOpen && hasSnapPoints ? 'true' : 'false',\n \"data-vaul-snap-points-overlay\": isOpen && shouldFade ? 'true' : 'false',\n \"data-vaul-animate\": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? 'true' : 'false',\n ...rest\n });\n});\nOverlay.displayName = 'Drawer.Overlay';\nconst Content = /*#__PURE__*/ React__default.forwardRef(function({ onPointerDownOutside, style, onOpenAutoFocus, ...rest }, ref) {\n const { drawerRef, onPress, onRelease, onDrag, keyboardIsOpen, snapPointsOffset, activeSnapPointIndex, modal, isOpen, direction, snapPoints, container, handleOnly, shouldAnimate, autoFocus } = useDrawerContext();\n // Needed to use transition instead of animations\n const [delayedSnapPoints, setDelayedSnapPoints] = React__default.useState(false);\n const composedRef = useComposedRefs(ref, drawerRef);\n const pointerStartRef = React__default.useRef(null);\n const lastKnownPointerEventRef = React__default.useRef(null);\n const wasBeyondThePointRef = React__default.useRef(false);\n const hasSnapPoints = snapPoints && snapPoints.length > 0;\n useScaleBackground();\n const isDeltaInDirection = (delta, direction, threshold = 0)=>{\n if (wasBeyondThePointRef.current) return true;\n const deltaY = Math.abs(delta.y);\n const deltaX = Math.abs(delta.x);\n const isDeltaX = deltaX > deltaY;\n const dFactor = [\n 'bottom',\n 'right'\n ].includes(direction) ? 1 : -1;\n if (direction === 'left' || direction === 'right') {\n const isReverseDirection = delta.x * dFactor < 0;\n if (!isReverseDirection && deltaX >= 0 && deltaX <= threshold) {\n return isDeltaX;\n }\n } else {\n const isReverseDirection = delta.y * dFactor < 0;\n if (!isReverseDirection && deltaY >= 0 && deltaY <= threshold) {\n return !isDeltaX;\n }\n }\n wasBeyondThePointRef.current = true;\n return true;\n };\n React__default.useEffect(()=>{\n if (hasSnapPoints) {\n window.requestAnimationFrame(()=>{\n setDelayedSnapPoints(true);\n });\n }\n }, []);\n function handleOnPointerUp(event) {\n pointerStartRef.current = null;\n wasBeyondThePointRef.current = false;\n onRelease(event);\n }\n return /*#__PURE__*/ React__default.createElement(DialogPrimitive.Content, {\n \"data-vaul-drawer-direction\": direction,\n \"data-vaul-drawer\": \"\",\n \"data-vaul-delayed-snap-points\": delayedSnapPoints ? 'true' : 'false',\n \"data-vaul-snap-points\": isOpen && hasSnapPoints ? 'true' : 'false',\n \"data-vaul-custom-container\": container ? 'true' : 'false',\n \"data-vaul-animate\": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? 'true' : 'false',\n ...rest,\n ref: composedRef,\n style: snapPointsOffset && snapPointsOffset.length > 0 ? {\n '--snap-point-height': `${snapPointsOffset[activeSnapPointIndex != null ? activeSnapPointIndex : 0]}px`,\n ...style\n } : style,\n onPointerDown: (event)=>{\n if (handleOnly) return;\n rest.onPointerDown == null ? void 0 : rest.onPointerDown.call(rest, event);\n pointerStartRef.current = {\n x: event.pageX,\n y: event.pageY\n };\n onPress(event);\n },\n onOpenAutoFocus: (e)=>{\n onOpenAutoFocus == null ? void 0 : onOpenAutoFocus(e);\n if (!autoFocus) {\n e.preventDefault();\n }\n },\n onPointerDownOutside: (e)=>{\n onPointerDownOutside == null ? void 0 : onPointerDownOutside(e);\n if (!modal || e.defaultPrevented) {\n e.preventDefault();\n return;\n }\n if (keyboardIsOpen.current) {\n keyboardIsOpen.current = false;\n }\n },\n onFocusOutside: (e)=>{\n if (!modal) {\n e.preventDefault();\n return;\n }\n },\n onPointerMove: (event)=>{\n lastKnownPointerEventRef.current = event;\n if (handleOnly) return;\n rest.onPointerMove == null ? void 0 : rest.onPointerMove.call(rest, event);\n if (!pointerStartRef.current) return;\n const yPosition = event.pageY - pointerStartRef.current.y;\n const xPosition = event.pageX - pointerStartRef.current.x;\n const swipeStartThreshold = event.pointerType === 'touch' ? 10 : 2;\n const delta = {\n x: xPosition,\n y: yPosition\n };\n const isAllowedToSwipe = isDeltaInDirection(delta, direction, swipeStartThreshold);\n if (isAllowedToSwipe) onDrag(event);\n else if (Math.abs(xPosition) > swipeStartThreshold || Math.abs(yPosition) > swipeStartThreshold) {\n pointerStartRef.current = null;\n }\n },\n onPointerUp: (event)=>{\n rest.onPointerUp == null ? void 0 : rest.onPointerUp.call(rest, event);\n pointerStartRef.current = null;\n wasBeyondThePointRef.current = false;\n onRelease(event);\n },\n onPointerOut: (event)=>{\n rest.onPointerOut == null ? void 0 : rest.onPointerOut.call(rest, event);\n handleOnPointerUp(lastKnownPointerEventRef.current);\n },\n onContextMenu: (event)=>{\n rest.onContextMenu == null ? void 0 : rest.onContextMenu.call(rest, event);\n if (lastKnownPointerEventRef.current) {\n handleOnPointerUp(lastKnownPointerEventRef.current);\n }\n }\n });\n});\nContent.displayName = 'Drawer.Content';\nconst LONG_HANDLE_PRESS_TIMEOUT = 250;\nconst DOUBLE_TAP_TIMEOUT = 120;\nconst Handle = /*#__PURE__*/ React__default.forwardRef(function({ preventCycle = false, children, ...rest }, ref) {\n const { closeDrawer, isDragging, snapPoints, activeSnapPoint, setActiveSnapPoint, dismissible, handleOnly, isOpen, onPress, onDrag } = useDrawerContext();\n const closeTimeoutIdRef = React__default.useRef(null);\n const shouldCancelInteractionRef = React__default.useRef(false);\n function handleStartCycle() {\n // Stop if this is the second click of a double click\n if (shouldCancelInteractionRef.current) {\n handleCancelInteraction();\n return;\n }\n window.setTimeout(()=>{\n handleCycleSnapPoints();\n }, DOUBLE_TAP_TIMEOUT);\n }\n function handleCycleSnapPoints() {\n // Prevent accidental taps while resizing drawer\n if (isDragging || preventCycle || shouldCancelInteractionRef.current) {\n handleCancelInteraction();\n return;\n }\n // Make sure to clear the timeout id if the user releases the handle before the cancel timeout\n handleCancelInteraction();\n if (!snapPoints || snapPoints.length === 0) {\n if (!dismissible) {\n closeDrawer();\n }\n return;\n }\n const isLastSnapPoint = activeSnapPoint === snapPoints[snapPoints.length - 1];\n if (isLastSnapPoint && dismissible) {\n closeDrawer();\n return;\n }\n const currentSnapIndex = snapPoints.findIndex((point)=>point === activeSnapPoint);\n if (currentSnapIndex === -1) return; // activeSnapPoint not found in snapPoints\n const nextSnapPoint = snapPoints[currentSnapIndex + 1];\n setActiveSnapPoint(nextSnapPoint);\n }\n function handleStartInteraction() {\n closeTimeoutIdRef.current = window.setTimeout(()=>{\n // Cancel click interaction on a long press\n shouldCancelInteractionRef.current = true;\n }, LONG_HANDLE_PRESS_TIMEOUT);\n }\n function handleCancelInteraction() {\n if (closeTimeoutIdRef.current) {\n window.clearTimeout(closeTimeoutIdRef.current);\n }\n shouldCancelInteractionRef.current = false;\n }\n return /*#__PURE__*/ React__default.createElement(\"div\", {\n onClick: handleStartCycle,\n onPointerCancel: handleCancelInteraction,\n onPointerDown: (e)=>{\n if (handleOnly) onPress(e);\n handleStartInteraction();\n },\n onPointerMove: (e)=>{\n if (handleOnly) onDrag(e);\n },\n // onPointerUp is already handled by the content component\n ref: ref,\n \"data-vaul-drawer-visible\": isOpen ? 'true' : 'false',\n \"data-vaul-handle\": \"\",\n \"aria-hidden\": \"true\",\n ...rest\n }, /*#__PURE__*/ React__default.createElement(\"span\", {\n \"data-vaul-handle-hitarea\": \"\",\n \"aria-hidden\": \"true\"\n }, children));\n});\nHandle.displayName = 'Drawer.Handle';\nfunction NestedRoot({ onDrag, onOpenChange, open: nestedIsOpen, ...rest }) {\n const { onNestedDrag, onNestedOpenChange, onNestedRelease } = useDrawerContext();\n if (!onNestedDrag) {\n throw new Error('Drawer.NestedRoot must be placed in another drawer');\n }\n return /*#__PURE__*/ React__default.createElement(Root, {\n nested: true,\n open: nestedIsOpen,\n onClose: ()=>{\n onNestedOpenChange(false);\n },\n onDrag: (e, p)=>{\n onNestedDrag(e, p);\n onDrag == null ? void 0 : onDrag(e, p);\n },\n onOpenChange: (o)=>{\n if (o) {\n onNestedOpenChange(o);\n }\n onOpenChange == null ? void 0 : onOpenChange(o);\n },\n onRelease: onNestedRelease,\n ...rest\n });\n}\nfunction Portal(props) {\n const context = useDrawerContext();\n const { container = context.container, ...portalProps } = props;\n return /*#__PURE__*/ React__default.createElement(DialogPrimitive.Portal, {\n container: container,\n ...portalProps\n });\n}\nconst Drawer = {\n Root,\n NestedRoot,\n Content,\n Overlay,\n Trigger: DialogPrimitive.Trigger,\n Portal,\n Handle,\n Close: DialogPrimitive.Close,\n Title: DialogPrimitive.Title,\n Description: DialogPrimitive.Description\n};\n\nexport { Content, Drawer, Handle, NestedRoot, Overlay, Portal, Root };\n","import type * as React from \"react\";\nimport { Drawer as DrawerPrimitive } from \"vaul\";\n\nimport { cn } from \"../utils\";\n\nfunction Drawer({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n\treturn (\n\t\t<DrawerPrimitive.Root\n\t\t\tdata-slot=\"drawer\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerTrigger({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n\treturn (\n\t\t<DrawerPrimitive.Trigger\n\t\t\tdata-slot=\"drawer-trigger\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerPortal({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n\treturn (\n\t\t<DrawerPrimitive.Portal\n\t\t\tdata-slot=\"drawer-portal\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n\treturn (\n\t\t<DrawerPrimitive.Close\n\t\t\tdata-slot=\"drawer-close\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerOverlay({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n\treturn (\n\t\t<DrawerPrimitive.Overlay\n\t\t\tdata-slot=\"drawer-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t// \"fixed inset-0 z-50 bg-black/80 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0\",\n\t\t\t\t\"fixed inset-0 z-50 bg-black/80 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerContent({\n\tclassName,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content>) {\n\treturn (\n\t\t<DrawerPortal data-slot=\"drawer-portal\">\n\t\t\t<DrawerOverlay />\n\t\t\t<DrawerPrimitive.Content\n\t\t\t\tdata-slot=\"drawer-content\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"group/drawer-content fixed z-50 flex h-auto flex-col bg-transparent p-2 text-xs/relaxed text-popover-foreground before:absolute before:inset-2 before:-z-10 before:rounded-xl before:border before:border-border before:bg-popover data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{/* <div className=\"mx-auto mt-4 hidden h-1.5 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block\" /> */}\n\t\t\t\t{children}\n\t\t\t</DrawerPrimitive.Content>\n\t\t</DrawerPortal>\n\t);\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"drawer-header\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex flex-col gap-1 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:text-left\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"drawer-footer\"\n\t\t\tclassName={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerTitle({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n\treturn (\n\t\t<DrawerPrimitive.Title\n\t\t\tdata-slot=\"drawer-title\"\n\t\t\tclassName={cn(\"text-sm font-medium text-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction DrawerDescription({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n\treturn (\n\t\t<DrawerPrimitive.Description\n\t\t\tdata-slot=\"drawer-description\"\n\t\t\tclassName={cn(\"text-xs/relaxed text-muted-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tDrawer,\n\tDrawerClose,\n\tDrawerContent,\n\tDrawerDescription,\n\tDrawerFooter,\n\tDrawerHeader,\n\tDrawerOverlay,\n\tDrawerPortal,\n\tDrawerTitle,\n\tDrawerTrigger,\n};\n","import { createContext as j, useContext as W, useState as A, useCallback as h, useRef as K, useLayoutEffect as X, useEffect as I, useMemo as Y } from \"react\";\nimport { jsx as x } from \"react/jsx-runtime\";\nconst F = [\"shift\", \"alt\", \"meta\", \"mod\", \"ctrl\", \"control\"];\nfunction Z() {\n return typeof navigator > \"u\" ? !1 : /mac/i.test(navigator.userAgent) && !/iphone|ipad|ipod/i.test(navigator.userAgent);\n}\nconst ee = {\n esc: \"escape\",\n return: \"enter\",\n left: \"arrowleft\",\n right: \"arrowright\",\n up: \"arrowup\",\n down: \"arrowdown\",\n ShiftLeft: \"shift\",\n ShiftRight: \"shift\",\n AltLeft: \"alt\",\n AltRight: \"alt\",\n MetaLeft: \"meta\",\n MetaRight: \"meta\",\n OSLeft: \"meta\",\n OSRight: \"meta\",\n ControlLeft: \"ctrl\",\n ControlRight: \"ctrl\"\n};\nfunction L(e) {\n return (ee[e.trim()] || e.trim()).toLowerCase().replace(/key|digit|numpad/, \"\");\n}\nfunction $(e) {\n return F.includes(e);\n}\nfunction R(e, t = \",\") {\n return e.toLowerCase().split(t);\n}\nfunction O(e, t = \"+\", r = \">\", i = !1, u, f) {\n let d = [], l = !1;\n e = e.trim(), e.includes(r) ? (l = !0, d = e.toLocaleLowerCase().split(r).map((y) => L(y))) : d = e.toLocaleLowerCase().split(t).map((y) => L(y));\n const o = {\n alt: d.includes(\"alt\"),\n ctrl: d.includes(\"ctrl\") || d.includes(\"control\"),\n shift: d.includes(\"shift\"),\n meta: d.includes(\"meta\"),\n mod: d.includes(\"mod\"),\n useKey: i\n }, p = d.filter((y) => !F.includes(y));\n return {\n ...o,\n keys: p,\n description: u,\n isSequence: l,\n hotkey: e,\n metadata: f\n };\n}\ntypeof document < \"u\" && (document.addEventListener(\"keydown\", (e) => {\n e.code !== void 0 && z([L(e.code)]);\n}), document.addEventListener(\"keyup\", (e) => {\n e.code !== void 0 && G([L(e.code)]);\n})), typeof window < \"u\" && (window.addEventListener(\"blur\", () => {\n g.clear();\n}), window.addEventListener(\"focus\", () => {\n g.clear();\n}), window.addEventListener(\"contextmenu\", () => {\n setTimeout(() => {\n g.clear();\n }, 0);\n})), typeof document < \"u\" && document.addEventListener(\"visibilitychange\", () => {\n g.clear();\n});\nconst g = /* @__PURE__ */ new Set();\nfunction D(e) {\n return Array.isArray(e);\n}\nfunction te(e, t = \",\") {\n return (D(e) ? e : e.split(t)).every((i) => g.has(i.trim().toLowerCase()));\n}\nfunction z(e) {\n const t = Array.isArray(e) ? e : [e];\n g.has(\"meta\") && g.forEach((r) => {\n $(r) || g.delete(r.toLowerCase());\n }), t.forEach((r) => {\n g.add(r.toLowerCase());\n });\n}\nfunction G(e) {\n const t = Array.isArray(e) ? e : [e];\n e === \"meta\" ? g.clear() : t.forEach((r) => {\n g.delete(r.toLowerCase());\n });\n}\nfunction re(e, t, r) {\n (typeof r == \"function\" && r(e, t) || r === !0) && e.preventDefault();\n}\nfunction ne(e, t, r) {\n return typeof r == \"function\" ? r(e, t) : r === !0 || r === void 0;\n}\nconst oe = [\n \"input\",\n \"textarea\",\n \"select\",\n \"searchbox\",\n \"slider\",\n \"spinbutton\",\n \"menuitem\",\n \"menuitemcheckbox\",\n \"menuitemradio\",\n \"option\",\n \"radio\",\n \"textbox\"\n];\nfunction se(e) {\n return J(e, oe);\n}\nfunction J(e, t = !1) {\n const { target: r, composed: i } = e;\n let u, f;\n return ie(r) && i ? (u = e.composedPath()[0] && e.composedPath()[0].tagName, f = e.composedPath()[0] && e.composedPath()[0].role) : (u = r && r.tagName, f = r && r.role), D(t) ? !!(u && t?.some((d) => d.toLowerCase() === u.toLowerCase() || d === f)) : !!(u && t && t);\n}\nfunction ie(e) {\n return !!e.tagName && !e.tagName.startsWith(\"-\") && e.tagName.includes(\"-\");\n}\nfunction ue(e, t) {\n return e.length === 0 && t ? !1 : t ? e.some((r) => t.includes(r)) || e.includes(\"*\") : !0;\n}\nconst ce = (e, t, r = !1) => {\n const { alt: i, meta: u, mod: f, shift: d, ctrl: l, keys: o, useKey: p } = t, { code: y, key: s, ctrlKey: c, metaKey: n, shiftKey: E, altKey: C } = e, m = L(y);\n if (p && o?.length === 1 && o.includes(s.toLowerCase()))\n return !0;\n if (!o?.includes(m) && ![\"ctrl\", \"control\", \"unknown\", \"meta\", \"alt\", \"shift\", \"os\"].includes(m))\n return !1;\n if (!r) {\n if (i !== C && m !== \"alt\" || d !== E && m !== \"shift\")\n return !1;\n if (f) {\n if (Z() ? !n : !c)\n return !1;\n } else if (u !== n && m !== \"meta\" && m !== \"os\" || l !== c && m !== \"ctrl\" && m !== \"control\")\n return !1;\n }\n return o && o.length === 1 && o.includes(m) ? !0 : o && o.length > 0 ? o.includes(m) ? te(o) : !1 : !o || o.length === 0;\n}, Q = j(void 0), ae = () => W(Q);\nfunction de({ addHotkey: e, removeHotkey: t, children: r }) {\n return /* @__PURE__ */ x(Q.Provider, { value: { addHotkey: e, removeHotkey: t }, children: r });\n}\nfunction M(e, t) {\n return e && t && typeof e == \"object\" && typeof t == \"object\" ? Object.keys(e).length === Object.keys(t).length && // @ts-expect-error TS7053\n Object.keys(e).reduce((r, i) => r && M(e[i], t[i]), !0) : e === t;\n}\nconst U = j({\n hotkeys: [],\n activeScopes: [],\n // This array has to be empty instead of containing '*' as default, to check if the provider is set or not\n toggleScope: () => {\n },\n enableScope: () => {\n },\n disableScope: () => {\n }\n}), fe = () => W(U), ve = ({ initiallyActiveScopes: e = [\"*\"], children: t }) => {\n const [r, i] = A(e), [u, f] = A([]), d = h((s) => {\n i((c) => c.includes(\"*\") ? [s] : Array.from(/* @__PURE__ */ new Set([...c, s])));\n }, []), l = h((s) => {\n i((c) => c.filter((n) => n !== s));\n }, []), o = h((s) => {\n i((c) => c.includes(s) ? c.filter((n) => n !== s) : c.includes(\"*\") ? [s] : Array.from(/* @__PURE__ */ new Set([...c, s])));\n }, []), p = h((s) => {\n f((c) => [...c, s]);\n }, []), y = h((s) => {\n f((c) => c.filter((n) => !M(n, s)));\n }, []);\n return /* @__PURE__ */ x(\n U.Provider,\n {\n value: { activeScopes: r, hotkeys: u, enableScope: d, disableScope: l, toggleScope: o },\n children: /* @__PURE__ */ x(de, { addHotkey: p, removeHotkey: y, children: t })\n }\n );\n};\nfunction le(e) {\n const t = K(void 0);\n return M(t.current, e) || (t.current = e), t.current;\n}\nconst ye = (e) => {\n e.stopPropagation(), e.preventDefault(), e.stopImmediatePropagation();\n}, me = typeof window < \"u\" ? X : I;\nfunction pe(e) {\n if (!e) return;\n const { enabled: t, preventDefault: r, ignoreEventWhen: i, ...u } = e;\n return u;\n}\nfunction we(e, t, r, i) {\n const [u, f] = A(null), d = h((w) => (f(w), () => f(null)), []), l = K(!1), o = Array.isArray(r) ? Array.isArray(i) ? void 0 : i : r, p = D(e) ? e.join(o?.delimiter) : e, y = Array.isArray(r) ? r : Array.isArray(i) ? i : void 0, s = h(t, y ?? []), c = K(s);\n y ? c.current = s : c.current = t;\n const n = le(pe(o)), E = K(o?.enabled);\n E.current = o?.enabled;\n const C = K(o?.preventDefault);\n C.current = o?.preventDefault;\n const m = K(o?.ignoreEventWhen);\n m.current = o?.ignoreEventWhen;\n const { activeScopes: T } = fe(), b = ae();\n return me(() => {\n if (E.current === !1 || !ue(T, n?.scopes))\n return;\n let w = [], S;\n const q = (a, _ = !1) => {\n if (!(se(a) && !J(a, n?.enableOnFormTags))) {\n if (u !== null) {\n const k = u.getRootNode();\n if ((k instanceof Document || k instanceof ShadowRoot) && k.activeElement !== u && !u.contains(k.activeElement)) {\n ye(a);\n return;\n }\n }\n a.target?.isContentEditable && !n?.enableOnContentEditable || R(p, n?.delimiter).forEach((k) => {\n if (k.includes(n?.splitKey ?? \"+\") && k.includes(n?.sequenceSplitKey ?? \">\")) {\n console.warn(\n `Hotkey ${k} contains both ${n?.splitKey ?? \"+\"} and ${n?.sequenceSplitKey ?? \">\"} which is not supported.`\n );\n return;\n }\n const v = O(\n k,\n n?.splitKey,\n n?.sequenceSplitKey,\n n?.useKey,\n n?.description,\n n?.metadata\n );\n if (v.isSequence) {\n S = setTimeout(() => {\n w = [];\n }, n?.sequenceTimeoutMs ?? 1e3);\n const P = v.useKey ? a.key : L(a.code);\n if ($(P.toLowerCase()))\n return;\n w.push(P);\n const V = v.keys?.[w.length - 1];\n if (P !== V) {\n w = [], S && clearTimeout(S);\n return;\n }\n w.length === v.keys?.length && (c.current(a, v), S && clearTimeout(S), w = []);\n } else if (ce(a, v, n?.ignoreModifiers) || v.keys?.includes(\"*\")) {\n if (m.current?.(a) || _ && l.current || (re(a, v, C.current), !ne(a, v, E.current)))\n return;\n c.current(a, v), _ || (l.current = !0);\n }\n });\n }\n }, B = (a) => {\n a.code !== void 0 && (z(L(a.code)), (n?.keydown === void 0 && n?.keyup !== !0 || n?.keydown) && q(a));\n }, N = (a) => {\n a.code !== void 0 && (G(L(a.code)), l.current = !1, n?.keyup && q(a, !0));\n }, H = u || o?.document || document;\n return H.addEventListener(\"keyup\", N, o?.eventListenerOptions), H.addEventListener(\"keydown\", B, o?.eventListenerOptions), b && R(p, n?.delimiter).forEach((a) => {\n b.addHotkey(\n O(\n a,\n n?.splitKey,\n n?.sequenceSplitKey,\n n?.useKey,\n n?.description,\n n?.metadata\n )\n );\n }), () => {\n H.removeEventListener(\"keyup\", N, o?.eventListenerOptions), H.removeEventListener(\"keydown\", B, o?.eventListenerOptions), b && R(p, n?.delimiter).forEach((a) => {\n b.removeHotkey(\n O(\n a,\n n?.splitKey,\n n?.sequenceSplitKey,\n n?.useKey,\n n?.description,\n n?.metadata\n )\n );\n }), w = [], S && clearTimeout(S);\n };\n }, [u, n, T, p]), d;\n}\nfunction ke(e = !1, t = []) {\n const [r, i] = A(/* @__PURE__ */ new Set()), [u, f] = A(!1), d = Y(() => new Set(t.map((s) => s.toLowerCase())), [t]), l = h(\n (s) => {\n if (s.code === void 0)\n return;\n const c = L(e ? s.key : s.code).toLowerCase();\n d.has(c) || (s.preventDefault(), s.stopPropagation(), i((n) => {\n const E = new Set(n);\n return E.add(c), E;\n }));\n },\n [e, d]\n ), o = h(() => {\n f(!1);\n }, []), p = h(() => {\n i(/* @__PURE__ */ new Set()), f(!0);\n }, []), y = h(() => {\n i(/* @__PURE__ */ new Set());\n }, []);\n return I(() => {\n if (typeof document < \"u\" && u)\n return document.addEventListener(\"keydown\", l), () => {\n document.removeEventListener(\"keydown\", l);\n };\n }, [u, l]), [r, { start: p, stop: o, resetKeys: y, isRecording: u }];\n}\nexport {\n ve as HotkeysProvider,\n te as isHotkeyPressed,\n we as useHotkeys,\n fe as useHotkeysContext,\n ke as useRecordHotkeys\n};\n","import { create } from \"zustand\";\n\nexport type CellUpdate = {\n\tscope: string;\n\trowData: Record<string, unknown>; // The entire row data\n\tcolumnName: string; // The column identifier\n\tnewValue: unknown; // The new value\n\toriginalValue: unknown; // The original value for comparison\n};\n\ntype UpdateCellStore = {\n\tupdates: Map<string, CellUpdate>;\n\tsetUpdate: (\n\t\trowData: Record<string, unknown>,\n\t\tcolumnName: string,\n\t\tnewValue: unknown,\n\t\toriginalValue: unknown,\n\t\tscope?: string,\n\t) => void;\n\tclearUpdates: () => void;\n\tclearUpdate: (rowData: Record<string, unknown>, columnName: string, scope?: string) => void;\n\tgetUpdates: () => CellUpdate[];\n\tgetUpdate: (\n\t\trowData: Record<string, unknown>,\n\t\tcolumnName: string,\n\t\tscope?: string,\n\t) => CellUpdate | null;\n\thasUpdate: (rowData: Record<string, unknown>, columnName: string, scope?: string) => boolean;\n\thasAnyUpdates: () => boolean;\n\tgetUpdateCount: () => number;\n};\n\nconst stableStringify = (value: unknown): string => {\n\tif (value === null || typeof value !== \"object\") return JSON.stringify(value);\n\tif (Array.isArray(value)) return `[${value.map(stableStringify).join(\",\")}]`;\n\n\tconst record = value as Record<string, unknown>;\n\treturn `{${Object.keys(record)\n\t\t.sort()\n\t\t.map((key) => `${JSON.stringify(key)}:${stableStringify(record[key])}`)\n\t\t.join(\",\")}}`;\n};\n\nconst getCellKey = (\n\trowData: Record<string, unknown>,\n\tcolumnName: string,\n\tscope = \"global\",\n): string => {\n\tconst rowId = rowData.id ?? rowData._id ?? stableStringify(rowData);\n\treturn stableStringify([scope, rowId, columnName]);\n};\n\nexport const useUpdateCellStore = create<UpdateCellStore>()((set, get) => ({\n\tupdates: new Map(),\n\n\tsetUpdate: (rowData, columnName, newValue, originalValue, scope) => {\n\t\tset((state) => {\n\t\t\tconst newUpdates = new Map(state.updates);\n\t\t\tconst key = getCellKey(rowData, columnName, scope);\n\n\t\t\t// If the new value equals the original value, remove the update\n\t\t\tif (newValue === originalValue) {\n\t\t\t\tnewUpdates.delete(key);\n\t\t\t} else {\n\t\t\t\tnewUpdates.set(key, {\n\t\t\t\t\tscope: scope ?? \"global\",\n\t\t\t\t\trowData,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\tnewValue,\n\t\t\t\t\toriginalValue,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn { updates: newUpdates };\n\t\t});\n\t},\n\n\tclearUpdates: () => set({ updates: new Map() }),\n\n\tclearUpdate: (rowData, columnName, scope) => {\n\t\tset((state) => {\n\t\t\tconst newUpdates = new Map(state.updates);\n\t\t\tnewUpdates.delete(getCellKey(rowData, columnName, scope));\n\t\t\treturn { updates: newUpdates };\n\t\t});\n\t},\n\n\tgetUpdates: () => Array.from(get().updates.values()),\n\n\tgetUpdate: (rowData, columnName, scope) => {\n\t\treturn get().updates.get(getCellKey(rowData, columnName, scope)) ?? null;\n\t},\n\n\thasUpdate: (rowData, columnName, scope) => {\n\t\treturn get().updates.has(getCellKey(rowData, columnName, scope));\n\t},\n\n\thasAnyUpdates: () => get().updates.size > 0,\n\n\tgetUpdateCount: () => get().updates.size,\n}));\n","import type {\n\tBaseResponse,\n\tFilterType,\n\tTableDataResultSchemaType,\n} from \"@db-studio/shared/types\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { DataGrid } from \"@db-studio/ui/data-grid\";\nimport { DrawerHeader, DrawerTitle } from \"@db-studio/ui/drawer\";\nimport { Spinner } from \"@db-studio/ui/spinner\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useNavigate } from \"@tanstack/react-router\";\nimport type { ColumnDef } from \"@tanstack/react-table\";\nimport { ExternalLink } from \"lucide-react\";\nimport { useMemo } from \"react\";\nimport { useTableCols } from \"@/features/schema\";\nimport { api } from \"@/shared/api/client\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { CellCopyButton } from \"./cell-copy-button\";\n\nexport const FkDrawerContent = ({\n\treferencedTable,\n\treferencedColumn,\n\tfkValue,\n}: {\n\treferencedTable: string;\n\treferencedColumn: string;\n\tfkValue: string;\n}) => {\n\tconst { selectedDatabase } = useDatabaseStore();\n\n\tconst { tableCols } = useTableCols({ tableName: referencedTable });\n\n\tconst filter: FilterType = useMemo(\n\t\t() => ({ columnName: referencedColumn, operator: \"=\", value: fkValue }),\n\t\t[referencedColumn, fkValue],\n\t);\n\n\tconst { data: tableData, isLoading } = useQuery({\n\t\tqueryKey: [\"fk-drawer\", referencedTable, referencedColumn, fkValue, selectedDatabase],\n\t\tqueryFn: async () => {\n\t\t\tconst res = await api.get<BaseResponse<TableDataResultSchemaType>>(\n\t\t\t\t`/tables/${referencedTable}/data`,\n\t\t\t\t{\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tdb: selectedDatabase ?? \"\",\n\t\t\t\t\t\tlimit: \"50\",\n\t\t\t\t\t\tfilters: JSON.stringify([filter]),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn res.data.data;\n\t\t},\n\t\tenabled: !!referencedTable && !!selectedDatabase && fkValue !== \"\",\n\t});\n\n\tconst columns = useMemo<ColumnDef<TableRecord>[]>(\n\t\t() =>\n\t\t\ttableCols?.map((col) => ({\n\t\t\t\taccessorKey: col.columnName,\n\t\t\t\theader: col.columnName,\n\t\t\t\tmeta: {\n\t\t\t\t\tvariant: col.enumValues ? \"enum\" : col.dataType,\n\t\t\t\t\tisPrimaryKey: col.isPrimaryKey,\n\t\t\t\t\tisForeignKey: col.isForeignKey,\n\t\t\t\t\treferencedTable: col.referencedTable,\n\t\t\t\t\treferencedColumn: col.referencedColumn,\n\t\t\t\t\tenumValues: col.enumValues,\n\t\t\t\t\tdataTypeLabel: col.dataTypeLabel,\n\t\t\t\t},\n\t\t\t\tsize: (col.columnName.length + (col.dataTypeLabel?.length || 0)) * 5 + 100,\n\t\t\t\tminSize: 100,\n\t\t\t\tmaxSize: 500,\n\t\t\t})) ?? [],\n\t\t[tableCols],\n\t);\n\n\tconst navigate = useNavigate();\n\n\tconst handleNavigate = () => {\n\t\tnavigate({\n\t\t\tto: \"/table/$table\",\n\t\t\tparams: { table: referencedTable },\n\t\t\tsearch: { filters: [filter] },\n\t\t});\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DrawerHeader className=\"flex flex-row items-center justify-between py-3\">\n\t\t\t\t<DrawerTitle>{referencedTable}</DrawerTitle>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tonClick={handleNavigate}\n\t\t\t\t>\n\t\t\t\t\t<ExternalLink size={14} />\n\t\t\t\t\tOpen table\n\t\t\t\t</Button>\n\t\t\t</DrawerHeader>\n\t\t\t<div className=\"flex flex-1 overflow-hidden border-t\">\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<div className=\"flex items-center justify-center w-full text-sm text-muted-foreground\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<DataGrid\n\t\t\t\t\t\tcolumns={columns}\n\t\t\t\t\t\tdata={tableData?.data ?? []}\n\t\t\t\t\t\trenderCellAccessory={(value) => <CellCopyButton value={value} />}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</>\n\t);\n};\n","import { cn } from \"@db-studio/ui/utils\";\nimport type { Cell, Table } from \"@tanstack/react-table\";\nimport { type ComponentProps, type KeyboardEvent, type MouseEvent, useCallback } from \"react\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { useUpdateCellStore } from \"../stores/update-cell.store\";\n\ninterface TableCellWrapperProps<TData> extends ComponentProps<\"div\"> {\n\tcell: Cell<TData, unknown>;\n\ttable: Table<TableRecord>;\n\trowIndex: number;\n\tcolumnId: string;\n\tisEditing: boolean;\n\tisFocused: boolean;\n\tisSelected: boolean;\n}\n\nexport function TableCellWrapper<TData>({\n\ttable,\n\tcell,\n\trowIndex,\n\tcolumnId,\n\tisEditing,\n\tisFocused,\n\tisSelected,\n\tclassName,\n\tonClick: onClickProp,\n\tonKeyDown: onKeyDownProp,\n\t...props\n}: TableCellWrapperProps<TData>) {\n\tconst { getUpdate } = useUpdateCellStore();\n\n\tconst meta = table.options.meta;\n\n\t// Check if this cell has a pending update\n\tconst rowData = cell.row.original as Record<string, unknown>;\n\tconst hasUpdate = !!getUpdate(rowData, columnId, table.options.meta?.editScope);\n\n\tconst onClick = useCallback(\n\t\t(event: MouseEvent<HTMLDivElement>) => {\n\t\t\tif (!isEditing) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClickProp?.(event);\n\t\t\t\tif (isFocused) {\n\t\t\t\t\tmeta?.onCellEditingStart?.(rowIndex, columnId);\n\t\t\t\t} else {\n\t\t\t\t\tmeta?.onCellClick?.(rowIndex, columnId, event);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[meta, rowIndex, columnId, isEditing, isFocused, onClickProp],\n\t);\n\n\tconst onContextMenu = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (!isEditing) {\n\t\t\t\tmeta?.onCellContextMenu?.(rowIndex, columnId, event);\n\t\t\t}\n\t\t},\n\t\t[meta, rowIndex, columnId, isEditing],\n\t);\n\n\tconst onMouseDown = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (!isEditing) {\n\t\t\t\tmeta?.onCellMouseDown?.(rowIndex, columnId, event);\n\t\t\t}\n\t\t},\n\t\t[meta, rowIndex, columnId, isEditing],\n\t);\n\n\tconst onMouseEnter = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (!isEditing) {\n\t\t\t\tmeta?.onCellMouseEnter?.(rowIndex, columnId, event);\n\t\t\t}\n\t\t},\n\t\t[meta, rowIndex, columnId, isEditing],\n\t);\n\n\tconst onMouseUp = useCallback(() => {\n\t\tif (!isEditing) {\n\t\t\tmeta?.onCellMouseUp?.();\n\t\t}\n\t}, [meta, isEditing]);\n\n\tconst onDoubleClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tif (!isEditing) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tmeta?.onCellDoubleClick?.(rowIndex, columnId);\n\t\t\t}\n\t\t},\n\t\t[meta, rowIndex, columnId, isEditing],\n\t);\n\n\tconst onKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tonKeyDownProp?.(event);\n\n\t\t\tif (event.defaultPrevented) return;\n\n\t\t\tif (\n\t\t\t\tevent.key === \"ArrowUp\" ||\n\t\t\t\tevent.key === \"ArrowDown\" ||\n\t\t\t\tevent.key === \"ArrowLeft\" ||\n\t\t\t\tevent.key === \"ArrowRight\" ||\n\t\t\t\tevent.key === \"Home\" ||\n\t\t\t\tevent.key === \"End\" ||\n\t\t\t\tevent.key === \"PageUp\" ||\n\t\t\t\tevent.key === \"PageDown\" ||\n\t\t\t\tevent.key === \"Tab\"\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isFocused && !isEditing) {\n\t\t\t\tif (event.key === \"F2\" || event.key === \"Enter\") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tmeta?.onCellEditingStart?.(rowIndex, columnId);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (event.key === \" \") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tmeta?.onCellEditingStart?.(rowIndex, columnId);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (event.key.length === 1 && !event.ctrlKey && !event.metaKey) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tmeta?.onCellEditingStart?.(rowIndex, columnId);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[onKeyDownProp, isFocused, isEditing, meta, rowIndex, columnId],\n\t);\n\treturn (\n\t\t<div\n\t\t\trole=\"button\"\n\t\t\tdata-slot=\"grid-cell-wrapper\"\n\t\t\tdata-editing={isEditing ? \"\" : undefined}\n\t\t\tdata-focused={isFocused ? \"\" : undefined}\n\t\t\tdata-selected={isSelected ? \"\" : undefined}\n\t\t\tdata-has-update={hasUpdate ? \"\" : undefined}\n\t\t\ttabIndex={isFocused && !isEditing ? 0 : -1}\n\t\t\tclassName={cn(\n\t\t\t\t\"size-full px-2 py-1.5 text-left text-sm outline-none has-data-[slot=checkbox]:pt-2.5\",\n\t\t\t\t\"**:data-[slot=grid-cell-content]:line-clamp-1\",\n\t\t\t\t{\n\t\t\t\t\t\"ring-1 ring-ring ring-inset\": isFocused,\n\t\t\t\t\t\"bg-primary/10\": isSelected && !isEditing,\n\t\t\t\t\t\"cursor-default\": !isEditing,\n\t\t\t\t\t\"ring-2 ring-primary\": hasUpdate,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={onClick}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\tonDoubleClick={onDoubleClick}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonMouseUp={onMouseUp}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n","\"use client\";\nimport { Badge } from \"@db-studio/ui/badge\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { DatePicker } from \"@db-studio/ui/date-picker\";\nimport { Drawer, DrawerContent } from \"@db-studio/ui/drawer\";\nimport { Input } from \"@db-studio/ui/input\";\nimport { Kbd } from \"@db-studio/ui/kbd\";\nimport { Popover, PopoverAnchor, PopoverContent } from \"@db-studio/ui/popover\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Textarea } from \"@db-studio/ui/textarea\";\nimport type { Cell, Table } from \"@tanstack/react-table\";\nimport {\n\ttype ChangeEvent,\n\ttype ComponentProps,\n\ttype KeyboardEvent,\n\tmemo,\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport { useHotkeys } from \"react-hotkeys-hook\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { formatCellValue } from \"@/utils/format-cell-value\";\nimport { useUpdateCellStore } from \"../stores/update-cell.store\";\nimport { FkDrawerContent } from \"./fk-drawer-content\";\nimport { TableCellWrapper } from \"./table-cell-wrapper\";\n\ninterface CellVariantProps<TData> {\n\tcell: Cell<TData, unknown>;\n\ttable: Table<TableRecord>;\n\trowIndex: number;\n\tcolumnId: string;\n\tisEditing: boolean;\n\tisFocused: boolean;\n\tisSelected: boolean;\n}\n\nexport const TableTextCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate, getUpdate } = useUpdateCellStore();\n\t\tconst rawInitialValue = cell.getValue();\n\t\tconst initialValue = formatCellValue(rawInitialValue);\n\n\t\t// Separate editor value from display value\n\t\tconst [editorValue, setEditorValue] = useState(() => initialValue ?? \"\");\n\t\tconst [open, setOpen] = useState(false);\n\t\tconst textareaRef = useRef<HTMLTextAreaElement>(null);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst meta = table.options.meta;\n\n\t\t// Get the row data and column name for store operations\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\t// Get the current display value from store or use initial value\n\t\tconst pendingUpdate = getUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\tconst displayValue = pendingUpdate\n\t\t\t? formatCellValue(pendingUpdate.newValue)\n\t\t\t: (initialValue ?? \"\");\n\n\t\tconst onSave = useCallback(() => {\n\t\t\t// Update the store with the final value\n\t\t\tsetUpdate(\n\t\t\t\trowData,\n\t\t\t\tcolumnName,\n\t\t\t\teditorValue,\n\t\t\t\trawInitialValue,\n\t\t\t\ttable.options.meta?.editScope,\n\t\t\t);\n\n\t\t\t// Stop editing first, then close the popover\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, editorValue, rawInitialValue, initialValue, columnName, rowData, setUpdate]);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\t// Restore the original value\n\t\t\tsetEditorValue(initialValue ?? \"\");\n\n\t\t\t// Clear this cell's update from the store\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\n\t\t\t// Stop editing first, then close the popover\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, initialValue, columnName, rowData, clearUpdate, editorValue]);\n\n\t\tconst onChange = useCallback(\n\t\t\t(event: ChangeEvent<HTMLTextAreaElement>) => {\n\t\t\t\tconst newValue = event.target.value;\n\t\t\t\tsetEditorValue(newValue);\n\t\t\t},\n\t\t\t[columnName, editorValue, initialValue],\n\t\t);\n\n\t\tconst onOpenChange = useCallback(\n\t\t\t(isOpen: boolean) => {\n\t\t\t\tsetOpen(isOpen);\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\t// When closing, update the store with current value if changed\n\t\t\t\t\tif (editorValue !== initialValue) {\n\t\t\t\t\t\tsetUpdate(\n\t\t\t\t\t\t\trowData,\n\t\t\t\t\t\t\tcolumnName,\n\t\t\t\t\t\t\teditorValue,\n\t\t\t\t\t\t\tinitialValue,\n\t\t\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[meta, editorValue, initialValue, columnName, rowData, setUpdate],\n\t\t);\n\n\t\tconst onOpenAutoFocus: NonNullable<\n\t\t\tComponentProps<typeof PopoverContent>[\"onOpenAutoFocus\"]\n\t\t> = useCallback((event) => {\n\t\t\tevent.preventDefault();\n\t\t\tif (textareaRef.current) {\n\t\t\t\ttextareaRef.current.focus();\n\t\t\t\tconst length = textareaRef.current.value.length;\n\t\t\t\ttextareaRef.current.setSelectionRange(length, length);\n\t\t\t}\n\t\t}, []);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing && !open) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.({\n\t\t\t\t\t\t\tdirection: event.shiftKey ? \"left\" : \"right\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, open, meta],\n\t\t);\n\n\t\tconst onTextareaKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonCancel();\n\t\t\t\t} else if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonSave();\n\t\t\t\t}\n\t\t\t\t// Stop propagation to prevent grid navigation\n\t\t\t\tevent.stopPropagation();\n\t\t\t},\n\t\t\t[onCancel, onSave, editorValue, initialValue],\n\t\t);\n\n\t\tconst onTextareaBlur = useCallback(() => {\n\t\t\t// Update store on blur\n\t\t\tif (editorValue !== initialValue) {\n\t\t\t\tsetUpdate(\n\t\t\t\t\trowData,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\teditorValue,\n\t\t\t\t\tinitialValue,\n\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Stop editing first, then close the popover\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, editorValue, initialValue, columnName, rowData, setUpdate]);\n\n\t\t// Sync open state with isEditing prop and initialize editor value\n\t\tuseEffect(() => {\n\t\t\tif (isEditing && !open) {\n\t\t\t\tsetEditorValue(displayValue);\n\t\t\t\tsetOpen(true);\n\t\t\t} else if (!isEditing && open) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t}, [isEditing, open, displayValue]);\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\tuseHotkeys(\"enter\", () => onSave());\n\t\tuseHotkeys(\"esc\", () => onCancel());\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\topen={open}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t>\n\t\t\t\t<PopoverAnchor asChild>\n\t\t\t\t\t<TableCellWrapper\n\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\tcell={cell}\n\t\t\t\t\t\ttable={table}\n\t\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span data-slot=\"grid-cell-content\">{displayValue}</span>\n\t\t\t\t\t</TableCellWrapper>\n\t\t\t\t</PopoverAnchor>\n\t\t\t\t<PopoverContent\n\t\t\t\t\tdata-grid-cell-editor=\"\"\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tside=\"bottom\"\n\t\t\t\t\tsideOffset={0}\n\t\t\t\t\tclassName=\"w-[400px] rounded-none p-0 gap-0\"\n\t\t\t\t\tonOpenAutoFocus={onOpenAutoFocus}\n\t\t\t\t>\n\t\t\t\t\t<Textarea\n\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\tvalue={editorValue}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\tonKeyDown={onTextareaKeyDown}\n\t\t\t\t\t\tonBlur={onTextareaBlur}\n\t\t\t\t\t\tclassName=\"min-h-[150px] resize-none rounded-none border-0 shadow-none focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Enter text...\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"flex flex-col border-t\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"rounded-none justify-start text-xs py-4 px-2\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal\">⌘↵</Kbd>\n\t\t\t\t\t\t\t<span className=\"ml-1 text-xs\">Save Changes</span>\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"rounded-none justify-start text-xs py-4 px-2\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal\">esc</Kbd>\n\t\t\t\t\t\t\t<span className=\"ml-1 text-xs\">Cancel Changes</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t},\n);\n\nTableTextCell.displayName = \"TableTextCell\";\n\nexport const TableNumberCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate } = useUpdateCellStore();\n\t\tconst initialValue = cell.getValue() as number;\n\n\t\t// Initialize state with initialValue\n\t\tconst [value, setValue] = useState(() => initialValue);\n\t\tconst [open, setOpen] = useState(false);\n\t\tconst inputRef = useRef<HTMLInputElement>(null);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst meta = table.options.meta;\n\n\t\t// Get the row data and column name for store operations\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\tconst onSave = useCallback(() => {\n\t\t\t// Update the store with the final value\n\t\t\tsetUpdate(rowData, columnName, value, initialValue, table.options.meta?.editScope);\n\n\t\t\t// Close the popover\n\t\t\tsetOpen(false);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t}, [meta, value, initialValue, columnName, rowData, setUpdate]);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\t// Restore the original value\n\t\t\tsetValue(initialValue);\n\n\t\t\t// Clear this cell's update from the store\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\n\t\t\tsetOpen(false);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t}, [meta, initialValue, columnName, rowData, clearUpdate, value]);\n\n\t\tconst onChange = useCallback(\n\t\t\t(event: ChangeEvent<HTMLInputElement>) => {\n\t\t\t\tconst newValue = event.target.value;\n\t\t\t\tsetValue(Number(newValue));\n\n\t\t\t\t// Debounced update to store (tracks the change but doesn't save)\n\t\t\t\tsetUpdate(\n\t\t\t\t\trowData,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\tNumber(newValue),\n\t\t\t\t\tinitialValue,\n\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t);\n\t\t\t},\n\t\t\t[columnName, value, initialValue, rowData, setUpdate],\n\t\t);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing && !open) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t// Update store when tabbing away\n\t\t\t\t\t\tif (value !== initialValue) {\n\t\t\t\t\t\t\tsetUpdate(\n\t\t\t\t\t\t\t\trowData,\n\t\t\t\t\t\t\t\tcolumnName,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\tinitialValue,\n\t\t\t\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmeta?.onCellEditingStop?.({\n\t\t\t\t\t\t\tdirection: event.shiftKey ? \"left\" : \"right\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, open, meta, value, initialValue, columnName, rowData, setUpdate],\n\t\t);\n\n\t\tconst onTextInputKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLInputElement>) => {\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonCancel();\n\t\t\t\t} else if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonSave();\n\t\t\t\t}\n\t\t\t\t// Stop propagation to prevent grid navigation\n\t\t\t\tevent.stopPropagation();\n\t\t\t},\n\t\t\t[onCancel, onSave, value, initialValue],\n\t\t);\n\n\t\tconst onTextInputBlur = useCallback(() => {\n\t\t\t// Update store on blur (don't auto-save, just track)\n\t\t\tif (value !== initialValue) {\n\t\t\t\tsetUpdate(rowData, columnName, value, initialValue, table.options.meta?.editScope);\n\t\t\t}\n\t\t\tsetOpen(false);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t}, [meta, value, initialValue, columnName, rowData, setUpdate]);\n\n\t\t// Sync open state with isEditing prop\n\t\tif (isEditing && !open) {\n\t\t\tsetOpen(true);\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\tuseHotkeys(\"enter\", () => onSave());\n\t\tuseHotkeys(\"esc\", () => onCancel());\n\n\t\treturn (\n\t\t\t<TableCellWrapper\n\t\t\t\tref={containerRef}\n\t\t\t\tcell={cell}\n\t\t\t\ttable={table}\n\t\t\t\trowIndex={rowIndex}\n\t\t\t\tcolumnId={columnId}\n\t\t\t\tisEditing={isEditing}\n\t\t\t\tisFocused={isFocused}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t>\n\t\t\t\t<Input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\tvalue={value || \"\"}\n\t\t\t\t\tonChange={(event) => onChange(event as ChangeEvent<HTMLInputElement>)}\n\t\t\t\t\tonKeyDown={(event) => onTextInputKeyDown(event as KeyboardEvent<HTMLInputElement>)}\n\t\t\t\t\tonBlur={onTextInputBlur}\n\t\t\t\t\tclassName=\"size-full rounded-none border-none p-0 shadow-none hover:bg-transparent! focus-visible:ring-0 dark:bg-transparent [&_svg]:hidden\"\n\t\t\t\t/>\n\t\t\t</TableCellWrapper>\n\t\t);\n\t},\n);\n\nTableNumberCell.displayName = \"TableNumberCell\";\n\nexport const TableBooleanCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate, getUpdate } = useUpdateCellStore();\n\t\tconst initialValue = cell.getValue() as boolean | null;\n\t\tconst [selectOpen, setSelectOpen] = useState(false);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst selectTriggerRef = useRef<HTMLButtonElement>(null);\n\t\tconst isEditingRef = useRef(isEditing);\n\t\tconst meta = table.options.meta;\n\n\t\t// Update ref when isEditing changes\n\t\tuseEffect(() => {\n\t\t\tisEditingRef.current = isEditing;\n\t\t}, [isEditing]);\n\n\t\t// Get the row data and column name for store operations\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\t// Get the current value from store or use initial value\n\t\tconst pendingUpdate = getUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\tconst currentValue = pendingUpdate\n\t\t\t? (pendingUpdate.newValue as boolean | null)\n\t\t\t: initialValue;\n\n\t\t// Convert boolean value to string for the select component\n\t\tconst value = useMemo(() => {\n\t\t\tif (currentValue === null || currentValue === undefined) return \"null\";\n\t\t\treturn currentValue ? \"true\" : \"false\";\n\t\t}, [currentValue]);\n\n\t\tconst onValueChange = useCallback(\n\t\t\t(newValue: string) => {\n\t\t\t\t// Convert string value back to boolean or null\n\t\t\t\tlet boolValue: boolean | null;\n\t\t\t\tif (newValue === \"null\") {\n\t\t\t\t\tboolValue = null;\n\t\t\t\t} else {\n\t\t\t\t\tboolValue = newValue === \"true\";\n\t\t\t\t}\n\n\t\t\t\t// Update the store when value changes\n\t\t\t\tsetUpdate(rowData, columnName, boolValue, initialValue, table.options.meta?.editScope);\n\n\t\t\t\t// Close the select and stop editing\n\t\t\t\tsetSelectOpen(false);\n\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t},\n\t\t\t[columnName, rowData, initialValue, setUpdate, meta],\n\t\t);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\t// Clear any pending updates (reverts to initial value)\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\n\t\t\t// Close select and stop editing\n\t\t\tsetSelectOpen(false);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t}, [rowData, columnName, clearUpdate, meta]);\n\n\t\tconst onOpenChange = useCallback(\n\t\t\t(open: boolean) => {\n\t\t\t\tsetSelectOpen(open);\n\n\t\t\t\t// If closing the select, stop editing (but keep the value in store)\n\t\t\t\tif (!open && isEditing) {\n\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, meta],\n\t\t);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing && !selectOpen) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonCancel();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonCancel();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.({\n\t\t\t\t\t\t\tdirection: event.shiftKey ? \"left\" : \"right\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, selectOpen, meta, onCancel],\n\t\t);\n\n\t\t// Auto-open select when entering edit mode, close when exiting\n\t\tuseEffect(() => {\n\t\t\tif (isEditing) {\n\t\t\t\t// Open the select and trigger click\n\t\t\t\tconst openTimer = setTimeout(() => {\n\t\t\t\t\tif (isEditingRef.current) {\n\t\t\t\t\t\tsetSelectOpen(true);\n\t\t\t\t\t\t// Small delay to ensure the trigger is rendered\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (isEditingRef.current) {\n\t\t\t\t\t\t\t\tselectTriggerRef.current?.click();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t\treturn () => {\n\t\t\t\t\tclearTimeout(openTimer);\n\t\t\t\t\t// Cleanup: close select when component unmounts or isEditing changes\n\t\t\t\t\tsetSelectOpen(false);\n\t\t\t\t};\n\t\t\t}\n\t\t}, [isEditing]);\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\t// Display value (use currentValue which includes store updates)\n\t\tconst displayValue =\n\t\t\tcurrentValue === null || currentValue === undefined\n\t\t\t\t? \"NULL\"\n\t\t\t\t: currentValue\n\t\t\t\t\t? \"true\"\n\t\t\t\t\t: \"false\";\n\n\t\treturn (\n\t\t\t<TableCellWrapper\n\t\t\t\tref={containerRef}\n\t\t\t\tcell={cell}\n\t\t\t\ttable={table}\n\t\t\t\trowIndex={rowIndex}\n\t\t\t\tcolumnId={columnId}\n\t\t\t\tisEditing={isEditing}\n\t\t\t\tisFocused={isFocused}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t\tclassName=\"p-0!\"\n\t\t\t>\n\t\t\t\t{isEditing ? (\n\t\t\t\t\t<Select\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tonValueChange={onValueChange}\n\t\t\t\t\t\topen={selectOpen}\n\t\t\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectTrigger\n\t\t\t\t\t\t\tref={selectTriggerRef}\n\t\t\t\t\t\t\tclassName=\"size-full px-2 py-1.5 rounded-none border-none p-0 shadow-none hover:bg-transparent! focus-visible:ring-0 dark:bg-transparent [&_svg]:hidden\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SelectValue />\n\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t<SelectContent\n\t\t\t\t\t\t\tdata-grid-cell-editor=\"\"\n\t\t\t\t\t\t\talignOffset={-8}\n\t\t\t\t\t\t\tsideOffset={-8}\n\t\t\t\t\t\t\tclassName=\"min-w-[calc(var(--radix-select-trigger-width)+16px)]\"\n\t\t\t\t\t\t\tonEscapeKeyDown={onCancel}\n\t\t\t\t\t\t\tonPointerDownOutside={(e) => {\n\t\t\t\t\t\t\t\t// Close the select and keep the value\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tsetSelectOpen(false);\n\t\t\t\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SelectItem value=\"true\">true</SelectItem>\n\t\t\t\t\t\t\t<SelectItem value=\"false\">false</SelectItem>\n\t\t\t\t\t\t\t<SelectItem value=\"null\">NULL</SelectItem>\n\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t</Select>\n\t\t\t\t) : (\n\t\t\t\t\t<span className=\"flex items-center size-full px-2 py-1.5\">{displayValue}</span>\n\t\t\t\t)}\n\t\t\t</TableCellWrapper>\n\t\t);\n\t},\n);\n\nTableBooleanCell.displayName = \"TableBooleanCell\";\n\nexport const TableEnumCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate, getUpdate } = useUpdateCellStore();\n\t\tconst initialValue = cell.getValue() as string | null;\n\t\tconst [selectOpen, setSelectOpen] = useState(false);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst selectTriggerRef = useRef<HTMLButtonElement>(null);\n\t\tconst isEditingRef = useRef(isEditing);\n\t\tconst meta = table.options.meta;\n\t\tconst enumValues = cell.column.columnDef.meta?.enumValues as string[] | undefined;\n\n\t\t// Update ref when isEditing changes\n\t\tuseEffect(() => {\n\t\t\tisEditingRef.current = isEditing;\n\t\t}, [isEditing]);\n\n\t\t// Get the row data and column name for store operations\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\t// Get the current value from store or use initial value\n\t\tconst pendingUpdate = getUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\tconst currentValue = pendingUpdate\n\t\t\t? (pendingUpdate.newValue as string | null)\n\t\t\t: initialValue;\n\n\t\tconst onValueChange = useCallback(\n\t\t\t(newValue: string) => {\n\t\t\t\t// Convert \"null\" string to actual null, otherwise use the enum value\n\t\t\t\tconst enumValue: string | null = newValue === \"null\" ? null : newValue;\n\t\t\t\tsetUpdate(rowData, columnName, enumValue, initialValue, table.options.meta?.editScope);\n\t\t\t\tsetSelectOpen(false);\n\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t},\n\t\t\t[columnName, rowData, initialValue, setUpdate, meta],\n\t\t);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\t// Clear any pending updates (reverts to initial value)\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\n\t\t\t// Close select and stop editing\n\t\t\tsetSelectOpen(false);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t}, [rowData, columnName, clearUpdate, meta]);\n\n\t\tconst onOpenChange = useCallback(\n\t\t\t(open: boolean) => {\n\t\t\t\tsetSelectOpen(open);\n\n\t\t\t\t// If closing the select, stop editing (but keep the value in store)\n\t\t\t\tif (!open && isEditing) {\n\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, meta],\n\t\t);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing && !selectOpen) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonCancel();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonCancel();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.({\n\t\t\t\t\t\t\tdirection: event.shiftKey ? \"left\" : \"right\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, selectOpen, meta, onCancel],\n\t\t);\n\n\t\t// Auto-open select when entering edit mode, close when exiting\n\t\tuseEffect(() => {\n\t\t\tif (isEditing) {\n\t\t\t\t// Open the select and trigger click\n\t\t\t\tconst openTimer = setTimeout(() => {\n\t\t\t\t\tif (isEditingRef.current) {\n\t\t\t\t\t\tsetSelectOpen(true);\n\t\t\t\t\t\t// Small delay to ensure the trigger is rendered\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (isEditingRef.current) {\n\t\t\t\t\t\t\t\tselectTriggerRef.current?.click();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t\treturn () => {\n\t\t\t\t\tclearTimeout(openTimer);\n\t\t\t\t\t// Cleanup: close select when component unmounts or isEditing changes\n\t\t\t\t\tsetSelectOpen(false);\n\t\t\t\t};\n\t\t\t}\n\t\t}, [isEditing]);\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\t// Display value (use currentValue which includes store updates)\n\t\tconst displayValue =\n\t\t\tcurrentValue === null || currentValue === undefined ? \"NULL\" : currentValue;\n\n\t\treturn (\n\t\t\t<TableCellWrapper\n\t\t\t\tref={containerRef}\n\t\t\t\tcell={cell}\n\t\t\t\ttable={table}\n\t\t\t\trowIndex={rowIndex}\n\t\t\t\tcolumnId={columnId}\n\t\t\t\tisEditing={isEditing}\n\t\t\t\tisFocused={isFocused}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t\tclassName=\"p-0!\"\n\t\t\t>\n\t\t\t\t{isEditing ? (\n\t\t\t\t\t<Select\n\t\t\t\t\t\tvalue={currentValue === null ? \"null\" : currentValue}\n\t\t\t\t\t\tonValueChange={onValueChange}\n\t\t\t\t\t\topen={selectOpen}\n\t\t\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectTrigger\n\t\t\t\t\t\t\tref={selectTriggerRef}\n\t\t\t\t\t\t\tclassName=\"size-full px-2 py-1.5 rounded-none border-none p-0 shadow-none hover:bg-transparent! focus-visible:ring-0 dark:bg-transparent [&_svg]:hidden\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SelectValue />\n\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t<SelectContent\n\t\t\t\t\t\t\tdata-grid-cell-editor=\"\"\n\t\t\t\t\t\t\talignOffset={-8}\n\t\t\t\t\t\t\tsideOffset={-8}\n\t\t\t\t\t\t\tclassName=\"min-w-[calc(var(--radix-select-trigger-width)+16px)]\"\n\t\t\t\t\t\t\tonEscapeKeyDown={onCancel}\n\t\t\t\t\t\t\tonPointerDownOutside={(e) => {\n\t\t\t\t\t\t\t\t// Close the select and keep the value\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tsetSelectOpen(false);\n\t\t\t\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{enumValues?.map((enumValue) => (\n\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\tkey={enumValue}\n\t\t\t\t\t\t\t\t\tvalue={enumValue}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{enumValue}\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t<SelectItem value=\"null\">NULL</SelectItem>\n\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t</Select>\n\t\t\t\t) : (\n\t\t\t\t\t<span className=\"flex items-center size-full px-2 py-1.5 truncate\">\n\t\t\t\t\t\t{displayValue}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</TableCellWrapper>\n\t\t);\n\t},\n);\n\nTableEnumCell.displayName = \"TableEnumCell\";\n\nexport const TableDateCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate, getUpdate } = useUpdateCellStore();\n\t\tconst initialValue = cell.getValue() as string | null;\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst meta = table.options.meta;\n\n\t\t// Get the row data and column name for store operations\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\t// Get the current value from store or use initial value\n\t\tconst pendingUpdate = getUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\tconst currentValue = pendingUpdate\n\t\t\t? (pendingUpdate.newValue as string | null)\n\t\t\t: initialValue;\n\n\t\tconst onDateChange = useCallback(\n\t\t\t(date: Date | null | undefined) => {\n\t\t\t\t// Convert Date to ISO string for storage (or null if undefined)\n\t\t\t\tconst dateString = date ? date.toISOString() : null;\n\t\t\t\tsetUpdate(\n\t\t\t\t\trowData,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\tdateString,\n\t\t\t\t\tinitialValue,\n\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t);\n\n\t\t\t\t// Close the date picker and stop editing\n\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t},\n\t\t\t[columnName, initialValue, rowData, setUpdate, meta],\n\t\t);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\t// Clear any pending updates (reverts to initial value)\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\n\t\t\t// Stop editing\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t}, [rowData, columnName, clearUpdate, meta, currentValue, initialValue]);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonCancel();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tonCancel();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, onCancel],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\treturn (\n\t\t\t<TableCellWrapper\n\t\t\t\tref={containerRef}\n\t\t\t\tcell={cell}\n\t\t\t\ttable={table}\n\t\t\t\trowIndex={rowIndex}\n\t\t\t\tcolumnId={columnId}\n\t\t\t\tisEditing={isEditing}\n\t\t\t\tisFocused={isFocused}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t\tclassName=\"p-0!\"\n\t\t\t>\n\t\t\t\t<DatePicker\n\t\t\t\t\tisFormatted={false}\n\t\t\t\t\ticon={false}\n\t\t\t\t\tvalue={currentValue ? new Date(currentValue) : undefined}\n\t\t\t\t\tonChange={onDateChange}\n\t\t\t\t\tplaceholder=\"Pick a date\"\n\t\t\t\t\tclassName=\"size-full px-2! py-1.5! rounded-none border-none p-0 shadow-none hover:bg-transparent! focus-visible:ring-0 dark:bg-transparent [&_svg]:hidden\"\n\t\t\t\t/>\n\t\t\t</TableCellWrapper>\n\t\t);\n\t},\n);\n\nTableDateCell.displayName = \"TableDateCell\";\n\nexport const TableJsonCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate, getUpdate } = useUpdateCellStore();\n\t\tconst rawValue = cell.getValue();\n\n\t\t// If the value is a string (which shouldn't happen but might due to pg driver issues),\n\t\t// parse it to an object\n\t\tlet initialValue: Record<string, unknown>;\n\t\tif (typeof rawValue === \"string\") {\n\t\t\ttry {\n\t\t\t\tinitialValue = JSON.parse(rawValue) as Record<string, unknown>;\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`TableJsonCell ${columnId}: initialValue was a string, parsed it to object`,\n\t\t\t\t\tinitialValue,\n\t\t\t\t);\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`TableJsonCell ${columnId}: Failed to parse initialValue string`,\n\t\t\t\t\trawValue,\n\t\t\t\t\te,\n\t\t\t\t);\n\t\t\t\tinitialValue = {};\n\t\t\t}\n\t\t} else {\n\t\t\tinitialValue = rawValue as Record<string, unknown>;\n\t\t}\n\n\t\t// Separate editor value (formatted) from display value (compact)\n\t\tconst [editorValue, setEditorValue] = useState(\n\t\t\t() => JSON.stringify(initialValue, null, 2) ?? \"\",\n\t\t);\n\t\tconst [open, setOpen] = useState(false);\n\t\tconst textareaRef = useRef<HTMLTextAreaElement>(null);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst meta = table.options.meta;\n\n\t\t// Get the row data and column name for store operations\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\t// Get the current display value from store or use initial value (compact format)\n\t\tconst pendingUpdate = getUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\tconst currentJsonValue = pendingUpdate\n\t\t\t? (pendingUpdate.newValue as Record<string, unknown>)\n\t\t\t: initialValue;\n\t\tconst displayValue = JSON.stringify(currentJsonValue);\n\n\t\tconst onSave = useCallback(() => {\n\t\t\ttry {\n\t\t\t\t// Parse the JSON string to validate and store as object\n\t\t\t\tconst parsedValue = JSON.parse(editorValue);\n\t\t\t\t// Update the store with the parsed value\n\t\t\t\tsetUpdate(\n\t\t\t\t\trowData,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\tparsedValue,\n\t\t\t\t\tinitialValue,\n\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Invalid JSON:\", error);\n\t\t\t\t// Optionally show an error message to the user\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Stop editing first, then close the popover\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, editorValue, initialValue, columnName, rowData, setUpdate]);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\t// Restore the original value (formatted)\n\t\t\tsetEditorValue(JSON.stringify(initialValue, null, 2) ?? \"\");\n\n\t\t\t// Clear this cell's update from the store\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\n\t\t\t// Stop editing first, then close the popover\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, initialValue, columnName, rowData, clearUpdate, editorValue]);\n\n\t\tconst onChange = useCallback(\n\t\t\t(event: ChangeEvent<HTMLTextAreaElement>) => {\n\t\t\t\tconst newValue = event.target.value;\n\t\t\t\tsetEditorValue(newValue);\n\t\t\t},\n\t\t\t[columnName, editorValue, initialValue],\n\t\t);\n\n\t\tconst onOpenChange = useCallback(\n\t\t\t(isOpen: boolean) => {\n\t\t\t\tsetOpen(isOpen);\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\t// When closing, update the store with current value if valid JSON\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst parsedValue = JSON.parse(editorValue);\n\t\t\t\t\t\tif (JSON.stringify(parsedValue) !== JSON.stringify(initialValue)) {\n\t\t\t\t\t\t\tsetUpdate(\n\t\t\t\t\t\t\t\trowData,\n\t\t\t\t\t\t\t\tcolumnName,\n\t\t\t\t\t\t\t\tparsedValue,\n\t\t\t\t\t\t\t\tinitialValue,\n\t\t\t\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(\"Invalid JSON on close:\", error);\n\t\t\t\t\t}\n\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[meta, editorValue, initialValue, columnName, rowData, setUpdate],\n\t\t);\n\n\t\tconst onOpenAutoFocus: NonNullable<\n\t\t\tComponentProps<typeof PopoverContent>[\"onOpenAutoFocus\"]\n\t\t> = useCallback((event) => {\n\t\t\tevent.preventDefault();\n\t\t\tif (textareaRef.current) {\n\t\t\t\ttextareaRef.current.focus();\n\t\t\t\tconst length = textareaRef.current.value.length;\n\t\t\t\ttextareaRef.current.setSelectionRange(length, length);\n\t\t\t}\n\t\t}, []);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing && !open) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.({\n\t\t\t\t\t\t\tdirection: event.shiftKey ? \"left\" : \"right\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, open, meta],\n\t\t);\n\n\t\tconst onTextareaKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonCancel();\n\t\t\t\t} else if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonSave();\n\t\t\t\t}\n\t\t\t\t// Stop propagation to prevent grid navigation\n\t\t\t\tevent.stopPropagation();\n\t\t\t},\n\t\t\t[onCancel, onSave, editorValue, initialValue],\n\t\t);\n\n\t\tconst onTextareaBlur = useCallback(() => {\n\t\t\t// Update store on blur if valid JSON\n\t\t\ttry {\n\t\t\t\tconst parsedValue = JSON.parse(editorValue);\n\t\t\t\tif (JSON.stringify(parsedValue) !== JSON.stringify(initialValue)) {\n\t\t\t\t\tsetUpdate(\n\t\t\t\t\t\trowData,\n\t\t\t\t\t\tcolumnName,\n\t\t\t\t\t\tparsedValue,\n\t\t\t\t\t\tinitialValue,\n\t\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(\"Invalid JSON on blur:\", error);\n\t\t\t}\n\t\t\t// Stop editing first, then close the popover\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, editorValue, initialValue, columnName, rowData, setUpdate]);\n\n\t\t// Sync open state with isEditing prop and initialize editor value\n\t\tuseEffect(() => {\n\t\t\tif (isEditing && !open) {\n\t\t\t\t// Initialize editor with formatted JSON\n\t\t\t\tsetEditorValue(JSON.stringify(currentJsonValue, null, 2));\n\t\t\t\tsetOpen(true);\n\t\t\t} else if (!isEditing && open) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t}, [isEditing, open, currentJsonValue]);\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\tuseHotkeys(\"enter\", () => onSave());\n\t\tuseHotkeys(\"esc\", () => onCancel());\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\topen={open}\n\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t>\n\t\t\t\t<PopoverAnchor asChild>\n\t\t\t\t\t<TableCellWrapper\n\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\tcell={cell}\n\t\t\t\t\t\ttable={table}\n\t\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span data-slot=\"grid-cell-content\">{displayValue}</span>\n\t\t\t\t\t</TableCellWrapper>\n\t\t\t\t</PopoverAnchor>\n\t\t\t\t<PopoverContent\n\t\t\t\t\tdata-grid-cell-editor=\"\"\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tside=\"bottom\"\n\t\t\t\t\tsideOffset={0}\n\t\t\t\t\tclassName=\"w-[400px] rounded-none p-0 gap-0\"\n\t\t\t\t\tonOpenAutoFocus={onOpenAutoFocus}\n\t\t\t\t>\n\t\t\t\t\t<Textarea\n\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\tvalue={editorValue}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\tonKeyDown={onTextareaKeyDown}\n\t\t\t\t\t\tonBlur={onTextareaBlur}\n\t\t\t\t\t\tclassName=\"min-h-[150px] resize-none rounded-none border-0 shadow-none focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Enter JSON...\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"flex flex-col border-t\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"rounded-none justify-start text-xs py-4 px-2\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal\">⌘↵</Kbd>\n\t\t\t\t\t\t\t<span className=\"ml-1 text-xs\">Save Changes</span>\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tclassName=\"rounded-none justify-start text-xs py-4 px-2\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal\">esc</Kbd>\n\t\t\t\t\t\t\t<span className=\"ml-1 text-xs\">Cancel Changes</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t},\n);\n\nTableJsonCell.displayName = \"TableJsonCell\";\n\nexport const TableForeignKeyCell = memo(\n\t({\n\t\tcell,\n\t\ttable,\n\t\trowIndex,\n\t\tcolumnId,\n\t\tisEditing,\n\t\tisFocused,\n\t\tisSelected,\n\t}: CellVariantProps<TableRecord>) => {\n\t\tconst { setUpdate, clearUpdate, getUpdate } = useUpdateCellStore();\n\t\tconst rawInitialValue = cell.getValue();\n\t\tconst initialValue = formatCellValue(rawInitialValue);\n\n\t\tconst [editorValue, setEditorValue] = useState(() => initialValue ?? \"\");\n\t\tconst [open, setOpen] = useState(false);\n\t\tconst [drawerOpen, setDrawerOpen] = useState(false);\n\t\tconst textareaRef = useRef<HTMLTextAreaElement>(null);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\t\tconst meta = table.options.meta;\n\t\tconst referencedTable = cell.column.columnDef.meta?.referencedTable;\n\n\t\tconst rowData = cell.row.original as Record<string, unknown>;\n\t\tconst columnName = columnId;\n\n\t\tconst pendingUpdate = getUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\tconst displayValue = pendingUpdate\n\t\t\t? formatCellValue(pendingUpdate.newValue)\n\t\t\t: (initialValue ?? \"\");\n\n\t\tconst onSave = useCallback(() => {\n\t\t\tsetUpdate(\n\t\t\t\trowData,\n\t\t\t\tcolumnName,\n\t\t\t\teditorValue,\n\t\t\t\trawInitialValue,\n\t\t\t\ttable.options.meta?.editScope,\n\t\t\t);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, editorValue, rawInitialValue, columnName, rowData, setUpdate]);\n\n\t\tconst onCancel = useCallback(() => {\n\t\t\tsetEditorValue(initialValue ?? \"\");\n\t\t\tclearUpdate(rowData, columnName, table.options.meta?.editScope);\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, initialValue, columnName, rowData, clearUpdate]);\n\n\t\tconst onChange = useCallback((event: ChangeEvent<HTMLTextAreaElement>) => {\n\t\t\tsetEditorValue(event.target.value);\n\t\t}, []);\n\n\t\tconst onOpenChange = useCallback(\n\t\t\t(isOpen: boolean) => {\n\t\t\t\tsetOpen(isOpen);\n\t\t\t\tif (!isOpen) {\n\t\t\t\t\tif (editorValue !== initialValue) {\n\t\t\t\t\t\tsetUpdate(\n\t\t\t\t\t\t\trowData,\n\t\t\t\t\t\t\tcolumnName,\n\t\t\t\t\t\t\teditorValue,\n\t\t\t\t\t\t\tinitialValue,\n\t\t\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[meta, editorValue, initialValue, columnName, rowData, setUpdate],\n\t\t);\n\n\t\tconst onOpenAutoFocus: NonNullable<\n\t\t\tComponentProps<typeof PopoverContent>[\"onOpenAutoFocus\"]\n\t\t> = useCallback((event) => {\n\t\t\tevent.preventDefault();\n\t\t\tif (textareaRef.current) {\n\t\t\t\ttextareaRef.current.focus();\n\t\t\t\tconst length = textareaRef.current.value.length;\n\t\t\t\ttextareaRef.current.setSelectionRange(length, length);\n\t\t\t}\n\t\t}, []);\n\n\t\tconst onWrapperKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\t\tif (isEditing && !open) {\n\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.();\n\t\t\t\t\t} else if (event.key === \"Tab\") {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tmeta?.onCellEditingStop?.({\n\t\t\t\t\t\t\tdirection: event.shiftKey ? \"left\" : \"right\",\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t[isEditing, open, meta],\n\t\t);\n\n\t\tconst onTextareaKeyDown = useCallback(\n\t\t\t(event: KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonCancel();\n\t\t\t\t} else if (event.key === \"Enter\" && (event.ctrlKey || event.metaKey)) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonSave();\n\t\t\t\t}\n\t\t\t\tevent.stopPropagation();\n\t\t\t},\n\t\t\t[onCancel, onSave],\n\t\t);\n\n\t\tconst onTextareaBlur = useCallback(() => {\n\t\t\tif (editorValue !== initialValue) {\n\t\t\t\tsetUpdate(\n\t\t\t\t\trowData,\n\t\t\t\t\tcolumnName,\n\t\t\t\t\teditorValue,\n\t\t\t\t\tinitialValue,\n\t\t\t\t\ttable.options.meta?.editScope,\n\t\t\t\t);\n\t\t\t}\n\t\t\tmeta?.onCellEditingStop?.();\n\t\t\tsetOpen(false);\n\t\t}, [meta, editorValue, initialValue, columnName, rowData, setUpdate]);\n\n\t\tuseEffect(() => {\n\t\t\tif (isEditing && !open) {\n\t\t\t\tsetEditorValue(displayValue);\n\t\t\t\tsetOpen(true);\n\t\t\t} else if (!isEditing && open) {\n\t\t\t\tsetOpen(false);\n\t\t\t}\n\t\t}, [isEditing, open, displayValue]);\n\n\t\tuseEffect(() => {\n\t\t\tif (isFocused && !isEditing && !meta?.isScrolling && containerRef.current) {\n\t\t\t\tcontainerRef.current.focus();\n\t\t\t}\n\t\t}, [isFocused, isEditing, meta?.isScrolling]);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Popover\n\t\t\t\t\topen={open}\n\t\t\t\t\tonOpenChange={onOpenChange}\n\t\t\t\t>\n\t\t\t\t\t<PopoverAnchor asChild>\n\t\t\t\t\t\t<TableCellWrapper\n\t\t\t\t\t\t\tref={containerRef}\n\t\t\t\t\t\t\tcell={cell}\n\t\t\t\t\t\t\ttable={table}\n\t\t\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\tonKeyDown={onWrapperKeyDown}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{displayValue !== \"\" && (\n\t\t\t\t\t\t\t\t<span className=\"flex items-center gap-1.5 size-full overflow-hidden\">\n\t\t\t\t\t\t\t\t\t{referencedTable && (\n\t\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"shrink-0 cursor-pointer hover:bg-muted\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\t\tsetDrawerOpen(true);\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{referencedTable}\n\t\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<span className=\"truncate text-muted-foreground\">{displayValue}</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</TableCellWrapper>\n\t\t\t\t\t</PopoverAnchor>\n\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\tdata-grid-cell-editor=\"\"\n\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\tside=\"bottom\"\n\t\t\t\t\t\tsideOffset={0}\n\t\t\t\t\t\tclassName=\"w-[400px] rounded-none p-0 gap-0\"\n\t\t\t\t\t\tonOpenAutoFocus={onOpenAutoFocus}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Textarea\n\t\t\t\t\t\t\tref={textareaRef}\n\t\t\t\t\t\t\tvalue={editorValue}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tonKeyDown={onTextareaKeyDown}\n\t\t\t\t\t\t\tonBlur={onTextareaBlur}\n\t\t\t\t\t\t\tclassName=\"min-h-[150px] resize-none rounded-none border-0 shadow-none focus-visible:ring-0\"\n\t\t\t\t\t\t\tplaceholder=\"Enter value...\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className=\"flex flex-col border-t\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\tclassName=\"rounded-none justify-start text-xs py-4 px-2\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal\">⌘↵</Kbd>\n\t\t\t\t\t\t\t\t<span className=\"ml-1 text-xs\">Save Changes</span>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\tclassName=\"rounded-none justify-start text-xs py-4 px-2\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal\">esc</Kbd>\n\t\t\t\t\t\t\t\t<span className=\"ml-1 text-xs\">Cancel Changes</span>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PopoverContent>\n\t\t\t\t</Popover>\n\t\t\t\t<Drawer\n\t\t\t\t\topen={drawerOpen}\n\t\t\t\t\tonOpenChange={setDrawerOpen}\n\t\t\t\t>\n\t\t\t\t\t<DrawerContent className=\"h-[70vh]\">\n\t\t\t\t\t\t{referencedTable && (\n\t\t\t\t\t\t\t<FkDrawerContent\n\t\t\t\t\t\t\t\treferencedTable={referencedTable}\n\t\t\t\t\t\t\t\treferencedColumn={cell.column.columnDef.meta?.referencedColumn ?? \"id\"}\n\t\t\t\t\t\t\t\tfkValue={displayValue}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DrawerContent>\n\t\t\t\t</Drawer>\n\t\t\t</>\n\t\t);\n\t},\n);\n\nTableForeignKeyCell.displayName = \"TableForeignKeyCell\";\n","import type { Cell, Table } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { CellVariant, TableRecord } from \"@/types/table.type\";\nimport {\n\tTableBooleanCell,\n\tTableDateCell,\n\tTableEnumCell,\n\tTableForeignKeyCell,\n\tTableJsonCell,\n\tTableNumberCell,\n\tTableTextCell,\n} from \"./table-cell-variant\";\n\nexport const TableCell = ({\n\tcell,\n\ttable,\n}: {\n\tcell: Cell<TableRecord, unknown>;\n\ttable: Table<TableRecord>;\n}) => {\n\tconst meta = table.options.meta;\n\n\t// Display position within the current (possibly sorted/filtered) row model.\n\t// Memoized on the row-model identity + this row's data so the O(N) scan runs\n\t// at most once per render pass per row model rather than on every cell render.\n\tconst rows = table.getRowModel().rows;\n\tconst rowIndex = useMemo(() => {\n\t\tconst displayRowIndex = rows.findIndex((row) => row.original === cell.row.original);\n\t\treturn displayRowIndex >= 0 ? displayRowIndex : cell.row.index;\n\t}, [rows, cell.row.original, cell.row.index]);\n\tconst columnId = cell.column.id;\n\n\tconst isFocused =\n\t\tmeta?.focusedCell?.rowIndex === rowIndex && meta?.focusedCell?.columnId === columnId;\n\tconst isEditing =\n\t\tmeta?.editingCell?.rowIndex === rowIndex && meta?.editingCell?.columnId === columnId;\n\tconst isSelected = meta?.getIsCellSelected?.(rowIndex, columnId) ?? false;\n\n\tconst cellVariant = cell.column.columnDef.meta?.variant as CellVariant | undefined;\n\tconst isForeignKey = cell.column.columnDef.meta?.isForeignKey;\n\tconst referencedTable = cell.column.columnDef.meta?.referencedTable;\n\n\tif (isForeignKey && referencedTable) {\n\t\treturn (\n\t\t\t<TableForeignKeyCell\n\t\t\t\tcell={cell}\n\t\t\t\ttable={table}\n\t\t\t\trowIndex={rowIndex}\n\t\t\t\tcolumnId={columnId}\n\t\t\t\tisEditing={isEditing}\n\t\t\t\tisFocused={isFocused}\n\t\t\t\tisSelected={isSelected}\n\t\t\t/>\n\t\t);\n\t}\n\n\tswitch (cellVariant) {\n\t\tcase \"text\":\n\t\t\treturn (\n\t\t\t\t<TableTextCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"boolean\":\n\t\t\treturn (\n\t\t\t\t<TableBooleanCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"number\":\n\t\t\treturn (\n\t\t\t\t<TableNumberCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"enum\":\n\t\t\treturn (\n\t\t\t\t<TableEnumCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"date\":\n\t\t\treturn (\n\t\t\t\t<TableDateCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"json\":\n\t\t\t// return a json editor\n\t\t\treturn (\n\t\t\t\t<TableJsonCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tcase \"array\":\n\t\t\treturn (\n\t\t\t\t<TableTextCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t\tdefault:\n\t\t\treturn (\n\t\t\t\t<TableTextCell\n\t\t\t\t\tcell={cell}\n\t\t\t\t\ttable={table}\n\t\t\t\t\trowIndex={rowIndex}\n\t\t\t\t\tcolumnId={columnId}\n\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t);\n\t}\n};\n","import { Checkbox } from \"@db-studio/ui/checkbox\";\nimport type { ColumnDef, Row, Table } from \"@tanstack/react-table\";\nimport type { TableRecord } from \"@/types/table.type\";\n\nexport const TableSelector = (): ColumnDef<TableRecord, unknown> => ({\n\tid: \"select\",\n\taccessorKey: \"select\",\n\theader: ({ table }: { table: Table<TableRecord> }) => (\n\t\t<div className=\"w-full h-full flex items-center justify-center\">\n\t\t\t<Checkbox\n\t\t\t\tchecked={table.getIsAllRowsSelected()}\n\t\t\t\tonCheckedChange={() => table.toggleAllRowsSelected()}\n\t\t\t/>\n\t\t</div>\n\t),\n\tcell: ({ row }: { row: Row<TableRecord> }) => (\n\t\t<div className=\"w-full h-full flex items-center justify-center\">\n\t\t\t<Checkbox\n\t\t\t\tchecked={row.getIsSelected()}\n\t\t\t\tonCheckedChange={() => row.toggleSelected()}\n\t\t\t/>\n\t\t</div>\n\t),\n\tsize: 20,\n\tenableSorting: false,\n});\n","import type { ColumnInfoSchemaType } from \"@db-studio/shared/types\";\nimport {\n\ttype ColumnDef,\n\tgetCoreRowModel,\n\tgetSortedRowModel,\n\tuseReactTable,\n} from \"@tanstack/react-table\";\nimport { useQueryState } from \"nuqs\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { CONSTANTS } from \"@/utils/constants\";\nimport { TableCell } from \"../components/table-cell\";\nimport { TableSelector } from \"../components/table-selector\";\n\nexport const useTableModel = ({\n\ttableName,\n\ttableCols,\n\ttableDataRows,\n}: {\n\ttableName: string;\n\ttableCols?: ColumnInfoSchemaType[];\n\ttableDataRows: TableRecord[];\n}) => {\n\tconst [columnName] = useQueryState(CONSTANTS.COLUMN_NAME);\n\tconst [order] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.ORDER);\n\n\tconst [rowSelection, setRowSelection] = useState<Record<string, boolean>>({});\n\tconst [columnSizing, setColumnSizing] = useState<Record<string, number>>({});\n\tconst [focusedCell, setFocusedCell] = useState<{\n\t\trowIndex: number;\n\t\tcolumnId: string;\n\t} | null>(null);\n\tconst [editingCell, setEditingCell] = useState<{\n\t\trowIndex: number;\n\t\tcolumnId: string;\n\t} | null>(null);\n\n\tconst selectorColumn = useMemo(() => TableSelector(), []);\n\n\tconst columns = useMemo<ColumnDef<TableRecord, unknown>[]>(\n\t\t() => [\n\t\t\tselectorColumn,\n\t\t\t...(tableCols?.map((col) => ({\n\t\t\t\taccessorKey: col.columnName,\n\t\t\t\theader: col.columnName,\n\t\t\t\tmeta: {\n\t\t\t\t\tvariant: col.enumValues ? \"enum\" : col.dataType,\n\t\t\t\t\tisPrimaryKey: col.isPrimaryKey,\n\t\t\t\t\tisForeignKey: col.isForeignKey,\n\t\t\t\t\treferencedTable: col.referencedTable,\n\t\t\t\t\treferencedColumn: col.referencedColumn,\n\t\t\t\t\tenumValues: col.enumValues,\n\t\t\t\t\tdataTypeLabel: col.dataTypeLabel,\n\t\t\t\t},\n\t\t\t\tsize: (col.columnName.length + (col.dataTypeLabel?.length || 0)) * 5 + 100,\n\t\t\t\tminSize: 100,\n\t\t\t\tmaxSize: 500,\n\t\t\t})) || []),\n\t\t],\n\t\t[tableCols, selectorColumn],\n\t);\n\n\tuseEffect(() => {\n\t\tsetRowSelection({});\n\t}, [tableName]);\n\n\tconst sorting = useMemo(() => {\n\t\tif (columnName && order) {\n\t\t\treturn [{ id: columnName, desc: order === \"desc\" }];\n\t\t}\n\t\treturn [];\n\t}, [columnName, order]);\n\n\tconst handleCellClick = useCallback((rowIndex: number, columnId: string) => {\n\t\tsetFocusedCell({ rowIndex, columnId });\n\t}, []);\n\n\tconst handleCellDoubleClick = useCallback((rowIndex: number, columnId: string) => {\n\t\tsetEditingCell({ rowIndex, columnId });\n\t}, []);\n\n\tconst handleCellEditingStart = useCallback((rowIndex: number, columnId: string) => {\n\t\tsetEditingCell({ rowIndex, columnId });\n\t}, []);\n\n\tconst handleCellEditingStop = useCallback(() => {\n\t\tsetEditingCell(null);\n\t}, []);\n\n\tconst handleDataUpdate = useCallback(() => {}, []);\n\tconst getIsCellSelected = useCallback(() => false, []);\n\n\tconst tableMeta = useMemo(\n\t\t() => ({\n\t\t\teditScope: tableName,\n\t\t\tfocusedCell,\n\t\t\teditingCell,\n\t\t\tonCellClick: handleCellClick,\n\t\t\tonCellDoubleClick: handleCellDoubleClick,\n\t\t\tonCellEditingStart: handleCellEditingStart,\n\t\t\tonCellEditingStop: handleCellEditingStop,\n\t\t\tonDataUpdate: handleDataUpdate,\n\t\t\tgetIsCellSelected,\n\t\t}),\n\t\t[\n\t\t\ttableName,\n\t\t\tfocusedCell,\n\t\t\teditingCell,\n\t\t\thandleCellClick,\n\t\t\thandleCellDoubleClick,\n\t\t\thandleCellEditingStart,\n\t\t\thandleCellEditingStop,\n\t\t\thandleDataUpdate,\n\t\t\tgetIsCellSelected,\n\t\t],\n\t);\n\n\tconst table = useReactTable({\n\t\tdata: tableDataRows,\n\t\tcolumns,\n\t\tdefaultColumn: {\n\t\t\tcell: TableCell,\n\t\t\tsize: 50,\n\t\t\tminSize: 100,\n\t\t\tmaxSize: 500,\n\t\t},\n\t\tgetCoreRowModel: getCoreRowModel(),\n\t\tgetSortedRowModel: getSortedRowModel(),\n\t\tstate: {\n\t\t\tsorting,\n\t\t\trowSelection,\n\t\t\tcolumnSizing,\n\t\t},\n\t\tmanualSorting: false,\n\t\tenableRowSelection: true,\n\t\tenableMultiRowSelection: true,\n\t\tenableColumnResizing: true,\n\t\tcolumnResizeMode: \"onChange\",\n\t\tonRowSelectionChange: setRowSelection,\n\t\tonColumnSizingChange: setColumnSizing,\n\t\tmeta: tableMeta,\n\t});\n\n\treturn {\n\t\ttable,\n\t\tselectedRows: table.getSelectedRowModel().rows,\n\t\tsetRowSelection,\n\t};\n};\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","function _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nexport { _objectWithoutPropertiesLoose as default };","import _extends from \"@babel/runtime/helpers/extends\";\nimport { createContext, useContext, useReducer } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar initialState = {};\nvar Context = /*#__PURE__*/createContext(initialState);\nvar reducer = (state, action) => _extends({}, state, action);\nexport var useShowToolsStore = () => {\n return useContext(Context);\n};\nvar DispatchShowTools = /*#__PURE__*/createContext(() => {});\nDispatchShowTools.displayName = 'JVR.DispatchShowTools';\nexport function useShowTools() {\n return useReducer(reducer, initialState);\n}\nexport function useShowToolsDispatch() {\n return useContext(DispatchShowTools);\n}\nexport var ShowTools = _ref => {\n var {\n initial,\n dispatch,\n children\n } = _ref;\n return /*#__PURE__*/_jsx(Context.Provider, {\n value: initial,\n children: /*#__PURE__*/_jsx(DispatchShowTools.Provider, {\n value: dispatch,\n children: children\n })\n });\n};\nShowTools.displayName = 'JVR.ShowTools';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { createContext, useContext, useReducer } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar initialState = {};\nvar Context = /*#__PURE__*/createContext(initialState);\nvar reducer = (state, action) => _extends({}, state, action);\nexport var useExpandsStore = () => {\n return useContext(Context);\n};\nvar DispatchExpands = /*#__PURE__*/createContext(() => {});\nDispatchExpands.displayName = 'JVR.DispatchExpands';\nexport function useExpands() {\n return useReducer(reducer, initialState);\n}\nexport function useExpandsDispatch() {\n return useContext(DispatchExpands);\n}\nexport var Expands = _ref => {\n var {\n initial,\n dispatch,\n children\n } = _ref;\n return /*#__PURE__*/_jsx(Context.Provider, {\n value: initial,\n children: /*#__PURE__*/_jsx(DispatchExpands.Provider, {\n value: dispatch,\n children: children\n })\n });\n};\nExpands.displayName = 'JVR.Expands';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { createContext, useContext, useReducer } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar initialState = {\n Str: {\n as: 'span',\n 'data-type': 'string',\n style: {\n color: 'var(--w-rjv-type-string-color, #cb4b16)'\n },\n className: 'w-rjv-type',\n children: 'string'\n },\n Url: {\n as: 'a',\n style: {\n color: 'var(--w-rjv-type-url-color, #0969da)'\n },\n 'data-type': 'url',\n className: 'w-rjv-type',\n children: 'url'\n },\n Undefined: {\n style: {\n color: 'var(--w-rjv-type-undefined-color, #586e75)'\n },\n as: 'span',\n 'data-type': 'undefined',\n className: 'w-rjv-type',\n children: 'undefined'\n },\n Null: {\n style: {\n color: 'var(--w-rjv-type-null-color, #d33682)'\n },\n as: 'span',\n 'data-type': 'null',\n className: 'w-rjv-type',\n children: 'null'\n },\n Map: {\n style: {\n color: 'var(--w-rjv-type-map-color, #268bd2)',\n marginRight: 3\n },\n as: 'span',\n 'data-type': 'map',\n className: 'w-rjv-type',\n children: 'Map'\n },\n Nan: {\n style: {\n color: 'var(--w-rjv-type-nan-color, #859900)'\n },\n as: 'span',\n 'data-type': 'nan',\n className: 'w-rjv-type',\n children: 'NaN'\n },\n Bigint: {\n style: {\n color: 'var(--w-rjv-type-bigint-color, #268bd2)'\n },\n as: 'span',\n 'data-type': 'bigint',\n className: 'w-rjv-type',\n children: 'bigint'\n },\n Int: {\n style: {\n color: 'var(--w-rjv-type-int-color, #268bd2)'\n },\n as: 'span',\n 'data-type': 'int',\n className: 'w-rjv-type',\n children: 'int'\n },\n Set: {\n style: {\n color: 'var(--w-rjv-type-set-color, #268bd2)',\n marginRight: 3\n },\n as: 'span',\n 'data-type': 'set',\n className: 'w-rjv-type',\n children: 'Set'\n },\n Float: {\n style: {\n color: 'var(--w-rjv-type-float-color, #859900)'\n },\n as: 'span',\n 'data-type': 'float',\n className: 'w-rjv-type',\n children: 'float'\n },\n True: {\n style: {\n color: 'var(--w-rjv-type-boolean-color, #2aa198)'\n },\n as: 'span',\n 'data-type': 'bool',\n className: 'w-rjv-type',\n children: 'bool'\n },\n False: {\n style: {\n color: 'var(--w-rjv-type-boolean-color, #2aa198)'\n },\n as: 'span',\n 'data-type': 'bool',\n className: 'w-rjv-type',\n children: 'bool'\n },\n Date: {\n style: {\n color: 'var(--w-rjv-type-date-color, #268bd2)'\n },\n as: 'span',\n 'data-type': 'date',\n className: 'w-rjv-type',\n children: 'date'\n }\n};\nvar Context = /*#__PURE__*/createContext(initialState);\nvar reducer = (state, action) => _extends({}, state, action);\nexport var useTypesStore = () => {\n return useContext(Context);\n};\nvar DispatchTypes = /*#__PURE__*/createContext(() => {});\nDispatchTypes.displayName = 'JVR.DispatchTypes';\nexport function useTypes() {\n return useReducer(reducer, initialState);\n}\nexport function useTypesDispatch() {\n return useContext(DispatchTypes);\n}\nexport function Types(_ref) {\n var {\n initial,\n dispatch,\n children\n } = _ref;\n return /*#__PURE__*/_jsx(Context.Provider, {\n value: initial,\n children: /*#__PURE__*/_jsx(DispatchTypes.Provider, {\n value: dispatch,\n children: children\n })\n });\n}\nTypes.displayName = 'JVR.Types';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"style\"];\nimport React from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function TriangleArrow(props) {\n var {\n style\n } = props,\n reset = _objectWithoutPropertiesLoose(props, _excluded);\n var defaultStyle = _extends({\n cursor: 'pointer',\n height: '1em',\n width: '1em',\n userSelect: 'none',\n display: 'inline-flex'\n }, style);\n return /*#__PURE__*/_jsx(\"svg\", _extends({\n viewBox: \"0 0 24 24\",\n fill: \"var(--w-rjv-arrow-color, currentColor)\",\n style: defaultStyle\n }, reset, {\n children: /*#__PURE__*/_jsx(\"path\", {\n d: \"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z\"\n })\n }));\n}\nTriangleArrow.displayName = 'JVR.TriangleArrow';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { createContext, useContext, useReducer } from 'react';\nimport { TriangleArrow } from \"../arrow/TriangleArrow.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar initialState = {\n Arrow: {\n as: 'span',\n className: 'w-rjv-arrow',\n style: {\n transform: 'rotate(0deg)',\n transition: 'all 0.3s'\n },\n children: /*#__PURE__*/_jsx(TriangleArrow, {})\n },\n Colon: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-colon-color, var(--w-rjv-color))',\n marginLeft: 0,\n marginRight: 2\n },\n className: 'w-rjv-colon',\n children: ':'\n },\n Quote: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-quotes-color, #236a7c)'\n },\n className: 'w-rjv-quotes',\n children: '\"'\n },\n ValueQuote: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-quotes-string-color, #cb4b16)'\n },\n className: 'w-rjv-quotes',\n children: '\"'\n },\n BracketsLeft: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-brackets-color, #236a7c)'\n },\n className: 'w-rjv-brackets-start',\n children: '['\n },\n BracketsRight: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-brackets-color, #236a7c)'\n },\n className: 'w-rjv-brackets-end',\n children: ']'\n },\n BraceLeft: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-curlybraces-color, #236a7c)'\n },\n className: 'w-rjv-curlybraces-start',\n children: '{'\n },\n BraceRight: {\n as: 'span',\n style: {\n color: 'var(--w-rjv-curlybraces-color, #236a7c)'\n },\n className: 'w-rjv-curlybraces-end',\n children: '}'\n }\n};\nvar Context = /*#__PURE__*/createContext(initialState);\nvar reducer = (state, action) => _extends({}, state, action);\nexport var useSymbolsStore = () => {\n return useContext(Context);\n};\nvar DispatchSymbols = /*#__PURE__*/createContext(() => {});\nDispatchSymbols.displayName = 'JVR.DispatchSymbols';\nexport function useSymbols() {\n return useReducer(reducer, initialState);\n}\nexport function useSymbolsDispatch() {\n return useContext(DispatchSymbols);\n}\nexport var Symbols = _ref => {\n var {\n initial,\n dispatch,\n children\n } = _ref;\n return /*#__PURE__*/_jsx(Context.Provider, {\n value: initial,\n children: /*#__PURE__*/_jsx(DispatchSymbols.Provider, {\n value: dispatch,\n children: children\n })\n });\n};\nSymbols.displayName = 'JVR.Symbols';","import _extends from \"@babel/runtime/helpers/extends\";\nimport React, { createContext, useContext, useReducer } from 'react';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nvar initialState = {\n Copied: {\n className: 'w-rjv-copied',\n style: {\n height: '1em',\n width: '1em',\n cursor: 'pointer',\n verticalAlign: 'middle',\n marginLeft: 5\n }\n },\n CountInfo: {\n as: 'span',\n className: 'w-rjv-object-size',\n style: {\n color: 'var(--w-rjv-info-color, #0000004d)',\n paddingLeft: 8,\n fontStyle: 'italic'\n }\n },\n CountInfoExtra: {\n as: 'span',\n className: 'w-rjv-object-extra',\n style: {\n paddingLeft: 8\n }\n },\n Ellipsis: {\n as: 'span',\n style: {\n cursor: 'pointer',\n color: 'var(--w-rjv-ellipsis-color, #cb4b16)',\n userSelect: 'none'\n },\n className: 'w-rjv-ellipsis',\n children: '...'\n },\n Row: {\n as: 'div',\n className: 'w-rjv-line'\n },\n KeyName: {\n as: 'span',\n className: 'w-rjv-object-key'\n }\n};\nvar Context = /*#__PURE__*/createContext(initialState);\nvar reducer = (state, action) => _extends({}, state, action);\nexport var useSectionStore = () => {\n return useContext(Context);\n};\nvar DispatchSection = /*#__PURE__*/createContext(() => {});\nDispatchSection.displayName = 'JVR.DispatchSection';\nexport function useSection() {\n return useReducer(reducer, initialState);\n}\nexport function useSectionDispatch() {\n return useContext(DispatchSection);\n}\nexport var Section = _ref => {\n var {\n initial,\n dispatch,\n children\n } = _ref;\n return /*#__PURE__*/_jsx(Context.Provider, {\n value: initial,\n children: /*#__PURE__*/_jsx(DispatchSection.Provider, {\n value: dispatch,\n children: children\n })\n });\n};\nSection.displayName = 'JVR.Section';","import _extends from \"@babel/runtime/helpers/extends\";\nimport React, { createContext, useContext, useEffect, useReducer } from 'react';\nimport { useShowTools, ShowTools } from \"./store/ShowTools.js\";\nimport { useExpands, Expands } from \"./store/Expands.js\";\nimport { useTypes, Types } from \"./store/Types.js\";\nimport { useSymbols, Symbols } from \"./store/Symbols.js\";\nimport { useSection, Section } from \"./store/Section.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var initialState = {\n objectSortKeys: false,\n indentWidth: 15\n};\nexport var Context = /*#__PURE__*/createContext(initialState);\nContext.displayName = 'JVR.Context';\nvar DispatchContext = /*#__PURE__*/createContext(() => {});\nDispatchContext.displayName = 'JVR.DispatchContext';\nexport function reducer(state, action) {\n return _extends({}, state, action);\n}\nexport var useStore = () => {\n return useContext(Context);\n};\nexport var useDispatchStore = () => {\n return useContext(DispatchContext);\n};\nexport var Provider = _ref => {\n var {\n children,\n initialState: init,\n initialTypes\n } = _ref;\n var [state, dispatch] = useReducer(reducer, Object.assign({}, initialState, init));\n var [showTools, showToolsDispatch] = useShowTools();\n var [expands, expandsDispatch] = useExpands();\n var [types, typesDispatch] = useTypes();\n var [symbols, symbolsDispatch] = useSymbols();\n var [section, sectionDispatch] = useSection();\n useEffect(() => dispatch(_extends({}, init)), [init]);\n return /*#__PURE__*/_jsx(Context.Provider, {\n value: state,\n children: /*#__PURE__*/_jsx(DispatchContext.Provider, {\n value: dispatch,\n children: /*#__PURE__*/_jsx(ShowTools, {\n initial: showTools,\n dispatch: showToolsDispatch,\n children: /*#__PURE__*/_jsx(Expands, {\n initial: expands,\n dispatch: expandsDispatch,\n children: /*#__PURE__*/_jsx(Types, {\n initial: _extends({}, types, initialTypes),\n dispatch: typesDispatch,\n children: /*#__PURE__*/_jsx(Symbols, {\n initial: symbols,\n dispatch: symbolsDispatch,\n children: /*#__PURE__*/_jsx(Section, {\n initial: section,\n dispatch: sectionDispatch,\n children: children\n })\n })\n })\n })\n })\n })\n });\n};\nexport function useDispatch() {\n return useContext(DispatchContext);\n}\nProvider.displayName = 'JVR.Provider';","function _objectDestructuringEmpty(t) {\n if (null == t) throw new TypeError(\"Cannot destructure \" + t);\n}\nexport { _objectDestructuringEmpty as default };","import _objectDestructuringEmpty from \"@babel/runtime/helpers/objectDestructuringEmpty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"isNumber\", \"value\", \"parentValue\", \"keyName\", \"keys\"],\n _excluded2 = [\"as\", \"render\"],\n _excluded3 = [\"as\", \"render\"],\n _excluded4 = [\"as\", \"render\"],\n _excluded5 = [\"as\", \"style\", \"render\"],\n _excluded6 = [\"as\", \"render\"],\n _excluded7 = [\"as\", \"render\"],\n _excluded8 = [\"as\", \"render\"],\n _excluded9 = [\"as\", \"render\"];\nimport { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useExpandsStore } from \"../store/Expands.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var Quote = props => {\n var {\n Quote: Comp = {}\n } = useSymbolsStore();\n var {\n isNumber,\n value,\n parentValue,\n keyName,\n keys\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n if (isNumber) return null;\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded2);\n var Elm = as || 'span';\n var elmProps = _extends({}, other, reset);\n // Trim the leading and trailing spaces in children,\n // and set it to undefined if it's an empty string or contains only spaces.\n // https://github.com/uiwjs/react-json-view/issues/86\n if (typeof elmProps.children === 'string') {\n var trimmed = elmProps.children.trim();\n elmProps.children = trimmed || undefined;\n }\n var result = {\n value,\n parentValue,\n keyName,\n keys: keys || (keyName ? [keyName] : [])\n };\n var child = render && typeof render === 'function' && render(elmProps, result);\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, elmProps));\n};\nQuote.displayName = 'JVR.Quote';\nexport var ValueQuote = props => {\n var {\n ValueQuote: Comp = {}\n } = useSymbolsStore();\n var other = _extends({}, (_objectDestructuringEmpty(props), props));\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded3);\n var Elm = as || 'span';\n var elmProps = _extends({}, other, reset);\n var child = render && typeof render === 'function' && render(elmProps, {});\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, elmProps));\n};\nValueQuote.displayName = 'JVR.ValueQuote';\nexport var Colon = props => {\n var {\n value,\n parentValue,\n keyName,\n keys\n } = props;\n var {\n Colon: Comp = {}\n } = useSymbolsStore();\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded4);\n var Elm = as || 'span';\n var child = render && typeof render === 'function' && render(reset, {\n value,\n parentValue,\n keyName,\n keys: keys || (keyName ? [keyName] : [])\n });\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, reset));\n};\nColon.displayName = 'JVR.Colon';\nexport var Arrow = props => {\n var {\n Arrow: Comp = {}\n } = useSymbolsStore();\n var expands = useExpandsStore();\n var {\n expandKey,\n style: resetStyle,\n value,\n parentValue,\n keyName,\n keys\n } = props;\n var isExpanded = !!expands[expandKey];\n var {\n as,\n style,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded5);\n var Elm = as || 'span';\n var isRender = render && typeof render === 'function';\n var elmProps = _extends({}, reset, {\n 'data-expanded': isExpanded,\n style: _extends({}, style, resetStyle)\n });\n var result = {\n value,\n parentValue,\n keyName,\n keys: keys || (keyName ? [keyName] : [])\n };\n var child = isRender && render(elmProps, result);\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, reset, {\n style: _extends({}, style, resetStyle)\n }));\n};\nArrow.displayName = 'JVR.Arrow';\nexport var BracketsOpen = props => {\n var {\n isBrackets,\n value,\n parentValue,\n keyName,\n keys\n } = props;\n var {\n BracketsLeft = {},\n BraceLeft = {}\n } = useSymbolsStore();\n var result = {\n value,\n parentValue,\n keyName,\n keys: keys || (keyName ? [keyName] : [])\n };\n if (isBrackets) {\n var {\n as,\n render: _render\n } = BracketsLeft,\n reset = _objectWithoutPropertiesLoose(BracketsLeft, _excluded6);\n var BracketsLeftComp = as || 'span';\n var _child = _render && typeof _render === 'function' && _render(reset, result);\n if (_child) return _child;\n return /*#__PURE__*/_jsx(BracketsLeftComp, _extends({}, reset));\n }\n var {\n as: elm,\n render\n } = BraceLeft,\n resetProps = _objectWithoutPropertiesLoose(BraceLeft, _excluded7);\n var BraceLeftComp = elm || 'span';\n var child = render && typeof render === 'function' && render(resetProps, result);\n if (child) return child;\n return /*#__PURE__*/_jsx(BraceLeftComp, _extends({}, resetProps));\n};\nBracketsOpen.displayName = 'JVR.BracketsOpen';\nexport var BracketsClose = props => {\n var {\n isBrackets,\n isVisiable,\n value,\n parentValue,\n keyName,\n keys\n } = props;\n var result = {\n value,\n parentValue,\n keyName,\n keys: keys || (keyName ? [keyName] : [])\n };\n if (!isVisiable) return null;\n var {\n BracketsRight = {},\n BraceRight = {}\n } = useSymbolsStore();\n if (isBrackets) {\n var {\n as,\n render: _render2\n } = BracketsRight,\n _reset = _objectWithoutPropertiesLoose(BracketsRight, _excluded8);\n var BracketsRightComp = as || 'span';\n var _child2 = _render2 && typeof _render2 === 'function' && _render2(_reset, result);\n if (_child2) return _child2;\n return /*#__PURE__*/_jsx(BracketsRightComp, _extends({}, _reset));\n }\n var {\n as: elm,\n render\n } = BraceRight,\n reset = _objectWithoutPropertiesLoose(BraceRight, _excluded9);\n var BraceRightComp = elm || 'span';\n var child = render && typeof render === 'function' && render(reset, result);\n if (child) return child;\n return /*#__PURE__*/_jsx(BraceRightComp, _extends({}, reset));\n};\nBracketsClose.displayName = 'JVR.BracketsClose';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { useStore } from \"../store.js\";\nimport { useExpandsStore } from \"../store/Expands.js\";\nimport { BracketsClose } from \"../symbol/index.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var NestedClose = props => {\n var _expands$expandKey;\n var {\n keyName,\n value,\n expandKey,\n parentValue,\n level,\n keys = []\n } = props;\n var expands = useExpandsStore();\n var {\n collapsed,\n shouldExpandNodeInitially\n } = useStore();\n var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;\n var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : shouldExpandNodeInitially ? false : defaultExpanded;\n var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {\n value,\n keys,\n level,\n keyName,\n parentValue\n });\n if (shouldExpandNodeInitially && collapsed === false) {\n if (expands[expandKey] === undefined && !shouldExpand) {\n return null;\n }\n } else {\n if (expands[expandKey] === undefined && shouldExpand) {\n return null;\n }\n }\n var len = Object.keys(value).length;\n if (isExpanded || len === 0) {\n return null;\n }\n var style = {\n paddingLeft: 4\n };\n var compProps = {\n keyName,\n value,\n keys,\n parentValue\n };\n var isArray = Array.isArray(value);\n var isMySet = value instanceof Set;\n return /*#__PURE__*/_jsx(\"div\", {\n style: style,\n children: /*#__PURE__*/_jsx(BracketsClose, _extends({\n isBrackets: isArray || isMySet\n }, compProps, {\n isVisiable: true\n }))\n });\n};\nNestedClose.displayName = 'JVR.NestedClose';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"as\", \"render\"],\n _excluded2 = [\"as\", \"render\"],\n _excluded3 = [\"as\", \"render\"],\n _excluded4 = [\"as\", \"render\"],\n _excluded5 = [\"as\", \"render\"],\n _excluded6 = [\"as\", \"render\"],\n _excluded7 = [\"as\", \"render\"],\n _excluded8 = [\"as\", \"render\"],\n _excluded9 = [\"as\", \"render\"],\n _excluded0 = [\"as\", \"render\"],\n _excluded1 = [\"as\", \"render\"],\n _excluded10 = [\"as\", \"render\"],\n _excluded11 = [\"as\", \"render\"];\nimport { Fragment, useEffect, useState } from 'react';\nimport { useStore } from \"../store.js\";\nimport { useTypesStore } from \"../store/Types.js\";\nimport { ValueQuote } from \"../symbol/index.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport var bigIntToString = bi => {\n if (bi === undefined) {\n return '0n';\n } else if (typeof bi === 'string') {\n try {\n bi = BigInt(bi);\n } catch (e) {\n return '0n';\n }\n }\n return bi ? bi.toString() + 'n' : '0n';\n};\nexport var SetComp = _ref => {\n var {\n value,\n keyName\n } = _ref;\n var {\n Set: Comp = {},\n displayDataTypes\n } = useTypesStore();\n var isSet = value instanceof Set;\n if (!isSet || !displayDataTypes) return null;\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded);\n var isRender = render && typeof render === 'function';\n var type = isRender && render(reset, {\n type: 'type',\n value,\n keyName\n });\n if (type) return type;\n var Elm = as || 'span';\n return /*#__PURE__*/_jsx(Elm, _extends({}, reset));\n};\nSetComp.displayName = 'JVR.SetComp';\nexport var MapComp = _ref2 => {\n var {\n value,\n keyName\n } = _ref2;\n var {\n Map: Comp = {},\n displayDataTypes\n } = useTypesStore();\n var isMap = value instanceof Map;\n if (!isMap || !displayDataTypes) return null;\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded2);\n var isRender = render && typeof render === 'function';\n var type = isRender && render(reset, {\n type: 'type',\n value,\n keyName\n });\n if (type) return type;\n var Elm = as || 'span';\n return /*#__PURE__*/_jsx(Elm, _extends({}, reset));\n};\nMapComp.displayName = 'JVR.MapComp';\nvar defalutStyle = {\n opacity: 0.75,\n paddingRight: 4\n};\nexport var TypeString = _ref3 => {\n var {\n children = '',\n keyName,\n keys\n } = _ref3;\n var {\n Str = {},\n displayDataTypes\n } = useTypesStore();\n var {\n shortenTextAfterLength: length = 30,\n stringEllipsis = '...'\n } = useStore();\n var {\n as,\n render\n } = Str,\n reset = _objectWithoutPropertiesLoose(Str, _excluded3);\n var childrenStr = children;\n var [shorten, setShorten] = useState(length && childrenStr.length > length);\n useEffect(() => setShorten(length && childrenStr.length > length), [length]);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Str.style || {});\n if (length > 0) {\n reset.style = _extends({}, reset.style, {\n cursor: childrenStr.length <= length ? 'initial' : 'pointer'\n });\n if (childrenStr.length > length) {\n reset.onClick = () => {\n setShorten(!shorten);\n };\n }\n }\n var text = shorten ? \"\" + childrenStr.slice(0, length) + stringEllipsis : childrenStr;\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var cls = shorten ? 'w-rjv-value w-rjv-value-short' : 'w-rjv-value';\n var child = isRender && render(_extends({}, reset, {\n children: text,\n className: cls\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsxs(Fragment, {\n children: [/*#__PURE__*/_jsx(ValueQuote, {}), /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: cls,\n children: text\n })), /*#__PURE__*/_jsx(ValueQuote, {})]\n })]\n });\n};\nTypeString.displayName = 'JVR.TypeString';\nexport var TypeTrue = _ref4 => {\n var {\n children,\n keyName,\n keys\n } = _ref4;\n var {\n True = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = True,\n reset = _objectWithoutPropertiesLoose(True, _excluded4);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, True.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: children == null ? void 0 : children.toString()\n }))]\n });\n};\nTypeTrue.displayName = 'JVR.TypeTrue';\nexport var TypeFalse = _ref5 => {\n var {\n children,\n keyName,\n keys\n } = _ref5;\n var {\n False = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = False,\n reset = _objectWithoutPropertiesLoose(False, _excluded5);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, False.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: children == null ? void 0 : children.toString()\n }))]\n });\n};\nTypeFalse.displayName = 'JVR.TypeFalse';\nexport var TypeFloat = _ref6 => {\n var {\n children,\n keyName,\n keys\n } = _ref6;\n var {\n Float = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = Float,\n reset = _objectWithoutPropertiesLoose(Float, _excluded6);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Float.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: children == null ? void 0 : children.toString()\n }))]\n });\n};\nTypeFloat.displayName = 'JVR.TypeFloat';\nexport var TypeInt = _ref7 => {\n var {\n children,\n keyName,\n keys\n } = _ref7;\n var {\n Int = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = Int,\n reset = _objectWithoutPropertiesLoose(Int, _excluded7);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Int.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: children == null ? void 0 : children.toString()\n }))]\n });\n};\nTypeInt.displayName = 'JVR.TypeInt';\nexport var TypeBigint = _ref8 => {\n var {\n children,\n keyName,\n keys\n } = _ref8;\n var {\n Bigint: CompBigint = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = CompBigint,\n reset = _objectWithoutPropertiesLoose(CompBigint, _excluded8);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, CompBigint.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: bigIntToString(children == null ? void 0 : children.toString())\n }))]\n });\n};\nTypeBigint.displayName = 'JVR.TypeFloat';\nexport var TypeUrl = _ref9 => {\n var {\n children,\n keyName,\n keys\n } = _ref9;\n var {\n Url = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = Url,\n reset = _objectWithoutPropertiesLoose(Url, _excluded9);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Url.style);\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children: children == null ? void 0 : children.href,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsxs(\"a\", _extends({\n href: children == null ? void 0 : children.href,\n target: \"_blank\"\n }, reset, {\n className: \"w-rjv-value\",\n children: [/*#__PURE__*/_jsx(ValueQuote, {}), children == null ? void 0 : children.href, /*#__PURE__*/_jsx(ValueQuote, {})]\n }))]\n });\n};\nTypeUrl.displayName = 'JVR.TypeUrl';\nexport var TypeDate = _ref0 => {\n var {\n children,\n keyName,\n keys\n } = _ref0;\n var {\n Date: CompData = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = CompData,\n reset = _objectWithoutPropertiesLoose(CompData, _excluded0);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, CompData.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var childStr = children instanceof Date ? children.toLocaleString() : children;\n var child = isRender && render(_extends({}, reset, {\n children: childStr,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: childStr\n }))]\n });\n};\nTypeDate.displayName = 'JVR.TypeDate';\nexport var TypeUndefined = _ref1 => {\n var {\n children,\n keyName,\n keys\n } = _ref1;\n var {\n Undefined = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = Undefined,\n reset = _objectWithoutPropertiesLoose(Undefined, _excluded1);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Undefined.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: \"undefined\"\n }))]\n });\n};\nTypeUndefined.displayName = 'JVR.TypeUndefined';\nexport var TypeNull = _ref10 => {\n var {\n children,\n keyName,\n keys\n } = _ref10;\n var {\n Null = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = Null,\n reset = _objectWithoutPropertiesLoose(Null, _excluded10);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Null.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children,\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: \"null\"\n }))]\n });\n};\nTypeNull.displayName = 'JVR.TypeNull';\nexport var TypeNan = _ref11 => {\n var {\n children,\n keyName,\n keys\n } = _ref11;\n var {\n Nan = {},\n displayDataTypes\n } = useTypesStore();\n var {\n as,\n render\n } = Nan,\n reset = _objectWithoutPropertiesLoose(Nan, _excluded11);\n var Comp = as || 'span';\n var style = _extends({}, defalutStyle, Nan.style || {});\n var isRender = render && typeof render === 'function';\n var type = isRender && render(_extends({}, reset, {\n style\n }), {\n type: 'type',\n value: children,\n keyName,\n keys\n });\n var child = isRender && render(_extends({}, reset, {\n children: children == null ? void 0 : children.toString(),\n className: 'w-rjv-value'\n }), {\n type: 'value',\n value: children,\n keyName,\n keys\n });\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n style: style\n }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {\n className: \"w-rjv-value\",\n children: \"NaN\"\n }))]\n });\n};\nTypeNan.displayName = 'JVR.TypeNan';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { TypeString, TypeTrue, TypeNull, TypeFalse, TypeFloat, TypeBigint, TypeInt, TypeDate, TypeUndefined, TypeNan, TypeUrl } from \"../types/index.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var isFloat = n => Number(n) === n && n % 1 !== 0 || isNaN(n);\nexport var Value = props => {\n var {\n value,\n keyName,\n keys\n } = props;\n var reset = {\n keyName,\n keys\n };\n if (value instanceof URL) {\n return /*#__PURE__*/_jsx(TypeUrl, _extends({}, reset, {\n children: value\n }));\n }\n if (typeof value === 'string') {\n return /*#__PURE__*/_jsx(TypeString, _extends({}, reset, {\n children: value\n }));\n }\n if (value === true) {\n return /*#__PURE__*/_jsx(TypeTrue, _extends({}, reset, {\n children: value\n }));\n }\n if (value === false) {\n return /*#__PURE__*/_jsx(TypeFalse, _extends({}, reset, {\n children: value\n }));\n }\n if (value === null) {\n return /*#__PURE__*/_jsx(TypeNull, _extends({}, reset, {\n children: value\n }));\n }\n if (value === undefined) {\n return /*#__PURE__*/_jsx(TypeUndefined, _extends({}, reset, {\n children: value\n }));\n }\n if (value instanceof Date) {\n return /*#__PURE__*/_jsx(TypeDate, _extends({}, reset, {\n children: value\n }));\n }\n if (typeof value === 'number' && isNaN(value)) {\n return /*#__PURE__*/_jsx(TypeNan, _extends({}, reset, {\n children: value\n }));\n } else if (typeof value === 'number' && isFloat(value)) {\n return /*#__PURE__*/_jsx(TypeFloat, _extends({}, reset, {\n children: value\n }));\n } else if (typeof value === 'bigint') {\n return /*#__PURE__*/_jsx(TypeBigint, _extends({}, reset, {\n children: value\n }));\n } else if (typeof value === 'number') {\n return /*#__PURE__*/_jsx(TypeInt, _extends({}, reset, {\n children: value\n }));\n }\n return null;\n};\nValue.displayName = 'JVR.Value';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { useEffect } from 'react';\nimport { useSymbolsDispatch } from \"../store/Symbols.js\";\nimport { useTypesDispatch } from \"../store/Types.js\";\nimport { useSectionDispatch } from \"../store/Section.js\";\nexport function useSymbolsRender(currentProps, props, key) {\n var dispatch = useSymbolsDispatch();\n var cls = [currentProps.className, props.className].filter(Boolean).join(' ');\n var reset = _extends({}, currentProps, props, {\n className: cls,\n style: _extends({}, currentProps.style, props.style),\n children: props.children || currentProps.children\n });\n useEffect(() => dispatch({\n [key]: reset\n }), [props]);\n}\nexport function useTypesRender(currentProps, props, key) {\n var dispatch = useTypesDispatch();\n var cls = [currentProps.className, props.className].filter(Boolean).join(' ');\n var reset = _extends({}, currentProps, props, {\n className: cls,\n style: _extends({}, currentProps.style, props.style),\n children: props.children || currentProps.children\n });\n useEffect(() => dispatch({\n [key]: reset\n }), [props]);\n}\nexport function useSectionRender(currentProps, props, key) {\n var dispatch = useSectionDispatch();\n var cls = [currentProps.className, props.className].filter(Boolean).join(' ');\n var reset = _extends({}, currentProps, props, {\n className: cls,\n style: _extends({}, currentProps.style, props.style),\n children: props.children || currentProps.children\n });\n useEffect(() => dispatch({\n [key]: reset\n }), [props]);\n}","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"as\", \"render\"];\nimport { useSectionStore } from \"../store/Section.js\";\nimport { useSectionRender } from \"../utils/useRender.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var KeyName = props => {\n var {\n KeyName: Comp = {}\n } = useSectionStore();\n useSectionRender(Comp, props, 'KeyName');\n return null;\n};\nKeyName.displayName = 'JVR.KeyName';\nexport var KeyNameComp = props => {\n var {\n children,\n value,\n parentValue,\n keyName,\n keys\n } = props;\n var isNumber = typeof children === 'number';\n var style = {\n color: isNumber ? 'var(--w-rjv-key-number, #268bd2)' : 'var(--w-rjv-key-string, #002b36)'\n };\n var {\n KeyName: Comp = {}\n } = useSectionStore();\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded);\n reset.style = _extends({}, reset.style, style);\n var Elm = as || 'span';\n var child = render && typeof render === 'function' && render(_extends({}, reset, {\n children\n }), {\n value,\n parentValue,\n keyName,\n keys: keys || (keyName ? [keyName] : [])\n });\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, reset, {\n children: children\n }));\n};\nKeyNameComp.displayName = 'JVR.KeyNameComp';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"children\", \"value\", \"parentValue\", \"keyName\", \"keys\"],\n _excluded2 = [\"as\", \"render\", \"children\"];\nimport { useSectionStore } from \"../store/Section.js\";\nimport { useSectionRender } from \"../utils/useRender.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var Row = props => {\n var {\n Row: Comp = {}\n } = useSectionStore();\n useSectionRender(Comp, props, 'Row');\n return null;\n};\nRow.displayName = 'JVR.Row';\nexport var RowComp = props => {\n var {\n children,\n value,\n parentValue,\n keyName,\n keys\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n var {\n Row: Comp = {}\n } = useSectionStore();\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded2);\n var Elm = as || 'div';\n var child = render && typeof render === 'function' && render(_extends({}, other, reset, {\n children\n }), {\n value,\n keyName,\n parentValue,\n keys\n });\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, other, reset, {\n children: children\n }));\n};\nRowComp.displayName = 'JVR.RowComp';","import { useMemo, useRef, useEffect } from 'react';\nexport function usePrevious(value) {\n var ref = useRef();\n useEffect(() => {\n ref.current = value;\n });\n return ref.current;\n}\nexport function useHighlight(_ref) {\n var {\n value,\n highlightUpdates,\n highlightContainer\n } = _ref;\n var prevValue = usePrevious(value);\n var isHighlight = useMemo(() => {\n if (!highlightUpdates || prevValue === undefined) return false;\n // highlight if value type changed\n if (typeof value !== typeof prevValue) {\n return true;\n }\n if (typeof value === 'number') {\n // notice: NaN !== NaN\n if (isNaN(value) && isNaN(prevValue)) return false;\n return value !== prevValue;\n }\n // highlight if isArray changed\n if (Array.isArray(value) !== Array.isArray(prevValue)) {\n return true;\n }\n // not highlight object/function\n // deep compare they will be slow\n if (typeof value === 'object' || typeof value === 'function') {\n return false;\n }\n\n // highlight if not equal\n if (value !== prevValue) {\n return true;\n }\n }, [highlightUpdates, value]);\n useEffect(() => {\n if (highlightContainer && highlightContainer.current && isHighlight && 'animate' in highlightContainer.current) {\n highlightContainer.current.animate([{\n backgroundColor: 'var(--w-rjv-update-color, #ebcb8b)'\n }, {\n backgroundColor: ''\n }], {\n duration: 1000,\n easing: 'ease-in'\n });\n }\n }, [isHighlight, value, highlightContainer]);\n}","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"keyName\", \"value\", \"parentValue\", \"expandKey\", \"keys\", \"beforeCopy\"],\n _excluded2 = [\"as\", \"render\"];\nimport { useState } from 'react';\nimport { useStore } from \"../store.js\";\nimport { useSectionStore } from \"../store/Section.js\";\nimport { useShowToolsStore } from \"../store/ShowTools.js\";\nimport { bigIntToString } from \"../types/index.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var Copied = props => {\n var {\n keyName,\n value,\n parentValue,\n expandKey,\n keys,\n beforeCopy\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n var {\n onCopied,\n enableClipboard,\n beforeCopy: globalBeforeCopy\n } = useStore();\n var showTools = useShowToolsStore();\n var isShowTools = showTools[expandKey];\n var [copied, setCopied] = useState(false);\n var {\n Copied: Comp = {}\n } = useSectionStore();\n var sectionBeforeCopy = Comp == null ? void 0 : Comp.beforeCopy;\n if (enableClipboard === false || !isShowTools) return null;\n var click = event => {\n event.stopPropagation();\n var copyText = '';\n if (typeof value === 'number' && value === Infinity) {\n copyText = 'Infinity';\n } else if (typeof value === 'number' && isNaN(value)) {\n copyText = 'NaN';\n } else if (typeof value === 'bigint') {\n copyText = bigIntToString(value);\n } else if (value instanceof Date) {\n copyText = value.toLocaleString();\n } else {\n copyText = JSON.stringify(value, (_, v) => typeof v === 'bigint' ? bigIntToString(v) : v, 2);\n }\n\n // Apply beforeCopy transformation if provided\n // Priority: component prop > section prop > global prop\n var finalBeforeCopy = beforeCopy || sectionBeforeCopy || globalBeforeCopy;\n if (finalBeforeCopy && typeof finalBeforeCopy === 'function') {\n copyText = finalBeforeCopy(copyText, keyName, value, parentValue, expandKey, keys);\n }\n onCopied && onCopied(copyText, value);\n setCopied(true);\n var _clipboard = navigator.clipboard || {\n writeText(text) {\n return new Promise((reslove, reject) => {\n var textarea = document.createElement('textarea');\n textarea.style.position = 'absolute';\n textarea.style.opacity = '0';\n textarea.style.left = '-99999999px';\n textarea.value = text;\n document.body.appendChild(textarea);\n textarea.select();\n if (!document.execCommand('copy')) {\n reject();\n } else {\n reslove();\n }\n textarea.remove();\n });\n }\n };\n _clipboard.writeText(copyText).then(() => {\n var timer = setTimeout(() => {\n setCopied(false);\n clearTimeout(timer);\n }, 3000);\n }).catch(error => {});\n };\n var svgProps = {\n style: {\n display: 'inline-flex'\n },\n fill: copied ? 'var(--w-rjv-copied-success-color, #28a745)' : 'var(--w-rjv-copied-color, currentColor)',\n onClick: click\n };\n var {\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded2);\n var elmProps = _extends({}, reset, other, svgProps, {\n style: _extends({}, reset.style, other.style, svgProps.style)\n });\n var isRender = render && typeof render === 'function';\n var child = isRender && render(_extends({}, elmProps, {\n 'data-copied': copied\n }), {\n value,\n keyName,\n keys,\n parentValue\n });\n if (child) return child;\n if (copied) {\n return /*#__PURE__*/_jsx(\"svg\", _extends({\n viewBox: \"0 0 32 36\"\n }, elmProps, {\n children: /*#__PURE__*/_jsx(\"path\", {\n d: \"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z\"\n })\n }));\n }\n return /*#__PURE__*/_jsx(\"svg\", _extends({\n viewBox: \"0 0 32 36\"\n }, elmProps, {\n children: /*#__PURE__*/_jsx(\"path\", {\n d: \"M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z\"\n })\n }));\n};\nCopied.displayName = 'JVR.Copied';","import { useRef } from 'react';\nexport function useIdCompat() {\n var idRef = useRef(null);\n if (idRef.current === null) {\n idRef.current = 'custom-id-' + Math.random().toString(36).substr(2, 9);\n }\n return idRef.current;\n}","import _extends from \"@babel/runtime/helpers/extends\";\nimport { Fragment, useRef } from 'react';\nimport { useStore } from \"../store.js\";\nimport { useExpandsStore } from \"../store/Expands.js\";\nimport { useShowToolsDispatch } from \"../store/ShowTools.js\";\nimport { Value } from \"./Value.js\";\nimport { KeyNameComp } from \"../section/KeyName.js\";\nimport { RowComp } from \"../section/Row.js\";\nimport { Container } from \"../Container.js\";\nimport { Quote, Colon } from \"../symbol/index.js\";\nimport { useHighlight } from \"../utils/useHighlight.js\";\nimport { Copied } from \"../comps/Copied.js\";\nimport { useIdCompat } from \"../comps/useIdCompat.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport var KeyValues = props => {\n var _expands$expandKey;\n var {\n keyName,\n value,\n expandKey = '',\n level,\n keys = [],\n parentValue\n } = props;\n var expands = useExpandsStore();\n var {\n objectSortKeys,\n indentWidth,\n collapsed,\n shouldExpandNodeInitially\n } = useStore();\n var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;\n var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : shouldExpandNodeInitially ? false : defaultExpanded;\n var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {\n value,\n keys,\n level,\n keyName,\n parentValue\n });\n if (shouldExpandNodeInitially && collapsed === false) {\n if (expands[expandKey] === undefined && !shouldExpand) {\n return null;\n }\n } else {\n if (expands[expandKey] === undefined && shouldExpand) {\n return null;\n }\n }\n if (isExpanded) {\n return null;\n }\n var isMyArray = Array.isArray(value);\n // object\n var entries = isMyArray ? Object.entries(value).map(m => [Number(m[0]), m[1]]) : Object.entries(value);\n if (objectSortKeys) {\n entries = objectSortKeys === true ? entries.sort((_ref, _ref2) => {\n var [a] = _ref;\n var [b] = _ref2;\n return typeof a === 'string' && typeof b === 'string' ? a.localeCompare(b) : 0;\n }) : entries.sort((_ref3, _ref4) => {\n var [a, valA] = _ref3;\n var [b, valB] = _ref4;\n return typeof a === 'string' && typeof b === 'string' ? objectSortKeys(a, b, valA, valB) : 0;\n });\n }\n var style = {\n borderLeft: 'var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)',\n paddingLeft: indentWidth,\n marginLeft: 6\n };\n return /*#__PURE__*/_jsx(\"div\", {\n className: \"w-rjv-wrap\",\n style: style,\n children: entries.map((_ref5, idx) => {\n var [key, val] = _ref5;\n return /*#__PURE__*/_jsx(KeyValuesItem, {\n parentValue: value,\n keyName: key,\n keys: [...keys, key],\n value: val,\n level: level\n }, idx);\n })\n });\n};\nKeyValues.displayName = 'JVR.KeyValues';\nexport var KayName = props => {\n var {\n keyName,\n parentValue,\n keys,\n value\n } = props;\n var {\n highlightUpdates\n } = useStore();\n var isNumber = typeof keyName === 'number';\n var highlightContainer = useRef(null);\n useHighlight({\n value,\n highlightUpdates,\n highlightContainer\n });\n var compProps = {\n keyName,\n value,\n keys,\n parentValue\n };\n return /*#__PURE__*/_jsxs(Fragment, {\n children: [/*#__PURE__*/_jsxs(\"span\", {\n ref: highlightContainer,\n children: [/*#__PURE__*/_jsx(Quote, _extends({\n isNumber: isNumber,\n \"data-placement\": \"left\"\n }, compProps)), /*#__PURE__*/_jsx(KeyNameComp, _extends({}, compProps, {\n children: keyName\n })), /*#__PURE__*/_jsx(Quote, _extends({\n isNumber: isNumber,\n \"data-placement\": \"right\"\n }, compProps))]\n }), /*#__PURE__*/_jsx(Colon, _extends({}, compProps))]\n });\n};\nKayName.displayName = 'JVR.KayName';\nexport var KeyValuesItem = props => {\n var {\n keyName,\n value,\n parentValue,\n level = 0,\n keys = []\n } = props;\n var dispatch = useShowToolsDispatch();\n var subkeyid = useIdCompat();\n var isMyArray = Array.isArray(value);\n var isMySet = value instanceof Set;\n var isMyMap = value instanceof Map;\n var isDate = value instanceof Date;\n var isUrl = value instanceof URL;\n var isMyObject = value && typeof value === 'object' && !isMyArray && !isMySet && !isMyMap && !isDate && !isUrl;\n var isNested = isMyObject || isMyArray || isMySet || isMyMap;\n if (isNested) {\n var myValue = isMySet ? Array.from(value) : isMyMap ? Object.fromEntries(value) : value;\n return /*#__PURE__*/_jsx(Container, {\n keyName: keyName,\n value: myValue,\n parentValue: parentValue,\n initialValue: value,\n keys: keys,\n level: level + 1\n });\n }\n var reset = {\n onMouseEnter: () => dispatch({\n [subkeyid]: true\n }),\n onMouseLeave: () => dispatch({\n [subkeyid]: false\n })\n };\n return /*#__PURE__*/_jsxs(RowComp, _extends({\n className: \"w-rjv-line\",\n value: value,\n keyName: keyName,\n keys: keys,\n parentValue: parentValue\n }, reset, {\n children: [/*#__PURE__*/_jsx(KayName, {\n keyName: keyName,\n value: value,\n keys: keys,\n parentValue: parentValue\n }), /*#__PURE__*/_jsx(Value, {\n keyName: keyName,\n value: value,\n keys: keys\n }), /*#__PURE__*/_jsx(Copied, {\n keyName: keyName,\n value: value,\n keys: keys,\n parentValue: parentValue,\n expandKey: subkeyid\n })]\n }));\n};\nKeyValuesItem.displayName = 'JVR.KeyValuesItem';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"value\", \"keyName\"],\n _excluded2 = [\"as\", \"render\"];\nimport { useSectionStore } from \"../store/Section.js\";\nimport { useSectionRender } from \"../utils/useRender.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var CountInfoExtra = props => {\n var {\n CountInfoExtra: Comp = {}\n } = useSectionStore();\n useSectionRender(Comp, props, 'CountInfoExtra');\n return null;\n};\nCountInfoExtra.displayName = 'JVR.CountInfoExtra';\nexport var CountInfoExtraComps = props => {\n var {\n value = {},\n keyName\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n var {\n CountInfoExtra: Comp = {}\n } = useSectionStore();\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded2);\n if (!render && !reset.children) return null;\n var Elm = as || 'span';\n var isRender = render && typeof render === 'function';\n var elmProps = _extends({}, reset, other);\n var child = isRender && render(elmProps, {\n value,\n keyName\n });\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, elmProps));\n};\nCountInfoExtraComps.displayName = 'JVR.CountInfoExtraComps';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"value\", \"keyName\"],\n _excluded2 = [\"as\", \"render\"];\nimport { useSectionStore } from \"../store/Section.js\";\nimport { useSectionRender } from \"../utils/useRender.js\";\nimport { useStore } from \"../store.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var CountInfo = props => {\n var {\n CountInfo: Comp = {}\n } = useSectionStore();\n useSectionRender(Comp, props, 'CountInfo');\n return null;\n};\nCountInfo.displayName = 'JVR.CountInfo';\nexport var CountInfoComp = props => {\n var {\n value = {},\n keyName\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n var {\n displayObjectSize\n } = useStore();\n var {\n CountInfo: Comp = {}\n } = useSectionStore();\n if (!displayObjectSize) return null;\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded2);\n var Elm = as || 'span';\n reset.style = _extends({}, reset.style, props.style);\n var len = Object.keys(value).length;\n if (!reset.children) {\n reset.children = len + \" item\" + (len === 1 ? '' : 's');\n }\n var elmProps = _extends({}, reset, other);\n var isRender = render && typeof render === 'function';\n var child = isRender && render(_extends({}, elmProps, {\n 'data-length': len\n }), {\n value,\n keyName\n });\n if (child) return child;\n return /*#__PURE__*/_jsx(Elm, _extends({}, elmProps));\n};\nCountInfoComp.displayName = 'JVR.CountInfoComp';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"as\", \"render\"];\nimport { useSectionStore } from \"../store/Section.js\";\nimport { useSectionRender } from \"../utils/useRender.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport var Ellipsis = props => {\n var {\n Ellipsis: Comp = {}\n } = useSectionStore();\n useSectionRender(Comp, props, 'Ellipsis');\n return null;\n};\nEllipsis.displayName = 'JVR.Ellipsis';\nexport var EllipsisComp = _ref => {\n var {\n isExpanded,\n value,\n keyName\n } = _ref;\n var {\n Ellipsis: Comp = {}\n } = useSectionStore();\n var {\n as,\n render\n } = Comp,\n reset = _objectWithoutPropertiesLoose(Comp, _excluded);\n var Elm = as || 'span';\n var child = render && typeof render === 'function' && render(_extends({}, reset, {\n 'data-expanded': isExpanded\n }), {\n value,\n keyName\n });\n if (child) return child;\n if (!isExpanded || typeof value === 'object' && Object.keys(value).length == 0) return null;\n return /*#__PURE__*/_jsx(Elm, _extends({}, reset));\n};\nEllipsisComp.displayName = 'JVR.EllipsisComp';","import _extends from \"@babel/runtime/helpers/extends\";\nimport { KayName } from \"./KeyValues.js\";\nimport { useExpandsStore, useExpandsDispatch } from \"../store/Expands.js\";\nimport { useStore } from \"../store.js\";\nimport { Copied } from \"./Copied.js\";\nimport { CountInfoExtraComps } from \"../section/CountInfoExtra.js\";\nimport { CountInfoComp } from \"../section/CountInfo.js\";\nimport { Arrow, BracketsOpen, BracketsClose } from \"../symbol/index.js\";\nimport { EllipsisComp } from \"../section/Ellipsis.js\";\nimport { SetComp, MapComp } from \"../types/index.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport var NestedOpen = props => {\n var _expands$expandKey;\n var {\n keyName,\n expandKey,\n keys = [],\n initialValue,\n value,\n parentValue,\n level\n } = props;\n var expands = useExpandsStore();\n var dispatchExpands = useExpandsDispatch();\n var {\n onExpand,\n collapsed,\n shouldExpandNodeInitially\n } = useStore();\n var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;\n var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : shouldExpandNodeInitially ? false : defaultExpanded;\n var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {\n value,\n keys,\n level,\n keyName,\n parentValue\n });\n if (expands[expandKey] === undefined && shouldExpandNodeInitially) {\n isExpanded = !shouldExpand;\n }\n var click = () => {\n var opt = {\n expand: !isExpanded,\n value,\n keyid: expandKey,\n keyName\n };\n onExpand && onExpand(opt);\n dispatchExpands({\n [expandKey]: opt.expand\n });\n };\n var style = {\n display: 'inline-flex',\n alignItems: 'center'\n };\n var arrowStyle = {\n transform: \"rotate(\" + (!isExpanded ? '0' : '-90') + \"deg)\",\n transition: 'all 0.3s'\n };\n var len = Object.keys(value).length;\n var isObject = typeof value === 'object';\n var isArray = Array.isArray(value);\n var isMySet = value instanceof Set;\n var showArrow = len !== 0 && (isArray || isMySet || isObject);\n var reset = {\n style\n };\n if (showArrow) {\n reset.onClick = click;\n }\n var compProps = {\n keyName,\n value,\n keys,\n parentValue\n };\n return /*#__PURE__*/_jsxs(\"span\", _extends({}, reset, {\n children: [showArrow && /*#__PURE__*/_jsx(Arrow, _extends({\n style: arrowStyle,\n expandKey: expandKey\n }, compProps)), (keyName || typeof keyName === 'number') && /*#__PURE__*/_jsx(KayName, _extends({}, compProps)), /*#__PURE__*/_jsx(SetComp, {\n value: initialValue,\n keyName: keyName\n }), /*#__PURE__*/_jsx(MapComp, {\n value: initialValue,\n keyName: keyName\n }), /*#__PURE__*/_jsx(BracketsOpen, _extends({\n isBrackets: isArray || isMySet\n }, compProps)), /*#__PURE__*/_jsx(EllipsisComp, {\n keyName: keyName,\n value: value,\n isExpanded: isExpanded\n }), /*#__PURE__*/_jsx(BracketsClose, _extends({\n isVisiable: isExpanded || !showArrow,\n isBrackets: isArray || isMySet\n }, compProps)), /*#__PURE__*/_jsx(CountInfoComp, {\n value: value,\n keyName: keyName\n }), /*#__PURE__*/_jsx(CountInfoExtraComps, {\n value: value,\n keyName: keyName\n }), /*#__PURE__*/_jsx(Copied, {\n keyName: keyName,\n value: value,\n expandKey: expandKey,\n parentValue: parentValue,\n keys: keys\n })]\n }));\n};\nNestedOpen.displayName = 'JVR.NestedOpen';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"className\", \"children\", \"parentValue\", \"keyid\", \"level\", \"value\", \"initialValue\", \"keys\", \"keyName\"];\nimport React, { forwardRef } from 'react';\nimport { NestedClose } from \"./comps/NestedClose.js\";\nimport { NestedOpen } from \"./comps/NestedOpen.js\";\nimport { KeyValues } from \"./comps/KeyValues.js\";\nimport { useIdCompat } from \"./comps/useIdCompat.js\";\nimport { useShowToolsDispatch } from \"./store/ShowTools.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport var Container = /*#__PURE__*/forwardRef((props, ref) => {\n var {\n className = '',\n parentValue,\n level = 1,\n value,\n initialValue,\n keys,\n keyName\n } = props,\n elmProps = _objectWithoutPropertiesLoose(props, _excluded);\n var dispatch = useShowToolsDispatch();\n var subkeyid = useIdCompat();\n var defaultClassNames = [className, 'w-rjv-inner'].filter(Boolean).join(' ');\n var reset = {\n onMouseEnter: () => dispatch({\n [subkeyid]: true\n }),\n onMouseLeave: () => dispatch({\n [subkeyid]: false\n })\n };\n return /*#__PURE__*/_jsxs(\"div\", _extends({\n className: defaultClassNames,\n ref: ref\n }, elmProps, reset, {\n children: [/*#__PURE__*/_jsx(NestedOpen, {\n expandKey: subkeyid,\n value: value,\n level: level,\n keys: keys,\n parentValue: parentValue,\n keyName: keyName,\n initialValue: initialValue\n }), /*#__PURE__*/_jsx(KeyValues, {\n expandKey: subkeyid,\n value: value,\n level: level,\n keys: keys,\n parentValue: parentValue,\n keyName: keyName\n }), /*#__PURE__*/_jsx(NestedClose, {\n expandKey: subkeyid,\n value: value,\n level: level,\n keys: keys,\n parentValue: parentValue,\n keyName: keyName\n })]\n }));\n});\nContainer.displayName = 'JVR.Container';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var BraceLeft = props => {\n var {\n BraceLeft: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'BraceLeft');\n return null;\n};\nBraceLeft.displayName = 'JVR.BraceLeft';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var BraceRight = props => {\n var {\n BraceRight: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'BraceRight');\n return null;\n};\nBraceRight.displayName = 'JVR.BraceRight';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var BracketsLeft = props => {\n var {\n BracketsLeft: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'BracketsLeft');\n return null;\n};\nBracketsLeft.displayName = 'JVR.BracketsLeft';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var BracketsRight = props => {\n var {\n BracketsRight: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'BracketsRight');\n return null;\n};\nBracketsRight.displayName = 'JVR.BracketsRight';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var Arrow = props => {\n var {\n Arrow: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'Arrow');\n return null;\n};\nArrow.displayName = 'JVR.Arrow';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var Colon = props => {\n var {\n Colon: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'Colon');\n return null;\n};\nColon.displayName = 'JVR.Colon';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var Quote = props => {\n var {\n Quote: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'Quote');\n return null;\n};\nQuote.displayName = 'JVR.Quote';","import { useSymbolsStore } from \"../store/Symbols.js\";\nimport { useSymbolsRender } from \"../utils/useRender.js\";\nexport var ValueQuote = props => {\n var {\n ValueQuote: Comp = {}\n } = useSymbolsStore();\n useSymbolsRender(Comp, props, 'ValueQuote');\n return null;\n};\nValueQuote.displayName = 'JVR.ValueQuote';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Bigint = props => {\n var {\n Bigint: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Bigint');\n return null;\n};\nBigint.displayName = 'JVR.Bigint';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Date = props => {\n var {\n Date: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Date');\n return null;\n};\nDate.displayName = 'JVR.Date';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var False = props => {\n var {\n False: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'False');\n return null;\n};\nFalse.displayName = 'JVR.False';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Float = props => {\n var {\n Float: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Float');\n return null;\n};\nFloat.displayName = 'JVR.Float';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Int = props => {\n var {\n Int: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Int');\n return null;\n};\nInt.displayName = 'JVR.Int';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Map = props => {\n var {\n Map: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Map');\n return null;\n};\nMap.displayName = 'JVR.Map';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Nan = props => {\n var {\n Nan: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Nan');\n return null;\n};\nNan.displayName = 'JVR.Nan';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Null = props => {\n var {\n Null: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Null');\n return null;\n};\nNull.displayName = 'JVR.Null';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Set = props => {\n var {\n Set: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Set');\n return null;\n};\nSet.displayName = 'JVR.Set';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var StringText = props => {\n var {\n Str: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Str');\n return null;\n};\nStringText.displayName = 'JVR.StringText';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var True = props => {\n var {\n True: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'True');\n return null;\n};\nTrue.displayName = 'JVR.True';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Undefined = props => {\n var {\n Undefined: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Undefined');\n return null;\n};\nUndefined.displayName = 'JVR.Undefined';","import { useTypesStore } from \"../store/Types.js\";\nimport { useTypesRender } from \"../utils/useRender.js\";\nexport var Url = props => {\n var {\n Url: Comp = {}\n } = useTypesStore();\n useTypesRender(Comp, props, 'Url');\n return null;\n};\nUrl.displayName = 'JVR.Url';","import { useSectionStore } from \"../store/Section.js\";\nimport { useSectionRender } from \"../utils/useRender.js\";\nexport var Copied = props => {\n var {\n Copied: Comp = {}\n } = useSectionStore();\n useSectionRender(Comp, props, 'Copied');\n return null;\n};\nCopied.displayName = 'JVR.Copied';","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"className\", \"style\", \"value\", \"children\", \"collapsed\", \"shouldExpandNodeInitially\", \"indentWidth\", \"displayObjectSize\", \"shortenTextAfterLength\", \"stringEllipsis\", \"highlightUpdates\", \"enableClipboard\", \"displayDataTypes\", \"objectSortKeys\", \"onExpand\", \"onCopied\", \"beforeCopy\"];\nimport { forwardRef } from 'react';\nimport { Provider } from \"./store.js\";\nimport { Container } from \"./Container.js\";\nimport { BraceLeft } from \"./symbol/BraceLeft.js\";\nimport { BraceRight } from \"./symbol/BraceRight.js\";\nimport { BracketsLeft } from \"./symbol/BracketsLeft.js\";\nimport { BracketsRight } from \"./symbol/BracketsRight.js\";\nimport { Arrow } from \"./symbol/Arrow.js\";\nimport { Colon } from \"./symbol/Colon.js\";\nimport { Quote } from \"./symbol/Quote.js\";\nimport { ValueQuote } from \"./symbol/ValueQuote.js\";\nimport { Bigint } from \"./types/Bigint.js\";\nimport { Date } from \"./types/Date.js\";\nimport { False } from \"./types/False.js\";\nimport { Float } from \"./types/Float.js\";\nimport { Int } from \"./types/Int.js\";\nimport { Map } from \"./types/Map.js\";\nimport { Nan } from \"./types/Nan.js\";\nimport { Null } from \"./types/Null.js\";\nimport { Set } from \"./types/Set.js\";\nimport { StringText } from \"./types/String.js\";\nimport { True } from \"./types/True.js\";\nimport { Undefined } from \"./types/Undefined.js\";\nimport { Url } from \"./types/Url.js\";\nimport { Copied } from \"./section/Copied.js\";\nimport { CountInfo } from \"./section/CountInfo.js\";\nimport { CountInfoExtra } from \"./section/CountInfoExtra.js\";\nimport { Ellipsis } from \"./section/Ellipsis.js\";\nimport { KeyName } from \"./section/KeyName.js\";\nimport { Row } from \"./section/Row.js\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport * from \"./store.js\";\nexport * from \"./store/Expands.js\";\nexport * from \"./store/ShowTools.js\";\nexport * from \"./store/Symbols.js\";\nexport * from \"./store/Types.js\";\nexport * from \"./symbol/index.js\";\nvar JsonView = /*#__PURE__*/forwardRef((props, ref) => {\n var {\n className = '',\n style,\n value,\n children,\n collapsed = false,\n shouldExpandNodeInitially,\n indentWidth = 15,\n displayObjectSize = true,\n shortenTextAfterLength = 30,\n stringEllipsis,\n highlightUpdates = true,\n enableClipboard = true,\n displayDataTypes = true,\n objectSortKeys = false,\n onExpand,\n onCopied,\n beforeCopy\n } = props,\n elmProps = _objectWithoutPropertiesLoose(props, _excluded);\n var defaultStyle = _extends({\n lineHeight: 1.4,\n fontFamily: 'var(--w-rjv-font-family, Menlo, monospace)',\n color: 'var(--w-rjv-color, #002b36)',\n backgroundColor: 'var(--w-rjv-background-color, #00000000)',\n fontSize: 13\n }, style);\n var cls = ['w-json-view-container', 'w-rjv', className].filter(Boolean).join(' ');\n return /*#__PURE__*/_jsxs(Provider, {\n initialState: {\n value,\n objectSortKeys,\n indentWidth,\n shouldExpandNodeInitially: collapsed === false ? shouldExpandNodeInitially : undefined,\n displayObjectSize,\n collapsed,\n enableClipboard,\n shortenTextAfterLength,\n stringEllipsis,\n highlightUpdates,\n onCopied,\n onExpand,\n beforeCopy\n },\n initialTypes: {\n displayDataTypes\n },\n children: [/*#__PURE__*/_jsx(Container, _extends({\n value: value\n }, elmProps, {\n ref: ref,\n className: cls,\n style: defaultStyle\n })), children]\n });\n});\nJsonView.Bigint = Bigint;\nJsonView.Date = Date;\nJsonView.False = False;\nJsonView.Float = Float;\nJsonView.Int = Int;\nJsonView.Map = Map;\nJsonView.Nan = Nan;\nJsonView.Null = Null;\nJsonView.Set = Set;\nJsonView.String = StringText;\nJsonView.True = True;\nJsonView.Undefined = Undefined;\nJsonView.Url = Url;\nJsonView.ValueQuote = ValueQuote;\nJsonView.Arrow = Arrow;\nJsonView.Colon = Colon;\nJsonView.Quote = Quote;\nJsonView.Ellipsis = Ellipsis;\nJsonView.BraceLeft = BraceLeft;\nJsonView.BraceRight = BraceRight;\nJsonView.BracketsLeft = BracketsLeft;\nJsonView.BracketsRight = BracketsRight;\nJsonView.Copied = Copied;\nJsonView.CountInfo = CountInfo;\nJsonView.CountInfoExtra = CountInfoExtra;\nJsonView.KeyName = KeyName;\nJsonView.Row = Row;\nJsonView.displayName = 'JVR.JsonView';\n\n// Named exports for better import flexibility\nexport { JsonView };\n// Named exports for type components\nexport { Bigint, Date as JsonDate, False, Float, Int, Map as JsonMap, Nan, Null, Set as JsonSet, StringText as JsonString, True, Undefined, Url };\n\n// Named exports for symbol components\nexport { BraceLeft, BraceRight, BracketsLeft, BracketsRight, Arrow, Colon, Quote, ValueQuote };\n\n// Named exports for section components\nexport { Copied, CountInfo, CountInfoExtra, Ellipsis, KeyName, Row };\nexport default JsonView;","export var vscodeTheme = {\n '--w-rjv-font-family': 'monospace',\n '--w-rjv-color': '#9cdcfe',\n '--w-rjv-key-string': '#9cdcfe',\n '--w-rjv-background-color': '#1e1e1e',\n '--w-rjv-line-color': '#36334280',\n '--w-rjv-arrow-color': '#838383',\n '--w-rjv-edit-color': 'var(--w-rjv-color)',\n '--w-rjv-info-color': '#9c9c9c7a',\n '--w-rjv-update-color': '#9cdcfe',\n '--w-rjv-copied-color': '#9cdcfe',\n '--w-rjv-copied-success-color': '#28a745',\n '--w-rjv-curlybraces-color': '#d4d4d4',\n '--w-rjv-colon-color': '#d4d4d4',\n '--w-rjv-brackets-color': '#d4d4d4',\n '--w-rjv-quotes-color': 'var(--w-rjv-key-string)',\n '--w-rjv-quotes-string-color': 'var(--w-rjv-type-string-color)',\n '--w-rjv-type-string-color': '#ce9178',\n '--w-rjv-type-int-color': '#b5cea8',\n '--w-rjv-type-float-color': '#b5cea8',\n '--w-rjv-type-bigint-color': '#b5cea8',\n '--w-rjv-type-boolean-color': '#569cd6',\n '--w-rjv-type-date-color': '#b5cea8',\n '--w-rjv-type-url-color': '#3b89cf',\n '--w-rjv-type-null-color': '#569cd6',\n '--w-rjv-type-nan-color': '#859900',\n '--w-rjv-type-undefined-color': '#569cd6'\n};","import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { cn } from \"../utils\";\nimport type { Button } from \"./button\";\nimport { buttonVariants } from \"./button\";\n\nfunction Pagination({ className, ...props }: React.ComponentProps<\"nav\">) {\n\treturn (\n\t\t<nav\n\t\t\taria-label=\"pagination\"\n\t\t\tdata-slot=\"pagination\"\n\t\t\tclassName={cn(\"mx-auto flex w-full justify-center\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PaginationContent({ className, ...props }: React.ComponentProps<\"ul\">) {\n\treturn (\n\t\t<ul\n\t\t\tdata-slot=\"pagination-content\"\n\t\t\tclassName={cn(\"flex flex-row items-center gap-1\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction PaginationItem({ ...props }: React.ComponentProps<\"li\">) {\n\treturn (\n\t\t<li\n\t\t\tdata-slot=\"pagination-item\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype PaginationLinkProps = {\n\tisActive?: boolean;\n\tisDisabled?: boolean;\n} & Pick<React.ComponentProps<typeof Button>, \"size\"> &\n\tReact.ComponentProps<\"a\">;\n\nfunction PaginationLink({\n\tclassName,\n\tisActive,\n\tsize = \"icon\",\n\t...props\n}: PaginationLinkProps) {\n\treturn (\n\t\t<a\n\t\t\taria-current={isActive ? \"page\" : undefined}\n\t\t\tdata-slot=\"pagination-link\"\n\t\t\tdata-active={isActive}\n\t\t\tclassName={cn(\n\t\t\t\tbuttonVariants({\n\t\t\t\t\tvariant: isActive ? \"outline\" : \"ghost\",\n\t\t\t\t\tsize,\n\t\t\t\t}),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _PaginationPrevious({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof PaginationLink>) {\n\treturn (\n\t\t<PaginationLink\n\t\t\taria-label=\"Go to previous page\"\n\t\t\tsize=\"default\"\n\t\t\tclassName={cn(\"gap-1 px-2.5 sm:pe-4\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ChevronLeftIcon size={16} />\n\t\t\t<span>Previous</span>\n\t\t</PaginationLink>\n\t);\n}\n\nfunction _PaginationNext({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof PaginationLink>) {\n\treturn (\n\t\t<PaginationLink\n\t\t\taria-label=\"Go to next page\"\n\t\t\tsize=\"default\"\n\t\t\tclassName={cn(\"gap-1 px-2.5 sm:ps-4\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span>Next</span>\n\t\t\t<ChevronRightIcon size={16} />\n\t\t</PaginationLink>\n\t);\n}\n\nfunction _PaginationEllipsis({ className, ...props }: React.ComponentProps<\"span\">) {\n\treturn (\n\t\t<span\n\t\t\taria-hidden\n\t\t\tdata-slot=\"pagination-ellipsis\"\n\t\t\tclassName={cn(\"flex size-9 items-center justify-center\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<MoreHorizontalIcon size={16} />\n\t\t\t<span className=\"sr-only\">More pages</span>\n\t\t</span>\n\t);\n}\n\nexport {\n\t_PaginationEllipsis as PaginationEllipsis,\n\t_PaginationNext as PaginationNext,\n\t_PaginationPrevious as PaginationPrevious,\n\tPagination,\n\tPaginationContent,\n\tPaginationItem,\n};\n","const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if (!connectionInfo) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst findCallerName = (stack) => {\n var _a, _b;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return (_b = /.+ (.+) .+/.exec(callerLine)) == null ? void 0 : _b[1];\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n api.devtools = {\n cleanup: () => {\n if (connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n removeStoreFromTrackedConnections(options.name, store);\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n","import { create } from \"zustand\";\nimport { persist } from \"zustand/middleware\";\n\ntype Theme = \"dark\" | \"light\" | \"system\";\n\ntype PersonalPreferencesState = {\n\tsidebar: {\n\t\twidth: number;\n\t\tisOpen: boolean;\n\t\tisPinned: boolean;\n\t};\n\trunnerResults: {\n\t\theight: number;\n\t};\n\ttheme: Theme;\n\tsetTheme: (theme: Theme) => void;\n\ttoggleTheme: () => void;\n\tsetSidebarWidth: (width: number) => void;\n\tsetSidebarOpen: (isOpen: boolean) => void;\n\tsetSidebarPinned: (isPinned: boolean) => void;\n\ttoggleSidebarOpen: () => void;\n\ttoggleSidebarPinned: () => void;\n\tsetRunnerResultsHeight: (height: number) => void;\n};\n\nexport const usePersonalPreferencesStore = create<PersonalPreferencesState>()(\n\tpersist(\n\t\t(set) => ({\n\t\t\tsidebar: {\n\t\t\t\twidth: 400,\n\t\t\t\tisOpen: true,\n\t\t\t\tisPinned: true,\n\t\t\t},\n\t\t\trunnerResults: {\n\t\t\t\theight: 300,\n\t\t\t},\n\t\t\ttheme: \"system\",\n\t\t\tsetTheme: (theme) => set({ theme: theme }),\n\t\t\ttoggleTheme: () =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\ttheme: state.theme === \"dark\" ? \"light\" : \"dark\",\n\t\t\t\t})),\n\t\t\tsetSidebarWidth: (width) =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\tsidebar: {\n\t\t\t\t\t\t...state.sidebar,\n\t\t\t\t\t\twidth: Math.max(250, Math.min(500, width)),\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\tsetSidebarOpen: (isOpen) =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\tsidebar: { ...state.sidebar, isOpen },\n\t\t\t\t})),\n\t\t\tsetSidebarPinned: (isPinned) =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\tsidebar: { ...state.sidebar, isPinned },\n\t\t\t\t})),\n\t\t\ttoggleSidebarOpen: () =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\tsidebar: { ...state.sidebar, isOpen: !state.sidebar.isOpen },\n\t\t\t\t})),\n\t\t\ttoggleSidebarPinned: () =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\tsidebar: {\n\t\t\t\t\t\t...state.sidebar,\n\t\t\t\t\t\tisPinned: !state.sidebar.isPinned,\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t\tsetRunnerResultsHeight: (height) =>\n\t\t\t\tset((state) => ({\n\t\t\t\t\trunnerResults: {\n\t\t\t\t\t\t...state.runnerResults,\n\t\t\t\t\t\theight: Math.max(150, Math.min(800, height)),\n\t\t\t\t\t},\n\t\t\t\t})),\n\t\t}),\n\t\t{\n\t\t\tname: \"db-studio-personal-preferences\",\n\t\t},\n\t),\n);\n","import { Button } from \"@db-studio/ui/button\";\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuTrigger,\n} from \"@db-studio/ui/dropdown-menu\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { Pagination, PaginationContent, PaginationItem } from \"@db-studio/ui/pagination\";\nimport { ChevronDown, ChevronLeft, ChevronRight, ChevronsLeft } from \"lucide-react\";\nimport { useQueryState } from \"nuqs\";\nimport { useRef } from \"react\";\nimport { usePersonalPreferencesStore } from \"@/stores/personal-preferences.store\";\nimport { CONSTANTS, PRESET_SIZES } from \"@/utils/constants\";\nimport { useTableData } from \"../hooks/use-table-data\";\n\nexport const TableFooter = ({\n\ttableName,\n\tvariant = \"row\",\n}: {\n\ttableName: string;\n\tvariant?: \"row\" | \"document\";\n}) => {\n\tconst {\n\t\tsidebar: { isPinned, width },\n\t} = usePersonalPreferencesStore();\n\tconst [limit, setLimit] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.LIMIT);\n\tconst [, setCursor] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.CURSOR);\n\tconst [, setDirection] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.DIRECTION);\n\tconst { tableData } = useTableData({ tableName });\n\n\tconst totalRows = tableData?.meta?.total ?? 0;\n\tconst dataLength = tableData?.data?.length ?? 0;\n\tconst itemLabel = variant === \"document\" ? \"documents\" : \"rows\";\n\tconst perPageLabel = variant === \"document\" ? \"Documents per page\" : \"Rows per page\";\n\n\tconst limitValue = limit ?? \"50\";\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst handleLimitChange = (value: string) => {\n\t\tconst num = parseInt(value, 10);\n\t\tif (Number.isNaN(num) || num < 1) return;\n\t\tconst clamped = Math.min(num, 10000).toString();\n\t\tsetLimit(clamped);\n\t\t// Reset cursor when changing page size\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t};\n\n\tconst handleNextPage = () => {\n\t\tif (tableData?.meta?.nextCursor) {\n\t\t\tsetCursor(tableData.meta.nextCursor);\n\t\t\tsetDirection(\"asc\");\n\t\t}\n\t};\n\n\tconst handlePrevPage = () => {\n\t\tif (tableData?.meta?.prevCursor) {\n\t\t\tsetCursor(tableData.meta.prevCursor);\n\t\t\tsetDirection(\"desc\");\n\t\t}\n\t};\n\n\tconst handleFirstPage = () => {\n\t\t// Reset to first page by clearing cursor\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t};\n\n\treturn (\n\t\t<footer\n\t\t\tclassName=\"fixed bottom-0 left-0 right-0 h-9 border-t border-zinc-800 flex items-center justify-between bg-zinc-950 px-2 text-white\"\n\t\t\tstyle={{\n\t\t\t\tmarginLeft: isPinned ? `${width}px` : \"0\",\n\t\t\t}}\n\t\t>\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<Label className=\"text-xs text-zinc-400 whitespace-nowrap\">{perPageLabel}</Label>\n\t\t\t\t<div className=\"flex items-center h-6 rounded-sm border border-transparent hover:border-zinc-700 focus-within:border-zinc-600 transition-colors\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tkey={limitValue}\n\t\t\t\t\t\tref={inputRef}\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\tmax={10000}\n\t\t\t\t\t\tdefaultValue={limitValue}\n\t\t\t\t\t\tonBlur={(e) => handleLimitChange(e.target.value)}\n\t\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\t\tif (e.key === \"Enter\") {\n\t\t\t\t\t\t\t\tinputRef.current?.blur();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tclassName=\"w-10 h-full bg-transparent text-xs text-center text-white outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\"\n\t\t\t\t\t/>\n\t\t\t\t\t<DropdownMenu>\n\t\t\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tclassName=\"flex items-center h-full px-0.5 text-zinc-500 hover:text-zinc-300 transition-colors focus:outline-none\"\n\t\t\t\t\t\t\t\taria-label=\"Choose preset row count\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ChevronDown className=\"size-3\" />\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t\t\t<DropdownMenuContent\n\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\tclassName=\"min-w-16 border-zinc-800\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{PRESET_SIZES.map((size) => (\n\t\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\t\tkey={size}\n\t\t\t\t\t\t\t\t\tonSelect={() => handleLimitChange(size.toString())}\n\t\t\t\t\t\t\t\t\tclassName=\"text-xs justify-center\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{size}\n\t\t\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</DropdownMenuContent>\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Row count information */}\n\t\t\t<div className=\"flex items-center justify-center text-xs text-zinc-400\">\n\t\t\t\t<p\n\t\t\t\t\tclassName=\"whitespace-nowrap\"\n\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t>\n\t\t\t\t\tShowing <span className=\"text-zinc-200\">{dataLength}</span> of{\" \"}\n\t\t\t\t\t<span className=\"text-zinc-200\">{totalRows}</span> {itemLabel}\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{/* Pagination buttons */}\n\t\t\t<div className=\"flex items-center gap-0.5\">\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tclassName=\"size-6 disabled:opacity-30\"\n\t\t\t\t\tonClick={handleFirstPage}\n\t\t\t\t\tdisabled={!tableData?.meta?.hasPreviousPage || totalRows === 0}\n\t\t\t\t\taria-label=\"Go to first page\"\n\t\t\t\t>\n\t\t\t\t\t<ChevronsLeft aria-hidden=\"true\" />\n\t\t\t\t</Button>\n\t\t\t\t<Pagination>\n\t\t\t\t\t<PaginationContent className=\"gap-0.5\">\n\t\t\t\t\t\t<PaginationItem>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"size-6 disabled:opacity-30\"\n\t\t\t\t\t\t\t\tonClick={handlePrevPage}\n\t\t\t\t\t\t\t\tdisabled={!tableData?.meta?.hasPreviousPage || totalRows === 0}\n\t\t\t\t\t\t\t\taria-label=\"Go to previous page\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ChevronLeft aria-hidden=\"true\" />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PaginationItem>\n\t\t\t\t\t\t<PaginationItem>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tclassName=\"size-6 disabled:opacity-30\"\n\t\t\t\t\t\t\t\tonClick={handleNextPage}\n\t\t\t\t\t\t\t\tdisabled={!tableData?.meta?.hasNextPage || totalRows === 0}\n\t\t\t\t\t\t\t\taria-label=\"Go to next page\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ChevronRight aria-hidden=\"true\" />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PaginationItem>\n\t\t\t\t\t</PaginationContent>\n\t\t\t\t</Pagination>\n\t\t\t</div>\n\t\t</footer>\n\t);\n};\n","import JsonView from \"@uiw/react-json-view\";\nimport { vscodeTheme } from \"@uiw/react-json-view/vscode\";\nimport { TableFooter } from \"@/features/tables/components/table-footer\";\n\nexport const TableDocumentView = ({\n\ttableName,\n\trows,\n}: {\n\ttableName: string;\n\trows: Record<string, unknown>[];\n}) => (\n\t<div className=\"flex-1 w-full flex flex-col overflow-hidden pb-9\">\n\t\t<div className=\"flex-1 overflow-auto bg-[#1E1E1E] p-3\">\n\t\t\t<JsonView\n\t\t\t\tvalue={rows}\n\t\t\t\tkeyName={tableName}\n\t\t\t\tobjectSortKeys={false}\n\t\t\t\tdisplayObjectSize={true}\n\t\t\t\tdisplayDataTypes={false}\n\t\t\t\tindentWidth={14}\n\t\t\t\tcollapsed={1}\n\t\t\t\tshortenTextAfterLength={120}\n\t\t\t\thighlightUpdates={false}\n\t\t\t\tstyle={vscodeTheme}\n\t\t\t\tenableClipboard={true}\n\t\t\t\tclassName=\"size-full\"\n\t\t\t/>\n\t\t</div>\n\t\t<TableFooter\n\t\t\ttableName={tableName}\n\t\t\tvariant=\"document\"\n\t\t/>\n\t</div>\n);\n","import { Button } from \"@db-studio/ui/button\";\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuItem,\n\tDropdownMenuTrigger,\n} from \"@db-studio/ui/dropdown-menu\";\nimport { Plus } from \"lucide-react\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\n\nexport const AddRecordMenu = () => {\n\tconst { openOverlay } = useOverlayStore();\n\n\treturn (\n\t\t<DropdownMenu>\n\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\tclassName=\"h-8! border-l-0 border-y-0 border-r border-zinc-800 rounded-none flex items-center gap-2\"\n\t\t\t\t\taria-label=\"Add records to the table\"\n\t\t\t\t>\n\t\t\t\t\t<Plus className=\"size-4\" />\n\t\t\t\t\tAdd Record\n\t\t\t\t</Button>\n\t\t\t</DropdownMenuTrigger>\n\t\t\t<DropdownMenuContent\n\t\t\t\talign=\"start\"\n\t\t\t\tclassName=\"w-48\"\n\t\t\t>\n\t\t\t\t<DropdownMenuItem onClick={() => openOverlay(\"records.add-record\")}>\n\t\t\t\t\tAdd Record\n\t\t\t\t</DropdownMenuItem>\n\t\t\t\t<DropdownMenuItem onClick={() => openOverlay(\"records.bulk-insert-csv\")}>\n\t\t\t\t\tAdd data from CSV\n\t\t\t\t</DropdownMenuItem>\n\t\t\t\t<DropdownMenuItem onClick={() => openOverlay(\"records.bulk-insert-excel\")}>\n\t\t\t\t\tAdd data from Excel\n\t\t\t\t</DropdownMenuItem>\n\t\t\t\t<DropdownMenuItem onClick={() => openOverlay(\"records.bulk-insert-json\")}>\n\t\t\t\t\tAdd data from JSON\n\t\t\t\t</DropdownMenuItem>\n\t\t\t</DropdownMenuContent>\n\t\t</DropdownMenu>\n\t);\n};\n","import { createFileRoute } from \"@tanstack/react-router\";\nimport { TableScreen } from \"@/features/tables\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/table/$table\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\tconst { table } = Route.useParams();\n\treturn <TableScreen tableName={table} />;\n}\n","import { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { Route } from \"@/routes/_pathlessLayout/table/$table\";\nimport { updateRecords } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport { type CellUpdate, useUpdateCellStore } from \"../stores/update-cell.store\";\n\nexport const useUpdateCell = () => {\n\tconst queryClient = useQueryClient();\n\tconst { table } = Route.useParams();\n\tconst { clearUpdates, getUpdateCount } = useUpdateCellStore();\n\tconst { selectedDatabase } = useDatabaseStore();\n\n\tconst { mutateAsync: updateCellMutation, isPending: isUpdatingCell } = useMutation({\n\t\tmutationFn: async (updates: CellUpdate[]) => {\n\t\t\tif (!table) {\n\t\t\t\tthrow new Error(\"No table selected\");\n\t\t\t}\n\n\t\t\t// Transform updates into the format the API expects\n\t\t\tconst payload = {\n\t\t\t\ttableName: table,\n\t\t\t\tupdates: updates.map((update) => ({\n\t\t\t\t\trowData: update.rowData,\n\t\t\t\t\tcolumnName: update.columnName,\n\t\t\t\t\tvalue: update.newValue,\n\t\t\t\t})),\n\t\t\t};\n\n\t\t\tconst res = await updateRecords({ ...payload, db: selectedDatabase });\n\t\t\treturn res.data.data;\n\t\t},\n\t\tonSuccess: async () => {\n\t\t\tclearUpdates();\n\n\t\t\tawait Promise.all([\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.dataByTable(table),\n\t\t\t\t\texact: false,\n\t\t\t\t}),\n\t\t\t]);\n\t\t},\n\t});\n\n\tconst updateCell = async (updates: CellUpdate[]) => {\n\t\tconst count = getUpdateCount();\n\t\treturn toast.promise(updateCellMutation(updates), {\n\t\t\tloading: \"Saving changes...\",\n\t\t\tsuccess: (message) =>\n\t\t\t\tmessage || `${count} ${count === 1 ? \"change\" : \"changes\"} saved successfully`,\n\t\t\terror: (error: Error) => error.message || \"Failed to save changes\",\n\t\t});\n\t};\n\n\treturn {\n\t\tupdateCell,\n\t\tisUpdatingCell: isUpdatingCell,\n\t};\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport { useCallback } from \"react\";\nimport { useUpdateCell } from \"../../hooks/use-update-cell\";\nimport { useUpdateCellStore } from \"../../stores/update-cell.store\";\nexport const ClearBtn = () => {\n\tconst { getUpdateCount, clearUpdates } = useUpdateCellStore();\n\tconst { isUpdatingCell } = useUpdateCell();\n\n\tconst handleClearUpdates = useCallback(() => {\n\t\tclearUpdates();\n\t}, [clearUpdates]);\n\n\tif (getUpdateCount() === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\ttype=\"button\"\n\t\t\tvariant=\"secondary\"\n\t\t\tclassName=\"h-8! border-l-0 border-y-0 border-r border-zinc-800 rounded-none\"\n\t\t\tonClick={handleClearUpdates}\n\t\t\taria-label=\"Clear changes to the table\"\n\t\t\tdisabled={isUpdatingCell}\n\t\t>\n\t\t\tClear Changes\n\t\t</Button>\n\t);\n};\n","import * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\nimport type * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { Button } from \"./button\";\n\nfunction AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n\treturn (\n\t\t<AlertDialogPrimitive.Root\n\t\t\tdata-slot=\"alert-dialog\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _AlertDialogTrigger({\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n\treturn (\n\t\t<AlertDialogPrimitive.Trigger\n\t\t\tdata-slot=\"alert-dialog-trigger\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogPortal({\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n\treturn (\n\t\t<AlertDialogPrimitive.Portal\n\t\t\tdata-slot=\"alert-dialog-portal\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogOverlay({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {\n\treturn (\n\t\t<AlertDialogPrimitive.Overlay\n\t\t\tdata-slot=\"alert-dialog-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t\"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogContent({\n\tclassName,\n\tsize = \"default\",\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {\n\tsize?: \"default\" | \"sm\";\n}) {\n\treturn (\n\t\t<AlertDialogPortal>\n\t\t\t<AlertDialogOverlay />\n\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\tdata-slot=\"alert-dialog-content\"\n\t\t\t\tdata-size={size}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPortal>\n\t);\n}\n\nfunction AlertDialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"alert-dialog-header\"\n\t\t\tclassName={cn(\n\t\t\t\t\"grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"alert-dialog-footer\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _AlertDialogMedia({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"alert-dialog-media\"\n\t\t\tclassName={cn(\n\t\t\t\t\"bg-muted mb-2 inline-flex size-8 items-center justify-center rounded-sm sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-4\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogTitle({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n\treturn (\n\t\t<AlertDialogPrimitive.Title\n\t\t\tdata-slot=\"alert-dialog-title\"\n\t\t\tclassName={cn(\n\t\t\t\t\"text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogDescription({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n\treturn (\n\t\t<AlertDialogPrimitive.Description\n\t\t\tdata-slot=\"alert-dialog-description\"\n\t\t\tclassName={cn(\n\t\t\t\t\"text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction AlertDialogAction({\n\tclassName,\n\tvariant = \"default\",\n\tsize = \"default\",\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &\n\tPick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n\treturn (\n\t\t<Button\n\t\t\tvariant={variant}\n\t\t\tsize={size}\n\t\t\tasChild\n\t\t>\n\t\t\t<AlertDialogPrimitive.Action\n\t\t\t\tdata-slot=\"alert-dialog-action\"\n\t\t\t\tclassName={cn(className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</Button>\n\t);\n}\n\nfunction AlertDialogCancel({\n\tclassName,\n\tvariant = \"outline\",\n\tsize = \"default\",\n\t...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &\n\tPick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">) {\n\treturn (\n\t\t<Button\n\t\t\tvariant={variant}\n\t\t\tsize={size}\n\t\t\tasChild\n\t\t>\n\t\t\t<AlertDialogPrimitive.Cancel\n\t\t\t\tdata-slot=\"alert-dialog-cancel\"\n\t\t\t\tclassName={cn(className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</Button>\n\t);\n}\n\nexport {\n\t_AlertDialogMedia as AlertDialogMedia,\n\t_AlertDialogTrigger as AlertDialogTrigger,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogCancel,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogTitle,\n};\n","import type { ColumnInfoSchemaType, DeleteRecordResult } from \"@db-studio/shared/types\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport type { AxiosError } from \"axios\";\nimport { toast } from \"sonner\";\nimport { useTableCols } from \"@/features/schema\";\nimport { posthogAnalytics } from \"@/lib/posthog\";\nimport { deleteRecords } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\nexport interface RelatedRecord {\n\ttableName: string;\n\tcolumnName: string;\n\tconstraintName: string;\n\trecords: Array<Record<string, unknown>>;\n}\n\nexport const useDeleteCells = ({ tableName }: { tableName: string }) => {\n\tconst queryClient = useQueryClient();\n\tconst { tableCols } = useTableCols({ tableName });\n\tconst { selectedDatabase, dbType } = useDatabaseStore();\n\n\tconst {\n\t\tmutateAsync: deleteCellsAsync,\n\t\tisPending: isDeletingCells,\n\t\treset: resetDeleteResult,\n\t\terror: deleteCellsError,\n\t} = useMutation({\n\t\tmutationFn: async ({\n\t\t\trowData,\n\t\t\tforce = false,\n\t\t}: {\n\t\t\trowData: Record<string, unknown>[];\n\t\t\tforce?: boolean;\n\t\t}) => {\n\t\t\tif (!tableName) {\n\t\t\t\tthrow new Error(\"No active table selected\");\n\t\t\t}\n\n\t\t\tif (!tableCols || tableCols.length === 0) {\n\t\t\t\tthrow new Error(\"No table columns found\");\n\t\t\t}\n\n\t\t\tconst result = await deleteCellsService(\n\t\t\t\ttableName,\n\t\t\t\ttableCols,\n\t\t\t\trowData,\n\t\t\t\tforce,\n\t\t\t\tselectedDatabase || undefined,\n\t\t\t);\n\t\t\treturn result;\n\t\t},\n\t\tonSuccess: async (result: DeleteRecordResult | { deletedCount: number }) => {\n\t\t\tawait Promise.all([\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.dataByTable(tableName),\n\t\t\t\t\texact: false,\n\t\t\t\t}),\n\t\t\t\tqueryClient.invalidateQueries({\n\t\t\t\t\tqueryKey: tableKeys.lists(),\n\t\t\t\t}),\n\t\t\t]);\n\t\t\tif (dbType) posthogAnalytics.capture(\"record_deleted\", { db_type: dbType });\n\t\t\treturn result;\n\t\t},\n\t});\n\n\tconst deleteCells = async (\n\t\trowData: Record<string, unknown>[],\n\t): Promise<{ deletedCount: number }> => {\n\t\tconst promise = deleteCellsAsync({ rowData, force: false });\n\t\ttoast.promise(promise, {\n\t\t\tloading: \"Deleting records...\",\n\t\t\tsuccess: (result) => `Deleted ${result.deletedCount} records from \"${tableName}\"`,\n\t\t\terror: (error: Error) => error.message || \"Failed to delete records\",\n\t\t});\n\t\treturn promise;\n\t};\n\n\tconst forceDeleteCells = async (\n\t\trowData: Record<string, unknown>[],\n\t): Promise<{ deletedCount: number }> => {\n\t\tconst promise = deleteCellsAsync({ rowData, force: true });\n\t\ttoast.promise(promise, {\n\t\t\tloading: \"Deleting records...\",\n\t\t\tsuccess: (result) => `Deleted ${result.deletedCount} records from \"${tableName}\"`,\n\t\t\terror: (error: Error) => error.message || \"Failed to delete records\",\n\t\t});\n\t\treturn promise;\n\t};\n\n\treturn {\n\t\tdeleteCells,\n\t\tforceDeleteCells,\n\t\tisDeletingCells,\n\t\tresetDeleteResult,\n\t\tdeleteCellsError,\n\t};\n};\n\nconst deleteCellsService = async (\n\ttableName: string,\n\ttableCols: ColumnInfoSchemaType[],\n\trowData: Record<string, unknown>[],\n\tforce: boolean,\n\tdatabase?: string,\n): Promise<DeleteRecordResult | { deletedCount: number }> => {\n\t// Find primary key column\n\tconst primaryKeyCol = tableCols.find((col) => col.isPrimaryKey);\n\tif (!primaryKeyCol) {\n\t\tthrow new Error(\"No primary key found for this table\");\n\t}\n\n\t// Extract primary key values from each row\n\tconst primaryKeys = rowData.map((row) => ({\n\t\tcolumnName: primaryKeyCol.columnName,\n\t\tvalue: row[primaryKeyCol.columnName],\n\t}));\n\n\tconst payload = {\n\t\ttableName,\n\t\tprimaryKeys,\n\t};\n\n\ttry {\n\t\tconst res = await deleteRecords({\n\t\t\t...payload,\n\t\t\tforce,\n\t\t\tdb: database,\n\t\t});\n\t\treturn {\n\t\t\tdeletedCount: res.data.data.deletedCount,\n\t\t\tfkViolation: res.data.data.fkViolation,\n\t\t\trelatedRecords: res.data.data.relatedRecords,\n\t\t};\n\t} catch (error) {\n\t\t// For FK violations (409), we return the result with relatedRecords instead of throwing\n\t\tconst axiosError = error as AxiosError<{ deletedCount: number }>;\n\t\tif (axiosError.response?.status === 409) {\n\t\t\treturn {\n\t\t\t\tdeletedCount: axiosError.response.data.deletedCount,\n\t\t\t};\n\t\t}\n\t\tthrow error;\n\t}\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport {\n\tDialog,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogTitle,\n} from \"@db-studio/ui/dialog\";\nimport type { RelatedRecord } from \"../../hooks/use-delete-cell\";\n\nexport const ForceDeleteDialog = ({\n\tisOpenFkDialog,\n\thandleDialogClose,\n\trelatedRecords,\n\thandleCancelForceDelete,\n\thandleForceDelete,\n\tisDeletingCells,\n}: {\n\tisOpenFkDialog: boolean;\n\thandleDialogClose: (isOpen: boolean) => void;\n\trelatedRecords: RelatedRecord[];\n\thandleCancelForceDelete: () => void;\n\thandleForceDelete: () => void;\n\tisDeletingCells: boolean;\n}) => {\n\treturn (\n\t\t<Dialog\n\t\t\topen={isOpenFkDialog}\n\t\t\tonOpenChange={handleDialogClose}\n\t\t>\n\t\t\t<DialogContent className=\"max-w-2xl z-500\">\n\t\t\t\t<DialogHeader>\n\t\t\t\t\t<DialogTitle>Cannot Delete - Foreign Key Constraint</DialogTitle>\n\t\t\t\t\t<DialogDescription>\n\t\t\t\t\t\tThe selected records cannot be deleted because they are referenced by records in\n\t\t\t\t\t\tother tables. You can either cancel the operation or force delete, which will also\n\t\t\t\t\t\tdelete all related records.\n\t\t\t\t\t</DialogDescription>\n\t\t\t\t</DialogHeader>\n\n\t\t\t\t<RelatedRecordsView relatedRecords={relatedRecords} />\n\n\t\t\t\t<DialogFooter className=\"gap-2\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tonClick={handleCancelForceDelete}\n\t\t\t\t\t\tdisabled={isDeletingCells}\n\t\t\t\t\t>\n\t\t\t\t\t\tCancel\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"destructive\"\n\t\t\t\t\t\tonClick={handleForceDelete}\n\t\t\t\t\t\tdisabled={isDeletingCells}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isDeletingCells ? \"Deleting...\" : \"Force Delete All\"}\n\t\t\t\t\t</Button>\n\t\t\t\t</DialogFooter>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t);\n};\n\nconst RelatedRecordsView = ({ relatedRecords }: { relatedRecords: RelatedRecord[] }) => {\n\treturn (\n\t\t<div className=\"space-y-4 max-h-64 overflow-y-auto\">\n\t\t\t{relatedRecords.map((related, idx) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={`${related.tableName}-${related.columnName}-${idx}`}\n\t\t\t\t\tclassName=\"border border-zinc-700 rounded-md p-3\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"font-medium text-sm mb-2\">\n\t\t\t\t\t\tTable: <span className=\"text-primary\">{related.tableName}</span>\n\t\t\t\t\t\t<span className=\"text-muted-foreground ml-2\">\n\t\t\t\t\t\t\t({related.records.length} record\n\t\t\t\t\t\t\t{related.records.length !== 1 ? \"s\" : \"\"})\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"text-xs text-muted-foreground mb-2\">\n\t\t\t\t\t\tReferences column: {related.columnName}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"bg-zinc-900 rounded p-2 text-xs overflow-x-auto\">\n\t\t\t\t\t\t<pre className=\"whitespace-pre-wrap\">\n\t\t\t\t\t\t\t{JSON.stringify(related.records.slice(0, 5), null, 2)}\n\t\t\t\t\t\t\t{related.records.length > 5 && (\n\t\t\t\t\t\t\t\t<div className=\"text-muted-foreground mt-2\">\n\t\t\t\t\t\t\t\t\t... and {related.records.length - 5} more\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n","import {\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogCancel,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogTitle,\n} from \"@db-studio/ui/alert-dialog\";\nimport { Button } from \"@db-studio/ui/button\";\nimport type { OnChangeFn, Row, RowSelectionState } from \"@tanstack/react-table\";\nimport { useCallback, useState } from \"react\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { type RelatedRecord, useDeleteCells } from \"../../hooks/use-delete-cell\";\nimport { ForceDeleteDialog } from \"./force-delete-dialog\";\n\nexport const DeleteBtn = ({\n\tselectedRows,\n\tsetRowSelection,\n\ttableName,\n}: {\n\ttableName: string;\n\tselectedRows: Row<TableRecord>[];\n\tsetRowSelection: OnChangeFn<RowSelectionState>;\n}) => {\n\tconst { deleteCells, forceDeleteCells, isDeletingCells, resetDeleteResult } = useDeleteCells(\n\t\t{ tableName },\n\t);\n\tconst [pendingRowData, setPendingRowData] = useState<Record<string, unknown>[]>([]);\n\tconst [isOpenFkDialog, setIsOpenFkDialog] = useState(false);\n\tconst [isOpenConfirmDialog, setIsOpenConfirmDialog] = useState(false);\n\tconst [relatedRecords, setRelatedRecords] = useState<RelatedRecord[]>([]);\n\n\tconst handleDeleteClick = useCallback(() => {\n\t\tsetIsOpenConfirmDialog(true);\n\t}, []);\n\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tconst rowData = selectedRows.map((row) => row.original);\n\t\tlet relatedRecords: RelatedRecord[] | undefined;\n\n\t\tsetIsOpenConfirmDialog(false);\n\n\t\ttry {\n\t\t\tawait deleteCells(rowData);\n\t\t\tsetRowSelection({});\n\t\t} catch {\n\t\t\tsetPendingRowData(rowData);\n\t\t\tsetRelatedRecords(relatedRecords || []);\n\t\t\tsetIsOpenFkDialog(true);\n\t\t}\n\t}, [deleteCells, selectedRows, setRowSelection]);\n\n\tconst handleForceDelete = async () => {\n\t\tif (pendingRowData.length === 0) return;\n\n\t\tconst res = await forceDeleteCells(pendingRowData);\n\n\t\t// Only close dialog after successful deletion\n\t\tif (res?.deletedCount > 0) {\n\t\t\tsetIsOpenFkDialog(false);\n\t\t\tsetPendingRowData([]);\n\t\t\tsetRelatedRecords([]);\n\t\t\tresetDeleteResult();\n\t\t\t// Reset row selection after successful force deletion\n\t\t\tsetRowSelection({});\n\t\t}\n\t};\n\n\tconst handleCancelForceDelete = useCallback(() => {\n\t\tsetIsOpenFkDialog(false);\n\t\tsetPendingRowData([]);\n\t\tsetRelatedRecords([]);\n\t\tresetDeleteResult();\n\t}, [resetDeleteResult]);\n\n\tconst handleDialogClose = (isOpen: boolean) => {\n\t\t// Only allow closing if not currently deleting\n\t\tif (isDeletingCells) return;\n\n\t\tif (!isOpen) {\n\t\t\thandleCancelForceDelete();\n\t\t} else {\n\t\t\tsetIsOpenFkDialog(isOpen);\n\t\t}\n\t};\n\n\tif (selectedRows?.length === 0) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\ttype=\"button\"\n\t\t\t\tvariant=\"destructive\"\n\t\t\t\tclassName=\"h-8! border-l-0 border-y-0 border-r border-zinc-800 text-white rounded-none\"\n\t\t\t\tonClick={handleDeleteClick}\n\t\t\t\taria-label=\"Delete the selected record\"\n\t\t\t\tdisabled={isDeletingCells}\n\t\t\t>\n\t\t\t\tDelete Record\n\t\t\t\t{selectedRows?.length > 1 && (\n\t\t\t\t\t<span className=\"ml-1.5 px-1.5 text-[10px] bg-white/20 border border-white/20 rounded\">\n\t\t\t\t\t\t{selectedRows?.length}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</Button>\n\n\t\t\t<AlertDialog\n\t\t\t\topen={isOpenConfirmDialog}\n\t\t\t\tonOpenChange={setIsOpenConfirmDialog}\n\t\t\t>\n\t\t\t\t<AlertDialogContent>\n\t\t\t\t\t<AlertDialogHeader>\n\t\t\t\t\t\t<AlertDialogTitle>\n\t\t\t\t\t\t\tDelete {selectedRows.length === 1 ? \"Record\" : \"Records\"}\n\t\t\t\t\t\t</AlertDialogTitle>\n\t\t\t\t\t\t<AlertDialogDescription>\n\t\t\t\t\t\t\tAre you sure you want to delete{\" \"}\n\t\t\t\t\t\t\t{selectedRows.length === 1 ? \"this record\" : `${selectedRows.length} records`}{\" \"}\n\t\t\t\t\t\t\tfrom \"{tableName}\"? This action cannot be undone.\n\t\t\t\t\t\t</AlertDialogDescription>\n\t\t\t\t\t</AlertDialogHeader>\n\t\t\t\t\t<AlertDialogFooter>\n\t\t\t\t\t\t<AlertDialogCancel>Cancel</AlertDialogCancel>\n\t\t\t\t\t\t<AlertDialogAction\n\t\t\t\t\t\t\tvariant=\"destructive\"\n\t\t\t\t\t\t\tonClick={handleConfirmDelete}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDelete\n\t\t\t\t\t\t</AlertDialogAction>\n\t\t\t\t\t</AlertDialogFooter>\n\t\t\t\t</AlertDialogContent>\n\t\t\t</AlertDialog>\n\n\t\t\t<ForceDeleteDialog\n\t\t\t\tisOpenFkDialog={isOpenFkDialog}\n\t\t\t\thandleDialogClose={handleDialogClose}\n\t\t\t\trelatedRecords={relatedRecords}\n\t\t\t\thandleCancelForceDelete={handleCancelForceDelete}\n\t\t\t\thandleForceDelete={handleForceDelete}\n\t\t\t\tisDeletingCells={isDeletingCells}\n\t\t\t/>\n\t\t</>\n\t);\n};\n","import type { FilterType } from \"@db-studio/shared/types\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Input } from \"@db-studio/ui/input\";\nimport { Kbd } from \"@db-studio/ui/kbd\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@db-studio/ui/popover\";\nimport {\n\tSelect,\n\tSelectContent,\n\tSelectItem,\n\tSelectTrigger,\n\tSelectValue,\n} from \"@db-studio/ui/select\";\nimport { Filter, X } from \"lucide-react\";\nimport { parseAsJson, useQueryState } from \"nuqs\";\nimport { useState } from \"react\";\nimport { useTableCols } from \"@/features/schema\";\nimport { CONSTANTS } from \"@/utils/constants\";\n\nexport const FilterPopup = ({ tableName }: { tableName: string }) => {\n\tconst [filters, setFilters] = useQueryState<FilterType[]>(\n\t\tCONSTANTS.TABLE_STATE_KEYS.FILTERS,\n\t\tparseAsJson((value) => value as FilterType[])\n\t\t\t.withDefault([])\n\t\t\t.withOptions({ history: \"push\" }),\n\t);\n\tconst [, setCursor] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.CURSOR);\n\tconst [, setDirection] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.DIRECTION);\n\tconst { tableCols } = useTableCols({ tableName });\n\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [localFilters, setLocalFilters] = useState<FilterType[]>([]);\n\n\tconst handleAddFilter = () => {\n\t\tconst firstColumn = tableCols?.[0]?.columnName ?? \"\";\n\t\tsetLocalFilters((prev) => [\n\t\t\t...prev,\n\t\t\t{ columnName: firstColumn, operator: \"=\", value: \"\" },\n\t\t]);\n\t};\n\n\tconst handleRemoveFilter = (index: number) => {\n\t\tsetLocalFilters(localFilters.filter((_, i) => i !== index));\n\t};\n\n\tconst handleFilterColumnChange = (index: number, columnName: string) => {\n\t\tsetLocalFilters(\n\t\t\tlocalFilters.map((filter, i) => (i === index ? { ...filter, columnName } : filter)),\n\t\t);\n\t};\n\n\tconst handleFilterValueChange = (index: number, value: string) => {\n\t\tsetLocalFilters(\n\t\t\tlocalFilters.map((filter, i) => (i === index ? { ...filter, value } : filter)),\n\t\t);\n\t};\n\n\tconst handleFilterOperatorChange = (index: number, operator: string) => {\n\t\tsetLocalFilters(\n\t\t\tlocalFilters.map((filter, i) => (i === index ? { ...filter, operator } : filter)),\n\t\t);\n\t};\n\n\tconst handleReset = () => {\n\t\tsetLocalFilters([]);\n\t\tsetFilters([]);\n\t\t// Reset cursor when filters change\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst applyFilters = () => {\n\t\tconst validFilters = localFilters.filter(\n\t\t\t(f) => f.columnName && f.operator && f.value !== \"\",\n\t\t);\n\n\t\tsetFilters(validFilters);\n\t\t// Reset cursor when filters change\n\t\tsetCursor(null);\n\t\tsetDirection(null);\n\t\tsetIsOpen(false);\n\t};\n\n\tconst hasActiveFilters = filters.length > 0;\n\n\t// Sync local state with URL filters when popover opens\n\tconst handleOpenChange = (open: boolean) => {\n\t\tif (open) {\n\t\t\tsetLocalFilters(filters);\n\t\t}\n\t\tsetIsOpen(open);\n\t};\n\n\treturn (\n\t\t<Popover\n\t\t\topen={isOpen}\n\t\t\tonOpenChange={handleOpenChange}\n\t\t>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tclassName=\"size-8! aspect-square border-l-0 border-y-0 border-r border-zinc-800 rounded-none\"\n\t\t\t\t\taria-label=\"Filter table data\"\n\t\t\t\t\tdata-active={hasActiveFilters}\n\t\t\t\t>\n\t\t\t\t\t<Filter className=\"size-4\" />\n\t\t\t\t</Button>\n\t\t\t</PopoverTrigger>\n\n\t\t\t<PopoverContent\n\t\t\t\tclassName=\"w-md space-y-2\"\n\t\t\t\talign=\"start\"\n\t\t\t>\n\t\t\t\t<div className=\"flex items-center gap-4\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={handleAddFilter}\n\t\t\t\t\t>\n\t\t\t\t\t\tAdd filter\n\t\t\t\t\t\t{localFilters && localFilters.length > 0 && (\n\t\t\t\t\t\t\t<Kbd className=\"text-xs font-normal text-white bg-primary/10 border border-primary/90 px-1.5 py-0.5\">\n\t\t\t\t\t\t\t\t{localFilters.length}\n\t\t\t\t\t\t\t</Kbd>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t\t\t{localFilters.length > 0 ? (\n\t\t\t\t\t\tlocalFilters.map((filter, index) => (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={`${filter.columnName}-${index}`}\n\t\t\t\t\t\t\t\tclassName=\"flex-1 flex h-9 gap-2\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tvalue={filter.columnName}\n\t\t\t\t\t\t\t\t\tonValueChange={(value) => handleFilterColumnChange(index, value)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SelectTrigger className=\"w-full flex-1\">\n\t\t\t\t\t\t\t\t\t\t<SelectValue placeholder=\"Select column\" />\n\t\t\t\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t\t\t\t{tableCols?.map((col) => (\n\t\t\t\t\t\t\t\t\t\t\t<SelectItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{col.columnName}\n\t\t\t\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t\t\t\t</Select>\n\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tvalue={filter.operator}\n\t\t\t\t\t\t\t\t\tonValueChange={(value) => handleFilterOperatorChange(index, value)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SelectTrigger>\n\t\t\t\t\t\t\t\t\t\t<SelectValue placeholder=\"Op\" />\n\t\t\t\t\t\t\t\t\t</SelectTrigger>\n\t\t\t\t\t\t\t\t\t<SelectContent>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"=\">=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"!=\">!=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\">\">&gt;</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\">=\">&gt;=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"<\">&lt;</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"<=\">&lt;=</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"is\">is</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"is not\">is not</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"like\">like</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"not like\">not like</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"ilike\">ilike</SelectItem>\n\t\t\t\t\t\t\t\t\t\t<SelectItem value=\"not ilike\">not ilike</SelectItem>\n\t\t\t\t\t\t\t\t\t</SelectContent>\n\t\t\t\t\t\t\t\t</Select>\n\n\t\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tplaceholder=\"Value\"\n\t\t\t\t\t\t\t\t\tvalue={filter.value as string}\n\t\t\t\t\t\t\t\t\tonChange={(e) => handleFilterValueChange(index, e.target.value)}\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\t\tclassName=\"text-xs\"\n\t\t\t\t\t\t\t\t\tonClick={() => handleRemoveFilter(index)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<X className=\"size-4\" />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"flex-1 flex h-9 gap-2 items-center justify-center\">\n\t\t\t\t\t\t\t<p className=\"text-sm text-muted-foreground text-center\">No filters applied</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"gap-2 flex justify-end\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={handleReset}\n\t\t\t\t\t>\n\t\t\t\t\t\tReset\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\tsize=\"lg\"\n\t\t\t\t\t\tclassName=\"text-sm\"\n\t\t\t\t\t\tonClick={applyFilters}\n\t\t\t\t\t>\n\t\t\t\t\t\tApply\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t);\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport { RefreshCw } from \"lucide-react\";\nimport { useCallback } from \"react\";\nimport { useTableCols } from \"@/features/schema\";\nimport { useTableData } from \"../../hooks/use-table-data\";\n\nexport const RefetchBtn = ({ tableName }: { tableName: string }) => {\n\tconst { refetchTableData, isRefetchingTableData } = useTableData({\n\t\ttableName,\n\t});\n\tconst { refetchTableCols, isRefetchingTableCols } = useTableCols({\n\t\ttableName,\n\t});\n\n\tconst handleRefetch = useCallback(() => {\n\t\tPromise.all([refetchTableData(), refetchTableCols()]);\n\t}, [refetchTableData, refetchTableCols]);\n\n\treturn (\n\t\t<Button\n\t\t\ttype=\"button\"\n\t\t\tvariant=\"ghost\"\n\t\t\tclassName=\"size-8! aspect-square border-l-0 border-y-0 border-r border-zinc-800 rounded-none\"\n\t\t\tonClick={handleRefetch}\n\t\t\taria-label=\"Refetch table data and columns\"\n\t\t\tdisabled={isRefetchingTableData || isRefetchingTableCols}\n\t\t>\n\t\t\t<RefreshCw className=\"size-4\" />\n\t\t</Button>\n\t);\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport type { OnChangeFn, RowSelectionState } from \"@tanstack/react-table\";\nimport { useCallback } from \"react\";\nimport { useUpdateCell } from \"../../hooks/use-update-cell\";\nimport { useUpdateCellStore } from \"../../stores/update-cell.store\";\n\nexport const SaveBtn = ({\n\tsetRowSelection,\n}: {\n\tsetRowSelection: OnChangeFn<RowSelectionState>;\n}) => {\n\tconst { getUpdates, getUpdateCount } = useUpdateCellStore();\n\tconst { updateCell, isUpdatingCell } = useUpdateCell();\n\n\tconst handleSave = useCallback(async () => {\n\t\tconst updates = getUpdates();\n\t\tif (updates.length === 0) return;\n\t\ttry {\n\t\t\tawait updateCell(updates);\n\t\t\t// Reset row selection after successful save\n\t\t\tsetRowSelection({});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Failed to save updates:\", error);\n\t\t}\n\t}, [getUpdates, updateCell, setRowSelection]);\n\n\t// Hide button if no updates\n\tif (getUpdateCount() === 0) {\n\t\treturn null;\n\t}\n\n\tconst updateCount = getUpdateCount();\n\n\treturn (\n\t\t<Button\n\t\t\ttype=\"button\"\n\t\t\tvariant=\"default\"\n\t\t\tclassName=\"h-8! border-l-0 border-y-0 border-r border-zinc-800 rounded-none bg-green-700 text-white hover:bg-green-800\"\n\t\t\tonClick={handleSave}\n\t\t\taria-label=\"Save changes to the table\"\n\t\t\tdisabled={isUpdatingCell}\n\t\t>\n\t\t\tSave Changes\n\t\t\t{updateCount > 0 && (\n\t\t\t\t<span className=\"ml-1.5 px-1.5 text-[10px] bg-white/20 border border-white/20 rounded\">\n\t\t\t\t\t{updateCount}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</Button>\n\t);\n};\n","import type { OnChangeFn, Row, RowSelectionState } from \"@tanstack/react-table\";\n// import { SettingsBtn } from \"./settings-menu\";\nimport { useIsSchemaless } from \"@/hooks/use-is-schemaless\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { AddRecordMenu } from \"./add-record-menu\";\nimport { ClearBtn } from \"./clear-btn\";\nimport { DeleteBtn } from \"./delete-btn\";\nimport { FilterPopup } from \"./filter-popup\";\nimport { RefetchBtn } from \"./refetch-btn\";\nimport { SaveBtn } from \"./save-btn\";\n\nexport const TableHeader = ({\n\tselectedRows,\n\tsetRowSelection,\n\ttableName,\n}: {\n\tselectedRows: Row<TableRecord>[];\n\tsetRowSelection: OnChangeFn<RowSelectionState>;\n\ttableName: string;\n}) => {\n\tconst isSchemaless = useIsSchemaless();\n\n\treturn (\n\t\t<header className=\"max-h-8 overflow-hidden border-b border-zinc-800 w-full flex items-center justify-between bg-zinc-950 sticky top-0 left-0 right-0 z-0\">\n\t\t\t<div className=\"flex items-center \">\n\t\t\t\t<RefetchBtn tableName={tableName} />\n\t\t\t\t{!isSchemaless && <FilterPopup tableName={tableName} />}\n\t\t\t\t<AddRecordMenu />\n\t\t\t\t<SaveBtn setRowSelection={setRowSelection} />\n\t\t\t\t<ClearBtn />\n\t\t\t\t<DeleteBtn\n\t\t\t\t\ttableName={tableName}\n\t\t\t\t\tselectedRows={selectedRows}\n\t\t\t\t\tsetRowSelection={setRowSelection}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t{/* <div className=\"flex items-center\">\n\t\t\t\t<SettingsBtn />\n\t\t\t</div> */}\n\t\t</header>\n\t);\n};\n","import type { OnChangeFn, Row, RowSelectionState } from \"@tanstack/react-table\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { TableHeader } from \"./header/table-header\";\n\nexport const TableEmptyState = ({\n\ttableName,\n\tselectedRows,\n\tsetRowSelection,\n}: {\n\ttableName: string;\n\tselectedRows: Row<TableRecord>[];\n\tsetRowSelection: OnChangeFn<RowSelectionState>;\n}) => (\n\t<div className=\"size-full flex flex-col items-center justify-center\">\n\t\t<TableHeader\n\t\t\tselectedRows={selectedRows}\n\t\t\tsetRowSelection={setRowSelection}\n\t\t\ttableName={tableName}\n\t\t/>\n\t\t<div className=\"text-sm text-muted-foreground flex-1 flex items-center justify-center\">\n\t\t\tNo data available for \"{tableName}\" table\n\t\t</div>\n\t</div>\n);\n","export const TableErrorState = ({\n\ttableName,\n\terrorTableData,\n\terrorTableCols,\n}: {\n\ttableName: string;\n\terrorTableData: Error | null;\n\terrorTableCols: Error | null;\n}) => {\n\tconst error = errorTableData || errorTableCols;\n\tconst errorMessage = error?.message || \"\";\n\tconst isTableNotFound =\n\t\terrorMessage.includes(\"does not exist\") ||\n\t\terrorMessage.includes(\"404\") ||\n\t\t(error as Error & { status?: number })?.status === 404;\n\tconst isNetworkError =\n\t\terrorMessage.includes(\"Network Error\") || errorMessage.includes(\"Failed to fetch\");\n\n\tlet errorTitle = \"Something went wrong\";\n\tlet errorDescription = errorMessage || \"An unexpected error occurred\";\n\n\tif (isTableNotFound) {\n\t\terrorTitle = \"Table not found\";\n\t\terrorDescription =\n\t\t\terrorMessage || `The table \"${tableName}\" does not exist or has been deleted`;\n\t} else if (isNetworkError) {\n\t\terrorTitle = \"Connection failed\";\n\t\terrorDescription =\n\t\t\t\"Unable to connect to the database server. Please check your connection.\";\n\t}\n\n\treturn (\n\t\t<div className=\"size-full flex flex-col items-center justify-center\">\n\t\t\t<div className=\"flex-1 flex flex-col items-center justify-center gap-2\">\n\t\t\t\t<div className=\"text-sm font-medium\">{errorTitle}</div>\n\t\t\t\t<div className=\"text-sm text-muted-foreground\">{errorDescription}</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { flexRender, type Row } from \"@tanstack/react-table\";\nimport type { VirtualItem, Virtualizer } from \"@tanstack/react-virtual\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { CellCopyButton } from \"./cell-copy-button\";\n\ninterface TableBodyRowProps {\n\tcolumnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;\n\trow: Row<TableRecord>;\n\trowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;\n\tvirtualPaddingLeft: number | undefined;\n\tvirtualPaddingRight: number | undefined;\n\tvirtualRow: VirtualItem;\n}\n\nexport const TableBodyRow = ({\n\tcolumnVirtualizer,\n\trow,\n\trowVirtualizer,\n\tvirtualPaddingLeft,\n\tvirtualPaddingRight,\n\tvirtualRow,\n}: TableBodyRowProps) => {\n\tconst visibleCells = row.getVisibleCells();\n\tconst virtualColumns = columnVirtualizer.getVirtualItems();\n\treturn (\n\t\t<tr\n\t\t\tdata-index={virtualRow.index} //needed for dynamic row height measurement\n\t\t\tref={(node) => rowVirtualizer.measureElement(node)} //measure dynamic row height\n\t\t\tkey={row.id}\n\t\t\tclassName=\"flex absolute w-fit border-b items-center justify-between text-sm hover:bg-accent/20 data-[state=open]:bg-accent/40 [&_svg]:size-4\"\n\t\t\tstyle={{\n\t\t\t\ttransform: `translateY(${virtualRow.start}px)`, //this should always be a `style` as it changes on scroll\n\t\t\t}}\n\t\t>\n\t\t\t{virtualPaddingLeft ? (\n\t\t\t\t// fake empty column to the left for virtualization scroll padding\n\t\t\t\t<td style={{ display: \"flex\", width: virtualPaddingLeft }} />\n\t\t\t) : null}\n\t\t\t{virtualColumns.map((vc) => {\n\t\t\t\tconst cell = visibleCells[vc.index];\n\t\t\t\treturn (\n\t\t\t\t\t<td\n\t\t\t\t\t\tkey={cell.id}\n\t\t\t\t\t\tclassName=\"group relative flex border-r border-zinc-800 h-8\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\twidth: vc.index === 0 ? \"40px\" : cell.column.getSize(),\n\t\t\t\t\t\t\t// height: \"33px\",\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{flexRender(cell.column.columnDef.cell, cell.getContext())}\n\t\t\t\t\t\t<CellCopyButton value={cell.getValue()} />\n\t\t\t\t\t</td>\n\t\t\t\t);\n\t\t\t})}\n\t\t\t{virtualPaddingRight ? (\n\t\t\t\t// fake empty column to the right for virtualization scroll padding\n\t\t\t\t<td style={{ display: \"flex\", width: virtualPaddingRight }} />\n\t\t\t) : null}\n\t\t</tr>\n\t);\n};\n","import type { Row, Table } from \"@tanstack/react-table\";\nimport { useVirtualizer, type Virtualizer } from \"@tanstack/react-virtual\";\nimport type { RefObject } from \"react\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { TableBodyRow } from \"./table-body-row\";\n\ninterface TableBodyProps {\n\tcolumnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;\n\ttable: Table<TableRecord>;\n\ttableContainerRef: RefObject<HTMLDivElement | null>;\n\tvirtualPaddingLeft: number | undefined;\n\tvirtualPaddingRight: number | undefined;\n}\n\nexport const TableBody = ({\n\tcolumnVirtualizer,\n\ttable,\n\ttableContainerRef,\n\tvirtualPaddingLeft,\n\tvirtualPaddingRight,\n}: TableBodyProps) => {\n\tconst { rows } = table.getRowModel();\n\n\t//dynamic row height virtualization - alternatively you could use a simpler fixed row height strategy without the need for `measureElement`\n\tconst rowVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableRowElement>({\n\t\tcount: rows.length,\n\t\testimateSize: () => 33, //estimate row height for accurate scrollbar dragging\n\t\tgetScrollElement: () => tableContainerRef.current,\n\t\t//measure dynamic row height, except in firefox because it measures table border height incorrectly\n\t\tmeasureElement:\n\t\t\ttypeof window !== \"undefined\" && navigator.userAgent.indexOf(\"Firefox\") === -1\n\t\t\t\t? (element) => element?.getBoundingClientRect().height\n\t\t\t\t: undefined,\n\t\toverscan: 5,\n\t});\n\n\tconst virtualRows = rowVirtualizer.getVirtualItems();\n\n\treturn (\n\t\t<tbody\n\t\t\tstyle={{\n\t\t\t\tdisplay: \"grid\",\n\t\t\t\theight: `${rowVirtualizer.getTotalSize()}px`, //tells scrollbar how big the table is\n\t\t\t\tposition: \"relative\", //needed for absolute positioning of rows\n\t\t\t}}\n\t\t>\n\t\t\t{virtualRows.map((virtualRow) => {\n\t\t\t\tconst row = rows[virtualRow.index] as Row<TableRecord>;\n\n\t\t\t\treturn (\n\t\t\t\t\t<TableBodyRow\n\t\t\t\t\t\tcolumnVirtualizer={columnVirtualizer}\n\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\trow={row}\n\t\t\t\t\t\trowVirtualizer={rowVirtualizer}\n\t\t\t\t\t\tvirtualPaddingLeft={virtualPaddingLeft}\n\t\t\t\t\t\tvirtualPaddingRight={virtualPaddingRight}\n\t\t\t\t\t\tvirtualRow={virtualRow}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t})}\n\t\t</tbody>\n\t);\n};\n","import { cn } from \"@db-studio/ui/utils\";\nimport type { Header, Table } from \"@tanstack/react-table\";\nimport { memo, useCallback } from \"react\";\nimport type { TableRecord } from \"@/types/table.type\";\n\nexport const TableColumnResizer = memo(TableColumnResizerImpl, (prev, next) => {\n\tconst prevColumn = prev.header.column;\n\tconst nextColumn = next.header.column;\n\n\tif (\n\t\tprevColumn.getIsResizing() !== nextColumn.getIsResizing() ||\n\t\tprevColumn.getSize() !== nextColumn.getSize()\n\t) {\n\t\treturn false;\n\t}\n\n\tif (prev.label !== next.label) return false;\n\n\treturn true;\n}) as typeof TableColumnResizerImpl;\n\ninterface TableColumnResizerProps {\n\theader: Header<TableRecord, unknown>;\n\ttable: Table<TableRecord>;\n\tlabel: string;\n}\n\nfunction TableColumnResizerImpl({ header, table, label }: TableColumnResizerProps) {\n\tconst defaultColumnDef = table._getDefaultColumnDef();\n\n\tconst onDoubleClick = useCallback(() => {\n\t\ttable.setColumnSizing((old) => {\n\t\t\tconst newSizing = { ...old };\n\t\t\tdelete newSizing[header.column.id];\n\t\t\treturn newSizing;\n\t\t});\n\t}, [header.column.id, table]);\n\n\treturn (\n\t\t<div\n\t\t\trole=\"separator\"\n\t\t\taria-orientation=\"vertical\"\n\t\t\taria-label={`Resize ${label} column`}\n\t\t\taria-valuenow={header.column.getSize()}\n\t\t\taria-valuemin={defaultColumnDef.minSize}\n\t\t\taria-valuemax={defaultColumnDef.maxSize}\n\t\t\ttabIndex={0}\n\t\t\tclassName={cn(\n\t\t\t\t\"after:-translate-x-1/2 -right-px absolute top-0 z-50 h-full w-0.5 cursor-ew-resize touch-none select-none bg-border transition-opacity after:absolute after:inset-y-0 after:left-1/2 after:h-full after:w-[18px] after:content-[''] hover:bg-primary focus:bg-primary focus:outline-none\",\n\t\t\t\theader.column.getIsResizing() ? \"bg-primary\" : \"opacity-0 hover:opacity-100\",\n\t\t\t)}\n\t\t\tonDoubleClick={onDoubleClick}\n\t\t\tonMouseDown={header.getResizeHandler()}\n\t\t\tonTouchStart={header.getResizeHandler()}\n\t\t/>\n\t);\n}\n","import {\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogCancel,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogTitle,\n} from \"@db-studio/ui/alert-dialog\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Checkbox } from \"@db-studio/ui/checkbox\";\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuGroup,\n\tDropdownMenuItem,\n\tDropdownMenuSeparator,\n\tDropdownMenuTrigger,\n} from \"@db-studio/ui/dropdown-menu\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@db-studio/ui/tooltip\";\nimport { cn } from \"@db-studio/ui/utils\";\nimport {\n\tflexRender,\n\ttype HeaderGroup,\n\ttype SortDirection,\n\ttype Table,\n} from \"@tanstack/react-table\";\nimport type { Virtualizer } from \"@tanstack/react-virtual\";\nimport {\n\tArrowDown,\n\tArrowUp,\n\tChevronDown,\n\tChevronUp,\n\tKey,\n\tLink,\n\tTrash2,\n\tX,\n} from \"lucide-react\";\nimport { useQueryState } from \"nuqs\";\nimport { useCallback, useState } from \"react\";\nimport { useDeleteColumn } from \"@/features/schema\";\nimport { useIsSchemaless } from \"@/hooks/use-is-schemaless\";\nimport { Route } from \"@/routes/_pathlessLayout/table/$table\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { CONSTANTS } from \"@/utils/constants\";\nimport { TableColumnResizer } from \"./table-col-resizer\";\n\ninterface TableHeadRowProps {\n\tcolumnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;\n\theaderGroup: HeaderGroup<TableRecord>;\n\tvirtualPaddingLeft: number | undefined;\n\tvirtualPaddingRight: number | undefined;\n\ttable: Table<TableRecord>;\n}\n\nexport const TableHeadRow = ({\n\tcolumnVirtualizer,\n\theaderGroup,\n\tvirtualPaddingLeft,\n\tvirtualPaddingRight,\n\ttable,\n}: TableHeadRowProps) => {\n\tconst { table: activeTableName } = Route.useParams();\n\tconst isSchemaless = useIsSchemaless();\n\n\tconst [deleteDialogOpen, setDeleteDialogOpen] = useState(false);\n\tconst [columnToDelete, setColumnToDelete] = useState<string | null>(null);\n\tconst [cascadeDelete, setCascadeDelete] = useState(false);\n\tconst { deleteColumn } = useDeleteColumn();\n\n\tconst [, setColumnName] = useQueryState(CONSTANTS.COLUMN_NAME);\n\tconst [, setSort] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.SORT);\n\tconst [, setOrder] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.ORDER);\n\tconst [, setCursor] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.CURSOR);\n\tconst [, setDirection] = useQueryState(CONSTANTS.TABLE_STATE_KEYS.DIRECTION);\n\n\tconst virtualColumns = columnVirtualizer.getVirtualItems();\n\tconst isAnyColumnResizing = table.getState().columnSizingInfo.isResizingColumn;\n\n\tconst createSortHandler = useCallback(\n\t\t(columnId: string) => (direction: SortDirection | null) => {\n\t\t\tif (direction === null) {\n\t\t\t\t// Clear sorting\n\t\t\t\tsetColumnName(null);\n\t\t\t\tsetSort(null);\n\t\t\t\tsetOrder(null);\n\t\t\t} else {\n\t\t\t\t// Update query state (table state will be derived from this)\n\t\t\t\tsetColumnName(columnId);\n\t\t\t\tsetSort(columnId);\n\t\t\t\tsetOrder(direction === \"desc\" ? \"desc\" : \"asc\");\n\t\t\t}\n\t\t\t// Reset cursor when sort changes\n\t\t\tsetCursor(null);\n\t\t\tsetDirection(null);\n\t\t},\n\t\t[setColumnName, setSort, setOrder, setCursor, setDirection],\n\t);\n\n\tconst handleDeleteClick = useCallback((columnId: string) => {\n\t\tsetColumnToDelete(columnId);\n\t\tsetCascadeDelete(false);\n\t\tsetDeleteDialogOpen(true);\n\t}, []);\n\n\tconst handleDialogOpenChange = useCallback((open: boolean) => {\n\t\tsetDeleteDialogOpen(open);\n\t\tif (!open) {\n\t\t\tsetColumnToDelete(null);\n\t\t\tsetCascadeDelete(false);\n\t\t}\n\t}, []);\n\n\tconst handleConfirmDelete = useCallback(async () => {\n\t\tif (!columnToDelete || !activeTableName) return;\n\n\t\tawait deleteColumn({\n\t\t\tdb: activeTableName,\n\t\t\ttableName: activeTableName,\n\t\t\tcolumnName: columnToDelete,\n\t\t\tcascade: cascadeDelete,\n\t\t});\n\n\t\tsetDeleteDialogOpen(false);\n\t\tsetColumnToDelete(null);\n\t\tsetCascadeDelete(false);\n\t}, [columnToDelete, activeTableName, deleteColumn, cascadeDelete]);\n\n\tconst handleCancelDelete = useCallback(() => {\n\t\tsetDeleteDialogOpen(false);\n\t\tsetColumnToDelete(null);\n\t\tsetCascadeDelete(false);\n\t}, []);\n\n\treturn (\n\t\t<>\n\t\t\t<tr\n\t\t\t\tkey={headerGroup.id}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex w-fit bg-black border-b items-center justify-between text-sm data-[state=open]:bg-accent/40 [&_svg]:size-4\",\n\t\t\t\t\tisAnyColumnResizing && \"pointer-events-none\",\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{virtualPaddingLeft ? (\n\t\t\t\t\t//fake empty column to the left for virtualization scroll padding\n\t\t\t\t\t<th style={{ display: \"flex\", width: virtualPaddingLeft }} />\n\t\t\t\t) : null}\n\t\t\t\t{virtualColumns.map((virtualColumn) => {\n\t\t\t\t\tconst header = headerGroup.headers[virtualColumn.index];\n\t\t\t\t\tconst isPrimaryKey = header.column.columnDef.meta?.isPrimaryKey;\n\t\t\t\t\tconst isForeignKey = header.column.columnDef.meta?.isForeignKey;\n\t\t\t\t\tconst dataTypeLabel = header.column.columnDef.meta?.dataTypeLabel;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\tkey={header.id}\n\t\t\t\t\t\t\tclassName=\"h-full flex z-100! relative\"\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\twidth: virtualColumn.index === 0 ? \"40px\" : header.getSize(),\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\t\t\tclassName: cn(\n\t\t\t\t\t\t\t\t\t\t\"relative w-full h-full flex items-center justify-between gap-2 text-sm hover:bg-accent/20 data-[state=open]:bg-accent/40 [&_svg]:size-4\",\n\t\t\t\t\t\t\t\t\t\t\"border-r border-zinc-800\",\n\t\t\t\t\t\t\t\t\t\theader.column.getCanSort() ? \"cursor-pointer select-none\" : \"\",\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t// onClick: header.column.getToggleSortingHandler(),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{virtualColumn.index === 0 ? (\n\t\t\t\t\t\t\t\t\tflexRender(header.column.columnDef.header, header.getContext())\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<DropdownMenu>\n\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"relative border-none w-full h-full bg-transparent! rounded-none justify-between\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"flex items-center gap-1\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{isPrimaryKey && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"inline-flex\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Key\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize={20}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"text-primary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<TooltipContent className=\"text-[10px]\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprimary key\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</TooltipContent>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{isForeignKey && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Tooltip>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"inline-flex\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize={20}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"text-primary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<TooltipContent className=\"text-[10px]\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tforeign key\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</TooltipContent>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{flexRender(header.column.columnDef.header, header.getContext())}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"flex items-center gap-1\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{dataTypeLabel && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-xs leading-none text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{dataTypeLabel}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-xs leading-none text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tasc: <ChevronDown />,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdesc: <ChevronUp />,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}[header.column.getIsSorted() as \"asc\" | \"desc\"] ?? null}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuContent\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"w-44\"\n\t\t\t\t\t\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{!isSchemaless && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{/* Sort ascending button */}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => createSortHandler(header.column.id)(\"asc\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ArrowUp />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSort ascending\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuItem>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{/* Sort descending button */}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => createSortHandler(header.column.id)(\"desc\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ArrowDown />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSort descending\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuItem>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{/* Remove sort button */}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{header.column.getIsSorted() && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => createSortHandler(header.column.id)(null)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<X />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tRemove sort\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{/* TODO: #84 Add edit column button */}\n\t\t\t\t\t\t\t\t\t\t\t\t{/* <DropdownMenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thandleEditColumn(header.column.id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<IconPencil />\n\t\t\t\t\t\t\t\t\t\t\t\t\tEdit column\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuSeparator /> */}\n\n\t\t\t\t\t\t\t\t\t\t\t\t{/* Delete column button */}\n\t\t\t\t\t\t\t\t\t\t\t\t<DropdownMenuItem\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"destructive\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={isSchemaless}\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => handleDeleteClick(header.column.id)}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Trash2 />\n\t\t\t\t\t\t\t\t\t\t\t\t\tDelete column\n\t\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuItem>\n\t\t\t\t\t\t\t\t\t\t\t</DropdownMenuContent>\n\t\t\t\t\t\t\t\t\t\t</DropdownMenu>\n\n\t\t\t\t\t\t\t\t\t\t{header.column.getCanResize() && (\n\t\t\t\t\t\t\t\t\t\t\t<TableColumnResizer\n\t\t\t\t\t\t\t\t\t\t\t\theader={header}\n\t\t\t\t\t\t\t\t\t\t\t\ttable={table}\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={header.column.id}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t\t{virtualPaddingRight ? (\n\t\t\t\t\t//fake empty column to the right for virtualization scroll padding\n\t\t\t\t\t<th style={{ display: \"flex\", width: virtualPaddingRight }} />\n\t\t\t\t) : null}\n\t\t\t</tr>\n\n\t\t\t<AlertDialog\n\t\t\t\topen={deleteDialogOpen}\n\t\t\t\tonOpenChange={handleDialogOpenChange}\n\t\t\t>\n\t\t\t\t<AlertDialogContent>\n\t\t\t\t\t<AlertDialogHeader>\n\t\t\t\t\t\t<AlertDialogTitle>Delete Column</AlertDialogTitle>\n\t\t\t\t\t\t<AlertDialogDescription>\n\t\t\t\t\t\t\tAre you sure you want to delete the column \"{columnToDelete}\n\t\t\t\t\t\t\t\"? This action cannot be undone and will permanently remove all data in this\n\t\t\t\t\t\t\tcolumn.\n\t\t\t\t\t\t</AlertDialogDescription>\n\t\t\t\t\t</AlertDialogHeader>\n\n\t\t\t\t\t<div className=\"flex gap-2 py-2\">\n\t\t\t\t\t\t<Checkbox\n\t\t\t\t\t\t\tid=\"cascade-delete\"\n\t\t\t\t\t\t\tchecked={cascadeDelete}\n\t\t\t\t\t\t\tonCheckedChange={(checked) => setCascadeDelete(checked === true)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Label\n\t\t\t\t\t\t\thtmlFor=\"cascade-delete\"\n\t\t\t\t\t\t\tclassName=\"text-xs text-muted-foreground cursor-pointer\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDrop with CASCADE (also remove dependent indexes, constraints, and foreign key\n\t\t\t\t\t\t\treferences)\n\t\t\t\t\t\t</Label>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<AlertDialogFooter>\n\t\t\t\t\t\t<AlertDialogCancel onClick={handleCancelDelete}>Cancel</AlertDialogCancel>\n\t\t\t\t\t\t<AlertDialogAction\n\t\t\t\t\t\t\tvariant=\"destructive\"\n\t\t\t\t\t\t\tonClick={handleConfirmDelete}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDelete\n\t\t\t\t\t\t</AlertDialogAction>\n\t\t\t\t\t</AlertDialogFooter>\n\t\t\t\t</AlertDialogContent>\n\t\t\t</AlertDialog>\n\t\t</>\n\t);\n};\n","import type { Table } from \"@tanstack/react-table\";\nimport type { Virtualizer } from \"@tanstack/react-virtual\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { TableHeadRow } from \"./table-head-row\";\n\ninterface TableHeadProps {\n\tcolumnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;\n\ttable: Table<TableRecord>;\n\tvirtualPaddingLeft: number | undefined;\n\tvirtualPaddingRight: number | undefined;\n}\n\nexport const TableHead = ({\n\tcolumnVirtualizer,\n\ttable,\n\tvirtualPaddingLeft,\n\tvirtualPaddingRight,\n}: TableHeadProps) => {\n\treturn (\n\t\t<thead className=\"h-9 grid sticky top-0 z-10\">\n\t\t\t{table.getHeaderGroups().map((headerGroup) => (\n\t\t\t\t<TableHeadRow\n\t\t\t\t\tcolumnVirtualizer={columnVirtualizer}\n\t\t\t\t\theaderGroup={headerGroup}\n\t\t\t\t\ttable={table}\n\t\t\t\t\tkey={headerGroup.id}\n\t\t\t\t\tvirtualPaddingLeft={virtualPaddingLeft}\n\t\t\t\t\tvirtualPaddingRight={virtualPaddingRight}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</thead>\n\t);\n};\n","import type { Table } from \"@tanstack/react-table\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport { type RefObject, useRef } from \"react\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { TableBody } from \"./table-body\";\nimport { TableHead } from \"./table-head\";\n\nexport const TableContainer = ({ table }: { table: Table<TableRecord> }) => {\n\tconst visibleColumns = table.getVisibleLeafColumns();\n\n\t// The virtualizers need to know the scrollable container element\n\tconst tableContainerRef = useRef<HTMLDivElement | null>(null);\n\n\t// we are using a slightly different virtualization strategy for columns (compared to virtual rows) in order to support dynamic row heights\n\tconst columnVirtualizer = useVirtualizer<HTMLDivElement, HTMLTableCellElement>({\n\t\tcount: visibleColumns.length,\n\t\testimateSize: (index) => visibleColumns[index].getSize(), //estimate width of each column for accurate scrollbar dragging\n\t\tgetScrollElement: () => tableContainerRef.current,\n\t\thorizontal: true,\n\t\toverscan: 3, // how many columns to render on each side off screen each way (adjust this for performance)\n\t});\n\n\tconst virtualColumns = columnVirtualizer.getVirtualItems();\n\n\t//different virtualization strategy for columns - instead of absolute and translateY, we add empty columns to the left and right\n\tlet virtualPaddingLeft: number | undefined;\n\tlet virtualPaddingRight: number | undefined;\n\n\tif (columnVirtualizer && virtualColumns?.length) {\n\t\tvirtualPaddingLeft = virtualColumns[0]?.start ?? 0;\n\t\tvirtualPaddingRight =\n\t\t\tcolumnVirtualizer.getTotalSize() - (virtualColumns[virtualColumns.length - 1]?.end ?? 0);\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"w-full flex-1 overflow-auto\"\n\t\t\tref={tableContainerRef}\n\t\t\tstyle={{\n\t\t\t\tposition: \"relative\",\n\t\t\t}}\n\t\t>\n\t\t\t{/* Even though we're still using sematic table tags, we must use CSS grid and flexbox for dynamic row heights */}\n\t\t\t<table style={{ display: \"grid\" }}>\n\t\t\t\t<TableHead\n\t\t\t\t\tcolumnVirtualizer={columnVirtualizer}\n\t\t\t\t\ttable={table}\n\t\t\t\t\tvirtualPaddingLeft={virtualPaddingLeft}\n\t\t\t\t\tvirtualPaddingRight={virtualPaddingRight}\n\t\t\t\t/>\n\t\t\t\t<TableBody\n\t\t\t\t\tcolumnVirtualizer={columnVirtualizer}\n\t\t\t\t\ttable={table}\n\t\t\t\t\ttableContainerRef={tableContainerRef as RefObject<HTMLDivElement>}\n\t\t\t\t\tvirtualPaddingLeft={virtualPaddingLeft as number | undefined}\n\t\t\t\t\tvirtualPaddingRight={virtualPaddingRight}\n\t\t\t\t/>\n\t\t\t</table>\n\t\t</div>\n\t);\n};\n","import { cn } from \"@db-studio/ui/utils\";\nimport type { OnChangeFn, Row, RowSelectionState, Table } from \"@tanstack/react-table\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { TableHeader } from \"./header/table-header\";\nimport { TableContainer } from \"./table-container\";\nimport { TableFooter } from \"./table-footer\";\n\nexport const TableGrid = ({\n\ttable,\n\ttableName,\n\tselectedRows,\n\tsetRowSelection,\n}: {\n\ttable: Table<TableRecord>;\n\ttableName: string;\n\tselectedRows: Row<TableRecord>[];\n\tsetRowSelection: OnChangeFn<RowSelectionState>;\n}) => (\n\t<div className={cn(\"flex-1 w-full flex flex-col overflow-hidden pb-9\")}>\n\t\t<TableHeader\n\t\t\tselectedRows={selectedRows}\n\t\t\tsetRowSelection={setRowSelection}\n\t\t\ttableName={tableName}\n\t\t/>\n\t\t<TableContainer table={table} />\n\t\t<TableFooter tableName={tableName} />\n\t</div>\n);\n","import { Spinner } from \"@db-studio/ui/spinner\";\n\nexport const TableLoadingState = () => (\n\t<div className=\"size-full flex items-center justify-center\">\n\t\t<Spinner size=\"size-7\" />\n\t</div>\n);\n","import { useMemo } from \"react\";\nimport { useTableCols } from \"@/features/schema\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport type { TableRecord } from \"@/types/table.type\";\nimport { useTableData } from \"../hooks/use-table-data\";\nimport { useTableModel } from \"../hooks/use-table-model\";\nimport { TableDocumentView } from \"./table-document-view\";\nimport { TableEmptyState } from \"./table-empty-state\";\nimport { TableErrorState } from \"./table-error-state\";\nimport { TableGrid } from \"./table-grid\";\nimport { TableLoadingState } from \"./table-loading-state\";\n\nexport const TableTabContainer = ({ tableName }: { tableName: string }) => {\n\tconst { dbType } = useDatabaseStore();\n\tconst { tableData, isLoadingTableData, errorTableData } = useTableData({\n\t\ttableName,\n\t});\n\tconst { tableCols, isLoadingTableCols, errorTableCols } = useTableCols({\n\t\ttableName,\n\t});\n\n\tconst tableDataRows = useMemo<TableRecord[]>(() => tableData?.data || [], [tableData?.data]);\n\n\tconst { table, selectedRows, setRowSelection } = useTableModel({\n\t\ttableName,\n\t\ttableCols,\n\t\ttableDataRows,\n\t});\n\n\tif (isLoadingTableData || isLoadingTableCols) {\n\t\treturn <TableLoadingState />;\n\t}\n\n\tif (errorTableData || errorTableCols) {\n\t\treturn (\n\t\t\t<TableErrorState\n\t\t\t\ttableName={tableName}\n\t\t\t\terrorTableData={errorTableData}\n\t\t\t\terrorTableCols={errorTableCols}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst hasNoData = !tableData?.data || tableData.data.length === 0;\n\n\tif (hasNoData) {\n\t\treturn (\n\t\t\t<TableEmptyState\n\t\t\t\ttableName={tableName}\n\t\t\t\tselectedRows={selectedRows}\n\t\t\t\tsetRowSelection={setRowSelection}\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if (dbType === \"mongodb\" || dbType === \"redis\") {\n\tif (dbType === \"mongodb\") {\n\t\treturn (\n\t\t\t<TableDocumentView\n\t\t\t\ttableName={tableName}\n\t\t\t\trows={tableDataRows}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TableGrid\n\t\t\ttable={table}\n\t\t\ttableName={tableName}\n\t\t\tselectedRows={selectedRows}\n\t\t\tsetRowSelection={setRowSelection}\n\t\t/>\n\t);\n};\n","import { TableTabContainer } from \"./table-tab-container\";\n\nexport const TableTab = TableTabContainer;\n","import {\n\tAddRecordForm,\n\tBulkInsertCsvSheet,\n\tBulkInsertExcelSheet,\n\tBulkInsertJsonSheet,\n\tBulkInsertSheet,\n} from \"@/features/records\";\nimport { TableTab } from \"../components/table-tab\";\n\nexport const TableScreen = ({ tableName }: { tableName: string }) => {\n\treturn (\n\t\t<main\n\t\t\tkey={tableName}\n\t\t\tclassName=\"flex-1 flex flex-col overflow-hidden\"\n\t\t>\n\t\t\t<TableTab tableName={tableName} />\n\n\t\t\t<AddRecordForm tableName={tableName} />\n\t\t\t<BulkInsertSheet tableName={tableName} />\n\t\t\t<BulkInsertCsvSheet tableName={tableName} />\n\t\t\t<BulkInsertExcelSheet tableName={tableName} />\n\t\t\t<BulkInsertJsonSheet tableName={tableName} />\n\t\t</main>\n\t);\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport {\n\tCommand,\n\tCommandEmpty,\n\tCommandGroup,\n\tCommandInput,\n\tCommandItem,\n\tCommandList,\n} from \"@db-studio/ui/command\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@db-studio/ui/popover\";\nimport { cn } from \"@db-studio/ui/utils\";\nimport { CheckIcon, ChevronDownIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport type { AddTableFormData, ForeignKeyData } from \"@/features/table-builder/types\";\nimport { useTablesList } from \"@/features/tables\";\n\nexport const ReferencedTableField = ({ index }: { index: number }) => {\n\tconst [open, setOpen] = useState<boolean>(false);\n\tconst { tablesList, isLoadingTablesList } = useTablesList();\n\tconst { control, watch, setValue, getValues } = useFormContext<AddTableFormData>();\n\n\tconst columnName = watch(`fields.${index}.columnName`);\n\n\tconst ensureForeignKeyExists = () => {\n\t\tconst currentForeignKeys = getValues(\"foreignKeys\") || [];\n\t\tif (!currentForeignKeys[index]) {\n\t\t\tconst paddedArray: ForeignKeyData[] = [...currentForeignKeys];\n\t\t\tpaddedArray.push({\n\t\t\t\tcolumnName: \"\",\n\t\t\t\treferencedTable: \"\",\n\t\t\t\treferencedColumn: \"\",\n\t\t\t\tonUpdate: \"NO ACTION\" as const,\n\t\t\t\tonDelete: \"NO ACTION\" as const,\n\t\t\t});\n\t\t\tsetValue(\"foreignKeys\", paddedArray);\n\t\t}\n\t};\n\n\treturn (\n\t\t<Controller\n\t\t\tcontrol={control}\n\t\t\tname={`foreignKeys.${index}`}\n\t\t\trender={({ field }) => (\n\t\t\t\t<div className=\"flex flex-col gap-2\">\n\t\t\t\t\t<Label htmlFor=\"referencedTable\">Select a table to reference to</Label>\n\t\t\t\t\t<Popover\n\t\t\t\t\t\tonOpenChange={(isOpen) => {\n\t\t\t\t\t\t\tif (isOpen) {\n\t\t\t\t\t\t\t\tensureForeignKeyExists();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetOpen(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\topen={open}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\taria-expanded={open}\n\t\t\t\t\t\t\t\taria-controls=\"referencedTable-listbox\"\n\t\t\t\t\t\t\t\tclassName=\"w-full justify-between border-input bg-background px-3 font-normal outline-none outline-offset-0 hover:bg-background focus-visible:outline-[3px]\"\n\t\t\t\t\t\t\t\tid=\"referencedTable\"\n\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\tdisabled={isLoadingTablesList}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\"truncate\",\n\t\t\t\t\t\t\t\t\t\t!field.value?.referencedTable && \"text-muted-foreground\",\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{field.value?.referencedTable || \"---\"}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<ChevronDownIcon\n\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\tclassName=\"shrink-0 text-muted-foreground/80\"\n\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PopoverTrigger>\n\t\t\t\t\t\t<PopoverContent\n\t\t\t\t\t\t\tid=\"referencedTable-listbox\"\n\t\t\t\t\t\t\talign=\"start\"\n\t\t\t\t\t\t\tclassName=\"w-full min-w-(--radix-popper-anchor-width) border-input p-0\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Command>\n\t\t\t\t\t\t\t\t<CommandInput placeholder=\"Search table...\" />\n\t\t\t\t\t\t\t\t<CommandList>\n\t\t\t\t\t\t\t\t\t<CommandEmpty>No table found.</CommandEmpty>\n\t\t\t\t\t\t\t\t\t<CommandGroup>\n\t\t\t\t\t\t\t\t\t\t{tablesList?.map((table) => (\n\t\t\t\t\t\t\t\t\t\t\t<CommandItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={table.tableName}\n\t\t\t\t\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfield.onChange({\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t...field.value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treferencedTable: table.tableName,\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetValue(`foreignKeys.${index}.columnName`, columnName);\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetOpen(false);\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={table.tableName}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{table.tableName}\n\t\t\t\t\t\t\t\t\t\t\t\t{field.value?.referencedTable === table.tableName && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<CheckIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"ml-auto\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t</CommandItem>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</CommandGroup>\n\t\t\t\t\t\t\t\t</CommandList>\n\t\t\t\t\t\t\t</Command>\n\t\t\t\t\t\t</PopoverContent>\n\t\t\t\t\t</Popover>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport { Sheet, SheetContent, SheetHeader, SheetTitle } from \"@db-studio/ui/sheet\";\nimport { useFieldArray, useFormContext } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { ForeignKeySelectorField } from \"./foreign-key-selector-field\";\nimport { ReferencedTableField } from \"./referenced-table-field\";\n\nexport const AddForeignKeyForm = ({ index }: { index: number }) => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { control } = useFormContext<AddTableFormData>();\n\n\tconst { remove: removeForeignKeys } = useFieldArray({\n\t\tcontrol,\n\t\tname: \"foreignKeys\",\n\t});\n\n\tconst resetForeignKey = () => {\n\t\tremoveForeignKeys(index);\n\t\tcloseOverlay(`table-builder.add-foreign-key-${index}`);\n\t};\n\n\treturn (\n\t\t<Sheet\n\t\t\topen={isOverlayOpen(`table-builder.add-foreign-key-${index}`)}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\tcloseOverlay(`table-builder.add-foreign-key-${index}`);\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<SheetContent className=\"max-w-lg!\">\n\t\t\t\t<SheetHeader>\n\t\t\t\t\t<SheetTitle>Add foreign key relationship</SheetTitle>\n\t\t\t\t</SheetHeader>\n\t\t\t\t<div className=\"flex flex-col justify-between px-5 py-6 h-full flex-1\">\n\t\t\t\t\t<div className=\"space-y-6 flex-1\">\n\t\t\t\t\t\t<ReferencedTableField index={index} />\n\t\t\t\t\t\t<ForeignKeySelectorField index={index} />\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\tonClick={resetForeignKey}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"text-xs\">Reset Foreign Key</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</SheetContent>\n\t\t</Sheet>\n\t);\n};\n","import { Button } from \"@db-studio/ui/button\";\nimport { XIcon } from \"lucide-react\";\nimport { useFormContext, useWatch } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\nimport { AddForeignKeyForm } from \"./add-foreign-key/add-foreign-key-form\";\nimport { AdvancedOptions } from \"./fields/advanced-options\";\nimport { ColumnNameField } from \"./fields/column-name-field\";\nimport { ColumnTypeField } from \"./fields/column-type-field\";\nimport { DefaultValueField } from \"./fields/default-value-field\";\nimport { PrimaryField } from \"./fields/primary-field\";\n\nexport const FieldRow = ({\n\tindex,\n\tonRemove,\n\tcanRemove,\n}: {\n\tindex: number;\n\tonRemove: () => void;\n\tcanRemove: boolean;\n}) => {\n\tconst { control } = useFormContext<AddTableFormData>();\n\tconst isPrimaryKey = useWatch({\n\t\tcontrol,\n\t\tname: `fields.${index}.isPrimaryKey`,\n\t});\n\n\treturn (\n\t\t<div className=\"grid grid-cols-4 gap-4\">\n\t\t\t<ColumnNameField index={index} />\n\t\t\t<ColumnTypeField index={index} />\n\t\t\t<DefaultValueField index={index} />\n\n\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t<PrimaryField index={index} />\n\t\t\t\t<AdvancedOptions\n\t\t\t\t\tindex={index}\n\t\t\t\t\tisDisabled={Boolean(isPrimaryKey)}\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"flex items-end justify-center\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tclassName=\"size-9\"\n\t\t\t\t\t\tonClick={onRemove}\n\t\t\t\t\t\tdisabled={!canRemove}\n\t\t\t\t\t>\n\t\t\t\t\t\t<XIcon className=\"size-4\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<AddForeignKeyForm index={index} />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { Alert } from \"@db-studio/ui/alert\";\nimport { Button } from \"@db-studio/ui/button\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { useFieldArray, useFormContext, useWatch } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\nimport { FieldRow } from \"./field-row\";\n\nexport const FormContent = () => {\n\tconst { control } = useFormContext<AddTableFormData>();\n\n\tconst { fields, append, remove } = useFieldArray({ control, name: \"fields\" });\n\tconst { remove: removeForeignKeys } = useFieldArray({ control, name: \"foreignKeys\" });\n\n\tconst watchedFields = useWatch({ control, name: \"fields\" });\n\n\tconst addField = () => {\n\t\tappend({\n\t\t\tcolumnName: \"\",\n\t\t\tcolumnType: \"\",\n\t\t\tdefaultValue: \"\",\n\t\t\tisPrimaryKey: false,\n\t\t\tisNullable: true,\n\t\t\tisUnique: false,\n\t\t\tisIdentity: false,\n\t\t\tisArray: false,\n\t\t});\n\t};\n\n\tconst removeField = (index: number) => {\n\t\tif (fields.length > 1) {\n\t\t\tremove(index);\n\t\t\tremoveForeignKeys(index);\n\t\t}\n\t};\n\n\tconst primaryFields = fields.reduce<{ field: (typeof fields)[number]; index: number }[]>(\n\t\t(acc, field, index) => {\n\t\t\tif (watchedFields?.[index]?.isPrimaryKey) acc.push({ field, index });\n\t\t\treturn acc;\n\t\t},\n\t\t[],\n\t);\n\n\tconst nonPrimaryFields = fields.reduce<{ field: (typeof fields)[number]; index: number }[]>(\n\t\t(acc, field, index) => {\n\t\t\tif (!watchedFields?.[index]?.isPrimaryKey) acc.push({ field, index });\n\t\t\treturn acc;\n\t\t},\n\t\t[],\n\t);\n\n\treturn (\n\t\t<div className=\"space-y-2\">\n\t\t\t{primaryFields.length > 1 && (\n\t\t\t\t<Alert\n\t\t\t\t\tvariant=\"info\"\n\t\t\t\t\ttitle=\"Composite primary key selected\"\n\t\t\t\t\tclassName=\"mb-6\"\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t<div className=\"grid grid-cols-4 px-2\">\n\t\t\t\t<Label className=\"text-xs\">Column Name</Label>\n\t\t\t\t<Label className=\"text-xs\">Column Type</Label>\n\t\t\t\t<Label className=\"text-xs\">Default Value</Label>\n\t\t\t\t<Label className=\"text-xs\">Primary</Label>\n\t\t\t</div>\n\n\t\t\t<div className=\"space-y-2\">\n\t\t\t\t{primaryFields.length > 0 && (\n\t\t\t\t\t<div className=\"bg-primary/10 rounded-lg px-2 py-3 space-y-2\">\n\t\t\t\t\t\t{primaryFields.map(({ field, index }) => (\n\t\t\t\t\t\t\t<FieldRow\n\t\t\t\t\t\t\t\tkey={field.id}\n\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\tonRemove={() => removeField(index)}\n\t\t\t\t\t\t\t\tcanRemove={fields.length > 1}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t{nonPrimaryFields.length > 0 && (\n\t\t\t\t\t<div className=\"space-y-2 px-2 py-3\">\n\t\t\t\t\t\t{nonPrimaryFields.map(({ field, index }) => (\n\t\t\t\t\t\t\t<FieldRow\n\t\t\t\t\t\t\t\tkey={field.id}\n\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\tonRemove={() => removeField(index)}\n\t\t\t\t\t\t\t\tcanRemove={fields.length > 1}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t<div className=\"border border-dashed border-input rounded-lg flex justify-center items-center p-6\">\n\t\t\t\t<Button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tonClick={addField}\n\t\t\t\t>\n\t\t\t\t\tAdd New Column\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../utils\";\nimport { Label } from \"./label\";\nimport { Separator } from \"./separator\";\n\nfunction _FieldSet({ className, ...props }: React.ComponentProps<\"fieldset\">) {\n\treturn (\n\t\t<fieldset\n\t\t\tdata-slot=\"field-set\"\n\t\t\tclassName={cn(\n\t\t\t\t\"gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldLegend({\n\tclassName,\n\tvariant = \"legend\",\n\t...props\n}: React.ComponentProps<\"legend\"> & { variant?: \"legend\" | \"label\" }) {\n\treturn (\n\t\t<legend\n\t\t\tdata-slot=\"field-legend\"\n\t\t\tdata-variant={variant}\n\t\t\tclassName={cn(\n\t\t\t\t\"mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"field-group\"\n\t\t\tclassName={cn(\n\t\t\t\t\"gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4 group/field-group @container/field-group flex w-full flex-col\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst fieldVariants = cva(\n\t\"data-[invalid=true]:text-destructive gap-2 group/field flex w-full\",\n\t{\n\t\tvariants: {\n\t\t\torientation: {\n\t\t\t\tvertical: \"flex-col [&>*]:w-full [&>.sr-only]:w-auto\",\n\t\t\t\thorizontal:\n\t\t\t\t\t\"flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n\t\t\t\tresponsive:\n\t\t\t\t\t\"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\torientation: \"vertical\",\n\t\t},\n\t},\n);\n\nfunction _Field({\n\tclassName,\n\torientation = \"vertical\",\n\t...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\tdata-slot=\"field\"\n\t\t\tdata-orientation={orientation}\n\t\t\tclassName={cn(fieldVariants({ orientation }), className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldContent({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"field-content\"\n\t\t\tclassName={cn(\n\t\t\t\t\"gap-0.5 group/field-content flex flex-1 flex-col leading-snug\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n\treturn (\n\t\t<Label\n\t\t\tdata-slot=\"field-label\"\n\t\t\tclassName={cn(\n\t\t\t\t\"has-data-checked:bg-primary/5 dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-sm has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug\",\n\t\t\t\t\"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"field-label\"\n\t\t\tclassName={cn(\n\t\t\t\t\"gap-2 text-xs/relaxed font-medium group-data-[disabled=true]/field:opacity-50 flex w-fit items-center leading-snug\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldDescription({ className, ...props }: React.ComponentProps<\"p\">) {\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"field-description\"\n\t\t\tclassName={cn(\n\t\t\t\t\"text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance\",\n\t\t\t\t\"last:mt-0 nth-last-2:-mt-1\",\n\t\t\t\t\"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction _FieldSeparator({\n\tchildren,\n\tclassName,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\tchildren?: React.ReactNode;\n}) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"field-separator\"\n\t\t\tdata-content={!!children}\n\t\t\tclassName={cn(\n\t\t\t\t\"-my-2 h-5 text-xs/relaxed group-data-[variant=outline]/field-group:-mb-2 relative\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<Separator className=\"absolute inset-0 top-1/2\" />\n\t\t\t{children && (\n\t\t\t\t<span\n\t\t\t\t\tclassName=\"text-muted-foreground px-2 bg-background relative mx-auto block w-fit\"\n\t\t\t\t\tdata-slot=\"field-separator-content\"\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nconst FieldErrorList = React.memo(function FieldErrorList({\n\terrors,\n}: {\n\terrors: Array<{ message?: string } | undefined>;\n}) {\n\tconst uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];\n\n\tif (uniqueErrors.length === 1) {\n\t\treturn <>{uniqueErrors[0]?.message}</>;\n\t}\n\n\treturn (\n\t\t<ul className=\"ml-4 flex list-disc flex-col gap-1\">\n\t\t\t{uniqueErrors.map(\n\t\t\t\t(error, index) =>\n\t\t\t\t\terror?.message && <li key={error?.message ?? index}>{error.message}</li>,\n\t\t\t)}\n\t\t</ul>\n\t);\n});\n\nfunction FieldError({\n\tclassName,\n\tchildren,\n\terrors,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\terrors?: Array<{ message?: string } | undefined>;\n}) {\n\tconst hasContent = children != null || (errors?.length ?? 0) > 0;\n\n\tif (!hasContent) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\trole=\"alert\"\n\t\t\tdata-slot=\"field-error\"\n\t\t\tclassName={cn(\"text-destructive text-xs/relaxed font-normal\", className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children ?? (errors && <FieldErrorList errors={errors} />)}\n\t\t</div>\n\t);\n}\n\nexport {\n\t_Field as Field,\n\t_FieldContent as FieldContent,\n\t_FieldDescription as FieldDescription,\n\t_FieldGroup as FieldGroup,\n\t_FieldLabel as FieldLabel,\n\t_FieldLegend as FieldLegend,\n\t_FieldSeparator as FieldSeparator,\n\t_FieldSet as FieldSet,\n\t_FieldTitle as FieldTitle,\n\tFieldError,\n};\n","import { FieldError } from \"@db-studio/ui/field\";\nimport { Input } from \"@db-studio/ui/input\";\nimport { Label } from \"@db-studio/ui/label\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport type { AddTableFormData } from \"@/features/table-builder/types\";\n\nexport const TableNameField = () => {\n\tconst {\n\t\tcontrol,\n\t\tregister,\n\t\tformState: { errors },\n\t} = useFormContext<AddTableFormData>();\n\n\treturn (\n\t\t<Controller\n\t\t\tcontrol={control}\n\t\t\tname=\"tableName\"\n\t\t\trender={() => (\n\t\t\t\t<div className=\"flex gap-24 px-2\">\n\t\t\t\t\t<Label htmlFor=\"tableName\">Table Name</Label>\n\t\t\t\t\t<div className=\"flex-1 space-y-1\">\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tid=\"tableName\"\n\t\t\t\t\t\t\t{...register(\"tableName\", {\n\t\t\t\t\t\t\t\trequired: \"Table name is required\",\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tclassName={errors.tableName ? \"border-destructive ring-destructive ring-1\" : \"\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{errors.tableName && <FieldError errors={[errors.tableName]} />}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t/>\n\t);\n};\n","import type { CreateTableSchemaType } from \"@db-studio/shared/types\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { toast } from \"sonner\";\nimport { posthogAnalytics } from \"@/lib/posthog\";\nimport { createTable as createTableRequest } from \"@/shared/api\";\nimport { tableKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\n\nexport const useCreateTable = () => {\n\tconst { closeOverlay } = useOverlayStore();\n\tconst queryClient = useQueryClient();\n\tconst { selectedDatabase, dbType } = useDatabaseStore();\n\n\tconst { mutateAsync: createTableMutation, isPending: isCreatingTable } = useMutation({\n\t\tmutationFn: async (data: CreateTableSchemaType) => {\n\t\t\tconst res = await createTableRequest(data, selectedDatabase);\n\t\t\treturn res.data.data;\n\t\t},\n\t\tonSuccess: async () => {\n\t\t\tawait Promise.all([\n\t\t\t\tqueryClient.invalidateQueries({ queryKey: tableKeys.lists() }),\n\t\t\t\tqueryClient.invalidateQueries({ queryKey: tableKeys.columns() }),\n\t\t\t]);\n\t\t\tcloseOverlay(\"table-builder.create-table\");\n\t\t\tif (dbType) posthogAnalytics.capture(\"table_created\", { db_type: dbType });\n\t\t},\n\t});\n\n\tconst createTable = async (\n\t\tdata: CreateTableSchemaType,\n\t\toptions: {\n\t\t\tonSuccess?: () => void;\n\t\t\tonError?: (error: Error & { detail?: string }) => void;\n\t\t},\n\t) => {\n\t\treturn toast.promise(createTableMutation(data, options), {\n\t\t\tloading: \"Creating table...\",\n\t\t\tsuccess: (message) => message || \"Table created successfully\",\n\t\t\terror: (error: Error & { detail?: string }) =>\n\t\t\t\terror.detail || error.message || \"Failed to create table\",\n\t\t});\n\t};\n\n\treturn {\n\t\tcreateTable,\n\t\tisCreatingTable,\n\t};\n};\n","import { z } from \"zod\";\n\nconst fieldSchema = z.object({\n\tcolumnName: z.string().min(1, \"Column name is required\"),\n\tcolumnType: z.string().min(1, \"Column type is required\"),\n\tdefaultValue: z.string(),\n\tisPrimaryKey: z.boolean(),\n\tisNullable: z.boolean(),\n\tisUnique: z.boolean(),\n\tisIdentity: z.boolean(),\n\tisArray: z.boolean(),\n});\n\nconst foreignKeySchema = z.object({\n\tcolumnName: z.string().min(1, \"Column name is required\"),\n\treferencedTable: z.string().min(1, \"Referenced table is required\"),\n\treferencedColumn: z.string().min(1, \"Referenced column is required\"),\n\tonUpdate: z\n\t\t.enum([\"CASCADE\", \"SET NULL\", \"SET DEFAULT\", \"RESTRICT\", \"NO ACTION\"])\n\t\t.default(\"NO ACTION\"),\n\tonDelete: z\n\t\t.enum([\"CASCADE\", \"SET NULL\", \"SET DEFAULT\", \"RESTRICT\", \"NO ACTION\"])\n\t\t.default(\"NO ACTION\"),\n});\n\nexport const addTableSchema = z.object({\n\ttableName: z.string().min(1, \"Table name is required\"),\n\tfields: z.array(fieldSchema).min(1, \"At least one column is required\"),\n\tforeignKeys: z.preprocess((val) => {\n\t\tif (!Array.isArray(val)) return undefined;\n\t\treturn val.filter((fk) => {\n\t\t\tif (fk === null || fk === undefined) return false;\n\t\t\tif (typeof fk === \"object\") {\n\t\t\t\tconst hasRequiredFields = fk.columnName && fk.referencedTable && fk.referencedColumn;\n\t\t\t\treturn hasRequiredFields;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}, z.array(foreignKeySchema).optional()),\n});\n\nexport type FieldData = z.infer<typeof fieldSchema>;\nexport type AddTableFormData = z.infer<typeof addTableSchema>;\nexport type ForeignKeyData = z.infer<typeof foreignKeySchema>;\n\nexport type AddTableOption = {\n\tname: keyof Pick<FieldData, \"isNullable\" | \"isUnique\" | \"isIdentity\" | \"isArray\">;\n\tlabel: string;\n\tdescription: string;\n};\n","import { zodResolver } from \"@hookform/resolvers/zod\";\nimport { type FieldErrors, FormProvider, useForm } from \"react-hook-form\";\nimport { toast } from \"sonner\";\nimport { SheetSidebar } from \"@/components/sheet-sidebar\";\nimport { useOverlayStore } from \"@/stores/overlay.store\";\nimport { FormActions } from \"../components/fields/form-actions\";\nimport { FormContent } from \"../components/form-content\";\nimport { TableNameField } from \"../components/table-name-field\";\nimport { useCreateTable } from \"../hooks/use-create-table\";\nimport { type AddTableFormData, addTableSchema } from \"../types\";\n\nconst defaultValues = {\n\ttableName: \"\",\n\tfields: [\n\t\t{\n\t\t\tcolumnName: \"\",\n\t\t\tcolumnType: \"\",\n\t\t\tdefaultValue: \"\",\n\t\t\tisPrimaryKey: false,\n\t\t\tisNullable: true,\n\t\t\tisUnique: false,\n\t\t\tisIdentity: false,\n\t\t\tisArray: false,\n\t\t},\n\t],\n\tforeignKeys: undefined,\n} satisfies AddTableFormData;\n\nexport const TableBuilderOverlay = () => {\n\tconst { closeOverlay, isOverlayOpen } = useOverlayStore();\n\tconst { createTable, isCreatingTable } = useCreateTable();\n\tconst methods = useForm({\n\t\tmode: \"onSubmit\",\n\t\tdefaultValues,\n\t\tresolver: zodResolver(addTableSchema),\n\t});\n\n\tconst onSubmit = async (data: AddTableFormData) => {\n\t\tconst cleanedData = {\n\t\t\t...data,\n\t\t\tforeignKeys: data.foreignKeys?.filter((fk) => {\n\t\t\t\tif (fk === null) return true;\n\t\t\t\treturn fk.columnName && fk.referencedTable && fk.referencedColumn;\n\t\t\t}),\n\t\t};\n\n\t\ttry {\n\t\t\tawait createTable(cleanedData, {\n\t\t\t\tonSuccess: () => {\n\t\t\t\t\tmethods.reset();\n\t\t\t\t},\n\t\t\t\tonError: (error) => {\n\t\t\t\t\tconsole.error(\"Error creating table:\", error);\n\t\t\t\t},\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error creating table:\", error);\n\t\t}\n\t};\n\n\tconst onError = (errors: FieldErrors<AddTableFormData>) => {\n\t\tif (errors.tableName?.message) {\n\t\t\ttoast.error(errors.tableName.message);\n\t\t\treturn;\n\t\t}\n\n\t\tif (errors.fields && Array.isArray(errors.fields)) {\n\t\t\tfor (const field of errors.fields) {\n\t\t\t\tif (field?.columnName?.message) {\n\t\t\t\t\ttoast.error(field.columnName.message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (field?.columnType?.message) {\n\t\t\t\t\ttoast.error(field.columnType.message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (errors.foreignKeys && Array.isArray(errors.foreignKeys)) {\n\t\t\tfor (const fk of errors.foreignKeys) {\n\t\t\t\tif (fk?.columnName?.message) {\n\t\t\t\t\ttoast.error(fk.columnName.message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (fk?.referencedTable?.message) {\n\t\t\t\t\ttoast.error(fk.referencedTable.message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (fk?.referencedColumn?.message) {\n\t\t\t\t\ttoast.error(fk.referencedColumn.message);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttoast.error(\"Please check the form for errors\");\n\t};\n\n\tconst handleCancel = () => {\n\t\tmethods.reset();\n\t\tcloseOverlay(\"table-builder.create-table\");\n\t};\n\n\treturn (\n\t\t<SheetSidebar\n\t\t\ttitle=\"Create a new table\"\n\t\t\topen={isOverlayOpen(\"table-builder.create-table\")}\n\t\t\tonOpenChange={(open) => {\n\t\t\t\tif (!open) {\n\t\t\t\t\thandleCancel();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<FormProvider {...methods}>\n\t\t\t\t<form\n\t\t\t\t\tonSubmit={methods.handleSubmit(onSubmit, onError)}\n\t\t\t\t\tclassName=\"space-y-6\"\n\t\t\t\t>\n\t\t\t\t\t<TableNameField />\n\t\t\t\t\t<FormContent />\n\t\t\t\t\t<FormActions\n\t\t\t\t\t\tonCancel={handleCancel}\n\t\t\t\t\t\tisLoading={isCreatingTable}\n\t\t\t\t\t/>\n\t\t\t\t</form>\n\t\t\t</FormProvider>\n\t\t</SheetSidebar>\n\t);\n};\n","import { useQuery } from \"@tanstack/react-query\";\nimport { useEffect, useRef } from \"react\";\nimport {\n\tgetCurrentDatabase,\n\tgetDatabaseConnectionInfo,\n\tgetDatabases,\n\tsetDbType as setApiDbType,\n} from \"@/shared/api\";\nimport { databaseKeys } from \"@/shared/query/keys\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\n/**\n * Fetch all databases from the server\n */\nexport const useDatabasesList = () => {\n\tconst { setDbType, selectedDatabase, setSelectedDatabase } = useDatabaseStore();\n\tconst {\n\t\tdata,\n\t\tisLoading: isLoadingDatabases,\n\t\terror: databasesError,\n\t\trefetch: refetchDatabases,\n\t\tisRefetching: isRefetchingDatabases,\n\t} = useQuery({\n\t\tqueryKey: databaseKeys.list(),\n\t\tqueryFn: getDatabases,\n\t\tselect: (response) => response.data.data,\n\t\tstaleTime: 1000 * 60 * 5, // 5 minutes\n\t});\n\n\tuseEffect(() => {\n\t\tif (data?.dbType) {\n\t\t\tsetDbType(data.dbType);\n\t\t\tsetApiDbType(data.dbType);\n\t\t}\n\t\tif (!selectedDatabase && data?.databases?.length) {\n\t\t\tsetSelectedDatabase(data.databases[0]?.name ?? null);\n\t\t}\n\t}, [data?.dbType, data?.databases, selectedDatabase, setDbType, setSelectedDatabase]);\n\n\treturn {\n\t\tdatabases: data?.databases,\n\t\tdbType: data?.dbType,\n\t\tisLoadingDatabases,\n\t\tdatabasesError,\n\t\trefetchDatabases,\n\t\tisRefetchingDatabases,\n\t};\n};\n\n/**\n * Initialize database connection and selected database.\n * Fetches current database, falls back to first database in list if none.\n * Shows loading until a database is selected.\n */\nexport const useInitializeDatabase = () => {\n\tconst { selectedDatabase, setSelectedDatabase, setDbType } = useDatabaseStore();\n\tconst hasInitializedRef = useRef(false);\n\n\t// First, fetch the databases list\n\tconst {\n\t\tdata: databasesData,\n\t\tisLoading: isLoadingDatabases,\n\t\terror: databasesError,\n\t} = useQuery({\n\t\tqueryKey: databaseKeys.list(),\n\t\tqueryFn: getDatabases,\n\t\tselect: (response) => response.data.data,\n\t\tstaleTime: 1000 * 60 * 5,\n\t});\n\n\t// Then fetch current database (only after databases list is loaded)\n\tconst {\n\t\tdata: currentDatabase,\n\t\tisLoading: isLoadingCurrentDatabase,\n\t\terror: currentDatabaseError,\n\t} = useQuery({\n\t\tqueryKey: databaseKeys.current(),\n\t\tqueryFn: async () => {\n\t\t\tconst res = await getCurrentDatabase();\n\n\t\t\t// init the api baseURL with the dbType from the first request\n\t\t\tsetDbType(res.data.data.dbType);\n\t\t\tsetApiDbType(res.data.data.dbType);\n\t\t\tif (!selectedDatabase && res.data.data.db) {\n\t\t\t\tsetSelectedDatabase(res.data.data.db);\n\t\t\t}\n\t\t\treturn res.data.data;\n\t\t},\n\t\tstaleTime: 1000 * 60 * 5,\n\t\tenabled: !!databasesData, // Only run after databases are loaded\n\t});\n\n\t// Initialize once requests settle so UI does not get stuck on the loading screen.\n\t// Run in an effect to avoid state updates during render.\n\tuseEffect(() => {\n\t\tif (hasInitializedRef.current) return;\n\t\tif (isLoadingDatabases || isLoadingCurrentDatabase) return;\n\n\t\thasInitializedRef.current = true;\n\t\tconst dbToSelect = currentDatabase?.db || databasesData?.databases?.[0]?.name;\n\t\tif (dbToSelect) {\n\t\t\tsetSelectedDatabase(dbToSelect);\n\t\t}\n\t}, [\n\t\tisLoadingDatabases,\n\t\tisLoadingCurrentDatabase,\n\t\tcurrentDatabase?.db,\n\t\tdatabasesData?.databases,\n\t\tsetSelectedDatabase,\n\t]);\n\n\tconst isLoading = isLoadingDatabases || isLoadingCurrentDatabase;\n\tconst isInitialized = hasInitializedRef.current;\n\n\treturn {\n\t\tcurrentDatabase,\n\t\tdatabases: databasesData?.databases,\n\t\tisLoading,\n\t\tisInitialized,\n\t\terror: databasesError || currentDatabaseError,\n\t};\n};\n\n/**\n * Fetch database connection information\n */\nexport const useDatabaseConnectionInfo = () => {\n\tconst {\n\t\tdata: connectionInfo,\n\t\tisLoading: isLoadingConnectionInfo,\n\t\terror: connectionInfoError,\n\t} = useQuery({\n\t\tqueryKey: databaseKeys.connectionInfo(),\n\t\tqueryFn: getDatabaseConnectionInfo,\n\t\tselect: (response) => response.data.data,\n\t\tstaleTime: 1000 * 60 * 5, // 5 minutes\n\t});\n\n\treturn { connectionInfo, isLoadingConnectionInfo, connectionInfoError };\n};\n","import { useEffect } from \"react\";\nimport { usePersonalPreferencesStore } from \"@/stores/personal-preferences.store\";\n\nexport function useTheme() {\n\tconst theme = usePersonalPreferencesStore((state) => state.theme);\n\n\tuseEffect(() => {\n\t\tconst root = window.document.documentElement;\n\n\t\troot.classList.remove(\"light\", \"dark\");\n\n\t\tif (theme === \"system\") {\n\t\t\tconst systemTheme = window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n\t\t\t\t? \"dark\"\n\t\t\t\t: \"light\";\n\n\t\t\troot.classList.add(systemTheme);\n\t\t\treturn;\n\t\t}\n\n\t\troot.classList.add(theme);\n\t}, [theme]);\n}\n","import { Toaster } from \"@db-studio/ui/sonner\";\nimport { Spinner } from \"@db-studio/ui/spinner\";\nimport { aiDevtoolsPlugin } from \"@tanstack/react-ai-devtools\";\nimport { TanStackDevtools } from \"@tanstack/react-devtools\";\nimport { ReactQueryDevtools } from \"@tanstack/react-query-devtools\";\nimport { createRootRoute, Outlet } from \"@tanstack/react-router\";\nimport { TanStackRouterDevtoolsPanel } from \"@tanstack/react-router-devtools\";\nimport { NuqsAdapter } from \"nuqs/adapters/react\";\nimport { useEffect } from \"react\";\nimport { TableBuilderOverlay } from \"@/features/table-builder\";\nimport { useInitializeDatabase } from \"@/hooks/use-databases-list\";\nimport { useTheme } from \"@/hooks/use-theme\";\nimport { posthogAnalytics } from \"@/lib/posthog\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\nconst darkModeScript = String.raw`\n try {\n document.documentElement.classList.add('dark')\n document.querySelector('meta[name=\"theme-color\"]').setAttribute('content', '#09090b')\n } catch (_) {}\n\n try {\n if (/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {\n document.documentElement.classList.add('os-macos')\n }\n } catch (_) {}\n`;\n\nconst connectDevtoolsServerBus =\n\timport.meta.env.DEV && import.meta.env.VITE_TANSTACK_SERVER_BUS === \"true\";\n\nexport const Route = createRootRoute({\n\tcomponent: function RootRouteComponent() {\n\t\tuseTheme();\n\n\t\tconst { dbType } = useDatabaseStore();\n\t\t// Initialize database connection when the component mounts, fetches databases list, current db, and selects first db as fallback\n\t\tconst { isLoading, isInitialized, error } = useInitializeDatabase();\n\n\t\tuseEffect(() => {\n\t\t\tif (error && dbType) {\n\t\t\t\tposthogAnalytics.capture(\"connection_error\", {\n\t\t\t\t\tdb_type: dbType,\n\t\t\t\t\tstatus: (error as { status?: number })?.status ?? 0,\n\t\t\t\t});\n\t\t\t}\n\t\t}, [error, dbType]);\n\n\t\t// Show loading until both queries complete AND database is initialized in store\n\t\tconst showLoading = (isLoading || !isInitialized) && !error;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<script\n\t\t\t\t\tdefer\n\t\t\t\t\tsrc={`data:text/javascript;base64,${btoa(darkModeScript)}`}\n\t\t\t\t/>\n\n\t\t\t\t<NuqsAdapter\n\t\t\t\t\tfullPageNavigationOnShallowFalseUpdates\n\t\t\t\t\tdefaultOptions={{ shallow: true, clearOnDefault: true }}\n\t\t\t\t>\n\t\t\t\t\t{showLoading ? (\n\t\t\t\t\t\t<div className=\"flex items-center justify-center h-screen\">\n\t\t\t\t\t\t\t<Spinner\n\t\t\t\t\t\t\t\tsize=\"size-8\"\n\t\t\t\t\t\t\t\tcolor=\"bg-primary\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : error ? (\n\t\t\t\t\t\t<div className=\"flex flex-col items-center justify-center h-screen gap-3 text-center\">\n\t\t\t\t\t\t\t<p className=\"text-destructive font-medium\">Failed to connect to the database</p>\n\t\t\t\t\t\t\t<p className=\"text-muted-foreground text-sm max-w-sm\">\n\t\t\t\t\t\t\t\t{(error as { message?: string })?.message ?? \"An unexpected error occurred\"}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Outlet />\n\t\t\t\t\t)}\n\t\t\t\t</NuqsAdapter>\n\t\t\t\t<Toaster position=\"top-right\" />\n\t\t\t\t{/* Global overlays */}\n\t\t\t\t<TableBuilderOverlay />\n\t\t\t\t{/* Devtools */}\n\t\t\t\t<TanStackDevtools\n\t\t\t\t\tconfig={{\n\t\t\t\t\t\tposition: \"bottom-right\",\n\t\t\t\t\t}}\n\t\t\t\t\tplugins={[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: \"Tanstack Router\",\n\t\t\t\t\t\t\trender: <TanStackRouterDevtoolsPanel />,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: \"React Query\",\n\t\t\t\t\t\t\trender: (\n\t\t\t\t\t\t\t\t<ReactQueryDevtools\n\t\t\t\t\t\t\t\t\tinitialIsOpen={false}\n\t\t\t\t\t\t\t\t\tbuttonPosition=\"bottom-left\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\taiDevtoolsPlugin(),\n\t\t\t\t\t]}\n\t\t\t\t\teventBusConfig={{\n\t\t\t\t\t\tconnectToServerBus: connectDevtoolsServerBus,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n});\n","import { createFileRoute, Navigate, Outlet, useLocation } from \"@tanstack/react-router\";\nimport { Header } from \"@/components/components/header\";\nimport { Sidebar } from \"@/components/sidebar/sidebar\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\nimport { usePersonalPreferencesStore } from \"@/stores/personal-preferences.store\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\tconst { dbType } = useDatabaseStore();\n\tconst { pathname } = useLocation();\n\tconst section = pathname.split(\"/\")[1];\n\tconst {\n\t\tsidebar: { isPinned, width },\n\t} = usePersonalPreferencesStore();\n\tif (dbType === \"redis\" && section !== \"browser\" && section !== \"runner\") {\n\t\treturn <Navigate to=\"/browser\" />;\n\t}\n\tif (dbType !== \"redis\" && section === \"browser\") {\n\t\treturn <Navigate to=\"/\" />;\n\t}\n\n\treturn (\n\t\t<div className=\"bg-zinc-950 w-dvw flex h-dvh max-h-dvh overflow-hidden relative\">\n\t\t\t<Sidebar />\n\n\t\t\t<div\n\t\t\t\tclassName=\"flex-1 flex flex-col h-full overflow-hidden \"\n\t\t\t\tstyle={{\n\t\t\t\t\tmarginLeft: isPinned ? `${width}px` : \"0\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<Header />\n\t\t\t\t<Outlet />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","import { createFileRoute, Navigate } from \"@tanstack/react-router\";\nimport { useDatabaseStore } from \"@/stores/database.store\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\tconst { dbType } = useDatabaseStore();\n\tif (dbType === \"redis\") return <Navigate to=\"/browser\" />;\n\treturn (\n\t\t<main className=\"flex-1 flex items-center justify-center\">\n\t\t\tSelect a tab to get started\n\t\t</main>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/visualizer\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\treturn (\n\t\t<main className=\"flex-1 flex items-center justify-center\">\n\t\t\tVisualizer will be available soon!\n\t\t</main>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/logs\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\treturn (\n\t\t<main className=\"flex-1 flex items-center justify-center\">\n\t\t\tLogs will be available soon!\n\t\t</main>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/indexes\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\treturn (\n\t\t<main className=\"flex-1 flex items-center justify-center\">\n\t\t\tIndexes will be available soon!\n\t\t</main>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\nimport { RedisBrowserScreen } from \"@/features/redis-browser\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/browser\")({\n\tcomponent: RedisBrowserScreen,\n});\n","import { createFileRoute } from \"@tanstack/react-router\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/table/\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\treturn (\n\t\t<div className=\"flex-1 flex items-center justify-center\">Select a table to view data</div>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/schema/\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\treturn (\n\t\t<main className=\"flex-1 flex items-center justify-center\">\n\t\t\tSelect a table to view its schema\n\t\t</main>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\nimport { RunnerScreen } from \"@/features/query-runner\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/runner/\")({\n\tvalidateSearch: (search: Record<string, unknown>): { cmd?: string } =>\n\t\ttypeof search.cmd === \"string\" ? { cmd: search.cmd } : {},\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\tconst { cmd } = Route.useSearch();\n\treturn <RunnerScreen initialQuery={cmd} />;\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\nimport { SchemaScreen } from \"@/features/schema\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/schema/$table\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\tconst { table } = Route.useParams();\n\n\treturn (\n\t\t<main className=\"flex-1 flex flex-col overflow-hidden\">\n\t\t\t<SchemaScreen tableName={table} />\n\t\t</main>\n\t);\n}\n","import { createFileRoute } from \"@tanstack/react-router\";\nimport { RunnerScreen } from \"@/features/query-runner\";\n\nexport const Route = createFileRoute(\"/_pathlessLayout/runner/$queryId\")({\n\tcomponent: RouteComponent,\n});\n\nfunction RouteComponent() {\n\tconst { queryId } = Route.useParams();\n\treturn <RunnerScreen queryId={queryId} />;\n}\n","/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PathlessLayoutIndexRouteImport } from './routes/_pathlessLayout/index'\nimport { Route as PathlessLayoutVisualizerRouteImport } from './routes/_pathlessLayout/visualizer'\nimport { Route as PathlessLayoutLogsRouteImport } from './routes/_pathlessLayout/logs'\nimport { Route as PathlessLayoutIndexesRouteImport } from './routes/_pathlessLayout/indexes'\nimport { Route as PathlessLayoutBrowserRouteImport } from './routes/_pathlessLayout/browser'\nimport { Route as PathlessLayoutTableIndexRouteImport } from './routes/_pathlessLayout/table/index'\nimport { Route as PathlessLayoutSchemaIndexRouteImport } from './routes/_pathlessLayout/schema/index'\nimport { Route as PathlessLayoutRunnerIndexRouteImport } from './routes/_pathlessLayout/runner/index'\nimport { Route as PathlessLayoutTableTableRouteImport } from './routes/_pathlessLayout/table/$table'\nimport { Route as PathlessLayoutSchemaTableRouteImport } from './routes/_pathlessLayout/schema/$table'\nimport { Route as PathlessLayoutRunnerQueryIdRouteImport } from './routes/_pathlessLayout/runner/$queryId'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n id: '/_pathlessLayout',\n getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutIndexRoute = PathlessLayoutIndexRouteImport.update({\n id: '/',\n path: '/',\n getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst PathlessLayoutVisualizerRoute =\n PathlessLayoutVisualizerRouteImport.update({\n id: '/visualizer',\n path: '/visualizer',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\nconst PathlessLayoutLogsRoute = PathlessLayoutLogsRouteImport.update({\n id: '/logs',\n path: '/logs',\n getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst PathlessLayoutIndexesRoute = PathlessLayoutIndexesRouteImport.update({\n id: '/indexes',\n path: '/indexes',\n getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst PathlessLayoutBrowserRoute = PathlessLayoutBrowserRouteImport.update({\n id: '/browser',\n path: '/browser',\n getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst PathlessLayoutTableIndexRoute =\n PathlessLayoutTableIndexRouteImport.update({\n id: '/table/',\n path: '/table/',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\nconst PathlessLayoutSchemaIndexRoute =\n PathlessLayoutSchemaIndexRouteImport.update({\n id: '/schema/',\n path: '/schema/',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\nconst PathlessLayoutRunnerIndexRoute =\n PathlessLayoutRunnerIndexRouteImport.update({\n id: '/runner/',\n path: '/runner/',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\nconst PathlessLayoutTableTableRoute =\n PathlessLayoutTableTableRouteImport.update({\n id: '/table/$table',\n path: '/table/$table',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\nconst PathlessLayoutSchemaTableRoute =\n PathlessLayoutSchemaTableRouteImport.update({\n id: '/schema/$table',\n path: '/schema/$table',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\nconst PathlessLayoutRunnerQueryIdRoute =\n PathlessLayoutRunnerQueryIdRouteImport.update({\n id: '/runner/$queryId',\n path: '/runner/$queryId',\n getParentRoute: () => PathlessLayoutRoute,\n } as any)\n\nexport interface FileRoutesByFullPath {\n '/': typeof PathlessLayoutIndexRoute\n '/browser': typeof PathlessLayoutBrowserRoute\n '/indexes': typeof PathlessLayoutIndexesRoute\n '/logs': typeof PathlessLayoutLogsRoute\n '/visualizer': typeof PathlessLayoutVisualizerRoute\n '/runner/$queryId': typeof PathlessLayoutRunnerQueryIdRoute\n '/schema/$table': typeof PathlessLayoutSchemaTableRoute\n '/table/$table': typeof PathlessLayoutTableTableRoute\n '/runner/': typeof PathlessLayoutRunnerIndexRoute\n '/schema/': typeof PathlessLayoutSchemaIndexRoute\n '/table/': typeof PathlessLayoutTableIndexRoute\n}\nexport interface FileRoutesByTo {\n '/browser': typeof PathlessLayoutBrowserRoute\n '/indexes': typeof PathlessLayoutIndexesRoute\n '/logs': typeof PathlessLayoutLogsRoute\n '/visualizer': typeof PathlessLayoutVisualizerRoute\n '/': typeof PathlessLayoutIndexRoute\n '/runner/$queryId': typeof PathlessLayoutRunnerQueryIdRoute\n '/schema/$table': typeof PathlessLayoutSchemaTableRoute\n '/table/$table': typeof PathlessLayoutTableTableRoute\n '/runner': typeof PathlessLayoutRunnerIndexRoute\n '/schema': typeof PathlessLayoutSchemaIndexRoute\n '/table': typeof PathlessLayoutTableIndexRoute\n}\nexport interface FileRoutesById {\n __root__: typeof rootRouteImport\n '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n '/_pathlessLayout/browser': typeof PathlessLayoutBrowserRoute\n '/_pathlessLayout/indexes': typeof PathlessLayoutIndexesRoute\n '/_pathlessLayout/logs': typeof PathlessLayoutLogsRoute\n '/_pathlessLayout/visualizer': typeof PathlessLayoutVisualizerRoute\n '/_pathlessLayout/': typeof PathlessLayoutIndexRoute\n '/_pathlessLayout/runner/$queryId': typeof PathlessLayoutRunnerQueryIdRoute\n '/_pathlessLayout/schema/$table': typeof PathlessLayoutSchemaTableRoute\n '/_pathlessLayout/table/$table': typeof PathlessLayoutTableTableRoute\n '/_pathlessLayout/runner/': typeof PathlessLayoutRunnerIndexRoute\n '/_pathlessLayout/schema/': typeof PathlessLayoutSchemaIndexRoute\n '/_pathlessLayout/table/': typeof PathlessLayoutTableIndexRoute\n}\nexport interface FileRouteTypes {\n fileRoutesByFullPath: FileRoutesByFullPath\n fullPaths:\n | '/'\n | '/browser'\n | '/indexes'\n | '/logs'\n | '/visualizer'\n | '/runner/$queryId'\n | '/schema/$table'\n | '/table/$table'\n | '/runner/'\n | '/schema/'\n | '/table/'\n fileRoutesByTo: FileRoutesByTo\n to:\n | '/browser'\n | '/indexes'\n | '/logs'\n | '/visualizer'\n | '/'\n | '/runner/$queryId'\n | '/schema/$table'\n | '/table/$table'\n | '/runner'\n | '/schema'\n | '/table'\n id:\n | '__root__'\n | '/_pathlessLayout'\n | '/_pathlessLayout/browser'\n | '/_pathlessLayout/indexes'\n | '/_pathlessLayout/logs'\n | '/_pathlessLayout/visualizer'\n | '/_pathlessLayout/'\n | '/_pathlessLayout/runner/$queryId'\n | '/_pathlessLayout/schema/$table'\n | '/_pathlessLayout/table/$table'\n | '/_pathlessLayout/runner/'\n | '/_pathlessLayout/schema/'\n | '/_pathlessLayout/table/'\n fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n interface FileRoutesByPath {\n '/_pathlessLayout': {\n id: '/_pathlessLayout'\n path: ''\n fullPath: '/'\n preLoaderRoute: typeof PathlessLayoutRouteImport\n parentRoute: typeof rootRouteImport\n }\n '/_pathlessLayout/': {\n id: '/_pathlessLayout/'\n path: '/'\n fullPath: '/'\n preLoaderRoute: typeof PathlessLayoutIndexRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/visualizer': {\n id: '/_pathlessLayout/visualizer'\n path: '/visualizer'\n fullPath: '/visualizer'\n preLoaderRoute: typeof PathlessLayoutVisualizerRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/logs': {\n id: '/_pathlessLayout/logs'\n path: '/logs'\n fullPath: '/logs'\n preLoaderRoute: typeof PathlessLayoutLogsRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/indexes': {\n id: '/_pathlessLayout/indexes'\n path: '/indexes'\n fullPath: '/indexes'\n preLoaderRoute: typeof PathlessLayoutIndexesRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/browser': {\n id: '/_pathlessLayout/browser'\n path: '/browser'\n fullPath: '/browser'\n preLoaderRoute: typeof PathlessLayoutBrowserRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/table/': {\n id: '/_pathlessLayout/table/'\n path: '/table'\n fullPath: '/table/'\n preLoaderRoute: typeof PathlessLayoutTableIndexRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/schema/': {\n id: '/_pathlessLayout/schema/'\n path: '/schema'\n fullPath: '/schema/'\n preLoaderRoute: typeof PathlessLayoutSchemaIndexRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/runner/': {\n id: '/_pathlessLayout/runner/'\n path: '/runner'\n fullPath: '/runner/'\n preLoaderRoute: typeof PathlessLayoutRunnerIndexRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/table/$table': {\n id: '/_pathlessLayout/table/$table'\n path: '/table/$table'\n fullPath: '/table/$table'\n preLoaderRoute: typeof PathlessLayoutTableTableRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/schema/$table': {\n id: '/_pathlessLayout/schema/$table'\n path: '/schema/$table'\n fullPath: '/schema/$table'\n preLoaderRoute: typeof PathlessLayoutSchemaTableRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n '/_pathlessLayout/runner/$queryId': {\n id: '/_pathlessLayout/runner/$queryId'\n path: '/runner/$queryId'\n fullPath: '/runner/$queryId'\n preLoaderRoute: typeof PathlessLayoutRunnerQueryIdRouteImport\n parentRoute: typeof PathlessLayoutRoute\n }\n }\n}\n\ninterface PathlessLayoutRouteChildren {\n PathlessLayoutBrowserRoute: typeof PathlessLayoutBrowserRoute\n PathlessLayoutIndexesRoute: typeof PathlessLayoutIndexesRoute\n PathlessLayoutLogsRoute: typeof PathlessLayoutLogsRoute\n PathlessLayoutVisualizerRoute: typeof PathlessLayoutVisualizerRoute\n PathlessLayoutIndexRoute: typeof PathlessLayoutIndexRoute\n PathlessLayoutRunnerQueryIdRoute: typeof PathlessLayoutRunnerQueryIdRoute\n PathlessLayoutSchemaTableRoute: typeof PathlessLayoutSchemaTableRoute\n PathlessLayoutTableTableRoute: typeof PathlessLayoutTableTableRoute\n PathlessLayoutRunnerIndexRoute: typeof PathlessLayoutRunnerIndexRoute\n PathlessLayoutSchemaIndexRoute: typeof PathlessLayoutSchemaIndexRoute\n PathlessLayoutTableIndexRoute: typeof PathlessLayoutTableIndexRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n PathlessLayoutBrowserRoute: PathlessLayoutBrowserRoute,\n PathlessLayoutIndexesRoute: PathlessLayoutIndexesRoute,\n PathlessLayoutLogsRoute: PathlessLayoutLogsRoute,\n PathlessLayoutVisualizerRoute: PathlessLayoutVisualizerRoute,\n PathlessLayoutIndexRoute: PathlessLayoutIndexRoute,\n PathlessLayoutRunnerQueryIdRoute: PathlessLayoutRunnerQueryIdRoute,\n PathlessLayoutSchemaTableRoute: PathlessLayoutSchemaTableRoute,\n PathlessLayoutTableTableRoute: PathlessLayoutTableTableRoute,\n PathlessLayoutRunnerIndexRoute: PathlessLayoutRunnerIndexRoute,\n PathlessLayoutSchemaIndexRoute: PathlessLayoutSchemaIndexRoute,\n PathlessLayoutTableIndexRoute: PathlessLayoutTableIndexRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n ._addFileChildren(rootRouteChildren)\n ._addFileTypes<FileRouteTypes>()\n","import { QueryClientProvider } from \"@tanstack/react-query\";\nimport { createRouter, RouterProvider } from \"@tanstack/react-router\";\nimport { StrictMode } from \"react\";\nimport ReactDOM from \"react-dom/client\";\n\nimport \"./index.css\";\nimport { initPosthog } from \"@/lib/posthog\";\nimport { getQueryClient } from \"@/lib/query-client\";\nimport { initSentry } from \"@/lib/sentry\";\nimport { routeTree } from \"./routeTree.gen\";\n\ninitSentry();\ninitPosthog();\n\n// Create a new router instance\nconst router = createRouter({\n\trouteTree,\n\tcontext: {\n\t\tqueryClient: getQueryClient(),\n\t},\n\tdefaultPreload: \"intent\",\n\tscrollRestoration: true,\n\tdefaultStructuralSharing: true,\n});\n\n// Register the router instance for type safety\ndeclare module \"@tanstack/react-router\" {\n\tinterface Register {\n\t\trouter: typeof router;\n\t}\n}\n\n// Render the app\nconst rootElement = document.getElementById(\"root\");\nif (rootElement && !rootElement.innerHTML) {\n\tconst root = ReactDOM.createRoot(rootElement);\n\tconst queryClient = getQueryClient();\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<QueryClientProvider client={queryClient}>\n\t\t\t\t<RouterProvider router={router} />\n\t\t\t</QueryClientProvider>\n\t\t</StrictMode>,\n\t);\n}\n"],"file":"index-BtqHnOp0.js"}