@womp/kookie-ui 0.25.0 → 0.25.2
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.
- package/components.css +19 -3
- package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +4 -4
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-resizable.d.ts +6 -0
- package/dist/cjs/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/accordion.js +1 -1
- package/dist/cjs/components/accordion.js.map +4 -4
- package/dist/cjs/components/alert-dialog.js +1 -1
- package/dist/cjs/components/alert-dialog.js.map +4 -4
- package/dist/cjs/components/avatar.js +1 -1
- package/dist/cjs/components/avatar.js.map +4 -4
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +4 -4
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +4 -4
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +4 -4
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox-group.js.map +4 -4
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +4 -4
- package/dist/cjs/components/chip.js +1 -1
- package/dist/cjs/components/chip.js.map +4 -4
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +4 -4
- package/dist/cjs/components/context-menu.js +1 -1
- package/dist/cjs/components/context-menu.js.map +4 -4
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +4 -4
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +4 -4
- package/dist/cjs/components/index.js +2 -2
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/message-scroller.js +1 -1
- package/dist/cjs/components/message-scroller.js.map +4 -4
- package/dist/cjs/components/navbar.js +1 -1
- package/dist/cjs/components/navbar.js.map +4 -4
- package/dist/cjs/components/notice.js +1 -1
- package/dist/cjs/components/notice.js.map +4 -4
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +4 -4
- package/dist/cjs/components/radio-group.js +1 -1
- package/dist/cjs/components/radio-group.js.map +4 -4
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +4 -4
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/segmented-control.js.map +4 -4
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +4 -4
- package/dist/cjs/components/sheet.js +1 -1
- package/dist/cjs/components/sheet.js.map +4 -4
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +4 -4
- package/dist/cjs/components/sidebar.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +4 -4
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slider.js.map +4 -4
- package/dist/cjs/components/switch.js +1 -1
- package/dist/cjs/components/switch.js.map +4 -4
- package/dist/cjs/components/table.js +1 -1
- package/dist/cjs/components/table.js.map +4 -4
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +4 -4
- package/dist/cjs/components/text-area.js +1 -1
- package/dist/cjs/components/text-area.js.map +4 -4
- package/dist/cjs/components/text-field.js +2 -2
- package/dist/cjs/components/text-field.js.map +4 -4
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +4 -4
- package/dist/cjs/components/toggle.js +1 -1
- package/dist/cjs/components/toggle.js.map +4 -4
- package/dist/cjs/components/toolbar.d.ts.map +1 -1
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +4 -4
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +4 -4
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/index.d.ts.map +1 -1
- package/dist/cjs/helpers/index.js +4 -4
- package/dist/cjs/helpers/index.js.map +3 -3
- package/dist/cjs/helpers/theme-size.d.ts +8 -30
- package/dist/cjs/helpers/theme-size.d.ts.map +1 -1
- package/dist/cjs/helpers/theme-size.js +1 -1
- package/dist/cjs/helpers/theme-size.js.map +3 -3
- package/dist/cjs/hooks/theme-size.d.ts +32 -0
- package/dist/cjs/hooks/theme-size.d.ts.map +1 -0
- package/dist/cjs/hooks/theme-size.js +3 -0
- package/dist/cjs/hooks/theme-size.js.map +7 -0
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +4 -4
- package/dist/esm/chunk-3B25RLWX.js +3 -0
- package/dist/esm/chunk-3B25RLWX.js.map +7 -0
- package/dist/esm/{chunk-PF67GJ5D.js → chunk-3CY6H4TE.js} +2 -2
- package/dist/esm/chunk-3CY6H4TE.js.map +7 -0
- package/dist/esm/{chunk-2EXOL2BR.js → chunk-3L2MDOYC.js} +2 -2
- package/dist/esm/chunk-3L2MDOYC.js.map +7 -0
- package/dist/esm/{chunk-KNBSG2WA.js → chunk-5CFSNNYS.js} +2 -2
- package/dist/esm/chunk-5CFSNNYS.js.map +7 -0
- package/dist/esm/{chunk-4ABQ6CDI.js → chunk-5EBJOOXE.js} +2 -2
- package/dist/esm/chunk-5EBJOOXE.js.map +7 -0
- package/dist/esm/{chunk-E4EMG3RC.js → chunk-5L4DZ2D3.js} +2 -2
- package/dist/esm/chunk-5L4DZ2D3.js.map +7 -0
- package/dist/esm/chunk-5ON3XLRD.js +3 -0
- package/dist/esm/chunk-5ON3XLRD.js.map +7 -0
- package/dist/esm/{chunk-UZAS4PYM.js → chunk-5TJH35TF.js} +2 -2
- package/dist/esm/{chunk-GPQSC6GL.js → chunk-5XR5PTDR.js} +2 -2
- package/dist/esm/chunk-5XR5PTDR.js.map +7 -0
- package/dist/esm/{chunk-AOBY2OUZ.js → chunk-63MUJFVF.js} +2 -2
- package/dist/esm/chunk-63MUJFVF.js.map +7 -0
- package/dist/esm/chunk-6AUIIXXE.js +2 -0
- package/dist/esm/chunk-6AUIIXXE.js.map +7 -0
- package/dist/esm/{chunk-4Q5PUIDJ.js → chunk-6RJQ5LLP.js} +2 -2
- package/dist/esm/{chunk-YVZTQA2L.js → chunk-7B3XDZXZ.js} +2 -2
- package/dist/esm/chunk-7B3XDZXZ.js.map +7 -0
- package/dist/esm/{chunk-7IHBNDCE.js → chunk-7X7VWR3F.js} +2 -2
- package/dist/esm/chunk-7X7VWR3F.js.map +7 -0
- package/dist/esm/{chunk-45O3JZWQ.js → chunk-7XHE6TOA.js} +2 -2
- package/dist/esm/chunk-7XHE6TOA.js.map +7 -0
- package/dist/esm/chunk-AQ7VUGQQ.js +3 -0
- package/dist/esm/chunk-AQ7VUGQQ.js.map +7 -0
- package/dist/esm/{chunk-54HUG34P.js → chunk-BVFHJP5E.js} +2 -2
- package/dist/esm/chunk-BVFHJP5E.js.map +7 -0
- package/dist/esm/{chunk-CRCYUJMK.js → chunk-BXZSJKWA.js} +2 -2
- package/dist/esm/chunk-BXZSJKWA.js.map +7 -0
- package/dist/esm/{chunk-IQ2RMFOM.js → chunk-CQG4U5BR.js} +2 -2
- package/dist/esm/{chunk-YNCI5PY6.js → chunk-FPGBCCML.js} +2 -2
- package/dist/esm/chunk-FPGBCCML.js.map +7 -0
- package/dist/esm/{chunk-A7QRPXXB.js → chunk-HHSFAOIO.js} +2 -2
- package/dist/esm/chunk-HHSFAOIO.js.map +7 -0
- package/dist/esm/{chunk-NMQGDBLD.js → chunk-MQEWEAH5.js} +2 -2
- package/dist/esm/chunk-MQEWEAH5.js.map +7 -0
- package/dist/esm/{chunk-YIKLO2XL.js → chunk-N3QLHFHB.js} +2 -2
- package/dist/esm/chunk-N3QLHFHB.js.map +7 -0
- package/dist/esm/{chunk-LCG3JZ3C.js → chunk-N5H7C3PZ.js} +2 -2
- package/dist/esm/chunk-N5H7C3PZ.js.map +7 -0
- package/dist/esm/{chunk-N53NJCEM.js → chunk-OQWD63AI.js} +2 -2
- package/dist/esm/chunk-OQWD63AI.js.map +7 -0
- package/dist/esm/chunk-PCLO3ZZY.js +3 -0
- package/dist/esm/chunk-PCLO3ZZY.js.map +7 -0
- package/dist/esm/{chunk-2XZ7477Y.js → chunk-PZZJH2LR.js} +2 -2
- package/dist/esm/chunk-PZZJH2LR.js.map +7 -0
- package/dist/esm/chunk-QKCNGEX4.js +3 -0
- package/dist/esm/chunk-QKCNGEX4.js.map +7 -0
- package/dist/esm/{chunk-PPQ7URZL.js → chunk-R4PGFURL.js} +2 -2
- package/dist/esm/{chunk-UUQGOQ5H.js → chunk-RB5VHWAW.js} +2 -2
- package/dist/esm/chunk-RB5VHWAW.js.map +7 -0
- package/dist/esm/{chunk-AG2YETE6.js → chunk-VPRAXHLL.js} +2 -2
- package/dist/esm/chunk-VPRAXHLL.js.map +7 -0
- package/dist/esm/{chunk-7J7RPEPB.js → chunk-VRQEWMC6.js} +2 -2
- package/dist/esm/chunk-VRQEWMC6.js.map +7 -0
- package/dist/esm/{chunk-UFJGZUKK.js → chunk-W4MQ6TEK.js} +2 -2
- package/dist/esm/chunk-W4MQ6TEK.js.map +7 -0
- package/dist/esm/{chunk-3223MHQK.js → chunk-WJ4H2O2G.js} +2 -2
- package/dist/esm/chunk-WMODMXEU.js +3 -0
- package/dist/esm/chunk-WMODMXEU.js.map +7 -0
- package/dist/esm/{chunk-JZVLP2VF.js → chunk-XPVRXQSW.js} +2 -2
- package/dist/esm/chunk-XPVRXQSW.js.map +7 -0
- package/dist/esm/{chunk-BUZGRMDD.js → chunk-Y2BTPKK6.js} +2 -2
- package/dist/esm/chunk-YOSCUA6Z.js +3 -0
- package/dist/esm/chunk-YOSCUA6Z.js.map +7 -0
- package/dist/esm/{chunk-X272YV2E.js → chunk-Z563IAE3.js} +2 -2
- package/dist/esm/chunk-Z563IAE3.js.map +7 -0
- package/dist/esm/{chunk-GZ333J7L.js → chunk-ZDSY6CJL.js} +2 -2
- package/dist/esm/chunk-ZDSY6CJL.js.map +7 -0
- package/dist/esm/{chunk-ENAW44VE.js → chunk-ZYKJTNAT.js} +2 -2
- package/dist/esm/chunk-ZYKJTNAT.js.map +7 -0
- package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-resizable.d.ts +6 -0
- package/dist/esm/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-resizable.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/chip.js +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/message-scroller.js +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/notice.js +1 -1
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/radio-group.js +1 -1
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/toggle.js +1 -1
- package/dist/esm/components/toolbar.d.ts.map +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.d.ts.map +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/index.js.map +4 -4
- package/dist/esm/helpers/theme-size.d.ts +8 -30
- package/dist/esm/helpers/theme-size.d.ts.map +1 -1
- package/dist/esm/helpers/theme-size.js +1 -1
- package/dist/esm/hooks/theme-size.d.ts +32 -0
- package/dist/esm/hooks/theme-size.d.ts.map +1 -0
- package/dist/esm/hooks/theme-size.js +3 -0
- package/dist/esm/hooks/theme-size.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/font-family.prop.js +1 -1
- package/dist/esm/props/font-family.prop.js.map +4 -4
- package/dist/esm/props/index.js +1 -1
- package/dist/esm/props/index.js.map +4 -4
- package/package.json +1 -1
- package/src/components/_internal/base-button.tsx +56 -42
- package/src/components/_internal/shell-inspector.tsx +3 -1
- package/src/components/_internal/shell-resizable.tsx +13 -0
- package/src/components/_internal/shell-sidebar.tsx +3 -1
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +1 -1
- package/src/components/avatar.tsx +1 -1
- package/src/components/card.tsx +1 -1
- package/src/components/chatbar.tsx +1 -1
- package/src/components/checkbox-group.tsx +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +1 -1
- package/src/components/context-menu.tsx +1 -1
- package/src/components/dialog.tsx +1 -1
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/navbar.tsx +1 -1
- package/src/components/notice.tsx +1 -1
- package/src/components/popover.css +4 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/radio-group.tsx +1 -1
- package/src/components/radio.tsx +1 -1
- package/src/components/segmented-control.tsx +1 -1
- package/src/components/select.tsx +1 -1
- package/src/components/sheet.css +4 -2
- package/src/components/sheet.tsx +1 -1
- package/src/components/shell.css +7 -2
- package/src/components/shell.tsx +1 -1
- package/src/components/sidebar.css +10 -0
- package/src/components/sidebar.tsx +16 -1
- package/src/components/slider.tsx +1 -1
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +1 -1
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-area.tsx +1 -1
- package/src/components/text-field.tsx +1 -1
- package/src/components/theme.tsx +1 -1
- package/src/components/toolbar.tsx +17 -8
- package/src/helpers/index.ts +3 -0
- package/src/helpers/theme-size.ts +8 -46
- package/src/hooks/theme-size.ts +50 -0
- package/src/styles/tokens/color.css +3 -0
- package/styles.css +21 -3
- package/tokens/base.css +2 -0
- package/tokens.css +2 -0
- package/dist/esm/chunk-2EXOL2BR.js.map +0 -7
- package/dist/esm/chunk-2IUGM657.js +0 -3
- package/dist/esm/chunk-2IUGM657.js.map +0 -7
- package/dist/esm/chunk-2XZ7477Y.js.map +0 -7
- package/dist/esm/chunk-3WZLXGUE.js +0 -3
- package/dist/esm/chunk-3WZLXGUE.js.map +0 -7
- package/dist/esm/chunk-3YLYGKFB.js +0 -2
- package/dist/esm/chunk-3YLYGKFB.js.map +0 -7
- package/dist/esm/chunk-45O3JZWQ.js.map +0 -7
- package/dist/esm/chunk-4ABQ6CDI.js.map +0 -7
- package/dist/esm/chunk-54HUG34P.js.map +0 -7
- package/dist/esm/chunk-7IHBNDCE.js.map +0 -7
- package/dist/esm/chunk-7J7RPEPB.js.map +0 -7
- package/dist/esm/chunk-A7QRPXXB.js.map +0 -7
- package/dist/esm/chunk-AG2YETE6.js.map +0 -7
- package/dist/esm/chunk-AOBY2OUZ.js.map +0 -7
- package/dist/esm/chunk-CRCYUJMK.js.map +0 -7
- package/dist/esm/chunk-DI7RUMLO.js +0 -3
- package/dist/esm/chunk-DI7RUMLO.js.map +0 -7
- package/dist/esm/chunk-E4EMG3RC.js.map +0 -7
- package/dist/esm/chunk-ENAW44VE.js.map +0 -7
- package/dist/esm/chunk-EVCQ6TG5.js +0 -3
- package/dist/esm/chunk-EVCQ6TG5.js.map +0 -7
- package/dist/esm/chunk-G32GSPNO.js +0 -3
- package/dist/esm/chunk-G32GSPNO.js.map +0 -7
- package/dist/esm/chunk-GPQSC6GL.js.map +0 -7
- package/dist/esm/chunk-GZ333J7L.js.map +0 -7
- package/dist/esm/chunk-JIF77MRB.js +0 -3
- package/dist/esm/chunk-JIF77MRB.js.map +0 -7
- package/dist/esm/chunk-JZVLP2VF.js.map +0 -7
- package/dist/esm/chunk-KNBSG2WA.js.map +0 -7
- package/dist/esm/chunk-LB2HB4NG.js +0 -3
- package/dist/esm/chunk-LB2HB4NG.js.map +0 -7
- package/dist/esm/chunk-LCG3JZ3C.js.map +0 -7
- package/dist/esm/chunk-N53NJCEM.js.map +0 -7
- package/dist/esm/chunk-NMQGDBLD.js.map +0 -7
- package/dist/esm/chunk-PF67GJ5D.js.map +0 -7
- package/dist/esm/chunk-UFJGZUKK.js.map +0 -7
- package/dist/esm/chunk-UUQGOQ5H.js.map +0 -7
- package/dist/esm/chunk-VCV7RACK.js +0 -2
- package/dist/esm/chunk-VCV7RACK.js.map +0 -7
- package/dist/esm/chunk-X272YV2E.js.map +0 -7
- package/dist/esm/chunk-YIKLO2XL.js.map +0 -7
- package/dist/esm/chunk-YNCI5PY6.js.map +0 -7
- package/dist/esm/chunk-YVZTQA2L.js.map +0 -7
- /package/dist/esm/{chunk-UZAS4PYM.js.map → chunk-5TJH35TF.js.map} +0 -0
- /package/dist/esm/{chunk-4Q5PUIDJ.js.map → chunk-6RJQ5LLP.js.map} +0 -0
- /package/dist/esm/{chunk-IQ2RMFOM.js.map → chunk-CQG4U5BR.js.map} +0 -0
- /package/dist/esm/{chunk-PPQ7URZL.js.map → chunk-R4PGFURL.js.map} +0 -0
- /package/dist/esm/{chunk-3223MHQK.js.map → chunk-WJ4H2O2G.js.map} +0 -0
- /package/dist/esm/{chunk-BUZGRMDD.js.map → chunk-Y2BTPKK6.js.map} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";"use client";var
|
|
2
|
+
"use strict";"use client";var K=Object.create;var c=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},C=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of U(e))!M.call(t,p)&&p!==n&&c(t,p,{get:()=>e[p],enumerable:!(i=B(e,p))||i.enumerable});return t};var m=(t,e,n)=>(n=t!=null?K(A(t)):{},C(e||!t||!t.__esModule?c(n,"default",{value:t,enumerable:!0}):n,t)),I=t=>C(c({},"__esModule",{value:!0}),t);var te={};W(te,{Card:()=>G});module.exports=I(te);var P=m(require("react")),w=m(require("classnames")),$=require("radix-ui");var b={asChild:{type:"boolean"}};var _=["1","2","3","4"],q=["raised","surface","outline","ghost","soft"],D={...b,size:{type:"enum",className:"kui-r-size",values:_,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:q,default:"raised"}};var k=m(require("classnames"));var L=[],F=new Set;function H(t){let e=Object.assign({},...t),n=[],i=[],p=new Set;for(let o in e){let r=e[o],f=r.values??L,a={key:o,type:r.type,default:r.default,hasDefault:r.default!==void 0,responsive:"responsive"in r,className:r.className,customProperties:r.customProperties,parseValue:r.parseValue,values:f,valueSet:f.length>0?new Set(f):F,enumValueSet:r.type==="enum"?new Set([r.default,...f]):void 0};r.className?(n.push(a),p.add(o)):(a.hasDefault||r.type==="enum")&&i.push(a)}return{styling:n,passthrough:i,stylingKeys:p}}var Y={children:new WeakMap};function N(t){let e=Y;for(let n=0;n<t.length;n++){let i=t[n],p=e.children.get(i);p===void 0&&(p={children:new WeakMap},e.children.set(i,p)),e=p}return e.compiled??(e.compiled=H(t))}var Z=["initial","xs","sm","md","lg","xl"],R=new Set(Z);function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var J=new Set(["initial","xs","sm","md","lg","xl"]);function d(t){if(typeof t!="object"||t===null)return!1;for(let e in t)if(J.has(e))return!0;return!1}function y(t,e,n){return e!==void 0?e.has(n):t.includes(n)}function V({className:t,customProperties:e,...n}){let i=v({allowArbitraryValues:!0,className:t,...n}),p=Q({customProperties:e,...n});return[i,p]}function v({allowArbitraryValues:t,value:e,className:n,propValues:i,propValueSet:p,parseValue:o=r=>r}){if(e){if(typeof e=="string")return y(i,p,e)?x(n,e,o):t?n:void 0;if(d(e)){let r=e,f=[];for(let a in r){if(!S(r,a)||!R.has(a))continue;let s=r[a];if(s!==void 0){if(y(i,p,s)){let l=x(n,s,o),u=a==="initial"?l:`${a}:${l}`;f.push(u)}else if(t){let l=a==="initial"?n:`${a}:${n}`;f.push(l)}}}return f.length>0?f.join(" "):""}if(t)return n}}function x(t,e,n){let i=t?"-":"",p=n(e),o=p?.startsWith("-"),r=o?"-":"",f=o?p?.substring(1):p;return`${r}${t}${i}${f}`}function Q({customProperties:t,value:e,propValues:n,propValueSet:i,parseValue:p=o=>o}){if(!e||typeof e=="string"&&y(n,i,e))return;let o;if(typeof e=="string"){let r=p(e);o={};for(let f of t)o[f]=r;return o}if(d(e)){let r=e;for(let f in r){if(!S(r,f)||!R.has(f))continue;let a=r[f];if(a===void 0||y(n,i,a))continue;let s=p(a);o??(o={});for(let l of t){let u=f==="initial"?l:`${l}-${f}`;o[u]=s}}}return o??{}}function h(...t){let e;for(let n of t)n&&(e===void 0&&(e={}),Object.assign(e,n));return e}function X(t,e){let n=t.initial,i=!1;return e.hasDefault&&n===void 0&&(n=e.default,i=!0),e.enumValueSet!==void 0&&!e.enumValueSet.has(n)&&(n=e.default,i=!0),i?{...t,initial:n}:t}function z(t,...e){let{styling:n,passthrough:i,stylingKeys:p}=N(e),o={};for(let a in t)p.has(a)||(o[a]=t[a]);for(let a=0;a<i.length;a++){let s=i[a],l=o[s.key];if(l===void 0){s.hasDefault&&(o[s.key]=s.default);continue}s.enumValueSet!==void 0&&!s.enumValueSet.has(l)&&!d(l)&&(o[s.key]=s.default)}let r,f=[];for(let a=0;a<n.length;a++){let s=n[a],l=t[s.key];if(l===void 0&&s.hasDefault&&(l=s.default),s.enumValueSet!==void 0&&!s.enumValueSet.has(l)&&!d(l)&&(l=s.default),!!l){if(d(l)){if(!s.responsive)continue;l=X(l,s)}if(s.type==="enum"){let u=v({allowArbitraryValues:!1,value:l,className:s.className,propValues:s.values,propValueSet:s.valueSet,parseValue:s.parseValue});u&&f.push(u);continue}if(s.type==="string"||s.type==="enum | string"){let[u,T]=V({className:s.className,customProperties:s.customProperties,propValues:s.type==="string"?[]:s.values,propValueSet:s.type==="string"?void 0:s.valueSet,parseValue:s.parseValue,value:l});T&&(r=h(r,T)),u&&f.push(u);continue}if(s.type==="boolean"){f.push(s.className);continue}}}return o.className=(0,k.default)(f.length>0?f.join(" "):void 0,t.className),o.style=h(r,t.style),o}var g=m(require("react"));function O(t,e){if(e.includes(t))return t;let n=Number(t),i=e[0],p=1/0;for(let o=0;o<e.length;o++){let r=Math.abs(Number(e[o])-n);r<p&&(p=r,i=e[o])}return i}var E=g.createContext("2");E.displayName="ThemeSizeContext";function j(t,e){let n=g.useContext(E);if(t.size!==void 0)return t;let i=O(n,e.values);return i===e.default?t:{...t,size:i}}var G=P.forwardRef((t,e)=>{let n=j(t,D.size),{asChild:i,className:p,...o}=z(n,D),r=i?$.Slot.Root:"div";return P.createElement(r,{ref:e,...o,className:(0,w.default)("kui-reset","kui-BaseCard","kui-Card","kui-SurfaceNest",p)})});G.displayName="Card";
|
|
3
3
|
//# sourceMappingURL=card.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/card.tsx", "../../../src/props/as-child.prop.ts", "../../../src/components/card.props.tsx", "../../../src/helpers/extract-props.ts", "../../../src/helpers/compile-prop-defs.ts", "../../../src/props/prop-def.ts", "../../../src/helpers/has-own-property.ts", "../../../src/helpers/is-responsive-object.ts", "../../../src/helpers/get-responsive-styles.ts", "../../../src/helpers/merge-styles.ts", "../../../src/helpers/theme-size.ts"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { cardPropDefs } from './card.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype CardElement = React.ElementRef<'div'>;\ntype CardOwnProps = GetPropDefTypes<typeof cardPropDefs>;\ninterface CardProps extends ComponentPropsWithout<'div', RemovedProps>, CardOwnProps {}\nconst Card = React.forwardRef<CardElement, CardProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, cardPropDefs.size);\n const { asChild, className, ...cardProps } = extractProps(props, cardPropDefs);\n const Comp = asChild ? Slot.Root : 'div';\n return (\n <Comp\n ref={forwardedRef}\n {...cardProps}\n className={classNames('kui-reset', 'kui-BaseCard', 'kui-Card', 'kui-SurfaceNest', className)}\n />\n );\n});\nCard.displayName = 'Card';\n\nexport { Card };\nexport type { CardProps };\n", "import type { PropDef } from './prop-def.js';\n\nconst asChildPropDef = {\n /**\n * Composes the component into its immediate child instead of rendering its own HTML element.\n * You\u2019ll have to provide a single React Element child.\n */\n asChild: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nexport { asChildPropDef };\n", "import { asChildPropDef } from '../props/as-child.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['raised', 'surface', 'outline', 'ghost', 'soft'] as const;\n\nconst cardPropDefs = {\n ...asChildPropDef,\n /** Padding --surface-p-N and corner --radius-surface-N. Unset, it follows the Theme size. */\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: variants, default: 'raised' },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n};\n\nexport { cardPropDefs };\n", "import classNames from 'classnames';\n\nimport { getCompiledPropDefs } from './compile-prop-defs.js';\nimport { getResponsiveClassNames, getResponsiveStyles } from './get-responsive-styles.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\nimport { mergeStyles } from './merge-styles.js';\n\nimport type { CompiledPropDef } from './compile-prop-defs.js';\nimport type * as React from 'react';\nimport type { PropDef } from '../props/prop-def.js';\n\ntype PropDefsWithClassName<T> = T extends Record<string, PropDef> ? { [K in keyof T]: T[K] extends { className: string } ? K : never }[keyof T] : never;\n\ntype ResponsiveValue = Record<string, string | undefined>;\n\n/**\n * Fills in the `initial` breakpoint of a responsive value from the prop def's\n * default, and coerces an invalid `initial` enum value back to that default.\n *\n * Returns the value untouched when nothing needs changing, and a copy otherwise\n * \u2014 callers routinely hoist responsive objects to module scope, so mutating the\n * caller's object would corrupt it for every later render.\n */\nfunction normalizeResponsiveValue(value: ResponsiveValue, propDef: CompiledPropDef) {\n let initial = value.initial;\n let changed = false;\n\n if (propDef.hasDefault && initial === undefined) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(initial)) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n return changed ? { ...value, initial } : value;\n}\n\n/**\n * Takes props, checks them against prop defs that have a `className` on them,\n * adds necessary CSS classes and inline styles, and returns the props without\n * the corresponding prop defs that were used to formulate the new `className`\n * and `style` values. Also applies prop def defaults to every prop.\n */\nfunction extractProps<P extends { className?: string; style?: React.CSSProperties; [key: string]: any }, T extends Record<string, PropDef>[]>(\n props: P,\n ...propDefs: T\n): Omit<P & { className?: string; style?: React.CSSProperties }, PropDefsWithClassName<T[number]>> {\n const { styling, passthrough, stylingKeys } = getCompiledPropDefs(propDefs);\n\n // Copy the props that survive to the element rather than spreading and then\n // deleting the styling keys. Deleting off a spread demotes the object to\n // dictionary mode in V8, and this object is on the render path of every\n // component in the library.\n const extractedProps: Record<string, any> = {};\n for (const key in props) {\n if (stylingKeys.has(key)) continue;\n extractedProps[key] = props[key];\n }\n\n for (let i = 0; i < passthrough.length; i++) {\n const propDef = passthrough[i];\n const value = extractedProps[propDef.key];\n\n if (value === undefined) {\n if (propDef.hasDefault) extractedProps[propDef.key] = propDef.default;\n continue;\n }\n\n // Fall back to the default when the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n extractedProps[propDef.key] = propDef.default;\n }\n }\n\n let style: ReturnType<typeof mergeStyles>;\n const classes: string[] = [];\n\n for (let i = 0; i < styling.length; i++) {\n const propDef = styling[i];\n let value = props[propDef.key];\n\n // Apply prop def defaults\n if (value === undefined && propDef.hasDefault) {\n value = propDef.default;\n }\n\n // Apply the default value if the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n value = propDef.default;\n }\n\n if (!value) continue;\n\n if (isResponsiveObject(value)) {\n // Make sure we are not threading through responsive values for non-responsive prop defs\n if (!propDef.responsive) continue;\n value = normalizeResponsiveValue(value, propDef);\n }\n\n if (propDef.type === 'enum') {\n const propClassName = getResponsiveClassNames({\n allowArbitraryValues: false,\n value,\n className: propDef.className!,\n propValues: propDef.values,\n propValueSet: propDef.valueSet,\n parseValue: propDef.parseValue,\n });\n\n if (propClassName) classes.push(propClassName);\n continue;\n }\n\n if (propDef.type === 'string' || propDef.type === 'enum | string') {\n const [propClassNames, propCustomProperties] = getResponsiveStyles({\n className: propDef.className!,\n customProperties: propDef.customProperties!,\n // `string` prop defs have no enum values, so every value is arbitrary\n propValues: propDef.type === 'string' ? [] : propDef.values,\n propValueSet: propDef.type === 'string' ? undefined : propDef.valueSet,\n parseValue: propDef.parseValue,\n value,\n });\n\n if (propCustomProperties) style = mergeStyles(style, propCustomProperties);\n if (propClassNames) classes.push(propClassNames);\n continue;\n }\n\n if (propDef.type === 'boolean') {\n // TODO handle responsive boolean props\n classes.push(propDef.className!);\n continue;\n }\n }\n\n extractedProps.className = classNames(classes.length > 0 ? classes.join(' ') : undefined, props.className);\n extractedProps.style = mergeStyles(style, props.style);\n return extractedProps as ReturnType<typeof extractProps<P, T>>;\n}\n\nexport { extractProps };\n", "import type { PropDef } from '../props/prop-def.js';\n\n/**\n * A prop def pre-processed into the exact shape `extractProps` needs at render\n * time. Everything that can be derived from the static prop def \u2014 enum\n * membership sets, whether the def is responsive, whether it carries a default\n * \u2014 is computed once here instead of on every render.\n */\ninterface CompiledPropDef {\n key: string;\n type: PropDef['type'];\n default: unknown;\n hasDefault: boolean;\n responsive: boolean;\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n /** The prop def's own enum values, kept for the responsive class name helpers. */\n values: readonly string[];\n /** O(1) membership for `values`. */\n valueSet: ReadonlySet<string>;\n /**\n * `values` plus the default, used to coerce invalid enum values back to the\n * default. Only present for `type: 'enum'` \u2014 `'enum | string'` props accept\n * arbitrary strings and must not be coerced.\n */\n enumValueSet?: ReadonlySet<unknown>;\n}\n\ninterface CompiledPropDefs {\n /** Defs that contribute a class name and/or custom properties. */\n styling: CompiledPropDef[];\n /**\n * Defs that pass through to the element but still need a default applied or\n * an invalid enum value coerced. Defs that can do neither are omitted\n * entirely \u2014 they are already correct as passed.\n */\n passthrough: CompiledPropDef[];\n /** Keys consumed by `styling`, so they can be skipped when copying props. */\n stylingKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_VALUES: readonly string[] = [];\nconst EMPTY_SET: ReadonlySet<string> = new Set();\n\nfunction compile(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n const merged: Record<string, PropDef> = Object.assign({}, ...propDefs);\n const styling: CompiledPropDef[] = [];\n const passthrough: CompiledPropDef[] = [];\n const stylingKeys = new Set<string>();\n\n for (const key in merged) {\n // The PropDef union is narrowed per-field below; reading the optional\n // members off the union directly is what the runtime actually needs.\n const def = merged[key] as PropDef & {\n default?: unknown;\n values?: readonly string[];\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n responsive?: true;\n };\n\n const values = def.values ?? EMPTY_VALUES;\n const compiled: CompiledPropDef = {\n key,\n type: def.type,\n default: def.default,\n hasDefault: def.default !== undefined,\n responsive: 'responsive' in def,\n className: def.className,\n customProperties: def.customProperties,\n parseValue: def.parseValue,\n values,\n valueSet: values.length > 0 ? new Set(values) : EMPTY_SET,\n enumValueSet: def.type === 'enum' ? new Set<unknown>([def.default, ...values]) : undefined,\n };\n\n if (def.className) {\n styling.push(compiled);\n stylingKeys.add(key);\n } else if (compiled.hasDefault || def.type === 'enum') {\n // Anything else is copied through untouched, so there is nothing to do.\n passthrough.push(compiled);\n }\n }\n\n return { styling, passthrough, stylingKeys };\n}\n\ninterface CacheNode {\n children: WeakMap<object, CacheNode>;\n compiled?: CompiledPropDefs;\n}\n\nconst cacheRoot: CacheNode = { children: new WeakMap() };\n\n/**\n * Compiles a set of prop defs, memoized on the identity of the prop def objects\n * themselves. Components always pass the same module-level constants, so after\n * the first render of a given component this is a couple of WeakMap lookups\n * instead of merging 50-odd prop defs into a fresh object.\n */\nfunction getCompiledPropDefs(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n let node = cacheRoot;\n\n for (let i = 0; i < propDefs.length; i++) {\n const propDef = propDefs[i];\n let child = node.children.get(propDef);\n if (child === undefined) {\n child = { children: new WeakMap() };\n node.children.set(propDef, child);\n }\n node = child;\n }\n\n return (node.compiled ??= compile(propDefs));\n}\n\nexport { getCompiledPropDefs };\nexport type { CompiledPropDef, CompiledPropDefs };\n", "import type React from 'react';\n\n// Creates a union type of string literals with strings, but retains intellisense for the literals.\n// Union<string, 'foo' | 'bar'> => string | Omit<string, 'foo' | 'bar'>\ntype Union<S = string, T extends string | number = string> = T | Omit<S, T>;\n\nconst breakpoints = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst breakpointSet: Set<string> = new Set(breakpoints);\ntype Breakpoint = (typeof breakpoints)[number];\ntype Responsive<T> = T | Partial<Record<Breakpoint, T>>;\n\ntype BooleanPropDef = {\n type: 'boolean';\n default?: boolean;\n required?: boolean;\n className?: string;\n};\ntype StringPropDef = {\n type: 'string';\n default?: string;\n required?: boolean;\n};\ntype ReactNodePropDef = {\n type: 'ReactNode';\n default?: React.ReactNode;\n required?: boolean;\n};\ntype EnumPropDef<T> = {\n type: 'enum';\n values: readonly T[];\n default?: T;\n required?: boolean;\n};\ntype EnumOrStringPropDef<T> = {\n type: 'enum | string';\n values: readonly T[];\n default?: T | string;\n required?: boolean;\n};\n\ntype NonStylingPropDef = {\n className?: never;\n customProperties?: never;\n parseValue?: never;\n};\n\ntype StylingPropDef = {\n className: string;\n parseValue?: (value: string) => string | undefined;\n};\n\ntype ArbitraryStylingPropDef = {\n className: string;\n customProperties: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n};\n\ntype RegularPropDef<T> =\n | ReactNodePropDef\n | BooleanPropDef\n | (StringPropDef & ArbitraryStylingPropDef)\n | (StringPropDef & NonStylingPropDef)\n | (EnumPropDef<T> & StylingPropDef)\n | (EnumPropDef<T> & NonStylingPropDef)\n | (EnumOrStringPropDef<T> & ArbitraryStylingPropDef)\n | (EnumOrStringPropDef<T> & NonStylingPropDef);\ntype ResponsivePropDef<T = any> = RegularPropDef<T> & { responsive: true };\ntype PropDef<T = any> = RegularPropDef<T> | ResponsivePropDef<T>;\n\n// prettier-ignore\ntype GetPropDefType<Def> =\n Def extends BooleanPropDef ? (Def extends ResponsivePropDef ? Responsive<boolean> : boolean)\n : Def extends StringPropDef ? (Def extends ResponsivePropDef ? Responsive<string> : string)\n : Def extends ReactNodePropDef ? (Def extends ResponsivePropDef ? Responsive<React.ReactNode> : React.ReactNode)\n : Def extends EnumOrStringPropDef<infer Type> ?\n Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Type\n : Def extends EnumPropDef<infer Type> ? (Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type)\n : never;\n\ntype GetPropDefTypes<P> = {\n [K in keyof P]?: GetPropDefType<P[K]>;\n};\n\nexport { breakpoints, breakpointSet };\nexport type {\n PropDef,\n GetPropDefTypes,\n ResponsivePropDef,\n //\n Breakpoint,\n Responsive,\n Union,\n};\n", "/** A util to check whether the object has a key, while inferring the correct key type */\nfunction hasOwnProperty<K extends string | number | symbol>(\n obj: Record<K, unknown>,\n key: string | number | symbol\n): key is K {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport { hasOwnProperty };\n", "import type { Responsive, Breakpoint } from '../props/prop-def.js';\n\n// Use a Set for O(1) lookup instead of array.includes() which is O(n)\nconst breakpointSet = new Set<string>(['initial', 'xs', 'sm', 'md', 'lg', 'xl']);\n\nexport function isResponsiveObject<Value extends string>(\n obj: Responsive<Value | Omit<string, Value>> | undefined\n): obj is Record<Breakpoint, string> {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // Use for...in to avoid Object.keys() array allocation\n for (const key in obj) {\n if (breakpointSet.has(key)) {\n return true;\n }\n }\n return false;\n}\n", "import { breakpointSet } from '../props/prop-def.js';\nimport { hasOwnProperty } from './has-own-property.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\n\nimport type { Responsive, Union } from '../props/prop-def.js';\n\n/**\n * Membership test against a prop def's enum values. Callers that already hold a\n * compiled prop def pass `propValueSet` for an O(1) lookup; the handful of call\n * sites that build options inline fall back to scanning the array.\n */\nfunction includesValue(propValues: string[] | readonly string[], propValueSet: ReadonlySet<string> | undefined, value: string): boolean {\n return propValueSet !== undefined ? propValueSet.has(value) : propValues.includes(value);\n}\n\ninterface GetResponsiveStylesOptions {\n className: string;\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveStyles({ className, customProperties, ...args }: GetResponsiveStylesOptions) {\n const responsiveClassNames = getResponsiveClassNames({\n allowArbitraryValues: true,\n className,\n ...args,\n });\n\n const responsiveCustomProperties = getResponsiveCustomProperties({ customProperties, ...args });\n return [responsiveClassNames, responsiveCustomProperties] as const;\n}\n\ninterface GetResponsiveClassNamesOptions {\n allowArbitraryValues?: boolean;\n className: string;\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveClassNames({ allowArbitraryValues, value, className, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveClassNamesOptions): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (typeof value === 'string') {\n if (includesValue(propValues, propValueSet, value)) {\n return getBaseClassName(className, value, parseValue);\n }\n return allowArbitraryValues ? className : undefined;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n const classNames: string[] = [];\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n if (value !== undefined) {\n if (includesValue(propValues, propValueSet, value)) {\n const baseClassName = getBaseClassName(className, value, parseValue);\n const bpClassName = bp === 'initial' ? baseClassName : `${bp}:${baseClassName}`;\n classNames.push(bpClassName);\n } else if (allowArbitraryValues) {\n const bpClassName = bp === 'initial' ? className : `${bp}:${className}`;\n classNames.push(bpClassName);\n }\n }\n }\n\n return classNames.length > 0 ? classNames.join(' ') : '';\n }\n\n if (allowArbitraryValues) {\n return className;\n }\n}\n\nfunction getBaseClassName(className: string, value: string, parseValue: (value: string) => string | undefined): string {\n const delimiter = className ? '-' : '';\n const matchedValue = parseValue(value);\n const isNegative = matchedValue?.startsWith('-');\n const minus = isNegative ? '-' : '';\n const absoluteValue = isNegative ? matchedValue?.substring(1) : matchedValue;\n return `${minus}${className}${delimiter}${absoluteValue}`;\n}\n\ninterface GetResponsiveCustomPropertiesOptions {\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveCustomProperties({ customProperties, value, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveCustomPropertiesOptions) {\n // Don't generate custom properties if the value is not arbitrary\n if (!value || (typeof value === 'string' && includesValue(propValues, propValueSet, value))) {\n return undefined;\n }\n\n let styles: Record<string, string | undefined> | undefined;\n\n if (typeof value === 'string') {\n const parsed = parseValue(value);\n styles = {};\n for (const customProperty of customProperties) {\n styles[customProperty] = parsed;\n }\n return styles;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n // Don't generate a custom property if the value is not arbitrary\n if (value === undefined || includesValue(propValues, propValueSet, value)) {\n continue;\n }\n\n const parsed = parseValue(value);\n styles ??= {};\n for (const customProperty of customProperties) {\n const bpProperty = bp === 'initial' ? customProperty : `${customProperty}-${bp}`;\n styles[bpProperty] = parsed;\n }\n }\n }\n\n return styles ?? {};\n}\n\nexport { getResponsiveStyles, getResponsiveCustomProperties, getResponsiveClassNames };\n", "type InlineStyle =\n | React.CSSProperties\n | Record<string, string | number | null | undefined>\n | undefined;\n\n// Merges CSS styles like `classNames` merges CSS classes\n// Optimized to avoid object spread in loop - uses Object.assign for in-place mutation\nexport function mergeStyles(...styles: Array<InlineStyle>): InlineStyle {\n let result: Record<string, string | number | null | undefined> | undefined;\n\n for (const style of styles) {\n if (style) {\n if (result === undefined) {\n // First non-empty style - create result object\n result = {};\n }\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n", "'use client';\n\nimport * as React from 'react';\n\ntype ThemeSize = '1' | '2' | '3' | '4';\n\n/** The rest of the 1-4 index when no Theme states a size. */\nconst THEME_SIZE_DEFAULT: ThemeSize = '2';\n\n/**\n * The app-wide size index, provided by `Theme` beside `ThemeContext`.\n *\n * It is its own context, holding one string, so a component that only needs\n * the size does not re-render when the accent colour or appearance changes.\n */\nconst ThemeSizeContext = React.createContext<ThemeSize>(THEME_SIZE_DEFAULT);\nThemeSizeContext.displayName = 'ThemeSizeContext';\n\ninterface SizePropDef {\n values: readonly string[];\n default?: string;\n}\n\n/**\n * Maps the theme size onto a component's own range: the value itself when the\n * component has it, otherwise the nearest end of the range (`4` on a 1-3 scale\n * is `3`, on a 1-2 scale it is `2`).\n */\nfunction clampSize(size: ThemeSize, values: readonly string[]): string {\n if (values.includes(size)) return size;\n const n = Number(size);\n let nearest = values[0];\n let distance = Infinity;\n for (let i = 0; i < values.length; i++) {\n const d = Math.abs(Number(values[i]) - n);\n if (d < distance) {\n distance = d;\n nearest = values[i];\n }\n }\n return nearest;\n}\n\n/**\n * The size a component on the 1-4 index takes: what the caller said, else the\n * nearest Theme's size, mapped into the component's range.\n */\nfunction useThemeSize<V>(explicit: V | undefined, propDef: SizePropDef): V {\n const themeSize = React.useContext(ThemeSizeContext);\n if (explicit !== undefined) return explicit;\n // The clamped value is one of `propDef.values`, which is what `V` ranges over.\n return clampSize(themeSize, propDef.values) as V;\n}\n\n/**\n * Fills `size` from the nearest Theme when the caller left it unset, so the\n * result can go straight into `extractProps`. An explicit size, responsive\n * object included, wins.\n *\n * Returns the same props object when there is nothing to fill: when a size is\n * set, or when the theme size resolves to the prop def's own default (the\n * common case, a Theme with no size), so `extractProps` applies it as before.\n */\nfunction useThemeSizeProps<P extends { size?: unknown }>(props: P, propDef: SizePropDef): P {\n const themeSize = React.useContext(ThemeSizeContext);\n if (props.size !== undefined) return props;\n const size = clampSize(themeSize, propDef.values);\n if (size === propDef.default) return props;\n return { ...props, size };\n}\n\nexport { ThemeSizeContext, THEME_SIZE_DEFAULT, clampSize, useThemeSize, useThemeSizeProps };\nexport type { ThemeSize };\n"],
|
|
5
|
-
"mappings": "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
|
|
6
|
-
"names": ["card_exports", "__export", "Card", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "asChildPropDef", "sizes", "variants", "cardPropDefs", "asChildPropDef", "import_classnames", "EMPTY_VALUES", "EMPTY_SET", "compile", "propDefs", "merged", "styling", "passthrough", "stylingKeys", "key", "def", "values", "compiled", "cacheRoot", "getCompiledPropDefs", "node", "i", "propDef", "child", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "normalizeResponsiveValue", "value", "propDef", "initial", "changed", "extractProps", "props", "propDefs", "styling", "passthrough", "stylingKeys", "getCompiledPropDefs", "extractedProps", "key", "i", "isResponsiveObject", "style", "classes", "propClassName", "getResponsiveClassNames", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles", "classNames", "React", "
|
|
3
|
+
"sources": ["../../../src/components/card.tsx", "../../../src/props/as-child.prop.ts", "../../../src/components/card.props.tsx", "../../../src/helpers/extract-props.ts", "../../../src/helpers/compile-prop-defs.ts", "../../../src/props/prop-def.ts", "../../../src/helpers/has-own-property.ts", "../../../src/helpers/is-responsive-object.ts", "../../../src/helpers/get-responsive-styles.ts", "../../../src/helpers/merge-styles.ts", "../../../src/hooks/theme-size.ts", "../../../src/helpers/theme-size.ts"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { cardPropDefs } from './card.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype CardElement = React.ElementRef<'div'>;\ntype CardOwnProps = GetPropDefTypes<typeof cardPropDefs>;\ninterface CardProps extends ComponentPropsWithout<'div', RemovedProps>, CardOwnProps {}\nconst Card = React.forwardRef<CardElement, CardProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, cardPropDefs.size);\n const { asChild, className, ...cardProps } = extractProps(props, cardPropDefs);\n const Comp = asChild ? Slot.Root : 'div';\n return (\n <Comp\n ref={forwardedRef}\n {...cardProps}\n className={classNames('kui-reset', 'kui-BaseCard', 'kui-Card', 'kui-SurfaceNest', className)}\n />\n );\n});\nCard.displayName = 'Card';\n\nexport { Card };\nexport type { CardProps };\n", "import type { PropDef } from './prop-def.js';\n\nconst asChildPropDef = {\n /**\n * Composes the component into its immediate child instead of rendering its own HTML element.\n * You\u2019ll have to provide a single React Element child.\n */\n asChild: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nexport { asChildPropDef };\n", "import { asChildPropDef } from '../props/as-child.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['raised', 'surface', 'outline', 'ghost', 'soft'] as const;\n\nconst cardPropDefs = {\n ...asChildPropDef,\n /** Padding --surface-p-N and corner --radius-surface-N. Unset, it follows the Theme size. */\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: variants, default: 'raised' },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n};\n\nexport { cardPropDefs };\n", "import classNames from 'classnames';\n\nimport { getCompiledPropDefs } from './compile-prop-defs.js';\nimport { getResponsiveClassNames, getResponsiveStyles } from './get-responsive-styles.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\nimport { mergeStyles } from './merge-styles.js';\n\nimport type { CompiledPropDef } from './compile-prop-defs.js';\nimport type * as React from 'react';\nimport type { PropDef } from '../props/prop-def.js';\n\ntype PropDefsWithClassName<T> = T extends Record<string, PropDef> ? { [K in keyof T]: T[K] extends { className: string } ? K : never }[keyof T] : never;\n\ntype ResponsiveValue = Record<string, string | undefined>;\n\n/**\n * Fills in the `initial` breakpoint of a responsive value from the prop def's\n * default, and coerces an invalid `initial` enum value back to that default.\n *\n * Returns the value untouched when nothing needs changing, and a copy otherwise\n * \u2014 callers routinely hoist responsive objects to module scope, so mutating the\n * caller's object would corrupt it for every later render.\n */\nfunction normalizeResponsiveValue(value: ResponsiveValue, propDef: CompiledPropDef) {\n let initial = value.initial;\n let changed = false;\n\n if (propDef.hasDefault && initial === undefined) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(initial)) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n return changed ? { ...value, initial } : value;\n}\n\n/**\n * Takes props, checks them against prop defs that have a `className` on them,\n * adds necessary CSS classes and inline styles, and returns the props without\n * the corresponding prop defs that were used to formulate the new `className`\n * and `style` values. Also applies prop def defaults to every prop.\n */\nfunction extractProps<P extends { className?: string; style?: React.CSSProperties; [key: string]: any }, T extends Record<string, PropDef>[]>(\n props: P,\n ...propDefs: T\n): Omit<P & { className?: string; style?: React.CSSProperties }, PropDefsWithClassName<T[number]>> {\n const { styling, passthrough, stylingKeys } = getCompiledPropDefs(propDefs);\n\n // Copy the props that survive to the element rather than spreading and then\n // deleting the styling keys. Deleting off a spread demotes the object to\n // dictionary mode in V8, and this object is on the render path of every\n // component in the library.\n const extractedProps: Record<string, any> = {};\n for (const key in props) {\n if (stylingKeys.has(key)) continue;\n extractedProps[key] = props[key];\n }\n\n for (let i = 0; i < passthrough.length; i++) {\n const propDef = passthrough[i];\n const value = extractedProps[propDef.key];\n\n if (value === undefined) {\n if (propDef.hasDefault) extractedProps[propDef.key] = propDef.default;\n continue;\n }\n\n // Fall back to the default when the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n extractedProps[propDef.key] = propDef.default;\n }\n }\n\n let style: ReturnType<typeof mergeStyles>;\n const classes: string[] = [];\n\n for (let i = 0; i < styling.length; i++) {\n const propDef = styling[i];\n let value = props[propDef.key];\n\n // Apply prop def defaults\n if (value === undefined && propDef.hasDefault) {\n value = propDef.default;\n }\n\n // Apply the default value if the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n value = propDef.default;\n }\n\n if (!value) continue;\n\n if (isResponsiveObject(value)) {\n // Make sure we are not threading through responsive values for non-responsive prop defs\n if (!propDef.responsive) continue;\n value = normalizeResponsiveValue(value, propDef);\n }\n\n if (propDef.type === 'enum') {\n const propClassName = getResponsiveClassNames({\n allowArbitraryValues: false,\n value,\n className: propDef.className!,\n propValues: propDef.values,\n propValueSet: propDef.valueSet,\n parseValue: propDef.parseValue,\n });\n\n if (propClassName) classes.push(propClassName);\n continue;\n }\n\n if (propDef.type === 'string' || propDef.type === 'enum | string') {\n const [propClassNames, propCustomProperties] = getResponsiveStyles({\n className: propDef.className!,\n customProperties: propDef.customProperties!,\n // `string` prop defs have no enum values, so every value is arbitrary\n propValues: propDef.type === 'string' ? [] : propDef.values,\n propValueSet: propDef.type === 'string' ? undefined : propDef.valueSet,\n parseValue: propDef.parseValue,\n value,\n });\n\n if (propCustomProperties) style = mergeStyles(style, propCustomProperties);\n if (propClassNames) classes.push(propClassNames);\n continue;\n }\n\n if (propDef.type === 'boolean') {\n // TODO handle responsive boolean props\n classes.push(propDef.className!);\n continue;\n }\n }\n\n extractedProps.className = classNames(classes.length > 0 ? classes.join(' ') : undefined, props.className);\n extractedProps.style = mergeStyles(style, props.style);\n return extractedProps as ReturnType<typeof extractProps<P, T>>;\n}\n\nexport { extractProps };\n", "import type { PropDef } from '../props/prop-def.js';\n\n/**\n * A prop def pre-processed into the exact shape `extractProps` needs at render\n * time. Everything that can be derived from the static prop def \u2014 enum\n * membership sets, whether the def is responsive, whether it carries a default\n * \u2014 is computed once here instead of on every render.\n */\ninterface CompiledPropDef {\n key: string;\n type: PropDef['type'];\n default: unknown;\n hasDefault: boolean;\n responsive: boolean;\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n /** The prop def's own enum values, kept for the responsive class name helpers. */\n values: readonly string[];\n /** O(1) membership for `values`. */\n valueSet: ReadonlySet<string>;\n /**\n * `values` plus the default, used to coerce invalid enum values back to the\n * default. Only present for `type: 'enum'` \u2014 `'enum | string'` props accept\n * arbitrary strings and must not be coerced.\n */\n enumValueSet?: ReadonlySet<unknown>;\n}\n\ninterface CompiledPropDefs {\n /** Defs that contribute a class name and/or custom properties. */\n styling: CompiledPropDef[];\n /**\n * Defs that pass through to the element but still need a default applied or\n * an invalid enum value coerced. Defs that can do neither are omitted\n * entirely \u2014 they are already correct as passed.\n */\n passthrough: CompiledPropDef[];\n /** Keys consumed by `styling`, so they can be skipped when copying props. */\n stylingKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_VALUES: readonly string[] = [];\nconst EMPTY_SET: ReadonlySet<string> = new Set();\n\nfunction compile(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n const merged: Record<string, PropDef> = Object.assign({}, ...propDefs);\n const styling: CompiledPropDef[] = [];\n const passthrough: CompiledPropDef[] = [];\n const stylingKeys = new Set<string>();\n\n for (const key in merged) {\n // The PropDef union is narrowed per-field below; reading the optional\n // members off the union directly is what the runtime actually needs.\n const def = merged[key] as PropDef & {\n default?: unknown;\n values?: readonly string[];\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n responsive?: true;\n };\n\n const values = def.values ?? EMPTY_VALUES;\n const compiled: CompiledPropDef = {\n key,\n type: def.type,\n default: def.default,\n hasDefault: def.default !== undefined,\n responsive: 'responsive' in def,\n className: def.className,\n customProperties: def.customProperties,\n parseValue: def.parseValue,\n values,\n valueSet: values.length > 0 ? new Set(values) : EMPTY_SET,\n enumValueSet: def.type === 'enum' ? new Set<unknown>([def.default, ...values]) : undefined,\n };\n\n if (def.className) {\n styling.push(compiled);\n stylingKeys.add(key);\n } else if (compiled.hasDefault || def.type === 'enum') {\n // Anything else is copied through untouched, so there is nothing to do.\n passthrough.push(compiled);\n }\n }\n\n return { styling, passthrough, stylingKeys };\n}\n\ninterface CacheNode {\n children: WeakMap<object, CacheNode>;\n compiled?: CompiledPropDefs;\n}\n\nconst cacheRoot: CacheNode = { children: new WeakMap() };\n\n/**\n * Compiles a set of prop defs, memoized on the identity of the prop def objects\n * themselves. Components always pass the same module-level constants, so after\n * the first render of a given component this is a couple of WeakMap lookups\n * instead of merging 50-odd prop defs into a fresh object.\n */\nfunction getCompiledPropDefs(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n let node = cacheRoot;\n\n for (let i = 0; i < propDefs.length; i++) {\n const propDef = propDefs[i];\n let child = node.children.get(propDef);\n if (child === undefined) {\n child = { children: new WeakMap() };\n node.children.set(propDef, child);\n }\n node = child;\n }\n\n return (node.compiled ??= compile(propDefs));\n}\n\nexport { getCompiledPropDefs };\nexport type { CompiledPropDef, CompiledPropDefs };\n", "import type React from 'react';\n\n// Creates a union type of string literals with strings, but retains intellisense for the literals.\n// Union<string, 'foo' | 'bar'> => string | Omit<string, 'foo' | 'bar'>\ntype Union<S = string, T extends string | number = string> = T | Omit<S, T>;\n\nconst breakpoints = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst breakpointSet: Set<string> = new Set(breakpoints);\ntype Breakpoint = (typeof breakpoints)[number];\ntype Responsive<T> = T | Partial<Record<Breakpoint, T>>;\n\ntype BooleanPropDef = {\n type: 'boolean';\n default?: boolean;\n required?: boolean;\n className?: string;\n};\ntype StringPropDef = {\n type: 'string';\n default?: string;\n required?: boolean;\n};\ntype ReactNodePropDef = {\n type: 'ReactNode';\n default?: React.ReactNode;\n required?: boolean;\n};\ntype EnumPropDef<T> = {\n type: 'enum';\n values: readonly T[];\n default?: T;\n required?: boolean;\n};\ntype EnumOrStringPropDef<T> = {\n type: 'enum | string';\n values: readonly T[];\n default?: T | string;\n required?: boolean;\n};\n\ntype NonStylingPropDef = {\n className?: never;\n customProperties?: never;\n parseValue?: never;\n};\n\ntype StylingPropDef = {\n className: string;\n parseValue?: (value: string) => string | undefined;\n};\n\ntype ArbitraryStylingPropDef = {\n className: string;\n customProperties: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n};\n\ntype RegularPropDef<T> =\n | ReactNodePropDef\n | BooleanPropDef\n | (StringPropDef & ArbitraryStylingPropDef)\n | (StringPropDef & NonStylingPropDef)\n | (EnumPropDef<T> & StylingPropDef)\n | (EnumPropDef<T> & NonStylingPropDef)\n | (EnumOrStringPropDef<T> & ArbitraryStylingPropDef)\n | (EnumOrStringPropDef<T> & NonStylingPropDef);\ntype ResponsivePropDef<T = any> = RegularPropDef<T> & { responsive: true };\ntype PropDef<T = any> = RegularPropDef<T> | ResponsivePropDef<T>;\n\n// prettier-ignore\ntype GetPropDefType<Def> =\n Def extends BooleanPropDef ? (Def extends ResponsivePropDef ? Responsive<boolean> : boolean)\n : Def extends StringPropDef ? (Def extends ResponsivePropDef ? Responsive<string> : string)\n : Def extends ReactNodePropDef ? (Def extends ResponsivePropDef ? Responsive<React.ReactNode> : React.ReactNode)\n : Def extends EnumOrStringPropDef<infer Type> ?\n Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Type\n : Def extends EnumPropDef<infer Type> ? (Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type)\n : never;\n\ntype GetPropDefTypes<P> = {\n [K in keyof P]?: GetPropDefType<P[K]>;\n};\n\nexport { breakpoints, breakpointSet };\nexport type {\n PropDef,\n GetPropDefTypes,\n ResponsivePropDef,\n //\n Breakpoint,\n Responsive,\n Union,\n};\n", "/** A util to check whether the object has a key, while inferring the correct key type */\nfunction hasOwnProperty<K extends string | number | symbol>(\n obj: Record<K, unknown>,\n key: string | number | symbol\n): key is K {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport { hasOwnProperty };\n", "import type { Responsive, Breakpoint } from '../props/prop-def.js';\n\n// Use a Set for O(1) lookup instead of array.includes() which is O(n)\nconst breakpointSet = new Set<string>(['initial', 'xs', 'sm', 'md', 'lg', 'xl']);\n\nexport function isResponsiveObject<Value extends string>(\n obj: Responsive<Value | Omit<string, Value>> | undefined\n): obj is Record<Breakpoint, string> {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // Use for...in to avoid Object.keys() array allocation\n for (const key in obj) {\n if (breakpointSet.has(key)) {\n return true;\n }\n }\n return false;\n}\n", "import { breakpointSet } from '../props/prop-def.js';\nimport { hasOwnProperty } from './has-own-property.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\n\nimport type { Responsive, Union } from '../props/prop-def.js';\n\n/**\n * Membership test against a prop def's enum values. Callers that already hold a\n * compiled prop def pass `propValueSet` for an O(1) lookup; the handful of call\n * sites that build options inline fall back to scanning the array.\n */\nfunction includesValue(propValues: string[] | readonly string[], propValueSet: ReadonlySet<string> | undefined, value: string): boolean {\n return propValueSet !== undefined ? propValueSet.has(value) : propValues.includes(value);\n}\n\ninterface GetResponsiveStylesOptions {\n className: string;\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveStyles({ className, customProperties, ...args }: GetResponsiveStylesOptions) {\n const responsiveClassNames = getResponsiveClassNames({\n allowArbitraryValues: true,\n className,\n ...args,\n });\n\n const responsiveCustomProperties = getResponsiveCustomProperties({ customProperties, ...args });\n return [responsiveClassNames, responsiveCustomProperties] as const;\n}\n\ninterface GetResponsiveClassNamesOptions {\n allowArbitraryValues?: boolean;\n className: string;\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveClassNames({ allowArbitraryValues, value, className, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveClassNamesOptions): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (typeof value === 'string') {\n if (includesValue(propValues, propValueSet, value)) {\n return getBaseClassName(className, value, parseValue);\n }\n return allowArbitraryValues ? className : undefined;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n const classNames: string[] = [];\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n if (value !== undefined) {\n if (includesValue(propValues, propValueSet, value)) {\n const baseClassName = getBaseClassName(className, value, parseValue);\n const bpClassName = bp === 'initial' ? baseClassName : `${bp}:${baseClassName}`;\n classNames.push(bpClassName);\n } else if (allowArbitraryValues) {\n const bpClassName = bp === 'initial' ? className : `${bp}:${className}`;\n classNames.push(bpClassName);\n }\n }\n }\n\n return classNames.length > 0 ? classNames.join(' ') : '';\n }\n\n if (allowArbitraryValues) {\n return className;\n }\n}\n\nfunction getBaseClassName(className: string, value: string, parseValue: (value: string) => string | undefined): string {\n const delimiter = className ? '-' : '';\n const matchedValue = parseValue(value);\n const isNegative = matchedValue?.startsWith('-');\n const minus = isNegative ? '-' : '';\n const absoluteValue = isNegative ? matchedValue?.substring(1) : matchedValue;\n return `${minus}${className}${delimiter}${absoluteValue}`;\n}\n\ninterface GetResponsiveCustomPropertiesOptions {\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveCustomProperties({ customProperties, value, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveCustomPropertiesOptions) {\n // Don't generate custom properties if the value is not arbitrary\n if (!value || (typeof value === 'string' && includesValue(propValues, propValueSet, value))) {\n return undefined;\n }\n\n let styles: Record<string, string | undefined> | undefined;\n\n if (typeof value === 'string') {\n const parsed = parseValue(value);\n styles = {};\n for (const customProperty of customProperties) {\n styles[customProperty] = parsed;\n }\n return styles;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n // Don't generate a custom property if the value is not arbitrary\n if (value === undefined || includesValue(propValues, propValueSet, value)) {\n continue;\n }\n\n const parsed = parseValue(value);\n styles ??= {};\n for (const customProperty of customProperties) {\n const bpProperty = bp === 'initial' ? customProperty : `${customProperty}-${bp}`;\n styles[bpProperty] = parsed;\n }\n }\n }\n\n return styles ?? {};\n}\n\nexport { getResponsiveStyles, getResponsiveCustomProperties, getResponsiveClassNames };\n", "type InlineStyle =\n | React.CSSProperties\n | Record<string, string | number | null | undefined>\n | undefined;\n\n// Merges CSS styles like `classNames` merges CSS classes\n// Optimized to avoid object spread in loop - uses Object.assign for in-place mutation\nexport function mergeStyles(...styles: Array<InlineStyle>): InlineStyle {\n let result: Record<string, string | number | null | undefined> | undefined;\n\n for (const style of styles) {\n if (style) {\n if (result === undefined) {\n // First non-empty style - create result object\n result = {};\n }\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n", "'use client';\n\nimport * as React from 'react';\n\nimport { THEME_SIZE_DEFAULT, clampSize } from '../helpers/theme-size.js';\nimport type { ThemeSize } from '../helpers/theme-size.js';\n\n/**\n * The app-wide size index, provided by `Theme` beside `ThemeContext`.\n *\n * It is its own context, holding one string, so a component that only needs\n * the size does not re-render when the accent colour or appearance changes.\n */\nconst ThemeSizeContext = React.createContext<ThemeSize>(THEME_SIZE_DEFAULT);\nThemeSizeContext.displayName = 'ThemeSizeContext';\n\ninterface SizePropDef {\n values: readonly string[];\n default?: string;\n}\n\n/**\n * The size a component on the 1-4 index takes: what the caller said, else the\n * nearest Theme's size, mapped into the component's range.\n */\nfunction useThemeSize<V>(explicit: V | undefined, propDef: SizePropDef): V {\n const themeSize = React.useContext(ThemeSizeContext);\n if (explicit !== undefined) return explicit;\n // The clamped value is one of `propDef.values`, which is what `V` ranges over.\n return clampSize(themeSize, propDef.values) as V;\n}\n\n/**\n * Fills `size` from the nearest Theme when the caller left it unset, so the\n * result can go straight into `extractProps`. An explicit size, responsive\n * object included, wins.\n *\n * Returns the same props object when there is nothing to fill: when a size is\n * set, or when the theme size resolves to the prop def's own default (the\n * common case, a Theme with no size), so `extractProps` applies it as before.\n */\nfunction useThemeSizeProps<P extends { size?: unknown }>(props: P, propDef: SizePropDef): P {\n const themeSize = React.useContext(ThemeSizeContext);\n if (props.size !== undefined) return props;\n const size = clampSize(themeSize, propDef.values);\n if (size === propDef.default) return props;\n return { ...props, size };\n}\n\nexport { ThemeSizeContext, useThemeSize, useThemeSizeProps };\n", "/**\n * The pure half of the theme size: the type, the default and the clamp. Server-safe.\n *\n * The context and the hooks that read it live in `hooks/theme-size.ts`, a client module, so there\n * is one `ThemeSizeContext` and importing `/helpers` from a server component does not call\n * `createContext`.\n */\n\ntype ThemeSize = '1' | '2' | '3' | '4';\n\n/** The rest of the 1-4 index when no Theme states a size. */\nconst THEME_SIZE_DEFAULT: ThemeSize = '2';\n\n/**\n * Maps the theme size onto a component's own range: the value itself when the\n * component has it, otherwise the nearest end of the range (`4` on a 1-3 scale\n * is `3`, on a 1-2 scale it is `2`).\n */\nfunction clampSize(size: ThemeSize, values: readonly string[]): string {\n if (values.includes(size)) return size;\n const n = Number(size);\n let nearest = values[0];\n let distance = Infinity;\n for (let i = 0; i < values.length; i++) {\n const d = Math.abs(Number(values[i]) - n);\n if (d < distance) {\n distance = d;\n nearest = values[i];\n }\n }\n return nearest;\n}\n\nexport { THEME_SIZE_DEFAULT, clampSize };\nexport type { ThemeSize };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["card_exports", "__export", "Card", "__toCommonJS", "React", "import_classnames", "import_radix_ui", "asChildPropDef", "sizes", "variants", "cardPropDefs", "asChildPropDef", "import_classnames", "EMPTY_VALUES", "EMPTY_SET", "compile", "propDefs", "merged", "styling", "passthrough", "stylingKeys", "key", "def", "values", "compiled", "cacheRoot", "getCompiledPropDefs", "node", "i", "propDef", "child", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "normalizeResponsiveValue", "value", "propDef", "initial", "changed", "extractProps", "props", "propDefs", "styling", "passthrough", "stylingKeys", "getCompiledPropDefs", "extractedProps", "key", "i", "isResponsiveObject", "style", "classes", "propClassName", "getResponsiveClassNames", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles", "classNames", "React", "clampSize", "size", "values", "nearest", "distance", "i", "d", "ThemeSizeContext", "useThemeSizeProps", "props", "propDef", "themeSize", "ThemeSizeContext", "size", "clampSize", "Card", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "cardPropDefs", "asChild", "className", "cardProps", "extractProps", "Comp", "classNames"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var Fr=Object.create;var nt=Object.defineProperty;var Lr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Vr=Object.getPrototypeOf,Or=Object.prototype.hasOwnProperty;var Mr=(e,t)=>{for(var o in t)nt(e,o,{get:t[o],enumerable:!0})},io=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Br(t))!Or.call(e,a)&&a!==o&&nt(e,a,{get:()=>t[a],enumerable:!(n=Lr(t,a))||n.enumerable});return e};var x=(e,t,o)=>(o=e!=null?Fr(Vr(e)):{},io(t||!e||!e.__esModule?nt(o,"default",{value:e,enumerable:!0}):o,e)),zr=e=>io(nt({},"__esModule",{value:!0}),e);var jn={};Mr(jn,{AttachTrigger:()=>hr,Attachment:()=>Jt,AttachmentsRow:()=>ur,InlineEnd:()=>cr,InlineStart:()=>pr,Item:()=>fr,Root:()=>ir,Row:()=>yr,RowEnd:()=>Pr,RowStart:()=>gr,Send:()=>br,Textarea:()=>lr});module.exports=zr(jn);var r=x(require("react")),q=x(require("classnames")),Ee=require("radix-ui/internal"),nr=require("react-dropzone");var qe=x(require("react")),_o=x(require("classnames"));var y=x(require("react")),ko=x(require("classnames")),So=require("radix-ui"),ut=require("radix-ui/internal");var ae={asChild:{type:"boolean"}};var st=["gray","gold","bronze","brown","yellow","amber","orange","tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","lime","mint","sky"],lo=["auto","gray","mauve","slate","sage","olive","sand"],po={color:{type:"enum",values:st,default:void 0}},co={color:{type:"enum",values:st,default:""}};var wt=["none","small","medium","large","full"],at={radius:{type:"enum",values:wt,default:void 0}};var Ir=["1","2","3","4"],Hr=["raised","solid","soft","surface","outline","ghost"],kt={...ae,size:{type:"enum",className:"kui-r-size",values:Ir,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:Hr,default:"solid"},...co,...at,loading:{type:"boolean",className:"kui-loading",default:!1},fullWidth:{type:"boolean",className:"kui-full-width",default:!1}};var ct=x(require("react")),Ro=x(require("classnames"));var ho=x(require("classnames"));var jr=[],Wr=new Set;function Gr(e){let t=Object.assign({},...e),o=[],n=[],a=new Set;for(let s in t){let i=t[s],l=i.values??jr,c={key:s,type:i.type,default:i.default,hasDefault:i.default!==void 0,responsive:"responsive"in i,className:i.className,customProperties:i.customProperties,parseValue:i.parseValue,values:l,valueSet:l.length>0?new Set(l):Wr,enumValueSet:i.type==="enum"?new Set([i.default,...l]):void 0};i.className?(o.push(c),a.add(s)):(c.hasDefault||i.type==="enum")&&n.push(c)}return{styling:o,passthrough:n,stylingKeys:a}}var $r={children:new WeakMap};function uo(e){let t=$r;for(let o=0;o<e.length;o++){let n=e[o],a=t.children.get(n);a===void 0&&(a={children:new WeakMap},t.children.set(n,a)),t=a}return t.compiled??(t.compiled=Gr(e))}var Kr=["initial","xs","sm","md","lg","xl"],St=new Set(Kr);function Nt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ur=new Set(["initial","xs","sm","md","lg","xl"]);function De(e){if(typeof e!="object"||e===null)return!1;for(let t in e)if(Ur.has(t))return!0;return!1}function it(e,t,o){return t!==void 0?t.has(o):e.includes(o)}function fo({className:e,customProperties:t,...o}){let n=Et({allowArbitraryValues:!0,className:e,...o}),a=_r({customProperties:t,...o});return[n,a]}function Et({allowArbitraryValues:e,value:t,className:o,propValues:n,propValueSet:a,parseValue:s=i=>i}){if(t){if(typeof t=="string")return it(n,a,t)?mo(o,t,s):e?o:void 0;if(De(t)){let i=t,l=[];for(let c in i){if(!Nt(i,c)||!St.has(c))continue;let p=i[c];if(p!==void 0){if(it(n,a,p)){let u=mo(o,p,s),d=c==="initial"?u:`${c}:${u}`;l.push(d)}else if(e){let u=c==="initial"?o:`${c}:${o}`;l.push(u)}}}return l.length>0?l.join(" "):""}if(e)return o}}function mo(e,t,o){let n=e?"-":"",a=o(t),s=a?.startsWith("-"),i=s?"-":"",l=s?a?.substring(1):a;return`${i}${e}${n}${l}`}function _r({customProperties:e,value:t,propValues:o,propValueSet:n,parseValue:a=s=>s}){if(!t||typeof t=="string"&&it(o,n,t))return;let s;if(typeof t=="string"){let i=a(t);s={};for(let l of e)s[l]=i;return s}if(De(t)){let i=t;for(let l in i){if(!Nt(i,l)||!St.has(l))continue;let c=i[l];if(c===void 0||it(o,n,c))continue;let p=a(c);s??(s={});for(let u of e){let d=l==="initial"?u:`${u}-${l}`;s[d]=p}}}return s??{}}function At(...e){let t;for(let o of e)o&&(t===void 0&&(t={}),Object.assign(t,o));return t}function qr(e,t){let o=e.initial,n=!1;return t.hasDefault&&o===void 0&&(o=t.default,n=!0),t.enumValueSet!==void 0&&!t.enumValueSet.has(o)&&(o=t.default,n=!0),n?{...e,initial:o}:e}function ee(e,...t){let{styling:o,passthrough:n,stylingKeys:a}=uo(t),s={};for(let c in e)a.has(c)||(s[c]=e[c]);for(let c=0;c<n.length;c++){let p=n[c],u=s[p.key];if(u===void 0){p.hasDefault&&(s[p.key]=p.default);continue}p.enumValueSet!==void 0&&!p.enumValueSet.has(u)&&!De(u)&&(s[p.key]=p.default)}let i,l=[];for(let c=0;c<o.length;c++){let p=o[c],u=e[p.key];if(u===void 0&&p.hasDefault&&(u=p.default),p.enumValueSet!==void 0&&!p.enumValueSet.has(u)&&!De(u)&&(u=p.default),!!u){if(De(u)){if(!p.responsive)continue;u=qr(u,p)}if(p.type==="enum"){let d=Et({allowArbitraryValues:!1,value:u,className:p.className,propValues:p.values,propValueSet:p.valueSet,parseValue:p.parseValue});d&&l.push(d);continue}if(p.type==="string"||p.type==="enum | string"){let[d,h]=fo({className:p.className,customProperties:p.customProperties,propValues:p.type==="string"?[]:p.values,propValueSet:p.type==="string"?void 0:p.valueSet,parseValue:p.parseValue,value:u});h&&(i=At(i,h)),d&&l.push(d);continue}if(p.type==="boolean"){l.push(p.className);continue}}}return s.className=(0,ho.default)(l.length>0?l.join(" "):void 0,e.className),s.style=At(i,e.style),s}var we=["0","1","2","3","4","5","6","7","8","9","10","11","12"],yo={p:{type:"enum | string",className:"kui-r-p",customProperties:["--p"],values:we,responsive:!0},px:{type:"enum | string",className:"kui-r-px",customProperties:["--pl","--pr"],values:we,responsive:!0},py:{type:"enum | string",className:"kui-r-py",customProperties:["--pt","--pb"],values:we,responsive:!0},pt:{type:"enum | string",className:"kui-r-pt",customProperties:["--pt"],values:we,responsive:!0},pr:{type:"enum | string",className:"kui-r-pr",customProperties:["--pr"],values:we,responsive:!0},pb:{type:"enum | string",className:"kui-r-pb",customProperties:["--pb"],values:we,responsive:!0},pl:{type:"enum | string",className:"kui-r-pl",customProperties:["--pl"],values:we,responsive:!0}};var lt={height:{type:"string",className:"kui-r-h",customProperties:["--height"],responsive:!0},minHeight:{type:"string",className:"kui-r-min-h",customProperties:["--min-height"],responsive:!0},maxHeight:{type:"string",className:"kui-r-max-h",customProperties:["--max-height"],responsive:!0}};var ge={width:{type:"string",className:"kui-r-w",customProperties:["--width"],responsive:!0},minWidth:{type:"string",className:"kui-r-min-w",customProperties:["--min-width"],responsive:!0},maxWidth:{type:"string",className:"kui-r-max-w",customProperties:["--max-width"],responsive:!0}};var Ft=["visible","hidden","clip","scroll","auto"],Yr=["static","relative","absolute","fixed","sticky"],$e=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Zr=["0","1"],Xr=["0","1"],Jr=["start","center","end","baseline","stretch"],Qr=["start","center","end","baseline","stretch"],go={...yo,...ge,...lt,position:{type:"enum",className:"kui-r-position",values:Yr,responsive:!0},inset:{type:"enum | string",className:"kui-r-inset",customProperties:["--inset"],values:$e,responsive:!0},top:{type:"enum | string",className:"kui-r-top",customProperties:["--top"],values:$e,responsive:!0},right:{type:"enum | string",className:"kui-r-right",customProperties:["--right"],values:$e,responsive:!0},bottom:{type:"enum | string",className:"kui-r-bottom",customProperties:["--bottom"],values:$e,responsive:!0},left:{type:"enum | string",className:"kui-r-left",customProperties:["--left"],values:$e,responsive:!0},overflow:{type:"enum",className:"kui-r-overflow",values:Ft,responsive:!0},overflowX:{type:"enum",className:"kui-r-ox",values:Ft,responsive:!0},overflowY:{type:"enum",className:"kui-r-oy",values:Ft,responsive:!0},flexBasis:{type:"string",className:"kui-r-fb",customProperties:["--flex-basis"],responsive:!0},flexShrink:{type:"enum | string",className:"kui-r-fs",customProperties:["--flex-shrink"],values:Zr,responsive:!0},flexGrow:{type:"enum | string",className:"kui-r-fg",customProperties:["--flex-grow"],values:Xr,responsive:!0},gridArea:{type:"string",className:"kui-r-ga",customProperties:["--grid-area"],responsive:!0},gridColumn:{type:"string",className:"kui-r-gc",customProperties:["--grid-column"],responsive:!0},gridColumnStart:{type:"string",className:"kui-r-gcs",customProperties:["--grid-column-start"],responsive:!0},gridColumnEnd:{type:"string",className:"kui-r-gce",customProperties:["--grid-column-end"],responsive:!0},gridRow:{type:"string",className:"kui-r-gr",customProperties:["--grid-row"],responsive:!0},gridRowStart:{type:"string",className:"kui-r-grs",customProperties:["--grid-row-start"],responsive:!0},gridRowEnd:{type:"string",className:"kui-r-gre",customProperties:["--grid-row-end"],responsive:!0},alignSelf:{type:"enum",className:"kui-r-as",values:Jr,responsive:!0},justifySelf:{type:"enum",className:"kui-r-js",values:Qr,responsive:!0}};var ke=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9","-10","-11","-12","bleed"],Po={m:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-ml",customProperties:["--ml"]}};var pt=require("radix-ui"),Ps=pt.Slot.Root,ie=pt.Slot.Root,bs=pt.Slot.Slottable;var Lt=["0","1","2","3","4","5","6","7","8","9","10","11","12"],bo={gap:{type:"enum | string",className:"kui-r-gap",customProperties:["--gap"],values:Lt,responsive:!0},gapX:{type:"enum | string",className:"kui-r-cg",customProperties:["--column-gap"],values:Lt,responsive:!0},gapY:{type:"enum | string",className:"kui-r-rg",customProperties:["--row-gap"],values:Lt,responsive:!0}};var en=["div","span"],tn=["none","inline-flex","flex"],on=["row","column","row-reverse","column-reverse"],rn=["start","center","end","baseline","stretch"],nn=["start","center","end","between"],sn=["nowrap","wrap","wrap-reverse"],vo={as:{type:"enum",values:en,default:"div"},...ae,display:{type:"enum",className:"kui-r-display",values:tn,responsive:!0},direction:{type:"enum",className:"kui-r-fd",values:on,responsive:!0},align:{type:"enum",className:"kui-r-ai",values:rn,responsive:!0},justify:{type:"enum",className:"kui-r-jc",values:nn,parseValue:an,responsive:!0},wrap:{type:"enum",className:"kui-r-fw",values:sn,responsive:!0},...bo};function an(e){return e==="between"?"space-between":e}var me=ct.forwardRef((e,t)=>{let{className:o,asChild:n,as:a="div",...s}=ee(e,vo,go,Po);return ct.createElement(n?ie:a,{...s,ref:t,className:(0,Ro.default)("kui-Flex",o)})});me.displayName="Flex";var V=x(require("react")),xo=x(require("classnames"));var Co={loading:{type:"boolean",default:!0}};var ze=V.forwardRef((e,t)=>{let{className:o,children:n,loading:a,...s}=ee(e,Co);if(!a)return n;let i=s["aria-label"]!==void 0||s["aria-labelledby"]!==void 0,l=V.createElement("span",{role:i?"status":void 0,"aria-hidden":i?void 0:!0,...s,ref:t,className:(0,xo.default)("kui-Spinner",o)},V.createElement("span",{className:"kui-SpinnerWheel"},V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"}),V.createElement("span",{className:"kui-SpinnerLeaf"})),typeof s["aria-label"]=="string"?V.createElement("span",{className:"kui-sr-only"},s["aria-label"]):null);return n===void 0?l:V.createElement(me,{asChild:!0,position:"relative",align:"center",justify:"center"},V.createElement("span",{"aria-busy":"true"},V.createElement("span",{"aria-hidden":!0,className:"kui-SpinnerHiddenChildren"},n),V.createElement(me,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},V.createElement("span",null,l))))});ze.displayName="Spinner";var g=x(require("react")),ln=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"})));ln.displayName="ThickDividerHorizontalIcon";var pn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));pn.displayName="ThickCheckIcon";var cn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));cn.displayName="ChevronDownIcon";var un=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));un.displayName="ThickChevronRightIcon";var mn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.76174 0.201711C5.45892 -0.0809141 4.98433 -0.0645489 4.70171 0.238264L1.20171 3.98826C0.932757 4.27642 0.932757 4.72359 1.20171 5.01174L4.70171 8.76174C4.98433 9.06455 5.45892 9.08092 5.76174 8.79829C6.06455 8.51567 6.08091 8.04108 5.79829 7.73826L2.77591 4.5L5.79829 1.26174C6.08091 0.958928 6.06455 0.484337 5.76174 0.201711Z"})));mn.displayName="ThickChevronLeftIcon";var dn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("circle",{cx:"4.5",cy:"4.5",r:"2"})));dn.displayName="ThickDotIcon";var Bt=g.default.forwardRef((e,t)=>g.default.createElement("svg",{...e,ref:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"M18 6 6 18"}),g.default.createElement("path",{d:"m6 6 12 12"})));Bt.displayName="CloseIcon";var Vt=g.default.forwardRef((e,t)=>g.default.createElement("svg",{...e,ref:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"})));Vt.displayName="PaperclipIcon";var fn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),g.default.createElement("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})));fn.displayName="FileIcon";var Ot=g.default.forwardRef((e,t)=>g.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),g.default.createElement("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),g.default.createElement("path",{d:"M10 9H8"}),g.default.createElement("path",{d:"M16 13H8"}),g.default.createElement("path",{d:"M16 17H8"})));Ot.displayName="FileTextIcon";var Mt=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{d:"M5 12.75L9.5 17.25L19 7.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})));Mt.displayName="TickIcon";var Ke=x(require("react")),hn="2",Se=Ke.createContext(hn);Se.displayName="ThemeSizeContext";function To(e,t){if(t.includes(e))return e;let o=Number(e),n=t[0],a=1/0;for(let s=0;s<t.length;s++){let i=Math.abs(Number(t[s])-o);i<a&&(a=i,n=t[s])}return n}function Ue(e,t){let o=Ke.useContext(Se);return e!==void 0?e:To(o,t.values)}function Do(e,t){let o=Ke.useContext(Se);if(e.size!==void 0)return e;let n=To(o,t.values);return n===t.default?e:{...e,size:n}}var Ht=y.forwardRef((e,t)=>{let o=Do(e,kt.size),{className:n,children:a,asChild:s,as:i,color:l,radius:c,disabled:p,done:u=!1,...d}=ee(o,kt),h=!!o.loading,R=o.loading!==void 0,v=!!p||h,{onClick:P,"aria-describedby":T}=d,B=y.useCallback(A=>{if(v){A.preventDefault();return}P?.(A)},[v,P]),N=y.useMemo(()=>{let A=s&&y.isValidElement(a)?a.props.children:a,K=It(A),U=F=>y.isValidElement(F)&&(F.type==="svg"||typeof F.type!="string"&&F.type!==y.Fragment&&!yn.has(zt(F.type)));return{iconStart:U(K[0]),iconEnd:U(K[K.length-1])}},[s,a]),[E,I]=y.useState(null),H=y.useRef(null),$=(0,ut.useComposedRefs)(t,H);(0,ut.useLayoutEffect)(()=>{let A=H.current;if(!A||h||u)return;let K=A.querySelector(":scope > .kui-BaseButtonContent")??A,U=wo(K,"start"),F=wo(K,"end");I(ne=>ne&&ne.iconStart===U&&ne.iconEnd===F?ne:{iconStart:U,iconEnd:F})});let{iconStart:C,iconEnd:Y}=E??N,te=!!d["data-icon-only"],pe=y.useMemo(()=>{if(!u)return a;let A=y.createElement(Mt,{key:"kui-done-tick",className:"kui-BaseButtonTick","aria-hidden":!0}),K=U=>{if(te)return A;let F=It(U),ne=F.findIndex(m=>!(typeof m=="string"&&!m.trim()));return C&&ne!==-1?F.map((m,S)=>S===ne?A:m):[A,...F]};if(s&&y.isValidElement(a)){let U=a;return y.cloneElement(U,void 0,K(U.props.children))}return K(a)},[u,a,te,C,s]),M=s?So.Slot.Root:i||"button",Z=["button","input","textarea","select"],ce=s?y.isValidElement(a)?a.type:void 0:i||"button",oe=typeof ce=="string"&&Z.includes(ce),{onClickCapture:re}=d,ue=y.useCallback(A=>{if(s&&v){A.preventDefault(),A.stopPropagation();return}re?.(A)},[s,v,re]),se=!s&&(!i||i==="button"),X="type"in d,J=y.useId(),Re=h?`${J}-loading`:void 0,Ae=y.useMemo(()=>h?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":[T,Re].filter(Boolean).join(" ")}:p&&(!oe||s)?{"aria-disabled":!0}:{},[h,Re,T,p,oe,s]);return y.createElement(M,{"data-accent-color":l,"data-radius":c,"data-icon-start":C||void 0,"data-icon-end":Y||void 0,"data-done":u||void 0,...d,...Ae,"data-disabled":v||void 0,onClick:B,onClickCapture:ue,ref:$,className:(0,ko.default)("kui-reset","kui-BaseButton",n),...oe&&{disabled:p},...se&&!X?{type:"button"}:{}},s&&!h?pe:y.createElement(y.Fragment,null,R?y.createElement("span",{className:"kui-BaseButtonContent","aria-hidden":h||void 0},pe):pe,h?y.createElement(y.Fragment,null,y.createElement("span",{className:"kui-sr-only"},y.createElement("span",{id:Re,"aria-hidden":!0},"Loading"),a),y.createElement(me,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},y.createElement("span",null,y.createElement(ze,{"aria-hidden":"true"})))):null))});Ht.displayName="BaseButton";var yn=new Set(["Text","Kbd","Code","Link","Em","Strong","Quote","Badge","Trans"]);function zt(e){if(!e||typeof e!="function"&&typeof e!="object")return"";let t=e;return t.displayName||t.name||zt(t.render)||zt(t.type)}function It(e){return y.Children.toArray(e).flatMap(t=>y.isValidElement(t)&&t.type===y.Fragment?It(t.props.children):[t])}function wo(e,t){let o=t==="start"?e.firstChild:e.lastChild;for(;o&&(o.nodeType===Node.COMMENT_NODE||o.nodeType===Node.TEXT_NODE&&!o.textContent?.trim());)o=t==="start"?o.nextSibling:o.previousSibling;return o?.nodeType===Node.ELEMENT_NODE&&o.localName==="svg"}var W=x(require("react")),Go=x(require("classnames")),be=require("radix-ui");var Ne=x(require("react")),Mo=require("radix-ui");var gn=["loud","medium","quiet"],No={emphasis:{type:"enum",className:"kui-emphasis",values:gn,default:void 0}};var Pn=["normal","start","end","both"],Eo={trim:{type:"enum",className:"kui-r-lt",values:Pn,responsive:!0}};var bn=["left","center","right"],Ao={align:{type:"enum",className:"kui-r-ta",values:bn,responsive:!0}};var vn=["wrap","nowrap","pretty","balance"],Fo={wrap:{type:"enum",className:"kui-r-tw",values:vn,responsive:!0}};var Lo={truncate:{type:"boolean",className:"kui-truncate"}};var Rn=["sans","mono","serif"],Bo={font:{type:"enum",className:"kui-r-ff",values:Rn}};var Cn=["regular","medium","semibold"],Vo={weight:{type:"enum",className:"kui-r-weight",values:Cn,responsive:!0}};var xn=["span","div","label","p"],Tn=["1","2","3","4","5","6","7","8","9"],Oo={as:{type:"enum",values:xn,default:"span"},...ae,size:{type:"enum",className:"kui-r-size",values:Tn,responsive:!0},...Bo,...Vo,...Ao,...Eo,...Lo,...Fo,...po,...No};var de=Ne.memo(Ne.forwardRef((e,t)=>{let{children:o,className:n,asChild:a,as:s="span",color:i,...l}=ee(e,Oo),c=n?`kui-Text ${n}`:"kui-Text";return a?Ne.createElement(Mo.Slot.Root,{"data-accent-color":i,...l,ref:t,className:c},o):Ne.createElement(s,{"data-accent-color":i,...l,ref:t,className:c},o)}));de.displayName="Text";var O=x(require("react")),Ho=x(require("classnames")),_e=require("radix-ui");function zo(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}var jt=x(require("react"));function Pe(e){let[t,o]=jt.useState(e),[n,a]=jt.useState(e);return Object.is(e,n)||(a(e),o(e)),[t,o]}var Dn=["inherit","light","dark"],Io=["sans","mono","serif"],wn=["1","2","3","4"],L={...ae,hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:Dn,default:"inherit"},accentColor:{type:"enum",values:st,default:"gray"},grayColor:{type:"enum",values:lo,default:"gray"},radius:{type:"enum",values:wt,default:"full"},fontFamily:{type:"enum",values:Io,default:"sans"},headingFontFamily:{type:"enum",values:Io},size:{type:"enum",values:wn,default:"2"}};var _=()=>{},Ra={appearance:L.appearance.default,accentColor:L.accentColor.default,grayColor:L.grayColor.default,resolvedGrayColor:L.grayColor.default,radius:L.radius.default,fontFamily:L.fontFamily.default,headingFontFamily:void 0,size:L.size.default,onAppearanceChange:_,onAccentColorChange:_,onGrayColorChange:_,onRadiusChange:_,onFontFamilyChange:_,onHeadingFontFamilyChange:_,onSizeChange:_},Wt=O.createContext(void 0);var Gt=O.forwardRef((e,t)=>{let o=O.useContext(Wt),n=_e.Direction.useDirection();return o===void 0?O.createElement(_e.Direction.Provider,{dir:n},O.createElement(jo,{...e,ref:t})):O.createElement($t,{...e,ref:t})});Gt.displayName="Theme";var jo=O.forwardRef((e,t)=>{let{appearance:o=L.appearance.default,accentColor:n=L.accentColor.default,grayColor:a=L.grayColor.default,radius:s=L.radius.default,fontFamily:i=L.fontFamily.default,headingFontFamily:l,size:c=L.size.default,hasBackground:p=L.hasBackground.default,...u}=e,[d,h]=Pe(o),[R,v]=Pe(n),[P,T]=Pe(a),[B,N]=Pe(s),[E,I]=Pe(i),[H,$]=Pe(l),[C,Y]=Pe(c);return O.createElement($t,{...u,ref:t,isRoot:!0,hasBackground:p,appearance:d,accentColor:R,grayColor:P,radius:B,fontFamily:E,headingFontFamily:H,size:C,onAppearanceChange:h,onAccentColorChange:v,onGrayColorChange:T,onRadiusChange:N,onFontFamilyChange:I,onHeadingFontFamilyChange:$,onSizeChange:Y})});jo.displayName="ThemeRoot";var $t=O.forwardRef((e,t)=>{let o=O.useContext(Wt),{asChild:n,isRoot:a,hasBackground:s,appearance:i=e.appearance??o?.appearance??L.appearance.default,accentColor:l=e.accentColor??o?.accentColor??L.accentColor.default,grayColor:c=e.grayColor??o?.resolvedGrayColor??L.grayColor.default,radius:p=e.radius??o?.radius??L.radius.default,fontFamily:u=e.fontFamily??o?.fontFamily??L.fontFamily.default,headingFontFamily:d=e.headingFontFamily??o?.headingFontFamily,size:h=e.size??o?.size??L.size.default,onAppearanceChange:R=o?.onAppearanceChange??_,onAccentColorChange:v=o?.onAccentColorChange??_,onGrayColorChange:P=o?.onGrayColorChange??_,onRadiusChange:T=o?.onRadiusChange??_,onFontFamilyChange:B=o?.onFontFamilyChange??_,onHeadingFontFamilyChange:N=o?.onHeadingFontFamilyChange??_,onSizeChange:E=o?.onSizeChange??_,...I}=e,H=n?_e.Slot.Root:"div",$=c==="auto"?zo(l):c,C=e.appearance==="light"||e.appearance==="dark",Y=s===void 0?a||C:s;return O.createElement(Wt.Provider,{value:O.useMemo(()=>({appearance:i,accentColor:l,grayColor:c,resolvedGrayColor:$,radius:p,fontFamily:u,headingFontFamily:d,size:h,onAppearanceChange:R,onAccentColorChange:v,onGrayColorChange:P,onRadiusChange:T,onFontFamilyChange:B,onHeadingFontFamilyChange:N,onSizeChange:E}),[i,l,c,$,p,u,d,h,R,v,P,T,B,N,E])},O.createElement(Se.Provider,{value:h},O.createElement(H,{"data-is-root-theme":a?"true":"false","data-accent-color":l,"data-gray-color":$,"data-has-background":Y?"true":"false","data-radius":p,"data-font-family":u,"data-heading-font-family":d,ref:t,...I,className:(0,Ho.default)("kui-theme",{light:i==="light",dark:i==="dark"},I.className)})))});$t.displayName="ThemeImpl";var Wo={content:{type:"ReactNode",required:!0},width:ge.width,minWidth:ge.minWidth,maxWidth:{...ge.maxWidth,default:"360px"}};var $o=200,Ko=W.createContext(!1);function kn({delayDuration:e=$o,children:t,...o}){return W.createElement(Ko.Provider,{value:!0},W.createElement(be.Tooltip.Provider,{delayDuration:e,...o},t))}kn.displayName="TooltipProvider";var Kt=W.forwardRef((e,t)=>{let{children:o,className:n,open:a,defaultOpen:s,onOpenChange:i,delayDuration:l,disableHoverableContent:c,content:p,container:u,forceMount:d,...h}=ee(e,Wo),R={open:a,defaultOpen:s,onOpenChange:i,delayDuration:l,disableHoverableContent:c},v=W.useContext(Ko),P=W.createElement(be.Tooltip.Root,{...R},W.createElement(be.Tooltip.Trigger,{asChild:!0},o),W.createElement(be.Tooltip.Portal,{container:u,forceMount:d},W.createElement(Gt,{asChild:!0},W.createElement(be.Tooltip.Content,{sideOffset:4,collisionPadding:10,...h,asChild:!1,ref:t,className:(0,Go.default)("kui-TooltipContent",n)},W.createElement(de,{as:"p",className:"kui-TooltipText",size:"1"},p),W.createElement(be.Tooltip.Arrow,{className:"kui-TooltipArrow"})))));return v?P:W.createElement(be.Tooltip.Provider,{delayDuration:$o},P)});Kt.displayName="Tooltip";var mt=x(require("react"));function Uo(e){let t=mt.useId(),o=!!e,n=mt.useMemo(()=>o?{"aria-describedby":t}:{},[o,t]);return{tooltipId:t,hasTooltip:o,accessibilityProps:n}}var Sn={loud:"solid",medium:"raised",quiet:"ghost"};function Nn(e){if(e["aria-label"]||e["aria-labelledby"])return;console.error("Button: an `iconOnly` button must have an accessible name. Pass `aria-label`, or `aria-labelledby` referencing a label element.")}var fe=qe.forwardRef(({className:e,style:t,tooltip:o,tooltipSide:n="top",tooltipAlign:a="center",tooltipDelayDuration:s,tooltipDisableHoverableContent:i,iconOnly:l=!1,emphasis:c,variant:p,...u},d)=>{let{tooltipId:h,hasTooltip:R,accessibilityProps:v}=Uo(o);l&&(Nn(u),u.fullWidth=!1);let P=c!==void 0?Sn[c]:p,T=u["aria-describedby"],B=v["aria-describedby"],N=[T,B].filter(Boolean).join(" ")||void 0,E=qe.createElement(Ht,{...u,variant:P,"aria-describedby":N,ref:d,"data-icon-only":l||void 0,className:(0,_o.default)("kui-Button",e),style:t});return R?qe.createElement(Kt,{content:o,side:n,align:a,delayDuration:s,disableHoverableContent:i,id:h},E):E});fe.displayName="Button";var z=x(require("react")),Jo=x(require("classnames")),ve=require("radix-ui"),Qo=require("radix-ui/internal");var En=["vertical","horizontal","both"],dt={...ae,...at,scrollbars:{type:"enum",values:En,default:"both"},fade:{type:"boolean",default:!1}};var ft=x(require("react"));function qo(e){let[t,o]=ft.useState(null);return ft.useEffect(()=>{if(!e||!t)return;let n=0,a=()=>{n=0;let c=Math.max(0,t.scrollTop),p=Math.max(0,t.scrollHeight-t.clientHeight-t.scrollTop);t.style.setProperty("--scroll-overflow-start",`${c}px`),t.style.setProperty("--scroll-overflow-end",`${p}px`);let u=Math.abs(t.scrollLeft),d=Math.max(0,t.scrollWidth-t.clientWidth-u);t.style.setProperty("--scroll-overflow-x-start",`${u}px`),t.style.setProperty("--scroll-overflow-x-end",`${d}px`)},s=()=>{n||(n=requestAnimationFrame(a))};a(),t.addEventListener("scroll",s,{passive:!0});let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(t);for(let c of Array.from(t.children))i?.observe(c);let l=typeof MutationObserver>"u"?null:new MutationObserver(s);return l?.observe(t,{childList:!0}),()=>{n&&cancelAnimationFrame(n),t.removeEventListener("scroll",s),i?.disconnect(),l?.disconnect(),t.style.removeProperty("--scroll-overflow-start"),t.style.removeProperty("--scroll-overflow-end"),t.style.removeProperty("--scroll-overflow-x-start"),t.style.removeProperty("--scroll-overflow-x-end")}},[e,t]),o}var ht=x(require("react"));function Zo(){let[e,t]=ht.useState(null);return ht.useEffect(()=>{let o=e?.parentElement;if(!e||!o)return;let n=0,a=()=>{n=0;for(let i of o.querySelectorAll(":scope > .kui-ScrollAreaScrollbar > .kui-ScrollAreaThumb")){let l=i.parentElement,c=getComputedStyle(l);if(l.dataset.orientation==="horizontal"){let p=l.clientWidth-parseFloat(c.paddingLeft)-parseFloat(c.paddingRight),u=Yo(e.scrollLeft,e.scrollWidth-e.offsetWidth,p-i.offsetWidth);i.style.transform=`translate3d(${u}px, 0, 0)`}else{let p=l.clientHeight-parseFloat(c.paddingTop)-parseFloat(c.paddingBottom),u=Yo(e.scrollTop,e.scrollHeight-e.offsetHeight,p-i.offsetHeight);i.style.transform=`translate3d(0, ${u}px, 0)`}}},s=()=>{n||(n=requestAnimationFrame(a))};return e.addEventListener("scroll",s,{passive:!0}),()=>{n&&cancelAnimationFrame(n),e.removeEventListener("scroll",s)}},[e]),t}function Yo(e,t,o){return t<=0||o<=0?0:Math.min(Math.max(e,-t),t)/t*o}var yt=x(require("react"));function Xo(e,t){let{asChild:o,children:n}=e;if(!o)return typeof t=="function"?t(n):t;let a=yt.Children.only(n);return yt.cloneElement(a,{children:typeof t=="function"?t(a.props.children):t})}var An='[role="menu"], [role="listbox"]';function Fn(e,t){z.useEffect(()=>{if(!t||!e||e.closest(An))return;let o=0,n=()=>{o=0,e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?e.setAttribute("tabindex","0"):e.removeAttribute("tabindex")},a=()=>{o||(o=requestAnimationFrame(n))};n();let s=typeof ResizeObserver>"u"?null:new ResizeObserver(a);s?.observe(e);for(let i of Array.from(e.children))s?.observe(i);return()=>{o&&cancelAnimationFrame(o),s?.disconnect()}},[e,t])}var Ut=z.forwardRef((e,t)=>{let{asChild:o,children:n,className:a,style:s,type:i,scrollHideDelay:l=i!=="scroll"?0:void 0,dir:c,radius:p=dt.radius.default,scrollbars:u=dt.scrollbars.default,fade:d=dt.fade.default,...h}=ee(e,ge,lt),[R,v]=z.useState(null),P=qo(d),T=Zo(),B=(0,Qo.useComposedRefs)(t,P,T,v);Fn(R,h.tabIndex===void 0);let N=h["aria-label"]!==void 0||h["aria-labelledby"]!==void 0;return z.createElement(ve.ScrollArea.Root,{type:i,scrollHideDelay:l,dir:c,className:(0,Jo.default)("kui-ScrollAreaRoot",a),"data-fade":d?"":void 0,style:s,asChild:o},Xo({asChild:o,children:n},E=>z.createElement(z.Fragment,null,z.createElement(ve.ScrollArea.Viewport,{role:N?"region":void 0,...h,ref:B,className:"kui-ScrollAreaViewport"},E),z.createElement("div",{className:"kui-ScrollAreaViewportFocusRing"}),u!=="vertical"?z.createElement(ve.ScrollArea.Scrollbar,{"data-radius":p,orientation:"horizontal",className:"kui-ScrollAreaScrollbar"},z.createElement(ve.ScrollArea.Thumb,{className:"kui-ScrollAreaThumb"})):null,u!=="horizontal"?z.createElement(ve.ScrollArea.Scrollbar,{"data-radius":p,orientation:"vertical",className:"kui-ScrollAreaScrollbar"},z.createElement(ve.ScrollArea.Thumb,{className:"kui-ScrollAreaThumb"})):null,u==="both"?z.createElement(ve.ScrollArea.Corner,{className:"kui-ScrollAreaCorner"}):null)))});Ut.displayName="ScrollArea";var k=x(require("react")),er=x(require("classnames"));var gt=k.createContext(void 0),tr={values:["1","2","3","4"]},_t=k.forwardRef(({kind:e,size:t="2",color:o="gray",className:n,children:a,trailing:s,leading:i,...l},c)=>k.createElement("div",{role:"status","aria-live":"polite",...l,ref:c,className:(0,er.default)("kui-NoticeRoot",`kui-r-size-${t}`,n),"data-kind":e,"data-accent-color":o},i?k.createElement("span",{className:"kui-NoticeIcon","aria-hidden":!0},i):null,k.createElement(de,{as:"div",size:t,className:"kui-NoticeText"},a),s));_t.displayName="Strip";var Ln=k.forwardRef(({icon:e,action:t,onDismiss:o,dismissLabel:n="Dismiss",size:a,...s},i)=>{let l=k.useContext(gt),c=Ue(a??l,tr),p=t||o?k.createElement("span",{className:"kui-NoticeActions"},t?k.createElement(Se.Provider,{value:c},t):null,o?k.createElement(fe,{iconOnly:!0,size:c,variant:"ghost",color:"gray","aria-label":n,className:"kui-NoticeDismiss",onClick:o},k.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none","aria-hidden":!0},k.createElement("path",{d:"M4 4l7 7M11 4l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))):null):null;return k.createElement(_t,{...s,size:c,ref:i,kind:"notice",leading:e,trailing:p})});Ln.displayName="Notice";var Bn=k.forwardRef(({confirmLabel:e,cancelLabel:t="Not now",onConfirm:o,onCancel:n,busy:a=!1,size:s,color:i="gray",...l},c)=>{let p=k.useContext(gt),u=Ue(s??p,tr);return k.createElement(_t,{...l,size:u,color:i,ref:c,kind:"confirmation",trailing:k.createElement("span",{className:"kui-NoticeActions"},k.createElement(fe,{size:u,variant:"ghost",color:"gray",disabled:a,onClick:n},t),k.createElement(fe,{size:u,variant:"solid",color:i,loading:a,onClick:o},e))})});Bn.displayName="Confirmation";var qt=require("radix-ui"),Yt=qt.VisuallyHidden.Root,Qa=qt.VisuallyHidden.Root;function or(e,t){let{placeholder:o}=e;if(!o){t();return}e.placeholder="";try{t()}finally{e.placeholder=o}}var Vn={values:["1","2","3"]},sr=r.createContext(null),Xt=r.createContext(""),le=()=>{let e=r.useContext(sr);if(!e)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return e},Ye=e=>Array.isArray(e)?e:typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[],On=(e,t)=>{if(t.length===0)return!0;let o=e.type.toLowerCase(),n=e.name.toLowerCase();for(let a of t){let s=a.toLowerCase();if(s.includes("/")){let[i,l]=s.split("/"),[c,p]=o.split("/");if(i==="*"||i===c&&(l==="*"||l===p))return!0}else if(s.startsWith(".")&&n.endsWith(s))return!0}return!1},Mn=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i,ar=(e,t)=>(t||"").toLowerCase().startsWith("image/")||Mn.test(e),Zt=e=>e.trim().length>0,rr=(e,t)=>`${e} ${t}${e===1?"":"s"}`,zn=0,In=()=>`chatbar-attachment-${Date.now()}-${++zn}`,ir=r.forwardRef((e,t)=>{let{className:o,style:n,children:a,value:s,defaultValue:i="",onValueChange:l,open:c,defaultOpen:p=!1,onOpenChange:u,expandOn:d="both",minLines:h=3,maxLines:R=6,sendMode:v="whenDirty",disabled:P,readOnly:T,onSubmit:B,size:N,variant:E,color:I,radius:H,width:$,maxWidth:C,attachments:Y,defaultAttachments:te,onAttachmentsChange:pe,accept:M,multiple:Z=!0,maxAttachments:ce,maxFileSize:oe,paste:re=!0,pasteAccept:ue,clearOnSubmit:se=!0,onAttachmentReject:X,dropzone:J=!0,apiRef:Re,onBlurCapture:Ae,notices:A,context:K,...U}=e,F=Ue(N,Vn),ne=s!=null,[m,S]=r.useState(i),G=ne?s:m,Fe=c!=null,[Ce,Le]=r.useState(p),Ie=Fe?c:Ce,xe="attachments"in e,[He,Ze]=r.useState(()=>te??[]),je=r.useMemo(()=>xe?Y??[]:He,[xe,Y,He]),[Qt,vr]=r.useState({text:"",id:0}),We=r.useCallback(f=>vr(b=>({text:f,id:b.id+1})),[]),eo=r.useRef(null),Rr=(0,Ee.useComposedRefs)(t,eo),Pt=r.useRef(null),bt=r.useRef(null),Ge=r.useRef(!1),Xe=r.useRef(!1),Je=r.useRef(void 0),vt=r.useRef(null),to=Ye(M).join(","),Rt=Ye(ue).join(","),Ct=r.useMemo(()=>Ye(to),[to]),Cr=r.useMemo(()=>Rt?Ye(Rt):Ct,[Rt,Ct]),oo={value:G,attachments:je,accepts:Ct,pasteAccepts:Cr,multiple:Z,maxAttachments:ce,maxFileSize:oe,disabled:P,readOnly:T,expandOn:d,isValueControlled:ne,isOpenControlled:Fe,isAttachmentsControlled:xe,onValueChange:l,onOpenChange:u,onAttachmentsChange:pe,onAttachmentReject:X,onSubmit:B},j=r.useRef(oo);j.current=oo;let xt=r.useRef(null),he=r.useCallback(()=>xt.current??j.current.attachments,[]),Be=r.useCallback(f=>{j.current.isOpenControlled||Le(f),j.current.onOpenChange?.(f)},[]),Qe=r.useCallback(f=>{j.current.isValueControlled||S(f),j.current.onValueChange?.(f)},[]),Ve=r.useCallback(f=>{xt.current=f,queueMicrotask(()=>{xt.current=null}),j.current.isAttachmentsControlled||Ze(f),j.current.onAttachmentsChange?.(f)},[]),et=r.useRef(new Set),Oe=r.useCallback((f,b,D=j.current.multiple)=>{let w=j.current;if(w.disabled||w.readOnly||f.length===0)return 0;let ye=he(),Te=[],Me=[],Er=typeof w.maxAttachments=="number"?Math.max(w.maxAttachments-ye.length,0):1/0,Ar=D?1/0:1;for(let Q of f){if(Te.length>=Er||Te.length>=Ar){Me.push({file:Q,reason:"count"});continue}if(typeof w.maxFileSize=="number"&&Q.size>w.maxFileSize){Me.push({file:Q,reason:"size"});continue}if(!On(Q,b)){Me.push({file:Q,reason:"type"});continue}let Dt=ar(Q.name,Q.type)?URL.createObjectURL(Q):void 0;Dt&&et.current.add(Dt),Te.push({id:In(),name:Q.name,size:Q.size,type:Q.type,file:Q,url:Dt,status:"idle"})}let rt=[];return Te.length>0&&(Ve(ye.concat(Te)),w.expandOn!=="none"&&Be(!0),rt.push(`${rr(Te.length,"file")} attached.`)),Me.length>0&&(w.onAttachmentReject?.(Me),rt.push(`${rr(Me.length,"file")} could not be attached.`)),rt.length>0&&We(rt.join(" ")),Te.length},[he,Ve,Be,We]),tt=r.useCallback(f=>Oe(f,j.current.accepts),[Oe]),ro=r.useCallback(f=>Oe(f,j.current.pasteAccepts),[Oe]),no=r.useCallback(f=>{let b=he(),D=b.find(w=>w.id===f);D&&(Ve(b.filter(w=>w.id!==f)),We(`Removed ${D.name}.`))},[he,Ve,We]),so=r.useCallback(f=>{let b=j.current;if(b.disabled||b.readOnly)return!1;let D=he();if(!Zt(b.value)&&D.length===0)return!1;let w={value:b.value,attachments:D};if(f&&b.onSubmit)for(let ye of D)ye.url&&et.current.delete(ye.url);return b.onSubmit?.(w),f&&(Qe(""),Ve([])),!0},[he,Qe,Ve]);r.useEffect(()=>{let f=et.current;if(f.size===0)return;let b=new Set(je.map(D=>D.url));for(let D of Array.from(f))b.has(D)||(URL.revokeObjectURL(D),f.delete(D))},[je]),r.useEffect(()=>{let f=et.current;return()=>{if(!j.current.isAttachmentsControlled){for(let b of Array.from(f))URL.revokeObjectURL(b);f.clear()}}},[]);let ot=r.useCallback(f=>{let b=j.current,D=bt.current;if(clearTimeout(Je.current),Xe.current=!1,!D||b.disabled||b.readOnly)return;let w=f?.accept!=null?Ye(f.accept):b.accepts,ye=f?.multiple??b.multiple;vt.current={patterns:w,multiple:ye},D.accept=w.join(","),D.multiple=ye,Ge.current=!0,D.click(),setTimeout(()=>{document.hasFocus()&&(Ge.current=!1)},1e3)},[]),ao=r.useCallback(()=>{Xe.current=!0,clearTimeout(Je.current),Je.current=setTimeout(()=>{Xe.current=!1},800)},[]);r.useEffect(()=>()=>clearTimeout(Je.current),[]),r.useEffect(()=>{let f=bt.current,b=()=>{Ge.current=!1};return window.addEventListener("focus",b),f?.addEventListener("cancel",b),()=>{window.removeEventListener("focus",b),f?.removeEventListener("cancel",b)}},[]);let xr=r.useCallback(f=>{let b=f.currentTarget,D=Array.from(b.files??[]),w=vt.current;Oe(D,w?.patterns??j.current.accepts,w?.multiple),Ge.current=!1,vt.current=null,b.value=""},[Oe]),Tr=r.useCallback(f=>{Ae?.(f);let b=j.current,D=eo.current;if(!D||b.expandOn==="none")return;let w=f.relatedTarget;w&&D.contains(w)||Ge.current||Xe.current||!Zt(b.value)&&he().length===0&&Be(!1)},[Ae,Be,he]),Dr=r.useCallback(f=>{tt(f)},[tt]),{getRootProps:wr,isDragActive:kr}=(0,nr.useDropzone)({onDrop:Dr,onDragEnter:()=>We(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!J||P||T}),Tt=J&&kr;r.useImperativeHandle(Re,()=>({focusTextarea:()=>Pt.current?.focus({preventScroll:!0}),openFilePicker:()=>ot()}),[ot]);let Sr=r.useCallback(f=>{if(P||f.pointerType==="mouse"&&f.button!==0)return;let b=f.target;b instanceof Element&&b.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(f.preventDefault(),Pt.current?.focus({preventScroll:!0}))},[P]),Nr=r.useMemo(()=>({open:Ie,setOpen:Be,setValue:Qe,size:F,expandOn:d,minLines:h,maxLines:R,sendMode:v,disabled:P,readOnly:T,paste:re,clearOnSubmit:se,multiple:Z,textareaRef:Pt,attachments:je,removeAttachment:no,submit:so,appendFiles:tt,appendFilesFromPaste:ro,openFilePicker:ot,beginFilePickerPress:ao}),[Ie,Be,Qe,F,d,h,R,v,P,T,re,se,Z,je,no,so,tt,ro,ot,ao]);return r.createElement(sr.Provider,{value:Nr},r.createElement(Xt.Provider,{value:G},r.createElement(r.Fragment,null,r.createElement("div",{...U,ref:Rr,className:(0,q.default)("kui-ChatbarRoot",`kui-r-size-${F}`,o),style:{position:"relative",width:$,maxWidth:C,...n},"data-state":Ie?"open":"closed","data-disabled":P?"":void 0,"data-readonly":T?"":void 0,"data-drop-active":Tt?"":void 0,"data-accent-color":I,"data-radius":H,onBlurCapture:Tr},r.createElement("input",{ref:bt,type:"file",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:xr}),A?r.createElement("div",{className:"kui-ChatbarNotices"},r.createElement(gt.Provider,{value:F},A)):null,r.createElement("div",{...J?wr():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Sr},r.createElement("div",{className:(0,q.default)("kui-ChatbarBox",`kui-variant-${E??"raised"}`),style:{position:"relative"},"data-accent-color":I,"data-radius":H},r.createElement("div",{className:"kui-ChatbarGrid"},a),Tt&&r.createElement("div",{className:"kui-ChatbarDropOverlay","aria-hidden":!0},r.createElement("div",{className:"kui-ChatbarDropContent"},r.createElement(de,{emphasis:"medium",size:F,weight:"medium"},"Drop files here to attach"))))),K?r.createElement(de,{as:"div",size:F==="3"?"2":"1",emphasis:"medium",className:"kui-ChatbarContext"},K):null,r.createElement(Yt,{role:"status","aria-live":"polite"},Tt?"Drop files here to attach.":r.createElement("span",{key:Qt.id},Qt.text))))))});ir.displayName="Chatbar.Root";var lr=r.forwardRef((e,t)=>{let{className:o,style:n,asChild:a,onFocus:s,onChange:i,onPaste:l,onKeyDown:c,onCompositionStart:p,onCompositionEnd:u,submitOnEnter:d=!1,...h}=e,R=le(),v=r.useContext(Xt),{open:P,minLines:T,maxLines:B,expandOn:N,disabled:E,readOnly:I,setOpen:H,setValue:$,textareaRef:C,paste:Y,appendFilesFromPaste:te,size:pe,submit:M,clearOnSubmit:Z}=R,ce=(0,Ee.useComposedRefs)(t,C),oe=r.useRef(0),re=r.useRef(0),ue=r.useRef(!1),se=r.useRef({open:P,minLines:T,maxLines:B});(0,Ee.useLayoutEffect)(()=>{se.current={open:P,minLines:T,maxLines:B}},[P,T,B]);let X=r.useCallback(()=>{let m=C.current;if(!m)return;let S=window.getComputedStyle(m);oe.current=parseFloat(S.lineHeight)||20,re.current=(parseFloat(S.paddingTop)||0)+(parseFloat(S.paddingBottom)||0)},[C]),J=r.useCallback((m,S)=>{let{minLines:G,maxLines:Fe}=se.current,Ce=oe.current,Le=re.current,Ie=Math.ceil((S?G:1)*Ce)+Le,xe=Math.ceil((S?Fe:1)*Ce)+Le,He=Math.max(m.scrollHeight,Ie);m.style.height=`${Math.min(He,xe)}px`;let Ze=He>xe;m.style.overflowY=Ze?"auto":"hidden",m.style.maxHeight=Ze?`${xe}px`:"none"},[]);(0,Ee.useLayoutEffect)(()=>{X()},[X,pe]),(0,Ee.useLayoutEffect)(()=>{let m=C.current;m&&(oe.current===0&&X(),or(m,()=>{m.style.height="auto";let S=P;if(!P&&(N==="overflow"||N==="both")){let G=Math.ceil(oe.current)+re.current;m.scrollHeight>G+1&&(S=!0,H(!0))}J(m,S)}))},[v,P,N,T,B,pe,H,C,X,J]),r.useEffect(()=>{let m=C.current;if(!m||typeof ResizeObserver>"u")return;let S=-1,G=new ResizeObserver(Fe=>{let Ce=Fe[0]?.contentRect.width??0;if(Ce===S)return;let Le=S===-1;S=Ce,!Le&&(X(),or(m,()=>{m.style.height="auto",J(m,se.current.open)}))});return G.observe(m),()=>G.disconnect()},[C,X,J]),r.useEffect(()=>{},[]);let Re=r.useCallback(m=>{s?.(m),!(E||I)&&(N==="focus"||N==="both")&&!P&&H(!0)},[E,I,N,P,H,s]),Ae=r.useCallback(m=>{$(m.currentTarget.value),i?.(m)},[$,i]),A=r.useCallback(m=>{if(l?.(m),m.defaultPrevented||!Y||E||I)return;let S=Array.from(m.clipboardData?.items??[]).filter(G=>G.kind==="file").map(G=>G.getAsFile()).filter(G=>!!G);S.length!==0&&te(S)>0&&m.preventDefault()},[Y,E,I,l,te]),K=r.useCallback(m=>{ue.current=!0,p?.(m)},[p]),U=r.useCallback(m=>{ue.current=!1,u?.(m)},[u]),F=r.useCallback(m=>{c?.(m),!(m.defaultPrevented||!d)&&(m.key!=="Enter"||m.shiftKey||m.altKey||m.ctrlKey||m.metaKey||ue.current||m.nativeEvent.isComposing||m.nativeEvent.keyCode===229||(m.preventDefault(),M(Z)))},[d,c,M,Z]);return r.createElement("div",{className:"kui-ChatbarField kui-ChatbarTextarea"},r.createElement(a?ie:"textarea",{...h,ref:ce,className:(0,q.default)("kui-ChatbarInput",o),value:v,onChange:Ae,onFocus:Re,onPaste:A,onKeyDown:F,onCompositionStart:K,onCompositionEnd:U,disabled:E,readOnly:I,rows:P?T:1,spellCheck:h.spellCheck??!0,autoCorrect:h.autoCorrect??"on",style:n}))});lr.displayName="Chatbar.Textarea";var pr=r.forwardRef((e,t)=>{let{children:o,asChild:n,className:a,...s}=e;return le().open?null:r.createElement(n?ie:"div",{...s,ref:t,className:(0,q.default)("kui-ChatbarInlineStart",a)},o)});pr.displayName="Chatbar.InlineStart";var cr=r.forwardRef((e,t)=>{let{children:o,asChild:n,className:a,...s}=e;return le().open?null:r.createElement(n?ie:"div",{...s,ref:t,className:(0,q.default)("kui-ChatbarInlineEnd",a)},o)});cr.displayName="Chatbar.InlineEnd";var ur=r.forwardRef((e,t)=>{let{asChild:o,forceMount:n,renderAttachment:a,className:s,children:i,...l}=e,c=le(),p=r.Children.toArray(i).length>0;return c.attachments.length===0&&!p&&!n?null:r.createElement("div",null,r.createElement(o?ie:"div",{...l,ref:t,className:(0,q.default)("kui-ChatbarAttachmentsRow",s),role:"list","aria-label":l["aria-label"]??"Attachments"},r.createElement(Ut,{className:"kui-ChatbarScrollArea",scrollbars:"horizontal"},r.createElement(me,{align:"center",gap:"3",minWidth:"fit-content"},c.attachments.map(d=>r.createElement(Jt,{key:d.id,attachment:d,asChild:!!a},a?.(d))),i))))});ur.displayName="Chatbar.AttachmentsRow";function mr(e,t){let o=e.closest('[role="listitem"]'),n=o?.parentElement?Array.from(o.parentElement.children):[],a=o?n.indexOf(o):-1,i=(n[a+1]??n[a-1])?.querySelector(".kui-ChatbarItemRemove");i?i.focus():t.current?.focus({preventScroll:!0})}var dr=({lead:e,leadKind:t,label:o,detail:n,removeLabel:a,onRemove:s})=>{let i=le();return r.createElement(r.Fragment,null,r.createElement("span",{className:"kui-ChatbarItemLead","data-kind":t,"aria-hidden":!0},e),r.createElement(de,{className:"kui-ChatbarItemLabel",size:i.size,truncate:!0},o,n?r.createElement(Yt,null,", ",n):null),s&&r.createElement(fe,{iconOnly:!0,className:"kui-ChatbarItemRemove","aria-label":a,size:"1",variant:"ghost",color:"gray",onClick:s},r.createElement(Bt,null)))},Hn={uploading:"uploading",error:"failed to upload"},Jt=r.forwardRef((e,t)=>{let{attachment:o,asChild:n,className:a,children:s,...i}=e,l=le(),c=n?ie:"div",p=!!o.url&&ar(o.name,o.type),u=`${Math.ceil(o.size/1024)} KB`,d=o.status?Hn[o.status]:void 0,h=l.disabled||l.readOnly,R=P=>{mr(P.currentTarget,l.textareaRef),l.removeAttachment(o.id)},v=o.status==="uploading"?r.createElement(ze,null):p?r.createElement("img",{className:"kui-ChatbarAttachmentImage",src:o.url,alt:""}):r.createElement(Ot,null);return r.createElement(c,{...i,ref:t,className:(0,q.default)(s?"kui-ChatbarAttachment":"kui-ChatbarAttachment kui-ChatbarItem",a),role:"listitem","data-kind":p?"image":"file","data-status":o.status,title:o.name},s??r.createElement(dr,{lead:v,leadKind:p&&o.status!=="uploading"?"image":"icon",label:o.name,detail:d?`${u}, ${d}`:u,removeLabel:`Remove ${o.name}`,onRemove:h?void 0:R}))});Jt.displayName="Chatbar.Attachment";var fr=r.forwardRef((e,t)=>{let{children:o,icon:n,image:a,color:s,onRemove:i,removeLabel:l,className:c,...p}=e,u=le(),d=u.disabled||u.readOnly,h=i?R=>{mr(R.currentTarget,u.textareaRef),i()}:void 0;return r.createElement("div",{...p,ref:t,className:(0,q.default)("kui-ChatbarItem",c),role:"listitem","data-accent-color":a?void 0:s??"gray",title:o},r.createElement(dr,{lead:a?r.createElement("img",{className:"kui-ChatbarAttachmentImage",src:a,alt:""}):n,leadKind:a?"image":"icon",label:o,removeLabel:l??`Remove ${o}`,onRemove:d?void 0:h}))});fr.displayName="Chatbar.Item";var hr=r.forwardRef((e,t)=>{let{asChild:o,accept:n,multiple:a,disabled:s,onPointerDown:i,onClick:l,children:c,color:p,...u}=e,d=le(),h=s||d.disabled||d.readOnly,R={...u,ref:t,className:(0,q.default)("kui-ChatbarAttachTrigger",u.className),type:u.type??"button","aria-label":u["aria-label"]??"Add attachments",disabled:h,onPointerDown:v=>{i?.(v),!h&&!v.defaultPrevented&&d.beginFilePickerPress()},onClick:v=>{l?.(v),!(h||v.defaultPrevented)&&d.openFilePicker({accept:n,multiple:a})}};return o?r.createElement(ie,{...R},c):r.createElement(fe,{iconOnly:!0,emphasis:"quiet",color:"gray",size:d.size,...R},c??r.createElement(Vt,{"aria-hidden":!0}))});hr.displayName="Chatbar.AttachTrigger";var yr=r.forwardRef((e,t)=>{let{asChild:o,children:n,className:a,...s}=e;return le().open?r.createElement("div",null,r.createElement(o?ie:"div",{...s,ref:t,className:(0,q.default)("kui-ChatbarRow",a)},r.createElement(me,{align:"center",justify:"between",width:"100%"},n))):null});yr.displayName="Chatbar.Row";var gr=r.forwardRef((e,t)=>{let{className:o,...n}=e;return r.createElement("div",{...n,ref:t,className:(0,q.default)("kui-ChatbarRowStart",o)})});gr.displayName="Chatbar.RowStart";var Pr=r.forwardRef((e,t)=>{let{className:o,...n}=e;return r.createElement("div",{...n,ref:t,className:(0,q.default)("kui-ChatbarRowEnd",o)})});Pr.displayName="Chatbar.RowEnd";var br=r.forwardRef((e,t)=>{let{asChild:o,clearOnSend:n,disabled:a,children:s,style:i,className:l,size:c,variant:p,emphasis:u,tabIndex:d,onClick:h,status:R="ready",onStop:v,onRetry:P,stopLabel:T="Stop",retryLabel:B="Retry",stopIcon:N,retryIcon:E,"aria-label":I,"aria-labelledby":H,...$}=e,C=le(),Y=r.useContext(Xt),te=Zt(Y)||C.attachments.length>0,M=te?"send":R==="submitted"||R==="streaming"?"stop":R==="error"?"retry":"send";if(C.sendMode==="never"&&M==="send")return null;let Z=M!=="send"||C.sendMode==="always"||te,ce=M==="send"?a||C.disabled||C.readOnly||!te:a||C.disabled,re=M==="stop"?{"aria-label":T}:M==="retry"?{"aria-label":B}:H?{"aria-labelledby":H}:{"aria-label":I??"Send"},ue=X=>{if(h?.(X),X.defaultPrevented||ce)return;if(M==="stop"){v?.();return}if(M==="retry"){P?.();return}let J=n??C.clearOnSubmit;C.submit(J)&&J&&C.textareaRef.current?.focus({preventScroll:!0})},se=M==="stop"?N??(R==="submitted"?r.createElement(ze,null):r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0},r.createElement("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"}))):M==="retry"?E??r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},r.createElement("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),r.createElement("path",{d:"M3 3v5h5"})):s??r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},r.createElement("path",{d:"M5 12h14"}),r.createElement("path",{d:"m12 5 7 7-7 7"}));return r.createElement(fe,{iconOnly:!0,...$,ref:t,size:c??C.size,...u?{emphasis:u}:{variant:p??(C.open||M!=="send"?"solid":"ghost")},disabled:ce,className:(0,q.default)("kui-ChatbarSend",l),style:{opacity:Z?1:0,pointerEvents:Z?void 0:"none",...i},"aria-hidden":Z?void 0:!0,tabIndex:Z?d:-1,asChild:o,onClick:ue,"data-status":R,"data-mode":M,...re},se)});br.displayName="Chatbar.Send";
|
|
2
|
+
"use strict";var Fr=Object.create;var nt=Object.defineProperty;var Lr=Object.getOwnPropertyDescriptor;var Br=Object.getOwnPropertyNames;var Vr=Object.getPrototypeOf,Or=Object.prototype.hasOwnProperty;var Mr=(e,t)=>{for(var o in t)nt(e,o,{get:t[o],enumerable:!0})},lo=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Br(t))!Or.call(e,a)&&a!==o&&nt(e,a,{get:()=>t[a],enumerable:!(n=Lr(t,a))||n.enumerable});return e};var T=(e,t,o)=>(o=e!=null?Fr(Vr(e)):{},lo(t||!e||!e.__esModule?nt(o,"default",{value:e,enumerable:!0}):o,e)),zr=e=>lo(nt({},"__esModule",{value:!0}),e);var jn={};Mr(jn,{AttachTrigger:()=>hr,Attachment:()=>Qt,AttachmentsRow:()=>ur,InlineEnd:()=>cr,InlineStart:()=>pr,Item:()=>fr,Root:()=>ir,Row:()=>yr,RowEnd:()=>Pr,RowStart:()=>gr,Send:()=>br,Textarea:()=>lr});module.exports=zr(jn);var r=T(require("react")),_=T(require("classnames")),Ee=require("radix-ui/internal"),nr=require("react-dropzone");var qe=T(require("react")),_o=T(require("classnames"));var y=T(require("react")),ko=T(require("classnames")),So=require("radix-ui"),ut=require("radix-ui/internal");var se={asChild:{type:"boolean"}};var st=["gray","gold","bronze","brown","yellow","amber","orange","tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","lime","mint","sky"],po=["auto","gray","mauve","slate","sage","olive","sand"],co={color:{type:"enum",values:st,default:void 0}},uo={color:{type:"enum",values:st,default:""}};var wt=["none","small","medium","large","full"],at={radius:{type:"enum",values:wt,default:void 0}};var Ir=["1","2","3","4"],Hr=["raised","solid","soft","surface","outline","ghost"],kt={...se,size:{type:"enum",className:"kui-r-size",values:Ir,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:Hr,default:"solid"},...uo,...at,loading:{type:"boolean",className:"kui-loading",default:!1},fullWidth:{type:"boolean",className:"kui-full-width",default:!1}};var ct=T(require("react")),Co=T(require("classnames"));var yo=T(require("classnames"));var jr=[],Wr=new Set;function Gr(e){let t=Object.assign({},...e),o=[],n=[],a=new Set;for(let s in t){let i=t[s],l=i.values??jr,c={key:s,type:i.type,default:i.default,hasDefault:i.default!==void 0,responsive:"responsive"in i,className:i.className,customProperties:i.customProperties,parseValue:i.parseValue,values:l,valueSet:l.length>0?new Set(l):Wr,enumValueSet:i.type==="enum"?new Set([i.default,...l]):void 0};i.className?(o.push(c),a.add(s)):(c.hasDefault||i.type==="enum")&&n.push(c)}return{styling:o,passthrough:n,stylingKeys:a}}var $r={children:new WeakMap};function mo(e){let t=$r;for(let o=0;o<e.length;o++){let n=e[o],a=t.children.get(n);a===void 0&&(a={children:new WeakMap},t.children.set(n,a)),t=a}return t.compiled??(t.compiled=Gr(e))}var Kr=["initial","xs","sm","md","lg","xl"],St=new Set(Kr);function Nt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Ur=new Set(["initial","xs","sm","md","lg","xl"]);function De(e){if(typeof e!="object"||e===null)return!1;for(let t in e)if(Ur.has(t))return!0;return!1}function it(e,t,o){return t!==void 0?t.has(o):e.includes(o)}function ho({className:e,customProperties:t,...o}){let n=Et({allowArbitraryValues:!0,className:e,...o}),a=_r({customProperties:t,...o});return[n,a]}function Et({allowArbitraryValues:e,value:t,className:o,propValues:n,propValueSet:a,parseValue:s=i=>i}){if(t){if(typeof t=="string")return it(n,a,t)?fo(o,t,s):e?o:void 0;if(De(t)){let i=t,l=[];for(let c in i){if(!Nt(i,c)||!St.has(c))continue;let p=i[c];if(p!==void 0){if(it(n,a,p)){let u=fo(o,p,s),d=c==="initial"?u:`${c}:${u}`;l.push(d)}else if(e){let u=c==="initial"?o:`${c}:${o}`;l.push(u)}}}return l.length>0?l.join(" "):""}if(e)return o}}function fo(e,t,o){let n=e?"-":"",a=o(t),s=a?.startsWith("-"),i=s?"-":"",l=s?a?.substring(1):a;return`${i}${e}${n}${l}`}function _r({customProperties:e,value:t,propValues:o,propValueSet:n,parseValue:a=s=>s}){if(!t||typeof t=="string"&&it(o,n,t))return;let s;if(typeof t=="string"){let i=a(t);s={};for(let l of e)s[l]=i;return s}if(De(t)){let i=t;for(let l in i){if(!Nt(i,l)||!St.has(l))continue;let c=i[l];if(c===void 0||it(o,n,c))continue;let p=a(c);s??(s={});for(let u of e){let d=l==="initial"?u:`${u}-${l}`;s[d]=p}}}return s??{}}function At(...e){let t;for(let o of e)o&&(t===void 0&&(t={}),Object.assign(t,o));return t}function qr(e,t){let o=e.initial,n=!1;return t.hasDefault&&o===void 0&&(o=t.default,n=!0),t.enumValueSet!==void 0&&!t.enumValueSet.has(o)&&(o=t.default,n=!0),n?{...e,initial:o}:e}function Q(e,...t){let{styling:o,passthrough:n,stylingKeys:a}=mo(t),s={};for(let c in e)a.has(c)||(s[c]=e[c]);for(let c=0;c<n.length;c++){let p=n[c],u=s[p.key];if(u===void 0){p.hasDefault&&(s[p.key]=p.default);continue}p.enumValueSet!==void 0&&!p.enumValueSet.has(u)&&!De(u)&&(s[p.key]=p.default)}let i,l=[];for(let c=0;c<o.length;c++){let p=o[c],u=e[p.key];if(u===void 0&&p.hasDefault&&(u=p.default),p.enumValueSet!==void 0&&!p.enumValueSet.has(u)&&!De(u)&&(u=p.default),!!u){if(De(u)){if(!p.responsive)continue;u=qr(u,p)}if(p.type==="enum"){let d=Et({allowArbitraryValues:!1,value:u,className:p.className,propValues:p.values,propValueSet:p.valueSet,parseValue:p.parseValue});d&&l.push(d);continue}if(p.type==="string"||p.type==="enum | string"){let[d,h]=ho({className:p.className,customProperties:p.customProperties,propValues:p.type==="string"?[]:p.values,propValueSet:p.type==="string"?void 0:p.valueSet,parseValue:p.parseValue,value:u});h&&(i=At(i,h)),d&&l.push(d);continue}if(p.type==="boolean"){l.push(p.className);continue}}}return s.className=(0,yo.default)(l.length>0?l.join(" "):void 0,e.className),s.style=At(i,e.style),s}var we=["0","1","2","3","4","5","6","7","8","9","10","11","12"],go={p:{type:"enum | string",className:"kui-r-p",customProperties:["--p"],values:we,responsive:!0},px:{type:"enum | string",className:"kui-r-px",customProperties:["--pl","--pr"],values:we,responsive:!0},py:{type:"enum | string",className:"kui-r-py",customProperties:["--pt","--pb"],values:we,responsive:!0},pt:{type:"enum | string",className:"kui-r-pt",customProperties:["--pt"],values:we,responsive:!0},pr:{type:"enum | string",className:"kui-r-pr",customProperties:["--pr"],values:we,responsive:!0},pb:{type:"enum | string",className:"kui-r-pb",customProperties:["--pb"],values:we,responsive:!0},pl:{type:"enum | string",className:"kui-r-pl",customProperties:["--pl"],values:we,responsive:!0}};var lt={height:{type:"string",className:"kui-r-h",customProperties:["--height"],responsive:!0},minHeight:{type:"string",className:"kui-r-min-h",customProperties:["--min-height"],responsive:!0},maxHeight:{type:"string",className:"kui-r-max-h",customProperties:["--max-height"],responsive:!0}};var ye={width:{type:"string",className:"kui-r-w",customProperties:["--width"],responsive:!0},minWidth:{type:"string",className:"kui-r-min-w",customProperties:["--min-width"],responsive:!0},maxWidth:{type:"string",className:"kui-r-max-w",customProperties:["--max-width"],responsive:!0}};var Ft=["visible","hidden","clip","scroll","auto"],Zr=["static","relative","absolute","fixed","sticky"],$e=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9"],Yr=["0","1"],Xr=["0","1"],Jr=["start","center","end","baseline","stretch"],Qr=["start","center","end","baseline","stretch"],Po={...go,...ye,...lt,position:{type:"enum",className:"kui-r-position",values:Zr,responsive:!0},inset:{type:"enum | string",className:"kui-r-inset",customProperties:["--inset"],values:$e,responsive:!0},top:{type:"enum | string",className:"kui-r-top",customProperties:["--top"],values:$e,responsive:!0},right:{type:"enum | string",className:"kui-r-right",customProperties:["--right"],values:$e,responsive:!0},bottom:{type:"enum | string",className:"kui-r-bottom",customProperties:["--bottom"],values:$e,responsive:!0},left:{type:"enum | string",className:"kui-r-left",customProperties:["--left"],values:$e,responsive:!0},overflow:{type:"enum",className:"kui-r-overflow",values:Ft,responsive:!0},overflowX:{type:"enum",className:"kui-r-ox",values:Ft,responsive:!0},overflowY:{type:"enum",className:"kui-r-oy",values:Ft,responsive:!0},flexBasis:{type:"string",className:"kui-r-fb",customProperties:["--flex-basis"],responsive:!0},flexShrink:{type:"enum | string",className:"kui-r-fs",customProperties:["--flex-shrink"],values:Yr,responsive:!0},flexGrow:{type:"enum | string",className:"kui-r-fg",customProperties:["--flex-grow"],values:Xr,responsive:!0},gridArea:{type:"string",className:"kui-r-ga",customProperties:["--grid-area"],responsive:!0},gridColumn:{type:"string",className:"kui-r-gc",customProperties:["--grid-column"],responsive:!0},gridColumnStart:{type:"string",className:"kui-r-gcs",customProperties:["--grid-column-start"],responsive:!0},gridColumnEnd:{type:"string",className:"kui-r-gce",customProperties:["--grid-column-end"],responsive:!0},gridRow:{type:"string",className:"kui-r-gr",customProperties:["--grid-row"],responsive:!0},gridRowStart:{type:"string",className:"kui-r-grs",customProperties:["--grid-row-start"],responsive:!0},gridRowEnd:{type:"string",className:"kui-r-gre",customProperties:["--grid-row-end"],responsive:!0},alignSelf:{type:"enum",className:"kui-r-as",values:Jr,responsive:!0},justifySelf:{type:"enum",className:"kui-r-js",values:Qr,responsive:!0}};var ke=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9","-10","-11","-12","bleed"],bo={m:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:ke,responsive:!0,className:"kui-r-ml",customProperties:["--ml"]}};var pt=require("radix-ui"),Ps=pt.Slot.Root,ae=pt.Slot.Root,bs=pt.Slot.Slottable;var Lt=["0","1","2","3","4","5","6","7","8","9","10","11","12"],vo={gap:{type:"enum | string",className:"kui-r-gap",customProperties:["--gap"],values:Lt,responsive:!0},gapX:{type:"enum | string",className:"kui-r-cg",customProperties:["--column-gap"],values:Lt,responsive:!0},gapY:{type:"enum | string",className:"kui-r-rg",customProperties:["--row-gap"],values:Lt,responsive:!0}};var en=["div","span"],tn=["none","inline-flex","flex"],on=["row","column","row-reverse","column-reverse"],rn=["start","center","end","baseline","stretch"],nn=["start","center","end","between"],sn=["nowrap","wrap","wrap-reverse"],Ro={as:{type:"enum",values:en,default:"div"},...se,display:{type:"enum",className:"kui-r-display",values:tn,responsive:!0},direction:{type:"enum",className:"kui-r-fd",values:on,responsive:!0},align:{type:"enum",className:"kui-r-ai",values:rn,responsive:!0},justify:{type:"enum",className:"kui-r-jc",values:nn,parseValue:an,responsive:!0},wrap:{type:"enum",className:"kui-r-fw",values:sn,responsive:!0},...vo};function an(e){return e==="between"?"space-between":e}var ce=ct.forwardRef((e,t)=>{let{className:o,asChild:n,as:a="div",...s}=Q(e,Ro,Po,bo);return ct.createElement(n?ae:a,{...s,ref:t,className:(0,Co.default)("kui-Flex",o)})});ce.displayName="Flex";var O=T(require("react")),To=T(require("classnames"));var xo={loading:{type:"boolean",default:!0}};var ze=O.forwardRef((e,t)=>{let{className:o,children:n,loading:a,...s}=Q(e,xo);if(!a)return n;let i=s["aria-label"]!==void 0||s["aria-labelledby"]!==void 0,l=O.createElement("span",{role:i?"status":void 0,"aria-hidden":i?void 0:!0,...s,ref:t,className:(0,To.default)("kui-Spinner",o)},O.createElement("span",{className:"kui-SpinnerWheel"},O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"}),O.createElement("span",{className:"kui-SpinnerLeaf"})),typeof s["aria-label"]=="string"?O.createElement("span",{className:"kui-sr-only"},s["aria-label"]):null);return n===void 0?l:O.createElement(ce,{asChild:!0,position:"relative",align:"center",justify:"center"},O.createElement("span",{"aria-busy":"true"},O.createElement("span",{"aria-hidden":!0,className:"kui-SpinnerHiddenChildren"},n),O.createElement(ce,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},O.createElement("span",null,l))))});ze.displayName="Spinner";var g=T(require("react")),ln=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 4.5C0.75 4.08579 1.08579 3.75 1.5 3.75H7.5C7.91421 3.75 8.25 4.08579 8.25 4.5C8.25 4.91421 7.91421 5.25 7.5 5.25H1.5C1.08579 5.25 0.75 4.91421 0.75 4.5Z"})));ln.displayName="ThickDividerHorizontalIcon";var pn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.53547 0.62293C8.88226 0.849446 8.97976 1.3142 8.75325 1.66099L4.5083 8.1599C4.38833 8.34356 4.19397 8.4655 3.9764 8.49358C3.75883 8.52167 3.53987 8.45309 3.3772 8.30591L0.616113 5.80777C0.308959 5.52987 0.285246 5.05559 0.563148 4.74844C0.84105 4.44128 1.31533 4.41757 1.62249 4.69547L3.73256 6.60459L7.49741 0.840706C7.72393 0.493916 8.18868 0.396414 8.53547 0.62293Z"})));pn.displayName="ThickCheckIcon";var cn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{d:"M0.135232 3.15803C0.324102 2.95657 0.640521 2.94637 0.841971 3.13523L4.5 6.56464L8.158 3.13523C8.3595 2.94637 8.6759 2.95657 8.8648 3.15803C9.0536 3.35949 9.0434 3.67591 8.842 3.86477L4.84197 7.6148C4.64964 7.7951 4.35036 7.7951 4.15803 7.6148L0.158031 3.86477C-0.0434285 3.67591 -0.0536285 3.35949 0.135232 3.15803Z"})));cn.displayName="ChevronDownIcon";var un=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.23826 0.201711C3.54108 -0.0809141 4.01567 -0.0645489 4.29829 0.238264L7.79829 3.98826C8.06724 4.27642 8.06724 4.72359 7.79829 5.01174L4.29829 8.76174C4.01567 9.06455 3.54108 9.08092 3.23826 8.79829C2.93545 8.51567 2.91909 8.04108 3.20171 7.73826L6.22409 4.5L3.20171 1.26174C2.91909 0.958928 2.93545 0.484337 3.23826 0.201711Z"})));un.displayName="ThickChevronRightIcon";var mn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.76174 0.201711C5.45892 -0.0809141 4.98433 -0.0645489 4.70171 0.238264L1.20171 3.98826C0.932757 4.27642 0.932757 4.72359 1.20171 5.01174L4.70171 8.76174C4.98433 9.06455 5.45892 9.08092 5.76174 8.79829C6.06455 8.51567 6.08091 8.04108 5.79829 7.73826L2.77591 4.5L5.79829 1.26174C6.08091 0.958928 6.06455 0.484337 5.76174 0.201711Z"})));mn.displayName="ThickChevronLeftIcon";var dn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("circle",{cx:"4.5",cy:"4.5",r:"2"})));dn.displayName="ThickDotIcon";var Bt=g.default.forwardRef((e,t)=>g.default.createElement("svg",{...e,ref:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"M18 6 6 18"}),g.default.createElement("path",{d:"m6 6 12 12"})));Bt.displayName="CloseIcon";var Vt=g.default.forwardRef((e,t)=>g.default.createElement("svg",{...e,ref:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"})));Vt.displayName="PaperclipIcon";var fn=g.default.forwardRef((e,t)=>g.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),g.default.createElement("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})));fn.displayName="FileIcon";var Ot=g.default.forwardRef((e,t)=>g.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},g.default.createElement("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),g.default.createElement("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),g.default.createElement("path",{d:"M10 9H8"}),g.default.createElement("path",{d:"M16 13H8"}),g.default.createElement("path",{d:"M16 17H8"})));Ot.displayName="FileTextIcon";var Mt=g.default.forwardRef((e,t)=>g.default.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,ref:t},g.default.createElement("path",{d:"M5 12.75L9.5 17.25L19 7.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})));Mt.displayName="TickIcon";var Ke=T(require("react"));function zt(e,t){if(t.includes(e))return e;let o=Number(e),n=t[0],a=1/0;for(let s=0;s<t.length;s++){let i=Math.abs(Number(t[s])-o);i<a&&(a=i,n=t[s])}return n}var Se=Ke.createContext("2");Se.displayName="ThemeSizeContext";function Ue(e,t){let o=Ke.useContext(Se);return e!==void 0?e:zt(o,t.values)}function Do(e,t){let o=Ke.useContext(Se);if(e.size!==void 0)return e;let n=zt(o,t.values);return n===t.default?e:{...e,size:n}}var jt=y.forwardRef((e,t)=>{let o=Do(e,kt.size),{className:n,children:a,asChild:s,as:i,color:l,radius:c,disabled:p,done:u=!1,...d}=Q(o,kt),h=!!o.loading,R=o.loading!==void 0,v=!!p||h,{onClick:P,"aria-describedby":D}=d,V=y.useCallback(k=>{if(v){k.preventDefault();return}P?.(k)},[v,P]),E=y.useMemo(()=>{let k=s&&y.isValidElement(a)?a.props.children:a,L=Ht(k),K=m=>y.isValidElement(m)&&(m.type==="svg"||typeof m.type!="string"&&m.type!==y.Fragment&&!yn.has(It(m.type)));return{iconStart:K(L[0]),iconEnd:K(L[L.length-1])}},[s,a]),[A,H]=y.useState(null),j=y.useRef(null),$=(0,ut.useComposedRefs)(t,j);(0,ut.useLayoutEffect)(()=>{let k=j.current;if(!k||h||u)return;let L=k.querySelector(":scope > .kui-BaseButtonContent")??k,K=wo(L,"start"),m=wo(L,"end");H(x=>x&&x.iconStart===K&&x.iconEnd===m?x:{iconStart:K,iconEnd:m})});let{iconStart:C,iconEnd:q}=A??E,ee=!!d["data-icon-only"],te=y.useMemo(()=>{if(!u)return a;let k=y.createElement(Mt,{key:"kui-done-tick",className:"kui-BaseButtonTick","aria-hidden":!0}),L=K=>{if(ee)return k;let m=Ht(K),x=m.findIndex(B=>!(typeof B=="string"&&!B.trim()));return C&&x!==-1?m.map((B,de)=>de===x?k:B):[k,...m]};if(s&&y.isValidElement(a)){let K=a;return y.cloneElement(K,void 0,L(K.props.children))}return L(a)},[u,a,ee,C,s]),z=s?So.Slot.Root:i||"button",Z=["button","input","textarea","select"],le=s?y.isValidElement(a)?a.type:void 0:i||"button",oe=typeof le=="string"&&Z.includes(le),{onClickCapture:re}=d,pe=y.useCallback(k=>{if(s&&v){k.preventDefault(),k.stopPropagation();return}re?.(k)},[s,v,re]),ne=!s&&(!i||i==="button"),Y="type"in d,X=y.useId(),ve=h?`${X}-loading`:void 0,Ae=y.useMemo(()=>h?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":[D,ve].filter(Boolean).join(" ")}:p&&(!oe||s)?{"aria-disabled":!0}:{},[h,ve,D,p,oe,s]),Re=(k,L)=>R?y.createElement(y.Fragment,null,y.createElement("span",{className:"kui-BaseButtonContent","aria-hidden":h||void 0},k),h?y.createElement(y.Fragment,null,y.createElement("span",{className:"kui-sr-only"},y.createElement("span",{id:ve,"aria-hidden":!0},"Loading"),L),y.createElement(ce,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},y.createElement("span",null,y.createElement(ze,{"aria-hidden":"true"})))):null):k,Fe=s&&R&&y.isValidElement(te)?y.cloneElement(te,void 0,Re(te.props.children,y.isValidElement(a)?a.props.children:null)):te;return y.createElement(z,{"data-accent-color":l,"data-radius":c,"data-icon-start":C||void 0,"data-icon-end":q||void 0,"data-done":u||void 0,...d,...Ae,"data-disabled":v||void 0,onClick:V,onClickCapture:pe,ref:$,className:(0,ko.default)("kui-reset","kui-BaseButton",n),...oe&&{disabled:p},...ne&&!Y?{type:"button"}:{}},s?Fe:Re(te,a))});jt.displayName="BaseButton";var yn=new Set(["Text","Kbd","Code","Link","Em","Strong","Quote","Badge","Trans"]);function It(e){if(!e||typeof e!="function"&&typeof e!="object")return"";let t=e;return t.displayName||t.name||It(t.render)||It(t.type)}function Ht(e){return y.Children.toArray(e).flatMap(t=>y.isValidElement(t)&&t.type===y.Fragment?Ht(t.props.children):[t])}function wo(e,t){let o=t==="start"?e.firstChild:e.lastChild;for(;o&&(o.nodeType===Node.COMMENT_NODE||o.nodeType===Node.TEXT_NODE&&!o.textContent?.trim());)o=t==="start"?o.nextSibling:o.previousSibling;return o?.nodeType===Node.ELEMENT_NODE&&o.localName==="svg"}var G=T(require("react")),Go=T(require("classnames")),Pe=require("radix-ui");var Ne=T(require("react")),Mo=require("radix-ui");var gn=["loud","medium","quiet"],No={emphasis:{type:"enum",className:"kui-emphasis",values:gn,default:void 0}};var Pn=["normal","start","end","both"],Eo={trim:{type:"enum",className:"kui-r-lt",values:Pn,responsive:!0}};var bn=["left","center","right"],Ao={align:{type:"enum",className:"kui-r-ta",values:bn,responsive:!0}};var vn=["wrap","nowrap","pretty","balance"],Fo={wrap:{type:"enum",className:"kui-r-tw",values:vn,responsive:!0}};var Lo={truncate:{type:"boolean",className:"kui-truncate"}};var Rn=["sans","mono","serif"],Bo={font:{type:"enum",className:"kui-r-ff",values:Rn}};var Cn=["regular","medium","semibold"],Vo={weight:{type:"enum",className:"kui-r-weight",values:Cn,responsive:!0}};var xn=["span","div","label","p"],Tn=["1","2","3","4","5","6","7","8","9"],Oo={as:{type:"enum",values:xn,default:"span"},...se,size:{type:"enum",className:"kui-r-size",values:Tn,responsive:!0},...Bo,...Vo,...Ao,...Eo,...Lo,...Fo,...co,...No};var ue=Ne.memo(Ne.forwardRef((e,t)=>{let{children:o,className:n,asChild:a,as:s="span",color:i,...l}=Q(e,Oo),c=n?`kui-Text ${n}`:"kui-Text";return a?Ne.createElement(Mo.Slot.Root,{"data-accent-color":i,...l,ref:t,className:c},o):Ne.createElement(s,{"data-accent-color":i,...l,ref:t,className:c},o)}));ue.displayName="Text";var M=T(require("react")),Ho=T(require("classnames")),_e=require("radix-ui");function zo(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}var Wt=T(require("react"));function ge(e){let[t,o]=Wt.useState(e),[n,a]=Wt.useState(e);return Object.is(e,n)||(a(e),o(e)),[t,o]}var Dn=["inherit","light","dark"],Io=["sans","mono","serif"],wn=["1","2","3","4"],F={...se,hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:Dn,default:"inherit"},accentColor:{type:"enum",values:st,default:"gray"},grayColor:{type:"enum",values:po,default:"gray"},radius:{type:"enum",values:wt,default:"full"},fontFamily:{type:"enum",values:Io,default:"sans"},headingFontFamily:{type:"enum",values:Io},size:{type:"enum",values:wn,default:"2"}};var U=()=>{},xa={appearance:F.appearance.default,accentColor:F.accentColor.default,grayColor:F.grayColor.default,resolvedGrayColor:F.grayColor.default,radius:F.radius.default,fontFamily:F.fontFamily.default,headingFontFamily:void 0,size:F.size.default,onAppearanceChange:U,onAccentColorChange:U,onGrayColorChange:U,onRadiusChange:U,onFontFamilyChange:U,onHeadingFontFamilyChange:U,onSizeChange:U},Gt=M.createContext(void 0);var $t=M.forwardRef((e,t)=>{let o=M.useContext(Gt),n=_e.Direction.useDirection();return o===void 0?M.createElement(_e.Direction.Provider,{dir:n},M.createElement(jo,{...e,ref:t})):M.createElement(Kt,{...e,ref:t})});$t.displayName="Theme";var jo=M.forwardRef((e,t)=>{let{appearance:o=F.appearance.default,accentColor:n=F.accentColor.default,grayColor:a=F.grayColor.default,radius:s=F.radius.default,fontFamily:i=F.fontFamily.default,headingFontFamily:l,size:c=F.size.default,hasBackground:p=F.hasBackground.default,...u}=e,[d,h]=ge(o),[R,v]=ge(n),[P,D]=ge(a),[V,E]=ge(s),[A,H]=ge(i),[j,$]=ge(l),[C,q]=ge(c);return M.createElement(Kt,{...u,ref:t,isRoot:!0,hasBackground:p,appearance:d,accentColor:R,grayColor:P,radius:V,fontFamily:A,headingFontFamily:j,size:C,onAppearanceChange:h,onAccentColorChange:v,onGrayColorChange:D,onRadiusChange:E,onFontFamilyChange:H,onHeadingFontFamilyChange:$,onSizeChange:q})});jo.displayName="ThemeRoot";var Kt=M.forwardRef((e,t)=>{let o=M.useContext(Gt),{asChild:n,isRoot:a,hasBackground:s,appearance:i=e.appearance??o?.appearance??F.appearance.default,accentColor:l=e.accentColor??o?.accentColor??F.accentColor.default,grayColor:c=e.grayColor??o?.resolvedGrayColor??F.grayColor.default,radius:p=e.radius??o?.radius??F.radius.default,fontFamily:u=e.fontFamily??o?.fontFamily??F.fontFamily.default,headingFontFamily:d=e.headingFontFamily??o?.headingFontFamily,size:h=e.size??o?.size??F.size.default,onAppearanceChange:R=o?.onAppearanceChange??U,onAccentColorChange:v=o?.onAccentColorChange??U,onGrayColorChange:P=o?.onGrayColorChange??U,onRadiusChange:D=o?.onRadiusChange??U,onFontFamilyChange:V=o?.onFontFamilyChange??U,onHeadingFontFamilyChange:E=o?.onHeadingFontFamilyChange??U,onSizeChange:A=o?.onSizeChange??U,...H}=e,j=n?_e.Slot.Root:"div",$=c==="auto"?zo(l):c,C=e.appearance==="light"||e.appearance==="dark",q=s===void 0?a||C:s;return M.createElement(Gt.Provider,{value:M.useMemo(()=>({appearance:i,accentColor:l,grayColor:c,resolvedGrayColor:$,radius:p,fontFamily:u,headingFontFamily:d,size:h,onAppearanceChange:R,onAccentColorChange:v,onGrayColorChange:P,onRadiusChange:D,onFontFamilyChange:V,onHeadingFontFamilyChange:E,onSizeChange:A}),[i,l,c,$,p,u,d,h,R,v,P,D,V,E,A])},M.createElement(Se.Provider,{value:h},M.createElement(j,{"data-is-root-theme":a?"true":"false","data-accent-color":l,"data-gray-color":$,"data-has-background":q?"true":"false","data-radius":p,"data-font-family":u,"data-heading-font-family":d,ref:t,...H,className:(0,Ho.default)("kui-theme",{light:i==="light",dark:i==="dark"},H.className)})))});Kt.displayName="ThemeImpl";var Wo={content:{type:"ReactNode",required:!0},width:ye.width,minWidth:ye.minWidth,maxWidth:{...ye.maxWidth,default:"360px"}};var $o=200,Ko=G.createContext(!1);function kn({delayDuration:e=$o,children:t,...o}){return G.createElement(Ko.Provider,{value:!0},G.createElement(Pe.Tooltip.Provider,{delayDuration:e,...o},t))}kn.displayName="TooltipProvider";var Ut=G.forwardRef((e,t)=>{let{children:o,className:n,open:a,defaultOpen:s,onOpenChange:i,delayDuration:l,disableHoverableContent:c,content:p,container:u,forceMount:d,...h}=Q(e,Wo),R={open:a,defaultOpen:s,onOpenChange:i,delayDuration:l,disableHoverableContent:c},v=G.useContext(Ko),P=G.createElement(Pe.Tooltip.Root,{...R},G.createElement(Pe.Tooltip.Trigger,{asChild:!0},o),G.createElement(Pe.Tooltip.Portal,{container:u,forceMount:d},G.createElement($t,{asChild:!0},G.createElement(Pe.Tooltip.Content,{sideOffset:4,collisionPadding:10,...h,asChild:!1,ref:t,className:(0,Go.default)("kui-TooltipContent",n)},G.createElement(ue,{as:"p",className:"kui-TooltipText",size:"1"},p),G.createElement(Pe.Tooltip.Arrow,{className:"kui-TooltipArrow"})))));return v?P:G.createElement(Pe.Tooltip.Provider,{delayDuration:$o},P)});Ut.displayName="Tooltip";var mt=T(require("react"));function Uo(e){let t=mt.useId(),o=!!e,n=mt.useMemo(()=>o?{"aria-describedby":t}:{},[o,t]);return{tooltipId:t,hasTooltip:o,accessibilityProps:n}}var Sn={loud:"solid",medium:"raised",quiet:"ghost"};function Nn(e){if(e["aria-label"]||e["aria-labelledby"])return;console.error("Button: an `iconOnly` button must have an accessible name. Pass `aria-label`, or `aria-labelledby` referencing a label element.")}var me=qe.forwardRef(({className:e,style:t,tooltip:o,tooltipSide:n="top",tooltipAlign:a="center",tooltipDelayDuration:s,tooltipDisableHoverableContent:i,iconOnly:l=!1,emphasis:c,variant:p,...u},d)=>{let{tooltipId:h,hasTooltip:R,accessibilityProps:v}=Uo(o);l&&(Nn(u),u.fullWidth=!1);let P=c!==void 0?Sn[c]:p,D=u["aria-describedby"],V=v["aria-describedby"],E=[D,V].filter(Boolean).join(" ")||void 0,A=qe.createElement(jt,{...u,variant:P,"aria-describedby":E,ref:d,"data-icon-only":l||void 0,className:(0,_o.default)("kui-Button",e),style:t});return R?qe.createElement(Ut,{content:o,side:n,align:a,delayDuration:s,disableHoverableContent:i,id:h},A):A});me.displayName="Button";var I=T(require("react")),Jo=T(require("classnames")),be=require("radix-ui"),Qo=require("radix-ui/internal");var En=["vertical","horizontal","both"],dt={...se,...at,scrollbars:{type:"enum",values:En,default:"both"},fade:{type:"boolean",default:!1}};var ft=T(require("react"));function qo(e){let[t,o]=ft.useState(null);return ft.useEffect(()=>{if(!e||!t)return;let n=0,a=()=>{n=0;let c=Math.max(0,t.scrollTop),p=Math.max(0,t.scrollHeight-t.clientHeight-t.scrollTop);t.style.setProperty("--scroll-overflow-start",`${c}px`),t.style.setProperty("--scroll-overflow-end",`${p}px`);let u=Math.abs(t.scrollLeft),d=Math.max(0,t.scrollWidth-t.clientWidth-u);t.style.setProperty("--scroll-overflow-x-start",`${u}px`),t.style.setProperty("--scroll-overflow-x-end",`${d}px`)},s=()=>{n||(n=requestAnimationFrame(a))};a(),t.addEventListener("scroll",s,{passive:!0});let i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(t);for(let c of Array.from(t.children))i?.observe(c);let l=typeof MutationObserver>"u"?null:new MutationObserver(s);return l?.observe(t,{childList:!0}),()=>{n&&cancelAnimationFrame(n),t.removeEventListener("scroll",s),i?.disconnect(),l?.disconnect(),t.style.removeProperty("--scroll-overflow-start"),t.style.removeProperty("--scroll-overflow-end"),t.style.removeProperty("--scroll-overflow-x-start"),t.style.removeProperty("--scroll-overflow-x-end")}},[e,t]),o}var ht=T(require("react"));function Yo(){let[e,t]=ht.useState(null);return ht.useEffect(()=>{let o=e?.parentElement;if(!e||!o)return;let n=0,a=()=>{n=0;for(let i of o.querySelectorAll(":scope > .kui-ScrollAreaScrollbar > .kui-ScrollAreaThumb")){let l=i.parentElement,c=getComputedStyle(l);if(l.dataset.orientation==="horizontal"){let p=l.clientWidth-parseFloat(c.paddingLeft)-parseFloat(c.paddingRight),u=Zo(e.scrollLeft,e.scrollWidth-e.offsetWidth,p-i.offsetWidth);i.style.transform=`translate3d(${u}px, 0, 0)`}else{let p=l.clientHeight-parseFloat(c.paddingTop)-parseFloat(c.paddingBottom),u=Zo(e.scrollTop,e.scrollHeight-e.offsetHeight,p-i.offsetHeight);i.style.transform=`translate3d(0, ${u}px, 0)`}}},s=()=>{n||(n=requestAnimationFrame(a))};return e.addEventListener("scroll",s,{passive:!0}),()=>{n&&cancelAnimationFrame(n),e.removeEventListener("scroll",s)}},[e]),t}function Zo(e,t,o){return t<=0||o<=0?0:Math.min(Math.max(e,-t),t)/t*o}var yt=T(require("react"));function Xo(e,t){let{asChild:o,children:n}=e;if(!o)return typeof t=="function"?t(n):t;let a=yt.Children.only(n);return yt.cloneElement(a,{children:typeof t=="function"?t(a.props.children):t})}var An='[role="menu"], [role="listbox"]';function Fn(e,t){I.useEffect(()=>{if(!t||!e||e.closest(An))return;let o=0,n=()=>{o=0,e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?e.setAttribute("tabindex","0"):e.removeAttribute("tabindex")},a=()=>{o||(o=requestAnimationFrame(n))};n();let s=typeof ResizeObserver>"u"?null:new ResizeObserver(a);s?.observe(e);for(let i of Array.from(e.children))s?.observe(i);return()=>{o&&cancelAnimationFrame(o),s?.disconnect()}},[e,t])}var _t=I.forwardRef((e,t)=>{let{asChild:o,children:n,className:a,style:s,type:i,scrollHideDelay:l=i!=="scroll"?0:void 0,dir:c,radius:p=dt.radius.default,scrollbars:u=dt.scrollbars.default,fade:d=dt.fade.default,...h}=Q(e,ye,lt),[R,v]=I.useState(null),P=qo(d),D=Yo(),V=(0,Qo.useComposedRefs)(t,P,D,v);Fn(R,h.tabIndex===void 0);let E=h["aria-label"]!==void 0||h["aria-labelledby"]!==void 0;return I.createElement(be.ScrollArea.Root,{type:i,scrollHideDelay:l,dir:c,className:(0,Jo.default)("kui-ScrollAreaRoot",a),"data-fade":d?"":void 0,style:s,asChild:o},Xo({asChild:o,children:n},A=>I.createElement(I.Fragment,null,I.createElement(be.ScrollArea.Viewport,{role:E?"region":void 0,...h,ref:V,className:"kui-ScrollAreaViewport"},A),I.createElement("div",{className:"kui-ScrollAreaViewportFocusRing"}),u!=="vertical"?I.createElement(be.ScrollArea.Scrollbar,{"data-radius":p,orientation:"horizontal",className:"kui-ScrollAreaScrollbar"},I.createElement(be.ScrollArea.Thumb,{className:"kui-ScrollAreaThumb"})):null,u!=="horizontal"?I.createElement(be.ScrollArea.Scrollbar,{"data-radius":p,orientation:"vertical",className:"kui-ScrollAreaScrollbar"},I.createElement(be.ScrollArea.Thumb,{className:"kui-ScrollAreaThumb"})):null,u==="both"?I.createElement(be.ScrollArea.Corner,{className:"kui-ScrollAreaCorner"}):null)))});_t.displayName="ScrollArea";var N=T(require("react")),er=T(require("classnames"));var gt=N.createContext(void 0),tr={values:["1","2","3","4"]},qt=N.forwardRef(({kind:e,size:t="2",color:o="gray",className:n,children:a,trailing:s,leading:i,...l},c)=>N.createElement("div",{role:"status","aria-live":"polite",...l,ref:c,className:(0,er.default)("kui-NoticeRoot",`kui-r-size-${t}`,n),"data-kind":e,"data-accent-color":o},i?N.createElement("span",{className:"kui-NoticeIcon","aria-hidden":!0},i):null,N.createElement(ue,{as:"div",size:t,className:"kui-NoticeText"},a),s));qt.displayName="Strip";var Ln=N.forwardRef(({icon:e,action:t,onDismiss:o,dismissLabel:n="Dismiss",size:a,...s},i)=>{let l=N.useContext(gt),c=Ue(a??l,tr),p=t||o?N.createElement("span",{className:"kui-NoticeActions"},t?N.createElement(Se.Provider,{value:c},t):null,o?N.createElement(me,{iconOnly:!0,size:c,variant:"ghost",color:"gray","aria-label":n,className:"kui-NoticeDismiss",onClick:o},N.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none","aria-hidden":!0},N.createElement("path",{d:"M4 4l7 7M11 4l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))):null):null;return N.createElement(qt,{...s,size:c,ref:i,kind:"notice",leading:e,trailing:p})});Ln.displayName="Notice";var Bn=N.forwardRef(({confirmLabel:e,cancelLabel:t="Not now",onConfirm:o,onCancel:n,busy:a=!1,size:s,color:i="gray",...l},c)=>{let p=N.useContext(gt),u=Ue(s??p,tr);return N.createElement(qt,{...l,size:u,color:i,ref:c,kind:"confirmation",trailing:N.createElement("span",{className:"kui-NoticeActions"},N.createElement(me,{size:u,variant:"ghost",color:"gray",disabled:a,onClick:n},t),N.createElement(me,{size:u,variant:"solid",color:i,loading:a,onClick:o},e))})});Bn.displayName="Confirmation";var Zt=require("radix-ui"),Yt=Zt.VisuallyHidden.Root,ti=Zt.VisuallyHidden.Root;function or(e,t){let{placeholder:o}=e;if(!o){t();return}e.placeholder="";try{t()}finally{e.placeholder=o}}var Vn={values:["1","2","3"]},sr=r.createContext(null),Jt=r.createContext(""),ie=()=>{let e=r.useContext(sr);if(!e)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return e},Ze=e=>Array.isArray(e)?e:typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[],On=(e,t)=>{if(t.length===0)return!0;let o=e.type.toLowerCase(),n=e.name.toLowerCase();for(let a of t){let s=a.toLowerCase();if(s.includes("/")){let[i,l]=s.split("/"),[c,p]=o.split("/");if(i==="*"||i===c&&(l==="*"||l===p))return!0}else if(s.startsWith(".")&&n.endsWith(s))return!0}return!1},Mn=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i,ar=(e,t)=>(t||"").toLowerCase().startsWith("image/")||Mn.test(e),Xt=e=>e.trim().length>0,rr=(e,t)=>`${e} ${t}${e===1?"":"s"}`,zn=0,In=()=>`chatbar-attachment-${Date.now()}-${++zn}`,ir=r.forwardRef((e,t)=>{let{className:o,style:n,children:a,value:s,defaultValue:i="",onValueChange:l,open:c,defaultOpen:p=!1,onOpenChange:u,expandOn:d="both",minLines:h=3,maxLines:R=6,sendMode:v="whenDirty",disabled:P,readOnly:D,onSubmit:V,size:E,variant:A,color:H,radius:j,width:$,maxWidth:C,attachments:q,defaultAttachments:ee,onAttachmentsChange:te,accept:z,multiple:Z=!0,maxAttachments:le,maxFileSize:oe,paste:re=!0,pasteAccept:pe,clearOnSubmit:ne=!0,onAttachmentReject:Y,dropzone:X=!0,apiRef:ve,onBlurCapture:Ae,notices:Re,context:Fe,...k}=e,L=Ue(E,Vn),K=s!=null,[m,x]=r.useState(i),B=K?s:m,de=c!=null,[Ce,Le]=r.useState(p),Ie=de?c:Ce,xe="attachments"in e,[He,Ye]=r.useState(()=>ee??[]),je=r.useMemo(()=>xe?q??[]:He,[xe,q,He]),[eo,vr]=r.useState({text:"",id:0}),We=r.useCallback(f=>vr(b=>({text:f,id:b.id+1})),[]),to=r.useRef(null),Rr=(0,Ee.useComposedRefs)(t,to),Pt=r.useRef(null),bt=r.useRef(null),Ge=r.useRef(!1),Xe=r.useRef(!1),Je=r.useRef(void 0),vt=r.useRef(null),oo=Ze(z).join(","),Rt=Ze(pe).join(","),Ct=r.useMemo(()=>Ze(oo),[oo]),Cr=r.useMemo(()=>Rt?Ze(Rt):Ct,[Rt,Ct]),ro={value:B,attachments:je,accepts:Ct,pasteAccepts:Cr,multiple:Z,maxAttachments:le,maxFileSize:oe,disabled:P,readOnly:D,expandOn:d,isValueControlled:K,isOpenControlled:de,isAttachmentsControlled:xe,onValueChange:l,onOpenChange:u,onAttachmentsChange:te,onAttachmentReject:Y,onSubmit:V},W=r.useRef(ro);W.current=ro;let xt=r.useRef(null),fe=r.useCallback(()=>xt.current??W.current.attachments,[]),Be=r.useCallback(f=>{W.current.isOpenControlled||Le(f),W.current.onOpenChange?.(f)},[]),Qe=r.useCallback(f=>{W.current.isValueControlled||x(f),W.current.onValueChange?.(f)},[]),Ve=r.useCallback(f=>{xt.current=f,queueMicrotask(()=>{xt.current=null}),W.current.isAttachmentsControlled||Ye(f),W.current.onAttachmentsChange?.(f)},[]),et=r.useRef(new Set),Oe=r.useCallback((f,b,w=W.current.multiple)=>{let S=W.current;if(S.disabled||S.readOnly||f.length===0)return 0;let he=fe(),Te=[],Me=[],Er=typeof S.maxAttachments=="number"?Math.max(S.maxAttachments-he.length,0):1/0,Ar=w?1/0:1;for(let J of f){if(Te.length>=Er||Te.length>=Ar){Me.push({file:J,reason:"count"});continue}if(typeof S.maxFileSize=="number"&&J.size>S.maxFileSize){Me.push({file:J,reason:"size"});continue}if(!On(J,b)){Me.push({file:J,reason:"type"});continue}let Dt=ar(J.name,J.type)?URL.createObjectURL(J):void 0;Dt&&et.current.add(Dt),Te.push({id:In(),name:J.name,size:J.size,type:J.type,file:J,url:Dt,status:"idle"})}let rt=[];return Te.length>0&&(Ve(he.concat(Te)),S.expandOn!=="none"&&Be(!0),rt.push(`${rr(Te.length,"file")} attached.`)),Me.length>0&&(S.onAttachmentReject?.(Me),rt.push(`${rr(Me.length,"file")} could not be attached.`)),rt.length>0&&We(rt.join(" ")),Te.length},[fe,Ve,Be,We]),tt=r.useCallback(f=>Oe(f,W.current.accepts),[Oe]),no=r.useCallback(f=>Oe(f,W.current.pasteAccepts),[Oe]),so=r.useCallback(f=>{let b=fe(),w=b.find(S=>S.id===f);w&&(Ve(b.filter(S=>S.id!==f)),We(`Removed ${w.name}.`))},[fe,Ve,We]),ao=r.useCallback(f=>{let b=W.current;if(b.disabled||b.readOnly)return!1;let w=fe();if(!Xt(b.value)&&w.length===0)return!1;let S={value:b.value,attachments:w};if(f&&b.onSubmit)for(let he of w)he.url&&et.current.delete(he.url);return b.onSubmit?.(S),f&&(Qe(""),Ve([])),!0},[fe,Qe,Ve]);r.useEffect(()=>{let f=et.current;if(f.size===0)return;let b=new Set(je.map(w=>w.url));for(let w of Array.from(f))b.has(w)||(URL.revokeObjectURL(w),f.delete(w))},[je]),r.useEffect(()=>{let f=et.current;return()=>{if(!W.current.isAttachmentsControlled){for(let b of Array.from(f))URL.revokeObjectURL(b);f.clear()}}},[]);let ot=r.useCallback(f=>{let b=W.current,w=bt.current;if(clearTimeout(Je.current),Xe.current=!1,!w||b.disabled||b.readOnly)return;let S=f?.accept!=null?Ze(f.accept):b.accepts,he=f?.multiple??b.multiple;vt.current={patterns:S,multiple:he},w.accept=S.join(","),w.multiple=he,Ge.current=!0,w.click(),setTimeout(()=>{document.hasFocus()&&(Ge.current=!1)},1e3)},[]),io=r.useCallback(()=>{Xe.current=!0,clearTimeout(Je.current),Je.current=setTimeout(()=>{Xe.current=!1},800)},[]);r.useEffect(()=>()=>clearTimeout(Je.current),[]),r.useEffect(()=>{let f=bt.current,b=()=>{Ge.current=!1};return window.addEventListener("focus",b),f?.addEventListener("cancel",b),()=>{window.removeEventListener("focus",b),f?.removeEventListener("cancel",b)}},[]);let xr=r.useCallback(f=>{let b=f.currentTarget,w=Array.from(b.files??[]),S=vt.current;Oe(w,S?.patterns??W.current.accepts,S?.multiple),Ge.current=!1,vt.current=null,b.value=""},[Oe]),Tr=r.useCallback(f=>{Ae?.(f);let b=W.current,w=to.current;if(!w||b.expandOn==="none")return;let S=f.relatedTarget;S&&w.contains(S)||Ge.current||Xe.current||!Xt(b.value)&&fe().length===0&&Be(!1)},[Ae,Be,fe]),Dr=r.useCallback(f=>{tt(f)},[tt]),{getRootProps:wr,isDragActive:kr}=(0,nr.useDropzone)({onDrop:Dr,onDragEnter:()=>We(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!X||P||D}),Tt=X&&kr;r.useImperativeHandle(ve,()=>({focusTextarea:()=>Pt.current?.focus({preventScroll:!0}),openFilePicker:()=>ot()}),[ot]);let Sr=r.useCallback(f=>{if(P||f.pointerType==="mouse"&&f.button!==0)return;let b=f.target;b instanceof Element&&b.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(f.preventDefault(),Pt.current?.focus({preventScroll:!0}))},[P]),Nr=r.useMemo(()=>({open:Ie,setOpen:Be,setValue:Qe,size:L,expandOn:d,minLines:h,maxLines:R,sendMode:v,disabled:P,readOnly:D,paste:re,clearOnSubmit:ne,multiple:Z,textareaRef:Pt,attachments:je,removeAttachment:so,submit:ao,appendFiles:tt,appendFilesFromPaste:no,openFilePicker:ot,beginFilePickerPress:io}),[Ie,Be,Qe,L,d,h,R,v,P,D,re,ne,Z,je,so,ao,tt,no,ot,io]);return r.createElement(sr.Provider,{value:Nr},r.createElement(Jt.Provider,{value:B},r.createElement(r.Fragment,null,r.createElement("div",{...k,ref:Rr,className:(0,_.default)("kui-ChatbarRoot",`kui-r-size-${L}`,o),style:{position:"relative",width:$,maxWidth:C,...n},"data-state":Ie?"open":"closed","data-disabled":P?"":void 0,"data-readonly":D?"":void 0,"data-drop-active":Tt?"":void 0,"data-accent-color":H,"data-radius":j,onBlurCapture:Tr},r.createElement("input",{ref:bt,type:"file",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:xr}),Re?r.createElement("div",{className:"kui-ChatbarNotices"},r.createElement(gt.Provider,{value:L},Re)):null,r.createElement("div",{...X?wr():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Sr},r.createElement("div",{className:(0,_.default)("kui-ChatbarBox",`kui-variant-${A??"raised"}`),style:{position:"relative"},"data-accent-color":H,"data-radius":j},r.createElement("div",{className:"kui-ChatbarGrid"},a),Tt&&r.createElement("div",{className:"kui-ChatbarDropOverlay","aria-hidden":!0},r.createElement("div",{className:"kui-ChatbarDropContent"},r.createElement(ue,{emphasis:"medium",size:L,weight:"medium"},"Drop files here to attach"))))),Fe?r.createElement(ue,{as:"div",size:L==="3"?"2":"1",emphasis:"medium",className:"kui-ChatbarContext"},Fe):null,r.createElement(Yt,{role:"status","aria-live":"polite"},Tt?"Drop files here to attach.":r.createElement("span",{key:eo.id},eo.text))))))});ir.displayName="Chatbar.Root";var lr=r.forwardRef((e,t)=>{let{className:o,style:n,asChild:a,onFocus:s,onChange:i,onPaste:l,onKeyDown:c,onCompositionStart:p,onCompositionEnd:u,submitOnEnter:d=!1,...h}=e,R=ie(),v=r.useContext(Jt),{open:P,minLines:D,maxLines:V,expandOn:E,disabled:A,readOnly:H,setOpen:j,setValue:$,textareaRef:C,paste:q,appendFilesFromPaste:ee,size:te,submit:z,clearOnSubmit:Z}=R,le=(0,Ee.useComposedRefs)(t,C),oe=r.useRef(0),re=r.useRef(0),pe=r.useRef(!1),ne=r.useRef({open:P,minLines:D,maxLines:V});(0,Ee.useLayoutEffect)(()=>{ne.current={open:P,minLines:D,maxLines:V}},[P,D,V]);let Y=r.useCallback(()=>{let m=C.current;if(!m)return;let x=window.getComputedStyle(m);oe.current=parseFloat(x.lineHeight)||20,re.current=(parseFloat(x.paddingTop)||0)+(parseFloat(x.paddingBottom)||0)},[C]),X=r.useCallback((m,x)=>{let{minLines:B,maxLines:de}=ne.current,Ce=oe.current,Le=re.current,Ie=Math.ceil((x?B:1)*Ce)+Le,xe=Math.ceil((x?de:1)*Ce)+Le,He=Math.max(m.scrollHeight,Ie);m.style.height=`${Math.min(He,xe)}px`;let Ye=He>xe;m.style.overflowY=Ye?"auto":"hidden",m.style.maxHeight=Ye?`${xe}px`:"none"},[]);(0,Ee.useLayoutEffect)(()=>{Y()},[Y,te]),(0,Ee.useLayoutEffect)(()=>{let m=C.current;m&&(oe.current===0&&Y(),or(m,()=>{m.style.height="auto";let x=P;if(!P&&(E==="overflow"||E==="both")){let B=Math.ceil(oe.current)+re.current;m.scrollHeight>B+1&&(x=!0,j(!0))}X(m,x)}))},[v,P,E,D,V,te,j,C,Y,X]),r.useEffect(()=>{let m=C.current;if(!m||typeof ResizeObserver>"u")return;let x=-1,B=new ResizeObserver(de=>{let Ce=de[0]?.contentRect.width??0;if(Ce===x)return;let Le=x===-1;x=Ce,!Le&&(Y(),or(m,()=>{m.style.height="auto",X(m,ne.current.open)}))});return B.observe(m),()=>B.disconnect()},[C,Y,X]),r.useEffect(()=>{},[]);let ve=r.useCallback(m=>{s?.(m),!(A||H)&&(E==="focus"||E==="both")&&!P&&j(!0)},[A,H,E,P,j,s]),Ae=r.useCallback(m=>{$(m.currentTarget.value),i?.(m)},[$,i]),Re=r.useCallback(m=>{if(l?.(m),m.defaultPrevented||!q||A||H)return;let x=Array.from(m.clipboardData?.items??[]).filter(B=>B.kind==="file").map(B=>B.getAsFile()).filter(B=>!!B);x.length!==0&&ee(x)>0&&m.preventDefault()},[q,A,H,l,ee]),Fe=r.useCallback(m=>{pe.current=!0,p?.(m)},[p]),k=r.useCallback(m=>{pe.current=!1,u?.(m)},[u]),L=r.useCallback(m=>{c?.(m),!(m.defaultPrevented||!d)&&(m.key!=="Enter"||m.shiftKey||m.altKey||m.ctrlKey||m.metaKey||pe.current||m.nativeEvent.isComposing||m.nativeEvent.keyCode===229||(m.preventDefault(),z(Z)))},[d,c,z,Z]);return r.createElement("div",{className:"kui-ChatbarField kui-ChatbarTextarea"},r.createElement(a?ae:"textarea",{...h,ref:le,className:(0,_.default)("kui-ChatbarInput",o),value:v,onChange:Ae,onFocus:ve,onPaste:Re,onKeyDown:L,onCompositionStart:Fe,onCompositionEnd:k,disabled:A,readOnly:H,rows:P?D:1,spellCheck:h.spellCheck??!0,autoCorrect:h.autoCorrect??"on",style:n}))});lr.displayName="Chatbar.Textarea";var pr=r.forwardRef((e,t)=>{let{children:o,asChild:n,className:a,...s}=e;return ie().open?null:r.createElement(n?ae:"div",{...s,ref:t,className:(0,_.default)("kui-ChatbarInlineStart",a)},o)});pr.displayName="Chatbar.InlineStart";var cr=r.forwardRef((e,t)=>{let{children:o,asChild:n,className:a,...s}=e;return ie().open?null:r.createElement(n?ae:"div",{...s,ref:t,className:(0,_.default)("kui-ChatbarInlineEnd",a)},o)});cr.displayName="Chatbar.InlineEnd";var ur=r.forwardRef((e,t)=>{let{asChild:o,forceMount:n,renderAttachment:a,className:s,children:i,...l}=e,c=ie(),p=r.Children.toArray(i).length>0;return c.attachments.length===0&&!p&&!n?null:r.createElement("div",null,r.createElement(o?ae:"div",{...l,ref:t,className:(0,_.default)("kui-ChatbarAttachmentsRow",s),role:"list","aria-label":l["aria-label"]??"Attachments"},r.createElement(_t,{className:"kui-ChatbarScrollArea",scrollbars:"horizontal"},r.createElement(ce,{align:"center",gap:"3",minWidth:"fit-content"},c.attachments.map(d=>r.createElement(Qt,{key:d.id,attachment:d,asChild:!!a},a?.(d))),i))))});ur.displayName="Chatbar.AttachmentsRow";function mr(e,t){let o=e.closest('[role="listitem"]'),n=o?.parentElement?Array.from(o.parentElement.children):[],a=o?n.indexOf(o):-1,i=(n[a+1]??n[a-1])?.querySelector(".kui-ChatbarItemRemove");i?i.focus():t.current?.focus({preventScroll:!0})}var dr=({lead:e,leadKind:t,label:o,detail:n,removeLabel:a,onRemove:s})=>{let i=ie();return r.createElement(r.Fragment,null,r.createElement("span",{className:"kui-ChatbarItemLead","data-kind":t,"aria-hidden":!0},e),r.createElement(ue,{className:"kui-ChatbarItemLabel",size:i.size,truncate:!0},o,n?r.createElement(Yt,null,", ",n):null),s&&r.createElement(me,{iconOnly:!0,className:"kui-ChatbarItemRemove","aria-label":a,size:"1",variant:"ghost",color:"gray",onClick:s},r.createElement(Bt,null)))},Hn={uploading:"uploading",error:"failed to upload"},Qt=r.forwardRef((e,t)=>{let{attachment:o,asChild:n,className:a,children:s,...i}=e,l=ie(),c=n?ae:"div",p=!!o.url&&ar(o.name,o.type),u=`${Math.ceil(o.size/1024)} KB`,d=o.status?Hn[o.status]:void 0,h=l.disabled||l.readOnly,R=P=>{mr(P.currentTarget,l.textareaRef),l.removeAttachment(o.id)},v=o.status==="uploading"?r.createElement(ze,null):p?r.createElement("img",{className:"kui-ChatbarAttachmentImage",src:o.url,alt:""}):r.createElement(Ot,null);return r.createElement(c,{...i,ref:t,className:(0,_.default)(s?"kui-ChatbarAttachment":"kui-ChatbarAttachment kui-ChatbarItem",a),role:"listitem","data-kind":p?"image":"file","data-status":o.status,title:o.name},s??r.createElement(dr,{lead:v,leadKind:p&&o.status!=="uploading"?"image":"icon",label:o.name,detail:d?`${u}, ${d}`:u,removeLabel:`Remove ${o.name}`,onRemove:h?void 0:R}))});Qt.displayName="Chatbar.Attachment";var fr=r.forwardRef((e,t)=>{let{children:o,icon:n,image:a,color:s,onRemove:i,removeLabel:l,className:c,...p}=e,u=ie(),d=u.disabled||u.readOnly,h=i?R=>{mr(R.currentTarget,u.textareaRef),i()}:void 0;return r.createElement("div",{...p,ref:t,className:(0,_.default)("kui-ChatbarItem",c),role:"listitem","data-accent-color":a?void 0:s??"gray",title:o},r.createElement(dr,{lead:a?r.createElement("img",{className:"kui-ChatbarAttachmentImage",src:a,alt:""}):n,leadKind:a?"image":"icon",label:o,removeLabel:l??`Remove ${o}`,onRemove:d?void 0:h}))});fr.displayName="Chatbar.Item";var hr=r.forwardRef((e,t)=>{let{asChild:o,accept:n,multiple:a,disabled:s,onPointerDown:i,onClick:l,children:c,color:p,...u}=e,d=ie(),h=s||d.disabled||d.readOnly,R={...u,ref:t,className:(0,_.default)("kui-ChatbarAttachTrigger",u.className),type:u.type??"button","aria-label":u["aria-label"]??"Add attachments",disabled:h,onPointerDown:v=>{i?.(v),!h&&!v.defaultPrevented&&d.beginFilePickerPress()},onClick:v=>{l?.(v),!(h||v.defaultPrevented)&&d.openFilePicker({accept:n,multiple:a})}};return o?r.createElement(ae,{...R},c):r.createElement(me,{iconOnly:!0,emphasis:"quiet",color:"gray",size:d.size,...R},c??r.createElement(Vt,{"aria-hidden":!0}))});hr.displayName="Chatbar.AttachTrigger";var yr=r.forwardRef((e,t)=>{let{asChild:o,children:n,className:a,...s}=e;return ie().open?r.createElement("div",null,r.createElement(o?ae:"div",{...s,ref:t,className:(0,_.default)("kui-ChatbarRow",a)},r.createElement(ce,{align:"center",justify:"between",width:"100%"},n))):null});yr.displayName="Chatbar.Row";var gr=r.forwardRef((e,t)=>{let{className:o,...n}=e;return r.createElement("div",{...n,ref:t,className:(0,_.default)("kui-ChatbarRowStart",o)})});gr.displayName="Chatbar.RowStart";var Pr=r.forwardRef((e,t)=>{let{className:o,...n}=e;return r.createElement("div",{...n,ref:t,className:(0,_.default)("kui-ChatbarRowEnd",o)})});Pr.displayName="Chatbar.RowEnd";var br=r.forwardRef((e,t)=>{let{asChild:o,clearOnSend:n,disabled:a,children:s,style:i,className:l,size:c,variant:p,emphasis:u,tabIndex:d,onClick:h,status:R="ready",onStop:v,onRetry:P,stopLabel:D="Stop",retryLabel:V="Retry",stopIcon:E,retryIcon:A,"aria-label":H,"aria-labelledby":j,...$}=e,C=ie(),q=r.useContext(Jt),ee=Xt(q)||C.attachments.length>0,z=ee?"send":R==="submitted"||R==="streaming"?"stop":R==="error"?"retry":"send";if(C.sendMode==="never"&&z==="send")return null;let Z=z!=="send"||C.sendMode==="always"||ee,le=z==="send"?a||C.disabled||C.readOnly||!ee:a||C.disabled,re=z==="stop"?{"aria-label":D}:z==="retry"?{"aria-label":V}:j?{"aria-labelledby":j}:{"aria-label":H??"Send"},pe=Y=>{if(h?.(Y),Y.defaultPrevented||le)return;if(z==="stop"){v?.();return}if(z==="retry"){P?.();return}let X=n??C.clearOnSubmit;C.submit(X)&&X&&C.textareaRef.current?.focus({preventScroll:!0})},ne=z==="stop"?E??(R==="submitted"?r.createElement(ze,null):r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0},r.createElement("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"}))):z==="retry"?A??r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},r.createElement("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),r.createElement("path",{d:"M3 3v5h5"})):s??r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},r.createElement("path",{d:"M5 12h14"}),r.createElement("path",{d:"m12 5 7 7-7 7"}));return r.createElement(me,{iconOnly:!0,...$,ref:t,size:c??C.size,...u?{emphasis:u}:{variant:p??(C.open||z!=="send"?"solid":"ghost")},disabled:le,className:(0,_.default)("kui-ChatbarSend",l),style:{opacity:Z?1:0,pointerEvents:Z?void 0:"none",...i},"aria-hidden":Z?void 0:!0,tabIndex:Z?d:-1,asChild:o,onClick:pe,"data-status":R,"data-mode":z,...re},ne)});br.displayName="Chatbar.Send";
|
|
3
3
|
//# sourceMappingURL=chatbar.js.map
|