@vue-skuilder/db 0.2.29 → 0.2.30

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.
@@ -3141,6 +3141,7 @@ __export(eloDistance_exports, {
3141
3141
  DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
3142
3142
  createEloDistanceFilter: () => createEloDistanceFilter,
3143
3143
  default: () => EloDistanceFilter,
3144
+ mountMultiDimEloToggle: () => mountMultiDimEloToggle,
3144
3145
  tagAwareGap: () => tagAwareGap
3145
3146
  });
3146
3147
  function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
@@ -3151,6 +3152,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
3151
3152
  function resolveConfig(config) {
3152
3153
  return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
3153
3154
  }
3155
+ function readMultiDimElo() {
3156
+ try {
3157
+ return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
3158
+ } catch {
3159
+ return false;
3160
+ }
3161
+ }
3162
+ function mountMultiDimEloToggle() {
3163
+ if (typeof window === "undefined") return;
3164
+ const win = window;
3165
+ win.skuilder = win.skuilder || {};
3166
+ Object.defineProperty(win.skuilder, "multiDimElo", {
3167
+ configurable: true,
3168
+ enumerable: true,
3169
+ get: () => multiDimElo,
3170
+ set: (on) => {
3171
+ multiDimElo = on === true;
3172
+ try {
3173
+ if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
3174
+ else localStorage.removeItem(MULTI_DIM_ELO_KEY);
3175
+ } catch (e) {
3176
+ logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
3177
+ }
3178
+ logger.info(
3179
+ `[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
3180
+ );
3181
+ }
3182
+ });
3183
+ }
3154
3184
  function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
3155
3185
  const globalGap = cardElo.global.score - userElo.global.score;
3156
3186
  const tags = [];
@@ -3178,7 +3208,7 @@ function tagReason(tags, globalGap) {
3178
3208
  async function applyEloDistance(cards, context, config, source) {
3179
3209
  const { course, userElo, userCourseElo } = context;
3180
3210
  const { halfLife, minMultiplier, maxMultiplier } = config;
3181
- const tagAware = config.tagAware && userCourseElo !== void 0;
3211
+ const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
3182
3212
  const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
3183
3213
  const fetched = /* @__PURE__ */ new Map();
3184
3214
  if (missing.length > 0) {
@@ -3192,10 +3222,10 @@ async function applyEloDistance(cards, context, config, source) {
3192
3222
  const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
3193
3223
  let distance = Math.abs(cardElo - userElo);
3194
3224
  let how = "";
3195
- if (tagAware && full) {
3196
- const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
3197
- distance = Math.abs(t.gap);
3198
- if (t.tags.length > 0) how = tagReason(t.tags, t.globalGap);
3225
+ if (tagAware) {
3226
+ const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
3227
+ if (t) distance = Math.abs(t.gap);
3228
+ how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
3199
3229
  }
3200
3230
  const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
3201
3231
  const newScore = card.score * multiplier;
@@ -3228,21 +3258,25 @@ function createEloDistanceFilter(config) {
3228
3258
  transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
3229
3259
  };
3230
3260
  }
3231
- var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
3261
+ var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
3232
3262
  var init_eloDistance = __esm({
3233
3263
  "src/core/navigators/filters/eloDistance.ts"() {
3234
3264
  "use strict";
3235
3265
  init_navigators();
3266
+ init_logger();
3236
3267
  DEFAULT_ELO_DISTANCE_CONFIG = {
3237
3268
  halfLife: 300,
3238
3269
  minMultiplier: 0.05,
3239
3270
  maxMultiplier: 1,
3240
- tagAware: true,
3271
+ tagAware: false,
3241
3272
  minTagCount: 3
3242
3273
  };
3243
3274
  TAG_CONFIDENCE_HALF = 10;
3244
3275
  COUNT_ONLY_SENTINEL = -1;
3245
3276
  DEFAULT_CARD_ELO = 1e3;
3277
+ MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
3278
+ multiDimElo = readMultiDimElo();
3279
+ mountMultiDimEloToggle();
3246
3280
  EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
3247
3281
  name;
3248
3282
  /** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */