dsh-codex-subscription 3.2.7 → 3.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +4 -4
- package/README.en.md +4 -4
- package/README.es.md +4 -4
- package/README.fr.md +4 -4
- package/README.ja.md +4 -4
- package/README.md +4 -4
- package/README.pt.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh-CN.md +4 -4
- package/lib/client.image-viewer.js +397 -222
- package/lib/client.js +1166 -136
- package/lib/index.js +905 -447
- package/package.json +1 -3
package/lib/client.js
CHANGED
|
@@ -30,8 +30,6 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
let react = require("react");
|
|
31
31
|
react = __toESM(react, 1);
|
|
32
32
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
-
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
34
|
-
_deepseek_ai_dsh_client_ui_primitives = __toESM(_deepseek_ai_dsh_client_ui_primitives, 1);
|
|
35
33
|
let react_dom = require("react-dom");
|
|
36
34
|
//#region src/sketch-layers.js
|
|
37
35
|
const createSketchLayers = () => ({
|
|
@@ -634,7 +632,67 @@ window.__ModuleLoader__.load({
|
|
|
634
632
|
d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"
|
|
635
633
|
}));
|
|
636
634
|
}
|
|
637
|
-
const ForwardRef$
|
|
635
|
+
const ForwardRef$10 = /*#__PURE__*/ react.forwardRef(ArrowPathIcon);
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/24/outline/esm/CheckIcon.js
|
|
638
|
+
function CheckIcon({ title, titleId, ...props }, svgRef) {
|
|
639
|
+
return /*#__PURE__*/ react.createElement("svg", Object.assign({
|
|
640
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
641
|
+
fill: "none",
|
|
642
|
+
viewBox: "0 0 24 24",
|
|
643
|
+
strokeWidth: 1.5,
|
|
644
|
+
stroke: "currentColor",
|
|
645
|
+
"aria-hidden": "true",
|
|
646
|
+
"data-slot": "icon",
|
|
647
|
+
ref: svgRef,
|
|
648
|
+
"aria-labelledby": titleId
|
|
649
|
+
}, props), title ? /*#__PURE__*/ react.createElement("title", { id: titleId }, title) : null, /*#__PURE__*/ react.createElement("path", {
|
|
650
|
+
strokeLinecap: "round",
|
|
651
|
+
strokeLinejoin: "round",
|
|
652
|
+
d: "m4.5 12.75 6 6 9-13.5"
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
655
|
+
const ForwardRef$9 = /*#__PURE__*/ react.forwardRef(CheckIcon);
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/24/outline/esm/ChevronDownIcon.js
|
|
658
|
+
function ChevronDownIcon({ title, titleId, ...props }, svgRef) {
|
|
659
|
+
return /*#__PURE__*/ react.createElement("svg", Object.assign({
|
|
660
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
661
|
+
fill: "none",
|
|
662
|
+
viewBox: "0 0 24 24",
|
|
663
|
+
strokeWidth: 1.5,
|
|
664
|
+
stroke: "currentColor",
|
|
665
|
+
"aria-hidden": "true",
|
|
666
|
+
"data-slot": "icon",
|
|
667
|
+
ref: svgRef,
|
|
668
|
+
"aria-labelledby": titleId
|
|
669
|
+
}, props), title ? /*#__PURE__*/ react.createElement("title", { id: titleId }, title) : null, /*#__PURE__*/ react.createElement("path", {
|
|
670
|
+
strokeLinecap: "round",
|
|
671
|
+
strokeLinejoin: "round",
|
|
672
|
+
d: "m19.5 8.25-7.5 7.5-7.5-7.5"
|
|
673
|
+
}));
|
|
674
|
+
}
|
|
675
|
+
const ForwardRef$8 = /*#__PURE__*/ react.forwardRef(ChevronDownIcon);
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/24/outline/esm/ChevronRightIcon.js
|
|
678
|
+
function ChevronRightIcon({ title, titleId, ...props }, svgRef) {
|
|
679
|
+
return /*#__PURE__*/ react.createElement("svg", Object.assign({
|
|
680
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
681
|
+
fill: "none",
|
|
682
|
+
viewBox: "0 0 24 24",
|
|
683
|
+
strokeWidth: 1.5,
|
|
684
|
+
stroke: "currentColor",
|
|
685
|
+
"aria-hidden": "true",
|
|
686
|
+
"data-slot": "icon",
|
|
687
|
+
ref: svgRef,
|
|
688
|
+
"aria-labelledby": titleId
|
|
689
|
+
}, props), title ? /*#__PURE__*/ react.createElement("title", { id: titleId }, title) : null, /*#__PURE__*/ react.createElement("path", {
|
|
690
|
+
strokeLinecap: "round",
|
|
691
|
+
strokeLinejoin: "round",
|
|
692
|
+
d: "m8.25 4.5 7.5 7.5-7.5 7.5"
|
|
693
|
+
}));
|
|
694
|
+
}
|
|
695
|
+
const ForwardRef$6 = /*#__PURE__*/ react.forwardRef(ChevronRightIcon);
|
|
638
696
|
//#endregion
|
|
639
697
|
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/24/outline/esm/ExclamationCircleIcon.js
|
|
640
698
|
function ExclamationCircleIcon({ title, titleId, ...props }, svgRef) {
|
|
@@ -654,7 +712,7 @@ window.__ModuleLoader__.load({
|
|
|
654
712
|
d: "M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"
|
|
655
713
|
}));
|
|
656
714
|
}
|
|
657
|
-
const ForwardRef$
|
|
715
|
+
const ForwardRef$4 = /*#__PURE__*/ react.forwardRef(ExclamationCircleIcon);
|
|
658
716
|
//#endregion
|
|
659
717
|
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/24/outline/esm/PhotoIcon.js
|
|
660
718
|
function PhotoIcon({ title, titleId, ...props }, svgRef) {
|
|
@@ -674,19 +732,428 @@ window.__ModuleLoader__.load({
|
|
|
674
732
|
d: "m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"
|
|
675
733
|
}));
|
|
676
734
|
}
|
|
677
|
-
const ForwardRef = /*#__PURE__*/ react.forwardRef(PhotoIcon);
|
|
735
|
+
const ForwardRef$2 = /*#__PURE__*/ react.forwardRef(PhotoIcon);
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js
|
|
738
|
+
function XMarkIcon({ title, titleId, ...props }, svgRef) {
|
|
739
|
+
return /*#__PURE__*/ react.createElement("svg", Object.assign({
|
|
740
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
741
|
+
fill: "none",
|
|
742
|
+
viewBox: "0 0 24 24",
|
|
743
|
+
strokeWidth: 1.5,
|
|
744
|
+
stroke: "currentColor",
|
|
745
|
+
"aria-hidden": "true",
|
|
746
|
+
"data-slot": "icon",
|
|
747
|
+
ref: svgRef,
|
|
748
|
+
"aria-labelledby": titleId
|
|
749
|
+
}, props), title ? /*#__PURE__*/ react.createElement("title", { id: titleId }, title) : null, /*#__PURE__*/ react.createElement("path", {
|
|
750
|
+
strokeLinecap: "round",
|
|
751
|
+
strokeLinejoin: "round",
|
|
752
|
+
d: "M6 18 18 6M6 6l12 12"
|
|
753
|
+
}));
|
|
754
|
+
}
|
|
755
|
+
const ForwardRef$1 = /*#__PURE__*/ react.forwardRef(XMarkIcon);
|
|
678
756
|
//#endregion
|
|
679
|
-
//#region src/client-primitives.
|
|
680
|
-
const
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
const
|
|
757
|
+
//#region src/client-primitives.jsx
|
|
758
|
+
const classes = (...names) => names.filter(Boolean).join(" ");
|
|
759
|
+
const icon = (Icon, size) => function ControlIcon() {
|
|
760
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
761
|
+
width: size,
|
|
762
|
+
height: size,
|
|
763
|
+
"aria-hidden": "true"
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
const IconCheckOutline16 = icon(ForwardRef$9, 16);
|
|
767
|
+
const IconChevronDownOutline14 = icon(ForwardRef$8, 14);
|
|
768
|
+
const IconChevronRightOutline14 = icon(ForwardRef$6, 14);
|
|
769
|
+
const IconCloseOutline16 = icon(ForwardRef$1, 16);
|
|
770
|
+
const Button = (0, react.forwardRef)(function Button({ variant = "ghost", size = "md", icon, className, children, ...props }, ref) {
|
|
771
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
772
|
+
ref,
|
|
773
|
+
type: "button",
|
|
774
|
+
className: classes("dcsButton", className),
|
|
775
|
+
"data-variant": variant,
|
|
776
|
+
"data-size": size,
|
|
777
|
+
...props,
|
|
778
|
+
children: [icon == null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
779
|
+
className: "dcsButtonIcon",
|
|
780
|
+
children: icon
|
|
781
|
+
}), children]
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
const Input = (0, react.forwardRef)(function Input({ className, ...props }, ref) {
|
|
785
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
786
|
+
className: classes("dcsInput", className),
|
|
787
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
788
|
+
ref,
|
|
789
|
+
...props
|
|
790
|
+
})
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
function Switch({ checked, onChange, label, disabled, title, className }) {
|
|
794
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
795
|
+
type: "button",
|
|
796
|
+
role: "switch",
|
|
797
|
+
"aria-checked": checked,
|
|
798
|
+
"aria-label": label,
|
|
799
|
+
title,
|
|
800
|
+
disabled,
|
|
801
|
+
className: classes("dcsSwitch", className),
|
|
802
|
+
onClick: () => onChange(!checked),
|
|
803
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
function usePopover(panelRef, open) {
|
|
807
|
+
(0, react.useLayoutEffect)(() => {
|
|
808
|
+
const panel = panelRef.current;
|
|
809
|
+
if (!open || typeof panel?.showPopover !== "function") return;
|
|
810
|
+
panel.showPopover();
|
|
811
|
+
return () => {
|
|
812
|
+
if (panel.isConnected) panel.hidePopover();
|
|
813
|
+
};
|
|
814
|
+
}, [panelRef, open]);
|
|
815
|
+
}
|
|
816
|
+
function useAnchoredPosition({ open, anchorRef, panelRef, side = "bottom", align = "start", gap = 6, margin = 12 }) {
|
|
817
|
+
const [position, setPosition] = (0, react.useState)(null);
|
|
818
|
+
(0, react.useLayoutEffect)(() => {
|
|
819
|
+
const anchor = anchorRef.current, panel = panelRef.current;
|
|
820
|
+
if (!open || !anchor || !panel) {
|
|
821
|
+
setPosition(null);
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
const win = anchor.ownerDocument.defaultView;
|
|
825
|
+
const viewport = win.visualViewport;
|
|
826
|
+
const update = () => {
|
|
827
|
+
const { left, right, top, bottom } = anchor.getBoundingClientRect();
|
|
828
|
+
const { width, height } = panel.getBoundingClientRect();
|
|
829
|
+
const minLeft = (viewport?.offsetLeft ?? 0) + margin;
|
|
830
|
+
const minTop = (viewport?.offsetTop ?? 0) + margin;
|
|
831
|
+
const maxLeft = minLeft + (viewport?.width ?? win.innerWidth) - width - margin * 2;
|
|
832
|
+
const maxTop = minTop + (viewport?.height ?? win.innerHeight) - height - margin * 2;
|
|
833
|
+
const anchorX = align === "end" ? right - width : align === "center" ? (left + right - width) / 2 : left;
|
|
834
|
+
const above = top - height - gap, below = bottom + gap;
|
|
835
|
+
const next = {
|
|
836
|
+
left: Math.max(minLeft, Math.min(anchorX, maxLeft)),
|
|
837
|
+
top: Math.max(minTop, Math.min(side === "top" ? above < minTop && below <= maxTop ? below : above : below > maxTop && above >= minTop ? above : below, maxTop))
|
|
838
|
+
};
|
|
839
|
+
setPosition((previous) => previous?.left === next.left && previous?.top === next.top ? previous : next);
|
|
840
|
+
};
|
|
841
|
+
update();
|
|
842
|
+
win.addEventListener("resize", update);
|
|
843
|
+
win.addEventListener("scroll", update, true);
|
|
844
|
+
viewport?.addEventListener("resize", update);
|
|
845
|
+
viewport?.addEventListener("scroll", update);
|
|
846
|
+
const observer = typeof ResizeObserver === "function" ? new ResizeObserver(update) : void 0;
|
|
847
|
+
observer?.observe(anchor);
|
|
848
|
+
observer?.observe(panel);
|
|
849
|
+
return () => {
|
|
850
|
+
observer?.disconnect();
|
|
851
|
+
win.removeEventListener("resize", update);
|
|
852
|
+
win.removeEventListener("scroll", update, true);
|
|
853
|
+
viewport?.removeEventListener("resize", update);
|
|
854
|
+
viewport?.removeEventListener("scroll", update);
|
|
855
|
+
};
|
|
856
|
+
}, [
|
|
857
|
+
open,
|
|
858
|
+
anchorRef,
|
|
859
|
+
panelRef,
|
|
860
|
+
side,
|
|
861
|
+
align,
|
|
862
|
+
gap,
|
|
863
|
+
margin
|
|
864
|
+
]);
|
|
865
|
+
return position;
|
|
866
|
+
}
|
|
867
|
+
function useDismissOnOutsidePointer(anchor, open, dismiss, panel) {
|
|
868
|
+
(0, react.useEffect)(() => {
|
|
869
|
+
if (!open) return;
|
|
870
|
+
const doc = anchor.current?.ownerDocument;
|
|
871
|
+
const outside = (event) => {
|
|
872
|
+
if (!anchor.current?.contains(event.target) && !panel.current?.contains(event.target)) dismiss();
|
|
873
|
+
};
|
|
874
|
+
doc?.addEventListener("pointerdown", outside);
|
|
875
|
+
return () => doc?.removeEventListener("pointerdown", outside);
|
|
876
|
+
}, [
|
|
877
|
+
anchor,
|
|
878
|
+
open,
|
|
879
|
+
dismiss,
|
|
880
|
+
panel
|
|
881
|
+
]);
|
|
882
|
+
}
|
|
883
|
+
function Tooltip({ label, children, side = "bottom", delayMs = 0, maxWidth, openOnClick = false }) {
|
|
884
|
+
const anchor = (0, react.useRef)(null), panel = (0, react.useRef)(null), timer = (0, react.useRef)();
|
|
885
|
+
const [open, setOpen] = (0, react.useState)(false), [pinned, setPinned] = (0, react.useState)(false);
|
|
886
|
+
const id = (0, react.useId)();
|
|
887
|
+
const originalRef = children.ref;
|
|
888
|
+
const setAnchor = (0, react.useCallback)((element) => {
|
|
889
|
+
anchor.current = element;
|
|
890
|
+
if (typeof originalRef === "function") originalRef(element);
|
|
891
|
+
else if (originalRef) originalRef.current = element;
|
|
892
|
+
}, [originalRef]);
|
|
893
|
+
const show = (delay) => {
|
|
894
|
+
clearTimeout(timer.current);
|
|
895
|
+
timer.current = setTimeout(() => setOpen(true), delay);
|
|
896
|
+
};
|
|
897
|
+
const hide = () => {
|
|
898
|
+
clearTimeout(timer.current);
|
|
899
|
+
if (!pinned) setOpen(false);
|
|
900
|
+
};
|
|
901
|
+
const dismiss = () => {
|
|
902
|
+
clearTimeout(timer.current);
|
|
903
|
+
setPinned(false);
|
|
904
|
+
setOpen(false);
|
|
905
|
+
};
|
|
906
|
+
(0, react.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
907
|
+
usePopover(panel, open);
|
|
908
|
+
const position = useAnchoredPosition({
|
|
909
|
+
open,
|
|
910
|
+
anchorRef: anchor,
|
|
911
|
+
panelRef: panel,
|
|
912
|
+
side,
|
|
913
|
+
align: "center"
|
|
914
|
+
});
|
|
915
|
+
useDismissOnOutsidePointer(anchor, pinned, dismiss, panel);
|
|
916
|
+
(0, react.useEffect)(() => {
|
|
917
|
+
if (!open) return;
|
|
918
|
+
const doc = anchor.current?.ownerDocument;
|
|
919
|
+
const escape = (event) => {
|
|
920
|
+
if (event.key !== "Escape") return;
|
|
921
|
+
dismiss();
|
|
922
|
+
if (pinned || anchor.current?.contains(doc.activeElement)) {
|
|
923
|
+
event.preventDefault();
|
|
924
|
+
event.stopPropagation();
|
|
925
|
+
}
|
|
926
|
+
};
|
|
927
|
+
const win = doc?.defaultView;
|
|
928
|
+
win?.addEventListener("keydown", escape, true);
|
|
929
|
+
return () => win?.removeEventListener("keydown", escape, true);
|
|
930
|
+
}, [open, pinned]);
|
|
931
|
+
const target = (0, react.cloneElement)(children, {
|
|
932
|
+
ref: setAnchor,
|
|
933
|
+
"data-dcs-tooltip-anchor": "",
|
|
934
|
+
"aria-describedby": open ? [children.props["aria-describedby"], id].filter(Boolean).join(" ") : children.props["aria-describedby"],
|
|
935
|
+
"aria-description": children.props["aria-description"] ?? label,
|
|
936
|
+
onPointerEnter: (event) => {
|
|
937
|
+
children.props.onPointerEnter?.(event);
|
|
938
|
+
if (event.pointerType !== "touch") show(delayMs);
|
|
939
|
+
},
|
|
940
|
+
onPointerLeave: (event) => {
|
|
941
|
+
children.props.onPointerLeave?.(event);
|
|
942
|
+
hide();
|
|
943
|
+
},
|
|
944
|
+
onFocus: (event) => {
|
|
945
|
+
children.props.onFocus?.(event);
|
|
946
|
+
show(0);
|
|
947
|
+
},
|
|
948
|
+
onBlur: (event) => {
|
|
949
|
+
children.props.onBlur?.(event);
|
|
950
|
+
hide();
|
|
951
|
+
},
|
|
952
|
+
onClick: openOnClick ? (event) => {
|
|
953
|
+
children.props.onClick?.(event);
|
|
954
|
+
if (event.defaultPrevented) return;
|
|
955
|
+
if (pinned) dismiss();
|
|
956
|
+
else {
|
|
957
|
+
clearTimeout(timer.current);
|
|
958
|
+
setPinned(true);
|
|
959
|
+
setOpen(true);
|
|
960
|
+
}
|
|
961
|
+
} : children.props.onClick
|
|
962
|
+
});
|
|
963
|
+
const bubble = open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
964
|
+
ref: panel,
|
|
965
|
+
popover: "manual",
|
|
966
|
+
className: "dcsTooltip",
|
|
967
|
+
id,
|
|
968
|
+
role: "tooltip",
|
|
969
|
+
"data-pinned": pinned || void 0,
|
|
970
|
+
style: {
|
|
971
|
+
...position,
|
|
972
|
+
maxWidth: maxWidth ? `min(${maxWidth}px, calc(100vw - 24px))` : void 0,
|
|
973
|
+
visibility: position ? "visible" : "hidden"
|
|
974
|
+
},
|
|
975
|
+
children: label
|
|
976
|
+
}) : null;
|
|
977
|
+
return children.type === "summary" ? (0, react.cloneElement)(target, void 0, children.props.children, bubble) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [target, bubble] });
|
|
978
|
+
}
|
|
979
|
+
function Menu({ open, anchor, items, selectedId, onSelect, onClose, align = "start", side = "bottom" }) {
|
|
980
|
+
const trigger = (0, react.useRef)(null), panel = (0, react.useRef)(null);
|
|
981
|
+
const [submenu, setSubmenu] = (0, react.useState)();
|
|
982
|
+
const id = (0, react.useId)();
|
|
983
|
+
const menuItems = () => [...panel.current.querySelectorAll("button[role^=\"menuitem\"]:not(:disabled)")];
|
|
984
|
+
const dismiss = (restoreFocus = false) => {
|
|
985
|
+
setSubmenu(void 0);
|
|
986
|
+
onClose();
|
|
987
|
+
if (restoreFocus) trigger.current?.focus();
|
|
988
|
+
};
|
|
989
|
+
usePopover(panel, open);
|
|
990
|
+
const position = useAnchoredPosition({
|
|
991
|
+
open,
|
|
992
|
+
anchorRef: trigger,
|
|
993
|
+
panelRef: panel,
|
|
994
|
+
side,
|
|
995
|
+
align
|
|
996
|
+
});
|
|
997
|
+
useDismissOnOutsidePointer(trigger, open, dismiss, panel);
|
|
998
|
+
const positioned = position !== null;
|
|
999
|
+
(0, react.useLayoutEffect)(() => {
|
|
1000
|
+
if (!open || !positioned) return;
|
|
1001
|
+
const choices = menuItems();
|
|
1002
|
+
(choices.find((item) => item.getAttribute("aria-checked") === "true") ?? choices[0] ?? panel.current).focus();
|
|
1003
|
+
}, [open, positioned]);
|
|
1004
|
+
(0, react.useLayoutEffect)(() => {
|
|
1005
|
+
if (open && submenu) panel.current.querySelector("[data-submenu-item]:not(:disabled)")?.focus();
|
|
1006
|
+
}, [open, submenu]);
|
|
1007
|
+
(0, react.useEffect)(() => {
|
|
1008
|
+
if (!open) setSubmenu(void 0);
|
|
1009
|
+
}, [open]);
|
|
1010
|
+
const closeSubmenu = () => {
|
|
1011
|
+
panel.current.querySelector("[aria-expanded=\"true\"]")?.focus();
|
|
1012
|
+
setSubmenu(void 0);
|
|
1013
|
+
};
|
|
1014
|
+
(0, react.useEffect)(() => {
|
|
1015
|
+
if (!open) return;
|
|
1016
|
+
const win = trigger.current?.ownerDocument.defaultView;
|
|
1017
|
+
const escape = (event) => {
|
|
1018
|
+
if (event.key !== "Escape") return;
|
|
1019
|
+
event.preventDefault();
|
|
1020
|
+
event.stopPropagation();
|
|
1021
|
+
if (submenu) closeSubmenu();
|
|
1022
|
+
else dismiss(true);
|
|
1023
|
+
};
|
|
1024
|
+
win?.addEventListener("keydown", escape, true);
|
|
1025
|
+
return () => win?.removeEventListener("keydown", escape, true);
|
|
1026
|
+
}, [
|
|
1027
|
+
open,
|
|
1028
|
+
submenu,
|
|
1029
|
+
onClose
|
|
1030
|
+
]);
|
|
1031
|
+
const walk = (event) => {
|
|
1032
|
+
const { key, target } = event;
|
|
1033
|
+
if (key === "Tab") {
|
|
1034
|
+
dismiss(true);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (key === "ArrowRight" && target.hasAttribute("aria-expanded")) {
|
|
1038
|
+
event.preventDefault();
|
|
1039
|
+
target.click();
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
if (key === "ArrowLeft" && submenu) {
|
|
1043
|
+
event.preventDefault();
|
|
1044
|
+
closeSubmenu();
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
if (![
|
|
1048
|
+
"ArrowDown",
|
|
1049
|
+
"ArrowUp",
|
|
1050
|
+
"Home",
|
|
1051
|
+
"End"
|
|
1052
|
+
].includes(key)) return;
|
|
1053
|
+
event.preventDefault();
|
|
1054
|
+
const choices = menuItems(), current = choices.indexOf(target);
|
|
1055
|
+
choices[key === "Home" ? 0 : key === "End" ? choices.length - 1 : (current + (key === "ArrowUp" ? -1 : 1) + choices.length) % choices.length]?.focus();
|
|
1056
|
+
};
|
|
1057
|
+
const rows = (entries, nested = false) => entries.map((item) => {
|
|
1058
|
+
if (item.type === "separator") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1059
|
+
role: "separator",
|
|
1060
|
+
className: "dcsMenuSeparator"
|
|
1061
|
+
}, item.id);
|
|
1062
|
+
if (item.type === "label") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1063
|
+
className: "dcsMenuLabel",
|
|
1064
|
+
children: item.text
|
|
1065
|
+
}, item.id);
|
|
1066
|
+
const selected = item.id === selectedId, expanded = submenu === item.id;
|
|
1067
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1068
|
+
role: "none",
|
|
1069
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1070
|
+
type: "button",
|
|
1071
|
+
role: item.submenu ? "menuitem" : "menuitemradio",
|
|
1072
|
+
tabIndex: -1,
|
|
1073
|
+
"aria-checked": item.submenu ? void 0 : selected,
|
|
1074
|
+
"aria-haspopup": item.submenu ? "menu" : void 0,
|
|
1075
|
+
"aria-expanded": item.submenu ? expanded : void 0,
|
|
1076
|
+
"data-submenu-item": nested || void 0,
|
|
1077
|
+
disabled: item.disabled,
|
|
1078
|
+
onClick: () => {
|
|
1079
|
+
if (item.submenu) {
|
|
1080
|
+
setSubmenu(expanded ? void 0 : item.id);
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
setSubmenu(void 0);
|
|
1084
|
+
trigger.current?.focus();
|
|
1085
|
+
onSelect(item.id);
|
|
1086
|
+
},
|
|
1087
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }), item.submenu ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutline14, {}) : selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutline16, {}) : null]
|
|
1088
|
+
}), item.submenu && expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1089
|
+
role: "menu",
|
|
1090
|
+
"aria-label": typeof item.label === "string" ? item.label : void 0,
|
|
1091
|
+
className: "dcsMenuChildren",
|
|
1092
|
+
children: rows(item.submenu, true)
|
|
1093
|
+
}) : null]
|
|
1094
|
+
}, item.id);
|
|
1095
|
+
});
|
|
1096
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react.cloneElement)(anchor, {
|
|
1097
|
+
ref: trigger,
|
|
1098
|
+
"aria-haspopup": "menu",
|
|
1099
|
+
"aria-controls": open ? id : void 0,
|
|
1100
|
+
onKeyDown: (event) => {
|
|
1101
|
+
anchor.props.onKeyDown?.(event);
|
|
1102
|
+
if (!event.defaultPrevented && !open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
|
|
1103
|
+
event.preventDefault();
|
|
1104
|
+
anchor.props.onClick?.(event);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}), open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1108
|
+
ref: panel,
|
|
1109
|
+
id,
|
|
1110
|
+
popover: "manual",
|
|
1111
|
+
className: "dcsMenu",
|
|
1112
|
+
role: "menu",
|
|
1113
|
+
"aria-label": anchor.props["aria-label"],
|
|
1114
|
+
tabIndex: -1,
|
|
1115
|
+
style: {
|
|
1116
|
+
...position,
|
|
1117
|
+
visibility: position ? "visible" : "hidden"
|
|
1118
|
+
},
|
|
1119
|
+
onKeyDown: walk,
|
|
1120
|
+
children: rows(items)
|
|
1121
|
+
}) : null] });
|
|
1122
|
+
}
|
|
1123
|
+
function ImageLightbox({ src, alt, labels, onClose }) {
|
|
1124
|
+
const dialog = (0, react.useRef)(null);
|
|
1125
|
+
(0, react.useLayoutEffect)(() => {
|
|
1126
|
+
const element = dialog.current, opener = element.ownerDocument.activeElement;
|
|
1127
|
+
element.showModal();
|
|
1128
|
+
element.querySelector("button")?.focus();
|
|
1129
|
+
return () => {
|
|
1130
|
+
element.close();
|
|
1131
|
+
if (opener?.isConnected) opener.focus();
|
|
1132
|
+
};
|
|
1133
|
+
}, []);
|
|
1134
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dialog", {
|
|
1135
|
+
ref: dialog,
|
|
1136
|
+
className: "dcsLightbox",
|
|
1137
|
+
"aria-label": labels.dialog,
|
|
1138
|
+
onCancel: (event) => {
|
|
1139
|
+
event.preventDefault();
|
|
1140
|
+
event.stopPropagation();
|
|
1141
|
+
onClose();
|
|
1142
|
+
},
|
|
1143
|
+
onClick: (event) => {
|
|
1144
|
+
if (event.target === event.currentTarget) onClose();
|
|
1145
|
+
},
|
|
1146
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
1147
|
+
src,
|
|
1148
|
+
alt
|
|
1149
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1150
|
+
type: "button",
|
|
1151
|
+
"aria-label": labels.close,
|
|
1152
|
+
onClick: onClose,
|
|
1153
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCloseOutline16, {})
|
|
1154
|
+
})]
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
690
1157
|
const ORIGINAL_IMAGE_ID_PATTERN = /^img_[0-9a-f]{32}$/u;
|
|
691
1158
|
const positiveInteger = (value) => Number.isSafeInteger(value) && value > 0;
|
|
692
1159
|
function decodeOriginalImageRef(value) {
|
|
@@ -744,7 +1211,7 @@ window.__ModuleLoader__.load({
|
|
|
744
1211
|
"voice/start",
|
|
745
1212
|
"voice/stop",
|
|
746
1213
|
"voice/status",
|
|
747
|
-
"voice/
|
|
1214
|
+
"voice/playback",
|
|
748
1215
|
"voice/preview",
|
|
749
1216
|
"voice/catalog",
|
|
750
1217
|
"voice/native/probe",
|
|
@@ -756,6 +1223,7 @@ window.__ModuleLoader__.load({
|
|
|
756
1223
|
"remote/enable",
|
|
757
1224
|
"remote/disable",
|
|
758
1225
|
"remote/pair",
|
|
1226
|
+
"remote/pair-status",
|
|
759
1227
|
"remote/clients",
|
|
760
1228
|
"remote/revoke",
|
|
761
1229
|
"reset-credit/inspect",
|
|
@@ -949,11 +1417,10 @@ window.__ModuleLoader__.load({
|
|
|
949
1417
|
...request,
|
|
950
1418
|
annotations: false
|
|
951
1419
|
});
|
|
952
|
-
else
|
|
1420
|
+
else setNativePreview({
|
|
953
1421
|
attachment,
|
|
954
1422
|
src
|
|
955
1423
|
});
|
|
956
|
-
else window.open(src, "_blank", "noopener,noreferrer");
|
|
957
1424
|
};
|
|
958
1425
|
if (error && !usable) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
959
1426
|
type: "button",
|
|
@@ -974,7 +1441,7 @@ window.__ModuleLoader__.load({
|
|
|
974
1441
|
onLoad: loaded,
|
|
975
1442
|
alt: label
|
|
976
1443
|
}, attempt), error ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("imageLoadFailed") }) : null]
|
|
977
|
-
}), nativePreview?.attachment === attachment && !features.imageViewer
|
|
1444
|
+
}), nativePreview?.attachment === attachment && !features.imageViewer ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ImageLightbox, {
|
|
978
1445
|
src: nativePreview.src,
|
|
979
1446
|
alt: label,
|
|
980
1447
|
labels: {
|
|
@@ -1001,7 +1468,7 @@ window.__ModuleLoader__.load({
|
|
|
1001
1468
|
showOutput ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1002
1469
|
className: "codexImageToolRow",
|
|
1003
1470
|
children: [
|
|
1004
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(!settled ? ForwardRef$
|
|
1471
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(!settled ? ForwardRef$10 : failed ? ForwardRef$4 : ForwardRef$2, {
|
|
1005
1472
|
className: "codexImageToolIcon",
|
|
1006
1473
|
"aria-hidden": "true"
|
|
1007
1474
|
}),
|
|
@@ -1130,7 +1597,6 @@ window.__ModuleLoader__.load({
|
|
|
1130
1597
|
label: t("sketch"),
|
|
1131
1598
|
side: "top",
|
|
1132
1599
|
delayMs: 350,
|
|
1133
|
-
portal: true,
|
|
1134
1600
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
1135
1601
|
variant: "ghost",
|
|
1136
1602
|
size: "sm",
|
|
@@ -1333,7 +1799,7 @@ window.__ModuleLoader__.load({
|
|
|
1333
1799
|
"aria-label": label,
|
|
1334
1800
|
disabled: !failed,
|
|
1335
1801
|
onClick: onRetry,
|
|
1336
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef$
|
|
1802
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef$10, {
|
|
1337
1803
|
className: failed ? "codexFeatureRetryIcon" : "codexFeatureLoadingIcon",
|
|
1338
1804
|
"aria-hidden": "true"
|
|
1339
1805
|
}),
|
|
@@ -2437,6 +2903,12 @@ window.__ModuleLoader__.load({
|
|
|
2437
2903
|
runwayDays: "{days} 天",
|
|
2438
2904
|
runwayHours: "{hours}h",
|
|
2439
2905
|
runwayMinutes: "{minutes} 分钟",
|
|
2906
|
+
"composerSettingsTitle": "输入框",
|
|
2907
|
+
"defaultSpeedTitle": "默认速度",
|
|
2908
|
+
"composerMenuCustom": "可在模型菜单中切换速度",
|
|
2909
|
+
"composerMenuHost": "由 DSH 或其他插件提供模型菜单",
|
|
2910
|
+
"legacyModelPicker": "自定义模型菜单",
|
|
2911
|
+
"legacyModelPickerHint": "在输入框的模型菜单中切换速度和回答详略。关闭后,本插件让出模型菜单,订阅功能仍可使用。",
|
|
2440
2912
|
speedTitle: "速度",
|
|
2441
2913
|
speedStandard: "标准",
|
|
2442
2914
|
speedStandardHint: "标准速度",
|
|
@@ -3372,6 +3844,12 @@ window.__ModuleLoader__.load({
|
|
|
3372
3844
|
runwayDays: "{days}d",
|
|
3373
3845
|
runwayHours: "{hours}h",
|
|
3374
3846
|
runwayMinutes: "{minutes}m",
|
|
3847
|
+
"composerSettingsTitle": "Composer",
|
|
3848
|
+
"defaultSpeedTitle": "Default speed",
|
|
3849
|
+
"composerMenuCustom": "Speed controls in the model menu",
|
|
3850
|
+
"composerMenuHost": "Model menu provided by DSH or another plugin",
|
|
3851
|
+
"legacyModelPicker": "Custom model menu",
|
|
3852
|
+
"legacyModelPickerHint": "Switch speed and output detail in the composer’s model menu. Turn off to let DSH or another plugin provide the menu. Subscription features remain available.",
|
|
3375
3853
|
speedTitle: "Speed",
|
|
3376
3854
|
speedStandard: "Standard",
|
|
3377
3855
|
speedStandardHint: "Standard speed",
|
|
@@ -4307,6 +4785,12 @@ window.__ModuleLoader__.load({
|
|
|
4307
4785
|
"runwayDays": "{days}日",
|
|
4308
4786
|
"runwayHours": "{hours}時間",
|
|
4309
4787
|
"runwayMinutes": "{minutes}分",
|
|
4788
|
+
"composerSettingsTitle": "入力欄",
|
|
4789
|
+
"defaultSpeedTitle": "既定の速度",
|
|
4790
|
+
"composerMenuCustom": "モデルメニューで速度を切り替え",
|
|
4791
|
+
"composerMenuHost": "DSH または他のプラグインのメニューを使用",
|
|
4792
|
+
"legacyModelPicker": "カスタムモデルメニュー",
|
|
4793
|
+
"legacyModelPickerHint": "入力欄のモデルメニューから速度と回答の詳しさを切り替えられます。オフにするとメニューを DSH や他のプラグインに任せます。購読機能は引き続き使えます。",
|
|
4310
4794
|
"speedTitle": "速度",
|
|
4311
4795
|
"speedStandard": "標準",
|
|
4312
4796
|
"speedStandardHint": "標準速度",
|
|
@@ -5242,6 +5726,12 @@ window.__ModuleLoader__.load({
|
|
|
5242
5726
|
"runwayDays": "{days} d",
|
|
5243
5727
|
"runwayHours": "{hours} h",
|
|
5244
5728
|
"runwayMinutes": "{minutes} min",
|
|
5729
|
+
"composerSettingsTitle": "Cuadro de mensaje",
|
|
5730
|
+
"defaultSpeedTitle": "Velocidad predeterminada",
|
|
5731
|
+
"composerMenuCustom": "Control de velocidad en el menú de modelos",
|
|
5732
|
+
"composerMenuHost": "Menú de DSH u otro complemento",
|
|
5733
|
+
"legacyModelPicker": "Menú de modelos personalizado",
|
|
5734
|
+
"legacyModelPickerHint": "Cambia la velocidad y el nivel de detalle en el menú de modelos. Al desactivar esta opción, DSH u otro complemento se encarga del menú. Las funciones de suscripción siguen disponibles.",
|
|
5245
5735
|
"speedTitle": "Velocidad",
|
|
5246
5736
|
"speedStandard": "Estándar",
|
|
5247
5737
|
"speedStandardHint": "Velocidad estándar",
|
|
@@ -6177,6 +6667,12 @@ window.__ModuleLoader__.load({
|
|
|
6177
6667
|
"runwayDays": "{days} j",
|
|
6178
6668
|
"runwayHours": "{hours} h",
|
|
6179
6669
|
"runwayMinutes": "{minutes} min",
|
|
6670
|
+
"composerSettingsTitle": "Zone de saisie",
|
|
6671
|
+
"defaultSpeedTitle": "Vitesse par défaut",
|
|
6672
|
+
"composerMenuCustom": "Réglage de la vitesse dans le menu des modèles",
|
|
6673
|
+
"composerMenuHost": "Menu fourni par DSH ou une autre extension",
|
|
6674
|
+
"legacyModelPicker": "Menu des modèles personnalisé",
|
|
6675
|
+
"legacyModelPickerHint": "Réglez la vitesse et le niveau de détail dans le menu des modèles. Si vous désactivez cette option, DSH ou une autre extension gère le menu. Les fonctions de l’abonnement restent disponibles.",
|
|
6180
6676
|
"speedTitle": "Vitesse",
|
|
6181
6677
|
"speedStandard": "Standard",
|
|
6182
6678
|
"speedStandardHint": "Vitesse standard",
|
|
@@ -7112,6 +7608,12 @@ window.__ModuleLoader__.load({
|
|
|
7112
7608
|
"runwayDays": "{days} Tg.",
|
|
7113
7609
|
"runwayHours": "{hours} Std.",
|
|
7114
7610
|
"runwayMinutes": "{minutes} Min.",
|
|
7611
|
+
"composerSettingsTitle": "Eingabefeld",
|
|
7612
|
+
"defaultSpeedTitle": "Standardtempo",
|
|
7613
|
+
"composerMenuCustom": "Tempowahl im Modellmenü",
|
|
7614
|
+
"composerMenuHost": "Modellmenü von DSH oder einem anderen Plugin",
|
|
7615
|
+
"legacyModelPicker": "Benutzerdefiniertes Modellmenü",
|
|
7616
|
+
"legacyModelPickerHint": "Ändere Tempo und Antwortlänge direkt im Modellmenü. Wenn du die Option ausschaltest, übernimmt DSH oder ein anderes Plugin das Menü. Die Abofunktionen bleiben verfügbar.",
|
|
7115
7617
|
"speedTitle": "Geschwindigkeit",
|
|
7116
7618
|
"speedStandard": "Standard",
|
|
7117
7619
|
"speedStandardHint": "Standardgeschwindigkeit",
|
|
@@ -8047,6 +8549,12 @@ window.__ModuleLoader__.load({
|
|
|
8047
8549
|
"runwayDays": "{days} д",
|
|
8048
8550
|
"runwayHours": "{hours} ч",
|
|
8049
8551
|
"runwayMinutes": "{minutes} мин",
|
|
8552
|
+
"composerSettingsTitle": "Поле ввода",
|
|
8553
|
+
"defaultSpeedTitle": "Скорость по умолчанию",
|
|
8554
|
+
"composerMenuCustom": "Настройка скорости в меню моделей",
|
|
8555
|
+
"composerMenuHost": "Меню DSH или другого плагина",
|
|
8556
|
+
"legacyModelPicker": "Настраиваемое меню моделей",
|
|
8557
|
+
"legacyModelPickerHint": "Меняйте скорость и подробность ответа в меню моделей. Если выключить настройку, меню предоставит DSH или другой плагин. Функции подписки останутся доступны.",
|
|
8050
8558
|
"speedTitle": "Скорость",
|
|
8051
8559
|
"speedStandard": "Стандартная",
|
|
8052
8560
|
"speedStandardHint": "Стандартная скорость",
|
|
@@ -8982,6 +9490,12 @@ window.__ModuleLoader__.load({
|
|
|
8982
9490
|
"runwayDays": "{days}d",
|
|
8983
9491
|
"runwayHours": "{hours}h",
|
|
8984
9492
|
"runwayMinutes": "{minutes}min",
|
|
9493
|
+
"composerSettingsTitle": "Caixa de mensagem",
|
|
9494
|
+
"defaultSpeedTitle": "Velocidade padrão",
|
|
9495
|
+
"composerMenuCustom": "Controle de velocidade no menu de modelos",
|
|
9496
|
+
"composerMenuHost": "Menu do DSH ou de outro plugin",
|
|
9497
|
+
"legacyModelPicker": "Menu de modelos personalizado",
|
|
9498
|
+
"legacyModelPickerHint": "Altere a velocidade e o nível de detalhe no menu de modelos. Ao desativar, o DSH ou outro plugin assume o menu. Os recursos da assinatura continuam disponíveis.",
|
|
8985
9499
|
"speedTitle": "Velocidade",
|
|
8986
9500
|
"speedStandard": "Padrão",
|
|
8987
9501
|
"speedStandardHint": "Velocidade padrão",
|
|
@@ -9047,6 +9561,45 @@ window.__ModuleLoader__.load({
|
|
|
9047
9561
|
//#endregion
|
|
9048
9562
|
//#region src/client-styles.js
|
|
9049
9563
|
const STYLE = `
|
|
9564
|
+
.codexModelSelect{position:relative;min-width:0}
|
|
9565
|
+
.codexModelSelectTrigger{display:flex;align-items:center;gap:4px;min-width:0;max-width:min(360px,45cqw);height:28px;padding:0 4px 0 8px;border:0;border-radius:var(--dsw-radius-sm);outline:0;background:transparent;color:var(--dsw-alias-label-secondary);font-size:13px;font-weight:500;line-height:20px;cursor:pointer}
|
|
9566
|
+
.codexModelSelectTrigger:hover:not(:disabled),.codexModelSelectTrigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}
|
|
9567
|
+
.codexModelSelectTrigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3)}
|
|
9568
|
+
.codexModelSelectTrigger:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}
|
|
9569
|
+
.codexModelSelectBolt{display:block;flex:none;width:14px;height:14px;color:var(--dsw-alias-label-primary)}
|
|
9570
|
+
.codexModelSelectLabel{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
9571
|
+
.codexModelSelectEffort{flex:none;color:var(--dsw-alias-label-caption)}
|
|
9572
|
+
.codexModelSelectChevron{flex:none;color:var(--dsw-alias-label-caption);transition:transform 120ms}
|
|
9573
|
+
.codexModelSelectTrigger[aria-expanded=true] .codexModelSelectChevron{transform:rotate(180deg)}
|
|
9574
|
+
.codexModelSelectMenu{inset:auto;margin:0;--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-sizing:border-box;position:fixed;display:flex;flex-direction:column;width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:min(420px,calc(100vw - 32px));max-height:min(360px,calc(100vh - 32px));padding:4px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,12px);background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1));box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);overflow:hidden}
|
|
9575
|
+
.codexModelSelectCell{box-sizing:border-box;display:flex;align-items:center;gap:6px;width:auto;min-width:100%;height:34px;padding:0 8px;border:none;border-radius:var(--dsw-radius-md);outline:none;background:transparent;color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;text-align:left;cursor:pointer}
|
|
9576
|
+
.codexModelSelectCell:hover,.codexModelSelectCell:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}
|
|
9577
|
+
.codexModelSelectCellLabel{flex:none;white-space:nowrap}
|
|
9578
|
+
.codexModelSelectCellValue{flex:auto;min-width:0;overflow:hidden;color:var(--dsw-alias-label-tertiary);text-align:right;text-overflow:ellipsis;white-space:nowrap}
|
|
9579
|
+
.codexModelSelectCellChevron{flex:none;width:12px;height:12px;color:var(--dsw-alias-menu-icon)}
|
|
9580
|
+
.codexModelSelectSearchRow{flex-shrink:0;position:relative;margin:2px 0 3px}
|
|
9581
|
+
.codexModelSelectSearchRow .codexModelSelectSearch{display:flex;height:auto;padding:5px 7px;border:0 solid transparent;border-radius:var(--dsw-radius-md);background:transparent}
|
|
9582
|
+
.codexModelSelectSearchRow .codexModelSelectSearch:focus-within{border-color:transparent}
|
|
9583
|
+
.codexModelSelectSearchRow .codexModelSelectSearch input{padding:0;font-size:12px;line-height:normal}
|
|
9584
|
+
.codexModelSelectSearchRow .codexModelSelectSearch input::placeholder{color:var(--dsw-alias-label-caption)}
|
|
9585
|
+
.codexModelSelectGroups{flex:1 1 auto;min-height:0;overflow-y:auto}
|
|
9586
|
+
.codexModelSelectGroupTitle{padding:5px 8px 3px;color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:500;line-height:18px}
|
|
9587
|
+
.codexModelSelectOption{box-sizing:border-box;display:flex;align-items:center;gap:6px;width:auto;min-width:100%;min-height:34px;padding:5px 7px;border:none;border-radius:var(--dsw-radius-md);outline:none;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
9588
|
+
.codexModelSelectOption:hover:not(:disabled),.codexModelSelectOption:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}
|
|
9589
|
+
.codexModelSelectOption:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}
|
|
9590
|
+
.codexModelSelectOptionCopy{display:flex;flex:1;flex-direction:column;min-width:0}
|
|
9591
|
+
.codexModelSelectOptionName{overflow:hidden;color:inherit;font-size:13px;font-weight:400;line-height:18px;text-overflow:ellipsis;white-space:nowrap}
|
|
9592
|
+
.codexModelSelectOptionDescription{overflow:hidden;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
|
|
9593
|
+
.codexModelSelectCheck{display:grid;place-items:center;flex:0 0 14px;color:var(--dsw-alias-label-primary)}
|
|
9594
|
+
.codexModelSelectCheck svg{width:14px;height:14px}
|
|
9595
|
+
.codexModelSelectStatus,.codexModelSelectEmpty{padding:8px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
|
|
9596
|
+
.codexModelSelectError,.codexModelSelectWarning{display:flex;align-items:flex-start;justify-content:space-between;gap:6px;margin-bottom:3px;padding:6px 7px;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);font-size:11px;line-height:16px}
|
|
9597
|
+
.codexModelSelectWarning{background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-state-warn-label)}
|
|
9598
|
+
.codexModelSelectRetry{flex:none;padding:0;border:none;background:transparent;color:inherit;font:inherit;font-weight:600;cursor:pointer}
|
|
9599
|
+
.codexModelSelectSearchRow{margin:2px 0 0;border-bottom:1px solid var(--dsw-alias-border-l2)}
|
|
9600
|
+
.codexModelSelectGroups{scroll-padding-block:30px;padding-top:2px}
|
|
9601
|
+
.codexModelSelectGroups [class*=_heading_]{background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-module-platform))}
|
|
9602
|
+
|
|
9050
9603
|
.codexSubscription[data-embedded=true]{max-width:960px}
|
|
9051
9604
|
.codexQuotaSettingsLink{display:block;width:100%;margin-top:8px;padding:8px 0 0;border:0;border-top:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-link,var(--dsw-alias-label-primary));font:inherit;text-align:start;cursor:pointer}
|
|
9052
9605
|
.codexQuotaSettingsLink:hover{text-decoration:underline}
|
|
@@ -9427,6 +9980,8 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
9427
9980
|
.codexFlat .codexSubscriptionPreferenceLabel small,.codexFlat .codexFeatureTitle small{line-height:16px;height:16px;display:inline-flex;align-items:center}
|
|
9428
9981
|
.codexFlat .codexSubscriptionPreferenceHint,.codexFlat .codexFeatureSummary{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
|
|
9429
9982
|
.codexFlat .codexSubscriptionPreferenceCopy{gap:0}
|
|
9983
|
+
.codexFlat .codexComposerMenuGroup>.codexSubscriptionPreference:not(:last-child){border-bottom:0;padding-bottom:0}
|
|
9984
|
+
.codexFlat .codexComposerMenuOption{padding-inline-start:16px;min-height:40px}
|
|
9430
9985
|
.codexFlat .codexSubscriptionDivider{display:none}
|
|
9431
9986
|
.codexFlat .codexSubscriptionQuotaModes{background:var(--dsw-alias-bg-module-platform);border-radius:10px;padding:2px;gap:2px;min-height:32px;box-sizing:border-box}
|
|
9432
9987
|
.codexFlat .codexSubscriptionQuotaMode{min-height:28px;border-radius:8px;padding:0 10px;font-size:13px;white-space:nowrap}
|
|
@@ -9489,6 +10044,40 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
9489
10044
|
.codexFeatureLoadNotice{position:fixed;z-index:1000;bottom:32px;left:50%;transform:translateX(-50%);padding:4px 8px;border:1px solid var(--dsw-alias-line-base,rgba(128,128,128,.2));border-radius:12px;background:var(--dsw-alias-bg-layer-1,#fff);box-shadow:0 4px 16px rgba(0,0,0,.08)}
|
|
9490
10045
|
@keyframes codexFeatureLoading{to{transform:rotate(360deg)}}
|
|
9491
10046
|
@media(prefers-reduced-motion:reduce){.codexFeatureLoadingIcon{animation:none}}
|
|
10047
|
+
.dcsButton{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:4px;height:36px;padding:0 14px;border:0;border-radius:var(--dsw-radius-md,12px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;line-height:22px;cursor:pointer}
|
|
10048
|
+
.dcsButton[data-size=sm]{height:28px;padding:0 10px;border-radius:var(--dsw-radius-sm,8px);font-size:12px;line-height:18px}
|
|
10049
|
+
.dcsButton[data-variant=outline]{box-shadow:inset 0 0 0 var(--dsh-hairline-width,.5px) var(--dsw-alias-border-l3)}
|
|
10050
|
+
.dcsButton[data-variant=primary]{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}
|
|
10051
|
+
.dcsButton:hover:not(:disabled),.dcsMenu button:hover:not(:disabled),.dcsMenu button:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}
|
|
10052
|
+
.dcsButton[data-variant=primary]:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}
|
|
10053
|
+
.dcsButton:disabled,.dcsSwitch:disabled{cursor:default;opacity:.4}
|
|
10054
|
+
.dcsButtonIcon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}
|
|
10055
|
+
.dcsInput{display:inline-flex;align-items:center;height:32px;padding:0 8px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md,12px);background:var(--dsw-alias-bg-layer-1)}
|
|
10056
|
+
.dcsInput:focus-within{border-color:var(--dsw-alias-state-business-primary)}
|
|
10057
|
+
.dcsInput input{flex:1;min-width:0;border:0;outline:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px}
|
|
10058
|
+
.dcsInput input::placeholder{color:var(--dsw-alias-label-dimmed)}
|
|
10059
|
+
.dcsSwitch{box-sizing:border-box;flex:none;width:36px;height:20px;padding:2px;border:0;border-radius:999px;corner-shape:round;background:var(--dsw-alias-border-l3);cursor:pointer}
|
|
10060
|
+
.dcsSwitch[aria-checked=true]{background:var(--dsw-alias-brand-primary)}
|
|
10061
|
+
.dcsSwitch>span{display:block;width:16px;height:16px;border-radius:50%;corner-shape:round;background:var(--dsw-alias-switch-thumb);transition:transform 120ms ease}
|
|
10062
|
+
.dcsSwitch[aria-checked=true]>span{transform:translateX(16px);background:var(--dsw-alias-label-primary-foreground)}
|
|
10063
|
+
.dcsButton:focus-visible,.dcsSwitch:focus-visible,.dcsLightbox button:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
10064
|
+
.dcsMenu,.dcsTooltip,.codexQuotaPopover[popover]{position:fixed;inset:auto;margin:0;box-sizing:border-box;max-width:calc(100vw - 24px);max-height:calc(100vh - 24px);overflow:auto}
|
|
10065
|
+
.dcsMenu{z-index:1100;min-width:min(144px,calc(100vw - 24px));width:max-content;padding:4px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,12px);color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-layer-1));box-shadow:var(--dsw-elevation-prominent)}
|
|
10066
|
+
.dcsMenu button{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:28px;padding:3px 8px;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:inherit;text-align:start;font:inherit;font-size:13px;cursor:pointer}
|
|
10067
|
+
.dcsMenu button:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}
|
|
10068
|
+
.dcsMenu button>span{min-width:0;overflow-wrap:anywhere}
|
|
10069
|
+
.dcsMenu button svg{flex:none}
|
|
10070
|
+
.dcsMenuSeparator{height:1px;margin:4px;background:var(--dsw-alias-border-l2)}
|
|
10071
|
+
.dcsMenuLabel{padding:4px 8px;color:var(--dsw-alias-label-secondary);font-size:12px}
|
|
10072
|
+
.dcsMenuChildren{margin-inline-start:10px;padding-inline-start:4px;border-inline-start:1px solid var(--dsw-alias-border-l2)}
|
|
10073
|
+
.dcsTooltip{z-index:1100;width:max-content;max-width:min(360px,calc(100vw - 24px));padding:3px 7px;border:0;border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-tooltip-bg);color:var(--dsw-alias-toast-label);font-size:13px;line-height:20px;white-space:pre-line;overflow-wrap:anywhere;pointer-events:none}
|
|
10074
|
+
.dcsTooltip[data-pinned]{pointer-events:auto}
|
|
10075
|
+
.dcsLightbox{position:fixed;inset:0;box-sizing:border-box;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:48px 24px 24px;border:0;overflow:hidden;background:transparent}
|
|
10076
|
+
.dcsLightbox[open]{display:grid;place-items:center}
|
|
10077
|
+
.dcsLightbox::backdrop{background:var(--dsw-alias-bg-mask-1);backdrop-filter:var(--dsw-mask-blur);clip-path:inset(var(--dsh-frame-chrome-top,0px) 0 0)}
|
|
10078
|
+
.dcsLightbox img{max-width:100%;max-height:100%;object-fit:contain}
|
|
10079
|
+
.dcsLightbox button{position:absolute;inset-block-start:calc(var(--dsh-frame-chrome-top,0px) + 16px);inset-inline-end:16px;display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--dsw-alias-border-l2);border-radius:999px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);cursor:pointer}
|
|
10080
|
+
@media(prefers-reduced-motion:reduce){.dcsSwitch>span{transition:none}}
|
|
9492
10081
|
`;
|
|
9493
10082
|
//#endregion
|
|
9494
10083
|
//#region src/image-edit-reference.js
|
|
@@ -9765,17 +10354,8 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
9765
10354
|
close() {
|
|
9766
10355
|
if (this.#snapshot === void 0) return;
|
|
9767
10356
|
this.#cancelOperations();
|
|
9768
|
-
const opener = this.#snapshot.opener;
|
|
9769
10357
|
this.#snapshot = void 0;
|
|
9770
10358
|
this.#emit();
|
|
9771
|
-
if (typeof window === "undefined") opener?.focus();
|
|
9772
|
-
else {
|
|
9773
|
-
const focus = () => {
|
|
9774
|
-
opener?.focus();
|
|
9775
|
-
};
|
|
9776
|
-
if (typeof window.requestAnimationFrame === "function") window.requestAnimationFrame(focus);
|
|
9777
|
-
else focus();
|
|
9778
|
-
}
|
|
9779
10359
|
}
|
|
9780
10360
|
#emit() {
|
|
9781
10361
|
for (const listener of this.#listeners) listener();
|
|
@@ -10062,6 +10642,11 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
10062
10642
|
"fast",
|
|
10063
10643
|
"ultrafast"
|
|
10064
10644
|
].includes(value) ? value : DEFAULT_SPEED_MODE;
|
|
10645
|
+
function effectiveCodexSpeedMode(mode, modelId, capability) {
|
|
10646
|
+
if (mode === "ultrafast" && capability?.supportsUltrafast === true) return mode;
|
|
10647
|
+
if (mode === "fast" && (capability?.supportsFast ?? supportsCodexFastMode(modelId))) return mode;
|
|
10648
|
+
return SPEED_MODE_STANDARD;
|
|
10649
|
+
}
|
|
10065
10650
|
const normalizeContextMode = (value) => [
|
|
10066
10651
|
"standard",
|
|
10067
10652
|
"extended",
|
|
@@ -10086,6 +10671,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
10086
10671
|
"bar",
|
|
10087
10672
|
"forecast"
|
|
10088
10673
|
].includes(value) ? value : legacyVisible === true ? QUICK_QUOTA_MODE_PERCENT : "off";
|
|
10674
|
+
const supportsCodexFastMode = (modelId) => typeof modelId === "string" && (/^gpt-5\.(?:5|6)(?:$|-)/u.test(modelId) || modelId === "gpt-5.4" || modelId === "gpt-6-astra");
|
|
10089
10675
|
//#endregion
|
|
10090
10676
|
//#region src/subagent-defaults.js
|
|
10091
10677
|
const SUBAGENT_EFFORTS = Object.freeze(DEFAULT_REASONING_EFFORTS.filter((value) => value !== "ultra"));
|
|
@@ -10116,6 +10702,11 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
10116
10702
|
default: "off",
|
|
10117
10703
|
error: "Invalid input prediction setting"
|
|
10118
10704
|
},
|
|
10705
|
+
composerModelPicker: {
|
|
10706
|
+
choices: ["dsh", "legacy"],
|
|
10707
|
+
default: "legacy",
|
|
10708
|
+
error: "Invalid composer model picker"
|
|
10709
|
+
},
|
|
10119
10710
|
connectionMode: {
|
|
10120
10711
|
choices: ["sse", "websocket"],
|
|
10121
10712
|
default: "sse",
|
|
@@ -10281,6 +10872,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
10281
10872
|
reviewModel: value?.reviewModel === "official" ? "official" : "session",
|
|
10282
10873
|
remoteControl: value?.remoteControl === "on" ? "on" : "off",
|
|
10283
10874
|
composerPredictions: value?.composerPredictions === "on" ? "on" : "off",
|
|
10875
|
+
composerModelPicker: value?.composerModelPicker === "dsh" ? "dsh" : "legacy",
|
|
10284
10876
|
otherModels: value?.otherModels === "off" ? "off" : "on",
|
|
10285
10877
|
compactionMode: value?.compactionMode === "cloud" ? "cloud" : "dsh",
|
|
10286
10878
|
reasoningCache: normalizeReasoningCache(value?.reasoningCache),
|
|
@@ -10362,6 +10954,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
10362
10954
|
reviewModel: value?.reviewModel === "official" ? "official" : "session",
|
|
10363
10955
|
remoteControl: value?.remoteControl === "on" ? "on" : "off",
|
|
10364
10956
|
composerPredictions: value?.composerPredictions === "on" ? "on" : "off",
|
|
10957
|
+
composerModelPicker: value?.composerModelPicker === "dsh" ? "dsh" : "legacy",
|
|
10365
10958
|
otherModels: value?.otherModels === "off" ? "off" : "on",
|
|
10366
10959
|
otherModels: value?.otherModels === "off" ? "off" : "on",
|
|
10367
10960
|
compactionMode: value?.compactionMode === "cloud" ? "cloud" : "dsh",
|
|
@@ -11017,7 +11610,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11017
11610
|
}
|
|
11018
11611
|
//#endregion
|
|
11019
11612
|
//#region src/version.js
|
|
11020
|
-
const PACKAGE_VERSION = "3.2.
|
|
11613
|
+
const PACKAGE_VERSION = "3.2.8";
|
|
11021
11614
|
//#endregion
|
|
11022
11615
|
//#region src/client-recovery.js
|
|
11023
11616
|
async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = endpoint === "usage" || endpoint.startsWith("usage/") ? 3e4 : 1e4) {
|
|
@@ -11261,6 +11854,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11261
11854
|
(0, react.useEffect)(() => () => clearTimeout(dismissTimer.current), []);
|
|
11262
11855
|
const id = (0, react.useId)();
|
|
11263
11856
|
const visible = open && quotaEnabled && !!quotas?.length;
|
|
11857
|
+
usePopover(panel, visible);
|
|
11264
11858
|
const position = useAnchoredPosition({
|
|
11265
11859
|
open: visible,
|
|
11266
11860
|
anchorRef: trigger,
|
|
@@ -11330,9 +11924,10 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11330
11924
|
preferenceSnapshot.quickQuotaMode !== "bar" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: `${percent(quota.remainingPercent)}%` }) : null
|
|
11331
11925
|
]
|
|
11332
11926
|
}, `${quota.windowSeconds}-${index}`))
|
|
11333
|
-
}), visible ?
|
|
11927
|
+
}), visible ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
11334
11928
|
ref: panel,
|
|
11335
11929
|
id,
|
|
11930
|
+
popover: "manual",
|
|
11336
11931
|
role: "dialog",
|
|
11337
11932
|
"aria-label": t("quotaDetails"),
|
|
11338
11933
|
className: "codexQuotaPopover",
|
|
@@ -11362,7 +11957,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11362
11957
|
},
|
|
11363
11958
|
children: t("openSubscriptionSettings")
|
|
11364
11959
|
}) : null]
|
|
11365
|
-
})
|
|
11960
|
+
}) : null] });
|
|
11366
11961
|
}
|
|
11367
11962
|
function shortWindow(seconds, t) {
|
|
11368
11963
|
if (Math.abs(seconds - 604800) < 60) return t("quotaShortWeek");
|
|
@@ -11380,22 +11975,435 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11380
11975
|
return fill(t("resets"), { value });
|
|
11381
11976
|
}
|
|
11382
11977
|
//#endregion
|
|
11978
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@18.3.1/node_modules/@heroicons/react/16/solid/esm/BoltIcon.js
|
|
11979
|
+
function BoltIcon({ title, titleId, ...props }, svgRef) {
|
|
11980
|
+
return /*#__PURE__*/ react.createElement("svg", Object.assign({
|
|
11981
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11982
|
+
viewBox: "0 0 16 16",
|
|
11983
|
+
fill: "currentColor",
|
|
11984
|
+
"aria-hidden": "true",
|
|
11985
|
+
"data-slot": "icon",
|
|
11986
|
+
ref: svgRef,
|
|
11987
|
+
"aria-labelledby": titleId
|
|
11988
|
+
}, props), title ? /*#__PURE__*/ react.createElement("title", { id: titleId }, title) : null, /*#__PURE__*/ react.createElement("path", {
|
|
11989
|
+
fillRule: "evenodd",
|
|
11990
|
+
d: "M9.58 1.077a.75.75 0 0 1 .405.82L9.165 6h4.085a.75.75 0 0 1 .567 1.241l-6.5 7.5a.75.75 0 0 1-1.302-.638L6.835 10H2.75a.75.75 0 0 1-.567-1.241l6.5-7.5a.75.75 0 0 1 .897-.182Z",
|
|
11991
|
+
clipRule: "evenodd"
|
|
11992
|
+
}));
|
|
11993
|
+
}
|
|
11994
|
+
const ForwardRef = /*#__PURE__*/ react.forwardRef(BoltIcon);
|
|
11995
|
+
//#endregion
|
|
11996
|
+
//#region src/client-model-select.jsx
|
|
11997
|
+
function CodexModelSelect({ locked, available, directory, load, select, preference, t }) {
|
|
11998
|
+
const state = (0, react.useSyncExternalStore)(directory.subscribe, directory.getSnapshot);
|
|
11999
|
+
const preferenceSnapshot = usePreferenceSnapshot(preference);
|
|
12000
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
12001
|
+
const [pane, setPane] = (0, react.useState)("root");
|
|
12002
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
12003
|
+
const menuRef = (0, react.useRef)(null);
|
|
12004
|
+
const triggerRef = (0, react.useRef)(null);
|
|
12005
|
+
const id = (0, react.useId)();
|
|
12006
|
+
const choices = (0, react.useMemo)(() => state.groups.flatMap((group) => group.models.map((model) => ({
|
|
12007
|
+
group,
|
|
12008
|
+
model,
|
|
12009
|
+
selection: {
|
|
12010
|
+
provider: group.id,
|
|
12011
|
+
model: model.id,
|
|
12012
|
+
...model.reasoning?.defaultEffort === void 0 ? {} : { reasoningEffort: model.reasoning.defaultEffort }
|
|
12013
|
+
}
|
|
12014
|
+
}))), [state.groups]);
|
|
12015
|
+
const visibleGroups = (0, react.useMemo)(() => {
|
|
12016
|
+
const hidden = new Set(preferenceSnapshot.disabledModels);
|
|
12017
|
+
return state.groups.map((group) => group.id === "openai-codex" ? {
|
|
12018
|
+
...group,
|
|
12019
|
+
models: group.models.filter((model) => !hidden.has(model.id)),
|
|
12020
|
+
allHidden: group.models.length > 0 && group.models.every((model) => hidden.has(model.id))
|
|
12021
|
+
} : group).filter((group) => group.models.length > 0 || group.allHidden === true);
|
|
12022
|
+
}, [state.groups, preferenceSnapshot.disabledModels]);
|
|
12023
|
+
const currentChoice = choices.find((choice) => choice.selection.provider === state.current?.provider && choice.selection.model === state.current?.model);
|
|
12024
|
+
const reasoning = currentChoice?.model.reasoning;
|
|
12025
|
+
const effectiveEffort = state.current?.reasoningEffort ?? reasoning?.defaultEffort;
|
|
12026
|
+
const effortLabel = reasoning === void 0 ? void 0 : effectiveEffort === void 0 ? t("providerDefault") : reasoning.efforts.find((level) => level.id === effectiveEffort)?.name ?? effectiveEffort;
|
|
12027
|
+
const effortChoices = (0, react.useMemo)(() => reasoning === void 0 ? [] : [...reasoning.defaultEffort === void 0 ? [{
|
|
12028
|
+
key: "provider-default",
|
|
12029
|
+
effort: void 0,
|
|
12030
|
+
label: t("providerDefault")
|
|
12031
|
+
}] : [], ...reasoning.efforts.map((effort) => ({
|
|
12032
|
+
key: `effort:${effort.id}`,
|
|
12033
|
+
effort: effort.id,
|
|
12034
|
+
label: effort.name,
|
|
12035
|
+
...effort.description === void 0 ? {} : { description: effort.description }
|
|
12036
|
+
}))], [reasoning, t]);
|
|
12037
|
+
const modelLabel = currentChoice?.model.name ?? t("selectModel");
|
|
12038
|
+
const searchable = visibleGroups.reduce((total, group) => total + group.models.length, 0) > 4;
|
|
12039
|
+
const needle = searchable ? query.trim().toLocaleLowerCase() : "";
|
|
12040
|
+
const shownGroups = needle === "" ? visibleGroups : visibleGroups.map((group) => ({
|
|
12041
|
+
...group,
|
|
12042
|
+
models: group.models.filter((model) => [
|
|
12043
|
+
model.name,
|
|
12044
|
+
model.id,
|
|
12045
|
+
model.description,
|
|
12046
|
+
group.name
|
|
12047
|
+
].some((text) => typeof text === "string" && text.toLocaleLowerCase().includes(needle)))
|
|
12048
|
+
})).filter((group) => group.models.length > 0);
|
|
12049
|
+
const speedSupported = state.current?.provider === "openai-codex" && (preferenceSnapshot.fastModels?.includes(state.current?.model) ?? supportsCodexFastMode(state.current?.model));
|
|
12050
|
+
const speedWritable = preferenceSnapshot.status === "ready" && preferenceSnapshot.writable === true && !preferenceSnapshot.saving;
|
|
12051
|
+
const ultrafastSupported = state.current?.provider === "openai-codex" && (preferenceSnapshot.ultrafastModels ?? []).includes(state.current?.model);
|
|
12052
|
+
const effectiveSpeed = effectiveCodexSpeedMode(preferenceSnapshot.speedMode, state.current?.model, {
|
|
12053
|
+
supportsFast: speedSupported,
|
|
12054
|
+
supportsUltrafast: ultrafastSupported
|
|
12055
|
+
});
|
|
12056
|
+
const ultrafast = effectiveSpeed === SPEED_MODE_ULTRAFAST;
|
|
12057
|
+
const fast = effectiveSpeed !== SPEED_MODE_STANDARD;
|
|
12058
|
+
const speedKey = ultrafast ? "speedUltrafast" : fast ? "speedFast" : "speedStandard";
|
|
12059
|
+
const verbositySupported = state.current?.provider === "openai-codex" && preferenceSnapshot.verbosityModels.includes(state.current?.model);
|
|
12060
|
+
const verbosityWritable = preferenceSnapshot.status === "ready" && preferenceSnapshot.writable === true;
|
|
12061
|
+
const verbosityItems = [
|
|
12062
|
+
{
|
|
12063
|
+
id: OUTPUT_VERBOSITY_DEFAULT,
|
|
12064
|
+
label: t("verbosityDefault"),
|
|
12065
|
+
description: t("verbosityDefaultHint")
|
|
12066
|
+
},
|
|
12067
|
+
{
|
|
12068
|
+
id: "low",
|
|
12069
|
+
label: t("verbosityLow"),
|
|
12070
|
+
description: t("verbosityLowHint")
|
|
12071
|
+
},
|
|
12072
|
+
{
|
|
12073
|
+
id: OUTPUT_VERBOSITY_MEDIUM,
|
|
12074
|
+
label: t("verbosityMedium"),
|
|
12075
|
+
description: t("verbosityMediumHint")
|
|
12076
|
+
},
|
|
12077
|
+
{
|
|
12078
|
+
id: OUTPUT_VERBOSITY_HIGH,
|
|
12079
|
+
label: t("verbosityHigh"),
|
|
12080
|
+
description: t("verbosityHighHint")
|
|
12081
|
+
}
|
|
12082
|
+
];
|
|
12083
|
+
const verbosityLabel = verbosityItems.find((item) => item.id === preferenceSnapshot.outputVerbosity)?.label ?? t("verbosityDefault");
|
|
12084
|
+
const busy = state.status === "selecting";
|
|
12085
|
+
(0, react.useEffect)(() => {
|
|
12086
|
+
if (available) load();
|
|
12087
|
+
}, [available, load]);
|
|
12088
|
+
(0, react.useEffect)(() => {
|
|
12089
|
+
if (pane !== "model") setQuery("");
|
|
12090
|
+
}, [pane]);
|
|
12091
|
+
(0, react.useEffect)(() => {
|
|
12092
|
+
if (!speedSupported && !ultrafastSupported && pane === "speed") setPane("root");
|
|
12093
|
+
if (!verbositySupported && pane === "verbosity") setPane("root");
|
|
12094
|
+
}, [
|
|
12095
|
+
pane,
|
|
12096
|
+
speedSupported,
|
|
12097
|
+
ultrafastSupported,
|
|
12098
|
+
verbositySupported
|
|
12099
|
+
]);
|
|
12100
|
+
const close = (restoreFocus = false) => {
|
|
12101
|
+
setOpen(false);
|
|
12102
|
+
setPane("root");
|
|
12103
|
+
setQuery("");
|
|
12104
|
+
if (restoreFocus) queueMicrotask(() => triggerRef.current?.focus());
|
|
12105
|
+
};
|
|
12106
|
+
usePopover(menuRef, open);
|
|
12107
|
+
const menuPos = useAnchoredPosition({
|
|
12108
|
+
open,
|
|
12109
|
+
anchorRef: triggerRef,
|
|
12110
|
+
panelRef: menuRef,
|
|
12111
|
+
side: "top",
|
|
12112
|
+
align: "end"
|
|
12113
|
+
});
|
|
12114
|
+
useDismissOnOutsidePointer(triggerRef, open, close, menuRef);
|
|
12115
|
+
if (!available) return null;
|
|
12116
|
+
const settleSelection = (accepted) => {
|
|
12117
|
+
if (accepted) close(true);
|
|
12118
|
+
};
|
|
12119
|
+
const chooseModel = (selection) => {
|
|
12120
|
+
if (state.current?.provider === selection.provider && state.current.model === selection.model) {
|
|
12121
|
+
close(true);
|
|
12122
|
+
return;
|
|
12123
|
+
}
|
|
12124
|
+
select(selection).then(settleSelection);
|
|
12125
|
+
};
|
|
12126
|
+
const chooseEffort = (effort) => {
|
|
12127
|
+
if (state.current === null) return;
|
|
12128
|
+
if (effectiveEffort === effort) {
|
|
12129
|
+
close(true);
|
|
12130
|
+
return;
|
|
12131
|
+
}
|
|
12132
|
+
select({
|
|
12133
|
+
provider: state.current.provider,
|
|
12134
|
+
model: state.current.model,
|
|
12135
|
+
...effort === void 0 ? {} : { reasoningEffort: effort }
|
|
12136
|
+
}).then(settleSelection);
|
|
12137
|
+
};
|
|
12138
|
+
const chooseSpeed = (speedMode) => {
|
|
12139
|
+
close(true);
|
|
12140
|
+
preference.set({ [SPEED_MODE_FIELD]: speedMode });
|
|
12141
|
+
};
|
|
12142
|
+
const chooseVerbosity = (outputVerbosity) => {
|
|
12143
|
+
close(true);
|
|
12144
|
+
preference.set({ [OUTPUT_VERBOSITY_FIELD]: outputVerbosity });
|
|
12145
|
+
};
|
|
12146
|
+
const option = ({ key, label, description, selected, disabled, onClick }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
12147
|
+
type: "button",
|
|
12148
|
+
role: "menuitemradio",
|
|
12149
|
+
"aria-checked": selected,
|
|
12150
|
+
className: "codexModelSelectOption",
|
|
12151
|
+
disabled,
|
|
12152
|
+
onClick,
|
|
12153
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
12154
|
+
className: "codexModelSelectOptionCopy",
|
|
12155
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12156
|
+
className: "codexModelSelectOptionName",
|
|
12157
|
+
children: label
|
|
12158
|
+
}), description === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12159
|
+
className: "codexModelSelectOptionDescription",
|
|
12160
|
+
children: description
|
|
12161
|
+
})]
|
|
12162
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12163
|
+
className: "codexModelSelectCheck",
|
|
12164
|
+
children: selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheckOutline16, {}) : null
|
|
12165
|
+
})]
|
|
12166
|
+
}, key);
|
|
12167
|
+
const cell = (target, label, value) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
12168
|
+
type: "button",
|
|
12169
|
+
role: "menuitem",
|
|
12170
|
+
className: "codexModelSelectCell",
|
|
12171
|
+
onClick: () => {
|
|
12172
|
+
setQuery("");
|
|
12173
|
+
setPane(target);
|
|
12174
|
+
},
|
|
12175
|
+
children: [
|
|
12176
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12177
|
+
className: "codexModelSelectCellLabel",
|
|
12178
|
+
children: label
|
|
12179
|
+
}),
|
|
12180
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12181
|
+
className: "codexModelSelectCellValue",
|
|
12182
|
+
children: value
|
|
12183
|
+
}),
|
|
12184
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronRightOutline14, { className: "codexModelSelectCellChevron" })
|
|
12185
|
+
]
|
|
12186
|
+
});
|
|
12187
|
+
const group = (key, label, children) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
12188
|
+
role: "group",
|
|
12189
|
+
"aria-label": label,
|
|
12190
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12191
|
+
className: "codexModelSelectGroupTitle",
|
|
12192
|
+
children: label
|
|
12193
|
+
}), children]
|
|
12194
|
+
}, key);
|
|
12195
|
+
let content = null;
|
|
12196
|
+
if (pane === "root") content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12197
|
+
cell("model", t("modelLabel"), modelLabel),
|
|
12198
|
+
reasoning === void 0 ? null : cell("effort", t("effortLabel"), effortLabel),
|
|
12199
|
+
(speedSupported || ultrafastSupported) && cell("speed", t("speedTitle"), t(speedKey)),
|
|
12200
|
+
verbositySupported && cell("verbosity", t("verbosityTitle"), verbosityLabel)
|
|
12201
|
+
] });
|
|
12202
|
+
else if (pane === "model") content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12203
|
+
searchable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12204
|
+
className: "codexModelSelectSearchRow",
|
|
12205
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
|
|
12206
|
+
className: "codexModelSelectSearch",
|
|
12207
|
+
type: "text",
|
|
12208
|
+
role: "searchbox",
|
|
12209
|
+
value: query,
|
|
12210
|
+
autoFocus: true,
|
|
12211
|
+
placeholder: t("modelSearch"),
|
|
12212
|
+
"aria-label": t("modelSearch"),
|
|
12213
|
+
onChange: (event) => setQuery(event.target.value)
|
|
12214
|
+
})
|
|
12215
|
+
}) : null,
|
|
12216
|
+
state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12217
|
+
className: "codexModelSelectStatus",
|
|
12218
|
+
children: t("modelsLoading")
|
|
12219
|
+
}) : null,
|
|
12220
|
+
state.error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12221
|
+
className: "codexModelSelectError",
|
|
12222
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: fill(t("modelFailed"), { value: state.error }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
12223
|
+
className: "codexModelSelectRetry",
|
|
12224
|
+
type: "button",
|
|
12225
|
+
onClick: load,
|
|
12226
|
+
children: t("modelRetry")
|
|
12227
|
+
})]
|
|
12228
|
+
}),
|
|
12229
|
+
state.failures.map((failure) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12230
|
+
className: "codexModelSelectWarning",
|
|
12231
|
+
children: fill(t("groupFailed"), {
|
|
12232
|
+
name: failure.name,
|
|
12233
|
+
value: failure.message
|
|
12234
|
+
})
|
|
12235
|
+
}, failure.id)),
|
|
12236
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12237
|
+
className: "codexModelSelectGroups scrollable",
|
|
12238
|
+
role: "menu",
|
|
12239
|
+
"aria-label": t("modelLabel"),
|
|
12240
|
+
children: shownGroups.map((entry) => group(entry.id, entry.name, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [entry.allHidden === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12241
|
+
className: "codexModelSelectEmpty",
|
|
12242
|
+
children: t("modelsHidden")
|
|
12243
|
+
}) : null, entry.models.map((model) => option({
|
|
12244
|
+
key: model.id,
|
|
12245
|
+
label: model.name,
|
|
12246
|
+
selected: state.current?.provider === entry.id && state.current.model === model.id,
|
|
12247
|
+
disabled: busy,
|
|
12248
|
+
onClick: () => chooseModel({
|
|
12249
|
+
provider: entry.id,
|
|
12250
|
+
model: model.id
|
|
12251
|
+
})
|
|
12252
|
+
}))] })))
|
|
12253
|
+
}),
|
|
12254
|
+
state.status === "ready" && visibleGroups.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12255
|
+
className: "codexModelSelectEmpty",
|
|
12256
|
+
children: t(choices.length === 0 ? "modelsEmpty" : "modelsHidden")
|
|
12257
|
+
}) : null,
|
|
12258
|
+
state.status === "ready" && visibleGroups.length > 0 && shownGroups.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12259
|
+
className: "codexModelSelectEmpty",
|
|
12260
|
+
children: t("modelNoMatch")
|
|
12261
|
+
}) : null
|
|
12262
|
+
] });
|
|
12263
|
+
else if (pane === "effort") content = effortChoices.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12264
|
+
className: "codexModelSelectEmpty",
|
|
12265
|
+
children: t("effortsEmpty")
|
|
12266
|
+
}) : effortChoices.map((level) => option({
|
|
12267
|
+
key: level.key,
|
|
12268
|
+
label: level.label,
|
|
12269
|
+
description: level.description,
|
|
12270
|
+
selected: effectiveEffort === level.effort,
|
|
12271
|
+
disabled: busy,
|
|
12272
|
+
onClick: () => chooseEffort(level.effort)
|
|
12273
|
+
}));
|
|
12274
|
+
else if (pane === "speed") content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12275
|
+
option({
|
|
12276
|
+
key: SPEED_MODE_STANDARD,
|
|
12277
|
+
label: t("speedStandard"),
|
|
12278
|
+
description: t("speedStandardHint"),
|
|
12279
|
+
selected: !fast,
|
|
12280
|
+
disabled: !speedWritable,
|
|
12281
|
+
onClick: () => chooseSpeed(SPEED_MODE_STANDARD)
|
|
12282
|
+
}),
|
|
12283
|
+
speedSupported && option({
|
|
12284
|
+
key: "fast",
|
|
12285
|
+
label: t("speedFast"),
|
|
12286
|
+
description: t(state.current?.model === "gpt-6-astra" ? "speedFastAstraHint" : "speedFastHint"),
|
|
12287
|
+
selected: fast && !ultrafast,
|
|
12288
|
+
disabled: !speedWritable,
|
|
12289
|
+
onClick: () => chooseSpeed("fast")
|
|
12290
|
+
}),
|
|
12291
|
+
ultrafastSupported && option({
|
|
12292
|
+
key: "ultrafast",
|
|
12293
|
+
label: t("speedUltrafast"),
|
|
12294
|
+
description: t("speedUltrafastHint"),
|
|
12295
|
+
selected: ultrafast,
|
|
12296
|
+
disabled: !speedWritable,
|
|
12297
|
+
onClick: () => chooseSpeed("ultrafast")
|
|
12298
|
+
})
|
|
12299
|
+
] });
|
|
12300
|
+
else if (pane === "verbosity") content = verbosityItems.map((item) => option({
|
|
12301
|
+
key: item.id,
|
|
12302
|
+
label: item.label,
|
|
12303
|
+
description: item.description,
|
|
12304
|
+
selected: preferenceSnapshot.outputVerbosity === item.id,
|
|
12305
|
+
disabled: !verbosityWritable,
|
|
12306
|
+
onClick: () => chooseVerbosity(item.id)
|
|
12307
|
+
}));
|
|
12308
|
+
const menu = open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12309
|
+
ref: menuRef,
|
|
12310
|
+
id: `${id}-menu`,
|
|
12311
|
+
className: "codexModelSelectMenu",
|
|
12312
|
+
popover: "manual",
|
|
12313
|
+
style: {
|
|
12314
|
+
...menuPos,
|
|
12315
|
+
visibility: menuPos ? "visible" : "hidden"
|
|
12316
|
+
},
|
|
12317
|
+
role: pane === "model" ? "group" : "menu",
|
|
12318
|
+
"aria-label": t("modelMenuAria"),
|
|
12319
|
+
"aria-busy": state.status === "loading" || busy,
|
|
12320
|
+
onKeyDown: (event) => {
|
|
12321
|
+
if (event.key !== "Escape") return;
|
|
12322
|
+
event.preventDefault();
|
|
12323
|
+
event.stopPropagation();
|
|
12324
|
+
if (pane === "root") close(true);
|
|
12325
|
+
else setPane("root");
|
|
12326
|
+
},
|
|
12327
|
+
children: content
|
|
12328
|
+
}) : null;
|
|
12329
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12330
|
+
className: "codexModelSelect",
|
|
12331
|
+
onKeyDown: (event) => {
|
|
12332
|
+
if (event.key !== "Escape" || !open) return;
|
|
12333
|
+
event.preventDefault();
|
|
12334
|
+
if (pane === "root") close(true);
|
|
12335
|
+
else setPane("root");
|
|
12336
|
+
},
|
|
12337
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
12338
|
+
ref: triggerRef,
|
|
12339
|
+
type: "button",
|
|
12340
|
+
className: "codexModelSelectTrigger",
|
|
12341
|
+
"aria-label": fast ? `${modelLabel} · ${t(speedKey)}` : modelLabel,
|
|
12342
|
+
"aria-haspopup": "menu",
|
|
12343
|
+
"aria-expanded": open,
|
|
12344
|
+
"aria-controls": open ? `${id}-menu` : void 0,
|
|
12345
|
+
title: fast ? `${modelLabel} · ${t(speedKey)}` : modelLabel,
|
|
12346
|
+
disabled: locked,
|
|
12347
|
+
onClick: () => open ? close() : (setPane("root"), setOpen(true), load()),
|
|
12348
|
+
children: [
|
|
12349
|
+
fast && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ForwardRef, {
|
|
12350
|
+
className: "codexModelSelectBolt",
|
|
12351
|
+
"aria-hidden": "true"
|
|
12352
|
+
}),
|
|
12353
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12354
|
+
className: "codexModelSelectLabel",
|
|
12355
|
+
children: modelLabel
|
|
12356
|
+
}),
|
|
12357
|
+
effortLabel === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12358
|
+
className: "codexModelSelectEffort",
|
|
12359
|
+
children: effortLabel
|
|
12360
|
+
}),
|
|
12361
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconChevronDownOutline14, { className: "codexModelSelectChevron" })
|
|
12362
|
+
]
|
|
12363
|
+
}), menu]
|
|
12364
|
+
});
|
|
12365
|
+
}
|
|
12366
|
+
//#endregion
|
|
12367
|
+
//#region src/client-model-picker-slot.js
|
|
12368
|
+
const slot = "conversation.input.model";
|
|
12369
|
+
function registerLegacyModelPicker(slots, preference, props, component) {
|
|
12370
|
+
return slots.inject(slot, () => {
|
|
12371
|
+
let dispose;
|
|
12372
|
+
const sync = () => {
|
|
12373
|
+
const state = preference.getSnapshot();
|
|
12374
|
+
if (state.status === "ready" && state.composerModelPicker === "legacy") {
|
|
12375
|
+
if (!dispose && !slots.entries(slot).some((entry) => entry.options.priority === -1)) dispose = slots.register({
|
|
12376
|
+
name: slot,
|
|
12377
|
+
priority: -1,
|
|
12378
|
+
inject: props
|
|
12379
|
+
}, component);
|
|
12380
|
+
} else {
|
|
12381
|
+
dispose?.();
|
|
12382
|
+
dispose = void 0;
|
|
12383
|
+
}
|
|
12384
|
+
};
|
|
12385
|
+
sync();
|
|
12386
|
+
const unwatch = preference.subscribe(sync);
|
|
12387
|
+
return () => {
|
|
12388
|
+
unwatch();
|
|
12389
|
+
dispose?.();
|
|
12390
|
+
};
|
|
12391
|
+
});
|
|
12392
|
+
}
|
|
12393
|
+
//#endregion
|
|
11383
12394
|
//#region src/client-hint.jsx
|
|
11384
|
-
/** Keep the setting's own label as the help target
|
|
12395
|
+
/** Keep the setting's own label as the help target. */
|
|
11385
12396
|
function SettingsLabel({ children, description, as: Tag = "span", className = "codexSubscriptionPreferenceLabel", openOnClick = true, ...props }) {
|
|
11386
12397
|
const hasHelp = typeof description === "string" && description.trim() !== "";
|
|
11387
12398
|
const label = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
11388
12399
|
...props,
|
|
11389
12400
|
className: className || void 0,
|
|
11390
12401
|
tabIndex: hasHelp ? 0 : void 0,
|
|
11391
|
-
title: hasHelp && !Tooltip ? description : void 0,
|
|
11392
|
-
"aria-description": hasHelp && !Tooltip ? description : void 0,
|
|
11393
12402
|
children
|
|
11394
12403
|
});
|
|
11395
|
-
return hasHelp
|
|
12404
|
+
return hasHelp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip, {
|
|
11396
12405
|
label: description,
|
|
11397
12406
|
side: "bottom",
|
|
11398
|
-
portal: true,
|
|
11399
12407
|
maxWidth: 360,
|
|
11400
12408
|
openOnClick,
|
|
11401
12409
|
children: label
|
|
@@ -11409,38 +12417,6 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11409
12417
|
});
|
|
11410
12418
|
}
|
|
11411
12419
|
//#endregion
|
|
11412
|
-
//#region src/voice-barge-in.js
|
|
11413
|
-
/** Mute playback promptly, and restore it only after interrupted audio has drained. */
|
|
11414
|
-
function createBargeInGate({ interrupt, changed, speechMs = 120, silenceMs = 400, outputTailMs = 0 }) {
|
|
11415
|
-
let speakingAt, quietAt, outputQuietAt, suppressed = false, drained = false;
|
|
11416
|
-
let outputActiveAt;
|
|
11417
|
-
return { sample({ mic, output, now }) {
|
|
11418
|
-
if (mic > .12) {
|
|
11419
|
-
speakingAt ??= now;
|
|
11420
|
-
quietAt = void 0;
|
|
11421
|
-
} else {
|
|
11422
|
-
speakingAt = void 0;
|
|
11423
|
-
quietAt ??= now;
|
|
11424
|
-
}
|
|
11425
|
-
if (output < .025) outputQuietAt ??= now;
|
|
11426
|
-
else outputQuietAt = void 0;
|
|
11427
|
-
if (output > .025) outputActiveAt = now;
|
|
11428
|
-
const recentOutput = outputTailMs > 0 && outputActiveAt !== void 0 && now - outputActiveAt <= outputTailMs;
|
|
11429
|
-
if (!suppressed && speakingAt !== void 0 && now - speakingAt >= speechMs && (output > .025 || recentOutput)) {
|
|
11430
|
-
suppressed = true;
|
|
11431
|
-
drained = false;
|
|
11432
|
-
changed(true);
|
|
11433
|
-
interrupt();
|
|
11434
|
-
}
|
|
11435
|
-
if (suppressed && outputQuietAt !== void 0 && now - outputQuietAt >= 250) drained = true;
|
|
11436
|
-
if (suppressed && drained && quietAt !== void 0 && now - quietAt >= silenceMs) {
|
|
11437
|
-
suppressed = false;
|
|
11438
|
-
speakingAt = void 0;
|
|
11439
|
-
changed(false);
|
|
11440
|
-
}
|
|
11441
|
-
} };
|
|
11442
|
-
}
|
|
11443
|
-
//#endregion
|
|
11444
12420
|
//#region src/voice-problems.js
|
|
11445
12421
|
/** Stable user-facing categories; never render private server error strings. */
|
|
11446
12422
|
function voicePreviewProblem(code) {
|
|
@@ -11570,12 +12546,18 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11570
12546
|
for (const track of stream.getTracks()) connection.addTrack(track, stream);
|
|
11571
12547
|
connection.createDataChannel("oai-events");
|
|
11572
12548
|
let ended = false;
|
|
11573
|
-
|
|
12549
|
+
const notePlayback = (state) => {
|
|
12550
|
+
if (!ended) rpc.call(CHANNEL, "voice/playback", {
|
|
12551
|
+
sessionId,
|
|
12552
|
+
state
|
|
12553
|
+
}).catch(() => {});
|
|
12554
|
+
};
|
|
12555
|
+
sound.addEventListener("playing", () => notePlayback("playing"));
|
|
12556
|
+
sound.addEventListener("waiting", () => notePlayback("waiting"));
|
|
11574
12557
|
const end = async () => {
|
|
11575
12558
|
if (ended) return;
|
|
11576
12559
|
ended = true;
|
|
11577
12560
|
signal?.removeEventListener("abort", aborted);
|
|
11578
|
-
clearInterval(monitor);
|
|
11579
12561
|
if (context) chime(context, [740, 520]);
|
|
11580
12562
|
for (const track of stream.getTracks()) track.stop();
|
|
11581
12563
|
sound.srcObject = null;
|
|
@@ -11631,22 +12613,6 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11631
12613
|
assistant: /* @__PURE__ */ new Uint8Array(512)
|
|
11632
12614
|
};
|
|
11633
12615
|
let muted = false;
|
|
11634
|
-
let outputMuted = false;
|
|
11635
|
-
let interrupted = false;
|
|
11636
|
-
const gate = createBargeInGate({
|
|
11637
|
-
changed: (value) => {
|
|
11638
|
-
interrupted = value;
|
|
11639
|
-
sound.muted = outputMuted || interrupted;
|
|
11640
|
-
},
|
|
11641
|
-
interrupt: () => {
|
|
11642
|
-
rpc.call(CHANNEL, "voice/interrupt", { sessionId }).catch(() => {});
|
|
11643
|
-
}
|
|
11644
|
-
});
|
|
11645
|
-
if (context) monitor = setInterval(() => gate.sample({
|
|
11646
|
-
mic: muted ? 0 : loudness(analysers.mic, buffers.mic),
|
|
11647
|
-
output: loudness(analysers.assistant, buffers.assistant),
|
|
11648
|
-
now: performance.now()
|
|
11649
|
-
}), 30);
|
|
11650
12616
|
return {
|
|
11651
12617
|
stop: end,
|
|
11652
12618
|
isMuted: () => muted,
|
|
@@ -11654,10 +12620,9 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
11654
12620
|
muted = value;
|
|
11655
12621
|
for (const track of stream.getAudioTracks()) track.enabled = !value;
|
|
11656
12622
|
},
|
|
11657
|
-
isOutputMuted: () =>
|
|
12623
|
+
isOutputMuted: () => sound.muted,
|
|
11658
12624
|
setOutputMuted: (value) => {
|
|
11659
|
-
|
|
11660
|
-
sound.muted = outputMuted || interrupted;
|
|
12625
|
+
sound.muted = value;
|
|
11661
12626
|
},
|
|
11662
12627
|
/** How loud the person (mic) and the model (voice) are right now, 0..1 each. */
|
|
11663
12628
|
levels: () => ({
|
|
@@ -13197,19 +14162,6 @@ void main(){
|
|
|
13197
14162
|
//#region src/image-preferences.jsx
|
|
13198
14163
|
function ImageChoice({ t, label, hint, title, value, text, items, disabled, onSelect }) {
|
|
13199
14164
|
const [open, setOpen] = (0, react.useState)(false);
|
|
13200
|
-
const anchor = (0, react.useRef)(null);
|
|
13201
|
-
(0, react.useEffect)(() => {
|
|
13202
|
-
if (!open || disabled) return;
|
|
13203
|
-
const escape = (event) => {
|
|
13204
|
-
if (event.key !== "Escape") return;
|
|
13205
|
-
event.preventDefault();
|
|
13206
|
-
event.stopPropagation();
|
|
13207
|
-
setOpen(false);
|
|
13208
|
-
anchor.current?.focus();
|
|
13209
|
-
};
|
|
13210
|
-
window.addEventListener("keydown", escape, true);
|
|
13211
|
-
return () => window.removeEventListener("keydown", escape, true);
|
|
13212
|
-
}, [open, disabled]);
|
|
13213
14165
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
13214
14166
|
className: "codexSubscriptionPreference codexImagePreference",
|
|
13215
14167
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -13230,10 +14182,7 @@ void main(){
|
|
|
13230
14182
|
onClose: () => setOpen(false),
|
|
13231
14183
|
align: "end",
|
|
13232
14184
|
side: "bottom",
|
|
13233
|
-
portal: true,
|
|
13234
|
-
compact: true,
|
|
13235
14185
|
anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
13236
|
-
ref: anchor,
|
|
13237
14186
|
type: "button",
|
|
13238
14187
|
className: "codexSubscriptionContextTrigger",
|
|
13239
14188
|
"aria-label": label,
|
|
@@ -15695,6 +16644,33 @@ void main(){
|
|
|
15695
16644
|
const timer = setInterval(() => setNow(Date.now()), 5e3);
|
|
15696
16645
|
return () => clearInterval(timer);
|
|
15697
16646
|
}, [pairing, active]);
|
|
16647
|
+
(0, react.useEffect)(() => {
|
|
16648
|
+
if (!on || !active || !pairing) return void 0;
|
|
16649
|
+
let stopped = false, timer;
|
|
16650
|
+
const poll = async () => {
|
|
16651
|
+
if (Date.now() >= pairing.expiresAt) return;
|
|
16652
|
+
try {
|
|
16653
|
+
const result = await rpc.call(CHANNEL, "remote/pair-status", { pairingCode: pairing.pairingCode });
|
|
16654
|
+
if (stopped) return;
|
|
16655
|
+
if (result.ok && result.value.claimed === true) {
|
|
16656
|
+
setPairing((current) => current === pairing ? void 0 : current);
|
|
16657
|
+
readClients();
|
|
16658
|
+
return;
|
|
16659
|
+
}
|
|
16660
|
+
} catch {}
|
|
16661
|
+
if (!stopped) timer = setTimeout(poll, 5e3);
|
|
16662
|
+
};
|
|
16663
|
+
timer = setTimeout(poll, 5e3);
|
|
16664
|
+
return () => {
|
|
16665
|
+
stopped = true;
|
|
16666
|
+
clearTimeout(timer);
|
|
16667
|
+
};
|
|
16668
|
+
}, [
|
|
16669
|
+
on,
|
|
16670
|
+
active,
|
|
16671
|
+
pairing,
|
|
16672
|
+
rpc
|
|
16673
|
+
]);
|
|
15698
16674
|
const pair = async () => {
|
|
15699
16675
|
if (busy) return;
|
|
15700
16676
|
setBusy(true);
|
|
@@ -17216,12 +18192,12 @@ void main(){
|
|
|
17216
18192
|
[SPEED_MODE_ULTRAFAST]: "speedUltrafast"
|
|
17217
18193
|
};
|
|
17218
18194
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
17219
|
-
className: "codexSubscriptionPreference",
|
|
18195
|
+
className: "codexSubscriptionPreference codexComposerMenuOption",
|
|
17220
18196
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17221
18197
|
className: "codexSubscriptionPreferenceCopy",
|
|
17222
18198
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, {
|
|
17223
18199
|
description: ultrafast ? `${t("speedFastHint")} · ${t("speedUltrafastHint")}` : t("speedFastHint"),
|
|
17224
|
-
children: t("
|
|
18200
|
+
children: t("defaultSpeedTitle")
|
|
17225
18201
|
})
|
|
17226
18202
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Radios, {
|
|
17227
18203
|
snapshot,
|
|
@@ -17229,7 +18205,7 @@ void main(){
|
|
|
17229
18205
|
field: SPEED_MODE_FIELD,
|
|
17230
18206
|
values,
|
|
17231
18207
|
name: "codex-speed",
|
|
17232
|
-
label: t("
|
|
18208
|
+
label: t("defaultSpeedTitle"),
|
|
17233
18209
|
text: (value) => t(labels[value]),
|
|
17234
18210
|
disabledValues: ultrafast ? [] : [SPEED_MODE_ULTRAFAST]
|
|
17235
18211
|
})]
|
|
@@ -17237,6 +18213,9 @@ void main(){
|
|
|
17237
18213
|
}
|
|
17238
18214
|
function ModelsPage({ preference, t, defaultModel }) {
|
|
17239
18215
|
const snapshot = usePreferenceSnapshot(preference);
|
|
18216
|
+
const loaded = snapshot.status === "ready";
|
|
18217
|
+
const customMenu = snapshot.composerModelPicker === "legacy";
|
|
18218
|
+
const menuDisabled = !ready(snapshot) || snapshot.saving;
|
|
17240
18219
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
17241
18220
|
className: "codexSubscriptionAdvancedPreferences",
|
|
17242
18221
|
children: [
|
|
@@ -17257,19 +18236,47 @@ void main(){
|
|
|
17257
18236
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultReasoningEffortPreference, {
|
|
17258
18237
|
preference,
|
|
17259
18238
|
t
|
|
18239
|
+
})
|
|
18240
|
+
]
|
|
18241
|
+
}),
|
|
18242
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
18243
|
+
className: "codexSubscriptionCard codexSubscriptionPreferencesCard",
|
|
18244
|
+
"aria-label": t("composerSettingsTitle"),
|
|
18245
|
+
children: [
|
|
18246
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("composerSettingsTitle") }),
|
|
18247
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18248
|
+
className: "codexComposerMenuGroup",
|
|
18249
|
+
role: "group",
|
|
18250
|
+
"aria-label": t("legacyModelPicker"),
|
|
18251
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18252
|
+
className: "codexSubscriptionPreference",
|
|
18253
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
18254
|
+
className: "codexSubscriptionPreferenceCopy",
|
|
18255
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsLabel, {
|
|
18256
|
+
description: t("legacyModelPickerHint"),
|
|
18257
|
+
children: t("legacyModelPicker")
|
|
18258
|
+
}), loaded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Hint, { children: t(customMenu ? "composerMenuCustom" : "composerMenuHost") }) : null]
|
|
18259
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Switch, {
|
|
18260
|
+
checked: customMenu,
|
|
18261
|
+
label: t("legacyModelPicker"),
|
|
18262
|
+
disabled: menuDisabled,
|
|
18263
|
+
onChange: (on) => {
|
|
18264
|
+
preference.set({ composerModelPicker: on ? "legacy" : "dsh" });
|
|
18265
|
+
}
|
|
18266
|
+
})]
|
|
18267
|
+
}), loaded && customMenu ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpeedPreference, {
|
|
18268
|
+
snapshot,
|
|
18269
|
+
preference,
|
|
18270
|
+
t
|
|
18271
|
+
}) : null]
|
|
17260
18272
|
}),
|
|
17261
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
17262
|
-
snapshot,
|
|
18273
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PickerModelsPreference, {
|
|
17263
18274
|
preference,
|
|
17264
18275
|
t
|
|
17265
18276
|
}),
|
|
17266
18277
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerPredictionPreference, {
|
|
17267
18278
|
preference,
|
|
17268
18279
|
t
|
|
17269
|
-
}),
|
|
17270
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PickerModelsPreference, {
|
|
17271
|
-
preference,
|
|
17272
|
-
t
|
|
17273
18280
|
})
|
|
17274
18281
|
]
|
|
17275
18282
|
}),
|
|
@@ -20123,6 +21130,27 @@ void main(){
|
|
|
20123
21130
|
scope.effect(() => () => {
|
|
20124
21131
|
if (scopedDirectories === modelDirectories) scopedDirectories = void 0;
|
|
20125
21132
|
}, "codex-subscription: scoped model directories");
|
|
21133
|
+
registerLegacyModelPicker(scope.slots, preference, (sessionId) => {
|
|
21134
|
+
const directory = modelDirectories.directoryFor(sessionId);
|
|
21135
|
+
const available = sessions.subagentAddress(sessionId) === void 0;
|
|
21136
|
+
return {
|
|
21137
|
+
available,
|
|
21138
|
+
directory: directory.store,
|
|
21139
|
+
preference,
|
|
21140
|
+
t,
|
|
21141
|
+
load: () => {
|
|
21142
|
+
if (available) directory.load().catch(() => {});
|
|
21143
|
+
},
|
|
21144
|
+
select: async (selection) => {
|
|
21145
|
+
if (!available) return false;
|
|
21146
|
+
try {
|
|
21147
|
+
return (await directory.select(selection))?.ok !== false;
|
|
21148
|
+
} catch {
|
|
21149
|
+
return false;
|
|
21150
|
+
}
|
|
21151
|
+
}
|
|
21152
|
+
};
|
|
21153
|
+
}, CodexModelSelect);
|
|
20126
21154
|
};
|
|
20127
21155
|
if (ctx.get("remote.session") === void 0) installDirectorySlots(ctx);
|
|
20128
21156
|
else ctx.inject(["remote.session"], installDirectorySlots);
|
|
@@ -20229,32 +21257,34 @@ void main(){
|
|
|
20229
21257
|
]) ctx.slots.inject(name, () => {
|
|
20230
21258
|
let dispose;
|
|
20231
21259
|
const sync = () => {
|
|
20232
|
-
if (needsSubscriptionImageEnhancement(preference.getSnapshot()) && (component !== ComposerImagePreviews || nativeAttachments()))
|
|
20233
|
-
name
|
|
20234
|
-
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
21260
|
+
if (needsSubscriptionImageEnhancement(preference.getSnapshot()) && (component !== ComposerImagePreviews || nativeAttachments())) {
|
|
21261
|
+
if (!dispose && ctx.slots.entries(name).some((entry) => entry.options.priority === -10)) return;
|
|
21262
|
+
dispose ??= ctx.slots.register({
|
|
21263
|
+
name,
|
|
21264
|
+
priority: -10,
|
|
21265
|
+
inject: (sessionId) => ({
|
|
21266
|
+
preference,
|
|
21267
|
+
t,
|
|
21268
|
+
sessionId,
|
|
21269
|
+
nativeAttachments,
|
|
21270
|
+
watchNativeAttachments,
|
|
21271
|
+
nativeTranslate,
|
|
21272
|
+
service: imageViewer,
|
|
21273
|
+
openSketchImage: openSketchImage(sessionId),
|
|
21274
|
+
attachForEdit: attachForEdit(sessionId)
|
|
21275
|
+
})
|
|
21276
|
+
}, component);
|
|
21277
|
+
} else {
|
|
20248
21278
|
dispose?.();
|
|
20249
21279
|
dispose = void 0;
|
|
20250
21280
|
}
|
|
20251
21281
|
};
|
|
20252
21282
|
sync();
|
|
20253
21283
|
const unwatch = preference.subscribe(sync);
|
|
20254
|
-
const
|
|
21284
|
+
const unwatchSlot = ctx.slots.subscribe(name, sync);
|
|
20255
21285
|
return () => {
|
|
20256
21286
|
unwatch();
|
|
20257
|
-
|
|
21287
|
+
unwatchSlot();
|
|
20258
21288
|
dispose?.();
|
|
20259
21289
|
};
|
|
20260
21290
|
});
|