pih-appointment-widget 0.0.37 → 0.0.38

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.
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IMG = exports.ICON = void 0;
7
+ var _icdIcon = _interopRequireDefault(require("./icdIcon.png"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ // ─── Image assets ─────────────────────────────────────────────────────────────
10
+
11
+ const IMG = exports.IMG = {
12
+ /** Main ICD-10 Assistant branding icon (floating button + panel header) */
13
+ icdIcon: _icdIcon.default
14
+ };
15
+
16
+ // ─── Emoji / text icons ───────────────────────────────────────────────────────
17
+ const ICON = exports.ICON = {
18
+ /** Reason / tip indicator on result cards */
19
+ reason: "💡",
20
+ /** Search history chip prefix */
21
+ history: "🕐",
22
+ /** Footer medical disclaimer */
23
+ medical: "⚕️",
24
+ /** Coding note (currently commented out) */
25
+ codingNote: "📋",
26
+ /** Copy success checkmark */
27
+ copied: "✓",
28
+ /** Copy action */
29
+ copy: "⎘"
30
+ };
@@ -7,6 +7,7 @@ exports.default = ICD10Assistant;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _icdService = require("../services/icdService");
9
9
  var _useClipboard = require("../hooks/useClipboard");
10
+ var _icdIcons = require("../assets/icons/icdIcons");
10
11
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
12
  /**
12
13
  * ICD10Assistant.jsx
@@ -162,7 +163,7 @@ function ResultCard(_ref3) {
162
163
  lineHeight: 1.5,
163
164
  paddingLeft: 2
164
165
  }
165
- }, "\uD83D\uDCA1 ", match.reason));
166
+ }, _icdIcons.ICON.reason, " ", match.reason));
166
167
  }
167
168
 
168
169
  // ─── History Chip ─────────────────────────────────────────────────────────────
@@ -191,7 +192,7 @@ function HistoryChip(_ref4) {
191
192
  },
192
193
  onMouseEnter: e => e.currentTarget.style.borderColor = C.primary,
193
194
  onMouseLeave: e => e.currentTarget.style.borderColor = C.border
194
- }, "\uD83D\uDD50 ", item.query);
195
+ }, _icdIcons.ICON.history, " ", item.query);
195
196
  }
196
197
 
197
198
  // ─── Mode Toggle (tab bar) ──────────────────────────────────────────────────
@@ -230,7 +231,7 @@ function ModeToggle(_ref5) {
230
231
  gap: 2,
231
232
  marginTop: 10
232
233
  }
233
- }, tab("nlm", "Quick Lookup", "🔎"), tab("ai", "AI Suggest", "🤖"));
234
+ }, tab("nlm", "Quick Lookup", ""), tab("ai", "AI Suggest", ""));
234
235
  }
235
236
 
236
237
  // ─── NLM Lookup Panel ────────────────────────────────────────────────────────
@@ -319,11 +320,15 @@ function NLMLookupPanel(_ref6) {
319
320
  alignItems: "center",
320
321
  gap: 10
321
322
  }
322
- }, /*#__PURE__*/_react.default.createElement("span", {
323
+ }, /*#__PURE__*/_react.default.createElement("img", {
324
+ src: _icdIcons.IMG.icdIcon,
325
+ alt: "ICD-10",
323
326
  style: {
324
- fontSize: 22
327
+ width: 32,
328
+ height: 32,
329
+ objectFit: "contain"
325
330
  }
326
- }, "\uD83E\uDE7A"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
331
+ }), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
327
332
  style: {
328
333
  color: C.white,
329
334
  fontWeight: 700,
@@ -382,13 +387,77 @@ function NLMLookupPanel(_ref6) {
382
387
  },
383
388
  onFocus: e => e.target.style.borderColor = C.primary,
384
389
  onBlur: e => e.target.style.borderColor = C.border
385
- }), status && /*#__PURE__*/_react.default.createElement("p", {
390
+ }), /*#__PURE__*/_react.default.createElement("p", {
391
+ style: {
392
+ margin: 0,
393
+ fontSize: 11,
394
+ color: "#aaa",
395
+ lineHeight: 1.6,
396
+ borderLeft: "3px solid ".concat(C.border),
397
+ paddingLeft: 8
398
+ }
399
+ }, /*#__PURE__*/_react.default.createElement("strong", null, "Note:"), " Use short, specific keywords for better results, or try", " ", /*#__PURE__*/_react.default.createElement("button", {
400
+ onClick: () => onModeChange("ai"),
401
+ style: {
402
+ background: "none",
403
+ border: "none",
404
+ padding: 0,
405
+ color: C.primary,
406
+ fontWeight: 700,
407
+ fontSize: 11,
408
+ cursor: "pointer",
409
+ textDecoration: "underline",
410
+ fontFamily: FONT
411
+ }
412
+ }, "AI Suggest"), " ", "for broader symptom-based recommendations."), status && results.length > 0 && /*#__PURE__*/_react.default.createElement("p", {
386
413
  style: {
387
414
  margin: 0,
388
415
  fontSize: 12,
389
416
  color: C.muted
390
417
  }
391
- }, status), /*#__PURE__*/_react.default.createElement("div", {
418
+ }, status), status === "No matching codes found." && results.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
419
+ style: {
420
+ background: C.warnLight,
421
+ border: "1px solid #fcd34d",
422
+ borderRadius: 10,
423
+ padding: "14px 16px",
424
+ display: "flex",
425
+ gap: 10,
426
+ alignItems: "flex-start"
427
+ }
428
+ }, /*#__PURE__*/_react.default.createElement("span", {
429
+ style: {
430
+ fontSize: 18,
431
+ flexShrink: 0
432
+ }
433
+ }, "\uD83D\uDD0D"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", {
434
+ style: {
435
+ margin: "0 0 4px",
436
+ fontSize: 13,
437
+ fontWeight: 700,
438
+ color: C.warn
439
+ }
440
+ }, "No results found"), /*#__PURE__*/_react.default.createElement("p", {
441
+ style: {
442
+ margin: 0,
443
+ fontSize: 12,
444
+ color: C.warn,
445
+ lineHeight: 1.6
446
+ }
447
+ }, "We couldn't find a match. Try using more accurate keywords or switch to", " ", /*#__PURE__*/_react.default.createElement("button", {
448
+ onClick: () => onModeChange("ai"),
449
+ style: {
450
+ background: "none",
451
+ border: "none",
452
+ padding: 0,
453
+ color: C.primary,
454
+ fontWeight: 700,
455
+ fontSize: 12,
456
+ cursor: "pointer",
457
+ textDecoration: "underline",
458
+ fontFamily: FONT
459
+ }
460
+ }, "AI Suggest"), " ", "for better results."))), /*#__PURE__*/_react.default.createElement("div", {
392
461
  style: {
393
462
  display: "flex",
394
463
  flexDirection: "column",
@@ -446,7 +515,7 @@ function NLMLookupPanel(_ref6) {
446
515
  color: "#aaa",
447
516
  textAlign: "center"
448
517
  }
449
- }, "\u2695\uFE0F For reference only. Always verify codes with a certified medical coder."));
518
+ }, _icdIcons.ICON.medical, " For reference only. Always verify codes with a certified medical coder."));
450
519
  }
451
520
 
452
521
  // ─── FloatingButton ───────────────────────────────────────────────────────────
@@ -486,11 +555,15 @@ function FloatingButton(_ref8) {
486
555
  e.currentTarget.style.transform = "translateY(0)";
487
556
  e.currentTarget.style.boxShadow = "0 4px 16px rgba(76,77,220,0.35)";
488
557
  }
489
- }, /*#__PURE__*/_react.default.createElement("span", {
558
+ }, /*#__PURE__*/_react.default.createElement("img", {
559
+ src: _icdIcons.IMG.icdIcon,
560
+ alt: "ICD-10",
490
561
  style: {
491
- fontSize: 18
562
+ width: 22,
563
+ height: 22,
564
+ objectFit: "contain"
492
565
  }
493
- }, "\uD83E\uDE7A"), "ICD-10 Assistant");
566
+ }), "ICD-10 Assistant");
494
567
  }
495
568
 
496
569
  // ─── Panel ────────────────────────────────────────────────────────────────────
@@ -553,11 +626,15 @@ function Panel(_ref9) {
553
626
  alignItems: "center",
554
627
  gap: 10
555
628
  }
556
- }, /*#__PURE__*/_react.default.createElement("span", {
629
+ }, /*#__PURE__*/_react.default.createElement("img", {
630
+ src: _icdIcons.IMG.icdIcon,
631
+ alt: "ICD-10",
557
632
  style: {
558
- fontSize: 22
633
+ width: 32,
634
+ height: 32,
635
+ objectFit: "contain"
559
636
  }
560
- }, "\uD83E\uDE7A"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
637
+ }), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
561
638
  style: {
562
639
  color: C.white,
563
640
  fontWeight: 700,
@@ -655,7 +732,14 @@ function Panel(_ref9) {
655
732
  borderRadius: 3,
656
733
  fontFamily: "monospace"
657
734
  }
658
- }, "\u2318 Enter"), " to submit")), /*#__PURE__*/_react.default.createElement("div", {
735
+ }, "Enter"), " to submit \xB7 ", /*#__PURE__*/_react.default.createElement("kbd", {
736
+ style: {
737
+ background: "#f3f4f6",
738
+ padding: "1px 5px",
739
+ borderRadius: 3,
740
+ fontFamily: "monospace"
741
+ }
742
+ }, "Shift+Enter"), " for new line")), /*#__PURE__*/_react.default.createElement("div", {
659
743
  style: {
660
744
  display: "flex",
661
745
  gap: 8
@@ -680,7 +764,7 @@ function Panel(_ref9) {
680
764
  cursor: !query.trim() || loading ? "not-allowed" : "pointer",
681
765
  transition: "background 0.15s"
682
766
  }
683
- }, loading ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Spinner, null), "Searching codes\u2026") : "🔍 Find ICD-10 Codes"), (query || result) && /*#__PURE__*/_react.default.createElement("button", {
767
+ }, loading ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Spinner, null), "Searching codes\u2026") : "Find ICD-10 Codes"), (query || result) && /*#__PURE__*/_react.default.createElement("button", {
684
768
  onClick: onClear,
685
769
  style: {
686
770
  padding: "10px 14px",
@@ -787,7 +871,7 @@ function Panel(_ref9) {
787
871
  lineHeight: 1.5,
788
872
  textAlign: "center"
789
873
  }
790
- }, "\u2695\uFE0F For reference only. Always verify codes with a certified medical coder. Not a substitute for clinical judgment or official coding guidelines."));
874
+ }, _icdIcons.ICON.medical, " For reference only. Always verify codes with a certified medical coder. Not a substitute for clinical judgment or official coding guidelines."));
791
875
  }
792
876
 
793
877
  // ─── Main Component ────────────────────────────────────────────────────────────
@@ -849,7 +933,7 @@ function ICD10Assistant() {
849
933
  }
850
934
  }, [query, loading]);
851
935
  const handleKeyDown = (0, _react.useCallback)(e => {
852
- if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
936
+ if (e.key === "Enter" && !e.shiftKey) {
853
937
  e.preventDefault();
854
938
  handleSubmit();
855
939
  }
@@ -2636,6 +2636,30 @@
2636
2636
  };
2637
2637
  }
2638
2638
 
2639
+ var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADsQAAA7EB9YPtSQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAB67SURBVHic7X15nBXVmfbznqp7b680jbIJIsY9LuPCB4rL4BLXRGMUjMQ1Jpo4mm8SxlE0iR1j9HOJQTT5DN/kc7KZKJM4aDSMohglLhFRRhFQVEQFItI0fbe+t6rOM39U1b11t6a770onD7+ibtf6nvM+533fs5aggcC3T/w0tPpXACfA0WPgMAqtV8Lmr9Erv5Tjn7HrItfyE/aCYV8FwzgNhkyGUn1QshrAQmy05tdLrkpA6i2ADy4/IoT2Ue8DGA8ScAho7e4dDTj6DdjO2TL9hXU1leulo6+BUjfDVGEoAQwFKAUYXtYJr5F9l9xZS5kqCVVvATJob+8AMB4AQO8/AmBmfxCIP3PZEZNqJRKfO/JGOLwdZDgrR0A2AKDsXyt5qoGGIYDs98wnAF4GEFR6dq8BkGNgq5/XQh4umXoUNG/MVXxAJv8A8V+1kKdaaBgCAABE/q1oRpNZEmjM4JNTZlRfGP0dkJIlorflyIYtcEYuqr4s1UNDEIDsUlx7wmlI22eAZG6JA3KVAEDrK6oqzx8Pn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qnx6va3xmXdmfaUma+/tTGgIF+DjqWNPXQxHTSf5Tr9mv7/6feEw7WVKnOl/V35xNBQBAGDpCaeuSqfMqdD8CUlryP5e67imnjt+9IfH/93sl0ZDuYB8THviP/YRqptAfkFThwfk78FtJO+nhR+uPf+yjfVOQ6OjoQngY+qS3+8Cy/qsQ308tRxErSdr6g6SNsEerfU6ar1CQ5bYLdEn1p0+vD/yUEn8D1aIYwK+QEZVAAAAAElFTkSuQmCC";
2640
+
2641
+ // ─── Image assets ─────────────────────────────────────────────────────────────
2642
+ const IMG = {
2643
+ /** Main ICD-10 Assistant branding icon (floating button + panel header) */
2644
+ icdIcon: img
2645
+ };
2646
+
2647
+ // ─── Emoji / text icons ───────────────────────────────────────────────────────
2648
+ const ICON = {
2649
+ /** Reason / tip indicator on result cards */
2650
+ reason: "💡",
2651
+ /** Search history chip prefix */
2652
+ history: "🕐",
2653
+ /** Footer medical disclaimer */
2654
+ medical: "⚕️",
2655
+ /** Coding note (currently commented out) */
2656
+ codingNote: "📋",
2657
+ /** Copy success checkmark */
2658
+ copied: "✓",
2659
+ /** Copy action */
2660
+ copy: "⎘"
2661
+ };
2662
+
2639
2663
  /**
2640
2664
  * ICD10Assistant.jsx
2641
2665
  * AI-powered ICD-10 coding assistant panel.
@@ -2790,7 +2814,7 @@
2790
2814
  lineHeight: 1.5,
2791
2815
  paddingLeft: 2
2792
2816
  }
2793
- }, "\uD83D\uDCA1 ", match.reason));
2817
+ }, ICON.reason, " ", match.reason));
2794
2818
  }
2795
2819
 
2796
2820
  // ─── History Chip ─────────────────────────────────────────────────────────────
@@ -2819,7 +2843,7 @@
2819
2843
  },
2820
2844
  onMouseEnter: e => e.currentTarget.style.borderColor = C.primary,
2821
2845
  onMouseLeave: e => e.currentTarget.style.borderColor = C.border
2822
- }, "\uD83D\uDD50 ", item.query);
2846
+ }, ICON.history, " ", item.query);
2823
2847
  }
2824
2848
 
2825
2849
  // ─── Mode Toggle (tab bar) ──────────────────────────────────────────────────
@@ -2858,7 +2882,7 @@
2858
2882
  gap: 2,
2859
2883
  marginTop: 10
2860
2884
  }
2861
- }, tab("nlm", "Quick Lookup", "🔎"), tab("ai", "AI Suggest", "🤖"));
2885
+ }, tab("nlm", "Quick Lookup", ""), tab("ai", "AI Suggest", ""));
2862
2886
  }
2863
2887
 
2864
2888
  // ─── NLM Lookup Panel ────────────────────────────────────────────────────────
@@ -2947,11 +2971,15 @@
2947
2971
  alignItems: "center",
2948
2972
  gap: 10
2949
2973
  }
2950
- }, /*#__PURE__*/React__default["default"].createElement("span", {
2974
+ }, /*#__PURE__*/React__default["default"].createElement("img", {
2975
+ src: IMG.icdIcon,
2976
+ alt: "ICD-10",
2951
2977
  style: {
2952
- fontSize: 22
2978
+ width: 32,
2979
+ height: 32,
2980
+ objectFit: "contain"
2953
2981
  }
2954
- }, "\uD83E\uDE7A"), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
2982
+ }), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
2955
2983
  style: {
2956
2984
  color: C.white,
2957
2985
  fontWeight: 700,
@@ -3010,13 +3038,77 @@
3010
3038
  },
3011
3039
  onFocus: e => e.target.style.borderColor = C.primary,
3012
3040
  onBlur: e => e.target.style.borderColor = C.border
3013
- }), status && /*#__PURE__*/React__default["default"].createElement("p", {
3041
+ }), /*#__PURE__*/React__default["default"].createElement("p", {
3042
+ style: {
3043
+ margin: 0,
3044
+ fontSize: 11,
3045
+ color: "#aaa",
3046
+ lineHeight: 1.6,
3047
+ borderLeft: "3px solid ".concat(C.border),
3048
+ paddingLeft: 8
3049
+ }
3050
+ }, /*#__PURE__*/React__default["default"].createElement("strong", null, "Note:"), " Use short, specific keywords for better results, or try", " ", /*#__PURE__*/React__default["default"].createElement("button", {
3051
+ onClick: () => onModeChange("ai"),
3052
+ style: {
3053
+ background: "none",
3054
+ border: "none",
3055
+ padding: 0,
3056
+ color: C.primary,
3057
+ fontWeight: 700,
3058
+ fontSize: 11,
3059
+ cursor: "pointer",
3060
+ textDecoration: "underline",
3061
+ fontFamily: FONT
3062
+ }
3063
+ }, "AI Suggest"), " ", "for broader symptom-based recommendations."), status && results.length > 0 && /*#__PURE__*/React__default["default"].createElement("p", {
3014
3064
  style: {
3015
3065
  margin: 0,
3016
3066
  fontSize: 12,
3017
3067
  color: C.muted
3018
3068
  }
3019
- }, status), /*#__PURE__*/React__default["default"].createElement("div", {
3069
+ }, status), status === "No matching codes found." && results.length === 0 && /*#__PURE__*/React__default["default"].createElement("div", {
3070
+ style: {
3071
+ background: C.warnLight,
3072
+ border: "1px solid #fcd34d",
3073
+ borderRadius: 10,
3074
+ padding: "14px 16px",
3075
+ display: "flex",
3076
+ gap: 10,
3077
+ alignItems: "flex-start"
3078
+ }
3079
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
3080
+ style: {
3081
+ fontSize: 18,
3082
+ flexShrink: 0
3083
+ }
3084
+ }, "\uD83D\uDD0D"), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("p", {
3085
+ style: {
3086
+ margin: "0 0 4px",
3087
+ fontSize: 13,
3088
+ fontWeight: 700,
3089
+ color: C.warn
3090
+ }
3091
+ }, "No results found"), /*#__PURE__*/React__default["default"].createElement("p", {
3092
+ style: {
3093
+ margin: 0,
3094
+ fontSize: 12,
3095
+ color: C.warn,
3096
+ lineHeight: 1.6
3097
+ }
3098
+ }, "We couldn't find a match. Try using more accurate keywords or switch to", " ", /*#__PURE__*/React__default["default"].createElement("button", {
3099
+ onClick: () => onModeChange("ai"),
3100
+ style: {
3101
+ background: "none",
3102
+ border: "none",
3103
+ padding: 0,
3104
+ color: C.primary,
3105
+ fontWeight: 700,
3106
+ fontSize: 12,
3107
+ cursor: "pointer",
3108
+ textDecoration: "underline",
3109
+ fontFamily: FONT
3110
+ }
3111
+ }, "AI Suggest"), " ", "for better results."))), /*#__PURE__*/React__default["default"].createElement("div", {
3020
3112
  style: {
3021
3113
  display: "flex",
3022
3114
  flexDirection: "column",
@@ -3074,7 +3166,7 @@
3074
3166
  color: "#aaa",
3075
3167
  textAlign: "center"
3076
3168
  }
3077
- }, "\u2695\uFE0F For reference only. Always verify codes with a certified medical coder."));
3169
+ }, ICON.medical, " For reference only. Always verify codes with a certified medical coder."));
3078
3170
  }
3079
3171
 
3080
3172
  // ─── FloatingButton ───────────────────────────────────────────────────────────
@@ -3114,11 +3206,15 @@
3114
3206
  e.currentTarget.style.transform = "translateY(0)";
3115
3207
  e.currentTarget.style.boxShadow = "0 4px 16px rgba(76,77,220,0.35)";
3116
3208
  }
3117
- }, /*#__PURE__*/React__default["default"].createElement("span", {
3209
+ }, /*#__PURE__*/React__default["default"].createElement("img", {
3210
+ src: IMG.icdIcon,
3211
+ alt: "ICD-10",
3118
3212
  style: {
3119
- fontSize: 18
3213
+ width: 22,
3214
+ height: 22,
3215
+ objectFit: "contain"
3120
3216
  }
3121
- }, "\uD83E\uDE7A"), "ICD-10 Assistant");
3217
+ }), "ICD-10 Assistant");
3122
3218
  }
3123
3219
 
3124
3220
  // ─── Panel ────────────────────────────────────────────────────────────────────
@@ -3181,11 +3277,15 @@
3181
3277
  alignItems: "center",
3182
3278
  gap: 10
3183
3279
  }
3184
- }, /*#__PURE__*/React__default["default"].createElement("span", {
3280
+ }, /*#__PURE__*/React__default["default"].createElement("img", {
3281
+ src: IMG.icdIcon,
3282
+ alt: "ICD-10",
3185
3283
  style: {
3186
- fontSize: 22
3284
+ width: 32,
3285
+ height: 32,
3286
+ objectFit: "contain"
3187
3287
  }
3188
- }, "\uD83E\uDE7A"), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
3288
+ }), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
3189
3289
  style: {
3190
3290
  color: C.white,
3191
3291
  fontWeight: 700,
@@ -3283,7 +3383,14 @@
3283
3383
  borderRadius: 3,
3284
3384
  fontFamily: "monospace"
3285
3385
  }
3286
- }, "\u2318 Enter"), " to submit")), /*#__PURE__*/React__default["default"].createElement("div", {
3386
+ }, "Enter"), " to submit \xB7 ", /*#__PURE__*/React__default["default"].createElement("kbd", {
3387
+ style: {
3388
+ background: "#f3f4f6",
3389
+ padding: "1px 5px",
3390
+ borderRadius: 3,
3391
+ fontFamily: "monospace"
3392
+ }
3393
+ }, "Shift+Enter"), " for new line")), /*#__PURE__*/React__default["default"].createElement("div", {
3287
3394
  style: {
3288
3395
  display: "flex",
3289
3396
  gap: 8
@@ -3308,7 +3415,7 @@
3308
3415
  cursor: !query.trim() || loading ? "not-allowed" : "pointer",
3309
3416
  transition: "background 0.15s"
3310
3417
  }
3311
- }, loading ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Spinner, null), "Searching codes\u2026") : "🔍 Find ICD-10 Codes"), (query || result) && /*#__PURE__*/React__default["default"].createElement("button", {
3418
+ }, loading ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Spinner, null), "Searching codes\u2026") : "Find ICD-10 Codes"), (query || result) && /*#__PURE__*/React__default["default"].createElement("button", {
3312
3419
  onClick: onClear,
3313
3420
  style: {
3314
3421
  padding: "10px 14px",
@@ -3415,7 +3522,7 @@
3415
3522
  lineHeight: 1.5,
3416
3523
  textAlign: "center"
3417
3524
  }
3418
- }, "\u2695\uFE0F For reference only. Always verify codes with a certified medical coder. Not a substitute for clinical judgment or official coding guidelines."));
3525
+ }, ICON.medical, " For reference only. Always verify codes with a certified medical coder. Not a substitute for clinical judgment or official coding guidelines."));
3419
3526
  }
3420
3527
 
3421
3528
  // ─── Main Component ────────────────────────────────────────────────────────────
@@ -3477,7 +3584,7 @@
3477
3584
  }
3478
3585
  }, [query, loading]);
3479
3586
  const handleKeyDown = React.useCallback(e => {
3480
- if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
3587
+ if (e.key === "Enter" && !e.shiftKey) {
3481
3588
  e.preventDefault();
3482
3589
  handleSubmit();
3483
3590
  }
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MyPackage={},e.React,e.ReactDOM)}(this,function(e,t,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t),r=o(n);function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i="https://afiyaapiqa.powermindinc.com",d="/appointment/V1/consultant/all-appointments",s="/notification/V1/consultation/online/initiate",c="https://ittisalqa.powermindinc.com/call?token=",p=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=(e||"").toUpperCase();"INPROGRESS"===a&&(a="IN_PROGRESS"),"UPCOMING"===a&&(a="UPCOMING,RESCHEDULED");const r=o.apiBaseUrl,l=o.hospitalId,i=o.doctorId,s=o.token||"",c={hospitalId:l,doctorId:i,fromDate:t,toDate:n,statuses:a,appointmentType:"ONLINE"},p="".concat(r).concat(d),u=await async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=new URL(e);o.search=new URLSearchParams(t).toString();const a={method:"GET",headers:{"Content-Type":"application/json",Authorization:"".concat(n)}};return fetch(o,a).then(async e=>{const t=await e.json().catch(()=>({}));var n;return e.ok?t:{err:(null==t||null===(n=t.resultInfo)||void 0===n?void 0:n.message)||"Something went wrong!",status:e.status}}).catch(e=>(console.error("Fetch error:",e),{err:(null==e?void 0:e.message)||String(e)||"Network error"}))}(p,c,"PIH-Appointment-Widget",s);return u},u=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};console.log("initiateConsultation -> config",t);const n=t.apiBaseUrl.replace(/\/$/,""),o="".concat(n).concat(s),a=t.appToken||"";return async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;const a=new URL(e);Object.keys(n).forEach(e=>{a.searchParams.append(e,n[e])});const r={"Content-Type":"application/json"};o&&(r.Authorization=o);const l={method:"POST",headers:r,body:JSON.stringify(t)};return fetch(a.toString(),l).then(async e=>{const t=await e.json().catch(()=>({}));var n;return e.ok?t:{err:(null==t||null===(n=t.resultInfo)||void 0===n?void 0:n.message)||"Something went wrong!",status:e.status}}).catch(e=>(console.error("Fetch error:",e),{err:e.message||"Network error"}))}(o,{patientId:String(e.patientId||""),primaryPatientId:String(e.primaryPatientId||e.patientId||""),hospitalId:t.hospitalId,doctorId:String(t.doctorId),patientName:e.patientName||e.name||"",doctorName:e.doctorName||t.doctorName,appointmentId:String(e.id||e.appointmentId||e._id||"")},"PIH-Appointment-Widget",{},a)};const f="pih_appointment_idToken",m="pih_appointment_email",g="pih_appointment_appToken",x="pih_appointment_doctorId",h="pih_appointment_userName",y="pih_appointment_apiBaseUrl",b="pih_appointment_hospitalId",E=720,v="pih-appointment-widget",w="data-pih-widget";class S extends t.Component{constructor(){super(...arguments),l(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){"undefined"!=typeof console&&console.error&&console.error("Appointment widget error:",e,t)}render(){return this.state.hasError?a.default.createElement("div",{className:v,[w]:"teleconsult-appointments",style:{fontFamily:'"Nunito", serif',background:"#F5F5F7",boxSizing:"border-box",minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",textAlign:"center"}},a.default.createElement("div",{style:{maxWidth:"400px"}},a.default.createElement("div",{style:{fontSize:"48px",marginBottom:"16px"}},"⚠️"),a.default.createElement("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1a1a1a",margin:"0 0 8px 0"}},"Something went wrong"),a.default.createElement("p",{style:{fontSize:"14px",color:"#666",margin:0,lineHeight:1.5}},"Please refresh the page or try again later."))):this.props.children}}const F=e=>{let{config:n={}}=e;const[o,r]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(y):null}catch(e){return null}}),[l,d]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(b):null}catch(e){return null}}),s=n.apiBaseUrl||o||i,F=n.hospitalId||l,[C,k]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(f):null}catch(e){return null}}),[I,D]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(m):null}catch(e){return null}}),z=n.idToken||n.token||C,T=n.email||I;t.useEffect(()=>{try{if("undefined"==typeof localStorage)return;const e=n.idToken||n.token;if(e&&String(e).trim()){localStorage.getItem(f)!==e&&(A(null),R(null),P(null),_(e=>e+1),localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h)),localStorage.setItem(f,e),k(e)}n.email&&String(n.email).trim()&&(localStorage.setItem(m,n.email),D(n.email)),n.apiBaseUrl&&String(n.apiBaseUrl).trim()&&(localStorage.setItem(y,n.apiBaseUrl.trim()),r(n.apiBaseUrl.trim())),null!=n.hospitalId&&String(n.hospitalId).trim()&&(localStorage.setItem(b,String(n.hospitalId).trim()),d(String(n.hospitalId).trim()))}catch(e){}},[n.idToken,n.token,n.email,n.apiBaseUrl,n.hospitalId]);const[W,A]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(g):null}catch(e){return null}}),[M,R]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(x):null}catch(e){return null}}),[N,P]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(h):null}catch(e){return null}}),[j,L]=t.useState(()=>{try{if("undefined"==typeof localStorage)return!1;const e=localStorage.getItem(g),t=localStorage.getItem(f),n=localStorage.getItem(m);return!e&&!(!t||!n)}catch(e){return!1}}),[H,B]=t.useState(null),[U,Y]=t.useState(!1),[O,_]=t.useState(0);t.useEffect(()=>{W&&j&&L(!1)},[W,j]),t.useEffect(()=>{W||(z&&T?(Y(!1),B(e=>"Sign in required. Redirecting to home..."===e?null:e)):(B("Sign in required. Redirecting to home..."),Y(!0)))},[W,z,T]),t.useEffect(()=>{if(!U)return;const e=n.homeUrl||"https://afiyaproqa.powermindinc.com/";if(!e||"undefined"==typeof window)return;const t=setTimeout(()=>{window.location.href=e},2500);return()=>clearTimeout(t)},[U,n.homeUrl]),t.useEffect(()=>{if(!j)return;const e=setTimeout(()=>{B("Request timed out. Please try again."),L(!1)},3e4);return()=>clearTimeout(e)},[j]);const q=n.joinCallUrl||c;W&&String(q||"").replace(/\/?$/,"/");const K=function(e){if(!e||"string"!=typeof e)return{};try{const t=e.split(".");if(3!==t.length)return{};const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),o=n.padEnd(n.length+(4-n.length%4)%4,"=");return JSON.parse(atob(o))}catch(e){return{}}}(z),V=N||K.name||K.sub||"User",X=()=>(new Date).toISOString().split("T")[0],G=e=>{const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(o)},[J,$]=t.useState("upcoming"),[Q,Z]=t.useState([]),[ee,te]=t.useState(null),[ne,oe]=t.useState(!1),[ae,re]=t.useState(null),[le,ie]=t.useState(window.innerWidth<768),[de,se]=t.useState("today"),[ce,pe]=t.useState("today"),[ue,fe]=t.useState(!1),[me,ge]=t.useState(!1),[xe,he]=t.useState("all"),[ye,be]=t.useState("asc"),[Ee,ve]=t.useState(""),[we,Se]=t.useState(!1),[Fe,Ce]=t.useState(!1),[ke,Ie]=t.useState(!1),[De,ze]=t.useState(null),[Te,We]=t.useState(null),[Ae,Me]=t.useState(!1),[Re,Ne]=t.useState(null),[Pe,je]=t.useState(()=>({x:Math.max(20,"undefined"!=typeof window?window.innerWidth-E-20:300),y:80})),[Le,He]=t.useState({width:E,height:560}),[Be,Ue]=t.useState(!1),[Ye,Oe]=t.useState({x:0,y:0}),[_e,qe]=t.useState(!1),[Ke,Ve]=t.useState(null),[Xe,Ge]=t.useState({x:0,y:0,width:0,height:0});t.useState(!1);const[Je,$e]=t.useState(1),Qe=Q.filter(e=>{if(!Ee.trim())return!0;const t=Ee.toLowerCase(),n=(e.patientName||"").toLowerCase(),o=String(e.patientId||"").toLowerCase();return n.includes(t)||o.includes(t)}),Ze=5*(Je-1),et=Ze+5,tt=Qe.slice(Ze,et),nt=Math.ceil(Qe.length/5),ot=Qe.length,[at,rt]=t.useState(X()),[lt,it]=t.useState(X()),[dt,st]=t.useState(),[ct,pt]=t.useState(),ut=e=>(null==e?void 0:e.id)||(null==e?void 0:e._id)||(null==e?void 0:e.appointmentId)||(null==e?void 0:e.patientId)||JSON.stringify(e),ft=e=>null!=e&&e.image?e.image:null,mt=e=>e?e.charAt(0).toUpperCase():"?",gt=e=>{if(!e)return"#4C4DDC";const t=["#4C4DDC","#1CC3CE","#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F"];return t[e.charCodeAt(0)%t.length]},xt=()=>{const e="asc"===ye?"desc":"asc";be(e);const t=[...Q].sort((t,n)=>{const o=new Date(t.appointmentDate||t.date||0),a=new Date(n.appointmentDate||n.date||0);return"asc"===e?o-a:a-o});Z(t),$e(1),t.length>0&&te(t[0])},ht=t.useCallback(async()=>{if(console.log(W,"fetchAppointments -> appToken"),!W)return void(z&&T&&_(e=>e+1));console.log(M,"fetchAppointments -> doctorIdFromLogin");const e=M;oe(!0),re(null);try{const t={apiBaseUrl:s,hospitalId:F,doctorId:e,token:W},n=await p(J,at,lt,t);if(401===n.status||403===n.status){try{"undefined"!=typeof localStorage&&(localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h))}catch(e){}return A(null),R(null),P(null),_(e=>e+1),void re("Session expired. Re-authenticating...")}if(n.err)return void re(String(n.err||"Failed to fetch appointments"));const o=n.data||n.appointments||n||[];Z(Array.isArray(o)?o:[]),Array.isArray(o)&&o.length>0?te(o[0]):te(null)}catch(e){console.error("Error fetching appointments:",e),re(e.message||"Failed to fetch appointments")}finally{oe(!1)}},[J,at,lt,xe,s,F,M,W,z,T]),yt=e=>{te(e),Ne(null)},bt=async()=>{if(ee&&W){Me(!0),Ne(null);try{var e;const t={apiBaseUrl:s,hospitalId:F,doctorId:M,doctorName:N||V,appToken:W};console.log(ee,"selectedAppointment"),console.log(t,"callConfig");const o=await u(ee,t);if(console.log(o.status,"response"),401===o.status||403===o.status){try{"undefined"!=typeof localStorage&&(localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h))}catch(e){}return A(null),R(null),P(null),_(e=>e+1),void Ne("Session expired. Re-authenticating...")}if(o.err||null===(e=o.data)||void 0===e||!e.token)return void Ne(String(o.err||"Failed to initiate call"));const a=n.joinCallUrl||c,r=o.data.token?String(a||"").replace(/\/?$/,"")+o.data.token:"";console.log("joinCallUrl",r),ze(o.data.token),We(r||""),Se(!0),Ce(!1),Ie(!1),He({width:E,height:560}),je({x:Math.max(20,window.innerWidth-E-20),y:80})}catch(e){Ne(e.message||"Failed to initiate call")}finally{Me(!1)}}},Et=()=>{Se(!1),Ce(!1),Ie(!1),ze(null),We(null),Ne(null),ht()},vt=()=>{ke&&Ie(!1),Ce(!Fe)},wt=()=>{Fe&&Ce(!1),Ie(!ke)},St=e=>{if(0!==e.button)return;if(e.target.closest("button"))return;e.currentTarget.setPointerCapture&&e.currentTarget.setPointerCapture(e.pointerId),Ue(!0);const t=e.currentTarget.getBoundingClientRect();Oe({x:e.clientX-t.left,y:e.clientY-t.top})},Ft=t.useCallback(e=>{if(!ke)if(Be){const t=e.clientX-Ye.x,n=e.clientY-Ye.y,o=window.innerWidth-Le.width,a=window.innerHeight-Le.height;je({x:Math.max(0,Math.min(t,o)),y:Math.max(0,Math.min(n,a))})}else if(_e){const t=e.clientX-Xe.x,n=e.clientY-Xe.y;let o=Xe.width,a=Xe.height,r=Xe.posX,l=Xe.posY;const i=300,d=250,s=window.innerWidth-40,c=window.innerHeight-100;if("bottom-right"===Ke)o=Math.min(Math.max(Xe.width+t,i),s),a=Math.min(Math.max(Xe.height+n,d),c),r+o>window.innerWidth&&(o=window.innerWidth-r),l+a>window.innerHeight&&(a=window.innerHeight-l);else if("bottom-left"===Ke){o=Math.min(Math.max(Xe.width-t,i),s),r=Math.max(0,Xe.posX+t),0===r&&(o=Xe.posX+Xe.width),a=Math.min(Math.max(Xe.height+n,d),c),l+a>window.innerHeight&&(a=window.innerHeight-l)}else if("top-right"===Ke){o=Math.min(Math.max(Xe.width+t,i),s),r+o>window.innerWidth&&(o=window.innerWidth-r);a=Math.min(Math.max(Xe.height-n,d),c),l=Math.max(0,Xe.posY+n),0===l&&(a=Xe.posY+Xe.height)}else if("top-left"===Ke){o=Math.min(Math.max(Xe.width-t,i),s),r=Math.max(0,Xe.posX+t),0===r&&(o=Xe.posX+Xe.width);a=Math.min(Math.max(Xe.height-n,d),c),l=Math.max(0,Xe.posY+n),0===l&&(a=Xe.posY+Xe.height)}He({width:o,height:a}),je({x:r,y:l})}},[Be,_e,Ye,Ke,Xe,Pe,Le,ke]),Ct=()=>{Ue(!1),qe(!1),Ve(null)},kt=(e,t)=>{t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture&&t.currentTarget.setPointerCapture(t.pointerId),qe(!0),Ve(e),Ge({x:t.clientX,y:t.clientY,width:Le.width,height:Le.height,posX:Pe.x,posY:Pe.y})};t.useEffect(()=>{if(!we||ke)return;const e=()=>{if(!(window.innerWidth<768)){const e=Fe?350:Le.width,t=Fe?60:Le.height,n=window.innerWidth-40,o=window.innerHeight-100,a=Math.min(e,n),r=Math.min(t,o);a===Le.width&&r===Le.height||He({width:a,height:r});const l=window.innerWidth-a-20,i=window.innerHeight-r-20;je(e=>({x:Math.min(e.x,l),y:Math.min(e.y,i)}))}};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[we,Fe,ke,Le]),t.useEffect(()=>{if(!(z&&T&&(!W||O>0)))return;let e=!1;return L(!0),B(null),(async(e,t,n,o)=>{const a=e.replace(/\/$/,""),r="".concat(a,"/um/user/V1/sso/login?hospitalId=").concat(encodeURIComponent(t)),l={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:n,email:o})};return console.log("[getTokenFromSso] request",{url:r,body:{idToken:n?n.slice(0,50)+"...":null,email:o}}),fetch(r,l).then(e=>(console.log("[getTokenFromSso] response status",e.status,e.statusText),e.ok?e.json().then(e=>{var t;return console.log("[getTokenFromSso] success",{hasData:!!e,dataKeys:e?Object.keys(e):[],hasAccessToken:!(null==e||null===(t=e.data)||void 0===t||!t.access_token)}),e}):e.json().then(t=>{var n;const o=(null==t||null===(n=t.resultInfo)||void 0===n?void 0:n.message)||"SSO login failed";return console.log("[getTokenFromSso] error body",t),{err:o,status:e.status}}).catch(()=>({err:"Something went wrong!",status:e.status})))).catch(e=>(console.error("[getTokenFromSso] catch",e),{err:e.message||"Network error"}))})(s,F,z,T).then(t=>{if(e)return;const n=function(e){var t,n,o,a,r,l;return!e||e.err?null:null!==(t=null!==(n=null!==(o=null!==(a=null===(r=e.data)||void 0===r?void 0:r.access_token)&&void 0!==a?a:null===(l=e.data)||void 0===l?void 0:l.token)&&void 0!==o?o:e.token)&&void 0!==n?n:e.accessToken)&&void 0!==t?t:null}(t);if(400===t.status)return B(t.err||"Invalid request. Redirecting to home..."),L(!1),void Y(!0);if(t.err||!n){B(String(t.err||"Failed to get token")),A(null),R(null),P(null);try{"undefined"!=typeof localStorage&&(localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h))}catch(e){}}else{const e=function(e){var t,n;if(null==e||!e.data)return null;const o=null!==(t=null!==(n=e.data.doctor_id)&&void 0!==n?n:e.data.doctorId)&&void 0!==t?t:null;return console.log(o,"extractDoctorIdFromLoginResponse -> id"),null!=o?String(o):null}(t);console.log(e,"extractDoctorIdFromLoginResponse -> doctorId");const o=function(e){var t,n,o;if(null==e||!e.data)return null;const a=null!==(t=null!==(n=null!==(o=e.data.name)&&void 0!==o?o:e.data.doctor_name)&&void 0!==n?n:e.data.userName)&&void 0!==t?t:null;return null!=a?String(a):null}(t);A(n),R(e),P(o),B(null),Y(!1);try{"undefined"!=typeof localStorage&&(localStorage.setItem(g,n),e&&localStorage.setItem(x,e),o&&localStorage.setItem(h,o))}catch(e){}}}).catch(t=>{e||(B((null==t?void 0:t.message)||"Authentication failed. Please try again."),A(null))}).finally(()=>{e||L(!1)}),()=>{e=!0}},[s,F,z,T,O,W]),t.useEffect(()=>{$e(1),Ne(null)},[J,de,at,lt,Ee,xe]),t.useEffect(()=>{!j&&W&&ht()},[ht,W,j]),t.useEffect(()=>{const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap",e.rel="stylesheet",document.head.appendChild(e);const t=document.createElement("style");t.innerHTML="\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n \n @media (max-width: 768px) {\n .appointments-grid {\n grid-template-columns: 1.5fr 1fr 0.8fr !important;\n }\n .appointments-header-grid {\n grid-template-columns: 1.5fr 1fr 0.8fr !important;\n }\n .hide-on-mobile {\n display: none !important;\n }\n }\n @media (max-width: 480px) {\n .appointments-header-grid {\n font-size: 10px !important;\n }\n .appointments-grid {\n font-size: 11px !important;\n }\n }\n ",document.head.appendChild(t);const n=()=>{ie(window.innerWidth<768)};return window.addEventListener("resize",n),()=>{document.head.removeChild(e),document.head.removeChild(t),window.removeEventListener("resize",n)}},[]),t.useEffect(()=>{const e=e=>{!ue||e.target.closest("button")||e.target.closest('input[type="date"]')||fe(!1),me&&!e.target.closest("[data-appointment-type-picker]")&&ge(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[ue,me]);let It='"Nunito", serif';const Dt=H||!W&&(!z||!T);let zt;return zt=j&&z&&T?a.default.createElement("div",{className:v,[w]:"teleconsult-appointments",style:{fontFamily:It,background:"#F5F5F7",boxSizing:"border-box",height:"100%",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px"}},a.default.createElement("style",null,"@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }"),a.default.createElement("div",{style:{width:"40px",height:"40px",border:"3px solid #f3f3f3",borderTop:"3px solid #4C4DDC",borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"16px"}}),a.default.createElement("p",{style:{fontSize:"14px",color:"#666",margin:0}},"Checking authorisation...")):a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{className:v,[w]:"teleconsult-appointments",style:{fontFamily:It,background:"#F5F5F7",boxSizing:"border-box",height:"100%",minHeight:"100vh",width:"100%",display:"flex",flexDirection:"column",overflow:"hidden"}},a.default.createElement("div",{style:{background:"#FFFFFF",padding:le?"10px 12px":"12px 24px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #E5E5E5",flexWrap:"nowrap",gap:le?"8px":"0"}},a.default.createElement("div",{style:{position:"relative",width:le?"calc(100% - 90px)":"480px",maxWidth:le?"none":"480px"}},a.default.createElement("input",{type:"text",placeholder:"Search by patient name or ID",value:Ee,onChange:e=>ve(e.target.value),style:{width:"100%",padding:le?"8px 32px 8px 10px":"8px 36px 8px 14px",border:"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"12px":"13px",fontFamily:It,background:"#FFFFFF",outline:"none",boxSizing:"border-box"}}),Ee&&a.default.createElement("button",{onClick:()=>ve(""),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:"16px"},title:"Clear search"},"✕")),!1),a.default.createElement("div",{style:{padding:le?"12px":"16px 24px",flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"}},a.default.createElement("div",{style:{marginBottom:le?"10px":"14px"}},a.default.createElement("h1",{style:{fontSize:le?"18px":"22px",fontWeight:700,color:"#1a1a1a",margin:"0 0 2px 0"}},"Tele Consultation"),a.default.createElement("p",{style:{fontSize:le?"11px":"12px",color:"#999",margin:0}},"Displaying All Tele Consultation Appointments")),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:le?"flex-start":"center",marginBottom:le?"10px":"14px",flexDirection:le?"column":"row",gap:le?"12px":"0"}},a.default.createElement("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",width:le?"100%":"auto"}},a.default.createElement("button",{onClick:()=>$("upcoming"),style:{background:"upcoming"===J?"#4C4DDC":"#FFFFFF",padding:le?"8px 10px":"9px 16px",border:"upcoming"===J?"none":"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"10px":"13px",color:"upcoming"===J?"white":"#555555",fontWeight:600,fontFamily:It,cursor:"pointer",flex:le?"1 1 auto":"none",minWidth:le?"0":"auto",transition:"all 0.3s ease",whiteSpace:"nowrap"}},"Upcoming Appointments"),a.default.createElement("button",{onClick:()=>$("completed"),style:{background:"completed"===J?"#4C4DDC":"#FFFFFF",padding:le?"8px 10px":"9px 16px",border:"completed"===J?"none":"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"10px":"13px",color:"completed"===J?"white":"#555555",fontWeight:600,fontFamily:It,cursor:"pointer",flex:le?"1 1 auto":"none",minWidth:le?"0":"auto",transition:"all 0.3s ease",whiteSpace:"nowrap"}},"Completed Appointments"),a.default.createElement("button",{onClick:()=>$("cancelled"),style:{background:"cancelled"===J?"#4C4DDC":"#FFFFFF",padding:le?"8px 10px":"9px 16px",border:"cancelled"===J?"none":"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"10px":"13px",color:"cancelled"===J?"white":"#555555",fontWeight:600,fontFamily:It,cursor:"pointer",flex:le?"1 1 auto":"none",minWidth:le?"0":"auto",transition:"all 0.3s ease",whiteSpace:"nowrap"}},"Cancelled Appointments")),a.default.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center",width:"auto",position:"relative",justifyContent:le?"flex-start":"flex-end",flexWrap:"wrap"}},a.default.createElement("button",{onClick:()=>{ue||(st(at),pt(lt),pe(de)),fe(!ue)},style:{padding:"8px 12px",fontFamily:It,fontWeight:600,border:"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"11px":"13px",color:"#1a1a1a",background:"#FFFFFF",display:"flex",alignItems:"center",gap:le?"4px":"6px",cursor:"pointer",flex:"none",minWidth:le?"100px":"auto",justifyContent:"center"}},a.default.createElement("svg",{width:le?"12":"14",height:le?"12":"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.default.createElement("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),a.default.createElement("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),a.default.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),a.default.createElement("line",{x1:"3",y1:"10",x2:"21",y2:"10"})),a.default.createElement("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},(()=>{switch(de){case"today":default:return"Today";case"tomorrow":return"Tomorrow";case"currentWeek":return"Current Week";case"thisMonth":return"This Month";case"currentYear":return"Current Year";case"custom":return le?"Custom":"".concat(at," to ").concat(lt)}})()),a.default.createElement("svg",{width:le?"8":"10",height:le?"8":"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.default.createElement("polyline",{points:"6 9 12 15 18 9"}))),ue&&a.default.createElement("div",{style:{position:"absolute",top:"100%",right:le?"auto":0,left:le?0:"auto",marginTop:"4px",background:"#FFFFFF",border:"1px solid #E5E5E5",borderRadius:"8px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"8px",zIndex:1e3,minWidth:le?"280px":"240px",width:le?"calc(100vw - 24px)":"auto",maxWidth:le?"calc(100vw - 24px)":"280px"}},a.default.createElement("div",{style:{marginBottom:"custom"===ce?"12px":"0"}},["thisMonth","today","tomorrow","currentWeek","currentYear","custom"].map(e=>a.default.createElement("button",{key:e,onClick:()=>{if(pe(e),"custom"!==e){const t=(e=>{const t=new Date;let n,o;switch(e){case"today":default:n=o=X();break;case"tomorrow":const e=new Date(t);e.setDate(e.getDate()+1),n=o=G(e);break;case"currentWeek":const a=new Date(t),r=new Date(t),l=t.getDay(),i=0===l?-6:1-l;a.setDate(t.getDate()+i),r.setDate(a.getDate()+6),n=G(a),o=G(r);break;case"thisMonth":const d=new Date(t.getFullYear(),t.getMonth(),1),s=new Date(t.getFullYear(),t.getMonth()+1,0);n=G(d),o=G(s);break;case"currentYear":n="".concat(t.getFullYear(),"-01-01"),o="".concat(t.getFullYear(),"-12-31")}return{from:n,to:o}})(e);se(e),rt(t.from),it(t.to),st(t.from),pt(t.to),fe(!1)}else st(""),pt("")},style:{width:"100%",padding:"10px 12px",background:ce===e?"#E8EEF4":"#FFFFFF",border:"none",borderRadius:"4px",fontSize:"13px",fontFamily:It,cursor:"pointer",textAlign:"left",fontWeight:ce===e?600:400,color:ce===e?"#4C4DDC":"#1a1a1a",marginBottom:"4px",display:"flex",justifyContent:"space-between",alignItems:"center",transition:"all 0.2s ease"},onMouseEnter:t=>{ce!==e&&(t.target.style.background="#F5F5F5")},onMouseLeave:t=>{ce!==e&&(t.target.style.background="#FFFFFF")}},a.default.createElement("span",null,{thisMonth:"This Month",today:"Today",tomorrow:"Tomorrow",currentWeek:"Current Week",currentYear:"Current Year",custom:"Custom"}[e]),ce===e&&a.default.createElement("span",{style:{color:"#4C4DDC",fontSize:"16px"}},"✓")))),"custom"===ce&&a.default.createElement("div",{style:{paddingTop:"8px",borderTop:"1px solid #E5E5E5"}},a.default.createElement("div",{style:{marginBottom:"8px"}},a.default.createElement("input",{type:"date",value:dt,onChange:e=>st(e.target.value),placeholder:"Start Date",style:{width:"100%",padding:"10px 8px",border:"1px solid #E5E5E5",borderRadius:"4px",fontSize:"13px",fontFamily:It,boxSizing:"border-box",cursor:"pointer"}})),a.default.createElement("div",{style:{marginBottom:"12px"}},a.default.createElement("input",{type:"date",value:ct,onChange:e=>pt(e.target.value),placeholder:"End Date",style:{width:"100%",padding:"10px 8px",border:"1px solid #E5E5E5",borderRadius:"4px",fontSize:"13px",fontFamily:It,boxSizing:"border-box",cursor:"pointer"}})),a.default.createElement("div",{style:{display:"flex",gap:"8px"}},a.default.createElement("button",{onClick:()=>{pe(de),st(at),pt(lt),fe(!1)},style:{flex:1,padding:"10px 12px",background:"#FFFFFF",color:"#4C4DDC",border:"1px solid #4C4DDC",borderRadius:"4px",fontSize:"13px",fontFamily:It,fontWeight:600,cursor:"pointer"}},"Cancel"),a.default.createElement("button",{onClick:()=>{dt&&ct&&(se("custom"),rt(dt),it(ct),fe(!1))},style:{flex:1,padding:"10px 12px",background:"#4C4DDC",color:"#FFFFFF",border:"none",borderRadius:"4px",fontSize:"13px",fontFamily:It,fontWeight:600,cursor:"pointer"}},"Submit")))))),a.default.createElement("div",{style:{display:"flex",flexDirection:le?"column":"row",gap:le?"12px":"14px",flex:1,minHeight:0,overflow:le?"auto":"hidden"}},a.default.createElement("div",{style:{flex:le?"none":"1 1 65%",width:le?"100%":"auto",display:"flex",flexDirection:"column",minHeight:le?"400px":0,maxHeight:le?"none":"100%",overflow:"hidden"}},a.default.createElement("div",{style:{background:"#FFFFFF",borderRadius:"8px",boxShadow:"0 1px 4px rgba(0,0,0,0.08)",overflow:"hidden",display:"flex",flexDirection:"column",flex:le?"none":1,minHeight:le?"auto":0,maxHeight:le?"none":"100%"}},a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:le?"12px 14px":"14px 18px",borderBottom:"1px solid #F1F1F1"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:le?"6px":"8px"}},a.default.createElement("span",{style:{fontSize:le?"14px":"15px",fontWeight:700,color:"#1a1a1a"}},"Appointments"),a.default.createElement("span",{style:{background:"#4C4DDC",color:"#fff",fontSize:le?"10px":"11px",fontWeight:600,padding:le?"2px 7px":"3px 8px",borderRadius:"12px"}},ot))),a.default.createElement("div",{className:"appointments-header-grid",style:{display:"grid",gridTemplateColumns:le?"1.5fr 1fr 0.8fr":"2.5fr 1fr 1.5fr 0.8fr 1.2fr",gap:le?"8px":"12px",padding:le?"8px 12px":"10px 18px",background:"#F5F5F5",fontSize:le?"10px":"12px",fontWeight:600,color:"#666"}},a.default.createElement("div",null,"Patients name"),!le&&a.default.createElement("div",null,"Patient ID"),a.default.createElement("div",{onClick:xt,style:{display:"flex",alignItems:"center",gap:"3px",cursor:"pointer",userSelect:"none"}},"Date",a.default.createElement("span",{style:{opacity:.7,fontSize:"10px"}},"asc"===ye?"▲":"▼")),!le&&a.default.createElement("div",null,"Slot"),!le&&a.default.createElement("div",null,"Doctor")),a.default.createElement("div",{style:{overflowY:"auto",overflowX:"hidden",flex:1,minHeight:0,maxHeight:le?"none":"430px",WebkitOverflowScrolling:"touch"}},j?a.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"40px",color:"#888"}},a.default.createElement("div",{style:{textAlign:"center"}},a.default.createElement("div",{style:{width:"40px",height:"40px",border:"3px solid #f3f3f3",borderTop:"3px solid #4C4DDC",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto 10px"}}),"Getting token...")):ne?a.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"40px",color:"#888"}},a.default.createElement("div",{style:{textAlign:"center"}},a.default.createElement("div",{style:{width:"40px",height:"40px",border:"3px solid #f3f3f3",borderTop:"3px solid #4C4DDC",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto 10px"}}),"Loading appointments...")):ae?a.default.createElement("div",{style:{padding:"40px",textAlign:"center",color:"#FF0000"}},a.default.createElement("div",{style:{fontSize:"16px",marginBottom:"8px"}},"⚠️ Error"),a.default.createElement("div",{style:{fontSize:"13px"}},ae),a.default.createElement("button",{onClick:ht,style:{marginTop:"16px",padding:"8px 16px",background:"#4C4DDC",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontFamily:It}},"Retry")):0===tt.length?a.default.createElement("div",{style:{padding:"40px",textAlign:"center",color:"#888"}},a.default.createElement("div",{style:{fontSize:"16px",marginBottom:"8px"}},"📋"),a.default.createElement("div",{style:{fontSize:"13px"}},Ee?'No appointments found for "'.concat(Ee,'"'):"No appointments found"),Ee&&a.default.createElement("button",{onClick:()=>ve(""),style:{marginTop:"12px",padding:"6px 12px",background:"#4C4DDC",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontFamily:It}},"Clear Search")):tt.map(e=>a.default.createElement("div",{key:ut(e),role:"button",tabIndex:0,onClick:()=>yt(e),onKeyDown:t=>"Enter"===t.key&&yt(e),className:"appointments-grid",style:{display:"grid",gridTemplateColumns:le?"1.5fr 1fr 0.8fr":"2.5fr 1fr 1.5fr 0.8fr 1.2fr",gap:le?"8px":"12px",padding:le?"10px 12px":"12px 18px",background:ut(ee)===ut(e)?"#E8EEF4":"#FFFFFF",borderTop:"1px solid #F1F1F1",alignItems:"center",cursor:"pointer",fontSize:le?"11px":"13px"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:le?"8px":"10px"}},ft(e)?a.default.createElement("img",{src:e.image,alt:"",style:{width:le?"32px":"36px",height:le?"32px":"36px",borderRadius:"50%",objectFit:"cover"}}):a.default.createElement("div",{style:{width:le?"32px":"36px",height:le?"32px":"36px",borderRadius:"50%",background:gt(e.patientName),display:"flex",alignItems:"center",justifyContent:"center",color:"#FFFFFF",fontWeight:600,fontSize:le?"14px":"16px"}},mt(e.patientName)),a.default.createElement("div",null,a.default.createElement("div",{style:{fontWeight:600,color:"#1a1a1a",fontSize:le?"11px":"13px"}},e.patientName),a.default.createElement("div",{style:{fontSize:le?"9px":"11px",color:"#888"}},e.email))),!le&&a.default.createElement("div",{style:{color:"#555",fontSize:"12px"}},e.patientId),a.default.createElement("div",{style:{color:"#555",fontSize:le?"10px":"12px"}},(()=>{const t=e.appointmentDate||"",n=t.match(/\s(\d{1,2}:\d{2}(?:\s*(?:AM|PM))?)$/i);return n?a.default.createElement(a.default.Fragment,null,a.default.createElement("div",null,t.slice(0,n.index).trim()),a.default.createElement("div",{style:{fontSize:le?"9px":"11px",color:"#888"}},n[1].trim())):a.default.createElement("div",null,t)})()),!le&&a.default.createElement("div",{style:{color:"#555",fontSize:"12px"}},e.appointmentTime||"-"),!le&&a.default.createElement("div",{style:{color:"#555",fontSize:"12px"}},e.doctorName||e.doctor||"-")))),!ne&&!ae&&tt.length>0&&a.default.createElement("div",{style:{padding:le?"12px 14px":"14px 18px",borderTop:"1px solid #F1F1F1",display:"flex",justifyContent:"space-between",alignItems:"center",background:"#FFFFFF",flexWrap:le?"wrap":"nowrap",gap:le?"10px":"0"}},a.default.createElement("div",{style:{fontSize:le?"11px":"12px",color:"#666"}},"Showing page ",Je," of ",nt," (",ot," total)"),a.default.createElement("div",{style:{display:"flex",gap:"6px",alignItems:"center"}},a.default.createElement("button",{onClick:()=>$e(e=>Math.max(1,e-1)),disabled:1===Je,style:{padding:le?"6px 10px":"6px 12px",border:"1px solid #E5E5E5",borderRadius:"4px",background:1===Je?"#F5F5F5":"#FFFFFF",color:1===Je?"#999":"#1a1a1a",fontSize:le?"11px":"12px",fontFamily:It,fontWeight:600,cursor:1===Je?"not-allowed":"pointer",opacity:1===Je?.5:1}},"Previous"),a.default.createElement("div",{style:{display:"flex",gap:"4px"}},[...Array(Math.min(5,nt))].map((e,t)=>{let n;return n=nt<=5||Je<=3?t+1:Je>=nt-2?nt-4+t:Je-2+t,a.default.createElement("button",{key:n,onClick:()=>$e(n),style:{padding:le?"6px 10px":"6px 12px",border:Je===n?"none":"1px solid #E5E5E5",borderRadius:"4px",background:Je===n?"#4C4DDC":"#FFFFFF",color:Je===n?"#FFFFFF":"#1a1a1a",fontSize:le?"11px":"12px",fontFamily:It,fontWeight:600,cursor:"pointer",minWidth:le?"32px":"36px"}},n)})),a.default.createElement("button",{onClick:()=>$e(e=>Math.min(nt,e+1)),disabled:Je===nt,style:{padding:le?"6px 10px":"6px 12px",border:"1px solid #E5E5E5",borderRadius:"4px",background:Je===nt?"#F5F5F5":"#FFFFFF",color:Je===nt?"#999":"#1a1a1a",fontSize:le?"11px":"12px",fontFamily:It,fontWeight:600,cursor:Je===nt?"not-allowed":"pointer",opacity:Je===nt?.5:1}},"Next"))))),a.default.createElement("div",{style:{flex:le?"none":"1 1 35%",width:le?"100%":"auto",display:ee||!le?"flex":"none",flexDirection:"column",minHeight:le?"auto":0}},a.default.createElement("div",{style:{border:"1px solid #E5E5E5",borderRadius:"8px",overflow:"hidden",background:"#FFFFFF",boxShadow:"0 1px 4px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",flex:le?"none":1,minHeight:le?"auto":0}},ee?a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:le?"12px 14px":"16px 18px",background:"#E8EEF4",borderBottom:"1px solid #E5E5E5"}},a.default.createElement("div",null,a.default.createElement("div",{style:{color:"#002668",fontSize:le?"14px":"16px",fontWeight:"700"}},ee.patientName||"N/A"),a.default.createElement("div",{style:{color:"#002668",fontSize:le?"11px":"13px"}},ee.patientId||ee.mrn||"N/A")),a.default.createElement("div",null,ft(ee)?a.default.createElement("img",{style:{width:le?"36px":"44px",height:le?"36px":"44px",borderRadius:"50%",objectFit:"cover"},src:ee.image,alt:ee.patientName}):a.default.createElement("div",{style:{width:le?"36px":"44px",height:le?"36px":"44px",borderRadius:"50%",background:gt(ee.patientName),display:"flex",alignItems:"center",justifyContent:"center",color:"#FFFFFF",fontWeight:700,fontSize:le?"16px":"20px"}},mt(ee.patientName)))),a.default.createElement("div",{style:{padding:le?"12px 14px":"14px 18px",gap:le?"10px":"12px",display:"flex",flexDirection:"column",background:"white",overflow:"auto",flex:1,position:"relative"}},a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Speciality"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.specialisation)||(null==ee?void 0:ee.speciality)||"N/A")),a.default.createElement("div",{style:{textAlign:"right"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Appointment Type"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.type)||(null==ee?void 0:ee.appointmentType)||"Online"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Appointment Date"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.date)||(null==ee?void 0:ee.appointmentDate)||"N/A")),a.default.createElement("div",{style:{textAlign:"right"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Appointment Time"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.time)||(null==ee?void 0:ee.appointmentTime)||"N/A"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Doctor"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.doctor)||(null==ee?void 0:ee.doctorName)||"N/A"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Hospital"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.hospital)||(null==ee?void 0:ee.hospitalName)||"N/A"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Reason for Appointment"),a.default.createElement("div",{style:{fontWeight:"600",fontSize:le?"11px":"12px",lineHeight:"1.4"}},(null==ee?void 0:ee.reason)||(null==ee?void 0:ee.reasonForAppointment)||"No reason provided"))),("upcoming"===J||"completed"===J&&(e=>{const t=(null==e?void 0:e.date)||(null==e?void 0:e.appointmentDate),n=(null==e?void 0:e.time)||(null==e?void 0:e.appointmentTime);if(!t||!n)return!1;try{const e=String(n).trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);let o,a;if(e){o=parseInt(e[1],10),a=parseInt(e[2],10);const t=e[3].toUpperCase();"AM"===t&&12===o&&(o=0),"PM"===t&&12!==o&&(o+=12)}else{const e=String(n).trim().split(":");o=parseInt(e[0],10),a=parseInt(e[1],10)}if(isNaN(o)||isNaN(a))return!1;const r=new Date("".concat(t," ").concat(String(o).padStart(2,"0"),":").concat(String(a).padStart(2,"0"),":00"));if(isNaN(r.getTime()))return!1;const l=new Date(r.getTime()+72e5);return new Date<=l}catch(e){return!1}})(ee))&&a.default.createElement("div",{style:{display:"flex",flexDirection:le?"column":"row",gap:"6px",marginTop:"10px"}},a.default.createElement("button",{type:"button",onClick:Ae?void 0:bt,disabled:Ae,style:{flex:1,background:Ae?"#99e4e8":"#1CC3CE",color:"#FFFFFF",border:"1px solid #1CC3CE",borderRadius:"6px",padding:le?"10px 8px":"8px 6px",fontFamily:It,fontWeight:600,fontSize:le?"11px":"12px",cursor:Ae?"not-allowed":"pointer"}},Ae?"Connecting...":"Join Call >")),("upcoming"===J||"completed"===J)&&Re&&a.default.createElement("div",{style:{fontSize:"11px",color:"#e53935",marginTop:"6px",textAlign:"center",width:"100%"}},"⚠️ ",Re))):a.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",padding:"40px",color:"#888",textAlign:"center"}},a.default.createElement("div",null,a.default.createElement("div",{style:{fontSize:"16px",marginBottom:"8px"}},"📋"),a.default.createElement("div",{style:{fontSize:"13px"}},"Select an appointment to view details"))))))),we&&a.default.createElement("div",{style:{position:"fixed",left:ke?"0":le?"10px":"".concat(Pe.x,"px"),top:ke?"0":le?"70px":"".concat(Pe.y,"px"),right:ke?"0":le?"10px":"auto",bottom:ke?"0":"auto",width:ke?"100vw":le?"calc(100vw - 20px)":Fe?"350px":"".concat(Le.width,"px"),height:ke?"100vh":Fe?"auto":le?"300px":"".concat(Le.height,"px"),background:"#FFFFFF",borderRadius:ke?"0":"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",zIndex:1e5,overflow:"hidden",display:"flex",flexDirection:"column",transition:Be||_e?"none":"all 0.3s ease"}},a.default.createElement("div",{onPointerDown:le||ke?void 0:St,onPointerMove:le||ke?void 0:Ft,onPointerUp:le||ke?void 0:Ct,onPointerCancel:le||ke?void 0:Ct,style:{background:"linear-gradient(135deg, #4C4DDC 0%, #3A3BBD 100%)",color:"#FFFFFF",padding:le?"8px 10px":"10px 12px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:le||ke?"default":"move",userSelect:"none"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:le?"6px":"8px",flex:1,minWidth:0}},a.default.createElement("div",{style:{width:le?"6px":"8px",height:le?"6px":"8px",borderRadius:"50%",background:"#FF4444",animation:"pulse 2s infinite",flexShrink:0}}),a.default.createElement("span",{style:{fontSize:le?"11px":"13px",fontWeight:600,fontFamily:It,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},"Video Call - ",(null==ee?void 0:ee.patientName)||"Patient")),a.default.createElement("div",{style:{display:"flex",gap:le?"4px":"6px",alignItems:"center",flexShrink:0}},a.default.createElement("button",{onClick:vt,style:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"6px",color:"#FFFFFF",cursor:"pointer",padding:le?"5px 8px":"6px 10px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",minWidth:le?"28px":"32px",height:le?"28px":"32px",transition:"background 0.2s ease"},onMouseEnter:e=>e.target.style.background="rgba(255, 255, 255, 0.3)",onMouseLeave:e=>e.target.style.background="rgba(255, 255, 255, 0.2)",title:Fe?"Restore":"Minimize"},Fe?a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("rect",{x:"3",y:"3",width:"10",height:"10",stroke:"white",strokeWidth:"1.8",fill:"none"})):a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round"}))),a.default.createElement("button",{onClick:wt,style:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"6px",color:"#FFFFFF",cursor:"pointer",padding:le?"5px 8px":"6px 10px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",minWidth:le?"28px":"32px",height:le?"28px":"32px",transition:"background 0.2s ease"},onMouseEnter:e=>e.target.style.background="rgba(255, 255, 255, 0.3)",onMouseLeave:e=>e.target.style.background="rgba(255, 255, 255, 0.2)",title:ke?"Exit Fullscreen":"Fullscreen"},ke?a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("path",{d:"M10 3H13V6M6 13H3V10M13 10V13H10M3 6V3H6",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})):a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("path",{d:"M3 6V3H6M13 10V13H10M10 3H13V6M6 13H3V10",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}))),a.default.createElement("button",{onClick:Et,style:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"6px",color:"#FFFFFF",cursor:"pointer",padding:le?"5px 8px":"6px 10px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",minWidth:le?"28px":"32px",height:le?"28px":"32px",fontWeight:"bold",fontSize:le?"18px":"22px",transition:"background 0.2s ease"},onMouseEnter:e=>e.target.style.background="rgba(255, 255, 255, 0.3)",onMouseLeave:e=>e.target.style.background="rgba(255, 255, 255, 0.2)",title:"Close"},"×"))),a.default.createElement("div",{style:{flex:1,background:"#000000",position:"relative",display:Fe?"none":"flex",flexDirection:"column"}},a.default.createElement("iframe",{src:(()=>{if(!De)return"";const e=String(q||"");return"".concat(e).concat(De)})(),style:{width:"100%",height:"100%",border:"none",flex:1},allow:"camera; microphone; display-capture; autoplay",allowFullScreen:!0,title:"Video Call"})),!le&&!ke&&!Fe&&a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{onPointerDown:e=>kt("top-left",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",left:0,top:0,width:"16px",height:"16px",cursor:"nwse-resize",background:"transparent",zIndex:10001}}),a.default.createElement("div",{onPointerDown:e=>kt("top-right",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",right:0,top:0,width:"16px",height:"16px",cursor:"nesw-resize",background:"transparent",zIndex:10001}}),a.default.createElement("div",{onPointerDown:e=>kt("bottom-left",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",left:0,bottom:0,width:"16px",height:"16px",cursor:"nesw-resize",background:"transparent",zIndex:10001}}),a.default.createElement("div",{onPointerDown:e=>kt("bottom-right",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",right:0,bottom:0,width:"16px",height:"16px",cursor:"nwse-resize",background:"transparent",zIndex:10001}})),a.default.createElement("style",null,"\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n "))),Dt&&a.default.createElement("div",{style:{position:"fixed",inset:0,zIndex:1e5,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(0,0,0,0.4)",boxSizing:"border-box"}},a.default.createElement("div",{style:{fontFamily:It,maxWidth:"400px",width:"100%",padding:"32px 24px",background:"#FFFFFF",borderRadius:"12px",boxShadow:"0 8px 32px rgba(0,0,0,0.2)",textAlign:"center"}},a.default.createElement("div",{style:{fontSize:"48px",marginBottom:"16px"}},"🔒"),a.default.createElement("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1a1a1a",margin:"0 0 8px 0"}},"Access Denied"),a.default.createElement("p",{style:{fontSize:"14px",color:"#666",margin:0,lineHeight:1.5}},"You do not have permission to access Afiya Pro. Please contact administrator for assistance.")))),a.default.createElement(S,null,zt)},C=Object.freeze({ICD_ONLY:"ICD_ONLY",CLAUDE_ONLY:"CLAUDE_ONLY",AUTO:"AUTO"}),k="".concat(i,"/insurance/api/icd/suggest");async function I(e,t){var n;if(!e||!e.trim())throw new Error("Query cannot be empty");const o=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e.trim(),mode:t})});if(!o.ok){var a;const e=await o.json().catch(()=>({})),t=(null==e?void 0:e.message)||(null==e||null===(a=e.error)||void 0===a?void 0:a.message)||"API error: ".concat(o.status," ").concat(o.statusText);throw new Error(t)}const r=await o.json(),l=null!==(n=null==r?void 0:r.data)&&void 0!==n?n:r;if(Array.isArray(null==l?void 0:l.matches))return{matches:l.matches,note:l.note||""};if(Array.isArray(l))return{matches:l,note:""};if(Array.isArray(null==l?void 0:l.results))return{matches:l.results.map(e=>({code:e.code,description:e.description||e.name||"",reason:e.reason||""})),note:l.note||""};throw new Error("Unexpected response format from ICD suggest API")}const D='"Nunito", sans-serif',z={primary:"#4C4DDC",primaryDark:"#3A3BBD",primaryLight:"#E8EEF4",teal:"#1CC3CE",tealLight:"#E0F8F9",success:"#16a34a",successLight:"#dcfce7",error:"#dc2626",errorLight:"#fee2e2",warn:"#d97706",warnLight:"#fef3c7",text:"#1a1a1a",muted:"#666",border:"#E5E5E5",bg:"#F5F5F7",white:"#FFFFFF"};function T(e){let{children:t,color:n=z.primary,bg:o=z.primaryLight}=e;return a.default.createElement("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 10px",borderRadius:"999px",fontSize:"12px",fontWeight:700,color:n,background:o,letterSpacing:"0.5px"}},t)}function W(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("style",null,"@keyframes icd-spin{to{transform:rotate(360deg)}}"),a.default.createElement("div",{style:{width:20,height:20,border:"2.5px solid #d1d5db",borderTop:"2.5px solid ".concat(z.primary),borderRadius:"50%",animation:"icd-spin 0.8s linear infinite",flexShrink:0}}))}function A(e){let{text:t,label:n="Copy",copyKey:o,copiedKey:r,copy:l}=e;const i=r===o;return a.default.createElement("button",{onClick:()=>l(t,o),title:i?"Copied!":"Copy ".concat(n),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",fontSize:11,fontWeight:600,fontFamily:D,border:"1px solid ".concat(i?z.success:z.border),borderRadius:5,background:i?z.successLight:z.white,color:i?z.success:z.muted,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"}},i?"✓ Copied":"⎘ ".concat(n))}function M(e){let{match:t,index:n,copy:o,copiedKey:r}=e;const l="card-".concat(n),i="".concat(t.code," — ").concat(t.description).concat(t.reason?"\nNote: ".concat(t.reason):"");return a.default.createElement("div",{style:{border:"1px solid ".concat(z.border),borderRadius:10,padding:"14px 16px",background:z.white,display:"flex",flexDirection:"column",gap:6,boxShadow:"0 1px 4px rgba(0,0,0,0.06)"}},a.default.createElement("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},a.default.createElement(T,{color:z.primary,bg:z.primaryLight},t.code),a.default.createElement("span",{style:{fontSize:13,fontWeight:600,color:z.text,lineHeight:1.4}},t.description)),a.default.createElement(A,{text:i,label:t.code,copyKey:l,copiedKey:r,copy:o})),t.reason&&a.default.createElement("p",{style:{margin:0,fontSize:12,color:z.muted,lineHeight:1.5,paddingLeft:2}},"💡 ",t.reason))}function R(e){let{item:t,onClick:n}=e;return a.default.createElement("button",{onClick:()=>n(t.query),title:"Re-run: ".concat(t.query),style:{padding:"4px 10px",border:"1px solid ".concat(z.border),borderRadius:999,fontSize:11,fontFamily:D,color:z.muted,background:z.white,cursor:"pointer",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",transition:"border-color 0.15s"},onMouseEnter:e=>e.currentTarget.style.borderColor=z.primary,onMouseLeave:e=>e.currentTarget.style.borderColor=z.border},"🕐 ",t.query)}function N(e){let{mode:t,onChange:n}=e;const o=(e,o,r)=>a.default.createElement("button",{onClick:()=>n(e),style:{flex:1,padding:"6px 0",border:"none",borderRadius:6,fontSize:12,fontWeight:700,fontFamily:D,cursor:"pointer",transition:"all 0.15s",background:t===e?z.white:"transparent",color:t===e?z.primary:"rgba(255,255,255,0.7)",boxShadow:t===e?"0 1px 4px rgba(0,0,0,0.15)":"none",display:"flex",alignItems:"center",justifyContent:"center",gap:5}},a.default.createElement("span",null,r)," ",o);return a.default.createElement("div",{style:{display:"flex",background:"rgba(255,255,255,0.15)",borderRadius:8,padding:3,gap:2,marginTop:10}},o("nlm","Quick Lookup","🔎"),o("ai","AI Suggest","🤖"))}function P(e){let{panelRef:n,onClose:o,mode:r,onModeChange:l}=e;const[i,d]=t.useState(""),[s,c]=t.useState([]),[p,u]=t.useState(""),[f,m]=t.useState(""),g=t.useRef(null),x=t.useRef(null);t.useEffect(()=>{setTimeout(()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.focus()},80)},[]);const h=t.useCallback(async e=>{if(e.length<2)return c([]),void u("");u("Searching…");try{const t=((await I(e,C.ICD_ONLY)).matches||[]).map(e=>[e.code,e.description]);c(t),u(0===t.length?"No matching codes found.":"Showing ".concat(t.length," result").concat(1!==t.length?"s":""))}catch(e){u(e.message||"Could not fetch results. Check your connection."),c([])}},[]);return a.default.createElement("div",{ref:n,style:{position:"fixed",bottom:28,right:28,zIndex:99999,width:"min(480px, calc(100vw - 32px))",maxHeight:"calc(100vh - 56px)",display:"flex",flexDirection:"column",background:z.white,borderRadius:16,boxShadow:"0 12px 48px rgba(0,0,0,0.18)",fontFamily:D,overflow:"hidden",animation:"icd-slide-in 0.2s ease"}},a.default.createElement("style",null,"@keyframes icd-slide-in{from{opacity:0;transform:translateY(20px) scale(0.97)}to{opacity:1;transform:translateY(0) scale(1)}}"),a.default.createElement("div",{style:{background:"linear-gradient(135deg, ".concat(z.primary," 0%, ").concat(z.teal," 100%)"),padding:"14px 18px",flexShrink:0}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:10}},a.default.createElement("span",{style:{fontSize:22}},"🩺"),a.default.createElement("div",null,a.default.createElement("div",{style:{color:z.white,fontWeight:700,fontSize:15,lineHeight:1.2}},"ICD-10 Coding Assistant"),a.default.createElement("div",{style:{color:"rgba(255,255,255,0.75)",fontSize:11}},"Quick ICD-10 lookup"))),a.default.createElement("button",{onClick:o,style:{background:"rgba(255,255,255,0.2)",border:"1px solid rgba(255,255,255,0.3)",borderRadius:8,color:z.white,cursor:"pointer",fontSize:18,fontWeight:"bold",width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"}},"×")),a.default.createElement(N,{mode:r,onChange:l})),a.default.createElement("div",{style:{flex:1,overflowY:"auto",padding:"16px 18px",display:"flex",flexDirection:"column",gap:10}},a.default.createElement("input",{ref:x,type:"text",value:i,onChange:e=>{const t=e.target.value;d(t),clearTimeout(g.current),g.current=setTimeout(()=>h(t.trim()),300)},placeholder:"Type a diagnosis, e.g. diabetes, hypertension…",style:{width:"100%",padding:"10px 14px",fontSize:14,fontFamily:D,border:"1.5px solid ".concat(z.border),borderRadius:8,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"},onFocus:e=>e.target.style.borderColor=z.primary,onBlur:e=>e.target.style.borderColor=z.border}),p&&a.default.createElement("p",{style:{margin:0,fontSize:12,color:z.muted}},p),a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},s.map(e=>{let[t,n]=e;return a.default.createElement("div",{key:t,onClick:()=>(e=>{navigator.clipboard.writeText(e).then(()=>{m(e),setTimeout(()=>m(""),2e3)})})(t),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",border:"1px solid ".concat(z.border),borderRadius:8,cursor:"pointer",background:z.white,transition:"background 0.1s"},onMouseEnter:e=>e.currentTarget.style.background=z.bg,onMouseLeave:e=>e.currentTarget.style.background=z.white},a.default.createElement("span",{style:{fontFamily:"monospace",fontSize:12,background:z.primaryLight,color:z.primary,padding:"3px 8px",borderRadius:6,whiteSpace:"nowrap",fontWeight:700}},t),a.default.createElement("span",{style:{fontSize:13,flex:1,color:z.text}},n),a.default.createElement("span",{style:{fontSize:11,color:f===t?z.success:z.muted,fontWeight:f===t?700:400}},f===t?"✓ copied":"copy"))}))),a.default.createElement("div",{style:{flexShrink:0,padding:"10px 18px",borderTop:"1px solid ".concat(z.border),background:z.bg,fontSize:11,color:"#aaa",textAlign:"center"}},"⚕️ For reference only. Always verify codes with a certified medical coder."))}function j(e){let{onOpen:t}=e;return a.default.createElement("button",{onClick:t,title:"ICD-10 Coding Assistant",style:{position:"fixed",bottom:28,right:28,zIndex:99998,display:"flex",alignItems:"center",gap:8,padding:"10px 18px",borderRadius:999,border:"none",background:"linear-gradient(135deg, ".concat(z.primary," 0%, ").concat(z.teal," 100%)"),color:z.white,fontFamily:D,fontWeight:700,fontSize:13,cursor:"pointer",boxShadow:"0 4px 16px rgba(76,77,220,0.35)",transition:"transform 0.15s ease, box-shadow 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 8px 24px rgba(76,77,220,0.4)"},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 4px 16px rgba(76,77,220,0.35)"}},a.default.createElement("span",{style:{fontSize:18}},"🩺"),"ICD-10 Assistant")}function L(e){var t;let{panelRef:n,textareaRef:o,query:r,loading:l,result:i,error:d,history:s,copy:c,copiedKey:p,onQueryChange:u,onKeyDown:f,onSubmit:m,onClear:g,onClose:x,onHistoryClick:h,mode:y,onModeChange:b}=e;const E=(null==i||null===(t=i.matches)||void 0===t?void 0:t.map(e=>"".concat(e.code," — ").concat(e.description)).join("\n"))||"";return a.default.createElement("div",{style:{position:"fixed",bottom:28,right:28,zIndex:99999,width:"min(480px, calc(100vw - 32px))",maxHeight:"calc(100vh - 56px)",display:"flex",flexDirection:"column",background:z.white,borderRadius:16,boxShadow:"0 12px 48px rgba(0,0,0,0.18)",fontFamily:D,overflow:"hidden",animation:"icd-slide-in 0.2s ease"},ref:n},a.default.createElement("style",null,"\n @keyframes icd-slide-in {\n from { opacity: 0; transform: translateY(20px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n "),a.default.createElement("div",{style:{background:"linear-gradient(135deg, ".concat(z.primary," 0%, ").concat(z.teal," 100%)"),padding:"14px 18px",flexShrink:0}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:10}},a.default.createElement("span",{style:{fontSize:22}},"🩺"),a.default.createElement("div",null,a.default.createElement("div",{style:{color:z.white,fontWeight:700,fontSize:15,lineHeight:1.2}},"ICD-10 Coding Assistant"),a.default.createElement("div",{style:{color:"rgba(255,255,255,0.75)",fontSize:11}},"AI-powered · Medical coding helper"))),a.default.createElement("button",{onClick:x,style:{background:"rgba(255,255,255,0.2)",border:"1px solid rgba(255,255,255,0.3)",borderRadius:8,color:z.white,cursor:"pointer",fontSize:18,fontWeight:"bold",width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},"×")),a.default.createElement(N,{mode:y,onChange:b})),a.default.createElement("div",{style:{overflowY:"auto",flex:1,padding:"18px 18px 0",display:"flex",flexDirection:"column",gap:14}},a.default.createElement("p",{style:{margin:0,fontSize:13,color:z.muted,lineHeight:1.6}},"Describe a diagnosis, condition, or procedure in plain language and get relevant ICD-10 code suggestions for insurance and billing."),a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},a.default.createElement("label",{style:{fontSize:12,fontWeight:600,color:z.text},htmlFor:"icd10-query"},"Diagnosis / Condition / Procedure"),a.default.createElement("textarea",{id:"icd10-query",ref:o,value:r,onChange:u,onKeyDown:f,placeholder:"e.g. Type 2 diabetes with hypertension, chest pain on exertion, rotator cuff repair…",rows:3,style:{width:"100%",padding:"10px 12px",border:"1.5px solid ".concat(z.border),borderRadius:8,fontSize:13,fontFamily:D,color:z.text,resize:"vertical",outline:"none",boxSizing:"border-box",lineHeight:1.5,transition:"border-color 0.15s"},onFocus:e=>e.target.style.borderColor=z.primary,onBlur:e=>e.target.style.borderColor=z.border}),a.default.createElement("div",{style:{fontSize:11,color:"#aaa",textAlign:"right"}},"Press ",a.default.createElement("kbd",{style:{background:"#f3f4f6",padding:"1px 5px",borderRadius:3,fontFamily:"monospace"}},"⌘ Enter")," to submit")),a.default.createElement("div",{style:{display:"flex",gap:8}},a.default.createElement("button",{onClick:m,disabled:!r.trim()||l,style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,padding:"10px 16px",background:!r.trim()||l?"#d1d5db":"linear-gradient(135deg, ".concat(z.primary," 0%, ").concat(z.primaryDark," 100%)"),color:z.white,border:"none",borderRadius:8,fontSize:13,fontWeight:700,fontFamily:D,cursor:!r.trim()||l?"not-allowed":"pointer",transition:"background 0.15s"}},l?a.default.createElement(a.default.Fragment,null,a.default.createElement(W,null),"Searching codes…"):"🔍 Find ICD-10 Codes"),(r||i)&&a.default.createElement("button",{onClick:g,style:{padding:"10px 14px",background:z.bg,border:"1px solid ".concat(z.border),borderRadius:8,fontSize:13,fontWeight:600,fontFamily:D,color:z.muted,cursor:"pointer"}},"Clear")),d&&a.default.createElement("div",{style:{background:z.errorLight,border:"1px solid #fca5a5",borderRadius:8,padding:"10px 14px",fontSize:13,color:z.error,display:"flex",gap:8}},a.default.createElement("span",null,"⚠️"),a.default.createElement("span",null,d)),i&&a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:10}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8}},a.default.createElement("span",{style:{fontSize:13,fontWeight:700,color:z.text}},"Suggested Codes"),a.default.createElement(T,{color:z.teal,bg:z.tealLight},i.matches.length," match",1!==i.matches.length?"es":"")),i.matches.length>0&&a.default.createElement(A,{text:E,label:"All",copyKey:"copy-all",copiedKey:p,copy:c})),0===i.matches.length&&a.default.createElement("div",{style:{padding:"20px",textAlign:"center",color:z.muted,fontSize:13,background:z.bg,borderRadius:10}},"No matching ICD-10 codes found."),i.matches.map((e,t)=>a.default.createElement(M,{key:t,index:t,match:e,copy:c,copiedKey:p}))),s.length>0&&a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},a.default.createElement("span",{style:{fontSize:11,fontWeight:600,color:"#aaa",textTransform:"uppercase",letterSpacing:"0.5px"}},"Recent searches"),a.default.createElement("div",{style:{display:"flex",gap:6,flexWrap:"wrap"}},s.map((e,t)=>a.default.createElement(R,{key:t,item:e,onClick:h}))))),a.default.createElement("div",{style:{flexShrink:0,padding:"12px 18px",borderTop:"1px solid ".concat(z.border),background:z.bg,fontSize:11,color:"#aaa",lineHeight:1.5,textAlign:"center"}},"⚕️ For reference only. Always verify codes with a certified medical coder. Not a substitute for clinical judgment or official coding guidelines."))}function H(){const[e,n]=t.useState(!1),[o,r]=t.useState("nlm"),[l,i]=t.useState(""),[d,s]=t.useState(!1),[c,p]=t.useState(null),[u,f]=t.useState(null),[m,g]=t.useState([]),x=t.useRef(null),h=t.useRef(null),{copy:y,copiedKey:b}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1800;const[n,o]=t.useState(null),a=t.useCallback(function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{o(n),setTimeout(()=>o(null),e)});else{const a=document.createElement("textarea");a.value=t,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a),o(n),setTimeout(()=>o(null),e)}},[e]);return{copy:a,copiedKey:n}}();t.useEffect(()=>{e&&x.current&&setTimeout(()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.focus()},80)},[e]),t.useEffect(()=>{if(!e)return;const t=e=>{h.current&&!h.current.contains(e.target)&&n(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e]);const E=t.useCallback(async()=>{if(l.trim()&&!d){s(!0),f(null),p(null);try{const e=await I(l.trim(),C.CLAUDE_ONLY);p(e),g(t=>{const n=t.filter(e=>e.query.toLowerCase()!==l.trim().toLowerCase());return[{query:l.trim(),matches:e.matches},...n].slice(0,3)})}catch(e){f(e.message||"Something went wrong. Please try again.")}finally{s(!1)}}},[l,d]),v=t.useCallback(e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),E())},[E]),w=t.useCallback(()=>{var e;i(""),p(null),f(null),null===(e=x.current)||void 0===e||e.focus()},[]),S=t.useCallback(e=>{var t;i(e),p(null),f(null),null===(t=x.current)||void 0===t||t.focus()},[]),F=t.useCallback(e=>i(e.target.value),[]);return a.default.createElement(a.default.Fragment,null,!e&&a.default.createElement(j,{onOpen:()=>n(!0)}),e&&"nlm"===o&&a.default.createElement(P,{panelRef:h,onClose:()=>n(!1),mode:o,onModeChange:r}),e&&"ai"===o&&a.default.createElement(L,{panelRef:h,textareaRef:x,query:l,loading:d,result:c,error:u,history:m,copy:y,copiedKey:b,onQueryChange:F,onKeyDown:v,onSubmit:E,onClear:w,onClose:()=>n(!1),onHistoryClick:S,mode:o,onModeChange:r}))}let B=null;const U={showWidget:(e,t)=>{B||(B=document.createElement("div"),document.body.appendChild(B));const n=()=>a.default.createElement(a.default.Fragment,null,a.default.createElement(F,{config:e}),e.showIcdAssistant&&a.default.createElement(H,null));r.default.render(a.default.createElement(n,null),B)},closePopup:()=>{B&&(r.default.unmountComponentAtNode(B),B=null)}};window.BookingSDK=U,e.AppointmentPage=F,e.ICD10Assistant=H,e.PIH_APPOINTMENT_WIDGET_CLASS=v,e.default=U,Object.defineProperty(e,"__esModule",{value:!0})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MyPackage={},e.React,e.ReactDOM)}(this,function(e,t,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t),r=o(n);function l(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i="https://afiyaapiqa.powermindinc.com",d="/appointment/V1/consultant/all-appointments",s="/notification/V1/consultation/online/initiate",c="https://ittisalqa.powermindinc.com/call?token=",p=async function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=(e||"").toUpperCase();"INPROGRESS"===a&&(a="IN_PROGRESS"),"UPCOMING"===a&&(a="UPCOMING,RESCHEDULED");const r=o.apiBaseUrl,l=o.hospitalId,i=o.doctorId,s=o.token||"",c={hospitalId:l,doctorId:i,fromDate:t,toDate:n,statuses:a,appointmentType:"ONLINE"},p="".concat(r).concat(d),u=await async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=new URL(e);o.search=new URLSearchParams(t).toString();const a={method:"GET",headers:{"Content-Type":"application/json",Authorization:"".concat(n)}};return fetch(o,a).then(async e=>{const t=await e.json().catch(()=>({}));var n;return e.ok?t:{err:(null==t||null===(n=t.resultInfo)||void 0===n?void 0:n.message)||"Something went wrong!",status:e.status}}).catch(e=>(console.error("Fetch error:",e),{err:(null==e?void 0:e.message)||String(e)||"Network error"}))}(p,c,"PIH-Appointment-Widget",s);return u},u=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};console.log("initiateConsultation -> config",t);const n=t.apiBaseUrl.replace(/\/$/,""),o="".concat(n).concat(s),a=t.appToken||"";return async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;const a=new URL(e);Object.keys(n).forEach(e=>{a.searchParams.append(e,n[e])});const r={"Content-Type":"application/json"};o&&(r.Authorization=o);const l={method:"POST",headers:r,body:JSON.stringify(t)};return fetch(a.toString(),l).then(async e=>{const t=await e.json().catch(()=>({}));var n;return e.ok?t:{err:(null==t||null===(n=t.resultInfo)||void 0===n?void 0:n.message)||"Something went wrong!",status:e.status}}).catch(e=>(console.error("Fetch error:",e),{err:e.message||"Network error"}))}(o,{patientId:String(e.patientId||""),primaryPatientId:String(e.primaryPatientId||e.patientId||""),hospitalId:t.hospitalId,doctorId:String(t.doctorId),patientName:e.patientName||e.name||"",doctorName:e.doctorName||t.doctorName,appointmentId:String(e.id||e.appointmentId||e._id||"")},"PIH-Appointment-Widget",{},a)};const f="pih_appointment_idToken",m="pih_appointment_email",g="pih_appointment_appToken",x="pih_appointment_doctorId",h="pih_appointment_userName",y="pih_appointment_apiBaseUrl",b="pih_appointment_hospitalId",E=720,v="pih-appointment-widget",w="data-pih-widget";class S extends t.Component{constructor(){super(...arguments),l(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){"undefined"!=typeof console&&console.error&&console.error("Appointment widget error:",e,t)}render(){return this.state.hasError?a.default.createElement("div",{className:v,[w]:"teleconsult-appointments",style:{fontFamily:'"Nunito", serif',background:"#F5F5F7",boxSizing:"border-box",minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",textAlign:"center"}},a.default.createElement("div",{style:{maxWidth:"400px"}},a.default.createElement("div",{style:{fontSize:"48px",marginBottom:"16px"}},"⚠️"),a.default.createElement("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1a1a1a",margin:"0 0 8px 0"}},"Something went wrong"),a.default.createElement("p",{style:{fontSize:"14px",color:"#666",margin:0,lineHeight:1.5}},"Please refresh the page or try again later."))):this.props.children}}const F=e=>{let{config:n={}}=e;const[o,r]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(y):null}catch(e){return null}}),[l,d]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(b):null}catch(e){return null}}),s=n.apiBaseUrl||o||i,F=n.hospitalId||l,[C,A]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(f):null}catch(e){return null}}),[k,I]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(m):null}catch(e){return null}}),D=n.idToken||n.token||C,z=n.email||k;t.useEffect(()=>{try{if("undefined"==typeof localStorage)return;const e=n.idToken||n.token;if(e&&String(e).trim()){localStorage.getItem(f)!==e&&(M(null),W(null),B(null),K(e=>e+1),localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h)),localStorage.setItem(f,e),A(e)}n.email&&String(n.email).trim()&&(localStorage.setItem(m,n.email),I(n.email)),n.apiBaseUrl&&String(n.apiBaseUrl).trim()&&(localStorage.setItem(y,n.apiBaseUrl.trim()),r(n.apiBaseUrl.trim())),null!=n.hospitalId&&String(n.hospitalId).trim()&&(localStorage.setItem(b,String(n.hospitalId).trim()),d(String(n.hospitalId).trim()))}catch(e){}},[n.idToken,n.token,n.email,n.apiBaseUrl,n.hospitalId]);const[T,M]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(g):null}catch(e){return null}}),[R,W]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(x):null}catch(e){return null}}),[N,B]=t.useState(()=>{try{return"undefined"!=typeof localStorage?localStorage.getItem(h):null}catch(e){return null}}),[H,P]=t.useState(()=>{try{if("undefined"==typeof localStorage)return!1;const e=localStorage.getItem(g),t=localStorage.getItem(f),n=localStorage.getItem(m);return!e&&!(!t||!n)}catch(e){return!1}}),[Q,L]=t.useState(null),[U,j]=t.useState(!1),[Y,K]=t.useState(0);t.useEffect(()=>{T&&H&&P(!1)},[T,H]),t.useEffect(()=>{T||(D&&z?(j(!1),L(e=>"Sign in required. Redirecting to home..."===e?null:e)):(L("Sign in required. Redirecting to home..."),j(!0)))},[T,D,z]),t.useEffect(()=>{if(!U)return;const e=n.homeUrl||"https://afiyaproqa.powermindinc.com/";if(!e||"undefined"==typeof window)return;const t=setTimeout(()=>{window.location.href=e},2500);return()=>clearTimeout(t)},[U,n.homeUrl]),t.useEffect(()=>{if(!H)return;const e=setTimeout(()=>{L("Request timed out. Please try again."),P(!1)},3e4);return()=>clearTimeout(e)},[H]);const q=n.joinCallUrl||c;T&&String(q||"").replace(/\/?$/,"/");const O=function(e){if(!e||"string"!=typeof e)return{};try{const t=e.split(".");if(3!==t.length)return{};const n=t[1].replace(/-/g,"+").replace(/_/g,"/"),o=n.padEnd(n.length+(4-n.length%4)%4,"=");return JSON.parse(atob(o))}catch(e){return{}}}(D),J=N||O.name||O.sub||"User",G=()=>(new Date).toISOString().split("T")[0],X=e=>{const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(o)},[V,Z]=t.useState("upcoming"),[_,$]=t.useState([]),[ee,te]=t.useState(null),[ne,oe]=t.useState(!1),[ae,re]=t.useState(null),[le,ie]=t.useState(window.innerWidth<768),[de,se]=t.useState("today"),[ce,pe]=t.useState("today"),[ue,fe]=t.useState(!1),[me,ge]=t.useState(!1),[xe,he]=t.useState("all"),[ye,be]=t.useState("asc"),[Ee,ve]=t.useState(""),[we,Se]=t.useState(!1),[Fe,Ce]=t.useState(!1),[Ae,ke]=t.useState(!1),[Ie,De]=t.useState(null),[ze,Te]=t.useState(null),[Me,Re]=t.useState(!1),[We,Ne]=t.useState(null),[Be,He]=t.useState(()=>({x:Math.max(20,"undefined"!=typeof window?window.innerWidth-E-20:300),y:80})),[Pe,Qe]=t.useState({width:E,height:560}),[Le,Ue]=t.useState(!1),[je,Ye]=t.useState({x:0,y:0}),[Ke,qe]=t.useState(!1),[Oe,Je]=t.useState(null),[Ge,Xe]=t.useState({x:0,y:0,width:0,height:0});t.useState(!1);const[Ve,Ze]=t.useState(1),_e=_.filter(e=>{if(!Ee.trim())return!0;const t=Ee.toLowerCase(),n=(e.patientName||"").toLowerCase(),o=String(e.patientId||"").toLowerCase();return n.includes(t)||o.includes(t)}),$e=5*(Ve-1),et=$e+5,tt=_e.slice($e,et),nt=Math.ceil(_e.length/5),ot=_e.length,[at,rt]=t.useState(G()),[lt,it]=t.useState(G()),[dt,st]=t.useState(),[ct,pt]=t.useState(),ut=e=>(null==e?void 0:e.id)||(null==e?void 0:e._id)||(null==e?void 0:e.appointmentId)||(null==e?void 0:e.patientId)||JSON.stringify(e),ft=e=>null!=e&&e.image?e.image:null,mt=e=>e?e.charAt(0).toUpperCase():"?",gt=e=>{if(!e)return"#4C4DDC";const t=["#4C4DDC","#1CC3CE","#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F"];return t[e.charCodeAt(0)%t.length]},xt=()=>{const e="asc"===ye?"desc":"asc";be(e);const t=[..._].sort((t,n)=>{const o=new Date(t.appointmentDate||t.date||0),a=new Date(n.appointmentDate||n.date||0);return"asc"===e?o-a:a-o});$(t),Ze(1),t.length>0&&te(t[0])},ht=t.useCallback(async()=>{if(console.log(T,"fetchAppointments -> appToken"),!T)return void(D&&z&&K(e=>e+1));console.log(R,"fetchAppointments -> doctorIdFromLogin");const e=R;oe(!0),re(null);try{const t={apiBaseUrl:s,hospitalId:F,doctorId:e,token:T},n=await p(V,at,lt,t);if(401===n.status||403===n.status){try{"undefined"!=typeof localStorage&&(localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h))}catch(e){}return M(null),W(null),B(null),K(e=>e+1),void re("Session expired. Re-authenticating...")}if(n.err)return void re(String(n.err||"Failed to fetch appointments"));const o=n.data||n.appointments||n||[];$(Array.isArray(o)?o:[]),Array.isArray(o)&&o.length>0?te(o[0]):te(null)}catch(e){console.error("Error fetching appointments:",e),re(e.message||"Failed to fetch appointments")}finally{oe(!1)}},[V,at,lt,xe,s,F,R,T,D,z]),yt=e=>{te(e),Ne(null)},bt=async()=>{if(ee&&T){Re(!0),Ne(null);try{var e;const t={apiBaseUrl:s,hospitalId:F,doctorId:R,doctorName:N||J,appToken:T};console.log(ee,"selectedAppointment"),console.log(t,"callConfig");const o=await u(ee,t);if(console.log(o.status,"response"),401===o.status||403===o.status){try{"undefined"!=typeof localStorage&&(localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h))}catch(e){}return M(null),W(null),B(null),K(e=>e+1),void Ne("Session expired. Re-authenticating...")}if(o.err||null===(e=o.data)||void 0===e||!e.token)return void Ne(String(o.err||"Failed to initiate call"));const a=n.joinCallUrl||c,r=o.data.token?String(a||"").replace(/\/?$/,"")+o.data.token:"";console.log("joinCallUrl",r),De(o.data.token),Te(r||""),Se(!0),Ce(!1),ke(!1),Qe({width:E,height:560}),He({x:Math.max(20,window.innerWidth-E-20),y:80})}catch(e){Ne(e.message||"Failed to initiate call")}finally{Re(!1)}}},Et=()=>{Se(!1),Ce(!1),ke(!1),De(null),Te(null),Ne(null),ht()},vt=()=>{Ae&&ke(!1),Ce(!Fe)},wt=()=>{Fe&&Ce(!1),ke(!Ae)},St=e=>{if(0!==e.button)return;if(e.target.closest("button"))return;e.currentTarget.setPointerCapture&&e.currentTarget.setPointerCapture(e.pointerId),Ue(!0);const t=e.currentTarget.getBoundingClientRect();Ye({x:e.clientX-t.left,y:e.clientY-t.top})},Ft=t.useCallback(e=>{if(!Ae)if(Le){const t=e.clientX-je.x,n=e.clientY-je.y,o=window.innerWidth-Pe.width,a=window.innerHeight-Pe.height;He({x:Math.max(0,Math.min(t,o)),y:Math.max(0,Math.min(n,a))})}else if(Ke){const t=e.clientX-Ge.x,n=e.clientY-Ge.y;let o=Ge.width,a=Ge.height,r=Ge.posX,l=Ge.posY;const i=300,d=250,s=window.innerWidth-40,c=window.innerHeight-100;if("bottom-right"===Oe)o=Math.min(Math.max(Ge.width+t,i),s),a=Math.min(Math.max(Ge.height+n,d),c),r+o>window.innerWidth&&(o=window.innerWidth-r),l+a>window.innerHeight&&(a=window.innerHeight-l);else if("bottom-left"===Oe){o=Math.min(Math.max(Ge.width-t,i),s),r=Math.max(0,Ge.posX+t),0===r&&(o=Ge.posX+Ge.width),a=Math.min(Math.max(Ge.height+n,d),c),l+a>window.innerHeight&&(a=window.innerHeight-l)}else if("top-right"===Oe){o=Math.min(Math.max(Ge.width+t,i),s),r+o>window.innerWidth&&(o=window.innerWidth-r);a=Math.min(Math.max(Ge.height-n,d),c),l=Math.max(0,Ge.posY+n),0===l&&(a=Ge.posY+Ge.height)}else if("top-left"===Oe){o=Math.min(Math.max(Ge.width-t,i),s),r=Math.max(0,Ge.posX+t),0===r&&(o=Ge.posX+Ge.width);a=Math.min(Math.max(Ge.height-n,d),c),l=Math.max(0,Ge.posY+n),0===l&&(a=Ge.posY+Ge.height)}Qe({width:o,height:a}),He({x:r,y:l})}},[Le,Ke,je,Oe,Ge,Be,Pe,Ae]),Ct=()=>{Ue(!1),qe(!1),Je(null)},At=(e,t)=>{t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture&&t.currentTarget.setPointerCapture(t.pointerId),qe(!0),Je(e),Xe({x:t.clientX,y:t.clientY,width:Pe.width,height:Pe.height,posX:Be.x,posY:Be.y})};t.useEffect(()=>{if(!we||Ae)return;const e=()=>{if(!(window.innerWidth<768)){const e=Fe?350:Pe.width,t=Fe?60:Pe.height,n=window.innerWidth-40,o=window.innerHeight-100,a=Math.min(e,n),r=Math.min(t,o);a===Pe.width&&r===Pe.height||Qe({width:a,height:r});const l=window.innerWidth-a-20,i=window.innerHeight-r-20;He(e=>({x:Math.min(e.x,l),y:Math.min(e.y,i)}))}};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[we,Fe,Ae,Pe]),t.useEffect(()=>{if(!(D&&z&&(!T||Y>0)))return;let e=!1;return P(!0),L(null),(async(e,t,n,o)=>{const a=e.replace(/\/$/,""),r="".concat(a,"/um/user/V1/sso/login?hospitalId=").concat(encodeURIComponent(t)),l={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:n,email:o})};return console.log("[getTokenFromSso] request",{url:r,body:{idToken:n?n.slice(0,50)+"...":null,email:o}}),fetch(r,l).then(e=>(console.log("[getTokenFromSso] response status",e.status,e.statusText),e.ok?e.json().then(e=>{var t;return console.log("[getTokenFromSso] success",{hasData:!!e,dataKeys:e?Object.keys(e):[],hasAccessToken:!(null==e||null===(t=e.data)||void 0===t||!t.access_token)}),e}):e.json().then(t=>{var n;const o=(null==t||null===(n=t.resultInfo)||void 0===n?void 0:n.message)||"SSO login failed";return console.log("[getTokenFromSso] error body",t),{err:o,status:e.status}}).catch(()=>({err:"Something went wrong!",status:e.status})))).catch(e=>(console.error("[getTokenFromSso] catch",e),{err:e.message||"Network error"}))})(s,F,D,z).then(t=>{if(e)return;const n=function(e){var t,n,o,a,r,l;return!e||e.err?null:null!==(t=null!==(n=null!==(o=null!==(a=null===(r=e.data)||void 0===r?void 0:r.access_token)&&void 0!==a?a:null===(l=e.data)||void 0===l?void 0:l.token)&&void 0!==o?o:e.token)&&void 0!==n?n:e.accessToken)&&void 0!==t?t:null}(t);if(400===t.status)return L(t.err||"Invalid request. Redirecting to home..."),P(!1),void j(!0);if(t.err||!n){L(String(t.err||"Failed to get token")),M(null),W(null),B(null);try{"undefined"!=typeof localStorage&&(localStorage.removeItem(g),localStorage.removeItem(x),localStorage.removeItem(h))}catch(e){}}else{const e=function(e){var t,n;if(null==e||!e.data)return null;const o=null!==(t=null!==(n=e.data.doctor_id)&&void 0!==n?n:e.data.doctorId)&&void 0!==t?t:null;return console.log(o,"extractDoctorIdFromLoginResponse -> id"),null!=o?String(o):null}(t);console.log(e,"extractDoctorIdFromLoginResponse -> doctorId");const o=function(e){var t,n,o;if(null==e||!e.data)return null;const a=null!==(t=null!==(n=null!==(o=e.data.name)&&void 0!==o?o:e.data.doctor_name)&&void 0!==n?n:e.data.userName)&&void 0!==t?t:null;return null!=a?String(a):null}(t);M(n),W(e),B(o),L(null),j(!1);try{"undefined"!=typeof localStorage&&(localStorage.setItem(g,n),e&&localStorage.setItem(x,e),o&&localStorage.setItem(h,o))}catch(e){}}}).catch(t=>{e||(L((null==t?void 0:t.message)||"Authentication failed. Please try again."),M(null))}).finally(()=>{e||P(!1)}),()=>{e=!0}},[s,F,D,z,Y,T]),t.useEffect(()=>{Ze(1),Ne(null)},[V,de,at,lt,Ee,xe]),t.useEffect(()=>{!H&&T&&ht()},[ht,T,H]),t.useEffect(()=>{const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap",e.rel="stylesheet",document.head.appendChild(e);const t=document.createElement("style");t.innerHTML="\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n \n @media (max-width: 768px) {\n .appointments-grid {\n grid-template-columns: 1.5fr 1fr 0.8fr !important;\n }\n .appointments-header-grid {\n grid-template-columns: 1.5fr 1fr 0.8fr !important;\n }\n .hide-on-mobile {\n display: none !important;\n }\n }\n @media (max-width: 480px) {\n .appointments-header-grid {\n font-size: 10px !important;\n }\n .appointments-grid {\n font-size: 11px !important;\n }\n }\n ",document.head.appendChild(t);const n=()=>{ie(window.innerWidth<768)};return window.addEventListener("resize",n),()=>{document.head.removeChild(e),document.head.removeChild(t),window.removeEventListener("resize",n)}},[]),t.useEffect(()=>{const e=e=>{!ue||e.target.closest("button")||e.target.closest('input[type="date"]')||fe(!1),me&&!e.target.closest("[data-appointment-type-picker]")&&ge(!1)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[ue,me]);let kt='"Nunito", serif';const It=Q||!T&&(!D||!z);let Dt;return Dt=H&&D&&z?a.default.createElement("div",{className:v,[w]:"teleconsult-appointments",style:{fontFamily:kt,background:"#F5F5F7",boxSizing:"border-box",height:"100%",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px"}},a.default.createElement("style",null,"@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }"),a.default.createElement("div",{style:{width:"40px",height:"40px",border:"3px solid #f3f3f3",borderTop:"3px solid #4C4DDC",borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"16px"}}),a.default.createElement("p",{style:{fontSize:"14px",color:"#666",margin:0}},"Checking authorisation...")):a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{className:v,[w]:"teleconsult-appointments",style:{fontFamily:kt,background:"#F5F5F7",boxSizing:"border-box",height:"100%",minHeight:"100vh",width:"100%",display:"flex",flexDirection:"column",overflow:"hidden"}},a.default.createElement("div",{style:{background:"#FFFFFF",padding:le?"10px 12px":"12px 24px",display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #E5E5E5",flexWrap:"nowrap",gap:le?"8px":"0"}},a.default.createElement("div",{style:{position:"relative",width:le?"calc(100% - 90px)":"480px",maxWidth:le?"none":"480px"}},a.default.createElement("input",{type:"text",placeholder:"Search by patient name or ID",value:Ee,onChange:e=>ve(e.target.value),style:{width:"100%",padding:le?"8px 32px 8px 10px":"8px 36px 8px 14px",border:"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"12px":"13px",fontFamily:kt,background:"#FFFFFF",outline:"none",boxSizing:"border-box"}}),Ee&&a.default.createElement("button",{onClick:()=>ve(""),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:"#999",fontSize:"16px"},title:"Clear search"},"✕")),!1),a.default.createElement("div",{style:{padding:le?"12px":"16px 24px",flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"}},a.default.createElement("div",{style:{marginBottom:le?"10px":"14px"}},a.default.createElement("h1",{style:{fontSize:le?"18px":"22px",fontWeight:700,color:"#1a1a1a",margin:"0 0 2px 0"}},"Tele Consultation"),a.default.createElement("p",{style:{fontSize:le?"11px":"12px",color:"#999",margin:0}},"Displaying All Tele Consultation Appointments")),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:le?"flex-start":"center",marginBottom:le?"10px":"14px",flexDirection:le?"column":"row",gap:le?"12px":"0"}},a.default.createElement("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",width:le?"100%":"auto"}},a.default.createElement("button",{onClick:()=>Z("upcoming"),style:{background:"upcoming"===V?"#4C4DDC":"#FFFFFF",padding:le?"8px 10px":"9px 16px",border:"upcoming"===V?"none":"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"10px":"13px",color:"upcoming"===V?"white":"#555555",fontWeight:600,fontFamily:kt,cursor:"pointer",flex:le?"1 1 auto":"none",minWidth:le?"0":"auto",transition:"all 0.3s ease",whiteSpace:"nowrap"}},"Upcoming Appointments"),a.default.createElement("button",{onClick:()=>Z("completed"),style:{background:"completed"===V?"#4C4DDC":"#FFFFFF",padding:le?"8px 10px":"9px 16px",border:"completed"===V?"none":"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"10px":"13px",color:"completed"===V?"white":"#555555",fontWeight:600,fontFamily:kt,cursor:"pointer",flex:le?"1 1 auto":"none",minWidth:le?"0":"auto",transition:"all 0.3s ease",whiteSpace:"nowrap"}},"Completed Appointments"),a.default.createElement("button",{onClick:()=>Z("cancelled"),style:{background:"cancelled"===V?"#4C4DDC":"#FFFFFF",padding:le?"8px 10px":"9px 16px",border:"cancelled"===V?"none":"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"10px":"13px",color:"cancelled"===V?"white":"#555555",fontWeight:600,fontFamily:kt,cursor:"pointer",flex:le?"1 1 auto":"none",minWidth:le?"0":"auto",transition:"all 0.3s ease",whiteSpace:"nowrap"}},"Cancelled Appointments")),a.default.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center",width:"auto",position:"relative",justifyContent:le?"flex-start":"flex-end",flexWrap:"wrap"}},a.default.createElement("button",{onClick:()=>{ue||(st(at),pt(lt),pe(de)),fe(!ue)},style:{padding:"8px 12px",fontFamily:kt,fontWeight:600,border:"1px solid #E5E5E5",borderRadius:"6px",fontSize:le?"11px":"13px",color:"#1a1a1a",background:"#FFFFFF",display:"flex",alignItems:"center",gap:le?"4px":"6px",cursor:"pointer",flex:"none",minWidth:le?"100px":"auto",justifyContent:"center"}},a.default.createElement("svg",{width:le?"12":"14",height:le?"12":"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.default.createElement("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),a.default.createElement("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),a.default.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),a.default.createElement("line",{x1:"3",y1:"10",x2:"21",y2:"10"})),a.default.createElement("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},(()=>{switch(de){case"today":default:return"Today";case"tomorrow":return"Tomorrow";case"currentWeek":return"Current Week";case"thisMonth":return"This Month";case"currentYear":return"Current Year";case"custom":return le?"Custom":"".concat(at," to ").concat(lt)}})()),a.default.createElement("svg",{width:le?"8":"10",height:le?"8":"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},a.default.createElement("polyline",{points:"6 9 12 15 18 9"}))),ue&&a.default.createElement("div",{style:{position:"absolute",top:"100%",right:le?"auto":0,left:le?0:"auto",marginTop:"4px",background:"#FFFFFF",border:"1px solid #E5E5E5",borderRadius:"8px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"8px",zIndex:1e3,minWidth:le?"280px":"240px",width:le?"calc(100vw - 24px)":"auto",maxWidth:le?"calc(100vw - 24px)":"280px"}},a.default.createElement("div",{style:{marginBottom:"custom"===ce?"12px":"0"}},["thisMonth","today","tomorrow","currentWeek","currentYear","custom"].map(e=>a.default.createElement("button",{key:e,onClick:()=>{if(pe(e),"custom"!==e){const t=(e=>{const t=new Date;let n,o;switch(e){case"today":default:n=o=G();break;case"tomorrow":const e=new Date(t);e.setDate(e.getDate()+1),n=o=X(e);break;case"currentWeek":const a=new Date(t),r=new Date(t),l=t.getDay(),i=0===l?-6:1-l;a.setDate(t.getDate()+i),r.setDate(a.getDate()+6),n=X(a),o=X(r);break;case"thisMonth":const d=new Date(t.getFullYear(),t.getMonth(),1),s=new Date(t.getFullYear(),t.getMonth()+1,0);n=X(d),o=X(s);break;case"currentYear":n="".concat(t.getFullYear(),"-01-01"),o="".concat(t.getFullYear(),"-12-31")}return{from:n,to:o}})(e);se(e),rt(t.from),it(t.to),st(t.from),pt(t.to),fe(!1)}else st(""),pt("")},style:{width:"100%",padding:"10px 12px",background:ce===e?"#E8EEF4":"#FFFFFF",border:"none",borderRadius:"4px",fontSize:"13px",fontFamily:kt,cursor:"pointer",textAlign:"left",fontWeight:ce===e?600:400,color:ce===e?"#4C4DDC":"#1a1a1a",marginBottom:"4px",display:"flex",justifyContent:"space-between",alignItems:"center",transition:"all 0.2s ease"},onMouseEnter:t=>{ce!==e&&(t.target.style.background="#F5F5F5")},onMouseLeave:t=>{ce!==e&&(t.target.style.background="#FFFFFF")}},a.default.createElement("span",null,{thisMonth:"This Month",today:"Today",tomorrow:"Tomorrow",currentWeek:"Current Week",currentYear:"Current Year",custom:"Custom"}[e]),ce===e&&a.default.createElement("span",{style:{color:"#4C4DDC",fontSize:"16px"}},"✓")))),"custom"===ce&&a.default.createElement("div",{style:{paddingTop:"8px",borderTop:"1px solid #E5E5E5"}},a.default.createElement("div",{style:{marginBottom:"8px"}},a.default.createElement("input",{type:"date",value:dt,onChange:e=>st(e.target.value),placeholder:"Start Date",style:{width:"100%",padding:"10px 8px",border:"1px solid #E5E5E5",borderRadius:"4px",fontSize:"13px",fontFamily:kt,boxSizing:"border-box",cursor:"pointer"}})),a.default.createElement("div",{style:{marginBottom:"12px"}},a.default.createElement("input",{type:"date",value:ct,onChange:e=>pt(e.target.value),placeholder:"End Date",style:{width:"100%",padding:"10px 8px",border:"1px solid #E5E5E5",borderRadius:"4px",fontSize:"13px",fontFamily:kt,boxSizing:"border-box",cursor:"pointer"}})),a.default.createElement("div",{style:{display:"flex",gap:"8px"}},a.default.createElement("button",{onClick:()=>{pe(de),st(at),pt(lt),fe(!1)},style:{flex:1,padding:"10px 12px",background:"#FFFFFF",color:"#4C4DDC",border:"1px solid #4C4DDC",borderRadius:"4px",fontSize:"13px",fontFamily:kt,fontWeight:600,cursor:"pointer"}},"Cancel"),a.default.createElement("button",{onClick:()=>{dt&&ct&&(se("custom"),rt(dt),it(ct),fe(!1))},style:{flex:1,padding:"10px 12px",background:"#4C4DDC",color:"#FFFFFF",border:"none",borderRadius:"4px",fontSize:"13px",fontFamily:kt,fontWeight:600,cursor:"pointer"}},"Submit")))))),a.default.createElement("div",{style:{display:"flex",flexDirection:le?"column":"row",gap:le?"12px":"14px",flex:1,minHeight:0,overflow:le?"auto":"hidden"}},a.default.createElement("div",{style:{flex:le?"none":"1 1 65%",width:le?"100%":"auto",display:"flex",flexDirection:"column",minHeight:le?"400px":0,maxHeight:le?"none":"100%",overflow:"hidden"}},a.default.createElement("div",{style:{background:"#FFFFFF",borderRadius:"8px",boxShadow:"0 1px 4px rgba(0,0,0,0.08)",overflow:"hidden",display:"flex",flexDirection:"column",flex:le?"none":1,minHeight:le?"auto":0,maxHeight:le?"none":"100%"}},a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:le?"12px 14px":"14px 18px",borderBottom:"1px solid #F1F1F1"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:le?"6px":"8px"}},a.default.createElement("span",{style:{fontSize:le?"14px":"15px",fontWeight:700,color:"#1a1a1a"}},"Appointments"),a.default.createElement("span",{style:{background:"#4C4DDC",color:"#fff",fontSize:le?"10px":"11px",fontWeight:600,padding:le?"2px 7px":"3px 8px",borderRadius:"12px"}},ot))),a.default.createElement("div",{className:"appointments-header-grid",style:{display:"grid",gridTemplateColumns:le?"1.5fr 1fr 0.8fr":"2.5fr 1fr 1.5fr 0.8fr 1.2fr",gap:le?"8px":"12px",padding:le?"8px 12px":"10px 18px",background:"#F5F5F5",fontSize:le?"10px":"12px",fontWeight:600,color:"#666"}},a.default.createElement("div",null,"Patients name"),!le&&a.default.createElement("div",null,"Patient ID"),a.default.createElement("div",{onClick:xt,style:{display:"flex",alignItems:"center",gap:"3px",cursor:"pointer",userSelect:"none"}},"Date",a.default.createElement("span",{style:{opacity:.7,fontSize:"10px"}},"asc"===ye?"▲":"▼")),!le&&a.default.createElement("div",null,"Slot"),!le&&a.default.createElement("div",null,"Doctor")),a.default.createElement("div",{style:{overflowY:"auto",overflowX:"hidden",flex:1,minHeight:0,maxHeight:le?"none":"430px",WebkitOverflowScrolling:"touch"}},H?a.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"40px",color:"#888"}},a.default.createElement("div",{style:{textAlign:"center"}},a.default.createElement("div",{style:{width:"40px",height:"40px",border:"3px solid #f3f3f3",borderTop:"3px solid #4C4DDC",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto 10px"}}),"Getting token...")):ne?a.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"40px",color:"#888"}},a.default.createElement("div",{style:{textAlign:"center"}},a.default.createElement("div",{style:{width:"40px",height:"40px",border:"3px solid #f3f3f3",borderTop:"3px solid #4C4DDC",borderRadius:"50%",animation:"spin 1s linear infinite",margin:"0 auto 10px"}}),"Loading appointments...")):ae?a.default.createElement("div",{style:{padding:"40px",textAlign:"center",color:"#FF0000"}},a.default.createElement("div",{style:{fontSize:"16px",marginBottom:"8px"}},"⚠️ Error"),a.default.createElement("div",{style:{fontSize:"13px"}},ae),a.default.createElement("button",{onClick:ht,style:{marginTop:"16px",padding:"8px 16px",background:"#4C4DDC",color:"white",border:"none",borderRadius:"6px",cursor:"pointer",fontFamily:kt}},"Retry")):0===tt.length?a.default.createElement("div",{style:{padding:"40px",textAlign:"center",color:"#888"}},a.default.createElement("div",{style:{fontSize:"16px",marginBottom:"8px"}},"📋"),a.default.createElement("div",{style:{fontSize:"13px"}},Ee?'No appointments found for "'.concat(Ee,'"'):"No appointments found"),Ee&&a.default.createElement("button",{onClick:()=>ve(""),style:{marginTop:"12px",padding:"6px 12px",background:"#4C4DDC",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontFamily:kt}},"Clear Search")):tt.map(e=>a.default.createElement("div",{key:ut(e),role:"button",tabIndex:0,onClick:()=>yt(e),onKeyDown:t=>"Enter"===t.key&&yt(e),className:"appointments-grid",style:{display:"grid",gridTemplateColumns:le?"1.5fr 1fr 0.8fr":"2.5fr 1fr 1.5fr 0.8fr 1.2fr",gap:le?"8px":"12px",padding:le?"10px 12px":"12px 18px",background:ut(ee)===ut(e)?"#E8EEF4":"#FFFFFF",borderTop:"1px solid #F1F1F1",alignItems:"center",cursor:"pointer",fontSize:le?"11px":"13px"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:le?"8px":"10px"}},ft(e)?a.default.createElement("img",{src:e.image,alt:"",style:{width:le?"32px":"36px",height:le?"32px":"36px",borderRadius:"50%",objectFit:"cover"}}):a.default.createElement("div",{style:{width:le?"32px":"36px",height:le?"32px":"36px",borderRadius:"50%",background:gt(e.patientName),display:"flex",alignItems:"center",justifyContent:"center",color:"#FFFFFF",fontWeight:600,fontSize:le?"14px":"16px"}},mt(e.patientName)),a.default.createElement("div",null,a.default.createElement("div",{style:{fontWeight:600,color:"#1a1a1a",fontSize:le?"11px":"13px"}},e.patientName),a.default.createElement("div",{style:{fontSize:le?"9px":"11px",color:"#888"}},e.email))),!le&&a.default.createElement("div",{style:{color:"#555",fontSize:"12px"}},e.patientId),a.default.createElement("div",{style:{color:"#555",fontSize:le?"10px":"12px"}},(()=>{const t=e.appointmentDate||"",n=t.match(/\s(\d{1,2}:\d{2}(?:\s*(?:AM|PM))?)$/i);return n?a.default.createElement(a.default.Fragment,null,a.default.createElement("div",null,t.slice(0,n.index).trim()),a.default.createElement("div",{style:{fontSize:le?"9px":"11px",color:"#888"}},n[1].trim())):a.default.createElement("div",null,t)})()),!le&&a.default.createElement("div",{style:{color:"#555",fontSize:"12px"}},e.appointmentTime||"-"),!le&&a.default.createElement("div",{style:{color:"#555",fontSize:"12px"}},e.doctorName||e.doctor||"-")))),!ne&&!ae&&tt.length>0&&a.default.createElement("div",{style:{padding:le?"12px 14px":"14px 18px",borderTop:"1px solid #F1F1F1",display:"flex",justifyContent:"space-between",alignItems:"center",background:"#FFFFFF",flexWrap:le?"wrap":"nowrap",gap:le?"10px":"0"}},a.default.createElement("div",{style:{fontSize:le?"11px":"12px",color:"#666"}},"Showing page ",Ve," of ",nt," (",ot," total)"),a.default.createElement("div",{style:{display:"flex",gap:"6px",alignItems:"center"}},a.default.createElement("button",{onClick:()=>Ze(e=>Math.max(1,e-1)),disabled:1===Ve,style:{padding:le?"6px 10px":"6px 12px",border:"1px solid #E5E5E5",borderRadius:"4px",background:1===Ve?"#F5F5F5":"#FFFFFF",color:1===Ve?"#999":"#1a1a1a",fontSize:le?"11px":"12px",fontFamily:kt,fontWeight:600,cursor:1===Ve?"not-allowed":"pointer",opacity:1===Ve?.5:1}},"Previous"),a.default.createElement("div",{style:{display:"flex",gap:"4px"}},[...Array(Math.min(5,nt))].map((e,t)=>{let n;return n=nt<=5||Ve<=3?t+1:Ve>=nt-2?nt-4+t:Ve-2+t,a.default.createElement("button",{key:n,onClick:()=>Ze(n),style:{padding:le?"6px 10px":"6px 12px",border:Ve===n?"none":"1px solid #E5E5E5",borderRadius:"4px",background:Ve===n?"#4C4DDC":"#FFFFFF",color:Ve===n?"#FFFFFF":"#1a1a1a",fontSize:le?"11px":"12px",fontFamily:kt,fontWeight:600,cursor:"pointer",minWidth:le?"32px":"36px"}},n)})),a.default.createElement("button",{onClick:()=>Ze(e=>Math.min(nt,e+1)),disabled:Ve===nt,style:{padding:le?"6px 10px":"6px 12px",border:"1px solid #E5E5E5",borderRadius:"4px",background:Ve===nt?"#F5F5F5":"#FFFFFF",color:Ve===nt?"#999":"#1a1a1a",fontSize:le?"11px":"12px",fontFamily:kt,fontWeight:600,cursor:Ve===nt?"not-allowed":"pointer",opacity:Ve===nt?.5:1}},"Next"))))),a.default.createElement("div",{style:{flex:le?"none":"1 1 35%",width:le?"100%":"auto",display:ee||!le?"flex":"none",flexDirection:"column",minHeight:le?"auto":0}},a.default.createElement("div",{style:{border:"1px solid #E5E5E5",borderRadius:"8px",overflow:"hidden",background:"#FFFFFF",boxShadow:"0 1px 4px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",flex:le?"none":1,minHeight:le?"auto":0}},ee?a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:le?"12px 14px":"16px 18px",background:"#E8EEF4",borderBottom:"1px solid #E5E5E5"}},a.default.createElement("div",null,a.default.createElement("div",{style:{color:"#002668",fontSize:le?"14px":"16px",fontWeight:"700"}},ee.patientName||"N/A"),a.default.createElement("div",{style:{color:"#002668",fontSize:le?"11px":"13px"}},ee.patientId||ee.mrn||"N/A")),a.default.createElement("div",null,ft(ee)?a.default.createElement("img",{style:{width:le?"36px":"44px",height:le?"36px":"44px",borderRadius:"50%",objectFit:"cover"},src:ee.image,alt:ee.patientName}):a.default.createElement("div",{style:{width:le?"36px":"44px",height:le?"36px":"44px",borderRadius:"50%",background:gt(ee.patientName),display:"flex",alignItems:"center",justifyContent:"center",color:"#FFFFFF",fontWeight:700,fontSize:le?"16px":"20px"}},mt(ee.patientName)))),a.default.createElement("div",{style:{padding:le?"12px 14px":"14px 18px",gap:le?"10px":"12px",display:"flex",flexDirection:"column",background:"white",overflow:"auto",flex:1,position:"relative"}},a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Speciality"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.specialisation)||(null==ee?void 0:ee.speciality)||"N/A")),a.default.createElement("div",{style:{textAlign:"right"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Appointment Type"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.type)||(null==ee?void 0:ee.appointmentType)||"Online"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Appointment Date"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.date)||(null==ee?void 0:ee.appointmentDate)||"N/A")),a.default.createElement("div",{style:{textAlign:"right"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Appointment Time"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.time)||(null==ee?void 0:ee.appointmentTime)||"N/A"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Doctor"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.doctor)||(null==ee?void 0:ee.doctorName)||"N/A"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Hospital"),a.default.createElement("div",{style:{fontWeight:"700",fontSize:le?"12px":"13px"}},(null==ee?void 0:ee.hospital)||(null==ee?void 0:ee.hospitalName)||"N/A"))),a.default.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},a.default.createElement("div",{style:{textAlign:"left"}},a.default.createElement("div",{style:{fontSize:le?"10px":"11px",color:"#888",marginBottom:"3px"}},"Reason for Appointment"),a.default.createElement("div",{style:{fontWeight:"600",fontSize:le?"11px":"12px",lineHeight:"1.4"}},(null==ee?void 0:ee.reason)||(null==ee?void 0:ee.reasonForAppointment)||"No reason provided"))),("upcoming"===V||"completed"===V&&(e=>{const t=(null==e?void 0:e.date)||(null==e?void 0:e.appointmentDate),n=(null==e?void 0:e.time)||(null==e?void 0:e.appointmentTime);if(!t||!n)return!1;try{const e=String(n).trim().match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/i);let o,a;if(e){o=parseInt(e[1],10),a=parseInt(e[2],10);const t=e[3].toUpperCase();"AM"===t&&12===o&&(o=0),"PM"===t&&12!==o&&(o+=12)}else{const e=String(n).trim().split(":");o=parseInt(e[0],10),a=parseInt(e[1],10)}if(isNaN(o)||isNaN(a))return!1;const r=new Date("".concat(t," ").concat(String(o).padStart(2,"0"),":").concat(String(a).padStart(2,"0"),":00"));if(isNaN(r.getTime()))return!1;const l=new Date(r.getTime()+72e5);return new Date<=l}catch(e){return!1}})(ee))&&a.default.createElement("div",{style:{display:"flex",flexDirection:le?"column":"row",gap:"6px",marginTop:"10px"}},a.default.createElement("button",{type:"button",onClick:Me?void 0:bt,disabled:Me,style:{flex:1,background:Me?"#99e4e8":"#1CC3CE",color:"#FFFFFF",border:"1px solid #1CC3CE",borderRadius:"6px",padding:le?"10px 8px":"8px 6px",fontFamily:kt,fontWeight:600,fontSize:le?"11px":"12px",cursor:Me?"not-allowed":"pointer"}},Me?"Connecting...":"Join Call >")),("upcoming"===V||"completed"===V)&&We&&a.default.createElement("div",{style:{fontSize:"11px",color:"#e53935",marginTop:"6px",textAlign:"center",width:"100%"}},"⚠️ ",We))):a.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",padding:"40px",color:"#888",textAlign:"center"}},a.default.createElement("div",null,a.default.createElement("div",{style:{fontSize:"16px",marginBottom:"8px"}},"📋"),a.default.createElement("div",{style:{fontSize:"13px"}},"Select an appointment to view details"))))))),we&&a.default.createElement("div",{style:{position:"fixed",left:Ae?"0":le?"10px":"".concat(Be.x,"px"),top:Ae?"0":le?"70px":"".concat(Be.y,"px"),right:Ae?"0":le?"10px":"auto",bottom:Ae?"0":"auto",width:Ae?"100vw":le?"calc(100vw - 20px)":Fe?"350px":"".concat(Pe.width,"px"),height:Ae?"100vh":Fe?"auto":le?"300px":"".concat(Pe.height,"px"),background:"#FFFFFF",borderRadius:Ae?"0":"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",zIndex:1e5,overflow:"hidden",display:"flex",flexDirection:"column",transition:Le||Ke?"none":"all 0.3s ease"}},a.default.createElement("div",{onPointerDown:le||Ae?void 0:St,onPointerMove:le||Ae?void 0:Ft,onPointerUp:le||Ae?void 0:Ct,onPointerCancel:le||Ae?void 0:Ct,style:{background:"linear-gradient(135deg, #4C4DDC 0%, #3A3BBD 100%)",color:"#FFFFFF",padding:le?"8px 10px":"10px 12px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:le||Ae?"default":"move",userSelect:"none"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:le?"6px":"8px",flex:1,minWidth:0}},a.default.createElement("div",{style:{width:le?"6px":"8px",height:le?"6px":"8px",borderRadius:"50%",background:"#FF4444",animation:"pulse 2s infinite",flexShrink:0}}),a.default.createElement("span",{style:{fontSize:le?"11px":"13px",fontWeight:600,fontFamily:kt,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},"Video Call - ",(null==ee?void 0:ee.patientName)||"Patient")),a.default.createElement("div",{style:{display:"flex",gap:le?"4px":"6px",alignItems:"center",flexShrink:0}},a.default.createElement("button",{onClick:vt,style:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"6px",color:"#FFFFFF",cursor:"pointer",padding:le?"5px 8px":"6px 10px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",minWidth:le?"28px":"32px",height:le?"28px":"32px",transition:"background 0.2s ease"},onMouseEnter:e=>e.target.style.background="rgba(255, 255, 255, 0.3)",onMouseLeave:e=>e.target.style.background="rgba(255, 255, 255, 0.2)",title:Fe?"Restore":"Minimize"},Fe?a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("rect",{x:"3",y:"3",width:"10",height:"10",stroke:"white",strokeWidth:"1.8",fill:"none"})):a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round"}))),a.default.createElement("button",{onClick:wt,style:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"6px",color:"#FFFFFF",cursor:"pointer",padding:le?"5px 8px":"6px 10px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",minWidth:le?"28px":"32px",height:le?"28px":"32px",transition:"background 0.2s ease"},onMouseEnter:e=>e.target.style.background="rgba(255, 255, 255, 0.3)",onMouseLeave:e=>e.target.style.background="rgba(255, 255, 255, 0.2)",title:Ae?"Exit Fullscreen":"Fullscreen"},Ae?a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("path",{d:"M10 3H13V6M6 13H3V10M13 10V13H10M3 6V3H6",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})):a.default.createElement("svg",{width:le?"14":"16",height:le?"14":"16",viewBox:"0 0 16 16",fill:"none"},a.default.createElement("path",{d:"M3 6V3H6M13 10V13H10M10 3H13V6M6 13H3V10",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}))),a.default.createElement("button",{onClick:Et,style:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"6px",color:"#FFFFFF",cursor:"pointer",padding:le?"5px 8px":"6px 10px",lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",minWidth:le?"28px":"32px",height:le?"28px":"32px",fontWeight:"bold",fontSize:le?"18px":"22px",transition:"background 0.2s ease"},onMouseEnter:e=>e.target.style.background="rgba(255, 255, 255, 0.3)",onMouseLeave:e=>e.target.style.background="rgba(255, 255, 255, 0.2)",title:"Close"},"×"))),a.default.createElement("div",{style:{flex:1,background:"#000000",position:"relative",display:Fe?"none":"flex",flexDirection:"column"}},a.default.createElement("iframe",{src:(()=>{if(!Ie)return"";const e=String(q||"");return"".concat(e).concat(Ie)})(),style:{width:"100%",height:"100%",border:"none",flex:1},allow:"camera; microphone; display-capture; autoplay",allowFullScreen:!0,title:"Video Call"})),!le&&!Ae&&!Fe&&a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{onPointerDown:e=>At("top-left",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",left:0,top:0,width:"16px",height:"16px",cursor:"nwse-resize",background:"transparent",zIndex:10001}}),a.default.createElement("div",{onPointerDown:e=>At("top-right",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",right:0,top:0,width:"16px",height:"16px",cursor:"nesw-resize",background:"transparent",zIndex:10001}}),a.default.createElement("div",{onPointerDown:e=>At("bottom-left",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",left:0,bottom:0,width:"16px",height:"16px",cursor:"nesw-resize",background:"transparent",zIndex:10001}}),a.default.createElement("div",{onPointerDown:e=>At("bottom-right",e),onPointerMove:Ft,onPointerUp:Ct,onPointerCancel:Ct,style:{position:"absolute",right:0,bottom:0,width:"16px",height:"16px",cursor:"nwse-resize",background:"transparent",zIndex:10001}})),a.default.createElement("style",null,"\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n "))),It&&a.default.createElement("div",{style:{position:"fixed",inset:0,zIndex:1e5,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(0,0,0,0.4)",boxSizing:"border-box"}},a.default.createElement("div",{style:{fontFamily:kt,maxWidth:"400px",width:"100%",padding:"32px 24px",background:"#FFFFFF",borderRadius:"12px",boxShadow:"0 8px 32px rgba(0,0,0,0.2)",textAlign:"center"}},a.default.createElement("div",{style:{fontSize:"48px",marginBottom:"16px"}},"🔒"),a.default.createElement("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1a1a1a",margin:"0 0 8px 0"}},"Access Denied"),a.default.createElement("p",{style:{fontSize:"14px",color:"#666",margin:0,lineHeight:1.5}},"You do not have permission to access Afiya Pro. Please contact administrator for assistance.")))),a.default.createElement(S,null,Dt)},C=Object.freeze({ICD_ONLY:"ICD_ONLY",CLAUDE_ONLY:"CLAUDE_ONLY",AUTO:"AUTO"}),A="".concat(i,"/insurance/api/icd/suggest");async function k(e,t){var n;if(!e||!e.trim())throw new Error("Query cannot be empty");const o=await fetch(A,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e.trim(),mode:t})});if(!o.ok){var a;const e=await o.json().catch(()=>({})),t=(null==e?void 0:e.message)||(null==e||null===(a=e.error)||void 0===a?void 0:a.message)||"API error: ".concat(o.status," ").concat(o.statusText);throw new Error(t)}const r=await o.json(),l=null!==(n=null==r?void 0:r.data)&&void 0!==n?n:r;if(Array.isArray(null==l?void 0:l.matches))return{matches:l.matches,note:l.note||""};if(Array.isArray(l))return{matches:l,note:""};if(Array.isArray(null==l?void 0:l.results))return{matches:l.results.map(e=>({code:e.code,description:e.description||e.name||"",reason:e.reason||""})),note:l.note||""};throw new Error("Unexpected response format from ICD suggest API")}const I="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADsQAAA7EB9YPtSQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAB67SURBVHic7X15nBXVmfbznqp7b680jbIJIsY9LuPCB4rL4BLXRGMUjMQ1Jpo4mm8SxlE0iR1j9HOJQTT5DN/kc7KZKJM4aDSMohglLhFRRhFQVEQFItI0fbe+t6rOM39U1b11t6a770onD7+ibtf6nvM+533fs5aggcC3T/w0tPpXACfA0WPgMAqtV8Lmr9Erv5Tjn7HrItfyE/aCYV8FwzgNhkyGUn1QshrAQmy05tdLrkpA6i2ADy4/IoT2Ue8DGA8ScAho7e4dDTj6DdjO2TL9hXU1leulo6+BUjfDVGEoAQwFKAUYXtYJr5F9l9xZS5kqCVVvATJob+8AMB4AQO8/AmBmfxCIP3PZEZNqJRKfO/JGOLwdZDgrR0A2AKDsXyt5qoGGIYDs98wnAF4GEFR6dq8BkGNgq5/XQh4umXoUNG/M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hAZaqLSX4wkJKeX0vIqebtIPLXDl9s7XburHd6GwkNYQEA4JRnFx/uiDxHsqWS/j5zHFwvYk9ffc4Vm+qd1kZCwxAAAE58bvGpWusHSY6okL/3qnx6va3xmXdmfaUma+/tTGgIF+DjqWNPXQxHTSf5Tr9mv7/6feEw7WVKnOl/V35xNBQBAGDpCaeuSqfMqdD8CUlryP5e67imnjt+9IfH/93sl0ZDuYB8THviP/YRqptAfkFThwfk78FtJO+nhR+uPf+yjfVOQ6OjoQngY+qS3+8Cy/qsQ308tRxErSdr6g6SNsEerfU6ar1CQ5bYLdEn1p0+vD/yUEn8D1aIYwK+QEZVAAAAAElFTkSuQmCC",D="💡",z="🕐",T="⚕️",M='"Nunito", sans-serif',R={primary:"#4C4DDC",primaryDark:"#3A3BBD",primaryLight:"#E8EEF4",teal:"#1CC3CE",tealLight:"#E0F8F9",success:"#16a34a",successLight:"#dcfce7",error:"#dc2626",errorLight:"#fee2e2",warn:"#d97706",warnLight:"#fef3c7",text:"#1a1a1a",muted:"#666",border:"#E5E5E5",bg:"#F5F5F7",white:"#FFFFFF"};function W(e){let{children:t,color:n=R.primary,bg:o=R.primaryLight}=e;return a.default.createElement("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 10px",borderRadius:"999px",fontSize:"12px",fontWeight:700,color:n,background:o,letterSpacing:"0.5px"}},t)}function N(){return a.default.createElement(a.default.Fragment,null,a.default.createElement("style",null,"@keyframes icd-spin{to{transform:rotate(360deg)}}"),a.default.createElement("div",{style:{width:20,height:20,border:"2.5px solid #d1d5db",borderTop:"2.5px solid ".concat(R.primary),borderRadius:"50%",animation:"icd-spin 0.8s linear infinite",flexShrink:0}}))}function B(e){let{text:t,label:n="Copy",copyKey:o,copiedKey:r,copy:l}=e;const i=r===o;return a.default.createElement("button",{onClick:()=>l(t,o),title:i?"Copied!":"Copy ".concat(n),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",fontSize:11,fontWeight:600,fontFamily:M,border:"1px solid ".concat(i?R.success:R.border),borderRadius:5,background:i?R.successLight:R.white,color:i?R.success:R.muted,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"}},i?"✓ Copied":"⎘ ".concat(n))}function H(e){let{match:t,index:n,copy:o,copiedKey:r}=e;const l="card-".concat(n),i="".concat(t.code," — ").concat(t.description).concat(t.reason?"\nNote: ".concat(t.reason):"");return a.default.createElement("div",{style:{border:"1px solid ".concat(R.border),borderRadius:10,padding:"14px 16px",background:R.white,display:"flex",flexDirection:"column",gap:6,boxShadow:"0 1px 4px rgba(0,0,0,0.06)"}},a.default.createElement("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"}},a.default.createElement(W,{color:R.primary,bg:R.primaryLight},t.code),a.default.createElement("span",{style:{fontSize:13,fontWeight:600,color:R.text,lineHeight:1.4}},t.description)),a.default.createElement(B,{text:i,label:t.code,copyKey:l,copiedKey:r,copy:o})),t.reason&&a.default.createElement("p",{style:{margin:0,fontSize:12,color:R.muted,lineHeight:1.5,paddingLeft:2}},D," ",t.reason))}function P(e){let{item:t,onClick:n}=e;return a.default.createElement("button",{onClick:()=>n(t.query),title:"Re-run: ".concat(t.query),style:{padding:"4px 10px",border:"1px solid ".concat(R.border),borderRadius:999,fontSize:11,fontFamily:M,color:R.muted,background:R.white,cursor:"pointer",maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",transition:"border-color 0.15s"},onMouseEnter:e=>e.currentTarget.style.borderColor=R.primary,onMouseLeave:e=>e.currentTarget.style.borderColor=R.border},z," ",t.query)}function Q(e){let{mode:t,onChange:n}=e;const o=(e,o,r)=>a.default.createElement("button",{onClick:()=>n(e),style:{flex:1,padding:"6px 0",border:"none",borderRadius:6,fontSize:12,fontWeight:700,fontFamily:M,cursor:"pointer",transition:"all 0.15s",background:t===e?R.white:"transparent",color:t===e?R.primary:"rgba(255,255,255,0.7)",boxShadow:t===e?"0 1px 4px rgba(0,0,0,0.15)":"none",display:"flex",alignItems:"center",justifyContent:"center",gap:5}},a.default.createElement("span",null,r)," ",o);return a.default.createElement("div",{style:{display:"flex",background:"rgba(255,255,255,0.15)",borderRadius:8,padding:3,gap:2,marginTop:10}},o("nlm","Quick Lookup",""),o("ai","AI Suggest",""))}function L(e){let{panelRef:n,onClose:o,mode:r,onModeChange:l}=e;const[i,d]=t.useState(""),[s,c]=t.useState([]),[p,u]=t.useState(""),[f,m]=t.useState(""),g=t.useRef(null),x=t.useRef(null);t.useEffect(()=>{setTimeout(()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.focus()},80)},[]);const h=t.useCallback(async e=>{if(e.length<2)return c([]),void u("");u("Searching…");try{const t=((await k(e,C.ICD_ONLY)).matches||[]).map(e=>[e.code,e.description]);c(t),u(0===t.length?"No matching codes found.":"Showing ".concat(t.length," result").concat(1!==t.length?"s":""))}catch(e){u(e.message||"Could not fetch results. Check your connection."),c([])}},[]);return a.default.createElement("div",{ref:n,style:{position:"fixed",bottom:28,right:28,zIndex:99999,width:"min(480px, calc(100vw - 32px))",maxHeight:"calc(100vh - 56px)",display:"flex",flexDirection:"column",background:R.white,borderRadius:16,boxShadow:"0 12px 48px rgba(0,0,0,0.18)",fontFamily:M,overflow:"hidden",animation:"icd-slide-in 0.2s ease"}},a.default.createElement("style",null,"@keyframes icd-slide-in{from{opacity:0;transform:translateY(20px) scale(0.97)}to{opacity:1;transform:translateY(0) scale(1)}}"),a.default.createElement("div",{style:{background:"linear-gradient(135deg, ".concat(R.primary," 0%, ").concat(R.teal," 100%)"),padding:"14px 18px",flexShrink:0}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:10}},a.default.createElement("img",{src:I,alt:"ICD-10",style:{width:32,height:32,objectFit:"contain"}}),a.default.createElement("div",null,a.default.createElement("div",{style:{color:R.white,fontWeight:700,fontSize:15,lineHeight:1.2}},"ICD-10 Coding Assistant"),a.default.createElement("div",{style:{color:"rgba(255,255,255,0.75)",fontSize:11}},"Quick ICD-10 lookup"))),a.default.createElement("button",{onClick:o,style:{background:"rgba(255,255,255,0.2)",border:"1px solid rgba(255,255,255,0.3)",borderRadius:8,color:R.white,cursor:"pointer",fontSize:18,fontWeight:"bold",width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"}},"×")),a.default.createElement(Q,{mode:r,onChange:l})),a.default.createElement("div",{style:{flex:1,overflowY:"auto",padding:"16px 18px",display:"flex",flexDirection:"column",gap:10}},a.default.createElement("input",{ref:x,type:"text",value:i,onChange:e=>{const t=e.target.value;d(t),clearTimeout(g.current),g.current=setTimeout(()=>h(t.trim()),300)},placeholder:"Type a diagnosis, e.g. diabetes, hypertension…",style:{width:"100%",padding:"10px 14px",fontSize:14,fontFamily:M,border:"1.5px solid ".concat(R.border),borderRadius:8,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"},onFocus:e=>e.target.style.borderColor=R.primary,onBlur:e=>e.target.style.borderColor=R.border}),a.default.createElement("p",{style:{margin:0,fontSize:11,color:"#aaa",lineHeight:1.6,borderLeft:"3px solid ".concat(R.border),paddingLeft:8}},a.default.createElement("strong",null,"Note:")," Use short, specific keywords for better results, or try"," ",a.default.createElement("button",{onClick:()=>l("ai"),style:{background:"none",border:"none",padding:0,color:R.primary,fontWeight:700,fontSize:11,cursor:"pointer",textDecoration:"underline",fontFamily:M}},"AI Suggest")," ","for broader symptom-based recommendations."),p&&s.length>0&&a.default.createElement("p",{style:{margin:0,fontSize:12,color:R.muted}},p),"No matching codes found."===p&&0===s.length&&a.default.createElement("div",{style:{background:R.warnLight,border:"1px solid #fcd34d",borderRadius:10,padding:"14px 16px",display:"flex",gap:10,alignItems:"flex-start"}},a.default.createElement("span",{style:{fontSize:18,flexShrink:0}},"🔍"),a.default.createElement("div",null,a.default.createElement("p",{style:{margin:"0 0 4px",fontSize:13,fontWeight:700,color:R.warn}},"No results found"),a.default.createElement("p",{style:{margin:0,fontSize:12,color:R.warn,lineHeight:1.6}},"We couldn't find a match. Try using more accurate keywords or switch to"," ",a.default.createElement("button",{onClick:()=>l("ai"),style:{background:"none",border:"none",padding:0,color:R.primary,fontWeight:700,fontSize:12,cursor:"pointer",textDecoration:"underline",fontFamily:M}},"AI Suggest")," ","for better results."))),a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},s.map(e=>{let[t,n]=e;return a.default.createElement("div",{key:t,onClick:()=>(e=>{navigator.clipboard.writeText(e).then(()=>{m(e),setTimeout(()=>m(""),2e3)})})(t),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 14px",border:"1px solid ".concat(R.border),borderRadius:8,cursor:"pointer",background:R.white,transition:"background 0.1s"},onMouseEnter:e=>e.currentTarget.style.background=R.bg,onMouseLeave:e=>e.currentTarget.style.background=R.white},a.default.createElement("span",{style:{fontFamily:"monospace",fontSize:12,background:R.primaryLight,color:R.primary,padding:"3px 8px",borderRadius:6,whiteSpace:"nowrap",fontWeight:700}},t),a.default.createElement("span",{style:{fontSize:13,flex:1,color:R.text}},n),a.default.createElement("span",{style:{fontSize:11,color:f===t?R.success:R.muted,fontWeight:f===t?700:400}},f===t?"✓ copied":"copy"))}))),a.default.createElement("div",{style:{flexShrink:0,padding:"10px 18px",borderTop:"1px solid ".concat(R.border),background:R.bg,fontSize:11,color:"#aaa",textAlign:"center"}},T," For reference only. Always verify codes with a certified medical coder."))}function U(e){let{onOpen:t}=e;return a.default.createElement("button",{onClick:t,title:"ICD-10 Coding Assistant",style:{position:"fixed",bottom:28,right:28,zIndex:99998,display:"flex",alignItems:"center",gap:8,padding:"10px 18px",borderRadius:999,border:"none",background:"linear-gradient(135deg, ".concat(R.primary," 0%, ").concat(R.teal," 100%)"),color:R.white,fontFamily:M,fontWeight:700,fontSize:13,cursor:"pointer",boxShadow:"0 4px 16px rgba(76,77,220,0.35)",transition:"transform 0.15s ease, box-shadow 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 8px 24px rgba(76,77,220,0.4)"},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 4px 16px rgba(76,77,220,0.35)"}},a.default.createElement("img",{src:I,alt:"ICD-10",style:{width:22,height:22,objectFit:"contain"}}),"ICD-10 Assistant")}function j(e){var t;let{panelRef:n,textareaRef:o,query:r,loading:l,result:i,error:d,history:s,copy:c,copiedKey:p,onQueryChange:u,onKeyDown:f,onSubmit:m,onClear:g,onClose:x,onHistoryClick:h,mode:y,onModeChange:b}=e;const E=(null==i||null===(t=i.matches)||void 0===t?void 0:t.map(e=>"".concat(e.code," — ").concat(e.description)).join("\n"))||"";return a.default.createElement("div",{style:{position:"fixed",bottom:28,right:28,zIndex:99999,width:"min(480px, calc(100vw - 32px))",maxHeight:"calc(100vh - 56px)",display:"flex",flexDirection:"column",background:R.white,borderRadius:16,boxShadow:"0 12px 48px rgba(0,0,0,0.18)",fontFamily:M,overflow:"hidden",animation:"icd-slide-in 0.2s ease"},ref:n},a.default.createElement("style",null,"\n @keyframes icd-slide-in {\n from { opacity: 0; transform: translateY(20px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n "),a.default.createElement("div",{style:{background:"linear-gradient(135deg, ".concat(R.primary," 0%, ").concat(R.teal," 100%)"),padding:"14px 18px",flexShrink:0}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:10}},a.default.createElement("img",{src:I,alt:"ICD-10",style:{width:32,height:32,objectFit:"contain"}}),a.default.createElement("div",null,a.default.createElement("div",{style:{color:R.white,fontWeight:700,fontSize:15,lineHeight:1.2}},"ICD-10 Coding Assistant"),a.default.createElement("div",{style:{color:"rgba(255,255,255,0.75)",fontSize:11}},"AI-powered · Medical coding helper"))),a.default.createElement("button",{onClick:x,style:{background:"rgba(255,255,255,0.2)",border:"1px solid rgba(255,255,255,0.3)",borderRadius:8,color:R.white,cursor:"pointer",fontSize:18,fontWeight:"bold",width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},"×")),a.default.createElement(Q,{mode:y,onChange:b})),a.default.createElement("div",{style:{overflowY:"auto",flex:1,padding:"18px 18px 0",display:"flex",flexDirection:"column",gap:14}},a.default.createElement("p",{style:{margin:0,fontSize:13,color:R.muted,lineHeight:1.6}},"Describe a diagnosis, condition, or procedure in plain language and get relevant ICD-10 code suggestions for insurance and billing."),a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},a.default.createElement("label",{style:{fontSize:12,fontWeight:600,color:R.text},htmlFor:"icd10-query"},"Diagnosis / Condition / Procedure"),a.default.createElement("textarea",{id:"icd10-query",ref:o,value:r,onChange:u,onKeyDown:f,placeholder:"e.g. Type 2 diabetes with hypertension, chest pain on exertion, rotator cuff repair…",rows:3,style:{width:"100%",padding:"10px 12px",border:"1.5px solid ".concat(R.border),borderRadius:8,fontSize:13,fontFamily:M,color:R.text,resize:"vertical",outline:"none",boxSizing:"border-box",lineHeight:1.5,transition:"border-color 0.15s"},onFocus:e=>e.target.style.borderColor=R.primary,onBlur:e=>e.target.style.borderColor=R.border}),a.default.createElement("div",{style:{fontSize:11,color:"#aaa",textAlign:"right"}},"Press ",a.default.createElement("kbd",{style:{background:"#f3f4f6",padding:"1px 5px",borderRadius:3,fontFamily:"monospace"}},"Enter")," to submit · ",a.default.createElement("kbd",{style:{background:"#f3f4f6",padding:"1px 5px",borderRadius:3,fontFamily:"monospace"}},"Shift+Enter")," for new line")),a.default.createElement("div",{style:{display:"flex",gap:8}},a.default.createElement("button",{onClick:m,disabled:!r.trim()||l,style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,padding:"10px 16px",background:!r.trim()||l?"#d1d5db":"linear-gradient(135deg, ".concat(R.primary," 0%, ").concat(R.primaryDark," 100%)"),color:R.white,border:"none",borderRadius:8,fontSize:13,fontWeight:700,fontFamily:M,cursor:!r.trim()||l?"not-allowed":"pointer",transition:"background 0.15s"}},l?a.default.createElement(a.default.Fragment,null,a.default.createElement(N,null),"Searching codes…"):"Find ICD-10 Codes"),(r||i)&&a.default.createElement("button",{onClick:g,style:{padding:"10px 14px",background:R.bg,border:"1px solid ".concat(R.border),borderRadius:8,fontSize:13,fontWeight:600,fontFamily:M,color:R.muted,cursor:"pointer"}},"Clear")),d&&a.default.createElement("div",{style:{background:R.errorLight,border:"1px solid #fca5a5",borderRadius:8,padding:"10px 14px",fontSize:13,color:R.error,display:"flex",gap:8}},a.default.createElement("span",null,"⚠️"),a.default.createElement("span",null,d)),i&&a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:10}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},a.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8}},a.default.createElement("span",{style:{fontSize:13,fontWeight:700,color:R.text}},"Suggested Codes"),a.default.createElement(W,{color:R.teal,bg:R.tealLight},i.matches.length," match",1!==i.matches.length?"es":"")),i.matches.length>0&&a.default.createElement(B,{text:E,label:"All",copyKey:"copy-all",copiedKey:p,copy:c})),0===i.matches.length&&a.default.createElement("div",{style:{padding:"20px",textAlign:"center",color:R.muted,fontSize:13,background:R.bg,borderRadius:10}},"No matching ICD-10 codes found."),i.matches.map((e,t)=>a.default.createElement(H,{key:t,index:t,match:e,copy:c,copiedKey:p}))),s.length>0&&a.default.createElement("div",{style:{display:"flex",flexDirection:"column",gap:6}},a.default.createElement("span",{style:{fontSize:11,fontWeight:600,color:"#aaa",textTransform:"uppercase",letterSpacing:"0.5px"}},"Recent searches"),a.default.createElement("div",{style:{display:"flex",gap:6,flexWrap:"wrap"}},s.map((e,t)=>a.default.createElement(P,{key:t,item:e,onClick:h}))))),a.default.createElement("div",{style:{flexShrink:0,padding:"12px 18px",borderTop:"1px solid ".concat(R.border),background:R.bg,fontSize:11,color:"#aaa",lineHeight:1.5,textAlign:"center"}},T," For reference only. Always verify codes with a certified medical coder. Not a substitute for clinical judgment or official coding guidelines."))}function Y(){const[e,n]=t.useState(!1),[o,r]=t.useState("nlm"),[l,i]=t.useState(""),[d,s]=t.useState(!1),[c,p]=t.useState(null),[u,f]=t.useState(null),[m,g]=t.useState([]),x=t.useRef(null),h=t.useRef(null),{copy:y,copiedKey:b}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1800;const[n,o]=t.useState(null),a=t.useCallback(function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";if(navigator.clipboard)navigator.clipboard.writeText(t).then(()=>{o(n),setTimeout(()=>o(null),e)});else{const a=document.createElement("textarea");a.value=t,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a),o(n),setTimeout(()=>o(null),e)}},[e]);return{copy:a,copiedKey:n}}();t.useEffect(()=>{e&&x.current&&setTimeout(()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.focus()},80)},[e]),t.useEffect(()=>{if(!e)return;const t=e=>{h.current&&!h.current.contains(e.target)&&n(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e]);const E=t.useCallback(async()=>{if(l.trim()&&!d){s(!0),f(null),p(null);try{const e=await k(l.trim(),C.CLAUDE_ONLY);p(e),g(t=>{const n=t.filter(e=>e.query.toLowerCase()!==l.trim().toLowerCase());return[{query:l.trim(),matches:e.matches},...n].slice(0,3)})}catch(e){f(e.message||"Something went wrong. Please try again.")}finally{s(!1)}}},[l,d]),v=t.useCallback(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),E())},[E]),w=t.useCallback(()=>{var e;i(""),p(null),f(null),null===(e=x.current)||void 0===e||e.focus()},[]),S=t.useCallback(e=>{var t;i(e),p(null),f(null),null===(t=x.current)||void 0===t||t.focus()},[]),F=t.useCallback(e=>i(e.target.value),[]);return a.default.createElement(a.default.Fragment,null,!e&&a.default.createElement(U,{onOpen:()=>n(!0)}),e&&"nlm"===o&&a.default.createElement(L,{panelRef:h,onClose:()=>n(!1),mode:o,onModeChange:r}),e&&"ai"===o&&a.default.createElement(j,{panelRef:h,textareaRef:x,query:l,loading:d,result:c,error:u,history:m,copy:y,copiedKey:b,onQueryChange:F,onKeyDown:v,onSubmit:E,onClear:w,onClose:()=>n(!1),onHistoryClick:S,mode:o,onModeChange:r}))}let K=null;const q={showWidget:(e,t)=>{K||(K=document.createElement("div"),document.body.appendChild(K));const n=()=>a.default.createElement(a.default.Fragment,null,a.default.createElement(F,{config:e}),e.showIcdAssistant&&a.default.createElement(Y,null));r.default.render(a.default.createElement(n,null),K)},closePopup:()=>{K&&(r.default.unmountComponentAtNode(K),K=null)}};window.BookingSDK=q,e.AppointmentPage=F,e.ICD10Assistant=Y,e.PIH_APPOINTMENT_WIDGET_CLASS=v,e.default=q,Object.defineProperty(e,"__esModule",{value:!0})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pih-appointment-widget",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "main": "dist/App.js",
5
5
  "module": "dist/App.js",
6
6
  "exports": {
Binary file
@@ -0,0 +1,23 @@
1
+ // ─── Image assets ─────────────────────────────────────────────────────────────
2
+ import icdIconImg from "./icdIcon.png";
3
+
4
+ export const IMG = {
5
+ /** Main ICD-10 Assistant branding icon (floating button + panel header) */
6
+ icdIcon: icdIconImg,
7
+ };
8
+
9
+ // ─── Emoji / text icons ───────────────────────────────────────────────────────
10
+ export const ICON = {
11
+ /** Reason / tip indicator on result cards */
12
+ reason: "💡",
13
+ /** Search history chip prefix */
14
+ history: "🕐",
15
+ /** Footer medical disclaimer */
16
+ medical: "⚕️",
17
+ /** Coding note (currently commented out) */
18
+ codingNote: "📋",
19
+ /** Copy success checkmark */
20
+ copied: "✓",
21
+ /** Copy action */
22
+ copy: "⎘",
23
+ };
@@ -6,6 +6,7 @@
6
6
  import React, { useState, useRef, useEffect, useCallback } from "react";
7
7
  import { getICDSuggestions, ICD_MODE } from "../services/icdService";
8
8
  import { useClipboard } from "../hooks/useClipboard";
9
+ import { IMG, ICON } from "../assets/icons/icdIcons";
9
10
 
10
11
  // ─── Constants ───────────────────────────────────────────────────────────────
11
12
  const MAX_HISTORY = 3;
@@ -136,7 +137,7 @@ function ResultCard({ match, index, copy, copiedKey }) {
136
137
  </div>
137
138
  {match.reason && (
138
139
  <p style={{ margin: 0, fontSize: 12, color: C.muted, lineHeight: 1.5, paddingLeft: 2 }}>
139
- 💡 {match.reason}
140
+ {ICON.reason} {match.reason}
140
141
  </p>
141
142
  )}
142
143
  </div>
@@ -167,7 +168,7 @@ function HistoryChip({ item, onClick }) {
167
168
  onMouseEnter={(e) => (e.currentTarget.style.borderColor = C.primary)}
168
169
  onMouseLeave={(e) => (e.currentTarget.style.borderColor = C.border)}
169
170
  >
170
- 🕐 {item.query}
171
+ {ICON.history} {item.query}
171
172
  </button>
172
173
  );
173
174
  }
@@ -210,8 +211,8 @@ function ModeToggle({ mode, onChange }) {
210
211
  marginTop: 10,
211
212
  }}
212
213
  >
213
- {tab("nlm", "Quick Lookup", "🔎")}
214
- {tab("ai", "AI Suggest", "🤖")}
214
+ {tab("nlm", "Quick Lookup", "")}
215
+ {tab("ai", "AI Suggest", "")}
215
216
  </div>
216
217
  );
217
218
  }
@@ -292,7 +293,7 @@ function NLMLookupPanel({ panelRef, onClose, mode, onModeChange }) {
292
293
  <div style={{ background: `linear-gradient(135deg, ${C.primary} 0%, ${C.teal} 100%)`, padding: "14px 18px", flexShrink: 0 }}>
293
294
  <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
294
295
  <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
295
- <span style={{ fontSize: 22 }}>🩺</span>
296
+ <img src={IMG.icdIcon} alt="ICD-10" style={{ width: 32, height: 32, objectFit: "contain" }} />
296
297
  <div>
297
298
  <div style={{ color: C.white, fontWeight: 700, fontSize: 15, lineHeight: 1.2 }}>ICD-10 Coding Assistant</div>
298
299
  <div style={{ color: "rgba(255,255,255,0.75)", fontSize: 11 }}>Quick ICD-10 lookup</div>
@@ -326,7 +327,74 @@ function NLMLookupPanel({ panelRef, onClose, mode, onModeChange }) {
326
327
  onBlur={(e) => (e.target.style.borderColor = C.border)}
327
328
  />
328
329
 
329
- {status && <p style={{ margin: 0, fontSize: 12, color: C.muted }}>{status}</p>}
330
+ {/* Persistent note */}
331
+ <p style={{ margin: 0, fontSize: 11, color: "#aaa", lineHeight: 1.6, borderLeft: `3px solid ${C.border}`, paddingLeft: 8 }}>
332
+ <strong>Note:</strong> Use short, specific keywords for better results, or try{" "}
333
+ <button
334
+ onClick={() => onModeChange("ai")}
335
+ style={{
336
+ background: "none",
337
+ border: "none",
338
+ padding: 0,
339
+ color: C.primary,
340
+ fontWeight: 700,
341
+ fontSize: 11,
342
+ cursor: "pointer",
343
+ textDecoration: "underline",
344
+ fontFamily: FONT,
345
+ }}
346
+ >
347
+ AI Suggest
348
+ </button>{" "}
349
+ for broader symptom-based recommendations.
350
+ </p>
351
+
352
+ {/* Status — only show while searching or when results found */}
353
+ {status && results.length > 0 && (
354
+ <p style={{ margin: 0, fontSize: 12, color: C.muted }}>{status}</p>
355
+ )}
356
+
357
+ {/* No results state */}
358
+ {status === "No matching codes found." && results.length === 0 && (
359
+ <div
360
+ style={{
361
+ background: C.warnLight,
362
+ border: `1px solid #fcd34d`,
363
+ borderRadius: 10,
364
+ padding: "14px 16px",
365
+ display: "flex",
366
+ gap: 10,
367
+ alignItems: "flex-start",
368
+ }}
369
+ >
370
+ <span style={{ fontSize: 18, flexShrink: 0 }}>🔍</span>
371
+ <div>
372
+ <p style={{ margin: "0 0 4px", fontSize: 13, fontWeight: 700, color: C.warn }}>
373
+ No results found
374
+ </p>
375
+ <p style={{ margin: 0, fontSize: 12, color: C.warn, lineHeight: 1.6 }}>
376
+ We couldn&apos;t find a match. Try using more accurate keywords or switch to{" "}
377
+ <button
378
+ onClick={() => onModeChange("ai")}
379
+ style={{
380
+ background: "none",
381
+ border: "none",
382
+ padding: 0,
383
+ color: C.primary,
384
+ fontWeight: 700,
385
+ fontSize: 12,
386
+ cursor: "pointer",
387
+ textDecoration: "underline",
388
+ fontFamily: FONT,
389
+ }}
390
+ >
391
+ AI Suggest
392
+ </button>{" "}
393
+ for better results.
394
+ </p>
395
+ </div>
396
+ </div>
397
+ )}
330
398
 
331
399
  <div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
332
400
  {results.map(([code, name]) => (
@@ -361,7 +429,7 @@ function NLMLookupPanel({ panelRef, onClose, mode, onModeChange }) {
361
429
 
362
430
  {/* Footer */}
363
431
  <div style={{ flexShrink: 0, padding: "10px 18px", borderTop: `1px solid ${C.border}`, background: C.bg, fontSize: 11, color: "#aaa", textAlign: "center" }}>
364
- ⚕️ For reference only. Always verify codes with a certified medical coder.
432
+ {ICON.medical} For reference only. Always verify codes with a certified medical coder.
365
433
  </div>
366
434
  </div>
367
435
  );
@@ -403,7 +471,7 @@ function FloatingButton({ onOpen }) {
403
471
  e.currentTarget.style.boxShadow = "0 4px 16px rgba(76,77,220,0.35)";
404
472
  }}
405
473
  >
406
- <span style={{ fontSize: 18 }}>🩺</span>
474
+ <img src={IMG.icdIcon} alt="ICD-10" style={{ width: 22, height: 22, objectFit: "contain" }} />
407
475
  ICD-10 Assistant
408
476
  </button>
409
477
  );
@@ -470,7 +538,7 @@ function Panel({
470
538
  >
471
539
  <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
472
540
  <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
473
- <span style={{ fontSize: 22 }}>🩺</span>
541
+ <img src={IMG.icdIcon} alt="ICD-10" style={{ width: 32, height: 32, objectFit: "contain" }} />
474
542
  <div>
475
543
  <div style={{ color: C.white, fontWeight: 700, fontSize: 15, lineHeight: 1.2 }}>
476
544
  ICD-10 Coding Assistant
@@ -555,7 +623,7 @@ function Panel({
555
623
  onBlur={(e) => (e.target.style.borderColor = C.border)}
556
624
  />
557
625
  <div style={{ fontSize: 11, color: "#aaa", textAlign: "right" }}>
558
- Press <kbd style={{ background: "#f3f4f6", padding: "1px 5px", borderRadius: 3, fontFamily: "monospace" }}>⌘ Enter</kbd> to submit
626
+ Press <kbd style={{ background: "#f3f4f6", padding: "1px 5px", borderRadius: 3, fontFamily: "monospace" }}>Enter</kbd> to submit · <kbd style={{ background: "#f3f4f6", padding: "1px 5px", borderRadius: 3, fontFamily: "monospace" }}>Shift+Enter</kbd> for new line
559
627
  </div>
560
628
  </div>
561
629
 
@@ -591,7 +659,7 @@ function Panel({
591
659
  Searching codes…
592
660
  </>
593
661
  ) : (
594
- "🔍 Find ICD-10 Codes"
662
+ "Find ICD-10 Codes"
595
663
  )}
596
664
  </button>
597
665
  {(query || result) && (
@@ -731,7 +799,7 @@ function Panel({
731
799
  textAlign: "center",
732
800
  }}
733
801
  >
734
- ⚕️ For reference only. Always verify codes with a certified medical coder.
802
+ {ICON.medical} For reference only. Always verify codes with a certified medical coder.
735
803
  Not a substitute for clinical judgment or official coding guidelines.
736
804
  </div>
737
805
  </div>
@@ -794,7 +862,7 @@ export default function ICD10Assistant() {
794
862
 
795
863
  const handleKeyDown = useCallback(
796
864
  (e) => {
797
- if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
865
+ if (e.key === "Enter" && !e.shiftKey) {
798
866
  e.preventDefault();
799
867
  handleSubmit();
800
868
  }