@feathery/react 2.52.0 → 2.53.0

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 (155) hide show
  1. package/cjs/Form/components/DevNavBar.d.ts.map +1 -1
  2. package/cjs/Form/index.d.ts.map +1 -1
  3. package/cjs/assistant/AssistantChat.d.ts.map +1 -1
  4. package/cjs/assistant/AssistantClient.d.ts +2 -1
  5. package/cjs/assistant/AssistantClient.d.ts.map +1 -1
  6. package/cjs/assistant/ToolStatus.d.ts.map +1 -1
  7. package/cjs/assistant/tools/clickElement.d.ts.map +1 -1
  8. package/cjs/assistant/tools/navigate.d.ts +16 -0
  9. package/cjs/assistant/tools/navigate.d.ts.map +1 -0
  10. package/cjs/assistant/tools/panelRuntime.d.ts +22 -5
  11. package/cjs/assistant/tools/panelRuntime.d.ts.map +1 -1
  12. package/cjs/assistant/tools/triggerTableAction.d.ts.map +1 -1
  13. package/cjs/assistant/tools/utils.d.ts +1 -0
  14. package/cjs/assistant/tools/utils.d.ts.map +1 -1
  15. package/cjs/elements/basic/ProgressBarElement/components/StepperBar.d.ts.map +1 -1
  16. package/cjs/elements/basic/ProgressBarElement/index.d.ts.map +1 -1
  17. package/cjs/{fthry_AssistantChat.DClMjBbo.js → fthry_AssistantChat.Cdt71IEA.js} +358 -100
  18. package/cjs/{fthry_FormControl.CFsGjlWP.js → fthry_FormControl.DpCsf-wk.js} +1 -1
  19. package/cjs/{fthry_InlineTooltip.D8vNmyCo.js → fthry_InlineTooltip.nKLmX5o5.js} +1 -1
  20. package/cjs/{fthry_PaymentMethodField.CjyihPh2.js → fthry_PaymentMethodField.BLuiD1KT.js} +3 -3
  21. package/cjs/{fthry_Placeholder.CEroHtne.js → fthry_Placeholder.BJA_j-7t.js} +1 -1
  22. package/cjs/{fthry_ShowEyeIcon.BnG3Vchl.js → fthry_ShowEyeIcon.DGAHQwc4.js} +1 -1
  23. package/cjs/{fthry_TabsElement.CZhy_wi4.js → fthry_TabsElement.EaxR88eT.js} +1 -1
  24. package/cjs/{fthry_auto-track.BPxVfhig.js → fthry_auto-track.B2EuUyWQ.js} +2 -2
  25. package/cjs/{fthry_highlighted-body-TPN3WLV5.Cbq0oozC.js → fthry_highlighted-body-TPN3WLV5.D0_x3Hnh.js} +3 -3
  26. package/cjs/{fthry_index.BDmxKsQr.js → fthry_index.AEIgB8XZ.js} +1 -1
  27. package/cjs/{fthry_index.-317ESCa.js → fthry_index.B0Z5hKAK.js} +2 -2
  28. package/cjs/{fthry_index.BKPLTWi2.js → fthry_index.B0xx5w3Y.js} +4 -4
  29. package/cjs/{fthry_index.CCEBVH2X.js → fthry_index.BDQthVrL.js} +1 -1
  30. package/cjs/{fthry_index.BFIHbM-S.js → fthry_index.BdNvpld5.js} +4 -4
  31. package/cjs/{fthry_index.3AdSzGkN.js → fthry_index.BoBcyJjH.js} +1 -1
  32. package/cjs/{fthry_index.B8MwyqlN.js → fthry_index.Bod-ybm6.js} +1 -1
  33. package/cjs/{fthry_index.DQNu-cig.js → fthry_index.BwAj91oq.js} +2 -2
  34. package/cjs/{fthry_index.DtLwdWxZ.js → fthry_index.C-Tcdfmc.js} +1 -1
  35. package/cjs/{fthry_index.CaUi4jbg.js → fthry_index.C0n-WuVc.js} +1 -1
  36. package/cjs/{fthry_index.D39Lt3zI.js → fthry_index.CCKdjjti.js} +1 -1
  37. package/cjs/{fthry_index.Cwq4DYI1.js → fthry_index.CE5CJdZu.js} +7 -7
  38. package/cjs/{fthry_index.CU8bLoRm.js → fthry_index.CF6HTGG8.js} +1 -1
  39. package/cjs/{fthry_index.Dc_4w6fx.js → fthry_index.CGCWGlnp.js} +3 -3
  40. package/cjs/{fthry_index.CmD9vaZF.js → fthry_index.CJEKmmXG.js} +1 -1
  41. package/cjs/{fthry_index.KEOsb1yt.js → fthry_index.CSYsApcr.js} +4 -4
  42. package/cjs/{fthry_index.FvahYCl4.js → fthry_index.CTlWYTKv.js} +2 -2
  43. package/cjs/{fthry_index.DJHxUxWn.js → fthry_index.CvGygqZP.js} +5 -5
  44. package/cjs/{fthry_index.CXwLzgRa.js → fthry_index.CxBG2-BU.js} +1 -1
  45. package/cjs/{fthry_index.C9NKIII4.js → fthry_index.CxY6K5_1.js} +10 -10
  46. package/cjs/{fthry_index.Z912i259.js → fthry_index.D-NTvk-Y.js} +1 -1
  47. package/cjs/{fthry_index.C3M5YF3_.js → fthry_index.D0IwM5iZ.js} +2 -2
  48. package/cjs/{fthry_index.CkV6wvoE.js → fthry_index.D8NmDklI.js} +3 -3
  49. package/cjs/{fthry_index.C3i01ldH.js → fthry_index.DEtRMtpY.js} +4 -4
  50. package/cjs/{fthry_index.D5nsJ4l9.js → fthry_index.DIcj_VUJ.js} +98 -56
  51. package/cjs/{fthry_index.BLx53xa6.js → fthry_index.DfhW9KvX.js} +2 -2
  52. package/cjs/{fthry_index.BTPOlsSL.js → fthry_index.QBRBv5zI.js} +5 -5
  53. package/cjs/{fthry_index.K-f-AFvK.js → fthry_index.a_07qAue.js} +5 -5
  54. package/cjs/{fthry_index.BsBvq_1g.js → fthry_index.cy-BntXN.js} +5 -5
  55. package/cjs/{fthry_index.BKp4BJaN.js → fthry_index.fXQdvWc6.js} +2 -2
  56. package/cjs/{fthry_index.Cak79RQu.js → fthry_index.n5ANsMnM.js} +2 -2
  57. package/cjs/{fthry_index.CT_LxtvQ.js → fthry_index.s44MPEx0.js} +3 -3
  58. package/cjs/{fthry_index.umd.CfnpJnCF.js → fthry_index.umd.C2sFE07r.js} +1 -1
  59. package/cjs/{fthry_input.FZhPnVr7.js → fthry_input.B2-tNesz.js} +1 -1
  60. package/cjs/{fthry_logging.geKUVlWF.js → fthry_logging.Ddacrn6B.js} +1 -1
  61. package/cjs/{fthry_mermaid-O7DHMXV3.CmGxXRTE.js → fthry_mermaid-O7DHMXV3.Dj-pTS7i.js} +3 -3
  62. package/cjs/{fthry_script.BUpgmYs1.js → fthry_script.CvH2Hl2W.js} +1 -1
  63. package/cjs/{fthry_styles.Cs5z0RLk.js → fthry_styles.DJU4cNZx.js} +1 -1
  64. package/cjs/{fthry_useElementSize.YisvU5or.js → fthry_useElementSize.D9gQ1cgh.js} +1 -1
  65. package/cjs/{fthry_useSalesforceSync.IpHyJ8Rh.js → fthry_useSalesforceSync.DJ-dQcVK.js} +1 -1
  66. package/cjs/{fthry_webfontloader.DNe9Fh4f.js → fthry_webfontloader.CpQnAbXr.js} +1 -1
  67. package/cjs/index.js +1 -1
  68. package/cjs/thumbnail-renderer.js +1 -1
  69. package/cjs/utils/featheryClient/integrationClient.d.ts +1 -1
  70. package/cjs/utils/featheryClient/integrationClient.d.ts.map +1 -1
  71. package/cjs/utils/formContext.d.ts.map +1 -1
  72. package/cjs/utils/internalState.d.ts +30 -2
  73. package/cjs/utils/internalState.d.ts.map +1 -1
  74. package/cjs/utils/stepper.d.ts +3 -0
  75. package/cjs/utils/stepper.d.ts.map +1 -0
  76. package/dist/Form/components/DevNavBar.d.ts.map +1 -1
  77. package/dist/Form/index.d.ts.map +1 -1
  78. package/dist/assistant/AssistantChat.d.ts.map +1 -1
  79. package/dist/assistant/AssistantClient.d.ts +2 -1
  80. package/dist/assistant/AssistantClient.d.ts.map +1 -1
  81. package/dist/assistant/ToolStatus.d.ts.map +1 -1
  82. package/dist/assistant/tools/clickElement.d.ts.map +1 -1
  83. package/dist/assistant/tools/navigate.d.ts +16 -0
  84. package/dist/assistant/tools/navigate.d.ts.map +1 -0
  85. package/dist/assistant/tools/panelRuntime.d.ts +22 -5
  86. package/dist/assistant/tools/panelRuntime.d.ts.map +1 -1
  87. package/dist/assistant/tools/triggerTableAction.d.ts.map +1 -1
  88. package/dist/assistant/tools/utils.d.ts +1 -0
  89. package/dist/assistant/tools/utils.d.ts.map +1 -1
  90. package/dist/elements/basic/ProgressBarElement/components/StepperBar.d.ts.map +1 -1
  91. package/dist/elements/basic/ProgressBarElement/index.d.ts.map +1 -1
  92. package/dist/{fthry_AssistantChat.TIBRtTlG.js → fthry_AssistantChat.CJAt7wH0.js} +358 -100
  93. package/dist/{fthry_FormControl.B7J9s9oo.js → fthry_FormControl.CWgZ1MrD.js} +1 -1
  94. package/dist/{fthry_InlineTooltip.BPOmnzvw.js → fthry_InlineTooltip.7XgEXbYu.js} +1 -1
  95. package/dist/{fthry_PaymentMethodField.DsCBiJlK.js → fthry_PaymentMethodField.CgAjXVvk.js} +3 -3
  96. package/dist/{fthry_Placeholder.NymoVpcm.js → fthry_Placeholder.ByFQNx8z.js} +1 -1
  97. package/dist/{fthry_ShowEyeIcon.BDAEa0mY.js → fthry_ShowEyeIcon.BJrSqd0f.js} +1 -1
  98. package/dist/{fthry_TabsElement.DX0UxEwC.js → fthry_TabsElement.CGC4knJ1.js} +1 -1
  99. package/dist/{fthry_auto-track.Dyp3Edpb.js → fthry_auto-track.CZqUYnsi.js} +2 -2
  100. package/dist/{fthry_highlighted-body-TPN3WLV5.BZlLLT_h.js → fthry_highlighted-body-TPN3WLV5.C3z_0DMf.js} +3 -3
  101. package/dist/{fthry_index.CpcusZGV.js → fthry_index.3Jy6ng8E.js} +1 -1
  102. package/dist/{fthry_index.Dy4F8buv.js → fthry_index.4QNSIT1t.js} +91 -57
  103. package/dist/{fthry_index.DYAwyU5i.js → fthry_index.B2Es9K0o.js} +1 -1
  104. package/dist/{fthry_index.Nuav8j0K.js → fthry_index.B9t_y8G8.js} +10 -10
  105. package/dist/{fthry_index.Dom1xrnf.js → fthry_index.BFVMswJ1.js} +2 -2
  106. package/dist/{fthry_index.CACzwTsE.js → fthry_index.BfZgFvaE.js} +1 -1
  107. package/dist/{fthry_index.nsku124v.js → fthry_index.BjKBqRrG.js} +1 -1
  108. package/dist/{fthry_index.Bz4rt_--.js → fthry_index.Bn0j9VXL.js} +2 -2
  109. package/dist/{fthry_index.dQWeqnwG.js → fthry_index.Bnm_pBFE.js} +2 -2
  110. package/dist/{fthry_index.Bg68oPpb.js → fthry_index.Btu6A06t.js} +4 -4
  111. package/dist/{fthry_index.C4y2VpAI.js → fthry_index.BuFT0arS.js} +1 -1
  112. package/dist/{fthry_index.fHB_kRnm.js → fthry_index.CKVts5To.js} +2 -2
  113. package/dist/{fthry_index.CphDVlAz.js → fthry_index.CLlR40IQ.js} +4 -4
  114. package/dist/{fthry_index.BlcRVzvp.js → fthry_index.CUueWzfP.js} +1 -1
  115. package/dist/{fthry_index.BioTQdQH.js → fthry_index.CX1r3NuY.js} +1 -1
  116. package/dist/{fthry_index.DZN4f0xc.js → fthry_index.CsM8DPsH.js} +1 -1
  117. package/dist/{fthry_index.CKkHv6qK.js → fthry_index.CwOyWW-J.js} +4 -4
  118. package/dist/{fthry_index.iwkuw--x.js → fthry_index.CypPLcEL.js} +1 -1
  119. package/dist/{fthry_index.B-wzj9I3.js → fthry_index.D-XOSELH.js} +4 -4
  120. package/dist/{fthry_index.B0vLbcGn.js → fthry_index.DBLwzmdF.js} +4 -4
  121. package/dist/{fthry_index.B7ES1pR0.js → fthry_index.DFn9knto.js} +3 -3
  122. package/dist/{fthry_index.CIiCjWfx.js → fthry_index.DT69gcWO.js} +2 -2
  123. package/dist/{fthry_index.Cwbly1ds.js → fthry_index.DgciEfKe.js} +5 -5
  124. package/dist/{fthry_index.bjvsIu8G.js → fthry_index.DpVMd01B.js} +2 -2
  125. package/dist/{fthry_index.DNdQzLH9.js → fthry_index.DwGHkZCX.js} +2 -2
  126. package/dist/{fthry_index.DESq1sgq.js → fthry_index.LTen71MA.js} +3 -3
  127. package/dist/{fthry_index.D2bM42q_.js → fthry_index.P8wEcmzz.js} +1 -1
  128. package/dist/{fthry_index.DCuF1bk9.js → fthry_index.dFtvnq3I.js} +5 -5
  129. package/dist/{fthry_index.DlMUmymj.js → fthry_index.grYyHutk.js} +7 -7
  130. package/dist/{fthry_index.CGeXsZmz.js → fthry_index.jN7H-T8G.js} +3 -3
  131. package/dist/{fthry_index.BM5fI9GV.js → fthry_index.lGuVWSnj.js} +1 -1
  132. package/dist/{fthry_index.umd.D4j5JUK3.js → fthry_index.umd.Dh0beEu5.js} +1 -1
  133. package/dist/{fthry_index.AY29jqCG.js → fthry_index.y_kfjmY0.js} +5 -5
  134. package/dist/{fthry_input.Adlw2NIB.js → fthry_input.BXpeFwlq.js} +1 -1
  135. package/dist/{fthry_logging.CMGH_ih6.js → fthry_logging.DRq8nhnp.js} +1 -1
  136. package/dist/fthry_mermaid-O7DHMXV3.CIgHgZjg.js +8 -0
  137. package/dist/{fthry_script.Cw3vY7SE.js → fthry_script.BygC8at8.js} +1 -1
  138. package/dist/{fthry_styles.kI9Gm6SN.js → fthry_styles.DKvdF1tW.js} +1 -1
  139. package/dist/{fthry_useElementSize.DI3dhxBK.js → fthry_useElementSize.n7b3hTj8.js} +1 -1
  140. package/dist/{fthry_useSalesforceSync.Dm771FBU.js → fthry_useSalesforceSync.gMwYUngS.js} +1 -1
  141. package/dist/{fthry_webfontloader.DzI_r3mH.js → fthry_webfontloader.CyBgW_8H.js} +1 -1
  142. package/dist/index.js +2 -2
  143. package/dist/thumbnail-renderer.js +1 -1
  144. package/dist/utils/featheryClient/integrationClient.d.ts +1 -1
  145. package/dist/utils/featheryClient/integrationClient.d.ts.map +1 -1
  146. package/dist/utils/formContext.d.ts.map +1 -1
  147. package/dist/utils/internalState.d.ts +30 -2
  148. package/dist/utils/internalState.d.ts.map +1 -1
  149. package/dist/utils/stepper.d.ts +3 -0
  150. package/dist/utils/stepper.d.ts.map +1 -0
  151. package/package.json +1 -1
  152. package/umd/AssistantChat.4e04484d6624a1473709.js +1 -0
  153. package/umd/index.js +1 -1
  154. package/dist/fthry_mermaid-O7DHMXV3.CD4sCxo0.js +0 -8
  155. package/umd/AssistantChat.f4f1a5ab9a911c339fd1.js +0 -1
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var index$1 = require('./fthry_index.D5nsJ4l9.js');
3
+ var index$1 = require('./fthry_index.DIcj_VUJ.js');
4
4
  var React = require('react');
5
5
  var clsx = require('./fthry_clsx.BtxeOLZW.js');
6
6
  var ReactJSXRuntime = require('react/jsx-runtime');
7
7
  var ReactDOM = require('react-dom');
8
- var index$2 = require('./fthry_index.CaUi4jbg.js');
8
+ var index$2 = require('./fthry_index.C0n-WuVc.js');
9
9
 
10
10
  // src/errors/ai-sdk-error.ts
11
11
  var marker = "vercel.ai.error";
@@ -9933,10 +9933,10 @@ var VoiceMic = /** @class */ (function () {
9933
9933
  switch (_d.label) {
9934
9934
  case 0:
9935
9935
  _d.trys.push([0, 4, , 5]);
9936
- return [4 /*yield*/, Promise.resolve().then(function () { return require('./fthry_index.DtLwdWxZ.js'); }).then(function (n) { return n.index; })];
9936
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./fthry_index.C-Tcdfmc.js'); }).then(function (n) { return n.index; })];
9937
9937
  case 1:
9938
9938
  _a = _d.sent(), MicVAD_1 = _a.MicVAD, vadUtils_1 = _a.utils;
9939
- return [4 /*yield*/, Promise.resolve().then(function () { return require('./fthry_logging.geKUVlWF.js'); }).then(function (n) { return n.logging; })];
9939
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./fthry_logging.Ddacrn6B.js'); }).then(function (n) { return n.logging; })];
9940
9940
  case 2:
9941
9941
  vadLog = (_d.sent()).log;
9942
9942
  vadLog.debug = function () { return undefined; };
@@ -10257,6 +10257,10 @@ var TOOL_LABELS = {
10257
10257
  running: 'Running form action...',
10258
10258
  done: 'Ran the form action'
10259
10259
  },
10260
+ navigateToStep: {
10261
+ running: 'Moving to another page...',
10262
+ done: 'Moved to another page'
10263
+ },
10260
10264
  addTableRow: {
10261
10265
  running: 'Adding a row...',
10262
10266
  done: 'Added a row'
@@ -10285,18 +10289,10 @@ var TOOL_LABELS = {
10285
10289
  running: 'Reading extraction results...',
10286
10290
  done: 'Reviewed the extraction results'
10287
10291
  },
10288
- listFormExtractions: {
10289
- running: 'Looking up extractions...',
10290
- done: 'Reviewed available extractions'
10291
- },
10292
10292
  getLogicRules: {
10293
10293
  running: 'Reading form logic...',
10294
10294
  done: 'Reviewed form logic'
10295
10295
  },
10296
- listFormHubs: {
10297
- running: 'Looking up records on file...',
10298
- done: 'Reviewed available records'
10299
- },
10300
10296
  getHubSchema: {
10301
10297
  running: 'Reading record setup...',
10302
10298
  done: 'Reviewed the record setup'
@@ -51744,14 +51740,14 @@ ${e}</tr>
51744
51740
  Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+T(n.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var L$1=new D;function g(u,e){return L$1.parse(u,e)}g.options=g.setOptions=function(u){return L$1.setOptions(u),g.defaults=L$1.defaults,G(g.defaults),g};g.getDefaults=M;g.defaults=O;g.use=function(...u){return L$1.use(...u),g.defaults=L$1.defaults,G(g.defaults),g};g.walkTokens=function(u,e){return L$1.walkTokens(u,e)};g.parseInline=L$1.parseInline;g.Parser=b;g.parser=b.parse;g.Renderer=y$1;g.TextRenderer=$;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=w;g.Hooks=P;g.parse=g;g.options;g.setOptions;g.use;g.walkTokens;g.parseInline;b.parse;x.lex;
51745
51741
 
51746
51742
  var En=300,Hn="300px",Dn=500;function Lt(e={}){let{immediate:t=false,debounceDelay:o=En,rootMargin:n=Hn,idleTimeout:r=Dn}=e,[s,a]=React.useState(false),l=React.useRef(null),i=React.useRef(null),c=React.useRef(null),d=React.useMemo(()=>p=>{let g=Date.now();return window.setTimeout(()=>{p({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-g))});},1)},[]),u=React.useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(p,g)=>window.requestIdleCallback(p,g):d,[d]),m=React.useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?p=>window.cancelIdleCallback(p):p=>{clearTimeout(p);},[]);return React.useEffect(()=>{if(t){a(true);return}let p=l.current;if(!p)return;i.current&&(clearTimeout(i.current),i.current=null),c.current&&(m(c.current),c.current=null);let g=()=>{i.current&&(clearTimeout(i.current),i.current=null),c.current&&(m(c.current),c.current=null);},h=x=>{c.current=u(w=>{w.timeRemaining()>0||w.didTimeout?(a(true),x.disconnect()):c.current=u(()=>{a(true),x.disconnect();},{timeout:r/2});},{timeout:r});},b=x=>{g(),i.current=window.setTimeout(()=>{var I,H;let w=x.takeRecords();(w.length===0||(H=(I=w.at(-1))==null?void 0:I.isIntersecting)!=null&&H)&&h(x);},o);},f=(x,w)=>{x.isIntersecting?b(w):g();},T=new IntersectionObserver(x=>{for(let w of x)f(w,T);},{rootMargin:n,threshold:0});return T.observe(p),()=>{i.current&&clearTimeout(i.current),c.current&&m(c.current),T.disconnect();}},[t,o,n,r,m,u]),{shouldRender:s,containerRef:l}}var Rt=/\s/,On=/^\s+$/,Vn=new Set(["code","pre","svg","math","annotation"]),jn=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",Fn=e=>e.some(t=>jn(t)&&Vn.has(t.tagName)),zn=e=>{let t=[],o="",n=false;for(let r of e){let s=Rt.test(r);s!==n&&o&&(t.push(o),o=""),o+=r,n=s;}return o&&t.push(o),t},_n=e=>{let t=[],o="";for(let n of e)Rt.test(n)?o+=n:(o&&(t.push(o),o=""),t.push(n));return o&&t.push(o),t},qn=(e,t,o,n,r)=>({type:"element",tagName:"span",properties:{"data-sd-animate":true,style:r?`--sd-animation:sd-${t};--sd-duration:0ms;--sd-easing:${n}`:`--sd-animation:sd-${t};--sd-duration:${o}ms;--sd-easing:${n}`},children:[{type:"text",value:e}]}),$n=(e,t,o,n,r)=>{let s=t.at(-1);if(!(s&&"children"in s))return;if(Fn(t))return SKIP;let a=s,l=a.children.indexOf(e);if(l===-1)return;let i=e.value;if(!i.trim()){r.count+=i.length;return}let c=o.sep==="char"?_n(i):zn(i),d=n.prevContentLength,u=c.map(m=>{let p=r.count;if(r.count+=m.length,On.test(m))return {type:"text",value:m};let g=d>0&&p<d;return qn(m,o.animation,o.duration,o.easing,g)});return a.children.splice(l,1,...u),l+u.length},Wn=0;function be(e){var s,a,l,i;let t={animation:(s=e==null?void 0:e.animation)!=null?s:"fadeIn",duration:(a=e==null?void 0:e.duration)!=null?a:150,easing:(l=e==null?void 0:e.easing)!=null?l:"ease",sep:(i=e==null?void 0:e.sep)!=null?i:"word"},o={prevContentLength:0,lastRenderCharCount:0},n=Wn++,r=()=>c=>{let d={count:0};visitParents(c,"text",(u,m)=>$n(u,m,t,o,d)),o.lastRenderCharCount=d.count,o.prevContentLength=0;};return Object.defineProperty(r,"name",{value:`rehypeAnimate$${n}`}),{name:"animate",type:"animate",rehypePlugin:r,setPrevContentLength(c){o.prevContentLength=c;},getLastRenderCharCount(){let c=o.lastRenderCharCount;return o.lastRenderCharCount=0,c}}}be();var Qe=React.createContext(false),et=()=>React.useContext(Qe);var he=(...e)=>twMerge(clsx.clsx(e)),Jn=(e,t)=>{if(!e||!t)return t;let o=`${e}:`;return t.split(/\s+/).filter(Boolean).map(n=>n.startsWith(o)?n:`${e}:${n}`).join(" ")},Ht=e=>e?(...t)=>Jn(e,twMerge(clsx.clsx(t))):he,J=(e,t,o)=>{let n=typeof t=="string"?new Blob([t],{type:o}):t,r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r);};var Se=React.createContext(he),y=()=>React.useContext(Se);var Yn=he("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),Qn=e=>{let t={};for(let o of e.split(";")){let n=o.indexOf(":");if(n>0){let r=o.slice(0,n).trim(),s=o.slice(n+1).trim();r&&s&&(t[r]=s);}}return t},Bt=React.memo(({children:e,result:t,language:o,className:n,startLine:r,...s})=>{let a=y(),l=React.useMemo(()=>a(Yn),[a]),i=React.useMemo(()=>{let c={};return t.bg&&(c["--sdm-bg"]=t.bg),t.fg&&(c["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(c,Qn(t.rootStyle)),c},[t.bg,t.fg,t.rootStyle]);return ReactJSXRuntime.jsx("div",{className:a(n,"overflow-hidden rounded-md border border-border bg-background p-4 text-sm"),"data-language":o,"data-streamdown":"code-block-body",...s,children:ReactJSXRuntime.jsx("pre",{className:a(n,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:i,children:ReactJSXRuntime.jsx("code",{className:a("[counter-increment:line_0] [counter-reset:line]"),style:r&&r>1?{counterReset:`line ${r-1}`}:void 0,children:t.tokens.map((c,d)=>ReactJSXRuntime.jsx("span",{className:l,children:c.length===0||c.length===1&&c[0].content===""?`
51747
- `:c.map((u,m)=>{let p={},g=!!u.bgColor;if(u.color&&(p["--sdm-c"]=u.color),u.bgColor&&(p["--sdm-tbg"]=u.bgColor),u.htmlStyle)for(let[h,b]of Object.entries(u.htmlStyle))h==="color"?p["--sdm-c"]=b:h==="background-color"?(p["--sdm-tbg"]=b,g=true):p[h]=b;return ReactJSXRuntime.jsx("span",{className:a("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",g&&"bg-[var(--sdm-tbg)]",g&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:p,...u.htmlAttrs,children:u.content},m)})},d))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine);var tt=({className:e,language:t,style:o,isIncomplete:n,...r})=>{let s=y();return ReactJSXRuntime.jsx("div",{className:s("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...o},...r})};var ot=React.createContext({code:""}),Ee=()=>React.useContext(ot);var nt=({language:e})=>{let t=y();return ReactJSXRuntime.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:ReactJSXRuntime.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})};var sr=/\n+$/,ar=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_highlighted-body-TPN3WLV5.Cbq0oozC.js'); }).then(e=>({default:e.HighlightedCodeBlockBody}))),rt=({code:e,language:t,className:o,children:n,isIncomplete:r=false,startLine:s,...a})=>{let l=y(),i=React.useMemo(()=>e.replace(sr,""),[e]),c=React.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:i.split(`
51743
+ `:c.map((u,m)=>{let p={},g=!!u.bgColor;if(u.color&&(p["--sdm-c"]=u.color),u.bgColor&&(p["--sdm-tbg"]=u.bgColor),u.htmlStyle)for(let[h,b]of Object.entries(u.htmlStyle))h==="color"?p["--sdm-c"]=b:h==="background-color"?(p["--sdm-tbg"]=b,g=true):p[h]=b;return ReactJSXRuntime.jsx("span",{className:a("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",g&&"bg-[var(--sdm-tbg)]",g&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:p,...u.htmlAttrs,children:u.content},m)})},d))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine);var tt=({className:e,language:t,style:o,isIncomplete:n,...r})=>{let s=y();return ReactJSXRuntime.jsx("div",{className:s("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...o},...r})};var ot=React.createContext({code:""}),Ee=()=>React.useContext(ot);var nt=({language:e})=>{let t=y();return ReactJSXRuntime.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:ReactJSXRuntime.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})};var sr=/\n+$/,ar=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_highlighted-body-TPN3WLV5.D0_x3Hnh.js'); }).then(e=>({default:e.HighlightedCodeBlockBody}))),rt=({code:e,language:t,className:o,children:n,isIncomplete:r=false,startLine:s,...a})=>{let l=y(),i=React.useMemo(()=>e.replace(sr,""),[e]),c=React.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:i.split(`
51748
51744
  `).map(d=>[{content:d,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[i]);return ReactJSXRuntime.jsx(ot.Provider,{value:{code:e},children:ReactJSXRuntime.jsxs(tt,{isIncomplete:r,language:t,children:[ReactJSXRuntime.jsx(nt,{language:t}),n?ReactJSXRuntime.jsx("div",{className:l("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ReactJSXRuntime.jsx("div",{className:l("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:n})}):null,ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Bt,{className:o,language:t,result:c,startLine:s,...a}),children:ReactJSXRuntime.jsx(ar,{className:o,code:i,language:t,raw:c,startLine:s,...a})})]})})};var Vt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),jt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),Ft=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),zt=e=>ReactJSXRuntime.jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[ReactJSXRuntime.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),_t=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),qt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),$t=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),Wt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),Zt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),Xt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})});var we={CheckIcon:Vt,CopyIcon:jt,DownloadIcon:Ft,ExternalLinkIcon:Wt,Loader2Icon:zt,Maximize2Icon:_t,RotateCcwIcon:qt,XIcon:$t,ZoomInIcon:Zt,ZoomOutIcon:Xt},Kt=React.createContext(we),mr=(e,t)=>{if(e===t)return true;if(!(e&&t))return e===t;let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?false:o.every(r=>e[r]===t[r])},st=({icons:e,children:t})=>{let o=React.useRef(e),n=React.useRef(e?{...we,...e}:we);mr(o.current,e)||(o.current=e,n.current=e?{...we,...e}:we);let r=n.current;return ReactJSXRuntime.jsx(Kt.Provider,{value:r,children:t})},L=()=>React.useContext(Kt);var He={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},De=React.createContext(He),B=()=>React.useContext(De);var Be=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:r,code:s,...a})=>{let l=y(),[i,c]=React.useState(false),d=React.useRef(0),{code:u}=Ee(),{isAnimating:m}=React.useContext(R),p=B(),g=s!=null?s:u,h=async()=>{var T;if(typeof window=="undefined"||!((T=navigator==null?void 0:navigator.clipboard)!=null&&T.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(g),c(!0),e==null||e(),d.current=window.setTimeout(()=>c(!1),o));}catch(x){t==null||t(x);}};React.useEffect(()=>()=>{window.clearTimeout(d.current);},[]);let b=L(),f=i?b.CheckIcon:b.CopyIcon;return ReactJSXRuntime.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:m,onClick:h,title:p.copyCode,type:"button",...a,children:n!=null?n:ReactJSXRuntime.jsx(f,{size:14})})};var Gt={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},at=({onDownload:e,onError:t,language:o,children:n,className:r,code:s,...a})=>{let l=y(),{code:i}=Ee(),{isAnimating:c}=React.useContext(R),d=B(),u=L(),m=s!=null?s:i,g=`file.${o&&o in Gt?Gt[o]:"txt"}`,h="text/plain",b=()=>{try{J(g,m,h),e==null||e();}catch(f){t==null||t(f);}};return ReactJSXRuntime.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:c,onClick:b,title:d.downloadFile,type:"button",...a,children:n!=null?n:ReactJSXRuntime.jsx(u.DownloadIcon,{size:14})})};var Ae=()=>{let{Loader2Icon:e}=L(),t=y();return ReactJSXRuntime.jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[ReactJSXRuntime.jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),ReactJSXRuntime.jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:ReactJSXRuntime.jsx(e,{className:t("size-4 animate-spin")})})]})};var xr=/\.[^/.]+$/,to=({node:e,className:t,src:o,alt:n,onLoad:r,onError:s,...a})=>{let{DownloadIcon:l}=L(),i=y(),c=React.useRef(null),[d,u]=React.useState(false),[m,p]=React.useState(false),g=B(),h=a.width!=null||a.height!=null,b=(d||h)&&!m,f=m&&!h;React.useEffect(()=>{let k=c.current;if(k!=null&&k.complete){let I=k.naturalWidth>0;u(I),p(!I);}},[]);let T=React.useCallback(k=>{u(true),p(false),r==null||r(k);},[r]),x=React.useCallback(k=>{u(false),p(true),s==null||s(k);},[s]),w=async()=>{if(o)try{let I=await(await fetch(o)).blob(),S=new URL(o,window.location.origin).pathname.split("/").pop()||"",F=S.split(".").pop(),z=S.includes(".")&&F!==void 0&&F.length<=4,q="";if(z)q=S;else {let A=I.type,K="png";A.includes("jpeg")||A.includes("jpg")?K="jpg":A.includes("png")?K="png":A.includes("svg")?K="svg":A.includes("gif")?K="gif":A.includes("webp")&&(K="webp"),q=`${(n||S||"image").replace(xr,"")}.${K}`;}J(q,I,I.type);}catch(k){window.open(o,"_blank");}};return o?ReactJSXRuntime.jsxs("div",{className:i("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[ReactJSXRuntime.jsx("img",{alt:n,className:i("max-w-full rounded-lg",f&&"hidden",t),"data-streamdown":"image",onError:x,onLoad:T,ref:c,src:o,...a}),f&&ReactJSXRuntime.jsx("span",{className:i("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:g.imageNotAvailable}),ReactJSXRuntime.jsx("div",{className:i("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block")}),b&&ReactJSXRuntime.jsx("button",{className:i("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:w,title:g.downloadImage,type:"button",children:ReactJSXRuntime.jsx(l,{size:14})})]}):null};var ke=0,le=()=>{ke+=1,ke===1&&(document.body.style.overflow="hidden");},ce=()=>{ke=Math.max(0,ke-1),ke===0&&(document.body.style.overflow="");};var ro=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let{CheckIcon:r,CopyIcon:s,ExternalLinkIcon:a,XIcon:l}=L(),i=y(),[c,d]=React.useState(false),u=B(),m=React.useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3);}catch(g){}},[e]),p=React.useCallback(()=>{n(),o();},[n,o]);return React.useEffect(()=>{if(t){le();let g=h=>{h.key==="Escape"&&o();};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),ce();}}},[t,o]),t?ReactJSXRuntime.jsx("div",{className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:o,onKeyDown:g=>{g.key==="Escape"&&o();},role:"button",tabIndex:0,children:ReactJSXRuntime.jsxs("div",{className:i("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),role:"presentation",children:[ReactJSXRuntime.jsx("button",{className:i("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:o,title:u.close,type:"button",children:ReactJSXRuntime.jsx(l,{size:16})}),ReactJSXRuntime.jsxs("div",{className:i("flex flex-col gap-2"),children:[ReactJSXRuntime.jsxs("div",{className:i("flex items-center gap-2 font-semibold text-lg"),children:[ReactJSXRuntime.jsx(a,{size:20}),ReactJSXRuntime.jsx("span",{children:u.openExternalLink})]}),ReactJSXRuntime.jsx("p",{className:i("text-muted-foreground text-sm"),children:u.externalLinkWarning})]}),ReactJSXRuntime.jsx("div",{className:i("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),ReactJSXRuntime.jsxs("div",{className:i("flex gap-2"),children:[ReactJSXRuntime.jsx("button",{className:i("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:m,type:"button",children:c?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx(r,{size:14}),ReactJSXRuntime.jsx("span",{children:u.copied})]}):ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx(s,{size:14}),ReactJSXRuntime.jsx("span",{children:u.copyLink})]})}),ReactJSXRuntime.jsxs("button",{className:i("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:p,type:"button",children:[ReactJSXRuntime.jsx(a,{size:14}),ReactJSXRuntime.jsx("span",{children:u.openLink})]})]})]})}):null};var Oe=React.createContext(null),lt=()=>React.useContext(Oe),Mi=()=>{var t;let e=lt();return (t=e==null?void 0:e.code)!=null?t:null},de=()=>{var t;let e=lt();return (t=e==null?void 0:e.mermaid)!=null?t:null};var so=e=>{var o;let t=lt();return t!=null&&t.renderers&&e&&(o=t.renderers.find(n=>Array.isArray(n.language)?n.language.includes(e):n.language===e))!=null?o:null};var ao=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((r,s)=>{let a="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),l=new Image;l.crossOrigin="anonymous",l.onload=()=>{let i=document.createElement("canvas"),c=l.width*o,d=l.height*o;i.width=c,i.height=d;let u=i.getContext("2d");if(!u){s(new Error("Failed to create 2D canvas context for PNG export"));return}u.drawImage(l,0,0,c,d),i.toBlob(m=>{if(!m){s(new Error("Failed to create PNG blob"));return}r(m);},"image/png");},l.onerror=()=>s(new Error("Failed to load SVG image")),l.src=a;})};var lo=({chart:e,children:t,className:o,onDownload:n,config:r,onError:s})=>{let a=y(),[l,i]=React.useState(false),c=React.useRef(null),{isAnimating:d}=React.useContext(R),u=L(),m=de(),p=B(),g=async h=>{try{if(h==="mmd"){J("diagram.mmd",e,"text/plain"),i(!1),n==null||n(h);return}if(!m){s==null||s(new Error("Mermaid plugin not available"));return}let b=m.getMermaid(r),f=e.split("").reduce((w,k)=>(w<<5)-w+k.charCodeAt(0)|0,0),T=`mermaid-${Math.abs(f)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:x}=await b.render(T,e);if(!x){s==null||s(new Error("SVG not found. Please wait for the diagram to render."));return}if(h==="svg"){J("diagram.svg",x,"image/svg+xml"),i(!1),n==null||n(h);return}if(h==="png"){let w=await ao(x);J("diagram.png",w,"image/png"),n==null||n(h),i(!1);return}}catch(b){s==null||s(b);}};return React.useEffect(()=>{let h=b=>{let f=b.composedPath();c.current&&!f.includes(c.current)&&i(false);};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[]),ReactJSXRuntime.jsxs("div",{className:a("relative"),ref:c,children:[ReactJSXRuntime.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:d,onClick:()=>i(!l),title:p.downloadDiagram,type:"button",children:t!=null?t:ReactJSXRuntime.jsx(u.DownloadIcon,{size:14})}),l?ReactJSXRuntime.jsxs("div",{className:a("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("svg"),title:p.downloadDiagramAsSvg,type:"button",children:p.mermaidFormatSvg}),ReactJSXRuntime.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("png"),title:p.downloadDiagramAsPng,type:"button",children:p.mermaidFormatPng}),ReactJSXRuntime.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("mmd"),title:p.downloadDiagramAsMmd,type:"button",children:p.mermaidFormatMmd})]}):null]})};var po=({chart:e,config:t,onFullscreen:o,onExit:n,className:r,...s})=>{let{Maximize2Icon:a,XIcon:l}=L(),i=y(),[c,d]=React.useState(false),{isAnimating:u,controls:m}=React.useContext(R),p=B(),g=(()=>{if(typeof m=="boolean")return m;let b=m.mermaid;return b===false?false:b===true||b===void 0?true:b.panZoom!==false})(),h=()=>{d(!c);};return React.useEffect(()=>{if(c){le();let b=f=>{f.key==="Escape"&&d(false);};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),ce();}}},[c]),React.useEffect(()=>{c?o==null||o():n&&n();},[c,o,n]),ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:u,onClick:h,title:p.viewFullscreen,type:"button",...s,children:ReactJSXRuntime.jsx(a,{size:14})}),c?ReactDOM.createPortal(ReactJSXRuntime.jsxs("div",{className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),onClick:h,onKeyDown:b=>{b.key==="Escape"&&h();},role:"button",tabIndex:0,children:[ReactJSXRuntime.jsx("button",{className:i("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:h,title:p.exitFullscreen,type:"button",children:ReactJSXRuntime.jsx(l,{size:20})}),ReactJSXRuntime.jsx("div",{className:i("flex size-full items-center justify-center p-4"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:ReactJSXRuntime.jsx(uo,{chart:e,className:i("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:true,showControls:g})})]}),document.body):null]})};var ue=e=>{var s,a;let t=[],o=[],n=e.querySelectorAll("thead th");for(let l of n)t.push(((s=l.textContent)==null?void 0:s.trim())||"");let r=e.querySelectorAll("tbody tr");for(let l of r){let i=[],c=l.querySelectorAll("td");for(let d of c)i.push(((a=d.textContent)==null?void 0:a.trim())||"");o.push(i);}return {headers:t,rows:o}},oe=e=>{let{headers:t,rows:o}=e,n=l=>{let i=false,c=false;for(let d of l){if(d==='"'){i=true,c=true;break}(d===","||d===`
51749
51745
  `)&&(i=true);}return i?c?`"${l.replace(/"/g,'""')}"`:`"${l}"`:l},r=t.length>0?o.length+1:o.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(n).join(","),a+=1);for(let l of o)s[a]=l.map(n).join(","),a+=1;return s.join(`
51750
51746
  `)},ct=e=>{let{headers:t,rows:o}=e,n=l=>{let i=false;for(let d of l)if(d===" "||d===`
51751
51747
  `||d==="\r"){i=true;break}if(!i)return l;let c=[];for(let d of l)d===" "?c.push("\\t"):d===`
51752
51748
  `?c.push("\\n"):d==="\r"?c.push("\\r"):c.push(d);return c.join("")},r=t.length>0?o.length+1:o.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(n).join(" "),a+=1);for(let l of o)s[a]=l.map(n).join(" "),a+=1;return s.join(`
51753
51749
  `)},Ve=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):o.push(n);return o.join("")},ne=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),r=0,s=t.map(l=>Ve(l));n[r]=`| ${s.join(" | ")} |`,r+=1;let a=new Array(t.length);for(let l=0;l<t.length;l+=1)a[l]="---";n[r]=`| ${a.join(" | ")} |`,r+=1;for(let l of o)if(l.length<t.length){let i=new Array(t.length);for(let c=0;c<t.length;c+=1)i[c]=c<l.length?Ve(l[c]):"";n[r]=`| ${i.join(" | ")} |`,r+=1;}else {let i=l.map(c=>Ve(c));n[r]=`| ${i.join(" | ")} |`,r+=1;}return n.join(`
51754
- `)};var Te=({children:e,className:t,onCopy:o,onError:n,timeout:r=2e3})=>{let s=y(),[a,l]=React.useState(false),[i,c]=React.useState(false),d=React.useRef(null),u=React.useRef(0),{isAnimating:m}=React.useContext(R),p=B(),g=async f=>{var T,x;if(typeof window=="undefined"||!((T=navigator==null?void 0:navigator.clipboard)!=null&&T.write)){n==null||n(new Error("Clipboard API not available"));return}try{let w=(x=d.current)==null?void 0:x.closest('[data-streamdown="table-wrapper"]'),k=w==null?void 0:w.querySelector("table");if(!k){n==null||n(new Error("Table not found"));return}let I=ue(k),F=({csv:oe,tsv:ct,md:ne}[f]||ne)(I),z=new ClipboardItem({"text/plain":new Blob([F],{type:"text/plain"}),"text/html":new Blob([k.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),c(!0),l(!1),o==null||o(f),u.current=window.setTimeout(()=>c(!1),r);}catch(w){n==null||n(w);}};React.useEffect(()=>{let f=T=>{let x=T.composedPath();d.current&&!x.includes(d.current)&&l(false);};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f),window.clearTimeout(u.current);}},[]);let h=L(),b=i?h.CheckIcon:h.CopyIcon;return ReactJSXRuntime.jsxs("div",{className:s("relative"),ref:d,children:[ReactJSXRuntime.jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:m,onClick:()=>l(!a),title:p.copyTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(b,{height:14,width:14})}),a?ReactJSXRuntime.jsxs("div",{className:s("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("md"),title:p.copyTableAsMarkdown,type:"button",children:p.tableFormatMarkdown}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:p.copyTableAsCsv,type:"button",children:p.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("tsv"),title:p.copyTableAsTsv,type:"button",children:p.tableFormatTsv})]}):null]})};var Pe=({children:e,className:t,onDownload:o,onError:n})=>{let r=y(),[s,a]=React.useState(false),l=React.useRef(null),{isAnimating:i}=React.useContext(R),c=B(),d=L(),u=m=>{var p;try{let g=(p=l.current)==null?void 0:p.closest('[data-streamdown="table-wrapper"]'),h=g==null?void 0:g.querySelector("table");if(!h){n==null||n(new Error("Table not found"));return}let b=ue(h),f=m==="csv"?oe(b):ne(b);J(`table.${m==="csv"?"csv":"md"}`,f,m==="csv"?"text/csv":"text/markdown"),a(!1),o==null||o(m);}catch(g){n==null||n(g);}};return React.useEffect(()=>{let m=p=>{let g=p.composedPath();l.current&&!g.includes(l.current)&&a(false);};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[]),ReactJSXRuntime.jsxs("div",{className:r("relative"),ref:l,children:[ReactJSXRuntime.jsx("button",{className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>a(!s),title:c.downloadTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(d.DownloadIcon,{size:14})}),s?ReactJSXRuntime.jsxs("div",{className:r("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("csv"),title:c.downloadTableAsCsv,type:"button",children:c.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("markdown"),title:c.downloadTableAsMarkdown,type:"button",children:c.tableFormatMarkdown})]}):null]})};var wo=({children:e,className:t,showCopy:o=true,showDownload:n=true})=>{let{Maximize2Icon:r,XIcon:s}=L(),a=y(),[l,i]=React.useState(false),{isAnimating:c}=React.useContext(R),d=B(),u=()=>{i(true);},m=()=>{i(false);};return React.useEffect(()=>{if(l){le();let p=g=>{g.key==="Escape"&&i(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),ce();}}},[l]),ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:u,title:d.viewFullscreen,type:"button",children:ReactJSXRuntime.jsx(r,{size:14})}),l?ReactDOM.createPortal(ReactJSXRuntime.jsx("div",{"aria-label":d.viewFullscreen,"aria-modal":"true",className:a("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:m,onKeyDown:p=>{p.key==="Escape"&&m();},role:"dialog",children:ReactJSXRuntime.jsxs("div",{className:a("flex h-full flex-col"),onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:[ReactJSXRuntime.jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[o?ReactJSXRuntime.jsx(Te,{}):null,n?ReactJSXRuntime.jsx(Pe,{}):null,ReactJSXRuntime.jsx("button",{className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:m,title:d.exitFullscreen,type:"button",children:ReactJSXRuntime.jsx(s,{size:20})})]}),ReactJSXRuntime.jsx("div",{className:a("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:ReactJSXRuntime.jsx("table",{className:a("w-full border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})};var ko=({children:e,className:t,showControls:o,showCopy:n=true,showDownload:r=true,showFullscreen:s=true,...a})=>{let l=y(),i=o&&n,c=o&&r,d=o&&s,u=i||c||d;return ReactJSXRuntime.jsxs("div",{className:l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[u?ReactJSXRuntime.jsxs("div",{className:l("flex items-center justify-end gap-1"),children:[i?ReactJSXRuntime.jsx(Te,{}):null,c?ReactJSXRuntime.jsx(Pe,{}):null,d?ReactJSXRuntime.jsx(wo,{showCopy:i,showDownload:c,children:e}):null]}):null,ReactJSXRuntime.jsx("div",{className:l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx("table",{className:l("w-full divide-y divide-border",t),"data-streamdown":"table",...a,children:e})})]})};var Gr=/startLine=(\d+)/,Yr=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_mermaid-O7DHMXV3.CmGxXRTE.js'); }).then(e=>({default:e.Mermaid}))),Qr=/language-([^\s]+)/;function _e(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,r=e.position.end,s=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(r==null?void 0:r.line)===(s==null?void 0:s.line)&&(r==null?void 0:r.column)===(s==null?void 0:s.column)}function E(e,t){return e.className===t.className&&_e(e.node,t.node)}var pt=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ut=(e,t)=>{if(typeof e=="boolean")return e;let o=e.table;return o===false?false:o===true||o===void 0?true:o[t]!==false},xo=(e,t)=>{if(typeof e=="boolean")return e;let o=e.code;return o===false?false:o===true||o===void 0?true:o[t]!==false},je=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},gt=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ol",{className:r("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e})},(e,t)=>E(e,t));gt.displayName="MarkdownOl";var To=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("li",{className:r("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e})},(e,t)=>e.className===t.className&&_e(e.node,t.node));To.displayName="MarkdownLi";var Po=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ul",{className:r("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e})},(e,t)=>E(e,t));Po.displayName="MarkdownUl";var Mo=React.memo(({className:e,node:t,...o})=>{let n=y();return ReactJSXRuntime.jsx("hr",{className:n("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o})},(e,t)=>E(e,t));Mo.displayName="MarkdownHr";var Io=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...n,children:e})},(e,t)=>E(e,t));Io.displayName="MarkdownStrong";var es=({children:e,className:t,href:o,node:n,...r})=>{let s=y(),{linkSafety:a}=React.useContext(R),[l,i]=React.useState(false),c=o==="streamdown:incomplete-link",d=React.useCallback(async g=>{if(!(!(a!=null&&a.enabled&&o)||c)){if(g.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[a,o,c]),u=React.useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),m=React.useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:l,onClose:m,onConfirm:u};return a!=null&&a.enabled&&o?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(p):ReactJSXRuntime.jsx(ro,{...p})]}):ReactJSXRuntime.jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...r,children:e})},No=React.memo(es,(e,t)=>E(e,t)&&e.href===t.href);No.displayName="MarkdownA";var Lo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e})},(e,t)=>E(e,t));Lo.displayName="MarkdownH1";var Ro=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e})},(e,t)=>E(e,t));Ro.displayName="MarkdownH2";var So=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e})},(e,t)=>E(e,t));So.displayName="MarkdownH3";var Eo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e})},(e,t)=>E(e,t));Eo.displayName="MarkdownH4";var Ho=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e})},(e,t)=>E(e,t));Ho.displayName="MarkdownH5";var Do=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e})},(e,t)=>E(e,t));Do.displayName="MarkdownH6";var Bo=React.memo(({children:e,className:t,node:o,...n})=>{let{controls:r}=React.useContext(R),s=pt(r,"table"),a=ut(r,"copy"),l=ut(r,"download"),i=ut(r,"fullscreen");return ReactJSXRuntime.jsx(ko,{className:t,showControls:s,showCopy:a,showDownload:l,showFullscreen:i,...n,children:e})},(e,t)=>E(e,t));Bo.displayName="MarkdownTable";var Ao=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e})},(e,t)=>E(e,t));Ao.displayName="MarkdownThead";var Oo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e})},(e,t)=>E(e,t));Oo.displayName="MarkdownTbody";var Vo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...n,children:e})},(e,t)=>E(e,t));Vo.displayName="MarkdownTr";var jo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("th",{className:r("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e})},(e,t)=>E(e,t));jo.displayName="MarkdownTh";var Fo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("td",{className:r("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e})},(e,t)=>E(e,t));Fo.displayName="MarkdownTd";var zo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e})},(e,t)=>E(e,t));zo.displayName="MarkdownBlockquote";var _o=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...n,children:e})},(e,t)=>E(e,t));_o.displayName="MarkdownSup";var qo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...n,children:e})},(e,t)=>E(e,t));qo.displayName="MarkdownSub";var $o=React.memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=i=>{var m,p;if(!React.isValidElement(i))return false;let c=Array.isArray(i.props.children)?i.props.children:[i.props.children],d=false,u=false;for(let g of c)if(g){if(typeof g=="string")g.trim()!==""&&(d=true);else if(React.isValidElement(g))if(((m=g.props)==null?void 0:m["data-footnote-backref"])!==void 0)u=true;else {let h=Array.isArray(g.props.children)?g.props.children:[g.props.children];for(let b of h){if(typeof b=="string"&&b.trim()!==""){d=true;break}if(React.isValidElement(b)&&((p=b.props)==null?void 0:p["data-footnote-backref"])===void 0){d=true;break}}}}return u&&!d},a=Array.isArray(e)?e.map(i=>{if(!React.isValidElement(i))return i;if(i.type===gt){let d=(Array.isArray(i.props.children)?i.props.children:[i.props.children]).filter(u=>!s(u));return d.length===0?null:{...i,props:{...i.props,children:d}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?ReactJSXRuntime.jsx("section",{className:t,...n,children:a}):null}return ReactJSXRuntime.jsx("section",{className:t,...n,children:e})},(e,t)=>E(e,t));$o.displayName="MarkdownSection";var ts=({node:e,className:t,children:o,...n})=>{var k,I;let r=y(),s=!("data-block"in n),{mermaid:a,controls:l}=React.useContext(R),i=de(),c=et(),d=t==null?void 0:t.match(Qr),u=(k=d==null?void 0:d.at(1))!=null?k:"",m=so(u);if(s)return ReactJSXRuntime.jsx("code",{className:r("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let p=(I=e==null?void 0:e.properties)==null?void 0:I.metastring,g=p==null?void 0:p.match(Gr),h=g?Number.parseInt(g[1],10):void 0,b=h!==void 0&&h>=1?h:void 0,f="";if(React.isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?f=o.props.children:typeof o=="string"&&(f=o),m){let H=m.component;return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsx(H,{code:f,isIncomplete:c,language:u})})}if(u==="mermaid"&&i){let H=pt(l,"mermaid"),S=je(l,"download"),F=je(l,"copy"),z=je(l,"fullscreen"),q=je(l,"panZoom"),A=H&&(S||F||z);return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsxs("div",{className:r("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-streamdown":"mermaid-block",children:[ReactJSXRuntime.jsx("div",{className:r("flex h-8 items-center text-muted-foreground text-xs"),children:ReactJSXRuntime.jsx("span",{className:r("ml-1 font-mono lowercase"),children:"mermaid"})}),A?ReactJSXRuntime.jsx("div",{className:r("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ReactJSXRuntime.jsxs("div",{className:r("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"mermaid-block-actions",children:[S?ReactJSXRuntime.jsx(lo,{chart:f,config:a==null?void 0:a.config}):null,F?ReactJSXRuntime.jsx(Be,{code:f}):null,z?ReactJSXRuntime.jsx(po,{chart:f,config:a==null?void 0:a.config}):null]})}):null,ReactJSXRuntime.jsx("div",{className:r("rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx(Yr,{chart:f,config:a==null?void 0:a.config,showControls:q})})]})})}let T=pt(l,"code"),x=xo(l,"download"),w=xo(l,"copy");return ReactJSXRuntime.jsx(rt,{className:t,code:f,isIncomplete:c,language:u,startLine:b,children:T?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[x?ReactJSXRuntime.jsx(at,{code:f,language:u}):null,w?ReactJSXRuntime.jsx(Be,{}):null]}):null})},Wo=React.memo(ts,(e,t)=>e.className===t.className&&_e(e.node,t.node));Wo.displayName="MarkdownCode";var Zo=React.memo(to,(e,t)=>e.className===t.className&&_e(e.node,t.node));Zo.displayName="MarkdownImg";var Xo=React.memo(({children:e,node:t,...o})=>{let r=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(r.length===1&&React.isValidElement(r[0])){let s=r[0].props.node,a=s==null?void 0:s.tagName;if(a==="img")return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e});if(a==="code"&&"data-block"in r[0].props)return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e})}return ReactJSXRuntime.jsx("p",{...o,children:e})},(e,t)=>E(e,t));Xo.displayName="MarkdownParagraph";var Jo={ol:gt,li:To,ul:Po,hr:Mo,strong:Io,a:No,h1:Lo,h2:Ro,h3:So,h4:Eo,h5:Ho,h6:Do,table:Bo,thead:Ao,tbody:Oo,tr:Vo,th:jo,td:Fo,blockquote:zo,code:Wo,img:Zo,pre:({children:e})=>React.isValidElement(e)?React.cloneElement(e,{"data-block":"true"}):e,sup:_o,sub:qo,p:Xo,section:$o};var os=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ns=/\p{L}/u;function qe(e){let t=e.replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,"");for(let o of t){if(os.test(o))return "rtl";if(ns.test(o))return "ltr"}return "ltr"}var rs=/^[ \t]{0,3}(`{3,}|~{3,})/,ss=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,bt=e=>{let t=e.split(`
51750
+ `)};var Te=({children:e,className:t,onCopy:o,onError:n,timeout:r=2e3})=>{let s=y(),[a,l]=React.useState(false),[i,c]=React.useState(false),d=React.useRef(null),u=React.useRef(0),{isAnimating:m}=React.useContext(R),p=B(),g=async f=>{var T,x;if(typeof window=="undefined"||!((T=navigator==null?void 0:navigator.clipboard)!=null&&T.write)){n==null||n(new Error("Clipboard API not available"));return}try{let w=(x=d.current)==null?void 0:x.closest('[data-streamdown="table-wrapper"]'),k=w==null?void 0:w.querySelector("table");if(!k){n==null||n(new Error("Table not found"));return}let I=ue(k),F=({csv:oe,tsv:ct,md:ne}[f]||ne)(I),z=new ClipboardItem({"text/plain":new Blob([F],{type:"text/plain"}),"text/html":new Blob([k.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),c(!0),l(!1),o==null||o(f),u.current=window.setTimeout(()=>c(!1),r);}catch(w){n==null||n(w);}};React.useEffect(()=>{let f=T=>{let x=T.composedPath();d.current&&!x.includes(d.current)&&l(false);};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f),window.clearTimeout(u.current);}},[]);let h=L(),b=i?h.CheckIcon:h.CopyIcon;return ReactJSXRuntime.jsxs("div",{className:s("relative"),ref:d,children:[ReactJSXRuntime.jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:m,onClick:()=>l(!a),title:p.copyTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(b,{height:14,width:14})}),a?ReactJSXRuntime.jsxs("div",{className:s("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("md"),title:p.copyTableAsMarkdown,type:"button",children:p.tableFormatMarkdown}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:p.copyTableAsCsv,type:"button",children:p.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("tsv"),title:p.copyTableAsTsv,type:"button",children:p.tableFormatTsv})]}):null]})};var Pe=({children:e,className:t,onDownload:o,onError:n})=>{let r=y(),[s,a]=React.useState(false),l=React.useRef(null),{isAnimating:i}=React.useContext(R),c=B(),d=L(),u=m=>{var p;try{let g=(p=l.current)==null?void 0:p.closest('[data-streamdown="table-wrapper"]'),h=g==null?void 0:g.querySelector("table");if(!h){n==null||n(new Error("Table not found"));return}let b=ue(h),f=m==="csv"?oe(b):ne(b);J(`table.${m==="csv"?"csv":"md"}`,f,m==="csv"?"text/csv":"text/markdown"),a(!1),o==null||o(m);}catch(g){n==null||n(g);}};return React.useEffect(()=>{let m=p=>{let g=p.composedPath();l.current&&!g.includes(l.current)&&a(false);};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[]),ReactJSXRuntime.jsxs("div",{className:r("relative"),ref:l,children:[ReactJSXRuntime.jsx("button",{className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>a(!s),title:c.downloadTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(d.DownloadIcon,{size:14})}),s?ReactJSXRuntime.jsxs("div",{className:r("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("csv"),title:c.downloadTableAsCsv,type:"button",children:c.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("markdown"),title:c.downloadTableAsMarkdown,type:"button",children:c.tableFormatMarkdown})]}):null]})};var wo=({children:e,className:t,showCopy:o=true,showDownload:n=true})=>{let{Maximize2Icon:r,XIcon:s}=L(),a=y(),[l,i]=React.useState(false),{isAnimating:c}=React.useContext(R),d=B(),u=()=>{i(true);},m=()=>{i(false);};return React.useEffect(()=>{if(l){le();let p=g=>{g.key==="Escape"&&i(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),ce();}}},[l]),ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:u,title:d.viewFullscreen,type:"button",children:ReactJSXRuntime.jsx(r,{size:14})}),l?ReactDOM.createPortal(ReactJSXRuntime.jsx("div",{"aria-label":d.viewFullscreen,"aria-modal":"true",className:a("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:m,onKeyDown:p=>{p.key==="Escape"&&m();},role:"dialog",children:ReactJSXRuntime.jsxs("div",{className:a("flex h-full flex-col"),onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:[ReactJSXRuntime.jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[o?ReactJSXRuntime.jsx(Te,{}):null,n?ReactJSXRuntime.jsx(Pe,{}):null,ReactJSXRuntime.jsx("button",{className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:m,title:d.exitFullscreen,type:"button",children:ReactJSXRuntime.jsx(s,{size:20})})]}),ReactJSXRuntime.jsx("div",{className:a("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:ReactJSXRuntime.jsx("table",{className:a("w-full border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})};var ko=({children:e,className:t,showControls:o,showCopy:n=true,showDownload:r=true,showFullscreen:s=true,...a})=>{let l=y(),i=o&&n,c=o&&r,d=o&&s,u=i||c||d;return ReactJSXRuntime.jsxs("div",{className:l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[u?ReactJSXRuntime.jsxs("div",{className:l("flex items-center justify-end gap-1"),children:[i?ReactJSXRuntime.jsx(Te,{}):null,c?ReactJSXRuntime.jsx(Pe,{}):null,d?ReactJSXRuntime.jsx(wo,{showCopy:i,showDownload:c,children:e}):null]}):null,ReactJSXRuntime.jsx("div",{className:l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx("table",{className:l("w-full divide-y divide-border",t),"data-streamdown":"table",...a,children:e})})]})};var Gr=/startLine=(\d+)/,Yr=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_mermaid-O7DHMXV3.Dj-pTS7i.js'); }).then(e=>({default:e.Mermaid}))),Qr=/language-([^\s]+)/;function _e(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,r=e.position.end,s=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(r==null?void 0:r.line)===(s==null?void 0:s.line)&&(r==null?void 0:r.column)===(s==null?void 0:s.column)}function E(e,t){return e.className===t.className&&_e(e.node,t.node)}var pt=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ut=(e,t)=>{if(typeof e=="boolean")return e;let o=e.table;return o===false?false:o===true||o===void 0?true:o[t]!==false},xo=(e,t)=>{if(typeof e=="boolean")return e;let o=e.code;return o===false?false:o===true||o===void 0?true:o[t]!==false},je=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},gt=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ol",{className:r("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e})},(e,t)=>E(e,t));gt.displayName="MarkdownOl";var To=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("li",{className:r("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e})},(e,t)=>e.className===t.className&&_e(e.node,t.node));To.displayName="MarkdownLi";var Po=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ul",{className:r("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e})},(e,t)=>E(e,t));Po.displayName="MarkdownUl";var Mo=React.memo(({className:e,node:t,...o})=>{let n=y();return ReactJSXRuntime.jsx("hr",{className:n("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o})},(e,t)=>E(e,t));Mo.displayName="MarkdownHr";var Io=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...n,children:e})},(e,t)=>E(e,t));Io.displayName="MarkdownStrong";var es=({children:e,className:t,href:o,node:n,...r})=>{let s=y(),{linkSafety:a}=React.useContext(R),[l,i]=React.useState(false),c=o==="streamdown:incomplete-link",d=React.useCallback(async g=>{if(!(!(a!=null&&a.enabled&&o)||c)){if(g.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[a,o,c]),u=React.useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),m=React.useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:l,onClose:m,onConfirm:u};return a!=null&&a.enabled&&o?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(p):ReactJSXRuntime.jsx(ro,{...p})]}):ReactJSXRuntime.jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...r,children:e})},No=React.memo(es,(e,t)=>E(e,t)&&e.href===t.href);No.displayName="MarkdownA";var Lo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e})},(e,t)=>E(e,t));Lo.displayName="MarkdownH1";var Ro=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e})},(e,t)=>E(e,t));Ro.displayName="MarkdownH2";var So=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e})},(e,t)=>E(e,t));So.displayName="MarkdownH3";var Eo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e})},(e,t)=>E(e,t));Eo.displayName="MarkdownH4";var Ho=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e})},(e,t)=>E(e,t));Ho.displayName="MarkdownH5";var Do=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e})},(e,t)=>E(e,t));Do.displayName="MarkdownH6";var Bo=React.memo(({children:e,className:t,node:o,...n})=>{let{controls:r}=React.useContext(R),s=pt(r,"table"),a=ut(r,"copy"),l=ut(r,"download"),i=ut(r,"fullscreen");return ReactJSXRuntime.jsx(ko,{className:t,showControls:s,showCopy:a,showDownload:l,showFullscreen:i,...n,children:e})},(e,t)=>E(e,t));Bo.displayName="MarkdownTable";var Ao=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e})},(e,t)=>E(e,t));Ao.displayName="MarkdownThead";var Oo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e})},(e,t)=>E(e,t));Oo.displayName="MarkdownTbody";var Vo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...n,children:e})},(e,t)=>E(e,t));Vo.displayName="MarkdownTr";var jo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("th",{className:r("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e})},(e,t)=>E(e,t));jo.displayName="MarkdownTh";var Fo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("td",{className:r("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e})},(e,t)=>E(e,t));Fo.displayName="MarkdownTd";var zo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e})},(e,t)=>E(e,t));zo.displayName="MarkdownBlockquote";var _o=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...n,children:e})},(e,t)=>E(e,t));_o.displayName="MarkdownSup";var qo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...n,children:e})},(e,t)=>E(e,t));qo.displayName="MarkdownSub";var $o=React.memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=i=>{var m,p;if(!React.isValidElement(i))return false;let c=Array.isArray(i.props.children)?i.props.children:[i.props.children],d=false,u=false;for(let g of c)if(g){if(typeof g=="string")g.trim()!==""&&(d=true);else if(React.isValidElement(g))if(((m=g.props)==null?void 0:m["data-footnote-backref"])!==void 0)u=true;else {let h=Array.isArray(g.props.children)?g.props.children:[g.props.children];for(let b of h){if(typeof b=="string"&&b.trim()!==""){d=true;break}if(React.isValidElement(b)&&((p=b.props)==null?void 0:p["data-footnote-backref"])===void 0){d=true;break}}}}return u&&!d},a=Array.isArray(e)?e.map(i=>{if(!React.isValidElement(i))return i;if(i.type===gt){let d=(Array.isArray(i.props.children)?i.props.children:[i.props.children]).filter(u=>!s(u));return d.length===0?null:{...i,props:{...i.props,children:d}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?ReactJSXRuntime.jsx("section",{className:t,...n,children:a}):null}return ReactJSXRuntime.jsx("section",{className:t,...n,children:e})},(e,t)=>E(e,t));$o.displayName="MarkdownSection";var ts=({node:e,className:t,children:o,...n})=>{var k,I;let r=y(),s=!("data-block"in n),{mermaid:a,controls:l}=React.useContext(R),i=de(),c=et(),d=t==null?void 0:t.match(Qr),u=(k=d==null?void 0:d.at(1))!=null?k:"",m=so(u);if(s)return ReactJSXRuntime.jsx("code",{className:r("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let p=(I=e==null?void 0:e.properties)==null?void 0:I.metastring,g=p==null?void 0:p.match(Gr),h=g?Number.parseInt(g[1],10):void 0,b=h!==void 0&&h>=1?h:void 0,f="";if(React.isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?f=o.props.children:typeof o=="string"&&(f=o),m){let H=m.component;return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsx(H,{code:f,isIncomplete:c,language:u})})}if(u==="mermaid"&&i){let H=pt(l,"mermaid"),S=je(l,"download"),F=je(l,"copy"),z=je(l,"fullscreen"),q=je(l,"panZoom"),A=H&&(S||F||z);return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsxs("div",{className:r("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-streamdown":"mermaid-block",children:[ReactJSXRuntime.jsx("div",{className:r("flex h-8 items-center text-muted-foreground text-xs"),children:ReactJSXRuntime.jsx("span",{className:r("ml-1 font-mono lowercase"),children:"mermaid"})}),A?ReactJSXRuntime.jsx("div",{className:r("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ReactJSXRuntime.jsxs("div",{className:r("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"mermaid-block-actions",children:[S?ReactJSXRuntime.jsx(lo,{chart:f,config:a==null?void 0:a.config}):null,F?ReactJSXRuntime.jsx(Be,{code:f}):null,z?ReactJSXRuntime.jsx(po,{chart:f,config:a==null?void 0:a.config}):null]})}):null,ReactJSXRuntime.jsx("div",{className:r("rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx(Yr,{chart:f,config:a==null?void 0:a.config,showControls:q})})]})})}let T=pt(l,"code"),x=xo(l,"download"),w=xo(l,"copy");return ReactJSXRuntime.jsx(rt,{className:t,code:f,isIncomplete:c,language:u,startLine:b,children:T?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[x?ReactJSXRuntime.jsx(at,{code:f,language:u}):null,w?ReactJSXRuntime.jsx(Be,{}):null]}):null})},Wo=React.memo(ts,(e,t)=>e.className===t.className&&_e(e.node,t.node));Wo.displayName="MarkdownCode";var Zo=React.memo(to,(e,t)=>e.className===t.className&&_e(e.node,t.node));Zo.displayName="MarkdownImg";var Xo=React.memo(({children:e,node:t,...o})=>{let r=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(r.length===1&&React.isValidElement(r[0])){let s=r[0].props.node,a=s==null?void 0:s.tagName;if(a==="img")return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e});if(a==="code"&&"data-block"in r[0].props)return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e})}return ReactJSXRuntime.jsx("p",{...o,children:e})},(e,t)=>E(e,t));Xo.displayName="MarkdownParagraph";var Jo={ol:gt,li:To,ul:Po,hr:Mo,strong:Io,a:No,h1:Lo,h2:Ro,h3:So,h4:Eo,h5:Ho,h6:Do,table:Bo,thead:Ao,tbody:Oo,tr:Vo,th:jo,td:Fo,blockquote:zo,code:Wo,img:Zo,pre:({children:e})=>React.isValidElement(e)?React.cloneElement(e,{"data-block":"true"}):e,sup:_o,sub:qo,p:Xo,section:$o};var os=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ns=/\p{L}/u;function qe(e){let t=e.replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,"");for(let o of t){if(os.test(o))return "rtl";if(ns.test(o))return "ltr"}return "ltr"}var rs=/^[ \t]{0,3}(`{3,}|~{3,})/,ss=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,bt=e=>{let t=e.split(`
51755
51751
  `),o=null,n=0;for(let r of t){let s=rs.exec(r);if(o===null){if(s){let a=s[1];o=a[0],n=a.length;}}else if(s){let a=s[1],l=a[0],i=a.length;l===o&&i>=n&&(o=null,n=0);}}return o!==null},Ko=e=>{let t=e.split(`
51756
51752
  `);for(let o of t){let n=o.trim();if(n.length>0&&n.includes("|")&&ss.test(n))return true}return false};var Uo=()=>e=>{visit(e,"html",(t,o,n)=>{!n||typeof o!="number"||(n.children[o]={type:"text",value:t.value});});};var Yo=[],Qo={allowDangerousHtml:true},$e=new WeakMap,yt=class{constructor(){this.cache=new Map;this.keyCache=new WeakMap;this.maxSize=100;}generateCacheKey(t){let o=this.keyCache.get(t);if(o)return o;let n=t.rehypePlugins,r=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(n||r||s)){let u="default";return this.keyCache.set(t,u),u}let a=u=>{if(!u||u.length===0)return "";let m="";for(let p=0;p<u.length;p+=1){let g=u[p];if(p>0&&(m+=","),Array.isArray(g)){let[h,b]=g;if(typeof h=="function"){let f=$e.get(h);f||(f=h.name,$e.set(h,f)),m+=f;}else m+=String(h);m+=":",m+=JSON.stringify(b);}else if(typeof g=="function"){let h=$e.get(g);h||(h=g.name,$e.set(g,h)),m+=h;}else m+=String(g);}return m},l=a(n),i=a(r),c=s?JSON.stringify(s):"",d=`${i}::${l}::${c}`;return this.keyCache.set(t,d),d}get(t){let o=this.generateCacheKey(t),n=this.cache.get(o);return n&&(this.cache.delete(o),this.cache.set(o,n)),n}set(t,o){let n=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r);}this.cache.set(n,o);}clear(){this.cache.clear();}},en=new yt,wt=e=>{let t=gs(e),o=e.children||"",n=t.runSync(t.parse(o),o);return ks(n,e)},gs=e=>{let t=en.get(e);if(t)return t;let o=hs(e);return en.set(e,o),o},bs=e=>e.some(t=>Array.isArray(t)?t[0]===rehypeRaw:t===rehypeRaw),hs=e=>{let t=e.rehypePlugins||Yo,o=e.remarkPlugins||Yo,n=bs(t)?o:[...o,Uo],r=e.remarkRehypeOptions?{...Qo,...e.remarkRehypeOptions}:Qo;return unified().use(remarkParse).use(n).use(remarkRehype,r).use(t)},tn=e=>e,ys=(e,t,o,n)=>{o?e.children.splice(t,1):e.children[t]={type:"text",value:n};},ws=(e,t)=>{var o;for(let n in urlAttributes)if(Object.hasOwn(urlAttributes,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],s=urlAttributes[n];(s===null||s.includes(e.tagName))&&(e.properties[n]=(o=t(String(r||""),n,e))!=null?o:void 0);}},Cs=(e,t,o,n,r,s)=>{let a=false;return n?a=!n.includes(e.tagName):r&&(a=r.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,o)),a},ks=(e,t)=>{let{allowElement:o,allowedElements:n,disallowedElements:r,skipHtml:s,unwrapDisallowed:a,urlTransform:l}=t;if(o||n||r||s||l){let c=l||tn;visit(e,(d,u,m)=>{if(d.type==="raw"&&m&&typeof u=="number")return ys(m,u,s,d.value),u;if(d.type==="element"&&(ws(d,c),Cs(d,u,m,n,r,o)&&m&&typeof u=="number"))return a&&d.children?m.children.splice(u,1,...d.children):m.children.splice(u,1),u});}return toJsxRuntime(e,{Fragment:ReactJSXRuntime.Fragment,components:t.components,ignoreInvalidStyle:true,jsx:ReactJSXRuntime.jsx,jsxs:ReactJSXRuntime.jsxs,passKeys:true,passNode:true})};var xs=/\[\^[\w-]{1,200}\](?!:)/,Ts=/\[\^[\w-]{1,200}\]:/;var Ps=/<(\w+)[\s>]/,Ms=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),on=new Map,nn=new Map,Is=e=>{let t=e.toLowerCase(),o=on.get(t);if(o)return o;let n=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return on.set(t,n),n},Ns=e=>{let t=e.toLowerCase(),o=nn.get(t);if(o)return o;let n=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return nn.set(t,n),n},rn=(e,t)=>{if(Ms.has(t.toLowerCase()))return 0;let o=e.match(Is(t));if(!o)return 0;let n=0;for(let r of o)r.trimEnd().endsWith("/>")||(n+=1);return n},sn=(e,t)=>{let o=e.match(Ns(t));return o?o.length:0},Ls=e=>{let t=0;for(let o=0;o<e.length-1;o+=1)e[o]==="$"&&e[o+1]==="$"&&(t+=1,o+=1);return t},Ct=e=>{let t=xs.test(e),o=Ts.test(e);if(t||o)return [e];let n=x.lex(e,{gfm:true}),r=[],s=[],a=false;for(let l of n){let i=l.raw,c=r.length;if(s.length>0){r[c-1]+=i;let d=s.at(-1),u=rn(i,d),m=sn(i,d);for(let p=0;p<u;p+=1)s.push(d);for(let p=0;p<m;p+=1)s.length>0&&s.at(-1)===d&&s.pop();continue}if(l.type==="html"&&l.block){let d=i.match(Ps);if(d){let u=d[1],m=rn(i,u),p=sn(i,u);m>p&&s.push(u);}}if(c>0&&!a){let d=r[c-1];if(Ls(d)%2===1){r[c-1]=d+i;continue}}r.push(i),l.type!=="space"&&(a=l.type==="code");}return r};var an=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let r=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(r,(s,a,l,i)=>{let c=l.replace(/\n\n/g,`
51757
51753
  <!---->
@@ -51849,6 +51845,7 @@ var deleteThread = function (baseUrl, headers, threadId) { return index$1.__awai
51849
51845
  });
51850
51846
  }); };
51851
51847
 
51848
+ var getLiveStepKey = function (state) { var _a, _b; return (_a = state.latestStepName) !== null && _a !== void 0 ? _a : (_b = state.currentStep) === null || _b === void 0 ? void 0 : _b.key; };
51852
51849
  var snapshotInlineErrors = function (state) {
51853
51850
  var e_1, _a;
51854
51851
  var _b, _c;
@@ -52039,6 +52036,139 @@ var resolveText = function (text, repeat) {
52039
52036
  }
52040
52037
  };
52041
52038
  var getCurrentStepKey = function (formId) { var _a, _b; return (_b = (_a = index$1.internalState[formId]) === null || _a === void 0 ? void 0 : _a.currentStep) === null || _b === void 0 ? void 0 : _b.key; };
52039
+ // Hydrate prior-session completed steps so a snapshot's stepper reachability is correct on the first turn
52040
+ var ensureCompletedSteps = function (formId) { return index$1.__awaiter(void 0, void 0, void 0, function () {
52041
+ var client;
52042
+ var _a;
52043
+ return index$1.__generator(this, function (_b) {
52044
+ switch (_b.label) {
52045
+ case 0:
52046
+ if (!formId)
52047
+ return [2 /*return*/];
52048
+ client = (_a = index$1.internalState[formId]) === null || _a === void 0 ? void 0 : _a.client;
52049
+ if (!client) return [3 /*break*/, 2];
52050
+ return [4 /*yield*/, index$1.loadCompletedSteps(client)];
52051
+ case 1:
52052
+ _b.sent();
52053
+ _b.label = 2;
52054
+ case 2: return [2 /*return*/];
52055
+ }
52056
+ });
52057
+ }); };
52058
+ var isElementVisible = function (state, el) {
52059
+ var _a, _b;
52060
+ var positionKey = ((_a = el.position) === null || _a === void 0 ? void 0 : _a.join(',')) || 'root';
52061
+ var flags = ((_b = state.visiblePositions) !== null && _b !== void 0 ? _b : {})[positionKey];
52062
+ return Array.isArray(flags) ? flags.some(Boolean) : true;
52063
+ };
52064
+ var collectNavigableSteps = function (state) {
52065
+ var _a, _b;
52066
+ var step = state === null || state === void 0 ? void 0 : state.currentStep;
52067
+ if (!step)
52068
+ return [];
52069
+ var out = [];
52070
+ var seen = new Set();
52071
+ var completedStepKeys = index$1.getCompletedStepKeys();
52072
+ ((_a = step.progress_bars) !== null && _a !== void 0 ? _a : []).forEach(function (el) {
52073
+ var _a, _b, _c, _d;
52074
+ if (!((_a = el === null || el === void 0 ? void 0 : el.properties) === null || _a === void 0 ? void 0 : _a.stepper) || !isElementVisible(state, el))
52075
+ return;
52076
+ var allowAll = !!((_b = el.properties) === null || _b === void 0 ? void 0 : _b.navigate_to_all_steps);
52077
+ ((_d = (_c = el.properties) === null || _c === void 0 ? void 0 : _c.entries) !== null && _d !== void 0 ? _d : []).forEach(function (s) {
52078
+ var stepKey = s === null || s === void 0 ? void 0 : s.step_key;
52079
+ if (!stepKey || seen.has(stepKey) || !index$1.isStepperStepVisible(s))
52080
+ return;
52081
+ var active = stepKey === step.key;
52082
+ if (!index$1.isStepperStepReachable(active, allowAll, completedStepKeys.has(stepKey)))
52083
+ return;
52084
+ seen.add(stepKey);
52085
+ out.push({ stepKey: stepKey, element: el, elementType: 'progress_bar' });
52086
+ });
52087
+ });
52088
+ // Tabs jump freely to any tab's step, no completed-step gating
52089
+ ((_b = step.tabs) !== null && _b !== void 0 ? _b : []).forEach(function (el) {
52090
+ var _a, _b;
52091
+ if (!isElementVisible(state, el))
52092
+ return;
52093
+ ((_b = (_a = el.properties) === null || _a === void 0 ? void 0 : _a.entries) !== null && _b !== void 0 ? _b : []).forEach(function (s) {
52094
+ var stepKey = s === null || s === void 0 ? void 0 : s.step_key;
52095
+ if (!stepKey || stepKey === step.key || seen.has(stepKey))
52096
+ return;
52097
+ seen.add(stepKey);
52098
+ out.push({ stepKey: stepKey, element: el, elementType: 'tab' });
52099
+ });
52100
+ });
52101
+ return out;
52102
+ };
52103
+ var collectNavigationSurfaces = function (state) {
52104
+ var _a, _b;
52105
+ var step = state === null || state === void 0 ? void 0 : state.currentStep;
52106
+ if (!step)
52107
+ return [];
52108
+ var out = [];
52109
+ var seenSurfaceIds = new Set();
52110
+ var completedStepKeys = index$1.getCompletedStepKeys();
52111
+ ((_a = step.progress_bars) !== null && _a !== void 0 ? _a : []).forEach(function (el) {
52112
+ var _a, _b, _c, _d, _e;
52113
+ if (!((_a = el === null || el === void 0 ? void 0 : el.properties) === null || _a === void 0 ? void 0 : _a.stepper) || !isElementVisible(state, el))
52114
+ return;
52115
+ var surfaceId = ((_b = el.properties) === null || _b === void 0 ? void 0 : _b.link_id) || el.id;
52116
+ if (seenSurfaceIds.has(surfaceId))
52117
+ return;
52118
+ seenSurfaceIds.add(surfaceId);
52119
+ var allowAll = !!((_c = el.properties) === null || _c === void 0 ? void 0 : _c.navigate_to_all_steps);
52120
+ var steps = ((_e = (_d = el.properties) === null || _d === void 0 ? void 0 : _d.entries) !== null && _e !== void 0 ? _e : [])
52121
+ .filter(function (s) { return index$1.isStepperStepVisible(s); })
52122
+ .map(function (s, idx) {
52123
+ var _a;
52124
+ var stepKey = s === null || s === void 0 ? void 0 : s.step_key;
52125
+ var label = String((_a = s === null || s === void 0 ? void 0 : s.label) !== null && _a !== void 0 ? _a : '');
52126
+ var position = idx + 1;
52127
+ if (!stepKey)
52128
+ return { label: label, position: position, reachable: false };
52129
+ var active = stepKey === step.key;
52130
+ return index$1.__assign(index$1.__assign({ stepKey: stepKey, label: label, position: position }, (active ? { active: true } : {})), { reachable: index$1.isStepperStepReachable(active, allowAll, completedStepKeys.has(stepKey)) });
52131
+ });
52132
+ if (steps.length > 0)
52133
+ out.push({
52134
+ surface: 'stepper',
52135
+ id: surfaceId,
52136
+ // Stepper clicks navigate without validating or submitting the current step
52137
+ submitsCurrentStep: false,
52138
+ steps: steps
52139
+ });
52140
+ });
52141
+ ((_b = step.tabs) !== null && _b !== void 0 ? _b : []).forEach(function (el) {
52142
+ var _a, _b, _c, _d;
52143
+ if (!isElementVisible(state, el))
52144
+ return;
52145
+ var surfaceId = ((_a = el.properties) === null || _a === void 0 ? void 0 : _a.link_id) || el.id;
52146
+ if (seenSurfaceIds.has(surfaceId))
52147
+ return;
52148
+ seenSurfaceIds.add(surfaceId);
52149
+ var steps = ((_c = (_b = el.properties) === null || _b === void 0 ? void 0 : _b.entries) !== null && _c !== void 0 ? _c : []).map(function (s, idx) {
52150
+ var _a;
52151
+ var stepKey = s === null || s === void 0 ? void 0 : s.step_key;
52152
+ var label = String((_a = s === null || s === void 0 ? void 0 : s.label) !== null && _a !== void 0 ? _a : '');
52153
+ var position = idx + 1;
52154
+ if (!stepKey)
52155
+ return { label: label, position: position, reachable: false };
52156
+ var active = stepKey === step.key;
52157
+ return index$1.__assign(index$1.__assign({ stepKey: stepKey, label: label, position: position }, (active ? { active: true } : {})), {
52158
+ // Any tab is reachable, no completed-step gating
52159
+ reachable: !active });
52160
+ });
52161
+ if (steps.length > 0)
52162
+ out.push({
52163
+ surface: 'tab',
52164
+ id: surfaceId,
52165
+ // A tab with submit validates and submits the current step before switching
52166
+ submitsCurrentStep: !!((_d = el.properties) === null || _d === void 0 ? void 0 : _d.submit),
52167
+ steps: steps
52168
+ });
52169
+ });
52170
+ return out;
52171
+ };
52042
52172
  // Mirrors canRunAction in utils/elementActions.ts; step events run for every in-scope step, element events require elementId in rule.elements.
52043
52173
  var STEP_EVENTS = new Set(['submit', 'load']);
52044
52174
  var elementHasLogicRules = function (logicRules, triggerEvent, stepId, elementId) {
@@ -52057,7 +52187,7 @@ var elementHasLogicRules = function (logicRules, triggerEvent, stepId, elementId
52057
52187
  };
52058
52188
  var getPanelRuntimeSnapshot = function (formId) {
52059
52189
  var e_1, _a, e_2, _b;
52060
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
52190
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
52061
52191
  var state = index$1.internalState[formId];
52062
52192
  if (!state || !state.currentStep)
52063
52193
  return null;
@@ -52185,8 +52315,8 @@ var getPanelRuntimeSnapshot = function (formId) {
52185
52315
  // Collect every servar key across the form
52186
52316
  var servarKeys = new Set();
52187
52317
  try {
52188
- for (var _u = index$1.__values(Object.keys((_j = state.steps) !== null && _j !== void 0 ? _j : {})), _v = _u.next(); !_v.done; _v = _u.next()) {
52189
- var stepKey = _v.value;
52318
+ for (var _s = index$1.__values(Object.keys((_j = state.steps) !== null && _j !== void 0 ? _j : {})), _t = _s.next(); !_t.done; _t = _s.next()) {
52319
+ var stepKey = _t.value;
52190
52320
  var loopStep = state.steps[stepKey];
52191
52321
  ((_k = loopStep === null || loopStep === void 0 ? void 0 : loopStep.servar_fields) !== null && _k !== void 0 ? _k : []).forEach(function (f) {
52192
52322
  var _a;
@@ -52198,7 +52328,7 @@ var getPanelRuntimeSnapshot = function (formId) {
52198
52328
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
52199
52329
  finally {
52200
52330
  try {
52201
- if (_v && !_v.done && (_a = _u.return)) _a.call(_u);
52331
+ if (_t && !_t.done && (_a = _s.return)) _a.call(_s);
52202
52332
  }
52203
52333
  finally { if (e_1) throw e_1.error; }
52204
52334
  }
@@ -52215,8 +52345,8 @@ var getPanelRuntimeSnapshot = function (formId) {
52215
52345
  var values = {};
52216
52346
  var hiddenFieldValues = {};
52217
52347
  try {
52218
- for (var _w = index$1.__values(Object.keys(fieldsMap)), _x = _w.next(); !_x.done; _x = _w.next()) {
52219
- var key = _x.value;
52348
+ for (var _u = index$1.__values(Object.keys(fieldsMap)), _v = _u.next(); !_v.done; _v = _u.next()) {
52349
+ var key = _v.value;
52220
52350
  var v = (_m = (_l = fieldsMap[key]) === null || _l === void 0 ? void 0 : _l.value) !== null && _m !== void 0 ? _m : null;
52221
52351
  if (servarKeys.has(key)) {
52222
52352
  values[key] = v;
@@ -52229,17 +52359,12 @@ var getPanelRuntimeSnapshot = function (formId) {
52229
52359
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
52230
52360
  finally {
52231
52361
  try {
52232
- if (_x && !_x.done && (_b = _w.return)) _b.call(_w);
52362
+ if (_v && !_v.done && (_b = _u.return)) _b.call(_u);
52233
52363
  }
52234
52364
  finally { if (e_2) throw e_2.error; }
52235
52365
  }
52236
52366
  var currentStepElements = [];
52237
- var visibilityFor = function (el) {
52238
- var _a;
52239
- var positionKey = ((_a = el.position) === null || _a === void 0 ? void 0 : _a.join(',')) || 'root';
52240
- var flags = visiblePositions[positionKey];
52241
- return Array.isArray(flags) ? flags.some(Boolean) : true;
52242
- };
52367
+ var visibilityFor = function (el) { return isElementVisible(state, el); };
52243
52368
  clickableSubgrids.forEach(function (sg) {
52244
52369
  var _a, _b, _c;
52245
52370
  var actions = sg.properties.actions;
@@ -52267,7 +52392,7 @@ var getPanelRuntimeSnapshot = function (formId) {
52267
52392
  currentStepElements.push(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign({ type: 'text', text: resolved, visible: visibilityFor(el) }, (el.id ? { id: el.id } : {})), (raw !== resolved ? { templateText: raw } : {})), (actions.length > 0 ? { actions: actions } : {})), (hasLogicRules ? { hasLogicRules: true } : {})), (clickableAncestorIds.length > 0 ? { clickableAncestorIds: clickableAncestorIds } : {})), (textRepeatContainer ? { repeatContainerId: textRepeatContainer } : {})));
52268
52393
  });
52269
52394
  ((_p = step.buttons) !== null && _p !== void 0 ? _p : []).forEach(function (el) {
52270
- var _a, _b, _c, _d, _e;
52395
+ var _a, _b, _c, _d, _e, _f, _g;
52271
52396
  var raw = extractRawText((_a = el === null || el === void 0 ? void 0 : el.properties) !== null && _a !== void 0 ? _a : {});
52272
52397
  var props = (_b = el === null || el === void 0 ? void 0 : el.properties) !== null && _b !== void 0 ? _b : {};
52273
52398
  var actions = Array.isArray(props.actions) ? props.actions : [];
@@ -52279,7 +52404,23 @@ var getPanelRuntimeSnapshot = function (formId) {
52279
52404
  if (!raw && actions.length === 0 && !props.submit && !hasLogicRules)
52280
52405
  return;
52281
52406
  var buttonRepeatContainer = (_d = index$1.getRepeatedContainer(step, el)) === null || _d === void 0 ? void 0 : _d.id;
52282
- currentStepElements.push(index$1.__assign(index$1.__assign({ type: 'button', id: (_e = el.id) !== null && _e !== void 0 ? _e : '', text: resolveText(raw), visible: visibilityFor(el), disabled: index$1.isButtonDisabled(el, step, visiblePositions, formReadOnly), submit: !!props.submit, actions: actions }, (hasLogicRules ? { hasLogicRules: true } : {})), (buttonRepeatContainer
52407
+ var actionTypes = actions.map(function (a) { return a === null || a === void 0 ? void 0 : a.type; });
52408
+ var navigatesTo;
52409
+ if (actionTypes.includes(index$1.ACTION_BACK)) {
52410
+ navigatesTo = index$1.getPrevStepKey(step, (_e = state.backNavMap) !== null && _e !== void 0 ? _e : {}) || undefined;
52411
+ }
52412
+ else if (actionTypes.includes(index$1.ACTION_NEXT)) {
52413
+ navigatesTo =
52414
+ index$1.nextStepKey((_f = step.next_conditions) !== null && _f !== void 0 ? _f : [], {
52415
+ elementType: 'button',
52416
+ elementIDs: [el.id]
52417
+ }) || undefined;
52418
+ }
52419
+ else if (props.submit) {
52420
+ // Submit without a navigation action cannot move pages
52421
+ navigatesTo = null;
52422
+ }
52423
+ currentStepElements.push(index$1.__assign(index$1.__assign(index$1.__assign({ type: 'button', id: (_g = el.id) !== null && _g !== void 0 ? _g : '', text: resolveText(raw), visible: visibilityFor(el), disabled: index$1.isButtonDisabled(el, step, visiblePositions, formReadOnly), submit: !!props.submit, actions: actions }, (navigatesTo !== undefined ? { navigatesTo: navigatesTo } : {})), (hasLogicRules ? { hasLogicRules: true } : {})), (buttonRepeatContainer
52283
52424
  ? { repeatContainerId: buttonRepeatContainer }
52284
52425
  : {})));
52285
52426
  });
@@ -52294,14 +52435,9 @@ var getPanelRuntimeSnapshot = function (formId) {
52294
52435
  var clickableAncestorIds = findClickableAncestorIds(el);
52295
52436
  currentStepElements.push(index$1.__assign({ type: 'image', text: resolveText(altRaw), visible: visibilityFor(el) }, (clickableAncestorIds.length > 0 ? { clickableAncestorIds: clickableAncestorIds } : {})));
52296
52437
  });
52297
- ((_r = step.progress_bars) !== null && _r !== void 0 ? _r : []).forEach(function (el) {
52298
- var _a;
52299
- var segments = (_a = el === null || el === void 0 ? void 0 : el.properties) === null || _a === void 0 ? void 0 : _a.num_segments;
52300
- currentStepElements.push(index$1.__assign(index$1.__assign({ type: 'progress' }, (typeof segments === 'number' ? { segments: segments } : {})), { visible: visibilityFor(el) }));
52301
- });
52302
52438
  // Collect tables with their column headers and row data
52303
52439
  var currentStepTables = [];
52304
- ((_s = step.tables) !== null && _s !== void 0 ? _s : []).forEach(function (el) {
52440
+ ((_r = step.tables) !== null && _r !== void 0 ? _r : []).forEach(function (el) {
52305
52441
  var _a, _b, _c, _d, _e;
52306
52442
  var cols = ((_b = (_a = el === null || el === void 0 ? void 0 : el.properties) === null || _a === void 0 ? void 0 : _a.columns) !== null && _b !== void 0 ? _b : []);
52307
52443
  if (cols.length === 0)
@@ -52337,7 +52473,8 @@ var getPanelRuntimeSnapshot = function (formId) {
52337
52473
  return {
52338
52474
  currentStep: { id: step.id, key: step.key },
52339
52475
  previousStepName: state.previousStepName || undefined,
52340
- totalSteps: Object.keys((_t = state.steps) !== null && _t !== void 0 ? _t : {}).length,
52476
+ activeStepKey: step.key,
52477
+ navigationSurfaces: collectNavigationSurfaces(state),
52341
52478
  currentStepFields: currentStepFields,
52342
52479
  currentStepElements: currentStepElements,
52343
52480
  currentStepTables: currentStepTables,
@@ -52868,7 +53005,7 @@ function dispatchClickElement(formUuid, elementId, rawRepeatIndex) {
52868
53005
  }];
52869
53006
  }
52870
53007
  client = state.assistantClient;
52871
- fromStepKey = state.currentStep.key;
53008
+ fromStepKey = (_f = getLiveStepKey(state)) !== null && _f !== void 0 ? _f : '';
52872
53009
  errorsBefore = snapshotInlineErrors(state);
52873
53010
  elementForDispatch = typeof repeatIndex === 'number'
52874
53011
  ? index$1.__assign(index$1.__assign({}, found.element), { repeat: repeatIndex }) : found.element;
@@ -52897,7 +53034,7 @@ function dispatchClickElement(formUuid, elementId, rawRepeatIndex) {
52897
53034
  case 6:
52898
53035
  if (!!ancestors_1_1.done) return [3 /*break*/, 9];
52899
53036
  sg = ancestors_1_1.value;
52900
- acts = (_f = sg === null || sg === void 0 ? void 0 : sg.properties) === null || _f === void 0 ? void 0 : _f.actions;
53037
+ acts = (_g = sg === null || sg === void 0 ? void 0 : sg.properties) === null || _g === void 0 ? void 0 : _g.actions;
52901
53038
  insideRepeat = typeof repeatIndex === 'number' &&
52902
53039
  !!repeatContainer &&
52903
53040
  sg.position.length >= repeatContainer.position.length;
@@ -52932,7 +53069,7 @@ function dispatchClickElement(formUuid, elementId, rawRepeatIndex) {
52932
53069
  error: err_1 instanceof Error ? err_1.message : String(err_1)
52933
53070
  }];
52934
53071
  case 14:
52935
- toStepKey = (_h = (_g = state.currentStep) === null || _g === void 0 ? void 0 : _g.key) !== null && _h !== void 0 ? _h : fromStepKey;
53072
+ toStepKey = (_h = getLiveStepKey(state)) !== null && _h !== void 0 ? _h : fromStepKey;
52936
53073
  errorsAfter = snapshotInlineErrors(state);
52937
53074
  fieldErrors = {};
52938
53075
  try {
@@ -52957,6 +53094,87 @@ function dispatchClickElement(formUuid, elementId, rawRepeatIndex) {
52957
53094
  });
52958
53095
  }
52959
53096
 
53097
+ function dispatchNavigate(formUuid, stepKey) {
53098
+ var _a, _b, _c;
53099
+ return index$1.__awaiter(this, void 0, void 0, function () {
53100
+ var state, target, client, fromStepKey, errorsBefore, err_1, toStepKey, errorsAfter, fieldErrors, _d, _e, key;
53101
+ var e_1, _f;
53102
+ return index$1.__generator(this, function (_g) {
53103
+ switch (_g.label) {
53104
+ case 0:
53105
+ if (!formUuid) {
53106
+ return [2 /*return*/, {
53107
+ ok: false,
53108
+ errorType: 'no_form_state',
53109
+ error: 'Form has not loaded yet.'
53110
+ }];
53111
+ }
53112
+ state = index$1.internalState[formUuid];
53113
+ if (!state || !state.currentStep || !state.assistantClient) {
53114
+ return [2 /*return*/, {
53115
+ ok: false,
53116
+ errorType: 'no_form_state',
53117
+ error: 'Form has not loaded yet.'
53118
+ }];
53119
+ }
53120
+ if (stepKey.length === 0) {
53121
+ return [2 /*return*/, {
53122
+ ok: false,
53123
+ errorType: 'shape_mismatch',
53124
+ error: 'stepKey is required.'
53125
+ }];
53126
+ }
53127
+ target = collectNavigableSteps(state).find(function (n) { return n.stepKey === stepKey; });
53128
+ if (!target) {
53129
+ return [2 /*return*/, {
53130
+ ok: false,
53131
+ errorType: 'step_not_allowed',
53132
+ error: "Step '".concat(stepKey, "' is not reachable through a navigation surface right now.")
53133
+ }];
53134
+ }
53135
+ client = state.assistantClient;
53136
+ fromStepKey = (_a = getLiveStepKey(state)) !== null && _a !== void 0 ? _a : '';
53137
+ errorsBefore = snapshotInlineErrors(state);
53138
+ _g.label = 1;
53139
+ case 1:
53140
+ _g.trys.push([1, 3, , 4]);
53141
+ return [4 /*yield*/, client.runActions(index$1.__assign({ actions: [{ type: index$1.ACTION_NEXT, next_step_key: stepKey }], element: target.element, elementType: target.elementType }, (target.elementType === 'tab'
53142
+ ? { submit: !!((_b = target.element.properties) === null || _b === void 0 ? void 0 : _b.submit) }
53143
+ : {})))];
53144
+ case 2:
53145
+ _g.sent();
53146
+ return [3 /*break*/, 4];
53147
+ case 3:
53148
+ err_1 = _g.sent();
53149
+ return [2 /*return*/, {
53150
+ ok: false,
53151
+ errorType: 'dispatch_failed',
53152
+ error: err_1 instanceof Error ? err_1.message : String(err_1)
53153
+ }];
53154
+ case 4:
53155
+ toStepKey = (_c = getLiveStepKey(state)) !== null && _c !== void 0 ? _c : fromStepKey;
53156
+ errorsAfter = snapshotInlineErrors(state);
53157
+ fieldErrors = {};
53158
+ try {
53159
+ for (_d = index$1.__values(Object.keys(errorsAfter)), _e = _d.next(); !_e.done; _e = _d.next()) {
53160
+ key = _e.value;
53161
+ if (errorsAfter[key] !== errorsBefore[key])
53162
+ fieldErrors[key] = errorsAfter[key];
53163
+ }
53164
+ }
53165
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
53166
+ finally {
53167
+ try {
53168
+ if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
53169
+ }
53170
+ finally { if (e_1) throw e_1.error; }
53171
+ }
53172
+ return [2 /*return*/, index$1.__assign({ ok: true, navigated: toStepKey !== fromStepKey ? { fromStepKey: fromStepKey, toStepKey: toStepKey } : null }, (Object.keys(fieldErrors).length > 0 ? { fieldErrors: fieldErrors } : {}))];
53173
+ }
53174
+ });
53175
+ });
53176
+ }
53177
+
52960
53178
  function dispatchTriggerTableAction(formUuid, tableId, rowIndex, actionLabel) {
52961
53179
  var _a, _b, _c;
52962
53180
  return index$1.__awaiter(this, void 0, void 0, function () {
@@ -53012,7 +53230,7 @@ function dispatchTriggerTableAction(formUuid, tableId, rowIndex, actionLabel) {
53012
53230
  }];
53013
53231
  }
53014
53232
  rowData = buildRowData(lookup.found, rowIndex);
53015
- fromStepKey = state.currentStep.key;
53233
+ fromStepKey = (_b = getLiveStepKey(state)) !== null && _b !== void 0 ? _b : '';
53016
53234
  errorsBefore = snapshotInlineErrors(state);
53017
53235
  _h.label = 1;
53018
53236
  case 1:
@@ -53034,7 +53252,7 @@ function dispatchTriggerTableAction(formUuid, tableId, rowIndex, actionLabel) {
53034
53252
  error: err_1 instanceof Error ? err_1.message : String(err_1)
53035
53253
  }];
53036
53254
  case 4:
53037
- toStepKey = (_c = (_b = state.currentStep) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : fromStepKey;
53255
+ toStepKey = (_c = getLiveStepKey(state)) !== null && _c !== void 0 ? _c : fromStepKey;
53038
53256
  errorsAfter = snapshotInlineErrors(state);
53039
53257
  fieldErrors = {};
53040
53258
  try {
@@ -53604,10 +53822,10 @@ var AssistantChat = function (_a) {
53604
53822
  onToolCall: function (_a) {
53605
53823
  var toolCall = _a.toolCall;
53606
53824
  return index$1.__awaiter(void 0, void 0, void 0, function () {
53607
- var input_1, fields, output, input_2, elementId, output, input_3, tableId, rowIndex, actionLabel, output, input_4, tableId, output, input_5, tableId, rowIndex, output, input_6, tableId, cells, output;
53608
- var _b, _c, _d, _e, _f, _g;
53609
- return index$1.__generator(this, function (_h) {
53610
- switch (_h.label) {
53825
+ var input_1, fields, output, input_2, elementId, output, input_3, stepKey, output, input_4, tableId, rowIndex, actionLabel, output, input_5, tableId, output, input_6, tableId, rowIndex, output, input_7, tableId, cells, output;
53826
+ var _b, _c, _d, _e, _f, _g, _h;
53827
+ return index$1.__generator(this, function (_j) {
53828
+ switch (_j.label) {
53611
53829
  case 0:
53612
53830
  if (toolCall.dynamic)
53613
53831
  return [2 /*return*/];
@@ -53616,87 +53834,100 @@ var AssistantChat = function (_a) {
53616
53834
  fields = Array.isArray(input_1.fields) ? input_1.fields : [];
53617
53835
  return [4 /*yield*/, dispatchSetFieldValue(instanceId, fields)];
53618
53836
  case 1:
53619
- output = _h.sent();
53837
+ output = _j.sent();
53620
53838
  chat.addToolOutput({
53621
53839
  tool: 'setFieldValue',
53622
53840
  toolCallId: toolCall.toolCallId,
53623
53841
  output: output
53624
53842
  });
53625
- return [3 /*break*/, 12];
53843
+ return [3 /*break*/, 14];
53626
53844
  case 2:
53627
53845
  if (!(toolCall.toolName === 'clickElement')) return [3 /*break*/, 4];
53628
53846
  input_2 = ((_c = toolCall.input) !== null && _c !== void 0 ? _c : {});
53629
53847
  elementId = typeof input_2.elementId === 'string' ? input_2.elementId : '';
53630
53848
  return [4 /*yield*/, dispatchClickElement(instanceId, elementId, input_2.repeatIndex)];
53631
53849
  case 3:
53632
- output = _h.sent();
53850
+ output = _j.sent();
53633
53851
  chat.addToolOutput({
53634
53852
  tool: 'clickElement',
53635
53853
  toolCallId: toolCall.toolCallId,
53636
53854
  output: output
53637
53855
  });
53638
- return [3 /*break*/, 12];
53856
+ return [3 /*break*/, 14];
53639
53857
  case 4:
53640
- if (!(toolCall.toolName === 'triggerTableAction')) return [3 /*break*/, 6];
53858
+ if (!(toolCall.toolName === 'navigateToStep')) return [3 /*break*/, 6];
53641
53859
  input_3 = ((_d = toolCall.input) !== null && _d !== void 0 ? _d : {});
53642
- tableId = typeof input_3.tableId === 'string' ? input_3.tableId : '';
53643
- rowIndex = typeof input_3.rowIndex === 'number' ? input_3.rowIndex : NaN;
53644
- actionLabel = typeof input_3.actionLabel === 'string'
53645
- ? input_3.actionLabel
53646
- : undefined;
53647
- return [4 /*yield*/, dispatchTriggerTableAction(instanceId, tableId, rowIndex, actionLabel)];
53860
+ stepKey = typeof input_3.stepKey === 'string' ? input_3.stepKey : '';
53861
+ return [4 /*yield*/, dispatchNavigate(instanceId, stepKey)];
53648
53862
  case 5:
53649
- output = _h.sent();
53863
+ output = _j.sent();
53650
53864
  chat.addToolOutput({
53651
- tool: 'triggerTableAction',
53865
+ tool: 'navigateToStep',
53652
53866
  toolCallId: toolCall.toolCallId,
53653
53867
  output: output
53654
53868
  });
53655
- return [3 /*break*/, 12];
53869
+ return [3 /*break*/, 14];
53656
53870
  case 6:
53657
- if (!(toolCall.toolName === 'addTableRow')) return [3 /*break*/, 8];
53871
+ if (!(toolCall.toolName === 'triggerTableAction')) return [3 /*break*/, 8];
53658
53872
  input_4 = ((_e = toolCall.input) !== null && _e !== void 0 ? _e : {});
53659
53873
  tableId = typeof input_4.tableId === 'string' ? input_4.tableId : '';
53660
- return [4 /*yield*/, dispatchAddTableRow(instanceId, tableId)];
53874
+ rowIndex = typeof input_4.rowIndex === 'number' ? input_4.rowIndex : NaN;
53875
+ actionLabel = typeof input_4.actionLabel === 'string'
53876
+ ? input_4.actionLabel
53877
+ : undefined;
53878
+ return [4 /*yield*/, dispatchTriggerTableAction(instanceId, tableId, rowIndex, actionLabel)];
53661
53879
  case 7:
53662
- output = _h.sent();
53880
+ output = _j.sent();
53663
53881
  chat.addToolOutput({
53664
- tool: 'addTableRow',
53882
+ tool: 'triggerTableAction',
53665
53883
  toolCallId: toolCall.toolCallId,
53666
53884
  output: output
53667
53885
  });
53668
- return [3 /*break*/, 12];
53886
+ return [3 /*break*/, 14];
53669
53887
  case 8:
53670
- if (!(toolCall.toolName === 'deleteTableRow')) return [3 /*break*/, 10];
53888
+ if (!(toolCall.toolName === 'addTableRow')) return [3 /*break*/, 10];
53671
53889
  input_5 = ((_f = toolCall.input) !== null && _f !== void 0 ? _f : {});
53672
53890
  tableId = typeof input_5.tableId === 'string' ? input_5.tableId : '';
53673
- rowIndex = typeof input_5.rowIndex === 'number' ? input_5.rowIndex : NaN;
53674
- return [4 /*yield*/, dispatchDeleteTableRow(instanceId, tableId, rowIndex)];
53891
+ return [4 /*yield*/, dispatchAddTableRow(instanceId, tableId)];
53675
53892
  case 9:
53676
- output = _h.sent();
53893
+ output = _j.sent();
53677
53894
  chat.addToolOutput({
53678
- tool: 'deleteTableRow',
53895
+ tool: 'addTableRow',
53679
53896
  toolCallId: toolCall.toolCallId,
53680
53897
  output: output
53681
53898
  });
53682
- return [3 /*break*/, 12];
53899
+ return [3 /*break*/, 14];
53683
53900
  case 10:
53684
- if (!(toolCall.toolName === 'setTableCellValue')) return [3 /*break*/, 12];
53901
+ if (!(toolCall.toolName === 'deleteTableRow')) return [3 /*break*/, 12];
53685
53902
  input_6 = ((_g = toolCall.input) !== null && _g !== void 0 ? _g : {});
53686
53903
  tableId = typeof input_6.tableId === 'string' ? input_6.tableId : '';
53687
- cells = Array.isArray(input_6.cells)
53688
- ? input_6.cells
53904
+ rowIndex = typeof input_6.rowIndex === 'number' ? input_6.rowIndex : NaN;
53905
+ return [4 /*yield*/, dispatchDeleteTableRow(instanceId, tableId, rowIndex)];
53906
+ case 11:
53907
+ output = _j.sent();
53908
+ chat.addToolOutput({
53909
+ tool: 'deleteTableRow',
53910
+ toolCallId: toolCall.toolCallId,
53911
+ output: output
53912
+ });
53913
+ return [3 /*break*/, 14];
53914
+ case 12:
53915
+ if (!(toolCall.toolName === 'setTableCellValue')) return [3 /*break*/, 14];
53916
+ input_7 = ((_h = toolCall.input) !== null && _h !== void 0 ? _h : {});
53917
+ tableId = typeof input_7.tableId === 'string' ? input_7.tableId : '';
53918
+ cells = Array.isArray(input_7.cells)
53919
+ ? input_7.cells
53689
53920
  : [];
53690
53921
  return [4 /*yield*/, dispatchSetTableCellValue(instanceId, tableId, cells)];
53691
- case 11:
53692
- output = _h.sent();
53922
+ case 13:
53923
+ output = _j.sent();
53693
53924
  chat.addToolOutput({
53694
53925
  tool: 'setTableCellValue',
53695
53926
  toolCallId: toolCall.toolCallId,
53696
53927
  output: output
53697
53928
  });
53698
- _h.label = 12;
53699
- case 12: return [2 /*return*/];
53929
+ _j.label = 14;
53930
+ case 14: return [2 /*return*/];
53700
53931
  }
53701
53932
  });
53702
53933
  });
@@ -53872,7 +54103,16 @@ var AssistantChat = function (_a) {
53872
54103
  }, [activeThreadId, activeThread, activeChat]);
53873
54104
  var _v = useAssistantVoice({
53874
54105
  status: status,
53875
- sendMessage: function (message) { return sendMessage(message); },
54106
+ sendMessage: function (message) { return index$1.__awaiter(void 0, void 0, void 0, function () {
54107
+ return index$1.__generator(this, function (_a) {
54108
+ switch (_a.label) {
54109
+ case 0: return [4 /*yield*/, ensureCompletedSteps(instanceId)];
54110
+ case 1:
54111
+ _a.sent();
54112
+ return [2 /*return*/, sendMessage(message)];
54113
+ }
54114
+ });
54115
+ }); },
53876
54116
  setMessages: setMessages,
53877
54117
  ensureThread: registerActiveThread,
53878
54118
  voiceActiveRef: voiceActiveRef,
@@ -53883,29 +54123,47 @@ var AssistantChat = function (_a) {
53883
54123
  React.useEffect(function () {
53884
54124
  pinToBottom();
53885
54125
  }, [spokenChars, audioDraining, pinToBottom]);
53886
- var handleSend = function () {
53887
- if (input.trim() && status === 'ready') {
53888
- registerActiveThread();
53889
- sendMessage({ text: input });
53890
- setInput('');
53891
- }
53892
- };
53893
- var handleWorkflowAction = function (action) {
53894
- if (status !== 'ready')
53895
- return;
53896
- registerActiveThread();
53897
- sendMessage({
53898
- parts: [
53899
- { type: 'text', text: action.name },
53900
- {
53901
- type: 'text',
53902
- text: action.instructions,
53903
- hidden: true,
53904
- interpolate: true
53905
- }
53906
- ]
54126
+ var handleSend = function () { return index$1.__awaiter(void 0, void 0, void 0, function () {
54127
+ return index$1.__generator(this, function (_a) {
54128
+ switch (_a.label) {
54129
+ case 0:
54130
+ if (!(input.trim() && status === 'ready')) return [3 /*break*/, 2];
54131
+ registerActiveThread();
54132
+ return [4 /*yield*/, ensureCompletedSteps(instanceId)];
54133
+ case 1:
54134
+ _a.sent();
54135
+ sendMessage({ text: input });
54136
+ setInput('');
54137
+ _a.label = 2;
54138
+ case 2: return [2 /*return*/];
54139
+ }
53907
54140
  });
53908
- };
54141
+ }); };
54142
+ var handleWorkflowAction = function (action) { return index$1.__awaiter(void 0, void 0, void 0, function () {
54143
+ return index$1.__generator(this, function (_a) {
54144
+ switch (_a.label) {
54145
+ case 0:
54146
+ if (status !== 'ready')
54147
+ return [2 /*return*/];
54148
+ registerActiveThread();
54149
+ return [4 /*yield*/, ensureCompletedSteps(instanceId)];
54150
+ case 1:
54151
+ _a.sent();
54152
+ sendMessage({
54153
+ parts: [
54154
+ { type: 'text', text: action.name },
54155
+ {
54156
+ type: 'text',
54157
+ text: action.instructions,
54158
+ hidden: true,
54159
+ interpolate: true
54160
+ }
54161
+ ]
54162
+ });
54163
+ return [2 /*return*/];
54164
+ }
54165
+ });
54166
+ }); };
53909
54167
  var handleKeyDown = function (e) {
53910
54168
  if (e.key === 'Enter' && !e.shiftKey) {
53911
54169
  e.preventDefault();