@abtnode/webapp 1.17.8-beta-20260205-074433-9d1114cf → 1.17.8
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.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/dist/assets/{AdapterDayjs-IaUSFlm4.js → AdapterDayjs-CXgBZcQU.js} +1 -1
- package/dist/assets/{Add-D1qtasGt.js → Add-B-lIYZBc.js} +1 -1
- package/dist/assets/ArrowDropDown-C1ynmK1V.js +1 -0
- package/dist/assets/{Autocomplete-DTKIP70z.js → Autocomplete-BHqH72uG.js} +1 -1
- package/dist/assets/{Breadcrumbs-DYu6Ih3W.js → Breadcrumbs-CpZ2DeBG.js} +1 -1
- package/dist/assets/{ButtonGroup-BmKH0AR_.js → ButtonGroup-CXwzM552.js} +1 -1
- package/dist/assets/{CSSTransition-By0IzEZz.js → CSSTransition-hTlKGu0l.js} +1 -1
- package/dist/assets/{CallMerge-CBsd3n82.js → CallMerge-V8M4tzIM.js} +1 -1
- package/dist/assets/{CardContent-uQht8_nO.js → CardContent-MdG6Fo_s.js} +1 -1
- package/dist/assets/{ChevronLeft-YHLhmhXY.js → ChevronLeft-BPs9Erbv.js} +1 -1
- package/dist/assets/{ChevronRight-Bry_Rp2n.js → ChevronRight-C_yvQN06.js} +1 -1
- package/dist/assets/{Clear-C9b1QEIp.js → Clear-XkW6YpHE.js} +1 -1
- package/dist/assets/{Delete-BR43GocU.js → Delete-CCasVLgy.js} +1 -1
- package/dist/assets/{DeleteOutline-BknUUIOQ.js → DeleteOutline-CocEa6gq.js} +1 -1
- package/dist/assets/{Done-D38mSa7e.js → Done-DfHgd6VN.js} +1 -1
- package/dist/assets/{Edit-Cezv9GPx.js → Edit-CGdW8_LW.js} +1 -1
- package/dist/assets/{ErrorOutline-DSSui5bs.js → ErrorOutline-D3nJBXYA.js} +1 -1
- package/dist/assets/{FilterList-ByiwX7w6.js → FilterList-BiaeVs0C.js} +1 -1
- package/dist/assets/{Google-DW20cCdB.js → Google-D9HgkG4U.js} +1 -1
- package/dist/assets/{HelpOutline-C8Ii5pdp.js → HelpOutline-s5mQqTw1.js} +1 -1
- package/dist/assets/{Launch-BjUxWdZ_.js → Launch-DHnB5pzO.js} +1 -1
- package/dist/assets/{Link-rwof5_jN.js → Link-DUSQD8mc.js} +1 -1
- package/dist/assets/{ListItemButton-CLYRGxS5.js → ListItemButton-BIo7wBNv.js} +1 -1
- package/dist/assets/{ListSubheader-BrZqDYTB.js → ListSubheader-rZisNvzB.js} +1 -1
- package/dist/assets/{LoadingButton-CEhniQ1z.js → LoadingButton-egcGN7yK.js} +1 -1
- package/dist/assets/{LottiePlayer.modern-BOVXfijb.js → LottiePlayer.modern-DuQJ5g1j.js} +1 -1
- package/dist/assets/{MoreVert-YQMFdAci.js → MoreVert-Cw1fjU9L.js} +1 -1
- package/dist/assets/{OpenInNew-D__db3UD.js → OpenInNew-2i4mGCRx.js} +1 -1
- package/dist/assets/{Refresh-CEyibS7R.js → Refresh-BIkqgW7p.js} +1 -1
- package/dist/assets/{Replay-DJEt53W0.js → Replay-3PaYn2br.js} +1 -1
- package/dist/assets/{Search-B-Kpov_x.js → Search-mc0LftDb.js} +1 -1
- package/dist/assets/{Stepper-BkvTFi6y.js → Stepper-CnqNXODv.js} +1 -1
- package/dist/assets/{TableSearch-QTEwGVjE.js → TableSearch-ZIwL7jK3.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-leiBEwd_.js → ToggleButtonGroup-DeGfqT0G.js} +1 -1
- package/dist/assets/{UnfoldMore-BtGzVWNn.js → UnfoldMore-DFA58tLQ.js} +1 -1
- package/dist/assets/{Verified-GvGnFXRL.js → Verified-se8hbTqT.js} +1 -1
- package/dist/assets/{VerifiedUser-D8u3Hj9z.js → VerifiedUser-8QA2XNlm.js} +1 -1
- package/dist/assets/{ViewList-CI4jp_14.js → ViewList-DgyKMmIc.js} +1 -1
- package/dist/assets/{Visibility-Bmnp5dVh.js → Visibility-BqBwXDHr.js} +1 -1
- package/dist/assets/{_createAggregator-DcJLZ0MZ.js → _createAggregator-BS_ZCLsv.js} +1 -1
- package/dist/assets/{actions-CCjvPhEB.js → actions-BuX7-i-0.js} +1 -1
- package/dist/assets/{actions-DaRBxjah.js → actions-DR8B4Taf.js} +2 -2
- package/dist/assets/{actions-CAvjo_Ow.js → actions-Zy-oEKVg.js} +1 -1
- package/dist/assets/{agreement-B5uBdrUm.js → agreement-3SHQ4MuR.js} +1 -1
- package/dist/assets/api-DBq1KtcA.js +1 -0
- package/dist/assets/{appearance-BWTNqmDR.js → appearance-CRQaeOoe.js} +1 -1
- package/dist/assets/{audit-logs-BAppUNme.js → audit-logs-BGRhRsNS.js} +2 -2
- package/dist/assets/{babel-BttEwFDF.js → babel-BILHfcMU.js} +1 -1
- package/dist/assets/{base-chart-nzAgs-vq.js → base-chart-Cp-etWR-.js} +1 -1
- package/dist/assets/{blocklet-mQW2VRE3.js → blocklet-D7q_eJsm.js} +1 -1
- package/dist/assets/{chain-Bajmovwi.js → chain-DDmwEbOF.js} +1 -1
- package/dist/assets/{click-to-copy-BJwHXTAU.js → click-to-copy-wk3E32eY.js} +1 -1
- package/dist/assets/cloneDeep-BEJXcFgb.js +1 -0
- package/dist/assets/{config-navigation-DhuiKMvJ.js → config-navigation-iUuwjLA_.js} +17 -17
- package/dist/assets/{connect-lnVGHfaY.js → connect-DGRM2e01.js} +1 -1
- package/dist/assets/{connect-to-HWRwV1Zb.js → connect-to-BdinmIba.js} +3 -3
- package/dist/assets/{delete-confirm-D-pHWenk.js → delete-confirm-C8X53PNk.js} +1 -1
- package/dist/assets/{depsEqual-BTB47kAG.js → depsEqual-FU6HOfMn.js} +1 -1
- package/dist/assets/{detail-DPUG43Cf.js → detail-BX_klHKR.js} +2 -2
- package/dist/assets/domains-DlW2t7QG.js +28 -0
- package/dist/assets/{download-B_GCffOL.js → download-CHMW-VV9.js} +1 -1
- package/dist/assets/{edit.svg-DgkWXClh.js → edit.svg-CBqxioRV.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-D6kXFXIA.js +1 -0
- package/dist/assets/engine-hQAyActy.js +1 -0
- package/dist/assets/{federated-detail-dialog-BAAYkStt.js → federated-detail-dialog-C93dA_OW.js} +1 -1
- package/dist/assets/{get-safe-url-BmWKThk5.js → get-safe-url-n4nPkbEQ.js} +1 -1
- package/dist/assets/getValidReactChildren-dJeDeNuf.js +1 -0
- package/dist/assets/{graphql-DRZgDRnJ.js → graphql-BOG1t7Ob.js} +1 -1
- package/dist/assets/{graphqlMode-D6Ry3UyA.js → graphqlMode-BuOU6E0N.js} +2 -2
- package/dist/assets/{html-title-BO3r7YSd.js → html-title-DwrWBQUt.js} +1 -1
- package/dist/assets/{iframe-DaoKgbiQ.js → iframe-B0inMXzK.js} +1 -1
- package/dist/assets/{index-BsfgDen6.js → index-0lc-age1.js} +1 -1
- package/dist/assets/index-1nsTMIEw.js +1 -0
- package/dist/assets/{index-xie30Dh0.js → index-2jRJYLHP.js} +1 -1
- package/dist/assets/{index-DwPMkrzc.js → index-2tPqycMJ.js} +2 -2
- package/dist/assets/{index-Ohp5zy8G.js → index-4OvGI3tM.js} +1 -1
- package/dist/assets/{index-BA_zqSiS.js → index-7TgPZijh.js} +1 -1
- package/dist/assets/{index-IQ8RBJFB.js → index-8K8V7S7h.js} +1 -1
- package/dist/assets/{index-DgAeLiKC.js → index-B01of1n7.js} +1 -1
- package/dist/assets/{index-PZ2fx_h4.js → index-B8jKymjp.js} +3 -3
- package/dist/assets/{index-DUa2rZxk.js → index-B9oDQ5jy.js} +20 -20
- package/dist/assets/{index-CcXfL7E7.js → index-BDQexjSt.js} +1 -1
- package/dist/assets/{index-CAbi4Q6i.js → index-BFpYSXLl.js} +3 -3
- package/dist/assets/{index-CcPy8sB_.js → index-BIOcSTv1.js} +1 -1
- package/dist/assets/{index-BdqGdcv2.js → index-BJsW1I-W.js} +1 -1
- package/dist/assets/{index-DrKVMSE5.js → index-BPu5OFdR.js} +1 -1
- package/dist/assets/{index-DscVI0IV.js → index-BQ0GXRUy.js} +1 -1
- package/dist/assets/{index-C7RFlKtP.js → index-BbnbDlTc.js} +2 -2
- package/dist/assets/{index-I3asAR5r.js → index-Bg6xcyjD.js} +6 -6
- package/dist/assets/{index-N0aqGit9.js → index-BsmvyFtw.js} +1 -1
- package/dist/assets/{index-BfWiTV5L.js → index-C5xvmzdD.js} +1 -1
- package/dist/assets/{index-D7zthsmK.js → index-CGJGuomb.js} +3 -3
- package/dist/assets/{index-DEflHlyo.js → index-CP8e2zcP.js} +3 -3
- package/dist/assets/{index-CENTGsHb.js → index-CRRnOuLM.js} +3 -3
- package/dist/assets/{index-AGlbL6jT.js → index-Cm_CX9Km.js} +1 -1
- package/dist/assets/{index-C07Ljz-P.js → index-CqXuTw4d.js} +1 -1
- package/dist/assets/{index-Cj38JD_6.js → index-Cske9PWb.js} +3 -3
- package/dist/assets/{index-BWxIl7Zm.js → index-CyXVLDQI.js} +1 -1
- package/dist/assets/{index-DZ_f5Dfi.js → index-D3qtx7de.js} +1 -1
- package/dist/assets/{index-BcRKEX-z.js → index-DK8BRrRb.js} +2 -2
- package/dist/assets/{index-CWEDY4A2.js → index-DNGIFQtW.js} +4 -4
- package/dist/assets/{index-Bl5zzd5F.js → index-DX_ig3IR.js} +1 -1
- package/dist/assets/{index-CJe-L0_W.js → index-De_3fKYA.js} +1 -1
- package/dist/assets/{index-CXj3-Qmy.js → index-G4GuFOuO.js} +1 -1
- package/dist/assets/{index-DA3gthJ9.js → index-MLCJ7HJV.js} +2 -2
- package/dist/assets/{index-BlU32mL_.js → index-OZjARxbD.js} +1 -1
- package/dist/assets/{index-BbxLly-V.js → index-Oah-jRyx.js} +1 -1
- package/dist/assets/{index-22B4OxZa.js → index-PzC6rkTH.js} +1 -1
- package/dist/assets/{index-ll7_pfKU.js → index-StdVm_EG.js} +1 -1
- package/dist/assets/{index--_MX4Y7D.js → index-_qKxdWY4.js} +10 -10
- package/dist/assets/{index-C2XQ9Wkq.js → index-dKtf23Ej.js} +1 -1
- package/dist/assets/{index-C4zhyFnN.js → index-erCgIvu7.js} +1 -1
- package/dist/assets/{index-DzQavNm8.js → index-hxHDV4zb.js} +2 -2
- package/dist/assets/{index-PupLKSg6.js → index-mGRBDoXw.js} +1 -1
- package/dist/assets/{index-B9lrrb_O.js → index-p8ewFFuc.js} +5 -5
- package/dist/assets/{index-BI2ulEux.js → index-pMmL--Md.js} +1 -1
- package/dist/assets/{index.esm-uIPkYqTP.js → index.esm-DjcC6_YD.js} +1 -1
- package/dist/assets/{install-from-url-6nN6p8KI.js → install-from-url-DfM4lxPD.js} +1 -1
- package/dist/assets/{invitation-BwJczXLd.js → invitation-CyjIyIIY.js} +1 -1
- package/dist/assets/{is-path-prefix-equal-B5QaVi7p.js → is-path-prefix-equal-sWdIB_FI.js} +1 -1
- package/dist/assets/{isEmail-DYZ2ooZR.js → isEmail-CpvKmXxu.js} +1 -1
- package/dist/assets/{item-9r2fa-dg.js → item-NX8BCXwV.js} +6 -6
- package/dist/assets/{jsonMode--ELrQNuw.js → jsonMode-wNz3PCor.js} +1 -1
- package/dist/assets/{list-header-W2Zqfuhf.js → list-header-DXqt77-Y.js} +1 -1
- package/dist/assets/{lite-eb-MtGjP.js → lite-D7_0Kk8P.js} +2 -2
- package/dist/assets/{lock.svg-BAPv5bGI.js → lock.svg-D22_UbmU.js} +1 -1
- package/dist/assets/{log-DfRitFTN.js → log-BtG4l72D.js} +1 -1
- package/dist/assets/{login-method-item-duWmEQ4c.js → login-method-item-CGUaonon.js} +1 -1
- package/dist/assets/{lottie-react.esm-Dg4E2zZC.js → lottie-react.esm-Cj9O6Lld.js} +1 -1
- package/dist/assets/{memory-CVCAiVAD.js → memory-MEOErB2y.js} +1 -1
- package/dist/assets/{metric-DGyzAosW.js → metric-DzrjUE5P.js} +1 -1
- package/dist/assets/{monaco-editor-CIyTCq3w.js → monaco-editor-i4E7Erh-.js} +3 -3
- package/dist/assets/{mouseTarget-yzhGv1sN.js → mouseTarget-DHjy6bBl.js} +1 -1
- package/dist/assets/omit-C1X-CRrb.js +1 -0
- package/dist/assets/{overview-CjC2_6TA.js → overview-BPSzB7yi.js} +1 -1
- package/dist/assets/{permission-Dgeoh_gC.js → permission-D6xGjoP4.js} +1 -1
- package/dist/assets/{preference-DPXvsW07.js → preference-CWfaETuk.js} +9 -9
- package/dist/assets/{provider-icon-H03n2Hjs.js → provider-icon-D-a204Ay.js} +1 -1
- package/dist/assets/{raf-schd.esm-Dgds4zE-.js → raf-schd.esm-vaS856Rv.js} +1 -1
- package/dist/assets/{rotate-session-key-Cg34J7dQ.js → rotate-session-key-Cn3NVWRi.js} +1 -1
- package/dist/assets/runtime-BJVsSRvX.js +1 -0
- package/dist/assets/schema-DeNYz3hJ.js +1 -0
- package/dist/assets/sdk-CyaYnqk4.js +1 -0
- package/dist/assets/{service-DoInkZVF.js → service-COrrqY-3.js} +1 -1
- package/dist/assets/{shorten-label-Ct9vHiPy.js → shorten-label-j-itDv6J.js} +1 -1
- package/dist/assets/{simple-select-DUBD32-K.js → simple-select-DApzKMrW.js} +1 -1
- package/dist/assets/{spaces-Ca-nLDun.js → spaces-BqdEt5Dg.js} +1 -1
- package/dist/assets/{status-DJJQr33v.js → status-CFw68CfZ.js} +2 -2
- package/dist/assets/{status-B8aMCivY.js → status-vwaEURfH.js} +1 -1
- package/dist/assets/{switch-control-DN6AO5e-.js → switch-control-BEw34mlq.js} +1 -1
- package/dist/assets/{table-icons-DPN-ujpU.js → table-icons-V0nzUvpC.js} +1 -1
- package/dist/assets/team-Bp-ehLS6.js +1 -0
- package/dist/assets/toLower-C4OoJYWk.js +1 -0
- package/dist/assets/toUpper-P-IpqDCE.js +1 -0
- package/dist/assets/{traffic-Coyo0eln.js → traffic-BuuDuC5C.js} +1 -1
- package/dist/assets/trim-BrqZEf0Q.js +1 -0
- package/dist/assets/{url-evaluation-DF8LRV6u.js → url-evaluation-BotqjpOW.js} +1 -1
- package/dist/assets/{url-join-BAOkJVTN.js → url-join-BYRfgTzL.js} +1 -1
- package/dist/assets/{use-mobile-D8q1By2e.js → use-mobile-BIorytbM.js} +1 -1
- package/dist/assets/{use-mobile-DjOKbbdW.js → use-mobile-BxCxZMSF.js} +1 -1
- package/dist/assets/{useAsync-CpuSmv4M.js → useAsync-CbHsXkPS.js} +1 -1
- package/dist/assets/{useAsyncRetry-DQ-1kK3Z.js → useAsyncRetry-6ULbruV9.js} +1 -1
- package/dist/assets/{useLocalStorage-B1cIHaab.js → useLocalStorage-CBx2eW_l.js} +1 -1
- package/dist/assets/{useThemeProps-CaL-a5Z3.js → useThemeProps-BWD3Vp6O.js} +1 -1
- package/dist/assets/{util-Dk5V-b84.js → util-BF2dKFyL.js} +1 -1
- package/dist/assets/{wait-container-BxmUT_e8.js → wait-container-Cc0h_2b3.js} +1 -1
- package/dist/assets/{without-wallet-DdcteX-E.js → without-wallet-lUjEmpWw.js} +1 -1
- package/dist/assets/wrap-locale-CF87ubG3.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-CLtIK8Ds.js +0 -1
- package/dist/assets/api-CtY709C1.js +0 -1
- package/dist/assets/cloneDeep-DcL7wHTZ.js +0 -1
- package/dist/assets/domains-DgOFqkxv.js +0 -28
- package/dist/assets/emotion-cache.browser.esm-C9pXLaus.js +0 -1
- package/dist/assets/engine-CsOVDEBF.js +0 -1
- package/dist/assets/getValidReactChildren-CaUdxsqb.js +0 -1
- package/dist/assets/index-DTHqSol2.js +0 -1
- package/dist/assets/omit-C9i7Uayy.js +0 -1
- package/dist/assets/runtime-3p5sMXNX.js +0 -1
- package/dist/assets/schema-DtiemgGr.js +0 -1
- package/dist/assets/sdk-CChXw_FN.js +0 -1
- package/dist/assets/team-pgmvSiLk.js +0 -1
- package/dist/assets/toUpper-DWIvDS3T.js +0 -1
- package/dist/assets/trim-CGi2LMwA.js +0 -1
- package/dist/assets/wrap-locale-BD1k5sx5.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ye,j as e,aR as bt,r as x,bF as Y,dg as U,H as $,c$ as $e,fj as q,bN as jt,o as d,w as ee,eX as yt,fk as _e,fl as ge,ad as vt,B as R,J as X,V as J,aD as Oe,F as Be,fm as Je,dU as ke,ch as De,cx as Le,aA as Re,fd as He,fe as Ne,C as Qe,ab as Ze,eK as et,b6 as Ee,c8 as St,dn as tt,fn as st,bz as Ie,eM as nt,fo as je,d7 as at,ap as wt,q as ae,e6 as pe,bu as Ve,bq as Rt,fp as Ct,fq as Tt,cu as kt,fr as Dt,fs as Lt,ft as Nt,fu as Et,cw as It,aV as it,ak as At,bM as Pt,aB as Ot,S as Bt,M as Ge,fv as Ft}from"./index-DEflHlyo.js";import{d as zt,H as ot,g as Wt}from"./index-BA_zqSiS.js";import{S as me}from"./shorten-label-Ct9vHiPy.js";import{v as rt}from"./index-IQ8RBJFB.js";import{T as Mt}from"./html-title-BO3r7YSd.js";import{R as Fe}from"./Replay-DJEt53W0.js";import{R as Kt}from"./Refresh-CEyibS7R.js";import{D as qt,g as Ut}from"./traffic-Coyo0eln.js";import"./FilterList-ByiwX7w6.js";import"./CSSTransition-By0IzEZz.js";import"./emotion-cache.browser.esm-C9pXLaus.js";import"./index-BWxIl7Zm.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BTB47kAG.js";import"./index-Bl5zzd5F.js";import"./TableSearch-QTEwGVjE.js";import"./Search-B-Kpov_x.js";import"./Clear-C9b1QEIp.js";import"./MoreVert-YQMFdAci.js";import"./iframe-DaoKgbiQ.js";import"./ChevronLeft-YHLhmhXY.js";import"./ChevronRight-Bry_Rp2n.js";import"./index-CVhk080O.js";import"./base-chart-nzAgs-vq.js";import"./index-C4zhyFnN.js";import"./AdapterDayjs-IaUSFlm4.js";import"./useThemeProps-CaL-a5Z3.js";import"./visuallyHidden-Dan1xhjv.js";const $t=Ye(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 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"})),_t=Ye(e.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),lt=x.createContext({}),{Provider:Ht,Consumer:Hs}=lt;function Vt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=bt(),[l,b]=x.useState([]),[m,v]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Y(()=>s.meta?.did,[s]),[j,S]=x.useState([]),[O,P]=x.useState({}),C=Y(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),_=async({page:p=1,pageSize:g=20,...k}={})=>{if(!h)return[];try{const N={paging:{page:p,pageSize:g},...k,teamDid:h,dateRange:k.dateRange?[U(k.dateRange[0]).toISOString(),U(k.dateRange[1]).toISOString()]:void 0},{dids:E,...z}=N;let B="";E&&E.includes("system")&&(B="system");const ie=E?E.filter(oe=>oe!=="system"):[],se={...z,source:B,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return P(se),b(Z.list),v(Z.paging),Z.list}catch(N){return $.error(N.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});S(p.componentDids)},I=x.useCallback(p=>{const g=s.children.find(k=>k.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),A=async({notificationId:p,receivers:g,channels:k,...N})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:k.map(E=>E==="wallet"?q.WALLET:E==="pushKit"?q.PUSH:E),...N}})},H=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...k}={})=>{try{const N={paging:{page:p,pageSize:g},...k,userName:k.searchText||"",teamDid:h,dateRange:k.dateRange?[U(k.dateRange[0]).toISOString(),U(k.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:N})}catch(N){throw $.error(N.message),N}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i($e.NOTIFICATION_BLOCKLET_UPDATE,p=>{C.has(p.notificationId)&&_(O)},[C,O]),i($e.NOTIFICATION_BLOCKLET_CREATE,p=>{C.has(p.id)||_(O)},[C,O]);const Q={fetch:_,data:l,paging:m,blocklet:s,getComponent:I,resendNotification:A,getUser:H,componentDids:j,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:Q},children:t})}function ze(){const{notificationRecords:t}=x.useContext(lt);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Gt={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(jt,{type:Gt[t],children:t})}const Xt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case ge.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case ge.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case ge.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case ge.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ct(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:yt(i,s)}):"",v=Xt(t,b,l);return r===_e.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:v}:r===_e.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:v,sentTime:m}}const Ae={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Pe=["wallet","pushKit","email"],Xe=["info","success","error","warning"],dt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},ut=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Yt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:dt(t),enabled:n}},Jt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:ut(t),enabled:n}},Qt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),es=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=U().startOf("day");return t.filter(n=>U(n.sendAt).isSame(s,"day")).length},ts=(t,s="")=>{if(s&&Pe.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return be(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return be(l)}const i={};return Pe.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),v=be(m);i[l]=v}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=be(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ss=t=>{switch(t){case q.WALLET:return"Wallet";case q.PUSH:return"Push Kit";case q.EMAIL:return"Email";case q.WEBHOOK:return"Webhook";default:return""}},pt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,v=[l,m].filter(Boolean).join(", ");return e.jsx(vt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(X,{color:"inherit",sx:{fontSize:12},children:v}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(R,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ae[i]}}),e.jsx(R,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ae[i]}})]}),e.jsx(X,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=J();return e.jsxs(R,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(X,{children:[s,": "]}),t.map(l=>{const b=ct(r,i,{status:l});return e.jsx(Oe,{size:"small",label:e.jsx(R,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}We.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function We({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Be,{className:"filter-container",children:[e.jsx(Je,{component:"legend",children:l}),e.jsx(ke,{row:!0,children:i.map(m=>e.jsx(De,{control:e.jsx(Le,{checked:t[n].indexOf(m.value??m)>-1,onChange:v=>{const h=[...t];v.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(j=>j!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function Te(t){return e.jsx(We,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=J(),m=ct(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Re,{className:"resend-btn",size:"small",startIcon:e.jsx(Fe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}Me.propTypes={value:d.array.isRequired,onChange:d.func};function Me({value:t,onChange:s}){const{locale:n}=J(),r=U().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,v=x.useCallback(h=>{if(!h.startDate||!h.endDate){$.error("Please select a date range");return}if(U(h.startDate).isAfter(h.endDate)||!U(h.startDate).isValid()||!U(h.endDate).isValid()){$.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(X,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Re,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ne,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(qt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Ut(r),onChange:v})})]})}Ke.propTypes={itemComponent:d.elementType.isRequired};function Ke({itemComponent:t,...s}){const{t:n}=J();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(R,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(zt.TableFilterList,{...s,ItemComponent:t})})]})}function qe({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Oe,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}qe.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const ns=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];ft.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function ft({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=J(),[i,l]=x.useState(ns),[b,m]=x.useState(!0),v=(j,S)=>{S.checked=j.target.checked;const O=i.map(P=>({...P,checked:P.value===S.value?S.checked:P.checked}));l(O)},h=j=>{j.stopPropagation(),n({channels:i.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:b})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(X,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(Be,{component:"fieldset",variant:"standard",children:[e.jsx(Je,{component:"legend",children:r("notification.selectChannels")}),e.jsx(ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(j=>e.jsx(De,{control:e.jsx(Le,{checked:j.checked,onChange:S=>v(S,j),name:j.value}),label:j.label},j.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(ke,{children:e.jsx(De,{control:e.jsx(Le,{checked:b,onChange:j=>m(j.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(R,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Re,{onClick:j=>{j.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Re,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Qe,{size:16}),r("common.confirm")]})]})]})}mt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function mt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=J(),l=Ze(),b=x.useMemo(()=>et(l,pt()),[l]),{getReceivers:m,inService:v,teamDid:h,getUser:j,blocklet:S}=ze(),[O,P]=x.useState(!1),[C,_]=x.useState([]),M=Ee({anchorEl:null,position:null}),I=Ee({anchorEl:null,position:null}),[A,H]=x.useState(null),[V,Q]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[U().subtract(1,"month").startOf("day").toDate(),U().endOf("day").toDate()]}),[k,N]=x.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!O&&t)try{P(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:at(c.receiverUser.avatar,h,v)}}));_(o),Q(a.paging),P(!1)}catch(a){$.error(a.message),P(!1)}};x.useEffect(()=>{z()},[p]);const B=a=>{a.stopPropagation();const o=a.currentTarget;I.anchorEl=o;const c=o.getBoundingClientRect();I.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ie,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Fe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:k,onRowSelectionChange:(a,o)=>{N(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:w})=>{const[,F=[],G=[],K=[]]=w;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(F,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:F,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await j(o);return c?a==="wallet"?Qt(c):a==="email"?Yt(S,c):a==="pushKit"?Jt(S,c):a==="webhook"?Zt(c):!0:!1},[j,S]),Ce=x.useCallback(a=>es(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,H(null)},u=()=>{I.anchorEl=null,I.position=null},y=async(a,o,c=!0,w="")=>{if(!(!o.length||!a.length))try{s(a,o,c,w),I.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},D=async({channels:a,isResendFailedOnly:o})=>{const c=k.map(w=>C[w].receiver);await y(a,c,o),await xe(.5),u(),N([])},L=async(a,o=[],c=!0)=>{try{await y(["webhook"],[a.receiver],c,o)}catch(w){$.error(w.response?w.response.statusText:w.message)}},T=async(a,o,c,w=[],F=!0)=>{if(a.stopPropagation(),ts(o,c)>=4){$.warning(r("notification.resendLimit"));return}if(!Pe.includes(c)){await L(o,w,F);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}H({channel:c});try{const K=await oe(c,o.receiver);await xe(1),H({channel:c,result:K}),(typeof K=="boolean"&&K||wt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],F),I.anchorEl||(await xe(.5),f()))}catch(K){$.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,w)=>{a.stopPropagation();const F=c.filter(G=>G!==o);g(G=>({...G,[w]:F,page:1}))},le=Y(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=C[a];return o?e.jsxs(R,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(tt,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(St,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:E,fullWidth:!0,logic:ve,display:(a,o,c,w)=>e.jsx(Te,{label:"Wallet",filterList:a,onChange:o,index:c,column:w,filterValues:E})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:w}=C[a];return e.jsx(ce,{status:o,updatedAt:c,reason:w,channel:"wallet",onResend:F=>T(F,C[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:w}=C[a];return e.jsx(ce,{status:o,updatedAt:c,reason:w,channel:"pushkit",onResend:F=>T(F,C[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:E,fullWidth:!0,logic:ve,display:(a,o,c,w)=>e.jsx(Te,{label:"Push Kit",filterList:a,onChange:o,index:c,column:w,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:w}=C[a];return e.jsx(ce,{status:o,updatedAt:c,reason:w,channel:"email",onResend:F=>T(F,C[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:E,fullWidth:!0,logic:ve,display:(a,o,c,w)=>e.jsx(Te,{label:"Email",filterList:a,onChange:o,index:c,column:w,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=C[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[w,F]=c,G=F[0];return e.jsx(R,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(R,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:w},w),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>T(K,C[a],"webhook",[w],!1)})]},w)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=C[a];return e.jsx(st,{value:o,locale:i,shouldUpdate:!0})}}}],[C,i,p,r]),xt=[e.jsx(Me,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(Ie,{variant:"contained",size:"small",color:"primary",loading:O,startIcon:e.jsx(Kt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(is,{children:e.jsxs(nt,{theme:b,children:[e.jsx(ot,{className:"receivers-table",locale:i,loading:O,columns:le,data:C,onChange:Z,options:se,customButtons:xt,components:{TableFilterList:a=>e.jsx(Ke,{...a,itemComponent:o=>e.jsx(qe,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ne,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(os,{children:[e.jsxs(X,{variant:"body1",component:"div",className:"check-title",children:[A?.channel," Checking"]}),e.jsx(R,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ce(A?.channel).map(a=>{const{type:o,pass:c,fail:w}=a;return!A?.result||A?.result?.[o]?e.jsxs(X,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:A?.result?.[o]?je.success.main:"inherit"},children:[A?.result?e.jsx(_t,{}):e.jsx(Qe,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(X,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:je.error.main},children:[e.jsx($t,{}),e.jsx("span",{children:w})]},o)})})]})}),I.anchorEl&&e.jsx(Ne,{open:!!I.anchorEl,anchorReference:"anchorPosition",anchorPosition:I.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(ft,{loading:n,onCancel:u,onConfirm:D})})]})})})}const as=x.memo(mt),is=ae.div`
|
|
1
|
+
import{c as Ye,j as e,aS as bt,r as x,bF as Y,dg as U,H as $,c$ as $e,fj as K,bN as jt,o as d,w as ee,eX as yt,fk as _e,fl as ge,ad as vt,B as C,J as X,V as J,aE as Oe,F as Be,fm as Je,dU as ke,ch as De,cx as Le,aB as Ce,fd as He,fe as Ne,C as Qe,ab as Ze,eK as et,b6 as Ee,c8 as St,dn as tt,fn as st,bz as Ie,eM as nt,fo as je,d7 as at,aq as wt,q as ae,e6 as pe,bu as Ve,bq as Ct,fp as Rt,fq as Tt,cu as kt,fr as Dt,fs as Lt,ft as Nt,fu as Et,cw as It,aV as it,al as At,bM as Pt,aC as Ot,S as Bt,M as Ge,fv as Ft}from"./index-CP8e2zcP.js";import{d as zt,H as ot,g as Wt}from"./index-7TgPZijh.js";import{S as me}from"./shorten-label-j-itDv6J.js";import{v as rt}from"./index-8K8V7S7h.js";import{T as Mt}from"./html-title-DwrWBQUt.js";import{R as Fe}from"./Replay-3PaYn2br.js";import{R as qt}from"./Refresh-BIkqgW7p.js";import{D as Kt,g as Ut}from"./traffic-BuuDuC5C.js";import"./FilterList-BiaeVs0C.js";import"./CSSTransition-hTlKGu0l.js";import"./emotion-cache.browser.esm-D6kXFXIA.js";import"./index-CyXVLDQI.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-FU6HOfMn.js";import"./index-DX_ig3IR.js";import"./TableSearch-ZIwL7jK3.js";import"./Search-mc0LftDb.js";import"./Clear-XkW6YpHE.js";import"./MoreVert-Cw1fjU9L.js";import"./iframe-B0inMXzK.js";import"./ChevronLeft-BPs9Erbv.js";import"./ChevronRight-C_yvQN06.js";import"./index-CVhk080O.js";import"./base-chart-Cp-etWR-.js";import"./index-erCgIvu7.js";import"./AdapterDayjs-CXgBZcQU.js";import"./useThemeProps-BWD3Vp6O.js";import"./visuallyHidden-Dan1xhjv.js";const $t=Ye(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 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"})),_t=Ye(e.jsx("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"})),lt=x.createContext({}),{Provider:Ht,Consumer:Hs}=lt;function Vt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=bt(),[l,b]=x.useState([]),[m,v]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Y(()=>s.meta?.did,[s]),[j,S]=x.useState([]),[O,P]=x.useState({}),R=Y(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),_=async({page:p=1,pageSize:g=20,...k}={})=>{if(!h)return[];try{const N={paging:{page:p,pageSize:g},...k,teamDid:h,dateRange:k.dateRange?[U(k.dateRange[0]).toISOString(),U(k.dateRange[1]).toISOString()]:void 0},{dids:E,...z}=N;let B="";E&&E.includes("system")&&(B="system");const ie=E?E.filter(oe=>oe!=="system"):[],se={...z,source:B,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return P(se),b(Z.list),v(Z.paging),Z.list}catch(N){return $.error(N.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});S(p.componentDids)},I=x.useCallback(p=>{const g=s.children.find(k=>k.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),A=async({notificationId:p,receivers:g,channels:k,...N})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:k.map(E=>E==="wallet"?K.WALLET:E==="pushKit"?K.PUSH:E),...N}})},H=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...k}={})=>{try{const N={paging:{page:p,pageSize:g},...k,userName:k.searchText||"",teamDid:h,dateRange:k.dateRange?[U(k.dateRange[0]).toISOString(),U(k.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:N})}catch(N){throw $.error(N.message),N}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i($e.NOTIFICATION_BLOCKLET_UPDATE,p=>{R.has(p.notificationId)&&_(O)},[R,O]),i($e.NOTIFICATION_BLOCKLET_CREATE,p=>{R.has(p.id)||_(O)},[R,O]);const Q={fetch:_,data:l,paging:m,blocklet:s,getComponent:I,resendNotification:A,getUser:H,componentDids:j,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:Q},children:t})}function ze(){const{notificationRecords:t}=x.useContext(lt);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Gt={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(jt,{type:Gt[t],children:t})}const Xt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case ge.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case ge.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case ge.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case ge.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ct(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:yt(i,s)}):"",v=Xt(t,b,l);return r===_e.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:v}:r===_e.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:v,sentTime:m}}const Ae={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Pe=["wallet","pushKit","email"],Xe=["info","success","error","warning"],dt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},ut=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Yt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:dt(t),enabled:n}},Jt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:ut(t),enabled:n}},Qt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),es=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=U().startOf("day");return t.filter(n=>U(n.sendAt).isSame(s,"day")).length},ts=(t,s="")=>{if(s&&Pe.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return be(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return be(l)}const i={};return Pe.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),v=be(m);i[l]=v}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=be(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},ss=t=>{switch(t){case K.WALLET:return"Wallet";case K.PUSH:return"Push Kit";case K.EMAIL:return"Email";case K.WEBHOOK:return"Webhook";default:return""}},pt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,v=[l,m].filter(Boolean).join(", ");return e.jsx(vt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(X,{color:"inherit",sx:{fontSize:12},children:v}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(C,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ae[i]}}),e.jsx(C,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ae[i]}})]}),e.jsx(X,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=J();return e.jsxs(C,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(X,{children:[s,": "]}),t.map(l=>{const b=ct(r,i,{status:l});return e.jsx(Oe,{size:"small",label:e.jsx(C,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}We.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function We({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Be,{className:"filter-container",children:[e.jsx(Je,{component:"legend",children:l}),e.jsx(ke,{row:!0,children:i.map(m=>e.jsx(De,{control:e.jsx(Le,{checked:t[n].indexOf(m.value??m)>-1,onChange:v=>{const h=[...t];v.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(j=>j!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function Te(t){return e.jsx(We,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=J(),m=ct(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Fe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}Me.propTypes={value:d.array.isRequired,onChange:d.func};function Me({value:t,onChange:s}){const{locale:n}=J(),r=U().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,v=x.useCallback(h=>{if(!h.startDate||!h.endDate){$.error("Please select a date range");return}if(U(h.startDate).isAfter(h.endDate)||!U(h.startDate).isValid()||!U(h.endDate).isValid()){$.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(X,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ne,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Kt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Ut(r),onChange:v})})]})}qe.propTypes={itemComponent:d.elementType.isRequired};function qe({itemComponent:t,...s}){const{t:n}=J();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(C,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(zt.TableFilterList,{...s,ItemComponent:t})})]})}function Ke({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Oe,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Ke.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const ns=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];ft.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function ft({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=J(),[i,l]=x.useState(ns),[b,m]=x.useState(!0),v=(j,S)=>{S.checked=j.target.checked;const O=i.map(P=>({...P,checked:P.value===S.value?S.checked:P.checked}));l(O)},h=j=>{j.stopPropagation(),n({channels:i.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:b})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(X,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Be,{component:"fieldset",variant:"standard",children:[e.jsx(Je,{component:"legend",children:r("notification.selectChannels")}),e.jsx(ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(j=>e.jsx(De,{control:e.jsx(Le,{checked:j.checked,onChange:S=>v(S,j),name:j.value}),label:j.label},j.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(ke,{children:e.jsx(De,{control:e.jsx(Le,{checked:b,onChange:j=>m(j.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:j=>{j.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Qe,{size:16}),r("common.confirm")]})]})]})}mt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function mt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=J(),l=Ze(),b=x.useMemo(()=>et(l,pt()),[l]),{getReceivers:m,inService:v,teamDid:h,getUser:j,blocklet:S}=ze(),[O,P]=x.useState(!1),[R,_]=x.useState([]),M=Ee({anchorEl:null,position:null}),I=Ee({anchorEl:null,position:null}),[A,H]=x.useState(null),[V,Q]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[U().subtract(1,"month").startOf("day").toDate(),U().endOf("day").toDate()]}),[k,N]=x.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!O&&t)try{P(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:at(c.receiverUser.avatar,h,v)}}));_(o),Q(a.paging),P(!1)}catch(a){$.error(a.message),P(!1)}};x.useEffect(()=>{z()},[p]);const B=a=>{a.stopPropagation();const o=a.currentTarget;I.anchorEl=o;const c=o.getBoundingClientRect();I.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ie,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Fe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:k,onRowSelectionChange:(a,o)=>{N(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:w})=>{const[,F=[],G=[],q=[]]=w;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(F,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(q,p.emailSendStatus)||g(W=>({...W,emailSendStatus:q,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:F,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await j(o);return c?a==="wallet"?Qt(c):a==="email"?Yt(S,c):a==="pushKit"?Jt(S,c):a==="webhook"?Zt(c):!0:!1},[j,S]),Re=x.useCallback(a=>es(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,H(null)},u=()=>{I.anchorEl=null,I.position=null},y=async(a,o,c=!0,w="")=>{if(!(!o.length||!a.length))try{s(a,o,c,w),I.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},D=async({channels:a,isResendFailedOnly:o})=>{const c=k.map(w=>R[w].receiver);await y(a,c,o),await xe(.5),u(),N([])},L=async(a,o=[],c=!0)=>{try{await y(["webhook"],[a.receiver],c,o)}catch(w){$.error(w.response?w.response.statusText:w.message)}},T=async(a,o,c,w=[],F=!0)=>{if(a.stopPropagation(),ts(o,c)>=4){$.warning(r("notification.resendLimit"));return}if(!Pe.includes(c)){await L(o,w,F);return}if(a){const q=a.currentTarget,W=q.getBoundingClientRect();M.anchorEl=q,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}H({channel:c});try{const q=await oe(c,o.receiver);await xe(1),H({channel:c,result:q}),(typeof q=="boolean"&&q||wt(q)&&Object.values(q).every(W=>!!W))&&(await s([c],[o.receiver],F),I.anchorEl||(await xe(.5),f()))}catch(q){$.error(q.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,w)=>{a.stopPropagation();const F=c.filter(G=>G!==o);g(G=>({...G,[w]:F,page:1}))},le=Y(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=R[a];return o?e.jsxs(C,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(tt,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(St,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:E,fullWidth:!0,logic:ve,display:(a,o,c,w)=>e.jsx(Te,{label:"Wallet",filterList:a,onChange:o,index:c,column:w,filterValues:E})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:w}=R[a];return e.jsx(ce,{status:o,updatedAt:c,reason:w,channel:"wallet",onResend:F=>T(F,R[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:w}=R[a];return e.jsx(ce,{status:o,updatedAt:c,reason:w,channel:"pushkit",onResend:F=>T(F,R[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:E,fullWidth:!0,logic:ve,display:(a,o,c,w)=>e.jsx(Te,{label:"Push Kit",filterList:a,onChange:o,index:c,column:w,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:w}=R[a];return e.jsx(ce,{status:o,updatedAt:c,reason:w,channel:"email",onResend:F=>T(F,R[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:E,fullWidth:!0,logic:ve,display:(a,o,c,w)=>e.jsx(Te,{label:"Email",filterList:a,onChange:o,index:c,column:w,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=R[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[w,F]=c,G=F[0];return e.jsx(C,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(C,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:w},w),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:q=>T(q,R[a],"webhook",[w],!1)})]},w)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=R[a];return e.jsx(st,{value:o,locale:i,shouldUpdate:!0})}}}],[R,i,p,r]),xt=[e.jsx(Me,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(Ie,{variant:"contained",size:"small",color:"primary",loading:O,startIcon:e.jsx(qt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(is,{children:e.jsxs(nt,{theme:b,children:[e.jsx(ot,{className:"receivers-table",locale:i,loading:O,columns:le,data:R,onChange:Z,options:se,customButtons:xt,components:{TableFilterList:a=>e.jsx(qe,{...a,itemComponent:o=>e.jsx(Ke,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ne,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(os,{children:[e.jsxs(X,{variant:"body1",component:"div",className:"check-title",children:[A?.channel," Checking"]}),e.jsx(C,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Re(A?.channel).map(a=>{const{type:o,pass:c,fail:w}=a;return!A?.result||A?.result?.[o]?e.jsxs(X,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:A?.result?.[o]?je.success.main:"inherit"},children:[A?.result?e.jsx(_t,{}):e.jsx(Qe,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(X,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:je.error.main},children:[e.jsx($t,{}),e.jsx("span",{children:w})]},o)})})]})}),I.anchorEl&&e.jsx(Ne,{open:!!I.anchorEl,anchorReference:"anchorPosition",anchorPosition:I.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(ft,{loading:n,onCancel:u,onConfirm:D})})]})})})}const as=x.memo(mt),is=ae.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -27,13 +27,13 @@ import{c as Ye,j as e,aR as bt,r as x,bF as Y,dg as U,H as $,c$ as $e,fj as q,bN
|
|
|
27
27
|
}
|
|
28
28
|
font-size: 12px;
|
|
29
29
|
}
|
|
30
|
-
`,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function rs(t){const{wallet:s,push:n,email:r,webhook:i}=t;return[{name:"Wallet",value:e.jsx(de,{item:s})},{name:"Push",value:e.jsx(de,{item:n})},{name:"Email",value:e.jsx(de,{item:r})},...i.total>0?[{name:"Webhook",value:e.jsx(de,{item:i,isWebhook:!0})}]:[]]}function ls(t,s,n){const{wallet:r,push:i,email:l,webhook:b}=t;return[{name:"Wallet",value:e.jsx(ue,{loading:n,channel:
|
|
30
|
+
`,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function rs(t){const{wallet:s,push:n,email:r,webhook:i}=t;return[{name:"Wallet",value:e.jsx(de,{item:s})},{name:"Push",value:e.jsx(de,{item:n})},{name:"Email",value:e.jsx(de,{item:r})},...i.total>0?[{name:"Webhook",value:e.jsx(de,{item:i,isWebhook:!0})}]:[]]}function ls(t,s,n){const{wallet:r,push:i,email:l,webhook:b}=t;return[{name:"Wallet",value:e.jsx(ue,{loading:n,channel:K.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(ue,{loading:n,channel:K.PUSH,item:i,onResend:s})},{name:"Email",value:e.jsx(ue,{loading:n,channel:K.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(ue,{loading:n,channel:K.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}Ue.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};de.propTypes={item:d.object.isRequired,isWebhook:d.bool};function de({item:t,isWebhook:s=!1}){const{t:n}=J(),r=s?t.success.length:t.success,i=t.total,l=r===i?"success":"failed";return e.jsx(C,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(C,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(te,{config:{status:l},enableTooltip:!1,children:[fe(r)," / ",fe(i)," ",n("notification.sendStatus.success")]})})})}ue.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};function ue({channel:t=K.WALLET,item:s,isWebhook:n=!1,onResend:r=()=>{},loading:i=!1}){const{t:l}=J(),{success:b,failed:m,pending:v}=s,h=ss(t),j=n?b.length:b,S=n?m.length:m,O=n?v.length:v,P=async I=>{I.stopPropagation();const A=n?[...new Set([...b,...m].map(H=>H))]:[];await r([t],[],!0,A)},R=j+S,_=R>0?j/R*100:0,M=R>0?S/R*100:0;return e.jsxs(cs,{successRatio:_,failedRatio:M,children:[e.jsxs(X,{variant:"h6",children:[h," (",s.total,")"]}),e.jsxs(X,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Ae.success,fontWeight:600,fontSize:24},children:fe(j)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(C,{className:"unsent-area",children:[e.jsxs(C,{children:[e.jsxs(te,{config:{status:"failed"},enableTooltip:!1,children:[fe(S)," ",l("notification.sendStatus.failed")]}),e.jsxs(te,{config:{status:"pending"},enableTooltip:!1,children:[fe(O)," ",l("notification.sendStatus.pending")]})]}),S>0&&e.jsx(C,{className:"resend-btn",children:e.jsx(Ie,{size:"small",color:"primary",loading:i,variant:"contained",startIcon:e.jsx(Fe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:P,children:l("notification.resend")})})]})]})}function Ue({statistics:t,mode:s="simple",onResend:n=()=>{},resending:r=!1}){const i=Y(()=>s==="simple"?rs(t):ls(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:i.map(l=>e.jsx(rt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(Ve,{container:!0,spacing:2,children:i.map(l=>e.jsx(Ve,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const cs=ae(C)`
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
align-items: flex-start;
|
|
34
34
|
padding: 16px;
|
|
35
35
|
border-radius: 8px;
|
|
36
|
-
background: ${({successRatio:t,failedRatio:s,theme:n})=>t===0&&s===0?n.palette.grey[300]:`linear-gradient(to right, ${
|
|
36
|
+
background: ${({successRatio:t,failedRatio:s,theme:n})=>t===0&&s===0?n.palette.grey[300]:`linear-gradient(to right, ${Ct(n.palette.success.light,.4)} ${t}%, ${n.palette.grey[100]} ${t}%)`};
|
|
37
37
|
transition: 'background 0.5s ease';
|
|
38
38
|
cursor: pointer;
|
|
39
39
|
.unsent-area {
|
|
@@ -45,7 +45,7 @@ import{c as Ye,j as e,aR as bt,r as x,bF as Y,dg as U,H as $,c$ as $e,fj as q,bN
|
|
|
45
45
|
bottom: 0;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
`;ht.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function ht({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:i,locale:l}=J(),{getComponent:b,resendNotification:m}=ze(),[v,h]=x.useState(!1),j=Y(()=>b(t.componentDid)||n,[n,t.componentDid]),S=Ee({tab:r||"info"}),O=x.useCallback(async(p,g,k=!0,N=[])=>{if(!p.length||!t.id)return;const E=g.length>0?g:t?.receivers?.map(B=>B.receiver);if(!E.length)return;let z=[...p];if(z.includes(
|
|
48
|
+
`;ht.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function ht({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:i,locale:l}=J(),{getComponent:b,resendNotification:m}=ze(),[v,h]=x.useState(!1),j=Y(()=>b(t.componentDid)||n,[n,t.componentDid]),S=Ee({tab:r||"info"}),O=x.useCallback(async(p,g,k=!0,N=[])=>{if(!p.length||!t.id)return;const E=g.length>0?g:t?.receivers?.map(B=>B.receiver);if(!E.length)return;let z=[...p];if(z.includes(K.PUSH)&&!ut(n)&&($.warning(i("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),z=z.filter(B=>B!==K.PUSH)),z.includes(K.EMAIL)&&!dt(n)&&($.warning(i("notification.sendStatus.reason.unavailable",{channel:"Email"})),z=z.filter(B=>B!==K.EMAIL)),!!z.length)try{h(!0),await m({notificationId:t.id,receivers:E,channels:z,resendFailedOnly:k,...z.includes("webhook")&&N.length?{webhookUrls:N}:{}}),$.success("Message has been sent!")}catch(B){console.error("handleResend error",{error:B}),$.error(B.response?B.response.statusText:B.message)}finally{h(!1)}},[n,t.id,t?.receivers,m,i]),P=Y(()=>Rt(t),[t]),R=Y(()=>Tt(t),[t]),_=Y(()=>P?t?.actorInfo:[],[t]),M=Y(()=>n?.did||n?.meta?.did||"",[n]);function I(){return[{name:i("notification.from"),value:P&&R?e.jsx(Dt,{actors:_,teamDid:M,size:32,showName:!0}):e.jsx(Lt,{size:32,blocklet:j,showName:!0,hideDot:!0})},{name:i("notification.notificationTitle"),value:e.jsx(me,{maxLength:50,children:t.title})},{name:i("notification.body"),value:P?e.jsx(Nt,{notification:t,blocklet:n}):e.jsx(Et,{notification:t,rows:0})},{name:i("notification.severity"),value:e.jsx(he,{severity:t.severity})},{name:i("notification.createdAt"),value:e.jsx(It,{value:t.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(rt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const A={info:{label:i("common.basicInfo"),value:"info",component:I},receivers:{label:i("notification.receiver"),value:"receivers"},statistics:{label:i("notification.statistics"),value:"statistics"}},H=Object.values(A).map(({label:p,value:g})=>({label:p,value:g})),V=A[S.tab]||A.info,Q=p=>{S.tab=p};return e.jsx(kt,{title:i("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{S.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(us,{children:[e.jsx(C,{className:"tabs",sx:{mx:3},children:e.jsx(Mt,{tabs:H,current:S.tab,onChange:Q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[S.tab==="receivers"&&e.jsx(as,{notificationId:t.id,resending:v,handleResend:O}),S.tab==="statistics"&&e.jsx(Ue,{statistics:t.statistics,mode:"detail",resending:v,onResend:O}),S.tab==="info"&&e.jsx(V.component,{})]})]})})}const ds=x.memo(ht),us=ae.div`
|
|
49
49
|
& > .notification-row {
|
|
50
50
|
padding: 0;
|
|
51
51
|
}
|
|
@@ -92,7 +92,7 @@ import{c as Ye,j as e,aR as bt,r as x,bF as Y,dg as U,H as $,c$ as $e,fj as q,bN
|
|
|
92
92
|
overflow: hidden;
|
|
93
93
|
text-overflow: ellipsis;
|
|
94
94
|
}
|
|
95
|
-
`;function we({blocklet:t=null,label:s=""}){return e.jsx(ps,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(it,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}gt.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function gt({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(
|
|
95
|
+
`;function we({blocklet:t=null,label:s=""}){return e.jsx(ps,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(it,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}gt.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function gt({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(C,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(X,{children:[s,": "]}),t.map(r=>e.jsx(Oe,{size:"small",label:e.jsx(C,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(he,{severity:r})}),onDelete:i=>n(i,r)},r))]})}function fs(t){return e.jsx(We,{...t,renderLabel:s=>e.jsx(he,{severity:s})})}function ms({customTableButtons:t}){const{t:s,locale:n}=J(),r=Ze(),i=At(r.breakpoints.down("sm")),l=x.useMemo(()=>et(r,pt()),[r]),[b,m]=x.useState(!1),{data:v,paging:h,blocklet:j,fetch:S,getComponent:O,componentDids:P,inService:R,teamDid:_}=ze(),M=x.useRef(null),[I,A]=x.useState(null),[H,V]=x.useState("info"),Q=`notification-records-${j.meta?.did}`,p=Wt(Q),[g,k]=x.useState({pageSize:p.rowsPerPage||10,page:p.page?p.page+1:1,dids:p.dids||[],dateRange:p.dateRange||[U().subtract(1,"month").startOf("day").toDate(),U().endOf("day").toDate()]}),N=Y(()=>{if(!j.children||!j.children.length)return[];const f=[];return j.children.forEach(u=>{const y=u.did||u.meta?.did;P.includes(y)&&(u.ancestors=[j],f.push(u))}),f},[P,j]),E=async f=>{try{m(!0),await S(f),m(!1)}finally{m(!1)}};x.useEffect(()=>{E(g)},[g]),x.useEffect(()=>{const f=v.find(u=>u.id===I?.id);I&&f&&A({...f})},[v]);const z=(f,u,y,D)=>{f.stopPropagation();const L=y.filter(T=>T!==u);k(T=>({...T,[D]:L,page:1}))},B=({page:f,rowsPerPage:u,filterList:y})=>{const[D=[],,,,L=[]]=y;g.pageSize!==u?k(T=>({...T,pageSize:u,page:1})):g.page!==f+1?k(T=>({...T,page:f+1})):pe(g.dids,D)?pe(g.severities,L)||k(T=>({...T,severities:L,page:1})):k(T=>({...T,dids:D,page:1}))},ie=x.useCallback(()=>{A(null),V("info")},[]),se=x.useCallback(()=>{S(g)},[S,g]),Z=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((u,y)=>{if(u==="system")return e.jsx("span",{children:s("notification.system")},`system-${y}`);const D=N.find(L=>(L.did||L.meta?.did)===u);return e.jsx(we,{blocklet:D,label:D?.title||D?.meta?.title},u)}),update:(f,u,y)=>(f[y].splice(u,1),f)},filterOptions:{names:N,logic:(f,u)=>u.length?!u.includes(f):!1,display:(f,u,y,D)=>e.jsxs(Be,{style:{width:"380px"},children:[e.jsx(Ot,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Bt,{multiple:!0,value:f[y],renderValue:L=>e.jsx(C,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:L.map(T=>{if(T==="system")return e.jsx("span",{children:s("notification.system")},T);const re=N.find(ne=>(ne.did||ne.meta?.did)===T);return e.jsx(we,{blocklet:re,label:re?.title||re?.meta?.title},T)})}),onChange:L=>{f[y]=L.target.value,u(f[y],y,D)},children:[e.jsx(Ge,{value:"system",children:s("notification.system")}),N.map(L=>{const T=L.did||L.meta?.did;return e.jsx(Ge,{value:T,children:e.jsx(we,{blocklet:L,label:L.title||L.meta?.title})},T)})]})]})},customBodyRenderLite:f=>{const u=v[f],y=O(u.componentDid);return e.jsxs(C,{sx:{display:"flex",alignItems:"center",gap:1},children:[y?e.jsx(it,{size:32,blocklet:y,ancestors:y.ancestors??[]}):e.jsx(Pt,{blocklet:j,size:32}),e.jsx(me,{maxLength:50,children:y?.meta?.title||j?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const u=v[f],{receivers:y}=u;return e.jsx(Ft,{total:y.length,renderSurplus:D=>D<100?e.jsxs("span",{children:["+",D]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:D=>{D.stopPropagation(),A(u),V("receivers")},children:y.map(D=>{const{receiverUser:L}=D;if(!L)return null;const T=at(L.avatar,_,R);return e.jsx(tt,{alt:L.fullName,src:`${T}?imageFilter=resize&w=48&h=48`,size:32,did:D.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},D.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const u=v[f];return e.jsx(C,{onClick:y=>{y.stopPropagation(),A(u),V("statistics")},children:e.jsx(Ue,{statistics:u.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const u=v[f];return e.jsx(me,{maxLength:50,children:u.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const u=v[f];return e.jsx(he,{severity:u.severity})},filter:!0,filterType:"custom",filterList:g.severities??[],customFilterListOptions:{render:f=>e.jsx(gt,{list:f,label:s("notification.severity"),onDelete:(u,y)=>{u.stopPropagation(),z(u,y,Z[4].options.filterList,"severities")}}),update:ye},filterOptions:{names:Xe,fullWidth:!0,logic:ve,display:(f,u,y,D)=>e.jsx(fs,{label:s("notification.severity"),filterList:f,onChange:u,index:y,column:D,filterValues:Xe})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:u}=v[f];return e.jsx(st,{value:u,locale:n,shouldUpdate:!0})}}}],oe=f=>{k(u=>({...u,dateRange:f,page:1}))},Re=[...t||[]];return e.jsxs(C,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(hs,{isBreakpointsDownSm:i,children:e.jsx(nt,{theme:l,children:e.jsx(ot,{className:"main-table",verticalKeyWidth:100,loading:b,locale:n,columns:Z,data:v,durable:Q,onChange:B,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...p,onRowClick:(f,{dataIndex:u})=>{A(v[u])}},title:e.jsx(Me,{value:g.dateRange,onChange:oe}),customButtons:Re,components:{TableFilterList:f=>e.jsx(qe,{...f,itemComponent:u=>e.jsx(Ke,{...u,canDelete:y=>y?.columnNames?.[y?.index||0]?.name==="sender"})})}})})}),I&&e.jsx(ds,{refresh:se,onCancel:ie,notification:I,blocklet:j,tab:H})]})}const hs=ae.div`
|
|
96
96
|
td.MuiTableCell-footer {
|
|
97
97
|
border: none !important;
|
|
98
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as me,j as e,r as D,q as je,B as O,eP as Gt,at as W,aD as Ke,au as ue,C as it,aF as cn,bf as ks,o as T,gs as Ss,R as dn,cC as Cs,es as Rs,P as Ps,J as Y,fh as kt,aR as te,bG as Bt,p as pe,hZ as Os,bH as Ht,al as X,ax as ee,aA as oe,H as V,aH as se,V as J,d as un,ct as As,A as hn,ar as $s,aT as mn,gv as Ts,h_ as Es,eX as Is,ch as ne,cx as qe,cu as Se,cv as Ls,as as St,bz as Q,bB as Ct,hm as $e,h$ as Ds,ev as Fe,ew as qs,i0 as Rt,e6 as Ve,i1 as zs,i2 as Ms,i3 as Bs,i4 as ut,bj as fn,fN as Hs,i5 as Ns,dk as Yt,c8 as Fs,fO as pn,ad as le,d2 as Jt,i6 as Zs,cJ as Vs,i7 as Ee,aS as _e,b6 as ve,k as E,i8 as Pt,F as K,an as Ot,x as ke,W as Me,g as gn,bF as be,af as ie,i9 as Nt,X as re,d4 as Ge,d6 as Ws,bK as Us,ab as Ie,cz as Ks,d8 as he,dB as Oe,gO as we,gY as ze,dz as xn,ia as Gs,ib as Ys,fQ as Js,du as Xs,dt as Qs,ic as er,ao as tr,Q as nr,bb as At,co as sr,cp as rr,cq as ir,S as ar,M as yn,cr as or,bt as lr,i as We,hA as st,id as $t,ie as cr,ig as ae,aC as dr,eS as vn,dU as rt,ih as bn,ga as ur,fz as Ae,f$ as jn,di as wn,ii as hr,g0 as mr,g3 as fr,bu as ht,bM as pr,aV as gr}from"./index-DEflHlyo.js";import{S as xr}from"./actions-CCjvPhEB.js";import{N as Xt}from"./ChevronRight-Bry_Rp2n.js";import{T as Ue}from"./html-title-BO3r7YSd.js";import{w as Be,P as yr}from"./permission-Dgeoh_gC.js";import{u as Ft}from"./index-DTHqSol2.js";import{F as vr,R as br,S as B,a as Tt,s as jr,L as Re,A as wr,b as _r,c as kr,d as Sr,e as Cr,f as Rr,g as Pr,B as Or}from"./preference-DPXvsW07.js";import{D as Ar}from"./Done-D38mSa7e.js";import{A as $r,a as Qt}from"./Autocomplete-DTKIP70z.js";import{C as Tr,R as Er,S as Ir,P as Lr}from"./rotate-session-key-Cg34J7dQ.js";import{u as ce}from"./blocklet-mQW2VRE3.js";import{C as _n}from"./click-to-copy-BJwHXTAU.js";import{a as at}from"./team-pgmvSiLk.js";import{v as Dr}from"./index-IQ8RBJFB.js";import{i as tt,g as qr}from"./chain-Bajmovwi.js";import{V as zr}from"./status-B8aMCivY.js";import{a as fe,S as Mr,u as kn}from"./switch-control-DN6AO5e-.js";import{u as ge,C as F,b as en}from"./index.esm-uIPkYqTP.js";import{i as mt}from"./isEmail-DYZ2ooZR.js";import{u as Br,a as Hr,D as Nr,H as Fr}from"./index-BWxIl7Zm.js";import{M as Pe}from"./provider-icon-H03n2Hjs.js";import{S as nt}from"./simple-select-DUBD32-K.js";import{D as tn}from"./Delete-BR43GocU.js";import{A as Et}from"./Add-D1qtasGt.js";import{S as Zr,F as Vr,E as Wr}from"./federated-detail-dialog-BAAYkStt.js";import{H as ot}from"./index-BA_zqSiS.js";import{u as Sn}from"./use-mobile-D8q1By2e.js";import{D as Ur}from"./DeleteOutline-BknUUIOQ.js";import{C as Kr}from"./CardContent-uQht8_nO.js";import{R as Cn,b as Rn}from"./url-evaluation-DF8LRV6u.js";import"./useLocalStorage-B1cIHaab.js";import"./MoreVert-YQMFdAci.js";import"./get-safe-url-BmWKThk5.js";import"./ButtonGroup-BmKH0AR_.js";import"./getValidReactChildren-CaUdxsqb.js";import"./omit-C9i7Uayy.js";import"./index-22B4OxZa.js";import"./edit.svg-DgkWXClh.js";import"./ArrowDropDown-CLtIK8Ds.js";import"./index-DgAeLiKC.js";import"./iframe-DaoKgbiQ.js";import"./ListSubheader-BrZqDYTB.js";import"./visuallyHidden-Dan1xhjv.js";import"./ErrorOutline-DSSui5bs.js";import"./index-DZ_f5Dfi.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./passkey-rounded-_WDHIZVd.js";import"./FilterList-ByiwX7w6.js";import"./CSSTransition-By0IzEZz.js";import"./emotion-cache.browser.esm-C9pXLaus.js";import"./depsEqual-BTB47kAG.js";import"./index-Bl5zzd5F.js";import"./TableSearch-QTEwGVjE.js";import"./Search-B-Kpov_x.js";import"./Clear-C9b1QEIp.js";const Pn=me([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")]),Gr=me([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")]),Yr=me(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"})),Jr=me(e.jsx("path",{d:"M20 13H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1M7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M20 3H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1M7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"})),Xr=me(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"})),Qr=me(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"})),ei=me(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"})),ti=me(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"})),ni=me(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"})),It=me(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"})),si=me([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")]),ri=me(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"})),ii=me(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"})),ai=me(e.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),oi=me(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"})),li=me(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"})),ci={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 On({label:_="",disabled:j=!1,required:P=!1,initialValue:R="",onChange:k=()=>{},style:y={},onSubmit:x=()=>{},triggers:o=[],options:f=[],formatterBeforeSubmit:p=i=>i.join(","),helperText:u="",placeholder:t="",renderImage:a=()=>null,renderLabel:r=()=>"",filterKeys:n=["name"],noEmpty:s=!1,...c}){const[i,l]=D.useState(!1),[d,h]=D.useState(!1),[g,w]=D.useState(""),S=D.useRef(null),[m,v]=D.useState(R),[b,C]=D.useState(m),A=D.useMemo(()=>{if(!f)return{};const H={};return f.forEach(I=>{H[I.code]=I}),H},[f]),$=()=>{if(!f)return[];if(!g)return f.map(I=>I.code);const H=new RegExp(g.toLowerCase());return f.filter(I=>{for(let N=0;N<n.length;N++){const Z=n[N];if(H.test(I[Z]?.toLowerCase()))return!0}return!1}).map(I=>I.code)},q=async()=>{h(!0);try{await x(typeof p=="function"?p(b):b)===!1?C(m):s&&!b.length?(C(R),v(R)):(C(b),v(b))}catch{C(m)}finally{h(!1),l(!1)}},M=(H,I)=>{if(!Array.isArray(I)){C([]),k([]);return}const N=I.filter(Z=>A[Z]);if(!N.length){C([]),k([]);return}C(N),k(N)},U=H=>{H.stopPropagation(),l(!0),setTimeout(()=>{if(S.current){const I=S.current.querySelector("input");I&&I.focus()}},500)},z=i?e.jsx($r,{ref:S,options:f,value:b,onChange:M,inputValue:g,onInputChange:(H,I)=>{w(I)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:$,getOptionLabel:H=>A[H]?.name,renderInput:H=>e.jsx(W,{...H,label:"",placeholder:t}),renderOption:(H,I)=>{const N=b.indexOf(I)!==-1;return D.createElement(di,{component:"li",...H,key:I},a(A[I]||{}),e.jsx(O,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:N?"700":"normal"},children:r(I,A[I])||A[I]?.name}),e.jsx(O,{component:Gt,sx:{opacity:.5,width:18,height:18},style:{visibility:N?"visible":"hidden"}}))},...c,slots:{popper:ui}}):e.jsx(O,{className:"form-item-input slot",onClick:U,style:{whiteSpace:"pre-wrap",cursor:"text"},sx:{px:1},children:b.filter(H=>f.some(I=>I.code===H)).map(H=>e.jsx(Ke,{label:f.find(I=>I.code===H).name,style:{marginRight:8},size:"small"},H))});return e.jsx(vr,{className:"form",style:y,children:e.jsxs(O,{className:"form-item",children:[e.jsxs(O,{className:"form-item-label",children:[_,P&&e.jsx(br,{})]}),e.jsxs(O,{className:"form-item-body",children:[e.jsx(O,{className:"form-item-input",children:z}),i?e.jsx(O,{className:"form-item-action",children:e.jsxs(e.Fragment,{children:[e.jsx(ue,{"data-cy":"schema-form-item-confirm",onClick:q,disabled:j||d,size:"large",children:d?e.jsx(it,{size:24}):e.jsx(Ar,{})}),e.jsx(ue,{"data-cy":"schema-form-item-cancel",onClick:()=>{C(m),l(!1)},disabled:j||d,size:"large",children:e.jsx(Gt,{})})]})}):null]}),i&&u&&e.jsx(cn,{children:u})]})})}On.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 di=je.div`
|
|
1
|
+
import{c as me,j as e,r as D,q as je,B as O,eP as Gt,au as W,aE as Ke,av as ue,C as it,aG as cn,bf as ks,o as T,gs as Ss,R as dn,cC as Cs,es as Rs,P as Ps,J as Y,fh as kt,aS as te,bG as Bt,p as pe,hZ as Os,bH as Ht,am as X,ay as ee,aB as oe,H as V,aI as se,V as J,d as un,ct as As,A as hn,as as $s,aU as mn,gv as Ts,h_ as Es,eX as Is,ch as ne,cx as qe,cu as Se,cv as Ls,at as St,bz as Q,bB as Ct,hm as $e,h$ as Ds,ev as Fe,ew as qs,i0 as Rt,e6 as Ve,i1 as zs,i2 as Ms,i3 as Bs,i4 as ut,bj as fn,fN as Hs,i5 as Ns,dk as Yt,c8 as Fs,fO as pn,ad as le,d2 as Jt,i6 as Zs,cJ as Vs,i7 as Ee,aT as _e,b6 as ve,k as E,i8 as Pt,F as K,ao as Ot,x as ke,W as Me,g as gn,bF as be,af as ie,i9 as Nt,X as re,d4 as Ge,d6 as Ws,bK as Us,ab as Ie,cz as Ks,d8 as he,dB as Oe,gO as we,gY as ze,dz as xn,ia as Gs,ib as Ys,fQ as Js,du as Xs,dt as Qs,ic as er,ap as tr,Q as nr,bb as At,co as sr,cp as rr,cq as ir,S as ar,M as yn,cr as or,bt as lr,i as We,hA as st,id as $t,ie as cr,ig as ae,aD as dr,eS as vn,dU as rt,ih as bn,ga as ur,fz as Ae,f$ as jn,di as wn,ii as hr,g0 as mr,g3 as fr,bu as ht,bM as pr,aV as gr}from"./index-CP8e2zcP.js";import{S as xr}from"./actions-BuX7-i-0.js";import{N as Xt}from"./ChevronRight-C_yvQN06.js";import{T as Ue}from"./html-title-DwrWBQUt.js";import{w as Be,P as yr}from"./permission-D6xGjoP4.js";import{u as Ft}from"./index-1nsTMIEw.js";import{F as vr,R as br,S as B,a as Tt,s as jr,L as Re,A as wr,b as _r,c as kr,d as Sr,e as Cr,f as Rr,g as Pr,B as Or}from"./preference-CWfaETuk.js";import{D as Ar}from"./Done-DfHgd6VN.js";import{A as $r,a as Qt}from"./Autocomplete-BHqH72uG.js";import{C as Tr,R as Er,S as Ir,P as Lr}from"./rotate-session-key-Cn3NVWRi.js";import{u as ce}from"./blocklet-D7q_eJsm.js";import{C as _n}from"./click-to-copy-wk3E32eY.js";import{a as at}from"./team-Bp-ehLS6.js";import{v as Dr}from"./index-8K8V7S7h.js";import{i as tt,g as qr}from"./chain-DDmwEbOF.js";import{V as zr}from"./status-vwaEURfH.js";import{a as fe,S as Mr,u as kn}from"./switch-control-BEw34mlq.js";import{u as ge,C as F,b as en}from"./index.esm-DjcC6_YD.js";import{i as mt}from"./isEmail-CpvKmXxu.js";import{u as Br,a as Hr,D as Nr,H as Fr}from"./index-CyXVLDQI.js";import{M as Pe}from"./provider-icon-D-a204Ay.js";import{S as nt}from"./simple-select-DApzKMrW.js";import{D as tn}from"./Delete-CCasVLgy.js";import{A as Et}from"./Add-B-lIYZBc.js";import{S as Zr,F as Vr,E as Wr}from"./federated-detail-dialog-C93dA_OW.js";import{H as ot}from"./index-7TgPZijh.js";import{u as Sn}from"./use-mobile-BIorytbM.js";import{D as Ur}from"./DeleteOutline-CocEa6gq.js";import{C as Kr}from"./CardContent-MdG6Fo_s.js";import{R as Cn,b as Rn}from"./url-evaluation-BotqjpOW.js";import"./useLocalStorage-CBx2eW_l.js";import"./MoreVert-Cw1fjU9L.js";import"./get-safe-url-n4nPkbEQ.js";import"./ButtonGroup-CXwzM552.js";import"./getValidReactChildren-dJeDeNuf.js";import"./omit-C1X-CRrb.js";import"./index-PzC6rkTH.js";import"./edit.svg-CBqxioRV.js";import"./ArrowDropDown-C1ynmK1V.js";import"./index-B01of1n7.js";import"./iframe-B0inMXzK.js";import"./ListSubheader-rZisNvzB.js";import"./visuallyHidden-Dan1xhjv.js";import"./ErrorOutline-D3nJBXYA.js";import"./index-D3qtx7de.js";import"./redux-Ab4buSXY.js";import"./typeof-QjJsDpFa.js";import"./passkey-rounded-_WDHIZVd.js";import"./FilterList-BiaeVs0C.js";import"./CSSTransition-hTlKGu0l.js";import"./emotion-cache.browser.esm-D6kXFXIA.js";import"./depsEqual-FU6HOfMn.js";import"./index-DX_ig3IR.js";import"./TableSearch-ZIwL7jK3.js";import"./Search-mc0LftDb.js";import"./Clear-XkW6YpHE.js";const Pn=me([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")]),Gr=me([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")]),Yr=me(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"})),Jr=me(e.jsx("path",{d:"M20 13H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1M7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M20 3H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1M7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"})),Xr=me(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"})),Qr=me(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"})),ei=me(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"})),ti=me(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"})),ni=me(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"})),It=me(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"})),si=me([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")]),ri=me(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"})),ii=me(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"})),ai=me(e.jsx("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"})),oi=me(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"})),li=me(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"})),ci={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 On({label:_="",disabled:j=!1,required:P=!1,initialValue:R="",onChange:k=()=>{},style:y={},onSubmit:x=()=>{},triggers:o=[],options:f=[],formatterBeforeSubmit:p=i=>i.join(","),helperText:u="",placeholder:t="",renderImage:a=()=>null,renderLabel:r=()=>"",filterKeys:n=["name"],noEmpty:s=!1,...c}){const[i,l]=D.useState(!1),[d,h]=D.useState(!1),[g,w]=D.useState(""),S=D.useRef(null),[m,v]=D.useState(R),[b,C]=D.useState(m),A=D.useMemo(()=>{if(!f)return{};const H={};return f.forEach(I=>{H[I.code]=I}),H},[f]),$=()=>{if(!f)return[];if(!g)return f.map(I=>I.code);const H=new RegExp(g.toLowerCase());return f.filter(I=>{for(let N=0;N<n.length;N++){const Z=n[N];if(H.test(I[Z]?.toLowerCase()))return!0}return!1}).map(I=>I.code)},q=async()=>{h(!0);try{await x(typeof p=="function"?p(b):b)===!1?C(m):s&&!b.length?(C(R),v(R)):(C(b),v(b))}catch{C(m)}finally{h(!1),l(!1)}},M=(H,I)=>{if(!Array.isArray(I)){C([]),k([]);return}const N=I.filter(Z=>A[Z]);if(!N.length){C([]),k([]);return}C(N),k(N)},U=H=>{H.stopPropagation(),l(!0),setTimeout(()=>{if(S.current){const I=S.current.querySelector("input");I&&I.focus()}},500)},z=i?e.jsx($r,{ref:S,options:f,value:b,onChange:M,inputValue:g,onInputChange:(H,I)=>{w(I)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:$,getOptionLabel:H=>A[H]?.name,renderInput:H=>e.jsx(W,{...H,label:"",placeholder:t}),renderOption:(H,I)=>{const N=b.indexOf(I)!==-1;return D.createElement(di,{component:"li",...H,key:I},a(A[I]||{}),e.jsx(O,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:N?"700":"normal"},children:r(I,A[I])||A[I]?.name}),e.jsx(O,{component:Gt,sx:{opacity:.5,width:18,height:18},style:{visibility:N?"visible":"hidden"}}))},...c,slots:{popper:ui}}):e.jsx(O,{className:"form-item-input slot",onClick:U,style:{whiteSpace:"pre-wrap",cursor:"text"},sx:{px:1},children:b.filter(H=>f.some(I=>I.code===H)).map(H=>e.jsx(Ke,{label:f.find(I=>I.code===H).name,style:{marginRight:8},size:"small"},H))});return e.jsx(vr,{className:"form",style:y,children:e.jsxs(O,{className:"form-item",children:[e.jsxs(O,{className:"form-item-label",children:[_,P&&e.jsx(br,{})]}),e.jsxs(O,{className:"form-item-body",children:[e.jsx(O,{className:"form-item-input",children:z}),i?e.jsx(O,{className:"form-item-action",children:e.jsxs(e.Fragment,{children:[e.jsx(ue,{"data-cy":"schema-form-item-confirm",onClick:q,disabled:j||d,size:"large",children:d?e.jsx(it,{size:24}):e.jsx(Ar,{})}),e.jsx(ue,{"data-cy":"schema-form-item-cancel",onClick:()=>{C(m),l(!1)},disabled:j||d,size:"large",children:e.jsx(Gt,{})})]})}):null]}),i&&u&&e.jsx(cn,{children:u})]})})}On.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 di=je.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{U as h}from"./index-DEflHlyo.js";var he=t=>t.type==="checkbox",le=t=>t instanceof Date,z=t=>t==null;const gt=t=>typeof t=="object";var I=t=>!z(t)&&!Array.isArray(t)&>(t)&&!le(t),mt=t=>I(t)&&t.target?he(t.target)?t.target.checked:t.target.value:t,It=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ht=(t,i)=>t.has(It(i)),Nt=t=>{const i=t.constructor&&t.constructor.prototype;return I(i)&&i.hasOwnProperty("isPrototypeOf")},$e=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function U(t){if(t instanceof Date)return new Date(t);const i=typeof FileList<"u"&&t instanceof FileList;if($e&&(t instanceof Blob||i))return t;const e=Array.isArray(t);if(!e&&!(I(t)&&Nt(t)))return t;const r=e?[]:Object.create(Object.getPrototypeOf(t));for(const u in t)Object.prototype.hasOwnProperty.call(t,u)&&(r[u]=U(t[u]));return r}var Ae=t=>/^\w*$/.test(t),R=t=>t===void 0,xe=t=>Array.isArray(t)?t.filter(Boolean):[],Ge=t=>xe(t.replace(/["|']|\]/g,"").split(/\.|\[/)),g=(t,i,e)=>{if(!i||!I(t))return e;const r=(Ae(i)?[i]:Ge(i)).reduce((u,n)=>z(u)?u:u[n],t);return R(r)||r===t?R(t[i])?e:t[i]:r},X=t=>typeof t=="boolean",K=t=>typeof t=="function",O=(t,i,e)=>{let r=-1;const u=Ae(i)?[i]:Ge(i),n=u.length,o=n-1;for(;++r<n;){const d=u[r];let p=e;if(r!==o){const x=t[d];p=I(x)||Array.isArray(x)?x:isNaN(+u[r+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;t[d]=p,t=t[d]}};const ve={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},te={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"},bt=h.createContext(null);bt.displayName="HookFormControlContext";const pe=()=>h.useContext(bt);var vt=(t,i,e,r=!0)=>{const u={defaultValues:i._defaultValues};for(const n in t)Object.defineProperty(u,n,{get:()=>{const o=n;return i._proxyFormState[o]!==te.all&&(i._proxyFormState[o]=!r||te.all),e&&(e[o]=!0),t[o]}});return u};const ke=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Bt(t){const i=pe(),{control:e=i,disabled:r,name:u,exact:n}=t||{},[o,d]=h.useState(e._formState),p=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ke(()=>e._subscribe({name:u,formState:p.current,exact:n,callback:x=>{!r&&d({...e._formState,...x})}}),[u,r,n]),h.useEffect(()=>{p.current.isValid&&e._setValid(!0)},[e]),h.useMemo(()=>vt(o,e,p.current,!1),[o,e])}var Z=t=>typeof t=="string",Pe=(t,i,e,r,u)=>Z(t)?(r&&i.watch.add(t),g(e,t,u)):Array.isArray(t)?t.map(n=>(r&&i.watch.add(n),g(e,n))):(r&&(i.watchAll=!0),e),We=t=>z(t)||!gt(t);function se(t,i,e=new WeakSet){if(We(t)||We(i))return Object.is(t,i);if(le(t)&&le(i))return Object.is(t.getTime(),i.getTime());const r=Object.keys(t),u=Object.keys(i);if(r.length!==u.length)return!1;if(e.has(t)||e.has(i))return!0;e.add(t),e.add(i);for(const n of r){const o=t[n];if(!u.includes(n))return!1;if(n!=="ref"){const d=i[n];if(le(o)&&le(d)||I(o)&&I(d)||Array.isArray(o)&&Array.isArray(d)?!se(o,d,e):!Object.is(o,d))return!1}}return!0}function Pt(t){const i=pe(),{control:e=i,name:r,defaultValue:u,disabled:n,exact:o,compute:d}=t||{},p=h.useRef(u),x=h.useRef(d),q=h.useRef(void 0),b=h.useRef(e),w=h.useRef(r);x.current=d;const[F,P]=h.useState(()=>{const f=e._getWatch(r,p.current);return x.current?x.current(f):f}),M=h.useCallback(f=>{const y=Pe(r,e._names,f||e._formValues,!1,p.current);return x.current?x.current(y):y},[e._formValues,e._names,r]),N=h.useCallback(f=>{if(!n){const y=Pe(r,e._names,f||e._formValues,!1,p.current);if(x.current){const V=x.current(y);se(V,q.current)||(P(V),q.current=V)}else P(y)}},[e._formValues,e._names,n,r]);ke(()=>((b.current!==e||!se(w.current,r))&&(b.current=e,w.current=r,N()),e._subscribe({name:r,formState:{values:!0},exact:o,callback:f=>{N(f.values)}})),[e,o,r,N]),h.useEffect(()=>e._removeUnmounted());const T=b.current!==e,A=w.current,W=h.useMemo(()=>{if(n)return null;const f=!T&&!se(A,r);return T||f?M():null},[n,T,r,A,M]);return W!==null?W:F}function Wt(t){const i=pe(),{name:e,disabled:r,control:u=i,shouldUnregister:n,defaultValue:o,exact:d=!0}=t,p=ht(u._names.array,e),x=h.useMemo(()=>g(u._formValues,e,g(u._defaultValues,e,o)),[u,e,o]),q=Pt({control:u,name:e,defaultValue:x,exact:d}),b=Bt({control:u,name:e,exact:d}),w=h.useRef(t),F=h.useRef(void 0),P=h.useRef(u.register(e,{...t.rules,value:q,...X(t.disabled)?{disabled:t.disabled}:{}}));w.current=t;const M=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(b.errors,e)},isDirty:{enumerable:!0,get:()=>!!g(b.dirtyFields,e)},isTouched:{enumerable:!0,get:()=>!!g(b.touchedFields,e)},isValidating:{enumerable:!0,get:()=>!!g(b.validatingFields,e)},error:{enumerable:!0,get:()=>g(b.errors,e)}}),[b,e]),N=h.useCallback(f=>P.current.onChange({target:{value:mt(f),name:e},type:ve.CHANGE}),[e]),T=h.useCallback(()=>P.current.onBlur({target:{value:g(u._formValues,e),name:e},type:ve.BLUR}),[e,u._formValues]),A=h.useCallback(f=>{const y=g(u._fields,e);y&&y._f&&f&&(y._f.ref={focus:()=>K(f.focus)&&f.focus(),select:()=>K(f.select)&&f.select(),setCustomValidity:V=>K(f.setCustomValidity)&&f.setCustomValidity(V),reportValidity:()=>K(f.reportValidity)&&f.reportValidity()})},[u._fields,e]),W=h.useMemo(()=>({name:e,value:q,...X(r)||b.disabled?{disabled:b.disabled||r}:{},onChange:N,onBlur:T,ref:A}),[e,r,b.disabled,N,T,A,q]);return h.useEffect(()=>{const f=u._options.shouldUnregister||n,y=F.current;y&&y!==e&&!p&&u.unregister(y),u.register(e,{...w.current.rules,...X(w.current.disabled)?{disabled:w.current.disabled}:{}});const V=(S,$)=>{const J=g(u._fields,S);J&&J._f&&(J._f.mount=$)};if(V(e,!0),f){const S=U(g(u._options.defaultValues,e,w.current.defaultValue));O(u._defaultValues,e,S),R(g(u._formValues,e))&&O(u._formValues,e,S)}return!p&&u.register(e),F.current=e,()=>{(p?f&&!u._state.action:f)?u.unregister(e):V(e,!1)}},[e,u,p,n]),h.useEffect(()=>{u._setDisabledField({disabled:r,name:e})},[r,e,u]),h.useMemo(()=>({field:W,formState:b,fieldState:M}),[W,b,M])}const nr=t=>t.render(Wt(t)),qt=h.createContext(null);qt.displayName="HookFormContext";var Ht=(t,i,e,r,u)=>i?{...e[t],types:{...e[t]&&e[t].types?e[t].types:{},[r]:u||!0}}:{},Y=t=>Array.isArray(t)?t:[t],nt=()=>{let t=[];return{get observers(){return t},next:u=>{for(const n of t)n.next&&n.next(u)},subscribe:u=>(t.push(u),{unsubscribe:()=>{t=t.filter(n=>n!==u)}}),unsubscribe:()=>{t=[]}}};function Vt(t,i){const e={};for(const r in t)if(t.hasOwnProperty(r)){const u=t[r],n=i[r];if(u&&I(u)&&n){const o=Vt(u,n);I(o)&&(e[r]=o)}else t[r]&&(e[r]=n)}return e}var j=t=>I(t)&&!Object.keys(t).length,Ke=t=>t.type==="file",Ve=t=>{if(!$e)return!1;const i=t?t.ownerDocument:0;return t instanceof(i&&i.defaultView?i.defaultView.HTMLElement:HTMLElement)},Ft=t=>t.type==="select-multiple",ze=t=>t.type==="radio",jt=t=>ze(t)||he(t),Oe=t=>Ve(t)&&t.isConnected;function $t(t,i){const e=i.slice(0,-1).length;let r=0;for(;r<e;)t=R(t)?r++:t[i[r++]];return t}function Gt(t){for(const i in t)if(t.hasOwnProperty(i)&&!R(t[i]))return!1;return!0}function L(t,i){const e=Array.isArray(i)?i:Ae(i)?[i]:Ge(i),r=e.length===1?t:$t(t,e),u=e.length-1,n=e[u];return r&&delete r[n],u!==0&&(I(r)&&j(r)||Array.isArray(r)&&Gt(r))&&L(t,e.slice(0,-1)),t}var Kt=t=>{for(const i in t)if(K(t[i]))return!0;return!1};function At(t){return Array.isArray(t)||I(t)&&!Kt(t)}function qe(t,i={}){for(const e in t){const r=t[e];At(r)?(i[e]=Array.isArray(r)?[]:{},qe(r,i[e])):R(r)||(i[e]=!0)}return i}function ce(t,i,e){e||(e=qe(i));for(const r in t){const u=t[r];if(At(u))R(i)||We(e[r])?e[r]=qe(u,Array.isArray(u)?[]:{}):ce(u,z(i)?{}:i[r],e[r]);else{const n=i[r];e[r]=!se(u,n)}}return e}const ut={value:!1,isValid:!1},lt={value:!0,isValid:!0};var xt=t=>{if(Array.isArray(t)){if(t.length>1){const i=t.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:i,isValid:!!i.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!R(t[0].attributes.value)?R(t[0].value)||t[0].value===""?lt:{value:t[0].value,isValid:!0}:lt:ut}return ut},pt=(t,{valueAsNumber:i,valueAsDate:e,setValueAs:r})=>R(t)?t:i?t===""?NaN:t&&+t:e&&Z(t)?new Date(t):r?r(t):t;const ot={isValid:!1,value:null};var kt=t=>Array.isArray(t)?t.reduce((i,e)=>e&&e.checked&&!e.disabled?{isValid:!0,value:e.value}:i,ot):ot;function ct(t){const i=t.ref;return Ke(i)?i.files:ze(i)?kt(t.refs).value:Ft(i)?[...i.selectedOptions].map(({value:e})=>e):he(i)?xt(t.refs).value:pt(R(i.value)?t.ref.value:i.value,t)}var zt=(t,i,e,r)=>{const u={};for(const n of t){const o=g(i,n);o&&O(u,n,o._f)}return{criteriaMode:e,names:[...t],fields:u,shouldUseNativeValidation:r}},Fe=t=>t instanceof RegExp,me=t=>R(t)?t:Fe(t)?t.source:I(t)?Fe(t.value)?t.value.source:t.value:t,de=t=>({isOnSubmit:!t||t===te.onSubmit,isOnBlur:t===te.onBlur,isOnChange:t===te.onChange,isOnAll:t===te.all,isOnTouch:t===te.onTouched});const dt="AsyncFunction";var Yt=t=>!!t&&!!t.validate&&!!(K(t.validate)&&t.validate.constructor.name===dt||I(t.validate)&&Object.values(t.validate).find(i=>i.constructor.name===dt)),Jt=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),He=(t,i,e)=>!e&&(i.watchAll||i.watch.has(t)||[...i.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const fe=(t,i,e,r)=>{for(const u of e||Object.keys(t)){const n=g(t,u);if(n){const{_f:o,...d}=n;if(o){if(o.refs&&o.refs[0]&&i(o.refs[0],u)&&!r)return!0;if(o.ref&&i(o.ref,o.name)&&!r)return!0;if(fe(d,i))break}else if(I(d)&&fe(d,i))break}}};function ft(t,i,e){const r=g(t,e);if(r||Ae(e))return{error:r,name:e};const u=e.split(".");for(;u.length;){const n=u.join("."),o=g(i,n),d=g(t,n);if(o&&!Array.isArray(o)&&e!==n)return{name:e};if(d&&d.type)return{name:n,error:d};if(d&&d.root&&d.root.type)return{name:`${n}.root`,error:d.root};u.pop()}return{name:e}}var Qt=(t,i,e,r)=>{e(t);const{name:u,...n}=t;return j(n)||Object.keys(n).length>=Object.keys(i).length||Object.keys(n).find(o=>i[o]===(!r||te.all))},Xt=(t,i,e)=>!t||!i||t===i||Y(t).some(r=>r&&(e?r===i:r.startsWith(i)||i.startsWith(r))),Zt=(t,i,e,r,u)=>u.isOnAll?!1:!e&&u.isOnTouch?!(i||t):(e?r.isOnBlur:u.isOnBlur)?!t:(e?r.isOnChange:u.isOnChange)?t:!0,er=(t,i)=>!xe(g(t,i)).length&&L(t,i),wt=(t,i,e)=>{const r=Y(g(t,e));return O(r,"root",i[e]),O(t,e,r),t};function yt(t,i,e="validate"){if(Z(t)||Array.isArray(t)&&t.every(Z)||X(t)&&!t)return{type:e,message:Z(t)?t:"",ref:i}}var oe=t=>I(t)&&!Fe(t)?t:{value:t,message:""},je=async(t,i,e,r,u,n)=>{const{ref:o,refs:d,required:p,maxLength:x,minLength:q,min:b,max:w,pattern:F,validate:P,name:M,valueAsNumber:N,mount:T}=t._f,A=g(e,M);if(!T||i.has(M))return{};const W=d?d[0]:o,f=k=>{u&&W.reportValidity&&(W.setCustomValidity(X(k)?"":k||""),W.reportValidity())},y={},V=ze(o),S=he(o),$=V||S,J=(N||Ke(o))&&R(o.value)&&R(A)||Ve(o)&&o.value===""||A===""||Array.isArray(A)&&!A.length,ee=Ht.bind(null,M,r,y),be=(k,D,B,H=ie.maxLength,re=ie.minLength)=>{const Q=k?D:B;y[M]={type:k?H:re,message:Q,ref:o,...ee(k?H:re,Q)}};if(n?!Array.isArray(A)||!A.length:p&&(!$&&(J||z(A))||X(A)&&!A||S&&!xt(d).isValid||V&&!kt(d).isValid)){const{value:k,message:D}=Z(p)?{value:!!p,message:p}:oe(p);if(k&&(y[M]={type:ie.required,message:D,ref:W,...ee(ie.required,D)},!r))return f(D),y}if(!J&&(!z(b)||!z(w))){let k,D;const B=oe(w),H=oe(b);if(!z(A)&&!isNaN(A)){const re=o.valueAsNumber||A&&+A;z(B.value)||(k=re>B.value),z(H.value)||(D=re<H.value)}else{const re=o.valueAsDate||new Date(A),Q=ge=>new Date(new Date().toDateString()+" "+ge),ye=o.type=="time",_e=o.type=="week";Z(B.value)&&A&&(k=ye?Q(A)>Q(B.value):_e?A>B.value:re>new Date(B.value)),Z(H.value)&&A&&(D=ye?Q(A)<Q(H.value):_e?A<H.value:re<new Date(H.value))}if((k||D)&&(be(!!k,B.message,H.message,ie.max,ie.min),!r))return f(y[M].message),y}if((x||q)&&!J&&(Z(A)||n&&Array.isArray(A))){const k=oe(x),D=oe(q),B=!z(k.value)&&A.length>+k.value,H=!z(D.value)&&A.length<+D.value;if((B||H)&&(be(B,k.message,D.message),!r))return f(y[M].message),y}if(F&&!J&&Z(A)){const{value:k,message:D}=oe(F);if(Fe(k)&&!A.match(k)&&(y[M]={type:ie.pattern,message:D,ref:o,...ee(ie.pattern,D)},!r))return f(D),y}if(P){if(K(P)){const k=await P(A,e),D=yt(k,W);if(D&&(y[M]={...D,...ee(ie.validate,D.message)},!r))return f(D.message),y}else if(I(P)){let k={};for(const D in P){if(!j(k)&&!r)break;const B=yt(await P[D](A,e),W,D);B&&(k={...B,...ee(D,B.message)},f(B.message),r&&(y[M]=k))}if(!j(k)&&(y[M]={ref:W,...k},!r))return y}}return f(!0),y};const tr={mode:te.onSubmit,reValidateMode:te.onChange,shouldFocusError:!0};function rr(t={}){let i={...tr,...t},e={submitCount:0,isDirty:!1,isReady:!1,isLoading:K(i.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:i.errors||{},disabled:i.disabled||!1},r={},u=I(i.defaultValues)||I(i.values)?U(i.defaultValues||i.values)||{}:{},n=i.shouldUnregister?{}:U(u),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},p,x=0;const q={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={...q};let w={...b};const F={array:nt(),state:nt()},P=i.criteriaMode===te.all,M=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},N=async s=>{if(!o.keepIsValid&&!i.disabled&&(b.isValid||w.isValid||s)){let a;i.resolver?(a=j((await $()).errors),T()):a=await ee(r,!0),a!==e.isValid&&F.state.next({isValid:a})}},T=(s,a)=>{!i.disabled&&(b.isValidating||b.validatingFields||w.isValidating||w.validatingFields)&&((s||Array.from(d.mount)).forEach(l=>{l&&(a?O(e.validatingFields,l,a):L(e.validatingFields,l))}),F.state.next({validatingFields:e.validatingFields,isValidating:!j(e.validatingFields)}))},A=(s,a=[],l,m,_=!0,c=!0)=>{if(m&&l&&!i.disabled){if(o.action=!0,c&&Array.isArray(g(r,s))){const v=l(g(r,s),m.argA,m.argB);_&&O(r,s,v)}if(c&&Array.isArray(g(e.errors,s))){const v=l(g(e.errors,s),m.argA,m.argB);_&&O(e.errors,s,v),er(e.errors,s)}if((b.touchedFields||w.touchedFields)&&c&&Array.isArray(g(e.touchedFields,s))){const v=l(g(e.touchedFields,s),m.argA,m.argB);_&&O(e.touchedFields,s,v)}(b.dirtyFields||w.dirtyFields)&&(e.dirtyFields=ce(u,n)),F.state.next({name:s,isDirty:k(s,a),dirtyFields:e.dirtyFields,errors:e.errors,isValid:e.isValid})}else O(n,s,a)},W=(s,a)=>{O(e.errors,s,a),F.state.next({errors:e.errors})},f=s=>{e.errors=s,F.state.next({errors:e.errors,isValid:!1})},y=(s,a,l,m)=>{const _=g(r,s);if(_){const c=g(n,s,R(l)?g(u,s):l);R(c)||m&&m.defaultChecked||a?O(n,s,a?c:ct(_._f)):H(s,c),o.mount&&!o.action&&N()}},V=(s,a,l,m,_)=>{let c=!1,v=!1;const C={name:s};if(!i.disabled){if(!l||m){(b.isDirty||w.isDirty)&&(v=e.isDirty,e.isDirty=C.isDirty=k(),c=v!==C.isDirty);const E=se(g(u,s),a);v=!!g(e.dirtyFields,s),E?L(e.dirtyFields,s):O(e.dirtyFields,s,!0),C.dirtyFields=e.dirtyFields,c=c||(b.dirtyFields||w.dirtyFields)&&v!==!E}if(l){const E=g(e.touchedFields,s);E||(O(e.touchedFields,s,l),C.touchedFields=e.touchedFields,c=c||(b.touchedFields||w.touchedFields)&&E!==l)}c&&_&&F.state.next(C)}return c?C:{}},S=(s,a,l,m)=>{const _=g(e.errors,s),c=(b.isValid||w.isValid)&&X(a)&&e.isValid!==a;if(i.delayError&&l?(p=M(()=>W(s,l)),p(i.delayError)):(clearTimeout(x),p=null,l?O(e.errors,s,l):L(e.errors,s)),(l?!se(_,l):_)||!j(m)||c){const v={...m,...c&&X(a)?{isValid:a}:{},errors:e.errors,name:s};e={...e,...v},F.state.next(v)}},$=async s=>(T(s,!0),await i.resolver(n,i.context,zt(s||d.mount,r,i.criteriaMode,i.shouldUseNativeValidation))),J=async s=>{const{errors:a}=await $(s);if(T(s),s)for(const l of s){const m=g(a,l);m?O(e.errors,l,m):L(e.errors,l)}else e.errors=a;return a},ee=async(s,a,l={valid:!0})=>{for(const m in s){const _=s[m];if(_){const{_f:c,...v}=_;if(c){const C=d.array.has(c.name),E=_._f&&Yt(_._f);E&&b.validatingFields&&T([c.name],!0);const G=await je(_,d.disabled,n,P,i.shouldUseNativeValidation&&!a,C);if(E&&b.validatingFields&&T([c.name]),G[c.name]&&(l.valid=!1,a||t.shouldUseNativeValidation))break;!a&&(g(G,c.name)?C?wt(e.errors,G,c.name):O(e.errors,c.name,G[c.name]):L(e.errors,c.name))}!j(v)&&await ee(v,a,l)}}return l.valid},be=()=>{for(const s of d.unMount){const a=g(r,s);a&&(a._f.refs?a._f.refs.every(l=>!Oe(l)):!Oe(a._f.ref))&&we(s)}d.unMount=new Set},k=(s,a)=>!i.disabled&&(s&&a&&O(n,s,a),!se(Ye(),u)),D=(s,a,l)=>Pe(s,d,{...o.mount?n:R(a)?u:Z(s)?{[s]:a}:a},l,a),B=s=>xe(g(o.mount?n:u,s,i.shouldUnregister?g(u,s,[]):[])),H=(s,a,l={})=>{const m=g(r,s);let _=a;if(m){const c=m._f;c&&(!c.disabled&&O(n,s,pt(a,c)),_=Ve(c.ref)&&z(a)?"":a,Ft(c.ref)?[...c.ref.options].forEach(v=>v.selected=_.includes(v.value)):c.refs?he(c.ref)?c.refs.forEach(v=>{(!v.defaultChecked||!v.disabled)&&(Array.isArray(_)?v.checked=!!_.find(C=>C===v.value):v.checked=_===v.value||!!_)}):c.refs.forEach(v=>v.checked=v.value===_):Ke(c.ref)?c.ref.value="":(c.ref.value=_,c.ref.type||F.state.next({name:s,values:U(n)})))}(l.shouldDirty||l.shouldTouch)&&V(s,_,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&ge(s)},re=(s,a,l)=>{for(const m in a){if(!a.hasOwnProperty(m))return;const _=a[m],c=s+"."+m,v=g(r,c);(d.array.has(s)||I(_)||v&&!v._f)&&!le(_)?re(c,_,l):H(c,_,l)}},Q=(s,a,l={})=>{const m=g(r,s),_=d.array.has(s),c=U(a);O(n,s,c),_?(F.array.next({name:s,values:U(n)}),(b.isDirty||b.dirtyFields||w.isDirty||w.dirtyFields)&&l.shouldDirty&&F.state.next({name:s,dirtyFields:ce(u,n),isDirty:k(s,c)})):m&&!m._f&&!z(c)?re(s,c,l):H(s,c,l),He(s,d)?F.state.next({...e,name:s,values:U(n)}):F.state.next({name:o.mount?s:void 0,values:U(n)})},ye=async s=>{o.mount=!0;const a=s.target;let l=a.name,m=!0;const _=g(r,l),c=E=>{m=Number.isNaN(E)||le(E)&&isNaN(E.getTime())||se(E,g(n,l,E))},v=de(i.mode),C=de(i.reValidateMode);if(_){let E,G;const ue=a.type?ct(_._f):mt(s),ae=s.type===ve.BLUR||s.type===ve.FOCUS_OUT,Mt=!Jt(_._f)&&!i.resolver&&!g(e.errors,l)&&!_._f.deps||Zt(ae,g(e.touchedFields,l),e.isSubmitted,C,v),Ce=He(l,d,ae);O(n,l,ue),ae?(!a||!a.readOnly)&&(_._f.onBlur&&_._f.onBlur(s),p&&p(0)):_._f.onChange&&_._f.onChange(s);const Ee=V(l,ue,ae),Tt=!j(Ee)||Ce;if(!ae&&F.state.next({name:l,type:s.type,values:U(n)}),Mt)return(b.isValid||w.isValid)&&(i.mode==="onBlur"?ae&&N():ae||N()),Tt&&F.state.next({name:l,...Ce?{}:Ee});if(!ae&&Ce&&F.state.next({...e}),i.resolver){const{errors:it}=await $([l]);if(T([l]),c(ue),m){const Lt=ft(e.errors,r,l),at=ft(it,r,Lt.name||l);E=at.error,l=at.name,G=j(it)}}else T([l],!0),E=(await je(_,d.disabled,n,P,i.shouldUseNativeValidation))[l],T([l]),c(ue),m&&(E?G=!1:(b.isValid||w.isValid)&&(G=await ee(r,!0)));m&&(_._f.deps&&(!Array.isArray(_._f.deps)||_._f.deps.length>0)&&ge(_._f.deps),S(l,G,E,Ee))}},_e=(s,a)=>{if(g(e.errors,a)&&s.focus)return s.focus(),1},ge=async(s,a={})=>{let l,m;const _=Y(s);if(i.resolver){const c=await J(R(s)?s:_);l=j(c),m=s?!_.some(v=>g(c,v)):l}else s?(m=(await Promise.all(_.map(async c=>{const v=g(r,c);return await ee(v&&v._f?{[c]:v}:v)}))).every(Boolean),!(!m&&!e.isValid)&&N()):m=l=await ee(r);return F.state.next({...!Z(s)||(b.isValid||w.isValid)&&l!==e.isValid?{}:{name:s},...i.resolver||!s?{isValid:l}:{},errors:e.errors}),a.shouldFocus&&!m&&fe(r,_e,s?_:d.mount),m},Ye=(s,a)=>{let l={...o.mount?n:u};return a&&(l=Vt(a.dirtyFields?e.dirtyFields:e.touchedFields,l)),R(s)?l:Z(s)?g(l,s):s.map(m=>g(l,m))},Je=(s,a)=>({invalid:!!g((a||e).errors,s),isDirty:!!g((a||e).dirtyFields,s),error:g((a||e).errors,s),isValidating:!!g(e.validatingFields,s),isTouched:!!g((a||e).touchedFields,s)}),St=s=>{s&&Y(s).forEach(a=>L(e.errors,a)),F.state.next({errors:s?e.errors:{}})},Qe=(s,a,l)=>{const m=(g(r,s,{_f:{}})._f||{}).ref,_=g(e.errors,s)||{},{ref:c,message:v,type:C,...E}=_;O(e.errors,s,{...E,...a,ref:m}),F.state.next({name:s,errors:e.errors,isValid:!1}),l&&l.shouldFocus&&m&&m.focus&&m.focus()},Dt=(s,a)=>K(s)?F.state.subscribe({next:l=>"values"in l&&s(D(void 0,a),l)}):D(s,a,!0),Xe=s=>F.state.subscribe({next:a=>{Xt(s.name,a.name,s.exact)&&Qt(a,s.formState||b,Ut,s.reRenderRoot)&&s.callback({values:{...n},...e,...a,defaultValues:u})}}).unsubscribe,Ct=s=>(o.mount=!0,w={...w,...s.formState},Xe({...s,formState:{...q,...s.formState}})),we=(s,a={})=>{for(const l of s?Y(s):d.mount)d.mount.delete(l),d.array.delete(l),a.keepValue||(L(r,l),L(n,l)),!a.keepError&&L(e.errors,l),!a.keepDirty&&L(e.dirtyFields,l),!a.keepTouched&&L(e.touchedFields,l),!a.keepIsValidating&&L(e.validatingFields,l),!i.shouldUnregister&&!a.keepDefaultValue&&L(u,l);F.state.next({values:U(n)}),F.state.next({...e,...a.keepDirty?{isDirty:k()}:{}}),!a.keepIsValid&&N()},Ze=({disabled:s,name:a})=>{if(X(s)&&o.mount||s||d.disabled.has(a)){const _=d.disabled.has(a)!==!!s;s?d.disabled.add(a):d.disabled.delete(a),_&&o.mount&&!o.action&&N()}},Se=(s,a={})=>{let l=g(r,s);const m=X(a.disabled)||X(i.disabled);return O(r,s,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),l?Ze({disabled:X(a.disabled)?a.disabled:i.disabled,name:s}):y(s,!0,a.value),{...m?{disabled:a.disabled||i.disabled}:{},...i.progressive?{required:!!a.required,min:me(a.min),max:me(a.max),minLength:me(a.minLength),maxLength:me(a.maxLength),pattern:me(a.pattern)}:{},name:s,onChange:ye,onBlur:ye,ref:_=>{if(_){Se(s,a),l=g(r,s);const c=R(_.value)&&_.querySelectorAll&&_.querySelectorAll("input,select,textarea")[0]||_,v=jt(c),C=l._f.refs||[];if(v?C.find(E=>E===c):c===l._f.ref)return;O(r,s,{_f:{...l._f,...v?{refs:[...C.filter(Oe),c,...Array.isArray(g(u,s))?[{}]:[]],ref:{type:c.type,name:s}}:{ref:c}}}),y(s,!1,void 0,c)}else l=g(r,s,{}),l._f&&(l._f.mount=!1),(i.shouldUnregister||a.shouldUnregister)&&!(ht(d.array,s)&&o.action)&&d.unMount.add(s)}}},De=()=>i.shouldFocusError&&fe(r,_e,d.mount),Et=s=>{X(s)&&(F.state.next({disabled:s}),fe(r,(a,l)=>{const m=g(r,l);m&&(a.disabled=m._f.disabled||s,Array.isArray(m._f.refs)&&m._f.refs.forEach(_=>{_.disabled=m._f.disabled||s}))},0,!1))},et=(s,a)=>async l=>{let m;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let _=U(n);if(F.state.next({isSubmitting:!0}),i.resolver){const{errors:c,values:v}=await $();T(),e.errors=c,_=U(v)}else await ee(r);if(d.disabled.size)for(const c of d.disabled)L(_,c);if(L(e.errors,"root"),j(e.errors)){F.state.next({errors:{}});try{await s(_,l)}catch(c){m=c}}else a&&await a({...e.errors},l),De(),setTimeout(De);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:j(e.errors)&&!m,submitCount:e.submitCount+1,errors:e.errors}),m)throw m},Ot=(s,a={})=>{g(r,s)&&(R(a.defaultValue)?Q(s,U(g(u,s))):(Q(s,a.defaultValue),O(u,s,U(a.defaultValue))),a.keepTouched||L(e.touchedFields,s),a.keepDirty||(L(e.dirtyFields,s),e.isDirty=a.defaultValue?k(s,U(g(u,s))):k()),a.keepError||(L(e.errors,s),b.isValid&&N()),F.state.next({...e}))},tt=(s,a={})=>{const l=s?U(s):u,m=U(l),_=j(s),c=_?u:m;if(a.keepDefaultValues||(u=l),!a.keepValues){if(a.keepDirtyValues){const v=new Set([...d.mount,...Object.keys(ce(u,n))]);for(const C of Array.from(v)){const E=g(e.dirtyFields,C),G=g(n,C),ue=g(c,C);E&&!R(G)?O(c,C,G):!E&&!R(ue)&&Q(C,ue)}}else{if($e&&R(s))for(const v of d.mount){const C=g(r,v);if(C&&C._f){const E=Array.isArray(C._f.refs)?C._f.refs[0]:C._f.ref;if(Ve(E)){const G=E.closest("form");if(G){G.reset();break}}}}if(a.keepFieldsRef)for(const v of d.mount)Q(v,g(c,v));else r={}}n=i.shouldUnregister?a.keepDefaultValues?U(u):{}:U(c),F.array.next({values:{...c}}),F.state.next({values:{...c}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!b.isValid||!!a.keepIsValid||!!a.keepDirtyValues||!i.shouldUnregister&&!j(c),o.watch=!!i.shouldUnregister,o.keepIsValid=!!a.keepIsValid,o.action=!1,a.keepErrors||(e.errors={}),F.state.next({submitCount:a.keepSubmitCount?e.submitCount:0,isDirty:_?!1:a.keepDirty?e.isDirty:!!(a.keepDefaultValues&&!se(s,u)),isSubmitted:a.keepIsSubmitted?e.isSubmitted:!1,dirtyFields:_?{}:a.keepDirtyValues?a.keepDefaultValues&&n?ce(u,n):e.dirtyFields:a.keepDefaultValues&&s?ce(u,s):a.keepDirty?e.dirtyFields:{},touchedFields:a.keepTouched?e.touchedFields:{},errors:a.keepErrors?e.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?e.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:u})},rt=(s,a)=>tt(K(s)?s(n):s,{...i.resetOptions,...a}),Rt=(s,a={})=>{const l=g(r,s),m=l&&l._f;if(m){const _=m.refs?m.refs[0]:m.ref;_.focus&&setTimeout(()=>{_.focus(),a.shouldSelect&&K(_.select)&&_.select()})}},Ut=s=>{e={...e,...s}},st={control:{register:Se,unregister:we,getFieldState:Je,handleSubmit:et,setError:Qe,_subscribe:Xe,_runSchema:$,_updateIsValidating:T,_focusError:De,_getWatch:D,_getDirty:k,_setValid:N,_setFieldArray:A,_setDisabledField:Ze,_setErrors:f,_getFieldArray:B,_reset:tt,_resetDefaultValues:()=>K(i.defaultValues)&&i.defaultValues().then(s=>{rt(s,i.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:be,_disableForm:Et,_subjects:F,_proxyFormState:b,get _fields(){return r},get _formValues(){return n},get _state(){return o},set _state(s){o=s},get _defaultValues(){return u},get _names(){return d},set _names(s){d=s},get _formState(){return e},get _options(){return i},set _options(s){i={...i,...s}}},subscribe:Ct,trigger:ge,register:Se,handleSubmit:et,watch:Dt,setValue:Q,getValues:Ye,reset:rt,resetField:Ot,clearErrors:St,unregister:we,setError:Qe,setFocus:Rt,getFieldState:Je};return{...st,formControl:st}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const t=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const e=(Math.random()*16+t)%16|0;return(i=="x"?e:e&3|8).toString(16)})},Re=(t,i,e={})=>e.shouldFocus||R(e.shouldFocus)?e.focusName||`${t}.${R(e.focusIndex)?i:e.focusIndex}.`:"",Ue=(t,i)=>[...t,...Y(i)],Me=t=>Array.isArray(t)?t.map(()=>{}):void 0;function Te(t,i,e){return[...t.slice(0,i),...Y(e),...t.slice(i)]}var Le=(t,i,e)=>Array.isArray(t)?(R(t[e])&&(t[e]=void 0),t.splice(e,0,t.splice(i,1)[0]),t):[],Ie=(t,i)=>[...Y(i),...Y(t)];function sr(t,i){let e=0;const r=[...t];for(const u of i)r.splice(u-e,1),e++;return xe(r).length?r:[]}var Ne=(t,i)=>R(i)?[]:sr(t,Y(i).sort((e,r)=>e-r)),Be=(t,i,e)=>{[t[i],t[e]]=[t[e],t[i]]},_t=(t,i,e)=>(t[i]=e,t);function ur(t){const i=pe(),{control:e=i,name:r,keyName:u="id",shouldUnregister:n,rules:o}=t,[d,p]=h.useState(e._getFieldArray(r)),x=h.useRef(e._getFieldArray(r).map(ne)),q=h.useRef(!1);e._names.array.add(r),h.useMemo(()=>o&&d.length>=0&&e.register(r,o),[e,r,d.length,o]),ke(()=>e._subjects.array.subscribe({next:({values:f,name:y})=>{if(y===r||!y){const V=g(f,r);Array.isArray(V)&&(p(V),x.current=V.map(ne))}}}).unsubscribe,[e,r]);const b=h.useCallback(f=>{q.current=!0,e._setFieldArray(r,f)},[e,r]),w=(f,y)=>{const V=Y(U(f)),S=Ue(e._getFieldArray(r),V);e._names.focus=Re(r,S.length-1,y),x.current=Ue(x.current,V.map(ne)),b(S),p(S),e._setFieldArray(r,S,Ue,{argA:Me(f)})},F=(f,y)=>{const V=Y(U(f)),S=Ie(e._getFieldArray(r),V);e._names.focus=Re(r,0,y),x.current=Ie(x.current,V.map(ne)),b(S),p(S),e._setFieldArray(r,S,Ie,{argA:Me(f)})},P=f=>{const y=Ne(e._getFieldArray(r),f);x.current=Ne(x.current,f),b(y),p(y),!Array.isArray(g(e._fields,r))&&O(e._fields,r,void 0),e._setFieldArray(r,y,Ne,{argA:f})},M=(f,y,V)=>{const S=Y(U(y)),$=Te(e._getFieldArray(r),f,S);e._names.focus=Re(r,f,V),x.current=Te(x.current,f,S.map(ne)),b($),p($),e._setFieldArray(r,$,Te,{argA:f,argB:Me(y)})},N=(f,y)=>{const V=e._getFieldArray(r);Be(V,f,y),Be(x.current,f,y),b(V),p(V),e._setFieldArray(r,V,Be,{argA:f,argB:y},!1)},T=(f,y)=>{const V=e._getFieldArray(r);Le(V,f,y),Le(x.current,f,y),b(V),p(V),e._setFieldArray(r,V,Le,{argA:f,argB:y},!1)},A=(f,y)=>{const V=U(y),S=_t(e._getFieldArray(r),f,V);x.current=[...S].map(($,J)=>!$||J===f?ne():x.current[J]),b(S),p([...S]),e._setFieldArray(r,S,_t,{argA:f,argB:V},!0,!1)},W=f=>{const y=Y(U(f));x.current=y.map(ne),b([...y]),p([...y]),e._setFieldArray(r,[...y],V=>V,{},!0,!1)};return h.useEffect(()=>{if(e._state.action=!1,He(r,e._names)&&e._subjects.state.next({...e._formState}),q.current&&(!de(e._options.mode).isOnSubmit||e._formState.isSubmitted)&&!de(e._options.reValidateMode).isOnSubmit)if(e._options.resolver)e._runSchema([r]).then(f=>{e._updateIsValidating([r]);const y=g(f.errors,r),V=g(e._formState.errors,r);(V?!y&&V.type||y&&(V.type!==y.type||V.message!==y.message):y&&y.type)&&(y?O(e._formState.errors,r,y):L(e._formState.errors,r),e._subjects.state.next({errors:e._formState.errors}))});else{const f=g(e._fields,r);f&&f._f&&!(de(e._options.reValidateMode).isOnSubmit&&de(e._options.mode).isOnSubmit)&&je(f,e._names.disabled,e._formValues,e._options.criteriaMode===te.all,e._options.shouldUseNativeValidation,!0).then(y=>!j(y)&&e._subjects.state.next({errors:wt(e._formState.errors,y,r)}))}e._subjects.state.next({name:r,values:U(e._formValues)}),e._names.focus&&fe(e._fields,(f,y)=>{if(e._names.focus&&y.startsWith(e._names.focus)&&f.focus)return f.focus(),1}),e._names.focus="",e._setValid(),q.current=!1},[d,r,e]),h.useEffect(()=>(!g(e._formValues,r)&&e._setFieldArray(r),()=>{const f=(y,V)=>{const S=g(e._fields,y);S&&S._f&&(S._f.mount=V)};e._options.shouldUnregister||n?e.unregister(r):f(r,!1)}),[r,e,u,n]),{swap:h.useCallback(N,[b,r,e]),move:h.useCallback(T,[b,r,e]),prepend:h.useCallback(F,[b,r,e]),append:h.useCallback(w,[b,r,e]),remove:h.useCallback(P,[b,r,e]),insert:h.useCallback(M,[b,r,e]),update:h.useCallback(A,[b,r,e]),replace:h.useCallback(W,[b,r,e]),fields:h.useMemo(()=>d.map((f,y)=>({...f,[u]:x.current[y]||ne()})),[d,u])}}function lr(t={}){const i=h.useRef(void 0),e=h.useRef(void 0),[r,u]=h.useState({isDirty:!1,isValidating:!1,isLoading:K(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:K(t.defaultValues)?void 0:t.defaultValues});if(!i.current)if(t.formControl)i.current={...t.formControl,formState:r},t.defaultValues&&!K(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...d}=rr(t);i.current={...d,formState:r}}const n=i.current.control;return n._options=t,ke(()=>{const o=n._subscribe({formState:n._proxyFormState,callback:()=>u({...n._formState}),reRenderRoot:!0});return u(d=>({...d,isReady:!0})),n._formState.isReady=!0,o},[n]),h.useEffect(()=>n._disableForm(t.disabled),[n,t.disabled]),h.useEffect(()=>{t.mode&&(n._options.mode=t.mode),t.reValidateMode&&(n._options.reValidateMode=t.reValidateMode)},[n,t.mode,t.reValidateMode]),h.useEffect(()=>{t.errors&&(n._setErrors(t.errors),n._focusError())},[n,t.errors]),h.useEffect(()=>{t.shouldUnregister&&n._subjects.state.next({values:n._getWatch()})},[n,t.shouldUnregister]),h.useEffect(()=>{if(n._proxyFormState.isDirty){const o=n._getDirty();o!==r.isDirty&&n._subjects.state.next({isDirty:o})}},[n,r.isDirty]),h.useEffect(()=>{var o;t.values&&!se(t.values,e.current)?(n._reset(t.values,{keepFieldsRef:!0,...n._options.resetOptions}),!((o=n._options.resetOptions)===null||o===void 0)&&o.keepIsValid||n._setValid(),e.current=t.values,u(d=>({...d}))):n._resetDefaultValues()},[n,t.values]),h.useEffect(()=>{n._state.mount||(n._setValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),i.current.formState=h.useMemo(()=>vt(r,n),[n,r]),i.current}export{nr as C,Pt as a,ur as b,lr as u};
|
|
1
|
+
import{U as h}from"./index-CP8e2zcP.js";var he=t=>t.type==="checkbox",le=t=>t instanceof Date,z=t=>t==null;const gt=t=>typeof t=="object";var I=t=>!z(t)&&!Array.isArray(t)&>(t)&&!le(t),mt=t=>I(t)&&t.target?he(t.target)?t.target.checked:t.target.value:t,It=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ht=(t,i)=>t.has(It(i)),Nt=t=>{const i=t.constructor&&t.constructor.prototype;return I(i)&&i.hasOwnProperty("isPrototypeOf")},$e=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function U(t){if(t instanceof Date)return new Date(t);const i=typeof FileList<"u"&&t instanceof FileList;if($e&&(t instanceof Blob||i))return t;const e=Array.isArray(t);if(!e&&!(I(t)&&Nt(t)))return t;const r=e?[]:Object.create(Object.getPrototypeOf(t));for(const u in t)Object.prototype.hasOwnProperty.call(t,u)&&(r[u]=U(t[u]));return r}var Ae=t=>/^\w*$/.test(t),R=t=>t===void 0,xe=t=>Array.isArray(t)?t.filter(Boolean):[],Ge=t=>xe(t.replace(/["|']|\]/g,"").split(/\.|\[/)),g=(t,i,e)=>{if(!i||!I(t))return e;const r=(Ae(i)?[i]:Ge(i)).reduce((u,n)=>z(u)?u:u[n],t);return R(r)||r===t?R(t[i])?e:t[i]:r},X=t=>typeof t=="boolean",K=t=>typeof t=="function",O=(t,i,e)=>{let r=-1;const u=Ae(i)?[i]:Ge(i),n=u.length,o=n-1;for(;++r<n;){const d=u[r];let p=e;if(r!==o){const x=t[d];p=I(x)||Array.isArray(x)?x:isNaN(+u[r+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;t[d]=p,t=t[d]}};const ve={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},te={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"},bt=h.createContext(null);bt.displayName="HookFormControlContext";const pe=()=>h.useContext(bt);var vt=(t,i,e,r=!0)=>{const u={defaultValues:i._defaultValues};for(const n in t)Object.defineProperty(u,n,{get:()=>{const o=n;return i._proxyFormState[o]!==te.all&&(i._proxyFormState[o]=!r||te.all),e&&(e[o]=!0),t[o]}});return u};const ke=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Bt(t){const i=pe(),{control:e=i,disabled:r,name:u,exact:n}=t||{},[o,d]=h.useState(e._formState),p=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ke(()=>e._subscribe({name:u,formState:p.current,exact:n,callback:x=>{!r&&d({...e._formState,...x})}}),[u,r,n]),h.useEffect(()=>{p.current.isValid&&e._setValid(!0)},[e]),h.useMemo(()=>vt(o,e,p.current,!1),[o,e])}var Z=t=>typeof t=="string",Pe=(t,i,e,r,u)=>Z(t)?(r&&i.watch.add(t),g(e,t,u)):Array.isArray(t)?t.map(n=>(r&&i.watch.add(n),g(e,n))):(r&&(i.watchAll=!0),e),We=t=>z(t)||!gt(t);function se(t,i,e=new WeakSet){if(We(t)||We(i))return Object.is(t,i);if(le(t)&&le(i))return Object.is(t.getTime(),i.getTime());const r=Object.keys(t),u=Object.keys(i);if(r.length!==u.length)return!1;if(e.has(t)||e.has(i))return!0;e.add(t),e.add(i);for(const n of r){const o=t[n];if(!u.includes(n))return!1;if(n!=="ref"){const d=i[n];if(le(o)&&le(d)||I(o)&&I(d)||Array.isArray(o)&&Array.isArray(d)?!se(o,d,e):!Object.is(o,d))return!1}}return!0}function Pt(t){const i=pe(),{control:e=i,name:r,defaultValue:u,disabled:n,exact:o,compute:d}=t||{},p=h.useRef(u),x=h.useRef(d),q=h.useRef(void 0),b=h.useRef(e),w=h.useRef(r);x.current=d;const[F,P]=h.useState(()=>{const f=e._getWatch(r,p.current);return x.current?x.current(f):f}),M=h.useCallback(f=>{const y=Pe(r,e._names,f||e._formValues,!1,p.current);return x.current?x.current(y):y},[e._formValues,e._names,r]),N=h.useCallback(f=>{if(!n){const y=Pe(r,e._names,f||e._formValues,!1,p.current);if(x.current){const V=x.current(y);se(V,q.current)||(P(V),q.current=V)}else P(y)}},[e._formValues,e._names,n,r]);ke(()=>((b.current!==e||!se(w.current,r))&&(b.current=e,w.current=r,N()),e._subscribe({name:r,formState:{values:!0},exact:o,callback:f=>{N(f.values)}})),[e,o,r,N]),h.useEffect(()=>e._removeUnmounted());const T=b.current!==e,A=w.current,W=h.useMemo(()=>{if(n)return null;const f=!T&&!se(A,r);return T||f?M():null},[n,T,r,A,M]);return W!==null?W:F}function Wt(t){const i=pe(),{name:e,disabled:r,control:u=i,shouldUnregister:n,defaultValue:o,exact:d=!0}=t,p=ht(u._names.array,e),x=h.useMemo(()=>g(u._formValues,e,g(u._defaultValues,e,o)),[u,e,o]),q=Pt({control:u,name:e,defaultValue:x,exact:d}),b=Bt({control:u,name:e,exact:d}),w=h.useRef(t),F=h.useRef(void 0),P=h.useRef(u.register(e,{...t.rules,value:q,...X(t.disabled)?{disabled:t.disabled}:{}}));w.current=t;const M=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(b.errors,e)},isDirty:{enumerable:!0,get:()=>!!g(b.dirtyFields,e)},isTouched:{enumerable:!0,get:()=>!!g(b.touchedFields,e)},isValidating:{enumerable:!0,get:()=>!!g(b.validatingFields,e)},error:{enumerable:!0,get:()=>g(b.errors,e)}}),[b,e]),N=h.useCallback(f=>P.current.onChange({target:{value:mt(f),name:e},type:ve.CHANGE}),[e]),T=h.useCallback(()=>P.current.onBlur({target:{value:g(u._formValues,e),name:e},type:ve.BLUR}),[e,u._formValues]),A=h.useCallback(f=>{const y=g(u._fields,e);y&&y._f&&f&&(y._f.ref={focus:()=>K(f.focus)&&f.focus(),select:()=>K(f.select)&&f.select(),setCustomValidity:V=>K(f.setCustomValidity)&&f.setCustomValidity(V),reportValidity:()=>K(f.reportValidity)&&f.reportValidity()})},[u._fields,e]),W=h.useMemo(()=>({name:e,value:q,...X(r)||b.disabled?{disabled:b.disabled||r}:{},onChange:N,onBlur:T,ref:A}),[e,r,b.disabled,N,T,A,q]);return h.useEffect(()=>{const f=u._options.shouldUnregister||n,y=F.current;y&&y!==e&&!p&&u.unregister(y),u.register(e,{...w.current.rules,...X(w.current.disabled)?{disabled:w.current.disabled}:{}});const V=(S,$)=>{const J=g(u._fields,S);J&&J._f&&(J._f.mount=$)};if(V(e,!0),f){const S=U(g(u._options.defaultValues,e,w.current.defaultValue));O(u._defaultValues,e,S),R(g(u._formValues,e))&&O(u._formValues,e,S)}return!p&&u.register(e),F.current=e,()=>{(p?f&&!u._state.action:f)?u.unregister(e):V(e,!1)}},[e,u,p,n]),h.useEffect(()=>{u._setDisabledField({disabled:r,name:e})},[r,e,u]),h.useMemo(()=>({field:W,formState:b,fieldState:M}),[W,b,M])}const nr=t=>t.render(Wt(t)),qt=h.createContext(null);qt.displayName="HookFormContext";var Ht=(t,i,e,r,u)=>i?{...e[t],types:{...e[t]&&e[t].types?e[t].types:{},[r]:u||!0}}:{},Y=t=>Array.isArray(t)?t:[t],nt=()=>{let t=[];return{get observers(){return t},next:u=>{for(const n of t)n.next&&n.next(u)},subscribe:u=>(t.push(u),{unsubscribe:()=>{t=t.filter(n=>n!==u)}}),unsubscribe:()=>{t=[]}}};function Vt(t,i){const e={};for(const r in t)if(t.hasOwnProperty(r)){const u=t[r],n=i[r];if(u&&I(u)&&n){const o=Vt(u,n);I(o)&&(e[r]=o)}else t[r]&&(e[r]=n)}return e}var j=t=>I(t)&&!Object.keys(t).length,Ke=t=>t.type==="file",Ve=t=>{if(!$e)return!1;const i=t?t.ownerDocument:0;return t instanceof(i&&i.defaultView?i.defaultView.HTMLElement:HTMLElement)},Ft=t=>t.type==="select-multiple",ze=t=>t.type==="radio",jt=t=>ze(t)||he(t),Oe=t=>Ve(t)&&t.isConnected;function $t(t,i){const e=i.slice(0,-1).length;let r=0;for(;r<e;)t=R(t)?r++:t[i[r++]];return t}function Gt(t){for(const i in t)if(t.hasOwnProperty(i)&&!R(t[i]))return!1;return!0}function L(t,i){const e=Array.isArray(i)?i:Ae(i)?[i]:Ge(i),r=e.length===1?t:$t(t,e),u=e.length-1,n=e[u];return r&&delete r[n],u!==0&&(I(r)&&j(r)||Array.isArray(r)&&Gt(r))&&L(t,e.slice(0,-1)),t}var Kt=t=>{for(const i in t)if(K(t[i]))return!0;return!1};function At(t){return Array.isArray(t)||I(t)&&!Kt(t)}function qe(t,i={}){for(const e in t){const r=t[e];At(r)?(i[e]=Array.isArray(r)?[]:{},qe(r,i[e])):R(r)||(i[e]=!0)}return i}function ce(t,i,e){e||(e=qe(i));for(const r in t){const u=t[r];if(At(u))R(i)||We(e[r])?e[r]=qe(u,Array.isArray(u)?[]:{}):ce(u,z(i)?{}:i[r],e[r]);else{const n=i[r];e[r]=!se(u,n)}}return e}const ut={value:!1,isValid:!1},lt={value:!0,isValid:!0};var xt=t=>{if(Array.isArray(t)){if(t.length>1){const i=t.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:i,isValid:!!i.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!R(t[0].attributes.value)?R(t[0].value)||t[0].value===""?lt:{value:t[0].value,isValid:!0}:lt:ut}return ut},pt=(t,{valueAsNumber:i,valueAsDate:e,setValueAs:r})=>R(t)?t:i?t===""?NaN:t&&+t:e&&Z(t)?new Date(t):r?r(t):t;const ot={isValid:!1,value:null};var kt=t=>Array.isArray(t)?t.reduce((i,e)=>e&&e.checked&&!e.disabled?{isValid:!0,value:e.value}:i,ot):ot;function ct(t){const i=t.ref;return Ke(i)?i.files:ze(i)?kt(t.refs).value:Ft(i)?[...i.selectedOptions].map(({value:e})=>e):he(i)?xt(t.refs).value:pt(R(i.value)?t.ref.value:i.value,t)}var zt=(t,i,e,r)=>{const u={};for(const n of t){const o=g(i,n);o&&O(u,n,o._f)}return{criteriaMode:e,names:[...t],fields:u,shouldUseNativeValidation:r}},Fe=t=>t instanceof RegExp,me=t=>R(t)?t:Fe(t)?t.source:I(t)?Fe(t.value)?t.value.source:t.value:t,de=t=>({isOnSubmit:!t||t===te.onSubmit,isOnBlur:t===te.onBlur,isOnChange:t===te.onChange,isOnAll:t===te.all,isOnTouch:t===te.onTouched});const dt="AsyncFunction";var Yt=t=>!!t&&!!t.validate&&!!(K(t.validate)&&t.validate.constructor.name===dt||I(t.validate)&&Object.values(t.validate).find(i=>i.constructor.name===dt)),Jt=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),He=(t,i,e)=>!e&&(i.watchAll||i.watch.has(t)||[...i.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const fe=(t,i,e,r)=>{for(const u of e||Object.keys(t)){const n=g(t,u);if(n){const{_f:o,...d}=n;if(o){if(o.refs&&o.refs[0]&&i(o.refs[0],u)&&!r)return!0;if(o.ref&&i(o.ref,o.name)&&!r)return!0;if(fe(d,i))break}else if(I(d)&&fe(d,i))break}}};function ft(t,i,e){const r=g(t,e);if(r||Ae(e))return{error:r,name:e};const u=e.split(".");for(;u.length;){const n=u.join("."),o=g(i,n),d=g(t,n);if(o&&!Array.isArray(o)&&e!==n)return{name:e};if(d&&d.type)return{name:n,error:d};if(d&&d.root&&d.root.type)return{name:`${n}.root`,error:d.root};u.pop()}return{name:e}}var Qt=(t,i,e,r)=>{e(t);const{name:u,...n}=t;return j(n)||Object.keys(n).length>=Object.keys(i).length||Object.keys(n).find(o=>i[o]===(!r||te.all))},Xt=(t,i,e)=>!t||!i||t===i||Y(t).some(r=>r&&(e?r===i:r.startsWith(i)||i.startsWith(r))),Zt=(t,i,e,r,u)=>u.isOnAll?!1:!e&&u.isOnTouch?!(i||t):(e?r.isOnBlur:u.isOnBlur)?!t:(e?r.isOnChange:u.isOnChange)?t:!0,er=(t,i)=>!xe(g(t,i)).length&&L(t,i),wt=(t,i,e)=>{const r=Y(g(t,e));return O(r,"root",i[e]),O(t,e,r),t};function yt(t,i,e="validate"){if(Z(t)||Array.isArray(t)&&t.every(Z)||X(t)&&!t)return{type:e,message:Z(t)?t:"",ref:i}}var oe=t=>I(t)&&!Fe(t)?t:{value:t,message:""},je=async(t,i,e,r,u,n)=>{const{ref:o,refs:d,required:p,maxLength:x,minLength:q,min:b,max:w,pattern:F,validate:P,name:M,valueAsNumber:N,mount:T}=t._f,A=g(e,M);if(!T||i.has(M))return{};const W=d?d[0]:o,f=k=>{u&&W.reportValidity&&(W.setCustomValidity(X(k)?"":k||""),W.reportValidity())},y={},V=ze(o),S=he(o),$=V||S,J=(N||Ke(o))&&R(o.value)&&R(A)||Ve(o)&&o.value===""||A===""||Array.isArray(A)&&!A.length,ee=Ht.bind(null,M,r,y),be=(k,D,B,H=ie.maxLength,re=ie.minLength)=>{const Q=k?D:B;y[M]={type:k?H:re,message:Q,ref:o,...ee(k?H:re,Q)}};if(n?!Array.isArray(A)||!A.length:p&&(!$&&(J||z(A))||X(A)&&!A||S&&!xt(d).isValid||V&&!kt(d).isValid)){const{value:k,message:D}=Z(p)?{value:!!p,message:p}:oe(p);if(k&&(y[M]={type:ie.required,message:D,ref:W,...ee(ie.required,D)},!r))return f(D),y}if(!J&&(!z(b)||!z(w))){let k,D;const B=oe(w),H=oe(b);if(!z(A)&&!isNaN(A)){const re=o.valueAsNumber||A&&+A;z(B.value)||(k=re>B.value),z(H.value)||(D=re<H.value)}else{const re=o.valueAsDate||new Date(A),Q=ge=>new Date(new Date().toDateString()+" "+ge),ye=o.type=="time",_e=o.type=="week";Z(B.value)&&A&&(k=ye?Q(A)>Q(B.value):_e?A>B.value:re>new Date(B.value)),Z(H.value)&&A&&(D=ye?Q(A)<Q(H.value):_e?A<H.value:re<new Date(H.value))}if((k||D)&&(be(!!k,B.message,H.message,ie.max,ie.min),!r))return f(y[M].message),y}if((x||q)&&!J&&(Z(A)||n&&Array.isArray(A))){const k=oe(x),D=oe(q),B=!z(k.value)&&A.length>+k.value,H=!z(D.value)&&A.length<+D.value;if((B||H)&&(be(B,k.message,D.message),!r))return f(y[M].message),y}if(F&&!J&&Z(A)){const{value:k,message:D}=oe(F);if(Fe(k)&&!A.match(k)&&(y[M]={type:ie.pattern,message:D,ref:o,...ee(ie.pattern,D)},!r))return f(D),y}if(P){if(K(P)){const k=await P(A,e),D=yt(k,W);if(D&&(y[M]={...D,...ee(ie.validate,D.message)},!r))return f(D.message),y}else if(I(P)){let k={};for(const D in P){if(!j(k)&&!r)break;const B=yt(await P[D](A,e),W,D);B&&(k={...B,...ee(D,B.message)},f(B.message),r&&(y[M]=k))}if(!j(k)&&(y[M]={ref:W,...k},!r))return y}}return f(!0),y};const tr={mode:te.onSubmit,reValidateMode:te.onChange,shouldFocusError:!0};function rr(t={}){let i={...tr,...t},e={submitCount:0,isDirty:!1,isReady:!1,isLoading:K(i.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:i.errors||{},disabled:i.disabled||!1},r={},u=I(i.defaultValues)||I(i.values)?U(i.defaultValues||i.values)||{}:{},n=i.shouldUnregister?{}:U(u),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},p,x=0;const q={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},b={...q};let w={...b};const F={array:nt(),state:nt()},P=i.criteriaMode===te.all,M=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},N=async s=>{if(!o.keepIsValid&&!i.disabled&&(b.isValid||w.isValid||s)){let a;i.resolver?(a=j((await $()).errors),T()):a=await ee(r,!0),a!==e.isValid&&F.state.next({isValid:a})}},T=(s,a)=>{!i.disabled&&(b.isValidating||b.validatingFields||w.isValidating||w.validatingFields)&&((s||Array.from(d.mount)).forEach(l=>{l&&(a?O(e.validatingFields,l,a):L(e.validatingFields,l))}),F.state.next({validatingFields:e.validatingFields,isValidating:!j(e.validatingFields)}))},A=(s,a=[],l,m,_=!0,c=!0)=>{if(m&&l&&!i.disabled){if(o.action=!0,c&&Array.isArray(g(r,s))){const v=l(g(r,s),m.argA,m.argB);_&&O(r,s,v)}if(c&&Array.isArray(g(e.errors,s))){const v=l(g(e.errors,s),m.argA,m.argB);_&&O(e.errors,s,v),er(e.errors,s)}if((b.touchedFields||w.touchedFields)&&c&&Array.isArray(g(e.touchedFields,s))){const v=l(g(e.touchedFields,s),m.argA,m.argB);_&&O(e.touchedFields,s,v)}(b.dirtyFields||w.dirtyFields)&&(e.dirtyFields=ce(u,n)),F.state.next({name:s,isDirty:k(s,a),dirtyFields:e.dirtyFields,errors:e.errors,isValid:e.isValid})}else O(n,s,a)},W=(s,a)=>{O(e.errors,s,a),F.state.next({errors:e.errors})},f=s=>{e.errors=s,F.state.next({errors:e.errors,isValid:!1})},y=(s,a,l,m)=>{const _=g(r,s);if(_){const c=g(n,s,R(l)?g(u,s):l);R(c)||m&&m.defaultChecked||a?O(n,s,a?c:ct(_._f)):H(s,c),o.mount&&!o.action&&N()}},V=(s,a,l,m,_)=>{let c=!1,v=!1;const C={name:s};if(!i.disabled){if(!l||m){(b.isDirty||w.isDirty)&&(v=e.isDirty,e.isDirty=C.isDirty=k(),c=v!==C.isDirty);const E=se(g(u,s),a);v=!!g(e.dirtyFields,s),E?L(e.dirtyFields,s):O(e.dirtyFields,s,!0),C.dirtyFields=e.dirtyFields,c=c||(b.dirtyFields||w.dirtyFields)&&v!==!E}if(l){const E=g(e.touchedFields,s);E||(O(e.touchedFields,s,l),C.touchedFields=e.touchedFields,c=c||(b.touchedFields||w.touchedFields)&&E!==l)}c&&_&&F.state.next(C)}return c?C:{}},S=(s,a,l,m)=>{const _=g(e.errors,s),c=(b.isValid||w.isValid)&&X(a)&&e.isValid!==a;if(i.delayError&&l?(p=M(()=>W(s,l)),p(i.delayError)):(clearTimeout(x),p=null,l?O(e.errors,s,l):L(e.errors,s)),(l?!se(_,l):_)||!j(m)||c){const v={...m,...c&&X(a)?{isValid:a}:{},errors:e.errors,name:s};e={...e,...v},F.state.next(v)}},$=async s=>(T(s,!0),await i.resolver(n,i.context,zt(s||d.mount,r,i.criteriaMode,i.shouldUseNativeValidation))),J=async s=>{const{errors:a}=await $(s);if(T(s),s)for(const l of s){const m=g(a,l);m?O(e.errors,l,m):L(e.errors,l)}else e.errors=a;return a},ee=async(s,a,l={valid:!0})=>{for(const m in s){const _=s[m];if(_){const{_f:c,...v}=_;if(c){const C=d.array.has(c.name),E=_._f&&Yt(_._f);E&&b.validatingFields&&T([c.name],!0);const G=await je(_,d.disabled,n,P,i.shouldUseNativeValidation&&!a,C);if(E&&b.validatingFields&&T([c.name]),G[c.name]&&(l.valid=!1,a||t.shouldUseNativeValidation))break;!a&&(g(G,c.name)?C?wt(e.errors,G,c.name):O(e.errors,c.name,G[c.name]):L(e.errors,c.name))}!j(v)&&await ee(v,a,l)}}return l.valid},be=()=>{for(const s of d.unMount){const a=g(r,s);a&&(a._f.refs?a._f.refs.every(l=>!Oe(l)):!Oe(a._f.ref))&&we(s)}d.unMount=new Set},k=(s,a)=>!i.disabled&&(s&&a&&O(n,s,a),!se(Ye(),u)),D=(s,a,l)=>Pe(s,d,{...o.mount?n:R(a)?u:Z(s)?{[s]:a}:a},l,a),B=s=>xe(g(o.mount?n:u,s,i.shouldUnregister?g(u,s,[]):[])),H=(s,a,l={})=>{const m=g(r,s);let _=a;if(m){const c=m._f;c&&(!c.disabled&&O(n,s,pt(a,c)),_=Ve(c.ref)&&z(a)?"":a,Ft(c.ref)?[...c.ref.options].forEach(v=>v.selected=_.includes(v.value)):c.refs?he(c.ref)?c.refs.forEach(v=>{(!v.defaultChecked||!v.disabled)&&(Array.isArray(_)?v.checked=!!_.find(C=>C===v.value):v.checked=_===v.value||!!_)}):c.refs.forEach(v=>v.checked=v.value===_):Ke(c.ref)?c.ref.value="":(c.ref.value=_,c.ref.type||F.state.next({name:s,values:U(n)})))}(l.shouldDirty||l.shouldTouch)&&V(s,_,l.shouldTouch,l.shouldDirty,!0),l.shouldValidate&&ge(s)},re=(s,a,l)=>{for(const m in a){if(!a.hasOwnProperty(m))return;const _=a[m],c=s+"."+m,v=g(r,c);(d.array.has(s)||I(_)||v&&!v._f)&&!le(_)?re(c,_,l):H(c,_,l)}},Q=(s,a,l={})=>{const m=g(r,s),_=d.array.has(s),c=U(a);O(n,s,c),_?(F.array.next({name:s,values:U(n)}),(b.isDirty||b.dirtyFields||w.isDirty||w.dirtyFields)&&l.shouldDirty&&F.state.next({name:s,dirtyFields:ce(u,n),isDirty:k(s,c)})):m&&!m._f&&!z(c)?re(s,c,l):H(s,c,l),He(s,d)?F.state.next({...e,name:s,values:U(n)}):F.state.next({name:o.mount?s:void 0,values:U(n)})},ye=async s=>{o.mount=!0;const a=s.target;let l=a.name,m=!0;const _=g(r,l),c=E=>{m=Number.isNaN(E)||le(E)&&isNaN(E.getTime())||se(E,g(n,l,E))},v=de(i.mode),C=de(i.reValidateMode);if(_){let E,G;const ue=a.type?ct(_._f):mt(s),ae=s.type===ve.BLUR||s.type===ve.FOCUS_OUT,Mt=!Jt(_._f)&&!i.resolver&&!g(e.errors,l)&&!_._f.deps||Zt(ae,g(e.touchedFields,l),e.isSubmitted,C,v),Ce=He(l,d,ae);O(n,l,ue),ae?(!a||!a.readOnly)&&(_._f.onBlur&&_._f.onBlur(s),p&&p(0)):_._f.onChange&&_._f.onChange(s);const Ee=V(l,ue,ae),Tt=!j(Ee)||Ce;if(!ae&&F.state.next({name:l,type:s.type,values:U(n)}),Mt)return(b.isValid||w.isValid)&&(i.mode==="onBlur"?ae&&N():ae||N()),Tt&&F.state.next({name:l,...Ce?{}:Ee});if(!ae&&Ce&&F.state.next({...e}),i.resolver){const{errors:it}=await $([l]);if(T([l]),c(ue),m){const Lt=ft(e.errors,r,l),at=ft(it,r,Lt.name||l);E=at.error,l=at.name,G=j(it)}}else T([l],!0),E=(await je(_,d.disabled,n,P,i.shouldUseNativeValidation))[l],T([l]),c(ue),m&&(E?G=!1:(b.isValid||w.isValid)&&(G=await ee(r,!0)));m&&(_._f.deps&&(!Array.isArray(_._f.deps)||_._f.deps.length>0)&&ge(_._f.deps),S(l,G,E,Ee))}},_e=(s,a)=>{if(g(e.errors,a)&&s.focus)return s.focus(),1},ge=async(s,a={})=>{let l,m;const _=Y(s);if(i.resolver){const c=await J(R(s)?s:_);l=j(c),m=s?!_.some(v=>g(c,v)):l}else s?(m=(await Promise.all(_.map(async c=>{const v=g(r,c);return await ee(v&&v._f?{[c]:v}:v)}))).every(Boolean),!(!m&&!e.isValid)&&N()):m=l=await ee(r);return F.state.next({...!Z(s)||(b.isValid||w.isValid)&&l!==e.isValid?{}:{name:s},...i.resolver||!s?{isValid:l}:{},errors:e.errors}),a.shouldFocus&&!m&&fe(r,_e,s?_:d.mount),m},Ye=(s,a)=>{let l={...o.mount?n:u};return a&&(l=Vt(a.dirtyFields?e.dirtyFields:e.touchedFields,l)),R(s)?l:Z(s)?g(l,s):s.map(m=>g(l,m))},Je=(s,a)=>({invalid:!!g((a||e).errors,s),isDirty:!!g((a||e).dirtyFields,s),error:g((a||e).errors,s),isValidating:!!g(e.validatingFields,s),isTouched:!!g((a||e).touchedFields,s)}),St=s=>{s&&Y(s).forEach(a=>L(e.errors,a)),F.state.next({errors:s?e.errors:{}})},Qe=(s,a,l)=>{const m=(g(r,s,{_f:{}})._f||{}).ref,_=g(e.errors,s)||{},{ref:c,message:v,type:C,...E}=_;O(e.errors,s,{...E,...a,ref:m}),F.state.next({name:s,errors:e.errors,isValid:!1}),l&&l.shouldFocus&&m&&m.focus&&m.focus()},Dt=(s,a)=>K(s)?F.state.subscribe({next:l=>"values"in l&&s(D(void 0,a),l)}):D(s,a,!0),Xe=s=>F.state.subscribe({next:a=>{Xt(s.name,a.name,s.exact)&&Qt(a,s.formState||b,Ut,s.reRenderRoot)&&s.callback({values:{...n},...e,...a,defaultValues:u})}}).unsubscribe,Ct=s=>(o.mount=!0,w={...w,...s.formState},Xe({...s,formState:{...q,...s.formState}})),we=(s,a={})=>{for(const l of s?Y(s):d.mount)d.mount.delete(l),d.array.delete(l),a.keepValue||(L(r,l),L(n,l)),!a.keepError&&L(e.errors,l),!a.keepDirty&&L(e.dirtyFields,l),!a.keepTouched&&L(e.touchedFields,l),!a.keepIsValidating&&L(e.validatingFields,l),!i.shouldUnregister&&!a.keepDefaultValue&&L(u,l);F.state.next({values:U(n)}),F.state.next({...e,...a.keepDirty?{isDirty:k()}:{}}),!a.keepIsValid&&N()},Ze=({disabled:s,name:a})=>{if(X(s)&&o.mount||s||d.disabled.has(a)){const _=d.disabled.has(a)!==!!s;s?d.disabled.add(a):d.disabled.delete(a),_&&o.mount&&!o.action&&N()}},Se=(s,a={})=>{let l=g(r,s);const m=X(a.disabled)||X(i.disabled);return O(r,s,{...l||{},_f:{...l&&l._f?l._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),l?Ze({disabled:X(a.disabled)?a.disabled:i.disabled,name:s}):y(s,!0,a.value),{...m?{disabled:a.disabled||i.disabled}:{},...i.progressive?{required:!!a.required,min:me(a.min),max:me(a.max),minLength:me(a.minLength),maxLength:me(a.maxLength),pattern:me(a.pattern)}:{},name:s,onChange:ye,onBlur:ye,ref:_=>{if(_){Se(s,a),l=g(r,s);const c=R(_.value)&&_.querySelectorAll&&_.querySelectorAll("input,select,textarea")[0]||_,v=jt(c),C=l._f.refs||[];if(v?C.find(E=>E===c):c===l._f.ref)return;O(r,s,{_f:{...l._f,...v?{refs:[...C.filter(Oe),c,...Array.isArray(g(u,s))?[{}]:[]],ref:{type:c.type,name:s}}:{ref:c}}}),y(s,!1,void 0,c)}else l=g(r,s,{}),l._f&&(l._f.mount=!1),(i.shouldUnregister||a.shouldUnregister)&&!(ht(d.array,s)&&o.action)&&d.unMount.add(s)}}},De=()=>i.shouldFocusError&&fe(r,_e,d.mount),Et=s=>{X(s)&&(F.state.next({disabled:s}),fe(r,(a,l)=>{const m=g(r,l);m&&(a.disabled=m._f.disabled||s,Array.isArray(m._f.refs)&&m._f.refs.forEach(_=>{_.disabled=m._f.disabled||s}))},0,!1))},et=(s,a)=>async l=>{let m;l&&(l.preventDefault&&l.preventDefault(),l.persist&&l.persist());let _=U(n);if(F.state.next({isSubmitting:!0}),i.resolver){const{errors:c,values:v}=await $();T(),e.errors=c,_=U(v)}else await ee(r);if(d.disabled.size)for(const c of d.disabled)L(_,c);if(L(e.errors,"root"),j(e.errors)){F.state.next({errors:{}});try{await s(_,l)}catch(c){m=c}}else a&&await a({...e.errors},l),De(),setTimeout(De);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:j(e.errors)&&!m,submitCount:e.submitCount+1,errors:e.errors}),m)throw m},Ot=(s,a={})=>{g(r,s)&&(R(a.defaultValue)?Q(s,U(g(u,s))):(Q(s,a.defaultValue),O(u,s,U(a.defaultValue))),a.keepTouched||L(e.touchedFields,s),a.keepDirty||(L(e.dirtyFields,s),e.isDirty=a.defaultValue?k(s,U(g(u,s))):k()),a.keepError||(L(e.errors,s),b.isValid&&N()),F.state.next({...e}))},tt=(s,a={})=>{const l=s?U(s):u,m=U(l),_=j(s),c=_?u:m;if(a.keepDefaultValues||(u=l),!a.keepValues){if(a.keepDirtyValues){const v=new Set([...d.mount,...Object.keys(ce(u,n))]);for(const C of Array.from(v)){const E=g(e.dirtyFields,C),G=g(n,C),ue=g(c,C);E&&!R(G)?O(c,C,G):!E&&!R(ue)&&Q(C,ue)}}else{if($e&&R(s))for(const v of d.mount){const C=g(r,v);if(C&&C._f){const E=Array.isArray(C._f.refs)?C._f.refs[0]:C._f.ref;if(Ve(E)){const G=E.closest("form");if(G){G.reset();break}}}}if(a.keepFieldsRef)for(const v of d.mount)Q(v,g(c,v));else r={}}n=i.shouldUnregister?a.keepDefaultValues?U(u):{}:U(c),F.array.next({values:{...c}}),F.state.next({values:{...c}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!b.isValid||!!a.keepIsValid||!!a.keepDirtyValues||!i.shouldUnregister&&!j(c),o.watch=!!i.shouldUnregister,o.keepIsValid=!!a.keepIsValid,o.action=!1,a.keepErrors||(e.errors={}),F.state.next({submitCount:a.keepSubmitCount?e.submitCount:0,isDirty:_?!1:a.keepDirty?e.isDirty:!!(a.keepDefaultValues&&!se(s,u)),isSubmitted:a.keepIsSubmitted?e.isSubmitted:!1,dirtyFields:_?{}:a.keepDirtyValues?a.keepDefaultValues&&n?ce(u,n):e.dirtyFields:a.keepDefaultValues&&s?ce(u,s):a.keepDirty?e.dirtyFields:{},touchedFields:a.keepTouched?e.touchedFields:{},errors:a.keepErrors?e.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?e.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:u})},rt=(s,a)=>tt(K(s)?s(n):s,{...i.resetOptions,...a}),Rt=(s,a={})=>{const l=g(r,s),m=l&&l._f;if(m){const _=m.refs?m.refs[0]:m.ref;_.focus&&setTimeout(()=>{_.focus(),a.shouldSelect&&K(_.select)&&_.select()})}},Ut=s=>{e={...e,...s}},st={control:{register:Se,unregister:we,getFieldState:Je,handleSubmit:et,setError:Qe,_subscribe:Xe,_runSchema:$,_updateIsValidating:T,_focusError:De,_getWatch:D,_getDirty:k,_setValid:N,_setFieldArray:A,_setDisabledField:Ze,_setErrors:f,_getFieldArray:B,_reset:tt,_resetDefaultValues:()=>K(i.defaultValues)&&i.defaultValues().then(s=>{rt(s,i.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:be,_disableForm:Et,_subjects:F,_proxyFormState:b,get _fields(){return r},get _formValues(){return n},get _state(){return o},set _state(s){o=s},get _defaultValues(){return u},get _names(){return d},set _names(s){d=s},get _formState(){return e},get _options(){return i},set _options(s){i={...i,...s}}},subscribe:Ct,trigger:ge,register:Se,handleSubmit:et,watch:Dt,setValue:Q,getValues:Ye,reset:rt,resetField:Ot,clearErrors:St,unregister:we,setError:Qe,setFocus:Rt,getFieldState:Je};return{...st,formControl:st}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const t=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,i=>{const e=(Math.random()*16+t)%16|0;return(i=="x"?e:e&3|8).toString(16)})},Re=(t,i,e={})=>e.shouldFocus||R(e.shouldFocus)?e.focusName||`${t}.${R(e.focusIndex)?i:e.focusIndex}.`:"",Ue=(t,i)=>[...t,...Y(i)],Me=t=>Array.isArray(t)?t.map(()=>{}):void 0;function Te(t,i,e){return[...t.slice(0,i),...Y(e),...t.slice(i)]}var Le=(t,i,e)=>Array.isArray(t)?(R(t[e])&&(t[e]=void 0),t.splice(e,0,t.splice(i,1)[0]),t):[],Ie=(t,i)=>[...Y(i),...Y(t)];function sr(t,i){let e=0;const r=[...t];for(const u of i)r.splice(u-e,1),e++;return xe(r).length?r:[]}var Ne=(t,i)=>R(i)?[]:sr(t,Y(i).sort((e,r)=>e-r)),Be=(t,i,e)=>{[t[i],t[e]]=[t[e],t[i]]},_t=(t,i,e)=>(t[i]=e,t);function ur(t){const i=pe(),{control:e=i,name:r,keyName:u="id",shouldUnregister:n,rules:o}=t,[d,p]=h.useState(e._getFieldArray(r)),x=h.useRef(e._getFieldArray(r).map(ne)),q=h.useRef(!1);e._names.array.add(r),h.useMemo(()=>o&&d.length>=0&&e.register(r,o),[e,r,d.length,o]),ke(()=>e._subjects.array.subscribe({next:({values:f,name:y})=>{if(y===r||!y){const V=g(f,r);Array.isArray(V)&&(p(V),x.current=V.map(ne))}}}).unsubscribe,[e,r]);const b=h.useCallback(f=>{q.current=!0,e._setFieldArray(r,f)},[e,r]),w=(f,y)=>{const V=Y(U(f)),S=Ue(e._getFieldArray(r),V);e._names.focus=Re(r,S.length-1,y),x.current=Ue(x.current,V.map(ne)),b(S),p(S),e._setFieldArray(r,S,Ue,{argA:Me(f)})},F=(f,y)=>{const V=Y(U(f)),S=Ie(e._getFieldArray(r),V);e._names.focus=Re(r,0,y),x.current=Ie(x.current,V.map(ne)),b(S),p(S),e._setFieldArray(r,S,Ie,{argA:Me(f)})},P=f=>{const y=Ne(e._getFieldArray(r),f);x.current=Ne(x.current,f),b(y),p(y),!Array.isArray(g(e._fields,r))&&O(e._fields,r,void 0),e._setFieldArray(r,y,Ne,{argA:f})},M=(f,y,V)=>{const S=Y(U(y)),$=Te(e._getFieldArray(r),f,S);e._names.focus=Re(r,f,V),x.current=Te(x.current,f,S.map(ne)),b($),p($),e._setFieldArray(r,$,Te,{argA:f,argB:Me(y)})},N=(f,y)=>{const V=e._getFieldArray(r);Be(V,f,y),Be(x.current,f,y),b(V),p(V),e._setFieldArray(r,V,Be,{argA:f,argB:y},!1)},T=(f,y)=>{const V=e._getFieldArray(r);Le(V,f,y),Le(x.current,f,y),b(V),p(V),e._setFieldArray(r,V,Le,{argA:f,argB:y},!1)},A=(f,y)=>{const V=U(y),S=_t(e._getFieldArray(r),f,V);x.current=[...S].map(($,J)=>!$||J===f?ne():x.current[J]),b(S),p([...S]),e._setFieldArray(r,S,_t,{argA:f,argB:V},!0,!1)},W=f=>{const y=Y(U(f));x.current=y.map(ne),b([...y]),p([...y]),e._setFieldArray(r,[...y],V=>V,{},!0,!1)};return h.useEffect(()=>{if(e._state.action=!1,He(r,e._names)&&e._subjects.state.next({...e._formState}),q.current&&(!de(e._options.mode).isOnSubmit||e._formState.isSubmitted)&&!de(e._options.reValidateMode).isOnSubmit)if(e._options.resolver)e._runSchema([r]).then(f=>{e._updateIsValidating([r]);const y=g(f.errors,r),V=g(e._formState.errors,r);(V?!y&&V.type||y&&(V.type!==y.type||V.message!==y.message):y&&y.type)&&(y?O(e._formState.errors,r,y):L(e._formState.errors,r),e._subjects.state.next({errors:e._formState.errors}))});else{const f=g(e._fields,r);f&&f._f&&!(de(e._options.reValidateMode).isOnSubmit&&de(e._options.mode).isOnSubmit)&&je(f,e._names.disabled,e._formValues,e._options.criteriaMode===te.all,e._options.shouldUseNativeValidation,!0).then(y=>!j(y)&&e._subjects.state.next({errors:wt(e._formState.errors,y,r)}))}e._subjects.state.next({name:r,values:U(e._formValues)}),e._names.focus&&fe(e._fields,(f,y)=>{if(e._names.focus&&y.startsWith(e._names.focus)&&f.focus)return f.focus(),1}),e._names.focus="",e._setValid(),q.current=!1},[d,r,e]),h.useEffect(()=>(!g(e._formValues,r)&&e._setFieldArray(r),()=>{const f=(y,V)=>{const S=g(e._fields,y);S&&S._f&&(S._f.mount=V)};e._options.shouldUnregister||n?e.unregister(r):f(r,!1)}),[r,e,u,n]),{swap:h.useCallback(N,[b,r,e]),move:h.useCallback(T,[b,r,e]),prepend:h.useCallback(F,[b,r,e]),append:h.useCallback(w,[b,r,e]),remove:h.useCallback(P,[b,r,e]),insert:h.useCallback(M,[b,r,e]),update:h.useCallback(A,[b,r,e]),replace:h.useCallback(W,[b,r,e]),fields:h.useMemo(()=>d.map((f,y)=>({...f,[u]:x.current[y]||ne()})),[d,u])}}function lr(t={}){const i=h.useRef(void 0),e=h.useRef(void 0),[r,u]=h.useState({isDirty:!1,isValidating:!1,isLoading:K(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:K(t.defaultValues)?void 0:t.defaultValues});if(!i.current)if(t.formControl)i.current={...t.formControl,formState:r},t.defaultValues&&!K(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...d}=rr(t);i.current={...d,formState:r}}const n=i.current.control;return n._options=t,ke(()=>{const o=n._subscribe({formState:n._proxyFormState,callback:()=>u({...n._formState}),reRenderRoot:!0});return u(d=>({...d,isReady:!0})),n._formState.isReady=!0,o},[n]),h.useEffect(()=>n._disableForm(t.disabled),[n,t.disabled]),h.useEffect(()=>{t.mode&&(n._options.mode=t.mode),t.reValidateMode&&(n._options.reValidateMode=t.reValidateMode)},[n,t.mode,t.reValidateMode]),h.useEffect(()=>{t.errors&&(n._setErrors(t.errors),n._focusError())},[n,t.errors]),h.useEffect(()=>{t.shouldUnregister&&n._subjects.state.next({values:n._getWatch()})},[n,t.shouldUnregister]),h.useEffect(()=>{if(n._proxyFormState.isDirty){const o=n._getDirty();o!==r.isDirty&&n._subjects.state.next({isDirty:o})}},[n,r.isDirty]),h.useEffect(()=>{var o;t.values&&!se(t.values,e.current)?(n._reset(t.values,{keepFieldsRef:!0,...n._options.resetOptions}),!((o=n._options.resetOptions)===null||o===void 0)&&o.keepIsValid||n._setValid(),e.current=t.values,u(d=>({...d}))):n._resetDefaultValues()},[n,t.values]),h.useEffect(()=>{n._state.mount||(n._setValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),i.current.formState=h.useMemo(()=>vt(r,n),[n,r]),i.current}export{nr as C,Pt as a,ur as b,lr as u};
|