@appquality/unguess-design-system 3.1.90-beta-attachments → 3.1.91-alpha-marks

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 (43) hide show
  1. package/CHANGELOG.md +307 -0
  2. package/build/index.d.ts +1 -0
  3. package/build/index.js +982 -669
  4. package/build/stories/buttons/button/index.stories.d.ts +0 -1
  5. package/build/stories/buttons/utils.d.ts +27 -27
  6. package/build/stories/chat/_types.d.ts +6 -3
  7. package/build/stories/chat/context/chatContext.d.ts +8 -6
  8. package/build/stories/chat/hooks/useMedia.d.ts +8 -0
  9. package/build/stories/chat/index.stories.d.ts +3 -5
  10. package/build/stories/chat/parts/MediaLightbox.d.ts +14 -0
  11. package/build/stories/chat/parts/ThumbnailContainer/Thumbnail.d.ts +11 -0
  12. package/build/stories/chat/parts/ThumbnailContainer/index.d.ts +3 -2
  13. package/build/stories/chat/parts/comment.d.ts +2 -7
  14. package/build/stories/dropdowns/select/index.stories.d.ts +0 -1
  15. package/build/stories/editor/index.stories.d.ts +0 -1
  16. package/build/stories/highlight/_types.d.ts +37 -0
  17. package/build/stories/highlight/demo-parts/data.d.ts +55 -0
  18. package/build/stories/highlight/demo-parts/sentiment-tag.d.ts +7 -0
  19. package/build/stories/highlight/demo-parts/transcript-base.d.ts +5 -0
  20. package/build/stories/highlight/demo-parts/transcript-diarization.d.ts +5 -0
  21. package/build/stories/highlight/demo-parts/transcript-paragraph.d.ts +5 -0
  22. package/build/stories/highlight/demo-parts/transcript-sentiment.d.ts +5 -0
  23. package/build/stories/highlight/highlightContext.d.ts +10 -0
  24. package/build/stories/highlight/index.d.ts +10 -0
  25. package/build/stories/highlight/index.stories.d.ts +17 -0
  26. package/build/stories/highlight/searchable.d.ts +3 -0
  27. package/build/stories/player/_types.d.ts +34 -1
  28. package/build/stories/player/context/progressContext.d.ts +16 -0
  29. package/build/stories/player/index.stories.d.ts +1 -2
  30. package/build/stories/player/parts/bookmark.d.ts +2 -0
  31. package/build/stories/player/parts/controlButton.d.ts +289 -0
  32. package/build/stories/player/parts/controls.d.ts +7 -2
  33. package/build/stories/player/parts/controlsCenterGroup.d.ts +2 -1
  34. package/build/stories/player/parts/cutterButton.d.ts +6 -0
  35. package/build/stories/player/parts/progress.d.ts +11 -0
  36. package/build/stories/player/parts/timeLabel.d.ts +2 -2
  37. package/build/stories/tooltip/_types.d.ts +1 -0
  38. package/build/stories/tooltip/index.d.ts +1 -0
  39. package/build/stories/tooltip/index.stories.d.ts +1 -0
  40. package/package.json +5 -2
  41. package/build/stories/chat/parts/ThumbnailContainer/ImageThumbnail.d.ts +0 -11
  42. package/build/stories/chat/parts/ThumbnailContainer/VideoThumbnail.d.ts +0 -11
  43. /package/build/stories/player/{parts/utils.d.ts → utils.d.ts} +0 -0
package/build/index.js CHANGED
@@ -27,6 +27,7 @@ var line = require('@nivo/line');
27
27
  var reactForms = require('@zendeskgarden/react-forms');
28
28
  var react = require('@tiptap/react');
29
29
  var reactTooltips = require('@zendeskgarden/react-tooltips');
30
+ var uuid = require('uuid');
30
31
  var Typography = require('@tiptap/extension-typography');
31
32
  var Link = require('@tiptap/extension-link');
32
33
  var StarterKit = require('@tiptap/starter-kit');
@@ -37,10 +38,10 @@ var Mention = require('@tiptap/extension-mention');
37
38
  var tippy = require('tippy.js');
38
39
  var Image$2 = require('@tiptap/extension-image');
39
40
  var Dropcursor = require('@tiptap/extension-dropcursor');
40
- var reactGrid = require('@zendeskgarden/react-grid');
41
41
  var reactModals = require('@zendeskgarden/react-modals');
42
42
  var SlickSlider = require('react-slick');
43
43
  var Video = require('@appquality/stream-player');
44
+ var reactGrid = require('@zendeskgarden/react-grid');
44
45
  var containerUtilities = require('@zendeskgarden/container-utilities');
45
46
  var reactColorpickers = require('@zendeskgarden/react-colorpickers');
46
47
  var reactDropdowns = require('@zendeskgarden/react-dropdowns');
@@ -333,8 +334,8 @@ const UgContainerCard = styled__default["default"](reactNotifications.Well) `
333
334
  `;
334
335
  const ContainerCard = (props) => jsxRuntime.jsx(UgContainerCard, Object.assign({}, props));
335
336
 
336
- var _a, _b, _c, _d, _e, _f, _g$c, _h;
337
- const components = Object.assign(Object.assign(Object.assign(Object.assign({}, reactTheming.DEFAULT_THEME.components), { chrome: Object.assign(Object.assign({}, (_a = reactTheming.DEFAULT_THEME.components) === null || _a === void 0 ? void 0 : _a.chrome), { header: Object.assign(Object.assign({}, (_c = (_b = reactTheming.DEFAULT_THEME.components) === null || _b === void 0 ? void 0 : _b.chrome) === null || _c === void 0 ? void 0 : _c.header), { height: "64px" }), nav: Object.assign(Object.assign({}, (_e = (_d = reactTheming.DEFAULT_THEME.components) === null || _d === void 0 ? void 0 : _d.chrome) === null || _e === void 0 ? void 0 : _e.nav), { openWidth: 240, closedWidth: 36, workspaceDropdownWidth: 192 }) }), notification: Object.assign(Object.assign({}, (_f = reactTheming.DEFAULT_THEME.components) === null || _f === void 0 ? void 0 : _f.notification), { card: Object.assign(Object.assign({}, (_h = (_g$c = reactTheming.DEFAULT_THEME.components) === null || _g$c === void 0 ? void 0 : _g$c.notification) === null || _h === void 0 ? void 0 : _h.well), { padding: "16px" }) }) }), cardCmponentStyle), { "text.primary": () => ({
337
+ var _a, _b, _c, _d, _e, _f, _g$d, _h;
338
+ const components = Object.assign(Object.assign(Object.assign(Object.assign({}, reactTheming.DEFAULT_THEME.components), { chrome: Object.assign(Object.assign({}, (_a = reactTheming.DEFAULT_THEME.components) === null || _a === void 0 ? void 0 : _a.chrome), { header: Object.assign(Object.assign({}, (_c = (_b = reactTheming.DEFAULT_THEME.components) === null || _b === void 0 ? void 0 : _b.chrome) === null || _c === void 0 ? void 0 : _c.header), { height: "64px" }), nav: Object.assign(Object.assign({}, (_e = (_d = reactTheming.DEFAULT_THEME.components) === null || _d === void 0 ? void 0 : _d.chrome) === null || _e === void 0 ? void 0 : _e.nav), { openWidth: 240, closedWidth: 36, workspaceDropdownWidth: 192 }) }), notification: Object.assign(Object.assign({}, (_f = reactTheming.DEFAULT_THEME.components) === null || _f === void 0 ? void 0 : _f.notification), { card: Object.assign(Object.assign({}, (_h = (_g$d = reactTheming.DEFAULT_THEME.components) === null || _g$d === void 0 ? void 0 : _g$d.notification) === null || _h === void 0 ? void 0 : _h.well), { padding: "16px" }) }) }), cardCmponentStyle), { "text.primary": () => ({
338
339
  color: getColor(colors.primaryHue, 600),
339
340
  }), "text.success": () => ({
340
341
  color: getColor(colors.successHue, 700),
@@ -841,48 +842,48 @@ Tag.Avatar = StyledAvatar;
841
842
  Tag.Close = StyledClose;
842
843
  Tag.SecondaryText = StyledSpan;
843
844
 
844
- var _path$F;
845
- function _extends$R() { _extends$R = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$R.apply(this, arguments); }
846
- const SvgUgSquare = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$R({
845
+ var _path$G;
846
+ function _extends$T() { _extends$T = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$T.apply(this, arguments); }
847
+ const SvgUgSquare = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$T({
847
848
  width: 24,
848
849
  height: 24,
849
850
  viewBox: "0 0 24 24",
850
851
  fill: "none",
851
852
  xmlns: "http://www.w3.org/2000/svg"
852
- }, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
853
+ }, props), _path$G || (_path$G = /*#__PURE__*/React__namespace.createElement("path", {
853
854
  d: "M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19Z",
854
855
  fill: "#E80C7A"
855
856
  })));
856
857
 
857
- var _path$E;
858
- function _extends$Q() { _extends$Q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Q.apply(this, arguments); }
859
- const SvgUgCircle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$Q({
858
+ var _path$F;
859
+ function _extends$S() { _extends$S = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$S.apply(this, arguments); }
860
+ const SvgUgCircle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$S({
860
861
  width: 24,
861
862
  height: 24,
862
863
  viewBox: "0 0 24 24",
863
864
  fill: "none",
864
865
  xmlns: "http://www.w3.org/2000/svg"
865
- }, props), _path$E || (_path$E = /*#__PURE__*/React__namespace.createElement("path", {
866
+ }, props), _path$F || (_path$F = /*#__PURE__*/React__namespace.createElement("path", {
866
867
  d: "M12 2C6.47 2 2 6.47 2 12C2 17.53 6.47 22 12 22C17.53 22 22 17.53 22 12C22 6.47 17.53 2 12 2ZM12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4C16.42 4 20 7.58 20 12C20 16.42 16.42 20 12 20Z",
867
868
  fill: "#FFCD1A"
868
869
  })));
869
870
 
870
- var _path$D;
871
- function _extends$P() { _extends$P = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$P.apply(this, arguments); }
872
- const SvgUgTriangle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$P({
871
+ var _path$E;
872
+ function _extends$R() { _extends$R = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$R.apply(this, arguments); }
873
+ const SvgUgTriangle = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$R({
873
874
  width: 24,
874
875
  height: 24,
875
876
  viewBox: "0 0 24 24",
876
877
  fill: "none",
877
878
  xmlns: "http://www.w3.org/2000/svg"
878
- }, props), _path$D || (_path$D = /*#__PURE__*/React__namespace.createElement("path", {
879
+ }, props), _path$E || (_path$E = /*#__PURE__*/React__namespace.createElement("path", {
879
880
  d: "M11.9993 7.32625L18.3893 17.5563H5.60929L11.9993 7.32625ZM11.1493 4.91625L2.94929 18.0262C2.53929 18.6962 3.01929 19.5563 3.79929 19.5563H20.1993C20.9893 19.5563 21.4593 18.6962 21.0493 18.0262L12.8493 4.91625C12.4593 4.28625 11.5393 4.28625 11.1493 4.91625Z",
880
881
  fill: "#7B0DFF"
881
882
  })));
882
883
 
883
- var _rect$4, _path$C, _path2$c, _path3$4;
884
- function _extends$O() { _extends$O = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$O.apply(this, arguments); }
885
- const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$O({
884
+ var _rect$4, _path$D, _path2$c, _path3$4;
885
+ function _extends$Q() { _extends$Q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$Q.apply(this, arguments); }
886
+ const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$Q({
886
887
  width: 24,
887
888
  height: 24,
888
889
  viewBox: "0 0 24 24",
@@ -893,7 +894,7 @@ const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElemen
893
894
  height: 24,
894
895
  rx: 12,
895
896
  fill: "#F6F6F8"
896
- })), _path$C || (_path$C = /*#__PURE__*/React__namespace.createElement("path", {
897
+ })), _path$D || (_path$D = /*#__PURE__*/React__namespace.createElement("path", {
897
898
  d: "M20.6953 5.73905C21.0148 5.41953 21.0148 4.90149 20.6953 4.58197C20.3758 4.26245 19.8577 4.26245 19.5382 4.58197L11.88 12.2402L10.0849 9.95981C9.80539 9.60476 9.29098 9.54352 8.93593 9.82303C8.58088 10.1025 8.51963 10.6169 8.79914 10.972L11.1642 13.9763C11.3089 14.16 11.5252 14.2731 11.7586 14.2869C11.9921 14.3008 12.2203 14.2141 12.3856 14.0487L20.6953 5.73905Z",
898
899
  fill: "#50BF95"
899
900
  })), _path2$c || (_path2$c = /*#__PURE__*/React__namespace.createElement("path", {
@@ -904,9 +905,9 @@ const SvgCampaignCompleted = props => /*#__PURE__*/React__namespace.createElemen
904
905
  fill: "#007345"
905
906
  })));
906
907
 
907
- var _rect$3, _path$B, _path2$b;
908
- function _extends$N() { _extends$N = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$N.apply(this, arguments); }
909
- const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$N({
908
+ var _rect$3, _path$C, _path2$b;
909
+ function _extends$P() { _extends$P = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$P.apply(this, arguments); }
910
+ const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$P({
910
911
  width: 24,
911
912
  height: 24,
912
913
  viewBox: "0 0 24 24",
@@ -917,7 +918,7 @@ const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("
917
918
  height: 24,
918
919
  rx: 12,
919
920
  fill: "#F6F6F8"
920
- })), _path$B || (_path$B = /*#__PURE__*/React__namespace.createElement("path", {
921
+ })), _path$C || (_path$C = /*#__PURE__*/React__namespace.createElement("path", {
921
922
  fillRule: "evenodd",
922
923
  clipRule: "evenodd",
923
924
  d: "M13.55 19.0875C14.25 19.7875 15.1063 20.1375 16.1188 20.1375C17.1313 20.1375 17.9875 19.7875 18.6875 19.0875C19.3875 18.3875 19.7375 17.5312 19.7375 16.5187C19.7375 15.5062 19.3875 14.65 18.6875 13.95C17.9875 13.25 17.1313 12.9 16.1188 12.9C15.1063 12.9 14.25 13.25 13.55 13.95C12.85 14.65 12.5 15.5062 12.5 16.5187C12.5 17.5312 12.85 18.3875 13.55 19.0875ZM17.5062 18.2812C17.4187 18.2812 17.3375 18.25 17.2625 18.1875L15.7438 16.7812C15.6813 16.6687 15.65 16.6 15.65 16.575V14.55C15.65 14.4375 15.6875 14.3437 15.7625 14.2687C15.8375 14.1937 15.9313 14.1562 16.0438 14.1562C16.1563 14.1562 16.25 14.1937 16.325 14.2687C16.4 14.3437 16.4375 14.4375 16.4375 14.55V16.4813L17.7313 17.6625C17.8063 17.725 17.8469 17.8062 17.8531 17.9062C17.8594 18.0063 17.825 18.0938 17.75 18.1688C17.675 18.2438 17.5937 18.2812 17.5062 18.2812Z",
@@ -929,9 +930,9 @@ const SvgCampaignLocked = props => /*#__PURE__*/React__namespace.createElement("
929
930
  fill: "#F4AC1A"
930
931
  })));
931
932
 
932
- var _rect$2, _path$A, _path2$a;
933
- function _extends$M() { _extends$M = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$M.apply(this, arguments); }
934
- const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$M({
933
+ var _rect$2, _path$B, _path2$a;
934
+ function _extends$O() { _extends$O = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$O.apply(this, arguments); }
935
+ const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$O({
935
936
  width: 24,
936
937
  height: 24,
937
938
  viewBox: "0 0 24 24",
@@ -942,7 +943,7 @@ const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement
942
943
  height: 24,
943
944
  rx: 12,
944
945
  fill: "#F6F6F8"
945
- })), _path$A || (_path$A = /*#__PURE__*/React__namespace.createElement("path", {
946
+ })), _path$B || (_path$B = /*#__PURE__*/React__namespace.createElement("path", {
946
947
  d: "M11.2266 13.0313H14.997M11.2266 9.26075V13.0313V9.26075ZM11.2266 13.0313L20.121 5.03906L11.2266 13.0313Z",
947
948
  stroke: "#024780",
948
949
  strokeWidth: 1.5,
@@ -956,9 +957,9 @@ const SvgCampaignIncoming = props => /*#__PURE__*/React__namespace.createElement
956
957
  strokeLinejoin: "round"
957
958
  })));
958
959
 
959
- var _rect$1, _path$z, _path2$9, _path3$3, _path4$1, _path5$1, _path6$1, _path7$1, _path8$1, _path9$1, _path10$1;
960
- function _extends$L() { _extends$L = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$L.apply(this, arguments); }
961
- const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$L({
960
+ var _rect$1, _path$A, _path2$9, _path3$3, _path4$1, _path5$1, _path6$1, _path7$1, _path8$1, _path9$1, _path10$1;
961
+ function _extends$N() { _extends$N = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$N.apply(this, arguments); }
962
+ const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$N({
962
963
  width: 24,
963
964
  height: 24,
964
965
  viewBox: "0 0 24 24",
@@ -969,7 +970,7 @@ const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement
969
970
  height: 24,
970
971
  rx: 12,
971
972
  fill: "#F6F6F8"
972
- })), _path$z || (_path$z = /*#__PURE__*/React__namespace.createElement("path", {
973
+ })), _path$A || (_path$A = /*#__PURE__*/React__namespace.createElement("path", {
973
974
  d: "M13.059 16.7647C13.059 16.1799 12.585 15.7059 12.0002 15.7059C11.4154 15.7059 10.9414 16.1799 10.9414 16.7647V19.9412C10.9414 20.5259 11.4154 21 12.0002 21C12.585 21 13.059 20.5259 13.059 19.9412V16.7647Z",
974
975
  fill: "#D1820A"
975
976
  })), _path2$9 || (_path2$9 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -1001,21 +1002,21 @@ const SvgCampaignProgress = props => /*#__PURE__*/React__namespace.createElement
1001
1002
  fill: "#FFB65A"
1002
1003
  })));
1003
1004
 
1004
- var _g$b, _path$y, _path2$8, _path3$2, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11;
1005
- function _extends$K() { _extends$K = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$K.apply(this, arguments); }
1006
- const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$K({
1005
+ var _g$c, _path$z, _path2$8, _path3$2, _path4, _path5, _path6, _path7, _path8, _path9, _path10, _path11;
1006
+ function _extends$M() { _extends$M = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$M.apply(this, arguments); }
1007
+ const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$M({
1007
1008
  width: 24,
1008
1009
  height: 24,
1009
1010
  viewBox: "0 0 24 24",
1010
1011
  fill: "none",
1011
1012
  xmlns: "http://www.w3.org/2000/svg"
1012
- }, props), _g$b || (_g$b = /*#__PURE__*/React__namespace.createElement("g", {
1013
+ }, props), _g$c || (_g$c = /*#__PURE__*/React__namespace.createElement("g", {
1013
1014
  opacity: 0.3
1014
1015
  }, /*#__PURE__*/React__namespace.createElement("path", {
1015
1016
  opacity: 0.3,
1016
1017
  d: "M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z",
1017
1018
  fill: "#50BF95"
1018
- }))), _path$y || (_path$y = /*#__PURE__*/React__namespace.createElement("path", {
1019
+ }))), _path$z || (_path$z = /*#__PURE__*/React__namespace.createElement("path", {
1019
1020
  d: "M12.487 3.19652C8.68003 3.19652 5.59895 6.27761 5.59895 10.0846C5.59895 10.2597 5.59895 10.4348 5.62438 10.5855C5.29857 11.1863 4.82307 12.013 4.24678 12.514C3.82117 12.8897 3.92096 13.2908 3.97085 13.4405C4.09609 13.7663 4.44635 14.0413 5.02265 14.2418C5.22322 14.3172 5.44825 14.3671 5.64883 14.417L5.67427 16.8464C5.67427 17.7984 6.47559 18.6251 7.45304 18.6251L8.93044 18.1496L9.08111 19.0263C9.18091 19.6026 9.68185 20.0282 10.2836 20.0282C10.3589 20.0282 10.4343 20.0282 10.5086 20.0028L15.1424 19.177C15.8185 19.0517 16.2441 18.4256 16.1443 17.7495L15.8185 16.1214C17.9974 14.9189 19.375 12.5892 19.375 10.0845C19.375 6.30279 16.2696 3.19641 12.4869 3.19641L12.487 3.19652Z",
1020
1021
  fill: "#2B8473",
1021
1022
  stroke: "#2B8473"
@@ -1071,21 +1072,21 @@ const SvgCampaignExperiential = props => /*#__PURE__*/React__namespace.createEle
1071
1072
  fill: "#ECF4F2"
1072
1073
  })));
1073
1074
 
1074
- var _g$a, _path$x;
1075
- function _extends$J() { _extends$J = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$J.apply(this, arguments); }
1076
- const SvgCampaignFunctional = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$J({
1075
+ var _g$b, _path$y;
1076
+ function _extends$L() { _extends$L = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$L.apply(this, arguments); }
1077
+ const SvgCampaignFunctional = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$L({
1077
1078
  width: 24,
1078
1079
  height: 24,
1079
1080
  viewBox: "0 0 24 24",
1080
1081
  fill: "none",
1081
1082
  xmlns: "http://www.w3.org/2000/svg"
1082
- }, props), _g$a || (_g$a = /*#__PURE__*/React__namespace.createElement("g", {
1083
+ }, props), _g$b || (_g$b = /*#__PURE__*/React__namespace.createElement("g", {
1083
1084
  opacity: 0.3
1084
1085
  }, /*#__PURE__*/React__namespace.createElement("path", {
1085
1086
  opacity: 0.3,
1086
1087
  d: "M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z",
1087
1088
  fill: "#003A57"
1088
- }))), _path$x || (_path$x = /*#__PURE__*/React__namespace.createElement("path", {
1089
+ }))), _path$y || (_path$y = /*#__PURE__*/React__namespace.createElement("path", {
1089
1090
  d: "M17.9983 7.16705C17.5188 6.58566 17.1422 6.73039 17.1422 6.73039C17.1422 6.73039 16.406 7.02453 16.0401 7.16303C15.6742 7.30153 15.2408 7.17357 15.2408 7.17357L14.7579 6.8851C14.7579 6.8851 14.4296 6.56554 14.3656 6.18067C14.3123 5.78958 14.1888 5.00269 14.1888 5.00269C14.1888 5.00269 14.1356 4.61159 13.3938 4.47257C12.652 4.33356 12.4678 4.68715 12.4678 4.68715C12.4678 4.68715 12.0932 5.38344 11.9091 5.73703C11.7249 6.09062 11.3114 6.27118 11.3114 6.27118L10.7639 6.36908C10.7639 6.36908 10.3144 6.33771 10.0176 6.07271L9.12712 5.27769C9.12712 5.27769 8.8303 5.01268 8.18313 5.38632C7.53595 5.75997 7.61705 6.14953 7.61705 6.14953L7.86033 7.3182C7.94143 7.70776 7.74381 8.11275 7.74381 8.11275L7.38528 8.53794C7.38528 8.53794 7.02217 8.80577 6.62387 8.78845C6.22557 8.77114 5.43527 8.7474 5.43527 8.7474C5.43527 8.7474 5.03697 8.73009 4.78646 9.44201C4.53595 10.1539 4.84804 10.3956 4.84804 10.3956C4.84804 10.3956 5.46774 10.896 5.77983 11.1376C6.09192 11.3793 6.19373 11.8296 6.19373 11.8296L6.20207 12.3921C6.20207 12.3921 6.09618 12.8314 5.79331 13.079C5.49043 13.3266 4.86759 13.8171 4.86759 13.8171C4.86759 13.8171 4.56471 14.0647 4.81769 14.7769C5.08144 15.4828 5.46713 15.4783 5.46713 15.4783C5.46713 15.4783 6.26012 15.4569 6.64582 15.4524C7.03152 15.4479 7.40116 15.7145 7.40116 15.7145L7.76458 16.1447C7.76458 16.1447 7.96976 16.5499 7.89441 16.9425C7.81907 17.3351 7.66208 18.1094 7.66208 18.1094C7.66208 18.1094 7.58674 18.502 8.23785 18.8824C8.88895 19.2629 9.18553 19.0044 9.18553 19.0044C9.18553 19.0044 9.7724 18.4765 10.069 18.218C10.3655 17.9595 10.8115 17.9347 10.8115 17.9347L11.3609 18.0394C11.3609 18.0394 11.77 18.225 11.9608 18.5803C12.1516 18.9356 12.5268 19.6354 12.5268 19.6354C12.5268 19.6354 12.7176 19.9907 13.4583 19.8539C14.1946 19.7343 14.2529 19.337 14.2529 19.337C14.2529 19.337 14.3586 18.5487 14.4232 18.1623C14.4814 17.765 14.8086 17.4598 14.8086 17.4598L15.2939 17.1796C15.2939 17.1796 15.7281 17.0598 16.095 17.1971C16.4682 17.3453 17.1975 17.637 17.1975 17.637C17.1975 17.637 17.5707 17.7851 18.0424 17.2073C18.5142 16.6295 18.3189 16.2913 18.3189 16.2913C18.3189 16.2913 17.9006 15.6164 17.6882 15.2736C17.4759 14.9307 17.5197 14.4836 17.5197 14.4836L17.7038 13.9555C17.7038 13.9555 17.9482 13.5816 18.3203 13.454C18.6925 13.3264 19.4431 13.0822 19.4431 13.0822C19.4431 13.0822 19.8153 12.9546 19.8113 12.2005C19.8074 11.4464 19.4297 11.3153 19.4297 11.3153C19.4297 11.3153 18.6807 11.0641 18.303 10.9331C17.9253 10.802 17.677 10.4217 17.677 10.4217L17.4861 9.8919C17.4861 9.8919 17.4293 9.4447 17.6368 9.1067C17.8443 8.7687 18.2486 8.09891 18.2486 8.09891C18.2486 8.09891 18.4778 7.74844 17.9983 7.16707L17.9983 7.16705ZM9.33902 8.38466L10.6176 10.5992C10.0433 11.149 9.82793 11.9715 10.0567 12.7413L7.86713 14.0054C6.98868 12.0106 7.60355 9.66286 9.33905 8.38457L9.33902 8.38466ZM13.9748 16.414C11.9998 17.2778 9.65918 16.6363 8.37099 14.8783L10.5605 13.6141C11.1128 14.1971 11.9329 14.4219 12.6961 14.1994L13.9748 16.414ZM12.6552 13.132C12.1159 13.4434 11.4325 13.2561 11.1176 12.7107C10.8027 12.1652 10.9822 11.4797 11.5215 11.1684C12.0608 10.857 12.7441 11.0443 13.0591 11.5897C13.374 12.1352 13.1945 12.8207 12.6552 13.132ZM14.8376 15.9158L13.5591 13.7012C14.1333 13.1515 14.3487 12.3289 14.12 11.5591L16.3095 10.295C17.188 12.2898 16.5731 14.6376 14.8376 15.9159L14.8376 15.9158ZM13.6161 10.6863C13.0638 10.1034 12.2437 9.87862 11.4805 10.1011L10.2019 7.88652C12.1769 7.02266 14.5112 7.65314 15.8057 9.42223L13.6161 10.6863Z",
1090
1091
  fill: "#003A57"
1091
1092
  })));
@@ -1946,15 +1947,15 @@ const WaffleChart = ({ height, width, data, total, tooltip, }) => {
1946
1947
  } }) })));
1947
1948
  };
1948
1949
 
1949
- var _g$9, _defs$4;
1950
- function _extends$I() { _extends$I = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$I.apply(this, arguments); }
1951
- const SvgSentiment1 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$I({
1950
+ var _g$a, _defs$4;
1951
+ function _extends$K() { _extends$K = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$K.apply(this, arguments); }
1952
+ const SvgSentiment1 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$K({
1952
1953
  width: 27,
1953
1954
  height: 26,
1954
1955
  viewBox: "0 0 27 26",
1955
1956
  fill: "none",
1956
1957
  xmlns: "http://www.w3.org/2000/svg"
1957
- }, props), _g$9 || (_g$9 = /*#__PURE__*/React__namespace.createElement("g", {
1958
+ }, props), _g$a || (_g$a = /*#__PURE__*/React__namespace.createElement("g", {
1958
1959
  clipPath: "url(#clip0_21_19131)"
1959
1960
  }, /*#__PURE__*/React__namespace.createElement("path", {
1960
1961
  d: "M26.5525 13C26.5525 20.1796 20.6084 26 13.2762 26C5.94481 26 0 20.1796 0 13C0 5.82111 5.94481 0 13.2762 0C20.6084 0 26.5525 5.82111 26.5525 13Z",
@@ -1970,15 +1971,15 @@ const SvgSentiment1 = props => /*#__PURE__*/React__namespace.createElement("svg"
1970
1971
  fill: "white"
1971
1972
  })))));
1972
1973
 
1973
- var _g$8, _defs$3;
1974
- function _extends$H() { _extends$H = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$H.apply(this, arguments); }
1975
- const SvgSentiment2 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$H({
1974
+ var _g$9, _defs$3;
1975
+ function _extends$J() { _extends$J = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$J.apply(this, arguments); }
1976
+ const SvgSentiment2 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$J({
1976
1977
  width: 27,
1977
1978
  height: 26,
1978
1979
  viewBox: "0 0 27 26",
1979
1980
  fill: "none",
1980
1981
  xmlns: "http://www.w3.org/2000/svg"
1981
- }, props), _g$8 || (_g$8 = /*#__PURE__*/React__namespace.createElement("g", {
1982
+ }, props), _g$9 || (_g$9 = /*#__PURE__*/React__namespace.createElement("g", {
1982
1983
  clipPath: "url(#clip0_21_19130)"
1983
1984
  }, /*#__PURE__*/React__namespace.createElement("path", {
1984
1985
  d: "M26.5525 13C26.5525 20.1796 20.6084 26 13.2762 26C5.94481 26 0 20.1796 0 13C0 5.82111 5.94481 0 13.2762 0C20.6084 0 26.5525 5.82111 26.5525 13Z",
@@ -1994,15 +1995,15 @@ const SvgSentiment2 = props => /*#__PURE__*/React__namespace.createElement("svg"
1994
1995
  fill: "white"
1995
1996
  })))));
1996
1997
 
1997
- var _g$7, _defs$2;
1998
- function _extends$G() { _extends$G = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$G.apply(this, arguments); }
1999
- const SvgSentiment3 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$G({
1998
+ var _g$8, _defs$2;
1999
+ function _extends$I() { _extends$I = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$I.apply(this, arguments); }
2000
+ const SvgSentiment3 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$I({
2000
2001
  width: 27,
2001
2002
  height: 26,
2002
2003
  viewBox: "0 0 27 26",
2003
2004
  fill: "none",
2004
2005
  xmlns: "http://www.w3.org/2000/svg"
2005
- }, props), _g$7 || (_g$7 = /*#__PURE__*/React__namespace.createElement("g", {
2006
+ }, props), _g$8 || (_g$8 = /*#__PURE__*/React__namespace.createElement("g", {
2006
2007
  clipPath: "url(#clip0_21_19129)"
2007
2008
  }, /*#__PURE__*/React__namespace.createElement("path", {
2008
2009
  d: "M26.5525 13C26.5525 20.1796 20.6084 26 13.2762 26C5.94481 26 0 20.1796 0 13C0 5.82111 5.94481 0 13.2762 0C20.6084 0 26.5525 5.82111 26.5525 13Z",
@@ -2024,15 +2025,15 @@ const SvgSentiment3 = props => /*#__PURE__*/React__namespace.createElement("svg"
2024
2025
  fill: "white"
2025
2026
  })))));
2026
2027
 
2027
- var _g$6, _defs$1;
2028
- function _extends$F() { _extends$F = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$F.apply(this, arguments); }
2029
- const SvgSentiment4 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$F({
2028
+ var _g$7, _defs$1;
2029
+ function _extends$H() { _extends$H = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$H.apply(this, arguments); }
2030
+ const SvgSentiment4 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$H({
2030
2031
  width: 27,
2031
2032
  height: 26,
2032
2033
  viewBox: "0 0 27 26",
2033
2034
  fill: "none",
2034
2035
  xmlns: "http://www.w3.org/2000/svg"
2035
- }, props), _g$6 || (_g$6 = /*#__PURE__*/React__namespace.createElement("g", {
2036
+ }, props), _g$7 || (_g$7 = /*#__PURE__*/React__namespace.createElement("g", {
2036
2037
  clipPath: "url(#clip0_21_19127)"
2037
2038
  }, /*#__PURE__*/React__namespace.createElement("path", {
2038
2039
  d: "M26.5525 13C26.5525 20.1796 20.6084 26 13.2762 26C5.94481 26 0 20.1796 0 13C0 5.82111 5.94481 0 13.2762 0C20.6084 0 26.5525 5.82111 26.5525 13Z",
@@ -2054,15 +2055,15 @@ const SvgSentiment4 = props => /*#__PURE__*/React__namespace.createElement("svg"
2054
2055
  fill: "white"
2055
2056
  })))));
2056
2057
 
2057
- var _g$5, _defs;
2058
- function _extends$E() { _extends$E = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$E.apply(this, arguments); }
2059
- const SvgSentiment5 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$E({
2058
+ var _g$6, _defs;
2059
+ function _extends$G() { _extends$G = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$G.apply(this, arguments); }
2060
+ const SvgSentiment5 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$G({
2060
2061
  width: 26,
2061
2062
  height: 26,
2062
2063
  viewBox: "0 0 26 26",
2063
2064
  fill: "none",
2064
2065
  xmlns: "http://www.w3.org/2000/svg"
2065
- }, props), _g$5 || (_g$5 = /*#__PURE__*/React__namespace.createElement("g", {
2066
+ }, props), _g$6 || (_g$6 = /*#__PURE__*/React__namespace.createElement("g", {
2066
2067
  clipPath: "url(#clip0_21_19125)"
2067
2068
  }, /*#__PURE__*/React__namespace.createElement("path", {
2068
2069
  d: "M25.2051 13C25.2051 20.1796 19.5626 26 12.6025 26C5.64314 26 0 20.1796 0 13C0 5.82111 5.64314 0 12.6025 0C19.5626 0 25.2051 5.82111 25.2051 13Z",
@@ -2313,7 +2314,7 @@ const ChatFooter = ({ saveText, children, showShortcut, }) => {
2313
2314
  };
2314
2315
 
2315
2316
  const ChatContext = React.createContext(null);
2316
- const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, children, }) => {
2317
+ const ChatContextProvider = ({ onSave, onFileUpload, onDeleteThumbnail, setMentionableUsers, children, }) => {
2317
2318
  const [editor, setEditor] = React.useState();
2318
2319
  const [thumbnails, setThumbnails] = React.useState([]);
2319
2320
  const getMentions = (editor) => {
@@ -2335,9 +2336,10 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2335
2336
  editor,
2336
2337
  setEditor,
2337
2338
  thumbnails,
2339
+ setThumbnails,
2338
2340
  afterUploadCallback: (failed) => {
2339
2341
  setThumbnails(thumbnails.map((file) => {
2340
- if (failed.includes(file.name)) {
2342
+ if (failed.includes(file.id)) {
2341
2343
  file.isLoadingMedia = false;
2342
2344
  //file.isError = true;
2343
2345
  }
@@ -2349,7 +2351,6 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2349
2351
  }));
2350
2352
  },
2351
2353
  addThumbnails: ({ files }) => {
2352
- files.forEach((file) => (file.isLoadingMedia = true));
2353
2354
  setThumbnails((prev) => [...prev, ...files]);
2354
2355
  if (onFileUpload) {
2355
2356
  onFileUpload(files).then((data) => {
@@ -2358,7 +2359,7 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2358
2359
  setThumbnails((prev) => {
2359
2360
  return prev.map((file) => {
2360
2361
  file.isLoadingMedia = false;
2361
- if ((failed === null || failed === void 0 ? void 0 : failed.length) && failed.includes(file.name)) {
2362
+ if ((failed === null || failed === void 0 ? void 0 : failed.length) && failed.includes(file.id)) {
2362
2363
  file.isError = true;
2363
2364
  }
2364
2365
  else {
@@ -2370,10 +2371,19 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2370
2371
  });
2371
2372
  }
2372
2373
  },
2373
- clearThumbnails: () => {
2374
- setThumbnails([]);
2374
+ clearInput: () => {
2375
+ if (editor && !editor.isEmpty) {
2376
+ editor.commands.clearContent();
2377
+ }
2378
+ if (thumbnails.length > 0)
2379
+ setThumbnails([]);
2380
+ },
2381
+ onDeleteThumbnail: (id) => {
2382
+ onDeleteThumbnail(id);
2383
+ },
2384
+ removeThumbnail: (index) => {
2385
+ setThumbnails(thumbnails.filter((_, i) => i !== index));
2375
2386
  },
2376
- removeThumbnail: (index) => setThumbnails(thumbnails.filter((_, i) => i !== index)),
2377
2387
  triggerSave: () => {
2378
2388
  if (editor && onSave && !editor.isEmpty) {
2379
2389
  onSave(editor, getMentions(editor));
@@ -2390,6 +2400,7 @@ const ChatContextProvider = ({ onSave, onFileUpload, setMentionableUsers, childr
2390
2400
  thumbnails,
2391
2401
  setThumbnails,
2392
2402
  onFileUpload,
2403
+ onDeleteThumbnail,
2393
2404
  ]);
2394
2405
  return (jsxRuntime.jsx(ChatContext.Provider, Object.assign({ value: chatContextValue }, { children: children })));
2395
2406
  };
@@ -2725,96 +2736,28 @@ const ChatTitle = styled__default["default"](Title$1) `
2725
2736
  padding: ${({ theme }) => `${theme.space.sm} ${theme.space.md}`};
2726
2737
  `;
2727
2738
 
2728
- const UgClose$1 = styled__default["default"](reactNotifications.Close) `
2729
- display: flex;
2730
- align-items: center;
2731
- justify-content: center;
2732
- width: ${({ theme }) => theme.space.xl};
2733
- height: ${({ theme }) => theme.space.xl};
2734
- `;
2735
- /**
2736
- * Title is a basic component used to display a title. Often used in card headers.
2737
- */
2738
- const Close = (props) => jsxRuntime.jsx(UgClose$1, Object.assign({}, props));
2739
-
2740
- const NOTIFICATION_COMPONENT_ID = "notifications.notification";
2741
- const CLOSE_COMPONENT_ID = "notifications.notification.close";
2742
- const CLOSE_ICON_COMPONENT_ID = "notifications.notification.close-icon";
2743
- const TITLE_COMPONENT_ID = "notifications.notification.title";
2744
- const UgClose = styled__default["default"](Close).attrs((props) => {
2745
- var _a;
2746
- return ({
2747
- "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_ICON_COMPONENT_ID,
2748
- });
2749
- }) `
2750
- ${(props) => reactTheming.retrieveComponentStyles(CLOSE_ICON_COMPONENT_ID, props)};
2751
- `;
2752
- const UgAnchor = styled__default["default"](reactButtons.Anchor).attrs((props) => {
2753
- var _a;
2754
- return ({
2755
- "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_COMPONENT_ID,
2756
- });
2757
- }) `
2758
- ${(props) => reactTheming.retrieveComponentStyles(CLOSE_COMPONENT_ID, props)};
2759
- `;
2760
- const UgTitle = styled__default["default"](Title$1).attrs((props) => {
2761
- var _a;
2762
- return ({
2763
- "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : TITLE_COMPONENT_ID,
2764
- });
2765
- }) `
2766
- ${(props) => reactTheming.retrieveComponentStyles(TITLE_COMPONENT_ID, props)};
2767
- `;
2768
- const UgNotification = styled__default["default"](reactNotifications.Notification) `
2769
- display: flex;
2770
- align-items: center;
2771
- justify-content: space-between;
2772
- padding-right: ${({ theme }) => theme.space.md};
2773
- white-space: pre;
2774
-
2775
- ${UgAnchor} {
2776
- flex-shrink: 0;
2777
- margin-left: ${({ theme }) => theme.space.md};
2778
- }
2779
-
2780
- ${(props) => reactTheming.retrieveComponentStyles(NOTIFICATION_COMPONENT_ID, props)};
2781
- `;
2782
- /**
2783
- * A Notification is a passive status update that keeps users informed of system progress.
2784
- * <hr>
2785
- * Used for this:
2786
- - For a passive status update about user or system activity
2787
- */
2788
- const Notification = (_a) => {
2789
- var { closeText, message, onClose, type, isPrimary, isRegular } = _a, props = __rest(_a, ["closeText", "message", "onClose", "type", "isPrimary", "isRegular"]);
2790
- return (jsxRuntime.jsxs(UgNotification, Object.assign({ type: type, isPrimary: isPrimary }, props, { children: [jsxRuntime.jsx(UgTitle, Object.assign({ isRegular: isRegular, type: type, isPrimary: isPrimary }, { children: message })), jsxRuntime.jsx(UgAnchor, Object.assign({ type: type, isPrimary: isPrimary, onClick: onClose }, { children: closeText !== null && closeText !== void 0 ? closeText : jsxRuntime.jsx(UgClose, {}) }))] })));
2791
- };
2792
- // ToastProvider
2793
- const ToastProvider = (props) => (jsxRuntime.jsx(reactNotifications.ToastProvider, Object.assign({}, props)));
2794
- const useToast = reactNotifications.useToast;
2795
-
2796
- var _path$w;
2797
- function _extends$D() { _extends$D = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$D.apply(this, arguments); }
2798
- const SvgBoldFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$D({
2739
+ var _path$x;
2740
+ function _extends$F() { _extends$F = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$F.apply(this, arguments); }
2741
+ const SvgBoldFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$F({
2799
2742
  xmlns: "http://www.w3.org/2000/svg",
2800
2743
  width: 16,
2801
2744
  height: 16,
2802
2745
  focusable: "false",
2803
2746
  viewBox: "0 0 16 16"
2804
- }, props), _path$w || (_path$w = /*#__PURE__*/React__namespace.createElement("path", {
2747
+ }, props), _path$x || (_path$x = /*#__PURE__*/React__namespace.createElement("path", {
2805
2748
  fill: "currentColor",
2806
2749
  d: "M7.5 0C9.952 0 12 2.048 12 4.5a4.483 4.483 0 01-1.27 3.108C12.078 8.39 13 9.855 13 11.5c0 2.452-2.048 4.5-4.5 4.5H4a1 1 0 01-1-1V1a1 1 0 011-1h3.5zM5 14h3.5c1.348 0 2.5-1.152 2.5-2.5S9.848 9 8.5 9H5v5zM7.5 2H5v5h2.5C8.848 7 10 5.848 10 4.5S8.848 2 7.5 2z"
2807
2750
  })));
2808
2751
 
2809
- var _path$v;
2810
- function _extends$C() { _extends$C = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$C.apply(this, arguments); }
2811
- const SvgItalicFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$C({
2752
+ var _path$w;
2753
+ function _extends$E() { _extends$E = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$E.apply(this, arguments); }
2754
+ const SvgItalicFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$E({
2812
2755
  xmlns: "http://www.w3.org/2000/svg",
2813
2756
  width: 16,
2814
2757
  height: 16,
2815
2758
  focusable: "false",
2816
2759
  viewBox: "0 0 16 16"
2817
- }, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
2760
+ }, props), _path$w || (_path$w = /*#__PURE__*/React__namespace.createElement("path", {
2818
2761
  fill: "none",
2819
2762
  stroke: "currentColor",
2820
2763
  strokeLinecap: "round",
@@ -2822,15 +2765,15 @@ const SvgItalicFill = props => /*#__PURE__*/React__namespace.createElement("svg"
2822
2765
  d: "M8 1h3M9.5 1l-3 14M5 15h3"
2823
2766
  })));
2824
2767
 
2825
- var _path$u, _path2$7;
2826
- function _extends$B() { _extends$B = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$B.apply(this, arguments); }
2827
- const SvgQuoteFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$B({
2768
+ var _path$v, _path2$7;
2769
+ function _extends$D() { _extends$D = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$D.apply(this, arguments); }
2770
+ const SvgQuoteFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$D({
2828
2771
  xmlns: "http://www.w3.org/2000/svg",
2829
2772
  width: 16,
2830
2773
  height: 16,
2831
2774
  focusable: "false",
2832
2775
  viewBox: "0 0 16 16"
2833
- }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
2776
+ }, props), _path$v || (_path$v = /*#__PURE__*/React__namespace.createElement("path", {
2834
2777
  fill: "currentColor",
2835
2778
  d: "M7 8H4c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v3c0 .55-.45 1-1 1zm6 0h-3c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v3c0 .55-.45 1-1 1z"
2836
2779
  })), _path2$7 || (_path2$7 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -2841,15 +2784,15 @@ const SvgQuoteFill = props => /*#__PURE__*/React__namespace.createElement("svg",
2841
2784
  d: "M5.5 12C6.5 11 7 9.5 7 8V6m4.5 6c1-1 1.5-2.5 1.5-4V6"
2842
2785
  })));
2843
2786
 
2844
- var _g$4;
2845
- function _extends$A() { _extends$A = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$A.apply(this, arguments); }
2846
- const SvgH1Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$A({
2787
+ var _g$5;
2788
+ function _extends$C() { _extends$C = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$C.apply(this, arguments); }
2789
+ const SvgH1Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$C({
2847
2790
  xmlns: "http://www.w3.org/2000/svg",
2848
2791
  width: 16,
2849
2792
  height: 16,
2850
2793
  focusable: "false",
2851
2794
  viewBox: "0 0 16 16"
2852
- }, props), _g$4 || (_g$4 = /*#__PURE__*/React__namespace.createElement("g", {
2795
+ }, props), _g$5 || (_g$5 = /*#__PURE__*/React__namespace.createElement("g", {
2853
2796
  transform: "translate(-464 -332)"
2854
2797
  }, /*#__PURE__*/React__namespace.createElement("rect", {
2855
2798
  width: 16,
@@ -2869,15 +2812,15 @@ const SvgH1Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _e
2869
2812
  transform: "translate(474.469 331)"
2870
2813
  }))));
2871
2814
 
2872
- var _g$3;
2873
- function _extends$z() { _extends$z = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$z.apply(this, arguments); }
2874
- const SvgH2Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$z({
2815
+ var _g$4;
2816
+ function _extends$B() { _extends$B = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$B.apply(this, arguments); }
2817
+ const SvgH2Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$B({
2875
2818
  xmlns: "http://www.w3.org/2000/svg",
2876
2819
  width: 16,
2877
2820
  height: 16,
2878
2821
  focusable: "false",
2879
2822
  viewBox: "0 0 16 16"
2880
- }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
2823
+ }, props), _g$4 || (_g$4 = /*#__PURE__*/React__namespace.createElement("g", {
2881
2824
  transform: "translate(-464 -332)"
2882
2825
  }, /*#__PURE__*/React__namespace.createElement("rect", {
2883
2826
  width: 16,
@@ -2897,15 +2840,15 @@ const SvgH2Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _e
2897
2840
  transform: "translate(469.359 331)"
2898
2841
  }))));
2899
2842
 
2900
- var _g$2;
2901
- function _extends$y() { _extends$y = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$y.apply(this, arguments); }
2902
- const SvgH3Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$y({
2843
+ var _g$3;
2844
+ function _extends$A() { _extends$A = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$A.apply(this, arguments); }
2845
+ const SvgH3Fill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$A({
2903
2846
  xmlns: "http://www.w3.org/2000/svg",
2904
2847
  width: 16,
2905
2848
  height: 16,
2906
2849
  focusable: "false",
2907
2850
  viewBox: "0 0 16 16"
2908
- }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
2851
+ }, props), _g$3 || (_g$3 = /*#__PURE__*/React__namespace.createElement("g", {
2909
2852
  transform: "translate(-464 -332)"
2910
2853
  }, /*#__PURE__*/React__namespace.createElement("rect", {
2911
2854
  width: 16,
@@ -2966,142 +2909,218 @@ const FloatingMenu = (props) => {
2966
2909
  const TooltipComponent = (props) => {
2967
2910
  var _a;
2968
2911
  const theme = React.useContext(styled.ThemeContext);
2969
- return jsxRuntime.jsx(reactTooltips.Tooltip, Object.assign({}, props, { zIndex: (_a = props.zIndex) !== null && _a !== void 0 ? _a : theme.levels.front }));
2912
+ return (jsxRuntime.jsx(reactTooltips.Tooltip, Object.assign({}, props, { zIndex: (_a = props.zIndex) !== null && _a !== void 0 ? _a : theme.levels.front })));
2970
2913
  };
2971
2914
  const Tooltip = styled__default["default"](TooltipComponent) `
2972
2915
  box-shadow: ${({ theme }) => theme.shadows.lg(`${theme.space.base * 3}px`, `${theme.space.base * 5}px`, getColor("neutralHue", 600, theme, 0.15))};
2916
+
2917
+ ${({ isTransparent }) => isTransparent &&
2918
+ `
2919
+ box-shadow: none;
2920
+ background-color: transparent;
2921
+ border: none;
2922
+ `};
2973
2923
  `;
2974
2924
 
2975
- var _path$t;
2976
- function _extends$x() { _extends$x = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); }
2977
- const SvgBoldStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$x({
2925
+ var _path$u;
2926
+ function _extends$z() { _extends$z = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$z.apply(this, arguments); }
2927
+ const SvgBoldStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$z({
2978
2928
  xmlns: "http://www.w3.org/2000/svg",
2979
2929
  width: 16,
2980
2930
  height: 16,
2981
2931
  focusable: "false",
2982
2932
  viewBox: "0 0 16 16"
2983
- }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
2933
+ }, props), _path$u || (_path$u = /*#__PURE__*/React__namespace.createElement("path", {
2984
2934
  fill: "currentColor",
2985
2935
  d: "M7 1c2.176 0 4 1.824 4 4 0 1.315-.666 2.501-1.673 3.234C10.869 8.792 12 10.287 12 12c0 2.176-1.824 4-4 4H3.5a.5.5 0 01-.5-.5v-14a.5.5 0 01.5-.5H7zM4 15h4c1.624 0 3-1.376 3-3S9.624 9 8 9H4v6zM7 2H4v6h3c1.624 0 3-1.376 3-3S8.624 2 7 2z"
2986
2936
  })));
2987
2937
 
2988
- var _path$s;
2989
- function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
2990
- const SvgItalicStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
2938
+ var _path$t;
2939
+ function _extends$y() { _extends$y = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$y.apply(this, arguments); }
2940
+ const SvgItalicStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$y({
2991
2941
  xmlns: "http://www.w3.org/2000/svg",
2992
2942
  width: 16,
2993
2943
  height: 16,
2994
2944
  focusable: "false",
2995
2945
  viewBox: "0 0 16 16"
2996
- }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
2946
+ }, props), _path$t || (_path$t = /*#__PURE__*/React__namespace.createElement("path", {
2997
2947
  fill: "none",
2998
2948
  stroke: "currentColor",
2999
2949
  strokeLinecap: "round",
3000
2950
  d: "M7.5 1.5h3M9 1.5l-3 14m-1.5 0h3"
3001
2951
  })));
3002
2952
 
3003
- var _path$r;
3004
- function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
3005
- const SvgAtStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
2953
+ var _path$s;
2954
+ function _extends$x() { _extends$x = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$x.apply(this, arguments); }
2955
+ const SvgAtStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$x({
3006
2956
  xmlns: "http://www.w3.org/2000/svg",
3007
2957
  width: 16,
3008
2958
  height: 16,
3009
2959
  focusable: "false",
3010
2960
  role: "presentation"
3011
- }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
2961
+ }, props), _path$s || (_path$s = /*#__PURE__*/React__namespace.createElement("path", {
3012
2962
  fill: "none",
3013
2963
  stroke: "currentColor",
3014
2964
  strokeLinecap: "round",
3015
2965
  d: "M11.5 4.5V8h0A3.5 3.5 0 018 11.5h0A3.5 3.5 0 014.5 8h0A3.5 3.5 0 018 4.5h0A3.5 3.5 0 0111.5 8h0v1.5a2 2 0 002 2h0a2 2 0 002-2V8h0A7.5 7.5 0 008 .5h0A7.5 7.5 0 00.5 8h0A7.5 7.5 0 008 15.5h3.41"
3016
2966
  })));
3017
2967
 
3018
- var _path$q;
3019
- function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
3020
- const SvgClipboard = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
2968
+ var _path$r;
2969
+ function _extends$w() { _extends$w = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$w.apply(this, arguments); }
2970
+ const SvgClipboard = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$w({
3021
2971
  xmlns: "http://www.w3.org/2000/svg",
3022
2972
  width: 16,
3023
2973
  height: 16,
3024
2974
  focusable: "false",
3025
2975
  role: "presentation"
3026
- }, props), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
2976
+ }, props), _path$r || (_path$r = /*#__PURE__*/React__namespace.createElement("path", {
3027
2977
  fill: "none",
3028
2978
  stroke: "currentColor",
3029
2979
  strokeLinecap: "round",
3030
2980
  d: "M9.5 4v7.7c0 .8-.7 1.5-1.5 1.5s-1.5-.7-1.5-1.5V3C6.5 1.6 7.6.5 9 .5s2.5 1.1 2.5 2.5v9c0 1.9-1.6 3.5-3.5 3.5S4.5 13.9 4.5 12V4"
3031
2981
  })));
3032
2982
 
3033
- const MenuContainer = styled__default["default"].div `
3034
- padding: ${({ theme }) => theme.space.xs} 0;
3035
- display: flex;
3036
- flex-direction: row;
3037
- justify-content: flex-start;
3038
- align-items: center;
3039
- gap: ${({ theme }) => theme.space.xxs};
2983
+ const UgClose$1 = styled__default["default"](reactNotifications.Close) `
2984
+ display: flex;
2985
+ align-items: center;
2986
+ justify-content: center;
2987
+ width: ${({ theme }) => theme.space.xl};
2988
+ height: ${({ theme }) => theme.space.xl};
3040
2989
  `;
3041
- const VerticalDivider = styled__default["default"].div `
3042
- width: 2px;
3043
- height: 24px;
3044
- background-color: ${({ theme }) => theme.palette.grey[300]};
3045
- margin: 0 ${({ theme }) => theme.space.xs};
2990
+ /**
2991
+ * Title is a basic component used to display a title. Often used in card headers.
2992
+ */
2993
+ const Close = (props) => jsxRuntime.jsx(UgClose$1, Object.assign({}, props));
2994
+
2995
+ const NOTIFICATION_COMPONENT_ID = "notifications.notification";
2996
+ const CLOSE_COMPONENT_ID = "notifications.notification.close";
2997
+ const CLOSE_ICON_COMPONENT_ID = "notifications.notification.close-icon";
2998
+ const TITLE_COMPONENT_ID = "notifications.notification.title";
2999
+ const UgClose = styled__default["default"](Close).attrs((props) => {
3000
+ var _a;
3001
+ return ({
3002
+ "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_ICON_COMPONENT_ID,
3003
+ });
3004
+ }) `
3005
+ ${(props) => reactTheming.retrieveComponentStyles(CLOSE_ICON_COMPONENT_ID, props)};
3046
3006
  `;
3047
- const CommentBar = ({ editor, i18n, }) => {
3048
- var _a, _b, _c, _d, _e, _f, _g, _h;
3049
- const { addThumbnails } = useChatContext();
3050
- if (!editor)
3051
- return null;
3052
- const getIcon = (type) => {
3053
- switch (type) {
3054
- case "bold":
3055
- return jsxRuntime.jsx(SvgBoldStroke, {});
3056
- case "italic":
3057
- return jsxRuntime.jsx(SvgItalicStroke, {});
3058
- case "mention":
3059
- return jsxRuntime.jsx(SvgAtStroke, {});
3060
- case "attachment":
3061
- return jsxRuntime.jsx(SvgClipboard, {});
3062
- default:
3063
- return null;
3064
- }
3065
- };
3066
- const handleClick = (type) => {
3067
- switch (type) {
3068
- case "bold":
3069
- return editor.chain().focus().toggleBold().run();
3070
- case "italic":
3071
- return editor.chain().focus().toggleItalic().run();
3072
- case "mention":
3073
- const { from } = editor.state.selection;
3074
- const char = from > 1 ? " @" : "@";
3075
- return editor.chain().focus().insertContent(char).run();
3076
- case "attachment":
3077
- //open a file browser to select one or more images
3078
- const fileInput = document.createElement("input");
3079
- fileInput.type = "file";
3080
- fileInput.accept = "image/*,video/*";
3081
- fileInput.multiple = true;
3082
- fileInput.click();
3083
- fileInput.onchange = () => {
3084
- const files = fileInput.files;
3085
- if (files) {
3086
- const mediaFiles = Array.from(files).map((file) => {
3087
- return Object.assign(file, { isLoadingMedia: false });
3088
- });
3089
- if (mediaFiles.length === 0)
3090
- return;
3091
- addThumbnails({ files: mediaFiles });
3092
- }
3093
- };
3094
- return;
3095
- default:
3096
- return;
3097
- }
3098
- };
3099
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(MenuContainer, Object.assign({ id: "menu-container" }, { children: [jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _a === void 0 ? void 0 : _a.bold) !== null && _b !== void 0 ? _b : "Bold text"} ${isMac() ? "Cmd" : "Ctrl"} + B`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("bold"), isPrimary: editor.isActive("bold"), isPill: false, onClick: () => handleClick("bold") }, { children: getIcon("bold") })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_d = (_c = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _c === void 0 ? void 0 : _c.italic) !== null && _d !== void 0 ? _d : "Italic text"} ${isMac() ? "Cmd" : "Ctrl"} + I`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("italic"), isPrimary: editor.isActive("italic"), isPill: false, onClick: () => handleClick("italic") }, { children: getIcon("italic") })) })), jsxRuntime.jsx(VerticalDivider, {}), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_f = (_e = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _e === void 0 ? void 0 : _e.mention) !== null && _f !== void 0 ? _f : "Add a mention", placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("mention"), isPrimary: editor.isActive("mention"), isPill: false, onClick: () => handleClick("mention") }, { children: getIcon("mention") })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_h = (_g = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _g === void 0 ? void 0 : _g.attachment) !== null && _h !== void 0 ? _h : "Upload images and video. Max size: 5GB", placement: "top", type: "light", size: "small", hasArrow: true }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("attachment"), isPrimary: editor.isActive("attachment"), isPill: false, onClick: () => handleClick("attachment") }, { children: getIcon("attachment") })) }))] })) }));
3100
- };
3007
+ const UgAnchor = styled__default["default"](reactButtons.Anchor).attrs((props) => {
3008
+ var _a;
3009
+ return ({
3010
+ "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : CLOSE_COMPONENT_ID,
3011
+ });
3012
+ }) `
3013
+ ${(props) => reactTheming.retrieveComponentStyles(CLOSE_COMPONENT_ID, props)};
3014
+ `;
3015
+ const UgTitle = styled__default["default"](Title$1).attrs((props) => {
3016
+ var _a;
3017
+ return ({
3018
+ "data-custom-id": (_a = props["data-custom-id"]) !== null && _a !== void 0 ? _a : TITLE_COMPONENT_ID,
3019
+ });
3020
+ }) `
3021
+ ${(props) => reactTheming.retrieveComponentStyles(TITLE_COMPONENT_ID, props)};
3022
+ `;
3023
+ const UgNotification = styled__default["default"](reactNotifications.Notification) `
3024
+ display: flex;
3025
+ align-items: center;
3026
+ justify-content: space-between;
3027
+ padding-right: ${({ theme }) => theme.space.md};
3028
+ white-space: pre;
3101
3029
 
3102
- const CustomMention = Mention__default["default"].extend({
3103
- addAttributes() {
3104
- return {
3030
+ ${UgAnchor} {
3031
+ flex-shrink: 0;
3032
+ margin-left: ${({ theme }) => theme.space.md};
3033
+ }
3034
+
3035
+ ${(props) => reactTheming.retrieveComponentStyles(NOTIFICATION_COMPONENT_ID, props)};
3036
+ `;
3037
+ /**
3038
+ * A Notification is a passive status update that keeps users informed of system progress.
3039
+ * <hr>
3040
+ * Used for this:
3041
+ - For a passive status update about user or system activity
3042
+ */
3043
+ const Notification = (_a) => {
3044
+ var { closeText, message, onClose, type, isPrimary, isRegular } = _a, props = __rest(_a, ["closeText", "message", "onClose", "type", "isPrimary", "isRegular"]);
3045
+ return (jsxRuntime.jsxs(UgNotification, Object.assign({ type: type, isPrimary: isPrimary }, props, { children: [jsxRuntime.jsx(UgTitle, Object.assign({ isRegular: isRegular, type: type, isPrimary: isPrimary }, { children: message })), jsxRuntime.jsx(UgAnchor, Object.assign({ type: type, isPrimary: isPrimary, onClick: onClose }, { children: closeText !== null && closeText !== void 0 ? closeText : jsxRuntime.jsx(UgClose, {}) }))] })));
3046
+ };
3047
+ // ToastProvider
3048
+ const ToastProvider = (props) => (jsxRuntime.jsx(reactNotifications.ToastProvider, Object.assign({}, props)));
3049
+ const useToast = reactNotifications.useToast;
3050
+
3051
+ const acceptedMediaTypes = /^(image|video)\//;
3052
+ function useMedia() {
3053
+ const { addToast } = useToast();
3054
+ function getValidMedia(data) {
3055
+ const wrongFiles = Array.from(data).filter((file) => !acceptedMediaTypes.test(file.type));
3056
+ if (wrongFiles.length) {
3057
+ addToast(({ close }) => (jsxRuntime.jsx(Notification, { onClose: close, type: "error", message: wrongFiles.length === 1
3058
+ ? `${wrongFiles[0].name} not supported, please upload video or image only`
3059
+ : "Some attachments are not supported, please upload video or image only", isPrimary: true })), { placement: "top" });
3060
+ }
3061
+ return Array.from(data).filter((file) => acceptedMediaTypes.test(file.type));
3062
+ }
3063
+ function getMedia(data) {
3064
+ return getValidMedia(data).map((file) => {
3065
+ return Object.assign(file, {
3066
+ url: URL.createObjectURL(file),
3067
+ isLoadingMedia: true,
3068
+ id: uuid.v4(),
3069
+ });
3070
+ });
3071
+ }
3072
+ return { getMedia };
3073
+ }
3074
+
3075
+ const MenuContainer = styled__default["default"].div `
3076
+ padding: ${({ theme }) => theme.space.xs} 0;
3077
+ display: flex;
3078
+ flex-direction: row;
3079
+ justify-content: flex-start;
3080
+ align-items: center;
3081
+ gap: ${({ theme }) => theme.space.xxs};
3082
+ `;
3083
+ const VerticalDivider = styled__default["default"].div `
3084
+ width: 2px;
3085
+ height: 24px;
3086
+ background-color: ${({ theme }) => theme.palette.grey[300]};
3087
+ margin: 0 ${({ theme }) => theme.space.xs};
3088
+ `;
3089
+ const CommentBar = ({ editor, i18n, }) => {
3090
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3091
+ const { addThumbnails } = useChatContext();
3092
+ const { getMedia } = useMedia();
3093
+ if (!editor)
3094
+ return null;
3095
+ const handleBoldClick = () => {
3096
+ editor.chain().focus().toggleBold().run();
3097
+ };
3098
+ const handleItalicClick = () => {
3099
+ editor.chain().focus().toggleItalic().run();
3100
+ };
3101
+ const handleMentionClick = () => {
3102
+ const { from } = editor.state.selection;
3103
+ const char = from > 1 ? " @" : "@";
3104
+ editor.chain().focus().insertContent(char).run();
3105
+ };
3106
+ const handleAttachmentClick = () => {
3107
+ const fileInput = document.createElement("input");
3108
+ fileInput.type = "file";
3109
+ fileInput.accept = "image/*,video/*";
3110
+ fileInput.multiple = true;
3111
+ fileInput.click();
3112
+ fileInput.onchange = () => {
3113
+ if (fileInput.files) {
3114
+ addThumbnails({ files: getMedia(fileInput.files) });
3115
+ }
3116
+ };
3117
+ };
3118
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(MenuContainer, Object.assign({ id: "menu-container" }, { children: [jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_b = (_a = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _a === void 0 ? void 0 : _a.bold) !== null && _b !== void 0 ? _b : "Bold text"} ${isMac() ? "Cmd" : "Ctrl"} + B`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("bold"), isPrimary: editor.isActive("bold"), isPill: false, onClick: handleBoldClick }, { children: jsxRuntime.jsx(SvgBoldStroke, {}) })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: `${(_d = (_c = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _c === void 0 ? void 0 : _c.italic) !== null && _d !== void 0 ? _d : "Italic text"} ${isMac() ? "Cmd" : "Ctrl"} + I`, placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("italic"), isPrimary: editor.isActive("italic"), isPill: false, onClick: handleItalicClick }, { children: jsxRuntime.jsx(SvgItalicStroke, {}) })) })), jsxRuntime.jsx(VerticalDivider, {}), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_f = (_e = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _e === void 0 ? void 0 : _e.mention) !== null && _f !== void 0 ? _f : "Add a mention", placement: "top", type: "light", size: "small", hasArrow: false }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("mention"), isPrimary: editor.isActive("mention"), isPill: false, onClick: handleMentionClick }, { children: jsxRuntime.jsx(SvgAtStroke, {}) })) })), jsxRuntime.jsx(Tooltip, Object.assign({ content: (_h = (_g = i18n === null || i18n === void 0 ? void 0 : i18n.menu) === null || _g === void 0 ? void 0 : _g.attachment) !== null && _h !== void 0 ? _h : (jsxRuntime.jsxs("span", { children: ["Upload images and video.", " ", jsxRuntime.jsxs("span", Object.assign({ style: { color: theme.palette.grey[600] } }, { children: [" ", jsxRuntime.jsx("br", {}), " Max size: 5GB", " "] }))] })), placement: "top", type: "light", size: "small", hasArrow: true }, { children: jsxRuntime.jsx(IconButton, Object.assign({ size: "small", isBasic: !editor.isActive("attachment"), isPrimary: editor.isActive("attachment"), isPill: false, onClick: handleAttachmentClick }, { children: jsxRuntime.jsx(SvgClipboard, {}) })) }))] })) }));
3119
+ };
3120
+
3121
+ const CustomMention = Mention__default["default"].extend({
3122
+ addAttributes() {
3123
+ return {
3105
3124
  id: {
3106
3125
  default: null,
3107
3126
  parseHTML: (element) => element.getAttribute("data-mention-id"),
@@ -3273,7 +3292,7 @@ const editorExtensions = ({ placeholderOptions, mentionableUsers, }) => {
3273
3292
  },
3274
3293
  }),
3275
3294
  Dropcursor__default["default"].configure({
3276
- color: "#ff0000",
3295
+ color: getColor(colors.accentHue, 700),
3277
3296
  width: 3,
3278
3297
  }),
3279
3298
  Placeholder__default["default"].configure(Object.assign({ placeholder: ({ node }) => {
@@ -3345,20 +3364,20 @@ const editorExtensions = ({ placeholderOptions, mentionableUsers, }) => {
3345
3364
  ];
3346
3365
  };
3347
3366
 
3348
- var _circle$2, _path$p, _path2$6;
3349
- function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
3350
- const SvgRemoveMediaIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
3367
+ var _circle$3, _path$q, _path2$6;
3368
+ function _extends$v() { _extends$v = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$v.apply(this, arguments); }
3369
+ const SvgRemoveMediaIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$v({
3351
3370
  width: 56,
3352
3371
  height: 56,
3353
3372
  viewBox: "0 0 56 56",
3354
3373
  fill: "#68737d",
3355
3374
  xmlns: "http://www.w3.org/2000/svg"
3356
- }, props), _circle$2 || (_circle$2 = /*#__PURE__*/React__namespace.createElement("circle", {
3375
+ }, props), _circle$3 || (_circle$3 = /*#__PURE__*/React__namespace.createElement("circle", {
3357
3376
  cx: 28,
3358
3377
  cy: 28,
3359
3378
  r: 28,
3360
3379
  fill: "#edf7ff"
3361
- })), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
3380
+ })), _path$q || (_path$q = /*#__PURE__*/React__namespace.createElement("path", {
3362
3381
  d: "M16.929 16.929L39.071 39.071",
3363
3382
  stroke: "currentColor",
3364
3383
  strokeWidth: 4
@@ -3377,72 +3396,36 @@ const StyledDeleteThumbnailX = styled__default["default"].div `
3377
3396
  width: 32px;
3378
3397
  height: 32px;
3379
3398
  opacity: 0;
3399
+ transition: opacity 0.2s;
3380
3400
  z-index: 2;
3381
3401
  `;
3382
3402
  const DeleteThumbnailX = ({ deleteThumbnail }) => {
3383
3403
  return (jsxRuntime.jsx(StyledDeleteThumbnailX, Object.assign({ className: "deleteThumbnail" }, { children: jsxRuntime.jsx(SvgRemoveMediaIcon, { onClick: (e) => deleteThumbnail(e) }) })));
3384
3404
  };
3385
3405
 
3386
- const ImageCard = styled__default["default"](SpecialCard) `
3387
- padding: 0;
3388
- :hover .deleteThumbnail {
3389
- opacity: 1;
3390
- }
3391
- `;
3392
- const Preview$1 = styled__default["default"].div `
3393
- display: flex;
3394
- justify-content: center;
3395
- align-items: center;
3396
- height: 150px;
3397
- width: 100%;
3398
- background-image: url(${(props) => props.url});
3399
- background-color: ${({ theme }) => theme.palette.grey[100]};
3400
- background-size: contain;
3401
- background-position: center;
3402
- background-repeat: no-repeat;
3403
- `;
3404
- const ImageThumbnail = ({ src, index = 0, removeThumbnail, clickThumbnail, showX = true, isLoadingMedia = false, isError = false, }) => {
3405
- const handleCancel = (e) => {
3406
- e.stopPropagation();
3407
- if (removeThumbnail)
3408
- removeThumbnail(index);
3409
- };
3410
- return (jsxRuntime.jsxs(ImageCard, Object.assign({ onClick: clickThumbnail }, { children: [isLoadingMedia && (jsxRuntime.jsx(Preview$1, Object.assign({ url: "" }, { children: jsxRuntime.jsx(reactLoaders.Spinner, { style: {
3411
- display: "flex",
3412
- alignItems: "center",
3413
- justifyContent: "center",
3414
- }, size: "large" }) }))), isError && (
3415
- // todo: add error icon
3416
- jsxRuntime.jsx("span", { children: "error uploading media" })), !isLoadingMedia && (jsxRuntime.jsx(Preview$1, Object.assign({ url: src }, { children: showX && (jsxRuntime.jsx(DeleteThumbnailX, { deleteThumbnail: (e) => handleCancel(e) })) })))] })));
3417
- };
3418
-
3419
- var _circle$1, _path$o;
3420
- function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
3421
- const SvgVideoPlayIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
3406
+ var _circle$2, _path$p;
3407
+ function _extends$u() { _extends$u = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$u.apply(this, arguments); }
3408
+ const SvgVideoPlayIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$u({
3422
3409
  width: 56,
3423
3410
  height: 56,
3424
3411
  viewBox: "0 0 56 56",
3425
3412
  fill: "none",
3426
3413
  xmlns: "http://www.w3.org/2000/svg"
3427
- }, props), _circle$1 || (_circle$1 = /*#__PURE__*/React__namespace.createElement("circle", {
3414
+ }, props), _circle$2 || (_circle$2 = /*#__PURE__*/React__namespace.createElement("circle", {
3428
3415
  cx: 28,
3429
3416
  cy: 28,
3430
3417
  r: 28,
3431
3418
  fill: "white"
3432
- })), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
3419
+ })), _path$p || (_path$p = /*#__PURE__*/React__namespace.createElement("path", {
3433
3420
  d: "M47 28L18.5 44.4545L18.5 11.5455L47 28Z",
3434
3421
  fill: "currentColor"
3435
3422
  })));
3436
3423
 
3437
- const VideoCard = styled__default["default"](SpecialCard) `
3424
+ const ImageCard = styled__default["default"](SpecialCard) `
3438
3425
  padding: 0;
3439
3426
  position: relative;
3440
3427
  overflow: hidden;
3441
-
3442
- &:hover .deleteThumbnail {
3443
- opacity: 1;
3444
- z-index: 9999;
3445
- }
3428
+ min-width: 90px;
3446
3429
 
3447
3430
  &:before {
3448
3431
  content: "";
@@ -3452,98 +3435,93 @@ const VideoCard = styled__default["default"](SpecialCard) `
3452
3435
  width: 100%;
3453
3436
  height: 100%;
3454
3437
  background-color: ${({ theme }) => theme.palette.grey[800]};
3455
- opacity: 0.3;
3438
+ opacity: 0;
3439
+ transition: opacity 0.2s;
3456
3440
  z-index: 1;
3457
3441
  }
3458
3442
 
3459
- > svg {
3460
- position: absolute;
3461
- top: 50%;
3462
- left: 50%;
3463
- transform: translate(-50%, -50%);
3464
- width: 32px;
3465
- height: 32px;
3466
- z-index: 2;
3443
+ &:hover {
3444
+ .deleteThumbnail {
3445
+ opacity: 1;
3446
+ }
3447
+ &:before {
3448
+ opacity: 0.3;
3449
+ }
3450
+ }
3451
+
3452
+ &.video {
3453
+ svg {
3454
+ position: absolute;
3455
+ top: 50%;
3456
+ left: 50%;
3457
+ transform: translate(-50%, -50%);
3458
+ width: 32px;
3459
+ height: 32px;
3460
+ z-index: 2;
3461
+ }
3467
3462
  }
3468
3463
  `;
3469
3464
  const Preview = styled__default["default"].div `
3470
- padding: ${({ theme }) => theme.space.md};
3471
3465
  display: flex;
3472
3466
  justify-content: center;
3473
3467
  align-items: center;
3474
- height: 150px;
3468
+ height: 100px;
3475
3469
  width: 100%;
3476
3470
 
3471
+ ${(p) => p.url &&
3472
+ `
3473
+ background-image: url(${p.url});
3474
+ background-color: ${p.theme.palette.grey[100]};
3475
+ background-size: cover;
3476
+ background-position: center;
3477
+ background-repeat: no-repeat;
3478
+ `}
3479
+
3477
3480
  > video {
3478
3481
  width: 100%;
3479
3482
  height: 100%;
3480
3483
  }
3481
3484
  `;
3482
- const VideoThumbnail = ({ src, index = 0, removeThumbnail, clickThumbnail, showX = true, isLoadingMedia = false, isError = false, }) => {
3485
+ const Thumbnail = ({ src, type, removeThumbnail, clickThumbnail, showX, isLoadingMedia = true, isError = false, }) => {
3483
3486
  const handleCancel = (e) => {
3484
3487
  e.stopPropagation();
3485
3488
  if (removeThumbnail)
3486
- removeThumbnail(index);
3489
+ removeThumbnail();
3487
3490
  };
3488
- return (jsxRuntime.jsxs(VideoCard, Object.assign({ onClick: clickThumbnail }, { children: [isLoadingMedia && (jsxRuntime.jsx(Preview, { children: jsxRuntime.jsx(reactLoaders.Spinner, { style: {
3491
+ return (jsxRuntime.jsxs(ImageCard, Object.assign({ onClick: clickThumbnail, className: type.includes("video") ? "video" : "image" }, { children: [isError && (
3492
+ // todo: add error icon
3493
+ jsxRuntime.jsx("span", { children: "error uploading media" })), isLoadingMedia ? (jsxRuntime.jsx(Preview, { children: jsxRuntime.jsx(reactLoaders.Spinner, { style: {
3489
3494
  display: "flex",
3490
3495
  alignItems: "center",
3491
3496
  justifyContent: "center",
3492
- }, size: "large" }) })), isError && (
3493
- // todo: add error icon
3494
- jsxRuntime.jsx("span", { children: "error uploading media" })), !isLoadingMedia && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showX && (jsxRuntime.jsx(DeleteThumbnailX, { deleteThumbnail: (e) => handleCancel(e) })), jsxRuntime.jsx(Preview, { children: jsxRuntime.jsx("video", Object.assign({ src: src }, { children: jsxRuntime.jsx("track", { kind: "captions" }) })) }), jsxRuntime.jsx(SvgVideoPlayIcon, {})] }))] })));
3497
+ }, size: "large" }) })) : (jsxRuntime.jsxs(Preview, Object.assign({ url: src }, { children: [showX && (jsxRuntime.jsx(DeleteThumbnailX, { deleteThumbnail: (e) => handleCancel(e) })), type.includes("video") && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("video", Object.assign({ src: src }, { children: jsxRuntime.jsx("track", { kind: "captions" }) })), jsxRuntime.jsx(SvgVideoPlayIcon, {})] }))] })))] })));
3495
3498
  };
3496
3499
 
3497
- const UgGrid = styled__default["default"](reactGrid.Grid) `
3498
- padding-left: 0;
3499
- padding-right: 0;
3500
- `;
3501
- /**
3502
- * The Grid component is a framework for building modular layouts.
3503
- * <hr>
3504
- * Used for this:
3505
- - To structure the layout of a page
3506
- */
3507
- const Grid = (props) => jsxRuntime.jsx(UgGrid, Object.assign({}, props));
3508
-
3509
- const Row$1 = (props) => jsxRuntime.jsx(reactGrid.Row, Object.assign({}, props));
3510
-
3511
- const StyledCol$1 = styled__default["default"](reactGrid.Col) `
3512
- margin-bottom: ${theme.space.lg};
3513
-
3514
- @media screen and (max-width: ${theme.breakpoints.sm}) {
3515
- margin-bottom: ${theme.space.md};
3516
- }
3500
+ const FlexContainer = styled.styled.div `
3501
+ display: flex;
3502
+ gap: ${({ theme }) => theme.space.xs};
3503
+ flex-wrap: wrap;
3517
3504
  `;
3518
- const Col = (props) => jsxRuntime.jsx(StyledCol$1, Object.assign({}, props));
3519
-
3520
3505
  const ThumbnailContainer = ({ openLightbox }) => {
3521
- const { thumbnails, removeThumbnail } = useChatContext();
3522
- if (!thumbnails || thumbnails.length === 0) {
3523
- return null;
3524
- }
3525
- const mediaFiles = [];
3526
- thumbnails.forEach((file) => {
3527
- mediaFiles.push({
3506
+ const { thumbnails, removeThumbnail, onDeleteThumbnail } = useChatContext();
3507
+ const mediaFiles = React.useMemo(() => {
3508
+ return thumbnails.map((file) => ({
3528
3509
  fileName: file.name,
3529
3510
  fileType: file.type,
3530
- status: file.isLoadingMedia ? "uploading" : "success",
3531
- previewUrl: URL.createObjectURL(file),
3532
- });
3533
- });
3534
- console.log("mediafiles", mediaFiles);
3535
- return (jsxRuntime.jsx(Grid, { children: jsxRuntime.jsx(Row$1, Object.assign({ className: "responsive-container" }, { children: mediaFiles.map((file, index) => {
3536
- // Check if item is an image or a video
3537
- if (file.fileType.includes('image'))
3538
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 3, className: "flex-3-sm" }, { children: jsxRuntime.jsx(ImageThumbnail, { src: file.previewUrl, index: index, showX: true, isLoadingMedia: file.status === "uploading", removeThumbnail: () => removeThumbnail(index), clickThumbnail: () => {
3539
- openLightbox(thumbnails[index], index);
3540
- } }, index) })));
3541
- if (file.fileType.includes('video'))
3542
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 3, className: "flex-3-sm" }, { children: jsxRuntime.jsx(VideoThumbnail, { src: file.previewUrl, index: index, showX: true, isLoadingMedia: file.status === "uploading", removeThumbnail: () => removeThumbnail(index), clickThumbnail: () => {
3543
- openLightbox(thumbnails[index], index);
3544
- } }, index) })));
3545
- return null;
3546
- }) })) }));
3511
+ previewUrl: file.url,
3512
+ id: file.id,
3513
+ isLoadingMedia: file.isLoadingMedia,
3514
+ }));
3515
+ }, [thumbnails]);
3516
+ if (!mediaFiles || mediaFiles.length === 0) {
3517
+ return null;
3518
+ }
3519
+ return (jsxRuntime.jsx(FlexContainer, { children: mediaFiles.map((file, index) => (jsxRuntime.jsx(Thumbnail, { src: file.previewUrl, showX: true, type: file.fileType, isLoadingMedia: file.isLoadingMedia, removeThumbnail: () => {
3520
+ removeThumbnail(index);
3521
+ onDeleteThumbnail(file.id);
3522
+ }, clickThumbnail: () => {
3523
+ openLightbox(index);
3524
+ } }, file.id))) }));
3547
3525
  };
3548
3526
 
3549
3527
  const UgModalBody = styled__default["default"](reactModals.Body) `
@@ -3612,28 +3590,28 @@ Lightbox.Body = ModalBody; // Includes Main and Details
3612
3590
  Lightbox.Footer = Footer$3;
3613
3591
  Lightbox.Close = reactModals.Close;
3614
3592
 
3615
- var _path$n;
3616
- function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3617
- const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3593
+ var _path$o;
3594
+ function _extends$t() { _extends$t = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$t.apply(this, arguments); }
3595
+ const SvgChevronLeftStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$t({
3618
3596
  xmlns: "http://www.w3.org/2000/svg",
3619
3597
  width: 16,
3620
3598
  height: 16,
3621
3599
  focusable: "false",
3622
3600
  viewBox: "0 0 16 16"
3623
- }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3601
+ }, props), _path$o || (_path$o = /*#__PURE__*/React__namespace.createElement("path", {
3624
3602
  fill: "currentColor",
3625
3603
  d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
3626
3604
  })));
3627
3605
 
3628
- var _path$m;
3629
- function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
3630
- const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3606
+ var _path$n;
3607
+ function _extends$s() { _extends$s = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$s.apply(this, arguments); }
3608
+ const SvgChevronRightStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$s({
3631
3609
  xmlns: "http://www.w3.org/2000/svg",
3632
3610
  width: 16,
3633
3611
  height: 16,
3634
3612
  focusable: "false",
3635
3613
  viewBox: "0 0 16 16"
3636
- }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3614
+ }, props), _path$n || (_path$n = /*#__PURE__*/React__namespace.createElement("path", {
3637
3615
  fill: "currentColor",
3638
3616
  d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
3639
3617
  })));
@@ -3856,44 +3834,26 @@ Slider.Slide = Slide;
3856
3834
  Slider.PrevButton = PrevButton;
3857
3835
  Slider.NextButton = NextButton;
3858
3836
 
3859
- const UgProgress = styled__default["default"](reactLoaders.Progress) ``;
3860
- /**
3861
- * A Progress loader communicates progress when downloading or uploading content.
3862
- * <hr>
3863
- * Used for this:
3864
- * - To communicate the amount of time left when downloading or uploading content
3865
- *
3866
- Not for this:
3867
- - When the loading time is unknown, use a Spinner instead
3868
- - When loading page content, use a Skeleton loader instead
3869
- */
3870
- const Progress = React.forwardRef((props, ref) => (jsxRuntime.jsx(UgProgress, Object.assign({ ref: ref }, props))));
3871
-
3872
- const Wrapper$1 = styled__default["default"].div `
3873
- position: absolute;
3874
- bottom: ${({ theme }) => theme.space.sm};
3875
- z-index: 1;
3876
- `;
3877
- const Content$1 = styled__default["default"].div `
3878
- display: flex;
3879
- background-color: ${({ theme }) => theme.palette.grey[800]};
3880
- border-radius: 2px;
3881
- width: auto;
3882
- padding: 2px 4px;
3883
- display: inline-flex;
3884
- color: white;
3885
- align-items: center;
3886
- justify-content: center;
3887
- min-height: 16px;
3888
- `;
3889
- const PlayerTooltip = (_a) => {
3890
- var { children } = _a, props = __rest(_a, ["children"]);
3891
- return (jsxRuntime.jsx(Wrapper$1, Object.assign({}, props, { children: jsxRuntime.jsx(Content$1, { children: children }) })));
3892
- };
3837
+ var _path$m, _path2$5;
3838
+ function _extends$r() { _extends$r = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$r.apply(this, arguments); }
3839
+ const SvgVolumeMutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$r({
3840
+ xmlns: "http://www.w3.org/2000/svg",
3841
+ width: 16,
3842
+ height: 16,
3843
+ focusable: "false",
3844
+ viewBox: "0 0 16 16"
3845
+ }, props), _path$m || (_path$m = /*#__PURE__*/React__namespace.createElement("path", {
3846
+ stroke: "currentColor",
3847
+ strokeLinecap: "round",
3848
+ d: "M11.5 10l4-4m-4 0l4 4"
3849
+ })), _path2$5 || (_path2$5 = /*#__PURE__*/React__namespace.createElement("path", {
3850
+ fill: "currentColor",
3851
+ d: "M9 15.29c-.26 0-.51-.1-.71-.29l-4-4H1c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h3.29l4-4a1.002 1.002 0 011.71.71V14.3a.986.986 0 01-1 .99z"
3852
+ })));
3893
3853
 
3894
- var _path$l;
3895
- function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
3896
- const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3854
+ var _path$l, _path2$4;
3855
+ function _extends$q() { _extends$q = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$q.apply(this, arguments); }
3856
+ const SvgVolumeUnmutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$q({
3897
3857
  xmlns: "http://www.w3.org/2000/svg",
3898
3858
  width: 16,
3899
3859
  height: 16,
@@ -3901,38 +3861,241 @@ const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg",
3901
3861
  viewBox: "0 0 16 16"
3902
3862
  }, props), _path$l || (_path$l = /*#__PURE__*/React__namespace.createElement("path", {
3903
3863
  fill: "currentColor",
3904
- d: "M6 15.79c-.13 0-.26-.03-.38-.08a.977.977 0 01-.62-.92V1.21a1 1 0 01.62-.93C6 .12 6.42.21 6.71.5l6.44 6.44c.58.58.58 1.54 0 2.12L6.71 15.5c-.19.19-.45.29-.71.29z"
3864
+ d: "M9 15.29c-.26 0-.51-.1-.71-.29l-4-4H1c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h3.29l4-4a1.002 1.002 0 011.71.71V14.3a.986.986 0 01-1 .99z"
3865
+ })), _path2$4 || (_path2$4 = /*#__PURE__*/React__namespace.createElement("path", {
3866
+ fill: "none",
3867
+ stroke: "currentColor",
3868
+ strokeLinecap: "round",
3869
+ d: "M11.77 9.77c.45-.45.73-1.08.73-1.77s-.28-1.31-.73-1.77m2.17 5.6c.97-.99 1.56-2.34 1.56-3.83 0-1.52-.62-2.89-1.61-3.89"
3905
3870
  })));
3906
3871
 
3907
- var _g$1;
3908
- function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
3909
- const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
3872
+ const ControlButton = styled__default["default"](IconButton) `
3873
+ color: ${({ theme }) => theme.palette.grey[700]};
3874
+ `;
3875
+
3876
+ const AudioButton = () => {
3877
+ const [hasAudio, setHasAudio] = React.useState(false);
3878
+ const { isMuted, setMuted, context } = Video.useVideoContext();
3879
+ const { player } = context;
3880
+ const checkAudio = (video) => {
3881
+ if (!video) {
3882
+ return false;
3883
+ }
3884
+ const videohasAudio = video.mozHasAudio ||
3885
+ Boolean(video.webkitAudioDecodedByteCount) ||
3886
+ Boolean(video.audioTracks && video.audioTracks.length);
3887
+ setHasAudio(videohasAudio);
3888
+ };
3889
+ const hasVolume = (video) => {
3890
+ if (!video) {
3891
+ return false;
3892
+ }
3893
+ return video.volume > 0;
3894
+ };
3895
+ React.useEffect(() => {
3896
+ if (player && (player === null || player === void 0 ? void 0 : player.ref)) {
3897
+ setMuted(!hasVolume(player.ref.current));
3898
+ checkAudio(player.ref.current);
3899
+ }
3900
+ }, [context.isPlaying, isMuted, player, setMuted]);
3901
+ return (jsxRuntime.jsx(ControlButton, Object.assign({ disabled: !hasAudio, onClick: () => {
3902
+ if (player === null || player === void 0 ? void 0 : player.ref.current) {
3903
+ player.ref.current.volume = player.ref.current.volume > 0 ? 0 : 1;
3904
+ setMuted(!player.ref.current.volume);
3905
+ }
3906
+ } }, { children: isMuted || !hasAudio ? jsxRuntime.jsx(SvgVolumeMutedFill, {}) : jsxRuntime.jsx(SvgVolumeUnmutedFill, {}) })));
3907
+ };
3908
+
3909
+ const ProgressContext = React.createContext(null);
3910
+ const ProgressContextProvider = ({ children, }) => {
3911
+ const [isGrabbing, setIsGrabbing] = React.useState(false);
3912
+ const [fromEnd, setFromEnd] = React.useState(false);
3913
+ const [activeBookmark, setactiveBookmark] = React.useState(undefined);
3914
+ const progressContextValue = React.useMemo(() => ({
3915
+ isGrabbing,
3916
+ fromEnd,
3917
+ activeBookmark,
3918
+ setIsGrabbing,
3919
+ setFromEnd,
3920
+ setactiveBookmark,
3921
+ reset: () => {
3922
+ setIsGrabbing(false);
3923
+ setFromEnd(false);
3924
+ setactiveBookmark(undefined);
3925
+ },
3926
+ }), [isGrabbing, fromEnd, activeBookmark]);
3927
+ return (jsxRuntime.jsx(ProgressContext.Provider, Object.assign({ value: progressContextValue }, { children: children })));
3928
+ };
3929
+ const useProgressContext = () => {
3930
+ const context = React.useContext(ProgressContext);
3931
+ if (!context)
3932
+ throw new Error("Provider not found for ProgressContextProvider");
3933
+ return context; // Now we can use the context in the component, SAFELY.
3934
+ };
3935
+
3936
+ var _g$2;
3937
+ function _extends$p() { _extends$p = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$p.apply(this, arguments); }
3938
+ const SvgGrip = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$p({
3910
3939
  xmlns: "http://www.w3.org/2000/svg",
3911
3940
  width: 16,
3912
3941
  height: 16,
3913
3942
  focusable: "false",
3914
3943
  viewBox: "0 0 16 16"
3915
- }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
3944
+ }, props), _g$2 || (_g$2 = /*#__PURE__*/React__namespace.createElement("g", {
3916
3945
  fill: "currentColor"
3917
3946
  }, /*#__PURE__*/React__namespace.createElement("rect", {
3918
- width: 4,
3919
- height: 14,
3920
- x: 3,
3947
+ width: 2,
3948
+ height: 2,
3949
+ x: 5,
3921
3950
  y: 1,
3922
- rx: 1,
3923
- ry: 1
3951
+ rx: 0.5,
3952
+ ry: 0.5
3924
3953
  }), /*#__PURE__*/React__namespace.createElement("rect", {
3925
- width: 4,
3926
- height: 14,
3954
+ width: 2,
3955
+ height: 2,
3927
3956
  x: 9,
3928
3957
  y: 1,
3929
- rx: 1,
3930
- ry: 1
3958
+ rx: 0.5,
3959
+ ry: 0.5
3960
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
3961
+ width: 2,
3962
+ height: 2,
3963
+ x: 5,
3964
+ y: 5,
3965
+ rx: 0.5,
3966
+ ry: 0.5
3967
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
3968
+ width: 2,
3969
+ height: 2,
3970
+ x: 9,
3971
+ y: 5,
3972
+ rx: 0.5,
3973
+ ry: 0.5
3974
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
3975
+ width: 2,
3976
+ height: 2,
3977
+ x: 5,
3978
+ y: 9,
3979
+ rx: 0.5,
3980
+ ry: 0.5
3981
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
3982
+ width: 2,
3983
+ height: 2,
3984
+ x: 9,
3985
+ y: 9,
3986
+ rx: 0.5,
3987
+ ry: 0.5
3988
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
3989
+ width: 2,
3990
+ height: 2,
3991
+ x: 5,
3992
+ y: 13,
3993
+ rx: 0.5,
3994
+ ry: 0.5
3995
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
3996
+ width: 2,
3997
+ height: 2,
3998
+ x: 9,
3999
+ y: 13,
4000
+ rx: 0.5,
4001
+ ry: 0.5
3931
4002
  }))));
3932
4003
 
3933
- var _path$k, _path2$5, _path3$1;
3934
- function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
3935
- const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
4004
+ const StyledGrabber = styled.styled.div `
4005
+ position: absolute;
4006
+ display: none;
4007
+ ${({ isEnd }) => isEnd
4008
+ ? `
4009
+ right: 0;
4010
+ border-top-right-radius: 2px;
4011
+ border-bottom-right-radius: 2px;
4012
+ `
4013
+ : `
4014
+ left: 0;
4015
+ border-top-left-radius: 2px;
4016
+ border-bottom-left-radius: 2px;
4017
+ `}
4018
+ height: 100%;
4019
+ width: 8px;
4020
+ background-color: white;
4021
+ z-index: 2;
4022
+ cursor: ew-resize;
4023
+
4024
+ div {
4025
+ display: flex;
4026
+ justify-content: center;
4027
+ align-items: center;
4028
+ height: 100%;
4029
+ width: 100%;
4030
+ color: ${({ theme }) => theme.palette.grey[500]};
4031
+ svg {
4032
+ width: auto;
4033
+ height: 50%;
4034
+ }
4035
+ }
4036
+ `;
4037
+ const activeBookMark = styled.css `
4038
+ height: 250%;
4039
+ transform: translateY(-30%);
4040
+
4041
+ ${StyledGrabber} {
4042
+ display: block;
4043
+ }
4044
+ `;
4045
+ const Rect = styled.styled.div `
4046
+ position: absolute;
4047
+ height: 110%;
4048
+ background-color: ${({ hue, theme }) => hue || theme.palette.grey[800]};
4049
+ z-index: 1;
4050
+ border-radius: 2px;
4051
+ &:hover {
4052
+ ${activeBookMark}
4053
+ border-radius: 4px;
4054
+ }
4055
+ color: white;
4056
+ ${({ isActive }) => isActive && activeBookMark}
4057
+
4058
+ transition: width 0.1s ease;
4059
+ `;
4060
+ const StyledTooltip$1 = styled.styled(Tooltip) `
4061
+ margin-bottom: ${({ theme }) => theme.space.sm};
4062
+ color: ${({ tooltipColor }) => tooltipColor};
4063
+
4064
+ `;
4065
+ const Grabber = (props) => {
4066
+ const { observation } = props;
4067
+ const { setIsGrabbing, setactiveBookmark, setFromEnd } = useProgressContext();
4068
+ const handleDragStart = (e) => {
4069
+ setIsGrabbing(true);
4070
+ setactiveBookmark(observation);
4071
+ setFromEnd(!!props.isEnd);
4072
+ e.preventDefault();
4073
+ e.stopPropagation();
4074
+ };
4075
+ return (jsxRuntime.jsx(StyledGrabber, Object.assign({ isEnd: props.isEnd, onMouseDown: handleDragStart, onMouseMove: props.handleMouseMove }, { children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(SvgGrip, {}) }) })));
4076
+ };
4077
+ const Bookmark = (props) => {
4078
+ var _a, _b;
4079
+ const { start, end, hue, tooltipContent } = props;
4080
+ const { context } = Video.useVideoContext();
4081
+ const videoStart = context.part.start || 0;
4082
+ const videoEnd = context.part.end || ((_a = context.player) === null || _a === void 0 ? void 0 : _a.totalTime) || 0;
4083
+ const duration = videoEnd - videoStart || ((_b = context.player) === null || _b === void 0 ? void 0 : _b.totalTime) || 0; //relative
4084
+ const { activeBookmark } = useProgressContext();
4085
+ if (!context.player || !context.player.ref) {
4086
+ return null;
4087
+ }
4088
+ if (start > videoEnd || start < videoStart)
4089
+ return null;
4090
+ return (jsxRuntime.jsx(StyledTooltip$1, Object.assign({ content: tooltipContent, type: "light", size: "large", isTransparent: true }, { children: jsxRuntime.jsxs(Rect, Object.assign({ isActive: activeBookmark && activeBookmark.id === props.id, hue: hue, style: {
4091
+ left: `${((start - videoStart) / duration) * 100}%`,
4092
+ width: `${((end - start) / duration) * 100}%`,
4093
+ }, onClick: props.onClick }, { children: [jsxRuntime.jsx(Grabber, { observation: props }), jsxRuntime.jsx(Grabber, { isEnd: true, observation: props })] })) })));
4094
+ };
4095
+
4096
+ var _path$k, _path2$3, _path3$1;
4097
+ function _extends$o() { _extends$o = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$o.apply(this, arguments); }
4098
+ const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$o({
3936
4099
  width: 16,
3937
4100
  height: 16,
3938
4101
  viewBox: "0 0 16 16",
@@ -3941,9 +4104,9 @@ const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createEleme
3941
4104
  }, props), _path$k || (_path$k = /*#__PURE__*/React__namespace.createElement("path", {
3942
4105
  fillRule: "evenodd",
3943
4106
  clipRule: "evenodd",
3944
- d: "M11.659 3.5C10.7411 2.85974 9.65081 2.5 8.5 2.5C5.45228 2.5 3 4.95228 3 8C3 11.0477 5.45228 13.5 8.5 13.5C10.2023 13.5 11.7457 12.7171 12.8191 11.3753C13.1641 10.944 13.7934 10.8741 14.2247 11.2191C14.656 11.5641 14.7259 12.1934 14.3809 12.6247C12.9372 14.4292 10.8263 15.5 8.5 15.5C4.34772 15.5 1 12.1523 1 8C1 3.84772 4.34772 0.5 8.5 0.5C10.1564 0.5 11.7168 1.04496 13 2.00147V1C13 0.447715 13.4477 0 14 0C14.5523 0 15 0.447715 15 1V4C15 4.85228 14.3523 5.5 13.5 5.5H10.5C9.94771 5.5 9.5 5.05228 9.5 4.5C9.5 3.94772 9.94771 3.5 10.5 3.5H11.659Z",
4107
+ d: "M4.34099 3.5C5.25886 2.85974 6.34919 2.5 7.5 2.5C10.5477 2.5 13 4.95228 13 8C13 11.0477 10.5477 13.5 7.5 13.5C5.79771 13.5 4.25432 12.7171 3.18087 11.3753C2.83586 10.944 2.20657 10.8741 1.7753 11.2191C1.34404 11.5641 1.27412 12.1934 1.61913 12.6247C3.06275 14.4292 5.17372 15.5 7.5 15.5C11.6523 15.5 15 12.1523 15 8C15 3.84772 11.6523 0.5 7.5 0.5C5.84359 0.5 4.28318 1.04496 3 2.00147V1C3 0.447715 2.55229 0 2 0C1.44771 0 1 0.447715 1 1V4C1 4.85228 1.64772 5.5 2.5 5.5H5.5C6.05229 5.5 6.5 5.05228 6.5 4.5C6.5 3.94772 6.05229 3.5 5.5 3.5H4.34099Z",
3945
4108
  fill: "currentColor"
3946
- })), _path2$5 || (_path2$5 = /*#__PURE__*/React__namespace.createElement("path", {
4109
+ })), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
3947
4110
  d: "M5.5 7.63073V7.07008H6.67566V11H6.02566V7.63073H5.5Z",
3948
4111
  fill: "currentColor"
3949
4112
  })), _path3$1 || (_path3$1 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -3951,9 +4114,9 @@ const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createEleme
3951
4114
  fill: "currentColor"
3952
4115
  })));
3953
4116
 
3954
- var _path$j, _path2$4, _path3;
3955
- function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
3956
- const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
4117
+ var _path$j, _path2$2, _path3;
4118
+ function _extends$n() { _extends$n = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$n.apply(this, arguments); }
4119
+ const SvgForwardSecondsFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$n({
3957
4120
  width: 16,
3958
4121
  height: 16,
3959
4122
  viewBox: "0 0 16 16",
@@ -3962,9 +4125,9 @@ const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement(
3962
4125
  }, props), _path$j || (_path$j = /*#__PURE__*/React__namespace.createElement("path", {
3963
4126
  fillRule: "evenodd",
3964
4127
  clipRule: "evenodd",
3965
- d: "M4.34099 3.5C5.25886 2.85974 6.34919 2.5 7.5 2.5C10.5477 2.5 13 4.95228 13 8C13 11.0477 10.5477 13.5 7.5 13.5C5.79771 13.5 4.25432 12.7171 3.18087 11.3753C2.83586 10.944 2.20657 10.8741 1.7753 11.2191C1.34404 11.5641 1.27412 12.1934 1.61913 12.6247C3.06275 14.4292 5.17372 15.5 7.5 15.5C11.6523 15.5 15 12.1523 15 8C15 3.84772 11.6523 0.5 7.5 0.5C5.84359 0.5 4.28318 1.04496 3 2.00147V1C3 0.447715 2.55229 0 2 0C1.44771 0 1 0.447715 1 1V4C1 4.85228 1.64772 5.5 2.5 5.5H5.5C6.05229 5.5 6.5 5.05228 6.5 4.5C6.5 3.94772 6.05229 3.5 5.5 3.5H4.34099Z",
4128
+ d: "M11.659 3.5C10.7411 2.85974 9.65081 2.5 8.5 2.5C5.45228 2.5 3 4.95228 3 8C3 11.0477 5.45228 13.5 8.5 13.5C10.2023 13.5 11.7457 12.7171 12.8191 11.3753C13.1641 10.944 13.7934 10.8741 14.2247 11.2191C14.656 11.5641 14.7259 12.1934 14.3809 12.6247C12.9372 14.4292 10.8263 15.5 8.5 15.5C4.34772 15.5 1 12.1523 1 8C1 3.84772 4.34772 0.5 8.5 0.5C10.1564 0.5 11.7168 1.04496 13 2.00147V1C13 0.447715 13.4477 0 14 0C14.5523 0 15 0.447715 15 1V4C15 4.85228 14.3523 5.5 13.5 5.5H10.5C9.94771 5.5 9.5 5.05228 9.5 4.5C9.5 3.94772 9.94771 3.5 10.5 3.5H11.659Z",
3966
4129
  fill: "currentColor"
3967
- })), _path2$4 || (_path2$4 = /*#__PURE__*/React__namespace.createElement("path", {
4130
+ })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
3968
4131
  d: "M5.5 7.63073V7.07008H6.67566V11H6.02566V7.63073H5.5Z",
3969
4132
  fill: "currentColor"
3970
4133
  })), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
@@ -3972,18 +4135,57 @@ const SvgBackSecondsFill = props => /*#__PURE__*/React__namespace.createElement(
3972
4135
  fill: "currentColor"
3973
4136
  })));
3974
4137
 
3975
- var _path$i, _path2$3;
4138
+ var _g$1;
4139
+ function _extends$m() { _extends$m = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$m.apply(this, arguments); }
4140
+ const SvgPauseFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$m({
4141
+ xmlns: "http://www.w3.org/2000/svg",
4142
+ width: 16,
4143
+ height: 16,
4144
+ focusable: "false",
4145
+ viewBox: "0 0 16 16"
4146
+ }, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
4147
+ fill: "currentColor"
4148
+ }, /*#__PURE__*/React__namespace.createElement("rect", {
4149
+ width: 4,
4150
+ height: 14,
4151
+ x: 3,
4152
+ y: 1,
4153
+ rx: 1,
4154
+ ry: 1
4155
+ }), /*#__PURE__*/React__namespace.createElement("rect", {
4156
+ width: 4,
4157
+ height: 14,
4158
+ x: 9,
4159
+ y: 1,
4160
+ rx: 1,
4161
+ ry: 1
4162
+ }))));
4163
+
4164
+ var _path$i;
3976
4165
  function _extends$l() { _extends$l = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$l.apply(this, arguments); }
3977
- const SvgPreviousFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
4166
+ const SvgPlayFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$l({
3978
4167
  xmlns: "http://www.w3.org/2000/svg",
3979
4168
  width: 16,
3980
4169
  height: 16,
3981
4170
  focusable: "false",
3982
- viewBox: "0 0 24 24"
4171
+ viewBox: "0 0 16 16"
3983
4172
  }, props), _path$i || (_path$i = /*#__PURE__*/React__namespace.createElement("path", {
4173
+ fill: "currentColor",
4174
+ d: "M6 15.79c-.13 0-.26-.03-.38-.08a.977.977 0 01-.62-.92V1.21a1 1 0 01.62-.93C6 .12 6.42.21 6.71.5l6.44 6.44c.58.58.58 1.54 0 2.12L6.71 15.5c-.19.19-.45.29-.71.29z"
4175
+ })));
4176
+
4177
+ var _path$h, _path2$1;
4178
+ function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
4179
+ const SvgPreviousFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
4180
+ xmlns: "http://www.w3.org/2000/svg",
4181
+ width: 16,
4182
+ height: 16,
4183
+ focusable: "false",
4184
+ viewBox: "0 0 24 24"
4185
+ }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
3984
4186
  d: "M2.75 20C2.75 20.5523 3.19772 21 3.75 21C4.30228 21 4.75 20.5523 4.75 20L4.75 4C4.75 3.44772 4.30229 3 3.75 3C3.19772 3 2.75 3.44772 2.75 4V20Z",
3985
4187
  fill: "currentColor"
3986
- })), _path2$3 || (_path2$3 = /*#__PURE__*/React__namespace.createElement("path", {
4188
+ })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
3987
4189
  d: "M20.75 19.0526C20.75 20.4774 19.1383 21.305 17.9803 20.4748L7.51062 12.9682C6.50574 12.2477 6.54467 10.7407 7.5854 10.073L18.0551 3.35665C19.2198 2.60946 20.75 3.44583 20.75 4.82961L20.75 19.0526Z",
3988
4190
  fill: "currentColor"
3989
4191
  })));
@@ -4013,8 +4215,9 @@ const getNextPlaybackRate = (rate = 1) => {
4013
4215
  const StyledDiv$3 = styled__default["default"].div `
4014
4216
  display: flex;
4015
4217
  align-items: center;
4218
+ justify-content: center;
4016
4219
  `;
4017
- const ControlsGroupCenter = () => {
4220
+ const ControlsGroupCenter = (props) => {
4018
4221
  var _a;
4019
4222
  const [playBackRate, setPlayBackRate] = React.useState(1);
4020
4223
  const { context, togglePlay } = Video.useVideoContext();
@@ -4037,133 +4240,99 @@ const ControlsGroupCenter = () => {
4037
4240
  const nextTime = videoRef.currentTime + 10;
4038
4241
  videoRef.currentTime = nextTime;
4039
4242
  };
4040
- return (jsxRuntime.jsxs(StyledDiv$3, { children: [jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4243
+ return (jsxRuntime.jsxs(StyledDiv$3, Object.assign({}, props, { children: [jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4041
4244
  if (videoRef) {
4042
4245
  videoRef.currentTime = 0;
4043
4246
  }
4044
4247
  e.stopPropagation();
4045
- } }, { children: jsxRuntime.jsx(SvgPreviousFill, {}) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4248
+ } }, { children: jsxRuntime.jsx(SvgPreviousFill, {}) })), jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4046
4249
  onRewind();
4047
4250
  e.stopPropagation();
4048
- } }, { children: jsxRuntime.jsx(SvgBackSecondsFill, {}) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, size: "large", onClick: togglePlay }, { children: isPlaying ? (jsxRuntime.jsx(SvgPauseFill, { style: { width: "24px", height: "24px" } })) : (jsxRuntime.jsx(SvgPlayFill, { style: { width: "24px", height: "24px" } })) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4251
+ } }, { children: jsxRuntime.jsx(SvgBackSecondsFill, {}) })), jsxRuntime.jsx(ControlButton, Object.assign({ size: "large", onClick: togglePlay }, { children: isPlaying ? (jsxRuntime.jsx(SvgPauseFill, { style: { width: "24px", height: "24px" } })) : (jsxRuntime.jsx(SvgPlayFill, { style: { width: "24px", height: "24px" } })) })), jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4049
4252
  onForward();
4050
4253
  e.stopPropagation();
4051
- } }, { children: jsxRuntime.jsx(SvgForwardSecondsFill, {}) })), jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, isPill: true, onClick: (e) => {
4254
+ } }, { children: jsxRuntime.jsx(SvgForwardSecondsFill, {}) })), jsxRuntime.jsx(ControlButton, Object.assign({ isPill: true, onClick: (e) => {
4052
4255
  const newSpeed = getNextPlaybackRate(playBackRate);
4053
4256
  if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.playbackRate) {
4054
4257
  setPlayBackRate(newSpeed);
4055
4258
  videoRef.playbackRate = newSpeed;
4056
4259
  }
4057
4260
  e.stopPropagation();
4058
- } }, { children: jsxRuntime.jsxs(SM, Object.assign({ isBold: true, style: { lineHeight: "16px" } }, { children: [playBackRate, "x"] })) }))] }));
4261
+ } }, { children: jsxRuntime.jsxs(SM, Object.assign({ isBold: true, style: { lineHeight: "16px" } }, { children: [playBackRate, "x"] })) }))] })));
4059
4262
  };
4060
4263
 
4061
- const StyledDiv$2 = styled__default["default"].div `
4062
- position: absolute;
4063
- bottom: ${({ theme }) => theme.space.sm};
4064
- right: 0;
4065
-
4066
- padding: 0 ${({ theme }) => theme.space.xs};
4067
-
4068
- span {
4069
- color: ${({ theme }) => theme.palette.grey[300]};
4070
- }
4071
- `;
4072
- const TimeLabel = ({ current, duration, }) => (jsxRuntime.jsx(StyledDiv$2, { children: jsxRuntime.jsxs(SM, Object.assign({ tag: "span" }, { children: [current, "/", duration] })) }));
4073
-
4074
- var _path$h, _path2$2;
4075
- function _extends$k() { _extends$k = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$k.apply(this, arguments); }
4076
- const SvgVolumeMutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$k({
4077
- xmlns: "http://www.w3.org/2000/svg",
4078
- width: 16,
4079
- height: 16,
4080
- focusable: "false",
4081
- viewBox: "0 0 16 16"
4082
- }, props), _path$h || (_path$h = /*#__PURE__*/React__namespace.createElement("path", {
4083
- stroke: "currentColor",
4084
- strokeLinecap: "round",
4085
- d: "M11.5 10l4-4m-4 0l4 4"
4086
- })), _path2$2 || (_path2$2 = /*#__PURE__*/React__namespace.createElement("path", {
4087
- fill: "currentColor",
4088
- d: "M9 15.29c-.26 0-.51-.1-.71-.29l-4-4H1c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h3.29l4-4a1.002 1.002 0 011.71.71V14.3a.986.986 0 01-1 .99z"
4089
- })));
4090
-
4091
- var _path$g, _path2$1;
4264
+ var _path$g, _circle$1;
4092
4265
  function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
4093
- const SvgVolumeUnmutedFill = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
4266
+ const SvgTagStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$j({
4094
4267
  xmlns: "http://www.w3.org/2000/svg",
4095
4268
  width: 16,
4096
4269
  height: 16,
4097
4270
  focusable: "false",
4098
4271
  viewBox: "0 0 16 16"
4099
4272
  }, props), _path$g || (_path$g = /*#__PURE__*/React__namespace.createElement("path", {
4100
- fill: "currentColor",
4101
- d: "M9 15.29c-.26 0-.51-.1-.71-.29l-4-4H1c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h3.29l4-4a1.002 1.002 0 011.71.71V14.3a.986.986 0 01-1 .99z"
4102
- })), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
4103
4273
  fill: "none",
4104
4274
  stroke: "currentColor",
4105
- strokeLinecap: "round",
4106
- d: "M11.77 9.77c.45-.45.73-1.08.73-1.77s-.28-1.31-.73-1.77m2.17 5.6c.97-.99 1.56-2.34 1.56-3.83 0-1.52-.62-2.89-1.61-3.89"
4275
+ d: "M.5 1v5.3c0 .1.1.3.1.4l8.5 8.5c.2.2.5.2.7 0l5.3-5.3c.2-.2.2-.5 0-.7L6.6.6S6.4.5 6.3.5H1C.7.5.5.7.5 1z"
4276
+ })), _circle$1 || (_circle$1 = /*#__PURE__*/React__namespace.createElement("circle", {
4277
+ cx: 4,
4278
+ cy: 4,
4279
+ r: 1,
4280
+ fill: "currentColor"
4107
4281
  })));
4108
4282
 
4109
- const AudioButton = () => {
4110
- const [hasAudio, setHasAudio] = React.useState(false);
4111
- const { isMuted, setMuted, context } = Video.useVideoContext();
4112
- const { player } = context;
4113
- const checkAudio = (video) => {
4114
- if (!video) {
4115
- return false;
4116
- }
4117
- console.log("hasAudio?", video);
4118
- const videohasAudio = video.mozHasAudio ||
4119
- Boolean(video.webkitAudioDecodedByteCount) ||
4120
- Boolean(video.audioTracks && video.audioTracks.length);
4121
- setHasAudio(videohasAudio);
4122
- };
4123
- const hasVolume = (video) => {
4124
- if (!video) {
4125
- return false;
4126
- }
4127
- return video.volume > 0;
4128
- };
4129
- React.useEffect(() => {
4130
- if (player && (player === null || player === void 0 ? void 0 : player.ref)) {
4131
- setMuted(!hasVolume(player.ref.current));
4132
- checkAudio(player.ref.current);
4133
- }
4134
- }, [context.isPlaying, isMuted]);
4135
- return (jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, disabled: !hasAudio, onClick: () => {
4136
- if (player === null || player === void 0 ? void 0 : player.ref.current) {
4137
- player.ref.current.volume = player.ref.current.volume > 0 ? 0 : 1;
4138
- setMuted(!player.ref.current.volume);
4283
+ var _path$f;
4284
+ function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
4285
+ const SvgPlus$1 = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
4286
+ width: 12,
4287
+ height: 12,
4288
+ viewBox: "0 0 12 12",
4289
+ fill: "none",
4290
+ xmlns: "http://www.w3.org/2000/svg"
4291
+ }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
4292
+ fillRule: "evenodd",
4293
+ clipRule: "evenodd",
4294
+ d: "M6.5 1C6.19318 1 5.94444 1.24873 5.94444 1.55556V5.44444H2.05556C1.74873 5.44444 1.5 5.69318 1.5 6C1.5 6.30683 1.74873 6.55556 2.05556 6.55556H5.94444V10.4444C5.94444 10.7513 6.19318 11 6.5 11C6.80683 11 7.05556 10.7513 7.05556 10.4444V6.55556H10.9444C11.2513 6.55556 11.5 6.30683 11.5 6C11.5 5.69318 11.2513 5.44444 10.9444 5.44444H7.05556V1.55556C7.05556 1.24873 6.80683 1 6.5 1Z",
4295
+ fill: "currentColor"
4296
+ })));
4297
+
4298
+ const Cutter = ({ onCutHandler, isCutting, i18n, }) => {
4299
+ var _a;
4300
+ const { context } = Video.useVideoContext();
4301
+ const videoRef = (_a = context.player) === null || _a === void 0 ? void 0 : _a.ref.current;
4302
+ if (!onCutHandler)
4303
+ return null;
4304
+ return (jsxRuntime.jsx(Button, Object.assign({ isPrimary: true, isAccent: !isCutting, size: "small", onClick: (e) => {
4305
+ if (videoRef) {
4306
+ onCutHandler(videoRef.currentTime);
4139
4307
  }
4140
- } }, { children: isMuted || !hasAudio ? jsxRuntime.jsx(SvgVolumeMutedFill, {}) : jsxRuntime.jsx(SvgVolumeUnmutedFill, {}) })));
4308
+ e.stopPropagation();
4309
+ } }, { children: isCutting ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button.StartIcon, { children: jsxRuntime.jsx(SvgTagStroke, {}) }), (i18n === null || i18n === void 0 ? void 0 : i18n.onHighlight) || "End observation"] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Button.StartIcon, { children: jsxRuntime.jsx(SvgPlus$1, {}) }), (i18n === null || i18n === void 0 ? void 0 : i18n.beforeHighlight) || "Start observation"] })) })));
4141
4310
  };
4142
4311
 
4143
- var _path$f;
4144
- function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
4145
- const SvgMaximizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$i({
4312
+ var _path$e;
4313
+ function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
4314
+ const SvgMaximizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
4146
4315
  xmlns: "http://www.w3.org/2000/svg",
4147
4316
  width: 16,
4148
4317
  height: 16,
4149
4318
  focusable: "false",
4150
4319
  viewBox: "0 0 16 16"
4151
- }, props), _path$f || (_path$f = /*#__PURE__*/React__namespace.createElement("path", {
4320
+ }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
4152
4321
  fill: "none",
4153
4322
  stroke: "currentColor",
4154
4323
  strokeLinecap: "round",
4155
4324
  d: "M4.5.5H1C.72.5.5.72.5 1v3.5m15 0V1c0-.28-.22-.5-.5-.5h-3.5m-11 11V15c0 .28.22.5.5.5h3.5m11-4V15c0 .28-.22.5-.5.5h-3.5m-7-11L1 1m10.5 3.5L15 1M4.5 11.5L1 15m10.5-3.5L15 15"
4156
4325
  })));
4157
4326
 
4158
- var _path$e;
4159
- function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
4160
- const SvgMinimizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$h({
4327
+ var _path$d;
4328
+ function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4329
+ const SvgMinimizeStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4161
4330
  xmlns: "http://www.w3.org/2000/svg",
4162
4331
  width: 16,
4163
4332
  height: 16,
4164
4333
  focusable: "false",
4165
4334
  viewBox: "0 0 16 16"
4166
- }, props), _path$e || (_path$e = /*#__PURE__*/React__namespace.createElement("path", {
4335
+ }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
4167
4336
  fill: "none",
4168
4337
  stroke: "currentColor",
4169
4338
  strokeLinecap: "round",
@@ -4206,7 +4375,7 @@ const FullScreenButton = ({ container, }) => {
4206
4375
  setFullScreen(false);
4207
4376
  }
4208
4377
  }
4209
- }), [ref, isFullScreen]);
4378
+ }), [ref, isFullScreen, setFullScreen]);
4210
4379
  const canGoFullScreen = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
4211
4380
  if (ref) {
4212
4381
  return (requestFullscreen ||
@@ -4231,31 +4400,89 @@ const FullScreenButton = ({ container, }) => {
4231
4400
  }
4232
4401
  };
4233
4402
  }, [ref]);
4234
- return (jsxRuntime.jsx(IconButton, Object.assign({ isBright: true, onClick: (e) => {
4403
+ return (jsxRuntime.jsx(ControlButton, Object.assign({ onClick: (e) => {
4235
4404
  handleFullScreen();
4236
4405
  e.stopPropagation();
4237
4406
  }, disabled: !canGoFullScreen() }, { children: document.fullscreenElement || isFullScreen ? (jsxRuntime.jsx(SvgMinimizeStroke, {})) : (jsxRuntime.jsx(SvgMaximizeStroke, {})) })));
4238
4407
  };
4239
4408
 
4409
+ const UgProgress = styled__default["default"](reactLoaders.Progress) ``;
4410
+ /**
4411
+ * A Progress loader communicates progress when downloading or uploading content.
4412
+ * <hr>
4413
+ * Used for this:
4414
+ * - To communicate the amount of time left when downloading or uploading content
4415
+ *
4416
+ Not for this:
4417
+ - When the loading time is unknown, use a Spinner instead
4418
+ - When loading page content, use a Skeleton loader instead
4419
+ */
4420
+ const Progress = React.forwardRef((props, ref) => (jsxRuntime.jsx(UgProgress, Object.assign({ ref: ref }, props))));
4421
+
4422
+ const StyledProgress = styled.styled(Progress) `
4423
+ width: 100%;
4424
+ border-radius: 0;
4425
+ color: ${({ theme }) => theme.palette.grey[400]};
4426
+ cursor: pointer;
4427
+ > div {
4428
+ border-radius: 0;
4429
+ }
4430
+ `;
4431
+ const ProgressBar = React.forwardRef((props, ref) => {
4432
+ const { progress, handleSkipAhead } = props;
4433
+ return (jsxRuntime.jsx(StyledProgress, { className: "progress-bar-1", ref: ref, value: progress, onClick: (e) => handleSkipAhead(e.clientX) }));
4434
+ });
4435
+
4436
+ const StyledDiv$2 = styled__default["default"].div `
4437
+ display: flex;
4438
+ color: ${({ theme }) => theme.palette.grey[700]};
4439
+ `;
4440
+ const TimeLabel = ({ current, duration, }) => (jsxRuntime.jsx(StyledDiv$2, { children: jsxRuntime.jsxs(SM, Object.assign({ tag: "span" }, { children: [formatDuration(current), "/", formatDuration(duration)] })) }));
4441
+
4442
+ const Wrapper$1 = styled__default["default"].div `
4443
+ position: absolute;
4444
+ bottom: ${({ theme }) => theme.space.sm};
4445
+ z-index: 1;
4446
+ `;
4447
+ const Content$1 = styled__default["default"].div `
4448
+ display: flex;
4449
+ background-color: ${({ theme }) => theme.palette.grey[800]};
4450
+ border-radius: 2px;
4451
+ width: auto;
4452
+ padding: 2px 4px;
4453
+ display: inline-flex;
4454
+ color: white;
4455
+ font-size: ${({ theme }) => theme.fontSizes.sm};
4456
+ align-items: center;
4457
+ justify-content: center;
4458
+ min-height: 14px;
4459
+ `;
4460
+ const PlayerTooltip = (_a) => {
4461
+ var { children } = _a, props = __rest(_a, ["children"]);
4462
+ return (jsxRuntime.jsx(Wrapper$1, Object.assign({}, props, { children: jsxRuntime.jsx(Content$1, { children: children }) })));
4463
+ };
4464
+
4465
+ function useDebounce(value, delay) {
4466
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
4467
+ React.useEffect(() => {
4468
+ const timer = setTimeout(() => setDebouncedValue(value), delay || 500);
4469
+ return () => {
4470
+ clearTimeout(timer);
4471
+ };
4472
+ }, [value, delay]);
4473
+ return debouncedValue;
4474
+ }
4475
+
4240
4476
  const ControlsWrapper = styled__default["default"].div `
4241
4477
  position: absolute;
4242
4478
  bottom: 0;
4243
4479
  left: 0;
4244
4480
  right: 0;
4245
4481
  padding: ${({ theme }) => theme.space.xxs} 0;
4246
- background-color: ${({ theme }) => reactTheming.getColor(theme.palette.grey, 700, undefined, 0.8)};
4482
+ background-color: ${({ theme }) => theme.palette.grey[100]};
4247
4483
  ${({ isPlaying }) => isPlaying && "display: none;"}
4248
4484
  z-index: 2;
4249
4485
  `;
4250
- const StyledProgress = styled__default["default"](Progress) `
4251
- width: 100%;
4252
- border-radius: 0;
4253
- color: ${({ theme }) => theme.palette.kale[700]};
4254
- cursor: pointer;
4255
- > div {
4256
- border-radius: 0;
4257
- }
4258
- `;
4259
4486
  const StyledTooltip = styled__default["default"](PlayerTooltip) `
4260
4487
  display: none;
4261
4488
  `;
@@ -4274,18 +4501,22 @@ const StyledDiv$1 = styled__default["default"].div `
4274
4501
  display: flex;
4275
4502
  align-items: center;
4276
4503
  `;
4277
- const Controls = ({ container, }) => {
4504
+ const Controls = ({ container, onCutHandler, bookmarks, isCutting, onBookMarkUpdated, i18n, }) => {
4278
4505
  var _a, _b, _c;
4279
4506
  const [progress, setProgress] = React.useState(0);
4280
4507
  const [tooltipMargin, setTooltipMargin] = React.useState(0);
4281
4508
  const [tooltipLabel, setTooltipLabel] = React.useState("00:00");
4509
+ const [marks, setMarks] = React.useState(bookmarks);
4510
+ const [updatedMark, setUpdatedMark] = React.useState();
4282
4511
  const progressRef = React.useRef(null);
4283
4512
  const { context, setCurrentTime } = Video.useVideoContext();
4513
+ const debouncedMark = useDebounce(updatedMark, 500);
4514
+ const { reset, isGrabbing, activeBookmark, fromEnd } = useProgressContext();
4284
4515
  const relCurrentTime = ((_a = context.player) === null || _a === void 0 ? void 0 : _a.currentTime)
4285
4516
  ? ((_b = context.player) === null || _b === void 0 ? void 0 : _b.currentTime) - context.part.start
4286
4517
  : 0;
4287
4518
  const duration = context.part.end - context.part.start || ((_c = context.player) === null || _c === void 0 ? void 0 : _c.totalTime) || 0; //relative
4288
- const getVideoPositionFromEvent = (clientX) => {
4519
+ const getVideoPositionFromEvent = React.useCallback((clientX) => {
4289
4520
  if (progressRef && progressRef.current && duration) {
4290
4521
  const bounds = progressRef.current.getBoundingClientRect();
4291
4522
  const x = clientX - bounds.left;
@@ -4293,12 +4524,18 @@ const Controls = ({ container, }) => {
4293
4524
  return videoPositionSecs;
4294
4525
  }
4295
4526
  return 0;
4296
- };
4527
+ }, [progressRef, duration]);
4528
+ const getProgress = React.useCallback((currentTime) => {
4529
+ const current = currentTime - (context.part.start || 0);
4530
+ if (duration === 0)
4531
+ return 0;
4532
+ return (current / duration) * 100;
4533
+ }, [context.part.start, duration]);
4297
4534
  const handleSkipAhead = React.useCallback((pageX) => {
4298
4535
  const time = getVideoPositionFromEvent(pageX) + (context.part.start || 0);
4299
4536
  setCurrentTime(time);
4300
4537
  setProgress(getProgress(time));
4301
- }, [context.player, context.part]);
4538
+ }, [getVideoPositionFromEvent, context.part.start, setCurrentTime, getProgress]);
4302
4539
  const onMouseEvent = (e) => {
4303
4540
  if (progressRef && progressRef.current) {
4304
4541
  const tooltipWidth = 40;
@@ -4309,31 +4546,56 @@ const Controls = ({ container, }) => {
4309
4546
  const videoTargetDuration = getVideoPositionFromEvent(e.clientX);
4310
4547
  setTooltipMargin(newTooltipMargin);
4311
4548
  setTooltipLabel(formatDuration(videoTargetDuration));
4549
+ if (isGrabbing) {
4550
+ handleBookmarkUpdate(marginX, progressRef.current.clientWidth);
4551
+ }
4312
4552
  }
4313
4553
  };
4554
+ const handleBookmarkUpdate = React.useCallback((newX, clientW) => {
4555
+ if (!activeBookmark || !marks)
4556
+ return;
4557
+ const currentObsIndex = marks.findIndex((mark) => mark.id === activeBookmark.id);
4558
+ const value = (newX / clientW) * duration + context.part.start;
4559
+ const updatedMark = Object.assign(Object.assign({}, marks[currentObsIndex]), (!!fromEnd ? { end: value } : { start: value }));
4560
+ const newMarks = [
4561
+ ...marks.slice(0, currentObsIndex),
4562
+ updatedMark,
4563
+ ...marks.slice(currentObsIndex + 1),
4564
+ ];
4565
+ setMarks(newMarks);
4566
+ setUpdatedMark(updatedMark);
4567
+ }, [activeBookmark, context.part.start, duration, fromEnd, marks]);
4314
4568
  React.useEffect(() => {
4315
4569
  var _a;
4316
4570
  const currentTime = ((_a = context.player) === null || _a === void 0 ? void 0 : _a.currentTime) || 0;
4317
4571
  setProgress(getProgress(currentTime));
4318
- }, [context.player]);
4319
- const getProgress = React.useCallback((currentTime) => {
4320
- const current = currentTime - (context.part.start || 0);
4321
- if (duration === 0)
4322
- return 0;
4323
- return (current / duration) * 100;
4324
- }, [context.player]);
4325
- return (jsxRuntime.jsxs(ControlsWrapper, Object.assign({ isPlaying: context.isPlaying }, { children: [jsxRuntime.jsxs(ProgressContainer, Object.assign({ onMouseEnter: onMouseEvent, onMouseMove: onMouseEvent, onMouseLeave: onMouseEvent }, { children: [jsxRuntime.jsx(StyledTooltip, Object.assign({ style: { marginLeft: `${tooltipMargin}px` } }, { children: tooltipLabel })), jsxRuntime.jsx(TimeLabel, { current: formatDuration(relCurrentTime), duration: formatDuration(duration) }), jsxRuntime.jsx(StyledProgress, { ref: progressRef, value: progress, onClick: (e) => handleSkipAhead(e.clientX) })] })), jsxRuntime.jsxs(ControlsBar, { children: [jsxRuntime.jsx(StyledDiv$1, { children: jsxRuntime.jsx(AudioButton, {}) }), jsxRuntime.jsx(ControlsGroupCenter, {}), jsxRuntime.jsx(StyledDiv$1, { children: jsxRuntime.jsx(FullScreenButton, { container: container }) })] })] })));
4572
+ }, [context.player, getProgress]);
4573
+ React.useEffect(() => {
4574
+ if (!marks)
4575
+ return;
4576
+ document.addEventListener("mouseup", reset);
4577
+ return () => {
4578
+ document.removeEventListener("mouseup", reset);
4579
+ };
4580
+ }, [reset, marks]);
4581
+ React.useEffect(() => {
4582
+ if (debouncedMark) {
4583
+ onBookMarkUpdated === null || onBookMarkUpdated === void 0 ? void 0 : onBookMarkUpdated(debouncedMark);
4584
+ }
4585
+ }, [debouncedMark, onBookMarkUpdated]);
4586
+ return (jsxRuntime.jsxs(ControlsWrapper, Object.assign({ isPlaying: context.isPlaying }, { children: [jsxRuntime.jsxs(ProgressContainer, Object.assign({ onMouseEnter: onMouseEvent, onMouseMove: onMouseEvent, onMouseLeave: onMouseEvent }, { children: [jsxRuntime.jsx(StyledTooltip, Object.assign({ style: { marginLeft: `${tooltipMargin}px` } }, { children: tooltipLabel })), !!duration &&
4587
+ (marks === null || marks === void 0 ? void 0 : marks.map((bookmark, index) => (jsxRuntime.jsx(Bookmark, Object.assign({}, bookmark), `${index}${bookmark.start}`)))), jsxRuntime.jsx(ProgressBar, { ref: progressRef, progress: progress, handleSkipAhead: handleSkipAhead, duration: duration })] })), jsxRuntime.jsxs(ControlsBar, { children: [jsxRuntime.jsxs(StyledDiv$1, Object.assign({ style: { width: "20%", justifyContent: "start" } }, { children: [jsxRuntime.jsx(AudioButton, {}), jsxRuntime.jsx(TimeLabel, { current: relCurrentTime, duration: duration })] })), jsxRuntime.jsx(ControlsGroupCenter, { style: { width: "60%" } }), jsxRuntime.jsxs(StyledDiv$1, Object.assign({ style: { width: "20%", justifyContent: "end" } }, { children: [jsxRuntime.jsx(Cutter, { onCutHandler: onCutHandler, isCutting: isCutting, i18n: i18n }), jsxRuntime.jsx(FullScreenButton, { container: container })] }))] })] })));
4326
4588
  };
4327
4589
 
4328
- var _path$d;
4329
- function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
4330
- const SvgPlayIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$g({
4590
+ var _path$c;
4591
+ function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
4592
+ const SvgPlayIcon = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
4331
4593
  width: 70,
4332
4594
  height: 70,
4333
4595
  viewBox: "0 0 70 70",
4334
4596
  fill: "none",
4335
4597
  xmlns: "http://www.w3.org/2000/svg"
4336
- }, props), _path$d || (_path$d = /*#__PURE__*/React__namespace.createElement("path", {
4598
+ }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
4337
4599
  d: "M60 35L17 62L17 8L60 35Z",
4338
4600
  fill: "#003A57"
4339
4601
  })));
@@ -4354,6 +4616,10 @@ const BigButton = styled__default["default"](IconButton) `
4354
4616
  min-width: ${({ theme }) => theme.space.base * 15}px;
4355
4617
  width: 80px;
4356
4618
  height: 80px;
4619
+
4620
+ box-shadow: ${({ theme }) => theme.shadows.boxShadow(theme)};
4621
+
4622
+
4357
4623
  ${PlayIcon} {
4358
4624
  width: 60%;
4359
4625
  height: 60%;
@@ -4420,8 +4686,7 @@ const Container$1 = styled__default["default"].div `
4420
4686
  }
4421
4687
  }
4422
4688
  }
4423
-
4424
- background-color: ${({ theme }) => theme.palette.grey[700]};
4689
+ background: ${({ theme }) => theme.palette.grey[400]};
4425
4690
  `;
4426
4691
 
4427
4692
  const UgSpinner = styled__default["default"](reactLoaders.Spinner) ``;
@@ -4449,18 +4714,15 @@ const VideoSpinner = () => (jsxRuntime.jsx(StyledDiv, { children: jsxRuntime.jsx
4449
4714
  * Used for this:
4450
4715
  - To display a video
4451
4716
  */
4452
- const Player = React.forwardRef((props, forwardRef) => {
4453
- const videoRef = React.useRef(null);
4454
- React.useImperativeHandle(forwardRef, () => videoRef.current);
4455
- return (jsxRuntime.jsx(Video__default["default"], Object.assign({ src: props.url }, props, { children: jsxRuntime.jsx(PlayerCore, Object.assign({ ref: videoRef }, props)) })));
4456
- });
4717
+ const Player = React.forwardRef((props, forwardRef) => (jsxRuntime.jsx(Video__default["default"], Object.assign({ src: props.url }, props, { children: jsxRuntime.jsx(PlayerCore, Object.assign({ ref: forwardRef }, props)) }))));
4457
4718
  const PlayerCore = React.forwardRef((props, forwardRef) => {
4458
4719
  var _a;
4459
4720
  const { context, togglePlay, setIsPlaying } = Video.useVideoContext();
4721
+ const { onCutHandler, bookmarks, isCutting } = props;
4460
4722
  const videoRef = (_a = context.player) === null || _a === void 0 ? void 0 : _a.ref.current;
4461
4723
  const isLoaded = !!videoRef;
4462
4724
  const containerRef = React.useRef(null);
4463
- React.useImperativeHandle(forwardRef, () => videoRef);
4725
+ React.useImperativeHandle(forwardRef, () => videoRef, [videoRef]);
4464
4726
  React.useEffect(() => {
4465
4727
  if (videoRef) {
4466
4728
  videoRef.addEventListener("pause", () => {
@@ -4474,10 +4736,19 @@ const PlayerCore = React.forwardRef((props, forwardRef) => {
4474
4736
  });
4475
4737
  }
4476
4738
  };
4477
- }, [videoRef]);
4478
- return (jsxRuntime.jsxs(Container$1, Object.assign({ isLoaded: isLoaded, isPlaying: context.isPlaying, ref: containerRef }, { children: [!isLoaded ? (jsxRuntime.jsx(VideoSpinner, {})) : (jsxRuntime.jsx(FloatingControls, { isPlaying: context.isPlaying, onClick: togglePlay })), jsxRuntime.jsx(Video__default["default"].Player, { className: "player-container" }), jsxRuntime.jsx(Controls, { container: containerRef.current })] })));
4739
+ }, [setIsPlaying, videoRef]);
4740
+ return (jsxRuntime.jsxs(Container$1, Object.assign({ isLoaded: isLoaded, isPlaying: context.isPlaying, ref: containerRef }, { children: [!isLoaded ? (jsxRuntime.jsx(VideoSpinner, {})) : (jsxRuntime.jsx(FloatingControls, { isPlaying: context.isPlaying, onClick: togglePlay })), jsxRuntime.jsx(Video__default["default"].Player, { className: "player-container" }), jsxRuntime.jsx(ProgressContextProvider, { children: jsxRuntime.jsx(Controls, { container: containerRef.current, onCutHandler: onCutHandler, bookmarks: bookmarks, isCutting: isCutting, onBookMarkUpdated: props.handleBookmarkUpdate, i18n: props.i18n }) })] })));
4479
4741
  });
4480
4742
 
4743
+ const MediaLightBox = ({ header, onClose, slideChange, selectedImageIndex, thumbnails, videoRefs, isOpen, details }) => {
4744
+ if (!isOpen) {
4745
+ return null;
4746
+ }
4747
+ return (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: onClose }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: header }), jsxRuntime.jsxs(Lightbox.Body, { children: [jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: details ? 2 : 3 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: thumbnails.map((item) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type.includes("image") && (jsxRuntime.jsx("img", { src: item.url, alt: `media ${item.name}`, style: { maxHeight: "100%", height: "auto" } })), item.type.includes("video") && item.url && (jsxRuntime.jsx(Player, { ref: (ref) => {
4748
+ videoRefs.current.push(ref);
4749
+ }, url: item.url }))] }, item.id))) })) })), details && (jsxRuntime.jsx(Lightbox.Body.Details, Object.assign({ style: { flex: 1 } }, { children: details })))] }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] })));
4750
+ };
4751
+
4481
4752
  const ChatBoxContainer = styled__default["default"].div `
4482
4753
  display: flex;
4483
4754
  border-top: 1px solid ${({ theme }) => theme.palette.grey[200]};
@@ -4497,14 +4768,19 @@ const ChatBoxContainer = styled__default["default"].div `
4497
4768
  - Simple text input, use textarea instead.
4498
4769
  */
4499
4770
  const CommentBox = (_a) => {
4771
+ var _b;
4500
4772
  var { placeholderOptions } = _a, props = __rest(_a, ["placeholderOptions"]);
4501
4773
  const { children, hasFloatingMenu, hasButtonsMenu, bubbleOptions, i18n } = props;
4502
- const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails } = useChatContext();
4503
- const { addToast } = useToast();
4774
+ const { editor, setEditor, mentionableUsers, triggerSave, thumbnails, addThumbnails, } = useChatContext();
4504
4775
  const [isOpen, setIsOpen] = React.useState(false);
4505
- const [selectedImage, setSelectedImage] = React.useState({});
4506
4776
  const [selectedImageIndex, setSelectedImageIndex] = React.useState(0);
4777
+ const { getMedia } = useMedia();
4507
4778
  const ext = editorExtensions({ placeholderOptions, mentionableUsers });
4779
+ function handleEvent(data) {
4780
+ if (!data || !data.files)
4781
+ return;
4782
+ addThumbnails({ files: getMedia(data.files) });
4783
+ }
4508
4784
  const closeLightbox = () => {
4509
4785
  setIsOpen(false);
4510
4786
  };
@@ -4517,10 +4793,7 @@ const CommentBox = (_a) => {
4517
4793
  }
4518
4794
  });
4519
4795
  }, [videoRefs]);
4520
- const handleOpenLightbox = (file, index) => {
4521
- if (!file)
4522
- throw Error("Error with the image");
4523
- setSelectedImage(file);
4796
+ const handleOpenLightbox = (index) => {
4524
4797
  setSelectedImageIndex(index);
4525
4798
  setIsOpen(true);
4526
4799
  };
@@ -4532,59 +4805,13 @@ const CommentBox = (_a) => {
4532
4805
  return false;
4533
4806
  },
4534
4807
  handleDrop: function (view, event, slice, moved) {
4535
- if (!event.dataTransfer || !event.dataTransfer.files)
4536
- return false;
4537
4808
  event.preventDefault();
4538
- const files = Array.from(event.dataTransfer.files).map((file) => {
4539
- return Object.assign(file, { isLoadingMedia: false });
4540
- });
4541
- const wronfFiles = files.filter((file) => !/^(image|video)\//.test(file.type));
4542
- if (wronfFiles.length > 0) {
4543
- for (const file of wronfFiles) {
4544
- addToast(({ close }) => (jsxRuntime.jsx(Notification, { onClose: close, type: "error", message: `${props.messageBadFileFormat} - ${file.name}`, isPrimary: true })), { placement: 'top' });
4545
- }
4546
- }
4547
- const mediaFiles = files.filter((file) => /^(image|video)\//.test(file.type));
4548
- if (mediaFiles.length === 0)
4549
- return false;
4550
- addThumbnails({ files: mediaFiles });
4551
- return false;
4809
+ handleEvent(event.dataTransfer);
4810
+ },
4811
+ handlePaste: (view, event, slice) => {
4812
+ event.preventDefault();
4813
+ handleEvent(event.clipboardData);
4552
4814
  },
4553
- /*handlePaste: (view, event, slice) => {
4554
- if (!event.clipboardData || !event.clipboardData.items) return false;
4555
-
4556
- event.preventDefault();
4557
-
4558
- const items = Array.from(event.clipboardData.items);
4559
-
4560
- const imageItems = items.filter(
4561
- (item) => item.type && item.type.startsWith("image/")
4562
- );
4563
- const textItem = items.find((item) => item.type === "text/plain");
4564
-
4565
- if (imageItems.length > 0) {
4566
- imageItems.forEach((imageItem) => {
4567
- const file = imageItem.getAsFile();
4568
- if (file) {
4569
- const imageUrl = URL.createObjectURL(file);
4570
- const node = view.state.schema.nodes.image.create({
4571
- src: imageUrl,
4572
- });
4573
- const transaction = view.state.tr.replaceSelectionWith(node);
4574
- view.dispatch(transaction);
4575
- }
4576
- });
4577
- } else if (textItem) {
4578
- textItem.getAsString(async (text) => {
4579
- const node = view.state.schema.text(text);
4580
- const tr = view.state.tr;
4581
- tr.replaceSelectionWith(node);
4582
- view.dispatch(tr);
4583
- });
4584
- }
4585
-
4586
- return true;
4587
- },*/
4588
4815
  } }, props));
4589
4816
  const onKeyDown = (event) => {
4590
4817
  if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
@@ -4596,28 +4823,31 @@ const CommentBox = (_a) => {
4596
4823
  return null;
4597
4824
  ed.on("create", ({ editor }) => setEditor(editor));
4598
4825
  ed.on("update", ({ editor }) => setEditor(editor));
4599
- const mediaFiles = thumbnails.map((file) => {
4600
- return Object.assign(file, { isLoadingMedia: file.isLoadingMedia });
4601
- });
4602
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: selectedImage.name }), jsxRuntime.jsx(Lightbox.Body, { children: jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 3 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: mediaFiles.map((item, index) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type.includes("image") && (jsxRuntime.jsx("img", { src: URL.createObjectURL(thumbnails[index]), alt: `media ${item.name}` })), item.type.includes("video") && (jsxRuntime.jsx(Player, { ref: (ref) => {
4603
- videoRefs.current.push(ref);
4604
- }, url: URL.createObjectURL(thumbnails[index]) }))] }))) })) })) }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] }))), jsxRuntime.jsx(ChatBoxContainer, { children: jsxRuntime.jsxs(EditorContainer$1, Object.assign({ editable: true, style: { marginLeft: 0, paddingBottom: 12 } }, { children: [hasFloatingMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: Object.assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(ThumbnailContainer, { openLightbox: handleOpenLightbox })] })) }), hasButtonsMenu && jsxRuntime.jsx(CommentBar, { editor: ed, i18n: i18n })] }));
4826
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MediaLightBox, { isOpen: isOpen, header: (_b = thumbnails[selectedImageIndex]) === null || _b === void 0 ? void 0 : _b.name, onClose: closeLightbox, slideChange: slideChange, selectedImageIndex: selectedImageIndex, thumbnails: thumbnails, videoRefs: videoRefs }), jsxRuntime.jsx(ChatBoxContainer, { children: jsxRuntime.jsxs(EditorContainer$1, Object.assign({ editable: true, style: { marginLeft: 0, paddingBottom: 12 } }, { children: [hasFloatingMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: Object.assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(ThumbnailContainer, { openLightbox: handleOpenLightbox })] })) }), hasButtonsMenu && jsxRuntime.jsx(CommentBar, { editor: ed, i18n: i18n })] }));
4605
4827
  };
4606
4828
 
4607
- var _path$c;
4608
- function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
4609
- const SvgDownloadStroke = props => /*#__PURE__*/React__namespace.createElement("svg", _extends$f({
4610
- xmlns: "http://www.w3.org/2000/svg",
4611
- width: 16,
4612
- height: 16,
4613
- focusable: "false",
4614
- viewBox: "0 0 16 16"
4615
- }, props), _path$c || (_path$c = /*#__PURE__*/React__namespace.createElement("path", {
4616
- fill: "none",
4617
- stroke: "currentColor",
4618
- strokeLinecap: "round",
4619
- d: "M1.5 15.5h13m-11-7l4.1 4.1c.2.2.5.2.7 0l4.1-4.1m-4.4 4V.5"
4620
- })));
4829
+ const UgGrid = styled__default["default"](reactGrid.Grid) `
4830
+ padding-left: 0;
4831
+ padding-right: 0;
4832
+ `;
4833
+ /**
4834
+ * The Grid component is a framework for building modular layouts.
4835
+ * <hr>
4836
+ * Used for this:
4837
+ - To structure the layout of a page
4838
+ */
4839
+ const Grid = (props) => jsxRuntime.jsx(UgGrid, Object.assign({}, props));
4840
+
4841
+ const Row$1 = (props) => jsxRuntime.jsx(reactGrid.Row, Object.assign({}, props));
4842
+
4843
+ const StyledCol$1 = styled__default["default"](reactGrid.Col) `
4844
+ margin-bottom: ${theme.space.lg};
4845
+
4846
+ @media screen and (max-width: ${theme.breakpoints.sm}) {
4847
+ margin-bottom: ${theme.space.md};
4848
+ }
4849
+ `;
4850
+ const Col = (props) => jsxRuntime.jsx(StyledCol$1, Object.assign({}, props));
4621
4851
 
4622
4852
  const CommentCard = styled.styled(Card) `
4623
4853
  padding: ${({ theme }) => `${theme.space.base * 3}px ${theme.space.sm}`};
@@ -4662,13 +4892,9 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4662
4892
  var _a, _b;
4663
4893
  const { mentionableUsers } = useChatContext();
4664
4894
  const [isOpen, setIsOpen] = React.useState(false);
4665
- const [selectedImage, setSelectedImage] = React.useState({});
4666
4895
  const [selectedImageIndex, setSelectedImageIndex] = React.useState(0);
4667
4896
  const ext = editorExtensions({ mentionableUsers });
4668
- const handleClickThumbnail = (file, index) => {
4669
- if (!file)
4670
- throw Error("Error with the image");
4671
- setSelectedImage(file);
4897
+ const handleClickThumbnail = (index) => {
4672
4898
  setSelectedImageIndex(index);
4673
4899
  setIsOpen(true);
4674
4900
  };
@@ -4677,7 +4903,6 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4677
4903
  };
4678
4904
  const videoRefs = React.useRef([]);
4679
4905
  const slideChange = React.useCallback((index) => {
4680
- setSelectedImage(media[index]);
4681
4906
  setSelectedImageIndex(index);
4682
4907
  videoRefs.current.forEach((ref) => {
4683
4908
  if (ref) {
@@ -4694,39 +4919,12 @@ const Comment = ({ author, message, children, date, media = [], header, }) => {
4694
4919
  ed.setOptions({
4695
4920
  editable: false,
4696
4921
  });
4697
- const dowloadSelectedMedia = () => __awaiter(void 0, void 0, void 0, function* () {
4698
- try {
4699
- const response = yield fetch(`${selectedImage.url}?download`);
4700
- const blob = yield response.blob();
4701
- const link = document.createElement('a');
4702
- link.href = window.URL.createObjectURL(blob);
4703
- link.download = "media_" + selectedImage.id.toString() || 'downloadedFile';
4704
- document.body.appendChild(link);
4705
- link.click();
4706
- window.URL.revokeObjectURL(link.href);
4707
- document.body.removeChild(link);
4708
- }
4709
- catch (error) {
4710
- console.error('An error occurred while downloading: ', error);
4711
- }
4712
- });
4713
- return (jsxRuntime.jsxs(CommentCard, { children: [jsxRuntime.jsxs(AuthorContainer, { children: [jsxRuntime.jsx(Avatar, Object.assign({ avatarType: (_a = author.avatarType) !== null && _a !== void 0 ? _a : "text", style: { flexShrink: 0 } }, { children: author.avatar })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(CommentTitle, { children: [(_b = author.name) !== null && _b !== void 0 ? _b : "User", jsxRuntime.jsx(CommentDate, { children: date })] }), jsxRuntime.jsx(ReadOnly, { children: jsxRuntime.jsx(EditorContainer$1, Object.assign({ editable: false }, { children: jsxRuntime.jsx(react.EditorContent, { editor: ed }) })) })] })] }), jsxRuntime.jsx(Grid, { children: jsxRuntime.jsx(Row$1, Object.assign({ className: "responsive-container" }, { children: media.map((file, index) => {
4714
- // Check if item is an image or a video
4715
- if (file.type.includes('image'))
4716
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 4, className: "flex-3-sm" }, { children: jsxRuntime.jsx(ImageThumbnail, { src: file.url, index: index, showX: true, isLoadingMedia: false, clickThumbnail: () => {
4717
- handleClickThumbnail(file, index);
4718
- } }, index) })));
4719
- if (file.type.includes('video'))
4720
- return (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 4, className: "flex-3-sm" }, { children: jsxRuntime.jsx(VideoThumbnail, { src: file.url, index: index, showX: true, isLoadingMedia: false, clickThumbnail: () => {
4721
- handleClickThumbnail(file, index);
4722
- } }, index) })));
4723
- return null;
4724
- }) })) }), isOpen && selectedImage && (jsxRuntime.jsxs(Lightbox, Object.assign({ onClose: closeLightbox }, { children: [jsxRuntime.jsx(Lightbox.Header, { children: jsxRuntime.jsxs(reactTypography.MD, Object.assign({ isBold: true }, { children: [jsxRuntime.jsx(Grey600Span, { children: header && header.title }), header && header.message && (jsxRuntime.jsxs(Grey800Span, { children: [" | ", header.message] }))] })) }), jsxRuntime.jsxs(Lightbox.Body, { children: [jsxRuntime.jsx(Lightbox.Body.Main, Object.assign({ style: { flex: 2 } }, { children: jsxRuntime.jsx(Slider, Object.assign({ prevArrow: jsxRuntime.jsx(Slider.PrevButton, { isBright: true }), nextArrow: jsxRuntime.jsx(Slider.NextButton, { isBright: true }), onSlideChange: slideChange, initialSlide: selectedImageIndex }, { children: media.map((item, index) => (jsxRuntime.jsxs(Slider.Slide, { children: [item.type === "image" && (jsxRuntime.jsx("img", { src: item.url, alt: `{{${item.url}}}` })), item.type === "video" && (jsxRuntime.jsx(Player, { ref: (ref) => {
4725
- videoRefs.current.push(ref);
4726
- }, url: item.url }))] }))) })) })), jsxRuntime.jsx(Lightbox.Body.Details, Object.assign({ style: { flex: 1 } }, { children: jsxRuntime.jsx(Comment, Object.assign({ header: header, author: {
4727
- avatar: author.avatar,
4728
- name: author.name,
4729
- }, date: date, message: message }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("br", {}) }) })) }))] }), jsxRuntime.jsx(Lightbox.Footer, { children: jsxRuntime.jsxs(Button, Object.assign({ isBasic: true, onClick: dowloadSelectedMedia }, { children: [jsxRuntime.jsx(Button.StartIcon, { children: jsxRuntime.jsx(SvgDownloadStroke, {}) }), "Download"] })) }), jsxRuntime.jsx(Lightbox.Close, { "aria-label": "Close modal" })] }))), jsxRuntime.jsx(Footer$2, { children: children })] }));
4922
+ return (jsxRuntime.jsxs(CommentCard, { children: [jsxRuntime.jsxs(AuthorContainer, { children: [jsxRuntime.jsx(Avatar, Object.assign({ avatarType: (_a = author.avatarType) !== null && _a !== void 0 ? _a : "text", style: { flexShrink: 0 } }, { children: author.avatar })), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(CommentTitle, { children: [(_b = author.name) !== null && _b !== void 0 ? _b : "User", " ", jsxRuntime.jsx(CommentDate, { children: date })] }), jsxRuntime.jsx(ReadOnly, { children: jsxRuntime.jsx(EditorContainer$1, Object.assign({ editable: false }, { children: jsxRuntime.jsx(react.EditorContent, { editor: ed }) })) })] })] }), jsxRuntime.jsx(Grid, { children: jsxRuntime.jsx(Row$1, Object.assign({ className: "responsive-container" }, { children: media.map((file, index) => (jsxRuntime.jsx(Col, Object.assign({ xs: 12, sm: 4, className: "flex-3-sm" }, { children: jsxRuntime.jsx(Thumbnail, { src: file.url, type: file.type, showX: false, isLoadingMedia: false, clickThumbnail: () => {
4923
+ handleClickThumbnail(index);
4924
+ } }) }), index))) })) }), jsxRuntime.jsx(MediaLightBox, { isOpen: isOpen, header: jsxRuntime.jsxs(reactTypography.MD, Object.assign({ isBold: true }, { children: [jsxRuntime.jsx(Grey600Span, { children: header && header.title }), header && header.message && (jsxRuntime.jsxs(Grey800Span, { children: [" | ", header.message] }))] })), onClose: closeLightbox, slideChange: slideChange, selectedImageIndex: selectedImageIndex, thumbnails: media, videoRefs: videoRefs, details: jsxRuntime.jsx(Comment, Object.assign({ header: header, author: {
4925
+ avatar: author.avatar,
4926
+ name: author.name,
4927
+ }, date: date, message: message }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("br", {}) }) })) }), jsxRuntime.jsx(Footer$2, { children: children })] }));
4730
4928
  };
4731
4929
 
4732
4930
  /**
@@ -5365,6 +5563,120 @@ const UgToggle = styled__default["default"](reactForms.Toggle) ``;
5365
5563
  **/
5366
5564
  const Toggle = (props) => jsxRuntime.jsx(UgToggle, Object.assign({}, props));
5367
5565
 
5566
+ const HighlightContext = React.createContext(null);
5567
+ const HighlightContextProvider = ({ term, children, }) => {
5568
+ const [searchTerm, setsearchTerm] = React.useState(term !== null && term !== void 0 ? term : "");
5569
+ React.useEffect(() => {
5570
+ setsearchTerm(term !== null && term !== void 0 ? term : "");
5571
+ }, [term]);
5572
+ const HighlightContextValue = React.useMemo(() => ({
5573
+ searchTerm,
5574
+ }), [searchTerm]);
5575
+ return (jsxRuntime.jsx(HighlightContext.Provider, Object.assign({ value: HighlightContextValue }, { children: children })));
5576
+ };
5577
+ const useHighlightContext = () => {
5578
+ const context = React.useContext(HighlightContext);
5579
+ if (!context)
5580
+ throw new Error("Provider not found for HighlightContextProvider");
5581
+ return context; // Now we can use the context in the component, SAFELY.
5582
+ };
5583
+
5584
+ const StyledSearchWord = styled__default["default"].span `
5585
+ background-color: ${({ theme }) => theme.palette.product.talk};
5586
+ color: ${({ theme }) => theme.palette.grey[700]};
5587
+ `;
5588
+ const Searchable = ({ text, }) => {
5589
+ const { searchTerm } = useHighlightContext();
5590
+ if (searchTerm) {
5591
+ const parts = text.split(new RegExp(`(${searchTerm})`, "gi"));
5592
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: parts.map((part, index) => part.toLowerCase() === searchTerm.toLowerCase() ? (jsxRuntime.jsx(StyledSearchWord, { children: part }, index)) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: part }))) }));
5593
+ }
5594
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: text });
5595
+ };
5596
+
5597
+ const StyledWord = styled__default["default"](reactTypography.Span) `
5598
+ font-size: ${({ theme, size }) => theme.fontSizes[size !== null && size !== void 0 ? size : "md"]};
5599
+ padding: ${({ theme }) => theme.space.xxs} 0;
5600
+
5601
+ ${({ observation, theme }) => {
5602
+ var _a, _b;
5603
+ return observation &&
5604
+ ` user-select: none;
5605
+ background-color: ${(_a = observation.hue) !== null && _a !== void 0 ? _a : getColor(theme.palette.azure, 700, undefined, 0.5)};
5606
+ color: ${(_b = observation.color) !== null && _b !== void 0 ? _b : "white"};
5607
+ box-sizing: border-box;
5608
+ &:focus {
5609
+ outline: none;
5610
+ }
5611
+
5612
+ + span:not([observation]) {
5613
+ margin-left: 2px;
5614
+ }
5615
+ `;
5616
+ }}
5617
+ `;
5618
+ const ActiveWord = styled__default["default"].span `
5619
+ background-color: ${({ theme }) => getColor(theme.palette.fuschia, 400, undefined, 0.4)};
5620
+ padding: 0 2px;
5621
+ `;
5622
+ const WordsContainer = styled__default["default"].div `
5623
+ box-sizing: border-box;
5624
+ ${StyledWord}, span {
5625
+ &::selection {
5626
+ background-color: ${({ theme }) => getColor(theme.palette.kale, 700, undefined, 0.5)};
5627
+ }
5628
+ }
5629
+ `;
5630
+ /**
5631
+ * Use Highlight to use highlight interation on any text element
5632
+ */
5633
+ const Highlight = (props) => {
5634
+ const ref = React.useRef(null);
5635
+ const handleSelectionChange = React.useCallback(() => {
5636
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
5637
+ const activeSelection = document.getSelection();
5638
+ const text = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.toString();
5639
+ if (!activeSelection || !text) {
5640
+ return;
5641
+ }
5642
+ const anchorNode = (_a = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.anchorNode) === null || _a === void 0 ? void 0 : _a.parentElement;
5643
+ const focusNode = (_b = activeSelection === null || activeSelection === void 0 ? void 0 : activeSelection.focusNode) === null || _b === void 0 ? void 0 : _b.parentElement;
5644
+ if (anchorNode &&
5645
+ focusNode &&
5646
+ ((_c = ref.current) === null || _c === void 0 ? void 0 : _c.contains(anchorNode)) && // Selection starts inside the ref
5647
+ ((_d = ref.current) === null || _d === void 0 ? void 0 : _d.contains(focusNode)) // Selection ends inside the ref
5648
+ ) {
5649
+ const selectionPart = {
5650
+ from: Math.min(Number.parseFloat((_e = anchorNode.getAttribute("data-start")) !== null && _e !== void 0 ? _e : "0"), Number.parseFloat((_f = focusNode.getAttribute("data-start")) !== null && _f !== void 0 ? _f : "0")),
5651
+ to: Math.max(Number.parseFloat((_g = anchorNode.getAttribute("data-end")) !== null && _g !== void 0 ? _g : "0"), Number.parseFloat((_h = focusNode.getAttribute("data-end")) !== null && _h !== void 0 ? _h : "0")),
5652
+ };
5653
+ (_j = props === null || props === void 0 ? void 0 : props.handleSelection) === null || _j === void 0 ? void 0 : _j.call(props, Object.assign(Object.assign({}, selectionPart), { text }));
5654
+ }
5655
+ }, [props]);
5656
+ React.useEffect(() => {
5657
+ if (ref.current === null)
5658
+ return;
5659
+ document.addEventListener("selectionchange", handleSelectionChange);
5660
+ return () => {
5661
+ document.removeEventListener("selectionchange", handleSelectionChange);
5662
+ };
5663
+ }, [ref, props, handleSelectionChange]);
5664
+ return (jsxRuntime.jsx(HighlightContextProvider, Object.assign({ term: props.search }, { children: jsxRuntime.jsx(WordsContainer, Object.assign({ ref: ref }, { children: props.children })) })));
5665
+ };
5666
+ const Word = (props) => {
5667
+ var _a;
5668
+ const isActive = props.currentTime &&
5669
+ props.currentTime >= props.start &&
5670
+ props.currentTime < props.end;
5671
+ // Is there an observation that contains this word?
5672
+ const observation = (_a = props.observations) === null || _a === void 0 ? void 0 : _a.find((obs) => props.start >= obs.start && props.end <= obs.end);
5673
+ if (props.tooltipContent !== undefined && !!observation) {
5674
+ return (jsxRuntime.jsx(Tooltip, Object.assign({ content: props.tooltipContent(observation), isTransparent: true }, { children: jsxRuntime.jsxs(StyledWord, Object.assign({}, props, { observation: observation, "data-start": props.start, "data-end": props.end, className: !!observation ? "highlighted" : "" }, (!!observation ? { tag: "observation" } : {}), { children: [isActive ? (jsxRuntime.jsx(ActiveWord, { children: jsxRuntime.jsx(Searchable, { text: props.text }) })) : (jsxRuntime.jsx(Searchable, { text: props.text })), " "] })) })));
5675
+ }
5676
+ return (jsxRuntime.jsxs(StyledWord, Object.assign({}, props, { observation: observation, "data-start": props.start, "data-end": props.end, className: !!observation ? "highlighted" : "" }, (!!observation ? { tag: "observation" } : {}), { children: [isActive ? (jsxRuntime.jsx(ActiveWord, { children: jsxRuntime.jsx(Searchable, { text: props.text }) })) : (jsxRuntime.jsx(Searchable, { text: props.text })), " "] })));
5677
+ };
5678
+ Highlight.Word = Word;
5679
+
5368
5680
  /**
5369
5681
  * The Dots loader communicates ongoing activity after a user takes an action.
5370
5682
  * It tells them that something is taking place.
@@ -6841,6 +7153,7 @@ exports.HeaderItem = HeaderItem;
6841
7153
  exports.HeaderItemIcon = HeaderItemIcon;
6842
7154
  exports.HeaderItemText = HeaderItemText;
6843
7155
  exports.HeaderRow = HeaderRow;
7156
+ exports.Highlight = Highlight;
6844
7157
  exports.Hint = Hint;
6845
7158
  exports.Icon = Icon;
6846
7159
  exports.IconButton = IconButton;