@feathery/react 2.52.0 → 2.53.1

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.CVafFEF9.js} +358 -100
  18. package/cjs/{fthry_FormControl.CFsGjlWP.js → fthry_FormControl.DwFbIZJd.js} +1 -1
  19. package/cjs/{fthry_InlineTooltip.D8vNmyCo.js → fthry_InlineTooltip.CYMFlmFg.js} +1 -1
  20. package/cjs/{fthry_PaymentMethodField.CjyihPh2.js → fthry_PaymentMethodField.BnWq1XON.js} +3 -3
  21. package/cjs/{fthry_Placeholder.CEroHtne.js → fthry_Placeholder.B7CXcIRV.js} +1 -1
  22. package/cjs/{fthry_ShowEyeIcon.BnG3Vchl.js → fthry_ShowEyeIcon.DEDr9oLt.js} +1 -1
  23. package/cjs/{fthry_TabsElement.CZhy_wi4.js → fthry_TabsElement.nQpiOp7a.js} +1 -1
  24. package/cjs/{fthry_auto-track.BPxVfhig.js → fthry_auto-track.b365Bgd3.js} +2 -2
  25. package/cjs/{fthry_highlighted-body-TPN3WLV5.Cbq0oozC.js → fthry_highlighted-body-TPN3WLV5.BBCsXFcQ.js} +3 -3
  26. package/cjs/{fthry_index.CXwLzgRa.js → fthry_index.36Ph0zIi.js} +1 -1
  27. package/cjs/{fthry_index.C9NKIII4.js → fthry_index.6yQkDzl0.js} +10 -10
  28. package/cjs/{fthry_index.BFIHbM-S.js → fthry_index.B4FD3PMM.js} +4 -4
  29. package/cjs/{fthry_index.CT_LxtvQ.js → fthry_index.B6kZoHiB.js} +3 -3
  30. package/cjs/{fthry_index.B8MwyqlN.js → fthry_index.BArvM6HS.js} +1 -1
  31. package/cjs/{fthry_index.Dc_4w6fx.js → fthry_index.BCfBMCB3.js} +3 -3
  32. package/cjs/{fthry_index.Cwq4DYI1.js → fthry_index.BECLpAxl.js} +7 -7
  33. package/cjs/{fthry_index.K-f-AFvK.js → fthry_index.BOKuzxBi.js} +5 -5
  34. package/cjs/{fthry_index.Cak79RQu.js → fthry_index.BZyAU4wL.js} +2 -2
  35. package/cjs/{fthry_index.BsBvq_1g.js → fthry_index.B_q4kl2c.js} +5 -5
  36. package/cjs/{fthry_index.D39Lt3zI.js → fthry_index.BazE_aqQ.js} +1 -1
  37. package/cjs/{fthry_index.DJHxUxWn.js → fthry_index.Bvgb5U7R.js} +5 -5
  38. package/cjs/{fthry_index.CCEBVH2X.js → fthry_index.ByW-toQp.js} +1 -1
  39. package/cjs/{fthry_index.C3i01ldH.js → fthry_index.Byp2EIpf.js} +4 -4
  40. package/cjs/{fthry_index.BKPLTWi2.js → fthry_index.BzD-U_xm.js} +4 -4
  41. package/cjs/{fthry_index.DtLwdWxZ.js → fthry_index.BzYS6B8d.js} +1 -1
  42. package/cjs/{fthry_index.BDmxKsQr.js → fthry_index.CDpCAPqf.js} +1 -1
  43. package/cjs/{fthry_index.KEOsb1yt.js → fthry_index.CF-8Cilp.js} +4 -4
  44. package/cjs/{fthry_index.FvahYCl4.js → fthry_index.CPPvBcFj.js} +2 -2
  45. package/cjs/{fthry_index.C3M5YF3_.js → fthry_index.CTdfgtuI.js} +2 -2
  46. package/cjs/{fthry_index.CaUi4jbg.js → fthry_index.Ckl1ehwL.js} +1 -1
  47. package/cjs/{fthry_index.3AdSzGkN.js → fthry_index.ClpCDYxE.js} +1 -1
  48. package/cjs/{fthry_index.CmD9vaZF.js → fthry_index.CzjmzEwU.js} +1 -1
  49. package/cjs/{fthry_index.BLx53xa6.js → fthry_index.DFMcMKQw.js} +2 -2
  50. package/cjs/{fthry_index.BKp4BJaN.js → fthry_index.DG51le7N.js} +2 -2
  51. package/cjs/{fthry_index.BTPOlsSL.js → fthry_index.DRzGV8US.js} +5 -5
  52. package/cjs/{fthry_index.DQNu-cig.js → fthry_index.DmeUgvTX.js} +2 -2
  53. package/cjs/{fthry_index.-317ESCa.js → fthry_index.MKCxdsfR.js} +2 -2
  54. package/cjs/{fthry_index.CU8bLoRm.js → fthry_index.YT_1qL8F.js} +1 -1
  55. package/cjs/{fthry_index.D5nsJ4l9.js → fthry_index.ebKTRfKH.js} +99 -56
  56. package/cjs/{fthry_index.umd.CfnpJnCF.js → fthry_index.umd.C0AAa6KQ.js} +1 -1
  57. package/cjs/{fthry_index.CkV6wvoE.js → fthry_index.wyC0vZGG.js} +3 -3
  58. package/cjs/{fthry_index.Z912i259.js → fthry_index.z2Wn4-ZC.js} +1 -1
  59. package/cjs/{fthry_input.FZhPnVr7.js → fthry_input.BvTWAuGz.js} +1 -1
  60. package/cjs/{fthry_logging.geKUVlWF.js → fthry_logging.DwDEi6p6.js} +1 -1
  61. package/cjs/{fthry_mermaid-O7DHMXV3.CmGxXRTE.js → fthry_mermaid-O7DHMXV3.CZ5BiMUU.js} +3 -3
  62. package/cjs/{fthry_script.BUpgmYs1.js → fthry_script.BsstD4tZ.js} +1 -1
  63. package/cjs/{fthry_styles.Cs5z0RLk.js → fthry_styles.JkeSRN2E.js} +1 -1
  64. package/cjs/{fthry_useElementSize.YisvU5or.js → fthry_useElementSize.BWpCZUoM.js} +1 -1
  65. package/cjs/{fthry_useSalesforceSync.IpHyJ8Rh.js → fthry_useSalesforceSync.DhEgP78Y.js} +1 -1
  66. package/cjs/{fthry_webfontloader.DNe9Fh4f.js → fthry_webfontloader.DQ7xsLob.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 +31 -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.D_pCgi4k.js} +358 -100
  93. package/dist/{fthry_FormControl.B7J9s9oo.js → fthry_FormControl.CjXGVKgo.js} +1 -1
  94. package/dist/{fthry_InlineTooltip.BPOmnzvw.js → fthry_InlineTooltip.TGwg1gLU.js} +1 -1
  95. package/dist/{fthry_PaymentMethodField.DsCBiJlK.js → fthry_PaymentMethodField.DwJHOZM9.js} +3 -3
  96. package/dist/{fthry_Placeholder.NymoVpcm.js → fthry_Placeholder.C2RhF-af.js} +1 -1
  97. package/dist/{fthry_ShowEyeIcon.BDAEa0mY.js → fthry_ShowEyeIcon.DRGyrzPe.js} +1 -1
  98. package/dist/{fthry_TabsElement.DX0UxEwC.js → fthry_TabsElement.CS8YU9-f.js} +1 -1
  99. package/dist/{fthry_auto-track.Dyp3Edpb.js → fthry_auto-track.DOL3JPd7.js} +2 -2
  100. package/dist/{fthry_highlighted-body-TPN3WLV5.BZlLLT_h.js → fthry_highlighted-body-TPN3WLV5.BSabEjgF.js} +3 -3
  101. package/dist/{fthry_index.C4y2VpAI.js → fthry_index.BEr0UVkq.js} +1 -1
  102. package/dist/{fthry_index.BioTQdQH.js → fthry_index.BKg3o6ON.js} +1 -1
  103. package/dist/{fthry_index.B7ES1pR0.js → fthry_index.BNj0VqnZ.js} +3 -3
  104. package/dist/{fthry_index.D2bM42q_.js → fthry_index.BOkKNXmh.js} +1 -1
  105. package/dist/{fthry_index.nsku124v.js → fthry_index.BOswT7gs.js} +1 -1
  106. package/dist/{fthry_index.CpcusZGV.js → fthry_index.BUnZgRW4.js} +1 -1
  107. package/dist/{fthry_index.B-wzj9I3.js → fthry_index.BY-XytC5.js} +4 -4
  108. package/dist/{fthry_index.DYAwyU5i.js → fthry_index.Buqdcuq4.js} +1 -1
  109. package/dist/{fthry_index.CACzwTsE.js → fthry_index.Bus44F0T.js} +1 -1
  110. package/dist/{fthry_index.DZN4f0xc.js → fthry_index.CERsbVBN.js} +1 -1
  111. package/dist/{fthry_index.dQWeqnwG.js → fthry_index.CFfYBj0f.js} +2 -2
  112. package/dist/{fthry_index.CGeXsZmz.js → fthry_index.CT7VIqLy.js} +3 -3
  113. package/dist/{fthry_index.Nuav8j0K.js → fthry_index.CWzL_12D.js} +10 -10
  114. package/dist/{fthry_index.Bg68oPpb.js → fthry_index.CYkIy_LS.js} +4 -4
  115. package/dist/{fthry_index.B0vLbcGn.js → fthry_index.CgzOYS5A.js} +4 -4
  116. package/dist/{fthry_index.DESq1sgq.js → fthry_index.Cj7vJibe.js} +3 -3
  117. package/dist/{fthry_index.CKkHv6qK.js → fthry_index.DJ7E5kMa.js} +4 -4
  118. package/dist/{fthry_index.DNdQzLH9.js → fthry_index.DQ5rqfaL.js} +2 -2
  119. package/dist/{fthry_index.BlcRVzvp.js → fthry_index.DTf5AWwg.js} +1 -1
  120. package/dist/{fthry_index.Bz4rt_--.js → fthry_index.Db3q0Gmv.js} +2 -2
  121. package/dist/{fthry_index.DCuF1bk9.js → fthry_index.Dg3dRdgf.js} +5 -5
  122. package/dist/{fthry_index.bjvsIu8G.js → fthry_index.DhbZuwUn.js} +2 -2
  123. package/dist/{fthry_index.iwkuw--x.js → fthry_index.Dn26el8S.js} +1 -1
  124. package/dist/{fthry_index.Dom1xrnf.js → fthry_index.DqlaWPOr.js} +2 -2
  125. package/dist/{fthry_index.fHB_kRnm.js → fthry_index.DyfHzjiL.js} +2 -2
  126. package/dist/{fthry_index.Dy4F8buv.js → fthry_index.Jk0neIfV.js} +92 -57
  127. package/dist/{fthry_index.DlMUmymj.js → fthry_index.fH5SLymc.js} +7 -7
  128. package/dist/{fthry_index.AY29jqCG.js → fthry_index.lbfZSe4J.js} +5 -5
  129. package/dist/{fthry_index.Cwbly1ds.js → fthry_index.nOgnbw-B.js} +5 -5
  130. package/dist/{fthry_index.BM5fI9GV.js → fthry_index.o1D9iiMP.js} +1 -1
  131. package/dist/{fthry_index.CphDVlAz.js → fthry_index.ovfWaBme.js} +4 -4
  132. package/dist/{fthry_index.CIiCjWfx.js → fthry_index.pvT0AekS.js} +2 -2
  133. package/dist/{fthry_index.umd.D4j5JUK3.js → fthry_index.umd.DoNTPTOJ.js} +1 -1
  134. package/dist/{fthry_input.Adlw2NIB.js → fthry_input.CHil5MA6.js} +1 -1
  135. package/dist/{fthry_logging.CMGH_ih6.js → fthry_logging.CQpLahbG.js} +1 -1
  136. package/dist/fthry_mermaid-O7DHMXV3.CKuI5_y2.js +8 -0
  137. package/dist/{fthry_script.Cw3vY7SE.js → fthry_script.DgUOelFD.js} +1 -1
  138. package/dist/{fthry_styles.kI9Gm6SN.js → fthry_styles.Bp-6Xc93.js} +1 -1
  139. package/dist/{fthry_useElementSize.DI3dhxBK.js → fthry_useElementSize.Ei12yAMg.js} +1 -1
  140. package/dist/{fthry_useSalesforceSync.Dm771FBU.js → fthry_useSalesforceSync.DRrMykIw.js} +1 -1
  141. package/dist/{fthry_webfontloader.DzI_r3mH.js → fthry_webfontloader.Csv0NH24.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 +31 -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
@@ -17,8 +17,17 @@ export declare type GetConfigParams = {
17
17
  };
18
18
  export declare type GetConfig = ({ filter, keys, unique }: GetConfigParams) => Promise<Record<string, any>[]>;
19
19
  declare type DocusignSigner = {
20
- email: string;
20
+ email?: string;
21
21
  name: string;
22
+ signMethod?: 'esign' | 'paper';
23
+ routingOrder?: string;
24
+ excludedDocuments?: number[];
25
+ };
26
+ declare type DocusignDocument = string | {
27
+ documentId?: string;
28
+ envelopeId?: string;
29
+ fillData?: Record<string, any>;
30
+ signerMap?: Record<string, number>;
22
31
  };
23
32
  declare type DocusignLibraryDocuments = {
24
33
  library: 'quik';
@@ -34,8 +43,20 @@ declare type DocusignLibraryDocuments = {
34
43
  featheryField: string;
35
44
  }[];
36
45
  };
46
+ declare type DocusignNotification = {
47
+ reminders?: {
48
+ enabled?: boolean;
49
+ delay?: number;
50
+ frequency?: number;
51
+ };
52
+ expirations?: {
53
+ enabled?: boolean;
54
+ after?: number;
55
+ warn?: number;
56
+ };
57
+ };
37
58
  export declare type SendDocusignParams = {
38
- documents?: string[];
59
+ documents?: DocusignDocument[];
39
60
  libraryDocuments?: DocusignLibraryDocuments;
40
61
  existingEnvelopeId?: string;
41
62
  signers?: DocusignSigner[];
@@ -43,6 +64,12 @@ export declare type SendDocusignParams = {
43
64
  emailSubject?: string;
44
65
  emailBlurb?: string;
45
66
  draft?: boolean;
67
+ wetSign?: boolean;
68
+ useDisclosure?: boolean;
69
+ notification?: DocusignNotification;
70
+ brandId?: string;
71
+ enforceSignerVisibility?: boolean;
72
+ ignoreTemplateFieldMapping?: boolean;
46
73
  };
47
74
  export declare type GetDocusignEnvelopeParams = {
48
75
  envelopeId: string;
@@ -55,7 +82,9 @@ export declare type UpdateDocusignEnvelopeParams = {
55
82
  export interface FormInternalState {
56
83
  language: string | undefined;
57
84
  currentStep: any;
85
+ latestStepName?: string;
58
86
  previousStepName: string;
87
+ backNavMap?: Record<string, string>;
59
88
  visiblePositions: any;
60
89
  logicRules?: LogicRule[];
61
90
  assistantClient?: AssistantClient;
@@ -1 +1 @@
1
- {"version":3,"file":"internalState.d.ts","sourceRoot":"","sources":["../../src/utils/internalState.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAA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AAC,IAAI,CAAC,CAAC;IACxE,aAAa,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,oBAAoB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,mBAAmB,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzE,sBAAsB,EAAE,CACtB,MAAM,EAAE,4BAA4B,KACjC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,aAAK,aAAa,GAAG;IACnB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACvC,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,aAAkB,CAAC;AAIxC,eAAO,MAAM,oBAAoB,aACrB,MAAM,eACH,OAAO,MAAM,EAAE,GAAG,CAAC,qBACd,MAAM,EAAE,sBA0B3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function isStepperStepVisible(stepConfig: any): boolean;
2
+ export declare function isStepperStepReachable(isActive: boolean, allowAllNavigation: boolean, isCompleted: boolean): boolean;
3
+ //# sourceMappingURL=stepper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepper.d.ts","sourceRoot":"","sources":["../../src/utils/stepper.ts"],"names":[],"mappings":"AAQA,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CAK7D;AAGD,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,OAAO,EACjB,kBAAkB,EAAE,OAAO,EAC3B,WAAW,EAAE,OAAO,GACnB,OAAO,CAET"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feathery/react",
3
- "version": "2.52.0",
3
+ "version": "2.53.1",
4
4
  "description": "React library for Feathery",
5
5
  "author": "Boyang Dun",
6
6
  "license": "MIT",
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[917],{11292:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ot});var r=n(35944),o=n(67294),i=n(91247),a=n(74790),l=n(74438),u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},u.apply(this,arguments)},s=function(e){return(0,r.tZ)("svg",u({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}))},c=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},d=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m22 2-7 20-4-9-9-4 20-7z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m22 2-11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},p=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",style:{borderRadius:"50%"},viewBox:"0 0 50 50"},e,{children:[(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#f5cbcb",strokeWidth:3,opacity:1}}),(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#e2626e",strokeWidth:3,opacity:1,strokeLinecap:"round",transformOrigin:"50% 50%",transform:"rotate3d(0,0,1,0deg)",animation:"2156ms ease-in-out 0s infinite normal none running feathery-spinner-arc,1829ms linear 0s infinite normal none running feathery-spinner-rotate"}})]}))},f=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M18 6 6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m6 6 12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(e){return(0,r.tZ)("svg",u({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("polyline",{points:"20 6 9 17 4 12",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},v=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},y=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("rect",{x:"12",y:"12",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"2"})]}))},b=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},g=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M15 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},m=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 9V5a1 1 0 0 1 1-1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 9V5a1 1 0 0 0-1-1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M4 15v4a1 1 0 0 0 1 1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 15v4a1 1 0 0 1-1 1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},x=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}))},w=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m11 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m18 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},k=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m6 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m13 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},S=function(e){return(0,r.BX)("svg",u({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},C=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"9",y:"3",width:"6",height:"12",rx:"3",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M5 11a7 7 0 0 0 14 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M12 18v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}))},_=function(e){return(0,r.BX)("svg",u({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 12v0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M8 9v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M12 5v14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M16 9v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M20 11v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}))},A=n(39479),T=function(){function e(e){void 0===e&&(e={}),this.building=[],this.queue=[],this.playIndex=0,this.ended=!1,this.playing=!1,this.audio=null,this.objectUrl=null,this.rafId=null,this.opts=e}return Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this.playing},enumerable:!1,configurable:!0}),e.prototype.pushChunk=function(e){this.building.push(function(e){for(var t=(0,A.Kv)().atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}(e))},e.prototype.pushSegment=function(e){this.queue.push({text:e,bytes:this.building}),this.building=[],this.playing=!0,this.playNext()},e.prototype.end=function(){this.ended=!0,this.playNext()},e.prototype.skip=function(){this.teardown()},e.prototype.playNext=function(){var e,t,n,r,o=this;if(!this.audio){var i=this.queue[this.playIndex];if(i){if(0===i.bytes.length)return null===(r=(n=this.opts).onSegmentEnd)||void 0===r||r.call(n,i.text),this.playIndex+=1,void this.playNext();var a=URL.createObjectURL(new Blob(i.bytes,{type:"audio/mpeg"})),l=new Audio(a);this.audio=l,this.objectUrl=a,l.onplaying=function(){var e,t;o.audio===l&&(null===(t=(e=o.opts).onSegmentStart)||void 0===t||t.call(e,i.text),o.startReveal(l,i.text))},l.onended=function(){return o.finishClip(l,i.text)},l.onerror=function(){return o.finishClip(l,i.text)},l.play().catch((function(){return o.finishClip(l,i.text)}))}else this.ended&&this.playing&&(this.playing=!1,null===(t=(e=this.opts).onIdle)||void 0===t||t.call(e))}},e.prototype.startReveal=function(e,t){var n=this,r=(0,A.Kv)(),o=function(){var i,a;if(n.audio===e){var l=e.duration,u=l&&isFinite(l)&&l>0?Math.min(1,e.currentTime/l*1.5):0;null===(a=(i=n.opts).onSegmentProgress)||void 0===a||a.call(i,t,u),n.rafId=r.requestAnimationFrame(o)}else n.rafId=null};this.rafId=r.requestAnimationFrame(o)},e.prototype.stopReveal=function(){null!==this.rafId&&((0,A.Kv)().cancelAnimationFrame(this.rafId),this.rafId=null)},e.prototype.finishClip=function(e,t){var n,r;this.audio===e&&(this.stopReveal(),null===(r=(n=this.opts).onSegmentEnd)||void 0===r||r.call(n,t),e.pause(),e.src="",this.audio=null,this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.playIndex+=1,this.playNext())},e.prototype.teardown=function(){var e,t;this.stopReveal(),this.audio&&(this.audio.pause(),this.audio.src="",this.audio=null),this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.building=[],this.queue=[],this.playIndex=0,this.ended=!1,this.playing=!1,null===(t=(e=this.opts).onIdle)||void 0===t||t.call(e)},e}(),I=function(){function e(e){this.vad=null,this.paused=!1,this.opts=e}return e.prototype.start=function(){return e=this,t=void 0,o=function(){var e,t,r,o,i=this;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,Promise.all([n.e(762),n.e(129)]).then(n.bind(n,39762))];case 1:return e=a.sent(),t=e.MicVAD,r=e.utils,[4,n.e(968).then(n.bind(n,66968))];case 2:return a.sent().log.debug=function(){},o=this,[4,t.new({baseAssetPath:"https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.30/dist/",onnxWASMBasePath:"https://cdn.jsdelivr.net/npm/onnxruntime-web@1.27.0/dist/",getStream:function(){return(0,A.Kv)().navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})},onSpeechStart:function(){i.paused||i.opts.onSpeechStart()},onSpeechEnd:function(e){if(!(i.paused||e.length<6400)){var t=new Blob([r.encodeWAV(e)],{type:"audio/wav"});i.opts.onUtterance(t)}}})];case 3:return o.vad=a.sent(),this.vad.start(),[2,!0];case 4:return a.sent(),this.vad=null,[2,!1];case 5:return[2]}}))},new((r=void 0)||(r=Promise))((function(n,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function l(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}u((o=o.apply(e,t||[])).next())}));var e,t,r,o},e.prototype.pause=function(){var e;this.paused=!0,null===(e=this.vad)||void 0===e||e.pause()},e.prototype.resume=function(){var e;this.paused=!1,null===(e=this.vad)||void 0===e||e.start()},e.prototype.destroy=function(){var e;null===(e=this.vad)||void 0===e||e.destroy(),this.vad=null},e}();function Z(){var e;try{var t=null===(e=(0,A.Kv)().navigator)||void 0===e?void 0:e.mediaDevices;return!!t&&"function"==typeof t.getUserMedia}catch(e){return!1}}var R=function(){return R=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},R.apply(this,arguments)},j=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},E=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},L=function(e){return e.replace(/\s/g,"").length},O="#6b7280",B="#f9fafb",K="#e5e7eb",M="#9ca3af",W="#6b7280",z="#1f2937",N="#ef4444",F=function(e,t){var n=parseInt(e.replace("#",""),16),r=Math.min(255,Math.max(0,(n>>16)+Math.round(2.55*t))),o=Math.min(255,Math.max(0,(n>>8&255)+Math.round(2.55*t))),i=Math.min(255,Math.max(0,(255&n)+Math.round(2.55*t)));return"#".concat((r<<16|o<<8|i).toString(16).padStart(6,"0"))},P=function(){return P=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},P.apply(this,arguments)},D=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},X=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},U={searchWeb:{running:"Searching the web...",done:"Searched the web"},scrapeUrl:{running:"Reading web page...",done:"Read the web page"},searchDocuments:{running:"Searching documents...",done:"Searched the documents"},setFieldValue:{running:"Updating form fields...",done:"Updated form fields"},clickElement:{running:"Running form action...",done:"Ran the form action"},navigateToStep:{running:"Moving to another page...",done:"Moved to another page"},addTableRow:{running:"Adding a row...",done:"Added a row"},deleteTableRow:{running:"Deleting a row...",done:"Deleted a row"},setTableCellValue:{running:"Updating table cells...",done:"Updated table cells"},triggerTableAction:{running:"Running table action...",done:"Ran the table action"},getPanelSnapshot:{running:"Reading the form...",done:"Reviewed the form"},getExtractionSnapshot:{running:"Reading extraction setup...",done:"Reviewed the extraction setup"},getExtractionResults:{running:"Reading extraction results...",done:"Reviewed the extraction results"},getLogicRules:{running:"Reading form logic...",done:"Reviewed form logic"},getHubSchema:{running:"Reading record setup...",done:"Reviewed the record setup"},queryHub:{running:"Searching records on file...",done:"Searched the records on file"},querySubmissions:{running:"Searching submissions...",done:"Searched submissions"}},V=function(e){try{var t=new URL(e);return t.hostname+("/"!==t.pathname?t.pathname:"")}catch(t){return e}},q=function(e){if(!e||"object"!=typeof e)return[];var t=e,n=[],r=function(e){return e.map((function(e){return"object"==typeof e&&null!==e&&e.url||""})).filter(Boolean)};return Array.isArray(t.web)&&n.push.apply(n,X([],D(r(t.web)),!1)),Array.isArray(t.news)&&n.push.apply(n,X([],D(r(t.news)),!1)),Array.isArray(t.images)&&n.push.apply(n,X([],D(r(t.images)),!1)),"string"==typeof t.url&&t.url&&n.push(t.url),n.length>0?Array.from(new Set(n)):Array.isArray(e)?Array.from(new Set(r(e))):[]},H=function(e){return"input-streaming"===e||"input-available"===e},G=function(e){return"output-error"===e.state||"object"==typeof e.output&&null!==e.output&&!1===e.output.ok},Y=function(e){var t,n=e.row,o=e.linkColor,i=e.indent,a=void 0===i?24:i,l=null===(t=n.input)||void 0===t?void 0:t.query,u=q(n.output);return l||u.length>0?(0,r.BX)("div",P({css:{display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"".concat(a,"px"),marginTop:"2px",marginBottom:"4px"}},{children:[l&&(0,r.BX)("div",P({css:{color:M,fontSize:"12px",fontStyle:"italic"}},{children:['"',l.length>80?l.substring(0,80)+"...":l,'"']})),u.map((function(e,t){return(0,r.BX)("a",P({href:e,target:"_blank",rel:"noopener noreferrer",css:{fontSize:"12px",color:o,textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",minWidth:0,":hover":{textDecoration:"underline"}}},{children:[(0,r.tZ)(S,{css:{flexShrink:0}}),(0,r.tZ)("span",P({css:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:V(e)}))]}),t)}))]})):null},J=function(e){var t;return!!(null===(t=e.input)||void 0===t?void 0:t.query)||q(e.output).length>0},$=function(e){var t,n,r=U[e.toolName]||{running:"Working...",done:"Done"};return H(e.state)?r.running:G(e)?null!==(t=r.done)&&void 0!==t?t:"Failed":null!==(n=r.done)&&void 0!==n?n:r.running},Q={backgroundImage:"linear-gradient(90deg, ".concat(W," 25%, #d1d5db 50%, ").concat(W," 75%)"),backgroundSize:"220% 100%",backgroundClip:"text",WebkitBackgroundClip:"text",color:"transparent",animation:"feathery-tool-shimmer 1.6s linear infinite","@keyframes feathery-tool-shimmer":{from:{backgroundPosition:"160% 0"},to:{backgroundPosition:"-60% 0"}}},ee=function(e){var t=e.rows,n=e.followedByText,i=e.turnFinished,a=e.audioPending,l=void 0!==a&&a,u=e.linkColor,s=void 0===u?O:u,d=e.isFirstChunk,p=void 0!==d&&d,h=t.some((function(e){return H(e.state)})),v=!h&&!l&&(n||i),y=!(!h&&!l&&n),b=D((0,o.useState)(null),2),g=b[0],m=b[1],x=null!=g?g:y,w=function(){return m(!x)},k=P({display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"".concat(14,"px")},p?{}:{animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}),S=t.filter((function(e){return e.toolName in U}));if(v&&1===S.length){var C=S[0],_=G(C),A=J(C);return(0,r.BX)("div",P({css:k},{children:[(0,r.BX)("button",P({type:"button",onClick:A?w:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:A?"pointer":"default",color:W,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[_&&(0,r.tZ)(f,{css:{width:"12px",height:"12px",color:N}}),(0,r.tZ)("span",{children:$(C)}),A&&(0,r.tZ)(c,{css:{width:"12px",height:"12px",color:M,transform:x?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),A&&x&&(0,r.tZ)(Y,{row:C,linkColor:s,indent:6})]}))}var T=v?"Finished working":"Working on it...",I=S.length>0;return(0,r.BX)("div",P({css:k},{children:[(0,r.BX)("button",P({type:"button",onClick:I?w:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:I?"pointer":"default",color:W,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",P({css:v?void 0:Q},{children:T})),I&&(0,r.tZ)(c,{css:{width:"12px",height:"12px",color:M,transform:x?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),I&&x&&(0,r.tZ)("div",P({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(K)}},{children:S.map((function(e){return(0,r.tZ)(te,{row:e,linkColor:s},e.key)}))}))]}))},te=function(e){var t=e.row,n=e.linkColor,i=J(t),a=H(t.state),l=G(t),u=D((0,o.useState)(null),2),s=u[0],d=u[1],v=null!=s?s:a,y=i?"button":"div";return(0,r.BX)("div",P({css:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[(0,r.BX)(y,P({type:i?"button":void 0,onClick:i?function(){return d(!v)}:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",color:l?N:W,background:"none",border:"none",padding:"2px 0",textAlign:"left",cursor:i?"pointer":"default",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[a?(0,r.tZ)(p,{css:{width:"12px",height:"12px"}}):l?(0,r.tZ)(f,{css:{width:"12px",height:"12px"}}):(0,r.tZ)(h,{css:{width:"12px",height:"12px"}}),(0,r.tZ)("span",P({css:a?Q:void 0},{children:$(t)})),i&&(0,r.tZ)(c,{css:{width:"10px",height:"10px",color:M,transform:v?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),i&&v&&(0,r.tZ)(Y,{row:t,linkColor:n})]}))},ne=function(){return(0,r.tZ)("div",P({css:{display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"14px",animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}},{children:(0,r.tZ)("div",P({css:{padding:"4px 0",color:W,fontSize:"13px",alignSelf:"flex-start"}},{children:(0,r.tZ)("span",P({css:Q},{children:"Working on it..."}))}))}))},re=n(70917),oe=n(14123),ie=function(){return ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ie.apply(this,arguments)},ae=(0,re.iv)({color:"#2563eb",fontWeight:400,textDecoration:"underline",textUnderlineOffset:"0.12em",textDecorationSkipInk:"auto",overflowWrap:"break-word","&:visited":{color:"#6d28d9"},"&:hover":{color:"#1d4ed8"}}),le=(0,re.iv)('\n & p,\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"],\n & [data-streamdown="blockquote"],\n & [data-streamdown="code-block"],\n & [data-streamdown^="heading-"],\n & [data-streamdown="horizontal-rule"] {\n margin-top: 0 !important;\n margin-bottom: 0.6em !important;\n }\n & > *:last-child,\n & p:last-child,\n & [data-streamdown="ordered-list"]:last-child,\n & [data-streamdown="unordered-list"]:last-child,\n & [data-streamdown="blockquote"]:last-child,\n & [data-streamdown="code-block"]:last-child,\n & [data-streamdown^="heading-"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="strong"],\n & strong,\n & b {\n font-weight: 600 !important;\n }\n & em,\n & i {\n font-style: italic !important;\n }\n\n & [data-streamdown="heading-1"] {\n font-size: 1.25em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-2"] {\n font-size: 1.15em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-3"] {\n font-size: 1.05em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-4"],\n & [data-streamdown="heading-5"],\n & [data-streamdown="heading-6"] {\n font-size: 1em !important;\n font-weight: 600 !important;\n }\n\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"] {\n padding-left: 1.25em !important;\n }\n & [data-streamdown="ordered-list"] {\n list-style: decimal !important;\n }\n & [data-streamdown="unordered-list"] {\n list-style: disc !important;\n }\n & [data-streamdown="list-item"] {\n margin-bottom: 0.2em !important;\n }\n & [data-streamdown="list-item"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="inline-code"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.1em 0.3em !important;\n border-radius: 4px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n }\n & [data-streamdown="code-block"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.5em 0.75em !important;\n border-radius: 6px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n overflow-x: auto !important;\n }\n\n & [data-streamdown="blockquote"] {\n padding-left: 0.75em !important;\n border-left: 3px solid rgba(0, 0, 0, 0.15) !important;\n color: rgba(0, 0, 0, 0.75) !important;\n }\n\n & [data-streamdown="horizontal-rule"] {\n border: 0 !important;\n border-top: 1px solid rgba(0, 0, 0, 0.12) !important;\n margin: 0.6em 0 !important;\n }\n'),ue={a:function(e){var t=e.href,n=e.children;return(0,r.tZ)("a",ie({href:t,target:"_blank",rel:"noopener noreferrer",css:ae},{children:n}))}},se=(0,o.memo)((function(e){var t=e.text,n=e.isStreaming,o=void 0!==n&&n;return(0,r.tZ)("div",ie({css:le},{children:(0,r.tZ)(oe.qI,ie({components:ue,isAnimating:o,parseIncompleteMarkdown:o},{children:t}))}))}));se.displayName="MarkdownText";const ce=se;var de=function(){return de=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},de.apply(this,arguments)},pe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},fe=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},he=function(e,t){return pe(void 0,void 0,void 0,(function(){var n;return fe(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/"),{headers:t()})];case 1:return(n=r.sent()).ok?[2,n.json()]:[2,null]}}))}))},ve=function(e,t,n){return pe(void 0,void 0,void 0,(function(){var r;return fe(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{headers:t()})];case 1:return(r=o.sent()).ok?[2,r.json()]:[2,null]}}))}))},ye=function(e,t,n){return pe(void 0,void 0,void 0,(function(){return fe(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{method:"DELETE",headers:t()})];case 1:return r.sent(),[2]}}))}))},be=n(95710),ge=n(14428),me=n(54665),xe=n(93861),we=n(18837),ke=n(7193),Se=n(67948),Ce=n(85340),_e=n(19455),Ae=n(77925),Te=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ie=function(e){var t,n;return null!==(t=e.latestStepName)&&void 0!==t?t:null===(n=e.currentStep)||void 0===n?void 0:n.key},Ze=function(e){var t,n,r,o,i={},a=null!==(r=null==e?void 0:e.inlineErrors)&&void 0!==r?r:{};try{for(var l=Te(Object.keys(a)),u=l.next();!u.done;u=l.next()){var s=u.value,c=null===(o=a[s])||void 0===o?void 0:o.message;"string"==typeof c&&c.length>0&&(i[s]=c)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return i},Re=function(e,t){var n,r;if(!Array.isArray(e)||!Array.isArray(t)||0===t.length)return[];var o=[];try{for(var i=Te(e),a=i.next();!a.done;a=i.next()){var l=a.value,u=Array.isArray(null==l?void 0:l.position)?l.position:[];if(!(u.length>=t.length)){for(var s=!0,c=0;c<u.length;c++)if(u[c]!==t[c]){s=!1;break}s&&o.push(l)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o.sort((function(e,t){return t.position.length-e.position.length})),o};function je(e,t,n,r){if(!t)return"number"==typeof e?{errorType:"repeated_index_unexpected",error:"'".concat(r,"' is not in a repeated container; do not pass repeatIndex.")}:null;if("number"!=typeof e){var o=0===n?"(none yet - add a row first)":"0..".concat(n-1);return{errorType:"repeated_index_missing",error:"'".concat(r,"' is in a repeated container; pass repeatIndex ").concat(o,".")}}return e<0||e>=n?{errorType:"repeated_index_out_of_range",error:"repeatIndex ".concat(e," is out of range for '").concat(r,"' (rowCount ").concat(n,").")}:null}var Ee=function(e,t){var n,r,o,i,a;if(!e)return{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."};var l=ge.Z[e];if(!l||!l.currentStep||!l.assistantClient)return{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."};if("string"!=typeof t||0===t.length)return{ok:!1,errorType:"shape_mismatch",error:"tableId is required."};var u=(null!==(n=l.currentStep.tables)&&void 0!==n?n:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(!u)return{ok:!1,errorType:"not_on_step",error:"Table '".concat(t,"' is not on the current step.")};var s=null===(r=l.visiblePositions)||void 0===r?void 0:r[null!==(o=(0,we.gh)(u))&&void 0!==o?o:"root"];if(Array.isArray(s)&&!s.some(Boolean))return{ok:!1,errorType:"hidden",error:"Table '".concat(t,"' is on the current step but is hidden right now.")};var c=Array.isArray(null===(i=null==u?void 0:u.properties)||void 0===i?void 0:i.columns)?u.properties.columns:[],d=null!==(a=l.fields)&&void 0!==a?a:{},p=c.reduce((function(e,t){var n,r=(null==t?void 0:t.field_key)?null===(n=d[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0);return{ok:!0,found:{state:l,table:u,columns:c,rowCount:p}}},Le=function(e,t){var n,r=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},o=!(!r.enable_editing||r.transpose&&t>0),i=o&&!!r.add_delete_rows;return{canEditCells:o,canAddRows:i,canDeleteRows:i}},Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Oe.apply(this,arguments)},Be=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Ke=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Me=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},We=function(e){var t=e.text;if("string"==typeof t&&t.trim())return t;var n=e.text_formatted,r=Array.isArray(n)?n:null==n?void 0:n.ops;return Array.isArray(r)?r.map((function(e){return"string"==typeof(null==e?void 0:e.insert)?e.insert:""})).join("").trim():""},ze=function(e,t){if(!e)return"";try{return(0,me.xf)(e,t)}catch(t){return e}},Ne=function(e){return t=void 0,n=void 0,o=function(){var t,n;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(r){switch(r.label){case 0:return e?(t=null===(n=ge.Z[e])||void 0===n?void 0:n.client)?[4,(0,be.Zz)(t)]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return[2]}}))},new((r=void 0)||(r=Promise))((function(e,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function l(e){try{u(o.throw(e))}catch(e){i(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,l)}u((o=o.apply(t,n||[])).next())}));var t,n,r,o},Fe=function(e,t){var n,r,o=(null===(n=t.position)||void 0===n?void 0:n.join(","))||"root",i=(null!==(r=e.visiblePositions)&&void 0!==r?r:{})[o];return!Array.isArray(i)||i.some(Boolean)},Pe=function(e){var t,n,r=null==e?void 0:e.currentStep;if(!r)return[];var o=[],i=new Set,a=(0,be._5)();return(null!==(t=r.progress_bars)&&void 0!==t?t:[]).forEach((function(t){var n,l,u,s,c;if((null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.stepper)&&Fe(e,t)){var d=(null===(l=t.properties)||void 0===l?void 0:l.link_id)||t.id;if(!i.has(d)){i.add(d);var p=!!(null===(u=t.properties)||void 0===u?void 0:u.navigate_to_all_steps),f=(null!==(c=null===(s=t.properties)||void 0===s?void 0:s.entries)&&void 0!==c?c:[]).filter((function(e){return(0,Ae.V)(e)})).map((function(e,t){var n,o=null==e?void 0:e.step_key,i=String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:""),l=t+1;if(!o)return{label:i,position:l,reachable:!1};var u=o===r.key;return Oe(Oe({stepKey:o,label:i,position:l},u?{active:!0}:{}),{reachable:(0,Ae.D)(u,p,a.has(o))})}));f.length>0&&o.push({surface:"stepper",id:d,submitsCurrentStep:!1,steps:f})}}})),(null!==(n=r.tabs)&&void 0!==n?n:[]).forEach((function(t){var n,a,l,u;if(Fe(e,t)){var s=(null===(n=t.properties)||void 0===n?void 0:n.link_id)||t.id;if(!i.has(s)){i.add(s);var c=(null!==(l=null===(a=t.properties)||void 0===a?void 0:a.entries)&&void 0!==l?l:[]).map((function(e,t){var n,o=null==e?void 0:e.step_key,i=String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:""),a=t+1;if(!o)return{label:i,position:a,reachable:!1};var l=o===r.key;return Oe(Oe({stepKey:o,label:i,position:a},l?{active:!0}:{}),{reachable:!l})}));c.length>0&&o.push({surface:"tab",id:s,submitsCurrentStep:!!(null===(u=t.properties)||void 0===u?void 0:u.submit),steps:c})}}})),o},De=new Set(["submit","load"]),Xe=function(e,t,n,r){return(null!=e?e:[]).some((function(e){if((null==e?void 0:e.trigger_event)!==t)return!1;if(!1===e.enabled||!1===e.valid)return!1;var o=e.steps,i=e.elements;return!(Array.isArray(o)&&o.length>0&&!o.includes(n))&&(!!De.has(t)||Array.isArray(i)&&i.includes(r))}))},Ue=n(99234),Ve=n(81075),qe=function(){return qe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qe.apply(this,arguments)},He=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Ge=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Ye=new Set(["file_upload","signature"]),Je=new Set(["text_field","text_area","email","phone_number","url","password","ssn","ein","gmap_line_1","gmap_line_2","gmap_city","gmap_state","gmap_country","gmap_zip"]),$e=new Set(["integer_field","slider","rating"]),Qe=new Set(["dropdown","radio"]),et=new Set(["dropdown_multi","multiselect","checkbox_group","button_group"]);function tt(e,t){var n,r=null!==(n=e.metadata)&&void 0!==n?n:{},o=Array.isArray(r.repeat_options)?r.repeat_options:null;if("number"==typeof t&&o&&Array.isArray(o[t]))return o[t].map((function(e){var t,n,r,o,i;return{value:String(null!==(n=null!==(t=null==e?void 0:e.value)&&void 0!==t?t:e)&&void 0!==n?n:""),label:String(null!==(i=null!==(o=null!==(r=null==e?void 0:e.label)&&void 0!==r?r:null==e?void 0:e.value)&&void 0!==o?o:e)&&void 0!==i?i:"")}}));var i=Array.isArray(r.options)?r.options:null;if(!i)return[];var a=Array.isArray(r.labels)?r.labels:[];return i.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=a[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}}))}function nt(e,t,n,r){return He(this,void 0,void 0,(function(){var o,i,a;return Ge(this,(function(l){switch(l.label){case 0:return(o="number"==typeof e?String(Math.trunc(e)):"string"==typeof e?e:"").replace(/\D/g,"")?(Ue.BZ||(0,Ue.bq)(),[4,Ue.hV]):[2,e];case 1:return l.sent(),Ue.BZ?(i=function(e,t,n){var r,o,i,a=null===(o=null===(r=e.fields)||void 0===r?void 0:r[t])||void 0===o?void 0:o.value;if(a&&"string"==typeof a&&Ue.BZ)try{var l=Ue.BZ.parsePhoneNumber("+".concat(a));if(null==l?void 0:l.country)return l.country}catch(e){}var u=null===(i=n.metadata)||void 0===i?void 0:i.default_country;return u&&"auto"!==u?u:"US"}(n,r,t),(null==(a=function(){try{return Ue.BZ.parsePhoneNumber(o,i)}catch(e){return}}())?void 0:a.isValid())?[2,a.number.replace(/^\+/,"")]:[2,e]):[2,e]}}))}))}function rt(e,t){var n,r;return He(this,void 0,void 0,(function(){var o,i,a,l,u,s,c=this;return Ge(this,(function(d){switch(d.label){case 0:return o=e?ge.Z[e]:void 0,i=null==o?void 0:o.assistantClient,o&&i?(a=new Set(t.map((function(e){return"string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:""})).filter(Boolean)),l=new Map((null!==(r=null===(n=o.currentStep)||void 0===n?void 0:n.servar_fields)&&void 0!==r?r:[]).filter((function(e){var t;return a.has(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)})).map((function(e){var t,n,r=e.servar.key,i=null===(n=null===(t=o.fields)||void 0===t?void 0:t[r])||void 0===n?void 0:n.value;return[r,null==i?null:JSON.parse(JSON.stringify(i))]}))),[4,Promise.all(t.map((function(e){return He(c,void 0,void 0,(function(){var t,n,r,i,a,l;return Ge(this,(function(u){switch(u.label){case 0:return t="string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",n=Number.isInteger(null==e?void 0:e.repeatIndex)?e.repeatIndex:void 0,t?(r=function(e,t,n,r){var o,i,a,l,u,s,c,d,p=null==e?void 0:e.currentStep,f=null!==(o=null==p?void 0:p.servar_fields)&&void 0!==o?o:[],h=f.find((function(e){var n;return(null===(n=null==e?void 0:e.servar)||void 0===n?void 0:n.key)===t}));if(!h){var v=f.map((function(e){var t;return null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key})).filter(Boolean).join(", ")||"(none)";return{ok:!1,errorType:"not_on_step",error:"Field '".concat(t,"' is not on the current step. Available field keys here: ").concat(v,".")}}var y=null!==(i=h.servar)&&void 0!==i?i:{},b=y.type,g=null!==(a=e.visiblePositions)&&void 0!==a?a:{},m=g[null!==(l=(0,we.gh)(h))&&void 0!==l?l:"root"];if(Array.isArray(m)&&!m.some(Boolean))return{ok:!1,errorType:"hidden",error:"Field '".concat(t,"' is on the current step but is hidden right now.")};var x=!(!(null===(u=e.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==be.Hi.collaboratorReview);if((null===(s=h.properties)||void 0===s?void 0:s.disabled)||x)return{ok:!1,errorType:"disabled",error:"Field '".concat(t,"' is disabled and cannot be written.")};if(Ye.has(b))return{ok:!1,errorType:"unwriteable_type",error:"Field '".concat(t,"' (").concat(b,") cannot be filled by the assistant; the user has to provide this themselves.")};var w=y.repeated?(0,xe.o$)(p,h):void 0,k=je(r,!!w,w?(null!==(d=g[null!==(c=(0,we.gh)(w))&&void 0!==c?c:"root"])&&void 0!==d?d:[]).length:0,t);if(k)return qe({ok:!1},k);if("number"==typeof r&&Array.isArray(m)&&!m[r])return{ok:!1,errorType:"hidden",error:"Row ".concat(r," of field '").concat(t,"' is hidden right now.")};var S=n;"phone_number"===b&&"number"==typeof S&&Number.isFinite(S)&&(S=String(Math.trunc(S)));var C=function(e,t,n){var r,o=e.type,i=e.key,a=null!==(r=e.metadata)&&void 0!==r?r:{},l="number"==typeof e.min_length?e.min_length:void 0,u="number"==typeof e.max_length?e.max_length:void 0;if("checkbox"===o)return"boolean"==typeof t?null:"Field '".concat(i,"' (checkbox) expects a boolean.");if($e.has(o))return"number"==typeof t&&Number.isFinite(t)?"number"==typeof l&&t<l?"Value below minimum (".concat(l,")."):"number"==typeof u&&t>u?"Value above maximum (".concat(u,")."):null:"Field '".concat(i,"' (").concat(o,") expects a number.");if("date_selector"===o)return"string"!=typeof t?"Field '".concat(i,"' (date_selector) expects a string."):/^\d{4}-\d{2}-\d{2}$/.test(t)?null:"Field '".concat(i,"' expects ISO date 'YYYY-MM-DD'.");if(Qe.has(o)){if("string"!=typeof t)return"Field '".concat(i,"' (").concat(o,") expects a single option value (string).");var s=tt(e,n).map((function(e){return e.value}));return s.length>0&&!s.includes(t)?"Value not in allowed options. Allowed: ".concat(s.join(", "),"."):null}if(et.has(o)){if(!Array.isArray(t)||!t.every((function(e){return"string"==typeof e})))return"Field '".concat(i,"' (").concat(o,") expects an array of option-value strings.");if("button_group"===o&&!a.multiple&&t.length>1)return"Field '".concat(i,"' (button_group) is single-select; pass at most one option.");var c=new Set(tt(e,n).map((function(e){return e.value})));if(c.size>0){var d=t.filter((function(e){return!c.has(e)}));if(d.length>0)return"Values not in allowed options: ".concat(d.join(", "),".")}return null}return Je.has(o)?"string"!=typeof t?"Field '".concat(i,"' (").concat(o,") expects a string."):"number"==typeof l&&t.length<l?"Value shorter than minimum length (".concat(l,")."):"number"==typeof u&&t.length>u?"Value exceeds maximum length (".concat(u,")."):null:null}(y,S,r);return C?{ok:!1,errorType:"shape_mismatch",error:C}:{ok:!0,field:h,servar:y,value:S}}(o,t,e.value,n)).ok?(i=r.field,a=r.servar,l=r.value,"gmap_state"!==a.type?[3,1]:(l=function(e,t){var n,r;if("string"!=typeof e||!e)return e;var o=!!(null===(n=t.metadata)||void 0===n?void 0:n.store_abbreviation),i=null===(r=t.metadata)||void 0===r?void 0:r.default_country,a=(i&&"auto"!==i?i:"us").toLowerCase(),l=Ve.P3[a];if(!l||0===l.length)return e;var u=e.toLowerCase(),s=l.find((function(e){return e.code.toLowerCase()===u||e.name.toLowerCase()===u}));return s?o?s.code:s.name:e}(l,a),[3,3])):[2,{fieldKey:t,repeatIndex:n,ok:!1,errorType:r.errorType,error:r.error}]:[2,{fieldKey:t,repeatIndex:n,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}];case 1:return"phone_number"!==a.type?[3,3]:[4,nt(l,a,o,t)];case 2:l=u.sent(),u.label=3;case 3:return[2,{fieldKey:t,repeatIndex:n,field:i,normalized:l}]}}))}))})))]):[2,{results:t.map((function(e){var t="string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",n=Number.isInteger(null==e?void 0:e.repeatIndex)?e.repeatIndex:void 0;return t?{fieldKey:t,repeatIndex:n,ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}:{fieldKey:t,repeatIndex:n,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}}))}];case 1:return u=d.sent(),s=u.map((function(e){var t,n;if("ok"in e)return e;var r="number"==typeof e.repeatIndex?qe(qe({},e.field),{repeat:e.repeatIndex}):e.field;try{i.changeValue(e.normalized,r,null!==(t=e.repeatIndex)&&void 0!==t?t:null)}catch(t){return{fieldKey:e.fieldKey,repeatIndex:e.repeatIndex,ok:!1,errorType:"dispatch_failed",error:t instanceof Error?t.message:String(t)}}var o=l.get(e.fieldKey),a=void 0!==e.repeatIndex?Array.isArray(o)&&null!==(n=o[e.repeatIndex])&&void 0!==n?n:null:null!=o?o:null;return{fieldKey:e.fieldKey,repeatIndex:e.repeatIndex,ok:!0,value:e.normalized,priorValue:a}})),[2,{results:s}]}}))}))}var ot=function(){return ot=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ot.apply(this,arguments)},it=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},at=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function lt(e,t,n){var r,o,i,a,l,u,s,c,d,p,f,h;return d=this,p=void 0,h=function(){var d,p,f,h,v,y,b,g,m,x,w,k,S,C,_,A,T,I,Z,R,j,E,L,O,B,K,M,W,z,N,F,P;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(D){switch(D.label){case 0:if(d=Number.isInteger(n)?n:null,!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(p=ge.Z[e])||!p.currentStep||!p.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if("string"!=typeof t||0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"elementId is required."}];if(f=function(e,t){var n,r,o,i=null==e?void 0:e.currentStep;if(!i)return null;var a=[[i.buttons,"button"],[i.texts,"text"],[i.subgrids,"container"]];try{for(var l=it(a),u=l.next();!u.done;u=l.next()){var s=at(u.value,2),c=s[0],d=s[1],p=(null!=c?c:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(p){var f=null===(o=null==p?void 0:p.properties)||void 0===o?void 0:o.actions;return{element:p,elementType:d,actions:Array.isArray(f)?f:[],position:Array.isArray(p.position)?p.position:[]}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}(p,t),!f)return[2,{ok:!1,errorType:"not_on_step",error:"Element '".concat(t,"' is not on the current step.")}];if(h=null!==(r=p.visiblePositions)&&void 0!==r?r:{},v=h[null!==(o=(0,we.gh)(f.element))&&void 0!==o?o:"root"],Array.isArray(v)&&!v.some(Boolean))return[2,{ok:!1,errorType:"hidden",error:"Element '".concat(t,"' is on the current step but is hidden right now.")}];if("button"===f.elementType&&(y=!(!(null===(i=p.formSettings)||void 0===i?void 0:i.readOnly)&&"readOnly"!==be.Hi.collaboratorReview),(0,Se.A)(f.element,p.currentStep,h,y)))return[2,{ok:!1,errorType:"disabled",error:"Button '".concat(t,"' is disabled and cannot be clicked.")}];if(b=f.element.repeated?f.element:(0,xe.o$)(p.currentStep,f.element),g=b?(null!==(l=h[null!==(a=(0,we.gh)(b))&&void 0!==a?a:"root"])&&void 0!==l?l:[]).length:0,m=je(d,!!b,g,t))return[2,ot({ok:!1},m)];if("number"==typeof d&&Array.isArray(v)&&!v[d])return[2,{ok:!1,errorType:"hidden",error:"Row ".concat(d," of element '").concat(t,"' is hidden right now.")}];x=p.assistantClient,w=null!==(u=Ie(p))&&void 0!==u?u:"",k=Ze(p),S="number"==typeof d?ot(ot({},f.element),{repeat:d}):f.element,D.label=1;case 1:return D.trys.push([1,13,,14]),"button"!==f.elementType?[3,3]:[4,x.click(S)];case 2:return D.sent(),[3,12];case 3:return C=Re(p.currentStep.subgrids,f.position),[4,x.runActions({actions:f.actions,element:S,elementType:f.elementType})];case 4:D.sent(),D.label=5;case 5:D.trys.push([5,10,11,12]),_=it(C),A=_.next(),D.label=6;case 6:return A.done?[3,9]:(T=A.value,I=null===(s=null==T?void 0:T.properties)||void 0===s?void 0:s.actions,Z="number"==typeof d&&!!b&&T.position.length>=b.position.length,[4,x.runActions({actions:Array.isArray(I)?I:[],element:Z?ot(ot({},T),{repeat:d}):T,elementType:"container"})]);case 7:D.sent(),D.label=8;case 8:return A=_.next(),[3,6];case 9:return[3,12];case 10:return R=D.sent(),z={error:R},[3,12];case 11:try{A&&!A.done&&(N=_.return)&&N.call(_)}finally{if(z)throw z.error}return[7];case 12:return[3,14];case 13:return[2,{ok:!1,errorType:"dispatch_failed",error:(j=D.sent())instanceof Error?j.message:String(j)}];case 14:E=null!==(c=Ie(p))&&void 0!==c?c:w,L=Ze(p),O={};try{for(B=it(Object.keys(L)),K=B.next();!K.done;K=B.next())M=K.value,L[M]!==k[M]&&(O[M]=L[M])}catch(e){F={error:e}}finally{try{K&&!K.done&&(P=B.return)&&P.call(B)}finally{if(F)throw F.error}}return W="button"===f.elementType?O[t]:void 0,delete O[t],[2,ot(ot({ok:!0,navigated:E!==w?{fromStepKey:w,toStepKey:E}:null},W?{buttonError:W}:{}),Object.keys(O).length>0?{fieldErrors:O}:{})]}}))},new((f=void 0)||(f=Promise))((function(e,t){function n(e){try{o(h.next(e))}catch(e){t(e)}}function r(e){try{o(h.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof f?o:new f((function(e){e(o)}))).then(n,r)}o((h=h.apply(d,p||[])).next())}))}var ut=function(){return ut=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ut.apply(this,arguments)};function st(e,t){var n,r,o,i,a,l,u;return i=this,a=void 0,u=function(){var i,a,l,u,s,c,d,p,f,h,v,y,b,g;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(m){switch(m.label){case 0:if(!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(i=ge.Z[e])||!i.currentStep||!i.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"stepKey is required."}];if(a=function(e){var t,n,r=null==e?void 0:e.currentStep;if(!r)return[];var o=[],i=new Set,a=(0,be._5)();return(null!==(t=r.progress_bars)&&void 0!==t?t:[]).forEach((function(t){var n,l,u,s;if((null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.stepper)&&Fe(e,t)){var c=!!(null===(l=t.properties)||void 0===l?void 0:l.navigate_to_all_steps);(null!==(s=null===(u=t.properties)||void 0===u?void 0:u.entries)&&void 0!==s?s:[]).forEach((function(e){var n=null==e?void 0:e.step_key;if(n&&!i.has(n)&&(0,Ae.V)(e)){var l=n===r.key;(0,Ae.D)(l,c,a.has(n))&&(i.add(n),o.push({stepKey:n,element:t,elementType:"progress_bar"}))}}))}})),(null!==(n=r.tabs)&&void 0!==n?n:[]).forEach((function(t){var n,a;Fe(e,t)&&(null!==(a=null===(n=t.properties)||void 0===n?void 0:n.entries)&&void 0!==a?a:[]).forEach((function(e){var n=null==e?void 0:e.step_key;n&&n!==r.key&&!i.has(n)&&(i.add(n),o.push({stepKey:n,element:t,elementType:"tab"}))}))})),o}(i).find((function(e){return e.stepKey===t})),!a)return[2,{ok:!1,errorType:"step_not_allowed",error:"Step '".concat(t,"' is not reachable through a navigation surface right now.")}];l=i.assistantClient,u=null!==(n=Ie(i))&&void 0!==n?n:"",s=Ze(i),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,l.runActions(ut({actions:[{type:Ce.Eb,next_step_key:t}],element:a.element,elementType:a.elementType},"tab"===a.elementType?{submit:!!(null===(r=a.element.properties)||void 0===r?void 0:r.submit)}:{}))];case 2:return m.sent(),[3,4];case 3:return[2,{ok:!1,errorType:"dispatch_failed",error:(c=m.sent())instanceof Error?c.message:String(c)}];case 4:d=null!==(o=Ie(i))&&void 0!==o?o:u,p=Ze(i),f={};try{for(h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(p)),v=h.next();!v.done;v=h.next())y=v.value,p[y]!==s[y]&&(f[y]=p[y])}catch(e){b={error:e}}finally{try{v&&!v.done&&(g=h.return)&&g.call(h)}finally{if(b)throw b.error}}return[2,ut({ok:!0,navigated:d!==u?{fromStepKey:u,toStepKey:d}:null},Object.keys(f).length>0?{fieldErrors:f}:{})]}}))},new((l=void 0)||(l=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof l?o:new l((function(e){e(o)}))).then(n,r)}o((u=u.apply(i,a||[])).next())}))}var ct=function(){return ct=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ct.apply(this,arguments)};function dt(e,t,n,r){var o,i,a,l,u,s,c;return l=this,u=void 0,c=function(){var l,u,s,c,d,p,f,h,v,y,b,g,m,x,w,k,S,C;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(_){switch(_.label){case 0:if(!(l=Ee(e,t)).ok)return[2,l];if(u=l.found,s=u.state,c=u.table,d=u.rowCount,p="string"==typeof r&&r.length>0,void 0!==r&&!p)return[2,{ok:!1,errorType:"shape_mismatch",error:"actionLabel must be a non-empty string when provided."}];if(!Number.isInteger(n)||n<0)return[2,{ok:!1,errorType:"shape_mismatch",error:"rowIndex must be a non-negative integer."}];if(p){if(!(Array.isArray(null===(o=null==c?void 0:c.properties)||void 0===o?void 0:o.actions)?c.properties.actions:[]).some((function(e){return(null==e?void 0:e.label)===r})))return[2,{ok:!1,errorType:"unknown_action",error:"Table '".concat(t,"' has no action labeled '").concat(r,"'.")}]}else if(Le(c,d).canEditCells)return[2,{ok:!1,errorType:"not_allowed",error:"Table '".concat(t,"' is editable, so bare row clicks are not wired; use a named action.")}];if(n>=d)return[2,{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(n," is out of range (table has ").concat(d," row").concat(1===d?"":"s",").")}];f=function(e,t){var n,r,o,i,a={};try{for(var l=Te(e.columns),u=l.next();!u.done;u=l.next()){var s=u.value;if(null==s?void 0:s.field_key){var c=null===(i=null===(o=e.state.fields)||void 0===o?void 0:o[s.field_key])||void 0===i?void 0:i.value,d=Array.isArray(c)?c[t]:c;a[s.name]=d}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return a}(l.found,n),h=null!==(i=Ie(s))&&void 0!==i?i:"",v=Ze(s),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,s.assistantClient.runTableAction({table:c,payload:p?{action:r,rowIndex:n,rowData:f}:{rowIndex:n,rowData:f}})];case 2:return _.sent(),[3,4];case 3:return[2,{ok:!1,errorType:"dispatch_failed",error:(y=_.sent())instanceof Error?y.message:String(y)}];case 4:b=null!==(a=Ie(s))&&void 0!==a?a:h,g=Ze(s),m={};try{for(x=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(g)),w=x.next();!w.done;w=x.next())k=w.value,g[k]!==v[k]&&(m[k]=g[k])}catch(e){S={error:e}}finally{try{w&&!w.done&&(C=x.return)&&C.call(x)}finally{if(S)throw S.error}}return[2,ct({ok:!0,navigated:b!==h?{fromStepKey:h,toStepKey:b}:null},Object.keys(m).length>0?{fieldErrors:m}:{})]}}))},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function r(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof s?o:new s((function(e){e(o)}))).then(n,r)}o((c=c.apply(l,u||[])).next())}))}var pt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},ft=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},ht=function(e,t){return!Number.isInteger(e)||e<0?{ok:!1,errorType:"shape_mismatch",error:"rowIndex must be a non-negative integer."}:e>=t?{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(e," is out of range (table has ").concat(t," row").concat(1===t?"":"s",").")}:null},vt={add:"adding rows",del:"deleting rows",edit:"cell editing"},yt=function(e,t,n,r){var o=Le(e,r);return"add"===n&&o.canAddRows||"del"===n&&o.canDeleteRows||"edit"===n&&o.canEditCells?null:{ok:!1,errorType:"not_allowed",error:"Table '".concat(t,"' does not allow ").concat(vt[n],".")}};function bt(e,t){return pt(this,void 0,void 0,(function(){var n,r,o,i,a,l;return ft(this,(function(u){if(!(n=Ee(e,t)).ok)return[2,n];if(r=n.found,o=r.state,i=r.table,a=r.rowCount,l=yt(i,t,"add",a))return[2,l];try{if(!o.assistantClient.addTableRow(t))return[2,{ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}]}catch(e){return[2,{ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}]}return[2,{ok:!0}]}))}))}function gt(e,t,n){return pt(this,void 0,void 0,(function(){var r,o,i,a,l,u,s;return ft(this,(function(c){if(!(r=Ee(e,t)).ok)return[2,r];if(o=r.found,i=o.state,a=o.table,l=o.rowCount,u=yt(a,t,"del",l))return[2,u];if(s=ht(n,l))return[2,s];try{if(!i.assistantClient.deleteTableRow(t,n))return[2,{ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}]}catch(e){return[2,{ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}]}return[2,{ok:!0}]}))}))}function mt(e,t,n){var r;return pt(this,void 0,void 0,(function(){var o,i,a,l,u,s,c,d,p,f,h,v,y,b,g,m,x;return ft(this,(function(w){if(o=(Array.isArray(n)?n:[]).map((function(e){return{rowIndex:"number"==typeof(null==e?void 0:e.rowIndex)?e.rowIndex:NaN,fieldKey:"string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",value:null==e?void 0:e.value}})),i=function(e,t){return{results:o.map((function(n){return{rowIndex:n.rowIndex,fieldKey:n.fieldKey,ok:!1,errorType:e,error:t}}))}},!(a=Ee(e,t)).ok)return[2,i(a.errorType,a.error)];if(l=a.found,u=l.state,s=l.table,c=l.columns,d=l.rowCount,p=yt(s,t,"edit",d))return[2,i(p.errorType,p.error)];f=new Map(o.filter((function(e){return e.fieldKey})).map((function(e){var t,n,r=null===(n=null===(t=u.fields)||void 0===t?void 0:t[e.fieldKey])||void 0===n?void 0:n.value,o=Array.isArray(r)?r[e.rowIndex]:void 0;return["".concat(e.fieldKey,":").concat(e.rowIndex),null==o?null:JSON.parse(JSON.stringify(o))]}))),h=[],v=function(e){var n=e.rowIndex,o=e.fieldKey,i=e.value;if(!o)return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}),"continue";if(!c.some((function(e){return(null==e?void 0:e.field_key)===o})))return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"unknown_field",error:"Table '".concat(t,"' has no column with fieldKey '").concat(o,"'.")}),"continue";var a=ht(n,d);if(a)return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:a.errorType,error:a.error}),"continue";var l=null==i?"":String(i);try{if(!u.assistantClient.editTableCell(t,n,o,l))return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}),"continue"}catch(e){return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}),"continue"}h.push({rowIndex:n,fieldKey:o,ok:!0,value:l,priorValue:null!==(r=f.get("".concat(o,":").concat(n)))&&void 0!==r?r:null})};try{for(y=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),b=y.next();!b.done;b=y.next())g=b.value,v(g)}catch(e){m={error:e}}finally{try{b&&!b.done&&(x=y.return)&&x.call(y)}finally{if(m)throw m.error}}return[2,{results:h}]}))}))}var xt=function(){return xt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},xt.apply(this,arguments)},wt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},kt=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},St=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Ct=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},_t="feathery.assistant.mode",At="current",Tt=function(){try{var e=(0,A.Kv)().localStorage.getItem(_t);return"current"===(t=e)||"sidebar-left"===t||"sidebar-right"===t||"fullscreen"===t?e:At}catch(e){return At}var t},It="feathery.assistant.sidebarWidth",Zt=400,Rt=function(e){var t=Math.max(280,function(){try{return Math.min(800,Math.floor(.6*(0,A.Kv)().innerWidth))}catch(e){return 800}}());return e<280?280:e>t?t:e},jt=function(){try{var e=(0,A.Kv)().localStorage.getItem(It),t=e?parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?Rt(t):Zt}catch(e){return Zt}},Et=function(e){try{(0,A.Kv)().localStorage.setItem(It,String(e))}catch(e){}},Lt=["current","sidebar-left","sidebar-right","fullscreen"];const Ot=function(e){var t,n,u,c=e.instanceId,p=e.getTargets,h=e.getJwt,S=e.baseUrl,W=e.bottom,N=void 0===W?20:W,P=e.color,D=e.voiceEnabled,X=void 0!==D&&D,U=e.workflowActions,V=void 0===U?[]:U,q=e.allowedModes,H=void 0===q?Lt:q,G=e.onLayoutChange,Y=(0,o.useMemo)((function(){if(h)return function(){return{Authorization:"Bearer ".concat(h())}};var e=(0,be.JQ)().sdkKey;return function(){var t={Authorization:"Token ".concat(e)},n=(0,A.ej)("feathery_session_token");return n&&(t["X-Feathery-Session"]=n),t}}),[h]),J=St((0,o.useState)(!1),2),$=J[0],Q=J[1],te=St((0,o.useState)(Tt),2),re=te[0],oe=te[1],ie=(0,o.useCallback)((function(e){oe(e),function(e){try{(0,A.Kv)().localStorage.setItem(_t,e)}catch(e){}}(e)}),[]),ae=St((0,o.useState)(jt),2),le=ae[0],ue=ae[1],se=St((0,o.useState)(!1),2),me=se[0],Ae=se[1];(0,o.useEffect)((function(){var e=function(){ue((function(e){var t=Rt(e);return t!==e&&Et(t),t}))};return(0,A.Kv)().addEventListener("resize",e),function(){return(0,A.Kv)().removeEventListener("resize",e)}}),[]);var Te=(0,o.useCallback)((function(e){return function(t){if(0===t.button){t.preventDefault(),Ae(!0);var n=(0,A.me)().body;n.style.cursor="col-resize",n.style.userSelect="none";var r=le,o=function(t){var n="right"===e?(0,A.Kv)().innerWidth-t.clientX:t.clientX;r=Rt(n),ue(r)},i=function(){(0,A.Kv)().removeEventListener("pointermove",o),(0,A.Kv)().removeEventListener("pointerup",i),(0,A.Kv)().removeEventListener("pointercancel",i),Ae(!1),n.style.cursor="",n.style.userSelect="",Et(r)};(0,A.Kv)().addEventListener("pointermove",o),(0,A.Kv)().addEventListener("pointerup",i),(0,A.Kv)().addEventListener("pointercancel",i)}}}),[le]),Ie=(0,o.useCallback)((function(){ue(Zt),Et(Zt)}),[]),Ze=St((0,o.useState)(""),2),je=Ze[0],Ee=Ze[1],De=St((0,o.useState)([]),2),Ue=De[0],Ve=De[1],qe=St((0,o.useState)(null),2),He=qe[0],Ge=qe[1],Ye=St((0,o.useState)(!1),2),Je=Ye[0],$e=Ye[1],Qe=St((0,o.useState)(!1),2),et=Qe[0],tt=Qe[1],nt=St((0,o.useState)(null),2),ot=nt[0],it=nt[1],at=(0,o.useRef)(null),ut=(0,o.useRef)(!0),ct=(0,o.useRef)(!1),pt=(0,o.useRef)(null),ft=(0,o.useRef)(null),ht=(0,o.useCallback)((function(){var e=at.current;if(e){var t=e.scrollHeight-e.scrollTop-e.clientHeight;ut.current=t<60}}),[]),vt=(0,o.useCallback)((function(){var e=at.current;e&&ut.current&&(e.scrollTop=e.scrollHeight)}),[]),yt=(0,o.useMemo)((function(){return{primary:e=P||O,hover:F(e,-15),disabled:F(e,30),light:(t=e,90,n=parseInt(t.replace("#",""),16),r=n>>16&255,o=n>>8&255,i=255&n,.9,a=Math.round(r+.9*(255-r)),l=Math.round(o+.9*(255-o)),u=Math.round(i+.9*(255-i)),"#".concat((a<<16|l<<8|u).toString(16).padStart(6,"0")))};var e,t,n,r,o,i,a,l,u}),[P]),At=function(e,t,n){void 0===t&&(t=[]);var r=e,o=!!n,i=function(e){if(!o&&e){o=!0;var t=r||null,n={},i=p();if(i.length>0&&(n.targets=i),c){var a=function(e){var t,n;return null===(n=null===(t=ge.Z[e])||void 0===t?void 0:t.currentStep)||void 0===n?void 0:n.key}(c);a&&(n.current_step=a)}(function(e,t,n,r,o){return pe(void 0,void 0,void 0,(function(){var i,a,l;return fe(this,(function(u){switch(u.label){case 0:return[4,fetch("".concat(e,"threads/title/"),{method:"POST",headers:de(de({},t()),{"Content-Type":"application/json"}),body:JSON.stringify(de({message:r,thread_id:null!=n?n:void 0},null!=o?o:{}))})];case 1:return(i=u.sent()).ok?[4,i.json()]:[2,null];case 2:return a=u.sent(),[2,null!==(l=a.title)&&void 0!==l?l:null]}}))}))})(S,Y,t,e,n).then((function(e){e&&Ve((function(n){return n.map((function(n){return n.id===t||n.chat===s?xt(xt({},n),{title:e}):n}))}))}))}},u=new l.PD({api:S,headers:Y,body:function(){return xt(xt({},function(){var e={},t=p();if(t.length>0&&(e.targets=t),c){var n=function(e){var t,n,r,o,i,a,l,u,s,c,d,p,f,h,v,y,b,g,m=ge.Z[e];if(!m||!m.currentStep)return null;var x=m.currentStep,w=null!==(i=m.visiblePositions)&&void 0!==i?i:{},k=null!==(a=m.fields)&&void 0!==a?a:{},S=null!==(l=m.inlineErrors)&&void 0!==l?l:{},C=m.logicRules,_=!(!(null===(u=m.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==be.Hi.collaboratorReview),A=(null!==(s=x.subgrids)&&void 0!==s?s:[]).filter((function(e){var t,n,r=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.actions;return!!(Array.isArray(r)&&r.length>0)||Xe(C,"action",x.id,null!==(n=e.id)&&void 0!==n?n:"")})),T=function(e){return Re(A,Array.isArray(null==e?void 0:e.position)?e.position:[]).map((function(e){var t;return null!==(t=e.id)&&void 0!==t?t:""}))},I={};(0,xe.bW)(x).forEach((function(e){var t=null==e?void 0:e.id;if(t){var n=w[(0,we.gh)(e)];Array.isArray(n)&&(I[t]=n.length)}}));var Z=(null!==(c=x.servar_fields)&&void 0!==c?c:[]).map((function(e){var t,n,r,o,i,a,l,u,s,c,d,p=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",f=w[p],h=!Array.isArray(f)||f.some(Boolean),v=k[e.servar.key],y=null!==(n=e.properties)&&void 0!==n?n:{},b="string"==typeof y.placeholder&&y.placeholder.trim()?ze(y.placeholder):void 0,g="string"==typeof y.tooltipText&&y.tooltipText.trim()?ze(y.tooltipText):void 0,m=null===(r=S[e.servar.key])||void 0===r?void 0:r.message,A=null!==(o=e.servar)&&void 0!==o?o:{},Z=null!==(i=A.metadata)&&void 0!==i?i:{},R=!!A.repeated,j=R?(0,xe.o$)(x,e):void 0,E=null!==(a=null==j?void 0:j.id)&&void 0!==a?a:"",L=Array.isArray(Z.options)?Z.options:null,O=Array.isArray(Z.labels)?Z.labels:[],B=L?L.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=O[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}})):void 0,K=Array.isArray(Z.repeat_options)?Z.repeat_options.map((function(e){return Array.isArray(e)?e.map((function(e){var t,n,r,o,i;return{value:String(null!==(n=null!==(t=null==e?void 0:e.value)&&void 0!==t?t:e)&&void 0!==n?n:""),label:String(null!==(i=null!==(o=null!==(r=null==e?void 0:e.label)&&void 0!==r?r:null==e?void 0:e.value)&&void 0!==o?o:e)&&void 0!==i?i:"")}})):null})):void 0,M=null!==(u=null!==(l=I[E])&&void 0!==l?l:null==K?void 0:K.length)&&void 0!==u?u:0,W=K?Array.from({length:M},(function(e,t){return Array.isArray(K[t])?K[t]:null})):void 0,z=Array.isArray(Z.questions)?Z.questions:null,N=z?z.map((function(e){var t,n;return{id:String(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:""),label:String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:"")}})).filter((function(e){return e.id||e.label})):void 0,F=Ke(Ke([],Be(Array.isArray(Z.file_types)?Z.file_types:[]),!1),Be(Array.isArray(Z.custom_file_types)?Z.custom_file_types.map((function(e){return".".concat(e)})):[]),!1),P=Z.min_val_label||Z.max_val_label?Oe(Oe({},Z.min_val_label?{min:String(Z.min_val_label)}:{}),Z.max_val_label?{max:String(Z.max_val_label)}:{}):void 0,D=!(!y.disabled&&!_),X=Xe(C,"change",x.id,null!==(s=A.id)&&void 0!==s?s:""),U=T(e),V=null!==(c=null==v?void 0:v.value)&&void 0!==c?c:null,q=R?null!==(d=I[E])&&void 0!==d?d:Array.isArray(V)?V.length:0:void 0;if("number"==typeof q&&q>0){var H=Array.isArray(V)?V:[];H.length<q&&(V=Ke(Ke([],Be(H),!1),Be(Array(q-H.length).fill((0,ke.oe)(e))),!1))}return Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe(Oe({key:A.key,type:A.type,value:V,visible:h,disabled:D,required:!!A.required},"number"==typeof q?{rowCount:q}:{}),(null==j?void 0:j.id)?{repeatContainerId:j.id}:{}),X?{hasLogicRules:!0}:{}),U.length>0?{clickableAncestorIds:U}:{}),b?{placeholder:b}:{}),g?{tooltip:g}:{}),m?{error:m}:{}),B?{options:B}:{}),W?{rowOptions:W}:{}),N?{questions:N}:{}),"number"==typeof A.min_length?{minLength:A.min_length}:{}),"number"==typeof A.max_length?{maxLength:A.max_length}:{}),A.format?{format:String(A.format)}:{}),F.length>0?{fileTypes:F}:{}),Z.multiple?{multipleFiles:!0}:{}),"button_group"===A.type?{multiple:!!Z.multiple}:{}),P?{sliderLabels:P}:{}),"number"==typeof Z.step_size?{stepSize:Z.step_size}:{})})),R=new Set;try{for(var j=Me(Object.keys(null!==(d=m.steps)&&void 0!==d?d:{})),E=j.next();!E.done;E=j.next()){var L=E.value,O=m.steps[L];(null!==(p=null==O?void 0:O.servar_fields)&&void 0!==p?p:[]).forEach((function(e){var t;(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)&&R.add(e.servar.key)}))}}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=j.return)&&n.call(j)}finally{if(t)throw t.error}}var B=function(e){return!(null==e||"string"==typeof e&&""===e||Array.isArray(e)&&0===e.length)},K={},M={};try{for(var W=Me(Object.keys(k)),z=W.next();!z.done;z=W.next()){var N=z.value,F=null!==(h=null===(f=k[N])||void 0===f?void 0:f.value)&&void 0!==h?h:null;R.has(N)?K[N]=F:B(F)&&(M[N]=F)}}catch(e){r={error:e}}finally{try{z&&!z.done&&(o=W.return)&&o.call(W)}finally{if(r)throw r.error}}var P=[],D=function(e){return Fe(m,e)};A.forEach((function(e){var t,n,r,o=e.properties.actions,i=Xe(C,"action",x.id,null!==(t=e.id)&&void 0!==t?t:""),a=T(e),l=e.repeated?e.id:null===(n=(0,xe.o$)(x,e))||void 0===n?void 0:n.id;P.push(Oe(Oe(Oe({type:"container",id:null!==(r=e.id)&&void 0!==r?r:"",visible:D(e),actions:o},i?{hasLogicRules:!0}:{}),a.length>0?{clickableAncestorIds:a}:{}),l?{repeatContainerId:l}:{}))})),(null!==(v=x.texts)&&void 0!==v?v:[]).forEach((function(e){var t,n,r,o,i=We(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(i){var a=ze(i),l=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},u=Array.isArray(l.actions)?l.actions:[],s=Xe(C,"action",x.id,null!==(r=e.id)&&void 0!==r?r:""),c=T(e),d=null===(o=(0,xe.o$)(x,e))||void 0===o?void 0:o.id;P.push(Oe(Oe(Oe(Oe(Oe(Oe({type:"text",text:a,visible:D(e)},e.id?{id:e.id}:{}),i!==a?{templateText:i}:{}),u.length>0?{actions:u}:{}),s?{hasLogicRules:!0}:{}),c.length>0?{clickableAncestorIds:c}:{}),d?{repeatContainerId:d}:{}))}})),(null!==(y=x.buttons)&&void 0!==y?y:[]).forEach((function(e){var t,n,r,o,i,a,l,u=We(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{}),s=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},c=Array.isArray(s.actions)?s.actions:[],d=Xe(C,"action",x.id,null!==(r=e.id)&&void 0!==r?r:"")||!!s.submit&&(Xe(C,"submit",x.id,"")||Xe(C,"form_complete",x.id,""));if(u||0!==c.length||s.submit||d){var p,f=null===(o=(0,xe.o$)(x,e))||void 0===o?void 0:o.id,h=c.map((function(e){return null==e?void 0:e.type}));h.includes(Ce.Md)?p=(0,_e.aL)(x,null!==(i=m.backNavMap)&&void 0!==i?i:{})||void 0:h.includes(Ce.Eb)?p=(0,_e.h6)(null!==(a=x.next_conditions)&&void 0!==a?a:[],{elementType:"button",elementIDs:[e.id]})||void 0:s.submit&&(p=null),P.push(Oe(Oe(Oe({type:"button",id:null!==(l=e.id)&&void 0!==l?l:"",text:ze(u),visible:D(e),disabled:(0,Se.A)(e,x,w,_),submit:!!s.submit,actions:c},void 0!==p?{navigatesTo:p}:{}),d?{hasLogicRules:!0}:{}),f?{repeatContainerId:f}:{}))}})),(null!==(b=x.images)&&void 0!==b?b:[]).forEach((function(e){var t,n=null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{},r="string"==typeof n.alt_text&&n.alt_text||"string"==typeof n.caption&&n.caption||"";if(r){var o=T(e);P.push(Oe({type:"image",text:ze(r),visible:D(e)},o.length>0?{clickableAncestorIds:o}:{}))}}));var X=[];return(null!==(g=x.tables)&&void 0!==g?g:[]).forEach((function(e){var t,n,r,o,i,a=null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.columns)&&void 0!==n?n:[];if(0!==a.length){var l=a.reduce((function(e,t){var n,r=t.field_key?null===(n=k[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0),u=Array.from({length:l},(function(e,t){return a.map((function(e){var n,r,o=e.field_key?null===(n=k[e.field_key])||void 0===n?void 0:n.value:null;return Array.isArray(o)?null!==(r=o[t])&&void 0!==r?r:null:null!=o?o:null}))})),s=(Array.isArray(null===(r=null==e?void 0:e.properties)||void 0===r?void 0:r.actions)?e.properties.actions:[]).map((function(e){return{label:"string"==typeof(null==e?void 0:e.label)?e.label:""}})).filter((function(e){return e.label.trim().length>0})),c=Le(e,l),d=c.canEditCells,p=c.canAddRows,f=c.canDeleteRows,h=Xe(C,"action",x.id,null!==(o=e.id)&&void 0!==o?o:"");X.push(Oe(Oe(Oe(Oe(Oe(Oe({id:null!==(i=e.id)&&void 0!==i?i:"",columns:a.map((function(e){var t,n,r;return{name:null!==(n=null!==(t=e.name)&&void 0!==t?t:e.field_key)&&void 0!==n?n:"",fieldKey:null!==(r=e.field_key)&&void 0!==r?r:""}})),rows:u},s.length>0?{actions:s}:{}),p?{canAddRows:!0}:{}),f?{canDeleteRows:!0}:{}),d?{canEditCells:!0}:{}),h?{hasLogicRules:!0}:{}),{visible:D(e)}))}})),{currentStep:{id:x.id,key:x.key},previousStepName:m.previousStepName||void 0,activeStepKey:x.key,navigationSurfaces:Pe(m),currentStepFields:Z,currentStepElements:P,currentStepTables:X,values:K,hiddenFieldValues:M}}(c);n&&(e.panel_runtime=n)}return e}()),{thread_id:r||null})},fetch:function(e,t){return wt(void 0,void 0,void 0,(function(){var n,o,a,l,u,c,d,p;return kt(this,(function(f){switch(f.label){case 0:return ct.current?((o=new FormData).append("payload","string"==typeof(null==t?void 0:t.body)?t.body:JSON.stringify(null!==(u=null==t?void 0:t.body)&&void 0!==u?u:{})),(a=pt.current)&&(o.append("audio",a,"speech.wav"),pt.current=null),[4,fetch("".concat(S,"voice/turn/"),{method:"POST",headers:Y(),body:o,signal:null==t?void 0:t.signal})]):[3,2];case 1:return n=f.sent(),[3,4];case 2:return[4,fetch(e,t)];case 3:n=f.sent(),f.label=4;case 4:return(l=n.headers.get("X-Thread-Id"))&&!r&&(r=l,Ve((function(e){return e.map((function(e){return e.chat===s?xt(xt({},e),{id:l,isTemporary:!1}):e}))})),Ge(l),ve(S,Y,l).then((function(e){e&&Ve((function(t){return t.map((function(t){return t.id===l?xt(xt({},e),{chat:s,title:t.title||e.title}):t}))}))}))),i(null===(p=null===(d=null===(c=s.messages.find((function(e){return"user"===e.role})))||void 0===c?void 0:c.parts)||void 0===d?void 0:d[0])||void 0===p?void 0:p.text),[2,n]}}))}))}}),s=new a.en({transport:u,messages:t,sendAutomaticallyWhen:l.Qk,onData:function(e){var t,n;"data-transcript"===(null==e?void 0:e.type)&&i(null===(t=e.data)||void 0===t?void 0:t.text),null===(n=ft.current)||void 0===n||n.call(ft,e)},onToolCall:function(e){var t=e.toolCall;return wt(void 0,void 0,void 0,(function(){var e,n,r,o,i,a,l,u,d,p,f,h,v,y,b,g,m,x,w,k,S,C;return kt(this,(function(_){switch(_.label){case 0:return t.dynamic?[2]:"setFieldValue"!==t.toolName?[3,2]:(e=null!==(g=t.input)&&void 0!==g?g:{},n=Array.isArray(e.fields)?e.fields:[],[4,rt(c,n)]);case 1:return b=_.sent(),s.addToolOutput({tool:"setFieldValue",toolCallId:t.toolCallId,output:b}),[3,14];case 2:return"clickElement"!==t.toolName?[3,4]:(r=null!==(m=t.input)&&void 0!==m?m:{},o="string"==typeof r.elementId?r.elementId:"",[4,lt(c,o,r.repeatIndex)]);case 3:return b=_.sent(),s.addToolOutput({tool:"clickElement",toolCallId:t.toolCallId,output:b}),[3,14];case 4:return"navigateToStep"!==t.toolName?[3,6]:(i=null!==(x=t.input)&&void 0!==x?x:{},a="string"==typeof i.stepKey?i.stepKey:"",[4,st(c,a)]);case 5:return b=_.sent(),s.addToolOutput({tool:"navigateToStep",toolCallId:t.toolCallId,output:b}),[3,14];case 6:return"triggerTableAction"!==t.toolName?[3,8]:(l=null!==(w=t.input)&&void 0!==w?w:{},v="string"==typeof l.tableId?l.tableId:"",f="number"==typeof l.rowIndex?l.rowIndex:NaN,u="string"==typeof l.actionLabel?l.actionLabel:void 0,[4,dt(c,v,f,u)]);case 7:return b=_.sent(),s.addToolOutput({tool:"triggerTableAction",toolCallId:t.toolCallId,output:b}),[3,14];case 8:return"addTableRow"!==t.toolName?[3,10]:(d=null!==(k=t.input)&&void 0!==k?k:{},v="string"==typeof d.tableId?d.tableId:"",[4,bt(c,v)]);case 9:return b=_.sent(),s.addToolOutput({tool:"addTableRow",toolCallId:t.toolCallId,output:b}),[3,14];case 10:return"deleteTableRow"!==t.toolName?[3,12]:(p=null!==(S=t.input)&&void 0!==S?S:{},v="string"==typeof p.tableId?p.tableId:"",f="number"==typeof p.rowIndex?p.rowIndex:NaN,[4,gt(c,v,f)]);case 11:return b=_.sent(),s.addToolOutput({tool:"deleteTableRow",toolCallId:t.toolCallId,output:b}),[3,14];case 12:return"setTableCellValue"!==t.toolName?[3,14]:(h=null!==(C=t.input)&&void 0!==C?C:{},v="string"==typeof h.tableId?h.tableId:"",y=Array.isArray(h.cells)?h.cells:[],[4,mt(c,v,y)]);case 13:b=_.sent(),s.addToolOutput({tool:"setTableCellValue",toolCallId:t.toolCallId,output:b}),_.label=14;case 14:return[2]}}))}))},onFinish:function(e){var t=e.isAbort,n=e.isError;t||n||!r||Ve((function(e){var t=e.find((function(e){return e.id===r}));return t?Ct([xt(xt({},t),{updated_at:(new Date).toISOString()})],St(e.filter((function(e){return e.id!==r}))),!1):e}))}});return s},It=(0,o.useMemo)((function(){return At(null)}),[Y,p,h]),Ot=Ue.find((function(e){return e.id===He})),Bt=null!==(u=null==Ot?void 0:Ot.chat)&&void 0!==u?u:It,Kt=(0,a.RJ)({chat:Bt}),Mt=Kt.messages,Wt=Kt.sendMessage,zt=Kt.setMessages,Nt=Kt.status,Ft=Kt.error,Pt=(0,o.useMemo)((function(){var e,t,n,r,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Mt),a=i.next();!a.done;a=i.next()){var l=a.value,u=o[o.length-1];u&&"assistant"===u.role&&"assistant"===l.role?o[o.length-1]=xt(xt({},u),{parts:Ct(Ct([],St(null!==(n=u.parts)&&void 0!==n?n:[]),!1),St(null!==(r=l.parts)&&void 0!==r?r:[]),!1)}):o.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o}),[Mt]);(0,o.useEffect)((function(){vt()}),[Pt,vt]),(0,o.useEffect)((function(){if("ready"===Nt){var e=(0,A.Kv)().requestAnimationFrame(vt);return function(){return(0,A.Kv)().cancelAnimationFrame(e)}}}),[Nt,vt]);var Dt=(0,o.useCallback)((function(){return wt(void 0,void 0,void 0,(function(){var e;return kt(this,(function(t){switch(t.label){case 0:return[4,he(S,Y)];case 1:return(e=t.sent())?(Ve((function(t){return Ct(Ct([],St(e.map((function(e){var n;return xt(xt({},e),{chat:null===(n=t.find((function(t){return t.id===e.id})))||void 0===n?void 0:n.chat})}))),!1),St(t.filter((function(t){return!e.find((function(e){return e.id===t.id}))}))),!1)})),[2]):[2]}}))}))}),[Y,S]);(0,o.useEffect)((function(){$&&Dt()}),[$,Dt]);var Xt=function(){Qt(),ut.current=!0;var e=(0,i.Z)(),t=(new Date).toISOString(),n=At(null);Ve((function(r){return Ct([{id:e,title:"",created_at:t,updated_at:t,isTemporary:!0,chat:n}],St(r.filter((function(e){return!e.isTemporary||e.title}))),!1)})),Ge(e)},Ut=(0,o.useCallback)((function(){ut.current=!0;var e=(new Date).toISOString();if(He)Ot&&!Ot.title&&Ve((function(t){return Ct([xt(xt({},Ot),{title:"New Chat",updated_at:e})],St(t.filter((function(e){return e.id!==He}))),!1)}));else{var t=(0,i.Z)();Ve((function(n){return Ct([{id:t,title:"New Chat",created_at:e,updated_at:e,isTemporary:!0,chat:Bt}],St(n),!1)})),Ge(t)}}),[He,Ot,Bt]),Vt=function(e){var t=this,n=e.status,r=e.sendMessage,a=e.setMessages,l=e.ensureThread,u=e.voiceActiveRef,s=e.pendingAudioRef,c=e.voiceDataRef,d=j((0,o.useState)("idle"),2),p=d[0],f=d[1],h=j((0,o.useState)(Z),1)[0],v=j((0,o.useState)(0),2),y=v[0],b=v[1],g=j((0,o.useState)(!1),2),m=g[0],x=g[1],w=(0,o.useRef)("idle"),k=(0,o.useRef)(n),S=(0,o.useRef)(null),C=(0,o.useRef)(null),_=(0,o.useRef)(0),A=(0,o.useRef)(!1),O=(0,o.useCallback)((function(e){w.current=e,f(e)}),[]),B=(0,o.useCallback)((function(){var e,t;u.current&&("ready"!==k.current&&"error"!==k.current||(null===(e=C.current)||void 0===e?void 0:e.isPlaying)||"transcribing"!==w.current&&"thinking"!==w.current&&"speaking"!==w.current||(null===(t=S.current)||void 0===t||t.resume(),O("listening")))}),[u,O]),K=(0,o.useCallback)((function(e){var t,n;"recording"!==w.current&&"listening"!==w.current||(s.current=e,null===(t=S.current)||void 0===t||t.pause(),null===(n=C.current)||void 0===n||n.skip(),_.current=0,A.current=!1,b(0),O("transcribing"),l(),r({text:""}))}),[s,l,r,O]),M=(0,o.useRef)(K);M.current=K;var W=(0,o.useCallback)((function(){return e=t,n=void 0,o=function(){var e,t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(n){switch(n.label){case 0:return"idle"!==w.current&&"error"!==w.current?[2]:(e=new T({onSegmentStart:function(){u.current&&O("speaking")},onSegmentProgress:function(e,t){return b(_.current+Math.floor(L(e)*t))},onSegmentEnd:function(e){_.current+=L(e),b(_.current)},onIdle:function(){x(!1),B()}}),t=new I({onSpeechStart:function(){"listening"===w.current&&O("recording")},onUtterance:function(e){return M.current(e)}}),C.current=e,S.current=t,u.current=!0,O("loading"),[4,t.start()]);case 1:return n.sent()?O("listening"):(u.current=!1,O("error")),[2]}}))},new((r=void 0)||(r=Promise))((function(t,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function l(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,l)}u((o=o.apply(e,n||[])).next())}));var e,n,r,o}),[u,B,O]),z=(0,o.useCallback)((function(){var e,t;null===(e=S.current)||void 0===e||e.destroy(),S.current=null,null===(t=C.current)||void 0===t||t.skip(),C.current=null,s.current=null,u.current=!1,O("idle")}),[u,s,O]),N=(0,o.useCallback)((function(){var e;"speaking"===w.current&&(A.current=!0,null===(e=C.current)||void 0===e||e.skip(),b(Number.MAX_SAFE_INTEGER))}),[]);return(0,o.useEffect)((function(){return c.current=function(e){var t,n,r,o,l,s,c;if(u.current)if("data-audio"===e.type)(null===(t=e.data)||void 0===t?void 0:t.done)?null===(n=C.current)||void 0===n||n.end():(null===(r=e.data)||void 0===r?void 0:r.chunk)&&!A.current&&(null===(o=C.current)||void 0===o||o.pushChunk(e.data.chunk));else if("data-segment"===e.type&&(null===(l=e.data)||void 0===l?void 0:l.text)){if(A.current)return;x(!0),null===(s=C.current)||void 0===s||s.pushSegment(e.data.text)}else if("data-transcript"===e.type&&(null===(c=e.data)||void 0===c?void 0:c.text)){var d=e.data.text;"transcribing"===w.current&&O("thinking"),a((function(e){for(var t=e.length-1;t>=0;t--)if("user"===e[t].role){var n=E([],j(e),!1);return n[t]=R(R({},e[t]),{parts:[{type:"text",text:d}]}),n}return E(E([],j(e),!1),[{id:(0,i.Z)(),role:"user",parts:[{type:"text",text:d}]}],!1)}))}},function(){c.current=null}}),[c,u,a,O]),(0,o.useEffect)((function(){k.current=n,"ready"!==n&&"error"!==n||!u.current||a((function(e){var t,n=e[e.length-1],r="user"===(null==n?void 0:n.role)&&!(null!==(t=n.parts)&&void 0!==t?t:[]).some((function(e){var t;return"text"===e.type&&(null!==(t=e.text)&&void 0!==t?t:"").trim()}));return r?e.slice(0,-1):e})),B()}),[n,B,u,a]),(0,o.useEffect)((function(){return function(){return z()}}),[z]),{voiceState:p,voiceActive:"idle"!==p&&"error"!==p,micAvailable:h,spokenChars:y,audioDraining:m,startVoice:W,stopVoice:z,skipSpeaking:N}}({status:Nt,sendMessage:function(e){return wt(void 0,void 0,void 0,(function(){return kt(this,(function(t){switch(t.label){case 0:return[4,Ne(c)];case 1:return t.sent(),[2,Wt(e)]}}))}))},setMessages:zt,ensureThread:Ut,voiceActiveRef:ct,pendingAudioRef:pt,voiceDataRef:ft}),qt=Vt.voiceState,Ht=Vt.voiceActive,Gt=Vt.micAvailable,Yt=Vt.spokenChars,Jt=Vt.audioDraining,$t=Vt.startVoice,Qt=Vt.stopVoice,en=Vt.skipSpeaking;(0,o.useEffect)((function(){vt()}),[Yt,Jt,vt]);var tn=function(){return wt(void 0,void 0,void 0,(function(){return kt(this,(function(e){switch(e.label){case 0:return je.trim()&&"ready"===Nt?(Ut(),[4,Ne(c)]):[3,2];case 1:e.sent(),Wt({text:je}),Ee(""),e.label=2;case 2:return[2]}}))}))},nn=Ue.filter((function(e){return e.title})),rn="submitted"===Nt||"streaming"===Nt,on={padding:"10px",backgroundColor:yt.primary,color:"white",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:yt.hover},":disabled":{backgroundColor:yt.disabled,cursor:"not-allowed"}},an="sidebar-left"===re?"left":"sidebar-right"===re?"right":null,ln=$&&an?le:0,un=(0,o.useRef)(G);un.current=G,(0,o.useEffect)((function(){var e;null===(e=un.current)||void 0===e||e.call(un,{mode:re,isOpen:$,side:an,width:ln,isResizing:me})}),[re,$,an,ln,me]);var sn="sidebar-left"===re?w:"sidebar-right"===re?k:"fullscreen"===re?f:x,cn="sidebar-left"===re?b:"sidebar-right"===re?g:"fullscreen"===re?m:y,dn="sidebar-left"===re,pn=dn?{left:"20px"}:{right:"20px"},fn=dn?20:N;if(!$)return(0,r.tZ)("button",xt({type:"button",onClick:function(){return Q(!0)},css:xt(xt({position:"fixed",bottom:"".concat(fn,"px")},pn),{width:"".concat(56,"px"),height:"".concat(56,"px"),borderRadius:"50%",backgroundColor:yt.primary,color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",transition:"transform 0.2s, box-shadow 0.2s, background-color 0.2s",zIndex:1e3,":hover":{backgroundColor:yt.hover,transform:"scale(1.05)",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})},{children:(0,r.tZ)(s,{})}));var hn="sidebar-left"===re?{top:0,left:0,width:"".concat(le,"px"),height:"100vh",borderRadius:0,boxShadow:"4px 0 24px rgba(0, 0, 0, 0.12)"}:"sidebar-right"===re?{top:0,right:0,width:"".concat(le,"px"),height:"100vh",borderRadius:0,boxShadow:"-4px 0 24px rgba(0, 0, 0, 0.12)"}:"fullscreen"===re?{inset:0,borderRadius:0,boxShadow:"none",border:"none"}:{bottom:"".concat(N,"px"),right:"20px",width:"".concat(380,"px"),height:"".concat(500,"px"),borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",border:"1px solid ".concat(K)};return(0,r.BX)("div",xt({css:xt({position:"fixed",backgroundColor:"white",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},hn)},{children:[an&&(0,r.tZ)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize assistant panel",title:"Drag to resize, double-click to reset",onPointerDown:Te(an),onDoubleClick:Ie,css:(t={position:"absolute",top:0},t["right"===an?"left":"right"]=0,t.width="6px",t.height="100%",t.cursor="col-resize",t.zIndex=2,t.touchAction="none",t.userSelect="none",t["::after"]=(n={content:'""',position:"absolute",top:0},n["right"===an?"left":"right"]="2px",n.width="2px",n.height="100%",n.backgroundColor="transparent",n.transition="background-color 120ms ease",n),t[":hover::after"]={backgroundColor:"rgba(0, 0, 0, 0.15)"},t)}),(0,r.BX)("div",xt({css:xt({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2px",padding:"12px 16px",backgroundColor:yt.primary,color:"white",position:"relative"},an?{minHeight:"var(--main-nav-height, 55px)",boxSizing:"border-box"}:{})},{children:[(0,r.BX)("div",xt({css:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:1,overflow:"hidden"}},{children:[(0,r.tZ)(s,{}),(0,r.BX)("button",xt({type:"button",onClick:function(){return $e((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",fontWeight:600,fontSize:"14px",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:[(0,r.tZ)("span",xt({css:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},{children:(null==Ot?void 0:Ot.title)||"AI Assistant"})),(0,r.tZ)("span",xt({css:{display:"flex",opacity:.8,flexShrink:0}},{children:(0,r.tZ)(v,{})}))]}))]})),(0,r.BX)("div",xt({css:{display:"flex",alignItems:"center",gap:"2px",position:"relative",flexShrink:0}},{children:[(0,r.tZ)("button",xt({type:"button",onClick:function(){return tt((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(cn,{})})),(0,r.tZ)("button",xt({type:"button",onClick:function(){Qt(),Q(!1)},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(sn,{})})),et&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return tt(!1)}}),(0,r.tZ)("div",xt({css:{position:"absolute",top:"100%",right:0,marginTop:"4px",minWidth:"180px",backgroundColor:"white",border:"1px solid ".concat(K),borderRadius:"8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,overflow:"hidden"}},{children:[{value:"current",label:"Floating",Icon:y},{value:"sidebar-left",label:"Sidebar left",Icon:b},{value:"sidebar-right",label:"Sidebar right",Icon:g},{value:"fullscreen",label:"Fullscreen",Icon:m}].filter((function(e){var t=e.value;return H.includes(t)})).map((function(e){var t=e.value,n=e.label,o=e.Icon;return(0,r.BX)("button",xt({type:"button",onClick:function(){ie(t),tt(!1)},css:{width:"100%",padding:"10px 14px",background:t===re?yt.light:"white",border:"none",cursor:"pointer",fontSize:"13px",color:z,textAlign:"left",display:"flex",alignItems:"center",gap:"10px",":hover":{backgroundColor:B}}},{children:[(0,r.tZ)("span",xt({css:{display:"flex",color:M,flexShrink:0}},{children:(0,r.tZ)(o,{})})),(0,r.tZ)("span",{children:n})]}),t)}))}))]})]})),Je&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return $e(!1)}}),(0,r.BX)("div",xt({css:{position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:"white",border:"1px solid ".concat(K),borderTop:"none",borderRadius:"0 0 8px 8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,maxHeight:"240px",overflowY:"scroll"}},{children:[(0,r.tZ)("button",xt({type:"button",onClick:function(){Xt(),$e(!1)},css:{width:"100%",padding:"10px 14px",background:"none",border:"none",borderBottom:"1px solid ".concat("#f3f4f6"),cursor:"pointer",fontSize:"13px",fontWeight:600,color:yt.primary,textAlign:"left",":hover":{backgroundColor:B}}},{children:"+ New Chat"})),0===nn.length&&(0,r.tZ)("div",xt({css:{padding:"12px 14px",fontSize:"13px",color:M}},{children:"No chats yet"})),nn.map((function(e){return(0,r.BX)("div",xt({onClick:function(){return t=e.id,wt(void 0,void 0,void 0,(function(){var e,n,r,o;return kt(this,(function(i){switch(i.label){case 0:return Qt(),ut.current=!0,(null===(r=Ue.find((function(e){return e.id===t})))||void 0===r?void 0:r.chat)?(Ge(t),$e(!1),[2]):[4,ve(S,Y,t)];case 1:return(e=i.sent())?(n=At(t,null!==(o=e.messages)&&void 0!==o?o:[],e.title),Ve((function(r){return r.map((function(r){return r.id===t?xt(xt({},e),{chat:n}):r}))})),Ge(t),$e(!1),[2]):[2]}}))}));var t},css:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",cursor:"pointer",backgroundColor:e.id===He?yt.light:"white",":hover":{backgroundColor:B}}},{children:[(0,r.BX)("div",xt({css:{flex:1,minWidth:0}},{children:[(0,r.tZ)("div",xt({css:{fontSize:"13px",fontWeight:500,color:z,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:e.title||"Untitled conversation"})),(0,r.tZ)("div",xt({css:{fontSize:"11px",color:M,marginTop:"2px"}},{children:new Date(e.updated_at).toLocaleDateString()}))]})),(0,r.tZ)("button",xt({type:"button",onClick:function(t){return function(e,t){return wt(void 0,void 0,void 0,(function(){var n;return kt(this,(function(r){switch(r.label){case 0:return t.stopPropagation(),(null==(n=Ue.find((function(t){return t.id===e})))?void 0:n.isTemporary)?[3,2]:[4,ye(S,Y,e)];case 1:r.sent(),r.label=2;case 2:return Ve((function(t){return t.filter((function(t){return t.id!==e}))})),He===e&&Xt(),[2]}}))}))}(e.id,t)},css:{background:"none",border:"none",cursor:"pointer",color:M,fontSize:"16px",padding:"2px 6px",marginLeft:"8px",borderRadius:"4px",lineHeight:1,":hover":{color:"#dc2626",backgroundColor:"#fef2f2"}}},{children:"×"}))]}),e.id)}))]}))]})]})),(0,r.BX)("div",xt({ref:at,onScroll:ht,css:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"}},{children:[0===Pt.length&&(0,r.tZ)("div",xt({css:{textAlign:"center",color:M,fontSize:"14px",marginTop:"40px"}},{children:"How can I help?"})),Pt.map((function(e,t){var n,i,a,l,u,s,c,d;return"user"===e.role?(null!==(n=e.parts)&&void 0!==n?n:[]).some((function(e){var t;return"text"===e.type&&(null!==(t=e.text)&&void 0!==t?t:"").trim()}))?(0,r.tZ)("div",xt({css:{display:"flex",justifyContent:"flex-end"}},{children:(0,r.tZ)("div",xt({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:yt.primary,color:"white",overflowWrap:"anywhere",wordBreak:"break-word"}},{children:e.parts.filter((function(e){return!e.hidden})).map((function(e,t){return"text"===e.type?(0,r.tZ)("span",{children:e.text},t):null}))}))}),e.id):null:(0,r.tZ)(o.Fragment,{children:(i=t===Pt.length-1,a=function(e){var t=[];return e.forEach((function(e,n){if("text"===e.type&&e.text.trim()){var r=t[t.length-1];r&&"text"===r.kind?r.text="".concat(r.text,"\n\n").concat(e.text):t.push({kind:"text",key:"text-".concat(n),text:e.text})}else{var o=function(e){if("text"===(null==e?void 0:e.type))return{kind:"text"};var t="string"==typeof(null==e?void 0:e.type)&&e.type.startsWith("tool-"),n="dynamic-tool"===(null==e?void 0:e.type);return t||n?{kind:"tool",toolName:t?e.type.replace("tool-",""):e.toolName||"unknown"}:null}(e);if(o&&"tool"===o.kind&&o.toolName){var i={key:"tool-".concat(n),toolName:o.toolName,state:e.state,input:e.input,output:e.output},a=t[t.length-1];a&&"tools"===a.kind?a.rows.push(i):t.push({kind:"tools",key:"tools-".concat(n),rows:[i]})}}})),t}(e.parts),l=e.parts[e.parts.length-1],u=!i||"ready"===Nt&&"text"===(null==l?void 0:l.type),s=ct.current&&i&&(rn||Jt),c=s?Yt:1/0,d=!1,a.map((function(e,t){if(d)return null;if("text"===e.kind){for(var n=0;n<e.text.length&&(c>0||/\s/.test(e.text[n]));)/\s/.test(e.text[n])||(c-=1),n+=1;return n<e.text.length&&(d=!0),n<=0?null:(0,r.tZ)("div",xt({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,r.tZ)("div",xt({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:yt.light,color:z,overflowWrap:"anywhere",wordBreak:"break-word"}},{children:(0,r.tZ)(ce,{text:e.text.slice(0,n),isStreaming:rn&&i&&t===a.length-1})}))}),e.key)}var o=a.slice(t+1).some((function(e){return"text"===e.kind})),l=s&&o&&c<=0;return(0,r.tZ)("div",xt({css:{display:"flex",justifyContent:"flex-start",maxWidth:"80%",minWidth:0}},{children:(0,r.tZ)(ee,{rows:e.rows,turnFinished:u,followedByText:o,audioPending:l,linkColor:yt.primary,isFirstChunk:0===t})}),e.key)})))},e.id)})),function(){var e;if(!rn)return null;var t=Pt[Pt.length-1];if(!t)return null;var n=t.parts||[],o=function(e){var t;if("text"===(null==e?void 0:e.type))return(null!==(t=e.text)&&void 0!==t?t:"").trim().length>0;var n="string"==typeof(null==e?void 0:e.type)?e.type:"";return n.startsWith("tool-")||"dynamic-tool"===n},i=n.some(o);if("user"===t.role){if(!i)return null}else{var a=ct.current&&Yt<=0&&"text"===(null===(e=n.find(o))||void 0===e?void 0:e.type);if(i&&!a)return null}return(0,r.tZ)(ne,{})}(),Ft&&(0,r.tZ)("div",xt({css:{padding:"10px 14px",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",fontSize:"14px"}},{children:"Something went wrong. Please try again."}))]})),V.length>0&&(0,r.BX)("div",xt({css:{position:"relative",zIndex:1,borderTop:"1px solid ".concat(K),backgroundColor:B,padding:"8px 16px",display:"flex",gap:"6px",overflowX:"auto"}},{children:[V.map((function(e,t){return(0,r.tZ)("button",xt({type:"button",disabled:rn,onClick:function(){return function(e){return wt(void 0,void 0,void 0,(function(){return kt(this,(function(t){switch(t.label){case 0:return"ready"!==Nt?[2]:(Ut(),[4,Ne(c)]);case 1:return t.sent(),Wt({parts:[{type:"text",text:e.name},{type:"text",text:e.instructions,hidden:!0,interpolate:!0}]}),[2]}}))}))}(e)},onMouseEnter:function(t){if(e.description){var n=t.currentTarget.getBoundingClientRect();it({text:e.description,x:n.left+n.width/2,y:n.top})}},onMouseLeave:function(){return it(null)},css:{flexShrink:0,padding:"4px 10px",fontSize:"12px",border:"1px solid ".concat(yt.primary),borderRadius:"12px",backgroundColor:"white",color:yt.primary,cursor:"pointer",whiteSpace:"nowrap",":disabled":{opacity:.5,cursor:"not-allowed"},":hover:not(:disabled)":{backgroundColor:yt.light},transition:"background-color 0.15s, color 0.15s"}},{children:e.name}),t)})),ot&&(0,r.tZ)("div",xt({css:{position:"fixed",top:ot.y-34,left:ot.x,transform:"translateX(-50%)",backgroundColor:"rgba(0,0,0,0.9)",color:"white",fontSize:"12px",padding:"4px 8px",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e4}},{children:ot.text}))]})),(0,r.BX)("div",xt({css:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderTop:"1px solid ".concat(K),backgroundColor:B}},{children:[Ht?(0,r.BX)("button",xt({type:"button",onClick:"speaking"===qt?en:void 0,css:{flex:1,display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",border:"1px solid ".concat(K),borderRadius:"8px",backgroundColor:"white",fontSize:"14px",color:z,cursor:"speaking"===qt?"pointer":"default"}},{children:[(0,r.tZ)(_,{css:{color:yt.primary}}),"loading"===qt?"Loading…":"transcribing"===qt?"Transcribing…":"thinking"===qt?"Thinking…":"speaking"===qt?"Tap to skip":"Listening…"]})):(0,r.tZ)("input",{type:"text",value:je,onChange:function(e){return Ee(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.stopPropagation(),tn())},placeholder:"Type a message...",css:{flex:1,padding:"10px 14px",border:"1px solid ".concat(K),borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.2s",":focus":{borderColor:yt.primary}}}),Ht?(0,r.tZ)("button",xt({type:"button",onClick:Qt,"aria-label":"Exit voice mode",css:on},{children:(0,r.tZ)(f,{})})):!X||je.trim()?(0,r.tZ)("button",xt({type:"button",onClick:tn,disabled:rn||!je.trim(),css:on},{children:(0,r.tZ)(d,{})})):(0,r.tZ)("button",xt({type:"button",onClick:$t,disabled:rn||!Gt,"aria-label":"Start voice mode",title:Gt?void 0:"Microphone unavailable",css:on},{children:(0,r.tZ)(C,{})}))]}))]}))}}}]);