@ordinatio/ui 1.2.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -374,7 +374,7 @@ function EmailBodyRenderer({
374
374
  keyCleanupRef.current?.();
375
375
  };
376
376
  }, []);
377
- const containerStyle = {
377
+ const containerStyle2 = {
378
378
  border: "1px solid #e5e7eb",
379
379
  borderRadius: "8px",
380
380
  backgroundColor: "#ffffff",
@@ -416,7 +416,7 @@ function EmailBodyRenderer({
416
416
  const css = iframeStyles ?? DEFAULT_IFRAME_STYLES;
417
417
  const csp = buildIframeCSP(imagePolicy);
418
418
  const srcDoc = `<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${csp}"><base target="_blank"><style>${css}</style></head><body>${cleanHtml}</body></html>`;
419
- return /* @__PURE__ */ jsxs2("div", { className, style: containerStyle, children: [
419
+ return /* @__PURE__ */ jsxs2("div", { className, style: containerStyle2, children: [
420
420
  showPrivacyBanner && /* @__PURE__ */ jsxs2("div", { style: {
421
421
  display: "flex",
422
422
  alignItems: "center",
@@ -468,7 +468,7 @@ function EmailBodyRenderer({
468
468
  ] });
469
469
  }
470
470
  if (bodyText) {
471
- return /* @__PURE__ */ jsx2("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx2("pre", { style: {
471
+ return /* @__PURE__ */ jsx2("div", { className, style: containerStyle2, children: /* @__PURE__ */ jsx2("pre", { style: {
472
472
  whiteSpace: "pre-wrap",
473
473
  fontFamily: "system-ui, sans-serif",
474
474
  padding: "16px",
@@ -477,7 +477,7 @@ function EmailBodyRenderer({
477
477
  }, children: bodyText }) });
478
478
  }
479
479
  if (snippet) {
480
- return /* @__PURE__ */ jsx2("div", { className, style: containerStyle, children: /* @__PURE__ */ jsx2("p", { style: { padding: "16px", margin: 0, color: "#6b7280", fontSize: "14px" }, children: snippet }) });
480
+ return /* @__PURE__ */ jsx2("div", { className, style: containerStyle2, children: /* @__PURE__ */ jsx2("p", { style: { padding: "16px", margin: 0, color: "#6b7280", fontSize: "14px" }, children: snippet }) });
481
481
  }
482
482
  return null;
483
483
  }
@@ -693,8 +693,769 @@ function ArchiveButton({
693
693
  );
694
694
  }
695
695
 
696
+ // src/components/entity-picker.tsx
697
+ import { useCallback as useCallback2, useEffect as useEffect2, useId, useRef as useRef2, useState as useState3 } from "react";
698
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
699
+ var defaults = {
700
+ root: { position: "relative", display: "inline-flex", alignItems: "center", gap: "4px", width: "100%" },
701
+ input: { flex: 1, minWidth: 0, padding: "8px 10px", fontSize: "14px", border: "1px solid #d4d4d4", borderRadius: "6px", backgroundColor: "#ffffff", color: "#171717" },
702
+ clear: { padding: "4px 8px", fontSize: "14px", border: "1px solid transparent", borderRadius: "6px", backgroundColor: "transparent", color: "#525252", cursor: "pointer" },
703
+ list: { position: "absolute", top: "100%", left: 0, right: 0, zIndex: 20, margin: "4px 0 0", padding: "4px", maxHeight: "240px", overflowY: "auto", border: "1px solid #d4d4d4", borderRadius: "6px", backgroundColor: "#ffffff", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" },
704
+ message: { padding: "6px 8px", fontSize: "13px", color: "#525252" }
705
+ };
706
+ var optionDefaults = {
707
+ base: { padding: "6px 8px", fontSize: "14px", borderRadius: "4px", cursor: "pointer", color: "#171717" },
708
+ active: { backgroundColor: "#f5f5f5" }
709
+ };
710
+ var visuallyHidden = { position: "absolute", width: "1px", height: "1px", margin: "-1px", padding: 0, overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap", border: 0 };
711
+ function EntityPicker({
712
+ value,
713
+ onChange,
714
+ search,
715
+ getKey,
716
+ getLabel,
717
+ renderOption,
718
+ ariaLabel,
719
+ id,
720
+ name,
721
+ placeholder,
722
+ disabled = false,
723
+ minChars = 1,
724
+ debounceMs = 200,
725
+ clearable = true,
726
+ clearLabel = "Clear selection",
727
+ loadingText = "Searching\u2026",
728
+ emptyText = "No matches",
729
+ errorText = "Search failed. Keep typing to try again.",
730
+ classNames,
731
+ style
732
+ }) {
733
+ const listId = useId();
734
+ const listRef = useRef2(null);
735
+ const inputRef = useRef2(null);
736
+ const selectAfterRender = useRef2(null);
737
+ const [text, setText] = useState3("");
738
+ const [editing, setEditing] = useState3(false);
739
+ const [open, setOpen] = useState3(false);
740
+ const [results, setResults] = useState3([]);
741
+ const [status, setStatus] = useState3("idle");
742
+ const [searched, setSearched] = useState3(false);
743
+ const [activeIndex, setActiveIndex] = useState3(-1);
744
+ const timer = useRef2(null);
745
+ const controller = useRef2(null);
746
+ const latest = useRef2(0);
747
+ const cancelSearch = useCallback2(() => {
748
+ if (timer.current) clearTimeout(timer.current);
749
+ timer.current = null;
750
+ controller.current?.abort();
751
+ controller.current = null;
752
+ latest.current++;
753
+ }, []);
754
+ useEffect2(() => cancelSearch, [cancelSearch]);
755
+ const runSearch = useCallback2(
756
+ (query) => {
757
+ cancelSearch();
758
+ const trimmed = query.trim();
759
+ if (trimmed.length < minChars) {
760
+ setResults([]);
761
+ setStatus("idle");
762
+ setSearched(false);
763
+ setActiveIndex(-1);
764
+ return;
765
+ }
766
+ const ticket = latest.current;
767
+ setStatus("loading");
768
+ setActiveIndex(-1);
769
+ timer.current = setTimeout(() => {
770
+ const abort = new AbortController();
771
+ controller.current = abort;
772
+ const fail = () => {
773
+ if (ticket !== latest.current) return;
774
+ setResults([]);
775
+ setSearched(false);
776
+ setStatus("error");
777
+ setActiveIndex(-1);
778
+ };
779
+ Promise.resolve().then(() => search(trimmed, abort.signal)).then((items) => {
780
+ if (ticket !== latest.current) return;
781
+ if (!Array.isArray(items)) return fail();
782
+ setResults(items);
783
+ setSearched(true);
784
+ setStatus("idle");
785
+ setActiveIndex(items.length > 0 ? 0 : -1);
786
+ }).catch(fail);
787
+ }, debounceMs);
788
+ },
789
+ [cancelSearch, debounceMs, minChars, search]
790
+ );
791
+ const stopEditing = () => {
792
+ cancelSearch();
793
+ setEditing(false);
794
+ setOpen(false);
795
+ setText("");
796
+ setResults([]);
797
+ setStatus("idle");
798
+ setSearched(false);
799
+ setActiveIndex(-1);
800
+ };
801
+ const choose = (item) => {
802
+ selectAfterRender.current = { key: getKey(item) };
803
+ stopEditing();
804
+ onChange(item);
805
+ };
806
+ const showPopup = open && !disabled && (status !== "idle" || searched);
807
+ const showListbox = showPopup && results.length > 0;
808
+ const activeId = showListbox && activeIndex >= 0 ? `${listId}-opt-${activeIndex}` : void 0;
809
+ const announcement = !showPopup ? "" : status === "loading" ? loadingText : status === "error" ? errorText : results.length === 0 ? emptyText : "";
810
+ useEffect2(() => {
811
+ if (showListbox && activeIndex >= 0) listRef.current?.children[activeIndex]?.scrollIntoView?.({ block: "nearest" });
812
+ }, [showListbox, activeIndex]);
813
+ useEffect2(() => {
814
+ const pending = selectAfterRender.current;
815
+ if (!pending || editing) return;
816
+ if ((value ? getKey(value) : null) !== pending.key) return;
817
+ selectAfterRender.current = null;
818
+ if (document.activeElement === inputRef.current) inputRef.current?.select();
819
+ }, [value, editing, getKey]);
820
+ useEffect2(() => {
821
+ if (disabled) stopEditing();
822
+ }, [disabled]);
823
+ const onKeyDown = (event) => {
824
+ if (event.nativeEvent.isComposing || event.keyCode === 229) return;
825
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
826
+ if (!showListbox || status === "loading") return;
827
+ event.preventDefault();
828
+ const step = event.key === "ArrowDown" ? 1 : -1;
829
+ setActiveIndex((index) => (index + step + results.length) % results.length);
830
+ } else if (event.key === "Enter") {
831
+ if (!showPopup) return;
832
+ event.preventDefault();
833
+ if (status !== "loading" && activeIndex >= 0 && results[activeIndex]) choose(results[activeIndex]);
834
+ } else if (event.key === "Escape") {
835
+ if (open) {
836
+ event.preventDefault();
837
+ event.stopPropagation();
838
+ selectAfterRender.current = { key: value ? getKey(value) : null };
839
+ stopEditing();
840
+ }
841
+ }
842
+ };
843
+ const partProps = (key) => {
844
+ const className = classNames?.[key];
845
+ if (className) return { className, style: key === "root" ? style : void 0 };
846
+ return { style: key === "root" ? { ...defaults.root, ...style } : defaults[key] };
847
+ };
848
+ const optionProps = (active) => {
849
+ const optionClass = classNames?.option;
850
+ const activeClass = classNames?.optionActive;
851
+ const className = [optionClass, active ? activeClass : void 0].filter(Boolean).join(" ") || void 0;
852
+ return { className, style: optionClass ? void 0 : { ...optionDefaults.base, ...active && !activeClass ? optionDefaults.active : {} } };
853
+ };
854
+ const shown = editing ? text : value ? getLabel(value) : "";
855
+ return /* @__PURE__ */ jsxs4("div", { ...partProps("root"), children: [
856
+ /* @__PURE__ */ jsx5(
857
+ "input",
858
+ {
859
+ ...partProps("input"),
860
+ ref: inputRef,
861
+ id,
862
+ type: "text",
863
+ role: "combobox",
864
+ "aria-label": ariaLabel,
865
+ "aria-expanded": showListbox,
866
+ "aria-controls": showListbox ? listId : void 0,
867
+ "aria-autocomplete": "list",
868
+ "aria-activedescendant": activeId,
869
+ autoComplete: "off",
870
+ placeholder,
871
+ disabled,
872
+ value: shown,
873
+ onChange: (event) => {
874
+ setEditing(true);
875
+ setText(event.target.value);
876
+ setOpen(true);
877
+ runSearch(event.target.value);
878
+ },
879
+ onKeyDown,
880
+ onFocus: (event) => {
881
+ if (!editing && value) event.target.select();
882
+ },
883
+ onBlur: () => {
884
+ if (document.hasFocus()) stopEditing();
885
+ }
886
+ }
887
+ ),
888
+ name !== void 0 ? /* @__PURE__ */ jsx5("input", { type: "hidden", name, value: value ? getKey(value) : "", disabled }) : null,
889
+ clearable && value && !disabled ? /* @__PURE__ */ jsx5("button", { type: "button", "aria-label": clearLabel, ...partProps("clear"), onClick: () => {
890
+ onChange(null);
891
+ inputRef.current?.focus();
892
+ }, children: "\xD7" }) : null,
893
+ /* @__PURE__ */ jsx5("div", { role: "status", "aria-live": "polite", style: visuallyHidden, children: announcement }),
894
+ showPopup ? (
895
+ // mousedown anywhere in the popup (an option, the scrollbar, a message) must not move focus out of the input, or its
896
+ // blur would close the list before the click lands (and make a long list impossible to scroll by dragging)
897
+ /* @__PURE__ */ jsxs4("div", { ...partProps("list"), onMouseDown: (event) => event.preventDefault(), children: [
898
+ showListbox ? /* @__PURE__ */ jsx5("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": ariaLabel, style: { listStyle: "none", margin: 0, padding: 0 }, children: results.map((item, index) => {
899
+ const active = index === activeIndex;
900
+ return /* @__PURE__ */ jsx5(
901
+ "li",
902
+ {
903
+ id: `${listId}-opt-${index}`,
904
+ role: "option",
905
+ "aria-selected": active,
906
+ ...optionProps(active),
907
+ onClick: () => choose(item),
908
+ onMouseMove: () => {
909
+ if (status !== "loading" && index !== activeIndex) setActiveIndex(index);
910
+ },
911
+ children: renderOption ? renderOption(item, { active }) : getLabel(item)
912
+ },
913
+ getKey(item)
914
+ );
915
+ }) }) : null,
916
+ status === "loading" ? /* @__PURE__ */ jsx5("div", { "aria-hidden": "true", "data-entity-picker-message": "loading", ...partProps("message"), children: loadingText }) : null,
917
+ status === "error" ? /* @__PURE__ */ jsx5("div", { "aria-hidden": "true", "data-entity-picker-message": "error", ...partProps("message"), children: errorText }) : null,
918
+ status === "idle" && searched && results.length === 0 ? /* @__PURE__ */ jsx5("div", { "aria-hidden": "true", "data-entity-picker-message": "empty", ...partProps("message"), children: emptyText }) : null
919
+ ] })
920
+ ) : null
921
+ ] });
922
+ }
923
+
924
+ // src/components/rich-text-editor.tsx
925
+ import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
926
+
927
+ // src/components/rich-text-editor-styles.ts
928
+ var containerStyle = {
929
+ border: "1px solid #d4d4d4",
930
+ borderRadius: "6px",
931
+ backgroundColor: "#ffffff"
932
+ };
933
+ var toolbarStyle = {
934
+ display: "flex",
935
+ alignItems: "center",
936
+ gap: "4px",
937
+ padding: "6px 8px",
938
+ borderBottom: "1px solid #e5e5e5"
939
+ };
940
+ var toolbarButtonStyle = {
941
+ display: "inline-flex",
942
+ alignItems: "center",
943
+ justifyContent: "center",
944
+ minWidth: "28px",
945
+ height: "28px",
946
+ padding: "0 6px",
947
+ fontSize: "13px",
948
+ fontWeight: 600,
949
+ border: "1px solid transparent",
950
+ borderRadius: "4px",
951
+ backgroundColor: "transparent",
952
+ color: "#171717",
953
+ cursor: "pointer"
954
+ };
955
+ var lockedToolbarButtonStyle = {
956
+ opacity: 0.4,
957
+ cursor: "not-allowed"
958
+ };
959
+ var toolbarRightStyle = {
960
+ marginLeft: "auto"
961
+ };
962
+ var linkErrorStyle = {
963
+ padding: "6px 8px",
964
+ fontSize: "12px",
965
+ color: "#dc2626",
966
+ backgroundColor: "#fef2f2"
967
+ };
968
+ var editableStyle = {
969
+ padding: "8px 12px",
970
+ fontSize: "14px",
971
+ lineHeight: 1.5,
972
+ color: "#171717",
973
+ outline: "none",
974
+ overflowY: "auto"
975
+ };
976
+
977
+ // src/components/rich-text-editor.tsx
978
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
979
+ var TOOLBAR_BUTTONS = [
980
+ { command: "bold", label: "B", ariaLabel: "Bold" },
981
+ { command: "italic", label: "I", ariaLabel: "Italic" },
982
+ { command: "underline", label: "U", ariaLabel: "Underline" },
983
+ { command: "insertUnorderedList", label: "\u2022", ariaLabel: "Bulleted list" },
984
+ { command: "insertOrderedList", label: "1.", ariaLabel: "Numbered list" }
985
+ ];
986
+ var ALLOWED_LINK_SCHEMES = ["http:", "https:", "mailto:"];
987
+ function isSafeLinkUrl(url) {
988
+ try {
989
+ return ALLOWED_LINK_SCHEMES.includes(new URL(url).protocol);
990
+ } catch {
991
+ return true;
992
+ }
993
+ }
994
+ function isEmptyHtml(html) {
995
+ return !html.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").trim();
996
+ }
997
+ function RichTextEditor({
998
+ content,
999
+ onChange,
1000
+ placeholder = "Start typing\u2026",
1001
+ minHeight = "120px",
1002
+ maxHeight = "400px",
1003
+ autoFocus = false,
1004
+ editable = true,
1005
+ locked = false,
1006
+ toolbarRight,
1007
+ className,
1008
+ style
1009
+ }) {
1010
+ const editorRef = useRef3(null);
1011
+ const [isFocused, setIsFocused] = useState4(false);
1012
+ const [isEmpty, setIsEmpty] = useState4(isEmptyHtml(content));
1013
+ const [linkError, setLinkError] = useState4(null);
1014
+ useEffect3(() => {
1015
+ const el = editorRef.current;
1016
+ if (el && !isFocused && el.innerHTML !== content) {
1017
+ el.innerHTML = content;
1018
+ setIsEmpty(isEmptyHtml(content));
1019
+ }
1020
+ }, [content, isFocused, editable]);
1021
+ useEffect3(() => {
1022
+ if (autoFocus) editorRef.current?.focus();
1023
+ }, []);
1024
+ const handleInput = useCallback3(() => {
1025
+ const html = editorRef.current?.innerHTML ?? "";
1026
+ setIsEmpty(isEmptyHtml(html));
1027
+ onChange(html);
1028
+ }, [onChange]);
1029
+ const runCommand = useCallback3(
1030
+ (command, value) => {
1031
+ editorRef.current?.focus();
1032
+ document.execCommand(command, false, value);
1033
+ handleInput();
1034
+ },
1035
+ [handleInput]
1036
+ );
1037
+ const handleLink = useCallback3(() => {
1038
+ const url = window.prompt("Link URL")?.trim();
1039
+ setLinkError(null);
1040
+ if (!url) return;
1041
+ if (!isSafeLinkUrl(url)) {
1042
+ setLinkError("That link type is not allowed. Use an http(s) or mailto link.");
1043
+ return;
1044
+ }
1045
+ runCommand("createLink", url);
1046
+ }, [runCommand]);
1047
+ if (!editable) {
1048
+ return /* @__PURE__ */ jsx6(
1049
+ "div",
1050
+ {
1051
+ className: [className, "ordinatio-rte", "ordinatio-rte-readonly"].filter(Boolean).join(" "),
1052
+ style: className ? style : { ...editableStyle, ...style },
1053
+ dangerouslySetInnerHTML: { __html: content }
1054
+ }
1055
+ );
1056
+ }
1057
+ return /* @__PURE__ */ jsxs5("div", { className: [className, "ordinatio-rte"].filter(Boolean).join(" "), style: className ? style : { ...containerStyle, ...style }, children: [
1058
+ /* @__PURE__ */ jsxs5("div", { className: "ordinatio-rte-toolbar", style: toolbarStyle, children: [
1059
+ TOOLBAR_BUTTONS.map((btn) => /* @__PURE__ */ jsx6(
1060
+ "button",
1061
+ {
1062
+ type: "button",
1063
+ className: "ordinatio-rte-toolbar-button",
1064
+ "aria-label": btn.ariaLabel,
1065
+ disabled: locked,
1066
+ onMouseDown: (e) => e.preventDefault(),
1067
+ onClick: () => runCommand(btn.command, btn.value),
1068
+ style: locked ? { ...toolbarButtonStyle, ...lockedToolbarButtonStyle } : toolbarButtonStyle,
1069
+ children: btn.label
1070
+ },
1071
+ btn.command
1072
+ )),
1073
+ /* @__PURE__ */ jsx6(
1074
+ "button",
1075
+ {
1076
+ type: "button",
1077
+ className: "ordinatio-rte-toolbar-button",
1078
+ "aria-label": "Insert link",
1079
+ disabled: locked,
1080
+ onMouseDown: (e) => e.preventDefault(),
1081
+ onClick: handleLink,
1082
+ style: locked ? { ...toolbarButtonStyle, ...lockedToolbarButtonStyle } : toolbarButtonStyle,
1083
+ children: "\u{1F517}"
1084
+ }
1085
+ ),
1086
+ toolbarRight ? /* @__PURE__ */ jsx6("div", { className: "ordinatio-rte-toolbar-right", style: toolbarRightStyle, children: toolbarRight }) : null
1087
+ ] }),
1088
+ linkError ? /* @__PURE__ */ jsx6("div", { className: "ordinatio-rte-link-error", role: "alert", style: linkErrorStyle, children: linkError }) : null,
1089
+ /* @__PURE__ */ jsxs5("div", { className: "ordinatio-rte-editable-wrap", style: { position: "relative" }, children: [
1090
+ isEmpty ? (
1091
+ // Shown while empty REGARDLESS of focus — WorldClass cycle 1:
1092
+ // the prior `isEmpty && !isFocused` condition hid the
1093
+ // placeholder the instant an empty editor was clicked, before
1094
+ // any typing, leaving a totally blank box with no confirmation
1095
+ // the click landed. Matches native `<textarea placeholder>`
1096
+ // behavior (visible while focused-and-empty, removed only once
1097
+ // the user types).
1098
+ /* @__PURE__ */ jsx6(
1099
+ "div",
1100
+ {
1101
+ "aria-hidden": "true",
1102
+ className: "ordinatio-rte-placeholder",
1103
+ style: { ...editableStyle, position: "absolute", inset: 0, color: "#a3a3a3", pointerEvents: "none" },
1104
+ children: placeholder
1105
+ }
1106
+ )
1107
+ ) : null,
1108
+ /* @__PURE__ */ jsx6(
1109
+ "div",
1110
+ {
1111
+ ref: editorRef,
1112
+ role: "textbox",
1113
+ "aria-multiline": "true",
1114
+ "aria-label": placeholder,
1115
+ "aria-disabled": locked,
1116
+ className: "ordinatio-rte-editable",
1117
+ contentEditable: !locked,
1118
+ suppressContentEditableWarning: true,
1119
+ onInput: handleInput,
1120
+ onFocus: () => setIsFocused(true),
1121
+ onBlur: () => setIsFocused(false),
1122
+ style: locked ? { ...editableStyle, minHeight, maxHeight, opacity: 0.6 } : { ...editableStyle, minHeight, maxHeight }
1123
+ }
1124
+ )
1125
+ ] })
1126
+ ] });
1127
+ }
1128
+
1129
+ // src/components/reply-panel.tsx
1130
+ import { useEffect as useEffect4, useId as useId2, useRef as useRef4, useState as useState5 } from "react";
1131
+
1132
+ // src/components/subject-prefix.ts
1133
+ function prefixSubject(subject, mode) {
1134
+ const prefix = mode === "forward" ? "Fwd" : "Re";
1135
+ let stripped = subject.trim();
1136
+ let previous;
1137
+ do {
1138
+ previous = stripped;
1139
+ stripped = stripped.replace(/^(re|fwd?)\s*:\s*/i, "").trim();
1140
+ } while (stripped !== previous);
1141
+ return `${prefix}: ${stripped}`;
1142
+ }
1143
+
1144
+ // src/components/reply-panel-styles.ts
1145
+ var fieldRowStyle = {
1146
+ display: "flex",
1147
+ alignItems: "center",
1148
+ gap: "8px"
1149
+ };
1150
+ var fieldLabelStyle = {
1151
+ fontSize: "12px",
1152
+ color: "#737373",
1153
+ width: "32px",
1154
+ flexShrink: 0
1155
+ };
1156
+ var fieldInputStyle = {
1157
+ flex: 1,
1158
+ border: "1px solid #d4d4d4",
1159
+ borderRadius: "4px",
1160
+ padding: "6px 8px",
1161
+ fontSize: "13px",
1162
+ color: "#171717",
1163
+ outline: "none"
1164
+ };
1165
+ var ccBccToggleStyle = {
1166
+ fontSize: "12px",
1167
+ color: "#2563eb",
1168
+ background: "none",
1169
+ border: "none",
1170
+ cursor: "pointer",
1171
+ marginLeft: "auto",
1172
+ flexShrink: 0
1173
+ };
1174
+ var errorStyle = {
1175
+ backgroundColor: "#fef2f2",
1176
+ color: "#dc2626",
1177
+ padding: "8px",
1178
+ borderRadius: "6px",
1179
+ fontSize: "13px"
1180
+ };
1181
+ var successStyle = {
1182
+ backgroundColor: "#f0fdf4",
1183
+ color: "#16a34a",
1184
+ padding: "8px",
1185
+ borderRadius: "6px",
1186
+ fontSize: "13px"
1187
+ };
1188
+ var actionsRowStyle = {
1189
+ display: "flex",
1190
+ alignItems: "center",
1191
+ justifyContent: "flex-end",
1192
+ gap: "8px"
1193
+ };
1194
+ var cancelButtonStyle = {
1195
+ padding: "8px 16px",
1196
+ fontSize: "14px",
1197
+ fontWeight: 500,
1198
+ borderRadius: "6px",
1199
+ border: "1px solid #d4d4d4",
1200
+ backgroundColor: "#ffffff",
1201
+ color: "#171717",
1202
+ cursor: "pointer"
1203
+ };
1204
+ var sendButtonStyle = {
1205
+ padding: "8px 16px",
1206
+ fontSize: "14px",
1207
+ fontWeight: 500,
1208
+ borderRadius: "6px",
1209
+ border: "1px solid transparent",
1210
+ backgroundColor: "#171717",
1211
+ color: "#ffffff",
1212
+ cursor: "pointer"
1213
+ };
1214
+ var disabledButtonStyle = {
1215
+ opacity: 0.5,
1216
+ cursor: "not-allowed"
1217
+ };
1218
+
1219
+ // src/components/reply-panel.tsx
1220
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1221
+ function ReplyPanel({
1222
+ mode = "reply",
1223
+ subject,
1224
+ toName,
1225
+ toEmail,
1226
+ initialCc = "",
1227
+ initialShowCcBcc = false,
1228
+ onSend,
1229
+ successMessage,
1230
+ onCancel,
1231
+ showCancel = true,
1232
+ sendButtonText,
1233
+ initialBody = "",
1234
+ className,
1235
+ style
1236
+ }) {
1237
+ const defaultTo = mode === "reply" ? toEmail || toName : "";
1238
+ const defaultSubject = prefixSubject(subject, mode);
1239
+ const idPrefix = useId2();
1240
+ const toId = `${idPrefix}-to`;
1241
+ const ccId = `${idPrefix}-cc`;
1242
+ const bccId = `${idPrefix}-bcc`;
1243
+ const subjectId = `${idPrefix}-subject`;
1244
+ const [to, setTo] = useState5(defaultTo);
1245
+ const [cc, setCc] = useState5(initialCc);
1246
+ const [bcc, setBcc] = useState5("");
1247
+ const [showCcBcc, setShowCcBcc] = useState5(initialShowCcBcc || !!initialCc);
1248
+ const [editedSubject, setEditedSubject] = useState5(defaultSubject);
1249
+ const [body, setBody] = useState5(initialBody);
1250
+ const [sending, setSending] = useState5(false);
1251
+ const [error, setError] = useState5(null);
1252
+ const [sent, setSent] = useState5(false);
1253
+ const isMountedRef = useRef4(true);
1254
+ useEffect4(() => {
1255
+ isMountedRef.current = true;
1256
+ return () => {
1257
+ isMountedRef.current = false;
1258
+ };
1259
+ }, []);
1260
+ const resolvedSendLabel = sendButtonText ?? (mode === "reply" ? "Send reply" : "Forward");
1261
+ const resolvedSuccessMessage = successMessage ?? (mode === "reply" ? "\u2713 Reply sent." : "\u2713 Forwarded.");
1262
+ const isSendDisabled = sending || mode === "reply" && isEmptyHtml(body) || mode === "forward" && !to.trim();
1263
+ const handleSend = async () => {
1264
+ if (mode === "forward" && !to.trim()) {
1265
+ setError("Please enter a recipient email address");
1266
+ return;
1267
+ }
1268
+ if (mode === "reply" && isEmptyHtml(body)) return;
1269
+ setSending(true);
1270
+ setError(null);
1271
+ setSent(false);
1272
+ try {
1273
+ await onSend(body, {
1274
+ to: to !== defaultTo ? to.trim() : void 0,
1275
+ cc: cc !== initialCc ? cc.trim() : void 0,
1276
+ // bcc's own default is always '' (no initialBcc prop exists) —
1277
+ // compared the same way as its siblings (WorldClass cycle 3: a
1278
+ // prior version checked `bcc.trim()` truthiness instead, which
1279
+ // reported a whitespace-only Bcc as "untouched" rather than
1280
+ // "deliberately cleared," an inconsistency with how to/cc/subject
1281
+ // treat the identical shape of edit).
1282
+ bcc: bcc !== "" ? bcc.trim() : void 0,
1283
+ subject: editedSubject !== defaultSubject ? editedSubject.trim() : void 0
1284
+ });
1285
+ if (!isMountedRef.current) return;
1286
+ setTo(defaultTo);
1287
+ setCc(initialCc);
1288
+ setBcc("");
1289
+ setEditedSubject(defaultSubject);
1290
+ setBody("");
1291
+ setSent(true);
1292
+ } catch (err) {
1293
+ if (!isMountedRef.current) return;
1294
+ setError(err instanceof Error ? err.message : `Failed to ${mode === "forward" ? "forward" : "send reply"}.`);
1295
+ } finally {
1296
+ if (isMountedRef.current) setSending(false);
1297
+ }
1298
+ };
1299
+ return /* @__PURE__ */ jsxs6(
1300
+ "div",
1301
+ {
1302
+ className: [className, "ordinatio-reply-panel"].filter(Boolean).join(" "),
1303
+ style: className ? style : { display: "flex", flexDirection: "column", gap: "8px", ...style },
1304
+ children: [
1305
+ /* @__PURE__ */ jsxs6("div", { className: "ordinatio-reply-fields", style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
1306
+ /* @__PURE__ */ jsxs6("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1307
+ /* @__PURE__ */ jsx7("label", { htmlFor: toId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "To" }),
1308
+ /* @__PURE__ */ jsx7(
1309
+ "input",
1310
+ {
1311
+ id: toId,
1312
+ type: "text",
1313
+ className: "ordinatio-reply-field-input",
1314
+ value: to,
1315
+ onChange: (e) => {
1316
+ setTo(e.target.value);
1317
+ setSent(false);
1318
+ setError(null);
1319
+ },
1320
+ placeholder: "recipient@example.com",
1321
+ autoFocus: mode === "forward",
1322
+ disabled: sending,
1323
+ style: fieldInputStyle
1324
+ }
1325
+ ),
1326
+ !showCcBcc ? (
1327
+ // Deliberately no aria-expanded/aria-controls (WorldClass
1328
+ // cycle 5 — a cycle-4 version added both, then cycle 5's own
1329
+ // review found they asserted a bidirectional disclosure
1330
+ // relationship this button doesn't actually have: it only
1331
+ // ever renders in the collapsed state — see this ternary's own
1332
+ // condition — so aria-expanded could only ever read `false`,
1333
+ // and aria-controls referenced ids (ccId/bccId) that don't
1334
+ // exist in the DOM until AFTER this button has already
1335
+ // unmounted. A one-directional reveal, not a toggle.
1336
+ /* @__PURE__ */ jsx7(
1337
+ "button",
1338
+ {
1339
+ type: "button",
1340
+ className: "ordinatio-reply-ccbcc-toggle",
1341
+ onClick: () => setShowCcBcc(true),
1342
+ disabled: sending,
1343
+ style: ccBccToggleStyle,
1344
+ children: "Cc/Bcc"
1345
+ }
1346
+ )
1347
+ ) : null
1348
+ ] }),
1349
+ showCcBcc ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1350
+ /* @__PURE__ */ jsxs6("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1351
+ /* @__PURE__ */ jsx7("label", { htmlFor: ccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Cc" }),
1352
+ /* @__PURE__ */ jsx7(
1353
+ "input",
1354
+ {
1355
+ id: ccId,
1356
+ type: "text",
1357
+ className: "ordinatio-reply-field-input",
1358
+ value: cc,
1359
+ onChange: (e) => {
1360
+ setCc(e.target.value);
1361
+ setSent(false);
1362
+ setError(null);
1363
+ },
1364
+ placeholder: "cc@example.com",
1365
+ disabled: sending,
1366
+ style: fieldInputStyle
1367
+ }
1368
+ )
1369
+ ] }),
1370
+ /* @__PURE__ */ jsxs6("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1371
+ /* @__PURE__ */ jsx7("label", { htmlFor: bccId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Bcc" }),
1372
+ /* @__PURE__ */ jsx7(
1373
+ "input",
1374
+ {
1375
+ id: bccId,
1376
+ type: "text",
1377
+ className: "ordinatio-reply-field-input",
1378
+ value: bcc,
1379
+ onChange: (e) => {
1380
+ setBcc(e.target.value);
1381
+ setSent(false);
1382
+ setError(null);
1383
+ },
1384
+ placeholder: "bcc@example.com",
1385
+ disabled: sending,
1386
+ style: fieldInputStyle
1387
+ }
1388
+ )
1389
+ ] })
1390
+ ] }) : null,
1391
+ /* @__PURE__ */ jsxs6("div", { className: "ordinatio-reply-field-row", style: fieldRowStyle, children: [
1392
+ /* @__PURE__ */ jsx7("label", { htmlFor: subjectId, className: "ordinatio-reply-field-label", style: fieldLabelStyle, children: "Subject" }),
1393
+ /* @__PURE__ */ jsx7(
1394
+ "input",
1395
+ {
1396
+ id: subjectId,
1397
+ type: "text",
1398
+ className: "ordinatio-reply-field-input",
1399
+ value: editedSubject,
1400
+ onChange: (e) => {
1401
+ setEditedSubject(e.target.value);
1402
+ setSent(false);
1403
+ setError(null);
1404
+ },
1405
+ placeholder: "Subject",
1406
+ disabled: sending,
1407
+ style: fieldInputStyle
1408
+ }
1409
+ )
1410
+ ] })
1411
+ ] }),
1412
+ error ? /* @__PURE__ */ jsx7("div", { className: "ordinatio-reply-error", role: "alert", style: errorStyle, children: error }) : null,
1413
+ sent && resolvedSuccessMessage ? /* @__PURE__ */ jsx7("div", { className: "ordinatio-reply-success", role: "status", style: successStyle, children: resolvedSuccessMessage }) : null,
1414
+ /* @__PURE__ */ jsx7(
1415
+ RichTextEditor,
1416
+ {
1417
+ content: body,
1418
+ onChange: (html) => {
1419
+ setBody(html);
1420
+ setSent(false);
1421
+ setError(null);
1422
+ },
1423
+ placeholder: mode === "forward" ? "Add a message\u2026" : "Write your reply\u2026",
1424
+ autoFocus: mode !== "forward",
1425
+ locked: sending
1426
+ }
1427
+ ),
1428
+ /* @__PURE__ */ jsxs6("div", { className: "ordinatio-reply-actions", style: actionsRowStyle, children: [
1429
+ showCancel && onCancel ? /* @__PURE__ */ jsx7(
1430
+ "button",
1431
+ {
1432
+ type: "button",
1433
+ className: "ordinatio-reply-cancel-button",
1434
+ onClick: onCancel,
1435
+ disabled: sending,
1436
+ style: sending ? { ...cancelButtonStyle, ...disabledButtonStyle } : cancelButtonStyle,
1437
+ children: "Cancel"
1438
+ }
1439
+ ) : null,
1440
+ /* @__PURE__ */ jsx7(
1441
+ "button",
1442
+ {
1443
+ type: "button",
1444
+ className: "ordinatio-reply-send-button",
1445
+ onClick: handleSend,
1446
+ disabled: isSendDisabled,
1447
+ style: isSendDisabled ? { ...sendButtonStyle, ...disabledButtonStyle } : sendButtonStyle,
1448
+ children: sending ? "Sending\u2026" : resolvedSendLabel
1449
+ }
1450
+ )
1451
+ ] })
1452
+ ]
1453
+ }
1454
+ );
1455
+ }
1456
+
696
1457
  // src/hooks/use-keyboard-shortcuts.ts
697
- import { useEffect as useEffect2, useCallback as useCallback2 } from "react";
1458
+ import { useEffect as useEffect5, useCallback as useCallback4 } from "react";
698
1459
 
699
1460
  // src/hooks/is-typing-context.ts
700
1461
  var TYPING_TAG_RE = /^(INPUT|TEXTAREA|SELECT)$/;
@@ -719,14 +1480,14 @@ function useKeyboardShortcuts({
719
1480
  ignoreTags = []
720
1481
  }) {
721
1482
  const malformed = !Array.isArray(shortcuts);
722
- useEffect2(() => {
1483
+ useEffect5(() => {
723
1484
  if (malformed) {
724
1485
  console.error(
725
1486
  "[useKeyboardShortcuts] expected { shortcuts: KeyboardShortcut[] } \u2014 got a non-array `shortcuts` (legacy array call form?). All shortcuts for this caller are disabled until the call is fixed."
726
1487
  );
727
1488
  }
728
1489
  }, [malformed]);
729
- const handleKeyDown = useCallback2(
1490
+ const handleKeyDown = useCallback4(
730
1491
  (e) => {
731
1492
  if (!enabled || malformed) return;
732
1493
  if (e.isComposing || e.keyCode === 229) return;
@@ -754,7 +1515,7 @@ function useKeyboardShortcuts({
754
1515
  },
755
1516
  [shortcuts, enabled, ignoreTags, malformed]
756
1517
  );
757
- useEffect2(() => {
1518
+ useEffect5(() => {
758
1519
  window.addEventListener("keydown", handleKeyDown);
759
1520
  return () => window.removeEventListener("keydown", handleKeyDown);
760
1521
  }, [handleKeyDown]);
@@ -924,13 +1685,13 @@ function getShortcut(context, action) {
924
1685
  }
925
1686
 
926
1687
  // src/components/keyboard-shortcuts-panel.tsx
927
- import { useEffect as useEffect3, useState as useState3 } from "react";
928
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1688
+ import { useEffect as useEffect6, useState as useState6 } from "react";
1689
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
929
1690
  function KeyboardShortcutsPanel({
930
1691
  contexts = ALL_SHORTCUT_CONTEXTS
931
1692
  }) {
932
- const [open, setOpen] = useState3(false);
933
- useEffect3(() => {
1693
+ const [open, setOpen] = useState6(false);
1694
+ useEffect6(() => {
934
1695
  function handleKey(e) {
935
1696
  if (e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey) {
936
1697
  const tag = e.target?.tagName;
@@ -947,33 +1708,33 @@ function KeyboardShortcutsPanel({
947
1708
  return () => window.removeEventListener("keydown", handleKey);
948
1709
  }, [open]);
949
1710
  if (!open) return null;
950
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
951
- /* @__PURE__ */ jsx5(
1711
+ return /* @__PURE__ */ jsxs7(Fragment3, { children: [
1712
+ /* @__PURE__ */ jsx8(
952
1713
  "div",
953
1714
  {
954
1715
  className: "fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",
955
1716
  onClick: () => setOpen(false)
956
1717
  }
957
1718
  ),
958
- /* @__PURE__ */ jsx5("div", { className: "fixed inset-x-0 top-[10%] z-50 mx-auto w-full max-w-lg", children: /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border bg-background shadow-2xl overflow-hidden", children: [
959
- /* @__PURE__ */ jsxs4("div", { className: "px-6 py-4 border-b", children: [
960
- /* @__PURE__ */ jsx5("h2", { className: "text-lg font-semibold", children: "Keyboard Shortcuts" }),
961
- /* @__PURE__ */ jsxs4("p", { className: "text-sm text-muted-foreground mt-0.5", children: [
1719
+ /* @__PURE__ */ jsx8("div", { className: "fixed inset-x-0 top-[10%] z-50 mx-auto w-full max-w-lg", children: /* @__PURE__ */ jsxs7("div", { className: "rounded-xl border bg-background shadow-2xl overflow-hidden", children: [
1720
+ /* @__PURE__ */ jsxs7("div", { className: "px-6 py-4 border-b", children: [
1721
+ /* @__PURE__ */ jsx8("h2", { className: "text-lg font-semibold", children: "Keyboard Shortcuts" }),
1722
+ /* @__PURE__ */ jsxs7("p", { className: "text-sm text-muted-foreground mt-0.5", children: [
962
1723
  "Press ",
963
- /* @__PURE__ */ jsx5("kbd", { className: "px-1.5 py-0.5 bg-muted rounded text-xs font-mono", children: "?" }),
1724
+ /* @__PURE__ */ jsx8("kbd", { className: "px-1.5 py-0.5 bg-muted rounded text-xs font-mono", children: "?" }),
964
1725
  " to toggle this panel"
965
1726
  ] })
966
1727
  ] }),
967
- /* @__PURE__ */ jsx5("div", { className: "px-6 py-4 max-h-[60vh] overflow-y-auto space-y-6", children: contexts.map((ctx) => /* @__PURE__ */ jsxs4("div", { children: [
968
- /* @__PURE__ */ jsx5("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: ctx.label }),
969
- /* @__PURE__ */ jsx5("div", { className: "space-y-1", children: Object.entries(ctx.shortcuts).map(([key, def]) => /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between py-1", children: [
970
- /* @__PURE__ */ jsx5("span", { className: "text-sm", children: def.description }),
971
- /* @__PURE__ */ jsx5("kbd", { className: "px-2 py-0.5 bg-muted rounded text-xs font-mono min-w-[2rem] text-center", children: def.display })
1728
+ /* @__PURE__ */ jsx8("div", { className: "px-6 py-4 max-h-[60vh] overflow-y-auto space-y-6", children: contexts.map((ctx) => /* @__PURE__ */ jsxs7("div", { children: [
1729
+ /* @__PURE__ */ jsx8("h3", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2", children: ctx.label }),
1730
+ /* @__PURE__ */ jsx8("div", { className: "space-y-1", children: Object.entries(ctx.shortcuts).map(([key, def]) => /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between py-1", children: [
1731
+ /* @__PURE__ */ jsx8("span", { className: "text-sm", children: def.description }),
1732
+ /* @__PURE__ */ jsx8("kbd", { className: "px-2 py-0.5 bg-muted rounded text-xs font-mono min-w-[2rem] text-center", children: def.display })
972
1733
  ] }, key)) })
973
1734
  ] }, ctx.name)) }),
974
- /* @__PURE__ */ jsxs4("div", { className: "px-6 py-3 border-t bg-muted/30 text-xs text-muted-foreground text-center", children: [
1735
+ /* @__PURE__ */ jsxs7("div", { className: "px-6 py-3 border-t bg-muted/30 text-xs text-muted-foreground text-center", children: [
975
1736
  "Press ",
976
- /* @__PURE__ */ jsx5("kbd", { className: "px-1 py-0.5 bg-muted rounded", children: "Esc" }),
1737
+ /* @__PURE__ */ jsx8("kbd", { className: "px-1 py-0.5 bg-muted rounded", children: "Esc" }),
977
1738
  " to close"
978
1739
  ] })
979
1740
  ] }) })
@@ -981,21 +1742,21 @@ function KeyboardShortcutsPanel({
981
1742
  }
982
1743
 
983
1744
  // src/hooks/use-auto-save.ts
984
- import { useEffect as useEffect4, useRef as useRef2, useCallback as useCallback3, useState as useState4 } from "react";
1745
+ import { useEffect as useEffect7, useRef as useRef5, useCallback as useCallback5, useState as useState7 } from "react";
985
1746
  function useAutoSave({
986
1747
  data,
987
1748
  onSave,
988
1749
  delay = 5e3,
989
1750
  enabled = true
990
1751
  }) {
991
- const [lastSavedAt, setLastSavedAt] = useState4(null);
992
- const [isSaving, setIsSaving] = useState4(false);
993
- const [saveError, setSaveError] = useState4(null);
994
- const timerRef = useRef2(null);
995
- const dataRef = useRef2(data);
996
- const savedDataRef = useRef2(null);
1752
+ const [lastSavedAt, setLastSavedAt] = useState7(null);
1753
+ const [isSaving, setIsSaving] = useState7(false);
1754
+ const [saveError, setSaveError] = useState7(null);
1755
+ const timerRef = useRef5(null);
1756
+ const dataRef = useRef5(data);
1757
+ const savedDataRef = useRef5(null);
997
1758
  dataRef.current = data;
998
- const save = useCallback3(async () => {
1759
+ const save = useCallback5(async () => {
999
1760
  const currentJson = JSON.stringify(dataRef.current);
1000
1761
  if (currentJson === savedDataRef.current) return;
1001
1762
  setIsSaving(true);
@@ -1010,7 +1771,7 @@ function useAutoSave({
1010
1771
  setIsSaving(false);
1011
1772
  }
1012
1773
  }, [onSave]);
1013
- useEffect4(() => {
1774
+ useEffect7(() => {
1014
1775
  if (!enabled) return;
1015
1776
  if (timerRef.current) clearTimeout(timerRef.current);
1016
1777
  timerRef.current = setTimeout(save, delay);
@@ -1022,19 +1783,19 @@ function useAutoSave({
1022
1783
  }
1023
1784
 
1024
1785
  // src/hooks/use-polling.ts
1025
- import { useEffect as useEffect5, useCallback as useCallback4, useRef as useRef3, useState as useState5 } from "react";
1786
+ import { useEffect as useEffect8, useCallback as useCallback6, useRef as useRef6, useState as useState8 } from "react";
1026
1787
  function usePolling({
1027
1788
  fetcher,
1028
1789
  interval = 3e4,
1029
1790
  enabled = true,
1030
1791
  onError
1031
1792
  }) {
1032
- const [data, setData] = useState5(null);
1033
- const [isLoading, setIsLoading] = useState5(true);
1034
- const [isRefreshing, setIsRefreshing] = useState5(false);
1035
- const [error, setError] = useState5(null);
1036
- const mountedRef = useRef3(true);
1037
- const doFetch = useCallback4(async (isInitial = false) => {
1793
+ const [data, setData] = useState8(null);
1794
+ const [isLoading, setIsLoading] = useState8(true);
1795
+ const [isRefreshing, setIsRefreshing] = useState8(false);
1796
+ const [error, setError] = useState8(null);
1797
+ const mountedRef = useRef6(true);
1798
+ const doFetch = useCallback6(async (isInitial = false) => {
1038
1799
  if (isInitial) setIsLoading(true);
1039
1800
  else setIsRefreshing(true);
1040
1801
  try {
@@ -1055,36 +1816,36 @@ function usePolling({
1055
1816
  }
1056
1817
  }
1057
1818
  }, [fetcher, onError]);
1058
- useEffect5(() => {
1819
+ useEffect8(() => {
1059
1820
  mountedRef.current = true;
1060
1821
  if (enabled) doFetch(true);
1061
1822
  return () => {
1062
1823
  mountedRef.current = false;
1063
1824
  };
1064
1825
  }, [doFetch, enabled]);
1065
- useEffect5(() => {
1826
+ useEffect8(() => {
1066
1827
  if (!enabled) return;
1067
1828
  const timer = setInterval(() => doFetch(false), interval);
1068
1829
  return () => clearInterval(timer);
1069
1830
  }, [doFetch, interval, enabled]);
1070
- const refresh = useCallback4(() => doFetch(false), [doFetch]);
1831
+ const refresh = useCallback6(() => doFetch(false), [doFetch]);
1071
1832
  return { data, isLoading, isRefreshing, error, refresh };
1072
1833
  }
1073
1834
 
1074
1835
  // src/hooks/use-server-search.ts
1075
- import { useEffect as useEffect6, useRef as useRef4, useState as useState6, useCallback as useCallback5 } from "react";
1836
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState9, useCallback as useCallback7 } from "react";
1076
1837
  function useServerSearch({
1077
1838
  fetcher,
1078
1839
  debounce = 150,
1079
1840
  minChars = 1,
1080
1841
  enabled = true
1081
1842
  }) {
1082
- const [query, setQuery] = useState6("");
1083
- const [results, setResults] = useState6([]);
1084
- const [isSearching, setIsSearching] = useState6(false);
1085
- const [isOpen, setIsOpen] = useState6(false);
1086
- const timerRef = useRef4(null);
1087
- useEffect6(() => {
1843
+ const [query, setQuery] = useState9("");
1844
+ const [results, setResults] = useState9([]);
1845
+ const [isSearching, setIsSearching] = useState9(false);
1846
+ const [isOpen, setIsOpen] = useState9(false);
1847
+ const timerRef = useRef7(null);
1848
+ useEffect9(() => {
1088
1849
  if (!enabled || query.length < minChars) {
1089
1850
  setResults([]);
1090
1851
  return;
@@ -1105,7 +1866,7 @@ function useServerSearch({
1105
1866
  if (timerRef.current) clearTimeout(timerRef.current);
1106
1867
  };
1107
1868
  }, [query, fetcher, debounce, minChars, enabled]);
1108
- const clear = useCallback5(() => {
1869
+ const clear = useCallback7(() => {
1109
1870
  setQuery("");
1110
1871
  setResults([]);
1111
1872
  setIsOpen(false);
@@ -1114,9 +1875,9 @@ function useServerSearch({
1114
1875
  }
1115
1876
 
1116
1877
  // src/hooks/use-iframe-focus-reclaim.ts
1117
- import { useEffect as useEffect7 } from "react";
1878
+ import { useEffect as useEffect10 } from "react";
1118
1879
  function useIframeFocusReclaim(containerRef, enabled = true, iframeSelector = "iframe") {
1119
- useEffect7(() => {
1880
+ useEffect10(() => {
1120
1881
  if (!enabled) return;
1121
1882
  const el = containerRef.current;
1122
1883
  if (!el) return;
@@ -1297,21 +2058,21 @@ function clearCache() {
1297
2058
  }
1298
2059
 
1299
2060
  // src/hooks/use-preferences.ts
1300
- import { useState as useState7, useEffect as useEffect8, useCallback as useCallback6 } from "react";
2061
+ import { useState as useState10, useEffect as useEffect11, useCallback as useCallback8 } from "react";
1301
2062
  function usePreferences({
1302
2063
  endpoint,
1303
- defaults
2064
+ defaults: defaults2
1304
2065
  }) {
1305
- const [preferences, setPreferences] = useState7(defaults ?? null);
1306
- const [loading, setLoading] = useState7(true);
1307
- const [error, setError] = useState7(null);
1308
- const fetchPreferences = useCallback6(async () => {
2066
+ const [preferences, setPreferences] = useState10(defaults2 ?? null);
2067
+ const [loading, setLoading] = useState10(true);
2068
+ const [error, setError] = useState10(null);
2069
+ const fetchPreferences = useCallback8(async () => {
1309
2070
  try {
1310
2071
  setError(null);
1311
2072
  const res = await fetch(endpoint);
1312
2073
  if (!res.ok) {
1313
2074
  if (res.status === 401) {
1314
- setPreferences(defaults ?? null);
2075
+ setPreferences(defaults2 ?? null);
1315
2076
  return;
1316
2077
  }
1317
2078
  throw new Error("Failed to fetch preferences");
@@ -1323,11 +2084,11 @@ function usePreferences({
1323
2084
  } finally {
1324
2085
  setLoading(false);
1325
2086
  }
1326
- }, [endpoint, defaults]);
1327
- useEffect8(() => {
2087
+ }, [endpoint, defaults2]);
2088
+ useEffect11(() => {
1328
2089
  fetchPreferences();
1329
2090
  }, [fetchPreferences]);
1330
- const updatePreferences = useCallback6(
2091
+ const updatePreferences = useCallback8(
1331
2092
  async (updates) => {
1332
2093
  setPreferences((prev) => prev ? { ...prev, ...updates } : updates);
1333
2094
  setError(null);
@@ -1685,6 +2446,7 @@ export {
1685
2446
  CLIENT_PROFILE_SHORTCUTS,
1686
2447
  EmailBodyRenderer,
1687
2448
  EmailThreadView,
2449
+ EntityPicker,
1688
2450
  ErrorBoundary,
1689
2451
  FORM_SHORTCUTS,
1690
2452
  GLOBAL_SHORTCUTS,
@@ -1692,6 +2454,8 @@ export {
1692
2454
  KeyboardShortcutsPanel,
1693
2455
  RENDER_ERRORS,
1694
2456
  REPLY_LAYOUT_OPTIONS,
2457
+ ReplyPanel,
2458
+ RichTextEditor,
1695
2459
  cachedFetch,
1696
2460
  canViewInline,
1697
2461
  clearCache,
@@ -1708,6 +2472,7 @@ export {
1708
2472
  invalidateCache,
1709
2473
  isAudio,
1710
2474
  isDocument,
2475
+ isEmptyHtml,
1711
2476
  isImage,
1712
2477
  isInlineLayout,
1713
2478
  isModalLayout,