@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.
@@ -3216,6 +3216,7 @@ __export(eloDistance_exports, {
3216
3216
  DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
3217
3217
  createEloDistanceFilter: () => createEloDistanceFilter,
3218
3218
  default: () => EloDistanceFilter,
3219
+ mountMultiDimEloToggle: () => mountMultiDimEloToggle,
3219
3220
  tagAwareGap: () => tagAwareGap
3220
3221
  });
3221
3222
  function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
@@ -3226,6 +3227,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
3226
3227
  function resolveConfig(config) {
3227
3228
  return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
3228
3229
  }
3230
+ function readMultiDimElo() {
3231
+ try {
3232
+ return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
3233
+ } catch {
3234
+ return false;
3235
+ }
3236
+ }
3237
+ function mountMultiDimEloToggle() {
3238
+ if (typeof window === "undefined") return;
3239
+ const win = window;
3240
+ win.skuilder = win.skuilder || {};
3241
+ Object.defineProperty(win.skuilder, "multiDimElo", {
3242
+ configurable: true,
3243
+ enumerable: true,
3244
+ get: () => multiDimElo,
3245
+ set: (on) => {
3246
+ multiDimElo = on === true;
3247
+ try {
3248
+ if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
3249
+ else localStorage.removeItem(MULTI_DIM_ELO_KEY);
3250
+ } catch (e) {
3251
+ logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
3252
+ }
3253
+ logger.info(
3254
+ `[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
3255
+ );
3256
+ }
3257
+ });
3258
+ }
3229
3259
  function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
3230
3260
  const globalGap = cardElo.global.score - userElo.global.score;
3231
3261
  const tags = [];
@@ -3253,7 +3283,7 @@ function tagReason(tags, globalGap) {
3253
3283
  async function applyEloDistance(cards, context, config, source) {
3254
3284
  const { course, userElo, userCourseElo } = context;
3255
3285
  const { halfLife, minMultiplier, maxMultiplier } = config;
3256
- const tagAware = config.tagAware && userCourseElo !== void 0;
3286
+ const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
3257
3287
  const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
3258
3288
  const fetched = /* @__PURE__ */ new Map();
3259
3289
  if (missing.length > 0) {
@@ -3267,10 +3297,10 @@ async function applyEloDistance(cards, context, config, source) {
3267
3297
  const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
3268
3298
  let distance = Math.abs(cardElo - userElo);
3269
3299
  let how = "";
3270
- if (tagAware && full) {
3271
- const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
3272
- distance = Math.abs(t.gap);
3273
- if (t.tags.length > 0) how = tagReason(t.tags, t.globalGap);
3300
+ if (tagAware) {
3301
+ const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
3302
+ if (t) distance = Math.abs(t.gap);
3303
+ how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
3274
3304
  }
3275
3305
  const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
3276
3306
  const newScore = card.score * multiplier;
@@ -3303,21 +3333,25 @@ function createEloDistanceFilter(config) {
3303
3333
  transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
3304
3334
  };
3305
3335
  }
3306
- var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
3336
+ var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
3307
3337
  var init_eloDistance = __esm({
3308
3338
  "src/core/navigators/filters/eloDistance.ts"() {
3309
3339
  "use strict";
3310
3340
  init_navigators();
3341
+ init_logger();
3311
3342
  DEFAULT_ELO_DISTANCE_CONFIG = {
3312
3343
  halfLife: 300,
3313
3344
  minMultiplier: 0.05,
3314
3345
  maxMultiplier: 1,
3315
- tagAware: true,
3346
+ tagAware: false,
3316
3347
  minTagCount: 3
3317
3348
  };
3318
3349
  TAG_CONFIDENCE_HALF = 10;
3319
3350
  COUNT_ONLY_SENTINEL = -1;
3320
3351
  DEFAULT_CARD_ELO = 1e3;
3352
+ MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
3353
+ multiDimElo = readMultiDimElo();
3354
+ mountMultiDimEloToggle();
3321
3355
  EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
3322
3356
  name;
3323
3357
  /** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */