@vue-skuilder/standalone-ui 0.2.25 → 0.2.27

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.
@@ -25273,6 +25273,19 @@ function formatAge(t) {
25273
25273
  let u = Math.round(c / 60);
25274
25274
  return u < 24 ? `${u}h` : `${Math.round(u / 24)}d`;
25275
25275
  }
25276
+ function unmetIntroExposeTags(t, c, u) {
25277
+ if (u <= 0) return [];
25278
+ let d = new Set(t.filter((t) => t.startsWith("gpc:expose:")));
25279
+ for (let c of t) {
25280
+ if (!c.startsWith("gpc:intro:")) continue;
25281
+ let t = c.slice(10);
25282
+ t && d.add(`gpc:expose:${t}`);
25283
+ }
25284
+ return [...d].filter((t) => {
25285
+ let d = c[t];
25286
+ return !d || d.count < u;
25287
+ });
25288
+ }
25276
25289
  function pickTopByScore(t, c) {
25277
25290
  return [...t].sort((t, c) => c.score - t.score || t.cardId.localeCompare(c.cardId)).slice(0, c);
25278
25291
  }
@@ -27487,7 +27500,10 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27487
27500
  return { cards: g };
27488
27501
  }
27489
27502
  };
27490
- } }), generators_exports = {}, init_generators = __esm({ "src/core/navigators/generators/index.ts"() {} }), prescribed_exports = {}, __export(prescribed_exports, { default: () => PrescribedCardsGenerator }), init_prescribed = __esm({ "src/core/navigators/generators/prescribed.ts"() {
27503
+ } }), generators_exports = {}, init_generators = __esm({ "src/core/navigators/generators/index.ts"() {} }), prescribed_exports = {}, __export(prescribed_exports, {
27504
+ default: () => PrescribedCardsGenerator,
27505
+ unmetIntroExposeTags: () => unmetIntroExposeTags
27506
+ }), init_prescribed = __esm({ "src/core/navigators/generators/prescribed.ts"() {
27491
27507
  init_navigators(), init_StrategyPressureDebugger(), init_logger(), DEFAULT_FRESHNESS_WINDOW = 3, DEFAULT_MAX_DIRECT_PER_RUN = 3, DEFAULT_MAX_SUPPORT_PER_RUN = 3, DEFAULT_HIERARCHY_DEPTH = 2, DEFAULT_MIN_COUNT = 3, DEFAULT_PRACTICE_MIN_COUNT = 3, DEFAULT_MAX_PRACTICE_PER_RUN = 4, BASE_TARGET_SCORE = 1, BASE_SUPPORT_SCORE = .8, DISCOVERED_SUPPORT_SCORE = 12, BASE_PRACTICE_SCORE = 1, PRACTICE_BASE_MULT = 2, MAX_PRACTICE_MULTIPLIER = 4, PRACTICE_STALENESS_BUMP_PER_DAY = .5, MAX_TARGET_MULTIPLIER = 8, MAX_SUPPORT_MULTIPLIER = 4, PRESCRIBED_DEBUG_VERSION = "testversion-prescribed-v3", PrescribedCardsGenerator = class extends ContentNavigator {
27492
27508
  constructor(t, c, u) {
27493
27509
  super(t, c, u), _defineProperty$2(this, "name", void 0), _defineProperty$2(this, "config", void 0), this.name = u.name || "Prescribed Cards", this.config = this.parseConfig(u.serializedData), logger.debug(`[Prescribed] Initialized with ${this.config.groups.length} groups and ${this.config.groups.reduce((t, c) => t + c.targetCardIds.length, 0)} targets`);
@@ -27647,6 +27663,7 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27647
27663
  freshnessWindowSessions: typeof t.freshnessWindowSessions == "number" ? t.freshnessWindowSessions : DEFAULT_FRESHNESS_WINDOW,
27648
27664
  maxDirectTargetsPerRun: typeof t.maxDirectTargetsPerRun == "number" ? t.maxDirectTargetsPerRun : DEFAULT_MAX_DIRECT_PER_RUN,
27649
27665
  maxSupportCardsPerRun: typeof t.maxSupportCardsPerRun == "number" ? t.maxSupportCardsPerRun : DEFAULT_MAX_SUPPORT_PER_RUN,
27666
+ introExposeMinCount: typeof t.introExposeMinCount == "number" ? t.introExposeMinCount : DEFAULT_MIN_COUNT,
27650
27667
  hierarchyWalk: {
27651
27668
  enabled: t.hierarchyWalk?.enabled !== !1,
27652
27669
  maxDepth: typeof t.hierarchyWalk?.maxDepth == "number" ? t.hierarchyWalk.maxDepth : DEFAULT_HIERARCHY_DEPTH
@@ -27681,16 +27698,8 @@ var import_browser_ponyfill, import_browser_ponyfill$1, import_browser, import__
27681
27698
  for (let t of E) D.set(t, g.get(t) ?? []);
27682
27699
  let O = [], xr = [], Sr = /* @__PURE__ */ new Set();
27683
27700
  for (let t of E) {
27684
- let u = D.get(t) ?? [], d = this.resolveBlockedSupportTags(u, S, C, w, c.hierarchyWalk?.enabled !== !1, c.hierarchyWalk?.maxDepth ?? DEFAULT_HIERARCHY_DEPTH), m = u.filter((t) => t.startsWith("gpc:intro:")), g = new Set(u.filter((t) => t.startsWith("gpc:expose:")));
27685
- for (let t of m) {
27686
- let c = t.slice(10);
27687
- c && g.add(`gpc:expose:${c}`);
27688
- }
27689
- let b = [...g].filter((t) => {
27690
- let c = C[t];
27691
- return !c || c.count < DEFAULT_MIN_COUNT;
27692
- });
27693
- b.length > 0 && b.forEach((t) => Sr.add(t)), d.blocked || b.length > 0 ? (O.push(t), d.supportTags.forEach((t) => Sr.add(t))) : xr.push(t);
27701
+ let u = D.get(t) ?? [], d = this.resolveBlockedSupportTags(u, S, C, w, c.hierarchyWalk?.enabled !== !1, c.hierarchyWalk?.maxDepth ?? DEFAULT_HIERARCHY_DEPTH), m = unmetIntroExposeTags(u, C, c.introExposeMinCount ?? DEFAULT_MIN_COUNT);
27702
+ m.length > 0 && m.forEach((t) => Sr.add(t)), d.blocked || m.length > 0 ? (O.push(t), d.supportTags.forEach((t) => Sr.add(t))) : xr.push(t);
27694
27703
  }
27695
27704
  let Cr = dedupe([...c.supportCardIds ?? [], ...this.findSupportCardsByTags(c, g, [...Sr])]).filter((t) => !d.has(t) && !m.has(t)), wr = O.length > 0 && Sr.size > 0 && Cr.length === 0 ? this.findDiscoveredSupportCards({
27696
27705
  supportTags: [...Sr],
@@ -29749,6 +29758,26 @@ ${t.stack}` : JSON.stringify(t);
29749
29758
  };
29750
29759
  }
29751
29760
  }
29761
+ async adoptSession(t) {
29762
+ let c;
29763
+ try {
29764
+ c = await getLoggedInUsername();
29765
+ } catch {
29766
+ return {
29767
+ ok: !1,
29768
+ error: "No session to adopt"
29769
+ };
29770
+ }
29771
+ if (t?.startsWith(GuestUsername)) {
29772
+ logger.info(`Migrating data from funnel account ${t} to ${c}`);
29773
+ let u = await this.migrateFunnelData(t, c);
29774
+ u.success || logger.warn(`Migration failed: ${u.error}`);
29775
+ }
29776
+ return {
29777
+ ok: !0,
29778
+ username: c
29779
+ };
29780
+ }
29752
29781
  async logout() {
29753
29782
  try {
29754
29783
  let t = await this.getRemoteCouchRootDB().logOut();
@@ -31278,15 +31307,15 @@ ${t.stack}` : JSON.stringify(t);
31278
31307
  c || this._applyHintsToSources();
31279
31308
  let g = [];
31280
31309
  for (let t = 0; t < this.sources.length; t++) {
31281
- let c = this.sources[t];
31310
+ let u = this.sources[t];
31282
31311
  try {
31283
- let u = (await c.getWeightedCards(m)).cards;
31312
+ let c = (await u.getWeightedCards(m)).cards;
31284
31313
  g.push({
31285
31314
  sourceIndex: t,
31286
- weighted: u
31315
+ weighted: c
31287
31316
  });
31288
- } catch (c) {
31289
- if (this.error(`Failed to get content from source ${t}:`, c), this.sources.length === 1) throw Error(`Cannot start session: failed to load content from source ${t}`);
31317
+ } catch (u) {
31318
+ if (this.error(`Failed to get content from source ${t}:`, u), this.sources.length === 1 && !c) throw Error(`Cannot start session: failed to load content from source ${t}`);
31290
31319
  }
31291
31320
  }
31292
31321
  if (g.length === 0) {
@@ -31644,6 +31673,23 @@ Currently logged-in as ${this._username}.`);
31644
31673
  }
31645
31674
  return u;
31646
31675
  }
31676
+ async adoptSession(t) {
31677
+ if (!this.syncStrategy.canAuthenticate() || !this.syncStrategy.adoptSession) throw Error("Session adoption not supported by current sync strategy");
31678
+ let c = this._username.startsWith(GuestUsername) ? this._username : void 0;
31679
+ if (!c) throw Error(`Cannot adopt a session while logged in.
31680
+ Log out of account ${this.getUsername()} first.`);
31681
+ let u = await this.syncStrategy.adoptSession(t.migrateGuestData ? c : void 0);
31682
+ if (u.ok && u.username) {
31683
+ log4(`Adopted session for ${u.username}`), this._username = u.username;
31684
+ try {
31685
+ localStorage.removeItem("sk-guest-uuid");
31686
+ } catch (t) {
31687
+ logger.warn("localStorage not available (Node.js environment):", t);
31688
+ }
31689
+ await this.init();
31690
+ }
31691
+ return u;
31692
+ }
31647
31693
  async resetUserData() {
31648
31694
  if (this.syncStrategy.canAuthenticate()) return {
31649
31695
  status: Status.error,
@@ -43982,6 +44028,7 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
43982
44028
  message: "Failed to prepare study session",
43983
44029
  error: t
43984
44030
  });
44031
+ return;
43985
44032
  }
43986
44033
  try {
43987
44034
  this.contentSources.filter((t) => t.type === "course").forEach(async (t) => this.courseNames[t.id] = (await this.dataLayer.getCoursesDB().getCourseConfig(t.id)).name), console.log(`[StudySession] Session created:
@@ -44096,7 +44143,7 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
44096
44143
  key: 4,
44097
44144
  ref: "shadowWrapper",
44098
44145
  class: "card-transition-container"
44099
- }, Xt = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), Zt = /* @__PURE__ */ F$3(Ut, [["render", _sfc_render$15], ["__scopeId", "data-v-c765534b"]]), Qt = /* @__PURE__ */ defineComponent({
44146
+ }, Xt = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), Zt = /* @__PURE__ */ F$3(Ut, [["render", _sfc_render$15], ["__scopeId", "data-v-ad5e0df0"]]), Qt = /* @__PURE__ */ defineComponent({
44100
44147
  name: "MultipleChoiceOption",
44101
44148
  components: { MarkdownRenderer: /* @__PURE__ */ defineAsyncComponent(() => Promise.resolve().then(() => (init_MarkdownRenderer_kStoDRNE(), MarkdownRenderer_kStoDRNE_exports)).then((t) => t.n)) },
44102
44149
  props: {