dorkos 0.131.0 → 0.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/dist/bin/cli.js +499 -314
  2. package/dist/browser/fresh-verifier.mjs +13 -13
  3. package/dist/browser/native/darwin-supervisor-worker.mjs +3 -3
  4. package/dist/browser/native/package-manifest.json +1 -1
  5. package/dist/browser/source-manifest.json +1 -1
  6. package/dist/client/assets/{AboutPage-BZ2LLJ0k.js → AboutPage-D-EHHVPa.js} +1 -1
  7. package/dist/client/assets/{ActivityErrorState-BnqAwUiy.js → ActivityErrorState-BTHnE1vP.js} +1 -1
  8. package/dist/client/assets/{ActivityPage-BlZKrSVo.js → ActivityPage-BfSLPIdR.js} +1 -1
  9. package/dist/client/assets/{ActivityRow-Ch8HxQ2m.js → ActivityRow-PwUBjQw8.js} +1 -1
  10. package/dist/client/assets/{AdapterIcon-CfocFMw-.js → AdapterIcon-DgkNN6bi.js} +1 -1
  11. package/dist/client/assets/{AdapterSetupWizard-Dtjx1Oad.js → AdapterSetupWizard-DX0dzp7q.js} +2 -2
  12. package/dist/client/assets/{AgentOptionRow-BGRvUeF7.js → AgentOptionRow-ApuDEKqq.js} +1 -1
  13. package/dist/client/assets/{AgentPicker-BcURPZQp.js → AgentPicker-BDci-9aL.js} +1 -1
  14. package/dist/client/assets/{AgentRequestCard-kNq5A_IN.js → AgentRequestCard-B2gxCMGi.js} +3 -3
  15. package/dist/client/assets/{AppearancePage-Cd-k7dcc.js → AppearancePage-8SVnFe0k.js} +1 -1
  16. package/dist/client/assets/ApplyToOverridesDialog-CnL1ubxL.js +1 -0
  17. package/dist/client/assets/{AttentionSignalRow-QY8AIjf9.js → AttentionSignalRow-CCKhUtil.js} +1 -1
  18. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Cgkvajbw.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B7wFPzG4.js} +3 -3
  19. package/dist/client/assets/BindingDialog-C4BHVXno.js +1 -0
  20. package/dist/client/assets/{BlintzCanvas-CMzZnmWK.js → BlintzCanvas-7E5uwVms.js} +3 -3
  21. package/dist/client/assets/{CanvasCsvContent-uxMaHePf.js → CanvasCsvContent-l7lfyDGn.js} +4 -4
  22. package/dist/client/assets/CanvasFileContent-Bqd0IEfK.js +2 -0
  23. package/dist/client/assets/CanvasModel3dContent-DqL0Sy4r.js +2 -0
  24. package/dist/client/assets/{ChannelComposer-BAg0a29Q.js → ChannelComposer-CAYvz_ZB.js} +12 -17
  25. package/dist/client/assets/{ChatAppsOff-DD28V0vX.js → ChatAppsOff-CNeKBVNz.js} +2 -2
  26. package/dist/client/assets/{CodeMirrorDiff-CyoduBgM.js → CodeMirrorDiff-BZRcNFsS.js} +1 -1
  27. package/dist/client/assets/{CodeMirrorEditor-DGccoZ8Q.js → CodeMirrorEditor-DD5tArRn.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Dk98shko.js → ComputerResourceView-BUmsVssG.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-Broprz4q.js → ComputerViewer-BKMR5LkF.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-C_qLz8GJ.js → ConnectionAccessLists-DYUiFmPY.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-CmGgGmDO.js → ConnectionsPage-DR2Kfm9Q.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-BxWLIUUC.js → ConventionPage-Do6q8873.js} +2 -2
  33. package/dist/client/assets/{ExtensionPageRoute-CyfIRaGs.js → ExtensionPageRoute-CP7NM7fw.js} +2 -2
  34. package/dist/client/assets/{FeatureDisabledState-By2dhVpu.js → FeatureDisabledState-Bi23k3rg.js} +1 -1
  35. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-B6wKQpLR.js → FloatingTanStackRouterDevtools-CqogiFob-lRlmDXYz.js} +1 -1
  36. package/dist/client/assets/{ForwardConsentHost-kDdpyBgA.js → ForwardConsentHost-DSR1pEEK.js} +1 -1
  37. package/dist/client/assets/HandlePage-aHId3bYX.js +1 -0
  38. package/dist/client/assets/HeartbeatPage-BTNVcHOI.js +1 -0
  39. package/dist/client/assets/{KeyEntry-Ctc1zp2J.js → KeyEntry-67acsEG2.js} +1 -1
  40. package/dist/client/assets/{LexicalField-7zd4B8f1.js → LexicalField-Cb68LIar.js} +2 -2
  41. package/dist/client/assets/{ManagesPage-BG1TIMP3.js → ManagesPage-ChPlBF42.js} +1 -1
  42. package/dist/client/assets/{Marketplace-C9r4jRJf.js → Marketplace-CzPhJEE1.js} +4 -4
  43. package/dist/client/assets/{MarketplaceSourcesView-C01Cdrge.js → MarketplaceSourcesView-CmQgxQmU.js} +1 -1
  44. package/dist/client/assets/{McpAppFrame-Dm7MqOhc.js → McpAppFrame-z5JUaCSA.js} +2 -2
  45. package/dist/client/assets/{McpSigninBody-CsXP_7lE.js → McpSigninBody-ZrnzwrOH.js} +1 -1
  46. package/dist/client/assets/{Model3dViewer-DOl8ZkrU.js → Model3dViewer-HJpWK-JI.js} +1 -1
  47. package/dist/client/assets/NamePage-C7F-SotG.js +1 -0
  48. package/dist/client/assets/{NewDirectMessageMenu-Dj-Qw8zA.js → NewDirectMessageMenu-CjBjzsDe.js} +1 -1
  49. package/dist/client/assets/{NotificationsPage-UExs4YE2.js → NotificationsPage-DwNUI0Z3.js} +1 -1
  50. package/dist/client/assets/{OpenMeshSwitch-Dx3M3wwS.js → OpenMeshSwitch-RNAZY1vn.js} +2 -2
  51. package/dist/client/assets/{OperatorIdentityForm-Bz5570RF.js → OperatorIdentityForm-B7S2C_eT.js} +1 -1
  52. package/dist/client/assets/PermissionHistory-D0chstxf.js +1 -0
  53. package/dist/client/assets/PermissionsPage-ToK0DZVV.js +1 -0
  54. package/dist/client/assets/{PersonalityPopover-Do-k_Hhw.js → PersonalityPopover-BvMtUQRM.js} +1 -1
  55. package/dist/client/assets/PhotoPage-Cqo3PNO_.js +1 -0
  56. package/dist/client/assets/{PreviewRefusedNotice-B-yyzQZP.js → PreviewRefusedNotice-DzbkMrUo.js} +1 -1
  57. package/dist/client/assets/{ProfileFields-DiarOK2y.js → ProfileFields-DU8dTGHT.js} +1 -1
  58. package/dist/client/assets/{ProfilePanelContainer-33Xkwoc3.js → ProfilePanelContainer-BfT-ufV7.js} +1 -1
  59. package/dist/client/assets/{ProfileRolePicker-BI6T4hj8.js → ProfileRolePicker-DrOtV-0N.js} +1 -1
  60. package/dist/client/assets/{PromptSuggestionChips-v5MScpZF.js → PromptSuggestionChips-CEnhme_V.js} +1 -1
  61. package/dist/client/assets/{ReportsToPopover-BALADuTO.js → ReportsToPopover-CwjpR1Tw.js} +1 -1
  62. package/dist/client/assets/{RoomSurface-BatV7gf5.js → RoomSurface-CChzNJKw.js} +1 -1
  63. package/dist/client/assets/{RoomsPage-DCCC3Dst.js → RoomsPage-Dbf6ijKr.js} +1 -1
  64. package/dist/client/assets/{RunsOnPopover-C7hMPyrb.js → RunsOnPopover-Bh5sSsSC.js} +1 -1
  65. package/dist/client/assets/{RuntimeConnectFlow-Dc5a8dlJ.js → RuntimeConnectFlow-BYQnY5vv.js} +1 -1
  66. package/dist/client/assets/{RuntimeSetupDialog-w90VGjJ4.js → RuntimeSetupDialog-DTO5v0dP.js} +1 -1
  67. package/dist/client/assets/{SeenDevices-BIMmbMWC.js → SeenDevices-cuY7ASEy.js} +3 -3
  68. package/dist/client/assets/{SessionsPage-0lwvSYHB.js → SessionsPage-BrqpVx-t.js} +1 -1
  69. package/dist/client/assets/{SettingsDialog-CrP6JzPg.js → SettingsDialog-DCAZX_1d.js} +4 -4
  70. package/dist/client/assets/{SkillsPage-BDgKWTfe.js → SkillsPage-D5who_ZH.js} +1 -1
  71. package/dist/client/assets/TaskDialogWrapper-BJ6XtOC5.js +1 -0
  72. package/dist/client/assets/TasksEmptyState-B3SjsxQa.js +3 -0
  73. package/dist/client/assets/{TasksPage-DjGbMGvn.js → TasksPage-B72w7J87.js} +1 -1
  74. package/dist/client/assets/{TeamComputerEntry-B_sM9Fik.js → TeamComputerEntry-B9ma5j-X.js} +1 -1
  75. package/dist/client/assets/TodoPromiseList-DDKWAfmv.js +1 -0
  76. package/dist/client/assets/TodoPromisesPage-BNXpvXzS.js +1 -0
  77. package/dist/client/assets/{ToolsPage-CeETRCd8.js → ToolsPage-DbJykCG3.js} +2 -2
  78. package/dist/client/assets/{TopologyGraph-CnpH2NjE.js → TopologyGraph-DKZS3nlr.js} +3 -3
  79. package/dist/client/assets/{TourHost-BQHrS47S.js → TourHost-Bw3Uoea5.js} +1 -1
  80. package/dist/client/assets/{UnlinkDialog-DOQLeNx4.js → UnlinkDialog-B-XCFNSd.js} +1 -1
  81. package/dist/client/assets/{UnreadDivider-DhyK6uGG.js → UnreadDivider-1aPVzwd7.js} +1 -1
  82. package/dist/client/assets/{WidgetErrorCard-Bwlfu514.js → WidgetErrorCard-C5ieVv_9.js} +6 -6
  83. package/dist/client/assets/{WithheldExtensionsNotice-BDc-CM2t.js → WithheldExtensionsNotice-CCO4ClRZ.js} +1 -1
  84. package/dist/client/assets/{WorkQueuePage-iO_DO1YK.js → WorkQueuePage-BbPKNwDg.js} +1 -1
  85. package/dist/client/assets/WorkView-BRcytACJ.js +51 -0
  86. package/dist/client/assets/_shell-EwFeSIGp.js +80 -0
  87. package/dist/client/assets/{_shell._home-BWi5YPaR.js → _shell._home-DD2mg-iK.js} +1 -1
  88. package/dist/client/assets/{_shell._home.activity-BU1NIGb7.js → _shell._home.activity-Z1QuU2M4.js} +1 -1
  89. package/dist/client/assets/_shell._home.index-BzTYr8Bw.js +3 -0
  90. package/dist/client/assets/_shell._home.tasks-BtC85Iut.js +1 -0
  91. package/dist/client/assets/{_shell._home.workspaces-wbnqJ58w.js → _shell._home.workspaces-qMG5OJYR.js} +1 -1
  92. package/dist/client/assets/{_shell.channels-D1KdvWZF.js → _shell.channels-BE4EK-iM.js} +2 -2
  93. package/dist/client/assets/_shell.connections-CBx0ogzx.js +1 -0
  94. package/dist/client/assets/{_shell.feedback-requests-DzHWC1fJ.js → _shell.feedback-requests-CwKSkkuD.js} +2 -2
  95. package/dist/client/assets/_shell.marketplace-CgWBUKSA.js +1 -0
  96. package/dist/client/assets/_shell.marketplace_.sources-8HZpKFDI.js +1 -0
  97. package/dist/client/assets/_shell.session-D6HcVbnm.js +1 -0
  98. package/dist/client/assets/{_shell.team-BMNSUpQQ.js → _shell.team-Dm5a4f8_.js} +4 -4
  99. package/dist/client/assets/_shell.threads-BavVtQOE.js +1 -0
  100. package/dist/client/assets/_shell.todos-B6uWr0zA.js +6 -0
  101. package/dist/client/assets/_shell.x._extensionId-DaELdkCH.js +1 -0
  102. package/dist/client/assets/_shell.x._extensionId_._-DaELdkCH.js +1 -0
  103. package/dist/client/assets/{abnfDiagram-WEYOIA3C-Co2k29JX.js → abnfDiagram-WEYOIA3C-Bu2T3jVw.js} +1 -1
  104. package/dist/client/assets/{access-copy-D6BUySpp.js → access-copy-tkiFMhRf.js} +1 -1
  105. package/dist/client/assets/{arc-DLZZpkuJ.js → arc-5q4SfXO9.js} +1 -1
  106. package/dist/client/assets/{architectureDiagram-ZHVYKT53-ClS9xqK5.js → architectureDiagram-ZHVYKT53-BnDMOBhV.js} +1 -1
  107. package/dist/client/assets/{banner-B8iMuXCP.js → banner-CSKUrrI0.js} +2 -2
  108. package/dist/client/assets/{blockDiagram-RJAE7QA3-DheoOELu.js → blockDiagram-RJAE7QA3-CtushlEs.js} +1 -1
  109. package/dist/client/assets/{c4Diagram-XDPPPE54-VWWZJ5x4.js → c4Diagram-XDPPPE54-7L-qYwKH.js} +1 -1
  110. package/dist/client/assets/channel-A3XT7_2L.js +1 -0
  111. package/dist/client/assets/{chunk-2E7WHVMD-BqPLJVkv.js → chunk-2E7WHVMD-ksBVyqQ3.js} +1 -1
  112. package/dist/client/assets/{chunk-2Q5K7J3B-DZn6OnKe.js → chunk-2Q5K7J3B-Bfqdkihb.js} +1 -1
  113. package/dist/client/assets/{chunk-4EMNKR2T-Dl9Poajp.js → chunk-4EMNKR2T-Brf2dH9x.js} +1 -1
  114. package/dist/client/assets/{chunk-55XCU76K-RoKuZPUc.js → chunk-55XCU76K-BlE7Cq40.js} +1 -1
  115. package/dist/client/assets/{chunk-5VM5RSS4-DV_1XHtU.js → chunk-5VM5RSS4-Bkgg3j7L.js} +1 -1
  116. package/dist/client/assets/{chunk-JWPE2WC7-B_IuS45y.js → chunk-JWPE2WC7-B9TRpN4O.js} +1 -1
  117. package/dist/client/assets/{chunk-VQ5W62QI-DkLNi45x.js → chunk-VQ5W62QI-ZoILnIYi.js} +1 -1
  118. package/dist/client/assets/{chunk-XXDRQBXY-ISM-1Dpw.js → chunk-XXDRQBXY-r2xNhaKz.js} +1 -1
  119. package/dist/client/assets/{chunk-ZCHMQSOR-MKaLMW8o.js → chunk-ZCHMQSOR-DfV3cF7d.js} +2 -2
  120. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-CIWuu4ht.js → classDiagram-v2-4MYWR3UA-VOVqMNNP.js} +1 -1
  121. package/dist/client/assets/{command-CxGYZKco.js → command-CaUEAy3b.js} +1 -1
  122. package/dist/client/assets/{copy-button-DjAoGwds.js → copy-button-BOznikwM.js} +1 -1
  123. package/dist/client/assets/{cose-bilkent-JH36ORCC-HiCifRyi.js → cose-bilkent-JH36ORCC-CAdBvyLz.js} +1 -1
  124. package/dist/client/assets/{cpu-DHHTTvp_.js → cpu-j9vX9Wfk.js} +1 -1
  125. package/dist/client/assets/{cynefin-EF2NZ3EQ-DjJGZrPz.js → cynefin-EF2NZ3EQ-DcH1A9Oo.js} +1 -1
  126. package/dist/client/assets/{cynefinDiagram-WF24UDRP-DE2NdiJ2.js → cynefinDiagram-WF24UDRP-DJuKBXHi.js} +1 -1
  127. package/dist/client/assets/{dagre-NK4GIZVX-C6gDOD26.js → dagre-NK4GIZVX-D099H_0S.js} +1 -1
  128. package/dist/client/assets/{detail-row-CjwI1iuc.js → detail-row-Crl89jnh.js} +1 -1
  129. package/dist/client/assets/{diagram-CBK3MWTC-38LckcsL.js → diagram-CBK3MWTC-Cd_4W9XO.js} +1 -1
  130. package/dist/client/assets/{diagram-I5XIIV2D--8L6D9Ra.js → diagram-I5XIIV2D-Bc7aQKt3.js} +1 -1
  131. package/dist/client/assets/{diagram-ODIL2UCW-DGC2Inhd.js → diagram-ODIL2UCW-awVJZ4Bg.js} +1 -1
  132. package/dist/client/assets/{diagram-PFBEJUXE-BDHp0AyR.js → diagram-PFBEJUXE-dhsj9aeU.js} +1 -1
  133. package/dist/client/assets/{diagram-RJA3I4VV-uBatJYPi.js → diagram-RJA3I4VV-Dm59CbiV.js} +1 -1
  134. package/dist/client/assets/{diagram-TYUNFSNR-C8e1EH9X.js → diagram-TYUNFSNR-BhvcIjA9.js} +1 -1
  135. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-DimRzU5B.js → ebnfDiagram-V4P3TTPT-C4wT_MTC.js} +1 -1
  136. package/dist/client/assets/{elk-QONTBCTQ-Dz6_Y2-G.js → elk-QONTBCTQ-CPI0zjmW.js} +1 -1
  137. package/dist/client/assets/{empty-state-saV209Il.js → empty-state-BHcmkSzu.js} +1 -1
  138. package/dist/client/assets/{erDiagram-KYQIGQAA-JeuTF8w6.js → erDiagram-KYQIGQAA-C_vGcbOB.js} +1 -1
  139. package/dist/client/assets/{execution-config-ClQZyDs9.js → execution-config-BS5rtvTZ.js} +1 -1
  140. package/dist/client/assets/{file-BIF-4ARS.js → file-CQGljfDT.js} +1 -1
  141. package/dist/client/assets/{file-exclamation-point-DxadH2b-.js → file-exclamation-point-B0a55VME.js} +1 -1
  142. package/dist/client/assets/{file-text-C_NPIQr4.js → file-text-Cycq_S0e.js} +1 -1
  143. package/dist/client/assets/{find-latest-widget-fence-CXai_zs0.js → find-latest-widget-fence-B6sJdG3Q.js} +4 -4
  144. package/dist/client/assets/{flowDiagram-IUGLLWBU-9FHDdK4j.js → flowDiagram-IUGLLWBU-_VNfmnxx.js} +1 -1
  145. package/dist/client/assets/{form-D3VdAYl4.js → form-BL14vwyB.js} +1 -1
  146. package/dist/client/assets/{format-cron-BqRDcFZM.js → format-cron-meJMgYNe.js} +1 -1
  147. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CLMuXlHt.js → ganttDiagram-R7GPNTJY-o0gGU7X_.js} +1 -1
  148. package/dist/client/assets/{git-branch-Df7a5_fb.js → git-branch-CsLE6G0Y.js} +1 -1
  149. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-sE7Rlpr6.js → gitGraphDiagram-PDYL7XHY-DjXjUpJo.js} +1 -1
  150. package/dist/client/assets/{graph-iNVyFhBQ.js → graph-BMYee_VK.js} +1 -1
  151. package/dist/client/assets/{heart-BHMhDZ0K.js → heart-Cn3a-UQI.js} +1 -1
  152. package/dist/client/assets/{highlighted-body-KPVGNVTW-VvvsrJbu.js → highlighted-body-KPVGNVTW-DsX5yCC0.js} +1 -1
  153. package/dist/client/assets/{image-lightbox-CGEIRguA.js → image-lightbox-BZ_eBZgA.js} +1 -1
  154. package/dist/client/assets/{image-off-C5-TmSq8.js → image-off-DjR7LI5G.js} +1 -1
  155. package/dist/client/assets/{index-C3zS0ghJ.js → index-1MwES_vb.js} +1 -1
  156. package/dist/client/assets/{index-ClyRhxV_.js → index-47--OGKJ.js} +1 -1
  157. package/dist/client/assets/{index-CTgUh4p3.js → index-4rSR8lau.js} +1 -1
  158. package/dist/client/assets/{index-D9bEy8X-.js → index-B4TxpTKD.js} +1 -1
  159. package/dist/client/assets/{index-Dw-4S640.js → index-B8LqLhq7.js} +1 -1
  160. package/dist/client/assets/index-BJRgbiEd.js +1 -0
  161. package/dist/client/assets/{index-DWZ5M321.js → index-BOCclWF3.js} +1 -1
  162. package/dist/client/assets/index-BR1m9FON.js +1066 -0
  163. package/dist/client/assets/index-BcFn_S6b.js +1 -0
  164. package/dist/client/assets/{index-DRtg_sGG.js → index-BcnwvTnt.js} +1 -1
  165. package/dist/client/assets/index-BdVQOlVQ.css +1 -0
  166. package/dist/client/assets/{index-DEvpdTo6.js → index-BmKHO-FD.js} +1 -1
  167. package/dist/client/assets/{index-Bd0PAkxf.js → index-BsZkXHsH.js} +1 -1
  168. package/dist/client/assets/{index-Cudi8rs6.js → index-BxWr8Mrf.js} +1 -1
  169. package/dist/client/assets/index-C5EvpXcq.js +1 -0
  170. package/dist/client/assets/{index-CExh9cKN.js → index-Cb_p_ynP.js} +1 -1
  171. package/dist/client/assets/{index-YZbu9tke.js → index-CczLBUKI.js} +1 -1
  172. package/dist/client/assets/{index-264YDu-W.js → index-Cf4Gtxf9.js} +1 -1
  173. package/dist/client/assets/{index-Dpu2CORc.js → index-CfKSlYjb.js} +1 -1
  174. package/dist/client/assets/{index-Bzm9YMbr.js → index-Cgjq7a-8.js} +1 -1
  175. package/dist/client/assets/{index-Ci_J5Q-6.js → index-CpWxcN5D.js} +1 -1
  176. package/dist/client/assets/{index-BK5QrGfQ.js → index-Cv67OXfk.js} +1 -1
  177. package/dist/client/assets/{index-Di-MIFQG.js → index-D5Qmx1JR.js} +3 -3
  178. package/dist/client/assets/{index-LPrq0pOA.js → index-DARchye_.js} +1 -1
  179. package/dist/client/assets/{index-DMwivStD.js → index-DFb4kOjm.js} +2 -2
  180. package/dist/client/assets/{index-WeLoaNzW.js → index-DLN0kcME.js} +1 -1
  181. package/dist/client/assets/{index-BMLCfTba.js → index-DMSSN08i.js} +1 -1
  182. package/dist/client/assets/{index-Y6BDhuGt.js → index-DQ8uADJF.js} +1 -1
  183. package/dist/client/assets/index-DZhMvc9m.js +1 -0
  184. package/dist/client/assets/{index-CLsoFUml.js → index-Dfko0tSp.js} +1 -1
  185. package/dist/client/assets/{index-BgdYXP8E.js → index-DiM3QX-4.js} +3 -3
  186. package/dist/client/assets/{index-BxFLHNLg.js → index-DlvUENo4.js} +1 -1
  187. package/dist/client/assets/{index-BLUUshO9.js → index-DqZmnJED.js} +1 -1
  188. package/dist/client/assets/{index-D_bAtIJZ.js → index-DrlB9RSk.js} +1 -1
  189. package/dist/client/assets/{index-CgWzzIbx.js → index-H4e5Wpmi.js} +1 -1
  190. package/dist/client/assets/{index-k67dvyau.js → index-Joav7LQU.js} +1 -1
  191. package/dist/client/assets/{index-B0FHRkHM.js → index-KganLhU1.js} +2 -2
  192. package/dist/client/assets/{index-DFkofTx1.js → index-Kt6r3DQg.js} +1 -1
  193. package/dist/client/assets/{index-B8I1k-z9.js → index-Z2ApBQt4.js} +1 -1
  194. package/dist/client/assets/index-dY7IFpet.js +1 -0
  195. package/dist/client/assets/{index-DYVNSRDk.js → index-faSyUc2q.js} +1 -1
  196. package/dist/client/assets/{index-BgRYuqWs.js → index-gmyiXkmr.js} +1 -1
  197. package/dist/client/assets/{index-BZTLFzJp.js → index-o6kGmVGx.js} +1 -1
  198. package/dist/client/assets/{index-C_0JoCV6.js → index-vHKVYcH7.js} +1 -1
  199. package/dist/client/assets/{index.esm-CYmalBux.js → index.esm-CJIDYBqd.js} +1 -1
  200. package/dist/client/assets/{infoDiagram-MVDRKAX5-0aR9wjgO.js → infoDiagram-MVDRKAX5-B1mMyUlp.js} +1 -1
  201. package/dist/client/assets/{inline-code-DyTKSC5b.js → inline-code-mh48Uhbi.js} +1 -1
  202. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-D1lN8x2t.js → ishikawaDiagram-HPEHV2GE-efEMQ0_X.js} +1 -1
  203. package/dist/client/assets/{journeyDiagram-BOSHW7O7-CkXITXiJ.js → journeyDiagram-BOSHW7O7-DSAywiVk.js} +1 -1
  204. package/dist/client/assets/{kanban-definition-FNSA4HC5-ge33IiSq.js → kanban-definition-FNSA4HC5-B9pbU4zK.js} +1 -1
  205. package/dist/client/assets/{layers-Bx3K7OUm.js → layers-B0Z5Od3N.js} +1 -1
  206. package/dist/client/assets/{lightbulb-C5LvXkvM.js → lightbulb-Cfb5ecEd.js} +1 -1
  207. package/dist/client/assets/{link-2-Bj0_Zkvr.js → link-2-Dzy5BUL3.js} +1 -1
  208. package/dist/client/assets/{list-runtime-types-VNj1C8TB.js → list-runtime-types-DLmjtBMq.js} +1 -1
  209. package/dist/client/assets/{markdown-content-BRaPEOC7.js → markdown-content-DhAtZOfj.js} +1 -1
  210. package/dist/client/assets/{mention-pill-B_MiJWfo.js → mention-pill-DmA8FxL4.js} +1 -1
  211. package/dist/client/assets/{mermaid.core-B2hil_4a.js → mermaid.core-DUIkdbeL.js} +4 -4
  212. package/dist/client/assets/{message-square-off-T33FHpr7.js → message-square-off-BowIzJUV.js} +1 -1
  213. package/dist/client/assets/{mindmap-definition-6OY57UG3-Bu_Ia4Xz.js → mindmap-definition-6OY57UG3-Dz7ZOR4C.js} +1 -1
  214. package/dist/client/assets/{more-details-oDazWBxm.js → more-details-DV7LmY0E.js} +1 -1
  215. package/dist/client/assets/{owner-notice-VepbAQhj.js → owner-notice-DdFc2P8z.js} +1 -1
  216. package/dist/client/assets/{package-DBsl3ao5.js → package-BhKXbvU_.js} +1 -1
  217. package/dist/client/assets/{page-container-Bkarym6m.js → page-container-0sWZ3xh9.js} +1 -1
  218. package/dist/client/assets/{pane-resize-handle-gBlb5k1v.js → pane-resize-handle-Bjy4udre.js} +1 -1
  219. package/dist/client/assets/{paperclip-BeFttiUK.js → paperclip-C-7LhBfl.js} +1 -1
  220. package/dist/client/assets/{path-input-NY_yCBHb.js → path-input-BPVyI72G.js} +1 -1
  221. package/dist/client/assets/{pegDiagram-ECIUJNBX-0KmJlW0E.js → pegDiagram-ECIUJNBX-C4EOP-Fa.js} +1 -1
  222. package/dist/client/assets/{pieDiagram-GNMPY74T-IjeZXicv.js → pieDiagram-GNMPY74T-CQ1OxRkv.js} +1 -1
  223. package/dist/client/assets/{plug-CTqOZ7cA.js → plug-CIZ-wWL8.js} +1 -1
  224. package/dist/client/assets/{primer-trigger-CjaGrT2u.js → primer-trigger-XA5fLzR5.js} +2 -2
  225. package/dist/client/assets/{profile-errors-B8XkL2Rp.js → profile-errors-C1XACbc9.js} +1 -1
  226. package/dist/client/assets/{progress-Cr-4myw6.js → progress-BA2JPtb6.js} +1 -1
  227. package/dist/client/assets/{quadrantDiagram-D57K4MC3-CP6kLJKa.js → quadrantDiagram-D57K4MC3-Cw4BdkpS.js} +1 -1
  228. package/dist/client/assets/{query-error-state-DvhY-YKM.js → query-error-state-Cm-Lozlb.js} +1 -1
  229. package/dist/client/assets/{radio-CmDmmJy6.js → radio-DQ29H26H.js} +1 -1
  230. package/dist/client/assets/{railroadDiagram-Y72NRBL7-Bcto__oE.js → railroadDiagram-Y72NRBL7-CSKtYLmm.js} +1 -1
  231. package/dist/client/assets/registry-Tbt9pcZl.js +39 -0
  232. package/dist/client/assets/registry-jD9zw538.js +1 -0
  233. package/dist/client/assets/{relay-trace-schemas-ZLR1S8ft.js → relay-trace-schemas-4AAUf-Zl.js} +2 -2
  234. package/dist/client/assets/{repeat-DVTM8et8.js → repeat-B8g-x-Sc.js} +1 -1
  235. package/dist/client/assets/{requirementDiagram-EQYSW5RA-DNJrds3m.js → requirementDiagram-EQYSW5RA-BPSBZr7X.js} +1 -1
  236. package/dist/client/assets/{room-files-source-9Wdtc-bG.js → room-files-source-BkiK4-ZI.js} +2 -2
  237. package/dist/client/assets/{rotate-ccw-clock-qJSWqifh.js → rotate-ccw-clock-DRtL-2nr.js} +1 -1
  238. package/dist/client/assets/{rotate-cw-uoeBxIeM.js → rotate-cw-BbHkWN-J.js} +1 -1
  239. package/dist/client/assets/{sankeyDiagram-SY24JHO5-DNlU7xGI.js → sankeyDiagram-SY24JHO5-DVlHablQ.js} +1 -1
  240. package/dist/client/assets/{scroll-area-B1d3NfEn.js → scroll-area-DAC7NrVU.js} +1 -1
  241. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-CRk71coF.js → sequenceDiagram-BLEHNHQU--wZkN8xk.js} +1 -1
  242. package/dist/client/assets/{shield-x-BpQmg1qz.js → shield-x-CEWfkzDN.js} +1 -1
  243. package/dist/client/assets/{signed-in-CTmJ3OqM.js → signed-in-CMhCR-m8.js} +1 -1
  244. package/dist/client/assets/{sizeCapture-INFHLROL-cihX3QNq.js → sizeCapture-INFHLROL-CLXc7d3S.js} +1 -1
  245. package/dist/client/assets/{soul-file-BwiyiI5v.js → soul-file-CbX7rNqz.js} +1 -1
  246. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BAwwRsnH.js → stateDiagram-v2-A6IESKWZ-5xa1FM_X.js} +1 -1
  247. package/dist/client/assets/{swimlanes-B3ENRKFQ-CpDB6CUC.js → swimlanes-B3ENRKFQ-DKgxJxjE.js} +1 -1
  248. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-f6MOc3pl.js +8 -0
  249. package/dist/client/assets/{table-dWrfPeX-.js → table-D0EJT0uP.js} +1 -1
  250. package/dist/client/assets/{tabs-D4txthOi.js → tabs-Ctjzrm8t.js} +1 -1
  251. package/dist/client/assets/{timeline-definition-JXYKGLGB-RDrKgCoU.js → timeline-definition-JXYKGLGB-B9P7ituI.js} +1 -1
  252. package/dist/client/assets/trust-dial-D__tIhzt.js +11 -0
  253. package/dist/client/assets/{trust-posture-atZIh8tf.js → trust-posture-DaHHtOZn.js} +1 -1
  254. package/dist/client/assets/{unplug-CnevV4yX.js → unplug-B-ipHefz.js} +1 -1
  255. package/dist/client/assets/{unverified-catalog-notice-BQwT36FA.js → unverified-catalog-notice-C8swqaTn.js} +1 -1
  256. package/dist/client/assets/{use-bindings-CltfjAWW.js → use-bindings-gLHRNAFU.js} +1 -1
  257. package/dist/client/assets/{use-composer-prefs-D-Zlt6z2.js → use-composer-prefs-CjpxcBIe.js} +1 -1
  258. package/dist/client/assets/{use-connector-management-C3CLnOOt.js → use-connector-management-BLiCJMgU.js} +1 -1
  259. package/dist/client/assets/{use-deep-link-scroll-DQlz-scx.js → use-deep-link-scroll-r2nKjzA-.js} +1 -1
  260. package/dist/client/assets/{use-delete-binding-D73CLm_7.js → use-delete-binding-BSiOik_K.js} +1 -1
  261. package/dist/client/assets/{use-dev-links-BqVFsMKU.js → use-dev-links-DXcIlMf-.js} +1 -1
  262. package/dist/client/assets/use-direct-message-panel-BbH8N4mE.js +1 -0
  263. package/dist/client/assets/{use-external-adapter-catalog-DrnksH0t.js → use-external-adapter-catalog-mmKni5ui.js} +1 -1
  264. package/dist/client/assets/{use-filter-state-D4i-hDOk.js → use-filter-state-CiPZ0AIH.js} +2 -2
  265. package/dist/client/assets/{use-full-activity-feed-DdDsRg8s.js → use-full-activity-feed-DXroUzfN.js} +1 -1
  266. package/dist/client/assets/use-is-below-desktop-LUZL5z5t.js +1 -0
  267. package/dist/client/assets/{use-mesh-topology-B7aLtPkZ.js → use-mesh-topology-upehQ5Cv.js} +1 -1
  268. package/dist/client/assets/{use-mounted-ref-DSSTCJfY.js → use-mounted-ref-IHwyriaF.js} +1 -1
  269. package/dist/client/assets/{use-notification-prefs-DaF3kwmq.js → use-notification-prefs-BHOK2P2l.js} +1 -1
  270. package/dist/client/assets/use-pending-read-mVsOBTzn.js +1 -0
  271. package/dist/client/assets/{use-personality-commit-D5b90JPX.js → use-personality-commit-Chf3UX8P.js} +1 -1
  272. package/dist/client/assets/{use-promo-activation-CPAOQpfe.js → use-promo-activation-Dlw6bg7G.js} +2 -2
  273. package/dist/client/assets/{use-promo-dismissals-Bx1gz1R1.js → use-promo-dismissals-Dx_fli7I.js} +1 -1
  274. package/dist/client/assets/{use-pulse-freshness-DeulB37O.js → use-pulse-freshness-CG_I6a-O.js} +1 -1
  275. package/dist/client/assets/{use-room-follow-claim-Dwke6RFQ.js → use-room-follow-claim-Bgrpr3bO.js} +1 -1
  276. package/dist/client/assets/{use-room-sessions-iepVrIMm.js → use-room-sessions-DecGrP3E.js} +1 -1
  277. package/dist/client/assets/{use-roving-tab-list-pCPKNQKv.js → use-roving-tab-list-CDkh-Ujm.js} +1 -1
  278. package/dist/client/assets/{use-session-canvas-BvvO-_V1.js → use-session-canvas-tvLLPQcm.js} +6 -6
  279. package/dist/client/assets/{use-status-budget-Bs7MMriS.js → use-status-budget-BBl2yxLR.js} +2 -2
  280. package/dist/client/assets/{use-todos-C-eREuDS.js → use-todos-BzRauzdQ.js} +1 -1
  281. package/dist/client/assets/{use-transform-lj3TkjYO.js → use-transform-DzJeHpxm.js} +1 -1
  282. package/dist/client/assets/{use-unclaimed-chats-BF3-0jHC.js → use-unclaimed-chats--HZdmq4F.js} +1 -1
  283. package/dist/client/assets/use-update-config-DjL7-nUR.js +1 -0
  284. package/dist/client/assets/{useMutationState-B_x_4f2K.js → useMutationState-DIywUTDG.js} +1 -1
  285. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DBsRYa4J.js → usecaseDiagram-WPOLBNNX-C9aLJ03F.js} +1 -1
  286. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-rFAXvcQI.js → vennDiagram-Q3Y3IDCW-ChBIWbL0.js} +1 -1
  287. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-bI0JZkO3.js → wardleyDiagram-IVAIDKWA-DvQDOaTm.js} +1 -1
  288. package/dist/client/assets/{xychartDiagram-4URNHDU4-DZUd8iln.js → xychartDiagram-4URNHDU4-8FxLPP2c.js} +1 -1
  289. package/dist/client/assets/zap-DSllMMHe.js +6 -0
  290. package/dist/client/index.html +2 -2
  291. package/dist/drizzle/20261104060919_package_approval_request.sql +1 -0
  292. package/dist/drizzle/20261104081935_hook_decline_review.sql +3 -0
  293. package/dist/drizzle/20261107183323_dor3933_todos_rename.sql +64 -0
  294. package/dist/drizzle/20261108014418_dor3938_cross_agent_writer.sql +4 -0
  295. package/dist/drizzle/meta/20261104060919_snapshot.json +14889 -0
  296. package/dist/drizzle/meta/20261104081935_snapshot.json +14910 -0
  297. package/dist/drizzle/meta/20261107183323_snapshot.json +14910 -0
  298. package/dist/drizzle/meta/20261108014418_snapshot.json +14938 -0
  299. package/dist/drizzle/meta/_journal.json +28 -0
  300. package/dist/server/index.js +24875 -21931
  301. package/dist/server/index.js.map +2 -2
  302. package/package.json +5 -5
  303. package/dist/client/assets/ApplyToOverridesDialog-DE9VVQCA.js +0 -1
  304. package/dist/client/assets/BindingDialog-C_yflKOE.js +0 -1
  305. package/dist/client/assets/CanvasFileContent-C3ZKszxn.js +0 -2
  306. package/dist/client/assets/CanvasModel3dContent-CsNUuaj6.js +0 -2
  307. package/dist/client/assets/CommitmentList-DOvfnyDA.js +0 -1
  308. package/dist/client/assets/CommitmentsPage-D81vxHUk.js +0 -1
  309. package/dist/client/assets/HandlePage-vsG04kBg.js +0 -1
  310. package/dist/client/assets/HeartbeatPage-CMj1SS30.js +0 -1
  311. package/dist/client/assets/NamePage-DdX2yQ5f.js +0 -1
  312. package/dist/client/assets/PermissionHistory-Bhl2kr1R.js +0 -1
  313. package/dist/client/assets/PermissionsPage-DUbenFkt.js +0 -1
  314. package/dist/client/assets/PhotoPage-CExABoHA.js +0 -1
  315. package/dist/client/assets/TaskDialogWrapper-BVb8gAr0.js +0 -1
  316. package/dist/client/assets/TasksEmptyState-RkUEEU2r.js +0 -3
  317. package/dist/client/assets/WorkView-BDk_vwu3.js +0 -51
  318. package/dist/client/assets/_shell-CMNFxZKJ.js +0 -80
  319. package/dist/client/assets/_shell._home.index-BjR-d3_s.js +0 -3
  320. package/dist/client/assets/_shell._home.tasks-CqURPMQD.js +0 -1
  321. package/dist/client/assets/_shell.connections-D3gJrBTQ.js +0 -1
  322. package/dist/client/assets/_shell.marketplace-HdefWdN_.js +0 -1
  323. package/dist/client/assets/_shell.marketplace_.sources-wAZKfDQF.js +0 -1
  324. package/dist/client/assets/_shell.session-C0utZeSI.js +0 -1
  325. package/dist/client/assets/_shell.threads-TvzYRNMt.js +0 -1
  326. package/dist/client/assets/_shell.todos-sOFmsIPE.js +0 -6
  327. package/dist/client/assets/_shell.x._extensionId-DiEQZIvl.js +0 -1
  328. package/dist/client/assets/_shell.x._extensionId_._-DiEQZIvl.js +0 -1
  329. package/dist/client/assets/channel-B0WiEIVe.js +0 -1
  330. package/dist/client/assets/index-BwTGkJbK.js +0 -1071
  331. package/dist/client/assets/index-CCHGVclj.js +0 -1
  332. package/dist/client/assets/index-CiUmx-i3.js +0 -1
  333. package/dist/client/assets/index-Dd4JoHFP.js +0 -1
  334. package/dist/client/assets/index-DlmGvYpy.js +0 -1
  335. package/dist/client/assets/index-EXJsA5kw.js +0 -1
  336. package/dist/client/assets/index-MpS13vhQ.css +0 -1
  337. package/dist/client/assets/registry-BQTcAm5U.js +0 -39
  338. package/dist/client/assets/registry-HencHRXy.js +0 -1
  339. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-nJfOIWYW.js +0 -8
  340. package/dist/client/assets/use-direct-message-panel-B3qfpDjY.js +0 -1
  341. package/dist/client/assets/use-is-below-desktop-BXHT3oPL.js +0 -1
  342. package/dist/client/assets/use-local-browser-DDWknHZE.js +0 -1
  343. package/dist/client/assets/use-pending-read-uvmEJ7H9.js +0 -1
  344. package/dist/client/assets/use-update-config-D-OGlXGR.js +0 -1
@@ -1 +1 @@
1
- import{j as e,B as c,x,G as u,W as o}from"./index-BwTGkJbK.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-BR1m9FON.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-ISM-1Dpw.js";import{s as Kt}from"./chunk-VQ5W62QI-DkLNi45x.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-B2hil_4a.js";import{s as ce}from"./transform-BqqRT-Iy.js";import{c as he}from"./channel-B0WiEIVe.js";import"./index-BwTGkJbK.js";import"./BlintzCanvas-CMzZnmWK.js";import"./index-Dpu2CORc.js";import"./index-Di-MIFQG.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-r2xNhaKz.js";import{s as Kt}from"./chunk-VQ5W62QI-ZoILnIYi.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-DUIkdbeL.js";import{s as ce}from"./transform-BqqRT-Iy.js";import{c as he}from"./channel-A3XT7_2L.js";import"./index-BR1m9FON.js";import"./BlintzCanvas-7E5uwVms.js";import"./index-CfKSlYjb.js";import"./index-D5Qmx1JR.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{aa as v,ab as E}from"./index-BwTGkJbK.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:b,runtimeLabel:f=E}=n,t=[],l=[],s=e.runtime??i,p=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&&(b===!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:`${p??"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{aa as v,ab as E}from"./index-BR1m9FON.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:b,runtimeLabel:f=E}=n,t=[],l=[],s=e.runtime??i,p=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&&(b===!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:`${p??"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-BwTGkJbK.js";/**
1
+ import{O as e}from"./index-BR1m9FON.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-BwTGkJbK.js";/**
1
+ import{O as e}from"./index-BR1m9FON.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-BwTGkJbK.js";/**
1
+ import{O as a}from"./index-BR1m9FON.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 u,j as t,fR as h,_,G as y,fS as N,a_ as j}from"./index-BwTGkJbK.js";import{u as b,p as k,W as v,a as E}from"./WidgetErrorCard-Bwlfu514.js";/**
1
+ import{O as u,j as t,fY as h,_ as y,G as _,fZ as N,aZ as j}from"./index-BR1m9FON.js";import{u as b,p as k,W as v,a as E}from"./WidgetErrorCard-C5ieVv_9.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,7 +8,7 @@ import{O as u,j as t,fR as h,_,G as y,fS as N,a_ as j}from"./index-BwTGkJbK.js";
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=b();return t.jsxs(h,{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(_.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=N(null),c=j(a=>a.openPip);if(!i){const a=k(e);if(a.ok)o.write(a.document);else if(o.read()===null&&!d)return t.jsx("div",{className:"my-2",children:t.jsx(v,{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(E,{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 P(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 R(e){return e.endsWith("\r")?e.slice(0,-1):e}function C(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:_("bg-muted rounded-md",e)})}function S(){const e=b();return t.jsxs(h,{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(y.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=N(null),c=j(a=>a.openPip);if(!i){const a=k(e);if(a.ok)o.write(a.document);else if(o.read()===null&&!d)return t.jsx("div",{className:"my-2",children:t.jsx(v,{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(E,{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 P(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 C(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(R).join(`
14
- `),isIncomplete:c===-1}}function G(e){const i=P(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}=C(s.content);return{code:d,isIncomplete:o,sourceMessageKey:s.key,isLatest:!0,isStreaming:s.key===g}}return null}export{T as C,w as P,M as W,F as a,f as b,G as f};
13
+ `),c=o.findIndex(a=>a.trimEnd()===W);return{code:(c===-1?o:o.slice(0,c)).map(C).join(`
14
+ `),isIncomplete:c===-1}}function G(e){const i=P(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{T as C,w as P,M as W,F as a,f as b,G as f};
@@ -1,4 +1,4 @@
1
- import{g as qt}from"./chunk-5VM5RSS4-DV_1XHtU.js";import{g as Xt}from"./chunk-XXDRQBXY-ISM-1Dpw.js";import{s as Qt}from"./chunk-VQ5W62QI-DkLNi45x.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-B2hil_4a.js";import{c as k1}from"./chunk-55XCU76K-RoKuZPUc.js";import{s as it}from"./transform-BqqRT-Iy.js";import{p as A1}from"./BlintzCanvas-CMzZnmWK.js";import{c as m1}from"./channel-B0WiEIVe.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-Bkgg3j7L.js";import{g as Xt}from"./chunk-XXDRQBXY-r2xNhaKz.js";import{s as Qt}from"./chunk-VQ5W62QI-ZoILnIYi.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-DUIkdbeL.js";import{c as k1}from"./chunk-55XCU76K-BlE7Cq40.js";import{s as it}from"./transform-BqqRT-Iy.js";import{p as A1}from"./BlintzCanvas-7E5uwVms.js";import{c as m1}from"./channel-A3XT7_2L.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 tt=t=>{throw TypeError(t)};var it=(t,r,e)=>r.has(t)||tt("Cannot "+e);var y=(t,r,e)=>(it(t,r,"read from private field"),e?e.call(t):r.get(t)),N=(t,r,e)=>r.has(t)?tt("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(t):r.set(t,e),B=(t,r,e,i)=>(it(t,r,"write to private field"),i?i.call(t,e):r.set(t,e),e);var st=(t,r,e,i)=>({set _(n){B(t,r,n,e)},get _(){return y(t,r,i)}});import{r as C,mB as yt,j as p,mC as Vt,dE as he,dF as fe,I as At,h8 as me,i8 as ge,dD as Et,ex as wt,ey as It,ez as Ct,eA as Lt,eB as Tt,i7 as mt,a3 as xt,gY as Dt,eF as Bt,B as kt}from"./index-BwTGkJbK.js";function jt({update:t,notify:r,unwatched:e}){return{link:i,unlink:n,propagate:h,checkDirty:s,shallowPropagate:a};function i(o,u,l){const f=u.depsTail;if(f!==void 0&&f.dep===o)return;const m=f!==void 0?f.nextDep:u.deps;if(m!==void 0&&m.dep===o){m.version=l,u.depsTail=m;return}const c=o.subsTail;if(c!==void 0&&c.version===l&&c.sub===u)return;const g=u.depsTail=o.subsTail={version:l,dep:o,sub:u,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:u.deps=g,c!==void 0?c.nextSub=g:o.subs=g}function n(o,u=o.sub){const l=o.dep,f=o.prevDep,m=o.nextDep,c=o.nextSub,g=o.prevSub;return m!==void 0?m.prevDep=f:u.depsTail=f,f!==void 0?f.nextDep=m:u.deps=m,c!==void 0?c.prevSub=g:l.subsTail=g,g!==void 0?g.nextSub=c:(l.subs=c)===void 0&&e(l),m}function h(o){let u=o.nextSub,l;e:do{const f=o.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&d(o,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&r(f),m&1){const c=f.subs;if(c!==void 0){const g=(o=c).nextSub;g!==void 0&&(l={value:u,prev:l},u=g);continue}}if((o=u)!==void 0){u=o.nextSub;continue}for(;l!==void 0;)if(o=l.value,l=l.prev,o!==void 0){u=o.nextSub;continue e}break}while(!0)}function s(o,u){let l,f=0,m=!1;e:do{const c=o.dep,g=c.flags;if(u.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){(o.nextSub!==void 0||o.prevSub!==void 0)&&(l={value:o,prev:l}),o=c.deps,u=c,++f;continue}if(!m){const v=o.nextDep;if(v!==void 0){o=v;continue}}for(;f--;){const v=u.subs,S=v.nextSub!==void 0;if(S?(o=l.value,l=l.prev):o=v,m){if(t(u)){S&&a(v),u=o.sub;continue}m=!1}else u.flags&=-33;u=o.sub;const F=o.nextDep;if(F!==void 0){o=F;continue e}}return m}while(!0)}function a(o){do{const u=o.sub,l=u.flags;(l&48)===32&&(u.flags=l|16,(l&6)===2&&r(u))}while((o=o.nextSub)!==void 0)}function d(o,u){let l=u.depsTail;for(;l!==void 0;){if(l===o)return!0;l=l.prevDep}return!1}}function Je(t,r,e){var h,s,a;const i=typeof t=="object",n=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(n),error:(s=i?t.error:r)==null?void 0:s.bind(n),complete:(a=i?t.complete:e)==null?void 0:a.bind(n)}}const He=[];let De=0;const{link:rt,unlink:Pt,propagate:_t,checkDirty:gt,shallowPropagate:nt}=jt({update(t){return t._update()},notify(t){He[Xe++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,Pe(t))}});let Le=0,Xe=0,z,Ye=0;function _(t){try{++Ye,t()}finally{--Ye||vt()}}function Pe(t){const r=t.depsTail;let e=r!==void 0?r.nextDep:t.deps;for(;e!==void 0;)e=Pt(e,t)}function vt(){if(!(Ye>0)){for(;Le<Xe;){const t=He[Le];He[Le++]=void 0,t.notify()}Le=0,Xe=0}}function bt(t,r){const e=typeof t=="function",i=t,n={_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&&rt(n,z,De),n._snapshot},subscribe(h){const s=Je(h),a={current:!1},d=Rt(()=>{var o;n.get(),a.current?(o=s.next)==null||o.call(s,n._snapshot):a.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=n,++De,n.depsTail=void 0;else if(h===void 0)return!1;e&&(n.flags=5);try{const d=n._snapshot,o=typeof h=="function"?h(d):h===void 0&&e?i(d):h;return d===void 0||!a(d,o)?(n._snapshot=o,!0):!1}finally{z=s,e&&(n.flags&=-5),Pe(n)}}};return e?(n.flags=17,n.get=function(){const h=n.flags;if(h&16||h&32&&gt(n.deps,n)){if(n._update()){const s=n.subs;s!==void 0&&nt(s)}}else h&32&&(n.flags=h&-33);return z!==void 0&&rt(n,z,De),n._snapshot}):n.set=function(h){if(n._update(h)){const s=n.subs;s!==void 0&&(_t(s),nt(s),vt())}},n}function Rt(t){const r=()=>{const i=z;z=e,++De,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,Pe(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&&gt(this.deps,this)?r():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Pe(this)}};return r(),e}var Nt=class{constructor(t,r){this.atom=bt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),r&&(this.actions=r(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Je(t))}},Ot=class{constructor(t){this.atom=bt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Je(t))}};function ie(t,r){return typeof t=="function"?new Ot(t):new Nt(t)}var Gt=class{constructor(t,r){this.fn=t,this.options=r,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 n=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},n)}},this.execute=(...e)=>{var i,n;this.fn(...e),(n=(i=this.options).onExecute)==null||n.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 $t(t,r){return new Gt(t,r).maybeExecute}var ee,U,G,we,H,re,X,ue,Ie,Ne,te,de,Y,Ce,ce,Oe;class Wt{constructor({pluginId:r,debug:e=!1,enabled:i=!0,reconnectEveryMs:n=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,we);N(this,H);N(this,re);N(this,X);N(this,ue);N(this,Ie,0);N(this,Ne,5);N(this,te,!1);N(this,de,!1);N(this,Y,null);N(this,Ce,()=>{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(r=>this.emitEventToBus(r)),B(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ce))});N(this,ce,()=>{if(y(this,Ie)<y(this,Ne)){st(this,Ie)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,ce)),B(this,de,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Oe,()=>{y(this,te)||(B(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ce)),y(this,ce).call(this))});B(this,U,r),B(this,ee,i),B(this,G,this.getGlobalTarget),B(this,we,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),B(this,H,[]),B(this,re,!1),B(this,de,!1),B(this,X,null),B(this,ue,n)}startConnectLoop(){y(this,X)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,ue)}ms)`),B(this,X,setInterval(y(this,ce),y(this,ue))))}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(...r){y(this,we)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...r)}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 r=typeof EventTarget<"u"?new EventTarget:void 0;return typeof r>"u"||typeof r.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),r)}getPluginId(){return y(this,U)}dispatchCustomEventShim(r,e){try{const i=new Event(r,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(r,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(r,{detail:e}))}catch{this.dispatchCustomEventShim(r,e)}}emitEventToBus(r){this.debugLog("Emitting event to client bus",r),this.dispatchCustomEvent("tanstack-dispatch-event",r)}createEventPayload(r,e){return{type:`${y(this,U)}:${r}`,payload:e,pluginId:y(this,U)}}emit(r,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",r,e);return}if(y(this,Y)&&(this.debugLog("Emitting event to internal event target",r,e),y(this,Y).dispatchEvent(new CustomEvent(`${y(this,U)}:${r}`,{detail:this.createEventPayload(r,e)}))),y(this,de)){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(r,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Oe).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(r,e))}on(r,e,i){const n=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${r}`;if(n&&(y(this,Y)||B(this,Y,new EventTarget),y(this,Y).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;n&&((a=y(this,Y))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(r){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const n=i.detail;r(n)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(r){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const n=i.detail;y(this,U)&&n.pluginId!==y(this,U)||r(n)};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,we=new WeakMap,H=new WeakMap,re=new WeakMap,X=new WeakMap,ue=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,te=new WeakMap,de=new WeakMap,Y=new WeakMap,Ce=new WeakMap,ce=new WeakMap,Oe=new WeakMap;class Ut extends Wt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new Ut;function ve(t,r){return typeof t=="function"?t(r):t}function le(t,r){return Ge(r).reduce((i,n)=>{if(i===null)return null;if(typeof i<"u")return i[n]},t)}function Fe(t,r,e){const i=Ge(r);function n(h){if(!i.length)return ve(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]:n(h[s])}):{[s]:n()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),n(h[s]),...h.slice(s+1)]}return[...new Array(s),n()]}return n(t)}function Kt(t,r){const e=Ge(r);function i(n){if(!n)return;if(e.length===1){const s=e[0];if(Array.isArray(n)&&typeof s=="number")return n.filter((o,u)=>u!==s);const{[s]:a,...d}=n;return d}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(n))&&typeof n=="object")return{...n,[h]:i(n[h])};if(typeof h=="number"&&Array.isArray(n)){if(h>=n.length)return n;const s=n.slice(0,h);return[...s.length?s:new Array(h),i(n[h]),...n.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const at=46,$e=91,We=93,ot=48,zt=57;function Ge(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const r=t.length,e=[];let i=r>0&&t.charCodeAt(0)===$e?1:0,n=!0,h=-1;for(let s=i;s<=r;s++){const a=s<r?t.charCodeAt(s):-1;if(s===r||a===at||a===$e||a===We){const d=s-i;if(d>0){const o=n&&(d===1||t.charCodeAt(i)!==ot),u=t.slice(i,s);if(o){const l=parseInt(u,10);d<=15||String(l)===u?e.push(l):e.push(u)}else e.push(u)}else h!==We&&!(h===-1&&a===We)&&!(h===a&&(a===at||a===$e))&&e.push("");i=s+1,n=!0}else(a<ot||a>zt)&&(n=!1);h=a}return e.length||e.push(""),e}function lt(t,r){return t.length===0?r:r.length===0?t:r.startsWith("[")||r.startsWith(".")?t+r:`${t}.${r}`}function qt(t){return!(Array.isArray(t)&&t.length===0)}function ye(t,r){const e=i=>i.validators.filter(Boolean).map(n=>({cause:n.cause,validate:n.fn}));return r.validationLogic({form:r.form,group:r.group,validators:r.validators,event:{type:t,fieldName:r.fieldName,async:!1},runValidation:e})}function Ve(t,r){const{asyncDebounceMs:e}=r,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:n,onDynamicAsyncDebounceMs:h}=r.validators||{},s=e??0,a=d=>d.validators.filter(Boolean).map(o=>{const u=(o==null?void 0:o.cause)||t;let l=s;switch(u){case"change":l=n??s;break;case"blur":l=i??s;break;case"dynamic":l=h??s;break;case"submit":l=0;break}return t==="submit"&&(l=0),{cause:u,validate:o.fn,debounceMs:l}});return r.validationLogic({form:r.form,group:r.group,validators:r.validators,event:{type:t,fieldName:r.fieldName,async:!0},runValidation:a})}const Be=t=>!!t&&typeof t=="object"&&"fields"in t;function Z(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[n,h]of t)if(!r.has(n)||!Object.is(h,r.get(n)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const n of t)if(!r.has(n))return!1;return!0}const e=Object.keys(t),i=Object.keys(r);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(r)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(r)!==Object.prototype))return!1;for(const n of e)if(!i.includes(n)||!Z(t[n],r[n]))return!1;return!0}const Ze=({newFormValidatorError:t,isPreviousErrorFromFormValidator:r,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:r?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},_e=({formLevelError:t,fieldLevelError:r})=>r?{newErrorValue:r,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,r){return t==null?r:{...t,...r}}let se=256;const ke=[];let Te;for(;se--;)ke[se]=(se+256).toString(16).substring(1);function Ft(){let t=0,r,e="";if(!Te||se+16>256){for(Te=new Array(256),t=256;t--;)Te[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)r=Te[se+t],t===6?e+=ke[r&15|64]:t===8?e+=ke[r&63|128]:e+=ke[r],t&1&&t>1&&t<11&&(e+="-");return se++,e}const Ht=$t(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function pe(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]=pe(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,n)=>{e.set(n,pe(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(pe(i))}),e}const r={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=pe(t[e]));return r}function ne(t,r){return r===t||r.startsWith(`${t}.`)||r.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const r=t.event.async,e=r?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:r?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},n={fn:r?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:r?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=r?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,n,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[n,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 Xt(t,r){const e=new Map;for(const i of t){const n=i.path??[];let h=r,s="";for(let a=0;a<n.length;a++){const d=n[a];if(d===void 0)continue;const o=typeof d=="object"?d.key:d,u=Number(o);Array.isArray(h)&&!Number.isNaN(u)?s+=`[${u}]`:s+=(a>0?".":"")+String(o),typeof h=="object"&&h!==null?h=h[o]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const ut=(t,r)=>{const e=Xt(t,r);return{form:e,fields:e}},ae={validate({value:t,validationSource:r},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return r==="field"?i.issues:ut(i.issues,t)},async validateAsync({value:t,validationSource:r},e){const i=await e["~standard"].validate(t);if(i.issues)return r==="field"?i.issues:ut(i.issues,t)}},Qe=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 r(l){const f=t.getFieldMeta(l)??O;t.setFieldMeta(l,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(l,f,m){r(l);const c=a(l,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(l,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(l,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);o(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(l,m))).forEach(F=>{const M=F.replace(s(l,m),s(l,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(l,f){r(l);const m=a(l,f,"remove");o(m,"up")}function n(l,f,m){r(l),a(l,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(l,f)))return;const v=g.toString().replace(s(l,f),s(l,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(l,f){r(l);const m=a(l,f,"insert");o(m,"down"),m.forEach(c=>{c.toString().startsWith(s(l,f))&&t.setFieldMeta(c,u())})}function s(l,f){return`${l}[${f}]`}function a(l,f,m,c){const g=[s(l,f)];switch(m){case"swap":g.push(s(l,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(l,F));break}default:{const v=t.getFieldValue(l),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(l,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function d(l,f){return l.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function o(l,f){(f==="up"?l:[...l].reverse()).forEach(c=>{const g=d(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,u())})}const u=()=>O;return{bumpArrayVersion:r,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:n,handleArrayInsert:h}}function Ue(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 dt{constructor(r){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{Ht(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})}),d=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),o=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),u=()=>{o(),d(),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:l}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),l&&this.validateSync("mount"),u},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const d=s.defaultValues&&!Z(s.defaultValues,a.defaultValues)&&!this.state.isTouched,o=!Z(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!d&&!o)){if(_(()=>{this.baseStore.setState(()=>Ue(Object.assign({},this.state,o?s.defaultState:{},d?{values:s.defaultValues}:{})))}),d){const u=Q(this);for(const l of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(l))&&u.bumpArrayVersion(l)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:d}=this.state,o=this.resetFieldMeta(d);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var l;let u=s??this.options.defaultValues??((l=this.options.defaultState)==null?void 0:l.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(u=Fe(u,f.instance.name,f.instance.options.defaultValue))}),Ue({...this.options.defaultState,values:u,fieldMetaBase:o})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(o=>{if(!o.instance)return;const u=o.instance;a.push(Promise.resolve().then(()=>u.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),o.instance.store.state.meta.isTouched||o.instance.setMeta(l=>({...l,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,d)=>{const o=this.getFieldValue(s),u=Array.isArray(o)?Math.max(o.length-1,0):null,l=[`${s}[${a}]`];for(let g=a+1;g<=(u??0);g++)l.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>l.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,d)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var o,u;const d=(o=this.fieldInfo[s])==null?void 0:o.instance;if(!d){const{hasErrored:l}=this.validateSync(a);return l&&!this.options.asyncAlways?((u=this.getFieldMeta(s))==null?void 0:u.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return d.store.state.meta.isTouched||d.setMeta(l=>({...l,isTouched:!0})),d.validate(a)},this.validateSync=(s,a)=>{const d=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let o=!1;const u={};return _(()=>{var m,c,g;for(const v of d){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}=je(S),V=Me(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"&&(u[b]={...u[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)&&(o=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const l=Me("submit");(c=this.state.errorMap)!=null&&c[l]&&s!=="submit"&&!o&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[l]:void 0}}));const f=Me("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!o&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:o,fieldsErrorMap:u}},this.validateAsync=async(s,a)=>{const d=Ve(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 o=[];let u;for(const m of d){if(!m.validate)continue;const c=Me(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},o.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}=je(F);V&&(u=u?{...u,...V}:V);const w=Me(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(u||{})]);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&&!(u!=null&&u[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=u==null?void 0:u[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(u?{fieldErrors:u,errorMapKey:w}:void 0)}))}let l=[];const f={};if(o.length){l=await Promise.all(o);for(const m of l)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:d,fieldsErrorMap:o}=this.validateSync(s,a);return d&&!this.options.asyncAlways?o:this.validateAsync(s,a)},this._handleSubmit=async s=>{var o,u,l,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){(u=(o=this.options).onSubmitInvalid)==null||u.call(o,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const d=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){d(),(f=(l=this.options).onSubmitInvalid)==null||f.call(l,{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){d(),(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}),d()})}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}),d(),M}},this.getFieldValue=s=>le(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(d=>({...d,fieldMetaBase:{...d.fieldMetaBase,[s]:ve(a,d.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,d)=>{const o=d;return a[o]=O,a},{}),this.setFieldValue=(s,a,d)=>{var f;const o=(d==null?void 0:d.dontUpdateMeta)??!1,u=(d==null?void 0:d.dontRunListeners)??!1,l=(d==null?void 0:d.dontValidate)??!1;_(()=>{o||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:Fe(m.values,s,a)}))}),u||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),l||this.validateField(s,"change")},this.deleteField=s=>{const d=[...Object.keys(this.fieldInfo).filter(o=>{const u=s.toString();return o.startsWith(`${u}.`)||o.startsWith(`${u}[`)}),s];this.baseStore.setState(o=>{const u={...o};return d.forEach(l=>{u.values=Kt(u.values,l),delete this.fieldInfo[l],delete u.fieldMetaBase[l]}),u})},this.pushFieldValue=(s,a,d)=>{this.setFieldValue(s,o=>[...Array.isArray(o)?o:[],a],d),Q(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,d,o)=>{this.setFieldValue(s,l=>[...l.slice(0,a),d,...l.slice(a)],$(o,{dontValidate:!0}));const u=(o==null?void 0:o.dontValidate)??!1;u||await this.validateField(s,"change"),Q(this).handleArrayInsert(s,a),u||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,d,o)=>{this.setFieldValue(s,l=>l.map((f,m)=>m===a?d:f),$(o,{dontValidate:!0})),Q(this).bumpArrayVersion(s),((o==null?void 0:o.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,d)=>{const o=this.getFieldValue(s),u=Array.isArray(o)?Math.max(o.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(d,{dontValidate:!0})),Q(this).handleArrayRemove(s,a),u!==null){const f=`${s}[${u}]`;this.deleteField(f)}((d==null?void 0:d.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,d,o)=>{this.setFieldValue(s,l=>{const f=l[a],m=l[d];return Fe(Fe(l,`${a}`,m),`${d}`,f)},$(o,{dontValidate:!0})),Q(this).handleArraySwap(s,a,d),((o==null?void 0:o.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${d}]`,"change"))},this.moveFieldValues=(s,a,d,o)=>{this.setFieldValue(s,l=>{const f=[...l];return f.splice(d,0,f.splice(a,1)[0]),f},$(o,{dontValidate:!0})),Q(this).handleArrayMove(s,a,d),((o==null?void 0:o.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${d}]`,"change"))},this.clearFieldValues=(s,a)=>{const d=this.getFieldValue(s),o=Array.isArray(d)?Math.max(d.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Q(this).bumpArrayVersion(s),o!==null)for(let l=0;l<=o;l++){const f=`${s}[${l}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var l;const d=(l=this.getFieldInfo(s).instance)==null?void 0:l.options.defaultValue,o=le(this.options.defaultValues,s),u=d??o;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:u!==void 0?Fe(a.values,s,u):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,d])=>{const o=a;if(Be(d)){const{formError:u,fieldErrors:l}=je(d);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[o]:l==null?void 0:l[f]},errorSourceMap:{...c.errorSourceMap,[o]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[o]:u}}))}else this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[o]:d}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,d])=>(Object.keys(d).length&&d.errors.length&&(s[a]={errors:d.errors,errorMap:d.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=(r==null?void 0:r.formId)??Ft(),this._devtoolsSubmissionOverride=!1;let e=Ue({...r==null?void 0:r.defaultState,values:(r==null?void 0:r.defaultValues)??((h=r==null?void 0:r.defaultState)==null?void 0:h.values)});if(r!=null&&r.transform){e=r.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!Be(a)))for(const d of Object.keys(a.fields)){const o=a.fields[d];if(o===void 0)continue;const u=e.fieldMetaBase[d];e.fieldMetaBase[d]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...u??{},errorSourceMap:{...(u==null?void 0:u.errorSourceMap)??{},onChange:"form"},errorMap:{...(u==null?void 0:u.errorMap)??{},[s]:o}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var u,l,f;const a=this.baseStore.get();let d=0;const o={};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=le(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=(u=this.getFieldInfo(m))==null?void 0:u.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!qt(F),V=!c.isDirty,w=Z(S,((f=(l=this.getFieldInfo(m))==null?void 0:l.instance)==null?void 0:f.options.defaultValue)??le(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){o[m]=v,d++;continue}o[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&d===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),o):o}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),d=this.fieldMetaDerived.get(),o={};for(const u of this.formGroupApis){const l=u.name,f=a.formGroupStateBase[l]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=d[l];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in d){if(W===l||!ne(l,W))continue;const k=d[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(d).some(([W,k])=>k&&W!==l&&ne(l,W)&&k.errorMap.onMount)),A=s==null?void 0:s[l];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 et=k.group;return et!==void 0&&W.push(et),W}return W.push(k),W},[]));const j=D.length===0,T=g&&j,I=u.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){o[l]=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}),o[l]=R}return o});let n;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),d=this.fieldMetaDerived.get(),o=Object.values(d).filter(Boolean),u=o.some(I=>I.isValidating),l=o.every(I=>I.isValid),f=o.some(I=>I.isTouched),m=o.some(I=>I.isBlurred),c=o.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=o.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||o.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!u;let V=(s==null?void 0:s.errors)??[];(!n||a.errorMap!==n.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&Be(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=l&&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&&n&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===u&&s.isFieldsValid===l&&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(n,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:u,isFieldsValid:l,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return n=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(r||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(r){return Qe(r.validate)?ae[r.type](r.value,r.validate):r.validate(r.value)}handleSubmit(r){return this._handleSubmit(r)}}function je(t){if(t){if(Be(t)){const r=je(t.form).formError,e=t.fields;return{formError:r,fieldErrors:e}}return{formError:t}}return{formError:void 0}}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"}}class Ae{constructor(r){this.options={},this.mount=()=>{var n,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=(n=this.options.listeners)==null?void 0:n.onMount)==null||h.call(n,{value:this.state.value,fieldApi:this}),()=>{var a,d,o,u;for(const[l,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[l]=null);for(const[l,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[l]=null);for(const[l,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[l]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[l,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[l]=void 0;this.form.baseStore.setState(l=>{var f,m,c;return{...l,fieldMetaBase:{...l.fieldMetaBase,[this.name]:{...O,isTouched:((f=l.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=l.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=l.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(d=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||d.call(a,{value:this.state.value,fieldApi:this}),(u=(o=this.form.options.listeners)==null?void 0:o.onFieldUnmount)==null||u.call(o,{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,n)=>{this.form.insertFieldValue(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,n)=>{this.form.replaceFieldValue(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.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,n)=>{this.form.swapFieldValues(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,n)=>{this.form.moveFieldValues(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.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),n=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ae))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&n.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&n.push(h.instance)}return n},this.validateSync=(e,i)=>{var o;const n=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((u,l)=>{const f=ye(e,{...l.options,form:l.form,fieldName:l.name,validationLogic:l.form.options.validationLogic||q});return f.forEach(m=>{m.field=l}),u.concat(f)},[]);let a=!1;_(()=>{const u=(l,f)=>{var F;const m=Se(f.cause),c=f.validate?ct(l.runValidator({validate:f.validate,value:{value:l.store.state.value,validationSource:"field",fieldApi:l},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=_e({formLevelError:g,fieldLevelError:c});((F=l.state.meta.errorMap)==null?void 0:F[m])!==v&&l.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const l of n)u(this,l);for(const l of s)l.validate&&u(l.field,l)});const d=Se("submit");return(o=this.state.meta.errorMap)!=null&&o[d]&&e!=="submit"&&!a&&this.setMeta(u=>({...u,errorMap:{...u.errorMap,[d]:void 0},errorSourceMap:{...u.errorSourceMap,[d]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const n=Ve(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=Ve(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)},[]),d=[],o=[],u=n.some(c=>c.validate),l=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{u&&this.startValidation();for(const c of l)c.startValidation()});const f=(c,g,v)=>{const S=Se(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=ct(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=_e({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 n)c.validate&&f(this,c,d);for(const c of a)c.validate&&f(c.field,c,o);let m=[];return(d.length||o.length)&&(m=await Promise.all(d),await Promise.all(o)),_(()=>{u&&this.endValidation();for(const c of l)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const n=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 n){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),d=new WeakMap;for(const c of n){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});d.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Se(e)])==null||f.lastAbortController.abort();const c=[];for(const g of n)(m=g.getInfo().validationMetaMap[Se(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const o=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),u=this.validateAsync(e,o),l=[];for(const c of n)d.get(c)&&!c.options.asyncAlways||l.push(c.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return l.length===0?u:Promise.all([u,...l]).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 n,h,s,a,d,o;const e=(n=this.form.options.listeners)==null?void 0:n.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var u,l;(l=(u=this.form.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{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 u,l;(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},i)):(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var n,h,s,a,d,o;const e=(n=this.form.options.listeners)==null?void 0:n.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var u,l;(l=(u=this.form.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{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 u,l;(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this})},i)):(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this});for(const u of this.form.formGroupApis)ne(u.name,this.name)&&u.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=r.form,this.name=r.name,this.options=r,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...r.defaultMeta};let n=this.form.getFieldValue(this.name);return!i.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!Z(n,this.options.defaultValue)&&(n=this.options.defaultValue),e&&e.value===n&&e.meta===i?e:{value:n,meta:i}})}get state(){return this.store.state}runValidator(r){return Qe(r.validate)?ae[r.type](r.value,r.validate):r.validate(r.value)}startValidation(){this.setMeta(r=>{const e=r._pendingValidationsCount+1;return{...r,_pendingValidationsCount:e,isValidating:e>0&&!r.isValidating?!0:r.isValidating}})}endValidation(){this.setMeta(r=>{const e=Math.max(0,r._pendingValidationsCount-1);return{...r,_pendingValidationsCount:e,isValidating:e===0&&r.isValidating?!1:r.isValidating}})}}function ct(t){if(t)return t}function Se(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 Ke(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Yt(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 Ee{constructor(r){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const n=i.formGroupStateBase[this.name]??Ke({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(n)}}})},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,n;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]??Ke({...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;qe(h)&&(s=h.group,a=h.fields);const d=ze(s);d&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,onMount:d},errorSourceMap:{...o.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(n=(i=this.options.listeners)==null?void 0:i.onMount)==null||n.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,d]of Object.entries(this.timeoutIds.validations))d&&(clearTimeout(d),this.timeoutIds.validations[a]=null);for(const[a,d]of Object.entries(this.timeoutIds.listeners))d&&(clearTimeout(d),this.timeoutIds.listeners[a]=null);for(const[a,d]of Object.entries(this.timeoutIds.formListeners))d&&(clearTimeout(d),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,d]of Object.entries(this.fieldInfo.validationMetaMap))d==null||d.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ke({})}})),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 n of e)n.instance&&n.instance instanceof Ae&&n.instance.name.startsWith(this.name)&&i.push(n.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[n,h]of e)n!==this.name&&ne(this.name,n)&&i.push({...h,name:n});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const n=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[d,o]of Object.entries(i))o==null||o===!1||h.add(this.buildChildFieldName(d));const s=new Set([...n,...h]);let a=!1;for(const d of s){const o=d.startsWith(this.name+"[")?d.slice(this.name.length):d.slice(this.name.length+1),u=i==null?void 0:i[o],l=this.form.getFieldMeta(d);if(!l&&!u)continue;const f=l==null?void 0:l.errorMap[e],m=(l==null?void 0:l.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Ze({newFormValidatorError:u,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(l==null?void 0:l.errorSourceMap[e])===g)&&this.form.setFieldMeta(d,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,n={})=>{var u;const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(n.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((l,f)=>{const m=ye(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),l.concat(m)},[]);let d=!1;_(()=>{const l=(f,m)=>{var L;const c=xe(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 Ee?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&qe(v)&&(S=v.group,F=v.fields);const M=ze(S),V=i[c],{newErrorValue:w,newSource:b}=_e({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&&(d=!0),g&&this.distributeFieldErrors(c,F)&&(d=!0)};for(const f of h)l(this,f);for(const f of a)f.validate&&l(f.field,f)});const o=xe("submit");return(u=this.state.meta.errorMap)!=null&&u[o]&&e!=="submit"&&!d&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,[o]:void 0},errorSourceMap:{...l.errorSourceMap,[o]:void 0}})),{hasErrored:d}},this.validateAsync=async(e,i,n={})=>{const h=Ve(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=n.skipRelatedFieldValidation?[]:this.getRelatedFields(),d=a.reduce((c,g)=>{const v=Ve(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),o=[],u=[],l=h.some(c=>c.validate)||d.some(c=>c.validate);if(l){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=xe(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 Ee?{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&&qe(L)&&(E=L.group,A=L.fields);const D=ze(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=_e({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,o);for(const c of d)c.validate&&f(c.field,c,u);let m=[];if((o.length||u.length)&&(m=await Promise.all(o),await Promise.all(u)),l){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,n)=>this.form.validateArrayFieldsStartingFrom(e,i,n),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,n)=>this.form.insertFieldValue(e,i,n),this.replaceFieldValue=(e,i,n)=>this.form.replaceFieldValue(e,i,n),this.swapFieldValues=(e,i,n)=>this.form.swapFieldValues(e,i,n),this.moveFieldValues=(e,i,n)=>this.form.moveFieldValues(e,i,n),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:n}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:d=>ne(this.name,d)}),{hasErrored:h}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[xe(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:d=>ne(this.name,d)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var n,h,s,a,d,o;const e=(n=this.form.options.listeners)==null?void 0:n.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var u,l;(l=(u=this.form.options.listeners)==null?void 0:u.onChangeGroup)==null||l.call(u,{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 u,l;(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},i)):(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{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,d,o,u,l,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 n=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){n(),(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){n(),(d=(a=this.options).onGroupSubmitInvalid)==null||d.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})})}),(u=(o=this.options.listeners)==null?void 0:o.onSubmit)==null||u.call(o,{groupApi:this,value:this.state.value});try{await((f=(l=this.options).onGroupSubmit)==null?void 0:f.call(l,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),n(),m}},this.form=r.form,this.name=r.name,this.options=r,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)??Yt(r.defaultMeta);let n=this.form.getFieldValue(this.name);return!i.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!Z(n,this.options.defaultValue)&&(n=this.options.defaultValue),e&&e.value===n&&e.meta===i?e:{value:n,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(r){if(Qe(r.validate)){const e=ae[r.type](r.value,r.validate);return r.type==="validate"?ht(e):e.then(ht)}return r.validate(r.value)}handleSubmit(r){return this._handleSubmit(r)}}function ze(t){if(t)return t}function qe(t){return!!t&&typeof t=="object"&&"fields"in t}function ht(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:r,fields:e,...i}=t;return{...i,group:r,fields:e}}function xe(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 Re{constructor(r){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return lt(this.fieldsMap,e);const i=Ge(e)[0];if(typeof i!="string")return"";const n=e.slice(i.length),h=this.fieldsMap[i];return lt(h,n)},this.getFormFieldOptions=e=>{const i={...e},n=i.validators;if(i.name=this.getFormFieldName(e.name),n&&(n.onChangeListenTo||n.onBlurListenTo)){const h={...n},s=a=>{if(a)return a.map(d=>this.getFormFieldName(d))};h.onChangeListenTo=s(n.onChangeListenTo),h.onBlurListenTo=s(n.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,n)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,n),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,n)=>this.form.setFieldValue(this.getFormFieldName(e),i,n),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,n)=>this.form.pushFieldValue(this.getFormFieldName(e),i,n),this.insertFieldValue=async(e,i,n,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,n,h),this.replaceFieldValue=async(e,i,n,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,n,h),this.removeFieldValue=async(e,i,n)=>this.form.removeFieldValue(this.getFormFieldName(e),i,n),this.swapFieldValues=(e,i,n,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,n,h),this.moveFieldValues=(e,i,n,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,n,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),r.form instanceof Re){const e=r.form;if(this.form=e.form,typeof r.fields=="string")this.fieldsMap=e.getFormFieldName(r.fields);else{const i={...r.fields};for(const n in i)i[n]=e.getFormFieldName(i[n]);this.fieldsMap=i}}else this.form=r.form,this.fieldsMap=r.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=le(e.values,this.fieldsMap);else{i={};const n=this.fieldsMap;for(const h in n)i[h]=le(e.values,n[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(r){return this.form.handleSubmit(r)}}function Zt(t,r){if(!r)return;const e=Object.assign({},t,{state:pe(t.state)});r(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const n=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(n).length&&t.baseStore.setState(h=>({...h,...n})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Jt(t,r){return t===r}function x(t,r=i=>i,e){const i=(e==null?void 0:e.compare)??Jt,n=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return yt.useSyncExternalStoreWithSelector(n,h,h,r,i)}const J=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Qt(t){const[r,e]=C.useState(()=>({form:t.form,name:t.name})),[i,n]=C.useState(()=>new Ae({...t}));let h=i;(r.form!==t.form||r.name!==t.name)&&(h=new Ae({...t}),n(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),d=x(h.store,c=>c.meta.isBlurred),o=x(h.store,c=>c.meta.isDirty),u=x(h.store,c=>c.meta.errorMap),l=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:d,isDirty:o,errorMap:u,errorSourceMap:l,isValidating:f}}}}}),[h,t.mode,s,a,d,o,u,l,f]);return J(h.mount,[h]),J(()=>{h.update(t)}),m}const ei=(({children:t,...r})=>{const e=Qt(r),i=C.useMemo(()=>ve(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ti(){return C.useState(()=>Ft())[0]}const ii=Vt,si=C.version.split(".")[0]==="17"?ti:ii.useId;function ri(t){const[r,e]=C.useState(()=>({form:t.form,name:t.name})),[i,n]=C.useState(()=>new Ee({...t}));(r.form!==t.form||r.name!==t.name)&&(n(new Ee({...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),d=x(i.store,b=>b.meta.isDirty),o=x(i.store,b=>b.meta.errorMap),u=x(i.store,b=>b.meta.errorSourceMap),l=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:d,errorMap:o,errorSourceMap:u,isValidating:l,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,d,o,u,l,f,m,c,g,v,S,F,M,V]);return J(i.mount,[i]),J(()=>{i.update(t)}),w}const ni=(({children:t,...r})=>{const e=ri(r),i=C.useMemo(()=>ve(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ai({form:t,selector:r=i=>i,children:e}){const i=x(t.store,r);return p.jsx(p.Fragment,{children:ve(e,i)})}function oi(t){const r=si(),[e,i]=C.useState(t==null?void 0:t.formId),[n,h]=C.useState(()=>new dt({...t,formId:(t==null?void 0:t.formId)??r}));if(e!==(t==null?void 0:t.formId)){const d=(t==null?void 0:t.formId)??r;h(new dt({...t,formId:d})),i(d)}const s=C.useMemo(()=>{const d={...n,handleSubmit:((...o)=>n._handleSubmit(...o)),get formId(){return n._formId},get state(){return n.store.state}};return d.Field=function(u){return p.jsx(ei,{...u,form:n})},d.FormGroup=function(u){return p.jsx(ni,{...u,form:n})},d.Subscribe=function(u){return p.jsx(ai,{form:n,selector:u.selector,children:u.children})},d},[n]);J(n.mount,[]),J(()=>{n.update(t)});const a=C.useRef(!1);return J(()=>{a.current&&t!=null&&t.transform&&Zt(n,t.transform)},[n,t==null?void 0:t.transform]),J(()=>{a.current=!0}),s}function li({lens:t,selector:r=i=>i,children:e}){const i=x(t.store,r);return p.jsx(p.Fragment,{children:ve(e,i)})}function ui(t){const[r]=C.useState(()=>{const e=new Re(t),i=t.form instanceof Re?t.form.form:t.form,n=e;return n.AppForm=function(s){return p.jsx(i.AppForm,{...s})},n.AppField=function(s){return p.jsx(i.AppField,{...r.getFormFieldOptions(s)})},n.Field=function(s){return p.jsx(i.Field,{...r.getFormFieldOptions(s)})},n.Subscribe=function(s){return p.jsx(li,{lens:r,selector:s.selector,children:s.children})},Object.assign(n,{...t.formComponents})});return J(r.mount,[r]),r}const ft=C.createContext(null),Mt=C.createContext(null);function St(){const t=C.useContext(Mt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function di(){function t(){const r=C.useContext(ft);if(!r)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return r}return{fieldContext:ft,useFieldContext:t,useFormContext:St,formContext:Mt}}function pt({fieldComponents:t,fieldContext:r,formContext:e,formComponents:i}){function n(o){const u=oi(o),l=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:u,children:c}),[u]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(u.Field,{...v,children:S=>p.jsx(r.Provider,{value:S,children:g(Object.assign(S,t))})})),[u]);return C.useMemo(()=>Object.assign(u,{AppField:f,AppForm:l,...i}),[u,f,l])}function h({render:o,props:u}){return function(f){return o({...u,...f})}}function s({render:o,props:u,defaultValues:l}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:l,formComponents:i}),[m.form,m.fields]),g=ui(c);return o({...u,...m,group:g})}}function a(o){return St()}function d(o){return pt({fieldContext:r,formContext:e,fieldComponents:{...t,...o.fieldComponents},formComponents:{...i,...o.formComponents}})}return{useAppForm:n,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:d}}const{fieldContext:ci,formContext:hi,useFieldContext:oe,useFormContext:fi}=di();function be(t){const r=oe(),{isBlurred:e,errors:i}=r.state.meta,h=e||r.form.state.submissionAttempts>0?i.map(o=>({message:String(o)})):[],s=h.length>0,a=`${r.name}-help`,d=`${r.name}-error`;return{fieldErrors:h,helpId:a,errorId:d,controlProps:{"aria-invalid":s||void 0,"aria-describedby":s?d:t?a:void 0}}}function mi({label:t,placeholder:r,type:e="text",description:i}){const n=oe(),{fieldErrors:h,helpId:s,errorId:a,controlProps:d}=be(!!i);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:n.name,children:t}),p.jsx(At,{id:n.name,type:e,value:n.state.value,placeholder:r,onBlur:n.handleBlur,onChange:o=>n.handleChange(o.target.value),...d}),i&&p.jsx(me,{id:s,children:i}),p.jsx(ge,{id:a,errors:h})]})}function gi({label:t,placeholder:r,description:e,rows:i}){const n=oe(),{fieldErrors:h,helpId:s,errorId:a,controlProps:d}=be(!!e);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:n.name,children:t}),p.jsx(Et,{id:n.name,value:n.state.value,placeholder:r,rows:i,onBlur:n.handleBlur,onChange:o=>n.handleChange(o.target.value),...d}),e&&p.jsx(me,{id:s,children:e}),p.jsx(ge,{id:a,errors:h})]})}function vi({label:t,options:r,placeholder:e,description:i}){const n=oe(),{fieldErrors:h,helpId:s,errorId:a,controlProps:d}=be(!!i);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:n.name,children:t}),p.jsxs(wt,{value:n.state.value,onValueChange:o=>n.handleChange(o),onOpenChange:o=>{o||n.handleBlur()},children:[p.jsx(It,{id:n.name,...d,children:p.jsx(Ct,{placeholder:e})}),p.jsx(Lt,{children:r.map(o=>p.jsx(Tt,{value:o.value,children:o.label},o.value))})]}),i&&p.jsx(me,{id:s,children:i}),p.jsx(ge,{id:a,errors:h})]})}function bi({label:t,description:r}){const e=oe(),{fieldErrors:i,helpId:n,errorId:h,controlProps:s}=be(!!r);return p.jsxs(he,{orientation:"horizontal",className:"justify-between gap-4 max-md:min-h-11 max-md:gap-4",children:[p.jsxs(mt,{children:[p.jsx(fe,{htmlFor:e.name,children:t}),r&&p.jsx(me,{id:n,children:r}),p.jsx(ge,{id:h,errors:i})]}),p.jsx(xt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:a=>e.handleChange(a),...s})]})}function Fi({label:t,description:r}){const e=oe(),{fieldErrors:i,helpId:n,errorId:h,controlProps:s}=be(!!r);return p.jsxs(he,{orientation:"horizontal",className:"max-md:min-h-11",children:[p.jsx(Dt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:a=>e.handleChange(a===!0),...s}),p.jsxs(mt,{children:[p.jsx(fe,{htmlFor:e.name,className:"font-normal",children:t}),r&&p.jsx(me,{id:n,children:r}),p.jsx(ge,{id:h,errors:i})]})]})}function Mi({label:t,placeholder:r,description:e}){const i=oe(),{fieldErrors:n,helpId:h,errorId:s,controlProps:a}=be(!!e);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:i.name,children:t}),p.jsx(Bt,{id:i.name,value:i.state.value,placeholder:r,onBlur:i.handleBlur,onChange:d=>i.handleChange(d.target.value),...a}),e&&p.jsx(me,{id:h,children:e}),p.jsx(ge,{id:s,errors:n})]})}function Si({label:t,pendingLabel:r="Saving…"}){const e=fi();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:n})=>p.jsx(kt,{type:"submit",disabled:!i||n,children:n?r:t})})}const{useAppForm:Vi}=pt({fieldContext:ci,formContext:hi,fieldComponents:{TextField:mi,TextareaField:gi,SelectField:vi,SwitchField:bi,CheckboxField:Fi,PasswordField:Mi},formComponents:{SubmitButton:Si}});export{x as a,Vi as u};
1
+ var tt=t=>{throw TypeError(t)};var it=(t,r,e)=>r.has(t)||tt("Cannot "+e);var y=(t,r,e)=>(it(t,r,"read from private field"),e?e.call(t):r.get(t)),N=(t,r,e)=>r.has(t)?tt("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(t):r.set(t,e),B=(t,r,e,i)=>(it(t,r,"write to private field"),i?i.call(t,e):r.set(t,e),e);var st=(t,r,e,i)=>({set _(n){B(t,r,n,e)},get _(){return y(t,r,i)}});import{r as C,mE as yt,j as p,mF as Vt,dD as he,dE as fe,I as At,h6 as me,i7 as ge,dC as Et,ew as wt,ex as It,ey as Ct,ez as Lt,eA as Tt,i6 as mt,a3 as xt,h0 as Dt,eM as Bt,B as kt}from"./index-BR1m9FON.js";function jt({update:t,notify:r,unwatched:e}){return{link:i,unlink:n,propagate:h,checkDirty:s,shallowPropagate:a};function i(o,u,l){const f=u.depsTail;if(f!==void 0&&f.dep===o)return;const m=f!==void 0?f.nextDep:u.deps;if(m!==void 0&&m.dep===o){m.version=l,u.depsTail=m;return}const c=o.subsTail;if(c!==void 0&&c.version===l&&c.sub===u)return;const g=u.depsTail=o.subsTail={version:l,dep:o,sub:u,prevDep:f,nextDep:m,prevSub:c,nextSub:void 0};m!==void 0&&(m.prevDep=g),f!==void 0?f.nextDep=g:u.deps=g,c!==void 0?c.nextSub=g:o.subs=g}function n(o,u=o.sub){const l=o.dep,f=o.prevDep,m=o.nextDep,c=o.nextSub,g=o.prevSub;return m!==void 0?m.prevDep=f:u.depsTail=f,f!==void 0?f.nextDep=m:u.deps=m,c!==void 0?c.prevSub=g:l.subsTail=g,g!==void 0?g.nextSub=c:(l.subs=c)===void 0&&e(l),m}function h(o){let u=o.nextSub,l;e:do{const f=o.sub;let m=f.flags;if(m&60?m&12?m&4?!(m&48)&&d(o,f)?(f.flags=m|40,m&=1):m=0:f.flags=m&-9|32:m=0:f.flags=m|32,m&2&&r(f),m&1){const c=f.subs;if(c!==void 0){const g=(o=c).nextSub;g!==void 0&&(l={value:u,prev:l},u=g);continue}}if((o=u)!==void 0){u=o.nextSub;continue}for(;l!==void 0;)if(o=l.value,l=l.prev,o!==void 0){u=o.nextSub;continue e}break}while(!0)}function s(o,u){let l,f=0,m=!1;e:do{const c=o.dep,g=c.flags;if(u.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){(o.nextSub!==void 0||o.prevSub!==void 0)&&(l={value:o,prev:l}),o=c.deps,u=c,++f;continue}if(!m){const v=o.nextDep;if(v!==void 0){o=v;continue}}for(;f--;){const v=u.subs,S=v.nextSub!==void 0;if(S?(o=l.value,l=l.prev):o=v,m){if(t(u)){S&&a(v),u=o.sub;continue}m=!1}else u.flags&=-33;u=o.sub;const F=o.nextDep;if(F!==void 0){o=F;continue e}}return m}while(!0)}function a(o){do{const u=o.sub,l=u.flags;(l&48)===32&&(u.flags=l|16,(l&6)===2&&r(u))}while((o=o.nextSub)!==void 0)}function d(o,u){let l=u.depsTail;for(;l!==void 0;){if(l===o)return!0;l=l.prevDep}return!1}}function Qe(t,r,e){var h,s,a;const i=typeof t=="object",n=i?t:void 0;return{next:(h=i?t.next:t)==null?void 0:h.bind(n),error:(s=i?t.error:r)==null?void 0:s.bind(n),complete:(a=i?t.complete:e)==null?void 0:a.bind(n)}}const He=[];let De=0;const{link:rt,unlink:Pt,propagate:_t,checkDirty:gt,shallowPropagate:nt}=jt({update(t){return t._update()},notify(t){He[Xe++]=t,t.flags&=-3},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=17,Pe(t))}});let Le=0,Xe=0,z,Ze=0;function _(t){try{++Ze,t()}finally{--Ze||vt()}}function Pe(t){const r=t.depsTail;let e=r!==void 0?r.nextDep:t.deps;for(;e!==void 0;)e=Pt(e,t)}function vt(){if(!(Ze>0)){for(;Le<Xe;){const t=He[Le];He[Le++]=void 0,t.notify()}Le=0,Xe=0}}function bt(t,r){const e=typeof t=="function",i=t,n={_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&&rt(n,z,De),n._snapshot},subscribe(h){const s=Qe(h),a={current:!1},d=Rt(()=>{var o;n.get(),a.current?(o=s.next)==null||o.call(s,n._snapshot):a.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(h){const s=z,a=Object.is;if(e)z=n,++De,n.depsTail=void 0;else if(h===void 0)return!1;e&&(n.flags=5);try{const d=n._snapshot,o=typeof h=="function"?h(d):h===void 0&&e?i(d):h;return d===void 0||!a(d,o)?(n._snapshot=o,!0):!1}finally{z=s,e&&(n.flags&=-5),Pe(n)}}};return e?(n.flags=17,n.get=function(){const h=n.flags;if(h&16||h&32&&gt(n.deps,n)){if(n._update()){const s=n.subs;s!==void 0&&nt(s)}}else h&32&&(n.flags=h&-33);return z!==void 0&&rt(n,z,De),n._snapshot}):n.set=function(h){if(n._update(h)){const s=n.subs;s!==void 0&&(_t(s),nt(s),vt())}},n}function Rt(t){const r=()=>{const i=z;z=e,++De,e.depsTail=void 0,e.flags=6;try{return t()}finally{z=i,e.flags&=-5,Pe(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&&gt(this.deps,this)?r():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Pe(this)}};return r(),e}var Nt=class{constructor(t,r){this.atom=bt(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),r&&(this.actions=r(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Qe(t))}},Ot=class{constructor(t){this.atom=bt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Qe(t))}};function ie(t,r){return typeof t=="function"?new Ot(t):new Nt(t)}var Gt=class{constructor(t,r){this.fn=t,this.options=r,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 n=this.options.wait-i;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},n)}},this.execute=(...e)=>{var i,n;this.fn(...e),(n=(i=this.options).onExecute)==null||n.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 $t(t,r){return new Gt(t,r).maybeExecute}var ee,U,G,we,H,re,X,ue,Ie,Ne,te,de,Z,Ce,ce,Oe;class Wt{constructor({pluginId:r,debug:e=!1,enabled:i=!0,reconnectEveryMs:n=300}){N(this,ee,!0);N(this,U);N(this,G);N(this,we);N(this,H);N(this,re);N(this,X);N(this,ue);N(this,Ie,0);N(this,Ne,5);N(this,te,!1);N(this,de,!1);N(this,Z,null);N(this,Ce,()=>{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(r=>this.emitEventToBus(r)),B(this,H,[]),this.stopConnectLoop(),y(this,G).call(this).removeEventListener("tanstack-connect-success",y(this,Ce))});N(this,ce,()=>{if(y(this,Ie)<y(this,Ne)){st(this,Ie)._++,this.dispatchCustomEvent("tanstack-connect",{});return}y(this,G).call(this).removeEventListener("tanstack-connect",y(this,ce)),B(this,de,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});N(this,Oe,()=>{y(this,te)||(B(this,te,!0),y(this,G).call(this).addEventListener("tanstack-connect-success",y(this,Ce)),y(this,ce).call(this))});B(this,U,r),B(this,ee,i),B(this,G,this.getGlobalTarget),B(this,we,e),this.debugLog(" Initializing event subscription for plugin",y(this,U)),B(this,H,[]),B(this,re,!1),B(this,de,!1),B(this,X,null),B(this,ue,n)}startConnectLoop(){y(this,X)!==null||y(this,re)||(this.debugLog(`Starting connect loop (every ${y(this,ue)}ms)`),B(this,X,setInterval(y(this,ce),y(this,ue))))}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(...r){y(this,we)&&console.log(`🌴 [tanstack-devtools:${y(this,U)}-plugin]`,...r)}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 r=typeof EventTarget<"u"?new EventTarget:void 0;return typeof r>"u"||typeof r.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),r)}getPluginId(){return y(this,U)}dispatchCustomEventShim(r,e){try{const i=new Event(r,{detail:e});y(this,G).call(this).dispatchEvent(i)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(r,e){try{y(this,G).call(this).dispatchEvent(new CustomEvent(r,{detail:e}))}catch{this.dispatchCustomEventShim(r,e)}}emitEventToBus(r){this.debugLog("Emitting event to client bus",r),this.dispatchCustomEvent("tanstack-dispatch-event",r)}createEventPayload(r,e){return{type:`${y(this,U)}:${r}`,payload:e,pluginId:y(this,U)}}emit(r,e){if(!y(this,ee)){this.debugLog("Event bus client is disabled, not emitting event",r,e);return}if(y(this,Z)&&(this.debugLog("Emitting event to internal event target",r,e),y(this,Z).dispatchEvent(new CustomEvent(`${y(this,U)}:${r}`,{detail:this.createEventPayload(r,e)}))),y(this,de)){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(r,e)),typeof CustomEvent<"u"&&!y(this,te)&&(y(this,Oe).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(r,e))}on(r,e,i){const n=(i==null?void 0:i.withEventTarget)??!1,h=`${y(this,U)}:${r}`;if(n&&(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;n&&((a=y(this,Z))==null||a.removeEventListener(h,s)),y(this,G).call(this).removeEventListener(h,s)}}onAll(r){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const n=i.detail;r(n)};return y(this,G).call(this).addEventListener("tanstack-devtools-global",e),()=>y(this,G).call(this).removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(r){if(!y(this,ee))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=i=>{const n=i.detail;y(this,U)&&n.pluginId!==y(this,U)||r(n)};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,we=new WeakMap,H=new WeakMap,re=new WeakMap,X=new WeakMap,ue=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,te=new WeakMap,de=new WeakMap,Z=new WeakMap,Ce=new WeakMap,ce=new WeakMap,Oe=new WeakMap;class Ut extends Wt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const K=new Ut;function ve(t,r){return typeof t=="function"?t(r):t}function le(t,r){return Ge(r).reduce((i,n)=>{if(i===null)return null;if(typeof i<"u")return i[n]},t)}function Fe(t,r,e){const i=Ge(r);function n(h){if(!i.length)return ve(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]:n(h[s])}):{[s]:n()};if(Array.isArray(h)&&typeof s=="number"){const a=h.slice(0,s);return[...a.length?a:new Array(s),n(h[s]),...h.slice(s+1)]}return[...new Array(s),n()]}return n(t)}function Kt(t,r){const e=Ge(r);function i(n){if(!n)return;if(e.length===1){const s=e[0];if(Array.isArray(n)&&typeof s=="number")return n.filter((o,u)=>u!==s);const{[s]:a,...d}=n;return d}const h=e.shift();if((typeof h=="string"||typeof h=="number"&&!Array.isArray(n))&&typeof n=="object")return{...n,[h]:i(n[h])};if(typeof h=="number"&&Array.isArray(n)){if(h>=n.length)return n;const s=n.slice(0,h);return[...s.length?s:new Array(h),i(n[h]),...n.slice(h+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return i(t)}const at=46,$e=91,We=93,ot=48,zt=57;function Ge(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const r=t.length,e=[];let i=r>0&&t.charCodeAt(0)===$e?1:0,n=!0,h=-1;for(let s=i;s<=r;s++){const a=s<r?t.charCodeAt(s):-1;if(s===r||a===at||a===$e||a===We){const d=s-i;if(d>0){const o=n&&(d===1||t.charCodeAt(i)!==ot),u=t.slice(i,s);if(o){const l=parseInt(u,10);d<=15||String(l)===u?e.push(l):e.push(u)}else e.push(u)}else h!==We&&!(h===-1&&a===We)&&!(h===a&&(a===at||a===$e))&&e.push("");i=s+1,n=!0}else(a<ot||a>zt)&&(n=!1);h=a}return e.length||e.push(""),e}function lt(t,r){return t.length===0?r:r.length===0?t:r.startsWith("[")||r.startsWith(".")?t+r:`${t}.${r}`}function qt(t){return!(Array.isArray(t)&&t.length===0)}function ye(t,r){const e=i=>i.validators.filter(Boolean).map(n=>({cause:n.cause,validate:n.fn}));return r.validationLogic({form:r.form,group:r.group,validators:r.validators,event:{type:t,fieldName:r.fieldName,async:!1},runValidation:e})}function Ve(t,r){const{asyncDebounceMs:e}=r,{onBlurAsyncDebounceMs:i,onChangeAsyncDebounceMs:n,onDynamicAsyncDebounceMs:h}=r.validators||{},s=e??0,a=d=>d.validators.filter(Boolean).map(o=>{const u=(o==null?void 0:o.cause)||t;let l=s;switch(u){case"change":l=n??s;break;case"blur":l=i??s;break;case"dynamic":l=h??s;break;case"submit":l=0;break}return t==="submit"&&(l=0),{cause:u,validate:o.fn,debounceMs:l}});return r.validationLogic({form:r.form,group:r.group,validators:r.validators,event:{type:t,fieldName:r.fieldName,async:!0},runValidation:a})}const Be=t=>!!t&&typeof t=="object"&&"fields"in t;function J(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[n,h]of t)if(!r.has(n)||!Object.is(h,r.get(n)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const n of t)if(!r.has(n))return!1;return!0}const e=Object.keys(t),i=Object.keys(r);if(e.length!==i.length||e.length===0&&!Array.isArray(t)&&!Array.isArray(r)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(r)!==Object.prototype))return!1;for(const n of e)if(!i.includes(n)||!J(t[n],r[n]))return!1;return!0}const Je=({newFormValidatorError:t,isPreviousErrorFromFormValidator:r,previousErrorValue:e})=>t?{newErrorValue:t,newSource:"form"}:r?{newErrorValue:void 0,newSource:void 0}:e?{newErrorValue:e,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},_e=({formLevelError:t,fieldLevelError:r})=>r?{newErrorValue:r,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function $(t,r){return t==null?r:{...t,...r}}let se=256;const ke=[];let Te;for(;se--;)ke[se]=(se+256).toString(16).substring(1);function Ft(){let t=0,r,e="";if(!Te||se+16>256){for(Te=new Array(256),t=256;t--;)Te[t]=256*Math.random()|0;t=0,se=0}for(;t<16;t++)r=Te[se+t],t===6?e+=ke[r&15|64]:t===8?e+=ke[r&63|128]:e+=ke[r],t&1&&t>1&&t<11&&(e+="-");return se++,e}const Ht=$t(t=>K.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function pe(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]=pe(t[i]);return e}if(t instanceof Map){const e=new Map;return t.forEach((i,n)=>{e.set(n,pe(i))}),e}if(t instanceof Set){const e=new Set;return t.forEach(i=>{e.add(pe(i))}),e}const r={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=pe(t[e]));return r}function ne(t,r){return r===t||r.startsWith(`${t}.`)||r.startsWith(`${t}[`)}const q=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const r=t.event.async,e=r?void 0:{fn:t.validators.onMount,cause:"mount"},i={fn:r?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},n={fn:r?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},h={fn:r?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=r?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,n,h,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[n,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 Xt(t,r){const e=new Map;for(const i of t){const n=i.path??[];let h=r,s="";for(let a=0;a<n.length;a++){const d=n[a];if(d===void 0)continue;const o=typeof d=="object"?d.key:d,u=Number(o);Array.isArray(h)&&!Number.isNaN(u)?s+=`[${u}]`:s+=(a>0?".":"")+String(o),typeof h=="object"&&h!==null?h=h[o]:h=void 0}e.set(s,(e.get(s)??[]).concat(i))}return Object.fromEntries(e)}const ut=(t,r)=>{const e=Xt(t,r);return{form:e,fields:e}},ae={validate({value:t,validationSource:r},e){const i=e["~standard"].validate(t);if(i instanceof Promise)throw new Error("async function passed to sync validator");if(i.issues)return r==="field"?i.issues:ut(i.issues,t)},async validateAsync({value:t,validationSource:r},e){const i=await e["~standard"].validate(t);if(i.issues)return r==="field"?i.issues:ut(i.issues,t)}},Ye=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 r(l){const f=t.getFieldMeta(l)??O;t.setFieldMeta(l,{...f,_arrayVersion:(f._arrayVersion||0)+1})}function e(l,f,m){r(l);const c=a(l,f,"move",m),g=Math.min(f,m),v=Math.max(f,m);for(let F=g;F<=v;F++)c.push(s(l,F));const S=Object.keys(t.fieldInfo).reduce((F,M)=>(M.startsWith(s(l,f))&&F.set(M,t.getFieldMeta(M)),F),new Map);o(c,f<m?"up":"down"),Object.keys(t.fieldInfo).filter(F=>F.startsWith(s(l,m))).forEach(F=>{const M=F.replace(s(l,m),s(l,f)),V=S.get(M);V&&t.setFieldMeta(F,V)})}function i(l,f){r(l);const m=a(l,f,"remove");o(m,"up")}function n(l,f,m){r(l),a(l,f,"swap",m).forEach(g=>{if(!g.toString().startsWith(s(l,f)))return;const v=g.toString().replace(s(l,f),s(l,m)),[S,F]=[t.getFieldMeta(g),t.getFieldMeta(v)];S&&t.setFieldMeta(v,S),F&&t.setFieldMeta(g,F)})}function h(l,f){r(l);const m=a(l,f,"insert");o(m,"down"),m.forEach(c=>{c.toString().startsWith(s(l,f))&&t.setFieldMeta(c,u())})}function s(l,f){return`${l}[${f}]`}function a(l,f,m,c){const g=[s(l,f)];switch(m){case"swap":g.push(s(l,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(l,F));break}default:{const v=t.getFieldValue(l),S=Array.isArray(v)?v.length:0;for(let F=f+1;F<S;F++)g.push(s(l,F));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(S=>v.startsWith(S)))}function d(l,f){return l.replace(/\[(\d+)\]/,(m,c)=>{const g=parseInt(c,10);return`[${f==="up"?g+1:Math.max(0,g-1)}]`})}function o(l,f){(f==="up"?l:[...l].reverse()).forEach(c=>{const g=d(c.toString(),f),v=t.getFieldMeta(g);v?t.setFieldMeta(c,v):t.setFieldMeta(c,u())})}const u=()=>O;return{bumpArrayVersion:r,handleArrayMove:e,handleArrayRemove:i,handleArraySwap:n,handleArrayInsert:h}}function Ue(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 dt{constructor(r){var h;this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{var f,m;const s=this.store.subscribe(()=>{Ht(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})}),d=K.on("request-form-reset",c=>{c.payload.id===this._formId&&this.reset()}),o=K.on("request-form-force-submit",c=>{c.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),u=()=>{o(),d(),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:l}=this.options.validators||{};return K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),l&&this.validateSync("mount"),u},this.update=s=>{if(!s)return;const a=this.options;this.options=s;const d=s.defaultValues&&!J(s.defaultValues,a.defaultValues)&&!this.state.isTouched,o=!J(s.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!d&&!o)){if(_(()=>{this.baseStore.setState(()=>Ue(Object.assign({},this.state,o?s.defaultState:{},d?{values:s.defaultValues}:{})))}),d){const u=Y(this);for(const l of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(l))&&u.bumpArrayVersion(l)}K.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(s,a)=>{const{fieldMeta:d}=this.state,o=this.resetFieldMeta(d);s&&!(a!=null&&a.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var l;let u=s??this.options.defaultValues??((l=this.options.defaultState)==null?void 0:l.values);return s||Object.values(this.fieldInfo).forEach(f=>{f.instance&&f.instance.options.defaultValue!==void 0&&(u=Fe(u,f.instance.name,f.instance.options.defaultValue))}),Ue({...this.options.defaultState,values:u,fieldMetaBase:o})})},this.validateAllFields=async s=>{const a=[];return _(()=>{Object.values(this.fieldInfo).forEach(o=>{if(!o.instance)return;const u=o.instance;a.push(Promise.resolve().then(()=>u.validate(s,{skipFormValidation:!0,skipGroupValidation:!0}))),o.instance.store.state.meta.isTouched||o.instance.setMeta(l=>({...l,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(s,a,d)=>{const o=this.getFieldValue(s),u=Array.isArray(o)?Math.max(o.length-1,0):null,l=[`${s}[${a}]`];for(let g=a+1;g<=(u??0);g++)l.push(`${s}[${g}]`);const f=Object.keys(this.fieldInfo).filter(g=>l.some(v=>g.startsWith(v))),m=[];return _(()=>{f.forEach(g=>{m.push(Promise.resolve().then(()=>this.validateField(g,d)))})}),(await Promise.all(m)).flat()},this.validateField=(s,a)=>{var o,u;const d=(o=this.fieldInfo[s])==null?void 0:o.instance;if(!d){const{hasErrored:l}=this.validateSync(a);return l&&!this.options.asyncAlways?((u=this.getFieldMeta(s))==null?void 0:u.errors)??[]:this.validateAsync(a).then(()=>{var f;return((f=this.getFieldMeta(s))==null?void 0:f.errors)??[]})}return d.store.state.meta.isTouched||d.setMeta(l=>({...l,isTouched:!0})),d.validate(a)},this.validateSync=(s,a)=>{const d=ye(s,{...this.options,form:this,group:a==null?void 0:a.group,validationLogic:this.options.validationLogic||q});let o=!1;const u={};return _(()=>{var m,c,g;for(const v of d){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}=je(S),V=Me(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}=Je({newFormValidatorError:D,isPreviousErrorFromFormValidator:(A==null?void 0:A[V])==="form",previousErrorValue:E==null?void 0:E[V]});T==="form"&&(u[b]={...u[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)&&(o=!0)}if(a!=null&&a.dontUpdateFormErrorMap)return;const l=Me("submit");(c=this.state.errorMap)!=null&&c[l]&&s!=="submit"&&!o&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[l]:void 0}}));const f=Me("server");(g=this.state.errorMap)!=null&&g[f]&&s!=="server"&&!o&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[f]:void 0}}))}),{hasErrored:o,fieldsErrorMap:u}},this.validateAsync=async(s,a)=>{const d=Ve(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 o=[];let u;for(const m of d){if(!m.validate)continue;const c=Me(m.cause),g=this.state.validationMetaMap[c];g==null||g.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[c]={lastAbortController:v},o.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}=je(F);V&&(u=u?{...u,...V}:V);const w=Me(m.cause),b=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(u||{})]);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&&!(u!=null&&u[E]))continue;const A=this.getFieldMeta(E)??O,{errorMap:D,errorSourceMap:j}=A,T=u==null?void 0:u[E],{newErrorValue:I,newSource:P}=Je({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(u?{fieldErrors:u,errorMapKey:w}:void 0)}))}let l=[];const f={};if(o.length){l=await Promise.all(o);for(const m of l)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:d,fieldsErrorMap:o}=this.validateSync(s,a);return d&&!this.options.asyncAlways?o:this.validateAsync(s,a)},this._handleSubmit=async s=>{var o,u,l,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){(u=(o=this.options).onSubmitInvalid)==null||u.call(o,{value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(M=>({...M,isSubmitting:!0}));const d=()=>{this.baseStore.setState(M=>({...M,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){d(),(f=(l=this.options).onSubmitInvalid)==null||f.call(l,{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){d(),(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}),d()})}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}),d(),M}},this.getFieldValue=s=>le(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(d=>({...d,fieldMetaBase:{...d.fieldMetaBase,[s]:ve(a,d.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((a,d)=>{const o=d;return a[o]=O,a},{}),this.setFieldValue=(s,a,d)=>{var f;const o=(d==null?void 0:d.dontUpdateMeta)??!1,u=(d==null?void 0:d.dontRunListeners)??!1,l=(d==null?void 0:d.dontValidate)??!1;_(()=>{o||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:Fe(m.values,s,a)}))}),u||(f=this.getFieldInfo(s).instance)==null||f.triggerOnChangeListener(),l||this.validateField(s,"change")},this.deleteField=s=>{const d=[...Object.keys(this.fieldInfo).filter(o=>{const u=s.toString();return o.startsWith(`${u}.`)||o.startsWith(`${u}[`)}),s];this.baseStore.setState(o=>{const u={...o};return d.forEach(l=>{u.values=Kt(u.values,l),delete this.fieldInfo[l],delete u.fieldMetaBase[l]}),u})},this.pushFieldValue=(s,a,d)=>{this.setFieldValue(s,o=>[...Array.isArray(o)?o:[],a],d),Y(this).bumpArrayVersion(s)},this.insertFieldValue=async(s,a,d,o)=>{this.setFieldValue(s,l=>[...l.slice(0,a),d,...l.slice(a)],$(o,{dontValidate:!0}));const u=(o==null?void 0:o.dontValidate)??!1;u||await this.validateField(s,"change"),Y(this).handleArrayInsert(s,a),u||await this.validateArrayFieldsStartingFrom(s,a,"change")},this.replaceFieldValue=async(s,a,d,o)=>{this.setFieldValue(s,l=>l.map((f,m)=>m===a?d:f),$(o,{dontValidate:!0})),Y(this).bumpArrayVersion(s),((o==null?void 0:o.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.removeFieldValue=async(s,a,d)=>{const o=this.getFieldValue(s),u=Array.isArray(o)?Math.max(o.length-1,0):null;if(this.setFieldValue(s,f=>f.filter((m,c)=>c!==a),$(d,{dontValidate:!0})),Y(this).handleArrayRemove(s,a),u!==null){const f=`${s}[${u}]`;this.deleteField(f)}((d==null?void 0:d.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,a,"change"))},this.swapFieldValues=(s,a,d,o)=>{this.setFieldValue(s,l=>{const f=l[a],m=l[d];return Fe(Fe(l,`${a}`,m),`${d}`,f)},$(o,{dontValidate:!0})),Y(this).handleArraySwap(s,a,d),((o==null?void 0:o.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${d}]`,"change"))},this.moveFieldValues=(s,a,d,o)=>{this.setFieldValue(s,l=>{const f=[...l];return f.splice(d,0,f.splice(a,1)[0]),f},$(o,{dontValidate:!0})),Y(this).handleArrayMove(s,a,d),((o==null?void 0:o.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${a}]`,"change"),this.validateField(`${s}[${d}]`,"change"))},this.clearFieldValues=(s,a)=>{const d=this.getFieldValue(s),o=Array.isArray(d)?Math.max(d.length-1,0):null;if(this.setFieldValue(s,[],$(a,{dontValidate:!0})),Y(this).bumpArrayVersion(s),o!==null)for(let l=0;l<=o;l++){const f=`${s}[${l}]`;this.deleteField(f)}((a==null?void 0:a.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(a=>{var l;const d=(l=this.getFieldInfo(s).instance)==null?void 0:l.options.defaultValue,o=le(this.options.defaultValues,s),u=d??o;return{...a,fieldMetaBase:{...a.fieldMetaBase,[s]:O},values:u!==void 0?Fe(a.values,s,u):a.values}})},this.setErrorMap=s=>{_(()=>{Object.entries(s).forEach(([a,d])=>{const o=a;if(Be(d)){const{formError:u,fieldErrors:l}=je(d);for(const f of Object.keys(this.fieldInfo))this.getFieldMeta(f)&&this.setFieldMeta(f,c=>({...c,errorMap:{...c.errorMap,[o]:l==null?void 0:l[f]},errorSourceMap:{...c.errorSourceMap,[o]:"form"}}));this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[o]:u}}))}else this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[o]:d}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[a,d])=>(Object.keys(d).length&&d.errors.length&&(s[a]={errors:d.errors,errorMap:d.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=(r==null?void 0:r.formId)??Ft(),this._devtoolsSubmissionOverride=!1;let e=Ue({...r==null?void 0:r.defaultState,values:(r==null?void 0:r.defaultValues)??((h=r==null?void 0:r.defaultState)==null?void 0:h.values)});if(r!=null&&r.transform){e=r.transform({state:e}).state;for(const s of Object.keys(e.errorMap)){const a=e.errorMap[s];if(!(a===void 0||!Be(a)))for(const d of Object.keys(a.fields)){const o=a.fields[d];if(o===void 0)continue;const u=e.fieldMetaBase[d];e.fieldMetaBase[d]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...u??{},errorSourceMap:{...(u==null?void 0:u.errorSourceMap)??{},onChange:"form"},errorMap:{...(u==null?void 0:u.errorMap)??{},[s]:o}}}}}this.baseStore=ie(e);let i;this.fieldMetaDerived=ie(s=>{var u,l,f;const a=this.baseStore.get();let d=0;const o={};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=le(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=(u=this.getFieldInfo(m))==null?void 0:u.instance;(!b||!b.options.disableErrorFlat)&&(F=F.flat(1))}const M=!qt(F),V=!c.isDirty,w=J(S,((f=(l=this.getFieldInfo(m))==null?void 0:l.instance)==null?void 0:f.options.defaultValue)??le(this.options.defaultValues,m));if(v&&v.isPristine===V&&v.isValid===M&&v.isDefaultValue===w&&v.errors===F&&c===g){o[m]=v,d++;continue}o[m]={...c,errors:F??[],isPristine:V,isValid:M,isDefaultValue:w}}return Object.keys(a.fieldMetaBase).length?s&&d===Object.keys(a.fieldMetaBase).length?s:(i=this.baseStore.get(),o):o}),this.formGroupMetaDerived=ie(s=>{const a=this.baseStore.get(),d=this.fieldMetaDerived.get(),o={};for(const u of this.formGroupApis){const l=u.name,f=a.formGroupStateBase[l]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},m=d[l];let c=!1,g=!0,v=!1,S=!1,F=!0,M=!1;for(const W in d){if(W===l||!ne(l,W))continue;const k=d[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(d).some(([W,k])=>k&&W!==l&&ne(l,W)&&k.errorMap.onMount)),A=s==null?void 0:s[l];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 et=k.group;return et!==void 0&&W.push(et),W}return W.push(k),W},[]));const j=D.length===0,T=g&&j,I=u.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){o[l]=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}),o[l]=R}return o});let n;this.store=ie(s=>{var j,T;const a=this.baseStore.get(),d=this.fieldMetaDerived.get(),o=Object.values(d).filter(Boolean),u=o.some(I=>I.isValidating),l=o.every(I=>I.isValid),f=o.some(I=>I.isTouched),m=o.some(I=>I.isBlurred),c=o.every(I=>I.isDefaultValue),g=f&&((j=a.errorMap)==null?void 0:j.onMount),v=o.some(I=>I.isDirty),S=!v,F=!!((T=a.errorMap)!=null&&T.onMount||o.some(I=>{var P;return(P=I==null?void 0:I.errorMap)==null?void 0:P.onMount})),M=!!u;let V=(s==null?void 0:s.errors)??[];(!n||a.errorMap!==n.errorMap)&&(V=Object.values(a.errorMap).reduce((I,P)=>P===void 0?I:P&&Be(P)?(I.push(P.form),I):(I.push(P),I),[]));const w=V.length===0,b=l&&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&&n&&s.errorMap===A&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===V&&s.isFieldsValidating===u&&s.isFieldsValid===l&&s.isFormValid===w&&s.isValid===b&&s.canSubmit===E&&s.isTouched===f&&s.isBlurred===m&&s.isPristine===S&&s.isDefaultValue===c&&s.isDirty===v&&J(n,a))return s;const D={...a,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:u,isFieldsValid:l,isFormValid:w,isValid:b,canSubmit:E,isTouched:f,isBlurred:m,isPristine:S,isDefaultValue:c,isDirty:v};return n=this.baseStore.get(),D}),this.handleSubmit=this.handleSubmit.bind(this),this.update(r||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(r){return Ye(r.validate)?ae[r.type](r.value,r.validate):r.validate(r.value)}handleSubmit(r){return this._handleSubmit(r)}}function je(t){if(t){if(Be(t)){const r=je(t.form).formError,e=t.fields;return{formError:r,fieldErrors:e}}return{formError:t}}return{formError:void 0}}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"}}class Ae{constructor(r){this.options={},this.mount=()=>{var n,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=(n=this.options.listeners)==null?void 0:n.onMount)==null||h.call(n,{value:this.state.value,fieldApi:this}),()=>{var a,d,o,u;for(const[l,f]of Object.entries(this.timeoutIds.validations))f&&(clearTimeout(f),this.timeoutIds.validations[l]=null);for(const[l,f]of Object.entries(this.timeoutIds.listeners))f&&(clearTimeout(f),this.timeoutIds.listeners[l]=null);for(const[l,f]of Object.entries(this.timeoutIds.formListeners))f&&(clearTimeout(f),this.timeoutIds.formListeners[l]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[l,f]of Object.entries(s.validationMetaMap))f==null||f.lastAbortController.abort(),s.validationMetaMap[l]=void 0;this.form.baseStore.setState(l=>{var f,m,c;return{...l,fieldMetaBase:{...l.fieldMetaBase,[this.name]:{...O,isTouched:((f=l.fieldMetaBase[this.name])==null?void 0:f.isTouched)??O.isTouched,isBlurred:((m=l.fieldMetaBase[this.name])==null?void 0:m.isBlurred)??O.isBlurred,isDirty:((c=l.fieldMetaBase[this.name])==null?void 0:c.isDirty)??O.isDirty}}}}),s.instance=null,(d=(a=this.options.listeners)==null?void 0:a.onUnmount)==null||d.call(a,{value:this.state.value,fieldApi:this}),(u=(o=this.form.options.listeners)==null?void 0:o.onFieldUnmount)==null||u.call(o,{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);J(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,n)=>{this.form.insertFieldValue(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,i,n)=>{this.form.replaceFieldValue(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.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,n)=>{this.form.swapFieldValues(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,i,n)=>{this.form.moveFieldValues(this.name,e,i,$(n,{dontRunListeners:!0})),n!=null&&n.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),n=[];for(const h of i){if(!h.instance||!(h.instance instanceof Ae))continue;const{onChangeListenTo:s,onBlurListenTo:a}=h.instance.options.validators||{};e==="change"&&(s!=null&&s.includes(this.name))&&n.push(h.instance),e==="blur"&&(a!=null&&a.includes(this.name))&&n.push(h.instance)}return n},this.validateSync=(e,i)=>{var o;const n=ye(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||q}),s=this.getLinkedFields(e).reduce((u,l)=>{const f=ye(e,{...l.options,form:l.form,fieldName:l.name,validationLogic:l.form.options.validationLogic||q});return f.forEach(m=>{m.field=l}),u.concat(f)},[]);let a=!1;_(()=>{const u=(l,f)=>{var F;const m=Se(f.cause),c=f.validate?ct(l.runValidator({validate:f.validate,value:{value:l.store.state.value,validationSource:"field",fieldApi:l},type:"validate"})):void 0,g=i[m],{newErrorValue:v,newSource:S}=_e({formLevelError:g,fieldLevelError:c});((F=l.state.meta.errorMap)==null?void 0:F[m])!==v&&l.setMeta(M=>({...M,errorMap:{...M.errorMap,[m]:v},errorSourceMap:{...M.errorSourceMap,[m]:S}})),v&&(a=!0)};for(const l of n)u(this,l);for(const l of s)l.validate&&u(l.field,l)});const d=Se("submit");return(o=this.state.meta.errorMap)!=null&&o[d]&&e!=="submit"&&!a&&this.setMeta(u=>({...u,errorMap:{...u.errorMap,[d]:void 0},errorSourceMap:{...u.errorSourceMap,[d]:void 0}})),{hasErrored:a}},this.validateAsync=async(e,i)=>{const n=Ve(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=Ve(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)},[]),d=[],o=[],u=n.some(c=>c.validate),l=Array.from(new Set(a.filter(c=>c.validate).map(c=>c.field)));_(()=>{u&&this.startValidation();for(const c of l)c.startValidation()});const f=(c,g,v)=>{const S=Se(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=ct(b),E=(j=h[c.name])==null?void 0:j[S],{newErrorValue:A,newSource:D}=_e({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 n)c.validate&&f(this,c,d);for(const c of a)c.validate&&f(c.field,c,o);let m=[];return(d.length||o.length)&&(m=await Promise.all(d),await Promise.all(o)),_(()=>{u&&this.endValidation();for(const c of l)c.endValidation()}),m.filter(Boolean)},this.validate=(e,i)=>{var f,m;if(!this.state.meta.isTouched)return[];const n=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 n){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),d=new WeakMap;for(const c of n){const{hasErrored:g}=c.validateSync(e,{},{skipRelatedFieldValidation:!0});d.set(c,g)}if(a&&!this.options.asyncAlways){(f=this.getInfo().validationMetaMap[Se(e)])==null||f.lastAbortController.abort();const c=[];for(const g of n)(m=g.getInfo().validationMetaMap[Se(e)])==null||m.lastAbortController.abort(),c.push(g.state.meta.errors);return[...this.state.meta.errors,...c.flat()]}const o=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),u=this.validateAsync(e,o),l=[];for(const c of n)d.get(c)&&!c.options.asyncAlways||l.push(c.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return l.length===0?u:Promise.all([u,...l]).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 n,h,s,a,d,o;const e=(n=this.form.options.listeners)==null?void 0:n.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var u,l;(l=(u=this.form.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{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 u,l;(l=(u=this.options.listeners)==null?void 0:u.onBlur)==null||l.call(u,{value:this.state.value,fieldApi:this})},i)):(o=(d=this.options.listeners)==null?void 0:d.onBlur)==null||o.call(d,{value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{var n,h,s,a,d,o;const e=(n=this.form.options.listeners)==null?void 0:n.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var u,l;(l=(u=this.form.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{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 u,l;(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,fieldApi:this})},i)):(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{value:this.state.value,fieldApi:this});for(const u of this.form.formGroupApis)ne(u.name,this.name)&&u.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=r.form,this.name=r.name,this.options=r,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=ie(e=>{this.form.store.get();const i=this.form.getFieldMeta(this.name)??{...O,...r.defaultMeta};let n=this.form.getFieldValue(this.name);return!i.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!J(n,this.options.defaultValue)&&(n=this.options.defaultValue),e&&e.value===n&&e.meta===i?e:{value:n,meta:i}})}get state(){return this.store.state}runValidator(r){return Ye(r.validate)?ae[r.type](r.value,r.validate):r.validate(r.value)}startValidation(){this.setMeta(r=>{const e=r._pendingValidationsCount+1;return{...r,_pendingValidationsCount:e,isValidating:e>0&&!r.isValidating?!0:r.isValidating}})}endValidation(){this.setMeta(r=>{const e=Math.max(0,r._pendingValidationsCount-1);return{...r,_pendingValidationsCount:e,isValidating:e===0&&r.isValidating?!1:r.isValidating}})}}function ct(t){if(t)return t}function Se(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 Ke(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Zt(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 Ee{constructor(r){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(i=>{const n=i.formGroupStateBase[this.name]??Ke({});return{...i,formGroupStateBase:{...i.formGroupStateBase,[this.name]:e(n)}}})},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);J(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,n;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]??Ke({...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;qe(h)&&(s=h.group,a=h.fields);const d=ze(s);d&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,onMount:d},errorSourceMap:{...o.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return(n=(i=this.options.listeners)==null?void 0:i.onMount)==null||n.call(i,{value:this.state.value,groupApi:this}),()=>{var h,s;for(const[a,d]of Object.entries(this.timeoutIds.validations))d&&(clearTimeout(d),this.timeoutIds.validations[a]=null);for(const[a,d]of Object.entries(this.timeoutIds.listeners))d&&(clearTimeout(d),this.timeoutIds.listeners[a]=null);for(const[a,d]of Object.entries(this.timeoutIds.formListeners))d&&(clearTimeout(d),this.timeoutIds.formListeners[a]=null);if(this.fieldInfo.instance===this){for(const[a,d]of Object.entries(this.fieldInfo.validationMetaMap))d==null||d.lastAbortController.abort(),this.fieldInfo.validationMetaMap[a]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(a=>({...a,formGroupStateBase:{...a.formGroupStateBase,[this.name]:Ke({})}})),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 n of e)n.instance&&n.instance instanceof Ae&&n.instance.name.startsWith(this.name)&&i.push(n.instance);return i},this.getRelatedFieldMetasDerived=()=>{const e=Object.entries(this.form.fieldMetaDerived.state),i=[];for(const[n,h]of e)n!==this.name&&ne(this.name,n)&&i.push({...h,name:n});return i},this.buildChildFieldName=e=>e===""?this.name:e.startsWith("[")?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,i)=>{const n=this._lastDistributedFieldNames[e]??new Set,h=new Set;if(i)for(const[d,o]of Object.entries(i))o==null||o===!1||h.add(this.buildChildFieldName(d));const s=new Set([...n,...h]);let a=!1;for(const d of s){const o=d.startsWith(this.name+"[")?d.slice(this.name.length):d.slice(this.name.length+1),u=i==null?void 0:i[o],l=this.form.getFieldMeta(d);if(!l&&!u)continue;const f=l==null?void 0:l.errorMap[e],m=(l==null?void 0:l.errorSourceMap[e])==="form",{newErrorValue:c,newSource:g}=Je({newFormValidatorError:u,isPreviousErrorFromFormValidator:m,previousErrorValue:f});c&&(a=!0),!(f===c&&(l==null?void 0:l.errorSourceMap[e])===g)&&this.form.setFieldMeta(d,(v=O)=>({...v,errorMap:{...v.errorMap,[e]:c},errorSourceMap:{...v.errorSourceMap,[e]:g}}))}return this._lastDistributedFieldNames[e]=h,a},this.validateSync=(e,i,n={})=>{var u;const h=ye(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),a=(n.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((l,f)=>{const m=ye(e,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||q});return m.forEach(c=>{c.field=f}),l.concat(m)},[]);let d=!1;_(()=>{const l=(f,m)=>{var L;const c=xe(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 Ee?{groupApi:f}:{fieldApi:f}},type:"validate"}));let S=v,F;g&&qe(v)&&(S=v.group,F=v.fields);const M=ze(S),V=i[c],{newErrorValue:w,newSource:b}=_e({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&&(d=!0),g&&this.distributeFieldErrors(c,F)&&(d=!0)};for(const f of h)l(this,f);for(const f of a)f.validate&&l(f.field,f)});const o=xe("submit");return(u=this.state.meta.errorMap)!=null&&u[o]&&e!=="submit"&&!d&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,[o]:void 0},errorSourceMap:{...l.errorSourceMap,[o]:void 0}})),{hasErrored:d}},this.validateAsync=async(e,i,n={})=>{const h=Ve(e,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||q}),s=await i,a=n.skipRelatedFieldValidation?[]:this.getRelatedFields(),d=a.reduce((c,g)=>{const v=Ve(e,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||q});return v.forEach(S=>{S.field=g}),c.concat(v)},[]),o=[],u=[],l=h.some(c=>c.validate)||d.some(c=>c.validate);if(l){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=xe(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 Ee?{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&&qe(L)&&(E=L.group,A=L.fields);const D=ze(E),j=(P=s[c.name])==null?void 0:P[S],{newErrorValue:T,newSource:I}=_e({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,o);for(const c of d)c.validate&&f(c.field,c,u);let m=[];if((o.length||u.length)&&(m=await Promise.all(o),await Promise.all(u)),l){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,n)=>this.form.validateArrayFieldsStartingFrom(e,i,n),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,n)=>this.form.insertFieldValue(e,i,n),this.replaceFieldValue=(e,i,n)=>this.form.replaceFieldValue(e,i,n),this.swapFieldValues=(e,i,n)=>this.form.swapFieldValues(e,i,n),this.moveFieldValues=(e,i,n)=>this.form.moveFieldValues(e,i,n),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:n}=i!=null&&i.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:d=>ne(this.name,d)}),{hasErrored:h}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation});if(h&&!this.options.asyncAlways)return(a=this.getInfo().validationMetaMap[xe(e)])==null||a.lastAbortController.abort(),this.state.meta.errors;const s=i!=null&&i.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:d=>ne(this.name,d)});return this.validateAsync(e,s,{skipRelatedFieldValidation:i==null?void 0:i.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{var n,h,s,a,d,o;const e=(n=this.form.options.listeners)==null?void 0:n.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var u,l;(l=(u=this.form.options.listeners)==null?void 0:u.onChangeGroup)==null||l.call(u,{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 u,l;(l=(u=this.options.listeners)==null?void 0:u.onChange)==null||l.call(u,{value:this.state.value,groupApi:this})},i)):(o=(d=this.options.listeners)==null?void 0:d.onChange)==null||o.call(d,{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,d,o,u,l,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 n=()=>{this.setFormGroupState(m=>({...m,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){n(),(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){n(),(d=(a=this.options).onGroupSubmitInvalid)==null||d.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})})}),(u=(o=this.options.listeners)==null?void 0:o.onSubmit)==null||u.call(o,{groupApi:this,value:this.state.value});try{await((f=(l=this.options).onGroupSubmit)==null?void 0:f.call(l,{value:this.state.value,groupApi:this,meta:i})),_(()=>{this.setFormGroupState(m=>({...m,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(m){throw this.setFormGroupState(c=>({...c,isSubmitSuccessful:!1})),n(),m}},this.form=r.form,this.name=r.name,this.options=r,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)??Zt(r.defaultMeta);let n=this.form.getFieldValue(this.name);return!i.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!J(n,this.options.defaultValue)&&(n=this.options.defaultValue),e&&e.value===n&&e.meta===i?e:{value:n,meta:i}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(r){if(Ye(r.validate)){const e=ae[r.type](r.value,r.validate);return r.type==="validate"?ht(e):e.then(ht)}return r.validate(r.value)}handleSubmit(r){return this._handleSubmit(r)}}function ze(t){if(t)return t}function qe(t){return!!t&&typeof t=="object"&&"fields"in t}function ht(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:r,fields:e,...i}=t;return{...i,group:r,fields:e}}function xe(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 Re{constructor(r){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap=="string")return lt(this.fieldsMap,e);const i=Ge(e)[0];if(typeof i!="string")return"";const n=e.slice(i.length),h=this.fieldsMap[i];return lt(h,n)},this.getFormFieldOptions=e=>{const i={...e},n=i.validators;if(i.name=this.getFormFieldName(e.name),n&&(n.onChangeListenTo||n.onBlurListenTo)){const h={...n},s=a=>{if(a)return a.map(d=>this.getFormFieldName(d))};h.onChangeListenTo=s(n.onChangeListenTo),h.onBlurListenTo=s(n.onBlurListenTo),i.validators=h}return i},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,i,n)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),i,n),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,n)=>this.form.setFieldValue(this.getFormFieldName(e),i,n),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,i,n)=>this.form.pushFieldValue(this.getFormFieldName(e),i,n),this.insertFieldValue=async(e,i,n,h)=>this.form.insertFieldValue(this.getFormFieldName(e),i,n,h),this.replaceFieldValue=async(e,i,n,h)=>this.form.replaceFieldValue(this.getFormFieldName(e),i,n,h),this.removeFieldValue=async(e,i,n)=>this.form.removeFieldValue(this.getFormFieldName(e),i,n),this.swapFieldValues=(e,i,n,h)=>this.form.swapFieldValues(this.getFormFieldName(e),i,n,h),this.moveFieldValues=(e,i,n,h)=>this.form.moveFieldValues(this.getFormFieldName(e),i,n,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),r.form instanceof Re){const e=r.form;if(this.form=e.form,typeof r.fields=="string")this.fieldsMap=e.getFormFieldName(r.fields);else{const i={...r.fields};for(const n in i)i[n]=e.getFormFieldName(i[n]);this.fieldsMap=i}}else this.form=r.form,this.fieldsMap=r.fields;this.store=ie(()=>{const e=this.form.store.get();let i;if(typeof this.fieldsMap=="string")i=le(e.values,this.fieldsMap);else{i={};const n=this.fieldsMap;for(const h in n)i[h]=le(e.values,n[h])}return{values:i}})}get state(){return this.store.state}async handleSubmit(r){return this.form.handleSubmit(r)}}function Jt(t,r){if(!r)return;const e=Object.assign({},t,{state:pe(t.state)});r(e),e.fieldInfo!==t.fieldInfo&&(t.fieldInfo=e.fieldInfo),e.options!==t.options&&(t.options=e.options);const n=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(n).length&&t.baseStore.setState(h=>({...h,...n})),e.state.errorMap!==t.state.errorMap&&t.setErrorMap(e.state.errorMap)}),e}function Qt(t,r){return t===r}function x(t,r=i=>i,e){const i=(e==null?void 0:e.compare)??Qt,n=C.useCallback(s=>{const{unsubscribe:a}=t.subscribe(s);return a},[t]),h=C.useCallback(()=>t.get(),[t]);return yt.useSyncExternalStoreWithSelector(n,h,h,r,i)}const Q=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Yt(t){const[r,e]=C.useState(()=>({form:t.form,name:t.name})),[i,n]=C.useState(()=>new Ae({...t}));let h=i;(r.form!==t.form||r.name!==t.name)&&(h=new Ae({...t}),n(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),d=x(h.store,c=>c.meta.isBlurred),o=x(h.store,c=>c.meta.isDirty),u=x(h.store,c=>c.meta.errorMap),l=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:d,isDirty:o,errorMap:u,errorSourceMap:l,isValidating:f}}}}}),[h,t.mode,s,a,d,o,u,l,f]);return Q(h.mount,[h]),Q(()=>{h.update(t)}),m}const ei=(({children:t,...r})=>{const e=Yt(r),i=C.useMemo(()=>ve(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ti(){return C.useState(()=>Ft())[0]}const ii=Vt,si=C.version.split(".")[0]==="17"?ti:ii.useId;function ri(t){const[r,e]=C.useState(()=>({form:t.form,name:t.name})),[i,n]=C.useState(()=>new Ee({...t}));(r.form!==t.form||r.name!==t.name)&&(n(new Ee({...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),d=x(i.store,b=>b.meta.isDirty),o=x(i.store,b=>b.meta.errorMap),u=x(i.store,b=>b.meta.errorSourceMap),l=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:d,errorMap:o,errorSourceMap:u,isValidating:l,isSubmitting:f,isSubmitted:m,submissionAttempts:c,isSubmitSuccessful:g,canSubmit:v,isValid:S,isFieldsValid:F,isFieldsValidating:M,isGroupValid:V}}}}}),[i,h,s,a,d,o,u,l,f,m,c,g,v,S,F,M,V]);return Q(i.mount,[i]),Q(()=>{i.update(t)}),w}const ni=(({children:t,...r})=>{const e=ri(r),i=C.useMemo(()=>ve(t,e),[t,e]);return p.jsx(p.Fragment,{children:i})});function ai({form:t,selector:r=i=>i,children:e}){const i=x(t.store,r);return p.jsx(p.Fragment,{children:ve(e,i)})}function oi(t){const r=si(),[e,i]=C.useState(t==null?void 0:t.formId),[n,h]=C.useState(()=>new dt({...t,formId:(t==null?void 0:t.formId)??r}));if(e!==(t==null?void 0:t.formId)){const d=(t==null?void 0:t.formId)??r;h(new dt({...t,formId:d})),i(d)}const s=C.useMemo(()=>{const d={...n,handleSubmit:((...o)=>n._handleSubmit(...o)),get formId(){return n._formId},get state(){return n.store.state}};return d.Field=function(u){return p.jsx(ei,{...u,form:n})},d.FormGroup=function(u){return p.jsx(ni,{...u,form:n})},d.Subscribe=function(u){return p.jsx(ai,{form:n,selector:u.selector,children:u.children})},d},[n]);Q(n.mount,[]),Q(()=>{n.update(t)});const a=C.useRef(!1);return Q(()=>{a.current&&t!=null&&t.transform&&Jt(n,t.transform)},[n,t==null?void 0:t.transform]),Q(()=>{a.current=!0}),s}function li({lens:t,selector:r=i=>i,children:e}){const i=x(t.store,r);return p.jsx(p.Fragment,{children:ve(e,i)})}function ui(t){const[r]=C.useState(()=>{const e=new Re(t),i=t.form instanceof Re?t.form.form:t.form,n=e;return n.AppForm=function(s){return p.jsx(i.AppForm,{...s})},n.AppField=function(s){return p.jsx(i.AppField,{...r.getFormFieldOptions(s)})},n.Field=function(s){return p.jsx(i.Field,{...r.getFormFieldOptions(s)})},n.Subscribe=function(s){return p.jsx(li,{lens:r,selector:s.selector,children:s.children})},Object.assign(n,{...t.formComponents})});return Q(r.mount,[r]),r}const ft=C.createContext(null),Mt=C.createContext(null);function St(){const t=C.useContext(Mt);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function di(){function t(){const r=C.useContext(ft);if(!r)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return r}return{fieldContext:ft,useFieldContext:t,useFormContext:St,formContext:Mt}}function pt({fieldComponents:t,fieldContext:r,formContext:e,formComponents:i}){function n(o){const u=oi(o),l=C.useMemo(()=>({children:c})=>p.jsx(e.Provider,{value:u,children:c}),[u]),f=C.useMemo(()=>(({children:g,...v})=>p.jsx(u.Field,{...v,children:S=>p.jsx(r.Provider,{value:S,children:g(Object.assign(S,t))})})),[u]);return C.useMemo(()=>Object.assign(u,{AppField:f,AppForm:l,...i}),[u,f,l])}function h({render:o,props:u}){return function(f){return o({...u,...f})}}function s({render:o,props:u,defaultValues:l}){return function(m){const c=C.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:l,formComponents:i}),[m.form,m.fields]),g=ui(c);return o({...u,...m,group:g})}}function a(o){return St()}function d(o){return pt({fieldContext:r,formContext:e,fieldComponents:{...t,...o.fieldComponents},formComponents:{...i,...o.formComponents}})}return{useAppForm:n,withForm:h,withFieldGroup:s,useTypedAppFormContext:a,extendForm:d}}const{fieldContext:ci,formContext:hi,useFieldContext:oe,useFormContext:fi}=di();function be(t){const r=oe(),{isBlurred:e,errors:i}=r.state.meta,h=e||r.form.state.submissionAttempts>0?i.map(o=>({message:String(o)})):[],s=h.length>0,a=`${r.name}-help`,d=`${r.name}-error`;return{fieldErrors:h,helpId:a,errorId:d,controlProps:{"aria-invalid":s||void 0,"aria-describedby":s?d:t?a:void 0}}}function mi({label:t,placeholder:r,type:e="text",description:i}){const n=oe(),{fieldErrors:h,helpId:s,errorId:a,controlProps:d}=be(!!i);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:n.name,children:t}),p.jsx(At,{id:n.name,type:e,value:n.state.value,placeholder:r,onBlur:n.handleBlur,onChange:o=>n.handleChange(o.target.value),...d}),i&&p.jsx(me,{id:s,children:i}),p.jsx(ge,{id:a,errors:h})]})}function gi({label:t,placeholder:r,description:e,rows:i}){const n=oe(),{fieldErrors:h,helpId:s,errorId:a,controlProps:d}=be(!!e);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:n.name,children:t}),p.jsx(Et,{id:n.name,value:n.state.value,placeholder:r,rows:i,onBlur:n.handleBlur,onChange:o=>n.handleChange(o.target.value),...d}),e&&p.jsx(me,{id:s,children:e}),p.jsx(ge,{id:a,errors:h})]})}function vi({label:t,options:r,placeholder:e,description:i}){const n=oe(),{fieldErrors:h,helpId:s,errorId:a,controlProps:d}=be(!!i);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:n.name,children:t}),p.jsxs(wt,{value:n.state.value,onValueChange:o=>n.handleChange(o),onOpenChange:o=>{o||n.handleBlur()},children:[p.jsx(It,{id:n.name,...d,children:p.jsx(Ct,{placeholder:e})}),p.jsx(Lt,{children:r.map(o=>p.jsx(Tt,{value:o.value,children:o.label},o.value))})]}),i&&p.jsx(me,{id:s,children:i}),p.jsx(ge,{id:a,errors:h})]})}function bi({label:t,description:r}){const e=oe(),{fieldErrors:i,helpId:n,errorId:h,controlProps:s}=be(!!r);return p.jsxs(he,{orientation:"horizontal",className:"justify-between gap-4 max-md:min-h-11 max-md:gap-4",children:[p.jsxs(mt,{children:[p.jsx(fe,{htmlFor:e.name,children:t}),r&&p.jsx(me,{id:n,children:r}),p.jsx(ge,{id:h,errors:i})]}),p.jsx(xt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:a=>e.handleChange(a),...s})]})}function Fi({label:t,description:r}){const e=oe(),{fieldErrors:i,helpId:n,errorId:h,controlProps:s}=be(!!r);return p.jsxs(he,{orientation:"horizontal",className:"max-md:min-h-11",children:[p.jsx(Dt,{id:e.name,checked:e.state.value,onBlur:e.handleBlur,onCheckedChange:a=>e.handleChange(a===!0),...s}),p.jsxs(mt,{children:[p.jsx(fe,{htmlFor:e.name,className:"font-normal",children:t}),r&&p.jsx(me,{id:n,children:r}),p.jsx(ge,{id:h,errors:i})]})]})}function Mi({label:t,placeholder:r,description:e}){const i=oe(),{fieldErrors:n,helpId:h,errorId:s,controlProps:a}=be(!!e);return p.jsxs(he,{orientation:"vertical",children:[p.jsx(fe,{htmlFor:i.name,children:t}),p.jsx(Bt,{id:i.name,value:i.state.value,placeholder:r,onBlur:i.handleBlur,onChange:d=>i.handleChange(d.target.value),...a}),e&&p.jsx(me,{id:h,children:e}),p.jsx(ge,{id:s,errors:n})]})}function Si({label:t,pendingLabel:r="Saving…"}){const e=fi();return p.jsx(e.Subscribe,{selector:i=>({canSubmit:i.canSubmit,isSubmitting:i.isSubmitting}),children:({canSubmit:i,isSubmitting:n})=>p.jsx(kt,{type:"submit",disabled:!i||n,children:n?r:t})})}const{useAppForm:Vi}=pt({fieldContext:ci,formContext:hi,fieldComponents:{TextField:mi,TextareaField:gi,SelectField:vi,SwitchField:bi,CheckboxField:Fi,PasswordField:Mi},formComponents:{SubmitButton:Si}});export{x as a,Vi as u};
@@ -1 +1 @@
1
- import{a5 as d,a6 as f}from"./index-BwTGkJbK.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{a5 as d,a6 as f}from"./index-BR1m9FON.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};