@sachahjkl/backoffice 0.2.5 → 0.2.6

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 (280) hide show
  1. package/README.md +3 -1
  2. package/bin/backoffice.mjs +2 -2
  3. package/dist/demo-reset.cjs +65895 -0
  4. package/dist/main.cjs +71 -39
  5. package/dist/migrate.cjs +17 -3
  6. package/dist/web/{chunk-Bans5XmP2.js → chunk--RuvStn6.js} +1 -1
  7. package/dist/web/{chunk-BidSGJER.js → chunk-4ipZT9nT.js} +1 -1
  8. package/dist/web/chunk-6jIo5mZ42.js +1 -0
  9. package/dist/web/{chunk-D0WfOSVe.js → chunk-9X4vLcFh.js} +1 -1
  10. package/dist/web/chunk-9d_UD-MQ.js +1 -0
  11. package/dist/web/{chunk-CuukTiS1.js → chunk-AJOoJgZJ.js} +1 -1
  12. package/dist/web/{chunk-2sHWWuzv2.js → chunk-B0bNirg2.js} +1 -1
  13. package/dist/web/chunk-B3OxeBLO2.js +1 -0
  14. package/dist/web/chunk-B5xzAYYx2.js +1 -0
  15. package/dist/web/{chunk-BQRlJCOd.js → chunk-B6Rml85x2.js} +1 -1
  16. package/dist/web/chunk-B8_dFe5w.js +1 -0
  17. package/dist/web/chunk-B91VAo1J.js +1 -0
  18. package/dist/web/chunk-B9NV1rY62.js +1 -0
  19. package/dist/web/chunk-BAn0tBhX.js +1 -0
  20. package/dist/web/chunk-BGVaNZdj.js +1 -0
  21. package/dist/web/chunk-BHDXYrox.js +1 -0
  22. package/dist/web/chunk-BI9lIdFn.js +1 -0
  23. package/dist/web/{chunk-CYB9QO85.js → chunk-BKufCOYq.js} +1 -1
  24. package/dist/web/chunk-BNksdK_D2.js +1 -0
  25. package/dist/web/chunk-BQ7WWH4L.js +1 -0
  26. package/dist/web/chunk-BQrmVphu2.js +1 -0
  27. package/dist/web/chunk-BR0demlX.js +1 -0
  28. package/dist/web/chunk-BT8KtCYG.js +1 -0
  29. package/dist/web/{chunk-Bm0a1bep.js → chunk-BVszSMJC.js} +1 -1
  30. package/dist/web/{chunk-CJDa7FT62.js → chunk-BYjxXKZ4.js} +1 -1
  31. package/dist/web/chunk-BZZJ287h.js +1 -0
  32. package/dist/web/chunk-Bb31fHqC2.js +1 -0
  33. package/dist/web/chunk-BcUjdID-.js +1 -0
  34. package/dist/web/{chunk-BzOWqX4m2.js → chunk-Bck0-DJt2.js} +1 -1
  35. package/dist/web/chunk-Bf3eV_su2.js +1 -0
  36. package/dist/web/chunk-BfSewUhY.js +1 -0
  37. package/dist/web/{chunk-osh5v_OU2.js → chunk-Bfx7EEIR.js} +1 -1
  38. package/dist/web/chunk-Bi4Jixry2.js +1 -0
  39. package/dist/web/chunk-BiECfDS7.js +1 -0
  40. package/dist/web/{chunk-CGgGK0-O2.js → chunk-Bj7Oze2U2.js} +1 -1
  41. package/dist/web/{chunk-BYalGDdQ.js → chunk-Bjo6eVnk.js} +1 -1
  42. package/dist/web/{chunk-BbKL19W02.js → chunk-BkvskoFt2.js} +1 -1
  43. package/dist/web/chunk-Bn46cQyx.js +1 -0
  44. package/dist/web/chunk-Bn6RkvPA2.js +1 -0
  45. package/dist/web/{chunk-B08xNtqD2.js → chunk-BpZ7MSOP.js} +1 -1
  46. package/dist/web/{chunk-DCE1ImZZ2.js → chunk-Bq2zV2_3.js} +1 -1
  47. package/dist/web/chunk-By2EFyNM.js +1 -0
  48. package/dist/web/{chunk-DQwyRMR6.js → chunk-C-O6GrQC2.js} +1 -1
  49. package/dist/web/{chunk-CtR8WyO5.js → chunk-C0Ceu-vg.js} +1 -1
  50. package/dist/web/chunk-C0gTeWW62.js +1 -0
  51. package/dist/web/{chunk-ClevJX5T2.js → chunk-C19Alcnx2.js} +1 -1
  52. package/dist/web/{chunk-BKWyrwrz.js → chunk-CABvk97t2.js} +1 -1
  53. package/dist/web/chunk-CApvwK4D.js +1 -0
  54. package/dist/web/chunk-CCkaRRSy.js +1 -0
  55. package/dist/web/chunk-CCqlW8pS2.js +3 -0
  56. package/dist/web/chunk-CCr_R2Cg.js +1 -0
  57. package/dist/web/chunk-CDK48Khc.js +1 -0
  58. package/dist/web/chunk-CDS6LjBz2.js +1 -0
  59. package/dist/web/chunk-CE9WzUCM.js +1 -0
  60. package/dist/web/chunk-CEJjSd8-2.js +1 -0
  61. package/dist/web/{chunk-Ce_TeGo52.js → chunk-CG4Kbo1n2.js} +1 -1
  62. package/dist/web/chunk-CGfyD3XX2.js +1 -0
  63. package/dist/web/chunk-CK6Sjqig.js +1 -0
  64. package/dist/web/chunk-CKFB1V-p2.js +1 -0
  65. package/dist/web/chunk-CL02A9wI.js +1 -0
  66. package/dist/web/{chunk-CrhlmMPy2.js → chunk-CLHj5Ycx2.js} +1 -1
  67. package/dist/web/chunk-CLZ5xsSQ2.js +1 -0
  68. package/dist/web/{chunk-JUTCkl5C2.js → chunk-CMvRZBpn.js} +1 -1
  69. package/dist/web/chunk-CNfmNEak.js +1 -0
  70. package/dist/web/chunk-COTrF1xY2.js +1 -0
  71. package/dist/web/{chunk-CC05ZHq-.js → chunk-COXN76fu2.js} +1 -1
  72. package/dist/web/{chunk-BkKRFLuX2.js → chunk-CPHUl7N2.js} +1 -1
  73. package/dist/web/chunk-CUqj_Bxs2.js +1 -0
  74. package/dist/web/{chunk-C2gUrdSR2.js → chunk-CVHqiS63.js} +1 -1
  75. package/dist/web/chunk-CV_fLVFT.js +1 -0
  76. package/dist/web/{chunk-CJKvPHwX.js → chunk-CYGyIy7J.js} +1 -1
  77. package/dist/web/chunk-CYRUKYKv2.js +1 -0
  78. package/dist/web/{chunk-xlLlHW0G2.js → chunk-C_QyIKvy.js} +1 -1
  79. package/dist/web/chunk-Ca3lwqEF.js +1 -0
  80. package/dist/web/chunk-CaJrmM9V.js +1 -0
  81. package/dist/web/{chunk-Ok502fV82.js → chunk-CfcCxe_k.js} +1 -1
  82. package/dist/web/chunk-Ck6cItVE2.js +2 -0
  83. package/dist/web/{chunk-S5Gmkpdy2.js → chunk-CkWd-yMn.js} +1 -1
  84. package/dist/web/{chunk-C7DvmZKC.js → chunk-CmokTGIG.js} +1 -1
  85. package/dist/web/chunk-CpXqQPuw.js +1 -0
  86. package/dist/web/{chunk-Dyia17vy.js → chunk-CtmP6l7_2.js} +1 -1
  87. package/dist/web/chunk-CubfQf-X2.js +1 -0
  88. package/dist/web/chunk-CuepVIkm2.js +1 -0
  89. package/dist/web/chunk-CvMAjyvr2.js +1 -0
  90. package/dist/web/chunk-CvsVlcIU2.js +1 -0
  91. package/dist/web/chunk-CwzCbuXH.js +1 -0
  92. package/dist/web/{chunk-BxQ7up-t.js → chunk-Cx07K71K.js} +1 -1
  93. package/dist/web/chunk-D-VHaopx.js +1 -0
  94. package/dist/web/chunk-D1DvlGbP.js +1 -0
  95. package/dist/web/{chunk-CfAqWkFp.js → chunk-D1wrPwB5.js} +1 -1
  96. package/dist/web/{chunk-BbWEBemE.js → chunk-D3XjW5Cm.js} +1 -1
  97. package/dist/web/{chunk-DRgIjFR6.js → chunk-D5MFwK9L.js} +1 -1
  98. package/dist/web/{chunk-CjtJKrza.js → chunk-D5qmP2Wu.js} +2 -2
  99. package/dist/web/{chunk-BbbRo5jM2.js → chunk-D6k6pmdU.js} +1 -1
  100. package/dist/web/chunk-D8kEdb5y2.js +1 -0
  101. package/dist/web/chunk-D8t0s8LD.js +1 -0
  102. package/dist/web/{chunk-Z9CNux5n2.js → chunk-D8xHm8jb2.js} +1 -1
  103. package/dist/web/{chunk-BMYHfrEK.js → chunk-D97UUzIx.js} +1 -1
  104. package/dist/web/chunk-DB6sOjsn2.js +1 -0
  105. package/dist/web/{chunk-D4J7xo6v.js → chunk-DDCyjjcE.js} +1 -1
  106. package/dist/web/chunk-DEXzwHB0.js +1 -0
  107. package/dist/web/{chunk-DODMV1QO.js → chunk-DGbo0App2.js} +1 -1
  108. package/dist/web/chunk-DIBFSF2Z.js +1 -0
  109. package/dist/web/{chunk-bP01prsY.js → chunk-DIJSXeQC2.js} +1 -1
  110. package/dist/web/{chunk-CvjKWUFl.js → chunk-DKlxu0GP2.js} +1 -1
  111. package/dist/web/{chunk-BtRCqgfa.js → chunk-DM4Wc9U7.js} +1 -1
  112. package/dist/web/{chunk-DUJbqlfC.js → chunk-DM5aibnW.js} +1 -1
  113. package/dist/web/chunk-DMXgU6Nc2.js +1 -0
  114. package/dist/web/chunk-DMskLhpk2.js +1 -0
  115. package/dist/web/{chunk-HhmMH02E.js → chunk-DOCau85G2.js} +1 -1
  116. package/dist/web/{chunk-B86wqImw.js → chunk-DOinRyX_2.js} +1 -1
  117. package/dist/web/chunk-DQp-2GVv.js +1 -0
  118. package/dist/web/chunk-DQr_9Q6T.js +1 -0
  119. package/dist/web/chunk-DSpA-ZPx.js +1 -0
  120. package/dist/web/chunk-DTPC4JtI2.js +1 -0
  121. package/dist/web/chunk-DURq7J8U2.js +1 -0
  122. package/dist/web/chunk-DVJ4YZuU.js +1 -0
  123. package/dist/web/chunk-DVyDnsGh.js +1 -0
  124. package/dist/web/{chunk-oS95kAu6.js → chunk-DXvlXoVT2.js} +1 -1
  125. package/dist/web/{chunk-CHUMIo442.js → chunk-DZgMGE6C.js} +1 -1
  126. package/dist/web/{chunk-BK0Mi7Tk.js → chunk-DZgf7AIe.js} +1 -1
  127. package/dist/web/{chunk-CBXOl0VL.js → chunk-D_8jIApo.js} +1 -1
  128. package/dist/web/chunk-D_vyhgGx.js +1 -0
  129. package/dist/web/chunk-Db2zQ-8C.js +1 -0
  130. package/dist/web/{chunk-BEAkjhZc2.js → chunk-DboSVJMM.js} +1 -1
  131. package/dist/web/chunk-DdOc1fs-.js +1 -0
  132. package/dist/web/chunk-DddDKWSn2.js +1 -0
  133. package/dist/web/{chunk-DAdKllIN.js → chunk-DerJPaBw.js} +1 -1
  134. package/dist/web/chunk-Dh86w63y.js +1 -0
  135. package/dist/web/{chunk-DXsw8_Za2.js → chunk-DhLlQTD-2.js} +1 -1
  136. package/dist/web/{chunk-9qDelKdu.js → chunk-DhkjPUn4.js} +1 -1
  137. package/dist/web/{chunk-BAKoExNF.js → chunk-Di9FA_QV.js} +1 -1
  138. package/dist/web/chunk-DjwvqY3z2.js +1 -0
  139. package/dist/web/{chunk-CH-_LXUF.js → chunk-Dl4EbYnM2.js} +1 -1
  140. package/dist/web/chunk-Dl4V93zm2.js +1 -0
  141. package/dist/web/{chunk-CsiZwjWr2.js → chunk-Dns8uMf32.js} +1 -1
  142. package/dist/web/chunk-Dnzjseqf2.js +1 -0
  143. package/dist/web/chunk-DpI44v1z.js +1 -0
  144. package/dist/web/{chunk-BqIPzI6E2.js → chunk-DpLF2wJ62.js} +1 -1
  145. package/dist/web/chunk-Dqhs2Pyw2.js +1 -0
  146. package/dist/web/{chunk-BWNhkOOr.js → chunk-DsaNNeZe.js} +1 -1
  147. package/dist/web/{chunk-GjZTRlHL.js → chunk-DubWLqvO.js} +1 -1
  148. package/dist/web/{chunk-DibPYvNu.js → chunk-Fc120Hsi2.js} +1 -1
  149. package/dist/web/{chunk-B23x0ZHj2.js → chunk-HmRGBt692.js} +1 -1
  150. package/dist/web/chunk-IlM3eTPp2.js +1 -0
  151. package/dist/web/chunk-IzGdqlW82.js +1 -0
  152. package/dist/web/{chunk-u_CBgBep.js → chunk-MpUdRrak2.js} +1 -1
  153. package/dist/web/{chunk-BlE9HnAo.js → chunk-NDpjbcAr2.js} +1 -1
  154. package/dist/web/chunk-P1du2kWg2.js +1 -0
  155. package/dist/web/{chunk-BCemdpJW.js → chunk-POMKwNf_.js} +1 -1
  156. package/dist/web/chunk-PqGGk0JD.js +1 -0
  157. package/dist/web/{chunk-BG9HC5MH2.js → chunk-RIi7_iVg.js} +1 -1
  158. package/dist/web/chunk-SZJG1lFa2.js +1 -0
  159. package/dist/web/{chunk-jEvWOBug.js → chunk-WNYFaDlu2.js} +1 -1
  160. package/dist/web/{chunk-Cx_tkq5a.js → chunk-XtjMOmku2.js} +1 -1
  161. package/dist/web/chunk-XvyWOb2Q.js +1 -0
  162. package/dist/web/{chunk-BPI0E5qw.js → chunk-ZcJhJsoo.js} +1 -1
  163. package/dist/web/{chunk-Dk7Fe34Y.js → chunk-aW8Vltn22.js} +1 -1
  164. package/dist/web/chunk-a_Va_Nj7.js +1 -0
  165. package/dist/web/{chunk-D83vXRZS2.js → chunk-enci06qG.js} +1 -1
  166. package/dist/web/chunk-fYJ7OBkh.js +1 -0
  167. package/dist/web/{chunk-THRzZN4s.js → chunk-k6TIcaIA.js} +1 -1
  168. package/dist/web/{chunk-BsXdvb75.js → chunk-nC_XlFOG.js} +1 -1
  169. package/dist/web/{chunk-DzxhjLIR.js → chunk-niXXbm7H.js} +1 -1
  170. package/dist/web/chunk-owvOEsA9.js +1 -0
  171. package/dist/web/{chunk-D8ywkT0Z2.js → chunk-pV57uiBu2.js} +1 -1
  172. package/dist/web/{chunk-CdEOFR_J.js → chunk-qKosqkwC.js} +1 -1
  173. package/dist/web/{chunk-BMsK7VjB2.js → chunk-r6H-BfOd.js} +1 -1
  174. package/dist/web/chunk-tDREPM-0.js +1 -0
  175. package/dist/web/{chunk-78yNgJiB.js → chunk-xTX16tt2.js} +1 -1
  176. package/dist/web/chunk-y0Vyi0HZ.js +1 -0
  177. package/dist/web/chunk-yfBrkklv.js +1 -0
  178. package/dist/web/index.csr.html +1 -1
  179. package/dist/web/{main-AJD2LGCE.js → main-F7D3L737.js} +4 -4
  180. package/package.json +1 -1
  181. package/dist/web/chunk-0C-62od6.js +0 -1
  182. package/dist/web/chunk-B1Kpw1um2.js +0 -1
  183. package/dist/web/chunk-B43WHzJp.js +0 -1
  184. package/dist/web/chunk-B6BtInzP2.js +0 -1
  185. package/dist/web/chunk-BAjZiy9u2.js +0 -1
  186. package/dist/web/chunk-BE8oALxd.js +0 -1
  187. package/dist/web/chunk-BIydbtyu.js +0 -1
  188. package/dist/web/chunk-BMU6gPN0.js +0 -1
  189. package/dist/web/chunk-BRUZgvLR2.js +0 -1
  190. package/dist/web/chunk-BSxXPdhz2.js +0 -1
  191. package/dist/web/chunk-BTDByxsO2.js +0 -1
  192. package/dist/web/chunk-BUnVNwR0.js +0 -1
  193. package/dist/web/chunk-BV-2_l7u2.js +0 -1
  194. package/dist/web/chunk-B_pX979y.js +0 -1
  195. package/dist/web/chunk-Ba4cFLiE2.js +0 -1
  196. package/dist/web/chunk-BaLdnNAA.js +0 -1
  197. package/dist/web/chunk-BhCP8fQA.js +0 -1
  198. package/dist/web/chunk-BhwbhxlY2.js +0 -1
  199. package/dist/web/chunk-Bjio-Q3F.js +0 -1
  200. package/dist/web/chunk-BjiyoDeK2.js +0 -1
  201. package/dist/web/chunk-BnPSwNBN.js +0 -1
  202. package/dist/web/chunk-BqbhE2jJ.js +0 -1
  203. package/dist/web/chunk-BrRhr7VS.js +0 -1
  204. package/dist/web/chunk-Bt1ivJuj2.js +0 -1
  205. package/dist/web/chunk-BtH61zrc.js +0 -1
  206. package/dist/web/chunk-BuKqE_YG2.js +0 -1
  207. package/dist/web/chunk-ByBw4qTD.js +0 -1
  208. package/dist/web/chunk-ByfP_6io2.js +0 -1
  209. package/dist/web/chunk-Bylz8GTy2.js +0 -1
  210. package/dist/web/chunk-C1jIGjiG.js +0 -1
  211. package/dist/web/chunk-C2WwmFiS.js +0 -1
  212. package/dist/web/chunk-C3v6o8sk.js +0 -1
  213. package/dist/web/chunk-C7TzEeP_2.js +0 -1
  214. package/dist/web/chunk-C8AJBuJL2.js +0 -1
  215. package/dist/web/chunk-C9_g77K0.js +0 -1
  216. package/dist/web/chunk-CAr--Z8G2.js +0 -1
  217. package/dist/web/chunk-CIIIDIUz.js +0 -1
  218. package/dist/web/chunk-CUvLKCob2.js +0 -1
  219. package/dist/web/chunk-CV-g60E82.js +0 -1
  220. package/dist/web/chunk-CV1Zh4JH.js +0 -1
  221. package/dist/web/chunk-CVZQi-q62.js +0 -1
  222. package/dist/web/chunk-CY4lfBdp2.js +0 -1
  223. package/dist/web/chunk-Cc534gtY.js +0 -1
  224. package/dist/web/chunk-CcvGqiZH.js +0 -1
  225. package/dist/web/chunk-CdDlz5SQ2.js +0 -1
  226. package/dist/web/chunk-CdeX3SOP.js +0 -1
  227. package/dist/web/chunk-CgThkMbX2.js +0 -1
  228. package/dist/web/chunk-Chasvinb.js +0 -1
  229. package/dist/web/chunk-CihZnkoG2.js +0 -1
  230. package/dist/web/chunk-ClYiqUra.js +0 -1
  231. package/dist/web/chunk-CmhHSFX72.js +0 -1
  232. package/dist/web/chunk-CsdHWYnL.js +0 -1
  233. package/dist/web/chunk-CuQMh9Mm2.js +0 -1
  234. package/dist/web/chunk-D2Albj_1.js +0 -1
  235. package/dist/web/chunk-D2P8u0ih2.js +0 -1
  236. package/dist/web/chunk-D2reBpeg2.js +0 -1
  237. package/dist/web/chunk-D6HQPG4L.js +0 -1
  238. package/dist/web/chunk-DFQAtlu22.js +0 -1
  239. package/dist/web/chunk-DIyfCN-v.js +0 -1
  240. package/dist/web/chunk-DK0GFIMr.js +0 -1
  241. package/dist/web/chunk-DMlYYeVV2.js +0 -3
  242. package/dist/web/chunk-DS8Gi0yV2.js +0 -1
  243. package/dist/web/chunk-DSIpVKzQ.js +0 -1
  244. package/dist/web/chunk-DT9HaYIg.js +0 -1
  245. package/dist/web/chunk-DU2qw7-O.js +0 -1
  246. package/dist/web/chunk-DZX7bq5d.js +0 -1
  247. package/dist/web/chunk-DiSSXeWw2.js +0 -1
  248. package/dist/web/chunk-DjQuCwaE.js +0 -1
  249. package/dist/web/chunk-DmBRHpbi2.js +0 -1
  250. package/dist/web/chunk-DpbG_pUL.js +0 -1
  251. package/dist/web/chunk-DqoyE916.js +0 -1
  252. package/dist/web/chunk-DsZGgyjH2.js +0 -1
  253. package/dist/web/chunk-DsbC92Ad2.js +0 -1
  254. package/dist/web/chunk-DuQk8dor2.js +0 -1
  255. package/dist/web/chunk-DxjwnDdp.js +0 -1
  256. package/dist/web/chunk-DyaBJhQt2.js +0 -1
  257. package/dist/web/chunk-H2FHxG4A.js +0 -1
  258. package/dist/web/chunk-KV_4fJOq.js +0 -2
  259. package/dist/web/chunk-NyAoR3GT.js +0 -1
  260. package/dist/web/chunk-Qhc5gzMT.js +0 -1
  261. package/dist/web/chunk-RRqL4AoW2.js +0 -1
  262. package/dist/web/chunk-THDcl3GX2.js +0 -1
  263. package/dist/web/chunk-TRzqZ7nT.js +0 -1
  264. package/dist/web/chunk-VKqyG94L.js +0 -1
  265. package/dist/web/chunk-cxgj3JaU2.js +0 -1
  266. package/dist/web/chunk-dClaCeUx.js +0 -1
  267. package/dist/web/chunk-kb-UZrxn2.js +0 -1
  268. package/dist/web/chunk-mI1TUlml.js +0 -1
  269. package/dist/web/chunk-tiVwZKxb.js +0 -1
  270. package/dist/web/chunk-uYhVCHeh2.js +0 -1
  271. package/dist/web/chunk-ynjMwOUq.js +0 -1
  272. package/dist/web/chunk-z-mghjkB.js +0 -1
  273. /package/dist/web/{chunk-BUoX0svL2.js → chunk-BUoX0svL.js} +0 -0
  274. /package/dist/web/{chunk-Bsy3r41y.js → chunk-Bsy3r41y2.js} +0 -0
  275. /package/dist/web/{chunk-CARNiCDb.js → chunk-CARNiCDb2.js} +0 -0
  276. /package/dist/web/{chunk-CGo7Fepz2.js → chunk-CGo7Fepz.js} +0 -0
  277. /package/dist/web/{chunk-CXHCUTDs2.js → chunk-CXHCUTDs.js} +0 -0
  278. /package/dist/web/{chunk-CtcsJTAS.js → chunk-CtcsJTAS2.js} +0 -0
  279. /package/dist/web/{chunk-WJWN7A_V.js → chunk-WJWN7A_V2.js} +0 -0
  280. /package/dist/web/{chunk-cTGENC4T.js → chunk-cTGENC4T2.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{i as o,n as m$1,t as l}from"./chunk-BwCtja5l.js";import{A as F9,Ai as xt$1,An as du$1,Bn as fD,Br as qre,C as D$1,Cn as ce,Ct as RG,Dt as Rp$1,E as E0,En as cs,Er as oe,Fi as yo$1,Fn as eie,Fr as pt$1,G as J,Gn as fs,Gr as ra$1,Hn as fde,Hr as r6,In as es$1,It as To,J as Jn,Jn as hl$1,Jr as rm$1,Jt as Vm$1,Kr as re,Ln as et,Lt as Ty$1,Mr as pl$1,Ni as ya$1,O as Ee$1,Or as or$1,P as G$1,Pi as yn$1,Qr as s1,Ri as zi$1,Rt as U$1,S as Cr$1,Sr as nm$1,St as RD,T as De$1,Tr as obe,U as Ie$1,Un as fe$1,Ut as Us,Vn as fP,Vt as Uj,W as Ir,Wn as fee,Xn as i2,Xr as rs,Yn as ht$1,Yr as rp$1,Yt as We$1,Z as Jt$1,Zn as ip$1,Zr as rt$1,_r as ma$1,_t as OD,a as $h$1,ai as sy$1,an as Zd$1,b as Cn$1,bt as Pe$1,c as Ah,ct as Me,dt as Nh$1,ei as sX,en as YK,fn as aD$1,g as C0$1,gn as ay$1,gr as ls,h as Bne,hi as ut$1,hn as at,ht as O0,i as $de,in as ZU,jt as Sd$1,ki as xo$1,kn as dr$1,kr as ot$1,li as to$1,m as Bm$1,mi as us,mr as le,ni as sl$1,nn as Yt,nr as jde,nt as L$1,o as AG,on as Zf$1,ot as Lh$1,p as Be,pn as an$1,qr as rie,qt as Vd$1,r as $d$1,ri as sn$1,rn as Z,rr as jn,rt as LV,sn as Zi$1,sr as k$1,st as M0,t as $$1,tr as jb,tt as Kt$1,ui as u$1,ur as kt$1,vn as bn$1,vr as mte,wi as wu$1,wt as RO,xr as nc$1,z as Hde}from"./chunk-BAe_07VM.js";var Gc=wu$1.Struct({status:wu$1.Literal(`ok`)});var fe=wu$1.String.check(wu$1.isPattern(/\S/));var a=wu$1.String.check(wu$1.isPattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/));var Cy=wu$1.Literals([`api-token`,`client`]);var A={affairRead:{code:`affair.read`,audiences:[`api-token`]},affairCreate:{code:`affair.create`,audiences:[`api-token`]},affairUpdate:{code:`affair.update`,audiences:[`api-token`]},integrationConfigure:{code:`integration.configure`,audiences:[]},ledgerRead:{code:`ledger.read`,audiences:[]},ledgerPost:{code:`ledger.post`,audiences:[]},invoiceCredit:{code:`invoice.credit`,audiences:[]},invoiceRefund:{code:`invoice.refund`,audiences:[]},emailDraftManage:{code:`email.draft.manage`,audiences:[]},emailTemplateManage:{code:`email.template.manage`,audiences:[]},emailReminderManage:{code:`email.reminder.manage`,audiences:[]},bankRead:{code:`bank.read`,audiences:[]},bankImport:{code:`bank.import`,audiences:[]},bankReconcile:{code:`bank.reconcile`,audiences:[]},catalogRead:{code:`catalog.read`,audiences:[]},catalogManage:{code:`catalog.manage`,audiences:[]},issuerRead:{code:`issuer.read`,audiences:[]},issuerUpdate:{code:`issuer.update`,audiences:[]},companyRead:{code:`company.read`,audiences:[]},companyUpdate:{code:`company.update`,audiences:[]},conditionRead:{code:`condition.read`,audiences:[]},conditionManage:{code:`condition.manage`,audiences:[]},paymentRead:{code:`payment.read`,audiences:[`api-token`]},integrationManage:{code:`integration.manage`,audiences:[]},clientRead:{code:`client.read`,audiences:[`api-token`]},clientCreate:{code:`client.create`,audiences:[`api-token`]},clientUpdate:{code:`client.update`,audiences:[`api-token`]},clientArchive:{code:`client.archive`,audiences:[`api-token`]},clientAccessManage:{code:`client.access.manage`,audiences:[]},supplierRead:{code:`supplier.read`,audiences:[`api-token`]},supplierCreate:{code:`supplier.create`,audiences:[`api-token`]},supplierUpdate:{code:`supplier.update`,audiences:[`api-token`]},supplierArchive:{code:`supplier.archive`,audiences:[`api-token`]},supplierInvoiceRead:{code:`supplier-invoice.read`,audiences:[`api-token`]},supplierInvoiceCreate:{code:`supplier-invoice.create`,audiences:[`api-token`]},supplierInvoiceUpdate:{code:`supplier-invoice.update`,audiences:[`api-token`]},supplierInvoiceApprove:{code:`supplier-invoice.approve`,audiences:[]},supplierInvoiceAnalyze:{code:`supplier-invoice.analyze`,audiences:[]},supplierInvoicePay:{code:`supplier-invoice.pay`,audiences:[]},quoteRead:{code:`quote.read`,audiences:[`api-token`,`client`]},quoteCreate:{code:`quote.create`,audiences:[`api-token`]},quoteUpdate:{code:`quote.update`,audiences:[`api-token`]},quoteDelete:{code:`quote.delete`,audiences:[`api-token`]},quoteSend:{code:`quote.send`,audiences:[`api-token`]},quoteSign:{code:`quote.sign`,audiences:[]},orderRead:{code:`order.read`,audiences:[`api-token`,`client`]},orderCreate:{code:`order.create`,audiences:[]},orderUpdate:{code:`order.update`,audiences:[]},invoiceRead:{code:`invoice.read`,audiences:[`api-token`,`client`]},invoiceCreate:{code:`invoice.create`,audiences:[`api-token`]},invoiceUpdate:{code:`invoice.update`,audiences:[`api-token`]},invoiceIssue:{code:`invoice.issue`,audiences:[`api-token`]},invoiceSend:{code:`invoice.send`,audiences:[]},invoiceMarkPaid:{code:`invoice.mark-paid`,audiences:[`api-token`]},invoiceVoid:{code:`invoice.void`,audiences:[`api-token`]},templateRead:{code:`template.read`,audiences:[]},templateSelect:{code:`template.select`,audiences:[]},documentRender:{code:`document.render`,audiences:[]},documentDownload:{code:`document.download`,audiences:[`api-token`,`client`]},userRead:{code:`user.read`,audiences:[]},userCreate:{code:`user.create`,audiences:[]},userUpdate:{code:`user.update`,audiences:[]},roleRead:{code:`role.read`,audiences:[]},roleManage:{code:`role.manage`,audiences:[]},sessionManage:{code:`session.manage`,audiences:[]},apiTokenManage:{code:`api-token.manage`,audiences:[]},auditRead:{code:`audit.read`,audiences:[]},accountingRead:{code:`accounting.read`,audiences:[`api-token`]},accountingWrite:{code:`accounting.write`,audiences:[`api-token`]},accountingValidate:{code:`accounting.validate`,audiences:[]},accountingClose:{code:`accounting.close`,audiences:[]},accountingExport:{code:`accounting.export`,audiences:[`api-token`]},accountingEvidence:{code:`accounting.evidence`,audiences:[`api-token`]},demoReset:{code:`demo.reset`,audiences:[]}};var Kc=t=>{let[r,...o]=t;if(r===void 0)throw new Error(`permission.registry.empty`);return[r,...o]};var ky=t=>t.audiences.some(r=>r===`api-token`);var Ry=t=>t.audiences.some(r=>r===`client`);var ys=Kc(Object.values(A));var OA=Kc(ys.map(({code:t})=>t));var GA=Kc(ys.filter(ky).map(({code:t})=>t));var vy=ys.filter(Ry).map(({code:t})=>t);var Cr=wu$1.Literals(OA);var xs=wu$1.Literals(GA);var Ss={minLength:12,maxLength:256};var kr=wu$1.Literals([`sales`,`purchasing`,`banking`,`accounting`,`tax`,`ai`,`demonstration`]);var se=wu$1.String.check(wu$1.isMaxLength(254),wu$1.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/));var Oe=wu$1.String.check(wu$1.isMinLength(Ss.minLength),wu$1.isMaxLength(Ss.maxLength));var Wc=wu$1.Literals([`client`,`administrator`]);var Jc=wu$1.Struct({email:se,password:Oe});var Yc=wu$1.Struct({currentPassword:Oe,newPassword:Oe});var mo=class extends wu$1.TaggedError()(`PasswordChangeRejected`,{code:wu$1.Literal(`authentication.password_change_rejected`)},{httpApiStatus:409}){};var Vt=wu$1.Struct({expiresAt:wu$1.Int,mode:Wc});var KA=wu$1.Literals([`inline`,`toast`,`snack`]);var $n=wu$1.Struct({theme:wu$1.Literals([`light`,`dark`]),language:wu$1.Literals([`fr`,`en`]),flashMode:KA});var Vc=wu$1.Struct({userId:a,email:se,mode:Wc,permissions:wu$1.UniqueArray(Cr),enabledModules:wu$1.UniqueArray(kr),preferences:$n});var fo=class extends wu$1.TaggedError()(`AuthenticationRejected`,{code:wu$1.Literal(`authentication.invalid_credentials`)},{httpApiStatus:401}){};var ho=class extends wu$1.TaggedError()(`SessionRejected`,{code:wu$1.Literal(`authentication.invalid_session`)},{httpApiStatus:401}){};var go=class extends wu$1.TaggedError()(`AuthenticationRateLimited`,{code:wu$1.Literal(`authentication.rate_limited`)},{httpApiStatus:429}){};var E=class extends wu$1.TaggedError()(`RequestRateLimited`,{code:wu$1.Literal(`request.rate_limited`)},{httpApiStatus:429}){};var he=class extends wu$1.TaggedError()(`RequestInvalidOrigin`,{code:wu$1.Literal(`request.invalid_origin`)},{httpApiStatus:403}){};var Ve=class extends wu$1.TaggedError()(`RequestTooLarge`,{code:wu$1.Literal(`request.too_large`)},{httpApiStatus:413}){};var k=class extends wu$1.TaggedError()(`AuthenticationRequired`,{code:wu$1.Literal(`authentication.required`)},{httpApiStatus:401}){};var v=class extends wu$1.TaggedError()(`PermissionDenied`,{code:wu$1.Literal(`authentication.permission_denied`)},{httpApiStatus:403}){};var by=wu$1.Union([fo,go]);var Ey=wu$1.Union([mo,k,E,he,Ve]);var w=wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/),wu$1.makeFilter(t=>Me.exists(Ty$1.make(t),r=>Ty$1.formatIso(r)===t),{message:`temporal.utc.invalid`}));var Ze=wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}$/));var T=Ze.check(wu$1.makeFilter(t=>Me.exists(Ty$1.make(t),r=>Ty$1.formatIsoDateUtc(r)===t),{message:`invoice.invalid_dates`}));var B=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(0),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var b=B.check(wu$1.isGreaterThan(0));var Rr=wu$1.Struct({description:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),quantityMilli:b,unitPriceCents:B,vatRateBasisPoints:B.check(wu$1.isLessThanOrEqualTo(1e4))});var WA=(t,r)=>(t+r/2n)/r;var ei=wu$1.Struct(m$1(l({id:a,position:B},Rr.fields),{netTotalCents:B,vatTotalCents:B,totalCents:B})).check(wu$1.makeFilter(t=>{let r=WA(BigInt(t.quantityMilli)*BigInt(t.unitPriceCents),1000n),o=WA(r*BigInt(t.vatRateBasisPoints),10000n),n=[];return BigInt(t.netTotalCents)!==r&&n.push({path:[`netTotalCents`],issue:`document.line.net_total.invalid`}),BigInt(t.vatTotalCents)!==o&&n.push({path:[`vatTotalCents`],issue:`document.line.vat_total.invalid`}),BigInt(t.totalCents)!==r+o&&n.push({path:[`totalCents`],issue:`document.line.total.invalid`}),n}));var Zt=wu$1.Array(ei).check(wu$1.isMinLength(1),wu$1.isMaxLength(20),wu$1.makeFilter(t=>{let r=[],o=new Set;for(let[n,i]of t.entries())i.position!==n&&r.push({path:[n,`position`],issue:`document.line.position.invalid`}),o.has(i.id)&&r.push({path:[n,`id`],issue:`document.line.id.duplicate`}),o.add(i.id);return r}));var rt=wu$1.makeFilter(t=>{let r=t.lines.reduce((i,s)=>i+BigInt(s.netTotalCents),0n),o=t.lines.reduce((i,s)=>i+BigInt(s.vatTotalCents),0n),n=[];return BigInt(t.netTotalCents)!==r&&n.push({path:[`netTotalCents`],issue:`document.net_total.invalid`}),BigInt(t.vatTotalCents)!==o&&n.push({path:[`vatTotalCents`],issue:`document.vat_total.invalid`}),BigInt(t.totalCents)!==r+o&&n.push({path:[`totalCents`],issue:`document.total.invalid`}),n});var Zc=wu$1.Literal(`FR`);var U=wu$1.String.check(wu$1.isPattern(/^[A-Z]{3}$/));var _t=U;var JA=wu$1.Literals([`ecb`,`manual`]);var Is=wu$1.Struct({id:a,rateDate:T,functionalCurrency:U,foreignCurrency:U,foreignUnitsPerFunctionalUnitNanos:b,source:JA,importedAt:wu$1.Int,createdByUserId:wu$1.NullOr(a)}).annotate({identifier:`ExchangeRate`});var Cs=wu$1.Array(Is).check(wu$1.isMaxLength(1e4));var _c=wu$1.Struct({rateDate:T,foreignCurrency:U,foreignUnitsPerFunctionalUnitNanos:b}).annotate({identifier:`ExchangeRateManualRequest`});var YA=wu$1.Struct({fiscalYearStartMonth:wu$1.Int.check(wu$1.isBetween({minimum:1,maximum:12})),fiscalYearStartDay:wu$1.Int.check(wu$1.isBetween({minimum:1,maximum:31}))});var VA=wu$1.makeFilter(({fiscalYearStartMonth:t,fiscalYearStartDay:r})=>new Date(Date.UTC(2024,t-1,r)).getUTCMonth()===t-1,{message:`company.fiscal_year_start_invalid`});var ti=wu$1.Struct(m$1(l({jurisdiction:Zc,functionalCurrency:_t,accountingInitialized:wu$1.Boolean},YA.fields),{defaultFiscalYearMonths:wu$1.Literal(12),enabledModules:wu$1.Array(kr).check(wu$1.isUnique()),retentionYears:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(10)),version:wu$1.Int.check(wu$1.isGreaterThan(0)),updatedAt:wu$1.Int})).check(VA).annotate({identifier:`CompanySettings`});var jc=wu$1.Struct(m$1(l({jurisdiction:Zc,functionalCurrency:_t},YA.fields),{enabledModules:wu$1.Array(kr).check(wu$1.isUnique()),retentionYears:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(10)),expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))})).check(VA).annotate({identifier:`CompanySettingsUpdateRequest`});var zc=wu$1.Struct({functionalCurrency:_t,expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))}).annotate({identifier:`AccountingInitializeRequest`});var vr=class extends wu$1.TaggedError()(`CompanySettingsConflict`,{code:wu$1.Literal(`company.settings_conflict`)}){};var yo=class extends wu$1.TaggedError()(`FunctionalCurrencyLocked`,{code:wu$1.Literal(`company.functional_currency_locked`)}){};var xo=class extends wu$1.TaggedError()(`AccountingAlreadyInitialized`,{code:wu$1.Literal(`company.accounting_already_initialized`)}){};var So=class extends wu$1.TaggedError()(`ExchangeRateConflict`,{code:wu$1.Literal(`company.exchange_rate_conflict`)}){};var Io=class extends wu$1.TaggedError()(`ExchangeRateImportFailed`,{code:wu$1.Literal(`company.exchange_rate_import_failed`)}){};var wy=wu$1.Union([k,v,E,vr,yo,xo,So,Io]);var br=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(Number.MIN_SAFE_INTEGER),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var ni=wu$1.String.check(wu$1.isPattern(/^\d{2,20}$/));var $c=wu$1.Literals([`asset`,`liability`,`equity`,`income`,`expense`]);var ii=wu$1.Struct({id:a,code:ni,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),kind:$c,system:wu$1.Boolean,archived:wu$1.Boolean,version:b});var ZA=wu$1.Array(ii).check(wu$1.isMaxLength(1e4));var ep=wu$1.Struct({code:ni,label:ii.fields.label,kind:$c,archived:wu$1.Boolean,expectedVersion:wu$1.NullOr(b)});var Er=wu$1.Struct({id:a,code:wu$1.String.check(wu$1.isPattern(/^[A-Z0-9]{2,10}$/)),label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),kind:wu$1.Literals([`sales`,`purchases`,`bank`,`general`,`opening`]),archived:wu$1.Boolean,version:b});var _A=wu$1.Array(Er);var tp=wu$1.Struct({code:Er.fields.code,label:Er.fields.label,kind:Er.fields.kind,archived:wu$1.Boolean,expectedVersion:wu$1.NullOr(b)});var Ty=wu$1.Literals([`open`,`locked`,`closed`]);var Ht=wu$1.Struct({id:a,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),startsOn:T,endsOn:T,status:Ty,finalClosed:wu$1.Boolean,version:b});var jA=wu$1.Array(Ht);var zA=wu$1.Struct({label:Ht.fields.label,startsOn:T,endsOn:T});var ks=wu$1.Struct({expectedVersion:b});var XA=wu$1.Struct({expectedVersion:b,acknowledgement:Ht.fields.label});var $A=wu$1.Struct({accountId:a,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(240)),debitCents:B,creditCents:B});var By=wu$1.Struct(l({id:a,position:B},$A.fields));var Ly=wu$1.Literals([`draft`,`posted`,`reversed`]);var jt=wu$1.Struct({id:a,requestId:wu$1.String.check(wu$1.isUUID(4)),journalId:a,periodId:a,entryDate:T,reference:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),description:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(240)),currency:U,status:Ly,reversalOfEntryId:wu$1.NullOr(a),version:b,createdAt:wu$1.Int,postedAt:wu$1.NullOr(wu$1.Int),lines:wu$1.Array(By).check(wu$1.isMinLength(2),wu$1.isMaxLength(1e3))});var em=wu$1.Array(jt).check(wu$1.isMaxLength(1e4));var tm=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),journalId:a,periodId:a,entryDate:T,reference:jt.fields.reference,description:jt.fields.description,lines:wu$1.Array($A).check(wu$1.isMinLength(2),wu$1.isMaxLength(1e3))});var rp=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),expectedVersion:b});var zt=wu$1.Struct({startsOn:T,endsOn:T});var op=wu$1.Struct({accountCode:ni,accountLabel:wu$1.String,debitCents:B,creditCents:B,balanceCents:br});var rm=wu$1.Struct({startsOn:T,endsOn:T,rows:wu$1.Array(op),debitCents:B,creditCents:B});var Py=wu$1.Struct({entryId:a,entryDate:T,journalCode:wu$1.String,reference:wu$1.String,description:wu$1.String,accountCode:ni,accountLabel:wu$1.String,lineLabel:wu$1.String,debitCents:B,creditCents:B});var om=wu$1.Struct({startsOn:T,endsOn:T,rows:wu$1.Array(Py)});var ri=wu$1.Struct({kind:$c,rows:wu$1.Array(op),totalCents:br});var nm=wu$1.Struct({startsOn:T,endsOn:T,assets:ri,liabilities:ri,equity:ri,income:ri,expenses:ri,netIncomeCents:br});var Dy=wu$1.Struct({code:wu$1.String,amountCents:br});var im=wu$1.Struct({jurisdiction:wu$1.Literal(`FR`),startsOn:T,endsOn:T,collectedVatCents:br,deductibleVatCents:br,payableVatCents:br,ca3:wu$1.Array(Dy)});var np=wu$1.Literals([`local`,`http`]);var Fy=2e3;var Hy=2e3;var ip=wu$1.Struct({adapter:np,endpoint:wu$1.NullOr(wu$1.String),credentialsPresent:wu$1.Boolean,updatedAt:wu$1.NullOr(wu$1.Int)});var sm=wu$1.Struct({adapter:np,endpoint:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^https:\/\/[^\s/@]+(?:\/[^\s]*)?$/),wu$1.isMaxLength(Fy))),apiKey:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(Hy)))});var sp=wu$1.Struct(l({requestId:wu$1.String.check(wu$1.isUUID(4))},zt.fields));var ap=wu$1.Struct({id:a,requestId:sp.fields.requestId,adapter:np,startsOn:T,endsOn:T,payloadSha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),providerReceipt:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500)),submittedAt:wu$1.Int});var am=wu$1.Array(ap);var My=wu$1.Struct({accountCode:wu$1.String,accountLabel:wu$1.String,debit:wu$1.String,credit:wu$1.String});var cp=wu$1.Struct({csv:wu$1.String.check(wu$1.isMaxLength(5e6)),delimiter:wu$1.Literals([`,`,`;`,` `]),columns:My,entryDate:T});var cm=wu$1.Struct({rows:wu$1.Array(op),debitCents:B,creditCents:B,balanced:wu$1.Boolean});var pm=wu$1.Struct(m$1(l({},cp.fields),{requestId:wu$1.String.check(wu$1.isUUID(4)),journalId:a,periodId:a}));var oi=wu$1.Struct({id:a,entryId:a,fileName:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(255)),mediaType:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),size:b,sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:wu$1.Int});var dm=wu$1.Array(oi);var um=wu$1.Struct({entryId:a,fileName:oi.fields.fileName,mediaType:oi.fields.mediaType,contentBase64:wu$1.String.check(wu$1.isMaxLength(2e7))});var qy=wu$1.Struct({lineId:a,entryId:a,entryDate:T,reference:wu$1.String,accountId:a,accountCode:ni,accountLabel:wu$1.String,lineLabel:wu$1.String,debitCents:B,creditCents:B,letteringCode:wu$1.NullOr(wu$1.String)});var lm=wu$1.Array(qy).check(wu$1.isMaxLength(1e4));var Am=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),lineIds:wu$1.Array(a).check(wu$1.isMinLength(2),wu$1.isMaxLength(1e3))});var mm=wu$1.Struct({id:a,code:wu$1.String,accountId:a,lineIds:wu$1.Array(a),createdAt:wu$1.Int});var Xc=class extends wu$1.TaggedError()(`AccountingConflict`,{code:wu$1.Literals([`accounting.not_found`,`accounting.version_conflict`,`accounting.code_conflict`,`accounting.period_overlap`,`accounting.period_not_open`,`accounting.period_final_closed`,`accounting.period_transition_invalid`,`accounting.period_has_drafts`,`accounting.period_reopen_acknowledgement_invalid`,`accounting.entry_unbalanced`,`accounting.entry_not_draft`,`accounting.entry_not_posted`,`accounting.opening_unbalanced`,`accounting.csv_invalid`,`accounting.lettering_invalid`,`accounting.lettering_conflict`,`accounting.tax_filing_configuration_invalid`,`accounting.tax_filing_failed`,`accounting.encryption_unavailable`])}){};var G=wu$1.Union([k,v,E,Xc]);var wR=50;var TR=30;var BR=100;var LR=180;var PR=120;var DR=240;var FR=48;var fm=wu$1.Struct({clients:wu$1.Int,suppliers:wu$1.Int,affairs:wu$1.Int,quotes:wu$1.Int,supplierInvoices:wu$1.Int,bankTransactions:wu$1.Int,accountingEntries:wu$1.Int});var hm=wu$1.Struct({password:wu$1.String.check(wu$1.isMinLength(1),wu$1.isMaxLength(1024)),confirmed:wu$1.Literal(!0)});var pp=class extends wu$1.TaggedError()(`DemoResetRejected`,{code:wu$1.Literals([`demo.environment_rejected`,`demo.secret_missing`,`demo.password_invalid`])}){};var gm=wu$1.Union([k,v,E,pp]);var dp=wu$1.String.check(wu$1.isMinLength(1),wu$1.isMaxLength(120));var up=wu$1.String.check(wu$1.isMaxLength(2048),wu$1.isPattern(/^(?:\/(?!\/)[^\s]*|https:\/\/[^\s]+)$/));var Rs=wu$1.Struct({name:dp,logoUrl:up,version:wu$1.Int});var lp=wu$1.Struct({name:wu$1.NullOr(dp),logoUrl:wu$1.NullOr(up),expectedVersion:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(0))});var si=class extends wu$1.TaggedError()(`BrandingConflict`,{code:wu$1.Literal(`company.branding_conflict`)}){};var ge=wu$1.String.check(wu$1.isPattern(/^DE-[0-9]{4}-[0-9]{6}$/));var Le=wu$1.String.check(wu$1.isPattern(/^CO-[0-9]{4}-[0-9]{6}$/));var vs=wu$1.String.check(wu$1.isPattern(/^FA-[0-9]{4}-[0-9]{6}$/));var Xt=wu$1.Union([vs,wu$1.String.check(wu$1.isPattern(/^F-[0-9]{6,}$/))]);var wr=wu$1.Struct({timeZone:wu$1.String.check(wu$1.makeFilter(t=>Me.isSome(Ty$1.zoneMakeNamed(t)),{message:`document.calendar.invalid_time_zone`}))});var $t=wu$1.Struct({displayName:fe.check(wu$1.isMaxLength(160)),addressLine1:wu$1.String.check(wu$1.isMaxLength(160)),addressLine2:wu$1.String.check(wu$1.isMaxLength(160)),postalCode:wu$1.String.check(wu$1.isMaxLength(32)),city:wu$1.String.check(wu$1.isMaxLength(120)),country:wu$1.String.check(wu$1.isMaxLength(120)),email:wu$1.String.check(wu$1.isMaxLength(254)),phone:wu$1.String.check(wu$1.isMaxLength(64))});var ft=wu$1.Struct(m$1(l({},$t.fields),{registrationNumber:wu$1.String.check(wu$1.isMaxLength(64)),vatNumber:wu$1.String.check(wu$1.isMaxLength(64))}));var ym=wu$1.Struct({party:wu$1.Literals([`issuer`,`client`]),field:wu$1.Literals([`displayName`,`addressLine1`,`city`,`country`,`email`,`phone`]),reason:wu$1.Literals([`required`,`invalid_email`,`invalid_phone`])});var ot=class extends wu$1.TaggedError()(`DocumentIncomplete`,{code:wu$1.Literal(`document.incomplete`),issues:wu$1.Array(ym).check(wu$1.isMinLength(1),wu$1.isMaxLength(10))},{httpApiStatus:409}){};var Ap=wu$1.Struct({id:a,quoteReference:ge,revisionId:a,kind:wu$1.Literal(`quote-pdf`),contentType:wu$1.Literal(`application/pdf`),byteSize:b,sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:w});var pe=class extends wu$1.TaggedError()(`DocumentNotFound`,{code:wu$1.Literal(`document.not_found`)},{httpApiStatus:404}){};var nt=class extends wu$1.TaggedError()(`QuotePreviewUnavailable`,{code:wu$1.Literal(`quote.preview_unavailable`)},{httpApiStatus:409}){};function gp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lr=gp();function bm(t){Lr=t}var Tr={exec:()=>null};function Co(t){let r=[];return o=>{let n=Math.max(0,Math.min(3,o-1)),i=r[n];return i||(i=t(n),r[n]=i),i}}function N(t,r=``){let o=typeof t==`string`?t:t.source,n={replace:(i,s)=>{let d=typeof s==`string`?s:s.source;return d=d.replace(ye.caret,`$1`),o=o.replace(i,d),n},getRegex:()=>new RegExp(o,r)};return n}var Uy=((t=``)=>{try{return!!new RegExp(`(?<=1)(?<!1)`+t)}catch{return!1}})();var ye={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Co(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Co(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Co(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:Co(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:Co(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Co(t=>new RegExp(`^ {0,${t}}>`))};var Qy=/^(?:[ \t]*(?:\n|$))+/;var Ny=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;var Oy=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;var pi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;var Gy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;var yp=/ {0,3}(?:[*+-]|\d{1,9}[.)])/;var Em=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;var wm=N(Em).replace(/bull/g,yp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex();var Ky=N(Em).replace(/bull/g,yp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();var xp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;var Wy=/^[^\n]+/;var Sp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;var Jy=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Sp).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();var Yy=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,yp).getRegex();var Bs=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`;var Ip=/<!--(?:-?>|[\s\S]*?(?:-->|$))/;var Vy=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ip).replace(`tag`,Bs).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();var Tm=t=>N(xp).replace(`hr`,pi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,t).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Bs).getRegex();var Zy=Tm(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);var _y=Tm(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);var Cp={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,_y).getRegex(),code:Ny,def:Jy,fences:Oy,heading:Gy,hr:pi,html:Vy,lheading:wm,list:Yy,newline:Qy,paragraph:Zy,table:Tr,text:Wy};var xm=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,pi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Bs).getRegex();var zy=m$1(l({},Cp),{lheading:Ky,table:xm,paragraph:N(xp).replace(`hr`,pi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,xm).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Bs).getRegex()});var Xy=m$1(l({},Cp),{html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ip).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Tr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(xp).replace(`hr`,pi).replace(`heading`,` *#{1,6} *[^
1
+ import{i as o,n as m$1,t as l}from"./chunk-BwCtja5l.js";import{A as F9,Ai as xt$1,An as du$1,Bn as fD,Br as qre,C as D$1,Cn as ce,Ct as RG,Dt as Rp$1,E as E0,En as cs,Er as oe,Fi as yo$1,Fn as eie,Fr as pt$1,G as J,Gn as fs,Gr as ra$1,Hn as fde,Hr as r6,In as es$1,It as To,J as Jn,Jn as hl$1,Jr as rm$1,Jt as Vm$1,Kr as re,Ln as et,Lt as Ty$1,Mr as pl$1,Ni as ya$1,O as Ee$1,Or as or$1,P as G$1,Pi as yn$1,Qr as s1,Ri as zi$1,Rt as U$1,S as Cr$1,Sr as nm$1,St as RD,T as De$1,Tr as obe,U as Ie$1,Un as fe$1,Ut as Us,Vn as fP,Vt as Uj,W as Ir,Wn as fee,Xn as i2,Xr as rs,Yn as ht$1,Yr as rp$1,Yt as We$1,Z as Jt$1,Zn as ip$1,Zr as rt$1,_r as ma$1,_t as OD,a as $h$1,ai as sy$1,an as Zd$1,b as Cn$1,bt as Pe$1,c as Ah,ct as Me,dt as Nh$1,ei as sX,en as YK,fn as aD$1,g as C0$1,gn as ay$1,gr as ls,h as Bne,hi as ut$1,hn as at,ht as O0,i as $de,in as ZU,jt as Sd$1,ki as xo$1,kn as dr$1,kr as ot$1,li as to$1,m as Bm$1,mi as us,mr as le,ni as sl$1,nn as Yt,nr as jde,nt as L$1,o as AG,on as Zf$1,ot as Lh$1,p as Be,pn as an$1,qr as rie,qt as Vd$1,r as $d$1,ri as sn$1,rn as Z,rr as jn,rt as LV,sn as Zi$1,sr as k$1,st as M0,t as $$1,tr as jb,tt as Kt$1,ui as u$1,ur as kt$1,vn as bn$1,vr as mte,wi as wu$1,wt as RO,xr as nc$1,z as Hde}from"./chunk-BAe_07VM.js";var Gc=wu$1.Struct({status:wu$1.Literal(`ok`)});var fe=wu$1.String.check(wu$1.isPattern(/\S/));var a=wu$1.String.check(wu$1.isPattern(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/));var Cy=wu$1.Literals([`api-token`,`client`]);var A={affairRead:{code:`affair.read`,audiences:[`api-token`]},affairCreate:{code:`affair.create`,audiences:[`api-token`]},affairUpdate:{code:`affair.update`,audiences:[`api-token`]},integrationConfigure:{code:`integration.configure`,audiences:[]},ledgerRead:{code:`ledger.read`,audiences:[]},ledgerPost:{code:`ledger.post`,audiences:[]},invoiceCredit:{code:`invoice.credit`,audiences:[]},invoiceRefund:{code:`invoice.refund`,audiences:[]},emailDraftManage:{code:`email.draft.manage`,audiences:[]},emailTemplateManage:{code:`email.template.manage`,audiences:[]},emailReminderManage:{code:`email.reminder.manage`,audiences:[]},bankRead:{code:`bank.read`,audiences:[]},bankImport:{code:`bank.import`,audiences:[]},bankReconcile:{code:`bank.reconcile`,audiences:[]},catalogRead:{code:`catalog.read`,audiences:[]},catalogManage:{code:`catalog.manage`,audiences:[]},issuerRead:{code:`issuer.read`,audiences:[]},issuerUpdate:{code:`issuer.update`,audiences:[]},companyRead:{code:`company.read`,audiences:[]},companyUpdate:{code:`company.update`,audiences:[]},conditionRead:{code:`condition.read`,audiences:[]},conditionManage:{code:`condition.manage`,audiences:[]},paymentRead:{code:`payment.read`,audiences:[`api-token`]},integrationManage:{code:`integration.manage`,audiences:[]},clientRead:{code:`client.read`,audiences:[`api-token`]},clientCreate:{code:`client.create`,audiences:[`api-token`]},clientUpdate:{code:`client.update`,audiences:[`api-token`]},clientArchive:{code:`client.archive`,audiences:[`api-token`]},clientAccessManage:{code:`client.access.manage`,audiences:[]},supplierRead:{code:`supplier.read`,audiences:[`api-token`]},supplierCreate:{code:`supplier.create`,audiences:[`api-token`]},supplierUpdate:{code:`supplier.update`,audiences:[`api-token`]},supplierArchive:{code:`supplier.archive`,audiences:[`api-token`]},supplierInvoiceRead:{code:`supplier-invoice.read`,audiences:[`api-token`]},supplierInvoiceCreate:{code:`supplier-invoice.create`,audiences:[`api-token`]},supplierInvoiceUpdate:{code:`supplier-invoice.update`,audiences:[`api-token`]},supplierInvoiceApprove:{code:`supplier-invoice.approve`,audiences:[]},supplierInvoiceAnalyze:{code:`supplier-invoice.analyze`,audiences:[]},supplierInvoicePay:{code:`supplier-invoice.pay`,audiences:[]},quoteRead:{code:`quote.read`,audiences:[`api-token`,`client`]},quoteCreate:{code:`quote.create`,audiences:[`api-token`]},quoteUpdate:{code:`quote.update`,audiences:[`api-token`]},quoteDelete:{code:`quote.delete`,audiences:[`api-token`]},quoteSend:{code:`quote.send`,audiences:[`api-token`]},quoteSign:{code:`quote.sign`,audiences:[]},orderRead:{code:`order.read`,audiences:[`api-token`,`client`]},orderCreate:{code:`order.create`,audiences:[]},orderUpdate:{code:`order.update`,audiences:[]},invoiceRead:{code:`invoice.read`,audiences:[`api-token`,`client`]},invoiceCreate:{code:`invoice.create`,audiences:[`api-token`]},invoiceUpdate:{code:`invoice.update`,audiences:[`api-token`]},invoiceIssue:{code:`invoice.issue`,audiences:[`api-token`]},invoiceSend:{code:`invoice.send`,audiences:[]},invoiceMarkPaid:{code:`invoice.mark-paid`,audiences:[`api-token`]},invoiceVoid:{code:`invoice.void`,audiences:[`api-token`]},templateRead:{code:`template.read`,audiences:[]},templateSelect:{code:`template.select`,audiences:[]},documentRender:{code:`document.render`,audiences:[]},documentDownload:{code:`document.download`,audiences:[`api-token`,`client`]},userRead:{code:`user.read`,audiences:[]},userCreate:{code:`user.create`,audiences:[]},userUpdate:{code:`user.update`,audiences:[]},roleRead:{code:`role.read`,audiences:[]},roleManage:{code:`role.manage`,audiences:[]},sessionManage:{code:`session.manage`,audiences:[]},apiTokenManage:{code:`api-token.manage`,audiences:[]},auditRead:{code:`audit.read`,audiences:[]},accountingRead:{code:`accounting.read`,audiences:[`api-token`]},accountingWrite:{code:`accounting.write`,audiences:[`api-token`]},accountingValidate:{code:`accounting.validate`,audiences:[]},accountingClose:{code:`accounting.close`,audiences:[]},accountingExport:{code:`accounting.export`,audiences:[`api-token`]},accountingEvidence:{code:`accounting.evidence`,audiences:[`api-token`]},demoReset:{code:`demo.reset`,audiences:[]}};var Kc=t=>{let[r,...o]=t;if(r===void 0)throw new Error(`permission.registry.empty`);return[r,...o]};var ky=t=>t.audiences.some(r=>r===`api-token`);var Ry=t=>t.audiences.some(r=>r===`client`);var ys=Kc(Object.values(A));var OA=Kc(ys.map(({code:t})=>t));var GA=Kc(ys.filter(ky).map(({code:t})=>t));var vy=ys.filter(Ry).map(({code:t})=>t);var Cr=wu$1.Literals(OA);var xs=wu$1.Literals(GA);var Ss={minLength:12,maxLength:256};var kr=wu$1.Literals([`sales`,`purchasing`,`banking`,`accounting`,`tax`,`ai`,`demonstration`]);var se=wu$1.String.check(wu$1.isMaxLength(254),wu$1.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/));var Oe=wu$1.String.check(wu$1.isMinLength(Ss.minLength),wu$1.isMaxLength(Ss.maxLength));var Wc=wu$1.Literals([`client`,`administrator`]);var Jc=wu$1.Struct({email:se,password:Oe});var Yc=wu$1.Struct({currentPassword:Oe,newPassword:Oe});var mo=class extends wu$1.TaggedError()(`PasswordChangeRejected`,{code:wu$1.Literal(`authentication.password_change_rejected`)},{httpApiStatus:409}){};var Vt=wu$1.Struct({expiresAt:wu$1.Int,mode:Wc});var KA=wu$1.Literals([`inline`,`toast`,`snack`]);var $n=wu$1.Struct({theme:wu$1.Literals([`light`,`dark`]),language:wu$1.Literals([`fr`,`en`]),flashMode:KA});var Vc=wu$1.Struct({userId:a,email:se,mode:Wc,permissions:wu$1.UniqueArray(Cr),enabledModules:wu$1.UniqueArray(kr),preferences:$n});var fo=class extends wu$1.TaggedError()(`AuthenticationRejected`,{code:wu$1.Literal(`authentication.invalid_credentials`)},{httpApiStatus:401}){};var ho=class extends wu$1.TaggedError()(`SessionRejected`,{code:wu$1.Literal(`authentication.invalid_session`)},{httpApiStatus:401}){};var go=class extends wu$1.TaggedError()(`AuthenticationRateLimited`,{code:wu$1.Literal(`authentication.rate_limited`)},{httpApiStatus:429}){};var E=class extends wu$1.TaggedError()(`RequestRateLimited`,{code:wu$1.Literal(`request.rate_limited`)},{httpApiStatus:429}){};var he=class extends wu$1.TaggedError()(`RequestInvalidOrigin`,{code:wu$1.Literal(`request.invalid_origin`)},{httpApiStatus:403}){};var Ve=class extends wu$1.TaggedError()(`RequestTooLarge`,{code:wu$1.Literal(`request.too_large`)},{httpApiStatus:413}){};var k=class extends wu$1.TaggedError()(`AuthenticationRequired`,{code:wu$1.Literal(`authentication.required`)},{httpApiStatus:401}){};var v=class extends wu$1.TaggedError()(`PermissionDenied`,{code:wu$1.Literal(`authentication.permission_denied`)},{httpApiStatus:403}){};var by=wu$1.Union([fo,go]);var Ey=wu$1.Union([mo,k,E,he,Ve]);var w=wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/),wu$1.makeFilter(t=>Me.exists(Ty$1.make(t),r=>Ty$1.formatIso(r)===t),{message:`temporal.utc.invalid`}));var Ze=wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}$/));var T=Ze.check(wu$1.makeFilter(t=>Me.exists(Ty$1.make(t),r=>Ty$1.formatIsoDateUtc(r)===t),{message:`invoice.invalid_dates`}));var B=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(0),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var b=B.check(wu$1.isGreaterThan(0));var Rr=wu$1.Struct({description:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),quantityMilli:b,unitPriceCents:B,vatRateBasisPoints:B.check(wu$1.isLessThanOrEqualTo(1e4))});var WA=(t,r)=>(t+r/2n)/r;var ei=wu$1.Struct(m$1(l({id:a,position:B},Rr.fields),{netTotalCents:B,vatTotalCents:B,totalCents:B})).check(wu$1.makeFilter(t=>{let r=WA(BigInt(t.quantityMilli)*BigInt(t.unitPriceCents),1000n),o=WA(r*BigInt(t.vatRateBasisPoints),10000n),n=[];return BigInt(t.netTotalCents)!==r&&n.push({path:[`netTotalCents`],issue:`document.line.net_total.invalid`}),BigInt(t.vatTotalCents)!==o&&n.push({path:[`vatTotalCents`],issue:`document.line.vat_total.invalid`}),BigInt(t.totalCents)!==r+o&&n.push({path:[`totalCents`],issue:`document.line.total.invalid`}),n}));var Zt=wu$1.Array(ei).check(wu$1.isMinLength(1),wu$1.isMaxLength(20),wu$1.makeFilter(t=>{let r=[],o=new Set;for(let[n,i]of t.entries())i.position!==n&&r.push({path:[n,`position`],issue:`document.line.position.invalid`}),o.has(i.id)&&r.push({path:[n,`id`],issue:`document.line.id.duplicate`}),o.add(i.id);return r}));var rt=wu$1.makeFilter(t=>{let r=t.lines.reduce((i,s)=>i+BigInt(s.netTotalCents),0n),o=t.lines.reduce((i,s)=>i+BigInt(s.vatTotalCents),0n),n=[];return BigInt(t.netTotalCents)!==r&&n.push({path:[`netTotalCents`],issue:`document.net_total.invalid`}),BigInt(t.vatTotalCents)!==o&&n.push({path:[`vatTotalCents`],issue:`document.vat_total.invalid`}),BigInt(t.totalCents)!==r+o&&n.push({path:[`totalCents`],issue:`document.total.invalid`}),n});var Zc=wu$1.Literal(`FR`);var U=wu$1.String.check(wu$1.isPattern(/^[A-Z]{3}$/));var _t=U;var JA=wu$1.Literals([`ecb`,`manual`]);var Is=wu$1.Struct({id:a,rateDate:T,functionalCurrency:U,foreignCurrency:U,foreignUnitsPerFunctionalUnitNanos:b,source:JA,importedAt:wu$1.Int,createdByUserId:wu$1.NullOr(a)}).annotate({identifier:`ExchangeRate`});var Cs=wu$1.Array(Is).check(wu$1.isMaxLength(1e4));var _c=wu$1.Struct({rateDate:T,foreignCurrency:U,foreignUnitsPerFunctionalUnitNanos:b}).annotate({identifier:`ExchangeRateManualRequest`});var YA=wu$1.Struct({fiscalYearStartMonth:wu$1.Int.check(wu$1.isBetween({minimum:1,maximum:12})),fiscalYearStartDay:wu$1.Int.check(wu$1.isBetween({minimum:1,maximum:31}))});var VA=wu$1.makeFilter(({fiscalYearStartMonth:t,fiscalYearStartDay:r})=>new Date(Date.UTC(2024,t-1,r)).getUTCMonth()===t-1,{message:`company.fiscal_year_start_invalid`});var ti=wu$1.Struct(m$1(l({jurisdiction:Zc,functionalCurrency:_t,accountingInitialized:wu$1.Boolean},YA.fields),{defaultFiscalYearMonths:wu$1.Literal(12),enabledModules:wu$1.Array(kr).check(wu$1.isUnique()),retentionYears:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(10)),version:wu$1.Int.check(wu$1.isGreaterThan(0)),updatedAt:wu$1.Int})).check(VA).annotate({identifier:`CompanySettings`});var jc=wu$1.Struct(m$1(l({jurisdiction:Zc,functionalCurrency:_t},YA.fields),{enabledModules:wu$1.Array(kr).check(wu$1.isUnique()),retentionYears:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(10)),expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))})).check(VA).annotate({identifier:`CompanySettingsUpdateRequest`});var zc=wu$1.Struct({functionalCurrency:_t,expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))}).annotate({identifier:`AccountingInitializeRequest`});var vr=class extends wu$1.TaggedError()(`CompanySettingsConflict`,{code:wu$1.Literal(`company.settings_conflict`)}){};var yo=class extends wu$1.TaggedError()(`FunctionalCurrencyLocked`,{code:wu$1.Literal(`company.functional_currency_locked`)}){};var xo=class extends wu$1.TaggedError()(`AccountingAlreadyInitialized`,{code:wu$1.Literal(`company.accounting_already_initialized`)}){};var So=class extends wu$1.TaggedError()(`ExchangeRateConflict`,{code:wu$1.Literal(`company.exchange_rate_conflict`)}){};var Io=class extends wu$1.TaggedError()(`ExchangeRateImportFailed`,{code:wu$1.Literal(`company.exchange_rate_import_failed`)}){};var wy=wu$1.Union([k,v,E,vr,yo,xo,So,Io]);var br=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(Number.MIN_SAFE_INTEGER),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var ni=wu$1.String.check(wu$1.isPattern(/^\d{2,20}$/));var $c=wu$1.Literals([`asset`,`liability`,`equity`,`income`,`expense`]);var ii=wu$1.Struct({id:a,code:ni,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),kind:$c,system:wu$1.Boolean,archived:wu$1.Boolean,version:b});var ZA=wu$1.Array(ii).check(wu$1.isMaxLength(1e4));var ep=wu$1.Struct({code:ni,label:ii.fields.label,kind:$c,archived:wu$1.Boolean,expectedVersion:wu$1.NullOr(b)});var Er=wu$1.Struct({id:a,code:wu$1.String.check(wu$1.isPattern(/^[A-Z0-9]{2,10}$/)),label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),kind:wu$1.Literals([`sales`,`purchases`,`bank`,`general`,`opening`]),archived:wu$1.Boolean,version:b});var _A=wu$1.Array(Er);var tp=wu$1.Struct({code:Er.fields.code,label:Er.fields.label,kind:Er.fields.kind,archived:wu$1.Boolean,expectedVersion:wu$1.NullOr(b)});var Ty=wu$1.Literals([`open`,`locked`,`closed`]);var Ht=wu$1.Struct({id:a,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),startsOn:T,endsOn:T,status:Ty,finalClosed:wu$1.Boolean,version:b});var jA=wu$1.Array(Ht);var zA=wu$1.Struct({label:Ht.fields.label,startsOn:T,endsOn:T});var ks=wu$1.Struct({expectedVersion:b});var XA=wu$1.Struct({expectedVersion:b,acknowledgement:Ht.fields.label});var $A=wu$1.Struct({accountId:a,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(240)),debitCents:B,creditCents:B});var By=wu$1.Struct(l({id:a,position:B},$A.fields));var Ly=wu$1.Literals([`draft`,`posted`,`reversed`]);var jt=wu$1.Struct({id:a,requestId:wu$1.String.check(wu$1.isUUID(4)),journalId:a,periodId:a,entryDate:T,reference:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),description:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(240)),currency:U,status:Ly,reversalOfEntryId:wu$1.NullOr(a),version:b,createdAt:wu$1.Int,postedAt:wu$1.NullOr(wu$1.Int),lines:wu$1.Array(By).check(wu$1.isMinLength(2),wu$1.isMaxLength(1e3))});var em=wu$1.Array(jt).check(wu$1.isMaxLength(1e4));var tm=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),journalId:a,periodId:a,entryDate:T,reference:jt.fields.reference,description:jt.fields.description,lines:wu$1.Array($A).check(wu$1.isMinLength(2),wu$1.isMaxLength(1e3))});var rp=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),expectedVersion:b});var zt=wu$1.Struct({startsOn:T,endsOn:T});var op=wu$1.Struct({accountCode:ni,accountLabel:wu$1.String,debitCents:B,creditCents:B,balanceCents:br});var rm=wu$1.Struct({startsOn:T,endsOn:T,rows:wu$1.Array(op),debitCents:B,creditCents:B});var Py=wu$1.Struct({entryId:a,entryDate:T,journalCode:wu$1.String,reference:wu$1.String,description:wu$1.String,accountCode:ni,accountLabel:wu$1.String,lineLabel:wu$1.String,debitCents:B,creditCents:B});var om=wu$1.Struct({startsOn:T,endsOn:T,rows:wu$1.Array(Py)});var ri=wu$1.Struct({kind:$c,rows:wu$1.Array(op),totalCents:br});var nm=wu$1.Struct({startsOn:T,endsOn:T,assets:ri,liabilities:ri,equity:ri,income:ri,expenses:ri,netIncomeCents:br});var Dy=wu$1.Struct({code:wu$1.String,amountCents:br});var im=wu$1.Struct({jurisdiction:wu$1.Literal(`FR`),startsOn:T,endsOn:T,collectedVatCents:br,deductibleVatCents:br,payableVatCents:br,ca3:wu$1.Array(Dy)});var np=wu$1.Literals([`local`,`http`]);var Fy=2e3;var Hy=2e3;var ip=wu$1.Struct({adapter:np,endpoint:wu$1.NullOr(wu$1.String),credentialsPresent:wu$1.Boolean,updatedAt:wu$1.NullOr(wu$1.Int)});var sm=wu$1.Struct({adapter:np,endpoint:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^https:\/\/[^\s/@]+(?:\/[^\s]*)?$/),wu$1.isMaxLength(Fy))),apiKey:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(Hy)))});var sp=wu$1.Struct(l({requestId:wu$1.String.check(wu$1.isUUID(4))},zt.fields));var ap=wu$1.Struct({id:a,requestId:sp.fields.requestId,adapter:np,startsOn:T,endsOn:T,payloadSha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),providerReceipt:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500)),submittedAt:wu$1.Int});var am=wu$1.Array(ap);var My=wu$1.Struct({accountCode:wu$1.String,accountLabel:wu$1.String,debit:wu$1.String,credit:wu$1.String});var cp=wu$1.Struct({csv:wu$1.String.check(wu$1.isMaxLength(5e6)),delimiter:wu$1.Literals([`,`,`;`,` `]),columns:My,entryDate:T});var cm=wu$1.Struct({rows:wu$1.Array(op),debitCents:B,creditCents:B,balanced:wu$1.Boolean});var pm=wu$1.Struct(m$1(l({},cp.fields),{requestId:wu$1.String.check(wu$1.isUUID(4)),journalId:a,periodId:a}));var oi=wu$1.Struct({id:a,entryId:a,fileName:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(255)),mediaType:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),size:b,sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:wu$1.Int});var dm=wu$1.Array(oi);var um=wu$1.Struct({entryId:a,fileName:oi.fields.fileName,mediaType:oi.fields.mediaType,contentBase64:wu$1.String.check(wu$1.isMaxLength(2e7))});var qy=wu$1.Struct({lineId:a,entryId:a,entryDate:T,reference:wu$1.String,accountId:a,accountCode:ni,accountLabel:wu$1.String,lineLabel:wu$1.String,debitCents:B,creditCents:B,letteringCode:wu$1.NullOr(wu$1.String)});var lm=wu$1.Array(qy).check(wu$1.isMaxLength(1e4));var Am=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),lineIds:wu$1.Array(a).check(wu$1.isMinLength(2),wu$1.isMaxLength(1e3))});var mm=wu$1.Struct({id:a,code:wu$1.String,accountId:a,lineIds:wu$1.Array(a),createdAt:wu$1.Int});var Xc=class extends wu$1.TaggedError()(`AccountingConflict`,{code:wu$1.Literals([`accounting.not_found`,`accounting.version_conflict`,`accounting.code_conflict`,`accounting.period_overlap`,`accounting.period_not_open`,`accounting.period_final_closed`,`accounting.period_transition_invalid`,`accounting.period_has_drafts`,`accounting.period_reopen_acknowledgement_invalid`,`accounting.entry_unbalanced`,`accounting.entry_not_draft`,`accounting.entry_not_posted`,`accounting.opening_unbalanced`,`accounting.csv_invalid`,`accounting.lettering_invalid`,`accounting.lettering_conflict`,`accounting.tax_filing_configuration_invalid`,`accounting.tax_filing_failed`,`accounting.encryption_unavailable`])}){};var G=wu$1.Union([k,v,E,Xc]);var wR=50;var TR=30;var BR=100;var LR=180;var PR=120;var DR=240;var FR=48;var fm=wu$1.Struct({clients:wu$1.Int,suppliers:wu$1.Int,affairs:wu$1.Int,quotes:wu$1.Int,supplierInvoices:wu$1.Int,bankTransactions:wu$1.Int,accountingEntries:wu$1.Int});var hm=wu$1.Struct({password:wu$1.String.check(wu$1.isMinLength(1),wu$1.isMaxLength(1024)),confirmed:wu$1.Literal(!0)});var pp=class extends wu$1.TaggedError()(`DemoResetRejected`,{code:wu$1.Literals([`demo.environment_rejected`,`demo.secret_missing`,`demo.password_conflict`,`demo.password_invalid`])}){};var gm=wu$1.Union([k,v,E,pp]);var dp=wu$1.String.check(wu$1.isMinLength(1),wu$1.isMaxLength(120));var up=wu$1.String.check(wu$1.isMaxLength(2048),wu$1.isPattern(/^(?:\/(?!\/)[^\s]*|https:\/\/[^\s]+)$/));var Rs=wu$1.Struct({name:dp,logoUrl:up,version:wu$1.Int});var lp=wu$1.Struct({name:wu$1.NullOr(dp),logoUrl:wu$1.NullOr(up),expectedVersion:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(0))});var si=class extends wu$1.TaggedError()(`BrandingConflict`,{code:wu$1.Literal(`company.branding_conflict`)}){};var ge=wu$1.String.check(wu$1.isPattern(/^DE-[0-9]{4}-[0-9]{6}$/));var Le=wu$1.String.check(wu$1.isPattern(/^CO-[0-9]{4}-[0-9]{6}$/));var vs=wu$1.String.check(wu$1.isPattern(/^FA-[0-9]{4}-[0-9]{6}$/));var Xt=wu$1.Union([vs,wu$1.String.check(wu$1.isPattern(/^F-[0-9]{6,}$/))]);var wr=wu$1.Struct({timeZone:wu$1.String.check(wu$1.makeFilter(t=>Me.isSome(Ty$1.zoneMakeNamed(t)),{message:`document.calendar.invalid_time_zone`}))});var $t=wu$1.Struct({displayName:fe.check(wu$1.isMaxLength(160)),addressLine1:wu$1.String.check(wu$1.isMaxLength(160)),addressLine2:wu$1.String.check(wu$1.isMaxLength(160)),postalCode:wu$1.String.check(wu$1.isMaxLength(32)),city:wu$1.String.check(wu$1.isMaxLength(120)),country:wu$1.String.check(wu$1.isMaxLength(120)),email:wu$1.String.check(wu$1.isMaxLength(254)),phone:wu$1.String.check(wu$1.isMaxLength(64))});var ft=wu$1.Struct(m$1(l({},$t.fields),{registrationNumber:wu$1.String.check(wu$1.isMaxLength(64)),vatNumber:wu$1.String.check(wu$1.isMaxLength(64))}));var ym=wu$1.Struct({party:wu$1.Literals([`issuer`,`client`]),field:wu$1.Literals([`displayName`,`addressLine1`,`city`,`country`,`email`,`phone`]),reason:wu$1.Literals([`required`,`invalid_email`,`invalid_phone`])});var ot=class extends wu$1.TaggedError()(`DocumentIncomplete`,{code:wu$1.Literal(`document.incomplete`),issues:wu$1.Array(ym).check(wu$1.isMinLength(1),wu$1.isMaxLength(10))},{httpApiStatus:409}){};var Ap=wu$1.Struct({id:a,quoteReference:ge,revisionId:a,kind:wu$1.Literal(`quote-pdf`),contentType:wu$1.Literal(`application/pdf`),byteSize:b,sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:w});var pe=class extends wu$1.TaggedError()(`DocumentNotFound`,{code:wu$1.Literal(`document.not_found`)},{httpApiStatus:404}){};var nt=class extends wu$1.TaggedError()(`QuotePreviewUnavailable`,{code:wu$1.Literal(`quote.preview_unavailable`)},{httpApiStatus:409}){};function gp(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lr=gp();function bm(t){Lr=t}var Tr={exec:()=>null};function Co(t){let r=[];return o=>{let n=Math.max(0,Math.min(3,o-1)),i=r[n];return i||(i=t(n),r[n]=i),i}}function N(t,r=``){let o=typeof t==`string`?t:t.source,n={replace:(i,s)=>{let d=typeof s==`string`?s:s.source;return d=d.replace(ye.caret,`$1`),o=o.replace(i,d),n},getRegex:()=>new RegExp(o,r)};return n}var Uy=((t=``)=>{try{return!!new RegExp(`(?<=1)(?<!1)`+t)}catch{return!1}})();var ye={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Co(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Co(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Co(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:Co(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:Co(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Co(t=>new RegExp(`^ {0,${t}}>`))};var Qy=/^(?:[ \t]*(?:\n|$))+/;var Ny=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;var Oy=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;var pi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;var Gy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;var yp=/ {0,3}(?:[*+-]|\d{1,9}[.)])/;var Em=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;var wm=N(Em).replace(/bull/g,yp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex();var Ky=N(Em).replace(/bull/g,yp).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();var xp=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;var Wy=/^[^\n]+/;var Sp=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;var Jy=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Sp).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();var Yy=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,yp).getRegex();var Bs=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`;var Ip=/<!--(?:-?>|[\s\S]*?(?:-->|$))/;var Vy=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ip).replace(`tag`,Bs).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();var Tm=t=>N(xp).replace(`hr`,pi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,t).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Bs).getRegex();var Zy=Tm(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);var _y=Tm(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);var Cp={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,_y).getRegex(),code:Ny,def:Jy,fences:Oy,heading:Gy,hr:pi,html:Vy,lheading:wm,list:Yy,newline:Qy,paragraph:Zy,table:Tr,text:Wy};var xm=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,pi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Bs).getRegex();var zy=m$1(l({},Cp),{lheading:Ky,table:xm,paragraph:N(xp).replace(`hr`,pi).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,xm).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Bs).getRegex()});var Xy=m$1(l({},Cp),{html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ip).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Tr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(xp).replace(`hr`,pi).replace(`heading`,` *#{1,6} *[^
2
2
  ]`).replace(`lheading`,wm).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()});var $y=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;var ex=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;var Bm=/^( {2,}|\\)\n(?!\s*$)/;var tx=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;var Mt=/[\p{P}\p{S}]/u;var ko=/[\s\p{P}\p{S}]/u;var di=/[^\s\p{P}\p{S}]/u;var rx=N(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ko).getRegex();var ox=/[\p{Pi}\p{Ps}"']/u;var Lm=/(?!~)[\p{P}\p{S}]/u;var nx=/(?!~)[\s\p{P}\p{S}]/u;var ix=/(?:[^\s\p{P}\p{S}]|~)/u;var sx=N(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Uy?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex();var Pm=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;var ax=N(Pm,`u`).replace(/punct/g,Mt).getRegex();var cx=N(Pm,`u`).replace(/punct/g,Lm).getRegex();var dx=N(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,ox).replace(/punct/g,Mt).getRegex();var Dm=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`;var ux=N(Dm,`gu`).replace(/notPunctSpace/g,di).replace(/punctSpace/g,ko).replace(/punct/g,Mt).getRegex();var lx=N(Dm,`gu`).replace(/notPunctSpace/g,ix).replace(/punctSpace/g,nx).replace(/punct/g,Lm).getRegex();var mx=N(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,di).replace(/punctSpace/g,ko).replace(/punct/g,Mt).getRegex();var fx=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,di).replace(/punctSpace/g,ko).replace(/punct/g,Mt).getRegex();var gx=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,di).replace(/punctSpace/g,ko).replace(/punct/g,Mt).getRegex();var yx=N(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Mt).getRegex();var Sx=N(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,di).replace(/punctSpace/g,ko).replace(/punct/g,Mt).getRegex();var Ix=N(/\\(punct)/,`gu`).replace(/punct/g,Mt).getRegex();var Cx=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();var kx=N(Ip).replace(`(?:-->|$)`,`-->`).getRegex();var Rx=N(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,kx).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();var Es=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;var vx=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Es).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();var Fm=N(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Es).replace(`ref`,Sp).getRegex();var Hm=N(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Sp).getRegex();var bx=N(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Fm).replace(`nolink`,Hm).getRegex();var Sm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;var kp={_backpedal:Tr,anyPunctuation:Ix,autolink:Cx,blockSkip:sx,br:Bm,code:ex,del:Tr,delLDelim:Tr,delRDelim:Tr,emStrongLDelim:ax,emStrongRDelimAst:ux,emStrongRDelimUnd:fx,escape:$y,link:vx,nolink:Hm,punctuation:rx,reflink:Fm,reflinkSearch:bx,tag:Rx,text:tx,url:Tr};var Ex=m$1(l({},kp),{emStrongLDelim:dx,emStrongRDelimAst:mx,emStrongRDelimUnd:gx,link:N(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Es).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Es).getRegex()});var mp=m$1(l({},kp),{emStrongRDelimAst:lx,emStrongLDelim:cx,delLDelim:yx,delRDelim:Sx,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Sm).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:N(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Sm).getRegex()});var wx=m$1(l({},mp),{br:N(Bm).replace(`{2,}`,`*`).getRegex(),text:N(mp.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()});var bs={normal:Cp,gfm:zy,pedantic:Xy};var ai={normal:kp,gfm:mp,breaks:wx,pedantic:Ex};var Tx={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};var Im=t=>Tx[t];function ht(t,r){if(r){if(ye.escapeTest.test(t))return t.replace(ye.escapeReplace,Im)}else if(ye.escapeTestNoEncode.test(t))return t.replace(ye.escapeReplaceNoEncode,Im);return t}function Cm(t){try{t=encodeURI(t).replace(ye.percentDecode,`%`)}catch{return null}return t}function km(t,r){let n=t.replace(ye.findPipe,(s,d,c)=>{let h=!1,y=d;for(;--y>=0&&c[y]===`\\`;)h=!h;return h?`|`:` |`}).split(ye.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),r)if(n.length>r)n.splice(r);else for(;n.length<r;)n.push(``);for(;i<n.length;i++)n[i]=n[i].trim().replace(ye.slashPipe,`|`);return n}function er(t,r,o){let n=t.length;if(n===0)return``;let i=0;for(;i<n;){let s=t.charAt(n-i-1);if(s===r&&!o)i++;else if(s!==r&&o)i++;else break}return t.slice(0,n-i)}function Rm(t){let r=t.split(`
3
3
  `),o=r.length-1;for(;o>=0&&ye.blankLine.test(r[o]);)o--;return r.length-o<=2?t:r.slice(0,o+1).join(`
4
4
  `)}function Bx(t,r){if(t.indexOf(r[1])===-1)return-1;let o=0;for(let n=0;n<t.length;n++)if(t[n]===`\\`)n++;else if(t[n]===r[0])o++;else if(t[n]===r[1]&&(o--,o<0))return n;return o>0?-2:-1}function Lx(t,r=0){let o=r,n=``;for(let i of t)if(i===` `){let s=4-o%4;n+=` `.repeat(s),o+=s}else n+=i,o++;return n}function vm(t,r,o,n,i){let s=r.href,d=r.title||null,c=t[1].replace(i.other.outputLinkReplace,`$1`),h=t[0].charAt(0)===`!`;n.state.inLink=!0;let y=n.state.linkEmitted,C=n.state.inRawBlock;n.state.linkEmitted=!1;let l=n.inlineTokens(c),R=n.state.linkEmitted;if(n.state.linkEmitted=y,n.state.inLink=!1,!h){if(R){n.state.inRawBlock=C;return}n.state.linkEmitted=!0}return{type:h?`image`:`link`,raw:o,href:s,title:d,text:c,tokens:l}}function Px(t,r,o){let n=t.match(o.other.indentCodeCompensation);if(n===null)return r;let i=n[1];return r.split(`
@@ -69,5 +69,5 @@ Please report this to https://github.com/markedjs/marked.`,t){let n=`<p>An error
69
69
  `):i.spans.map(s=>s.text).join(``)).join(`
70
70
 
71
71
  `);return o(Dp(t,r.format))};var Nm=t=>t.map(r=>{let o=wp(r.text).replaceAll(`
72
- `,`<br>`),n=r.italic?`<em>${o}</em>`:o;return r.bold?`<strong>${n}</strong>`:n}).join(``);var Jm=t=>t.map(r=>{if(r.kind===`heading`)return`<h${r.level}>${Nm(r.spans)}</h${r.level}>`;if(r.kind===`paragraph`)return`<p>${Nm(r.spans)}</p>`;let o=r.ordered?`ol`:`ul`;return`<${o}${r.ordered&&r.start!==1?` start="${r.start}"`:``}>${r.items.map(i=>`<li>${Jm(i)}</li>`).join(``)}</${o}>`}).join(``);var Wx=t=>Jm(Dp(t,`blocks`));var Ds=wu$1.String.check(wu$1.isPattern(/^[0-9a-f]{40}$/));var Ym=wu$1.Struct({name:wu$1.NonEmptyString,version:wu$1.NonEmptyString});var Hp=wu$1.Struct({commit:Ds,packages:wu$1.Array(Ym)});var Vm=wu$1.Literals([`development`,`staging`,`production`]);var Zm=wu$1.Literals([`construction`,`live`]);var Jx=wu$1.Struct({appEnvironment:Vm,sitePhase:Zm,commit:wu$1.NullOr(Ds),githubRepositoryUrl:wu$1.NullOr(wu$1.String)});var _m=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120));var jm=wu$1.String.check(wu$1.isPattern(/^froment_api_v1_[0-7][0-9A-HJKMNP-TV-Z]{25}\.[A-Za-z0-9_-]{43}$/));var Mp=wu$1.Struct({id:a,name:_m,permissions:wu$1.UniqueArray(xs),createdAt:wu$1.Int,expiresAt:wu$1.Int,lastUsedAt:wu$1.NullOr(wu$1.Int),revokedAt:wu$1.NullOr(wu$1.Int),rateLimitPerMinute:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(1),wu$1.isLessThanOrEqualTo(600))});var zm=wu$1.Array(Mp);var qp=wu$1.Struct({items:zm,nextCursor:wu$1.NullOr(a)});var Up=wu$1.Struct({cursor:wu$1.optionalKey(a),limit:wu$1.optionalKey(wu$1.NumberFromString.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(1),wu$1.isLessThanOrEqualTo(100)))});var Qp=wu$1.Struct({name:_m,permissions:wu$1.UniqueArray(xs).check(wu$1.isMinLength(1)),expiresAt:wu$1.Int,rateLimitPerMinute:wu$1.optionalKey(wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(1),wu$1.isLessThanOrEqualTo(600)))});var Fs=wu$1.Struct({token:Mp,secret:jm});var Ro=class extends wu$1.TaggedError()(`ApiTokenNotFound`,{code:wu$1.Literal(`api_token.not_found`)},{httpApiStatus:404}){};var vo=class extends wu$1.TaggedError()(`ApiTokenNameConflict`,{code:wu$1.Literal(`api_token.name_conflict`)},{httpApiStatus:409}){};var bo=class extends wu$1.TaggedError()(`ApiTokenInvalidExpiration`,{code:wu$1.Literal(`api_token.invalid_expiration`)},{httpApiStatus:422}){};var Eo=class extends wu$1.TaggedError()(`ApiTokenInvalidCursor`,{code:wu$1.Literal(`api_token.invalid_cursor`)},{httpApiStatus:400}){};var Yx=wu$1.Union([k,v,E,he,Ve,Ro,vo,bo,Eo]);var Hs=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(0),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var Xm=wu$1.Struct({id:a,reference:Le,quoteId:a,quoteReference:ge,revisionId:a,clientId:a,clientDisplayName:fe,title:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),currency:U,totalCents:Hs,createdAt:w,invoiceId:wu$1.NullOr(a),pdfAvailable:wu$1.Boolean}).annotate({identifier:`OrderSummary`});var Np=wu$1.Array(Xm);var Vx=wu$1.Struct({templateId:wu$1.Literal(`order-default`),templateVersion:wu$1.Literal(1),calendar:wu$1.optionalKey(wr),orderId:a,revisionId:a,orderReference:Le,quoteReference:ge,confirmedAt:w,issuer:ft,client:$t,title:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),conditions:wu$1.String.check(wu$1.isMaxLength(2e3)),conditionsPresentation:wu$1.optionalKey(xe),currency:U,netTotalCents:Hs,vatTotalCents:Hs,totalCents:Hs,lines:Zt}).check(rt);var Op=wu$1.Struct({id:a,orderId:a,orderReference:Le,kind:wu$1.Literal(`order-pdf`),contentType:wu$1.Literal(`application/pdf`),byteSize:wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThan(0)),sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:w});var wo=class extends wu$1.TaggedError()(`OrderNotFound`,{code:wu$1.Literal(`order.not_found`)},{httpApiStatus:404}){};var Ms=wu$1.Literals([`affair.created`,`affair.updated`,`affair.quote-linked`,`bank.ledger-posted`,`bank.ledger-reversed`,`invoice.credited`,`invoice.refund-recorded`,`invoice.credit-allocated`,`invoice.credit-allocation-cancelled`,`invoice.refund-cancelled`,`team.invited`,`team.invitation-cancelled`,`team.joined`,`team.member-updated`,`administrator.bootstrapped`,`api.token-created`,`api.token-revoked`,`api.token-used`,`authentication.login-succeeded`,`email.draft-saved`,`email.template-saved`,`email.template-archived`,`email.reminder-scheduled`,`email.reminder-rejected`,`email.reminder-cancelled`,`email.reminder-processed`,`email.draft-archived`,`authentication.passkey-added`,`authentication.passkey-removed`,`authentication.passkey-login`,`authentication.logout`,`authentication.password-changed`,`authentication.refresh-replay-detected`,`authentication.sessions-revoked`,`authentication.session-revoked`,`client.access-created`,`client.access-replaced`,`client.access-revoked`,`client.archived`,`client.created`,`client.reactivated`,`client.updated`,`supplier.archived`,`supplier.created`,`supplier.reactivated`,`supplier-invoice.created`,`supplier-credit.created`,`supplier-invoice.evidence-added`,`supplier-invoice.evidence-accessed`,`supplier-invoice.updated`,`supplier-invoice.confirmed`,`supplier-invoice.approved`,`supplier-invoice.cancelled`,`supplier-invoice.analysis-settings-updated`,`supplier-invoice.analysis-submitted`,`supplier-payment-batch.created`,`supplier.updated`,`catalog.created`,`catalog.updated`,`document.rendered`,`invoice.created`,`invoice.issued`,`invoice.marked-paid`,`invoice.payment-recorded`,`invoice.payment-cancelled`,`invoice.revised`,`invoice.voided`,`issuer.updated`,`company.settings-updated`,`company.accounting-initialized`,`company.exchange-rate-imported`,`company.exchange-rate-overridden`,`accounting.account-saved`,`accounting.journal-saved`,`accounting.period-created`,`accounting.period-locked`,`accounting.period-closed`,`accounting.period-final-closed`,`accounting.period-reopened`,`accounting.entry-created`,`accounting.entry-posted`,`accounting.entry-reversed`,`accounting.evidence-added`,`accounting.evidence-accessed`,`accounting.lettered`,`accounting.tax-filing-settings-updated`,`accounting.tax-filed`,`demo.reset`,`role.created`,`role.updated`,`role.deleted`,`integration.requested`,`integration.processed`,`bank.imported`,`bank.matched`,`bank.supplier-matched`,`bank.supplier-unmatched`,`bank.unmatched`,`quote.accepted`,`quote.cancelled`,`quote.condition-preset-created`,`quote.condition-preset-deleted`,`quote.condition-preset-updated`,`quote.created`,`quote.expired`,`quote.revised`,`quote.sent`,`quote.link-replaced`]);var qs=wu$1.String.check(wu$1.isPattern(/^[a-z]+(?:-[a-z]+)*$/),wu$1.isMaxLength(40));var $m=wu$1.Record(wu$1.String.check(wu$1.isPattern(/^[a-z][a-zA-Z0-9]*$/),wu$1.isMaxLength(40)),wu$1.String.check(wu$1.isMaxLength(500)));var _e=wu$1.Struct({id:a,action:Ms,actorUserId:wu$1.NullOr(a),resourceType:qs,resourceId:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),requestId:wu$1.NullOr(wu$1.String.check(wu$1.isUUID(4))),traceId:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{32}$/))),spanId:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{16}$/))),occurredAt:wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/)),metadata:$m});var ki={};o(ki,{AdditionalSchemas:()=>Ci,isHttpApi:()=>WI,make:()=>YI,reflect:()=>wd});var u={};o(u,{delete:()=>OI,get:()=>qI,getErrorSchemas:()=>Ii,getPayloadSchemas:()=>bd,getSuccessSchemas:()=>Si,head:()=>GI,isHttpApiEndpoint:()=>EI,make:()=>nr,options:()=>KI,patch:()=>NI,post:()=>UI,put:()=>QI});var Gp=`~effect/http/UrlParams`;m$1(l({},ut$1),{[Gp]:Gp,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[We$1](t){return eS(this,t)},[Be](){return rs(this.params.flat())}});var eS=Jt$1((t,r)=>tS(t.params,r.params));var tS=mte(sX([hl$1(),hl$1()]));var Wp=`~effect/http/HttpBody`;fs(`HttpBodyError`);var Jp=class{[Wp];constructor(){this[Wp]=Wp}[De$1](){return this.toJSON()}toString(){return Z(this,{ignoreToString:!0})}};var Yp=class extends Jp{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}};var nf=new Yp;var sf=Symbol.for(`~effect/http/Headers`);var li=Object.defineProperties(Object.create(null),{[sf]:{value:sf},[$d$1]:{value(t){return iS(this,rt$1(t,sS))}},toJSON:{value(){return Zi$1(this)}},[We$1]:{value(t){return nS(this,t)}},[Be]:{value(){return jb(this)}},toString:{value:F9.toString},[De$1]:{value:F9[De$1]}});var oS=t=>Object.assign(Object.create(li),t);var nS=fee(hl$1());var Zp=Object.create(li);var Dr=t=>{if(t===void 0)return Zp;if(Symbol.iterator in t){let o=Object.create(li);for(let[n,i]of t)o[n.toLowerCase()]=i;return o}let r=Object.create(li);for(let[o,n]of Object.entries(t))Array.isArray(n)?r[o.toLowerCase()]=n.join(`, `):n!==void 0&&(r[o.toLowerCase()]=n);return r};var af=t=>Object.setPrototypeOf(t,li);u$1(2,(t,r)=>{let o=oS(t);return Object.assign(o,r),o});var iS=u$1(2,(t,r)=>{let o=l({},t),n=i=>{if(typeof i==`string`){let s=i.toLowerCase();s in t&&(o[s]=Ah(t[s]))}else for(let s in t)i.test(s)&&(o[s]=Ah(t[s]))};if(Array.isArray(r))for(let i=0;i<r.length;i++)n(r[i]);else n(r);return o});var sS=et(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]});var pf=`~effect/http/Cookies`;var df=`~effect/http/Cookies/Cookie`;fs(`CookieError`);var aS=m$1(l({[pf]:pf},F9),{toJSON(){return{_id:`effect/Cookies`,cookies:Vd$1(this.cookies,t=>t.toJSON())}},pipe(){return re(this,arguments)}});var cS=t=>{let r=Object.create(aS);return r.cookies=t,r};var mf=t=>{let r={};for(let o of t)L$1(r,o.name,o);return cS(r)};var ff=mf([]);m$1(l({[df]:df},F9),{toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}});fs(`HttpClientError`);fs(`DecodeError`);fs(`EmptyBodyError`);var Ns=t=>t!==`GET`&&t!==`HEAD`&&t!==`OPTIONS`&&t!==`TRACE`;et(`effect/http/HttpIncomingMessage/MaxBodySize`,{defaultValue:()=>{}});var kf=`~effect/http/HttpServerResponse`;var te=t=>yS({status:t?.status??204,statusText:t?.statusText,headers:t?.headers?Dr(t.headers):void 0,cookies:t?.cookies});new TextDecoder;var gS=m$1(l({},ut$1),{[kf]:kf,[i2]:!0,toJSON(){return{_id:`HttpServerResponse`,status:this.status,statusText:this.statusText,headers:Zi$1(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}});var yS=(t,r=!1)=>{let o=Object.create(gS);if(o.status=t.status,o.statusText=t.statusText,o.cookies=t.cookies??ff,o.body=t.body??nf,o.body._tag!==`Empty`&&(o.body.contentType||o.body.contentLength!==void 0)){let n=af(l({},t.headers));o.body.contentType&&(!r||n[`content-type`]===void 0)&&(n[`content-type`]=o.body.contentType),o.body.contentLength!==void 0&&(!r||n[`content-length`]===void 0)&&(n[`content-length`]=o.body.contentLength.toString()),o.headers=n}else o.headers=t.headers??Zp;return o};var z=`~effect/http/HttpServerRespondable`;fs(`HttpServerError`);fs(`RequestParseError`);fs(`RouteNotFound`);fs(`InternalError`);fs(`ResponseError`);var Lf=new Uint8Array(256);for(let t of"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")Lf[t.charCodeAt(0)]=1;var Js=new Uint8Array(256);Js[9]=1;for(let t=32;t<=126;t++)Js[t]=1;for(let t=128;t<=255;t++)Js[t]=1;new TextEncoder().encode(`\r
72
+ `,`<br>`),n=r.italic?`<em>${o}</em>`:o;return r.bold?`<strong>${n}</strong>`:n}).join(``);var Jm=t=>t.map(r=>{if(r.kind===`heading`)return`<h${r.level}>${Nm(r.spans)}</h${r.level}>`;if(r.kind===`paragraph`)return`<p>${Nm(r.spans)}</p>`;let o=r.ordered?`ol`:`ul`;return`<${o}${r.ordered&&r.start!==1?` start="${r.start}"`:``}>${r.items.map(i=>`<li>${Jm(i)}</li>`).join(``)}</${o}>`}).join(``);var Wx=t=>Jm(Dp(t,`blocks`));var Ds=wu$1.String.check(wu$1.isPattern(/^[0-9a-f]{40}$/));var Ym=wu$1.Struct({name:wu$1.NonEmptyString,version:wu$1.NonEmptyString});var Hp=wu$1.Struct({commit:Ds,packages:wu$1.Array(Ym)});var Vm=wu$1.Literals([`development`,`staging`,`production`]);var Zm=wu$1.Literals([`construction`,`live`]);var Jx=wu$1.Struct({appEnvironment:Vm,sitePhase:Zm,commit:wu$1.NullOr(Ds),githubRepositoryUrl:wu$1.NullOr(wu$1.String),demo:wu$1.NullOr(wu$1.Struct({password:wu$1.String,accounts:wu$1.Array(wu$1.Struct({name:wu$1.String,email:wu$1.String}))}))});var _m=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120));var jm=wu$1.String.check(wu$1.isPattern(/^froment_api_v1_[0-7][0-9A-HJKMNP-TV-Z]{25}\.[A-Za-z0-9_-]{43}$/));var Mp=wu$1.Struct({id:a,name:_m,permissions:wu$1.UniqueArray(xs),createdAt:wu$1.Int,expiresAt:wu$1.Int,lastUsedAt:wu$1.NullOr(wu$1.Int),revokedAt:wu$1.NullOr(wu$1.Int),rateLimitPerMinute:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(1),wu$1.isLessThanOrEqualTo(600))});var zm=wu$1.Array(Mp);var qp=wu$1.Struct({items:zm,nextCursor:wu$1.NullOr(a)});var Up=wu$1.Struct({cursor:wu$1.optionalKey(a),limit:wu$1.optionalKey(wu$1.NumberFromString.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(1),wu$1.isLessThanOrEqualTo(100)))});var Qp=wu$1.Struct({name:_m,permissions:wu$1.UniqueArray(xs).check(wu$1.isMinLength(1)),expiresAt:wu$1.Int,rateLimitPerMinute:wu$1.optionalKey(wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(1),wu$1.isLessThanOrEqualTo(600)))});var Fs=wu$1.Struct({token:Mp,secret:jm});var Ro=class extends wu$1.TaggedError()(`ApiTokenNotFound`,{code:wu$1.Literal(`api_token.not_found`)},{httpApiStatus:404}){};var vo=class extends wu$1.TaggedError()(`ApiTokenNameConflict`,{code:wu$1.Literal(`api_token.name_conflict`)},{httpApiStatus:409}){};var bo=class extends wu$1.TaggedError()(`ApiTokenInvalidExpiration`,{code:wu$1.Literal(`api_token.invalid_expiration`)},{httpApiStatus:422}){};var Eo=class extends wu$1.TaggedError()(`ApiTokenInvalidCursor`,{code:wu$1.Literal(`api_token.invalid_cursor`)},{httpApiStatus:400}){};var Yx=wu$1.Union([k,v,E,he,Ve,Ro,vo,bo,Eo]);var Hs=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(0),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var Xm=wu$1.Struct({id:a,reference:Le,quoteId:a,quoteReference:ge,revisionId:a,clientId:a,clientDisplayName:fe,title:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),currency:U,totalCents:Hs,createdAt:w,invoiceId:wu$1.NullOr(a),pdfAvailable:wu$1.Boolean}).annotate({identifier:`OrderSummary`});var Np=wu$1.Array(Xm);var Vx=wu$1.Struct({templateId:wu$1.Literal(`order-default`),templateVersion:wu$1.Literal(1),calendar:wu$1.optionalKey(wr),orderId:a,revisionId:a,orderReference:Le,quoteReference:ge,confirmedAt:w,issuer:ft,client:$t,title:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120)),conditions:wu$1.String.check(wu$1.isMaxLength(2e3)),conditionsPresentation:wu$1.optionalKey(xe),currency:U,netTotalCents:Hs,vatTotalCents:Hs,totalCents:Hs,lines:Zt}).check(rt);var Op=wu$1.Struct({id:a,orderId:a,orderReference:Le,kind:wu$1.Literal(`order-pdf`),contentType:wu$1.Literal(`application/pdf`),byteSize:wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThan(0)),sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:w});var wo=class extends wu$1.TaggedError()(`OrderNotFound`,{code:wu$1.Literal(`order.not_found`)},{httpApiStatus:404}){};var Ms=wu$1.Literals([`affair.created`,`affair.updated`,`affair.quote-linked`,`bank.ledger-posted`,`bank.ledger-reversed`,`invoice.credited`,`invoice.refund-recorded`,`invoice.credit-allocated`,`invoice.credit-allocation-cancelled`,`invoice.refund-cancelled`,`team.invited`,`team.invitation-cancelled`,`team.joined`,`team.member-updated`,`administrator.bootstrapped`,`api.token-created`,`api.token-revoked`,`api.token-used`,`authentication.login-succeeded`,`email.draft-saved`,`email.template-saved`,`email.template-archived`,`email.reminder-scheduled`,`email.reminder-rejected`,`email.reminder-cancelled`,`email.reminder-processed`,`email.draft-archived`,`authentication.passkey-added`,`authentication.passkey-removed`,`authentication.passkey-login`,`authentication.logout`,`authentication.password-changed`,`authentication.refresh-replay-detected`,`authentication.sessions-revoked`,`authentication.session-revoked`,`client.access-created`,`client.access-replaced`,`client.access-revoked`,`client.archived`,`client.created`,`client.reactivated`,`client.updated`,`supplier.archived`,`supplier.created`,`supplier.reactivated`,`supplier-invoice.created`,`supplier-credit.created`,`supplier-invoice.evidence-added`,`supplier-invoice.evidence-accessed`,`supplier-invoice.updated`,`supplier-invoice.confirmed`,`supplier-invoice.approved`,`supplier-invoice.cancelled`,`supplier-invoice.analysis-settings-updated`,`supplier-invoice.analysis-submitted`,`supplier-payment-batch.created`,`supplier.updated`,`catalog.created`,`catalog.updated`,`document.rendered`,`invoice.created`,`invoice.issued`,`invoice.marked-paid`,`invoice.payment-recorded`,`invoice.payment-cancelled`,`invoice.revised`,`invoice.voided`,`issuer.updated`,`company.settings-updated`,`company.accounting-initialized`,`company.exchange-rate-imported`,`company.exchange-rate-overridden`,`accounting.account-saved`,`accounting.journal-saved`,`accounting.period-created`,`accounting.period-locked`,`accounting.period-closed`,`accounting.period-final-closed`,`accounting.period-reopened`,`accounting.entry-created`,`accounting.entry-posted`,`accounting.entry-reversed`,`accounting.evidence-added`,`accounting.evidence-accessed`,`accounting.lettered`,`accounting.tax-filing-settings-updated`,`accounting.tax-filed`,`demo.reset`,`role.created`,`role.updated`,`role.deleted`,`integration.requested`,`integration.processed`,`bank.imported`,`bank.matched`,`bank.supplier-matched`,`bank.supplier-unmatched`,`bank.unmatched`,`quote.accepted`,`quote.cancelled`,`quote.condition-preset-created`,`quote.condition-preset-deleted`,`quote.condition-preset-updated`,`quote.created`,`quote.expired`,`quote.revised`,`quote.sent`,`quote.link-replaced`]);var qs=wu$1.String.check(wu$1.isPattern(/^[a-z]+(?:-[a-z]+)*$/),wu$1.isMaxLength(40));var $m=wu$1.Record(wu$1.String.check(wu$1.isPattern(/^[a-z][a-zA-Z0-9]*$/),wu$1.isMaxLength(40)),wu$1.String.check(wu$1.isMaxLength(500)));var _e=wu$1.Struct({id:a,action:Ms,actorUserId:wu$1.NullOr(a),resourceType:qs,resourceId:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),requestId:wu$1.NullOr(wu$1.String.check(wu$1.isUUID(4))),traceId:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{32}$/))),spanId:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{16}$/))),occurredAt:wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/)),metadata:$m});var ki={};o(ki,{AdditionalSchemas:()=>Ci,isHttpApi:()=>WI,make:()=>YI,reflect:()=>wd});var u={};o(u,{delete:()=>OI,get:()=>qI,getErrorSchemas:()=>Ii,getPayloadSchemas:()=>bd,getSuccessSchemas:()=>Si,head:()=>GI,isHttpApiEndpoint:()=>EI,make:()=>nr,options:()=>KI,patch:()=>NI,post:()=>UI,put:()=>QI});var Gp=`~effect/http/UrlParams`;m$1(l({},ut$1),{[Gp]:Gp,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[We$1](t){return eS(this,t)},[Be](){return rs(this.params.flat())}});var eS=Jt$1((t,r)=>tS(t.params,r.params));var tS=mte(sX([hl$1(),hl$1()]));var Wp=`~effect/http/HttpBody`;fs(`HttpBodyError`);var Jp=class{[Wp];constructor(){this[Wp]=Wp}[De$1](){return this.toJSON()}toString(){return Z(this,{ignoreToString:!0})}};var Yp=class extends Jp{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}};var nf=new Yp;var sf=Symbol.for(`~effect/http/Headers`);var li=Object.defineProperties(Object.create(null),{[sf]:{value:sf},[$d$1]:{value(t){return iS(this,rt$1(t,sS))}},toJSON:{value(){return Zi$1(this)}},[We$1]:{value(t){return nS(this,t)}},[Be]:{value(){return jb(this)}},toString:{value:F9.toString},[De$1]:{value:F9[De$1]}});var oS=t=>Object.assign(Object.create(li),t);var nS=fee(hl$1());var Zp=Object.create(li);var Dr=t=>{if(t===void 0)return Zp;if(Symbol.iterator in t){let o=Object.create(li);for(let[n,i]of t)o[n.toLowerCase()]=i;return o}let r=Object.create(li);for(let[o,n]of Object.entries(t))Array.isArray(n)?r[o.toLowerCase()]=n.join(`, `):n!==void 0&&(r[o.toLowerCase()]=n);return r};var af=t=>Object.setPrototypeOf(t,li);u$1(2,(t,r)=>{let o=oS(t);return Object.assign(o,r),o});var iS=u$1(2,(t,r)=>{let o=l({},t),n=i=>{if(typeof i==`string`){let s=i.toLowerCase();s in t&&(o[s]=Ah(t[s]))}else for(let s in t)i.test(s)&&(o[s]=Ah(t[s]))};if(Array.isArray(r))for(let i=0;i<r.length;i++)n(r[i]);else n(r);return o});var sS=et(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]});var pf=`~effect/http/Cookies`;var df=`~effect/http/Cookies/Cookie`;fs(`CookieError`);var aS=m$1(l({[pf]:pf},F9),{toJSON(){return{_id:`effect/Cookies`,cookies:Vd$1(this.cookies,t=>t.toJSON())}},pipe(){return re(this,arguments)}});var cS=t=>{let r=Object.create(aS);return r.cookies=t,r};var mf=t=>{let r={};for(let o of t)L$1(r,o.name,o);return cS(r)};var ff=mf([]);m$1(l({[df]:df},F9),{toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}});fs(`HttpClientError`);fs(`DecodeError`);fs(`EmptyBodyError`);var Ns=t=>t!==`GET`&&t!==`HEAD`&&t!==`OPTIONS`&&t!==`TRACE`;et(`effect/http/HttpIncomingMessage/MaxBodySize`,{defaultValue:()=>{}});var kf=`~effect/http/HttpServerResponse`;var te=t=>yS({status:t?.status??204,statusText:t?.statusText,headers:t?.headers?Dr(t.headers):void 0,cookies:t?.cookies});new TextDecoder;var gS=m$1(l({},ut$1),{[kf]:kf,[i2]:!0,toJSON(){return{_id:`HttpServerResponse`,status:this.status,statusText:this.statusText,headers:Zi$1(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}});var yS=(t,r=!1)=>{let o=Object.create(gS);if(o.status=t.status,o.statusText=t.statusText,o.cookies=t.cookies??ff,o.body=t.body??nf,o.body._tag!==`Empty`&&(o.body.contentType||o.body.contentLength!==void 0)){let n=af(l({},t.headers));o.body.contentType&&(!r||n[`content-type`]===void 0)&&(n[`content-type`]=o.body.contentType),o.body.contentLength!==void 0&&(!r||n[`content-length`]===void 0)&&(n[`content-length`]=o.body.contentLength.toString()),o.headers=n}else o.headers=t.headers??Zp;return o};var z=`~effect/http/HttpServerRespondable`;fs(`HttpServerError`);fs(`RequestParseError`);fs(`RouteNotFound`);fs(`InternalError`);fs(`ResponseError`);var Lf=new Uint8Array(256);for(let t of"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")Lf[t.charCodeAt(0)]=1;var Js=new Uint8Array(256);Js[9]=1;for(let t=32;t<=126;t++)Js[t]=1;for(let t=128;t<=255;t++)Js[t]=1;new TextEncoder().encode(`\r
73
73
  `);new TextDecoder(`utf-8`);var Of=`~effect/http/Multipart/MultipartError`;var sd=class extends RO{};var HS={FileTooLarge:413,FieldTooLarge:413,BodyTooLarge:413,TooManyParts:413,InternalError:500,Parse:400};var be=class t extends fs(`MultipartError`){static fromReason(r,o){return new t({reason:new sd({_tag:r,cause:o})})}[Of]=Of;[i2]=!0;[z](){return k$1(te({status:HS[this.reason._tag]}))}get message(){return this.reason._tag}};et(`effect/http/Multipart/MaxParts`,{defaultValue:()=>{}});et(`effect/http/Multipart/MaxFieldSize`,{defaultValue:at(sl$1(10*1024*1024))});et(`effect/http/Multipart/MaxFileSize`,{defaultValue:()=>{}});et(`effect/http/Multipart/FieldMimeTypes`,{defaultValue:at([`application/json`])});var Wf=kt$1(`effect/http/HttpServerRequest`);new TextDecoder;var jS=new WeakSet;var Zf=t=>pt$1(r=>{let o=xo$1(r.context,Wf);return jS.add(o.source),t});var $S=kt$1(`effect/http/HttpRouter`);var eI=t=>t.endsWith(`/`)?t.slice(0,-1):t;var zf=u$1(2,(t,r)=>(r=eI(r),t===`*`?`${r}/*`:t===`/`?r:r+t));var tI=`~effect/http/HttpRouter/Middleware`;var rI=function(){return arguments.length===0?_f:_f(arguments[0],arguments[1])};var _f=(t,r)=>r?.global?eie(J(function*(){let o=yield*$S,n=dr$1(t)?yield*t:t;yield*o.addGlobalMiddleware(n)})):new fd(dr$1(t)?ip$1(D$1(t,o=>ra$1(new Map([[md,o]])))):rp$1(ra$1(new Map([[md,t]]))));var oI=0;var md=`effect/http/HttpRouter/MiddlewareFn`;var fd=class t{[tI]={};layerFn;dependencies;constructor(r,o){this.layerFn=r,this.dependencies=o;let n=`effect/http/HttpRouter/Middleware-${++oI}`;this.layer=ip$1(J({self:this},function*(){let i=yield*Cr$1(),s=[nm$1(i,md)];if(this.dependencies){let d=yield*ma$1,c=rt$1(i,Yt),h=yield*Us(this.dependencies,d,c);s.push(...nI(h))}return ra$1(new Map([[n,s]]))})).pipe(nc$1(this.layerFn))}layer;combine(r){return new t(this.layerFn,this.dependencies?rie(this.dependencies,r.layer):r.layer)}};var jf=new WeakMap;var nI=t=>{let r=jf.get(t);if(r)return r;let o=ht$1(),n=0;for(let[i,s]of t.mapUnsafe)i.startsWith(`effect/http/HttpRouter/Middleware-`)&&(o.push(s),s.length>n&&(n=s.length));if(o.length===0)r=[];else{let i=new Set;for(let s=n-1;s>=0;s--)for(let d of o)s<d.length&&i.add(d[s]);r=oe(i).reverse()}return jf.set(t,r),r};rI(Zf).layer;var p={};o(p,{Accepted:()=>pI,Created:()=>cI,Empty:()=>js,MultipartStreamTypeId:()=>ih,MultipartTypeId:()=>nh,NoContent:()=>yd,StreamSse:()=>uI,StreamUint8Array:()=>lI,WithHeaders:()=>fI,WithHeadersTypeId:()=>Lo,WithHeadersValueTypeId:()=>Zs,asFormUrlEncoded:()=>Id,asJson:()=>SI,asMultipart:()=>yI,asMultipartStream:()=>xI,asNoContent:()=>dI,asText:()=>II,asUint8Array:()=>CI,encodeToWithHeaders:()=>gI,getPayloadEncoding:()=>Do,getResponseEncoding:()=>hi,getResponseEncodingSchema:()=>or,getStatusError:()=>hd,getStatusErrorSchema:()=>Ur,getStatusStream:()=>vI,getStatusSuccess:()=>_s,getStatusSuccessSchema:()=>rr,getWithHeadersAnnotation:()=>Po,isNoContent:()=>qr,isStreamSchema:()=>Ke,isStreamSse:()=>gi,isStreamUint8Array:()=>AI,isWithHeaders:()=>Se,isWithHeadersValue:()=>oh,rebuildWithHeaders:()=>xd,status:()=>eh,withHeaders:()=>hI});var sI={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,OK:200,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};var Xf=t=>sI[t];var fi=`~effect/httpapi/HttpApiSchema/Stream`;function eh(t){let r=typeof t==`string`?Xf(t):t;return o=>o.annotate({httpApiStatus:r})}var js=t=>RD.pipe(eh(t));var yd=js(204);var cI=js(201);var pI=js(202);function dI(t){return r=>RD.pipe(Pe$1(es$1(r),sn$1({decode:t.decode,encode:bn$1})))}var th=zi$1(ot$1);var uI=t=>{let r=t.events??(t.data===void 0?void 0:ce({id:O0(Ie$1),event:Ie$1,data:r6(t.data)}));if(r===void 0)throw new Error(`StreamSse requires either an events schema or a data schema`);return Ee$1(th.ast,{[fi]:fi,_tag:`StreamSse`,mode:`sse`,sseMode:t.events===void 0?`data`:`events`,contentType:t.contentType??rh(`sse`),events:r,error:t.error??OD})};var lI=t=>Ee$1(th.ast,{[fi]:fi,_tag:`StreamUint8Array`,mode:`uint8array`,contentType:t?.contentType??rh(`uint8array`)});var Ke=t=>C0$1(t)&&U$1(t,fi);var gi=t=>Ke(t)&&t._tag===`StreamSse`;var AI=t=>Ke(t)&&t._tag===`StreamUint8Array`;function rh(t){switch(t){case`sse`:return`text/event-stream`;case`uint8array`:return`application/octet-stream`}}var Lo=`~effect/httpapi/HttpApiSchema/WithHeaders`;var Zs=`~effect/httpapi/HttpApiSchema/WithHeadersValue`;var oh=t=>U$1(t,Zs);var mI=zi$1(oh);function fI(t,r){if(Se(t))throw new Error(`WithHeaders schemas cannot be nested`);return Ee$1(mI.ast,{[Lo]:Lo,schema:t,headers:C0$1(r)?r:ce(r)})}var hI=t=>({[Zs]:Zs,body:t.body,headers:t.headers});var Se=t=>C0$1(t)&&U$1(t,Lo);function xd(t,r,o){return Ee$1(t.ast,{[Lo]:Lo,schema:r,headers:o})}function gI(t,r){return o=>{let n=t.body,i=ce(t.headers),s=yi(n.ast),d=Xs(n.ast);return ce({body:n,headers:i}).pipe(Pe$1(es$1(o),sn$1(r))).annotate(l(l({"~httpApiWithHeaders":{body:n,headers:i,headersCodec:Nh$1(i)}},s!==void 0?{httpApiStatus:s}:void 0),d!==void 0?{"~httpApiEncoding":d}:void 0))}}var nh=`~effect/httpapi/HttpApiSchema/Multipart`;function yI(t){return r=>r.pipe(LV(nh)).annotate({"~httpApiEncoding":{_tag:`Multipart`,mode:`buffered`,contentType:Sd(`Multipart`),limits:t}})}var ih=`~effect/httpapi/HttpApiSchema/MultipartStream`;function xI(t){return r=>r.pipe(LV(ih)).annotate({"~httpApiEncoding":{_tag:`Multipart`,mode:`stream`,contentType:Sd(`Multipart`),limits:t}})}function zs(t,r){return t.annotate({"~httpApiEncoding":{_tag:r._tag,contentType:r.contentType??Sd(r._tag)}})}function Sd(t){switch(t){case`Multipart`:return`multipart/form-data`;case`Json`:return`application/json`;case`FormUrlEncoded`:return`application/x-www-form-urlencoded`;case`Uint8Array`:return`application/octet-stream`;case`Text`:return`text/plain`}}function SI(t){return r=>zs(r,l({_tag:`Json`},t))}function Id(t){return r=>zs(r,l({_tag:`FormUrlEncoded`},t))}function II(t){return r=>zs(r,l({_tag:`Text`},t))}function CI(t){return r=>zs(r,l({_tag:`Uint8Array`},t))}var qr=t=>{if(fde(t))return!0;if(fde(to$1(t)))return!0;let o=t.encoding?.[0].to;return o===void 0?!1:fde(o)};var Xs=$de(`~httpApiEncoding`);var Po=$de(`~httpApiWithHeaders`);var yi=$de(`httpApiStatus`);var sh={_tag:`Json`,contentType:`application/json`};var kI={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function RI(t){return Xs(t)??sh}function Do(t,r){return Xs(t)||(Ns(r)?sh:kI)}function hi(t){let r=RI(t);if(r._tag===`Multipart`)throw new Error(`Multipart is not supported in response`);return r}function _s(t){return yi(t)??200}function rr(t){return Se(t)?yi(t.ast)??_s(t.schema.ast):_s(t.ast)}function or(t){return Se(t)&&Xs(t.ast)===void 0?hi(t.schema.ast):hi(t.ast)}function vI(t){return _s(t.ast)}function hd(t){return yi(t)??500}function Ur(t){return Se(t)?yi(t.ast)??hd(t.schema.ast):hd(t.ast)}function Qr(t){let r=t.toLowerCase().trim(),o=r.indexOf(`;`);return o===-1?r:r.slice(0,o).trim()}var kd=`~effect/httpapi/HttpApiEndpoint`;var EI=t=>U$1(t,kd);function bd(t){let r=[];for(let{schemas:o}of t.payload.values())r.push(...o);return r}function Si(t){let r=Array.from(t.success);return Kt$1(r)?r:[yd]}function Ii(t){let r=new Set(t.error);for(let o of t.middlewares){let n=o;for(let i of n.error)r.add(i)}return Array.from(r)}var wI={[kd]:kd,pipe(){return re(this,arguments)},prefix(t){return xi(m$1(l({},$s(this)),{path:zf(this.path,t)}))},middleware(t){return xi(m$1(l({},$s(this)),{middlewares:new Set([...this.middlewares,t])}))},annotate(t,r){return xi(m$1(l({},$s(this)),{annotations:Cn$1(this.annotations,t,r)}))},annotateMerge(t){return xi(m$1(l({},$s(this)),{annotations:us(this.annotations,t)}))}};var $s=t=>({identifier:t.identifier,path:t.path,method:t.method,params:t.params,query:t.query,headers:t.headers,payload:t.payload,success:t.success,error:t.error,annotations:t.annotations,middlewares:t.middlewares});function xi(t){function r(){}return Object.setPrototypeOf(r,wI),Object.assign(r,t)}var nr=t=>(r,o,n)=>{let i=n?.disableCodecs??!1,s=i?$$1:$h$1;return xi({identifier:r,path:o,method:t,params:Cd(n?.params,s),query:Cd(n?.query,s),headers:Cd(n?.headers,s),payload:TI(n?.payload,t,i),success:BI(n?.success,t,i),error:LI(n?.error,i),annotations:Ir(),middlewares:new Set})};function Cd(t,r){if(t!==void 0)return C0$1(t)?r(t):r(ce(t))}function TI(t,r,o){let n=new Map;if(t===void 0)return n;let i=Array.isArray(t)?t:C0$1(t)?[t]:[ce(t).pipe(Id())],s=o?$$1:MI;for(let d of i){let c=Do(d.ast,r),h=Qr(c.contentType),y=n.get(h);if(y){if(y.encoding._tag!==c._tag)throw new Error(`Multiple payload encodings for content-type: ${c.contentType}`);if(y.encoding._tag===`Multipart`)throw new Error(`Multiple multipart payloads for content-type: ${c.contentType}`);y.schemas.push(s(d,r))}else n.set(h,{encoding:c,schemas:[s(d,r)]})}return n}var ch=`effect/httpapi/stream/failure`;function BI(t,r,o){if(t===void 0)return new Set;let n=Zd$1(t);return PI(n,r),new Set(o?n:n.map(ph))}function ph(t){if(Ke(t))return t;if(Se(t))return xd(t,Ke(t.schema)?t.schema:vd(t.schema,or(t)),$h$1(t.headers));return HI(t)}function LI(t,r){if(t===void 0)return new Set;let o=Zd$1(t);for(let n of o)if(Ke(Se(n)?n.schema:n))throw new Error(`Streaming schemas are not supported in error responses`);return dh(o,Ur),new Set(r?o:o.map(ph))}function PI(t,r){let o=!1,n=new Map;for(let i of t){let s=Se(i)?i.schema:i,d=rr(i);if(Ke(s)){if(DI(s,r),o)throw new Error(`Multiple streaming success responses are not supported`);o=!0;let c=ah(n,d);if(c.noContent)throw new Error(`Cannot combine no-content and streaming success responses for status: ${d}`);if(c.bufferedContentTypes.has(Qr(s.contentType)))throw new Error(`Cannot combine buffered and streaming success responses for status ${d} and content-type: ${s.contentType}`);n.set(d,m$1(l({},c),{stream:s}))}else{let c=ah(n,d),h=qr(s.ast);if(c.stream!==void 0){if(h)throw new Error(`Cannot combine no-content and streaming success responses for status: ${d}`);let y=or(i);if(Qr(y.contentType)===Qr(c.stream.contentType))throw new Error(`Cannot combine buffered and streaming success responses for status ${d} and content-type: ${y.contentType}`)}h||c.bufferedContentTypes.add(Qr(or(i).contentType)),c.noContent=c.noContent||h}}dh(t,rr)}function ah(t,r){let o=t.get(r);return o===void 0&&(o={bufferedContentTypes:new Set,noContent:!1},t.set(r,o)),o}function dh(t,r){let o=new Map;for(let n of t){let i=r(n),s=Po(n.ast),d=Se(n)?n.schema:s?.body??n,c=qr(d.ast)?``:Qr(Ke(d)?d.contentType:or(n).contentType),h=o.get(i);h===void 0&&(h={headerContentType:void 0,plainContentTypes:new Set},o.set(i,h));let y=()=>new Error(`Cannot combine a response with headers with another response for status ${i} and content-type: ${c||`<no content>`}`);if(Se(n)||s!==void 0){if(h.headerContentType!==void 0)throw new Error(`Cannot declare multiple responses with headers for status ${i}`);if(h.plainContentTypes.has(c))throw y();h.headerContentType=c}else{if(h.headerContentType===c)throw y();h.plainContentTypes.add(c)}}}function DI(t,r){if(r===`HEAD`)throw new Error(`HEAD endpoints cannot declare streaming success responses`);if(gi(t)&&FI(t.events.ast))throw new Error(`SSE event name is reserved: ${ch}`)}function FI(t){return Rd(to$1(t),new Set)}function Rd(t,r){if(r.has(t))return!1;if(r.add(t),fP(t))return t.types.some(n=>Rd(n,r));if(RG(t))return Rd(t.thunk(),r);if(!AG(t))return!1;let o=t.propertySignatures.find(n=>n.name===`event`);return o!==void 0&&ea(o.type,r)}function ea(t,r){if(r.has(t))return!1;r.add(t);let o=to$1(t);return o!==t?ea(o,r):Rp$1(t)?t.literal===ch:fP(t)?t.types.some(n=>ea(n,r)):RG(t)?ea(t.thunk(),r):!1}function HI(t){let r=hi(t.ast),o=Po(t.ast);if(o===void 0)return vd(t,r);let n=Nh$1(o.headers);return ce({body:vd(Nh$1(o.body),r),headers:n}).pipe(Pe$1(t)).annotate({"~httpApiWithHeaders":m$1(l({},o),{headersCodec:$h$1(n)})})}function vd(t,r){switch(r._tag){case`Json`:return Sd$1(t);case`FormUrlEncoded`:return $h$1(t);case`Text`:case`Uint8Array`:return t}}function MI(t,r){switch(Do(t.ast,r)._tag){case`Json`:return Sd$1(t);case`FormUrlEncoded`:return $h$1(t);case`Text`:case`Uint8Array`:case`Multipart`:return t}}var qI=nr(`GET`);var UI=nr(`POST`);var QI=nr(`PUT`);var NI=nr(`PATCH`);var OI=nr(`DELETE`);var GI=nr(`HEAD`);var KI=nr(`OPTIONS`);var Ed=`~effect/httpapi/HttpApi`;var WI=t=>U$1(t,Ed);var JI={[Ed]:Ed,pipe(){return re(this,arguments)},add(...t){let r=l({},this.groups);for(let o of t)L$1(r,o.identifier,o);return Nr(m$1(l({},Fo(this)),{groups:r}))},addHttpApi(t){let r=l({},this.groups);for(let o of Object.keys(t.groups)){let n=t.groups[o];L$1(r,o,n.annotateMerge(us(t.annotations,n.annotations)))}return Nr(m$1(l({},Fo(this)),{groups:r}))},prefix(t){return Nr(m$1(l({},Fo(this)),{groups:Vd$1(this.groups,r=>r.prefix(t))}))},middleware(t){return Nr(m$1(l({},Fo(this)),{groups:Vd$1(this.groups,r=>r.middleware(t))}))},annotate(t,r){return Nr(m$1(l({},Fo(this)),{annotations:Cn$1(this.annotations,t,r)}))},annotateMerge(t){return Nr(m$1(l({},Fo(this)),{annotations:us(this.annotations,t)}))}};var Fo=t=>({identifier:t.identifier,groups:t.groups,annotations:t.annotations});var Nr=t=>{function r(){}return Object.setPrototypeOf(r,JI),Object.assign(r,t)};var YI=t=>Nr({identifier:t,groups:{},annotations:Ir()});var wd=(t,r)=>{let o=Object.values(t.groups);for(let n of o){let i=us(t.annotations,n.annotations);r.onGroup({group:n,mergedAnnotations:i});let s=Object.values(n.endpoints);for(let d of s)r.predicate&&!r.predicate({endpoint:d,group:n})||r.onEndpoint({group:n,endpoint:d,middleware:d.middlewares,mergedAnnotations:us(i,d.annotations),successes:uh(Si(d),rr),errors:uh(Ii(d),Ur)})}};var uh=(t,r)=>{let o=new Map;return t.forEach(n),o;function n(i){if(Ke(Se(i)?i.schema:i))return;let d=r(i),c=o.get(d);c===void 0?o.set(d,[i]):c.push(i)}};var Ci=class extends kt$1()(`effect/httpapi/HttpApi/AdditionalSchemas`){};var VI=te({status:400});te({status:401});te({status:403});te({status:404});te({status:405});te({status:406});te({status:408});te({status:409});te({status:410});te({status:422});te({status:500});te({status:501});te({status:503});Lh$1(`effect/HttpApiError/Unauthorized`)({_tag:yn$1(`Unauthorized`)},{description:`Unauthorized`,httpApiStatus:401});Lh$1(`effect/HttpApiError/Forbidden`)({_tag:yn$1(`Forbidden`)},{description:`Forbidden`,httpApiStatus:403});Lh$1(`effect/HttpApiError/NotFound`)({_tag:yn$1(`NotFound`)},{description:`NotFound`,httpApiStatus:404});Lh$1(`effect/HttpApiError/MethodNotAllowed`)({_tag:yn$1(`MethodNotAllowed`)},{description:`MethodNotAllowed`,httpApiStatus:405});Lh$1(`effect/HttpApiError/NotAcceptable`)({_tag:yn$1(`NotAcceptable`)},{description:`NotAcceptable`,httpApiStatus:406});Lh$1(`effect/HttpApiError/RequestTimeout`)({_tag:yn$1(`RequestTimeout`)},{description:`RequestTimeout`,httpApiStatus:408});Lh$1(`effect/HttpApiError/Conflict`)({_tag:yn$1(`Conflict`)},{description:`Conflict`,httpApiStatus:409});Lh$1(`effect/HttpApiError/Gone`)({_tag:yn$1(`Gone`)},{description:`Gone`,httpApiStatus:410});Lh$1(`effect/HttpApiError/UnprocessableEntity`)({_tag:yn$1(`UnprocessableEntity`)},{description:`UnprocessableEntity`,httpApiStatus:422});Lh$1(`effect/HttpApiError/InternalServerError`)({_tag:yn$1(`InternalServerError`)},{description:`InternalServerError`,httpApiStatus:500});Lh$1(`effect/HttpApiError/NotImplemented`)({_tag:yn$1(`NotImplemented`)},{description:`NotImplemented`,httpApiStatus:501});Lh$1(`effect/HttpApiError/ServiceUnavailable`)({_tag:yn$1(`ServiceUnavailable`)},{description:`ServiceUnavailable`,httpApiStatus:503});var Td=`~effect/httpapi/HttpApiError/HttpApiSchemaError`;var ta=class t extends qre(`HttpApiSchemaError`){[Td]=Td;static is(r){return U$1(r,Td)}static wrap(r,o){return sy$1(o,n=>new t({kind:r,cause:n}))}name=`HttpApiSchemaError`;message=this.kind;[z](){return k$1(VI)}};var Nt={};o(Nt,{Service:()=>aC,isSecurity:()=>Ld,layerClient:()=>dC,layerSchemaErrorTransform:()=>pC});var Rh=`~effect/httpapi/HttpApiMiddleware`;var Bd=`~effect/httpapi/HttpApiMiddleware/Security`;var Ld=t=>U$1(t,Bd);var aC=()=>(t,r)=>{let o=globalThis.Error,n=ls();Jn(2);let i=new o;Jn(n);class s extends kt$1()(t){}let d=s;if(Object.defineProperty(s,"stack",{get(){return i.stack}}),d[Rh]=Rh,d.error=cC(r?.error),d.requiredForClient=r?.requiredForClient??!1,r?.security!==void 0){if(Object.keys(r.security).length===0)throw new Error(`HttpApiMiddleware.Service: security object must not be empty`);d[Bd]=Bd,d.security=r.security}return d};function cC(t){return t===void 0?new Set:new Set(Array.isArray(t)?t:[t])}var pC=(t,r)=>yo$1(t,(o,n)=>ya$1(o,i=>ta.is(i)?r(i,n):G$1(i)));var dC=(t,r)=>ip$1(J(function*(){let o=(yield*Cr$1()).pipe(Uj(Yt)),n=dr$1(r)?yield*r:r;return ra$1(new Map([[`${t.key}/Client`,i=>ay$1(n(i),s=>us(o,s))]]))}));var xt={};o(xt,{Deprecated:()=>Ti,Description:()=>ir,Exclude:()=>ra,ExternalDocs:()=>Ho,Format:()=>wi,Identifier:()=>Ri,License:()=>bi,Override:()=>Gr,Servers:()=>Ei,Summary:()=>Mo,Title:()=>Or,Transform:()=>Kr,Version:()=>vi,annotations:()=>lC,fromApi:()=>mC});var Ri=class extends kt$1()(`effect/httpapi/OpenApi/Identifier`){};var Or=class extends kt$1()(`effect/httpapi/OpenApi/Title`){};var vi=class extends kt$1()(`effect/httpapi/OpenApi/Version`){};var ir=class extends kt$1()(`effect/httpapi/OpenApi/Description`){};var bi=class extends kt$1()(`effect/httpapi/OpenApi/License`){};var Ho=class extends kt$1()(`effect/httpapi/OpenApi/ExternalDocs`){};var Ei=class extends kt$1()(`effect/httpapi/OpenApi/Servers`){};var wi=class extends kt$1()(`effect/httpapi/OpenApi/Format`){};var Mo=class extends kt$1()(`effect/httpapi/OpenApi/Summary`){};var Ti=class extends kt$1()(`effect/httpapi/OpenApi/Deprecated`){};var Gr=class extends kt$1()(`effect/httpapi/OpenApi/Override`){};var ra=et(`effect/httpapi/OpenApi/Exclude`,{defaultValue:pl$1});var Kr=class extends kt$1()(`effect/httpapi/OpenApi/Transform`){};var uC=t=>{let r=Object.entries(t);return o=>{let n=Ir();for(let[i,s]of r)o[i]!==void 0&&(n=Cn$1(n,s,o[i]));return n}};var lC=uC({identifier:Ri,title:Or,version:vi,description:ir,license:bi,summary:Mo,deprecated:Ti,externalDocs:Ho,servers:Ei,format:wi,override:Gr,exclude:ra,transform:Kr});var AC={};var vh=new WeakMap;var oa=t=>{if(Array.isArray(t))return t.map(oa);if(t!==null&&typeof t==`object`&&!Object.isFrozen(t)){let r={};for(let o of Object.keys(t))L$1(r,o,oa(t[o]));return r}return t};function ie(t,r,o){let n=rm$1(t,r);le(n)&&o(n.value)}function mC(t,r){let o=r??AC,n=vh.get(o);n===void 0&&(n=new WeakMap,vh.set(o,n));let i=n.get(t);if(i!==void 0)return oa(i);let s=fC(t,o);return n.set(t,oa(s)),s}function fC(t,r){let o={openapi:`3.1.0`,info:{title:`Api`,version:`0.0.1`},paths:{},components:{schemas:{},securitySchemes:{}},security:[],tags:[]},n=[],i=new Set,s=new Set;ie(t.annotations,Or,c=>{o.info.title=c}),ie(t.annotations,vi,c=>{o.info.version=c}),ie(t.annotations,ir,c=>{o.info.description=c}),ie(t.annotations,bi,c=>{o.info.license=c}),ie(t.annotations,Mo,c=>{o.info.summary=c}),ie(t.annotations,Ei,c=>{o.servers=[...c]}),wd(t,{onGroup({group:c}){if(rt$1(c.annotations,ra))return;let h={name:Bne(c.annotations,Or,()=>c.identifier)};ie(c.annotations,ir,y=>{h.description=y}),ie(c.annotations,Ho,y=>{h.externalDocs=y}),ie(c.annotations,Gr,y=>{for(let[C,l]of Object.entries(y))L$1(h,C,l)}),ie(c.annotations,Kr,y=>{h=y(h)}),o.tags.push(h)},onEndpoint({endpoint:c,group:h,mergedAnnotations:y,middleware:C}){if(rt$1(y,ra))return;let l={tags:[Bne(h.annotations,Or,()=>h.identifier)],operationId:Bne(c.annotations,Ri,()=>h.topLevel?c.identifier:`${h.identifier}.${c.identifier}`),parameters:[],security:[],responses:{}},R=c.path.replace(/:(\w+)\??/g,`{$1}`),F=c.method.toLowerCase();function q(M,Y){for(let[Q,{content:Xe,descriptions:rs,headers:Mn,streamContent:os}]of M){let Sy=rs.size>0?Array.from(rs).join(` | `):Y();L$1(l.responses,Q,{description:Sy});for(let Yt of Mn){let lt=Vm$1(Yt.ast);if(AG(lt))for(let qn of lt.propertySignatures){let oo=String(qn.name).toLowerCase();oo!==`content-type`&&(l.responses[Q].headers??={},L$1(l.responses[Q].headers,oo,{schema:{},required:!jn(qn.type)}),n.push({_tag:`parameter`,ast:qn.type,path:[`paths`,R,F,`responses`,String(Q),`headers`,oo,`schema`]}))}}Xe!==void 0&&Xe.forEach((Yt,lt)=>{Yt.forEach((qn,oo)=>{let lc=Array.from(qn,Bm$1),Iy=lc.length===1?lc[0]:new To(lc,`anyOf`);n.push({_tag:`schema`,ast:bh(Iy,lt),path:[`paths`,R,F,`responses`,String(Q),`content`,oo,`schema`]}),l.responses[Q].content??={},L$1(l.responses[Q].content,oo,{schema:{}})})}),os!==void 0&&os.forEach((Yt,lt)=>{l.responses[Q].content??={},gi(Yt)?(n.push({_tag:`schema`,ast:Bm$1(Yt.events),path:[`paths`,R,F,`responses`,String(Q),`content`,lt,`schema`]}),n.push({_tag:`schema`,ast:Bm$1(Sd$1(E0(Yt.error,s1()))),path:[`paths`,R,F,`responses`,String(Q),`content`,lt,`x-effect-stream`,`causeSchema`]}),n.push({_tag:`schema`,ast:Bm$1(Yt.error),path:[`paths`,R,F,`responses`,String(Q),`content`,lt,`x-effect-stream`,`errorSchema`]}),L$1(l.responses[Q].content,lt,{schema:{},"x-effect-stream":{encoding:`sse`,causeSchema:{},errorSchema:{},failureEvent:hC}})):L$1(l.responses[Q].content,lt,{schema:{type:`string`,format:`binary`},"x-effect-stream":{encoding:`uint8array`}})})}}function J(M,Y){if(M){let Q=Vm$1(M.ast);if(AG(Q))for(let Xe of Q.propertySignatures)l.parameters.push({name:String(Xe.name),in:Y,schema:{},required:Y===`path`||!jn(Xe.type)}),n.push({_tag:`parameter`,ast:Xe.type,path:[`paths`,R,F,`parameters`,String(l.parameters.length-1),`schema`]})}}ie(c.annotations,ir,M=>{l.description=M}),ie(c.annotations,Mo,M=>{l.summary=M}),ie(c.annotations,Ti,M=>{l.deprecated=M}),ie(c.annotations,Ho,M=>{l.externalDocs=M}),C.forEach(M=>{if(Ld(M))for(let[Y,Q]of Object.entries(M.security))K(Y,Q),l.security.push({[Y]:[]})});function K(M,Y){let Q=yC(Y);if(!Object.hasOwn(o.components.securitySchemes,M)){L$1(o.components.securitySchemes,M,Q);return}if(!fe$1(Eh(o.components.securitySchemes[M]),Eh(Q)))throw new globalThis.Error(`Conflicting OpenAPI security scheme: ${M}`)}let Z=Ns(c.method);if(Z){let M=new Map;for(let Y of bd(c)){if(qr(Y.ast))continue;let Q=Do(Y.ast,c.method),Xe=M.get(Q.contentType);Xe===void 0?M.set(Q.contentType,{encoding:Q,schemas:[Y]}):Xe.schemas.push(Y)}if(M.size>0){let Y={};for(let[Q,{encoding:Xe,schemas:rs}]of M){let Mn=rs.map(Bm$1),os=Mn.length===1?Mn[0]:new To(Mn,`anyOf`);n.push({_tag:`schema`,ast:bh(os,Xe._tag),path:[`paths`,R,F,`requestBody`,`content`,Q,`schema`]}),L$1(Y,Q,{schema:{}})}l.requestBody={content:Y,required:!0}}}if(J(c.params,`path`),!Z&&c.payload.size===1){let M=c.payload.values().next().value;J(M.schemas[0],`query`)}J(c.headers,`header`),J(c.query,`query`),q(gC(c),()=>`Success`),q(wh(Ii(c),Ur,Th),()=>`Error`),ie(c.annotations,Gr,M=>{for(let[Y,Q]of Object.entries(M))L$1(l,Y,Q)}),ie(c.annotations,Kr,M=>{l=M(l)});let re=`${F} ${R.replace(/\{[^}]+\}/g,`{}`)}`;if(i.has(re))throw new globalThis.Error(`Duplicate OpenAPI operation for ${c.method} ${R}`);let le=l.operationId;if(le!==void 0){if(s.has(le))throw new globalThis.Error(`Duplicate OpenAPI operationId: ${le}`);s.add(le)}i.add(re),Object.hasOwn(o.paths,R)||L$1(o.paths,R,{}),o.paths[R][F]=l}}),ie(t.annotations,Ci,c=>{c.forEach(h=>{let y=jde(h.ast);if(y!==void 0){if(Object.hasOwn(o.components.schemas,y))throw new globalThis.Error(`Duplicate component schema identifier: ${y}`);L$1(o.components.schemas,y,{}),n.push({_tag:`schema`,ast:h.ast,path:[`components`,`schemas`,y]})}})});function d(c){return`/`+c.map(Zf$1).join(`/`)}if(Kt$1(n)){let c=obe(YK(aD$1(an$1(n,y=>M0(y.ast)),r))),h=n.map((y,C)=>{return{op:`replace`,path:d(y.path),value:c.schemas[C]}});Object.entries(c.definitions).forEach(([y,C])=>{h.push({op:`add`,path:d([`components`,`schemas`,y]),value:C})}),o=fD(h,o)}return Object.keys(o.components.schemas).forEach(c=>{if(!ZU.test(c))throw new globalThis.Error(`Invalid component schema key: ${c}`)}),ie(t.annotations,Gr,c=>{for(let[h,y]of Object.entries(c))L$1(o,h,y)}),ie(t.annotations,Kr,c=>{o=c(o)}),o}var hC=`effect/httpapi/stream/failure`;function gC(t){return wh(Si(t),rr,Th)}function wh(t,r,o){let n=new Map;return t.forEach(i),n;function i(h){let y=Po(h.ast),C=Se(h)?h.schema:y?.body??h,l=Se(h)?h.headers:y?.headersCodec,R=r(h),F=C.ast;Ke(C)?c(C,R):qr(F)?s(R,o(h.ast)??o(F)??`<No Content>`):d(C,R,or(h),o(h.ast)??o(F)),l!==void 0&&n.get(R).headers.push(l)}function s(h,y){let C=n.get(h);C===void 0?n.set(h,{descriptions:new Set([y]),content:void 0,headers:[],streamContent:void 0}):y!==void 0&&C.descriptions.add(y)}function d(h,y,C,l){let R=n.get(y),{_tag:F,contentType:q}=C;if(R===void 0)n.set(y,{descriptions:new Set(l!==void 0?[l]:[]),content:new Map([[F,new Map([[q,new Set([h])]])]]),headers:[],streamContent:void 0});else if(l!==void 0&&R.descriptions.add(l),R.content===void 0)R.content=new Map([[F,new Map([[q,new Set([h])]])]]);else{let J=R.content.get(F);if(J===void 0)R.content.set(F,new Map([[q,new Set([h])]]));else{let K=J.get(q);K===void 0?J.set(q,new Set([h])):K.add(h)}}}function c(h,y){let C=n.get(y);C===void 0?n.set(y,{descriptions:new Set,content:void 0,headers:[],streamContent:new Map([[h.contentType,h]])}):C.streamContent===void 0?C.streamContent=new Map([[h.contentType,h]]):C.streamContent.set(h.contentType,h)}}function Th(t){return Hde(t)??jde(t)}var Bh=Ie$1.annotate({format:`binary`});function bh(t,r){switch(r){case`Uint8Array`:return Bh.ast;case`Text`:return Ie$1.ast;case`FormUrlEncoded`:case`Json`:return t;case`Multipart`:return Lh(t)}}function Lh(t){return du$1(t)&&t.annotations?.representation?.id===`effect/http/PersistedFile`?Bh.ast:typeof t?.recur==`function`?t.recur(Lh):t}var yC=t=>{let r={};switch(ie(t.annotations,ir,o=>{r.description=o}),t._tag){case`Basic`:return m$1(l({},r),{type:`http`,scheme:`basic`});case`Http`:{let o=rm$1(t.annotations,wi).pipe(or$1(n=>({bearerFormat:n})),cs);return l(m$1(l({},r),{type:`http`,scheme:t.scheme}),o)}case`ApiKey`:return m$1(l({},r),{type:`apiKey`,name:t.key,in:t.in})}};var Eh=t=>t.type===`http`?m$1(l({},t),{scheme:t.scheme.toLowerCase()}):t.in===`header`?m$1(l({},t),{name:t.name.toLowerCase()}):t;var D={};o(D,{isHttpApiGroup:()=>xC,make:()=>IC});var Pd=`~effect/httpapi/HttpApiGroup`;var xC=t=>U$1(t,Pd);var SC={[Pd]:Pd,add(...t){let r=l({},this.endpoints);for(let o of t)L$1(r,o.identifier,o);return sr(m$1(l({},Wr(this)),{endpoints:r}))},prefix(t){return sr(m$1(l({},Wr(this)),{endpoints:Vd$1(this.endpoints,r=>r.prefix(t))}))},middleware(t){return sr(m$1(l({},Wr(this)),{endpoints:Vd$1(this.endpoints,r=>r.middleware(t))}))},annotateMerge(t){return sr(m$1(l({},Wr(this)),{annotations:us(this.annotations,t)}))},annotate(t,r){return sr(m$1(l({},Wr(this)),{annotations:Cn$1(this.annotations,t,r)}))},annotateEndpointsMerge(t){return sr(m$1(l({},Wr(this)),{endpoints:Vd$1(this.endpoints,r=>r.annotateMerge(t))}))},annotateEndpoints(t,r){return sr(m$1(l({},Wr(this)),{endpoints:Vd$1(this.endpoints,o=>o.annotate(t,r))}))},pipe(){return re(this,arguments)}};var Wr=t=>({identifier:t.identifier,topLevel:t.topLevel,endpoints:t.endpoints,annotations:t.annotations});var sr=t=>{function r(){}return Object.setPrototypeOf(r,SC),r.key=`effect/httpapi/HttpApiGroup/${t.identifier}`,Object.assign(r,t)};var IC=(t,r)=>sr({identifier:t,topLevel:r?.topLevel??!1,endpoints:{},annotations:Ir()});var Li={};o(Li,{annotate:()=>bC,annotateMerge:()=>vC,apiKey:()=>kC,basic:()=>RC,bearer:()=>CC,http:()=>Dh});var Ph=`~effect/httpapi/HttpApiSecurity`;var Bi={[Ph]:Ph,pipe(){return re(this,arguments)}};var Dh=t=>Object.assign(Object.create(Bi),{_tag:`Http`,scheme:t.scheme,schemeLength:t.scheme.length,annotations:Ir()});var CC=Dh({scheme:`Bearer`});var kC=t=>Object.assign(Object.create(Bi),{_tag:`ApiKey`,key:t.key,in:t.in??`header`,annotations:Ir()});var RC=Object.assign(Object.create(Bi),{_tag:`Basic`,annotations:Ir()});var vC=u$1(2,(t,r)=>Object.assign(Object.create(Bi),m$1(l({},t),{annotations:us(t.annotations,r)})));var bC=u$1(3,(t,r,o)=>Object.assign(Object.create(Bi),m$1(l({},t),{annotations:Cn$1(t.annotations,r,o)})));var Dd=class extends xt$1.Service()(`@froment/contracts/ApiCredentials`){};var Fd=class extends xt$1.Service()(`@froment/contracts/ApiPrincipal`){};var EC=Li.http({scheme:`bearer`}).pipe(Li.annotateMerge(xt.annotations({format:`froment_api_v1_<token-id>.<secret>`})));var Ie=class extends Nt.Service()(`@froment/contracts/ApiAuthentication`,{requiredForClient:!1,security:{bearer:EC},error:[k,he]}){};var H=class extends Nt.Service()(`@froment/contracts/ApiBrowserRequest`,{error:he}){};var S=class extends Nt.Service()(`@froment/contracts/ApiRequestBody`,{error:Ve}){};var Jr=xt$1.Reference(`@froment/contracts/RequestBodyKind`,{defaultValue:()=>`standard`});var Pi=class extends Nt.Service()(`@froment/contracts/ApiTelemetry`){};var Di=class extends Nt.Service()(`@froment/contracts/ApiAuthorization`,{error:[k,v,he,E]}){};var m=t=>t.middleware(Ie);var na=class extends xt$1.Service()(`@froment/contracts/RequiredPermissions`){};var f=t=>{let[r,...o]=t,n=[r.code,...o.map(({code:i})=>i)];return i=>i.annotate(na,n).middleware(Di).annotateMerge(xt.annotations({override:{"x-required-permissions":n}}))};var g=t=>t.annotateMerge(xt.annotations({transform:r=>m$1(l({},r),{tags:[...r.tags,`frontend`]})}));var Fh=wu$1.Struct({id:_e.fields.id,action:_e.fields.action,actorUserId:_e.fields.actorUserId,resourceType:_e.fields.resourceType,resourceId:_e.fields.resourceId,occurredAt:_e.fields.occurredAt}).annotate({identifier:`GlobalAuditEvent`});var Hd=wu$1.Struct({cursor:wu$1.optionalKey(a),direction:wu$1.optionalKey(wu$1.Literals([`older`,`newer`])),limit:wu$1.optionalKey(wu$1.NumberFromString.check(wu$1.isInt(),wu$1.isGreaterThan(0))),action:wu$1.optionalKey(Ms),resourceType:wu$1.optionalKey(qs)}).check(wu$1.makeFilter(t=>t.direction!==`newer`||t.cursor!==void 0,{message:`audit.newer_requires_cursor`})).annotate({identifier:`GlobalAuditQuery`});var Md=wu$1.Struct({items:wu$1.Array(Fh),previousCursor:wu$1.NullOr(a),nextCursor:wu$1.NullOr(a)}).annotate({identifier:`GlobalAuditPage`});var qo=class extends wu$1.TaggedError()(`InvalidAuditQuery`,{code:wu$1.Literal(`audit.invalid_query`)}){};var Uo=class extends wu$1.TaggedError()(`AuditUnavailable`,{code:wu$1.Literal(`audit.unavailable`)}){};var wC=wu$1.Union([k,v,E,qo,Uo]);var Fi=class extends D.make(`audit`,{topLevel:!0}).add(u.get(`auditEventList`,`/api/audit-events`,{query:Hd,success:Md,error:[qo.pipe(p.status(400)),k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),Uo.pipe(p.status(503))]}).pipe(f([A.auditRead]),m,g)){};var ar=wu$1.Struct({id:a,displayName:fe,addressLine1:wu$1.String,addressLine2:wu$1.String,postalCode:wu$1.String,city:wu$1.String,country:wu$1.String,email:wu$1.String,phone:wu$1.String,archived:wu$1.Boolean,updatedAt:wu$1.Int}).annotate({identifier:`ClientSummary`});var qd=wu$1.Array(ar);var Ud=wu$1.Struct({displayName:fe.check(wu$1.isMaxLength(120)),addressLine1:wu$1.String.check(wu$1.isMaxLength(160)),addressLine2:wu$1.String.check(wu$1.isMaxLength(160)),postalCode:wu$1.String.check(wu$1.isMaxLength(32)),city:wu$1.String.check(wu$1.isMaxLength(120)),country:wu$1.String.check(wu$1.isMaxLength(120)),email:wu$1.String.check(wu$1.isMaxLength(254),wu$1.isPattern(/^$|^[^\s@]+@[^\s@]+\.[^\s@]+$/)),phone:wu$1.String.check(wu$1.isMaxLength(64),wu$1.isPattern(/^$|^\+?[0-9][0-9 ()\-./]{5,62}$/))});var Qd=wu$1.Struct(l({requestId:wu$1.String.check(wu$1.isUUID(4))},Ud.fields)).annotate({identifier:`ClientCreateRequest`});var Nd=wu$1.Struct(m$1(l({},Ud.fields),{expectedUpdatedAt:wu$1.Int})).annotate({identifier:`ClientUpdateRequest`});var ia=wu$1.Struct({id:a,clientId:a,email:se,createdAt:wu$1.Int});var Od=wu$1.Array(ia);var Gd=wu$1.Struct({email:se,password:Oe});var ue=class extends wu$1.TaggedError()(`ClientNotFound`,{code:wu$1.Literal(`client.not_found`)},{httpApiStatus:404}){};var ze=class extends wu$1.TaggedError()(`ClientArchived`,{code:wu$1.Literal(`client.archived`)},{httpApiStatus:409}){};var Qo=class extends wu$1.TaggedError()(`ClientVersionConflict`,{code:wu$1.Literal(`client.version_conflict`)},{httpApiStatus:409}){};var No=class extends wu$1.TaggedError()(`ClientEmailConflict`,{code:wu$1.Literal(`client.email_conflict`)},{httpApiStatus:409}){};var Oo=class extends wu$1.TaggedError()(`ClientCreationConflict`,{code:wu$1.Literal(`client.creation_conflict`)},{httpApiStatus:409}){};var Go=class extends wu$1.TaggedError()(`ClientAccessNotFound`,{code:wu$1.Literal(`client.access_not_found`)},{httpApiStatus:404}){};var TC=wu$1.Union([k,v,ue,ze,Qo,No,Oo,Go,E]);var sa=wu$1.Literals([`france`,`eu-reverse-charge`,`non-eu-import`,`foreign-local-tax`]);var aa=wu$1.Struct({displayName:fe.check(wu$1.isMaxLength(160)),addressLine1:wu$1.String.check(wu$1.isMaxLength(160)),addressLine2:wu$1.String.check(wu$1.isMaxLength(160)),postalCode:wu$1.String.check(wu$1.isMaxLength(32)),city:wu$1.String.check(wu$1.isMaxLength(120)),country:wu$1.String.check(wu$1.isMaxLength(120)),email:wu$1.String.check(wu$1.isMaxLength(254),wu$1.isPattern(/^$|^[^\s@]+@[^\s@]+\.[^\s@]+$/)),phone:wu$1.String.check(wu$1.isMaxLength(64),wu$1.isPattern(/^$|^\+?[0-9][0-9 ()\-./]{5,62}$/)),registrationNumber:wu$1.String.check(wu$1.isMaxLength(64)),vatNumber:wu$1.String.check(wu$1.isMaxLength(64)),taxTreatment:sa,defaultCurrency:wu$1.String.check(wu$1.isPattern(/^[A-Z]{3}$/)),paymentTermsDays:wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:365})),iban:wu$1.String.check(wu$1.isMaxLength(42),wu$1.isPattern(/^$|^[A-Za-z]{2}[0-9A-Za-z ]{13,40}$/)),bic:wu$1.String.check(wu$1.isMaxLength(11),wu$1.isPattern(/^$|^[A-Za-z0-9]{8}(?:[A-Za-z0-9]{3})?$/))}).annotate({identifier:`SupplierInput`});var cr=wu$1.Struct(m$1(l({id:a},aa.fields),{archived:wu$1.Boolean,viesValidatedAt:wu$1.NullOr(wu$1.Int),updatedAt:wu$1.Int})).annotate({identifier:`SupplierSummary`});var Kd=wu$1.Array(cr);var Wd=wu$1.Struct(l({requestId:wu$1.String.check(wu$1.isUUID(4))},aa.fields)).annotate({identifier:`SupplierCreateRequest`});var Jd=wu$1.Struct(m$1(l({},aa.fields),{expectedUpdatedAt:wu$1.Int})).annotate({identifier:`SupplierUpdateRequest`});var Ot=class extends wu$1.TaggedError()(`SupplierNotFound`,{code:wu$1.Literal(`supplier.not_found`)}){};var Ko=class extends wu$1.TaggedError()(`SupplierArchived`,{code:wu$1.Literal(`supplier.archived`)}){};var Wo=class extends wu$1.TaggedError()(`SupplierVersionConflict`,{code:wu$1.Literal(`supplier.version_conflict`)}){};var Jo=class extends wu$1.TaggedError()(`SupplierCreationConflict`,{code:wu$1.Literal(`supplier.creation_conflict`)}){};var Yr=class extends wu$1.TaggedError()(`SupplierTaxInvalid`,{code:wu$1.Literals([`supplier.tax_invalid`,`supplier.vies_unavailable`])}){};var BC=wu$1.Union([k,v,Ot,Ko,Wo,Jo,Yr,E]);var Hh=9e12;var LC=4e12;var PC=1e4;var DC=500;var _d=1;var FC=80;var HC=500;var MC=4e3;var jd=255;var x0=2;var S0=2;var I0=100;var qC=2e3;var UC=2e3;var Mh=4;var zd=100;var QC=100;var NC=Hh*100;var C0=70;var k0=35;var Vr=wu$1.String.check(wu$1.isPattern(/^\d{4}-\d{2}-\d{2}$/));var St=wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:Hh}));var OC=wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:NC}));var GC=wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:LC}));var KC=wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:PC}));var WC=wu$1.Literals([`draft`,`confirmed`,`approved`,`paid`,`cancelled`]);var qh=wu$1.Literals([`manual`,`ocr`]);var JC=wu$1.Literals([`invoice`,`credit`]);var Uh=wu$1.Struct({description:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500)),netTotalCents:GC,vatRateBasisPoints:KC});var YC=wu$1.Struct(m$1(l({id:a,position:wu$1.Int.check(wu$1.isGreaterThanOrEqualTo(0))},Uh.fields),{vatTotalCents:St,totalCents:St}));var ca={supplierId:a,reference:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(80)),invoiceDate:Vr,dueDate:Vr,currency:_t,lines:wu$1.Array(Uh).check(wu$1.isMinLength(1),wu$1.isMaxLength(500)),notes:wu$1.String.check(wu$1.isMaxLength(MC))};var Qh=wu$1.makeFilter(({invoiceDate:t,dueDate:r})=>r>=t,{message:`supplier_invoice.date_order_invalid`});var Xd=wu$1.Struct(m$1(l({requestId:wu$1.String.check(wu$1.isUUID(4))},ca),{source:qh,sourceFileName:wu$1.NullOr(wu$1.String.check(wu$1.isMaxLength(255))),externalSubmissionId:wu$1.NullOr(a)})).check(Qh).annotate({identifier:`SupplierInvoiceCreateRequest`});var Nh=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),sourceInvoiceId:a});var Oh=wu$1.Struct(m$1(l({},ca),{expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))})).check(Qh).annotate({identifier:`SupplierInvoiceUpdateRequest`});var It=wu$1.Struct({id:a,supplierId:a,supplierName:wu$1.String,taxTreatment:sa,documentKind:JC,sourceInvoiceId:wu$1.NullOr(a),reference:ca.reference,invoiceDate:Vr,dueDate:Vr,currency:_t,lines:wu$1.Array(YC),notes:ca.notes,netTotalCents:St,vatTotalCents:St,totalCents:St,functionalCurrency:wu$1.NullOr(_t),exchangeRateDate:wu$1.NullOr(Vr),foreignUnitsPerFunctionalUnitNanos:wu$1.NullOr(St),functionalNetTotalCents:wu$1.NullOr(St),functionalVatTotalCents:wu$1.NullOr(St),functionalTotalCents:wu$1.NullOr(St),status:WC,source:qh,sourceFileName:Xd.fields.sourceFileName,externalSubmissionId:wu$1.NullOr(a),confirmedAt:wu$1.NullOr(wu$1.Int),approvedAt:wu$1.NullOr(wu$1.Int),version:wu$1.Int.check(wu$1.isGreaterThan(0)),createdAt:wu$1.Int,updatedAt:wu$1.Int}).annotate({identifier:`SupplierInvoice`});var Gh=wu$1.Array(It);var pa=wu$1.Struct({expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))});var Kh=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),executionDate:Vr,invoiceIds:wu$1.Array(a).check(wu$1.isMinLength(1),wu$1.isMaxLength(100))});var VC=wu$1.Struct({invoiceId:a,reference:wu$1.String,supplierName:wu$1.String,amountCents:St});var $d=wu$1.Struct({id:a,messageId:wu$1.String,executionDate:Vr,transactionCount:wu$1.Int.check(wu$1.isGreaterThan(0)),controlSumCents:OC,createdAt:wu$1.Int,invoices:wu$1.Array(VC).check(wu$1.isMinLength(1),wu$1.isMaxLength(100))});var Wh=wu$1.Array($d).check(wu$1.isMaxLength(100));var Jh=wu$1.Literals([`local`,`openai`]);var eu=wu$1.Struct({adapter:Jh,endpoint:wu$1.NullOr(wu$1.String),credentialsPresent:wu$1.Boolean,external:wu$1.Boolean,updatedAt:wu$1.NullOr(wu$1.Int)});var Yh=wu$1.Struct({external:wu$1.Boolean});var Vh=wu$1.Struct({adapter:Jh,endpoint:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^https:\/\/[^\s/@]+(?:\/[^\s]*)?$/),wu$1.isMaxLength(qC))),apiKey:wu$1.optional(wu$1.String.check(wu$1.isMaxLength(UC)))});var Zh=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),supplierId:a,fileName:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(255)),mediaType:wu$1.Literals([`application/pdf`,`image/jpeg`,`image/png`,`image/webp`]),contentBase64:wu$1.String.check(wu$1.isMinLength(4),wu$1.isPattern(/^[A-Za-z0-9+/]*={0,2}$/)),consent:wu$1.Boolean});var Hi=wu$1.Struct({id:a,invoiceId:a,fileName:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(255)),mediaType:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),size:wu$1.Int.check(wu$1.isGreaterThan(0)),sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:wu$1.Int});var _h=wu$1.Array(Hi);var jh=wu$1.Struct({invoiceId:a,fileName:Hi.fields.fileName,mediaType:Hi.fields.mediaType,contentBase64:wu$1.String.check(wu$1.isMinLength(4),wu$1.isPattern(/^[A-Za-z0-9+/]*={0,2}$/))});var Yd=class extends wu$1.TaggedError()(`SupplierInvoiceNotFound`,{code:wu$1.Literal(`supplier_invoice.not_found`)},{httpApiStatus:404}){};var Vd=class extends wu$1.TaggedError()(`SupplierPaymentBatchNotFound`,{code:wu$1.Literal(`supplier_payment_batch.not_found`)},{httpApiStatus:404}){};var Zd=class extends wu$1.TaggedError()(`SupplierInvoiceConflict`,{code:wu$1.Literals([`supplier_invoice.version_conflict`,`supplier_invoice.creation_conflict`,`supplier_invoice.reference_exists`,`supplier_invoice.not_editable`,`supplier_invoice.invalid_transition`,`supplier_invoice.exchange_rate_missing`,`supplier_invoice.accounting_unavailable`,`supplier_invoice.evidence_invalid`,`supplier_invoice.supplier_unavailable`,`supplier_invoice.analysis_not_configured`,`supplier_invoice.analysis_consent_required`,`supplier_invoice.analysis_failed`,`supplier_invoice.encryption_unavailable`,`supplier_payment_batch.creation_conflict`,`supplier_payment_batch.invoice_not_payable`,`supplier_payment_batch.currency_not_supported`,`supplier_payment_batch.debtor_account_incomplete`,`supplier_payment_batch.creditor_account_incomplete`,`supplier_payment_batch.party_name_too_long`])},{httpApiStatus:409}){};var ae=wu$1.Union([Yd,Vd,Zd]);var tu=wu$1.Struct({available:wu$1.Boolean});var ru=wu$1.Struct({bootstrapPassword:wu$1.NonEmptyString.check(wu$1.isMaxLength(256)),email:se,password:Oe});var ou=Vt;var Yo=class extends wu$1.TaggedError()(`BootstrapRejected`,{code:wu$1.Literal(`bootstrap.invalid_credentials`)},{httpApiStatus:401}){};var Vo=class extends wu$1.TaggedError()(`BootstrapUnavailable`,{code:wu$1.Literal(`bootstrap.unavailable`)},{httpApiStatus:409}){};var Zo=class extends wu$1.TaggedError()(`BootstrapRateLimited`,{code:wu$1.Literal(`bootstrap.rate_limited`)},{httpApiStatus:429}){};var ZC=wu$1.Union([Yo,Vo,Zo]);var nu=wu$1.Struct({iban:wu$1.String.check(wu$1.isMaxLength(42),wu$1.isPattern(/^$|^[A-Za-z]{2}[0-9A-Za-z ]{13,40}$/)),bic:wu$1.String.check(wu$1.isMaxLength(11),wu$1.isPattern(/^$|^[A-Za-z0-9]{8}(?:[A-Za-z0-9]{3})?$/))});var da=wu$1.Struct(m$1(l(l({},ft.fields),nu.fields),{version:b}));var iu=wu$1.Struct(m$1(l(l({},ft.fields),nu.fields),{expectedVersion:b}));var Mi=class extends wu$1.TaggedError()(`IssuerSettingsConflict`,{code:wu$1.Literal(`issuer.conflict`)},{httpApiStatus:409}){};var _C=160;var zh=wu$1.Literals([`open`,`closed`]);var jC=wu$1.String.check(wu$1.isPattern(/^AF-\d{4}-\d{6}$/));var qi=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),clientId:a,title:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160))});var Xh=wu$1.Struct({expectedVersion:b,title:qi.fields.title,status:zh});var Ui=wu$1.Struct({id:a,requestId:qi.fields.requestId,reference:jC,clientId:a,clientDisplayName:wu$1.String,title:qi.fields.title,status:zh,version:b,createdAt:w,updatedAt:w,quoteIds:wu$1.Array(a),orderIds:wu$1.Array(a),invoiceIds:wu$1.Array(a)});var $h=wu$1.Array(Ui).check(wu$1.isMaxLength(1e4));var Ct=class extends wu$1.TaggedError()(`AffairNotFound`,{code:wu$1.Literal(`affair.not_found`)},{httpApiStatus:404}){};var kt=class extends wu$1.TaggedError()(`AffairConflict`,{code:wu$1.Literal(`affair.conflict`)},{httpApiStatus:409}){};var N0=wu$1.Union([Ct,kt,k,v]);var au=wu$1.String.check(wu$1.isPattern(/^[A-Za-z0-9_-]{43}$/));var zC=wu$1.decodeOption(wu$1.URLFromString);var cu=wu$1.Literals([`draft`,`sent`,`accepted`,`rejected`,`expired`,`cancelled`]);var eg=Rr;var tg=wu$1.Array(eg).check(wu$1.isMinLength(1),wu$1.isMaxLength(20));var Qi=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120));var ua=wu$1.String.check(wu$1.isMaxLength(2e3));var la=wu$1.makeFilter(t=>qt(t.conditions,t.conditionsPresentation?.format??`plain`)||`document.conditions_format.invalid`);var pu=wu$1.Struct({affairId:wu$1.optionalKey(a),clientId:a,currency:U,title:Qi,conditions:ua,conditionsPresentation:wu$1.optionalKey(xe),lines:tg}).check(la).annotate({identifier:`QuoteCreateRequest`});var du=wu$1.Struct({expectedVersion:b,currency:U,title:Qi,conditions:ua,conditionsPresentation:wu$1.optionalKey(xe),lines:tg}).check(la).annotate({identifier:`QuoteRevisionCreateRequest`});var uu=wu$1.Struct({expectedVersion:b});var lu=wu$1.Struct({id:a,expiresAt:w});var Au=wu$1.Struct({expectedVersion:b,expectedLinkId:wu$1.NullOr(a)});var rg=wu$1.Literals([`client-declined`,`scope-changed`,`budget-unavailable`,`duplicate`,`replaced`,`other`]);var mu=wu$1.Struct({expectedVersion:b,reason:rg,note:wu$1.String.check(wu$1.isMaxLength(500))});var Aa=wu$1.Struct({token:au});var XC=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160));var $C=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160));var fu=wu$1.Struct({token:au,signerName:XC,consent:wu$1.Literal(!0),signature:wu$1.Struct({kind:wu$1.Literal(`typed`),value:$C})});var ek=ei;var og=wu$1.Struct({templateId:wu$1.Literal(`quote-default`),templateVersion:wu$1.Literal(1),calendar:wu$1.optionalKey(wr),quoteId:a,quoteReference:ge,revisionId:a,version:b,createdAt:w,issuer:ft,client:$t,title:Qi,conditions:ua,conditionsPresentation:wu$1.optionalKey(xe),currency:U,netTotalCents:B,vatTotalCents:B,totalCents:B,lines:Zt}).check(rt,la);var hu=wu$1.Struct({status:wu$1.Literals([`sent`,`accepted`]),canSign:wu$1.Boolean,expiresAt:w,snapshot:og});var gu=wu$1.Struct({quoteId:a,revisionId:a,signatureId:a,orderId:a,quoteReference:ge,orderReference:Le,status:wu$1.Literal(`accepted`),acceptedAt:w,evidenceSha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/))});var su=wu$1.Struct({id:a,version:b,previewAvailable:wu$1.Boolean,pdfAvailable:wu$1.Boolean,clientDisplayName:fe,title:Qi,conditions:ua,conditionsPresentation:wu$1.optionalKey(xe),currency:U,netTotalCents:B,vatTotalCents:B,totalCents:B,createdAt:w,createdByUserId:a,lines:Zt}).check(rt,la).annotate({identifier:`QuoteRevision`});var ng=wu$1.Struct({id:a,reference:ge,clientId:a,clientDisplayName:fe,status:cu,version:b,title:Qi,currency:U,totalCents:B,updatedAt:w}).annotate({identifier:`QuoteSummary`});var zo=wu$1.Struct({id:a,reference:ge,clientId:a,status:cu,version:b,currentRevision:su,revisions:wu$1.Array(su)}).annotate({identifier:`QuoteDetail`});var ma=wu$1.Struct({quoteId:a,revisionId:a,status:wu$1.Literal(`sent`),version:b,link:wu$1.Struct({id:a,url:wu$1.String.check(wu$1.makeFilter(t=>Me.exists(zC(t),r=>[`http:`,`https:`].includes(r.protocol)),{message:`quote.link.url.invalid`}),wu$1.isMaxLength(2048)),expiresAt:w})});var yu=wu$1.Array(ng);var Pe=class extends wu$1.TaggedError()(`QuoteNotFound`,{code:wu$1.Literal(`quote.not_found`)},{httpApiStatus:404}){};var Rt=class extends wu$1.TaggedError()(`QuoteVersionConflict`,{code:wu$1.Literal(`quote.version_conflict`),currentVersion:b},{httpApiStatus:409}){};var Zr=class extends wu$1.TaggedError()(`QuoteAmountTooLarge`,{code:wu$1.Literal(`quote.amount_too_large`)},{httpApiStatus:422}){};var pt=class extends wu$1.TaggedError()(`QuoteNotEditable`,{code:wu$1.Literal(`quote.not_editable`)},{httpApiStatus:409}){};var _r=class extends wu$1.TaggedError()(`QuotePdfRequired`,{code:wu$1.Literal(`quote.pdf_required`)},{httpApiStatus:409}){};var pr=class extends wu$1.TaggedError()(`QuoteLinkNotFound`,{code:wu$1.Literal(`quote_link.not_found`)},{httpApiStatus:404}){};var _o=class extends wu$1.TaggedError()(`QuoteLinkNotSignable`,{code:wu$1.Literal(`quote_link.not_signable`)},{httpApiStatus:409}){};var jo=class extends wu$1.TaggedError()(`QuoteLinkConflict`,{code:wu$1.Literal(`quote_link.conflict`)},{httpApiStatus:409}){};var tk=wu$1.Union([k,v,Pe,Rt,Zr,pt,nt,_r,pr,_o,jo,pe,ue,ot,ze,Ct,kt,E]);var L={sixtyPerMinute:60,tenPerMinute:10};var fa=class extends xt$1.Service()(`@froment/contracts/EndpointRateLimit`){};var P=t=>r=>r.annotate(fa,t);var Ni=wu$1.Struct(m$1(l({},Rr.fields),{currency:U}));var Oi=wu$1.Struct(m$1(l({},Ni.fields),{id:a,version:b,archived:wu$1.Boolean}));var xu=wu$1.Array(Oi);var Su=wu$1.Struct(m$1(l({},Ni.fields),{expectedVersion:b,archived:wu$1.Boolean}));var Xo=class extends wu$1.TaggedError()(`CatalogItemNotFound`,{code:wu$1.Literal(`catalog.not_found`)},{httpApiStatus:404}){};var $o=class extends wu$1.TaggedError()(`CatalogItemVersionConflict`,{code:wu$1.Literal(`catalog.version_conflict`)},{httpApiStatus:409}){};var rk=wu$1.Union([k,v,E,Xo,$o]);var ha=class extends D.make(`catalog`,{topLevel:!0}).add(u.get(`catalogList`,`/api/catalog`,{success:xu,error:[k,v]}).pipe(f([A.catalogRead]),m,g),u.post(`catalogCreate`,`/api/catalog`,{payload:Ni,success:Oi,error:[k,v,E]}).middleware(S).pipe(f([A.catalogManage]),m,P(L.sixtyPerMinute),g),u.put(`catalogUpdate`,`/api/catalog/:itemId`,{params:{itemId:a},payload:Su,success:Oi,error:[k,v,E,Xo,$o]}).middleware(S).pipe(f([A.catalogManage]),m,P(L.sixtyPerMinute),g)){};var ok=wu$1.Struct({operationId:a,attempts:B,status:wu$1.Literals([`waiting`,`processing`,`completed`,`exhausted`,`blocked`]),nextAttemptAt:wu$1.NullOr(w),error:wu$1.NullOr(wu$1.Literals([`integration.unavailable`,`integration.request_conflict`,`integration.invalid_request`,`integration.retry_permission`,`integration.retry_interrupted`,`integration.retry_database`]))});var ig=wu$1.Array(ok);var en=wu$1.Literals([`plain`,`blocks`]);var tn=wu$1.String.check(wu$1.isMaxLength(2e4));var vt=wu$1.makeFilter(t=>qt(t.body,t.bodyFormat)||`email.body_format.invalid`);var Iu=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160));var Gi={requestId:wu$1.String.check(wu$1.isUUID(4)),reference:Iu,expectedMode:wu$1.Literals([`simulation`,`live`])};var sg=wu$1.Struct(m$1(l({},Gi),{kind:wu$1.Literal(`email`),recipient:se,subject:Iu,body:tn.check(wu$1.isPattern(/\S/)),bodyFormat:en})).check(vt);var ag=wu$1.Struct(m$1(l({},Gi),{kind:wu$1.Literal(`signature`),artifactId:a,signerEmail:se}));var cg=wu$1.Struct(m$1(l({},Gi),{kind:wu$1.Literal(`payment`),amountCents:b,currency:U,customerEmail:se}));var pg=wu$1.Struct(m$1(l({},Gi),{kind:wu$1.Literal(`banking`),accountReference:Iu,from:T,to:T}));var dg=wu$1.Struct(m$1(l({},Gi),{kind:wu$1.Literal(`electronic-invoice`),artifactId:a}));var ya=wu$1.Union([sg,ag,cg,pg,dg]);var nn=wu$1.Literals([`email`,`signature`,`payment`,`banking`,`electronic-invoice`]);var ug=wu$1.Union([wu$1.Struct({id:wu$1.NonEmptyString,mode:wu$1.Literal(`simulation`),status:wu$1.Literal(`simulated`)}),wu$1.Struct({id:wu$1.NonEmptyString,mode:wu$1.Literal(`live`),status:wu$1.Literal(`submitted`)})]);var xa=wu$1.Struct({id:a,request:ya,receipt:wu$1.NullOr(ug),createdAt:w,createdByUserId:a});var Cu=wu$1.Array(xa);var nk=wu$1.Struct({kind:nn,mode:wu$1.Literals([`simulation`,`live`])});var ku=wu$1.Array(nk);var ga=class extends wu$1.TaggedError()(`IntegrationConflict`,{code:wu$1.Literal(`integration.request_conflict`)},{httpApiStatus:409}){};var rn=class extends wu$1.TaggedError()(`IntegrationInvalid`,{code:wu$1.Literal(`integration.invalid_request`)},{httpApiStatus:422}){};var on=class extends wu$1.TaggedError()(`IntegrationUnavailable`,{code:wu$1.Literal(`integration.unavailable`)},{httpApiStatus:503}){};var We=wu$1.Union([k,v,E,ga,rn,on]);var Sa=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),invoiceId:a,expectedVersion:b});var ik=wu$1.String.check(wu$1.isPattern(/^https:\/\/checkout\.stripe\.com\/[^\s]+$/));var sk=wu$1.String.check(wu$1.isPattern(/^cs_test_[A-Za-z0-9]+$/));var ak=wu$1.Literals([`checkout.credentialsMissing`,`checkout.testKeyRequired`,`checkout.credentialsChanged`,`checkout.permissionRevoked`,`checkout.invoiceChanged`,`checkout.deadline`,`checkout.unavailable`,`checkout.rejected`,`checkout.rateLimited`,`checkout.statusUnavailable`,`checkout.statusWindowExceeded`,`checkout.responseMismatch`]);var Ia=wu$1.Struct({request:Sa,revisionId:a,invoiceNumber:wu$1.NonEmptyString,amountCents:wu$1.Int.check(wu$1.isBetween({minimum:50,maximum:99999999})),currency:U,mode:wu$1.Literal(`test`),createdByUserId:a,createdAt:w,updatedAt:w,expiresAt:w,status:wu$1.Literals([`queued`,`creating`,`retrying`,`open`,`paid`,`expired`,`failed`,`blocked`]),attempts:wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:5})),nextAttemptAt:wu$1.NullOr(w),sessionId:wu$1.NullOr(sk),checkoutUrl:wu$1.NullOr(ik),error:wu$1.NullOr(ak)});var WT=t=>t.status===`open`&&t.nextAttemptAt===null&&t.sessionId!==null;var lg=wu$1.Array(Ia);var Ag=wu$1.Struct({credentialsPresent:wu$1.Boolean,testKey:wu$1.Boolean,webhookConfigured:wu$1.Boolean});var Ru=class extends wu$1.TaggedError()(`CheckoutConflict`,{code:wu$1.Literals([`checkout.conflict`,`checkout.active`,`checkout.limit`,`checkout.invoiceIneligible`,`checkout.reconcileDenied`,`checkout.notFound`])},{httpApiStatus:409}){};var Ki=wu$1.Union([...We.members,Ru]);var ck=wu$1.Struct({provider:wu$1.Literals([`resend`,`stripe`,`signwell`,`superpdp`]),credentialsPresent:wu$1.Boolean,missingSecrets:wu$1.Array(wu$1.String),mode:wu$1.Literals([`restricted-test`,`not-connected`])});var mg=wu$1.Array(ck);var jT={from:`Sacha — froment.software <sacha@mail.froment.software>`,replyTo:`sacha@froment.software`,recipient:`sacha@sacha.house`};var bu=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),subject:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isPattern(/^[^\r\n]*$/),wu$1.isMaxLength(160)),body:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(2e4))});var pk=wu$1.Literals([`emailTest.credentialsMissing`,`emailTest.credentialsChanged`,`emailTest.permissionRevoked`,`emailTest.rejected`,`emailTest.rateLimited`,`emailTest.unavailable`,`emailTest.expired`,`emailTest.statusUnavailable`]);var Eu=wu$1.Struct({request:bu,createdByUserId:a,createdAt:w,updatedAt:w,status:wu$1.Literals([`queued`,`sending`,`retrying`,`accepted`,`delivered`,`bounced`,`complained`,`failed`,`blocked`]),attempts:wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:5})),nextAttemptAt:wu$1.NullOr(w),providerId:wu$1.NullOr(wu$1.String.check(wu$1.isUUID())),error:wu$1.NullOr(pk)});var fg=wu$1.Array(Eu);var vu=class extends wu$1.TaggedError()(`EmailTestConflict`,{code:wu$1.Literals([`emailTest.conflict`,`emailTest.active`,`emailTest.limit`])},{httpApiStatus:409}){};var wu=wu$1.Union([...We.members,vu]);var Ca=class extends D.make(`integrations`,{topLevel:!0}).add(u.get(`checkoutConnection`,`/api/integrations/checkout/connection`,{success:Ag,error:Ki.members}).pipe(f([A.integrationConfigure]),m,g),u.get(`checkoutList`,`/api/integrations/checkout`,{success:lg,error:Ki.members}).pipe(f([A.integrationConfigure,A.invoiceRead]),m,g),u.post(`checkoutCreate`,`/api/integrations/checkout`,{payload:Sa,success:Ia,error:Ki.members}).middleware(S).middleware(H).pipe(f([A.integrationConfigure,A.invoiceRead]),m,P(L.tenPerMinute),g),u.post(`checkoutReconcile`,`/api/integrations/checkout/:requestId/reconcile`,{params:{requestId:Sa.fields.requestId},payload:wu$1.Struct({}),success:Ia,error:Ki.members}).middleware(S).middleware(H).pipe(f([A.integrationConfigure,A.invoiceRead]),m,P(L.tenPerMinute),g),u.get(`providerConnections`,`/api/integrations/connections`,{success:mg,error:We.members}).pipe(f([A.integrationConfigure]),m,g),u.get(`emailTestList`,`/api/integrations/email-tests`,{success:fg,error:wu.members}).pipe(f([A.integrationConfigure]),m,g),u.post(`emailTestCreate`,`/api/integrations/email-tests`,{payload:bu,success:Eu,error:wu.members}).middleware(S).middleware(H).pipe(f([A.integrationConfigure]),m,P(L.tenPerMinute),g),u.get(`integrationRetryList`,`/api/integrations/retries`,{success:ig,error:We.members}).pipe(f([A.integrationManage]),m,g),u.get(`integrationStatus`,`/api/integrations`,{success:ku,error:We.members}).pipe(f([A.integrationManage]),m,g),u.get(`integrationOperationList`,`/api/integrations/operations`,{query:{kind:wu$1.optional(nn)},success:Cu,error:We.members}).pipe(f([A.integrationManage]),m,g),u.post(`integrationOperationCreate`,`/api/integrations/operations`,{payload:ya,success:xa,error:We.members}).middleware(S).middleware(H).pipe(f([A.integrationManage]),m,P(L.tenPerMinute),g)){};var hg=5e5;var dk=1e3;var uk=1e4;var sn=100;var gg=wu$1.Literals([`camt.053`,`ofx`,`csv`]);var yg=wu$1.Struct({delimiter:wu$1.Literals([`,`,`;`,` `]),referenceColumn:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(100)),bookedOnColumn:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(100)),amountColumn:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(100)),currencyColumn:wu$1.String.check(wu$1.isMaxLength(100)),descriptionColumn:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(100)),dateFormat:wu$1.Literals([`yyyy-MM-dd`,`dd/MM/yyyy`]),decimalSeparator:wu$1.Literals([`.`,`,`])});var lk={delimiter:`,`,referenceColumn:`transaction_id`,bookedOnColumn:`booked_on`,amountColumn:`amount`,currencyColumn:`currency`,descriptionColumn:`description`,dateFormat:`yyyy-MM-dd`,decimalSeparator:`.`};var ba=wu$1.Struct({account:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(100)),format:gg,content:wu$1.String.check(wu$1.isMinLength(1),wu$1.isMaxLength(hg)),csvConfiguration:wu$1.NullOr(yg)}).check(wu$1.makeFilter(({format:t,csvConfiguration:r})=>t===`csv`&&r!==null||t!==`csv`&&r===null,{message:`bank.import_configuration_invalid`}));var xg=wu$1.Struct({feeCents:B,matchId:a,paymentId:a,invoiceId:a,invoiceNumber:wu$1.NullOr(wu$1.String),amountCents:b,paymentCancelled:wu$1.Boolean,exchangeDifferenceFunctionalCents:B});var Ea=wu$1.Struct({id:a,account:wu$1.String,reference:wu$1.String,bookedOn:T,amountCents:wu$1.Int,currency:U,functionalCurrency:U,exchangeRateDate:T,foreignUnitsPerFunctionalUnitNanos:b,functionalAmountCents:wu$1.Int,description:wu$1.String,importedAt:w,matchedCents:B,allocations:wu$1.Array(xg)});var Wi=wu$1.Array(Ea);var Tu=wu$1.Array(wu$1.Struct({id:a,paidOn:T,reference:wu$1.String,amountCents:b,availableCents:B,currency:U}));var Bu=wu$1.Array(wu$1.Struct({id:a,paymentId:a,feeCents:B,amountCents:b,invoiceId:a,invoiceNumber:wu$1.NullOr(wu$1.String),matchedAt:w,matchedByUserId:a,cancelledAt:wu$1.NullOr(w),cancelledByUserId:wu$1.NullOr(a),cancellationReason:wu$1.NullOr(wu$1.String),exchangeDifferenceFunctionalCents:B}));var Sg=10;var Ig=wu$1.Literals([`exact-amount`,`close-amount`,`invoice-reference`,`payment-reference`,`close-date`]);var Cg=wu$1.Struct({paymentId:a,invoiceId:a,invoiceNumber:wu$1.NullOr(wu$1.String),clientDisplayName:wu$1.String,paidOn:T,paymentReference:wu$1.String,amountCents:b,currency:U,score:wu$1.Int.check(wu$1.isBetween({minimum:0,maximum:100})),reasons:wu$1.Array(Ig).check(wu$1.isMinLength(1))});var Lu=wu$1.Array(Cg).check(wu$1.isMaxLength(10));var wa=wu$1.Struct({added:wu$1.Int,existing:wu$1.Int});var Pu=wu$1.Struct(m$1(l({},wa.fields),{rows:wu$1.Array(wu$1.Struct({reference:wu$1.String,bookedOn:T,amountCents:wu$1.Int,currency:U,functionalCurrency:U,exchangeRateDate:T,foreignUnitsPerFunctionalUnitNanos:b,functionalAmountCents:wu$1.Int,description:wu$1.String,existing:wu$1.Boolean}))}));var Du=wu$1.Struct({feeCents:B,requestId:wu$1.String.check(wu$1.isUUID(4)),paymentId:a,amountCents:b}).check(wu$1.makeFilter(t=>t.feeCents<t.amountCents,{message:`bank.invalid_fee`}));var Fu=wu$1.Struct({matchId:a,reason:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500))});var kg=wu$1.Struct({batchId:a,invoiceId:a,reference:wu$1.String,supplierName:wu$1.String,executionDate:T,amountCents:b,availableCents:B,matchedCents:B});var Ji=wu$1.Array(kg);var Rg=wu$1.Struct({id:a,batchId:a,invoiceId:a,amountCents:b,matchedAt:w,cancelledAt:wu$1.NullOr(w),cancellationReason:wu$1.NullOr(wu$1.String)});var Hu=wu$1.Array(Rg);var Mu=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),batchId:a,invoiceId:a,amountCents:b});var qu=wu$1.Struct({matchId:a,reason:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500))});var ka=class extends wu$1.TaggedError()(`BankImportInvalid`,{code:wu$1.Literal(`bank.import_invalid`)},{httpApiStatus:422}){};var Ra=class extends wu$1.TaggedError()(`BankMatchConflict`,{code:wu$1.Literal(`bank.match_conflict`)},{httpApiStatus:409}){};var va=class extends wu$1.TaggedError()(`BankTransactionNotFound`,{code:wu$1.Literal(`bank.transaction_not_found`)},{httpApiStatus:404}){};var Ee=wu$1.Union([ka,Ra,va,k,v,E]);var Ta=class extends D.make(`banking`,{topLevel:!0}).add(u.get(`bankPaymentList`,`/api/banking/invoices/:invoiceId/payments`,{params:{invoiceId:a},success:Tu,error:Ee.members}).pipe(f([A.bankRead,A.invoiceRead]),m,g),u.get(`bankMatchHistory`,`/api/banking/transactions/:transactionId/history`,{params:{transactionId:a},success:Bu,error:Ee.members}).pipe(f([A.bankRead]),m,g),u.get(`bankTransactionList`,`/api/banking/transactions`,{success:Wi,error:Ee.members}).pipe(f([A.bankRead]),m,g),u.get(`bankTransactionGet`,`/api/banking/transactions/:transactionId`,{params:{transactionId:a},success:Ea,error:Ee.members}).pipe(f([A.bankRead]),m,g),u.get(`supplierBankPaymentList`,`/api/banking/transactions/:transactionId/supplier-payments`,{params:{transactionId:a},success:Ji,error:Ee.members}).pipe(f([A.bankRead,A.supplierInvoiceRead]),m,g),u.get(`supplierBankMatchList`,`/api/banking/transactions/:transactionId/supplier-matches`,{params:{transactionId:a},success:Hu,error:Ee.members}).pipe(f([A.bankRead,A.supplierInvoiceRead]),m,g),u.get(`bankMatchSuggestionList`,`/api/banking/transactions/:transactionId/suggestions`,{params:{transactionId:a},success:Lu,error:Ee.members}).pipe(f([A.bankRead,A.invoiceRead]),m,g),u.post(`bankImportPreview`,`/api/banking/import/preview`,{payload:ba,success:Pu,error:Ee.members}).annotate(Jr,`bank-import`).middleware(S).middleware(H).pipe(f([A.bankImport]),m,P(L.sixtyPerMinute),g),u.post(`bankImport`,`/api/banking/import`,{payload:ba,success:wa,error:Ee.members}).annotate(Jr,`bank-import`).middleware(S).middleware(H).pipe(f([A.bankImport]),m,P(L.tenPerMinute),g),u.post(`bankMatch`,`/api/banking/transactions/:transactionId/match`,{params:{transactionId:a},payload:Du,success:Wi,error:Ee.members}).middleware(S).middleware(H).pipe(f([A.bankReconcile]),m,P(L.sixtyPerMinute),g),u.post(`bankUnmatch`,`/api/banking/transactions/:transactionId/unmatch`,{params:{transactionId:a},payload:Fu,success:Wi,error:Ee.members}).middleware(S).middleware(H).pipe(f([A.bankReconcile]),m,P(L.sixtyPerMinute),g),u.post(`supplierBankMatch`,`/api/banking/transactions/:transactionId/supplier-match`,{params:{transactionId:a},payload:Mu,success:Ji,error:Ee.members}).middleware(S).middleware(H).pipe(f([A.bankReconcile]),m,P(L.sixtyPerMinute),g),u.post(`supplierBankUnmatch`,`/api/banking/transactions/:transactionId/supplier-unmatch`,{params:{transactionId:a},payload:qu,success:Ji,error:Ee.members}).middleware(S).middleware(H).pipe(f([A.bankReconcile]),m,P(L.sixtyPerMinute),g)){};var Nu=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(80));var jr=wu$1.Struct({id:a,name:Nu,permissions:wu$1.Array(Cr).check(wu$1.isUnique()),version:wu$1.Int.check(wu$1.isGreaterThan(0)),createdAt:wu$1.Int,updatedAt:wu$1.Int}).annotate({identifier:`CustomRole`});var vg=wu$1.Array(jr);var bg=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),name:Nu,permissions:wu$1.Array(Cr).check(wu$1.isUnique())}).annotate({identifier:`CustomRoleCreateRequest`});var Eg=wu$1.Struct({name:Nu,permissions:wu$1.Array(Cr).check(wu$1.isUnique()),expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0))}).annotate({identifier:`CustomRoleUpdateRequest`});var Uu=class extends wu$1.TaggedError()(`CustomRoleNotFound`,{code:wu$1.Literal(`role.not_found`)},{httpApiStatus:404}){};var Qu=class extends wu$1.TaggedError()(`CustomRoleConflict`,{code:wu$1.Literals([`role.name_exists`,`role.creation_conflict`,`role.version_conflict`,`role.in_use`,`role.last_administrator`])},{httpApiStatus:409}){};var an=wu$1.Union([Uu,Qu]);var Ak=wu$1.String.check(wu$1.isPattern(/^custom:[0-7][0-9A-HJKMNP-TV-Z]{25}$/));var Ba=wu$1.Union([wu$1.Literals([`collaborator`,`accountant`,`accounting-validator`,`accounting-reader`]),Ak]);var qB={accountant:[`ledger.read`,`client.read`,`quote.read`,`order.read`,`invoice.read`,`payment.read`,`bank.read`,`issuer.read`,`document.download`,`catalog.read`,`condition.read`,`company.read`,`company.update`,`role.read`,`supplier.read`,`supplier.create`,`supplier.update`,`supplier.archive`,`supplier-invoice.read`,`supplier-invoice.create`,`supplier-invoice.update`,`supplier-invoice.approve`,`supplier-invoice.analyze`,`supplier-invoice.pay`,`accounting.read`,`accounting.write`,`accounting.validate`,`accounting.close`,`accounting.export`,`accounting.evidence`],"accounting-validator":[`company.read`,`supplier.read`,`supplier-invoice.read`,`invoice.read`,`bank.read`,`document.download`,`accounting.read`,`accounting.write`,`accounting.validate`,`accounting.export`,`accounting.evidence`],"accounting-reader":[`company.read`,`supplier.read`,`supplier-invoice.read`,`invoice.read`,`bank.read`,`document.download`,`accounting.read`,`accounting.export`],collaborator:[`client.read`,`client.create`,`client.update`,`quote.read`,`quote.create`,`quote.update`,`quote.send`,`order.read`,`invoice.read`,`invoice.create`,`invoice.update`,`invoice.issue`,`payment.read`,`invoice.mark-paid`,`bank.read`,`bank.import`,`bank.reconcile`,`catalog.read`,`condition.read`,`issuer.read`,`document.download`,`email.draft.manage`,`document.render`,`integration.manage`,`company.read`,`role.read`,`supplier.read`,`supplier-invoice.read`,`supplier-invoice.create`,`supplier-invoice.update`,`supplier-invoice.analyze`]};var La=wu$1.String.check(wu$1.isUUID(4));var Pa=wu$1.Struct({requestId:La,email:se,displayName:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),profile:Ba});var wg=wu$1.Struct({id:La,email:se,displayName:Pa.fields.displayName,profile:Ba,createdAt:wu$1.Int,expiresAt:wu$1.Int,cancelledAt:wu$1.NullOr(wu$1.Int),acceptedAt:wu$1.NullOr(wu$1.Int)});var Tg=wu$1.Struct({invitation:wg,url:wu$1.String});var Bg=wu$1.Struct({token:wu$1.String.check(wu$1.isPattern(/^[A-Za-z0-9_-]{43}$/)),password:Oe});var mk=wu$1.Struct({id:a,email:se,displayName:Pa.fields.displayName,profile:Ba,version:wu$1.Int,disabledAt:wu$1.NullOr(wu$1.Int)});var Lg=wu$1.Struct({expectedVersion:wu$1.Int.check(wu$1.isGreaterThan(0)),profile:Ba,disabled:wu$1.Boolean});var Pg=wu$1.Struct({members:wu$1.Array(mk),invitations:wu$1.Array(wg),roles:wu$1.Array(jr)});var Ou=class extends wu$1.TaggedError()(`TeamConflict`,{code:wu$1.Literals([`team.conflict`,`team.email_exists`,`team.invitation_exists`,`team.invitation_limit`,`team.invitation_changed`,`team.invitation_inactive`,`team.invitation_permission`,`team.role_unavailable`,`team.last_administrator`])},{httpApiStatus:409}){};var Gu=class extends wu$1.TaggedError()(`TeamInvitationRejected`,{code:wu$1.Literal(`team.invitation_rejected`)},{httpApiStatus:409}){};var cn=wu$1.Union([Ou,Gu]);var Da=class extends D.make(`team`,{topLevel:!0}).add(u.get(`teamList`,`/api/team`,{success:Pg,error:cn.members}).pipe(f([A.userRead]),m,g),u.post(`teamInvite`,`/api/team/invitations`,{payload:Pa,success:Tg,error:cn.members}).middleware(S).middleware(H).pipe(f([A.userCreate]),m,P(L.tenPerMinute),g),u.post(`teamInvitationCancel`,`/api/team/invitations/:invitationId/cancel`,{params:{invitationId:La},success:p.NoContent,error:cn.members}).middleware(H).pipe(f([A.userCreate]),m,g),u.put(`teamMemberUpdate`,`/api/team/members/:userId`,{params:{userId:a},payload:Lg,success:p.NoContent,error:cn.members}).middleware(S).middleware(H).pipe(f([A.userUpdate]),m,g),u.post(`teamInvitationAccept`,`/api/team/accept`,{payload:Bg,success:p.NoContent,error:[...cn.members,E]}).middleware(S).middleware(H).pipe(g)){};var Fa=class extends D.make(`roles`,{topLevel:!0}).add(u.get(`customRoleList`,`/api/roles`,{success:vg,error:an.members}).pipe(f([A.roleRead]),m,g),u.get(`customRoleGet`,`/api/roles/:roleId`,{params:{roleId:a},success:jr,error:an.members}).pipe(f([A.roleRead]),m,g),u.post(`customRoleCreate`,`/api/roles`,{payload:bg,success:jr,error:an.members}).middleware(S).pipe(f([A.roleManage]),m,g),u.put(`customRoleUpdate`,`/api/roles/:roleId`,{params:{roleId:a},payload:Eg,success:jr,error:an.members}).middleware(S).pipe(f([A.roleManage]),m,g),u.delete(`customRoleDelete`,`/api/roles/:roleId`,{params:{roleId:a},success:p.NoContent,error:an.members}).pipe(f([A.roleManage]),m,g)){};var Ku=100;var fk=1e3;var hk=wu$1.Struct({invoiceId:a,invoiceVersion:b,sourceLineId:a,quantityMilli:b});var dt=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),reason:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(fk)),lines:wu$1.Array(hk).check(wu$1.isMinLength(1),wu$1.isMaxLength(100))});var Dg=wu$1.Struct({expectedVersion:b,reason:dt.fields.reason,lines:dt.fields.lines});var Fg=wu$1.Struct({requestId:dt.fields.requestId,expectedVersion:b});var Hg=wu$1.Struct(m$1(l({},ei.fields),{invoiceId:a,invoiceVersion:b,invoiceNumber:wu$1.String,sourceLineId:a}));var gk=wu$1.Literals([`draft`,`issued`]);var yk=wu$1.Struct({id:a,version:b,reason:dt.fields.reason,createdAt:w,createdByUserId:a,netTotalCents:B,vatTotalCents:B,totalCents:b,lines:wu$1.Array(Hg).check(wu$1.isMinLength(1),wu$1.isMaxLength(100))}).check(rt);var Ce=wu$1.Struct({id:a,clientId:a,status:gk,version:b,requestId:dt.fields.requestId,issueRequestId:wu$1.NullOr(dt.fields.requestId),number:wu$1.NullOr(wu$1.String.check(wu$1.isPattern(/^AV-\d{4}-\d{6}$/))),reason:dt.fields.reason,currency:wu$1.String.check(wu$1.isPattern(/^[A-Z]{3}$/)),createdAt:w,createdByUserId:a,issuedAt:wu$1.NullOr(w),issuedByUserId:wu$1.NullOr(a),netTotalCents:B,vatTotalCents:B,totalCents:b,lines:wu$1.Array(Hg).check(wu$1.isMinLength(1),wu$1.isMaxLength(100)),revisions:wu$1.Array(yk).check(wu$1.isMinLength(1))}).check(rt,wu$1.makeFilter(t=>t.status===`draft`?t.number===null&&t.issueRequestId===null&&t.issuedAt===null&&t.issuedByUserId===null:t.number!==null&&t.issueRequestId!==null&&t.issuedAt!==null&&t.issuedByUserId!==null),wu$1.makeFilter(t=>{let r=t.revisions.find(o=>o.version===t.version);return r!==void 0&&r.reason===t.reason&&r.netTotalCents===t.netTotalCents&&r.vatTotalCents===t.vatTotalCents&&r.totalCents===t.totalCents}));var Wu=wu$1.Struct({requestId:dt.fields.requestId,amountCents:b,refundedOn:T,reference:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160))});var Ju=wu$1.Struct(m$1(l({},Wu.fields),{id:a,invoiceId:a,recordedAt:w,recordedByUserId:a,cancelledAt:wu$1.NullOr(w),cancellationReason:wu$1.NullOr(wu$1.String),cancelledByUserId:wu$1.NullOr(a)}));var Yu=wu$1.Struct({reason:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500))});var Vu=wu$1.Struct({requestId:dt.fields.requestId,targetInvoiceId:a,amountCents:b,allocatedOn:T,reference:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160))});var xk=wu$1.Struct(m$1(l({},Vu.fields),{id:a,sourceInvoiceId:a,recordedAt:w,recordedByUserId:a,cancelledAt:wu$1.NullOr(w),cancellationReason:wu$1.NullOr(wu$1.String),cancelledByUserId:wu$1.NullOr(a)}));var pn=wu$1.Struct({creditNotes:wu$1.Array(Ce),refunds:wu$1.Array(Ju),allocations:wu$1.Array(xk),refundableCents:B});var Mg=wu$1.Struct({id:Ce.fields.id,clientId:Ce.fields.clientId,clientDisplayName:wu$1.String,status:Ce.fields.status,version:Ce.fields.version,number:Ce.fields.number,reason:Ce.fields.reason,currency:Ce.fields.currency,createdAt:Ce.fields.createdAt,issuedAt:Ce.fields.issuedAt,totalCents:Ce.fields.totalCents,sourceInvoiceIds:wu$1.Array(a).check(wu$1.isMinLength(1)),sourceInvoiceNumbers:wu$1.Array(wu$1.String).check(wu$1.isMinLength(1))});var we=class extends wu$1.TaggedError()(`InvoiceCreditConflict`,{code:wu$1.Literal(`invoice.credit_conflict`)},{httpApiStatus:409}){};var ut=class extends wu$1.TaggedError()(`InvoiceCreditRequestConflict`,{code:wu$1.Literal(`invoice.credit_request_conflict`)},{httpApiStatus:409}){};var dL=wu$1.Union([we,ut,k,v,E,he,Ve]);var Ha=class extends D.make(`creditNotes`,{topLevel:!0}).add(u.get(`invoiceCreditsGet`,`/api/invoices/:invoiceId/credits`,{params:{invoiceId:a},success:pn,error:[we]}).pipe(f([A.invoiceRead]),m,g),u.get(`creditNoteGet`,`/api/credit-notes/:creditNoteId`,{params:{creditNoteId:a},success:Ce,error:[we]}).pipe(f([A.invoiceRead]),m,g),u.post(`creditNoteCreate`,`/api/credit-notes`,{payload:dt,success:Ce,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceCredit]),m,g),u.put(`creditNoteUpdate`,`/api/credit-notes/:creditNoteId`,{params:{creditNoteId:a},payload:Dg,success:Ce,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceCredit]),m,g),u.post(`creditNoteIssue`,`/api/credit-notes/:creditNoteId/issue`,{params:{creditNoteId:a},payload:Fg,success:Ce,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceCredit]),m,g),u.post(`invoiceRefundRecord`,`/api/invoices/:invoiceId/refunds`,{params:{invoiceId:a},payload:Wu,success:pn,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceRefund]),m,g),u.post(`invoiceCreditAllocate`,`/api/invoices/:invoiceId/credit-allocations`,{params:{invoiceId:a},payload:Vu,success:pn,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceRefund]),m,g),u.post(`invoiceRefundCancel`,`/api/invoices/:invoiceId/refunds/:refundId/cancel`,{params:{invoiceId:a,refundId:a},payload:Yu,success:pn,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceRefund]),m,g),u.post(`invoiceCreditAllocationCancel`,`/api/invoices/:invoiceId/credit-allocations/:allocationId/cancel`,{params:{invoiceId:a,allocationId:a},payload:Yu,success:pn,error:[we,ut]}).middleware(S).middleware(H).pipe(f([A.invoiceRefund]),m,g),u.get(`invoiceCreditPdf`,`/api/credit-notes/:creditNoteId/pdf`,{params:{creditNoteId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[we]}).pipe(f([A.documentDownload,A.invoiceRead]),m,g),u.get(`clientCreditPdf`,`/api/client/credit-notes/:creditNoteId/pdf`,{params:{creditNoteId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[we,k,v]}).pipe(g)){};var Ma=wu$1.Literals([`debit`,`fee`]);var qg=wu$1.String.check(wu$1.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,31}$/));var Yi=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),sourceKind:Ma,sourceId:a,bookedOn:T,debitAccount:qg,creditAccount:qg,label:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160))}).check(wu$1.makeFilter(t=>t.debitAccount!==t.creditAccount,{message:`ledger.accounts_identical`}));var Vi=wu$1.Struct(m$1(l({},Yi.fields),{id:a,amountCents:b,bookedOn:T,recordedAt:w,recordedByUserId:a,reversesId:wu$1.NullOr(a),reversalId:wu$1.NullOr(a)}));var Ug=wu$1.Struct({sourceId:a,sourceKind:Ma,reference:wu$1.String,account:wu$1.String,bookedOn:T,postingDate:T,amountCents:b,entryId:wu$1.NullOr(a)});var Sk=wu$1.Struct(m$1(l({},Vi.fields),{sourceReference:wu$1.String}));var Qg=wu$1.Struct({entries:wu$1.Array(Sk),sources:wu$1.Array(Ug)});var Ng=wu$1.Struct({source:Ug,transactionId:a});var Og=wu$1.Struct({requestId:Yi.fields.requestId,reason:Yi.fields.label,bookedOn:T});var Zu=wu$1.Struct({from:T,to:T}).check(wu$1.makeFilter(t=>t.from<=t.to,{message:`ledger.invalid_period`}));var Gt=class extends wu$1.TaggedError()(`LedgerConflict`,{code:wu$1.Literal(`ledger.conflict`)},{httpApiStatus:409}){};var qa=class extends D.make(`bankLedger`,{topLevel:!0}).add(u.get(`bankLedgerList`,`/api/banking/ledger`,{query:Zu,success:Qg,error:[Gt]}).pipe(f([A.ledgerRead]),m,g),u.get(`bankLedgerExport`,`/api/banking/ledger/export`,{query:Zu,success:wu$1.String.pipe(p.asText({contentType:`text/csv`})),error:[Gt]}).pipe(f([A.ledgerRead]),m,g),u.get(`bankLedgerEntryGet`,`/api/banking/ledger/entries/:entryId`,{params:{entryId:a},success:Vi,error:[Gt]}).pipe(f([A.ledgerRead]),m,g),u.get(`bankLedgerSourceGet`,`/api/banking/ledger/sources/:sourceKind/:sourceId`,{params:{sourceKind:Ma,sourceId:a},success:Ng,error:[Gt]}).pipe(f([A.ledgerRead]),m,g),u.post(`bankLedgerPost`,`/api/banking/ledger`,{payload:Yi,success:Vi,error:[Gt]}).middleware(S).middleware(H).pipe(f([A.ledgerPost,A.ledgerRead]),m,g),u.post(`bankLedgerReverse`,`/api/banking/ledger/:entryId/reverse`,{params:{entryId:a},payload:Og,success:Vi,error:[Gt]}).middleware(S).middleware(H).pipe(f([A.ledgerPost,A.ledgerRead]),m,g)){};var dn=class extends D.make(`affairs`,{topLevel:!0}).add(u.get(`affairList`,`/api/affairs`,{success:$h}).pipe(f([A.affairRead]),m,g),u.get(`affairGet`,`/api/affairs/:affairId`,{params:{affairId:a},success:Ui,error:[Ct]}).pipe(f([A.affairRead]),m,g),u.post(`affairCreate`,`/api/affairs`,{payload:qi,success:Ui,error:[kt]}).middleware(S).middleware(H).pipe(f([A.affairCreate]),m,g),u.put(`affairUpdate`,`/api/affairs/:affairId`,{params:{affairId:a},payload:Xh,success:Ui,error:[Ct,kt]}).middleware(S).middleware(H).pipe(f([A.affairUpdate]),m,g),u.get(`affairEventList`,`/api/affairs/:affairId/events`,{params:{affairId:a},success:wu$1.Array(_e),error:[k.pipe(p.status(401)),v.pipe(p.status(403))]}).pipe(f([A.affairRead,A.auditRead]),m,g)){};var Ik=wu$1.Struct({id:a,startedAt:w,renewedAt:w,expiresAt:w,current:wu$1.Boolean});var _u=wu$1.Array(Ik);var un=class extends wu$1.TaggedError()(`AccountSessionNotFound`,{code:wu$1.Literal(`account.session_not_found`)},{httpApiStatus:404}){};var ln=class extends wu$1.TaggedError()(`AccountSessionCurrent`,{code:wu$1.Literal(`account.session_current`)},{httpApiStatus:409}){};var Ck=wu$1.Union([un,ln,k,E,he]);var An=class extends D.make(`authentication`,{topLevel:!0}).add(u.get(`accountSessionList`,`/api/auth/sessions`,{success:_u,error:k}).middleware(Ie).pipe(g),u.post(`accountSessionRevoke`,`/api/auth/sessions/:sessionId/revoke`,{params:{sessionId:a},success:p.NoContent,error:[k,un,ln,E]}).middleware(H).middleware(Ie).pipe(g),u.post(`passwordChange`,`/api/auth/password`,{payload:Yc,success:p.NoContent,error:[mo,k,E]}).middleware(S).middleware(H).middleware(Ie).pipe(g),u.post(`login`,`/api/auth/login`,{payload:Jc,success:Vt,error:[fo.pipe(p.status(401)),go.pipe(p.status(429))]}).middleware(S).middleware(H).pipe(g),u.post(`refresh`,`/api/auth/refresh`,{success:Vt,error:[ho.pipe(p.status(401)),E.pipe(p.status(429))]}).middleware(H).pipe(g),u.get(`currentAccount`,`/api/auth/account`,{success:Vc,error:k.pipe(p.status(401))}).middleware(Ie).pipe(g),u.put(`updatePreferences`,`/api/auth/preferences`,{payload:$n,success:$n,error:[k,E]}).middleware(S).middleware(H).middleware(Ie).pipe(g),u.post(`logout`,`/api/auth/logout`,{success:p.NoContent,error:ho.pipe(p.status(401))}).middleware(H).pipe(g)){};var bt=wu$1.String.check(wu$1.isPattern(/^[A-Za-z0-9_-]+$/),wu$1.isMaxLength(65536));var ju=bt.check(wu$1.isMaxLength(2048));var Gg=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(80));var kk=wu$1.String.check(wu$1.isMaxLength(32));var Rk=wu$1.Struct({id:ju,type:wu$1.Literal(`public-key`)});var Kg=wu$1.Struct({challenge:bt,rp:wu$1.Struct({id:wu$1.String,name:wu$1.String}),user:wu$1.Struct({id:bt,name:wu$1.String,displayName:wu$1.String}),pubKeyCredParams:wu$1.Array(wu$1.Struct({type:wu$1.Literal(`public-key`),alg:wu$1.Int})),timeout:wu$1.Number,excludeCredentials:wu$1.Array(Rk),attestation:wu$1.Literal(`none`),authenticatorSelection:wu$1.Struct({residentKey:wu$1.Literal(`required`),userVerification:wu$1.Literal(`required`)})});var Wg=wu$1.Struct({challenge:bt,rpId:wu$1.String,timeout:wu$1.Number,userVerification:wu$1.Literal(`required`)});var Jg={id:ju,rawId:ju,type:wu$1.Literal(`public-key`),clientExtensionResults:wu$1.Struct({})};var Yg=wu$1.Struct(m$1(l({},Jg),{response:wu$1.Struct({clientDataJSON:bt,attestationObject:bt,transports:wu$1.optionalKey(wu$1.Array(kk).check(wu$1.isMaxLength(10)))})}));var Vg=wu$1.Struct(m$1(l({},Jg),{response:wu$1.Struct({clientDataJSON:bt,authenticatorData:bt,signature:bt,userHandle:bt})}));var Zg=wu$1.Struct({name:Gg,password:Oe});var _g=wu$1.Struct({password:Oe});var vk=wu$1.Struct({id:a,name:Gg,createdAt:wu$1.Int,lastUsedAt:wu$1.NullOr(wu$1.Int)});var jg=wu$1.Array(vk);var zu=class extends wu$1.TaggedError()(`PasskeyRejected`,{code:wu$1.Literal(`passkey.rejected`)},{httpApiStatus:400}){};var zr=wu$1.Union([zu,k,E]);var Ua=class extends D.make(`passkeys`,{topLevel:!0}).add(u.get(`passkeyList`,`/api/auth/passkeys`,{success:jg,error:zr.members}).middleware(Ie).pipe(g),u.post(`passkeyRegisterOptions`,`/api/auth/passkeys/register/options`,{payload:Zg,success:Kg,error:zr.members}).middleware(S).middleware(H).middleware(Ie).pipe(g),u.post(`passkeyRegisterVerify`,`/api/auth/passkeys/register/verify`,{payload:Yg,success:p.NoContent,error:zr.members}).middleware(S).middleware(H).middleware(Ie).pipe(g),u.post(`passkeyRemove`,`/api/auth/passkeys/:passkeyId/remove`,{params:{passkeyId:a},payload:_g,success:p.NoContent,error:zr.members}).middleware(S).middleware(H).middleware(Ie).pipe(g),u.post(`passkeyLoginOptions`,`/api/auth/passkeys/login/options`,{success:Wg,error:zr.members}).middleware(H).pipe(g),u.post(`passkeyLoginVerify`,`/api/auth/passkeys/login/verify`,{payload:Vg,success:Vt,error:zr.members}).middleware(S).middleware(H).pipe(g)){};var Qa=wu$1.String.check(wu$1.isUUID(4));var zg=wu$1.Struct({recipient:wu$1.String.check(wu$1.isMaxLength(254)),reference:wu$1.String.check(wu$1.isMaxLength(160)),subject:wu$1.String.check(wu$1.isMaxLength(160)),body:tn,bodyFormat:en,reminder:wu$1.Boolean}).check(vt);var Xg=wu$1.Struct(m$1(l({},zg.fields),{expectedVersion:B})).check(vt);var el=wu$1.Struct(m$1(l({},zg.fields),{id:Qa,version:b,updatedAt:w})).check(vt);var $g=wu$1.Array(el);var ey=wu$1.Struct({expectedVersion:b});var Xu=class extends wu$1.TaggedError()(`EmailDraftConflict`,{code:wu$1.Literal(`email_draft.conflict`)},{httpApiStatus:409}){};var $u=class extends wu$1.TaggedError()(`EmailDraftNotFound`,{code:wu$1.Literal(`email_draft.not_found`)},{httpApiStatus:404}){};var Na=wu$1.Union([Xu,$u,k,v,E]);var Oa=class extends D.make(`emailDrafts`,{topLevel:!0}).add(u.get(`emailDraftList`,`/api/email-drafts`,{success:$g,error:Na.members}).pipe(f([A.emailDraftManage]),m,g),u.put(`emailDraftSave`,`/api/email-drafts/:draftId`,{params:{draftId:Qa},payload:Xg,success:el,error:Na.members}).middleware(S).pipe(f([A.emailDraftManage]),m,P(L.sixtyPerMinute),g),u.post(`emailDraftArchive`,`/api/email-drafts/:draftId/archive`,{params:{draftId:Qa},payload:ey,success:p.NoContent,error:Na.members}).middleware(S).pipe(f([A.emailDraftManage]),m,P(L.sixtyPerMinute),g)){};var Ga=wu$1.String.check(wu$1.isUUID(4));var ty=wu$1.Struct({subject:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160)),body:tn.check(wu$1.isPattern(/\S/)),bodyFormat:en}).check(vt);var ry=wu$1.Struct(m$1(l({},ty.fields),{expectedVersion:B})).check(vt);var ol=wu$1.Struct(m$1(l({},ty.fields),{id:Ga,version:b,updatedAt:w})).check(vt);var oy=wu$1.Array(ol);var ny=wu$1.Struct({expectedVersion:b});var tl=class extends wu$1.TaggedError()(`EmailTemplateConflict`,{code:wu$1.Literal(`email_template.conflict`)},{httpApiStatus:409}){};var rl=class extends wu$1.TaggedError()(`EmailTemplateNotFound`,{code:wu$1.Literal(`email_template.not_found`)},{httpApiStatus:404}){};var Ka=wu$1.Union([tl,rl,k,v,E]);var Wa=class extends D.make(`emailTemplates`,{topLevel:!0}).add(u.get(`emailTemplateList`,`/api/email-templates`,{success:oy,error:Ka.members}).pipe(f([A.emailTemplateManage]),m,g),u.put(`emailTemplateSave`,`/api/email-templates/:templateId`,{params:{templateId:Ga},payload:ry,success:ol,error:Ka.members}).middleware(S).pipe(f([A.emailTemplateManage]),m,P(L.sixtyPerMinute),g),u.post(`emailTemplateArchive`,`/api/email-templates/:templateId/archive`,{params:{templateId:Ga},payload:ny,success:p.NoContent,error:Ka.members}).middleware(S).pipe(f([A.emailTemplateManage]),m,P(L.sixtyPerMinute),g)){};var Zi=wu$1.String.check(wu$1.isUUID(4));var bk=wu$1.Struct({invoiceId:a,sendAt:w,language:wu$1.Literals([`fr`,`en`]),expectedMode:wu$1.Literals([`simulation`,`live`])});var Ja=wu$1.Struct(m$1(l({},bk.fields),{expectedVersion:b}));var Ek=wu$1.Literals([`invoice-ineligible`,`invoice-changed`,`recipient-invalid`,`mode-changed`,`date-invalid`,`already-scheduled`,`limit`]);var nl=class extends wu$1.TaggedError()(`ReminderRejected`,{code:wu$1.Literal(`reminder.rejected`),requestId:Zi,request:Ja,reason:Ek},{httpApiStatus:409}){};var aD=(t,r,o)=>t.requestId===r&&t.request.invoiceId===o.invoiceId&&t.request.expectedVersion===o.expectedVersion&&t.request.sendAt===o.sendAt&&t.request.expectedMode===o.expectedMode&&t.request.language===o.language;var Ya=wu$1.Struct(m$1(l({invoiceReference:wu$1.NonEmptyString},Ja.fields),{id:Zi,createdByUserId:a,createdAt:w,status:wu$1.Literals([`scheduled`,`cancelled`,`skipped`,`queued`]),reason:wu$1.NullOr(wu$1.Literals([`invoice-ineligible`,`recipient-invalid`,`permission-revoked`,`mode-changed`])),operationId:wu$1.NullOr(a)}));var iy=wu$1.Array(Ya);var il=class extends wu$1.TaggedError()(`ReminderConflict`,{code:wu$1.Literal(`reminder.conflict`)},{httpApiStatus:409}){};var sl=class extends wu$1.TaggedError()(`ReminderNotFound`,{code:wu$1.Literal(`reminder.not_found`)},{httpApiStatus:404}){};var Va=wu$1.Union([il,nl,sl,k,v,E]);var al=[A.emailReminderManage,A.invoiceRead,A.clientRead,A.integrationManage];var Za=class extends D.make(`reminders`,{topLevel:!0}).add(u.get(`reminderList`,`/api/reminders`,{success:iy,error:Va.members}).pipe(f(al),m,g),u.put(`reminderCreate`,`/api/reminders/:reminderId`,{params:{reminderId:Zi},payload:Ja,success:Ya,error:Va.members}).middleware(S).middleware(H).pipe(f(al),m,P(L.sixtyPerMinute),g),u.post(`reminderCancel`,`/api/reminders/:reminderId/cancel`,{params:{reminderId:Zi},payload:wu$1.Struct({}),success:Ya,error:Va.members}).middleware(S).middleware(H).pipe(f(al),m,P(L.sixtyPerMinute),g)){};var _a=class extends wu$1.TaggedError()(`ProviderNotFound`,{code:wu$1.Literal(`provider.not_found`)},{httpApiStatus:404}){};var ja=class extends wu$1.TaggedError()(`ProviderRejected`,{code:wu$1.Literal(`provider.rejected`),reason:wu$1.Literals([`invalid-state`,`insufficient-funds`,`unsupported-operation`,`permission-denied`,`expired-consent`])},{httpApiStatus:409}){};var za=class extends wu$1.TaggedError()(`ProviderRateLimited`,{code:wu$1.Literal(`provider.rate_limited`),retryAfterSeconds:b},{httpApiStatus:429}){};var ED=wu$1.Union([rn,on,_a,ja,za]);var py=wu$1.Union([...We.members,_a,ja,za]);var ml=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(1e3));var j=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(200));var ll=wu$1.String.check(wu$1.isUUID(4));var _i={requestId:ll};var De=wu$1.Struct(m$1(l({},_i),{providerId:j}));var ji=wu$1.Struct(m$1(l({},De.fields),{reason:ml}));var dy=wu$1.Struct(m$1(l({},_i),{cursor:wu$1.NullOr(j),limit:B.check(wu$1.isBetween({minimum:1,maximum:100}))}));var fl=wu$1.Struct(m$1(l({},dy.fields),{providerId:j}));var wk=wu$1.Struct(m$1(l({},_i),{bodyBase64:wu$1.String.check(wu$1.isMaxLength(1e5)),signature:wu$1.String.check(wu$1.isMaxLength(4e3)),receivedAt:w}));var uy=wu$1.Struct({id:j,providerId:j,occurredAt:w,kind:nn,status:wu$1.Literals([`draft`,`queued`,`submitted`,`delivered`,`bounced`,`complained`,`cancelled`,`failed`,`pending`,`signed`,`declined`,`expired`,`requires-action`,`authorized`,`captured`,`succeeded`,`pending-consent`,`active`,`revoked`,`accepted`,`rejected`,`received`,`approved`,`disputed`,`paid`,`booked`,`reversed`])});var Xa=t=>wu$1.Struct({items:wu$1.Array(t),nextCursor:wu$1.NullOr(j)});var Tk=t=>wu$1.Union([wu$1.Struct({mode:wu$1.Literal(`simulation`),executed:wu$1.Literal(!1),requestId:ll,preview:t}),wu$1.Struct({mode:wu$1.Literal(`live`),executed:wu$1.Literal(!0),requestId:ll,result:t})]);var _=(t,r)=>({request:t,response:Tk(r)});var sy=wu$1.Struct({providerId:j,status:wu$1.Literals([`queued`,`submitted`,`delivered`,`bounced`,`complained`,`cancelled`,`failed`]),recipient:se,updatedAt:w,failureCode:wu$1.NullOr(j)});var cl=wu$1.Struct({providerId:j,artifactId:a,status:wu$1.Literals([`draft`,`pending`,`signed`,`declined`,`expired`,`cancelled`,`failed`]),signers:wu$1.Array(wu$1.Struct({email:se,status:wu$1.Literals([`pending`,`signed`,`declined`]),signedAt:wu$1.NullOr(w)})),updatedAt:w});var Al=wu$1.Union([wu$1.Struct({available:wu$1.Literal(!1)}),wu$1.Struct({available:wu$1.Literal(!0),filename:j,mediaType:wu$1.Literals([`application/pdf`,`application/json`,`application/xml`,`application/zip`]),contentBase64:wu$1.String,sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/))})]);var pl=wu$1.Struct({providerId:j,status:wu$1.Literals([`pending`,`requires-action`,`authorized`,`captured`,`cancelled`,`failed`]),amountCents:b,capturedCents:B,refundedCents:B,currency:U,checkoutUrl:wu$1.NullOr(wu$1.String),updatedAt:w});var ay=wu$1.Struct({providerId:j,paymentId:j,amountCents:b,currency:U,status:wu$1.Literals([`pending`,`succeeded`,`failed`,`cancelled`]),updatedAt:w});var Bk=wu$1.Struct(m$1(l({},De.fields),{amountCents:b,reason:ml}));var dl=wu$1.Struct({providerId:j,status:wu$1.Literals([`pending-consent`,`active`,`expired`,`revoked`,`failed`]),consentUrl:wu$1.NullOr(wu$1.String),expiresAt:wu$1.NullOr(w)});var Lk=wu$1.Struct({providerId:j,name:j,iban:wu$1.NullOr(j),currency:U});var Pk=wu$1.Struct({providerId:j,accountId:j,bookedOn:T,amountCents:wu$1.Int.check(wu$1.isBetween({minimum:-Number.MAX_SAFE_INTEGER,maximum:Number.MAX_SAFE_INTEGER})),currency:U,description:ml,status:wu$1.Literals([`pending`,`booked`,`reversed`])});var Dk=wu$1.Struct(m$1(l({},fl.fields),{from:T,to:T})).check(wu$1.makeFilter(t=>t.from<=t.to,{message:`provider.invalid_date_range`}));var ul=wu$1.Struct({providerId:j,artifactId:a,status:wu$1.Literals([`submitted`,`accepted`,`rejected`,`delivered`,`received`,`approved`,`disputed`,`paid`,`cancelled`,`failed`]),direction:wu$1.Literals([`incoming`,`outgoing`]),updatedAt:w,rejectionCode:wu$1.NullOr(j)});var cy=wu$1.Struct({providerId:j,from:T,to:T,status:wu$1.Literals([`submitted`,`accepted`,`rejected`,`failed`]),rejectionCode:wu$1.NullOr(j)});var Fk=wu$1.Struct(m$1(l({},_i),{from:T,to:T,entries:wu$1.Array(wu$1.Struct({invoiceId:a,amountCents:b,currency:U,paidOn:wu$1.NullOr(T)})).check(wu$1.isMinLength(1),wu$1.isMaxLength(1e3))})).check(wu$1.makeFilter(t=>t.from<=t.to,{message:`provider.invalid_date_range`}));var $a=_(fl,Xa(uy));var zi=_(wk,wu$1.Struct({verified:wu$1.Boolean,events:wu$1.Array(uy)}));var Xi={get:_(De,sy),cancel:_(ji,sy),events:$a,verifyWebhook:zi};var dr={get:_(De,cl),cancel:_(ji,cl),remind:_(De,cl),signedDocument:_(De,Al),proof:_(De,Al),events:$a,verifyWebhook:zi};var ur={get:_(De,pl),cancel:_(ji,pl),capture:_(wu$1.Struct(m$1(l({},De.fields),{amountCents:b})),pl),refund:_(Bk,ay),getRefund:_(De,ay),events:$a,verifyWebhook:zi};var Xr={connect:_(wu$1.Struct(m$1(l({},_i),{returnUrl:wu$1.String,accountReference:j})),dl),getConnection:_(De,dl),revokeConnection:_(ji,dl),accounts:_(fl,Xa(Lk)),transactions:_(Dk,Xa(Pk)),verifyWebhook:zi};var Kt={get:_(De,ul),cancel:_(ji,ul),download:_(De,Al),inbox:_(dy,Xa(ul)),report:_(Fk,cy),getReport:_(De,cy),events:$a,verifyWebhook:zi};var W=(t,r,o)=>u.post(t,r,{payload:o.request,success:o.response,error:py.members}).middleware(S).middleware(H).pipe(f([A.integrationManage]),m,P(L.sixtyPerMinute),g);var ec=class extends D.make(`providerActions`,{topLevel:!0}).add(W(`providerEmailGet`,`/api/providers/email/get`,Xi.get),W(`providerEmailCancel`,`/api/providers/email/cancel`,Xi.cancel),W(`providerEmailEvents`,`/api/providers/email/events`,Xi.events),W(`providerEmailVerifyWebhook`,`/api/providers/email/verify-webhook`,Xi.verifyWebhook),W(`providerSignatureGet`,`/api/providers/signature/get`,dr.get),W(`providerSignatureCancel`,`/api/providers/signature/cancel`,dr.cancel),W(`providerSignatureRemind`,`/api/providers/signature/remind`,dr.remind),W(`providerSignatureDocument`,`/api/providers/signature/document`,dr.signedDocument),W(`providerSignatureProof`,`/api/providers/signature/proof`,dr.proof),W(`providerSignatureEvents`,`/api/providers/signature/events`,dr.events),W(`providerSignatureVerifyWebhook`,`/api/providers/signature/verify-webhook`,dr.verifyWebhook),W(`providerPaymentGet`,`/api/providers/payment/get`,ur.get),W(`providerPaymentCancel`,`/api/providers/payment/cancel`,ur.cancel),W(`providerPaymentCapture`,`/api/providers/payment/capture`,ur.capture),W(`providerPaymentRefund`,`/api/providers/payment/refund`,ur.refund),W(`providerPaymentGetRefund`,`/api/providers/payment/get-refund`,ur.getRefund),W(`providerPaymentEvents`,`/api/providers/payment/events`,ur.events),W(`providerPaymentVerifyWebhook`,`/api/providers/payment/verify-webhook`,ur.verifyWebhook),W(`providerBankConnect`,`/api/providers/banking/connect`,Xr.connect),W(`providerBankConnection`,`/api/providers/banking/connection`,Xr.getConnection),W(`providerBankRevoke`,`/api/providers/banking/revoke`,Xr.revokeConnection),W(`providerBankAccounts`,`/api/providers/banking/accounts`,Xr.accounts),W(`providerBankTransactions`,`/api/providers/banking/transactions`,Xr.transactions),W(`providerBankVerifyWebhook`,`/api/providers/banking/verify-webhook`,Xr.verifyWebhook),W(`providerElectronicInvoiceGet`,`/api/providers/electronic-invoice/get`,Kt.get),W(`providerElectronicInvoiceCancel`,`/api/providers/electronic-invoice/cancel`,Kt.cancel),W(`providerElectronicInvoiceDownload`,`/api/providers/electronic-invoice/download`,Kt.download),W(`providerElectronicInvoiceInbox`,`/api/providers/electronic-invoice/inbox`,Kt.inbox),W(`providerElectronicInvoiceReport`,`/api/providers/electronic-invoice/report`,Kt.report),W(`providerElectronicInvoiceGetReport`,`/api/providers/electronic-invoice/get-report`,Kt.getReport),W(`providerElectronicInvoiceEvents`,`/api/providers/electronic-invoice/events`,Kt.events),W(`providerElectronicInvoiceVerifyWebhook`,`/api/providers/electronic-invoice/verify-webhook`,Kt.verifyWebhook)){};var mn=class extends D.make(`bootstrap`,{topLevel:!0}).add(u.get(`bootstrapStatus`,`/api/bootstrap`,{success:tu}).pipe(g),u.post(`bootstrapCreate`,`/api/bootstrap`,{payload:ru,success:ou,error:[Yo.pipe(p.status(401)),Vo.pipe(p.status(409)),Zo.pipe(p.status(429))]}).middleware(S).middleware(H).pipe(g)){};var fn=wu$1.Number.check(wu$1.isInt(),wu$1.isGreaterThanOrEqualTo(0),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var hl=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120));var ly=wu$1.Struct({id:a,reference:ge,status:wu$1.Literals([`sent`,`accepted`,`rejected`,`expired`]),title:hl,currency:U,totalCents:fn,updatedAt:w,pdfAvailable:wu$1.Boolean});var gl=wu$1.Array(ly);var Ay=wu$1.Struct({id:a,reference:Le,quoteId:a,quoteReference:ge,status:wu$1.Literal(`confirmed`),title:hl,currency:U,totalCents:fn,createdAt:w,invoiceId:wu$1.NullOr(a),pdfAvailable:wu$1.Boolean});var yl=wu$1.Array(Ay);var my=wu$1.Struct({creditedCents:fn,recordedPaidCents:fn,remainingCents:fn,id:a,orderId:a,orderReference:Le,status:wu$1.Literals([`issued`,`paid`,`void`]),invoiceNumber:Xt,title:hl,dueDate:T,currency:U,totalCents:fn,updatedAt:w,pdfAvailable:wu$1.Boolean,creditNotes:wu$1.Array(wu$1.Struct({id:a,number:wu$1.String.check(wu$1.isPattern(/^AV-\d{4}-\d{6}$/))}))});var xl=wu$1.Array(my);var hn=[k.pipe(p.status(401)),v.pipe(p.status(403))];var gn=class extends D.make(`clientPortal`,{topLevel:!0}).add(u.get(`clientQuoteList`,`/api/client/quotes`,{success:gl,error:hn}).pipe(g),u.get(`clientOrderList`,`/api/client/orders`,{success:yl,error:hn}).pipe(g),u.get(`clientInvoiceList`,`/api/client/invoices`,{success:xl,error:hn}).pipe(g),u.get(`clientQuotePdf`,`/api/client/quotes/:quoteId/pdf`,{params:{quoteId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[...hn,pe.pipe(p.status(404))]}).pipe(g),u.get(`clientInvoicePdf`,`/api/client/invoices/:invoiceId/pdf`,{params:{invoiceId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[...hn,pe.pipe(p.status(404))]}).pipe(g),u.get(`clientOrderPdf`,`/api/client/orders/:orderId/pdf`,{params:{orderId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[...hn,pe.pipe(p.status(404))]}).pipe(g)){};var yn=class extends D.make(`clients`,{topLevel:!0}).add(u.get(`clientList`,`/api/clients`,{success:qd,error:[k.pipe(p.status(401)),v.pipe(p.status(403))]}).pipe(f([A.clientRead]),m),u.get(`clientGet`,`/api/clients/:clientId`,{params:{clientId:a},success:ar,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),ue.pipe(p.status(404))]}).pipe(f([A.clientRead]),m),u.post(`clientCreate`,`/api/clients`,{payload:Qd,success:ar,error:[Oo,k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429))]}).middleware(S).pipe(f([A.clientCreate]),m,P(L.sixtyPerMinute)),u.put(`clientUpdate`,`/api/clients/:clientId`,{params:{clientId:a},payload:Nd,success:ar,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ue.pipe(p.status(404)),ze.pipe(p.status(409)),Qo.pipe(p.status(409))]}).middleware(S).pipe(f([A.clientUpdate]),m,P(L.sixtyPerMinute)),u.post(`clientArchive`,`/api/clients/:clientId/archive`,{params:{clientId:a},success:ar,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ue.pipe(p.status(404))]}).pipe(f([A.clientArchive]),m,P(L.sixtyPerMinute)),u.post(`clientReactivate`,`/api/clients/:clientId/reactivate`,{params:{clientId:a},success:ar,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ue.pipe(p.status(404))]}).pipe(f([A.clientArchive]),m,P(L.sixtyPerMinute)),u.get(`clientAccessList`,`/api/clients/:clientId/access`,{params:{clientId:a},success:Od,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),ue.pipe(p.status(404))]}).pipe(f([A.clientAccessManage]),m,g),u.post(`clientAccessCreate`,`/api/clients/:clientId/access`,{params:{clientId:a},payload:Gd,success:ia,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ue.pipe(p.status(404)),ze.pipe(p.status(409)),No.pipe(p.status(409))]}).middleware(S).pipe(f([A.clientAccessManage]),m,P(L.tenPerMinute),g),u.delete(`clientAccessRevoke`,`/api/clients/:clientId/access/:accessId`,{params:{clientId:a,accessId:a},success:p.NoContent,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ue.pipe(p.status(404)),Go.pipe(p.status(404))]}).pipe(f([A.clientAccessManage]),m,P(L.tenPerMinute),g)){};var Sl=[k.pipe(p.status(401)),v.pipe(p.status(403))];var $i=[...Sl,E.pipe(p.status(429))];var tc=class extends D.make(`company`,{topLevel:!0}).add(u.get(`brandingGet`,`/api/branding`,{success:Rs}).pipe(g),u.put(`brandingUpdate`,`/api/branding`,{payload:lp,success:Rs,error:[...$i,si.pipe(p.status(409))]}).middleware(S).pipe(f([A.companyUpdate]),m,g),u.get(`companySettingsGet`,`/api/company`,{success:ti,error:Sl}).pipe(f([A.companyRead]),m,g),u.put(`companySettingsUpdate`,`/api/company`,{payload:jc,success:ti,error:[...$i,vr.pipe(p.status(409)),yo.pipe(p.status(409))]}).middleware(S).pipe(f([A.companyUpdate]),m,g),u.post(`companyAccountingInitialize`,`/api/company/accounting/initialize`,{payload:zc,success:ti,error:[...$i,vr.pipe(p.status(409)),xo.pipe(p.status(409))]}).middleware(S).pipe(f([A.companyUpdate]),m,g),u.get(`companyExchangeRateList`,`/api/company/exchange-rates`,{success:Cs,error:Sl}).pipe(f([A.companyRead]),m,g),u.put(`companyExchangeRateSet`,`/api/company/exchange-rates`,{payload:_c,success:Is,error:[...$i,So.pipe(p.status(409))]}).middleware(S).pipe(f([A.companyUpdate]),m,g),u.post(`companyExchangeRateImport`,`/api/company/exchange-rates/ecb`,{success:Cs,error:[...$i,Io.pipe(p.status(502))]}).pipe(f([A.companyUpdate]),m,g)){};var xn=[k.pipe(p.status(401)),v.pipe(p.status(403))];var rc=class extends D.make(`suppliers`,{topLevel:!0}).add(u.get(`supplierList`,`/api/suppliers`,{success:Kd,error:xn}).pipe(f([A.supplierRead]),m),u.get(`supplierGet`,`/api/suppliers/:supplierId`,{params:{supplierId:a},success:cr,error:[...xn,Ot.pipe(p.status(404))]}).pipe(f([A.supplierRead]),m),u.post(`supplierCreate`,`/api/suppliers`,{payload:Wd,success:cr,error:[...xn,Jo.pipe(p.status(409)),Yr.pipe(p.status(422)),E.pipe(p.status(429))]}).middleware(S).pipe(f([A.supplierCreate]),m,P(L.sixtyPerMinute)),u.put(`supplierUpdate`,`/api/suppliers/:supplierId`,{params:{supplierId:a},payload:Jd,success:cr,error:[...xn,Ot.pipe(p.status(404)),Ko.pipe(p.status(409)),Wo.pipe(p.status(409)),Yr.pipe(p.status(422)),E.pipe(p.status(429))]}).middleware(S).pipe(f([A.supplierUpdate]),m,P(L.sixtyPerMinute)),u.post(`supplierArchive`,`/api/suppliers/:supplierId/archive`,{params:{supplierId:a},success:cr,error:[...xn,Ot.pipe(p.status(404)),E.pipe(p.status(429))]}).pipe(f([A.supplierArchive]),m,P(L.sixtyPerMinute)),u.post(`supplierReactivate`,`/api/suppliers/:supplierId/reactivate`,{params:{supplierId:a},success:cr,error:[...xn,Ot.pipe(p.status(404)),E.pipe(p.status(429))]}).pipe(f([A.supplierArchive]),m,P(L.sixtyPerMinute))){};var oc=class extends D.make(`supplierInvoices`,{topLevel:!0}).add(u.get(`supplierInvoiceList`,`/api/supplier-invoices`,{success:Gh,error:ae.members}).pipe(f([A.supplierInvoiceRead]),m,g),u.get(`supplierInvoiceGet`,`/api/supplier-invoices/:invoiceId`,{params:{invoiceId:a},success:It,error:ae.members}).pipe(f([A.supplierInvoiceRead]),m,g),u.get(`supplierInvoiceEvidenceList`,`/api/supplier-invoices/:invoiceId/evidence`,{params:{invoiceId:a},success:_h,error:ae.members}).pipe(f([A.supplierInvoiceRead]),m,g),u.get(`supplierPaymentBatchList`,`/api/supplier-payment-batches`,{success:Wh,error:ae.members}).pipe(f([A.supplierInvoicePay]),m,g),u.post(`supplierPaymentBatchCreate`,`/api/supplier-payment-batches`,{payload:Kh,success:$d,error:ae.members}).middleware(S).pipe(f([A.supplierInvoicePay]),m,g),u.get(`supplierPaymentBatchDownload`,`/api/supplier-payment-batches/:batchId/download`,{params:{batchId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/xml; charset=utf-8`})),error:ae.members}).pipe(f([A.supplierInvoicePay]),m,g),u.post(`supplierInvoiceCreate`,`/api/supplier-invoices`,{payload:Xd,success:It,error:ae.members}).middleware(S).pipe(f([A.supplierInvoiceCreate]),m,g),u.post(`supplierCreditCreate`,`/api/supplier-credits`,{payload:Nh,success:It,error:ae.members}).middleware(S).pipe(f([A.supplierInvoiceCreate]),m,g),u.post(`supplierInvoiceEvidenceCreate`,`/api/supplier-invoice-evidence`,{payload:jh,success:Hi,error:ae.members}).annotate(Jr,`supplier-invoice-evidence`).middleware(S).pipe(f([A.supplierInvoiceUpdate]),m,g),u.get(`supplierInvoiceEvidenceDownload`,`/api/supplier-invoice-evidence/:evidenceId/download`,{params:{evidenceId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/octet-stream`})),error:ae.members}).pipe(f([A.supplierInvoiceRead]),m,g),u.put(`supplierInvoiceUpdate`,`/api/supplier-invoices/:invoiceId`,{params:{invoiceId:a},payload:Oh,success:It,error:ae.members}).middleware(S).pipe(f([A.supplierInvoiceUpdate]),m,g),u.post(`supplierInvoiceConfirm`,`/api/supplier-invoices/:invoiceId/confirm`,{params:{invoiceId:a},payload:pa,success:It,error:ae.members}).middleware(S).pipe(f([A.supplierInvoiceUpdate]),m,g),u.post(`supplierInvoiceApprove`,`/api/supplier-invoices/:invoiceId/approve`,{params:{invoiceId:a},payload:pa,success:It,error:ae.members}).middleware(S).pipe(f([A.supplierInvoiceApprove]),m,g),u.post(`supplierInvoiceCancel`,`/api/supplier-invoices/:invoiceId/cancel`,{params:{invoiceId:a},payload:pa,success:It,error:ae.members}).middleware(S).pipe(f([A.supplierInvoiceUpdate]),m,g),u.get(`supplierInvoiceAnalysisSettings`,`/api/supplier-invoice-analysis/settings`,{success:eu,error:ae.members}).pipe(f([A.integrationConfigure]),m,g),u.get(`supplierInvoiceAnalysisStatus`,`/api/supplier-invoice-analysis/status`,{success:Yh,error:ae.members}).pipe(f([A.supplierInvoiceAnalyze]),m,g),u.put(`supplierInvoiceAnalysisSettingsUpdate`,`/api/supplier-invoice-analysis/settings`,{payload:Vh,success:eu,error:ae.members}).middleware(S).pipe(f([A.integrationConfigure]),m,g),u.post(`supplierInvoiceAnalyze`,`/api/supplier-invoices/analyze`,{payload:Zh,success:It,error:ae.members}).annotate(Jr,`supplier-invoice-analysis`).middleware(S).pipe(f([A.supplierInvoiceAnalyze]),m,g)){};var Sn=class extends D.make(`apiTokens`,{topLevel:!0}).add(u.get(`apiTokenList`,`/api/tokens`,{query:Up,success:qp,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),Eo.pipe(p.status(400))]}).pipe(f([A.apiTokenManage]),m,g),u.post(`apiTokenCreate`,`/api/tokens`,{payload:Qp,success:Fs,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),vo.pipe(p.status(409)),bo.pipe(p.status(422))]}).middleware(S).pipe(f([A.apiTokenManage]),m,P(L.tenPerMinute),g),u.post(`apiTokenRevoke`,`/api/tokens/:tokenId/revoke`,{params:{tokenId:a},success:Fs.fields.token,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),Ro.pipe(p.status(404))]}).pipe(f([A.apiTokenManage]),m,P(L.tenPerMinute),g)){};var nc=wu$1.Struct({requestId:wu$1.String.check(wu$1.isUUID(4)),expectedVersion:b,amountCents:b,paidOn:T,method:wu$1.Literals([`transfer`,`card`,`cash`,`cheque`,`other`]),reference:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(160))});var es=wu$1.Struct(m$1(l({},nc.fields),{id:a,recordedAt:w,recordedByUserId:a,cancelledAt:wu$1.NullOr(w),cancelledByUserId:wu$1.NullOr(a),cancellationReason:wu$1.NullOr(wu$1.String)}));var Il=wu$1.Struct({expectedVersion:b,reason:wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(500))});var lr=class extends wu$1.TaggedError()(`InvoicePaymentInvalid`,{code:wu$1.Literal(`invoice.payment_invalid`)},{httpApiStatus:409}){};var Cl=wu$1.Struct({from:Ze,to:Ze});var In=class extends wu$1.TaggedError()(`PaymentExportInvalidRange`,{code:wu$1.Literal(`payment.export_invalid_range`)},{httpApiStatus:422}){};var Cn=class extends wu$1.TaggedError()(`PaymentExportTooLarge`,{code:wu$1.Literal(`payment.export_too_large`)},{httpApiStatus:422}){};var Hk=wu$1.Union([k,v,E,In,Cn]);var Et=wu$1.NumberFromString.check(wu$1.isInt(),wu$1.isGreaterThan(0),wu$1.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER));var ic=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120));var sc=wu$1.String.check(wu$1.isMaxLength(2e3));var ac=wu$1.makeFilter(t=>qt(t.paymentTerms,t.paymentTermsPresentation?.format??`plain`)||`document.conditions_format.invalid`);var Mk=wu$1.Array(Rr).check(wu$1.isMinLength(1),wu$1.isMaxLength(20));var cc=wu$1.Literals([`draft`,`issued`,`paid`,`void`]);var fy=wu$1.Literals([`pending`,`processing`,`ready`,`failed`]);var Rl=wu$1.Struct({status:fy,attempts:B,error:wu$1.NullOr(wu$1.Literal(`pdf.render_failed`))});var vl=wu$1.Struct({orderId:a,serviceDate:T,dueDate:T,paymentTerms:sc,paymentTermsPresentation:wu$1.optionalKey(xe)}).check(ac).annotate({identifier:`InvoiceCreateRequest`});var bl=wu$1.Struct({expectedVersion:b,refreshParties:wu$1.Boolean,title:ic,serviceDate:T,dueDate:T,paymentTerms:sc,paymentTermsPresentation:wu$1.optionalKey(xe),lines:Mk}).check(ac).annotate({identifier:`InvoiceRevisionCreateRequest`});var El=wu$1.Struct({expectedVersion:b});var wl=wu$1.Struct({expectedVersion:b});var qk=wu$1.Struct({templateId:wu$1.Literal(`invoice-default`),templateVersion:wu$1.Literal(1),calendar:wu$1.optionalKey(wr),invoiceId:a,orderId:a,quoteReference:ge,orderReference:Le,revisionId:a,version:b,createdAt:w,invoiceNumber:wu$1.NullOr(Xt),issuedAt:wu$1.NullOr(w),serviceDate:T,dueDate:T,issuer:ft,client:$t,title:ic,paymentTerms:sc,paymentTermsPresentation:wu$1.optionalKey(xe),currency:U,netTotalCents:B,vatTotalCents:B,totalCents:B,lines:Zt}).check(rt,ac);var kl=wu$1.Struct({id:a,version:b,clientDisplayName:fe,invoiceNumber:wu$1.NullOr(Xt),issuedAt:wu$1.NullOr(w),title:ic,serviceDate:T,dueDate:T,paymentTerms:sc,paymentTermsPresentation:wu$1.optionalKey(xe),currency:U,netTotalCents:B,vatTotalCents:B,totalCents:B,functionalCurrency:wu$1.NullOr(U),exchangeRateDate:wu$1.NullOr(T),foreignUnitsPerFunctionalUnitNanos:wu$1.NullOr(b),functionalNetTotalCents:wu$1.NullOr(B),functionalVatTotalCents:wu$1.NullOr(B),functionalTotalCents:wu$1.NullOr(B),createdAt:w,createdByUserId:a,lines:Zt}).check(rt,ac).annotate({identifier:`InvoiceRevision`});var Tt=wu$1.Struct({creditedCents:B,recordedPaidCents:B,id:a,orderId:a,orderReference:Le,clientId:a,clientDisplayName:fe,status:cc,version:b,invoiceNumber:wu$1.NullOr(Xt),title:ic,dueDate:T,currency:U,totalCents:B,updatedAt:w,pdf:wu$1.NullOr(Rl)}).annotate({identifier:`InvoiceSummary`});var mr=wu$1.Struct({creditedCents:B,payments:wu$1.Array(es),id:a,orderId:a,orderReference:Le,clientId:a,status:cc,version:b,invoiceNumber:wu$1.NullOr(Xt),issuedAt:wu$1.NullOr(w),paidAt:wu$1.NullOr(w),voidedAt:wu$1.NullOr(w),currentRevision:kl,revisions:wu$1.Array(kl),pdf:wu$1.NullOr(Rl)}).annotate({identifier:`InvoiceDetail`});var Tl=wu$1.Struct({invoiceId:a,revisionId:a,version:b,status:wu$1.Literal(`issued`),invoiceNumber:vs,issuedAt:w});var Bl=wu$1.Struct({id:a,invoiceNumber:Xt,invoiceRevisionId:a,kind:wu$1.Literal(`invoice-pdf`),contentType:wu$1.Literal(`application/pdf`),byteSize:b,sha256:wu$1.String.check(wu$1.isPattern(/^[a-f0-9]{64}$/)),createdAt:w});var Ll=wu$1.Array(Tt);var Fe=class extends wu$1.TaggedError()(`InvoiceNotFound`,{code:wu$1.Literal(`invoice.not_found`)},{httpApiStatus:404}){};var kn=class extends wu$1.TaggedError()(`InvoiceOrderNotFound`,{code:wu$1.Literal(`invoice.order_not_found`)},{httpApiStatus:404}){};var Rn=class extends wu$1.TaggedError()(`InvoiceAlreadyExists`,{code:wu$1.Literal(`invoice.already_exists`),invoiceId:a},{httpApiStatus:409}){};var vn=class extends wu$1.TaggedError()(`InvoiceNotEditable`,{code:wu$1.Literal(`invoice.not_editable`)},{httpApiStatus:409}){};var wt=class extends wu$1.TaggedError()(`InvoiceVersionConflict`,{code:wu$1.Literal(`invoice.version_conflict`),currentVersion:b},{httpApiStatus:409}){};var $r=class extends wu$1.TaggedError()(`InvoiceAmountTooLarge`,{code:wu$1.Literal(`invoice.amount_too_large`)},{httpApiStatus:422}){};var Ar=class extends wu$1.TaggedError()(`InvoiceInvalidDates`,{code:wu$1.Literal(`invoice.invalid_dates`)},{httpApiStatus:422}){};var Wt=class extends wu$1.TaggedError()(`InvoiceInvalidTransition`,{code:wu$1.Literal(`invoice.invalid_transition`),currentStatus:cc},{httpApiStatus:409}){};var bn=class extends wu$1.TaggedError()(`InvoiceExchangeRateMissing`,{code:wu$1.Literal(`invoice.exchange_rate_missing`)},{httpApiStatus:422}){};var eo=class extends wu$1.TaggedError()(`InvoiceAccountingUnavailable`,{code:wu$1.Literal(`invoice.accounting_unavailable`)},{httpApiStatus:422}){};var Uk=wu$1.Union([lr,k,v,E,he,Ve,Fe,kn,Rn,vn,wt,$r,Ar,Wt,bn,eo,pe,ot]);var hy={invoiceId:Tt.fields.id,invoiceNumber:Tt.fields.invoiceNumber,title:Tt.fields.title,clientId:Tt.fields.clientId,clientDisplayName:Tt.fields.clientDisplayName,orderId:Tt.fields.orderId,orderReference:Tt.fields.orderReference};var Pl=wu$1.Array(wu$1.Struct(l(l({},es.fields),hy))).check(wu$1.isMaxLength(1e4));var Dl=wu$1.Array(Mg).check(wu$1.isMaxLength(1e4));var Fl=wu$1.Array(wu$1.Struct(l(l({},Ju.fields),hy))).check(wu$1.isMaxLength(1e4));var Hl=wu$1.Array(_e).check(wu$1.isMaxLength(1e4));var fr=class extends wu$1.TaggedError()(`InvoiceWorkspaceLimitExceeded`,{code:wu$1.Literal(`invoice.workspace_limit`)},{httpApiStatus:413}){};var Jt=[k.pipe(p.status(401)),v.pipe(p.status(403))];var hr=[...Jt,E.pipe(p.status(429))];var Qk=wu$1.Struct(m$1(l({},vl.fields),{serviceDate:Ze,dueDate:Ze})).annotate({identifier:`InvoiceCreateRequest`});var Nk=wu$1.Struct(m$1(l({},bl.fields),{serviceDate:Ze,dueDate:Ze})).annotate({identifier:`InvoiceRevisionCreateRequest`});var En=class extends D.make(`invoices`,{topLevel:!0}).add(u.get(`invoiceReceiptList`,`/api/invoice-payments`,{success:Pl,error:[...Jt,fr]}).pipe(f([A.paymentRead,A.invoiceRead]),m),u.get(`creditNoteList`,`/api/credit-notes`,{success:Dl,error:[...Jt,fr]}).pipe(f([A.invoiceRead]),m),u.get(`invoiceRefundList`,`/api/invoice-refunds`,{success:Fl,error:[...Jt,fr]}).pipe(f([A.paymentRead,A.invoiceRead]),m),u.get(`invoiceHistory`,`/api/invoices/:invoiceId/history`,{params:{invoiceId:a},success:Hl,error:[...Jt,Fe,fr]}).pipe(f([A.invoiceRead,A.auditRead]),m,g),u.get(`invoicePaymentExport`,`/api/invoice-payments/export`,{query:Cl,success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`text/csv; charset=utf-8`})),error:[...hr,In,Cn]}).pipe(f([A.paymentRead]),m,P(L.tenPerMinute)),u.get(`invoiceList`,`/api/invoices`,{success:Ll,error:Jt}).pipe(f([A.invoiceRead]),m),u.get(`invoiceGet`,`/api/invoices/:invoiceId`,{params:{invoiceId:a},success:mr,error:[...Jt,Fe.pipe(p.status(404))]}).pipe(f([A.invoiceRead]),m),u.get(`invoicePreview`,`/api/invoices/:invoiceId/revisions/:version/preview`,{params:{invoiceId:a,version:Et},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[...Jt,Fe.pipe(p.status(404))]}).pipe(f([A.documentRender]),m,g),u.post(`invoicePdfRender`,`/api/invoices/:invoiceId/revisions/:version/pdf`,{params:{invoiceId:a,version:Et},success:Bl,error:[...hr,Fe.pipe(p.status(404))]}).pipe(f([A.documentRender]),m,P(L.tenPerMinute),g),u.get(`invoicePdfDownload`,`/api/invoices/:invoiceId/revisions/:version/pdf`,{params:{invoiceId:a,version:Et},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[...Jt,pe.pipe(p.status(404))]}).pipe(f([A.documentDownload]),m),u.post(`invoiceCreate`,`/api/invoices`,{payload:Qk,success:mr,error:[...hr,kn.pipe(p.status(404)),Rn.pipe(p.status(409)),Ar.pipe(p.status(422)),$r.pipe(p.status(422))]}).middleware(S).pipe(f([A.invoiceCreate]),m,P(L.sixtyPerMinute)),u.post(`invoiceRevisionCreate`,`/api/invoices/:invoiceId/revisions`,{params:{invoiceId:a},payload:Nk,success:mr,error:[...hr,Fe.pipe(p.status(404)),vn.pipe(p.status(409)),wt.pipe(p.status(409)),Ar.pipe(p.status(422)),$r.pipe(p.status(422))]}).middleware(S).pipe(f([A.invoiceUpdate]),m,P(L.sixtyPerMinute)),u.post(`invoiceIssue`,`/api/invoices/:invoiceId/issue`,{params:{invoiceId:a},payload:El,success:Tl,error:[...hr,Fe.pipe(p.status(404)),wt.pipe(p.status(409)),Ar.pipe(p.status(422)),Wt.pipe(p.status(409)),bn.pipe(p.status(422)),eo.pipe(p.status(422)),ot.pipe(p.status(409))]}).middleware(S).pipe(f([A.invoiceIssue]),m,P(L.tenPerMinute)),u.post(`invoicePaymentCreate`,`/api/invoices/:invoiceId/payments`,{params:{invoiceId:a},payload:wu$1.Struct(m$1(l({},nc.fields),{paidOn:Ze})),success:mr,error:[lr,...hr,Fe.pipe(p.status(404)),wt.pipe(p.status(409)),Wt.pipe(p.status(409))]}).middleware(S).pipe(f([A.invoiceMarkPaid]),m,P(L.tenPerMinute)),u.post(`invoicePaymentCancel`,`/api/invoices/:invoiceId/payments/:paymentId/cancel`,{params:{invoiceId:a,paymentId:a},payload:Il,success:mr,error:[lr,...hr,Fe.pipe(p.status(404)),wt.pipe(p.status(409)),Wt.pipe(p.status(409))]}).middleware(S).pipe(f([A.invoiceMarkPaid]),m,P(L.tenPerMinute)),u.post(`invoiceVoid`,`/api/invoices/:invoiceId/void`,{params:{invoiceId:a},payload:wl,success:mr,error:[...hr,Fe.pipe(p.status(404)),wt.pipe(p.status(409)),Wt.pipe(p.status(409)),eo.pipe(p.status(422))]}).middleware(S).pipe(f([A.invoiceVoid]),m,P(L.tenPerMinute))){};var wn=class extends D.make(`issuerSettings`,{topLevel:!0}).add(u.get(`issuerSettingsGet`,`/api/issuer-settings`,{success:da,error:[k.pipe(p.status(401)),v.pipe(p.status(403))]}).pipe(f([A.issuerRead]),m,g),u.put(`issuerSettingsUpdate`,`/api/issuer-settings`,{payload:iu,success:da,error:[Mi,k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429))]}).middleware(S).pipe(f([A.issuerUpdate]),m,P(L.sixtyPerMinute),g)){};var Tn=class extends D.make(`orders`,{topLevel:!0}).add(u.get(`orderList`,`/api/orders`,{success:Np,error:[k.pipe(p.status(401)),v.pipe(p.status(403))]}).pipe(f([A.orderRead]),m),u.get(`orderPreview`,`/api/orders/:orderId/preview`,{params:{orderId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[k.pipe(p.status(401)),v.pipe(p.status(403)),wo.pipe(p.status(404)),nt.pipe(p.status(409))]}).pipe(f([A.documentRender]),m,g),u.post(`orderPdfRender`,`/api/orders/:orderId/pdf`,{params:{orderId:a},success:Op,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),wo.pipe(p.status(404)),nt.pipe(p.status(409))]}).pipe(f([A.documentRender]),m,P(L.tenPerMinute),g),u.get(`orderPdfDownload`,`/api/orders/:orderId/pdf`,{params:{orderId:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[k.pipe(p.status(401)),v.pipe(p.status(403)),pe.pipe(p.status(404))]}).pipe(f([A.documentDownload]),m)){};var gy=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(120));var yy=wu$1.String.check(wu$1.isPattern(/\S/),wu$1.isMaxLength(2e3));var xy=wu$1.makeFilter(t=>qt(t.conditions,t.conditionsPresentation?.format??`plain`)&&/\S/.test(Fp(t.conditions,t.conditionsPresentation))||`document.conditions_format.invalid`);var Bn=wu$1.Struct({id:a,name:gy,conditions:yy,conditionsPresentation:wu$1.optionalKey(xe)}).check(xy);var Ml=wu$1.Array(Bn);var pc=wu$1.Struct({name:gy,conditions:yy,conditionsPresentation:wu$1.optionalKey(xe)}).check(xy);var to=class extends wu$1.TaggedError()(`QuoteConditionPresetNotFound`,{code:wu$1.Literal(`quote_condition_preset.not_found`)},{httpApiStatus:404}){};var ro=class extends wu$1.TaggedError()(`QuoteConditionPresetNameConflict`,{code:wu$1.Literal(`quote_condition_preset.name_conflict`)},{httpApiStatus:409}){};var Ok=wu$1.Union([k,v,E,to,ro]);var Ln=class extends D.make(`quoteConditionPresets`,{topLevel:!0}).add(u.get(`quoteConditionPresetList`,`/api/quote-condition-presets`,{success:Ml,error:[k.pipe(p.status(401)),v.pipe(p.status(403))]}).pipe(f([A.conditionRead]),m,g),u.post(`quoteConditionPresetCreate`,`/api/quote-condition-presets`,{payload:pc,success:Bn,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ro.pipe(p.status(409))]}).middleware(S).pipe(f([A.conditionManage]),m,P(L.sixtyPerMinute),g),u.put(`quoteConditionPresetUpdate`,`/api/quote-condition-presets/:presetId`,{params:{presetId:a},payload:pc,success:Bn,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),to.pipe(p.status(404)),ro.pipe(p.status(409))]}).middleware(S).pipe(f([A.conditionManage]),m,P(L.sixtyPerMinute),g),u.delete(`quoteConditionPresetDelete`,`/api/quote-condition-presets/:presetId`,{params:{presetId:a},success:Bn,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),to.pipe(p.status(404))]}).pipe(f([A.conditionManage]),m,P(L.sixtyPerMinute),g)){};var ts=t=>t.middleware(H);var Pn=class extends D.make(`quoteLinks`,{topLevel:!0}).add(u.get(`quoteLinkState`,`/api/quotes/:quoteId/signature-link`,{params:{quoteId:a},success:wu$1.NullOr(lu),error:[k,v,Pe,pt]}).pipe(f([A.quoteSend]),m),u.post(`quoteLinkReplace`,`/api/quotes/:quoteId/signature-link`,{params:{quoteId:a},payload:Au,success:ma,error:[k,v,E,Pe,pt,Rt,_r,jo]}).middleware(S).pipe(f([A.quoteSend]),m,P(L.tenPerMinute)),u.post(`quoteSend`,`/api/quotes/:quoteId/send`,{params:{quoteId:a},payload:uu,success:ma,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),Pe.pipe(p.status(404)),Rt.pipe(p.status(409)),pt.pipe(p.status(409)),_r.pipe(p.status(409)),ot.pipe(p.status(409))]}).middleware(S).pipe(f([A.quoteSend]),m,P(L.tenPerMinute)),u.post(`publicQuoteGet`,`/api/public/quote-link`,{payload:Aa,success:hu,error:[pr.pipe(p.status(404)),E.pipe(p.status(429))]}).middleware(S).pipe(ts,g),u.post(`publicQuotePdfDownload`,`/api/public/quote-link/pdf`,{payload:Aa,success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[pr.pipe(p.status(404)),E.pipe(p.status(429))]}).middleware(S).pipe(ts,g),u.post(`publicQuoteSign`,`/api/public/quote-link/signature`,{payload:fu,success:gu,error:[pr.pipe(p.status(404)),_o.pipe(p.status(409)),E.pipe(p.status(429))]}).middleware(S).pipe(ts,g)){};var Dn=class extends D.make(`quotes`,{topLevel:!0}).add(u.get(`quoteList`,`/api/quotes`,{success:yu,error:[k.pipe(p.status(401)),v.pipe(p.status(403))]}).pipe(f([A.quoteRead]),m),u.get(`quoteGet`,`/api/quotes/:quoteId`,{params:{quoteId:a},success:zo,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),Pe.pipe(p.status(404))]}).pipe(f([A.quoteRead]),m),u.get(`quotePreview`,`/api/quotes/:quoteId/revisions/:version/preview`,{params:{quoteId:a,version:Et},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[k.pipe(p.status(401)),v.pipe(p.status(403)),Pe.pipe(p.status(404)),nt.pipe(p.status(409))]}).pipe(f([A.documentRender]),m,g),u.post(`quotePdfRender`,`/api/quotes/:quoteId/revisions/:version/pdf`,{params:{quoteId:a,version:Et},success:Ap,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),Pe.pipe(p.status(404)),nt.pipe(p.status(409))]}).pipe(f([A.documentRender]),m,P(L.tenPerMinute),g),u.get(`quotePdfDownload`,`/api/quotes/:quoteId/revisions/:version/pdf`,{params:{quoteId:a,version:Et},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/pdf`})),error:[k.pipe(p.status(401)),v.pipe(p.status(403)),pe.pipe(p.status(404))]}).pipe(f([A.documentDownload]),m),u.post(`quoteCreate`,`/api/quotes`,{payload:pu,success:zo,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),ue.pipe(p.status(404)),ze.pipe(p.status(409)),Ct.pipe(p.status(404)),kt.pipe(p.status(409)),Zr.pipe(p.status(422))]}).middleware(S).pipe(f([A.quoteCreate]),m,P(L.sixtyPerMinute)),u.post(`quoteCancel`,`/api/quotes/:quoteId/cancel`,{params:{quoteId:a},payload:mu,success:zo,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),Pe.pipe(p.status(404)),Rt.pipe(p.status(409)),pt.pipe(p.status(409))]}).middleware(S).pipe(f([A.quoteDelete]),m,P(L.sixtyPerMinute)),u.post(`quoteRevisionCreate`,`/api/quotes/:quoteId/revisions`,{params:{quoteId:a},payload:du,success:zo,error:[k.pipe(p.status(401)),v.pipe(p.status(403)),E.pipe(p.status(429)),Pe.pipe(p.status(404)),Rt.pipe(p.status(409)),pt.pipe(p.status(409)),ue.pipe(p.status(404)),ze.pipe(p.status(409)),Zr.pipe(p.status(422))]}).middleware(S).pipe(f([A.quoteUpdate]),m,P(L.sixtyPerMinute))){};var Fn=class extends D.make(`status`,{topLevel:!0}).add(u.get(`health`,`/api/health`,{success:Gc}),u.get(`version`,`/api/version`,{success:Hp})){};var Hn=class extends D.make(`blog`,{topLevel:!0}).add(u.get(`blogFeed`,`/api/blog/feed`,{success:wu$1.String.pipe(p.asText({contentType:`application/atom+xml`}))})){};var dc=class extends D.make(`accounting`,{topLevel:!0}).add(u.get(`accountingAccountList`,`/api/accounting/accounts`,{success:ZA,error:G.members}).pipe(f([A.accountingRead]),m,g),u.post(`accountingAccountCreate`,`/api/accounting/accounts`,{payload:ep,success:ii,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.put(`accountingAccountUpdate`,`/api/accounting/accounts/:id`,{params:{id:a},payload:ep,success:ii,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.get(`accountingJournalList`,`/api/accounting/journals`,{success:_A,error:G.members}).pipe(f([A.accountingRead]),m,g),u.post(`accountingJournalCreate`,`/api/accounting/journals`,{payload:tp,success:Er,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.put(`accountingJournalUpdate`,`/api/accounting/journals/:id`,{params:{id:a},payload:tp,success:Er,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.get(`accountingPeriodList`,`/api/accounting/periods`,{success:jA,error:G.members}).pipe(f([A.accountingRead]),m,g),u.post(`accountingPeriodCreate`,`/api/accounting/periods`,{payload:zA,success:Ht,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.post(`accountingPeriodLock`,`/api/accounting/periods/:id/lock`,{params:{id:a},payload:ks,success:Ht,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.post(`accountingPeriodClose`,`/api/accounting/periods/:id/close`,{params:{id:a},payload:ks,success:Ht,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.post(`accountingPeriodFinalClose`,`/api/accounting/periods/:id/final-close`,{params:{id:a},payload:ks,success:Ht,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.post(`accountingPeriodReopen`,`/api/accounting/periods/:id/reopen`,{params:{id:a},payload:XA,success:Ht,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.get(`accountingEntryList`,`/api/accounting/entries`,{success:em,error:G.members}).pipe(f([A.accountingRead]),m,g),u.post(`accountingEntryCreate`,`/api/accounting/entries`,{payload:tm,success:jt,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.post(`accountingEntryPost`,`/api/accounting/entries/:id/post`,{params:{id:a},payload:rp,success:jt,error:G.members}).middleware(S).pipe(f([A.accountingValidate]),m,g),u.post(`accountingEntryReverse`,`/api/accounting/entries/:id/reverse`,{params:{id:a},payload:rp,success:jt,error:G.members}).middleware(S).pipe(f([A.accountingValidate]),m,g),u.get(`accountingLetterableLineList`,`/api/accounting/lettering/lines`,{success:lm,error:G.members}).pipe(f([A.accountingRead]),m,g),u.post(`accountingLetteringCreate`,`/api/accounting/lettering`,{payload:Am,success:mm,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.get(`accountingBalanceReport`,`/api/accounting/reports/balance`,{query:zt,success:rm,error:G.members}).pipe(f([A.accountingRead]),m,g),u.get(`accountingLedgerReport`,`/api/accounting/reports/ledger`,{query:zt,success:om,error:G.members}).pipe(f([A.accountingRead]),m,g),u.get(`accountingFinancialReport`,`/api/accounting/reports/financial-statements`,{query:zt,success:nm,error:G.members}).pipe(f([A.accountingRead]),m,g),u.get(`accountingTaxReport`,`/api/accounting/reports/france/vat`,{query:zt,success:im,error:G.members}).pipe(f([A.accountingRead]),m,g),u.get(`accountingCa3Export`,`/api/accounting/reports/france/ca3`,{query:zt,success:wu$1.String.pipe(p.asText({contentType:`application/json`})),error:G.members}).pipe(f([A.accountingExport]),m),u.get(`accountingFecExport`,`/api/accounting/reports/fec`,{query:zt,success:wu$1.String.pipe(p.asText({contentType:`text/plain; charset=utf-8`})),error:G.members}).pipe(f([A.accountingExport]),m),u.get(`accountingTaxFilingSettings`,`/api/accounting/tax-filing/settings`,{success:ip,error:G.members}).pipe(f([A.accountingExport]),m,g),u.put(`accountingTaxFilingSettingsUpdate`,`/api/accounting/tax-filing/settings`,{payload:sm,success:ip,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.get(`accountingTaxFilingSubmissionList`,`/api/accounting/tax-filings`,{success:am,error:G.members}).pipe(f([A.accountingExport]),m,g),u.post(`accountingTaxFilingSubmit`,`/api/accounting/tax-filings`,{payload:sp,success:ap,error:G.members}).middleware(S).pipe(f([A.accountingClose]),m,g),u.post(`accountingOpeningPreview`,`/api/accounting/opening-balances/preview`,{payload:cp,success:cm,error:G.members}).middleware(S).pipe(f([A.accountingWrite]),m,g),u.post(`accountingOpeningCommit`,`/api/accounting/opening-balances`,{payload:pm,success:jt,error:G.members}).middleware(S).pipe(f([A.accountingValidate]),m,g),u.get(`accountingEvidenceList`,`/api/accounting/evidence`,{success:dm,error:G.members}).pipe(f([A.accountingRead]),m,g),u.post(`accountingEvidenceCreate`,`/api/accounting/evidence`,{payload:um,success:oi,error:G.members}).middleware(S).pipe(f([A.accountingEvidence]),m,g),u.get(`accountingEvidenceDownload`,`/api/accounting/evidence/:id/download`,{params:{id:a},success:wu$1.Uint8Array.pipe(p.asUint8Array({contentType:`application/octet-stream`})),error:G.members}).pipe(f([A.accountingEvidence]),m,g)){};var uc=class extends D.make(`demo`,{topLevel:!0}).add(u.post(`demoReset`,`/api/demo/reset`,{payload:hm,success:fm,error:gm.members}).middleware(S).pipe(f([A.demoReset]),m,g)){};var ql=class extends ki.make(`froment-api`).add(Fn).add(Hn).add(ha).add(Ca).add(Ta).add(Da).add(Fa).add(Ha).add(qa).add(mn).add(An).add(Ua).add(Oa).add(Wa).add(Za).add(ec).add(yn).add(tc).add(rc).add(oc).add(Tn).add(Ln).add(wn).add(dn).add(Fi).add(Dn).add(Pn).add(En).add(gn).add(Sn).add(dc).add(uc).middleware(Pi).annotateMerge(xt.annotations({version:`latest`})){};export{Ds as $,bo as $a,ri as $c,Xu as $i,wR as $l,Nd as $n,gn as $o,T as $r,mn as $s,Ie as $t,Bu as A,_g as Aa,pl as Ac,Vu as Ai,ug as Al,La as An,ep as Ao,Qa as Ar,k as As,GA as At,za as Au,Ct as B,ag as Ba,qd as Bc,Wo as Bi,v as Bl,Ma as Bn,fm as Bo,Ro as Br,lg as Bs,Hd as Bt,zu as Bu,BC as C,Zu as Ca,ou as Cc,Ve as Ci,tn as Cl,Ko as Cn,dy as Co,Pi as Cr,jg as Cs,Fl as Ct,yl as Cu,Bk as D,_c as Da,pe as Dc,Vm as Di,tu as Dl,L as Dn,em as Do,Pu as Dr,jo as Ds,Fu as Dt,ys as Du,Bg as E,_a as Ea,pc as Ec,Vi as Ei,ts as El,Kx as En,el as Eo,Pn as Er,jm as Es,Fs as Et,yo as Eu,Ck as F,_u as Fa,pt as Fc,Wd as Fi,up as Fl,Ln as Fn,fa as Fo,Qu as Fr,kn as Fs,Go as Ft,zh as Fu,Dd as G,ar as Ga,ql as Gc,Xc as Gi,vn as Gl,Ml as Gn,fy as Go,S0 as Gr,lr as Gs,Hl as Gt,Cy as H,am as Ha,qh as Hc,Wu as Hi,vg as Hl,Mg as Hn,fr as Ho,Rt as Hr,lm as Hs,Hh as Ht,Cl as I,a as Ia,pu as Ic,We as Ii,ur as Il,Lp as In,fe as Io,Ra as Ir,kr as Is,Gt as It,zm as Iu,Di as J,ba as Ja,qs as Jc,Xh as Ji,vs as Jl,Mu as Jn,ge as Jo,Sk as Jr,m as Js,Ht as Jt,De as K,au as Ka,qo as Kc,Xd as Ki,vo as Kl,Mp as Kn,g as Ko,Sa as Kr,lu as Ks,Hn as Kt,Cn as L,aD as La,py as Lc,Wg as Li,ut as Ll,Lu as Ln,fg as Lo,Rg as Lr,ks as Ls,Gu as Lt,zo as Lu,C0 as M,_o as Ma,pn as Mc,WC as Mi,ul as Ml,Lg as Mn,eu as Mo,Qg as Mr,ka as Ms,Gc as Mt,zd as Mu,Ce as N,_r as Na,pp as Nc,WT as Ni,um as Nl,Lk as Nn,ey as No,Qo as Nr,kg as Ns,Gd as Nt,ze as Nu,Bl as O,_d as Oa,pg as Oc,Vo as Oi,ty as Ol,LC as On,en as Oo,Py as Or,jr as Os,Fy as Ot,yu as Ou,Cg as P,_t as Pa,pr as Pc,Wc as Pi,un as Pl,Ll as Pn,f as Po,Qp as Pr,kl as Ps,Gh as Pt,zg as Pu,Dp as Q,bn as Qa,rg as Qc,Xr as Qi,wC as Ql,Na as Qn,gm as Qo,Su as Qr,mm as Qs,Ia as Qt,Cr as R,aa as Ra,qB as Rc,Wh as Ri,uu as Rl,Ly as Rn,fk as Ro,Rl as Rr,kt as Rs,H as Rt,zr as Ru,Ay as S,Zr as Sa,ot as Sc,Vd as Si,tm as Sl,Ki as Sn,du as So,Pg as Sr,jd as Ss,Fk as St,yk as Su,Ba as T,_C as Ta,pa as Tc,Vh as Ti,tp as Tl,Ku as Tn,ek as To,Pl as Tr,ji as Ts,Fp as Tt,yn as Tu,DC as U,an as Ua,qi as Uc,Wx as Ui,vk as Ul,Mh as Un,ft as Uo,Ru as Ur,ln as Us,Hi as Ut,Cu as V,ak as Va,qg as Vc,Wt as Vi,va as Vl,Md as Vn,fo as Vo,Rs as Vr,lk as Vs,Hg as Vt,DR as W,ap as Wa,qk as Wc,XA as Wi,vl as Wl,Mi as Wn,fu as Wo,S as Wr,lp as Ws,Hk as Wt,Dl as X,bk as Xa,qu as Xc,Xm as Xi,vu as Xl,N0 as Xn,gk as Xo,So as Xr,mg as Xs,Hy as Xt,Dk as Y,bg as Ya,qt as Yc,Xi as Yi,vt as Yl,My as Yn,gg as Yo,Sn as Yr,ma as Ys,Hu as Yt,Dn as Z,bl as Za,qy as Zc,Xo as Zi,vy as Zl,NC as Zn,gl as Zo,Ss as Zr,mk as Zs,I0 as Zt,Am as _,Zg as _a,ok as _c,Up as _i,su as _l,KA as _n,dm as _o,P as _r,jA as _s,Fd as _t,xo as _u,$h as a,Yh as aa,nc as ac,Tp as ai,rp as al,It as an,cl as ao,Nu as ar,hm as as,Ee as at,wn as au,Ar as b,Zm as ba,on as bc,Va as bi,tk as bl,Kg as bn,dr as bo,Pa as br,ja as bs,Fh as bt,ya as bu,$o as c,Yo as ca,nl as cc,Ty as ci,sa as cl,Ja as cn,cp as co,Oe as cr,ia as cs,El as ct,wt as cu,$u as d,Yx as da,np as dc,Ud as di,si as dl,Jh as dn,cy as do,Oi as dr,ik as ds,Er as dt,x0 as du,YC as ea,mo as ec,TC as ei,rk as el,Ig as en,bu as eo,Ng as er,go as es,Du as et,wa as eu,A as f,ZA as fa,nt as fc,Ug as fi,sk as fl,Ji as fn,dL as fo,Ok as fr,il as fs,Et as ft,xa as fu,Al as g,Ze as ga,oi as gc,Uo as gi,sp as gl,Jx as gn,dl as go,Ou as gr,iy as gs,FR as gt,xl as gu,Ak as h,Zd as ha,og as hc,Uk as hi,sn as hl,Ju as hn,dk as ho,Ot as hr,iu as hs,FC as ht,xk as hu,$g as i,Yg as ia,na as ic,Tn as ii,ro as il,Is as in,ck as io,Np as ir,hk as is,Ea as it,wl as iu,By as j,_h as ja,pm as jc,Vx as ji,uk as jl,Le as jn,es as jo,Qd as jr,k0 as js,Ga as jt,zc as ju,Bn as k,_e as ka,pk as kc,Vt as ki,ue as kl,LR as kn,eo as ko,QC as kr,jt as ks,G as kt,zA as ku,$r as l,Yr as la,nm as lc,U as li,se as ll,Jc as ln,cr as lo,Og as lr,ig as ls,En as lt,wu as lu,Ag as m,Zc as ma,ny as mc,Ui as mi,sm as ml,Jr as mn,dg as mo,Op as mr,ip as ms,Ey as mt,xg as mu,$c as n,Yc as na,mu as nc,Tg as ni,rm as nl,In as nn,cc as no,Ni as nr,he as ns,E as nt,wg as nu,$m as o,Yi as oa,ng as oc,Tt as oi,ru as ol,JA as on,cm as oo,OA as or,ho as os,Eg as ot,wo as ou,Aa as p,ZC as pa,nu as pc,Uh as pi,sl as pl,Jo as pn,da as po,Oo as pr,im as ps,Eu as pt,xe as pu,Dg as q,ay as qa,qp as qc,Xg as qi,vr as ql,Ms as qn,ga as qo,Sg as qr,ly as qs,Hp as qt,$d as r,Yd as ra,my as rc,Tl as ri,rn as rl,Io as rn,cg as ro,No as rr,hg as rs,ED as rt,wk as ru,$n as s,Ym as sa,ni as sc,Tu as si,ry as sl,JC as sn,cn as so,Od as sr,hu as ss,Ek as st,wr as su,$A as t,Ya as ta,mr as tc,TR as ti,rl as tl,Il as tn,by as to,Nh as tr,gu as ts,Dy as tt,we as tu,$t as u,Yu as ua,nn as uc,UC as ui,sg as ul,Jd as un,cu as uo,Oh as ur,ii as us,Eo as ut,wy as uu,An as v,Zh as va,ol as vc,Uu as vi,sy as vl,Ka as vn,dn as vo,PC as vr,jC as vs,Fe as vt,xs as vu,BR as w,_A as wa,oy as wc,Vg as wi,to as wl,Kt as wn,eg as wo,Pk as wr,jh as ws,Fn as wt,ym as wu,Au as x,Zo as xa,op as xc,Vc as xi,tl as xl,Kh as xn,dt as xo,Pe as xr,jc as xs,Fi as xt,yg as xu,Ap as y,Zi as ya,om as yc,VC as yi,ti as yl,Kd as yn,dp as yo,PR as yr,jT as ys,Fg as yt,xu as yu,Cs as z,ae as za,qC as zc,Wi as zi,uy as zl,MC as zn,fl as zo,Rn as zr,ku as zs,HC as zt,zt as zu};
@@ -1 +1 @@
1
- import{Dn as g,H as JD,o as A,ot as OD}from"./chunk-BAHiFuUo.js";import{Mo as eu,Pt as Gh,Ri as Wh,Ut as Hi,aa as Yh,an as It,ja as _h,r as $d,za as ae}from"./chunk-CjtJKrza.js";import{n as m}from"./chunk-Dv9sNWWK.js";var S=class s{http=g(OD);list(){return m(this.http.get(`/api/supplier-invoices`),Gh,ae,`supplierInvoice.error`)}get(e){return m(this.http.get(`/api/supplier-invoices/${e}`),It,ae,`supplierInvoice.error`)}evidence(e){return m(this.http.get(`/api/supplier-invoices/${e}/evidence`),_h,ae,`supplierInvoice.error`)}createEvidence(e){return m(this.http.post(`/api/supplier-invoice-evidence`,e),Hi,ae,`supplierInvoice.error`)}downloadEvidence(e){return JD(this.http.get(`/api/supplier-invoice-evidence/${e}/download`,{responseType:`blob`}))}create(e){return m(this.http.post(`/api/supplier-invoices`,e),It,ae,`supplierInvoice.error`)}createCredit(e){return m(this.http.post(`/api/supplier-credits`,e),It,ae,`supplierInvoice.error`)}update(e,p){return m(this.http.put(`/api/supplier-invoices/${e}`,p),It,ae,`supplierInvoice.error`)}transition(e,p,m$1){return m(this.http.post(`/api/supplier-invoices/${e}/${p}`,{expectedVersion:m$1}),It,ae,`supplierInvoice.error`)}analysisSettings(){return m(this.http.get(`/api/supplier-invoice-analysis/settings`),eu,ae,`supplierInvoice.error`)}analysisStatus(){return m(this.http.get(`/api/supplier-invoice-analysis/status`),Yh,ae,`supplierInvoice.error`)}updateAnalysisSettings(e){return m(this.http.put(`/api/supplier-invoice-analysis/settings`,e),eu,ae,`supplierInvoice.error`)}analyze(e){return m(this.http.post(`/api/supplier-invoices/analyze`,e),It,ae,`supplierInvoice.error`)}paymentBatches(){return m(this.http.get(`/api/supplier-payment-batches`),Wh,ae,`supplierInvoice.error`)}createPaymentBatch(e){return m(this.http.post(`/api/supplier-payment-batches`,e),$d,ae,`supplierInvoice.error`)}static ɵfac=function(p){return new(p||s)};static ɵprov=A({token:s,factory:s.ɵfac,providedIn:`root`})};export{S as t};
1
+ import{Dn as g,H as JD,o as A,ot as OD}from"./chunk-BAHiFuUo.js";import{n as m}from"./chunk-Dv9sNWWK.js";import{Mo as eu,Pt as Gh,Ri as Wh,Ut as Hi,aa as Yh,an as It,ja as _h,r as $d,za as ae}from"./chunk-D5qmP2Wu.js";var S=class s{http=g(OD);list(){return m(this.http.get(`/api/supplier-invoices`),Gh,ae,`supplierInvoice.error`)}get(e){return m(this.http.get(`/api/supplier-invoices/${e}`),It,ae,`supplierInvoice.error`)}evidence(e){return m(this.http.get(`/api/supplier-invoices/${e}/evidence`),_h,ae,`supplierInvoice.error`)}createEvidence(e){return m(this.http.post(`/api/supplier-invoice-evidence`,e),Hi,ae,`supplierInvoice.error`)}downloadEvidence(e){return JD(this.http.get(`/api/supplier-invoice-evidence/${e}/download`,{responseType:`blob`}))}create(e){return m(this.http.post(`/api/supplier-invoices`,e),It,ae,`supplierInvoice.error`)}createCredit(e){return m(this.http.post(`/api/supplier-credits`,e),It,ae,`supplierInvoice.error`)}update(e,p){return m(this.http.put(`/api/supplier-invoices/${e}`,p),It,ae,`supplierInvoice.error`)}transition(e,p,m$1){return m(this.http.post(`/api/supplier-invoices/${e}/${p}`,{expectedVersion:m$1}),It,ae,`supplierInvoice.error`)}analysisSettings(){return m(this.http.get(`/api/supplier-invoice-analysis/settings`),eu,ae,`supplierInvoice.error`)}analysisStatus(){return m(this.http.get(`/api/supplier-invoice-analysis/status`),Yh,ae,`supplierInvoice.error`)}updateAnalysisSettings(e){return m(this.http.put(`/api/supplier-invoice-analysis/settings`,e),eu,ae,`supplierInvoice.error`)}analyze(e){return m(this.http.post(`/api/supplier-invoices/analyze`,e),It,ae,`supplierInvoice.error`)}paymentBatches(){return m(this.http.get(`/api/supplier-payment-batches`),Wh,ae,`supplierInvoice.error`)}createPaymentBatch(e){return m(this.http.post(`/api/supplier-payment-batches`,e),$d,ae,`supplierInvoice.error`)}static ɵfac=function(p){return new(p||s)};static ɵprov=A({token:s,factory:s.ɵfac,providedIn:`root`})};export{S as t};
@@ -0,0 +1 @@
1
+ import{t as l}from"./chunk-BwCtja5l.js";import{Dn as g,E as Ft,p as Be}from"./chunk-BAHiFuUo.js";import{a as T,y as G}from"./main-F7D3L737.js";import{n as w,r as x}from"./chunk-B0bNirg2.js";import{a as r,i as n}from"./chunk-DpLF2wJ62.js";var u=class e{query=T(g(G).queryParamMap,{requireSync:!0});params=Ft(()=>l(l({},w(x(this.query(),r),r)),w(x(this.query(),n),n)));static ɵfac=function(f){return new(f||e)};static ɵprov=Be({token:e,factory:e.ɵfac,autoProvided:!1})};export{u as t};
@@ -0,0 +1 @@
1
+ import{$t as ZC,A as Gy,D as Fy,Dn as g,E as Ft,Ir as wp,It as Us,Jr as zS,K as Ke,Nr as vd,Sr as rv,Tn as fd,V as Iy,Wn as kS,Wr as y_,hr as q_,l as A_,lt as OS,mr as qT,pr as qS,qn as ky,rn as Zw,rr as nv,tn as ZT,vt as Py,w as Fb,z as Ip}from"./chunk-BAHiFuUo.js";import{r as N}from"./main-F7D3L737.js";import{ct as Me,wi as wu}from"./chunk-BAe_07VM.js";import"./chunk-Dv9sNWWK.js";import{$r as T,Hi as Wu}from"./chunk-D5qmP2Wu.js";import"./chunk-BzUDWIzm.js";import"./chunk-CReShp-B.js";import"./chunk-CfwFJLFh.js";import"./chunk-DsaNNeZe.js";import{t as l}from"./chunk-BVszSMJC.js";import{d as nr,f as or,h as yn,n as an,o as gn,r as cn,t as P,u as mn}from"./chunk-CSkyOfSg.js";import"./chunk-B56nz2lI.js";import{t as k}from"./chunk-D5MFwK9L.js";import"./chunk-niXXbm7H.js";import"./chunk-NDpjbcAr2.js";import"./chunk-POMKwNf_.js";import{a as u}from"./chunk-Dx1NwQCW.js";import"./chunk-Fc120Hsi2.js";import{o as N$1,r as E}from"./chunk-B6Rml85x2.js";import{t as u$1}from"./chunk-MpUdRrak2.js";import"./chunk-CEJjSd8-2.js";import{t as w}from"./chunk-Bb31fHqC2.js";import{t as S}from"./chunk-P1du2kWg2.js";import{t as v}from"./chunk-BGVaNZdj.js";function ie(t,n){if(t&1&&(Us(0,`p`,3),y_(1),fd()),t&2){let e=qS();ZC(),nv(e.i18n.t(`backOffice.invoices.loading`))}}function ae(t,n){if(t&1&&(Us(0,`p`,4),y_(1),fd()),t&2){let e=qS();ZC(),nv(e.i18n.t(`credit.loadError`))}}function re(t,n){if(t&1&&(Us(0,`p`,2),y_(1),fd()),t&2){let e=qS(2);ZC(),nv(e.i18n.t(`billingWorkspace.unavailable`))}}function oe(t,n){if(t&1&&y_(0),t&2)vd(` `,qS(4).i18n.t(`billingWorkspace.amountInvalid`),` `)}function de(t,n){if(t&1&&y_(0),t&2)vd(` `,qS(4).i18n.t(`billingWorkspace.dateInvalid`),` `)}function le(t,n){if(t&1&&y_(0),t&2)vd(` `,qS(4).i18n.t(`billingWorkspace.referenceInvalid`),` `)}function ce(t,n){if(t&1){let e=zS();Us(0,`button`,19),Gy(`click`,function(){Ip(e);return wp(qS(4).retry())}),y_(1),fd()}if(t&2){let e=qS(4);Fy(`disabled`,e.task.busy()),ZC(),vd(` `,e.i18n.t(`billingWorkspace.retrySame`),` `)}}function se(t,n){if(t&1){let e=zS();Us(0,`form`,7),Gy(`submit`,function(c){Ip(e);return wp(qS(3).save(c))}),Us(1,`div`,8)(2,`label`,9),y_(3),Py(4,`input`,10),qT(),Us(5,`span`,11),OS(6,oe,1,1),fd()(),Us(7,`label`,9),y_(8),Py(9,`input`,12),qT(),Us(10,`span`,13),OS(11,de,1,1),fd()()(),Us(12,`label`,9),y_(13),Py(14,`input`,14),qT(),Us(15,`span`,15),OS(16,le,1,1),fd()(),Us(17,`div`,16)(18,`button`,17),y_(19),fd(),OS(20,ce,2,2,`button`,18),fd()()}if(t&2){let e=qS(3);ZC(3),nv(e.i18n.t(`credit.amount`)),ZC(),Fy(`formField`,e.refundForm.amount),ky(`aria-invalid`,e.refundForm.amount().touched()&&e.refundForm.amount().invalid()),ZT(),ZC(2),kS(e.refundForm.amount().touched()&&e.refundForm.amount().invalid()?6:-1),ZC(2),nv(e.i18n.t(`credit.refundedOn`)),ZC(),Fy(`formField`,e.refundForm.refundedOn),ky(`aria-invalid`,e.refundForm.refundedOn().touched()&&e.refundForm.refundedOn().invalid()),ZT(),ZC(2),kS(e.refundForm.refundedOn().touched()&&e.refundForm.refundedOn().invalid()?11:-1),ZC(2),nv(e.i18n.t(`credit.reference`)),ZC(),Fy(`formField`,e.refundForm.reference),ky(`aria-invalid`,e.refundForm.reference().touched()&&e.refundForm.reference().invalid()),ZT(),ZC(2),kS(e.refundForm.reference().touched()&&e.refundForm.reference().invalid()?16:-1),ZC(2),Fy(`disabled`,e.task.locked()),ZC(),vd(` `,e.i18n.t(`credit.recordRefund`),` `),ZC(),kS(e.task.uncertain()?20:-1)}}function ue(t,n){if(t&1&&(Us(0,`p`)(1,`strong`),y_(2),fd()(),Iy(3,se,21,15,`form`,6)),t&2){let e=qS(2);ZC(2),rv(``,e.i18n.t(`credit.refundable`),` `,e.task.money(e.balance())),ZC(),Fy(`appCan`,`invoice.refund`)}}function me(t,n){if(t&1&&OS(0,re,2,1,`p`,2)(1,ue,4,3),t&2)kS(qS().eligible()?1:0)}function pe(t,n){if(t&1){let e=zS();Us(0,`button`,20),Gy(`click`,function(){Ip(e);return wp(qS().reload())}),y_(1),fd()}if(t&2){let e=qS();Fy(`disabled`,e.task.busy()||e.task.loading()),ZC(),vd(` `,e.i18n.t(`listControls.reload`),` `)}}var te=()=>({amount:``,refundedOn:``,reference:``});var ne=class t{task=g(w);i18n=this.task.i18n;api=g(u$1);credits=q_({params:()=>this.task.invoice()?.id,loader:({params:n})=>this.api.get(n)});creditState=Ft(()=>{let n=this.credits.hasValue()?this.credits.value():void 0;return n?.success?n.result:void 0});balance=Ft(()=>this.creditState()?.refundableCents??0);eligible=Ft(()=>this.balance()>0);model=Ke(te());baseline=JSON.stringify(this.model());refundForm=nr(this.model,n=>{an(n,()=>this.task.locked()||!this.eligible()),gn(n.amount),P(n.amount,({value:e})=>{let i=u(e(),2);return i===void 0||i<=0||i>this.balance()?{kind:`amount`}:void 0}),gn(n.refundedOn),P(n.refundedOn,({value:e})=>{let i=this.creditState()?.creditNotes.filter(c=>c.status===`issued`).map(c=>c.issuedAt).filter(c=>c!==null).sort()[0];return!wu.is(T)(e())||e()>N$1()||i!==void 0&&e()<E(i)?{kind:`date`}:void 0}),gn(n.reference),mn(n.reference,/\S/),cn(n.reference,160)});hasUnsavedChanges=Ft(()=>JSON.stringify(this.model())!==this.baseline||this.refundForm().errorSummary().some(n=>n.kind===`parse`));attempt;save(n){n.preventDefault(),!(this.task.locked()||!this.eligible())&&or(this.refundForm,{action:async()=>{let e=this.refundForm().value(),i=wu.decodeUnknownOption(Wu)({amountCents:u(e.amount,2),refundedOn:e.refundedOn,reference:e.reference.trim(),requestId:crypto.randomUUID()});if(Me.isNone(i)){this.task.error.set(`invoice.credit_conflict`);return}this.attempt=i.value,await this.retry()},onInvalid:()=>this.task.focusInvalid()})}async retry(){let n=this.task.invoice(),e=this.attempt;if(!n||!e)return;await this.task.run(()=>this.api.refund(n.id,e),`credit.confirmRefund`,`refund`)===`resolved`&&(this.attempt=void 0)}async reload(){this.task.uncertain()||this.task.busy()||await this.task.confirmation.request(this.i18n.t(`billingWorkspace.reloadConfirm`))&&(this.attempt=void 0,this.refundForm().reset(te()),await this.task.load(),this.credits.reload())}canDeactivate(){return this.task.canDeactivate(this.hasUnsavedChanges())}static ɵfac=function(e){return new(e||t)};static ɵcmp=Fb({type:t,selectors:[[`app-refund-editor`]],hostAttrs:[1,`page-container`],hostBindings:function(e,i){e&1&&Gy(`beforeunload`,function(M){return i.task.beforeUnload(M,i.hasUnsavedChanges())},Zw)},features:[A_([w])],decls:9,vars:4,consts:[[`aria-labelledby`,`refund-title`,1,`detail-page`,`form-page`],[`headingId`,`refund-title`,3,`heading`],[`appNotice`,``],[`role`,`status`],[`appNotice`,``,`variant`,`danger`,`role`,`alert`],[`appButton`,``,3,`disabled`],[`class`,`task-form ds-panel form-panel`,3,`submit`,4,`appCan`],[1,`task-form`,`ds-panel`,`form-panel`,3,`submit`],[1,`fields`],[1,`field`],[`inputmode`,`decimal`,`aria-describedby`,`refund-amount-error`,1,`input`,3,`formField`],[`id`,`refund-amount-error`,1,`field-error`],[`type`,`date`,`aria-describedby`,`refund-date-error`,1,`input`,3,`formField`],[`id`,`refund-date-error`,1,`field-error`],[`aria-describedby`,`refund-reference-error`,1,`input`,3,`formField`],[`id`,`refund-reference-error`,1,`field-error`],[1,`actions`],[`appButton`,``,`type`,`submit`,`variant`,`primary`,3,`disabled`],[`appButton`,``,`type`,`button`,3,`disabled`],[`appButton`,``,`type`,`button`,3,`click`,`disabled`],[`appButton`,``,3,`click`,`disabled`]],template:function(e,i){e&1&&(Us(0,`section`,0),Py(1,`app-invoice-task-header`,1),Us(2,`p`,2),y_(3),fd(),Py(4,`app-invoice-task-feedback`),OS(5,ie,2,1,`p`,3)(6,ae,2,1,`p`,4)(7,me,2,1),OS(8,pe,2,2,`button`,5),fd()),e&2&&(ZC(),Fy(`heading`,i.i18n.t(`credit.recordRefund`)),ZC(2),nv(i.i18n.t(`billingWorkspace.refundHint`)),ZC(2),kS(i.credits.isLoading()?5:i.task.invoice()&&!i.creditState()?6:i.task.invoice()&&!i.task.completed()?7:-1),ZC(3),kS(i.task.error()&&!i.task.completed()&&!i.task.uncertain()?8:-1))},dependencies:[l,N,k,yn,v,S],styles:[`[appListWorkspace][_ngcontent-%COMP%] > p[_ngcontent-%COMP%]{margin-block:0}header[_ngcontent-%COMP%], .actions[_ngcontent-%COMP%], .filters[_ngcontent-%COMP%], .chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--%NS%space-3)}header[_ngcontent-%COMP%]{justify-content:space-between;align-items:start}.billing-page[_ngcontent-%COMP%] > h1[_ngcontent-%COMP%]{font-size:var(--%NS%text-2xl);margin-block:var(--%NS%space-2)}h2[_ngcontent-%COMP%]{font-size:var(--%NS%text-xl)}.field[_ngcontent-%COMP%]{display:grid;gap:var(--%NS%space-2);min-inline-size:0}.filters[_ngcontent-%COMP%]{align-items:end}.filters[_ngcontent-%COMP%] .search[_ngcontent-%COMP%]{flex:1 1 22rem}.filters[_ngcontent-%COMP%] .field[_ngcontent-%COMP%]:not(.search){flex:1 1 10rem}.amount[_ngcontent-%COMP%]{text-align:end;font-variant-numeric:tabular-nums;white-space:nowrap}td[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{display:block;color:var(--%NS%color-muted)}.muted[_ngcontent-%COMP%]{color:var(--%NS%color-muted)}.empty[_ngcontent-%COMP%], .bulk-actions[_ngcontent-%COMP%], .summary[_ngcontent-%COMP%]{padding:var(--%NS%space-4)}.task-form[_ngcontent-%COMP%]{display:grid;gap:var(--%NS%space-5);inline-size:100%}.fields[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--%NS%space-4)}.field-error[_ngcontent-%COMP%]{color:var(--%NS%color-danger);font-size:var(--%NS%text-sm)}.field-error[_ngcontent-%COMP%]:empty{display:none}dl[_ngcontent-%COMP%]{display:grid;gap:var(--%NS%space-3)}dl[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;justify-content:space-between;gap:var(--%NS%space-2) var(--%NS%space-4)}dt[_ngcontent-%COMP%]{color:var(--%NS%color-muted)}dd[_ngcontent-%COMP%]{margin:0;overflow-wrap:anywhere}ol[_ngcontent-%COMP%]{display:grid;gap:var(--%NS%space-4)}.history-entry[_ngcontent-%COMP%]{padding:var(--%NS%space-4);overflow-wrap:anywhere}@media(max-width:40rem){.fields[_ngcontent-%COMP%]{grid-template-columns:1fr}}[_nghost-%COMP%]{display:block}.detail-page[_ngcontent-%COMP%]{display:grid;gap:var(--%NS%space-4);min-inline-size:0;inline-size:100%;max-inline-size:var(--%NS%page-width-detail);margin-inline:auto;padding:var(--%NS%page-header-y) var(--%NS%page-x)}.detail-page.form-page[_ngcontent-%COMP%]{max-inline-size:var(--%NS%page-width-form)}.detail-page.wide-page[_ngcontent-%COMP%]{max-inline-size:var(--%NS%page-width-wide)}app-page-header[data-header-layout=stacked][_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:0;font-size:var(--%NS%text-2xl);overflow-wrap:anywhere}app-page-header[data-header-layout=stacked][_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:var(--%NS%text-base);color:var(--%NS%color-muted);overflow-wrap:anywhere}.detail-page[_ngcontent-%COMP%] > button[_ngcontent-%COMP%]{justify-self:start}@media print{.detail-page[_ngcontent-%COMP%], .detail-page.form-page[_ngcontent-%COMP%], .detail-page.wide-page[_ngcontent-%COMP%]{max-inline-size:none}}`]})};export{ne as RefundEditor};