@pisell/pisellos 2.3.73 → 2.3.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +111 -71
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  5. package/dist/model/strategy/strategy-example.js +5 -19
  6. package/dist/modules/Cart/index.js +0 -3
  7. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  8. package/dist/modules/Date/index.js +1 -5
  9. package/dist/modules/Discount/index.js +2 -4
  10. package/dist/modules/OpenData/index.js +0 -2
  11. package/dist/modules/Order/index.d.ts +1 -1
  12. package/dist/modules/Order/index.js +36 -64
  13. package/dist/modules/Payment/index.js +97 -162
  14. package/dist/modules/Quotation/index.d.ts +6 -0
  15. package/dist/modules/Quotation/index.js +75 -19
  16. package/dist/modules/Rules/index.js +1 -4
  17. package/dist/modules/Schedule/index.js +0 -1
  18. package/dist/modules/Schedule/utils.js +0 -1
  19. package/dist/modules/Step/index.js +0 -1
  20. package/dist/plugins/request.d.ts +1 -0
  21. package/dist/plugins/request.js +1 -4
  22. package/dist/plugins/window.js +2 -6
  23. package/dist/server/index.d.ts +8 -2
  24. package/dist/server/index.js +303 -269
  25. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  26. package/dist/server/modules/floor-plan/index.js +240 -98
  27. package/dist/server/modules/menu/index.js +75 -59
  28. package/dist/server/modules/order/index.d.ts +17 -7
  29. package/dist/server/modules/order/index.js +421 -211
  30. package/dist/server/modules/products/index.d.ts +8 -2
  31. package/dist/server/modules/products/index.js +191 -117
  32. package/dist/server/modules/quotation/index.js +29 -38
  33. package/dist/server/modules/resource/index.js +24 -17
  34. package/dist/server/modules/schedule/index.js +27 -35
  35. package/dist/server/utils/product.js +0 -1
  36. package/dist/solution/BaseSales/index.js +38 -41
  37. package/dist/solution/BookingByStep/index.d.ts +1 -1
  38. package/dist/solution/BookingByStep/index.js +7 -59
  39. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  40. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  41. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  42. package/dist/solution/BookingTicket/index.js +0 -2
  43. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  44. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  45. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  46. package/dist/solution/BuyTickets/index.js +9 -12
  47. package/dist/solution/Checkout/index.js +177 -252
  48. package/dist/solution/Checkout/utils/index.js +4 -16
  49. package/dist/solution/RegisterAndLogin/index.js +30 -76
  50. package/dist/solution/ScanOrder/index.js +50 -60
  51. package/dist/solution/ShopDiscount/index.js +2 -7
  52. package/dist/solution/VenueBooking/index.js +45 -55
  53. package/dist/utils/task.js +15 -18
  54. package/dist/utils/watch.js +0 -1
  55. package/lib/apis/picoding.js +2 -0
  56. package/lib/core/index.d.ts +7 -0
  57. package/lib/core/index.js +149 -131
  58. package/lib/effects/index.js +46 -57
  59. package/lib/index.js +82 -49
  60. package/lib/model/index.js +14 -21
  61. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  62. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  63. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  64. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  65. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  66. package/lib/model/strategy/adapter/index.js +100 -64
  67. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  68. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  69. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  70. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  71. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  72. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  73. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  74. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  75. package/lib/model/strategy/adapter/promotion/index.js +1 -0
  76. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  77. package/lib/model/strategy/adapter/type.js +4 -16
  78. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  79. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  80. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  81. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  82. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  83. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  84. package/lib/model/strategy/engine.js +270 -168
  85. package/lib/model/strategy/index.js +49 -34
  86. package/lib/model/strategy/strategy-example.js +243 -239
  87. package/lib/model/strategy/type.js +100 -40
  88. package/lib/modules/Account/index.js +39 -53
  89. package/lib/modules/Account/types.js +20 -33
  90. package/lib/modules/AccountList/index.js +116 -154
  91. package/lib/modules/AccountList/types.js +30 -31
  92. package/lib/modules/AccountList/utils.js +18 -30
  93. package/lib/modules/BaseModule.js +23 -42
  94. package/lib/modules/BookingContext/index.js +158 -136
  95. package/lib/modules/BookingContext/types.js +46 -32
  96. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  97. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  98. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  99. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  100. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  101. package/lib/modules/BookingContext/utils/index.js +124 -41
  102. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  103. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  104. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  105. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  106. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  107. package/lib/modules/BookingContext/utils/resources.js +209 -167
  108. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  109. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  110. package/lib/modules/Cart/index.js +170 -124
  111. package/lib/modules/Cart/types.js +46 -51
  112. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  113. package/lib/modules/Cart/utils/cartDate.js +56 -61
  114. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  115. package/lib/modules/Cart/utils/cartNote.js +27 -32
  116. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  117. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  118. package/lib/modules/Cart/utils/cartResource.js +70 -78
  119. package/lib/modules/Cart/utils/changePrice.js +22 -50
  120. package/lib/modules/Cart/utils/index.js +106 -48
  121. package/lib/modules/Customer/constants.js +13 -34
  122. package/lib/modules/Customer/index.js +235 -172
  123. package/lib/modules/Customer/types.js +38 -35
  124. package/lib/modules/Date/index.js +116 -115
  125. package/lib/modules/Date/types.js +16 -28
  126. package/lib/modules/Date/utils.js +174 -123
  127. package/lib/modules/Discount/index.js +122 -127
  128. package/lib/modules/Discount/types.js +9 -31
  129. package/lib/modules/Guests/index.js +30 -56
  130. package/lib/modules/Guests/types.js +23 -33
  131. package/lib/modules/Holder/index.js +209 -189
  132. package/lib/modules/Holder/types.js +4 -16
  133. package/lib/modules/Holder/utils.js +20 -49
  134. package/lib/modules/OpenData/index.js +70 -76
  135. package/lib/modules/OpenData/types.js +4 -16
  136. package/lib/modules/OpenData/utils.js +44 -78
  137. package/lib/modules/Order/index.d.ts +1 -1
  138. package/lib/modules/Order/index.js +1713 -2118
  139. package/lib/modules/Order/payment-utils.js +77 -120
  140. package/lib/modules/Order/types.js +88 -35
  141. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  142. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  143. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  144. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  145. package/lib/modules/Order/utils.js +814 -647
  146. package/lib/modules/Payment/cash.js +20 -33
  147. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  148. package/lib/modules/Payment/eftpos.js +16 -30
  149. package/lib/modules/Payment/index.js +532 -399
  150. package/lib/modules/Payment/mx51.js +1 -0
  151. package/lib/modules/Payment/types.js +230 -108
  152. package/lib/modules/Payment/utils.js +52 -51
  153. package/lib/modules/Payment/walletpass.js +485 -660
  154. package/lib/modules/Product/index.js +51 -46
  155. package/lib/modules/Product/types.js +4 -16
  156. package/lib/modules/Product/utils.js +32 -33
  157. package/lib/modules/ProductList/index.js +113 -123
  158. package/lib/modules/ProductList/types.js +9 -31
  159. package/lib/modules/Quotation/index.d.ts +6 -0
  160. package/lib/modules/Quotation/index.js +110 -103
  161. package/lib/modules/Quotation/types.js +4 -16
  162. package/lib/modules/Resource/index.js +27 -59
  163. package/lib/modules/Resource/types.js +22 -32
  164. package/lib/modules/Resource/utils.js +30 -38
  165. package/lib/modules/ResourcePlanner/index.js +25 -23
  166. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  167. package/lib/modules/ResourcePlanner/planner.js +589 -770
  168. package/lib/modules/ResourcePlanner/types.js +10 -29
  169. package/lib/modules/Rules/index.js +1218 -959
  170. package/lib/modules/Rules/types.js +17 -40
  171. package/lib/modules/SalesSummary/index.js +85 -90
  172. package/lib/modules/SalesSummary/types.js +4 -16
  173. package/lib/modules/SalesSummary/utils.js +355 -430
  174. package/lib/modules/ScanOrderLogger/index.js +59 -79
  175. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  176. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  177. package/lib/modules/ScanOrderLogger/types.js +4 -16
  178. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  179. package/lib/modules/Schedule/index.js +100 -114
  180. package/lib/modules/Schedule/type.js +4 -16
  181. package/lib/modules/Schedule/types.js +4 -16
  182. package/lib/modules/Schedule/utils.js +433 -291
  183. package/lib/modules/Step/index.js +40 -52
  184. package/lib/modules/Step/tyeps.js +4 -16
  185. package/lib/modules/Summary/index.js +66 -71
  186. package/lib/modules/Summary/types.js +4 -16
  187. package/lib/modules/Summary/utils.js +773 -418
  188. package/lib/modules/SurchargeList/index.js +46 -60
  189. package/lib/modules/SurchargeList/types.js +4 -16
  190. package/lib/modules/index.js +245 -63
  191. package/lib/plugins/app.js +4 -16
  192. package/lib/plugins/index.js +36 -25
  193. package/lib/plugins/request.d.ts +1 -0
  194. package/lib/plugins/request.js +137 -126
  195. package/lib/plugins/shopStore.js +4 -16
  196. package/lib/plugins/user.js +4 -16
  197. package/lib/plugins/window.js +171 -179
  198. package/lib/server/index.d.ts +8 -2
  199. package/lib/server/index.js +3083 -2663
  200. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  201. package/lib/server/modules/floor-plan/index.js +159 -127
  202. package/lib/server/modules/floor-plan/types.js +15 -30
  203. package/lib/server/modules/index.js +106 -68
  204. package/lib/server/modules/menu/index.js +170 -124
  205. package/lib/server/modules/menu/types.js +18 -31
  206. package/lib/server/modules/order/index.d.ts +17 -7
  207. package/lib/server/modules/order/index.js +916 -977
  208. package/lib/server/modules/order/types.js +122 -33
  209. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  210. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  211. package/lib/server/modules/payment/index.js +59 -83
  212. package/lib/server/modules/payment/types.js +4 -16
  213. package/lib/server/modules/products/index.d.ts +8 -2
  214. package/lib/server/modules/products/index.js +656 -471
  215. package/lib/server/modules/products/types.js +44 -34
  216. package/lib/server/modules/quotation/index.js +137 -172
  217. package/lib/server/modules/quotation/types.js +21 -31
  218. package/lib/server/modules/resource/index.js +225 -186
  219. package/lib/server/modules/resource/types.js +42 -33
  220. package/lib/server/modules/schedule/index.js +135 -123
  221. package/lib/server/modules/schedule/types.js +14 -21
  222. package/lib/server/modules/schedule/utils.js +334 -163
  223. package/lib/server/types.js +4 -16
  224. package/lib/server/utils/index.js +25 -23
  225. package/lib/server/utils/product.js +196 -139
  226. package/lib/server/utils/schedule.js +34 -41
  227. package/lib/server/utils/small-ticket.js +479 -456
  228. package/lib/server/utils/time.js +40 -49
  229. package/lib/solution/BaseSales/index.js +1186 -1410
  230. package/lib/solution/BaseSales/types.js +42 -38
  231. package/lib/solution/BaseSales/utils/cartPromotion.js +642 -498
  232. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  233. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  234. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
  235. package/lib/solution/BaseSales/utils.js +158 -143
  236. package/lib/solution/BookingByStep/index.d.ts +1 -1
  237. package/lib/solution/BookingByStep/index.js +1527 -1340
  238. package/lib/solution/BookingByStep/types.js +40 -99
  239. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  240. package/lib/solution/BookingByStep/utils/products.js +42 -52
  241. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  242. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  243. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  244. package/lib/solution/BookingTicket/index.js +607 -522
  245. package/lib/solution/BookingTicket/types.js +99 -77
  246. package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
  247. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  248. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  249. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  250. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  251. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  252. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  253. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  254. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  255. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  256. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  257. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  258. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  259. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  260. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  261. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  262. package/lib/solution/BuyTickets/index.js +67 -70
  263. package/lib/solution/BuyTickets/types.js +22 -38
  264. package/lib/solution/Checkout/index.js +1451 -1158
  265. package/lib/solution/Checkout/types.js +91 -61
  266. package/lib/solution/Checkout/utils/index.js +228 -156
  267. package/lib/solution/PlaceOrder/index.js +55 -0
  268. package/lib/solution/RegisterAndLogin/config.js +493 -460
  269. package/lib/solution/RegisterAndLogin/index.js +633 -630
  270. package/lib/solution/RegisterAndLogin/types.js +189 -76
  271. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  272. package/lib/solution/Sales/index.js +328 -324
  273. package/lib/solution/Sales/types.js +27 -33
  274. package/lib/solution/ScanOrder/index.js +832 -864
  275. package/lib/solution/ScanOrder/types.js +33 -34
  276. package/lib/solution/ScanOrder/utils.js +409 -374
  277. package/lib/solution/ShopDiscount/index.js +226 -232
  278. package/lib/solution/ShopDiscount/types.js +15 -37
  279. package/lib/solution/ShopDiscount/utils.js +300 -172
  280. package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
  281. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  282. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  283. package/lib/solution/VenueBooking/index.js +811 -879
  284. package/lib/solution/VenueBooking/types.js +19 -39
  285. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  286. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  287. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  288. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  289. package/lib/solution/VenueBooking/utils.js +130 -67
  290. package/lib/solution/index.js +124 -41
  291. package/lib/store/createStore.js +32 -29
  292. package/lib/types/index.js +4 -16
  293. package/lib/utils/payment-number.js +26 -46
  294. package/lib/utils/task.js +36 -36
  295. package/lib/utils/watch.js +81 -47
  296. package/package.json +2 -1
@@ -1,36 +1,24 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/model/strategy/adapter/dataVariant/evaluator.ts
20
- var evaluator_exports = {};
21
- __export(evaluator_exports, {
22
- DataVariantEvaluator: () => DataVariantEvaluator,
23
- default: () => evaluator_default
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
24
5
  });
25
- module.exports = __toCommonJS(evaluator_exports);
26
- var import_engine = require("../../engine");
27
- var import_getDateIsInSchedule = require("../../../../modules/Schedule/getDateIsInSchedule");
28
- var import_adapter = require("./adapter");
29
- var DataVariantEvaluator = class {
6
+ exports.default = exports.DataVariantEvaluator = void 0;
7
+ var _engine = require("../../engine");
8
+ var _getDateIsInSchedule = require("../../../../modules/Schedule/getDateIsInSchedule");
9
+ var _adapter = require("./adapter");
10
+ /**
11
+ * Data Variant 评估器。
12
+ *
13
+ * 当前阶段只提供策略模型能力和示例验证,不接入 ProductList 业务链路。
14
+ */
15
+ class DataVariantEvaluator {
16
+ adapter;
17
+ strategyConfigs = [];
30
18
  constructor() {
31
- this.strategyConfigs = [];
32
- this.adapter = new import_adapter.DataVariantAdapter();
19
+ this.adapter = new _adapter.DataVariantAdapter();
33
20
  }
21
+
34
22
  /**
35
23
  * 设置策略配置列表,仅保留 metadata.type === 'data_variant' 的策略。
36
24
  */
@@ -40,6 +28,7 @@ var DataVariantEvaluator = class {
40
28
  getStrategyConfigs() {
41
29
  return this.strategyConfigs;
42
30
  }
31
+
43
32
  /**
44
33
  * 批量解析商品 Data Variant。
45
34
  *
@@ -48,28 +37,15 @@ var DataVariantEvaluator = class {
48
37
  resolveProducts(businessData) {
49
38
  const strategyConfigs = businessData.strategyConfigs ? this.normalizeStrategyConfigs(businessData.strategyConfigs) : this.strategyConfigs;
50
39
  const menuScopeMap = this.buildMenuScopeMap(businessData.menuList || []);
51
- const scheduleTimePoints = this.buildScheduleTimePoints(
52
- strategyConfigs,
53
- businessData.scheduleList || []
54
- );
55
- const { globalEffectiveRuleMap, rawResults } = this.buildGlobalEffectiveRuleMap(
56
- strategyConfigs,
57
- businessData,
58
- menuScopeMap
59
- );
60
- const products = businessData.products.map((product) => {
61
- const resolvedProduct = this.resolveProduct(
62
- product,
63
- businessData,
64
- globalEffectiveRuleMap,
65
- menuScopeMap
66
- );
67
- return this.resolveProductBundleItems(
68
- resolvedProduct,
69
- businessData,
70
- globalEffectiveRuleMap,
71
- menuScopeMap
72
- );
40
+ const scheduleTimePoints = this.buildScheduleTimePoints(strategyConfigs, businessData.scheduleList || []);
41
+ const {
42
+ globalEffectiveRuleMap,
43
+ rawResults
44
+ } = this.buildGlobalEffectiveRuleMap(strategyConfigs, businessData, menuScopeMap);
45
+ const products = businessData.products.map(product => {
46
+ const resolvedProduct = this.resolveProduct(product, businessData, globalEffectiveRuleMap, menuScopeMap);
47
+ // 套餐子商品也可能携带 data_variants,需在同一策略上下文内继续评估并写回 bundle_item。
48
+ return this.resolveProductBundleItems(resolvedProduct, businessData, globalEffectiveRuleMap, menuScopeMap);
73
49
  });
74
50
  return {
75
51
  products,
@@ -79,55 +55,51 @@ var DataVariantEvaluator = class {
79
55
  rawResults
80
56
  };
81
57
  }
58
+
82
59
  /**
83
60
  * 根据 operator/field 判断条件是否依赖当前商品。
84
61
  */
85
62
  getConditionScope(rule) {
86
- if (rule.operator === "schedule_match")
87
- return "global";
88
- if (rule.operator === "menu_match")
89
- return "product";
90
- if (rule.operator === "product_match")
91
- return "product";
92
- if (rule.field === "product" || rule.field === "productIdAndVariantId") {
93
- return "product";
63
+ if (rule.operator === 'schedule_match') return 'global';
64
+ if (rule.operator === 'menu_match') return 'product';
65
+ if (rule.operator === 'product_match') return 'product';
66
+ if (rule.field === 'product' || rule.field === 'productIdAndVariantId') {
67
+ return 'product';
94
68
  }
95
- return "global";
69
+ return 'global';
96
70
  }
71
+
97
72
  /**
98
73
  * 将餐牌 partyroom_package 预构建为 Map/Set 索引。
99
74
  */
100
75
  buildMenuScopeMap(menuList) {
101
- const map = /* @__PURE__ */ new Map();
76
+ const map = new Map();
102
77
  for (const menu of menuList) {
103
- if ((menu == null ? void 0 : menu.status) && menu.status !== "valid")
104
- continue;
105
- const menuId = this.toNumber(menu == null ? void 0 : menu.form_record_id);
106
- if (!menuId)
107
- continue;
78
+ if (menu?.status && menu.status !== 'valid') continue;
79
+ const menuId = this.toNumber(menu?.form_record_id);
80
+ if (!menuId) continue;
108
81
  const scope = {
109
82
  isAllProducts: false,
110
- collectionIds: /* @__PURE__ */ new Set(),
111
- productKeys: /* @__PURE__ */ new Set(),
112
- productAllVariantIds: /* @__PURE__ */ new Set()
83
+ collectionIds: new Set(),
84
+ productKeys: new Set(),
85
+ productAllVariantIds: new Set()
113
86
  };
114
87
  const packageConfig = menu.partyroom_package;
115
- const products = Array.isArray(packageConfig == null ? void 0 : packageConfig.products) ? packageConfig.products : [];
116
- if ((packageConfig == null ? void 0 : packageConfig.type) === "product_all") {
88
+ const products = Array.isArray(packageConfig?.products) ? packageConfig.products : [];
89
+ if (packageConfig?.type === 'product_all') {
117
90
  scope.isAllProducts = true;
118
- } else if ((packageConfig == null ? void 0 : packageConfig.type) === "product_collection") {
91
+ } else if (packageConfig?.type === 'product_collection') {
119
92
  for (const item of products) {
120
93
  const collectionId = this.toNumber(item.product_collection_id);
121
94
  if (collectionId) {
122
95
  scope.collectionIds.add(collectionId);
123
96
  }
124
97
  }
125
- } else if ((packageConfig == null ? void 0 : packageConfig.type) === "products") {
98
+ } else if (packageConfig?.type === 'products') {
126
99
  for (const item of products) {
127
100
  const productId = this.toNumber(item.product_id);
128
101
  const variantId = this.toNumber(item.product_variant_id);
129
- if (!productId)
130
- continue;
102
+ if (!productId) continue;
131
103
  if (variantId === 0) {
132
104
  scope.productAllVariantIds.add(productId);
133
105
  } else {
@@ -139,6 +111,7 @@ var DataVariantEvaluator = class {
139
111
  }
140
112
  return map;
141
113
  }
114
+
142
115
  /**
143
116
  * 从当前策略中所有 schedule_match.value 绑定的 schedule_id 提取时间点。
144
117
  *
@@ -146,27 +119,25 @@ var DataVariantEvaluator = class {
146
119
  */
147
120
  buildScheduleTimePoints(strategyConfigs, scheduleList) {
148
121
  const scheduleIds = this.collectScheduleIdsFromStrategies(strategyConfigs);
149
- if (!scheduleIds.length || !scheduleList.length)
150
- return [];
122
+ if (!scheduleIds.length || !scheduleList.length) return [];
151
123
  const scheduleIdSet = new Set(scheduleIds);
152
- const matchedSchedules = scheduleList.filter(
153
- (schedule) => scheduleIdSet.has(Number(schedule.id))
154
- );
124
+ const matchedSchedules = scheduleList.filter(schedule => scheduleIdSet.has(Number(schedule.id)));
155
125
  return this.extractTimePointsFromSchedules(matchedSchedules);
156
126
  }
157
127
  buildGlobalEffectiveRuleMap(strategyConfigs, businessData, menuScopeMap) {
158
- const globalEffectiveRuleMap = /* @__PURE__ */ new Map();
128
+ const globalEffectiveRuleMap = new Map();
159
129
  const rawResults = [];
160
130
  const engine = this.createEngine(businessData, menuScopeMap);
161
131
  const context = this.adapter.prepareGlobalContext(businessData);
162
132
  for (const config of strategyConfigs) {
163
- if (!this.isStrategyActive(config))
164
- continue;
165
- const { globalConfig, productRules } = this.splitStrategyConfig(config);
133
+ if (!this.isStrategyActive(config)) continue;
134
+ const {
135
+ globalConfig,
136
+ productRules
137
+ } = this.splitStrategyConfig(config);
166
138
  const result = engine.evaluate(globalConfig, context);
167
139
  rawResults.push(result);
168
- if (!result.applicable)
169
- continue;
140
+ if (!result.applicable) continue;
170
141
  globalEffectiveRuleMap.set(String(config.metadata.id), {
171
142
  ruleId: String(config.metadata.id),
172
143
  priority: this.getStrategyPriority(config),
@@ -175,19 +146,18 @@ var DataVariantEvaluator = class {
175
146
  globalResult: result
176
147
  });
177
148
  }
178
- return { globalEffectiveRuleMap, rawResults };
149
+ return {
150
+ globalEffectiveRuleMap,
151
+ rawResults
152
+ };
179
153
  }
180
154
  resolveProduct(product, businessData, globalEffectiveRuleMap, menuScopeMap) {
181
155
  const dataVariants = this.getProductDataVariants(product);
182
- if (!dataVariants.length)
183
- return product;
156
+ if (!dataVariants.length) return product;
184
157
  const matchedVariants = [];
185
158
  for (const variant of dataVariants) {
186
- const rule = globalEffectiveRuleMap.get(
187
- String(variant.data_variant_rule_id)
188
- );
189
- if (!rule)
190
- continue;
159
+ const rule = globalEffectiveRuleMap.get(String(variant.data_variant_rule_id));
160
+ if (!rule) continue;
191
161
  if (!this.evaluateProductRules(rule, product, businessData, menuScopeMap)) {
192
162
  continue;
193
163
  }
@@ -198,10 +168,10 @@ var DataVariantEvaluator = class {
198
168
  variant
199
169
  });
200
170
  }
201
- if (!matchedVariants.length)
202
- return product;
171
+ if (!matchedVariants.length) return product;
203
172
  return this.mergeMatchedVariants(product, matchedVariants);
204
173
  }
174
+
205
175
  /**
206
176
  * 解析套餐子商品上的 Data Variant 覆盖。
207
177
  *
@@ -212,21 +182,14 @@ var DataVariantEvaluator = class {
212
182
  if (!Array.isArray(bundleGroups) || bundleGroups.length === 0) {
213
183
  return product;
214
184
  }
215
- const resolvedGroups = bundleGroups.map((group) => {
216
- const bundleItems = group == null ? void 0 : group.bundle_item;
185
+ const resolvedGroups = bundleGroups.map(group => {
186
+ const bundleItems = group?.bundle_item;
217
187
  if (!Array.isArray(bundleItems) || bundleItems.length === 0) {
218
188
  return group;
219
189
  }
220
190
  return {
221
191
  ...group,
222
- bundle_item: bundleItems.map(
223
- (item) => this.resolveBundleItem(
224
- item,
225
- businessData,
226
- globalEffectiveRuleMap,
227
- menuScopeMap
228
- )
229
- )
192
+ bundle_item: bundleItems.map(item => this.resolveBundleItem(item, businessData, globalEffectiveRuleMap, menuScopeMap))
230
193
  };
231
194
  });
232
195
  return {
@@ -234,6 +197,7 @@ var DataVariantEvaluator = class {
234
197
  bundle_group: resolvedGroups
235
198
  };
236
199
  }
200
+
237
201
  /**
238
202
  * 将 bundle_item 转为 DataVariantProduct 并评估 data_variants。
239
203
  */
@@ -242,14 +206,10 @@ var DataVariantEvaluator = class {
242
206
  if (!this.getProductDataVariants(bundleProduct).length) {
243
207
  return item;
244
208
  }
245
- const resolvedItem = this.resolveProduct(
246
- bundleProduct,
247
- businessData,
248
- globalEffectiveRuleMap,
249
- menuScopeMap
250
- );
209
+ const resolvedItem = this.resolveProduct(bundleProduct, businessData, globalEffectiveRuleMap, menuScopeMap);
251
210
  return this.mergeBundleItemResolvedData(item, resolvedItem);
252
211
  }
212
+
253
213
  /**
254
214
  * bundle_item 的商品身份映射:bundle_product_id + bundle_variant_id。
255
215
  */
@@ -265,18 +225,20 @@ var DataVariantEvaluator = class {
265
225
  data_variants: item.data_variants
266
226
  };
267
227
  }
228
+
268
229
  /**
269
230
  * 仅回写命中的字段,避免污染 bundle_item 的结构字段。
270
231
  */
271
232
  mergeBundleItemResolvedData(originalItem, resolvedItem) {
272
- var _a;
273
233
  const appliedInfo = resolvedItem._dataVariant;
274
- if (!((_a = appliedInfo == null ? void 0 : appliedInfo.appliedFields) == null ? void 0 : _a.length)) {
234
+ if (!appliedInfo?.appliedFields?.length) {
275
235
  return originalItem;
276
236
  }
277
- const result = { ...originalItem };
237
+ const result = {
238
+ ...originalItem
239
+ };
278
240
  for (const field of appliedInfo.appliedFields) {
279
- if (resolvedItem[field] !== void 0) {
241
+ if (resolvedItem[field] !== undefined) {
280
242
  result[field] = resolvedItem[field];
281
243
  }
282
244
  }
@@ -284,20 +246,20 @@ var DataVariantEvaluator = class {
284
246
  return result;
285
247
  }
286
248
  evaluateProductRules(rule, product, businessData, menuScopeMap) {
287
- if (!rule.productRules.length)
288
- return true;
249
+ if (!rule.productRules.length) return true;
289
250
  const engine = this.createEngine(businessData, menuScopeMap);
290
251
  const context = this.adapter.prepareProductContext(businessData, product);
291
252
  const productOnlyConfig = {
292
253
  ...rule.strategyConfig,
293
254
  conditions: {
294
- operator: "and",
255
+ operator: 'and',
295
256
  rules: rule.productRules,
296
257
  actionIds: rule.strategyConfig.conditions.actionIds || []
297
258
  }
298
259
  };
299
260
  return engine.evaluate(productOnlyConfig, context).applicable;
300
261
  }
262
+
301
263
  /**
302
264
  * 拆分策略条件。
303
265
  *
@@ -307,7 +269,7 @@ var DataVariantEvaluator = class {
307
269
  const conditions = config.conditions;
308
270
  const globalRules = [];
309
271
  const productRules = [];
310
- if (conditions.operator !== "and") {
272
+ if (conditions.operator !== 'and') {
311
273
  return {
312
274
  globalConfig: {
313
275
  ...config,
@@ -321,7 +283,7 @@ var DataVariantEvaluator = class {
321
283
  productRules.push(...this.flattenConditionRules(rule));
322
284
  continue;
323
285
  }
324
- if (this.getConditionScope(rule) === "product") {
286
+ if (this.getConditionScope(rule) === 'product') {
325
287
  productRules.push(rule);
326
288
  } else {
327
289
  globalRules.push(rule);
@@ -331,7 +293,7 @@ var DataVariantEvaluator = class {
331
293
  globalConfig: {
332
294
  ...config,
333
295
  conditions: {
334
- operator: "and",
296
+ operator: 'and',
335
297
  rules: globalRules,
336
298
  actionIds: conditions.actionIds || []
337
299
  }
@@ -341,62 +303,48 @@ var DataVariantEvaluator = class {
341
303
  }
342
304
  createEngine(businessData, menuScopeMap) {
343
305
  const operatorHandlers = {
344
- schedule_match: (fieldValue, compareValue) => this.evaluateScheduleMatch(
345
- fieldValue,
346
- compareValue,
347
- businessData.scheduleList || []
348
- ),
306
+ schedule_match: (fieldValue, compareValue) => this.evaluateScheduleMatch(fieldValue, compareValue, businessData.scheduleList || []),
349
307
  menu_match: (fieldValue, compareValue) => this.evaluateMenuMatch(fieldValue, compareValue, menuScopeMap),
350
308
  array_intersects: (fieldValue, compareValue) => this.evaluateArrayIntersects(fieldValue, compareValue)
351
309
  };
352
- return new import_engine.StrategyEngine({
310
+ return new _engine.StrategyEngine({
353
311
  debug: false,
354
312
  enableTrace: false,
355
313
  operatorHandlers
356
314
  });
357
315
  }
358
316
  evaluateScheduleMatch(fieldValue, compareValue, scheduleList) {
359
- const scheduleDateTime = String(fieldValue || "");
317
+ const scheduleDateTime = String(fieldValue || '');
360
318
  const scheduleIds = this.normalizeNumberArray(compareValue);
361
- if (!scheduleIds.length)
362
- return true;
363
- if (!scheduleDateTime || !(scheduleList == null ? void 0 : scheduleList.length))
364
- return false;
365
- const matchedSchedules = scheduleList.filter(
366
- (schedule) => scheduleIds.includes(Number(schedule.id))
367
- );
368
- return (0, import_getDateIsInSchedule.getDateIsInSchedule)(scheduleDateTime, matchedSchedules);
319
+ if (!scheduleIds.length) return true;
320
+ if (!scheduleDateTime || !scheduleList?.length) return false;
321
+ const matchedSchedules = scheduleList.filter(schedule => scheduleIds.includes(Number(schedule.id)));
322
+ return (0, _getDateIsInSchedule.getDateIsInSchedule)(scheduleDateTime, matchedSchedules);
369
323
  }
370
324
  evaluateMenuMatch(fieldValue, compareValue, menuScopeMap) {
371
325
  const menuIds = this.normalizeNumberArray(compareValue);
372
- if (!menuIds.length)
373
- return true;
326
+ if (!menuIds.length) return true;
374
327
  for (const menuId of menuIds) {
375
328
  const scope = menuScopeMap.get(menuId);
376
- if (!scope)
377
- continue;
378
- if (this.isProductInMenuScope(fieldValue, scope))
379
- return true;
329
+ if (!scope) continue;
330
+ if (this.isProductInMenuScope(fieldValue, scope)) return true;
380
331
  }
381
332
  return false;
382
333
  }
383
334
  evaluateArrayIntersects(fieldValue, compareValue) {
384
335
  const fieldValues = this.normalizeComparableArray(fieldValue);
385
336
  const compareValues = this.normalizeComparableArray(compareValue);
386
- if (!fieldValues.length || !compareValues.length)
387
- return false;
337
+ if (!fieldValues.length || !compareValues.length) return false;
388
338
  const compareSet = new Set(compareValues);
389
- return fieldValues.some((item) => compareSet.has(item));
339
+ return fieldValues.some(item => compareSet.has(item));
390
340
  }
391
341
  collectScheduleIdsFromStrategies(strategyConfigs) {
392
- const scheduleIds = /* @__PURE__ */ new Set();
342
+ const scheduleIds = new Set();
393
343
  for (const config of strategyConfigs) {
394
- if (!this.isStrategyActive(config))
395
- continue;
344
+ if (!this.isStrategyActive(config)) continue;
396
345
  const rules = this.flattenConditionRules(config.conditions);
397
346
  for (const rule of rules) {
398
- if (rule.operator !== "schedule_match")
399
- continue;
347
+ if (rule.operator !== 'schedule_match') continue;
400
348
  for (const scheduleId of this.normalizeNumberArray(rule.value)) {
401
349
  scheduleIds.add(scheduleId);
402
350
  }
@@ -405,95 +353,89 @@ var DataVariantEvaluator = class {
405
353
  return Array.from(scheduleIds);
406
354
  }
407
355
  extractTimePointsFromSchedules(schedules) {
408
- const timePoints = /* @__PURE__ */ new Set();
356
+ const timePoints = new Set();
409
357
  for (const schedule of schedules) {
410
358
  switch (schedule.type) {
411
- case "standard": {
412
- this.addDateTimePoint(timePoints, schedule.start_time);
413
- this.addDateTimePoint(timePoints, schedule.end_time);
414
- break;
415
- }
416
- case "time-slots": {
417
- const slots = Array.isArray(schedule.time_slot) ? schedule.time_slot : [];
418
- for (const slot of slots) {
419
- this.addRawTimePoint(timePoints, slot.start_time);
420
- this.addRawTimePoint(timePoints, slot.end_time);
359
+ case 'standard':
360
+ {
361
+ this.addDateTimePoint(timePoints, schedule.start_time);
362
+ this.addDateTimePoint(timePoints, schedule.end_time);
363
+ break;
421
364
  }
422
- break;
423
- }
424
- case "designation": {
425
- const designations = Array.isArray(schedule.designation) ? schedule.designation : schedule.designation ? [schedule.designation] : [];
426
- for (const designation of designations) {
427
- this.addRawTimePoint(timePoints, designation.start_time);
428
- this.addRawTimePoint(timePoints, designation.end_time);
365
+ case 'time-slots':
366
+ {
367
+ const slots = Array.isArray(schedule.time_slot) ? schedule.time_slot : [];
368
+ for (const slot of slots) {
369
+ this.addRawTimePoint(timePoints, slot.start_time);
370
+ this.addRawTimePoint(timePoints, slot.end_time);
371
+ }
372
+ break;
373
+ }
374
+ case 'designation':
375
+ {
376
+ const designations = Array.isArray(schedule.designation) ? schedule.designation : schedule.designation ? [schedule.designation] : [];
377
+ for (const designation of designations) {
378
+ this.addRawTimePoint(timePoints, designation.start_time);
379
+ this.addRawTimePoint(timePoints, designation.end_time);
380
+ }
381
+ break;
429
382
  }
430
- break;
431
- }
432
383
  default:
433
384
  break;
434
385
  }
435
386
  }
436
- return Array.from(timePoints).sort(
437
- (a, b) => this.timeToMinutes(a) - this.timeToMinutes(b)
438
- );
387
+ return Array.from(timePoints).sort((a, b) => this.timeToMinutes(a) - this.timeToMinutes(b));
439
388
  }
440
389
  addDateTimePoint(points, value) {
441
390
  const time = this.extractTimeFromDateTime(value);
442
- if (time)
443
- points.add(time);
391
+ if (time) points.add(time);
444
392
  }
445
393
  addRawTimePoint(points, value) {
446
394
  const time = this.normalizeTime(value);
447
- if (time)
448
- points.add(time);
395
+ if (time) points.add(time);
449
396
  }
450
397
  extractTimeFromDateTime(value) {
451
- if (!value)
452
- return null;
398
+ if (!value) return null;
453
399
  const match = value.match(/(\d{1,2}):(\d{2})/);
454
- if (!match)
455
- return null;
456
- return `${match[1].padStart(2, "0")}:${match[2]}`;
400
+ if (!match) return null;
401
+ return `${match[1].padStart(2, '0')}:${match[2]}`;
457
402
  }
458
403
  normalizeTime(value) {
459
- if (!value)
460
- return null;
404
+ if (!value) return null;
461
405
  const match = value.match(/^(\d{1,2}):(\d{2})/);
462
- if (!match)
463
- return null;
464
- return `${match[1].padStart(2, "0")}:${match[2]}`;
406
+ if (!match) return null;
407
+ return `${match[1].padStart(2, '0')}:${match[2]}`;
465
408
  }
466
409
  timeToMinutes(value) {
467
- const [hour, minute] = value.split(":").map((item) => Number(item));
468
- if (!Number.isFinite(hour) || !Number.isFinite(minute))
469
- return 0;
410
+ const [hour, minute] = value.split(':').map(item => Number(item));
411
+ if (!Number.isFinite(hour) || !Number.isFinite(minute)) return 0;
470
412
  return hour * 60 + minute;
471
413
  }
472
414
  isProductInMenuScope(product, scope) {
473
- if (scope.isAllProducts)
474
- return true;
475
- if (!product || typeof product !== "object")
476
- return false;
415
+ if (scope.isAllProducts) return true;
416
+ if (!product || typeof product !== 'object') return false;
477
417
  const productId = this.toNumber(product.id ?? product.product_id);
478
418
  const variantId = this.toNumber(product.product_variant_id);
479
419
  const productKey = this.buildProductKey(productId, variantId);
480
- const collectionIds = Array.isArray(product.collection_ids) ? product.collection_ids.map((id) => this.toNumber(id)) : [];
481
- return collectionIds.some((id) => scope.collectionIds.has(id)) || scope.productKeys.has(productKey) || scope.productAllVariantIds.has(productId);
420
+ const collectionIds = Array.isArray(product.collection_ids) ? product.collection_ids.map(id => this.toNumber(id)) : [];
421
+ return collectionIds.some(id => scope.collectionIds.has(id)) || scope.productKeys.has(productKey) || scope.productAllVariantIds.has(productId);
482
422
  }
483
423
  mergeMatchedVariants(product, matchedVariants) {
484
- const original = { ...product };
424
+ const original = {
425
+ ...product
426
+ };
485
427
  const sortedVariants = [...matchedVariants].sort((a, b) => {
486
- if (a.priority !== b.priority)
487
- return a.priority - b.priority;
428
+ if (a.priority !== b.priority) return a.priority - b.priority;
488
429
  return Number(a.ruleId) - Number(b.ruleId);
489
430
  });
490
- const result = { ...product };
431
+ const result = {
432
+ ...product
433
+ };
491
434
  const appliedRuleIds = [];
492
- const appliedFields = /* @__PURE__ */ new Set();
435
+ const appliedFields = new Set();
493
436
  for (const matched of sortedVariants) {
494
437
  for (const [key, value] of Object.entries(matched.data)) {
495
- if (value === void 0)
496
- continue;
438
+ if (value === undefined) continue;
497
439
  result[key] = value;
498
440
  appliedFields.add(key);
499
441
  }
@@ -510,31 +452,20 @@ var DataVariantEvaluator = class {
510
452
  return Array.isArray(product.data_variants) ? product.data_variants : [];
511
453
  }
512
454
  normalizeStrategyConfigs(configs) {
513
- return configs.filter(
514
- (config) => {
515
- var _a;
516
- return ((_a = config == null ? void 0 : config.metadata) == null ? void 0 : _a.type) === "data_variant";
517
- }
518
- );
455
+ return configs.filter(config => config?.metadata?.type === 'data_variant');
519
456
  }
520
457
  isStrategyActive(config) {
521
- var _a;
522
- const status = (_a = config.metadata.custom) == null ? void 0 : _a.status;
523
- return !status || status === "active";
458
+ const status = config.metadata.custom?.status;
459
+ return !status || status === 'active';
524
460
  }
525
461
  getStrategyPriority(config) {
526
- var _a;
527
- const priority = Number((_a = config.metadata.custom) == null ? void 0 : _a.priority);
528
- if (Number.isFinite(priority))
529
- return priority;
530
- return Math.max(
531
- 0,
532
- ...config.actions.map((action) => Number(action.priority || 0))
533
- );
462
+ const priority = Number(config.metadata.custom?.priority);
463
+ if (Number.isFinite(priority)) return priority;
464
+ return Math.max(0, ...config.actions.map(action => Number(action.priority || 0)));
534
465
  }
535
466
  createAlwaysTrueConditions(actionIds) {
536
467
  return {
537
- operator: "and",
468
+ operator: 'and',
538
469
  rules: [],
539
470
  actionIds
540
471
  };
@@ -551,18 +482,16 @@ var DataVariantEvaluator = class {
551
482
  return rules;
552
483
  }
553
484
  isConditionGroup(rule) {
554
- return "rules" in rule && Array.isArray(rule.rules);
485
+ return 'rules' in rule && Array.isArray(rule.rules);
555
486
  }
556
487
  normalizeNumberArray(value) {
557
- if (!Array.isArray(value))
558
- return [];
559
- return value.map((item) => this.toNumber(item)).filter((item) => item > 0);
488
+ if (!Array.isArray(value)) return [];
489
+ return value.map(item => this.toNumber(item)).filter(item => item > 0);
560
490
  }
561
491
  normalizeComparableArray(value) {
562
- const list = Array.isArray(value) ? value : value == null || value === "" ? [] : [value];
563
- const normalized = list.map((item) => {
564
- if (item == null || item === "")
565
- return "";
492
+ const list = Array.isArray(value) ? value : value == null || value === '' ? [] : [value];
493
+ const normalized = list.map(item => {
494
+ if (item == null || item === '') return '';
566
495
  const parsed = Number(item);
567
496
  return Number.isFinite(parsed) ? String(parsed) : String(item).trim();
568
497
  }).filter(Boolean);
@@ -575,9 +504,6 @@ var DataVariantEvaluator = class {
575
504
  const parsed = Number(value);
576
505
  return Number.isFinite(parsed) ? parsed : 0;
577
506
  }
578
- };
579
- var evaluator_default = DataVariantEvaluator;
580
- // Annotate the CommonJS export names for ESM import in node:
581
- 0 && (module.exports = {
582
- DataVariantEvaluator
583
- });
507
+ }
508
+ exports.DataVariantEvaluator = DataVariantEvaluator;
509
+ var _default = exports.default = DataVariantEvaluator;