@abtnode/webapp 1.17.6 → 1.17.7-beta-20251223-090654-55d57623

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 (185) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-BjFsoQ-w.js → AdapterDayjs-CNrLw9Vz.js} +1 -1
  4. package/dist/assets/{Add-DwgbzyUw.js → Add-DmAZpTAX.js} +1 -1
  5. package/dist/assets/ArrowDropDown-C5HLN-JN.js +1 -0
  6. package/dist/assets/{Autocomplete-Dm1_2YSl.js → Autocomplete-BvGMj8d2.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-CJg6cGOH.js → Breadcrumbs-DJuRsF5C.js} +1 -1
  8. package/dist/assets/{ButtonGroup-Td8BNrZx.js → ButtonGroup-D0vK9rJe.js} +1 -1
  9. package/dist/assets/{CSSTransition-y8iKTN7d.js → CSSTransition-kYwC_AYj.js} +1 -1
  10. package/dist/assets/{CallMerge-KptmKwB4.js → CallMerge-Bqb0zbmy.js} +1 -1
  11. package/dist/assets/{CardContent-ewSbhAdG.js → CardContent-MBq5V8vu.js} +1 -1
  12. package/dist/assets/{ChevronLeft-nSrR9D_I.js → ChevronLeft-Cu8az6Ql.js} +1 -1
  13. package/dist/assets/{ChevronRight-CRb5GVq5.js → ChevronRight-ZsluCIi3.js} +1 -1
  14. package/dist/assets/{Clear-CP-1JSsG.js → Clear-obXZ0PRj.js} +1 -1
  15. package/dist/assets/{Delete-zum6vOfn.js → Delete-Qei5VqRe.js} +1 -1
  16. package/dist/assets/{DeleteOutline-BRn6KXm4.js → DeleteOutline-BMoxlkvD.js} +1 -1
  17. package/dist/assets/{Done-BD3-Bno_.js → Done-D15PfZFX.js} +1 -1
  18. package/dist/assets/{Edit-fbuEYDWz.js → Edit-C68BL33Z.js} +1 -1
  19. package/dist/assets/{ErrorOutline-eTinVSTi.js → ErrorOutline-r8z8_0k8.js} +1 -1
  20. package/dist/assets/{FilterList-CoptEImh.js → FilterList-Ctqdg3pC.js} +1 -1
  21. package/dist/assets/{Google-DYe0WpSM.js → Google-0c2PtiDt.js} +1 -1
  22. package/dist/assets/{HelpOutline-CTq25q-V.js → HelpOutline-X8WyhtRN.js} +1 -1
  23. package/dist/assets/{KeyboardArrowDown-DBKPniSI.js → KeyboardArrowDown-ChJWcs80.js} +1 -1
  24. package/dist/assets/{Launch-BMpdke3b.js → Launch-CEhi4fOh.js} +1 -1
  25. package/dist/assets/{Link-Bum1u5am.js → Link-CkO8lOlM.js} +1 -1
  26. package/dist/assets/{ListItemButton-DAHFrrOj.js → ListItemButton-CVZEvzBW.js} +1 -1
  27. package/dist/assets/{ListSubheader-DmTgdBz5.js → ListSubheader--_-XKbS8.js} +1 -1
  28. package/dist/assets/{LoadingButton-Hr-4vZXO.js → LoadingButton-C9N7uXBC.js} +1 -1
  29. package/dist/assets/{MoreVert-Bs574HAx.js → MoreVert-CeEDj1aH.js} +1 -1
  30. package/dist/assets/{OpenInNew-Df7bSVHt.js → OpenInNew-Cs-AwdZR.js} +1 -1
  31. package/dist/assets/{Refresh-mfLuZ9Wj.js → Refresh-DHtQtEn3.js} +1 -1
  32. package/dist/assets/{Replay-CUAnOum2.js → Replay-Dbrib_q2.js} +1 -1
  33. package/dist/assets/{Search-CCrESOjg.js → Search-BtkTxHX-.js} +1 -1
  34. package/dist/assets/{Stepper-CDtZbh-4.js → Stepper-B30VS8qM.js} +1 -1
  35. package/dist/assets/{TableSearch-hUcYhTcB.js → TableSearch-gKn4yfNZ.js} +1 -1
  36. package/dist/assets/{ToggleButtonGroup-B8Mjp9ll.js → ToggleButtonGroup-CNdwB07n.js} +1 -1
  37. package/dist/assets/{UnfoldMore-DDQ8EkCp.js → UnfoldMore-ByQyYNQz.js} +1 -1
  38. package/dist/assets/{Verified-D2LDOD6a.js → Verified-DWuUc_op.js} +1 -1
  39. package/dist/assets/{VerifiedUser-dJrRBh25.js → VerifiedUser-hJ3mj0BI.js} +1 -1
  40. package/dist/assets/{ViewList-Dd0smq67.js → ViewList-2pmKgylC.js} +1 -1
  41. package/dist/assets/{_createAggregator-Btgpq5ky.js → _createAggregator-o5us6YWd.js} +1 -1
  42. package/dist/assets/{actions-Bsd5QbHY.js → actions-D7UfMRLN.js} +1 -1
  43. package/dist/assets/{actions-PjGF5ddj.js → actions-w0p6XVub.js} +1 -1
  44. package/dist/assets/{agreement-CR0Ele2A.js → agreement-BQjQnRA5.js} +1 -1
  45. package/dist/assets/api-DVPCT3Hv.js +1 -0
  46. package/dist/assets/{appearance-Dde_YYZa.js → appearance-FiYDKz7x.js} +1 -1
  47. package/dist/assets/{audit-logs-BA1_e5TT.js → audit-logs-Cjafw-tF.js} +1 -1
  48. package/dist/assets/{base-chart-DoQaNYbB.js → base-chart-BMO_7hKy.js} +1 -1
  49. package/dist/assets/{blocklet-9wr_FD8g.js → blocklet-CFzK39yZ.js} +1 -1
  50. package/dist/assets/{chain-xcMn0w3E.js → chain-D1Fwee6d.js} +1 -1
  51. package/dist/assets/{click-to-copy-BkgGJ2iu.js → click-to-copy-B1d42v9P.js} +1 -1
  52. package/dist/assets/cloneDeep-BuzpQSpL.js +1 -0
  53. package/dist/assets/{config-navigation-B8xULYAA.js → config-navigation-C_PMZOLg.js} +3 -3
  54. package/dist/assets/{connect-to-D7kv9JZG.js → connect-to-DoKSgfqT.js} +1 -1
  55. package/dist/assets/{cssMode-CrKT5NTU.js → cssMode-ClpIc5F4.js} +1 -1
  56. package/dist/assets/{delete-confirm-DsbMbRAa.js → delete-confirm-POXo6hH3.js} +1 -1
  57. package/dist/assets/{depsEqual-BIKlqTyk.js → depsEqual-DYZrAOrY.js} +1 -1
  58. package/dist/assets/{detail-Y8udUtll.js → detail-wRbXxkwJ.js} +3 -3
  59. package/dist/assets/{domains-B-frEuQt.js → domains-DYl_SPW0.js} +1 -1
  60. package/dist/assets/{download-DjEQp-4L.js → download-Ba2tPkmj.js} +1 -1
  61. package/dist/assets/{edit.svg-_S0cvmEV.js → edit.svg-Bt1rUdxu.js} +1 -1
  62. package/dist/assets/emotion-cache.browser.esm-CuK33BMV.js +1 -0
  63. package/dist/assets/engine-C48PkCS2.js +1 -0
  64. package/dist/assets/{freemarker2-DMLRgxDr.js → freemarker2-DtJar_6h.js} +1 -1
  65. package/dist/assets/{get-safe-url-DcDP4eG0.js → get-safe-url-C4fVKi22.js} +1 -1
  66. package/dist/assets/getValidReactChildren-CqYTFgwI.js +1 -0
  67. package/dist/assets/{graphqlMode-BF3BGh5s.js → graphqlMode-BWlf2_-0.js} +2 -2
  68. package/dist/assets/{handlebars-D79JLSFR.js → handlebars-joSlHmJn.js} +1 -1
  69. package/dist/assets/{html-BnBm7tse.js → html-ZR0G0V5v.js} +1 -1
  70. package/dist/assets/{html-title-CFJOQU04.js → html-title-nz5vmr92.js} +1 -1
  71. package/dist/assets/{htmlMode-Dbi5GsHR.js → htmlMode-DOVpPnO_.js} +1 -1
  72. package/dist/assets/{iframe-DTPDSES_.js → iframe-D0_BJlWL.js} +1 -1
  73. package/dist/assets/{index-FOfUOpKU.js → index-8DkeDWz0.js} +1 -1
  74. package/dist/assets/{index-DKlmfMu8.js → index-B2sD602o.js} +1 -1
  75. package/dist/assets/{index-TkRGX0aU.js → index-B32oAL99.js} +1 -1
  76. package/dist/assets/{index-Dter8RWU.js → index-B7DUE5wV.js} +1 -1
  77. package/dist/assets/{index-DkNsYHWd.js → index-BHcY0rXA.js} +1 -1
  78. package/dist/assets/{index-BprceCor.js → index-BNqeTjZk.js} +1 -1
  79. package/dist/assets/{index-B3S0fIB2.js → index-BQOOI9zH.js} +1 -1
  80. package/dist/assets/index-Bgw3LjDC.js +1 -0
  81. package/dist/assets/{index-_p9TGBvO.js → index-ByV5lrBo.js} +1 -1
  82. package/dist/assets/{index-C-G6LjU2.js → index-BzbWd73Z.js} +1 -1
  83. package/dist/assets/{index-DpFVufZF.js → index-CHD9Cmfg.js} +3 -3
  84. package/dist/assets/{index-8vHqMMTo.js → index-CLH8YftR.js} +1 -1
  85. package/dist/assets/{index-DqKWQ6lA.js → index-CPw54kmB.js} +1 -1
  86. package/dist/assets/{index-Crh7ejXx.js → index-CTWubm-u.js} +3 -3
  87. package/dist/assets/{index-BruXFS68.js → index-Cd1OxNJr.js} +1 -1
  88. package/dist/assets/{index-BESOxZme.js → index-CiZLAWXc.js} +1 -1
  89. package/dist/assets/{index-C6w6MwHd.js → index-CtaGvMIP.js} +1 -1
  90. package/dist/assets/{index-Cy1gRvjJ.js → index-CzNTIz_Q.js} +1 -1
  91. package/dist/assets/{index-CSqb8yB_.js → index-D1_DoL-Z.js} +1 -1
  92. package/dist/assets/{index-gY5iKTIg.js → index-D25XEy92.js} +1 -1
  93. package/dist/assets/{index-CnaB1RS2.js → index-D2Z3ikID.js} +1 -1
  94. package/dist/assets/{index-DfO0PkR5.js → index-D4ha92_f.js} +2 -2
  95. package/dist/assets/{index-B3f37Bjf.js → index-D7j36DTZ.js} +1 -1
  96. package/dist/assets/{index-CZVZy3tE.js → index-DPjJiIdV.js} +1 -1
  97. package/dist/assets/{index-DAzO4vT3.js → index-DTLMh4h8.js} +1 -1
  98. package/dist/assets/{index-DxeaApG7.js → index-DYPtfr0Z.js} +1 -1
  99. package/dist/assets/{index-Cj3feFCu.js → index-DcwVNsRb.js} +1 -1
  100. package/dist/assets/{index-CySEKiOM.js → index-DfNDAgds.js} +1 -1
  101. package/dist/assets/{index-DmsOwDxy.js → index-Dhvt7Ym5.js} +1 -1
  102. package/dist/assets/{index-gW2LRVpQ.js → index-DlSAbZi-.js} +3 -3
  103. package/dist/assets/{index-CeVw-yV4.js → index-DtjFcFmK.js} +1 -1
  104. package/dist/assets/{index-D49gl1dV.js → index-Dzu3wxna.js} +1 -1
  105. package/dist/assets/{index-D09yH344.js → index-HBK_8R63.js} +1 -1
  106. package/dist/assets/{index-Br_3Odot.js → index-LVdYaQel.js} +1 -1
  107. package/dist/assets/{index-CaHbIkEa.js → index-MZp194nt.js} +1 -1
  108. package/dist/assets/{index-B6CCglEp.js → index-NSWrBRrw.js} +1 -1
  109. package/dist/assets/{index-DSki-yHd.js → index-P7EocbaR.js} +3 -3
  110. package/dist/assets/{index-DAIx6BU9.js → index-WAAPLubj.js} +9 -9
  111. package/dist/assets/{index-CusFNu14.js → index-Xe9_eawT.js} +1 -1
  112. package/dist/assets/{index-BOjP8MFh.js → index-_78XKglK.js} +1 -1
  113. package/dist/assets/{index-aQCP0zMr.js → index-_hnO--KV.js} +3 -3
  114. package/dist/assets/{index-C4bxvfjr.js → index-baJkBr-j.js} +1 -1
  115. package/dist/assets/{index-Cqnb030V.js → index-k7J3AIEr.js} +1 -1
  116. package/dist/assets/{index-CsR2mhWN.js → index-mby9-hlE.js} +1 -1
  117. package/dist/assets/{index-C0xGIN2P.js → index-oFfuKxtZ.js} +1 -1
  118. package/dist/assets/{index.esm-DNw2WsMP.js → index.esm-BnAlHHpx.js} +1 -1
  119. package/dist/assets/{install-from-url-ChxBmd8y.js → install-from-url-BfkA5qq5.js} +1 -1
  120. package/dist/assets/{invitation-CK-9fzay.js → invitation-B1Hci8ad.js} +1 -1
  121. package/dist/assets/{is-path-prefix-equal-z6rXFfWF.js → is-path-prefix-equal-CEDKDnds.js} +1 -1
  122. package/dist/assets/{item-Bi4YOXoV.js → item-C1a2mBPm.js} +1 -1
  123. package/dist/assets/{javascript-gR9EmbFN.js → javascript-dyXRvlcK.js} +1 -1
  124. package/dist/assets/{jsonMode-C2iokhm3.js → jsonMode-DzE7SlMT.js} +1 -1
  125. package/dist/assets/{liquid-DlmH91G9.js → liquid-BLSJYKFn.js} +1 -1
  126. package/dist/assets/{list-header-CiZSpcHw.js → list-header-Xr78rkjh.js} +1 -1
  127. package/dist/assets/{lock.svg-D4RerwXL.js → lock.svg-BDo5OQLw.js} +1 -1
  128. package/dist/assets/{log-fHnfsRRc.js → log-B5fdFoWr.js} +1 -1
  129. package/dist/assets/{lottie-react.esm-DwGuMXwe.js → lottie-react.esm-BRx0CrdN.js} +1 -1
  130. package/dist/assets/{mdx-B4KL37qQ.js → mdx-DUcuNLZ_.js} +1 -1
  131. package/dist/assets/{memory-_jD3viB0.js → memory-Bu_eYXVV.js} +1 -1
  132. package/dist/assets/{metric-D-n9wLBp.js → metric-BRD42HhW.js} +1 -1
  133. package/dist/assets/omit-BbisAClK.js +1 -0
  134. package/dist/assets/{overview-DTGYE6TZ.js → overview-DnP-6Mqs.js} +1 -1
  135. package/dist/assets/{permission-a5zDq7rM.js → permission-BXLhf3R0.js} +1 -1
  136. package/dist/assets/{preference-B-CYFAI3.js → preference-BzQl99QW.js} +3 -3
  137. package/dist/assets/{python-BM52WTwZ.js → python-BnPAt3qA.js} +1 -1
  138. package/dist/assets/{raf-schd.esm-B5OMlrCf.js → raf-schd.esm-BXbZksWn.js} +1 -1
  139. package/dist/assets/{razor-DrYd4877.js → razor-CduynFng.js} +1 -1
  140. package/dist/assets/{rotate-session-key-DETYEvOS.js → rotate-session-key-DstPsh_a.js} +1 -1
  141. package/dist/assets/{runtime-C5Qv_-EQ.js → runtime-CjIgfnHt.js} +1 -1
  142. package/dist/assets/schema-BzTdGgcj.js +1 -0
  143. package/dist/assets/sdk-0S2KBs8w.js +1 -0
  144. package/dist/assets/{service-CU627QjX.js → service-CgXroyDr.js} +1 -1
  145. package/dist/assets/{shorten-label-izVabXeE.js → shorten-label-3hNyntjL.js} +1 -1
  146. package/dist/assets/{simple-select-BSptVRvh.js → simple-select-Ci2yAG8G.js} +1 -1
  147. package/dist/assets/{spaces-CGMxc8V-.js → spaces-DHFupx5x.js} +1 -1
  148. package/dist/assets/{status-DsuywKQN.js → status-C8F30-2_.js} +1 -1
  149. package/dist/assets/{status-Cc65Exxv.js → status-i4b_7SEt.js} +1 -1
  150. package/dist/assets/{switch-control-BrQIub8A.js → switch-control-BPmq_LUk.js} +1 -1
  151. package/dist/assets/{table-icons-hVAZnA0-.js → table-icons-DNUbhod4.js} +1 -1
  152. package/dist/assets/{team-651xYHqY.js → team-DUFIrJZB.js} +1 -1
  153. package/dist/assets/{toLower-BTh_yPFG.js → toLower-mlBM75tb.js} +1 -1
  154. package/dist/assets/toUpper-DiLJ8xtF.js +1 -0
  155. package/dist/assets/{traffic-DEO0b2pJ.js → traffic-Cax4LCF4.js} +1 -1
  156. package/dist/assets/{tsMode-DFoW-qGq.js → tsMode-DZI4Je6h.js} +1 -1
  157. package/dist/assets/{typescript-yTEHeHqu.js → typescript-BcCZdteQ.js} +1 -1
  158. package/dist/assets/{url-evaluation-htR8cP0c.js → url-evaluation-B8wdjuzT.js} +1 -1
  159. package/dist/assets/{url-join-CvBUjlHE.js → url-join-C_wXQJkg.js} +1 -1
  160. package/dist/assets/{use-mobile-B2fvjcjL.js → use-mobile-UkcNMy9o.js} +1 -1
  161. package/dist/assets/{use-mobile-CD0b5-fF.js → use-mobile-nZ7DBF8e.js} +1 -1
  162. package/dist/assets/{useAsync-DTSaiLA6.js → useAsync-AHQa-tEg.js} +1 -1
  163. package/dist/assets/{useAsyncRetry-3oMBxbWI.js → useAsyncRetry-BsBg8EC6.js} +1 -1
  164. package/dist/assets/{useLocalStorage-pDiaOOl8.js → useLocalStorage-CLwjyMkh.js} +1 -1
  165. package/dist/assets/{useThemeProps-D2o2I8tH.js → useThemeProps-qKz8U_K7.js} +1 -1
  166. package/dist/assets/{util-CO7za6kW.js → util-BRRRfGvR.js} +1 -1
  167. package/dist/assets/{wait-container-CKMtOVZ5.js → wait-container-C1xtJsis.js} +1 -1
  168. package/dist/assets/{without-wallet-Bz0faV9X.js → without-wallet-DlU2ZB3p.js} +1 -1
  169. package/dist/assets/wrap-locale-DwPSR3NV.js +1 -0
  170. package/dist/assets/{xml-DOoQrL1t.js → xml-CJOrT7vU.js} +1 -1
  171. package/dist/assets/{yaml-CEc3MOv9.js → yaml-C3gqC8Oa.js} +1 -1
  172. package/dist/index.html +1 -1
  173. package/package.json +1 -1
  174. package/dist/assets/ArrowDropDown-CbNJotqT.js +0 -1
  175. package/dist/assets/api-IHWlq8qW.js +0 -1
  176. package/dist/assets/cloneDeep-DvQOj2-I.js +0 -1
  177. package/dist/assets/emotion-cache.browser.esm-B4otC3_4.js +0 -1
  178. package/dist/assets/engine-B_GmO38d.js +0 -1
  179. package/dist/assets/getValidReactChildren-DUKHPCTn.js +0 -1
  180. package/dist/assets/index-DdF52dPT.js +0 -1
  181. package/dist/assets/omit-CPRZ0B0R.js +0 -1
  182. package/dist/assets/schema-BpWVtFwc.js +0 -1
  183. package/dist/assets/sdk-BCvN9-9d.js +0 -1
  184. package/dist/assets/toUpper-BY5QEPjh.js +0 -1
  185. package/dist/assets/wrap-locale-BbjqZMGZ.js +0 -1
@@ -1,4 +1,4 @@
1
- import{cJ as $m,be as jL,g_ as oT,bb as Xm,bc as Zm,cW as qm,bf as JL,r as QL}from"./index-DpFVufZF.js";/*! *****************************************************************************
1
+ import{cJ as $m,be as jL,g_ as oT,bb as Xm,bc as Zm,cW as qm,bf as JL,r as QL}from"./index-CHD9Cmfg.js";/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- import{ez as k}from"./index-DpFVufZF.js";var m,C;function S(){if(C)return m;C=1;function v(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function A(o,e){for(var r="",i=0,f=-1,t=0,n,l=0;l<=o.length;++l){if(l<o.length)n=o.charCodeAt(l);else{if(n===47)break;n=47}if(n===47){if(!(f===l-1||t===1))if(f!==l-1&&t===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var s=r.lastIndexOf("/");if(s!==r.length-1){s===-1?(r="",i=0):(r=r.slice(0,s),i=r.length-1-r.lastIndexOf("/")),f=l,t=0;continue}}else if(r.length===2||r.length===1){r="",i=0,f=l,t=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+o.slice(f+1,l):r=o.slice(f+1,l),i=l-f-1;f=l,t=0}else n===46&&t!==-1?++t:t=-1}return r}function b(o,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+o+i:i}var g={resolve:function(){for(var e="",r=!1,i,f=arguments.length-1;f>=-1&&!r;f--){var t;f>=0?t=arguments[f]:(i===void 0&&(i=k.cwd()),t=i),v(t),t.length!==0&&(e=t+"/"+e,r=t.charCodeAt(0)===47)}return e=A(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(v(e),e.length===0)return".";var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=A(e,!r),e.length===0&&!r&&(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return v(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];v(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":g.normalize(e)},relative:function(e,r){if(v(e),v(r),e===r||(e=g.resolve(e),r=g.resolve(r),e===r))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var f=e.length,t=f-i,n=1;n<r.length&&r.charCodeAt(n)===47;++n);for(var l=r.length,s=l-n,c=t<s?t:s,u=-1,a=0;a<=c;++a){if(a===c){if(s>c){if(r.charCodeAt(n+a)===47)return r.slice(n+a+1);if(a===0)return r.slice(n+a)}else t>c&&(e.charCodeAt(i+a)===47?u=a:a===0&&(u=0));break}var h=e.charCodeAt(i+a),y=r.charCodeAt(n+a);if(h!==y)break;h===47&&(u=a)}var d="";for(a=i+u+1;a<=f;++a)(a===f||e.charCodeAt(a)===47)&&(d.length===0?d+="..":d+="/..");return d.length>0?d+r.slice(n+u):(n+=u,r.charCodeAt(n)===47&&++n,r.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(v(e),e.length===0)return".";for(var r=e.charCodeAt(0),i=r===47,f=-1,t=!0,n=e.length-1;n>=1;--n)if(r=e.charCodeAt(n),r===47){if(!t){f=n;break}}else t=!1;return f===-1?i?"/":".":i&&f===1?"//":e.slice(0,f)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');v(e);var i=0,f=-1,t=!0,n;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var l=r.length-1,s=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(c===47){if(!t){i=n+1;break}}else s===-1&&(t=!1,s=n+1),l>=0&&(c===r.charCodeAt(l)?--l===-1&&(f=n):(l=-1,f=s))}return i===f?f=s:f===-1&&(f=e.length),e.slice(i,f)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!t){i=n+1;break}}else f===-1&&(t=!1,f=n+1);return f===-1?"":e.slice(i,f)}},extname:function(e){v(e);for(var r=-1,i=0,f=-1,t=!0,n=0,l=e.length-1;l>=0;--l){var s=e.charCodeAt(l);if(s===47){if(!t){i=l+1;break}continue}f===-1&&(t=!1,f=l+1),s===46?r===-1?r=l:n!==1&&(n=1):r!==-1&&(n=-1)}return r===-1||f===-1||n===0||n===1&&r===f-1&&r===i+1?"":e.slice(r,f)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return b("/",e)},parse:function(e){v(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var i=e.charCodeAt(0),f=i===47,t;f?(r.root="/",t=1):t=0;for(var n=-1,l=0,s=-1,c=!0,u=e.length-1,a=0;u>=t;--u){if(i=e.charCodeAt(u),i===47){if(!c){l=u+1;break}continue}s===-1&&(c=!1,s=u+1),i===46?n===-1?n=u:a!==1&&(a=1):n!==-1&&(a=-1)}return n===-1||s===-1||a===0||a===1&&n===s-1&&n===l+1?s!==-1&&(l===0&&f?r.base=r.name=e.slice(1,s):r.base=r.name=e.slice(l,s)):(l===0&&f?(r.name=e.slice(1,n),r.base=e.slice(1,s)):(r.name=e.slice(l,n),r.base=e.slice(l,s)),r.ext=e.slice(n,s)),l>0?r.dir=e.slice(0,l-1):f&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return g.posix=g,m=g,m}export{S as r};
1
+ import{ez as k}from"./index-CHD9Cmfg.js";var m,C;function S(){if(C)return m;C=1;function v(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function A(o,e){for(var r="",i=0,f=-1,t=0,n,l=0;l<=o.length;++l){if(l<o.length)n=o.charCodeAt(l);else{if(n===47)break;n=47}if(n===47){if(!(f===l-1||t===1))if(f!==l-1&&t===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var s=r.lastIndexOf("/");if(s!==r.length-1){s===-1?(r="",i=0):(r=r.slice(0,s),i=r.length-1-r.lastIndexOf("/")),f=l,t=0;continue}}else if(r.length===2||r.length===1){r="",i=0,f=l,t=0;continue}}e&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+o.slice(f+1,l):r=o.slice(f+1,l),i=l-f-1;f=l,t=0}else n===46&&t!==-1?++t:t=-1}return r}function b(o,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+o+i:i}var g={resolve:function(){for(var e="",r=!1,i,f=arguments.length-1;f>=-1&&!r;f--){var t;f>=0?t=arguments[f]:(i===void 0&&(i=k.cwd()),t=i),v(t),t.length!==0&&(e=t+"/"+e,r=t.charCodeAt(0)===47)}return e=A(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(v(e),e.length===0)return".";var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=A(e,!r),e.length===0&&!r&&(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return v(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,r=0;r<arguments.length;++r){var i=arguments[r];v(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":g.normalize(e)},relative:function(e,r){if(v(e),v(r),e===r||(e=g.resolve(e),r=g.resolve(r),e===r))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var f=e.length,t=f-i,n=1;n<r.length&&r.charCodeAt(n)===47;++n);for(var l=r.length,s=l-n,c=t<s?t:s,u=-1,a=0;a<=c;++a){if(a===c){if(s>c){if(r.charCodeAt(n+a)===47)return r.slice(n+a+1);if(a===0)return r.slice(n+a)}else t>c&&(e.charCodeAt(i+a)===47?u=a:a===0&&(u=0));break}var h=e.charCodeAt(i+a),y=r.charCodeAt(n+a);if(h!==y)break;h===47&&(u=a)}var d="";for(a=i+u+1;a<=f;++a)(a===f||e.charCodeAt(a)===47)&&(d.length===0?d+="..":d+="/..");return d.length>0?d+r.slice(n+u):(n+=u,r.charCodeAt(n)===47&&++n,r.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(v(e),e.length===0)return".";for(var r=e.charCodeAt(0),i=r===47,f=-1,t=!0,n=e.length-1;n>=1;--n)if(r=e.charCodeAt(n),r===47){if(!t){f=n;break}}else t=!1;return f===-1?i?"/":".":i&&f===1?"//":e.slice(0,f)},basename:function(e,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');v(e);var i=0,f=-1,t=!0,n;if(r!==void 0&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var l=r.length-1,s=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(c===47){if(!t){i=n+1;break}}else s===-1&&(t=!1,s=n+1),l>=0&&(c===r.charCodeAt(l)?--l===-1&&(f=n):(l=-1,f=s))}return i===f?f=s:f===-1&&(f=e.length),e.slice(i,f)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!t){i=n+1;break}}else f===-1&&(t=!1,f=n+1);return f===-1?"":e.slice(i,f)}},extname:function(e){v(e);for(var r=-1,i=0,f=-1,t=!0,n=0,l=e.length-1;l>=0;--l){var s=e.charCodeAt(l);if(s===47){if(!t){i=l+1;break}continue}f===-1&&(t=!1,f=l+1),s===46?r===-1?r=l:n!==1&&(n=1):r!==-1&&(n=-1)}return r===-1||f===-1||n===0||n===1&&r===f-1&&r===i+1?"":e.slice(r,f)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return b("/",e)},parse:function(e){v(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return r;var i=e.charCodeAt(0),f=i===47,t;f?(r.root="/",t=1):t=0;for(var n=-1,l=0,s=-1,c=!0,u=e.length-1,a=0;u>=t;--u){if(i=e.charCodeAt(u),i===47){if(!c){l=u+1;break}continue}s===-1&&(c=!1,s=u+1),i===46?n===-1?n=u:a!==1&&(a=1):n!==-1&&(a=-1)}return n===-1||s===-1||a===0||a===1&&n===s-1&&n===l+1?s!==-1&&(l===0&&f?r.base=r.name=e.slice(1,s):r.base=r.name=e.slice(l,s)):(l===0&&f?(r.name=e.slice(1,n),r.base=e.slice(1,s)):(r.name=e.slice(l,n),r.base=e.slice(l,s)),r.ext=e.slice(n,s)),l>0?r.dir=e.slice(0,l-1):f&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return g.posix=g,m=g,m}export{S as r};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-gW2LRVpQ.js","./index-DpFVufZF.js","./index-DGkT7afN.css","./url-join-CvBUjlHE.js","./index-BOjP8MFh.js","./_createAggregator-Btgpq5ky.js","./depsEqual-BIKlqTyk.js","./index-_p9TGBvO.js","./index-DRYJ0xIl.js","./toUpper-BY5QEPjh.js","./index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
- import{aF as Ae,j as t,dt as _s,gz as Ss,iA as Es,V as de,bo as ye,K as B,O as be,H as Y,o as x,f as gt,r as k,p as Se,bG as st,b as je,i as X,X as Un,bF as ft,Y as xe,iB as ks,t as Ce,s as oe,a4 as he,aW as uo,T as ue,$ as Zt,dI as mt,y as _e,b9 as Rs,bK as Ps,aH as H,b2 as Ts,go as Is,gp as Ds,C as we,f5 as po,hy as Wn,x as Bs,ax as Kt,w as Os,iC as Us,iD as Ns,v as Be,iE as Ls,Z as As,a0 as Ms,iF as fo,bp as mo,R as Ne,f7 as zs,f2 as Fs,aA as qs,aB as $s,bl as Ws,aC as Hs,aD as fe,aO as Ks,cS as Gs,S as Vs,eO as cr,bj as Ys,h as Zs,dx as It,iG as Xs,f$ as ho,iH as Qs,iI as Js,ez as me,iJ as go,dG as ei,iK as ti,ha as ni,fP as ri,iL as oi,cJ as dr,ht as Hn,av as si,bB as Xt,dq as ze,bv as ii,bw as ur,z as Gt,cw as ai,G as Fe,aP as pr,gk as xo,aT as He,h6 as li,bE as kt,cp as fr,hr as ci,fn as mr,bh as di,L as xt,E as yo,bn as ui,_ as pi,M as Rt,a_ as Kn,iM as fi,a$ as Le,az as hr,cQ as mi,ad as it,aM as vo,bY as Gn,cB as hi,iN as gi,ba as xi,A as Vn,aV as Nn,g as yi,aS as ut,N as fn,W as vi,bH as Co,aI as Ci,by as bo,aR as bi,fe as gr,g7 as xr,g8 as yr,U as vr,cP as ji,g9 as wi,bX as _i,iO as Si}from"./index-DpFVufZF.js";import{y as Ei}from"./index-BruXFS68.js";import{a as ki,S as Ri,u as Yn}from"./actions-Bsd5QbHY.js";import{S as Pi,a as Ti}from"./switch-control-BrQIub8A.js";import{u as De}from"./blocklet-9wr_FD8g.js";import{P as Ln,w as Qt}from"./permission-a5zDq7rM.js";import{E as jo}from"./Edit-fbuEYDWz.js";import{T as Ii,M as Di,t as Bi}from"./table-icons-hVAZnA0-.js";import{s as Oi,F as wo,A as Ui,b as Ni,c as Li,d as Ai,R as ot,L as Mi,I as zi,S as dt,a as Pt,B as Fi}from"./preference-B-CYFAI3.js";import{C as Cr}from"./click-to-copy-BkgGJ2iu.js";import{v as mn}from"./index-C6w6MwHd.js";import{A as qi}from"./Add-DwgbzyUw.js";import{A as Jt}from"./Link-Bum1u5am.js";import{C as $i,c as Wi,b as Hi,f as _o,A as Ki,_ as Gi,a as Vi,e as Yi,d as So,s as Zi,L as Xi,u as Qi,g as Ji,S as ea}from"./item-Bi4YOXoV.js";import{T as ta,L as na,a as An,u as br,W as ra,P as oa}from"./index-D09yH344.js";import{e as Eo}from"./engine-B_GmO38d.js";import{u as sa,C as ia,D as aa,a as la,b as ca,S as da}from"./connect-to-D7kv9JZG.js";import{C as ua,u as pa,A as fa}from"./agreement-CR0Ele2A.js";import{D as ko}from"./Done-BD3-Bno_.js";import{C as ma}from"./Google-DYe0WpSM.js";import{I as Ro,f as ha,a as ga,B as xa}from"./install-from-url-ChxBmd8y.js";import{a as jr}from"./api-IHWlq8qW.js";import{v as Po,e as ya,a as Vt}from"./util-CO7za6kW.js";import{u as To}from"./use-mobile-CD0b5-fF.js";import{A as va}from"./ArrowDropDown-CbNJotqT.js";import{u as Ca}from"./useLocalStorage-pDiaOOl8.js";import{r as en}from"./index-BOjP8MFh.js";import{b as tn}from"./without-wallet-Bz0faV9X.js";import{E as Zn}from"./ErrorOutline-eTinVSTi.js";import{H as ba}from"./HelpOutline-CTq25q-V.js";import{C as ja}from"./lock.svg-D4RerwXL.js";import{D as nn}from"./Delete-zum6vOfn.js";import{L as Io}from"./Launch-BMpdke3b.js";import{D as wa}from"./delete-confirm-DsbMbRAa.js";import{W as ht,B as Mn,m as _a}from"./status-Cc65Exxv.js";import{R as Sa}from"./Replay-CUAnOum2.js";import{R as Ea,a as wr}from"./url-evaluation-htR8cP0c.js";import{A as Do}from"./actions-PjGF5ddj.js";import{v as hn}from"./index-FOfUOpKU.js";import{t as ka}from"./toUpper-BY5QEPjh.js";import{a as Ra}from"./team-651xYHqY.js";import"./MoreVert-Bs574HAx.js";import"./DeleteOutline-BRn6KXm4.js";import"./get-safe-url-DcDP4eG0.js";import"./ButtonGroup-Td8BNrZx.js";import"./getValidReactChildren-DUKHPCTn.js";import"./FilterList-CoptEImh.js";import"./CSSTransition-y8iKTN7d.js";import"./emotion-cache.browser.esm-B4otC3_4.js";import"./index-DBii9-f-.js";import"./typeof-QjJsDpFa.js";import"./raf-schd.esm-B5OMlrCf.js";import"./redux-DfszZyTl.js";import"./useThemeProps-D2o2I8tH.js";import"./html-title-CFJOQU04.js";import"./Clear-CP-1JSsG.js";import"./ChevronRight-CRb5GVq5.js";import"./ChevronLeft-nSrR9D_I.js";import"./Search-CCrESOjg.js";import"./omit-CPRZ0B0R.js";import"./edit.svg-_S0cvmEV.js";import"./index-_p9TGBvO.js";import"./iframe-DTPDSES_.js";import"./index-Cj3feFCu.js";import"./KeyboardArrowDown-DBKPniSI.js";import"./Autocomplete-Dm1_2YSl.js";import"./ListSubheader-DmTgdBz5.js";import"./Verified-D2LDOD6a.js";import"./VerifiedUser-dJrRBh25.js";import"./url-join-CvBUjlHE.js";import"./index-BojVbZw0.js";import"./spaces-CGMxc8V-.js";import"./OpenInNew-Df7bSVHt.js";import"./index-DRYJ0xIl.js";import"./index-D49gl1dV.js";import"./decode-DPztD6kB.js";import"./cloneDeep-DvQOj2-I.js";import"./ListItemButton-DAHFrrOj.js";import"./Stepper-CDtZbh-4.js";import"./is-path-prefix-equal-z6rXFfWF.js";const Pa=Ae(t.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),Ta=Ae(t.jsx("path",{d:"m19 8-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4z"})),Ia=Ae(t.jsx("path",{d:"M8 5v14l11-7z"})),Bo=Ae(t.jsx("path",{d:"M22 5.18 10.59 16.6l-4.24-4.24 1.41-1.41 2.83 2.83 10-10zm-2.21 5.04c.13.57.21 1.17.21 1.78 0 4.42-3.58 8-8 8s-8-3.58-8-8 3.58-8 8-8c1.58 0 3.04.46 4.28 1.25l1.44-1.44C16.1 2.67 14.13 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-1.19-.22-2.33-.6-3.39z"})),Da=Ae(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"})),Oo=Ae(t.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),Ba=Ae(t.jsx("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"})),Oa=Ae(t.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),Ua=Ae(t.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),Na=Ae(t.jsx("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"}));function _r(e,r){var n={};return r=_s(r),Ss(e,function(i,a,o){Es(n,a,r(i,a,o))}),n}function Uo({children:e=null,...r}){const{t:n}=de(),{api:i}=ye(),{blocklet:a}=De(),o=a?.settings?.autoCheckUpdate,f=async l=>{await i.updateAutoCheckUpdate({input:{did:a.meta.did,autoCheckUpdate:l}})},c=async()=>{try{const l=!o?.enabled;await f({enabled:l}),Y.success(n(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){Y.error(l.message)}},d=!!o?.enabled;return t.jsxs(B,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e,t.jsx(be,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Pi,{checked:d,onChange:c,name:"enableWelcomePage",style:{...r.style,zoom:.8}})})})]})}Uo.propTypes={children:x.any};function Sr(e){function r({sx:n,...i}){return t.jsx(e,{...i,sx:{color:"text.primary",...n}})}return r}const La={..._r(Bi,Sr),..._r(ki,Sr)},Aa=(e,r)=>{let{description:n}=e;return(Object.values(je.CHAIN_PROP_MAP).includes(e.key)||X.isEnvShareable(e))&&(n?n=`${n} (${r("blocklet.config.sharedToAllComponents")})`:n=r("blocklet.config.sharedToAllComponents")),n&&t.jsx("div",{style:{marginLeft:12},children:n})},gn=(e,r,n=[])=>!n?.length&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!r.meta.environments.find(i=>i.name===e.key)&&r.children.every(i=>!i.meta.environments.find(a=>a.name===e.key))?!0:e.custom,Er=e=>[je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),xn=e=>[je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function No({blocklet:e,ancestors:r=[]}){const n=ye(),{palette:i}=gt(),{inService:a}=n,{t:o}=k.useContext(Se),f=[...r.map(s=>s.meta.did),e.meta.did],c=()=>Y.success(o("blocklet.config.changedTip")),d=s=>gn(s,e,r);if(st(e.status)||e.status==="unknown"&&st(e.status))return null;const l=s=>new Promise(async(h,b)=>{if(!s.key.trim()||!s.value.trim()){Y.error(o("blocklet.config.environment.keyValueRequired")),b();return}if(Er(s.key)===!1){Y.error(o("blocklet.config.environment.invalidKey")),b();return}s.custom=xn(s.key);try{const R=await n.api.configBlocklet({input:{did:f,configs:[s]}});c(R.blocklet),h()}catch(R){Y.error(xe(R)),b()}}),y=(s,h)=>new Promise(async(b,R)=>{if(s.required&&(!s.key.trim()||!s.value.trim())){Y.error(o("blocklet.config.environment.keyValueRequired")),R();return}if(Er(s.key)===!1){Y.error(o("blocklet.config.environment.invalidKey")),R();return}if(s.key===je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const M=ks(s);if(M){Y.error(M),R();return}}const E=[{...s,value:s.secure&&s.value==="__encrypted__"?"":s.value}];if(s.key!==h.key){if(!gn(s,e,r)){Y.error("Only key of custom env can be changed"),R();return}E.push({key:h.key,custom:xn(s.key)})}try{const M=await n.api.configBlocklet({input:{did:f,configs:E}});c(M.blocklet),b()}catch(M){Y.error(xe(M)),R()}}),p=s=>new Promise(async(h,b)=>{if(s.required){Y.error(o("blocklet.config.environment.deleteForbidden")),b();return}if(!gn(s,e,r)){Y.error(o("environmentTips.deleteForbidden")),b();return}try{const R=await n.api.configBlocklet({input:{did:f,configs:[{key:s.key,custom:xn(s.key)}]}});c(R.blocklet),h()}catch(R){Y.error(xe(R)),b()}}),C=(e.configs||[]).filter(s=>!je.BLOCKLET_CONFIGURABLE_KEY[s.key]||[je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(s.key)),m=X.getSharedConfigObj(r[0],e),v=X.getComponentMissingConfigs(e,r[0]),j=C.map(s=>({...s,value:Object.values(je.CHAIN_PROP_MAP).includes(s.key)&&Object.keys(m).includes(s.key)?m[s.key]:m[s.key]||s.value})),w=j.some(s=>s.key&&s.key.startsWith("BWA_")),S={onRowAdd:l,onRowUpdate:y,onRowDelete:p,isDeletable:d},u=()=>[{title:o("common.key"),field:"key",initialEditValue:"",width:"30%",render:s=>t.jsx(Cr,{value:s.value,style:{color:s.required&&!s.value?i.error.main:i.text.primary,fontWeight:s.required?"bold":"normal"},children:s.key}),editComponent:s=>{const{value:h,rowData:b,onChange:R}=s;return t.jsx(kr,{children:t.jsx(Ce,{fullWidth:!0,size:"small",value:Oi.escapeTag(h),onChange:E=>R(E.target.value),variant:"outlined",label:"Key",placeholder:o("blocklet.config.environment.key"),margin:"dense",autoFocus:!0,slotProps:{input:{readOnly:d(b)===!1}}})})}},{title:o("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:s=>s.value?s.secure?"******":t.jsx(Cr,{unstyled:!0,value:s.value,style:{wordBreak:"break-all"},children:s.value}):null,editComponent:s=>{const{value:h,rowData:b,onChange:R}=s;return t.jsxs(kr,{children:[t.jsx(Ce,{fullWidth:!0,size:"small",value:h==="__encrypted__"?"":h,onChange:E=>R(E.target.value),variant:"outlined",label:o("common.value"),placeholder:o("blocklet.config.environment.value"),margin:"dense"}),Aa(b,o)]})}}];return t.jsxs(Ma,{children:[!!v.length&&t.jsx(Un,{severity:"error",style:{marginTop:24},children:o("blocklet.config.missingRequired")}),w&&t.jsx(Un,{severity:"info",children:o("blocklet.config.environment.tip")}),t.jsx(Ln,{permission:a?"":"mutate_blocklets",role:a?ft:[],children:s=>t.jsx(Ii,{className:"config-table",children:t.jsx(Di,{title:t.jsx(B,{sx:{fontWeight:"bold"},children:o("common.environments")}),columns:u(),icons:La,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:o("common.actions")},body:{emptyDataSourceMessage:o("common.noData"),editRow:{deleteText:o("environmentTips.delete")}}},data:j,editable:s?S:{}})})})]})}No.propTypes={blocklet:x.object.isRequired,ancestors:x.array};const Ma=oe.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DlSAbZi-.js","./index-CHD9Cmfg.js","./index-DGkT7afN.css","./url-join-C_wXQJkg.js","./index-_78XKglK.js","./_createAggregator-o5us6YWd.js","./depsEqual-DYZrAOrY.js","./index-ByV5lrBo.js","./index-DRYJ0xIl.js","./toUpper-DiLJ8xtF.js","./index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
+ import{aF as Ae,j as t,dt as _s,gz as Ss,iA as Es,V as de,bo as ye,K as B,O as be,H as Y,o as x,f as gt,r as k,p as Se,bG as st,b as je,i as X,X as Un,bF as ft,Y as xe,iB as ks,t as Ce,s as oe,a4 as he,aW as uo,T as ue,$ as Zt,dI as mt,y as _e,b9 as Rs,bK as Ps,aH as H,b2 as Ts,go as Is,gp as Ds,C as we,f5 as po,hy as Wn,x as Bs,ax as Kt,w as Os,iC as Us,iD as Ns,v as Be,iE as Ls,Z as As,a0 as Ms,iF as fo,bp as mo,R as Ne,f7 as zs,f2 as Fs,aA as qs,aB as $s,bl as Ws,aC as Hs,aD as fe,aO as Ks,cS as Gs,S as Vs,eO as cr,bj as Ys,h as Zs,dx as It,iG as Xs,f$ as ho,iH as Qs,iI as Js,ez as me,iJ as go,dG as ei,iK as ti,ha as ni,fP as ri,iL as oi,cJ as dr,ht as Hn,av as si,bB as Xt,dq as ze,bv as ii,bw as ur,z as Gt,cw as ai,G as Fe,aP as pr,gk as xo,aT as He,h6 as li,bE as kt,cp as fr,hr as ci,fn as mr,bh as di,L as xt,E as yo,bn as ui,_ as pi,M as Rt,a_ as Kn,iM as fi,a$ as Le,az as hr,cQ as mi,ad as it,aM as vo,bY as Gn,cB as hi,iN as gi,ba as xi,A as Vn,aV as Nn,g as yi,aS as ut,N as fn,W as vi,bH as Co,aI as Ci,by as bo,aR as bi,fe as gr,g7 as xr,g8 as yr,U as vr,cP as ji,g9 as wi,bX as _i,iO as Si}from"./index-CHD9Cmfg.js";import{y as Ei}from"./index-Cd1OxNJr.js";import{a as ki,S as Ri,u as Yn}from"./actions-D7UfMRLN.js";import{S as Pi,a as Ti}from"./switch-control-BPmq_LUk.js";import{u as De}from"./blocklet-CFzK39yZ.js";import{P as Ln,w as Qt}from"./permission-BXLhf3R0.js";import{E as jo}from"./Edit-C68BL33Z.js";import{T as Ii,M as Di,t as Bi}from"./table-icons-DNUbhod4.js";import{s as Oi,F as wo,A as Ui,b as Ni,c as Li,d as Ai,R as ot,L as Mi,I as zi,S as dt,a as Pt,B as Fi}from"./preference-BzQl99QW.js";import{C as Cr}from"./click-to-copy-B1d42v9P.js";import{v as mn}from"./index-CtaGvMIP.js";import{A as qi}from"./Add-DmAZpTAX.js";import{A as Jt}from"./Link-CkO8lOlM.js";import{C as $i,c as Wi,b as Hi,f as _o,A as Ki,_ as Gi,a as Vi,e as Yi,d as So,s as Zi,L as Xi,u as Qi,g as Ji,S as ea}from"./item-C1a2mBPm.js";import{T as ta,L as na,a as An,u as br,W as ra,P as oa}from"./index-HBK_8R63.js";import{e as Eo}from"./engine-C48PkCS2.js";import{u as sa,C as ia,D as aa,a as la,b as ca,S as da}from"./connect-to-DoKSgfqT.js";import{C as ua,u as pa,A as fa}from"./agreement-BQjQnRA5.js";import{D as ko}from"./Done-D15PfZFX.js";import{C as ma}from"./Google-0c2PtiDt.js";import{I as Ro,f as ha,a as ga,B as xa}from"./install-from-url-BfkA5qq5.js";import{a as jr}from"./api-DVPCT3Hv.js";import{v as Po,e as ya,a as Vt}from"./util-BRRRfGvR.js";import{u as To}from"./use-mobile-nZ7DBF8e.js";import{A as va}from"./ArrowDropDown-C5HLN-JN.js";import{u as Ca}from"./useLocalStorage-CLwjyMkh.js";import{r as en}from"./index-_78XKglK.js";import{b as tn}from"./without-wallet-DlU2ZB3p.js";import{E as Zn}from"./ErrorOutline-r8z8_0k8.js";import{H as ba}from"./HelpOutline-X8WyhtRN.js";import{C as ja}from"./lock.svg-BDo5OQLw.js";import{D as nn}from"./Delete-Qei5VqRe.js";import{L as Io}from"./Launch-CEhi4fOh.js";import{D as wa}from"./delete-confirm-POXo6hH3.js";import{W as ht,B as Mn,m as _a}from"./status-i4b_7SEt.js";import{R as Sa}from"./Replay-Dbrib_q2.js";import{R as Ea,a as wr}from"./url-evaluation-B8wdjuzT.js";import{A as Do}from"./actions-w0p6XVub.js";import{v as hn}from"./index-8DkeDWz0.js";import{t as ka}from"./toUpper-DiLJ8xtF.js";import{a as Ra}from"./team-DUFIrJZB.js";import"./MoreVert-CeEDj1aH.js";import"./DeleteOutline-BMoxlkvD.js";import"./get-safe-url-C4fVKi22.js";import"./ButtonGroup-D0vK9rJe.js";import"./getValidReactChildren-CqYTFgwI.js";import"./FilterList-Ctqdg3pC.js";import"./CSSTransition-kYwC_AYj.js";import"./emotion-cache.browser.esm-CuK33BMV.js";import"./index-DBii9-f-.js";import"./typeof-QjJsDpFa.js";import"./raf-schd.esm-BXbZksWn.js";import"./redux-DfszZyTl.js";import"./useThemeProps-qKz8U_K7.js";import"./html-title-nz5vmr92.js";import"./Clear-obXZ0PRj.js";import"./ChevronRight-ZsluCIi3.js";import"./ChevronLeft-Cu8az6Ql.js";import"./Search-BtkTxHX-.js";import"./omit-BbisAClK.js";import"./edit.svg-Bt1rUdxu.js";import"./index-ByV5lrBo.js";import"./iframe-D0_BJlWL.js";import"./index-DcwVNsRb.js";import"./KeyboardArrowDown-ChJWcs80.js";import"./Autocomplete-BvGMj8d2.js";import"./ListSubheader--_-XKbS8.js";import"./Verified-DWuUc_op.js";import"./VerifiedUser-hJ3mj0BI.js";import"./url-join-C_wXQJkg.js";import"./index-BojVbZw0.js";import"./spaces-DHFupx5x.js";import"./OpenInNew-Cs-AwdZR.js";import"./index-DRYJ0xIl.js";import"./index-Dzu3wxna.js";import"./decode-DPztD6kB.js";import"./cloneDeep-BuzpQSpL.js";import"./ListItemButton-CVZEvzBW.js";import"./Stepper-B30VS8qM.js";import"./is-path-prefix-equal-CEDKDnds.js";const Pa=Ae(t.jsx("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"})),Ta=Ae(t.jsx("path",{d:"m19 8-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4z"})),Ia=Ae(t.jsx("path",{d:"M8 5v14l11-7z"})),Bo=Ae(t.jsx("path",{d:"M22 5.18 10.59 16.6l-4.24-4.24 1.41-1.41 2.83 2.83 10-10zm-2.21 5.04c.13.57.21 1.17.21 1.78 0 4.42-3.58 8-8 8s-8-3.58-8-8 3.58-8 8-8c1.58 0 3.04.46 4.28 1.25l1.44-1.44C16.1 2.67 14.13 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-1.19-.22-2.33-.6-3.39z"})),Da=Ae(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"})),Oo=Ae(t.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),Ba=Ae(t.jsx("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"})),Oa=Ae(t.jsx("path",{d:"M5 20h14v-2H5zm0-10h4v6h6v-6h4l-7-7z"})),Ua=Ae(t.jsx("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),Na=Ae(t.jsx("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"}));function _r(e,r){var n={};return r=_s(r),Ss(e,function(i,a,o){Es(n,a,r(i,a,o))}),n}function Uo({children:e=null,...r}){const{t:n}=de(),{api:i}=ye(),{blocklet:a}=De(),o=a?.settings?.autoCheckUpdate,f=async l=>{await i.updateAutoCheckUpdate({input:{did:a.meta.did,autoCheckUpdate:l}})},c=async()=>{try{const l=!o?.enabled;await f({enabled:l}),Y.success(n(l?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(l){Y.error(l.message)}},d=!!o?.enabled;return t.jsxs(B,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e,t.jsx(be,{title:n("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Pi,{checked:d,onChange:c,name:"enableWelcomePage",style:{...r.style,zoom:.8}})})})]})}Uo.propTypes={children:x.any};function Sr(e){function r({sx:n,...i}){return t.jsx(e,{...i,sx:{color:"text.primary",...n}})}return r}const La={..._r(Bi,Sr),..._r(ki,Sr)},Aa=(e,r)=>{let{description:n}=e;return(Object.values(je.CHAIN_PROP_MAP).includes(e.key)||X.isEnvShareable(e))&&(n?n=`${n} (${r("blocklet.config.sharedToAllComponents")})`:n=r("blocklet.config.sharedToAllComponents")),n&&t.jsx("div",{style:{marginLeft:12},children:n})},gn=(e,r,n=[])=>!n?.length&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!r.meta.environments.find(i=>i.name===e.key)&&r.children.every(i=>!i.meta.environments.find(a=>a.name===e.key))?!0:e.custom,Er=e=>[je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),xn=e=>[je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function No({blocklet:e,ancestors:r=[]}){const n=ye(),{palette:i}=gt(),{inService:a}=n,{t:o}=k.useContext(Se),f=[...r.map(s=>s.meta.did),e.meta.did],c=()=>Y.success(o("blocklet.config.changedTip")),d=s=>gn(s,e,r);if(st(e.status)||e.status==="unknown"&&st(e.status))return null;const l=s=>new Promise(async(h,b)=>{if(!s.key.trim()||!s.value.trim()){Y.error(o("blocklet.config.environment.keyValueRequired")),b();return}if(Er(s.key)===!1){Y.error(o("blocklet.config.environment.invalidKey")),b();return}s.custom=xn(s.key);try{const R=await n.api.configBlocklet({input:{did:f,configs:[s]}});c(R.blocklet),h()}catch(R){Y.error(xe(R)),b()}}),y=(s,h)=>new Promise(async(b,R)=>{if(s.required&&(!s.key.trim()||!s.value.trim())){Y.error(o("blocklet.config.environment.keyValueRequired")),R();return}if(Er(s.key)===!1){Y.error(o("blocklet.config.environment.invalidKey")),R();return}if(s.key===je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const M=ks(s);if(M){Y.error(M),R();return}}const E=[{...s,value:s.secure&&s.value==="__encrypted__"?"":s.value}];if(s.key!==h.key){if(!gn(s,e,r)){Y.error("Only key of custom env can be changed"),R();return}E.push({key:h.key,custom:xn(s.key)})}try{const M=await n.api.configBlocklet({input:{did:f,configs:E}});c(M.blocklet),b()}catch(M){Y.error(xe(M)),R()}}),p=s=>new Promise(async(h,b)=>{if(s.required){Y.error(o("blocklet.config.environment.deleteForbidden")),b();return}if(!gn(s,e,r)){Y.error(o("environmentTips.deleteForbidden")),b();return}try{const R=await n.api.configBlocklet({input:{did:f,configs:[{key:s.key,custom:xn(s.key)}]}});c(R.blocklet),h()}catch(R){Y.error(xe(R)),b()}}),C=(e.configs||[]).filter(s=>!je.BLOCKLET_CONFIGURABLE_KEY[s.key]||[je.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(s.key)),m=X.getSharedConfigObj(r[0],e),v=X.getComponentMissingConfigs(e,r[0]),j=C.map(s=>({...s,value:Object.values(je.CHAIN_PROP_MAP).includes(s.key)&&Object.keys(m).includes(s.key)?m[s.key]:m[s.key]||s.value})),w=j.some(s=>s.key&&s.key.startsWith("BWA_")),S={onRowAdd:l,onRowUpdate:y,onRowDelete:p,isDeletable:d},u=()=>[{title:o("common.key"),field:"key",initialEditValue:"",width:"30%",render:s=>t.jsx(Cr,{value:s.value,style:{color:s.required&&!s.value?i.error.main:i.text.primary,fontWeight:s.required?"bold":"normal"},children:s.key}),editComponent:s=>{const{value:h,rowData:b,onChange:R}=s;return t.jsx(kr,{children:t.jsx(Ce,{fullWidth:!0,size:"small",value:Oi.escapeTag(h),onChange:E=>R(E.target.value),variant:"outlined",label:"Key",placeholder:o("blocklet.config.environment.key"),margin:"dense",autoFocus:!0,slotProps:{input:{readOnly:d(b)===!1}}})})}},{title:o("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:s=>s.value?s.secure?"******":t.jsx(Cr,{unstyled:!0,value:s.value,style:{wordBreak:"break-all"},children:s.value}):null,editComponent:s=>{const{value:h,rowData:b,onChange:R}=s;return t.jsxs(kr,{children:[t.jsx(Ce,{fullWidth:!0,size:"small",value:h==="__encrypted__"?"":h,onChange:E=>R(E.target.value),variant:"outlined",label:o("common.value"),placeholder:o("blocklet.config.environment.value"),margin:"dense"}),Aa(b,o)]})}}];return t.jsxs(Ma,{children:[!!v.length&&t.jsx(Un,{severity:"error",style:{marginTop:24},children:o("blocklet.config.missingRequired")}),w&&t.jsx(Un,{severity:"info",children:o("blocklet.config.environment.tip")}),t.jsx(Ln,{permission:a?"":"mutate_blocklets",role:a?ft:[],children:s=>t.jsx(Ii,{className:"config-table",children:t.jsx(Di,{title:t.jsx(B,{sx:{fontWeight:"bold"},children:o("common.environments")}),columns:u(),icons:La,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:o("common.actions")},body:{emptyDataSourceMessage:o("common.noData"),editRow:{deleteText:o("environmentTips.delete")}}},data:j,editable:s?S:{}})})})]})}No.propTypes={blocklet:x.object.isRequired,ancestors:x.array};const Ma=oe.div`
3
3
  .config-table {
4
4
  margin-bottom: 24px;
5
5
  position: relative;
@@ -66,7 +66,7 @@ import{aF as Ae,j as t,dt as _s,gz as Ss,iA as Es,V as de,bo as ye,K as B,O as b
66
66
  .ux-dialog_closeButton {
67
67
  margin: 0;
68
68
  }
69
- `,Fa=k.lazy(()=>Ps(()=>import("./index-gW2LRVpQ.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).then(e=>({default:e.Uploader}))),qa="/blocklet/component/upload",Rr=[".html",".htm",".tgz",".zip"],$a=Number(window.env?.maxUploadFileSize)||H.MAX_UPLOAD_FILE_SIZE,Wa=$a*1024*1024;function Lo({did:e,prefix:r,headers:n=()=>({}),onUploaded:i=mt,open:a=!1,onClose:o=mt}){const{t:f,locale:c}=de(),d=k.useRef(null),l=k.useCallback(y=>{const{status:p,data:C}=y;if(p===200){i(C);return}Y.error(f("blocklet.component.addComponentTip.uploadFailed"))},[i,f]);return k.useEffect(()=>{a?d.current?.open():d.current?.close()},[a]),t.jsx(Ha,{id:`component-uploader-${e}`,children:t.jsx(Fa,{ref:d,locale:c,popup:!0,disableXssAttack:!0,onUploadFinish:l,plugins:[],onClose:o,installerProps:{disabled:!0},apiPathProps:{uploader:_e(r,qa,e),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:Rr,maxFileSize:Wa,maxNumberOfFiles:1}},tusProps:{headers:n},dashboardProps:{note:f("blocklet.component.addComponentTip.allowedFileTypes",{types:Rr.map(y=>y.replace(".","")).join(", ")})}})},`component-uploader-${e}`)}Lo.propTypes={did:x.string.isRequired,prefix:x.string.isRequired,open:x.bool,headers:x.func,onUploaded:x.func,onClose:x.func};const Ha=Rs(B)`
69
+ `,Fa=k.lazy(()=>Ps(()=>import("./index-DlSAbZi-.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).then(e=>({default:e.Uploader}))),qa="/blocklet/component/upload",Rr=[".html",".htm",".tgz",".zip"],$a=Number(window.env?.maxUploadFileSize)||H.MAX_UPLOAD_FILE_SIZE,Wa=$a*1024*1024;function Lo({did:e,prefix:r,headers:n=()=>({}),onUploaded:i=mt,open:a=!1,onClose:o=mt}){const{t:f,locale:c}=de(),d=k.useRef(null),l=k.useCallback(y=>{const{status:p,data:C}=y;if(p===200){i(C);return}Y.error(f("blocklet.component.addComponentTip.uploadFailed"))},[i,f]);return k.useEffect(()=>{a?d.current?.open():d.current?.close()},[a]),t.jsx(Ha,{id:`component-uploader-${e}`,children:t.jsx(Fa,{ref:d,locale:c,popup:!0,disableXssAttack:!0,onUploadFinish:l,plugins:[],onClose:o,installerProps:{disabled:!0},apiPathProps:{uploader:_e(r,qa,e),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:Rr,maxFileSize:Wa,maxNumberOfFiles:1}},tusProps:{headers:n},dashboardProps:{note:f("blocklet.component.addComponentTip.allowedFileTypes",{types:Rr.map(y=>y.replace(".","")).join(", ")})}})},`component-uploader-${e}`)}Lo.propTypes={did:x.string.isRequired,prefix:x.string.isRequired,open:x.bool,headers:x.func,onUploaded:x.func,onClose:x.func};const Ha=Rs(B)`
70
70
  .uploader-wrapper {
71
71
  display: inline-flex;
72
72
  position: relative;
@@ -1,4 +1,4 @@
1
- import{c1 as Ke,c0 as Fe,r as h,c2 as Ge,j as e,b9 as ee,c4 as Ye,ch as J,c5 as $e,b_ as He,cj as qe,aF as he,M as q,bo as A,cw as Ce,H as B,Y as V,bg as E,fD as we,aQ as Be,b as N,iT as Ve,V as D,gD as Qe,o as f,x as Xe,ax as De,y as fe,al as Ze,p as Je,C as L,T as j,k as et,s as tt,f as st,iU as X,h_ as Z,iV as ot,K as S,aW as K,aH as T,L as nt,g as H,dm as at,O as Se,R as G,aE as Y,a9 as $,a5 as rt,bB as it,fu as ct,b0 as lt,v as pe,w as dt,G as be,Z as Ee,bE as xe,B as pt}from"./index-DpFVufZF.js";import{T as ut}from"./html-title-CFJOQU04.js";import{u as U}from"./blocklet-9wr_FD8g.js";import{u as mt}from"./use-mobile-CD0b5-fF.js";import{c as Ie,d as ft,e as xt,f as gt,S as ht,g as ue,h as St,b as yt,u as bt,C as kt,D as jt,a as Ct}from"./connect-to-D7kv9JZG.js";import"./index-C6w6MwHd.js";import"./index-BojVbZw0.js";import"./api-IHWlq8qW.js";import{d as wt,a as Bt,g as Dt,i as Et,e as ge,f as It,h as Tt,j as Rt}from"./spaces-CGMxc8V-.js";import{v as zt}from"./index-FOfUOpKU.js";import{E as vt}from"./index-CusFNu14.js";import{H as Pt}from"./HelpOutline-CTq25q-V.js";import{H as At}from"./index-DxeaApG7.js";import{x as Lt}from"./index-DRYJ0xIl.js";import{D as Ut}from"./DeleteOutline-BRn6KXm4.js";import{g as ke}from"./get-safe-url-DcDP4eG0.js";import{S as Ot}from"./switch-control-BrQIub8A.js";import{L as je}from"./list-header-CiZSpcHw.js";import"./OpenInNew-Df7bSVHt.js";import"./ButtonGroup-Td8BNrZx.js";import"./getValidReactChildren-DUKHPCTn.js";import"./FilterList-CoptEImh.js";import"./CSSTransition-y8iKTN7d.js";import"./emotion-cache.browser.esm-B4otC3_4.js";import"./index-BprceCor.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BIKlqTyk.js";import"./index-BruXFS68.js";import"./TableSearch-hUcYhTcB.js";import"./Search-CCrESOjg.js";import"./Clear-CP-1JSsG.js";import"./MoreVert-Bs574HAx.js";function Mt(t){return Ke("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${J(s)}`,`fontSize${J(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${J(n.color)}`],s[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ge({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Kt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Ft=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Gt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:Ws}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=U(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=U(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Je),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(L,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
1
+ import{c1 as Ke,c0 as Fe,r as h,c2 as Ge,j as e,b9 as ee,c4 as Ye,ch as J,c5 as $e,b_ as He,cj as qe,aF as he,M as q,bo as A,cw as Ce,H as B,Y as V,bg as E,fD as we,aQ as Be,b as N,iT as Ve,V as D,gD as Qe,o as f,x as Xe,ax as De,y as fe,al as Ze,p as Je,C as L,T as j,k as et,s as tt,f as st,iU as X,h_ as Z,iV as ot,K as S,aW as K,aH as T,L as nt,g as H,dm as at,O as Se,R as G,aE as Y,a9 as $,a5 as rt,bB as it,fu as ct,b0 as lt,v as pe,w as dt,G as be,Z as Ee,bE as xe,B as pt}from"./index-CHD9Cmfg.js";import{T as ut}from"./html-title-nz5vmr92.js";import{u as U}from"./blocklet-CFzK39yZ.js";import{u as mt}from"./use-mobile-nZ7DBF8e.js";import{c as Ie,d as ft,e as xt,f as gt,S as ht,g as ue,h as St,b as yt,u as bt,C as kt,D as jt,a as Ct}from"./connect-to-DoKSgfqT.js";import"./index-CtaGvMIP.js";import"./index-BojVbZw0.js";import"./api-DVPCT3Hv.js";import{d as wt,a as Bt,g as Dt,i as Et,e as ge,f as It,h as Tt,j as Rt}from"./spaces-DHFupx5x.js";import{v as zt}from"./index-8DkeDWz0.js";import{E as vt}from"./index-Xe9_eawT.js";import{H as Pt}from"./HelpOutline-X8WyhtRN.js";import{H as At}from"./index-DYPtfr0Z.js";import{x as Lt}from"./index-DRYJ0xIl.js";import{D as Ut}from"./DeleteOutline-BMoxlkvD.js";import{g as ke}from"./get-safe-url-C4fVKi22.js";import{S as Ot}from"./switch-control-BPmq_LUk.js";import{L as je}from"./list-header-Xr78rkjh.js";import"./OpenInNew-Cs-AwdZR.js";import"./ButtonGroup-D0vK9rJe.js";import"./getValidReactChildren-CqYTFgwI.js";import"./FilterList-Ctqdg3pC.js";import"./CSSTransition-kYwC_AYj.js";import"./emotion-cache.browser.esm-CuK33BMV.js";import"./index-BNqeTjZk.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DYZrAOrY.js";import"./index-Cd1OxNJr.js";import"./TableSearch-gKn4yfNZ.js";import"./Search-BtkTxHX-.js";import"./Clear-obXZ0PRj.js";import"./MoreVert-CeEDj1aH.js";function Mt(t){return Ke("MuiIcon",t)}Fe("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${J(s)}`,`fontSize${J(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${J(n.color)}`],s[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ge({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:c,component:i,fontSize:d},u=Nt(p);return e.jsx(_t,{as:i,className:Ye(r,"notranslate",u.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Kt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Ft=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Gt({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await wt(a.endpoint);return!q(i)&&i!==c&&(c=i,o=!0),{...a,name:c}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function Yt({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Gt({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:o.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return Be(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function $t({appDid:t}){const{backups:s}=Te(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&o(()=>({...c}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[c]=s;o(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}}),p=Array.isArray(l)?l.map(u=>({...u,successCount:+u.successCount,errorCount:+u.errorCount})):[];r(p)}catch(i){console.error("Failed to fetch backup summary:",i),B.error(V(i)),r([])}finally{s(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Re=h.createContext({}),{Provider:qt,Consumer:Ws}=Re;function ze({children:t}){const{t:s}=D(),{api:n}=A(),{blocklet:o}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=Yt({refresh:c}),u=Qe(d),x=$t({appDid:o?.appDid}),m=h.useMemo(()=>Bt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(0),{backupSummary:ne}=Ht({deps:[se]}),[_,M]=h.useState(d?.find(g=>g.endpoint===m)),I=o?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{oe(g=>g+1)},re=()=>{b(g=>g+1)},F=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),m!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===m&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await F({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),m!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===m;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:u,spaceGatewayIsSelected:C,updateAutoBackup:F,abortBlockletBackup:Q,backupEndpoint:m,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:f.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:s}=U(),{info:n}=A(),{t:o}=D(),r=Ie({blocklet:s}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:u,name:x,did:m})=>{const k=await Dt(u);if(!await Et(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===u)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:m,url:k,endpoint:u},u)},p=async({spaceGateway:u})=>{try{await l(u)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:s}=U(),{data:n,loading:o}=Ce(()=>t.getBlocklet({input:{did:s?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!s?.meta?.did,refreshDeps:[s?.meta?.did]});return{blocklet:n?.blocklet??null,loading:o}}function Pe({...t}){const{t:s}=h.useContext(Je),{blocklet:n,loading:o}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(zt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return o?e.jsx(L,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:s,backupSummary:n}=O(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),c=h.useCallback(l=>{s(l)},[s]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),u=new Map(n.map(m=>[m.date,{date:m.date,successCount:m.successCount,errorCount:m.errorCount}])),x=[];for(let m=p.clone();E(m).isBefore(l);m=m.add(1,"day")){const k=m.format("YYYY-MM-DD");x.push(u.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
2
2
  `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(vt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(K,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Xt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:s="",createdAt:n}){const{t:o}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):i?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(Pt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:f.string.isRequired,message:f.string,createdAt:f.string.isRequired};function Ue({metadata:t={}}){const{t:s}=D();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=Lt(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:s("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:f.object};function Oe(){const{t,locale:s}=D(),{spaceGateways:n,backups:o,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:u}=o[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,m=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return m?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>q(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=o?.[i]??{},{status:l,message:p,createdAt:u,metadata:x}=d,m=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(u,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!m,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!m;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:u})}}}],[o,n,t]),c=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(At,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Me({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(u,x)=>{u?.preventDefault(),u?.stopPropagation(),a(x)},l=async u=>{try{u?.stopPropagation(),i(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=u=>{d(u,!1),n?.(u)};return e.jsxs(e.Fragment,{children:[e.jsxs(G,{color:"red",onClick:u=>d(u,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool}).isRequired,onConfirm:f.func,onCancel:f.func};function Ne({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[u,x]=h.useState(!1),m=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),m(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),m(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[u||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>m(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>m(y,!1),children:[e.jsxs(G,{onClick:y=>{m(y,!1),window.open(ke(t.endpoint?It(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx($,{children:p("common.open")})]}),e.jsxs(G,{onClick:y=>{m(y,!1),window.open(ke(Tt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(G,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(G,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(ht,{fontSize:"small"})}),e.jsx($,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:f.shape({name:f.string.isRequired,url:f.string.isRequired,protected:f.bool,endpoint:f.string.isRequired,loading:f.bool}).isRequired,selected:f.bool.isRequired,enableSwitchToSpace:f.bool,onDelete:f.func,onConnect:f.func,backupInProgress:f.bool};const Jt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,F=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Rt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:u,appName:x,appDescription:m,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},le=async()=>{try{await se(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),oe(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:F})]})}_e.propTypes={spaceGateway:f.shape({did:f.string.isRequired,name:f.string.isRequired,url:f.string.isRequired,endpoint:f.string.isRequired,protected:f.bool,loading:f.bool}).isRequired,spaceStatus:f.string.isRequired,selected:f.bool.isRequired,onConnected:f.func,onDeleted:f.func,onBackedUp:f.func};function es({...t}){const{t:s}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function ts({...t}){const{t:s}=D(),{autoBackup:n,updateAutoBackup:o}=O(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ss(){const{t}=D(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=O(),r=n&&!s?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(ts,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(St,{endpoint:c.endpoint,selected:o(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(es,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function os(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(s)?e.jsx(Zt,{}):e.jsx(ss,{})}function ns(){return e.jsx(ze,{children:e.jsx(os,{})})}function as(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=bt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(jt,{}),e.jsx(S,{sx:c,children:e.jsx(Ct,{onConnect:n,storageEndpoint:a})})]})}function rs(){const{t}=D();return e.jsxs(yt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(as,{})]})}function is({navOrientation:t="vertical",...s}){const{t:n,locale:o}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(ns,{}),storage:e.jsx(rs,{})}))[d],m=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:m,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}is.propTypes={navOrientation:f.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{aF as ce,j as e,hh as Zr,hi as Vr,bR as Wr,r as q,s as ye,K as A,f5 as Tt,t as H,eO as bt,a4 as le,C as Ee,bj as Xt,dL as Ur,o as T,hj as Kr,b3 as Qt,cB as Jr,cU as Gr,dq as Yr,T as Y,dH as ut,bo as ne,bF as jt,p as ue,hk as Xr,bG as _t,b as K,bh as ee,bB as re,H as F,aW as ie,V as ae,n as er,q as Qr,w as tr,ad as es,i as rr,ge as ts,hl as rs,au as ss,aV as G,U as Te,$ as Se,D as ns,X as is,v as X,Y as ht,hm as as,hn as os,eA as ls,eC as cs,F as _e,aH as J,g3 as ds,d0 as Et,W as us,fn as sr,O as te,aR as It,ho as hs,hp as fs,be as ms,gk as Ie,f9 as be,aP as ge,aT as E,hq as Ye,hr as ft,P as W,z as ps,y as wt,bE as xe,aD as se,hs as Me,a2 as gs,ht as Xe,c8 as Re,eD as xs,hu as ys,dI as he,f as Oe,bA as mt,M as vs,cI as nr,bt as bs,hv as js,ba as _s,L as ws,cw as Be,aJ as We,hw as ks,R as Ss,bq as Cs,ag as Dt,a3 as ir,bk as Ue,hx as ar,b7 as Rs,gD as ke,fa as or,c_ as lr,B as Os,b6 as Lt,fc as As,fh as $s,G as Qe,J as Ps,by as Ts}from"./index-DpFVufZF.js";import{S as Es}from"./actions-Bsd5QbHY.js";import{N as qt}from"./ChevronRight-CRb5GVq5.js";import{T as He}from"./html-title-CFJOQU04.js";import{w as De,P as Is}from"./permission-a5zDq7rM.js";import{u as kt}from"./index-DdF52dPT.js";import{F as Ds,R as Ls,S as M,a as pt,s as qs,L as we,A as Ms,b as zs,c as Bs,d as Hs,B as Ns}from"./preference-B-CYFAI3.js";import{D as Fs}from"./Done-BD3-Bno_.js";import{A as Zs,a as Mt}from"./Autocomplete-Dm1_2YSl.js";import{C as Vs,R as Ws,S as Us,P as Ks}from"./rotate-session-key-DETYEvOS.js";import{u as oe}from"./blocklet-9wr_FD8g.js";import{C as cr}from"./click-to-copy-BkgGJ2iu.js";import{u as Ke}from"./team-651xYHqY.js";import{v as dr}from"./index-FOfUOpKU.js";import{g as Js}from"./chain-xcMn0w3E.js";import{V as Gs,d as Ys}from"./status-DsuywKQN.js";import{a as de,S as Ne,u as Xs}from"./switch-control-BrQIub8A.js";import{u as ve,C as z,b as zt}from"./index.esm-DNw2WsMP.js";import{y as Qs}from"./index-BruXFS68.js";import{I as en,J as tn,K as rn,L as sn}from"./index-BprceCor.js";import{D as Bt}from"./Delete-zum6vOfn.js";import{A as Ht}from"./Add-DwgbzyUw.js";import{H as Je}from"./index-DxeaApG7.js";import{u as ur}from"./use-mobile-CD0b5-fF.js";import{S as et}from"./simple-select-BSptVRvh.js";import{C as nn}from"./CardContent-ewSbhAdG.js";import{R as hr,a as fr}from"./url-evaluation-htR8cP0c.js";import"./useLocalStorage-pDiaOOl8.js";import"./MoreVert-Bs574HAx.js";import"./DeleteOutline-BRn6KXm4.js";import"./get-safe-url-DcDP4eG0.js";import"./ButtonGroup-Td8BNrZx.js";import"./getValidReactChildren-DUKHPCTn.js";import"./omit-CPRZ0B0R.js";import"./index-BOjP8MFh.js";import"./edit.svg-_S0cvmEV.js";import"./ArrowDropDown-CbNJotqT.js";import"./index-_p9TGBvO.js";import"./iframe-DTPDSES_.js";import"./ListSubheader-DmTgdBz5.js";import"./visuallyHidden-Dan1xhjv.js";import"./ErrorOutline-eTinVSTi.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./FilterList-CoptEImh.js";import"./CSSTransition-y8iKTN7d.js";import"./emotion-cache.browser.esm-B4otC3_4.js";import"./depsEqual-BIKlqTyk.js";import"./TableSearch-hUcYhTcB.js";import"./Search-CCrESOjg.js";import"./Clear-CP-1JSsG.js";const mr=ce([e.jsx("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),e.jsx("circle",{cx:"16",cy:"12",r:"1.5"},"1")]),an=ce([e.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),e.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),on=ce(e.jsx("path",{d:"M21 8V7l-3 2-3-2v1l3 2zm1-5H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2M8 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3m6 12H2v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1zm8-6h-8V6h8z"})),ln=ce(e.jsx("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"})),cn=ce(e.jsx("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"})),dn=ce(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"})),un=ce(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),hn=ce(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),gt=ce(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),fn=ce([e.jsx("path",{d:"M18 11c.7 0 1.37.1 2 .29V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6.26c-.79-1.13-1.26-2.51-1.26-4 0-3.87 3.13-7 7-7M8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9z"},"0"),e.jsx("path",{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 2c.83 0 1.5.67 1.5 1.5S18.83 18 18 18s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5m0 6c-1.03 0-1.94-.52-2.48-1.32.73-.42 1.57-.68 2.48-.68s1.75.26 2.48.68c-.54.8-1.45 1.32-2.48 1.32"},"1")]),mn=ce(e.jsx("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"})),pn=ce(e.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"})),pr=ce(e.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"})),gn=ce(e.jsx("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"})),xn=ce(e.jsx("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}));var yn=Array.prototype,Nt=yn.splice;function vn(v,R,C,O){var _=Vr,j=-1,p=R.length,i=v;for(v===R&&(R=Zr(R));++j<p;)for(var m=0,f=R[j],u=f;(m=_(i,u,m))>-1;)i!==v&&Nt.call(i,m,1),Nt.call(v,m,1);return v}function bn(v,R){return v&&v.length&&R&&R.length?vn(v,R):v}var jn=Wr(bn);const _n={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'};function gr({label:v="",disabled:R=!1,required:C=!1,initialValue:O="",onChange:_=()=>{},style:j={},onSubmit:p=()=>{},triggers:i=[],options:m=[],formatterBeforeSubmit:f=n=>n.join(","),helperText:u="",placeholder:t="",renderImage:l=()=>null,renderLabel:o=()=>"",filterKeys:s=["name"],noEmpty:r=!1,...c}){const[n,a]=q.useState(!1),[h,x]=q.useState(!1),[g,S]=q.useState(""),k=q.useRef(null),[d,y]=q.useState(O),[b,w]=q.useState(d),$=q.useMemo(()=>{if(!m)return{};const N={};return m.forEach(D=>{N[D.code]=D}),N},[m]),P=()=>{if(!m)return[];if(!g)return m.map(D=>D.code);const N=new RegExp(g.toLowerCase());return m.filter(D=>{for(let B=0;B<s.length;B++){const V=s[B];if(N.test(D[V]?.toLowerCase()))return!0}return!1}).map(D=>D.code)},I=async()=>{x(!0);try{await p(typeof f=="function"?f(b):b)===!1?w(d):r&&!b.length?(w(O),y(O)):(w(b),y(b))}catch{w(d)}finally{x(!1),a(!1)}},L=(N,D)=>{if(!Array.isArray(D)){w([]),_([]);return}const B=D.filter(V=>$[V]);if(!B.length){w([]),_([]);return}w(B),_(B)},Z=N=>{N.stopPropagation(),a(!0),setTimeout(()=>{if(k.current){const D=k.current.querySelector("input");D&&D.focus()}},500)},U=n?e.jsx(Zs,{ref:k,options:m,value:b,onChange:L,inputValue:g,onInputChange:(N,D)=>{S(D)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:P,getOptionLabel:N=>$[N]?.name,renderInput:N=>e.jsx(H,{...N,label:"",placeholder:t}),renderOption:(N,D)=>{const B=b.indexOf(D)!==-1;return q.createElement(wn,{component:"li",...N,key:D},l($[D]||{}),e.jsx(A,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:B?"700":"normal"},children:o(D,$[D])||$[D]?.name}),e.jsx(A,{component:Tt,sx:{opacity:.5,width:18,height:18},style:{visibility:B?"visible":"hidden"}}))},...c,slots:{popper:kn}}):e.jsx(A,{className:"form-item-input slot",onClick:Z,style:{whiteSpace:"pre-wrap",cursor:"text"},sx:{px:1},children:b.filter(N=>m.some(D=>D.code===N)).map(N=>e.jsx(bt,{label:m.find(D=>D.code===N).name,style:{marginRight:8},size:"small"},N))});return e.jsx(Ds,{className:"form",style:j,children:e.jsxs(A,{className:"form-item",children:[e.jsxs(A,{className:"form-item-label",children:[v,C&&e.jsx(Ls,{})]}),e.jsxs(A,{className:"form-item-body",children:[e.jsx(A,{className:"form-item-input",children:U}),n?e.jsx(A,{className:"form-item-action",children:e.jsxs(e.Fragment,{children:[e.jsx(le,{"data-cy":"schema-form-item-confirm",onClick:I,disabled:R||h,size:"large",children:h?e.jsx(Ee,{size:24}):e.jsx(Fs,{})}),e.jsx(le,{"data-cy":"schema-form-item-cancel",onClick:()=>{w(d),a(!1)},disabled:R||h,size:"large",children:e.jsx(Tt,{})})]})}):null]}),n&&u&&e.jsx(Xt,{children:u})]})})}gr.propTypes={style:T.object,onSubmit:T.func,onChange:T.func,label:T.string,initialValue:T.string,required:T.bool,disabled:T.bool,triggers:T.array,options:T.array,helperText:T.string,formatterBeforeSubmit:T.func,placeholder:T.string,renderImage:T.func,filterKeys:T.arrayOf(T.string),noEmpty:T.bool,renderLabel:T.func};const wn=ye.div`
1
+ import{aF as ce,j as e,hh as Zr,hi as Vr,bR as Wr,r as q,s as ye,K as A,f5 as Tt,t as H,eO as bt,a4 as le,C as Ee,bj as Xt,dL as Ur,o as T,hj as Kr,b3 as Qt,cB as Jr,cU as Gr,dq as Yr,T as Y,dH as ut,bo as ne,bF as jt,p as ue,hk as Xr,bG as _t,b as K,bh as ee,bB as re,H as F,aW as ie,V as ae,n as er,q as Qr,w as tr,ad as es,i as rr,ge as ts,hl as rs,au as ss,aV as G,U as Te,$ as Se,D as ns,X as is,v as X,Y as ht,hm as as,hn as os,eA as ls,eC as cs,F as _e,aH as J,g3 as ds,d0 as Et,W as us,fn as sr,O as te,aR as It,ho as hs,hp as fs,be as ms,gk as Ie,f9 as be,aP as ge,aT as E,hq as Ye,hr as ft,P as W,z as ps,y as wt,bE as xe,aD as se,hs as Me,a2 as gs,ht as Xe,c8 as Re,eD as xs,hu as ys,dI as he,f as Oe,bA as mt,M as vs,cI as nr,bt as bs,hv as js,ba as _s,L as ws,cw as Be,aJ as We,hw as ks,R as Ss,bq as Cs,ag as Dt,a3 as ir,bk as Ue,hx as ar,b7 as Rs,gD as ke,fa as or,c_ as lr,B as Os,b6 as Lt,fc as As,fh as $s,G as Qe,J as Ps,by as Ts}from"./index-CHD9Cmfg.js";import{S as Es}from"./actions-D7UfMRLN.js";import{N as qt}from"./ChevronRight-ZsluCIi3.js";import{T as He}from"./html-title-nz5vmr92.js";import{w as De,P as Is}from"./permission-BXLhf3R0.js";import{u as kt}from"./index-Bgw3LjDC.js";import{F as Ds,R as Ls,S as M,a as pt,s as qs,L as we,A as Ms,b as zs,c as Bs,d as Hs,B as Ns}from"./preference-BzQl99QW.js";import{D as Fs}from"./Done-D15PfZFX.js";import{A as Zs,a as Mt}from"./Autocomplete-BvGMj8d2.js";import{C as Vs,R as Ws,S as Us,P as Ks}from"./rotate-session-key-DstPsh_a.js";import{u as oe}from"./blocklet-CFzK39yZ.js";import{C as cr}from"./click-to-copy-B1d42v9P.js";import{u as Ke}from"./team-DUFIrJZB.js";import{v as dr}from"./index-8DkeDWz0.js";import{g as Js}from"./chain-D1Fwee6d.js";import{V as Gs,d as Ys}from"./status-C8F30-2_.js";import{a as de,S as Ne,u as Xs}from"./switch-control-BPmq_LUk.js";import{u as ve,C as z,b as zt}from"./index.esm-BnAlHHpx.js";import{y as Qs}from"./index-Cd1OxNJr.js";import{I as en,J as tn,K as rn,L as sn}from"./index-BNqeTjZk.js";import{D as Bt}from"./Delete-Qei5VqRe.js";import{A as Ht}from"./Add-DmAZpTAX.js";import{H as Je}from"./index-DYPtfr0Z.js";import{u as ur}from"./use-mobile-nZ7DBF8e.js";import{S as et}from"./simple-select-Ci2yAG8G.js";import{C as nn}from"./CardContent-MBq5V8vu.js";import{R as hr,a as fr}from"./url-evaluation-B8wdjuzT.js";import"./useLocalStorage-CLwjyMkh.js";import"./MoreVert-CeEDj1aH.js";import"./DeleteOutline-BMoxlkvD.js";import"./get-safe-url-C4fVKi22.js";import"./ButtonGroup-D0vK9rJe.js";import"./getValidReactChildren-CqYTFgwI.js";import"./omit-BbisAClK.js";import"./index-_78XKglK.js";import"./edit.svg-Bt1rUdxu.js";import"./ArrowDropDown-C5HLN-JN.js";import"./index-ByV5lrBo.js";import"./iframe-D0_BJlWL.js";import"./ListSubheader--_-XKbS8.js";import"./visuallyHidden-Dan1xhjv.js";import"./ErrorOutline-r8z8_0k8.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./FilterList-Ctqdg3pC.js";import"./CSSTransition-kYwC_AYj.js";import"./emotion-cache.browser.esm-CuK33BMV.js";import"./depsEqual-DYZrAOrY.js";import"./TableSearch-gKn4yfNZ.js";import"./Search-BtkTxHX-.js";import"./Clear-obXZ0PRj.js";const mr=ce([e.jsx("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),e.jsx("circle",{cx:"16",cy:"12",r:"1.5"},"1")]),an=ce([e.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),e.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),on=ce(e.jsx("path",{d:"M21 8V7l-3 2-3-2v1l3 2zm1-5H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2M8 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3m6 12H2v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1zm8-6h-8V6h8z"})),ln=ce(e.jsx("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"})),cn=ce(e.jsx("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"})),dn=ce(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"})),un=ce(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),hn=ce(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),gt=ce(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),fn=ce([e.jsx("path",{d:"M18 11c.7 0 1.37.1 2 .29V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6.26c-.79-1.13-1.26-2.51-1.26-4 0-3.87 3.13-7 7-7M8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9z"},"0"),e.jsx("path",{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 2c.83 0 1.5.67 1.5 1.5S18.83 18 18 18s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5m0 6c-1.03 0-1.94-.52-2.48-1.32.73-.42 1.57-.68 2.48-.68s1.75.26 2.48.68c-.54.8-1.45 1.32-2.48 1.32"},"1")]),mn=ce(e.jsx("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"})),pn=ce(e.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"})),pr=ce(e.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"})),gn=ce(e.jsx("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"})),xn=ce(e.jsx("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}));var yn=Array.prototype,Nt=yn.splice;function vn(v,R,C,O){var _=Vr,j=-1,p=R.length,i=v;for(v===R&&(R=Zr(R));++j<p;)for(var m=0,f=R[j],u=f;(m=_(i,u,m))>-1;)i!==v&&Nt.call(i,m,1),Nt.call(v,m,1);return v}function bn(v,R){return v&&v.length&&R&&R.length?vn(v,R):v}var jn=Wr(bn);const _n={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'};function gr({label:v="",disabled:R=!1,required:C=!1,initialValue:O="",onChange:_=()=>{},style:j={},onSubmit:p=()=>{},triggers:i=[],options:m=[],formatterBeforeSubmit:f=n=>n.join(","),helperText:u="",placeholder:t="",renderImage:l=()=>null,renderLabel:o=()=>"",filterKeys:s=["name"],noEmpty:r=!1,...c}){const[n,a]=q.useState(!1),[h,x]=q.useState(!1),[g,S]=q.useState(""),k=q.useRef(null),[d,y]=q.useState(O),[b,w]=q.useState(d),$=q.useMemo(()=>{if(!m)return{};const N={};return m.forEach(D=>{N[D.code]=D}),N},[m]),P=()=>{if(!m)return[];if(!g)return m.map(D=>D.code);const N=new RegExp(g.toLowerCase());return m.filter(D=>{for(let B=0;B<s.length;B++){const V=s[B];if(N.test(D[V]?.toLowerCase()))return!0}return!1}).map(D=>D.code)},I=async()=>{x(!0);try{await p(typeof f=="function"?f(b):b)===!1?w(d):r&&!b.length?(w(O),y(O)):(w(b),y(b))}catch{w(d)}finally{x(!1),a(!1)}},L=(N,D)=>{if(!Array.isArray(D)){w([]),_([]);return}const B=D.filter(V=>$[V]);if(!B.length){w([]),_([]);return}w(B),_(B)},Z=N=>{N.stopPropagation(),a(!0),setTimeout(()=>{if(k.current){const D=k.current.querySelector("input");D&&D.focus()}},500)},U=n?e.jsx(Zs,{ref:k,options:m,value:b,onChange:L,inputValue:g,onInputChange:(N,D)=>{S(D)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:P,getOptionLabel:N=>$[N]?.name,renderInput:N=>e.jsx(H,{...N,label:"",placeholder:t}),renderOption:(N,D)=>{const B=b.indexOf(D)!==-1;return q.createElement(wn,{component:"li",...N,key:D},l($[D]||{}),e.jsx(A,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:B?"700":"normal"},children:o(D,$[D])||$[D]?.name}),e.jsx(A,{component:Tt,sx:{opacity:.5,width:18,height:18},style:{visibility:B?"visible":"hidden"}}))},...c,slots:{popper:kn}}):e.jsx(A,{className:"form-item-input slot",onClick:Z,style:{whiteSpace:"pre-wrap",cursor:"text"},sx:{px:1},children:b.filter(N=>m.some(D=>D.code===N)).map(N=>e.jsx(bt,{label:m.find(D=>D.code===N).name,style:{marginRight:8},size:"small"},N))});return e.jsx(Ds,{className:"form",style:j,children:e.jsxs(A,{className:"form-item",children:[e.jsxs(A,{className:"form-item-label",children:[v,C&&e.jsx(Ls,{})]}),e.jsxs(A,{className:"form-item-body",children:[e.jsx(A,{className:"form-item-input",children:U}),n?e.jsx(A,{className:"form-item-action",children:e.jsxs(e.Fragment,{children:[e.jsx(le,{"data-cy":"schema-form-item-confirm",onClick:I,disabled:R||h,size:"large",children:h?e.jsx(Ee,{size:24}):e.jsx(Fs,{})}),e.jsx(le,{"data-cy":"schema-form-item-cancel",onClick:()=>{w(d),a(!1)},disabled:R||h,size:"large",children:e.jsx(Tt,{})})]})}):null]}),n&&u&&e.jsx(Xt,{children:u})]})})}gr.propTypes={style:T.object,onSubmit:T.func,onChange:T.func,label:T.string,initialValue:T.string,required:T.bool,disabled:T.bool,triggers:T.array,options:T.array,helperText:T.string,formatterBeforeSubmit:T.func,placeholder:T.string,renderImage:T.func,filterKeys:T.arrayOf(T.string),noEmpty:T.bool,renderLabel:T.func};const wn=ye.div`
2
2
  display: flex;
3
3
  justify-content: space-between;
4
4
  align-items: center;
@@ -1 +1 @@
1
- import{r as P,V as E,A as C,j as e,Z as W,C as j,cG as I,K as T,w as k,H as u,aH as S,u as U,x as v,ar as N,af as R}from"./index-DpFVufZF.js";import{w as b}from"./wrap-locale-BbjqZMGZ.js";import{g as L}from"./get-safe-url-DcDP4eG0.js";import"./index-CySEKiOM.js";function H({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),f=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},m=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(W,{children:e.jsx(j,{})}):e.jsx(I,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:f,onError:m,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const K=b(H);function V(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(K,{SessionContext:N,webWalletUrl:a,onSuccess:r})}export{V as default};
1
+ import{r as P,V as E,A as C,j as e,Z as W,C as j,cG as I,K as T,w as k,H as u,aH as S,u as U,x as v,ar as N,af as R}from"./index-CHD9Cmfg.js";import{w as b}from"./wrap-locale-DwPSR3NV.js";import{g as L}from"./get-safe-url-C4fVKi22.js";import"./index-DfNDAgds.js";function H({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),f=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},m=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(W,{children:e.jsx(j,{})}):e.jsx(I,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:f,onError:m,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const K=b(H);function V(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(K,{SessionContext:N,webWalletUrl:a,onSuccess:r})}export{V as default};
@@ -1 +1 @@
1
- import{j as e,cG as j,K as v,A as P,r as a,p as S,ay as k,u as w,x as K,f as b,aP as E,dj as W,aT as i,b8 as _,w as U,Z as N,C as R,dk as T,dl as z}from"./index-DpFVufZF.js";import{p as c}from"./index-CZVZy3tE.js";function o({children:r,...s}){return e.jsx(j,{...s,did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function F(){const r=P(),{t:s,locale:d}=a.useContext(S),{api:l}=k(),{info:u}=w(),p=K(u),f=b(),n=E({ready:!1,success:!1,error:null,invalidSession:!1}),h=W(),m=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=T(g);if(!z(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};a.useLayoutEffect(()=>m(),[]);const x=i(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=i(()=>{n.success=!0});if(n.invalidSession)return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(_,{style:{color:f.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(o,{children:e.jsx(U,{className:"connect",action:"gen-key-pair",checkFn:l.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:h?.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:p,onSuccess:C,onError:x,locale:d,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(N,{children:e.jsx(R,{})})}export{F as default};
1
+ import{j as e,cG as j,K as v,A as P,r as a,p as S,ay as k,u as w,x as K,f as b,aP as E,dj as W,aT as i,b8 as _,w as U,Z as N,C as R,dk as T,dl as z}from"./index-CHD9Cmfg.js";import{p as c}from"./index-DPjJiIdV.js";function o({children:r,...s}){return e.jsx(j,{...s,did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function F(){const r=P(),{t:s,locale:d}=a.useContext(S),{api:l}=k(),{info:u}=w(),p=K(u),f=b(),n=E({ready:!1,success:!1,error:null,invalidSession:!1}),h=W(),m=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=T(g);if(!z(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};a.useLayoutEffect(()=>m(),[]);const x=i(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=i(()=>{n.success=!0});if(n.invalidSession)return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(_,{style:{color:f.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(o,{children:e.jsx(U,{className:"connect",action:"gen-key-pair",checkFn:l.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:h?.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:p,onSuccess:C,onError:x,locale:d,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(N,{children:e.jsx(R,{})})}export{F as default};
@@ -1 +1 @@
1
- import{bf as v,r as at}from"./index-DpFVufZF.js";var he=e=>e.type==="checkbox",ue=e=>e instanceof Date,$=e=>e==null;const _t=e=>typeof e=="object";var P=e=>!$(e)&&!Array.isArray(e)&&_t(e)&&!ue(e),ht=e=>P(e)&&e.target?he(e.target)?e.target.checked:e.target.value:e,Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mt=(e,r)=>e.has(Nt(r)),Bt=e=>{const r=e.constructor&&e.constructor.prototype;return P(r)&&r.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function T(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(!(je&&(e instanceof Blob||i))&&(t||P(e)))if(r=t?[]:{},!t&&!Bt(e))r=e;else for(const n in e)e.hasOwnProperty(n)&&(r[n]=T(e[n]));else return e;return r}var Se=e=>/^\w*$/.test(e),U=e=>e===void 0,we=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>we(e.replace(/["|']|\]/g,"").split(/\.|\[/)),c=(e,r,t)=>{if(!r||!P(e))return t;const i=(Se(r)?[r]:Ke(r)).reduce((n,l)=>$(n)?n:n[l],e);return U(i)||i===e?U(e[r])?t:e[r]:i},Q=e=>typeof e=="boolean",E=(e,r,t)=>{let i=-1;const n=Se(r)?[r]:Ke(r),l=n.length,f=l-1;for(;++i<l;){const d=n[i];let b=t;if(i!==f){const x=e[d];b=P(x)||Array.isArray(x)?x:isNaN(+n[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=b,e=e[d]}};const Fe={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vt=v.createContext(null);vt.displayName="HookFormContext";const ke=()=>v.useContext(vt);var bt=(e,r,t,i=!0)=>{const n={defaultValues:r._defaultValues};for(const l in e)Object.defineProperty(n,l,{get:()=>{const f=l;return r._proxyFormState[f]!==Z.all&&(r._proxyFormState[f]=!i||Z.all),t&&(t[f]=!0),e[f]}});return n};const De=typeof window<"u"?at.useLayoutEffect:at.useEffect;function Pt(e){const r=ke(),{control:t=r.control,disabled:i,name:n,exact:l}=e||{},[f,d]=v.useState(t._formState),b=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return De(()=>t._subscribe({name:n,formState:b.current,exact:l,callback:x=>{!i&&d({...t._formState,...x})}}),[n,i,l]),v.useEffect(()=>{b.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>bt(f,t,b.current,!1),[f,t])}var se=e=>typeof e=="string",Ft=(e,r,t,i,n)=>se(e)?(i&&r.watch.add(e),c(t,e,n)):Array.isArray(e)?e.map(l=>(i&&r.watch.add(l),c(t,l))):(i&&(r.watchAll=!0),t);function Wt(e){const r=ke(),{control:t=r.control,name:i,defaultValue:n,disabled:l,exact:f}=e||{},d=v.useRef(n),[b,x]=v.useState(t._getWatch(i,d.current));return De(()=>t._subscribe({name:i,formState:{values:!0},exact:f,callback:D=>!l&&x(Ft(i,t._names,D.values||t._formValues,!1,d.current))}),[i,t,l,f]),v.useEffect(()=>t._removeUnmounted()),b}function qt(e){const r=ke(),{name:t,disabled:i,control:n=r.control,shouldUnregister:l}=e,f=mt(n._names.array,t),d=Wt({control:n,name:t,defaultValue:c(n._formValues,t,c(n._defaultValues,t,e.defaultValue)),exact:!0}),b=Pt({control:n,name:t,exact:!0}),x=v.useRef(e),D=v.useRef(n.register(t,{...e.rules,value:d,...Q(e.disabled)?{disabled:e.disabled}:{}})),C=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!c(b.errors,t)},isDirty:{enumerable:!0,get:()=>!!c(b.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!c(b.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!c(b.validatingFields,t)},error:{enumerable:!0,get:()=>c(b.errors,t)}}),[b,t]),F=v.useCallback(L=>D.current.onChange({target:{value:ht(L),name:t},type:Fe.CHANGE}),[t]),M=v.useCallback(()=>D.current.onBlur({target:{value:c(n._formValues,t),name:t},type:Fe.BLUR}),[t,n._formValues]),z=v.useCallback(L=>{const ee=c(n._fields,t);ee&&L&&(ee._f.ref={focus:()=>L.focus&&L.focus(),select:()=>L.select&&L.select(),setCustomValidity:V=>L.setCustomValidity(V),reportValidity:()=>L.reportValidity()})},[n._fields,t]),R=v.useMemo(()=>({name:t,value:d,...Q(i)||b.disabled?{disabled:b.disabled||i}:{},onChange:F,onBlur:M,ref:z}),[t,i,b.disabled,F,M,z,d]);return v.useEffect(()=>{const L=n._options.shouldUnregister||l;n.register(t,{...x.current.rules,...Q(x.current.disabled)?{disabled:x.current.disabled}:{}});const ee=(V,G)=>{const W=c(n._fields,V);W&&W._f&&(W._f.mount=G)};if(ee(t,!0),L){const V=T(c(n._options.defaultValues,t));E(n._defaultValues,t,V),U(c(n._formValues,t))&&E(n._formValues,t,V)}return!f&&n.register(t),()=>{(f?L&&!n._state.action:L)?n.unregister(t):ee(t,!1)}},[t,n,f,l]),v.useEffect(()=>{n._setDisabledField({disabled:i,name:t})},[i,t,n]),v.useMemo(()=>({field:R,formState:b,fieldState:C}),[R,b,C])}const ar=e=>e.render(qt(e));var Ht=(e,r,t,i,n)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:n||!0}}:{},K=e=>Array.isArray(e)?e:[e],nt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const l of e)l.next&&l.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(l=>l!==n)}}),unsubscribe:()=>{e=[]}}},qe=e=>$(e)||!_t(e);function le(e,r,t=new WeakSet){if(qe(e)||qe(r))return e===r;if(ue(e)&&ue(r))return e.getTime()===r.getTime();const i=Object.keys(e),n=Object.keys(r);if(i.length!==n.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const l of i){const f=e[l];if(!n.includes(l))return!1;if(l!=="ref"){const d=r[l];if(ue(f)&&ue(d)||P(f)&&P(d)||Array.isArray(f)&&Array.isArray(d)?!le(f,d,t):f!==d)return!1}}return!0}var H=e=>P(e)&&!Object.keys(e).length,ze=e=>e.type==="file",te=e=>typeof e=="function",Ve=e=>{if(!je)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Vt=e=>e.type==="select-multiple",Ge=e=>e.type==="radio",$t=e=>Ge(e)||he(e),Me=e=>Ve(e)&&e.isConnected;function jt(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=U(e)?i++:e[r[i++]];return e}function Kt(e){for(const r in e)if(e.hasOwnProperty(r)&&!U(e[r]))return!1;return!0}function B(e,r){const t=Array.isArray(r)?r:Se(r)?[r]:Ke(r),i=t.length===1?e:jt(e,t),n=t.length-1,l=t[n];return i&&delete i[l],n!==0&&(P(i)&&H(i)||Array.isArray(i)&&Kt(i))&&B(e,t.slice(0,-1)),e}var At=e=>{for(const r in e)if(te(e[r]))return!0;return!1};function Ae(e,r={}){const t=Array.isArray(e);if(P(e)||t)for(const i in e)Array.isArray(e[i])||P(e[i])&&!At(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ae(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function xt(e,r,t){const i=Array.isArray(e);if(P(e)||i)for(const n in e)Array.isArray(e[n])||P(e[n])&&!At(e[n])?U(r)||qe(t[n])?t[n]=Array.isArray(e[n])?Ae(e[n],[]):{...Ae(e[n])}:xt(e[n],$(r)?{}:r[n],t[n]):t[n]=!le(e[n],r[n]);return t}var ge=(e,r)=>xt(e,r,Ae(r));const lt={value:!1,isValid:!1},ut={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?ut:{value:e[0].value,isValid:!0}:ut:lt}return lt},wt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>U(e)?e:r?e===""?NaN:e&&+e:t&&se(e)?new Date(e):i?i(e):e;const ot={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,ot):ot;function ct(e){const r=e.ref;return ze(r)?r.files:Ge(r)?kt(e.refs).value:Vt(r)?[...r.selectedOptions].map(({value:t})=>t):he(r)?St(e.refs).value:wt(U(r.value)?e.ref.value:r.value,e)}var zt=(e,r,t,i)=>{const n={};for(const l of e){const f=c(r,l);f&&E(n,l,f._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},xe=e=>e instanceof RegExp,_e=e=>U(e)?e:xe(e)?e.source:P(e)?xe(e.value)?e.value.source:e.value:e,de=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const dt="AsyncFunction";var Gt=e=>!!e&&!!e.validate&&!!(te(e.validate)&&e.validate.constructor.name===dt||P(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===dt)),Yt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),He=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const fe=(e,r,t,i)=>{for(const n of t||Object.keys(e)){const l=c(e,n);if(l){const{_f:f,...d}=l;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],n)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(fe(d,r))break}else if(P(d)&&fe(d,r))break}}};function ft(e,r,t){const i=c(e,t);if(i||Se(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const l=n.join("."),f=c(r,l),d=c(e,l);if(f&&!Array.isArray(f)&&t!==l)return{name:t};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};n.pop()}return{name:t}}var Jt=(e,r,t,i)=>{t(e);const{name:n,...l}=e;return H(l)||Object.keys(l).length>=Object.keys(r).length||Object.keys(l).find(f=>r[f]===(!i||Z.all))},Qt=(e,r,t)=>!e||!r||e===r||K(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Xt=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Zt=(e,r)=>!we(c(e,r)).length&&B(e,r),Dt=(e,r,t)=>{const i=K(c(e,t));return E(i,"root",r[t]),E(e,t,i),e},be=e=>se(e);function yt(e,r,t="validate"){if(be(e)||Array.isArray(e)&&e.every(be)||Q(e)&&!e)return{type:t,message:be(e)?e:"",ref:r}}var ce=e=>P(e)&&!xe(e)?e:{value:e,message:""},$e=async(e,r,t,i,n,l)=>{const{ref:f,refs:d,required:b,maxLength:x,minLength:D,min:C,max:F,pattern:M,validate:z,name:R,valueAsNumber:L,mount:ee}=e._f,V=c(t,R);if(!ee||r.has(R))return{};const G=d?d[0]:f,W=w=>{n&&G.reportValidity&&(G.setCustomValidity(Q(w)?"":w||""),G.reportValidity())},I={},m=Ge(f),h=he(f),A=m||h,S=(L||ze(f))&&U(f.value)&&U(V)||Ve(f)&&f.value===""||V===""||Array.isArray(V)&&!V.length,Y=Ht.bind(null,R,i,I),J=(w,p,N,q=ie.maxLength,j=ie.minLength)=>{const re=w?p:N;I[R]={type:w?q:j,message:re,ref:f,...Y(w?q:j,re)}};if(l?!Array.isArray(V)||!V.length:b&&(!A&&(S||$(V))||Q(V)&&!V||h&&!St(d).isValid||m&&!kt(d).isValid)){const{value:w,message:p}=be(b)?{value:!!b,message:b}:ce(b);if(w&&(I[R]={type:ie.required,message:p,ref:G,...Y(ie.required,p)},!i))return W(p),I}if(!S&&(!$(C)||!$(F))){let w,p;const N=ce(F),q=ce(C);if(!$(V)&&!isNaN(V)){const j=f.valueAsNumber||V&&+V;$(N.value)||(w=j>N.value),$(q.value)||(p=j<q.value)}else{const j=f.valueAsDate||new Date(V),re=me=>new Date(new Date().toDateString()+" "+me),ye=f.type=="time",oe=f.type=="week";se(N.value)&&V&&(w=ye?re(V)>re(N.value):oe?V>N.value:j>new Date(N.value)),se(q.value)&&V&&(p=ye?re(V)<re(q.value):oe?V<q.value:j<new Date(q.value))}if((w||p)&&(J(!!w,N.message,q.message,ie.max,ie.min),!i))return W(I[R].message),I}if((x||D)&&!S&&(se(V)||l&&Array.isArray(V))){const w=ce(x),p=ce(D),N=!$(w.value)&&V.length>+w.value,q=!$(p.value)&&V.length<+p.value;if((N||q)&&(J(N,w.message,p.message),!i))return W(I[R].message),I}if(M&&!S&&se(V)){const{value:w,message:p}=ce(M);if(xe(w)&&!V.match(w)&&(I[R]={type:ie.pattern,message:p,ref:f,...Y(ie.pattern,p)},!i))return W(p),I}if(z){if(te(z)){const w=await z(V,t),p=yt(w,G);if(p&&(I[R]={...p,...Y(ie.validate,p.message)},!i))return W(p.message),I}else if(P(z)){let w={};for(const p in z){if(!H(w)&&!i)break;const N=yt(await z[p](V,t),G,p);N&&(w={...N,...Y(p,N.message)},W(N.message),i&&(I[R]=w))}if(!H(w)&&(I[R]={ref:G,...w},!i))return I}}return W(!0),I};const er={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function tr(e={}){let r={...er,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1};const i={};let n=P(r.defaultValues)||P(r.values)?T(r.defaultValues||r.values)||{}:{},l=r.shouldUnregister?{}:T(n),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,x=0;const D={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let C={...D};const F={array:nt(),state:nt()},M=r.criteriaMode===Z.all,z=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},R=async s=>{if(!r.disabled&&(D.isValid||C.isValid||s)){const a=r.resolver?H((await h()).errors):await S(i,!0);a!==t.isValid&&F.state.next({isValid:a})}},L=(s,a)=>{!r.disabled&&(D.isValidating||D.validatingFields||C.isValidating||C.validatingFields)&&((s||Array.from(d.mount)).forEach(u=>{u&&(a?E(t.validatingFields,u,a):B(t.validatingFields,u))}),F.state.next({validatingFields:t.validatingFields,isValidating:!H(t.validatingFields)}))},ee=(s,a=[],u,g,y=!0,o=!0)=>{if(g&&u&&!r.disabled){if(f.action=!0,o&&Array.isArray(c(i,s))){const _=u(c(i,s),g.argA,g.argB);y&&E(i,s,_)}if(o&&Array.isArray(c(t.errors,s))){const _=u(c(t.errors,s),g.argA,g.argB);y&&E(t.errors,s,_),Zt(t.errors,s)}if((D.touchedFields||C.touchedFields)&&o&&Array.isArray(c(t.touchedFields,s))){const _=u(c(t.touchedFields,s),g.argA,g.argB);y&&E(t.touchedFields,s,_)}(D.dirtyFields||C.dirtyFields)&&(t.dirtyFields=ge(n,l)),F.state.next({name:s,isDirty:J(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else E(l,s,a)},V=(s,a)=>{E(t.errors,s,a),F.state.next({errors:t.errors})},G=s=>{t.errors=s,F.state.next({errors:t.errors,isValid:!1})},W=(s,a,u,g)=>{const y=c(i,s);if(y){const o=c(l,s,U(u)?c(n,s):u);U(o)||g&&g.defaultChecked||a?E(l,s,a?o:ct(y._f)):N(s,o),f.mount&&R()}},I=(s,a,u,g,y)=>{let o=!1,_=!1;const k={name:s};if(!r.disabled){if(!u||g){(D.isDirty||C.isDirty)&&(_=t.isDirty,t.isDirty=k.isDirty=J(),o=_!==k.isDirty);const O=le(c(n,s),a);_=!!c(t.dirtyFields,s),O?B(t.dirtyFields,s):E(t.dirtyFields,s,!0),k.dirtyFields=t.dirtyFields,o=o||(D.dirtyFields||C.dirtyFields)&&_!==!O}if(u){const O=c(t.touchedFields,s);O||(E(t.touchedFields,s,u),k.touchedFields=t.touchedFields,o=o||(D.touchedFields||C.touchedFields)&&O!==u)}o&&y&&F.state.next(k)}return o?k:{}},m=(s,a,u,g)=>{const y=c(t.errors,s),o=(D.isValid||C.isValid)&&Q(a)&&t.isValid!==a;if(r.delayError&&u?(b=z(()=>V(s,u)),b(r.delayError)):(clearTimeout(x),b=null,u?E(t.errors,s,u):B(t.errors,s)),(u?!le(y,u):y)||!H(g)||o){const _={...g,...o&&Q(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,..._},F.state.next(_)}},h=async s=>{L(s,!0);const a=await r.resolver(l,r.context,zt(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return L(s),a},A=async s=>{const{errors:a}=await h(s);if(s)for(const u of s){const g=c(a,u);g?E(t.errors,u,g):B(t.errors,u)}else t.errors=a;return a},S=async(s,a,u={valid:!0})=>{for(const g in s){const y=s[g];if(y){const{_f:o,..._}=y;if(o){const k=d.array.has(o.name),O=y._f&&Gt(y._f);O&&D.validatingFields&&L([g],!0);const X=await $e(y,d.disabled,l,M,r.shouldUseNativeValidation&&!a,k);if(O&&D.validatingFields&&L([g]),X[o.name]&&(u.valid=!1,a))break;!a&&(c(X,o.name)?k?Dt(t.errors,X,o.name):E(t.errors,o.name,X[o.name]):B(t.errors,o.name))}!H(_)&&await S(_,a,u)}}return u.valid},Y=()=>{for(const s of d.unMount){const a=c(i,s);a&&(a._f.refs?a._f.refs.every(u=>!Me(u)):!Me(a._f.ref))&&Ee(s)}d.unMount=new Set},J=(s,a)=>!r.disabled&&(s&&a&&E(l,s,a),!le(me(),n)),w=(s,a,u)=>Ft(s,d,{...f.mount?l:U(a)?n:se(s)?{[s]:a}:a},u,a),p=s=>we(c(f.mount?l:n,s,r.shouldUnregister?c(n,s,[]):[])),N=(s,a,u={})=>{const g=c(i,s);let y=a;if(g){const o=g._f;o&&(!o.disabled&&E(l,s,wt(a,o)),y=Ve(o.ref)&&$(a)?"":a,Vt(o.ref)?[...o.ref.options].forEach(_=>_.selected=y.includes(_.value)):o.refs?he(o.ref)?o.refs.forEach(_=>{(!_.defaultChecked||!_.disabled)&&(Array.isArray(y)?_.checked=!!y.find(k=>k===_.value):_.checked=y===_.value||!!y)}):o.refs.forEach(_=>_.checked=_.value===y):ze(o.ref)?o.ref.value="":(o.ref.value=y,o.ref.type||F.state.next({name:s,values:T(l)})))}(u.shouldDirty||u.shouldTouch)&&I(s,y,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&oe(s)},q=(s,a,u)=>{for(const g in a){if(!a.hasOwnProperty(g))return;const y=a[g],o=s+"."+g,_=c(i,o);(d.array.has(s)||P(y)||_&&!_._f)&&!ue(y)?q(o,y,u):N(o,y,u)}},j=(s,a,u={})=>{const g=c(i,s),y=d.array.has(s),o=T(a);E(l,s,o),y?(F.array.next({name:s,values:T(l)}),(D.isDirty||D.dirtyFields||C.isDirty||C.dirtyFields)&&u.shouldDirty&&F.state.next({name:s,dirtyFields:ge(n,l),isDirty:J(s,o)})):g&&!g._f&&!$(o)?q(s,o,u):N(s,o,u),He(s,d)&&F.state.next({...t}),F.state.next({name:f.mount?s:void 0,values:T(l)})},re=async s=>{f.mount=!0;const a=s.target;let u=a.name,g=!0;const y=c(i,u),o=O=>{g=Number.isNaN(O)||ue(O)&&isNaN(O.getTime())||le(O,c(l,u,O))},_=de(r.mode),k=de(r.reValidateMode);if(y){let O,X;const ve=a.type?ct(y._f):ht(s),ae=s.type===Fe.BLUR||s.type===Fe.FOCUS_OUT,Lt=!Yt(y._f)&&!r.resolver&&!c(t.errors,u)&&!y._f.deps||Xt(ae,c(t.touchedFields,u),t.isSubmitted,k,_),Oe=He(u,d,ae);E(l,u,ve),ae?(y._f.onBlur&&y._f.onBlur(s),b&&b(0)):y._f.onChange&&y._f.onChange(s);const Ue=I(u,ve,ae),Tt=!H(Ue)||Oe;if(!ae&&F.state.next({name:u,type:s.type,values:T(l)}),Lt)return(D.isValid||C.isValid)&&(r.mode==="onBlur"?ae&&R():ae||R()),Tt&&F.state.next({name:u,...Oe?{}:Ue});if(!ae&&Oe&&F.state.next({...t}),r.resolver){const{errors:st}=await h([u]);if(o(ve),g){const It=ft(t.errors,i,u),it=ft(st,i,It.name||u);O=it.error,u=it.name,X=H(st)}}else L([u],!0),O=(await $e(y,d.disabled,l,M,r.shouldUseNativeValidation))[u],L([u]),o(ve),g&&(O?X=!1:(D.isValid||C.isValid)&&(X=await S(i,!0)));g&&(y._f.deps&&oe(y._f.deps),m(u,X,O,Ue))}},ye=(s,a)=>{if(c(t.errors,a)&&s.focus)return s.focus(),1},oe=async(s,a={})=>{let u,g;const y=K(s);if(r.resolver){const o=await A(U(s)?s:y);u=H(o),g=s?!y.some(_=>c(o,_)):u}else s?(g=(await Promise.all(y.map(async o=>{const _=c(i,o);return await S(_&&_._f?{[o]:_}:_)}))).every(Boolean),!(!g&&!t.isValid)&&R()):g=u=await S(i);return F.state.next({...!se(s)||(D.isValid||C.isValid)&&u!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!g&&fe(i,ye,s?y:d.mount),g},me=s=>{const a={...f.mount?l:n};return U(s)?a:se(s)?c(a,s):s.map(u=>c(a,u))},Ye=(s,a)=>({invalid:!!c((a||t).errors,s),isDirty:!!c((a||t).dirtyFields,s),error:c((a||t).errors,s),isValidating:!!c(t.validatingFields,s),isTouched:!!c((a||t).touchedFields,s)}),Et=s=>{s&&K(s).forEach(a=>B(t.errors,a)),F.state.next({errors:s?t.errors:{}})},Je=(s,a,u)=>{const g=(c(i,s,{_f:{}})._f||{}).ref,y=c(t.errors,s)||{},{ref:o,message:_,type:k,...O}=y;E(t.errors,s,{...O,...a,ref:g}),F.state.next({name:s,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&g&&g.focus&&g.focus()},pt=(s,a)=>te(s)?F.state.subscribe({next:u=>s(w(void 0,a),u)}):w(s,a,!0),Qe=s=>F.state.subscribe({next:a=>{Qt(s.name,a.name,s.exact)&&Jt(a,s.formState||D,Rt,s.reRenderRoot)&&s.callback({values:{...l},...t,...a})}}).unsubscribe,Ct=s=>(f.mount=!0,C={...C,...s.formState},Qe({...s,formState:C})),Ee=(s,a={})=>{for(const u of s?K(s):d.mount)d.mount.delete(u),d.array.delete(u),a.keepValue||(B(i,u),B(l,u)),!a.keepError&&B(t.errors,u),!a.keepDirty&&B(t.dirtyFields,u),!a.keepTouched&&B(t.touchedFields,u),!a.keepIsValidating&&B(t.validatingFields,u),!r.shouldUnregister&&!a.keepDefaultValue&&B(n,u);F.state.next({values:T(l)}),F.state.next({...t,...a.keepDirty?{isDirty:J()}:{}}),!a.keepIsValid&&R()},Xe=({disabled:s,name:a})=>{(Q(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},pe=(s,a={})=>{let u=c(i,s);const g=Q(a.disabled)||Q(r.disabled);return E(i,s,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),u?Xe({disabled:Q(a.disabled)?a.disabled:r.disabled,name:s}):W(s,!0,a.value),{...g?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:s,onChange:re,onBlur:re,ref:y=>{if(y){pe(s,a),u=c(i,s);const o=U(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,_=$t(o),k=u._f.refs||[];if(_?k.find(O=>O===o):o===u._f.ref)return;E(i,s,{_f:{...u._f,..._?{refs:[...k.filter(Me),o,...Array.isArray(c(n,s))?[{}]:[]],ref:{type:o.type,name:s}}:{ref:o}}}),W(s,!1,void 0,o)}else u=c(i,s,{}),u._f&&(u._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(mt(d.array,s)&&f.action)&&d.unMount.add(s)}}},Ce=()=>r.shouldFocusError&&fe(i,ye,d.mount),Ot=s=>{Q(s)&&(F.state.next({disabled:s}),fe(i,(a,u)=>{const g=c(i,u);g&&(a.disabled=g._f.disabled||s,Array.isArray(g._f.refs)&&g._f.refs.forEach(y=>{y.disabled=g._f.disabled||s}))},0,!1))},Ze=(s,a)=>async u=>{let g;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let y=T(l);if(F.state.next({isSubmitting:!0}),r.resolver){const{errors:o,values:_}=await h();t.errors=o,y=T(_)}else await S(i);if(d.disabled.size)for(const o of d.disabled)B(y,o);if(B(t.errors,"root"),H(t.errors)){F.state.next({errors:{}});try{await s(y,u)}catch(o){g=o}}else a&&await a({...t.errors},u),Ce(),setTimeout(Ce);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(t.errors)&&!g,submitCount:t.submitCount+1,errors:t.errors}),g)throw g},Ut=(s,a={})=>{c(i,s)&&(U(a.defaultValue)?j(s,T(c(n,s))):(j(s,a.defaultValue),E(n,s,T(a.defaultValue))),a.keepTouched||B(t.touchedFields,s),a.keepDirty||(B(t.dirtyFields,s),t.isDirty=a.defaultValue?J(s,T(c(n,s))):J()),a.keepError||(B(t.errors,s),D.isValid&&R()),F.state.next({...t}))},et=(s,a={})=>{const u=s?T(s):n,g=T(u),y=H(s),o=y?n:g;if(a.keepDefaultValues||(n=u),!a.keepValues){if(a.keepDirtyValues){const _=new Set([...d.mount,...Object.keys(ge(n,l))]);for(const k of Array.from(_))c(t.dirtyFields,k)?E(o,k,c(l,k)):j(k,c(o,k))}else{if(je&&U(s))for(const _ of d.mount){const k=c(i,_);if(k&&k._f){const O=Array.isArray(k._f.refs)?k._f.refs[0]:k._f.ref;if(Ve(O)){const X=O.closest("form");if(X){X.reset();break}}}}for(const _ of d.mount){const k=c(o,_,c(n,_));U(k)||(E(o,_,k),j(_,c(o,_)))}}l=T(o),F.array.next({values:{...o}}),F.state.next({values:{...o}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!D.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,F.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:y?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!le(s,n)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y?{}:a.keepDirtyValues?a.keepDefaultValues&&l?ge(n,l):t.dirtyFields:a.keepDefaultValues&&s?ge(n,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},tt=(s,a)=>et(te(s)?s(l):s,a),Mt=(s,a={})=>{const u=c(i,s),g=u&&u._f;if(g){const y=g.refs?g.refs[0]:g.ref;y.focus&&(y.focus(),a.shouldSelect&&te(y.select)&&y.select())}},Rt=s=>{t={...t,...s}},rt={control:{register:pe,unregister:Ee,getFieldState:Ye,handleSubmit:Ze,setError:Je,_subscribe:Qe,_runSchema:h,_focusError:Ce,_getWatch:w,_getDirty:J,_setValid:R,_setFieldArray:ee,_setDisabledField:Xe,_setErrors:G,_getFieldArray:p,_reset:et,_resetDefaultValues:()=>te(r.defaultValues)&&r.defaultValues().then(s=>{tt(s,r.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:Y,_disableForm:Ot,_subjects:F,_proxyFormState:D,get _fields(){return i},get _formValues(){return l},get _state(){return f},set _state(s){f=s},get _defaultValues(){return n},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Ct,trigger:oe,register:pe,handleSubmit:Ze,watch:pt,setValue:j,getValues:me,reset:tt,resetField:Ut,clearErrors:Et,unregister:Ee,setError:Je,setFocus:Mt,getFieldState:Ye};return{...rt,formControl:rt}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=(Math.random()*16+e)%16|0;return(r=="x"?t:t&3|8).toString(16)})},Re=(e,r,t={})=>t.shouldFocus||U(t.shouldFocus)?t.focusName||`${e}.${U(t.focusIndex)?r:t.focusIndex}.`:"",Le=(e,r)=>[...e,...K(r)],Te=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ie(e,r,t){return[...e.slice(0,r),...K(t),...e.slice(r)]}var Ne=(e,r,t)=>Array.isArray(e)?(U(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[],Be=(e,r)=>[...K(r),...K(e)];function rr(e,r){let t=0;const i=[...e];for(const n of r)i.splice(n-t,1),t++;return we(i).length?i:[]}var Pe=(e,r)=>U(r)?[]:rr(e,K(r).sort((t,i)=>t-i)),We=(e,r,t)=>{[e[r],e[t]]=[e[t],e[r]]},gt=(e,r,t)=>(e[r]=t,e);function nr(e){const r=ke(),{control:t=r.control,name:i,keyName:n="id",shouldUnregister:l,rules:f}=e,[d,b]=v.useState(t._getFieldArray(i)),x=v.useRef(t._getFieldArray(i).map(ne)),D=v.useRef(d),C=v.useRef(i),F=v.useRef(!1);C.current=i,D.current=d,t._names.array.add(i),f&&t.register(i,f),De(()=>t._subjects.array.subscribe({next:({values:m,name:h})=>{if(h===C.current||!h){const A=c(m,C.current);Array.isArray(A)&&(b(A),x.current=A.map(ne))}}}).unsubscribe,[t]);const M=v.useCallback(m=>{F.current=!0,t._setFieldArray(i,m)},[t,i]),z=(m,h)=>{const A=K(T(m)),S=Le(t._getFieldArray(i),A);t._names.focus=Re(i,S.length-1,h),x.current=Le(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Le,{argA:Te(m)})},R=(m,h)=>{const A=K(T(m)),S=Be(t._getFieldArray(i),A);t._names.focus=Re(i,0,h),x.current=Be(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Be,{argA:Te(m)})},L=m=>{const h=Pe(t._getFieldArray(i),m);x.current=Pe(x.current,m),M(h),b(h),!Array.isArray(c(t._fields,i))&&E(t._fields,i,void 0),t._setFieldArray(i,h,Pe,{argA:m})},ee=(m,h,A)=>{const S=K(T(h)),Y=Ie(t._getFieldArray(i),m,S);t._names.focus=Re(i,m,A),x.current=Ie(x.current,m,S.map(ne)),M(Y),b(Y),t._setFieldArray(i,Y,Ie,{argA:m,argB:Te(h)})},V=(m,h)=>{const A=t._getFieldArray(i);We(A,m,h),We(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,We,{argA:m,argB:h},!1)},G=(m,h)=>{const A=t._getFieldArray(i);Ne(A,m,h),Ne(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,Ne,{argA:m,argB:h},!1)},W=(m,h)=>{const A=T(h),S=gt(t._getFieldArray(i),m,A);x.current=[...S].map((Y,J)=>!Y||J===m?ne():x.current[J]),M(S),b([...S]),t._setFieldArray(i,S,gt,{argA:m,argB:A},!0,!1)},I=m=>{const h=K(T(m));x.current=h.map(ne),M([...h]),b([...h]),t._setFieldArray(i,[...h],A=>A,{},!0,!1)};return v.useEffect(()=>{if(t._state.action=!1,He(i,t._names)&&t._subjects.state.next({...t._formState}),F.current&&(!de(t._options.mode).isOnSubmit||t._formState.isSubmitted)&&!de(t._options.reValidateMode).isOnSubmit)if(t._options.resolver)t._runSchema([i]).then(m=>{const h=c(m.errors,i),A=c(t._formState.errors,i);(A?!h&&A.type||h&&(A.type!==h.type||A.message!==h.message):h&&h.type)&&(h?E(t._formState.errors,i,h):B(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const m=c(t._fields,i);m&&m._f&&!(de(t._options.reValidateMode).isOnSubmit&&de(t._options.mode).isOnSubmit)&&$e(m,t._names.disabled,t._formValues,t._options.criteriaMode===Z.all,t._options.shouldUseNativeValidation,!0).then(h=>!H(h)&&t._subjects.state.next({errors:Dt(t._formState.errors,h,i)}))}t._subjects.state.next({name:i,values:T(t._formValues)}),t._names.focus&&fe(t._fields,(m,h)=>{if(t._names.focus&&h.startsWith(t._names.focus)&&m.focus)return m.focus(),1}),t._names.focus="",t._setValid(),F.current=!1},[d,i,t]),v.useEffect(()=>(!c(t._formValues,i)&&t._setFieldArray(i),()=>{const m=(h,A)=>{const S=c(t._fields,h);S&&S._f&&(S._f.mount=A)};t._options.shouldUnregister||l?t.unregister(i):m(i,!1)}),[i,t,n,l]),{swap:v.useCallback(V,[M,i,t]),move:v.useCallback(G,[M,i,t]),prepend:v.useCallback(R,[M,i,t]),append:v.useCallback(z,[M,i,t]),remove:v.useCallback(L,[M,i,t]),insert:v.useCallback(ee,[M,i,t]),update:v.useCallback(W,[M,i,t]),replace:v.useCallback(I,[M,i,t]),fields:v.useMemo(()=>d.map((m,h)=>({...m,[n]:x.current[h]||ne()})),[d,n])}}function lr(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[i,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=tr(e);r.current={...d,formState:i}}const l=r.current.control;return l._options=e,De(()=>{const f=l._subscribe({formState:l._proxyFormState,callback:()=>n({...l._formState}),reRenderRoot:!0});return n(d=>({...d,isReady:!0})),l._formState.isReady=!0,f},[l]),v.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),v.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),v.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),v.useEffect(()=>{if(l._proxyFormState.isDirty){const f=l._getDirty();f!==i.isDirty&&l._subjects.state.next({isDirty:f})}},[l,i.isDirty]),v.useEffect(()=>{e.values&&!le(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,n(f=>({...f}))):l._resetDefaultValues()},[l,e.values]),v.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),r.current.formState=bt(i,l),r.current}export{ar as C,Wt as a,nr as b,lr as u};
1
+ import{bf as v,r as at}from"./index-CHD9Cmfg.js";var he=e=>e.type==="checkbox",ue=e=>e instanceof Date,$=e=>e==null;const _t=e=>typeof e=="object";var P=e=>!$(e)&&!Array.isArray(e)&&_t(e)&&!ue(e),ht=e=>P(e)&&e.target?he(e.target)?e.target.checked:e.target.value:e,Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mt=(e,r)=>e.has(Nt(r)),Bt=e=>{const r=e.constructor&&e.constructor.prototype;return P(r)&&r.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function T(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(!(je&&(e instanceof Blob||i))&&(t||P(e)))if(r=t?[]:{},!t&&!Bt(e))r=e;else for(const n in e)e.hasOwnProperty(n)&&(r[n]=T(e[n]));else return e;return r}var Se=e=>/^\w*$/.test(e),U=e=>e===void 0,we=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>we(e.replace(/["|']|\]/g,"").split(/\.|\[/)),c=(e,r,t)=>{if(!r||!P(e))return t;const i=(Se(r)?[r]:Ke(r)).reduce((n,l)=>$(n)?n:n[l],e);return U(i)||i===e?U(e[r])?t:e[r]:i},Q=e=>typeof e=="boolean",E=(e,r,t)=>{let i=-1;const n=Se(r)?[r]:Ke(r),l=n.length,f=l-1;for(;++i<l;){const d=n[i];let b=t;if(i!==f){const x=e[d];b=P(x)||Array.isArray(x)?x:isNaN(+n[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=b,e=e[d]}};const Fe={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vt=v.createContext(null);vt.displayName="HookFormContext";const ke=()=>v.useContext(vt);var bt=(e,r,t,i=!0)=>{const n={defaultValues:r._defaultValues};for(const l in e)Object.defineProperty(n,l,{get:()=>{const f=l;return r._proxyFormState[f]!==Z.all&&(r._proxyFormState[f]=!i||Z.all),t&&(t[f]=!0),e[f]}});return n};const De=typeof window<"u"?at.useLayoutEffect:at.useEffect;function Pt(e){const r=ke(),{control:t=r.control,disabled:i,name:n,exact:l}=e||{},[f,d]=v.useState(t._formState),b=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return De(()=>t._subscribe({name:n,formState:b.current,exact:l,callback:x=>{!i&&d({...t._formState,...x})}}),[n,i,l]),v.useEffect(()=>{b.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>bt(f,t,b.current,!1),[f,t])}var se=e=>typeof e=="string",Ft=(e,r,t,i,n)=>se(e)?(i&&r.watch.add(e),c(t,e,n)):Array.isArray(e)?e.map(l=>(i&&r.watch.add(l),c(t,l))):(i&&(r.watchAll=!0),t);function Wt(e){const r=ke(),{control:t=r.control,name:i,defaultValue:n,disabled:l,exact:f}=e||{},d=v.useRef(n),[b,x]=v.useState(t._getWatch(i,d.current));return De(()=>t._subscribe({name:i,formState:{values:!0},exact:f,callback:D=>!l&&x(Ft(i,t._names,D.values||t._formValues,!1,d.current))}),[i,t,l,f]),v.useEffect(()=>t._removeUnmounted()),b}function qt(e){const r=ke(),{name:t,disabled:i,control:n=r.control,shouldUnregister:l}=e,f=mt(n._names.array,t),d=Wt({control:n,name:t,defaultValue:c(n._formValues,t,c(n._defaultValues,t,e.defaultValue)),exact:!0}),b=Pt({control:n,name:t,exact:!0}),x=v.useRef(e),D=v.useRef(n.register(t,{...e.rules,value:d,...Q(e.disabled)?{disabled:e.disabled}:{}})),C=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!c(b.errors,t)},isDirty:{enumerable:!0,get:()=>!!c(b.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!c(b.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!c(b.validatingFields,t)},error:{enumerable:!0,get:()=>c(b.errors,t)}}),[b,t]),F=v.useCallback(L=>D.current.onChange({target:{value:ht(L),name:t},type:Fe.CHANGE}),[t]),M=v.useCallback(()=>D.current.onBlur({target:{value:c(n._formValues,t),name:t},type:Fe.BLUR}),[t,n._formValues]),z=v.useCallback(L=>{const ee=c(n._fields,t);ee&&L&&(ee._f.ref={focus:()=>L.focus&&L.focus(),select:()=>L.select&&L.select(),setCustomValidity:V=>L.setCustomValidity(V),reportValidity:()=>L.reportValidity()})},[n._fields,t]),R=v.useMemo(()=>({name:t,value:d,...Q(i)||b.disabled?{disabled:b.disabled||i}:{},onChange:F,onBlur:M,ref:z}),[t,i,b.disabled,F,M,z,d]);return v.useEffect(()=>{const L=n._options.shouldUnregister||l;n.register(t,{...x.current.rules,...Q(x.current.disabled)?{disabled:x.current.disabled}:{}});const ee=(V,G)=>{const W=c(n._fields,V);W&&W._f&&(W._f.mount=G)};if(ee(t,!0),L){const V=T(c(n._options.defaultValues,t));E(n._defaultValues,t,V),U(c(n._formValues,t))&&E(n._formValues,t,V)}return!f&&n.register(t),()=>{(f?L&&!n._state.action:L)?n.unregister(t):ee(t,!1)}},[t,n,f,l]),v.useEffect(()=>{n._setDisabledField({disabled:i,name:t})},[i,t,n]),v.useMemo(()=>({field:R,formState:b,fieldState:C}),[R,b,C])}const ar=e=>e.render(qt(e));var Ht=(e,r,t,i,n)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:n||!0}}:{},K=e=>Array.isArray(e)?e:[e],nt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const l of e)l.next&&l.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(l=>l!==n)}}),unsubscribe:()=>{e=[]}}},qe=e=>$(e)||!_t(e);function le(e,r,t=new WeakSet){if(qe(e)||qe(r))return e===r;if(ue(e)&&ue(r))return e.getTime()===r.getTime();const i=Object.keys(e),n=Object.keys(r);if(i.length!==n.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const l of i){const f=e[l];if(!n.includes(l))return!1;if(l!=="ref"){const d=r[l];if(ue(f)&&ue(d)||P(f)&&P(d)||Array.isArray(f)&&Array.isArray(d)?!le(f,d,t):f!==d)return!1}}return!0}var H=e=>P(e)&&!Object.keys(e).length,ze=e=>e.type==="file",te=e=>typeof e=="function",Ve=e=>{if(!je)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Vt=e=>e.type==="select-multiple",Ge=e=>e.type==="radio",$t=e=>Ge(e)||he(e),Me=e=>Ve(e)&&e.isConnected;function jt(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=U(e)?i++:e[r[i++]];return e}function Kt(e){for(const r in e)if(e.hasOwnProperty(r)&&!U(e[r]))return!1;return!0}function B(e,r){const t=Array.isArray(r)?r:Se(r)?[r]:Ke(r),i=t.length===1?e:jt(e,t),n=t.length-1,l=t[n];return i&&delete i[l],n!==0&&(P(i)&&H(i)||Array.isArray(i)&&Kt(i))&&B(e,t.slice(0,-1)),e}var At=e=>{for(const r in e)if(te(e[r]))return!0;return!1};function Ae(e,r={}){const t=Array.isArray(e);if(P(e)||t)for(const i in e)Array.isArray(e[i])||P(e[i])&&!At(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ae(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function xt(e,r,t){const i=Array.isArray(e);if(P(e)||i)for(const n in e)Array.isArray(e[n])||P(e[n])&&!At(e[n])?U(r)||qe(t[n])?t[n]=Array.isArray(e[n])?Ae(e[n],[]):{...Ae(e[n])}:xt(e[n],$(r)?{}:r[n],t[n]):t[n]=!le(e[n],r[n]);return t}var ge=(e,r)=>xt(e,r,Ae(r));const lt={value:!1,isValid:!1},ut={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?ut:{value:e[0].value,isValid:!0}:ut:lt}return lt},wt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>U(e)?e:r?e===""?NaN:e&&+e:t&&se(e)?new Date(e):i?i(e):e;const ot={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,ot):ot;function ct(e){const r=e.ref;return ze(r)?r.files:Ge(r)?kt(e.refs).value:Vt(r)?[...r.selectedOptions].map(({value:t})=>t):he(r)?St(e.refs).value:wt(U(r.value)?e.ref.value:r.value,e)}var zt=(e,r,t,i)=>{const n={};for(const l of e){const f=c(r,l);f&&E(n,l,f._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},xe=e=>e instanceof RegExp,_e=e=>U(e)?e:xe(e)?e.source:P(e)?xe(e.value)?e.value.source:e.value:e,de=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const dt="AsyncFunction";var Gt=e=>!!e&&!!e.validate&&!!(te(e.validate)&&e.validate.constructor.name===dt||P(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===dt)),Yt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),He=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const fe=(e,r,t,i)=>{for(const n of t||Object.keys(e)){const l=c(e,n);if(l){const{_f:f,...d}=l;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],n)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(fe(d,r))break}else if(P(d)&&fe(d,r))break}}};function ft(e,r,t){const i=c(e,t);if(i||Se(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const l=n.join("."),f=c(r,l),d=c(e,l);if(f&&!Array.isArray(f)&&t!==l)return{name:t};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};n.pop()}return{name:t}}var Jt=(e,r,t,i)=>{t(e);const{name:n,...l}=e;return H(l)||Object.keys(l).length>=Object.keys(r).length||Object.keys(l).find(f=>r[f]===(!i||Z.all))},Qt=(e,r,t)=>!e||!r||e===r||K(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Xt=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Zt=(e,r)=>!we(c(e,r)).length&&B(e,r),Dt=(e,r,t)=>{const i=K(c(e,t));return E(i,"root",r[t]),E(e,t,i),e},be=e=>se(e);function yt(e,r,t="validate"){if(be(e)||Array.isArray(e)&&e.every(be)||Q(e)&&!e)return{type:t,message:be(e)?e:"",ref:r}}var ce=e=>P(e)&&!xe(e)?e:{value:e,message:""},$e=async(e,r,t,i,n,l)=>{const{ref:f,refs:d,required:b,maxLength:x,minLength:D,min:C,max:F,pattern:M,validate:z,name:R,valueAsNumber:L,mount:ee}=e._f,V=c(t,R);if(!ee||r.has(R))return{};const G=d?d[0]:f,W=w=>{n&&G.reportValidity&&(G.setCustomValidity(Q(w)?"":w||""),G.reportValidity())},I={},m=Ge(f),h=he(f),A=m||h,S=(L||ze(f))&&U(f.value)&&U(V)||Ve(f)&&f.value===""||V===""||Array.isArray(V)&&!V.length,Y=Ht.bind(null,R,i,I),J=(w,p,N,q=ie.maxLength,j=ie.minLength)=>{const re=w?p:N;I[R]={type:w?q:j,message:re,ref:f,...Y(w?q:j,re)}};if(l?!Array.isArray(V)||!V.length:b&&(!A&&(S||$(V))||Q(V)&&!V||h&&!St(d).isValid||m&&!kt(d).isValid)){const{value:w,message:p}=be(b)?{value:!!b,message:b}:ce(b);if(w&&(I[R]={type:ie.required,message:p,ref:G,...Y(ie.required,p)},!i))return W(p),I}if(!S&&(!$(C)||!$(F))){let w,p;const N=ce(F),q=ce(C);if(!$(V)&&!isNaN(V)){const j=f.valueAsNumber||V&&+V;$(N.value)||(w=j>N.value),$(q.value)||(p=j<q.value)}else{const j=f.valueAsDate||new Date(V),re=me=>new Date(new Date().toDateString()+" "+me),ye=f.type=="time",oe=f.type=="week";se(N.value)&&V&&(w=ye?re(V)>re(N.value):oe?V>N.value:j>new Date(N.value)),se(q.value)&&V&&(p=ye?re(V)<re(q.value):oe?V<q.value:j<new Date(q.value))}if((w||p)&&(J(!!w,N.message,q.message,ie.max,ie.min),!i))return W(I[R].message),I}if((x||D)&&!S&&(se(V)||l&&Array.isArray(V))){const w=ce(x),p=ce(D),N=!$(w.value)&&V.length>+w.value,q=!$(p.value)&&V.length<+p.value;if((N||q)&&(J(N,w.message,p.message),!i))return W(I[R].message),I}if(M&&!S&&se(V)){const{value:w,message:p}=ce(M);if(xe(w)&&!V.match(w)&&(I[R]={type:ie.pattern,message:p,ref:f,...Y(ie.pattern,p)},!i))return W(p),I}if(z){if(te(z)){const w=await z(V,t),p=yt(w,G);if(p&&(I[R]={...p,...Y(ie.validate,p.message)},!i))return W(p.message),I}else if(P(z)){let w={};for(const p in z){if(!H(w)&&!i)break;const N=yt(await z[p](V,t),G,p);N&&(w={...N,...Y(p,N.message)},W(N.message),i&&(I[R]=w))}if(!H(w)&&(I[R]={ref:G,...w},!i))return I}}return W(!0),I};const er={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function tr(e={}){let r={...er,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1};const i={};let n=P(r.defaultValues)||P(r.values)?T(r.defaultValues||r.values)||{}:{},l=r.shouldUnregister?{}:T(n),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,x=0;const D={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let C={...D};const F={array:nt(),state:nt()},M=r.criteriaMode===Z.all,z=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},R=async s=>{if(!r.disabled&&(D.isValid||C.isValid||s)){const a=r.resolver?H((await h()).errors):await S(i,!0);a!==t.isValid&&F.state.next({isValid:a})}},L=(s,a)=>{!r.disabled&&(D.isValidating||D.validatingFields||C.isValidating||C.validatingFields)&&((s||Array.from(d.mount)).forEach(u=>{u&&(a?E(t.validatingFields,u,a):B(t.validatingFields,u))}),F.state.next({validatingFields:t.validatingFields,isValidating:!H(t.validatingFields)}))},ee=(s,a=[],u,g,y=!0,o=!0)=>{if(g&&u&&!r.disabled){if(f.action=!0,o&&Array.isArray(c(i,s))){const _=u(c(i,s),g.argA,g.argB);y&&E(i,s,_)}if(o&&Array.isArray(c(t.errors,s))){const _=u(c(t.errors,s),g.argA,g.argB);y&&E(t.errors,s,_),Zt(t.errors,s)}if((D.touchedFields||C.touchedFields)&&o&&Array.isArray(c(t.touchedFields,s))){const _=u(c(t.touchedFields,s),g.argA,g.argB);y&&E(t.touchedFields,s,_)}(D.dirtyFields||C.dirtyFields)&&(t.dirtyFields=ge(n,l)),F.state.next({name:s,isDirty:J(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else E(l,s,a)},V=(s,a)=>{E(t.errors,s,a),F.state.next({errors:t.errors})},G=s=>{t.errors=s,F.state.next({errors:t.errors,isValid:!1})},W=(s,a,u,g)=>{const y=c(i,s);if(y){const o=c(l,s,U(u)?c(n,s):u);U(o)||g&&g.defaultChecked||a?E(l,s,a?o:ct(y._f)):N(s,o),f.mount&&R()}},I=(s,a,u,g,y)=>{let o=!1,_=!1;const k={name:s};if(!r.disabled){if(!u||g){(D.isDirty||C.isDirty)&&(_=t.isDirty,t.isDirty=k.isDirty=J(),o=_!==k.isDirty);const O=le(c(n,s),a);_=!!c(t.dirtyFields,s),O?B(t.dirtyFields,s):E(t.dirtyFields,s,!0),k.dirtyFields=t.dirtyFields,o=o||(D.dirtyFields||C.dirtyFields)&&_!==!O}if(u){const O=c(t.touchedFields,s);O||(E(t.touchedFields,s,u),k.touchedFields=t.touchedFields,o=o||(D.touchedFields||C.touchedFields)&&O!==u)}o&&y&&F.state.next(k)}return o?k:{}},m=(s,a,u,g)=>{const y=c(t.errors,s),o=(D.isValid||C.isValid)&&Q(a)&&t.isValid!==a;if(r.delayError&&u?(b=z(()=>V(s,u)),b(r.delayError)):(clearTimeout(x),b=null,u?E(t.errors,s,u):B(t.errors,s)),(u?!le(y,u):y)||!H(g)||o){const _={...g,...o&&Q(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,..._},F.state.next(_)}},h=async s=>{L(s,!0);const a=await r.resolver(l,r.context,zt(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return L(s),a},A=async s=>{const{errors:a}=await h(s);if(s)for(const u of s){const g=c(a,u);g?E(t.errors,u,g):B(t.errors,u)}else t.errors=a;return a},S=async(s,a,u={valid:!0})=>{for(const g in s){const y=s[g];if(y){const{_f:o,..._}=y;if(o){const k=d.array.has(o.name),O=y._f&&Gt(y._f);O&&D.validatingFields&&L([g],!0);const X=await $e(y,d.disabled,l,M,r.shouldUseNativeValidation&&!a,k);if(O&&D.validatingFields&&L([g]),X[o.name]&&(u.valid=!1,a))break;!a&&(c(X,o.name)?k?Dt(t.errors,X,o.name):E(t.errors,o.name,X[o.name]):B(t.errors,o.name))}!H(_)&&await S(_,a,u)}}return u.valid},Y=()=>{for(const s of d.unMount){const a=c(i,s);a&&(a._f.refs?a._f.refs.every(u=>!Me(u)):!Me(a._f.ref))&&Ee(s)}d.unMount=new Set},J=(s,a)=>!r.disabled&&(s&&a&&E(l,s,a),!le(me(),n)),w=(s,a,u)=>Ft(s,d,{...f.mount?l:U(a)?n:se(s)?{[s]:a}:a},u,a),p=s=>we(c(f.mount?l:n,s,r.shouldUnregister?c(n,s,[]):[])),N=(s,a,u={})=>{const g=c(i,s);let y=a;if(g){const o=g._f;o&&(!o.disabled&&E(l,s,wt(a,o)),y=Ve(o.ref)&&$(a)?"":a,Vt(o.ref)?[...o.ref.options].forEach(_=>_.selected=y.includes(_.value)):o.refs?he(o.ref)?o.refs.forEach(_=>{(!_.defaultChecked||!_.disabled)&&(Array.isArray(y)?_.checked=!!y.find(k=>k===_.value):_.checked=y===_.value||!!y)}):o.refs.forEach(_=>_.checked=_.value===y):ze(o.ref)?o.ref.value="":(o.ref.value=y,o.ref.type||F.state.next({name:s,values:T(l)})))}(u.shouldDirty||u.shouldTouch)&&I(s,y,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&oe(s)},q=(s,a,u)=>{for(const g in a){if(!a.hasOwnProperty(g))return;const y=a[g],o=s+"."+g,_=c(i,o);(d.array.has(s)||P(y)||_&&!_._f)&&!ue(y)?q(o,y,u):N(o,y,u)}},j=(s,a,u={})=>{const g=c(i,s),y=d.array.has(s),o=T(a);E(l,s,o),y?(F.array.next({name:s,values:T(l)}),(D.isDirty||D.dirtyFields||C.isDirty||C.dirtyFields)&&u.shouldDirty&&F.state.next({name:s,dirtyFields:ge(n,l),isDirty:J(s,o)})):g&&!g._f&&!$(o)?q(s,o,u):N(s,o,u),He(s,d)&&F.state.next({...t}),F.state.next({name:f.mount?s:void 0,values:T(l)})},re=async s=>{f.mount=!0;const a=s.target;let u=a.name,g=!0;const y=c(i,u),o=O=>{g=Number.isNaN(O)||ue(O)&&isNaN(O.getTime())||le(O,c(l,u,O))},_=de(r.mode),k=de(r.reValidateMode);if(y){let O,X;const ve=a.type?ct(y._f):ht(s),ae=s.type===Fe.BLUR||s.type===Fe.FOCUS_OUT,Lt=!Yt(y._f)&&!r.resolver&&!c(t.errors,u)&&!y._f.deps||Xt(ae,c(t.touchedFields,u),t.isSubmitted,k,_),Oe=He(u,d,ae);E(l,u,ve),ae?(y._f.onBlur&&y._f.onBlur(s),b&&b(0)):y._f.onChange&&y._f.onChange(s);const Ue=I(u,ve,ae),Tt=!H(Ue)||Oe;if(!ae&&F.state.next({name:u,type:s.type,values:T(l)}),Lt)return(D.isValid||C.isValid)&&(r.mode==="onBlur"?ae&&R():ae||R()),Tt&&F.state.next({name:u,...Oe?{}:Ue});if(!ae&&Oe&&F.state.next({...t}),r.resolver){const{errors:st}=await h([u]);if(o(ve),g){const It=ft(t.errors,i,u),it=ft(st,i,It.name||u);O=it.error,u=it.name,X=H(st)}}else L([u],!0),O=(await $e(y,d.disabled,l,M,r.shouldUseNativeValidation))[u],L([u]),o(ve),g&&(O?X=!1:(D.isValid||C.isValid)&&(X=await S(i,!0)));g&&(y._f.deps&&oe(y._f.deps),m(u,X,O,Ue))}},ye=(s,a)=>{if(c(t.errors,a)&&s.focus)return s.focus(),1},oe=async(s,a={})=>{let u,g;const y=K(s);if(r.resolver){const o=await A(U(s)?s:y);u=H(o),g=s?!y.some(_=>c(o,_)):u}else s?(g=(await Promise.all(y.map(async o=>{const _=c(i,o);return await S(_&&_._f?{[o]:_}:_)}))).every(Boolean),!(!g&&!t.isValid)&&R()):g=u=await S(i);return F.state.next({...!se(s)||(D.isValid||C.isValid)&&u!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!g&&fe(i,ye,s?y:d.mount),g},me=s=>{const a={...f.mount?l:n};return U(s)?a:se(s)?c(a,s):s.map(u=>c(a,u))},Ye=(s,a)=>({invalid:!!c((a||t).errors,s),isDirty:!!c((a||t).dirtyFields,s),error:c((a||t).errors,s),isValidating:!!c(t.validatingFields,s),isTouched:!!c((a||t).touchedFields,s)}),Et=s=>{s&&K(s).forEach(a=>B(t.errors,a)),F.state.next({errors:s?t.errors:{}})},Je=(s,a,u)=>{const g=(c(i,s,{_f:{}})._f||{}).ref,y=c(t.errors,s)||{},{ref:o,message:_,type:k,...O}=y;E(t.errors,s,{...O,...a,ref:g}),F.state.next({name:s,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&g&&g.focus&&g.focus()},pt=(s,a)=>te(s)?F.state.subscribe({next:u=>s(w(void 0,a),u)}):w(s,a,!0),Qe=s=>F.state.subscribe({next:a=>{Qt(s.name,a.name,s.exact)&&Jt(a,s.formState||D,Rt,s.reRenderRoot)&&s.callback({values:{...l},...t,...a})}}).unsubscribe,Ct=s=>(f.mount=!0,C={...C,...s.formState},Qe({...s,formState:C})),Ee=(s,a={})=>{for(const u of s?K(s):d.mount)d.mount.delete(u),d.array.delete(u),a.keepValue||(B(i,u),B(l,u)),!a.keepError&&B(t.errors,u),!a.keepDirty&&B(t.dirtyFields,u),!a.keepTouched&&B(t.touchedFields,u),!a.keepIsValidating&&B(t.validatingFields,u),!r.shouldUnregister&&!a.keepDefaultValue&&B(n,u);F.state.next({values:T(l)}),F.state.next({...t,...a.keepDirty?{isDirty:J()}:{}}),!a.keepIsValid&&R()},Xe=({disabled:s,name:a})=>{(Q(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},pe=(s,a={})=>{let u=c(i,s);const g=Q(a.disabled)||Q(r.disabled);return E(i,s,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),u?Xe({disabled:Q(a.disabled)?a.disabled:r.disabled,name:s}):W(s,!0,a.value),{...g?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:s,onChange:re,onBlur:re,ref:y=>{if(y){pe(s,a),u=c(i,s);const o=U(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,_=$t(o),k=u._f.refs||[];if(_?k.find(O=>O===o):o===u._f.ref)return;E(i,s,{_f:{...u._f,..._?{refs:[...k.filter(Me),o,...Array.isArray(c(n,s))?[{}]:[]],ref:{type:o.type,name:s}}:{ref:o}}}),W(s,!1,void 0,o)}else u=c(i,s,{}),u._f&&(u._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(mt(d.array,s)&&f.action)&&d.unMount.add(s)}}},Ce=()=>r.shouldFocusError&&fe(i,ye,d.mount),Ot=s=>{Q(s)&&(F.state.next({disabled:s}),fe(i,(a,u)=>{const g=c(i,u);g&&(a.disabled=g._f.disabled||s,Array.isArray(g._f.refs)&&g._f.refs.forEach(y=>{y.disabled=g._f.disabled||s}))},0,!1))},Ze=(s,a)=>async u=>{let g;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let y=T(l);if(F.state.next({isSubmitting:!0}),r.resolver){const{errors:o,values:_}=await h();t.errors=o,y=T(_)}else await S(i);if(d.disabled.size)for(const o of d.disabled)B(y,o);if(B(t.errors,"root"),H(t.errors)){F.state.next({errors:{}});try{await s(y,u)}catch(o){g=o}}else a&&await a({...t.errors},u),Ce(),setTimeout(Ce);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(t.errors)&&!g,submitCount:t.submitCount+1,errors:t.errors}),g)throw g},Ut=(s,a={})=>{c(i,s)&&(U(a.defaultValue)?j(s,T(c(n,s))):(j(s,a.defaultValue),E(n,s,T(a.defaultValue))),a.keepTouched||B(t.touchedFields,s),a.keepDirty||(B(t.dirtyFields,s),t.isDirty=a.defaultValue?J(s,T(c(n,s))):J()),a.keepError||(B(t.errors,s),D.isValid&&R()),F.state.next({...t}))},et=(s,a={})=>{const u=s?T(s):n,g=T(u),y=H(s),o=y?n:g;if(a.keepDefaultValues||(n=u),!a.keepValues){if(a.keepDirtyValues){const _=new Set([...d.mount,...Object.keys(ge(n,l))]);for(const k of Array.from(_))c(t.dirtyFields,k)?E(o,k,c(l,k)):j(k,c(o,k))}else{if(je&&U(s))for(const _ of d.mount){const k=c(i,_);if(k&&k._f){const O=Array.isArray(k._f.refs)?k._f.refs[0]:k._f.ref;if(Ve(O)){const X=O.closest("form");if(X){X.reset();break}}}}for(const _ of d.mount){const k=c(o,_,c(n,_));U(k)||(E(o,_,k),j(_,c(o,_)))}}l=T(o),F.array.next({values:{...o}}),F.state.next({values:{...o}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!D.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,F.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:y?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!le(s,n)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y?{}:a.keepDirtyValues?a.keepDefaultValues&&l?ge(n,l):t.dirtyFields:a.keepDefaultValues&&s?ge(n,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},tt=(s,a)=>et(te(s)?s(l):s,a),Mt=(s,a={})=>{const u=c(i,s),g=u&&u._f;if(g){const y=g.refs?g.refs[0]:g.ref;y.focus&&(y.focus(),a.shouldSelect&&te(y.select)&&y.select())}},Rt=s=>{t={...t,...s}},rt={control:{register:pe,unregister:Ee,getFieldState:Ye,handleSubmit:Ze,setError:Je,_subscribe:Qe,_runSchema:h,_focusError:Ce,_getWatch:w,_getDirty:J,_setValid:R,_setFieldArray:ee,_setDisabledField:Xe,_setErrors:G,_getFieldArray:p,_reset:et,_resetDefaultValues:()=>te(r.defaultValues)&&r.defaultValues().then(s=>{tt(s,r.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:Y,_disableForm:Ot,_subjects:F,_proxyFormState:D,get _fields(){return i},get _formValues(){return l},get _state(){return f},set _state(s){f=s},get _defaultValues(){return n},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Ct,trigger:oe,register:pe,handleSubmit:Ze,watch:pt,setValue:j,getValues:me,reset:tt,resetField:Ut,clearErrors:Et,unregister:Ee,setError:Je,setFocus:Mt,getFieldState:Ye};return{...rt,formControl:rt}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=(Math.random()*16+e)%16|0;return(r=="x"?t:t&3|8).toString(16)})},Re=(e,r,t={})=>t.shouldFocus||U(t.shouldFocus)?t.focusName||`${e}.${U(t.focusIndex)?r:t.focusIndex}.`:"",Le=(e,r)=>[...e,...K(r)],Te=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ie(e,r,t){return[...e.slice(0,r),...K(t),...e.slice(r)]}var Ne=(e,r,t)=>Array.isArray(e)?(U(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[],Be=(e,r)=>[...K(r),...K(e)];function rr(e,r){let t=0;const i=[...e];for(const n of r)i.splice(n-t,1),t++;return we(i).length?i:[]}var Pe=(e,r)=>U(r)?[]:rr(e,K(r).sort((t,i)=>t-i)),We=(e,r,t)=>{[e[r],e[t]]=[e[t],e[r]]},gt=(e,r,t)=>(e[r]=t,e);function nr(e){const r=ke(),{control:t=r.control,name:i,keyName:n="id",shouldUnregister:l,rules:f}=e,[d,b]=v.useState(t._getFieldArray(i)),x=v.useRef(t._getFieldArray(i).map(ne)),D=v.useRef(d),C=v.useRef(i),F=v.useRef(!1);C.current=i,D.current=d,t._names.array.add(i),f&&t.register(i,f),De(()=>t._subjects.array.subscribe({next:({values:m,name:h})=>{if(h===C.current||!h){const A=c(m,C.current);Array.isArray(A)&&(b(A),x.current=A.map(ne))}}}).unsubscribe,[t]);const M=v.useCallback(m=>{F.current=!0,t._setFieldArray(i,m)},[t,i]),z=(m,h)=>{const A=K(T(m)),S=Le(t._getFieldArray(i),A);t._names.focus=Re(i,S.length-1,h),x.current=Le(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Le,{argA:Te(m)})},R=(m,h)=>{const A=K(T(m)),S=Be(t._getFieldArray(i),A);t._names.focus=Re(i,0,h),x.current=Be(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Be,{argA:Te(m)})},L=m=>{const h=Pe(t._getFieldArray(i),m);x.current=Pe(x.current,m),M(h),b(h),!Array.isArray(c(t._fields,i))&&E(t._fields,i,void 0),t._setFieldArray(i,h,Pe,{argA:m})},ee=(m,h,A)=>{const S=K(T(h)),Y=Ie(t._getFieldArray(i),m,S);t._names.focus=Re(i,m,A),x.current=Ie(x.current,m,S.map(ne)),M(Y),b(Y),t._setFieldArray(i,Y,Ie,{argA:m,argB:Te(h)})},V=(m,h)=>{const A=t._getFieldArray(i);We(A,m,h),We(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,We,{argA:m,argB:h},!1)},G=(m,h)=>{const A=t._getFieldArray(i);Ne(A,m,h),Ne(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,Ne,{argA:m,argB:h},!1)},W=(m,h)=>{const A=T(h),S=gt(t._getFieldArray(i),m,A);x.current=[...S].map((Y,J)=>!Y||J===m?ne():x.current[J]),M(S),b([...S]),t._setFieldArray(i,S,gt,{argA:m,argB:A},!0,!1)},I=m=>{const h=K(T(m));x.current=h.map(ne),M([...h]),b([...h]),t._setFieldArray(i,[...h],A=>A,{},!0,!1)};return v.useEffect(()=>{if(t._state.action=!1,He(i,t._names)&&t._subjects.state.next({...t._formState}),F.current&&(!de(t._options.mode).isOnSubmit||t._formState.isSubmitted)&&!de(t._options.reValidateMode).isOnSubmit)if(t._options.resolver)t._runSchema([i]).then(m=>{const h=c(m.errors,i),A=c(t._formState.errors,i);(A?!h&&A.type||h&&(A.type!==h.type||A.message!==h.message):h&&h.type)&&(h?E(t._formState.errors,i,h):B(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const m=c(t._fields,i);m&&m._f&&!(de(t._options.reValidateMode).isOnSubmit&&de(t._options.mode).isOnSubmit)&&$e(m,t._names.disabled,t._formValues,t._options.criteriaMode===Z.all,t._options.shouldUseNativeValidation,!0).then(h=>!H(h)&&t._subjects.state.next({errors:Dt(t._formState.errors,h,i)}))}t._subjects.state.next({name:i,values:T(t._formValues)}),t._names.focus&&fe(t._fields,(m,h)=>{if(t._names.focus&&h.startsWith(t._names.focus)&&m.focus)return m.focus(),1}),t._names.focus="",t._setValid(),F.current=!1},[d,i,t]),v.useEffect(()=>(!c(t._formValues,i)&&t._setFieldArray(i),()=>{const m=(h,A)=>{const S=c(t._fields,h);S&&S._f&&(S._f.mount=A)};t._options.shouldUnregister||l?t.unregister(i):m(i,!1)}),[i,t,n,l]),{swap:v.useCallback(V,[M,i,t]),move:v.useCallback(G,[M,i,t]),prepend:v.useCallback(R,[M,i,t]),append:v.useCallback(z,[M,i,t]),remove:v.useCallback(L,[M,i,t]),insert:v.useCallback(ee,[M,i,t]),update:v.useCallback(W,[M,i,t]),replace:v.useCallback(I,[M,i,t]),fields:v.useMemo(()=>d.map((m,h)=>({...m,[n]:x.current[h]||ne()})),[d,n])}}function lr(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[i,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=tr(e);r.current={...d,formState:i}}const l=r.current.control;return l._options=e,De(()=>{const f=l._subscribe({formState:l._proxyFormState,callback:()=>n({...l._formState}),reRenderRoot:!0});return n(d=>({...d,isReady:!0})),l._formState.isReady=!0,f},[l]),v.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),v.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),v.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),v.useEffect(()=>{if(l._proxyFormState.isDirty){const f=l._getDirty();f!==i.isDirty&&l._subjects.state.next({isDirty:f})}},[l,i.isDirty]),v.useEffect(()=>{e.values&&!le(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,n(f=>({...f}))):l._resetDefaultValues()},[l,e.values]),v.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),r.current.formState=bt(i,l),r.current}export{ar as C,Wt as a,nr as b,lr as u};