@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.js CHANGED
@@ -8530,20 +8530,59 @@ function deserializeMessage(msg) {
8530
8530
  }
8531
8531
  return msg;
8532
8532
  }
8533
+ function getAuthMode(auth) {
8534
+ if (auth.token) {
8535
+ return "bearer";
8536
+ }
8537
+ if (auth.apiKey) {
8538
+ return "api-key";
8539
+ }
8540
+ return "none";
8541
+ }
8542
+ function getResponseErrorBody(response) {
8543
+ return response.text().catch(() => "");
8544
+ }
8533
8545
  async function getThreadState(backendUrl, auth, threadId) {
8534
8546
  const base2 = getAthenaApiBaseUrl(backendUrl);
8535
- const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
8536
- method: "GET",
8537
- headers: { ...getAuthHeaders(auth) }
8547
+ const authMode = getAuthMode(auth);
8548
+ const endpoint = `${base2}/api/conversations/threads/get`;
8549
+ console.info("[AthenaSDK] Loading thread state from conversations API:", {
8550
+ threadId,
8551
+ endpoint,
8552
+ authMode,
8553
+ hasToken: Boolean(auth.token),
8554
+ hasApiKey: Boolean(auth.apiKey)
8555
+ });
8556
+ const res = await fetch(endpoint, {
8557
+ method: "POST",
8558
+ headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
8559
+ body: JSON.stringify({
8560
+ thread_id: threadId,
8561
+ skip_cache: true
8562
+ })
8538
8563
  });
8539
8564
  if (!res.ok) {
8540
- throw new Error(`[AthenaSDK] Failed to get thread state: ${res.status}`);
8565
+ const body = await getResponseErrorBody(res);
8566
+ throw new Error(
8567
+ `[AthenaSDK] Failed to get thread state: ${res.status} (${authMode})${body ? `: ${body.slice(0, 300)}` : ""}`
8568
+ );
8541
8569
  }
8542
8570
  const data = await res.json();
8543
- if (Array.isArray(data.messages)) {
8544
- data.messages = data.messages.map(deserializeMessage);
8571
+ const thread = data.thread;
8572
+ if (data.thread_found === false || !thread) {
8573
+ return {
8574
+ thread_id: threadId,
8575
+ messages: []
8576
+ };
8545
8577
  }
8546
- return data;
8578
+ const channelValues = thread.channel_values ?? {};
8579
+ const rawMessages = Array.isArray(channelValues.messages) ? channelValues.messages : Array.isArray(thread.messages) ? thread.messages : [];
8580
+ return {
8581
+ ...channelValues,
8582
+ thread_id: thread.thread_id ?? threadId,
8583
+ messages: rawMessages.map(deserializeMessage),
8584
+ ...thread.state ? { status: thread.state } : {}
8585
+ };
8547
8586
  }
8548
8587
  async function archiveThread(backendUrl, auth, threadId) {
8549
8588
  const base2 = getAthenaApiBaseUrl(backendUrl);
@@ -8938,7 +8977,7 @@ const useAthenaRuntime = (config2) => {
8938
8977
  hasMessages: messageCount > 0
8939
8978
  });
8940
8979
  runtime.thread.importExternalState({
8941
- messages: state.messages
8980
+ ...state
8942
8981
  });
8943
8982
  console.log(
8944
8983
  "[AthenaSDK] importExternalState completed, runtime messages:",
@@ -9014,12 +9053,12 @@ function useComposedRefs(...refs) {
9014
9053
  return React.useCallback(composeRefs(...refs), refs);
9015
9054
  }
9016
9055
  // @__NO_SIDE_EFFECTS__
9017
- function createSlot$7(ownerName) {
9018
- const SlotClone = /* @__PURE__ */ createSlotClone$7(ownerName);
9056
+ function createSlot(ownerName) {
9057
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
9019
9058
  const Slot2 = React.forwardRef((props, forwardedRef) => {
9020
9059
  const { children, ...slotProps } = props;
9021
9060
  const childrenArray = React.Children.toArray(children);
9022
- const slottable = childrenArray.find(isSlottable$7);
9061
+ const slottable = childrenArray.find(isSlottable);
9023
9062
  if (slottable) {
9024
9063
  const newElement = slottable.props.children;
9025
9064
  const newChildren = childrenArray.map((child) => {
@@ -9037,13 +9076,14 @@ function createSlot$7(ownerName) {
9037
9076
  Slot2.displayName = `${ownerName}.Slot`;
9038
9077
  return Slot2;
9039
9078
  }
9079
+ var Slot = /* @__PURE__ */ createSlot("Slot");
9040
9080
  // @__NO_SIDE_EFFECTS__
9041
- function createSlotClone$7(ownerName) {
9081
+ function createSlotClone(ownerName) {
9042
9082
  const SlotClone = React.forwardRef((props, forwardedRef) => {
9043
9083
  const { children, ...slotProps } = props;
9044
9084
  if (React.isValidElement(children)) {
9045
- const childrenRef = getElementRef$8(children);
9046
- const props2 = mergeProps$7(slotProps, children.props);
9085
+ const childrenRef = getElementRef$1(children);
9086
+ const props2 = mergeProps(slotProps, children.props);
9047
9087
  if (children.type !== React.Fragment) {
9048
9088
  props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9049
9089
  }
@@ -9054,11 +9094,21 @@ function createSlotClone$7(ownerName) {
9054
9094
  SlotClone.displayName = `${ownerName}.SlotClone`;
9055
9095
  return SlotClone;
9056
9096
  }
9057
- var SLOTTABLE_IDENTIFIER$7 = Symbol("radix.slottable");
9058
- function isSlottable$7(child) {
9059
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$7;
9097
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
9098
+ // @__NO_SIDE_EFFECTS__
9099
+ function createSlottable(ownerName) {
9100
+ const Slottable2 = ({ children }) => {
9101
+ return /* @__PURE__ */ jsx(Fragment$1, { children });
9102
+ };
9103
+ Slottable2.displayName = `${ownerName}.Slottable`;
9104
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
9105
+ return Slottable2;
9106
+ }
9107
+ var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
9108
+ function isSlottable(child) {
9109
+ return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
9060
9110
  }
9061
- function mergeProps$7(slotProps, childProps) {
9111
+ function mergeProps(slotProps, childProps) {
9062
9112
  const overrideProps = { ...childProps };
9063
9113
  for (const propName in childProps) {
9064
9114
  const slotPropValue = slotProps[propName];
@@ -9082,7 +9132,7 @@ function mergeProps$7(slotProps, childProps) {
9082
9132
  }
9083
9133
  return { ...slotProps, ...overrideProps };
9084
9134
  }
9085
- function getElementRef$8(element) {
9135
+ function getElementRef$1(element) {
9086
9136
  var _a2, _b;
9087
9137
  let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9088
9138
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -9116,7 +9166,7 @@ var NODES$6 = [
9116
9166
  "ul"
9117
9167
  ];
9118
9168
  var Primitive$6 = NODES$6.reduce((primitive, node) => {
9119
- const Slot2 = /* @__PURE__ */ createSlot$7(`Primitive.${node}`);
9169
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9120
9170
  const Node4 = React.forwardRef((props, forwardedRef) => {
9121
9171
  const { asChild, ...primitiveProps } = props;
9122
9172
  const Comp = asChild ? Slot2 : node;
@@ -9291,89 +9341,6 @@ function composeContextScopes$2(...scopes) {
9291
9341
  createScope.scopeName = baseScope.scopeName;
9292
9342
  return createScope;
9293
9343
  }
9294
- // @__NO_SIDE_EFFECTS__
9295
- function createSlot$6(ownerName) {
9296
- const SlotClone = /* @__PURE__ */ createSlotClone$6(ownerName);
9297
- const Slot2 = React.forwardRef((props, forwardedRef) => {
9298
- const { children, ...slotProps } = props;
9299
- const childrenArray = React.Children.toArray(children);
9300
- const slottable = childrenArray.find(isSlottable$6);
9301
- if (slottable) {
9302
- const newElement = slottable.props.children;
9303
- const newChildren = childrenArray.map((child) => {
9304
- if (child === slottable) {
9305
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
9306
- return React.isValidElement(newElement) ? newElement.props.children : null;
9307
- } else {
9308
- return child;
9309
- }
9310
- });
9311
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
9312
- }
9313
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
9314
- });
9315
- Slot2.displayName = `${ownerName}.Slot`;
9316
- return Slot2;
9317
- }
9318
- // @__NO_SIDE_EFFECTS__
9319
- function createSlotClone$6(ownerName) {
9320
- const SlotClone = React.forwardRef((props, forwardedRef) => {
9321
- const { children, ...slotProps } = props;
9322
- if (React.isValidElement(children)) {
9323
- const childrenRef = getElementRef$7(children);
9324
- const props2 = mergeProps$6(slotProps, children.props);
9325
- if (children.type !== React.Fragment) {
9326
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9327
- }
9328
- return React.cloneElement(children, props2);
9329
- }
9330
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
9331
- });
9332
- SlotClone.displayName = `${ownerName}.SlotClone`;
9333
- return SlotClone;
9334
- }
9335
- var SLOTTABLE_IDENTIFIER$6 = Symbol("radix.slottable");
9336
- function isSlottable$6(child) {
9337
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$6;
9338
- }
9339
- function mergeProps$6(slotProps, childProps) {
9340
- const overrideProps = { ...childProps };
9341
- for (const propName in childProps) {
9342
- const slotPropValue = slotProps[propName];
9343
- const childPropValue = childProps[propName];
9344
- const isHandler = /^on[A-Z]/.test(propName);
9345
- if (isHandler) {
9346
- if (slotPropValue && childPropValue) {
9347
- overrideProps[propName] = (...args) => {
9348
- const result = childPropValue(...args);
9349
- slotPropValue(...args);
9350
- return result;
9351
- };
9352
- } else if (slotPropValue) {
9353
- overrideProps[propName] = slotPropValue;
9354
- }
9355
- } else if (propName === "style") {
9356
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
9357
- } else if (propName === "className") {
9358
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
9359
- }
9360
- }
9361
- return { ...slotProps, ...overrideProps };
9362
- }
9363
- function getElementRef$7(element) {
9364
- var _a2, _b;
9365
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9366
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9367
- if (mayWarn) {
9368
- return element.ref;
9369
- }
9370
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
9371
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9372
- if (mayWarn) {
9373
- return element.props.ref;
9374
- }
9375
- return element.props.ref || element.ref;
9376
- }
9377
9344
  var NODES$5 = [
9378
9345
  "a",
9379
9346
  "button",
@@ -9394,7 +9361,7 @@ var NODES$5 = [
9394
9361
  "ul"
9395
9362
  ];
9396
9363
  var Primitive$5 = NODES$5.reduce((primitive, node) => {
9397
- const Slot2 = /* @__PURE__ */ createSlot$6(`Primitive.${node}`);
9364
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9398
9365
  const Node4 = React.forwardRef((props, forwardedRef) => {
9399
9366
  const { asChild, ...primitiveProps } = props;
9400
9367
  const Comp = asChild ? Slot2 : node;
@@ -9416,7 +9383,7 @@ var Presence = (props) => {
9416
9383
  const { present, children } = props;
9417
9384
  const presence = usePresence(present);
9418
9385
  const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
9419
- const ref = useComposedRefs(presence.ref, getElementRef$6(child));
9386
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
9420
9387
  const forceMount = typeof children === "function";
9421
9388
  return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
9422
9389
  };
@@ -9515,7 +9482,7 @@ function usePresence(present) {
9515
9482
  function getAnimationName(styles) {
9516
9483
  return (styles == null ? void 0 : styles.animationName) || "none";
9517
9484
  }
9518
- function getElementRef$6(element) {
9485
+ function getElementRef(element) {
9519
9486
  var _a2, _b;
9520
9487
  let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9521
9488
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
@@ -9668,89 +9635,6 @@ function getState(open) {
9668
9635
  return open ? "open" : "closed";
9669
9636
  }
9670
9637
  var Root$1 = Collapsible$1;
9671
- // @__NO_SIDE_EFFECTS__
9672
- function createSlot$5(ownerName) {
9673
- const SlotClone = /* @__PURE__ */ createSlotClone$5(ownerName);
9674
- const Slot2 = React.forwardRef((props, forwardedRef) => {
9675
- const { children, ...slotProps } = props;
9676
- const childrenArray = React.Children.toArray(children);
9677
- const slottable = childrenArray.find(isSlottable$5);
9678
- if (slottable) {
9679
- const newElement = slottable.props.children;
9680
- const newChildren = childrenArray.map((child) => {
9681
- if (child === slottable) {
9682
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
9683
- return React.isValidElement(newElement) ? newElement.props.children : null;
9684
- } else {
9685
- return child;
9686
- }
9687
- });
9688
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
9689
- }
9690
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
9691
- });
9692
- Slot2.displayName = `${ownerName}.Slot`;
9693
- return Slot2;
9694
- }
9695
- // @__NO_SIDE_EFFECTS__
9696
- function createSlotClone$5(ownerName) {
9697
- const SlotClone = React.forwardRef((props, forwardedRef) => {
9698
- const { children, ...slotProps } = props;
9699
- if (React.isValidElement(children)) {
9700
- const childrenRef = getElementRef$5(children);
9701
- const props2 = mergeProps$5(slotProps, children.props);
9702
- if (children.type !== React.Fragment) {
9703
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
9704
- }
9705
- return React.cloneElement(children, props2);
9706
- }
9707
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
9708
- });
9709
- SlotClone.displayName = `${ownerName}.SlotClone`;
9710
- return SlotClone;
9711
- }
9712
- var SLOTTABLE_IDENTIFIER$5 = Symbol("radix.slottable");
9713
- function isSlottable$5(child) {
9714
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$5;
9715
- }
9716
- function mergeProps$5(slotProps, childProps) {
9717
- const overrideProps = { ...childProps };
9718
- for (const propName in childProps) {
9719
- const slotPropValue = slotProps[propName];
9720
- const childPropValue = childProps[propName];
9721
- const isHandler = /^on[A-Z]/.test(propName);
9722
- if (isHandler) {
9723
- if (slotPropValue && childPropValue) {
9724
- overrideProps[propName] = (...args) => {
9725
- const result = childPropValue(...args);
9726
- slotPropValue(...args);
9727
- return result;
9728
- };
9729
- } else if (slotPropValue) {
9730
- overrideProps[propName] = slotPropValue;
9731
- }
9732
- } else if (propName === "style") {
9733
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
9734
- } else if (propName === "className") {
9735
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
9736
- }
9737
- }
9738
- return { ...slotProps, ...overrideProps };
9739
- }
9740
- function getElementRef$5(element) {
9741
- var _a2, _b;
9742
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
9743
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9744
- if (mayWarn) {
9745
- return element.ref;
9746
- }
9747
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
9748
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
9749
- if (mayWarn) {
9750
- return element.props.ref;
9751
- }
9752
- return element.props.ref || element.ref;
9753
- }
9754
9638
  var NODES$4 = [
9755
9639
  "a",
9756
9640
  "button",
@@ -9771,7 +9655,7 @@ var NODES$4 = [
9771
9655
  "ul"
9772
9656
  ];
9773
9657
  var Primitive$4 = NODES$4.reduce((primitive, node) => {
9774
- const Slot2 = /* @__PURE__ */ createSlot$5(`Primitive.${node}`);
9658
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
9775
9659
  const Node4 = React.forwardRef((props, forwardedRef) => {
9776
9660
  const { asChild, ...primitiveProps } = props;
9777
9661
  const Comp = asChild ? Slot2 : node;
@@ -10009,89 +9893,6 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
10009
9893
  target.dispatchEvent(event);
10010
9894
  }
10011
9895
  }
10012
- // @__NO_SIDE_EFFECTS__
10013
- function createSlot$4(ownerName) {
10014
- const SlotClone = /* @__PURE__ */ createSlotClone$4(ownerName);
10015
- const Slot2 = React.forwardRef((props, forwardedRef) => {
10016
- const { children, ...slotProps } = props;
10017
- const childrenArray = React.Children.toArray(children);
10018
- const slottable = childrenArray.find(isSlottable$4);
10019
- if (slottable) {
10020
- const newElement = slottable.props.children;
10021
- const newChildren = childrenArray.map((child) => {
10022
- if (child === slottable) {
10023
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
10024
- return React.isValidElement(newElement) ? newElement.props.children : null;
10025
- } else {
10026
- return child;
10027
- }
10028
- });
10029
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
10030
- }
10031
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
10032
- });
10033
- Slot2.displayName = `${ownerName}.Slot`;
10034
- return Slot2;
10035
- }
10036
- // @__NO_SIDE_EFFECTS__
10037
- function createSlotClone$4(ownerName) {
10038
- const SlotClone = React.forwardRef((props, forwardedRef) => {
10039
- const { children, ...slotProps } = props;
10040
- if (React.isValidElement(children)) {
10041
- const childrenRef = getElementRef$4(children);
10042
- const props2 = mergeProps$4(slotProps, children.props);
10043
- if (children.type !== React.Fragment) {
10044
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
10045
- }
10046
- return React.cloneElement(children, props2);
10047
- }
10048
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
10049
- });
10050
- SlotClone.displayName = `${ownerName}.SlotClone`;
10051
- return SlotClone;
10052
- }
10053
- var SLOTTABLE_IDENTIFIER$4 = Symbol("radix.slottable");
10054
- function isSlottable$4(child) {
10055
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$4;
10056
- }
10057
- function mergeProps$4(slotProps, childProps) {
10058
- const overrideProps = { ...childProps };
10059
- for (const propName in childProps) {
10060
- const slotPropValue = slotProps[propName];
10061
- const childPropValue = childProps[propName];
10062
- const isHandler = /^on[A-Z]/.test(propName);
10063
- if (isHandler) {
10064
- if (slotPropValue && childPropValue) {
10065
- overrideProps[propName] = (...args) => {
10066
- const result = childPropValue(...args);
10067
- slotPropValue(...args);
10068
- return result;
10069
- };
10070
- } else if (slotPropValue) {
10071
- overrideProps[propName] = slotPropValue;
10072
- }
10073
- } else if (propName === "style") {
10074
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
10075
- } else if (propName === "className") {
10076
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
10077
- }
10078
- }
10079
- return { ...slotProps, ...overrideProps };
10080
- }
10081
- function getElementRef$4(element) {
10082
- var _a2, _b;
10083
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
10084
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10085
- if (mayWarn) {
10086
- return element.ref;
10087
- }
10088
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
10089
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10090
- if (mayWarn) {
10091
- return element.props.ref;
10092
- }
10093
- return element.props.ref || element.ref;
10094
- }
10095
9896
  var NODES$3 = [
10096
9897
  "a",
10097
9898
  "button",
@@ -10112,7 +9913,7 @@ var NODES$3 = [
10112
9913
  "ul"
10113
9914
  ];
10114
9915
  var Primitive$3 = NODES$3.reduce((primitive, node) => {
10115
- const Slot2 = /* @__PURE__ */ createSlot$4(`Primitive.${node}`);
9916
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
10116
9917
  const Node4 = React.forwardRef((props, forwardedRef) => {
10117
9918
  const { asChild, ...primitiveProps } = props;
10118
9919
  const Comp = asChild ? Slot2 : node;
@@ -10134,100 +9935,6 @@ var Portal$1 = React.forwardRef((props, forwardedRef) => {
10134
9935
  return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive$3.div, { ...portalProps, ref: forwardedRef }), container) : null;
10135
9936
  });
10136
9937
  Portal$1.displayName = PORTAL_NAME$1;
10137
- // @__NO_SIDE_EFFECTS__
10138
- function createSlot$3(ownerName) {
10139
- const SlotClone = /* @__PURE__ */ createSlotClone$3(ownerName);
10140
- const Slot2 = React.forwardRef((props, forwardedRef) => {
10141
- const { children, ...slotProps } = props;
10142
- const childrenArray = React.Children.toArray(children);
10143
- const slottable = childrenArray.find(isSlottable$3);
10144
- if (slottable) {
10145
- const newElement = slottable.props.children;
10146
- const newChildren = childrenArray.map((child) => {
10147
- if (child === slottable) {
10148
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
10149
- return React.isValidElement(newElement) ? newElement.props.children : null;
10150
- } else {
10151
- return child;
10152
- }
10153
- });
10154
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
10155
- }
10156
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
10157
- });
10158
- Slot2.displayName = `${ownerName}.Slot`;
10159
- return Slot2;
10160
- }
10161
- var Slot = /* @__PURE__ */ createSlot$3("Slot");
10162
- // @__NO_SIDE_EFFECTS__
10163
- function createSlotClone$3(ownerName) {
10164
- const SlotClone = React.forwardRef((props, forwardedRef) => {
10165
- const { children, ...slotProps } = props;
10166
- if (React.isValidElement(children)) {
10167
- const childrenRef = getElementRef$3(children);
10168
- const props2 = mergeProps$3(slotProps, children.props);
10169
- if (children.type !== React.Fragment) {
10170
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
10171
- }
10172
- return React.cloneElement(children, props2);
10173
- }
10174
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
10175
- });
10176
- SlotClone.displayName = `${ownerName}.SlotClone`;
10177
- return SlotClone;
10178
- }
10179
- var SLOTTABLE_IDENTIFIER$3 = Symbol("radix.slottable");
10180
- // @__NO_SIDE_EFFECTS__
10181
- function createSlottable$1(ownerName) {
10182
- const Slottable2 = ({ children }) => {
10183
- return /* @__PURE__ */ jsx(Fragment$1, { children });
10184
- };
10185
- Slottable2.displayName = `${ownerName}.Slottable`;
10186
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER$3;
10187
- return Slottable2;
10188
- }
10189
- var Slottable$1 = /* @__PURE__ */ createSlottable$1("Slottable");
10190
- function isSlottable$3(child) {
10191
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$3;
10192
- }
10193
- function mergeProps$3(slotProps, childProps) {
10194
- const overrideProps = { ...childProps };
10195
- for (const propName in childProps) {
10196
- const slotPropValue = slotProps[propName];
10197
- const childPropValue = childProps[propName];
10198
- const isHandler = /^on[A-Z]/.test(propName);
10199
- if (isHandler) {
10200
- if (slotPropValue && childPropValue) {
10201
- overrideProps[propName] = (...args) => {
10202
- const result = childPropValue(...args);
10203
- slotPropValue(...args);
10204
- return result;
10205
- };
10206
- } else if (slotPropValue) {
10207
- overrideProps[propName] = slotPropValue;
10208
- }
10209
- } else if (propName === "style") {
10210
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
10211
- } else if (propName === "className") {
10212
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
10213
- }
10214
- }
10215
- return { ...slotProps, ...overrideProps };
10216
- }
10217
- function getElementRef$3(element) {
10218
- var _a2, _b;
10219
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
10220
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10221
- if (mayWarn) {
10222
- return element.ref;
10223
- }
10224
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
10225
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
10226
- if (mayWarn) {
10227
- return element.props.ref;
10228
- }
10229
- return element.props.ref || element.ref;
10230
- }
10231
9938
  var shim$1 = { exports: {} };
10232
9939
  var useSyncExternalStoreShim_production = {};
10233
9940
  /**
@@ -12320,89 +12027,6 @@ const arrow$2 = (options, deps) => {
12320
12027
  options: [options, deps]
12321
12028
  };
12322
12029
  };
12323
- // @__NO_SIDE_EFFECTS__
12324
- function createSlot$2(ownerName) {
12325
- const SlotClone = /* @__PURE__ */ createSlotClone$2(ownerName);
12326
- const Slot2 = React.forwardRef((props, forwardedRef) => {
12327
- const { children, ...slotProps } = props;
12328
- const childrenArray = React.Children.toArray(children);
12329
- const slottable = childrenArray.find(isSlottable$2);
12330
- if (slottable) {
12331
- const newElement = slottable.props.children;
12332
- const newChildren = childrenArray.map((child) => {
12333
- if (child === slottable) {
12334
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
12335
- return React.isValidElement(newElement) ? newElement.props.children : null;
12336
- } else {
12337
- return child;
12338
- }
12339
- });
12340
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
12341
- }
12342
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12343
- });
12344
- Slot2.displayName = `${ownerName}.Slot`;
12345
- return Slot2;
12346
- }
12347
- // @__NO_SIDE_EFFECTS__
12348
- function createSlotClone$2(ownerName) {
12349
- const SlotClone = React.forwardRef((props, forwardedRef) => {
12350
- const { children, ...slotProps } = props;
12351
- if (React.isValidElement(children)) {
12352
- const childrenRef = getElementRef$2(children);
12353
- const props2 = mergeProps$2(slotProps, children.props);
12354
- if (children.type !== React.Fragment) {
12355
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12356
- }
12357
- return React.cloneElement(children, props2);
12358
- }
12359
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
12360
- });
12361
- SlotClone.displayName = `${ownerName}.SlotClone`;
12362
- return SlotClone;
12363
- }
12364
- var SLOTTABLE_IDENTIFIER$2 = Symbol("radix.slottable");
12365
- function isSlottable$2(child) {
12366
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$2;
12367
- }
12368
- function mergeProps$2(slotProps, childProps) {
12369
- const overrideProps = { ...childProps };
12370
- for (const propName in childProps) {
12371
- const slotPropValue = slotProps[propName];
12372
- const childPropValue = childProps[propName];
12373
- const isHandler = /^on[A-Z]/.test(propName);
12374
- if (isHandler) {
12375
- if (slotPropValue && childPropValue) {
12376
- overrideProps[propName] = (...args) => {
12377
- const result = childPropValue(...args);
12378
- slotPropValue(...args);
12379
- return result;
12380
- };
12381
- } else if (slotPropValue) {
12382
- overrideProps[propName] = slotPropValue;
12383
- }
12384
- } else if (propName === "style") {
12385
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
12386
- } else if (propName === "className") {
12387
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
12388
- }
12389
- }
12390
- return { ...slotProps, ...overrideProps };
12391
- }
12392
- function getElementRef$2(element) {
12393
- var _a2, _b;
12394
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
12395
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12396
- if (mayWarn) {
12397
- return element.ref;
12398
- }
12399
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
12400
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12401
- if (mayWarn) {
12402
- return element.props.ref;
12403
- }
12404
- return element.props.ref || element.ref;
12405
- }
12406
12030
  var NODES$2 = [
12407
12031
  "a",
12408
12032
  "button",
@@ -12423,7 +12047,7 @@ var NODES$2 = [
12423
12047
  "ul"
12424
12048
  ];
12425
12049
  var Primitive$2 = NODES$2.reduce((primitive, node) => {
12426
- const Slot2 = /* @__PURE__ */ createSlot$2(`Primitive.${node}`);
12050
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
12427
12051
  const Node4 = React.forwardRef((props, forwardedRef) => {
12428
12052
  const { asChild, ...primitiveProps } = props;
12429
12053
  const Comp = asChild ? Slot2 : node;
@@ -12512,89 +12136,6 @@ function composeContextScopes$1(...scopes) {
12512
12136
  createScope.scopeName = baseScope.scopeName;
12513
12137
  return createScope;
12514
12138
  }
12515
- // @__NO_SIDE_EFFECTS__
12516
- function createSlot$1(ownerName) {
12517
- const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
12518
- const Slot2 = React.forwardRef((props, forwardedRef) => {
12519
- const { children, ...slotProps } = props;
12520
- const childrenArray = React.Children.toArray(children);
12521
- const slottable = childrenArray.find(isSlottable$1);
12522
- if (slottable) {
12523
- const newElement = slottable.props.children;
12524
- const newChildren = childrenArray.map((child) => {
12525
- if (child === slottable) {
12526
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
12527
- return React.isValidElement(newElement) ? newElement.props.children : null;
12528
- } else {
12529
- return child;
12530
- }
12531
- });
12532
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
12533
- }
12534
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12535
- });
12536
- Slot2.displayName = `${ownerName}.Slot`;
12537
- return Slot2;
12538
- }
12539
- // @__NO_SIDE_EFFECTS__
12540
- function createSlotClone$1(ownerName) {
12541
- const SlotClone = React.forwardRef((props, forwardedRef) => {
12542
- const { children, ...slotProps } = props;
12543
- if (React.isValidElement(children)) {
12544
- const childrenRef = getElementRef$1(children);
12545
- const props2 = mergeProps$1(slotProps, children.props);
12546
- if (children.type !== React.Fragment) {
12547
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12548
- }
12549
- return React.cloneElement(children, props2);
12550
- }
12551
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
12552
- });
12553
- SlotClone.displayName = `${ownerName}.SlotClone`;
12554
- return SlotClone;
12555
- }
12556
- var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
12557
- function isSlottable$1(child) {
12558
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
12559
- }
12560
- function mergeProps$1(slotProps, childProps) {
12561
- const overrideProps = { ...childProps };
12562
- for (const propName in childProps) {
12563
- const slotPropValue = slotProps[propName];
12564
- const childPropValue = childProps[propName];
12565
- const isHandler = /^on[A-Z]/.test(propName);
12566
- if (isHandler) {
12567
- if (slotPropValue && childPropValue) {
12568
- overrideProps[propName] = (...args) => {
12569
- const result = childPropValue(...args);
12570
- slotPropValue(...args);
12571
- return result;
12572
- };
12573
- } else if (slotPropValue) {
12574
- overrideProps[propName] = slotPropValue;
12575
- }
12576
- } else if (propName === "style") {
12577
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
12578
- } else if (propName === "className") {
12579
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
12580
- }
12581
- }
12582
- return { ...slotProps, ...overrideProps };
12583
- }
12584
- function getElementRef$1(element) {
12585
- var _a2, _b;
12586
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
12587
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12588
- if (mayWarn) {
12589
- return element.ref;
12590
- }
12591
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
12592
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
12593
- if (mayWarn) {
12594
- return element.props.ref;
12595
- }
12596
- return element.props.ref || element.ref;
12597
- }
12598
12139
  var NODES$1 = [
12599
12140
  "a",
12600
12141
  "button",
@@ -12615,7 +12156,7 @@ var NODES$1 = [
12615
12156
  "ul"
12616
12157
  ];
12617
12158
  var Primitive$1 = NODES$1.reduce((primitive, node) => {
12618
- const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
12159
+ const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
12619
12160
  const Node4 = React.forwardRef((props, forwardedRef) => {
12620
12161
  const { asChild, ...primitiveProps } = props;
12621
12162
  const Comp = asChild ? Slot2 : node;
@@ -12957,98 +12498,6 @@ function composeContextScopes(...scopes) {
12957
12498
  createScope.scopeName = baseScope.scopeName;
12958
12499
  return createScope;
12959
12500
  }
12960
- // @__NO_SIDE_EFFECTS__
12961
- function createSlot(ownerName) {
12962
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
12963
- const Slot2 = React.forwardRef((props, forwardedRef) => {
12964
- const { children, ...slotProps } = props;
12965
- const childrenArray = React.Children.toArray(children);
12966
- const slottable = childrenArray.find(isSlottable);
12967
- if (slottable) {
12968
- const newElement = slottable.props.children;
12969
- const newChildren = childrenArray.map((child) => {
12970
- if (child === slottable) {
12971
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
12972
- return React.isValidElement(newElement) ? newElement.props.children : null;
12973
- } else {
12974
- return child;
12975
- }
12976
- });
12977
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
12978
- }
12979
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
12980
- });
12981
- Slot2.displayName = `${ownerName}.Slot`;
12982
- return Slot2;
12983
- }
12984
- // @__NO_SIDE_EFFECTS__
12985
- function createSlotClone(ownerName) {
12986
- const SlotClone = React.forwardRef((props, forwardedRef) => {
12987
- const { children, ...slotProps } = props;
12988
- if (React.isValidElement(children)) {
12989
- const childrenRef = getElementRef(children);
12990
- const props2 = mergeProps(slotProps, children.props);
12991
- if (children.type !== React.Fragment) {
12992
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
12993
- }
12994
- return React.cloneElement(children, props2);
12995
- }
12996
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
12997
- });
12998
- SlotClone.displayName = `${ownerName}.SlotClone`;
12999
- return SlotClone;
13000
- }
13001
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
13002
- // @__NO_SIDE_EFFECTS__
13003
- function createSlottable(ownerName) {
13004
- const Slottable2 = ({ children }) => {
13005
- return /* @__PURE__ */ jsx(Fragment$1, { children });
13006
- };
13007
- Slottable2.displayName = `${ownerName}.Slottable`;
13008
- Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
13009
- return Slottable2;
13010
- }
13011
- function isSlottable(child) {
13012
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
13013
- }
13014
- function mergeProps(slotProps, childProps) {
13015
- const overrideProps = { ...childProps };
13016
- for (const propName in childProps) {
13017
- const slotPropValue = slotProps[propName];
13018
- const childPropValue = childProps[propName];
13019
- const isHandler = /^on[A-Z]/.test(propName);
13020
- if (isHandler) {
13021
- if (slotPropValue && childPropValue) {
13022
- overrideProps[propName] = (...args) => {
13023
- const result = childPropValue(...args);
13024
- slotPropValue(...args);
13025
- return result;
13026
- };
13027
- } else if (slotPropValue) {
13028
- overrideProps[propName] = slotPropValue;
13029
- }
13030
- } else if (propName === "style") {
13031
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
13032
- } else if (propName === "className") {
13033
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
13034
- }
13035
- }
13036
- return { ...slotProps, ...overrideProps };
13037
- }
13038
- function getElementRef(element) {
13039
- var _a2, _b;
13040
- let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
13041
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13042
- if (mayWarn) {
13043
- return element.ref;
13044
- }
13045
- getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
13046
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13047
- if (mayWarn) {
13048
- return element.props.ref;
13049
- }
13050
- return element.props.ref || element.ref;
13051
- }
13052
12501
  var NODES = [
13053
12502
  "a",
13054
12503
  "button",
@@ -46865,7 +46314,12 @@ const ComposerKeybinds = Extension.create({
46865
46314
  if (editor.isActive("bulletList") || editor.isActive("orderedList")) {
46866
46315
  return false;
46867
46316
  }
46868
- this.options.onSubmit();
46317
+ const submit = this.options.onSubmit;
46318
+ if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
46319
+ window.requestAnimationFrame(() => submit());
46320
+ } else {
46321
+ submit();
46322
+ }
46869
46323
  return true;
46870
46324
  },
46871
46325
  "Shift-Enter": ({ editor }) => {