@arbidocs/blocks 0.4.128 → 0.4.130

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 (236) hide show
  1. package/README.md +25 -10
  2. package/dist/{StreamedArtifactEditor-EEYAXJ4H.cjs → StreamedArtifactEditor-TQAND4H5.cjs} +6 -5
  3. package/dist/StreamedArtifactEditor-TQAND4H5.cjs.map +1 -0
  4. package/dist/{StreamedArtifactEditor-TDATDYD2.js → StreamedArtifactEditor-XQNANTWM.js} +4 -3
  5. package/dist/StreamedArtifactEditor-XQNANTWM.js.map +1 -0
  6. package/dist/agents/index.cjs +304 -304
  7. package/dist/agents/index.js +12 -12
  8. package/dist/artifacts/ArtifactCodeView.d.ts +6 -0
  9. package/dist/artifacts/ArtifactPreview.d.ts +22 -0
  10. package/dist/artifacts/index.cjs +50 -21
  11. package/dist/artifacts/index.d.ts +3 -0
  12. package/dist/artifacts/index.js +2 -1
  13. package/dist/artifacts/sandbox-policy.d.ts +34 -0
  14. package/dist/artifacts/sandboxDocument.d.ts +7 -0
  15. package/dist/calendar/CalendarPrint.d.ts +25 -0
  16. package/dist/calendar/booking-slots.d.ts +21 -0
  17. package/dist/calendar/index.cjs +440 -243
  18. package/dist/calendar/index.cjs.map +1 -1
  19. package/dist/calendar/index.d.ts +4 -0
  20. package/dist/calendar/index.js +282 -151
  21. package/dist/calendar/index.js.map +1 -1
  22. package/dist/calendar/print-layout.d.ts +16 -0
  23. package/dist/calendar/printCalendar.d.ts +6 -0
  24. package/dist/calls/composite-canvas.d.ts +52 -0
  25. package/dist/calls/index.cjs +376 -3
  26. package/dist/calls/index.cjs.map +1 -1
  27. package/dist/calls/index.d.ts +3 -0
  28. package/dist/calls/index.js +360 -5
  29. package/dist/calls/index.js.map +1 -1
  30. package/dist/calls/ringtone.d.ts +16 -0
  31. package/dist/calls/voice-levels.d.ts +32 -0
  32. package/dist/chat/ThreadVisualizer.d.ts +28 -0
  33. package/dist/chat/index.cjs +156 -140
  34. package/dist/chat/index.d.ts +2 -0
  35. package/dist/chat/index.js +5 -5
  36. package/dist/chat/open-document.d.ts +5 -1
  37. package/dist/chat/thread-diagram.d.ts +26 -0
  38. package/dist/{chunk-7HAM7Y5U.js → chunk-2DFDFOM7.js} +3 -3
  39. package/dist/{chunk-7HAM7Y5U.js.map → chunk-2DFDFOM7.js.map} +1 -1
  40. package/dist/{chunk-54ANPPMV.js → chunk-2PNNCEPH.js} +4 -4
  41. package/dist/{chunk-54ANPPMV.js.map → chunk-2PNNCEPH.js.map} +1 -1
  42. package/dist/{chunk-DQCYCEDR.js → chunk-2Q7FDZAY.js} +3 -3
  43. package/dist/{chunk-DQCYCEDR.js.map → chunk-2Q7FDZAY.js.map} +1 -1
  44. package/dist/{chunk-INW76PEL.cjs → chunk-2YV7FBLO.cjs} +175 -2
  45. package/dist/chunk-2YV7FBLO.cjs.map +1 -0
  46. package/dist/{chunk-S7PSMMRG.js → chunk-444XKG46.js} +3 -3
  47. package/dist/{chunk-S7PSMMRG.js.map → chunk-444XKG46.js.map} +1 -1
  48. package/dist/{chunk-FSBY2S4V.cjs → chunk-4QIIDXLF.cjs} +10 -10
  49. package/dist/{chunk-FSBY2S4V.cjs.map → chunk-4QIIDXLF.cjs.map} +1 -1
  50. package/dist/{chunk-OYMWV45N.js → chunk-4RLCRFZS.js} +63 -13
  51. package/dist/chunk-4RLCRFZS.js.map +1 -0
  52. package/dist/{chunk-NZUQFF35.cjs → chunk-4S5IDT5F.cjs} +234 -5
  53. package/dist/chunk-4S5IDT5F.cjs.map +1 -0
  54. package/dist/{chunk-CJBN5HIS.js → chunk-4UMXQPNA.js} +20 -8
  55. package/dist/chunk-4UMXQPNA.js.map +1 -0
  56. package/dist/{chunk-KELGOCJA.js → chunk-65S53MZK.js} +174 -5
  57. package/dist/chunk-65S53MZK.js.map +1 -0
  58. package/dist/{chunk-IBZJYCYM.js → chunk-66TA5IBN.js} +17 -25
  59. package/dist/chunk-66TA5IBN.js.map +1 -0
  60. package/dist/{chunk-HM23LXUP.cjs → chunk-6AALMYPS.cjs} +3 -3
  61. package/dist/{chunk-HM23LXUP.cjs.map → chunk-6AALMYPS.cjs.map} +1 -1
  62. package/dist/{chunk-OR4CO743.cjs → chunk-AAFX64WD.cjs} +3 -3
  63. package/dist/{chunk-OR4CO743.cjs.map → chunk-AAFX64WD.cjs.map} +1 -1
  64. package/dist/{chunk-MUMH3Z6K.cjs → chunk-ARDHLU73.cjs} +61 -11
  65. package/dist/chunk-ARDHLU73.cjs.map +1 -0
  66. package/dist/chunk-BIXHB4LV.cjs +178 -0
  67. package/dist/chunk-BIXHB4LV.cjs.map +1 -0
  68. package/dist/chunk-C4WSHRR6.cjs +166 -0
  69. package/dist/chunk-C4WSHRR6.cjs.map +1 -0
  70. package/dist/{chunk-ZAVEMQ37.cjs → chunk-DWZXSPMB.cjs} +3 -3
  71. package/dist/{chunk-ZAVEMQ37.cjs.map → chunk-DWZXSPMB.cjs.map} +1 -1
  72. package/dist/{chunk-VW2C2AZL.js → chunk-ENDP7JER.js} +3 -3
  73. package/dist/{chunk-VW2C2AZL.js.map → chunk-ENDP7JER.js.map} +1 -1
  74. package/dist/{chunk-5HFPRI3W.js → chunk-FUTMU4FR.js} +3 -3
  75. package/dist/{chunk-5HFPRI3W.js.map → chunk-FUTMU4FR.js.map} +1 -1
  76. package/dist/{chunk-P5ST47VY.js → chunk-GDBDHOI4.js} +3 -3
  77. package/dist/{chunk-P5ST47VY.js.map → chunk-GDBDHOI4.js.map} +1 -1
  78. package/dist/chunk-GTCC2VAR.js +153 -0
  79. package/dist/chunk-GTCC2VAR.js.map +1 -0
  80. package/dist/{chunk-3BJLNKOB.cjs → chunk-GZPTWHP5.cjs} +22 -10
  81. package/dist/chunk-GZPTWHP5.cjs.map +1 -0
  82. package/dist/{chunk-OUW6G4O2.cjs → chunk-HFGXA5CL.cjs} +4 -4
  83. package/dist/{chunk-OUW6G4O2.cjs.map → chunk-HFGXA5CL.cjs.map} +1 -1
  84. package/dist/{chunk-SWQX6CTT.cjs → chunk-JKB7WT7L.cjs} +2 -2
  85. package/dist/chunk-JKB7WT7L.cjs.map +1 -0
  86. package/dist/{chunk-D4YR56FV.cjs → chunk-KYDRUFWT.cjs} +5 -5
  87. package/dist/{chunk-D4YR56FV.cjs.map → chunk-KYDRUFWT.cjs.map} +1 -1
  88. package/dist/chunk-NS4JD2VR.js +22 -0
  89. package/dist/chunk-NS4JD2VR.js.map +1 -0
  90. package/dist/{chunk-S6BOINC4.cjs → chunk-OGBXV326.cjs} +7 -7
  91. package/dist/{chunk-S6BOINC4.cjs.map → chunk-OGBXV326.cjs.map} +1 -1
  92. package/dist/{chunk-DJM7DLCT.cjs → chunk-OPTBQSCV.cjs} +3 -3
  93. package/dist/{chunk-DJM7DLCT.cjs.map → chunk-OPTBQSCV.cjs.map} +1 -1
  94. package/dist/{chunk-GFYGYME3.js → chunk-OQ7RUNOC.js} +3 -3
  95. package/dist/{chunk-GFYGYME3.js.map → chunk-OQ7RUNOC.js.map} +1 -1
  96. package/dist/{chunk-WV4IDVDQ.cjs → chunk-PJJY6CYL.cjs} +11 -11
  97. package/dist/{chunk-WV4IDVDQ.cjs.map → chunk-PJJY6CYL.cjs.map} +1 -1
  98. package/dist/{chunk-CXLVI3SB.js → chunk-PUCY3UXN.js} +3 -3
  99. package/dist/{chunk-CXLVI3SB.js.map → chunk-PUCY3UXN.js.map} +1 -1
  100. package/dist/{chunk-ZV3BKLFY.cjs → chunk-QDEODGXE.cjs} +5 -5
  101. package/dist/{chunk-ZV3BKLFY.cjs.map → chunk-QDEODGXE.cjs.map} +1 -1
  102. package/dist/{chunk-7BJRLP3U.js → chunk-QYTYW74G.js} +5 -5
  103. package/dist/{chunk-7BJRLP3U.js.map → chunk-QYTYW74G.js.map} +1 -1
  104. package/dist/{chunk-A7NCSZAP.cjs → chunk-QZTNTP75.cjs} +17 -25
  105. package/dist/chunk-QZTNTP75.cjs.map +1 -0
  106. package/dist/{chunk-OB5F4577.cjs → chunk-R26BK7YL.cjs} +4 -4
  107. package/dist/{chunk-OB5F4577.cjs.map → chunk-R26BK7YL.cjs.map} +1 -1
  108. package/dist/{chunk-A2YAC22G.js → chunk-RI6DZA5X.js} +3 -3
  109. package/dist/{chunk-A2YAC22G.js.map → chunk-RI6DZA5X.js.map} +1 -1
  110. package/dist/{chunk-LC2KJSUS.cjs → chunk-SARREDFP.cjs} +46 -46
  111. package/dist/{chunk-LC2KJSUS.cjs.map → chunk-SARREDFP.cjs.map} +1 -1
  112. package/dist/{chunk-ZCHSJUCI.js → chunk-SZX44LCT.js} +231 -6
  113. package/dist/chunk-SZX44LCT.js.map +1 -0
  114. package/dist/{chunk-7QDX2CO4.cjs → chunk-TP6PLDNM.cjs} +4 -4
  115. package/dist/{chunk-7QDX2CO4.cjs.map → chunk-TP6PLDNM.cjs.map} +1 -1
  116. package/dist/{chunk-W27VK32R.cjs → chunk-TT6XV6WM.cjs} +84 -84
  117. package/dist/{chunk-W27VK32R.cjs.map → chunk-TT6XV6WM.cjs.map} +1 -1
  118. package/dist/{chunk-KLOSOT26.js → chunk-UMIY4SQS.js} +11 -11
  119. package/dist/{chunk-KLOSOT26.js.map → chunk-UMIY4SQS.js.map} +1 -1
  120. package/dist/chunk-VG24E4JJ.cjs +26 -0
  121. package/dist/chunk-VG24E4JJ.cjs.map +1 -0
  122. package/dist/{chunk-ECERC6TI.js → chunk-VHJHY7TT.js} +3 -3
  123. package/dist/{chunk-ECERC6TI.js.map → chunk-VHJHY7TT.js.map} +1 -1
  124. package/dist/{chunk-D3N67Q4D.js → chunk-W3VYZXNS.js} +3 -3
  125. package/dist/{chunk-D3N67Q4D.js.map → chunk-W3VYZXNS.js.map} +1 -1
  126. package/dist/{chunk-JK45LSIH.cjs → chunk-WXYQ66KC.cjs} +5 -5
  127. package/dist/{chunk-JK45LSIH.cjs.map → chunk-WXYQ66KC.cjs.map} +1 -1
  128. package/dist/{chunk-ZCF2JJFA.js → chunk-Y3KA6X7B.js} +3 -3
  129. package/dist/{chunk-ZCF2JJFA.js.map → chunk-Y3KA6X7B.js.map} +1 -1
  130. package/dist/{chunk-GYCQ3FNL.js → chunk-YBLIKTJK.js} +2 -2
  131. package/dist/chunk-YBLIKTJK.js.map +1 -0
  132. package/dist/chunk-YNIBUKV5.js +163 -0
  133. package/dist/chunk-YNIBUKV5.js.map +1 -0
  134. package/dist/citations/index.cjs +12 -11
  135. package/dist/citations/index.js +3 -2
  136. package/dist/collaboration/index.cjs +51 -51
  137. package/dist/collaboration/index.js +3 -3
  138. package/dist/components/DroppableContainer.d.ts +6 -0
  139. package/dist/components/GridRowNavigator.d.ts +29 -0
  140. package/dist/components/LoadingIndicator.d.ts +21 -0
  141. package/dist/components/RowNavigatorControls.d.ts +29 -0
  142. package/dist/components/SharedCell.d.ts +27 -0
  143. package/dist/connect/docx.cjs +7 -5
  144. package/dist/connect/docx.cjs.map +1 -1
  145. package/dist/connect/docx.js +6 -4
  146. package/dist/connect/docx.js.map +1 -1
  147. package/dist/connect/index.cjs +270 -227
  148. package/dist/connect/index.cjs.map +1 -1
  149. package/dist/connect/index.d.ts +1 -1
  150. package/dist/connect/index.js +199 -156
  151. package/dist/connect/index.js.map +1 -1
  152. package/dist/connection/ConnectedSettings.d.ts +46 -20
  153. package/dist/connection/ConnectionProvider.d.ts +5 -0
  154. package/dist/connection/mail/ConnectedMailComposer.d.ts +2 -3
  155. package/dist/connection/mail/ConnectedMailbox.d.ts +2 -3
  156. package/dist/connection/mail/MailComposerForm.d.ts +2 -3
  157. package/dist/connection/mail/index.d.ts +2 -2
  158. package/dist/connection/mail/mailbox.d.ts +1 -4
  159. package/dist/connection/mail/types.d.ts +0 -8
  160. package/dist/document-tools/index.cjs +1 -1
  161. package/dist/document-tools/index.js +1 -1
  162. package/dist/facts/fact-citations.d.ts +56 -0
  163. package/dist/facts/fact-table-column-resize.d.ts +18 -0
  164. package/dist/facts/index.cjs +198 -29
  165. package/dist/facts/index.cjs.map +1 -1
  166. package/dist/facts/index.d.ts +2 -1
  167. package/dist/facts/index.js +187 -27
  168. package/dist/facts/index.js.map +1 -1
  169. package/dist/files/index.cjs +4 -4
  170. package/dist/files/index.js +3 -3
  171. package/dist/home/index.cjs +20 -19
  172. package/dist/home/index.cjs.map +1 -1
  173. package/dist/home/index.js +5 -4
  174. package/dist/home/index.js.map +1 -1
  175. package/dist/index.cjs +877 -679
  176. package/dist/index.cjs.map +1 -1
  177. package/dist/index.d.ts +7 -1
  178. package/dist/index.js +207 -30
  179. package/dist/index.js.map +1 -1
  180. package/dist/provider/BlocksProvider.d.ts +39 -4
  181. package/dist/provider/dialogs.d.ts +31 -0
  182. package/dist/retrieval/index.cjs +5 -4
  183. package/dist/retrieval/index.js +3 -2
  184. package/dist/sandboxDocument-JLEETIWW.js +71 -0
  185. package/dist/sandboxDocument-JLEETIWW.js.map +1 -0
  186. package/dist/sandboxDocument-WQUNODSC.cjs +76 -0
  187. package/dist/sandboxDocument-WQUNODSC.cjs.map +1 -0
  188. package/dist/settings/DraggableHeader.d.ts +10 -0
  189. package/dist/settings/FilterChip.d.ts +15 -0
  190. package/dist/settings/MessageJsonTree.d.ts +7 -0
  191. package/dist/settings/MoreInfo.d.ts +25 -0
  192. package/dist/settings/PlanCard.d.ts +1 -1
  193. package/dist/settings/index.cjs +363 -266
  194. package/dist/settings/index.cjs.map +1 -1
  195. package/dist/settings/index.d.ts +4 -1
  196. package/dist/settings/index.js +317 -222
  197. package/dist/settings/index.js.map +1 -1
  198. package/dist/settings/message-schema-hints.d.ts +19 -0
  199. package/dist/shell/index.cjs +48 -47
  200. package/dist/shell/index.js +4 -3
  201. package/dist/site/index.cjs +5 -5
  202. package/dist/site/index.js +1 -1
  203. package/dist/studio/index.cjs +19 -18
  204. package/dist/studio/index.cjs.map +1 -1
  205. package/dist/studio/index.js +11 -10
  206. package/dist/studio/index.js.map +1 -1
  207. package/dist/workflow-canvas/index.cjs +65 -65
  208. package/dist/workflow-canvas/index.js +13 -13
  209. package/dist/workspaces/index.cjs +42 -3
  210. package/dist/workspaces/index.cjs.map +1 -1
  211. package/dist/workspaces/index.d.ts +1 -0
  212. package/dist/workspaces/index.js +38 -3
  213. package/dist/workspaces/index.js.map +1 -1
  214. package/dist/workspaces/workspace-type.d.ts +29 -0
  215. package/node_modules/@arbidocs/coedit/package.json +1 -1
  216. package/package.json +10 -4
  217. package/dist/StreamedArtifactEditor-EEYAXJ4H.cjs.map +0 -1
  218. package/dist/StreamedArtifactEditor-TDATDYD2.js.map +0 -1
  219. package/dist/chunk-3BJLNKOB.cjs.map +0 -1
  220. package/dist/chunk-76JDDMSP.js +0 -31
  221. package/dist/chunk-76JDDMSP.js.map +0 -1
  222. package/dist/chunk-A7NCSZAP.cjs.map +0 -1
  223. package/dist/chunk-C54XEN5T.cjs +0 -34
  224. package/dist/chunk-C54XEN5T.cjs.map +0 -1
  225. package/dist/chunk-CJBN5HIS.js.map +0 -1
  226. package/dist/chunk-GYCQ3FNL.js.map +0 -1
  227. package/dist/chunk-IBZJYCYM.js.map +0 -1
  228. package/dist/chunk-INW76PEL.cjs.map +0 -1
  229. package/dist/chunk-KELGOCJA.js.map +0 -1
  230. package/dist/chunk-MUMH3Z6K.cjs.map +0 -1
  231. package/dist/chunk-NZUQFF35.cjs.map +0 -1
  232. package/dist/chunk-OYMWV45N.js.map +0 -1
  233. package/dist/chunk-SWQX6CTT.cjs.map +0 -1
  234. package/dist/chunk-ZCHSJUCI.js.map +0 -1
  235. package/dist/facts/timezone.d.ts +0 -4
  236. package/dist/settings/FirmPool.d.ts +0 -82
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { ARTIFACT_MESSAGE_TAG, ARTIFACT_CSP } from './chunk-NS4JD2VR.js';
3
+ import './chunk-VUNV25KB.js';
4
+ import { transform } from 'sucrase';
5
+
6
+ var BRIDGE_SCRIPT = `(function(){
7
+ var TAG=${JSON.stringify(ARTIFACT_MESSAGE_TAG)};
8
+ function send(m){m[TAG]=true;try{parent.postMessage(m,'*')}catch(e){}}
9
+ function str(v){if(typeof v==='string')return v;if(v instanceof Error)return v.stack||v.message;try{return JSON.stringify(v)}catch(e){return String(v)}}
10
+ ['log','info','warn','error'].forEach(function(l){var o=console[l];console[l]=function(){var a=[].slice.call(arguments);send({type:'console',level:l,text:a.map(str).join(' ')});try{o.apply(console,a)}catch(e){}}});
11
+ window.addEventListener('error',function(e){send({type:'error',text:(e.message||'Error')+(e.lineno?' (line '+e.lineno+')':'')})});
12
+ window.addEventListener('unhandledrejection',function(e){send({type:'error',text:'Unhandled promise rejection: '+str(e.reason)})});
13
+ window.__arbiArtifactSend=send;
14
+ })();`;
15
+ function securityPrefix(extraHead) {
16
+ return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${ARTIFACT_CSP}"><meta name="viewport" content="width=device-width, initial-scale=1"><script>${BRIDGE_SCRIPT}</script>${extraHead}</head><body>`;
17
+ }
18
+ var TAILWIND_CDN_SCRIPT = /<script\b[^>]*\bsrc\s*=\s*["']https?:\/\/(?:cdn\.tailwindcss\.com|cdn\.jsdelivr\.net\/npm\/@tailwindcss\/browser)[^"']*["'][^>]*>\s*<\/script\s*>/gi;
19
+ function buildHtmlSandboxDocument(source, runtime) {
20
+ const body = source.replace(
21
+ TAILWIND_CDN_SCRIPT,
22
+ () => `<script>${escapeForInlineScript(runtime.tailwind)}</script>`
23
+ );
24
+ return securityPrefix("") + body;
25
+ }
26
+ function compileReactArtifact(source) {
27
+ try {
28
+ return transform(source, {
29
+ transforms: ["jsx", "imports"],
30
+ jsxRuntime: "classic",
31
+ production: true
32
+ }).code;
33
+ } catch (err) {
34
+ const message = err instanceof Error ? err.message : String(err);
35
+ throw new Error(`Could not compile this component: ${message}`, { cause: err });
36
+ }
37
+ }
38
+ function escapeForInlineScript(code) {
39
+ return code.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
40
+ }
41
+ function reactBootstrap(compiled) {
42
+ return `(function(){
43
+ var send=window.__arbiArtifactSend||function(){};
44
+ var available={'react':window.React,'react-dom':window.ReactDOM,'react-dom/client':window.ReactDOMClient};
45
+ function req(name){if(Object.prototype.hasOwnProperty.call(available,name))return available[name];throw new Error('Module "'+name+'" is not available in artifacts. Only "react" and "react-dom" can be imported.')}
46
+ var module={exports:{}};var exports=module.exports;
47
+ try{
48
+ (function(require,module,exports){
49
+ ${escapeForInlineScript(compiled)}
50
+ })(req,module,exports);
51
+ var App=(module.exports&&module.exports.default)||module.exports;
52
+ if(typeof App!=='function')throw new Error('The artifact must export a React component with "export default".');
53
+ var React=window.React;
54
+ var Boundary=class extends React.Component{constructor(p){super(p);this.state={e:null}}static getDerivedStateFromError(e){return{e:e}}componentDidCatch(e){send({type:'error',text:String(e&&e.stack||e)})}render(){if(this.state.e)return React.createElement('pre',{style:{color:'#b91c1c',padding:'16px',whiteSpace:'pre-wrap',font:'13px/1.5 ui-monospace,monospace'}},String(this.state.e&&this.state.e.message||this.state.e));return this.props.children}};
55
+ window.ReactDOMClient.createRoot(document.getElementById('root')).render(React.createElement(Boundary,null,React.createElement(App)));
56
+ send({type:'ready'});
57
+ }catch(e){send({type:'error',text:String(e&&e.message||e)})}
58
+ })();`;
59
+ }
60
+ function buildReactSandboxDocument(source, runtime) {
61
+ const compiled = compileReactArtifact(source);
62
+ const head = `<script>${escapeForInlineScript(runtime.react)}</script><script>${escapeForInlineScript(runtime.tailwind)}</script><style>html,body,#root{min-height:100%;margin:0}</style>`;
63
+ return securityPrefix(head) + `<div id="root"></div><script>${reactBootstrap(compiled)}</script>`;
64
+ }
65
+ function buildSandboxDocument(kind, source, runtime) {
66
+ return kind === "react" ? buildReactSandboxDocument(source, runtime) : buildHtmlSandboxDocument(source, runtime);
67
+ }
68
+
69
+ export { buildHtmlSandboxDocument, buildReactSandboxDocument, buildSandboxDocument, compileReactArtifact };
70
+ //# sourceMappingURL=sandboxDocument-JLEETIWW.js.map
71
+ //# sourceMappingURL=sandboxDocument-JLEETIWW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/artifacts/sandboxDocument.ts"],"names":[],"mappings":";;;;AAsBA,IAAM,aAAA,GAAgB,CAAA;AAAA,QAAA,EACZ,IAAA,CAAK,SAAA,CAAU,oBAAoB,CAAC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAA,CAAA;AAS9C,SAAS,eAAe,SAAA,EAA2B;AACjD,EAAA,OACE,CAAA,qGAAA,EACuD,YAAY,CAAA,8EAAA,EAExD,aAAa,YAAY,SAAS,CAAA,aAAA,CAAA;AAEjD;AAIA,IAAM,mBAAA,GACJ,qJAAA;AAEK,SAAS,wBAAA,CAAyB,QAAgB,OAAA,EAAkC;AAEzF,EAAA,MAAM,OAAO,MAAA,CAAO,OAAA;AAAA,IAClB,mBAAA;AAAA,IACA,MAAM,CAAA,QAAA,EAAW,qBAAA,CAAsB,OAAA,CAAQ,QAAQ,CAAC,CAAA,SAAA;AAAA,GAC1D;AACA,EAAA,OAAO,cAAA,CAAe,EAAE,CAAA,GAAI,IAAA;AAC9B;AAGO,SAAS,qBAAqB,MAAA,EAAwB;AAC3D,EAAA,IAAI;AACF,IAAA,OAAO,UAAU,MAAA,EAAQ;AAAA,MACvB,UAAA,EAAY,CAAC,KAAA,EAAO,SAAS,CAAA;AAAA,MAC7B,UAAA,EAAY,SAAA;AAAA,MACZ,UAAA,EAAY;AAAA,KACb,CAAA,CAAE,IAAA;AAAA,EACL,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,UAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC/D,IAAA,MAAM,IAAI,MAAM,CAAA,kCAAA,EAAqC,OAAO,IAAI,EAAE,KAAA,EAAO,KAAK,CAAA;AAAA,EAChF;AACF;AAGA,SAAS,sBAAsB,IAAA,EAAsB;AACnD,EAAA,OAAO,KAAK,OAAA,CAAQ,aAAA,EAAe,YAAY,CAAA,CAAE,OAAA,CAAQ,SAAS,QAAQ,CAAA;AAC5E;AAGA,SAAS,eAAe,QAAA,EAA0B;AAChD,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOP,qBAAA,CAAsB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAA,CAAA;AAUjC;AAEO,SAAS,yBAAA,CAA0B,QAAgB,OAAA,EAAkC;AAC1F,EAAA,MAAM,QAAA,GAAW,qBAAqB,MAAM,CAAA;AAC5C,EAAA,MAAM,IAAA,GACJ,CAAA,QAAA,EAAW,qBAAA,CAAsB,OAAA,CAAQ,KAAK,CAAC,CAAA,iBAAA,EACpC,qBAAA,CAAsB,OAAA,CAAQ,QAAQ,CAAC,CAAA,iEAAA,CAAA;AAEpD,EAAA,OAAO,eAAe,IAAI,CAAA,GAAI,CAAA,6BAAA,EAAgC,cAAA,CAAe,QAAQ,CAAC,CAAA,SAAA,CAAA;AACxF;AAEO,SAAS,oBAAA,CACd,IAAA,EACA,MAAA,EACA,OAAA,EACQ;AACR,EAAA,OAAO,IAAA,KAAS,UACZ,yBAAA,CAA0B,MAAA,EAAQ,OAAO,CAAA,GACzC,wBAAA,CAAyB,QAAQ,OAAO,CAAA;AAC9C","file":"sandboxDocument-JLEETIWW.js","sourcesContent":["/**\n * Builds the document that runs inside the artifact preview iframe.\n *\n * Threat model: artifact code is written by an LLM from untrusted input and runs in\n * the user's browser next to a decrypted session. It must never reach the app.\n * Layers (each independently sufficient for the main risks):\n * 1. The iframe is sandboxed with `allow-scripts` ONLY. No `allow-same-origin`, so the\n * frame gets an opaque origin: no access to the parent DOM, cookies, localStorage,\n * IndexedDB or the in-memory session. No popups, forms, top navigation or downloads.\n * 2. A Content-Security-Policy with `connect-src 'none'` and no remote sources: the\n * artifact cannot fetch, open sockets, load remote scripts/images/fonts or exfiltrate.\n * 3. JSX is compiled in the app (sucrase = text transform only), so the sandbox never\n * needs a compiler and compile errors surface in the app UI.\n *\n * The security prefix is PREPENDED to artifact HTML, never spliced into it, so a crafted\n * comment or `<head>` in the artifact cannot move the CSP out of effect.\n */\nimport { transform } from 'sucrase'\nimport type { ArtifactPreviewKind } from '@arbidocs/react/artifacts'\nimport { ARTIFACT_CSP, ARTIFACT_MESSAGE_TAG, type ArtifactRuntime } from './sandbox-policy'\n\n// Forwards console output and uncaught errors to the app. Runs first, before artifact code.\nconst BRIDGE_SCRIPT = `(function(){\nvar TAG=${JSON.stringify(ARTIFACT_MESSAGE_TAG)};\nfunction send(m){m[TAG]=true;try{parent.postMessage(m,'*')}catch(e){}}\nfunction str(v){if(typeof v==='string')return v;if(v instanceof Error)return v.stack||v.message;try{return JSON.stringify(v)}catch(e){return String(v)}}\n['log','info','warn','error'].forEach(function(l){var o=console[l];console[l]=function(){var a=[].slice.call(arguments);send({type:'console',level:l,text:a.map(str).join(' ')});try{o.apply(console,a)}catch(e){}}});\nwindow.addEventListener('error',function(e){send({type:'error',text:(e.message||'Error')+(e.lineno?' (line '+e.lineno+')':'')})});\nwindow.addEventListener('unhandledrejection',function(e){send({type:'error',text:'Unhandled promise rejection: '+str(e.reason)})});\nwindow.__arbiArtifactSend=send;\n})();`\n\nfunction securityPrefix(extraHead: string): string {\n return (\n '<!doctype html><html><head><meta charset=\"utf-8\">' +\n `<meta http-equiv=\"Content-Security-Policy\" content=\"${ARTIFACT_CSP}\">` +\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">' +\n `<script>${BRIDGE_SCRIPT}</script>${extraHead}</head><body>`\n )\n}\n\n// Models often include the Tailwind CDN script; there is no network in the sandbox, so replace the\n// whole element with the bundled copy.\nconst TAILWIND_CDN_SCRIPT =\n /<script\\b[^>]*\\bsrc\\s*=\\s*[\"']https?:\\/\\/(?:cdn\\.tailwindcss\\.com|cdn\\.jsdelivr\\.net\\/npm\\/@tailwindcss\\/browser)[^\"']*[\"'][^>]*>\\s*<\\/script\\s*>/gi\n\nexport function buildHtmlSandboxDocument(source: string, runtime: ArtifactRuntime): string {\n // A replacer function, not a string: the runtime contains `$` sequences that String.replace would expand.\n const body = source.replace(\n TAILWIND_CDN_SCRIPT,\n () => `<script>${escapeForInlineScript(runtime.tailwind)}</script>`\n )\n return securityPrefix('') + body\n}\n\n/** Compiles an artifact's JSX file to plain JS (CommonJS), or throws with a readable message. */\nexport function compileReactArtifact(source: string): string {\n try {\n return transform(source, {\n transforms: ['jsx', 'imports'],\n jsxRuntime: 'classic',\n production: true,\n }).code\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n throw new Error(`Could not compile this component: ${message}`, { cause: err })\n }\n}\n\n/** Keeps code from terminating an inline <script> or opening an HTML comment. */\nfunction escapeForInlineScript(code: string): string {\n return code.replace(/<\\/script/gi, '<\\\\/script').replace(/<!--/g, '<\\\\!--')\n}\n\n// Runs compiled artifact code with a tiny CommonJS shim and mounts its default export.\nfunction reactBootstrap(compiled: string): string {\n return `(function(){\nvar send=window.__arbiArtifactSend||function(){};\nvar available={'react':window.React,'react-dom':window.ReactDOM,'react-dom/client':window.ReactDOMClient};\nfunction req(name){if(Object.prototype.hasOwnProperty.call(available,name))return available[name];throw new Error('Module \"'+name+'\" is not available in artifacts. Only \"react\" and \"react-dom\" can be imported.')}\nvar module={exports:{}};var exports=module.exports;\ntry{\n(function(require,module,exports){\n${escapeForInlineScript(compiled)}\n})(req,module,exports);\nvar App=(module.exports&&module.exports.default)||module.exports;\nif(typeof App!=='function')throw new Error('The artifact must export a React component with \"export default\".');\nvar React=window.React;\nvar Boundary=class extends React.Component{constructor(p){super(p);this.state={e:null}}static getDerivedStateFromError(e){return{e:e}}componentDidCatch(e){send({type:'error',text:String(e&&e.stack||e)})}render(){if(this.state.e)return React.createElement('pre',{style:{color:'#b91c1c',padding:'16px',whiteSpace:'pre-wrap',font:'13px/1.5 ui-monospace,monospace'}},String(this.state.e&&this.state.e.message||this.state.e));return this.props.children}};\nwindow.ReactDOMClient.createRoot(document.getElementById('root')).render(React.createElement(Boundary,null,React.createElement(App)));\nsend({type:'ready'});\n}catch(e){send({type:'error',text:String(e&&e.message||e)})}\n})();`\n}\n\nexport function buildReactSandboxDocument(source: string, runtime: ArtifactRuntime): string {\n const compiled = compileReactArtifact(source)\n const head =\n `<script>${escapeForInlineScript(runtime.react)}</script>` +\n `<script>${escapeForInlineScript(runtime.tailwind)}</script>` +\n '<style>html,body,#root{min-height:100%;margin:0}</style>'\n return securityPrefix(head) + `<div id=\"root\"></div><script>${reactBootstrap(compiled)}</script>`\n}\n\nexport function buildSandboxDocument(\n kind: ArtifactPreviewKind,\n source: string,\n runtime: ArtifactRuntime\n): string {\n return kind === 'react'\n ? buildReactSandboxDocument(source, runtime)\n : buildHtmlSandboxDocument(source, runtime)\n}\n"]}
@@ -0,0 +1,76 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkVG24E4JJ_cjs = require('./chunk-VG24E4JJ.cjs');
5
+ require('./chunk-DES3K4SD.cjs');
6
+ var sucrase = require('sucrase');
7
+
8
+ var BRIDGE_SCRIPT = `(function(){
9
+ var TAG=${JSON.stringify(chunkVG24E4JJ_cjs.ARTIFACT_MESSAGE_TAG)};
10
+ function send(m){m[TAG]=true;try{parent.postMessage(m,'*')}catch(e){}}
11
+ function str(v){if(typeof v==='string')return v;if(v instanceof Error)return v.stack||v.message;try{return JSON.stringify(v)}catch(e){return String(v)}}
12
+ ['log','info','warn','error'].forEach(function(l){var o=console[l];console[l]=function(){var a=[].slice.call(arguments);send({type:'console',level:l,text:a.map(str).join(' ')});try{o.apply(console,a)}catch(e){}}});
13
+ window.addEventListener('error',function(e){send({type:'error',text:(e.message||'Error')+(e.lineno?' (line '+e.lineno+')':'')})});
14
+ window.addEventListener('unhandledrejection',function(e){send({type:'error',text:'Unhandled promise rejection: '+str(e.reason)})});
15
+ window.__arbiArtifactSend=send;
16
+ })();`;
17
+ function securityPrefix(extraHead) {
18
+ return `<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${chunkVG24E4JJ_cjs.ARTIFACT_CSP}"><meta name="viewport" content="width=device-width, initial-scale=1"><script>${BRIDGE_SCRIPT}</script>${extraHead}</head><body>`;
19
+ }
20
+ var TAILWIND_CDN_SCRIPT = /<script\b[^>]*\bsrc\s*=\s*["']https?:\/\/(?:cdn\.tailwindcss\.com|cdn\.jsdelivr\.net\/npm\/@tailwindcss\/browser)[^"']*["'][^>]*>\s*<\/script\s*>/gi;
21
+ function buildHtmlSandboxDocument(source, runtime) {
22
+ const body = source.replace(
23
+ TAILWIND_CDN_SCRIPT,
24
+ () => `<script>${escapeForInlineScript(runtime.tailwind)}</script>`
25
+ );
26
+ return securityPrefix("") + body;
27
+ }
28
+ function compileReactArtifact(source) {
29
+ try {
30
+ return sucrase.transform(source, {
31
+ transforms: ["jsx", "imports"],
32
+ jsxRuntime: "classic",
33
+ production: true
34
+ }).code;
35
+ } catch (err) {
36
+ const message = err instanceof Error ? err.message : String(err);
37
+ throw new Error(`Could not compile this component: ${message}`, { cause: err });
38
+ }
39
+ }
40
+ function escapeForInlineScript(code) {
41
+ return code.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
42
+ }
43
+ function reactBootstrap(compiled) {
44
+ return `(function(){
45
+ var send=window.__arbiArtifactSend||function(){};
46
+ var available={'react':window.React,'react-dom':window.ReactDOM,'react-dom/client':window.ReactDOMClient};
47
+ function req(name){if(Object.prototype.hasOwnProperty.call(available,name))return available[name];throw new Error('Module "'+name+'" is not available in artifacts. Only "react" and "react-dom" can be imported.')}
48
+ var module={exports:{}};var exports=module.exports;
49
+ try{
50
+ (function(require,module,exports){
51
+ ${escapeForInlineScript(compiled)}
52
+ })(req,module,exports);
53
+ var App=(module.exports&&module.exports.default)||module.exports;
54
+ if(typeof App!=='function')throw new Error('The artifact must export a React component with "export default".');
55
+ var React=window.React;
56
+ var Boundary=class extends React.Component{constructor(p){super(p);this.state={e:null}}static getDerivedStateFromError(e){return{e:e}}componentDidCatch(e){send({type:'error',text:String(e&&e.stack||e)})}render(){if(this.state.e)return React.createElement('pre',{style:{color:'#b91c1c',padding:'16px',whiteSpace:'pre-wrap',font:'13px/1.5 ui-monospace,monospace'}},String(this.state.e&&this.state.e.message||this.state.e));return this.props.children}};
57
+ window.ReactDOMClient.createRoot(document.getElementById('root')).render(React.createElement(Boundary,null,React.createElement(App)));
58
+ send({type:'ready'});
59
+ }catch(e){send({type:'error',text:String(e&&e.message||e)})}
60
+ })();`;
61
+ }
62
+ function buildReactSandboxDocument(source, runtime) {
63
+ const compiled = compileReactArtifact(source);
64
+ const head = `<script>${escapeForInlineScript(runtime.react)}</script><script>${escapeForInlineScript(runtime.tailwind)}</script><style>html,body,#root{min-height:100%;margin:0}</style>`;
65
+ return securityPrefix(head) + `<div id="root"></div><script>${reactBootstrap(compiled)}</script>`;
66
+ }
67
+ function buildSandboxDocument(kind, source, runtime) {
68
+ return kind === "react" ? buildReactSandboxDocument(source, runtime) : buildHtmlSandboxDocument(source, runtime);
69
+ }
70
+
71
+ exports.buildHtmlSandboxDocument = buildHtmlSandboxDocument;
72
+ exports.buildReactSandboxDocument = buildReactSandboxDocument;
73
+ exports.buildSandboxDocument = buildSandboxDocument;
74
+ exports.compileReactArtifact = compileReactArtifact;
75
+ //# sourceMappingURL=sandboxDocument-WQUNODSC.cjs.map
76
+ //# sourceMappingURL=sandboxDocument-WQUNODSC.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/artifacts/sandboxDocument.ts"],"names":["ARTIFACT_MESSAGE_TAG","ARTIFACT_CSP","transform"],"mappings":";;;;;;AAsBA,IAAM,aAAA,GAAgB,CAAA;AAAA,QAAA,EACZ,IAAA,CAAK,SAAA,CAAUA,sCAAoB,CAAC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAA,CAAA;AAS9C,SAAS,eAAe,SAAA,EAA2B;AACjD,EAAA,OACE,CAAA,qGAAA,EACuDC,8BAAY,CAAA,8EAAA,EAExD,aAAa,YAAY,SAAS,CAAA,aAAA,CAAA;AAEjD;AAIA,IAAM,mBAAA,GACJ,qJAAA;AAEK,SAAS,wBAAA,CAAyB,QAAgB,OAAA,EAAkC;AAEzF,EAAA,MAAM,OAAO,MAAA,CAAO,OAAA;AAAA,IAClB,mBAAA;AAAA,IACA,MAAM,CAAA,QAAA,EAAW,qBAAA,CAAsB,OAAA,CAAQ,QAAQ,CAAC,CAAA,SAAA;AAAA,GAC1D;AACA,EAAA,OAAO,cAAA,CAAe,EAAE,CAAA,GAAI,IAAA;AAC9B;AAGO,SAAS,qBAAqB,MAAA,EAAwB;AAC3D,EAAA,IAAI;AACF,IAAA,OAAOC,kBAAU,MAAA,EAAQ;AAAA,MACvB,UAAA,EAAY,CAAC,KAAA,EAAO,SAAS,CAAA;AAAA,MAC7B,UAAA,EAAY,SAAA;AAAA,MACZ,UAAA,EAAY;AAAA,KACb,CAAA,CAAE,IAAA;AAAA,EACL,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,UAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC/D,IAAA,MAAM,IAAI,MAAM,CAAA,kCAAA,EAAqC,OAAO,IAAI,EAAE,KAAA,EAAO,KAAK,CAAA;AAAA,EAChF;AACF;AAGA,SAAS,sBAAsB,IAAA,EAAsB;AACnD,EAAA,OAAO,KAAK,OAAA,CAAQ,aAAA,EAAe,YAAY,CAAA,CAAE,OAAA,CAAQ,SAAS,QAAQ,CAAA;AAC5E;AAGA,SAAS,eAAe,QAAA,EAA0B;AAChD,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOP,qBAAA,CAAsB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAA,CAAA;AAUjC;AAEO,SAAS,yBAAA,CAA0B,QAAgB,OAAA,EAAkC;AAC1F,EAAA,MAAM,QAAA,GAAW,qBAAqB,MAAM,CAAA;AAC5C,EAAA,MAAM,IAAA,GACJ,CAAA,QAAA,EAAW,qBAAA,CAAsB,OAAA,CAAQ,KAAK,CAAC,CAAA,iBAAA,EACpC,qBAAA,CAAsB,OAAA,CAAQ,QAAQ,CAAC,CAAA,iEAAA,CAAA;AAEpD,EAAA,OAAO,eAAe,IAAI,CAAA,GAAI,CAAA,6BAAA,EAAgC,cAAA,CAAe,QAAQ,CAAC,CAAA,SAAA,CAAA;AACxF;AAEO,SAAS,oBAAA,CACd,IAAA,EACA,MAAA,EACA,OAAA,EACQ;AACR,EAAA,OAAO,IAAA,KAAS,UACZ,yBAAA,CAA0B,MAAA,EAAQ,OAAO,CAAA,GACzC,wBAAA,CAAyB,QAAQ,OAAO,CAAA;AAC9C","file":"sandboxDocument-WQUNODSC.cjs","sourcesContent":["/**\n * Builds the document that runs inside the artifact preview iframe.\n *\n * Threat model: artifact code is written by an LLM from untrusted input and runs in\n * the user's browser next to a decrypted session. It must never reach the app.\n * Layers (each independently sufficient for the main risks):\n * 1. The iframe is sandboxed with `allow-scripts` ONLY. No `allow-same-origin`, so the\n * frame gets an opaque origin: no access to the parent DOM, cookies, localStorage,\n * IndexedDB or the in-memory session. No popups, forms, top navigation or downloads.\n * 2. A Content-Security-Policy with `connect-src 'none'` and no remote sources: the\n * artifact cannot fetch, open sockets, load remote scripts/images/fonts or exfiltrate.\n * 3. JSX is compiled in the app (sucrase = text transform only), so the sandbox never\n * needs a compiler and compile errors surface in the app UI.\n *\n * The security prefix is PREPENDED to artifact HTML, never spliced into it, so a crafted\n * comment or `<head>` in the artifact cannot move the CSP out of effect.\n */\nimport { transform } from 'sucrase'\nimport type { ArtifactPreviewKind } from '@arbidocs/react/artifacts'\nimport { ARTIFACT_CSP, ARTIFACT_MESSAGE_TAG, type ArtifactRuntime } from './sandbox-policy'\n\n// Forwards console output and uncaught errors to the app. Runs first, before artifact code.\nconst BRIDGE_SCRIPT = `(function(){\nvar TAG=${JSON.stringify(ARTIFACT_MESSAGE_TAG)};\nfunction send(m){m[TAG]=true;try{parent.postMessage(m,'*')}catch(e){}}\nfunction str(v){if(typeof v==='string')return v;if(v instanceof Error)return v.stack||v.message;try{return JSON.stringify(v)}catch(e){return String(v)}}\n['log','info','warn','error'].forEach(function(l){var o=console[l];console[l]=function(){var a=[].slice.call(arguments);send({type:'console',level:l,text:a.map(str).join(' ')});try{o.apply(console,a)}catch(e){}}});\nwindow.addEventListener('error',function(e){send({type:'error',text:(e.message||'Error')+(e.lineno?' (line '+e.lineno+')':'')})});\nwindow.addEventListener('unhandledrejection',function(e){send({type:'error',text:'Unhandled promise rejection: '+str(e.reason)})});\nwindow.__arbiArtifactSend=send;\n})();`\n\nfunction securityPrefix(extraHead: string): string {\n return (\n '<!doctype html><html><head><meta charset=\"utf-8\">' +\n `<meta http-equiv=\"Content-Security-Policy\" content=\"${ARTIFACT_CSP}\">` +\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">' +\n `<script>${BRIDGE_SCRIPT}</script>${extraHead}</head><body>`\n )\n}\n\n// Models often include the Tailwind CDN script; there is no network in the sandbox, so replace the\n// whole element with the bundled copy.\nconst TAILWIND_CDN_SCRIPT =\n /<script\\b[^>]*\\bsrc\\s*=\\s*[\"']https?:\\/\\/(?:cdn\\.tailwindcss\\.com|cdn\\.jsdelivr\\.net\\/npm\\/@tailwindcss\\/browser)[^\"']*[\"'][^>]*>\\s*<\\/script\\s*>/gi\n\nexport function buildHtmlSandboxDocument(source: string, runtime: ArtifactRuntime): string {\n // A replacer function, not a string: the runtime contains `$` sequences that String.replace would expand.\n const body = source.replace(\n TAILWIND_CDN_SCRIPT,\n () => `<script>${escapeForInlineScript(runtime.tailwind)}</script>`\n )\n return securityPrefix('') + body\n}\n\n/** Compiles an artifact's JSX file to plain JS (CommonJS), or throws with a readable message. */\nexport function compileReactArtifact(source: string): string {\n try {\n return transform(source, {\n transforms: ['jsx', 'imports'],\n jsxRuntime: 'classic',\n production: true,\n }).code\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n throw new Error(`Could not compile this component: ${message}`, { cause: err })\n }\n}\n\n/** Keeps code from terminating an inline <script> or opening an HTML comment. */\nfunction escapeForInlineScript(code: string): string {\n return code.replace(/<\\/script/gi, '<\\\\/script').replace(/<!--/g, '<\\\\!--')\n}\n\n// Runs compiled artifact code with a tiny CommonJS shim and mounts its default export.\nfunction reactBootstrap(compiled: string): string {\n return `(function(){\nvar send=window.__arbiArtifactSend||function(){};\nvar available={'react':window.React,'react-dom':window.ReactDOM,'react-dom/client':window.ReactDOMClient};\nfunction req(name){if(Object.prototype.hasOwnProperty.call(available,name))return available[name];throw new Error('Module \"'+name+'\" is not available in artifacts. Only \"react\" and \"react-dom\" can be imported.')}\nvar module={exports:{}};var exports=module.exports;\ntry{\n(function(require,module,exports){\n${escapeForInlineScript(compiled)}\n})(req,module,exports);\nvar App=(module.exports&&module.exports.default)||module.exports;\nif(typeof App!=='function')throw new Error('The artifact must export a React component with \"export default\".');\nvar React=window.React;\nvar Boundary=class extends React.Component{constructor(p){super(p);this.state={e:null}}static getDerivedStateFromError(e){return{e:e}}componentDidCatch(e){send({type:'error',text:String(e&&e.stack||e)})}render(){if(this.state.e)return React.createElement('pre',{style:{color:'#b91c1c',padding:'16px',whiteSpace:'pre-wrap',font:'13px/1.5 ui-monospace,monospace'}},String(this.state.e&&this.state.e.message||this.state.e));return this.props.children}};\nwindow.ReactDOMClient.createRoot(document.getElementById('root')).render(React.createElement(Boundary,null,React.createElement(App)));\nsend({type:'ready'});\n}catch(e){send({type:'error',text:String(e&&e.message||e)})}\n})();`\n}\n\nexport function buildReactSandboxDocument(source: string, runtime: ArtifactRuntime): string {\n const compiled = compileReactArtifact(source)\n const head =\n `<script>${escapeForInlineScript(runtime.react)}</script>` +\n `<script>${escapeForInlineScript(runtime.tailwind)}</script>` +\n '<style>html,body,#root{min-height:100%;margin:0}</style>'\n return securityPrefix(head) + `<div id=\"root\"></div><script>${reactBootstrap(compiled)}</script>`\n}\n\nexport function buildSandboxDocument(\n kind: ArtifactPreviewKind,\n source: string,\n runtime: ArtifactRuntime\n): string {\n return kind === 'react'\n ? buildReactSandboxDocument(source, runtime)\n : buildHtmlSandboxDocument(source, runtime)\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Wrapper that makes a header region draggable for FloatingPanel,
3
+ * while ignoring clicks on interactive elements (buttons, inputs, tabs, etc.).
4
+ */
5
+ import React from 'react';
6
+ export interface DraggableHeaderProps {
7
+ onDragStart?: (e: React.MouseEvent) => void;
8
+ children: React.ReactNode;
9
+ }
10
+ export declare function DraggableHeader({ onDragStart, children }: DraggableHeaderProps): React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { TriState } from './TriStateFilterMenu';
3
+ export interface FilterChipProps {
4
+ label: string;
5
+ state: TriState;
6
+ icon?: ReactNode;
7
+ /** When provided, renders a colored pill identical to Labels column */
8
+ color?: string;
9
+ onDismiss?: () => void;
10
+ /** The dismiss button's accessible name (default "Remove <label>"). */
11
+ dismissLabel?: string;
12
+ className?: string;
13
+ testId?: string;
14
+ }
15
+ export declare function FilterChip({ label, state, icon, color, onDismiss, dismissLabel, className, testId, }: FilterChipProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * MessageJsonTree: the JsonTree with the ARBI message schema hints (field names, ids, timestamps
3
+ * of a message and its tool outputs), for a "message details" view.
4
+ */
5
+ import { type JsonTreeProps } from './JsonTree';
6
+ export type MessageJsonTreeProps = Omit<JsonTreeProps, 'resolveHint' | 'formatValue'>;
7
+ export declare function MessageJsonTree(props: MessageJsonTreeProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface MoreInfoProps {
3
+ /** The modal's title, e.g. "Usage and top-ups". */
4
+ title: string;
5
+ /** The explanation: short paragraphs or a {@link MoreInfoList}. */
6
+ children: ReactNode;
7
+ /** The link's text. */
8
+ label?: string;
9
+ /** Test id of the link; the modal is `<testId>-dialog`. */
10
+ testId?: string;
11
+ className?: string;
12
+ }
13
+ /**
14
+ * A small "More info" link that opens a modal with the longer explanation, so a screen can keep to
15
+ * short labels and one-line facts. The one place billing surfaces put proration, caps, renewals
16
+ * and refunds.
17
+ */
18
+ export declare function MoreInfo({ title, children, label, testId, className, }: MoreInfoProps): import("react").JSX.Element;
19
+ /** The explanation as a list of short points, each with an optional bold lead. */
20
+ export declare function MoreInfoList({ items }: {
21
+ items: Array<{
22
+ term?: string;
23
+ text: ReactNode;
24
+ }>;
25
+ }): import("react").JSX.Element;
@@ -95,7 +95,7 @@ export declare function PromoCodeInput({ value, onChange, labels, }: {
95
95
  onChange: (value: string) => void;
96
96
  labels?: Partial<PlanCardLabels>;
97
97
  }): import("react").JSX.Element;
98
- /** "Pricing Explainer" popover. `onOpenModelList` opens the AI model list. */
98
+ /** "How pricing works": a link that opens the pricing explainer modal. `onOpenModelList` opens the AI model list. */
99
99
  export declare function PlanInfoPopover({ onOpenModelList, labels, }: {
100
100
  onOpenModelList: () => void;
101
101
  labels?: Partial<PlanCardLabels>;