@inkeep/agents-ui 0.15.26 → 0.15.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +166 -174
  3. package/dist/primitives/atoms/dialog.cjs +1 -1
  4. package/dist/primitives/atoms/dialog.js +110 -106
  5. package/dist/primitives/atoms/file-upload.cjs +1 -0
  6. package/dist/primitives/atoms/file-upload.d.ts +35 -0
  7. package/dist/primitives/atoms/file-upload.js +45 -0
  8. package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
  9. package/dist/primitives/atoms/icons/built-in-icons.d.ts +8 -1
  10. package/dist/primitives/atoms/icons/built-in-icons.js +86 -79
  11. package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
  12. package/dist/primitives/atoms/icons/collections/pi.d.ts +6 -0
  13. package/dist/primitives/atoms/icons/collections/pi.js +103 -13
  14. package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
  15. package/dist/primitives/atoms/icons/inkeep-default-icons.js +9 -1
  16. package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -0
  17. package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +68 -0
  18. package/dist/primitives/components/embedded-chat/file-upload-input.js +328 -0
  19. package/dist/primitives/components/embedded-chat/image-preview-modal.cjs +1 -0
  20. package/dist/primitives/components/embedded-chat/image-preview-modal.d.ts +15 -0
  21. package/dist/primitives/components/embedded-chat/image-preview-modal.js +71 -0
  22. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +3 -3
  23. package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +7 -5
  24. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +277 -237
  25. package/dist/primitives/components/embedded-chat.cjs +4 -4
  26. package/dist/primitives/components/embedded-chat.d.ts +7 -116
  27. package/dist/primitives/components/embedded-chat.js +1082 -1484
  28. package/dist/primitives/components/embedded-search.d.ts +1 -1
  29. package/dist/primitives/hooks/index.cjs +1 -1
  30. package/dist/primitives/hooks/index.js +15 -14
  31. package/dist/primitives/hooks/use-input-notification.cjs +1 -0
  32. package/dist/primitives/hooks/use-input-notification.d.ts +9 -0
  33. package/dist/primitives/hooks/use-input-notification.js +18 -0
  34. package/dist/primitives/hooks/use-scrolling-fades.cjs +1 -1
  35. package/dist/primitives/hooks/use-scrolling-fades.d.ts +1 -0
  36. package/dist/primitives/hooks/use-scrolling-fades.js +21 -5
  37. package/dist/primitives/index.cjs +1 -1
  38. package/dist/primitives/index.js +146 -154
  39. package/dist/primitives/providers/base-events-provider.cjs +1 -1
  40. package/dist/primitives/providers/base-events-provider.js +1 -1
  41. package/dist/primitives/providers/feedback-provider.cjs +1 -1
  42. package/dist/primitives/providers/feedback-provider.js +37 -38
  43. package/dist/primitives/providers/image-preview-provider.cjs +1 -0
  44. package/dist/primitives/providers/image-preview-provider.d.ts +15 -0
  45. package/dist/primitives/providers/image-preview-provider.js +23 -0
  46. package/dist/primitives/providers/index.cjs +1 -1
  47. package/dist/primitives/providers/index.d.ts +0 -3
  48. package/dist/primitives/providers/index.js +54 -63
  49. package/dist/primitives/utils/component-ids.cjs +1 -1
  50. package/dist/primitives/utils/component-ids.d.ts +54 -98
  51. package/dist/primitives/utils/component-ids.js +44 -66
  52. package/dist/primitives/utils/default-settings.cjs +1 -1
  53. package/dist/primitives/utils/default-settings.d.ts +0 -2
  54. package/dist/primitives/utils/default-settings.js +6 -8
  55. package/dist/react/embedded-chat.cjs +1 -1
  56. package/dist/react/embedded-chat.js +283 -287
  57. package/dist/react/index.cjs +1 -1
  58. package/dist/react/index.js +166 -174
  59. package/dist/styled/components/chat-history.cjs +1 -1
  60. package/dist/styled/components/chat-history.d.ts +1 -1
  61. package/dist/styled/components/chat-history.js +31 -29
  62. package/dist/styled/components/embedded-chat/file-upload-input.cjs +1 -0
  63. package/dist/styled/components/embedded-chat/file-upload-input.d.ts +20 -0
  64. package/dist/styled/components/embedded-chat/file-upload-input.js +300 -0
  65. package/dist/styled/components/embedded-chat/image-preview-modal.cjs +1 -0
  66. package/dist/styled/components/embedded-chat/image-preview-modal.d.ts +11 -0
  67. package/dist/styled/components/embedded-chat/image-preview-modal.js +77 -0
  68. package/dist/styled/components/embedded-chat.cjs +1 -1
  69. package/dist/styled/components/embedded-chat.d.ts +4 -50
  70. package/dist/styled/components/embedded-chat.js +567 -1010
  71. package/dist/styled/components/message.cjs +1 -1
  72. package/dist/styled/components/message.js +89 -88
  73. package/dist/styled/components/ui/recipes/citation.d.ts +1 -1
  74. package/dist/styled/components/ui/recipes/index.cjs +1 -1
  75. package/dist/styled/components/ui/recipes/index.d.ts +0 -1
  76. package/dist/styled/components/ui/recipes/index.js +31 -33
  77. package/dist/styled/index.cjs +1 -1
  78. package/dist/styled/index.js +154 -162
  79. package/dist/styled/inkeep.css.cjs +241 -61
  80. package/dist/styled/inkeep.css.js +241 -61
  81. package/dist/types/config/ai.d.ts +1 -10
  82. package/dist/types/icons/built-in.d.ts +1 -1
  83. package/dist/types/icons/custom.d.ts +8 -0
  84. package/dist/types/index.d.ts +0 -1
  85. package/package.json +7 -6
  86. package/dist/primitives/providers/attachment-item-provider.cjs +0 -1
  87. package/dist/primitives/providers/attachment-item-provider.d.ts +0 -9
  88. package/dist/primitives/providers/attachment-item-provider.js +0 -13
  89. package/dist/primitives/providers/attachments-bar-provider.cjs +0 -1
  90. package/dist/primitives/providers/attachments-bar-provider.d.ts +0 -30
  91. package/dist/primitives/providers/attachments-bar-provider.js +0 -57
  92. package/dist/primitives/providers/message-attachments-provider.cjs +0 -1
  93. package/dist/primitives/providers/message-attachments-provider.d.ts +0 -13
  94. package/dist/primitives/providers/message-attachments-provider.js +0 -27
  95. package/dist/primitives/utils/get-message-metadata.d.ts +0 -8
  96. package/dist/styled/components/ui/recipes/attachment.cjs +0 -1
  97. package/dist/styled/components/ui/recipes/attachment.d.ts +0 -4
  98. package/dist/styled/components/ui/recipes/attachment.js +0 -28
  99. package/dist/types/config/settings/workflow.d.ts +0 -86
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../generate-icon.cjs");function t(a){return l.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M44,120H212a4,4,0,0,0,4-4V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76A4,4,0,0,0,44,120ZM152,44l44,44H152Zm72,108.53a8.18,8.18,0,0,1-8.25,7.47H192v16h15.73a8.17,8.17,0,0,1,8.25,7.47,8,8,0,0,1-8,8.53H192v15.73a8.17,8.17,0,0,1-7.47,8.25,8,8,0,0,1-8.53-8V152a8,8,0,0,1,8-8h32A8,8,0,0,1,224,152.53ZM64,144H48a8,8,0,0,0-8,8v55.73A8.17,8.17,0,0,0,47.47,216,8,8,0,0,0,56,208v-8h7.4c15.24,0,28.14-11.92,28.59-27.15A28,28,0,0,0,64,144Zm-.35,40H56V160h8a12,12,0,0,1,12,13.16A12.25,12.25,0,0,1,63.65,184ZM128,144H112a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h15.32c19.66,0,36.21-15.48,36.67-35.13A36,36,0,0,0,128,144Zm-.49,56H120V160h8a20,20,0,0,1,20,20.77C147.58,191.59,138.34,200,127.51,200Z"},child:[]}]})(a)}function i(a){return l.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M224,152a8,8,0,0,1-8,8H192v16h16a8,8,0,0,1,0,16H192v16a8,8,0,0,1-16,0V152a8,8,0,0,1,8-8h32A8,8,0,0,1,224,152ZM92,172a28,28,0,0,1-28,28H56v8a8,8,0,0,1-16,0V152a8,8,0,0,1,8-8H64A28,28,0,0,1,92,172Zm-16,0a12,12,0,0,0-12-12H56v24h8A12,12,0,0,0,76,172Zm88,8a36,36,0,0,1-36,36H112a8,8,0,0,1-8-8V152a8,8,0,0,1,8-8h16A36,36,0,0,1,164,180Zm-16,0a20,20,0,0,0-20-20h-8v40h8A20,20,0,0,0,148,180ZM40,112V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0ZM160,80h28.69L160,51.31Z"},child:[]}]})(a)}function e(a){return l.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M72.61,83.06a8,8,0,0,1,1.73-8.72l48-48a8,8,0,0,1,11.32,0l48,48A8,8,0,0,1,176,88H80A8,8,0,0,1,72.61,83.06ZM176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Z"},child:[]}]})(a)}exports.PiCaretUpDownFill=e;exports.PiFilePdf=i;exports.PiFilePdfFill=t;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generate-icon.cjs");function l(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M16 184.571C16.0001 180.153 19.5818 176.571 24 176.571C28.4182 176.571 31.9999 180.153 32 184.571C32 186.53 32.7811 188.416 34.1836 189.812C35.5873 191.209 37.4991 192 39.5 192C41.5009 192 43.4127 191.209 44.8164 189.812C46.2189 188.416 47 186.53 47 184.571V152C47 147.582 50.5817 144 55 144C59.4183 144 63 147.582 63 152V184.571C63 190.797 60.5147 196.761 56.1035 201.151C51.6936 205.541 45.7205 208 39.5 208C33.2795 208 27.3064 205.541 22.8965 201.151C18.4853 196.761 16 190.797 16 184.571ZM167 176C167 166.127 160.21 160 154 160C147.79 160 141 166.127 141 176C141 185.873 147.79 192 154 192C160.21 192 167 185.873 167 176ZM191 200V152C191 148.517 193.254 145.434 196.573 144.377C199.893 143.32 203.515 144.533 205.528 147.376L225 174.865V152C225 147.582 228.582 144 233 144C237.418 144 241 147.582 241 152V200C241 203.483 238.746 206.566 235.427 207.623C232.107 208.68 228.485 207.467 226.472 204.624L207 177.134V200C207 204.418 203.418 208 199 208C194.582 208 191 204.418 191 200ZM92.6406 144.059C96.5959 143.845 100.332 144.254 102.983 144.679C104.334 144.895 105.461 145.125 106.269 145.306C106.673 145.396 107.001 145.475 107.239 145.534C107.358 145.564 107.456 145.589 107.529 145.608C107.566 145.618 107.597 145.626 107.622 145.633C107.634 145.636 107.645 145.639 107.654 145.642C107.659 145.643 107.664 145.644 107.668 145.646L107.673 145.646C107.675 145.647 107.677 145.648 105.766 152.684L107.678 145.648C111.941 146.807 114.459 151.202 113.301 155.466C112.143 159.728 107.75 162.244 103.487 161.089L103.491 161.091C103.493 161.091 103.497 161.092 103.497 161.092C103.501 161.093 103.504 161.094 103.504 161.094C103.504 161.094 103.499 161.093 103.491 161.091C103.472 161.086 103.431 161.075 103.37 161.06C103.248 161.029 103.047 160.981 102.777 160.921C102.236 160.8 101.432 160.635 100.452 160.478C98.4442 160.156 95.9258 159.904 93.5039 160.035C90.9783 160.172 89.2855 160.688 88.3467 161.284C87.7783 161.645 87.224 162.131 87.0234 163.765C87.0073 163.896 87.0014 163.996 87 164.067C87.0933 164.153 87.2577 164.291 87.5352 164.469C89.2298 165.555 91.9117 166.376 96.3486 167.689C100.038 168.782 105.407 170.338 109.549 173.303C111.789 174.906 113.973 177.113 115.406 180.155C116.859 183.24 117.27 186.615 116.835 190.094V190.096C116.029 196.521 112.814 201.28 108.207 204.231C103.966 206.949 99.1332 207.77 95.2666 207.955C91.2998 208.145 87.5599 207.696 84.9102 207.241C83.5604 207.009 82.4329 206.765 81.626 206.574C81.2215 206.478 80.8937 206.396 80.6553 206.333C80.5362 206.302 80.439 206.275 80.3652 206.255C80.3285 206.245 80.2975 206.236 80.2725 206.229C80.2601 206.225 80.2487 206.222 80.2393 206.22C80.2345 206.218 80.2296 206.217 80.2256 206.216C80.2236 206.215 80.2197 206.214 80.2197 206.214C80.2188 206.207 80.2761 206 82.416 198.521L80.2148 206.213C75.9671 204.997 73.5091 200.568 74.7246 196.32C75.9385 192.078 80.3571 189.621 84.5996 190.825L84.6035 190.826C84.6061 190.827 84.6078 190.827 84.6104 190.828C84.6303 190.834 84.669 190.844 84.7256 190.859C84.8458 190.891 85.0453 190.942 85.3125 191.005C85.8492 191.132 86.6463 191.306 87.6182 191.473C89.612 191.815 92.1069 192.088 94.5029 191.974C96.9991 191.854 98.658 191.346 99.5752 190.759C100.126 190.406 100.736 189.884 100.959 188.104C101.02 187.615 101 187.318 100.979 187.171C100.96 187.033 100.935 186.981 100.931 186.972C100.924 186.959 100.899 186.907 100.812 186.809C100.718 186.702 100.542 186.532 100.235 186.312C98.6856 185.203 96.092 184.3 91.8057 183.031C88.2663 181.983 82.9575 180.539 78.9023 177.94C76.7008 176.53 74.406 174.516 72.8398 171.6C71.224 168.591 70.7209 165.249 71.1426 161.814C71.9294 155.406 75.1807 150.693 79.7656 147.779C83.9802 145.101 88.7888 144.267 92.6406 144.059ZM84.6084 190.827L84.6104 190.828L84.6064 190.827L84.6035 190.826L84.6084 190.827ZM40 112V40C40 35.7565 41.6859 31.6871 44.6865 28.6865C47.6871 25.6859 51.7565 24 56 24H152C154.122 24 156.157 24.8425 157.657 26.3428L213.657 82.3428C215.158 83.8431 216 85.8783 216 88V112C216 116.418 212.418 120 208 120C203.582 120 200 116.418 200 112V96H152C147.582 96 144 92.4183 144 88V40H56V112C56 116.418 52.4183 120 48 120C43.5817 120 40 116.418 40 112ZM160 80H188.686L160 51.3145V80ZM183 176C183 192.636 170.986 208 154 208C137.014 208 125 192.636 125 176C125 159.364 137.014 144 154 144C170.986 144 183 159.364 183 176Z"},child:[]}]})(C)}function t(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M44 152C44 147.582 47.5817 144 52 144C56.4183 144 60 147.582 60 152V200H80C84.4183 200 88 203.582 88 208C88 212.418 84.4183 216 80 216H52C47.5817 216 44 212.418 44 208V152ZM144 180C144 167.753 135.724 160 128 160C120.276 160 112 167.753 112 180C112 192.247 120.276 200 128 200C135.724 200 144 192.247 144 180ZM216 176C220.418 176 224 179.582 224 184V200.87C224 202.879 223.244 204.814 221.883 206.291C219.104 209.307 215.738 211.724 211.992 213.394C208.247 215.062 204.199 215.95 200.096 215.999C200.064 215.999 200.032 216 200 216C181.219 216 168 198.677 168 180C168 161.323 181.219 144 200 144C200.008 144 200.016 144 200.024 144C205.921 144.018 211.677 145.817 216.535 149.16C220.175 151.665 221.095 156.645 218.59 160.285C216.085 163.925 211.105 164.845 207.465 162.34C205.264 160.825 202.657 160.01 199.985 160C192.27 160.01 184 167.765 184 180C184 192.223 192.253 199.974 199.962 199.999C201.863 199.969 203.74 199.554 205.479 198.778C206.37 198.382 207.214 197.894 208 197.326V192C203.582 192 200 188.418 200 184C200 179.582 203.582 176 208 176H216ZM40 112V40C40 35.7565 41.6862 31.687 44.6865 28.6865C47.687 25.6862 51.7565 24 56 24H152C154.122 24 156.157 24.8425 157.657 26.3428L213.657 82.3428C215.158 83.8431 216 85.8783 216 88V112C216 116.418 212.418 120 208 120C203.582 120 200 116.418 200 112V96H152C147.582 96 144 92.4183 144 88V40H56V112C56 116.418 52.4183 120 48 120C43.5817 120 40 116.418 40 112ZM160 80H188.686L160 51.3145V80ZM160 180C160 198.681 146.786 216 128 216C109.214 216 96 198.681 96 180C96 161.319 109.214 144 128 144C146.786 144 160 161.319 160 180Z"},child:[]}]})(C)}function i(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V224a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM144,144H128a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h16a36,36,0,0,0,0-72Zm0,56h-8V160h8a20,20,0,0,1,0,40Zm-40-48v56a8,8,0,0,1-16,0V177.38L74.55,196.59a8,8,0,0,1-13.1,0L48,177.38V208a8,8,0,0,1-16,0V152a8,8,0,0,1,14.55-4.59L68,178.05l21.45-30.64A8,8,0,0,1,104,152Z"},child:[]}]})(C)}function r(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M216,120V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v80a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48v24a8,8,0,0,0,16,0ZM160,51.31,188.69,80H160ZM68,160v48a8,8,0,0,1-16,0V192H32v16a8,8,0,0,1-16,0V160a8,8,0,0,1,16,0v16H52V160a8,8,0,0,1,16,0Zm56,0a8,8,0,0,1-8,8h-8v40a8,8,0,0,1-16,0V168H84a8,8,0,0,1,0-16h32A8,8,0,0,1,124,160Zm72,0v48a8,8,0,0,1-16,0V184l-9.6,12.8a8,8,0,0,1-12.8,0L148,184v24a8,8,0,0,1-16,0V160a8,8,0,0,1,14.4-4.8L164,178.67l17.6-23.47A8,8,0,0,1,196,160Zm56,48a8,8,0,0,1-8,8H216a8,8,0,0,1-8-8V160a8,8,0,0,1,16,0v40h20A8,8,0,0,1,252,208Z"},child:[]}]})(C)}function e(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M48,180c0,11,7.18,20,16,20a14.24,14.24,0,0,0,10.22-4.66A8,8,0,0,1,85.78,206.4,30.06,30.06,0,0,1,64,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a30.06,30.06,0,0,1,21.78,9.6,8,8,0,0,1-11.56,11.06A14.24,14.24,0,0,0,64,160C55.18,160,48,169,48,180Zm79.6-8.69c-4-1.16-8.14-2.35-10.45-3.84-1.25-.81-1.23-1-1.12-1.9a4.57,4.57,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.82-.56A8,8,0,0,0,142,145.86c-2.12-.55-21-5.22-32.84,2.76a20.58,20.58,0,0,0-9,14.95c-2,15.88,13.65,20.41,23,23.11,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.14,3.93-4.6,3.06-15.17,1.56-19.55.36A8,8,0,0,0,109.94,214a61.34,61.34,0,0,0,15.19,2c5.82,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C154,179,137.49,174.17,127.6,171.31Zm83.09-26.84a8,8,0,0,0-10.23,4.84L188,184.21l-12.47-34.9a8,8,0,0,0-15.07,5.38l20,56a8,8,0,0,0,15.07,0l20-56A8,8,0,0,0,210.69,144.47ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-27.31-8L160,51.31V80Z"},child:[]}]})(C)}function n(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M48,120a8,8,0,0,0,8-8V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72A8,8,0,0,0,48,120ZM160,51.31,188.69,80H160Zm-5.49,105.34L137.83,180l16.68,23.35a8,8,0,0,1-13,9.3L128,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L118.17,180l-16.68-23.35a8,8,0,1,1,13-9.3L128,166.24l13.49-18.89a8,8,0,0,1,13,9.3ZM92,152a8,8,0,0,1-8,8H72v48a8,8,0,0,1-16,0V160H44a8,8,0,0,1,0-16H84A8,8,0,0,1,92,152Zm128,0a8,8,0,0,1-8,8H200v48a8,8,0,0,1-16,0V160H172a8,8,0,0,1,0-16h40A8,8,0,0,1,220,152Z"},child:[]}]})(C)}function V(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M44,120H212a4,4,0,0,0,4-4V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v76A4,4,0,0,0,44,120ZM152,44l44,44H152Zm72,108.53a8.18,8.18,0,0,1-8.25,7.47H192v16h15.73a8.17,8.17,0,0,1,8.25,7.47,8,8,0,0,1-8,8.53H192v15.73a8.17,8.17,0,0,1-7.47,8.25,8,8,0,0,1-8.53-8V152a8,8,0,0,1,8-8h32A8,8,0,0,1,224,152.53ZM64,144H48a8,8,0,0,0-8,8v55.73A8.17,8.17,0,0,0,47.47,216,8,8,0,0,0,56,208v-8h7.4c15.24,0,28.14-11.92,28.59-27.15A28,28,0,0,0,64,144Zm-.35,40H56V160h8a12,12,0,0,1,12,13.16A12.25,12.25,0,0,1,63.65,184ZM128,144H112a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h15.32c19.66,0,36.21-15.48,36.67-35.13A36,36,0,0,0,128,144Zm-.49,56H120V160h8a20,20,0,0,1,20,20.77C147.58,191.59,138.34,200,127.51,200Z"},child:[]}]})(C)}function c(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M224,152a8,8,0,0,1-8,8H192v16h16a8,8,0,0,1,0,16H192v16a8,8,0,0,1-16,0V152a8,8,0,0,1,8-8h32A8,8,0,0,1,224,152ZM92,172a28,28,0,0,1-28,28H56v8a8,8,0,0,1-16,0V152a8,8,0,0,1,8-8H64A28,28,0,0,1,92,172Zm-16,0a12,12,0,0,0-12-12H56v24h8A12,12,0,0,0,76,172Zm88,8a36,36,0,0,1-36,36H112a8,8,0,0,1-8-8V152a8,8,0,0,1,8-8h16A36,36,0,0,1,164,180Zm-16,0a20,20,0,0,0-20-20h-8v40h8A20,20,0,0,0,148,180ZM40,112V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0ZM160,80h28.69L160,51.31Z"},child:[]}]})(C)}function o(C){return a.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M72.61,83.06a8,8,0,0,1,1.73-8.72l48-48a8,8,0,0,1,11.32,0l48,48A8,8,0,0,1,176,88H80A8,8,0,0,1,72.61,83.06ZM176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Z"},child:[]}]})(C)}exports.PiCaretUpDownFill=o;exports.PiFileCsv=e;exports.PiFileHtml=r;exports.PiFileJson=l;exports.PiFileLog=t;exports.PiFileMarkdown=i;exports.PiFilePdf=c;exports.PiFilePdfFill=V;exports.PiFileText=n;
@@ -1,4 +1,10 @@
1
1
  import { IconBaseProps } from '../generate-icon';
2
+ export declare function PiFileJson(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function PiFileLog(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function PiFileMarkdown(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function PiFileHtml(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function PiFileCsv(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function PiFileText(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
2
8
  export declare function PiFilePdfFill(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
3
9
  export declare function PiFilePdf(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
4
10
  export declare function PiCaretUpDownFill(props: IconBaseProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,91 @@
1
1
  "use client";
2
- import { GenIcon as t } from "../generate-icon.js";
3
- function r(a) {
4
- return t({
2
+ import { GenIcon as a } from "../generate-icon.js";
3
+ function l(C) {
4
+ return a({
5
+ attr: { viewBox: "0 0 256 256", fill: "currentColor" },
6
+ child: [
7
+ {
8
+ tag: "path",
9
+ attr: {
10
+ d: "M16 184.571C16.0001 180.153 19.5818 176.571 24 176.571C28.4182 176.571 31.9999 180.153 32 184.571C32 186.53 32.7811 188.416 34.1836 189.812C35.5873 191.209 37.4991 192 39.5 192C41.5009 192 43.4127 191.209 44.8164 189.812C46.2189 188.416 47 186.53 47 184.571V152C47 147.582 50.5817 144 55 144C59.4183 144 63 147.582 63 152V184.571C63 190.797 60.5147 196.761 56.1035 201.151C51.6936 205.541 45.7205 208 39.5 208C33.2795 208 27.3064 205.541 22.8965 201.151C18.4853 196.761 16 190.797 16 184.571ZM167 176C167 166.127 160.21 160 154 160C147.79 160 141 166.127 141 176C141 185.873 147.79 192 154 192C160.21 192 167 185.873 167 176ZM191 200V152C191 148.517 193.254 145.434 196.573 144.377C199.893 143.32 203.515 144.533 205.528 147.376L225 174.865V152C225 147.582 228.582 144 233 144C237.418 144 241 147.582 241 152V200C241 203.483 238.746 206.566 235.427 207.623C232.107 208.68 228.485 207.467 226.472 204.624L207 177.134V200C207 204.418 203.418 208 199 208C194.582 208 191 204.418 191 200ZM92.6406 144.059C96.5959 143.845 100.332 144.254 102.983 144.679C104.334 144.895 105.461 145.125 106.269 145.306C106.673 145.396 107.001 145.475 107.239 145.534C107.358 145.564 107.456 145.589 107.529 145.608C107.566 145.618 107.597 145.626 107.622 145.633C107.634 145.636 107.645 145.639 107.654 145.642C107.659 145.643 107.664 145.644 107.668 145.646L107.673 145.646C107.675 145.647 107.677 145.648 105.766 152.684L107.678 145.648C111.941 146.807 114.459 151.202 113.301 155.466C112.143 159.728 107.75 162.244 103.487 161.089L103.491 161.091C103.493 161.091 103.497 161.092 103.497 161.092C103.501 161.093 103.504 161.094 103.504 161.094C103.504 161.094 103.499 161.093 103.491 161.091C103.472 161.086 103.431 161.075 103.37 161.06C103.248 161.029 103.047 160.981 102.777 160.921C102.236 160.8 101.432 160.635 100.452 160.478C98.4442 160.156 95.9258 159.904 93.5039 160.035C90.9783 160.172 89.2855 160.688 88.3467 161.284C87.7783 161.645 87.224 162.131 87.0234 163.765C87.0073 163.896 87.0014 163.996 87 164.067C87.0933 164.153 87.2577 164.291 87.5352 164.469C89.2298 165.555 91.9117 166.376 96.3486 167.689C100.038 168.782 105.407 170.338 109.549 173.303C111.789 174.906 113.973 177.113 115.406 180.155C116.859 183.24 117.27 186.615 116.835 190.094V190.096C116.029 196.521 112.814 201.28 108.207 204.231C103.966 206.949 99.1332 207.77 95.2666 207.955C91.2998 208.145 87.5599 207.696 84.9102 207.241C83.5604 207.009 82.4329 206.765 81.626 206.574C81.2215 206.478 80.8937 206.396 80.6553 206.333C80.5362 206.302 80.439 206.275 80.3652 206.255C80.3285 206.245 80.2975 206.236 80.2725 206.229C80.2601 206.225 80.2487 206.222 80.2393 206.22C80.2345 206.218 80.2296 206.217 80.2256 206.216C80.2236 206.215 80.2197 206.214 80.2197 206.214C80.2188 206.207 80.2761 206 82.416 198.521L80.2148 206.213C75.9671 204.997 73.5091 200.568 74.7246 196.32C75.9385 192.078 80.3571 189.621 84.5996 190.825L84.6035 190.826C84.6061 190.827 84.6078 190.827 84.6104 190.828C84.6303 190.834 84.669 190.844 84.7256 190.859C84.8458 190.891 85.0453 190.942 85.3125 191.005C85.8492 191.132 86.6463 191.306 87.6182 191.473C89.612 191.815 92.1069 192.088 94.5029 191.974C96.9991 191.854 98.658 191.346 99.5752 190.759C100.126 190.406 100.736 189.884 100.959 188.104C101.02 187.615 101 187.318 100.979 187.171C100.96 187.033 100.935 186.981 100.931 186.972C100.924 186.959 100.899 186.907 100.812 186.809C100.718 186.702 100.542 186.532 100.235 186.312C98.6856 185.203 96.092 184.3 91.8057 183.031C88.2663 181.983 82.9575 180.539 78.9023 177.94C76.7008 176.53 74.406 174.516 72.8398 171.6C71.224 168.591 70.7209 165.249 71.1426 161.814C71.9294 155.406 75.1807 150.693 79.7656 147.779C83.9802 145.101 88.7888 144.267 92.6406 144.059ZM84.6084 190.827L84.6104 190.828L84.6064 190.827L84.6035 190.826L84.6084 190.827ZM40 112V40C40 35.7565 41.6859 31.6871 44.6865 28.6865C47.6871 25.6859 51.7565 24 56 24H152C154.122 24 156.157 24.8425 157.657 26.3428L213.657 82.3428C215.158 83.8431 216 85.8783 216 88V112C216 116.418 212.418 120 208 120C203.582 120 200 116.418 200 112V96H152C147.582 96 144 92.4183 144 88V40H56V112C56 116.418 52.4183 120 48 120C43.5817 120 40 116.418 40 112ZM160 80H188.686L160 51.3145V80ZM183 176C183 192.636 170.986 208 154 208C137.014 208 125 192.636 125 176C125 159.364 137.014 144 154 144C170.986 144 183 159.364 183 176Z"
11
+ },
12
+ child: []
13
+ }
14
+ ]
15
+ })(C);
16
+ }
17
+ function r(C) {
18
+ return a({
19
+ attr: { viewBox: "0 0 256 256", fill: "currentColor" },
20
+ child: [
21
+ {
22
+ tag: "path",
23
+ attr: {
24
+ d: "M44 152C44 147.582 47.5817 144 52 144C56.4183 144 60 147.582 60 152V200H80C84.4183 200 88 203.582 88 208C88 212.418 84.4183 216 80 216H52C47.5817 216 44 212.418 44 208V152ZM144 180C144 167.753 135.724 160 128 160C120.276 160 112 167.753 112 180C112 192.247 120.276 200 128 200C135.724 200 144 192.247 144 180ZM216 176C220.418 176 224 179.582 224 184V200.87C224 202.879 223.244 204.814 221.883 206.291C219.104 209.307 215.738 211.724 211.992 213.394C208.247 215.062 204.199 215.95 200.096 215.999C200.064 215.999 200.032 216 200 216C181.219 216 168 198.677 168 180C168 161.323 181.219 144 200 144C200.008 144 200.016 144 200.024 144C205.921 144.018 211.677 145.817 216.535 149.16C220.175 151.665 221.095 156.645 218.59 160.285C216.085 163.925 211.105 164.845 207.465 162.34C205.264 160.825 202.657 160.01 199.985 160C192.27 160.01 184 167.765 184 180C184 192.223 192.253 199.974 199.962 199.999C201.863 199.969 203.74 199.554 205.479 198.778C206.37 198.382 207.214 197.894 208 197.326V192C203.582 192 200 188.418 200 184C200 179.582 203.582 176 208 176H216ZM40 112V40C40 35.7565 41.6862 31.687 44.6865 28.6865C47.687 25.6862 51.7565 24 56 24H152C154.122 24 156.157 24.8425 157.657 26.3428L213.657 82.3428C215.158 83.8431 216 85.8783 216 88V112C216 116.418 212.418 120 208 120C203.582 120 200 116.418 200 112V96H152C147.582 96 144 92.4183 144 88V40H56V112C56 116.418 52.4183 120 48 120C43.5817 120 40 116.418 40 112ZM160 80H188.686L160 51.3145V80ZM160 180C160 198.681 146.786 216 128 216C109.214 216 96 198.681 96 180C96 161.319 109.214 144 128 144C146.786 144 160 161.319 160 180Z"
25
+ },
26
+ child: []
27
+ }
28
+ ]
29
+ })(C);
30
+ }
31
+ function i(C) {
32
+ return a({
33
+ attr: { viewBox: "0 0 256 256", fill: "currentColor" },
34
+ child: [
35
+ {
36
+ tag: "path",
37
+ attr: {
38
+ d: "M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48V224a8,8,0,0,0,16,0V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM144,144H128a8,8,0,0,0-8,8v56a8,8,0,0,0,8,8h16a36,36,0,0,0,0-72Zm0,56h-8V160h8a20,20,0,0,1,0,40Zm-40-48v56a8,8,0,0,1-16,0V177.38L74.55,196.59a8,8,0,0,1-13.1,0L48,177.38V208a8,8,0,0,1-16,0V152a8,8,0,0,1,14.55-4.59L68,178.05l21.45-30.64A8,8,0,0,1,104,152Z"
39
+ },
40
+ child: []
41
+ }
42
+ ]
43
+ })(C);
44
+ }
45
+ function V(C) {
46
+ return a({
47
+ attr: { viewBox: "0 0 256 256", fill: "currentColor" },
48
+ child: [
49
+ {
50
+ tag: "path",
51
+ attr: {
52
+ d: "M216,120V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v80a8,8,0,0,0,16,0V40h88V88a8,8,0,0,0,8,8h48v24a8,8,0,0,0,16,0ZM160,51.31,188.69,80H160ZM68,160v48a8,8,0,0,1-16,0V192H32v16a8,8,0,0,1-16,0V160a8,8,0,0,1,16,0v16H52V160a8,8,0,0,1,16,0Zm56,0a8,8,0,0,1-8,8h-8v40a8,8,0,0,1-16,0V168H84a8,8,0,0,1,0-16h32A8,8,0,0,1,124,160Zm72,0v48a8,8,0,0,1-16,0V184l-9.6,12.8a8,8,0,0,1-12.8,0L148,184v24a8,8,0,0,1-16,0V160a8,8,0,0,1,14.4-4.8L164,178.67l17.6-23.47A8,8,0,0,1,196,160Zm56,48a8,8,0,0,1-8,8H216a8,8,0,0,1-8-8V160a8,8,0,0,1,16,0v40h20A8,8,0,0,1,252,208Z"
53
+ },
54
+ child: []
55
+ }
56
+ ]
57
+ })(C);
58
+ }
59
+ function h(C) {
60
+ return a({
61
+ attr: { viewBox: "0 0 256 256", fill: "currentColor" },
62
+ child: [
63
+ {
64
+ tag: "path",
65
+ attr: {
66
+ d: "M48,180c0,11,7.18,20,16,20a14.24,14.24,0,0,0,10.22-4.66A8,8,0,0,1,85.78,206.4,30.06,30.06,0,0,1,64,216c-17.65,0-32-16.15-32-36s14.35-36,32-36a30.06,30.06,0,0,1,21.78,9.6,8,8,0,0,1-11.56,11.06A14.24,14.24,0,0,0,64,160C55.18,160,48,169,48,180Zm79.6-8.69c-4-1.16-8.14-2.35-10.45-3.84-1.25-.81-1.23-1-1.12-1.9a4.57,4.57,0,0,1,2-3.67c4.6-3.12,15.34-1.73,19.82-.56A8,8,0,0,0,142,145.86c-2.12-.55-21-5.22-32.84,2.76a20.58,20.58,0,0,0-9,14.95c-2,15.88,13.65,20.41,23,23.11,12.06,3.49,13.12,4.92,12.78,7.59-.31,2.41-1.26,3.34-2.14,3.93-4.6,3.06-15.17,1.56-19.55.36A8,8,0,0,0,109.94,214a61.34,61.34,0,0,0,15.19,2c5.82,0,12.3-1,17.49-4.46a20.82,20.82,0,0,0,9.19-15.23C154,179,137.49,174.17,127.6,171.31Zm83.09-26.84a8,8,0,0,0-10.23,4.84L188,184.21l-12.47-34.9a8,8,0,0,0-15.07,5.38l20,56a8,8,0,0,0,15.07,0l20-56A8,8,0,0,0,210.69,144.47ZM216,88v24a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H56v72a8,8,0,0,1-16,0V40A16,16,0,0,1,56,24h96a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-27.31-8L160,51.31V80Z"
67
+ },
68
+ child: []
69
+ }
70
+ ]
71
+ })(C);
72
+ }
73
+ function Z(C) {
74
+ return a({
75
+ attr: { viewBox: "0 0 256 256", fill: "currentColor" },
76
+ child: [
77
+ {
78
+ tag: "path",
79
+ attr: {
80
+ d: "M48,120a8,8,0,0,0,8-8V40h88V88a8,8,0,0,0,8,8h48v16a8,8,0,0,0,16,0V88a8,8,0,0,0-2.34-5.66l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40v72A8,8,0,0,0,48,120ZM160,51.31,188.69,80H160Zm-5.49,105.34L137.83,180l16.68,23.35a8,8,0,0,1-13,9.3L128,193.76l-13.49,18.89a8,8,0,1,1-13-9.3L118.17,180l-16.68-23.35a8,8,0,1,1,13-9.3L128,166.24l13.49-18.89a8,8,0,0,1,13,9.3ZM92,152a8,8,0,0,1-8,8H72v48a8,8,0,0,1-16,0V160H44a8,8,0,0,1,0-16H84A8,8,0,0,1,92,152Zm128,0a8,8,0,0,1-8,8H200v48a8,8,0,0,1-16,0V160H172a8,8,0,0,1,0-16h40A8,8,0,0,1,220,152Z"
81
+ },
82
+ child: []
83
+ }
84
+ ]
85
+ })(C);
86
+ }
87
+ function H(C) {
88
+ return a({
5
89
  attr: { viewBox: "0 0 256 256", fill: "currentColor" },
6
90
  child: [
7
91
  {
@@ -12,10 +96,10 @@ function r(a) {
12
96
  child: []
13
97
  }
14
98
  ]
15
- })(a);
99
+ })(C);
16
100
  }
17
- function i(a) {
18
- return t({
101
+ function c(C) {
102
+ return a({
19
103
  attr: { viewBox: "0 0 256 256", fill: "currentColor" },
20
104
  child: [
21
105
  {
@@ -26,10 +110,10 @@ function i(a) {
26
110
  child: []
27
111
  }
28
112
  ]
29
- })(a);
113
+ })(C);
30
114
  }
31
- function h(a) {
32
- return t({
115
+ function o(C) {
116
+ return a({
33
117
  attr: { viewBox: "0 0 256 256", fill: "currentColor" },
34
118
  child: [
35
119
  {
@@ -40,10 +124,16 @@ function h(a) {
40
124
  child: []
41
125
  }
42
126
  ]
43
- })(a);
127
+ })(C);
44
128
  }
45
129
  export {
46
- h as PiCaretUpDownFill,
47
- i as PiFilePdf,
48
- r as PiFilePdfFill
130
+ o as PiCaretUpDownFill,
131
+ h as PiFileCsv,
132
+ V as PiFileHtml,
133
+ l as PiFileJson,
134
+ r as PiFileLog,
135
+ i as PiFileMarkdown,
136
+ c as PiFilePdf,
137
+ H as PiFilePdfFill,
138
+ Z as PiFileText
49
139
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={search:"IoSearch",thumbsUp:"LuThumbsUp",thumbsDown:"LuThumbsDown",messageCopy:"LuCopy",messageCopied:"LuCheck",messageRevise:"FiEdit",codeCopy:"LuCopy",codeCopied:"LuCheck",openLinkInNewTab:"LuArrowUpRight",openLinkInSameTab:"LuCornerDownLeft",newLine:"LuCornerDownRight",breadcrumbSeparator:"FaChevronRight",switchToSearch:"IoSearch",switchToChat:"LuSparkles",chatSubmit:"LuSend",close:"IoCloseOutline",info:"IoInformationCircleOutline",command:"LuCommand",chatButtonClose:"LuChevronDown",chatHistory:"LuHistory",chatHistoryPanel:"LuPanelLeft",backToChat:"LuArrowLeft"};exports.defaultBuiltInIcons=e;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={search:"IoSearch",thumbsUp:"LuThumbsUp",thumbsDown:"LuThumbsDown",messageCopy:"LuCopy",messageCopied:"LuCheck",messageRevise:"FiEdit",codeCopy:"LuCopy",codeCopied:"LuCheck",openLinkInNewTab:"LuArrowUpRight",openLinkInSameTab:"LuCornerDownLeft",newLine:"LuCornerDownRight",breadcrumbSeparator:"FaChevronRight",switchToSearch:"IoSearch",switchToChat:"LuSparkles",chatSubmit:"LuSend",close:"IoCloseOutline",info:"IoInformationCircleOutline",command:"LuCommand",chatButtonClose:"LuChevronDown",chatHistory:"LuHistory",chatHistoryPanel:"LuPanelLeft",backToChat:"LuArrowLeft",fileUpload:"LuPaperclip",filePdf:"FaRegFilePdf",fileText:"PiFileText",fileMarkdown:"PiFileMarkdown",fileHtml:"PiFileHtml",fileCsv:"PiFileCsv",fileLog:"PiFileLog",fileJson:"PiFileJson"};exports.defaultBuiltInIcons=e;
@@ -21,7 +21,15 @@ const e = {
21
21
  chatButtonClose: "LuChevronDown",
22
22
  chatHistory: "LuHistory",
23
23
  chatHistoryPanel: "LuPanelLeft",
24
- backToChat: "LuArrowLeft"
24
+ backToChat: "LuArrowLeft",
25
+ fileUpload: "LuPaperclip",
26
+ filePdf: "FaRegFilePdf",
27
+ fileText: "PiFileText",
28
+ fileMarkdown: "PiFileMarkdown",
29
+ fileHtml: "PiFileHtml",
30
+ fileCsv: "PiFileCsv",
31
+ fileLog: "PiFileLog",
32
+ fileJson: "PiFileJson"
25
33
  };
26
34
  export {
27
35
  e as defaultBuiltInIcons
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),d=require("react"),E=require("../../atoms/icons/custom-icon.cjs"),g=require("../../providers/image-preview-provider.cjs"),k=require("../../providers/message-provider.cjs"),u=require("./chat-provider.cjs"),l=require("../../atoms/file-upload.cjs"),_=require("../../utils/misc.cjs"),c=require("../../utils/compose-event-handlers.cjs"),a=require("../factory.cjs"),M=require("../../providers/config-provider.cjs"),x={"application/pdf":"filePdf","text/plain":"fileText","text/markdown":"fileMarkdown","text/html":"fileHtml","text/csv":"fileCsv","text/x-log":"fileLog","application/json":"fileJson"};function F(e){return e.startsWith("image/")}const p={"image/png":[".png"],"image/jpeg":[".jpg",".jpeg"],"image/webp":[".webp"],"application/pdf":[".pdf"],"text/plain":[".txt"],"text/markdown":[".md"],"text/html":[".html"],"text/csv":[".csv"],"text/x-log":[".log"],"application/json":[".json"]},j=new Set(Object.keys(p)),T=Object.values(p).flat().join(", "),P=10,f=1024*1024*10,L=Object.entries(p).reduce((e,[i,t])=>{for(const n of t)e[n]=i;return e},{});function N(e){if(e.type)return e;const i=`.${e.name.split(".").pop()?.toLowerCase()}`,t=L[i];return t?new File([e],e.name,{type:t}):e}function w(e){if(!e.length)return null;const i=t=>e.some(n=>n.errors.includes(t));return i("TOO_MANY_FILES")?{title:"Attachment limit reached",message:`You can only attach up to ${P} files per message.`}:i("FILE_INVALID_TYPE")?{title:"Unsupported file type",message:`Only ${T} files are supported.`}:i("FILE_TOO_LARGE")?{title:"File too large",message:`Files must be smaller than ${f/1024/1024}MB.`}:i("FILE_EXISTS")?{title:"File already exists",message:`The file "${e.find(n=>n.errors.includes("FILE_EXISTS"))?.file.name??"file"}" is already attached to this message.`}:{title:"File rejected",message:"This file could not be added."}}const y=a.ikp("div",{_id:"aiChatMessage__Files"}),A=({children:e,...i})=>{const{message:t}=k.useMessage();if(t.role!=="user")return null;const n=(t.parts??[]).filter(s=>{if(s.type!=="file")return!1;const r=s.mediaType;return j.has(r??"")});return n.length?o.jsx(y,{...i,children:e(n)}):null},S=a.ikp("button",{_id:"aiChatMessage__File"}),U=({url:e,name:i,mediaType:t,onClick:n,...s})=>{const{openImagePreview:r}=g.useImagePreview(),[m,v]=d.useState(!0),h=d.useMemo(()=>new File([],i??"file",{type:t}),[i,t]);return o.jsx(b.Provider,{value:{file:h,objectUrl:e,isLoading:m,setIsLoading:v,onRemove:()=>{}},children:o.jsx(S,{type:"button","aria-label":F(t??"")?`Preview ${i??"file"}`:`Open ${i??"file"} in new tab`,"data-loading":_.dataAttr(m),onClick:c.composeEventHandlers(n,()=>{if(F(t??""))r({url:e,name:i??"file"});else if(e)if(e.startsWith("data:")){const I=document.createElement("a");I.href=e,I.download=i??"file",I.click()}else window.open(e,"_blank","noopener,noreferrer")}),...s})})},R=a.ikp("div",{_id:"aiChatInput__Fieldset"}),O=e=>{const i=l.useFileUploadApi();return o.jsx(R,{...i.getDropzoneProps({disableClick:!0}),"data-drag-over":_.dataAttr(i.dragging),...e})},D=({...e})=>{const{files:i,setFiles:t,showInputNotification:n}=u.useChat();return o.jsx(l.FileUploadRoot,{accept:p,maxFiles:P,maxFileSize:f,preventDocumentDrop:!0,acceptedFiles:i,onFileAccept:s=>t(s.files),onFileReject:s=>{const r=w(s.files);r&&n(r)},children:o.jsx(O,{...e})})},H=a.ikp("div",{_id:"aiChatInput__DropZone"}),q=a.ikp("div",{_id:"aiChatInput__Notification"}),X=e=>{const{inputNotification:i}=u.useChat();return i?o.jsx(q,{role:"alert",...e}):null},B=a.ikp("p",{_id:"aiChatInput__NotificationTitle"}),$=e=>{const{inputNotification:i}=u.useChat();return i?.title?o.jsx(B,{...e,children:i.title}):null},Y=a.ikp("p",{_id:"aiChatInput__NotificationMessage"}),Z=e=>{const{inputNotification:i}=u.useChat();return o.jsx(Y,{...e,children:i?.message})},z=a.ikp("button",{_id:"aiChatInput__NotificationClose"}),K=({onClick:e,...i})=>{const{clearInputNotification:t}=u.useChat();return o.jsx(z,{type:"button","aria-label":"Dismiss",onClick:c.composeEventHandlers(e,t),...i})},V=a.ikp("div",{_id:"aiChatInput__NotificationContent"}),W=a.ikp("div",{_id:"aiChatInput__NotificationHeader"}),G=a.ikp(E.CustomIcon,{_id:"aiChatInput__FileUploadButtonIcon",iconKey:"fileUpload"}),J=a.ikp("button",{_id:"aiChatInput__FileUploadButton"}),Q=e=>{const{aiChatSettings:i}=M.useInkeepConfig(),t=l.useFileUploadApi(),{onClick:n,...s}=e;return o.jsx(J,{type:"button","aria-label":"Upload file",disabled:i.isViewOnly,onClick:c.composeEventHandlers(n,()=>t.openFilePicker()),...s})},ee=a.ikp("input",{_id:"aiChatInput__FileInput"}),ie=e=>{const i=l.useFileUploadApi();return o.jsx(ee,{...e,...i.getHiddenInputProps()})},te=a.ikp("div",{_id:"aiChatInput__FileList"}),ne=({children:e,...i})=>{const n=l.useFileUploadApi().acceptedFiles;return n.length?o.jsx(te,{...i,children:e(n)}):null},b=d.createContext(null);function C(){const e=d.useContext(b);if(!e)throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");return e}const oe=a.ikp("div",{_id:"aiChatInput__FileItem"}),ae=({file:e,...i})=>{const t=l.useFileUploadApi(),[n,s]=d.useState(void 0),[r,m]=d.useState(!0);d.useEffect(()=>t.createFileUrl(e,h=>{s(h),m(!0)}),[e]);const v=()=>t.deleteFile(e);return o.jsx(b.Provider,{value:{file:e,objectUrl:n,isLoading:r,setIsLoading:m,onRemove:v},children:o.jsx(oe,{"data-loading":_.dataAttr(r),...i})})},se=a.ikp("button",{_id:"aiChatInput__FilePreviewTrigger"}),re=({onClick:e,...i})=>{const{objectUrl:t,file:n}=C(),{openImagePreview:s}=g.useImagePreview();return o.jsx(se,{type:"button","aria-label":`Preview ${n.name}`,disabled:!t,onClick:c.composeEventHandlers(e,()=>{t&&s({url:t,name:n.name})}),...i})},de=a.ikp("span",{_id:"aiChatInput__FileContent"}),le=e=>o.jsx(de,{...e}),ce=a.ikp("img",{_id:"aiChatInput__FileThumbnail"}),me=({onLoad:e,...i})=>{const{objectUrl:t,file:n,setIsLoading:s}=C();return o.jsx(ce,{src:t,alt:n.name,onLoad:c.composeEventHandlers(e,()=>s(!1)),...i})},ue=({className:e})=>{const{file:i}=C(),t=x[N(i).type]??"fileText";return o.jsx(E.CustomIcon,{iconKey:t,className:e})},pe=a.ikp("span",{_id:"aiChatInput__FileName"}),Ce=e=>{const{file:i}=C();return o.jsx(pe,{...e,children:i.name})},ve=a.ikp("button",{_id:"aiChatInput__FileRemove"}),he=a.ikp(E.CustomIcon,{_id:"aiChatInput__FileRemoveIcon",iconKey:"close"}),Ie=({onClick:e,...i})=>{const{onRemove:t}=C();return o.jsx(ve,{type:"button","aria-label":"Remove file",onClick:c.composeEventHandlers(e,t),...i})};exports.ACCEPTED_FILE_EXTENSIONS=T;exports.ACCEPTED_FILE_MIME_TYPES=j;exports.EmbeddedChatPrimitiveDropZone=H;exports.EmbeddedChatPrimitiveFileContent=le;exports.EmbeddedChatPrimitiveFileInput=ie;exports.EmbeddedChatPrimitiveFileItem=ae;exports.EmbeddedChatPrimitiveFileList=ne;exports.EmbeddedChatPrimitiveFileName=Ce;exports.EmbeddedChatPrimitiveFilePreviewTrigger=re;exports.EmbeddedChatPrimitiveFileRemove=Ie;exports.EmbeddedChatPrimitiveFileRemoveIcon=he;exports.EmbeddedChatPrimitiveFileThumbnail=me;exports.EmbeddedChatPrimitiveFileTypeIcon=ue;exports.EmbeddedChatPrimitiveFileUploadButton=Q;exports.EmbeddedChatPrimitiveFileUploadButtonIcon=G;exports.EmbeddedChatPrimitiveInputFieldset=D;exports.EmbeddedChatPrimitiveInputNotification=X;exports.EmbeddedChatPrimitiveInputNotificationClose=K;exports.EmbeddedChatPrimitiveInputNotificationContent=V;exports.EmbeddedChatPrimitiveInputNotificationHeader=W;exports.EmbeddedChatPrimitiveInputNotificationMessage=Z;exports.EmbeddedChatPrimitiveInputNotificationTitle=$;exports.EmbeddedChatPrimitiveMessageFile=U;exports.EmbeddedChatPrimitiveMessageFiles=A;exports.FILE_ACCEPT_MAP=p;exports.FILE_TYPE_ICON_MAP=x;exports.MAX_FILES=P;exports.MAX_FILE_SIZE=f;exports.isImageMimeType=F;exports.normalizeFileType=N;
@@ -0,0 +1,68 @@
1
+ import { default as React, ComponentPropsWithRef, ReactNode } from 'react';
2
+ import { CustomIcons } from '../../../types/index.ts';
3
+ import { FileUIPart } from 'ai';
4
+ import { PolymorphicProps } from '..';
5
+ import { CustomIconProps } from '../..';
6
+ export declare const FILE_TYPE_ICON_MAP: Partial<Record<keyof typeof FILE_ACCEPT_MAP, keyof CustomIcons>>;
7
+ export declare function isImageMimeType(mimeType: string): boolean;
8
+ export declare const FILE_ACCEPT_MAP: Record<string, string[]>;
9
+ export declare const ACCEPTED_FILE_MIME_TYPES: Set<string>;
10
+ export declare const ACCEPTED_FILE_EXTENSIONS: string;
11
+ export declare const MAX_FILES = 10;
12
+ export declare const MAX_FILE_SIZE: number;
13
+ export declare function normalizeFileType(file: File): File;
14
+ declare const PrimitiveMessageFiles: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
15
+ interface MessageFilesProps extends Omit<ComponentPropsWithRef<typeof PrimitiveMessageFiles>, 'children'> {
16
+ children: (parts: FileUIPart[]) => ReactNode;
17
+ }
18
+ export declare const EmbeddedChatPrimitiveMessageFiles: ({ children, ...props }: MessageFilesProps) => import("react/jsx-runtime").JSX.Element | null;
19
+ declare const PrimitiveMessageFile: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
20
+ interface MessageFileProps extends ComponentPropsWithRef<typeof PrimitiveMessageFile> {
21
+ url: string;
22
+ name?: string;
23
+ mediaType?: string;
24
+ }
25
+ export declare const EmbeddedChatPrimitiveMessageFile: ({ url, name, mediaType, onClick, ...props }: MessageFileProps) => import("react/jsx-runtime").JSX.Element;
26
+ declare const PrimitiveInputFieldset: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
27
+ export declare const EmbeddedChatPrimitiveInputFieldset: ({ ...props }: ComponentPropsWithRef<typeof PrimitiveInputFieldset>) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const EmbeddedChatPrimitiveDropZone: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
29
+ declare const PrimitiveInputNotification: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
30
+ export declare const EmbeddedChatPrimitiveInputNotification: (props: ComponentPropsWithRef<typeof PrimitiveInputNotification>) => import("react/jsx-runtime").JSX.Element | null;
31
+ declare const PrimitiveInputNotificationTitle: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "_id">>>;
32
+ export declare const EmbeddedChatPrimitiveInputNotificationTitle: (props: ComponentPropsWithRef<typeof PrimitiveInputNotificationTitle>) => import("react/jsx-runtime").JSX.Element | null;
33
+ declare const PrimitiveInputNotificationMessage: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "_id">>>;
34
+ export declare const EmbeddedChatPrimitiveInputNotificationMessage: (props: ComponentPropsWithRef<typeof PrimitiveInputNotificationMessage>) => import("react/jsx-runtime").JSX.Element;
35
+ declare const PrimitiveInputNotificationClose: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
36
+ export declare const EmbeddedChatPrimitiveInputNotificationClose: ({ onClick, ...props }: ComponentPropsWithRef<typeof PrimitiveInputNotificationClose>) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const EmbeddedChatPrimitiveInputNotificationContent: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
38
+ export declare const EmbeddedChatPrimitiveInputNotificationHeader: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
39
+ export declare const EmbeddedChatPrimitiveFileUploadButtonIcon: React.ForwardRefExoticComponent< PolymorphicProps & Omit< CustomIconProps, "_id" | "iconKey"> & Partial<Pick< CustomIconProps, "_id" | "iconKey">>>;
40
+ declare const FileUploadButton: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
41
+ export declare const EmbeddedChatPrimitiveFileUploadButton: (props: ComponentPropsWithRef<typeof FileUploadButton>) => import("react/jsx-runtime").JSX.Element;
42
+ declare const PrimitiveFileInput: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "_id">>>;
43
+ export declare const EmbeddedChatPrimitiveFileInput: (props: ComponentPropsWithRef<typeof PrimitiveFileInput>) => import("react/jsx-runtime").JSX.Element;
44
+ declare const PrimitiveFileList: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
45
+ interface FileListProps extends Omit<ComponentPropsWithRef<typeof PrimitiveFileList>, 'children'> {
46
+ children: (files: File[]) => ReactNode;
47
+ }
48
+ export declare const EmbeddedChatPrimitiveFileList: ({ children, ...props }: FileListProps) => import("react/jsx-runtime").JSX.Element | null;
49
+ declare const PrimitiveFileItem: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
50
+ interface FileItemProps extends ComponentPropsWithRef<typeof PrimitiveFileItem> {
51
+ file: File;
52
+ }
53
+ export declare const EmbeddedChatPrimitiveFileItem: ({ file, ...props }: FileItemProps) => import("react/jsx-runtime").JSX.Element;
54
+ declare const PrimitiveFilePreviewTrigger: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
55
+ export declare const EmbeddedChatPrimitiveFilePreviewTrigger: ({ onClick, ...props }: ComponentPropsWithRef<typeof PrimitiveFilePreviewTrigger>) => import("react/jsx-runtime").JSX.Element;
56
+ declare const PrimitiveFileContent: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
57
+ export declare const EmbeddedChatPrimitiveFileContent: (props: ComponentPropsWithRef<typeof PrimitiveFileContent>) => import("react/jsx-runtime").JSX.Element;
58
+ declare const PrimitiveFileThumbnail: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "_id">>>;
59
+ export declare const EmbeddedChatPrimitiveFileThumbnail: ({ onLoad, ...props }: ComponentPropsWithRef<typeof PrimitiveFileThumbnail>) => import("react/jsx-runtime").JSX.Element;
60
+ export declare const EmbeddedChatPrimitiveFileTypeIcon: ({ className }: {
61
+ className?: string;
62
+ }) => import("react/jsx-runtime").JSX.Element;
63
+ declare const PrimitiveFileName: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
64
+ export declare const EmbeddedChatPrimitiveFileName: (props: ComponentPropsWithRef<typeof PrimitiveFileName>) => import("react/jsx-runtime").JSX.Element;
65
+ declare const PrimitiveFileRemove: React.ForwardRefExoticComponent< PolymorphicProps & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id"> & Partial<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "_id">>>;
66
+ export declare const EmbeddedChatPrimitiveFileRemoveIcon: React.ForwardRefExoticComponent< PolymorphicProps & Omit< CustomIconProps, "_id" | "iconKey"> & Partial<Pick< CustomIconProps, "_id" | "iconKey">>>;
67
+ export declare const EmbeddedChatPrimitiveFileRemove: ({ onClick, ...props }: ComponentPropsWithRef<typeof PrimitiveFileRemove>) => import("react/jsx-runtime").JSX.Element;
68
+ export {};
@@ -0,0 +1,328 @@
1
+ "use client";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import P, { useState as C, useMemo as x, useEffect as T } from "react";
4
+ import { CustomIcon as F } from "../../atoms/icons/custom-icon.js";
5
+ import { useImagePreview as b } from "../../providers/image-preview-provider.js";
6
+ import { useMessage as w } from "../../providers/message-provider.js";
7
+ import { useChat as d } from "./chat-provider.js";
8
+ import { FileUploadRoot as L, useFileUploadApi as m } from "../../atoms/file-upload.js";
9
+ import { dataAttr as I } from "../../utils/misc.js";
10
+ import { composeEventHandlers as l } from "../../utils/compose-event-handlers.js";
11
+ import { ikp as a } from "../factory.js";
12
+ import { useInkeepConfig as M } from "../../providers/config-provider.js";
13
+ const y = {
14
+ "application/pdf": "filePdf",
15
+ "text/plain": "fileText",
16
+ "text/markdown": "fileMarkdown",
17
+ "text/html": "fileHtml",
18
+ "text/csv": "fileCsv",
19
+ "text/x-log": "fileLog",
20
+ "application/json": "fileJson"
21
+ };
22
+ function g(e) {
23
+ return e.startsWith("image/");
24
+ }
25
+ const p = {
26
+ "image/png": [".png"],
27
+ "image/jpeg": [".jpg", ".jpeg"],
28
+ "image/webp": [".webp"],
29
+ "application/pdf": [".pdf"],
30
+ "text/plain": [".txt"],
31
+ "text/markdown": [".md"],
32
+ "text/html": [".html"],
33
+ "text/csv": [".csv"],
34
+ "text/x-log": [".log"],
35
+ "application/json": [".json"]
36
+ }, j = new Set(Object.keys(p)), k = Object.values(p).flat().join(", "), E = 10, N = 1024 * 1024 * 10, U = Object.entries(p).reduce(
37
+ (e, [t, i]) => {
38
+ for (const n of i) e[n] = t;
39
+ return e;
40
+ },
41
+ {}
42
+ );
43
+ function R(e) {
44
+ if (e.type) return e;
45
+ const t = `.${e.name.split(".").pop()?.toLowerCase()}`, i = U[t];
46
+ return i ? new File([e], e.name, { type: i }) : e;
47
+ }
48
+ function A(e) {
49
+ if (!e.length) return null;
50
+ const t = (i) => e.some((n) => n.errors.includes(i));
51
+ return t("TOO_MANY_FILES") ? {
52
+ title: "Attachment limit reached",
53
+ message: `You can only attach up to ${E} files per message.`
54
+ } : t("FILE_INVALID_TYPE") ? {
55
+ title: "Unsupported file type",
56
+ message: `Only ${k} files are supported.`
57
+ } : t("FILE_TOO_LARGE") ? {
58
+ title: "File too large",
59
+ message: `Files must be smaller than ${N / 1024 / 1024}MB.`
60
+ } : t("FILE_EXISTS") ? {
61
+ title: "File already exists",
62
+ message: `The file "${e.find((n) => n.errors.includes("FILE_EXISTS"))?.file.name ?? "file"}" is already attached to this message.`
63
+ } : {
64
+ title: "File rejected",
65
+ message: "This file could not be added."
66
+ };
67
+ }
68
+ const O = a("div", {
69
+ _id: "aiChatMessage__Files"
70
+ }), me = ({
71
+ children: e,
72
+ ...t
73
+ }) => {
74
+ const { message: i } = w();
75
+ if (i.role !== "user") return null;
76
+ const n = (i.parts ?? []).filter((r) => {
77
+ if (r.type !== "file") return !1;
78
+ const s = r.mediaType;
79
+ return j.has(s ?? "");
80
+ });
81
+ return n.length ? /* @__PURE__ */ o(O, { ...t, children: e(n) }) : null;
82
+ }, S = a("button", {
83
+ _id: "aiChatMessage__File"
84
+ }), ue = ({
85
+ url: e,
86
+ name: t,
87
+ mediaType: i,
88
+ onClick: n,
89
+ ...r
90
+ }) => {
91
+ const { openImagePreview: s } = b(), [c, f] = C(!0), _ = x(() => new File([], t ?? "file", { type: i }), [t, i]);
92
+ return /* @__PURE__ */ o(
93
+ v.Provider,
94
+ {
95
+ value: { file: _, objectUrl: e, isLoading: c, setIsLoading: f, onRemove: () => {
96
+ } },
97
+ children: /* @__PURE__ */ o(
98
+ S,
99
+ {
100
+ type: "button",
101
+ "aria-label": g(i ?? "") ? `Preview ${t ?? "file"}` : `Open ${t ?? "file"} in new tab`,
102
+ "data-loading": I(c),
103
+ onClick: l(n, () => {
104
+ if (g(i ?? ""))
105
+ s({ url: e, name: t ?? "file" });
106
+ else if (e)
107
+ if (e.startsWith("data:")) {
108
+ const h = document.createElement("a");
109
+ h.href = e, h.download = t ?? "file", h.click();
110
+ } else
111
+ window.open(e, "_blank", "noopener,noreferrer");
112
+ }),
113
+ ...r
114
+ }
115
+ )
116
+ }
117
+ );
118
+ }, D = a("div", {
119
+ _id: "aiChatInput__Fieldset"
120
+ }), $ = (e) => {
121
+ const t = m();
122
+ return /* @__PURE__ */ o(
123
+ D,
124
+ {
125
+ ...t.getDropzoneProps({ disableClick: !0 }),
126
+ "data-drag-over": I(t.dragging),
127
+ ...e
128
+ }
129
+ );
130
+ }, pe = ({
131
+ ...e
132
+ }) => {
133
+ const { files: t, setFiles: i, showInputNotification: n } = d();
134
+ return /* @__PURE__ */ o(
135
+ L,
136
+ {
137
+ accept: p,
138
+ maxFiles: E,
139
+ maxFileSize: N,
140
+ preventDocumentDrop: !0,
141
+ acceptedFiles: t,
142
+ onFileAccept: (r) => i(r.files),
143
+ onFileReject: (r) => {
144
+ const s = A(r.files);
145
+ s && n(s);
146
+ },
147
+ children: /* @__PURE__ */ o($, { ...e })
148
+ }
149
+ );
150
+ }, fe = a("div", {
151
+ _id: "aiChatInput__DropZone"
152
+ }), B = a("div", {
153
+ _id: "aiChatInput__Notification"
154
+ }), _e = (e) => {
155
+ const { inputNotification: t } = d();
156
+ return t ? /* @__PURE__ */ o(B, { role: "alert", ...e }) : null;
157
+ }, X = a("p", {
158
+ _id: "aiChatInput__NotificationTitle"
159
+ }), he = (e) => {
160
+ const { inputNotification: t } = d();
161
+ return t?.title ? /* @__PURE__ */ o(X, { ...e, children: t.title }) : null;
162
+ }, H = a("p", {
163
+ _id: "aiChatInput__NotificationMessage"
164
+ }), Ce = (e) => {
165
+ const { inputNotification: t } = d();
166
+ return /* @__PURE__ */ o(H, { ...e, children: t?.message });
167
+ }, Y = a("button", {
168
+ _id: "aiChatInput__NotificationClose"
169
+ }), Fe = ({
170
+ onClick: e,
171
+ ...t
172
+ }) => {
173
+ const { clearInputNotification: i } = d();
174
+ return /* @__PURE__ */ o(
175
+ Y,
176
+ {
177
+ type: "button",
178
+ "aria-label": "Dismiss",
179
+ onClick: l(e, i),
180
+ ...t
181
+ }
182
+ );
183
+ }, Ie = a("div", {
184
+ _id: "aiChatInput__NotificationContent"
185
+ }), ve = a("div", {
186
+ _id: "aiChatInput__NotificationHeader"
187
+ }), ge = a(F, {
188
+ _id: "aiChatInput__FileUploadButtonIcon",
189
+ iconKey: "fileUpload"
190
+ }), z = a("button", {
191
+ _id: "aiChatInput__FileUploadButton"
192
+ }), Pe = (e) => {
193
+ const { aiChatSettings: t } = M(), i = m(), { onClick: n, ...r } = e;
194
+ return /* @__PURE__ */ o(
195
+ z,
196
+ {
197
+ type: "button",
198
+ "aria-label": "Upload file",
199
+ disabled: t.isViewOnly,
200
+ onClick: l(n, () => i.openFilePicker()),
201
+ ...r
202
+ }
203
+ );
204
+ }, K = a("input", {
205
+ _id: "aiChatInput__FileInput"
206
+ }), be = (e) => {
207
+ const t = m();
208
+ return /* @__PURE__ */ o(K, { ...e, ...t.getHiddenInputProps() });
209
+ }, Z = a("div", {
210
+ _id: "aiChatInput__FileList"
211
+ }), Ee = ({
212
+ children: e,
213
+ ...t
214
+ }) => {
215
+ const n = m().acceptedFiles;
216
+ return n.length ? /* @__PURE__ */ o(Z, { ...t, children: e(n) }) : null;
217
+ }, v = P.createContext(null);
218
+ function u() {
219
+ const e = P.useContext(v);
220
+ if (!e) throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");
221
+ return e;
222
+ }
223
+ const V = a("div", {
224
+ _id: "aiChatInput__FileItem"
225
+ }), Ne = ({ file: e, ...t }) => {
226
+ const i = m(), [n, r] = C(void 0), [s, c] = C(!0);
227
+ T(() => i.createFileUrl(e, (_) => {
228
+ r(_), c(!0);
229
+ }), [e]);
230
+ const f = () => i.deleteFile(e);
231
+ return /* @__PURE__ */ o(v.Provider, { value: { file: e, objectUrl: n, isLoading: s, setIsLoading: c, onRemove: f }, children: /* @__PURE__ */ o(V, { "data-loading": I(s), ...t }) });
232
+ }, W = a("button", {
233
+ _id: "aiChatInput__FilePreviewTrigger"
234
+ }), xe = ({
235
+ onClick: e,
236
+ ...t
237
+ }) => {
238
+ const { objectUrl: i, file: n } = u(), { openImagePreview: r } = b();
239
+ return /* @__PURE__ */ o(
240
+ W,
241
+ {
242
+ type: "button",
243
+ "aria-label": `Preview ${n.name}`,
244
+ disabled: !i,
245
+ onClick: l(e, () => {
246
+ i && r({ url: i, name: n.name });
247
+ }),
248
+ ...t
249
+ }
250
+ );
251
+ }, G = a("span", {
252
+ _id: "aiChatInput__FileContent"
253
+ }), Te = (e) => /* @__PURE__ */ o(G, { ...e }), J = a("img", {
254
+ _id: "aiChatInput__FileThumbnail"
255
+ }), we = ({
256
+ onLoad: e,
257
+ ...t
258
+ }) => {
259
+ const { objectUrl: i, file: n, setIsLoading: r } = u();
260
+ return /* @__PURE__ */ o(
261
+ J,
262
+ {
263
+ src: i,
264
+ alt: n.name,
265
+ onLoad: l(e, () => r(!1)),
266
+ ...t
267
+ }
268
+ );
269
+ }, Le = ({ className: e }) => {
270
+ const { file: t } = u(), i = y[R(t).type] ?? "fileText";
271
+ return /* @__PURE__ */ o(F, { iconKey: i, className: e });
272
+ }, q = a("span", {
273
+ _id: "aiChatInput__FileName"
274
+ }), Me = (e) => {
275
+ const { file: t } = u();
276
+ return /* @__PURE__ */ o(q, { ...e, children: t.name });
277
+ }, Q = a("button", {
278
+ _id: "aiChatInput__FileRemove"
279
+ }), ye = a(F, {
280
+ _id: "aiChatInput__FileRemoveIcon",
281
+ iconKey: "close"
282
+ }), je = ({
283
+ onClick: e,
284
+ ...t
285
+ }) => {
286
+ const { onRemove: i } = u();
287
+ return /* @__PURE__ */ o(
288
+ Q,
289
+ {
290
+ type: "button",
291
+ "aria-label": "Remove file",
292
+ onClick: l(e, i),
293
+ ...t
294
+ }
295
+ );
296
+ };
297
+ export {
298
+ k as ACCEPTED_FILE_EXTENSIONS,
299
+ j as ACCEPTED_FILE_MIME_TYPES,
300
+ fe as EmbeddedChatPrimitiveDropZone,
301
+ Te as EmbeddedChatPrimitiveFileContent,
302
+ be as EmbeddedChatPrimitiveFileInput,
303
+ Ne as EmbeddedChatPrimitiveFileItem,
304
+ Ee as EmbeddedChatPrimitiveFileList,
305
+ Me as EmbeddedChatPrimitiveFileName,
306
+ xe as EmbeddedChatPrimitiveFilePreviewTrigger,
307
+ je as EmbeddedChatPrimitiveFileRemove,
308
+ ye as EmbeddedChatPrimitiveFileRemoveIcon,
309
+ we as EmbeddedChatPrimitiveFileThumbnail,
310
+ Le as EmbeddedChatPrimitiveFileTypeIcon,
311
+ Pe as EmbeddedChatPrimitiveFileUploadButton,
312
+ ge as EmbeddedChatPrimitiveFileUploadButtonIcon,
313
+ pe as EmbeddedChatPrimitiveInputFieldset,
314
+ _e as EmbeddedChatPrimitiveInputNotification,
315
+ Fe as EmbeddedChatPrimitiveInputNotificationClose,
316
+ Ie as EmbeddedChatPrimitiveInputNotificationContent,
317
+ ve as EmbeddedChatPrimitiveInputNotificationHeader,
318
+ Ce as EmbeddedChatPrimitiveInputNotificationMessage,
319
+ he as EmbeddedChatPrimitiveInputNotificationTitle,
320
+ ue as EmbeddedChatPrimitiveMessageFile,
321
+ me as EmbeddedChatPrimitiveMessageFiles,
322
+ p as FILE_ACCEPT_MAP,
323
+ y as FILE_TYPE_ICON_MAP,
324
+ E as MAX_FILES,
325
+ N as MAX_FILE_SIZE,
326
+ g as isImageMimeType,
327
+ R as normalizeFileType
328
+ };