@vue-skuilder/standalone-ui 0.2.28 → 0.2.29

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.
@@ -24642,6 +24642,7 @@ var init_v4 = __esmMin((() => {
24642
24642
  ContentNavigator: () => ContentNavigator,
24643
24643
  CouchDBToStaticPacker: () => CouchDBToStaticPacker,
24644
24644
  CourseLookup: () => CourseLookup,
24645
+ DEFAULT_REGULATOR_CONFIG: () => DEFAULT_REGULATOR_CONFIG,
24645
24646
  DIVERSITY_FLOOR: () => DIVERSITY_FLOOR,
24646
24647
  DIVERSITY_STRENGTH: () => DIVERSITY_STRENGTH,
24647
24648
  DocType: () => DocType,
@@ -24650,11 +24651,13 @@ var init_v4 = __esmMin((() => {
24650
24651
  FileSystemError: () => FileSystemError,
24651
24652
  GuestUsername: () => GuestUsername,
24652
24653
  HYDRATION_MARKER_ID: () => HYDRATION_MARKER_ID,
24654
+ INTAKE_CLOCK_KEY: () => INTAKE_CLOCK_KEY,
24653
24655
  Loggable: () => Loggable,
24654
24656
  NOT_SET: () => NOT_SET,
24655
24657
  NavigatorRole: () => NavigatorRole,
24656
24658
  NavigatorRoles: () => NavigatorRoles,
24657
24659
  Navigators: () => Navigators,
24660
+ PIPELINE_STAGES: () => PIPELINE_STAGES,
24658
24661
  QuotaRoundRobinMixer: () => QuotaRoundRobinMixer,
24659
24662
  REVIEW_TIME_FORMAT: () => REVIEW_TIME_FORMAT2,
24660
24663
  SessionController: () => SessionController,
@@ -24662,6 +24665,7 @@ var init_v4 = __esmMin((() => {
24662
24665
  TagFilteredContentSource: () => TagFilteredContentSource,
24663
24666
  _resetDataLayer: () => _resetDataLayer,
24664
24667
  aggregateOutcomesForGradient: () => aggregateOutcomesForGradient,
24668
+ applyReading: () => applyReading,
24665
24669
  areQuestionRecords: () => areQuestionRecords,
24666
24670
  buildStrategyStateId: () => buildStrategyStateId,
24667
24671
  captureMixerRun: () => captureMixerRun,
@@ -24680,6 +24684,7 @@ var init_v4 = __esmMin((() => {
24680
24684
  drainCapturedRuns: () => drainCapturedRuns,
24681
24685
  endSessionTracking: () => endSessionTracking,
24682
24686
  ensureAppDataDirectory: () => ensureAppDataDirectory,
24687
+ frozenMsAt: () => frozenMsAt,
24683
24688
  getActiveController: () => getActiveController,
24684
24689
  getActivePipeline: () => getActivePipeline,
24685
24690
  getAppDataDirectory: () => getAppDataDirectory,
@@ -24689,6 +24694,7 @@ var init_v4 = __esmMin((() => {
24689
24694
  getDbPath: () => getDbPath,
24690
24695
  getDefaultLearnableWeight: () => getDefaultLearnableWeight,
24691
24696
  getLapses: () => getLapses,
24697
+ getRegisteredFilterKind: () => getRegisteredFilterKind,
24692
24698
  getRegisteredNavigator: () => getRegisteredNavigator,
24693
24699
  getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
24694
24700
  getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
@@ -24702,6 +24708,8 @@ var init_v4 = __esmMin((() => {
24702
24708
  initializeDataDirectory: () => initializeDataDirectory,
24703
24709
  initializeDataLayer: () => initializeDataLayer,
24704
24710
  initializeNavigatorRegistry: () => initializeNavigatorRegistry,
24711
+ intakeHours: () => intakeHours,
24712
+ intakeReading: () => intakeReading,
24705
24713
  isDataShapeRegistered: () => isDataShapeRegistered,
24706
24714
  isDataShapeSchemaAvailable: () => isDataShapeSchemaAvailable,
24707
24715
  isFilter: () => isFilter,
@@ -24721,6 +24729,7 @@ var init_v4 = __esmMin((() => {
24721
24729
  newSessionId: () => newSessionId,
24722
24730
  parseCardHistoryID: () => parseCardHistoryID,
24723
24731
  pipelineDebugAPI: () => pipelineDebugAPI,
24732
+ planPipeline: () => planPipeline,
24724
24733
  processCustomQuestionsData: () => processCustomQuestionsData,
24725
24734
  recordCardPresentation: () => recordCardPresentation,
24726
24735
  recordUserOutcome: () => recordUserOutcome,
@@ -24734,12 +24743,16 @@ var init_v4 = __esmMin((() => {
24734
24743
  removeCustomQuestionTypes: () => removeCustomQuestionTypes,
24735
24744
  removeDataShape: () => removeDataShape,
24736
24745
  removeQuestionType: () => removeQuestionType,
24746
+ resetIntakeClock: () => resetIntakeClock,
24747
+ reviewMassReading: () => reviewMassReading,
24748
+ reviewWeight: () => reviewWeight,
24737
24749
  runPeriodUpdate: () => runPeriodUpdate,
24738
24750
  scoreAccuracyInZone: () => scoreAccuracyInZone,
24739
24751
  sessionDebugAPI: () => sessionDebugAPI,
24740
24752
  setDebugSessionId: () => setDebugSessionId,
24741
24753
  snapshotQueues: () => snapshotQueues,
24742
24754
  startSessionTracking: () => startSessionTracking,
24755
+ stepIntakeClock: () => stepIntakeClock,
24743
24756
  toggleSessionOverlay: () => toggleSessionOverlay,
24744
24757
  updateLearningState: () => updateLearningState,
24745
24758
  updateStrategyWeight: () => updateStrategyWeight,
@@ -24952,43 +24965,43 @@ function parseCardElo(t) {
24952
24965
  let u = c.reason.match(/card:\s*(\d+)/);
24953
24966
  return u ? parseInt(u[1], 10) : void 0;
24954
24967
  }
24955
- function buildRunReport(t, c, u, d, m, g, b, S, C, w, T) {
24956
- let E = new Set(S.map((t) => t.cardId)), toReport = (t) => ({
24968
+ function buildRunReport(t, c, u, d, m, g, b, S, C, w, T, E) {
24969
+ let D = new Set(S.map((t) => t.cardId)), toReport = (t) => ({
24957
24970
  cardId: t.cardId,
24958
24971
  courseId: t.courseId,
24959
24972
  origin: getOrigin(t),
24960
24973
  generator: t.provenance[0]?.strategyName || t.provenance[0]?.strategy,
24961
24974
  finalScore: t.score,
24962
- cardElo: parseCardElo(t.provenance),
24975
+ cardElo: t.cardElo ?? parseCardElo(t.provenance),
24963
24976
  provenance: t.provenance,
24964
24977
  tags: t.tags,
24965
- selected: E.has(t.cardId)
24966
- }), D = [], O = [], xr = [], Sr = 0;
24967
- for (let t of b) E.has(t.cardId) ? D.push(toReport(t)) : Sr < DISCARDED_KEEP_TOP ? (O.push(toReport(t)), Sr++) : xr.push(t);
24968
- let Cr = [...D, ...O], wr;
24969
- if (xr.length > 0) {
24978
+ selected: D.has(t.cardId)
24979
+ }), O = [], xr = [], Sr = [], Cr = 0;
24980
+ for (let t of b) D.has(t.cardId) ? O.push(toReport(t)) : Cr < DISCARDED_KEEP_TOP ? (xr.push(toReport(t)), Cr++) : Sr.push(t);
24981
+ let wr = [...O, ...xr], Tr;
24982
+ if (Sr.length > 0) {
24970
24983
  let t = Infinity, c = -Infinity, u = Infinity, d = -Infinity, m = !1;
24971
- for (let g of xr) {
24984
+ for (let g of Sr) {
24972
24985
  g.score < t && (t = g.score), g.score > c && (c = g.score);
24973
24986
  let b = parseCardElo(g.provenance);
24974
24987
  b !== void 0 && (m = !0, b < u && (u = b), b > d && (d = b));
24975
24988
  }
24976
24989
  let g = m ? `, ELO ${u}\u2013${d}` : "";
24977
- wr = {
24978
- count: xr.length,
24990
+ Tr = {
24991
+ count: Sr.length,
24979
24992
  scoreRange: [t, c],
24980
24993
  eloRange: m ? [u, d] : void 0,
24981
- note: `${xr.length} additional candidate(s) scored below the top ${DISCARDED_KEEP_TOP} near-misses and were not retained (score ${t.toExponential(2)}\u2013${c.toExponential(2)}${g}). Likely ELO-window pull remnants filtered out by hierarchy/lesson/priority gates.`
24994
+ note: `${Sr.length} additional candidate(s) scored below the top ${DISCARDED_KEEP_TOP} near-misses and were not retained (score ${t.toExponential(2)}\u2013${c.toExponential(2)}${g}). Likely ELO-window pull remnants filtered out by hierarchy/lesson/priority gates.`
24982
24995
  };
24983
24996
  }
24984
- let isUnselectedNew = (t) => !t.reviewID && !E.has(t.cardId), generatorScore = (t) => t.provenance[0]?.score ?? 0, Tr = new Set(b.map((t) => t.cardId)), hintExcluded = (t) => t.score > 0 && !Tr.has(t.cardId), Er;
24985
- for (let t of b) isUnselectedNew(t) && (!Er || t.score > Er.score) && (Er = t);
24986
- let Dr;
24987
- for (let t of T ?? b) !isUnselectedNew(t) || hintExcluded(t) || (!Dr || generatorScore(t) > generatorScore(Dr)) && (Dr = t);
24988
- let Or = Er || Dr ? {
24989
- ...Er ? { nextInLine: toReport(Er) } : {},
24990
- ...Dr && Dr.cardId !== Er?.cardId ? { topGenerated: toReport(Dr) } : {}
24991
- } : void 0, kr = S.filter((t) => getOrigin(t) === "review").length, Ar = S.filter((t) => getOrigin(t) === "new").length;
24997
+ let isUnselectedNew = (t) => !t.reviewID && !D.has(t.cardId), generatorScore = (t) => t.provenance[0]?.score ?? 0, Er = new Set(b.map((t) => t.cardId)), hintExcluded = (t) => t.score > 0 && !Er.has(t.cardId), Dr;
24998
+ for (let t of b) isUnselectedNew(t) && (!Dr || t.score > Dr.score) && (Dr = t);
24999
+ let Or;
25000
+ for (let t of T ?? b) !isUnselectedNew(t) || hintExcluded(t) || (!Or || generatorScore(t) > generatorScore(Or)) && (Or = t);
25001
+ let kr = Dr || Or ? {
25002
+ ...Dr ? { nextInLine: toReport(Dr) } : {},
25003
+ ...Or && Or.cardId !== Dr?.cardId ? { topGenerated: toReport(Or) } : {}
25004
+ } : void 0, Ar = S.filter((t) => getOrigin(t) === "review").length, jr = S.filter((t) => getOrigin(t) === "new").length;
24992
25005
  return {
24993
25006
  courseId: t,
24994
25007
  courseName: c,
@@ -24999,11 +25012,12 @@ function buildRunReport(t, c, u, d, m, g, b, S, C, w, T) {
24999
25012
  filters: g,
25000
25013
  hints: w,
25001
25014
  finalCount: S.length,
25002
- reviewsSelected: kr,
25003
- newSelected: Ar,
25004
- cards: Cr,
25005
- unselectedNew: Or,
25006
- discardedTail: wr
25015
+ reviewsSelected: Ar,
25016
+ newSelected: jr,
25017
+ cards: wr,
25018
+ unselectedNew: kr,
25019
+ discardedTail: Tr,
25020
+ ...E ? { regulators: E } : {}
25007
25021
  };
25008
25022
  }
25009
25023
  function formatProvenance(t) {
@@ -25212,6 +25226,16 @@ function mountPipelineDebugger() {
25212
25226
  function captureSrsBacklog(t) {
25213
25227
  snapshots.set(t.courseId, t);
25214
25228
  }
25229
+ function noteReviewPressure(t, c) {
25230
+ let u = snapshots.get(t);
25231
+ u && snapshots.set(t, {
25232
+ ...u,
25233
+ reviewMass: c.mass,
25234
+ healthyBacklog: c.healthyMass,
25235
+ backlogGrowthRate: c.rate,
25236
+ backlogMultiplier: c.multiplier
25237
+ });
25238
+ }
25215
25239
  function getSrsBacklogDebug() {
25216
25240
  return [...snapshots.values()].sort((t, c) => c.timestamp - t.timestamp);
25217
25241
  }
@@ -25297,32 +25321,158 @@ function unmetIntroExposeTags(t, c, u) {
25297
25321
  function pickTopByScore(t, c) {
25298
25322
  return [...t].sort((t, c) => c.score - t.score || t.cardId.localeCompare(c.cardId)).slice(0, c);
25299
25323
  }
25324
+ function clamp01(t) {
25325
+ return Math.min(1, Math.max(0, t));
25326
+ }
25327
+ function reviewWeight(t, c, u) {
25328
+ return t.reviewUrgency !== void 0 && c !== void 0 && c > 0 ? clamp01(t.reviewUrgency * (t.score / c)) : clamp01(t.score / u);
25329
+ }
25330
+ function reviewMassReading(t, c, u = DEFAULT_REGULATOR_CONFIG.reviewMass) {
25331
+ let d = t.reduce((t, d) => t + reviewWeight(d, c.get(d.cardId), u.referenceScore), 0);
25332
+ return {
25333
+ name: "review-mass",
25334
+ class: "review",
25335
+ urgency: d,
25336
+ multiplier: d > u.healthyMass ? u.rate ** +((d - u.healthyMass) / u.healthyMass) : 1,
25337
+ applied: t.length,
25338
+ inputs: {
25339
+ due: t.length,
25340
+ mass: d,
25341
+ healthyMass: u.healthyMass
25342
+ }
25343
+ };
25344
+ }
25345
+ function resetIntakeClock(t) {
25346
+ return {
25347
+ lastNewAt: new Date(t).toISOString(),
25348
+ frozenMs: 0,
25349
+ unservableSince: null
25350
+ };
25351
+ }
25352
+ function frozenMsAt(t, c) {
25353
+ let u = t.unservableSince ? Math.max(0, c - Date.parse(t.unservableSince)) : 0;
25354
+ return t.frozenMs + u;
25355
+ }
25356
+ function intakeHours(t, c) {
25357
+ let u = c - Date.parse(t.lastNewAt);
25358
+ return Math.max(0, u - frozenMsAt(t, c)) / 36e5;
25359
+ }
25360
+ function stepIntakeClock(t, c, u) {
25361
+ return u === 0 && !t.unservableSince ? {
25362
+ ...t,
25363
+ unservableSince: new Date(c).toISOString()
25364
+ } : u > 0 && t.unservableSince ? {
25365
+ ...t,
25366
+ frozenMs: frozenMsAt(t, c),
25367
+ unservableSince: null
25368
+ } : t;
25369
+ }
25370
+ function intakeReading(t, c, u, d = DEFAULT_REGULATOR_CONFIG.intake) {
25371
+ let m = intakeHours(t, c);
25372
+ return {
25373
+ name: "intake",
25374
+ class: "new",
25375
+ urgency: m,
25376
+ multiplier: u.eligibleNew > 0 ? d.rate ** +(m / d.scaleHours) : 1,
25377
+ applied: u.eligibleNew,
25378
+ inputs: {
25379
+ hoursSinceNew: m,
25380
+ frozenHours: frozenMsAt(t, c) / 36e5,
25381
+ eligibleNew: u.eligibleNew,
25382
+ newCandidates: u.newCandidates
25383
+ }
25384
+ };
25385
+ }
25386
+ function applyReading(t, c) {
25387
+ if (c.multiplier === 1) return;
25388
+ let u = c.name === "review-mass" ? `review mass ${c.urgency.toFixed(1)} (healthy ${c.inputs.healthyMass}) \u2192 \xD7${c.multiplier.toFixed(2)}` : `${c.urgency.toFixed(1)}h since a new card \u2192 \xD7${c.multiplier.toFixed(2)}`;
25389
+ for (let d of t) d.score *= c.multiplier, d.provenance.push({
25390
+ strategy: "regulator",
25391
+ strategyName: `Regulator: ${REGULATOR_LABEL[c.name]}`,
25392
+ strategyId: `regulator-${c.name}`,
25393
+ action: c.multiplier > 1 ? "boosted" : "penalized",
25394
+ score: d.score,
25395
+ reason: u
25396
+ });
25397
+ }
25300
25398
  function computeMultiplier(t, c, u, d) {
25301
25399
  let m = t / c, g = Math.exp(-(m * m));
25302
25400
  return u + (d - u) * g;
25303
25401
  }
25304
- function createEloDistanceFilter(t) {
25305
- let c = t?.halfLife ?? DEFAULT_HALF_LIFE, u = t?.minMultiplier ?? DEFAULT_MIN_MULTIPLIER, d = t?.maxMultiplier ?? DEFAULT_MAX_MULTIPLIER;
25402
+ function resolveConfig(t) {
25306
25403
  return {
25307
- name: "ELO Distance Filter",
25308
- async transform(t, m) {
25309
- let { course: g, userElo: b } = m, S = t.map((t) => t.cardId), C = await g.getCardEloData(S);
25310
- return t.map((t, m) => {
25311
- let g = C[m]?.global?.score ?? 1e3, S = Math.abs(g - b), w = computeMultiplier(S, c, u, d), T = t.score * w, E = w < d - .01 ? "penalized" : "passed";
25312
- return {
25313
- ...t,
25314
- score: T,
25315
- provenance: [...t.provenance, {
25316
- strategy: "eloDistance",
25317
- strategyName: "ELO Distance Filter",
25318
- strategyId: "ELO_DISTANCE_FILTER",
25319
- action: E,
25320
- score: T,
25321
- reason: `ELO distance ${Math.round(S)} (card: ${Math.round(g)}, user: ${Math.round(b)}) \u2192 ${w.toFixed(2)}x`
25322
- }]
25323
- };
25324
- });
25404
+ ...DEFAULT_ELO_DISTANCE_CONFIG,
25405
+ ...t
25406
+ };
25407
+ }
25408
+ function tagAwareGap(t, c, u, d) {
25409
+ let m = c.global.score - u.global.score, g = [];
25410
+ for (let m of t) {
25411
+ let t = u.tags[m];
25412
+ if (!t || t.score === COUNT_ONLY_SENTINEL || t.count < d) continue;
25413
+ let b = c.tags[m]?.score ?? c.global.score;
25414
+ g.push({
25415
+ tag: m,
25416
+ gap: b - t.score,
25417
+ weight: t.count / (t.count + TAG_CONFIDENCE_HALF)
25418
+ });
25419
+ }
25420
+ if (g.length === 0) return {
25421
+ gap: m,
25422
+ globalGap: m,
25423
+ tags: g
25424
+ };
25425
+ let b = g.reduce((t, c) => t + c.weight, 0), S = g.reduce((t, c) => t + c.weight * c.gap, 0) / b, C = b / (b + 1);
25426
+ return {
25427
+ gap: C * S + (1 - C) * m,
25428
+ globalGap: m,
25429
+ tags: g
25430
+ };
25431
+ }
25432
+ function tagReason(t, c) {
25433
+ let u = [...t].sort((t, c) => Math.abs(c.gap) * c.weight - Math.abs(t.gap) * t.weight).slice(0, 3).map((t) => `${t.tag} ${t.gap >= 0 ? "+" : ""}${Math.round(t.gap)}`).join(", "), d = t.length > 3 ? `, +${t.length - 3} more` : "";
25434
+ return ` on ${t.length} shared tag(s) [${u}${d}] (global ${c >= 0 ? "+" : ""}${Math.round(c)})`;
25435
+ }
25436
+ async function applyEloDistance(t, c, u, d) {
25437
+ let { course: m, userElo: g, userCourseElo: b } = c, { halfLife: S, minMultiplier: C, maxMultiplier: w } = u, T = u.tagAware && b !== void 0, E = t.filter((t) => T || t.cardElo === void 0).map((t) => t.cardId), D = /* @__PURE__ */ new Map();
25438
+ if (E.length > 0) {
25439
+ let t = await m.getCardEloData(E);
25440
+ E.forEach((c, u) => {
25441
+ t[u] && D.set(c, t[u]);
25442
+ });
25443
+ }
25444
+ return t.map((t) => {
25445
+ let c = D.get(t.cardId), m = c?.global?.score ?? t.cardElo ?? DEFAULT_CARD_ELO, E = Math.abs(m - g), O = "";
25446
+ if (T && c) {
25447
+ let d = tagAwareGap(t.tags ?? [], c, b, u.minTagCount);
25448
+ E = Math.abs(d.gap), d.tags.length > 0 && (O = tagReason(d.tags, d.globalGap));
25325
25449
  }
25450
+ let xr = computeMultiplier(E, S, C, w), Sr = t.score * xr, Cr = xr < w - .01 ? "penalized" : "passed";
25451
+ return {
25452
+ ...t,
25453
+ cardElo: m,
25454
+ score: Sr,
25455
+ provenance: [...t.provenance, {
25456
+ strategy: "eloDistance",
25457
+ strategyName: d.name,
25458
+ strategyId: d.strategyId,
25459
+ action: Cr,
25460
+ score: Sr,
25461
+ reason: `ELO distance ${Math.round(E)} (card: ${Math.round(m)}, user: ${Math.round(g)})${O} \u2192 ${xr.toFixed(2)}x`
25462
+ }]
25463
+ };
25464
+ });
25465
+ }
25466
+ function createEloDistanceFilter(t) {
25467
+ let c = resolveConfig(t), u = {
25468
+ name: "ELO Distance Filter",
25469
+ strategyId: "ELO_DISTANCE_FILTER"
25470
+ };
25471
+ return {
25472
+ name: u.name,
25473
+ kind: "signal",
25474
+ liveOnly: !0,
25475
+ transform: (t, d) => applyEloDistance(t, d, c, u)
25326
25476
  };
25327
25477
  }
25328
25478
  function aggregateOutcomesForGradient(t, c) {
@@ -25611,10 +25761,60 @@ function createDefaultSrsStrategy(t) {
25611
25761
  serializedData: ""
25612
25762
  };
25613
25763
  }
25764
+ function createDefaultEloDistanceStrategy(t) {
25765
+ return {
25766
+ _id: "NAVIGATION_STRATEGY-eloDistance-default",
25767
+ docType: "NAVIGATION_STRATEGY",
25768
+ name: "ELO Distance (default)",
25769
+ description: "Scales every candidate, new or review, by its distance from the learner's ELO",
25770
+ implementingClass: "eloDistance",
25771
+ course: t,
25772
+ serializedData: JSON.stringify(DEFAULT_ELO_DISTANCE_CONFIG)
25773
+ };
25774
+ }
25614
25775
  function createDefaultPipeline(t, c) {
25615
- let u = c.getCourseID(), d = new ELONavigator(t, c, createDefaultEloStrategy(u)), m = new SRSNavigator(t, c, createDefaultSrsStrategy(u)), g = new CompositeGenerator([d, m]), b = createEloDistanceFilter();
25776
+ let u = c.getCourseID(), d = new ELONavigator(t, c, createDefaultEloStrategy(u)), m = new SRSNavigator(t, c, createDefaultSrsStrategy(u)), g = new CompositeGenerator([d, m]), b = new EloDistanceFilter(t, c, createDefaultEloDistanceStrategy(u));
25616
25777
  return new Pipeline(g, [b], t, c);
25617
25778
  }
25779
+ function planned(t, c, u) {
25780
+ let d = c === "filter" ? getRegisteredFilterKind(t.implementingClass) : void 0;
25781
+ return {
25782
+ role: c,
25783
+ origin: u,
25784
+ name: t.name,
25785
+ implementingClass: t.implementingClass,
25786
+ strategy: t,
25787
+ ...d ? { kind: d } : {}
25788
+ };
25789
+ }
25790
+ function planPipeline(t, c) {
25791
+ if (t.length === 0) return {
25792
+ kind: "default",
25793
+ generators: [planned(createDefaultEloStrategy(c), "generator", "default-pipeline"), planned(createDefaultSrsStrategy(c), "generator", "default-pipeline")],
25794
+ filters: [planned(createDefaultEloDistanceStrategy(c), "filter", "default-pipeline")],
25795
+ skipped: [],
25796
+ warnings: [],
25797
+ notes: [],
25798
+ regulators: DEFAULT_REGULATOR_CONFIG
25799
+ };
25800
+ let u = [], d = [], m = [], g = [];
25801
+ for (let c of t) isGenerator(c.implementingClass) ? u.push(planned(c, "generator", "strategy-doc")) : isFilter(c.implementingClass) ? d.push(planned(c, "filter", "strategy-doc")) : (m.push({
25802
+ strategy: c,
25803
+ reason: "not a registered generator or filter"
25804
+ }), g.push(`Unknown strategy type '${c.implementingClass}', skipping: ${c.name}`));
25805
+ let b = new Set(u.map((t) => t.implementingClass));
25806
+ b.has(createDefaultEloStrategy(c).implementingClass) || u.push(planned(createDefaultEloStrategy(c), "generator", "assembler-default")), b.has(createDefaultSrsStrategy(c).implementingClass) || u.push(planned(createDefaultSrsStrategy(c), "generator", "assembler-default"));
25807
+ let S = createDefaultEloDistanceStrategy(c);
25808
+ return d.some((t) => t.implementingClass === S.implementingClass) || d.push(planned(S, "filter", "assembler-default")), d.sort((t, c) => t.name.localeCompare(c.name)), {
25809
+ kind: "assembled",
25810
+ generators: u,
25811
+ filters: d,
25812
+ skipped: m,
25813
+ warnings: g,
25814
+ notes: [],
25815
+ regulators: DEFAULT_REGULATOR_CONFIG
25816
+ };
25817
+ }
25618
25818
  function registerNavigator(t, c, u) {
25619
25819
  navigatorRegistry.set(t, {
25620
25820
  constructor: c,
@@ -25630,6 +25830,9 @@ function hasRegisteredNavigator(t) {
25630
25830
  function getRegisteredNavigatorRole(t) {
25631
25831
  return navigatorRegistry.get(t)?.role;
25632
25832
  }
25833
+ function getRegisteredFilterKind(t) {
25834
+ return navigatorRegistry.get(t)?.constructor?.kind;
25835
+ }
25633
25836
  function getRegisteredNavigatorNames() {
25634
25837
  return Array.from(navigatorRegistry.keys());
25635
25838
  }
@@ -25637,13 +25840,14 @@ async function initializeNavigatorRegistry() {
25637
25840
  logger.debug("[NavigatorRegistry] Initializing built-in navigators...");
25638
25841
  let [t, c] = await Promise.all([Promise.resolve().then(() => (init_elo(), elo_exports)), Promise.resolve().then(() => (init_srs(), srs_exports))]), u = await Promise.resolve().then(() => (init_prescribed(), prescribed_exports));
25639
25842
  registerNavigator("elo", t.default), registerNavigator("srs", c.default), registerNavigator("prescribed", u.default);
25640
- let [d, m, g, b] = await Promise.all([
25843
+ let [d, m, g, b, S] = await Promise.all([
25641
25844
  Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
25642
25845
  Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
25643
25846
  Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
25644
- Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports))
25847
+ Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports)),
25848
+ Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports))
25645
25849
  ]);
25646
- registerNavigator("hierarchyDefinition", d.default), registerNavigator("interferenceMitigator", m.default), registerNavigator("relativePriority", g.default), registerNavigator("userTagPreference", b.default), logger.debug(`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`);
25850
+ registerNavigator("hierarchyDefinition", d.default), registerNavigator("interferenceMitigator", m.default), registerNavigator("relativePriority", g.default), registerNavigator("userTagPreference", b.default), registerNavigator("eloDistance", S.default), logger.debug(`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`);
25647
25851
  }
25648
25852
  function getCardOrigin(t) {
25649
25853
  if (t.provenance.length === 0) throw Error("Card has no provenance - cannot determine origin");
@@ -26264,8 +26468,8 @@ function hintsHtml(t) {
26264
26468
  }
26265
26469
  function backlogHtml(t) {
26266
26470
  return t.length ? `<div style="margin-bottom:6px"><div style="color:#93c5fd">review backpressure</div>${t.map((t) => {
26267
- let c = t.backlogMultiplier >= 3, u = t.backlogMultiplier <= 1 ? "#86efac" : c ? "#fca5a5" : "#fcd34d", d = t.backlogMultiplier > 1 ? `climbing (\xD7${t.backlogGrowthRate.toFixed(2)} per ${t.healthyBacklog}-review excess, unbounded)` : "healthy — no pressure", m = t.topReviewScore === null ? "—" : t.topReviewScore.toFixed(2), g = t.nextDueIn ? ` <span style="opacity:.6">\xB7 next due ${esc(t.nextDueIn)}</span>` : "";
26268
- return `<div style="margin-left:6px"><span style="opacity:.7">${esc(t.courseId.slice(0, 8))}</span> due ${t.dueNow}/${t.scheduledTotal} <span style="opacity:.6">(healthy ${t.healthyBacklog})</span>${g}<div style="margin-left:6px">pressure <span style="color:${u}">\xD7${t.backlogMultiplier.toFixed(2)}</span> <span style="opacity:.6">${d} \xB7 top review ${m}</span></div></div>`;
26471
+ let c = t.backlogMultiplier >= 3, u = t.backlogMultiplier <= 1 ? "#86efac" : c ? "#fca5a5" : "#fcd34d", d = t.backlogMultiplier > 1 ? `climbing (\xD7${t.backlogGrowthRate.toFixed(2)} per ${t.healthyBacklog} of mass in excess, unbounded)` : "healthy — no pressure", m = t.reviewMass === null ? "" : ` \xB7 mass ${t.reviewMass.toFixed(1)}`, g = t.topReviewScore === null ? "—" : t.topReviewScore.toFixed(2), b = t.nextDueIn ? ` <span style="opacity:.6">\xB7 next due ${esc(t.nextDueIn)}</span>` : "";
26472
+ return `<div style="margin-left:6px"><span style="opacity:.7">${esc(t.courseId.slice(0, 8))}</span> due ${t.dueNow}/${t.scheduledTotal}${m} <span style="opacity:.6">(healthy mass ${t.healthyBacklog})</span>${b}<div style="margin-left:6px">pressure <span style="color:${u}">\xD7${t.backlogMultiplier.toFixed(2)}</span> <span style="opacity:.6">${d} \xB7 top review ${g}</span></div></div>`;
26269
26473
  }).join("")}</div>` : "";
26270
26474
  }
26271
26475
  function pressureColor(t, c) {
@@ -26333,8 +26537,8 @@ function snapshotToText(t) {
26333
26537
  if (u && (u.boostTags && Object.keys(u.boostTags).length && d.push(` boost: ${Object.entries(u.boostTags).map(([t, c]) => `${t}\xD7${c}`).join(", ")}`), u.boostCards && Object.keys(u.boostCards).length && d.push(` boostCards: ${Object.entries(u.boostCards).map(([t, c]) => `${t}\xD7${c}`).join(", ")}`), u.requireCards?.length && d.push(` require: ${u.requireCards.join(", ")}`), u.requireTags?.length && d.push(` requireTags: ${u.requireTags.join(", ")}`), u.excludeTags?.length && d.push(` exclude: ${u.excludeTags.join(", ")}`), u.excludeCards?.length && d.push(` excludeCards: ${u.excludeCards.join(", ")}`)), c.push(d.length ? d.join("\n") : " none"), t.reviewBacklog.length) {
26334
26538
  c.push(""), c.push("review backpressure:");
26335
26539
  for (let u of t.reviewBacklog) {
26336
- let t = u.backlogMultiplier > 1 ? "climbing" : "healthy", d = u.topReviewScore === null ? "—" : u.topReviewScore.toFixed(2), m = u.nextDueIn ? `, next due ${u.nextDueIn}` : "";
26337
- c.push(` ${u.courseId.slice(0, 8)}: due ${u.dueNow}/${u.scheduledTotal} (healthy ${u.healthyBacklog})${m}; pressure \xD7${u.backlogMultiplier.toFixed(2)} ${t}; top review ${d}`);
26540
+ let t = u.backlogMultiplier > 1 ? "climbing" : "healthy", d = u.topReviewScore === null ? "—" : u.topReviewScore.toFixed(2), m = u.nextDueIn ? `, next due ${u.nextDueIn}` : "", g = u.reviewMass === null ? "" : `, mass ${u.reviewMass.toFixed(1)}`;
26541
+ c.push(` ${u.courseId.slice(0, 8)}: due ${u.dueNow}/${u.scheduledTotal}${g} (healthy mass ${u.healthyBacklog})${m}; pressure \xD7${u.backlogMultiplier.toFixed(2)} ${t}; top review ${d}`);
26338
26542
  }
26339
26543
  }
26340
26544
  if (t.strategyPressure.length) {
@@ -26499,6 +26703,14 @@ function toRunCardTrail(t) {
26499
26703
  }))
26500
26704
  };
26501
26705
  }
26706
+ function persistedReading(t) {
26707
+ return {
26708
+ ...t,
26709
+ urgency: sig4(t.urgency),
26710
+ multiplier: sig4(t.multiplier),
26711
+ inputs: Object.fromEntries(Object.entries(t.inputs).map(([t, c]) => [t, sig4(c)]))
26712
+ };
26713
+ }
26502
26714
  function persistedRunCards(t) {
26503
26715
  let c = t.cards.filter((t) => t.selected), u = t.cards.filter((t) => !t.selected).slice(0, PERSISTED_RUNNERS_UP);
26504
26716
  return [...c, ...u].map(toRunCard);
@@ -27010,7 +27222,7 @@ async function registerCustomQuestionTypes(t, c, u, d) {
27010
27222
  };
27011
27223
  }
27012
27224
  }
27013
- var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import___vite_browser_external, import___vite_browser_external$1, import___vite_browser_external$2, __defProp, __getOwnPropNames, __glob, __esm, __export, init_adminDB, init_classroomDB, init_SyncStrategy, isDevelopment, logger, init_logger, GuestUsername, log, DocType, DocTypePrefixes, init_types_legacy, init_util, pouchdb_setup_default, init_pouchdb_setup, Loggable, init_Loggable, UpdateQueue, init_updateQueue, CLIENT_CACHE, init_clientCache, AlreadyTaggedErr, init_courseAPI, courseLookupDBTitle, CourseLookup, init_courseLookupDB, diversityRerank_exports, DIVERSITY_STRENGTH, DIVERSITY_FLOOR, STRATEGY, STRATEGY_ID, STRATEGY_NAME, init_diversityRerank, PipelineDebugger_exports, _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI, init_PipelineDebugger, SrsDebugger_exports, snapshots, init_SrsDebugger, StrategyPressureDebugger_exports, snapshots2, init_StrategyPressureDebugger, CompositeGenerator_exports, AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator, init_CompositeGenerator, elo_exports, ELO_RELEVANCE_SIGMA, ELONavigator, init_elo, generators_exports, init_generators, prescribed_exports, DEFAULT_FRESHNESS_WINDOW, DEFAULT_MAX_DIRECT_PER_RUN, DEFAULT_MAX_SUPPORT_PER_RUN, DEFAULT_HIERARCHY_DEPTH, DEFAULT_MIN_COUNT, DEFAULT_PRACTICE_MIN_COUNT, DEFAULT_MAX_PRACTICE_PER_RUN, BASE_TARGET_SCORE, BASE_SUPPORT_SCORE, DISCOVERED_SUPPORT_SCORE, BASE_PRACTICE_SCORE, PRACTICE_BASE_MULT, MAX_PRACTICE_MULTIPLIER, PRACTICE_STALENESS_BUMP_PER_DAY, MAX_TARGET_MULTIPLIER, MAX_SUPPORT_MULTIPLIER, PRESCRIBED_DEBUG_VERSION, PrescribedCardsGenerator, init_prescribed, srs_exports, DEFAULT_HEALTHY_BACKLOG, BACKLOG_GROWTH_RATE, SRSNavigator, init_srs, types_exports, init_types, globImport_generators, init_, DEFAULT_LEARNABLE_WEIGHT, init_contentNavigationStrategy, WeightedFilter_exports, WeightedFilter, init_WeightedFilter, eloDistance_exports, DEFAULT_HALF_LIFE, DEFAULT_MIN_MULTIPLIER, DEFAULT_MAX_MULTIPLIER, init_eloDistance, hierarchyDefinition_exports, DEFAULT_MIN_COUNT2, HierarchyDefinitionNavigator, init_hierarchyDefinition, userTagPreference_exports, UserTagPreferenceFilter, init_userTagPreference, filters_exports, init_filters, inferredPreferenceStub_exports, INFERRED_PREFERENCE_NAVIGATOR_STUB, init_inferredPreferenceStub, interferenceMitigator_exports, DEFAULT_MIN_COUNT3, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator, init_interferenceMitigator, relativePriority_exports, DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator, init_relativePriority, types_exports2, init_types2, userGoalStub_exports, USER_GOAL_NAVIGATOR_STUB, init_userGoalStub, globImport_filters, init_2, init_gradient, MIN_OBSERVATIONS_FOR_UPDATE, LEARNING_RATE, MAX_WEIGHT_DELTA, MIN_R_SQUARED_FOR_GRADIENT, FLAT_GRADIENT_THRESHOLD, MAX_HISTORY_LENGTH, init_learning, init_signal, init_recording, MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT, init_orchestration, Pipeline_exports, VERBOSE_RESULTS, Pipeline, init_Pipeline, defaults_exports, init_defaults, PipelineAssembler_exports, PipelineAssembler, init_PipelineAssembler, globImport, init_3, navigators_exports, navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator, init_navigators, CoursesDB, CourseDB, init_courseDB, classroomLookupDBTitle, CLASSROOM_CONFIG, ClassroomDBBase, StudentClassroomDB, TeacherClassroomDB, ClassroomLookupDB, init_classroomDB2, AdminDB, init_adminDB2, CourseSyncService_exports, DEFAULT_REPLICATION, CourseSyncService, init_CourseSyncService, init_auth, CouchDBSyncStrategy_exports, log2, CouchDBSyncStrategy, init_CouchDBSyncStrategy, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT, init_couch, duration, init_SpacedRepetition, SrsService, init_SrsService, init_tagRecent, EloService, init_EloService, ResponseProcessor, init_ResponseProcessor, CardHydrationService, init_CardHydrationService, ItemQueue, init_ItemQueue, init_studySession, init_types3, CouchDBToStaticPacker, init_CouchDBToStaticPacker, init_packer, DEFAULT_MIGRATION_OPTIONS, init_types4, FileSystemError, init_FileSystemAdapter, nodeFS, init_validation, nodeFS2, nodePath, StaticToCouchDBMigrator, init_StaticToCouchDBMigrator, init_migrator, init_dataDirectory, init_util2, QuotaRoundRobinMixer, init_SourceMixer, MAX_RUNS2, runHistory2, mixerDebugAPI, init_MixerDebugger, activeController, OVERLAY_ID, POLL_MS, INLINE_THRESHOLD, SPINNER_FRAMES, spinnerFrame, overlayEl, pollHandle, lastSnapshot, copyFlashUntil, minified, expanded, init_SessionOverlay, activeSession, sessionHistory, MAX_HISTORY, sessionDebugAPI, init_SessionDebugger, PERSISTED_RUNNERS_UP, SessionController, init_SessionController, TagFilteredContentSource, init_TagFilteredContentSource, init_study, REVIEW_TIME_FORMAT2, log3, init_userDBHelpers, UsrCrsData, init_user_course_relDB, log4, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc, init_BaseUserDB, init_common, PouchDataLayerProvider_exports, CouchDataLayerProvider, init_PouchDataLayerProvider, pathUtils, nodeFS3, StaticDataUnpacker, init_StaticDataUnpacker, StaticCourseDB, init_courseDB2, StaticCoursesDB, init_coursesDB, NoOpSyncStrategy, init_NoOpSyncStrategy, StaticDataLayerProvider_exports, StaticDataLayerProvider, init_StaticDataLayerProvider, NOT_SET, ENV, dataLayerInstance, init_factory, init_contentSource, init_courseDB3, init_dataLayerProvider, init_userDB, init_interfaces, init_user, init_strategyState, init_userOutcome, HYDRATION_MARKER_ID, init_hydration, init_cardProcessor, init_types5, init_bulkImport, userDBDebugAPI, init_UserDBDebugger, init_core, init_dist = __esmMin((() => {
27225
+ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import___vite_browser_external, import___vite_browser_external$1, import___vite_browser_external$2, __defProp, __getOwnPropNames, __glob, __esm, __export, init_adminDB, init_classroomDB, init_SyncStrategy, isDevelopment, logger, init_logger, GuestUsername, log, DocType, DocTypePrefixes, init_types_legacy, init_util, pouchdb_setup_default, init_pouchdb_setup, Loggable, init_Loggable, UpdateQueue, init_updateQueue, CLIENT_CACHE, init_clientCache, AlreadyTaggedErr, init_courseAPI, courseLookupDBTitle, CourseLookup, init_courseLookupDB, diversityRerank_exports, DIVERSITY_STRENGTH, DIVERSITY_FLOOR, STRATEGY, STRATEGY_ID, STRATEGY_NAME, init_diversityRerank, PipelineDebugger_exports, _activePipeline, MAX_RUNS, runHistory, _currentSessionId, _pendingRuns, DISCARDED_KEEP_TOP, _uiContainer, _selectedRunIndex, _cardSearchQuery, pipelineDebugAPI, init_PipelineDebugger, SrsDebugger_exports, snapshots, init_SrsDebugger, StrategyPressureDebugger_exports, snapshots2, init_StrategyPressureDebugger, CompositeGenerator_exports, AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator, init_CompositeGenerator, elo_exports, ELONavigator, init_elo, generators_exports, init_generators, prescribed_exports, DEFAULT_FRESHNESS_WINDOW, DEFAULT_MAX_DIRECT_PER_RUN, DEFAULT_MAX_SUPPORT_PER_RUN, DEFAULT_HIERARCHY_DEPTH, DEFAULT_MIN_COUNT, DEFAULT_PRACTICE_MIN_COUNT, DEFAULT_MAX_PRACTICE_PER_RUN, BASE_TARGET_SCORE, BASE_SUPPORT_SCORE, DISCOVERED_SUPPORT_SCORE, BASE_PRACTICE_SCORE, PRACTICE_BASE_MULT, MAX_PRACTICE_MULTIPLIER, PRACTICE_STALENESS_BUMP_PER_DAY, MAX_TARGET_MULTIPLIER, MAX_SUPPORT_MULTIPLIER, PRESCRIBED_DEBUG_VERSION, PrescribedCardsGenerator, init_prescribed, regulators_exports, DEFAULT_REGULATOR_CONFIG, INTAKE_CLOCK_KEY, REGULATOR_LABEL, init_regulators, srs_exports, SRSNavigator, init_srs, types_exports, init_types, globImport_generators, init_, DEFAULT_LEARNABLE_WEIGHT, init_contentNavigationStrategy, WeightedFilter_exports, WeightedFilter, init_WeightedFilter, eloDistance_exports, DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter, init_eloDistance, hierarchyDefinition_exports, DEFAULT_MIN_COUNT2, HierarchyDefinitionNavigator, init_hierarchyDefinition, userTagPreference_exports, UserTagPreferenceFilter, init_userTagPreference, filters_exports, init_filters, inferredPreferenceStub_exports, INFERRED_PREFERENCE_NAVIGATOR_STUB, init_inferredPreferenceStub, interferenceMitigator_exports, DEFAULT_MIN_COUNT3, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator, init_interferenceMitigator, relativePriority_exports, DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator, init_relativePriority, types_exports2, init_types2, userGoalStub_exports, USER_GOAL_NAVIGATOR_STUB, init_userGoalStub, globImport_filters, init_2, init_gradient, MIN_OBSERVATIONS_FOR_UPDATE, LEARNING_RATE, MAX_WEIGHT_DELTA, MIN_R_SQUARED_FOR_GRADIENT, FLAT_GRADIENT_THRESHOLD, MAX_HISTORY_LENGTH, init_learning, init_signal, init_recording, MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT, init_orchestration, Pipeline_exports, VERBOSE_RESULTS, Pipeline, init_Pipeline, defaults_exports, init_defaults, pipelinePlan_exports, PIPELINE_STAGES, init_pipelinePlan, PipelineAssembler_exports, PipelineAssembler, init_PipelineAssembler, globImport, init_3, navigators_exports, navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator, init_navigators, CoursesDB, CourseDB, init_courseDB, classroomLookupDBTitle, CLASSROOM_CONFIG, ClassroomDBBase, StudentClassroomDB, TeacherClassroomDB, ClassroomLookupDB, init_classroomDB2, AdminDB, init_adminDB2, CourseSyncService_exports, DEFAULT_REPLICATION, CourseSyncService, init_CourseSyncService, init_auth, CouchDBSyncStrategy_exports, log2, CouchDBSyncStrategy, init_CouchDBSyncStrategy, isBrowser, GUEST_LOCAL_DB, localUserDB, pouchDBincludeCredentialsConfig, REVIEW_TIME_FORMAT, init_couch, duration, init_SpacedRepetition, SrsService, init_SrsService, init_tagRecent, EloService, init_EloService, ResponseProcessor, init_ResponseProcessor, CardHydrationService, init_CardHydrationService, ItemQueue, init_ItemQueue, init_studySession, init_types3, CouchDBToStaticPacker, init_CouchDBToStaticPacker, init_packer, DEFAULT_MIGRATION_OPTIONS, init_types4, FileSystemError, init_FileSystemAdapter, nodeFS, init_validation, nodeFS2, nodePath, StaticToCouchDBMigrator, init_StaticToCouchDBMigrator, init_migrator, init_dataDirectory, init_util2, QuotaRoundRobinMixer, init_SourceMixer, MAX_RUNS2, runHistory2, mixerDebugAPI, init_MixerDebugger, activeController, OVERLAY_ID, POLL_MS, INLINE_THRESHOLD, SPINNER_FRAMES, spinnerFrame, overlayEl, pollHandle, lastSnapshot, copyFlashUntil, minified, expanded, init_SessionOverlay, activeSession, sessionHistory, MAX_HISTORY, sessionDebugAPI, init_SessionDebugger, PERSISTED_RUNNERS_UP, SessionController, init_SessionController, TagFilteredContentSource, init_TagFilteredContentSource, init_study, REVIEW_TIME_FORMAT2, log3, init_userDBHelpers, UsrCrsData, init_user_course_relDB, log4, HYDRATION_TIMEOUT_MS, BaseUser, userCoursesDoc, userClassroomsDoc, init_BaseUserDB, init_common, PouchDataLayerProvider_exports, CouchDataLayerProvider, init_PouchDataLayerProvider, pathUtils, nodeFS3, StaticDataUnpacker, init_StaticDataUnpacker, StaticCourseDB, init_courseDB2, StaticCoursesDB, init_coursesDB, NoOpSyncStrategy, init_NoOpSyncStrategy, StaticDataLayerProvider_exports, StaticDataLayerProvider, init_StaticDataLayerProvider, NOT_SET, ENV, dataLayerInstance, init_factory, init_contentSource, init_courseDB3, init_dataLayerProvider, init_userDB, init_interfaces, init_user, init_strategyState, init_userOutcome, HYDRATION_MARKER_ID, init_hydration, init_cardProcessor, init_types5, init_bulkImport, userDBDebugAPI, init_UserDBDebugger, init_core, init_dist = __esmMin((() => {
27014
27226
  init_defineProperty(), init_index_browser_es$5(), init_index_browser_es(), init_index_es(), init_dist$1(), init_esm_browser(), init_moment(), import_browser_ponyfill = /* @__PURE__ */ __toESM$2(require_browser_ponyfill(), 1), import_browser_ponyfill$1 = /* @__PURE__ */ __toESM$2(require_browser_ponyfill(), 1), import_browser = /* @__PURE__ */ __toESM$2(require_browser(), 1), import___vite_browser_external = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), import___vite_browser_external$1 = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), import___vite_browser_external$2 = /* @__PURE__ */ __toESM$2(require___vite_browser_external(), 1), __defProp = Object.defineProperty, __getOwnPropNames = Object.getOwnPropertyNames, __glob = (t) => (c) => {
27015
27227
  var u = t[c];
27016
27228
  if (u) return u();
@@ -27399,7 +27611,8 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27399
27611
  } }), SrsDebugger_exports = {}, __export(SrsDebugger_exports, {
27400
27612
  captureSrsBacklog: () => captureSrsBacklog,
27401
27613
  clearSrsBacklogDebug: () => clearSrsBacklogDebug,
27402
- getSrsBacklogDebug: () => getSrsBacklogDebug
27614
+ getSrsBacklogDebug: () => getSrsBacklogDebug,
27615
+ noteReviewPressure: () => noteReviewPressure
27403
27616
  }), init_SrsDebugger = __esm({ "src/core/navigators/SrsDebugger.ts"() {
27404
27617
  snapshots = /* @__PURE__ */ new Map();
27405
27618
  } }), StrategyPressureDebugger_exports = {}, __export(StrategyPressureDebugger_exports, {
@@ -27503,7 +27716,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27503
27716
  }
27504
27717
  };
27505
27718
  } }), elo_exports = {}, __export(elo_exports, { default: () => ELONavigator }), init_elo = __esm({ "src/core/navigators/generators/elo.ts"() {
27506
- init_navigators(), init_logger(), ELO_RELEVANCE_SIGMA = 300, ELONavigator = class extends ContentNavigator {
27719
+ init_navigators(), init_logger(), ELONavigator = class extends ContentNavigator {
27507
27720
  constructor(t, c, u) {
27508
27721
  super(t, c, u), _defineProperty$2(this, "name", void 0), this.name = u?.name || "ELO";
27509
27722
  }
@@ -27517,18 +27730,19 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27517
27730
  ...t,
27518
27731
  status: "new"
27519
27732
  })).map((t) => {
27520
- let c = t.elo ?? 1e3, d = Math.abs(c - u), m = Math.exp(-((d / ELO_RELEVANCE_SIGMA) ** 2)), g = m * (.5 + .5 * Math.random());
27733
+ let c = t.elo ?? 1e3, d = Math.abs(c - u), m = .5 + .5 * Math.random();
27521
27734
  return {
27522
27735
  cardId: t.cardID,
27523
27736
  courseId: t.courseID,
27524
- score: g,
27737
+ score: m,
27738
+ cardElo: c,
27525
27739
  provenance: [{
27526
27740
  strategy: "elo",
27527
27741
  strategyName: this.strategyName || this.name,
27528
27742
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
27529
27743
  action: "generated",
27530
- score: g,
27531
- reason: `ELO distance ${Math.round(d)} (card: ${Math.round(c)}, user: ${Math.round(u)}), relevance ${m.toFixed(3)}, key ${g.toFixed(3)}`
27744
+ score: m,
27745
+ reason: `new card near learner ELO: distance ${Math.round(d)} (card: ${Math.round(c)}, user: ${Math.round(u)}), jitter ${m.toFixed(3)}`
27532
27746
  }]
27533
27747
  };
27534
27748
  });
@@ -27966,18 +28180,36 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27966
28180
  return c.count < d ? !1 : t.masteryThreshold?.minElo === void 0 ? t.masteryThreshold?.minCount === void 0 ? c.score >= u : !0 : c.score >= t.masteryThreshold.minElo;
27967
28181
  }
27968
28182
  };
28183
+ } }), regulators_exports = {}, __export(regulators_exports, {
28184
+ DEFAULT_REGULATOR_CONFIG: () => DEFAULT_REGULATOR_CONFIG,
28185
+ INTAKE_CLOCK_KEY: () => INTAKE_CLOCK_KEY,
28186
+ applyReading: () => applyReading,
28187
+ frozenMsAt: () => frozenMsAt,
28188
+ intakeHours: () => intakeHours,
28189
+ intakeReading: () => intakeReading,
28190
+ resetIntakeClock: () => resetIntakeClock,
28191
+ reviewMassReading: () => reviewMassReading,
28192
+ reviewWeight: () => reviewWeight,
28193
+ stepIntakeClock: () => stepIntakeClock
28194
+ }), init_regulators = __esm({ "src/core/navigators/regulators.ts"() {
28195
+ DEFAULT_REGULATOR_CONFIG = {
28196
+ reviewMass: {
28197
+ referenceScore: .95,
28198
+ healthyMass: 20,
28199
+ rate: 2
28200
+ },
28201
+ intake: {
28202
+ rate: 2,
28203
+ scaleHours: 24
28204
+ }
28205
+ }, INTAKE_CLOCK_KEY = "IntakeClock", REGULATOR_LABEL = {
28206
+ "review-mass": "Review mass",
28207
+ intake: "Intake"
28208
+ };
27969
28209
  } }), srs_exports = {}, __export(srs_exports, { default: () => SRSNavigator }), init_srs = __esm({ "src/core/navigators/generators/srs.ts"() {
27970
- init_navigators(), init_SrsDebugger(), init_logger(), DEFAULT_HEALTHY_BACKLOG = 20, BACKLOG_GROWTH_RATE = 2, SRSNavigator = class extends ContentNavigator {
28210
+ init_navigators(), init_SrsDebugger(), init_regulators(), init_logger(), SRSNavigator = class extends ContentNavigator {
27971
28211
  constructor(t, c, u) {
27972
- super(t, c, u), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "healthyBacklog", void 0), this.name = u?.name || "SRS", this.healthyBacklog = this.parseConfig(u?.serializedData).healthyBacklog ?? DEFAULT_HEALTHY_BACKLOG;
27973
- }
27974
- parseConfig(t) {
27975
- if (!t) return {};
27976
- try {
27977
- return JSON.parse(t);
27978
- } catch {
27979
- return logger.warn("[SRS] Failed to parse strategy config, using defaults"), {};
27980
- }
28212
+ super(t, c, u), _defineProperty$2(this, "name", void 0), this.name = u?.name || "SRS";
27981
28213
  }
27982
28214
  async getWeightedCards(t, c) {
27983
28215
  if (!this.user || !this.course) throw Error("SRSNavigator requires user and course to be set");
@@ -27989,24 +28221,23 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27989
28221
  for (let t of u) this.user.removeScheduledCardReview(t);
27990
28222
  }
27991
28223
  }
27992
- let b = this.computeBacklogMultiplier(g.length), S = d.filter((t) => !m.isAfter(hooks.utc(t.reviewTime))), C = null;
27993
- if (S.length > 0) {
27994
- let t = S.reduce((t, c) => hooks.utc(t.reviewTime).isBefore(hooks.utc(c.reviewTime)) ? t : c), c = hooks.duration(hooks.utc(t.reviewTime).diff(m));
27995
- C = c.asHours() < 1 ? `${Math.round(c.asMinutes())}m` : c.asHours() < 24 ? `${Math.round(c.asHours())}h` : `${Math.round(c.asDays())}d`;
28224
+ let b = d.filter((t) => !m.isAfter(hooks.utc(t.reviewTime))), S = null;
28225
+ if (b.length > 0) {
28226
+ let t = b.reduce((t, c) => hooks.utc(t.reviewTime).isBefore(hooks.utc(c.reviewTime)) ? t : c), c = hooks.duration(hooks.utc(t.reviewTime).diff(m));
28227
+ S = c.asHours() < 1 ? `${Math.round(c.asMinutes())}m` : c.asHours() < 24 ? `${Math.round(c.asHours())}h` : `${Math.round(c.asDays())}d`;
27996
28228
  }
27997
- if (g.length > 0) {
27998
- let t = b > 1 ? ` [backlog pressure: \xD7${b.toFixed(2)}]` : " [healthy backlog]";
27999
- logger.info(`[SRS] Course ${u}: ${g.length} reviews due now (of ${d.length} scheduled)${t}`);
28000
- } else if (d.length > 0) {
28229
+ if (g.length > 0) logger.info(`[SRS] Course ${u}: ${g.length} reviews due now (of ${d.length} scheduled)`);
28230
+ else if (d.length > 0) {
28001
28231
  let t = [...d].sort((t, c) => hooks.utc(t.reviewTime).diff(hooks.utc(c.reviewTime)))[0], c = hooks.utc(t.reviewTime), g = hooks.duration(c.diff(m)), b = g.asHours() < 1 ? `${Math.round(g.asMinutes())}m` : g.asHours() < 24 ? `${Math.round(g.asHours())}h` : `${Math.round(g.asDays())}d`;
28002
28232
  logger.info(`[SRS] Course ${u}: 0 reviews due now (${d.length} scheduled, next in ${b})`);
28003
28233
  } else logger.info(`[SRS] Course ${u}: No reviews scheduled`);
28004
- let w = g.map((t) => {
28005
- let { score: c, reason: u } = this.computeUrgencyScore(t, m, b);
28234
+ let C = g.map((t) => {
28235
+ let { score: c, urgency: u, reason: d } = this.computeUrgencyScore(t, m);
28006
28236
  return {
28007
28237
  cardId: t.cardId,
28008
28238
  courseId: t.courseId,
28009
28239
  score: c,
28240
+ reviewUrgency: u,
28010
28241
  reviewID: t._id,
28011
28242
  provenance: [{
28012
28243
  strategy: "srs",
@@ -28014,7 +28245,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28014
28245
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-SRS-default",
28015
28246
  action: "generated",
28016
28247
  score: c,
28017
- reason: u
28248
+ reason: d
28018
28249
  }]
28019
28250
  };
28020
28251
  }).sort((t, c) => c.score - t.score);
@@ -28022,28 +28253,25 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28022
28253
  courseId: u,
28023
28254
  scheduledTotal: d.length,
28024
28255
  dueNow: g.length,
28025
- healthyBacklog: this.healthyBacklog,
28026
- backlogMultiplier: b,
28027
- backlogGrowthRate: BACKLOG_GROWTH_RATE,
28028
- topReviewScore: w.length > 0 ? w[0].score : null,
28029
- nextDueIn: C,
28256
+ healthyBacklog: DEFAULT_REGULATOR_CONFIG.reviewMass.healthyMass,
28257
+ reviewMass: null,
28258
+ backlogMultiplier: 1,
28259
+ backlogGrowthRate: DEFAULT_REGULATOR_CONFIG.reviewMass.rate,
28260
+ topReviewScore: C.length > 0 ? C[0].score : null,
28261
+ nextDueIn: S,
28030
28262
  timestamp: Date.now()
28031
- }), { cards: w.slice(0, t) };
28032
- }
28033
- computeBacklogMultiplier(t) {
28034
- if (t <= this.healthyBacklog) return 1;
28035
- let c = (t - this.healthyBacklog) / this.healthyBacklog;
28036
- return BACKLOG_GROWTH_RATE ** +c;
28037
- }
28038
- computeUrgencyScore(t, c, u) {
28039
- let d = hooks.utc(t.scheduledAt), m = hooks.utc(t.reviewTime), g = Math.max(1, m.diff(d, "hours")), b = c.diff(m, "hours"), S = b / g, C = .3 + .7 * Math.exp(-g / 720), w = (.5 + (Math.min(1, Math.max(0, S)) * .5 + C * .5) * .45) * u, T = [
28040
- `${Math.round(b)}h overdue`,
28041
- `interval: ${Math.round(g)}h`,
28042
- `relative: ${S.toFixed(2)}`,
28043
- `recency: ${C.toFixed(2)}`
28263
+ }), { cards: C.slice(0, t) };
28264
+ }
28265
+ computeUrgencyScore(t, c) {
28266
+ let u = hooks.utc(t.scheduledAt), d = hooks.utc(t.reviewTime), m = Math.max(1, d.diff(u, "hours")), g = c.diff(d, "hours"), b = g / m, S = .3 + .7 * Math.exp(-m / 720), C = Math.min(1, Math.max(0, b)) * .5 + S * .5, w = .5 + C * .45, T = [
28267
+ `${Math.round(g)}h overdue`,
28268
+ `interval: ${Math.round(m)}h`,
28269
+ `relative: ${b.toFixed(2)}`,
28270
+ `recency: ${S.toFixed(2)}`
28044
28271
  ];
28045
- return u > 1 && T.push(`backlog: \xD7${u.toFixed(2)}`), T.push("review"), {
28272
+ return T.push("review"), {
28046
28273
  score: w,
28274
+ urgency: C,
28047
28275
  reason: T.join(", ")
28048
28276
  };
28049
28277
  }
@@ -28066,7 +28294,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28066
28294
  } }), WeightedFilter_exports = {}, __export(WeightedFilter_exports, { WeightedFilter: () => WeightedFilter }), init_WeightedFilter = __esm({ "src/core/navigators/filters/WeightedFilter.ts"() {
28067
28295
  init_contentNavigationStrategy(), WeightedFilter = class {
28068
28296
  constructor(t, c = DEFAULT_LEARNABLE_WEIGHT, u = !1, d) {
28069
- _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "inner", void 0), _defineProperty$2(this, "learnable", void 0), _defineProperty$2(this, "staticWeight", void 0), _defineProperty$2(this, "strategyId", void 0), this.inner = t, this.name = t.name, this.learnable = c, this.staticWeight = u, this.strategyId = d;
28297
+ _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", void 0), _defineProperty$2(this, "liveOnly", void 0), _defineProperty$2(this, "inner", void 0), _defineProperty$2(this, "learnable", void 0), _defineProperty$2(this, "staticWeight", void 0), _defineProperty$2(this, "strategyId", void 0), this.inner = t, this.name = t.name, this.kind = t.kind, this.liveOnly = t.liveOnly, this.learnable = c, this.staticWeight = u, this.strategyId = d;
28070
28298
  }
28071
28299
  async transform(t, c) {
28072
28300
  let u = this.learnable.weight, d;
@@ -28104,16 +28332,44 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28104
28332
  }
28105
28333
  };
28106
28334
  } }), eloDistance_exports = {}, __export(eloDistance_exports, {
28107
- DEFAULT_HALF_LIFE: () => DEFAULT_HALF_LIFE,
28108
- DEFAULT_MAX_MULTIPLIER: () => DEFAULT_MAX_MULTIPLIER,
28109
- DEFAULT_MIN_MULTIPLIER: () => DEFAULT_MIN_MULTIPLIER,
28110
- createEloDistanceFilter: () => createEloDistanceFilter
28335
+ DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
28336
+ createEloDistanceFilter: () => createEloDistanceFilter,
28337
+ default: () => EloDistanceFilter,
28338
+ tagAwareGap: () => tagAwareGap
28111
28339
  }), init_eloDistance = __esm({ "src/core/navigators/filters/eloDistance.ts"() {
28112
- DEFAULT_HALF_LIFE = 200, DEFAULT_MIN_MULTIPLIER = .3, DEFAULT_MAX_MULTIPLIER = 1;
28340
+ var t;
28341
+ init_navigators(), DEFAULT_ELO_DISTANCE_CONFIG = {
28342
+ halfLife: 300,
28343
+ minMultiplier: .05,
28344
+ maxMultiplier: 1,
28345
+ tagAware: !0,
28346
+ minTagCount: 3
28347
+ }, TAG_CONFIDENCE_HALF = 10, COUNT_ONLY_SENTINEL = -1, DEFAULT_CARD_ELO = 1e3, EloDistanceFilter = (t = class _EloDistanceFilter extends ContentNavigator {
28348
+ constructor(t, c, u) {
28349
+ super(t, c, u), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _EloDistanceFilter.kind), _defineProperty$2(this, "liveOnly", !0), _defineProperty$2(this, "config", void 0), this.name = u.name || "ELO Distance";
28350
+ let d;
28351
+ try {
28352
+ d = u.serializedData ? JSON.parse(u.serializedData) : void 0;
28353
+ } catch {
28354
+ d = void 0;
28355
+ }
28356
+ this.config = resolveConfig(d);
28357
+ }
28358
+ transform(t, c) {
28359
+ return applyEloDistance(t, c, this.config, {
28360
+ name: this.name,
28361
+ strategyId: this.strategyId || "NAVIGATION_STRATEGY-eloDistance-default"
28362
+ });
28363
+ }
28364
+ async getWeightedCards(t) {
28365
+ throw Error("EloDistanceFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28366
+ }
28367
+ }, _defineProperty$2(t, "kind", "signal"), t);
28113
28368
  } }), hierarchyDefinition_exports = {}, __export(hierarchyDefinition_exports, { default: () => HierarchyDefinitionNavigator }), init_hierarchyDefinition = __esm({ "src/core/navigators/filters/hierarchyDefinition.ts"() {
28114
- init_navigators(), init_logger(), DEFAULT_MIN_COUNT2 = 3, HierarchyDefinitionNavigator = class extends ContentNavigator {
28369
+ var t;
28370
+ init_navigators(), init_logger(), DEFAULT_MIN_COUNT2 = 3, HierarchyDefinitionNavigator = (t = class _HierarchyDefinitionNavigator extends ContentNavigator {
28115
28371
  constructor(t, c, u) {
28116
- super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Hierarchy Definition";
28372
+ super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _HierarchyDefinitionNavigator.kind), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Hierarchy Definition";
28117
28373
  }
28118
28374
  parseConfig(t) {
28119
28375
  try {
@@ -28226,11 +28482,12 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28226
28482
  async getWeightedCards(t) {
28227
28483
  throw Error("HierarchyDefinitionNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28228
28484
  }
28229
- };
28485
+ }, _defineProperty$2(t, "kind", "gate"), t);
28230
28486
  } }), userTagPreference_exports = {}, __export(userTagPreference_exports, { default: () => UserTagPreferenceFilter }), init_userTagPreference = __esm({ "src/core/navigators/filters/userTagPreference.ts"() {
28231
- init_navigators(), UserTagPreferenceFilter = class extends ContentNavigator {
28487
+ var t;
28488
+ init_navigators(), UserTagPreferenceFilter = (t = class _UserTagPreferenceFilter extends ContentNavigator {
28232
28489
  constructor(t, c, u) {
28233
- super(t, c, u), _defineProperty$2(this, "_strategyData", void 0), _defineProperty$2(this, "name", void 0), this._strategyData = u, this.name = u.name || "User Tag Preferences";
28490
+ super(t, c, u), _defineProperty$2(this, "_strategyData", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _UserTagPreferenceFilter.kind), this._strategyData = u, this.name = u.name || "User Tag Preferences";
28234
28491
  }
28235
28492
  computeMultiplier(t, c) {
28236
28493
  let u = t.map((t) => c[t]).filter((t) => t !== void 0);
@@ -28271,8 +28528,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28271
28528
  async getWeightedCards(t) {
28272
28529
  throw Error("UserTagPreferenceFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28273
28530
  }
28274
- };
28531
+ }, _defineProperty$2(t, "kind", "signal"), t);
28275
28532
  } }), filters_exports = {}, __export(filters_exports, {
28533
+ EloDistanceFilter: () => EloDistanceFilter,
28276
28534
  UserTagPreferenceFilter: () => UserTagPreferenceFilter,
28277
28535
  createEloDistanceFilter: () => createEloDistanceFilter
28278
28536
  }), init_filters = __esm({ "src/core/navigators/filters/index.ts"() {
@@ -28280,9 +28538,10 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28280
28538
  } }), inferredPreferenceStub_exports = {}, __export(inferredPreferenceStub_exports, { INFERRED_PREFERENCE_NAVIGATOR_STUB: () => INFERRED_PREFERENCE_NAVIGATOR_STUB }), init_inferredPreferenceStub = __esm({ "src/core/navigators/filters/inferredPreferenceStub.ts"() {
28281
28539
  INFERRED_PREFERENCE_NAVIGATOR_STUB = !0;
28282
28540
  } }), interferenceMitigator_exports = {}, __export(interferenceMitigator_exports, { default: () => InterferenceMitigatorNavigator }), init_interferenceMitigator = __esm({ "src/core/navigators/filters/interferenceMitigator.ts"() {
28283
- init_navigators(), DEFAULT_MIN_COUNT3 = 10, DEFAULT_MIN_ELAPSED_DAYS = 3, DEFAULT_INTERFERENCE_DECAY = .8, InterferenceMitigatorNavigator = class extends ContentNavigator {
28541
+ var t;
28542
+ init_navigators(), DEFAULT_MIN_COUNT3 = 10, DEFAULT_MIN_ELAPSED_DAYS = 3, DEFAULT_INTERFERENCE_DECAY = .8, InterferenceMitigatorNavigator = (t = class _InterferenceMitigatorNavigator extends ContentNavigator {
28284
28543
  constructor(t, c, u) {
28285
- super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "interferenceMap", void 0), this.config = this.parseConfig(u.serializedData), this.interferenceMap = this.buildInterferenceMap(), this.name = u.name || "Interference Mitigator";
28544
+ super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _InterferenceMitigatorNavigator.kind), _defineProperty$2(this, "interferenceMap", void 0), this.config = this.parseConfig(u.serializedData), this.interferenceMap = this.buildInterferenceMap(), this.name = u.name || "Interference Mitigator";
28286
28545
  }
28287
28546
  parseConfig(t) {
28288
28547
  try {
@@ -28397,11 +28656,12 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28397
28656
  async getWeightedCards(t) {
28398
28657
  throw Error("InterferenceMitigatorNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28399
28658
  }
28400
- };
28659
+ }, _defineProperty$2(t, "kind", "signal"), t);
28401
28660
  } }), relativePriority_exports = {}, __export(relativePriority_exports, { default: () => RelativePriorityNavigator }), init_relativePriority = __esm({ "src/core/navigators/filters/relativePriority.ts"() {
28402
- init_navigators(), DEFAULT_PRIORITY = .5, DEFAULT_PRIORITY_INFLUENCE = .5, DEFAULT_COMBINE_MODE = "max", RelativePriorityNavigator = class extends ContentNavigator {
28661
+ var t;
28662
+ init_navigators(), DEFAULT_PRIORITY = .5, DEFAULT_PRIORITY_INFLUENCE = .5, DEFAULT_COMBINE_MODE = "max", RelativePriorityNavigator = (t = class _RelativePriorityNavigator extends ContentNavigator {
28403
28663
  constructor(t, c, u) {
28404
- super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Relative Priority";
28664
+ super(t, c, u), _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "kind", _RelativePriorityNavigator.kind), this.config = this.parseConfig(u.serializedData), this.name = u.name || "Relative Priority";
28405
28665
  }
28406
28666
  parseConfig(t) {
28407
28667
  try {
@@ -28463,7 +28723,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28463
28723
  async getWeightedCards(t) {
28464
28724
  throw Error("RelativePriorityNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform().");
28465
28725
  }
28466
- };
28726
+ }, _defineProperty$2(t, "kind", "signal"), t);
28467
28727
  } }), types_exports2 = {}, init_types2 = __esm({ "src/core/navigators/filters/types.ts"() {} }), userGoalStub_exports = {}, __export(userGoalStub_exports, { USER_GOAL_NAVIGATOR_STUB: () => USER_GOAL_NAVIGATOR_STUB }), init_userGoalStub = __esm({ "src/core/navigators/filters/userGoalStub.ts"() {
28468
28728
  USER_GOAL_NAVIGATOR_STUB = !0;
28469
28729
  } }), init_2 = __esm({ "import(\"./filters/**/*\") in src/core/navigators/index.ts"() {
@@ -28491,9 +28751,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28491
28751
  Pipeline: () => Pipeline,
28492
28752
  mergeHints: () => mergeHints2
28493
28753
  }), init_Pipeline = __esm({ "src/core/navigators/Pipeline.ts"() {
28494
- init_navigators(), init_logger(), init_orchestration(), init_PipelineDebugger(), init_diversityRerank(), VERBOSE_RESULTS = !0, Pipeline = class extends ContentNavigator {
28754
+ init_navigators(), init_logger(), init_orchestration(), init_PipelineDebugger(), init_diversityRerank(), init_regulators(), init_SrsDebugger(), VERBOSE_RESULTS = !0, Pipeline = class extends ContentNavigator {
28495
28755
  constructor(t, c, u, d) {
28496
- super(), _defineProperty$2(this, "generator", void 0), _defineProperty$2(this, "filters", void 0), _defineProperty$2(this, "_cachedOrchestration", null), _defineProperty$2(this, "_tagCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_ephemeralHints", null), this.generator = t, this.filters = c, this.user = u, this.course = d, d.getCourseConfig().then((t) => {
28756
+ super(), _defineProperty$2(this, "generator", void 0), _defineProperty$2(this, "filters", void 0), _defineProperty$2(this, "_cachedOrchestration", null), _defineProperty$2(this, "_tagCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_ephemeralHints", null), _defineProperty$2(this, "_intakeClock", null), _defineProperty$2(this, "_intakeClockWrite", Promise.resolve()), this.generator = t, this.filters = c, this.user = u, this.course = d, d.getCourseConfig().then((t) => {
28497
28757
  logger.debug(`[pipeline] Crated pipeline for ${t.name}`);
28498
28758
  }).catch((t) => {
28499
28759
  logger.error(`[pipeline] Failed to lookup courseCfg: ${t}`);
@@ -28518,12 +28778,12 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28518
28778
  }
28519
28779
  }
28520
28780
  w = Array.from(t.entries()).map(([t, c]) => {
28521
- let u = c.cards.filter((t) => t.provenance[0]?.reason?.includes("new card")), d = c.cards.filter((t) => t.provenance[0]?.reason?.includes("review"));
28781
+ let u = c.cards.filter((t) => t.reviewID).length;
28522
28782
  return {
28523
28783
  name: t,
28524
28784
  cardCount: c.cards.length,
28525
- newCount: u.length,
28526
- reviewCount: d.length,
28785
+ newCount: c.cards.length - u,
28786
+ reviewCount: u,
28527
28787
  topScore: Math.max(...c.cards.map((t) => t.score), 0)
28528
28788
  };
28529
28789
  });
@@ -28544,17 +28804,18 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28544
28804
  logger.info(`[Pipeline] Pre-fetched ${c.length} required card(s) into pool: ${c.join(", ")}`);
28545
28805
  }
28546
28806
  }
28547
- let O = new Set(b.filter((t) => t.provenance.some((t) => t.strategy === "prescribed")).map((t) => t.cardId)), xr = [];
28807
+ let O = new Set(b.filter((t) => t.provenance.some((t) => t.strategy === "prescribed")).map((t) => t.cardId)), xr = [], Sr = new Map(b.map((t) => [t.cardId, t.score])), Cr = /* @__PURE__ */ new Set();
28548
28808
  for (let t of this.filters) {
28549
28809
  let c = b.length, d = new Map(b.map((t) => [t.cardId, t.score]));
28550
28810
  b = await t.transform(b, u);
28551
- let m = 0, g = 0, S = 0, C = c - b.length;
28811
+ let m = 0, g = 0, S = 0, C = c - b.length, w = t.kind ?? "gate";
28552
28812
  for (let t of b) {
28553
28813
  let c = d.get(t.cardId) ?? 0;
28554
- t.score > c ? m++ : t.score < c ? g++ : S++;
28814
+ t.score > c ? m++ : t.score < c ? (g++, w === "gate" && Cr.add(t.cardId)) : S++;
28555
28815
  }
28556
28816
  if (xr.push({
28557
28817
  name: t.name,
28818
+ kind: w,
28558
28819
  boosted: m,
28559
28820
  penalized: g,
28560
28821
  passed: S,
@@ -28565,21 +28826,21 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28565
28826
  }
28566
28827
  logger.debug(`[Pipeline] Filter '${t.name}': ${d.size} \u2192 ${b.length} cards (\u2191${m} \u2193${g} =${S})`);
28567
28828
  }
28568
- let Sr = b;
28829
+ let wr = b;
28569
28830
  b = b.filter((t) => t.score > 0);
28570
- let Cr = this._ephemeralHints;
28571
- Cr && (this._ephemeralHints = null, b = this.applyHints(b, Cr, E)), b = diversityRerank(b), b.sort((t, c) => c.score - t.score);
28572
- let wr = performance.now(), Tr = b.slice(0, t);
28573
- logger.info(`[Pipeline:timing] total=${(wr - c).toFixed(0)}ms (context=${(d - c).toFixed(0)} generate=${(S - d).toFixed(0)} hydrate=${(T - S).toFixed(0)} filter=${(wr - T).toFixed(0)})`);
28574
- let Er = Tr.slice(0, 3).map((t) => t.score);
28575
- logExecutionSummary(this.generator.name, C, this.filters.length, Tr.length, Er, xr), logResultCards(Tr), logCardProvenance(Tr, 3);
28831
+ let Tr = await this.regulate(b, Sr, Cr), Er = this._ephemeralHints;
28832
+ Er && (this._ephemeralHints = null, b = this.applyHints(b, Er, E)), b = diversityRerank(b), b.sort((t, c) => c.score - t.score);
28833
+ let Dr = performance.now(), Or = b.slice(0, t);
28834
+ logger.info(`[Pipeline:timing] total=${(Dr - c).toFixed(0)}ms (context=${(d - c).toFixed(0)} generate=${(S - d).toFixed(0)} hydrate=${(T - S).toFixed(0)} filter=${(Dr - T).toFixed(0)})`);
28835
+ let kr = Or.slice(0, 3).map((t) => t.score);
28836
+ logExecutionSummary(this.generator.name, C, this.filters.length, Or.length, kr, xr), logResultCards(Or), logCardProvenance(Or, 3);
28576
28837
  try {
28577
28838
  let t = await this.course?.getCourseConfig().then((t) => t.name).catch(() => void 0);
28578
- captureRun(buildRunReport(this.course?.getCourseID() || "unknown", t, this.generator.name, w, C, xr, b, Tr, u.userElo, Cr ?? void 0, Sr));
28839
+ captureRun(buildRunReport(this.course?.getCourseID() || "unknown", t, this.generator.name, w, C, xr, b, Or, u.userElo, Er ?? void 0, wr, Tr));
28579
28840
  } catch (t) {
28580
28841
  logger.debug(`[Pipeline] Failed to capture debug run: ${t}`);
28581
28842
  }
28582
- return { cards: Tr };
28843
+ return { cards: Or };
28583
28844
  }
28584
28845
  async hydrateTags(t) {
28585
28846
  if (t.length === 0) return t;
@@ -28649,20 +28910,55 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28649
28910
  }
28650
28911
  return logger.info(`[Pipeline] Hints applied: ${d} \u2192 ${t.length} cards`), t;
28651
28912
  }
28913
+ async regulate(t, c, u) {
28914
+ let d = DEFAULT_REGULATOR_CONFIG, m = t.filter((t) => t.reviewID), g = t.filter((t) => !t.reviewID), b = g.filter((t) => !u.has(t.cardId)), S = reviewMassReading(m, c, d.reviewMass);
28915
+ applyReading(m, S), noteReviewPressure(this.course.getCourseID(), {
28916
+ mass: S.urgency,
28917
+ healthyMass: d.reviewMass.healthyMass,
28918
+ rate: d.reviewMass.rate,
28919
+ multiplier: S.multiplier
28920
+ });
28921
+ let C = Date.now(), w = await this.loadIntakeClock(C), T = stepIntakeClock(w, C, b.length);
28922
+ T !== w && this.saveIntakeClock(T);
28923
+ let E = intakeReading(T, C, {
28924
+ eligibleNew: b.length,
28925
+ newCandidates: g.length
28926
+ }, d.intake);
28927
+ return applyReading(b, E), logger.info(`[Pipeline:regulators] review mass ${S.urgency.toFixed(1)} over ${m.length} due \u2192 \xD7${S.multiplier.toFixed(2)}; intake ${E.urgency.toFixed(1)}h, ${b.length}/${g.length} new eligible \u2192 \xD7${E.multiplier.toFixed(2)}`), [S, E];
28928
+ }
28929
+ notePresented(t) {
28930
+ t.status !== "new" || t.courseId !== this.course?.getCourseID() || this.saveIntakeClock(resetIntakeClock(Date.now()));
28931
+ }
28932
+ async loadIntakeClock(t) {
28933
+ if (this._intakeClock) return this._intakeClock;
28934
+ let c = null;
28935
+ try {
28936
+ c = await this.user.getStrategyState(this.course.getCourseID(), INTAKE_CLOCK_KEY);
28937
+ } catch (t) {
28938
+ logger.warn(`[Pipeline:regulators] Could not read the intake clock: ${t}`);
28939
+ }
28940
+ return c ? this._intakeClock = c : this.saveIntakeClock(resetIntakeClock(t)), this._intakeClock;
28941
+ }
28942
+ saveIntakeClock(t) {
28943
+ this._intakeClock = t;
28944
+ let c = this.course.getCourseID();
28945
+ this._intakeClockWrite = this._intakeClockWrite.then(() => this.user.putStrategyState(c, INTAKE_CLOCK_KEY, t)).catch((t) => logger.warn(`[Pipeline:regulators] Could not save the intake clock: ${t}`));
28946
+ }
28652
28947
  async buildContext() {
28653
- let t = 1e3;
28948
+ let t = 1e3, c;
28654
28949
  try {
28655
- t = toCourseElo((await this.user.getCourseRegDoc(this.course.getCourseID())).elo).global.score;
28950
+ c = toCourseElo((await this.user.getCourseRegDoc(this.course.getCourseID())).elo), t = c.global.score;
28656
28951
  } catch (t) {
28657
28952
  logger.debug(`[Pipeline] Could not get user ELO, using default: ${t}`);
28658
28953
  }
28659
28954
  this._cachedOrchestration || (this._cachedOrchestration = await createOrchestrationContext(this.user, this.course));
28660
- let c = this._cachedOrchestration;
28955
+ let u = this._cachedOrchestration;
28661
28956
  return {
28662
28957
  user: this.user,
28663
28958
  course: this.course,
28664
28959
  userElo: t,
28665
- orchestration: c
28960
+ ...c ? { userCourseElo: c } : {},
28961
+ orchestration: u
28666
28962
  };
28667
28963
  }
28668
28964
  getCourseID() {
@@ -28709,7 +29005,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28709
29005
  }));
28710
29006
  m = await this.hydrateTags(m);
28711
29007
  let g = m.slice(), b = await this.buildContext();
28712
- for (let t of this.filters) m = await t.transform(m, b);
29008
+ for (let t of this.forecastFilters()) m = await t.transform(m, b);
28713
29009
  if (t?.hints && (m = this.applyHints(m, t.hints, g)), m = m.filter((t) => t.score >= c), u) {
28714
29010
  let t;
28715
29011
  try {
@@ -28721,6 +29017,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28721
29017
  }
28722
29018
  return m.sort((t, c) => c.score - t.score), t?.limit ? m.slice(0, t.limit) : m;
28723
29019
  }
29020
+ forecastFilters() {
29021
+ return this.filters.filter((t) => !t.liveOnly);
29022
+ }
28724
29023
  async diagnoseCardSpace(t) {
28725
29024
  let c = t?.threshold ?? .1, u = performance.now(), d = await this.course.getAllCardIds(), m = d.map((t) => ({
28726
29025
  cardId: t,
@@ -28730,7 +29029,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28730
29029
  }));
28731
29030
  m = await this.hydrateTags(m);
28732
29031
  let g = await this.buildContext(), b = [];
28733
- for (let t of this.filters) {
29032
+ for (let t of this.forecastFilters()) {
28734
29033
  m = await t.transform(m, g);
28735
29034
  let u = m.filter((t) => t.score >= c).length;
28736
29035
  b.push({
@@ -28774,13 +29073,55 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28774
29073
  }
28775
29074
  };
28776
29075
  } }), defaults_exports = {}, __export(defaults_exports, {
29076
+ createDefaultEloDistanceStrategy: () => createDefaultEloDistanceStrategy,
28777
29077
  createDefaultEloStrategy: () => createDefaultEloStrategy,
28778
29078
  createDefaultPipeline: () => createDefaultPipeline,
28779
29079
  createDefaultSrsStrategy: () => createDefaultSrsStrategy
28780
29080
  }), init_defaults = __esm({ "src/core/navigators/defaults.ts"() {
28781
29081
  init_navigators(), init_Pipeline(), init_CompositeGenerator(), init_elo(), init_srs(), init_eloDistance(), init_types_legacy();
29082
+ } }), pipelinePlan_exports = {}, __export(pipelinePlan_exports, {
29083
+ PIPELINE_STAGES: () => PIPELINE_STAGES,
29084
+ planPipeline: () => planPipeline
29085
+ }), init_pipelinePlan = __esm({ "src/core/navigators/pipelinePlan.ts"() {
29086
+ init_navigators(), init_regulators(), init_defaults(), PIPELINE_STAGES = [
29087
+ {
29088
+ key: "generate",
29089
+ title: "Generate",
29090
+ summary: "Each generator proposes candidates (up to 500 in all), scored on what is specific to its source. A card proposed by several generators keeps their mean score, raised 10% per extra generator."
29091
+ },
29092
+ {
29093
+ key: "filter",
29094
+ title: "Filter",
29095
+ summary: "Each filter multiplies candidate scores, in the order shown. A gate says a card is not ready yet; a signal expresses preference. Gates usually penalize rather than remove, so a gated card stays in the pool at a low score."
29096
+ },
29097
+ {
29098
+ key: "drop-zero",
29099
+ title: "Drop zero scores",
29100
+ summary: "Candidates whose score reached 0 leave the pool."
29101
+ },
29102
+ {
29103
+ key: "regulate",
29104
+ title: "Regulate",
29105
+ summary: "Balances reviews against new cards. Review mass: the due reviews weighed by their filtered scores; above a healthy level, every review is lifted. Intake: hours since a new card was last presented; new cards no gate penalized are lifted, and the clock stops while there are none."
29106
+ },
29107
+ {
29108
+ key: "hints",
29109
+ title: "Apply hints",
29110
+ summary: "The session's hints (from the app: an intro's follow-up, a difficulty boost) exclude, boost, or require cards. Required cards skip the filters entirely."
29111
+ },
29112
+ {
29113
+ key: "diversity",
29114
+ title: "Diversity re-rank",
29115
+ summary: "Demotes candidates that repeat a distinctive tag already ranked above them, so one concept or answer cannot take the whole head of the queue. Sees this run only, not what the session already served."
29116
+ },
29117
+ {
29118
+ key: "select",
29119
+ title: "Select",
29120
+ summary: "Highest scores first, up to the run's limit. The session mixes them into its supply queue."
29121
+ }
29122
+ ];
28782
29123
  } }), PipelineAssembler_exports = {}, __export(PipelineAssembler_exports, { PipelineAssembler: () => PipelineAssembler }), init_PipelineAssembler = __esm({ "src/core/navigators/PipelineAssembler.ts"() {
28783
- init_navigators(), init_WeightedFilter(), init_Pipeline(), init_logger(), init_CompositeGenerator(), init_defaults(), PipelineAssembler = class {
29124
+ init_navigators(), init_WeightedFilter(), init_Pipeline(), init_logger(), init_CompositeGenerator(), init_pipelinePlan(), PipelineAssembler = class {
28784
29125
  async assemble(t) {
28785
29126
  let { strategies: c, user: u, course: d } = t, m = [];
28786
29127
  if (c.length === 0) return {
@@ -28789,32 +29130,33 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28789
29130
  filterStrategies: [],
28790
29131
  warnings: m
28791
29132
  };
28792
- let g = [], b = [];
28793
- for (let t of c) isGenerator(t.implementingClass) ? g.push(t) : isFilter(t.implementingClass) ? b.push(t) : m.push(`Unknown strategy type '${t.implementingClass}', skipping: ${t.name}`);
28794
- let S = d.getCourseID(), C = g.some((t) => t.implementingClass === "elo"), w = g.some((t) => t.implementingClass === "srs");
28795
- if (C || (logger.debug("[PipelineAssembler] No ELO generator configured, adding default"), g.push(createDefaultEloStrategy(S))), w || (logger.debug("[PipelineAssembler] No SRS generator configured, adding default"), g.push(createDefaultSrsStrategy(S))), g.length === 0) return m.push("No generator strategy found"), {
29133
+ let g = planPipeline(c, d.getCourseID());
29134
+ m.push(...g.warnings);
29135
+ for (let t of [...g.generators, ...g.filters]) t.origin === "assembler-default" && logger.debug(`[PipelineAssembler] No ${t.implementingClass} ${t.role} configured, adding default`);
29136
+ let b = g.generators.map((t) => t.strategy), S = g.filters.map((t) => t.strategy);
29137
+ if (b.length === 0) return m.push("No generator strategy found"), {
28796
29138
  pipeline: null,
28797
29139
  generatorStrategies: [],
28798
29140
  filterStrategies: [],
28799
29141
  warnings: m
28800
29142
  };
28801
- let T;
28802
- g.length === 1 ? (T = await ContentNavigator.create(u, d, g[0]), logger.debug(`[PipelineAssembler] Using single generator: ${g[0].name}`)) : (logger.debug(`[PipelineAssembler] Using CompositeGenerator for ${g.length} generators: ${g.map((t) => t.name).join(", ")}`), T = await CompositeGenerator.fromStrategies(u, d, g));
28803
- let E = [], D = [...b].sort((t, c) => t.name.localeCompare(c.name));
28804
- for (let t of D) try {
29143
+ let C;
29144
+ b.length === 1 ? (C = await ContentNavigator.create(u, d, b[0]), logger.debug(`[PipelineAssembler] Using single generator: ${b[0].name}`)) : (logger.debug(`[PipelineAssembler] Using CompositeGenerator for ${b.length} generators: ${b.map((t) => t.name).join(", ")}`), C = await CompositeGenerator.fromStrategies(u, d, b));
29145
+ let w = [];
29146
+ for (let t of S) try {
28805
29147
  let c = await ContentNavigator.create(u, d, t);
28806
29148
  if ("transform" in c && typeof c.transform == "function") {
28807
29149
  let u = c;
28808
- t.learnable && (u = new WeightedFilter(u, t.learnable, t.staticWeight, t._id)), E.push(u), logger.debug(`[PipelineAssembler] Added filter: ${t.name}`);
29150
+ t.learnable && (u = new WeightedFilter(u, t.learnable, t.staticWeight, t._id)), w.push(u), logger.debug(`[PipelineAssembler] Added filter: ${t.name}`);
28809
29151
  } else m.push(`Filter '${t.name}' does not implement CardFilter.transform(), skipping`);
28810
29152
  } catch (c) {
28811
29153
  m.push(`Failed to instantiate filter '${t.name}': ${c}`);
28812
29154
  }
28813
- let O = new Pipeline(T, E, u, d);
28814
- return logger.debug(`[PipelineAssembler] Assembled pipeline with ${g.length} generator(s) and ${E.length} filter(s)`), {
28815
- pipeline: O,
28816
- generatorStrategies: g,
28817
- filterStrategies: D,
29155
+ let T = new Pipeline(C, w, u, d);
29156
+ return logger.debug(`[PipelineAssembler] Assembled pipeline with ${b.length} generator(s) and ${w.length} filter(s)`), {
29157
+ pipeline: T,
29158
+ generatorStrategies: b,
29159
+ filterStrategies: S,
28818
29160
  warnings: m
28819
29161
  };
28820
29162
  }
@@ -28844,7 +29186,9 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28844
29186
  "./generators/prescribed.ts": () => Promise.resolve().then(() => (init_prescribed(), prescribed_exports)),
28845
29187
  "./generators/srs.ts": () => Promise.resolve().then(() => (init_srs(), srs_exports)),
28846
29188
  "./generators/types.ts": () => Promise.resolve().then(() => (init_types(), types_exports)),
28847
- "./index.ts": () => Promise.resolve().then(() => (init_navigators(), navigators_exports))
29189
+ "./index.ts": () => Promise.resolve().then(() => (init_navigators(), navigators_exports)),
29190
+ "./pipelinePlan.ts": () => Promise.resolve().then(() => (init_pipelinePlan(), pipelinePlan_exports)),
29191
+ "./regulators.ts": () => Promise.resolve().then(() => (init_regulators(), regulators_exports))
28848
29192
  });
28849
29193
  } }), navigators_exports = {}, __export(navigators_exports, {
28850
29194
  ContentNavigator: () => ContentNavigator,
@@ -28860,6 +29204,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28860
29204
  drainCapturedRuns: () => drainCapturedRuns,
28861
29205
  getActivePipeline: () => getActivePipeline,
28862
29206
  getCardOrigin: () => getCardOrigin,
29207
+ getRegisteredFilterKind: () => getRegisteredFilterKind,
28863
29208
  getRegisteredNavigator: () => getRegisteredNavigator,
28864
29209
  getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
28865
29210
  getRegisteredNavigatorRole: () => getRegisteredNavigatorRole,
@@ -28875,14 +29220,15 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
28875
29220
  registerNavigator: () => registerNavigator,
28876
29221
  setDebugSessionId: () => setDebugSessionId
28877
29222
  }), init_navigators = __esm({ "src/core/navigators/index.ts"() {
28878
- init_diversityRerank(), init_PipelineDebugger(), init_SrsDebugger(), init_StrategyPressureDebugger(), init_logger(), init_(), init_2(), init_3(), navigatorRegistry = /* @__PURE__ */ new Map(), Navigators = /* @__PURE__ */ ((t) => (t.ELO = "elo", t.SRS = "srs", t.PRESCRIBED = "prescribed", t.HIERARCHY = "hierarchyDefinition", t.INTERFERENCE = "interferenceMitigator", t.RELATIVE_PRIORITY = "relativePriority", t.USER_TAG_PREFERENCE = "userTagPreference", t))(Navigators || {}), NavigatorRole = /* @__PURE__ */ ((t) => (t.GENERATOR = "generator", t.FILTER = "filter", t))(NavigatorRole || {}), NavigatorRoles = {
29223
+ init_diversityRerank(), init_PipelineDebugger(), init_SrsDebugger(), init_StrategyPressureDebugger(), init_logger(), init_(), init_2(), init_3(), navigatorRegistry = /* @__PURE__ */ new Map(), Navigators = /* @__PURE__ */ ((t) => (t.ELO = "elo", t.SRS = "srs", t.PRESCRIBED = "prescribed", t.HIERARCHY = "hierarchyDefinition", t.INTERFERENCE = "interferenceMitigator", t.RELATIVE_PRIORITY = "relativePriority", t.USER_TAG_PREFERENCE = "userTagPreference", t.ELO_DISTANCE = "eloDistance", t))(Navigators || {}), NavigatorRole = /* @__PURE__ */ ((t) => (t.GENERATOR = "generator", t.FILTER = "filter", t))(NavigatorRole || {}), NavigatorRoles = {
28879
29224
  elo: "generator",
28880
29225
  srs: "generator",
28881
29226
  prescribed: "generator",
28882
29227
  hierarchyDefinition: "filter",
28883
29228
  interferenceMitigator: "filter",
28884
29229
  relativePriority: "filter",
28885
- userTagPreference: "filter"
29230
+ userTagPreference: "filter",
29231
+ eloDistance: "filter"
28886
29232
  }, ContentNavigator = class {
28887
29233
  constructor(t, c, u) {
28888
29234
  _defineProperty$2(this, "user", void 0), _defineProperty$2(this, "course", void 0), _defineProperty$2(this, "strategyName", void 0), _defineProperty$2(this, "strategyId", void 0), _defineProperty$2(this, "learnable", void 0), _defineProperty$2(this, "staticWeight", void 0), this.user = t, this.course = c, u && (this.strategyName = u.name, this.strategyId = u._id, this.learnable = u.learnable, this.staticWeight = u.staticWeight);
@@ -29232,6 +29578,9 @@ ${t.stack}` : JSON.stringify(t);
29232
29578
  setEphemeralHints(t) {
29233
29579
  this._pendingHints = t;
29234
29580
  }
29581
+ notePresented(t) {
29582
+ t.status === "new" && this._getCurrentUser().then((t) => this._getCachedNavigator(t)).then(({ navigator: c }) => c.notePresented?.(t)).catch((t) => logger.warn(`[courseDB] Could not note a presentation: ${t}`));
29583
+ }
29235
29584
  async getWeightedCards(t) {
29236
29585
  let c = await this._getCurrentUser();
29237
29586
  try {
@@ -31111,7 +31460,8 @@ ${t.stack}` : JSON.stringify(t);
31111
31460
  ...u.hints ? { hints: u.hints } : {},
31112
31461
  ...u.discardedTail ? { discardedTail: u.discardedTail } : {},
31113
31462
  cards: persistedRunCards(u),
31114
- ...u.unselectedNew ? { unselectedNew: persistedUnselectedNew(u.unselectedNew) } : {}
31463
+ ...u.unselectedNew ? { unselectedNew: persistedUnselectedNew(u.unselectedNew) } : {},
31464
+ ...u.regulators ? { regulators: u.regulators.map(persistedReading) } : {}
31115
31465
  });
31116
31466
  }
31117
31467
  }
@@ -31441,7 +31791,13 @@ ${t.stack}` : JSON.stringify(t);
31441
31791
  if (c || (c = await this.hydrationService.waitForCard(t.cardID)), this.removeItemFromQueue(t), c) {
31442
31792
  await this.hydrationService.ensureHydratedCards(), this._currentCard = c;
31443
31793
  let u = t.status === "review" || t.status === "failed-review" ? "review" : t.status === "new" || t.status === "failed-new" ? "new" : "failed", d = t.status.startsWith("failed") ? "failedQ" : "supplyQ";
31444
- return recordCardPresentation(t.cardID, t.courseID, this.courseNameCache.get(t.courseID), u, d, t.score), snapshotQueues(this.supplyQ.length, this.failedQ.length), c;
31794
+ recordCardPresentation(t.cardID, t.courseID, this.courseNameCache.get(t.courseID), u, d, t.score);
31795
+ for (let c of this.sources) c.notePresented?.({
31796
+ cardId: t.cardID,
31797
+ courseId: t.courseID,
31798
+ status: t.status
31799
+ });
31800
+ return snapshotQueues(this.supplyQ.length, this.failedQ.length), c;
31445
31801
  }
31446
31802
  this.log(`Skipping card ${t.cardID}: hydration failed, trying next`), isReview(t) && this.srsService.removeReview(t.reviewID);
31447
31803
  }
@@ -32786,6 +33142,9 @@ Currently logged-in as ${this._username}.`);
32786
33142
  setEphemeralHints(t) {
32787
33143
  this._pendingHints = t;
32788
33144
  }
33145
+ notePresented(t) {
33146
+ t.status === "new" && this.createNavigator(this.userDB).then((c) => c.notePresented?.(t)).catch((t) => logger.warn(`[static/courseDB] Could not note a presentation: ${t}`));
33147
+ }
32789
33148
  async getWeightedCards(t) {
32790
33149
  try {
32791
33150
  let c = await this.createNavigator(this.userDB);
@@ -33122,7 +33481,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
33122
33481
  }, mountUserDBDebugger();
33123
33482
  } }), init_core = __esm({ "src/core/index.ts"() {
33124
33483
  init_interfaces(), init_types_legacy(), init_user(), init_strategyState(), init_userOutcome(), init_studySession(), init_hydration(), init_Loggable(), init_util(), init_navigators(), init_bulkImport(), init_orchestration(), init_UserDBDebugger();
33125
- } }), init_core(), init_courseLookupDB(), init_logger(), init_study(), init_util2(), init_factory(), init_userDBHelpers();
33484
+ } }), init_core(), init_pipelinePlan(), init_regulators(), init_courseLookupDB(), init_logger(), init_study(), init_util2(), init_factory(), init_userDBHelpers();
33126
33485
  }));
33127
33486
  //#endregion
33128
33487
  //#region ../../node_modules/vue-router/dist/vue-router.mjs