@abtnode/blocklet-services 1.16.45 → 1.16.46-beta-20250703-050038-4ba2582f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/api/routes/user-session.js +2 -1
  2. package/api/state/index.js +1 -1
  3. package/dist/assets/{AdapterDayjs-BRnJ9bMs.js → AdapterDayjs-BIQsjtiT.js} +1 -1
  4. package/dist/assets/{ArrowDropDown-DBJPIOl4.js → ArrowDropDown-C8mwBtnq.js} +1 -1
  5. package/dist/assets/{CheckCircle-DUJmWceY.js → CheckCircle-BMMes-V7.js} +1 -1
  6. package/dist/assets/{ChevronLeft-BBJJJhVi.js → ChevronLeft-B8rsCJhy.js} +1 -1
  7. package/dist/assets/{ChevronRight-BU9I7WD4.js → ChevronRight-CXhRlHKa.js} +1 -1
  8. package/dist/assets/{DeleteOutline-BKSMNwfT.js → DeleteOutline-DtbgduIM.js} +1 -1
  9. package/dist/assets/{Done-ASNftAOL.js → Done-CfxTFgBR.js} +1 -1
  10. package/dist/assets/{Download-D4X39_9V.js → Download-Cz4FAob1.js} +1 -1
  11. package/dist/assets/{Edit-CiTb-w5P.js → Edit-Dh2oBqBB.js} +1 -1
  12. package/dist/assets/{Error-BAEKW7-e.js → Error-BsnYcwiq.js} +1 -1
  13. package/dist/assets/{ExpandLess-CcLTbsdW.js → ExpandLess-B7eaaZaz.js} +1 -1
  14. package/dist/assets/{Google-C28yeMZW.js → Google-BAVYemz7.js} +1 -1
  15. package/dist/assets/{Home-Dujcj083.js → Home-SYcuMunC.js} +1 -1
  16. package/dist/assets/{InfoOutlined-BVWbftGI.js → InfoOutlined-GEKFkezP.js} +1 -1
  17. package/dist/assets/{Launch-DFS3fgjy.js → Launch-BB2NS6gw.js} +1 -1
  18. package/dist/assets/{LaunchOutlined-C1x4Og4u.js → LaunchOutlined-BEsYq9kI.js} +1 -1
  19. package/dist/assets/{MoreHoriz-ChJ3K52h.js → MoreHoriz-BDLlOCqj.js} +1 -1
  20. package/dist/assets/{PlayArrow-BqVYRyLK.js → PlayArrow-hnXK75qN.js} +1 -1
  21. package/dist/assets/{TuneOutlined-CKzi_VZZ.js → TuneOutlined-CjVMXY_7.js} +1 -1
  22. package/dist/assets/{ViewList-BOGcbymi.js → ViewList-CYMKafss.js} +1 -1
  23. package/dist/assets/{access-control-5WGT2JfR.js → access-control-BFze8gPg.js} +1 -1
  24. package/dist/assets/{actions-DnTVXQ_Z.js → actions-D_aAU5uf.js} +1 -1
  25. package/dist/assets/{add-component-core-DehB4lvu.js → add-component-core-CwbGrQav.js} +1 -1
  26. package/dist/assets/{add-resource-DfqBSLDk.js → add-resource-EZWL5Kfm.js} +1 -1
  27. package/dist/assets/{addon-DdjBFoHI.js → addon-CuKQNO-0.js} +1 -1
  28. package/dist/assets/advanced-BR1PWvXD.js +14 -0
  29. package/dist/assets/api-ZzsS0diA.js +1 -0
  30. package/dist/assets/{appearance-DsoglxbB.js → appearance-CHLvy771.js} +1 -1
  31. package/dist/assets/{audit-logs-DKiQkfse.js → audit-logs-HRbs-zR8.js} +1 -1
  32. package/dist/assets/{authorize-IzqEi1HK.js → authorize-BLL3c3nQ.js} +1 -1
  33. package/dist/assets/{base-chart-CoApVzod.js → base-chart-B81_ogPb.js} +1 -1
  34. package/dist/assets/{base32-DUSifB4M.js → base32-BTgHqgXA.js} +1 -1
  35. package/dist/assets/{branding-CwYIeBi1.js → branding-BYCDBHLo.js} +1 -1
  36. package/dist/assets/{branding-B1o_K1XB.js → branding-WyyEnk9U.js} +2 -2
  37. package/dist/assets/{bundle-avatar-UIbxwQif.js → bundle-avatar-DxpUnWc9.js} +1 -1
  38. package/dist/assets/{button-D_ZVjN82.js → button-BxXFhZV_.js} +1 -1
  39. package/dist/assets/{click-to-copy-By4fgGR7.js → click-to-copy-nMjIOe47.js} +1 -1
  40. package/dist/assets/{cloneDeep-CDl5kZTY.js → cloneDeep-Cm_V5yFW.js} +1 -1
  41. package/dist/assets/{collapse-DAaiuAEY.js → collapse-2Uzc-qtU.js} +1 -1
  42. package/dist/assets/{complete-Bi_BaBBl.js → complete-DCJ7Rl4p.js} +1 -1
  43. package/dist/assets/{component-CiFJ1vhL.js → component-BqNp0WH9.js} +3 -3
  44. package/dist/assets/{config-BZuiK8BP.js → config-COcQW2xB.js} +1 -1
  45. package/dist/assets/{config-JUGJKWP_.js → config-DaC-Wq7r.js} +1 -1
  46. package/dist/assets/{config-navigation-DZ54_nVv.js → config-navigation-DOALMOAS.js} +3 -3
  47. package/dist/assets/{config-space-D6ScnWdA.js → config-space-CyCq4fxg.js} +1 -1
  48. package/dist/assets/{confirm-RvA9mFot.js → confirm-CDWcSF88.js} +1 -1
  49. package/dist/assets/connect-Br7I-KPU.js +5 -0
  50. package/dist/assets/{connect-DhuiCF4g.js → connect-CKhBRnXh.js} +1 -1
  51. package/dist/assets/{connect-to-CxoBjkcK.js → connect-to-D_-7CELt.js} +1 -1
  52. package/dist/assets/{dashboard-t9EszOna.js → dashboard-3f3Wapmv.js} +3 -3
  53. package/dist/assets/{delete-confirm-wTMDQFnr.js → delete-confirm-CEtsVP5o.js} +1 -1
  54. package/dist/assets/{did-address-NnOD1W_A.js → did-address-BYc4cym-.js} +1 -1
  55. package/dist/assets/domain-DrB0Xtiq.js +9 -0
  56. package/dist/assets/{domain-action-card-BlPWBOAu.js → domain-action-card-BmFA6T_2.js} +1 -1
  57. package/dist/assets/domains-aM7-R16w.js +1 -0
  58. package/dist/assets/dot-BSvIHcuy.js +7 -0
  59. package/dist/assets/{email-0b_MYxBQ.js → email-NDtfDo4w.js} +1 -1
  60. package/dist/assets/{exchange-passport-BnmyuwIs.js → exchange-passport-dw7T8AUh.js} +1 -1
  61. package/dist/assets/{fuel-DEqW116b.js → fuel-CQnVBL1G.js} +1 -1
  62. package/dist/assets/{gen-access-key-CVpZSjIw.js → gen-access-key-CKRsRWaQ.js} +1 -1
  63. package/dist/assets/{get-safe-url-B0-S5PGZ.js → get-safe-url-D3ggKpT1.js} +1 -1
  64. package/dist/assets/{get-safe-url-D5KSEAKZ.js → get-safe-url-DAFhlwkH.js} +1 -1
  65. package/dist/assets/{home-DfSu-4-a.js → home-A-VRaS1G.js} +1 -1
  66. package/dist/assets/{iframe-DFg8oeD0.js → iframe-GZPTHXNz.js} +1 -1
  67. package/dist/assets/{index-CkwXRCmN.js → index-75Nc_luV.js} +4 -4
  68. package/dist/assets/{index-I1i2Mc1k.js → index-B1I0U81c.js} +1 -1
  69. package/dist/assets/{index-DrTNV3tX.js → index-BEpPMiyb.js} +1 -1
  70. package/dist/assets/{index-Dq1Rmjwf.js → index-BXVUmQnX.js} +1 -1
  71. package/dist/assets/{index-CD07vq9d.js → index-BrMH3hes.js} +1 -1
  72. package/dist/assets/{index-6I6juqjg.js → index-BsIM7oBN.js} +1 -1
  73. package/dist/assets/{index-B70kYOfj.js → index-C0LoLjcL.js} +1 -1
  74. package/dist/assets/{index-YaLWfp9D.js → index-CAHja9to.js} +1 -1
  75. package/dist/assets/{index-BxJZWVOT.js → index-CRPd6bu_.js} +1 -1
  76. package/dist/assets/{index-Cwq0Io0K.js → index-C_iJfkbw.js} +1 -1
  77. package/dist/assets/{index-CwUT0vPy.js → index-Cti-S8sI.js} +4 -4
  78. package/dist/assets/{index-BLfUtUpB.js → index-D1V1OV_1.js} +1 -1
  79. package/dist/assets/{index-DPIWnhb5.js → index-D3Qm_7QJ.js} +1 -1
  80. package/dist/assets/{index-B874LN5A.js → index-D6Kz_Kj2.js} +1 -1
  81. package/dist/assets/{index-2mYUqHxe.js → index-DBnbtCJw.js} +3 -3
  82. package/dist/assets/{index-C0btiQfG.js → index-DDpPyFll.js} +1 -1
  83. package/dist/assets/{index-IeoAQOW8.js → index-DJghIcZg.js} +1 -1
  84. package/dist/assets/{index-w4f-mlFt.js → index-opVatFs5.js} +1 -1
  85. package/dist/assets/{index-ZcD1N43m.js → index-rz1HClDn.js} +1 -1
  86. package/dist/assets/{index-B4fH-l5R.js → index-xEAUvM9N.js} +1 -1
  87. package/dist/assets/{index-aAlnaECr.js → index-zvQQ3C85.js} +1 -1
  88. package/dist/assets/{invitation-B3B-J4fG.js → invitation-lVBY7BRV.js} +1 -1
  89. package/dist/assets/{invite-jaOwIvW9.js → invite-vGAxuB6S.js} +1 -1
  90. package/dist/assets/{issue-passport-DpSBB2L8.js → issue-passport-BJj9S3VH.js} +1 -1
  91. package/dist/assets/{item-D-39k2FC.js → item-Ck1X0EKi.js} +1 -1
  92. package/dist/assets/{layout-DEiEwPzB.js → layout-Iy3Ltu2J.js} +1 -1
  93. package/dist/assets/{list-ZFC0mCy0.js → list-CA-gEd-1.js} +2 -2
  94. package/dist/assets/{list-DDNORnll.js → list-DWx_rlsJ.js} +1 -1
  95. package/dist/assets/localization-BmadHeXm.js +1 -0
  96. package/dist/assets/{log-BBUgs8Rd.js → log-BFUsU5ZV.js} +1 -1
  97. package/dist/assets/{logger-Dqm1UQym.js → logger-9nL4ASn6.js} +1 -1
  98. package/dist/assets/{login-DbSs2lO2.js → login-D_thJ6QB.js} +1 -1
  99. package/dist/assets/{login-oauth-callback-Cpai1yC1.js → login-oauth-callback-D3WJu6Qx.js} +1 -1
  100. package/dist/assets/{logo-uploader-BPSmPaZd.js → logo-uploader-CMlpg5uV.js} +3 -3
  101. package/dist/assets/{lost-passport-Ce_WXcnR.js → lost-passport-C23LgPGO.js} +1 -1
  102. package/dist/assets/{omit-Cao4GLS7.js → omit-rJ-mc6U5.js} +1 -1
  103. package/dist/assets/{open-window-hpzKFxn5.js → open-window-CTBzFUUv.js} +1 -1
  104. package/dist/assets/{overview-C3aIT8Ro.js → overview-Bmi7dmR0.js} +1 -1
  105. package/dist/assets/{page-header-DNvUdNpI.js → page-header-DqtuZOzT.js} +1 -1
  106. package/dist/assets/{passport-item-B3XIp0U4.js → passport-item-BGYRFCwE.js} +1 -1
  107. package/dist/assets/{permission-DQvXGutX.js → permission-BEqDHKfL.js} +1 -1
  108. package/dist/assets/{preferences-C3zaKjfI.js → preferences-D1eIimRF.js} +1 -1
  109. package/dist/assets/{profile-embed-BFjGm3Vt.js → profile-embed-DdACJ_zu.js} +1 -1
  110. package/dist/assets/publish-resource-BnpouxdO.js +1 -0
  111. package/dist/assets/{react-beautiful-dnd.esm-02tdagHZ.js → react-beautiful-dnd.esm-CNuzAjru.js} +1 -1
  112. package/dist/assets/{runtime-Drmh1-cb.js → runtime-6wVftvUx.js} +1 -1
  113. package/dist/assets/{sanitize-e0A8A-yt.js → sanitize-BKnEhEg8.js} +1 -1
  114. package/dist/assets/sdk-Btq1iUPd.js +1 -0
  115. package/dist/assets/{security-BPd4v9z4.js → security-DJRv4_Fx.js} +1 -1
  116. package/dist/assets/{session-BGdAM8zS.js → session-kQ1tvY5U.js} +1 -1
  117. package/dist/assets/setup-CV_F3UHP.js +30 -0
  118. package/dist/assets/{spaces-DUkzPTBd.js → spaces-BTlTdKAI.js} +1 -1
  119. package/dist/assets/{start-C9Hvgbcz.js → start-7Wq6LiTT.js} +1 -1
  120. package/dist/assets/{starting-progress-CYgfPTsE.js → starting-progress-CAkASj-X.js} +1 -1
  121. package/dist/assets/{status-f3Y-NXRP.js → status-CYSvSIaN.js} +1 -1
  122. package/dist/assets/{step-actions-BNbc1l8F.js → step-actions-C4SB9_F2.js} +1 -1
  123. package/dist/assets/{studio-I9lo0Itp.js → studio-BWs_EnV3.js} +1 -1
  124. package/dist/assets/{switch-control-Brwb8ptk.js → switch-control-eCwDP-ME.js} +1 -1
  125. package/dist/assets/{table-tips-BzPqsKYQ.js → table-tips-CCj0tXz1.js} +1 -1
  126. package/dist/assets/{traffic-FNLLya21.js → traffic-Pt9FvcDk.js} +1 -1
  127. package/dist/assets/{transfer-m6229uxg.js → transfer-Cj_zgOWb.js} +1 -1
  128. package/dist/assets/{unsubscribe-BXKQU2c1.js → unsubscribe-CICtmk2r.js} +1 -1
  129. package/dist/assets/{use-blocklet-logo-4UB-MFD3.js → use-blocklet-logo-Bjt6-_x3.js} +1 -1
  130. package/dist/assets/useAsync-CZkpdKtR.js +1 -0
  131. package/dist/assets/useAsync-DmrzeQhI.js +1 -0
  132. package/dist/assets/{useLocalStorage-CaPDqrQ7.js → useLocalStorage-BoYGn-bQ.js} +1 -1
  133. package/dist/assets/{user-center-CNdVbQx6.js → user-center-BVfQDQ91.js} +3 -3
  134. package/dist/assets/{util-BRPRFc9p.js → util-BQvjy4j5.js} +1 -1
  135. package/dist/assets/{util-BQAJqeb4.js → util-TW4lcckB.js} +1 -1
  136. package/dist/assets/{vendor-arcblock-CwufDgLV.js → vendor-arcblock-DzylOsX3.js} +3 -3
  137. package/dist/assets/{vendor-hooks-DqdmWCmo.js → vendor-hooks-B2N8eE_a.js} +1 -1
  138. package/dist/assets/vendor-utils-uPLZO5mM.js +208 -0
  139. package/dist/assets/vendor-ux-did-connect-CQtodyZB.js +2304 -0
  140. package/dist/assets/{wrap-locale-ClbCNOs0.js → wrap-locale-CpZgZaeK.js} +1 -1
  141. package/dist/index.html +5 -5
  142. package/dist/service-worker.js +1 -1
  143. package/package.json +23 -23
  144. package/dist/assets/advanced-CJz1c7Eh.js +0 -14
  145. package/dist/assets/api-C1S8LUld.js +0 -1
  146. package/dist/assets/connect-DGMfp8-Y.js +0 -5
  147. package/dist/assets/domain-BaMcm6r6.js +0 -9
  148. package/dist/assets/domains-CxJF-JF_.js +0 -1
  149. package/dist/assets/dot-4jhL56kz.js +0 -7
  150. package/dist/assets/localization-tyC-vHO5.js +0 -1
  151. package/dist/assets/publish-resource-CAZrBTdz.js +0 -1
  152. package/dist/assets/sdk-BmeKtHic.js +0 -1
  153. package/dist/assets/setup-Bo10IVJ4.js +0 -30
  154. package/dist/assets/useAsync-C62uE2pS.js +0 -1
  155. package/dist/assets/vendor-utils-BfZ4tlod.js +0 -208
  156. package/dist/assets/vendor-ux-did-connect-pzpsrvqx.js +0 -2304
@@ -1,14 +0,0 @@
1
- import{r as Oe,e as ze}from"./vendor-react-DEoibe3W.js";import{a9 as _t,j as L,ab as Ze,H as Ee,aa as U,y as mr,T as Be,ah as wt,bs as pr,bR as gr,bx as yr,ak as vr,E as br,al as He,O as _r,N as wr,bt as Ue,X as De,ad as Qt}from"./vendor-mui-core-Bq8gXTan.js";import{D as Je,G as xr,f as Mr,aM as $r,n as kr,aE as jr,z as Xt,W as sr,V as nr}from"./index-CwUT0vPy.js";import{P as Sr,w as Ge}from"./permission-DQvXGutX.js";import{r as xt,a as We,B as qe,a3 as Le,at as ir,f as Rr,ar,c3 as Ar,aR as Or,i as Te,k as Er,a1 as er,bb as Cr}from"./vendor-ux-did-connect-pzpsrvqx.js";import{x as or}from"./vendor-hooks-DqdmWCmo.js";import{c as Ne}from"./vendor-arcblock-CwufDgLV.js";import{d as tr}from"./InfoOutlined-BVWbftGI.js";import{C as Mt}from"./confirm-RvA9mFot.js";import{f as Ve}from"./index-8eXqqyHQ.js";import{_ as Dr}from"./useSetState-CWq0AVWn.js";import{u as lr}from"./session-BGdAM8zS.js";import{S as Ce}from"./section-BDMQAX_r.js";import{C as Ir}from"./click-to-copy-By4fgGR7.js";import{u as cr}from"./dashboard-t9EszOna.js";import{r as Tr,aL as Lr}from"./vendor-utils-BfZ4tlod.js";import{I as qr}from"./index-DPIWnhb5.js";import{W as Nr}from"./did-address-NnOD1W_A.js";import{V as Pr}from"./status-f3Y-NXRP.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CaPDqrQ7.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-D5KSEAKZ.js";import"./use-blocklet-logo-4UB-MFD3.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./use-mobile-DwzRjjku.js";import"./omit-Cao4GLS7.js";var $t={},zr=_t;Object.defineProperty($t,"__esModule",{value:!0});var ur=$t.default=void 0,Fr=zr(xt()),Br=L;ur=$t.default=(0,Fr.default)((0,Br.jsx)("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}),"VolunteerActivismOutlined");var kt={},Jr=_t;Object.defineProperty(kt,"__esModule",{value:!0});var jt=kt.default=void 0,Ur=Jr(xt()),rr=L;jt=kt.default=(0,Ur.default)([(0,rr.jsx)("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),(0,rr.jsx)("circle",{cx:"16",cy:"12",r:"1.5"},"1")],"AccountBalanceWalletOutlined");const Vr=localStorage.getItem("enableDebug")==="true";function Wr({teamDid:I,size:P="small",...B}){const{t:T}=We(),{api:q}=Je(),[p,b]=Oe.useState(!1),[l,M]=Oe.useState(null),v=()=>{b(!1),M(null)},m=async()=>{var a;try{b(!0);const i=await q.clearCache({input:{teamDid:I}});Le.success(T("blocklet.config.clearCache.success",{count:((a=i.removed)==null?void 0:a.length)||0}))}catch(i){Le.error(Ve(i))}finally{b(!1),M(null)}},e={title:T("blocklet.config.clearCache.title"),description:T("blocklet.config.clearCache.description"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:m,onCancel:v};return L.jsxs("div",{...B,children:[L.jsxs(qe,{onClick:()=>M(e),color:"error",variant:"outlined",size:P,children:[p?L.jsx(Ze,{size:16,style:{marginRight:5}}):null,T("blocklet.config.clearCache.action")]}),l&&L.jsx(Mt,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}var St={},Kr=_t;Object.defineProperty(St,"__esModule",{value:!0});var fr=St.default=void 0,Hr=Kr(xt()),Zr=L;fr=St.default=(0,Hr.default)((0,Zr.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"}),"KeyOutlined");function Rt({onChange:I,disabled:P,loading:B,inService:T}){const{t:q}=We(),{api:p,session:b}=lr(),{blocklet:l}=xr(),[M,v]=Dr({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),m=()=>v({isConnectOpen:!1}),e=()=>{if(Mr.isInProgress(l.status)){Le.error(q("blocklet.error.isInProgress"));return}v({confirmDialogOpen:!0})};return L.jsxs(L.Fragment,{children:[L.jsx(Ce,{title:q("blocklet.config.migrate.button"),desc:q("blocklet.config.migrate.description"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsxs(mr,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:P||B,onClick:e,children:[L.jsx(fr,{style:{fontSize:"1.3em",marginRight:4}}),q("blocklet.config.migrate.button")]})})}),L.jsxs(L.Fragment,{children:[M.isConnectOpen&&L.jsx(ir,{popup:!0,open:M.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:p.get,checkTimeout:5*60*1e3,onSuccess:()=>{I(),T&&b.logout(),m()},extraParams:{appDid:l.appDid},messages:{title:q("setup.keyPair.title"),scan:q("setup.keyPair.scan"),confirm:q("setup.keyPair.confirm"),success:q("setup.keyPair.success")},onClose:m}),M.confirmDialogOpen&&L.jsx(Mt,{title:L.jsx(Be,{sx:{fontSize:"20px",fontWeight:"500"},children:q("blocklet.config.migrate.title")}),description:L.jsx(Be,{sx:{fontSize:"14px",color:"#9397A1"},children:q("blocklet.config.migrate.confirm")}),confirm:q("common.confirm"),cancel:q("common.cancel"),onConfirm:()=>v({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>v({confirmDialogOpen:!1})})]})]})}Rt.propTypes={onChange:Ee.func,disabled:Ee.bool,loading:Ee.bool,inService:Ee.bool};Rt.defaultProps={onChange:()=>{},disabled:!1,loading:!1,inService:!1};function At({onCancel:I,onSuccess:P,onError:B}){const{api:T}=Oe.useContext(Rr),[q,p]=Oe.useState(!1),{t:b,locale:l}=We(),[M,v]=Oe.useState(""),[m,e]=Oe.useState(!1),[a,i]=Oe.useState(0),[r,t]=Oe.useState(""),{endpoint:c}=cr(),[s,o]=Oe.useState(!1),h=f=>{v(null),p(!0);try{t(f.result),i(R.length-1)}catch(y){const x=Ve(y);v(x),B(y)}finally{p(!1)}},g=()=>{e(!0),i(1)},w=()=>{e(!1),i(0)},R=[{body:L.jsxs(U,{children:[L.jsx(Be,{children:b("team.transferApp.transferDialog.tips.progress")}),L.jsx(Be,{mt:3,mb:2,children:b("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:b("common.cancel"),confirm:b("team.transferApp.transferDialog.createTransferLink"),onCancel:I,onConfirm:g},{cancel:b("common.cancel"),confirm:b("team.transferApp.transferDialog.createTransferLink"),body:()=>L.jsx(ir,{action:"transfer-app-owner",open:m,locale:l,checkFn:T.get,onClose:w,onSuccess:h,checkTimeout:5*60*1e3,extraParams:{},messages:{title:b("team.transferApp.connectDialog.title"),scan:b("team.transferApp.connectDialog.scan"),confirm:b("team.transferApp.connectDialog.confirm"),success:b("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const f=$r({transferId:r.transferId,endpoint:c});return L.jsxs(L.Fragment,{children:[L.jsx(U,{component:Fe,dangerouslySetInnerHTML:{__html:b("team.transferApp.transferDialog.createSuccessTip1")}}),L.jsx(U,{component:Fe,mt:2,children:L.jsx(Fe,{children:b("team.transferApp.transferDialog.createSuccessTip3")})}),L.jsxs(U,{children:[L.jsx(U,{component:Fe,mt:2,children:L.jsx(Fe,{children:b("team.transferApp.transferDialog.createSuccessTip2",{expireDate:kr(r.expireDate,l)})})}),L.jsx(U,{my:1,children:L.jsx(Ir,{children:f})})]}),L.jsx("div",{children:L.jsx(pr,{value:"end",control:L.jsx(gr,{checked:s,onChange:y=>o(y.target.checked)}),label:b("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:b("common.confirm"),onConfirm:P}],j=R[a];return L.jsxs(ar,{title:L.jsx(Fe,{className:"title",children:b("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:L.jsxs(L.Fragment,{children:[j.cancel&&L.jsx(qe,{onClick:j.onCancel,color:"inherit",children:j.cancel}),L.jsxs(qe,{onClick:j.onConfirm,color:"error",disabled:q||a===R.length-1&&!s,variant:"contained",autoFocus:!0,children:[q&&L.jsx(Ze,{size:16}),j.confirm]})]}),children:[L.jsx(yr,{component:"div",children:typeof j.body=="function"?j.body():j.body}),!!M&&L.jsx(vr,{severity:"error",variant:"icon",children:M})]})}At.propTypes={onCancel:Ee.func.isRequired,onSuccess:Ee.func.isRequired,onError:Ee.func};At.defaultProps={onError:()=>{}};const Fe=wt.div`
2
- font-size: 16px;
3
- font-weight: bold;
4
- &.title {
5
- font-size: 20px;
6
- }
7
- `;var hr={},dr={exports:{}};(function(I,P){(function(B,T){I.exports=T()})(self,()=>{return B={7629:(q,p,b)=>{const l=b(375),M=b(8571),v=b(9474),m=b(1687),e=b(8652),a=b(8160),i=b(3292),r=b(6354),t=b(8901),c=b(9708),s=b(6914),o=b(2294),h=b(6133),g=b(1152),w=b(8863),R=b(2036),j={Base:class{constructor(f){this.type=f,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new o.Ids,this._preferences=null,this._refs=new h.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return l(typeof c.describe=="function","Manifest functionality disabled"),c.describe(this)}allow(...f){return a.verifyFlat(f,"allow"),this._values(f,"_valids")}alter(f){l(f&&typeof f=="object"&&!Array.isArray(f),"Invalid targets argument"),l(!this._inRuleset(),"Cannot set alterations inside a ruleset");const y=this.clone();y.$_terms.alterations=y.$_terms.alterations||[];for(const x in f){const C=f[x];l(typeof C=="function","Alteration adjuster for",x,"must be a function"),y.$_terms.alterations.push({target:x,adjuster:C})}return y.$_temp.ruleset=!1,y}artifact(f){return l(f!==void 0,"Artifact cannot be undefined"),l(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",f)}cast(f){return l(f===!1||typeof f=="string","Invalid to value"),l(f===!1||this._definition.cast[f],"Type",this.type,"does not support casting to",f),this.$_setFlag("cast",f===!1?void 0:f)}default(f,y){return this._default("default",f,y)}description(f){return l(f&&typeof f=="string","Description must be a non-empty string"),this.$_setFlag("description",f)}empty(f){const y=this.clone();return f!==void 0&&(f=y.$_compile(f,{override:!1})),y.$_setFlag("empty",f,{clone:!1})}error(f){return l(f,"Missing error"),l(f instanceof Error||typeof f=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",f)}example(f,y={}){return l(f!==void 0,"Missing example"),a.assertOptions(y,["override"]),this._inner("examples",f,{single:!0,override:y.override})}external(f,y){return typeof f=="object"&&(l(!y,"Cannot combine options with description"),y=f.description,f=f.method),l(typeof f=="function","Method must be a function"),l(y===void 0||y&&typeof y=="string","Description must be a non-empty string"),this._inner("externals",{method:f,description:y},{single:!0})}failover(f,y){return this._default("failover",f,y)}forbidden(){return this.presence("forbidden")}id(f){return f?(l(typeof f=="string","id must be a non-empty string"),l(/^[^\.]+$/.test(f),"id cannot contain period character"),this.$_setFlag("id",f)):this.$_setFlag("id",void 0)}invalid(...f){return this._values(f,"_invalids")}label(f){return l(f&&typeof f=="string","Label name must be a non-empty string"),this.$_setFlag("label",f)}meta(f){return l(f!==void 0,"Meta cannot be undefined"),this._inner("metas",f,{single:!0})}note(...f){l(f.length,"Missing notes");for(const y of f)l(y&&typeof y=="string","Notes must be non-empty strings");return this._inner("notes",f)}only(f=!0){return l(typeof f=="boolean","Invalid mode:",f),this.$_setFlag("only",f)}optional(){return this.presence("optional")}prefs(f){l(f,"Missing preferences"),l(f.context===void 0,"Cannot override context"),l(f.externals===void 0,"Cannot override externals"),l(f.warnings===void 0,"Cannot override warnings"),l(f.debug===void 0,"Cannot override debug"),a.checkPreferences(f);const y=this.clone();return y._preferences=a.preferences(y._preferences,f),y}presence(f){return l(["optional","required","forbidden"].includes(f),"Unknown presence mode",f),this.$_setFlag("presence",f)}raw(f=!0){return this.$_setFlag("result",f?"raw":void 0)}result(f){return l(["raw","strip"].includes(f),"Unknown result mode",f),this.$_setFlag("result",f)}required(){return this.presence("required")}strict(f){const y=this.clone(),x=f!==void 0&&!f;return y._preferences=a.preferences(y._preferences,{convert:x}),y}strip(f=!0){return this.$_setFlag("result",f?"strip":void 0)}tag(...f){l(f.length,"Missing tags");for(const y of f)l(y&&typeof y=="string","Tags must be non-empty strings");return this._inner("tags",f)}unit(f){return l(f&&typeof f=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",f)}valid(...f){a.verifyFlat(f,"valid");const y=this.allow(...f);return y.$_setFlag("only",!!y._valids,{clone:!1}),y}when(f,y){const x=this.clone();x.$_terms.whens||(x.$_terms.whens=[]);const C=i.when(x,f,y);if(!["any","link"].includes(x.type)){const N=C.is?[C]:C.switch;for(const $ of N)l(!$.then||$.then.type==="any"||$.then.type===x.type,"Cannot combine",x.type,"with",$.then&&$.then.type),l(!$.otherwise||$.otherwise.type==="any"||$.otherwise.type===x.type,"Cannot combine",x.type,"with",$.otherwise&&$.otherwise.type)}return x.$_terms.whens.push(C),x.$_mutateRebuild()}cache(f){l(!this._inRuleset(),"Cannot set caching inside a ruleset"),l(!this._cache,"Cannot override schema cache"),l(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const y=this.clone();return y._cache=f||e.provider.provision(),y.$_temp.ruleset=!1,y}clone(){const f=Object.create(Object.getPrototypeOf(this));return this._assign(f)}concat(f){l(a.isSchema(f),"Invalid schema object"),l(this.type==="any"||f.type==="any"||f.type===this.type,"Cannot merge type",this.type,"with another type:",f.type),l(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),l(!f._inRuleset(),"Cannot concatenate a schema with open ruleset");let y=this.clone();if(this.type==="any"&&f.type!=="any"){const x=f.clone();for(const C of Object.keys(y))C!=="type"&&(x[C]=y[C]);y=x}y._ids.concat(f._ids),y._refs.register(f,h.toSibling),y._preferences=y._preferences?a.preferences(y._preferences,f._preferences):f._preferences,y._valids=R.merge(y._valids,f._valids,f._invalids),y._invalids=R.merge(y._invalids,f._invalids,f._valids);for(const x of f._singleRules.keys())y._singleRules.has(x)&&(y._rules=y._rules.filter(C=>C.keep||C.name!==x),y._singleRules.delete(x));for(const x of f._rules)f._definition.rules[x.method].multi||y._singleRules.set(x.name,x),y._rules.push(x);if(y._flags.empty&&f._flags.empty){y._flags.empty=y._flags.empty.concat(f._flags.empty);const x=Object.assign({},f._flags);delete x.empty,m(y._flags,x)}else if(f._flags.empty){y._flags.empty=f._flags.empty;const x=Object.assign({},f._flags);delete x.empty,m(y._flags,x)}else m(y._flags,f._flags);for(const x in f.$_terms){const C=f.$_terms[x];C?y.$_terms[x]?y.$_terms[x]=y.$_terms[x].concat(C):y.$_terms[x]=C.slice():y.$_terms[x]||(y.$_terms[x]=C)}return this.$_root._tracer&&this.$_root._tracer._combine(y,[this,f]),y.$_mutateRebuild()}extend(f){return l(!f.base,"Cannot extend type with another base"),t.type(this,f)}extract(f){return f=Array.isArray(f)?f:f.split("."),this._ids.reach(f)}fork(f,y){l(!this._inRuleset(),"Cannot fork inside a ruleset");let x=this;for(let C of[].concat(f))C=Array.isArray(C)?C:C.split("."),x=x._ids.fork(C,y,x);return x.$_temp.ruleset=!1,x}rule(f){const y=this._definition;a.assertOptions(f,Object.keys(y.modifiers)),l(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const x=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;l(x>=0&&x<this._rules.length,"Cannot apply rules to empty ruleset");const C=this.clone();for(let N=x;N<C._rules.length;++N){const $=C._rules[N],n=M($);for(const d in f)y.modifiers[d](n,f[d]),l(n.name===$.name,"Cannot change rule name");C._rules[N]=n,C._singleRules.get(n.name)===$&&C._singleRules.set(n.name,n)}return C.$_temp.ruleset=!1,C.$_mutateRebuild()}get ruleset(){l(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const f=this.clone();return f.$_temp.ruleset=f._rules.length,f}get $(){return this.ruleset}tailor(f){f=[].concat(f),l(!this._inRuleset(),"Cannot tailor inside a ruleset");let y=this;if(this.$_terms.alterations)for(const{target:x,adjuster:C}of this.$_terms.alterations)f.includes(x)&&(y=C(y),l(a.isSchema(y),"Alteration adjuster for",x,"failed to return a schema object"));return y=y.$_modify({each:x=>x.tailor(f),ref:!1}),y.$_temp.ruleset=!1,y.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(f,y){return w.entry(f,this,y)}validateAsync(f,y){return w.entryAsync(f,this,y)}$_addRule(f){typeof f=="string"&&(f={name:f}),l(f&&typeof f=="object","Invalid options"),l(f.name&&typeof f.name=="string","Invalid rule name");for(const $ in f)l($[0]!=="_","Cannot set private rule properties");const y=Object.assign({},f);y._resolve=[],y.method=y.method||y.name;const x=this._definition.rules[y.method],C=y.args;l(x,"Unknown rule",y.method);const N=this.clone();if(C){l(Object.keys(C).length===1||Object.keys(C).length===this._definition.rules[y.name].args.length,"Invalid rule definition for",this.type,y.name);for(const $ in C){let n=C[$];if(x.argsByName){const d=x.argsByName.get($);if(d.ref&&a.isResolvable(n))y._resolve.push($),N.$_mutateRegister(n);else if(d.normalize&&(n=d.normalize(n),C[$]=n),d.assert){const _=a.validateArg(n,$,d);l(!_,_,"or reference")}}n!==void 0?C[$]=n:delete C[$]}}return x.multi||(N._ruleRemove(y.name,{clone:!1}),N._singleRules.set(y.name,y)),N.$_temp.ruleset===!1&&(N.$_temp.ruleset=null),x.priority?N._rules.unshift(y):N._rules.push(y),N}$_compile(f,y){return i.schema(this.$_root,f,y)}$_createError(f,y,x,C,N,$={}){const n=$.flags!==!1?this._flags:{},d=$.messages?s.merge(this._definition.messages,$.messages):this._definition.messages;return new r.Report(f,y,x,n,d,C,N)}$_getFlag(f){return this._flags[f]}$_getRule(f){return this._singleRules.get(f)}$_mapLabels(f){return f=Array.isArray(f)?f:f.split("."),this._ids.labels(f)}$_match(f,y,x,C){(x=Object.assign({},x)).abortEarly=!0,x._externals=!1,y.snapshot();const N=!w.validate(f,this,y,x,C).errors;return y.restore(),N}$_modify(f){return a.assertOptions(f,["each","once","ref","schema"]),o.schema(this,f)||this}$_mutateRebuild(){return l(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(f,{source:y,name:x,path:C,key:N})=>{const $=this._definition[y][x]&&this._definition[y][x].register;$!==!1&&this.$_mutateRegister(f,{family:$,key:N})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(f,{family:y,key:x}={}){this._refs.register(f,y),this._ids.register(f,{key:x})}$_property(f){return this._definition.properties[f]}$_reach(f){return this._ids.reach(f)}$_rootReferences(){return this._refs.roots()}$_setFlag(f,y,x={}){l(f[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const C=this._definition.flags[f]||{};if(v(y,C.default)&&(y=void 0),v(y,this._flags[f]))return this;const N=x.clone!==!1?this.clone():this;return y!==void 0?(N._flags[f]=y,N.$_mutateRegister(y)):delete N._flags[f],f[0]!=="_"&&(N.$_temp.ruleset=!1),N}$_parent(f,...y){return this[f][a.symbols.parent].call(this,...y)}$_validate(f,y,x){return w.validate(f,this,y,x)}_assign(f){f.type=this.type,f.$_root=this.$_root,f.$_temp=Object.assign({},this.$_temp),f.$_temp.whens={},f._ids=this._ids.clone(),f._preferences=this._preferences,f._valids=this._valids&&this._valids.clone(),f._invalids=this._invalids&&this._invalids.clone(),f._rules=this._rules.slice(),f._singleRules=M(this._singleRules,{shallow:!0}),f._refs=this._refs.clone(),f._flags=Object.assign({},this._flags),f._cache=null,f.$_terms={};for(const y in this.$_terms)f.$_terms[y]=this.$_terms[y]?this.$_terms[y].slice():null;f.$_super={};for(const y in this.$_super)f.$_super[y]=this._super[y].bind(f);return f}_bare(){const f=this.clone();f._reset();const y=f._definition.terms;for(const x in y){const C=y[x];f.$_terms[x]=C.init}return f.$_mutateRebuild()}_default(f,y,x={}){return a.assertOptions(x,"literal"),l(y!==void 0,"Missing",f,"value"),l(typeof y=="function"||!x.literal,"Only function value supports literal option"),typeof y=="function"&&x.literal&&(y={[a.symbols.literal]:!0,literal:y}),this.$_setFlag(f,y)}_generate(f,y,x){if(!this.$_terms.whens)return{schema:this};const C=[],N=[];for(let d=0;d<this.$_terms.whens.length;++d){const _=this.$_terms.whens[d];if(_.concat){C.push(_.concat),N.push(`${d}.concat`);continue}const S=_.ref?_.ref.resolve(f,y,x):f,O=_.is?[_]:_.switch,E=N.length;for(let D=0;D<O.length;++D){const{is:k,then:u,otherwise:A}=O[D],z=`${d}${_.switch?"."+D:""}`;if(k.$_match(S,y.nest(k,`${z}.is`),x)){if(u){const F=y.localize([...y.path,`${z}.then`],y.ancestors,y.schemas),{schema:J,id:K}=u._generate(f,F,x);C.push(J),N.push(`${z}.then${K?`(${K})`:""}`);break}}else if(A){const F=y.localize([...y.path,`${z}.otherwise`],y.ancestors,y.schemas),{schema:J,id:K}=A._generate(f,F,x);C.push(J),N.push(`${z}.otherwise${K?`(${K})`:""}`);break}}if(_.break&&N.length>E)break}const $=N.join(", ");if(y.mainstay.tracer.debug(y,"rule","when",$),!$)return{schema:this};if(!y.mainstay.tracer.active&&this.$_temp.whens[$])return{schema:this.$_temp.whens[$],id:$};let n=this;this._definition.generate&&(n=this._definition.generate(this,f,y,x));for(const d of C)n=n.concat(d);return this.$_root._tracer&&this.$_root._tracer._combine(n,[this,...C]),this.$_temp.whens[$]=n,{schema:n,id:$}}_inner(f,y,x={}){l(!this._inRuleset(),`Cannot set ${f} inside a ruleset`);const C=this.clone();return C.$_terms[f]&&!x.override||(C.$_terms[f]=[]),x.single?C.$_terms[f].push(y):C.$_terms[f].push(...y),C.$_temp.ruleset=!1,C}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(f,y={}){if(!this._singleRules.has(f))return this;const x=y.clone!==!1?this.clone():this;x._singleRules.delete(f);const C=[];for(let N=0;N<x._rules.length;++N){const $=x._rules[N];$.name!==f||$.keep?C.push($):x._inRuleset()&&N<x.$_temp.ruleset&&--x.$_temp.ruleset}return x._rules=C,x}_values(f,y){a.verifyFlat(f,y.slice(1,-1));const x=this.clone(),C=f[0]===a.symbols.override;if(C&&(f=f.slice(1)),!x[y]&&f.length?x[y]=new R:C&&(x[y]=f.length?new R:null,x.$_mutateRebuild()),!x[y])return x;C&&x[y].override();for(const N of f){l(N!==void 0,"Cannot call allow/valid/invalid with undefined"),l(N!==a.symbols.override,"Override must be the first value");const $=y==="_invalids"?"_valids":"_invalids";x[$]&&(x[$].remove(N),x[$].length||(l(y==="_valids"||!x._flags.only,"Setting invalid value",N,"leaves schema rejecting all values due to previous valid rule"),x[$]=null)),x[y].add(N,x._refs)}return x}}};j.Base.prototype[a.symbols.any]={version:a.version,compile:i.compile,root:"$_root"},j.Base.prototype.isImmutable=!0,j.Base.prototype.deny=j.Base.prototype.invalid,j.Base.prototype.disallow=j.Base.prototype.invalid,j.Base.prototype.equal=j.Base.prototype.valid,j.Base.prototype.exist=j.Base.prototype.required,j.Base.prototype.not=j.Base.prototype.invalid,j.Base.prototype.options=j.Base.prototype.prefs,j.Base.prototype.preferences=j.Base.prototype.prefs,q.exports=new j.Base},8652:(q,p,b)=>{const l=b(375),M=b(8571),v=b(8160),m={max:1e3,supported:new Set(["undefined","boolean","number","string"])};p.provider={provision:e=>new m.Cache(e)},m.Cache=class{constructor(e={}){v.assertOptions(e,["max"]),l(e.max===void 0||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||m.max,this._map=new Map,this._list=new m.List}get length(){return this._map.size}set(e,a){if(e!==null&&!m.supported.has(typeof e))return;let i=this._map.get(e);if(i)return i.value=a,void this._list.first(i);i=this._list.unshift({key:e,value:a}),this._map.set(e,i),this._compact()}get(e){const a=this._map.get(e);if(a)return this._list.first(a),M(a.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},m.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:a,prev:i}=e;return a.prev=i,i&&(i.next=a),e===this.tail&&(this.tail=a),e.prev=null,e.next=null,e}}},8160:(q,p,b)=>{const l=b(375),M=b(7916),v=b(5934);let m,e;const a={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};p.version=v.version,p.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},p.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},p.assertOptions=function(i,r,t="Options"){l(i&&typeof i=="object"&&!Array.isArray(i),"Options must be of type object");const c=Object.keys(i).filter(s=>!r.includes(s));l(c.length===0,`${t} contain unknown keys: ${c}`)},p.checkPreferences=function(i){e=e||b(3378);const r=e.preferences.validate(i);if(r.error)throw new M([r.error.details[0].message])},p.compare=function(i,r,t){switch(t){case"=":return i===r;case">":return i>r;case"<":return i<r;case">=":return i>=r;case"<=":return i<=r}},p.default=function(i,r){return i===void 0?r:i},p.isIsoDate=function(i){return a.isoDate.test(i)},p.isNumber=function(i){return typeof i=="number"&&!isNaN(i)},p.isResolvable=function(i){return!!i&&(i[p.symbols.ref]||i[p.symbols.template])},p.isSchema=function(i,r={}){const t=i&&i[p.symbols.any];return!!t&&(l(r.legacy||t.version===p.version,"Cannot mix different versions of joi schemas"),!0)},p.isValues=function(i){return i[p.symbols.values]},p.limit=function(i){return Number.isSafeInteger(i)&&i>=0},p.preferences=function(i,r){m=m||b(6914),i=i||{},r=r||{};const t=Object.assign({},i,r);return r.errors&&i.errors&&(t.errors=Object.assign({},i.errors,r.errors),t.errors.wrap=Object.assign({},i.errors.wrap,r.errors.wrap)),r.messages&&(t.messages=m.compile(r.messages,i.messages)),delete t[p.symbols.prefs],t},p.tryWithPath=function(i,r,t={}){try{return i()}catch(c){throw c.path!==void 0?c.path=r+"."+c.path:c.path=r,t.append&&(c.message=`${c.message} (${c.path})`),c}},p.validateArg=function(i,r,{assert:t,message:c}){if(p.isSchema(t)){const s=t.validate(i);return s.error?s.error.message:void 0}if(!t(i))return r?`${r} ${c}`:c},p.verifyFlat=function(i,r){for(const t of i)l(!Array.isArray(t),"Method no longer accepts array arguments:",r)}},3292:(q,p,b)=>{const l=b(375),M=b(8160),v=b(6133),m={};p.schema=function(e,a,i={}){M.assertOptions(i,["appendPath","override"]);try{return m.schema(e,a,i)}catch(r){throw i.appendPath&&r.path!==void 0&&(r.message=`${r.message} (${r.path})`),r}},m.schema=function(e,a,i){l(a!==void 0,"Invalid undefined schema"),Array.isArray(a)&&(l(a.length,"Invalid empty array schema"),a.length===1&&(a=a[0]));const r=(t,...c)=>i.override!==!1?t.valid(e.override,...c):t.valid(...c);if(m.simple(a))return r(e,a);if(typeof a=="function")return e.custom(a);if(l(typeof a=="object","Invalid schema content:",typeof a),M.isResolvable(a))return r(e,a);if(M.isSchema(a))return a;if(Array.isArray(a)){for(const t of a)if(!m.simple(t))return e.alternatives().try(...a);return r(e,...a)}return a instanceof RegExp?e.string().regex(a):a instanceof Date?r(e.date(),a):(l(Object.getPrototypeOf(a)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(a))},p.ref=function(e,a){return v.isRef(e)?e:v.create(e,a)},p.compile=function(e,a,i={}){M.assertOptions(i,["legacy"]);const r=a&&a[M.symbols.any];if(r)return l(i.legacy||r.version===M.version,"Cannot mix different versions of joi schemas:",r.version,M.version),a;if(typeof a!="object"||!i.legacy)return p.schema(e,a,{appendPath:!0});const t=m.walk(a);return t?t.compile(t.root,a):p.schema(e,a,{appendPath:!0})},m.walk=function(e){if(typeof e!="object")return null;if(Array.isArray(e)){for(const i of e){const r=m.walk(i);if(r)return r}return null}const a=e[M.symbols.any];if(a)return{root:e[a.root],compile:a.compile};l(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const i in e){const r=m.walk(e[i]);if(r)return r}return null},m.simple=function(e){return e===null||["boolean","string","number"].includes(typeof e)},p.when=function(e,a,i){if(i===void 0&&(l(a&&typeof a=="object","Missing options"),i=a,a=v.create(".")),Array.isArray(i)&&(i={switch:i}),M.assertOptions(i,["is","not","then","otherwise","switch","break"]),M.isSchema(a))return l(i.is===void 0,'"is" can not be used with a schema condition'),l(i.not===void 0,'"not" can not be used with a schema condition'),l(i.switch===void 0,'"switch" can not be used with a schema condition'),m.condition(e,{is:a,then:i.then,otherwise:i.otherwise,break:i.break});if(l(v.isRef(a)||typeof a=="string","Invalid condition:",a),l(i.not===void 0||i.is===void 0,'Cannot combine "is" with "not"'),i.switch===void 0){let t=i;i.not!==void 0&&(t={is:i.not,then:i.otherwise,otherwise:i.then,break:i.break});let c=t.is!==void 0?e.$_compile(t.is):e.$_root.invalid(null,!1,0,"").required();return l(t.then!==void 0||t.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),l(t.break===void 0||t.then===void 0||t.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),i.is===void 0||v.isRef(i.is)||M.isSchema(i.is)||(c=c.required()),m.condition(e,{ref:p.ref(a),is:c,then:t.then,otherwise:t.otherwise,break:t.break})}l(Array.isArray(i.switch),'"switch" must be an array'),l(i.is===void 0,'Cannot combine "switch" with "is"'),l(i.not===void 0,'Cannot combine "switch" with "not"'),l(i.then===void 0,'Cannot combine "switch" with "then"');const r={ref:p.ref(a),switch:[],break:i.break};for(let t=0;t<i.switch.length;++t){const c=i.switch[t],s=t===i.switch.length-1;M.assertOptions(c,s?["is","then","otherwise"]:["is","then"]),l(c.is!==void 0,'Switch statement missing "is"'),l(c.then!==void 0,'Switch statement missing "then"');const o={is:e.$_compile(c.is),then:e.$_compile(c.then)};if(v.isRef(c.is)||M.isSchema(c.is)||(o.is=o.is.required()),s){l(i.otherwise===void 0||c.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const h=i.otherwise!==void 0?i.otherwise:c.otherwise;h!==void 0&&(l(r.break===void 0,"Cannot specify both otherwise and break"),o.otherwise=e.$_compile(h))}r.switch.push(o)}return r},m.condition=function(e,a){for(const i of["then","otherwise"])a[i]===void 0?delete a[i]:a[i]=e.$_compile(a[i]);return a}},6354:(q,p,b)=>{const l=b(5688),M=b(8160),v=b(3328);p.Report=class{constructor(m,e,a,i,r,t,c){if(this.code=m,this.flags=i,this.messages=r,this.path=t.path,this.prefs=c,this.state=t,this.value=e,this.message=null,this.template=null,this.local=a||{},this.local.label=p.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const s=this.path[this.path.length-1];typeof s!="object"&&(this.local.key=s)}}_setTemplate(m){if(this.template=m,!this.flags.label&&this.path.length===0){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const m=this.code;if(!this.prefs.errors.render)return this.code;const e=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return e===void 0?`Error code "${m}" is not defined, your custom type is missing the correct messages definition`:(this.message=e.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(m,e){return p.template(this.value,m,e||this.code,this.state,this.prefs)}},p.path=function(m){let e="";for(const a of m)typeof a!="object"&&(typeof a=="string"?(e&&(e+="."),e+=a):e+=`[${a}]`);return e},p.template=function(m,e,a,i,r){if(!e)return;if(v.isTemplate(e))return a!=="root"?e:null;let t=r.errors.language;if(M.isResolvable(t)&&(t=t.resolve(m,i,r)),t&&e[t]){if(e[t][a]!==void 0)return e[t][a];if(e[t]["*"]!==void 0)return e[t]["*"]}return e[a]?e[a]:e["*"]},p.label=function(m,e,a,i){if(!a.errors.label)return"";if(m.label)return m.label;let r=e.path;return a.errors.label==="key"&&e.path.length>1&&(r=e.path.slice(-1)),p.path(r)||p.template(null,a.messages,"root",e,a)||i&&p.template(null,i,"root",e,a)||"value"},p.process=function(m,e,a){if(!m)return null;const{override:i,message:r,details:t}=p.details(m);if(i)return i;if(a.errors.stack)return new p.ValidationError(r,t,e);const c=Error.stackTraceLimit;Error.stackTraceLimit=0;const s=new p.ValidationError(r,t,e);return Error.stackTraceLimit=c,s},p.details=function(m,e={}){let a=[];const i=[];for(const r of m){if(r instanceof Error){if(e.override!==!1)return{override:r};const c=r.toString();a.push(c),i.push({message:c,type:"override",context:{error:r}});continue}const t=r.toString();a.push(t),i.push({message:t,path:r.path.filter(c=>typeof c!="object"),type:r.code,context:r.local})}return a.length>1&&(a=[...new Set(a)]),{message:a.join(". "),details:i}},p.ValidationError=class extends Error{constructor(m,e,a){super(m),this._original=a,this.details=e}static isError(m){return m instanceof p.ValidationError}},p.ValidationError.prototype.isJoi=!0,p.ValidationError.prototype.name="ValidationError",p.ValidationError.prototype.annotate=l.error},8901:(q,p,b)=>{const l=b(375),M=b(8571),v=b(8160),m=b(6914),e={};p.type=function(a,i){const r=Object.getPrototypeOf(a),t=M(r),c=a._assign(Object.create(t)),s=Object.assign({},i);delete s.base,t._definition=s;const o=r._definition||{};s.messages=m.merge(o.messages,s.messages),s.properties=Object.assign({},o.properties,s.properties),c.type=s.type,s.flags=Object.assign({},o.flags,s.flags);const h=Object.assign({},o.terms);if(s.terms)for(const j in s.terms){const f=s.terms[j];l(c.$_terms[j]===void 0,"Invalid term override for",s.type,j),c.$_terms[j]=f.init,h[j]=f}s.terms=h,s.args||(s.args=o.args),s.prepare=e.prepare(s.prepare,o.prepare),s.coerce&&(typeof s.coerce=="function"&&(s.coerce={method:s.coerce}),s.coerce.from&&!Array.isArray(s.coerce.from)&&(s.coerce={method:s.coerce.method,from:[].concat(s.coerce.from)})),s.coerce=e.coerce(s.coerce,o.coerce),s.validate=e.validate(s.validate,o.validate);const g=Object.assign({},o.rules);if(s.rules)for(const j in s.rules){const f=s.rules[j];l(typeof f=="object","Invalid rule definition for",s.type,j);let y=f.method;if(y===void 0&&(y=function(){return this.$_addRule(j)}),y&&(l(!t[j],"Rule conflict in",s.type,j),t[j]=y),l(!g[j],"Rule conflict in",s.type,j),g[j]=f,f.alias){const x=[].concat(f.alias);for(const C of x)t[C]=f.method}f.args&&(f.argsByName=new Map,f.args=f.args.map(x=>(typeof x=="string"&&(x={name:x}),l(!f.argsByName.has(x.name),"Duplicated argument name",x.name),v.isSchema(x.assert)&&(x.assert=x.assert.strict().label(x.name)),f.argsByName.set(x.name,x),x)))}s.rules=g;const w=Object.assign({},o.modifiers);if(s.modifiers)for(const j in s.modifiers){l(!t[j],"Rule conflict in",s.type,j);const f=s.modifiers[j];l(typeof f=="function","Invalid modifier definition for",s.type,j);const y=function(x){return this.rule({[j]:x})};t[j]=y,w[j]=f}if(s.modifiers=w,s.overrides){t._super=r,c.$_super={};for(const j in s.overrides)l(r[j],"Cannot override missing",j),s.overrides[j][v.symbols.parent]=r[j],c.$_super[j]=r[j].bind(c);Object.assign(t,s.overrides)}s.cast=Object.assign({},o.cast,s.cast);const R=Object.assign({},o.manifest,s.manifest);return R.build=e.build(s.manifest&&s.manifest.build,o.manifest&&o.manifest.build),s.manifest=R,s.rebuild=e.rebuild(s.rebuild,o.rebuild),c},e.build=function(a,i){return a&&i?function(r,t){return i(a(r,t),t)}:a||i},e.coerce=function(a,i){return a&&i?{from:a.from&&i.from?[...new Set([...a.from,...i.from])]:null,method(r,t){let c;if((!i.from||i.from.includes(typeof r))&&(c=i.method(r,t),c)){if(c.errors||c.value===void 0)return c;r=c.value}if(!a.from||a.from.includes(typeof r)){const s=a.method(r,t);if(s)return s}return c}}:a||i},e.prepare=function(a,i){return a&&i?function(r,t){const c=a(r,t);if(c){if(c.errors||c.value===void 0)return c;r=c.value}return i(r,t)||c}:a||i},e.rebuild=function(a,i){return a&&i?function(r){i(r),a(r)}:a||i},e.validate=function(a,i){return a&&i?function(r,t){const c=i(r,t);if(c){if(c.errors&&(!Array.isArray(c.errors)||c.errors.length))return c;r=c.value}return a(r,t)||c}:a||i}},5107:(q,p,b)=>{const l=b(375),M=b(8571),v=b(8652),m=b(8160),e=b(3292),a=b(6354),i=b(8901),r=b(9708),t=b(6133),c=b(3328),s=b(1152);let o;const h={types:{alternatives:b(4946),any:b(8068),array:b(546),boolean:b(4937),date:b(7500),function:b(390),link:b(8785),number:b(3832),object:b(8966),string:b(7417),symbol:b(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const g={_types:new Set(Object.keys(h.types))};for(const w of g._types)g[w]=function(...R){return l(!R.length||["alternatives","link","object"].includes(w),"The",w,"type does not allow arguments"),h.generate(this,h.types[w],R)};for(const w of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])g[w]=function(...R){return this.any()[w](...R)};Object.assign(g,h.methods);for(const w in h.aliases){const R=h.aliases[w];g[w]=g[R]}return g.x=g.expression,s.setup&&s.setup(g),g}};h.methods={ValidationError:a.ValidationError,version:m.version,cache:v.provider,assert(g,w,...R){h.assert(g,w,!0,R)},attempt:(g,w,...R)=>h.assert(g,w,!1,R),build(g){return l(typeof r.build=="function","Manifest functionality disabled"),r.build(this,g)},checkPreferences(g){m.checkPreferences(g)},compile(g,w){return e.compile(this,g,w)},defaults(g){l(typeof g=="function","modifier must be a function");const w=Object.assign({},this);for(const R of w._types){const j=g(w[R]());l(m.isSchema(j),"modifier must return a valid schema object"),w[R]=function(...f){return h.generate(this,j,f)}}return w},expression:(...g)=>new c(...g),extend(...g){m.verifyFlat(g,"extend"),o=o||b(3378),l(g.length,"You need to provide at least one extension"),this.assert(g,o.extensions);const w=Object.assign({},this);w._types=new Set(w._types);for(let R of g){typeof R=="function"&&(R=R(w)),this.assert(R,o.extension);const j=h.expandExtension(R,w);for(const f of j){l(w[f.type]===void 0||w._types.has(f.type),"Cannot override name",f.type);const y=f.base||this.any(),x=i.type(y,f);w._types.add(f.type),w[f.type]=function(...C){return h.generate(this,x,C)}}}return w},isError:a.ValidationError.isError,isExpression:c.isTemplate,isRef:t.isRef,isSchema:m.isSchema,in:(...g)=>t.in(...g),override:m.symbols.override,ref:(...g)=>t.create(...g),types(){const g={};for(const w of this._types)g[w]=this[w]();for(const w in h.aliases)g[w]=this[w]();return g}},h.assert=function(g,w,R,j){const f=j[0]instanceof Error||typeof j[0]=="string"?j[0]:null,y=f!==null?j[1]:j[0],x=w.validate(g,m.preferences({errors:{stack:!0}},y||{}));let C=x.error;if(!C)return x.value;if(f instanceof Error)throw f;const N=R&&typeof C.annotate=="function"?C.annotate():C.message;throw C instanceof a.ValidationError==0&&(C=M(C)),C.message=f?`${f} ${N}`:N,C},h.generate=function(g,w,R){return l(g,"Must be invoked on a Joi instance."),w.$_root=g,w._definition.args&&R.length?w._definition.args(w,...R):w},h.expandExtension=function(g,w){if(typeof g.type=="string")return[g];const R=[];for(const j of w._types)if(g.type.test(j)){const f=Object.assign({},g);f.type=j,f.base=w[j](),R.push(f)}return R},q.exports=h.root()},6914:(q,p,b)=>{const l=b(375),M=b(8571),v=b(3328);p.compile=function(m,e){if(typeof m=="string")return l(!e,"Cannot set single message string"),new v(m);if(v.isTemplate(m))return l(!e,"Cannot set single message template"),m;l(typeof m=="object"&&!Array.isArray(m),"Invalid message options"),e=e?M(e):{};for(let a in m){const i=m[a];if(a==="root"||v.isTemplate(i)){e[a]=i;continue}if(typeof i=="string"){e[a]=new v(i);continue}l(typeof i=="object"&&!Array.isArray(i),"Invalid message for",a);const r=a;for(a in e[r]=e[r]||{},i){const t=i[a];a==="root"||v.isTemplate(t)?e[r][a]=t:(l(typeof t=="string","Invalid message for",a,"in",r),e[r][a]=new v(t))}}return e},p.decompile=function(m){const e={};for(let a in m){const i=m[a];if(a==="root"){e.root=i;continue}if(v.isTemplate(i)){e[a]=i.describe({compact:!0});continue}const r=a;for(a in e[r]={},i){const t=i[a];a!=="root"?e[r][a]=t.describe({compact:!0}):e[r].root=t}}return e},p.merge=function(m,e){if(!m)return p.compile(e);if(!e)return m;if(typeof e=="string")return new v(e);if(v.isTemplate(e))return e;const a=M(m);for(let i in e){const r=e[i];if(i==="root"||v.isTemplate(r)){a[i]=r;continue}if(typeof r=="string"){a[i]=new v(r);continue}l(typeof r=="object"&&!Array.isArray(r),"Invalid message for",i);const t=i;for(i in a[t]=a[t]||{},r){const c=r[i];i==="root"||v.isTemplate(c)?a[t][i]=c:(l(typeof c=="string","Invalid message for",i,"in",t),a[t][i]=new v(c))}}return a}},2294:(q,p,b)=>{const l=b(375),M=b(8160),v=b(6133),m={};p.Ids=m.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new m.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[a,i]of e._byId.entries())l(!this._byKey.has(a),"Schema id conflicts with existing key:",a),this._byId.set(a,i);for(const[a,i]of e._byKey.entries())l(!this._byId.has(a),"Schema key conflicts with existing id:",a),this._byKey.set(a,i)}fork(e,a,i){const r=this._collect(e);r.push({schema:i});const t=r.shift();let c={id:t.id,schema:a(t.schema)};l(M.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const s of r)c={id:s.id,schema:m.fork(s.schema,c.id,c.schema)};return c.schema}labels(e,a=[]){const i=e[0],r=this._get(i);if(!r)return[...a,...e].join(".");const t=e.slice(1);return a=[...a,r.schema._flags.label||i],t.length?r.schema._ids.labels(t,a):a.join(".")}reach(e,a=[]){const i=e[0],r=this._get(i);l(r,"Schema does not contain path",[...a,...e].join("."));const t=e.slice(1);return t.length?r.schema._ids.reach(t,[...a,i]):r.schema}register(e,{key:a}={}){if(!e||!M.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const i=e._flags.id;if(i){const r=this._byId.get(i);l(!r||r.schema===e,"Cannot add different schemas with the same id:",i),l(!this._byKey.has(i),"Schema id conflicts with existing key:",i),this._byId.set(i,{schema:e,id:i})}a&&(l(!this._byKey.has(a),"Schema already contains key:",a),l(!this._byId.has(a),"Schema key conflicts with existing id:",a),this._byKey.set(a,{schema:e,id:a}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,a=[],i=[]){const r=e[0],t=this._get(r);l(t,"Schema does not contain path",[...a,...e].join(".")),i=[t,...i];const c=e.slice(1);return c.length?t.schema._ids._collect(c,[...a,r],i):i}_get(e){return this._byId.get(e)||this._byKey.get(e)}},m.fork=function(e,a,i){const r=p.schema(e,{each:(t,{key:c})=>{if(a===(t._flags.id||c))return i},ref:!1});return r?r.$_mutateRebuild():e},p.schema=function(e,a){let i;for(const r in e._flags){if(r[0]==="_")continue;const t=m.scan(e._flags[r],{source:"flags",name:r},a);t!==void 0&&(i=i||e.clone(),i._flags[r]=t)}for(let r=0;r<e._rules.length;++r){const t=e._rules[r],c=m.scan(t.args,{source:"rules",name:t.name},a);if(c!==void 0){i=i||e.clone();const s=Object.assign({},t);s.args=c,i._rules[r]=s,i._singleRules.get(t.name)===t&&i._singleRules.set(t.name,s)}}for(const r in e.$_terms){if(r[0]==="_")continue;const t=m.scan(e.$_terms[r],{source:"terms",name:r},a);t!==void 0&&(i=i||e.clone(),i.$_terms[r]=t)}return i},m.scan=function(e,a,i,r,t){const c=r||[];if(e===null||typeof e!="object")return;let s;if(Array.isArray(e)){for(let o=0;o<e.length;++o){const h=a.source==="terms"&&a.name==="keys"&&e[o].key,g=m.scan(e[o],a,i,[o,...c],h);g!==void 0&&(s=s||e.slice(),s[o]=g)}return s}if(i.schema!==!1&&M.isSchema(e)||i.ref!==!1&&v.isRef(e)){const o=i.each(e,{...a,path:c,key:t});return o===e?void 0:o}for(const o in e){if(o[0]==="_")continue;const h=m.scan(e[o],a,i,[o,...c],t);h!==void 0&&(s=s||Object.assign({},e),s[o]=h)}return s}},6133:(q,p,b)=>{const l=b(375),M=b(8571),v=b(9621),m=b(8160);let e;const a={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};p.create=function(i,r={}){l(typeof i=="string","Invalid reference key:",i),m.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),l(!r.prefix||typeof r.prefix=="object","options.prefix must be of type object");const t=Object.assign({},a.defaults,r);delete t.prefix;const c=t.separator,s=a.context(i,c,r.prefix);if(t.type=s.type,i=s.key,t.type==="value")if(s.root&&(l(!c||i[0]!==c,"Cannot specify relative path with root prefix"),t.ancestor="root",i||(i=null)),c&&c===i)i=null,t.ancestor=0;else if(t.ancestor!==void 0)l(!c||!i||i[0]!==c,"Cannot combine prefix with ancestor option");else{const[o,h]=a.ancestor(i,c);h&&(i=i.slice(h))===""&&(i=null),t.ancestor=o}return t.path=c?i===null?[]:i.split(c):[i],new a.Ref(t)},p.in=function(i,r={}){return p.create(i,{...r,in:!0})},p.isRef=function(i){return!!i&&!!i[m.symbols.ref]},a.Ref=class{constructor(i){l(typeof i=="object","Invalid reference construction"),m.assertOptions(i,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),l([!1,void 0].includes(i.separator)||typeof i.separator=="string"&&i.separator.length===1,"Invalid separator"),l(!i.adjust||typeof i.adjust=="function","options.adjust must be a function"),l(!i.map||Array.isArray(i.map),"options.map must be an array"),l(!i.map||!i.adjust,"Cannot set both map and adjust options"),Object.assign(this,a.defaults,i),l(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(i,r,t,c,s={}){return l(!this.in||s.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(t.context,r,s):this.type==="local"?this._resolve(c,r,s):this.ancestor?this.ancestor==="root"?this._resolve(r.ancestors[r.ancestors.length-1],r,s):(l(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,s)):this._resolve(i,r,s)}_resolve(i,r,t){let c;if(this.type==="value"&&r.mainstay.shadow&&t.shadow!==!1&&(c=r.mainstay.shadow.get(this.absolute(r))),c===void 0&&(c=v(i,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(c=this.adjust(c)),this.map){const s=this.map.get(c);s!==void 0&&(c=s)}return r.mainstay&&r.mainstay.tracer.resolve(r,this,c),c}toString(){return this.display}absolute(i){return[...i.path.slice(0,-this.ancestor),...this.path]}clone(){return new a.Ref(this)}describe(){const i={path:this.path};this.type!=="value"&&(i.type=this.type),this.separator!=="."&&(i.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(i.ancestor=this.ancestor),this.map&&(i.map=[...this.map]);for(const r of["adjust","iterables","render"])this[r]!==null&&this[r]!==void 0&&(i[r]=this[r]);return this.in!==!1&&(i.in=!0),{ref:i}}updateDisplay(){const i=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${i}`);if(!this.separator)return void(this.display=`ref:${i}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${i}`);if(this.ancestor==="root")return void(this.display=`ref:root:${i}`);if(this.ancestor===1)return void(this.display=`ref:${i||".."}`);const r=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${r}${i||""}`}},a.Ref.prototype[m.symbols.ref]=!0,p.build=function(i){return(i=Object.assign({},a.defaults,i)).type==="value"&&i.ancestor===void 0&&(i.ancestor=1),new a.Ref(i)},a.context=function(i,r,t={}){if(i=i.trim(),t){const c=t.global===void 0?"$":t.global;if(c!==r&&i.startsWith(c))return{key:i.slice(c.length),type:"global"};const s=t.local===void 0?"#":t.local;if(s!==r&&i.startsWith(s))return{key:i.slice(s.length),type:"local"};const o=t.root===void 0?"/":t.root;if(o!==r&&i.startsWith(o))return{key:i.slice(o.length),type:"value",root:!0}}return{key:i,type:"value"}},a.ancestor=function(i,r){if(!r)return[1,0];if(i[0]!==r)return[1,0];if(i[1]!==r)return[0,1];let t=2;for(;i[t]===r;)++t;return[t-1,t]},p.toSibling=0,p.toParent=1,p.Manager=class{constructor(){this.refs=[]}register(i,r){if(i)if(r=r===void 0?p.toParent:r,Array.isArray(i))for(const t of i)this.register(t,r);else if(m.isSchema(i))for(const t of i._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else p.isRef(i)&&i.type==="value"&&i.ancestor-r>=0&&this.refs.push({ancestor:i.ancestor-r,root:i.root}),e=e||b(3328),e.isTemplate(i)&&this.register(i.refs(),r)}get length(){return this.refs.length}clone(){const i=new p.Manager;return i.refs=M(this.refs),i}reset(){this.refs=[]}roots(){return this.refs.filter(i=>!i.ancestor).map(i=>i.root)}}},3378:(q,p,b)=>{const l=b(5107),M={};M.wrap=l.string().min(1).max(2).allow(!1),p.preferences=l.object({allowUnknown:l.boolean(),abortEarly:l.boolean(),artifacts:l.boolean(),cache:l.boolean(),context:l.object(),convert:l.boolean(),dateFormat:l.valid("date","iso","string","time","utc"),debug:l.boolean(),errors:{escapeHtml:l.boolean(),label:l.valid("path","key",!1),language:[l.string(),l.object().ref()],render:l.boolean(),stack:l.boolean(),wrap:{label:M.wrap,array:M.wrap,string:M.wrap}},externals:l.boolean(),messages:l.object(),noDefaults:l.boolean(),nonEnumerables:l.boolean(),presence:l.valid("required","optional","forbidden"),skipFunctions:l.boolean(),stripUnknown:l.object({arrays:l.boolean(),objects:l.boolean()}).or("arrays","objects").allow(!0,!1),warnings:l.boolean()}).strict(),M.nameRx=/^[a-zA-Z0-9]\w*$/,M.rule=l.object({alias:l.array().items(l.string().pattern(M.nameRx)).single(),args:l.array().items(l.string(),l.object({name:l.string().pattern(M.nameRx).required(),ref:l.boolean(),assert:l.alternatives([l.function(),l.object().schema()]).conditional("ref",{is:!0,then:l.required()}),normalize:l.function(),message:l.string().when("assert",{is:l.function(),then:l.required()})})),convert:l.boolean(),manifest:l.boolean(),method:l.function().allow(!1),multi:l.boolean(),validate:l.function()}),p.extension=l.object({type:l.alternatives([l.string(),l.object().regex()]).required(),args:l.function(),cast:l.object().pattern(M.nameRx,l.object({from:l.function().maxArity(1).required(),to:l.function().minArity(1).maxArity(2).required()})),base:l.object().schema().when("type",{is:l.object().regex(),then:l.forbidden()}),coerce:[l.function().maxArity(3),l.object({method:l.function().maxArity(3).required(),from:l.array().items(l.string()).single()})],flags:l.object().pattern(M.nameRx,l.object({setter:l.string(),default:l.any()})),manifest:{build:l.function().arity(2)},messages:[l.object(),l.string()],modifiers:l.object().pattern(M.nameRx,l.function().minArity(1).maxArity(2)),overrides:l.object().pattern(M.nameRx,l.function()),prepare:l.function().maxArity(3),rebuild:l.function().arity(1),rules:l.object().pattern(M.nameRx,M.rule),terms:l.object().pattern(M.nameRx,l.object({init:l.array().allow(null).required(),manifest:l.object().pattern(/.+/,[l.valid("schema","single"),l.object({mapped:l.object({from:l.string().required(),to:l.string().required()}).required()})])})),validate:l.function().maxArity(3)}).strict(),p.extensions=l.array().items(l.object(),l.function().arity(1)).strict(),M.desc={buffer:l.object({buffer:l.string()}),func:l.object({function:l.function().required(),options:{literal:!0}}),override:l.object({override:!0}),ref:l.object({ref:l.object({type:l.valid("value","global","local"),path:l.array().required(),separator:l.string().length(1).allow(!1),ancestor:l.number().min(0).integer().allow("root"),map:l.array().items(l.array().length(2)).min(1),adjust:l.function(),iterables:l.boolean(),in:l.boolean(),render:l.boolean()}).required()}),regex:l.object({regex:l.string().min(3)}),special:l.object({special:l.valid("deep").required()}),template:l.object({template:l.string().required(),options:l.object()}),value:l.object({value:l.alternatives([l.object(),l.array()]).required()})},M.desc.entity=l.alternatives([l.array().items(l.link("...")),l.boolean(),l.function(),l.number(),l.string(),M.desc.buffer,M.desc.func,M.desc.ref,M.desc.regex,M.desc.special,M.desc.template,M.desc.value,l.link("/")]),M.desc.values=l.array().items(null,l.boolean(),l.function(),l.number().allow(1/0,-1/0),l.string().allow(""),l.symbol(),M.desc.buffer,M.desc.func,M.desc.override,M.desc.ref,M.desc.regex,M.desc.template,M.desc.value),M.desc.messages=l.object().pattern(/.+/,[l.string(),M.desc.template,l.object().pattern(/.+/,[l.string(),M.desc.template])]),p.description=l.object({type:l.string().required(),flags:l.object({cast:l.string(),default:l.any(),description:l.string(),empty:l.link("/"),failover:M.desc.entity,id:l.string(),label:l.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:l.boolean(),unit:l.string()}).unknown(),preferences:{allowUnknown:l.boolean(),abortEarly:l.boolean(),artifacts:l.boolean(),cache:l.boolean(),convert:l.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:l.boolean(),label:["path","key"],language:[l.string(),M.desc.ref],wrap:{label:M.wrap,array:M.wrap}},externals:l.boolean(),messages:M.desc.messages,noDefaults:l.boolean(),nonEnumerables:l.boolean(),presence:["required","optional","forbidden"],skipFunctions:l.boolean(),stripUnknown:l.object({arrays:l.boolean(),objects:l.boolean()}).or("arrays","objects").allow(!0,!1),warnings:l.boolean()},allow:M.desc.values,invalid:M.desc.values,rules:l.array().min(1).items({name:l.string().required(),args:l.object().min(1),keep:l.boolean(),message:[l.string(),M.desc.messages],warn:l.boolean()}),keys:l.object().pattern(/.*/,l.link("/")),link:M.desc.ref}).pattern(/^[a-z]\w*$/,l.any())},493:(q,p,b)=>{const l=b(8571),M=b(9621),v=b(8160),m={value:Symbol("value")};q.exports=m.State=class{constructor(e,a,i){this.path=e,this.ancestors=a,this.mainstay=i.mainstay,this.schemas=i.schemas,this.debug=null}localize(e,a=null,i=null){const r=new m.State(e,a,this);return i&&r.schemas&&(r.schemas=[m.schemas(i),...r.schemas]),r}nest(e,a){const i=new m.State(this.path,this.ancestors,this);return i.schemas=i.schemas&&[m.schemas(e),...i.schemas],i.debug=a,i}shadow(e,a){this.mainstay.shadow=this.mainstay.shadow||new m.Shadow,this.mainstay.shadow.set(this.path,e,a)}snapshot(){this.mainstay.shadow&&(this._snapshot=l(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},m.schemas=function(e){return v.isSchema(e)?{schema:e}:e},m.Shadow=class{constructor(){this._values=null}set(e,a,i){if(!e.length||i==="strip"&&typeof e[e.length-1]=="number")return;this._values=this._values||new Map;let r=this._values;for(let t=0;t<e.length;++t){const c=e[t];let s=r.get(c);s||(s=new Map,r.set(c,s)),r=s}r[m.value]=a}get(e){const a=this.node(e);if(a)return a[m.value]}node(e){if(this._values)return M(this._values,e,{iterables:!0})}override(e,a){if(!this._values)return;const i=e.slice(0,-1),r=e[e.length-1],t=M(this._values,i,{iterables:!0});a?t.set(r,a):t&&t.delete(r)}}},3328:(q,p,b)=>{const l=b(375),M=b(8571),v=b(5277),m=b(1447),e=b(8160),a=b(6354),i=b(6133),r={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};q.exports=r.Template=class{constructor(t,c){if(l(typeof t=="string","Template source must be a string"),l(!t.includes("\0")&&!t.includes(""),"Template source cannot contain reserved control characters"),this.source=t,this.rendered=t,this._template=null,c){const{functions:s,...o}=c;this._settings=Object.keys(o).length?M(o):void 0,this._functions=s,this._functions&&(l(Object.keys(this._functions).every(h=>typeof h=="string"),"Functions keys must be strings"),l(Object.values(this._functions).every(h=>typeof h=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const t=r.encode(this.source),c=r.split(t);let s=!1;const o=[],h=c.shift();h&&o.push(h);for(const g of c){const w=g[0]!=="{",R=w?"}":"}}",j=g.indexOf(R);if(j===-1||g[1]==="{"){o.push(`{${r.decode(g)}`);continue}let f=g.slice(w?0:1,j);const y=f[0]===":";y&&(f=f.slice(1));const x=this._ref(r.decode(f),{raw:w,wrapped:y});o.push(x),typeof x!="string"&&(s=!0);const C=g.slice(j+R.length);C&&o.push(r.decode(C))}s?this._template=o:this.rendered=o.join("")}static date(t,c){return r.dateFormat[c.dateFormat].call(t)}describe(t={}){if(!this._settings&&t.compact)return this.source;const c={template:this.source};return this._settings&&(c.options=this._settings),this._functions&&(c.functions=this._functions),c}static build(t){return new r.Template(t.template,t.options||t.functions?{...t.options,functions:t.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(t){return!!t&&!!t[e.symbols.template]}refs(){if(!this._template)return;const t=[];for(const c of this._template)typeof c!="string"&&t.push(...c.refs);return t}resolve(t,c,s,o){return this._template&&this._template.length===1?this._part(this._template[0],t,c,s,o,{}):this.render(t,c,s,o)}_part(t,...c){return t.ref?t.ref.resolve(...c):t.formula.evaluate(c)}render(t,c,s,o,h={}){if(!this.isDynamic())return this.rendered;const g=[];for(const w of this._template)if(typeof w=="string")g.push(w);else{const R=this._part(w,t,c,s,o,h),j=r.stringify(R,t,c,s,o,h);if(j!==void 0){const f=w.raw||(h.errors&&h.errors.escapeHtml)===!1?j:v(j);g.push(r.wrap(f,w.wrapped&&s.errors.wrap.label))}}return g.join("")}_ref(t,{raw:c,wrapped:s}){const o=[],h=w=>{const R=i.create(w,this._settings);return o.push(R),j=>{const f=R.resolve(...j);return f!==void 0?f:null}};try{const w=this._functions?{...r.functions,...this._functions}:r.functions;var g=new m.Parser(t,{reference:h,functions:w,constants:r.constants})}catch(w){throw w.message=`Invalid template variable "${t}" fails due to: ${w.message}`,w}if(g.single){if(g.single.type==="reference"){const w=o[0];return{ref:w,raw:c,refs:o,wrapped:s||w.type==="local"&&w.key==="label"}}return r.stringify(g.single.value)}return{formula:g,raw:c,refs:o}}toString(){return this.source}},r.Template.prototype[e.symbols.template]=!0,r.Template.prototype.isImmutable=!0,r.encode=function(t){return t.replace(/\\(\{+)/g,(c,s)=>r.opens.slice(0,s.length)).replace(/\\(\}+)/g,(c,s)=>r.closes.slice(0,s.length))},r.decode=function(t){return t.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},r.split=function(t){const c=[];let s="";for(let o=0;o<t.length;++o){const h=t[o];if(h==="{"){let g="";for(;o+1<t.length&&t[o+1]==="{";)g+="{",++o;c.push(s),s=g}else s+=h}return c.push(s),c},r.wrap=function(t,c){return c?c.length===1?`${c}${t}${c}`:`${c[0]}${t}${c[1]}`:t},r.stringify=function(t,c,s,o,h,g={}){const w=typeof t,R=o&&o.errors&&o.errors.wrap||{};let j=!1;if(i.isRef(t)&&t.render&&(j=t.in,t=t.resolve(c,s,o,h,{in:t.in,...g})),t===null)return"null";if(w==="string")return r.wrap(t,g.arrayItems&&R.string);if(w==="number"||w==="function"||w==="symbol")return t.toString();if(w!=="object")return JSON.stringify(t);if(t instanceof Date)return r.Template.date(t,o);if(t instanceof Map){const y=[];for(const[x,C]of t.entries())y.push(`${x.toString()} -> ${C.toString()}`);t=y}if(!Array.isArray(t))return t.toString();const f=[];for(const y of t)f.push(r.stringify(y,c,s,o,h,{arrayItems:!0,...g}));return r.wrap(f.join(", "),!j&&R.array)},r.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},r.functions={if:(t,c,s)=>t?c:s,length:t=>typeof t=="string"?t.length:t&&typeof t=="object"?Array.isArray(t)?t.length:Object.keys(t).length:null,msg(t){const[c,s,o,h,g]=this,w=g.messages;if(!w)return"";const R=a.template(c,w[0],t,s,o)||a.template(c,w[1],t,s,o);return R?R.render(c,s,o,h,g):""},number:t=>typeof t=="number"?t:typeof t=="string"?parseFloat(t):typeof t=="boolean"?t?1:0:t instanceof Date?t.getTime():null}},4946:(q,p,b)=>{const l=b(375),M=b(1687),v=b(8068),m=b(8160),e=b(3292),a=b(6354),i=b(6133),r={};q.exports=v.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:i.toSibling}},args:(t,...c)=>c.length===1&&Array.isArray(c[0])?t.try(...c[0]):t.try(...c),validate(t,c){const{schema:s,error:o,state:h,prefs:g}=c;if(s._flags.match){const R=[],j=[];for(let y=0;y<s.$_terms.matches.length;++y){const x=s.$_terms.matches[y],C=h.nest(x.schema,`match.${y}`);C.snapshot();const N=x.schema.$_validate(t,C,g);N.errors?(j.push(N.errors),C.restore()):(R.push(N.value),C.commit())}if(R.length===0)return{errors:o("alternatives.any",{details:j.map(y=>a.details(y,{override:!1}))})};if(s._flags.match==="one")return R.length===1?{value:R[0]}:{errors:o("alternatives.one")};if(R.length!==s.$_terms.matches.length)return{errors:o("alternatives.all",{details:j.map(y=>a.details(y,{override:!1}))})};const f=y=>y.$_terms.matches.some(x=>x.schema.type==="object"||x.schema.type==="alternatives"&&f(x.schema));return f(s)?{value:R.reduce((y,x)=>M(y,x,{mergeArrays:!1}))}:{value:R[R.length-1]}}const w=[];for(let R=0;R<s.$_terms.matches.length;++R){const j=s.$_terms.matches[R];if(j.schema){const x=h.nest(j.schema,`match.${R}`);x.snapshot();const C=j.schema.$_validate(t,x,g);if(!C.errors)return x.commit(),C;x.restore(),w.push({schema:j.schema,reports:C.errors});continue}const f=j.ref?j.ref.resolve(t,h,g):t,y=j.is?[j]:j.switch;for(let x=0;x<y.length;++x){const C=y[x],{is:N,then:$,otherwise:n}=C,d=`match.${R}${j.switch?"."+x:""}`;if(N.$_match(f,h.nest(N,`${d}.is`),g)){if($)return $.$_validate(t,h.nest($,`${d}.then`),g)}else if(n)return n.$_validate(t,h.nest(n,`${d}.otherwise`),g)}}return r.errors(w,c)},rules:{conditional:{method(t,c){l(!this._flags._endedSwitch,"Unreachable condition"),l(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),l(c.break===void 0,"Cannot use break option with alternatives conditional");const s=this.clone(),o=e.when(s,t,c),h=o.is?[o]:o.switch;for(const g of h)if(g.then&&g.otherwise){s.$_setFlag("_endedSwitch",!0,{clone:!1});break}return s.$_terms.matches.push(o),s.$_mutateRebuild()}},match:{method(t){if(l(["any","one","all"].includes(t),"Invalid alternatives match mode",t),t!=="any")for(const c of this.$_terms.matches)l(c.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){l(t.length,"Missing alternative schemas"),m.verifyFlat(t,"try"),l(!this._flags._endedSwitch,"Unreachable condition");const c=this.clone();for(const s of t)c.$_terms.matches.push({schema:c.$_compile(s)});return c.$_mutateRebuild()}}},overrides:{label(t){return this.$_parent("label",t).$_modify({each:(c,s)=>s.path[0]!=="is"&&typeof c._flags.label!="string"?c.label(t):void 0,ref:!1})}},rebuild(t){t.$_modify({each:c=>{m.isSchema(c)&&c.type==="array"&&t.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(t,c){if(c.matches)for(const s of c.matches){const{schema:o,ref:h,is:g,not:w,then:R,otherwise:j}=s;t=o?t.try(o):h?t.conditional(h,{is:g,then:R,not:w,otherwise:j,switch:s.switch}):t.conditional(g,{then:R,otherwise:j})}return t}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),r.errors=function(t,{error:c,state:s}){if(!t.length)return{errors:c("alternatives.any")};if(t.length===1)return{errors:t[0].reports};const o=new Set,h=[];for(const{reports:g,schema:w}of t){if(g.length>1)return r.unmatched(t,c);const R=g[0];if(R instanceof a.Report==0)return r.unmatched(t,c);if(R.state.path.length!==s.path.length){h.push({type:w.type,report:R});continue}if(R.code==="any.only"){for(const y of R.local.valids)o.add(y);continue}const[j,f]=R.code.split(".");f!=="base"?h.push({type:w.type,report:R}):R.code==="object.base"?o.add(R.local.type):o.add(j)}return h.length?h.length===1?{errors:h[0].report}:r.unmatched(t,c):{errors:c("alternatives.types",{types:[...o]})}},r.unmatched=function(t,c){const s=[];for(const o of t)s.push(...o.reports);return{errors:c("alternatives.match",a.details(s,{override:!1}))}}},8068:(q,p,b)=>{const l=b(375),M=b(7629),v=b(8160),m=b(6914);q.exports=M.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,a){return l(typeof e=="function","Method must be a function"),l(a===void 0||a&&typeof a=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:a}})},validate(e,a,{method:i}){try{return i(e,a)}catch(r){return a.error("any.custom",{error:r})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){l(v.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const a=this.clone();return a.$_terms.shared=a.$_terms.shared||[],a.$_terms.shared.push(e),a.$_mutateRegister(e),a}},warning:{method(e,a){return l(e&&typeof e=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:a},warn:!0})},validate:(e,a,{code:i,local:r})=>a.error(i,r),args:["code","local"],multi:!0}},modifiers:{keep(e,a=!0){e.keep=a},message(e,a){e.message=m.compile(a)},warn(e,a=!0){e.warn=a}},manifest:{build(e,a){for(const i in a){const r=a[i];if(["examples","externals","metas","notes","tags"].includes(i))for(const t of r)e=e[i.slice(0,-1)](t);else if(i!=="alterations")if(i!=="whens"){if(i==="shared")for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:c,is:s,not:o,then:h,otherwise:g,concat:w}=t;e=w?e.concat(w):c?e.when(c,{is:s,not:o,then:h,otherwise:g,switch:t.switch,break:t.break}):e.when(s,{then:h,otherwise:g,break:t.break})}else{const t={};for(const{target:c,adjuster:s}of r)t[c]=s;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(q,p,b)=>{const l=b(375),M=b(9474),v=b(9621),m=b(8068),e=b(8160),a=b(3292),i={};q.exports=m.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(r,{schema:t,state:c,prefs:s}){if(!Array.isArray(r))return;const o=t.$_getRule("sort");return o?i.sort(t,r,o.args.options,c,s):void 0}},validate(r,{schema:t,error:c}){if(!Array.isArray(r)){if(t._flags.single){const s=[r];return s[e.symbols.arraySingle]=!0,{value:s}}return{errors:c("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:r.slice()}},rules:{has:{method(r){r=this.$_compile(r,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:r}});return t.$_mutateRegister(r),t},validate(r,{state:t,prefs:c,error:s},{schema:o}){const h=[r,...t.ancestors];for(let w=0;w<r.length;++w){const R=t.localize([...t.path,w],h,o);if(o.$_match(r[w],R,c))return r}const g=o._flags.label;return g?s("array.hasKnown",{patternLabel:g}):s("array.hasUnknown",null)},multi:!0},items:{method(...r){e.verifyFlat(r,"items");const t=this.$_addRule("items");for(let c=0;c<r.length;++c){const s=e.tryWithPath(()=>this.$_compile(r[c]),c,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(r,{schema:t,error:c,state:s,prefs:o,errorsArray:h}){const g=t.$_terms._requireds.slice(),w=t.$_terms.ordered.slice(),R=[...t.$_terms._inclusions,...g],j=!r[e.symbols.arraySingle];delete r[e.symbols.arraySingle];const f=h();let y=r.length;for(let x=0;x<y;++x){const C=r[x];let N=!1,$=!1;const n=j?x:new Number(x),d=[...s.path,n];if(!t._flags.sparse&&C===void 0){if(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),o.abortEarly)return f;w.shift();continue}const _=[r,...s.ancestors];for(const D of t.$_terms._exclusions)if(D.$_match(C,s.localize(d,_,D),o,{presence:"ignore"})){if(f.push(c("array.excludes",{pos:x,value:C},s.localize(d))),o.abortEarly)return f;N=!0,w.shift();break}if(N)continue;if(t.$_terms.ordered.length){if(w.length){const D=w.shift(),k=D.$_validate(C,s.localize(d,_,D),o);if(k.errors){if(f.push(...k.errors),o.abortEarly)return f}else if(D._flags.result==="strip")i.fastSplice(r,x),--x,--y;else{if(!t._flags.sparse&&k.value===void 0){if(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),o.abortEarly)return f;continue}r[x]=k.value}continue}if(!t.$_terms.items.length){if(f.push(c("array.orderedLength",{pos:x,limit:t.$_terms.ordered.length})),o.abortEarly)return f;break}}const S=[];let O=g.length;for(let D=0;D<O;++D){const k=s.localize(d,_,g[D]);k.snapshot();const u=g[D].$_validate(C,k,o);if(S[D]=u,!u.errors){if(k.commit(),r[x]=u.value,$=!0,i.fastSplice(g,D),--D,--O,!t._flags.sparse&&u.value===void 0&&(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),o.abortEarly))return f;break}k.restore()}if($)continue;const E=o.stripUnknown&&!!o.stripUnknown.arrays||!1;O=R.length;for(const D of R){let k;const u=g.indexOf(D);if(u!==-1)k=S[u];else{const A=s.localize(d,_,D);if(A.snapshot(),k=D.$_validate(C,A,o),!k.errors){A.commit(),D._flags.result==="strip"?(i.fastSplice(r,x),--x,--y):t._flags.sparse||k.value!==void 0?r[x]=k.value:(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),N=!0),$=!0;break}A.restore()}if(O===1){if(E){i.fastSplice(r,x),--x,--y,$=!0;break}if(f.push(...k.errors),o.abortEarly)return f;N=!0;break}}if(!N&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!$){if(E){i.fastSplice(r,x),--x,--y;continue}if(f.push(c("array.includes",{pos:x,value:C},s.localize(d))),o.abortEarly)return f}}return g.length&&i.fillMissedErrors(t,f,g,r,s,o),w.length&&(i.fillOrderedErrors(t,f,w,r,s,o),f.length||i.fillDefault(w,r,s,o)),f.length?f:r},priority:!0,manifest:!1},length:{method(r){return this.$_addRule({name:"length",args:{limit:r},operator:"="})},validate:(r,t,{limit:c},{name:s,operator:o,args:h})=>e.compare(r.length,c,o)?r:t.error("array."+s,{limit:h.limit,value:r}),args:[{name:"limit",ref:!0,assert:e.limit,message:"must be a positive integer"}]},max:{method(r){return this.$_addRule({name:"max",method:"length",args:{limit:r},operator:"<="})}},min:{method(r){return this.$_addRule({name:"min",method:"length",args:{limit:r},operator:">="})}},ordered:{method(...r){e.verifyFlat(r,"ordered");const t=this.$_addRule("items");for(let c=0;c<r.length;++c){const s=e.tryWithPath(()=>this.$_compile(r[c]),c,{append:!0});i.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(r){const t=r===void 0||!!r;return l(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(r={}){e.assertOptions(r,["by","order"]);const t={order:r.order||"ascending"};return r.by&&(t.by=a.ref(r.by,{ancestor:0}),l(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(r,{error:t,state:c,prefs:s,schema:o},{options:h}){const{value:g,errors:w}=i.sort(o,r,h,c,s);if(w)return w;for(let R=0;R<r.length;++R)if(r[R]!==g[R])return t("array.sort",{order:h.order,by:h.by?h.by.key:"value"});return r},convert:!0},sparse:{method(r){const t=r===void 0||!!r;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(r,t={}){l(!r||typeof r=="function"||typeof r=="string","comparator must be a function or a string"),e.assertOptions(t,["ignoreUndefined","separator"]);const c={name:"unique",args:{options:t,comparator:r}};if(r)if(typeof r=="string"){const s=e.default(t.separator,".");c.path=s?r.split(s):[r]}else c.comparator=r;return this.$_addRule(c)},validate(r,{state:t,error:c,schema:s},{comparator:o,options:h},{comparator:g,path:w}){const R={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},j=g||M,f=h.ignoreUndefined;for(let y=0;y<r.length;++y){const x=w?v(r[y],w):r[y],C=g?R.custom:R[typeof x];if(l(C,"Failed to find unique map container for type",typeof x),C instanceof Map){const N=C.entries();let $;for(;!($=N.next()).done;)if(j($.value[0],x)){const n=t.localize([...t.path,y],[r,...t.ancestors]),d={pos:y,value:r[y],dupePos:$.value[1],dupeValue:r[$.value[1]]};return w&&(d.path=o),c("array.unique",d,n)}C.set(x,y)}else{if((!f||x!==void 0)&&C[x]!==void 0){const N={pos:y,value:r[y],dupePos:C[x],dupeValue:r[C[x]]};return w&&(N.path=o),c("array.unique",N,t.localize([...t.path,y],[r,...t.ancestors]))}C[x]=y}}return r},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(r,t)=>new Set(r)}},rebuild(r){r.$_terms._inclusions=[],r.$_terms._exclusions=[],r.$_terms._requireds=[];for(const t of r.$_terms.items)i.validateSingle(t,r),t._flags.presence==="required"?r.$_terms._requireds.push(t):t._flags.presence==="forbidden"?r.$_terms._exclusions.push(t):r.$_terms._inclusions.push(t);for(const t of r.$_terms.ordered)i.validateSingle(t,r)},manifest:{build:(r,t)=>(t.items&&(r=r.items(...t.items)),t.ordered&&(r=r.ordered(...t.ordered)),r)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),i.fillMissedErrors=function(r,t,c,s,o,h){const g=[];let w=0;for(const R of c){const j=R._flags.label;j?g.push(j):++w}g.length?w?t.push(r.$_createError("array.includesRequiredBoth",s,{knownMisses:g,unknownMisses:w},o,h)):t.push(r.$_createError("array.includesRequiredKnowns",s,{knownMisses:g},o,h)):t.push(r.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:w},o,h))},i.fillOrderedErrors=function(r,t,c,s,o,h){const g=[];for(const w of c)w._flags.presence==="required"&&g.push(w);g.length&&i.fillMissedErrors(r,t,g,s,o,h)},i.fillDefault=function(r,t,c,s){const o=[];let h=!0;for(let g=r.length-1;g>=0;--g){const w=r[g],R=[t,...c.ancestors],j=w.$_validate(void 0,c.localize(c.path,R,w),s).value;if(h){if(j===void 0)continue;h=!1}o.unshift(j)}o.length&&t.push(...o)},i.fastSplice=function(r,t){let c=t;for(;c<r.length;)r[c++]=r[c];--r.length},i.validateSingle=function(r,t){(r.type==="array"||r._flags._arrayItems)&&(l(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},i.sort=function(r,t,c,s,o){const h=c.order==="ascending"?1:-1,g=-1*h,w=h,R=(j,f)=>{let y=i.compare(j,f,g,w);if(y!==null||(c.by&&(j=c.by.resolve(j,s,o),f=c.by.resolve(f,s,o)),y=i.compare(j,f,g,w),y!==null))return y;const x=typeof j;if(x!==typeof f)throw r.$_createError("array.sort.mismatching",t,null,s,o);if(x!=="number"&&x!=="string")throw r.$_createError("array.sort.unsupported",t,{type:x},s,o);return x==="number"?(j-f)*h:j<f?g:w};try{return{value:t.slice().sort(R)}}catch(j){return{errors:j}}},i.compare=function(r,t,c,s){return r===t?0:r===void 0?1:t===void 0?-1:r===null?s:t===null?c:null}},4937:(q,p,b)=>{const l=b(375),M=b(8068),v=b(8160),m=b(2036),e={isBool:function(a){return typeof a=="boolean"}};q.exports=M.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(a,{schema:i}){if(typeof a!="boolean"){if(typeof a=="string"){const r=i._flags.sensitive?a:a.toLowerCase();a=r==="true"||r!=="false"&&a}return typeof a!="boolean"&&(a=i.$_terms.truthy&&i.$_terms.truthy.has(a,null,null,!i._flags.sensitive)||(!i.$_terms.falsy||!i.$_terms.falsy.has(a,null,null,!i._flags.sensitive))&&a),{value:a}}},validate(a,{error:i}){if(typeof a!="boolean")return{value:a,errors:i("boolean.base")}},rules:{truthy:{method(...a){v.verifyFlat(a,"truthy");const i=this.clone();i.$_terms.truthy=i.$_terms.truthy||new m;for(let r=0;r<a.length;++r){const t=a[r];l(t!==void 0,"Cannot call truthy with undefined"),i.$_terms.truthy.add(t)}return i}},falsy:{method(...a){v.verifyFlat(a,"falsy");const i=this.clone();i.$_terms.falsy=i.$_terms.falsy||new m;for(let r=0;r<a.length;++r){const t=a[r];l(t!==void 0,"Cannot call falsy with undefined"),i.$_terms.falsy.add(t)}return i}},sensitive:{method(a=!0){return this.$_setFlag("sensitive",a)}}},cast:{number:{from:e.isBool,to:(a,i)=>a?1:0},string:{from:e.isBool,to:(a,i)=>a?"true":"false"}},manifest:{build:(a,i)=>(i.truthy&&(a=a.truthy(...i.truthy)),i.falsy&&(a=a.falsy(...i.falsy)),a)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(q,p,b)=>{const l=b(375),M=b(8068),v=b(8160),m=b(3328),e={isDate:function(a){return a instanceof Date}};q.exports=M.extend({type:"date",coerce:{from:["number","string"],method:(a,{schema:i})=>({value:e.parse(a,i._flags.format)||a})},validate(a,{schema:i,error:r,prefs:t}){if(a instanceof Date&&!isNaN(a.getTime()))return;const c=i._flags.format;return t.convert&&c&&typeof a=="string"?{value:a,errors:r("date.format",{format:c})}:{value:a,errors:r("date.base")}},rules:{compare:{method:!1,validate(a,i,{date:r},{name:t,operator:c,args:s}){const o=r==="now"?Date.now():r.getTime();return v.compare(a.getTime(),o,c)?a:i.error("date."+t,{limit:s.date,value:a})},args:[{name:"date",ref:!0,normalize:a=>a==="now"?a:e.parse(a),assert:a=>a!==null,message:"must have a valid date format"}]},format:{method(a){return l(["iso","javascript","unix"].includes(a),"Unknown date format",a),this.$_setFlag("format",a)}},greater:{method(a){return this.$_addRule({name:"greater",method:"compare",args:{date:a},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(a){return this.$_addRule({name:"less",method:"compare",args:{date:a},operator:"<"})}},max:{method(a){return this.$_addRule({name:"max",method:"compare",args:{date:a},operator:"<="})}},min:{method(a){return this.$_addRule({name:"min",method:"compare",args:{date:a},operator:">="})}},timestamp:{method(a="javascript"){return l(["javascript","unix"].includes(a),'"type" must be one of "javascript, unix"'),this.format(a)}}},cast:{number:{from:e.isDate,to:(a,i)=>a.getTime()},string:{from:e.isDate,to:(a,{prefs:i})=>m.date(a,i)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),e.parse=function(a,i){if(a instanceof Date)return a;if(typeof a!="string"&&(isNaN(a)||!isFinite(a))||/^\s*$/.test(a))return null;if(i==="iso")return v.isIsoDate(a)?e.date(a.toString()):null;const r=a;if(typeof a=="string"&&/^[+-]?\d+(\.\d+)?$/.test(a)&&(a=parseFloat(a)),i){if(i==="javascript")return e.date(1*a);if(i==="unix")return e.date(1e3*a);if(typeof r=="string")return null}return e.date(a)},e.date=function(a){const i=new Date(a);return isNaN(i.getTime())?null:i}},390:(q,p,b)=>{const l=b(375),M=b(7824);q.exports=M.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(v){return l(Number.isSafeInteger(v)&&v>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:v}})},validate:(v,m,{n:e})=>v.length===e?v:m.error("function.arity",{n:e})},class:{method(){return this.$_addRule("class")},validate:(v,m)=>/^\s*class\s/.test(v.toString())?v:m.error("function.class",{value:v})},minArity:{method(v){return l(Number.isSafeInteger(v)&&v>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:v}})},validate:(v,m,{n:e})=>v.length>=e?v:m.error("function.minArity",{n:e})},maxArity:{method(v){return l(Number.isSafeInteger(v)&&v>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:v}})},validate:(v,m,{n:e})=>v.length<=e?v:m.error("function.maxArity",{n:e})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(q,p,b)=>{const l=b(978),M=b(375),v=b(8571),m=b(3652),e=b(8068),a=b(8160),i=b(3292),r=b(6354),t=b(6133),c=b(3328),s={renameDefaults:{alias:!1,multiple:!1,override:!1}};q.exports=e.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(o,h)=>o.keys(h),validate(o,{schema:h,error:g,state:w,prefs:R}){if(!o||typeof o!==h.$_property("typeof")||Array.isArray(o))return{value:o,errors:g("object.base",{type:h.$_property("typeof")})};if(!(h.$_terms.renames||h.$_terms.dependencies||h.$_terms.keys||h.$_terms.patterns||h.$_terms.externals))return;o=s.clone(o,R);const j=[];if(h.$_terms.renames&&!s.rename(h,o,w,R,j))return{value:o,errors:j};if(!h.$_terms.keys&&!h.$_terms.patterns&&!h.$_terms.dependencies)return{value:o,errors:j};const f=new Set(Object.keys(o));if(h.$_terms.keys){const y=[o,...w.ancestors];for(const x of h.$_terms.keys){const C=x.key,N=o[C];f.delete(C);const $=w.localize([...w.path,C],y,x),n=x.schema.$_validate(N,$,R);if(n.errors){if(R.abortEarly)return{value:o,errors:n.errors};n.value!==void 0&&(o[C]=n.value),j.push(...n.errors)}else x.schema._flags.result==="strip"||n.value===void 0&&N!==void 0?delete o[C]:n.value!==void 0&&(o[C]=n.value)}}if(f.size||h._flags._hasPatternMatch){const y=s.unknown(h,o,f,j,w,R);if(y)return y}if(h.$_terms.dependencies)for(const y of h.$_terms.dependencies){if(y.key!==null&&s.isPresent(y.options)(y.key.resolve(o,w,R,null,{shadow:!1}))===!1)continue;const x=s.dependencies[y.rel](h,y,o,w,R);if(x){const C=h.$_createError(x.code,o,x.context,w,R);if(R.abortEarly)return{value:o,errors:C};j.push(C)}}return{value:o,errors:j}},rules:{and:{method(...o){return a.verifyFlat(o,"and"),s.dependency(this,"and",null,o)}},append:{method(o){return o==null||Object.keys(o).length===0?this:this.keys(o)}},assert:{method(o,h,g){c.isTemplate(o)||(o=i.ref(o)),M(g===void 0||typeof g=="string","Message must be a string"),h=this.$_compile(h,{appendPath:!0});const w=this.$_addRule({name:"assert",args:{subject:o,schema:h,message:g}});return w.$_mutateRegister(o),w.$_mutateRegister(h),w},validate(o,{error:h,prefs:g,state:w},{subject:R,schema:j,message:f}){const y=R.resolve(o,w,g),x=t.isRef(R)?R.absolute(w):[];return j.$_match(y,w.localize(x,[o,...w.ancestors],j),g)?o:h("object.assert",{subject:R,message:f})},args:["subject","schema","message"],multi:!0},instance:{method(o,h){return M(typeof o=="function","constructor must be a function"),h=h||o.name,this.$_addRule({name:"instance",args:{constructor:o,name:h}})},validate:(o,h,{constructor:g,name:w})=>o instanceof g?o:h.error("object.instance",{type:w,value:o}),args:["constructor","name"]},keys:{method(o){M(o===void 0||typeof o=="object","Object schema must be a valid object"),M(!a.isSchema(o),"Object schema cannot be a joi schema");const h=this.clone();if(o)if(Object.keys(o).length){h.$_terms.keys=h.$_terms.keys?h.$_terms.keys.filter(g=>!o.hasOwnProperty(g.key)):new s.Keys;for(const g in o)a.tryWithPath(()=>h.$_terms.keys.push({key:g,schema:this.$_compile(o[g])}),g)}else h.$_terms.keys=new s.Keys;else h.$_terms.keys=null;return h.$_mutateRebuild()}},length:{method(o){return this.$_addRule({name:"length",args:{limit:o},operator:"="})},validate:(o,h,{limit:g},{name:w,operator:R,args:j})=>a.compare(Object.keys(o).length,g,R)?o:h.error("object."+w,{limit:j.limit,value:o}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(o){return this.$_addRule({name:"max",method:"length",args:{limit:o},operator:"<="})}},min:{method(o){return this.$_addRule({name:"min",method:"length",args:{limit:o},operator:">="})}},nand:{method(...o){return a.verifyFlat(o,"nand"),s.dependency(this,"nand",null,o)}},or:{method(...o){return a.verifyFlat(o,"or"),s.dependency(this,"or",null,o)}},oxor:{method(...o){return s.dependency(this,"oxor",null,o)}},pattern:{method(o,h,g={}){const w=o instanceof RegExp;w||(o=this.$_compile(o,{appendPath:!0})),M(h!==void 0,"Invalid rule"),a.assertOptions(g,["fallthrough","matches"]),w&&M(!o.flags.includes("g")&&!o.flags.includes("y"),"pattern should not use global or sticky mode"),h=this.$_compile(h,{appendPath:!0});const R=this.clone();R.$_terms.patterns=R.$_terms.patterns||[];const j={[w?"regex":"schema"]:o,rule:h};return g.matches&&(j.matches=this.$_compile(g.matches),j.matches.type!=="array"&&(j.matches=j.matches.$_root.array().items(j.matches)),R.$_mutateRegister(j.matches),R.$_setFlag("_hasPatternMatch",!0,{clone:!1})),g.fallthrough&&(j.fallthrough=!0),R.$_terms.patterns.push(j),R.$_mutateRegister(h),R}},ref:{method(){return this.$_addRule("ref")},validate:(o,h)=>t.isRef(o)?o:h.error("object.refType",{value:o})},regex:{method(){return this.$_addRule("regex")},validate:(o,h)=>o instanceof RegExp?o:h.error("object.regex",{value:o})},rename:{method(o,h,g={}){M(typeof o=="string"||o instanceof RegExp,"Rename missing the from argument"),M(typeof h=="string"||h instanceof c,"Invalid rename to argument"),M(h!==o,"Cannot rename key to same name:",o),a.assertOptions(g,["alias","ignoreUndefined","override","multiple"]);const w=this.clone();w.$_terms.renames=w.$_terms.renames||[];for(const R of w.$_terms.renames)M(R.from!==o,"Cannot rename the same key multiple times");return h instanceof c&&w.$_mutateRegister(h),w.$_terms.renames.push({from:o,to:h,options:l(s.renameDefaults,g)}),w}},schema:{method(o="any"){return this.$_addRule({name:"schema",args:{type:o}})},validate:(o,h,{type:g})=>!a.isSchema(o)||g!=="any"&&o.type!==g?h.error("object.schema",{type:g}):o},unknown:{method(o){return this.$_setFlag("unknown",o!==!1)}},with:{method(o,h,g={}){return s.dependency(this,"with",o,h,g)}},without:{method(o,h,g={}){return s.dependency(this,"without",o,h,g)}},xor:{method(...o){return a.verifyFlat(o,"xor"),s.dependency(this,"xor",null,o)}}},overrides:{default(o,h){return o===void 0&&(o=a.symbols.deepDefault),this.$_parent("default",o,h)}},rebuild(o){if(o.$_terms.keys){const h=new m.Sorter;for(const g of o.$_terms.keys)a.tryWithPath(()=>h.add(g,{after:g.schema.$_rootReferences(),group:g.key}),g.key);o.$_terms.keys=new s.Keys(...h.nodes)}},manifest:{build(o,h){if(h.keys&&(o=o.keys(h.keys)),h.dependencies)for(const{rel:g,key:w=null,peers:R,options:j}of h.dependencies)o=s.dependency(o,g,w,R,j);if(h.patterns)for(const{regex:g,schema:w,rule:R,fallthrough:j,matches:f}of h.patterns)o=o.pattern(g||w,R,{fallthrough:j,matches:f});if(h.renames)for(const{from:g,to:w,options:R}of h.renames)o=o.rename(g,w,R);return o}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),s.clone=function(o,h){if(typeof o=="object"){if(h.nonEnumerables)return v(o,{shallow:!0});const w=Object.create(Object.getPrototypeOf(o));return Object.assign(w,o),w}const g=function(...w){return o.apply(this,w)};return g.prototype=v(o.prototype),Object.defineProperty(g,"name",{value:o.name,writable:!1}),Object.defineProperty(g,"length",{value:o.length,writable:!1}),Object.assign(g,o),g},s.dependency=function(o,h,g,w,R){M(g===null||typeof g=="string",h,"key must be a strings"),R||(R=w.length>1&&typeof w[w.length-1]=="object"?w.pop():{}),a.assertOptions(R,["separator","isPresent"]),w=[].concat(w);const j=a.default(R.separator,"."),f=[];for(const x of w)M(typeof x=="string",h,"peers must be strings"),f.push(i.ref(x,{separator:j,ancestor:0,prefix:!1}));g!==null&&(g=i.ref(g,{separator:j,ancestor:0,prefix:!1}));const y=o.clone();return y.$_terms.dependencies=y.$_terms.dependencies||[],y.$_terms.dependencies.push(new s.Dependency(h,g,f,w,R)),y},s.dependencies={and(o,h,g,w,R){const j=[],f=[],y=h.peers.length,x=s.isPresent(h.options);for(const C of h.peers)x(C.resolve(g,w,R,null,{shadow:!1}))===!1?j.push(C.key):f.push(C.key);if(j.length!==y&&f.length!==y)return{code:"object.and",context:{present:f,presentWithLabels:s.keysToLabels(o,f),missing:j,missingWithLabels:s.keysToLabels(o,j)}}},nand(o,h,g,w,R){const j=[],f=s.isPresent(h.options);for(const C of h.peers)f(C.resolve(g,w,R,null,{shadow:!1}))&&j.push(C.key);if(j.length!==h.peers.length)return;const y=h.paths[0],x=h.paths.slice(1);return{code:"object.nand",context:{main:y,mainWithLabel:s.keysToLabels(o,y),peers:x,peersWithLabels:s.keysToLabels(o,x)}}},or(o,h,g,w,R){const j=s.isPresent(h.options);for(const f of h.peers)if(j(f.resolve(g,w,R,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)}}},oxor(o,h,g,w,R){const j=[],f=s.isPresent(h.options);for(const x of h.peers)f(x.resolve(g,w,R,null,{shadow:!1}))&&j.push(x.key);if(!j.length||j.length===1)return;const y={peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)};return y.present=j,y.presentWithLabels=s.keysToLabels(o,j),{code:"object.oxor",context:y}},with(o,h,g,w,R){const j=s.isPresent(h.options);for(const f of h.peers)if(j(f.resolve(g,w,R,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:h.key.key,mainWithLabel:s.keysToLabels(o,h.key.key),peer:f.key,peerWithLabel:s.keysToLabels(o,f.key)}}},without(o,h,g,w,R){const j=s.isPresent(h.options);for(const f of h.peers)if(j(f.resolve(g,w,R,null,{shadow:!1})))return{code:"object.without",context:{main:h.key.key,mainWithLabel:s.keysToLabels(o,h.key.key),peer:f.key,peerWithLabel:s.keysToLabels(o,f.key)}}},xor(o,h,g,w,R){const j=[],f=s.isPresent(h.options);for(const x of h.peers)f(x.resolve(g,w,R,null,{shadow:!1}))&&j.push(x.key);if(j.length===1)return;const y={peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)};return j.length===0?{code:"object.missing",context:y}:(y.present=j,y.presentWithLabels=s.keysToLabels(o,j),{code:"object.xor",context:y})}},s.keysToLabels=function(o,h){return Array.isArray(h)?h.map(g=>o.$_mapLabels(g)):o.$_mapLabels(h)},s.isPresent=function(o){return typeof o.isPresent=="function"?o.isPresent:h=>h!==void 0},s.rename=function(o,h,g,w,R){const j={};for(const f of o.$_terms.renames){const y=[],x=typeof f.from!="string";if(x)for(const C in h){if(h[C]===void 0&&f.options.ignoreUndefined||C===f.to)continue;const N=f.from.exec(C);N&&y.push({from:C,to:f.to,match:N})}else!Object.prototype.hasOwnProperty.call(h,f.from)||h[f.from]===void 0&&f.options.ignoreUndefined||y.push(f);for(const C of y){const N=C.from;let $=C.to;if($ instanceof c&&($=$.render(h,g,w,C.match)),N!==$){if(!f.options.multiple&&j[$]&&(R.push(o.$_createError("object.rename.multiple",h,{from:N,to:$,pattern:x},g,w)),w.abortEarly)||Object.prototype.hasOwnProperty.call(h,$)&&!f.options.override&&!j[$]&&(R.push(o.$_createError("object.rename.override",h,{from:N,to:$,pattern:x},g,w)),w.abortEarly))return!1;h[N]===void 0?delete h[$]:h[$]=h[N],j[$]=!0,f.options.alias||delete h[N]}}}return!0},s.unknown=function(o,h,g,w,R,j){if(o.$_terms.patterns){let f=!1;const y=o.$_terms.patterns.map(C=>{if(C.matches)return f=!0,[]}),x=[h,...R.ancestors];for(const C of g){const N=h[C],$=[...R.path,C];for(let n=0;n<o.$_terms.patterns.length;++n){const d=o.$_terms.patterns[n];if(d.regex){const O=d.regex.test(C);if(R.mainstay.tracer.debug(R,"rule",`pattern.${n}`,O?"pass":"error"),!O)continue}else if(!d.schema.$_match(C,R.nest(d.schema,`pattern.${n}`),j))continue;g.delete(C);const _=R.localize($,x,{schema:d.rule,key:C}),S=d.rule.$_validate(N,_,j);if(S.errors){if(j.abortEarly)return{value:h,errors:S.errors};w.push(...S.errors)}if(d.matches&&y[n].push(C),h[C]=S.value,!d.fallthrough)break}}if(f)for(let C=0;C<y.length;++C){const N=y[C];if(!N)continue;const $=o.$_terms.patterns[C].matches,n=R.localize(R.path,x,$),d=$.$_validate(N,n,j);if(d.errors){const _=r.details(d.errors,{override:!1});_.matches=N;const S=o.$_createError("object.pattern.match",h,_,R,j);if(j.abortEarly)return{value:h,errors:S};w.push(S)}}}if(g.size&&(o.$_terms.keys||o.$_terms.patterns)){if(j.stripUnknown&&o._flags.unknown===void 0||j.skipFunctions){const f=!(!j.stripUnknown||j.stripUnknown!==!0&&!j.stripUnknown.objects);for(const y of g)f?(delete h[y],g.delete(y)):typeof h[y]=="function"&&g.delete(y)}if(!a.default(o._flags.unknown,j.allowUnknown))for(const f of g){const y=R.localize([...R.path,f],[]),x=o.$_createError("object.unknown",h[f],{child:f},y,j,{flags:!1});if(j.abortEarly)return{value:h,errors:x};w.push(x)}}},s.Dependency=class{constructor(o,h,g,w,R){this.rel=o,this.key=h,this.peers=g,this.paths=w,this.options=R}describe(){const o={rel:this.rel,peers:this.paths};return this.key!==null&&(o.key=this.key.key),this.peers[0].separator!=="."&&(o.options={...o.options,separator:this.peers[0].separator}),this.options.isPresent&&(o.options={...o.options,isPresent:this.options.isPresent}),o}},s.Keys=class extends Array{concat(o){const h=this.slice(),g=new Map;for(let w=0;w<h.length;++w)g.set(h[w].key,w);for(const w of o){const R=w.key,j=g.get(R);j!==void 0?h[j]={key:R,schema:h[j].schema.concat(w.schema)}:h.push(w)}return h}}},8785:(q,p,b)=>{const l=b(375),M=b(8068),v=b(8160),m=b(3292),e=b(6354),a={};q.exports=M.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(i,r)=>i.ref(r),validate(i,{schema:r,state:t,prefs:c}){l(r.$_terms.link,"Uninitialized link schema");const s=a.generate(r,i,t,c),o=r.$_terms.link[0].ref;return s.$_validate(i,t.nest(s,`link:${o.display}:${s.type}`),c)},generate:(i,r,t,c)=>a.generate(i,r,t,c),rules:{ref:{method(i){l(!this.$_terms.link,"Cannot reinitialize schema"),i=m.ref(i),l(i.type==="value"||i.type==="local","Invalid reference type:",i.type),l(i.type==="local"||i.ancestor==="root"||i.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:i}],r}},relative:{method(i=!0){return this.$_setFlag("relative",i)}}},overrides:{concat(i){l(this.$_terms.link,"Uninitialized link schema"),l(v.isSchema(i),"Invalid schema object"),l(i.type!=="link","Cannot merge type link with another link");const r=this.clone();return r.$_terms.whens||(r.$_terms.whens=[]),r.$_terms.whens.push({concat:i}),r.$_mutateRebuild()}},manifest:{build:(i,r)=>(l(r.link,"Invalid link description missing link"),i.ref(r.link))}}),a.generate=function(i,r,t,c){let s=t.mainstay.links.get(i);if(s)return s._generate(r,t,c).schema;const o=i.$_terms.link[0].ref,{perspective:h,path:g}=a.perspective(o,t);a.assert(h,"which is outside of schema boundaries",o,i,t,c);try{s=g.length?h.$_reach(g):h}catch{a.assert(!1,"to non-existing schema",o,i,t,c)}return a.assert(s.type!=="link","which is another link",o,i,t,c),i._flags.relative||t.mainstay.links.set(i,s),s._generate(r,t,c).schema},a.perspective=function(i,r){if(i.type==="local"){for(const{schema:t,key:c}of r.schemas){if((t._flags.id||c)===i.path[0])return{perspective:t,path:i.path.slice(1)};if(t.$_terms.shared){for(const s of t.$_terms.shared)if(s._flags.id===i.path[0])return{perspective:s,path:i.path.slice(1)}}}return{perspective:null,path:null}}return i.ancestor==="root"?{perspective:r.schemas[r.schemas.length-1].schema,path:i.path}:{perspective:r.schemas[i.ancestor]&&r.schemas[i.ancestor].schema,path:i.path}},a.assert=function(i,r,t,c,s,o){i||l(!1,`"${e.label(c._flags,s,o)}" contains link reference "${t.display}" ${r}`)}},3832:(q,p,b)=>{const l=b(375),M=b(8068),v=b(8160),m={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const a=e.toString(),i=a.indexOf("."),r=a.indexOf("e");return(i<0?0:(r<0?a.length:r)-i-1)+(r<0?0:Math.max(0,-parseInt(a.slice(r+1))))}};q.exports=M.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:a,error:i}){if(!e.match(m.numberRx))return;e=e.trim();const r={value:parseFloat(e)};if(r.value===0&&(r.value=0),!a._flags.unsafe)if(e.match(/e/i)){if(m.extractSignificantDigits(e)!==m.extractSignificantDigits(String(r.value)))return r.errors=i("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==m.normalizeDecimal(e))return r.errors=i("number.unsafe"),r}return r}},validate(e,{schema:a,error:i,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:i("number.infinity")};if(!v.isNumber(e))return{value:e,errors:i("number.base")};const t={value:e};if(r.convert){const c=a.$_getRule("precision");if(c){const s=Math.pow(10,c.args.limit);t.value=Math.round(t.value*s)/s}}return t.value===0&&(t.value=0),!a._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(t.errors=i("number.unsafe")),t},rules:{compare:{method:!1,validate:(e,a,{limit:i},{name:r,operator:t,args:c})=>v.compare(e,i,t)?e:a.error("number."+r,{limit:c.limit,value:e}),args:[{name:"limit",ref:!0,assert:v.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,a)=>Math.trunc(e)-e==0?e:a.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const a=typeof e=="number"?m.decimalPlaces(e):null,i=Math.pow(10,a);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:a,pfactor:i}})},validate:(e,a,{base:i,baseDecimalPlace:r,pfactor:t},c)=>m.decimalPlaces(e)>r?a.error("number.multiple",{multiple:c.args.base,value:e}):Math.round(t*e)%Math.round(t*i)==0?e:a.error("number.multiple",{multiple:c.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>typeof e=="number"&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,a)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:a.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return l(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,a,{limit:i}){const r=e.toString().match(m.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=i?e:a.error("number.precision",{limit:i,value:e})},convert:!0},sign:{method(e){return l(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,a,{sign:i})=>i==="negative"&&e<0||i==="positive"&&e>0?e:a.error(`number.${i}`)},unsafe:{method(e=!0){return l(typeof e=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>typeof e=="number",to:(e,a)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),m.extractSignificantDigits=function(e){return e.replace(m.exponentialPartRegex,"").replace(m.dotRegex,"").replace(m.trailingZerosRegex,"").replace(m.leadingSignAndZerosRegex,"")},m.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),e==="-0"?"0":e}},8966:(q,p,b)=>{const l=b(7824);q.exports=l.extend({type:"object",cast:{map:{from:M=>M&&typeof M=="object",to:(M,v)=>new Map(Object.entries(M))}}})},7417:(q,p,b)=>{const l=b(375),M=b(5380),v=b(1745),m=b(9959),e=b(6064),a=b(9926),i=b(5752),r=b(8068),t=b(8160),c={tlds:a instanceof Set&&{tlds:{allow:a,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:m.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};q.exports=r.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(s,{schema:o,state:h,prefs:g}){const w=o.$_getRule("normalize");w&&(s=s.normalize(w.args.form));const R=o.$_getRule("case");R&&(s=R.args.direction==="upper"?s.toLocaleUpperCase():s.toLocaleLowerCase());const j=o.$_getRule("trim");if(j&&j.args.enabled&&(s=s.trim()),o.$_terms.replacements)for(const y of o.$_terms.replacements)s=s.replace(y.pattern,y.replacement);const f=o.$_getRule("hex");if(f&&f.args.options.byteAligned&&s.length%2!=0&&(s=`0${s}`),o.$_getRule("isoDate")){const y=c.isoDate(s);y&&(s=y)}if(o._flags.truncate){const y=o.$_getRule("max");if(y){let x=y.args.limit;if(t.isResolvable(x)&&(x=x.resolve(s,h,g),!t.limit(x)))return{value:s,errors:o.$_createError("any.ref",x,{ref:y.args.limit,arg:"limit",reason:"must be a positive integer"},h,g)};s=s.slice(0,x)}}return{value:s}}},validate(s,{schema:o,error:h}){if(typeof s!="string")return{value:s,errors:h("string.base")};if(s===""){const g=o.$_getRule("min");return g&&g.args.limit===0?void 0:{value:s,errors:h("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(s,o)=>/^[a-zA-Z0-9]+$/.test(s)?s:o.error("string.alphanum")},base64:{method(s={}){return t.assertOptions(s,["paddingRequired","urlSafe"]),s={urlSafe:!1,paddingRequired:!0,...s},l(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),l(typeof s.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:s}})},validate:(s,o,{options:h})=>c.base64Regex[h.paddingRequired][h.urlSafe].test(s)?s:o.error("string.base64")},case:{method(s){return l(["lower","upper"].includes(s),"Invalid case:",s),this.$_addRule({name:"case",args:{direction:s}})},validate:(s,o,{direction:h})=>h==="lower"&&s===s.toLocaleLowerCase()||h==="upper"&&s===s.toLocaleUpperCase()?s:o.error(`string.${h}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(s,o){let h=s.length,g=0,w=1;for(;h--;){const R=s.charAt(h)*w;g+=R-9*(R>9),w^=3}return g>0&&g%10==0?s:o.error("string.creditCard")}},dataUri:{method(s={}){return t.assertOptions(s,["paddingRequired"]),s={paddingRequired:!0,...s},l(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:s}})},validate(s,o,{options:h}){const g=s.match(c.dataUriRegex);return g&&(!g[2]||g[2]!=="base64"||c.base64Regex[h.paddingRequired].false.test(g[3]))?s:o.error("string.dataUri")}},domain:{method(s){s&&t.assertOptions(s,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const o=c.addressOptions(s);return this.$_addRule({name:"domain",args:{options:s},address:o})},validate:(s,o,h,{address:g})=>M.isValid(s,g)?s:o.error("string.domain")},email:{method(s={}){t.assertOptions(s,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),l(s.multiple===void 0||typeof s.multiple=="boolean","multiple option must be an boolean");const o=c.addressOptions(s),h=new RegExp(`\\s*[${s.separator?e(s.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:s},regex:h,address:o})},validate(s,o,{options:h},{regex:g,address:w}){const R=h.multiple?s.split(g):[s],j=[];for(const f of R)v.isValid(f,w)||j.push(f);return j.length?o.error("string.email",{value:s,invalids:j}):s}},guid:{alias:"uuid",method(s={}){t.assertOptions(s,["version","separator"]);let o="";if(s.version){const w=[].concat(s.version);l(w.length>=1,"version must have at least 1 valid version specified");const R=new Set;for(let j=0;j<w.length;++j){const f=w[j];l(typeof f=="string","version at position "+j+" must be a string");const y=c.guidVersions[f.toLowerCase()];l(y,"version at position "+j+" must be one of "+Object.keys(c.guidVersions).join(", ")),l(!R.has(y),"version at position "+j+" must not be a duplicate"),o+=y,R.add(y)}}l(c.guidSeparators.has(s.separator),'separator must be one of true, false, "-", or ":"');const h=s.separator===void 0?"[:-]?":s.separator===!0?"[:-]":s.separator===!1?"[]?":`\\${s.separator}`,g=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${h})[0-9A-F]{4}\\2?[${o||"0-9A-F"}][0-9A-F]{3}\\2?[${o?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:s},regex:g})},validate(s,o,h,{regex:g}){const w=g.exec(s);return w?c.guidBrackets[w[1]]!==w[w.length-1]?o.error("string.guid"):s:o.error("string.guid")}},hex:{method(s={}){return t.assertOptions(s,["byteAligned","prefix"]),s={byteAligned:!1,prefix:!1,...s},l(typeof s.byteAligned=="boolean","byteAligned must be boolean"),l(typeof s.prefix=="boolean"||s.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:s}})},validate:(s,o,{options:h})=>(h.prefix==="optional"?c.hexRegex.withOptionalPrefix:h.prefix===!0?c.hexRegex.withPrefix:c.hexRegex.withoutPrefix).test(s)?h.byteAligned&&s.length%2!=0?o.error("string.hexAlign"):s:o.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(s,o)=>M.isValid(s,{minDomainSegments:1})||c.ipRegex.test(s)?s:o.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(s={}){t.assertOptions(s,["cidr","version"]);const{cidr:o,versions:h,regex:g}=m.regex(s),w=s.version?h:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:o,version:w}},regex:g})},validate:(s,o,{options:h},{regex:g})=>g.test(s)?s:h.version?o.error("string.ipVersion",{value:s,cidr:h.cidr,version:h.version}):o.error("string.ip",{value:s,cidr:h.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(s,{error:o})=>c.isoDate(s)?s:o("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(s,o)=>c.isoDurationRegex.test(s)?s:o.error("string.isoDuration")},length:{method(s,o){return c.length(this,"length",s,"=",o)},validate(s,o,{limit:h,encoding:g},{name:w,operator:R,args:j}){const f=!g&&s.length;return t.compare(f,h,R)?s:o.error("string."+w,{limit:j.limit,value:s,encoding:g})},args:[{name:"limit",ref:!0,assert:t.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(s,o){return c.length(this,"max",s,"<=",o)},args:["limit","encoding"]},min:{method(s,o){return c.length(this,"min",s,">=",o)},args:["limit","encoding"]},normalize:{method(s="NFC"){return l(c.normalizationForms.includes(s),"normalization form must be one of "+c.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:s}})},validate:(s,{error:o},{form:h})=>s===s.normalize(h)?s:o("string.normalize",{value:s,form:h}),convert:!0},pattern:{alias:"regex",method(s,o={}){l(s instanceof RegExp,"regex must be a RegExp"),l(!s.flags.includes("g")&&!s.flags.includes("y"),"regex should not use global or sticky mode"),typeof o=="string"&&(o={name:o}),t.assertOptions(o,["invert","name"]);const h=["string.pattern",o.invert?".invert":"",o.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:s,options:o},errorCode:h})},validate:(s,o,{regex:h,options:g},{errorCode:w})=>h.test(s)^g.invert?s:o.error(w,{name:g.name,regex:h,value:s}),args:["regex","options"],multi:!0},replace:{method(s,o){typeof s=="string"&&(s=new RegExp(e(s),"g")),l(s instanceof RegExp,"pattern must be a RegExp"),l(typeof o=="string","replacement must be a String");const h=this.clone();return h.$_terms.replacements||(h.$_terms.replacements=[]),h.$_terms.replacements.push({pattern:s,replacement:o}),h}},token:{method(){return this.$_addRule("token")},validate:(s,o)=>/^\w+$/.test(s)?s:o.error("string.token")},trim:{method(s=!0){return l(typeof s=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:s}})},validate:(s,o,{enabled:h})=>h&&s!==s.trim()?o.error("string.trim"):s,convert:!0},truncate:{method(s=!0){return l(typeof s=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",s)}},uppercase:{method(){return this.case("upper")}},uri:{method(s={}){t.assertOptions(s,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),s.domain&&t.assertOptions(s.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:o,scheme:h}=i.regex(s),g=s.domain?c.addressOptions(s.domain):null;return this.$_addRule({name:"uri",args:{options:s},regex:o,domain:g,scheme:h})},validate(s,o,{options:h},{regex:g,domain:w,scheme:R}){if(["http:/","https:/"].includes(s))return o.error("string.uri");let j=g.exec(s);if(!j&&o.prefs.convert&&h.encodeUri){const f=encodeURI(s);j=g.exec(f),j&&(s=f)}if(j){const f=j[1]||j[2];return!w||h.allowRelative&&!f||M.isValid(f,w)?s:o.error("string.domain",{value:f})}return h.relativeOnly?o.error("string.uriRelativeOnly"):h.scheme?o.error("string.uriCustomScheme",{scheme:R,value:s}):o.error("string.uri")}}},manifest:{build(s,o){if(o.replacements)for(const{pattern:h,replacement:g}of o.replacements)s=s.replace(h,g);return s}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),c.addressOptions=function(s){if(!s)return c.tlds||s;if(l(s.minDomainSegments===void 0||Number.isSafeInteger(s.minDomainSegments)&&s.minDomainSegments>0,"minDomainSegments must be a positive integer"),l(s.maxDomainSegments===void 0||Number.isSafeInteger(s.maxDomainSegments)&&s.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),s.tlds===!1)return s;if(s.tlds===!0||s.tlds===void 0)return l(c.tlds,"Built-in TLD list disabled"),Object.assign({},s,c.tlds);l(typeof s.tlds=="object","tlds must be true, false, or an object");const o=s.tlds.deny;if(o)return Array.isArray(o)&&(s=Object.assign({},s,{tlds:{deny:new Set(o)}})),l(s.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),l(!s.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),c.validateTlds(s.tlds.deny,"tlds.deny"),s;const h=s.tlds.allow;return h?h===!0?(l(c.tlds,"Built-in TLD list disabled"),Object.assign({},s,c.tlds)):(Array.isArray(h)&&(s=Object.assign({},s,{tlds:{allow:new Set(h)}})),l(s.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),c.validateTlds(s.tlds.allow,"tlds.allow"),s):s},c.validateTlds=function(s,o){for(const h of s)l(M.isValid(h,{minDomainSegments:1,maxDomainSegments:1}),`${o} must contain valid top level domain names`)},c.isoDate=function(s){if(!t.isIsoDate(s))return null;/.*T.*[+-]\d\d$/.test(s)&&(s+="00");const o=new Date(s);return isNaN(o.getTime())?null:o.toISOString()},c.length=function(s,o,h,g,w){return l(!w||!1,"Invalid encoding:",w),s.$_addRule({name:o,method:"length",args:{limit:h,encoding:w},operator:g})}},8826:(q,p,b)=>{const l=b(375),M=b(8068),v={};v.Map=class extends Map{slice(){return new v.Map(this)}},q.exports=M.extend({type:"symbol",terms:{map:{init:new v.Map}},coerce:{method(m,{schema:e,error:a}){const i=e.$_terms.map.get(m);return i&&(m=i),e._flags.only&&typeof m!="symbol"?{value:m,errors:a("symbol.map",{map:e.$_terms.map})}:{value:m}}},validate(m,{error:e}){if(typeof m!="symbol")return{value:m,errors:e("symbol.base")}},rules:{map:{method(m){m&&!m[Symbol.iterator]&&typeof m=="object"&&(m=Object.entries(m)),l(m&&m[Symbol.iterator],"Iterable must be an iterable or object");const e=this.clone(),a=[];for(const i of m){l(i&&i[Symbol.iterator],"Entry must be an iterable");const[r,t]=i;l(typeof r!="object"&&typeof r!="function"&&typeof r!="symbol","Key must not be of type object, function, or Symbol"),l(typeof t=="symbol","Value must be a Symbol"),e.$_terms.map.set(r,t),a.push(t)}return e.valid(...a)}}},manifest:{build:(m,e)=>(e.map&&(m=m.map(e.map)),m)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(q,p,b)=>{const l=b(375),M=b(8571),v=b(738),m=b(9621),e=b(8160),a=b(6354),i=b(493),r={result:Symbol("result")};p.entry=function(t,c,s){let o=e.defaults;s&&(l(s.warnings===void 0,"Cannot override warnings preference in synchronous validation"),l(s.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),o=e.preferences(e.defaults,s));const h=r.entry(t,c,o);l(!h.mainstay.externals.length,"Schema with external rules must use validateAsync()");const g={value:h.value};return h.error&&(g.error=h.error),h.mainstay.warnings.length&&(g.warning=a.details(h.mainstay.warnings)),h.mainstay.debug&&(g.debug=h.mainstay.debug),h.mainstay.artifacts&&(g.artifacts=h.mainstay.artifacts),g},p.entryAsync=async function(t,c,s){let o=e.defaults;s&&(o=e.preferences(e.defaults,s));const h=r.entry(t,c,o),g=h.mainstay;if(h.error)throw g.debug&&(h.error.debug=g.debug),h.error;if(g.externals.length){let R=h.value;const j=[];for(const f of g.externals){const y=f.state.path,x=f.schema.type==="link"?g.links.get(f.schema):null;let C,N,$=R;const n=y.length?[R]:[],d=y.length?m(t,y):t;if(y.length){C=y[y.length-1];let _=R;for(const S of y.slice(0,-1))_=_[S],n.unshift(_);N=n[0],$=N[C]}try{const _=(O,E)=>(x||f.schema).$_createError(O,$,E,f.state,o),S=await f.method($,{schema:f.schema,linked:x,state:f.state,prefs:s,original:d,error:_,errorsArray:r.errorsArray,warn:(O,E)=>g.warnings.push((x||f.schema).$_createError(O,$,E,f.state,o)),message:(O,E)=>(x||f.schema).$_createError("external",$,E,f.state,o,{messages:O})});if(S===void 0||S===$)continue;if(S instanceof a.Report){if(g.tracer.log(f.schema,f.state,"rule","external","error"),j.push(S),o.abortEarly)break;continue}if(Array.isArray(S)&&S[e.symbols.errors]){if(g.tracer.log(f.schema,f.state,"rule","external","error"),j.push(...S),o.abortEarly)break;continue}N?(g.tracer.value(f.state,"rule",$,S,"external"),N[C]=S):(g.tracer.value(f.state,"rule",R,S,"external"),R=S)}catch(_){throw o.errors.label&&(_.message+=` (${f.label})`),_}}if(h.value=R,j.length)throw h.error=a.process(j,t,o),g.debug&&(h.error.debug=g.debug),h.error}if(!o.warnings&&!o.debug&&!o.artifacts)return h.value;const w={value:h.value};return g.warnings.length&&(w.warning=a.details(g.warnings)),g.debug&&(w.debug=g.debug),g.artifacts&&(w.artifacts=g.artifacts),w},r.Mainstay=class{constructor(t,c,s){this.externals=[],this.warnings=[],this.tracer=t,this.debug=c,this.links=s,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const t=this._snapshots.pop();this.externals=t.externals,this.warnings=t.warnings}commit(){this._snapshots.pop()}},r.entry=function(t,c,s){const{tracer:o,cleanup:h}=r.tracer(c,s),g=s.debug?[]:null,w=c._ids._schemaChain?new Map:null,R=new r.Mainstay(o,g,w),j=c._ids._schemaChain?[{schema:c}]:null,f=new i([],[],{mainstay:R,schemas:j}),y=p.validate(t,c,f,s);h&&c.$_root.untrace();const x=a.process(y.errors,t,s);return{value:y.value,error:x,mainstay:R}},r.tracer=function(t,c){return t.$_root._tracer?{tracer:t.$_root._tracer._register(t)}:c.debug?(l(t.$_root.trace,"Debug mode not supported"),{tracer:t.$_root.trace()._register(t),cleanup:!0}):{tracer:r.ignore}},p.validate=function(t,c,s,o,h={}){if(c.$_terms.whens&&(c=c._generate(t,s,o).schema),c._preferences&&(o=r.prefs(c,o)),c._cache&&o.cache){const x=c._cache.get(t);if(s.mainstay.tracer.debug(s,"validate","cached",!!x),x)return x}const g=(x,C,N)=>c.$_createError(x,t,C,N||s,o),w={original:t,prefs:o,schema:c,state:s,error:g,errorsArray:r.errorsArray,warn:(x,C,N)=>s.mainstay.warnings.push(g(x,C,N)),message:(x,C)=>c.$_createError("custom",t,C,s,o,{messages:x})};s.mainstay.tracer.entry(c,s);const R=c._definition;if(R.prepare&&t!==void 0&&o.convert){const x=R.prepare(t,w);if(x){if(s.mainstay.tracer.value(s,"prepare",t,x.value),x.errors)return r.finalize(x.value,[].concat(x.errors),w);t=x.value}}if(R.coerce&&t!==void 0&&o.convert&&(!R.coerce.from||R.coerce.from.includes(typeof t))){const x=R.coerce.method(t,w);if(x){if(s.mainstay.tracer.value(s,"coerced",t,x.value),x.errors)return r.finalize(x.value,[].concat(x.errors),w);t=x.value}}const j=c._flags.empty;j&&j.$_match(r.trim(t,c),s.nest(j),e.defaults)&&(s.mainstay.tracer.value(s,"empty",t,void 0),t=void 0);const f=h.presence||c._flags.presence||(c._flags._endedSwitch?null:o.presence);if(t===void 0){if(f==="forbidden")return r.finalize(t,null,w);if(f==="required")return r.finalize(t,[c.$_createError("any.required",t,null,s,o)],w);if(f==="optional"){if(c._flags.default!==e.symbols.deepDefault)return r.finalize(t,null,w);s.mainstay.tracer.value(s,"default",t,{}),t={}}}else if(f==="forbidden")return r.finalize(t,[c.$_createError("any.unknown",t,null,s,o)],w);const y=[];if(c._valids){const x=c._valids.get(t,s,o,c._flags.insensitive);if(x)return o.convert&&(s.mainstay.tracer.value(s,"valids",t,x.value),t=x.value),s.mainstay.tracer.filter(c,s,"valid",x),r.finalize(t,null,w);if(c._flags.only){const C=c.$_createError("any.only",t,{valids:c._valids.values({display:!0})},s,o);if(o.abortEarly)return r.finalize(t,[C],w);y.push(C)}}if(c._invalids){const x=c._invalids.get(t,s,o,c._flags.insensitive);if(x){s.mainstay.tracer.filter(c,s,"invalid",x);const C=c.$_createError("any.invalid",t,{invalids:c._invalids.values({display:!0})},s,o);if(o.abortEarly)return r.finalize(t,[C],w);y.push(C)}}if(R.validate){const x=R.validate(t,w);if(x&&(s.mainstay.tracer.value(s,"base",t,x.value),t=x.value,x.errors)){if(!Array.isArray(x.errors))return y.push(x.errors),r.finalize(t,y,w);if(x.errors.length)return y.push(...x.errors),r.finalize(t,y,w)}}return c._rules.length?r.rules(t,y,w):r.finalize(t,y,w)},r.rules=function(t,c,s){const{schema:o,state:h,prefs:g}=s;for(const w of o._rules){const R=o._definition.rules[w.method];if(R.convert&&g.convert){h.mainstay.tracer.log(o,h,"rule",w.name,"full");continue}let j,f=w.args;if(w._resolve.length){f=Object.assign({},f);for(const x of w._resolve){const C=R.argsByName.get(x),N=f[x].resolve(t,h,g),$=C.normalize?C.normalize(N):N,n=e.validateArg($,null,C);if(n){j=o.$_createError("any.ref",N,{arg:x,ref:f[x],reason:n},h,g);break}f[x]=$}}j=j||R.validate(t,s,f,w);const y=r.rule(j,w);if(y.errors){if(h.mainstay.tracer.log(o,h,"rule",w.name,"error"),w.warn){h.mainstay.warnings.push(...y.errors);continue}if(g.abortEarly)return r.finalize(t,y.errors,s);c.push(...y.errors)}else h.mainstay.tracer.log(o,h,"rule",w.name,"pass"),h.mainstay.tracer.value(h,"rule",t,y.value,w.name),t=y.value}return r.finalize(t,c,s)},r.rule=function(t,c){return t instanceof a.Report?(r.error(t,c),{errors:[t],value:null}):Array.isArray(t)&&t[e.symbols.errors]?(t.forEach(s=>r.error(s,c)),{errors:t,value:null}):{errors:null,value:t}},r.error=function(t,c){return c.message&&t._setTemplate(c.message),t},r.finalize=function(t,c,s){c=c||[];const{schema:o,state:h,prefs:g}=s;if(c.length){const R=r.default("failover",void 0,c,s);R!==void 0&&(h.mainstay.tracer.value(h,"failover",t,R),t=R,c=[])}if(c.length&&o._flags.error)if(typeof o._flags.error=="function"){c=o._flags.error(c),Array.isArray(c)||(c=[c]);for(const R of c)l(R instanceof Error||R instanceof a.Report,"error() must return an Error object")}else c=[o._flags.error];if(t===void 0){const R=r.default("default",t,c,s);h.mainstay.tracer.value(h,"default",t,R),t=R}if(o._flags.cast&&t!==void 0){const R=o._definition.cast[o._flags.cast];if(R.from(t)){const j=R.to(t,s);h.mainstay.tracer.value(h,"cast",t,j,o._flags.cast),t=j}}if(o.$_terms.externals&&g.externals&&g._externals!==!1)for(const{method:R}of o.$_terms.externals)h.mainstay.externals.push({method:R,schema:o,state:h,label:a.label(o._flags,h,g)});const w={value:t,errors:c.length?c:null};return o._flags.result&&(w.value=o._flags.result==="strip"?void 0:s.original,h.mainstay.tracer.value(h,o._flags.result,t,w.value),h.shadow(t,o._flags.result)),o._cache&&g.cache!==!1&&!o._refs.length&&o._cache.set(s.original,w),t===void 0||w.errors||o._flags.artifact===void 0||(h.mainstay.artifacts=h.mainstay.artifacts||new Map,h.mainstay.artifacts.has(o._flags.artifact)||h.mainstay.artifacts.set(o._flags.artifact,[]),h.mainstay.artifacts.get(o._flags.artifact).push(h.path)),w},r.prefs=function(t,c){const s=c===e.defaults;return s&&t._preferences[e.symbols.prefs]?t._preferences[e.symbols.prefs]:(c=e.preferences(c,t._preferences),s&&(t._preferences[e.symbols.prefs]=c),c)},r.default=function(t,c,s,o){const{schema:h,state:g,prefs:w}=o,R=h._flags[t];if(w.noDefaults||R===void 0)return c;if(g.mainstay.tracer.log(h,g,"rule",t,"full"),!R)return R;if(typeof R=="function"){const j=R.length?[M(g.ancestors[0]),o]:[];try{return R(...j)}catch(f){return void s.push(h.$_createError(`any.${t}`,null,{error:f},g,w))}}return typeof R!="object"?R:R[e.symbols.literal]?R.literal:e.isResolvable(R)?R.resolve(c,g,w):M(R)},r.trim=function(t,c){if(typeof t!="string")return t;const s=c.$_getRule("trim");return s&&s.args.enabled?t.trim():t},r.ignore={active:!1,debug:v,entry:v,filter:v,log:v,resolve:v,value:v},r.errorsArray=function(){const t=[];return t[e.symbols.errors]=!0,t}},2036:(q,p,b)=>{const l=b(375),M=b(9474),v=b(8160),m={};q.exports=m.Values=class{constructor(e,a){this._values=new Set(e),this._refs=new Set(a),this._lowercase=m.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,a){v.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),a&&a.register(e)):this.has(e,null,null,!1)||(this._values.add(e),typeof e=="string"&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,a,i){if(e=e||new m.Values,a){if(a._override)return a.clone();for(const r of[...a._values,...a._refs])e.add(r)}if(i)for(const r of[...i._values,...i._refs])e.remove(r);return e.length?e:null}remove(e){v.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),typeof e=="string"&&this._lowercase.delete(e.toLowerCase()))}has(e,a,i,r){return!!this.get(e,a,i,r)}get(e,a,i,r){if(!this.length)return!1;if(this._values.has(e))return{value:e};if(typeof e=="string"&&e&&r){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&typeof e!="object")return!1;if(typeof e=="object"){for(const t of this._values)if(M(t,e))return{value:t}}if(a)for(const t of this._refs){const c=t.resolve(e,a,i,null,{in:!0});if(c===void 0)continue;const s=t.in&&typeof c=="object"?Array.isArray(c)?c:Object.keys(c):[c];for(const o of s)if(typeof o==typeof e){if(r&&e&&typeof e=="string"){if(o.toLowerCase()===e.toLowerCase())return{value:o,ref:t}}else if(M(o,e))return{value:o,ref:t}}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const a=[];for(const i of[...this._values,...this._refs])i!==void 0&&a.push(i);return a}return Array.from([...this._values,...this._refs])}clone(){const e=new m.Values(this._values,this._refs);return e._override=this._override,e}concat(e){l(!e._override,"Cannot concat override set of values");const a=new m.Values([...this._values,...e._values],[...this._refs,...e._refs]);return a._override=this._override,a}describe(){const e=[];this._override&&e.push({override:!0});for(const a of this._values.values())e.push(a&&typeof a=="object"?{value:a}:a);for(const a of this._refs.values())e.push(a.describe());return e}},m.Values.prototype[v.symbols.values]=!0,m.Values.prototype.slice=m.Values.prototype.clone,m.lowercases=function(e){const a=new Map;if(e)for(const i of e)typeof i=="string"&&a.set(i.toLowerCase(),i);return a}},978:(q,p,b)=>{const l=b(375),M=b(8571),v=b(1687),m=b(9621),e={};q.exports=function(a,i,r={}){if(l(a&&typeof a=="object","Invalid defaults value: must be an object"),l(!i||i===!0||typeof i=="object","Invalid source value: must be true, falsy or an object"),l(typeof r=="object","Invalid options: must be an object"),!i)return null;if(r.shallow)return e.applyToDefaultsWithShallow(a,i,r);const t=M(a);if(i===!0)return t;const c=r.nullOverride!==void 0&&r.nullOverride;return v(t,i,{nullOverride:c,mergeArrays:!1})},e.applyToDefaultsWithShallow=function(a,i,r){const t=r.shallow;l(Array.isArray(t),"Invalid keys");const c=new Map,s=i===!0?null:new Set;for(let g of t){g=Array.isArray(g)?g:g.split(".");const w=m(a,g);w&&typeof w=="object"?c.set(w,s&&m(i,g)||w):s&&s.add(g)}const o=M(a,{},c);if(!s)return o;for(const g of s)e.reachCopy(o,i,g);const h=r.nullOverride!==void 0&&r.nullOverride;return v(o,i,{nullOverride:h,mergeArrays:!1})},e.reachCopy=function(a,i,r){for(const s of r){if(!(s in i))return;const o=i[s];if(typeof o!="object"||o===null)return;i=o}const t=i;let c=a;for(let s=0;s<r.length-1;++s){const o=r[s];typeof c[o]!="object"&&(c[o]={}),c=c[o]}c[r[r.length-1]]=t}},375:(q,p,b)=>{const l=b(7916);q.exports=function(M,...v){if(!M)throw v.length===1&&v[0]instanceof Error?v[0]:new l(v)}},8571:(q,p,b)=>{const l=b(9621),M=b(4277),v=b(7043),m={needsProtoHack:new Set([M.set,M.map,M.weakSet,M.weakMap])};q.exports=m.clone=function(e,a={},i=null){if(typeof e!="object"||e===null)return e;let r=m.clone,t=i;if(a.shallow){if(a.shallow!==!0)return m.cloneWithShallow(e,a);r=h=>h}else if(t){const h=t.get(e);if(h)return h}else t=new Map;const c=M.getInternalProto(e);if(c===M.buffer)return!1;if(c===M.date)return new Date(e.getTime());if(c===M.regex)return new RegExp(e);const s=m.base(e,c,a);if(s===e)return e;if(t&&t.set(e,s),c===M.set)for(const h of e)s.add(r(h,a,t));else if(c===M.map)for(const[h,g]of e)s.set(h,r(g,a,t));const o=v.keys(e,a);for(const h of o){if(h==="__proto__")continue;if(c===M.array&&h==="length"){s.length=e.length;continue}const g=Object.getOwnPropertyDescriptor(e,h);g?g.get||g.set?Object.defineProperty(s,h,g):g.enumerable?s[h]=r(e[h],a,t):Object.defineProperty(s,h,{enumerable:!1,writable:!0,configurable:!0,value:r(e[h],a,t)}):Object.defineProperty(s,h,{enumerable:!0,writable:!0,configurable:!0,value:r(e[h],a,t)})}return s},m.cloneWithShallow=function(e,a){const i=a.shallow;(a=Object.assign({},a)).shallow=!1;const r=new Map;for(const t of i){const c=l(e,t);typeof c!="object"&&typeof c!="function"||r.set(c,c)}return m.clone(e,a,r)},m.base=function(e,a,i){if(i.prototype===!1)return m.needsProtoHack.has(a)?new a.constructor:a===M.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(a===M.array){const t=[];return r!==a&&Object.setPrototypeOf(t,r),t}if(m.needsProtoHack.has(a)){const t=new r.constructor;return r!==a&&Object.setPrototypeOf(t,r),t}return Object.create(r)}},9474:(q,p,b)=>{const l=b(4277),M={mismatched:null};q.exports=function(v,m,e){return e=Object.assign({prototype:!0},e),!!M.isDeepEqual(v,m,e,[])},M.isDeepEqual=function(v,m,e,a){if(v===m)return v!==0||1/v==1/m;const i=typeof v;if(i!==typeof m||v===null||m===null)return!1;if(i==="function"){if(!e.deepFunction||v.toString()!==m.toString())return!1}else if(i!=="object")return v!=v&&m!=m;const r=M.getSharedType(v,m,!!e.prototype);switch(r){case l.buffer:return!1;case l.promise:return v===m;case l.regex:return v.toString()===m.toString();case M.mismatched:return!1}for(let t=a.length-1;t>=0;--t)if(a[t].isSame(v,m))return!0;a.push(new M.SeenEntry(v,m));try{return!!M.isDeepEqualObj(r,v,m,e,a)}finally{a.pop()}},M.getSharedType=function(v,m,e){if(e)return Object.getPrototypeOf(v)!==Object.getPrototypeOf(m)?M.mismatched:l.getInternalProto(v);const a=l.getInternalProto(v);return a!==l.getInternalProto(m)?M.mismatched:a},M.valueOf=function(v){const m=v.valueOf;if(m===void 0)return v;try{return m.call(v)}catch(e){return e}},M.hasOwnEnumerableProperty=function(v,m){return Object.prototype.propertyIsEnumerable.call(v,m)},M.isSetSimpleEqual=function(v,m){for(const e of Set.prototype.values.call(v))if(!Set.prototype.has.call(m,e))return!1;return!0},M.isDeepEqualObj=function(v,m,e,a,i){const{isDeepEqual:r,valueOf:t,hasOwnEnumerableProperty:c}=M,{keys:s,getOwnPropertySymbols:o}=Object;if(v===l.array){if(!a.part){if(m.length!==e.length)return!1;for(let j=0;j<m.length;++j)if(!r(m[j],e[j],a,i))return!1;return!0}for(const j of m)for(const f of e)if(r(j,f,a,i))return!0}else if(v===l.set){if(m.size!==e.size)return!1;if(!M.isSetSimpleEqual(m,e)){const j=new Set(Set.prototype.values.call(e));for(const f of Set.prototype.values.call(m)){if(j.delete(f))continue;let y=!1;for(const x of j)if(r(f,x,a,i)){j.delete(x),y=!0;break}if(!y)return!1}}}else if(v===l.map){if(m.size!==e.size)return!1;for(const[j,f]of Map.prototype.entries.call(m))if(f===void 0&&!Map.prototype.has.call(e,j)||!r(f,Map.prototype.get.call(e,j),a,i))return!1}else if(v===l.error&&(m.name!==e.name||m.message!==e.message))return!1;const h=t(m),g=t(e);if((m!==h||e!==g)&&!r(h,g,a,i))return!1;const w=s(m);if(!a.part&&w.length!==s(e).length&&!a.skip)return!1;let R=0;for(const j of w)if(a.skip&&a.skip.includes(j))e[j]===void 0&&++R;else if(!c(e,j)||!r(m[j],e[j],a,i))return!1;if(!a.part&&w.length-R!==s(e).length)return!1;if(a.symbols!==!1){const j=o(m),f=new Set(o(e));for(const y of j){if(!a.skip||!a.skip.includes(y)){if(c(m,y)){if(!c(e,y)||!r(m[y],e[y],a,i))return!1}else if(c(e,y))return!1}f.delete(y)}for(const y of f)if(c(e,y))return!1}return!0},M.SeenEntry=class{constructor(v,m){this.obj=v,this.ref=m}isSame(v,m){return this.obj===v&&this.ref===m}}},7916:(q,p,b)=>{const l=b(8761);q.exports=class extends Error{constructor(M){super(M.filter(v=>v!=="").map(v=>typeof v=="string"?v:v instanceof Error?v.message:l(v)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,p.assert)}}},5277:q=>{const p={};q.exports=function(b){if(!b)return"";let l="";for(let M=0;M<b.length;++M){const v=b.charCodeAt(M);p.isSafe(v)?l+=b[M]:l+=p.escapeHtmlChar(v)}return l},p.escapeHtmlChar=function(b){return p.namedHtml.get(b)||(b>=256?"&#"+b+";":`&#x${b.toString(16).padStart(2,"0")};`)},p.isSafe=function(b){return p.safeCharCodes.has(b)},p.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),p.safeCharCodes=function(){const b=new Set;for(let l=32;l<123;++l)(l>=97||l>=65&&l<=90||l>=48&&l<=57||l===32||l===46||l===44||l===45||l===58||l===95)&&b.add(l);return b}()},6064:q=>{q.exports=function(p){return p.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:q=>{q.exports=function(){}},1687:(q,p,b)=>{const l=b(375),M=b(8571),v=b(7043),m={};q.exports=m.merge=function(e,a,i){if(l(e&&typeof e=="object","Invalid target value: must be an object"),l(a==null||typeof a=="object","Invalid source value: must be null, undefined, or an object"),!a)return e;if(i=Object.assign({nullOverride:!0,mergeArrays:!0},i),Array.isArray(a)){l(Array.isArray(e),"Cannot merge array onto an object"),i.mergeArrays||(e.length=0);for(let t=0;t<a.length;++t)e.push(M(a[t],{symbols:i.symbols}));return e}const r=v.keys(a,i);for(let t=0;t<r.length;++t){const c=r[t];if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,c))continue;const s=a[c];if(s&&typeof s=="object"){if(e[c]===s)continue;!e[c]||typeof e[c]!="object"||Array.isArray(e[c])!==Array.isArray(s)||s instanceof Date||s instanceof RegExp?e[c]=M(s,{symbols:i.symbols}):m.merge(e[c],s,i)}else(s!=null||i.nullOverride)&&(e[c]=s)}return e}},9621:(q,p,b)=>{const l=b(375),M={};q.exports=function(v,m,e){if(m===!1||m==null)return v;typeof(e=e||{})=="string"&&(e={separator:e});const a=Array.isArray(m);l(!a||!e.separator,"Separator option is not valid for array-based chain");const i=a?m:m.split(e.separator||".");let r=v;for(let t=0;t<i.length;++t){let c=i[t];const s=e.iterables&&M.iterables(r);if(Array.isArray(r)||s==="set"){const o=Number(c);Number.isInteger(o)&&(c=o<0?r.length+o:o)}if(!r||typeof r=="function"&&e.functions===!1||!s&&r[c]===void 0){l(!e.strict||t+1===i.length,"Missing segment",c,"in reach path ",m),l(typeof r=="object"||e.functions===!0||typeof r!="function","Invalid segment",c,"in reach path ",m),r=e.default;break}r=s?s==="set"?[...r][c]:r.get(c):r[c]}return r},M.iterables=function(v){return v instanceof Set?"set":v instanceof Map?"map":void 0}},8761:q=>{q.exports=function(...p){try{return JSON.stringify(...p)}catch(b){return"[Cannot display object: "+b.message+"]"}}},4277:(q,p)=>{const b={};p=q.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},b.typeMap=new Map([["[object Error]",p.error],["[object Map]",p.map],["[object Promise]",p.promise],["[object Set]",p.set],["[object WeakMap]",p.weakMap],["[object WeakSet]",p.weakSet]]),p.getInternalProto=function(l){if(Array.isArray(l))return p.array;if(l instanceof Date)return p.date;if(l instanceof RegExp)return p.regex;if(l instanceof Error)return p.error;const M=Object.prototype.toString.call(l);return b.typeMap.get(M)||p.generic}},7043:(q,p)=>{p.keys=function(b,l={}){return l.symbols!==!1?Reflect.ownKeys(b):Object.getOwnPropertyNames(b)}},3652:(q,p,b)=>{const l=b(375),M={};p.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(v,m){const e=[].concat((m=m||{}).before||[]),a=[].concat(m.after||[]),i=m.group||"?",r=m.sort||0;l(!e.includes(i),`Item cannot come before itself: ${i}`),l(!e.includes("?"),"Item cannot come before unassociated items"),l(!a.includes(i),`Item cannot come after itself: ${i}`),l(!a.includes("?"),"Item cannot come after unassociated items"),Array.isArray(v)||(v=[v]);for(const t of v){const c={seq:this._items.length,sort:r,before:e,after:a,group:i,node:t};this._items.push(c)}if(!m.manual){const t=this._sort();l(t,"item",i!=="?"?`added into group ${i}`:"","created a dependencies error")}return this.nodes}merge(v){Array.isArray(v)||(v=[v]);for(const e of v)if(e)for(const a of e._items)this._items.push(Object.assign({},a));this._items.sort(M.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const m=this._sort();return l(m,"merge created a dependencies error"),this.nodes}sort(){const v=this._sort();return l(v,"sort created a dependencies error"),this.nodes}_sort(){const v={},m=Object.create(null),e=Object.create(null);for(const c of this._items){const s=c.seq,o=c.group;e[o]=e[o]||[],e[o].push(s),v[s]=c.before;for(const h of c.after)m[h]=m[h]||[],m[h].push(s)}for(const c in v){const s=[];for(const o in v[c]){const h=v[c][o];e[h]=e[h]||[],s.push(...e[h])}v[c]=s}for(const c in m)if(e[c])for(const s of e[c])v[s].push(...m[c]);const a={};for(const c in v){const s=v[c];for(const o of s)a[o]=a[o]||[],a[o].push(c)}const i={},r=[];for(let c=0;c<this._items.length;++c){let s=c;if(a[c]){s=null;for(let o=0;o<this._items.length;++o){if(i[o]===!0)continue;a[o]||(a[o]=[]);const h=a[o].length;let g=0;for(let w=0;w<h;++w)i[a[o][w]]&&++g;if(g===h){s=o;break}}}s!==null&&(i[s]=!0,r.push(s))}if(r.length!==this._items.length)return!1;const t={};for(const c of this._items)t[c.seq]=c;this._items=[],this.nodes=[];for(const c of r){const s=t[c];this.nodes.push(s.node),this._items.push(s)}return!0}},M.mergeSort=(v,m)=>v.sort===m.sort?0:v.sort<m.sort?-1:1},5380:(q,p,b)=>{const l=b(443),M=b(2178),v={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:l.URL||URL};p.analyze=function(m,e={}){if(!m)return M.code("DOMAIN_NON_EMPTY_STRING");if(typeof m!="string")throw new Error("Invalid input: domain must be a string");if(m.length>256)return M.code("DOMAIN_TOO_LONG");if(v.nonAsciiRx.test(m)){if(e.allowUnicode===!1)return M.code("DOMAIN_INVALID_UNICODE_CHARS");m=m.normalize("NFC")}if(v.domainControlRx.test(m))return M.code("DOMAIN_INVALID_CHARS");m=v.punycode(m),e.allowFullyQualified&&m[m.length-1]==="."&&(m=m.slice(0,-1));const a=e.minDomainSegments||v.minDomainSegments,i=m.split(".");if(i.length<a)return M.code("DOMAIN_SEGMENTS_COUNT");if(e.maxDomainSegments&&i.length>e.maxDomainSegments)return M.code("DOMAIN_SEGMENTS_COUNT_MAX");const r=e.tlds;if(r){const t=i[i.length-1].toLowerCase();if(r.deny&&r.deny.has(t)||r.allow&&!r.allow.has(t))return M.code("DOMAIN_FORBIDDEN_TLDS")}for(let t=0;t<i.length;++t){const c=i[t];if(!c.length)return M.code("DOMAIN_EMPTY_SEGMENT");if(c.length>63)return M.code("DOMAIN_LONG_SEGMENT");if(t<i.length-1){if(!v.domainSegmentRx.test(c))return M.code("DOMAIN_INVALID_CHARS")}else if(!v.tldSegmentRx.test(c))return M.code("DOMAIN_INVALID_TLDS_CHARS")}return null},p.isValid=function(m,e){return!p.analyze(m,e)},v.punycode=function(m){m.includes("%")&&(m=m.replace(/%/g,"%25"));try{return new v.URL(`http://${m}`).host}catch{return m}}},1745:(q,p,b)=>{const l=b(9848),M=b(5380),v=b(2178),m={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(l.TextEncoder||TextEncoder)};p.analyze=function(e,a){return m.email(e,a)},p.isValid=function(e,a){return!m.email(e,a)},m.email=function(e,a={}){if(typeof e!="string")throw new Error("Invalid input: email must be a string");if(!e)return v.code("EMPTY_STRING");const i=!m.nonAsciiRx.test(e);if(!i){if(a.allowUnicode===!1)return v.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(r.length!==2)return r.length>2?v.code("MULTIPLE_AT_CHAR"):v.code("MISSING_AT_CHAR");const[t,c]=r;if(!t)return v.code("EMPTY_LOCAL");if(!a.ignoreLength){if(e.length>254)return v.code("ADDRESS_TOO_LONG");if(m.encoder.encode(t).length>64)return v.code("LOCAL_TOO_LONG")}return m.local(t,i)||M.analyze(c,a)},m.local=function(e,a){const i=e.split(".");for(const r of i){if(!r.length)return v.code("EMPTY_LOCAL_SEGMENT");if(a){if(!m.atextRx.test(r))return v.code("INVALID_LOCAL_CHARS")}else for(const t of r){if(m.atextRx.test(t))continue;const c=m.binary(t);if(!m.atomRx.test(c))return v.code("INVALID_LOCAL_CHARS")}}},m.binary=function(e){return Array.from(m.encoder.encode(e)).map(a=>String.fromCharCode(a)).join("")},m.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,m.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(q,p)=>{p.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},p.code=function(b){return{code:b,error:p.codes[b]}}},9959:(q,p,b)=>{const l=b(375),M=b(5752);p.regex=function(v={}){l(v.cidr===void 0||typeof v.cidr=="string","options.cidr must be a string");const m=v.cidr?v.cidr.toLowerCase():"optional";l(["required","optional","forbidden"].includes(m),"options.cidr must be one of required, optional, forbidden"),l(v.version===void 0||typeof v.version=="string"||Array.isArray(v.version),"options.version must be a string or an array of string");let e=v.version||["ipv4","ipv6","ipvfuture"];Array.isArray(e)||(e=[e]),l(e.length>=1,"options.version must have at least 1 version specified");for(let r=0;r<e.length;++r)l(typeof e[r]=="string","options.version must only contain strings"),e[r]=e[r].toLowerCase(),l(["ipv4","ipv6","ipvfuture"].includes(e[r]),"options.version contains unknown version "+e[r]+" - must be one of ipv4, ipv6, ipvfuture");e=Array.from(new Set(e));const a=`(?:${e.map(r=>{if(m==="forbidden")return M.ip[r];const t=`\\/${r==="ipv4"?M.ip.v4Cidr:M.ip.v6Cidr}`;return m==="required"?`${M.ip[r]}${t}`:`${M.ip[r]}(?:${t})?`}).join("|")})`,i=new RegExp(`^${a}$`);return{cidr:m,versions:e,regex:i,raw:a}}},5752:(q,p,b)=>{const l=b(375),M=b(6064),v={generate:function(){const m={},e="\\dA-Fa-f",a="["+e+"]",i="\\w-\\.~",r="!\\$&'\\(\\)\\*\\+,;=",t="%"+e,c=i+t+r+":@",s="["+c+"]",o="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";m.ipv4address="(?:"+o+"\\.){3}"+o;const h=a+"{1,4}",g="(?:"+h+":"+h+"|"+m.ipv4address+")",w="(?:"+h+":){6}"+g,R="::(?:"+h+":){5}"+g,j="(?:"+h+")?::(?:"+h+":){4}"+g,f="(?:(?:"+h+":){0,1}"+h+")?::(?:"+h+":){3}"+g,y="(?:(?:"+h+":){0,2}"+h+")?::(?:"+h+":){2}"+g,x="(?:(?:"+h+":){0,3}"+h+")?::"+h+":"+g,C="(?:(?:"+h+":){0,4}"+h+")?::"+g,N="(?:(?:"+h+":){0,5}"+h+")?::"+h,$="(?:(?:"+h+":){0,6}"+h+")?::";m.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",m.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",m.ipv6address="(?:"+w+"|"+R+"|"+j+"|"+f+"|"+y+"|"+x+"|"+C+"|"+N+"|"+$+")",m.ipvFuture="v"+a+"+\\.["+i+r+":]+",m.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",m.schemeRegex=new RegExp(m.scheme);const n="["+i+t+r+":]*",d="["+i+t+r+"]{1,255}",_="(?:\\[(?:"+m.ipv6address+"|"+m.ipvFuture+")\\]|"+m.ipv4address+"|"+d+")",S="(?:"+n+"@)?"+_+"(?::\\d*)?",O="(?:"+n+"@)?("+_+")(?::\\d*)?",E=s+"*",D=s+"+",k="(?:\\/"+E+")*",u="\\/(?:"+D+k+")?",A=D+k,z="["+i+t+r+"@]+"+k,F="(?:\\/\\/\\/"+E+k+")";return m.hierPart="(?:(?:\\/\\/"+S+k+")|"+u+"|"+A+"|"+F+")",m.hierPartCapture="(?:(?:\\/\\/"+O+k+")|"+u+"|"+A+")",m.relativeRef="(?:(?:\\/\\/"+S+k+")|"+u+"|"+z+"|)",m.relativeRefCapture="(?:(?:\\/\\/"+O+k+")|"+u+"|"+z+"|)",m.query="["+c+"\\/\\?]*(?=#|$)",m.queryWithSquareBrackets="["+c+"\\[\\]\\/\\?]*(?=#|$)",m.fragment="["+c+"\\/\\?]*",m}};v.rfc3986=v.generate(),p.ip={v4Cidr:v.rfc3986.ipv4Cidr,v6Cidr:v.rfc3986.ipv6Cidr,ipv4:v.rfc3986.ipv4address,ipv6:v.rfc3986.ipv6address,ipvfuture:v.rfc3986.ipvFuture},v.createRegex=function(m){const e=v.rfc3986,a="(?:\\?"+(m.allowQuerySquareBrackets?e.queryWithSquareBrackets:e.query)+")?(?:#"+e.fragment+")?",i=m.domain?e.relativeRefCapture:e.relativeRef;if(m.relativeOnly)return v.wrap(i+a);let r="";if(m.scheme){l(m.scheme instanceof RegExp||typeof m.scheme=="string"||Array.isArray(m.scheme),"scheme must be a RegExp, String, or Array");const s=[].concat(m.scheme);l(s.length>=1,"scheme must have at least 1 scheme specified");const o=[];for(let h=0;h<s.length;++h){const g=s[h];l(g instanceof RegExp||typeof g=="string","scheme at position "+h+" must be a RegExp or String"),g instanceof RegExp?o.push(g.source.toString()):(l(e.schemeRegex.test(g),"scheme at position "+h+" must be a valid scheme"),o.push(M(g)))}r=o.join("|")}const t="(?:"+(r?"(?:"+r+")":e.scheme)+":"+(m.domain?e.hierPartCapture:e.hierPart)+")",c=m.allowRelative?"(?:"+t+"|"+i+")":t;return v.wrap(c+a,r)},v.wrap=function(m,e){return{raw:m=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${m}`,regex:new RegExp(`^${m}$`),scheme:e}},v.uriRegex=v.createRegex({}),p.regex=function(m={}){return m.scheme||m.allowRelative||m.relativeOnly||m.allowQuerySquareBrackets||m.domain?v.createRegex(m):v.uriRegex}},1447:(q,p)=>{const b={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};p.Parser=class{constructor(l,M={}){if(!M[b.settings]&&M.constants)for(const v in M.constants){const m=M.constants[v];if(m!==null&&!["boolean","number","string"].includes(typeof m))throw new Error(`Formula constant ${v} contains invalid ${typeof m} value type`)}this.settings=M[b.settings]?M:Object.assign({[b.settings]:!0,constants:{},functions:{}},M),this.single=null,this._parts=null,this._parse(l)}_parse(l){let M=[],v="",m=0,e=!1;const a=r=>{if(m)throw new Error("Formula missing closing parenthesis");const t=M.length?M[M.length-1]:null;if(e||v||r){if(t&&t.type==="reference"&&r===")")return t.type="function",t.value=this._subFormula(v,t.value),void(v="");if(r===")"){const c=new p.Parser(v,this.settings);M.push({type:"segment",value:c})}else if(e){if(e==="]")return M.push({type:"reference",value:v}),void(v="");M.push({type:"literal",value:v})}else if(b.operatorCharacters.includes(v))t&&t.type==="operator"&&b.operators.includes(t.value+v)?t.value+=v:M.push({type:"operator",value:v});else if(v.match(b.numberRx))M.push({type:"constant",value:parseFloat(v)});else if(this.settings.constants[v]!==void 0)M.push({type:"constant",value:this.settings.constants[v]});else{if(!v.match(b.tokenRx))throw new Error(`Formula contains invalid token: ${v}`);M.push({type:"reference",value:v})}v=""}};for(const r of l)e?r===e?(a(),e=!1):v+=r:m?r==="("?(v+=r,++m):r===")"?(--m,m?v+=r:a(r)):v+=r:r in b.literals?e=b.literals[r]:r==="("?(a(),++m):b.operatorCharacters.includes(r)?(a(),v=r,a()):r!==" "?v+=r:a();a(),M=M.map((r,t)=>r.type!=="operator"||r.value!=="-"||t&&M[t-1].type!=="operator"?r:{type:"operator",value:"n"});let i=!1;for(const r of M){if(r.type==="operator"){if(b.operatorsPrefix.includes(r.value))continue;if(!i)throw new Error("Formula contains an operator in invalid position");if(!b.operators.includes(r.value))throw new Error(`Formula contains an unknown operator ${r.value}`)}else if(i)throw new Error("Formula missing expected operator");i=!i}if(!i)throw new Error("Formula contains invalid trailing operator");M.length===1&&["reference","literal","constant"].includes(M[0].type)&&(this.single={type:M[0].type==="reference"?"reference":"value",value:M[0].value}),this._parts=M.map(r=>{if(r.type==="operator")return b.operatorsPrefix.includes(r.value)?r:r.value;if(r.type!=="reference")return r.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(r.value))throw new Error(`Formula contains invalid reference ${r.value}`);return this.settings.reference?this.settings.reference(r.value):b.reference(r.value)})}_subFormula(l,M){const v=this.settings.functions[M];if(typeof v!="function")throw new Error(`Formula contains unknown function ${M}`);let m=[];if(l){let e="",a=0,i=!1;const r=()=>{if(!e)throw new Error(`Formula contains function ${M} with invalid arguments ${l}`);m.push(e),e=""};for(let t=0;t<l.length;++t){const c=l[t];i?(e+=c,c===i&&(i=!1)):c in b.literals&&!a?(e+=c,i=b.literals[c]):c!==","||a?(e+=c,c==="("?++a:c===")"&&--a):r()}r()}return m=m.map(e=>new p.Parser(e,this.settings)),function(e){const a=[];for(const i of m)a.push(i.evaluate(e));return v.call(e,...a)}}evaluate(l){const M=this._parts.slice();for(let v=M.length-2;v>=0;--v){const m=M[v];if(m&&m.type==="operator"){const e=M[v+1];M.splice(v+1,1);const a=b.evaluate(e,l);M[v]=b.single(m.value,a)}}return b.operatorsOrder.forEach(v=>{for(let m=1;m<M.length-1;)if(v.includes(M[m])){const e=M[m],a=b.evaluate(M[m-1],l),i=b.evaluate(M[m+1],l);M.splice(m,2);const r=b.calculate(e,a,i);M[m-1]=r===0?0:r}else m+=2}),b.evaluate(M[0],l)}},p.Parser.prototype[b.symbol]=!0,b.reference=function(l){return function(M){return M&&M[l]!==void 0?M[l]:null}},b.evaluate=function(l,M){return l===null?null:typeof l=="function"?l(M):l[b.symbol]?l.evaluate(M):l},b.single=function(l,M){if(l==="!")return!M;const v=-M;return v===0?0:v},b.calculate=function(l,M,v){if(l==="??")return b.exists(M)?M:v;if(typeof M=="string"||typeof v=="string"){if(l==="+")return(M=b.exists(M)?M:"")+(b.exists(v)?v:"")}else switch(l){case"^":return Math.pow(M,v);case"*":return M*v;case"/":return M/v;case"%":return M%v;case"+":return M+v;case"-":return M-v}switch(l){case"<":return M<v;case"<=":return M<=v;case">":return M>v;case">=":return M>=v;case"==":return M===v;case"!=":return M!==v;case"&&":return M&&v;case"||":return M||v}return null},b.exists=function(l){return l!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:q=>{q.exports=JSON.parse('{"version":"17.13.3"}')}},T={},function q(p){var b=T[p];if(b!==void 0)return b.exports;var l=T[p]={exports:{}};return B[p](l,l.exports,q),l.exports}(5107);var B,T})})(dr);var Gr=dr.exports,Ot={},Et={exports:{}};Et.exports;(function(I){(function(P,B){function T($,n){if(!$)throw new Error(n||"Assertion failed")}function q($,n){$.super_=n;var d=function(){};d.prototype=n.prototype,$.prototype=new d,$.prototype.constructor=$}function p($,n,d){if(p.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(d=n,n=10),this._init($||0,n||10,d||"be"))}typeof P=="object"?P.exports=p:B.BN=p,p.BN=p,p.wordSize=26;var b;try{typeof window<"u"&&typeof window.Buffer<"u"?b=window.Buffer:b=Tr.Buffer}catch{}p.isBN=function(n){return n instanceof p?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===p.wordSize&&Array.isArray(n.words)},p.max=function(n,d){return n.cmp(d)>0?n:d},p.min=function(n,d){return n.cmp(d)<0?n:d},p.prototype._init=function(n,d,_){if(typeof n=="number")return this._initNumber(n,d,_);if(typeof n=="object")return this._initArray(n,d,_);d==="hex"&&(d=16),T(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var S=0;n[0]==="-"&&(S++,this.negative=1),S<n.length&&(d===16?this._parseHex(n,S,_):(this._parseBase(n,d,S),_==="le"&&this._initArray(this.toArray(),d,_)))},p.prototype._initNumber=function(n,d,_){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(T(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),_==="le"&&this._initArray(this.toArray(),d,_)},p.prototype._initArray=function(n,d,_){if(T(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var S=0;S<this.length;S++)this.words[S]=0;var O,E,D=0;if(_==="be")for(S=n.length-1,O=0;S>=0;S-=3)E=n[S]|n[S-1]<<8|n[S-2]<<16,this.words[O]|=E<<D&67108863,this.words[O+1]=E>>>26-D&67108863,D+=24,D>=26&&(D-=26,O++);else if(_==="le")for(S=0,O=0;S<n.length;S+=3)E=n[S]|n[S+1]<<8|n[S+2]<<16,this.words[O]|=E<<D&67108863,this.words[O+1]=E>>>26-D&67108863,D+=24,D>=26&&(D-=26,O++);return this._strip()};function l($,n){var d=$.charCodeAt(n);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;T(!1,"Invalid character in "+$)}function M($,n,d){var _=l($,d);return d-1>=n&&(_|=l($,d-1)<<4),_}p.prototype._parseHex=function(n,d,_){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var S=0;S<this.length;S++)this.words[S]=0;var O=0,E=0,D;if(_==="be")for(S=n.length-1;S>=d;S-=2)D=M(n,d,S)<<O,this.words[E]|=D&67108863,O>=18?(O-=18,E+=1,this.words[E]|=D>>>26):O+=8;else{var k=n.length-d;for(S=k%2===0?d+1:d;S<n.length;S+=2)D=M(n,d,S)<<O,this.words[E]|=D&67108863,O>=18?(O-=18,E+=1,this.words[E]|=D>>>26):O+=8}this._strip()};function v($,n,d,_){for(var S=0,O=0,E=Math.min($.length,d),D=n;D<E;D++){var k=$.charCodeAt(D)-48;S*=_,k>=49?O=k-49+10:k>=17?O=k-17+10:O=k,T(k>=0&&O<_,"Invalid character"),S+=O}return S}p.prototype._parseBase=function(n,d,_){this.words=[0],this.length=1;for(var S=0,O=1;O<=67108863;O*=d)S++;S--,O=O/d|0;for(var E=n.length-_,D=E%S,k=Math.min(E,E-D)+_,u=0,A=_;A<k;A+=S)u=v(n,A,A+S,d),this.imuln(O),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(D!==0){var z=1;for(u=v(n,A,n.length,d),A=0;A<D;A++)z*=d;this.imuln(z),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},p.prototype.copy=function(n){n.words=new Array(this.length);for(var d=0;d<this.length;d++)n.words[d]=this.words[d];n.length=this.length,n.negative=this.negative,n.red=this.red};function m($,n){$.words=n.words,$.length=n.length,$.negative=n.negative,$.red=n.red}if(p.prototype._move=function(n){m(n,this)},p.prototype.clone=function(){var n=new p(null);return this.copy(n),n},p.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},p.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},p.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{p.prototype[Symbol.for("nodejs.util.inspect.custom")]=e}catch{p.prototype.inspect=e}else p.prototype.inspect=e;function e(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],i=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],r=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];p.prototype.toString=function(n,d){n=n||10,d=d|0||1;var _;if(n===16||n==="hex"){_="";for(var S=0,O=0,E=0;E<this.length;E++){var D=this.words[E],k=((D<<S|O)&16777215).toString(16);O=D>>>24-S&16777215,S+=2,S>=26&&(S-=26,E--),O!==0||E!==this.length-1?_=a[6-k.length]+k+_:_=k+_}for(O!==0&&(_=O.toString(16)+_);_.length%d!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}if(n===(n|0)&&n>=2&&n<=36){var u=i[n],A=r[n];_="";var z=this.clone();for(z.negative=0;!z.isZero();){var F=z.modrn(A).toString(n);z=z.idivn(A),z.isZero()?_=F+_:_=a[u-F.length]+F+_}for(this.isZero()&&(_="0"+_);_.length%d!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}T(!1,"Base should be between 2 and 36")},p.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&T(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},p.prototype.toJSON=function(){return this.toString(16,2)},b&&(p.prototype.toBuffer=function(n,d){return this.toArrayLike(b,n,d)}),p.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var t=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};p.prototype.toArrayLike=function(n,d,_){this._strip();var S=this.byteLength(),O=_||Math.max(1,S);T(S<=O,"byte array longer than desired length"),T(O>0,"Requested array length <= 0");var E=t(n,O),D=d==="le"?"LE":"BE";return this["_toArrayLike"+D](E,S),E},p.prototype._toArrayLikeLE=function(n,d){for(var _=0,S=0,O=0,E=0;O<this.length;O++){var D=this.words[O]<<E|S;n[_++]=D&255,_<n.length&&(n[_++]=D>>8&255),_<n.length&&(n[_++]=D>>16&255),E===6?(_<n.length&&(n[_++]=D>>24&255),S=0,E=0):(S=D>>>24,E+=2)}if(_<n.length)for(n[_++]=S;_<n.length;)n[_++]=0},p.prototype._toArrayLikeBE=function(n,d){for(var _=n.length-1,S=0,O=0,E=0;O<this.length;O++){var D=this.words[O]<<E|S;n[_--]=D&255,_>=0&&(n[_--]=D>>8&255),_>=0&&(n[_--]=D>>16&255),E===6?(_>=0&&(n[_--]=D>>24&255),S=0,E=0):(S=D>>>24,E+=2)}if(_>=0)for(n[_--]=S;_>=0;)n[_--]=0},Math.clz32?p.prototype._countBits=function(n){return 32-Math.clz32(n)}:p.prototype._countBits=function(n){var d=n,_=0;return d>=4096&&(_+=13,d>>>=13),d>=64&&(_+=7,d>>>=7),d>=8&&(_+=4,d>>>=4),d>=2&&(_+=2,d>>>=2),_+d},p.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,_=0;return d&8191||(_+=13,d>>>=13),d&127||(_+=7,d>>>=7),d&15||(_+=4,d>>>=4),d&3||(_+=2,d>>>=2),d&1||_++,_},p.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function c($){for(var n=new Array($.bitLength()),d=0;d<n.length;d++){var _=d/26|0,S=d%26;n[d]=$.words[_]>>>S&1}return n}p.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;d<this.length;d++){var _=this._zeroBits(this.words[d]);if(n+=_,_!==26)break}return n},p.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},p.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},p.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},p.prototype.isNeg=function(){return this.negative!==0},p.prototype.neg=function(){return this.clone().ineg()},p.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},p.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var d=0;d<n.length;d++)this.words[d]=this.words[d]|n.words[d];return this._strip()},p.prototype.ior=function(n){return T((this.negative|n.negative)===0),this.iuor(n)},p.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},p.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},p.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var _=0;_<d.length;_++)this.words[_]=this.words[_]&n.words[_];return this.length=d.length,this._strip()},p.prototype.iand=function(n){return T((this.negative|n.negative)===0),this.iuand(n)},p.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},p.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},p.prototype.iuxor=function(n){var d,_;this.length>n.length?(d=this,_=n):(d=n,_=this);for(var S=0;S<_.length;S++)this.words[S]=d.words[S]^_.words[S];if(this!==d)for(;S<d.length;S++)this.words[S]=d.words[S];return this.length=d.length,this._strip()},p.prototype.ixor=function(n){return T((this.negative|n.negative)===0),this.iuxor(n)},p.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},p.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},p.prototype.inotn=function(n){T(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,_=n%26;this._expand(d),_>0&&d--;for(var S=0;S<d;S++)this.words[S]=~this.words[S]&67108863;return _>0&&(this.words[S]=~this.words[S]&67108863>>26-_),this._strip()},p.prototype.notn=function(n){return this.clone().inotn(n)},p.prototype.setn=function(n,d){T(typeof n=="number"&&n>=0);var _=n/26|0,S=n%26;return this._expand(_+1),d?this.words[_]=this.words[_]|1<<S:this.words[_]=this.words[_]&~(1<<S),this._strip()},p.prototype.iadd=function(n){var d;if(this.negative!==0&&n.negative===0)return this.negative=0,d=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,d=this.isub(n),n.negative=1,d._normSign();var _,S;this.length>n.length?(_=this,S=n):(_=n,S=this);for(var O=0,E=0;E<S.length;E++)d=(_.words[E]|0)+(S.words[E]|0)+O,this.words[E]=d&67108863,O=d>>>26;for(;O!==0&&E<_.length;E++)d=(_.words[E]|0)+O,this.words[E]=d&67108863,O=d>>>26;if(this.length=_.length,O!==0)this.words[this.length]=O,this.length++;else if(_!==this)for(;E<_.length;E++)this.words[E]=_.words[E];return this},p.prototype.add=function(n){var d;return n.negative!==0&&this.negative===0?(n.negative=0,d=this.sub(n),n.negative^=1,d):n.negative===0&&this.negative!==0?(this.negative=0,d=n.sub(this),this.negative=1,d):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},p.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var _=this.cmp(n);if(_===0)return this.negative=0,this.length=1,this.words[0]=0,this;var S,O;_>0?(S=this,O=n):(S=n,O=this);for(var E=0,D=0;D<O.length;D++)d=(S.words[D]|0)-(O.words[D]|0)+E,E=d>>26,this.words[D]=d&67108863;for(;E!==0&&D<S.length;D++)d=(S.words[D]|0)+E,E=d>>26,this.words[D]=d&67108863;if(E===0&&D<S.length&&S!==this)for(;D<S.length;D++)this.words[D]=S.words[D];return this.length=Math.max(this.length,D),S!==this&&(this.negative=1),this._strip()},p.prototype.sub=function(n){return this.clone().isub(n)};function s($,n,d){d.negative=n.negative^$.negative;var _=$.length+n.length|0;d.length=_,_=_-1|0;var S=$.words[0]|0,O=n.words[0]|0,E=S*O,D=E&67108863,k=E/67108864|0;d.words[0]=D;for(var u=1;u<_;u++){for(var A=k>>>26,z=k&67108863,F=Math.min(u,n.length-1),J=Math.max(0,u-$.length+1);J<=F;J++){var K=u-J|0;S=$.words[K]|0,O=n.words[J]|0,E=S*O+z,A+=E/67108864|0,z=E&67108863}d.words[u]=z|0,k=A|0}return k!==0?d.words[u]=k|0:d.length--,d._strip()}var o=function(n,d,_){var S=n.words,O=d.words,E=_.words,D=0,k,u,A,z=S[0]|0,F=z&8191,J=z>>>13,K=S[1]|0,V=K&8191,W=K>>>13,It=S[2]|0,H=It&8191,Z=It>>>13,Tt=S[3]|0,G=Tt&8191,Y=Tt>>>13,Lt=S[4]|0,Q=Lt&8191,X=Lt>>>13,qt=S[5]|0,ee=qt&8191,te=qt>>>13,Nt=S[6]|0,re=Nt&8191,se=Nt>>>13,Pt=S[7]|0,ne=Pt&8191,ie=Pt>>>13,zt=S[8]|0,ae=zt&8191,oe=zt>>>13,Ft=S[9]|0,le=Ft&8191,ce=Ft>>>13,Bt=O[0]|0,ue=Bt&8191,fe=Bt>>>13,Jt=O[1]|0,he=Jt&8191,de=Jt>>>13,Ut=O[2]|0,me=Ut&8191,pe=Ut>>>13,Vt=O[3]|0,ge=Vt&8191,ye=Vt>>>13,Wt=O[4]|0,ve=Wt&8191,be=Wt>>>13,Kt=O[5]|0,_e=Kt&8191,we=Kt>>>13,Ht=O[6]|0,xe=Ht&8191,Me=Ht>>>13,Zt=O[7]|0,$e=Zt&8191,ke=Zt>>>13,Gt=O[8]|0,je=Gt&8191,Se=Gt>>>13,Yt=O[9]|0,Re=Yt&8191,Ae=Yt>>>13;_.negative=n.negative^d.negative,_.length=19,k=Math.imul(F,ue),u=Math.imul(F,fe),u=u+Math.imul(J,ue)|0,A=Math.imul(J,fe);var Xe=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,k=Math.imul(V,ue),u=Math.imul(V,fe),u=u+Math.imul(W,ue)|0,A=Math.imul(W,fe),k=k+Math.imul(F,he)|0,u=u+Math.imul(F,de)|0,u=u+Math.imul(J,he)|0,A=A+Math.imul(J,de)|0;var et=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(et>>>26)|0,et&=67108863,k=Math.imul(H,ue),u=Math.imul(H,fe),u=u+Math.imul(Z,ue)|0,A=Math.imul(Z,fe),k=k+Math.imul(V,he)|0,u=u+Math.imul(V,de)|0,u=u+Math.imul(W,he)|0,A=A+Math.imul(W,de)|0,k=k+Math.imul(F,me)|0,u=u+Math.imul(F,pe)|0,u=u+Math.imul(J,me)|0,A=A+Math.imul(J,pe)|0;var tt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(tt>>>26)|0,tt&=67108863,k=Math.imul(G,ue),u=Math.imul(G,fe),u=u+Math.imul(Y,ue)|0,A=Math.imul(Y,fe),k=k+Math.imul(H,he)|0,u=u+Math.imul(H,de)|0,u=u+Math.imul(Z,he)|0,A=A+Math.imul(Z,de)|0,k=k+Math.imul(V,me)|0,u=u+Math.imul(V,pe)|0,u=u+Math.imul(W,me)|0,A=A+Math.imul(W,pe)|0,k=k+Math.imul(F,ge)|0,u=u+Math.imul(F,ye)|0,u=u+Math.imul(J,ge)|0,A=A+Math.imul(J,ye)|0;var rt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(rt>>>26)|0,rt&=67108863,k=Math.imul(Q,ue),u=Math.imul(Q,fe),u=u+Math.imul(X,ue)|0,A=Math.imul(X,fe),k=k+Math.imul(G,he)|0,u=u+Math.imul(G,de)|0,u=u+Math.imul(Y,he)|0,A=A+Math.imul(Y,de)|0,k=k+Math.imul(H,me)|0,u=u+Math.imul(H,pe)|0,u=u+Math.imul(Z,me)|0,A=A+Math.imul(Z,pe)|0,k=k+Math.imul(V,ge)|0,u=u+Math.imul(V,ye)|0,u=u+Math.imul(W,ge)|0,A=A+Math.imul(W,ye)|0,k=k+Math.imul(F,ve)|0,u=u+Math.imul(F,be)|0,u=u+Math.imul(J,ve)|0,A=A+Math.imul(J,be)|0;var st=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(st>>>26)|0,st&=67108863,k=Math.imul(ee,ue),u=Math.imul(ee,fe),u=u+Math.imul(te,ue)|0,A=Math.imul(te,fe),k=k+Math.imul(Q,he)|0,u=u+Math.imul(Q,de)|0,u=u+Math.imul(X,he)|0,A=A+Math.imul(X,de)|0,k=k+Math.imul(G,me)|0,u=u+Math.imul(G,pe)|0,u=u+Math.imul(Y,me)|0,A=A+Math.imul(Y,pe)|0,k=k+Math.imul(H,ge)|0,u=u+Math.imul(H,ye)|0,u=u+Math.imul(Z,ge)|0,A=A+Math.imul(Z,ye)|0,k=k+Math.imul(V,ve)|0,u=u+Math.imul(V,be)|0,u=u+Math.imul(W,ve)|0,A=A+Math.imul(W,be)|0,k=k+Math.imul(F,_e)|0,u=u+Math.imul(F,we)|0,u=u+Math.imul(J,_e)|0,A=A+Math.imul(J,we)|0;var nt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(nt>>>26)|0,nt&=67108863,k=Math.imul(re,ue),u=Math.imul(re,fe),u=u+Math.imul(se,ue)|0,A=Math.imul(se,fe),k=k+Math.imul(ee,he)|0,u=u+Math.imul(ee,de)|0,u=u+Math.imul(te,he)|0,A=A+Math.imul(te,de)|0,k=k+Math.imul(Q,me)|0,u=u+Math.imul(Q,pe)|0,u=u+Math.imul(X,me)|0,A=A+Math.imul(X,pe)|0,k=k+Math.imul(G,ge)|0,u=u+Math.imul(G,ye)|0,u=u+Math.imul(Y,ge)|0,A=A+Math.imul(Y,ye)|0,k=k+Math.imul(H,ve)|0,u=u+Math.imul(H,be)|0,u=u+Math.imul(Z,ve)|0,A=A+Math.imul(Z,be)|0,k=k+Math.imul(V,_e)|0,u=u+Math.imul(V,we)|0,u=u+Math.imul(W,_e)|0,A=A+Math.imul(W,we)|0,k=k+Math.imul(F,xe)|0,u=u+Math.imul(F,Me)|0,u=u+Math.imul(J,xe)|0,A=A+Math.imul(J,Me)|0;var it=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(it>>>26)|0,it&=67108863,k=Math.imul(ne,ue),u=Math.imul(ne,fe),u=u+Math.imul(ie,ue)|0,A=Math.imul(ie,fe),k=k+Math.imul(re,he)|0,u=u+Math.imul(re,de)|0,u=u+Math.imul(se,he)|0,A=A+Math.imul(se,de)|0,k=k+Math.imul(ee,me)|0,u=u+Math.imul(ee,pe)|0,u=u+Math.imul(te,me)|0,A=A+Math.imul(te,pe)|0,k=k+Math.imul(Q,ge)|0,u=u+Math.imul(Q,ye)|0,u=u+Math.imul(X,ge)|0,A=A+Math.imul(X,ye)|0,k=k+Math.imul(G,ve)|0,u=u+Math.imul(G,be)|0,u=u+Math.imul(Y,ve)|0,A=A+Math.imul(Y,be)|0,k=k+Math.imul(H,_e)|0,u=u+Math.imul(H,we)|0,u=u+Math.imul(Z,_e)|0,A=A+Math.imul(Z,we)|0,k=k+Math.imul(V,xe)|0,u=u+Math.imul(V,Me)|0,u=u+Math.imul(W,xe)|0,A=A+Math.imul(W,Me)|0,k=k+Math.imul(F,$e)|0,u=u+Math.imul(F,ke)|0,u=u+Math.imul(J,$e)|0,A=A+Math.imul(J,ke)|0;var at=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(at>>>26)|0,at&=67108863,k=Math.imul(ae,ue),u=Math.imul(ae,fe),u=u+Math.imul(oe,ue)|0,A=Math.imul(oe,fe),k=k+Math.imul(ne,he)|0,u=u+Math.imul(ne,de)|0,u=u+Math.imul(ie,he)|0,A=A+Math.imul(ie,de)|0,k=k+Math.imul(re,me)|0,u=u+Math.imul(re,pe)|0,u=u+Math.imul(se,me)|0,A=A+Math.imul(se,pe)|0,k=k+Math.imul(ee,ge)|0,u=u+Math.imul(ee,ye)|0,u=u+Math.imul(te,ge)|0,A=A+Math.imul(te,ye)|0,k=k+Math.imul(Q,ve)|0,u=u+Math.imul(Q,be)|0,u=u+Math.imul(X,ve)|0,A=A+Math.imul(X,be)|0,k=k+Math.imul(G,_e)|0,u=u+Math.imul(G,we)|0,u=u+Math.imul(Y,_e)|0,A=A+Math.imul(Y,we)|0,k=k+Math.imul(H,xe)|0,u=u+Math.imul(H,Me)|0,u=u+Math.imul(Z,xe)|0,A=A+Math.imul(Z,Me)|0,k=k+Math.imul(V,$e)|0,u=u+Math.imul(V,ke)|0,u=u+Math.imul(W,$e)|0,A=A+Math.imul(W,ke)|0,k=k+Math.imul(F,je)|0,u=u+Math.imul(F,Se)|0,u=u+Math.imul(J,je)|0,A=A+Math.imul(J,Se)|0;var ot=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ot>>>26)|0,ot&=67108863,k=Math.imul(le,ue),u=Math.imul(le,fe),u=u+Math.imul(ce,ue)|0,A=Math.imul(ce,fe),k=k+Math.imul(ae,he)|0,u=u+Math.imul(ae,de)|0,u=u+Math.imul(oe,he)|0,A=A+Math.imul(oe,de)|0,k=k+Math.imul(ne,me)|0,u=u+Math.imul(ne,pe)|0,u=u+Math.imul(ie,me)|0,A=A+Math.imul(ie,pe)|0,k=k+Math.imul(re,ge)|0,u=u+Math.imul(re,ye)|0,u=u+Math.imul(se,ge)|0,A=A+Math.imul(se,ye)|0,k=k+Math.imul(ee,ve)|0,u=u+Math.imul(ee,be)|0,u=u+Math.imul(te,ve)|0,A=A+Math.imul(te,be)|0,k=k+Math.imul(Q,_e)|0,u=u+Math.imul(Q,we)|0,u=u+Math.imul(X,_e)|0,A=A+Math.imul(X,we)|0,k=k+Math.imul(G,xe)|0,u=u+Math.imul(G,Me)|0,u=u+Math.imul(Y,xe)|0,A=A+Math.imul(Y,Me)|0,k=k+Math.imul(H,$e)|0,u=u+Math.imul(H,ke)|0,u=u+Math.imul(Z,$e)|0,A=A+Math.imul(Z,ke)|0,k=k+Math.imul(V,je)|0,u=u+Math.imul(V,Se)|0,u=u+Math.imul(W,je)|0,A=A+Math.imul(W,Se)|0,k=k+Math.imul(F,Re)|0,u=u+Math.imul(F,Ae)|0,u=u+Math.imul(J,Re)|0,A=A+Math.imul(J,Ae)|0;var lt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(lt>>>26)|0,lt&=67108863,k=Math.imul(le,he),u=Math.imul(le,de),u=u+Math.imul(ce,he)|0,A=Math.imul(ce,de),k=k+Math.imul(ae,me)|0,u=u+Math.imul(ae,pe)|0,u=u+Math.imul(oe,me)|0,A=A+Math.imul(oe,pe)|0,k=k+Math.imul(ne,ge)|0,u=u+Math.imul(ne,ye)|0,u=u+Math.imul(ie,ge)|0,A=A+Math.imul(ie,ye)|0,k=k+Math.imul(re,ve)|0,u=u+Math.imul(re,be)|0,u=u+Math.imul(se,ve)|0,A=A+Math.imul(se,be)|0,k=k+Math.imul(ee,_e)|0,u=u+Math.imul(ee,we)|0,u=u+Math.imul(te,_e)|0,A=A+Math.imul(te,we)|0,k=k+Math.imul(Q,xe)|0,u=u+Math.imul(Q,Me)|0,u=u+Math.imul(X,xe)|0,A=A+Math.imul(X,Me)|0,k=k+Math.imul(G,$e)|0,u=u+Math.imul(G,ke)|0,u=u+Math.imul(Y,$e)|0,A=A+Math.imul(Y,ke)|0,k=k+Math.imul(H,je)|0,u=u+Math.imul(H,Se)|0,u=u+Math.imul(Z,je)|0,A=A+Math.imul(Z,Se)|0,k=k+Math.imul(V,Re)|0,u=u+Math.imul(V,Ae)|0,u=u+Math.imul(W,Re)|0,A=A+Math.imul(W,Ae)|0;var ct=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ct>>>26)|0,ct&=67108863,k=Math.imul(le,me),u=Math.imul(le,pe),u=u+Math.imul(ce,me)|0,A=Math.imul(ce,pe),k=k+Math.imul(ae,ge)|0,u=u+Math.imul(ae,ye)|0,u=u+Math.imul(oe,ge)|0,A=A+Math.imul(oe,ye)|0,k=k+Math.imul(ne,ve)|0,u=u+Math.imul(ne,be)|0,u=u+Math.imul(ie,ve)|0,A=A+Math.imul(ie,be)|0,k=k+Math.imul(re,_e)|0,u=u+Math.imul(re,we)|0,u=u+Math.imul(se,_e)|0,A=A+Math.imul(se,we)|0,k=k+Math.imul(ee,xe)|0,u=u+Math.imul(ee,Me)|0,u=u+Math.imul(te,xe)|0,A=A+Math.imul(te,Me)|0,k=k+Math.imul(Q,$e)|0,u=u+Math.imul(Q,ke)|0,u=u+Math.imul(X,$e)|0,A=A+Math.imul(X,ke)|0,k=k+Math.imul(G,je)|0,u=u+Math.imul(G,Se)|0,u=u+Math.imul(Y,je)|0,A=A+Math.imul(Y,Se)|0,k=k+Math.imul(H,Re)|0,u=u+Math.imul(H,Ae)|0,u=u+Math.imul(Z,Re)|0,A=A+Math.imul(Z,Ae)|0;var ut=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ut>>>26)|0,ut&=67108863,k=Math.imul(le,ge),u=Math.imul(le,ye),u=u+Math.imul(ce,ge)|0,A=Math.imul(ce,ye),k=k+Math.imul(ae,ve)|0,u=u+Math.imul(ae,be)|0,u=u+Math.imul(oe,ve)|0,A=A+Math.imul(oe,be)|0,k=k+Math.imul(ne,_e)|0,u=u+Math.imul(ne,we)|0,u=u+Math.imul(ie,_e)|0,A=A+Math.imul(ie,we)|0,k=k+Math.imul(re,xe)|0,u=u+Math.imul(re,Me)|0,u=u+Math.imul(se,xe)|0,A=A+Math.imul(se,Me)|0,k=k+Math.imul(ee,$e)|0,u=u+Math.imul(ee,ke)|0,u=u+Math.imul(te,$e)|0,A=A+Math.imul(te,ke)|0,k=k+Math.imul(Q,je)|0,u=u+Math.imul(Q,Se)|0,u=u+Math.imul(X,je)|0,A=A+Math.imul(X,Se)|0,k=k+Math.imul(G,Re)|0,u=u+Math.imul(G,Ae)|0,u=u+Math.imul(Y,Re)|0,A=A+Math.imul(Y,Ae)|0;var ft=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ft>>>26)|0,ft&=67108863,k=Math.imul(le,ve),u=Math.imul(le,be),u=u+Math.imul(ce,ve)|0,A=Math.imul(ce,be),k=k+Math.imul(ae,_e)|0,u=u+Math.imul(ae,we)|0,u=u+Math.imul(oe,_e)|0,A=A+Math.imul(oe,we)|0,k=k+Math.imul(ne,xe)|0,u=u+Math.imul(ne,Me)|0,u=u+Math.imul(ie,xe)|0,A=A+Math.imul(ie,Me)|0,k=k+Math.imul(re,$e)|0,u=u+Math.imul(re,ke)|0,u=u+Math.imul(se,$e)|0,A=A+Math.imul(se,ke)|0,k=k+Math.imul(ee,je)|0,u=u+Math.imul(ee,Se)|0,u=u+Math.imul(te,je)|0,A=A+Math.imul(te,Se)|0,k=k+Math.imul(Q,Re)|0,u=u+Math.imul(Q,Ae)|0,u=u+Math.imul(X,Re)|0,A=A+Math.imul(X,Ae)|0;var ht=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ht>>>26)|0,ht&=67108863,k=Math.imul(le,_e),u=Math.imul(le,we),u=u+Math.imul(ce,_e)|0,A=Math.imul(ce,we),k=k+Math.imul(ae,xe)|0,u=u+Math.imul(ae,Me)|0,u=u+Math.imul(oe,xe)|0,A=A+Math.imul(oe,Me)|0,k=k+Math.imul(ne,$e)|0,u=u+Math.imul(ne,ke)|0,u=u+Math.imul(ie,$e)|0,A=A+Math.imul(ie,ke)|0,k=k+Math.imul(re,je)|0,u=u+Math.imul(re,Se)|0,u=u+Math.imul(se,je)|0,A=A+Math.imul(se,Se)|0,k=k+Math.imul(ee,Re)|0,u=u+Math.imul(ee,Ae)|0,u=u+Math.imul(te,Re)|0,A=A+Math.imul(te,Ae)|0;var dt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(dt>>>26)|0,dt&=67108863,k=Math.imul(le,xe),u=Math.imul(le,Me),u=u+Math.imul(ce,xe)|0,A=Math.imul(ce,Me),k=k+Math.imul(ae,$e)|0,u=u+Math.imul(ae,ke)|0,u=u+Math.imul(oe,$e)|0,A=A+Math.imul(oe,ke)|0,k=k+Math.imul(ne,je)|0,u=u+Math.imul(ne,Se)|0,u=u+Math.imul(ie,je)|0,A=A+Math.imul(ie,Se)|0,k=k+Math.imul(re,Re)|0,u=u+Math.imul(re,Ae)|0,u=u+Math.imul(se,Re)|0,A=A+Math.imul(se,Ae)|0;var mt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(mt>>>26)|0,mt&=67108863,k=Math.imul(le,$e),u=Math.imul(le,ke),u=u+Math.imul(ce,$e)|0,A=Math.imul(ce,ke),k=k+Math.imul(ae,je)|0,u=u+Math.imul(ae,Se)|0,u=u+Math.imul(oe,je)|0,A=A+Math.imul(oe,Se)|0,k=k+Math.imul(ne,Re)|0,u=u+Math.imul(ne,Ae)|0,u=u+Math.imul(ie,Re)|0,A=A+Math.imul(ie,Ae)|0;var pt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(pt>>>26)|0,pt&=67108863,k=Math.imul(le,je),u=Math.imul(le,Se),u=u+Math.imul(ce,je)|0,A=Math.imul(ce,Se),k=k+Math.imul(ae,Re)|0,u=u+Math.imul(ae,Ae)|0,u=u+Math.imul(oe,Re)|0,A=A+Math.imul(oe,Ae)|0;var gt=(D+k|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(gt>>>26)|0,gt&=67108863,k=Math.imul(le,Re),u=Math.imul(le,Ae),u=u+Math.imul(ce,Re)|0,A=Math.imul(ce,Ae);var yt=(D+k|0)+((u&8191)<<13)|0;return D=(A+(u>>>13)|0)+(yt>>>26)|0,yt&=67108863,E[0]=Xe,E[1]=et,E[2]=tt,E[3]=rt,E[4]=st,E[5]=nt,E[6]=it,E[7]=at,E[8]=ot,E[9]=lt,E[10]=ct,E[11]=ut,E[12]=ft,E[13]=ht,E[14]=dt,E[15]=mt,E[16]=pt,E[17]=gt,E[18]=yt,D!==0&&(E[19]=D,_.length++),_};Math.imul||(o=s);function h($,n,d){d.negative=n.negative^$.negative,d.length=$.length+n.length;for(var _=0,S=0,O=0;O<d.length-1;O++){var E=S;S=0;for(var D=_&67108863,k=Math.min(O,n.length-1),u=Math.max(0,O-$.length+1);u<=k;u++){var A=O-u,z=$.words[A]|0,F=n.words[u]|0,J=z*F,K=J&67108863;E=E+(J/67108864|0)|0,K=K+D|0,D=K&67108863,E=E+(K>>>26)|0,S+=E>>>26,E&=67108863}d.words[O]=D,_=E,E=S}return _!==0?d.words[O]=_:d.length--,d._strip()}function g($,n,d){return h($,n,d)}p.prototype.mulTo=function(n,d){var _,S=this.length+n.length;return this.length===10&&n.length===10?_=o(this,n,d):S<63?_=s(this,n,d):S<1024?_=h(this,n,d):_=g(this,n,d),_},p.prototype.mul=function(n){var d=new p(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},p.prototype.mulf=function(n){var d=new p(null);return d.words=new Array(this.length+n.length),g(this,n,d)},p.prototype.imul=function(n){return this.clone().mulTo(n,this)},p.prototype.imuln=function(n){var d=n<0;d&&(n=-n),T(typeof n=="number"),T(n<67108864);for(var _=0,S=0;S<this.length;S++){var O=(this.words[S]|0)*n,E=(O&67108863)+(_&67108863);_>>=26,_+=O/67108864|0,_+=E>>>26,this.words[S]=E&67108863}return _!==0&&(this.words[S]=_,this.length++),d?this.ineg():this},p.prototype.muln=function(n){return this.clone().imuln(n)},p.prototype.sqr=function(){return this.mul(this)},p.prototype.isqr=function(){return this.imul(this.clone())},p.prototype.pow=function(n){var d=c(n);if(d.length===0)return new p(1);for(var _=this,S=0;S<d.length&&d[S]===0;S++,_=_.sqr());if(++S<d.length)for(var O=_.sqr();S<d.length;S++,O=O.sqr())d[S]!==0&&(_=_.mul(O));return _},p.prototype.iushln=function(n){T(typeof n=="number"&&n>=0);var d=n%26,_=(n-d)/26,S=67108863>>>26-d<<26-d,O;if(d!==0){var E=0;for(O=0;O<this.length;O++){var D=this.words[O]&S,k=(this.words[O]|0)-D<<d;this.words[O]=k|E,E=D>>>26-d}E&&(this.words[O]=E,this.length++)}if(_!==0){for(O=this.length-1;O>=0;O--)this.words[O+_]=this.words[O];for(O=0;O<_;O++)this.words[O]=0;this.length+=_}return this._strip()},p.prototype.ishln=function(n){return T(this.negative===0),this.iushln(n)},p.prototype.iushrn=function(n,d,_){T(typeof n=="number"&&n>=0);var S;d?S=(d-d%26)/26:S=0;var O=n%26,E=Math.min((n-O)/26,this.length),D=67108863^67108863>>>O<<O,k=_;if(S-=E,S=Math.max(0,S),k){for(var u=0;u<E;u++)k.words[u]=this.words[u];k.length=E}if(E!==0)if(this.length>E)for(this.length-=E,u=0;u<this.length;u++)this.words[u]=this.words[u+E];else this.words[0]=0,this.length=1;var A=0;for(u=this.length-1;u>=0&&(A!==0||u>=S);u--){var z=this.words[u]|0;this.words[u]=A<<26-O|z>>>O,A=z&D}return k&&A!==0&&(k.words[k.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},p.prototype.ishrn=function(n,d,_){return T(this.negative===0),this.iushrn(n,d,_)},p.prototype.shln=function(n){return this.clone().ishln(n)},p.prototype.ushln=function(n){return this.clone().iushln(n)},p.prototype.shrn=function(n){return this.clone().ishrn(n)},p.prototype.ushrn=function(n){return this.clone().iushrn(n)},p.prototype.testn=function(n){T(typeof n=="number"&&n>=0);var d=n%26,_=(n-d)/26,S=1<<d;if(this.length<=_)return!1;var O=this.words[_];return!!(O&S)},p.prototype.imaskn=function(n){T(typeof n=="number"&&n>=0);var d=n%26,_=(n-d)/26;if(T(this.negative===0,"imaskn works only with positive numbers"),this.length<=_)return this;if(d!==0&&_++,this.length=Math.min(_,this.length),d!==0){var S=67108863^67108863>>>d<<d;this.words[this.length-1]&=S}return this._strip()},p.prototype.maskn=function(n){return this.clone().imaskn(n)},p.prototype.iaddn=function(n){return T(typeof n=="number"),T(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<=n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},p.prototype._iaddn=function(n){this.words[0]+=n;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},p.prototype.isubn=function(n){if(T(typeof n=="number"),T(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},p.prototype.addn=function(n){return this.clone().iaddn(n)},p.prototype.subn=function(n){return this.clone().isubn(n)},p.prototype.iabs=function(){return this.negative=0,this},p.prototype.abs=function(){return this.clone().iabs()},p.prototype._ishlnsubmul=function(n,d,_){var S=n.length+_,O;this._expand(S);var E,D=0;for(O=0;O<n.length;O++){E=(this.words[O+_]|0)+D;var k=(n.words[O]|0)*d;E-=k&67108863,D=(E>>26)-(k/67108864|0),this.words[O+_]=E&67108863}for(;O<this.length-_;O++)E=(this.words[O+_]|0)+D,D=E>>26,this.words[O+_]=E&67108863;if(D===0)return this._strip();for(T(D===-1),D=0,O=0;O<this.length;O++)E=-(this.words[O]|0)+D,D=E>>26,this.words[O]=E&67108863;return this.negative=1,this._strip()},p.prototype._wordDiv=function(n,d){var _=this.length-n.length,S=this.clone(),O=n,E=O.words[O.length-1]|0,D=this._countBits(E);_=26-D,_!==0&&(O=O.ushln(_),S.iushln(_),E=O.words[O.length-1]|0);var k=S.length-O.length,u;if(d!=="mod"){u=new p(null),u.length=k+1,u.words=new Array(u.length);for(var A=0;A<u.length;A++)u.words[A]=0}var z=S.clone()._ishlnsubmul(O,1,k);z.negative===0&&(S=z,u&&(u.words[k]=1));for(var F=k-1;F>=0;F--){var J=(S.words[O.length+F]|0)*67108864+(S.words[O.length+F-1]|0);for(J=Math.min(J/E|0,67108863),S._ishlnsubmul(O,J,F);S.negative!==0;)J--,S.negative=0,S._ishlnsubmul(O,1,F),S.isZero()||(S.negative^=1);u&&(u.words[F]=J)}return u&&u._strip(),S._strip(),d!=="div"&&_!==0&&S.iushrn(_),{div:u||null,mod:S}},p.prototype.divmod=function(n,d,_){if(T(!n.isZero()),this.isZero())return{div:new p(0),mod:new p(0)};var S,O,E;return this.negative!==0&&n.negative===0?(E=this.neg().divmod(n,d),d!=="mod"&&(S=E.div.neg()),d!=="div"&&(O=E.mod.neg(),_&&O.negative!==0&&O.iadd(n)),{div:S,mod:O}):this.negative===0&&n.negative!==0?(E=this.divmod(n.neg(),d),d!=="mod"&&(S=E.div.neg()),{div:S,mod:E.mod}):this.negative&n.negative?(E=this.neg().divmod(n.neg(),d),d!=="div"&&(O=E.mod.neg(),_&&O.negative!==0&&O.isub(n)),{div:E.div,mod:O}):n.length>this.length||this.cmp(n)<0?{div:new p(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new p(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new p(this.modrn(n.words[0]))}:this._wordDiv(n,d)},p.prototype.div=function(n){return this.divmod(n,"div",!1).div},p.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},p.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},p.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var _=d.div.negative!==0?d.mod.isub(n):d.mod,S=n.ushrn(1),O=n.andln(1),E=_.cmp(S);return E<0||O===1&&E===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},p.prototype.modrn=function(n){var d=n<0;d&&(n=-n),T(n<=67108863);for(var _=(1<<26)%n,S=0,O=this.length-1;O>=0;O--)S=(_*S+(this.words[O]|0))%n;return d?-S:S},p.prototype.modn=function(n){return this.modrn(n)},p.prototype.idivn=function(n){var d=n<0;d&&(n=-n),T(n<=67108863);for(var _=0,S=this.length-1;S>=0;S--){var O=(this.words[S]|0)+_*67108864;this.words[S]=O/n|0,_=O%n}return this._strip(),d?this.ineg():this},p.prototype.divn=function(n){return this.clone().idivn(n)},p.prototype.egcd=function(n){T(n.negative===0),T(!n.isZero());var d=this,_=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var S=new p(1),O=new p(0),E=new p(0),D=new p(1),k=0;d.isEven()&&_.isEven();)d.iushrn(1),_.iushrn(1),++k;for(var u=_.clone(),A=d.clone();!d.isZero();){for(var z=0,F=1;!(d.words[0]&F)&&z<26;++z,F<<=1);if(z>0)for(d.iushrn(z);z-- >0;)(S.isOdd()||O.isOdd())&&(S.iadd(u),O.isub(A)),S.iushrn(1),O.iushrn(1);for(var J=0,K=1;!(_.words[0]&K)&&J<26;++J,K<<=1);if(J>0)for(_.iushrn(J);J-- >0;)(E.isOdd()||D.isOdd())&&(E.iadd(u),D.isub(A)),E.iushrn(1),D.iushrn(1);d.cmp(_)>=0?(d.isub(_),S.isub(E),O.isub(D)):(_.isub(d),E.isub(S),D.isub(O))}return{a:E,b:D,gcd:_.iushln(k)}},p.prototype._invmp=function(n){T(n.negative===0),T(!n.isZero());var d=this,_=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var S=new p(1),O=new p(0),E=_.clone();d.cmpn(1)>0&&_.cmpn(1)>0;){for(var D=0,k=1;!(d.words[0]&k)&&D<26;++D,k<<=1);if(D>0)for(d.iushrn(D);D-- >0;)S.isOdd()&&S.iadd(E),S.iushrn(1);for(var u=0,A=1;!(_.words[0]&A)&&u<26;++u,A<<=1);if(u>0)for(_.iushrn(u);u-- >0;)O.isOdd()&&O.iadd(E),O.iushrn(1);d.cmp(_)>=0?(d.isub(_),S.isub(O)):(_.isub(d),O.isub(S))}var z;return d.cmpn(1)===0?z=S:z=O,z.cmpn(0)<0&&z.iadd(n),z},p.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),_=n.clone();d.negative=0,_.negative=0;for(var S=0;d.isEven()&&_.isEven();S++)d.iushrn(1),_.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;_.isEven();)_.iushrn(1);var O=d.cmp(_);if(O<0){var E=d;d=_,_=E}else if(O===0||_.cmpn(1)===0)break;d.isub(_)}while(!0);return _.iushln(S)},p.prototype.invm=function(n){return this.egcd(n).a.umod(n)},p.prototype.isEven=function(){return(this.words[0]&1)===0},p.prototype.isOdd=function(){return(this.words[0]&1)===1},p.prototype.andln=function(n){return this.words[0]&n},p.prototype.bincn=function(n){T(typeof n=="number");var d=n%26,_=(n-d)/26,S=1<<d;if(this.length<=_)return this._expand(_+1),this.words[_]|=S,this;for(var O=S,E=_;O!==0&&E<this.length;E++){var D=this.words[E]|0;D+=O,O=D>>>26,D&=67108863,this.words[E]=D}return O!==0&&(this.words[E]=O,this.length++),this},p.prototype.isZero=function(){return this.length===1&&this.words[0]===0},p.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var _;if(this.length>1)_=1;else{d&&(n=-n),T(n<=67108863,"Number is too big");var S=this.words[0]|0;_=S===n?0:S<n?-1:1}return this.negative!==0?-_|0:_},p.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var d=this.ucmp(n);return this.negative!==0?-d|0:d},p.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var d=0,_=this.length-1;_>=0;_--){var S=this.words[_]|0,O=n.words[_]|0;if(S!==O){S<O?d=-1:S>O&&(d=1);break}}return d},p.prototype.gtn=function(n){return this.cmpn(n)===1},p.prototype.gt=function(n){return this.cmp(n)===1},p.prototype.gten=function(n){return this.cmpn(n)>=0},p.prototype.gte=function(n){return this.cmp(n)>=0},p.prototype.ltn=function(n){return this.cmpn(n)===-1},p.prototype.lt=function(n){return this.cmp(n)===-1},p.prototype.lten=function(n){return this.cmpn(n)<=0},p.prototype.lte=function(n){return this.cmp(n)<=0},p.prototype.eqn=function(n){return this.cmpn(n)===0},p.prototype.eq=function(n){return this.cmp(n)===0},p.red=function(n){return new C(n)},p.prototype.toRed=function(n){return T(!this.red,"Already a number in reduction context"),T(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},p.prototype.fromRed=function(){return T(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},p.prototype._forceRed=function(n){return this.red=n,this},p.prototype.forceRed=function(n){return T(!this.red,"Already a number in reduction context"),this._forceRed(n)},p.prototype.redAdd=function(n){return T(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},p.prototype.redIAdd=function(n){return T(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},p.prototype.redSub=function(n){return T(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},p.prototype.redISub=function(n){return T(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},p.prototype.redShl=function(n){return T(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},p.prototype.redMul=function(n){return T(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},p.prototype.redIMul=function(n){return T(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},p.prototype.redSqr=function(){return T(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},p.prototype.redISqr=function(){return T(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},p.prototype.redSqrt=function(){return T(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},p.prototype.redInvm=function(){return T(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},p.prototype.redNeg=function(){return T(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},p.prototype.redPow=function(n){return T(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var w={k256:null,p224:null,p192:null,p25519:null};function R($,n){this.name=$,this.p=new p(n,16),this.n=this.p.bitLength(),this.k=new p(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}R.prototype._tmp=function(){var n=new p(null);return n.words=new Array(Math.ceil(this.n/13)),n},R.prototype.ireduce=function(n){var d=n,_;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),_=d.bitLength();while(_>this.n);var S=_<this.n?-1:d.ucmp(this.p);return S===0?(d.words[0]=0,d.length=1):S>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},R.prototype.split=function(n,d){n.iushrn(this.n,0,d)},R.prototype.imulK=function(n){return n.imul(this.k)};function j(){R.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}q(j,R),j.prototype.split=function(n,d){for(var _=4194303,S=Math.min(n.length,9),O=0;O<S;O++)d.words[O]=n.words[O];if(d.length=S,n.length<=9){n.words[0]=0,n.length=1;return}var E=n.words[9];for(d.words[d.length++]=E&_,O=10;O<n.length;O++){var D=n.words[O]|0;n.words[O-10]=(D&_)<<4|E>>>22,E=D}E>>>=22,n.words[O-10]=E,E===0&&n.length>10?n.length-=10:n.length-=9},j.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,_=0;_<n.length;_++){var S=n.words[_]|0;d+=S*977,n.words[_]=d&67108863,d=S*64+(d/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function f(){R.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}q(f,R);function y(){R.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}q(y,R);function x(){R.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}q(x,R),x.prototype.imulK=function(n){for(var d=0,_=0;_<n.length;_++){var S=(n.words[_]|0)*19+d,O=S&67108863;S>>>=26,n.words[_]=O,d=S}return d!==0&&(n.words[n.length++]=d),n},p._prime=function(n){if(w[n])return w[n];var d;if(n==="k256")d=new j;else if(n==="p224")d=new f;else if(n==="p192")d=new y;else if(n==="p25519")d=new x;else throw new Error("Unknown prime "+n);return w[n]=d,d};function C($){if(typeof $=="string"){var n=p._prime($);this.m=n.p,this.prime=n}else T($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}C.prototype._verify1=function(n){T(n.negative===0,"red works only with positives"),T(n.red,"red works only with red numbers")},C.prototype._verify2=function(n,d){T((n.negative|d.negative)===0,"red works only with positives"),T(n.red&&n.red===d.red,"red works only with red numbers")},C.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(m(n,n.umod(this.m)._forceRed(this)),n)},C.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},C.prototype.add=function(n,d){this._verify2(n,d);var _=n.add(d);return _.cmp(this.m)>=0&&_.isub(this.m),_._forceRed(this)},C.prototype.iadd=function(n,d){this._verify2(n,d);var _=n.iadd(d);return _.cmp(this.m)>=0&&_.isub(this.m),_},C.prototype.sub=function(n,d){this._verify2(n,d);var _=n.sub(d);return _.cmpn(0)<0&&_.iadd(this.m),_._forceRed(this)},C.prototype.isub=function(n,d){this._verify2(n,d);var _=n.isub(d);return _.cmpn(0)<0&&_.iadd(this.m),_},C.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},C.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},C.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},C.prototype.isqr=function(n){return this.imul(n,n.clone())},C.prototype.sqr=function(n){return this.mul(n,n)},C.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(T(d%2===1),d===3){var _=this.m.add(new p(1)).iushrn(2);return this.pow(n,_)}for(var S=this.m.subn(1),O=0;!S.isZero()&&S.andln(1)===0;)O++,S.iushrn(1);T(!S.isZero());var E=new p(1).toRed(this),D=E.redNeg(),k=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new p(2*u*u).toRed(this);this.pow(u,k).cmp(D)!==0;)u.redIAdd(D);for(var A=this.pow(u,S),z=this.pow(n,S.addn(1).iushrn(1)),F=this.pow(n,S),J=O;F.cmp(E)!==0;){for(var K=F,V=0;K.cmp(E)!==0;V++)K=K.redSqr();T(V<J);var W=this.pow(A,new p(1).iushln(J-V-1));z=z.redMul(W),A=W.redSqr(),F=F.redMul(A),J=V}return z},C.prototype.invm=function(n){var d=n._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},C.prototype.pow=function(n,d){if(d.isZero())return new p(1).toRed(this);if(d.cmpn(1)===0)return n.clone();var _=4,S=new Array(1<<_);S[0]=new p(1).toRed(this),S[1]=n;for(var O=2;O<S.length;O++)S[O]=this.mul(S[O-1],n);var E=S[0],D=0,k=0,u=d.bitLength()%26;for(u===0&&(u=26),O=d.length-1;O>=0;O--){for(var A=d.words[O],z=u-1;z>=0;z--){var F=A>>z&1;if(E!==S[0]&&(E=this.sqr(E)),F===0&&D===0){k=0;continue}D<<=1,D|=F,k++,!(k!==_&&(O!==0||z!==0))&&(E=this.mul(E,S[D]),k=0,D=0)}u=26}return E},C.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},C.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},p.mont=function(n){return new N(n)};function N($){C.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new p(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}q(N,C),N.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},N.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},N.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var _=n.imul(d),S=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=_.isub(S).iushrn(this.shift),E=O;return O.cmp(this.m)>=0?E=O.isub(this.m):O.cmpn(0)<0&&(E=O.iadd(this.m)),E._forceRed(this)},N.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new p(0)._forceRed(this);var _=n.mul(d),S=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=_.isub(S).iushrn(this.shift),E=O;return O.cmp(this.m)>=0?E=O.isub(this.m):O.cmpn(0)<0&&(E=O.iadd(this.m)),E._forceRed(this)},N.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(I,ze)})(Et);var Yr=Et.exports,Qr=ze&&ze.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.BNExtension=Xr;const Pe=Qr(Yr);function Xr(I){return{type:"BN",base:I.any(),messages:{"bn.nan":"{{#label}} is not a big number","bn.max":'{{#label}} needs to be less than or equal to "{{#threshold}}"',"bn.min":'{{#label}} needs to be greater than or equal to "{{#threshold}}"',"bn.less":'{{#label}} needs to be less than "{{#threshold}}"',"bn.greater":'{{#label}} needs to be greater than "{{#threshold}}"',"bn.positive":"{{#label}} needs to be positive","bn.negative":"{{#label}} needs to be negative"},prepare(P,B){try{return{value:new Pe.default(P)}}catch{return{errors:B.error("bn.nan")}}},coerce(P){return{value:P.toString(10)}},validate(P){return{value:P}},rules:{gt:{args:[{name:"threshold",ref:!0,assert:P=>Pe.default.isBN(P),message:"must be a big number",normalize:P=>new Pe.default(P)},{name:"equal",assert:P=>typeof P=="boolean",message:"must be a boolean"}],validate(P,B,T){const q=new Pe.default(P);return T.equal&&q.lt(T.threshold)?B.error("bn.min",T):!T.equal&&q.lte(T.threshold)?B.error("bn.greater",T):P}},lt:{args:[{name:"threshold",ref:!0,assert:P=>Pe.default.isBN(P),message:"must be a big number",normalize:P=>new Pe.default(P)},{name:"equal",assert:P=>typeof P=="boolean",message:"must be a boolean"}],validate(P,B,T){const q=new Pe.default(P);return T.equal&&q.gt(T.threshold)?B.error("bn.max",T):!T.equal&&q.gte(T.threshold)?B.error("bn.less",T):P}},min:{alias:"gte",method(P){return this.$_addRule({name:"gt",args:{threshold:P,equal:!0}})}},max:{alias:"lte",method(P){return this.$_addRule({name:"lt",args:{threshold:P,equal:!0}})}},greater:{alias:"gt",method(P){return this.$_addRule({name:"gt",args:{threshold:P,equal:!1}})}},less:{alias:"lt",method(P){return this.$_addRule({name:"lt",args:{threshold:P,equal:!1}})}},positive:{method(){return this.$_addRule({name:"gt",args:{threshold:0,equal:!1}})}},negative:{method(){return this.$_addRule({name:"lt",args:{threshold:0,equal:!1}})}}}}}var Ct={},es=ze&&ze.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.DIDExtension=ts;const vt=es(Ar),bt=Or,Ie=Te,Ke={pk:Object.keys(bt.types.KeyType),hash:Object.keys(bt.types.HashType),role:Object.keys(bt.types.RoleType)};function ts(I){return{type:"DID",base:I.string().trim(),messages:{"did.empty":'Expect {{#label}} to be non-empty string, got "{{#value}}"',"did.invalid":'Expect {{#label}} to be valid did, got "{{#value}}"',"did.wallet":'Expect wallet type of {{#label}} to be "{{#expected}}" wallet, got "{{#actual}}"',"did.pk":'Expect pk type of {{#label}} to be "{{#expected}}", got "{{#actual}}"',"did.hash":'Expect hash type of {{#label}} to be "{{#expected}}", got "{{#actual}}"',"did.role":'Expect role type of {{#label}} to be "{{#expected}}", got "{{#actual}}"',"did.prefix":'Expect prefix of {{#label}} to be "{{#expected}}"'},validate(P,B){return!P||typeof P!="string"?{errors:B.error("did.empty",{value:P})}:(0,Ie.isValid)(P)===!1?{errors:B.error("did.invalid",{value:P})}:{value:P}},rules:{type:{args:[{name:"key",ref:!0,assert:P=>Object.keys(Ke).includes(P),message:`must be one of ${Object.keys(Ke).join(", ")}`},{name:"expected",assert:P=>Object.keys(Ke).some(B=>Ke[B].includes(P)),message:"must be valid type"}],validate(P,B,T){const q=(0,Ie.toTypeInfoStr)(P);return T.key==="pk"&&q.pk!==T.expected?B.error("did.pk",{...T,actual:q.pk}):T.key==="hash"&&q.hash!==T.expected?B.error("did.hash",{...T,actual:q.hash}):T.key==="role"&&q.role!==T.expected?B.error("did.role",{...T,actual:q.role}):P}},pk:{method(P){return this.$_addRule({name:"type",args:{key:"pk",expected:P}})}},hash:{method(P){return this.$_addRule({name:"type",args:{key:"hash",expected:P}})}},role:{method(P){return this.$_addRule({name:"type",args:{key:"role",expected:P}})}},wallet:{method(P){return this.$_addRule({name:"wallet",args:{type:P}})},args:[{name:"type",ref:!0,assert:P=>["arcblock","ethereum","default","eth","passkey"].includes(P),message:"must be a string",normalize:P=>P.trim()}],validate(P,B,T={}){const q=(0,Ie.toTypeInfo)(P),p=(0,Ie.toTypeInfoStr)(P);return["ethereum","eth"].includes(T.type)&&(0,vt.default)(q,Ie.DID_TYPE_ETHEREUM)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):["arcblock","default"].includes(T.type)&&(0,vt.default)(q,Ie.DID_TYPE_ARCBLOCK)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):["passkey"].includes(T.type)&&(0,vt.default)(q,Ie.DID_TYPE_PASSKEY)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):P}},prefix:{method(P=""){return this.$_addRule({name:"prefix",args:{str:P}})},args:[{name:"str",ref:!0,assert:P=>["",Ie.DID_PREFIX].includes(P),message:"must be a string",normalize:P=>P.trim()}],validate(P,B,T={}){return T.str&&P.startsWith(T.str)===!1?B.error("did.prefix",{expected:T.str}):!T.str&&(0,Ie.toAddress)(P)!==P?B.error("did.prefix",{expected:T.str}):P}}}}}(function(I){var P=ze&&ze.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(I,"__esModule",{value:!0}),I.patterns=I.schemas=I.Joi=void 0;const B=P(Gr),T=Ot,q=Ct;I.Joi=B.default.extend(q.DIDExtension).extend(T.BNExtension);const p=/^(0x)?([A-Fa-f0-9]{64})$/,b=I.Joi.object({genesisTime:I.Joi.date().iso().required().raw(),genesisTx:I.Joi.string().regex(p).required().allow(""),renaissanceTime:I.Joi.date().iso().required().raw(),renaissanceTx:I.Joi.string().regex(p).required().allow("")}),l=I.Joi.object({address:I.Joi.DID().prefix().role("ROLE_TOKEN").required(),value:I.Joi.BN().positive().required()}),M=I.Joi.object({name:I.Joi.string().min(1).max(256).required(),value:I.Joi.string().min(1).max(1024).required(),description:I.Joi.string().min(1).max(256).optional().allow(""),required:I.Joi.boolean().optional().default(!1)}),v=I.Joi.alternatives().try(I.Joi.DID().prefix().role("ROLE_ACCOUNT"),I.Joi.DID().prefix().role("ROLE_APPLICATION"),I.Joi.DID().prefix().role("ROLE_BLOCKLET"),I.Joi.DID().prefix().wallet("ethereum"),I.Joi.DID().prefix().wallet("passkey")),m=I.Joi.array().items(I.Joi.object({owner:v.required(),tokensList:I.Joi.array().items(l).default([]),assetsList:I.Joi.array().items(I.Joi.DID().prefix().role("ROLE_ASSET")).default([])})),e=I.Joi.array().items({signer:I.Joi.DID().prefix().required(),pk:I.Joi.any().required(),signature:I.Joi.any().required(),delegator:I.Joi.DID().prefix().valid("").optional(),data:I.Joi.any().optional()}),a=I.Joi.object({type:I.Joi.string().min(1).max(32).required(),contractAddress:I.Joi.DID().prefix().wallet("ethereum").required(),chainType:I.Joi.string().min(1).max(32).required(),chainName:I.Joi.string().min(1).max(32).required(),chainId:I.Joi.number().positive().required()}),i=I.Joi.object({type:I.Joi.string().valid("svg","url","uri").required(),content:I.Joi.string().when("type",{is:"uri",then:I.Joi.string().max(20480).dataUri().required()}).when("type",{is:"url",then:I.Joi.string().max(2048).uri({scheme:["http","https"]}).required()})}),r=I.Joi.object({id:I.Joi.string().max(2048).uri({scheme:["http","https"]}).required(),scope:I.Joi.string().valid("public","private").default("public")}),t=I.Joi.object({id:I.Joi.DID().prefix().required(),pk:I.Joi.string().required(),name:I.Joi.string().min(1).max(256).required()}),c={address:I.Joi.DID().prefix().role("ROLE_ASSET").required(),moniker:I.Joi.string().min(2).max(255).required(),data:I.Joi.any().required(),readonly:I.Joi.boolean().default(!1),transferrable:I.Joi.boolean().default(!1),ttl:I.Joi.number().min(0).default(0),parent:I.Joi.DID().prefix().optional().allow(""),issuer:I.Joi.DID().prefix().optional().allow(""),endpoint:r.optional().allow(null).default(null),display:i.optional().allow(null).default(null),tags:I.Joi.array().items(I.Joi.string().min(1).max(64)).max(4).optional()},s={address:I.Joi.DID().prefix().role("ROLE_FACTORY").required(),name:I.Joi.string().min(2).max(255).required(),description:I.Joi.string().min(2).max(255).required(),settlement:I.Joi.string().valid("instant","periodic").default("instant"),limit:I.Joi.number().integer().min(0).default(0),trustedIssuers:I.Joi.array().items(I.Joi.DID().prefix()).max(8).optional(),data:I.Joi.any().optional().allow(null).default(null),display:i.optional().allow(null).default(null),input:I.Joi.object({value:I.Joi.BN().positive().min("0").default("0"),tokens:I.Joi.array().items(l).max(8).optional(),assets:I.Joi.array().items(I.Joi.alternatives().try(I.Joi.DID().prefix().role("ROLE_ASSET"),I.Joi.DID().prefix().role("ROLE_FACTORY"))).max(8).optional(),variables:I.Joi.array().items(I.Joi.object({name:I.Joi.string().min(1).max(255).required(),description:I.Joi.string().max(255).optional().allow(""),required:I.Joi.boolean().required()})).optional()}),output:I.Joi.object({moniker:I.Joi.string().min(2).max(255).required(),data:I.Joi.any().required(),readonly:I.Joi.boolean().default(!1),transferrable:I.Joi.boolean().default(!1),ttl:I.Joi.number().min(0).default(0),parent:I.Joi.string().max(255).required(),issuer:I.Joi.string().max(255).required(),endpoint:r.optional(),display:i.optional(),tags:I.Joi.array().items(I.Joi.string().min(1).max(64)).max(4).optional()}),hooks:I.Joi.array().items(I.Joi.object({name:I.Joi.string().valid("mint","postMint","preMint").required(),type:I.Joi.string().valid("url","contract").required(),hook:I.Joi.string().min(1).max(4096).required(),compiled:I.Joi.array().items(I.Joi.object()).optional()})).optional()};I.schemas={context:b,tokenInput:l,multiInput:m,multiSig:e,foreignToken:a,variableInput:M,nftDisplay:i,nftEndpoint:r,nftIssuer:t,tokenHolder:v,assetProps:c,assetSchema:I.Joi.object(c).options({stripUnknown:!0,noDefaults:!1}),factoryProps:s,factorySchema:I.Joi.object(s).options({stripUnknown:!0,noDefaults:!1})},I.patterns={txHash:p}})(hr);function Dt({onCancel:I,onSuccess:P,blocklet:B}){var c,s;const{vaults:T=[],appPid:q}=B,{t:p,locale:b}=We(),{connectApi:l}=lr(),{api:M}=Je(),{teamDid:v}=cr(),[m,e]=or({loading:!1,fetching:!1,error:"",address:"",fetched:[],errored:[]});Oe.useEffect(()=>{if(!Te.isValid(m.address))return;const o=Te.toAddress(m.address),h=m.fetched.find(w=>w.address===o),g=m.errored.find(w=>w.address===o);!m.fetching&&!h&&!g&&(e({fetching:!0}),jr(Er.MAIN_CHAIN_ENDPOINT).getAccountState({address:o}).then(R=>{R.state?e({fetching:!1,fetched:[...m.fetched.filter(j=>j.address!==o),R.state]}):e({fetching:!1,errored:[...m.errored.filter(j=>j.address!==o),{address:o}]})}).catch(R=>{console.error(R),e({fetching:!1,error:Ve(R)})}))},[m.address,m.fetching]),Oe.useEffect(()=>{if(m.address){const o=Te.toAddress(m.address);if(!Te.isValid(o)){e({error:p("blocklet.config.vault.error.invalid")});return}if(hr.schemas.tokenHolder.validate(o).error){e({error:p("blocklet.config.vault.error.holder")});return}if(T.find(g=>g.did===o)){e({error:p("blocklet.config.vault.error.duplicate")});return}if(Lr([B.appDid,B.appPid,...B.migratedFrom.map(g=>g.appDid)].filter(Boolean)).includes(o)){e({error:p("blocklet.config.vault.error.appDid")});return}}e({error:""})},[m.address]);const a=async()=>{e({loading:!0});try{const o=await M.configVault({input:{teamDid:v,vaultDid:Te.toAddress(m.address)}});l.open({locale:b,action:"approve-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:o.sessionId},messages:{title:p("blocklet.config.vault.approve.title"),scan:p(`blocklet.config.vault.approve.${T.length>0?"byLast":"byOwner"}`),confirm:p("blocklet.config.vault.approve.confirm"),success:p("blocklet.config.vault.approve.success")},onSuccess:()=>{l.open({locale:b,action:"config-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:o.sessionId},messages:{title:p("blocklet.config.vault.commit.title"),scan:p("blocklet.config.vault.commit.scan"),confirm:p("blocklet.config.vault.commit.confirm"),success:p("blocklet.config.vault.commit.success")},onSuccess:()=>{e({loading:!1}),P()},onClose:()=>{e({loading:!1}),l.close()}})},onClose:()=>{e({loading:!1}),l.close()}})}catch(o){e({loading:!1,error:Ve(o)})}},i=Te.toAddress(m.address),r=[];Te.isValid(i)&&r.push({key:p("blocklet.config.vault.role"),value:L.jsx(br,{color:"primary",variant:"outlined",size:"small",label:Te.toTypeInfoStr(i).role||"-"})});const t=m.fetched.find(o=>o.address===i);return t&&r.push({key:p("blocklet.config.vault.firstSeen"),value:Xt((c=t.context)==null?void 0:c.genesisTime,"-")},{key:p("blocklet.config.vault.lastSeen"),value:Xt((s=t.context)==null?void 0:s.renaissanceTime,"-")},{key:p("blocklet.config.vault.migratedFrom"),value:t.migratedFrom.length?t.migratedFrom.map(o=>L.jsx(er,{did:o,showQrcode:!0,compact:!0,size:14,locale:b},o)):"-"},{key:p("blocklet.config.vault.migratedTo"),value:t.migratedTo.length?t.migratedTo.map(o=>L.jsx(er,{did:o,showQrcode:!0,compact:!0,size:14,locale:b},o)):"-"}),L.jsx(ar,{open:!0,fullWidth:!0,showCloseButton:!1,onClose:I,title:L.jsxs(U,{sx:{display:"flex",alignItems:"center",gap:1},children:[L.jsx(jt,{}),p("blocklet.config.vault.title")]}),actions:L.jsxs(L.Fragment,{children:[L.jsx(qe,{onClick:I,children:p("common.cancel")}),L.jsx(qe,{onClick:a,variant:"contained",disabled:!!m.error||m.loading,children:p("common.confirm")})]}),children:L.jsxs(He,{direction:"column",spacing:3,children:[L.jsxs(Be,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[p("blocklet.config.vault.desc")," ",p("blocklet.config.vault.tip")]}),T.length>0&&L.jsxs(U,{children:[L.jsxs(Be,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[p("blocklet.config.vault.current"),":"]}),L.jsxs(U,{sx:{display:"flex",alignItems:"center",gap:.5},children:[L.jsx(Nr,{did:T[T.length-1].did,showQrcode:!0,style:{width:"auto"}}),L.jsx(Pr,{vaults:T,appPid:q})]})]}),L.jsx(_r,{fullWidth:!0,"data-cy":"input-factory-address",label:p("blocklet.config.vault.address"),error:!!m.error,helperText:m.error,value:m.address,InputProps:{endAdornment:m.fetching?L.jsx(wr,{position:"end",children:L.jsx(Ze,{size:16})}):null},onChange:o=>{e({address:o.target.value,error:""})}}),L.jsx(U,{sx:{"& .info-row__name":{fontSize:"14px"},"& .info-row__value":{fontSize:"14px"}},children:r.map(o=>L.jsx(qr,{valueComponent:"div",nameWidth:120,name:o.key,children:o.value},o.key))})]})})}Dt.propTypes={onCancel:Ee.func.isRequired,onSuccess:Ee.func.isRequired,blocklet:Ee.object.isRequired};Dt.defaultProps={};function rs({teamDid:I,size:P="small",...B}){const{t:T}=We(),{api:q}=Je(),[p,b]=Oe.useState(!1),[l,M]=Oe.useState(null),v=()=>{b(!1),M(null)},m=async()=>{var a;try{b(!0);const i=await q.rotateSessionKey({input:{teamDid:I}});Le.success(T("blocklet.config.rotateSessionKey.success",{count:((a=i.removed)==null?void 0:a.length)||0})),setTimeout(()=>{window.location.reload()},1e3)}catch(i){Le.error(Ve(i))}finally{b(!1),M(null)}},e={title:T("blocklet.config.rotateSessionKey.title"),description:T("blocklet.config.rotateSessionKey.description"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:m,onCancel:v};return L.jsxs("div",{...B,children:[L.jsxs(qe,{onClick:()=>M(e),color:"error",variant:"outlined",size:P,children:[p?L.jsx(Ze,{size:16,style:{marginRight:5}}):null,T("blocklet.config.rotateSessionKey.action")]}),l&&L.jsx(Mt,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}function Ye({blocklet:I,onUpdate:P,hasPermission:B}){var d,_,S,O;const{info:T,api:q,inService:p}=Je(),{t:b,locale:l}=Oe.useContext(Cr),[M,v]=or({loading:!1,showTransferOwner:!1,showConfigVault:!1}),[m,e]=Oe.useState(()=>{var E,D,k;return((k=(D=(E=I==null?void 0:I.settings)==null?void 0:E.gateway)==null?void 0:D.wafPolicy)==null?void 0:k.enabled)??!0}),[a,i]=Oe.useState(()=>{var E;return!!((E=I==null?void 0:I.settings)!=null&&E.enableSessionHardening)}),[r,t]=Oe.useState(()=>{var E,D;return!!((D=(E=I==null?void 0:I.settings)==null?void 0:E.invite)!=null&&D.enabled)}),c=M.loading||!B,{did:s}=I.meta,o=p?(S=(_=(d=window.env)==null?void 0:d.gateway)==null?void 0:_.wafPolicy)==null?void 0:S.enabled:(O=T==null?void 0:T.routing.wafPolicy)==null?void 0:O.enabled;if(sr(I.status))return null;const h=I.environments.find(E=>E.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE),g=!h||h.value==="yes",w=I.environments.find(E=>E.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_TENANT_MODE),R=(w==null?void 0:w.value)||Ne.BLOCKLET_TENANT_MODES.SINGLE,j=(E,D)=>async k=>{if(!M.loading){v({loading:!0});try{const{checked:u}=k.target,{blocklet:A}=await q.configBlocklet({input:{did:I.meta.did,configs:[{key:Ne.BLOCKLET_CONFIGURABLE_KEY[E],value:D(u)}]}});P(A)}catch(u){Le.error(u.message)}finally{v({loading:!1})}}},f=j("BLOCKLET_DELETABLE",E=>E?"no":"yes"),y=j("BLOCKLET_APP_TENANT_MODE",E=>E?Ne.BLOCKLET_TENANT_MODES.MULTIPLE:Ne.BLOCKLET_TENANT_MODES.SINGLE),x=(E,D)=>async k=>{if(!M.loading){v({loading:!0});try{const u=k.target.checked;await q.updateBlockletSettings({input:E(u)}),D&&D(u)}catch(u){Le.error(u.message)}finally{v({loading:!1})}}},C=x(E=>({did:I.meta.did,invite:{enabled:E}}),t),N=x(E=>({did:I.meta.did,gateway:{wafPolicy:{enabled:E}}}),e),$=x(E=>({did:I.meta.did,enableSessionHardening:E}),i),n=async()=>{if(!M.loading){v({loading:!0});try{const{blocklet:E}=await q.getBlocklet({input:{did:I.meta.did}});P(E)}catch(E){Le.error(E.message)}finally{v({loading:!1})}}};return L.jsxs(as,{p:3,sx:{border:"1px solid red",borderRadius:2},className:"advanced-config",children:[!p&&L.jsxs(L.Fragment,{children:[L.jsx(Ce,{title:b("blocklet.config.deletable.name"),desc:b(g?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(Ue,{disabled:c,checked:!g,defaultChecked:!0,onChange:f})})}),L.jsx(U,{className:"config-form",component:De,my:3})]}),L.jsx(Rt,{inService:p,disabled:c,loading:M.loading,onChange:n}),L.jsx(U,{className:"config-form",component:De,my:3}),p&&L.jsx(Sr,{role:"owner",children:E=>(E||Vr)&&L.jsxs(L.Fragment,{children:[L.jsx(Ce,{title:b("blocklet.config.vault.title"),desc:b("blocklet.config.vault.desc"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsxs(qe,{variant:"contained",color:"primary",size:"small","data-cy":"config-vault",onClick:()=>v({showConfigVault:!0}),children:[L.jsx(jt,{style:{fontSize:"1.3em",marginRight:4}}),b("blocklet.config.vault.title")]})})}),L.jsx(U,{className:"config-form",component:De,my:3}),M.showConfigVault&&L.jsx(Dt,{blocklet:I,onCancel:()=>v({showConfigVault:!1}),onSuccess:()=>v({showConfigVault:!1})}),L.jsx(Ce,{title:b("team.transferApp.name"),desc:b("team.transferApp.description"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsxs(qe,{variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"transfer-app",onClick:()=>v({showTransferOwner:!0}),children:[L.jsx(ur,{style:{fontSize:"1.3em",marginRight:4}}),b("team.transferApp.name")]})})}),L.jsx(U,{className:"config-form",component:De,my:3}),M.showTransferOwner&&L.jsx(At,{onCancel:()=>v({showTransferOwner:!1}),onSuccess:()=>v({showTransferOwner:!1})})]})}),L.jsx(Ce,{title:b("blocklet.config.clearCache.name"),desc:b("blocklet.config.clearCache.purpose"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(Wr,{teamDid:s})})}),L.jsx(U,{className:"config-form",component:De,my:3}),L.jsx(Ce,{title:b("blocklet.config.rotateSessionKey.name"),desc:b("blocklet.config.rotateSessionKey.purpose"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(rs,{style:{whiteSpace:"nowrap"},teamDid:s})})}),L.jsx(U,{className:"config-form",component:De,my:3}),L.jsx(Ce,{title:b("blocklet.config.tenantMode.name"),desc:b(`blocklet.config.tenantMode.${R}`),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(Ue,{disabled:c,checked:R===Ne.BLOCKLET_TENANT_MODES.MULTIPLE,onChange:y})})}),L.jsx(U,{className:"config-form",component:De,my:3}),L.jsx(Ce,{title:b("team.invite.setting"),desc:b(`team.invite.${r?"enabled":"disabled"}`),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(Ue,{disabled:c,checked:r,onChange:C})})}),L.jsx(U,{className:"config-form",component:De,my:3}),L.jsx(Ce,{title:L.jsxs(He,{direction:"row",alignItems:"center",gap:1,children:[b("setting.form.enableSessionHardening.switchLabel"),L.jsx(Qt,{title:b("setting.form.enableSessionHardening.switchTips"),children:L.jsx(tr,{sx:{ml:.5,fontSize:"20px"},color:"primary"})})]}),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(Ue,{disabled:c,checked:a,onChange:$})})}),o&&L.jsxs(L.Fragment,{children:[L.jsx(U,{className:"config-form",component:De,my:3}),L.jsx(Ce,{title:L.jsxs(He,{direction:"row",alignItems:"center",gap:1,children:[b("router.gateway.wafPolicy.title"),L.jsx(Qt,{title:L.jsx(U,{sx:{fontSize:"14px",lineHeight:1.5},children:L.jsx(U,{sx:{color:"common.white",ml:.5},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${l}/enable-web-application-firewall`,target:"_blank",rel:"noopener noreferrer",children:b("dashboard.document")})}),children:L.jsx(tr,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]}),desc:b("router.gateway.wafPolicy.switchLabel"),children:L.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:L.jsx(Ue,{disabled:c,checked:m,onChange:N})})})]})]})}const ss=Ge(Ye,"mutate_blocklets"),ns=Ge(Ye,"",nr);function is(I){const{inService:P}=Je();return P?L.jsx(ns,{...I}):L.jsx(ss,{...I})}Ye.propTypes={blocklet:Ee.object.isRequired,onUpdate:Ee.func,hasPermission:Ee.bool};Ye.defaultProps={onUpdate:()=>{},hasPermission:!1};const as=wt(He)``;function Qe({blocklet:I,onUpdate:P,hasPermission:B}){return sr(I.status)?null:L.jsx(cs,{children:L.jsx(is,{blocklet:I,onUpdate:P,hasPermission:B})})}const os=Ge(Qe,"mutate_blocklets"),ls=Ge(Qe,"",nr);function Ns(I){const{inService:P}=Je();return P?L.jsx(ls,{...I}):L.jsx(os,{...I})}Qe.propTypes={blocklet:Ee.object.isRequired,onUpdate:Ee.func,hasPermission:Ee.bool};Qe.defaultProps={onUpdate:()=>{},hasPermission:!1};const cs=wt(U)`
8
- max-width: 1536px;
9
-
10
- .advanced-config {
11
- border: 0;
12
- padding: 0;
13
- }
14
- `;export{Ns as default};