@abtnode/webapp 1.17.8-beta-20260106-113136-b3c09e14 → 1.17.8-beta-20260108-021819-e099f0ca
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-DWVMAxzn.js → AdapterDayjs-Chnfr9fe.js} +1 -1
- package/dist/assets/{Add-DSHUmuh2.js → Add-b-MNk7UB.js} +1 -1
- package/dist/assets/ArrowDropDown-lsZjWbH5.js +1 -0
- package/dist/assets/{Autocomplete-CafCM_25.js → Autocomplete-79tADtg2.js} +1 -1
- package/dist/assets/{Breadcrumbs-DwWBB4-B.js → Breadcrumbs-Cqjt-kp8.js} +1 -1
- package/dist/assets/{ButtonGroup-C1HewoiR.js → ButtonGroup-C_JbniJW.js} +1 -1
- package/dist/assets/{CSSTransition-1BwLUUYd.js → CSSTransition-DinXVMZy.js} +1 -1
- package/dist/assets/{CallMerge-BQb_v7zQ.js → CallMerge-CF5jo3Pw.js} +1 -1
- package/dist/assets/{CardContent-B53G0-HU.js → CardContent-CYNmFsYJ.js} +1 -1
- package/dist/assets/{ChevronLeft-CaPH--HT.js → ChevronLeft-Byy2_Dj8.js} +1 -1
- package/dist/assets/{ChevronRight-CtPp_MpO.js → ChevronRight-BKFXnJ7g.js} +1 -1
- package/dist/assets/{Clear-BBluvTPc.js → Clear-Chg9fOPG.js} +1 -1
- package/dist/assets/{Delete-9ESwe_tH.js → Delete-B306vkSB.js} +1 -1
- package/dist/assets/{DeleteOutline-CK2Vy8gP.js → DeleteOutline-BjSm7PCr.js} +1 -1
- package/dist/assets/{Done-Cc0u-Lkn.js → Done-Bh0vP7e6.js} +1 -1
- package/dist/assets/{Edit-D1Klg2r6.js → Edit-DFmlgA7E.js} +1 -1
- package/dist/assets/EditOutlined-Qskj3-tY.js +1 -0
- package/dist/assets/{ErrorOutline-BoB93pXx.js → ErrorOutline-CjKNiJFO.js} +1 -1
- package/dist/assets/{FilterList-DjsH6fTI.js → FilterList-Dphn1UXx.js} +1 -1
- package/dist/assets/{Google-wvuc_gx7.js → Google-C0G3l0jL.js} +1 -1
- package/dist/assets/{HelpOutline-CM_Ykzlc.js → HelpOutline--A0maMxb.js} +1 -1
- package/dist/assets/{KeyboardArrowDown-xhzKRGfY.js → KeyboardArrowDown-CD6n37Y9.js} +1 -1
- package/dist/assets/{Launch-DlhEZ9Bw.js → Launch-Cor8d4pT.js} +1 -1
- package/dist/assets/{Link-DfMegObq.js → Link-Mg5UlAaZ.js} +1 -1
- package/dist/assets/{ListItemButton-DmY4JAPa.js → ListItemButton-C8XIzvy_.js} +1 -1
- package/dist/assets/{ListSubheader-B41Y1ZMB.js → ListSubheader-CHT01bOG.js} +1 -1
- package/dist/assets/{LoadingButton-Cj4ijk42.js → LoadingButton-DtnAWL1w.js} +1 -1
- package/dist/assets/{MoreVert-BQdkfudm.js → MoreVert-KNjOpSoE.js} +1 -1
- package/dist/assets/{OpenInNew-GavEOug8.js → OpenInNew-DGDd5qxt.js} +1 -1
- package/dist/assets/{Refresh-C5IecY_i.js → Refresh-B0_3c6OW.js} +1 -1
- package/dist/assets/{Replay-BLAjtrmV.js → Replay-BzP784vV.js} +1 -1
- package/dist/assets/{Search-DsDROQ8Z.js → Search-CUoYhy1v.js} +1 -1
- package/dist/assets/{Stepper-DpZ7eOjv.js → Stepper-DfUO9buC.js} +1 -1
- package/dist/assets/{TableSearch-B9TJh3X_.js → TableSearch-DxZYknBa.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-CJ8NJ0D1.js → ToggleButtonGroup-BwLu2zCu.js} +1 -1
- package/dist/assets/{UnfoldMore-wahbC_eH.js → UnfoldMore-DvSw9pGy.js} +1 -1
- package/dist/assets/{Verified-CR7dtVpN.js → Verified-CfonAx-G.js} +1 -1
- package/dist/assets/{VerifiedUser-CJqNBrd2.js → VerifiedUser-wCwGdsz1.js} +1 -1
- package/dist/assets/{ViewList-CmgkgU2_.js → ViewList-DhdvL6AT.js} +1 -1
- package/dist/assets/_createAggregator-BLxu5C4t.js +1 -0
- package/dist/assets/{actions-DFw06nT4.js → actions-D1YtdqKL.js} +1 -1
- package/dist/assets/{actions-BGmJ3r4b.js → actions-Wo9kGXdj.js} +1 -1
- package/dist/assets/{agreement-nsoxnYhM.js → agreement-07HiBYSX.js} +3 -3
- package/dist/assets/api-eF9wxSJp.js +1 -0
- package/dist/assets/{appearance-DPQCzdhZ.js → appearance-CKF7Bo6h.js} +1 -1
- package/dist/assets/{ar-BukCw0OI.js → ar-BHqjWgUQ.js} +2 -2
- package/dist/assets/{audit-logs-C1Fzb4ps.js → audit-logs-CLt2l7-q.js} +2 -2
- package/dist/assets/{base-chart-CEDitl1S.js → base-chart-_0APPWGp.js} +1 -1
- package/dist/assets/{blocklet-CQ-S_G-T.js → blocklet-ClPWX-SV.js} +1 -1
- package/dist/assets/{chain-T1WmG8fp.js → chain-Bg9mny_E.js} +1 -1
- package/dist/assets/{click-to-copy-BtM6Ocbq.js → click-to-copy-BbJJzGI1.js} +1 -1
- package/dist/assets/cloneDeep-DNOsGRuG.js +1 -0
- package/dist/assets/{config-navigation-nzNCj2pe.js → config-navigation-B-CtKO70.js} +3 -3
- package/dist/assets/connect-2JDWTFDP.js +5 -0
- package/dist/assets/{connect-to-YFMYu-C6.js → connect-to-CBEHT895.js} +1 -1
- package/dist/assets/{cssMode-CorZ9Trm.js → cssMode-U7KzpQEJ.js} +1 -1
- package/dist/assets/{de-Br0tDZam.js → de-QUGQFv2K.js} +1 -1
- package/dist/assets/{delete-confirm-DkYJPW8j.js → delete-confirm-Cx4JPY2I.js} +1 -1
- package/dist/assets/depsEqual-Cvglsxh5.js +1 -0
- package/dist/assets/{detail-B2tLxU0Q.js → detail-Cgws9Fjd.js} +3 -3
- package/dist/assets/{domains-D6W5MF-p.js → domains-BJzrDugH.js} +2 -2
- package/dist/assets/{download-CMbpTIK1.js → download-Df1TrhTI.js} +1 -1
- package/dist/assets/{edit.svg-DA3pWWpd.js → edit.svg-833vjqGH.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-Epiq9rij.js +1 -0
- package/dist/assets/engine-a9f8P0CB.js +1 -0
- package/dist/assets/{es-D_e0gGgp.js → es-C4w6cL07.js} +2 -2
- package/dist/assets/{fr-DXizOT4b.js → fr-Bq3UipEu.js} +2 -2
- package/dist/assets/{freemarker2-B35GIWEl.js → freemarker2-J5nZkQuM.js} +1 -1
- package/dist/assets/{get-safe-url-BtHUKeta.js → get-safe-url-QppwE77w.js} +1 -1
- package/dist/assets/getValidReactChildren-Cjo-LFyx.js +1 -0
- package/dist/assets/{graphqlMode-BhjTwCqd.js → graphqlMode-5yY_akok.js} +2 -2
- package/dist/assets/{handlebars-DGxR4b_w.js → handlebars-DfBT6Rl2.js} +1 -1
- package/dist/assets/{hi-D2FEb_Tx.js → hi-DGZy0DLh.js} +2 -2
- package/dist/assets/{html-Dl26d1wf.js → html-BBpT31Z8.js} +1 -1
- package/dist/assets/{html-title-DdUp_-5h.js → html-title-BpNgi7iw.js} +1 -1
- package/dist/assets/{htmlMode-zyg79iHD.js → htmlMode-CDF4YwlA.js} +1 -1
- package/dist/assets/{id-Dw9URVwP.js → id-DOzDilAf.js} +2 -2
- package/dist/assets/{iframe-naOtT0ea.js → iframe-CH8rbppJ.js} +1 -1
- package/dist/assets/{index-B5a5GywJ.js → index-0NOALS_P.js} +1 -1
- package/dist/assets/{index-9I_iGd-v.js → index-3MwDYHdN.js} +9 -9
- package/dist/assets/index-B31H3tAk.js +1 -0
- package/dist/assets/index-B3tcK3_z.js +179 -0
- package/dist/assets/{index-B5Gr8NCp.js → index-B4fcaU-r.js} +2 -2
- package/dist/assets/{index--8pMPQd4.js → index-B6x6Mq9n.js} +1 -1
- package/dist/assets/{index-MY2K6w0a.js → index-B8qqbKQt.js} +1 -1
- package/dist/assets/{index-B32KxiCS.js → index-BBe9oV9e.js} +1 -1
- package/dist/assets/{index-CH66h8Bz.js → index-BHQcEGDq.js} +1 -1
- package/dist/assets/{index-BjFIjVRr.js → index-BJVvRV0h.js} +1 -1
- package/dist/assets/{index-D_9cPML4.js → index-BRSm_uSW.js} +3 -3
- package/dist/assets/{index-CajyH0Pt.js → index-BSBkhGl0.js} +1 -1
- package/dist/assets/{index-BWhjxKXQ.js → index-BVJB29cJ.js} +1 -1
- package/dist/assets/{index-BRe92Q_R.js → index-BbND9whL.js} +1 -1
- package/dist/assets/{index-Brq4w3lW.js → index-BdVOugOI.js} +1 -1
- package/dist/assets/index-Bek3Nxot.js +2900 -0
- package/dist/assets/{index-CUMme3nC.js → index-BfTQCMKf.js} +1 -1
- package/dist/assets/{index-DJvzDb5Q.js → index-BfnrUUfH.js} +1 -1
- package/dist/assets/{index-BwNCJNhy.js → index-BikUP_wv.js} +1 -1
- package/dist/assets/{index-BWGe4dJb.js → index-BqrWLXQw.js} +3 -3
- package/dist/assets/{index-BUZBDqqG.js → index-CBHMH4Z7.js} +1 -1
- package/dist/assets/{index-DgL9xnFX.js → index-CDd3s2GI.js} +1 -1
- package/dist/assets/{index-BYUmgdKD.js → index-CHgpIuFF.js} +3 -3
- package/dist/assets/{index-Bn367fJd.js → index-CKWS_NIP.js} +33 -33
- package/dist/assets/{index-C2cbrgVU.js → index-CZX-K9Eg.js} +1 -1
- package/dist/assets/{index-CqYZvIgm.js → index-CaxsY_au.js} +3 -3
- package/dist/assets/{index-8NfiZJjD.js → index-CbK68mel.js} +1 -1
- package/dist/assets/{index-BZiL2FK1.js → index-CbnvHmOA.js} +1 -1
- package/dist/assets/{index-D6evhDRM.js → index-Crqqt-AN.js} +1 -1
- package/dist/assets/{index-0xQC_RX5.js → index-CsTd8Q4H.js} +1 -1
- package/dist/assets/{index-CYUImSxu.js → index-DCHzmqFc.js} +1 -1
- package/dist/assets/{index-CgaVkwyv.js → index-DJfXtT-f.js} +1 -1
- package/dist/assets/index-DSjaZAu3.js +1 -0
- package/dist/assets/{index-CRl4QsFf.js → index-DXfP6ckA.js} +2 -2
- package/dist/assets/{index-Beuvm8_y.js → index-D_L4A5jU.js} +1 -1
- package/dist/assets/{index-BGxDum8X.js → index-DqkfLKvE.js} +1 -1
- package/dist/assets/{index-B_lfyJAT.js → index-Dr7VuVvC.js} +1 -1
- package/dist/assets/{index-CNgBOpOW.js → index-DrsAyGr6.js} +1 -1
- package/dist/assets/{index-CaBQPbJb.js → index-FdUIQyuT.js} +1 -1
- package/dist/assets/{index-DDM20tun.js → index-HqyXcG7M.js} +3 -3
- package/dist/assets/{index-CNsTH-sC.js → index-WHQs_PkC.js} +1 -1
- package/dist/assets/{index-C_yKF6eG.js → index-cZdqepfp.js} +1 -1
- package/dist/assets/{index-C_xCzC4h.js → index-iqFfmV_z.js} +1 -1
- package/dist/assets/{index-BVBi2pvN.js → index-jHF3D4cy.js} +1 -1
- package/dist/assets/{index-CzlMX9ae.js → index-m8sITmne.js} +1 -1
- package/dist/assets/{index-BTQvwhJ3.js → index-tNmk7CjJ.js} +1 -1
- package/dist/assets/{index.esm-Bhe9PyJD.js → index.esm-WZ7Avw4n.js} +1 -1
- package/dist/assets/{install-from-url-BSRJz2Np.js → install-from-url-PuHPLadE.js} +1 -1
- package/dist/assets/{invitation-C2EDl-5j.js → invitation-Bi2QgUpB.js} +1 -1
- package/dist/assets/{is-path-prefix-equal-DRlBVNUG.js → is-path-prefix-equal-BAfeJQQq.js} +1 -1
- package/dist/assets/{item-BBL8EstT.js → item-hbtsGcq0.js} +1 -1
- package/dist/assets/{ja-DBxpsmGJ.js → ja-DMq-YXDX.js} +2 -2
- package/dist/assets/{javascript-Bw5GnACP.js → javascript-CH6uPFyX.js} +1 -1
- package/dist/assets/{jsonMode-CYcndJYD.js → jsonMode-B3mvgwT0.js} +1 -1
- package/dist/assets/{ko-CCAdSyce.js → ko-BrYbXurh.js} +2 -2
- package/dist/assets/{liquid-ClyO3pFK.js → liquid-BoDus-ho.js} +1 -1
- package/dist/assets/{list-header-CQdhtCZz.js → list-header-C3SJDsfy.js} +1 -1
- package/dist/assets/{lock.svg-B7I2PtUy.js → lock.svg-CGmlgpmU.js} +1 -1
- package/dist/assets/{log-BztLHiQf.js → log-D4BWVj7G.js} +1 -1
- package/dist/assets/{lottie-react.esm-Cq3-epqH.js → lottie-react.esm-ayFZjR4e.js} +1 -1
- package/dist/assets/{mdx-DkYVlLke.js → mdx-C33wkq6H.js} +1 -1
- package/dist/assets/{memory-DV8JsQtx.js → memory-lh5QZ4zg.js} +1 -1
- package/dist/assets/{metric-EPbdPW3c.js → metric-chc-qmc8.js} +1 -1
- package/dist/assets/omit-C11lcOpj.js +1 -0
- package/dist/assets/{overview-dKd5GT8L.js → overview-DL-GP40o.js} +1 -1
- package/dist/assets/{permission-CM6DkVuZ.js → permission-D09K4EY6.js} +1 -1
- package/dist/assets/{preference-BM-UTdmc.js → preference-iiwdIYk6.js} +5 -5
- package/dist/assets/{provider-icon-Cktbn65r.js → provider-icon-Dm9XYo2I.js} +1 -1
- package/dist/assets/{pt-CrMGrBZ6.js → pt-Dl6732JN.js} +2 -2
- package/dist/assets/{python-Du7VaLuo.js → python-D_lYYAX1.js} +1 -1
- package/dist/assets/{raf-schd.esm-BNw9NITo.js → raf-schd.esm-Bo9SYHL8.js} +1 -1
- package/dist/assets/{razor-BVnET0nC.js → razor-dpsmZHh4.js} +1 -1
- package/dist/assets/{rotate-session-key-CFNbgP5f.js → rotate-session-key-Bfdv46s3.js} +1 -1
- package/dist/assets/{ru-up3R57Pv.js → ru-CVUeN9AX.js} +2 -2
- package/dist/assets/{runtime-Dk9rcZxS.js → runtime-BUcScDcM.js} +1 -1
- package/dist/assets/schema-DidDB4o0.js +1 -0
- package/dist/assets/sdk-l1r4MOQ_.js +1 -0
- package/dist/assets/{service-CqUPpwp0.js → service-DCzLPjA3.js} +1 -1
- package/dist/assets/{shorten-label-3s6gLF6k.js → shorten-label-CN9pEyom.js} +1 -1
- package/dist/assets/{simple-select-Wx3iUaBi.js → simple-select-DxwJpURO.js} +1 -1
- package/dist/assets/{spaces-Am_oeFAi.js → spaces-BrB8zqzV.js} +1 -1
- package/dist/assets/{status-CNrrWhOD.js → status-B-GGRrEB.js} +1 -1
- package/dist/assets/{status-C7WonqAX.js → status-BZx_J-ps.js} +1 -1
- package/dist/assets/{switch-control-5rdk6r2s.js → switch-control-X9WA2UjB.js} +1 -1
- package/dist/assets/{table-icons-BYFzOJU6.js → table-icons-Xs4hP9Pw.js} +1 -1
- package/dist/assets/{team-DIUm8el2.js → team-B9jB42uy.js} +1 -1
- package/dist/assets/{th-DdNj2Ao6.js → th-32eBNQes.js} +2 -2
- package/dist/assets/{toLower-4lrgdc-N.js → toLower-DwWNsNMJ.js} +1 -1
- package/dist/assets/toUpper-DXK6zXOf.js +1 -0
- package/dist/assets/{traffic-Dk6Khjvb.js → traffic-C_4zWOQM.js} +1 -1
- package/dist/assets/{tsMode-Dsc9rLfX.js → tsMode-57DuREfP.js} +1 -1
- package/dist/assets/{typescript-DpjdjVZw.js → typescript-BJp2b_J1.js} +1 -1
- package/dist/assets/{url-evaluation-C14MBkPs.js → url-evaluation-DetQFE_e.js} +1 -1
- package/dist/assets/{url-join-CdWz3bWK.js → url-join-rRKl4Ear.js} +1 -1
- package/dist/assets/{use-mobile-DyfoHLG-.js → use-mobile-BDRFDg8j.js} +1 -1
- package/dist/assets/{use-mobile-CDGtPjEm.js → use-mobile-DOhPXmq7.js} +1 -1
- package/dist/assets/{useAsync-CxBbRyfH.js → useAsync-B59MJoKM.js} +1 -1
- package/dist/assets/{useAsyncRetry-Bocgt3FN.js → useAsyncRetry-CGp0YSlH.js} +1 -1
- package/dist/assets/{useLocalStorage-DCDZL7eY.js → useLocalStorage-Dpl2DibN.js} +1 -1
- package/dist/assets/{useThemeProps-BgZ7aDx7.js → useThemeProps-BS48y1B2.js} +1 -1
- package/dist/assets/{util-Be7ZYLl2.js → util-DgOs7OwT.js} +1 -1
- package/dist/assets/{vi-HNh41Xxk.js → vi-DF8IinAc.js} +2 -2
- package/dist/assets/{wait-container-DxcDiGL9.js → wait-container-CxHAyAQN.js} +1 -1
- package/dist/assets/{without-wallet-B0F51hFz.js → without-wallet-qfmn1VhQ.js} +1 -1
- package/dist/assets/wrap-locale-D8IL6u8L.js +1 -0
- package/dist/assets/{xml-B7OEZnDx.js → xml-BZRt8HAs.js} +1 -1
- package/dist/assets/{yaml-CKPSOCPR.js → yaml-0X7rH3i7.js} +1 -1
- package/dist/assets/{zh-MM5bvwO_.js → zh-ByJkLAV1.js} +2 -2
- package/dist/assets/{zh-tw-Dr5DyPwA.js → zh-tw-34G9tsUP.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-X9T3XBZa.js +0 -1
- package/dist/assets/_createAggregator-DnJlZ903.js +0 -1
- package/dist/assets/api-D8UyBv4i.js +0 -1
- package/dist/assets/cloneDeep-CJSiQzIj.js +0 -1
- package/dist/assets/connect-DEbeKuNy.js +0 -5
- package/dist/assets/depsEqual-C5Zw7_49.js +0 -1
- package/dist/assets/emotion-cache.browser.esm-4wp097w6.js +0 -1
- package/dist/assets/engine-DDhO6kSm.js +0 -1
- package/dist/assets/getValidReactChildren-DsFc6cpz.js +0 -1
- package/dist/assets/index-7mVca6L9.js +0 -1
- package/dist/assets/index-BAMKzu46.js +0 -2900
- package/dist/assets/index-Bv7eZ7mu.js +0 -179
- package/dist/assets/index-CJNCkrWH.js +0 -1
- package/dist/assets/omit-DisUFHh2.js +0 -1
- package/dist/assets/schema-DV0hUaoz.js +0 -1
- package/dist/assets/sdk-4bF4Obyz.js +0 -1
- package/dist/assets/toUpper-DJkJXqdQ.js +0 -1
- package/dist/assets/wrap-locale-DCD2RpMr.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as P,V as E,A as C,j as e,I,C as W,cF as j,J as T,w as k,H as u,aH as S,u as U,x as v,ar as N,af as R}from"./index-
|
|
1
|
+
import{r as P,V as E,A as C,j as e,I,C as W,cF as j,J as T,w as k,H as u,aH as S,u as U,x as v,ar as N,af as R}from"./index-Bek3Nxot.js";import{w as b}from"./wrap-locale-D8IL6u8L.js";import{g as L}from"./get-safe-url-QppwE77w.js";import"./index-DSjaZAu3.js";function F({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),f=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},m=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(I,{children:e.jsx(W,{})}):e.jsx(j,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:f,onError:m,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const H=b(F);function V(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(H,{SessionContext:N,webWalletUrl:a,onSuccess:r})}export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,cF as j,J as v,A as P,r as a,p as S,ay as k,u as w,x as b,f as E,aP as K,dj as W,F as i,b7 as _,w as F,I as U,C as N,dk as R,dl as z}from"./index-
|
|
1
|
+
import{j as e,cF as j,J as v,A as P,r as a,p as S,ay as k,u as w,x as b,f as E,aP as K,dj as W,F as i,b7 as _,w as F,I as U,C as N,dk as R,dl as z}from"./index-Bek3Nxot.js";import{p as c}from"./index-BJVvRV0h.js";function o({children:r,...s}){return e.jsx(j,{...s,did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(v,{sx:{maxWidth:"100%",height:"100%"},children:r})})}function L(){const r=P(),{t:s,locale:d}=a.useContext(S),{api:l}=k(),{info:u}=w(),p=b(u),f=E(),n=K({ready:!1,success:!1,error:null,invalidSession:!1}),h=W(),m=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const g=t.searchParams.get("__connect_url__"),y=R(g);if(!z(y))throw new Error;n.ready=!0}catch{n.invalidSession=!0,r("#invalid",{replace:!0})}};a.useLayoutEffect(()=>m(),[]);const x=i(t=>{n.error=t.message,r("#invalid",{replace:!0})}),C=i(()=>{n.success=!0});if(n.invalidSession)return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.invalidSession"),description:s("didConnect.common.invalidSessionDesc")})});if(n.error){const t=n.error;return e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"error",title:s("didConnect.common.connectionError"),description:t})})}return n.success?e.jsx(o,{children:e.jsx(c,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(_,{style:{color:f.palette.success.main,fontSize:72}}),title:s("didConnect.genKeyPair.success"),description:s("didConnect.genKeyPair.successDesc")})}):n.ready?e.jsx(o,{children:e.jsx(F,{className:"connect",action:"gen-key-pair",checkFn:l.get,checkTimeout:10*60*1e3,extraParams:{sourceAppPid:h?.appPid,forceSwitch:!0},saveConnect:!1,forceConnected:!1,webWalletUrl:p,onSuccess:C,onError:x,locale:d,messages:{title:s("didConnect.genKeyPair.title"),scan:s("didConnect.genKeyPair.scan"),confirm:s("auth.confirm"),success:s("didConnect.genKeyPair.success")},popup:!0,open:!0,hideCloseButton:!0})},"ready"):e.jsx(U,{children:e.jsx(N,{})})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fF as D}from"./index-BAMKzu46.js";function f(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function $(e){return f(e)==="object"}function re(e){return Array.isArray(e)&&e.length>0&&e.every(m=>"message"in m)}function Y(e,m){return e.length<124?e:m}const ne="graphql-transport-ws";var g;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(g||(g={}));var c;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(c||(c={}));function v(e){if(!$(e))throw new Error(`Message is expected to be an object, but got ${f(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${f(e.type)}`);switch(e.type){case c.ConnectionInit:case c.ConnectionAck:case c.Ping:case c.Pong:{if(e.payload!=null&&!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case c.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${f(e.payload.query)}`);if(e.payload.variables!=null&&!$(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${f(e.payload.variables)}`);if(e.payload.operationName!=null&&f(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${f(e.payload.operationName)}`);if(e.payload.extensions!=null&&!$(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${f(e.payload.extensions)}`);break}case c.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);break}case c.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!re(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case c.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function oe(e,m){return v(typeof e=="string"?JSON.parse(e,m):e)}function W(e,m){return v(e),JSON.stringify(e,m)}var A=function(e){return this instanceof A?(this.v=e,this):new A(e)},ie=function(e,m,R){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=R.apply(e,m||[]),b,w=[];return b={},E("next"),E("throw"),E("return"),b[Symbol.asyncIterator]=function(){return this},b;function E(u){M[u]&&(b[u]=function(r){return new Promise(function(S,L){w.push([u,r,S,L])>1||I(u,r)})})}function I(u,r){try{q(M[u](r))}catch(S){F(w[0][3],S)}}function q(u){u.value instanceof A?Promise.resolve(u.value.v).then(z,G):F(w[0][2],u)}function z(u){I("next",u)}function G(u){I("throw",u)}function F(u,r){u(r),w.shift(),w.length&&I(w[0][0],w[0][1])}};function pe(e){const{url:m,connectionParams:R,lazy:M=!0,onNonLazyError:b=console.error,lazyCloseTimeout:w=0,keepAlive:E=0,disablePong:I,connectionAckWaitTimeout:q=0,retryAttempts:z=5,retryWait:G=async function(a){let t=1e3;for(let o=0;o<a;o++)t*=2;await new Promise(o=>setTimeout(o,t+Math.floor(Math.random()*2700+300)))},shouldRetry:F=J,isFatalConnectionProblem:u,on:r,webSocketImpl:S,generateID:L=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const t=Math.random()*16|0;return(a=="x"?t:t&3|8).toString(16)})},jsonMessageReplacer:U,jsonMessageReviver:ee}=e;let T;if(S){if(!ae(S))throw new Error("Invalid WebSocket implementation provided");T=S}else typeof WebSocket<"u"?T=WebSocket:typeof D<"u"?T=D.WebSocket||D.MozWebSocket:typeof window<"u"&&(T=window.WebSocket||window.MozWebSocket);if(!T)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=T,d=(()=>{const n=(()=>{const t={};return{on(o,s){return t[o]=s,()=>{delete t[o]}},emit(o){var s;"id"in o&&((s=t[o.id])===null||s===void 0||s.call(t,o))}}})(),a={connecting:r?.connecting?[r.connecting]:[],opened:r?.opened?[r.opened]:[],connected:r?.connected?[r.connected]:[],ping:r?.ping?[r.ping]:[],pong:r?.pong?[r.pong]:[],message:r?.message?[n.emit,r.message]:[n.emit],closed:r?.closed?[r.closed]:[],error:r?.error?[r.error]:[]};return{onMessage:n.on,on(t,o){const s=a[t];return s.push(o),()=>{s.splice(s.indexOf(o),1)}},emit(t,...o){for(const s of[...a[t]])s(...o)}}})();function Q(n){const a=[d.on("error",t=>{a.forEach(o=>o()),n(t)}),d.on("closed",t=>{a.forEach(o=>o()),n(t)})]}let h,k=0,H,O=!1,j=0,C=!1;async function K(){clearTimeout(H);const[n,a]=await(h??(h=new Promise((s,y)=>(async()=>{if(O){if(await G(j),!k)return h=void 0,y({code:1e3,reason:"All Subscriptions Gone"});j++}d.emit("connecting",O);const i=new N(typeof m=="function"?await m():m,ne);let x,_;function B(){isFinite(E)&&E>0&&(clearTimeout(_),_=setTimeout(()=>{i.readyState===N.OPEN&&(i.send(W({type:c.Ping})),d.emit("ping",!1,void 0))},E))}Q(l=>{h=void 0,clearTimeout(x),clearTimeout(_),y(l),l instanceof Z&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=l=>d.emit("error",l),i.onclose=l=>d.emit("closed",l),i.onopen=async()=>{try{d.emit("opened",i);const l=typeof R=="function"?await R():R;if(i.readyState!==N.OPEN)return;i.send(W(l?{type:c.ConnectionInit,payload:l}:{type:c.ConnectionInit},U)),isFinite(q)&&q>0&&(x=setTimeout(()=>{i.close(g.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},q)),B()}catch(l){d.emit("error",l),i.close(g.InternalClientError,Y(l instanceof Error?l.message:new Error(l).message,"Internal client error"))}};let P=!1;i.onmessage=({data:l})=>{try{const p=oe(l,ee);if(d.emit("message",p),p.type==="ping"||p.type==="pong"){d.emit(p.type,!0,p.payload),p.type==="pong"?B():I||(i.send(W(p.payload?{type:c.Pong,payload:p.payload}:{type:c.Pong})),d.emit("pong",!1,p.payload));return}if(P)return;if(p.type!==c.ConnectionAck)throw new Error(`First message cannot be of type ${p.type}`);clearTimeout(x),P=!0,d.emit("connected",i,p.payload,O),O=!1,j=0,s([i,new Promise((ce,te)=>Q(te))])}catch(p){i.onmessage=null,d.emit("error",p),i.close(g.BadResponse,Y(p instanceof Error?p.message:new Error(p).message,"Bad response"))}}})())));n.readyState===N.CLOSING&&await a;let t=()=>{};const o=new Promise(s=>t=s);return[n,t,Promise.race([o.then(()=>{if(!k){const s=()=>n.close(1e3,"Normal Closure");isFinite(w)&&w>0?H=setTimeout(()=>{n.readyState===N.OPEN&&s()},w):s()}}),a])]}function V(n){if(J(n)&&(se(n.code)||[g.InternalServerError,g.InternalClientError,g.BadRequest,g.BadResponse,g.Unauthorized,g.SubprotocolNotAcceptable,g.SubscriberAlreadyExists,g.TooManyInitialisationRequests].includes(n.code)))throw n;if(C)return!1;if(J(n)&&n.code===1e3)return k>0;if(!z||j>=z||!F(n)||u?.(n))throw n;return O=!0}M||(async()=>{for(k++;;)try{const[,,n]=await K();await n}catch(n){try{if(!V(n))return}catch(a){return b?.(a)}}})();function X(n,a){const t=L(n);let o=!1,s=!1,y=()=>{k--,o=!0};return(async()=>{for(k++;;)try{const[i,x,_]=await K();if(o)return x();const B=d.onMessage(t,P=>{switch(P.type){case c.Next:{a.next(P.payload);return}case c.Error:{s=!0,o=!0,a.error(P.payload),y();return}case c.Complete:{o=!0,y();return}}});i.send(W({id:t,type:c.Subscribe,payload:n},U)),y=()=>{!o&&i.readyState===N.OPEN&&i.send(W({id:t,type:c.Complete},U)),k--,o=!0,x()},await _.finally(B);return}catch(i){if(!V(i))return}})().then(()=>{s||a.complete()}).catch(i=>{a.error(i)}),()=>{o||y()}}return{on:d.on,subscribe:X,iterate(n){const a=[],t={done:!1,error:null,resolve:()=>{}},o=X(n,{next(y){a.push(y),t.resolve()},error(y){t.done=!0,t.error=y,t.resolve()},complete(){t.done=!0,t.resolve()}}),s=function(){return ie(this,arguments,function*(){for(;;){for(a.length||(yield A(new Promise(x=>t.resolve=x)));a.length;)yield yield A(a.shift());if(t.error)throw t.error;if(t.done)return yield A(void 0)}})}();return s.throw=async y=>(t.done||(t.done=!0,t.error=y,t.resolve()),{done:!0,value:void 0}),s.return=async()=>(o(),{done:!0,value:void 0}),s},async dispose(){if(C=!0,h){const[n]=await h;n.close(1e3,"Normal Closure")}},terminate(){h&&d.emit("closed",new Z)}}}class Z extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function J(e){return $(e)&&"code"in e&&"reason"in e}function se(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function ae(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}export{g as CloseCode,ne as GRAPHQL_TRANSPORT_WS_PROTOCOL,c as MessageType,Z as TerminatedCloseEvent,pe as createClient,oe as parseMessage,W as stringifyMessage,v as validateMessage};
|
|
1
|
+
import{fG as D}from"./index-Bek3Nxot.js";function f(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function $(e){return f(e)==="object"}function re(e){return Array.isArray(e)&&e.length>0&&e.every(m=>"message"in m)}function Y(e,m){return e.length<124?e:m}const ne="graphql-transport-ws";var g;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(g||(g={}));var c;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(c||(c={}));function v(e){if(!$(e))throw new Error(`Message is expected to be an object, but got ${f(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${f(e.type)}`);switch(e.type){case c.ConnectionInit:case c.ConnectionAck:case c.Ping:case c.Pong:{if(e.payload!=null&&!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case c.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${f(e.payload.query)}`);if(e.payload.variables!=null&&!$(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${f(e.payload.variables)}`);if(e.payload.operationName!=null&&f(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${f(e.payload.operationName)}`);if(e.payload.extensions!=null&&!$(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${f(e.payload.extensions)}`);break}case c.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!$(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${f(e.payload)}`);break}case c.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!re(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case c.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${f(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function oe(e,m){return v(typeof e=="string"?JSON.parse(e,m):e)}function W(e,m){return v(e),JSON.stringify(e,m)}var A=function(e){return this instanceof A?(this.v=e,this):new A(e)},ie=function(e,m,R){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var M=R.apply(e,m||[]),b,w=[];return b={},E("next"),E("throw"),E("return"),b[Symbol.asyncIterator]=function(){return this},b;function E(u){M[u]&&(b[u]=function(r){return new Promise(function(S,L){w.push([u,r,S,L])>1||I(u,r)})})}function I(u,r){try{q(M[u](r))}catch(S){G(w[0][3],S)}}function q(u){u.value instanceof A?Promise.resolve(u.value.v).then(z,F):G(w[0][2],u)}function z(u){I("next",u)}function F(u){I("throw",u)}function G(u,r){u(r),w.shift(),w.length&&I(w[0][0],w[0][1])}};function pe(e){const{url:m,connectionParams:R,lazy:M=!0,onNonLazyError:b=console.error,lazyCloseTimeout:w=0,keepAlive:E=0,disablePong:I,connectionAckWaitTimeout:q=0,retryAttempts:z=5,retryWait:F=async function(a){let t=1e3;for(let o=0;o<a;o++)t*=2;await new Promise(o=>setTimeout(o,t+Math.floor(Math.random()*2700+300)))},shouldRetry:G=J,isFatalConnectionProblem:u,on:r,webSocketImpl:S,generateID:L=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const t=Math.random()*16|0;return(a=="x"?t:t&3|8).toString(16)})},jsonMessageReplacer:U,jsonMessageReviver:ee}=e;let T;if(S){if(!ae(S))throw new Error("Invalid WebSocket implementation provided");T=S}else typeof WebSocket<"u"?T=WebSocket:typeof D<"u"?T=D.WebSocket||D.MozWebSocket:typeof window<"u"&&(T=window.WebSocket||window.MozWebSocket);if(!T)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const N=T,d=(()=>{const n=(()=>{const t={};return{on(o,s){return t[o]=s,()=>{delete t[o]}},emit(o){var s;"id"in o&&((s=t[o.id])===null||s===void 0||s.call(t,o))}}})(),a={connecting:r?.connecting?[r.connecting]:[],opened:r?.opened?[r.opened]:[],connected:r?.connected?[r.connected]:[],ping:r?.ping?[r.ping]:[],pong:r?.pong?[r.pong]:[],message:r?.message?[n.emit,r.message]:[n.emit],closed:r?.closed?[r.closed]:[],error:r?.error?[r.error]:[]};return{onMessage:n.on,on(t,o){const s=a[t];return s.push(o),()=>{s.splice(s.indexOf(o),1)}},emit(t,...o){for(const s of[...a[t]])s(...o)}}})();function Q(n){const a=[d.on("error",t=>{a.forEach(o=>o()),n(t)}),d.on("closed",t=>{a.forEach(o=>o()),n(t)})]}let h,k=0,H,O=!1,j=0,C=!1;async function K(){clearTimeout(H);const[n,a]=await(h??(h=new Promise((s,y)=>(async()=>{if(O){if(await F(j),!k)return h=void 0,y({code:1e3,reason:"All Subscriptions Gone"});j++}d.emit("connecting",O);const i=new N(typeof m=="function"?await m():m,ne);let x,_;function B(){isFinite(E)&&E>0&&(clearTimeout(_),_=setTimeout(()=>{i.readyState===N.OPEN&&(i.send(W({type:c.Ping})),d.emit("ping",!1,void 0))},E))}Q(l=>{h=void 0,clearTimeout(x),clearTimeout(_),y(l),l instanceof Z&&(i.close(4499,"Terminated"),i.onerror=null,i.onclose=null)}),i.onerror=l=>d.emit("error",l),i.onclose=l=>d.emit("closed",l),i.onopen=async()=>{try{d.emit("opened",i);const l=typeof R=="function"?await R():R;if(i.readyState!==N.OPEN)return;i.send(W(l?{type:c.ConnectionInit,payload:l}:{type:c.ConnectionInit},U)),isFinite(q)&&q>0&&(x=setTimeout(()=>{i.close(g.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},q)),B()}catch(l){d.emit("error",l),i.close(g.InternalClientError,Y(l instanceof Error?l.message:new Error(l).message,"Internal client error"))}};let P=!1;i.onmessage=({data:l})=>{try{const p=oe(l,ee);if(d.emit("message",p),p.type==="ping"||p.type==="pong"){d.emit(p.type,!0,p.payload),p.type==="pong"?B():I||(i.send(W(p.payload?{type:c.Pong,payload:p.payload}:{type:c.Pong})),d.emit("pong",!1,p.payload));return}if(P)return;if(p.type!==c.ConnectionAck)throw new Error(`First message cannot be of type ${p.type}`);clearTimeout(x),P=!0,d.emit("connected",i,p.payload,O),O=!1,j=0,s([i,new Promise((ce,te)=>Q(te))])}catch(p){i.onmessage=null,d.emit("error",p),i.close(g.BadResponse,Y(p instanceof Error?p.message:new Error(p).message,"Bad response"))}}})())));n.readyState===N.CLOSING&&await a;let t=()=>{};const o=new Promise(s=>t=s);return[n,t,Promise.race([o.then(()=>{if(!k){const s=()=>n.close(1e3,"Normal Closure");isFinite(w)&&w>0?H=setTimeout(()=>{n.readyState===N.OPEN&&s()},w):s()}}),a])]}function V(n){if(J(n)&&(se(n.code)||[g.InternalServerError,g.InternalClientError,g.BadRequest,g.BadResponse,g.Unauthorized,g.SubprotocolNotAcceptable,g.SubscriberAlreadyExists,g.TooManyInitialisationRequests].includes(n.code)))throw n;if(C)return!1;if(J(n)&&n.code===1e3)return k>0;if(!z||j>=z||!G(n)||u?.(n))throw n;return O=!0}M||(async()=>{for(k++;;)try{const[,,n]=await K();await n}catch(n){try{if(!V(n))return}catch(a){return b?.(a)}}})();function X(n,a){const t=L(n);let o=!1,s=!1,y=()=>{k--,o=!0};return(async()=>{for(k++;;)try{const[i,x,_]=await K();if(o)return x();const B=d.onMessage(t,P=>{switch(P.type){case c.Next:{a.next(P.payload);return}case c.Error:{s=!0,o=!0,a.error(P.payload),y();return}case c.Complete:{o=!0,y();return}}});i.send(W({id:t,type:c.Subscribe,payload:n},U)),y=()=>{!o&&i.readyState===N.OPEN&&i.send(W({id:t,type:c.Complete},U)),k--,o=!0,x()},await _.finally(B);return}catch(i){if(!V(i))return}})().then(()=>{s||a.complete()}).catch(i=>{a.error(i)}),()=>{o||y()}}return{on:d.on,subscribe:X,iterate(n){const a=[],t={done:!1,error:null,resolve:()=>{}},o=X(n,{next(y){a.push(y),t.resolve()},error(y){t.done=!0,t.error=y,t.resolve()},complete(){t.done=!0,t.resolve()}}),s=function(){return ie(this,arguments,function*(){for(;;){for(a.length||(yield A(new Promise(x=>t.resolve=x)));a.length;)yield yield A(a.shift());if(t.error)throw t.error;if(t.done)return yield A(void 0)}})}();return s.throw=async y=>(t.done||(t.done=!0,t.error=y,t.resolve()),{done:!0,value:void 0}),s.return=async()=>(o(),{done:!0,value:void 0}),s},async dispose(){if(C=!0,h){const[n]=await h;n.close(1e3,"Normal Closure")}},terminate(){h&&d.emit("closed",new Z)}}}class Z extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function J(e){return $(e)&&"code"in e&&"reason"in e}function se(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function ae(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}export{g as CloseCode,ne as GRAPHQL_TRANSPORT_WS_PROTOCOL,c as MessageType,Z as TerminatedCloseEvent,pe as createClient,oe as parseMessage,W as stringifyMessage,v as validateMessage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aF as je,j as e,u as Q,r as g,e as $e,aG as Wr,aH as E,aI as ln,aJ as Vn,aK as qr,aL as cn,aM as rt,V as M,ad as le,s as re,aN as dn,o as f,aO as Hr,aP as un,aQ as Gr,H as te,N as mn,T as L,t as H,P as fe,aR as _e,C as K,Y as be,v as Z,aS as Xn,Z as pe,J as W,p as mt,F as Kr,U as V,aE as Ie,a9 as et,O as it,aT as Yr,d as Ht,aU as Fe,aV as me,aa as Vr,aW as Xr,aX as Qr,y as Zr,A as Qn,W as fn,g as pn,h as ne,aY as Gt,a as _t,b as ft,aZ as Zn,a_ as Jn,X as er,a4 as It,a$ as Jr,b0 as ei,b1 as ti,b2 as ni,b3 as ot,i as gn,b4 as ri,b5 as ii,a6 as kt,b6 as oi,a7 as Lt,L as Kt,M as ai,b7 as si,b8 as tr,a8 as li,b9 as nr,ba as De,bb as Te,bc as ci,bd as Yt,be as di,$ as rr,D as Ft,f as ir,bf as ui,bg as hn,ak as mi,bh as fi,bi as ee,bj as pi,S as xn,l as yn,m as bn,bk as gi,bl as hi,bm as xi}from"./index-
|
|
1
|
+
import{aF as je,j as e,u as Q,r as g,e as $e,aG as Wr,aH as E,aI as ln,aJ as Vn,aK as qr,aL as cn,aM as rt,V as M,ad as le,s as re,aN as dn,o as f,aO as Hr,aP as un,aQ as Gr,H as te,N as mn,T as L,t as H,P as fe,aR as _e,C as K,Y as be,v as Z,aS as Xn,Z as pe,J as W,p as mt,F as Kr,U as V,aE as Ie,a9 as et,O as it,aT as Yr,d as Ht,aU as Fe,aV as me,aa as Vr,aW as Xr,aX as Qr,y as Zr,A as Qn,W as fn,g as pn,h as ne,aY as Gt,a as _t,b as ft,aZ as Zn,a_ as Jn,X as er,a4 as It,a$ as Jr,b0 as ei,b1 as ti,b2 as ni,b3 as ot,i as gn,b4 as ri,b5 as ii,a6 as kt,b6 as oi,a7 as Lt,L as Kt,M as ai,b7 as si,b8 as tr,a8 as li,b9 as nr,ba as De,bb as Te,bc as ci,bd as Yt,be as di,$ as rr,D as Ft,f as ir,bf as ui,bg as hn,ak as mi,bh as fi,bi as ee,bj as pi,S as xn,l as yn,m as bn,bk as gi,bl as hi,bm as xi}from"./index-Bek3Nxot.js";import{u as yi,T as bi}from"./html-title-BpNgi7iw.js";import{A as vi}from"./ArrowDropDown-lsZjWbH5.js";import{u as Vt,C as B,a as vn}from"./index.esm-WZ7Avw4n.js";import{S as se,a as ji}from"./switch-control-X9WA2UjB.js";import{P as ie}from"./permission-D09K4EY6.js";import{H as or,g as wi}from"./index-BHQcEGDq.js";import{A as ar}from"./Link-Mg5UlAaZ.js";import{A as Ci}from"./actions-D1YtdqKL.js";import{D as ve}from"./Delete-B306vkSB.js";import{D as pt}from"./delete-confirm-Cx4JPY2I.js";import{v as at}from"./index-B8qqbKQt.js";import{s as Si}from"./logo-BKA11TRi.js";import{R as sr,a as Ot,b as ki}from"./url-evaluation-DetQFE_e.js";import{u as Di}from"./useLocalStorage-Dpl2DibN.js";import{R as Ti}from"./Refresh-B0_3c6OW.js";import{L as Ri}from"./LoadingButton-DtnAWL1w.js";import{C as Ei,R as Pi,P as lr,S as Ai}from"./rotate-session-key-Bfdv46s3.js";import{A as Oe}from"./Add-b-MNk7UB.js";import{B as cr,D as jn,W as Ke}from"./status-B-GGRrEB.js";import{i as _i}from"./is-path-prefix-equal-BAfeJQQq.js";import{N as Ii}from"./ChevronRight-BKFXnJ7g.js";import{I as Li}from"./MoreVert-KNjOpSoE.js";import{E as dr}from"./Edit-DFmlgA7E.js";import{A as Fi}from"./CallMerge-CF5jo3Pw.js";import{C as Oi}from"./CardContent-CYNmFsYJ.js";import"./FilterList-Dphn1UXx.js";import"./CSSTransition-DinXVMZy.js";import"./emotion-cache.browser.esm-Epiq9rij.js";import"./index-CsTd8Q4H.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-Cvglsxh5.js";import"./index-CDd3s2GI.js";import"./TableSearch-DxZYknBa.js";import"./Search-CUoYhy1v.js";import"./Clear-Chg9fOPG.js";import"./click-to-copy-BbJJzGI1.js";import"./visuallyHidden-Dan1xhjv.js";const Ni=je(e.jsx("path",{d:"m7 14 5-5 5 5z"})),$i=je(e.jsx("path",{d:"M12 3 2 21h20zm1 5.92L18.6 19H13zm-2 0V19H5.4z"})),Ui=je(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 15h-2v-2h2zm0-4h-2V7h2z"})),ur=je(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"})),zi=je(e.jsx("path",{d:"M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"})),Mi=je(e.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),Bi=je(e.jsx("path",{d:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9z"})),ye="Dashboard",mr=g.createContext({}),{Provider:Wi,Consumer:fs}=mr,wn=[ye,E.DOMAIN_FOR_IP_SITE,E.DOMAIN_FOR_IP_SITE_REGEXP],qi=(t,r)=>{if(t.name===E.DOMAIN_FOR_DEFAULT_SITE)return-1;if(r.name===E.DOMAIN_FOR_DEFAULT_SITE)return 1;const n=wn.includes(t.name),i=wn.includes(r.name);return n&&i?cn(t.name,r.name):n?-1:i?1:cn(t.name,r.name)},Cn=({sites:t,nodePort:r})=>{const n=window.location.hostname,a=(t||[]).map(o=>{const{id:s,rules:d=[],corsAllowedOrigins:m=[]}=o;let{domain:c,domainAliases:u}=o;u=u||[],[E.DOMAIN_FOR_IP_SITE,E.DOMAIN_FOR_IP_SITE_REGEXP].includes(c)&&(c=ye,u.find(v=>v.value===n)||u.unshift({protected:!1,value:n}));const j={id:s,name:c,type:"domain",items:[],domainAliases:u,isProtected:o.isProtected,corsAllowedOrigins:m};return(d||[]).forEach(v=>{const{id:h,isProtected:S,from:{pathPrefix:b},to:k}=v;if(k.type===E.ROUTING_RULE_TYPES.BLOCKLET){let D="";Number.parseInt(k.port,10)===Number.parseInt(r,10)?(D="Blocklet Server Dashboard",k.type=E.ROUTING_RULE_TYPES.DAEMON):D=k.did,j.items.push({id:h,name:ln(b||"/"),title:D,type:"rule",isProtected:S,pathPrefix:b,to:k})}else j.items.push({id:h,pathPrefix:b,name:ln(b||"/"),title:"Blocklet Server Dashboard",type:"rule",isProtected:S,to:k})}),j.items=Vn(j.items,v=>v.name),j}).sort(qi),l=a.reduce((o,s)=>{let{name:d}=s;return d.endsWith(E.BLOCKLET_SITE_GROUP_SUFFIX)&&([d]=d.split(".")),o[d]={...s,rules:s.items},o},{});return{sites:a,siteMap:l}},Hi=({did:t,domain:r,mountPoint:n,siteMap:i,params:a}={})=>{if(!i)return null;const l=i[t];if(!l)return null;const o=r||(l.domainAliases||[])[0];if(!o)return null;let s=n;if(!s){const d=l.rules.filter(m=>!m.name.startsWith(E.WELLKNOWN_PATH_PREFIX))[0];s=d?d.name:"/"}return rt(o.value,s,a)},Gi=({did:t,mountPoint:r,siteMap:n,params:i}={})=>{if(!n)return[];const a=n[t];if(!a)return[];const l=a.domainAliases||[];if(!l.length)return[];let o=r;if(!o){const s=a.rules.filter(d=>!d.name.startsWith(E.WELLKNOWN_PATH_PREFIX))[0];o=s?s.name:"/"}return l.map(s=>rt(s.value,o,i))},Ki=t=>{const r=t.map(i=>i.domain).filter(i=>![E.DOMAIN_FOR_IP_SITE_REGEXP,E.DOMAIN_FOR_DEFAULT_SITE].includes(i));let n=[];return t.forEach(i=>n.push(...i.domainAliases||[])),n=n.map(i=>typeof i=="string"?{value:i,isProtected:!1}:i),{domains:r,domainsAliases:n}};function Sn({children:t}){const{api:r,info:n}=Q(),[i,a]=g.useState([]),[l,o]=g.useState([]),[s,d]=g.useState([]),m=$e(async()=>{const{sites:y}=await r.getRoutingSites({input:{snapshotHash:""}}),P=y||[];await Promise.all(P.map(async w=>(w.domainAliases=await Wr(w.domainAliases,{getIP:qr}),w)));const x=Ki(P);a(P),o(x.domains);const p=Cn({sites:P,nodePort:n.port});d((p?.sites||[]).map(w=>w.domainAliases.map(A=>A.value)).filter(w=>w.length))},[n]),c=(y,P)=>{a(x=>x.map(p=>p.id===y?P.domain?P:{...P,domain:p.domain}:p))},u=async y=>{const P=await r.addRoutingSite({input:y});a(i.concat(P.site))},j=async(y,P)=>{const x=await r.updateRoutingSite({input:{id:y,...P}});if(x.site&&x.site.id){const p=i.findIndex(w=>w.id===x.site.id);p!==-1&&(i.splice(p,1,x.site),a([].concat(i)))}},v=async y=>{await r.deleteRoutingSite({input:{id:y}}),a(i.filter(P=>P.id!==y))},h=async(y,P,x)=>{const p=await r.addDomainAlias({input:{id:y,domainAlias:P,force:x}});c(y,p.site)},S=async(y,P)=>{const x=await r.deleteDomainAlias({input:{id:y,domainAlias:P}});c(y,x.site)},b=async(y,P)=>{const{site:x}=await r.addRoutingRule({input:{id:y,rule:P}});c(y,x)},k=async(y,P)=>{const{site:x}=await r.updateRoutingRule({input:{id:y,rule:P}});c(y,x)},D=async(y,P)=>{const{site:x}=await r.deleteRoutingRule({input:{id:y,ruleId:P}});c(y,x)},C={loading:m.loading,error:m.error,refresh:m.retry,api:r,actions:{addSite:u,updateSite:j,deleteSite:v,addDomainAlias:h,deleteDomainAlias:S,addRule:b,updateRule:k,deleteRule:D}},{sites:T,siteMap:R}=Cn({sites:i,nodePort:n.port});return C.sites=T,C.siteMap=R,C.domains=l,C.allDomains=s,C.getBlockletUrl=({did:y,domain:P,mountPoint:x,params:p})=>Hi({did:y,domain:P,mountPoint:x,siteMap:C.siteMap,params:p}),C.getBlockletUrls=({did:y,mountPoint:P,params:x})=>Gi({did:y,mountPoint:P,siteMap:C.siteMap,params:x}),e.jsx(Wi,{value:{routing:C},children:t})}function de(){const{routing:t}=g.useContext(mr);return t}function Xt(t){const r=[E.DOMAIN_FOR_IP_SITE_REGEXP,E.DOMAIN_FOR_DEFAULT_SITE,E.DOMAIN_FOR_IP_SITE];return typeof window<"u"&&typeof window.location<"u"&&r.push(window.location.hostname),r.includes(t)}function Yi(){return null}function fr({confirm:t=null}){const[r,n]=g.useState(null),{t:i}=M(),a=()=>{n(null)},l=async s=>{if(s){let d=window.env&&window.env.apiPrefix?window.env.apiPrefix:"/";d==="/"?dn.push(`${s.pathname}`):(d.endsWith("/")&&(d=d.substring(0,d.length-1)),dn.push(`${d}${s.pathname}`)),window.location.reload()}},o=(s,...d)=>{let m=typeof t=="function"?t(s,...d):t;return m?(typeof m=="string"&&(m={description:m}),n({title:i("common.noticeTitle"),description:i("common.leavePageTip"),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>l(s),onCancel:()=>a(),...m}),!1):!0};return e.jsxs(Vi,{children:[e.jsx(Yi,{message:o}),r&&e.jsx(le,{title:r.title,description:r.description,confirm:r.confirm,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}fr.propTypes={confirm:f.oneOfType([f.object,f.string,f.func])};const Vi=re.div`
|
|
2
2
|
margin-bottom: 24px;
|
|
3
3
|
.top-btns-alert {
|
|
4
4
|
@media (max-width: ${t=>t.theme.breakpoints.values.sm}px) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{be as v,r as at}from"./index-BAMKzu46.js";var he=e=>e.type==="checkbox",ue=e=>e instanceof Date,$=e=>e==null;const _t=e=>typeof e=="object";var P=e=>!$(e)&&!Array.isArray(e)&&_t(e)&&!ue(e),ht=e=>P(e)&&e.target?he(e.target)?e.target.checked:e.target.value:e,Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mt=(e,r)=>e.has(Nt(r)),Bt=e=>{const r=e.constructor&&e.constructor.prototype;return P(r)&&r.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function T(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(!(je&&(e instanceof Blob||i))&&(t||P(e)))if(r=t?[]:{},!t&&!Bt(e))r=e;else for(const n in e)e.hasOwnProperty(n)&&(r[n]=T(e[n]));else return e;return r}var Se=e=>/^\w*$/.test(e),U=e=>e===void 0,we=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>we(e.replace(/["|']|\]/g,"").split(/\.|\[/)),c=(e,r,t)=>{if(!r||!P(e))return t;const i=(Se(r)?[r]:Ke(r)).reduce((n,l)=>$(n)?n:n[l],e);return U(i)||i===e?U(e[r])?t:e[r]:i},Q=e=>typeof e=="boolean",E=(e,r,t)=>{let i=-1;const n=Se(r)?[r]:Ke(r),l=n.length,f=l-1;for(;++i<l;){const d=n[i];let b=t;if(i!==f){const x=e[d];b=P(x)||Array.isArray(x)?x:isNaN(+n[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=b,e=e[d]}};const Fe={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vt=v.createContext(null);vt.displayName="HookFormContext";const ke=()=>v.useContext(vt);var bt=(e,r,t,i=!0)=>{const n={defaultValues:r._defaultValues};for(const l in e)Object.defineProperty(n,l,{get:()=>{const f=l;return r._proxyFormState[f]!==Z.all&&(r._proxyFormState[f]=!i||Z.all),t&&(t[f]=!0),e[f]}});return n};const De=typeof window<"u"?at.useLayoutEffect:at.useEffect;function Pt(e){const r=ke(),{control:t=r.control,disabled:i,name:n,exact:l}=e||{},[f,d]=v.useState(t._formState),b=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return De(()=>t._subscribe({name:n,formState:b.current,exact:l,callback:x=>{!i&&d({...t._formState,...x})}}),[n,i,l]),v.useEffect(()=>{b.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>bt(f,t,b.current,!1),[f,t])}var se=e=>typeof e=="string",Ft=(e,r,t,i,n)=>se(e)?(i&&r.watch.add(e),c(t,e,n)):Array.isArray(e)?e.map(l=>(i&&r.watch.add(l),c(t,l))):(i&&(r.watchAll=!0),t);function Wt(e){const r=ke(),{control:t=r.control,name:i,defaultValue:n,disabled:l,exact:f}=e||{},d=v.useRef(n),[b,x]=v.useState(t._getWatch(i,d.current));return De(()=>t._subscribe({name:i,formState:{values:!0},exact:f,callback:D=>!l&&x(Ft(i,t._names,D.values||t._formValues,!1,d.current))}),[i,t,l,f]),v.useEffect(()=>t._removeUnmounted()),b}function qt(e){const r=ke(),{name:t,disabled:i,control:n=r.control,shouldUnregister:l}=e,f=mt(n._names.array,t),d=Wt({control:n,name:t,defaultValue:c(n._formValues,t,c(n._defaultValues,t,e.defaultValue)),exact:!0}),b=Pt({control:n,name:t,exact:!0}),x=v.useRef(e),D=v.useRef(n.register(t,{...e.rules,value:d,...Q(e.disabled)?{disabled:e.disabled}:{}})),C=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!c(b.errors,t)},isDirty:{enumerable:!0,get:()=>!!c(b.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!c(b.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!c(b.validatingFields,t)},error:{enumerable:!0,get:()=>c(b.errors,t)}}),[b,t]),F=v.useCallback(L=>D.current.onChange({target:{value:ht(L),name:t},type:Fe.CHANGE}),[t]),M=v.useCallback(()=>D.current.onBlur({target:{value:c(n._formValues,t),name:t},type:Fe.BLUR}),[t,n._formValues]),z=v.useCallback(L=>{const ee=c(n._fields,t);ee&&L&&(ee._f.ref={focus:()=>L.focus&&L.focus(),select:()=>L.select&&L.select(),setCustomValidity:V=>L.setCustomValidity(V),reportValidity:()=>L.reportValidity()})},[n._fields,t]),R=v.useMemo(()=>({name:t,value:d,...Q(i)||b.disabled?{disabled:b.disabled||i}:{},onChange:F,onBlur:M,ref:z}),[t,i,b.disabled,F,M,z,d]);return v.useEffect(()=>{const L=n._options.shouldUnregister||l;n.register(t,{...x.current.rules,...Q(x.current.disabled)?{disabled:x.current.disabled}:{}});const ee=(V,G)=>{const W=c(n._fields,V);W&&W._f&&(W._f.mount=G)};if(ee(t,!0),L){const V=T(c(n._options.defaultValues,t));E(n._defaultValues,t,V),U(c(n._formValues,t))&&E(n._formValues,t,V)}return!f&&n.register(t),()=>{(f?L&&!n._state.action:L)?n.unregister(t):ee(t,!1)}},[t,n,f,l]),v.useEffect(()=>{n._setDisabledField({disabled:i,name:t})},[i,t,n]),v.useMemo(()=>({field:R,formState:b,fieldState:C}),[R,b,C])}const ar=e=>e.render(qt(e));var Ht=(e,r,t,i,n)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:n||!0}}:{},K=e=>Array.isArray(e)?e:[e],nt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const l of e)l.next&&l.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(l=>l!==n)}}),unsubscribe:()=>{e=[]}}},qe=e=>$(e)||!_t(e);function le(e,r,t=new WeakSet){if(qe(e)||qe(r))return e===r;if(ue(e)&&ue(r))return e.getTime()===r.getTime();const i=Object.keys(e),n=Object.keys(r);if(i.length!==n.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const l of i){const f=e[l];if(!n.includes(l))return!1;if(l!=="ref"){const d=r[l];if(ue(f)&&ue(d)||P(f)&&P(d)||Array.isArray(f)&&Array.isArray(d)?!le(f,d,t):f!==d)return!1}}return!0}var H=e=>P(e)&&!Object.keys(e).length,ze=e=>e.type==="file",te=e=>typeof e=="function",Ve=e=>{if(!je)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Vt=e=>e.type==="select-multiple",Ge=e=>e.type==="radio",$t=e=>Ge(e)||he(e),Me=e=>Ve(e)&&e.isConnected;function jt(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=U(e)?i++:e[r[i++]];return e}function Kt(e){for(const r in e)if(e.hasOwnProperty(r)&&!U(e[r]))return!1;return!0}function B(e,r){const t=Array.isArray(r)?r:Se(r)?[r]:Ke(r),i=t.length===1?e:jt(e,t),n=t.length-1,l=t[n];return i&&delete i[l],n!==0&&(P(i)&&H(i)||Array.isArray(i)&&Kt(i))&&B(e,t.slice(0,-1)),e}var At=e=>{for(const r in e)if(te(e[r]))return!0;return!1};function Ae(e,r={}){const t=Array.isArray(e);if(P(e)||t)for(const i in e)Array.isArray(e[i])||P(e[i])&&!At(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ae(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function xt(e,r,t){const i=Array.isArray(e);if(P(e)||i)for(const n in e)Array.isArray(e[n])||P(e[n])&&!At(e[n])?U(r)||qe(t[n])?t[n]=Array.isArray(e[n])?Ae(e[n],[]):{...Ae(e[n])}:xt(e[n],$(r)?{}:r[n],t[n]):t[n]=!le(e[n],r[n]);return t}var ge=(e,r)=>xt(e,r,Ae(r));const lt={value:!1,isValid:!1},ut={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?ut:{value:e[0].value,isValid:!0}:ut:lt}return lt},wt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>U(e)?e:r?e===""?NaN:e&&+e:t&&se(e)?new Date(e):i?i(e):e;const ot={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,ot):ot;function ct(e){const r=e.ref;return ze(r)?r.files:Ge(r)?kt(e.refs).value:Vt(r)?[...r.selectedOptions].map(({value:t})=>t):he(r)?St(e.refs).value:wt(U(r.value)?e.ref.value:r.value,e)}var zt=(e,r,t,i)=>{const n={};for(const l of e){const f=c(r,l);f&&E(n,l,f._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},xe=e=>e instanceof RegExp,_e=e=>U(e)?e:xe(e)?e.source:P(e)?xe(e.value)?e.value.source:e.value:e,de=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const dt="AsyncFunction";var Gt=e=>!!e&&!!e.validate&&!!(te(e.validate)&&e.validate.constructor.name===dt||P(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===dt)),Yt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),He=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const fe=(e,r,t,i)=>{for(const n of t||Object.keys(e)){const l=c(e,n);if(l){const{_f:f,...d}=l;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],n)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(fe(d,r))break}else if(P(d)&&fe(d,r))break}}};function ft(e,r,t){const i=c(e,t);if(i||Se(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const l=n.join("."),f=c(r,l),d=c(e,l);if(f&&!Array.isArray(f)&&t!==l)return{name:t};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};n.pop()}return{name:t}}var Jt=(e,r,t,i)=>{t(e);const{name:n,...l}=e;return H(l)||Object.keys(l).length>=Object.keys(r).length||Object.keys(l).find(f=>r[f]===(!i||Z.all))},Qt=(e,r,t)=>!e||!r||e===r||K(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Xt=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Zt=(e,r)=>!we(c(e,r)).length&&B(e,r),Dt=(e,r,t)=>{const i=K(c(e,t));return E(i,"root",r[t]),E(e,t,i),e},be=e=>se(e);function yt(e,r,t="validate"){if(be(e)||Array.isArray(e)&&e.every(be)||Q(e)&&!e)return{type:t,message:be(e)?e:"",ref:r}}var ce=e=>P(e)&&!xe(e)?e:{value:e,message:""},$e=async(e,r,t,i,n,l)=>{const{ref:f,refs:d,required:b,maxLength:x,minLength:D,min:C,max:F,pattern:M,validate:z,name:R,valueAsNumber:L,mount:ee}=e._f,V=c(t,R);if(!ee||r.has(R))return{};const G=d?d[0]:f,W=w=>{n&&G.reportValidity&&(G.setCustomValidity(Q(w)?"":w||""),G.reportValidity())},I={},m=Ge(f),h=he(f),A=m||h,S=(L||ze(f))&&U(f.value)&&U(V)||Ve(f)&&f.value===""||V===""||Array.isArray(V)&&!V.length,Y=Ht.bind(null,R,i,I),J=(w,p,N,q=ie.maxLength,j=ie.minLength)=>{const re=w?p:N;I[R]={type:w?q:j,message:re,ref:f,...Y(w?q:j,re)}};if(l?!Array.isArray(V)||!V.length:b&&(!A&&(S||$(V))||Q(V)&&!V||h&&!St(d).isValid||m&&!kt(d).isValid)){const{value:w,message:p}=be(b)?{value:!!b,message:b}:ce(b);if(w&&(I[R]={type:ie.required,message:p,ref:G,...Y(ie.required,p)},!i))return W(p),I}if(!S&&(!$(C)||!$(F))){let w,p;const N=ce(F),q=ce(C);if(!$(V)&&!isNaN(V)){const j=f.valueAsNumber||V&&+V;$(N.value)||(w=j>N.value),$(q.value)||(p=j<q.value)}else{const j=f.valueAsDate||new Date(V),re=me=>new Date(new Date().toDateString()+" "+me),ye=f.type=="time",oe=f.type=="week";se(N.value)&&V&&(w=ye?re(V)>re(N.value):oe?V>N.value:j>new Date(N.value)),se(q.value)&&V&&(p=ye?re(V)<re(q.value):oe?V<q.value:j<new Date(q.value))}if((w||p)&&(J(!!w,N.message,q.message,ie.max,ie.min),!i))return W(I[R].message),I}if((x||D)&&!S&&(se(V)||l&&Array.isArray(V))){const w=ce(x),p=ce(D),N=!$(w.value)&&V.length>+w.value,q=!$(p.value)&&V.length<+p.value;if((N||q)&&(J(N,w.message,p.message),!i))return W(I[R].message),I}if(M&&!S&&se(V)){const{value:w,message:p}=ce(M);if(xe(w)&&!V.match(w)&&(I[R]={type:ie.pattern,message:p,ref:f,...Y(ie.pattern,p)},!i))return W(p),I}if(z){if(te(z)){const w=await z(V,t),p=yt(w,G);if(p&&(I[R]={...p,...Y(ie.validate,p.message)},!i))return W(p.message),I}else if(P(z)){let w={};for(const p in z){if(!H(w)&&!i)break;const N=yt(await z[p](V,t),G,p);N&&(w={...N,...Y(p,N.message)},W(N.message),i&&(I[R]=w))}if(!H(w)&&(I[R]={ref:G,...w},!i))return I}}return W(!0),I};const er={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function tr(e={}){let r={...er,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1};const i={};let n=P(r.defaultValues)||P(r.values)?T(r.defaultValues||r.values)||{}:{},l=r.shouldUnregister?{}:T(n),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,x=0;const D={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let C={...D};const F={array:nt(),state:nt()},M=r.criteriaMode===Z.all,z=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},R=async s=>{if(!r.disabled&&(D.isValid||C.isValid||s)){const a=r.resolver?H((await h()).errors):await S(i,!0);a!==t.isValid&&F.state.next({isValid:a})}},L=(s,a)=>{!r.disabled&&(D.isValidating||D.validatingFields||C.isValidating||C.validatingFields)&&((s||Array.from(d.mount)).forEach(u=>{u&&(a?E(t.validatingFields,u,a):B(t.validatingFields,u))}),F.state.next({validatingFields:t.validatingFields,isValidating:!H(t.validatingFields)}))},ee=(s,a=[],u,g,y=!0,o=!0)=>{if(g&&u&&!r.disabled){if(f.action=!0,o&&Array.isArray(c(i,s))){const _=u(c(i,s),g.argA,g.argB);y&&E(i,s,_)}if(o&&Array.isArray(c(t.errors,s))){const _=u(c(t.errors,s),g.argA,g.argB);y&&E(t.errors,s,_),Zt(t.errors,s)}if((D.touchedFields||C.touchedFields)&&o&&Array.isArray(c(t.touchedFields,s))){const _=u(c(t.touchedFields,s),g.argA,g.argB);y&&E(t.touchedFields,s,_)}(D.dirtyFields||C.dirtyFields)&&(t.dirtyFields=ge(n,l)),F.state.next({name:s,isDirty:J(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else E(l,s,a)},V=(s,a)=>{E(t.errors,s,a),F.state.next({errors:t.errors})},G=s=>{t.errors=s,F.state.next({errors:t.errors,isValid:!1})},W=(s,a,u,g)=>{const y=c(i,s);if(y){const o=c(l,s,U(u)?c(n,s):u);U(o)||g&&g.defaultChecked||a?E(l,s,a?o:ct(y._f)):N(s,o),f.mount&&R()}},I=(s,a,u,g,y)=>{let o=!1,_=!1;const k={name:s};if(!r.disabled){if(!u||g){(D.isDirty||C.isDirty)&&(_=t.isDirty,t.isDirty=k.isDirty=J(),o=_!==k.isDirty);const O=le(c(n,s),a);_=!!c(t.dirtyFields,s),O?B(t.dirtyFields,s):E(t.dirtyFields,s,!0),k.dirtyFields=t.dirtyFields,o=o||(D.dirtyFields||C.dirtyFields)&&_!==!O}if(u){const O=c(t.touchedFields,s);O||(E(t.touchedFields,s,u),k.touchedFields=t.touchedFields,o=o||(D.touchedFields||C.touchedFields)&&O!==u)}o&&y&&F.state.next(k)}return o?k:{}},m=(s,a,u,g)=>{const y=c(t.errors,s),o=(D.isValid||C.isValid)&&Q(a)&&t.isValid!==a;if(r.delayError&&u?(b=z(()=>V(s,u)),b(r.delayError)):(clearTimeout(x),b=null,u?E(t.errors,s,u):B(t.errors,s)),(u?!le(y,u):y)||!H(g)||o){const _={...g,...o&&Q(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,..._},F.state.next(_)}},h=async s=>{L(s,!0);const a=await r.resolver(l,r.context,zt(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return L(s),a},A=async s=>{const{errors:a}=await h(s);if(s)for(const u of s){const g=c(a,u);g?E(t.errors,u,g):B(t.errors,u)}else t.errors=a;return a},S=async(s,a,u={valid:!0})=>{for(const g in s){const y=s[g];if(y){const{_f:o,..._}=y;if(o){const k=d.array.has(o.name),O=y._f&&Gt(y._f);O&&D.validatingFields&&L([g],!0);const X=await $e(y,d.disabled,l,M,r.shouldUseNativeValidation&&!a,k);if(O&&D.validatingFields&&L([g]),X[o.name]&&(u.valid=!1,a))break;!a&&(c(X,o.name)?k?Dt(t.errors,X,o.name):E(t.errors,o.name,X[o.name]):B(t.errors,o.name))}!H(_)&&await S(_,a,u)}}return u.valid},Y=()=>{for(const s of d.unMount){const a=c(i,s);a&&(a._f.refs?a._f.refs.every(u=>!Me(u)):!Me(a._f.ref))&&Ee(s)}d.unMount=new Set},J=(s,a)=>!r.disabled&&(s&&a&&E(l,s,a),!le(me(),n)),w=(s,a,u)=>Ft(s,d,{...f.mount?l:U(a)?n:se(s)?{[s]:a}:a},u,a),p=s=>we(c(f.mount?l:n,s,r.shouldUnregister?c(n,s,[]):[])),N=(s,a,u={})=>{const g=c(i,s);let y=a;if(g){const o=g._f;o&&(!o.disabled&&E(l,s,wt(a,o)),y=Ve(o.ref)&&$(a)?"":a,Vt(o.ref)?[...o.ref.options].forEach(_=>_.selected=y.includes(_.value)):o.refs?he(o.ref)?o.refs.forEach(_=>{(!_.defaultChecked||!_.disabled)&&(Array.isArray(y)?_.checked=!!y.find(k=>k===_.value):_.checked=y===_.value||!!y)}):o.refs.forEach(_=>_.checked=_.value===y):ze(o.ref)?o.ref.value="":(o.ref.value=y,o.ref.type||F.state.next({name:s,values:T(l)})))}(u.shouldDirty||u.shouldTouch)&&I(s,y,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&oe(s)},q=(s,a,u)=>{for(const g in a){if(!a.hasOwnProperty(g))return;const y=a[g],o=s+"."+g,_=c(i,o);(d.array.has(s)||P(y)||_&&!_._f)&&!ue(y)?q(o,y,u):N(o,y,u)}},j=(s,a,u={})=>{const g=c(i,s),y=d.array.has(s),o=T(a);E(l,s,o),y?(F.array.next({name:s,values:T(l)}),(D.isDirty||D.dirtyFields||C.isDirty||C.dirtyFields)&&u.shouldDirty&&F.state.next({name:s,dirtyFields:ge(n,l),isDirty:J(s,o)})):g&&!g._f&&!$(o)?q(s,o,u):N(s,o,u),He(s,d)&&F.state.next({...t}),F.state.next({name:f.mount?s:void 0,values:T(l)})},re=async s=>{f.mount=!0;const a=s.target;let u=a.name,g=!0;const y=c(i,u),o=O=>{g=Number.isNaN(O)||ue(O)&&isNaN(O.getTime())||le(O,c(l,u,O))},_=de(r.mode),k=de(r.reValidateMode);if(y){let O,X;const ve=a.type?ct(y._f):ht(s),ae=s.type===Fe.BLUR||s.type===Fe.FOCUS_OUT,Lt=!Yt(y._f)&&!r.resolver&&!c(t.errors,u)&&!y._f.deps||Xt(ae,c(t.touchedFields,u),t.isSubmitted,k,_),Oe=He(u,d,ae);E(l,u,ve),ae?(y._f.onBlur&&y._f.onBlur(s),b&&b(0)):y._f.onChange&&y._f.onChange(s);const Ue=I(u,ve,ae),Tt=!H(Ue)||Oe;if(!ae&&F.state.next({name:u,type:s.type,values:T(l)}),Lt)return(D.isValid||C.isValid)&&(r.mode==="onBlur"?ae&&R():ae||R()),Tt&&F.state.next({name:u,...Oe?{}:Ue});if(!ae&&Oe&&F.state.next({...t}),r.resolver){const{errors:st}=await h([u]);if(o(ve),g){const It=ft(t.errors,i,u),it=ft(st,i,It.name||u);O=it.error,u=it.name,X=H(st)}}else L([u],!0),O=(await $e(y,d.disabled,l,M,r.shouldUseNativeValidation))[u],L([u]),o(ve),g&&(O?X=!1:(D.isValid||C.isValid)&&(X=await S(i,!0)));g&&(y._f.deps&&oe(y._f.deps),m(u,X,O,Ue))}},ye=(s,a)=>{if(c(t.errors,a)&&s.focus)return s.focus(),1},oe=async(s,a={})=>{let u,g;const y=K(s);if(r.resolver){const o=await A(U(s)?s:y);u=H(o),g=s?!y.some(_=>c(o,_)):u}else s?(g=(await Promise.all(y.map(async o=>{const _=c(i,o);return await S(_&&_._f?{[o]:_}:_)}))).every(Boolean),!(!g&&!t.isValid)&&R()):g=u=await S(i);return F.state.next({...!se(s)||(D.isValid||C.isValid)&&u!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!g&&fe(i,ye,s?y:d.mount),g},me=s=>{const a={...f.mount?l:n};return U(s)?a:se(s)?c(a,s):s.map(u=>c(a,u))},Ye=(s,a)=>({invalid:!!c((a||t).errors,s),isDirty:!!c((a||t).dirtyFields,s),error:c((a||t).errors,s),isValidating:!!c(t.validatingFields,s),isTouched:!!c((a||t).touchedFields,s)}),Et=s=>{s&&K(s).forEach(a=>B(t.errors,a)),F.state.next({errors:s?t.errors:{}})},Je=(s,a,u)=>{const g=(c(i,s,{_f:{}})._f||{}).ref,y=c(t.errors,s)||{},{ref:o,message:_,type:k,...O}=y;E(t.errors,s,{...O,...a,ref:g}),F.state.next({name:s,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&g&&g.focus&&g.focus()},pt=(s,a)=>te(s)?F.state.subscribe({next:u=>s(w(void 0,a),u)}):w(s,a,!0),Qe=s=>F.state.subscribe({next:a=>{Qt(s.name,a.name,s.exact)&&Jt(a,s.formState||D,Rt,s.reRenderRoot)&&s.callback({values:{...l},...t,...a})}}).unsubscribe,Ct=s=>(f.mount=!0,C={...C,...s.formState},Qe({...s,formState:C})),Ee=(s,a={})=>{for(const u of s?K(s):d.mount)d.mount.delete(u),d.array.delete(u),a.keepValue||(B(i,u),B(l,u)),!a.keepError&&B(t.errors,u),!a.keepDirty&&B(t.dirtyFields,u),!a.keepTouched&&B(t.touchedFields,u),!a.keepIsValidating&&B(t.validatingFields,u),!r.shouldUnregister&&!a.keepDefaultValue&&B(n,u);F.state.next({values:T(l)}),F.state.next({...t,...a.keepDirty?{isDirty:J()}:{}}),!a.keepIsValid&&R()},Xe=({disabled:s,name:a})=>{(Q(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},pe=(s,a={})=>{let u=c(i,s);const g=Q(a.disabled)||Q(r.disabled);return E(i,s,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),u?Xe({disabled:Q(a.disabled)?a.disabled:r.disabled,name:s}):W(s,!0,a.value),{...g?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:s,onChange:re,onBlur:re,ref:y=>{if(y){pe(s,a),u=c(i,s);const o=U(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,_=$t(o),k=u._f.refs||[];if(_?k.find(O=>O===o):o===u._f.ref)return;E(i,s,{_f:{...u._f,..._?{refs:[...k.filter(Me),o,...Array.isArray(c(n,s))?[{}]:[]],ref:{type:o.type,name:s}}:{ref:o}}}),W(s,!1,void 0,o)}else u=c(i,s,{}),u._f&&(u._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(mt(d.array,s)&&f.action)&&d.unMount.add(s)}}},Ce=()=>r.shouldFocusError&&fe(i,ye,d.mount),Ot=s=>{Q(s)&&(F.state.next({disabled:s}),fe(i,(a,u)=>{const g=c(i,u);g&&(a.disabled=g._f.disabled||s,Array.isArray(g._f.refs)&&g._f.refs.forEach(y=>{y.disabled=g._f.disabled||s}))},0,!1))},Ze=(s,a)=>async u=>{let g;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let y=T(l);if(F.state.next({isSubmitting:!0}),r.resolver){const{errors:o,values:_}=await h();t.errors=o,y=T(_)}else await S(i);if(d.disabled.size)for(const o of d.disabled)B(y,o);if(B(t.errors,"root"),H(t.errors)){F.state.next({errors:{}});try{await s(y,u)}catch(o){g=o}}else a&&await a({...t.errors},u),Ce(),setTimeout(Ce);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(t.errors)&&!g,submitCount:t.submitCount+1,errors:t.errors}),g)throw g},Ut=(s,a={})=>{c(i,s)&&(U(a.defaultValue)?j(s,T(c(n,s))):(j(s,a.defaultValue),E(n,s,T(a.defaultValue))),a.keepTouched||B(t.touchedFields,s),a.keepDirty||(B(t.dirtyFields,s),t.isDirty=a.defaultValue?J(s,T(c(n,s))):J()),a.keepError||(B(t.errors,s),D.isValid&&R()),F.state.next({...t}))},et=(s,a={})=>{const u=s?T(s):n,g=T(u),y=H(s),o=y?n:g;if(a.keepDefaultValues||(n=u),!a.keepValues){if(a.keepDirtyValues){const _=new Set([...d.mount,...Object.keys(ge(n,l))]);for(const k of Array.from(_))c(t.dirtyFields,k)?E(o,k,c(l,k)):j(k,c(o,k))}else{if(je&&U(s))for(const _ of d.mount){const k=c(i,_);if(k&&k._f){const O=Array.isArray(k._f.refs)?k._f.refs[0]:k._f.ref;if(Ve(O)){const X=O.closest("form");if(X){X.reset();break}}}}for(const _ of d.mount){const k=c(o,_,c(n,_));U(k)||(E(o,_,k),j(_,c(o,_)))}}l=T(o),F.array.next({values:{...o}}),F.state.next({values:{...o}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!D.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,F.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:y?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!le(s,n)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y?{}:a.keepDirtyValues?a.keepDefaultValues&&l?ge(n,l):t.dirtyFields:a.keepDefaultValues&&s?ge(n,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},tt=(s,a)=>et(te(s)?s(l):s,a),Mt=(s,a={})=>{const u=c(i,s),g=u&&u._f;if(g){const y=g.refs?g.refs[0]:g.ref;y.focus&&(y.focus(),a.shouldSelect&&te(y.select)&&y.select())}},Rt=s=>{t={...t,...s}},rt={control:{register:pe,unregister:Ee,getFieldState:Ye,handleSubmit:Ze,setError:Je,_subscribe:Qe,_runSchema:h,_focusError:Ce,_getWatch:w,_getDirty:J,_setValid:R,_setFieldArray:ee,_setDisabledField:Xe,_setErrors:G,_getFieldArray:p,_reset:et,_resetDefaultValues:()=>te(r.defaultValues)&&r.defaultValues().then(s=>{tt(s,r.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:Y,_disableForm:Ot,_subjects:F,_proxyFormState:D,get _fields(){return i},get _formValues(){return l},get _state(){return f},set _state(s){f=s},get _defaultValues(){return n},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Ct,trigger:oe,register:pe,handleSubmit:Ze,watch:pt,setValue:j,getValues:me,reset:tt,resetField:Ut,clearErrors:Et,unregister:Ee,setError:Je,setFocus:Mt,getFieldState:Ye};return{...rt,formControl:rt}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=(Math.random()*16+e)%16|0;return(r=="x"?t:t&3|8).toString(16)})},Re=(e,r,t={})=>t.shouldFocus||U(t.shouldFocus)?t.focusName||`${e}.${U(t.focusIndex)?r:t.focusIndex}.`:"",Le=(e,r)=>[...e,...K(r)],Te=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ie(e,r,t){return[...e.slice(0,r),...K(t),...e.slice(r)]}var Ne=(e,r,t)=>Array.isArray(e)?(U(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[],Be=(e,r)=>[...K(r),...K(e)];function rr(e,r){let t=0;const i=[...e];for(const n of r)i.splice(n-t,1),t++;return we(i).length?i:[]}var Pe=(e,r)=>U(r)?[]:rr(e,K(r).sort((t,i)=>t-i)),We=(e,r,t)=>{[e[r],e[t]]=[e[t],e[r]]},gt=(e,r,t)=>(e[r]=t,e);function nr(e){const r=ke(),{control:t=r.control,name:i,keyName:n="id",shouldUnregister:l,rules:f}=e,[d,b]=v.useState(t._getFieldArray(i)),x=v.useRef(t._getFieldArray(i).map(ne)),D=v.useRef(d),C=v.useRef(i),F=v.useRef(!1);C.current=i,D.current=d,t._names.array.add(i),f&&t.register(i,f),De(()=>t._subjects.array.subscribe({next:({values:m,name:h})=>{if(h===C.current||!h){const A=c(m,C.current);Array.isArray(A)&&(b(A),x.current=A.map(ne))}}}).unsubscribe,[t]);const M=v.useCallback(m=>{F.current=!0,t._setFieldArray(i,m)},[t,i]),z=(m,h)=>{const A=K(T(m)),S=Le(t._getFieldArray(i),A);t._names.focus=Re(i,S.length-1,h),x.current=Le(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Le,{argA:Te(m)})},R=(m,h)=>{const A=K(T(m)),S=Be(t._getFieldArray(i),A);t._names.focus=Re(i,0,h),x.current=Be(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Be,{argA:Te(m)})},L=m=>{const h=Pe(t._getFieldArray(i),m);x.current=Pe(x.current,m),M(h),b(h),!Array.isArray(c(t._fields,i))&&E(t._fields,i,void 0),t._setFieldArray(i,h,Pe,{argA:m})},ee=(m,h,A)=>{const S=K(T(h)),Y=Ie(t._getFieldArray(i),m,S);t._names.focus=Re(i,m,A),x.current=Ie(x.current,m,S.map(ne)),M(Y),b(Y),t._setFieldArray(i,Y,Ie,{argA:m,argB:Te(h)})},V=(m,h)=>{const A=t._getFieldArray(i);We(A,m,h),We(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,We,{argA:m,argB:h},!1)},G=(m,h)=>{const A=t._getFieldArray(i);Ne(A,m,h),Ne(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,Ne,{argA:m,argB:h},!1)},W=(m,h)=>{const A=T(h),S=gt(t._getFieldArray(i),m,A);x.current=[...S].map((Y,J)=>!Y||J===m?ne():x.current[J]),M(S),b([...S]),t._setFieldArray(i,S,gt,{argA:m,argB:A},!0,!1)},I=m=>{const h=K(T(m));x.current=h.map(ne),M([...h]),b([...h]),t._setFieldArray(i,[...h],A=>A,{},!0,!1)};return v.useEffect(()=>{if(t._state.action=!1,He(i,t._names)&&t._subjects.state.next({...t._formState}),F.current&&(!de(t._options.mode).isOnSubmit||t._formState.isSubmitted)&&!de(t._options.reValidateMode).isOnSubmit)if(t._options.resolver)t._runSchema([i]).then(m=>{const h=c(m.errors,i),A=c(t._formState.errors,i);(A?!h&&A.type||h&&(A.type!==h.type||A.message!==h.message):h&&h.type)&&(h?E(t._formState.errors,i,h):B(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const m=c(t._fields,i);m&&m._f&&!(de(t._options.reValidateMode).isOnSubmit&&de(t._options.mode).isOnSubmit)&&$e(m,t._names.disabled,t._formValues,t._options.criteriaMode===Z.all,t._options.shouldUseNativeValidation,!0).then(h=>!H(h)&&t._subjects.state.next({errors:Dt(t._formState.errors,h,i)}))}t._subjects.state.next({name:i,values:T(t._formValues)}),t._names.focus&&fe(t._fields,(m,h)=>{if(t._names.focus&&h.startsWith(t._names.focus)&&m.focus)return m.focus(),1}),t._names.focus="",t._setValid(),F.current=!1},[d,i,t]),v.useEffect(()=>(!c(t._formValues,i)&&t._setFieldArray(i),()=>{const m=(h,A)=>{const S=c(t._fields,h);S&&S._f&&(S._f.mount=A)};t._options.shouldUnregister||l?t.unregister(i):m(i,!1)}),[i,t,n,l]),{swap:v.useCallback(V,[M,i,t]),move:v.useCallback(G,[M,i,t]),prepend:v.useCallback(R,[M,i,t]),append:v.useCallback(z,[M,i,t]),remove:v.useCallback(L,[M,i,t]),insert:v.useCallback(ee,[M,i,t]),update:v.useCallback(W,[M,i,t]),replace:v.useCallback(I,[M,i,t]),fields:v.useMemo(()=>d.map((m,h)=>({...m,[n]:x.current[h]||ne()})),[d,n])}}function lr(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[i,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=tr(e);r.current={...d,formState:i}}const l=r.current.control;return l._options=e,De(()=>{const f=l._subscribe({formState:l._proxyFormState,callback:()=>n({...l._formState}),reRenderRoot:!0});return n(d=>({...d,isReady:!0})),l._formState.isReady=!0,f},[l]),v.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),v.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),v.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),v.useEffect(()=>{if(l._proxyFormState.isDirty){const f=l._getDirty();f!==i.isDirty&&l._subjects.state.next({isDirty:f})}},[l,i.isDirty]),v.useEffect(()=>{e.values&&!le(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,n(f=>({...f}))):l._resetDefaultValues()},[l,e.values]),v.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),r.current.formState=bt(i,l),r.current}export{ar as C,Wt as a,nr as b,lr as u};
|
|
1
|
+
import{be as v,r as at}from"./index-Bek3Nxot.js";var he=e=>e.type==="checkbox",ue=e=>e instanceof Date,$=e=>e==null;const _t=e=>typeof e=="object";var P=e=>!$(e)&&!Array.isArray(e)&&_t(e)&&!ue(e),ht=e=>P(e)&&e.target?he(e.target)?e.target.checked:e.target.value:e,Nt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,mt=(e,r)=>e.has(Nt(r)),Bt=e=>{const r=e.constructor&&e.constructor.prototype;return P(r)&&r.hasOwnProperty("isPrototypeOf")},je=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function T(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(e instanceof Set)r=new Set(e);else if(!(je&&(e instanceof Blob||i))&&(t||P(e)))if(r=t?[]:{},!t&&!Bt(e))r=e;else for(const n in e)e.hasOwnProperty(n)&&(r[n]=T(e[n]));else return e;return r}var Se=e=>/^\w*$/.test(e),U=e=>e===void 0,we=e=>Array.isArray(e)?e.filter(Boolean):[],Ke=e=>we(e.replace(/["|']|\]/g,"").split(/\.|\[/)),c=(e,r,t)=>{if(!r||!P(e))return t;const i=(Se(r)?[r]:Ke(r)).reduce((n,l)=>$(n)?n:n[l],e);return U(i)||i===e?U(e[r])?t:e[r]:i},Q=e=>typeof e=="boolean",E=(e,r,t)=>{let i=-1;const n=Se(r)?[r]:Ke(r),l=n.length,f=l-1;for(;++i<l;){const d=n[i];let b=t;if(i!==f){const x=e[d];b=P(x)||Array.isArray(x)?x:isNaN(+n[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=b,e=e[d]}};const Fe={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},vt=v.createContext(null);vt.displayName="HookFormContext";const ke=()=>v.useContext(vt);var bt=(e,r,t,i=!0)=>{const n={defaultValues:r._defaultValues};for(const l in e)Object.defineProperty(n,l,{get:()=>{const f=l;return r._proxyFormState[f]!==Z.all&&(r._proxyFormState[f]=!i||Z.all),t&&(t[f]=!0),e[f]}});return n};const De=typeof window<"u"?at.useLayoutEffect:at.useEffect;function Pt(e){const r=ke(),{control:t=r.control,disabled:i,name:n,exact:l}=e||{},[f,d]=v.useState(t._formState),b=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return De(()=>t._subscribe({name:n,formState:b.current,exact:l,callback:x=>{!i&&d({...t._formState,...x})}}),[n,i,l]),v.useEffect(()=>{b.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>bt(f,t,b.current,!1),[f,t])}var se=e=>typeof e=="string",Ft=(e,r,t,i,n)=>se(e)?(i&&r.watch.add(e),c(t,e,n)):Array.isArray(e)?e.map(l=>(i&&r.watch.add(l),c(t,l))):(i&&(r.watchAll=!0),t);function Wt(e){const r=ke(),{control:t=r.control,name:i,defaultValue:n,disabled:l,exact:f}=e||{},d=v.useRef(n),[b,x]=v.useState(t._getWatch(i,d.current));return De(()=>t._subscribe({name:i,formState:{values:!0},exact:f,callback:D=>!l&&x(Ft(i,t._names,D.values||t._formValues,!1,d.current))}),[i,t,l,f]),v.useEffect(()=>t._removeUnmounted()),b}function qt(e){const r=ke(),{name:t,disabled:i,control:n=r.control,shouldUnregister:l}=e,f=mt(n._names.array,t),d=Wt({control:n,name:t,defaultValue:c(n._formValues,t,c(n._defaultValues,t,e.defaultValue)),exact:!0}),b=Pt({control:n,name:t,exact:!0}),x=v.useRef(e),D=v.useRef(n.register(t,{...e.rules,value:d,...Q(e.disabled)?{disabled:e.disabled}:{}})),C=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!c(b.errors,t)},isDirty:{enumerable:!0,get:()=>!!c(b.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!c(b.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!c(b.validatingFields,t)},error:{enumerable:!0,get:()=>c(b.errors,t)}}),[b,t]),F=v.useCallback(L=>D.current.onChange({target:{value:ht(L),name:t},type:Fe.CHANGE}),[t]),M=v.useCallback(()=>D.current.onBlur({target:{value:c(n._formValues,t),name:t},type:Fe.BLUR}),[t,n._formValues]),z=v.useCallback(L=>{const ee=c(n._fields,t);ee&&L&&(ee._f.ref={focus:()=>L.focus&&L.focus(),select:()=>L.select&&L.select(),setCustomValidity:V=>L.setCustomValidity(V),reportValidity:()=>L.reportValidity()})},[n._fields,t]),R=v.useMemo(()=>({name:t,value:d,...Q(i)||b.disabled?{disabled:b.disabled||i}:{},onChange:F,onBlur:M,ref:z}),[t,i,b.disabled,F,M,z,d]);return v.useEffect(()=>{const L=n._options.shouldUnregister||l;n.register(t,{...x.current.rules,...Q(x.current.disabled)?{disabled:x.current.disabled}:{}});const ee=(V,G)=>{const W=c(n._fields,V);W&&W._f&&(W._f.mount=G)};if(ee(t,!0),L){const V=T(c(n._options.defaultValues,t));E(n._defaultValues,t,V),U(c(n._formValues,t))&&E(n._formValues,t,V)}return!f&&n.register(t),()=>{(f?L&&!n._state.action:L)?n.unregister(t):ee(t,!1)}},[t,n,f,l]),v.useEffect(()=>{n._setDisabledField({disabled:i,name:t})},[i,t,n]),v.useMemo(()=>({field:R,formState:b,fieldState:C}),[R,b,C])}const ar=e=>e.render(qt(e));var Ht=(e,r,t,i,n)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:n||!0}}:{},K=e=>Array.isArray(e)?e:[e],nt=()=>{let e=[];return{get observers(){return e},next:n=>{for(const l of e)l.next&&l.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(l=>l!==n)}}),unsubscribe:()=>{e=[]}}},qe=e=>$(e)||!_t(e);function le(e,r,t=new WeakSet){if(qe(e)||qe(r))return e===r;if(ue(e)&&ue(r))return e.getTime()===r.getTime();const i=Object.keys(e),n=Object.keys(r);if(i.length!==n.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const l of i){const f=e[l];if(!n.includes(l))return!1;if(l!=="ref"){const d=r[l];if(ue(f)&&ue(d)||P(f)&&P(d)||Array.isArray(f)&&Array.isArray(d)?!le(f,d,t):f!==d)return!1}}return!0}var H=e=>P(e)&&!Object.keys(e).length,ze=e=>e.type==="file",te=e=>typeof e=="function",Ve=e=>{if(!je)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Vt=e=>e.type==="select-multiple",Ge=e=>e.type==="radio",$t=e=>Ge(e)||he(e),Me=e=>Ve(e)&&e.isConnected;function jt(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=U(e)?i++:e[r[i++]];return e}function Kt(e){for(const r in e)if(e.hasOwnProperty(r)&&!U(e[r]))return!1;return!0}function B(e,r){const t=Array.isArray(r)?r:Se(r)?[r]:Ke(r),i=t.length===1?e:jt(e,t),n=t.length-1,l=t[n];return i&&delete i[l],n!==0&&(P(i)&&H(i)||Array.isArray(i)&&Kt(i))&&B(e,t.slice(0,-1)),e}var At=e=>{for(const r in e)if(te(e[r]))return!0;return!1};function Ae(e,r={}){const t=Array.isArray(e);if(P(e)||t)for(const i in e)Array.isArray(e[i])||P(e[i])&&!At(e[i])?(r[i]=Array.isArray(e[i])?[]:{},Ae(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function xt(e,r,t){const i=Array.isArray(e);if(P(e)||i)for(const n in e)Array.isArray(e[n])||P(e[n])&&!At(e[n])?U(r)||qe(t[n])?t[n]=Array.isArray(e[n])?Ae(e[n],[]):{...Ae(e[n])}:xt(e[n],$(r)?{}:r[n],t[n]):t[n]=!le(e[n],r[n]);return t}var ge=(e,r)=>xt(e,r,Ae(r));const lt={value:!1,isValid:!1},ut={value:!0,isValid:!0};var St=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?ut:{value:e[0].value,isValid:!0}:ut:lt}return lt},wt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>U(e)?e:r?e===""?NaN:e&&+e:t&&se(e)?new Date(e):i?i(e):e;const ot={isValid:!1,value:null};var kt=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,ot):ot;function ct(e){const r=e.ref;return ze(r)?r.files:Ge(r)?kt(e.refs).value:Vt(r)?[...r.selectedOptions].map(({value:t})=>t):he(r)?St(e.refs).value:wt(U(r.value)?e.ref.value:r.value,e)}var zt=(e,r,t,i)=>{const n={};for(const l of e){const f=c(r,l);f&&E(n,l,f._f)}return{criteriaMode:t,names:[...e],fields:n,shouldUseNativeValidation:i}},xe=e=>e instanceof RegExp,_e=e=>U(e)?e:xe(e)?e.source:P(e)?xe(e.value)?e.value.source:e.value:e,de=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const dt="AsyncFunction";var Gt=e=>!!e&&!!e.validate&&!!(te(e.validate)&&e.validate.constructor.name===dt||P(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===dt)),Yt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),He=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const fe=(e,r,t,i)=>{for(const n of t||Object.keys(e)){const l=c(e,n);if(l){const{_f:f,...d}=l;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],n)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(fe(d,r))break}else if(P(d)&&fe(d,r))break}}};function ft(e,r,t){const i=c(e,t);if(i||Se(t))return{error:i,name:t};const n=t.split(".");for(;n.length;){const l=n.join("."),f=c(r,l),d=c(e,l);if(f&&!Array.isArray(f)&&t!==l)return{name:t};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};n.pop()}return{name:t}}var Jt=(e,r,t,i)=>{t(e);const{name:n,...l}=e;return H(l)||Object.keys(l).length>=Object.keys(r).length||Object.keys(l).find(f=>r[f]===(!i||Z.all))},Qt=(e,r,t)=>!e||!r||e===r||K(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Xt=(e,r,t,i,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(r||e):(t?i.isOnBlur:n.isOnBlur)?!e:(t?i.isOnChange:n.isOnChange)?e:!0,Zt=(e,r)=>!we(c(e,r)).length&&B(e,r),Dt=(e,r,t)=>{const i=K(c(e,t));return E(i,"root",r[t]),E(e,t,i),e},be=e=>se(e);function yt(e,r,t="validate"){if(be(e)||Array.isArray(e)&&e.every(be)||Q(e)&&!e)return{type:t,message:be(e)?e:"",ref:r}}var ce=e=>P(e)&&!xe(e)?e:{value:e,message:""},$e=async(e,r,t,i,n,l)=>{const{ref:f,refs:d,required:b,maxLength:x,minLength:D,min:C,max:F,pattern:M,validate:z,name:R,valueAsNumber:L,mount:ee}=e._f,V=c(t,R);if(!ee||r.has(R))return{};const G=d?d[0]:f,W=w=>{n&&G.reportValidity&&(G.setCustomValidity(Q(w)?"":w||""),G.reportValidity())},I={},m=Ge(f),h=he(f),A=m||h,S=(L||ze(f))&&U(f.value)&&U(V)||Ve(f)&&f.value===""||V===""||Array.isArray(V)&&!V.length,Y=Ht.bind(null,R,i,I),J=(w,p,N,q=ie.maxLength,j=ie.minLength)=>{const re=w?p:N;I[R]={type:w?q:j,message:re,ref:f,...Y(w?q:j,re)}};if(l?!Array.isArray(V)||!V.length:b&&(!A&&(S||$(V))||Q(V)&&!V||h&&!St(d).isValid||m&&!kt(d).isValid)){const{value:w,message:p}=be(b)?{value:!!b,message:b}:ce(b);if(w&&(I[R]={type:ie.required,message:p,ref:G,...Y(ie.required,p)},!i))return W(p),I}if(!S&&(!$(C)||!$(F))){let w,p;const N=ce(F),q=ce(C);if(!$(V)&&!isNaN(V)){const j=f.valueAsNumber||V&&+V;$(N.value)||(w=j>N.value),$(q.value)||(p=j<q.value)}else{const j=f.valueAsDate||new Date(V),re=me=>new Date(new Date().toDateString()+" "+me),ye=f.type=="time",oe=f.type=="week";se(N.value)&&V&&(w=ye?re(V)>re(N.value):oe?V>N.value:j>new Date(N.value)),se(q.value)&&V&&(p=ye?re(V)<re(q.value):oe?V<q.value:j<new Date(q.value))}if((w||p)&&(J(!!w,N.message,q.message,ie.max,ie.min),!i))return W(I[R].message),I}if((x||D)&&!S&&(se(V)||l&&Array.isArray(V))){const w=ce(x),p=ce(D),N=!$(w.value)&&V.length>+w.value,q=!$(p.value)&&V.length<+p.value;if((N||q)&&(J(N,w.message,p.message),!i))return W(I[R].message),I}if(M&&!S&&se(V)){const{value:w,message:p}=ce(M);if(xe(w)&&!V.match(w)&&(I[R]={type:ie.pattern,message:p,ref:f,...Y(ie.pattern,p)},!i))return W(p),I}if(z){if(te(z)){const w=await z(V,t),p=yt(w,G);if(p&&(I[R]={...p,...Y(ie.validate,p.message)},!i))return W(p.message),I}else if(P(z)){let w={};for(const p in z){if(!H(w)&&!i)break;const N=yt(await z[p](V,t),G,p);N&&(w={...N,...Y(p,N.message)},W(N.message),i&&(I[R]=w))}if(!H(w)&&(I[R]={ref:G,...w},!i))return I}}return W(!0),I};const er={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function tr(e={}){let r={...er,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:te(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1};const i={};let n=P(r.defaultValues)||P(r.values)?T(r.defaultValues||r.values)||{}:{},l=r.shouldUnregister?{}:T(n),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,x=0;const D={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let C={...D};const F={array:nt(),state:nt()},M=r.criteriaMode===Z.all,z=s=>a=>{clearTimeout(x),x=setTimeout(s,a)},R=async s=>{if(!r.disabled&&(D.isValid||C.isValid||s)){const a=r.resolver?H((await h()).errors):await S(i,!0);a!==t.isValid&&F.state.next({isValid:a})}},L=(s,a)=>{!r.disabled&&(D.isValidating||D.validatingFields||C.isValidating||C.validatingFields)&&((s||Array.from(d.mount)).forEach(u=>{u&&(a?E(t.validatingFields,u,a):B(t.validatingFields,u))}),F.state.next({validatingFields:t.validatingFields,isValidating:!H(t.validatingFields)}))},ee=(s,a=[],u,g,y=!0,o=!0)=>{if(g&&u&&!r.disabled){if(f.action=!0,o&&Array.isArray(c(i,s))){const _=u(c(i,s),g.argA,g.argB);y&&E(i,s,_)}if(o&&Array.isArray(c(t.errors,s))){const _=u(c(t.errors,s),g.argA,g.argB);y&&E(t.errors,s,_),Zt(t.errors,s)}if((D.touchedFields||C.touchedFields)&&o&&Array.isArray(c(t.touchedFields,s))){const _=u(c(t.touchedFields,s),g.argA,g.argB);y&&E(t.touchedFields,s,_)}(D.dirtyFields||C.dirtyFields)&&(t.dirtyFields=ge(n,l)),F.state.next({name:s,isDirty:J(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else E(l,s,a)},V=(s,a)=>{E(t.errors,s,a),F.state.next({errors:t.errors})},G=s=>{t.errors=s,F.state.next({errors:t.errors,isValid:!1})},W=(s,a,u,g)=>{const y=c(i,s);if(y){const o=c(l,s,U(u)?c(n,s):u);U(o)||g&&g.defaultChecked||a?E(l,s,a?o:ct(y._f)):N(s,o),f.mount&&R()}},I=(s,a,u,g,y)=>{let o=!1,_=!1;const k={name:s};if(!r.disabled){if(!u||g){(D.isDirty||C.isDirty)&&(_=t.isDirty,t.isDirty=k.isDirty=J(),o=_!==k.isDirty);const O=le(c(n,s),a);_=!!c(t.dirtyFields,s),O?B(t.dirtyFields,s):E(t.dirtyFields,s,!0),k.dirtyFields=t.dirtyFields,o=o||(D.dirtyFields||C.dirtyFields)&&_!==!O}if(u){const O=c(t.touchedFields,s);O||(E(t.touchedFields,s,u),k.touchedFields=t.touchedFields,o=o||(D.touchedFields||C.touchedFields)&&O!==u)}o&&y&&F.state.next(k)}return o?k:{}},m=(s,a,u,g)=>{const y=c(t.errors,s),o=(D.isValid||C.isValid)&&Q(a)&&t.isValid!==a;if(r.delayError&&u?(b=z(()=>V(s,u)),b(r.delayError)):(clearTimeout(x),b=null,u?E(t.errors,s,u):B(t.errors,s)),(u?!le(y,u):y)||!H(g)||o){const _={...g,...o&&Q(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,..._},F.state.next(_)}},h=async s=>{L(s,!0);const a=await r.resolver(l,r.context,zt(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return L(s),a},A=async s=>{const{errors:a}=await h(s);if(s)for(const u of s){const g=c(a,u);g?E(t.errors,u,g):B(t.errors,u)}else t.errors=a;return a},S=async(s,a,u={valid:!0})=>{for(const g in s){const y=s[g];if(y){const{_f:o,..._}=y;if(o){const k=d.array.has(o.name),O=y._f&&Gt(y._f);O&&D.validatingFields&&L([g],!0);const X=await $e(y,d.disabled,l,M,r.shouldUseNativeValidation&&!a,k);if(O&&D.validatingFields&&L([g]),X[o.name]&&(u.valid=!1,a))break;!a&&(c(X,o.name)?k?Dt(t.errors,X,o.name):E(t.errors,o.name,X[o.name]):B(t.errors,o.name))}!H(_)&&await S(_,a,u)}}return u.valid},Y=()=>{for(const s of d.unMount){const a=c(i,s);a&&(a._f.refs?a._f.refs.every(u=>!Me(u)):!Me(a._f.ref))&&Ee(s)}d.unMount=new Set},J=(s,a)=>!r.disabled&&(s&&a&&E(l,s,a),!le(me(),n)),w=(s,a,u)=>Ft(s,d,{...f.mount?l:U(a)?n:se(s)?{[s]:a}:a},u,a),p=s=>we(c(f.mount?l:n,s,r.shouldUnregister?c(n,s,[]):[])),N=(s,a,u={})=>{const g=c(i,s);let y=a;if(g){const o=g._f;o&&(!o.disabled&&E(l,s,wt(a,o)),y=Ve(o.ref)&&$(a)?"":a,Vt(o.ref)?[...o.ref.options].forEach(_=>_.selected=y.includes(_.value)):o.refs?he(o.ref)?o.refs.forEach(_=>{(!_.defaultChecked||!_.disabled)&&(Array.isArray(y)?_.checked=!!y.find(k=>k===_.value):_.checked=y===_.value||!!y)}):o.refs.forEach(_=>_.checked=_.value===y):ze(o.ref)?o.ref.value="":(o.ref.value=y,o.ref.type||F.state.next({name:s,values:T(l)})))}(u.shouldDirty||u.shouldTouch)&&I(s,y,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&oe(s)},q=(s,a,u)=>{for(const g in a){if(!a.hasOwnProperty(g))return;const y=a[g],o=s+"."+g,_=c(i,o);(d.array.has(s)||P(y)||_&&!_._f)&&!ue(y)?q(o,y,u):N(o,y,u)}},j=(s,a,u={})=>{const g=c(i,s),y=d.array.has(s),o=T(a);E(l,s,o),y?(F.array.next({name:s,values:T(l)}),(D.isDirty||D.dirtyFields||C.isDirty||C.dirtyFields)&&u.shouldDirty&&F.state.next({name:s,dirtyFields:ge(n,l),isDirty:J(s,o)})):g&&!g._f&&!$(o)?q(s,o,u):N(s,o,u),He(s,d)&&F.state.next({...t}),F.state.next({name:f.mount?s:void 0,values:T(l)})},re=async s=>{f.mount=!0;const a=s.target;let u=a.name,g=!0;const y=c(i,u),o=O=>{g=Number.isNaN(O)||ue(O)&&isNaN(O.getTime())||le(O,c(l,u,O))},_=de(r.mode),k=de(r.reValidateMode);if(y){let O,X;const ve=a.type?ct(y._f):ht(s),ae=s.type===Fe.BLUR||s.type===Fe.FOCUS_OUT,Lt=!Yt(y._f)&&!r.resolver&&!c(t.errors,u)&&!y._f.deps||Xt(ae,c(t.touchedFields,u),t.isSubmitted,k,_),Oe=He(u,d,ae);E(l,u,ve),ae?(y._f.onBlur&&y._f.onBlur(s),b&&b(0)):y._f.onChange&&y._f.onChange(s);const Ue=I(u,ve,ae),Tt=!H(Ue)||Oe;if(!ae&&F.state.next({name:u,type:s.type,values:T(l)}),Lt)return(D.isValid||C.isValid)&&(r.mode==="onBlur"?ae&&R():ae||R()),Tt&&F.state.next({name:u,...Oe?{}:Ue});if(!ae&&Oe&&F.state.next({...t}),r.resolver){const{errors:st}=await h([u]);if(o(ve),g){const It=ft(t.errors,i,u),it=ft(st,i,It.name||u);O=it.error,u=it.name,X=H(st)}}else L([u],!0),O=(await $e(y,d.disabled,l,M,r.shouldUseNativeValidation))[u],L([u]),o(ve),g&&(O?X=!1:(D.isValid||C.isValid)&&(X=await S(i,!0)));g&&(y._f.deps&&oe(y._f.deps),m(u,X,O,Ue))}},ye=(s,a)=>{if(c(t.errors,a)&&s.focus)return s.focus(),1},oe=async(s,a={})=>{let u,g;const y=K(s);if(r.resolver){const o=await A(U(s)?s:y);u=H(o),g=s?!y.some(_=>c(o,_)):u}else s?(g=(await Promise.all(y.map(async o=>{const _=c(i,o);return await S(_&&_._f?{[o]:_}:_)}))).every(Boolean),!(!g&&!t.isValid)&&R()):g=u=await S(i);return F.state.next({...!se(s)||(D.isValid||C.isValid)&&u!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!g&&fe(i,ye,s?y:d.mount),g},me=s=>{const a={...f.mount?l:n};return U(s)?a:se(s)?c(a,s):s.map(u=>c(a,u))},Ye=(s,a)=>({invalid:!!c((a||t).errors,s),isDirty:!!c((a||t).dirtyFields,s),error:c((a||t).errors,s),isValidating:!!c(t.validatingFields,s),isTouched:!!c((a||t).touchedFields,s)}),Et=s=>{s&&K(s).forEach(a=>B(t.errors,a)),F.state.next({errors:s?t.errors:{}})},Je=(s,a,u)=>{const g=(c(i,s,{_f:{}})._f||{}).ref,y=c(t.errors,s)||{},{ref:o,message:_,type:k,...O}=y;E(t.errors,s,{...O,...a,ref:g}),F.state.next({name:s,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&g&&g.focus&&g.focus()},pt=(s,a)=>te(s)?F.state.subscribe({next:u=>s(w(void 0,a),u)}):w(s,a,!0),Qe=s=>F.state.subscribe({next:a=>{Qt(s.name,a.name,s.exact)&&Jt(a,s.formState||D,Rt,s.reRenderRoot)&&s.callback({values:{...l},...t,...a})}}).unsubscribe,Ct=s=>(f.mount=!0,C={...C,...s.formState},Qe({...s,formState:C})),Ee=(s,a={})=>{for(const u of s?K(s):d.mount)d.mount.delete(u),d.array.delete(u),a.keepValue||(B(i,u),B(l,u)),!a.keepError&&B(t.errors,u),!a.keepDirty&&B(t.dirtyFields,u),!a.keepTouched&&B(t.touchedFields,u),!a.keepIsValidating&&B(t.validatingFields,u),!r.shouldUnregister&&!a.keepDefaultValue&&B(n,u);F.state.next({values:T(l)}),F.state.next({...t,...a.keepDirty?{isDirty:J()}:{}}),!a.keepIsValid&&R()},Xe=({disabled:s,name:a})=>{(Q(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},pe=(s,a={})=>{let u=c(i,s);const g=Q(a.disabled)||Q(r.disabled);return E(i,s,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),u?Xe({disabled:Q(a.disabled)?a.disabled:r.disabled,name:s}):W(s,!0,a.value),{...g?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:_e(a.min),max:_e(a.max),minLength:_e(a.minLength),maxLength:_e(a.maxLength),pattern:_e(a.pattern)}:{},name:s,onChange:re,onBlur:re,ref:y=>{if(y){pe(s,a),u=c(i,s);const o=U(y.value)&&y.querySelectorAll&&y.querySelectorAll("input,select,textarea")[0]||y,_=$t(o),k=u._f.refs||[];if(_?k.find(O=>O===o):o===u._f.ref)return;E(i,s,{_f:{...u._f,..._?{refs:[...k.filter(Me),o,...Array.isArray(c(n,s))?[{}]:[]],ref:{type:o.type,name:s}}:{ref:o}}}),W(s,!1,void 0,o)}else u=c(i,s,{}),u._f&&(u._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(mt(d.array,s)&&f.action)&&d.unMount.add(s)}}},Ce=()=>r.shouldFocusError&&fe(i,ye,d.mount),Ot=s=>{Q(s)&&(F.state.next({disabled:s}),fe(i,(a,u)=>{const g=c(i,u);g&&(a.disabled=g._f.disabled||s,Array.isArray(g._f.refs)&&g._f.refs.forEach(y=>{y.disabled=g._f.disabled||s}))},0,!1))},Ze=(s,a)=>async u=>{let g;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let y=T(l);if(F.state.next({isSubmitting:!0}),r.resolver){const{errors:o,values:_}=await h();t.errors=o,y=T(_)}else await S(i);if(d.disabled.size)for(const o of d.disabled)B(y,o);if(B(t.errors,"root"),H(t.errors)){F.state.next({errors:{}});try{await s(y,u)}catch(o){g=o}}else a&&await a({...t.errors},u),Ce(),setTimeout(Ce);if(F.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:H(t.errors)&&!g,submitCount:t.submitCount+1,errors:t.errors}),g)throw g},Ut=(s,a={})=>{c(i,s)&&(U(a.defaultValue)?j(s,T(c(n,s))):(j(s,a.defaultValue),E(n,s,T(a.defaultValue))),a.keepTouched||B(t.touchedFields,s),a.keepDirty||(B(t.dirtyFields,s),t.isDirty=a.defaultValue?J(s,T(c(n,s))):J()),a.keepError||(B(t.errors,s),D.isValid&&R()),F.state.next({...t}))},et=(s,a={})=>{const u=s?T(s):n,g=T(u),y=H(s),o=y?n:g;if(a.keepDefaultValues||(n=u),!a.keepValues){if(a.keepDirtyValues){const _=new Set([...d.mount,...Object.keys(ge(n,l))]);for(const k of Array.from(_))c(t.dirtyFields,k)?E(o,k,c(l,k)):j(k,c(o,k))}else{if(je&&U(s))for(const _ of d.mount){const k=c(i,_);if(k&&k._f){const O=Array.isArray(k._f.refs)?k._f.refs[0]:k._f.ref;if(Ve(O)){const X=O.closest("form");if(X){X.reset();break}}}}for(const _ of d.mount){const k=c(o,_,c(n,_));U(k)||(E(o,_,k),j(_,c(o,_)))}}l=T(o),F.array.next({values:{...o}}),F.state.next({values:{...o}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!D.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,F.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:y?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!le(s,n)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:y?{}:a.keepDirtyValues?a.keepDefaultValues&&l?ge(n,l):t.dirtyFields:a.keepDefaultValues&&s?ge(n,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},tt=(s,a)=>et(te(s)?s(l):s,a),Mt=(s,a={})=>{const u=c(i,s),g=u&&u._f;if(g){const y=g.refs?g.refs[0]:g.ref;y.focus&&(y.focus(),a.shouldSelect&&te(y.select)&&y.select())}},Rt=s=>{t={...t,...s}},rt={control:{register:pe,unregister:Ee,getFieldState:Ye,handleSubmit:Ze,setError:Je,_subscribe:Qe,_runSchema:h,_focusError:Ce,_getWatch:w,_getDirty:J,_setValid:R,_setFieldArray:ee,_setDisabledField:Xe,_setErrors:G,_getFieldArray:p,_reset:et,_resetDefaultValues:()=>te(r.defaultValues)&&r.defaultValues().then(s=>{tt(s,r.resetOptions),F.state.next({isLoading:!1})}),_removeUnmounted:Y,_disableForm:Ot,_subjects:F,_proxyFormState:D,get _fields(){return i},get _formValues(){return l},get _state(){return f},set _state(s){f=s},get _defaultValues(){return n},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Ct,trigger:oe,register:pe,handleSubmit:Ze,watch:pt,setValue:j,getValues:me,reset:tt,resetField:Ut,clearErrors:Et,unregister:Ee,setError:Je,setFocus:Mt,getFieldState:Ye};return{...rt,formControl:rt}}var ne=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=(Math.random()*16+e)%16|0;return(r=="x"?t:t&3|8).toString(16)})},Re=(e,r,t={})=>t.shouldFocus||U(t.shouldFocus)?t.focusName||`${e}.${U(t.focusIndex)?r:t.focusIndex}.`:"",Le=(e,r)=>[...e,...K(r)],Te=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ie(e,r,t){return[...e.slice(0,r),...K(t),...e.slice(r)]}var Ne=(e,r,t)=>Array.isArray(e)?(U(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[],Be=(e,r)=>[...K(r),...K(e)];function rr(e,r){let t=0;const i=[...e];for(const n of r)i.splice(n-t,1),t++;return we(i).length?i:[]}var Pe=(e,r)=>U(r)?[]:rr(e,K(r).sort((t,i)=>t-i)),We=(e,r,t)=>{[e[r],e[t]]=[e[t],e[r]]},gt=(e,r,t)=>(e[r]=t,e);function nr(e){const r=ke(),{control:t=r.control,name:i,keyName:n="id",shouldUnregister:l,rules:f}=e,[d,b]=v.useState(t._getFieldArray(i)),x=v.useRef(t._getFieldArray(i).map(ne)),D=v.useRef(d),C=v.useRef(i),F=v.useRef(!1);C.current=i,D.current=d,t._names.array.add(i),f&&t.register(i,f),De(()=>t._subjects.array.subscribe({next:({values:m,name:h})=>{if(h===C.current||!h){const A=c(m,C.current);Array.isArray(A)&&(b(A),x.current=A.map(ne))}}}).unsubscribe,[t]);const M=v.useCallback(m=>{F.current=!0,t._setFieldArray(i,m)},[t,i]),z=(m,h)=>{const A=K(T(m)),S=Le(t._getFieldArray(i),A);t._names.focus=Re(i,S.length-1,h),x.current=Le(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Le,{argA:Te(m)})},R=(m,h)=>{const A=K(T(m)),S=Be(t._getFieldArray(i),A);t._names.focus=Re(i,0,h),x.current=Be(x.current,A.map(ne)),M(S),b(S),t._setFieldArray(i,S,Be,{argA:Te(m)})},L=m=>{const h=Pe(t._getFieldArray(i),m);x.current=Pe(x.current,m),M(h),b(h),!Array.isArray(c(t._fields,i))&&E(t._fields,i,void 0),t._setFieldArray(i,h,Pe,{argA:m})},ee=(m,h,A)=>{const S=K(T(h)),Y=Ie(t._getFieldArray(i),m,S);t._names.focus=Re(i,m,A),x.current=Ie(x.current,m,S.map(ne)),M(Y),b(Y),t._setFieldArray(i,Y,Ie,{argA:m,argB:Te(h)})},V=(m,h)=>{const A=t._getFieldArray(i);We(A,m,h),We(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,We,{argA:m,argB:h},!1)},G=(m,h)=>{const A=t._getFieldArray(i);Ne(A,m,h),Ne(x.current,m,h),M(A),b(A),t._setFieldArray(i,A,Ne,{argA:m,argB:h},!1)},W=(m,h)=>{const A=T(h),S=gt(t._getFieldArray(i),m,A);x.current=[...S].map((Y,J)=>!Y||J===m?ne():x.current[J]),M(S),b([...S]),t._setFieldArray(i,S,gt,{argA:m,argB:A},!0,!1)},I=m=>{const h=K(T(m));x.current=h.map(ne),M([...h]),b([...h]),t._setFieldArray(i,[...h],A=>A,{},!0,!1)};return v.useEffect(()=>{if(t._state.action=!1,He(i,t._names)&&t._subjects.state.next({...t._formState}),F.current&&(!de(t._options.mode).isOnSubmit||t._formState.isSubmitted)&&!de(t._options.reValidateMode).isOnSubmit)if(t._options.resolver)t._runSchema([i]).then(m=>{const h=c(m.errors,i),A=c(t._formState.errors,i);(A?!h&&A.type||h&&(A.type!==h.type||A.message!==h.message):h&&h.type)&&(h?E(t._formState.errors,i,h):B(t._formState.errors,i),t._subjects.state.next({errors:t._formState.errors}))});else{const m=c(t._fields,i);m&&m._f&&!(de(t._options.reValidateMode).isOnSubmit&&de(t._options.mode).isOnSubmit)&&$e(m,t._names.disabled,t._formValues,t._options.criteriaMode===Z.all,t._options.shouldUseNativeValidation,!0).then(h=>!H(h)&&t._subjects.state.next({errors:Dt(t._formState.errors,h,i)}))}t._subjects.state.next({name:i,values:T(t._formValues)}),t._names.focus&&fe(t._fields,(m,h)=>{if(t._names.focus&&h.startsWith(t._names.focus)&&m.focus)return m.focus(),1}),t._names.focus="",t._setValid(),F.current=!1},[d,i,t]),v.useEffect(()=>(!c(t._formValues,i)&&t._setFieldArray(i),()=>{const m=(h,A)=>{const S=c(t._fields,h);S&&S._f&&(S._f.mount=A)};t._options.shouldUnregister||l?t.unregister(i):m(i,!1)}),[i,t,n,l]),{swap:v.useCallback(V,[M,i,t]),move:v.useCallback(G,[M,i,t]),prepend:v.useCallback(R,[M,i,t]),append:v.useCallback(z,[M,i,t]),remove:v.useCallback(L,[M,i,t]),insert:v.useCallback(ee,[M,i,t]),update:v.useCallback(W,[M,i,t]),replace:v.useCallback(I,[M,i,t]),fields:v.useMemo(()=>d.map((m,h)=>({...m,[n]:x.current[h]||ne()})),[d,n])}}function lr(e={}){const r=v.useRef(void 0),t=v.useRef(void 0),[i,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:te(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=tr(e);r.current={...d,formState:i}}const l=r.current.control;return l._options=e,De(()=>{const f=l._subscribe({formState:l._proxyFormState,callback:()=>n({...l._formState}),reRenderRoot:!0});return n(d=>({...d,isReady:!0})),l._formState.isReady=!0,f},[l]),v.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),v.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),v.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),v.useEffect(()=>{if(l._proxyFormState.isDirty){const f=l._getDirty();f!==i.isDirty&&l._subjects.state.next({isDirty:f})}},[l,i.isDirty]),v.useEffect(()=>{e.values&&!le(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,n(f=>({...f}))):l._resetDefaultValues()},[l,e.values]),v.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),r.current.formState=bt(i,l),r.current}export{ar as C,Wt as a,nr as b,lr as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j,o as L,eE as Ot,eF as Pt,eG as Lt,J as dt,eH as Tt,r as I,be as Dt,a8 as Nt,a4 as Mt,a9 as qt,bi as Wt,bn as $t,n as Bt,V as Ft,cM as Gt,cO as Ht,bC as Kt,y as et,i as Vt,W as zt,F as Yt,H as Jt,Z as rt,T as Xt,t as Qt,$ as Zt,D as kt,Y as te,v as it,C as nt,w as ee,z as re}from"./index-BAMKzu46.js";import{W as ie}from"./status-CNrrWhOD.js";import{r as gt,a as ne,W as se}from"./without-wallet-B0F51hFz.js";import{r as oe}from"./cloneDeep-CJSiQzIj.js";import{u as vt}from"./useLocalStorage-DCDZL7eY.js";import{v as st}from"./index-MY2K6w0a.js";import{D as ae}from"./Delete-9ESwe_tH.js";import{A as le}from"./Autocomplete-CafCM_25.js";import{L as ce}from"./ListItemButton-DmY4JAPa.js";import{S as ue,a as he,b as fe}from"./Stepper-DpZ7eOjv.js";function pe({mode:o,...p}){return o==="development"?j.jsx(ie,{type:"primary",...p,children:"DEV"}):null}pe.propTypes={mode:L.string.isRequired};var T={},F={exports:{}},V={exports:{}},ot;function yt(){if(ot)return V.exports;ot=1;var o=V.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(u){return"file-"+m(u)}}},p={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:m};Object.keys(o).forEach(function(u){Object.keys(p).forEach(function(h){o[u][h]||(o[u][h]=p[h])}),o[u].protocols_re=RegExp("^("+o[u].protocols.map(function(h){return h.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function m(u){return u.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return V.exports}var z,at;function me(){if(at)return z;at=1;var o=yt(),p=Object.assign||function(h,t){if(t===null||typeof t!="object")return h;const r=Object.keys(t);let i=r.length;for(;i--;)h[r[i]]=t[r[i]];return h};z=m;function m(u,h,t,r,i,n,a){var x=this;x.type=u,Object.keys(o[u]).forEach(function(w){x[w]=o[u][w]}),x.user=h,x.auth=t,x.project=r,x.committish=i,x.default=n,x.opts=a||{}}return m.prototype.hash=function(){return this.committish?"#"+this.committish:""},m.prototype._fill=function(u,h){if(u){var t=p({},h);t.path=t.path?t.path.replace(/^[/]+/g,""):"",h=p(p({},this.opts),h);var r=this;Object.keys(this).forEach(function(c){r[c]!=null&&t[c]==null&&(t[c]=r[c])});var i=t.auth,n=t.committish,a=t.fragment,x=t.path,w=t.project;Object.keys(t).forEach(function(c){var E=t[c];(c==="path"||c==="project")&&typeof E=="string"?t[c]=E.split("/").map(function(S){return encodeURIComponent(S)}).join("/"):c!=="domain"&&(t[c]=encodeURIComponent(E))}),t["auth@"]=i?i+"@":"",t["#fragment"]=a?"#"+this.hashformat(a):"",t.fragment=t.fragment?t.fragment:"",t["#path"]=x?"#"+this.hashformat(x):"",t["/path"]=t.path?"/"+t.path:"",t.projectPath=w.split("/").map(encodeURIComponent).join("/"),h.noCommittish?(t["#committish"]="",t["/tree/committish"]="",t["/committish"]="",t.committish=""):(t["#committish"]=n?"#"+n:"",t["/tree/committish"]=t.committish?"/"+t.treepath+"/"+t.committish:"",t["/committish"]=t.committish?"/"+t.committish:"",t.committish=t.committish||"master");var g=u;return Object.keys(t).forEach(function(c){g=g.replace(new RegExp("[{]"+c+"[}]","g"),t[c])}),h.noGitPlus?g.replace(/^git[+]/,""):g}},m.prototype.ssh=function(u){return this._fill(this.sshtemplate,u)},m.prototype.sshurl=function(u){return this._fill(this.sshurltemplate,u)},m.prototype.browse=function(u,h,t){return typeof u=="string"?(typeof h!="string"&&(t=h,h=null),this._fill(this.browsefiletemplate,p({fragment:h,path:u},t))):this._fill(this.browsetemplate,u)},m.prototype.docs=function(u){return this._fill(this.docstemplate,u)},m.prototype.bugs=function(u){return this._fill(this.bugstemplate,u)},m.prototype.https=function(u){return this._fill(this.httpstemplate,u)},m.prototype.git=function(u){return this._fill(this.gittemplate,u)},m.prototype.shortcut=function(u){return this._fill(this.shortcuttemplate,u)},m.prototype.path=function(u){return this._fill(this.pathtemplate,u)},m.prototype.tarball=function(u){var h=p({},u,{noCommittish:!1});return this._fill(this.tarballtemplate,h)},m.prototype.file=function(u,h){return this._fill(this.filetemplate,p({path:u},h))},m.prototype.getDefaultRepresentation=function(){return this.default},m.prototype.toString=function(u){return this.default&&typeof this[this.default]=="function"?this[this.default](u):this.sshurl(u)},z}var Y,lt;function de(){return lt||(lt=1,Y=function(o){o.prototype[Symbol.iterator]=function*(){for(let p=this.head;p;p=p.next)yield p.value}}),Y}var J,ct;function ge(){if(ct)return J;ct=1,J=o,o.Node=h,o.create=o;function o(t){var r=this;if(r instanceof o||(r=new o),r.tail=null,r.head=null,r.length=0,t&&typeof t.forEach=="function")t.forEach(function(a){r.push(a)});else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}o.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var r=t.next,i=t.prev;return r&&(r.prev=i),i&&(i.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=i),t.list.length--,t.next=null,t.prev=null,t.list=null,r},o.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},o.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||(this.head=t),this.length++}},o.prototype.push=function(){for(var t=0,r=arguments.length;t<r;t++)m(this,arguments[t]);return this.length},o.prototype.unshift=function(){for(var t=0,r=arguments.length;t<r;t++)u(this,arguments[t]);return this.length},o.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},o.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},o.prototype.forEach=function(t,r){r=r||this;for(var i=this.head,n=0;i!==null;n++)t.call(r,i.value,n,this),i=i.next},o.prototype.forEachReverse=function(t,r){r=r||this;for(var i=this.tail,n=this.length-1;i!==null;n--)t.call(r,i.value,n,this),i=i.prev},o.prototype.get=function(t){for(var r=0,i=this.head;i!==null&&r<t;r++)i=i.next;if(r===t&&i!==null)return i.value},o.prototype.getReverse=function(t){for(var r=0,i=this.tail;i!==null&&r<t;r++)i=i.prev;if(r===t&&i!==null)return i.value},o.prototype.map=function(t,r){r=r||this;for(var i=new o,n=this.head;n!==null;)i.push(t.call(r,n.value,this)),n=n.next;return i},o.prototype.mapReverse=function(t,r){r=r||this;for(var i=new o,n=this.tail;n!==null;)i.push(t.call(r,n.value,this)),n=n.prev;return i},o.prototype.reduce=function(t,r){var i,n=this.head;if(arguments.length>1)i=r;else if(this.head)n=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;n!==null;a++)i=t(i,n.value,a),n=n.next;return i},o.prototype.reduceReverse=function(t,r){var i,n=this.tail;if(arguments.length>1)i=r;else if(this.tail)n=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;n!==null;a--)i=t(i,n.value,a),n=n.prev;return i},o.prototype.toArray=function(){for(var t=new Array(this.length),r=0,i=this.head;i!==null;r++)t[r]=i.value,i=i.next;return t},o.prototype.toArrayReverse=function(){for(var t=new Array(this.length),r=0,i=this.tail;i!==null;r++)t[r]=i.value,i=i.prev;return t},o.prototype.slice=function(t,r){r=r||this.length,r<0&&(r+=this.length),t=t||0,t<0&&(t+=this.length);var i=new o;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,a=this.head;a!==null&&n<t;n++)a=a.next;for(;a!==null&&n<r;n++,a=a.next)i.push(a.value);return i},o.prototype.sliceReverse=function(t,r){r=r||this.length,r<0&&(r+=this.length),t=t||0,t<0&&(t+=this.length);var i=new o;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,a=this.tail;a!==null&&n>r;n--)a=a.prev;for(;a!==null&&n>t;n--,a=a.prev)i.push(a.value);return i},o.prototype.splice=function(t,r,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,a=this.head;a!==null&&n<t;n++)a=a.next;for(var x=[],n=0;a&&n<r;n++)x.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var n=0;n<i.length;n++)a=p(this,a,i[n]);return x},o.prototype.reverse=function(){for(var t=this.head,r=this.tail,i=t;i!==null;i=i.prev){var n=i.prev;i.prev=i.next,i.next=n}return this.head=r,this.tail=t,this};function p(t,r,i){var n=r===t.head?new h(i,null,r,t):new h(i,r,r.next,t);return n.next===null&&(t.tail=n),n.prev===null&&(t.head=n),t.length++,n}function m(t,r){t.tail=new h(r,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function u(t,r){t.head=new h(r,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function h(t,r,i,n){if(!(this instanceof h))return new h(t,r,i,n);this.list=n,this.value=t,r?(r.next=this,this.prev=r):this.prev=null,i?(i.prev=this,this.next=i):this.next=null}try{de()(o)}catch{}return J}var X,ut;function ve(){if(ut)return X;ut=1;const o=ge(),p=Symbol("max"),m=Symbol("length"),u=Symbol("lengthCalculator"),h=Symbol("allowStale"),t=Symbol("maxAge"),r=Symbol("dispose"),i=Symbol("noDisposeOnSet"),n=Symbol("lruList"),a=Symbol("cache"),x=Symbol("updateAgeOnGet"),w=()=>1;class g{constructor(s){if(typeof s=="number"&&(s={max:s}),s||(s={}),s.max&&(typeof s.max!="number"||s.max<0))throw new TypeError("max must be a non-negative number");this[p]=s.max||1/0;const e=s.length||w;if(this[u]=typeof e!="function"?w:e,this[h]=s.stale||!1,s.maxAge&&typeof s.maxAge!="number")throw new TypeError("maxAge must be a number");this[t]=s.maxAge||0,this[r]=s.dispose,this[i]=s.noDisposeOnSet||!1,this[x]=s.updateAgeOnGet||!1,this.reset()}set max(s){if(typeof s!="number"||s<0)throw new TypeError("max must be a non-negative number");this[p]=s||1/0,S(this)}get max(){return this[p]}set allowStale(s){this[h]=!!s}get allowStale(){return this[h]}set maxAge(s){if(typeof s!="number")throw new TypeError("maxAge must be a non-negative number");this[t]=s,S(this)}get maxAge(){return this[t]}set lengthCalculator(s){typeof s!="function"&&(s=w),s!==this[u]&&(this[u]=s,this[m]=0,this[n].forEach(e=>{e.length=this[u](e.value,e.key),this[m]+=e.length})),S(this)}get lengthCalculator(){return this[u]}get length(){return this[m]}get itemCount(){return this[n].length}rforEach(s,e){e=e||this;for(let l=this[n].tail;l!==null;){const f=l.prev;U(this,s,l,e),l=f}}forEach(s,e){e=e||this;for(let l=this[n].head;l!==null;){const f=l.next;U(this,s,l,e),l=f}}keys(){return this[n].toArray().map(s=>s.key)}values(){return this[n].toArray().map(s=>s.value)}reset(){this[r]&&this[n]&&this[n].length&&this[n].forEach(s=>this[r](s.key,s.value)),this[a]=new Map,this[n]=new o,this[m]=0}dump(){return this[n].map(s=>E(this,s)?!1:{k:s.key,v:s.value,e:s.now+(s.maxAge||0)}).toArray().filter(s=>s)}dumpLru(){return this[n]}set(s,e,l){if(l=l||this[t],l&&typeof l!="number")throw new TypeError("maxAge must be a number");const f=l?Date.now():0,y=this[u](e,s);if(this[a].has(s)){if(y>this[p])return C(this,this[a].get(s)),!1;const A=this[a].get(s).value;return this[r]&&(this[i]||this[r](s,A.value)),A.now=f,A.maxAge=l,A.value=e,this[m]+=y-A.length,A.length=y,this.get(s),S(this),!0}const b=new R(s,e,y,f,l);return b.length>this[p]?(this[r]&&this[r](s,e),!1):(this[m]+=b.length,this[n].unshift(b),this[a].set(s,this[n].head),S(this),!0)}has(s){if(!this[a].has(s))return!1;const e=this[a].get(s).value;return!E(this,e)}get(s){return c(this,s,!0)}peek(s){return c(this,s,!1)}pop(){const s=this[n].tail;return s?(C(this,s),s.value):null}del(s){C(this,this[a].get(s))}load(s){this.reset();const e=Date.now();for(let l=s.length-1;l>=0;l--){const f=s[l],y=f.e||0;if(y===0)this.set(f.k,f.v);else{const b=y-e;b>0&&this.set(f.k,f.v,b)}}}prune(){this[a].forEach((s,e)=>c(this,e,!1))}}const c=(v,s,e)=>{const l=v[a].get(s);if(l){const f=l.value;if(E(v,f)){if(C(v,l),!v[h])return}else e&&(v[x]&&(l.value.now=Date.now()),v[n].unshiftNode(l));return f.value}},E=(v,s)=>{if(!s||!s.maxAge&&!v[t])return!1;const e=Date.now()-s.now;return s.maxAge?e>s.maxAge:v[t]&&e>v[t]},S=v=>{if(v[m]>v[p])for(let s=v[n].tail;v[m]>v[p]&&s!==null;){const e=s.prev;C(v,s),s=e}},C=(v,s)=>{if(s){const e=s.value;v[r]&&v[r](e.key,e.value),v[m]-=e.length,v[a].delete(e.key),v[n].removeNode(s)}};class R{constructor(s,e,l,f,y){this.key=s,this.value=e,this.length=l,this.now=f,this.maxAge=y||0}}const U=(v,s,e,l)=>{let f=e.value;E(v,f)&&(C(v,e),v[h]||(f=void 0)),f&&s.call(l,f.value,f.key,v)};return X=g,X}var ht;function ye(){if(ht)return F.exports;ht=1;var o=Ot,p=yt(),m=F.exports=me(),u=ve(),h=new u({max:1e3}),t={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function r(g){return t[g]||g.slice(0,-1)}var i={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};F.exports.fromUrl=function(g,c){if(typeof g=="string"){var E=g+JSON.stringify(c||{});return h.has(E)||h.set(E,n(g,c)),h.get(E)}};function n(g,c){if(!(g==null||g==="")){var E=x(a(g)?"github:"+g:g),S=w(E),C=E.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),R=Object.keys(p).map(function(U){try{var v=p[U],s=null;S.auth&&i[S.protocol]&&(s=S.auth);var e=S.hash?decodeURIComponent(S.hash.substr(1)):null,l=null,f=null,y=null;if(C&&C[1]===U)l=C[2]&&decodeURIComponent(C[2]),f=decodeURIComponent(C[3].replace(/\.git$/,"")),y="shortcut";else{if(S.host&&S.host!==v.domain&&S.host.replace(/^www[.]/,"")!==v.domain||!v.protocols_re.test(S.protocol)||!S.path)return;var b=v.pathmatch,_=S.path.match(b);if(!_)return;_[1]!==null&&_[1]!==void 0&&(l=decodeURIComponent(_[1].replace(/^:/,""))),f=decodeURIComponent(_[2]),y=r(S.protocol)}return new m(U,l,s,f,e,y,c)}catch(A){if(!(A instanceof URIError))throw A}}).filter(function(U){return U});if(R.length===1)return R[0]}}function a(g){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(g)}function x(g){var c=o.parse(g);return c.protocol==="gist:"&&c.host&&!c.path?c.protocol+"/"+c.host:g}function w(g){var c=g.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!c){var E=o.parse(g);if(E.auth){const C=g.match(/[^@]+@[^:/]+/);if(C){var S=new o.URL(C[0]);E.auth=S.username||"",S.password&&(E.auth+=":"+S.password)}}return E}return{protocol:"git+ssh:",slashes:!0,auth:c[1],host:c[2],port:null,hostname:c[2],hash:c[4],search:null,query:null,pathname:"/"+c[3],path:"/"+c[3],href:"git+ssh://"+c[1]+"@"+c[2]+"/"+c[3]+(c[4]||"")}}return F.exports}var N={},P={},ft;function xe(){if(ft)return P;ft=1;var o=P&&P.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(P,"__esModule",{value:!0}),P.setService=P.findService=P.getDefaultServiceConfig=P.getServiceConfig=void 0;const p=o(oe),m=gt(),u={},h=a=>{u[a.name]={validate:a.schema.validate.bind(a.schema),defaultConfig:a.default}};P.setService=h,h({name:"auth",schema:m.authConfigSchema,default:{}});const t=a=>{if(!a)throw new Error("service name should not be empty");const x=u[a];if(!x)throw new Error(`service ${a} does not exist`);return x},r=(a,x,{validate:w}={})=>{const g=t(a),c=(0,p.default)(x||{}),{value:E,error:S}=g.validate(c);if(w&&S)throw new Error(`Invalid blocklet service config: ${S.details.map(C=>C.message).join(", ")}`);return E};P.getServiceConfig=r;const i=a=>{const{defaultConfig:x}=t(a);return x};P.getDefaultServiceConfig=i;const n=(a,x)=>{const w=[x];return(a||[]).find(g=>w.includes(g.name))};return P.findService=n,P.default={getServiceConfig:r,getDefaultServiceConfig:i,findService:n,setService:h},P}var pt;function be(){if(pt)return N;pt=1,Object.defineProperty(N,"__esModule",{value:!0}),N.fixAndValidateService=N.validateMeta=void 0;const o=gt(),p=xe(),m=h=>(!h.interfaces||!h.interfaces.length||h.interfaces.forEach(t=>{t.services&&t.services.length&&t.services.forEach(r=>{r.config=(0,p.getServiceConfig)(r.name,r.config,{validate:!0})})}),h);N.fixAndValidateService=m;const u=(h,{ensureFiles:t=!1,ensureDist:r=!1,ensureComponentStore:i=!0,ensureName:n=!1,skipValidateDidName:a=!1,schemaOptions:x={}}={})=>{const w=(0,o.createBlockletSchema)(null,{ensureFiles:t,ensureDist:r,ensureComponentStore:i,ensureName:n,skipValidateDidName:a,...x}),{value:g,error:c}=w.validate(h);if(c)throw new Error(`Invalid blocklet meta: ${c.details.map(E=>E.message).join(", ")}`);return g};return N.validateMeta=u,N.default=u,N}var mt;function je(){return mt||(mt=1,function(o){var p=T&&T.__createBinding||(Object.create?function(e,l,f,y){y===void 0&&(y=f);var b=Object.getOwnPropertyDescriptor(l,f);(!b||("get"in b?!l.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return l[f]}}),Object.defineProperty(e,y,b)}:function(e,l,f,y){y===void 0&&(y=f),e[y]=l[f]}),m=T&&T.__setModuleDefault||(Object.create?function(e,l){Object.defineProperty(e,"default",{enumerable:!0,value:l})}:function(e,l){e.default=l}),u=T&&T.__importStar||function(){var e=function(l){return e=Object.getOwnPropertyNames||function(f){var y=[];for(var b in f)Object.prototype.hasOwnProperty.call(f,b)&&(y[y.length]=b);return y},e(l)};return function(l){if(l&&l.__esModule)return l;var f={};if(l!=null)for(var y=e(l),b=0;b<y.length;b++)y[b]!=="default"&&p(f,l,y[b]);return m(f,l),f}}(),h=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.fixService=o.fixInterfaces=o.parsePerson=o.formatPerson=o.fixName=o.fixTags=o.fixPerson=o.fixKeywords=o.fixFiles=o.fixRepository=o.fixRequired=void 0;const t=h(Pt),r=u(ye()),i=Lt(),n=be();Object.defineProperty(o,"fixService",{enumerable:!0,get:function(){return n.fixAndValidateService}});const a=ne(),x=(e,l)=>{e.description||(e.description=`Blocklet from ${l}`),e.version||(e.version=i.BLOCKLET_DEFAULT_VERSION)};o.fixRequired=x;const w=e=>{if(e.repository&&(typeof e.repository=="string"&&(e.repository={type:"git",url:e.repository}),e.repository.url)){const l=r.fromUrl(e.repository.url);l&&(e.repository.url=l.getDefaultRepresentation()==="shortcut"?l.https():l.toString())}};o.fixRepository=w;const g=e=>{Array.isArray(e.files)?e.files&&(e.files=e.files.filter(l=>!(!l||typeof l!="string"))):delete e.files};o.fixFiles=g;const c=e=>{typeof e.keywords=="string"&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?delete e.keywords:e.keywords&&(e.keywords=e.keywords.filter(l=>!(typeof l!="string"||!l)))};o.fixKeywords=c;const E=e=>{typeof e.tags=="string"&&(e.tags=e.tags.split(/,\s+/)),e.tags&&!Array.isArray(e.tags)?delete e.tags:e.tags&&(e.tags=e.tags.filter(l=>!(typeof l!="string"||!l)))};o.fixTags=E;const S=(e,l)=>(e.author&&(e.author=l(e.author)),["maintainers","contributors"].forEach(f=>{Array.isArray(e[f])&&(e[f]=e[f].map(l))}),e),C=e=>{if(!e)return"";if(typeof e=="string")return e;const l=e.name||"",f=e.url||e.web,y=f?` (${f})`:"",b=e.email||e.mail,_=b?` <${b}>`:"";return l+_+y};o.formatPerson=C;const R=e=>{if(typeof e!="string")return e;const l=e.match(/^([^(<]+)/),f=e.match(/\(([^)]+)\)/),y=e.match(/<([^>]+)>/),b={};return l&&l[0].trim()&&(b.name=l[0].trim()),y&&([,b.email]=y),f&&([,b.url]=f),b};o.parsePerson=R;const U=e=>(S(e,C),S(e,R),e);o.fixPerson=U;const v=(e,l=!0)=>{if(Array.isArray(e.interfaces)||(e.interfaces=[]),e.interfaces.length)return e.interfaces.forEach(_=>{_.type===i.BLOCKLET_INTERFACE_TYPE_WEB&&(_.protocol="http")}),e;const y=(0,t.default)(e,"capabilities.dynamicPathPrefix",!0)?i.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",b=({type:_="web",name:A,path:W="/",protocol:G="http",port:B=i.BLOCKLET_DEFAULT_PORT_NAME})=>{e.interfaces.push({type:_,name:A,path:W,prefix:y,port:B,protocol:G})};return[i.BLOCKLET_INTERFACE_PUBLIC].forEach(_=>{e[_]&&b({name:_,path:e[_]})}),Array.isArray(e.exposeServices)&&e.exposeServices.forEach(_=>{b({type:"service",name:_.protocol,protocol:_.protocol,port:{internal:`BLOCKLET_${_.protocol}_PORT`.toUpperCase(),external:_.port}})}),l&&(delete e.publicUrl,delete e.adminUrl,delete e.configUrl,delete e.docUrl,delete e.exposeServices,e.capabilities&&delete e.capabilities.dynamicPathPrefix),e};o.fixInterfaces=v;const s=e=>{const{did:l}=e;try{(0,a.validateNewDid)(l),e.name=l}catch{}return e};o.fixName=s,o.default={fixRequired:x,fixRepository:w,fixFiles:g,fixKeywords:c,fixPerson:U,fixTags:E,fixName:s,formatPerson:C,parsePerson:R,fixInterfaces:v,fixService:n.fixAndValidateService}}(T)),T}var Se=je();function xt({owner:o,locale:p}){return j.jsxs(dt,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.fullName,o.did?j.jsx(Tt,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:o.did,compact:!0,size:14,locale:p}):null]})}xt.propTypes={owner:L.object.isRequired,locale:L.string.isRequired};const Ee="install-blocklet-from-URL",bt=()=>{const[o,p]=vt(Ee,"[]",{raw:!0}),m=h=>{const t=h.trim(),r=JSON.parse(o),i=r.findIndex(n=>n===t);i!==0&&(i>0&&r.splice(i,1),r.length>=10&&r.splice(9),r.unshift(t),p(JSON.stringify(r)))},u=h=>{if(!h)return;const t=JSON.parse(o),r=h.trim(),i=t.findIndex(n=>n===r);i>-1&&(t.splice(i,1),p(JSON.stringify(t)))};return{urls:o?JSON.parse(o):[],addUrlRecord:m,removeUrlRecord:u}};function jt({value:o="",onValueChange:p=()=>{},children:m=null,helperText:u=""}){const{urls:h,removeUrlRecord:t}=bt(),r=(i,n)=>{i.preventDefault(),i.stopPropagation(),t(n)};return j.jsxs(dt,{children:[j.jsx(le,{freeSolo:!0,options:h,inputValue:o,onInputChange:(i,n)=>{p(n)},disableClearable:!0,popupIcon:null,renderInput:i=>Dt.cloneElement(m,{...i}),renderOption:(i,n)=>I.createElement(Nt,{...i,key:n,secondaryAction:j.jsx(Mt,{edge:"end","aria-label":"delete",onClick:a=>r(a,n),children:j.jsx(ae,{})})},j.jsx(ce,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:j.jsx(qt,{primary:n,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),j.jsx(Wt,{style:{margin:0},children:u})]})}jt.propTypes={onValueChange:L.func,children:L.node,value:L.string,helperText:L.string};function _e({defaultUrl:o="",onCancel:p,onSuccess:m,onError:u=()=>{},mode:h="install",handleText:t={}}){const{api:r}=$t(),{api:i,session:n}=Bt(),[a,x]=I.useState(!1),[w,g]=I.useState(""),{t:c,locale:E}=Ft(),S={dist:{}},{encryptKey:C}=Gt(),[R,U]=I.useState(o),[v,s]=I.useState(o?1:0),[e,l]=I.useState(S),[f,y]=I.useState(!1),[b,_]=I.useState(""),[A]=vt("instant-blocklet-install",!1),[W,G]=I.useState({}),B=h==="component",H=B?!0:!o,{addUrlRecord:St}=bt(),$=I.useMemo(()=>(n.user?.connectedAccounts||[]).some(D=>D.provider===Ht.WALLET),[n.user]),Q=I.useMemo(()=>{let d=R.trim();return!d.startsWith("https://")&&!d.startsWith("http://")&&!d.startsWith("file://")&&(d=`file://${d}`),d},[R]),K=async()=>{l(S),g(null),x(!0);const d=Q;try{const O=decodeURIComponent(d);try{new URL(O)}catch{throw new Error("Invalid URL")}const{meta:D,inStore:It,registryUrl:Ut}=await r.getBlockletMetaFromUrl({input:{url:O}});l(D),G({inStore:It,registryUrl:Ut,inputUrl:d}),St(d)}catch(O){console.error(O);const D=`Blocklet Install failed: ${rt(O)}`;g(D),u(O)}finally{x(!1)}},Et=()=>{if(B){m({meta:e,...W}),p();return}if(A){x(!0),y(!0);return}const d=et(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=re(d,{blocklet_meta_url:decodeURIComponent(Q.trim()),from:"url"})},Z=()=>{x(!1),y(!1),m({meta:e,...W}),p()},_t=()=>{x(!1),y(!1)};I.useEffect(()=>{o&&K()},[o]);const q=I.useMemo(()=>({title:e.title,wt:Kt(e),blockletMetaUrl:decodeURIComponent(R.trim())}),[e,R]),k=I.useCallback(async()=>{if($||A){_("");return}const d=new URL(window.location.href);d.pathname=et(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),d.searchParams.set("_ek_",C),Object.keys(q).forEach(D=>{d.searchParams.set(D,q[D])});const{data:O}=await i.get(d.href);O.url?_(O.url):_("")},[$,q,i,C,A]);I.useEffect(()=>{k()},[k]);const Ct=I.useMemo(()=>$&&b?{...q,nw:b,skipMigrateAccount:!0}:q,[q,b,$]),wt=[{name:c("common.name"),value:Vt.getDisplayName({meta:e},!0)},{name:c("common.version"),value:e.version},{name:c("common.did"),value:e.did?j.jsx(zt,{did:e.did}):null},{name:c("common.author"),value:e.owner?j.jsx(xt,{owner:e.owner,locale:E}):Se.formatPerson(e.author)},{name:c("blocklet.dist.downloadLink"),value:e.dist.tarball}],Rt=()=>a?j.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:j.jsx(nt,{})}):e.did?j.jsx("div",{style:{paddingLeft:"10%"},children:wt.map(d=>d.name===c("common.did")?j.jsx(st,{valueComponent:"div",nameWidth:120,name:d.name,nameFormatter:()=>c("common.did"),children:d.value},d.name):j.jsx(st,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.name))}):null,At=Yt(async()=>{let d=e.title;n.user&&(d=`${n.user.fullName}'s ${e.title}`);try{Z(),await r.launchBlockletWithoutWallet({input:{title:d,blockletMetaUrl:decodeURIComponent(R.trim()),type:"store",storeUrl:W.registryUrl,onlyRequired:!0}})}catch(O){console.error("launchBlockletWithoutWallet error:",O),Jt.error(rt(O),{autoHideDuration:3e3})}}),tt=[{label:c("blocklet.fromUrl.step0"),body:j.jsx(Xt,{component:"div",children:j.jsx(jt,{style:{marginBottom:32},value:R,helperText:c("blocklet.fromUrl.description"),onValueChange:d=>{g(null),U(d)},children:j.jsx(Qt,{label:c("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:R,onChange:d=>{g(null),U(d.target.value)},disabled:a,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),K(),s(1))}})})}),cancel:c("common.cancel"),confirm:c("common.next"),onCancel:p,onConfirm:()=>{K(),s(1)}},{label:c("blocklet.fromUrl.step1"),body:Rt(),cancel:c(H?"common.pre":"common.cancel"),confirm:t?.confirm||c("blocklet.fromUrl.confirm"),onCancel:()=>{H?s(d=>d-1):p()},onConfirm:()=>{Et()}}],M=tt[v];return j.jsxs(j.Fragment,{children:[j.jsxs(Zt,{title:t?.title||c("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>M.onCancel(),showCloseButton:v===0,disableEscapeKeyDown:!0,open:!0,actions:j.jsxs(j.Fragment,{children:[M.cancel&&j.jsx(it,{onClick:d=>{d.stopPropagation(),g(null),M.onCancel()},color:"inherit",children:M.cancel||c("common.cancel")}),j.jsxs(it,{onClick:d=>{d.stopPropagation(),M.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!R||w,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[a&&v===0&&j.jsx(nt,{size:16}),M.confirm]})]}),children:[H&&j.jsx(ue,{alternativeLabel:!0,activeStep:v,children:tt.map(({label:d})=>j.jsx(he,{children:j.jsx(fe,{children:d})},d))}),j.jsx(kt,{component:"div",style:{marginTop:24},children:M.body}),!!w&&j.jsx(te,{severity:"error",style:{width:"100%",marginTop:8},children:w})]}),e&&f&&j.jsx(ee,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!$&&!A?"bind-wallet":"launch-free-blocklet-by-session",checkFn:i.get,checkTimeout:5*60*1e3,onSuccess:Z,extraParams:Ct,messages:{title:c("setup.keyPair.title"),scan:c("setup.keyPair.scan"),confirm:c("setup.keyPair.confirm"),success:c("setup.keyPair.success")},onClose:_t,customItems:A?[]:[j.jsx(se,{onClick:At})]})]})}_e.propTypes={defaultUrl:L.string,onCancel:L.func.isRequired,onSuccess:L.func.isRequired,onError:L.func,mode:L.oneOf(["install","component"]),handleText:L.object};export{pe as B,_e as I,xt as a,Se as f};
|
|
1
|
+
import{j,o as L,eF as Ot,eG as Pt,eH as Lt,J as dt,eI as Tt,r as I,be as Dt,a8 as Nt,a4 as Mt,a9 as qt,bi as Wt,bn as $t,n as Bt,V as Ft,cM as Gt,cO as Ht,bC as Kt,y as et,i as Vt,W as zt,F as Yt,H as Jt,Z as rt,T as Xt,t as Qt,$ as Zt,D as kt,Y as te,v as it,C as nt,w as ee,z as re}from"./index-Bek3Nxot.js";import{W as ie}from"./status-B-GGRrEB.js";import{r as gt,a as ne,W as se}from"./without-wallet-qfmn1VhQ.js";import{r as oe}from"./cloneDeep-DNOsGRuG.js";import{u as vt}from"./useLocalStorage-Dpl2DibN.js";import{v as st}from"./index-B8qqbKQt.js";import{D as ae}from"./Delete-B306vkSB.js";import{A as le}from"./Autocomplete-79tADtg2.js";import{L as ce}from"./ListItemButton-C8XIzvy_.js";import{S as ue,a as he,b as fe}from"./Stepper-DfUO9buC.js";function pe({mode:o,...p}){return o==="development"?j.jsx(ie,{type:"primary",...p,children:"DEV"}):null}pe.propTypes={mode:L.string.isRequired};var T={},F={exports:{}},V={exports:{}},ot;function yt(){if(ot)return V.exports;ot=1;var o=V.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(u){return"file-"+m(u)}}},p={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:m};Object.keys(o).forEach(function(u){Object.keys(p).forEach(function(h){o[u][h]||(o[u][h]=p[h])}),o[u].protocols_re=RegExp("^("+o[u].protocols.map(function(h){return h.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function m(u){return u.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return V.exports}var z,at;function me(){if(at)return z;at=1;var o=yt(),p=Object.assign||function(h,t){if(t===null||typeof t!="object")return h;const r=Object.keys(t);let i=r.length;for(;i--;)h[r[i]]=t[r[i]];return h};z=m;function m(u,h,t,r,i,n,a){var x=this;x.type=u,Object.keys(o[u]).forEach(function(w){x[w]=o[u][w]}),x.user=h,x.auth=t,x.project=r,x.committish=i,x.default=n,x.opts=a||{}}return m.prototype.hash=function(){return this.committish?"#"+this.committish:""},m.prototype._fill=function(u,h){if(u){var t=p({},h);t.path=t.path?t.path.replace(/^[/]+/g,""):"",h=p(p({},this.opts),h);var r=this;Object.keys(this).forEach(function(c){r[c]!=null&&t[c]==null&&(t[c]=r[c])});var i=t.auth,n=t.committish,a=t.fragment,x=t.path,w=t.project;Object.keys(t).forEach(function(c){var _=t[c];(c==="path"||c==="project")&&typeof _=="string"?t[c]=_.split("/").map(function(S){return encodeURIComponent(S)}).join("/"):c!=="domain"&&(t[c]=encodeURIComponent(_))}),t["auth@"]=i?i+"@":"",t["#fragment"]=a?"#"+this.hashformat(a):"",t.fragment=t.fragment?t.fragment:"",t["#path"]=x?"#"+this.hashformat(x):"",t["/path"]=t.path?"/"+t.path:"",t.projectPath=w.split("/").map(encodeURIComponent).join("/"),h.noCommittish?(t["#committish"]="",t["/tree/committish"]="",t["/committish"]="",t.committish=""):(t["#committish"]=n?"#"+n:"",t["/tree/committish"]=t.committish?"/"+t.treepath+"/"+t.committish:"",t["/committish"]=t.committish?"/"+t.committish:"",t.committish=t.committish||"master");var g=u;return Object.keys(t).forEach(function(c){g=g.replace(new RegExp("[{]"+c+"[}]","g"),t[c])}),h.noGitPlus?g.replace(/^git[+]/,""):g}},m.prototype.ssh=function(u){return this._fill(this.sshtemplate,u)},m.prototype.sshurl=function(u){return this._fill(this.sshurltemplate,u)},m.prototype.browse=function(u,h,t){return typeof u=="string"?(typeof h!="string"&&(t=h,h=null),this._fill(this.browsefiletemplate,p({fragment:h,path:u},t))):this._fill(this.browsetemplate,u)},m.prototype.docs=function(u){return this._fill(this.docstemplate,u)},m.prototype.bugs=function(u){return this._fill(this.bugstemplate,u)},m.prototype.https=function(u){return this._fill(this.httpstemplate,u)},m.prototype.git=function(u){return this._fill(this.gittemplate,u)},m.prototype.shortcut=function(u){return this._fill(this.shortcuttemplate,u)},m.prototype.path=function(u){return this._fill(this.pathtemplate,u)},m.prototype.tarball=function(u){var h=p({},u,{noCommittish:!1});return this._fill(this.tarballtemplate,h)},m.prototype.file=function(u,h){return this._fill(this.filetemplate,p({path:u},h))},m.prototype.getDefaultRepresentation=function(){return this.default},m.prototype.toString=function(u){return this.default&&typeof this[this.default]=="function"?this[this.default](u):this.sshurl(u)},z}var Y,lt;function de(){return lt||(lt=1,Y=function(o){o.prototype[Symbol.iterator]=function*(){for(let p=this.head;p;p=p.next)yield p.value}}),Y}var J,ct;function ge(){if(ct)return J;ct=1,J=o,o.Node=h,o.create=o;function o(t){var r=this;if(r instanceof o||(r=new o),r.tail=null,r.head=null,r.length=0,t&&typeof t.forEach=="function")t.forEach(function(a){r.push(a)});else if(arguments.length>0)for(var i=0,n=arguments.length;i<n;i++)r.push(arguments[i]);return r}o.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var r=t.next,i=t.prev;return r&&(r.prev=i),i&&(i.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=i),t.list.length--,t.next=null,t.prev=null,t.list=null,r},o.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},o.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||(this.head=t),this.length++}},o.prototype.push=function(){for(var t=0,r=arguments.length;t<r;t++)m(this,arguments[t]);return this.length},o.prototype.unshift=function(){for(var t=0,r=arguments.length;t<r;t++)u(this,arguments[t]);return this.length},o.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},o.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},o.prototype.forEach=function(t,r){r=r||this;for(var i=this.head,n=0;i!==null;n++)t.call(r,i.value,n,this),i=i.next},o.prototype.forEachReverse=function(t,r){r=r||this;for(var i=this.tail,n=this.length-1;i!==null;n--)t.call(r,i.value,n,this),i=i.prev},o.prototype.get=function(t){for(var r=0,i=this.head;i!==null&&r<t;r++)i=i.next;if(r===t&&i!==null)return i.value},o.prototype.getReverse=function(t){for(var r=0,i=this.tail;i!==null&&r<t;r++)i=i.prev;if(r===t&&i!==null)return i.value},o.prototype.map=function(t,r){r=r||this;for(var i=new o,n=this.head;n!==null;)i.push(t.call(r,n.value,this)),n=n.next;return i},o.prototype.mapReverse=function(t,r){r=r||this;for(var i=new o,n=this.tail;n!==null;)i.push(t.call(r,n.value,this)),n=n.prev;return i},o.prototype.reduce=function(t,r){var i,n=this.head;if(arguments.length>1)i=r;else if(this.head)n=this.head.next,i=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=0;n!==null;a++)i=t(i,n.value,a),n=n.next;return i},o.prototype.reduceReverse=function(t,r){var i,n=this.tail;if(arguments.length>1)i=r;else if(this.tail)n=this.tail.prev,i=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var a=this.length-1;n!==null;a--)i=t(i,n.value,a),n=n.prev;return i},o.prototype.toArray=function(){for(var t=new Array(this.length),r=0,i=this.head;i!==null;r++)t[r]=i.value,i=i.next;return t},o.prototype.toArrayReverse=function(){for(var t=new Array(this.length),r=0,i=this.tail;i!==null;r++)t[r]=i.value,i=i.prev;return t},o.prototype.slice=function(t,r){r=r||this.length,r<0&&(r+=this.length),t=t||0,t<0&&(t+=this.length);var i=new o;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=0,a=this.head;a!==null&&n<t;n++)a=a.next;for(;a!==null&&n<r;n++,a=a.next)i.push(a.value);return i},o.prototype.sliceReverse=function(t,r){r=r||this.length,r<0&&(r+=this.length),t=t||0,t<0&&(t+=this.length);var i=new o;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);for(var n=this.length,a=this.tail;a!==null&&n>r;n--)a=a.prev;for(;a!==null&&n>t;n--,a=a.prev)i.push(a.value);return i},o.prototype.splice=function(t,r,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,a=this.head;a!==null&&n<t;n++)a=a.next;for(var x=[],n=0;a&&n<r;n++)x.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var n=0;n<i.length;n++)a=p(this,a,i[n]);return x},o.prototype.reverse=function(){for(var t=this.head,r=this.tail,i=t;i!==null;i=i.prev){var n=i.prev;i.prev=i.next,i.next=n}return this.head=r,this.tail=t,this};function p(t,r,i){var n=r===t.head?new h(i,null,r,t):new h(i,r,r.next,t);return n.next===null&&(t.tail=n),n.prev===null&&(t.head=n),t.length++,n}function m(t,r){t.tail=new h(r,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function u(t,r){t.head=new h(r,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function h(t,r,i,n){if(!(this instanceof h))return new h(t,r,i,n);this.list=n,this.value=t,r?(r.next=this,this.prev=r):this.prev=null,i?(i.prev=this,this.next=i):this.next=null}try{de()(o)}catch{}return J}var X,ut;function ve(){if(ut)return X;ut=1;const o=ge(),p=Symbol("max"),m=Symbol("length"),u=Symbol("lengthCalculator"),h=Symbol("allowStale"),t=Symbol("maxAge"),r=Symbol("dispose"),i=Symbol("noDisposeOnSet"),n=Symbol("lruList"),a=Symbol("cache"),x=Symbol("updateAgeOnGet"),w=()=>1;class g{constructor(s){if(typeof s=="number"&&(s={max:s}),s||(s={}),s.max&&(typeof s.max!="number"||s.max<0))throw new TypeError("max must be a non-negative number");this[p]=s.max||1/0;const e=s.length||w;if(this[u]=typeof e!="function"?w:e,this[h]=s.stale||!1,s.maxAge&&typeof s.maxAge!="number")throw new TypeError("maxAge must be a number");this[t]=s.maxAge||0,this[r]=s.dispose,this[i]=s.noDisposeOnSet||!1,this[x]=s.updateAgeOnGet||!1,this.reset()}set max(s){if(typeof s!="number"||s<0)throw new TypeError("max must be a non-negative number");this[p]=s||1/0,S(this)}get max(){return this[p]}set allowStale(s){this[h]=!!s}get allowStale(){return this[h]}set maxAge(s){if(typeof s!="number")throw new TypeError("maxAge must be a non-negative number");this[t]=s,S(this)}get maxAge(){return this[t]}set lengthCalculator(s){typeof s!="function"&&(s=w),s!==this[u]&&(this[u]=s,this[m]=0,this[n].forEach(e=>{e.length=this[u](e.value,e.key),this[m]+=e.length})),S(this)}get lengthCalculator(){return this[u]}get length(){return this[m]}get itemCount(){return this[n].length}rforEach(s,e){e=e||this;for(let l=this[n].tail;l!==null;){const f=l.prev;U(this,s,l,e),l=f}}forEach(s,e){e=e||this;for(let l=this[n].head;l!==null;){const f=l.next;U(this,s,l,e),l=f}}keys(){return this[n].toArray().map(s=>s.key)}values(){return this[n].toArray().map(s=>s.value)}reset(){this[r]&&this[n]&&this[n].length&&this[n].forEach(s=>this[r](s.key,s.value)),this[a]=new Map,this[n]=new o,this[m]=0}dump(){return this[n].map(s=>_(this,s)?!1:{k:s.key,v:s.value,e:s.now+(s.maxAge||0)}).toArray().filter(s=>s)}dumpLru(){return this[n]}set(s,e,l){if(l=l||this[t],l&&typeof l!="number")throw new TypeError("maxAge must be a number");const f=l?Date.now():0,y=this[u](e,s);if(this[a].has(s)){if(y>this[p])return C(this,this[a].get(s)),!1;const A=this[a].get(s).value;return this[r]&&(this[i]||this[r](s,A.value)),A.now=f,A.maxAge=l,A.value=e,this[m]+=y-A.length,A.length=y,this.get(s),S(this),!0}const b=new R(s,e,y,f,l);return b.length>this[p]?(this[r]&&this[r](s,e),!1):(this[m]+=b.length,this[n].unshift(b),this[a].set(s,this[n].head),S(this),!0)}has(s){if(!this[a].has(s))return!1;const e=this[a].get(s).value;return!_(this,e)}get(s){return c(this,s,!0)}peek(s){return c(this,s,!1)}pop(){const s=this[n].tail;return s?(C(this,s),s.value):null}del(s){C(this,this[a].get(s))}load(s){this.reset();const e=Date.now();for(let l=s.length-1;l>=0;l--){const f=s[l],y=f.e||0;if(y===0)this.set(f.k,f.v);else{const b=y-e;b>0&&this.set(f.k,f.v,b)}}}prune(){this[a].forEach((s,e)=>c(this,e,!1))}}const c=(v,s,e)=>{const l=v[a].get(s);if(l){const f=l.value;if(_(v,f)){if(C(v,l),!v[h])return}else e&&(v[x]&&(l.value.now=Date.now()),v[n].unshiftNode(l));return f.value}},_=(v,s)=>{if(!s||!s.maxAge&&!v[t])return!1;const e=Date.now()-s.now;return s.maxAge?e>s.maxAge:v[t]&&e>v[t]},S=v=>{if(v[m]>v[p])for(let s=v[n].tail;v[m]>v[p]&&s!==null;){const e=s.prev;C(v,s),s=e}},C=(v,s)=>{if(s){const e=s.value;v[r]&&v[r](e.key,e.value),v[m]-=e.length,v[a].delete(e.key),v[n].removeNode(s)}};class R{constructor(s,e,l,f,y){this.key=s,this.value=e,this.length=l,this.now=f,this.maxAge=y||0}}const U=(v,s,e,l)=>{let f=e.value;_(v,f)&&(C(v,e),v[h]||(f=void 0)),f&&s.call(l,f.value,f.key,v)};return X=g,X}var ht;function ye(){if(ht)return F.exports;ht=1;var o=Ot,p=yt(),m=F.exports=me(),u=ve(),h=new u({max:1e3}),t={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function r(g){return t[g]||g.slice(0,-1)}var i={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};F.exports.fromUrl=function(g,c){if(typeof g=="string"){var _=g+JSON.stringify(c||{});return h.has(_)||h.set(_,n(g,c)),h.get(_)}};function n(g,c){if(!(g==null||g==="")){var _=x(a(g)?"github:"+g:g),S=w(_),C=_.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),R=Object.keys(p).map(function(U){try{var v=p[U],s=null;S.auth&&i[S.protocol]&&(s=S.auth);var e=S.hash?decodeURIComponent(S.hash.substr(1)):null,l=null,f=null,y=null;if(C&&C[1]===U)l=C[2]&&decodeURIComponent(C[2]),f=decodeURIComponent(C[3].replace(/\.git$/,"")),y="shortcut";else{if(S.host&&S.host!==v.domain&&S.host.replace(/^www[.]/,"")!==v.domain||!v.protocols_re.test(S.protocol)||!S.path)return;var b=v.pathmatch,E=S.path.match(b);if(!E)return;E[1]!==null&&E[1]!==void 0&&(l=decodeURIComponent(E[1].replace(/^:/,""))),f=decodeURIComponent(E[2]),y=r(S.protocol)}return new m(U,l,s,f,e,y,c)}catch(A){if(!(A instanceof URIError))throw A}}).filter(function(U){return U});if(R.length===1)return R[0]}}function a(g){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(g)}function x(g){var c=o.parse(g);return c.protocol==="gist:"&&c.host&&!c.path?c.protocol+"/"+c.host:g}function w(g){var c=g.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!c){var _=o.parse(g);if(_.auth){const C=g.match(/[^@]+@[^:/]+/);if(C){var S=new o.URL(C[0]);_.auth=S.username||"",S.password&&(_.auth+=":"+S.password)}}return _}return{protocol:"git+ssh:",slashes:!0,auth:c[1],host:c[2],port:null,hostname:c[2],hash:c[4],search:null,query:null,pathname:"/"+c[3],path:"/"+c[3],href:"git+ssh://"+c[1]+"@"+c[2]+"/"+c[3]+(c[4]||"")}}return F.exports}var N={},P={},ft;function xe(){if(ft)return P;ft=1;var o=P&&P.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(P,"__esModule",{value:!0}),P.setService=P.findService=P.getDefaultServiceConfig=P.getServiceConfig=void 0;const p=o(oe),m=gt(),u={},h=a=>{u[a.name]={validate:a.schema.validate.bind(a.schema),defaultConfig:a.default}};P.setService=h,h({name:"auth",schema:m.authConfigSchema,default:{}});const t=a=>{if(!a)throw new Error("service name should not be empty");const x=u[a];if(!x)throw new Error(`service ${a} does not exist`);return x},r=(a,x,{validate:w}={})=>{const g=t(a),c=(0,p.default)(x||{}),{value:_,error:S}=g.validate(c);if(w&&S)throw new Error(`Invalid blocklet service config: ${S.details.map(C=>C.message).join(", ")}`);return _};P.getServiceConfig=r;const i=a=>{const{defaultConfig:x}=t(a);return x};P.getDefaultServiceConfig=i;const n=(a,x)=>{const w=[x];return(a||[]).find(g=>w.includes(g.name))};return P.findService=n,P.default={getServiceConfig:r,getDefaultServiceConfig:i,findService:n,setService:h},P}var pt;function be(){if(pt)return N;pt=1,Object.defineProperty(N,"__esModule",{value:!0}),N.fixAndValidateService=N.validateMeta=void 0;const o=gt(),p=xe(),m=h=>(!h.interfaces||!h.interfaces.length||h.interfaces.forEach(t=>{t.services&&t.services.length&&t.services.forEach(r=>{r.config=(0,p.getServiceConfig)(r.name,r.config,{validate:!0})})}),h);N.fixAndValidateService=m;const u=(h,{ensureFiles:t=!1,ensureDist:r=!1,ensureComponentStore:i=!0,ensureName:n=!1,skipValidateDidName:a=!1,schemaOptions:x={}}={})=>{const w=(0,o.createBlockletSchema)(null,{ensureFiles:t,ensureDist:r,ensureComponentStore:i,ensureName:n,skipValidateDidName:a,...x}),{value:g,error:c}=w.validate(h);if(c)throw new Error(`Invalid blocklet meta: ${c.details.map(_=>_.message).join(", ")}`);return g};return N.validateMeta=u,N.default=u,N}var mt;function je(){return mt||(mt=1,function(o){var p=T&&T.__createBinding||(Object.create?function(e,l,f,y){y===void 0&&(y=f);var b=Object.getOwnPropertyDescriptor(l,f);(!b||("get"in b?!l.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return l[f]}}),Object.defineProperty(e,y,b)}:function(e,l,f,y){y===void 0&&(y=f),e[y]=l[f]}),m=T&&T.__setModuleDefault||(Object.create?function(e,l){Object.defineProperty(e,"default",{enumerable:!0,value:l})}:function(e,l){e.default=l}),u=T&&T.__importStar||function(){var e=function(l){return e=Object.getOwnPropertyNames||function(f){var y=[];for(var b in f)Object.prototype.hasOwnProperty.call(f,b)&&(y[y.length]=b);return y},e(l)};return function(l){if(l&&l.__esModule)return l;var f={};if(l!=null)for(var y=e(l),b=0;b<y.length;b++)y[b]!=="default"&&p(f,l,y[b]);return m(f,l),f}}(),h=T&&T.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0}),o.fixService=o.fixInterfaces=o.parsePerson=o.formatPerson=o.fixName=o.fixTags=o.fixPerson=o.fixKeywords=o.fixFiles=o.fixRepository=o.fixRequired=void 0;const t=h(Pt),r=u(ye()),i=Lt(),n=be();Object.defineProperty(o,"fixService",{enumerable:!0,get:function(){return n.fixAndValidateService}});const a=ne(),x=(e,l)=>{e.description||(e.description=`Blocklet from ${l}`),e.version||(e.version=i.BLOCKLET_DEFAULT_VERSION)};o.fixRequired=x;const w=e=>{if(e.repository&&(typeof e.repository=="string"&&(e.repository={type:"git",url:e.repository}),e.repository.url)){const l=r.fromUrl(e.repository.url);l&&(e.repository.url=l.getDefaultRepresentation()==="shortcut"?l.https():l.toString())}};o.fixRepository=w;const g=e=>{Array.isArray(e.files)?e.files&&(e.files=e.files.filter(l=>!(!l||typeof l!="string"))):delete e.files};o.fixFiles=g;const c=e=>{typeof e.keywords=="string"&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?delete e.keywords:e.keywords&&(e.keywords=e.keywords.filter(l=>!(typeof l!="string"||!l)))};o.fixKeywords=c;const _=e=>{typeof e.tags=="string"&&(e.tags=e.tags.split(/,\s+/)),e.tags&&!Array.isArray(e.tags)?delete e.tags:e.tags&&(e.tags=e.tags.filter(l=>!(typeof l!="string"||!l)))};o.fixTags=_;const S=(e,l)=>(e.author&&(e.author=l(e.author)),["maintainers","contributors"].forEach(f=>{Array.isArray(e[f])&&(e[f]=e[f].map(l))}),e),C=e=>{if(!e)return"";if(typeof e=="string")return e;const l=e.name||"",f=e.url||e.web,y=f?` (${f})`:"",b=e.email||e.mail,E=b?` <${b}>`:"";return l+E+y};o.formatPerson=C;const R=e=>{if(typeof e!="string")return e;const l=e.match(/^([^(<]+)/),f=e.match(/\(([^)]+)\)/),y=e.match(/<([^>]+)>/),b={};return l&&l[0].trim()&&(b.name=l[0].trim()),y&&([,b.email]=y),f&&([,b.url]=f),b};o.parsePerson=R;const U=e=>(S(e,C),S(e,R),e);o.fixPerson=U;const v=(e,l=!0)=>{if(Array.isArray(e.interfaces)||(e.interfaces=[]),e.interfaces.length)return e.interfaces.forEach(E=>{E.type===i.BLOCKLET_INTERFACE_TYPE_WEB&&(E.protocol="http")}),e;const y=(0,t.default)(e,"capabilities.dynamicPathPrefix",!0)?i.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",b=({type:E="web",name:A,path:W="/",protocol:G="http",port:B=i.BLOCKLET_DEFAULT_PORT_NAME})=>{e.interfaces.push({type:E,name:A,path:W,prefix:y,port:B,protocol:G})};return[i.BLOCKLET_INTERFACE_PUBLIC].forEach(E=>{e[E]&&b({name:E,path:e[E]})}),Array.isArray(e.exposeServices)&&e.exposeServices.forEach(E=>{b({type:"service",name:E.protocol,protocol:E.protocol,port:{internal:`BLOCKLET_${E.protocol}_PORT`.toUpperCase(),external:E.port}})}),l&&(delete e.publicUrl,delete e.adminUrl,delete e.configUrl,delete e.docUrl,delete e.exposeServices,e.capabilities&&delete e.capabilities.dynamicPathPrefix),e};o.fixInterfaces=v;const s=e=>{const{did:l}=e;try{(0,a.validateNewDid)(l),e.name=l}catch{}return e};o.fixName=s,o.default={fixRequired:x,fixRepository:w,fixFiles:g,fixKeywords:c,fixPerson:U,fixTags:_,fixName:s,formatPerson:C,parsePerson:R,fixInterfaces:v,fixService:n.fixAndValidateService}}(T)),T}var Se=je();function xt({owner:o,locale:p}){return j.jsxs(dt,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.fullName,o.did?j.jsx(Tt,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:o.did,compact:!0,size:14,locale:p}):null]})}xt.propTypes={owner:L.object.isRequired,locale:L.string.isRequired};const _e="install-blocklet-from-URL",bt=()=>{const[o,p]=vt(_e,"[]",{raw:!0}),m=h=>{const t=h.trim(),r=JSON.parse(o),i=r.findIndex(n=>n===t);i!==0&&(i>0&&r.splice(i,1),r.length>=10&&r.splice(9),r.unshift(t),p(JSON.stringify(r)))},u=h=>{if(!h)return;const t=JSON.parse(o),r=h.trim(),i=t.findIndex(n=>n===r);i>-1&&(t.splice(i,1),p(JSON.stringify(t)))};return{urls:o?JSON.parse(o):[],addUrlRecord:m,removeUrlRecord:u}};function jt({value:o="",onValueChange:p=()=>{},children:m=null,helperText:u=""}){const{urls:h,removeUrlRecord:t}=bt(),r=(i,n)=>{i.preventDefault(),i.stopPropagation(),t(n)};return j.jsxs(dt,{children:[j.jsx(le,{freeSolo:!0,options:h,inputValue:o,onInputChange:(i,n)=>{p(n)},disableClearable:!0,popupIcon:null,renderInput:i=>Dt.cloneElement(m,{...i}),renderOption:(i,n)=>I.createElement(Nt,{...i,key:n,secondaryAction:j.jsx(Mt,{edge:"end","aria-label":"delete",onClick:a=>r(a,n),children:j.jsx(ae,{})})},j.jsx(ce,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:j.jsx(qt,{primary:n,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),j.jsx(Wt,{style:{margin:0},children:u})]})}jt.propTypes={onValueChange:L.func,children:L.node,value:L.string,helperText:L.string};function Ee({defaultUrl:o="",onCancel:p,onSuccess:m,onError:u=()=>{},mode:h="install",handleText:t={}}){const{api:r}=$t(),{api:i,session:n}=Bt(),[a,x]=I.useState(!1),[w,g]=I.useState(""),{t:c,locale:_}=Ft(),S={dist:{}},{encryptKey:C}=Gt(),[R,U]=I.useState(o),[v,s]=I.useState(o?1:0),[e,l]=I.useState(S),[f,y]=I.useState(!1),[b,E]=I.useState(""),[A]=vt("instant-blocklet-install",!1),[W,G]=I.useState({}),B=h==="component",H=B?!0:!o,{addUrlRecord:St}=bt(),$=I.useMemo(()=>(n.user?.connectedAccounts||[]).some(D=>D.provider===Ht.WALLET),[n.user]),Q=I.useMemo(()=>{let d=R.trim();return!d.startsWith("https://")&&!d.startsWith("http://")&&!d.startsWith("file://")&&(d=`file://${d}`),d},[R]),K=async()=>{l(S),g(null),x(!0);const d=Q;try{const O=decodeURIComponent(d);try{new URL(O)}catch{throw new Error("Invalid URL")}const{meta:D,inStore:It,registryUrl:Ut}=await r.getBlockletMetaFromUrl({input:{url:O}});l(D),G({inStore:It,registryUrl:Ut,inputUrl:d}),St(d)}catch(O){console.error(O);const D=`Blocklet Install failed: ${rt(O)}`;g(D),u(O)}finally{x(!1)}},_t=()=>{if(B){m({meta:e,...W}),p();return}if(A){x(!0),y(!0);return}const d=et(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=re(d,{blocklet_meta_url:decodeURIComponent(Q.trim()),from:"url"})},Z=()=>{x(!1),y(!1),m({meta:e,...W}),p()},Et=()=>{x(!1),y(!1)};I.useEffect(()=>{o&&K()},[o]);const q=I.useMemo(()=>({title:e.title,wt:Kt(e),blockletMetaUrl:decodeURIComponent(R.trim())}),[e,R]),k=I.useCallback(async()=>{if($||A){E("");return}const d=new URL(window.location.href);d.pathname=et(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),d.searchParams.set("_ek_",C),Object.keys(q).forEach(D=>{d.searchParams.set(D,q[D])});const{data:O}=await i.get(d.href);O.url?E(O.url):E("")},[$,q,i,C,A]);I.useEffect(()=>{k()},[k]);const Ct=I.useMemo(()=>$&&b?{...q,nw:b,skipMigrateAccount:!0}:q,[q,b,$]),wt=[{name:c("common.name"),value:Vt.getDisplayName({meta:e},!0)},{name:c("common.version"),value:e.version},{name:c("common.did"),value:e.did?j.jsx(zt,{did:e.did}):null},{name:c("common.author"),value:e.owner?j.jsx(xt,{owner:e.owner,locale:_}):Se.formatPerson(e.author)},{name:c("blocklet.dist.downloadLink"),value:e.dist.tarball}],Rt=()=>a?j.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:j.jsx(nt,{})}):e.did?j.jsx("div",{style:{paddingLeft:"10%"},children:wt.map(d=>d.name===c("common.did")?j.jsx(st,{valueComponent:"div",nameWidth:120,name:d.name,nameFormatter:()=>c("common.did"),children:d.value},d.name):j.jsx(st,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.name))}):null,At=Yt(async()=>{let d=e.title;n.user&&(d=`${n.user.fullName}'s ${e.title}`);try{Z(),await r.launchBlockletWithoutWallet({input:{title:d,blockletMetaUrl:decodeURIComponent(R.trim()),type:"store",storeUrl:W.registryUrl,onlyRequired:!0}})}catch(O){console.error("launchBlockletWithoutWallet error:",O),Jt.error(rt(O),{autoHideDuration:3e3})}}),tt=[{label:c("blocklet.fromUrl.step0"),body:j.jsx(Xt,{component:"div",children:j.jsx(jt,{style:{marginBottom:32},value:R,helperText:c("blocklet.fromUrl.description"),onValueChange:d=>{g(null),U(d)},children:j.jsx(Qt,{label:c("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:R,onChange:d=>{g(null),U(d.target.value)},disabled:a,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),K(),s(1))}})})}),cancel:c("common.cancel"),confirm:c("common.next"),onCancel:p,onConfirm:()=>{K(),s(1)}},{label:c("blocklet.fromUrl.step1"),body:Rt(),cancel:c(H?"common.pre":"common.cancel"),confirm:t?.confirm||c("blocklet.fromUrl.confirm"),onCancel:()=>{H?s(d=>d-1):p()},onConfirm:()=>{_t()}}],M=tt[v];return j.jsxs(j.Fragment,{children:[j.jsxs(Zt,{title:t?.title||c("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>M.onCancel(),showCloseButton:v===0,disableEscapeKeyDown:!0,open:!0,actions:j.jsxs(j.Fragment,{children:[M.cancel&&j.jsx(it,{onClick:d=>{d.stopPropagation(),g(null),M.onCancel()},color:"inherit",children:M.cancel||c("common.cancel")}),j.jsxs(it,{onClick:d=>{d.stopPropagation(),M.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!R||w,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[a&&v===0&&j.jsx(nt,{size:16}),M.confirm]})]}),children:[H&&j.jsx(ue,{alternativeLabel:!0,activeStep:v,children:tt.map(({label:d})=>j.jsx(he,{children:j.jsx(fe,{children:d})},d))}),j.jsx(kt,{component:"div",style:{marginTop:24},children:M.body}),!!w&&j.jsx(te,{severity:"error",style:{width:"100%",marginTop:8},children:w})]}),e&&f&&j.jsx(ee,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!$&&!A?"bind-wallet":"launch-free-blocklet-by-session",checkFn:i.get,checkTimeout:5*60*1e3,onSuccess:Z,extraParams:Ct,messages:{title:c("setup.keyPair.title"),scan:c("setup.keyPair.scan"),confirm:c("setup.keyPair.confirm"),success:c("setup.keyPair.success")},onClose:Et,customItems:A?[]:[j.jsx(se,{onClick:At})]})]})}Ee.propTypes={defaultUrl:L.string,onCancel:L.func.isRequired,onSuccess:L.func.isRequired,onError:L.func,mode:L.oneOf(["install","component"]),handleText:L.object};export{pe as B,Ee as I,xt as a,Se as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aF as L,j as i,r as u,p as H,bf as T,$ as M,s as v,o as s,v as E,J as y,cZ as A,V as w,n as D,aP as q,c_ as F,cC as U,F as j,y as O,c$ as V,aH as W,d0 as Y,d1 as k,d2 as I,at as B,b7 as J,cv as K,C as X,b8 as Z}from"./index-
|
|
1
|
+
import{aF as L,j as i,r as u,p as H,bf as T,$ as M,s as v,o as s,v as E,J as y,cZ as A,V as w,n as D,aP as q,c_ as F,cC as U,F as j,y as O,c$ as V,aH as W,d0 as Y,d1 as k,d2 as I,at as B,b7 as J,cv as K,C as X,b8 as Z}from"./index-Bek3Nxot.js";import{p as G}from"./index-BJVvRV0h.js";import{N as Q}from"./index-BfnrUUfH.js";import{b as ee}from"./sdk-l1r4MOQ_.js";import{w as ie}from"./wrap-locale-D8IL6u8L.js";const se=L(i.jsx("path",{d:"M19 3H4.99c-1.11 0-1.98.89-1.98 2L3 19c0 1.1.88 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.11-.9-2-2-2m0 12h-4c0 1.66-1.35 3-3 3s-3-1.34-3-3H4.99V5H19z"}));function P({invitation:e,createPassportSvg:n,passportColor:c="auto"}){const[p,r]=u.useState(!1),{t:l}=u.useContext(H),t=u.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),d=u.useMemo(()=>n({title:t,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c,extra:e.passportExpireTime?{key:"Exp",value:T(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,t]),m=u.useCallback(()=>{r(!0)},[]),o=u.useCallback(()=>{r(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(te,{children:i.jsxs("div",{className:"invite-passport__card",onClick:m,children:[!!e.display&&i.jsx(Q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:d}})]})}),i.jsx(M,{open:p,title:l("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:o,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(x=>i.jsx("li",{style:{listStyle:"circle"},children:x.description},x.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(se,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:l("invite.emptyPermission")})]})})]})}P.propTypes={invitation:s.object.isRequired,createPassportSvg:s.func.isRequired,passportColor:s.string};const te=v.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
max-width: 350px;
|
|
4
4
|
margin: 30px auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{gy as P,bd as s}from"./index-Bek3Nxot.js";var r,e;function u(){if(e)return r;e=1;const a=P();return r=(i,t)=>a(i)===a(t),r}var f=u();const x=s(f);export{x as i};
|