sandforge 1.82.0 → 1.83.0

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 (200) hide show
  1. package/lib/{chunk-JLZRZL5E.mjs → chunk-262TP6UU.mjs} +1 -1
  2. package/lib/{chunk-Z42PHCVZ.mjs → chunk-27BBEGUD.mjs} +1 -1
  3. package/lib/{chunk-YGJF55VJ.mjs → chunk-2ADSD5WK.mjs} +1 -1
  4. package/lib/{chunk-KIMQQ6JQ.mjs → chunk-2GSMHGIV.mjs} +1 -1
  5. package/lib/chunk-2K5BYZQM.mjs +8 -0
  6. package/lib/{chunk-DJCGURW7.mjs → chunk-2KTGDYUH.mjs} +1 -1
  7. package/lib/{chunk-YAJQS3OL.mjs → chunk-2N73W63D.mjs} +1 -1
  8. package/lib/{chunk-LXDSRP2W.mjs → chunk-2R6GFNKF.mjs} +1 -1
  9. package/lib/{chunk-VZVICK7Q.mjs → chunk-2WMKJVD2.mjs} +1 -1
  10. package/lib/{chunk-CV47FDQW.mjs → chunk-36Y225OM.mjs} +1 -1
  11. package/lib/{chunk-3C2ZZIFN.mjs → chunk-3CM7LAPE.mjs} +1 -1
  12. package/lib/{chunk-HIHCYMSL.mjs → chunk-3OVTKRS4.mjs} +1 -1
  13. package/lib/{chunk-XFU3HRUV.mjs → chunk-3V4YH5KO.mjs} +1 -1
  14. package/lib/{chunk-XO5FBOQF.mjs → chunk-446GBKAC.mjs} +1 -1
  15. package/lib/{chunk-ZUOPC4W2.mjs → chunk-4GCYGQXD.mjs} +1 -1
  16. package/lib/{chunk-GCGHHN4K.mjs → chunk-4V3QO7HF.mjs} +1 -1
  17. package/lib/{chunk-VZT4E2OJ.mjs → chunk-4X5D3MSV.mjs} +1 -1
  18. package/lib/{chunk-P55MKIZX.mjs → chunk-5OGNK3JP.mjs} +1 -1
  19. package/lib/{chunk-3MGMNK3Q.mjs → chunk-6KOUYHEY.mjs} +1 -1
  20. package/lib/chunk-6QSHWIZI.mjs +48 -0
  21. package/lib/chunk-6VOQFISN.mjs +7 -0
  22. package/lib/{chunk-VYOYXTCU.mjs → chunk-6YC2ELCU.mjs} +1 -1
  23. package/lib/chunk-77IVKH7R.mjs +7 -0
  24. package/lib/{chunk-JKT5YAQ2.mjs → chunk-77MZRBWX.mjs} +1 -1
  25. package/lib/{chunk-PR74GYVI.mjs → chunk-7BQMBXKX.mjs} +1 -1
  26. package/lib/{chunk-SZGGFST2.mjs → chunk-7DPHZWA4.mjs} +1 -1
  27. package/lib/chunk-7V2UYZ6S.mjs +7 -0
  28. package/lib/{chunk-HKUWHVI7.mjs → chunk-7WSQ65WG.mjs} +1 -1
  29. package/lib/{chunk-LHU6CPGE.mjs → chunk-7ZBDACVG.mjs} +1 -1
  30. package/lib/{chunk-WT3SCUHS.mjs → chunk-AG24QMSY.mjs} +1 -1
  31. package/lib/{chunk-A65ADTCR.mjs → chunk-AHUGG3WU.mjs} +1 -1
  32. package/lib/{chunk-ZXFL2MSN.mjs → chunk-ALBY5SOH.mjs} +1 -1
  33. package/lib/chunk-AXFD2OH6.mjs +7 -0
  34. package/lib/{chunk-JESRFE2Z.mjs → chunk-BH76USTQ.mjs} +1 -1
  35. package/lib/{chunk-DBBPDSFN.mjs → chunk-BPHTA6KP.mjs} +1 -1
  36. package/lib/{chunk-3SKLBRPL.mjs → chunk-BT43WSOS.mjs} +1 -1
  37. package/lib/{chunk-32EUNQT6.mjs → chunk-BVZ5H3N4.mjs} +1 -1
  38. package/lib/{chunk-PWVDNN2C.mjs → chunk-C6RKM4BB.mjs} +1 -1
  39. package/lib/{chunk-27Z76O2O.mjs → chunk-CDWZGQAJ.mjs} +1 -1
  40. package/lib/chunk-CGZGL6VT.mjs +7 -0
  41. package/lib/{chunk-P63WJMXQ.mjs → chunk-CN5HGFG4.mjs} +1 -1
  42. package/lib/{chunk-Y4TDVDP2.mjs → chunk-CQAFVEKP.mjs} +1 -1
  43. package/lib/{chunk-G2JR3F63.mjs → chunk-CTPLYUXA.mjs} +1 -1
  44. package/lib/chunk-CXKZ6TYV.mjs +9 -0
  45. package/lib/{chunk-FKK5YBGZ.mjs → chunk-D6JT4PAB.mjs} +1 -1
  46. package/lib/{chunk-3CX7GPCR.mjs → chunk-D7XUNWWU.mjs} +1 -1
  47. package/lib/{chunk-PPHVWUFY.mjs → chunk-DB5RVDC5.mjs} +1 -1
  48. package/lib/{chunk-LAUOSXMN.mjs → chunk-DIGUC7S4.mjs} +1 -1
  49. package/lib/{chunk-6GQUZ4IP.mjs → chunk-DKDKCGXV.mjs} +1 -1
  50. package/lib/chunk-DMT5SCO3.mjs +7 -0
  51. package/lib/{chunk-KKOA62S4.mjs → chunk-DNQKVCUV.mjs} +4 -3
  52. package/lib/{chunk-3XG25GTF.mjs → chunk-DSR2MSBH.mjs} +1 -1
  53. package/lib/{chunk-ZHIZY3ZC.mjs → chunk-E3RQ575Y.mjs} +1 -1
  54. package/lib/{chunk-SAMWHL22.mjs → chunk-EOQON3E5.mjs} +1 -1
  55. package/lib/{chunk-2JZGCCPG.mjs → chunk-ETNQHIDI.mjs} +1 -1
  56. package/lib/chunk-F5SBGJWW.mjs +7 -0
  57. package/lib/chunk-FBXH4VRQ.mjs +7 -0
  58. package/lib/chunk-FKCIGJOI.mjs +15 -0
  59. package/lib/{chunk-NWOI25WY.mjs → chunk-FVLFO2S6.mjs} +1 -1
  60. package/lib/{chunk-MKTXJCXN.mjs → chunk-FYWNSMOZ.mjs} +1 -1
  61. package/lib/{chunk-52EXDVPN.mjs → chunk-GEEWPTV5.mjs} +1 -1
  62. package/lib/{chunk-XSKPYGMT.mjs → chunk-GLN4PI5P.mjs} +1 -1
  63. package/lib/{chunk-DWMRIWV5.mjs → chunk-GT5ZKU6V.mjs} +1 -1
  64. package/lib/chunk-GTRU5AV5.mjs +7 -0
  65. package/lib/chunk-H33DVU3D.mjs +7 -0
  66. package/lib/{chunk-YAIIRFKJ.mjs → chunk-HQZUQXDC.mjs} +1 -1
  67. package/lib/{chunk-MUEQRIK7.mjs → chunk-HVX2AFYW.mjs} +1 -1
  68. package/lib/chunk-I3ZO76LL.mjs +21 -0
  69. package/lib/{chunk-7WSLT5VX.mjs → chunk-I5C4O3VA.mjs} +1 -1
  70. package/lib/{chunk-6VSZNZHH.mjs → chunk-IHGYJZZ2.mjs} +1 -1
  71. package/lib/{chunk-DIS254AN.mjs → chunk-ISA2NYJV.mjs} +1 -1
  72. package/lib/{chunk-GGUOIDWP.mjs → chunk-ISAUCWYK.mjs} +1 -1
  73. package/lib/{chunk-ZUTUYBNW.mjs → chunk-ISOSTAJR.mjs} +1 -1
  74. package/lib/chunk-IXIY6Q4M.mjs +7 -0
  75. package/lib/{chunk-2UU42PTD.mjs → chunk-J3TIHLWG.mjs} +1 -1
  76. package/lib/{chunk-GGNUACTY.mjs → chunk-JAV6F6OA.mjs} +1 -1
  77. package/lib/chunk-JBWJ6UEZ.mjs +7 -0
  78. package/lib/{chunk-C2N2TNEU.mjs → chunk-JH4ZTVQN.mjs} +1 -1
  79. package/lib/{chunk-FOIWWK7G.mjs → chunk-JIPT5FUD.mjs} +1 -1
  80. package/lib/{chunk-7EYQYZJP.mjs → chunk-JREKJO3D.mjs} +1 -1
  81. package/lib/{chunk-VQJMP3DC.mjs → chunk-JUOQUG7U.mjs} +1 -1
  82. package/lib/chunk-JYUMD357.mjs +7 -0
  83. package/lib/{chunk-KP5G6FUC.mjs → chunk-K7G3W7XH.mjs} +1 -1
  84. package/lib/{chunk-T7WREYA5.mjs → chunk-KKS2KFBT.mjs} +1 -1
  85. package/lib/{chunk-TMA34QMA.mjs → chunk-KWAVSZ2B.mjs} +1 -1
  86. package/lib/{chunk-H4JUYUSL.mjs → chunk-KXUOHACP.mjs} +1 -1
  87. package/lib/{chunk-STRMWSIQ.mjs → chunk-L3I6DAHX.mjs} +1 -1
  88. package/lib/{chunk-TCBAE65A.mjs → chunk-L47JCNP3.mjs} +1 -1
  89. package/lib/{chunk-5K2I2DMP.mjs → chunk-L4MSL4U7.mjs} +1 -1
  90. package/lib/chunk-L4RJX7DG.mjs +7 -0
  91. package/lib/{chunk-47UHTN3Q.mjs → chunk-L6CLN664.mjs} +1 -1
  92. package/lib/chunk-LI2XNV7F.mjs +7 -0
  93. package/lib/chunk-LP2D3JJP.mjs +7 -0
  94. package/lib/{chunk-KJYEQHYP.mjs → chunk-LWES2KZE.mjs} +1 -1
  95. package/lib/{chunk-3HEMJTAP.mjs → chunk-LYOGCIYD.mjs} +2 -2
  96. package/lib/{chunk-VPDEJGPS.mjs → chunk-MJD6CPZZ.mjs} +1 -1
  97. package/lib/{chunk-SNEOKYV7.mjs → chunk-MTM4KG3T.mjs} +1 -1
  98. package/lib/{chunk-J24TIGSI.mjs → chunk-N2HYG3BL.mjs} +1 -1
  99. package/lib/chunk-N5UIE4IR.mjs +7 -0
  100. package/lib/{chunk-YMDFF657.mjs → chunk-NDFFIJL5.mjs} +1 -1
  101. package/lib/{chunk-WOOUISSO.mjs → chunk-NFEBX75O.mjs} +1 -1
  102. package/lib/{chunk-ZUBBEP75.mjs → chunk-NNV7IGM7.mjs} +1 -1
  103. package/lib/{chunk-Q3DY7TO2.mjs → chunk-NS6ONPWL.mjs} +1 -1
  104. package/lib/{chunk-IVZJSDJD.mjs → chunk-O7GCCRPW.mjs} +1 -1
  105. package/lib/{chunk-A7JJWOLT.mjs → chunk-OO24ZYYJ.mjs} +1 -1
  106. package/lib/chunk-OOIDCHBQ.mjs +9 -0
  107. package/lib/{chunk-AUS6NFLZ.mjs → chunk-OS5GE52G.mjs} +1 -1
  108. package/lib/chunk-OS6HFJ7L.mjs +7 -0
  109. package/lib/{chunk-V3R45ZWT.mjs → chunk-OTJH6AEA.mjs} +1 -1
  110. package/lib/{chunk-PBE44M2Y.mjs → chunk-OUU47Y7A.mjs} +1 -1
  111. package/lib/{chunk-BN33LVPQ.mjs → chunk-P6WRYJN3.mjs} +1 -1
  112. package/lib/{chunk-JJITOWZK.mjs → chunk-PDRXM5WN.mjs} +1 -1
  113. package/lib/{chunk-RYRMUPMY.mjs → chunk-PGRY365W.mjs} +1 -1
  114. package/lib/chunk-Q4PPI3KG.mjs +7 -0
  115. package/lib/chunk-QFTF2PGS.mjs +21 -0
  116. package/lib/chunk-QKJXIY6L.mjs +7 -0
  117. package/lib/{chunk-PYRZFUVU.mjs → chunk-QLRWU3MB.mjs} +1 -1
  118. package/lib/chunk-QO4MPHZD.mjs +7 -0
  119. package/lib/chunk-QP3JLFIO.mjs +7 -0
  120. package/lib/{chunk-NLB3RGIY.mjs → chunk-QQDZQCO2.mjs} +1 -1
  121. package/lib/{chunk-7CVDVBEE.mjs → chunk-QXB6U3ZP.mjs} +1 -1
  122. package/lib/chunk-R3OM3X4L.mjs +8 -0
  123. package/lib/chunk-R7GKMAT4.mjs +7 -0
  124. package/lib/{chunk-YT22LMF7.mjs → chunk-RVCPQVKM.mjs} +1 -1
  125. package/lib/{chunk-TWV4A5RK.mjs → chunk-RZKJQOOC.mjs} +1 -1
  126. package/lib/chunk-S4PRKKGC.mjs +8 -0
  127. package/lib/{chunk-JH27IKCO.mjs → chunk-SX6QWYCQ.mjs} +1 -1
  128. package/lib/{chunk-UHFLKP26.mjs → chunk-T36DZJPH.mjs} +1 -1
  129. package/lib/{chunk-CZLJZQCS.mjs → chunk-T7DDS4UQ.mjs} +1 -1
  130. package/lib/chunk-TCEXCHXR.mjs +7 -0
  131. package/lib/chunk-TMIESDE5.mjs +7 -0
  132. package/lib/chunk-TQJ5NPRC.mjs +7 -0
  133. package/lib/chunk-TUPZY2QJ.mjs +7 -0
  134. package/lib/{chunk-GBGHJTPC.mjs → chunk-U2CTKIPE.mjs} +1 -1
  135. package/lib/{chunk-3HROD5RE.mjs → chunk-U4YFYSF3.mjs} +1 -1
  136. package/lib/{chunk-Q6SXNKV2.mjs → chunk-UIR77ZJD.mjs} +1 -1
  137. package/lib/{chunk-FA4ZKDCU.mjs → chunk-UOHZW2L4.mjs} +1 -1
  138. package/lib/{chunk-7PY3VQP3.mjs → chunk-VXZ5PTOM.mjs} +1 -1
  139. package/lib/{chunk-7LKI7OAS.mjs → chunk-VZLJZEV2.mjs} +1 -1
  140. package/lib/{chunk-YH4DYI6D.mjs → chunk-W3BQGMTR.mjs} +1 -1
  141. package/lib/{chunk-CELEBWEZ.mjs → chunk-WABXKL4N.mjs} +1 -1
  142. package/lib/{chunk-EEFUE2ES.mjs → chunk-WAYQLQAD.mjs} +1 -1
  143. package/lib/{chunk-RCYEBY42.mjs → chunk-WBELLGNE.mjs} +1 -1
  144. package/lib/{chunk-SFGZFB4F.mjs → chunk-WJAZ5LHL.mjs} +1 -1
  145. package/lib/{chunk-JQZTMFO7.mjs → chunk-WXU6ZJIV.mjs} +1 -1
  146. package/lib/{chunk-GJ6SZVHT.mjs → chunk-WZN36ACK.mjs} +1 -1
  147. package/lib/{chunk-XU25YA46.mjs → chunk-X2XZQ434.mjs} +1 -1
  148. package/lib/{chunk-QAPVKPEC.mjs → chunk-X4HZD5U2.mjs} +1 -1
  149. package/lib/chunk-X6XNTOGO.mjs +7 -0
  150. package/lib/{chunk-XK5W7BVE.mjs → chunk-XAMMIPZ4.mjs} +1 -1
  151. package/lib/{chunk-DT3T7FRD.mjs → chunk-XAUQXYPW.mjs} +1 -1
  152. package/lib/{chunk-C3LNYAVJ.mjs → chunk-XCJUNX63.mjs} +1 -1
  153. package/lib/chunk-XJICAOAQ.mjs +7 -0
  154. package/lib/{chunk-CBL42DUU.mjs → chunk-XKFHTBAB.mjs} +1 -1
  155. package/lib/{chunk-O2PUGRNW.mjs → chunk-XMQ5R6TC.mjs} +1 -1
  156. package/lib/chunk-XPXEQKLR.mjs +7 -0
  157. package/lib/{chunk-6KP6WETK.mjs → chunk-Y7YUNRKK.mjs} +1 -1
  158. package/lib/{chunk-WSUKC2U3.mjs → chunk-YBZIDW6W.mjs} +1 -1
  159. package/lib/{chunk-RTWYLOCA.mjs → chunk-YEVB7LVK.mjs} +1 -1
  160. package/lib/{chunk-L4INJ5TZ.mjs → chunk-Z3MGN42K.mjs} +1 -1
  161. package/lib/{chunk-EOFO3PHS.mjs → chunk-ZB5E7NHU.mjs} +1 -1
  162. package/lib/chunk-ZCOSME6P.mjs +7 -0
  163. package/lib/{chunk-HFUDCNU5.mjs → chunk-ZOSESZ22.mjs} +1 -1
  164. package/lib/chunk-ZTHC42X6.mjs +7 -0
  165. package/lib/{chunk-XZISAZA6.mjs → chunk-ZXOUWHYE.mjs} +1 -1
  166. package/lib/sandforge-autopilot.mjs +1 -1
  167. package/lib/sandforge-backup.mjs +1 -1
  168. package/lib/sandforge-checkpoint.mjs +1 -1
  169. package/lib/sandforge-cleanup.mjs +1 -1
  170. package/lib/sandforge-clone.mjs +1 -1
  171. package/lib/sandforge-compare.mjs +1 -1
  172. package/lib/sandforge-dataops.mjs +1 -1
  173. package/lib/sandforge-empty.mjs +4 -4
  174. package/lib/sandforge-env.mjs +98 -99
  175. package/lib/sandforge-frozen.mjs +1 -1
  176. package/lib/sandforge-mcp.mjs +2 -2
  177. package/lib/sandforge-monitor.mjs +1 -1
  178. package/lib/sandforge-pipeline.mjs +1 -1
  179. package/lib/sandforge-seed.mjs +1 -1
  180. package/lib/sandforge-sync.mjs +1 -1
  181. package/lib/sandforge-users.mjs +21 -23
  182. package/oclif.manifest.json +1 -1
  183. package/package.json +1 -1
  184. package/lib/chunk-42BFLWHR.mjs +0 -7
  185. package/lib/chunk-466F37VD.mjs +0 -7
  186. package/lib/chunk-7SDZR6SR.mjs +0 -7
  187. package/lib/chunk-BMTNTBBM.mjs +0 -7
  188. package/lib/chunk-CCEH7L53.mjs +0 -7
  189. package/lib/chunk-DIL62SUN.mjs +0 -7
  190. package/lib/chunk-FZF23M6R.mjs +0 -7
  191. package/lib/chunk-GHPR5UVV.mjs +0 -7
  192. package/lib/chunk-HQQVANWQ.mjs +0 -20
  193. package/lib/chunk-IRZJU2PG.mjs +0 -22
  194. package/lib/chunk-ISSP2FZ5.mjs +0 -7
  195. package/lib/chunk-JFNLKHY6.mjs +0 -8
  196. package/lib/chunk-O4BROUGM.mjs +0 -7
  197. package/lib/chunk-PE435FVH.mjs +0 -15
  198. package/lib/chunk-RLWB7F26.mjs +0 -7
  199. package/lib/chunk-WEMLDUQA.mjs +0 -7
  200. package/lib/chunk-ZQO5PDX5.mjs +0 -48
@@ -4,7 +4,7 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{C as ts,r as Jo}from"./chunk-O2PUGRNW.mjs";import{A as hn,B as wn,H as ce,I as No,J as St,R as Eo,e as yt,m as So,v as Ao,w as ko,x as Io}from"./chunk-7SDZR6SR.mjs";import{e as ps,h as ms}from"./chunk-TEIBWMJM.mjs";import{a as Fo,b as Po}from"./chunk-T63U4OZJ.mjs";import{a as et,d as Xo,i as es,o as Ne}from"./chunk-YAIIRFKJ.mjs";import{a as vo}from"./chunk-YYZL7UGV.mjs";import{a as ho,l as Ro}from"./chunk-54HYHHVL.mjs";import{d as To}from"./chunk-QIRO4HTE.mjs";import{b as jo}from"./chunk-QSRAEUGZ.mjs";import{d as gs}from"./chunk-JH27IKCO.mjs";import{t as Oe}from"./chunk-SAMWHL22.mjs";import{a as Mo,c as Lo,d as At,e as je,f as _o,g as Do,h as kt,i as Bo,j as $o,k as Wo,l as qo,m as zo,n as Uo,o as se,p as ie,q as It,r as we,s as Vo}from"./chunk-4JKR4PTZ.mjs";import{d as yn,z as Go}from"./chunk-J24TIGSI.mjs";import{a as mo,b as Me,c as go,d as X,h as pe}from"./chunk-VPDEJGPS.mjs";import{a as po}from"./chunk-5LFSFYFJ.mjs";import{Db as is,Eb as as,J as Zo,K as Sn,L as Qo,Pa as Ee,Qa as ns,Ra as ye,ab as Te,db as rs,eb as os,f as to,oc as ds,pc as cs,uc as ls,vc as us,wc as fs,xc as me,zb as ss}from"./chunk-JFNLKHY6.mjs";import{b as Ot}from"./chunk-VV3B6IC3.mjs";import{f as Et}from"./chunk-7PY3VQP3.mjs";import{a as no,b as ro,c as fn,e as oo,f as so,g as io,i as pn,j as ao}from"./chunk-INIT2UKJ.mjs";import{a as bo,c as gn,j as Oo}from"./chunk-HFUDCNU5.mjs";import{f as uo,g as fo}from"./chunk-XZISAZA6.mjs";import{a as q,b as le,c as jt,d as bn,e as Ho,f as Nt,g as Ko,h as Rn,i as Yo}from"./chunk-TQ2TQHTT.mjs";import{g as lo}from"./chunk-OHEOJISY.mjs";import{a as Co,b as xo}from"./chunk-PC247GKX.mjs";import{c as co}from"./chunk-EADHKH3A.mjs";import{b as Xr,r as eo}from"./chunk-L4INJ5TZ.mjs";import{A as Wr,B as ln,C as qr,F as zr,G as un,J as Ur,K as Vr,O as Gr,R as Jr,S as Hr,T as Kr,U as Yr,V as Zr,W as Qr,e as cn,q as de,r as oe,s as xe,x as Br,y as $r}from"./chunk-KIMQQ6JQ.mjs";import{a as Ce,h as J}from"./chunk-TZE3Y7IQ.mjs";import{a as wt,b as H}from"./chunk-CA5NAXSU.mjs";import{a as bt,c as mn,f as wo,i as Rt,k as yo}from"./chunk-ZUTUYBNW.mjs";import{Aa as Tr,Ba as Fr,Ca as Pr,Cc as ht,O as Ze,T as sn,Uc as Se,Ya as vr,_ as an,fc as Cr,hd as Lr,lc as xr,mc as Mr,nc as Qe,oc as pt,rc as Xe,sc as dn,tc as mt,td as _r,ua as Re,ud as Dr,va as Er,yc as ve,zc as gt}from"./chunk-ZQO5PDX5.mjs";import{b as W,e as te,f as Ke,i as Ie,k as Z,l as V,m as rn,r as Nr,s as on,u as Pe,v as Ye}from"./chunk-WZQEK4WT.mjs";var Le=.5;function xu(n){return`Salesforce can take several minutes to count a load in what ${n} says it has left: a run started sooner after another may read room it no longer has`}function ws(n){if("unread"in n.storage)return n.withinMB===void 0?{unread:n.storage.unread}:hs(n,Math.floor(Math.max(0,n.withinMB)*1048576),{share:Ee,roundingMB:Le,withinMB:n.withinMB,limitedBy:"within"});let{remainingMB:e,maxMB:t}=n.storage,r=Ee*Math.max(0,e-Le)*1048576,o=n.withinMB!==void 0?Math.max(0,n.withinMB)*1048576:1/0,s=o<r?"within":"storage",i={remainingMB:e,maxMB:t,share:Ee,roundingMB:Le,...n.withinMB!==void 0?{withinMB:n.withinMB}:{},limitedBy:s},a=Math.floor(Math.min(r,o));return hs(n,a,i)}function ys(n,e){return e.bytesLimit==="within"&&e.storageBytes!==void 0&&n>e.storageBytes?"storage":e.bytesLimit}function hs(n,e,t){if(!n.api)return{bytes:e,terms:t};if("unread"in n.api)return{bytes:e,terms:t,requestsUnread:n.api.unread};let r=Object.values(n.otherRequests??{}).reduce((s,i)=>s+Math.max(0,i??0),0),o=Math.max(0,Math.floor(n.api.remaining-Te*n.api.max-r));return{bytes:e,terms:t,runRequests:o}}var wa=/__e$/i,ya=/Share$/;function Mu(n,e){let t=new Map,r=new Map,o=(i,a)=>{let d=`${i}
7
+ import{C as ts,r as Jo}from"./chunk-XMQ5R6TC.mjs";import{A as wn,G as ce,H as No,I as St,Q as Eo,e as yt,l as So,u as Ao,v as ko,w as Io,z as hn}from"./chunk-IXIY6Q4M.mjs";import{e as ps,h as ms}from"./chunk-TEIBWMJM.mjs";import{a as Fo,b as Po}from"./chunk-T63U4OZJ.mjs";import{a as et,d as Xo,i as es,o as Ne}from"./chunk-HQZUQXDC.mjs";import{a as vo}from"./chunk-YYZL7UGV.mjs";import{a as ho,l as Ro}from"./chunk-54HYHHVL.mjs";import{d as To}from"./chunk-QIRO4HTE.mjs";import{b as jo}from"./chunk-QSRAEUGZ.mjs";import{d as gs}from"./chunk-SX6QWYCQ.mjs";import{t as Oe}from"./chunk-EOQON3E5.mjs";import{a as Mo,c as Lo,d as At,e as je,f as _o,g as Do,h as kt,i as Bo,j as $o,k as Wo,l as qo,m as zo,n as Uo,o as se,p as ie,q as It,r as we,s as Vo}from"./chunk-4JKR4PTZ.mjs";import{d as yn,z as Go}from"./chunk-N2HYG3BL.mjs";import{a as mo,b as Me,c as go,d as X,h as pe}from"./chunk-MJD6CPZZ.mjs";import{a as po}from"./chunk-5LFSFYFJ.mjs";import{D as Zo,E as Sn,F as Qo,Ja as Ee,Ka as ns,La as ye,Wa as Te,Za as rs,_a as os,ic as ds,jc as cs,oc as ls,pc as us,qc as fs,rc as me,tb as ss,xb as is,yb as as}from"./chunk-R3OM3X4L.mjs";import{f as to}from"./chunk-77IVKH7R.mjs";import{b as Ot}from"./chunk-VV3B6IC3.mjs";import{f as Et}from"./chunk-VXZ5PTOM.mjs";import{a as no,b as ro,c as fn,e as oo,f as so,g as io,i as pn,j as ao}from"./chunk-INIT2UKJ.mjs";import{a as bo,c as gn,j as Oo}from"./chunk-ZOSESZ22.mjs";import{f as uo,g as fo}from"./chunk-ZXOUWHYE.mjs";import{a as q,b as le,c as jt,d as bn,e as Ho,f as Nt,g as Ko,h as Rn,i as Yo}from"./chunk-TQ2TQHTT.mjs";import{g as lo}from"./chunk-OHEOJISY.mjs";import{a as Co,b as xo}from"./chunk-PC247GKX.mjs";import{c as co}from"./chunk-EADHKH3A.mjs";import{b as Xr,r as eo}from"./chunk-Z3MGN42K.mjs";import{A as Wr,B as ln,C as qr,F as zr,G as un,J as Ur,K as Vr,O as Gr,R as Jr,S as Hr,T as Kr,U as Yr,V as Zr,W as Qr,e as cn,q as de,r as oe,s as xe,x as Br,y as $r}from"./chunk-2GSMHGIV.mjs";import{a as Ce,h as J}from"./chunk-TZE3Y7IQ.mjs";import{a as wt,b as H}from"./chunk-CA5NAXSU.mjs";import{a as bt,c as mn,f as wo,i as Rt,k as yo}from"./chunk-ISOSTAJR.mjs";import{Aa as Tr,Ac as Qe,Ba as Fr,Bc as pt,Ca as Pr,Ec as Xe,Fc as dn,Gc as mt,Gd as _r,Hd as Dr,Lc as ve,Mc as gt,O as Ze,Pc as ht,T as sn,Ya as vr,_ as an,fd as Se,sc as Cr,ua as Re,ud as Lr,va as Er,yc as xr,zc as Mr}from"./chunk-6QSHWIZI.mjs";import{b as W,e as te,f as Ke,i as Ie,k as Z,l as V,m as rn,r as Nr,s as on,u as Pe,v as Ye}from"./chunk-WZQEK4WT.mjs";var Le=.5;function xu(n){return`Salesforce can take several minutes to count a load in what ${n} says it has left: a run started sooner after another may read room it no longer has`}function ws(n){if("unread"in n.storage)return n.withinMB===void 0?{unread:n.storage.unread}:hs(n,Math.floor(Math.max(0,n.withinMB)*1048576),{share:Ee,roundingMB:Le,withinMB:n.withinMB,limitedBy:"within"});let{remainingMB:e,maxMB:t}=n.storage,r=Ee*Math.max(0,e-Le)*1048576,o=n.withinMB!==void 0?Math.max(0,n.withinMB)*1048576:1/0,s=o<r?"within":"storage",i={remainingMB:e,maxMB:t,share:Ee,roundingMB:Le,...n.withinMB!==void 0?{withinMB:n.withinMB}:{},limitedBy:s},a=Math.floor(Math.min(r,o));return hs(n,a,i)}function ys(n,e){return e.bytesLimit==="within"&&e.storageBytes!==void 0&&n>e.storageBytes?"storage":e.bytesLimit}function hs(n,e,t){if(!n.api)return{bytes:e,terms:t};if("unread"in n.api)return{bytes:e,terms:t,requestsUnread:n.api.unread};let r=Object.values(n.otherRequests??{}).reduce((s,i)=>s+Math.max(0,i??0),0),o=Math.max(0,Math.floor(n.api.remaining-Te*n.api.max-r));return{bytes:e,terms:t,runRequests:o}}var wa=/__e$/i,ya=/Share$/;function Mu(n,e){let t=new Map,r=new Map,o=(i,a)=>{let d=`${i}
8
8
  ${a}`,c=t.get(d);return c||(c={objectApiName:i,act:a,bytes:0,creates:[]},t.set(d,c)),c},s=i=>{r.set(`${i.objectApiName}
9
9
  ${i.kind}
10
10
  ${i.name}`,i)};for(let i of n.firing){let a=i.write;if(!(a!=="insert"&&a!=="update")&&e(i.objectApiName,a)){if(i.kind==="trigger"||!i.flow){s({objectApiName:i.objectApiName,kind:"trigger",name:i.name});continue}if(i.flow.condition!=="read"){s({objectApiName:i.objectApiName,kind:"notRead",name:i.name});continue}for(let d of i.flow.creates??[]){if(wa.test(d))continue;if(ya.test(d)){s({objectApiName:i.objectApiName,kind:"share",name:d});continue}let c=o(i.objectApiName,a);c.bytes+=ye(d,{rows:1}),c.creates.push({objectApiName:d,by:i.name})}}}return{perRecord:[...t.values()].filter(i=>i.bytes>0),notCounted:[...r.values()]}}function Lu(n,e){return n.perRecord.reduce((t,r)=>t+r.bytes*Math.max(0,e(r.objectApiName,r.act)),0)}function _u(n,e,t){return{budgetMB:Math.max(0,n.bytes-e)/1048576,...n.terms,automationMB:e/1048576,...t.notCounted.length>0?{notCounted:t.notCounted.map(r=>({...r}))}:{}}}function bs(n,e){if(!e(1))return 0;if(e(n))return n;let t=1,r=n;for(;r-t>1;){let o=Math.floor((t+r)/2);e(o)?t=o:r=o}return t}function Du(n,e){let t=Math.max(0,Math.floor(n)),r=Math.min(t,Math.max(0,Math.floor(e))),o=[];if(r===0)return o;for(let s=0;s<t;s++)Math.floor((s+1)*r/t)>Math.floor(s*r/t)&&o.push(s);return o}import{existsSync as ba,readFileSync as Ra,writeFileSync as Sa}from"node:fs";function qu(n){let e={getData:()=>ba(n)?JSON.parse(Ra(n,"utf8")):{},setData:r=>Sa(n,JSON.stringify(r,null,2),{encoding:"utf8",mode:384})},t=new ts(e);return t.initialize(),t}var On="User",Oa="005",Ss=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/;function Aa(n,e,t=Xr){let r=n.referenceTo??[];return n.name==="RecordTypeId"||r.length===0?!1:r.every(o=>t(o))?!0:r.length===1&&e?.(r[0])===!0}var Rs=1e5;async function Ju(n){let{known:e,ownerMappings:t={},mapped:r,refused:o,inactive:s}=n,i=n.lookups.filter(m=>Aa(m,n.outsideTheRun,n.neverCopied)),a=new Map,d=new Set;for(let m of i)for(let h of n.rows){let w=h[m.name];if(typeof w!="string"||!Ss.test(w)||m.name==="OwnerId"&&t[w]!==void 0||r?.(w)===!0||(d.add(w),e.has(w)))continue;let y=m.referenceTo??[];if(!y.some(R=>o?.has(R)===!0))for(let R of y)a.set(R,(a.get(R)??new Set).add(w))}let c=new Set,f=new Set,u=new Set;for(let[m,h]of a){let w=s!==void 0&&m===On,y=w?"Id, IsActive":"Id";for(let R of X([...h]))try{let O=await n.query(`SELECT ${y} FROM ${J(m)} WHERE Id IN (${R})`);for(let g of O){let b=g.Id;typeof b=="string"&&(c.add(b),c.add(b.slice(0,15)),w&&g.IsActive===!1&&(u.add(b),u.add(b.slice(0,15))))}}catch{for(let O of h)f.add(O);o?.add(m);break}}let p=new Map;for(let m of a.values())for(let h of m)c.has(h)||c.has(h.slice(0,15))?p.set(h,!0):!f.has(h)&&!p.has(h)&&p.set(h,!1);for(let[m,h]of p){if(e.size>=Rs)break;e.set(m,h)}if(s&&u.size>0){let m=[...a.get(On)??[]].filter(h=>u.has(h)||u.has(h.slice(0,15)));for(let h of[...u,...m]){if(s.size>=Rs)break;s.add(h)}}let l=new Set;for(let m of d)(p.get(m)??e.get(m))===!1&&l.add(m);return l}function Hu(n,e,t={}){let r=new Set;if(e.size===0)return r;for(let o of n){let s=o.OwnerId;typeof s!="string"||!s||t[s]===void 0&&e.has(s)&&r.add(s)}return r}var ka="SELECT PermissionsUpdateWithInactiveOwner FROM UserPermissionAccess";async function Ia(n){try{let[e]=await n(ka);return e?.PermissionsUpdateWithInactiveOwner===!0}catch{return!1}}function Ku(n){let e;return()=>(e??=Ia(n),e)}async function Os(n,e){let t=new Map;for(let[i,a]of Object.entries(n)){if(!Ss.test(a))continue;let d=a.slice(0,15),c=t.get(d)??{user:a,sources:[]};c.sources.push(i),t.set(d,c)}let r=[],o=[],s=[...t.values()];for(let i=0;i<s.length;i+=Me){let a=s.slice(i,i+Me),[d]=X(a.map(({user:u})=>u)),c;try{c=await e(`SELECT Id, Name, IsActive FROM ${On} WHERE Id IN (${d})`)}catch{continue}let f=new Set;for(let u of c){let p=u.Id;if(typeof p!="string"||(f.add(p.slice(0,15)),u.IsActive!==!1))continue;let l=t.get(p.slice(0,15));if(!l)continue;let m=u.Name;r.push({user:l.user,...typeof m=="string"&&m!==""?{name:m}:{},sources:l.sources})}for(let{user:u,sources:p}of a)u.startsWith(Oa)&&!f.has(u.slice(0,15))&&o.push({user:u,sources:p})}return{inactive:r,unknown:o}}var Tt=10,An="Nothing was read or written.",Xu="Nothing was written.";function As(n,e=An){let t=n.slice(0,Tt).map(({user:o,name:s,sources:i})=>`${s!==void 0?`${s} (${o})`:o}, given the records of `+i.join(", ")).join("; "),r=n.length-Tt;return`Owners given to users the target holds inactive: ${t}${r>0?`; and ${r} more`:""}. The target refuses a record owned by an inactive user, and the run will not give it to the user it writes as instead of the one chosen. Give those records to an active user under Owners (Review \u2192 Controls, or --owner-map on the command line), or reactivate the user in the target. `+e}function ja(n,e=An){let t=n.slice(0,Tt).map(({user:o,sources:s})=>`${o}, given the records of ${s.join(", ")}`).join("; "),r=n.length-Tt;return`Owners given to users the target does not hold: ${t}${r>0?`; and ${r} more`:""}. The target refuses a record owned by a user it does not hold (INVALID_CROSS_REFERENCE_KEY), and the run will not give it to the user it writes as instead of the one chosen. Give those records to a user of the target under Owners (Review \u2192 Controls, or --owner-map on the command line). `+e}async function ef(n,e,t=An){let{inactive:r,unknown:o}=await Os(n,e);if(o.length>0){let s=ja(o,t);return new me(fs,r.length>0?`${s.slice(0,-t.length)}${As(r,t)}`:s)}return r.length>0?new me(us,As(r,t)):void 0}import{createHash as Na}from"node:crypto";var js={ContentVersion:"VersionData",Attachment:"Body"},Ea=3,ks=class extends Error{constructor(t,r,o){super(t);this.code=r;this.storage=o;this.name="ForgeFilesRefusedError"}code;storage};function Y(n,e){let t=n[e];return typeof t=="string"&&t!==""?t:void 0}function Is(n,e){let t=n[e];return typeof t=="number"&&Number.isFinite(t)?t:0}function kn(n,e,t){return{objectApiName:n,stage:"query",failedCount:0,attemptedCount:0,samples:[{recordSummary:e,messages:[H(t)]}]}}async function cf(n){let{scope:e,sourceOrgId:t,maxFileBytes:r,queryRecords:o}=n,s=new Map;for(let u of e.values())for(let p of u)s.has(p)||s.set(p,s.size);let i={files:[],leftOut:[],errors:[]},a=[...s.keys()];if(a.length===0)return i;let d=u=>s.get(u)??Number.MAX_SAFE_INTEGER,c=new Map;try{for(let u of X(a)){let p=await o(t,`SELECT ContentDocumentId, LinkedEntityId, ShareType, Visibility FROM ContentDocumentLink WHERE LinkedEntityId IN (${u})`);for(let l of p){let m=Y(l,"ContentDocumentId"),h=Y(l,"LinkedEntityId");if(!m||!h||!s.has(h))continue;let w=c.get(m)??[];w.some(y=>y.id===h)||w.push({id:h,shareType:Y(l,"ShareType"),visibility:Y(l,"Visibility")}),c.set(m,w)}}}catch(u){i.errors.push(kn("ContentDocument","(links of the records in scope)",u))}let f=[];try{for(let u of X([...c.keys()])){let p=await o(t,`SELECT Id, ContentDocumentId, Title, PathOnClient, ContentSize, ContentLocation, SharingPrivacy FROM ContentVersion WHERE ContentDocumentId IN (${u}) AND IsLatest = true`);for(let l of p){let m=Y(l,"ContentDocumentId"),h=Y(l,"Id"),w=m?c.get(m):void 0;if(!m||!h||!w)continue;let y=Y(l,"Title")??m;f.push({external:(Y(l,"ContentLocation")??"S")!=="S",file:{objectApiName:"ContentDocument",sourceId:m,body:{objectApiName:"ContentVersion",id:h},name:y,bytes:Is(l,"ContentSize"),hosts:[...w].sort((R,O)=>d(R.id)-d(O.id)),fields:{Title:y,PathOnClient:Y(l,"PathOnClient")??y,...Y(l,"SharingPrivacy")==="P"?{SharingPrivacy:"P"}:{}}}})}}}catch(u){i.errors.push(kn("ContentDocument","(latest versions of the files)",u))}try{for(let u of X(a)){let p=await o(t,`SELECT Id, ParentId, Name, ContentType, BodyLength, IsPrivate FROM Attachment WHERE ParentId IN (${u})`);for(let l of p){let m=Y(l,"Id"),h=Y(l,"ParentId");if(!m||!h||!s.has(h))continue;let w=Y(l,"Name")??m;f.push({external:!1,file:{objectApiName:"Attachment",sourceId:m,body:{objectApiName:"Attachment",id:m},name:w,bytes:Is(l,"BodyLength"),hosts:[{id:h}],fields:{Name:w,...Y(l,"ContentType")?{ContentType:Y(l,"ContentType")}:{},IsPrivate:l.IsPrivate===!0}}})}}}catch(u){i.errors.push(kn("Attachment","(attachments of the records in scope)",u))}f.sort((u,p)=>d(u.file.hosts[0].id)-d(p.file.hosts[0].id));for(let{file:u,external:p}of f){let l=p?"external":u.bytes>r?"too-large":void 0;l?i.leftOut.push({objectApiName:u.objectApiName,sourceId:u.sourceId,name:u.name,bytes:u.bytes,reason:l}):i.files.push(u)}return i}function lf(n){return n.errors.length===0?null:`The files of the records to clone could not all be looked up in the source (${[...new Set(n.errors.flatMap(t=>t.samples.flatMap(r=>r.messages)))].join("; ")}). Run it again, or leave the files out.`}async function uf(n){let{files:e,targetOrgId:t,copiedBefore:r,queryRecords:o}=n,s={files:[],errors:[]},i=new Map;for(let l of e){let m=r(l.sourceId);m&&i.set(l.sourceId,m)}if(i.size===0)return{...s,files:[...e]};let a=new Map,d,c=new Map;for(let[l,m]of i)m.objectApiName==="ContentVersion"&&c.set(m.targetId,l),m.objectApiName==="ContentDocument"&&a.set(l,m.targetId);try{for(let l of X([...c.keys()])){let m=await o(t,`SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id IN (${l})`);for(let h of m){let w=Y(h,"Id"),y=Y(h,"ContentDocumentId"),R=w?c.get(w):void 0;R&&y&&a.set(R,y)}}}catch(l){d=H(l)}let f=new Map,u;try{for(let l of X([...new Set(a.values())])){let m=await o(t,`SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN (${l})`);for(let h of m){let w=Y(h,"ContentDocumentId"),y=Y(h,"LinkedEntityId");w&&y&&f.set(w,[...f.get(w)??[],y])}}}catch(l){u=H(l)}let p=(l,m)=>{s.errors.push({objectApiName:"ContentDocument",stage:"query",failedCount:0,attemptedCount:0,samples:[{recordSummary:`${l.name} (${Se(l.bytes)})`,messages:[m]}]})};for(let l of e){let m=i.get(l.sourceId);if(!m){s.files.push(l);continue}if(l.body.objectApiName==="Attachment")continue;let h=a.get(l.sourceId);if(!h){p(l,`Copied as ContentVersion ${m.targetId} by the run this one takes up, and its document still cannot be read back`+(d?` (${d})`:"")+": the file is not copied again, nor linked to the records it lacks.");continue}if(u){p(l,`Copied by the run this one takes up; its links could not be read (${u}): it is not linked to the records it lacks.`);continue}s.files.push({...l,into:{documentId:h,linked:f.get(h)??[],unchanged:!0}})}return s}function ff(n){return{objectApiName:"__files__",stage:"scope",failedCount:0,attemptedCount:0,samples:[{recordSummary:"(files)",messages:[n]}]}}function pf(n){return n.reduce((e,t)=>e+t.bytes,0)}function mf(n,e){return n<=e?null:`The files to copy take ${Se(n)} and the target has ${Se(Math.max(0,e))} of file storage left. Lower the largest file copied, or leave the files out.`}async function gf(n,e){let t=await n.remainingFileStorageMB(e);if(!Number.isFinite(t))throw new Error("The target did not say how much file storage it has left.");return t*1048576}function hf(n,e,t){let r=[];for(let o of n.files){let s=r.find(i=>i.objectApiName===o.objectApiName);s||(s={objectApiName:o.objectApiName,planned:0,plannedBytes:0,copied:0,failed:0},r.push(s)),s.planned++,s.plannedBytes+=o.bytes}return{maxFileBytes:e,objects:r,links:0,leftOut:[...n.leftOut],...t===void 0?{}:{remainingStorageBytes:t}}}function In(n,e){let t=n==="Attachment"?"attachment":"file";return e===1?t:`${t}s`}function wf(n){return`[dry-run] ${n.objectApiName}: ${n.planned} ${In(n.objectApiName,n.planned)} would be copied (${Se(n.plannedBytes)})`}function Ta(n,e,t){return n.body.objectApiName==="Attachment"?{Name:n.fields.Name??n.name,BodyLength:n.bytes,ParentId:t}:{Title:n.fields.Title??n.name,Checksum:Na("md5").update(Buffer.from(e,"base64")).digest("hex"),ContentSize:n.bytes}}function Fa(n){let e={};for(let[t,r]of Object.entries(n))t!=="SharingPrivacy"&&(e[t]=r);return e}async function yf(n){let{files:e,sourceOrgId:t,targetOrgId:r,remapper:o,deps:s,report:i,errors:a,onProgress:d,onCopied:c}=n,f=0,u=g=>{let b=i.objects.find(A=>A.objectApiName===g);return b||(b={objectApiName:g,planned:0,plannedBytes:0,copied:0,failed:0},i.objects.push(b)),b},p=(g,b)=>a.find(A=>A.objectApiName===g&&A.stage===b),l=new Map,m=(g,b,A=1)=>{let N=`${g}/${b}`;l.set(N,(l.get(N)??0)+A);let x=p(g,b);x&&(x.attemptedCount+=A)},h=(g,b,A,N,x=!1)=>{let v=p(g,b);v||(v={objectApiName:g,stage:b,failedCount:0,attemptedCount:l.get(`${g}/${b}`)??0,samples:[]},a.push(v)),x||(v.failedCount++,f++),v.samples.length<Ea&&v.samples.push({recordSummary:A,messages:[N]})},w=(g,b,A)=>{h(g.objectApiName,b,`${g.name} (${Se(g.bytes)})`,A),u(g.objectApiName).failed++},y=async(g,b,A)=>{let N=A.flatMap(v=>{let P=o.get(v.id);return P?[{ContentDocumentId:b,LinkedEntityId:P,ShareType:v.shareType??"V",Visibility:v.visibility??"AllUsers"}]:[]});if(N.length===0)return[];let x=[];m("ContentDocumentLink","insert",N.length);try{let v=await s.insertRecords(r,"ContentDocumentLink",N);N.forEach((P,k)=>{let j=v[k];if(j?.success){i.links++,x.push(P.LinkedEntityId);return}h("ContentDocumentLink","insert",g.name,j?.errors.join("; ")||"The target gave no reason.")})}catch(v){for(let P=0;P<N.length;P++)h("ContentDocumentLink","insert",g.name,H(v))}return x},R=e.filter(g=>!(g.body.objectApiName==="ContentVersion"&&g.into?.unchanged)).length,O=0;for(let g of e){await n.waitIfPaused();let b=g.hosts.filter(I=>o.isCreated(I.id)),A=g.body.objectApiName==="ContentVersion"?g.into:void 0,N=A?b.filter(I=>{let C=o.get(I.id);return C!==void 0&&!A.linked.includes(C)}):[];if(A?.unchanged){let I=await y(g,A.documentId,N);I.length>0&&c?.(g,{targetId:A.documentId,linked:I,asVersion:!1});continue}let x=O++,v=b.length>0?o.get(b[0].id):void 0;if(!v&&!A){i.leftOut.push({objectApiName:g.objectApiName,sourceId:g.sourceId,name:g.name,bytes:g.bytes,reason:"record-not-created"});continue}d({objectName:g.objectApiName,status:"running",progress:Math.round(x/R*100),message:`Copying ${In(g.objectApiName,1)} ${x+1} of ${R} (${Se(g.bytes)})`});let P;m(g.objectApiName,"query");try{P=await s.readFileBody(t,g.body.objectApiName,g.body.id)}catch(I){w(g,"query",H(I));continue}let k=Buffer.byteLength(P,"base64");if(k!==g.bytes){w(g,"query",`Read ${k} bytes of the ${g.bytes} the source reports: the file was not written.`);continue}let j=A?{...Fa(g.fields),VersionData:P,ContentDocumentId:A.documentId}:g.body.objectApiName==="ContentVersion"?{...g.fields,VersionData:P,FirstPublishLocationId:v}:{...g.fields,Body:P,ParentId:v},M;m(g.objectApiName,"insert");let D=n.calls?.sending(g.body.objectApiName,[{sourceId:g.sourceId,payload:Ta(g,P,v)}]),E=()=>{D!==void 0&&n.calls?.answered(D)};try{M=await s.insertFile(r,g.body.objectApiName,j)}catch(I){vo(I)!=="may-have-written"&&E(),w(g,"insert",H(I));continue}if(!M.success||!M.id){E(),w(g,"insert",M.errors.join("; ")||"The target gave no reason.");continue}if(u(g.objectApiName).copied++,g.body.objectApiName==="Attachment"){o.add(g.sourceId,M.id,"Attachment"),E(),o.persist?.(),c?.(g,{targetId:M.id,linked:v?[v]:[],asVersion:!1});continue}if(A){o.add(g.sourceId,A.documentId,"ContentDocument"),E(),o.persist?.();let I=await y(g,A.documentId,N);c?.(g,{targetId:A.documentId,linked:I,asVersion:!0});continue}o.add(g.sourceId,M.id,"ContentVersion"),E(),o.persist?.();let F;try{let I=await s.queryRecords(r,`SELECT ContentDocumentId FROM ContentVersion WHERE Id = '${Ce(M.id)}'`);F=I[0]?Y(I[0],"ContentDocumentId"):void 0}catch{F=void 0}if(!F){h("ContentDocument","query",`${g.name} (${Se(g.bytes)})`,`Copied as ContentVersion ${M.id}, but its document could not be read back: the run keeps the version, which a removal of the run takes with its document, and links it to no other record.`,!0);continue}o.add(g.sourceId,F,"ContentDocument"),o.persist?.();let S=await y(g,F,b.slice(1));c?.(g,{targetId:F,linked:v?[v,...S]:S,asVersion:!1})}for(let g of i.objects)d({objectName:g.objectApiName,status:g.failed>0&&g.copied===0?"error":"done",progress:100,message:`Copied ${g.copied} ${In(g.objectApiName,g.copied)} of ${g.planned}`+(g.failed>0?`, ${g.failed} failed`:"")});return f}function If(n,e,t={},r){if(!n)return;let o={};for(let s of e.nodes)es(s)&&(o[s.objectApiName]=[...s.anonymizeFields]);return{fields:o,methods:{...t},...r?{personalFieldsOf:r}:{}}}var Pa=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,va=/@example\.com$/i,jn="@example.invalid",Ca=64,xa=new Set(["fake","mask","preserve_format","shuffle"]);function Ma(n,e,t){return typeof n!="string"||n===""?n:Pa.test(n)?e.email(n.replace(va,jn),t):`${n.replace(/[^A-Za-z0-9._-]/g,"_").slice(0,Ca).replace(/^[._]+|[._]+$/g,"")||"anonymized"}${jn}`}var Ns=class{smartAnonymizer;contactPoints;constructor(e,t){this.smartAnonymizer=new To(e),this.contactPoints=new ms(t)}categorizeField(e,t){let r=t.toLowerCase();if(r==="email")return"email";if(r==="phone")return"phone";let o=Po(e,t);if(o)return o;let s=e.toLowerCase();return s.includes("email")?"email":s.includes("phone")||s.includes("fax")||s.includes("mobile")?"phone":s.includes("firstname")||s.includes("lastname")||s==="name"||Fo(e)?"name":s.includes("street")||s.includes("address")||s.includes("city")||s.includes("state")||s.includes("postalcode")||s.includes("zip")||s.includes("country")?"address":s.includes("ssn")||s.includes("national_id")||s.includes("passport")||s.includes("driver")||s.includes("license")?"ssn_id":s.includes("credit")||s.includes("card")||s.includes("cvv")||s.includes("iban")||s.includes("routing")||s.includes("bank")?"financial":"other"}getDefaultMethod(e){return{email:"fake",phone:"mask",name:"fake",address:"fake",ssn_id:"redact",financial:"hash",other:"nullify"}[e]}getDefaults(){return{email:"fake",phone:"mask",name:"fake",address:"fake",ssn_id:"redact",financial:"hash",other:"nullify"}}anonymize(e){if(e.fields.length===0)return e.records;let t={...this.getDefaults(),...e.methods},r=e.records.map((a,d)=>({...a,Id:e.sourceIds[d]??""})),o=this.anonymizeRecords(r,e.fields,t,e.objectApiName),s=e.fields.filter(a=>this.categorizeField(a.name,a.type)==="email"),i=xa.has(t.phone)?e.fields.filter(a=>this.categorizeField(a.name,a.type)==="phone"):[];return o.map((a,d)=>{let c=e.records[d],f={...a};for(let u of s)f[u.name]=this.undeliverable(f[u.name],u);for(let u of i)f[u.name]=this.fictionalNumber(c[u.name],f[u.name],u);return"Id"in c?f.Id=c.Id:delete f.Id,f})}undeliverable(e,t){let r=t.length!==void 0&&t.length>0?t.length:void 0;return t.type.toLowerCase()==="email"?Ma(e,this.contactPoints,r??ps):typeof e!="string"?e:this.contactPoints.addressesIn(e.replace(/@example\.com(?![\w.-])/gi,jn),r)}fictionalNumber(e,t,r){if(typeof e!="string")return t;if(!/\d/.test(e))return e;let o=r.length!==void 0&&r.length>0?r.length:void 0;return this.contactPoints.phone(e,o)}anonymizeRecords(e,t,r,o){let s=t.map(a=>{let d=this.categorizeField(a.name,a.type);return{objectApiName:o,fieldApiName:a.name,method:r[d],piiCategory:"PII",aiConfidence:1,userOverridden:!1}}),i=e.map(a=>({...a}));return this.smartAnonymizer.anonymize(i,s,o)}};var Es=new WeakMap;function Nf(n,e){typeof n=="object"&&n!==null&&Es.set(n,e)}function Ef(n){return typeof n=="object"&&n!==null?Es.get(n):void 0}var Nn=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,Ts=/^[A-Za-z][A-Za-z0-9_]*$/;function tt(n){if(!n.startsWith('["'))return;let e;try{e=JSON.parse(n)}catch{return}if(!Array.isArray(e))return;let[t,r,o,s]=e;if(!(t!=="c"&&t!=="e"&&t!=="u")&&!(typeof r!="string"||!Nn.test(r))&&!(typeof o!="string"||!Nn.test(o)))return{tag:t,sourceId:r,targetId:o,object:typeof s=="string"&&Ts.test(s)?s:""}}function _e(n){if(!n.startsWith(`["${kt}"`))return;let e;try{e=JSON.parse(n)}catch{return}if(!Array.isArray(e))return;let[,t,r]=e;if(!(typeof t!="string"||!Ts.test(t)||!Array.isArray(r)))return{object:t,ids:r.filter(o=>typeof o=="string"&&Nn.test(o))}}function nt(n){return n.slice(0,15)}var rt=class{offsets=new Float64Array(64);lengths=new Uint16Array(64);size=0;push(e,t){if(this.size===this.offsets.length){let r=new Float64Array(this.size*2);r.set(this.offsets),this.offsets=r;let o=new Uint16Array(this.size*2);o.set(this.lengths),this.lengths=o}this.offsets[this.size]=e,this.lengths[this.size]=t,this.size++}offsetAt(e){return this.offsets[e]}lengthAt(e){return this.lengths[e]}},be=class{capacity=1024;used=0;h1=new Uint32Array(this.capacity);h2=new Uint32Array(this.capacity);taken=new Uint8Array(this.capacity);add(e){let t=se(e),r=ie(e);if(this.slotOf(t,r)>=0)return;this.used+1>this.capacity*.6&&this.grow();let o=this.freeSlotFor(r);this.h1[o]=t,this.h2[o]=r,this.taken[o]=1,this.used++}has(e){return this.slotOf(se(e),ie(e))>=0}get size(){return this.used}slotOf(e,t){let r=this.capacity-1;for(let o=t&r;;o=o+1&r){if(this.taken[o]===0)return-1;if(this.h1[o]===e&&this.h2[o]===t)return o}}freeSlotFor(e){let t=this.capacity-1,r=e&t;for(;this.taken[r]!==0;)r=r+1&t;return r}grow(){let{h1:e,h2:t,taken:r}=this;this.capacity*=2,this.h1=new Uint32Array(this.capacity),this.h2=new Uint32Array(this.capacity),this.taken=new Uint8Array(this.capacity);for(let o=0;o<r.length;o++){if(r[o]===0)continue;let s=this.freeSlotFor(t[o]);this.h1[s]=e[o],this.h2[s]=t[o],this.taken[s]=1}}},La=2e3,ot=class n{constructor(e,t,r,o,s){this.file=e;this.all=t;this.mine=r;this.firstInPart=o;this.unattributed=s}file;all;mine;firstInPart;unattributed;static read(e,t){let r=(f,u)=>tt(e.read(f,u).toString("utf8"))?.sourceId??"",o=new It(r),s=new It(r),i=new rt,a=new rt,d=!1,c=-1;for(let f of we(e)){if(!d){if(!f.text.startsWith('{"run":'))return;d=!0;continue}if(f.text.startsWith('{"part":')){c++;continue}if(f.text.startsWith('{"object":'))return;if(c===t&&_e(f.text)){a.push(f.offset,f.length);continue}let u=tt(f.text);if(!u)continue;let p=se(u.sourceId),l=ie(u.sourceId);if(o.put(o.find(u.sourceId,p,l),p,l,f.offset,f.length,0),c!==t)continue;let m=s.find(u.sourceId,p,l);m<0&&i.push(f.offset,f.length);let h=u.tag==="c"&&u.object!=="";s.put(m,p,l,f.offset,f.length,h?1:0)}return d?new n(e,o,s,i,a):void 0}mappingAt(e,t){return tt(this.file.read(e,t).toString("utf8"))}wordsOn(e){let t=se(e),r=ie(e),o=this.all.find(e,t,r),s=this.mine.find(e,t,r);return{latest:o>=0?{offset:this.all.offsetOf(o),length:this.all.lengthOf(o)}:void 0,createdByThePart:s>=0&&this.mine.codeOf(s)===1,inThePart:s>=0?{offset:this.mine.offsetOf(s),length:this.mine.lengthOf(s)}:void 0}}createdByObject(){let e=new Map;for(let t=0;t<this.firstInPart.size;t++){let r=this.mappingAt(this.firstInPart.offsetAt(t),this.firstInPart.lengthAt(t));if(!r)continue;let o=this.wordsOn(r.sourceId);if(!o.createdByThePart||!o.latest||!o.inThePart)continue;let s=this.mappingAt(o.inThePart.offset,o.inThePart.length);if(!s)continue;let i=e.get(s.object)??new rt;i.push(o.latest.offset,o.latest.length),e.set(s.object,i)}return e}runRecords(e,t=La){let{file:r}=this,o=(h,w)=>tt(r.read(h,w).toString("utf8")),s=(h,w)=>{let y=o(h,w);return y?nt(y.targetId):""},i=new It(s),a=this.createdByObject(),d=[];for(let h of[...a.keys()].reverse()){let w=a.get(h);if(!w)continue;let y=0;for(let R=w.size-1;R>=0;R--){let O=w.offsetAt(R),g=o(O,w.lengthAt(R));if(!g||g.object==="")continue;let b=nt(g.targetId),A=se(b),N=ie(b),x=i.find(b,A,N);x>=0||(i.put(x,A,N,O,w.lengthAt(R),0),(!e||e.has(b))&&y++)}y>0&&d.push({objectApiName:h,count:y})}let c=(h,w)=>{let y=i.find(h,se(h),ie(h),w);return y>=0&&(w===void 0||i.offsetOf(y)===w)&&(!e||e.has(h))},f=h=>_e(r.read(this.unattributed.offsetAt(h),this.unattributed.lengthAt(h)).toString("utf8")),u=new be,p=this.unattributed.size,l=new Map;for(let h=0;h<p;h++){let w=f(h);if(w)for(let y of w.ids){let R=nt(y);u.has(R)||i.find(R,se(R),ie(R))>=0||(u.add(R),(!e||e.has(R))&&l.set(w.object,(l.get(w.object)??0)+1))}}for(let[h,w]of l){let y=d.find(R=>R.objectApiName===h);y?y.count+=w:d.unshift({objectApiName:h,count:w})}let m=h=>u.size>0&&u.has(h)&&(!e||e.has(h));return{objects:d,pages:async function*(h){let w=a.get(h),y=[];if(w)for(let R=w.size-1;R>=0;R--){let O=w.offsetAt(R),g=o(O,w.lengthAt(R));if(!g||g.object==="")continue;let b=nt(g.targetId);c(b,O)&&(y.push(g.targetId),y.length>=t&&(yield y,y=[]))}if(l.has(h)){let R=new be;for(let O=0;O<p;O++){let g=f(O);if(g?.object===h)for(let b of g.ids){let A=nt(b);R.has(A)||!m(A)||i.find(A,se(A),ie(A))>=0||(R.add(A),y.push(b),y.length>=t&&(yield y,y=[]))}}}y.length>0&&(yield y)},has:h=>c(h)||m(h)}}*idMapRows(){let e=new Map;for(let[r,o]of this.createdByObject())for(let s=0;s<o.size;s++){let i=this.mappingAt(o.offsetAt(s),o.lengthAt(s));i&&e.set(i.sourceId.slice(0,3),r)}let t=new Uint8Array(Math.ceil(this.all.slots/8));for(let r of we(this.file)){let o=tt(r.text);if(!o)continue;let s=this.all.find(o.sourceId,se(o.sourceId),ie(o.sourceId));if(s<0||(t[s>>3]&1<<(s&7))!==0)continue;t[s>>3]|=1<<(s&7);let i=this.wordsOn(o.sourceId);if(!i.latest)continue;let a=this.mappingAt(i.latest.offset,i.latest.length);if(!a||a.object==="")continue;yield{objectApiName:(i.createdByThePart&&i.inThePart?this.mappingAt(i.inThePart.offset,i.inThePart.length):void 0)?.object??e.get(a.sourceId.slice(0,3)),sourceId:a.sourceId,targetId:a.targetId,outcome:i.createdByThePart?"created":"linked to existing"}}}};var Ae=/^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/,st=/^[A-Za-z][A-Za-z0-9_]*$/,_a=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/,Da=255,Ba=40,$a=2*6e4,Wa=10*6e4;function $f(n){let[e]=n;return e?Object.keys(e).filter(t=>t!=="Id"&&st.test(t)).filter(t=>n.every(r=>qa(r[t]))).sort().slice(0,Ba):[]}function qa(n){return typeof n=="string"?n.trim()!==""&&n.length<=Da:typeof n=="number"?Number.isFinite(n):typeof n=="boolean"}function za(n){if(typeof n=="boolean")return n?"true":"false";if(typeof n=="number")return Number.isFinite(n)?String(n):"";if(typeof n!="string")return"";let e=n.trim();if(Ae.test(e))return e.slice(0,15);if(_a.test(e)){let r=Date.parse(e);if(Number.isFinite(r))return new Date(r).toISOString()}if(e!==""&&Number.isFinite(Number(e)))return String(Number(e));let t=e.replace(/\s+/g," ").toLowerCase();return t.includes(";")?t.split(";").map(r=>r.trim()).sort().join(";"):t}function Tn(n,e){return Fn(e.map(t=>`${t}${za(n[t])}`).join(""))}function Fn(n){return se(n).toString(36).padStart(7,"0")+ie(n).toString(36).padStart(7,"0")}function Wf(n){let e=bo("insert",n);return e.rows.map(t=>Fn(gn(e.columns.map((r,o)=>[r,t[o]??""]))))}var Ua=/^sf__/;function Fs(n){let e=[];for(let[t,r]of Object.entries(n))Ua.test(t)||e.push([t,typeof r=="string"?r:r==null?"":String(r)]);return Fn(gn(e))}function vs(n,e){return Tn(n,[e])}function Va(n,e){if(!Array.isArray(n))return!1;for(let t of n){if(!Array.isArray(t)||t.length<4)return!1;let[r,o,s,i]=t;if(typeof r!="number"||!Number.isInteger(r)||!e[r]||typeof o!="string"||!st.test(o)||typeof s!="string"||!Ae.test(s))return!1;e[r].owes.push({field:o,sourceRefId:s,...i===1?{insertOnly:!0}:{}})}return!0}function En(n){if(!n.startsWith(`["${At}"`))return;let e;try{e=JSON.parse(n)}catch{return}if(!Array.isArray(e)||e.length<6)return;let[,t,r,o,s,i,a,d]=e;if(typeof t!="string"||typeof r!="string"||!st.test(r)||typeof o!="string")return;let c=Date.parse(o);if(!Number.isFinite(c)||!Array.isArray(s)||!Array.isArray(i)||!s.every(p=>typeof p=="string"&&st.test(p))||d!==void 0&&(typeof d!="string"||!st.test(d)))return;let f=[];for(let p of i){if(!Array.isArray(p)||p.length<2)return;let[l,m,h,w]=p;if(typeof l!="string"||!Ae.test(l)||typeof m!="string"||h!==void 0&&typeof h!="string"||w!==void 0&&typeof w!="string")return;f.push({sourceId:l,fingerprint:m,owes:[],...typeof h=="string"&&h!==""?{externalKey:h}:{},...typeof w=="string"&&w!==""?{jobKey:w}:{}})}let u=a!==void 0;if(!(u&&!Va(a,f)))return{callId:t,objectApiName:r,at:c,fields:s,rows:f,owesKept:u,...typeof d=="string"?{upsertField:d}:{}}}function Cs(n){if(n.startsWith(`["${je}"`))try{let e=JSON.parse(n);return Array.isArray(e)&&typeof e[1]=="string"?e[1]:void 0}catch{return}}function Ga(n){if(n.startsWith(`["${Do}"`))try{let e=JSON.parse(n);return Array.isArray(e)&&typeof e[1]=="string"?e[1]:void 0}catch{return}}function Ja(n){if(n.startsWith(`["${_o}"`))try{let e=JSON.parse(n);if(!Array.isArray(e))return;let[,t,r]=e;return typeof t!="string"||typeof r!="string"||r===""?void 0:{callId:t,jobId:r}}catch{return}}function Ha(n){if(!(!n.startsWith('["c"')&&!n.startsWith('["e"')&&!n.startsWith('["u"')))try{let e=JSON.parse(n);if(!Array.isArray(e))return;let[,t,r,o]=e;return typeof t!="string"||typeof r!="string"||!Ae.test(t)||!Ae.test(r)?void 0:{sourceId:t,targetId:r,object:typeof o=="string"?o:""}}catch{return}}function Ka(n){let e=/"(?:startedAt|at)":"([^"]{10,40})"/.exec(n);return e?Date.parse(e[1]):Number.NaN}function qf(n){return{queryPages:e=>co({query:async t=>n.query(t),queryMore:async t=>n.queryMore(t)},e),userId:async()=>(await n.identity()).user_id,serverTime:async()=>(await n.soap.getServerTimestamp()).timestamp,readJob:e=>Ro(So(n),e)}}function Ya(){return{calls:0,found:[],notFound:[],uncertain:[],unread:[]}}function K(n,e,t=1){if(t<=0)return;let r=n.find(o=>o.objectApiName===e);r?r.rows+=t:n.push({objectApiName:e,rows:t})}function Ps(n){return new Date(n).toISOString().replace(/\.\d{3}Z$/,"Z")}function Pn(n,e,t){return[JSON.stringify(["c",e.sourceId,t,n.objectApiName,n.owesKept?Wo:$o]),...e.owes.map(({field:r,sourceRefId:o,insertOnly:s})=>Uo({objectApiName:n.objectApiName,newId:t,sourceId:e.sourceId,fieldName:r,sourceRefId:o,...s?{insertOnly:s}:{}}))]}function Za(n,e,t,r){let{call:o,rows:s,read:i}=n,{objectApiName:a}=o,d=JSON.stringify([je,o.callId]);if(i.state==="never-closed")return K(r.notFound,a,s.length),{lines:[d],taken:[]};if(i.state==="running")return K(r.uncertain,a,s.length),(r.underway??=[]).push({objectApiName:a,jobId:n.jobId,rows:s.length,...i.info?{state:i.info.state}:{},...i.info?.numberRecordsProcessed!==void 0?{processed:i.info.numberRecordsProcessed}:{},...i.openUntil?{openUntil:i.openUntil}:{},...i.graceLeftMs!==void 0?{graceLeftMs:i.graceLeftMs}:{}}),{lines:[],taken:[]};if(i.state==="unread")return r.unread.push({objectApiName:a,reason:i.reason}),K(r.uncertain,a,s.length),{lines:[],taken:[]};let c=o.upsertField===void 0&&s.every(u=>u.jobKey!==void 0)?Qa(o,s,i.results,e,t,r):Xa(o,s,i.results,e,t,r),f=Date.parse(i.info.systemModstamp??"");return!n.endKept&&c.taken.length>0&&Number.isFinite(f)&&c.lines.unshift(qo(o.callId,n.jobId,new Date(f).toISOString(),new Date(f-n.ahead).toISOString())),c}function Qa(n,e,t,r,o,s){let{objectApiName:i}=n,a=new Map,d=new Set;for(let O of t.successfulResults??[]){let g=O.sf__Id,b=Fs(O);if(typeof g!="string"||!Ae.test(g)){d.add(b);continue}let A=g.slice(0,15);r.has(A)&&!o.has(A)||a.set(b,[...a.get(b)??[],g])}let c=new Set,f=t.unprocessedRecords;for(let O of[...t.failedResults??[],...Array.isArray(f)?f:[]])c.add(Fs(O));let u=new Map;for(let O of e){let g=O.jobKey??"";u.set(g,[...u.get(g)??[],O])}let p=[],l=[],m=[],h=0,w=!1,y=0;for(let[O,g]of u){let b=a.get(O)??[];a.delete(O);let A=d.delete(O);if(g.length===1&&b.length===1&&!A){p.push(...Pn(n,g[0],b[0])),l.push(b[0]),K(s.found,i);continue}if(b.length>0||A){K(s.uncertain,i,g.length),g.length>1&&K(s.untold??=[],i,g.length),A||(y+=g.length),m.push(...b),w=!0;continue}if(g.length>1||c.has(O)){K(s.notFound,i,g.length);continue}h+=g.length}let R=d.size>0;for(let O of a.values())m.push(...O),O.length>0&&(R=!0);return h>0&&(K(R?s.uncertain:s.notFound,i,h),R&&(w=!0,d.size===0&&(y+=h))),y>0&&K(s.ofEndedJobs??=[],i,y),p.push(...xs(n,m,o,w,s)),{lines:p,taken:[...l,...m]}}function xs(n,e,t,r,o){e.length>0&&K(o.unattributed??=[],n.objectApiName,e.length);let s=e.filter(i=>!t.has(i.slice(0,15)));return[...s.length>0?[JSON.stringify([kt,n.objectApiName,s])]:[],...r?[]:[JSON.stringify([je,n.callId])]]}function Xa(n,e,t,r,o,s){let{objectApiName:i}=n,a=n.upsertField,d=new Map;for(let w of t.successfulResults??[]){let y=w.sf__Id;if(typeof y!="string"||!Ae.test(y))continue;let R=y.slice(0,15);if(r.has(R)&&!o.has(R)||a!==void 0&&String(w.sf__Created).toLowerCase()!=="true")continue;let O=a!==void 0?vs(w,a):Tn(w,n.fields);d.set(O,[...d.get(O)??[],y])}let c=new Map;for(let w of e){let y=a!==void 0?w.externalKey??"":w.fingerprint;c.set(y,[...c.get(y)??[],w])}let f=[],u=[],p=[],l=0,m=!1;for(let[w,y]of c){let R=w===""?[]:d.get(w)??[];if(d.delete(w),R.length===0){l+=y.length;continue}if(y.length===1&&R.length===1){f.push(...Pn(n,y[0],R[0])),u.push(R[0]),K(s.found,i);continue}K(s.uncertain,i,y.length),K(s.ofEndedJobs??=[],i,y.length),y.length>1&&K(s.untold??=[],i,y.length),p.push(...R),m=!0}let h=!1;for(let w of d.values())p.push(...w),w.length>0&&(h=!0);return l>0&&(K(h?s.uncertain:s.notFound,i,l),h&&(m=!0,K(s.ofEndedJobs??=[],i,l))),f.push(...xs(n,p,o,m,s)),{lines:f,taken:[...u,...p]}}function Ms(n){let e=new Set;for(let t of we(n)){let r=Cs(t.text);if(r!==void 0)e.delete(r);else{let o=t.text.startsWith(`["${At}"`)?En(t.text):void 0;o&&e.add(o.callId)}}return e.size}async function Ls(n,e,t=()=>new Date){let r=Ya(),o=new Map,s=new Map,i=new Set,a=Number.NEGATIVE_INFINITY;for(let g of we(n)){let b=Cs(g.text);if(b!==void 0){o.delete(b);continue}let A=Ja(g.text);if(A){s.set(A.callId,A.jobId);continue}let N=Ga(g.text);if(N!==void 0){i.add(N);continue}if(g.text.startsWith(`["${At}"`)){let x=En(g.text);x&&(o.set(x.callId,{offset:g.offset,length:g.length}),a=Math.max(a,x.at));continue}if(g.text.startsWith("{")){let x=Ka(g.text);Number.isFinite(x)&&(a=Math.max(a,x))}}if(o.size===0)return r;let d=[];for(let{offset:g,length:b}of o.values()){let A=En(n.read(g,b).toString("utf8"));A&&d.push(A)}r.calls=d.length;let c=new Set(d.map(g=>g.objectApiName)),f=new Set(d.flatMap(g=>g.rows.map(b=>b.sourceId)));r.lookedFor=f;let u=new Set,p=new be,l=new be;for(let g of we(n)){let b=_e(g.text);if(b){if(c.has(b.object))for(let N of b.ids)p.add(N.slice(0,15)),l.add(N.slice(0,15));continue}let A=Ha(g.text);A&&(f.has(A.sourceId)&&u.add(A.sourceId),(A.object===""||c.has(A.object))&&p.add(A.targetId.slice(0,15)))}let m=0;if(e.serverTime)try{let g=t().getTime(),b=Date.parse(await e.serverTime());Number.isFinite(b)&&(m=b-(g+t().getTime())/2)}catch{}let h,w,y=[],R=e.readJob?.bind(e),O=new Set;if(R)for(let g of d){let b=s.get(g.callId);if(b===void 0)continue;O.add(g.callId);let A=g.rows.filter(x=>!u.has(x.sourceId));if(A.length===0){y.push(JSON.stringify([je,g.callId]));continue}let N=Za({call:g,rows:A,jobId:b,read:await R(b),ahead:m,endKept:i.has(g.callId)},p,l,r);y.push(...N.lines);for(let x of N.taken)p.add(x.slice(0,15))}for(let g of c){let b=d.filter(S=>S.objectApiName===g&&!O.has(S.callId));if(b.length===0)continue;let A=b.map(S=>({call:S,rows:S.rows.filter(I=>!u.has(I.sourceId))})),N=A.reduce((S,{rows:I})=>S+I.length,0);if(N===0){for(let{call:S}of A)y.push(JSON.stringify([je,S.callId]));continue}let x=new Map;for(let S of b)x.set(S.fields.join(","),S.fields);let v=[...new Set(b.flatMap(S=>S.upsertField?[S.upsertField]:[]))],P=[...new Set([...b.flatMap(S=>S.fields),...v])].sort(),k;try{if(h===void 0&&w===void 0)try{h=await e.userId()}catch(L){w=H(L)}if(h===void 0)throw new Error(`the user the run writes as is not known: ${w}`);let S=Math.min(...b.map(L=>L.at))+m-$a,I=a+m+Wa,C=P.includes("CreatedDate")?"SystemModstamp":"CreatedDate",B=P.includes("CreatedById")?"":`CreatedById = '${h}' AND `,T=`SELECT ${["Id",...P.filter(L=>L!=="Id")].join(", ")} FROM ${J(g)} WHERE ${B}${C} >= ${Ps(S)} AND ${C} <= ${Ps(I)} ORDER BY Id`;k=[];for await(let L of e.queryPages(T))for(let _ of L){let $=_.Id;if(typeof $!="string"||!Ae.test($)||p.has($.slice(0,15)))continue;let U=new Map;for(let[fe,ft]of x)U.set(fe,Tn(_,ft));let Q=new Map;for(let fe of v)Q.set(fe,vs(_,fe));k.push({id:$,fingerprints:U,externalKeys:Q,taken:!1})}}catch(S){r.unread.push({objectApiName:g,reason:H(S)}),K(r.uncertain,g,N);continue}k.sort((S,I)=>S.id<I.id?-1:S.id>I.id?1:0);let j=new Map;for(let S of x.keys()){let I=new Map;for(let C of k){let B=C.fingerprints.get(S)??"",T=I.get(B)??[];T.push(C),I.set(B,T)}j.set(S,I)}let M=(S,I,C)=>{C.taken=!0,y.push(...Pn(S,I,C.id)),K(r.found,g)},D=new Set;for(let{call:S,rows:I}of A){let C=S.upsertField;if(C===void 0)continue;let B=new Map;for(let L of k){let _=L.externalKeys.get(C);L.taken||_===void 0||B.set(_,[...B.get(_)??[],L])}let T=new Map;for(let L of I){let _=L.externalKey??"";T.set(_,[...T.get(_)??[],L])}for(let[L,_]of T){let $=L===""?[]:B.get(L)??[];if(L===""||_.length>1||$.length>1){K(r.uncertain,g,_.length),D.add(S.callId);continue}$.length===1?M(S,_[0],$[0]):K(r.notFound,g)}}let E=[];for(let{call:S,rows:I}of A){if(S.upsertField!==void 0)continue;let C=S.fields.join(","),B=new Map;for(let T of I){let L=B.get(T.fingerprint)??[];L.push(T),B.set(T.fingerprint,L)}for(let[T,L]of B){let _=(j.get(C)?.get(T)??[]).filter($=>!$.taken);if(_.length>L.length){for(let $ of L)E.push({callId:S.callId,sourceId:$.sourceId});D.add(S.callId);continue}_.forEach(($,U)=>M(S,L[U],$));for(let $ of L.slice(_.length))E.push({callId:S.callId,sourceId:$.sourceId})}}let F=k.some(S=>!S.taken);for(let S of E)F||D.has(S.callId)?(K(r.uncertain,g),D.add(S.callId)):K(r.notFound,g);for(let{call:S}of A)D.has(S.callId)||y.push(JSON.stringify([je,S.callId]))}return y.length>0&&n.append(`${y.join(`
@@ -4,4 +4,4 @@ import { dirname as __sandforgeDirname } from 'node:path';
4
4
  const require = __sandforgeRequire(import.meta.url);
5
5
  const __filename = __sandforgePath(import.meta.url);
6
6
  const __dirname = __sandforgeDirname(__filename);
7
- import{a,b,c,d}from"./chunk-A65ADTCR.mjs";import"./chunk-VPDEJGPS.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-ZQO5PDX5.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ARTICLE_VERSION_OBJECT,b as articleBodyFields,c as articleBodyOptions,d as seedKnowledge};
7
+ import{a,b,c,d}from"./chunk-AHUGG3WU.mjs";import"./chunk-MJD6CPZZ.mjs";import"./chunk-5LFSFYFJ.mjs";import"./chunk-4TLYUZD5.mjs";import"./chunk-TZE3Y7IQ.mjs";import"./chunk-CA5NAXSU.mjs";import"./chunk-6QSHWIZI.mjs";import"./chunk-WZQEK4WT.mjs";import"./chunk-NTOVCTRS.mjs";export{a as ARTICLE_VERSION_OBJECT,b as articleBodyFields,c as articleBodyOptions,d as seedKnowledge};