@athenaintel/react 0.10.24 → 0.10.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8570,20 +8570,59 @@ function deserializeMessage(msg) {
8570
8570
  }
8571
8571
  return msg;
8572
8572
  }
8573
+ function getAuthMode(auth) {
8574
+ if (auth.token) {
8575
+ return "bearer";
8576
+ }
8577
+ if (auth.apiKey) {
8578
+ return "api-key";
8579
+ }
8580
+ return "none";
8581
+ }
8582
+ function getResponseErrorBody(response) {
8583
+ return response.text().catch(() => "");
8584
+ }
8573
8585
  async function getThreadState(backendUrl, auth, threadId) {
8574
8586
  const base2 = getAthenaApiBaseUrl(backendUrl);
8575
- const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
8576
- method: "GET",
8577
- headers: { ...getAuthHeaders(auth) }
8587
+ const authMode = getAuthMode(auth);
8588
+ const endpoint = `${base2}/api/conversations/threads/get`;
8589
+ console.info("[AthenaSDK] Loading thread state from conversations API:", {
8590
+ threadId,
8591
+ endpoint,
8592
+ authMode,
8593
+ hasToken: Boolean(auth.token),
8594
+ hasApiKey: Boolean(auth.apiKey)
8595
+ });
8596
+ const res = await fetch(endpoint, {
8597
+ method: "POST",
8598
+ headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
8599
+ body: JSON.stringify({
8600
+ thread_id: threadId,
8601
+ skip_cache: true
8602
+ })
8578
8603
  });
8579
8604
  if (!res.ok) {
8580
- throw new Error(`[AthenaSDK] Failed to get thread state: ${res.status}`);
8605
+ const body = await getResponseErrorBody(res);
8606
+ throw new Error(
8607
+ `[AthenaSDK] Failed to get thread state: ${res.status} (${authMode})${body ? `: ${body.slice(0, 300)}` : ""}`
8608
+ );
8581
8609
  }
8582
8610
  const data = await res.json();
8583
- if (Array.isArray(data.messages)) {
8584
- data.messages = data.messages.map(deserializeMessage);
8611
+ const thread = data.thread;
8612
+ if (data.thread_found === false || !thread) {
8613
+ return {
8614
+ thread_id: threadId,
8615
+ messages: []
8616
+ };
8585
8617
  }
8586
- return data;
8618
+ const channelValues = thread.channel_values ?? {};
8619
+ const rawMessages = Array.isArray(channelValues.messages) ? channelValues.messages : Array.isArray(thread.messages) ? thread.messages : [];
8620
+ return {
8621
+ ...channelValues,
8622
+ thread_id: thread.thread_id ?? threadId,
8623
+ messages: rawMessages.map(deserializeMessage),
8624
+ ...thread.state ? { status: thread.state } : {}
8625
+ };
8587
8626
  }
8588
8627
  async function archiveThread(backendUrl, auth, threadId) {
8589
8628
  const base2 = getAthenaApiBaseUrl(backendUrl);
@@ -8978,7 +9017,7 @@ const useAthenaRuntime = (config2) => {
8978
9017
  hasMessages: messageCount > 0
8979
9018
  });
8980
9019
  runtime.thread.importExternalState({
8981
- messages: state.messages
9020
+ ...state
8982
9021
  });
8983
9022
  console.log(
8984
9023
  "[AthenaSDK] importExternalState completed, runtime messages:",
@@ -9054,12 +9093,12 @@ function useComposedRefs(...refs) {
9054
9093
  return React__namespace.useCallback(composeRefs(...refs), refs);
9055
9094
  }
9056
9095
  // @__NO_SIDE_EFFECTS__
9057
- function createSlot$7(ownerName) {
9058
- const SlotClone = /* @__PURE__ */ createSlotClone$7(ownerName);
9096
+ function createSlot(ownerName) {
9097
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
9059
9098
  const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
9060
9099
  const { children, ...slotProps } = props;
9061
9100
  const childrenArray = React__namespace.Children.toArray(children);
9062
- const slottable = childrenArray.find(isSlottable$7);
9101
+ const slottable = childrenArray.find(isSlottable);
9063
9102
  if (slottable) {
9064
9103
  const newElement = slottable.props.children;
9065
9104
  const newChildren = childrenArray.map((child) => {
@@ -9077,13 +9116,14 @@ function createSlot$7(ownerName) {
9077
9116
  Slot2.displayName = `${ownerName}.Slot`;
9078
9117
  return Slot2;
9079
9118
  }
9119
+ var Slot = /* @__PURE__ */ createSlot("Slot");
9080
9120
  // @__NO_SIDE_EFFECTS__
9081
- function createSlotClone$7(ownerName) {
9121
+ function createSlotClone(ownerName) {
9082
9122
  const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
9083
9123
  const { children, ...slotProps } = props;
9084
9124
  if (React__namespace.isValidElement(children)) {
9085
- const childrenRef = getElementRef$8(children);
9086
- const props2 = mergeProps$7(slotProps, children.props);
9125
+ const childrenRef = getElementRef$1(children);
9126
+ const props2 = mergeProps(slotProps, children.props);
9087
9127
  if (children.type !== React__namespace.Fragment) {
9088
9128
  props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9089
9129
  }
@@ -9094,11 +9134,21 @@ function createSlotClone$7(ownerName) {
9094
9134
  SlotClone.displayName = `${ownerName}.SlotClone`;
9095
9135
  return SlotClone;
9096
9136
  }
9097
- var SLOTTABLE_IDENTIFIER$7 = Symbol("radix.slottable");
9098
- function isSlottable$7(child) {
9099
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$7;
9137
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
9138
+ // @__NO_SIDE_EFFECTS__
9139
+ function createSlottable(ownerName) {
9140
+ const Slottable2 = ({ children }) => {
9141
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
9142
+ };
9143
+ Slottable2.displayName = `${ownerName}.Slottable`;
9144
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
9145
+ return Slottable2;
9146
+ }
9147
+ var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
9148
+ function isSlottable(child) {
9149
+ return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
9100
9150
  }
9101
- function mergeProps$7(slotProps, childProps) {
9151
+ function mergeProps(slotProps, childProps) {
9102
9152
  const overrideProps = { ...childProps };
9103
9153
  for (const propName in childProps) {
9104
9154
  const slotPropValue = slotProps[propName];
@@ -9122,7 +9172,7 @@ function mergeProps$7(slotProps, childProps) {
9122
9172
  }
9123
9173
  return { ...slotProps, ...overrideProps };
9124
9174
  }
9125
- function getElementRef$8(element) {
9175
+ function getElementRef$1(element) {
9126
9176
  var _a2, _b;
9127
9177
  let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9128
9178
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -9156,7 +9206,7 @@ var NODES$6 = [
9156
9206
  "ul"
9157
9207
  ];
9158
9208
  var Primitive$6 = NODES$6.reduce((primitive, node) => {
9159
- const Slot2 = /* @__PURE__ */ createSlot$7(`Primitive.${node}`);
9209
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9160
9210
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
9161
9211
  const { asChild, ...primitiveProps } = props;
9162
9212
  const Comp = asChild ? Slot2 : node;
@@ -9331,89 +9381,6 @@ function composeContextScopes$2(...scopes) {
9331
9381
  createScope.scopeName = baseScope.scopeName;
9332
9382
  return createScope;
9333
9383
  }
9334
- // @__NO_SIDE_EFFECTS__
9335
- function createSlot$6(ownerName) {
9336
- const SlotClone = /* @__PURE__ */ createSlotClone$6(ownerName);
9337
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
9338
- const { children, ...slotProps } = props;
9339
- const childrenArray = React__namespace.Children.toArray(children);
9340
- const slottable = childrenArray.find(isSlottable$6);
9341
- if (slottable) {
9342
- const newElement = slottable.props.children;
9343
- const newChildren = childrenArray.map((child) => {
9344
- if (child === slottable) {
9345
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
9346
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
9347
- } else {
9348
- return child;
9349
- }
9350
- });
9351
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
9352
- }
9353
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
9354
- });
9355
- Slot2.displayName = `${ownerName}.Slot`;
9356
- return Slot2;
9357
- }
9358
- // @__NO_SIDE_EFFECTS__
9359
- function createSlotClone$6(ownerName) {
9360
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
9361
- const { children, ...slotProps } = props;
9362
- if (React__namespace.isValidElement(children)) {
9363
- const childrenRef = getElementRef$7(children);
9364
- const props2 = mergeProps$6(slotProps, children.props);
9365
- if (children.type !== React__namespace.Fragment) {
9366
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9367
- }
9368
- return React__namespace.cloneElement(children, props2);
9369
- }
9370
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
9371
- });
9372
- SlotClone.displayName = `${ownerName}.SlotClone`;
9373
- return SlotClone;
9374
- }
9375
- var SLOTTABLE_IDENTIFIER$6 = Symbol("radix.slottable");
9376
- function isSlottable$6(child) {
9377
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$6;
9378
- }
9379
- function mergeProps$6(slotProps, childProps) {
9380
- const overrideProps = { ...childProps };
9381
- for (const propName in childProps) {
9382
- const slotPropValue = slotProps[propName];
9383
- const childPropValue = childProps[propName];
9384
- const isHandler = /^on[A-Z]/.test(propName);
9385
- if (isHandler) {
9386
- if (slotPropValue && childPropValue) {
9387
- overrideProps[propName] = (...args) => {
9388
- const result = childPropValue(...args);
9389
- slotPropValue(...args);
9390
- return result;
9391
- };
9392
- } else if (slotPropValue) {
9393
- overrideProps[propName] = slotPropValue;
9394
- }
9395
- } else if (propName === "style") {
9396
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
9397
- } else if (propName === "className") {
9398
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
9399
- }
9400
- }
9401
- return { ...slotProps, ...overrideProps };
9402
- }
9403
- function getElementRef$7(element) {
9404
- var _a2, _b;
9405
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9406
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9407
- if (mayWarn) {
9408
- return element.ref;
9409
- }
9410
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
9411
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9412
- if (mayWarn) {
9413
- return element.props.ref;
9414
- }
9415
- return element.props.ref || element.ref;
9416
- }
9417
9384
  var NODES$5 = [
9418
9385
  "a",
9419
9386
  "button",
@@ -9434,7 +9401,7 @@ var NODES$5 = [
9434
9401
  "ul"
9435
9402
  ];
9436
9403
  var Primitive$5 = NODES$5.reduce((primitive, node) => {
9437
- const Slot2 = /* @__PURE__ */ createSlot$6(`Primitive.${node}`);
9404
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9438
9405
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
9439
9406
  const { asChild, ...primitiveProps } = props;
9440
9407
  const Comp = asChild ? Slot2 : node;
@@ -9456,7 +9423,7 @@ var Presence = (props) => {
9456
9423
  const { present, children } = props;
9457
9424
  const presence = usePresence(present);
9458
9425
  const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
9459
- const ref = useComposedRefs(presence.ref, getElementRef$6(child));
9426
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
9460
9427
  const forceMount = typeof children === "function";
9461
9428
  return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
9462
9429
  };
@@ -9555,7 +9522,7 @@ function usePresence(present) {
9555
9522
  function getAnimationName(styles) {
9556
9523
  return (styles == null ? void 0 : styles.animationName) || "none";
9557
9524
  }
9558
- function getElementRef$6(element) {
9525
+ function getElementRef(element) {
9559
9526
  var _a2, _b;
9560
9527
  let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9561
9528
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -9708,89 +9675,6 @@ function getState(open) {
9708
9675
  return open ? "open" : "closed";
9709
9676
  }
9710
9677
  var Root$1 = Collapsible$1;
9711
- // @__NO_SIDE_EFFECTS__
9712
- function createSlot$5(ownerName) {
9713
- const SlotClone = /* @__PURE__ */ createSlotClone$5(ownerName);
9714
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
9715
- const { children, ...slotProps } = props;
9716
- const childrenArray = React__namespace.Children.toArray(children);
9717
- const slottable = childrenArray.find(isSlottable$5);
9718
- if (slottable) {
9719
- const newElement = slottable.props.children;
9720
- const newChildren = childrenArray.map((child) => {
9721
- if (child === slottable) {
9722
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
9723
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
9724
- } else {
9725
- return child;
9726
- }
9727
- });
9728
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
9729
- }
9730
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
9731
- });
9732
- Slot2.displayName = `${ownerName}.Slot`;
9733
- return Slot2;
9734
- }
9735
- // @__NO_SIDE_EFFECTS__
9736
- function createSlotClone$5(ownerName) {
9737
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
9738
- const { children, ...slotProps } = props;
9739
- if (React__namespace.isValidElement(children)) {
9740
- const childrenRef = getElementRef$5(children);
9741
- const props2 = mergeProps$5(slotProps, children.props);
9742
- if (children.type !== React__namespace.Fragment) {
9743
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9744
- }
9745
- return React__namespace.cloneElement(children, props2);
9746
- }
9747
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
9748
- });
9749
- SlotClone.displayName = `${ownerName}.SlotClone`;
9750
- return SlotClone;
9751
- }
9752
- var SLOTTABLE_IDENTIFIER$5 = Symbol("radix.slottable");
9753
- function isSlottable$5(child) {
9754
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$5;
9755
- }
9756
- function mergeProps$5(slotProps, childProps) {
9757
- const overrideProps = { ...childProps };
9758
- for (const propName in childProps) {
9759
- const slotPropValue = slotProps[propName];
9760
- const childPropValue = childProps[propName];
9761
- const isHandler = /^on[A-Z]/.test(propName);
9762
- if (isHandler) {
9763
- if (slotPropValue && childPropValue) {
9764
- overrideProps[propName] = (...args) => {
9765
- const result = childPropValue(...args);
9766
- slotPropValue(...args);
9767
- return result;
9768
- };
9769
- } else if (slotPropValue) {
9770
- overrideProps[propName] = slotPropValue;
9771
- }
9772
- } else if (propName === "style") {
9773
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
9774
- } else if (propName === "className") {
9775
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
9776
- }
9777
- }
9778
- return { ...slotProps, ...overrideProps };
9779
- }
9780
- function getElementRef$5(element) {
9781
- var _a2, _b;
9782
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9783
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9784
- if (mayWarn) {
9785
- return element.ref;
9786
- }
9787
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
9788
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9789
- if (mayWarn) {
9790
- return element.props.ref;
9791
- }
9792
- return element.props.ref || element.ref;
9793
- }
9794
9678
  var NODES$4 = [
9795
9679
  "a",
9796
9680
  "button",
@@ -9811,7 +9695,7 @@ var NODES$4 = [
9811
9695
  "ul"
9812
9696
  ];
9813
9697
  var Primitive$4 = NODES$4.reduce((primitive, node) => {
9814
- const Slot2 = /* @__PURE__ */ createSlot$5(`Primitive.${node}`);
9698
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9815
9699
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
9816
9700
  const { asChild, ...primitiveProps } = props;
9817
9701
  const Comp = asChild ? Slot2 : node;
@@ -10049,89 +9933,6 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
10049
9933
  target.dispatchEvent(event);
10050
9934
  }
10051
9935
  }
10052
- // @__NO_SIDE_EFFECTS__
10053
- function createSlot$4(ownerName) {
10054
- const SlotClone = /* @__PURE__ */ createSlotClone$4(ownerName);
10055
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
10056
- const { children, ...slotProps } = props;
10057
- const childrenArray = React__namespace.Children.toArray(children);
10058
- const slottable = childrenArray.find(isSlottable$4);
10059
- if (slottable) {
10060
- const newElement = slottable.props.children;
10061
- const newChildren = childrenArray.map((child) => {
10062
- if (child === slottable) {
10063
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
10064
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
10065
- } else {
10066
- return child;
10067
- }
10068
- });
10069
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
10070
- }
10071
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
10072
- });
10073
- Slot2.displayName = `${ownerName}.Slot`;
10074
- return Slot2;
10075
- }
10076
- // @__NO_SIDE_EFFECTS__
10077
- function createSlotClone$4(ownerName) {
10078
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
10079
- const { children, ...slotProps } = props;
10080
- if (React__namespace.isValidElement(children)) {
10081
- const childrenRef = getElementRef$4(children);
10082
- const props2 = mergeProps$4(slotProps, children.props);
10083
- if (children.type !== React__namespace.Fragment) {
10084
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
10085
- }
10086
- return React__namespace.cloneElement(children, props2);
10087
- }
10088
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
10089
- });
10090
- SlotClone.displayName = `${ownerName}.SlotClone`;
10091
- return SlotClone;
10092
- }
10093
- var SLOTTABLE_IDENTIFIER$4 = Symbol("radix.slottable");
10094
- function isSlottable$4(child) {
10095
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$4;
10096
- }
10097
- function mergeProps$4(slotProps, childProps) {
10098
- const overrideProps = { ...childProps };
10099
- for (const propName in childProps) {
10100
- const slotPropValue = slotProps[propName];
10101
- const childPropValue = childProps[propName];
10102
- const isHandler = /^on[A-Z]/.test(propName);
10103
- if (isHandler) {
10104
- if (slotPropValue && childPropValue) {
10105
- overrideProps[propName] = (...args) => {
10106
- const result = childPropValue(...args);
10107
- slotPropValue(...args);
10108
- return result;
10109
- };
10110
- } else if (slotPropValue) {
10111
- overrideProps[propName] = slotPropValue;
10112
- }
10113
- } else if (propName === "style") {
10114
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
10115
- } else if (propName === "className") {
10116
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
10117
- }
10118
- }
10119
- return { ...slotProps, ...overrideProps };
10120
- }
10121
- function getElementRef$4(element) {
10122
- var _a2, _b;
10123
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
10124
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10125
- if (mayWarn) {
10126
- return element.ref;
10127
- }
10128
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
10129
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10130
- if (mayWarn) {
10131
- return element.props.ref;
10132
- }
10133
- return element.props.ref || element.ref;
10134
- }
10135
9936
  var NODES$3 = [
10136
9937
  "a",
10137
9938
  "button",
@@ -10152,7 +9953,7 @@ var NODES$3 = [
10152
9953
  "ul"
10153
9954
  ];
10154
9955
  var Primitive$3 = NODES$3.reduce((primitive, node) => {
10155
- const Slot2 = /* @__PURE__ */ createSlot$4(`Primitive.${node}`);
9956
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
10156
9957
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
10157
9958
  const { asChild, ...primitiveProps } = props;
10158
9959
  const Comp = asChild ? Slot2 : node;
@@ -10174,100 +9975,6 @@ var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
10174
9975
  return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive$3.div, { ...portalProps, ref: forwardedRef }), container) : null;
10175
9976
  });
10176
9977
  Portal$1.displayName = PORTAL_NAME$1;
10177
- // @__NO_SIDE_EFFECTS__
10178
- function createSlot$3(ownerName) {
10179
- const SlotClone = /* @__PURE__ */ createSlotClone$3(ownerName);
10180
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
10181
- const { children, ...slotProps } = props;
10182
- const childrenArray = React__namespace.Children.toArray(children);
10183
- const slottable = childrenArray.find(isSlottable$3);
10184
- if (slottable) {
10185
- const newElement = slottable.props.children;
10186
- const newChildren = childrenArray.map((child) => {
10187
- if (child === slottable) {
10188
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
10189
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
10190
- } else {
10191
- return child;
10192
- }
10193
- });
10194
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
10195
- }
10196
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
10197
- });
10198
- Slot2.displayName = `${ownerName}.Slot`;
10199
- return Slot2;
10200
- }
10201
- var Slot = /* @__PURE__ */ createSlot$3("Slot");
10202
- // @__NO_SIDE_EFFECTS__
10203
- function createSlotClone$3(ownerName) {
10204
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
10205
- const { children, ...slotProps } = props;
10206
- if (React__namespace.isValidElement(children)) {
10207
- const childrenRef = getElementRef$3(children);
10208
- const props2 = mergeProps$3(slotProps, children.props);
10209
- if (children.type !== React__namespace.Fragment) {
10210
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
10211
- }
10212
- return React__namespace.cloneElement(children, props2);
10213
- }
10214
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
10215
- });
10216
- SlotClone.displayName = `${ownerName}.SlotClone`;
10217
- return SlotClone;
10218
- }
10219
- var SLOTTABLE_IDENTIFIER$3 = Symbol("radix.slottable");
10220
- // @__NO_SIDE_EFFECTS__
10221
- function createSlottable$1(ownerName) {
10222
- const Slottable2 = ({ children }) => {
10223
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
10224
- };
10225
- Slottable2.displayName = `${ownerName}.Slottable`;
10226
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER$3;
10227
- return Slottable2;
10228
- }
10229
- var Slottable$1 = /* @__PURE__ */ createSlottable$1("Slottable");
10230
- function isSlottable$3(child) {
10231
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$3;
10232
- }
10233
- function mergeProps$3(slotProps, childProps) {
10234
- const overrideProps = { ...childProps };
10235
- for (const propName in childProps) {
10236
- const slotPropValue = slotProps[propName];
10237
- const childPropValue = childProps[propName];
10238
- const isHandler = /^on[A-Z]/.test(propName);
10239
- if (isHandler) {
10240
- if (slotPropValue && childPropValue) {
10241
- overrideProps[propName] = (...args) => {
10242
- const result = childPropValue(...args);
10243
- slotPropValue(...args);
10244
- return result;
10245
- };
10246
- } else if (slotPropValue) {
10247
- overrideProps[propName] = slotPropValue;
10248
- }
10249
- } else if (propName === "style") {
10250
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
10251
- } else if (propName === "className") {
10252
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
10253
- }
10254
- }
10255
- return { ...slotProps, ...overrideProps };
10256
- }
10257
- function getElementRef$3(element) {
10258
- var _a2, _b;
10259
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
10260
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10261
- if (mayWarn) {
10262
- return element.ref;
10263
- }
10264
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
10265
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10266
- if (mayWarn) {
10267
- return element.props.ref;
10268
- }
10269
- return element.props.ref || element.ref;
10270
- }
10271
9978
  var shim$1 = { exports: {} };
10272
9979
  var useSyncExternalStoreShim_production = {};
10273
9980
  /**
@@ -12360,89 +12067,6 @@ const arrow$2 = (options, deps) => {
12360
12067
  options: [options, deps]
12361
12068
  };
12362
12069
  };
12363
- // @__NO_SIDE_EFFECTS__
12364
- function createSlot$2(ownerName) {
12365
- const SlotClone = /* @__PURE__ */ createSlotClone$2(ownerName);
12366
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
12367
- const { children, ...slotProps } = props;
12368
- const childrenArray = React__namespace.Children.toArray(children);
12369
- const slottable = childrenArray.find(isSlottable$2);
12370
- if (slottable) {
12371
- const newElement = slottable.props.children;
12372
- const newChildren = childrenArray.map((child) => {
12373
- if (child === slottable) {
12374
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
12375
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
12376
- } else {
12377
- return child;
12378
- }
12379
- });
12380
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
12381
- }
12382
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12383
- });
12384
- Slot2.displayName = `${ownerName}.Slot`;
12385
- return Slot2;
12386
- }
12387
- // @__NO_SIDE_EFFECTS__
12388
- function createSlotClone$2(ownerName) {
12389
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
12390
- const { children, ...slotProps } = props;
12391
- if (React__namespace.isValidElement(children)) {
12392
- const childrenRef = getElementRef$2(children);
12393
- const props2 = mergeProps$2(slotProps, children.props);
12394
- if (children.type !== React__namespace.Fragment) {
12395
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12396
- }
12397
- return React__namespace.cloneElement(children, props2);
12398
- }
12399
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
12400
- });
12401
- SlotClone.displayName = `${ownerName}.SlotClone`;
12402
- return SlotClone;
12403
- }
12404
- var SLOTTABLE_IDENTIFIER$2 = Symbol("radix.slottable");
12405
- function isSlottable$2(child) {
12406
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$2;
12407
- }
12408
- function mergeProps$2(slotProps, childProps) {
12409
- const overrideProps = { ...childProps };
12410
- for (const propName in childProps) {
12411
- const slotPropValue = slotProps[propName];
12412
- const childPropValue = childProps[propName];
12413
- const isHandler = /^on[A-Z]/.test(propName);
12414
- if (isHandler) {
12415
- if (slotPropValue && childPropValue) {
12416
- overrideProps[propName] = (...args) => {
12417
- const result = childPropValue(...args);
12418
- slotPropValue(...args);
12419
- return result;
12420
- };
12421
- } else if (slotPropValue) {
12422
- overrideProps[propName] = slotPropValue;
12423
- }
12424
- } else if (propName === "style") {
12425
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
12426
- } else if (propName === "className") {
12427
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
12428
- }
12429
- }
12430
- return { ...slotProps, ...overrideProps };
12431
- }
12432
- function getElementRef$2(element) {
12433
- var _a2, _b;
12434
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
12435
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12436
- if (mayWarn) {
12437
- return element.ref;
12438
- }
12439
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
12440
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12441
- if (mayWarn) {
12442
- return element.props.ref;
12443
- }
12444
- return element.props.ref || element.ref;
12445
- }
12446
12070
  var NODES$2 = [
12447
12071
  "a",
12448
12072
  "button",
@@ -12463,7 +12087,7 @@ var NODES$2 = [
12463
12087
  "ul"
12464
12088
  ];
12465
12089
  var Primitive$2 = NODES$2.reduce((primitive, node) => {
12466
- const Slot2 = /* @__PURE__ */ createSlot$2(`Primitive.${node}`);
12090
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
12467
12091
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
12468
12092
  const { asChild, ...primitiveProps } = props;
12469
12093
  const Comp = asChild ? Slot2 : node;
@@ -12552,89 +12176,6 @@ function composeContextScopes$1(...scopes) {
12552
12176
  createScope.scopeName = baseScope.scopeName;
12553
12177
  return createScope;
12554
12178
  }
12555
- // @__NO_SIDE_EFFECTS__
12556
- function createSlot$1(ownerName) {
12557
- const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
12558
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
12559
- const { children, ...slotProps } = props;
12560
- const childrenArray = React__namespace.Children.toArray(children);
12561
- const slottable = childrenArray.find(isSlottable$1);
12562
- if (slottable) {
12563
- const newElement = slottable.props.children;
12564
- const newChildren = childrenArray.map((child) => {
12565
- if (child === slottable) {
12566
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
12567
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
12568
- } else {
12569
- return child;
12570
- }
12571
- });
12572
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
12573
- }
12574
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12575
- });
12576
- Slot2.displayName = `${ownerName}.Slot`;
12577
- return Slot2;
12578
- }
12579
- // @__NO_SIDE_EFFECTS__
12580
- function createSlotClone$1(ownerName) {
12581
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
12582
- const { children, ...slotProps } = props;
12583
- if (React__namespace.isValidElement(children)) {
12584
- const childrenRef = getElementRef$1(children);
12585
- const props2 = mergeProps$1(slotProps, children.props);
12586
- if (children.type !== React__namespace.Fragment) {
12587
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12588
- }
12589
- return React__namespace.cloneElement(children, props2);
12590
- }
12591
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
12592
- });
12593
- SlotClone.displayName = `${ownerName}.SlotClone`;
12594
- return SlotClone;
12595
- }
12596
- var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
12597
- function isSlottable$1(child) {
12598
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
12599
- }
12600
- function mergeProps$1(slotProps, childProps) {
12601
- const overrideProps = { ...childProps };
12602
- for (const propName in childProps) {
12603
- const slotPropValue = slotProps[propName];
12604
- const childPropValue = childProps[propName];
12605
- const isHandler = /^on[A-Z]/.test(propName);
12606
- if (isHandler) {
12607
- if (slotPropValue && childPropValue) {
12608
- overrideProps[propName] = (...args) => {
12609
- const result = childPropValue(...args);
12610
- slotPropValue(...args);
12611
- return result;
12612
- };
12613
- } else if (slotPropValue) {
12614
- overrideProps[propName] = slotPropValue;
12615
- }
12616
- } else if (propName === "style") {
12617
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
12618
- } else if (propName === "className") {
12619
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
12620
- }
12621
- }
12622
- return { ...slotProps, ...overrideProps };
12623
- }
12624
- function getElementRef$1(element) {
12625
- var _a2, _b;
12626
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
12627
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12628
- if (mayWarn) {
12629
- return element.ref;
12630
- }
12631
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
12632
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12633
- if (mayWarn) {
12634
- return element.props.ref;
12635
- }
12636
- return element.props.ref || element.ref;
12637
- }
12638
12179
  var NODES$1 = [
12639
12180
  "a",
12640
12181
  "button",
@@ -12655,7 +12196,7 @@ var NODES$1 = [
12655
12196
  "ul"
12656
12197
  ];
12657
12198
  var Primitive$1 = NODES$1.reduce((primitive, node) => {
12658
- const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
12199
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
12659
12200
  const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
12660
12201
  const { asChild, ...primitiveProps } = props;
12661
12202
  const Comp = asChild ? Slot2 : node;
@@ -12997,98 +12538,6 @@ function composeContextScopes(...scopes) {
12997
12538
  createScope.scopeName = baseScope.scopeName;
12998
12539
  return createScope;
12999
12540
  }
13000
- // @__NO_SIDE_EFFECTS__
13001
- function createSlot(ownerName) {
13002
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
13003
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
13004
- const { children, ...slotProps } = props;
13005
- const childrenArray = React__namespace.Children.toArray(children);
13006
- const slottable = childrenArray.find(isSlottable);
13007
- if (slottable) {
13008
- const newElement = slottable.props.children;
13009
- const newChildren = childrenArray.map((child) => {
13010
- if (child === slottable) {
13011
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
13012
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
13013
- } else {
13014
- return child;
13015
- }
13016
- });
13017
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
13018
- }
13019
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
13020
- });
13021
- Slot2.displayName = `${ownerName}.Slot`;
13022
- return Slot2;
13023
- }
13024
- // @__NO_SIDE_EFFECTS__
13025
- function createSlotClone(ownerName) {
13026
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
13027
- const { children, ...slotProps } = props;
13028
- if (React__namespace.isValidElement(children)) {
13029
- const childrenRef = getElementRef(children);
13030
- const props2 = mergeProps(slotProps, children.props);
13031
- if (children.type !== React__namespace.Fragment) {
13032
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
13033
- }
13034
- return React__namespace.cloneElement(children, props2);
13035
- }
13036
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
13037
- });
13038
- SlotClone.displayName = `${ownerName}.SlotClone`;
13039
- return SlotClone;
13040
- }
13041
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
13042
- // @__NO_SIDE_EFFECTS__
13043
- function createSlottable(ownerName) {
13044
- const Slottable2 = ({ children }) => {
13045
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
13046
- };
13047
- Slottable2.displayName = `${ownerName}.Slottable`;
13048
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
13049
- return Slottable2;
13050
- }
13051
- function isSlottable(child) {
13052
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
13053
- }
13054
- function mergeProps(slotProps, childProps) {
13055
- const overrideProps = { ...childProps };
13056
- for (const propName in childProps) {
13057
- const slotPropValue = slotProps[propName];
13058
- const childPropValue = childProps[propName];
13059
- const isHandler = /^on[A-Z]/.test(propName);
13060
- if (isHandler) {
13061
- if (slotPropValue && childPropValue) {
13062
- overrideProps[propName] = (...args) => {
13063
- const result = childPropValue(...args);
13064
- slotPropValue(...args);
13065
- return result;
13066
- };
13067
- } else if (slotPropValue) {
13068
- overrideProps[propName] = slotPropValue;
13069
- }
13070
- } else if (propName === "style") {
13071
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
13072
- } else if (propName === "className") {
13073
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
13074
- }
13075
- }
13076
- return { ...slotProps, ...overrideProps };
13077
- }
13078
- function getElementRef(element) {
13079
- var _a2, _b;
13080
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
13081
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13082
- if (mayWarn) {
13083
- return element.ref;
13084
- }
13085
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
13086
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13087
- if (mayWarn) {
13088
- return element.props.ref;
13089
- }
13090
- return element.props.ref || element.ref;
13091
- }
13092
12541
  var NODES = [
13093
12542
  "a",
13094
12543
  "button",
@@ -46905,7 +46354,12 @@ const ComposerKeybinds = Extension.create({
46905
46354
  if (editor.isActive("bulletList") || editor.isActive("orderedList")) {
46906
46355
  return false;
46907
46356
  }
46908
- this.options.onSubmit();
46357
+ const submit = this.options.onSubmit;
46358
+ if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
46359
+ window.requestAnimationFrame(() => submit());
46360
+ } else {
46361
+ submit();
46362
+ }
46909
46363
  return true;
46910
46364
  },
46911
46365
  "Shift-Enter": ({ editor }) => {