@sheetxl/mcp 0.8.0-beta.14 → 0.8.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -7
- package/assets/{DnmjS548g7nY6EUS.js → -PtBguqpLi7Nr4Df.js} +2 -2
- package/assets/{hRLLK6I6m0uGKWo8.js → 2GLqCzpAJP6jbaRx.js} +12 -12
- package/assets/{DPazQ_nZv-sXUwO3.js → 3_NofB4A4Qhl-4YY.js} +2 -2
- package/assets/{BOcWUnxWSG1d5Ljc.js → 3t-I20nDzFHBd5UJ.js} +2 -2
- package/assets/{B9QlqO6n3MCBsvoj.js → 4vS8pASPZSU7QcRZ.js} +4 -4
- package/assets/{DTlvhtB9hvPdbdxu.js → 5B_tapYOcjOv1wGO.js} +35382 -29921
- package/assets/{Dg7xy50qHwqkYd4g.js → 8NrxfSWBHDaEJvhz.js} +2 -2
- package/assets/{KpCEdfpsHnfkyqjx.js → 9MXt8KXdWlbEJNc2.js} +2 -2
- package/assets/{DuZ6DXQGttY3Lrhd.js → AjWB-QdIkr07kToW.js} +189 -189
- package/assets/{Du_JrYiYGJo5_B9H.js → B16N6VSLY5HPgVkD.js} +2 -2
- package/assets/{PmooYGqWqoTxPExF.js → B2YEEPHIkNcezk9T.js} +3 -3
- package/assets/{CDGeuGB9CBXeCIm6.js → B3MqN3t5naY3moOk.js} +2 -2
- package/assets/{DZZ5R3msiytVNCqK.js → BBPjYcS8XKQREith.js} +49 -49
- package/assets/{CHHJZPAuM3OjbzF6.js → BCSRsSAEPlwR59H5.js} +5 -5
- package/assets/{GnXTzeDYWWeEf5yV.js → BIUUGUhypimIDg2a.js} +2 -2
- package/assets/{B-1_xSqUFCJ6jNjn.js → BNrpvJZtIL0Ex_wE.js} +996 -995
- package/assets/{BW8XjynUqlfvuQUV.js → BR66nPIzyzlOcP10.js} +2 -2
- package/assets/{BmxgDCZk_aMDms4i.js → BRLA4pJWiYdpW-69.js} +75 -75
- package/assets/{BiAEoWSl8c6jcUnS.js → BUAq-ENCmL0XGLIu.js} +2 -2
- package/assets/{DoIU_ohoCBwTZV9G.js → BYqyNLuwXl7GKuzh.js} +43 -41
- package/assets/{zu-72oKE_gCkrozc.js → BZbxPclVVopktv3l.js} +2 -2
- package/assets/{OU7gC5JF-lyDOOid.js → B_nQLUWaxp-Q1IfV.js} +3 -3
- package/assets/{yNiBIhsMP9BCWd67.js → BbDKWV_FQAICqZjP.js} +2 -2
- package/assets/{CH9M37mRwnS0t9wM.js → BbXlmp8W_cbr75FN.js} +6 -6
- package/assets/{PRSerWiAGYu8MVnd.js → BdMebk9YSA0oxQ_d.js} +78 -78
- package/assets/{BwisWvPpXRhyIP4O.js → Bdt9nQs8gDIzu_IG.js} +2 -2
- package/assets/{CVFTQ0OwsUt03r4o.js → BiE9M6RctwQ339_7.js} +2 -2
- package/assets/{UX2ywz3gr7q-MlHr.js → BiGm1tKvxUh8oWbD.js} +2 -2
- package/assets/{CgjR_TiVOcuxg5tO.js → BjDsx_FHl0mShqHX.js} +2 -2
- package/assets/{CXM1IYmE-TDInPwr.js → BlIrJwQGEASCgJdZ.js} +2 -2
- package/assets/{C55MTJ_5qW94RElE.js → BlWfQ5HPEehB_lPz.js} +3298 -2140
- package/assets/BpgPKKZwxXklRyo7.js +7 -0
- package/assets/{DUzaW_op2vBTwOOI.js → BrtLeTsrulaU6osB.js} +2 -2
- package/assets/{Cm3Q_-DDdnVHRBxr.js → BsFWmVYPrLyh5Dre.js} +34 -34
- package/assets/{BMnNvUCJu35tT_aO.js → BtNRIFE92ka4hATo.js} +2 -2
- package/assets/{BOF64A2D2KKcv_fo.js → BuhHuKVWppW4L8AV.js} +2 -2
- package/assets/{Dl87mJoXDkCkzBi7.js → C-AIgWmHugqMcl9J.js} +3 -3
- package/assets/{DihigEGfNCLR8UPN.js → C-gN7uBg-MWHRo4g.js} +2 -2
- package/assets/{B6b9ytNrHR-ijcOa.js → C0JSC9gVwR1QxopD.js} +2 -2
- package/assets/{ThqyayHHaBxzfaAt.js → C2dG4GHThf9O-IJy.js} +2 -2
- package/assets/{CjwzOAnab_dpAqiG.js → C3Wibs7QGFZ1FI7W.js} +2 -2
- package/assets/{w8YWSMNTTn45ImnB.js → C75i_5ip7OhGkuiF.js} +2 -2
- package/assets/{CpOhY88x6AgVxvTz.js → C95HXhZkkhnUx_aE.js} +3 -3
- package/assets/{CeDqeFLuUfN8UIGx.js → CAEhAL7-0FG7jdzN.js} +2 -2
- package/assets/{CtpcYuBFU6fxsUhs.js → CAMrW5ypKhgn105y.js} +2 -2
- package/assets/{2zIY9Xuml4y8NI05.js → CBPkPTmeaEokFPSI.js} +2 -2
- package/assets/{DZRp3_yqPS6Lshho.js → CDqG64rXHp9-2tXr.js} +2 -2
- package/assets/{CcLPa6zB5PH3OG2O.js → CFdJvXLSbUrvNera.js} +2435 -2447
- package/assets/{mcFLzsOH35mvmd3C.js → CG8zvnxueimOY7wm.js} +2 -2
- package/assets/{B9qiPx_BXxo1jgcx.js → CIqJdIUKSLZkNwHy.js} +353 -243
- package/assets/{BoTScfjgygCozDVi.js → CJa8JVvKGVBz8Q7q.js} +3 -3
- package/assets/{Dfd7kvLIFNqu-m-r.js → CK9h6iDOreaI8GEt.js} +4 -4
- package/assets/CL1-ziDI0aAaVbhJ.js +7 -0
- package/assets/{DBFXsbIHDxbMBrzV.js → CVRc6jQcH155Z89u.js} +2 -2
- package/assets/{a7BoASyT8yQZY9hJ.js → CVbRpT7QPHOMgwTx.js} +2 -2
- package/assets/CW-ivE6pl3V7vKuT.js +2563 -0
- package/assets/{D2w3KjYuONW1G1kX.js → CX-6eYkcr5y0VmQm.js} +4 -4
- package/assets/{DSSrCrejjpWoszj7.js → CZepo1lDTQp1myg6.js} +2 -2
- package/assets/{DkPXpv81Y5teMd-R.js → C_0RM0w6Pw70Bx_Y.js} +2 -2
- package/assets/{aqguaobnu61szXWM.js → Ci7-PIIhZwb2mVv5.js} +2 -2
- package/assets/{eHAVGCUcMAfNjEGt.js → Cl98sBOj9GM2XnFe.js} +3 -3
- package/assets/{BNfBq8Eic3Cl-f6A.js → CoIjAX2gECGb3Wxl.js} +2 -2
- package/assets/{ZTEO4JX22YIOkrJg.js → Co_y6GfwJTYtOmlt.js} +8 -8
- package/assets/{DkFK1iu4vqjLZMja.js → CrwtgrD7BbXyCkx0.js} +2 -2
- package/assets/{DCHsM8bfVisYJFTT.js → CsjjeeOHE2624pGt.js} +2 -2
- package/assets/Ct5VTtdW77k-WcP_.js +529 -0
- package/assets/{BXC6616BWEWNZ2-D.js → CvJkwRgwm80S2bcd.js} +2 -2
- package/assets/{C2Rgsb69SnMOohGt.js → D-irgQZ2WmkP9dnK.js} +2 -2
- package/assets/{D94hlZEaHtGHdN_K.js → D1g6IOzdvInVLV-x.js} +7 -7
- package/assets/{BYtBi8vLoB41QkV8.js → D2YdqNWXwSHJMPbA.js} +109 -109
- package/assets/{CBNNl8igIyeHY4St.js → D3bxrF1Ys2GSVfQH.js} +25 -19
- package/assets/{st-UQngeBG4hwKoy.js → D7iU4kaxzl_PojNt.js} +2 -2
- package/assets/{B-jE7tAMA559MtNt.js → D7ibkNIu_Pn4TeBD.js} +4 -4
- package/assets/DBANZf_eAzaCFdIj.js +4676 -0
- package/assets/{BWsXOU_jh_cA8m8I.js → DBMZF6PRHCko9K9R.js} +2 -2
- package/assets/{CwJyw5Yxpj4PGh14.js → DEIkGoOZ_WeuY0Lj.js} +2 -2
- package/assets/{HKLw8b2xTdu5c1w5.js → DFAqI-o57Kd_Azlt.js} +2 -2
- package/assets/{EeSGsbh_r4N-qs4w.js → DFn_thWGK0_EZI5k.js} +2 -2
- package/assets/{DvD_K4M5HgJ4uJ8L.js → DFvs1LVzXKm1N5M2.js} +3 -3
- package/assets/{Df2IAW-O7Gwl7V1l.js → DJdRl2yX9DP_D8kh.js} +3 -3
- package/assets/{D3BAmD-1AfFtHdC6.js → DKRa_Oc4XqB3DABB.js} +9 -9
- package/assets/{Doqy_uDSQTCv6a6X.js → DLhlBqwsDnmscAuL.js} +2 -2
- package/assets/{DpGuA6U12gwyGHEM.js → DMhtIFfkX-DZT_e3.js} +4 -4
- package/assets/{cdIvC9t9tYtVn4nc.js → DNhfziNrJGdL8BYs.js} +82 -81
- package/assets/{BDZ1FGc1zFqO1nK7.js → DOZ40EyxD3m0gCos.js} +810 -495
- package/assets/{BkBCkgPNrFR5N9fo.js → DQcus4X_kTKIIyX6.js} +2 -2
- package/assets/{ByziR0Anm39Bw0Bc.js → DR9xHYH6v5G0lOqf.js} +4 -4
- package/assets/{C-5LlJ5qhC7Ef0gV.js → DTLbKr_XIJMwQJmk.js} +52 -52
- package/assets/{8vRAQlvTcvMLeio0.js → DaILIYfy-jPVTXjz.js} +3 -3
- package/assets/{B66aeGYrHLbGpuN9.js → Dd8CHUZz7xuYTfp-.js} +1443 -1355
- package/assets/{B5xHa5bjZu5ONrm5.js → DdrsYdX3bLixdb_9.js} +2 -2
- package/assets/DfWWAHOjmhqvN3m_.js +7166 -0
- package/assets/{DIy1659Yv5-fD69E.js → DfzLOnWTNL_2J90y.js} +2 -2
- package/assets/{CfiVUfpeONJ3rf31.js → Dg4JXbd1yPGNZOtL.js} +2 -2
- package/assets/Di4ehJD7muvtcrN3.js +169 -0
- package/assets/{CPDkdp0yI4DwUHGZ.js → DmLbqbAez7Dzwyl7.js} +2 -2
- package/assets/{CMTDUipnLiOj5pbe.js → Dp-dLoOaBndV2N5i.js} +3 -3
- package/assets/DsTi7zHk_Xl37bAD.js +14 -0
- package/assets/{9dbZwzIWefGss7is.js → DvFwVzuc5YfagNnH.js} +2 -2
- package/assets/{D81iH5MJJfq2t9FP.js → Dy67BUF2yd8VRPwL.js} +2 -2
- package/assets/{C-CNmTrzNS-ZlQ8j.js → DzkccbbE6iXMqQDO.js} +410 -406
- package/assets/{DWTpPijG5yeNFR0W.js → Gqh12ggLm5KlvN3v.js} +2 -2
- package/assets/{ZBYHyJs7CQgnnHfR.js → JC8UUcu6m23qqrr3.js} +3 -4
- package/assets/{B9w1dNK8pNq-Z1P3.js → LwFDS0HxPZKiiEnN.js} +2 -2
- package/assets/{QXKcNTuZqOauSidr.js → POdlv6cpSx6ftJxx.js} +2 -2
- package/assets/{DK0VM9-qrEXBm8Ud.js → QVWayvB03YMyTKt3.js} +3 -3
- package/assets/{C1rIlmARlinuie5E.js → SB2aKOIVln0EkgXR.js} +2 -2
- package/assets/SaCo3me4_hw2b1L4.js +2039 -0
- package/assets/{BFwNQZVRnbNt-gRJ.js → TNQaiw20sEAEUiK5.js} +386 -372
- package/assets/{CutEBbZl8oFbTlXZ.js → W2FU69Pfo4chpqtk.js} +2 -2
- package/assets/{ddJqSu7gXUkXjGxZ.js → YXC__Myl-BuIFW6s.js} +2 -2
- package/assets/{B_-VPqfsse8AlCTm.js → Z01wJImjl6lBMpf4.js} +2 -2
- package/assets/{C1w8NQeox7_92swz.js → h6EQSu5n2vTsu2yd.js} +2 -2
- package/assets/{TzsPqmpG77I4ewVt.js → iULnLPcNKVpz00r7.js} +2 -2
- package/assets/{cv7k-VAIJtYeL9k4.js → iqQWGoJaPha0_8lU.js} +2 -2
- package/assets/{DUUt1z6Y_cpxEpYY.js → nDmE2I07HvkpRdR0.js} +2 -2
- package/assets/{9MRZ5Yc2RBgcqZSp.js → nmB0nnkFQf5NWo0i.js} +3 -3
- package/assets/{33QTHR3r6ZujxFx8.js → pQUJKbHGetb7dcOr.js} +2 -2
- package/assets/{DUYoUViqY5U6uQX3.js → rfwqMukKbJBeJBuC.js} +3 -3
- package/assets/{CULV-2mwmqYYpAjM.js → soSlr334Fv1j5t2m.js} +2 -2
- package/index.js +2013 -1947
- package/lib.js +2 -2
- package/licenses/dependencies.txt +281 -216
- package/package.json +4 -9
- package/resources/locales/@sheetxl/sdk/de/model.msg.json +82 -1
- package/resources/locales/@sheetxl/sdk/en/model.msg.json +80 -1
- package/screenshot-page/assets/{CSUd8n1H0VBfREnk.js → -N4OYIMgf6f5vgNy.js} +1 -1
- package/screenshot-page/assets/{B4PbXdzBe9BsoZ0e.js → B7eQ3rE-7Vayb_4O.js} +1 -1
- package/screenshot-page/assets/B8i4Sr2kMQAXp0rb.js +4 -0
- package/screenshot-page/assets/{DQWHkaQeNXft9j8b.js → B8qybUclSjEYP5FJ.js} +2 -2
- package/screenshot-page/assets/BIHbD4jMsk3NetOd.js +1 -0
- package/screenshot-page/assets/BIrVK5hdDCUYmxGO.js +1 -0
- package/screenshot-page/assets/{BRqSWCr2mTVNFquQ.js → BJ2r2WfEL3SgkBAX.js} +1 -1
- package/screenshot-page/assets/BJviQwDXR5L6l1DA.js +1 -0
- package/screenshot-page/assets/BM78thqEW6HwXFAK.js +13 -0
- package/screenshot-page/assets/{BcOdl17EeFSxnAiq.js → BMf827t1Ul65MHd5.js} +1 -1
- package/screenshot-page/assets/BMwQInar0xVS5FRu.js +1 -0
- package/screenshot-page/assets/{BUjI304IvdJnFXH3.js → BU5S8KEzPmIA_Flm.js} +1 -1
- package/screenshot-page/assets/{D6Jpaz2YkhOfzxDB.js → BYQZ8o8k3-MDoNat.js} +1 -1
- package/screenshot-page/assets/{CZf9s6otzzoaBlSs.js → BftXEPOuf5Uwxpud.js} +1 -1
- package/screenshot-page/assets/Bir0SSOHX0w2yo8h.js +1 -0
- package/screenshot-page/assets/{CykecBozGGFl26KA.js → Btgo0VFTT0JxuaP3.js} +74 -68
- package/screenshot-page/assets/C2H2lX8eyKpxpP6M.js +2 -0
- package/screenshot-page/assets/{B-KIwD5F_5S-NsPg.js → C71ZZMVLfHdPl441.js} +1 -1
- package/screenshot-page/assets/CFfgJlXaIS8QMx5O.js +1 -0
- package/screenshot-page/assets/{DGXDfjkGZjMRAXPg.js → CN8u05DjKwNHbUHN.js} +1 -1
- package/screenshot-page/assets/CQFj5AGXfIA9z9zI.js +1 -0
- package/screenshot-page/assets/{gG0AFZ45VxS_moMw.js → CRsTnamLrPN5-Dsi.js} +1 -1
- package/screenshot-page/assets/CYfkL98Zu43S8-50.js +42 -0
- package/screenshot-page/assets/{DDpAoGAPzo1c4vl5.js → CZa1rha3RnQUWyOk.js} +7 -7
- package/screenshot-page/assets/{CpbohdgEaEsVDi9J.js → C_vPl50T1L5HWnhv.js} +1 -1
- package/screenshot-page/assets/{CbUDukmvDZmVfhJH.js → CfkssmHURDicfYvR.js} +1 -1
- package/screenshot-page/assets/{Bor_tayB4yBfNOH5.js → CguXw0IcKNPbmAbj.js} +2 -2
- package/screenshot-page/assets/{DmbuCapSSCYIa3yk.js → ClzJdxlUDDtBYjH8.js} +1 -1
- package/screenshot-page/assets/{Miyn0clMq0rovRIo.js → CqyMYduWKFvmMs_Z.js} +1 -1
- package/screenshot-page/assets/CzsoLbEIUVK5ia1C.js +1 -0
- package/screenshot-page/assets/D2IHCJ1QWDKwmhge.js +1 -0
- package/screenshot-page/assets/D6CzedWHXTesD55R.js +1 -0
- package/screenshot-page/assets/D7biuwkvm3zAwsBa.js +39 -0
- package/screenshot-page/assets/D8s3sJnhFxbI3Dqn.js +1 -0
- package/screenshot-page/assets/{CE0MnsfMjqV2ICzk.js → DDkL9PZPXAggW2Yr.js} +13 -13
- package/screenshot-page/assets/DEpn6VGd30cHEJOS.js +1 -0
- package/screenshot-page/assets/{CIged53b3hHKxa-o.js → DLFFFQjTi5Ji1940.js} +1 -1
- package/screenshot-page/assets/DMxrNtfw275en7pm.js +1 -0
- package/screenshot-page/assets/{CqR3hGrC956TkCMj.js → DRncpwDkZZX8rL9S.js} +1 -1
- package/screenshot-page/assets/DTrnAtpccj55fGg5.js +1 -0
- package/screenshot-page/assets/D_kJ3WunvjIINcHC.js +1 -0
- package/screenshot-page/assets/{BFaiQZKle44Rhyou.js → D_rtIYQ7FDC2CoEn.js} +1 -1
- package/screenshot-page/assets/{Bf7xq8PyF4ohjMzP.js → Db6bZVJ-184DJIoe.js} +2 -2
- package/screenshot-page/assets/{DyLWQxXXTw5uwPVy.js → DeyRZ5rprDbRbuf4.js} +1 -1
- package/screenshot-page/assets/{D47ePD4x1lVazNdl.js → DgtqX4DiBgkepVZZ.js} +1 -1
- package/screenshot-page/assets/DhB6GjSJIeTmIODk.js +1 -0
- package/screenshot-page/assets/Dn5PwRw7rrTKNnql.js +586 -0
- package/screenshot-page/assets/{BYRwTzX1q407lHUS.js → Dq7wGcTrNIshovlT.js} +2 -2
- package/screenshot-page/assets/{BUGXf2DEBog16Slb.js → DqXO_Zw1Cp7rAQ04.js} +2 -2
- package/screenshot-page/assets/{21oAESJyBGXeHegm.js → DtihumgXQ7ETaN0A.js} +2 -2
- package/screenshot-page/assets/DuYb_otrRZZDq6-f.js +2 -0
- package/screenshot-page/assets/DyiVrm8mEnEaoZHa.js +3 -0
- package/screenshot-page/assets/{BHqg55S-4_OoAu3P.js → LYyM_ig973jLdOU0.js} +2 -2
- package/screenshot-page/assets/TilS2JSBGVkd1za3.js +3 -0
- package/screenshot-page/assets/Tph2vYqw17-NBCtd.js +1 -0
- package/screenshot-page/assets/UKFgEuwI1UMhPqKF.js +2 -0
- package/screenshot-page/assets/XgsioU5Px1T5gKAY.js +1 -0
- package/screenshot-page/assets/cTMKPkmZF8FWQaMn.js +1 -0
- package/screenshot-page/assets/hlxJ87-H830aSZBQ.js +1 -0
- package/screenshot-page/assets/{DDQWM8rNYCYzKa9R.js → lgeNUp9cU20IAotv.js} +1 -1
- package/screenshot-page/assets/nM1r2xslndIMKlI2.js +2 -0
- package/screenshot-page/assets/{BCl5buf87xUgIfEB.js → rOzyaU7hqchMbhRL.js} +1 -1
- package/screenshot-page/index.html +12 -12
- package/screenshot-page/resources/locales/@sheetxl/sdk/de/model.msg.json +82 -1
- package/screenshot-page/resources/locales/@sheetxl/sdk/en/model.msg.json +80 -1
- package/types/scripting-api.json +9967 -9497
- package/types/scripting-enums.json +27 -0
- package/types/scripting.d.ts +2282 -166
- package/assets/B6BP5l2qmeZhqVV7.js +0 -7
- package/assets/COFze3jkZDQRSij9.js +0 -4437
- package/assets/CdF5MxGnISAZ41oQ.js +0 -359
- package/assets/Cfvhcua4c6onouhP.js +0 -14
- package/assets/CwdOInoJwCxXnhog.js +0 -7
- package/assets/D2_T0KSaye0ncjQa.js +0 -6294
- package/assets/W-MzzQHZuRxr8adc.js +0 -2346
- package/screenshot-page/assets/04d8koPx6lzeMYRQ.js +0 -39
- package/screenshot-page/assets/0MTaPYjKud2Q9QG9.js +0 -1
- package/screenshot-page/assets/BQfe-XTIOGeUnD9B.js +0 -1
- package/screenshot-page/assets/BksaQEoZr5OWq-_d.js +0 -3
- package/screenshot-page/assets/Bwql3QifB2cv7Mqp.js +0 -3
- package/screenshot-page/assets/Bz2U7weS0spa8Xbh.js +0 -1
- package/screenshot-page/assets/C2Wh2h27c7FUb8Yk.js +0 -1
- package/screenshot-page/assets/C81mK8aZKZAAS-AB.js +0 -1
- package/screenshot-page/assets/CFOaI8g7pJuPzsyk.js +0 -1
- package/screenshot-page/assets/Ca6nxdhEuLLty3d7.js +0 -2
- package/screenshot-page/assets/CnZJ44ncMxZ4ivcB.js +0 -586
- package/screenshot-page/assets/Cv8FG9PPBkkPw86e.js +0 -1
- package/screenshot-page/assets/CvL9XK3Ht1mP-rGz.js +0 -4
- package/screenshot-page/assets/DUJzubL4qqOyizfu.js +0 -1
- package/screenshot-page/assets/DWiI5I3RtoKvVT66.js +0 -1
- package/screenshot-page/assets/DZDRRw-62D6Zw7qs.js +0 -1
- package/screenshot-page/assets/D_H2dlsQ8PJ0r1WD.js +0 -10
- package/screenshot-page/assets/DeAKjatTVaZ0u_FY.js +0 -1
- package/screenshot-page/assets/DqM1wwsmN1J4MXMm.js +0 -1
- package/screenshot-page/assets/DsL71n5SxCVjL6Ho.js +0 -2
- package/screenshot-page/assets/DzZRUd0p22CBa27b.js +0 -1
- package/screenshot-page/assets/IRtoU5oVgBWu9rnK.js +0 -2
- package/screenshot-page/assets/IfF7Tv-nhz6Ikpn0.js +0 -1
- package/screenshot-page/assets/Rm5Sf5E6t8bk_Y3r.js +0 -1
- package/screenshot-page/assets/b3AbgxQkoaCiBi15.js +0 -1
- package/screenshot-page/assets/fGlPAximvsxzPzGA.js +0 -1
- package/screenshot-page/assets/qm3VY0bH7F7EgSdi.js +0 -2
- package/screenshot-page/assets/rPOkVKdPbFpTG6AY.js +0 -1
- package/screenshot-page/assets/zHHZFbk5RXnrxbOc.js +0 -42
|
@@ -0,0 +1,2039 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/mcp - MCP server exposing SheetXL spreadsheet operations as tools and resources. - v0.8.0-beta.16
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: SheetXL EULA — https://www.sheetxl.com/eula
|
|
6
|
+
*/
|
|
7
|
+
import { p as e, tt as t } from "./CrwtgrD7BbXyCkx0.js";
|
|
8
|
+
import { d as n, en as s, f as r, vt as o } from "./BNrpvJZtIL0Ex_wE.js";
|
|
9
|
+
import { d as a } from "./D3bxrF1Ys2GSVfQH.js";
|
|
10
|
+
import { $ as i, $i as l, Aa as d, Ai as u, Bi as c, Ca as f, Gr as m, Hi as p, In as h, Ki as g, Li as w, M as v, Oi as F, Rn as b, Sn as y, U as I, Vi as x, Wa as A, Xi as C, Ya as E, Yi as S, Zi as P, _n as k, ci as M, ei as T, ga as R, jr as O, kt as N, ln as $, mr as L, n as _, nt as D, ut as V, wr as U, x as H, xr as B, xt as z, yr as j, za as G, zr as q } from "./5B_tapYOcjOv1wGO.js";
|
|
11
|
+
import { a as K, i as Q, n as W, o as J, r as Y } from "./Di4ehJD7muvtcrN3.js";
|
|
12
|
+
var X = [
|
|
13
|
+
"Jan",
|
|
14
|
+
"Feb",
|
|
15
|
+
"Mar",
|
|
16
|
+
"Apr",
|
|
17
|
+
"May",
|
|
18
|
+
"Jun",
|
|
19
|
+
"Jul",
|
|
20
|
+
"Aug",
|
|
21
|
+
"Sep",
|
|
22
|
+
"Oct",
|
|
23
|
+
"Nov",
|
|
24
|
+
"Dec"
|
|
25
|
+
], Z = [
|
|
26
|
+
31,
|
|
27
|
+
29,
|
|
28
|
+
31,
|
|
29
|
+
30,
|
|
30
|
+
31,
|
|
31
|
+
30,
|
|
32
|
+
31,
|
|
33
|
+
31,
|
|
34
|
+
30,
|
|
35
|
+
31,
|
|
36
|
+
30,
|
|
37
|
+
31
|
|
38
|
+
], ee = (e, t, n, s) => {
|
|
39
|
+
if ("number" != typeof n) return null;
|
|
40
|
+
if (n < e.start) return 0;
|
|
41
|
+
const o = t - 1;
|
|
42
|
+
if (((e) => "numbers" === e.by || "days" === e.by && 1 !== (e.interval ?? 1))(e)) {
|
|
43
|
+
const s = Math.floor((n - e.start) / (e.interval ?? 1));
|
|
44
|
+
return s >= t - 2 ? n <= e.end ? t - 2 : o : s + 1;
|
|
45
|
+
}
|
|
46
|
+
if (n > e.end) return o;
|
|
47
|
+
const a = r(n, s, !0);
|
|
48
|
+
if (!a) return null;
|
|
49
|
+
switch (e.by) {
|
|
50
|
+
case "years": return Math.min(a.year - (r(e.start, s, !0)?.year ?? a.year) + 1, o);
|
|
51
|
+
case "quarters": return Math.floor((a.month - 1) / 3) + 1;
|
|
52
|
+
case "months": return a.month;
|
|
53
|
+
case "days": {
|
|
54
|
+
let e = a.day;
|
|
55
|
+
for (let t = 0; t < a.month - 1; t++) e += Z[t];
|
|
56
|
+
return e;
|
|
57
|
+
}
|
|
58
|
+
case "hours": return a.hour + 1;
|
|
59
|
+
case "minutes": return a.minute + 1;
|
|
60
|
+
case "seconds": return a.second + 1;
|
|
61
|
+
default: return null;
|
|
62
|
+
}
|
|
63
|
+
}, te = (e, t) => {
|
|
64
|
+
const n = e.fields ?? [], s = m(e.records, n.length);
|
|
65
|
+
if (!n.some(p)) return s;
|
|
66
|
+
const r = m(e.items, n.length), o = e.recordCount ?? 0, a = s.slice();
|
|
67
|
+
for (let e = 0; e < n.length; e++) {
|
|
68
|
+
const i = n[e];
|
|
69
|
+
if (!p(i)) continue;
|
|
70
|
+
const l = i.group, d = s[l.base] ?? [], u = r[l.base] ?? [], c = new Int32Array(u.length);
|
|
71
|
+
for (let e = 0; e < u.length; e++) {
|
|
72
|
+
const n = l.range ? ee(l.range, l.items.length, G(u[e]), t) : l.discrete?.[e] ?? null;
|
|
73
|
+
c[e] = n ?? -1;
|
|
74
|
+
}
|
|
75
|
+
const f = new Array(o);
|
|
76
|
+
for (let e = 0; e < o; e++) {
|
|
77
|
+
const t = c[d[e]];
|
|
78
|
+
if (void 0 === t || t < 0) return null;
|
|
79
|
+
f[e] = t;
|
|
80
|
+
}
|
|
81
|
+
a[e] = f;
|
|
82
|
+
}
|
|
83
|
+
return a;
|
|
84
|
+
}, ne = (e) => String(Number(e.toPrecision(12))), se = (e, t) => {
|
|
85
|
+
const n = r(e, t, !0);
|
|
86
|
+
return n ? `${n.month}/${n.day}/${n.year}` : String(e);
|
|
87
|
+
}, re = (e, t, n) => {
|
|
88
|
+
const s = e.range;
|
|
89
|
+
let o = 1 / 0, a = -1 / 0;
|
|
90
|
+
for (const e of t) {
|
|
91
|
+
if ("number" != typeof e) return null;
|
|
92
|
+
e < o && (o = e), e > a && (a = e);
|
|
93
|
+
}
|
|
94
|
+
if (0 === t.length) return e;
|
|
95
|
+
const i = { ...s };
|
|
96
|
+
s.fixedStart || (i.start = o), s.fixedEnd || (i.end = "numbers" !== s.by && Number.isInteger(a) ? a + 1 : a);
|
|
97
|
+
const { inner: l, endText: d } = ((e, t) => {
|
|
98
|
+
const { start: n, end: s } = e, o = e.interval ?? 1, a = se(s, t), i = (e, t) => Array.from({ length: e }, (e, n) => t(n));
|
|
99
|
+
switch (e.by) {
|
|
100
|
+
case "numbers": {
|
|
101
|
+
const e = Math.max(1, Math.ceil(Number(((s - n) / o).toPrecision(12)))), t = Number.isInteger(Number(((s - n) / o).toPrecision(12))), r = Number.isInteger(n) && Number.isInteger(o);
|
|
102
|
+
return {
|
|
103
|
+
inner: i(e, (a) => {
|
|
104
|
+
const i = n + a * o, l = a === e - 1 && t ? s : r ? i + o - 1 : i + o;
|
|
105
|
+
return `${ne(i)}-${ne(l)}`;
|
|
106
|
+
}),
|
|
107
|
+
endText: ne(t ? s : n + e * o)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
case "days":
|
|
111
|
+
if (1 === o) {
|
|
112
|
+
const e = [];
|
|
113
|
+
return Z.forEach((t, n) => {
|
|
114
|
+
for (let s = 1; s <= t; s++) e.push(`${s}-${X[n]}`);
|
|
115
|
+
}), {
|
|
116
|
+
inner: e,
|
|
117
|
+
endText: a
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
inner: i(Math.max(1, Math.ceil((s - n) / o)), (e) => {
|
|
122
|
+
const r = n + e * o;
|
|
123
|
+
return `${se(r, t)} - ${se(Math.min(r + o - 1, s), t)}`;
|
|
124
|
+
}),
|
|
125
|
+
endText: a
|
|
126
|
+
};
|
|
127
|
+
case "months": return {
|
|
128
|
+
inner: X.slice(),
|
|
129
|
+
endText: a
|
|
130
|
+
};
|
|
131
|
+
case "quarters": return {
|
|
132
|
+
inner: [
|
|
133
|
+
"Qtr1",
|
|
134
|
+
"Qtr2",
|
|
135
|
+
"Qtr3",
|
|
136
|
+
"Qtr4"
|
|
137
|
+
],
|
|
138
|
+
endText: a
|
|
139
|
+
};
|
|
140
|
+
case "years": {
|
|
141
|
+
const e = r(n, t)?.year ?? 0;
|
|
142
|
+
return {
|
|
143
|
+
inner: i((r(s, t)?.year ?? e) - e + 1, (t) => String(e + t)),
|
|
144
|
+
endText: a
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
case "hours": return {
|
|
148
|
+
inner: i(24, (e) => `${e % 12 == 0 ? 12 : e % 12} ${e < 12 ? "AM" : "PM"}`),
|
|
149
|
+
endText: a
|
|
150
|
+
};
|
|
151
|
+
default: return {
|
|
152
|
+
inner: i(60, (e) => `:${String(e).padStart(2, "0")}`),
|
|
153
|
+
endText: a
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
})(i, n), u = "numbers" === i.by ? ne(i.start) : se(i.start, n);
|
|
157
|
+
return {
|
|
158
|
+
...e,
|
|
159
|
+
range: i,
|
|
160
|
+
items: [
|
|
161
|
+
`<${u}`,
|
|
162
|
+
...l,
|
|
163
|
+
`>${d}`
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
}, oe = (e, t) => {
|
|
167
|
+
let n = "", s = 0;
|
|
168
|
+
const r = () => {
|
|
169
|
+
let t = "";
|
|
170
|
+
for (s++; s < e.length;) {
|
|
171
|
+
if ("'" === e[s]) {
|
|
172
|
+
if ("'" !== e[s + 1]) {
|
|
173
|
+
s++;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
s++;
|
|
177
|
+
}
|
|
178
|
+
t += e[s++];
|
|
179
|
+
}
|
|
180
|
+
return t;
|
|
181
|
+
};
|
|
182
|
+
for (; s < e.length;) {
|
|
183
|
+
const o = e[s];
|
|
184
|
+
if ("\"" === o) {
|
|
185
|
+
const t = /^"(?:[^"]|"")*"/.exec(e.slice(s)), r = t ? t[0] : e.slice(s);
|
|
186
|
+
n += r, s += r.length;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (/[0-9.]/.test(o)) {
|
|
190
|
+
const t = /^[0-9.]+(?:[eE][+-]?[0-9]+)?/.exec(e.slice(s))[0];
|
|
191
|
+
n += t, s += t.length;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const a = "'" === o, i = a ? null : /^[\p{L}_][\p{L}\p{N}_.]*/u.exec(e.slice(s))?.[0];
|
|
195
|
+
if (!a && !i) {
|
|
196
|
+
n += o, s++;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const l = a ? r() : i;
|
|
200
|
+
if (a || (s += l.length), "(" !== e[s]) {
|
|
201
|
+
if ("[" === e[s]) {
|
|
202
|
+
s++;
|
|
203
|
+
let o = "";
|
|
204
|
+
for ("'" === e[s] && (o = r()); s < e.length && "]" !== e[s];) o += e[s++];
|
|
205
|
+
s++;
|
|
206
|
+
const a = t(l, o);
|
|
207
|
+
if (null === a) return null;
|
|
208
|
+
n += a;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
n += t(l, null) ?? (a ? `'${l.replace(/'/g, "''")}'` : l);
|
|
212
|
+
} else n += l;
|
|
213
|
+
}
|
|
214
|
+
return n;
|
|
215
|
+
}, ae = (e) => {
|
|
216
|
+
let t = "";
|
|
217
|
+
for (let n = e + 1; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
218
|
+
return `${t}1`;
|
|
219
|
+
}, ie = (e, t) => ({
|
|
220
|
+
rowStart: 0,
|
|
221
|
+
colStart: e,
|
|
222
|
+
rowEnd: t - 1,
|
|
223
|
+
colEnd: e
|
|
224
|
+
}), le = (e, t) => {
|
|
225
|
+
const n = [];
|
|
226
|
+
for (let s = 0; s < t; s++) n.push([s, [[0, e.map((e) => e[s] ?? null)]]]);
|
|
227
|
+
return n;
|
|
228
|
+
}, de = (e, t) => {
|
|
229
|
+
const n = t.fields ?? [], s = [], r = [], o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), i = (e, t) => {
|
|
230
|
+
if (o.has(e)) return !0;
|
|
231
|
+
if (t.includes(e)) return !1;
|
|
232
|
+
const l = [];
|
|
233
|
+
oe(n[e].formula, (e) => {
|
|
234
|
+
const t = n.findIndex((t) => w(t.name, e));
|
|
235
|
+
return t >= 0 && l.push(t), t >= 0 ? "" : null;
|
|
236
|
+
});
|
|
237
|
+
for (const r of l) if (f(n[r])) {
|
|
238
|
+
if (!i(r, [...t, e])) return !1;
|
|
239
|
+
} else s.includes(r) || s.push(r);
|
|
240
|
+
return o.set(e, r.length), a.set(e, n[e].formula), r.push({
|
|
241
|
+
field: e,
|
|
242
|
+
expression: ""
|
|
243
|
+
}), !0;
|
|
244
|
+
}, l = [];
|
|
245
|
+
for (const [t, s] of (e.dataFields ?? []).entries()) if (f(n[s.field])) {
|
|
246
|
+
if (!i(s.field, [])) return null;
|
|
247
|
+
l.push({
|
|
248
|
+
data: t,
|
|
249
|
+
formula: o.get(s.field)
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
const d = (e, t) => {
|
|
253
|
+
if (null !== t) return null;
|
|
254
|
+
const r = n.findIndex((t) => w(t.name, e));
|
|
255
|
+
return r >= 0 ? ae(f(n[a = r]) ? s.length + o.get(a) : s.indexOf(a)) : null;
|
|
256
|
+
var a;
|
|
257
|
+
};
|
|
258
|
+
for (const e of r) {
|
|
259
|
+
const t = oe(a.get(e.field), d);
|
|
260
|
+
if (null === t) return null;
|
|
261
|
+
e.expression = t;
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
operands: s,
|
|
265
|
+
formulas: r,
|
|
266
|
+
measures: l
|
|
267
|
+
};
|
|
268
|
+
}, ue = /* @__PURE__ */ new Set([
|
|
269
|
+
"sum",
|
|
270
|
+
"count",
|
|
271
|
+
"countNums"
|
|
272
|
+
]), ce = -2, fe = 4294967295, me = 4294967295, pe = {
|
|
273
|
+
sum: 0,
|
|
274
|
+
countNums: 1,
|
|
275
|
+
count: 11,
|
|
276
|
+
average: 3,
|
|
277
|
+
min: 4,
|
|
278
|
+
max: 5,
|
|
279
|
+
product: 6,
|
|
280
|
+
var: 7,
|
|
281
|
+
varp: 8,
|
|
282
|
+
stdDev: 9,
|
|
283
|
+
stdDevp: 10
|
|
284
|
+
}, he = [
|
|
285
|
+
"sum",
|
|
286
|
+
"countA",
|
|
287
|
+
"avg",
|
|
288
|
+
"max",
|
|
289
|
+
"min",
|
|
290
|
+
"product",
|
|
291
|
+
"count",
|
|
292
|
+
"stdDev",
|
|
293
|
+
"stdDevP",
|
|
294
|
+
"var",
|
|
295
|
+
"varP"
|
|
296
|
+
], ge = {
|
|
297
|
+
sum: 0,
|
|
298
|
+
countA: 13,
|
|
299
|
+
avg: 3,
|
|
300
|
+
max: 5,
|
|
301
|
+
min: 4,
|
|
302
|
+
product: 6,
|
|
303
|
+
count: 12,
|
|
304
|
+
stdDev: 9,
|
|
305
|
+
stdDevP: 10,
|
|
306
|
+
var: 7,
|
|
307
|
+
varP: 8
|
|
308
|
+
}, we = {
|
|
309
|
+
sum: "Sum",
|
|
310
|
+
countA: "Count",
|
|
311
|
+
avg: "Average",
|
|
312
|
+
max: "Max",
|
|
313
|
+
min: "Min",
|
|
314
|
+
product: "Product",
|
|
315
|
+
count: "Count",
|
|
316
|
+
stdDev: "StdDev",
|
|
317
|
+
stdDevP: "StdDevp",
|
|
318
|
+
var: "Var",
|
|
319
|
+
varP: "Varp"
|
|
320
|
+
}, ve = (e) => {
|
|
321
|
+
const t = e?.subtotals;
|
|
322
|
+
return t && !t.includes("default") ? he.filter((e) => t.includes(e)) : [];
|
|
323
|
+
}, Fe = (e, t) => {
|
|
324
|
+
const n = new Set(t.flatMap((t) => t.field === ce ? [] : ve(e.fields?.[t.field])));
|
|
325
|
+
return he.filter((e) => n.has(e));
|
|
326
|
+
}, be = (e, t) => {
|
|
327
|
+
const n = t.filter((e) => e.field !== ce).map((e) => e.field);
|
|
328
|
+
return !(n.length < 2 || t[t.length - 1].field === ce || n.slice(0, -1).some((t) => e.fields?.[t]?.items?.some((e) => e.collapsed)) || e.filters?.some((e) => void 0 !== e.dataField && n.includes(e.field)));
|
|
329
|
+
}, ye = {
|
|
330
|
+
normal: 0,
|
|
331
|
+
percentOfTotal: 1,
|
|
332
|
+
percentOfRow: 2,
|
|
333
|
+
percentOfCol: 3,
|
|
334
|
+
index: 4,
|
|
335
|
+
percentOfParentRow: 5,
|
|
336
|
+
percentOfParentCol: 6,
|
|
337
|
+
percentOfParent: 7,
|
|
338
|
+
runTotal: 8,
|
|
339
|
+
percentOfRunningTotal: 9,
|
|
340
|
+
rankAscending: 10,
|
|
341
|
+
rankDescending: 11,
|
|
342
|
+
difference: 12,
|
|
343
|
+
percent: 13,
|
|
344
|
+
percentDiff: 14
|
|
345
|
+
}, Ie = (e, t, n, s) => {
|
|
346
|
+
const r = y.peek(), o = e.fields, a = t.fields;
|
|
347
|
+
if (!r || !o || !a || o.length !== a.length) return null;
|
|
348
|
+
if (h(e)) return {
|
|
349
|
+
cells: [],
|
|
350
|
+
...V,
|
|
351
|
+
rowPageCount: 0,
|
|
352
|
+
columnPageCount: 0,
|
|
353
|
+
header: c(e),
|
|
354
|
+
rowLines: [],
|
|
355
|
+
columnLines: [],
|
|
356
|
+
viewValues: [],
|
|
357
|
+
firstKey: null,
|
|
358
|
+
...s?.roles ? { roles: /* @__PURE__ */ new Map() } : {}
|
|
359
|
+
};
|
|
360
|
+
const i = u(e, a), l = i ? s?.filters : null;
|
|
361
|
+
if (i && !l) return null;
|
|
362
|
+
const d = o.some((e) => e.items?.some((e) => e.calculated));
|
|
363
|
+
if (d && !l?.calculatedRecords) return null;
|
|
364
|
+
const f = de(e, t);
|
|
365
|
+
if (!f || f.measures.length > 0 && !l?.fieldValues) return null;
|
|
366
|
+
if ((e.dataFields ?? []).some((e) => void 0 === ye[e.showDataAs ?? "normal"] || void 0 === pe[e.subtotal ?? "sum"])) return null;
|
|
367
|
+
const m = xe(e, t, n, l?.calculatedRecords, f.operands);
|
|
368
|
+
if (!m) return null;
|
|
369
|
+
const { items: g, records: w, values: v, n: F } = m, b = (e) => !!e && (!e.noRecords || p(e)), I = e.form ?? "compact", x = (e) => {
|
|
370
|
+
const t = [];
|
|
371
|
+
for (const n of e ?? []) {
|
|
372
|
+
if (n === ce) {
|
|
373
|
+
t.push({
|
|
374
|
+
field: n,
|
|
375
|
+
form: I
|
|
376
|
+
});
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
const e = o[n], s = e?.subtotals;
|
|
380
|
+
if (!e || !b(a[n])) return null;
|
|
381
|
+
if (d && s && s.some((e) => "default" !== e)) return null;
|
|
382
|
+
t.push({
|
|
383
|
+
field: n,
|
|
384
|
+
form: e.form ?? "compact"
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
return t;
|
|
388
|
+
}, C = x(e.rowFields), E = x(e.columnFields), S = e.pageFields ?? [];
|
|
389
|
+
if (!C || !E || S.some((e) => !b(a[e.field]))) return null;
|
|
390
|
+
const P = A(e, s?.slicerFields);
|
|
391
|
+
return P.pageFields?.some((e) => !b(a[e.field])) ? null : Te(e, t, g, C, E, Se(r, P, g, w, v, C, E, F, l?.keep, l?.records, f.operands.length, l?.fieldValues, !0), n, !0 === s?.roles, "columns" === s?.cellOrder);
|
|
392
|
+
}, xe = (e, t, n, s, r = []) => {
|
|
393
|
+
const o = t.fields?.length ?? 0, a = U(t);
|
|
394
|
+
if (!t.records) return null;
|
|
395
|
+
const i = te(t, n.isDate1904());
|
|
396
|
+
if (!i) return null;
|
|
397
|
+
const l = !0 === t.fields?.some(p), d = l ? m(t.items, o) : a, u = l ? m(t.records, o) : i, c = t.recordCount ?? 0, f = s?.count ?? 0, h = c + f, g = (e, n) => {
|
|
398
|
+
const s = !t.fields?.[e]?.noRecords, r = s ? u[e] : i[e] ?? [], o = s ? d[e] : a[e], l = new Array(h);
|
|
399
|
+
for (let e = 0; e < c; e++) l[e] = G(o[r[e]]);
|
|
400
|
+
for (let e = 0; e < f; e++) l[c + e] = n?.[e] ?? null;
|
|
401
|
+
return l;
|
|
402
|
+
}, w = [...(e.dataFields ?? []).map((e, t) => g(e.field, s?.values[t])), ...r.map((e) => g(e))];
|
|
403
|
+
return {
|
|
404
|
+
items: a,
|
|
405
|
+
records: s ? i.map((e, t) => e.concat(s.ids[t] ?? [])) : i,
|
|
406
|
+
values: w,
|
|
407
|
+
n: h
|
|
408
|
+
};
|
|
409
|
+
}, Ae = async (e, t, n, s, r, o, a, i, l) => {
|
|
410
|
+
const d = y.peek(), u = e.dataFields?.[r];
|
|
411
|
+
if (!d || !e.fields || !u || void 0 === pe[u.subtotal ?? "sum"]) return null;
|
|
412
|
+
const c = [e.rowFields, e.columnFields].map((e) => (e ?? []).filter((e) => e !== ce)), f = c.findIndex((e) => e.includes(s)), m = c[f];
|
|
413
|
+
if (!m) return null;
|
|
414
|
+
const p = m.slice(0, m.indexOf(s)), h = e.fields.map((e) => {
|
|
415
|
+
const { blankRowAfter: t, showItemsWithNoData: n, sort: s, ...r } = e;
|
|
416
|
+
return {
|
|
417
|
+
...r,
|
|
418
|
+
items: e.items?.map((e) => {
|
|
419
|
+
if (!e.collapsed) return e;
|
|
420
|
+
const { collapsed: t, ...n } = e;
|
|
421
|
+
return n;
|
|
422
|
+
})
|
|
423
|
+
};
|
|
424
|
+
}), { columnGrandTotals: g, ...w } = e, { showDataAs: v, ...F } = u, b = {
|
|
425
|
+
...w,
|
|
426
|
+
fields: h,
|
|
427
|
+
rowFields: [...p, s],
|
|
428
|
+
columnFields: [],
|
|
429
|
+
dataFields: [F],
|
|
430
|
+
rowGrandTotals: !1
|
|
431
|
+
}, I = i ? {
|
|
432
|
+
...i,
|
|
433
|
+
values: [i.values[r] ?? []]
|
|
434
|
+
} : i, x = de(b, t);
|
|
435
|
+
if (!x || x.measures.length > 0 && !l) return null;
|
|
436
|
+
const A = xe(b, t, n, I, x.operands);
|
|
437
|
+
if (!A) return null;
|
|
438
|
+
const { items: C, records: E, values: S, n: P } = A, k = b.rowFields.map((e) => ({
|
|
439
|
+
field: e,
|
|
440
|
+
form: "compact"
|
|
441
|
+
}));
|
|
442
|
+
let M;
|
|
443
|
+
if (a) {
|
|
444
|
+
const e = 0 === f ? 1 : 2;
|
|
445
|
+
M = new Uint8Array(P);
|
|
446
|
+
for (let t = 0; t < P; t++) {
|
|
447
|
+
const n = a[t];
|
|
448
|
+
M[t] = (n & e ? 1 : 0) | (3 === n ? 2 : 0);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
const T = x.measures.length > 0 ? await Ee(d, x, b, C, E, S, k, [], P, o, M, l) : void 0, R = Se(d, b, C, E, S, k, [], P, o, M, x.operands.length, T), O = (t, n) => e.fields[t].items?.[n]?.item ?? n, N = /* @__PURE__ */ new Map(), $ = R.columns.length;
|
|
452
|
+
return R.rows.forEach((e, t) => {
|
|
453
|
+
if (0 !== e.kind || e.path.length !== p.length + 1) return;
|
|
454
|
+
const n = p.map((t, n) => O(t, e.path[n])).join(",");
|
|
455
|
+
let r = N.get(n);
|
|
456
|
+
r || N.set(n, r = {
|
|
457
|
+
ids: [],
|
|
458
|
+
totals: []
|
|
459
|
+
}), r.ids.push(O(s, e.path[p.length])), r.totals.push(R.values[t * $]);
|
|
460
|
+
}), {
|
|
461
|
+
outer: p,
|
|
462
|
+
groups: N,
|
|
463
|
+
records: E
|
|
464
|
+
};
|
|
465
|
+
}, Ce = (e, t, n) => {
|
|
466
|
+
const s = new Uint32Array(t).fill(fe), r = new Uint8Array(t), o = e.items;
|
|
467
|
+
if (o) o.forEach((e, n) => {
|
|
468
|
+
void 0 === e.item || void 0 !== e.type || e.item >= t || (s[e.item] = n, r[e.item] = (e.hidden ? 1 : 0) | (e.collapsed ? 2 : 0));
|
|
469
|
+
});
|
|
470
|
+
else for (let e = 0; e < t; e++) s[e] = e;
|
|
471
|
+
if (n) for (let e = 0; e < t; e++) n[e] || (r[e] |= 1);
|
|
472
|
+
return {
|
|
473
|
+
ranks: s,
|
|
474
|
+
flags: r
|
|
475
|
+
};
|
|
476
|
+
}, Ee = async (e, t, n, s, r, o, i, l, d, u, c, f) => {
|
|
477
|
+
const { request: m, errors: p } = Pe(e, n, s, r, o, i, l, d, u, c, t.operands.length);
|
|
478
|
+
let h = 0;
|
|
479
|
+
const g = [];
|
|
480
|
+
try {
|
|
481
|
+
const s = m.operands(0, p.codeOf(a.BuiltIn.NA), p.codeOf(a.BuiltIn.Null));
|
|
482
|
+
try {
|
|
483
|
+
h = s.cell_count();
|
|
484
|
+
const r = n.dataFields?.length ?? 0;
|
|
485
|
+
t.operands.forEach((t, n) => {
|
|
486
|
+
const o = s.values(r + n);
|
|
487
|
+
try {
|
|
488
|
+
const t = Q(e.wasm_memory().buffer, o, p), n = new Array(h);
|
|
489
|
+
for (let e = 0; e < h; e++) n[e] = t(e);
|
|
490
|
+
g.push(n);
|
|
491
|
+
} finally {
|
|
492
|
+
o.free();
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
} finally {
|
|
496
|
+
s.free();
|
|
497
|
+
}
|
|
498
|
+
} finally {
|
|
499
|
+
m.free();
|
|
500
|
+
}
|
|
501
|
+
return (async (e, t, n, s) => {
|
|
502
|
+
const r = n + 1, o = t.map((e) => {
|
|
503
|
+
const t = new Array(r);
|
|
504
|
+
for (let s = 0; s < n; s++) t[s] = e[s] ?? 0;
|
|
505
|
+
return t[n] = 0, t;
|
|
506
|
+
}), a = await s.evaluateBatch({
|
|
507
|
+
values: le(o, r),
|
|
508
|
+
formulas: e.formulas.map(({ expression: e }, n) => ({
|
|
509
|
+
expression: e,
|
|
510
|
+
coords: ie(t.length + n, r)
|
|
511
|
+
}))
|
|
512
|
+
}), i = /* @__PURE__ */ new Map();
|
|
513
|
+
for (const { data: t, formula: n } of e.measures) {
|
|
514
|
+
const e = new Array(r);
|
|
515
|
+
for (let t = 0; t < r; t++) e[t] = a[n].getValueAt(t, 0) ?? 0;
|
|
516
|
+
i.set(t, e);
|
|
517
|
+
}
|
|
518
|
+
return i;
|
|
519
|
+
})(t, g, h, f);
|
|
520
|
+
}, Se = (e, t, n, s, r, o, i, l, d, u, c = 0, f, m = !1) => {
|
|
521
|
+
const { request: p, errors: h } = Pe(e, t, n, s, r, o, i, l, d, u, c, f, m), g = h.codeOf(a.BuiltIn.NA), w = h.codeOf(a.BuiltIn.Null), v = p.lay_out(0, g, w);
|
|
522
|
+
try {
|
|
523
|
+
const n = ke(v.row_lines(), v.row_stride()), s = ke(v.column_lines(), v.column_stride()), r = v.states(), a = v.values();
|
|
524
|
+
try {
|
|
525
|
+
const l = Q(e.wasm_memory().buffer, a, h), d = new Array(r.length);
|
|
526
|
+
for (let e = 0; e < r.length; e++) d[e] = 0 === r[e] ? l(e) : null;
|
|
527
|
+
return {
|
|
528
|
+
rows: n,
|
|
529
|
+
columns: s,
|
|
530
|
+
states: r,
|
|
531
|
+
values: d,
|
|
532
|
+
functions: m ? Fe(t, [...o, ...i]) : []
|
|
533
|
+
};
|
|
534
|
+
} finally {
|
|
535
|
+
a.free();
|
|
536
|
+
}
|
|
537
|
+
} finally {
|
|
538
|
+
v.free(), p.free();
|
|
539
|
+
}
|
|
540
|
+
}, Pe = (e, t, n, s, r, o, a, i, l, d, u = 0, c, f = !1) => {
|
|
541
|
+
const m = t.fields, p = new e.LayoutRequest(i), h = f ? Fe(t, [...o, ...a]) : [], g = [], w = (e, s) => {
|
|
542
|
+
for (const { field: r, form: o } of s) {
|
|
543
|
+
if (r === ce) {
|
|
544
|
+
p.add_values_slot(e, "tabular" === o);
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
const a = m[r], i = a.subtotals, l = (!i || i.includes("default") ? 1 : 0) | (!1 !== a.subtotalsOnTop ? 2 : 0) | (a.blankRowAfter ? 4 : 0) | (a.showItemsWithNoData ? 8 : 0) | ("tabular" === o ? 16 : 0), d = p.add_field(e, n[r].length, l), u = a.sort;
|
|
548
|
+
void 0 !== u?.dataField && p.set_field_sort(e, d, u.dataField, "descending" === u.order, new Uint32Array((u.scope?.items ?? []).map((e) => e.item)));
|
|
549
|
+
const c = f ? ve(a) : [];
|
|
550
|
+
if (c.length > 0) {
|
|
551
|
+
const n = s[s.length - 1].field === r && be(t, s);
|
|
552
|
+
p.set_field_functions(e, d, new Uint32Array(c.map((e) => h.indexOf(e))), n);
|
|
553
|
+
}
|
|
554
|
+
g.push({
|
|
555
|
+
axis: e,
|
|
556
|
+
slot: d,
|
|
557
|
+
field: r
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
w(0, o), w(1, a);
|
|
562
|
+
const v = (t.pageFields ?? []).map((e) => ({
|
|
563
|
+
page: e,
|
|
564
|
+
index: p.add_page(n[e.field].length)
|
|
565
|
+
})), F = r.map(() => p.add_values(127)), b = t.dataFields ?? [];
|
|
566
|
+
b.forEach((e, t) => {
|
|
567
|
+
p.add_measure(t, pe[e.subtotal ?? "sum"]);
|
|
568
|
+
const n = ye[e.showDataAs ?? "normal"];
|
|
569
|
+
if (!n) return;
|
|
570
|
+
let s = 2, r = o.findIndex((t) => t.field === e.baseField);
|
|
571
|
+
r >= 0 ? s = 0 : (r = a.findIndex((t) => t.field === e.baseField), r >= 0 && (s = 1));
|
|
572
|
+
const i = "previous" === e.baseItem ? 4294967294 : "next" === e.baseItem ? 4294967295 : e.baseItem ?? 0;
|
|
573
|
+
p.set_show_as(t, n, s, Math.max(r, 0), i);
|
|
574
|
+
});
|
|
575
|
+
for (let e = 0; e < u; e++) p.add_measure(b.length + e, pe.sum);
|
|
576
|
+
u > 0 && p.set_operand_measures(u);
|
|
577
|
+
for (const e of h) b.forEach((t, n) => p.add_measure(n, ge[e]));
|
|
578
|
+
h.length > 0 && p.set_functions(h.length);
|
|
579
|
+
const y = [...c ?? []].map(([e, t]) => ({
|
|
580
|
+
column: t,
|
|
581
|
+
ptr: p.add_calculated(e, t.length - 1, 127)
|
|
582
|
+
}));
|
|
583
|
+
p.set_grand(!1 !== t.rowGrandTotals, !1 !== t.columnGrandTotals);
|
|
584
|
+
const I = d ? p.record_keep() : null, x = e.wasm_memory().buffer;
|
|
585
|
+
d && null !== I && new Uint8Array(x, I, i).set(d.subarray(0, i));
|
|
586
|
+
for (const { axis: e, slot: t, field: r } of g) {
|
|
587
|
+
const o = n[r].length;
|
|
588
|
+
new Uint32Array(x, p.field_ids(e, t), i).set(s[r].slice(0, i));
|
|
589
|
+
const { ranks: a, flags: d } = Ce(m[r], o, l?.get(r));
|
|
590
|
+
new Uint32Array(x, p.field_ranks(e, t), o).set(a), new Uint8Array(x, p.field_flags(e, t), o).set(d);
|
|
591
|
+
}
|
|
592
|
+
for (const { page: e, index: t } of v) {
|
|
593
|
+
const r = n[e.field].length;
|
|
594
|
+
new Uint32Array(x, p.page_ids(t), i).set(s[e.field].slice(0, i));
|
|
595
|
+
const { ranks: o, flags: a } = Ce(m[e.field], r), d = new Uint8Array(x, p.page_keep(t), r), u = void 0 !== e.item ? m[e.field].items?.[e.item]?.item : void 0, c = e.slicer ? l?.get(e.field) : void 0;
|
|
596
|
+
for (let t = 0; t < r; t++) {
|
|
597
|
+
const n = void 0 !== u ? t === u : !(o[t] === fe && m[e.field].items || 1 & a[t]);
|
|
598
|
+
d[t] = !n || c && 0 === c[t] ? 0 : 1;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
const A = new W();
|
|
602
|
+
F.forEach((e, t) => {
|
|
603
|
+
const n = {
|
|
604
|
+
doubles: new Float64Array(x, e, i),
|
|
605
|
+
ints: new Int32Array(x, e, 2 * i),
|
|
606
|
+
types: new Uint8Array(x, e + 8 * i, i)
|
|
607
|
+
}, s = {
|
|
608
|
+
ok: !0,
|
|
609
|
+
numeric: !0
|
|
610
|
+
}, o = r[t];
|
|
611
|
+
for (let e = 0; e < i; e++) Y(n, e, o[e], A, s);
|
|
612
|
+
});
|
|
613
|
+
for (const { column: e, ptr: t } of y) {
|
|
614
|
+
const n = e.length, s = {
|
|
615
|
+
doubles: new Float64Array(x, t, n),
|
|
616
|
+
ints: new Int32Array(x, t, 2 * n),
|
|
617
|
+
types: new Uint8Array(x, t + 8 * n, n)
|
|
618
|
+
}, r = {
|
|
619
|
+
ok: !0,
|
|
620
|
+
numeric: !0
|
|
621
|
+
};
|
|
622
|
+
for (let t = 0; t < n; t++) Y(s, t, e[t], A, r);
|
|
623
|
+
}
|
|
624
|
+
return {
|
|
625
|
+
request: p,
|
|
626
|
+
errors: A
|
|
627
|
+
};
|
|
628
|
+
}, ke = (e, t) => {
|
|
629
|
+
const n = [], s = 7 + t;
|
|
630
|
+
for (let t = 0; t + s <= e.length; t += s) {
|
|
631
|
+
const s = e[t + 1], r = e[t + 3], o = e[t + 5];
|
|
632
|
+
n.push({
|
|
633
|
+
kind: e[t],
|
|
634
|
+
path: Array.from(e.subarray(t + 7, t + 7 + s)),
|
|
635
|
+
data: r === me ? null : r,
|
|
636
|
+
function: o === me ? null : o,
|
|
637
|
+
across: 1 === e[t + 6]
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
return n;
|
|
641
|
+
}, Me = (e, t) => {
|
|
642
|
+
let n = [];
|
|
643
|
+
return e.map((e) => {
|
|
644
|
+
const s = { items: [] };
|
|
645
|
+
if (0 === e.kind) {
|
|
646
|
+
let t = 0;
|
|
647
|
+
for (; t < e.path.length - 1 && t < n.length && e.path[t] === n[t];) t++;
|
|
648
|
+
t > 0 && (s.repeat = t), s.items = e.path.slice(t), n = e.path;
|
|
649
|
+
} else s.type = 1 === e.kind ? null !== e.function ? t[e.function] : "default" : 2 === e.kind ? "grand" : "blank", s.items = 2 === e.kind ? [0] : e.path.slice();
|
|
650
|
+
return null !== e.data && e.data > 0 && (s.dataField = e.data), s;
|
|
651
|
+
});
|
|
652
|
+
}, Te = (e, t, n, r, o, i, l, u, f) => {
|
|
653
|
+
const m = e.fields, p = t.fields, h = e.dataFields ?? [], w = (t) => t === ce ? e.valuesCaption ?? "Values" : m[t].name ?? p[t].name, v = (e, t) => {
|
|
654
|
+
if (e === ce) return h[t]?.name ?? "";
|
|
655
|
+
const s = m[e].items?.[t];
|
|
656
|
+
if (void 0 !== s?.name) return s.name;
|
|
657
|
+
const r = G(n[e][s?.item ?? t]);
|
|
658
|
+
return null === r ? d : r;
|
|
659
|
+
}, F = (e, t) => {
|
|
660
|
+
const n = v(e, t);
|
|
661
|
+
if ("number" == typeof n) {
|
|
662
|
+
const r = m[e].items?.[t]?.item ?? t, o = void 0 === (m[e].numberFormat ?? p[e].numberFormat) && T(p[e], r);
|
|
663
|
+
return s(l, o ? O(q(p[e], r), l) : ((e) => O(m[e].numberFormat ?? p[e].numberFormat, l))(e), n);
|
|
664
|
+
}
|
|
665
|
+
return a.isError(n) ? n.getLabel() : "boolean" == typeof n ? n ? "TRUE" : "FALSE" : String(n);
|
|
666
|
+
}, y = (e) => {
|
|
667
|
+
if (void 0 !== e.item) return v(e.field, e.item);
|
|
668
|
+
const t = m[e.field].items ?? [];
|
|
669
|
+
if (!t.some((e) => e.hidden)) return "(All)";
|
|
670
|
+
const n = t.flatMap((e, t) => E(e) && !e.hidden ? [t] : []);
|
|
671
|
+
return 1 === n.length ? v(e.field, n[0]) : "(Multiple Items)";
|
|
672
|
+
}, I = e.grandTotalCaption ?? "Grand Total", x = u ? /* @__PURE__ */ new Map() : null, A = (e, t) => e === ce ? {
|
|
673
|
+
kind: "dataCaption",
|
|
674
|
+
data: t
|
|
675
|
+
} : {
|
|
676
|
+
kind: "item",
|
|
677
|
+
field: e,
|
|
678
|
+
rank: t
|
|
679
|
+
}, C = (e) => e === ce ? null : {
|
|
680
|
+
kind: "fieldCaption",
|
|
681
|
+
field: e
|
|
682
|
+
}, P = (e, t) => 2 === e.kind && t === I ? { kind: "grandTotal" } : null, k = 0 === r.length && 0 === o.length && 0 === h.length, M = k ? {
|
|
683
|
+
firstHeaderRow: 0,
|
|
684
|
+
firstDataRow: 0,
|
|
685
|
+
firstDataCol: 0
|
|
686
|
+
} : c(e), R = k ? [] : Me(i.rows, i.functions), N = k ? [] : Me(i.columns, i.functions), $ = g({
|
|
687
|
+
...e,
|
|
688
|
+
header: M,
|
|
689
|
+
rowLines: R,
|
|
690
|
+
columnLines: N
|
|
691
|
+
}), L = i.columns.length, _ = (e) => "row" === e ? r : o, D = (t) => {
|
|
692
|
+
switch (t.kind) {
|
|
693
|
+
case "pageCaption": {
|
|
694
|
+
const n = e.pageFields[t.page].field;
|
|
695
|
+
return [w(n), {
|
|
696
|
+
kind: "fieldCaption",
|
|
697
|
+
field: n
|
|
698
|
+
}];
|
|
699
|
+
}
|
|
700
|
+
case "pageItem": {
|
|
701
|
+
const n = e.pageFields[t.page];
|
|
702
|
+
return [y(n), {
|
|
703
|
+
kind: "pageItem",
|
|
704
|
+
page: t.page
|
|
705
|
+
}];
|
|
706
|
+
}
|
|
707
|
+
case "dataCaption": return [h[t.data]?.name ?? null, {
|
|
708
|
+
kind: "dataCaption",
|
|
709
|
+
data: t.data
|
|
710
|
+
}];
|
|
711
|
+
case "rowHeader": return [r.every((e) => e.field === ce) ? e.valuesCaption ?? "Values" : e.rowHeaderCaption ?? "Row Labels", { kind: "rowHeader" }];
|
|
712
|
+
case "columnHeader": return [e.columnHeaderCaption ?? "Column Labels", { kind: "columnHeader" }];
|
|
713
|
+
case "fieldCaption": {
|
|
714
|
+
const e = _(t.axis)[t.level].field;
|
|
715
|
+
return [w(e), C(e)];
|
|
716
|
+
}
|
|
717
|
+
case "label": {
|
|
718
|
+
const e = _(t.axis)[t.level].field, n = t.line.path[t.level];
|
|
719
|
+
return [v(e, n), A(e, n)];
|
|
720
|
+
}
|
|
721
|
+
case "total": {
|
|
722
|
+
const e = ("row" === t.axis ? i.rows : i.columns)[t.line.index], n = ((e, t) => {
|
|
723
|
+
const n = e.findIndex((e) => e.field === ce) >= t.path.length && null !== t.data, s = n ? h[t.data]?.name ?? "" : "";
|
|
724
|
+
if (2 === t.kind) return n ? `Total ${s}` : I;
|
|
725
|
+
const r = t.path.length - 1, o = e[r].field, a = F(o, t.path[r]);
|
|
726
|
+
if (null !== t.function) {
|
|
727
|
+
const e = we[i.functions[t.function]];
|
|
728
|
+
return (n || t.across) && null !== t.data ? `${a} ${e} of ${w(h[t.data].field)}` : `${a} ${e}`;
|
|
729
|
+
}
|
|
730
|
+
return m[o]?.subtotalCaption ?? (n ? `${a} ${s}` : `${a} Total`);
|
|
731
|
+
})(_(t.axis), e);
|
|
732
|
+
return [n, P(e, n)];
|
|
733
|
+
}
|
|
734
|
+
case "value": {
|
|
735
|
+
const n = t.row.index * L + t.column.index, s = i.states[n];
|
|
736
|
+
let r = null;
|
|
737
|
+
return 0 === s ? (r = i.values[n], e.showError && a.isError(r) && (r = e.errorCaption ?? "")) : 1 === s && (r = !1 === e.showEmpty ? 0 : ((e) => {
|
|
738
|
+
if (void 0 === e) return null;
|
|
739
|
+
const t = e.trim();
|
|
740
|
+
if (!/^[+-]?\d*(?:\.\d*)?$/.test(t)) return e;
|
|
741
|
+
const n = Number(t.replace(/^([+-]?)\.?$/, "$10"));
|
|
742
|
+
return Number.isFinite(n) ? n + 0 : e;
|
|
743
|
+
})(e.emptyCaption)), [r, null];
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
}, V = new S.Builder(), U = $.top, H = $.pages.reduce((e, t) => Math.max(e, t.column + 2), 0), B = (e, t) => {
|
|
747
|
+
const n = j($, e, t);
|
|
748
|
+
if (!n) return;
|
|
749
|
+
const [s, r] = D(n);
|
|
750
|
+
((e, t, n) => {
|
|
751
|
+
x && n && x.set(e + "," + t, n);
|
|
752
|
+
})(e - U, t, r), null !== s && (f ? V.pushAt(t, e - U, s) : V.pushAt(e - U, t, s));
|
|
753
|
+
};
|
|
754
|
+
if (f) {
|
|
755
|
+
const e = Math.max(H, $.columns.length);
|
|
756
|
+
for (let t = 0; t < e; t++) for (let e = 0; e < $.rows.length; e++) t < (e < U ? H : $.columns.length) && B(e, t);
|
|
757
|
+
} else for (let e = 0; e < $.rows.length; e++) {
|
|
758
|
+
const t = e < U ? H : $.columns.length;
|
|
759
|
+
for (let n = 0; n < t; n++) B(e, n);
|
|
760
|
+
}
|
|
761
|
+
if (k) {
|
|
762
|
+
const t = b(e);
|
|
763
|
+
return {
|
|
764
|
+
cells: V.build()?.tuples ?? [],
|
|
765
|
+
rows: 1,
|
|
766
|
+
columns: 1,
|
|
767
|
+
rowPageCount: t.rows,
|
|
768
|
+
columnPageCount: t.columns,
|
|
769
|
+
header: M,
|
|
770
|
+
rowLines: [],
|
|
771
|
+
columnLines: [],
|
|
772
|
+
viewValues: [],
|
|
773
|
+
firstKey: null,
|
|
774
|
+
...x ? { roles: x } : {}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
const z = (e, t) => {
|
|
778
|
+
const n = [];
|
|
779
|
+
return e.forEach((e, s) => {
|
|
780
|
+
e.field !== ce && n.push(s < t.path.length ? t.path[s] : -1);
|
|
781
|
+
}), n;
|
|
782
|
+
}, Q = (e, t) => K(e.data ?? t.data ?? 0, [...z(r, e), ...z(o, t)]), [W] = i.rows, [J] = i.columns, Y = W && J && 3 !== W.kind && 3 !== J.kind ? Q(W, J) : null, X = [], Z = (e) => 1 === e.kind && null !== e.function;
|
|
783
|
+
i.rows.forEach((t, n) => {
|
|
784
|
+
3 === t.kind || Z(t) || (z(r, t), i.columns.forEach((s, r) => {
|
|
785
|
+
const o = i.states[n * L + r];
|
|
786
|
+
if (3 === s.kind || Z(s) || 0 !== o && 1 !== o) return;
|
|
787
|
+
let l = 0 === o ? i.values[n * L + r] : 0;
|
|
788
|
+
e.showError && a.isError(l) && (l = e.errorCaption || 0), X.push([Q(t, s), l]);
|
|
789
|
+
}));
|
|
790
|
+
});
|
|
791
|
+
const ee = b(e);
|
|
792
|
+
return {
|
|
793
|
+
cells: V.build()?.tuples ?? [],
|
|
794
|
+
rows: $.rows.length - U,
|
|
795
|
+
columns: $.columns.length,
|
|
796
|
+
rowPageCount: ee.rows,
|
|
797
|
+
columnPageCount: ee.columns,
|
|
798
|
+
header: M,
|
|
799
|
+
rowLines: R,
|
|
800
|
+
columnLines: N,
|
|
801
|
+
viewValues: X,
|
|
802
|
+
firstKey: Y,
|
|
803
|
+
...x ? { roles: x } : {}
|
|
804
|
+
};
|
|
805
|
+
}, Re = (e, t, n, r, o = !1, i, l) => {
|
|
806
|
+
const d = Ie(e, t, r, {
|
|
807
|
+
filters: i,
|
|
808
|
+
slicerFields: l
|
|
809
|
+
});
|
|
810
|
+
if (!d) return null;
|
|
811
|
+
const u = d.rowPageCount > 0 ? d.rowPageCount + 1 : 0, c = d.rowPageCount > 0 ? 3 * d.columnPageCount - 1 : 0, { rowStart: f, colStart: m } = n;
|
|
812
|
+
if (f - u < 0) return null;
|
|
813
|
+
const h = {
|
|
814
|
+
rowStart: f - u,
|
|
815
|
+
colStart: m,
|
|
816
|
+
rowEnd: f + d.rows - 1,
|
|
817
|
+
colEnd: m + Math.max(d.columns, c) - 1
|
|
818
|
+
}, g = e.fields, w = t.fields, v = U(t), F = (e, t) => {
|
|
819
|
+
const n = g[e], o = n.numberFormat ?? w[e].numberFormat, i = O(o, r), l = p(w[e]), d = v[e], u = (n.items ?? []).filter((e) => void 0 !== e.item && void 0 === e.type), c = u.length > 0 ? u : d.map((e, t) => ({ item: t })), f = c.map((t) => {
|
|
820
|
+
const n = G(d[t.item]), u = T(w[e], t.item), c = null === n ? "(blank)" : "number" == typeof n ? s(r, u ? (f = t.item, void 0 === o ? O(q(w[e], f), r) : i) : i, n) : a.isError(n) ? n.getLabel() : "boolean" == typeof n ? n ? "TRUE" : "FALSE" : String(n);
|
|
821
|
+
var f;
|
|
822
|
+
const m = l && u ? c : n;
|
|
823
|
+
return void 0 !== t.name ? {
|
|
824
|
+
value: m,
|
|
825
|
+
text: c,
|
|
826
|
+
name: t.name
|
|
827
|
+
} : {
|
|
828
|
+
value: m,
|
|
829
|
+
text: c
|
|
830
|
+
};
|
|
831
|
+
}), m = {
|
|
832
|
+
name: n.name ?? w[e].name,
|
|
833
|
+
items: f
|
|
834
|
+
};
|
|
835
|
+
if (t) {
|
|
836
|
+
const e = void 0 !== t.item ? (n.items ?? [])[t.item]?.item : void 0;
|
|
837
|
+
m.page = void 0 !== e ? c.findIndex((t) => t.item === e) : -1;
|
|
838
|
+
}
|
|
839
|
+
return m;
|
|
840
|
+
}, b = (e) => (e ?? []).filter((e) => -2 !== e);
|
|
841
|
+
return {
|
|
842
|
+
view: {
|
|
843
|
+
range: h,
|
|
844
|
+
dataFields: (e.dataFields ?? []).map((e) => ({
|
|
845
|
+
name: e.name,
|
|
846
|
+
sourceName: w[e.field].name
|
|
847
|
+
})),
|
|
848
|
+
fields: [
|
|
849
|
+
...b(e.rowFields).map((e) => F(e)),
|
|
850
|
+
...b(e.columnFields).map((e) => F(e)),
|
|
851
|
+
...(e.pageFields ?? []).map((e) => F(e.field, e))
|
|
852
|
+
],
|
|
853
|
+
values: d.viewValues,
|
|
854
|
+
block: {
|
|
855
|
+
anchor: {
|
|
856
|
+
row: f,
|
|
857
|
+
column: m
|
|
858
|
+
},
|
|
859
|
+
...o ? { blocked: !0 } : {},
|
|
860
|
+
...null !== d.firstKey ? { first: d.firstKey } : {}
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
size: {
|
|
864
|
+
rows: d.rows,
|
|
865
|
+
columns: d.columns
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
}, Oe = async (e, t, n, r) => {
|
|
869
|
+
const o = /* @__PURE__ */ new Map(), i = (e.filters ?? []).filter((t) => D(t) || e.rowFields?.includes(t.field) || e.columnFields?.includes(t.field)), l = e.fields?.some((e) => e.items?.some((e) => e.calculated)), u = e.dataFields?.some((e) => f(t.fields?.[e.field]));
|
|
870
|
+
if (0 === i.length && !l && !u) return { keep: o };
|
|
871
|
+
const c = U(t);
|
|
872
|
+
for (const s of i.filter(D)) {
|
|
873
|
+
const a = s.field, i = c[a];
|
|
874
|
+
if (!i) continue;
|
|
875
|
+
const l = x(s.condition) ? Le(e, t, i, a, n) : null, d = new Array(i.length);
|
|
876
|
+
for (let e = 0; e < i.length; e++) d[e] = l ? l[e] : G(i[e]);
|
|
877
|
+
const u = await $e(s.condition, d, n, r), f = o.get(a);
|
|
878
|
+
if (f) for (let e = 0; e < u.length; e++) f[e] &= u[e];
|
|
879
|
+
else o.set(a, u);
|
|
880
|
+
}
|
|
881
|
+
const m = l && r ? await (async (e, t, n, r, o) => {
|
|
882
|
+
const i = t.fields ?? [], l = e.fields ?? [], u = i.flatMap((e, t) => e.calculatedItems?.length ? [t] : []), c = e.dataFields ?? [];
|
|
883
|
+
if (1 !== u.length || c.some((e) => f(i[e.field]) || !ue.has(e.subtotal ?? "sum"))) return null;
|
|
884
|
+
const m = u[0], p = i[m].calculatedItems, h = te(t, n.isDate1904());
|
|
885
|
+
if (!h) return null;
|
|
886
|
+
const g = U(t), v = U({
|
|
887
|
+
...t,
|
|
888
|
+
fields: i.map(({ group: e, ...t }) => t)
|
|
889
|
+
}), F = (e.rowFields ?? []).filter((e) => e >= 0), b = (e.columnFields ?? []).filter((e) => e >= 0), y = F.includes(m) ? F : b.includes(m) ? b : null;
|
|
890
|
+
if (!y) return null;
|
|
891
|
+
const I = y.slice(0, y.indexOf(m)), x = [...y.slice(y.indexOf(m) + 1), ...y === F ? b : F], A = [...I, ...x], C = t.recordCount ?? 0, E = (e, t) => {
|
|
892
|
+
const n = l[e]?.items, s = n?.find((e) => e.item === t && void 0 === e.type);
|
|
893
|
+
return !(n && (!s || s.hidden) || o?.get(e) && 0 === o.get(e)[t]);
|
|
894
|
+
}, S = (e, t) => {
|
|
895
|
+
const n = l[e.field]?.items;
|
|
896
|
+
if (void 0 !== e.item) return n?.[e.item]?.item === t;
|
|
897
|
+
const s = n?.find((e) => e.item === t && void 0 === e.type);
|
|
898
|
+
return !n || !!s && !s.hidden;
|
|
899
|
+
}, P = e.pageFields ?? [], k = O(i[m].numberFormat ?? 14, n), M = (e) => g[m].findIndex((t, r) => {
|
|
900
|
+
const o = G(t);
|
|
901
|
+
return "number" == typeof o && (i[m].dates || T(i[m], r)) ? w(s(n, k, o), e) : w(null === o ? d : H(o), e);
|
|
902
|
+
}), R = /* @__PURE__ */ new Map(), N = new Map(p.map((e) => [e.item, e.formula])), $ = (e) => {
|
|
903
|
+
let t = R.get(e);
|
|
904
|
+
return void 0 === t && R.set(e, t = R.size), t;
|
|
905
|
+
};
|
|
906
|
+
for (const e of p) if (null === oe(e.formula, (e, t) => {
|
|
907
|
+
if (null === t || !w(i[m].name, e)) return null;
|
|
908
|
+
const n = M(t);
|
|
909
|
+
return n < 0 ? null : (N.has(n) || $(n), "");
|
|
910
|
+
})) return null;
|
|
911
|
+
const L = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map(), D = c.map((e) => ({
|
|
912
|
+
column: h[e.field],
|
|
913
|
+
values: v[e.field],
|
|
914
|
+
fold: e.subtotal ?? "sum"
|
|
915
|
+
})), V = R.size;
|
|
916
|
+
for (let e = 0; e < C; e++) {
|
|
917
|
+
if (!P.every((t) => S(t, h[t.field][e]))) continue;
|
|
918
|
+
if (!A.every((t) => E(t, h[t][e]))) continue;
|
|
919
|
+
let t = "";
|
|
920
|
+
for (const n of I) t += h[n][e] + ",";
|
|
921
|
+
_.has(t) || _.set(t, e);
|
|
922
|
+
const n = R.get(h[m][e]);
|
|
923
|
+
if (void 0 === n) continue;
|
|
924
|
+
let s = t;
|
|
925
|
+
for (const t of x) s += h[t][e] + ",";
|
|
926
|
+
let r = L.get(s);
|
|
927
|
+
r || (r = {
|
|
928
|
+
sums: c.map(() => new Array(V).fill(0)),
|
|
929
|
+
errors: c.map(() => new Array(V).fill(void 0))
|
|
930
|
+
}, L.set(s, r));
|
|
931
|
+
const { sums: o, errors: i } = r;
|
|
932
|
+
D.forEach(({ column: t, values: s, fold: r }, l) => {
|
|
933
|
+
const d = G(s[t[e]]);
|
|
934
|
+
"sum" === r ? "number" == typeof d ? o[l][n] += d : a.isError(d) && (i[l][n] ??= d) : ("countNums" === r ? "number" == typeof d : null !== d) && (o[l][n] += 1);
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
const B = x.map((e) => {
|
|
938
|
+
const t = l[e]?.items;
|
|
939
|
+
return t ? t.flatMap((t) => void 0 !== t.item && void 0 === t.type && !t.missing && E(e, t.item) ? [t.item] : []) : g[e].map((e, t) => t);
|
|
940
|
+
});
|
|
941
|
+
if (B.reduce((e, t) => e * t.length, _.size) > 5e5) return null;
|
|
942
|
+
const z = [];
|
|
943
|
+
for (const [e, t] of _) {
|
|
944
|
+
const n = (e, s, r) => {
|
|
945
|
+
if (e !== B.length) for (const t of B[e]) n(e + 1, [...s, t], r + t + ",");
|
|
946
|
+
else z.push({
|
|
947
|
+
exemplar: t,
|
|
948
|
+
path: s,
|
|
949
|
+
key: r
|
|
950
|
+
});
|
|
951
|
+
};
|
|
952
|
+
n(0, [], e);
|
|
953
|
+
}
|
|
954
|
+
const j = z.length;
|
|
955
|
+
if (0 === j) return {
|
|
956
|
+
count: 0,
|
|
957
|
+
ids: i.map(() => []),
|
|
958
|
+
values: c.map(() => [])
|
|
959
|
+
};
|
|
960
|
+
const q = c.length * V, K = (e, t) => e * V + t, Q = (e, t) => q + e * p.length + t, W = [];
|
|
961
|
+
for (let e = 0; e < c.length; e++) for (let t = 0; t < V; t++) W.push(z.map(({ key: n }) => {
|
|
962
|
+
const s = L.get(n);
|
|
963
|
+
return s ? s.errors[e][t] ?? s.sums[e][t] : 0;
|
|
964
|
+
}));
|
|
965
|
+
const J = [];
|
|
966
|
+
for (let e = 0; e < c.length; e++) for (let t = 0; t < p.length; t++) {
|
|
967
|
+
const n = oe(p[t].formula, (t, n) => {
|
|
968
|
+
if (null === n) return null;
|
|
969
|
+
const s = M(n), r = p.findIndex((e) => e.item === s);
|
|
970
|
+
return ae(r >= 0 ? Q(e, r) : K(e, R.get(s)));
|
|
971
|
+
});
|
|
972
|
+
if (null === n) return null;
|
|
973
|
+
J.push({
|
|
974
|
+
expression: n,
|
|
975
|
+
coords: ie(Q(e, t), j)
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
const Y = await r.evaluateBatch({
|
|
979
|
+
values: le(W, j),
|
|
980
|
+
formulas: J
|
|
981
|
+
}), X = i.map(() => []), Z = c.map(() => []), ee = (e, t, n, s) => {
|
|
982
|
+
h.forEach((n, s) => {
|
|
983
|
+
const r = x.indexOf(s);
|
|
984
|
+
X[s].push(s === m ? t : r >= 0 ? e.path[r] : n[e.exemplar] ?? 0);
|
|
985
|
+
}), Z.forEach((e, t) => {
|
|
986
|
+
e.push(t === n ? s : null);
|
|
987
|
+
});
|
|
988
|
+
};
|
|
989
|
+
return z.forEach((e, t) => {
|
|
990
|
+
p.forEach(({ item: n }, s) => {
|
|
991
|
+
c.forEach((r, o) => {
|
|
992
|
+
const a = Y[o * p.length + s].getValueAt(t, 0) ?? 0;
|
|
993
|
+
if ("sum" !== (r.subtotal ?? "sum") && "number" == typeof a) for (let t = 0; t < Math.round(a); t++) ee(e, n, o, 1);
|
|
994
|
+
else ee(e, n, o, a);
|
|
995
|
+
});
|
|
996
|
+
});
|
|
997
|
+
}), {
|
|
998
|
+
count: X[0]?.length ?? 0,
|
|
999
|
+
ids: X,
|
|
1000
|
+
values: Z
|
|
1001
|
+
};
|
|
1002
|
+
})(e, t, n, r, o) : void 0, p = i.filter((e) => !D(e)).map((e, t) => ({
|
|
1003
|
+
filter: e,
|
|
1004
|
+
index: t
|
|
1005
|
+
})).sort((e, t) => (e.filter.evalOrder ?? -1) - (t.filter.evalOrder ?? -1) || e.index - t.index), h = (t.recordCount ?? 0) + (m?.count ?? 0);
|
|
1006
|
+
let g;
|
|
1007
|
+
const v = e.rowFields ?? [];
|
|
1008
|
+
for (const { filter: s } of p) {
|
|
1009
|
+
const a = await Ae(e, t, n, s.field, s.dataField, o, g, m, r);
|
|
1010
|
+
if (!a) continue;
|
|
1011
|
+
const i = /* @__PURE__ */ new Set();
|
|
1012
|
+
for (const [e, t] of a.groups) {
|
|
1013
|
+
const o = await $e(s.condition, t.totals, n, r);
|
|
1014
|
+
t.ids.forEach((t, n) => {
|
|
1015
|
+
o[n] || i.add(`${e}|${t}`);
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
if (0 === i.size) continue;
|
|
1019
|
+
g ??= new Uint8Array(h).fill(3);
|
|
1020
|
+
const l = a.outer.map((e) => a.records[e]), d = a.records[s.field], u = v.includes(s.field) ? 1 : 2;
|
|
1021
|
+
for (let e = 0; e < h; e++) {
|
|
1022
|
+
if (!(g[e] & u)) continue;
|
|
1023
|
+
let t = "";
|
|
1024
|
+
for (let n = 0; n < l.length; n++) t += (n > 0 ? "," : "") + l[n][e];
|
|
1025
|
+
i.has(`${t}|${d[e]}`) && (g[e] &= ~u);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
const F = u && r ? await (async (e, t, n, s, r, o, a) => {
|
|
1029
|
+
const i = y.peek(), l = de(e, t);
|
|
1030
|
+
if (!i || !l) return null;
|
|
1031
|
+
const d = xe(e, t, n, a, l.operands);
|
|
1032
|
+
if (!d) return null;
|
|
1033
|
+
const u = (t) => (t ?? []).map((t) => ({
|
|
1034
|
+
field: t,
|
|
1035
|
+
form: t === ce ? e.form ?? "compact" : e.fields?.[t]?.form ?? "compact"
|
|
1036
|
+
}));
|
|
1037
|
+
return Ee(i, l, e, d.items, d.records, d.values, u(e.rowFields), u(e.columnFields), d.n, r, o, s);
|
|
1038
|
+
})(e, t, n, r, o, g, m) : void 0;
|
|
1039
|
+
return {
|
|
1040
|
+
keep: o,
|
|
1041
|
+
...g ? { records: g } : {},
|
|
1042
|
+
...m ? { calculatedRecords: m } : {},
|
|
1043
|
+
...F ? { fieldValues: F } : {}
|
|
1044
|
+
};
|
|
1045
|
+
}, Ne = (e, t) => {
|
|
1046
|
+
const n = e.filters;
|
|
1047
|
+
if (!n) return e;
|
|
1048
|
+
let s = !1;
|
|
1049
|
+
const r = n.map((e) => {
|
|
1050
|
+
const n = e.condition && F(e.condition, t);
|
|
1051
|
+
return n === e.condition ? e : (s = !0, {
|
|
1052
|
+
...e,
|
|
1053
|
+
condition: n
|
|
1054
|
+
});
|
|
1055
|
+
});
|
|
1056
|
+
return s ? {
|
|
1057
|
+
...e,
|
|
1058
|
+
filters: r
|
|
1059
|
+
} : e;
|
|
1060
|
+
}, $e = async (e, t, n, s) => {
|
|
1061
|
+
const r = t.length, o = new Uint8Array(r);
|
|
1062
|
+
if (0 === r) return o;
|
|
1063
|
+
const a = new i();
|
|
1064
|
+
for (let e = 0; e < r; e++) null !== t[e] && a.setValueAt(e, 0, t[e]);
|
|
1065
|
+
let l = !1;
|
|
1066
|
+
return await B({
|
|
1067
|
+
conditions: [e],
|
|
1068
|
+
runtime: n,
|
|
1069
|
+
calculation: s ?? null,
|
|
1070
|
+
values: a,
|
|
1071
|
+
coords: {
|
|
1072
|
+
rowStart: 0,
|
|
1073
|
+
rowEnd: r - 1,
|
|
1074
|
+
colStart: 0,
|
|
1075
|
+
colEnd: 0
|
|
1076
|
+
},
|
|
1077
|
+
onTrue: (e) => {
|
|
1078
|
+
l = !0, o[e.rowIndex] = 1;
|
|
1079
|
+
},
|
|
1080
|
+
onFalse: () => {
|
|
1081
|
+
l = !0;
|
|
1082
|
+
},
|
|
1083
|
+
onBlank: (e) => {
|
|
1084
|
+
l = !0;
|
|
1085
|
+
for (let n = 0; n < r; n++) null === t[n] && e(n, 0) && (o[n] = 1);
|
|
1086
|
+
}
|
|
1087
|
+
}), l || o.fill(1), o;
|
|
1088
|
+
}, Le = (e, t, n, r, o) => {
|
|
1089
|
+
const i = e.fields?.[r], l = /* @__PURE__ */ new Map();
|
|
1090
|
+
for (const e of i?.items ?? []) void 0 !== e.item && void 0 === e.type && void 0 !== e.name && l.set(e.item, e.name);
|
|
1091
|
+
const u = i?.numberFormat ?? t.fields?.[r]?.numberFormat, c = O(u, o), f = (e) => void 0 === u ? O(q(t.fields?.[r], e), o) : c, m = new Array(n.length);
|
|
1092
|
+
for (let e = 0; e < n.length; e++) {
|
|
1093
|
+
const i = l.get(e);
|
|
1094
|
+
if (void 0 !== i) {
|
|
1095
|
+
m[e] = i;
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
1098
|
+
const u = G(n[e]);
|
|
1099
|
+
null === u ? m[e] = d : "number" == typeof u ? m[e] = s(o, T(t.fields?.[r], e) ? f(e) : c, u) : "boolean" == typeof u ? m[e] = u ? "TRUE" : "FALSE" : a.isError(u) ? m[e] = u.getLabel() : m[e] = String(u);
|
|
1100
|
+
}
|
|
1101
|
+
return m;
|
|
1102
|
+
}, _e = (e) => {
|
|
1103
|
+
const t = e.getCoords(), n = t.colEnd - t.colStart + 1, s = t.rowEnd - t.rowStart, r = e.getWorksheet(), o = r.getRange({
|
|
1104
|
+
rowStart: t.rowStart,
|
|
1105
|
+
rowEnd: t.rowStart,
|
|
1106
|
+
colStart: t.colStart,
|
|
1107
|
+
colEnd: t.colEnd
|
|
1108
|
+
}).getValues()[0] ?? [], a = [];
|
|
1109
|
+
for (let e = 0; e < n; e++) {
|
|
1110
|
+
const n = o[e] ?? null, i = new J(), l = new Uint32Array(s);
|
|
1111
|
+
let d, u, c = !1, f = i.values;
|
|
1112
|
+
if (s > 0) {
|
|
1113
|
+
const n = r.getRange({
|
|
1114
|
+
rowStart: t.rowStart + 1,
|
|
1115
|
+
rowEnd: t.rowEnd,
|
|
1116
|
+
colStart: t.colStart + e,
|
|
1117
|
+
colEnd: t.colStart + e
|
|
1118
|
+
});
|
|
1119
|
+
i.fill(n.getValuesRange(), l), d = Ve(n, s);
|
|
1120
|
+
const o = Ue(n, t.rowStart + 1, l, i.values);
|
|
1121
|
+
c = o.dates, u = o.dateIds, f = o.values;
|
|
1122
|
+
}
|
|
1123
|
+
a.push({
|
|
1124
|
+
header: De(n),
|
|
1125
|
+
ids: l,
|
|
1126
|
+
values: f,
|
|
1127
|
+
numberFormat: d,
|
|
1128
|
+
dates: c,
|
|
1129
|
+
...u ? { dateIds: u } : {}
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
return {
|
|
1133
|
+
columns: a,
|
|
1134
|
+
recordCount: s
|
|
1135
|
+
};
|
|
1136
|
+
}, De = (e) => null == e ? "" : "boolean" == typeof e ? e ? "TRUE" : "FALSE" : a.isError(e) ? e.getLabel() : String(e), Ve = (e, t) => {
|
|
1137
|
+
const n = [...e.getRegions("numberFormat")];
|
|
1138
|
+
if (1 !== n.length || n[0].getRowCount() !== t) return;
|
|
1139
|
+
const s = n[0].getCell().getStyle().getNumberFormat();
|
|
1140
|
+
return s && "General" !== s ? s : void 0;
|
|
1141
|
+
}, Ue = (e, t, n, s) => {
|
|
1142
|
+
const r = [];
|
|
1143
|
+
for (const n of e.getRegions("dateFormat")) {
|
|
1144
|
+
const { rowStart: e, rowEnd: s } = n.getCoords();
|
|
1145
|
+
r.push([e - t, s - t]);
|
|
1146
|
+
}
|
|
1147
|
+
if (0 === r.length) return {
|
|
1148
|
+
dates: !1,
|
|
1149
|
+
values: s
|
|
1150
|
+
};
|
|
1151
|
+
r.sort((e, t) => e[0] - t[0]);
|
|
1152
|
+
let o = !1, a = !1;
|
|
1153
|
+
for (let e = 0; e < n.length && (!o || !a); e++) "number" == typeof s[n[e]] && (He(r, e) ? o = !0 : a = !0);
|
|
1154
|
+
if (!o || !a) return {
|
|
1155
|
+
dates: o,
|
|
1156
|
+
values: s
|
|
1157
|
+
};
|
|
1158
|
+
const i = s.slice(), l = /* @__PURE__ */ new Map();
|
|
1159
|
+
for (let e = 0; e < n.length; e++) {
|
|
1160
|
+
const t = n[e];
|
|
1161
|
+
if ("number" != typeof s[t] || !He(r, e)) continue;
|
|
1162
|
+
let o = l.get(t);
|
|
1163
|
+
void 0 === o && (o = i.length, i.push(s[t]), l.set(t, o)), n[e] = o;
|
|
1164
|
+
}
|
|
1165
|
+
return {
|
|
1166
|
+
dates: !1,
|
|
1167
|
+
dateIds: new Set(l.values()),
|
|
1168
|
+
values: i
|
|
1169
|
+
};
|
|
1170
|
+
}, He = (e, t) => {
|
|
1171
|
+
let n = 0, s = e.length - 1;
|
|
1172
|
+
for (; n <= s;) {
|
|
1173
|
+
const r = n + s >> 1, [o, a] = e[r];
|
|
1174
|
+
if (t < o) s = r - 1;
|
|
1175
|
+
else {
|
|
1176
|
+
if (!(t > a)) return !0;
|
|
1177
|
+
n = r + 1;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
return !1;
|
|
1181
|
+
}, Be = (e) => null == e ? {
|
|
1182
|
+
t: "z",
|
|
1183
|
+
v: 0
|
|
1184
|
+
} : a.isError(e) ? {
|
|
1185
|
+
t: "e",
|
|
1186
|
+
v: e.getCode()
|
|
1187
|
+
} : e, ze = (e, t) => (t && "number" == typeof e ? "date:" : "") + P(G(e)), je = (e, t, n, s = !1) => {
|
|
1188
|
+
const r = e.fields ?? [], o = m(e.items, r.length), a = /\smissingItemsLimit="0"/.test(e.rest ?? ""), i = ((e) => {
|
|
1189
|
+
const t = /* @__PURE__ */ new Set();
|
|
1190
|
+
return e.map((e, n) => {
|
|
1191
|
+
const s = "" === e ? `Field${n + 1}` : e;
|
|
1192
|
+
let r = s;
|
|
1193
|
+
for (let e = 2; t.has(r.toLocaleLowerCase()); e++) r = `${s}${e}`;
|
|
1194
|
+
return t.add(r.toLocaleLowerCase()), r;
|
|
1195
|
+
});
|
|
1196
|
+
})(t.columns.map((e) => e.header)), l = /* @__PURE__ */ new Map();
|
|
1197
|
+
r.forEach((e, t) => {
|
|
1198
|
+
const n = e.name.toLocaleLowerCase();
|
|
1199
|
+
e.noRecords || l.has(n) || l.set(n, t);
|
|
1200
|
+
});
|
|
1201
|
+
const d = t.recordCount, u = r.map(() => -1), c = r.map((e, t) => o[t].map(() => -1)), h = [], g = [], w = [], v = [], F = [], b = [], y = [], I = (e, t, n) => {
|
|
1202
|
+
v[t] = n.items, b[t] = n.items.length, y[t] = !0, c[e] = ((e, t) => {
|
|
1203
|
+
const n = /* @__PURE__ */ new Map();
|
|
1204
|
+
return t.forEach((e, t) => {
|
|
1205
|
+
n.set(e, t);
|
|
1206
|
+
}), e.map((s, r) => 0 === r ? 0 : r === e.length - 1 ? t.length - 1 : n.get(s) ?? -1);
|
|
1207
|
+
})(r[e].group.items, n.items);
|
|
1208
|
+
};
|
|
1209
|
+
t.columns.forEach((e, t) => {
|
|
1210
|
+
const n = l.get(i[t].toLocaleLowerCase());
|
|
1211
|
+
void 0 !== n && (l.delete(i[t].toLocaleLowerCase()), u[n] = t);
|
|
1212
|
+
const f = new Int32Array(e.values.length).fill(-1), m = [], x = [], A = new Array(d);
|
|
1213
|
+
for (let t = 0; t < d; t++) {
|
|
1214
|
+
const n = e.ids[t];
|
|
1215
|
+
let s = f[n];
|
|
1216
|
+
s < 0 && (s = f[n] = m.length, m.push(Be(e.values[n])), x.push(e.dates || !!e.dateIds?.has(n))), A[t] = s;
|
|
1217
|
+
}
|
|
1218
|
+
const C = (e) => void 0 !== n && (!!r[n].dates || T(r[n], e)), E = m.length, S = void 0 !== n ? !0 === r[n].inline : m.every((e) => "number" == typeof e || "object" == typeof e && "z" === e?.t), P = [];
|
|
1219
|
+
if (void 0 !== n && S) {
|
|
1220
|
+
const e = /* @__PURE__ */ new Map();
|
|
1221
|
+
for (let t = 0; t < E; t++) e.set(ze(m[t], x[t]), t);
|
|
1222
|
+
o[n].forEach((t, s) => {
|
|
1223
|
+
c[n][s] = e.get(ze(t, C(s))) ?? -1;
|
|
1224
|
+
});
|
|
1225
|
+
} else if (void 0 !== n) {
|
|
1226
|
+
const e = /* @__PURE__ */ new Map();
|
|
1227
|
+
for (let t = 0; t < E; t++) e.set(ze(m[t], x[t]), t);
|
|
1228
|
+
const t = new Set(r[n].calculatedItems?.map((e) => e.item));
|
|
1229
|
+
o[n].forEach((s, r) => {
|
|
1230
|
+
if (t.has(r)) return;
|
|
1231
|
+
const o = ze(s, C(r));
|
|
1232
|
+
let i = e.get(o);
|
|
1233
|
+
void 0 !== i || a || C(r) || (i = m.length, m.push(s), x.push(C(r)), P.push(i), e.set(o, i)), c[n][r] = i ?? -1;
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
const k = { name: i[t] };
|
|
1237
|
+
S && (k.inline = !0), void 0 !== e.numberFormat && (k.numberFormat = e.numberFormat);
|
|
1238
|
+
const M = [];
|
|
1239
|
+
let R = !1;
|
|
1240
|
+
m.forEach((e, t) => {
|
|
1241
|
+
"number" == typeof e && (x[t] ? M.push(t) : R = !0);
|
|
1242
|
+
}), M.length > 0 && !R ? k.dates = !0 : M.length > 0 && (k.dateItems = M), F[t] = k.dateItems ? new Set(k.dateItems) : void 0, P.length > 0 && (k.unused = P);
|
|
1243
|
+
const O = void 0 !== n ? r[n].rest : void 0;
|
|
1244
|
+
O && (k.rest = O);
|
|
1245
|
+
const N = void 0 !== n ? r[n].calculatedItems : void 0;
|
|
1246
|
+
N?.length && (k.calculatedItems = N.map(({ item: e, formula: t }) => {
|
|
1247
|
+
const s = m.length;
|
|
1248
|
+
return m.push(o[n][e]), c[n][e] = s, {
|
|
1249
|
+
item: s,
|
|
1250
|
+
formula: t
|
|
1251
|
+
};
|
|
1252
|
+
})), h.push(k), g.push([t, [[0, m]]]), w.push([t, [[0, A]]]), v.push(m), b.push(E), y.push(!1);
|
|
1253
|
+
const $ = void 0 !== n ? r[n].group : void 0;
|
|
1254
|
+
if ($?.range && $.base === n) {
|
|
1255
|
+
const e = re($, m.slice(0, E).map(G), s);
|
|
1256
|
+
e ? (k.group = {
|
|
1257
|
+
...e,
|
|
1258
|
+
base: t
|
|
1259
|
+
}, I(n, t, e)) : c[n] = o[n].map(() => -1);
|
|
1260
|
+
} else $ && !p(r[n]) && (k.group = $);
|
|
1261
|
+
}), r.forEach((e, t) => {
|
|
1262
|
+
if (!e.noRecords) return;
|
|
1263
|
+
if (f(e)) return u[t] = h.length, h.push(e), v.push([]), b.push(0), void y.push(!1);
|
|
1264
|
+
const n = e.group;
|
|
1265
|
+
if (!n) return;
|
|
1266
|
+
const r = u[n.base];
|
|
1267
|
+
if (void 0 === r || r < 0) return;
|
|
1268
|
+
const o = v[r];
|
|
1269
|
+
let a, i = [];
|
|
1270
|
+
if (n.range) a = re(n, o.slice(0, b[r]).map(G), s);
|
|
1271
|
+
else {
|
|
1272
|
+
const e = Ge(n, c[n.base], o, h[r]);
|
|
1273
|
+
a = e.group, i = e.itemMap;
|
|
1274
|
+
}
|
|
1275
|
+
if (!a) return;
|
|
1276
|
+
const l = h.length;
|
|
1277
|
+
u[t] = l, h.push({
|
|
1278
|
+
...e,
|
|
1279
|
+
group: {
|
|
1280
|
+
...a,
|
|
1281
|
+
base: r
|
|
1282
|
+
}
|
|
1283
|
+
}), v.push(a.items), F[l] = a.dateItems ? new Set(a.dateItems) : void 0, b.push(a.items.length), y.push(!1), n.range ? I(t, l, a) : c[t] = i;
|
|
1284
|
+
}), h.forEach((e, t) => {
|
|
1285
|
+
const n = e.group;
|
|
1286
|
+
if (void 0 === n?.parent) return;
|
|
1287
|
+
const s = u[n.parent], { parent: r, ...o } = n;
|
|
1288
|
+
void 0 !== s && s >= 0 ? e.group = {
|
|
1289
|
+
...n,
|
|
1290
|
+
parent: s
|
|
1291
|
+
} : p(e) ? e.group = o : delete e.group, e.group && !p(e) && (e.group = {
|
|
1292
|
+
...e.group,
|
|
1293
|
+
base: t
|
|
1294
|
+
});
|
|
1295
|
+
});
|
|
1296
|
+
const { cacheId: x, part: A, partFormats: C, fields: E, items: S, records: P, ...k } = e;
|
|
1297
|
+
return {
|
|
1298
|
+
model: {
|
|
1299
|
+
...k,
|
|
1300
|
+
source: n ?? e.source,
|
|
1301
|
+
fields: h,
|
|
1302
|
+
items: g,
|
|
1303
|
+
records: w,
|
|
1304
|
+
recordCount: d
|
|
1305
|
+
},
|
|
1306
|
+
remap: {
|
|
1307
|
+
fields: u,
|
|
1308
|
+
items: c,
|
|
1309
|
+
newItems: v,
|
|
1310
|
+
usedCounts: b,
|
|
1311
|
+
inItemOrder: y,
|
|
1312
|
+
dateItems: F
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
}, Ge = (e, t, n, s) => {
|
|
1316
|
+
const r = /* @__PURE__ */ new Set(), o = new Array(n.length).fill(-1);
|
|
1317
|
+
(e.discrete ?? []).forEach((e, n) => {
|
|
1318
|
+
const s = t?.[n] ?? -1;
|
|
1319
|
+
s < 0 || (o[s] = e, r.add(e));
|
|
1320
|
+
});
|
|
1321
|
+
const a = [], i = [], l = new Set(e.dateItems), d = e.items.map((e, t) => r.has(t) ? (l.has(t) && i.push(a.length), a.push(e), a.length - 1) : -1), u = o.map((e, t) => e >= 0 ? d[e] : ((s.dates || T(s, t)) && i.push(a.length), a.push(n[t]), a.length - 1)), { dateItems: c, ...f } = e;
|
|
1322
|
+
return {
|
|
1323
|
+
group: {
|
|
1324
|
+
...f,
|
|
1325
|
+
items: a,
|
|
1326
|
+
discrete: u,
|
|
1327
|
+
...i.length > 0 ? { dateItems: i } : {}
|
|
1328
|
+
},
|
|
1329
|
+
itemMap: d
|
|
1330
|
+
};
|
|
1331
|
+
}, qe = (e, t, n = !1, s = !1) => {
|
|
1332
|
+
const r = (e, t) => null === e ? 5 : "number" == typeof e ? t ? 3 : 0 : "string" == typeof e ? 1 : "boolean" == typeof e ? 2 : 4, o = r(e, n), a = r(t, s);
|
|
1333
|
+
return o !== a ? o - a : 0 === o || 3 === o ? e - t : 1 === o ? e.localeCompare(t, void 0, { sensitivity: "base" }) : 2 === o ? Number(e) - Number(t) : 4 === o ? e.getCode() - t.getCode() : 0;
|
|
1334
|
+
}, Ke = (e, t) => {
|
|
1335
|
+
const n = e.fields ?? [], s = t.newItems.length, r = (e) => e < 0 ? e : t.fields[e] ?? -1, o = (e) => e < 0 || r(e) >= 0, a = e.dataFields ?? [], i = [], l = [];
|
|
1336
|
+
a.forEach((e) => {
|
|
1337
|
+
if (!o(e.field)) return void i.push(-1);
|
|
1338
|
+
i.push(l.length);
|
|
1339
|
+
const t = {
|
|
1340
|
+
...e,
|
|
1341
|
+
field: r(e.field)
|
|
1342
|
+
};
|
|
1343
|
+
void 0 !== e.baseField && (o(e.baseField) ? t.baseField = r(e.baseField) : delete t.baseField), l.push(t);
|
|
1344
|
+
});
|
|
1345
|
+
const d = n.map(() => null), u = [];
|
|
1346
|
+
for (let e = 0; e < s; e++) u.push({});
|
|
1347
|
+
n.forEach((e, n) => {
|
|
1348
|
+
const s = r(n);
|
|
1349
|
+
if (s < 0) return;
|
|
1350
|
+
const o = { ...e };
|
|
1351
|
+
if (void 0 !== e.sort?.dataField) {
|
|
1352
|
+
const t = i[e.sort.dataField];
|
|
1353
|
+
o.sort = t >= 0 ? {
|
|
1354
|
+
...e.sort,
|
|
1355
|
+
dataField: t
|
|
1356
|
+
} : { order: e.sort.order };
|
|
1357
|
+
}
|
|
1358
|
+
if (e.items) {
|
|
1359
|
+
const { items: r, positions: a } = We(e, t.items[n], t.newItems[s], t.usedCounts[s], t.inItemOrder[s], t.dateItems[s]);
|
|
1360
|
+
o.items = r, d[n] = a;
|
|
1361
|
+
}
|
|
1362
|
+
u[s] = o;
|
|
1363
|
+
}), n.forEach((e, t) => {
|
|
1364
|
+
const n = e.sort?.scope, s = r(t);
|
|
1365
|
+
if (!n || s < 0 || void 0 === u[s].sort?.scope) return;
|
|
1366
|
+
const o = n.items.map((e) => ({
|
|
1367
|
+
field: r(e.field),
|
|
1368
|
+
item: d[e.field]?.[e.item] ?? -1
|
|
1369
|
+
}));
|
|
1370
|
+
o.some((e) => e.field < 0 || e.item < 0) ? delete u[s].sort : u[s].sort = {
|
|
1371
|
+
...u[s].sort,
|
|
1372
|
+
scope: {
|
|
1373
|
+
...n,
|
|
1374
|
+
items: o
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
});
|
|
1378
|
+
const c = (e) => {
|
|
1379
|
+
if (!e) return;
|
|
1380
|
+
let t = e.filter(o).map(r);
|
|
1381
|
+
return l.length < 2 && (t = t.filter((e) => -2 !== e)), t.length > 0 ? t : void 0;
|
|
1382
|
+
}, f = {
|
|
1383
|
+
...e,
|
|
1384
|
+
fields: u
|
|
1385
|
+
};
|
|
1386
|
+
Qe(f, "rowFields", c(e.rowFields)), Qe(f, "columnFields", c(e.columnFields)), Qe(f, "dataFields", l.length > 0 ? l : void 0), a.forEach((e, t) => {
|
|
1387
|
+
const n = i[t];
|
|
1388
|
+
if (n < 0 || void 0 === e.baseField || "number" != typeof e.baseItem) return;
|
|
1389
|
+
const s = d[e.baseField]?.[e.baseItem];
|
|
1390
|
+
void 0 !== s && s >= 0 && (l[n].baseItem = s);
|
|
1391
|
+
});
|
|
1392
|
+
const m = (e.pageFields ?? []).flatMap((e) => {
|
|
1393
|
+
if (!o(e.field)) return [];
|
|
1394
|
+
const t = { field: r(e.field) };
|
|
1395
|
+
if (void 0 !== e.item) {
|
|
1396
|
+
const n = Ye(u[t.field].items ?? [], d[e.field]?.[e.item] ?? -1);
|
|
1397
|
+
void 0 !== n && (t.item = n);
|
|
1398
|
+
}
|
|
1399
|
+
return [t];
|
|
1400
|
+
});
|
|
1401
|
+
Qe(f, "pageFields", m.length > 0 ? m : void 0);
|
|
1402
|
+
const p = (e.filters ?? []).flatMap((e) => {
|
|
1403
|
+
if (!o(e.field)) return [];
|
|
1404
|
+
const t = {
|
|
1405
|
+
...e,
|
|
1406
|
+
field: r(e.field)
|
|
1407
|
+
};
|
|
1408
|
+
if (void 0 !== e.dataField) {
|
|
1409
|
+
const n = i[e.dataField];
|
|
1410
|
+
if (void 0 === n || n < 0) return [];
|
|
1411
|
+
t.dataField = n;
|
|
1412
|
+
}
|
|
1413
|
+
return [t];
|
|
1414
|
+
});
|
|
1415
|
+
Qe(f, "filters", p.length > 0 ? p : void 0);
|
|
1416
|
+
const h = (e) => Xe(e, r, o, d, i), g = (e.formats ?? []).flatMap((e) => {
|
|
1417
|
+
const t = h(e.area);
|
|
1418
|
+
return t ? [{
|
|
1419
|
+
...e,
|
|
1420
|
+
area: t
|
|
1421
|
+
}] : [];
|
|
1422
|
+
});
|
|
1423
|
+
Qe(f, "formats", g.length > 0 ? g : void 0);
|
|
1424
|
+
const w = (e.conditionalFormats ?? []).flatMap((e) => {
|
|
1425
|
+
const t = e.areas.flatMap((e) => {
|
|
1426
|
+
const t = h(e);
|
|
1427
|
+
return t ? [t] : [];
|
|
1428
|
+
});
|
|
1429
|
+
return t.length > 0 ? [{
|
|
1430
|
+
...e,
|
|
1431
|
+
areas: t
|
|
1432
|
+
}] : [];
|
|
1433
|
+
});
|
|
1434
|
+
return Qe(f, "conditionalFormats", w.length > 0 ? w : void 0), f;
|
|
1435
|
+
}, Qe = (e, t, n) => {
|
|
1436
|
+
void 0 === n ? delete e[t] : e[t] = n;
|
|
1437
|
+
}, We = (e, t, n, s, r = !1, o) => {
|
|
1438
|
+
const a = e.items ?? [], i = [], l = [], d = /* @__PURE__ */ new Set();
|
|
1439
|
+
for (const e of a) {
|
|
1440
|
+
if (!E(e)) {
|
|
1441
|
+
l.push(i.length), i.push(e);
|
|
1442
|
+
continue;
|
|
1443
|
+
}
|
|
1444
|
+
const n = t[e.item] ?? -1;
|
|
1445
|
+
if (n < 0) {
|
|
1446
|
+
l.push(-1);
|
|
1447
|
+
continue;
|
|
1448
|
+
}
|
|
1449
|
+
d.add(n);
|
|
1450
|
+
const r = {
|
|
1451
|
+
...e,
|
|
1452
|
+
item: n
|
|
1453
|
+
};
|
|
1454
|
+
n >= s && !e.calculated ? r.missing = !0 : delete r.missing, l.push(i.length), i.push(r);
|
|
1455
|
+
}
|
|
1456
|
+
const u = [];
|
|
1457
|
+
for (let e = 0; e < n.length; e++) d.has(e) || u.push(e);
|
|
1458
|
+
if (r) {
|
|
1459
|
+
const t = void 0 === e.sort?.dataField && "descending" === e.sort?.order, n = !e.includeNewItemsInFilter && a.some((e) => e.hidden), s = i.map((e, t) => ({
|
|
1460
|
+
item: e,
|
|
1461
|
+
at: t
|
|
1462
|
+
})), r = s.filter((e) => !E(e.item)), o = [...[...s.filter((e) => E(e.item)), ...u.map((e) => ({
|
|
1463
|
+
item: n ? {
|
|
1464
|
+
item: e,
|
|
1465
|
+
hidden: !0
|
|
1466
|
+
} : { item: e },
|
|
1467
|
+
at: -1
|
|
1468
|
+
}))].sort((e, n) => t ? n.item.item - e.item.item : e.item.item - n.item.item), ...r], d = new Map(o.map((e, t) => [e.at, t]));
|
|
1469
|
+
return {
|
|
1470
|
+
items: o.map((e) => e.item),
|
|
1471
|
+
positions: l.map((e) => e < 0 ? e : d.get(e) ?? -1)
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
if (0 === u.length) return {
|
|
1475
|
+
items: i,
|
|
1476
|
+
positions: l
|
|
1477
|
+
};
|
|
1478
|
+
const c = !e.includeNewItemsInFilter && a.some((e) => e.hidden), f = (e) => c ? {
|
|
1479
|
+
item: e,
|
|
1480
|
+
hidden: !0
|
|
1481
|
+
} : { item: e };
|
|
1482
|
+
if (e.sort && void 0 === e.sort.dataField) {
|
|
1483
|
+
const t = "descending" === e.sort.order, s = (e, t) => qe(L(e, n), G(n[t]), void 0 === e.name && o?.has(e.item), o?.has(t));
|
|
1484
|
+
for (const e of u) {
|
|
1485
|
+
const n = f(e);
|
|
1486
|
+
let r = i.findIndex((n) => E(n) && (t ? s(n, e) < 0 : s(n, e) > 0));
|
|
1487
|
+
r < 0 && (r = Je(i)), i.splice(r, 0, n);
|
|
1488
|
+
for (let e = 0; e < l.length; e++) l[e] >= r && l[e]++;
|
|
1489
|
+
}
|
|
1490
|
+
} else {
|
|
1491
|
+
const e = Je(i);
|
|
1492
|
+
i.splice(e, 0, ...u.map(f));
|
|
1493
|
+
for (let t = 0; t < l.length; t++) l[t] >= e && (l[t] += u.length);
|
|
1494
|
+
}
|
|
1495
|
+
return {
|
|
1496
|
+
items: i,
|
|
1497
|
+
positions: l
|
|
1498
|
+
};
|
|
1499
|
+
}, Je = (e) => {
|
|
1500
|
+
const t = e.findIndex((e) => !E(e));
|
|
1501
|
+
return t < 0 ? e.length : t;
|
|
1502
|
+
}, Ye = (e, t) => {
|
|
1503
|
+
if (!(t < 0)) for (let n = 0; n < e.length; n++) {
|
|
1504
|
+
const s = (t + n) % e.length, r = e[s];
|
|
1505
|
+
if (E(r) && !r.missing) return s;
|
|
1506
|
+
}
|
|
1507
|
+
}, Xe = (e, t, n, s, r) => {
|
|
1508
|
+
const o = { ...e };
|
|
1509
|
+
if (void 0 !== e.field) {
|
|
1510
|
+
if (!n(e.field)) return null;
|
|
1511
|
+
o.field = t(e.field);
|
|
1512
|
+
}
|
|
1513
|
+
if (e.references) {
|
|
1514
|
+
const a = [];
|
|
1515
|
+
for (const o of e.references) {
|
|
1516
|
+
if (!n(o.field)) return null;
|
|
1517
|
+
const e = {
|
|
1518
|
+
...o,
|
|
1519
|
+
field: t(o.field)
|
|
1520
|
+
};
|
|
1521
|
+
if (o.items && !o.byPosition && !o.relative) {
|
|
1522
|
+
const t = -2 === o.field ? r : s[o.field];
|
|
1523
|
+
if (t) {
|
|
1524
|
+
const n = o.items.map((e) => t[e] ?? -1);
|
|
1525
|
+
if (n.some((e) => e < 0)) return null;
|
|
1526
|
+
e.items = n;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
a.push(e);
|
|
1530
|
+
}
|
|
1531
|
+
o.references = a;
|
|
1532
|
+
}
|
|
1533
|
+
return o;
|
|
1534
|
+
}, Ze = (e, t, n) => {
|
|
1535
|
+
const s = e.fields ?? [], r = s[t]?.items ?? [], o = new Array(r.length);
|
|
1536
|
+
n.forEach((e, t) => {
|
|
1537
|
+
o[e] = t;
|
|
1538
|
+
});
|
|
1539
|
+
const a = {
|
|
1540
|
+
...e,
|
|
1541
|
+
fields: s.map((e, s) => {
|
|
1542
|
+
if (s === t) return {
|
|
1543
|
+
...e,
|
|
1544
|
+
items: n.map((e) => r[e])
|
|
1545
|
+
};
|
|
1546
|
+
const a = e.sort?.scope;
|
|
1547
|
+
if (!a?.items.some((e) => e.field === t)) return e;
|
|
1548
|
+
const i = a.items.map((e) => e.field === t ? {
|
|
1549
|
+
...e,
|
|
1550
|
+
item: o[e.item] ?? e.item
|
|
1551
|
+
} : e);
|
|
1552
|
+
return {
|
|
1553
|
+
...e,
|
|
1554
|
+
sort: {
|
|
1555
|
+
...e.sort,
|
|
1556
|
+
scope: {
|
|
1557
|
+
...a,
|
|
1558
|
+
items: i
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
})
|
|
1563
|
+
};
|
|
1564
|
+
e.pageFields?.some((e) => e.field === t && void 0 !== e.item) && (a.pageFields = e.pageFields.map((e) => e.field === t && void 0 !== e.item ? {
|
|
1565
|
+
...e,
|
|
1566
|
+
item: o[e.item]
|
|
1567
|
+
} : e)), e.dataFields?.some((e) => e.baseField === t && "number" == typeof e.baseItem) && (a.dataFields = e.dataFields.map((e) => e.baseField === t && "number" == typeof e.baseItem ? {
|
|
1568
|
+
...e,
|
|
1569
|
+
baseItem: o[e.baseItem] ?? e.baseItem
|
|
1570
|
+
} : e));
|
|
1571
|
+
const i = s.map((e, n) => n === t ? o : null), l = (e.dataFields ?? []).map((e, t) => t), d = (e) => Xe(e, (e) => e, () => !0, i, l) ?? e;
|
|
1572
|
+
return e.formats && (a.formats = e.formats.map((e) => ({
|
|
1573
|
+
...e,
|
|
1574
|
+
area: d(e.area)
|
|
1575
|
+
}))), e.conditionalFormats && (a.conditionalFormats = e.conditionalFormats.map((e) => ({
|
|
1576
|
+
...e,
|
|
1577
|
+
areas: e.areas.map(d)
|
|
1578
|
+
}))), a;
|
|
1579
|
+
}, et = (e, t, n, s) => {
|
|
1580
|
+
const r = (e.fields ?? [])[n]?.items ?? [], o = U(t)[n] ?? [], a = t.fields?.[n], i = void 0 !== a?.group?.range, l = (e) => void 0 === e.name && T(a, e.item), d = r.map((e, t) => ({
|
|
1581
|
+
item: e,
|
|
1582
|
+
at: t
|
|
1583
|
+
})), u = d.filter((e) => E(e.item));
|
|
1584
|
+
u.sort((e, t) => i ? e.item.item - t.item.item : qe(L(e.item, o), L(t.item, o), l(e.item), l(t.item))), "descending" === s && u.reverse();
|
|
1585
|
+
let c = 0;
|
|
1586
|
+
const f = Ze(e, n, d.map((e) => E(e.item) ? u[c++] : e).map((e) => e.at));
|
|
1587
|
+
return {
|
|
1588
|
+
...f,
|
|
1589
|
+
fields: f.fields.map((e, t) => t === n ? {
|
|
1590
|
+
...e,
|
|
1591
|
+
sort: { order: s }
|
|
1592
|
+
} : e)
|
|
1593
|
+
};
|
|
1594
|
+
}, tt = (n, s, r) => {
|
|
1595
|
+
const o = n.fields?.[s]?.items?.[r];
|
|
1596
|
+
if (!o || !E(o)) throw new t(e("error.pivotTable.changePart"));
|
|
1597
|
+
return o;
|
|
1598
|
+
}, nt = (n, s, r, o, a) => {
|
|
1599
|
+
const i = tt(n, r, o), l = n.fields[r].items, u = U(s)[r] ?? [], c = (e) => {
|
|
1600
|
+
const t = G(u[e.item]);
|
|
1601
|
+
return null === t ? d : H(t);
|
|
1602
|
+
};
|
|
1603
|
+
if (l.some((e, t) => t !== o && E(e) && w(e.name ?? c(e), a))) throw new t(e("error.pivotTable.itemNameExists", { name: a }));
|
|
1604
|
+
const { name: f, ...m } = i, p = a === c(i) ? m : {
|
|
1605
|
+
...i,
|
|
1606
|
+
name: a
|
|
1607
|
+
};
|
|
1608
|
+
if (p.name === i.name) return n;
|
|
1609
|
+
const h = {
|
|
1610
|
+
...n,
|
|
1611
|
+
fields: n.fields.map((e, t) => t === r ? {
|
|
1612
|
+
...e,
|
|
1613
|
+
items: l.map((e, t) => t === o ? p : e)
|
|
1614
|
+
} : e)
|
|
1615
|
+
}, g = n.fields[r].sort;
|
|
1616
|
+
return g && void 0 === g.dataField ? et(h, s, r, g.order) : h;
|
|
1617
|
+
}, st = (e, t, n, s) => {
|
|
1618
|
+
tt(e, t, n);
|
|
1619
|
+
const r = e.fields[t].items.map((e, t) => t).filter((e) => e !== n);
|
|
1620
|
+
r.splice(s, 0, n);
|
|
1621
|
+
const o = e.fields[t].sort;
|
|
1622
|
+
if (!o && r.every((e, t) => e === t)) return e;
|
|
1623
|
+
const a = Ze(e, t, r);
|
|
1624
|
+
return o ? {
|
|
1625
|
+
...a,
|
|
1626
|
+
fields: a.fields.map((e, n) => {
|
|
1627
|
+
if (n !== t) return e;
|
|
1628
|
+
const { sort: s, ...r } = e;
|
|
1629
|
+
return r;
|
|
1630
|
+
})
|
|
1631
|
+
} : a;
|
|
1632
|
+
}, rt = (n, s, r, o) => {
|
|
1633
|
+
const a = H(o), i = n.fields, l = s.fields, u = n.dataFields ?? [], c = U(s), f = (e, t) => {
|
|
1634
|
+
if (void 0 !== t.name) return t.name;
|
|
1635
|
+
const n = G(c[e][t.item]);
|
|
1636
|
+
return null === n ? d : H(n);
|
|
1637
|
+
}, m = (r) => {
|
|
1638
|
+
if (void 0 !== r.field && a === (i[r.field].name ?? l[r.field].name)) return;
|
|
1639
|
+
const o = void 0 === r.field ? n : {
|
|
1640
|
+
...n,
|
|
1641
|
+
fields: i.map((e, t) => t === r.field ? {
|
|
1642
|
+
...e,
|
|
1643
|
+
name: "\0"
|
|
1644
|
+
} : e)
|
|
1645
|
+
};
|
|
1646
|
+
if (z(o, s, a, r.data) !== a) throw new t(e("error.pivotTable.fieldNameExists"));
|
|
1647
|
+
};
|
|
1648
|
+
switch (r.kind) {
|
|
1649
|
+
case "item": {
|
|
1650
|
+
const { field: e, rank: t } = r;
|
|
1651
|
+
tt(n, e, t);
|
|
1652
|
+
const o = i[e].items.findIndex((n, s) => s !== t && E(n) && w(f(e, n), a));
|
|
1653
|
+
return o >= 0 ? st(n, e, o, t) : nt(n, s, e, t, a);
|
|
1654
|
+
}
|
|
1655
|
+
case "fieldCaption": {
|
|
1656
|
+
const { field: e } = r;
|
|
1657
|
+
return m({ field: e }), ((e, t) => ({
|
|
1658
|
+
...n,
|
|
1659
|
+
fields: i.map((n, s) => s === e ? t(n) : n)
|
|
1660
|
+
}))(e, (t) => {
|
|
1661
|
+
const { name: n, ...s } = t;
|
|
1662
|
+
return a === l[e].name ? s : {
|
|
1663
|
+
...t,
|
|
1664
|
+
name: a
|
|
1665
|
+
};
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
case "dataCaption": {
|
|
1669
|
+
const { data: e } = r;
|
|
1670
|
+
return m({ data: e }), {
|
|
1671
|
+
...n,
|
|
1672
|
+
dataFields: u.map((t, n) => n === e ? {
|
|
1673
|
+
...t,
|
|
1674
|
+
name: a
|
|
1675
|
+
} : t)
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
case "rowHeader": return {
|
|
1679
|
+
...n,
|
|
1680
|
+
rowHeaderCaption: a
|
|
1681
|
+
};
|
|
1682
|
+
case "columnHeader": return {
|
|
1683
|
+
...n,
|
|
1684
|
+
columnHeaderCaption: a
|
|
1685
|
+
};
|
|
1686
|
+
case "grandTotal": return {
|
|
1687
|
+
...n,
|
|
1688
|
+
grandTotalCaption: a
|
|
1689
|
+
};
|
|
1690
|
+
case "pageItem": {
|
|
1691
|
+
const s = n.pageFields, o = s[r.page];
|
|
1692
|
+
let l;
|
|
1693
|
+
if (!w(a, "(All)") && (l = (i[o.field].items ?? []).findIndex((e) => E(e) && w(f(o.field, e), a)), l < 0)) throw new t(e("error.pivotTable.notAnItem", { name: a }));
|
|
1694
|
+
const { item: d, ...u } = o, c = void 0 === l ? u : {
|
|
1695
|
+
...o,
|
|
1696
|
+
item: l
|
|
1697
|
+
};
|
|
1698
|
+
return {
|
|
1699
|
+
...n,
|
|
1700
|
+
pageFields: s.map((e, t) => t === r.page ? c : e)
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
}, ot = (e, t, n) => je({
|
|
1705
|
+
cacheId: 0,
|
|
1706
|
+
fields: []
|
|
1707
|
+
}, e, t, n).model, at = (e, t) => t.some((t) => e.fields?.[t]?.inline) ? {
|
|
1708
|
+
...e,
|
|
1709
|
+
fields: e.fields.map((e, n) => {
|
|
1710
|
+
if (!e.inline || !t.includes(n)) return e;
|
|
1711
|
+
const { inline: s, ...r } = e;
|
|
1712
|
+
return r;
|
|
1713
|
+
})
|
|
1714
|
+
} : e, it = (e) => [
|
|
1715
|
+
...e.rowFields ?? [],
|
|
1716
|
+
...e.columnFields ?? [],
|
|
1717
|
+
...(e.pageFields ?? []).map((e) => e.field)
|
|
1718
|
+
].filter((e) => e >= 0), lt = (e, t) => {
|
|
1719
|
+
const n = e.fields[t], s = U(e)[t], r = s.map((e, t) => t);
|
|
1720
|
+
p(n) || r.sort((e, t) => qe(G(s[e]), G(s[t]), T(n, e), T(n, t)));
|
|
1721
|
+
const o = new Set(n.calculatedItems?.map((e) => e.item)), a = new Set(n.unused);
|
|
1722
|
+
return [...r.map((e) => ({
|
|
1723
|
+
item: e,
|
|
1724
|
+
...o.has(e) ? { calculated: !0 } : {},
|
|
1725
|
+
...a.has(e) ? { missing: !0 } : {}
|
|
1726
|
+
})), { type: "default" }];
|
|
1727
|
+
}, dt = (s) => {
|
|
1728
|
+
if (!("number" == typeof s ? void 0 !== o(s) : "" !== s && n.isValidFormat(s))) throw new t(e("error.pivotTable.notANumberFormat", { name: String(s) }));
|
|
1729
|
+
}, ut = (n, s, r, o) => {
|
|
1730
|
+
const a = o?.function ?? ((e, t) => "number" === M(e, t) ? "sum" : "count")(s.fields[r], U(s)[r]), i = k[a];
|
|
1731
|
+
if (!i) throw new t(e("error.pivotTable.notAFunction", { name: a }));
|
|
1732
|
+
let l = o?.name;
|
|
1733
|
+
if (void 0 === l) l = z(n, s, `${i} of ${v(n, s, r)}`);
|
|
1734
|
+
else if (z(n, s, l) !== l) throw new t(e("error.pivotTable.fieldNameExists"));
|
|
1735
|
+
const d = {
|
|
1736
|
+
name: l,
|
|
1737
|
+
field: r,
|
|
1738
|
+
baseField: 0,
|
|
1739
|
+
baseItem: 0
|
|
1740
|
+
};
|
|
1741
|
+
return "sum" !== a && (d.subtotal = a), void 0 !== o?.numberFormat && (dt(o.numberFormat), d.numberFormat = o.numberFormat), d;
|
|
1742
|
+
}, ct = (n, s) => {
|
|
1743
|
+
const r = n.fields ?? [], o = (n) => {
|
|
1744
|
+
const s = r.findIndex((e) => w(e.name, n));
|
|
1745
|
+
if (s < 0) throw new t(e("error.pivotTable.notAField", { name: n }));
|
|
1746
|
+
return s;
|
|
1747
|
+
}, a = /* @__PURE__ */ new Map(), i = (e, t) => {
|
|
1748
|
+
for (const n of e ?? []) {
|
|
1749
|
+
const e = o(n);
|
|
1750
|
+
a.delete(e), a.set(e, t);
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1753
|
+
i(s?.rows, "row"), i(s?.columns, "column"), i(s?.pages, "page");
|
|
1754
|
+
const l = (e) => [...a].filter(([, t]) => t === e).map(([e]) => e), d = [];
|
|
1755
|
+
for (const e of s?.values ?? []) {
|
|
1756
|
+
const { field: t, ...s } = "string" == typeof e ? { field: e } : e;
|
|
1757
|
+
d.push(ut({ dataFields: d }, n, o(t), s));
|
|
1758
|
+
}
|
|
1759
|
+
const u = new Set(d.map((e) => e.field)), c = s?.form && "compact" !== s.form ? s.form : void 0, f = r.map((e, t) => {
|
|
1760
|
+
const s = {}, r = a.get(t);
|
|
1761
|
+
return r && (s.axis = r, s.items = lt(n, t)), u.has(t) && (s.dataField = !0), c && (s.form = c), e.dates && void 0 !== e.numberFormat && (s.numberFormat = e.numberFormat), s;
|
|
1762
|
+
}), m = l("column");
|
|
1763
|
+
d.length > 1 && m.push(-2);
|
|
1764
|
+
const p = {
|
|
1765
|
+
fields: f,
|
|
1766
|
+
style: {
|
|
1767
|
+
name: s?.style ?? "PivotStyleLight16",
|
|
1768
|
+
showRowHeaders: !0,
|
|
1769
|
+
showColumnHeaders: !0,
|
|
1770
|
+
showRowStripes: !1,
|
|
1771
|
+
showColumnStripes: !1,
|
|
1772
|
+
showLastColumn: !0
|
|
1773
|
+
}
|
|
1774
|
+
}, h = l("row");
|
|
1775
|
+
h.length > 0 && (p.rowFields = h), m.length > 0 && (p.columnFields = m);
|
|
1776
|
+
const g = l("page");
|
|
1777
|
+
return g.length > 0 && (p.pageFields = g.map((e) => ({ field: e }))), d.length > 0 && (p.dataFields = d), c && (p.form = c), p;
|
|
1778
|
+
}, ft = (e, t) => t.map((t) => {
|
|
1779
|
+
const n = t.sort?.scope;
|
|
1780
|
+
if (!n) return t;
|
|
1781
|
+
const s = ((t.axis === _.Axis.Row ? e.columnFields : t.axis === _.Axis.Column ? e.rowFields : void 0) ?? []).filter((e) => -2 !== e);
|
|
1782
|
+
if (!n.items.every((e, t) => s[t] === e.field)) {
|
|
1783
|
+
const { sort: e, ...n } = t;
|
|
1784
|
+
return n;
|
|
1785
|
+
}
|
|
1786
|
+
const { subtotal: r, ...o } = n;
|
|
1787
|
+
return {
|
|
1788
|
+
...t,
|
|
1789
|
+
sort: {
|
|
1790
|
+
...t.sort,
|
|
1791
|
+
scope: n.items.length < s.length ? {
|
|
1792
|
+
...o,
|
|
1793
|
+
subtotal: !0
|
|
1794
|
+
} : o
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
}), mt = (n, s, r, o, a) => {
|
|
1798
|
+
const i = _.Axis, d = s.fields?.[r], u = n.fields?.[r]?.axis ?? null;
|
|
1799
|
+
if (o === i.Values) throw new t(e("error.pivotTable.valuesNotAnAxis"));
|
|
1800
|
+
if (null === o) {
|
|
1801
|
+
if (null === u) return n;
|
|
1802
|
+
} else if (void 0 !== d?.formula || o === i.Page && (d?.calculatedItems?.length ?? 0) > 0) throw new t(e("error.pivotTable.fieldNotPlaceable"));
|
|
1803
|
+
const c = o ? R(n, o).filter((e) => e !== r) : [];
|
|
1804
|
+
if (void 0 !== a && (!Number.isInteger(a) || a < 1 || a > c.length + 1)) throw new t(e("error.pivotTable.fieldPosition"));
|
|
1805
|
+
const f = (a ?? c.length + 1) - 1;
|
|
1806
|
+
if (o === u && (void 0 === a || R(n, o)[f] === r)) return n;
|
|
1807
|
+
c.splice(f, 0, r);
|
|
1808
|
+
const { rowFields: m, columnFields: p, pageFields: h, ...g } = n, w = {}, v = (e) => (e ?? []).filter((e) => e !== r), F = o === i.Row ? c : v(n.rowFields), b = o === i.Column ? c : v(n.columnFields), y = o === i.Page ? c.map((e) => n.pageFields?.find((t) => t.field === e) ?? { field: e }) : (n.pageFields ?? []).filter((e) => e.field !== r);
|
|
1809
|
+
F.length > 0 && (w.rowFields = F), b.length > 0 && (w.columnFields = b), y.length > 0 && (w.pageFields = y);
|
|
1810
|
+
let I = {
|
|
1811
|
+
...g,
|
|
1812
|
+
...w
|
|
1813
|
+
};
|
|
1814
|
+
o === i.Page && u !== i.Page && (I = l(I, r, () => !0));
|
|
1815
|
+
const x = { ...n.fields?.[r] };
|
|
1816
|
+
o ? x.axis = o : delete x.axis, o && !x.items && d && (x.items = C(lt(s, r), x.subtotals)), o && void 0 === x.numberFormat && d?.dates && void 0 !== d.numberFormat && (x.numberFormat = d.numberFormat), o === i.Page && x.items?.some((e) => e.hidden) && (x.multipleItemSelection = !0);
|
|
1817
|
+
const A = (n.fields ?? []).map((e, t) => t === r ? x : e);
|
|
1818
|
+
if (I = {
|
|
1819
|
+
...I,
|
|
1820
|
+
fields: ft(I, A)
|
|
1821
|
+
}, null === o && n.formats?.some((e) => e.area.references?.some((e) => e.field === r))) {
|
|
1822
|
+
const e = n.formats.filter((e) => !e.area.references?.some((e) => e.field === r)), { formats: t, ...s } = I;
|
|
1823
|
+
I = e.length > 0 ? {
|
|
1824
|
+
...s,
|
|
1825
|
+
formats: e
|
|
1826
|
+
} : s;
|
|
1827
|
+
}
|
|
1828
|
+
return I;
|
|
1829
|
+
}, pt = -2, ht = /* @__PURE__ */ new Set([
|
|
1830
|
+
"percentOfTotal",
|
|
1831
|
+
"percentOfRow",
|
|
1832
|
+
"percentOfCol",
|
|
1833
|
+
"percentOfParentRow",
|
|
1834
|
+
"percentOfParentCol",
|
|
1835
|
+
"percentOfParent",
|
|
1836
|
+
"percentOfRunningTotal",
|
|
1837
|
+
"percent",
|
|
1838
|
+
"percentDiff"
|
|
1839
|
+
]), gt = /* @__PURE__ */ new Set([
|
|
1840
|
+
"index",
|
|
1841
|
+
"rankAscending",
|
|
1842
|
+
"rankDescending"
|
|
1843
|
+
]), wt = /* @__PURE__ */ new Set([
|
|
1844
|
+
...ht,
|
|
1845
|
+
...gt,
|
|
1846
|
+
"runTotal",
|
|
1847
|
+
"difference"
|
|
1848
|
+
]), vt = (e, t) => {
|
|
1849
|
+
const n = 1 === e.references?.length ? e.references[0] : null;
|
|
1850
|
+
return !1 === e.outline && n?.field === pt && 1 === n.items?.length && n.items[0] === t && void 0 === n.selected && !e.type && !e.labelOnly && void 0 === e.dataOnly;
|
|
1851
|
+
}, Ft = (e, t) => {
|
|
1852
|
+
if (!e.formats?.some((e) => vt(e.area, t))) return e;
|
|
1853
|
+
const n = e.formats.filter((e) => !vt(e.area, t)), { formats: s, ...r } = e;
|
|
1854
|
+
return n.length > 0 ? {
|
|
1855
|
+
...r,
|
|
1856
|
+
formats: n
|
|
1857
|
+
} : r;
|
|
1858
|
+
}, bt = (e, t, n) => ({
|
|
1859
|
+
...e,
|
|
1860
|
+
dataFields: e.dataFields.map((e, s) => s === t ? n(e) : e)
|
|
1861
|
+
}), yt = (e, t) => {
|
|
1862
|
+
const { numberFormat: n, ...s } = e;
|
|
1863
|
+
return void 0 === t ? s : {
|
|
1864
|
+
...s,
|
|
1865
|
+
numberFormat: t
|
|
1866
|
+
};
|
|
1867
|
+
}, It = (e, t, n) => {
|
|
1868
|
+
const s = new Set(t.map((e) => e.field)), r = (e.fields ?? []).map((e, t) => {
|
|
1869
|
+
let r = e;
|
|
1870
|
+
if (void 0 !== e.sort?.dataField) {
|
|
1871
|
+
const t = n[e.sort.dataField];
|
|
1872
|
+
if (t < 0) {
|
|
1873
|
+
const { sort: e, ...t } = r;
|
|
1874
|
+
r = t;
|
|
1875
|
+
} else t !== e.sort.dataField && (r = {
|
|
1876
|
+
...r,
|
|
1877
|
+
sort: {
|
|
1878
|
+
...e.sort,
|
|
1879
|
+
dataField: t
|
|
1880
|
+
}
|
|
1881
|
+
});
|
|
1882
|
+
}
|
|
1883
|
+
if (!!e.dataField !== s.has(t)) {
|
|
1884
|
+
const { dataField: e, ...n } = r;
|
|
1885
|
+
r = s.has(t) ? {
|
|
1886
|
+
...n,
|
|
1887
|
+
dataField: !0
|
|
1888
|
+
} : n;
|
|
1889
|
+
}
|
|
1890
|
+
return r;
|
|
1891
|
+
}), { dataFields: o, filters: a, formats: i, conditionalFormats: l, ...d } = e, u = {
|
|
1892
|
+
...d,
|
|
1893
|
+
fields: r
|
|
1894
|
+
};
|
|
1895
|
+
t.length > 0 && (u.dataFields = t);
|
|
1896
|
+
const c = (e.filters ?? []).flatMap((e) => {
|
|
1897
|
+
if (void 0 === e.dataField) return [e];
|
|
1898
|
+
const t = n[e.dataField];
|
|
1899
|
+
return t < 0 ? [] : [{
|
|
1900
|
+
...e,
|
|
1901
|
+
dataField: t
|
|
1902
|
+
}];
|
|
1903
|
+
});
|
|
1904
|
+
c.length > 0 && (u.filters = c);
|
|
1905
|
+
const f = (e) => Xe(e, (e) => e, () => !0, [], n), m = (e.formats ?? []).flatMap((e) => {
|
|
1906
|
+
const t = f(e.area);
|
|
1907
|
+
return t ? [{
|
|
1908
|
+
...e,
|
|
1909
|
+
area: t
|
|
1910
|
+
}] : [];
|
|
1911
|
+
});
|
|
1912
|
+
m.length > 0 && (u.formats = m);
|
|
1913
|
+
const p = (e.conditionalFormats ?? []).flatMap((e) => {
|
|
1914
|
+
const t = e.areas.flatMap((e) => f(e) ?? []);
|
|
1915
|
+
return t.length > 0 ? [{
|
|
1916
|
+
...e,
|
|
1917
|
+
areas: t
|
|
1918
|
+
}] : [];
|
|
1919
|
+
});
|
|
1920
|
+
return p.length > 0 && (u.conditionalFormats = p), ((e) => {
|
|
1921
|
+
const t = e.dataFields?.length ?? 0, n = e.rowFields?.includes(pt), s = e.columnFields?.includes(pt), { valuesPosition: r, ...o } = e;
|
|
1922
|
+
if (t < 2 && (n || s)) {
|
|
1923
|
+
const t = n ? "rowFields" : "columnFields", s = e[t], r = s.indexOf(pt), a = s.filter((e) => e !== pt), i = {
|
|
1924
|
+
...o,
|
|
1925
|
+
...r < a.length ? { valuesPosition: r } : {}
|
|
1926
|
+
};
|
|
1927
|
+
return a.length > 0 ? i[t] = a : delete i[t], i;
|
|
1928
|
+
}
|
|
1929
|
+
if (t >= 2 && !n && !s) {
|
|
1930
|
+
const t = e.valuesOnRows ? "rowFields" : "columnFields", n = [...e[t] ?? []];
|
|
1931
|
+
return n.splice(Math.min(r ?? n.length, n.length), 0, pt), {
|
|
1932
|
+
...o,
|
|
1933
|
+
[t]: n
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
return e;
|
|
1937
|
+
})(u);
|
|
1938
|
+
}, xt = (e, t, n, s) => {
|
|
1939
|
+
const r = mt(e, t, n, null), o = r.dataFields?.length ?? 0, a = ut(r, t, n, s);
|
|
1940
|
+
return It(r, [...r.dataFields ?? [], a], Array.from({ length: o }, (e, t) => t));
|
|
1941
|
+
}, At = (e, t) => {
|
|
1942
|
+
const n = e.dataFields ?? [], s = [], r = [];
|
|
1943
|
+
return n.forEach((e, n) => {
|
|
1944
|
+
void 0 !== t && n !== t ? (s.push(r.length), r.push(e)) : s.push(-1);
|
|
1945
|
+
}), It(e, r, s);
|
|
1946
|
+
}, Ct = (n, s, r) => {
|
|
1947
|
+
const o = n.dataFields ?? [];
|
|
1948
|
+
if (!Number.isInteger(r) || r < 1 || r > o.length) throw new t(e("error.pivotTable.valuePosition"));
|
|
1949
|
+
if (r - 1 === s) return n;
|
|
1950
|
+
const a = o.map((e, t) => t).filter((e) => e !== s);
|
|
1951
|
+
a.splice(r - 1, 0, s);
|
|
1952
|
+
const i = [];
|
|
1953
|
+
return a.forEach((e, t) => {
|
|
1954
|
+
i[e] = t;
|
|
1955
|
+
}), It(n, a.map((e) => o[e]), i);
|
|
1956
|
+
}, Et = (e, t, n, s) => {
|
|
1957
|
+
const r = I(e, t, n, s);
|
|
1958
|
+
return (e.dataFields[n].subtotal ?? "sum") === s ? e : bt(e, n, (e) => {
|
|
1959
|
+
const { subtotal: t, ...n } = e, o = {
|
|
1960
|
+
...n,
|
|
1961
|
+
name: r
|
|
1962
|
+
};
|
|
1963
|
+
return "sum" !== s && (o.subtotal = s), o;
|
|
1964
|
+
});
|
|
1965
|
+
}, St = (n, s, r, o) => {
|
|
1966
|
+
const a = n.dataFields[r], i = a.showDataAs ?? "normal", l = o?.kind ?? "normal";
|
|
1967
|
+
if (o && !wt.has(o.kind)) throw new t(e("error.pivotTable.notAShowAs", { name: o.kind }));
|
|
1968
|
+
const { showDataAs: d, baseField: u, baseItem: c, ...f } = a, m = { ...f };
|
|
1969
|
+
"normal" !== l && (m.showDataAs = l);
|
|
1970
|
+
let p = a.baseField, h = a.baseItem;
|
|
1971
|
+
if (void 0 !== o?.baseField) {
|
|
1972
|
+
const r = o.baseField, a = (s.fields ?? []).findIndex((e, t) => w(v(n, s, t), r));
|
|
1973
|
+
if (a < 0) throw new t(e("error.pivotTable.notAField", { name: r }));
|
|
1974
|
+
a !== p && (p = a, h = 0);
|
|
1975
|
+
}
|
|
1976
|
+
if (void 0 !== o?.baseItem) {
|
|
1977
|
+
const r = p ?? 0;
|
|
1978
|
+
if (w(o.baseItem, "(previous)")) h = "previous";
|
|
1979
|
+
else if (w(o.baseItem, "(next)")) h = "next";
|
|
1980
|
+
else {
|
|
1981
|
+
const a = n.fields?.[r]?.items ? n : { fields: (n.fields ?? []).map((e, t) => t === r ? {
|
|
1982
|
+
...e,
|
|
1983
|
+
items: lt(s, r)
|
|
1984
|
+
} : e) }, i = $(a, s, r).findIndex((e) => null !== e && w(e, o.baseItem));
|
|
1985
|
+
if (i < 0) throw new t(e("error.pivotTable.notAnItem", { name: o.baseItem }));
|
|
1986
|
+
h = i;
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
if (void 0 !== p && (m.baseField = p), void 0 !== h && (m.baseItem = h), l === i) return m.baseField === a.baseField && m.baseItem === a.baseItem ? n : bt(n, r, () => m);
|
|
1990
|
+
const g = ((e, t, n) => {
|
|
1991
|
+
if (gt.has(n)) return gt.has(t) ? e : void 0;
|
|
1992
|
+
const s = ((e) => N(e).replace(/"[^"]*"|\\./g, "").includes("%"))(e);
|
|
1993
|
+
return ht.has(n) ? ht.has(t) || s ? e : 10 : ht.has(t) && s ? void 0 : e;
|
|
1994
|
+
})(a.numberFormat, i, l);
|
|
1995
|
+
return g === a.numberFormat ? bt(n, r, () => m) : bt(Ft(n, r), r, () => yt(m, g));
|
|
1996
|
+
}, Pt = (e, t, n) => {
|
|
1997
|
+
dt(n);
|
|
1998
|
+
const s = N(n), r = e.dataFields[t], o = e.formats?.[e.formats.length - 1];
|
|
1999
|
+
if (N(r.numberFormat) === s && o && vt(o.area, t) && o.style.numberFormat === s) return e;
|
|
2000
|
+
const a = bt(Ft(e, t), t, (e) => yt(e, "General" === s ? void 0 : n));
|
|
2001
|
+
return {
|
|
2002
|
+
...a,
|
|
2003
|
+
formats: [...a.formats ?? [], {
|
|
2004
|
+
style: { numberFormat: s },
|
|
2005
|
+
area: {
|
|
2006
|
+
outline: !1,
|
|
2007
|
+
references: [{
|
|
2008
|
+
field: pt,
|
|
2009
|
+
items: [t]
|
|
2010
|
+
}]
|
|
2011
|
+
}
|
|
2012
|
+
}]
|
|
2013
|
+
};
|
|
2014
|
+
}, kt = (n, s, r) => {
|
|
2015
|
+
if (null === s) return At(n);
|
|
2016
|
+
const o = _.Axis;
|
|
2017
|
+
if (s !== o.Row && s !== o.Column) throw new t(e("error.pivotTable.fieldNotPlaceable"));
|
|
2018
|
+
const a = n.rowFields?.includes(pt) ? o.Row : n.columnFields?.includes(pt) ? o.Column : null;
|
|
2019
|
+
if (!a) throw new t(e("error.pivotTable.fieldPosition"));
|
|
2020
|
+
const i = R(n, s).filter((e) => e !== pt);
|
|
2021
|
+
if (void 0 !== r && (!Number.isInteger(r) || r < 1 || r > i.length + 1)) throw new t(e("error.pivotTable.fieldPosition"));
|
|
2022
|
+
const l = (r ?? i.length + 1) - 1;
|
|
2023
|
+
if (s === a && (void 0 === r || R(n, s)[l] === pt)) return n;
|
|
2024
|
+
i.splice(l, 0, pt);
|
|
2025
|
+
const { rowFields: d, columnFields: u, valuesOnRows: c, ...f } = n, m = R(n, s === o.Row ? o.Column : o.Row).filter((e) => e !== pt), p = { ...f }, h = s === o.Row ? i : m, g = s === o.Column ? i : m;
|
|
2026
|
+
return h.length > 0 && (p.rowFields = [...h]), g.length > 0 && (p.columnFields = [...g]), s === o.Row && (p.valuesOnRows = !0), p;
|
|
2027
|
+
}, Mt = (n, s, r) => {
|
|
2028
|
+
if (r === (n.valuesCaption ?? "Values")) return n;
|
|
2029
|
+
const { valuesCaption: o, ...a } = n, i = {
|
|
2030
|
+
...a,
|
|
2031
|
+
valuesCaption: "\0"
|
|
2032
|
+
};
|
|
2033
|
+
if (z(i, s, r) !== r) throw new t(e("error.pivotTable.fieldNameExists"));
|
|
2034
|
+
return "Values" === r ? a : {
|
|
2035
|
+
...a,
|
|
2036
|
+
valuesCaption: r
|
|
2037
|
+
};
|
|
2038
|
+
};
|
|
2039
|
+
export { xt as addPivotDataField, Ne as anchorPivotPeriods, dt as assertNumberFormat, it as axisFieldsOf, Re as buildPivotView, Oe as evaluatePivotFilters, D as isItemFilter, Ie as layOutPivot, lt as listedItemsOf, Ct as movePivotDataField, mt as movePivotField, st as movePivotItem, kt as movePivotValues, ot as newPivotCache, ct as newPivotTable, _e as readPivotSource, je as refreshPivotCache, Ke as remapPivotTable, At as removePivotDataField, nt as renamePivotItem, Mt as renamePivotValues, Ze as reorderPivotItems, Et as setPivotDataFunction, Pt as setPivotDataNumberFormat, St as setPivotDataShowAs, et as sortPivotItemsByLabel, rt as typeOverPivot, at as withListedFields };
|