sunpeak 0.10.4 → 0.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/bin/commands/build.mjs +13 -13
  2. package/bin/commands/push.mjs +3 -4
  3. package/dist/chatgpt/index.cjs +1 -1
  4. package/dist/chatgpt/index.js +1 -1
  5. package/dist/index.cjs +3 -3
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.js +4 -4
  8. package/dist/index.js.map +1 -1
  9. package/dist/mcp/entry.cjs +1 -1
  10. package/dist/mcp/entry.js +1 -1
  11. package/dist/mcp/index.cjs +1 -1
  12. package/dist/mcp/index.js +1 -1
  13. package/dist/{server-CSybLAYo.cjs → server-B-T6Y3-J.cjs} +35 -47
  14. package/dist/{server-CSybLAYo.cjs.map → server-B-T6Y3-J.cjs.map} +1 -1
  15. package/dist/{server-310A1k9o.js → server-CnRhUNGQ.js} +35 -47
  16. package/dist/{server-310A1k9o.js.map → server-CnRhUNGQ.js.map} +1 -1
  17. package/dist/{simulator-url-BZBcq5tc.js → simulator-url-BUKX-wRa.js} +344 -270
  18. package/dist/{simulator-url-BZBcq5tc.js.map → simulator-url-BUKX-wRa.js.map} +1 -1
  19. package/dist/{simulator-url-D4tFBjeu.cjs → simulator-url-pSDp_VWO.cjs} +345 -271
  20. package/dist/{simulator-url-D4tFBjeu.cjs.map → simulator-url-pSDp_VWO.cjs.map} +1 -1
  21. package/package.json +2 -2
  22. package/template/dist/albums/albums.js +7 -47
  23. package/template/dist/albums/albums.json +1 -1
  24. package/template/dist/carousel/carousel.js +7 -47
  25. package/template/dist/carousel/carousel.json +1 -1
  26. package/template/dist/map/map.js +140 -187
  27. package/template/dist/map/map.json +1 -1
  28. package/template/dist/review/review.js +7 -47
  29. package/template/dist/review/review.json +1 -1
  30. package/template/node_modules/.vite/deps/_metadata.json +22 -22
  31. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- var _a, _b;
6
2
  const jsxRuntime = require("react/jsx-runtime");
7
3
  const React = require("react");
8
4
  const ReactDOM = require("react-dom");
@@ -30,9 +26,7 @@ function isOpenAiAvailable() {
30
26
  return typeof window !== "undefined" && window.openai != null;
31
27
  }
32
28
  class OpenAiProvider {
33
- constructor() {
34
- __publicField(this, "id", "openai");
35
- }
29
+ id = "openai";
36
30
  getGlobal(key) {
37
31
  if (typeof window === "undefined" || !window.openai) {
38
32
  return null;
@@ -61,34 +55,13 @@ class OpenAiProvider {
61
55
  return null;
62
56
  }
63
57
  return {
64
- callTool: (...args) => {
65
- var _a2, _b2;
66
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.callTool) == null ? void 0 : _b2.call(_a2, ...args);
67
- },
68
- sendFollowUpMessage: (...args) => {
69
- var _a2, _b2;
70
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.sendFollowUpMessage) == null ? void 0 : _b2.call(_a2, ...args);
71
- },
72
- openExternal: (...args) => {
73
- var _a2, _b2;
74
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.openExternal) == null ? void 0 : _b2.call(_a2, ...args);
75
- },
76
- requestDisplayMode: (...args) => {
77
- var _a2, _b2;
78
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.requestDisplayMode) == null ? void 0 : _b2.call(_a2, ...args);
79
- },
80
- requestModal: (...args) => {
81
- var _a2, _b2;
82
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.requestModal) == null ? void 0 : _b2.call(_a2, ...args);
83
- },
84
- notifyIntrinsicHeight: (...args) => {
85
- var _a2, _b2;
86
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.notifyIntrinsicHeight) == null ? void 0 : _b2.call(_a2, ...args);
87
- },
88
- setWidgetState: (...args) => {
89
- var _a2, _b2;
90
- return (_b2 = (_a2 = window.openai) == null ? void 0 : _a2.setWidgetState) == null ? void 0 : _b2.call(_a2, ...args);
91
- }
58
+ callTool: (...args) => window.openai?.callTool?.(...args),
59
+ sendFollowUpMessage: (...args) => window.openai?.sendFollowUpMessage?.(...args),
60
+ openExternal: (...args) => window.openai?.openExternal?.(...args),
61
+ requestDisplayMode: (...args) => window.openai?.requestDisplayMode?.(...args),
62
+ requestModal: (...args) => window.openai?.requestModal?.(...args),
63
+ notifyIntrinsicHeight: (...args) => window.openai?.notifyIntrinsicHeight?.(...args),
64
+ setWidgetState: (...args) => window.openai?.setWidgetState?.(...args)
92
65
  };
93
66
  }
94
67
  }
@@ -126,16 +99,16 @@ function isProviderAvailable() {
126
99
  }
127
100
  function getGlobal(key) {
128
101
  const provider = getProvider();
129
- return (provider == null ? void 0 : provider.getGlobal(key)) ?? null;
102
+ return provider?.getGlobal(key) ?? null;
130
103
  }
131
104
  function subscribeToGlobal(key, onChange) {
132
105
  const provider = getProvider();
133
- return (provider == null ? void 0 : provider.subscribe(key, onChange)) ?? (() => {
106
+ return provider?.subscribe(key, onChange) ?? (() => {
134
107
  });
135
108
  }
136
109
  function getAPI() {
137
110
  const provider = getProvider();
138
- return (provider == null ? void 0 : provider.getAPI()) ?? null;
111
+ return provider?.getAPI() ?? null;
139
112
  }
140
113
  function resetProviderCache() {
141
114
  resetProviderCache$1();
@@ -193,7 +166,7 @@ function useWidgetState(defaultState) {
193
166
  });
194
167
  const hasSentInitialState = React.useRef(false);
195
168
  React.useEffect(() => {
196
- if (!hasSentInitialState.current && widgetStateFromProvider == null && widgetState != null && (api == null ? void 0 : api.setWidgetState)) {
169
+ if (!hasSentInitialState.current && widgetStateFromProvider == null && widgetState != null && api?.setWidgetState) {
197
170
  hasSentInitialState.current = true;
198
171
  api.setWidgetState(widgetState);
199
172
  }
@@ -207,7 +180,7 @@ function useWidgetState(defaultState) {
207
180
  (state) => {
208
181
  _setWidgetState((prevState) => {
209
182
  const newState = typeof state === "function" ? state(prevState) : state;
210
- if (newState != null && (api == null ? void 0 : api.setWidgetState)) {
183
+ if (newState != null && api?.setWidgetState) {
211
184
  api.setWidgetState(newState);
212
185
  }
213
186
  return newState;
@@ -306,7 +279,7 @@ function createSlotClone(ownerName) {
306
279
  SlotClone.displayName = `${ownerName}.SlotClone`;
307
280
  return SlotClone;
308
281
  }
309
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
282
+ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
310
283
  // @__NO_SIDE_EFFECTS__
311
284
  function createSlottable(ownerName) {
312
285
  const Slottable2 = ({ children }) => {
@@ -344,13 +317,12 @@ function mergeProps(slotProps, childProps) {
344
317
  return { ...slotProps, ...overrideProps };
345
318
  }
346
319
  function getElementRef$1(element) {
347
- var _a2, _b2;
348
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
320
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
349
321
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
350
322
  if (mayWarn) {
351
323
  return element.ref;
352
324
  }
353
- getter = (_b2 = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b2.get;
325
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
354
326
  mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
355
327
  if (mayWarn) {
356
328
  return element.props.ref;
@@ -382,7 +354,7 @@ var Primitive = NODES.reduce((primitive, node) => {
382
354
  const { asChild, ...primitiveProps } = props;
383
355
  const Comp = asChild ? Slot2 : node;
384
356
  if (typeof window !== "undefined") {
385
- window[Symbol.for("radix-ui")] = true;
357
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
386
358
  }
387
359
  return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
388
360
  });
@@ -427,16 +399,14 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
427
399
  const index2 = defaultContexts.length;
428
400
  defaultContexts = [...defaultContexts, defaultContext];
429
401
  const Provider2 = (props) => {
430
- var _a2;
431
402
  const { scope, children, ...context } = props;
432
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
403
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
433
404
  const value = React__namespace.useMemo(() => context, Object.values(context));
434
405
  return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
435
406
  };
436
407
  Provider2.displayName = rootComponentName + "Provider";
437
408
  function useContext2(consumerName, scope) {
438
- var _a2;
439
- const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
409
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
440
410
  const context = React__namespace.useContext(Context);
441
411
  if (context) return context;
442
412
  if (defaultContext !== void 0) return defaultContext;
@@ -449,7 +419,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
449
419
  return React__namespace.createContext(defaultContext);
450
420
  });
451
421
  return function useScope(scope) {
452
- const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
422
+ const contexts = scope?.[scopeName] || scopeContexts;
453
423
  return React__namespace.useMemo(
454
424
  () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
455
425
  [scope, contexts]
@@ -543,13 +513,13 @@ function createCollection(name) {
543
513
  }
544
514
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
545
515
  return function handleEvent(event) {
546
- originalEventHandler == null ? void 0 : originalEventHandler(event);
516
+ originalEventHandler?.(event);
547
517
  if (checkForDefaultPrevented === false || !event.defaultPrevented) {
548
- return ourEventHandler == null ? void 0 : ourEventHandler(event);
518
+ return ourEventHandler?.(event);
549
519
  }
550
520
  };
551
521
  }
552
- var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
522
+ var useLayoutEffect2 = globalThis?.document ? React__namespace.useLayoutEffect : () => {
553
523
  };
554
524
  var useInsertionEffect = React__namespace[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
555
525
  function useControllableState({
@@ -581,11 +551,10 @@ function useControllableState({
581
551
  }
582
552
  const setValue = React__namespace.useCallback(
583
553
  (nextValue) => {
584
- var _a2;
585
554
  if (isControlled) {
586
555
  const value2 = isFunction$1(nextValue) ? nextValue(prop) : nextValue;
587
556
  if (value2 !== prop) {
588
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value2);
557
+ onChangeRef.current?.(value2);
589
558
  }
590
559
  } else {
591
560
  setUncontrolledProp(nextValue);
@@ -606,9 +575,8 @@ function useUncontrolledState({
606
575
  onChangeRef.current = onChange;
607
576
  }, [onChange]);
608
577
  React__namespace.useEffect(() => {
609
- var _a2;
610
578
  if (prevValueRef.current !== value) {
611
- (_a2 = onChangeRef.current) == null ? void 0 : _a2.call(onChangeRef, value);
579
+ onChangeRef.current?.(value);
612
580
  prevValueRef.current = value;
613
581
  }
614
582
  }, [value, prevValueRef]);
@@ -664,7 +632,7 @@ function usePresence(present) {
664
632
  const currentAnimationName = getAnimationName(styles);
665
633
  if (present) {
666
634
  send("MOUNT");
667
- } else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
635
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
668
636
  send("UNMOUNT");
669
637
  } else {
670
638
  const isAnimating = prevAnimationName !== currentAnimationName;
@@ -724,16 +692,15 @@ function usePresence(present) {
724
692
  };
725
693
  }
726
694
  function getAnimationName(styles) {
727
- return (styles == null ? void 0 : styles.animationName) || "none";
695
+ return styles?.animationName || "none";
728
696
  }
729
697
  function getElementRef(element) {
730
- var _a2, _b2;
731
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
698
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
732
699
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
733
700
  if (mayWarn) {
734
701
  return element.ref;
735
702
  }
736
- getter = (_b2 = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b2.get;
703
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
737
704
  mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
738
705
  if (mayWarn) {
739
706
  return element.props.ref;
@@ -759,12 +726,9 @@ function useCallbackRef$1(callback) {
759
726
  React__namespace.useEffect(() => {
760
727
  callbackRef.current = callback;
761
728
  });
762
- return React__namespace.useMemo(() => (...args) => {
763
- var _a2;
764
- return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
765
- }, []);
729
+ return React__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
766
730
  }
767
- function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
731
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
768
732
  const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
769
733
  React__namespace.useEffect(() => {
770
734
  const handleKeyDown2 = (event) => {
@@ -799,7 +763,7 @@ var DismissableLayer = React__namespace.forwardRef(
799
763
  } = props;
800
764
  const context = React__namespace.useContext(DismissableLayerContext);
801
765
  const [node, setNode] = React__namespace.useState(null);
802
- const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
766
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
803
767
  const [, force] = React__namespace.useState({});
804
768
  const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
805
769
  const layers = Array.from(context.layers);
@@ -812,22 +776,22 @@ var DismissableLayer = React__namespace.forwardRef(
812
776
  const target = event.target;
813
777
  const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
814
778
  if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
815
- onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
816
- onInteractOutside == null ? void 0 : onInteractOutside(event);
817
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
779
+ onPointerDownOutside?.(event);
780
+ onInteractOutside?.(event);
781
+ if (!event.defaultPrevented) onDismiss?.();
818
782
  }, ownerDocument);
819
783
  const focusOutside = useFocusOutside((event) => {
820
784
  const target = event.target;
821
785
  const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
822
786
  if (isFocusInBranch) return;
823
- onFocusOutside == null ? void 0 : onFocusOutside(event);
824
- onInteractOutside == null ? void 0 : onInteractOutside(event);
825
- if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
787
+ onFocusOutside?.(event);
788
+ onInteractOutside?.(event);
789
+ if (!event.defaultPrevented) onDismiss?.();
826
790
  }, ownerDocument);
827
791
  useEscapeKeydown((event) => {
828
792
  const isHighestLayer = index2 === context.layers.size - 1;
829
793
  if (!isHighestLayer) return;
830
- onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
794
+ onEscapeKeyDown?.(event);
831
795
  if (!event.defaultPrevented && onDismiss) {
832
796
  event.preventDefault();
833
797
  onDismiss();
@@ -900,7 +864,7 @@ var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) =
900
864
  return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
901
865
  });
902
866
  DismissableLayerBranch.displayName = BRANCH_NAME;
903
- function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
867
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
904
868
  const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
905
869
  const isPointerInsideReactTreeRef = React__namespace.useRef(false);
906
870
  const handleClickRef = React__namespace.useRef(() => {
@@ -943,7 +907,7 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
943
907
  onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
944
908
  };
945
909
  }
946
- function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
910
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
947
911
  const handleFocusOutside = useCallbackRef$1(onFocusOutside);
948
912
  const isFocusInsideReactTreeRef = React__namespace.useRef(false);
949
913
  React__namespace.useEffect(() => {
@@ -1154,15 +1118,14 @@ function createFocusScopesStack() {
1154
1118
  add(focusScope) {
1155
1119
  const activeFocusScope = stack[0];
1156
1120
  if (focusScope !== activeFocusScope) {
1157
- activeFocusScope == null ? void 0 : activeFocusScope.pause();
1121
+ activeFocusScope?.pause();
1158
1122
  }
1159
1123
  stack = arrayRemove(stack, focusScope);
1160
1124
  stack.unshift(focusScope);
1161
1125
  },
1162
1126
  remove(focusScope) {
1163
- var _a2;
1164
1127
  stack = arrayRemove(stack, focusScope);
1165
- (_a2 = stack[0]) == null ? void 0 : _a2.resume();
1128
+ stack[0]?.resume();
1166
1129
  }
1167
1130
  };
1168
1131
  }
@@ -1179,11 +1142,10 @@ function removeLinks(items) {
1179
1142
  }
1180
1143
  var PORTAL_NAME$2 = "Portal";
1181
1144
  var Portal$2 = React__namespace.forwardRef((props, forwardedRef) => {
1182
- var _a2;
1183
1145
  const { container: containerProp, ...portalProps } = props;
1184
1146
  const [mounted, setMounted] = React__namespace.useState(false);
1185
1147
  useLayoutEffect2(() => setMounted(true), []);
1186
- const container = containerProp || mounted && ((_a2 = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a2.body);
1148
+ const container = containerProp || mounted && globalThis?.document?.body;
1187
1149
  return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
1188
1150
  });
1189
1151
  Portal$2.displayName = PORTAL_NAME$2;
@@ -1396,8 +1358,8 @@ function createSidecarMedium(options) {
1396
1358
  medium.options = __assign({ async: true, ssr: false }, options);
1397
1359
  return medium;
1398
1360
  }
1399
- var SideCar$1 = function(_a2) {
1400
- var sideCar = _a2.sideCar, rest = __rest(_a2, ["sideCar"]);
1361
+ var SideCar$1 = function(_a) {
1362
+ var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
1401
1363
  if (!sideCar) {
1402
1364
  throw new Error("Sidecar: please provide `sideCar` property to import the right car");
1403
1365
  }
@@ -1418,12 +1380,12 @@ var nothing = function() {
1418
1380
  };
1419
1381
  var RemoveScroll = React__namespace.forwardRef(function(props, parentRef) {
1420
1382
  var ref = React__namespace.useRef(null);
1421
- var _a2 = React__namespace.useState({
1383
+ var _a = React__namespace.useState({
1422
1384
  onScrollCapture: nothing,
1423
1385
  onWheelCapture: nothing,
1424
1386
  onTouchMoveCapture: nothing
1425
- }), callbacks = _a2[0], setCallbacks = _a2[1];
1426
- var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b2 = props.as, Container2 = _b2 === void 0 ? "div" : _b2, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1387
+ }), callbacks = _a[0], setCallbacks = _a[1];
1388
+ var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container2 = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1427
1389
  var SideCar2 = sideCar;
1428
1390
  var containerRef = useMergeRefs([ref, parentRef]);
1429
1391
  var containerProps = __assign(__assign({}, rest), callbacks);
@@ -1506,8 +1468,8 @@ var styleHookSingleton = function() {
1506
1468
  };
1507
1469
  var styleSingleton = function() {
1508
1470
  var useStyle = styleHookSingleton();
1509
- var Sheet = function(_a2) {
1510
- var styles = _a2.styles, dynamic = _a2.dynamic;
1471
+ var Sheet = function(_a) {
1472
+ var styles = _a.styles, dynamic = _a.dynamic;
1511
1473
  useStyle(styles, dynamic);
1512
1474
  return null;
1513
1475
  };
@@ -1548,8 +1510,8 @@ var getGapWidth = function(gapMode) {
1548
1510
  };
1549
1511
  var Style = styleSingleton();
1550
1512
  var lockAttribute = "data-scroll-locked";
1551
- var getStyles = function(_a2, allowRelative, gapMode, important) {
1552
- var left = _a2.left, top = _a2.top, right = _a2.right, gap = _a2.gap;
1513
+ var getStyles = function(_a, allowRelative, gapMode, important) {
1514
+ var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
1553
1515
  if (gapMode === void 0) {
1554
1516
  gapMode = "margin";
1555
1517
  }
@@ -1576,8 +1538,8 @@ var useLockAttribute = function() {
1576
1538
  };
1577
1539
  }, []);
1578
1540
  };
1579
- var RemoveScrollBar = function(_a2) {
1580
- var noRelative = _a2.noRelative, noImportant = _a2.noImportant, _b2 = _a2.gapMode, gapMode = _b2 === void 0 ? "margin" : _b2;
1541
+ var RemoveScrollBar = function(_a) {
1542
+ var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
1581
1543
  useLockAttribute();
1582
1544
  var gap = React__namespace.useMemo(function() {
1583
1545
  return getGapWidth(gapMode);
@@ -1629,7 +1591,7 @@ var locationCouldBeScrolled = function(axis, node) {
1629
1591
  }
1630
1592
  var isScrollable = elementCouldBeScrolled(axis, current);
1631
1593
  if (isScrollable) {
1632
- var _a2 = getScrollVariables(axis, current), scrollHeight = _a2[1], clientHeight = _a2[2];
1594
+ var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
1633
1595
  if (scrollHeight > clientHeight) {
1634
1596
  return true;
1635
1597
  }
@@ -1638,16 +1600,16 @@ var locationCouldBeScrolled = function(axis, node) {
1638
1600
  } while (current && current !== ownerDocument.body);
1639
1601
  return false;
1640
1602
  };
1641
- var getVScrollVariables = function(_a2) {
1642
- var scrollTop = _a2.scrollTop, scrollHeight = _a2.scrollHeight, clientHeight = _a2.clientHeight;
1603
+ var getVScrollVariables = function(_a) {
1604
+ var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
1643
1605
  return [
1644
1606
  scrollTop,
1645
1607
  scrollHeight,
1646
1608
  clientHeight
1647
1609
  ];
1648
1610
  };
1649
- var getHScrollVariables = function(_a2) {
1650
- var scrollLeft = _a2.scrollLeft, scrollWidth = _a2.scrollWidth, clientWidth = _a2.clientWidth;
1611
+ var getHScrollVariables = function(_a) {
1612
+ var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
1651
1613
  return [
1652
1614
  scrollLeft,
1653
1615
  scrollWidth,
@@ -1676,7 +1638,7 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
1676
1638
  if (!target) {
1677
1639
  break;
1678
1640
  }
1679
- var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
1641
+ var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
1680
1642
  var elementScroll = scroll_1 - capacity - directionFactor * position;
1681
1643
  if (position || elementScroll) {
1682
1644
  if (elementCouldBeScrolled(axis, target)) {
@@ -2110,7 +2072,7 @@ var CheckboxTrigger = React__namespace.forwardRef(
2110
2072
  const composedRefs = useComposedRefs(forwardedRef, setControl);
2111
2073
  const initialCheckedStateRef = React__namespace.useRef(checked);
2112
2074
  React__namespace.useEffect(() => {
2113
- const form = control == null ? void 0 : control.form;
2075
+ const form = control?.form;
2114
2076
  if (form) {
2115
2077
  const reset = () => setChecked(initialCheckedStateRef.current);
2116
2078
  form.addEventListener("reset", reset);
@@ -4207,7 +4169,7 @@ var PopperAnchor = React__namespace.forwardRef(
4207
4169
  const anchorRef = React__namespace.useRef(null);
4208
4170
  React__namespace.useEffect(() => {
4209
4171
  const previousAnchor = anchorRef.current;
4210
- anchorRef.current = (virtualRef == null ? void 0 : virtualRef.current) || ref.current;
4172
+ anchorRef.current = virtualRef?.current || ref.current;
4211
4173
  if (previousAnchor !== anchorRef.current) {
4212
4174
  context.onAnchorChange(anchorRef.current);
4213
4175
  }
@@ -4220,7 +4182,6 @@ var CONTENT_NAME$2 = "PopperContent";
4220
4182
  var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$2);
4221
4183
  var PopperContent = React__namespace.forwardRef(
4222
4184
  (props, forwardedRef) => {
4223
- var _a2, _b2, _c, _d, _e, _f;
4224
4185
  const {
4225
4186
  __scopePopper,
4226
4187
  side = "bottom",
@@ -4242,8 +4203,8 @@ var PopperContent = React__namespace.forwardRef(
4242
4203
  const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
4243
4204
  const [arrow$12, setArrow] = React__namespace.useState(null);
4244
4205
  const arrowSize = useSize(arrow$12);
4245
- const arrowWidth = (arrowSize == null ? void 0 : arrowSize.width) ?? 0;
4246
- const arrowHeight = (arrowSize == null ? void 0 : arrowSize.height) ?? 0;
4206
+ const arrowWidth = arrowSize?.width ?? 0;
4207
+ const arrowHeight = arrowSize?.height ?? 0;
4247
4208
  const desiredPlacement = side + (align !== "center" ? "-" + align : "");
4248
4209
  const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
4249
4210
  const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
@@ -4296,12 +4257,12 @@ var PopperContent = React__namespace.forwardRef(
4296
4257
  const handlePlaced = useCallbackRef$1(onPlaced);
4297
4258
  useLayoutEffect2(() => {
4298
4259
  if (isPositioned) {
4299
- handlePlaced == null ? void 0 : handlePlaced();
4260
+ handlePlaced?.();
4300
4261
  }
4301
4262
  }, [isPositioned, handlePlaced]);
4302
- const arrowX = (_a2 = middlewareData.arrow) == null ? void 0 : _a2.x;
4303
- const arrowY = (_b2 = middlewareData.arrow) == null ? void 0 : _b2.y;
4304
- const cannotCenterArrow = ((_c = middlewareData.arrow) == null ? void 0 : _c.centerOffset) !== 0;
4263
+ const arrowX = middlewareData.arrow?.x;
4264
+ const arrowY = middlewareData.arrow?.y;
4265
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
4305
4266
  const [contentZIndex, setContentZIndex] = React__namespace.useState();
4306
4267
  useLayoutEffect2(() => {
4307
4268
  if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
@@ -4318,13 +4279,13 @@ var PopperContent = React__namespace.forwardRef(
4318
4279
  minWidth: "max-content",
4319
4280
  zIndex: contentZIndex,
4320
4281
  ["--radix-popper-transform-origin"]: [
4321
- (_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
4322
- (_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
4282
+ middlewareData.transformOrigin?.x,
4283
+ middlewareData.transformOrigin?.y
4323
4284
  ].join(" "),
4324
4285
  // hide the content if using the hide middleware and should be hidden
4325
4286
  // set visibility to hidden and disable pointer events so the UI behaves
4326
4287
  // as if the PopperContent isn't there at all
4327
- ...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
4288
+ ...middlewareData.hide?.referenceHidden && {
4328
4289
  visibility: "hidden",
4329
4290
  pointerEvents: "none"
4330
4291
  }
@@ -4423,16 +4384,15 @@ var transformOrigin = (options) => ({
4423
4384
  name: "transformOrigin",
4424
4385
  options,
4425
4386
  fn(data) {
4426
- var _a2, _b2, _c;
4427
4387
  const { placement, rects, middlewareData } = data;
4428
- const cannotCenterArrow = ((_a2 = middlewareData.arrow) == null ? void 0 : _a2.centerOffset) !== 0;
4388
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
4429
4389
  const isArrowHidden = cannotCenterArrow;
4430
4390
  const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
4431
4391
  const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
4432
4392
  const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
4433
4393
  const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
4434
- const arrowXCenter = (((_b2 = middlewareData.arrow) == null ? void 0 : _b2.x) ?? 0) + arrowWidth / 2;
4435
- const arrowYCenter = (((_c = middlewareData.arrow) == null ? void 0 : _c.y) ?? 0) + arrowHeight / 2;
4394
+ const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
4395
+ const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
4436
4396
  let x = "";
4437
4397
  let y = "";
4438
4398
  if (placedSide === "bottom") {
@@ -4788,9 +4748,8 @@ var PopoverContentModal = React__namespace.forwardRef(
4788
4748
  trapFocus: context.open,
4789
4749
  disableOutsidePointerEvents: true,
4790
4750
  onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
4791
- var _a2;
4792
4751
  event.preventDefault();
4793
- if (!isRightClickOutsideRef.current) (_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
4752
+ if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
4794
4753
  }),
4795
4754
  onPointerDownOutside: composeEventHandlers(
4796
4755
  props.onPointerDownOutside,
@@ -4824,18 +4783,16 @@ var PopoverContentNonModal = React__namespace.forwardRef(
4824
4783
  trapFocus: false,
4825
4784
  disableOutsidePointerEvents: false,
4826
4785
  onCloseAutoFocus: (event) => {
4827
- var _a2, _b2;
4828
- (_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
4786
+ props.onCloseAutoFocus?.(event);
4829
4787
  if (!event.defaultPrevented) {
4830
- if (!hasInteractedOutsideRef.current) (_b2 = context.triggerRef.current) == null ? void 0 : _b2.focus();
4788
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
4831
4789
  event.preventDefault();
4832
4790
  }
4833
4791
  hasInteractedOutsideRef.current = false;
4834
4792
  hasPointerDownOutsideRef.current = false;
4835
4793
  },
4836
4794
  onInteractOutside: (event) => {
4837
- var _a2, _b2;
4838
- (_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
4795
+ props.onInteractOutside?.(event);
4839
4796
  if (!event.defaultPrevented) {
4840
4797
  hasInteractedOutsideRef.current = true;
4841
4798
  if (event.detail.originalEvent.type === "pointerdown") {
@@ -4843,7 +4800,7 @@ var PopoverContentNonModal = React__namespace.forwardRef(
4843
4800
  }
4844
4801
  }
4845
4802
  const target = event.target;
4846
- const targetIsTrigger = (_b2 = context.triggerRef.current) == null ? void 0 : _b2.contains(target);
4803
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
4847
4804
  if (targetIsTrigger) event.preventDefault();
4848
4805
  if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
4849
4806
  event.preventDefault();
@@ -5213,7 +5170,7 @@ var Tooltip$2 = (props) => {
5213
5170
  } else {
5214
5171
  providerContext.onClose();
5215
5172
  }
5216
- onOpenChange == null ? void 0 : onOpenChange(open2);
5173
+ onOpenChange?.(open2);
5217
5174
  },
5218
5175
  caller: TOOLTIP_NAME
5219
5176
  });
@@ -5391,7 +5348,7 @@ var TooltipContentHoverable = React__namespace.forwardRef((props, forwardedRef)
5391
5348
  const handleTrackPointerGrace = (event) => {
5392
5349
  const target = event.target;
5393
5350
  const pointerPosition = { x: event.clientX, y: event.clientY };
5394
- const hasEnteredTarget = (trigger == null ? void 0 : trigger.contains(target)) || (content == null ? void 0 : content.contains(target));
5351
+ const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
5395
5352
  const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
5396
5353
  if (hasEnteredTarget) {
5397
5354
  handleRemoveGraceArea();
@@ -5429,7 +5386,7 @@ var TooltipContentImpl = React__namespace.forwardRef(
5429
5386
  if (context.trigger) {
5430
5387
  const handleScroll2 = (event) => {
5431
5388
  const target = event.target;
5432
- if (target == null ? void 0 : target.contains(context.trigger)) onClose();
5389
+ if (target?.contains(context.trigger)) onClose();
5433
5390
  };
5434
5391
  window.addEventListener("scroll", handleScroll2, { capture: true });
5435
5392
  return () => window.removeEventListener("scroll", handleScroll2, { capture: true });
@@ -5614,12 +5571,11 @@ function useLatestValue(value) {
5614
5571
  let handlers = [];
5615
5572
  let listenerBound = false;
5616
5573
  const handleKeyDown = (evt) => {
5617
- var _a2, _b2;
5618
5574
  if (evt.key === "Escape") {
5619
5575
  const [firstHandler] = handlers;
5620
5576
  if (firstHandler) {
5621
5577
  evt.preventDefault();
5622
- (_b2 = (_a2 = firstHandler.callback).current) == null ? void 0 : _b2.call(_a2);
5578
+ firstHandler.callback.current?.();
5623
5579
  }
5624
5580
  }
5625
5581
  };
@@ -5653,11 +5609,11 @@ const useEscCloseStack = (listening, cb) => {
5653
5609
  }, [id, listening, latestCallback]);
5654
5610
  };
5655
5611
  const __vite_import_meta_env__ = { "DEV": false, "MODE": "production" };
5656
- const META_ENV = typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("simulator-url-D4tFBjeu.cjs", document.baseURI).href } !== "undefined" ? __vite_import_meta_env__ : void 0;
5657
- const NODE_ENV = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) ? (_b = process.env) == null ? void 0 : _b.NODE_ENV : "production";
5658
- const isDev = NODE_ENV === "development" || !!(META_ENV == null ? void 0 : META_ENV.DEV);
5612
+ const META_ENV = typeof { url: typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("simulator-url-pSDp_VWO.cjs", document.baseURI).href } !== "undefined" ? __vite_import_meta_env__ : void 0;
5613
+ const NODE_ENV = typeof process !== "undefined" && process.env?.NODE_ENV ? process.env?.NODE_ENV : "production";
5614
+ const isDev = NODE_ENV === "development" || !!META_ENV?.DEV;
5659
5615
  const isJSDomLike = typeof navigator !== "undefined" && /(jsdom|happy-dom)/i.test(navigator.userAgent) || typeof globalThis.happyDOM === "object";
5660
- const isTest = NODE_ENV === "test" || (META_ENV == null ? void 0 : META_ENV.MODE) === "test" || isJSDomLike;
5616
+ const isTest = NODE_ENV === "test" || META_ENV?.MODE === "test" || isJSDomLike;
5661
5617
  const hasWindow = typeof window !== "undefined";
5662
5618
  const hasDocument = typeof document !== "undefined";
5663
5619
  const canUseDOM = hasWindow && hasDocument;
@@ -5812,23 +5768,22 @@ const Input = (props) => {
5812
5768
  };
5813
5769
  const [focused, setFocused] = React.useState(false);
5814
5770
  React.useEffect(() => {
5815
- var _a2;
5816
5771
  if (autoSelect) {
5817
- (_a2 = inputRef.current) == null ? void 0 : _a2.select();
5772
+ inputRef.current?.select();
5818
5773
  }
5819
5774
  }, [autoSelect]);
5820
5775
  const handleAnimationStart = (evt) => {
5821
- onAnimationStart == null ? void 0 : onAnimationStart(evt);
5776
+ onAnimationStart?.(evt);
5822
5777
  if (evt.animationName === "native-autofill-in") {
5823
- onAutofill == null ? void 0 : onAutofill();
5778
+ onAutofill?.();
5824
5779
  }
5825
5780
  };
5826
5781
  return jsxRuntime.jsxs("div", { className: clsx(s$9.Container, className), "data-variant": variant, "data-size": size2, "data-gutter-size": gutterSize, "data-focused": focused, "data-disabled": disabled ? "" : void 0, "data-readonly": readOnly ? "" : void 0, "data-invalid": invalid ? "" : void 0, "data-pill": pill ? "" : void 0, "data-optically-align": opticallyAlign, "data-has-start-adornment": StartAdornment ? "" : void 0, "data-has-end-adornment": EndAdornment ? "" : void 0, onMouseDown: handleMouseDown, children: [StartAdornment, jsxRuntime.jsx("input", { ...restProps, ref: o([ref, inputRef]), id: id || (allowAutofillExtensions ? void 0 : onePasswordPreventionId), className: s$9.Input, type, name, readOnly, disabled, onFocus: (evt) => {
5827
5782
  setFocused(true);
5828
- onFocus == null ? void 0 : onFocus(evt);
5783
+ onFocus?.(evt);
5829
5784
  }, onBlur: (evt) => {
5830
5785
  setFocused(false);
5831
- onBlur == null ? void 0 : onBlur(evt);
5786
+ onBlur?.(evt);
5832
5787
  }, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? void 0 : true, "data-1p-ignore": allowAutofillExtensions ? void 0 : true }), EndAdornment] });
5833
5788
  };
5834
5789
  const flattenTextNodes = (children) => {
@@ -5877,9 +5832,140 @@ const wrapTextNodeSiblings = (children) => {
5877
5832
  });
5878
5833
  };
5879
5834
  React.createContext(null);
5880
- var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
5881
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
5882
- freeGlobal || freeSelf || Function("return this")();
5835
+ var lodash_debounce;
5836
+ var hasRequiredLodash_debounce;
5837
+ function requireLodash_debounce() {
5838
+ if (hasRequiredLodash_debounce) return lodash_debounce;
5839
+ hasRequiredLodash_debounce = 1;
5840
+ var FUNC_ERROR_TEXT = "Expected a function";
5841
+ var NAN = 0 / 0;
5842
+ var symbolTag = "[object Symbol]";
5843
+ var reTrim = /^\s+|\s+$/g;
5844
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5845
+ var reIsBinary = /^0b[01]+$/i;
5846
+ var reIsOctal = /^0o[0-7]+$/i;
5847
+ var freeParseInt = parseInt;
5848
+ var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
5849
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
5850
+ var root = freeGlobal || freeSelf || Function("return this")();
5851
+ var objectProto = Object.prototype;
5852
+ var objectToString = objectProto.toString;
5853
+ var nativeMax = Math.max, nativeMin = Math.min;
5854
+ var now = function() {
5855
+ return root.Date.now();
5856
+ };
5857
+ function debounce(func, wait, options) {
5858
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
5859
+ if (typeof func != "function") {
5860
+ throw new TypeError(FUNC_ERROR_TEXT);
5861
+ }
5862
+ wait = toNumber(wait) || 0;
5863
+ if (isObject(options)) {
5864
+ leading = !!options.leading;
5865
+ maxing = "maxWait" in options;
5866
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
5867
+ trailing = "trailing" in options ? !!options.trailing : trailing;
5868
+ }
5869
+ function invokeFunc(time) {
5870
+ var args = lastArgs, thisArg = lastThis;
5871
+ lastArgs = lastThis = void 0;
5872
+ lastInvokeTime = time;
5873
+ result = func.apply(thisArg, args);
5874
+ return result;
5875
+ }
5876
+ function leadingEdge(time) {
5877
+ lastInvokeTime = time;
5878
+ timerId = setTimeout(timerExpired, wait);
5879
+ return leading ? invokeFunc(time) : result;
5880
+ }
5881
+ function remainingWait(time) {
5882
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall;
5883
+ return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2;
5884
+ }
5885
+ function shouldInvoke(time) {
5886
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
5887
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
5888
+ }
5889
+ function timerExpired() {
5890
+ var time = now();
5891
+ if (shouldInvoke(time)) {
5892
+ return trailingEdge(time);
5893
+ }
5894
+ timerId = setTimeout(timerExpired, remainingWait(time));
5895
+ }
5896
+ function trailingEdge(time) {
5897
+ timerId = void 0;
5898
+ if (trailing && lastArgs) {
5899
+ return invokeFunc(time);
5900
+ }
5901
+ lastArgs = lastThis = void 0;
5902
+ return result;
5903
+ }
5904
+ function cancel() {
5905
+ if (timerId !== void 0) {
5906
+ clearTimeout(timerId);
5907
+ }
5908
+ lastInvokeTime = 0;
5909
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
5910
+ }
5911
+ function flush() {
5912
+ return timerId === void 0 ? result : trailingEdge(now());
5913
+ }
5914
+ function debounced() {
5915
+ var time = now(), isInvoking = shouldInvoke(time);
5916
+ lastArgs = arguments;
5917
+ lastThis = this;
5918
+ lastCallTime = time;
5919
+ if (isInvoking) {
5920
+ if (timerId === void 0) {
5921
+ return leadingEdge(lastCallTime);
5922
+ }
5923
+ if (maxing) {
5924
+ timerId = setTimeout(timerExpired, wait);
5925
+ return invokeFunc(lastCallTime);
5926
+ }
5927
+ }
5928
+ if (timerId === void 0) {
5929
+ timerId = setTimeout(timerExpired, wait);
5930
+ }
5931
+ return result;
5932
+ }
5933
+ debounced.cancel = cancel;
5934
+ debounced.flush = flush;
5935
+ return debounced;
5936
+ }
5937
+ function isObject(value) {
5938
+ var type = typeof value;
5939
+ return !!value && (type == "object" || type == "function");
5940
+ }
5941
+ function isObjectLike(value) {
5942
+ return !!value && typeof value == "object";
5943
+ }
5944
+ function isSymbol(value) {
5945
+ return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
5946
+ }
5947
+ function toNumber(value) {
5948
+ if (typeof value == "number") {
5949
+ return value;
5950
+ }
5951
+ if (isSymbol(value)) {
5952
+ return NAN;
5953
+ }
5954
+ if (isObject(value)) {
5955
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
5956
+ value = isObject(other) ? other + "" : other;
5957
+ }
5958
+ if (typeof value != "string") {
5959
+ return value === 0 ? value : +value;
5960
+ }
5961
+ value = value.replace(reTrim, "");
5962
+ var isBinary = reIsBinary.test(value);
5963
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
5964
+ }
5965
+ lodash_debounce = debounce;
5966
+ return lodash_debounce;
5967
+ }
5968
+ requireLodash_debounce();
5883
5969
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
5884
5970
  function useIsMounted() {
5885
5971
  const isMounted = React.useRef(false);
@@ -6248,7 +6334,7 @@ const Button = (props) => {
6248
6334
  if (disabled) {
6249
6335
  return;
6250
6336
  }
6251
- onClick == null ? void 0 : onClick(e);
6337
+ onClick?.(e);
6252
6338
  }, [onClick, disabled]);
6253
6339
  return jsxRuntime.jsxs("button", {
6254
6340
  type,
@@ -6303,8 +6389,8 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6303
6389
  const hasAnyTertiaryIndicator = showClearAction || loading || hasDropdownIcon;
6304
6390
  const isInteractive = !loading && !disabled;
6305
6391
  const handleKeyDown2 = (evt) => {
6306
- var _a2;
6307
6392
  switch (evt.key) {
6393
+ // NOTE: "Enter" does not open selects, as it may be an attempt to submit a form
6308
6394
  case "ArrowDown":
6309
6395
  case "ArrowUp":
6310
6396
  case " ":
@@ -6313,7 +6399,7 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6313
6399
  if (onInteract) {
6314
6400
  onInteract();
6315
6401
  } else {
6316
- (_a2 = controlRef.current) == null ? void 0 : _a2.dispatchEvent(new PointerEvent("pointerdown", {
6402
+ controlRef.current?.dispatchEvent(new PointerEvent("pointerdown", {
6317
6403
  bubbles: true,
6318
6404
  cancelable: true,
6319
6405
  pointerType: "mouse"
@@ -6324,11 +6410,10 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6324
6410
  case "Enter":
6325
6411
  break;
6326
6412
  default:
6327
- onKeyDown == null ? void 0 : onKeyDown(evt);
6413
+ onKeyDown?.(evt);
6328
6414
  }
6329
6415
  };
6330
6416
  const handlePointerDown = (evt) => {
6331
- var _a2;
6332
6417
  if (evt.button === 2) {
6333
6418
  return;
6334
6419
  }
@@ -6337,8 +6422,8 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6337
6422
  evt.preventDefault();
6338
6423
  onInteract();
6339
6424
  } else {
6340
- onPointerDown == null ? void 0 : onPointerDown(evt);
6341
- (_a2 = restProps.onClick) == null ? void 0 : _a2.call(restProps, evt);
6425
+ onPointerDown?.(evt);
6426
+ restProps.onClick?.(evt);
6342
6427
  }
6343
6428
  };
6344
6429
  return (
@@ -6351,7 +6436,7 @@ const SelectControl = ({ ref, onPointerDown, onKeyDown, onPointerEnter, onIntera
6351
6436
  tabIndex: disabled ? -1 : 0,
6352
6437
  onPointerEnter: (evt) => {
6353
6438
  handlePressableMouseEnter(evt);
6354
- onPointerEnter == null ? void 0 : onPointerEnter(evt);
6439
+ onPointerEnter?.(evt);
6355
6440
  },
6356
6441
  onPointerDown: isInteractive ? handlePointerDown : void 0,
6357
6442
  onKeyDown: isInteractive ? handleKeyDown2 : void 0,
@@ -6423,10 +6508,10 @@ const Tooltip = (props) => {
6423
6508
  };
6424
6509
  return jsxRuntime.jsxs(Root, { open, delayDuration: openDelay, onOpenChange: handleOpenChange, disableHoverableContent: !interactive, children: [jsxRuntime.jsx(Trigger$1, { asChild: true, children: jsxRuntime.jsx(Slot$1, { ...restProps, ref: forwardedRef, onPointerDown: (evt) => {
6425
6510
  maybePreventClickClose(evt);
6426
- onPointerDown == null ? void 0 : onPointerDown(evt);
6511
+ onPointerDown?.(evt);
6427
6512
  }, onClick: (evt) => {
6428
6513
  maybePreventClickClose(evt);
6429
- onClick == null ? void 0 : onClick(evt);
6514
+ onClick?.(evt);
6430
6515
  }, children }) }), jsxRuntime.jsx(Content, { maxWidth, compact, align, alignOffset, side, sideOffset, gutterSize, className: contentClassName, children: content })] });
6431
6516
  };
6432
6517
  const Root = ({ children, open, onOpenChange, ...restProps }) => {
@@ -6536,8 +6621,7 @@ const Select = (props) => {
6536
6621
  const propActionsRef = React.useRef(propActions);
6537
6622
  propActionsRef.current = propActions;
6538
6623
  const onActionSelect = React.useCallback((actionId) => {
6539
- var _a2;
6540
- (_a2 = propActionsRef.current.find((a) => a.id === actionId)) == null ? void 0 : _a2.onSelect(actionId);
6624
+ propActionsRef.current.find((a) => a.id === actionId)?.onSelect(actionId);
6541
6625
  }, []);
6542
6626
  const optionsCount = React.useMemo(() => isOptionGroupArray(options) ? options.reduce((acc, group) => {
6543
6627
  return acc + group.options.length;
@@ -6685,7 +6769,7 @@ const SelectTrigger = (props) => {
6685
6769
  };
6686
6770
  const handleClearClick = () => {
6687
6771
  onSelectRef.current({ value: "", label: "" });
6688
- onOpenChange == null ? void 0 : onOpenChange(false);
6772
+ onOpenChange?.(false);
6689
6773
  };
6690
6774
  return jsxRuntime.jsxs(SelectControl, { id: triggerId, className: triggerClassName, selected: !isPlaceholder, variant, pill, block, size: size2, disabled, loading, StartIcon: TriggerStartIcon, opticallyAlign, dropdownIconType, onClearClick: clearable ? handleClearClick : void 0, onInteract: onOpenChange, onKeyDown: handleKeyDown2, ...restProps, children: [multiple ? jsxRuntime.jsx(TriggerView, { ...multipleTriggerViewProps }) : jsxRuntime.jsx(TriggerView, { ...selectedItem }), (name || id) && jsxRuntime.jsx("input", {
6691
6775
  id,
@@ -6693,8 +6777,7 @@ const SelectTrigger = (props) => {
6693
6777
  value: firstValue,
6694
6778
  tabIndex: -1,
6695
6779
  onFocus: () => {
6696
- var _a2;
6697
- (_a2 = document.getElementById(triggerId)) == null ? void 0 : _a2.focus();
6780
+ document.getElementById(triggerId)?.focus();
6698
6781
  },
6699
6782
  // keep react from complaining - don't make this readOnly because that
6700
6783
  // prevents the value from being required
@@ -6714,7 +6797,6 @@ const CustomSelect = () => {
6714
6797
  setOpen(nextState);
6715
6798
  if (!nextState) {
6716
6799
  setTimeout(() => {
6717
- var _a2;
6718
6800
  if (!selectContentRef.current) {
6719
6801
  return;
6720
6802
  }
@@ -6722,7 +6804,7 @@ const CustomSelect = () => {
6722
6804
  if (activeElement && !selectContentRef.current.contains(activeElement)) {
6723
6805
  return;
6724
6806
  }
6725
- (_a2 = document.getElementById(triggerId)) == null ? void 0 : _a2.focus();
6807
+ document.getElementById(triggerId)?.focus();
6726
6808
  });
6727
6809
  }
6728
6810
  };
@@ -6773,9 +6855,8 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6773
6855
  const searchInputRef = React.useRef(null);
6774
6856
  const [searchTerm, setSearchTerm] = React.useState("");
6775
6857
  const [highlightedValue, setHighlightedValue] = React.useState(() => {
6776
- var _a2;
6777
6858
  const selectedValue = multiple ? value[0] : value;
6778
- return (selectedValue || ((_a2 = getFirstValidOption(options)) == null ? void 0 : _a2.value)) ?? "";
6859
+ return (selectedValue || getFirstValidOption(options)?.value) ?? "";
6779
6860
  });
6780
6861
  const typeahead = React.useMemo(() => createTypeahead(), []);
6781
6862
  const internalListId = React.useId();
@@ -6788,7 +6869,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6788
6869
  const handleKeyDown2 = (evt) => {
6789
6870
  const key = evt.key;
6790
6871
  const firstValue = multiple ? value[0] : value;
6791
- const targetValue = highlightedValue || (firstOption == null ? void 0 : firstOption.value) || firstValue;
6872
+ const targetValue = highlightedValue || firstOption?.value || firstValue;
6792
6873
  const isFocusedInSearch = document.activeElement === searchInputRef.current;
6793
6874
  const menuElement = menuRef.current;
6794
6875
  if (!menuElement) {
@@ -6801,7 +6882,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6801
6882
  pointerType: "mouse"
6802
6883
  });
6803
6884
  const selectedOption = findOptionByValue(highlightedValue, menuElement);
6804
- selectedOption == null ? void 0 : selectedOption.dispatchEvent(pointerUpEvent);
6885
+ selectedOption?.dispatchEvent(pointerUpEvent);
6805
6886
  };
6806
6887
  const highlightOption = (val, element) => {
6807
6888
  setHighlightedValue(val);
@@ -6832,7 +6913,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6832
6913
  return;
6833
6914
  }
6834
6915
  const nextElement = findNextOption(highlightedValue, menuElement);
6835
- const nextValue = nextElement == null ? void 0 : nextElement.getAttribute("data-option-id");
6916
+ const nextValue = nextElement?.getAttribute("data-option-id");
6836
6917
  if (nextElement && nextValue) {
6837
6918
  highlightOption(nextValue, nextElement);
6838
6919
  }
@@ -6845,7 +6926,7 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6845
6926
  return;
6846
6927
  }
6847
6928
  const previousElement = findPreviousOption(targetValue, menuElement);
6848
- const previousValue = previousElement == null ? void 0 : previousElement.getAttribute("data-option-id");
6929
+ const previousValue = previousElement?.getAttribute("data-option-id");
6849
6930
  if (previousElement && previousValue) {
6850
6931
  highlightOption(previousValue, previousElement);
6851
6932
  }
@@ -6896,10 +6977,10 @@ const CustomSelectMenu = ({ onOpenChange }) => {
6896
6977
  return;
6897
6978
  }
6898
6979
  const currentOption = findOptionByValue(highlightedValue, menuRef.current);
6899
- currentOption == null ? void 0 : currentOption.scrollIntoView({ block: "center" });
6980
+ currentOption?.scrollIntoView({ block: "center" });
6900
6981
  });
6901
6982
  const autoFocusTarget = searchInputRef.current || menuRef.current;
6902
- autoFocusTarget == null ? void 0 : autoFocusTarget.focus({ preventScroll: true });
6983
+ autoFocusTarget?.focus({ preventScroll: true });
6903
6984
  return () => {
6904
6985
  isMountStableRef.current = false;
6905
6986
  };
@@ -6998,12 +7079,11 @@ const CustomSelectOption = (option) => {
6998
7079
  const isSelected = multiple ? propsValue.includes(value) : value === currentValue;
6999
7080
  const isHighlighted = value === highlightedValue;
7000
7081
  const handlePointerUp = () => {
7001
- var _a2;
7002
7082
  if (multiple) {
7003
7083
  onSelectRef.current(option, isSelected);
7004
7084
  } else {
7005
7085
  onSelectRef.current(option);
7006
- (_a2 = requestCloseRef.current) == null ? void 0 : _a2.call(requestCloseRef);
7086
+ requestCloseRef.current?.();
7007
7087
  }
7008
7088
  };
7009
7089
  const handlePointerMove = () => {
@@ -7060,9 +7140,8 @@ const CustomSelectAction = ({ id, label, Icon, className }) => {
7060
7140
  }
7061
7141
  };
7062
7142
  const handlePointerUp = () => {
7063
- var _a2;
7064
7143
  onActionSelect(id);
7065
- (_a2 = requestCloseRef.current) == null ? void 0 : _a2.call(requestCloseRef);
7144
+ requestCloseRef.current?.();
7066
7145
  };
7067
7146
  return jsxRuntime.jsx("div", { className: s$3.Action, onPointerUp: handlePointerUp, onKeyDown: handleKeyDown2, tabIndex: 0, children: jsxRuntime.jsxs("div", { className: clsx(s$3.ActionInner, className), children: [Icon && jsxRuntime.jsx(Icon, { role: "presentation" }), label] }) });
7068
7147
  };
@@ -7151,7 +7230,7 @@ const findOptionByValue = (currentValue, container) => container.querySelector(`
7151
7230
  const isValidOptionNode = (node) => node.matches("[data-option-id]:not([data-disabled])");
7152
7231
  const findNextOption = (currentValue, container) => {
7153
7232
  const currentOption = findOptionByValue(currentValue, container);
7154
- let nextNode = currentOption == null ? void 0 : currentOption.nextElementSibling;
7233
+ let nextNode = currentOption?.nextElementSibling;
7155
7234
  let maxSteps = 0;
7156
7235
  while (nextNode && maxSteps < MAX_DOM_CRAWLS) {
7157
7236
  if (isValidOptionNode(nextNode)) {
@@ -7163,7 +7242,7 @@ const findNextOption = (currentValue, container) => {
7163
7242
  };
7164
7243
  const findPreviousOption = (currentValue, container) => {
7165
7244
  const currentOption = findOptionByValue(currentValue, container);
7166
- let nextNode = currentOption == null ? void 0 : currentOption.previousElementSibling;
7245
+ let nextNode = currentOption?.previousElementSibling;
7167
7246
  let maxSteps = 0;
7168
7247
  while (nextNode && maxSteps < MAX_DOM_CRAWLS) {
7169
7248
  if (isValidOptionNode(nextNode)) {
@@ -7284,15 +7363,14 @@ const Textarea = (props) => {
7284
7363
  const [focused, setFocused] = React.useState(false);
7285
7364
  const computedMaxRows = autoResize ? Math.max(maxRows ?? 10, rows) : rows;
7286
7365
  React.useEffect(() => {
7287
- var _a2;
7288
7366
  if (autoSelect) {
7289
- (_a2 = textAreaRef.current) == null ? void 0 : _a2.select();
7367
+ textAreaRef.current?.select();
7290
7368
  }
7291
7369
  }, [autoSelect]);
7292
7370
  const handleAnimationStart = (evt) => {
7293
- onAnimationStart == null ? void 0 : onAnimationStart(evt);
7371
+ onAnimationStart?.(evt);
7294
7372
  if (evt.animationName === "native-autofill-in") {
7295
- onAutofill == null ? void 0 : onAutofill();
7373
+ onAutofill?.();
7296
7374
  }
7297
7375
  };
7298
7376
  const autosizeTextarea = React.useCallback(() => {
@@ -7309,14 +7387,14 @@ const Textarea = (props) => {
7309
7387
  "textarea-min-rows": `${rows}`,
7310
7388
  "textarea-max-rows": `${computedMaxRows}`
7311
7389
  }), children: jsxRuntime.jsx("textarea", { ...restProps, onChange: (evt) => {
7312
- onChange == null ? void 0 : onChange(evt);
7390
+ onChange?.(evt);
7313
7391
  autosizeTextarea();
7314
7392
  }, ref: o([textAreaRef, ref]), id: id || (allowAutofillExtensions ? void 0 : onePasswordPreventionId), className: s$1.Textarea, name, readOnly, disabled, rows, onFocus: (evt) => {
7315
7393
  setFocused(true);
7316
- onFocus == null ? void 0 : onFocus(evt);
7394
+ onFocus?.(evt);
7317
7395
  }, onBlur: (evt) => {
7318
7396
  setFocused(false);
7319
- onBlur == null ? void 0 : onBlur(evt);
7397
+ onBlur?.(evt);
7320
7398
  }, onAnimationStart: handleAnimationStart, "data-lpignore": allowAutofillExtensions ? void 0 : true, "data-1p-ignore": allowAutofillExtensions ? void 0 : true }) });
7321
7399
  };
7322
7400
  const SegmentedControl$1 = "_SegmentedControl_1sl7d_1";
@@ -7336,7 +7414,7 @@ const SegmentedControl = ({ value, onChange, children, block, pill = true, size:
7336
7414
  if (!root || !thumb) {
7337
7415
  return;
7338
7416
  }
7339
- const activeNode = root == null ? void 0 : root.querySelector('[data-state="on"]');
7417
+ const activeNode = root?.querySelector('[data-state="on"]');
7340
7418
  if (!activeNode) {
7341
7419
  return;
7342
7420
  }
@@ -7586,7 +7664,7 @@ function SidebarTextarea({
7586
7664
  maxRows = 8,
7587
7665
  error
7588
7666
  }) {
7589
- const contentRows = (value == null ? void 0 : value.split("\n").length) ?? 1;
7667
+ const contentRows = value?.split("\n").length ?? 1;
7590
7668
  const rows = Math.min(contentRows, maxRows);
7591
7669
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
7592
7670
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -7706,7 +7784,7 @@ function generateCSP(csp, scriptSrc) {
7706
7784
  if (scriptOrigin) {
7707
7785
  connectSources.add(scriptOrigin);
7708
7786
  }
7709
- if (csp == null ? void 0 : csp.connect_domains) {
7787
+ if (csp?.connect_domains) {
7710
7788
  for (const domain of csp.connect_domains) {
7711
7789
  connectSources.add(domain);
7712
7790
  }
@@ -7716,7 +7794,7 @@ function generateCSP(csp, scriptSrc) {
7716
7794
  if (scriptOrigin) {
7717
7795
  resourceSources.add(scriptOrigin);
7718
7796
  }
7719
- if (csp == null ? void 0 : csp.resource_domains) {
7797
+ if (csp?.resource_domains) {
7720
7798
  for (const domain of csp.resource_domains) {
7721
7799
  resourceSources.add(domain);
7722
7800
  }
@@ -8057,7 +8135,6 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8057
8135
  }, [sendUpdate]);
8058
8136
  const handlePortMessage = React.useCallback(
8059
8137
  (event) => {
8060
- var _a2, _b2;
8061
8138
  if (!event.data || typeof event.data !== "object" || typeof event.data.type !== "string") {
8062
8139
  return;
8063
8140
  }
@@ -8078,7 +8155,7 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8078
8155
  console.warn("[IframeResource] Invalid display mode:", mode);
8079
8156
  return;
8080
8157
  }
8081
- if (typeof window !== "undefined" && ((_a2 = window.openai) == null ? void 0 : _a2.requestDisplayMode)) {
8158
+ if (typeof window !== "undefined" && window.openai?.requestDisplayMode) {
8082
8159
  window.openai.requestDisplayMode({ mode });
8083
8160
  }
8084
8161
  break;
@@ -8089,7 +8166,7 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8089
8166
  console.warn("[IframeResource] Invalid widgetState payload");
8090
8167
  return;
8091
8168
  }
8092
- if (typeof window !== "undefined" && ((_b2 = window.openai) == null ? void 0 : _b2.setWidgetState)) {
8169
+ if (typeof window !== "undefined" && window.openai?.setWidgetState) {
8093
8170
  window.openai.setWidgetState(payload);
8094
8171
  }
8095
8172
  break;
@@ -8136,7 +8213,7 @@ function IframeResource({ scriptSrc, className, style, csp }) {
8136
8213
  channel.port1.onmessage = handlePortMessage;
8137
8214
  channel.port1.start();
8138
8215
  const iframe = iframeRef.current;
8139
- if (iframe == null ? void 0 : iframe.contentWindow) {
8216
+ if (iframe?.contentWindow) {
8140
8217
  iframe.contentWindow.postMessage({ type: "openai:handshake" }, "*", [channel.port2]);
8141
8218
  }
8142
8219
  }
@@ -8213,13 +8290,13 @@ function Conversation({
8213
8290
  const displayMode = useDisplayMode() ?? "inline";
8214
8291
  const api = useWidgetAPI();
8215
8292
  const userAgent = useUserAgent();
8216
- const isDesktop = (userAgent == null ? void 0 : userAgent.device.type) === "desktop";
8293
+ const isDesktop = userAgent?.device.type === "desktop";
8217
8294
  const containerWidth = screenWidth === "full" ? "100%" : `${SCREEN_WIDTHS[screenWidth]}px`;
8218
- const widgetCSP = resourceMeta == null ? void 0 : resourceMeta["openai/widgetCSP"];
8295
+ const widgetCSP = resourceMeta?.["openai/widgetCSP"];
8219
8296
  const content = iframeScriptSrc ? /* @__PURE__ */ jsxRuntime.jsx(IframeResource, { scriptSrc: iframeScriptSrc, className: "h-full w-full", csp: widgetCSP }) : children;
8220
8297
  if (displayMode === "fullscreen") {
8221
8298
  const handleClose = () => {
8222
- if (api == null ? void 0 : api.requestDisplayMode) {
8299
+ if (api?.requestDisplayMode) {
8223
8300
  api.requestDisplayMode({ mode: "inline" });
8224
8301
  }
8225
8302
  };
@@ -8253,8 +8330,8 @@ function Conversation({
8253
8330
  color: "primary",
8254
8331
  className: "bg-token-bg-primary",
8255
8332
  onClick: () => {
8256
- const widgetDomain = resourceMeta == null ? void 0 : resourceMeta["openai/widgetDomain"];
8257
- if ((api == null ? void 0 : api.openExternal) && widgetDomain) {
8333
+ const widgetDomain = resourceMeta?.["openai/widgetDomain"];
8334
+ if (api?.openExternal && widgetDomain) {
8258
8335
  api.openExternal({ href: widgetDomain });
8259
8336
  }
8260
8337
  },
@@ -8346,7 +8423,7 @@ function Conversation({
8346
8423
  "button",
8347
8424
  {
8348
8425
  onClick: () => {
8349
- if (api == null ? void 0 : api.requestDisplayMode) {
8426
+ if (api?.requestDisplayMode) {
8350
8427
  api.requestDisplayMode({ mode: "inline" });
8351
8428
  }
8352
8429
  },
@@ -8385,32 +8462,30 @@ function Conversation({
8385
8462
  );
8386
8463
  }
8387
8464
  class MockOpenAI {
8388
- constructor() {
8389
- __publicField(this, "theme", "light");
8390
- __publicField(this, "userAgent", {
8391
- device: { type: "desktop" },
8392
- capabilities: {
8393
- hover: true,
8394
- touch: false
8395
- }
8396
- });
8397
- __publicField(this, "locale", "en-US");
8398
- __publicField(this, "maxHeight");
8399
- __publicField(this, "displayMode", "inline");
8400
- __publicField(this, "safeArea", {
8401
- insets: {
8402
- top: 0,
8403
- bottom: 0,
8404
- left: 0,
8405
- right: 0
8406
- }
8407
- });
8408
- __publicField(this, "view", null);
8409
- __publicField(this, "toolInput", {});
8410
- __publicField(this, "toolOutput", null);
8411
- __publicField(this, "toolResponseMetadata", null);
8412
- __publicField(this, "widgetState", null);
8413
- }
8465
+ theme = "light";
8466
+ userAgent = {
8467
+ device: { type: "desktop" },
8468
+ capabilities: {
8469
+ hover: true,
8470
+ touch: false
8471
+ }
8472
+ };
8473
+ locale = "en-US";
8474
+ maxHeight = void 0;
8475
+ displayMode = "inline";
8476
+ safeArea = {
8477
+ insets: {
8478
+ top: 0,
8479
+ bottom: 0,
8480
+ left: 0,
8481
+ right: 0
8482
+ }
8483
+ };
8484
+ view = null;
8485
+ toolInput = {};
8486
+ toolOutput = null;
8487
+ toolResponseMetadata = null;
8488
+ widgetState = null;
8414
8489
  async callTool(name, args) {
8415
8490
  console.log("Mock callTool:", name, args);
8416
8491
  return { result: JSON.stringify({ success: true }) };
@@ -8497,37 +8572,37 @@ class MockOpenAI {
8497
8572
  function initMockOpenAI(initialData) {
8498
8573
  if (typeof window !== "undefined") {
8499
8574
  const mock = new MockOpenAI();
8500
- if ((initialData == null ? void 0 : initialData.theme) !== void 0) {
8575
+ if (initialData?.theme !== void 0) {
8501
8576
  mock.theme = initialData.theme;
8502
8577
  }
8503
- if ((initialData == null ? void 0 : initialData.userAgent) !== void 0) {
8578
+ if (initialData?.userAgent !== void 0) {
8504
8579
  mock.userAgent = initialData.userAgent;
8505
8580
  }
8506
- if ((initialData == null ? void 0 : initialData.locale) !== void 0) {
8581
+ if (initialData?.locale !== void 0) {
8507
8582
  mock.locale = initialData.locale;
8508
8583
  }
8509
- if ((initialData == null ? void 0 : initialData.maxHeight) !== void 0) {
8584
+ if (initialData?.maxHeight !== void 0) {
8510
8585
  mock.maxHeight = initialData.maxHeight;
8511
8586
  }
8512
- if ((initialData == null ? void 0 : initialData.displayMode) !== void 0) {
8587
+ if (initialData?.displayMode !== void 0) {
8513
8588
  mock.displayMode = initialData.displayMode;
8514
8589
  }
8515
- if ((initialData == null ? void 0 : initialData.safeArea) !== void 0) {
8590
+ if (initialData?.safeArea !== void 0) {
8516
8591
  mock.safeArea = initialData.safeArea;
8517
8592
  }
8518
- if ((initialData == null ? void 0 : initialData.view) !== void 0) {
8593
+ if (initialData?.view !== void 0) {
8519
8594
  mock.view = initialData.view;
8520
8595
  }
8521
- if ((initialData == null ? void 0 : initialData.toolInput) !== void 0) {
8596
+ if (initialData?.toolInput !== void 0) {
8522
8597
  mock.toolInput = initialData.toolInput;
8523
8598
  }
8524
- if ((initialData == null ? void 0 : initialData.toolOutput) !== void 0) {
8599
+ if (initialData?.toolOutput !== void 0) {
8525
8600
  mock.toolOutput = initialData.toolOutput;
8526
8601
  }
8527
- if ((initialData == null ? void 0 : initialData.toolResponseMetadata) !== void 0) {
8602
+ if (initialData?.toolResponseMetadata !== void 0) {
8528
8603
  mock.toolResponseMetadata = initialData.toolResponseMetadata;
8529
8604
  }
8530
- if ((initialData == null ? void 0 : initialData.widgetState) !== void 0) {
8605
+ if (initialData?.widgetState !== void 0) {
8531
8606
  mock.widgetState = initialData.widgetState;
8532
8607
  }
8533
8608
  window.openai = mock;
@@ -8633,7 +8708,7 @@ function ChatGPTSimulator({
8633
8708
  }, [urlParams.simulation, simulations, simulationNames]);
8634
8709
  const [selectedSimulationName, setSelectedSimulationName] = React__namespace.useState(initialSimulationName);
8635
8710
  const selectedSim = simulations[selectedSimulationName];
8636
- const userMessage = selectedSim == null ? void 0 : selectedSim.userMessage;
8711
+ const userMessage = selectedSim?.userMessage;
8637
8712
  const mock = React.useMemo(
8638
8713
  () => initMockOpenAI({
8639
8714
  theme: urlParams.theme ?? DEFAULT_THEME,
@@ -8652,13 +8727,12 @@ function ChatGPTSimulator({
8652
8727
  resetProviderCache();
8653
8728
  }
8654
8729
  React.useEffect(() => {
8655
- var _a2, _b2;
8656
8730
  if (selectedSim) {
8657
- mock.toolInput = ((_a2 = selectedSim.callToolRequestParams) == null ? void 0 : _a2.arguments) ?? {};
8731
+ mock.toolInput = selectedSim.callToolRequestParams?.arguments ?? {};
8658
8732
  if (selectedSim.widgetState !== void 0) {
8659
8733
  mock.setWidgetStateExternal(selectedSim.widgetState);
8660
8734
  }
8661
- mock.toolOutput = ((_b2 = selectedSim.callToolResult) == null ? void 0 : _b2.structuredContent) ?? null;
8735
+ mock.toolOutput = selectedSim.callToolResult?.structuredContent ?? null;
8662
8736
  }
8663
8737
  }, [selectedSimulationName, selectedSim, mock]);
8664
8738
  const theme = useTheme() ?? DEFAULT_THEME;
@@ -8685,7 +8759,7 @@ function ChatGPTSimulator({
8685
8759
  () => JSON.stringify(widgetState ?? null, null, 2)
8686
8760
  );
8687
8761
  const [viewParamsJson, setViewParamsJson] = React.useState(
8688
- () => JSON.stringify((view == null ? void 0 : view.params) ?? {}, null, 2)
8762
+ () => JSON.stringify(view?.params ?? {}, null, 2)
8689
8763
  );
8690
8764
  const [editingField, setEditingField] = React.useState(null);
8691
8765
  const [toolInputError, setToolInputError] = React.useState("");
@@ -8740,7 +8814,7 @@ function ChatGPTSimulator({
8740
8814
  setWidgetStateError("");
8741
8815
  }
8742
8816
  if (editingField !== "viewParams") {
8743
- setViewParamsJson(JSON.stringify((view == null ? void 0 : view.params) ?? {}, null, 2));
8817
+ setViewParamsJson(JSON.stringify(view?.params ?? {}, null, 2));
8744
8818
  setViewParamsError("");
8745
8819
  }
8746
8820
  }, [
@@ -8749,7 +8823,7 @@ function ChatGPTSimulator({
8749
8823
  toolOutput,
8750
8824
  toolResponseMetadata,
8751
8825
  widgetState,
8752
- view == null ? void 0 : view.params,
8826
+ view?.params,
8753
8827
  editingField
8754
8828
  ]);
8755
8829
  const validateJSON = (json, setJson, setError) => {
@@ -8774,8 +8848,8 @@ function ChatGPTSimulator({
8774
8848
  setEditingField(null);
8775
8849
  }
8776
8850
  };
8777
- const SelectedComponent = selectedSim == null ? void 0 : selectedSim.resourceComponent;
8778
- const iframeScriptSrc = !SelectedComponent ? selectedSim == null ? void 0 : selectedSim.resourceScript : void 0;
8851
+ const SelectedComponent = selectedSim?.resourceComponent;
8852
+ const iframeScriptSrc = !SelectedComponent ? selectedSim?.resourceScript : void 0;
8779
8853
  const content = SelectedComponent ? /* @__PURE__ */ jsxRuntime.jsx(SelectedComponent, {}) : children;
8780
8854
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(
8781
8855
  SimpleSidebar,
@@ -8787,7 +8861,7 @@ function ChatGPTSimulator({
8787
8861
  value: selectedSimulationName,
8788
8862
  onChange: (value) => {
8789
8863
  const newSim = simulations[value];
8790
- mock.setWidgetStateExternal((newSim == null ? void 0 : newSim.widgetState) ?? null);
8864
+ mock.setWidgetStateExternal(newSim?.widgetState ?? null);
8791
8865
  setSelectedSimulationName(value);
8792
8866
  },
8793
8867
  options: simulationNames.map((name) => {
@@ -8872,7 +8946,7 @@ function ChatGPTSimulator({
8872
8946
  /* @__PURE__ */ jsxRuntime.jsx(SidebarControl, { label: "User Agent - Device", children: /* @__PURE__ */ jsxRuntime.jsx(
8873
8947
  SidebarSelect,
8874
8948
  {
8875
- value: (userAgent == null ? void 0 : userAgent.device.type) ?? "desktop",
8949
+ value: userAgent?.device.type ?? "desktop",
8876
8950
  onChange: (value) => {
8877
8951
  const deviceType = value;
8878
8952
  let capabilities;
@@ -8909,13 +8983,13 @@ function ChatGPTSimulator({
8909
8983
  /* @__PURE__ */ jsxRuntime.jsx(
8910
8984
  SidebarCheckbox,
8911
8985
  {
8912
- checked: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
8986
+ checked: userAgent?.capabilities.hover ?? true,
8913
8987
  onChange: (checked) => mock.setUserAgent({
8914
8988
  ...userAgent,
8915
- device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
8989
+ device: userAgent?.device ?? { type: "desktop" },
8916
8990
  capabilities: {
8917
8991
  hover: checked,
8918
- touch: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false
8992
+ touch: userAgent?.capabilities.touch ?? false
8919
8993
  }
8920
8994
  }),
8921
8995
  label: "Hover"
@@ -8924,12 +8998,12 @@ function ChatGPTSimulator({
8924
8998
  /* @__PURE__ */ jsxRuntime.jsx(
8925
8999
  SidebarCheckbox,
8926
9000
  {
8927
- checked: (userAgent == null ? void 0 : userAgent.capabilities.touch) ?? false,
9001
+ checked: userAgent?.capabilities.touch ?? false,
8928
9002
  onChange: (checked) => mock.setUserAgent({
8929
9003
  ...userAgent,
8930
- device: (userAgent == null ? void 0 : userAgent.device) ?? { type: "desktop" },
9004
+ device: userAgent?.device ?? { type: "desktop" },
8931
9005
  capabilities: {
8932
- hover: (userAgent == null ? void 0 : userAgent.capabilities.hover) ?? true,
9006
+ hover: userAgent?.capabilities.hover ?? true,
8933
9007
  touch: checked
8934
9008
  }
8935
9009
  }),
@@ -8944,14 +9018,14 @@ function ChatGPTSimulator({
8944
9018
  SidebarInput,
8945
9019
  {
8946
9020
  type: "number",
8947
- value: String((safeArea == null ? void 0 : safeArea.insets.top) ?? 0),
9021
+ value: String(safeArea?.insets.top ?? 0),
8948
9022
  onChange: (value) => mock.setSafeArea({
8949
9023
  insets: {
8950
- ...safeArea == null ? void 0 : safeArea.insets,
9024
+ ...safeArea?.insets,
8951
9025
  top: Number(value),
8952
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
8953
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8954
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
9026
+ bottom: safeArea?.insets.bottom ?? 0,
9027
+ left: safeArea?.insets.left ?? 0,
9028
+ right: safeArea?.insets.right ?? 0
8955
9029
  }
8956
9030
  })
8957
9031
  }
@@ -8963,14 +9037,14 @@ function ChatGPTSimulator({
8963
9037
  SidebarInput,
8964
9038
  {
8965
9039
  type: "number",
8966
- value: String((safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0),
9040
+ value: String(safeArea?.insets.bottom ?? 0),
8967
9041
  onChange: (value) => mock.setSafeArea({
8968
9042
  insets: {
8969
- ...safeArea == null ? void 0 : safeArea.insets,
8970
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
9043
+ ...safeArea?.insets,
9044
+ top: safeArea?.insets.top ?? 0,
8971
9045
  bottom: Number(value),
8972
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
8973
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
9046
+ left: safeArea?.insets.left ?? 0,
9047
+ right: safeArea?.insets.right ?? 0
8974
9048
  }
8975
9049
  })
8976
9050
  }
@@ -8982,14 +9056,14 @@ function ChatGPTSimulator({
8982
9056
  SidebarInput,
8983
9057
  {
8984
9058
  type: "number",
8985
- value: String((safeArea == null ? void 0 : safeArea.insets.left) ?? 0),
9059
+ value: String(safeArea?.insets.left ?? 0),
8986
9060
  onChange: (value) => mock.setSafeArea({
8987
9061
  insets: {
8988
- ...safeArea == null ? void 0 : safeArea.insets,
8989
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
8990
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
9062
+ ...safeArea?.insets,
9063
+ top: safeArea?.insets.top ?? 0,
9064
+ bottom: safeArea?.insets.bottom ?? 0,
8991
9065
  left: Number(value),
8992
- right: (safeArea == null ? void 0 : safeArea.insets.right) ?? 0
9066
+ right: safeArea?.insets.right ?? 0
8993
9067
  }
8994
9068
  })
8995
9069
  }
@@ -9001,13 +9075,13 @@ function ChatGPTSimulator({
9001
9075
  SidebarInput,
9002
9076
  {
9003
9077
  type: "number",
9004
- value: String((safeArea == null ? void 0 : safeArea.insets.right) ?? 0),
9078
+ value: String(safeArea?.insets.right ?? 0),
9005
9079
  onChange: (value) => mock.setSafeArea({
9006
9080
  insets: {
9007
- ...safeArea == null ? void 0 : safeArea.insets,
9008
- top: (safeArea == null ? void 0 : safeArea.insets.top) ?? 0,
9009
- bottom: (safeArea == null ? void 0 : safeArea.insets.bottom) ?? 0,
9010
- left: (safeArea == null ? void 0 : safeArea.insets.left) ?? 0,
9081
+ ...safeArea?.insets,
9082
+ top: safeArea?.insets.top ?? 0,
9083
+ bottom: safeArea?.insets.bottom ?? 0,
9084
+ left: safeArea?.insets.left ?? 0,
9011
9085
  right: Number(value)
9012
9086
  }
9013
9087
  })
@@ -9018,11 +9092,11 @@ function ChatGPTSimulator({
9018
9092
  /* @__PURE__ */ jsxRuntime.jsx(SidebarControl, { label: "View Mode", children: /* @__PURE__ */ jsxRuntime.jsx(
9019
9093
  SidebarSelect,
9020
9094
  {
9021
- value: (view == null ? void 0 : view.mode) ?? "default",
9095
+ value: view?.mode ?? "default",
9022
9096
  onChange: (value) => mock.setView(
9023
9097
  value === "default" ? null : {
9024
9098
  mode: value,
9025
- params: view == null ? void 0 : view.params
9099
+ params: view?.params
9026
9100
  }
9027
9101
  ),
9028
9102
  options: [
@@ -9115,7 +9189,7 @@ function ChatGPTSimulator({
9115
9189
  appName,
9116
9190
  appIcon,
9117
9191
  userMessage,
9118
- resourceMeta: selectedSim == null ? void 0 : selectedSim.resource._meta,
9192
+ resourceMeta: selectedSim?.resource._meta,
9119
9193
  iframeScriptSrc,
9120
9194
  children: content
9121
9195
  },
@@ -9195,4 +9269,4 @@ exports.useWidgetAPI = useWidgetAPI;
9195
9269
  exports.useWidgetGlobal = useWidgetGlobal;
9196
9270
  exports.useWidgetProps = useWidgetProps;
9197
9271
  exports.useWidgetState = useWidgetState;
9198
- //# sourceMappingURL=simulator-url-D4tFBjeu.cjs.map
9272
+ //# sourceMappingURL=simulator-url-pSDp_VWO.cjs.map