dorkos 0.126.0 → 0.126.2

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 (309) hide show
  1. package/dist/bin/cli.js +1225 -562
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-2c9n8B32.js → AboutPage-BQ66xWcJ.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-muwC_jif.js → ActivityErrorState-CPbfgXjw.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-2aUz3zv0.js → ActivityPage-CesljfZn.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-nQBqDCak.js → ActivityRow-DzhwE0ht.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-ChpyilnO.js → AdapterIcon-BXJkyF5g.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-DRKQp5Gh.js → AdapterSetupWizard-CwKYl1vG.js} +2 -2
  10. package/dist/client/assets/{AgentOptionRow-CeVPhvTq.js → AgentOptionRow-0VdNzXCF.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-D8YX1P_q.js → AgentPicker-Ldh64iOA.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-refCLvuV.js → AgentRequestCard-CmAlDGTr.js} +3 -3
  13. package/dist/client/assets/{AppearancePage-BDTIp3j0.js → AppearancePage-DmsZPHst.js} +1 -1
  14. package/dist/client/assets/ApplyToOverridesDialog-Ct1W283T.js +1 -0
  15. package/dist/client/assets/{AttentionSignalRow-Dn4rP542.js → AttentionSignalRow-B7gezgzA.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-B0sy0nRk.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Nqvr65_g.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DMYB-vWm.js → BindingDialog-CpBZoSZU.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-D9ZLEDXc.js → BlintzCanvas-BCtfZPrs.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-DMqGpNWm.js → CanvasCsvContent-DYksqzaf.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-Bxhc86lv.js → CanvasFileContent-CqEqSxuJ.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-D783Ql7m.js → CanvasModel3dContent-vR6ze4IR.js} +2 -2
  22. package/dist/client/assets/{ChannelComposer-BNlD-d2W.js → ChannelComposer-BVACOdph.js} +5 -5
  23. package/dist/client/assets/{ChatAppsOff-eRAfqzJR.js → ChatAppsOff-VsPP2Hye.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-CqEUAG6G.js → CodeMirrorDiff-CmKjH03N.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BM1ANude.js → CodeMirrorEditor-BtNgazuc.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-C3QvbbGF.js → CommitmentList-D9I-CmNy.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-bmqKNd-Z.js → CommitmentsPage-BORMYDZb.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-78falOZG.js → ComputerResourceView-BZ9BxgOi.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-DZ2RiDbn.js → ComputerViewer-CbuU9tXK.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-CXsNyR4U.js → ConnectionAccessLists-uE-Fzp6Y.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-bpkRfRRK.js → ConnectionsPage-D7QTHeQQ.js} +1 -1
  32. package/dist/client/assets/{ConventionPage-rYtICYjS.js → ConventionPage-PS2WWCyB.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-DXTqUrR4.js → ExtensionPageRoute-Cn7bYxGB.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CCNB3_Gb.js → FloatingTanStackRouterDevtools-CqogiFob-DKGNSXVz.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-BfVnJ6oD.js → ForwardConsentHost-CLIHtWwq.js} +1 -1
  36. package/dist/client/assets/HandlePage-BjlcYr_l.js +1 -0
  37. package/dist/client/assets/{HeartbeatPage-DdAfcR81.js → HeartbeatPage-7MTowke-.js} +1 -1
  38. package/dist/client/assets/{KeyEntry-CR7GBqXf.js → KeyEntry-Cf7D0Oo6.js} +1 -1
  39. package/dist/client/assets/{LexicalField-RAoub3wq.js → LexicalField-DqvzeMr3.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-CEhYj9ov.js → ManagesPage-DxR4zWMf.js} +1 -1
  41. package/dist/client/assets/{Marketplace-DtxHDbF4.js → Marketplace-V_92jKOn.js} +1 -1
  42. package/dist/client/assets/{MarketplaceSourcesView-CSFvFtV_.js → MarketplaceSourcesView-CjCVMP_d.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-1mPdRK9p.js → McpAppFrame-4JDJsrmg.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody--HfjMnE1.js → McpSigninBody-DG1XX7XT.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-BT2SY67i.js → Model3dViewer-DedBFHsl.js} +1 -1
  46. package/dist/client/assets/NamePage-A8X09lY7.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-QUtJTzKI.js → NewDirectMessageMenu-C8t7x-sB.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-D3fleW0i.js → NotificationsPage-DwGFE3F6.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-8WEn0WrA.js → OpenMeshSwitch-DPmTA9eg.js} +2 -2
  50. package/dist/client/assets/OperatorIdentityForm-Cu0h8Xqy.js +1 -0
  51. package/dist/client/assets/{PermissionHistory-5stLHBu8.js → PermissionHistory-zD6ksrl2.js} +1 -1
  52. package/dist/client/assets/PermissionsPage-Durcnmie.js +1 -0
  53. package/dist/client/assets/{PersonalityPopover-DIbsJ6HP.js → PersonalityPopover-DuRjJuLj.js} +1 -1
  54. package/dist/client/assets/PhotoPage-DP5WoeFd.js +1 -0
  55. package/dist/client/assets/{PreviewRefusedNotice-CjT7jQ45.js → PreviewRefusedNotice-hlYrFDQM.js} +1 -1
  56. package/dist/client/assets/{ProfileFields-gZNaFBow.js → ProfileFields-x-x8vgNo.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-DYf7L8xJ.js → ProfilePanelContainer-8WxopRj2.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-DclYXFSP.js → ProfileRolePicker-BfciiNpr.js} +1 -1
  59. package/dist/client/assets/{PromptSuggestionChips-k9HolS90.js → PromptSuggestionChips-D34Zeaq_.js} +1 -1
  60. package/dist/client/assets/{ReportsToPopover-Bh5KrFbJ.js → ReportsToPopover-BhqA5qXi.js} +1 -1
  61. package/dist/client/assets/{RoomSurface-32U7Wl6Z.js → RoomSurface-BlMNuQsT.js} +1 -1
  62. package/dist/client/assets/{RoomsPage-sdMZgHla.js → RoomsPage-C52AOHIE.js} +1 -1
  63. package/dist/client/assets/{RunsOnPopover-B5_Jz7ir.js → RunsOnPopover-DLhEKwXF.js} +1 -1
  64. package/dist/client/assets/{RuntimeConnectFlow-C_6ozpAK.js → RuntimeConnectFlow-D3H5Fpkc.js} +1 -1
  65. package/dist/client/assets/{RuntimeSetupDialog-BDvzruM4.js → RuntimeSetupDialog-DPU4QIY9.js} +1 -1
  66. package/dist/client/assets/{SeenDevices-CZ--8ljN.js → SeenDevices-CDSHTsL7.js} +2 -2
  67. package/dist/client/assets/{SessionsPage-BKyrJh1O.js → SessionsPage-Crh3D3Jj.js} +1 -1
  68. package/dist/client/assets/{SettingsDialog-E5hPag3F.js → SettingsDialog-D0Oh-ku1.js} +4 -4
  69. package/dist/client/assets/{SkillsPage-BeL6zfgw.js → SkillsPage-BPexZwnJ.js} +1 -1
  70. package/dist/client/assets/{TaskDialogWrapper-B-IP5hYv.js → TaskDialogWrapper-D6RB8E59.js} +1 -1
  71. package/dist/client/assets/{TasksEmptyState-BcftWVbk.js → TasksEmptyState-Di3SbhJM.js} +2 -2
  72. package/dist/client/assets/{TasksPage-CmroTI1v.js → TasksPage-CDLsY1Ww.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-DbfoZrZz.js → TeamComputerEntry-B_q-oVSs.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-h-PS45fZ.js → ToolsPage-gvIVTnwf.js} +1 -1
  75. package/dist/client/assets/{TopologyGraph-Bk_0y0Yy.js → TopologyGraph-Bp8aL_qw.js} +1 -1
  76. package/dist/client/assets/{TourHost-D4La-1-E.js → TourHost-Cg8EHvod.js} +1 -1
  77. package/dist/client/assets/{UnlinkDialog-CWd4fhT4.js → UnlinkDialog-Ddd1Yxfk.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-Bvg9QLn9.js → UnreadDivider-LL4_YtF0.js} +1 -1
  79. package/dist/client/assets/{WidgetErrorCard-DictdlWO.js → WidgetErrorCard-BA3P7hNv.js} +6 -6
  80. package/dist/client/assets/WithheldExtensionsNotice-quqWNbus.js +1 -0
  81. package/dist/client/assets/{WorkView-DxThzZ0w.js → WorkView-C_h8sclU.js} +1 -1
  82. package/dist/client/assets/_shell-D9q8zLfr.js +80 -0
  83. package/dist/client/assets/{_shell._home-CBNsPEH4.js → _shell._home-CrTxBB3h.js} +1 -1
  84. package/dist/client/assets/_shell._home.activity-2M0BJkbQ.js +1 -0
  85. package/dist/client/assets/_shell._home.index-BTJhhEWN.js +3 -0
  86. package/dist/client/assets/_shell._home.tasks-Dfrqv2nl.js +1 -0
  87. package/dist/client/assets/{_shell._home.workspaces-3R3VtH7x.js → _shell._home.workspaces-DPLQXDdH.js} +1 -1
  88. package/dist/client/assets/{_shell.channels-DRslcaiA.js → _shell.channels-CJqfUTZ1.js} +1 -1
  89. package/dist/client/assets/{_shell.connections-BPQxNUPD.js → _shell.connections-Cpe1hru3.js} +1 -1
  90. package/dist/client/assets/{_shell.feedback-requests-DkXEk3qm.js → _shell.feedback-requests-BeWCqScf.js} +2 -2
  91. package/dist/client/assets/_shell.marketplace-CzLqm8iR.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-DtraxnMx.js +1 -0
  93. package/dist/client/assets/_shell.session-72JEfodU.js +1 -0
  94. package/dist/client/assets/{_shell.team-CZu-l34d.js → _shell.team-EPvcS7RS.js} +3 -3
  95. package/dist/client/assets/{_shell.threads-Cz-EZQXr.js → _shell.threads-NJDzq9dv.js} +1 -1
  96. package/dist/client/assets/_shell.x._extensionId-CcJi8pKR.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-CcJi8pKR.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-4hI8_uRi.js → abnfDiagram-WEYOIA3C-DUHshdrR.js} +1 -1
  99. package/dist/client/assets/{access-copy-BegDAoeR.js → access-copy-DHfPjN3G.js} +1 -1
  100. package/dist/client/assets/{arc-DgydwPM5.js → arc-sP6zNsGB.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-4kexDkbn.js → architectureDiagram-ZHVYKT53-C8PTjsPx.js} +1 -1
  102. package/dist/client/assets/{banner-CYV5jQI0.js → banner-CVrzHqOT.js} +1 -1
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-BUP4L5_m.js → blockDiagram-RJAE7QA3-Cydde2fz.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-B4HK3S3o.js → c4Diagram-XDPPPE54-DbM6KAK7.js} +1 -1
  105. package/dist/client/assets/{card-6VNSI3kT.js → card-DA_Z-FYX.js} +1 -1
  106. package/dist/client/assets/channel-DMgpNBDz.js +1 -0
  107. package/dist/client/assets/{chunk-2E7WHVMD-Bhw5hCVI.js → chunk-2E7WHVMD-CEbspaNh.js} +1 -1
  108. package/dist/client/assets/{chunk-2Q5K7J3B-CeUgfCvO.js → chunk-2Q5K7J3B-DDP1SiE0.js} +1 -1
  109. package/dist/client/assets/{chunk-4EMNKR2T-DqSZunXx.js → chunk-4EMNKR2T-BFjozJqd.js} +1 -1
  110. package/dist/client/assets/{chunk-55XCU76K-Bigp9-bU.js → chunk-55XCU76K-0JSp6acZ.js} +1 -1
  111. package/dist/client/assets/{chunk-5VM5RSS4-DF1L8DrH.js → chunk-5VM5RSS4-DswTXnmp.js} +1 -1
  112. package/dist/client/assets/{chunk-JWPE2WC7-lcFap_43.js → chunk-JWPE2WC7-D0PYncYV.js} +1 -1
  113. package/dist/client/assets/{chunk-VQ5W62QI-Bgmsy9NF.js → chunk-VQ5W62QI-r5T-ZVBs.js} +1 -1
  114. package/dist/client/assets/{chunk-XXDRQBXY-DFFzLm_u.js → chunk-XXDRQBXY-D8kkjktE.js} +1 -1
  115. package/dist/client/assets/{chunk-ZCHMQSOR-B4aJwBdo.js → chunk-ZCHMQSOR-D6XtRzln.js} +2 -2
  116. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-BdUAMGnS.js → classDiagram-v2-4MYWR3UA-DUPDMGfm.js} +1 -1
  117. package/dist/client/assets/{command-Dz2pZLle.js → command-BvXBgZfv.js} +1 -1
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-BdJxQmWe.js → cose-bilkent-JH36ORCC-tiQpE-Q8.js} +1 -1
  119. package/dist/client/assets/{cpu-CjKJ8pVl.js → cpu-mx7zDf7k.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-BvnDWKe0.js → cynefin-EF2NZ3EQ-BjAUxFfb.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-DKL8UyvS.js → cynefinDiagram-WF24UDRP-PmlyltXR.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-CCuJpxlY.js → dagre-NK4GIZVX-DDePjPkn.js} +1 -1
  123. package/dist/client/assets/{diagram-CBK3MWTC-C1jeuv8r.js → diagram-CBK3MWTC-D7N3T4Fx.js} +1 -1
  124. package/dist/client/assets/{diagram-I5XIIV2D-CSnTyOU0.js → diagram-I5XIIV2D-BfZHSbR2.js} +1 -1
  125. package/dist/client/assets/{diagram-ODIL2UCW-9w6q1YKi.js → diagram-ODIL2UCW-sXAa9bzN.js} +1 -1
  126. package/dist/client/assets/{diagram-PFBEJUXE-BMFBmD0P.js → diagram-PFBEJUXE-Dfd_61WO.js} +1 -1
  127. package/dist/client/assets/{diagram-RJA3I4VV-D9Utl6qX.js → diagram-RJA3I4VV-BCzdEfnM.js} +1 -1
  128. package/dist/client/assets/{diagram-TYUNFSNR-u_ogc51l.js → diagram-TYUNFSNR-BMqtz6sZ.js} +1 -1
  129. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bg_smbFH.js → ebnfDiagram-V4P3TTPT-CyWj1615.js} +1 -1
  130. package/dist/client/assets/{elk-QONTBCTQ-CtuwbIK2.js → elk-QONTBCTQ-BkQMBXse.js} +1 -1
  131. package/dist/client/assets/{empty-state-CbFKhqwB.js → empty-state-Dv5iV4jb.js} +1 -1
  132. package/dist/client/assets/{erDiagram-KYQIGQAA-MlvYHdZ7.js → erDiagram-KYQIGQAA-DiPsX7uU.js} +1 -1
  133. package/dist/client/assets/{execution-config-BjNjQoBp.js → execution-config-Bej0Ot8e.js} +1 -1
  134. package/dist/client/assets/{file-JokR8lB2.js → file-DXbyb23e.js} +1 -1
  135. package/dist/client/assets/{file-exclamation-point-sl45DZYe.js → file-exclamation-point-C8XqHyzY.js} +1 -1
  136. package/dist/client/assets/{file-text-C4PxLfBm.js → file-text-CRTgqqkn.js} +1 -1
  137. package/dist/client/assets/{find-latest-widget-fence-Bc1LICCy.js → find-latest-widget-fence-D1i7qNny.js} +5 -5
  138. package/dist/client/assets/{flowDiagram-IUGLLWBU-BlrKbUnh.js → flowDiagram-IUGLLWBU-BSM44aJP.js} +1 -1
  139. package/dist/client/assets/{form-1NlezfMg.js → form-DYSiVEri.js} +1 -1
  140. package/dist/client/assets/{format-cron-C57sE3sK.js → format-cron-DYYwmo-o.js} +1 -1
  141. package/dist/client/assets/{ganttDiagram-R7GPNTJY-BhCCQ-d7.js → ganttDiagram-R7GPNTJY-BWCjYexX.js} +1 -1
  142. package/dist/client/assets/{git-branch-BXEb1Sqq.js → git-branch-1zYKSuur.js} +1 -1
  143. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-Chl1aqHg.js → gitGraphDiagram-PDYL7XHY-ULC7Zunc.js} +1 -1
  144. package/dist/client/assets/{graph-DIIpUxLd.js → graph-BsZzo5TN.js} +1 -1
  145. package/dist/client/assets/{heart-CUs7jdhV.js → heart-C4CSHUW7.js} +1 -1
  146. package/dist/client/assets/{highlighted-body-KPVGNVTW-DlDHGjld.js → highlighted-body-KPVGNVTW-CFECg7iB.js} +1 -1
  147. package/dist/client/assets/{image-lightbox-BczXKBTZ.js → image-lightbox-M9t3Wulc.js} +1 -1
  148. package/dist/client/assets/{image-off-Ch98GGBJ.js → image-off-c01kxBAm.js} +1 -1
  149. package/dist/client/assets/{index-D6NjBiAq.js → index-B-7P1Q9s.js} +1 -1
  150. package/dist/client/assets/{index-BAnl5kwm.js → index-B3xeyV6n.js} +1 -1
  151. package/dist/client/assets/{index-DwrBsA10.js → index-B6Scr7KJ.js} +213 -213
  152. package/dist/client/assets/{index-Ev7FZl9a.js → index-BIVIHPoe.js} +1 -1
  153. package/dist/client/assets/{index-hyqRnlFg.js → index-BRH6C3LJ.js} +1 -1
  154. package/dist/client/assets/{index-CQTeDD0B.js → index-BScgHCO_.js} +1 -1
  155. package/dist/client/assets/{index-pQstFziR.js → index-BSxkprTm.js} +3 -3
  156. package/dist/client/assets/{index-DaZdDh7o.js → index-BTGRc0hC.js} +1 -1
  157. package/dist/client/assets/{index-CaVP52c1.js → index-BYY8HEOz.js} +1 -1
  158. package/dist/client/assets/{index-Cn1ZEy3S.js → index-B_he44rF.js} +1 -1
  159. package/dist/client/assets/{index-rKEUwjq8.js → index-BnXWm8Db.js} +1 -1
  160. package/dist/client/assets/{index-BQlnEL5t.js → index-BqwCOIbF.js} +1 -1
  161. package/dist/client/assets/{index-8FrM4Unx.js → index-Br35Gqfz.js} +1 -1
  162. package/dist/client/assets/{index-BC41bN42.js → index-C1XazYWZ.js} +1 -1
  163. package/dist/client/assets/{index-DMfV6rUz.js → index-C3swXqWW.js} +1 -1
  164. package/dist/client/assets/{index-B0p2_o3r.js → index-CAAsqmfP.js} +1 -1
  165. package/dist/client/assets/{index-DzLIbXMR.js → index-CAjKQnAd.js} +1 -1
  166. package/dist/client/assets/{index-vU7itvE8.js → index-Ce3HZQem.js} +1 -1
  167. package/dist/client/assets/{index-CnNGTb8f.js → index-CnltS8ym.js} +1 -1
  168. package/dist/client/assets/{index-ByIDaFWv.js → index-D847rJXW.js} +1 -1
  169. package/dist/client/assets/{index-CYhf-E_N.js → index-DG13Cp5o.js} +1 -1
  170. package/dist/client/assets/{index-CoHeCySh.js → index-DIDUjTkq.js} +1 -1
  171. package/dist/client/assets/{index-slBSiB-H.js → index-DQTTC52E.js} +1 -1
  172. package/dist/client/assets/{index-BiyMpL0z.js → index-DhYnXLRT.js} +1 -1
  173. package/dist/client/assets/{index-HnW-eS5i.js → index-DhkfALZp.js} +1 -1
  174. package/dist/client/assets/{index-BVjrgWDa.js → index-DhoaVQXu.js} +1 -1
  175. package/dist/client/assets/{index-D1Be28yK.js → index-DrENuQdJ.js} +1 -1
  176. package/dist/client/assets/{index-B0q1o1JU.js → index-DrQqkQq_.js} +1 -1
  177. package/dist/client/assets/{index-0MDZSAdr.js → index-DsasLE1l.js} +1 -1
  178. package/dist/client/assets/{index-CSOhBvPV.js → index-Dt7RONID.js} +1 -1
  179. package/dist/client/assets/{index-Czar7aPT.js → index-Du4HX97h.js} +2 -2
  180. package/dist/client/assets/{index-37h1E-65.js → index-DyN65ufd.js} +1 -1
  181. package/dist/client/assets/{index-BNJa5z6K.js → index-DzHj8lCz.js} +6 -6
  182. package/dist/client/assets/{index-BwHCH3tE.js → index-FwAvbbet.js} +1 -1
  183. package/dist/client/assets/{index-DlZ77Qfj.js → index-JG_0k1NX.js} +1 -1
  184. package/dist/client/assets/{index-BRyEtRBO.js → index-LpaxG4VS.js} +1 -1
  185. package/dist/client/assets/{index-D_9H4FdK.js → index-UJq1qaku.js} +1 -1
  186. package/dist/client/assets/{index-Cnjpi7ar.js → index-XEE1k4cl.js} +1 -1
  187. package/dist/client/assets/{index-BzqkXlms.js → index-YXyEu3Ia.js} +1 -1
  188. package/dist/client/assets/index-e6oawwKv.js +1 -0
  189. package/dist/client/assets/index-j30EyYIU.js +1 -0
  190. package/dist/client/assets/{index-Cw0QRsnv.js → index-jLIoULQt.js} +1 -1
  191. package/dist/client/assets/{index-CFJcOzPD.js → index-uLbyd6YP.js} +1 -1
  192. package/dist/client/assets/{index.esm-DM8Bqi3n.js → index.esm-CZ68Qd2t.js} +1 -1
  193. package/dist/client/assets/{infoDiagram-MVDRKAX5-C0p1eP9j.js → infoDiagram-MVDRKAX5-BCjhXqIT.js} +1 -1
  194. package/dist/client/assets/{inline-code-CNmpgW3O.js → inline-code-BKPMIXZR.js} +1 -1
  195. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-COdxgYUT.js → ishikawaDiagram-HPEHV2GE-C9rsv2nh.js} +1 -1
  196. package/dist/client/assets/{journeyDiagram-BOSHW7O7-C84Ny9n9.js → journeyDiagram-BOSHW7O7-BRYr1XL1.js} +1 -1
  197. package/dist/client/assets/{kanban-definition-FNSA4HC5-ECSXhFX0.js → kanban-definition-FNSA4HC5-2ey8FXEn.js} +1 -1
  198. package/dist/client/assets/{layers-JgRwJGyf.js → layers-DE3wjQuk.js} +1 -1
  199. package/dist/client/assets/{lightbulb-BhQB8sFP.js → lightbulb-BXJIRUdm.js} +1 -1
  200. package/dist/client/assets/{link-2-B4byjdgg.js → link-2-DzWm9OxA.js} +1 -1
  201. package/dist/client/assets/{list-runtime-types-M5_gxIg1.js → list-runtime-types-BhkZkTrB.js} +1 -1
  202. package/dist/client/assets/{markdown-content-C3qWcii6.js → markdown-content-Bk9lCksw.js} +1 -1
  203. package/dist/client/assets/{mention-pill-DUbgdKmA.js → mention-pill-os_7QQu2.js} +1 -1
  204. package/dist/client/assets/{mermaid.core-BQiwaVjZ.js → mermaid.core-BcRUBvZd.js} +4 -4
  205. package/dist/client/assets/{message-square-off-AjtFFe_u.js → message-square-off-DuOiETNI.js} +1 -1
  206. package/dist/client/assets/{mindmap-definition-6OY57UG3-BfA6EqgP.js → mindmap-definition-6OY57UG3-DBhXkS2i.js} +1 -1
  207. package/dist/client/assets/{more-details-itSF4Fah.js → more-details-Bt9nlPmS.js} +1 -1
  208. package/dist/client/assets/{owner-notice-B6JRjE_c.js → owner-notice-4ZSBxa2K.js} +1 -1
  209. package/dist/client/assets/{package-5YQSitlR.js → package-BmOMrNwc.js} +1 -1
  210. package/dist/client/assets/{page-container-DBPUOYYM.js → page-container-LomhzyuS.js} +1 -1
  211. package/dist/client/assets/{pane-resize-handle-Kwb3zKa6.js → pane-resize-handle-BOtzx5Q4.js} +1 -1
  212. package/dist/client/assets/{paperclip-IRKZTEQw.js → paperclip-C1tkiT74.js} +1 -1
  213. package/dist/client/assets/{path-input-BHkA4fFw.js → path-input-JHTlL97W.js} +1 -1
  214. package/dist/client/assets/{pegDiagram-ECIUJNBX-CqIy9WDe.js → pegDiagram-ECIUJNBX-B01fb3t0.js} +1 -1
  215. package/dist/client/assets/{pieDiagram-GNMPY74T-C5yI3cvV.js → pieDiagram-GNMPY74T-BJ7JYrTk.js} +1 -1
  216. package/dist/client/assets/{plug-CupdBXaG.js → plug-CsqfQsYq.js} +1 -1
  217. package/dist/client/assets/{primer-trigger-Ci_XRRfX.js → primer-trigger-DLdK7lVr.js} +2 -2
  218. package/dist/client/assets/{profile-errors-aEsWNifs.js → profile-errors-CpvSy5wY.js} +1 -1
  219. package/dist/client/assets/{progress-Bpmb837n.js → progress-qB87L0zJ.js} +1 -1
  220. package/dist/client/assets/{quadrantDiagram-D57K4MC3-DyCDNvk7.js → quadrantDiagram-D57K4MC3-mJYGGmOV.js} +1 -1
  221. package/dist/client/assets/{query-error-state-s6AJaHa3.js → query-error-state-MyJ1ivia.js} +1 -1
  222. package/dist/client/assets/{radio-Ci6Ghks8.js → radio-DJV7l0fv.js} +1 -1
  223. package/dist/client/assets/{railroadDiagram-Y72NRBL7-B3u1B937.js → railroadDiagram-Y72NRBL7-BlXWwQe2.js} +1 -1
  224. package/dist/client/assets/registry-BrjQCdmG.js +1 -0
  225. package/dist/client/assets/{registry-NGfn1R2_.js → registry-tJrGs7kB.js} +4 -4
  226. package/dist/client/assets/{relay-trace-schemas-hOFIzdY-.js → relay-trace-schemas-TH0-GYCB.js} +2 -2
  227. package/dist/client/assets/{repeat-B1S2ceC2.js → repeat-CBnopqBr.js} +1 -1
  228. package/dist/client/assets/{requirementDiagram-EQYSW5RA-CdG-unip.js → requirementDiagram-EQYSW5RA-Dqr1Y74x.js} +1 -1
  229. package/dist/client/assets/{room-files-source-J7gnN1gx.js → room-files-source-BFo0FEUP.js} +1 -1
  230. package/dist/client/assets/{rotate-ccw-clock-7Q2akPFi.js → rotate-ccw-clock-D9XRHj5E.js} +1 -1
  231. package/dist/client/assets/{rotate-cw-DK3Rzmlh.js → rotate-cw-DNa7ENG3.js} +1 -1
  232. package/dist/client/assets/{sankeyDiagram-SY24JHO5-D3Z4Qk2b.js → sankeyDiagram-SY24JHO5-DGYZs_kW.js} +1 -1
  233. package/dist/client/assets/{scroll-area-6Gelypei.js → scroll-area-Bf6IGziJ.js} +1 -1
  234. package/dist/client/assets/search-x-DFBBEouE.js +6 -0
  235. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-RXPgeLr6.js → sequenceDiagram-BLEHNHQU-BW3u4L9y.js} +1 -1
  236. package/dist/client/assets/{shield-x-D8lJ0Op0.js → shield-x-WGxwrtNV.js} +1 -1
  237. package/dist/client/assets/{signed-in-NOeTLLso.js → signed-in-eV4_EXuv.js} +1 -1
  238. package/dist/client/assets/{sizeCapture-INFHLROL-q7qki1pK.js → sizeCapture-INFHLROL-C1TpueOu.js} +1 -1
  239. package/dist/client/assets/{soul-file-DTEcjDxP.js → soul-file-e1iYX9IV.js} +1 -1
  240. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DFs6IVbj.js → stateDiagram-v2-A6IESKWZ-DvrHUauN.js} +1 -1
  241. package/dist/client/assets/{swimlanes-B3ENRKFQ-D1A-3JE-.js → swimlanes-B3ENRKFQ-BUbTcoId.js} +1 -1
  242. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-wkooBe_N.js +8 -0
  243. package/dist/client/assets/{table-CuBPM_bg.js → table-DsxLk3Gx.js} +1 -1
  244. package/dist/client/assets/{timeline-definition-JXYKGLGB-CLHy0rAb.js → timeline-definition-JXYKGLGB-CzbVpGxn.js} +1 -1
  245. package/dist/client/assets/{trust-posture-BXXe8F8n.js → trust-posture-Blofy7eE.js} +1 -1
  246. package/dist/client/assets/{unplug-Cuej6sM6.js → unplug-B6dUhqA7.js} +1 -1
  247. package/dist/client/assets/{unverified-catalog-notice-BbK4SCJp.js → unverified-catalog-notice-6pwZtIjx.js} +1 -1
  248. package/dist/client/assets/{use-adapter-catalog-Cy7ENVZN.js → use-adapter-catalog-J43bUHJu.js} +1 -1
  249. package/dist/client/assets/{use-bindings-Tj0BcF4m.js → use-bindings-BgXZ0D7k.js} +1 -1
  250. package/dist/client/assets/{use-composer-prefs-BrQVpwRi.js → use-composer-prefs--zO2mm_M.js} +1 -1
  251. package/dist/client/assets/{use-connector-management-CLZQXgln.js → use-connector-management-9Q7wHb06.js} +1 -1
  252. package/dist/client/assets/{use-deep-link-scroll-BeqtUhj2.js → use-deep-link-scroll-CXqwdwGr.js} +1 -1
  253. package/dist/client/assets/{use-delete-binding-d7ii9iFQ.js → use-delete-binding-BBQNMtUY.js} +1 -1
  254. package/dist/client/assets/{use-dev-links-MYOV3h2q.js → use-dev-links-C643CCcq.js} +1 -1
  255. package/dist/client/assets/{use-direct-message-panel-C_lXDYnB.js → use-direct-message-panel-BD_daG2E.js} +1 -1
  256. package/dist/client/assets/{use-external-adapter-catalog-kMFSEJGV.js → use-external-adapter-catalog-BjbC1V6t.js} +1 -1
  257. package/dist/client/assets/{use-full-activity-feed-MFSkvnza.js → use-full-activity-feed-DUH8r8jx.js} +1 -1
  258. package/dist/client/assets/use-is-below-desktop-DAZnwJGB.js +1 -0
  259. package/dist/client/assets/{use-local-browser-1oVtlmXD.js → use-local-browser-P93oA-F5.js} +1 -1
  260. package/dist/client/assets/{use-mesh-topology-BJs6M6kh.js → use-mesh-topology-B0k0gLoW.js} +1 -1
  261. package/dist/client/assets/{use-mounted-ref-DitdlmSI.js → use-mounted-ref-DE7EQsBF.js} +1 -1
  262. package/dist/client/assets/{use-notification-prefs-CXbRTRLF.js → use-notification-prefs-B8JtshQ0.js} +1 -1
  263. package/dist/client/assets/use-pending-read-DeGO1wGC.js +1 -0
  264. package/dist/client/assets/{use-personality-commit-DQrWyVGT.js → use-personality-commit-Dh5Sejj_.js} +1 -1
  265. package/dist/client/assets/{use-promo-activation-CgdBHk2f.js → use-promo-activation-C9FWA7ru.js} +3 -3
  266. package/dist/client/assets/{use-promo-dismissals-DprcDmfs.js → use-promo-dismissals-BIfafj9f.js} +1 -1
  267. package/dist/client/assets/{use-pulse-freshness-BtMzHCs3.js → use-pulse-freshness-CxzVMmVK.js} +1 -1
  268. package/dist/client/assets/{use-relay-config-CGBlgXC2.js → use-relay-config-DQE3dmJ2.js} +1 -1
  269. package/dist/client/assets/{use-room-follow-claim-Db5U7kWT.js → use-room-follow-claim-B1QPFaUb.js} +1 -1
  270. package/dist/client/assets/{use-room-sessions-K6mdH-Tb.js → use-room-sessions-CdjzO67_.js} +1 -1
  271. package/dist/client/assets/{use-roving-tab-list-B2zxa_F_.js → use-roving-tab-list-Nu-MIapD.js} +1 -1
  272. package/dist/client/assets/{use-session-canvas-D4G5fO_a.js → use-session-canvas-BfKGOpNy.js} +8 -8
  273. package/dist/client/assets/{use-status-budget-UccdTZ7o.js → use-status-budget-DgeTxC3h.js} +3 -3
  274. package/dist/client/assets/{use-transform-BBj2pwbo.js → use-transform-CiJqtMBf.js} +1 -1
  275. package/dist/client/assets/{use-unclaimed-chats-BidDnyt8.js → use-unclaimed-chats-Blkq6U4D.js} +1 -1
  276. package/dist/client/assets/use-update-config-BFFW_6Mc.js +1 -0
  277. package/dist/client/assets/{useMutationState-RYxTf1aD.js → useMutationState-lbcdmnfE.js} +1 -1
  278. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Bjmcc2gK.js → usecaseDiagram-WPOLBNNX-BM36oESm.js} +1 -1
  279. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Cd6C9CxW.js → vennDiagram-Q3Y3IDCW-Zrybcs91.js} +1 -1
  280. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-CzWWmwUL.js → wardleyDiagram-IVAIDKWA-CO4pzGG0.js} +1 -1
  281. package/dist/client/assets/{xychartDiagram-4URNHDU4-DSUn9rhA.js → xychartDiagram-4URNHDU4-pi_wF1CM.js} +1 -1
  282. package/dist/client/index.html +1 -1
  283. package/dist/server/index.js +70428 -68011
  284. package/dist/server/index.js.map +2 -2
  285. package/package.json +4 -4
  286. package/dist/client/assets/ApplyToOverridesDialog-C-XL9N4W.js +0 -1
  287. package/dist/client/assets/HandlePage-BH_G4sMV.js +0 -1
  288. package/dist/client/assets/NamePage-CaJsVRhh.js +0 -1
  289. package/dist/client/assets/OperatorIdentityForm-BRKAQS0D.js +0 -1
  290. package/dist/client/assets/PermissionsPage-C2pB1TCJ.js +0 -1
  291. package/dist/client/assets/PhotoPage-33Xh8sq1.js +0 -1
  292. package/dist/client/assets/_shell-CX_gaQPE.js +0 -80
  293. package/dist/client/assets/_shell._home.activity-DpSGWVSW.js +0 -1
  294. package/dist/client/assets/_shell._home.index-BWH93iWg.js +0 -3
  295. package/dist/client/assets/_shell._home.tasks-Ive4UW8c.js +0 -1
  296. package/dist/client/assets/_shell.marketplace-D8deZF5L.js +0 -1
  297. package/dist/client/assets/_shell.marketplace_.sources-BHG9MqWR.js +0 -1
  298. package/dist/client/assets/_shell.session-CkdA2hgF.js +0 -1
  299. package/dist/client/assets/_shell.x._extensionId-Cry6E5KK.js +0 -1
  300. package/dist/client/assets/_shell.x._extensionId_._-Cry6E5KK.js +0 -1
  301. package/dist/client/assets/channel-Bf4e4rlX.js +0 -1
  302. package/dist/client/assets/index-BThp0Av1.js +0 -1
  303. package/dist/client/assets/index-Dv6HjbCS.js +0 -1
  304. package/dist/client/assets/registry-DatwH4jj.js +0 -1
  305. package/dist/client/assets/search-x-Be8VetKs.js +0 -6
  306. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-hZFkkqUb.js +0 -8
  307. package/dist/client/assets/use-is-below-desktop-CJJ4zMQO.js +0 -1
  308. package/dist/client/assets/use-pending-read-CvX1lOb8.js +0 -1
  309. package/dist/client/assets/use-update-config-D8g4P42J.js +0 -1
@@ -1 +1 @@
1
- import{j as e,B as c,x,G as u,W as o}from"./index-DwrBsA10.js";const p=o("rounded-xl p-3",{variants:{tone:{muted:"bg-muted/50 text-muted-foreground",destructive:"bg-destructive/10 text-destructive"}},defaultVariants:{tone:"muted"}});function f({icon:n,headline:d,description:r,action:s,preview:t,tone:i,headingLevel:a,className:l}){const m=a?`h${a}`:"p";return e.jsxs("div",{"data-slot":"empty-state",className:u("flex flex-col items-center justify-center gap-3 p-12 text-center",l),children:[t&&e.jsx("div",{className:"pointer-events-none mb-4 w-full max-w-sm opacity-40 select-none",children:t}),e.jsx("div",{className:p({tone:i}),children:e.jsx(n,{className:"size-6","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(m,{className:"text-sm font-medium",children:d}),e.jsx("p",{className:"text-muted-foreground max-w-[280px] text-xs",children:r})]}),s&&e.jsxs(c,{size:"sm",variant:s.variant,onClick:s.onClick,disabled:s.disabled||s.busy,className:"mt-1",children:[s.busy&&e.jsx(x,{size:"xs"}),s.label]})]})}export{f as E};
1
+ import{j as e,B as c,x,G as u,W as o}from"./index-B6Scr7KJ.js";const p=o("rounded-xl p-3",{variants:{tone:{muted:"bg-muted/50 text-muted-foreground",destructive:"bg-destructive/10 text-destructive"}},defaultVariants:{tone:"muted"}});function f({icon:n,headline:d,description:r,action:s,preview:t,tone:i,headingLevel:a,className:l}){const m=a?`h${a}`:"p";return e.jsxs("div",{"data-slot":"empty-state",className:u("flex flex-col items-center justify-center gap-3 p-12 text-center",l),children:[t&&e.jsx("div",{className:"pointer-events-none mb-4 w-full max-w-sm opacity-40 select-none",children:t}),e.jsx("div",{className:p({tone:i}),children:e.jsx(n,{className:"size-6","aria-hidden":!0})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(m,{className:"text-sm font-medium",children:d}),e.jsx("p",{className:"text-muted-foreground max-w-[280px] text-xs",children:r})]}),s&&e.jsxs(c,{size:"sm",variant:s.variant,onClick:s.onClick,disabled:s.disabled||s.busy,className:"mt-1",children:[s.busy&&e.jsx(x,{size:"xs"}),s.label]})]})}export{f as E};
@@ -1,4 +1,4 @@
1
- import{g as Ut}from"./chunk-XXDRQBXY-DFFzLm_u.js";import{s as Kt}from"./chunk-VQ5W62QI-Bgmsy9NF.js";import{_ as f,I as Tt,b as Zt,a as jt,s as qt,g as Wt,t as Ht,v as Qt,c as tt,l as F,k as Xt,A as Jt,z as $t,D as te,E as ee,F as se,K as ie,H as re,L as ae,q as ne,r as oe,u as le}from"./mermaid.core-BQiwaVjZ.js";import{s as ce}from"./transform-BqqRT-Iy.js";import{c as he}from"./channel-Bf4e4rlX.js";import"./index-DwrBsA10.js";import"./BlintzCanvas-D9ZLEDXc.js";import"./index-0MDZSAdr.js";import"./index-pQstFziR.js";var Ot=(function(){var s=f(function(G,n,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=n);return h},"o"),a=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],o=[2,2],l=[1,7],r=[1,9],c=[1,10],y=[1,11],g=[1,12],k=[1,30],N=[1,23],p=[1,24],b=[1,25],A=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],C=[1,20],D=[1,18],L=[1,21],w=[1,22],Nt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],dt=[1,36],pt=[1,37],ft=[1,38],bt=[1,39],gt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],xt=[69,70,71,72,73],Ct=[1,91],At=[6,9,45,50],z=[6,9,12,44,45,50,51,52],at=[1,101],nt=[1,100],ot=[1,99],J=[18,61],It=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],yt=[18,61,64,66],_t={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(n,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(a,o,{5:3}),{6:[1,4],7:5,8:6,9:l,10:8,21:r,23:c,25:y,27:g,28:13,29:14,30:15,31:16,32:17,34:k,37:N,38:p,39:b,40:A,41:v,43:x,46:T,47:I,51:C,53:D,54:L,55:w},s(a,Nt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:dt,70:pt,71:ft,72:bt,73:gt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,o,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:C,53:D,54:L,55:w},{10:51,43:x,51:C,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:C,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:l,10:8,21:r,23:c,25:y,27:g,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:N,38:p,39:b,40:A,41:v,43:x,46:T,47:I,51:C,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:dt,70:pt,71:ft,72:bt,73:gt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:dt,70:pt,71:ft,72:bt,73:gt},s(xt,[2,82]),s(xt,[2,83]),s(u,[2,31]),s(u,Nt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(At,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:C,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:at,53:nt,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:C,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:It,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:C,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(yt,[2,72]),s(J,[2,75]),s(yt,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(At,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:at,53:nt,76:ot},{15:127,43:V,44:M},{13:128,43:at,53:nt,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:It},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(yt,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:at,53:nt,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(n,h){if(h.recoverable)this.trace(n);else{var d=new Error(n);throw d.hash=h,d}},"parseError"),parse:f(function(n){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",ct=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var kt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,kt)&&(Y.yy[kt]=this.yy[kt]);m.setInput(n,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var mt=m.yylloc;t.push(mt);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,Et,U={},ht,R,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var St="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?St="Parse error on line "+(ct+1)+`:
1
+ import{g as Ut}from"./chunk-XXDRQBXY-D8kkjktE.js";import{s as Kt}from"./chunk-VQ5W62QI-r5T-ZVBs.js";import{_ as f,I as Tt,b as Zt,a as jt,s as qt,g as Wt,t as Ht,v as Qt,c as tt,l as F,k as Xt,A as Jt,z as $t,D as te,E as ee,F as se,K as ie,H as re,L as ae,q as ne,r as oe,u as le}from"./mermaid.core-BcRUBvZd.js";import{s as ce}from"./transform-BqqRT-Iy.js";import{c as he}from"./channel-DMgpNBDz.js";import"./index-B6Scr7KJ.js";import"./BlintzCanvas-BCtfZPrs.js";import"./index-DsasLE1l.js";import"./index-BSxkprTm.js";var Ot=(function(){var s=f(function(G,n,h,d){for(h=h||{},d=G.length;d--;h[G[d]]=n);return h},"o"),a=[6,9,21,23,25,27,34,37,38,39,40,41,43,46,47,51,53,54,55],o=[2,2],l=[1,7],r=[1,9],c=[1,10],y=[1,11],g=[1,12],k=[1,30],N=[1,23],p=[1,24],b=[1,25],A=[1,26],v=[1,27],x=[1,19],T=[1,28],I=[1,29],C=[1,20],D=[1,18],L=[1,21],w=[1,22],Nt=[2,6],u=[6,9,21,23,25,27,33,34,37,38,39,40,41,43,46,47,51,53,54,55],dt=[1,36],pt=[1,37],ft=[1,38],bt=[1,39],gt=[1,40],Z=[6,9,12,14,16,19,20,21,23,25,27,33,34,37,38,39,40,41,43,46,47,50,51,53,54,55,69,70,71,72,73],V=[1,46],M=[1,47],j=[1,57],q=[43,51,53,54,55,74,75],W=[1,70],H=[1,68],B=[1,65],Q=[1,69],X=[1,71],et=[6,9,12,16,21,23,25,27,33,34,37,38,39,40,41,43,44,45,46,47,51,52,53,54,55,69,70,71,72,73],st=[1,78],it=[1,77],rt=[1,76],xt=[69,70,71,72,73],Ct=[1,91],At=[6,9,45,50],z=[6,9,12,44,45,50,51,52],at=[1,101],nt=[1,100],ot=[1,99],J=[18,61],It=[1,110],Rt=[1,109],vt=[20,43,51,53,54,55],yt=[18,61,64,66],_t={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,statement:8,NEWLINE:9,entityName:10,relSpec:11,COLON:12,role:13,STYLE_SEPARATOR:14,idList:15,BLOCK_START:16,attributes:17,BLOCK_STOP:18,SQS:19,SQE:20,title:21,title_value:22,acc_title:23,acc_title_value:24,acc_descr:25,acc_descr_value:26,acc_descr_multiline_value:27,direction:28,classDefStatement:29,classStatement:30,styleStatement:31,subgraphHeader:32,END:33,SUBGRAPH:34,separator:35,subgraphTitle:36,direction_tb:37,direction_bt:38,direction_rl:39,direction_lr:40,CLASSDEF:41,stylesOpt:42,UNICODE_TEXT:43,STYLE_TEXT:44,COMMA:45,CLASS:46,STYLE:47,style:48,styleComponent:49,SEMI:50,NUM:51,BRKT:52,ENTITY_NAME:53,DECIMAL_NUM:54,ENTITY_ONE:55,attribute:56,attributeType:57,attributeName:58,attributeKeyTypeList:59,attributeComment:60,ATTRIBUTE_WORD:61,"?":62,attributeKeyType:63,",":64,ATTRIBUTE_KEY:65,COMMENT:66,cardinality:67,relType:68,ZERO_OR_ONE:69,ZERO_OR_MORE:70,ONE_OR_MORE:71,ONLY_ONE:72,MD_PARENT:73,NON_IDENTIFYING:74,IDENTIFYING:75,WORD:76,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",9:"NEWLINE",12:"COLON",14:"STYLE_SEPARATOR",16:"BLOCK_START",18:"BLOCK_STOP",19:"SQS",20:"SQE",21:"title",22:"title_value",23:"acc_title",24:"acc_title_value",25:"acc_descr",26:"acc_descr_value",27:"acc_descr_multiline_value",33:"END",34:"SUBGRAPH",37:"direction_tb",38:"direction_bt",39:"direction_rl",40:"direction_lr",41:"CLASSDEF",43:"UNICODE_TEXT",44:"STYLE_TEXT",45:"COMMA",46:"CLASS",47:"STYLE",50:"SEMI",51:"NUM",52:"BRKT",53:"ENTITY_NAME",54:"DECIMAL_NUM",55:"ENTITY_ONE",61:"ATTRIBUTE_WORD",62:"?",64:",",65:"ATTRIBUTE_KEY",66:"COMMENT",69:"ZERO_OR_ONE",70:"ZERO_OR_MORE",71:"ONE_OR_MORE",72:"ONLY_ONE",73:"MD_PARENT",74:"NON_IDENTIFYING",75:"IDENTIFYING",76:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[7,1],[8,5],[8,9],[8,7],[8,7],[8,4],[8,6],[8,3],[8,5],[8,1],[8,3],[8,7],[8,9],[8,6],[8,8],[8,4],[8,6],[8,2],[8,2],[8,2],[8,1],[8,1],[8,1],[8,1],[8,1],[8,3],[32,3],[32,6],[36,1],[36,2],[28,1],[28,1],[28,1],[28,1],[29,4],[15,1],[15,1],[15,3],[15,3],[30,3],[31,4],[42,1],[42,3],[48,1],[48,2],[35,1],[35,1],[35,1],[49,1],[49,1],[49,1],[49,1],[10,1],[10,1],[10,1],[10,1],[10,1],[17,1],[17,2],[56,2],[56,3],[56,3],[56,4],[57,1],[57,2],[58,1],[59,1],[59,3],[63,1],[60,1],[11,3],[67,1],[67,1],[67,1],[67,1],[67,1],[68,1],[68,1],[13,1],[13,1],[13,1]],performAction:f(function(n,h,d,i,_,t,$){var e=t.length-1;switch(_){case 1:break;case 2:this.$=[];break;case 3:this.$=t[e-1].concat(t[e]);break;case 4:this.$=t[e];break;case 5:case 6:this.$=[];break;case 7:i.addEntity(t[e-4]),i.addEntity(t[e-2]),i.addRelationship(t[e-4],t[e],t[e-2],t[e-3]),this.$=[t[e-4],t[e-2]];break;case 8:i.addEntity(t[e-8]),i.addEntity(t[e-4]),i.addRelationship(t[e-8],t[e],t[e-4],t[e-5]),i.setClass([t[e-8]],t[e-6]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-8],t[e-4]];break;case 9:i.addEntity(t[e-6]),i.addEntity(t[e-2]),i.addRelationship(t[e-6],t[e],t[e-2],t[e-3]),i.setClass([t[e-6]],t[e-4]),this.$=[t[e-6],t[e-2]];break;case 10:i.addEntity(t[e-6]),i.addEntity(t[e-4]),i.addRelationship(t[e-6],t[e],t[e-4],t[e-5]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-6],t[e-4]];break;case 11:i.addEntity(t[e-3]),i.addAttributes(t[e-3],t[e-1]),this.$=[t[e-3]];break;case 12:i.addEntity(t[e-5]),i.addAttributes(t[e-5],t[e-1]),i.setClass([t[e-5]],t[e-3]),this.$=[t[e-5]];break;case 13:i.addEntity(t[e-2]),this.$=[t[e-2]];break;case 14:i.addEntity(t[e-4]),i.setClass([t[e-4]],t[e-2]),this.$=[t[e-4]];break;case 15:i.addEntity(t[e]),this.$=[t[e]];break;case 16:i.addEntity(t[e-2]),i.setClass([t[e-2]],t[e]),this.$=[t[e-2]];break;case 17:i.addEntity(t[e-6],t[e-4]),i.addAttributes(t[e-6],t[e-1]),this.$=[t[e-6]];break;case 18:i.addEntity(t[e-8],t[e-6]),i.addAttributes(t[e-8],t[e-1]),i.setClass([t[e-8]],t[e-3]),this.$=[t[e-8]];break;case 19:i.addEntity(t[e-5],t[e-3]),this.$=[t[e-5]];break;case 20:i.addEntity(t[e-7],t[e-5]),i.setClass([t[e-7]],t[e-2]),this.$=[t[e-7]];break;case 21:i.addEntity(t[e-3],t[e-1]);break;case 22:i.addEntity(t[e-5],t[e-3]),i.setClass([t[e-5]],t[e]);break;case 23:case 24:this.$=t[e].trim(),i.setAccTitle(this.$);break;case 25:case 26:this.$=t[e].trim(),i.setAccDescription(this.$);break;case 27:i.subgraphDepth?this.$=t[e]:(i.setDirection(t[e].value),this.$=[]);break;case 31:i.subgraphDepth=(i.subgraphDepth||1)-1,this.$=i.addSubGraph({text:t[e-2].id},t[e-1],{text:t[e-2].text});break;case 32:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-1],text:t[e-1]};break;case 33:i.subgraphDepth=(i.subgraphDepth||0)+1,this.$={id:t[e-4],text:t[e-2]};break;case 34:case 59:case 60:case 61:case 62:case 86:this.$=t[e];break;case 35:this.$=t[e-1]+" "+t[e];break;case 36:this.$={stmt:"dir",value:"TB"};break;case 37:this.$={stmt:"dir",value:"BT"};break;case 38:this.$={stmt:"dir",value:"RL"};break;case 39:this.$={stmt:"dir",value:"LR"};break;case 40:this.$=t[e-3],i.addClass(t[e-2],t[e-1]);break;case 41:case 42:case 63:case 72:this.$=[t[e]];break;case 43:case 44:this.$=t[e-2].concat([t[e]]);break;case 45:this.$=t[e-2],i.setClass(t[e-1],t[e]);break;case 46:this.$=t[e-3],i.addCssStyles(t[e-2],t[e-1]);break;case 47:this.$=[t[e]];break;case 48:t[e-2].push(t[e]),this.$=t[e-2];break;case 50:this.$=t[e-1]+t[e];break;case 58:case 84:case 85:this.$=t[e].replace(/"/g,"");break;case 64:t[e].push(t[e-1]),this.$=t[e];break;case 65:this.$={type:t[e-1],name:t[e]};break;case 66:this.$={type:t[e-2],name:t[e-1],keys:t[e]};break;case 67:this.$={type:t[e-2],name:t[e-1],comment:t[e]};break;case 68:this.$={type:t[e-3],name:t[e-2],keys:t[e-1],comment:t[e]};break;case 69:case 71:case 74:this.$=t[e];break;case 70:this.$=t[e-1]+t[e];break;case 73:t[e-2].push(t[e]),this.$=t[e-2];break;case 75:this.$=t[e].replace(/"/g,"");break;case 76:this.$={cardA:t[e],relType:t[e-1],cardB:t[e-2]};break;case 77:this.$=i.Cardinality.ZERO_OR_ONE;break;case 78:this.$=i.Cardinality.ZERO_OR_MORE;break;case 79:this.$=i.Cardinality.ONE_OR_MORE;break;case 80:this.$=i.Cardinality.ONLY_ONE;break;case 81:this.$=i.Cardinality.MD_PARENT;break;case 82:this.$=i.Identification.NON_IDENTIFYING;break;case 83:this.$=i.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},s(a,o,{5:3}),{6:[1,4],7:5,8:6,9:l,10:8,21:r,23:c,25:y,27:g,28:13,29:14,30:15,31:16,32:17,34:k,37:N,38:p,39:b,40:A,41:v,43:x,46:T,47:I,51:C,53:D,54:L,55:w},s(a,Nt,{1:[2,1]}),s(u,[2,3]),s(u,[2,4]),s(u,[2,5]),s(u,[2,15],{11:31,67:35,14:[1,32],16:[1,33],19:[1,34],69:dt,70:pt,71:ft,72:bt,73:gt}),{22:[1,41]},{24:[1,42]},{26:[1,43]},s(u,[2,26]),s(u,[2,27]),s(u,[2,28]),s(u,[2,29]),s(u,[2,30]),s(u,o,{5:44}),s(Z,[2,58]),s(Z,[2,59]),s(Z,[2,60]),s(Z,[2,61]),s(Z,[2,62]),s(u,[2,36]),s(u,[2,37]),s(u,[2,38]),s(u,[2,39]),{15:45,43:V,44:M},{15:48,43:V,44:M},{15:49,43:V,44:M},{10:50,43:x,51:C,53:D,54:L,55:w},{10:51,43:x,51:C,53:D,54:L,55:w},{15:52,43:V,44:M},{17:53,18:[1,54],56:55,57:56,61:j},{10:58,43:x,51:C,53:D,54:L,55:w},{68:59,74:[1,60],75:[1,61]},s(q,[2,77]),s(q,[2,78]),s(q,[2,79]),s(q,[2,80]),s(q,[2,81]),s(u,[2,23]),s(u,[2,24]),s(u,[2,25]),{6:[1,63],7:5,8:6,9:l,10:8,21:r,23:c,25:y,27:g,28:13,29:14,30:15,31:16,32:17,33:[1,62],34:k,37:N,38:p,39:b,40:A,41:v,43:x,46:T,47:I,51:C,53:D,54:L,55:w},{12:W,42:64,44:H,45:B,48:66,49:67,51:Q,52:X},s(et,[2,41]),s(et,[2,42]),{15:72,43:V,44:M,45:B},{12:W,42:73,44:H,45:B,48:66,49:67,51:Q,52:X},{6:st,9:it,19:[1,75],35:74,50:rt},{12:[1,79],14:[1,80]},s(u,[2,16],{67:35,11:81,16:[1,82],45:B,69:dt,70:pt,71:ft,72:bt,73:gt}),{18:[1,83]},s(u,[2,13]),{17:84,18:[2,63],56:55,57:56,61:j},{58:85,61:[1,86]},{61:[2,69],62:[1,87]},{20:[1,88]},{67:89,69:dt,70:pt,71:ft,72:bt,73:gt},s(xt,[2,82]),s(xt,[2,83]),s(u,[2,31]),s(u,Nt),{6:st,9:it,35:90,45:Ct,50:rt},{43:[1,92],44:[1,93]},s(At,[2,47],{49:94,12:W,44:H,51:Q,52:X}),s(z,[2,49]),s(z,[2,54]),s(z,[2,55]),s(z,[2,56]),s(z,[2,57]),s(u,[2,45],{45:B}),{6:st,9:it,35:95,45:Ct,50:rt},s(u,[2,32]),{10:97,36:96,43:x,51:C,53:D,54:L,55:w},s(u,[2,51]),s(u,[2,52]),s(u,[2,53]),{13:98,43:at,53:nt,76:ot},{15:102,43:V,44:M},{10:103,43:x,51:C,53:D,54:L,55:w},{17:104,18:[1,105],56:55,57:56,61:j},s(u,[2,11]),{18:[2,64]},s(J,[2,65],{59:106,60:107,63:108,65:It,66:Rt}),s([18,61,65,66],[2,71]),{61:[2,70]},s(u,[2,21],{14:[1,112],16:[1,111]}),s([43,51,53,54,55],[2,76]),s(u,[2,40]),{12:W,44:H,48:113,49:67,51:Q,52:X},s(et,[2,43]),s(et,[2,44]),s(z,[2,50]),s(u,[2,46]),{10:115,20:[1,114],43:x,51:C,53:D,54:L,55:w},s(vt,[2,34]),s(u,[2,7]),s(u,[2,84]),s(u,[2,85]),s(u,[2,86]),{12:[1,116],45:B},{12:[1,118],14:[1,117]},{18:[1,119]},s(u,[2,14]),s(J,[2,66],{60:120,64:[1,121],66:Rt}),s(J,[2,67]),s(yt,[2,72]),s(J,[2,75]),s(yt,[2,74]),{17:122,18:[1,123],56:55,57:56,61:j},{15:124,43:V,44:M},s(At,[2,48],{49:94,12:W,44:H,51:Q,52:X}),{6:st,9:it,35:125,50:rt},s(vt,[2,35]),{13:126,43:at,53:nt,76:ot},{15:127,43:V,44:M},{13:128,43:at,53:nt,76:ot},s(u,[2,12]),s(J,[2,68]),{63:129,65:It},{18:[1,130]},s(u,[2,19]),s(u,[2,22],{16:[1,131],45:B}),s(u,[2,33]),s(u,[2,10]),{12:[1,132],45:B},s(u,[2,9]),s(yt,[2,73]),s(u,[2,17]),{17:133,18:[1,134],56:55,57:56,61:j},{13:135,43:at,53:nt,76:ot},{18:[1,136]},s(u,[2,20]),s(u,[2,8]),s(u,[2,18])],defaultActions:{84:[2,64],87:[2,70]},parseError:f(function(n,h){if(h.recoverable)this.trace(n);else{var d=new Error(n);throw d.hash=h,d}},"parseError"),parse:f(function(n){var h=this,d=[0],i=[],_=[null],t=[],$=this.table,e="",ct=0,Dt=0,Ft=2,Lt=1,Yt=t.slice.call(arguments,1),m=Object.create(this.lexer),Y={yy:{}};for(var kt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,kt)&&(Y.yy[kt]=this.yy[kt]);m.setInput(n,Y.yy),Y.yy.lexer=m,Y.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var mt=m.yylloc;t.push(mt);var Pt=m.options&&m.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function zt(S){d.length=d.length-2*S,_.length=_.length-S,t.length=t.length-S}f(zt,"popStack");function wt(){var S;return S=i.pop()||m.lex()||Lt,typeof S!="number"&&(S instanceof Array&&(i=S,S=i.pop()),S=h.symbols_[S]||S),S}f(wt,"lex");for(var E,P,O,Et,U={},ht,R,Vt,ut;;){if(P=d[d.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=wt()),O=$[P]&&$[P][E]),typeof O>"u"||!O.length||!O[0]){var St="";ut=[];for(ht in $[P])this.terminals_[ht]&&ht>Ft&&ut.push("'"+this.terminals_[ht]+"'");m.showPosition?St="Parse error on line "+(ct+1)+`:
2
2
  `+m.showPosition()+`
3
3
  Expecting `+ut.join(", ")+", got '"+(this.terminals_[E]||E)+"'":St="Parse error on line "+(ct+1)+": Unexpected "+(E==Lt?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(St,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:mt,expected:ut})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(O[0]){case 1:d.push(E),_.push(m.yytext),t.push(m.yylloc),d.push(O[1]),E=null,Dt=m.yyleng,e=m.yytext,ct=m.yylineno,mt=m.yylloc;break;case 2:if(R=this.productions_[O[1]][1],U.$=_[_.length-R],U._$={first_line:t[t.length-(R||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(R||1)].first_column,last_column:t[t.length-1].last_column},Pt&&(U._$.range=[t[t.length-(R||1)].range[0],t[t.length-1].range[1]]),Et=this.performAction.apply(U,[e,Dt,ct,Y.yy,O[1],_,t].concat(Yt)),typeof Et<"u")return Et;R&&(d=d.slice(0,-1*R*2),_=_.slice(0,-1*R),t=t.slice(0,-1*R)),d.push(this.productions_[O[1]][0]),_.push(U.$),t.push(U._$),Vt=$[d[d.length-2]][d[d.length-1]],d.push(Vt);break;case 3:return!0}}return!0},"parse")},Gt=(function(){var G={EOF:1,parseError:f(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:f(function(n,h){return this.yy=h||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var h=n.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},"input"),unput:f(function(n){var h=n.length,d=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===i.length?this.yylloc.first_column:0)+i[i.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(n){this.unput(this.match.slice(n))},"less"),pastInput:f(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var n=this.pastInput(),h=new Array(n.length+1).join("-");return n+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{a8 as v,a9 as E}from"./index-DwrBsA10.js";const C={none:"None",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",max:"Max",xhigh:"Extra high"};function D(n){return n?C[n]:"Default"}function w(n){return n&&n.length>0?n.map(e=>e.value):void 0}function x(n,e){var o;const i=n.runtime??e.defaultRuntime;if(!e.runtimeDeclaresCredits(i))return!1;if(i!==m)return((o=e.runtimeDefaultsToCredits)==null?void 0:o.call(e,i))??!1;if(!e.credits)return!1;const a=n.account??null;return a===v?e.credits.allowedAgents.includes(n.id):a===null&&e.credits.isDefault}const m="claude-code";function R(n){const{agent:e,defaultRuntime:i,serverDefaultModel:a,knownRuntimes:o,knownModels:c,knownAccounts:r,accountsUnavailable:h,modelSupportsEffort:g,runtimeSupportsEffort:p,runtimeLabel:f=E}=n,t=[],l=[],s=e.runtime??i,b=e.model??a??null,u=s===m&&h!==!0?e.account??null:null,d=u!==null?r==null?void 0:r.find(k=>k.id===u):void 0;return e.runtime!=null&&e.runtime!==i&&l.push({field:"runtime",label:f(e.runtime)}),e.model!=null&&l.push({field:"model",label:e.model}),e.effort!=null&&l.push({field:"effort",label:D(e.effort)}),u!==null&&l.push({field:"account",label:(d==null?void 0:d.label)??u}),o!==void 0&&!o.includes(s)?t.push({kind:"runtime-not-connected",message:`${f(s)} is not connected on this machine.`}):(e.model!=null&&c!==void 0&&!c.includes(e.model)&&t.push({kind:"model-unavailable",message:`${f(s)} no longer offers ${e.model}.`}),u!==null&&r!==void 0&&!d&&t.push({kind:"account-unregistered",message:`“${u}” isn’t on this computer. This agent runs on your default account.`})),e.effort!=null&&(p===!1?t.push({kind:"effort-unsupported-runtime",message:`${f(s)} has no effort setting. It’s ignored.`}):g===!1&&t.push({kind:"effort-unsupported-model",message:`${b??"This model"} does not take an effort setting.`})),{breakages:t,deviations:l,isException:t.length>0||l.length>0,isBroken:t.length>0}}export{x as a,R as d,D as e,w as k};
1
+ import{a8 as v,a9 as E}from"./index-B6Scr7KJ.js";const C={none:"None",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",max:"Max",xhigh:"Extra high"};function D(n){return n?C[n]:"Default"}function w(n){return n&&n.length>0?n.map(e=>e.value):void 0}function x(n,e){var o;const i=n.runtime??e.defaultRuntime;if(!e.runtimeDeclaresCredits(i))return!1;if(i!==m)return((o=e.runtimeDefaultsToCredits)==null?void 0:o.call(e,i))??!1;if(!e.credits)return!1;const a=n.account??null;return a===v?e.credits.allowedAgents.includes(n.id):a===null&&e.credits.isDefault}const m="claude-code";function R(n){const{agent:e,defaultRuntime:i,serverDefaultModel:a,knownRuntimes:o,knownModels:c,knownAccounts:r,accountsUnavailable:h,modelSupportsEffort:g,runtimeSupportsEffort:p,runtimeLabel:f=E}=n,t=[],l=[],s=e.runtime??i,b=e.model??a??null,u=s===m&&h!==!0?e.account??null:null,d=u!==null?r==null?void 0:r.find(k=>k.id===u):void 0;return e.runtime!=null&&e.runtime!==i&&l.push({field:"runtime",label:f(e.runtime)}),e.model!=null&&l.push({field:"model",label:e.model}),e.effort!=null&&l.push({field:"effort",label:D(e.effort)}),u!==null&&l.push({field:"account",label:(d==null?void 0:d.label)??u}),o!==void 0&&!o.includes(s)?t.push({kind:"runtime-not-connected",message:`${f(s)} is not connected on this machine.`}):(e.model!=null&&c!==void 0&&!c.includes(e.model)&&t.push({kind:"model-unavailable",message:`${f(s)} no longer offers ${e.model}.`}),u!==null&&r!==void 0&&!d&&t.push({kind:"account-unregistered",message:`“${u}” isn’t on this computer. This agent runs on your default account.`})),e.effort!=null&&(p===!1?t.push({kind:"effort-unsupported-runtime",message:`${f(s)} has no effort setting. It’s ignored.`}):g===!1&&t.push({kind:"effort-unsupported-model",message:`${b??"This model"} does not take an effort setting.`})),{breakages:t,deviations:l,isException:t.length>0||l.length>0,isBroken:t.length>0}}export{x as a,R as d,D as e,w as k};
@@ -1,4 +1,4 @@
1
- import{O as e}from"./index-DwrBsA10.js";/**
1
+ import{O as e}from"./index-B6Scr7KJ.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{O as e}from"./index-DwrBsA10.js";/**
1
+ import{O as e}from"./index-B6Scr7KJ.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{O as a}from"./index-DwrBsA10.js";/**
1
+ import{O as a}from"./index-B6Scr7KJ.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,14 +1,14 @@
1
- import{O as u,j as t,ar as h,G as y,fA as _,aY as N}from"./index-DwrBsA10.js";import{u as j,p as b,W as k,a as v}from"./WidgetErrorCard-DictdlWO.js";import{C as E}from"./card-6VNSI3kT.js";/**
1
+ import{O as u,j as t,ar as h,G as y,fC as _,aY as N}from"./index-B6Scr7KJ.js";import{u as j,p as b,W as k,a as v}from"./WidgetErrorCard-BA3P7hNv.js";import{C as E}from"./card-DA_Z-FYX.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const m={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};m.node;const A=u(m);/**
6
+ */const m={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};m.node;const F=u(m);/**
7
7
  * @license lucide-react v1.48.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const p={name:"picture-in-picture-2",size:24,node:[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]};p.node;const w=u(p),I=1.6;function r({className:e}){return t.jsx("div",{className:y("bg-muted rounded-md",e)})}function S(){const e=j();return t.jsxs(E,{gap:"sm",className:"relative overflow-hidden","aria-busy":"true","aria-label":"Loading widget",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(r,{className:"size-8 rounded-lg"}),t.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[t.jsx(r,{className:"h-3.5 w-1/3"}),t.jsx(r,{className:"h-2.5 w-1/2"})]})]}),t.jsx(r,{className:"h-2.5 w-full"}),t.jsx(r,{className:"h-2.5 w-5/6"}),t.jsx(r,{className:"h-16 w-full"}),e&&t.jsx(h.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 w-1/2 -skew-x-12 bg-gradient-to-r from-transparent via-white/50 to-transparent dark:via-white/[0.06]",initial:{x:"-150%"},animate:{x:"350%"},transition:{duration:I,ease:"linear",repeat:1/0,repeatDelay:.4}})]})}function F({code:e,isIncomplete:i,sessionId:n,isLatestMessage:s,isStreaming:d=!1}){const o=_(null),c=N(a=>a.openPip);if(!i){const a=b(e);if(a.ok)o.write(a.document);else if(o.read()===null&&!d)return t.jsx("div",{className:"my-2",children:t.jsx(k,{error:a.error,raw:a.raw})})}const l=o.read();if(l){const a=()=>{n&&c({kind:"widget",sessionId:n,title:l.title??"Widget"})};return t.jsxs("div",{className:"group relative my-2",children:[t.jsx(v,{document:l,sessionId:n,isLatestMessage:s}),n&&t.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),a()},"aria-label":"Pop out into a floating window",title:"Pop out",className:"text-muted-foreground hover:bg-muted hover:text-foreground bg-background/80 focus-ring absolute top-1 right-1 rounded-md p-1 opacity-100 backdrop-blur-sm transition-opacity focus-visible:opacity-100 md:opacity-0 md:group-hover:opacity-100",children:t.jsx(w,{className:"size-3.5"})})]})}return t.jsx("div",{className:"my-2",children:t.jsx(S,{})})}const L="__optimistic_user__",g="__in_progress_turn__",M="dorkos-ui",f=`\`\`\`${M}`,W="```";function C(e){const i=e.messages.map(s=>({key:s.id,content:s.content,isStreaming:!1}));e.optimisticUserMessage&&i.push({key:L,content:e.optimisticUserMessage.content,isStreaming:!1});const n=e.inProgressTurn.filter(s=>s.type==="text_delta").map(s=>s.text).join("");return n.length>0&&i.push({key:g,content:n,isStreaming:!0}),i}function P(e){return e.endsWith("\r")?e.slice(0,-1):e}function R(e){const i=e.lastIndexOf(f),n=e.indexOf(`
11
+ */const p={name:"picture-in-picture-2",size:24,node:[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]};p.node;const w=u(p),I=1.6;function r({className:e}){return t.jsx("div",{className:y("bg-muted rounded-md",e)})}function S(){const e=j();return t.jsxs(E,{gap:"sm",className:"relative overflow-hidden","aria-busy":"true","aria-label":"Loading widget",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx(r,{className:"size-8 rounded-lg"}),t.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[t.jsx(r,{className:"h-3.5 w-1/3"}),t.jsx(r,{className:"h-2.5 w-1/2"})]})]}),t.jsx(r,{className:"h-2.5 w-full"}),t.jsx(r,{className:"h-2.5 w-5/6"}),t.jsx(r,{className:"h-16 w-full"}),e&&t.jsx(h.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 left-0 w-1/2 -skew-x-12 bg-gradient-to-r from-transparent via-white/50 to-transparent dark:via-white/[0.06]",initial:{x:"-150%"},animate:{x:"350%"},transition:{duration:I,ease:"linear",repeat:1/0,repeatDelay:.4}})]})}function G({code:e,isIncomplete:i,sessionId:n,isLatestMessage:s,isStreaming:d=!1}){const o=_(null),c=N(a=>a.openPip);if(!i){const a=b(e);if(a.ok)o.write(a.document);else if(o.read()===null&&!d)return t.jsx("div",{className:"my-2",children:t.jsx(k,{error:a.error,raw:a.raw})})}const l=o.read();if(l){const a=()=>{n&&c({kind:"widget",sessionId:n,title:l.title??"Widget"})};return t.jsxs("div",{className:"group relative my-2",children:[t.jsx(v,{document:l,sessionId:n,isLatestMessage:s}),n&&t.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),a()},"aria-label":"Pop out into a floating window",title:"Pop out",className:"text-muted-foreground hover:bg-muted hover:text-foreground bg-background/80 focus-ring absolute top-1 right-1 rounded-md p-1 opacity-100 backdrop-blur-sm transition-opacity focus-visible:opacity-100 md:opacity-0 md:group-hover:opacity-100",children:t.jsx(w,{className:"size-3.5"})})]})}return t.jsx("div",{className:"my-2",children:t.jsx(S,{})})}const C="__optimistic_user__",g="__in_progress_turn__",L="dorkos-ui",f=`\`\`\`${L}`,M="```";function W(e){const i=e.messages.map(s=>({key:s.id,content:s.content,isStreaming:!1}));e.optimisticUserMessage&&i.push({key:C,content:e.optimisticUserMessage.content,isStreaming:!1});const n=e.inProgressTurn.filter(s=>s.type==="text_delta").map(s=>s.text).join("");return n.length>0&&i.push({key:g,content:n,isStreaming:!0}),i}function P(e){return e.endsWith("\r")?e.slice(0,-1):e}function R(e){const i=e.lastIndexOf(f),n=e.indexOf(`
12
12
  `,i),s=n===-1?e.length:n+1,o=e.slice(s).split(`
13
- `),c=o.findIndex(a=>a.trimEnd()===W);return{code:(c===-1?o:o.slice(0,c)).map(P).join(`
14
- `),isIncomplete:c===-1}}function G(e){const i=C(e);for(let n=i.length-1;n>=0;n--){const s=i[n];if(!s.content.includes(f))continue;const{code:d,isIncomplete:o}=R(s.content);return{code:d,isIncomplete:o,sourceMessageKey:s.key,isLatest:!0,isStreaming:s.key===g}}return null}export{A as C,w as P,M as W,F as a,f as b,G as f};
13
+ `),c=o.findIndex(a=>a.trimEnd()===M);return{code:(c===-1?o:o.slice(0,c)).map(P).join(`
14
+ `),isIncomplete:c===-1}}function U(e){const i=W(e);for(let n=i.length-1;n>=0;n--){const s=i[n];if(!s.content.includes(f))continue;const{code:d,isIncomplete:o}=R(s.content);return{code:d,isIncomplete:o,sourceMessageKey:s.key,isLatest:!0,isStreaming:s.key===g}}return null}export{F as C,w as P,L as W,G as a,f as b,U as f};
@@ -1,4 +1,4 @@
1
- import{g as qt}from"./chunk-5VM5RSS4-DF1L8DrH.js";import{g as Xt}from"./chunk-XXDRQBXY-DFFzLm_u.js";import{s as Qt}from"./chunk-VQ5W62QI-Bgmsy9NF.js";import{_ as m,p as Jt,l as te,c as Ae,q as Zt,r as $t,u as rt,b as e1,s as t1,t as s1,a as i1,g as r1,v as a1,k as n1,x as u1,J as o1,y as l1,z as st,A as c1,B as h1,D as d1,E as p1,F as f1,G as g1,H as b1}from"./mermaid.core-BQiwaVjZ.js";import{c as k1}from"./chunk-55XCU76K-Bigp9-bU.js";import{s as it}from"./transform-BqqRT-Iy.js";import{p as A1}from"./BlintzCanvas-D9ZLEDXc.js";import{c as m1}from"./channel-Bf4e4rlX.js";var C1="flowchart-",Pe,T1=(Pe=class{constructor(){this.vertexCounter=0,this.config=Ae(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=e1,this.setAccDescription=t1,this.setDiagramTitle=s1,this.getAccTitle=i1,this.getAccDescription=r1,this.getDiagramTitle=a1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return n1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const n of this.vertices.values())if(n.id===i)return this.diagramId?`${this.diagramId}-${n.domId}`:n.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,n,r,a,o,b,l={},k){var F,_;if(!i||i.trim().length===0)return;let u;if(k!==void 0){let B;k.includes(`
1
+ import{g as qt}from"./chunk-5VM5RSS4-DswTXnmp.js";import{g as Xt}from"./chunk-XXDRQBXY-D8kkjktE.js";import{s as Qt}from"./chunk-VQ5W62QI-r5T-ZVBs.js";import{_ as m,p as Jt,l as te,c as Ae,q as Zt,r as $t,u as rt,b as e1,s as t1,t as s1,a as i1,g as r1,v as a1,k as n1,x as u1,J as o1,y as l1,z as st,A as c1,B as h1,D as d1,E as p1,F as f1,G as g1,H as b1}from"./mermaid.core-BcRUBvZd.js";import{c as k1}from"./chunk-55XCU76K-0JSp6acZ.js";import{s as it}from"./transform-BqqRT-Iy.js";import{p as A1}from"./BlintzCanvas-BCtfZPrs.js";import{c as m1}from"./channel-DMgpNBDz.js";var C1="flowchart-",Pe,T1=(Pe=class{constructor(){this.vertexCounter=0,this.config=Ae(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=e1,this.setAccDescription=t1,this.setDiagramTitle=s1,this.getAccTitle=i1,this.getAccDescription=r1,this.getDiagramTitle=a1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return n1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const n of this.vertices.values())if(n.id===i)return this.diagramId?`${this.diagramId}-${n.domId}`:n.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,n,r,a,o,b,l={},k){var F,_;if(!i||i.trim().length===0)return;let u;if(k!==void 0){let B;k.includes(`
2
2
  `)?B=k+`
3
3
  `:B=`{
4
4
  `+k+`
@@ -1 +1 @@
1
- var et=t=>{throw TypeError(t)};var tt=(t,n,e)=>n.has(t)||et("Cannot "+e);var y=(t,n,e)=>(tt(t,n,"read from private field"),e?e.call(t):n.get(t)),N=(t,n,e)=>n.has(t)?et("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),B=(t,n,e,i)=>(tt(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e);var it=(t,n,e,i)=>({set _(r){B(t,n,r,e)},get _(){return y(t,n,i)}});import{r as C,lp as St,j as p,lq as pt,dp as ce,dq as he,I as yt,g_ as fe,hY as me,hZ as Vt,ef as At,eg as Et,eh as wt,ei as It,ej as Ct,$ as Lt,gO as Tt,en as xt,B as Dt}from"./index-DwrBsA10.js";function Bt({update:t,notify:n,unwatched:e}){return{link:i,unlink:r,propagate:h,checkDirty:s,shallowPropagate:a};function i(l,d,o){const f=d.depsTail;if(f!==void 0&&f.dep===l)return;const m=f!==void 0?f.nextDep:d.deps;if(m!==void 0&&m.dep===l){m.version=o,d.depsTail=m;return}const c=l.subsTail;if(c!==void 0&&c.version===o&&c.sub===d)return;const g=d.depsTail=l.subsTail={version:o,dep:l,sub:d,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:d.deps=g,c!==void 0?c.nextSub=g:l.subs=g}function r(l,d=l.sub){const o=l.dep,f=l.prevDep,m=l.nextDep,c=l.nextSub,g=l.prevSub;return m!==void 0?m.prevDep=f:d.depsTail=f,f!==void 0?f.nextDep=m:d.deps=m,c!==void 0?c.prevSub=g:o.subsTail=g,g!==void 0?g.nextSub=c:(o.subs=c)===void 0&&e(o),m}function h(l){let d=l.nextSub,o;e:do{const f=l.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&u(l,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&n(f),m&1){const c=f.subs;if(c!==void 0){const g=(l=c).nextSub;g!==void 0&&(o={value:d,prev:o},d=g);continue}}if((l=d)!==void 0){d=l.nextSub;continue}for(;o!==void 0;)if(l=o.value,o=o.prev,l!==void 0){d=l.nextSub;continue e}break}while(!0)}function s(l,d){let o,f=0,m=!1;e:do{const c=l.dep,g=c.flags;if(d.flags&16)m=!0;else if((g&17)===17){if(t(c)){const v=c.subs;v.nextSub!==void 0&&a(v),m=!0}}else if((g&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(o={value:l,prev:o}),l=c.deps,d=c,++f;continue}if(!m){const v=l.nextDep;if(v!==void 0){l=v;continue}}for(;f--;){const v=d.subs,S=v.nextSub!==void 0;if(S?(l=o.value,o=o.prev):l=v,m){if(t(d)){S&&a(v),d=l.sub;continue}m=!1}else d.flags&=-33;d=l.sub;const F=l.nextDep;if(F!==void 0){l=F;continue e}}return m}while(!0)}function a(l){do{const d=l.sub,o=d.flags;(o&48)===32&&(d.flags=o|16,(o&6)===2&&n(d))}while((l=l.nextSub)!==void 0)}function u(l,d){let o=d.depsTail;for(;o!==void 0;){if(o===l)return!0;o=o.prevDep}return!1}}function Ye(t,n,e){var h,s,a;const i=typeof t=="object",r=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(r),error:(s=i?t.error:n)==null?void 0:s.bind(r),complete:(a=i?t.complete:e)==null?void 0:a.bind(r)}}const qe=[];let xe=0;const{link:st,unlink:kt,propagate:jt,checkDirty:ft,shallowPropagate:rt}=Bt({update(t){return t._update()},notify(t){qe[He++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,je(t))}});let Ce=0,He=0,z,Xe=0;function _(t){try{++Xe,t()}finally{--Xe||mt()}}function je(t){const n=t.depsTail;let e=n!==void 0?n.nextDep:t.deps;for(;e!==void 0;)e=kt(e,t)}function mt(){if(!(Xe>0)){for(;Ce<He;){const t=qe[Ce];qe[Ce++]=void 0,t.notify()}Ce=0,He=0}}function gt(t,n){const e=typeof t=="function",i=t,r={_snapshot:e?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:e?0:1,get(){return z!==void 0&&st(r,z,xe),r._snapshot},subscribe(h){const s=Ye(h),a={current:!1},u=Pt(()=>{var l;r.get(),a.current?(l=s.next)==null||l.call(s,r._snapshot):a.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=r,++xe,r.depsTail=void 0;else if(h===void 0)return!1;e&&(r.flags=5);try{const u=r._snapshot,l=typeof h=="function"?h(u):h===void 0&&e?i(u):h;return u===void 0||!a(u,l)?(r._snapshot=l,!0):!1}finally{z=s,e&&(r.flags&=-5),je(r)}}};return e?(r.flags=17,r.get=function(){const h=r.flags;if(h&16||h&32&&ft(r.deps,r)){if(r._update()){const s=r.subs;s!==void 0&&rt(s)}}else h&32&&(r.flags=h&-33);return z!==void 0&&st(r,z,xe),r._snapshot}):r.set=function(h){if(r._update(h)){const s=r.subs;s!==void 0&&(jt(s),rt(s),mt())}},r}function Pt(t){const n=()=>{const i=z;z=e,++xe,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,je(e)}},e={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const i=this.flags;i&16||i&32&&ft(this.deps,this)?n():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,je(this)}};return n(),e}var _t=class{constructor(t,n){this.atom=gt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ye(t))}},Rt=class{constructor(t){this.atom=gt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ye(t))}};function ie(t,n){return typeof t=="function"?new Rt(t):new _t(t)}var Nt=class{constructor(t,n){this.fn=t,this.options=n,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{const i=Date.now()-this.lastExecutionTime;if(this.options.leading&&i>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){const r=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},r)}},this.execute=(...e)=>{var i,r;this.fn(...e),(r=(i=this.options).onExecute)==null||r.call(i,e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Ot(t,n){return new Nt(t,n).maybeExecute}var ee,U,G,Ee,H,re,X,le,we,Re,te,ue,Z,Ie,de,Ne;class Gt{constructor({pluginId:n,debug:e=!1,enabled:i=!0,reconnectEveryMs:r=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,Ee);N(this,H);N(this,re);N(this,X);N(this,le);N(this,we,0);N(this,Re,5);N(this,te,!1);N(this,ue,!1);N(this,Z,null);N(this,Ie,()=>{this.debugLog("Connected to event bus"),B(this,re,!0),B(this,te,!1),this.debugLog("Emitting queued events",y(this,H)),y(this,H).forEach(n=>this.emitEventToBus(n)),B(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ie))});N(this,de,()=>{if(y(this,we)<y(this,Re)){it(this,we)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,de)),B(this,ue,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Ne,()=>{y(this,te)||(B(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ie)),y(this,de).call(this))});B(this,U,n),B(this,ee,i),B(this,G,this.getGlobalTarget),B(this,Ee,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),B(this,H,[]),B(this,re,!1),B(this,ue,!1),B(this,X,null),B(this,le,r)}startConnectLoop(){y(this,X)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,le)}ms)`),B(this,X,setInterval(y(this,de),y(this,le))))}stopConnectLoop(){B(this,te,!1),y(this,X)!==null&&(clearInterval(y(this,X)),B(this,X,null),B(this,H,[]),this.debugLog("Stopped connect loop"))}debugLog(...n){y(this,Ee)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...n)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const n=typeof EventTarget<"u"?new EventTarget:void 0;return typeof n>"u"||typeof n.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),n)}getPluginId(){return y(this,U)}dispatchCustomEventShim(n,e){try{const i=new Event(n,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(n,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(n,{detail:e}))}catch{this.dispatchCustomEventShim(n,e)}}emitEventToBus(n){this.debugLog("Emitting event to client bus",n),this.dispatchCustomEvent("tanstack-dispatch-event",n)}createEventPayload(n,e){return{type:`${y(this,U)}:${n}`,payload:e,pluginId:y(this,U)}}emit(n,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",n,e);return}if(y(this,Z)&&(this.debugLog("Emitting event to internal event target",n,e),y(this,Z).dispatchEvent(new CustomEvent(`${y(this,U)}:${n}`,{detail:this.createEventPayload(n,e)}))),y(this,ue)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!y(this,re)){this.debugLog("Bus not available, will be pushed as soon as connected"),y(this,H).push(this.createEventPayload(n,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Ne).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(n,e))}on(n,e,i){const r=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${n}`;if(r&&(y(this,Z)||B(this,Z,new EventTarget),y(this,Z).addEventListener(h,a=>{e(a.detail)})),!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event",h),()=>{};const s=a=>{this.debugLog("Received event from bus",a.detail),e(a.detail)};return y(this,G).call(this).addEventListener(h,s),this.debugLog("Registered event to bus",h),()=>{var a;r&&((a=y(this,Z))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;y(this,U)&&r.pluginId!==y(this,U)||n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}}ee=new WeakMap,U=new WeakMap,G=new WeakMap,Ee=new WeakMap,H=new WeakMap,re=new WeakMap,X=new WeakMap,le=new WeakMap,we=new WeakMap,Re=new WeakMap,te=new WeakMap,ue=new WeakMap,Z=new WeakMap,Ie=new WeakMap,de=new WeakMap,Ne=new WeakMap;class $t extends Gt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new $t;function ge(t,n){return typeof t=="function"?t(n):t}function oe(t,n){return Oe(n).reduce((i,r)=>{if(i===null)return null;if(typeof i<"u")return i[r]},t)}function be(t,n,e){const i=Oe(n);function r(h){if(!i.length)return ge(e,h);const s=i.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(h))return typeof h=="object"?(h===null&&(h={}),{...h,[s]:r(h[s])}):{[s]:r()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),r(h[s]),...h.slice(s+1)]}return[...new Array(s),r()]}return r(t)}function Wt(t,n){const e=Oe(n);function i(r){if(!r)return;if(e.length===1){const s=e[0];if(Array.isArray(r)&&typeof s=="number")return r.filter((l,d)=>d!==s);const{[s]:a,...u}=r;return u}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(r))&&typeof r=="object")return{...r,[h]:i(r[h])};if(typeof h=="number"&&Array.isArray(r)){if(h>=r.length)return r;const s=r.slice(0,h);return[...s.length?s:new Array(h),i(r[h]),...r.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const nt=46,Ge=91,$e=93,at=48,Ut=57;function Oe(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const n=t.length,e=[];let i=n>0&&t.charCodeAt(0)===Ge?1:0,r=!0,h=-1;for(let s=i;s<=n;s++){const a=s<n?t.charCodeAt(s):-1;if(s===n||a===nt||a===Ge||a===$e){const u=s-i;if(u>0){const l=r&&(u===1||t.charCodeAt(i)!==at),d=t.slice(i,s);if(l){const o=parseInt(d,10);u<=15||String(o)===d?e.push(o):e.push(d)}else e.push(d)}else h!==$e&&!(h===-1&&a===$e)&&!(h===a&&(a===nt||a===Ge))&&e.push("");i=s+1,r=!0}else(a<at||a>Ut)&&(r=!1);h=a}return e.length||e.push(""),e}function ot(t,n){return t.length===0?n:n.length===0?t:n.startsWith("[")||n.startsWith(".")?t+n:`${t}.${n}`}function Kt(t){return!(Array.isArray(t)&&t.length===0)}function pe(t,n){const e=i=>i.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!1},runValidation:e})}function ye(t,n){const{asyncDebounceMs:e}=n,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:h}=n.validators||{},s=e??0,a=u=>u.validators.filter(Boolean).map(l=>{const d=(l==null?void 0:l.cause)||t;let o=s;switch(d){case"change":o=r??s;break;case"blur":o=i??s;break;case"dynamic":o=h??s;break;case"submit":o=0;break}return t==="submit"&&(o=0),{cause:d,validate:l.fn,debounceMs:o}});return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!0},runValidation:a})}const De=t=>!!t&&typeof t=="object"&&"fields"in t;function Y(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;if(t instanceof Date&&n instanceof Date)return t.getTime()===n.getTime();if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const[r,h]of t)if(!n.has(r)||!Object.is(h,n.get(r)))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const r of t)if(!n.has(r))return!1;return!0}const e=Object.keys(t),i=Object.keys(n);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(n)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(n)!==Object.prototype))return!1;for(const r of e)if(!i.includes(r)||!Y(t[r],n[r]))return!1;return!0}const Ze=({newFormValidatorError:t,isPreviousErrorFromFormValidator:n,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},Pe=({formLevelError:t,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,n){return t==null?n:{...t,...n}}let se=256;const Be=[];let Le;for(;se--;)Be[se]=(se+256).toString(16).substring(1);function vt(){let t=0,n,e="";if(!Le||se+16>256){for(Le=new Array(256),t=256;t--;)Le[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)n=Le[se+t],t===6?e+=Be[n&15|64]:t===8?e+=Be[n&63|128]:e+=Be[n],t&1&&t>1&&t<11&&(e+="-");return se++,e}const zt=Ot(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function Se(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e[i]=Se(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,r)=>{e.set(r,Se(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(Se(i))}),e}const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Se(t[e]));return n}function ne(t,n){return n===t||n.startsWith(`${t}.`)||n.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const n=t.event.async,e=n?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:n?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},r={fn:n?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:n?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=n?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[e],form:t.form});case"submit":return t.runValidation({validators:[i,r,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[r,s],form:t.form});case"change":return t.runValidation({validators:[i,s],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function qt(t,n){const e=new Map;for(const i of t){const r=i.path??[];let h=n,s="";for(let a=0;a<r.length;a++){const u=r[a];if(u===void 0)continue;const l=typeof u=="object"?u.key:u,d=Number(l);Array.isArray(h)&&!Number.isNaN(d)?s+=`[${d}]`:s+=(a>0?".":"")+String(l),typeof h=="object"&&h!==null?h=h[l]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const lt=(t,n)=>{const e=qt(t,n);return{form:e,fields:e}},ae={validate({value:t,validationSource:n},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return n==="field"?i.issues:lt(i.issues,t)},async validateAsync({value:t,validationSource:n},e){const i=await e["~standard"].validate(t);if(i.issues)return n==="field"?i.issues:lt(i.issues,t)}},Je=t=>!!t&&"~standard"in t,O={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Q(t){function n(o){const f=t.getFieldMeta(o)??O;t.setFieldMeta(o,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(o,f,m){n(o);const c=a(o,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(o,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(o,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);l(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(o,m))).forEach(F=>{const M=F.replace(s(o,m),s(o,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(o,f){n(o);const m=a(o,f,"remove");l(m,"up")}function r(o,f,m){n(o),a(o,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(o,f)))return;const v=g.toString().replace(s(o,f),s(o,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(o,f){n(o);const m=a(o,f,"insert");l(m,"down"),m.forEach(c=>{c.toString().startsWith(s(o,f))&&t.setFieldMeta(c,d())})}function s(o,f){return`${o}[${f}]`}function a(o,f,m,c){const g=[s(o,f)];switch(m){case"swap":g.push(s(o,c));break;case"move":{const[v,S]=[Math.min(f,c),Math.max(f,c)];for(let F=v;F<=S;F++)g.push(s(o,F));break}default:{const v=t.getFieldValue(o),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(o,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function u(o,f){return o.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function l(o,f){(f==="up"?o:[...o].reverse()).forEach(c=>{const g=u(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,d())})}const d=()=>O;return{bumpArrayVersion:n,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:h}}function We(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},formGroupStateBase:t.formGroupStateBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ut{constructor(n){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{zt(this)}),a=K.on("request-form-state",c=>{c.payload.id===this._formId&&K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),u=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),l=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),d=()=>{l(),u(),a(),s.unsubscribe(),K.emit("form-unmounted",{id:this._formId})};(m=(f=this.options.listeners)==null?void 0:f.onMount)==null||m.call(f,{formApi:this});const{onMount:o}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),d},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const u=s.defaultValues&&!Y(s.defaultValues,a.defaultValues)&&!this.state.isTouched,l=!Y(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!u&&!l)){if(_(()=>{this.baseStore.setState(()=>We(Object.assign({},this.state,l?s.defaultState:{},u?{values:s.defaultValues}:{})))}),u){const d=Q(this);for(const o of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(o))&&d.bumpArrayVersion(o)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:u}=this.state,l=this.resetFieldMeta(u);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var o;let d=s??this.options.defaultValues??((o=this.options.defaultState)==null?void 0:o.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(d=be(d,f.instance.name,f.instance.options.defaultValue))}),We({...this.options.defaultState,values:d,fieldMetaBase:l})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(l=>{if(!l.instance)return;const d=l.instance;a.push(Promise.resolve().then(()=>d.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),l.instance.store.state.meta.isTouched||l.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null,o=[`${s}[${a}]`];for(let g=a+1;g<=(d??0);g++)o.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>o.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,u)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var l,d;const u=(l=this.fieldInfo[s])==null?void 0:l.instance;if(!u){const{hasErrored:o}=this.validateSync(a);return o&&!this.options.asyncAlways?((d=this.getFieldMeta(s))==null?void 0:d.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return u.store.state.meta.isTouched||u.setMeta(o=>({...o,isTouched:!0})),u.validate(a)},this.validateSync=(s,a)=>{const u=pe(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let l=!1;const d={};return _(()=>{var m,c,g;for(const v of u){if(!v.validate)continue;const S=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:F,fieldErrors:M}=ke(S),V=Fe(v.cause);let w=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(M||{})]);a!=null&&a.filterFieldNames&&(w=new Set([...w].filter(a.filterFieldNames)));for(const b of w){if(this.baseStore.state.fieldMetaBase[b]===void 0&&!(M!=null&&M[b]))continue;const L=this.getFieldMeta(b)??O,{errorMap:E,errorSourceMap:A}=L,D=M==null?void 0:M[b],{newErrorValue:j,newSource:T}=Ze({newFormValidatorError:D,isPreviousErrorFromFormValidator:(A==null?void 0:A[V])==="form",previousErrorValue:E==null?void 0:E[V]});T==="form"&&(d[b]={...d[b],[V]:D}),(E==null?void 0:E[V])!==j&&this.setFieldMeta(b,(I=O)=>({...I,errorMap:{...I.errorMap,[V]:j},errorSourceMap:{...I.errorSourceMap,[V]:T}}))}a!=null&&a.dontUpdateFormErrorMap||((m=this.state.errorMap)==null?void 0:m[V])!==F&&this.baseStore.setState(b=>({...b,errorMap:{...b.errorMap,[V]:F}})),(F||M)&&(l=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const o=Fe("submit");(c=this.state.errorMap)!=null&&c[o]&&s!=="submit"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}));const f=Fe("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:l,fieldsErrorMap:d}},this.validateAsync=async(s,a)=>{const u=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});this.state.isFormValidating||this.baseStore.setState(m=>({...m,isFormValidating:!0}));const l=[];let d;for(const m of u){if(!m.validate)continue;const c=Fe(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},l.push(new Promise(async S=>{let F;try{F=await new Promise((E,A)=>{setTimeout(async()=>{if(v.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:m.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(D){A(D)}},m.debounceMs)})}catch(E){F=E}const{formError:M,fieldErrors:V}=ke(F);V&&(d=d?{...d,...V}:V);const w=Fe(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(d||{})]);let L=Array.from(b);a!=null&&a.filterFieldNames&&(L=L.filter(a.filterFieldNames));for(const E of L){if(this.baseStore.state.fieldMetaBase[E]===void 0&&!(d!=null&&d[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=d==null?void 0:d[E],{newErrorValue:I,newSource:P}=Ze({newFormValidatorError:T,isPreviousErrorFromFormValidator:(j==null?void 0:j[w])==="form",previousErrorValue:D==null?void 0:D[w]});(D==null?void 0:D[w])!==I&&this.setFieldMeta(E,(R=O)=>({...R,errorMap:{...R.errorMap,[w]:I},errorSourceMap:{...R.errorSourceMap,[w]:P}}))}a!=null&&a.dontUpdateFormErrorMap||this.baseStore.setState(E=>({...E,errorMap:{...E.errorMap,[w]:M}})),S(d?{fieldErrors:d,errorMapKey:w}:void 0)}))}let o=[];const f={};if(l.length){o=await Promise.all(l);for(const m of o)if(m!=null&&m.fieldErrors){const{errorMapKey:c}=m;for(const[g,v]of Object.entries(m.fieldErrors)){const F={...f[g]||{},[c]:v};f[g]=F}}}return this.baseStore.setState(m=>({...m,isFormValidating:!1})),f},this.validate=(s,a)=>{const{hasErrored:u,fieldsErrorMap:l}=this.validateSync(s,a);return u&&!this.options.asyncAlways?l:this.validateAsync(s,a)},this._handleSubmit=async s=>{var l,d,o,f,m,c,g,v,S,F;this.baseStore.setState(M=>({...M,isSubmitted:!1,submissionAttempts:M.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.fieldInfo).forEach(M=>{M.instance&&(M.instance.store.state.meta.isTouched||M.instance.setMeta(V=>({...V,isTouched:!0})))})});const a=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){(d=(l=this.options).onSubmitInvalid)==null||d.call(l,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const u=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){u(),(f=(o=this.options).onSubmitInvalid)==null||f.call(o,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(M=>M.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){u(),(c=(m=this.options).onSubmitInvalid)==null||c.call(m,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}_(()=>{Object.values(this.fieldInfo).forEach(M=>{var V;(V=M.instance)==null||V.triggerOnSubmitListener()})}),(v=(g=this.options.listeners)==null?void 0:g.onSubmit)==null||v.call(g,{formApi:this,meta:a});try{await((F=(S=this.options).onSubmit)==null?void 0:F.call(S,{value:this.state.values,formApi:this,meta:a})),_(()=>{this.baseStore.setState(M=>({...M,isSubmitted:!0,isSubmitSuccessful:!0})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),u()})}catch(M){throw this.baseStore.setState(V=>({...V,isSubmitSuccessful:!1})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:M}),u(),M}},this.getFieldValue=s=>oe(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFormGroupMeta=s=>this.formGroupMetaDerived.state[s],this.getFieldInfo=s=>{var a;return(a=this.fieldInfo)[s]||(a[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,a)=>{this.baseStore.setState(u=>({...u,fieldMetaBase:{...u.fieldMetaBase,[s]:ge(a,u.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,u)=>{const l=u;return a[l]=O,a},{}),this.setFieldValue=(s,a,u)=>{var f;const l=(u==null?void 0:u.dontUpdateMeta)??!1,d=(u==null?void 0:u.dontRunListeners)??!1,o=(u==null?void 0:u.dontValidate)??!1;_(()=>{l||this.setFieldMeta(s,m=>({...m,isTouched:!0,isDirty:!0,errorMap:{...m==null?void 0:m.errorMap,onMount:void 0}})),this.baseStore.setState(m=>({...m,values:be(m.values,s,a)}))}),d||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const u=[...Object.keys(this.fieldInfo).filter(l=>{const d=s.toString();return l.startsWith(`${d}.`)||l.startsWith(`${d}[`)}),s];this.baseStore.setState(l=>{const d={...l};return u.forEach(o=>{d.values=Wt(d.values,o),delete this.fieldInfo[o],delete d.fieldMetaBase[o]}),d})},this.pushFieldValue=(s,a,u)=>{this.setFieldValue(s,l=>[...Array.isArray(l)?l:[],a],u),Q(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>[...o.slice(0,a),u,...o.slice(a)],$(l,{dontValidate:!0}));const d=(l==null?void 0:l.dontValidate)??!1;d||await this.validateField(s,"change"),Q(this).handleArrayInsert(s,a),d||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>o.map((f,m)=>m===a?u:f),$(l,{dontValidate:!0})),Q(this).bumpArrayVersion(s),((l==null?void 0:l.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(u,{dontValidate:!0})),Q(this).handleArrayRemove(s,a),d!==null){const f=`${s}[${d}]`;this.deleteField(f)}((u==null?void 0:u.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=o[a],m=o[u];return be(be(o,`${a}`,m),`${u}`,f)},$(l,{dontValidate:!0})),Q(this).handleArraySwap(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.moveFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=[...o];return f.splice(u,0,f.splice(a,1)[0]),f},$(l,{dontValidate:!0})),Q(this).handleArrayMove(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.clearFieldValues=(s,a)=>{const u=this.getFieldValue(s),l=Array.isArray(u)?Math.max(u.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Q(this).bumpArrayVersion(s),l!==null)for(let o=0;o<=l;o++){const f=`${s}[${o}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var o;const u=(o=this.getFieldInfo(s).instance)==null?void 0:o.options.defaultValue,l=oe(this.options.defaultValues,s),d=u??l;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:d!==void 0?be(a.values,s,d):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,u])=>{const l=a;if(De(u)){const{formError:d,fieldErrors:o}=ke(u);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[l]:o==null?void 0:o[f]},errorSourceMap:{...c.errorSourceMap,[l]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[l]:d}}))}else this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[l]:u}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,u])=>(Object.keys(u).length&&u.errors.length&&(s[a]={errors:u.errors,errorMap:u.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(n==null?void 0:n.formId)??vt(),this._devtoolsSubmissionOverride=!1;let e=We({...n==null?void 0:n.defaultState,values:(n==null?void 0:n.defaultValues)??((h=n==null?void 0:n.defaultState)==null?void 0:h.values)});if(n!=null&&n.transform){e=n.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!De(a)))for(const u of Object.keys(a.fields)){const l=a.fields[u];if(l===void 0)continue;const d=e.fieldMetaBase[u];e.fieldMetaBase[u]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...d??{},errorSourceMap:{...(d==null?void 0:d.errorSourceMap)??{},onChange:"form"},errorMap:{...(d==null?void 0:d.errorMap)??{},[s]:l}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var d,o,f;const a=this.baseStore.get();let u=0;const l={};for(const m of Object.keys(a.fieldMetaBase)){const c=a.fieldMetaBase[m],g=i==null?void 0:i.fieldMetaBase[m],v=s==null?void 0:s[m],S=oe(a.values,m);let F=v==null?void 0:v.errors;if(!g||c.errorMap!==g.errorMap){F=Object.values(c.errorMap??{}).filter(L=>L!==void 0);const b=(d=this.getFieldInfo(m))==null?void 0:d.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!Kt(F),V=!c.isDirty,w=Y(S,((f=(o=this.getFieldInfo(m))==null?void 0:o.instance)==null?void 0:f.options.defaultValue)??oe(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){l[m]=v,u++;continue}l[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&u===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),l):l}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l={};for(const d of this.formGroupApis){const o=d.name,f=a.formGroupStateBase[o]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=u[o];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in u){if(W===o||!ne(o,W))continue;const k=u[W];k&&(k.isValidating&&(c=!0),k.isValid||(g=!1),k.isTouched&&(v=!0),k.isBlurred&&(S=!0),k.isDefaultValue||(F=!1),k.isDirty&&(M=!0))}const V=!M,w=!!c||f.isValidating,b=(m==null?void 0:m.errorMap)??{},L=(m==null?void 0:m.errorSourceMap)??{},E=!!(b.onMount||Object.entries(u).some(([W,k])=>k&&W!==o&&ne(o,W)&&k.errorMap.onMount)),A=s==null?void 0:s[o];let D=(A==null?void 0:A.errors)??[];(!A||A.__srcErrorMap!==b)&&(D=Object.values(b).reduce((W,k)=>{if(k===void 0)return W;if(k&&typeof k=="object"&&"fields"in k){const Qe=k.group;return Qe!==void 0&&W.push(Qe),W}return W.push(k),W},[]));const j=D.length===0,T=g&&j,I=d.options.canSubmitWhenInvalid??!1,P=f.submissionAttempts===0&&!v&&!E||!w&&!f.isSubmitting&&T||I;if(A&&A.errorMap===b&&A.errorSourceMap===L&&A.errors===D&&A.isFieldsValidating===c&&A.isFieldsValid===g&&A.isGroupValid===j&&A.isValid===T&&A.canSubmit===P&&A.isTouched===v&&A.isBlurred===S&&A.isPristine===V&&A.isDefaultValue===F&&A.isDirty===M&&A.isValidating===w&&A.isSubmitting===f.isSubmitting&&A.isSubmitted===f.isSubmitted&&A.submissionAttempts===f.submissionAttempts&&A.isSubmitSuccessful===f.isSubmitSuccessful){l[o]=A;continue}const R={...f,errorMap:b,errorSourceMap:L,_arrayVersion:(m==null?void 0:m._arrayVersion)??0,isTouched:v,isBlurred:S,isDirty:M,isPristine:V,isDefaultValue:F,isValid:T,errors:D,isValidating:w,isFieldsValidating:c,isFieldsValid:g,isGroupValid:j,canSubmit:P};Object.defineProperty(R,"__srcErrorMap",{value:b,enumerable:!1,configurable:!0}),l[o]=R}return l});let r;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l=Object.values(u).filter(Boolean),d=l.some(I=>I.isValidating),o=l.every(I=>I.isValid),f=l.some(I=>I.isTouched),m=l.some(I=>I.isBlurred),c=l.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=l.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||l.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!d;let V=(s==null?void 0:s.errors)??[];(!r||a.errorMap!==r.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&De(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=o&&w,L=this.options.canSubmitWhenInvalid??!1,E=a.submissionAttempts===0&&!f&&!F||!M&&!a.isSubmitting&&b||L;let A=a.errorMap;if(g&&(V=V.filter(I=>I!==a.errorMap.onMount),A=Object.assign(A,{onMount:void 0})),s&&r&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===d&&s.isFieldsValid===o&&s.isFormValid===w&&s.isValid===b&&s.canSubmit===E&&s.isTouched===f&&s.isBlurred===m&&s.isPristine===S&&s.isDefaultValue===c&&s.isDirty===v&&Y(r,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:d,isFieldsValid:o,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return r=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function ke(t){if(t){if(De(t)){const n=ke(t.form).formError,e=t.fields;return{formError:n,fieldErrors:e}}return{formError:t}}return{formError:void 0}}function Fe(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Ve{constructor(n){this.options={},this.mount=()=>{var r,h;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const e=this.getInfo();e.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const s=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(a=>({...a,errorMap:{...a==null?void 0:a.errorMap,onMount:s},errorSourceMap:{...a==null?void 0:a.errorSourceMap,onMount:"field"}}))}return(h=(r=this.options.listeners)==null?void 0:r.onMount)==null||h.call(r,{value:this.state.value,fieldApi:this}),()=>{var a,u,l,d;for(const[o,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var f,m,c;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...O,isTouched:((f=o.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=o.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=o.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(u=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||u.call(a,{value:this.state.value,fieldApi:this}),(d=(l=this.form.options.listeners)==null?void 0:l.onFieldUnmount)==null||d.call(l,{formApi:this.form,fieldApi:this})}}},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Y(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,i)=>{this.form.pushFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,i,r)=>{this.form.insertFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,r)=>{this.form.replaceFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,i)=>{this.form.removeFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,i,r)=>{this.form.swapFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,r)=>{this.form.moveFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,$(e,{dontRunListeners:!0})),e!=null&&e.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{const i=Object.values(this.form.fieldInfo),r=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ve))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&r.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&r.push(h.instance)}return r},this.validateSync=(e,i)=>{var l;const r=pe(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((d,o)=>{const f=pe(e,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||q});return f.forEach(m=>{m.field=o}),d.concat(f)},[]);let a=!1;_(()=>{const d=(o,f)=>{var F;const m=Me(f.cause),c=f.validate?dt(o.runValidator({validate:f.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=Pe({formLevelError:g,fieldLevelError:c});((F=o.state.meta.errorMap)==null?void 0:F[m])!==v&&o.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const o of r)d(this,o);for(const o of s)o.validate&&d(o.field,o)});const u=Me("submit");return(l=this.state.meta.errorMap)!=null&&l[u]&&e!=="submit"&&!a&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[u]:void 0},errorSourceMap:{...d.errorSourceMap,[u]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const r=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),h=await i,a=this.getLinkedFields(e).reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,fieldName:g.name,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),u=[],l=[],d=r.some(c=>c.validate),o=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{d&&this.startValidation();for(const c of o)c.startValidation()});const f=(c,g,v)=>{const S=Me(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V},v.push(new Promise(async w=>{var j;let b;try{b=await new Promise((T,I)=>{c.timeoutIds.validations[g.cause]&&(clearTimeout(c.timeoutIds.validations[g.cause]),c.endValidation()),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return T(void 0);try{T(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,fieldApi:c,signal:V.signal,validationSource:"field"},type:"validateAsync"}))}catch(P){I(P)}},g.debounceMs)})}catch(T){b=T}if(V.signal.aborted)return w(void 0);const L=dt(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=Pe({formLevelError:E,fieldLevelError:L});if(c.getInfo().instance!==c)return w(void 0);c.setMeta(T=>({...T,errorMap:{...T==null?void 0:T.errorMap,[S]:A},errorSourceMap:{...T.errorSourceMap,[S]:D}})),w(A)}))};for(const c of r)c.validate&&f(this,c,u);for(const c of a)c.validate&&f(c.field,c,l);let m=[];return(u.length||l.length)&&(m=await Promise.all(u),await Promise.all(l)),_(()=>{d&&this.endValidation();for(const c of o)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const r=i!=null&&i.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(c=>this.name.startsWith(c.name));let s=(i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!(i!=null&&i.skipFormValidation))for(const c of r){if(c.state.meta.submissionAttempts===0)continue;const{fieldsErrorMap:g}=this.form.validateSync(e,{group:c,dontUpdateFormErrorMap:!0,filterFieldNames:v=>ne(c.name,v)});s={...s,...g[this.name]??{}}}const{hasErrored:a}=this.validateSync(e,s),u=new WeakMap;for(const c of r){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});u.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Me(e)])==null||f.lastAbortController.abort();const c=[];for(const g of r)(m=g.getInfo().validationMetaMap[Me(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const l=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),d=this.validateAsync(e,l),o=[];for(const c of r)u.get(c)&&!c.options.asyncAlways||o.push(c.validateAsync(e,l,{skipRelatedFieldValidation:!0}));return o.length===0?d:Promise.all([d,...o]).then(c=>c.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(i=>({...i,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(i=>({...i,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(i=>({...i,errorMap:{...i.errorMap,...e}}))},this.parseValueWithSchema=e=>ae.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>ae.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnBlurListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onBlur)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChange)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this});for(const d of this.form.formGroupApis)ne(d.name,this.name)&&d.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,fieldApi:this})},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...n.defaultMeta};let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}})}get state(){return this.store.state}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}startValidation(){this.setMeta(n=>{const e=n._pendingValidationsCount+1;return{...n,_pendingValidationsCount:e,isValidating:e>0&&!n.isValidating?!0:n.isValidating}})}endValidation(){this.setMeta(n=>{const e=Math.max(0,n._pendingValidationsCount-1);return{...n,_pendingValidationsCount:e,isValidating:e===0&&n.isValidating?!1:n.isValidating}})}}function dt(t){if(t)return t}function Me(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function Ue(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Ht(t){return{...O,...t,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}class Ae{constructor(n){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const r=i.formGroupStateBase[this.name]??Ue({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(r)}}})},this._lastDistributedFieldNames={},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Y(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...O,...this.options.defaultMeta})},this.mount=()=>{var i,r;this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(h=>({...h,formGroupStateBase:{...h.formGroupStateBase,[this.name]:h.formGroupStateBase[this.name]??Ue({...this.options.defaultState})}}));const{onMount:e}=this.options.validators||{};if(e){const h=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:"form"},type:"validate"});let s=h,a;ze(h)&&(s=h.group,a=h.fields);const u=Ke(s);u&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,onMount:u},errorSourceMap:{...l.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(r=(i=this.options.listeners)==null?void 0:i.onMount)==null||r.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,u]of Object.entries(this.timeoutIds.validations))u&&(clearTimeout(u),this.timeoutIds.validations[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.listeners))u&&(clearTimeout(u),this.timeoutIds.listeners[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.formListeners))u&&(clearTimeout(u),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,u]of Object.entries(this.fieldInfo.validationMetaMap))u==null||u.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ue({})}})),this.fieldInfo.instance=null,(s=(h=this.options.listeners)==null?void 0:h.onUnmount)==null||s.call(h,{value:this.state.value,groupApi:this})}}},this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{const e=Object.values(this.form.fieldInfo),i=[];for(const r of e)r.instance&&r.instance instanceof Ve&&r.instance.name.startsWith(this.name)&&i.push(r.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[r,h]of e)r!==this.name&&ne(this.name,r)&&i.push({...h,name:r});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const r=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[u,l]of Object.entries(i))l==null||l===!1||h.add(this.buildChildFieldName(u));const s=new Set([...r,...h]);let a=!1;for(const u of s){const l=u.startsWith(this.name+"[")?u.slice(this.name.length):u.slice(this.name.length+1),d=i==null?void 0:i[l],o=this.form.getFieldMeta(u);if(!o&&!d)continue;const f=o==null?void 0:o.errorMap[e],m=(o==null?void 0:o.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Ze({newFormValidatorError:d,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(o==null?void 0:o.errorSourceMap[e])===g)&&this.form.setFieldMeta(u,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,r={})=>{var d;const h=pe(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((o,f)=>{const m=pe(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),o.concat(m)},[]);let u=!1;_(()=>{const o=(f,m)=>{var L;const c=Te(m.cause),g=f===this;let v;m.validate&&(v=f.runValidator({validate:m.validate,value:{value:f.store.state.value,validationSource:g?"form":"field",...f instanceof Ae?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&ze(v)&&(S=v.group,F=v.fields);const M=Ke(S),V=i[c],{newErrorValue:w,newSource:b}=Pe({formLevelError:V,fieldLevelError:M});((L=f.state.meta.errorMap)==null?void 0:L[c])!==w&&f.setMeta(E=>({...E,errorMap:{...E.errorMap,[c]:w},errorSourceMap:{...E.errorSourceMap,[c]:b}})),w&&(u=!0),g&&this.distributeFieldErrors(c,F)&&(u=!0)};for(const f of h)o(this,f);for(const f of a)f.validate&&o(f.field,f)});const l=Te("submit");return(d=this.state.meta.errorMap)!=null&&d[l]&&e!=="submit"&&!u&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,[l]:void 0},errorSourceMap:{...o.errorSourceMap,[l]:void 0}})),{hasErrored:u}},this.validateAsync=async(e,i,r={})=>{const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),u=a.reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),l=[],d=[],o=h.some(c=>c.validate)||u.some(c=>c.validate);if(o){this.state.meta.isValidating||this.setMeta(c=>({...c,isValidating:!0}));for(const c of a)c.setMeta(g=>({...g,isValidating:!0}))}const f=(c,g,v)=>{const S=Te(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V};const w=c===this;v.push(new Promise(async b=>{var P;let L;try{L=await new Promise((R,W)=>{c.timeoutIds.validations[g.cause]&&clearTimeout(c.timeoutIds.validations[g.cause]),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return R(void 0);try{R(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,signal:V.signal,validationSource:w?"form":"field",...c instanceof Ae?{groupApi:c}:{fieldApi:c}},type:"validateAsync"}))}catch(k){W(k)}},g.debounceMs)})}catch(R){L=R}if(V.signal.aborted)return b(void 0);let E=L,A;w&&ze(L)&&(E=L.group,A=L.fields);const D=Ke(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=Pe({formLevelError:j,fieldLevelError:D});if(c.getInfo().instance!==c)return b(void 0);c.setMeta(R=>({...R,errorMap:{...R==null?void 0:R.errorMap,[S]:T},errorSourceMap:{...R.errorSourceMap,[S]:I}})),w&&this.distributeFieldErrors(S,A),b(T)}))};for(const c of h)c.validate&&f(this,c,l);for(const c of u)c.validate&&f(c.field,c,d);let m=[];if((l.length||d.length)&&(m=await Promise.all(l),await Promise.all(d)),o){this.setMeta(c=>({...c,isValidating:!1}));for(const c of a)c.setMeta(g=>({...g,isValidating:!1}))}return m.filter(Boolean)},this.validateAllFields=async e=>{const i=[];return _(()=>{Object.values(this.getRelatedFields()).forEach(h=>{i.push(Promise.resolve().then(()=>h.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),h.store.state.meta.isTouched||h.setMeta(s=>({...s,isTouched:!0}))})}),(await Promise.all(i)).flat()},this.validateArrayFieldsStartingFrom=(e,i,r)=>this.form.validateArrayFieldsStartingFrom(e,i,r),this.validateField=(e,i)=>this.form.validateField(e,i),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(e,i),this.setFieldValue=(e,i)=>this.form.setFieldValue(e,i),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,i)=>this.form.pushFieldValue(e,i),this.insertFieldValue=(e,i,r)=>this.form.insertFieldValue(e,i,r),this.replaceFieldValue=(e,i,r)=>this.form.replaceFieldValue(e,i,r),this.swapFieldValues=(e,i,r)=>this.form.swapFieldValues(e,i,r),this.moveFieldValues=(e,i,r)=>this.form.moveFieldValues(e,i,r),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,i)=>this.form.removeFieldValue(e,i),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,i)=>{var a;const{fieldsErrorMap:r}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)}),{hasErrored:h}=this.validateSync(e,r[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[Te(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChangeGroup)==null||o.call(d,{formApi:this.form,groupApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChangeGroup)==null||s.call(h,{formApi:this.form,groupApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,groupApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{var h,s,a,u,l,d,o,f;this.setFormGroupState(m=>({...m,isSubmitted:!1,submissionAttempts:m.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{m.state.meta.isTouched||m.setMeta(c=>({...c,isTouched:!0}))})});const i=e??this.options.onSubmitMeta;this.setFormGroupState(m=>({...m,isSubmitting:!0}));const r=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){r(),(s=(h=this.options).onGroupSubmitInvalid)==null||s.call(h,{value:this.state.value,groupApi:this,meta:i});return}if(await this.validate("submit",{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){r(),(u=(a=this.options).onGroupSubmitInvalid)==null||u.call(a,{value:this.state.value,groupApi:this,meta:i});return}_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{var c,g;(g=(c=m.options.listeners)==null?void 0:c.onGroupSubmit)==null||g.call(c,{value:m.state.value,fieldApi:m})})}),(d=(l=this.options.listeners)==null?void 0:l.onSubmit)==null||d.call(l,{groupApi:this,value:this.state.value});try{await((f=(o=this.options).onGroupSubmit)==null?void 0:f.call(o,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),r(),m}},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=ie(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();const i=this.form.getFormGroupMeta(this.name)??Ht(n.defaultMeta);let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Y(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(n){if(Je(n.validate)){const e=ae[n.type](n.value,n.validate);return n.type==="validate"?ct(e):e.then(ct)}return n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Ke(t){if(t)return t}function ze(t){return!!t&&typeof t=="object"&&"fields"in t}function ct(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:n,fields:e,...i}=t;return{...i,group:n,fields:e}}function Te(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class _e{constructor(n){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return ot(this.fieldsMap,e);const i=Oe(e)[0];if(typeof i!="string")return"";const r=e.slice(i.length),h=this.fieldsMap[i];return ot(h,r)},this.getFormFieldOptions=e=>{const i={...e},r=i.validators;if(i.name=this.getFormFieldName(e.name),r&&(r.onChangeListenTo||r.onBlurListenTo)){const h={...r},s=a=>{if(a)return a.map(u=>this.getFormFieldName(u))};h.onChangeListenTo=s(r.onChangeListenTo),h.onBlurListenTo=s(r.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,r),this.validateField=(e,i)=>this.form.validateField(this.getFormFieldName(e),i),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(this.getFormFieldName(e),i),this.setFieldValue=(e,i,r)=>this.form.setFieldValue(this.getFormFieldName(e),i,r),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,r)=>this.form.pushFieldValue(this.getFormFieldName(e),i,r),this.insertFieldValue=async(e,i,r,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,r,h),this.replaceFieldValue=async(e,i,r,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,r,h),this.removeFieldValue=async(e,i,r)=>this.form.removeFieldValue(this.getFormFieldName(e),i,r),this.swapFieldValues=(e,i,r,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,r,h),this.moveFieldValues=(e,i,r,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,r,h),this.clearFieldValues=(e,i)=>this.form.clearFieldValues(this.getFormFieldName(e),i),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),n.form instanceof _e){const e=n.form;if(this.form=e.form,typeof n.fields=="string")this.fieldsMap=e.getFormFieldName(n.fields);else{const i={...n.fields};for(const r in i)i[r]=e.getFormFieldName(i[r]);this.fieldsMap=i}}else this.form=n.form,this.fieldsMap=n.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=oe(e.values,this.fieldsMap);else{i={};const r=this.fieldsMap;for(const h in r)i[h]=oe(e.values,r[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}function Xt(t,n){if(!n)return;const e=Object.assign({},t,{state:Se(t.state)});n(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((h,s)=>(t.state[s]!==e.state[s]&&(h[s]=e.state[s]),h),{});return _(()=>{Object.keys(r).length&&t.baseStore.setState(h=>({...h,...r})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Zt(t,n){return t===n}function x(t,n=i=>i,e){const i=(e==null?void 0:e.compare)??Zt,r=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return St.useSyncExternalStoreWithSelector(r,h,h,n,i)}const J=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Yt(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ve({...t}));let h=i;(n.form!==t.form||n.name!==t.name)&&(h=new Ve({...t}),r(h),e({form:t.form,name:t.name}));const s=x(h.store,t.mode==="array"?c=>c.meta._arrayVersion||0:c=>c.value),a=x(h.store,c=>c.meta.isTouched),u=x(h.store,c=>c.meta.isBlurred),l=x(h.store,c=>c.meta.isDirty),d=x(h.store,c=>c.meta.errorMap),o=x(h.store,c=>c.meta.errorSourceMap),f=x(h.store,c=>c.meta.isValidating),m=C.useMemo(()=>({...h,get state(){return{value:t.mode==="array"?h.state.value:s,get meta(){return{...h.state.meta,isTouched:a,isBlurred:u,isDirty:l,errorMap:d,errorSourceMap:o,isValidating:f}}}}}),[h,t.mode,s,a,u,l,d,o,f]);return J(h.mount,[h]),J(()=>{h.update(t)}),m}const Jt=(({children:t,...n})=>{const e=Yt(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function Qt(){return C.useState(()=>vt())[0]}const ei=pt,ti=C.version.split(".")[0]==="17"?Qt:ei.useId;function ii(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ae({...t}));(n.form!==t.form||n.name!==t.name)&&(r(new Ae({...t})),e({form:t.form,name:t.name}));const h=x(i.store,b=>b.value),s=x(i.store,b=>b.meta.isTouched),a=x(i.store,b=>b.meta.isBlurred),u=x(i.store,b=>b.meta.isDirty),l=x(i.store,b=>b.meta.errorMap),d=x(i.store,b=>b.meta.errorSourceMap),o=x(i.store,b=>b.meta.isValidating),f=x(i.store,b=>b.meta.isSubmitting),m=x(i.store,b=>b.meta.isSubmitted),c=x(i.store,b=>b.meta.submissionAttempts),g=x(i.store,b=>b.meta.isSubmitSuccessful),v=x(i.store,b=>b.meta.canSubmit),S=x(i.store,b=>b.meta.isValid),F=x(i.store,b=>b.meta.isFieldsValid),M=x(i.store,b=>b.meta.isFieldsValidating),V=x(i.store,b=>b.meta.isGroupValid),w=C.useMemo(()=>({...i,handleSubmit:((...E)=>i._handleSubmit(...E)),get state(){return{...i.state,value:h,get meta(){return{...i.state.meta,isTouched:s,isBlurred:a,isDirty:u,errorMap:l,errorSourceMap:d,isValidating:o,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,u,l,d,o,f,m,c,g,v,S,F,M,V]);return J(i.mount,[i]),J(()=>{i.update(t)}),w}const si=(({children:t,...n})=>{const e=ii(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ri({form:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function ni(t){const n=ti(),[e,i]=C.useState(t==null?void 0:t.formId),[r,h]=C.useState(()=>new ut({...t,formId:(t==null?void 0:t.formId)??n}));if(e!==(t==null?void 0:t.formId)){const u=(t==null?void 0:t.formId)??n;h(new ut({...t,formId:u})),i(u)}const s=C.useMemo(()=>{const u={...r,handleSubmit:((...l)=>r._handleSubmit(...l)),get formId(){return r._formId},get state(){return r.store.state}};return u.Field=function(d){return p.jsx(Jt,{...d,form:r})},u.FormGroup=function(d){return p.jsx(si,{...d,form:r})},u.Subscribe=function(d){return p.jsx(ri,{form:r,selector:d.selector,children:d.children})},u},[r]);J(r.mount,[]),J(()=>{r.update(t)});const a=C.useRef(!1);return J(()=>{a.current&&t!=null&&t.transform&&Xt(r,t.transform)},[r,t==null?void 0:t.transform]),J(()=>{a.current=!0}),s}function ai({lens:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function oi(t){const[n]=C.useState(()=>{const e=new _e(t),i=t.form instanceof _e?t.form.form:t.form,r=e;return r.AppForm=function(s){return p.jsx(i.AppForm,{...s})},r.AppField=function(s){return p.jsx(i.AppField,{...n.getFormFieldOptions(s)})},r.Field=function(s){return p.jsx(i.Field,{...n.getFormFieldOptions(s)})},r.Subscribe=function(s){return p.jsx(ai,{lens:n,selector:s.selector,children:s.children})},Object.assign(r,{...t.formComponents})});return J(n.mount,[n]),n}const ht=C.createContext(null),bt=C.createContext(null);function Ft(){const t=C.useContext(bt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function li(){function t(){const n=C.useContext(ht);if(!n)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return n}return{fieldContext:ht,useFieldContext:t,useFormContext:Ft,formContext:bt}}function Mt({fieldComponents:t,fieldContext:n,formContext:e,formComponents:i}){function r(l){const d=ni(l),o=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:d,children:c}),[d]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(d.Field,{...v,children:S=>p.jsx(n.Provider,{value:S,children:g(Object.assign(S,t))})})),[d]);return C.useMemo(()=>Object.assign(d,{AppField:f,AppForm:o,...i}),[d,f,o])}function h({render:l,props:d}){return function(f){return l({...d,...f})}}function s({render:l,props:d,defaultValues:o}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:o,formComponents:i}),[m.form,m.fields]),g=oi(c);return l({...d,...m,group:g})}}function a(l){return Ft()}function u(l){return Mt({fieldContext:n,formContext:e,fieldComponents:{...t,...l.fieldComponents},formComponents:{...i,...l.formComponents}})}return{useAppForm:r,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:u}}const{fieldContext:ui,formContext:di,useFieldContext:ve,useFormContext:ci}=li();function hi({label:t,placeholder:n,type:e="text",description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(yt,{id:r.name,type:e,value:r.state.value,placeholder:n,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function fi({label:t,placeholder:n,description:e,rows:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(Vt,{id:r.name,value:r.state.value,placeholder:n,rows:i,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:a})]})}function mi({label:t,options:n,placeholder:e,description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsxs(At,{value:r.state.value,onValueChange:u=>r.handleChange(u),onOpenChange:u=>{u||r.handleBlur()},children:[p.jsx(Et,{id:r.name,children:p.jsx(wt,{placeholder:e})}),p.jsx(It,{children:n.map(u=>p.jsx(Ct,{value:u.value,children:u.label},u.value))})]}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function gi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(he,{htmlFor:e.name,children:t}),p.jsx(Lt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s)}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function vi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(Tt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s===!0)}),p.jsx(he,{htmlFor:e.name,children:t}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function bi({label:t,placeholder:n,description:e}){const i=ve(),{isTouched:r,errors:h}=i.state.meta,s=r?h.map(a=>({message:String(a)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:i.name,children:t}),p.jsx(xt,{id:i.name,value:i.state.value,placeholder:n,onBlur:i.handleBlur,onChange:a=>i.handleChange(a.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:s})]})}function Fi({label:t,pendingLabel:n="Saving…"}){const e=ci();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:r})=>p.jsx(Dt,{type:"submit",disabled:!i||r,children:r?n:t})})}const{useAppForm:pi}=Mt({fieldContext:ui,formContext:di,fieldComponents:{TextField:hi,TextareaField:fi,SelectField:mi,SwitchField:gi,CheckboxField:vi,PasswordField:bi},formComponents:{SubmitButton:Fi}});export{x as a,pi as u};
1
+ var et=t=>{throw TypeError(t)};var tt=(t,n,e)=>n.has(t)||et("Cannot "+e);var y=(t,n,e)=>(tt(t,n,"read from private field"),e?e.call(t):n.get(t)),N=(t,n,e)=>n.has(t)?et("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(t):n.set(t,e),k=(t,n,e,i)=>(tt(t,n,"write to private field"),i?i.call(t,e):n.set(t,e),e);var it=(t,n,e,i)=>({set _(r){k(t,n,r,e)},get _(){return y(t,n,i)}});import{r as C,lr as St,j as p,ls as pt,dr as ce,ds as he,I as yt,h0 as fe,h_ as me,h$ as Vt,eh as At,ei as Et,ej as wt,ek as It,el as Ct,$ as Lt,gQ as Tt,ep as xt,B as Dt}from"./index-B6Scr7KJ.js";function kt({update:t,notify:n,unwatched:e}){return{link:i,unlink:r,propagate:h,checkDirty:s,shallowPropagate:a};function i(l,d,o){const f=d.depsTail;if(f!==void 0&&f.dep===l)return;const m=f!==void 0?f.nextDep:d.deps;if(m!==void 0&&m.dep===l){m.version=o,d.depsTail=m;return}const c=l.subsTail;if(c!==void 0&&c.version===o&&c.sub===d)return;const g=d.depsTail=l.subsTail={version:o,dep:l,sub:d,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:d.deps=g,c!==void 0?c.nextSub=g:l.subs=g}function r(l,d=l.sub){const o=l.dep,f=l.prevDep,m=l.nextDep,c=l.nextSub,g=l.prevSub;return m!==void 0?m.prevDep=f:d.depsTail=f,f!==void 0?f.nextDep=m:d.deps=m,c!==void 0?c.prevSub=g:o.subsTail=g,g!==void 0?g.nextSub=c:(o.subs=c)===void 0&&e(o),m}function h(l){let d=l.nextSub,o;e:do{const f=l.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&u(l,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&n(f),m&1){const c=f.subs;if(c!==void 0){const g=(l=c).nextSub;g!==void 0&&(o={value:d,prev:o},d=g);continue}}if((l=d)!==void 0){d=l.nextSub;continue}for(;o!==void 0;)if(l=o.value,o=o.prev,l!==void 0){d=l.nextSub;continue e}break}while(!0)}function s(l,d){let o,f=0,m=!1;e:do{const c=l.dep,g=c.flags;if(d.flags&16)m=!0;else if((g&17)===17){if(t(c)){const v=c.subs;v.nextSub!==void 0&&a(v),m=!0}}else if((g&33)===33){(l.nextSub!==void 0||l.prevSub!==void 0)&&(o={value:l,prev:o}),l=c.deps,d=c,++f;continue}if(!m){const v=l.nextDep;if(v!==void 0){l=v;continue}}for(;f--;){const v=d.subs,S=v.nextSub!==void 0;if(S?(l=o.value,o=o.prev):l=v,m){if(t(d)){S&&a(v),d=l.sub;continue}m=!1}else d.flags&=-33;d=l.sub;const F=l.nextDep;if(F!==void 0){l=F;continue e}}return m}while(!0)}function a(l){do{const d=l.sub,o=d.flags;(o&48)===32&&(d.flags=o|16,(o&6)===2&&n(d))}while((l=l.nextSub)!==void 0)}function u(l,d){let o=d.depsTail;for(;o!==void 0;){if(o===l)return!0;o=o.prevDep}return!1}}function Ze(t,n,e){var h,s,a;const i=typeof t=="object",r=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(r),error:(s=i?t.error:n)==null?void 0:s.bind(r),complete:(a=i?t.complete:e)==null?void 0:a.bind(r)}}const qe=[];let xe=0;const{link:st,unlink:Bt,propagate:jt,checkDirty:ft,shallowPropagate:rt}=kt({update(t){return t._update()},notify(t){qe[He++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,je(t))}});let Ce=0,He=0,z,Xe=0;function _(t){try{++Xe,t()}finally{--Xe||mt()}}function je(t){const n=t.depsTail;let e=n!==void 0?n.nextDep:t.deps;for(;e!==void 0;)e=Bt(e,t)}function mt(){if(!(Xe>0)){for(;Ce<He;){const t=qe[Ce];qe[Ce++]=void 0,t.notify()}Ce=0,He=0}}function gt(t,n){const e=typeof t=="function",i=t,r={_snapshot:e?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:e?0:1,get(){return z!==void 0&&st(r,z,xe),r._snapshot},subscribe(h){const s=Ze(h),a={current:!1},u=Pt(()=>{var l;r.get(),a.current?(l=s.next)==null||l.call(s,r._snapshot):a.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=r,++xe,r.depsTail=void 0;else if(h===void 0)return!1;e&&(r.flags=5);try{const u=r._snapshot,l=typeof h=="function"?h(u):h===void 0&&e?i(u):h;return u===void 0||!a(u,l)?(r._snapshot=l,!0):!1}finally{z=s,e&&(r.flags&=-5),je(r)}}};return e?(r.flags=17,r.get=function(){const h=r.flags;if(h&16||h&32&&ft(r.deps,r)){if(r._update()){const s=r.subs;s!==void 0&&rt(s)}}else h&32&&(r.flags=h&-33);return z!==void 0&&st(r,z,xe),r._snapshot}):r.set=function(h){if(r._update(h)){const s=r.subs;s!==void 0&&(jt(s),rt(s),mt())}},r}function Pt(t){const n=()=>{const i=z;z=e,++xe,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,je(e)}},e={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){const i=this.flags;i&16||i&32&&ft(this.deps,this)?n():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,je(this)}};return n(),e}var _t=class{constructor(t,n){this.atom=gt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ze(t))}},Rt=class{constructor(t){this.atom=gt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Ze(t))}};function ie(t,n){return typeof t=="function"?new Rt(t):new _t(t)}var Nt=class{constructor(t,n){this.fn=t,this.options=n,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{const i=Date.now()-this.lastExecutionTime;if(this.options.leading&&i>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){const r=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},r)}},this.execute=(...e)=>{var i,r;this.fn(...e),(r=(i=this.options).onExecute)==null||r.call(i,e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Ot(t,n){return new Nt(t,n).maybeExecute}var ee,U,G,Ee,H,re,X,le,we,Re,te,ue,Q,Ie,de,Ne;class Gt{constructor({pluginId:n,debug:e=!1,enabled:i=!0,reconnectEveryMs:r=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,Ee);N(this,H);N(this,re);N(this,X);N(this,le);N(this,we,0);N(this,Re,5);N(this,te,!1);N(this,ue,!1);N(this,Q,null);N(this,Ie,()=>{this.debugLog("Connected to event bus"),k(this,re,!0),k(this,te,!1),this.debugLog("Emitting queued events",y(this,H)),y(this,H).forEach(n=>this.emitEventToBus(n)),k(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ie))});N(this,de,()=>{if(y(this,we)<y(this,Re)){it(this,we)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,de)),k(this,ue,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Ne,()=>{y(this,te)||(k(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ie)),y(this,de).call(this))});k(this,U,n),k(this,ee,i),k(this,G,this.getGlobalTarget),k(this,Ee,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),k(this,H,[]),k(this,re,!1),k(this,ue,!1),k(this,X,null),k(this,le,r)}startConnectLoop(){y(this,X)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,le)}ms)`),k(this,X,setInterval(y(this,de),y(this,le))))}stopConnectLoop(){k(this,te,!1),y(this,X)!==null&&(clearInterval(y(this,X)),k(this,X,null),k(this,H,[]),this.debugLog("Stopped connect loop"))}debugLog(...n){y(this,Ee)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...n)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const n=typeof EventTarget<"u"?new EventTarget:void 0;return typeof n>"u"||typeof n.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),n)}getPluginId(){return y(this,U)}dispatchCustomEventShim(n,e){try{const i=new Event(n,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(n,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(n,{detail:e}))}catch{this.dispatchCustomEventShim(n,e)}}emitEventToBus(n){this.debugLog("Emitting event to client bus",n),this.dispatchCustomEvent("tanstack-dispatch-event",n)}createEventPayload(n,e){return{type:`${y(this,U)}:${n}`,payload:e,pluginId:y(this,U)}}emit(n,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",n,e);return}if(y(this,Q)&&(this.debugLog("Emitting event to internal event target",n,e),y(this,Q).dispatchEvent(new CustomEvent(`${y(this,U)}:${n}`,{detail:this.createEventPayload(n,e)}))),y(this,ue)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!y(this,re)){this.debugLog("Bus not available, will be pushed as soon as connected"),y(this,H).push(this.createEventPayload(n,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Ne).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(n,e))}on(n,e,i){const r=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${n}`;if(r&&(y(this,Q)||k(this,Q,new EventTarget),y(this,Q).addEventListener(h,a=>{e(a.detail)})),!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event",h),()=>{};const s=a=>{this.debugLog("Received event from bus",a.detail),e(a.detail)};return y(this,G).call(this).addEventListener(h,s),this.debugLog("Registered event to bus",h),()=>{var a;r&&((a=y(this,Q))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(n){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const r=i.detail;y(this,U)&&r.pluginId!==y(this,U)||n(r)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}}ee=new WeakMap,U=new WeakMap,G=new WeakMap,Ee=new WeakMap,H=new WeakMap,re=new WeakMap,X=new WeakMap,le=new WeakMap,we=new WeakMap,Re=new WeakMap,te=new WeakMap,ue=new WeakMap,Q=new WeakMap,Ie=new WeakMap,de=new WeakMap,Ne=new WeakMap;class $t extends Gt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new $t;function ge(t,n){return typeof t=="function"?t(n):t}function oe(t,n){return Oe(n).reduce((i,r)=>{if(i===null)return null;if(typeof i<"u")return i[r]},t)}function be(t,n,e){const i=Oe(n);function r(h){if(!i.length)return ge(e,h);const s=i.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(h))return typeof h=="object"?(h===null&&(h={}),{...h,[s]:r(h[s])}):{[s]:r()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),r(h[s]),...h.slice(s+1)]}return[...new Array(s),r()]}return r(t)}function Wt(t,n){const e=Oe(n);function i(r){if(!r)return;if(e.length===1){const s=e[0];if(Array.isArray(r)&&typeof s=="number")return r.filter((l,d)=>d!==s);const{[s]:a,...u}=r;return u}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(r))&&typeof r=="object")return{...r,[h]:i(r[h])};if(typeof h=="number"&&Array.isArray(r)){if(h>=r.length)return r;const s=r.slice(0,h);return[...s.length?s:new Array(h),i(r[h]),...r.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const nt=46,Ge=91,$e=93,at=48,Ut=57;function Oe(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const n=t.length,e=[];let i=n>0&&t.charCodeAt(0)===Ge?1:0,r=!0,h=-1;for(let s=i;s<=n;s++){const a=s<n?t.charCodeAt(s):-1;if(s===n||a===nt||a===Ge||a===$e){const u=s-i;if(u>0){const l=r&&(u===1||t.charCodeAt(i)!==at),d=t.slice(i,s);if(l){const o=parseInt(d,10);u<=15||String(o)===d?e.push(o):e.push(d)}else e.push(d)}else h!==$e&&!(h===-1&&a===$e)&&!(h===a&&(a===nt||a===Ge))&&e.push("");i=s+1,r=!0}else(a<at||a>Ut)&&(r=!1);h=a}return e.length||e.push(""),e}function ot(t,n){return t.length===0?n:n.length===0?t:n.startsWith("[")||n.startsWith(".")?t+n:`${t}.${n}`}function Kt(t){return!(Array.isArray(t)&&t.length===0)}function pe(t,n){const e=i=>i.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!1},runValidation:e})}function ye(t,n){const{asyncDebounceMs:e}=n,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:h}=n.validators||{},s=e??0,a=u=>u.validators.filter(Boolean).map(l=>{const d=(l==null?void 0:l.cause)||t;let o=s;switch(d){case"change":o=r??s;break;case"blur":o=i??s;break;case"dynamic":o=h??s;break;case"submit":o=0;break}return t==="submit"&&(o=0),{cause:d,validate:l.fn,debounceMs:o}});return n.validationLogic({form:n.form,group:n.group,validators:n.validators,event:{type:t,fieldName:n.fieldName,async:!0},runValidation:a})}const De=t=>!!t&&typeof t=="object"&&"fields"in t;function Z(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;if(t instanceof Date&&n instanceof Date)return t.getTime()===n.getTime();if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const[r,h]of t)if(!n.has(r)||!Object.is(h,n.get(r)))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const r of t)if(!n.has(r))return!1;return!0}const e=Object.keys(t),i=Object.keys(n);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(n)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(n)!==Object.prototype))return!1;for(const r of e)if(!i.includes(r)||!Z(t[r],n[r]))return!1;return!0}const Qe=({newFormValidatorError:t,isPreviousErrorFromFormValidator:n,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},Pe=({formLevelError:t,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,n){return t==null?n:{...t,...n}}let se=256;const ke=[];let Le;for(;se--;)ke[se]=(se+256).toString(16).substring(1);function vt(){let t=0,n,e="";if(!Le||se+16>256){for(Le=new Array(256),t=256;t--;)Le[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)n=Le[se+t],t===6?e+=ke[n&15|64]:t===8?e+=ke[n&63|128]:e+=ke[n],t&1&&t>1&&t<11&&(e+="-");return se++,e}const zt=Ot(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function Se(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++)e[i]=Se(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,r)=>{e.set(r,Se(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(Se(i))}),e}const n={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Se(t[e]));return n}function ne(t,n){return n===t||n.startsWith(`${t}.`)||n.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const n=t.event.async,e=n?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:n?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},r={fn:n?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:n?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=n?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[e],form:t.form});case"submit":return t.runValidation({validators:[i,r,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[r,s],form:t.form});case"change":return t.runValidation({validators:[i,s],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function qt(t,n){const e=new Map;for(const i of t){const r=i.path??[];let h=n,s="";for(let a=0;a<r.length;a++){const u=r[a];if(u===void 0)continue;const l=typeof u=="object"?u.key:u,d=Number(l);Array.isArray(h)&&!Number.isNaN(d)?s+=`[${d}]`:s+=(a>0?".":"")+String(l),typeof h=="object"&&h!==null?h=h[l]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const lt=(t,n)=>{const e=qt(t,n);return{form:e,fields:e}},ae={validate({value:t,validationSource:n},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return n==="field"?i.issues:lt(i.issues,t)},async validateAsync({value:t,validationSource:n},e){const i=await e["~standard"].validate(t);if(i.issues)return n==="field"?i.issues:lt(i.issues,t)}},Je=t=>!!t&&"~standard"in t,O={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function Y(t){function n(o){const f=t.getFieldMeta(o)??O;t.setFieldMeta(o,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(o,f,m){n(o);const c=a(o,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(o,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(o,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);l(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(o,m))).forEach(F=>{const M=F.replace(s(o,m),s(o,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(o,f){n(o);const m=a(o,f,"remove");l(m,"up")}function r(o,f,m){n(o),a(o,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(o,f)))return;const v=g.toString().replace(s(o,f),s(o,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(o,f){n(o);const m=a(o,f,"insert");l(m,"down"),m.forEach(c=>{c.toString().startsWith(s(o,f))&&t.setFieldMeta(c,d())})}function s(o,f){return`${o}[${f}]`}function a(o,f,m,c){const g=[s(o,f)];switch(m){case"swap":g.push(s(o,c));break;case"move":{const[v,S]=[Math.min(f,c),Math.max(f,c)];for(let F=v;F<=S;F++)g.push(s(o,F));break}default:{const v=t.getFieldValue(o),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(o,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function u(o,f){return o.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function l(o,f){(f==="up"?o:[...o].reverse()).forEach(c=>{const g=u(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,d())})}const d=()=>O;return{bumpArrayVersion:n,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:h}}function We(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},formGroupStateBase:t.formGroupStateBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ut{constructor(n){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{zt(this)}),a=K.on("request-form-state",c=>{c.payload.id===this._formId&&K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),u=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),l=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),d=()=>{l(),u(),a(),s.unsubscribe(),K.emit("form-unmounted",{id:this._formId})};(m=(f=this.options.listeners)==null?void 0:f.onMount)==null||m.call(f,{formApi:this});const{onMount:o}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),d},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const u=s.defaultValues&&!Z(s.defaultValues,a.defaultValues)&&!this.state.isTouched,l=!Z(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!u&&!l)){if(_(()=>{this.baseStore.setState(()=>We(Object.assign({},this.state,l?s.defaultState:{},u?{values:s.defaultValues}:{})))}),u){const d=Y(this);for(const o of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(o))&&d.bumpArrayVersion(o)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:u}=this.state,l=this.resetFieldMeta(u);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var o;let d=s??this.options.defaultValues??((o=this.options.defaultState)==null?void 0:o.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(d=be(d,f.instance.name,f.instance.options.defaultValue))}),We({...this.options.defaultState,values:d,fieldMetaBase:l})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(l=>{if(!l.instance)return;const d=l.instance;a.push(Promise.resolve().then(()=>d.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),l.instance.store.state.meta.isTouched||l.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null,o=[`${s}[${a}]`];for(let g=a+1;g<=(d??0);g++)o.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>o.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,u)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var l,d;const u=(l=this.fieldInfo[s])==null?void 0:l.instance;if(!u){const{hasErrored:o}=this.validateSync(a);return o&&!this.options.asyncAlways?((d=this.getFieldMeta(s))==null?void 0:d.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return u.store.state.meta.isTouched||u.setMeta(o=>({...o,isTouched:!0})),u.validate(a)},this.validateSync=(s,a)=>{const u=pe(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let l=!1;const d={};return _(()=>{var m,c,g;for(const v of u){if(!v.validate)continue;const S=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:F,fieldErrors:M}=Be(S),V=Fe(v.cause);let w=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(M||{})]);a!=null&&a.filterFieldNames&&(w=new Set([...w].filter(a.filterFieldNames)));for(const b of w){if(this.baseStore.state.fieldMetaBase[b]===void 0&&!(M!=null&&M[b]))continue;const L=this.getFieldMeta(b)??O,{errorMap:E,errorSourceMap:A}=L,D=M==null?void 0:M[b],{newErrorValue:j,newSource:T}=Qe({newFormValidatorError:D,isPreviousErrorFromFormValidator:(A==null?void 0:A[V])==="form",previousErrorValue:E==null?void 0:E[V]});T==="form"&&(d[b]={...d[b],[V]:D}),(E==null?void 0:E[V])!==j&&this.setFieldMeta(b,(I=O)=>({...I,errorMap:{...I.errorMap,[V]:j},errorSourceMap:{...I.errorSourceMap,[V]:T}}))}a!=null&&a.dontUpdateFormErrorMap||((m=this.state.errorMap)==null?void 0:m[V])!==F&&this.baseStore.setState(b=>({...b,errorMap:{...b.errorMap,[V]:F}})),(F||M)&&(l=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const o=Fe("submit");(c=this.state.errorMap)!=null&&c[o]&&s!=="submit"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}));const f=Fe("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!l&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:l,fieldsErrorMap:d}},this.validateAsync=async(s,a)=>{const u=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});this.state.isFormValidating||this.baseStore.setState(m=>({...m,isFormValidating:!0}));const l=[];let d;for(const m of u){if(!m.validate)continue;const c=Fe(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},l.push(new Promise(async S=>{let F;try{F=await new Promise((E,A)=>{setTimeout(async()=>{if(v.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:m.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(D){A(D)}},m.debounceMs)})}catch(E){F=E}const{formError:M,fieldErrors:V}=Be(F);V&&(d=d?{...d,...V}:V);const w=Fe(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(d||{})]);let L=Array.from(b);a!=null&&a.filterFieldNames&&(L=L.filter(a.filterFieldNames));for(const E of L){if(this.baseStore.state.fieldMetaBase[E]===void 0&&!(d!=null&&d[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=d==null?void 0:d[E],{newErrorValue:I,newSource:P}=Qe({newFormValidatorError:T,isPreviousErrorFromFormValidator:(j==null?void 0:j[w])==="form",previousErrorValue:D==null?void 0:D[w]});(D==null?void 0:D[w])!==I&&this.setFieldMeta(E,(R=O)=>({...R,errorMap:{...R.errorMap,[w]:I},errorSourceMap:{...R.errorSourceMap,[w]:P}}))}a!=null&&a.dontUpdateFormErrorMap||this.baseStore.setState(E=>({...E,errorMap:{...E.errorMap,[w]:M}})),S(d?{fieldErrors:d,errorMapKey:w}:void 0)}))}let o=[];const f={};if(l.length){o=await Promise.all(l);for(const m of o)if(m!=null&&m.fieldErrors){const{errorMapKey:c}=m;for(const[g,v]of Object.entries(m.fieldErrors)){const F={...f[g]||{},[c]:v};f[g]=F}}}return this.baseStore.setState(m=>({...m,isFormValidating:!1})),f},this.validate=(s,a)=>{const{hasErrored:u,fieldsErrorMap:l}=this.validateSync(s,a);return u&&!this.options.asyncAlways?l:this.validateAsync(s,a)},this._handleSubmit=async s=>{var l,d,o,f,m,c,g,v,S,F;this.baseStore.setState(M=>({...M,isSubmitted:!1,submissionAttempts:M.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.fieldInfo).forEach(M=>{M.instance&&(M.instance.store.state.meta.isTouched||M.instance.setMeta(V=>({...V,isTouched:!0})))})});const a=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){(d=(l=this.options).onSubmitInvalid)==null||d.call(l,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const u=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){u(),(f=(o=this.options).onSubmitInvalid)==null||f.call(o,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(M=>M.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){u(),(c=(m=this.options).onSubmitInvalid)==null||c.call(m,{value:this.state.values,formApi:this,meta:a}),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}_(()=>{Object.values(this.fieldInfo).forEach(M=>{var V;(V=M.instance)==null||V.triggerOnSubmitListener()})}),(v=(g=this.options.listeners)==null?void 0:g.onSubmit)==null||v.call(g,{formApi:this,meta:a});try{await((F=(S=this.options).onSubmit)==null?void 0:F.call(S,{value:this.state.values,formApi:this,meta:a})),_(()=>{this.baseStore.setState(M=>({...M,isSubmitted:!0,isSubmitSuccessful:!0})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),u()})}catch(M){throw this.baseStore.setState(V=>({...V,isSubmitSuccessful:!1})),K.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:M}),u(),M}},this.getFieldValue=s=>oe(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFormGroupMeta=s=>this.formGroupMetaDerived.state[s],this.getFieldInfo=s=>{var a;return(a=this.fieldInfo)[s]||(a[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,a)=>{this.baseStore.setState(u=>({...u,fieldMetaBase:{...u.fieldMetaBase,[s]:ge(a,u.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,u)=>{const l=u;return a[l]=O,a},{}),this.setFieldValue=(s,a,u)=>{var f;const l=(u==null?void 0:u.dontUpdateMeta)??!1,d=(u==null?void 0:u.dontRunListeners)??!1,o=(u==null?void 0:u.dontValidate)??!1;_(()=>{l||this.setFieldMeta(s,m=>({...m,isTouched:!0,isDirty:!0,errorMap:{...m==null?void 0:m.errorMap,onMount:void 0}})),this.baseStore.setState(m=>({...m,values:be(m.values,s,a)}))}),d||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const u=[...Object.keys(this.fieldInfo).filter(l=>{const d=s.toString();return l.startsWith(`${d}.`)||l.startsWith(`${d}[`)}),s];this.baseStore.setState(l=>{const d={...l};return u.forEach(o=>{d.values=Wt(d.values,o),delete this.fieldInfo[o],delete d.fieldMetaBase[o]}),d})},this.pushFieldValue=(s,a,u)=>{this.setFieldValue(s,l=>[...Array.isArray(l)?l:[],a],u),Y(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>[...o.slice(0,a),u,...o.slice(a)],$(l,{dontValidate:!0}));const d=(l==null?void 0:l.dontValidate)??!1;d||await this.validateField(s,"change"),Y(this).handleArrayInsert(s,a),d||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,u,l)=>{this.setFieldValue(s,o=>o.map((f,m)=>m===a?u:f),$(l,{dontValidate:!0})),Y(this).bumpArrayVersion(s),((l==null?void 0:l.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,u)=>{const l=this.getFieldValue(s),d=Array.isArray(l)?Math.max(l.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(u,{dontValidate:!0})),Y(this).handleArrayRemove(s,a),d!==null){const f=`${s}[${d}]`;this.deleteField(f)}((u==null?void 0:u.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=o[a],m=o[u];return be(be(o,`${a}`,m),`${u}`,f)},$(l,{dontValidate:!0})),Y(this).handleArraySwap(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.moveFieldValues=(s,a,u,l)=>{this.setFieldValue(s,o=>{const f=[...o];return f.splice(u,0,f.splice(a,1)[0]),f},$(l,{dontValidate:!0})),Y(this).handleArrayMove(s,a,u),((l==null?void 0:l.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${u}]`,"change"))},this.clearFieldValues=(s,a)=>{const u=this.getFieldValue(s),l=Array.isArray(u)?Math.max(u.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Y(this).bumpArrayVersion(s),l!==null)for(let o=0;o<=l;o++){const f=`${s}[${o}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var o;const u=(o=this.getFieldInfo(s).instance)==null?void 0:o.options.defaultValue,l=oe(this.options.defaultValues,s),d=u??l;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:d!==void 0?be(a.values,s,d):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,u])=>{const l=a;if(De(u)){const{formError:d,fieldErrors:o}=Be(u);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[l]:o==null?void 0:o[f]},errorSourceMap:{...c.errorSourceMap,[l]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[l]:d}}))}else this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[l]:u}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,u])=>(Object.keys(u).length&&u.errors.length&&(s[a]={errors:u.errors,errorMap:u.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(n==null?void 0:n.formId)??vt(),this._devtoolsSubmissionOverride=!1;let e=We({...n==null?void 0:n.defaultState,values:(n==null?void 0:n.defaultValues)??((h=n==null?void 0:n.defaultState)==null?void 0:h.values)});if(n!=null&&n.transform){e=n.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!De(a)))for(const u of Object.keys(a.fields)){const l=a.fields[u];if(l===void 0)continue;const d=e.fieldMetaBase[u];e.fieldMetaBase[u]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...d??{},errorSourceMap:{...(d==null?void 0:d.errorSourceMap)??{},onChange:"form"},errorMap:{...(d==null?void 0:d.errorMap)??{},[s]:l}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var d,o,f;const a=this.baseStore.get();let u=0;const l={};for(const m of Object.keys(a.fieldMetaBase)){const c=a.fieldMetaBase[m],g=i==null?void 0:i.fieldMetaBase[m],v=s==null?void 0:s[m],S=oe(a.values,m);let F=v==null?void 0:v.errors;if(!g||c.errorMap!==g.errorMap){F=Object.values(c.errorMap??{}).filter(L=>L!==void 0);const b=(d=this.getFieldInfo(m))==null?void 0:d.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!Kt(F),V=!c.isDirty,w=Z(S,((f=(o=this.getFieldInfo(m))==null?void 0:o.instance)==null?void 0:f.options.defaultValue)??oe(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){l[m]=v,u++;continue}l[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&u===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),l):l}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l={};for(const d of this.formGroupApis){const o=d.name,f=a.formGroupStateBase[o]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=u[o];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in u){if(W===o||!ne(o,W))continue;const B=u[W];B&&(B.isValidating&&(c=!0),B.isValid||(g=!1),B.isTouched&&(v=!0),B.isBlurred&&(S=!0),B.isDefaultValue||(F=!1),B.isDirty&&(M=!0))}const V=!M,w=!!c||f.isValidating,b=(m==null?void 0:m.errorMap)??{},L=(m==null?void 0:m.errorSourceMap)??{},E=!!(b.onMount||Object.entries(u).some(([W,B])=>B&&W!==o&&ne(o,W)&&B.errorMap.onMount)),A=s==null?void 0:s[o];let D=(A==null?void 0:A.errors)??[];(!A||A.__srcErrorMap!==b)&&(D=Object.values(b).reduce((W,B)=>{if(B===void 0)return W;if(B&&typeof B=="object"&&"fields"in B){const Ye=B.group;return Ye!==void 0&&W.push(Ye),W}return W.push(B),W},[]));const j=D.length===0,T=g&&j,I=d.options.canSubmitWhenInvalid??!1,P=f.submissionAttempts===0&&!v&&!E||!w&&!f.isSubmitting&&T||I;if(A&&A.errorMap===b&&A.errorSourceMap===L&&A.errors===D&&A.isFieldsValidating===c&&A.isFieldsValid===g&&A.isGroupValid===j&&A.isValid===T&&A.canSubmit===P&&A.isTouched===v&&A.isBlurred===S&&A.isPristine===V&&A.isDefaultValue===F&&A.isDirty===M&&A.isValidating===w&&A.isSubmitting===f.isSubmitting&&A.isSubmitted===f.isSubmitted&&A.submissionAttempts===f.submissionAttempts&&A.isSubmitSuccessful===f.isSubmitSuccessful){l[o]=A;continue}const R={...f,errorMap:b,errorSourceMap:L,_arrayVersion:(m==null?void 0:m._arrayVersion)??0,isTouched:v,isBlurred:S,isDirty:M,isPristine:V,isDefaultValue:F,isValid:T,errors:D,isValidating:w,isFieldsValidating:c,isFieldsValid:g,isGroupValid:j,canSubmit:P};Object.defineProperty(R,"__srcErrorMap",{value:b,enumerable:!1,configurable:!0}),l[o]=R}return l});let r;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),u=this.fieldMetaDerived.get(),l=Object.values(u).filter(Boolean),d=l.some(I=>I.isValidating),o=l.every(I=>I.isValid),f=l.some(I=>I.isTouched),m=l.some(I=>I.isBlurred),c=l.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=l.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||l.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!d;let V=(s==null?void 0:s.errors)??[];(!r||a.errorMap!==r.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&De(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=o&&w,L=this.options.canSubmitWhenInvalid??!1,E=a.submissionAttempts===0&&!f&&!F||!M&&!a.isSubmitting&&b||L;let A=a.errorMap;if(g&&(V=V.filter(I=>I!==a.errorMap.onMount),A=Object.assign(A,{onMount:void 0})),s&&r&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===d&&s.isFieldsValid===o&&s.isFormValid===w&&s.isValid===b&&s.canSubmit===E&&s.isTouched===f&&s.isBlurred===m&&s.isPristine===S&&s.isDefaultValue===c&&s.isDirty===v&&Z(r,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:d,isFieldsValid:o,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return r=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Be(t){if(t){if(De(t)){const n=Be(t.form).formError,e=t.fields;return{formError:n,fieldErrors:e}}return{formError:t}}return{formError:void 0}}function Fe(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Ve{constructor(n){this.options={},this.mount=()=>{var r,h;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const e=this.getInfo();e.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const s=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(a=>({...a,errorMap:{...a==null?void 0:a.errorMap,onMount:s},errorSourceMap:{...a==null?void 0:a.errorSourceMap,onMount:"field"}}))}return(h=(r=this.options.listeners)==null?void 0:r.onMount)==null||h.call(r,{value:this.state.value,fieldApi:this}),()=>{var a,u,l,d;for(const[o,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[o]=null);for(const[o,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var f,m,c;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...O,isTouched:((f=o.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=o.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=o.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(u=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||u.call(a,{value:this.state.value,fieldApi:this}),(d=(l=this.form.options.listeners)==null?void 0:l.onFieldUnmount)==null||d.call(l,{formApi:this.form,fieldApi:this})}}},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Z(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,i)=>{this.form.pushFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,i,r)=>{this.form.insertFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,r)=>{this.form.replaceFieldValue(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,i)=>{this.form.removeFieldValue(this.name,e,$(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,i,r)=>{this.form.swapFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,r)=>{this.form.moveFieldValues(this.name,e,i,$(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,$(e,{dontRunListeners:!0})),e!=null&&e.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{const i=Object.values(this.form.fieldInfo),r=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ve))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&r.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&r.push(h.instance)}return r},this.validateSync=(e,i)=>{var l;const r=pe(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((d,o)=>{const f=pe(e,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||q});return f.forEach(m=>{m.field=o}),d.concat(f)},[]);let a=!1;_(()=>{const d=(o,f)=>{var F;const m=Me(f.cause),c=f.validate?dt(o.runValidator({validate:f.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=Pe({formLevelError:g,fieldLevelError:c});((F=o.state.meta.errorMap)==null?void 0:F[m])!==v&&o.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const o of r)d(this,o);for(const o of s)o.validate&&d(o.field,o)});const u=Me("submit");return(l=this.state.meta.errorMap)!=null&&l[u]&&e!=="submit"&&!a&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[u]:void 0},errorSourceMap:{...d.errorSourceMap,[u]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const r=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),h=await i,a=this.getLinkedFields(e).reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,fieldName:g.name,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),u=[],l=[],d=r.some(c=>c.validate),o=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{d&&this.startValidation();for(const c of o)c.startValidation()});const f=(c,g,v)=>{const S=Me(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V},v.push(new Promise(async w=>{var j;let b;try{b=await new Promise((T,I)=>{c.timeoutIds.validations[g.cause]&&(clearTimeout(c.timeoutIds.validations[g.cause]),c.endValidation()),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return T(void 0);try{T(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,fieldApi:c,signal:V.signal,validationSource:"field"},type:"validateAsync"}))}catch(P){I(P)}},g.debounceMs)})}catch(T){b=T}if(V.signal.aborted)return w(void 0);const L=dt(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=Pe({formLevelError:E,fieldLevelError:L});if(c.getInfo().instance!==c)return w(void 0);c.setMeta(T=>({...T,errorMap:{...T==null?void 0:T.errorMap,[S]:A},errorSourceMap:{...T.errorSourceMap,[S]:D}})),w(A)}))};for(const c of r)c.validate&&f(this,c,u);for(const c of a)c.validate&&f(c.field,c,l);let m=[];return(u.length||l.length)&&(m=await Promise.all(u),await Promise.all(l)),_(()=>{d&&this.endValidation();for(const c of o)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const r=i!=null&&i.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(c=>this.name.startsWith(c.name));let s=(i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!(i!=null&&i.skipFormValidation))for(const c of r){if(c.state.meta.submissionAttempts===0)continue;const{fieldsErrorMap:g}=this.form.validateSync(e,{group:c,dontUpdateFormErrorMap:!0,filterFieldNames:v=>ne(c.name,v)});s={...s,...g[this.name]??{}}}const{hasErrored:a}=this.validateSync(e,s),u=new WeakMap;for(const c of r){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});u.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Me(e)])==null||f.lastAbortController.abort();const c=[];for(const g of r)(m=g.getInfo().validationMetaMap[Me(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const l=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),d=this.validateAsync(e,l),o=[];for(const c of r)u.get(c)&&!c.options.asyncAlways||o.push(c.validateAsync(e,l,{skipRelatedFieldValidation:!0}));return o.length===0?d:Promise.all([d,...o]).then(c=>c.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(i=>({...i,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(i=>({...i,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(i=>({...i,errorMap:{...i.errorMap,...e}}))},this.parseValueWithSchema=e=>ae.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>ae.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnBlurListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onBlur)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{formApi:this.form,fieldApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChange)==null||s.call(h,{formApi:this.form,fieldApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this});for(const d of this.form.formGroupApis)ne(d.name,this.name)&&d.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,fieldApi:this})},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...n.defaultMeta};let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Z(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}})}get state(){return this.store.state}runValidator(n){return Je(n.validate)?ae[n.type](n.value,n.validate):n.validate(n.value)}startValidation(){this.setMeta(n=>{const e=n._pendingValidationsCount+1;return{...n,_pendingValidationsCount:e,isValidating:e>0&&!n.isValidating?!0:n.isValidating}})}endValidation(){this.setMeta(n=>{const e=Math.max(0,n._pendingValidationsCount-1);return{...n,_pendingValidationsCount:e,isValidating:e===0&&n.isValidating?!1:n.isValidating}})}}function dt(t){if(t)return t}function Me(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function Ue(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Ht(t){return{...O,...t,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}class Ae{constructor(n){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const r=i.formGroupStateBase[this.name]??Ue({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(r)}}})},this._lastDistributedFieldNames={},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const i=this.form.getFieldValue(this.name);Z(i,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...O,...this.options.defaultMeta})},this.mount=()=>{var i,r;this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(h=>({...h,formGroupStateBase:{...h.formGroupStateBase,[this.name]:h.formGroupStateBase[this.name]??Ue({...this.options.defaultState})}}));const{onMount:e}=this.options.validators||{};if(e){const h=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:"form"},type:"validate"});let s=h,a;ze(h)&&(s=h.group,a=h.fields);const u=Ke(s);u&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,onMount:u},errorSourceMap:{...l.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(r=(i=this.options.listeners)==null?void 0:i.onMount)==null||r.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,u]of Object.entries(this.timeoutIds.validations))u&&(clearTimeout(u),this.timeoutIds.validations[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.listeners))u&&(clearTimeout(u),this.timeoutIds.listeners[a]=null);for(const[a,u]of Object.entries(this.timeoutIds.formListeners))u&&(clearTimeout(u),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,u]of Object.entries(this.fieldInfo.validationMetaMap))u==null||u.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ue({})}})),this.fieldInfo.instance=null,(s=(h=this.options.listeners)==null?void 0:h.onUnmount)==null||s.call(h,{value:this.state.value,groupApi:this})}}},this.setValue=(e,i)=>{this.form.setFieldValue(this.name,e,$(i,{dontRunListeners:!0,dontValidate:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener(),i!=null&&i.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{const e=Object.values(this.form.fieldInfo),i=[];for(const r of e)r.instance&&r.instance instanceof Ve&&r.instance.name.startsWith(this.name)&&i.push(r.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[r,h]of e)r!==this.name&&ne(this.name,r)&&i.push({...h,name:r});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const r=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[u,l]of Object.entries(i))l==null||l===!1||h.add(this.buildChildFieldName(u));const s=new Set([...r,...h]);let a=!1;for(const u of s){const l=u.startsWith(this.name+"[")?u.slice(this.name.length):u.slice(this.name.length+1),d=i==null?void 0:i[l],o=this.form.getFieldMeta(u);if(!o&&!d)continue;const f=o==null?void 0:o.errorMap[e],m=(o==null?void 0:o.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Qe({newFormValidatorError:d,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(o==null?void 0:o.errorSourceMap[e])===g)&&this.form.setFieldMeta(u,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,r={})=>{var d;const h=pe(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((o,f)=>{const m=pe(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),o.concat(m)},[]);let u=!1;_(()=>{const o=(f,m)=>{var L;const c=Te(m.cause),g=f===this;let v;m.validate&&(v=f.runValidator({validate:m.validate,value:{value:f.store.state.value,validationSource:g?"form":"field",...f instanceof Ae?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&ze(v)&&(S=v.group,F=v.fields);const M=Ke(S),V=i[c],{newErrorValue:w,newSource:b}=Pe({formLevelError:V,fieldLevelError:M});((L=f.state.meta.errorMap)==null?void 0:L[c])!==w&&f.setMeta(E=>({...E,errorMap:{...E.errorMap,[c]:w},errorSourceMap:{...E.errorSourceMap,[c]:b}})),w&&(u=!0),g&&this.distributeFieldErrors(c,F)&&(u=!0)};for(const f of h)o(this,f);for(const f of a)f.validate&&o(f.field,f)});const l=Te("submit");return(d=this.state.meta.errorMap)!=null&&d[l]&&e!=="submit"&&!u&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,[l]:void 0},errorSourceMap:{...o.errorSourceMap,[l]:void 0}})),{hasErrored:u}},this.validateAsync=async(e,i,r={})=>{const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),u=a.reduce((c,g)=>{const v=ye(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),l=[],d=[],o=h.some(c=>c.validate)||u.some(c=>c.validate);if(o){this.state.meta.isValidating||this.setMeta(c=>({...c,isValidating:!0}));for(const c of a)c.setMeta(g=>({...g,isValidating:!0}))}const f=(c,g,v)=>{const S=Te(g.cause),F=c.getInfo(),M=F.validationMetaMap[S];M==null||M.lastAbortController.abort();const V=new AbortController;F.validationMetaMap[S]={lastAbortController:V};const w=c===this;v.push(new Promise(async b=>{var P;let L;try{L=await new Promise((R,W)=>{c.timeoutIds.validations[g.cause]&&clearTimeout(c.timeoutIds.validations[g.cause]),c.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(V.signal.aborted)return R(void 0);try{R(await this.runValidator({validate:g.validate,value:{value:c.store.state.value,signal:V.signal,validationSource:w?"form":"field",...c instanceof Ae?{groupApi:c}:{fieldApi:c}},type:"validateAsync"}))}catch(B){W(B)}},g.debounceMs)})}catch(R){L=R}if(V.signal.aborted)return b(void 0);let E=L,A;w&&ze(L)&&(E=L.group,A=L.fields);const D=Ke(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=Pe({formLevelError:j,fieldLevelError:D});if(c.getInfo().instance!==c)return b(void 0);c.setMeta(R=>({...R,errorMap:{...R==null?void 0:R.errorMap,[S]:T},errorSourceMap:{...R.errorSourceMap,[S]:I}})),w&&this.distributeFieldErrors(S,A),b(T)}))};for(const c of h)c.validate&&f(this,c,l);for(const c of u)c.validate&&f(c.field,c,d);let m=[];if((l.length||d.length)&&(m=await Promise.all(l),await Promise.all(d)),o){this.setMeta(c=>({...c,isValidating:!1}));for(const c of a)c.setMeta(g=>({...g,isValidating:!1}))}return m.filter(Boolean)},this.validateAllFields=async e=>{const i=[];return _(()=>{Object.values(this.getRelatedFields()).forEach(h=>{i.push(Promise.resolve().then(()=>h.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),h.store.state.meta.isTouched||h.setMeta(s=>({...s,isTouched:!0}))})}),(await Promise.all(i)).flat()},this.validateArrayFieldsStartingFrom=(e,i,r)=>this.form.validateArrayFieldsStartingFrom(e,i,r),this.validateField=(e,i)=>this.form.validateField(e,i),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(e,i),this.setFieldValue=(e,i)=>this.form.setFieldValue(e,i),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,i)=>this.form.pushFieldValue(e,i),this.insertFieldValue=(e,i,r)=>this.form.insertFieldValue(e,i,r),this.replaceFieldValue=(e,i,r)=>this.form.replaceFieldValue(e,i,r),this.swapFieldValues=(e,i,r)=>this.form.swapFieldValues(e,i,r),this.moveFieldValues=(e,i,r)=>this.form.moveFieldValues(e,i,r),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,i)=>this.form.removeFieldValue(e,i),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,i)=>{var a;const{fieldsErrorMap:r}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)}),{hasErrored:h}=this.validateSync(e,r[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[Te(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:u=>ne(this.name,u)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var r,h,s,a,u,l;const e=(r=this.form.options.listeners)==null?void 0:r.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var d,o;(o=(d=this.form.options.listeners)==null?void 0:d.onChangeGroup)==null||o.call(d,{formApi:this.form,groupApi:this})},e)):(s=(h=this.form.options.listeners)==null?void 0:h.onChangeGroup)==null||s.call(h,{formApi:this.form,groupApi:this});const i=(a=this.options.listeners)==null?void 0:a.onChangeDebounceMs;i&&i>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var d,o;(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,groupApi:this})},i)):(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{var e,i;(i=(e=this.options.listeners)==null?void 0:e.onSubmit)==null||i.call(e,{value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{var h,s,a,u,l,d,o,f;this.setFormGroupState(m=>({...m,isSubmitted:!1,submissionAttempts:m.submissionAttempts+1,isSubmitSuccessful:!1})),_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{m.state.meta.isTouched||m.setMeta(c=>({...c,isTouched:!0}))})});const i=e??this.options.onSubmitMeta;this.setFormGroupState(m=>({...m,isSubmitting:!0}));const r=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){r(),(s=(h=this.options).onGroupSubmitInvalid)==null||s.call(h,{value:this.state.value,groupApi:this,meta:i});return}if(await this.validate("submit",{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){r(),(u=(a=this.options).onGroupSubmitInvalid)==null||u.call(a,{value:this.state.value,groupApi:this,meta:i});return}_(()=>{Object.values(this.getRelatedFields()).forEach(m=>{var c,g;(g=(c=m.options.listeners)==null?void 0:c.onGroupSubmit)==null||g.call(c,{value:m.state.value,fieldApi:m})})}),(d=(l=this.options.listeners)==null?void 0:l.onSubmit)==null||d.call(l,{groupApi:this,value:this.state.value});try{await((f=(o=this.options).onGroupSubmit)==null?void 0:f.call(o,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),r(),m}},this.form=n.form,this.name=n.name,this.options=n,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=ie(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();const i=this.form.getFormGroupMeta(this.name)??Ht(n.defaultMeta);let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Z(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===i?e:{value:r,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(n){if(Je(n.validate)){const e=ae[n.type](n.value,n.validate);return n.type==="validate"?ct(e):e.then(ct)}return n.validate(n.value)}handleSubmit(n){return this._handleSubmit(n)}}function Ke(t){if(t)return t}function ze(t){return!!t&&typeof t=="object"&&"fields"in t}function ct(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:n,fields:e,...i}=t;return{...i,group:n,fields:e}}function Te(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class _e{constructor(n){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return ot(this.fieldsMap,e);const i=Oe(e)[0];if(typeof i!="string")return"";const r=e.slice(i.length),h=this.fieldsMap[i];return ot(h,r)},this.getFormFieldOptions=e=>{const i={...e},r=i.validators;if(i.name=this.getFormFieldName(e.name),r&&(r.onChangeListenTo||r.onBlurListenTo)){const h={...r},s=a=>{if(a)return a.map(u=>this.getFormFieldName(u))};h.onChangeListenTo=s(r.onChangeListenTo),h.onBlurListenTo=s(r.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,r),this.validateField=(e,i)=>this.form.validateField(this.getFormFieldName(e),i),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,i)=>this.form.setFieldMeta(this.getFormFieldName(e),i),this.setFieldValue=(e,i,r)=>this.form.setFieldValue(this.getFormFieldName(e),i,r),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,r)=>this.form.pushFieldValue(this.getFormFieldName(e),i,r),this.insertFieldValue=async(e,i,r,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,r,h),this.replaceFieldValue=async(e,i,r,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,r,h),this.removeFieldValue=async(e,i,r)=>this.form.removeFieldValue(this.getFormFieldName(e),i,r),this.swapFieldValues=(e,i,r,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,r,h),this.moveFieldValues=(e,i,r,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,r,h),this.clearFieldValues=(e,i)=>this.form.clearFieldValues(this.getFormFieldName(e),i),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),n.form instanceof _e){const e=n.form;if(this.form=e.form,typeof n.fields=="string")this.fieldsMap=e.getFormFieldName(n.fields);else{const i={...n.fields};for(const r in i)i[r]=e.getFormFieldName(i[r]);this.fieldsMap=i}}else this.form=n.form,this.fieldsMap=n.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=oe(e.values,this.fieldsMap);else{i={};const r=this.fieldsMap;for(const h in r)i[h]=oe(e.values,r[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}function Xt(t,n){if(!n)return;const e=Object.assign({},t,{state:Se(t.state)});n(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((h,s)=>(t.state[s]!==e.state[s]&&(h[s]=e.state[s]),h),{});return _(()=>{Object.keys(r).length&&t.baseStore.setState(h=>({...h,...r})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Qt(t,n){return t===n}function x(t,n=i=>i,e){const i=(e==null?void 0:e.compare)??Qt,r=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return St.useSyncExternalStoreWithSelector(r,h,h,n,i)}const J=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Zt(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ve({...t}));let h=i;(n.form!==t.form||n.name!==t.name)&&(h=new Ve({...t}),r(h),e({form:t.form,name:t.name}));const s=x(h.store,t.mode==="array"?c=>c.meta._arrayVersion||0:c=>c.value),a=x(h.store,c=>c.meta.isTouched),u=x(h.store,c=>c.meta.isBlurred),l=x(h.store,c=>c.meta.isDirty),d=x(h.store,c=>c.meta.errorMap),o=x(h.store,c=>c.meta.errorSourceMap),f=x(h.store,c=>c.meta.isValidating),m=C.useMemo(()=>({...h,get state(){return{value:t.mode==="array"?h.state.value:s,get meta(){return{...h.state.meta,isTouched:a,isBlurred:u,isDirty:l,errorMap:d,errorSourceMap:o,isValidating:f}}}}}),[h,t.mode,s,a,u,l,d,o,f]);return J(h.mount,[h]),J(()=>{h.update(t)}),m}const Jt=(({children:t,...n})=>{const e=Zt(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function Yt(){return C.useState(()=>vt())[0]}const ei=pt,ti=C.version.split(".")[0]==="17"?Yt:ei.useId;function ii(t){const[n,e]=C.useState(()=>({form:t.form,name:t.name})),[i,r]=C.useState(()=>new Ae({...t}));(n.form!==t.form||n.name!==t.name)&&(r(new Ae({...t})),e({form:t.form,name:t.name}));const h=x(i.store,b=>b.value),s=x(i.store,b=>b.meta.isTouched),a=x(i.store,b=>b.meta.isBlurred),u=x(i.store,b=>b.meta.isDirty),l=x(i.store,b=>b.meta.errorMap),d=x(i.store,b=>b.meta.errorSourceMap),o=x(i.store,b=>b.meta.isValidating),f=x(i.store,b=>b.meta.isSubmitting),m=x(i.store,b=>b.meta.isSubmitted),c=x(i.store,b=>b.meta.submissionAttempts),g=x(i.store,b=>b.meta.isSubmitSuccessful),v=x(i.store,b=>b.meta.canSubmit),S=x(i.store,b=>b.meta.isValid),F=x(i.store,b=>b.meta.isFieldsValid),M=x(i.store,b=>b.meta.isFieldsValidating),V=x(i.store,b=>b.meta.isGroupValid),w=C.useMemo(()=>({...i,handleSubmit:((...E)=>i._handleSubmit(...E)),get state(){return{...i.state,value:h,get meta(){return{...i.state.meta,isTouched:s,isBlurred:a,isDirty:u,errorMap:l,errorSourceMap:d,isValidating:o,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,u,l,d,o,f,m,c,g,v,S,F,M,V]);return J(i.mount,[i]),J(()=>{i.update(t)}),w}const si=(({children:t,...n})=>{const e=ii(n),i=C.useMemo(()=>ge(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ri({form:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function ni(t){const n=ti(),[e,i]=C.useState(t==null?void 0:t.formId),[r,h]=C.useState(()=>new ut({...t,formId:(t==null?void 0:t.formId)??n}));if(e!==(t==null?void 0:t.formId)){const u=(t==null?void 0:t.formId)??n;h(new ut({...t,formId:u})),i(u)}const s=C.useMemo(()=>{const u={...r,handleSubmit:((...l)=>r._handleSubmit(...l)),get formId(){return r._formId},get state(){return r.store.state}};return u.Field=function(d){return p.jsx(Jt,{...d,form:r})},u.FormGroup=function(d){return p.jsx(si,{...d,form:r})},u.Subscribe=function(d){return p.jsx(ri,{form:r,selector:d.selector,children:d.children})},u},[r]);J(r.mount,[]),J(()=>{r.update(t)});const a=C.useRef(!1);return J(()=>{a.current&&t!=null&&t.transform&&Xt(r,t.transform)},[r,t==null?void 0:t.transform]),J(()=>{a.current=!0}),s}function ai({lens:t,selector:n=i=>i,children:e}){const i=x(t.store,n);return p.jsx(p.Fragment,{children:ge(e,i)})}function oi(t){const[n]=C.useState(()=>{const e=new _e(t),i=t.form instanceof _e?t.form.form:t.form,r=e;return r.AppForm=function(s){return p.jsx(i.AppForm,{...s})},r.AppField=function(s){return p.jsx(i.AppField,{...n.getFormFieldOptions(s)})},r.Field=function(s){return p.jsx(i.Field,{...n.getFormFieldOptions(s)})},r.Subscribe=function(s){return p.jsx(ai,{lens:n,selector:s.selector,children:s.children})},Object.assign(r,{...t.formComponents})});return J(n.mount,[n]),n}const ht=C.createContext(null),bt=C.createContext(null);function Ft(){const t=C.useContext(bt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function li(){function t(){const n=C.useContext(ht);if(!n)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return n}return{fieldContext:ht,useFieldContext:t,useFormContext:Ft,formContext:bt}}function Mt({fieldComponents:t,fieldContext:n,formContext:e,formComponents:i}){function r(l){const d=ni(l),o=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:d,children:c}),[d]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(d.Field,{...v,children:S=>p.jsx(n.Provider,{value:S,children:g(Object.assign(S,t))})})),[d]);return C.useMemo(()=>Object.assign(d,{AppField:f,AppForm:o,...i}),[d,f,o])}function h({render:l,props:d}){return function(f){return l({...d,...f})}}function s({render:l,props:d,defaultValues:o}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:o,formComponents:i}),[m.form,m.fields]),g=oi(c);return l({...d,...m,group:g})}}function a(l){return Ft()}function u(l){return Mt({fieldContext:n,formContext:e,fieldComponents:{...t,...l.fieldComponents},formComponents:{...i,...l.formComponents}})}return{useAppForm:r,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:u}}const{fieldContext:ui,formContext:di,useFieldContext:ve,useFormContext:ci}=li();function hi({label:t,placeholder:n,type:e="text",description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(yt,{id:r.name,type:e,value:r.state.value,placeholder:n,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function fi({label:t,placeholder:n,description:e,rows:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsx(Vt,{id:r.name,value:r.state.value,placeholder:n,rows:i,onBlur:r.handleBlur,onChange:u=>r.handleChange(u.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:a})]})}function mi({label:t,options:n,placeholder:e,description:i}){const r=ve(),{isTouched:h,errors:s}=r.state.meta,a=h?s.map(u=>({message:String(u)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:r.name,children:t}),p.jsxs(At,{value:r.state.value,onValueChange:u=>r.handleChange(u),onOpenChange:u=>{u||r.handleBlur()},children:[p.jsx(Et,{id:r.name,children:p.jsx(wt,{placeholder:e})}),p.jsx(It,{children:n.map(u=>p.jsx(Ct,{value:u.value,children:u.label},u.value))})]}),i&&p.jsx(fe,{children:i}),p.jsx(me,{errors:a})]})}function gi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(he,{htmlFor:e.name,children:t}),p.jsx(Lt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s)}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function vi({label:t,description:n}){const e=ve(),{isTouched:i,errors:r}=e.state.meta,h=i?r.map(s=>({message:String(s)})):[];return p.jsxs(ce,{orientation:"horizontal",children:[p.jsx(Tt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:s=>e.handleChange(s===!0)}),p.jsx(he,{htmlFor:e.name,children:t}),n&&p.jsx(fe,{children:n}),p.jsx(me,{errors:h})]})}function bi({label:t,placeholder:n,description:e}){const i=ve(),{isTouched:r,errors:h}=i.state.meta,s=r?h.map(a=>({message:String(a)})):[];return p.jsxs(ce,{orientation:"vertical",children:[p.jsx(he,{htmlFor:i.name,children:t}),p.jsx(xt,{id:i.name,value:i.state.value,placeholder:n,onBlur:i.handleBlur,onChange:a=>i.handleChange(a.target.value)}),e&&p.jsx(fe,{children:e}),p.jsx(me,{errors:s})]})}function Fi({label:t,pendingLabel:n="Saving…"}){const e=ci();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:r})=>p.jsx(Dt,{type:"submit",disabled:!i||r,children:r?n:t})})}const{useAppForm:pi}=Mt({fieldContext:ui,formContext:di,fieldComponents:{TextField:hi,TextareaField:fi,SelectField:mi,SwitchField:gi,CheckboxField:vi,PasswordField:bi},formComponents:{SubmitButton:Fi}});export{x as a,pi as u};
@@ -1 +1 @@
1
- import{a1 as d,a2 as f}from"./index-DwrBsA10.js";function p(){const t=d();return f({queryKey:["tasks","templates"],queryFn:()=>t.getTaskTemplates()})}const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function c(t){const n=t.trim().split(/\s+/);if(n.length!==5)return null;const[r,e,a,i,u]=n;if(a!=="*"||i!=="*"||!s(e)||!s(r)||Number(e)>23||Number(r)>59)return null;if(u==="*")return`Every day at ${o(e,r)}`;if(u==="1-5")return`Every weekday at ${o(e,r)}`;if(s(u)){const y=m[Number(u)];return y?`Every ${y} at ${o(e,r)}`:null}return null}function s(t){return/^\d+$/.test(t)}function o(t,n){const r=Number(t),e=Number(n),a=r>=12?"PM":"AM";return`${r===0?12:r>12?r-12:r}:${String(e).padStart(2,"0")} ${a}`}function h(t){return c(t)??t}export{h as f,p as u};
1
+ import{a1 as d,a2 as f}from"./index-B6Scr7KJ.js";function p(){const t=d();return f({queryKey:["tasks","templates"],queryFn:()=>t.getTaskTemplates()})}const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function c(t){const n=t.trim().split(/\s+/);if(n.length!==5)return null;const[r,e,a,i,u]=n;if(a!=="*"||i!=="*"||!s(e)||!s(r)||Number(e)>23||Number(r)>59)return null;if(u==="*")return`Every day at ${o(e,r)}`;if(u==="1-5")return`Every weekday at ${o(e,r)}`;if(s(u)){const y=m[Number(u)];return y?`Every ${y} at ${o(e,r)}`:null}return null}function s(t){return/^\d+$/.test(t)}function o(t,n){const r=Number(t),e=Number(n),a=r>=12?"PM":"AM";return`${r===0?12:r>12?r-12:r}:${String(e).padStart(2,"0")} ${a}`}function h(t){return c(t)??t}export{h as f,p as u};