@frontera-sdk/chat-ui 1.50.40

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 (148) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +348 -0
  3. package/dist/af-DK_CjRn6-OPBHDTNZ.js +197 -0
  4. package/dist/agent-picker.d.ts +38 -0
  5. package/dist/agent-picker.js +8 -0
  6. package/dist/as-BPtSu6VN-O4ZZEAJG.js +11 -0
  7. package/dist/be-CrQ0smca-5HIE5K27.js +11 -0
  8. package/dist/bg-CrQqGwni-3IRVPZQ7.js +11 -0
  9. package/dist/bn-NCLZcWHi-XOZJFNIB.js +11 -0
  10. package/dist/ca-SUf6Y2Om-V6F2EBCA.js +38 -0
  11. package/dist/capture-NO5ZIGP6.js +1652 -0
  12. package/dist/chat.css +3555 -0
  13. package/dist/chat.d.ts +161 -0
  14. package/dist/chat.js +60498 -0
  15. package/dist/chunk-2KEBRV3W.js +191 -0
  16. package/dist/chunk-6BPHEBCF.js +639 -0
  17. package/dist/chunk-6HYPVNVA.js +25 -0
  18. package/dist/chunk-7ADM3CKD.js +10 -0
  19. package/dist/chunk-AFVU5VT6.js +5601 -0
  20. package/dist/chunk-BEJ3HQG4.js +93 -0
  21. package/dist/chunk-CCVPZVFK.js +28 -0
  22. package/dist/chunk-DGDHKMDB.js +10 -0
  23. package/dist/chunk-FXKXDR5K.js +2166 -0
  24. package/dist/chunk-GTQH7MPF.js +129 -0
  25. package/dist/chunk-I7SXWUAN.js +1258 -0
  26. package/dist/chunk-IQRPGFLI.js +234 -0
  27. package/dist/chunk-IXDM5R55.js +23 -0
  28. package/dist/chunk-JD6ETTXC.js +178 -0
  29. package/dist/chunk-OP4MLJDA.js +215 -0
  30. package/dist/chunk-PQZ2CS26.js +2315 -0
  31. package/dist/chunk-PR4QN5HX.js +38 -0
  32. package/dist/chunk-PUIVKDV5.js +271 -0
  33. package/dist/chunk-QSSFBZAS.js +6914 -0
  34. package/dist/chunk-RAKKA3WU.js +5896 -0
  35. package/dist/chunk-RB2Y4NYC.js +681 -0
  36. package/dist/chunk-VDZH5Z3K.js +72 -0
  37. package/dist/chunk-WMN6BPPS.js +49 -0
  38. package/dist/chunk-WO6DJLFE.js +10857 -0
  39. package/dist/chunk-X5E2DJVO.js +47634 -0
  40. package/dist/chunk-XJFTVKLW.js +2687 -0
  41. package/dist/chunk-ZS6PXIZP.js +187 -0
  42. package/dist/client.d.ts +89 -0
  43. package/dist/client.js +20 -0
  44. package/dist/composer.d.ts +23 -0
  45. package/dist/composer.js +89 -0
  46. package/dist/cop-C3sk0IUo-CIZA2H43.js +11 -0
  47. package/dist/credential.d.ts +75 -0
  48. package/dist/credential.js +3 -0
  49. package/dist/cs-CmAteokq-HAKEQPB4.js +17 -0
  50. package/dist/cu-CBUlrW6Y-QTZ6ZLA4.js +32 -0
  51. package/dist/cy-BBPa6z2x-MX6DGDNW.js +11 -0
  52. package/dist/da-CCDXfXtG-5YEOHMG3.js +11 -0
  53. package/dist/de-1901-CWoAOigE-63QFSF2A.js +11 -0
  54. package/dist/de-1996-BL6awyxG-R2PHKMAB.js +11 -0
  55. package/dist/de-ch-1901-hVThVHVb-JSDB53OZ.js +11 -0
  56. package/dist/el-monoton-D3aKqTz2-2V4OOFBB.js +11 -0
  57. package/dist/el-polyton-ogVWcTzh-3U7NGQMT.js +11 -0
  58. package/dist/en-gb-B7Al27b_-UKCBQFSU.js +21 -0
  59. package/dist/es-DcaaHPU_-NOBXSOZK.js +11 -0
  60. package/dist/esm-MHF25KDL.js +3 -0
  61. package/dist/et-B_spaleu-5UAYIW62.js +11 -0
  62. package/dist/eu-Ctv_kq9Z-V5DREOPN.js +11 -0
  63. package/dist/fi-RW5VB8Yp-YSXBK7LW.js +11 -0
  64. package/dist/fr-BC2onEz9-7KH5T76G.js +11 -0
  65. package/dist/frame.d.ts +59 -0
  66. package/dist/frame.js +111 -0
  67. package/dist/fur-AC12wySk-4PD2Y72H.js +11 -0
  68. package/dist/ga-Cn6LkudM-RRAAJT3N.js +58 -0
  69. package/dist/gl-DZGc-K_G-KYSXXTCY.js +11 -0
  70. package/dist/grc-DOlGgO8T-2HXBZVJ5.js +11 -0
  71. package/dist/gu-Bjl0l-cf-4CFSVZHZ.js +11 -0
  72. package/dist/header.d.ts +78 -0
  73. package/dist/header.js +18 -0
  74. package/dist/hi-DsAaTPCC-KMCFBWK7.js +11 -0
  75. package/dist/hr-DT1SBBes-X2TIX6EI.js +11 -0
  76. package/dist/hsb-DC_ITc1e-PXLERA7R.js +46 -0
  77. package/dist/hu-DVk7Y_ka-PJPVU54B.js +11 -0
  78. package/dist/hy-e995ysyO-MZBRFX52.js +11 -0
  79. package/dist/ia-Cr4TJH0c-D3O2FHGP.js +22 -0
  80. package/dist/id-DifDyWg9-MZ2BGHWI.js +58 -0
  81. package/dist/is-BT8UVRze-CZZCKEFI.js +11 -0
  82. package/dist/it-Bt_Meacx-T4Y5JYV6.js +11 -0
  83. package/dist/ka-jyoLzyDE-ES6EXZLW.js +11 -0
  84. package/dist/kmr-Cfwhwuff-TSW2R2KS.js +11 -0
  85. package/dist/kn-C6Lov-DP-B4BL47CE.js +11 -0
  86. package/dist/la-DuvHjUWw-6K7TFU6X.js +11 -0
  87. package/dist/la-x-classic-yTyAOQEt-YWTKMM2L.js +11 -0
  88. package/dist/la-x-liturgic-CXeQb4FY-B772L5E7.js +11 -0
  89. package/dist/lib-3ZKX25RJ.js +4511 -0
  90. package/dist/lt-BBe8DlDF-4YINVOZR.js +11 -0
  91. package/dist/lv-Q2BBHnzp-TMVQ3MX2.js +11 -0
  92. package/dist/message.d.ts +64 -0
  93. package/dist/message.js +18 -0
  94. package/dist/ml-2xLVYkVY-NGZLAPIN.js +11 -0
  95. package/dist/mn-cyrl-lHM4n0oC-DGBYYUT3.js +11 -0
  96. package/dist/mn-cyrl-x-lmc-3aetruI8-QHJABMOO.js +11 -0
  97. package/dist/mr-CjWJPVmH-X5UHV65O.js +11 -0
  98. package/dist/mul-ethi-D_CMSMEq-H7UMQSOQ.js +11 -0
  99. package/dist/nb-DI8u59ch-J4CAVI4Y.js +122 -0
  100. package/dist/new-session-Dw7JOgzu.d.ts +141 -0
  101. package/dist/new-session.d.ts +4 -0
  102. package/dist/new-session.js +10 -0
  103. package/dist/nl-BHQJ6Gvn-7BH55RA7.js +52 -0
  104. package/dist/nn-ntZvarUK-KKNCHHJ4.js +122 -0
  105. package/dist/no-B8ItS0F3-3ZXIRJ6U.js +120 -0
  106. package/dist/oauth-callback.d.ts +35 -0
  107. package/dist/oauth-callback.js +18 -0
  108. package/dist/oc-P_i3-xLA-XZM6E5YZ.js +11 -0
  109. package/dist/or-50rxpoq4-5VELAFMJ.js +11 -0
  110. package/dist/pa-C54UG8eN-WEJPMZ6Z.js +11 -0
  111. package/dist/parts.d.ts +49 -0
  112. package/dist/parts.js +106 -0
  113. package/dist/pdf-cover-thumbnail-inner-4N2Q5AAG.js +36 -0
  114. package/dist/pdf-deck-view-inner-FZVLAEQR.js +575 -0
  115. package/dist/pdf-document-view-inner-6DF54JWK.js +585 -0
  116. package/dist/pdf-viewer-inner-GPES3KG2.js +256 -0
  117. package/dist/pending-cards.d.ts +26 -0
  118. package/dist/pending-cards.js +9 -0
  119. package/dist/pi-B9cgjyG1-GD5ASDDU.js +11 -0
  120. package/dist/pl-9fg-ESVt-UMX7MCJM.js +32 -0
  121. package/dist/platform.css +4013 -0
  122. package/dist/pms-BRGfm5gS-SSE3AUW5.js +11 -0
  123. package/dist/pt-Cum2_NUC-W35JYVR4.js +11 -0
  124. package/dist/rm-C0MIK9N4-IWL4YTNT.js +11 -0
  125. package/dist/ro-0fmdH0HA-46WUTOYH.js +11 -0
  126. package/dist/ru-v4l-ayaq-BUGK6XCN.js +196 -0
  127. package/dist/sa-CKY9c_Vq-4KIJOI5Y.js +11 -0
  128. package/dist/sh-cyrl-BpCRFOmq-DSLQ4UY2.js +128 -0
  129. package/dist/sh-latn-sRy4Tuaj-UNQOR63V.js +128 -0
  130. package/dist/sk-_iOeDNrQ-NCTQKH25.js +17 -0
  131. package/dist/sl-DpiklF-D-6GG5TDVN.js +11 -0
  132. package/dist/sr-cyrl-Dpzrbd0W-4Q5226YJ.js +142 -0
  133. package/dist/sv-CFm5y56M-VTWNPZ7I.js +11 -0
  134. package/dist/ta-BcghgTbD-NRT35DW6.js +11 -0
  135. package/dist/te-B5Spl2Jk-5VE6CLN4.js +11 -0
  136. package/dist/th-DWX5iPSo-N5GMOQOP.js +11 -0
  137. package/dist/theme.d.ts +49 -0
  138. package/dist/theme.js +3 -0
  139. package/dist/tk-BMbKB10q-HGWWY5L3.js +11 -0
  140. package/dist/tr-CIHIuzqc-6ISBNYLV.js +11 -0
  141. package/dist/types-BDqLaBfH.d.ts +60 -0
  142. package/dist/uk-Dir3oxLs-YQ3QZRI4.js +11 -0
  143. package/dist/univer-workbook-BSSUE5TG.css +3555 -0
  144. package/dist/univer-workbook-N5IIN7CH.js +290849 -0
  145. package/dist/vega-chart-block-NQADYNWQ.js +2857 -0
  146. package/dist/zh-latn-pinyin-BdYb-Ey_-RB542AHF.js +11 -0
  147. package/package.json +137 -0
  148. package/src/styles.css +996 -0
@@ -0,0 +1,35 @@
1
+ import * as react from 'react';
2
+
3
+ /**
4
+ * The whole OAuth callback page, as a component.
5
+ *
6
+ * Mount it at the route you registered as your redirect URI and there is
7
+ * nothing else to write — it forwards the code to the chat (posting to the
8
+ * opener in a popup, navigating back in a redirected tab) and shows a line of
9
+ * text while it does.
10
+ *
11
+ * ```tsx
12
+ * // app/frontera/oauth/callback/page.tsx
13
+ * 'use client'
14
+ * import { FronteraOAuthCallback } from '@frontera-sdk/chat-ui/oauth-callback'
15
+ * export default function Page() { return <FronteraOAuthCallback /> }
16
+ * ```
17
+ *
18
+ * Not using React on that route? `renderConnectCallbackPage()` from
19
+ * `@frontera-sdk/chat/callback-page` returns the same page as HTML for any
20
+ * server.
21
+ */
22
+ interface FronteraOAuthCallbackProps {
23
+ /**
24
+ * Origin allowed to receive the code in popup mode. Defaults to this page's
25
+ * own origin — right when the chat and the callback are the same app. Never
26
+ * pass `'*'`: the message carries an authorization code.
27
+ */
28
+ targetOrigin?: string;
29
+ /** Replace the holding text with your own. */
30
+ children?: React.ReactNode;
31
+ className?: string;
32
+ }
33
+ declare function FronteraOAuthCallback({ targetOrigin, children, className, }: FronteraOAuthCallbackProps): react.JSX.Element;
34
+
35
+ export { FronteraOAuthCallback, type FronteraOAuthCallbackProps };
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import './chunk-PR4QN5HX.js';
3
+ import { useEffect } from 'react';
4
+ import { postConnectResultToOpener } from '@frontera-sdk/chat/connect-popup';
5
+ import { jsx } from 'react/jsx-runtime';
6
+
7
+ function FronteraOAuthCallback({
8
+ targetOrigin,
9
+ children,
10
+ className
11
+ }) {
12
+ useEffect(() => {
13
+ postConnectResultToOpener(window.location.search, targetOrigin);
14
+ }, [targetOrigin]);
15
+ return /* @__PURE__ */ jsx("div", { className: className ?? "fr-callback", role: "status", "aria-live": "polite", children: children ?? /* @__PURE__ */ jsx("p", { children: "Finishing up\u2026" }) });
16
+ }
17
+
18
+ export { FronteraOAuthCallback };
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import './chunk-PR4QN5HX.js';
3
+
4
+ // ../../node_modules/@univerjs/engine-render/lib/es/oc-P_i3-xLA.js
5
+ var Oc = [
6
+ "00001,000032,0000021,021,000001,0023,32,1,01,001,2,02,022,032,023,102,23,22,223,4",
7
+ `{".":[{"a":[{"n":[{"t":[{"i":[{"m":[{"n":1}]},0]}]}]}],"c":[{"i":[{"r":[{"c":[{"u":[{"m":2}]}]}]}]}],"e":[{"x":3}],"p":[{"a":[{"r":[{"a":[{"i":0,"u":0}]}]}],"r":[{"o":[{"t":[{"o":[{"a":4,"e":4,"i":4,"u":4}]}]}]}]}],"s":[{"u":[{"b":[{"l":[{"u":5}],"r":5}]}]},11]}],"p":[{"s":[{"i":[{"c":6}]},10],"n":[{"e":[{"u":6}]},10],"h":[{"p":10,"t":10},11],"l":11,"p":10,"r":11,"t":10,"z":10,".":10,"'":10},7],"\xEF":7,"\xFC":7,"a":[{"i":[{"a":8,"e":8,"o":8,"u":8}],"o":[{"r":[{".":8}],"i":[{"r":[{"a":[{".":8}]}]}]}]}],"i":[{"o":[{"r":[{".":8}],"i":[{"r":[{"a":[{".":8}]}]},9]}],"i":[{".":7}]}],"e":[{"i":[{"u":8}]}],"o":[{"i":[{"a":8,"e":8,"o":8,"u":8}]}],"b":[{"b":10,"d":10,"l":11,"m":10,"n":10,"r":11,"t":10,"s":10,".":10,"'":10},7],"c":[{"c":10,"h":[{".":10,"'":[{".":10,"'":[{".":10}]}]},12],"l":11,"m":10,"n":10,"q":10,"r":11,"s":10,"t":10,"z":10,".":10,"'":10},7],"\xE7":[{".":10},7],"d":[{"d":10,"g":10,"m":10,"r":11,"s":10,"v":10,".":10,"'":10},7],"f":[{"f":10,"l":11,"n":10,"r":11,"t":10,".":10,"'":10},7],"g":[{"g":10,"d":10,"f":10,"l":11,"m":10,"n":10,"r":11,"s":10,"\xFC":12,"v":10,".":10,"'":10},7],"h":[{"p":10,"t":10,".":10,"'":10},7],"j":[{"'":10},7],"k":[{"k":10,"h":12,"'":10},7],"l":[{"b":10,"c":10,"d":10,"f":[{"t":13},10],"g":10,"h":[{".":10},11],"k":10,"l":10,"m":10,"n":10,"p":10,"q":10,"r":10,"s":10,"t":10,"v":10,".":10,"'":[{".":10,"'":10}]},7],"m":[{"m":10,"b":10,"p":10,"l":10,"n":10,"q":10,"r":10,"v":10,".":10,"'":10},7],"n":[{"b":10,"c":10,"\xE7":10,"d":10,"f":10,"h":[{".":10},11],"g":10,"j":10,"l":10,"m":10,"n":10,"p":10,"q":10,"r":10,"s":[{"m":14,"f":14,".":10},10],"t":10,"v":10,"x":10,".":10,"'":10},7],"q":[{"u":15,"\xFC":12,"'":10},7],"r":[{"b":10,"c":10,"\xE7":10,"d":10,"f":10,"g":10,"h":11,"l":10,"m":10,"n":10,"p":10,"q":10,"r":10,"s":10,"t":[{".":10},10],"\xFC":11,"v":10,"z":10,".":10,"'":10},7],"s":[{"p":[{"h":16},10],"s":10,"t":[{"b":17,"c":17,"d":17,"f":17,"g":17,"l":18,"m":17,"n":17,"p":17,"q":17,"s":17,"t":17,"v":17,".":10},10],".":10,"c":[{".":10},10],"b":10,"d":10,"f":10,"g":10,"h":[{".":10,"'":10},11],"j":10,"k":10,"l":10,"m":10,"n":10,"r":10,"v":10,"z":10,"'":[{".":19,"'":19}]},7],"t":[{"b":10,"c":10,"d":10,"f":10,"g":[{".":10},11],"h":11,"j":11,"l":11,"r":11,"m":10,"n":10,"p":10,"q":10,"t":10,"v":10,"z":[{".":10},11],".":10,"'":[{".":10,"'":10}]},7],"v":[{"l":11,"r":11,"v":10,"'":[{".":10,"'":10}]},7],"x":[{"t":10,"x":10,".":10,"'":10},7],"z":[{".":10,"'":[{".":10,"'":10}]},7],"'":17,"w":[{"'":10}]}`,
8
+ []
9
+ ];
10
+
11
+ export { Oc };
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import './chunk-PR4QN5HX.js';
3
+
4
+ // ../../node_modules/@univerjs/engine-render/lib/es/or-50rxpoq4.js
5
+ var Or = [
6
+ "22,11,01,1,21",
7
+ '{"\u200D":0,"\u200C":1,"\u0B05":2,"\u0B06":2,"\u0B07":2,"\u0B08":2,"\u0B09":2,"\u0B0A":2,"\u0B0B":2,"\u0B60":2,"\u0B0C":2,"\u0B61":2,"\u0B0F":2,"\u0B10":2,"\u0B13":2,"\u0B14":2,"\u0B3E":2,"\u0B3F":2,"\u0B40":2,"\u0B41":2,"\u0B42":2,"\u0B43":2,"\u0B47":2,"\u0B48":2,"\u0B4B":2,"\u0B4C":2,"\u0B15":3,"\u0B16":3,"\u0B17":3,"\u0B18":3,"\u0B19":3,"\u0B1A":3,"\u0B1B":3,"\u0B1C":3,"\u0B1D":3,"\u0B1E":3,"\u0B1F":3,"\u0B20":3,"\u0B21":3,"\u0B22":3,"\u0B23":3,"\u0B24":3,"\u0B25":3,"\u0B26":3,"\u0B27":3,"\u0B28":3,"\u0B2A":3,"\u0B2B":3,"\u0B2C":3,"\u0B2D":3,"\u0B2E":3,"\u0B2F":3,"\u0B30":3,"\u0B32":3,"\u0B33":3,"\u0B35":3,"\u0B36":3,"\u0B37":3,"\u0B38":3,"\u0B39":3,"\u0B02":4,"\u0B03":4,"\u0B57":4,"\u0B01":4,"\u0B4D":0}',
8
+ []
9
+ ];
10
+
11
+ export { Or };
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import './chunk-PR4QN5HX.js';
3
+
4
+ // ../../node_modules/@univerjs/engine-render/lib/es/pa-C54UG8eN.js
5
+ var Pa = [
6
+ "22,11,01,1,21",
7
+ '{"\u200D":0,"\u200C":1,"\u0A05":2,"\u0A06":2,"\u0A07":2,"\u0A08":2,"\u0A09":2,"\u0A0A":2,"\u0A0F":2,"\u0A10":2,"\u0A13":2,"\u0A14":2,"\u0A3E":2,"\u0A3F":2,"\u0A40":2,"\u0A41":2,"\u0A42":2,"\u0A47":2,"\u0A48":2,"\u0A4B":2,"\u0A4C":2,"\u0A15":3,"\u0A16":3,"\u0A17":3,"\u0A18":3,"\u0A19":3,"\u0A1A":3,"\u0A1B":3,"\u0A1C":3,"\u0A1D":3,"\u0A1E":3,"\u0A1F":3,"\u0A20":3,"\u0A21":3,"\u0A22":3,"\u0A23":3,"\u0A24":3,"\u0A25":3,"\u0A26":3,"\u0A27":3,"\u0A28":3,"\u0A2A":3,"\u0A2B":3,"\u0A2C":3,"\u0A2D":3,"\u0A2E":3,"\u0A2F":3,"\u0A30":3,"\u0A32":3,"\u0A33":3,"\u0A35":3,"\u0A36":3,"\u0A38":3,"\u0A39":3,"\u0A01":4,"\u0A02":4,"\u0A03":4,"\u0A4D":0,"\u0A70":0,"\u0A71":0}',
8
+ []
9
+ ];
10
+
11
+ export { Pa };
@@ -0,0 +1,49 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, ComponentType } from 'react';
3
+ import { UIMessage } from 'ai';
4
+
5
+ /**
6
+ * Rendering for the pieces a message is actually made of.
7
+ *
8
+ * A message is not a string. It carries an array of parts — text, the agent's
9
+ * reasoning, tool calls that move through states, artifacts it produced, files
10
+ * — and a surface that reads only `text` silently drops most of the work the
11
+ * agent did. Each part type here exists because dropping it left a visible
12
+ * hole in the conversation.
13
+ */
14
+ type MessagePart = UIMessage['parts'][number];
15
+ interface PartRenderers {
16
+ /** Replace or wrap any part type. Return `undefined` to fall through. */
17
+ renderPart?: (part: MessagePart) => ReactNode | undefined;
18
+ /** Called when an artifact chip is activated, if you surface artifacts. */
19
+ onOpenArtifact?: (artifact: {
20
+ id?: string;
21
+ title?: string;
22
+ }) => void;
23
+ }
24
+ /**
25
+ * The markdown renderer, supplied by the consumer.
26
+ *
27
+ * Injected rather than imported so this package never pulls a markdown
28
+ * pipeline into a bundle that does not need one, and so an application already
29
+ * rendering markdown its own way keeps one implementation instead of two. Pass
30
+ * `Streamdown` — what the platform itself uses — for identical output:
31
+ *
32
+ * ```tsx
33
+ * import { Streamdown } from 'streamdown'
34
+ * <FronteraChat markdown={Streamdown} … />
35
+ * ```
36
+ *
37
+ * Unset, text renders verbatim with whitespace preserved: correct, just
38
+ * unformatted.
39
+ */
40
+ type MarkdownRenderer = ComponentType<{
41
+ children: string;
42
+ }>;
43
+ declare const MarkdownContext: react.Context<MarkdownRenderer | null>;
44
+ declare function Part({ part, renderers }: {
45
+ part: MessagePart;
46
+ renderers?: PartRenderers;
47
+ }): react.JSX.Element | null;
48
+
49
+ export { MarkdownContext, type MarkdownRenderer, type MessagePart, Part, type PartRenderers };
package/dist/parts.js ADDED
@@ -0,0 +1,106 @@
1
+ 'use client';
2
+ import { ToolCallItem } from './chunk-OP4MLJDA.js';
3
+ import './chunk-XJFTVKLW.js';
4
+ import './chunk-GTQH7MPF.js';
5
+ import './chunk-IQRPGFLI.js';
6
+ import './chunk-DGDHKMDB.js';
7
+ import './chunk-AFVU5VT6.js';
8
+ import './chunk-PR4QN5HX.js';
9
+ import { createContext, useContext } from 'react';
10
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
11
+
12
+ var MarkdownContext = createContext(null);
13
+ function Markdown({ text }) {
14
+ const Renderer = useContext(MarkdownContext);
15
+ if (!Renderer) return /* @__PURE__ */ jsx("p", { className: "fr-text", children: text });
16
+ return /* @__PURE__ */ jsx("div", { className: "fr-markdown", children: /* @__PURE__ */ jsx(Renderer, { children: text }) });
17
+ }
18
+ function Part({ part, renderers }) {
19
+ const custom = renderers?.renderPart?.(part);
20
+ if (custom !== void 0) return /* @__PURE__ */ jsx(Fragment, { children: custom });
21
+ const type = part.type;
22
+ if (type === "text") {
23
+ const text = part.text ?? "";
24
+ return text ? /* @__PURE__ */ jsx(Markdown, { text }) : null;
25
+ }
26
+ if (type === "reasoning") {
27
+ const text = part.text;
28
+ if (!text) return null;
29
+ return /* @__PURE__ */ jsxs("details", { className: "fr-reasoning", children: [
30
+ /* @__PURE__ */ jsx("summary", { children: "Thinking" }),
31
+ /* @__PURE__ */ jsx("div", { className: "fr-reasoning-body", children: text })
32
+ ] });
33
+ }
34
+ if (type.startsWith("tool-") || type === "dynamic-tool") {
35
+ return /* @__PURE__ */ jsx(ToolPart, { part });
36
+ }
37
+ if (type === "file") {
38
+ const file = part;
39
+ if (file.mediaType?.startsWith("image/") && file.url) {
40
+ return /* @__PURE__ */ jsx("img", { className: "fr-image", src: file.url, alt: file.filename ?? "" });
41
+ }
42
+ return /* @__PURE__ */ jsxs("a", { className: "fr-file", href: file.url, target: "_blank", rel: "noreferrer", children: [
43
+ /* @__PURE__ */ jsx(FileIcon, {}),
44
+ file.filename ?? "attachment"
45
+ ] });
46
+ }
47
+ if (type === "artifact" || type === "data-artifact") {
48
+ const artifact = part;
49
+ const title = artifact.title ?? artifact.data?.title ?? "Untitled";
50
+ const id = artifact.artifactId ?? artifact.data?.artifactId;
51
+ return /* @__PURE__ */ jsxs(
52
+ "button",
53
+ {
54
+ type: "button",
55
+ className: "fr-artifact",
56
+ onClick: () => renderers?.onOpenArtifact?.({ id, title }),
57
+ disabled: !renderers?.onOpenArtifact,
58
+ children: [
59
+ /* @__PURE__ */ jsx(DocumentIcon, {}),
60
+ /* @__PURE__ */ jsx("span", { children: title })
61
+ ]
62
+ }
63
+ );
64
+ }
65
+ return null;
66
+ }
67
+ var DELEGATION_TOOLS = {
68
+ delegate: "Sub-agent",
69
+ consult_agent: "Asked another agent"
70
+ };
71
+ function delegationTask(input) {
72
+ if (!input || typeof input !== "object") return null;
73
+ const fields = input;
74
+ if (typeof fields.title === "string" && fields.title.trim()) return fields.title.trim();
75
+ const task = typeof fields.task === "string" ? fields.task : null;
76
+ const firstLine = task?.split("\n").find((line) => line.trim());
77
+ return firstLine?.trim() ?? null;
78
+ }
79
+ function ToolPart({ part }) {
80
+ const tool = part;
81
+ const rawName = tool.type === "dynamic-tool" ? tool.toolName ?? "tool" : tool.type.slice(5);
82
+ const delegationLabel = DELEGATION_TOOLS[rawName];
83
+ const task = delegationLabel ? delegationTask(tool.input) : null;
84
+ return /* @__PURE__ */ jsx(
85
+ ToolCallItem,
86
+ {
87
+ toolName: delegationLabel && task ? `${delegationLabel}: ${task}` : rawName,
88
+ state: tool.state ?? "output-available",
89
+ input: tool.input,
90
+ output: tool.output,
91
+ errorText: tool.errorText,
92
+ isMcp: tool.type === "dynamic-tool"
93
+ }
94
+ );
95
+ }
96
+ function DocumentIcon() {
97
+ return /* @__PURE__ */ jsxs("svg", { className: "fr-icon", viewBox: "0 0 16 16", "aria-hidden": true, children: [
98
+ /* @__PURE__ */ jsx("path", { d: "M9 1.5H4.5A1.5 1.5 0 0 0 3 3v10A1.5 1.5 0 0 0 4.5 14.5h7A1.5 1.5 0 0 0 13 13V5.5L9 1.5Z", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinejoin: "round" }),
99
+ /* @__PURE__ */ jsx("path", { d: "M9 1.5V5.5H13", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinejoin: "round" })
100
+ ] });
101
+ }
102
+ function FileIcon() {
103
+ return /* @__PURE__ */ jsx(DocumentIcon, {});
104
+ }
105
+
106
+ export { MarkdownContext, Part };
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+ import './chunk-PR4QN5HX.js';
3
+ import { pdfjs, Document, Page } from 'react-pdf';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
7
+ function PdfCoverThumbnailInner({
8
+ fileUrl,
9
+ width,
10
+ loading,
11
+ onError
12
+ }) {
13
+ return /* @__PURE__ */ jsx(
14
+ Document,
15
+ {
16
+ file: fileUrl,
17
+ loading,
18
+ error: loading,
19
+ onLoadError: onError,
20
+ children: /* @__PURE__ */ jsx(
21
+ Page,
22
+ {
23
+ pageNumber: 1,
24
+ width,
25
+ renderTextLayer: false,
26
+ renderAnnotationLayer: false,
27
+ loading,
28
+ onLoadError: onError,
29
+ className: "[&>canvas]:!h-full [&>canvas]:!w-full [&>canvas]:!object-cover [&>canvas]:!object-top"
30
+ }
31
+ )
32
+ }
33
+ );
34
+ }
35
+
36
+ export { PdfCoverThumbnailInner as default };