@thanh01.pmt/research-kit 1.2.0 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/academic/index.cjs +11 -2
  2. package/dist/academic/index.cjs.map +1 -1
  3. package/dist/academic/index.d.cts +3 -3
  4. package/dist/academic/index.d.ts +3 -3
  5. package/dist/academic/index.js +2 -1
  6. package/dist/{catalogBuilder-nrGYEY4b.d.cts → catalogBuilder-B4eiLS_S.d.cts} +27 -5
  7. package/dist/{catalogBuilder-2i5KASUF.d.ts → catalogBuilder-BNB_gaWP.d.ts} +27 -5
  8. package/dist/chunk-AKEI7H2C.js +223 -0
  9. package/dist/chunk-AKEI7H2C.js.map +1 -0
  10. package/dist/{chunk-X3X26W2I.js → chunk-HESXWQEF.js} +12 -7
  11. package/dist/chunk-HESXWQEF.js.map +1 -0
  12. package/dist/{chunk-QFYM2NV4.js → chunk-KXJDQBSJ.js} +3 -3
  13. package/dist/{chunk-QFYM2NV4.js.map → chunk-KXJDQBSJ.js.map} +1 -1
  14. package/dist/{chunk-XDDTHWJW.js → chunk-P6RHBJY2.js} +89 -25
  15. package/dist/chunk-P6RHBJY2.js.map +1 -0
  16. package/dist/{chunk-ON6VFCJO.js → chunk-QQZQNBJC.js} +51 -2
  17. package/dist/chunk-QQZQNBJC.js.map +1 -0
  18. package/dist/{chunk-QK3LVGI7.js → chunk-SAHBBO3U.js} +170 -8
  19. package/dist/chunk-SAHBBO3U.js.map +1 -0
  20. package/dist/{chunk-DOXSPRSP.js → chunk-SDDZFFL6.js} +14 -225
  21. package/dist/chunk-SDDZFFL6.js.map +1 -0
  22. package/dist/chunk-YICMTZS5.js +527 -0
  23. package/dist/chunk-YICMTZS5.js.map +1 -0
  24. package/dist/config/index.cjs +10 -5
  25. package/dist/config/index.cjs.map +1 -1
  26. package/dist/config/index.d.cts +1 -1
  27. package/dist/config/index.d.ts +1 -1
  28. package/dist/config/index.js +1 -1
  29. package/dist/evidence/index.cjs.map +1 -1
  30. package/dist/evidence/index.d.cts +2 -2
  31. package/dist/evidence/index.d.ts +2 -2
  32. package/dist/evidence/index.js +2 -2
  33. package/dist/harvester/index.cjs +965 -6
  34. package/dist/harvester/index.cjs.map +1 -1
  35. package/dist/harvester/index.d.cts +87 -5
  36. package/dist/harvester/index.d.ts +87 -5
  37. package/dist/harvester/index.js +4 -3
  38. package/dist/{index-DlngvZBr.d.ts → index-9rDiFuR4.d.cts} +43 -12
  39. package/dist/{index-DlngvZBr.d.cts → index-9rDiFuR4.d.ts} +43 -12
  40. package/dist/index.cjs +852 -32
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +13 -11
  43. package/dist/index.d.ts +13 -11
  44. package/dist/index.js +21 -12
  45. package/dist/index.js.map +1 -1
  46. package/dist/{literatureReview-C7hsjrn4.d.cts → literatureReview-BwidpYJo.d.cts} +2 -1
  47. package/dist/{literatureReview-DWl13r_3.d.ts → literatureReview-DOzgm9Q2.d.ts} +2 -1
  48. package/dist/pipeline/index.cjs +545 -249
  49. package/dist/pipeline/index.cjs.map +1 -1
  50. package/dist/pipeline/index.d.cts +10 -4
  51. package/dist/pipeline/index.d.ts +10 -4
  52. package/dist/pipeline/index.js +6 -5
  53. package/dist/{webScraper-yO9P-oLb.d.cts → webScraper-CAQjE46m.d.cts} +11 -2
  54. package/dist/{webScraper-DBFUIqoO.d.ts → webScraper-CXIpvyA6.d.ts} +11 -2
  55. package/package.json +1 -1
  56. package/dist/chunk-DOXSPRSP.js.map +0 -1
  57. package/dist/chunk-LSMSIPTZ.js +0 -3
  58. package/dist/chunk-LSMSIPTZ.js.map +0 -1
  59. package/dist/chunk-ON6VFCJO.js.map +0 -1
  60. package/dist/chunk-QK3LVGI7.js.map +0 -1
  61. package/dist/chunk-X3X26W2I.js.map +0 -1
  62. package/dist/chunk-XDDTHWJW.js.map +0 -1
@@ -0,0 +1,527 @@
1
+ // src/harvester/stemResources.ts
2
+ var PHET_SIMULATIONS = [
3
+ {
4
+ id: "phet-circuit-construction-kit-dc",
5
+ titleEn: "Circuit Construction Kit: DC",
6
+ titleVi: "B\u1ED9 L\u1EAFp R\xE1p M\u1EA1ch \u0110i\u1EC7n M\u1ED9t Chi\u1EC1u (DC)",
7
+ descriptionEn: "Build circuits with batteries, light bulbs, resistors, switches, and conductors. Measure voltage and current with voltmeter and ammeter.",
8
+ descriptionVi: "X\xE2y d\u1EF1ng m\u1EA1ch \u0111i\u1EC7n m\u1ED9t chi\u1EC1u v\u1EDBi pin, b\xF3ng \u0111\xE8n, \u0111i\u1EC7n tr\u1EDF, c\xF4ng t\u1EAFc. \u0110o \u0111i\u1EC7n \xE1p v\xE0 d\xF2ng \u0111i\u1EC7n b\u1EB1ng v\xF4n k\u1EBF v\xE0 ampe k\u1EBF.",
9
+ simUrl: "https://phet.colorado.edu/sims/html/circuit-construction-kit-dc/latest/circuit-construction-kit-dc_all.html",
10
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/circuit-construction-kit-dc/latest/circuit-construction-kit-dc-600.png",
11
+ subject: "electronics",
12
+ targetLevel: "all",
13
+ keywords: ["circuit", "m\u1EA1ch \u0111i\u1EC7n", "\u0111i\u1EC7n tr\u1EDF", "resistor", "pin", "battery", "led", "voltage", "current", "d\xF2ng \u0111i\u1EC7n", "hi\u1EC7u \u0111i\u1EC7n th\u1EBF", "ohm", "\u0111o \u0111i\u1EC7n"]
14
+ },
15
+ {
16
+ id: "phet-wave-on-a-string",
17
+ titleEn: "Wave on a String",
18
+ titleVi: "S\xF3ng Tr\xEAn D\xE2y",
19
+ descriptionEn: "Simulate mechanical wave pulse and periodic oscillations. Adjust frequency, amplitude, tension, and damping.",
20
+ descriptionVi: "M\xF4 ph\u1ECFng s\xF3ng c\u01A1 h\u1ECDc tr\xEAn d\xE2y. \u0110i\u1EC1u ch\u1EC9nh t\u1EA7n s\u1ED1, bi\xEAn \u0111\u1ED9, l\u1EF1c c\u0103ng v\xE0 \u0111\u1ED9 suy gi\u1EA3m.",
21
+ simUrl: "https://phet.colorado.edu/sims/html/wave-on-a-string/latest/wave-on-a-string_all.html",
22
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/wave-on-a-string/latest/wave-on-a-string-600.png",
23
+ subject: "physics",
24
+ targetLevel: "lower_secondary",
25
+ keywords: ["wave", "s\xF3ng", "t\u1EA7n s\u1ED1", "frequency", "bi\xEAn \u0111\u1ED9", "amplitude", "sound", "\xE2m thanh", "si\xEAu \xE2m", "ultrasonic"]
26
+ },
27
+ {
28
+ id: "phet-balloons-and-static-electricity",
29
+ titleEn: "Balloons and Static Electricity",
30
+ titleVi: "B\xF3ng Bay v\xE0 T\u0129nh \u0110i\u1EC7n",
31
+ descriptionEn: "Explore electrical charges, attraction, repulsion, and static electricity by rubbing a balloon on a sweater.",
32
+ descriptionVi: "Kh\xE1m ph\xE1 \u0111i\u1EC7n t\xEDch, l\u1EF1c h\xFAt, l\u1EF1c \u0111\u1EA9y v\xE0 hi\u1EC7n t\u01B0\u1EE3ng t\u0129nh \u0111i\u1EC7n qua qu\u1EA3 b\xF3ng bay v\xE0 \xE1o len.",
33
+ simUrl: "https://phet.colorado.edu/sims/html/balloons-and-static-electricity/latest/balloons-and-static-electricity_all.html",
34
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/balloons-and-static-electricity/latest/balloons-and-static-electricity-600.png",
35
+ subject: "physics",
36
+ targetLevel: "primary",
37
+ keywords: ["static electricity", "t\u0129nh \u0111i\u1EC7n", "\u0111i\u1EC7n t\xEDch", "electron", "charge", "l\u1EF1c \u0111i\u1EC7n", "h\xFAt \u0111\u1EA9y"]
38
+ },
39
+ {
40
+ id: "phet-faradays-law",
41
+ titleEn: "Faraday's Law & Electromagnetic Induction",
42
+ titleVi: "\u0110\u1ECBnh Lu\u1EADt Faraday & C\u1EA3m \u1EE8ng \u0110i\u1EC7n T\u1EEB",
43
+ descriptionEn: "Move a bar magnet through a coil of wire to generate an electric current and illuminate a bulb. Observe magnet direction and voltage.",
44
+ descriptionVi: "Di chuy\u1EC3n nam ch\xE2m qua cu\u1ED9n d\xE2y \u0111\u1EC3 t\u1EA1o ra d\xF2ng \u0111i\u1EC7n c\u1EA3m \u1EE9ng l\xE0m s\xE1ng b\xF3ng \u0111\xE8n. Quan s\xE1t chi\u1EC1u d\xF2ng \u0111i\u1EC7n v\xE0 c\u1EF1c t\u1EEB.",
45
+ simUrl: "https://phet.colorado.edu/sims/html/faradays-law/latest/faradays-law_all.html",
46
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/faradays-law/latest/faradays-law-600.png",
47
+ subject: "electronics",
48
+ targetLevel: "upper_secondary",
49
+ keywords: ["faraday", "c\u1EA3m \u1EE9ng \u0111i\u1EC7n t\u1EEB", "nam ch\xE2m", "magnet", "cu\u1ED9n d\xE2y", "coil", "\u0111\u1ED9ng c\u01A1", "motor", "m\xE1y ph\xE1t \u0111i\u1EC7n", "generator"]
50
+ },
51
+ {
52
+ id: "phet-color-vision",
53
+ titleEn: "Color Vision (RGB & Light Filters)",
54
+ titleVi: "Th\u1ECB Gi\xE1c M\xE0u (Ph\u1ED1i M\xE0u RGB & B\u1ED9 L\u1ECDc \xC1nh S\xE1ng)",
55
+ descriptionEn: "Combine red, green, and blue light sources to create full spectrum colors. Ideal for teaching RGB LEDs, sensors, and display screens.",
56
+ descriptionVi: "K\u1EBFt h\u1EE3p c\xE1c ngu\u1ED3n s\xE1ng \u0110\u1ECF (Red), Xanh l\u1EE5c (Green), Xanh lam (Blue) \u0111\u1EC3 t\u1EA1o ra c\xE1c d\u1EA3i m\xE0u. R\u1EA5t ph\xF9 h\u1EE3p khi d\u1EA1y LED RGB v\xE0 c\u1EA3m bi\u1EBFn m\xE0u.",
57
+ simUrl: "https://phet.colorado.edu/sims/html/color-vision/latest/color-vision_all.html",
58
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/color-vision/latest/color-vision-600.png",
59
+ subject: "physics",
60
+ targetLevel: "all",
61
+ keywords: ["color", "m\xE0u s\u1EAFc", "rgb", "led rgb", "\xE1nh s\xE1ng", "light", "c\u1EA3m bi\u1EBFn \xE1nh s\xE1ng", "ldr", "quang h\u1ECDc", "optics"]
62
+ },
63
+ {
64
+ id: "phet-forces-and-motion-basics",
65
+ titleEn: "Forces and Motion: Basics",
66
+ titleVi: "L\u1EF1c v\xE0 Chuy\u1EC3n \u0110\u1ED9ng C\u01A1 B\u1EA3n",
67
+ descriptionEn: "Explore the forces at work when tugging a crate, sliding on ice, or pushing objects. Observe friction, acceleration, and Newton laws.",
68
+ descriptionVi: "Kh\xE1m ph\xE1 c\xE1c l\u1EF1c t\xE1c d\u1EE5ng khi k\xE9o th\xF9ng h\xE0ng, ma s\xE1t, gia t\u1ED1c v\xE0 \u0111\u1ECBnh lu\u1EADt Newton. C\u1ED1t l\xF5i cho robot di \u0111\u1ED9ng v\xE0 xe t\u1EF1 h\xE0nh.",
69
+ simUrl: "https://phet.colorado.edu/sims/html/forces-and-motion-basics/latest/forces-and-motion-basics_all.html",
70
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/forces-and-motion-basics/latest/forces-and-motion-basics-600.png",
71
+ subject: "physics",
72
+ targetLevel: "all",
73
+ keywords: ["force", "l\u1EF1c", "motion", "chuy\u1EC3n \u0111\u1ED9ng", "friction", "ma s\xE1t", "robotics", "xe t\u1EF1 h\xE0nh", "newton", "v\u1EADn t\u1ED1c", "gia t\u1ED1c"]
74
+ },
75
+ {
76
+ id: "phet-gravity-and-orbits",
77
+ titleEn: "Gravity and Orbits",
78
+ titleVi: "L\u1EF1c H\u1EA5p D\u1EABn v\xE0 Qu\u1EF9 \u0110\u1EA1o V\u1EC7 Tinh",
79
+ descriptionEn: "Move the sun, earth, moon and space station to see how gravity controls orbital velocity and gravitational pull.",
80
+ descriptionVi: "Di chuy\u1EC3n M\u1EB7t Tr\u1EDDi, Tr\xE1i \u0110\u1EA5t, M\u1EB7t Tr\u0103ng v\xE0 tr\u1EA1m kh\xF4ng gian \u0111\u1EC3 xem l\u1EF1c h\u1EA5p d\u1EABn \u0111i\u1EC1u khi\u1EC3n qu\u1EF9 \u0111\u1EA1o v\xE0 v\u1EADn t\u1ED1c.",
81
+ simUrl: "https://phet.colorado.edu/sims/html/gravity-and-orbits/latest/gravity-and-orbits_all.html",
82
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/gravity-and-orbits/latest/gravity-and-orbits-600.png",
83
+ subject: "physics",
84
+ targetLevel: "lower_secondary",
85
+ keywords: ["gravity", "tr\u1ECDng l\u1EF1c", "l\u1EF1c h\u1EA5p d\u1EABn", "qu\u1EF9 \u0111\u1EA1o", "orbit", "nasa", "kh\xF4ng gian", "space", "v\u1EC7 tinh", "satellite", "earth", "moon"]
86
+ },
87
+ {
88
+ id: "phet-projectile-motion",
89
+ titleEn: "Projectile Motion",
90
+ titleVi: "Chuy\u1EC3n \u0110\u1ED9ng N\xE9m Ngang & N\xE9m Xi\xEAn",
91
+ descriptionEn: "Blast cannonballs, baseballs, or pianos. Adjust launch angle, initial speed, mass, and air resistance to hit targets.",
92
+ descriptionVi: "B\u1EAFn \u0111\u1EA1i b\xE1c, b\xF3ng ch\xE0y ho\u1EB7c \u0111\xE0n piano. \u0110i\u1EC1u ch\u1EC9nh g\xF3c b\u1EAFn, v\u1EADn t\u1ED1c \u0111\u1EA7u v\xE0 l\u1EF1c c\u1EA3n kh\xF4ng kh\xED. C\u1EF1c k\u1EF3 h\u1EEFu \xEDch cho l\u1EADp tr\xECnh game v\u1EADt l\xFD.",
93
+ simUrl: "https://phet.colorado.edu/sims/html/projectile-motion/latest/projectile-motion_all.html",
94
+ thumbnailUrl: "https://phet.colorado.edu/sims/html/projectile-motion/latest/projectile-motion-600.png",
95
+ subject: "physics",
96
+ targetLevel: "upper_secondary",
97
+ keywords: ["projectile", "n\xE9m xi\xEAn", "qu\u1EF9 \u0111\u1EA1o", "trajectory", "game physics", "v\u1EADt l\xFD tr\xF2 ch\u01A1i", "v\u1EADn t\u1ED1c", "g\xF3c b\u1EAFn"]
98
+ }
99
+ ];
100
+ var OpenverseClient = class {
101
+ baseUrl = "https://api.openverse.org/v1";
102
+ async searchImages(query, options = {}) {
103
+ try {
104
+ const limit = Math.min(options.limit ?? 5, 20);
105
+ const params = new URLSearchParams({
106
+ q: query,
107
+ page_size: String(limit)
108
+ });
109
+ if (options.license) {
110
+ params.set("license", options.license);
111
+ }
112
+ const res = await fetch(`${this.baseUrl}/images/?${params.toString()}`, {
113
+ headers: {
114
+ "User-Agent": "CurriculumStudio-ResearchKit/1.2.2",
115
+ Accept: "application/json"
116
+ },
117
+ signal: AbortSignal.timeout(8e3)
118
+ });
119
+ if (!res.ok) return [];
120
+ const data = await res.json();
121
+ const results = Array.isArray(data?.results) ? data.results : [];
122
+ return results.map((item) => {
123
+ const licenseType = (item.license || "CC").toUpperCase();
124
+ const licenseVer = item.license_version ? ` ${item.license_version}` : "";
125
+ const creator = item.creator ? ` b\u1EDFi ${item.creator}` : "";
126
+ return {
127
+ id: `openverse-${item.id}`,
128
+ title: item.title || `H\xECnh \u1EA3nh minh h\u1ECDa: ${query}`,
129
+ url: item.foreign_landing_url || item.url,
130
+ description: `H\xECnh \u1EA3nh gi\u1EA5y ph\xE9p m\u1EDF (${licenseType}${licenseVer})${creator} t\u1EEB ngu\u1ED3n ${item.source || item.provider || "Openverse"}.`,
131
+ type: "media_image",
132
+ provider: "openverse",
133
+ thumbnailUrl: item.thumbnail || item.url,
134
+ mediaType: "image",
135
+ license: {
136
+ type: `${licenseType}${licenseVer}`,
137
+ attributionText: `\u1EA2nh: "${item.title || query}"${creator} (${licenseType}${licenseVer}) via Openverse.`,
138
+ url: item.license_url,
139
+ commercialUseAllowed: !licenseType.includes("NC")
140
+ },
141
+ subject: "general_stem",
142
+ targetLevel: "all",
143
+ tags: Array.isArray(item.tags) ? item.tags.slice(0, 5).map((t) => t.name || String(t)) : [query],
144
+ relevanceScore: 8.5
145
+ };
146
+ });
147
+ } catch (e) {
148
+ console.warn("[OpenverseClient] Kh\xF4ng th\u1EC3 t\xECm ki\u1EBFm media Openverse:", e?.message || e);
149
+ return [];
150
+ }
151
+ }
152
+ };
153
+ var NasaMediaClient = class {
154
+ baseUrl = "https://images-api.nasa.gov";
155
+ async search(query, options = {}) {
156
+ try {
157
+ const limit = Math.min(options.limit ?? 5, 20);
158
+ const mediaType = options.mediaType || "image";
159
+ const params = new URLSearchParams({
160
+ q: query,
161
+ media_type: mediaType,
162
+ page_size: String(limit)
163
+ });
164
+ const res = await fetch(`${this.baseUrl}/search?${params.toString()}`, {
165
+ headers: {
166
+ "User-Agent": "CurriculumStudio-ResearchKit/1.2.2",
167
+ Accept: "application/json"
168
+ },
169
+ signal: AbortSignal.timeout(8e3)
170
+ });
171
+ if (!res.ok) return [];
172
+ const data = await res.json();
173
+ const items = Array.isArray(data?.collection?.items) ? data.collection.items : [];
174
+ return items.slice(0, limit).map((item) => {
175
+ const meta = Array.isArray(item.data) && item.data[0] ? item.data[0] : {};
176
+ const link = Array.isArray(item.links) && item.links[0] ? item.links[0] : {};
177
+ const title = meta.title || `NASA Media: ${query}`;
178
+ const desc = (meta.description || meta.caption || "").slice(0, 220);
179
+ const nasaId = meta.nasa_id || item.href;
180
+ const actualMediaType = meta.media_type === "video" ? "video" : "image";
181
+ return {
182
+ id: `nasa-${nasaId}`,
183
+ title,
184
+ url: `https://images.nasa.gov/details/${encodeURIComponent(nasaId)}`,
185
+ description: desc || `T\u01B0 li\u1EC7u khoa h\u1ECDc v\u0169 tr\u1EE5, v\u1EC7 tinh v\xE0 k\u1EF9 thu\u1EADt kh\xF4ng gian t\u1EEB NASA.`,
186
+ type: actualMediaType === "video" ? "media_video" : "media_image",
187
+ provider: "nasa",
188
+ thumbnailUrl: link.href,
189
+ mediaType: actualMediaType,
190
+ license: {
191
+ type: "Public Domain (NASA Media Guidelines)",
192
+ attributionText: `T\u01B0 li\u1EC7u khoa h\u1ECDc t\u1EEB NASA (ID: ${nasaId}). S\u1EED d\u1EE5ng t\u1EF1 do cho m\u1EE5c \u0111\xEDch gi\xE1o d\u1EE5c.`,
193
+ url: "https://www.nasa.gov/multimedia/guidelines/index.html",
194
+ commercialUseAllowed: true
195
+ },
196
+ subject: "physics",
197
+ targetLevel: "all",
198
+ tags: Array.isArray(meta.keywords) ? meta.keywords.slice(0, 5) : ["nasa", "space", "stem"],
199
+ relevanceScore: 9
200
+ };
201
+ });
202
+ } catch (e) {
203
+ console.warn("[NasaMediaClient] L\u1ED7i t\xECm ki\u1EBFm NASA media:", e?.message || e);
204
+ return [];
205
+ }
206
+ }
207
+ };
208
+ var GitHubCurriculumClient = class {
209
+ baseUrl = "https://api.github.com";
210
+ async searchCurricula(query, options = {}) {
211
+ try {
212
+ const limit = Math.min(options.limit ?? 5, 10);
213
+ const q = `${query} curriculum in:name,description,topics`;
214
+ const params = new URLSearchParams({
215
+ q,
216
+ sort: "stars",
217
+ order: "desc",
218
+ per_page: String(limit)
219
+ });
220
+ const headers = {
221
+ "User-Agent": "CurriculumStudio-ResearchKit/1.2.2",
222
+ Accept: "application/vnd.github.v3+json"
223
+ };
224
+ if (options.token || process.env.GITHUB_TOKEN) {
225
+ headers["Authorization"] = `token ${options.token || process.env.GITHUB_TOKEN}`;
226
+ }
227
+ const res = await fetch(`${this.baseUrl}/search/repositories?${params.toString()}`, {
228
+ headers,
229
+ signal: AbortSignal.timeout(8e3)
230
+ });
231
+ if (!res.ok) return [];
232
+ const data = await res.json();
233
+ const items = Array.isArray(data?.items) ? data.items : [];
234
+ return items.map((repo) => {
235
+ const licenseName = repo.license?.name || repo.license?.spdx_id || "Open Source";
236
+ return {
237
+ id: `github-${repo.id}`,
238
+ title: `${repo.name} (${repo.stargazers_count.toLocaleString()} \u2B50)`,
239
+ url: repo.html_url,
240
+ description: repo.description || `Gi\xE1o tr\xECnh v\xE0 m\xE3 ngu\u1ED3n m\u1EDF tr\xEAn GitHub b\u1EDFi ${repo.owner?.login}.`,
241
+ type: "curriculum",
242
+ provider: "github",
243
+ mediaType: "code",
244
+ license: {
245
+ type: licenseName,
246
+ attributionText: `Gi\xE1o tr\xECnh m\u1EDF t\u1EEB repo "${repo.full_name}" tr\xEAn GitHub (${licenseName}).`,
247
+ url: repo.license?.url || repo.html_url,
248
+ commercialUseAllowed: !licenseName.toLowerCase().includes("non-commercial")
249
+ },
250
+ subject: "computer_science",
251
+ targetLevel: "upper_secondary",
252
+ tags: Array.isArray(repo.topics) ? repo.topics.slice(0, 5) : ["curriculum", "education", "programming"],
253
+ relevanceScore: Math.min(10, 7 + Math.log10(Math.max(1, repo.stargazers_count)) * 0.7)
254
+ };
255
+ });
256
+ } catch (e) {
257
+ console.warn("[GitHubCurriculumClient] L\u1ED7i t\xECm ki\u1EBFm GitHub curriculum:", e?.message || e);
258
+ return [];
259
+ }
260
+ }
261
+ };
262
+ var CURATED_OER_PROGRAMS = [
263
+ {
264
+ id: "cs-unplugged-algorithms",
265
+ title: "CS Unplugged: H\u1ECDc Khoa H\u1ECDc M\xE1y T\xEDnh Kh\xF4ng C\u1EA7n M\xE1y T\xEDnh",
266
+ url: "https://www.csunplugged.org/en/",
267
+ description: "B\u1ED9 ho\u1EA1t \u0111\u1ED9ng offline gi\u1EA3ng d\u1EA1y thu\u1EADt to\xE1n, h\u1EC7 nh\u1ECB ph\xE2n, c\u1EA5u tr\xFAc d\u1EEF li\u1EC7u qua tr\xF2 ch\u01A1i \u0111\xF3ng vai, x\u1EBFp h\xECnh v\xE0 b\xE0i t\u1EADp nh\xF3m.",
268
+ type: "hands_on_lab",
269
+ provider: "cs_unplugged",
270
+ subject: "computer_science",
271
+ targetLevel: "primary",
272
+ keywords: ["unplugged", "kh\xF4ng d\xF9ng m\xE1y", "thu\u1EADt to\xE1n", "nh\u1ECB ph\xE2n", "binary", "sorting", "s\u1EAFp x\u1EBFp", "tr\u1EBB em", "kids", "logic"],
273
+ licenseType: "Creative Commons CC BY-NC-SA 4.0"
274
+ },
275
+ {
276
+ id: "scratch-mit-studio",
277
+ title: "Scratch MIT: M\xF4i Tr\u01B0\u1EDDng L\u1EADp Tr\xECnh Kh\u1ED1i & S\xE1ng T\u1EA1o Tr\u1EF1c Quan",
278
+ url: "https://scratch.mit.edu/",
279
+ description: "N\u1EC1n t\u1EA3ng l\u1EADp tr\xECnh kh\u1ED1i do MIT Media Lab ph\xE1t tri\u1EC3n, th\xEDch h\u1EE3p l\xE0m quen v\u1EDBi t\u01B0 duy bi\u1EBFn s\u1ED1, r\u1EBD nh\xE1nh, v\xF2ng l\u1EB7p v\xE0 s\u1EF1 ki\u1EC7n \xE2m thanh/h\xECnh \u1EA3nh.",
280
+ type: "curriculum",
281
+ provider: "scratch",
282
+ subject: "computer_science",
283
+ targetLevel: "primary",
284
+ keywords: ["scratch", "blockly", "l\u1EADp tr\xECnh kh\u1ED1i", "k\xE9o th\u1EA3", "game 2d", "ho\u1EA1t h\xECnh", "tr\u1EBB em", "mit scratch"],
285
+ licenseType: "Free & Open Educational Platform"
286
+ },
287
+ {
288
+ id: "freecodecamp-responsive-web",
289
+ title: "freeCodeCamp: L\u1ED9 Tr\xECnh L\u1EADp Tr\xECnh D\u1EF1 \xC1n Th\u1EF1c Chi\u1EBFn Mi\u1EC5n Ph\xED",
290
+ url: "https://www.freecodecamp.org/learn",
291
+ description: "H\xE0ng ng\xE0n gi\u1EDD b\xE0i h\u1ECDc t\u01B0\u01A1ng t\xE1c t\u1EEB c\u01A1 b\u1EA3n \u0111\u1EBFn n\xE2ng cao: HTML/CSS, JavaScript, Python, C\u1EA5u tr\xFAc d\u1EEF li\u1EC7u v\xE0 AI.",
292
+ type: "curriculum",
293
+ provider: "web",
294
+ subject: "computer_science",
295
+ targetLevel: "upper_secondary",
296
+ keywords: ["freecodecamp", "web", "javascript", "python", "html", "css", "l\u1EADp tr\xECnh web", "ch\u1EE9ng ch\u1EC9 mi\u1EC5n ph\xED"],
297
+ licenseType: "Creative Commons CC BY-SA 4.0 / Open Source"
298
+ },
299
+ {
300
+ id: "the-odin-project-fullstack",
301
+ title: "The Odin Project: L\u1ED9 Tr\xECnh Full-Stack Web Open Source",
302
+ url: "https://www.theodinproject.com/",
303
+ description: "Curriculum h\u1ECDc ph\xE1t tri\u1EC3n web b\xE0i b\u1EA3n theo chu\u1EA9n c\xF4ng nghi\u1EC7p: Git, CLI, HTML/CSS, JavaScript hi\u1EC7n \u0111\u1EA1i, Node.js v\xE0 React.",
304
+ type: "curriculum",
305
+ provider: "web",
306
+ subject: "computer_science",
307
+ targetLevel: "developer",
308
+ keywords: ["odin project", "fullstack", "git", "github", "frontend", "backend", "react", "web developer"],
309
+ licenseType: "Open Source Curriculum"
310
+ },
311
+ {
312
+ id: "openstax-physics-volume-1",
313
+ title: "OpenStax: S\xE1ch Gi\xE1o Tr\xECnh V\u1EADt L\xFD \u0110\u1EA1i H\u1ECDc & Ph\u1ED5 Th\xF4ng M\u1EDF",
314
+ url: "https://openstax.org/subjects/science",
315
+ description: "S\xE1ch gi\xE1o khoa s\u1ED1 chu\u1EA9n h\u1ECDc thu\u1EADt \u0111\u01B0\u1EE3c b\xECnh duy\u1EC7t \u0111\u1ED9c l\u1EADp, bao g\u1ED3m C\u01A1 h\u1ECDc, S\xF3ng, \u0110i\u1EC7n t\u1EEB h\u1ECDc v\xE0 Quang h\u1ECDc.",
316
+ type: "textbook",
317
+ provider: "openstax",
318
+ subject: "physics",
319
+ targetLevel: "upper_secondary",
320
+ keywords: ["openstax", "gi\xE1o tr\xECnh", "s\xE1ch gi\xE1o khoa", "v\u1EADt l\xFD", "physics", "c\u01A1 h\u1ECDc", "\u0111i\u1EC7n t\u1EEB", "s\xE1ch m\u1EDF"],
321
+ licenseType: "Creative Commons CC BY 4.0"
322
+ },
323
+ {
324
+ id: "exercism-coding-practice",
325
+ title: "Exercism: Luy\u1EC7n T\u1EADp T\u01B0 Duy Thu\u1EADt To\xE1n & Code Review \u0110a Ng\xF4n Ng\u1EEF",
326
+ url: "https://exercism.org/",
327
+ description: "H\u01A1n 70 ng\xF4n ng\u1EEF l\u1EADp tr\xECnh (Python, C++, Rust, Swift, JavaScript) v\u1EDBi l\u1ED9 tr\xECnh b\xE0i t\u1EADp r\xE8n luy\u1EC7n c\xFA ph\xE1p v\xE0 phong c\xE1ch m\xE3 ngu\u1ED3n chu\u1EA9n.",
328
+ type: "problem_set",
329
+ provider: "exercism",
330
+ subject: "computer_science",
331
+ targetLevel: "developer",
332
+ keywords: ["exercism", "thu\u1EADt to\xE1n", "luy\u1EC7n code", "b\xE0i t\u1EADp l\u1EADp tr\xECnh", "c++", "python", "swift", "clean code"],
333
+ licenseType: "Open Source & Free Non-profit Education"
334
+ }
335
+ ];
336
+ var StemResourceResearcher = class {
337
+ openverse = new OpenverseClient();
338
+ nasa = new NasaMediaClient();
339
+ github = new GitHubCurriculumClient();
340
+ async findResources(query, options = {}) {
341
+ const limit = options.limit ?? 10;
342
+ const rawTypes = options.types && options.types.length > 0 ? options.types : ["simulation", "curriculum", "media_image", "media_video", "hands_on_lab", "textbook", "problem_set"];
343
+ const requestedTypes = /* @__PURE__ */ new Set();
344
+ for (const t of rawTypes) {
345
+ if (t === "interactive") {
346
+ requestedTypes.add("simulation");
347
+ requestedTypes.add("hands_on_lab");
348
+ } else if (t === "open_media") {
349
+ requestedTypes.add("media_image");
350
+ requestedTypes.add("media_video");
351
+ } else {
352
+ requestedTypes.add(t);
353
+ }
354
+ }
355
+ const lowerQuery = query.toLowerCase();
356
+ const queryTokens = lowerQuery.split(/\s+/).filter((t) => t.length > 1);
357
+ const matches = [];
358
+ if (requestedTypes.has("simulation")) {
359
+ for (const sim of PHET_SIMULATIONS) {
360
+ let score = 0;
361
+ for (const token of queryTokens) {
362
+ if (sim.keywords.some((k) => k.toLowerCase().includes(token))) score += 2;
363
+ if (sim.titleEn.toLowerCase().includes(token) || sim.titleVi.toLowerCase().includes(token)) score += 3;
364
+ if (sim.descriptionEn.toLowerCase().includes(token) || sim.descriptionVi.toLowerCase().includes(token)) score += 1;
365
+ }
366
+ if (score > 0) {
367
+ matches.push({
368
+ id: sim.id,
369
+ title: `${sim.titleVi} (${sim.titleEn})`,
370
+ url: sim.simUrl,
371
+ description: sim.descriptionVi,
372
+ type: "simulation",
373
+ provider: "phet",
374
+ thumbnailUrl: sim.thumbnailUrl,
375
+ embedUrl: sim.simUrl,
376
+ mediaType: "interactive",
377
+ license: {
378
+ type: "Creative Commons CC BY 4.0",
379
+ attributionText: `M\xF4 ph\u1ECFng PhET Interactive Simulations, University of Colorado Boulder (https://phet.colorado.edu). CC BY 4.0.`,
380
+ url: "https://phet.colorado.edu/en/licensing",
381
+ commercialUseAllowed: true
382
+ },
383
+ subject: sim.subject,
384
+ targetLevel: sim.targetLevel,
385
+ tags: ["phet", "simulation", sim.subject, ...sim.keywords.slice(0, 3)],
386
+ relevanceScore: Math.min(10, 7.5 + score * 0.4)
387
+ });
388
+ }
389
+ }
390
+ }
391
+ for (const prog of CURATED_OER_PROGRAMS) {
392
+ if (!requestedTypes.has(prog.type)) continue;
393
+ let score = 0;
394
+ for (const token of queryTokens) {
395
+ if (prog.keywords.some((k) => k.toLowerCase().includes(token))) score += 2;
396
+ if (prog.title.toLowerCase().includes(token)) score += 3;
397
+ if (prog.description.toLowerCase().includes(token)) score += 1;
398
+ }
399
+ if (score > 0) {
400
+ matches.push({
401
+ id: prog.id,
402
+ title: prog.title,
403
+ url: prog.url,
404
+ description: prog.description,
405
+ type: prog.type,
406
+ provider: prog.provider,
407
+ mediaType: prog.type === "hands_on_lab" || prog.type === "curriculum" ? "text" : "code",
408
+ license: {
409
+ type: prog.licenseType,
410
+ attributionText: `T\xE0i nguy\xEAn gi\xE1o d\u1EE5c m\u1EDF t\u1EEB ${prog.provider.toUpperCase()} (${prog.licenseType}).`,
411
+ commercialUseAllowed: !prog.licenseType.includes("NC")
412
+ },
413
+ subject: prog.subject,
414
+ targetLevel: prog.targetLevel,
415
+ tags: [prog.provider, prog.type, ...prog.keywords.slice(0, 3)],
416
+ relevanceScore: Math.min(10, 7 + score * 0.4)
417
+ });
418
+ }
419
+ }
420
+ const asyncTasks = [];
421
+ if (requestedTypes.has("media_image")) {
422
+ asyncTasks.push(this.openverse.searchImages(query, { limit: 4 }));
423
+ }
424
+ if (requestedTypes.has("media_image") || requestedTypes.has("media_video")) {
425
+ const isSpaceOrPhysics = /(vũ trụ|space|physics|vật lý|quỹ đạo|orbit|sensor|cảm biến|robot|nasa|trọng lực|gravity|earth|solar)/i.test(query);
426
+ if (isSpaceOrPhysics) {
427
+ asyncTasks.push(this.nasa.search(query, { limit: 3 }));
428
+ }
429
+ }
430
+ if (requestedTypes.has("curriculum")) {
431
+ asyncTasks.push(this.github.searchCurricula(query, { limit: 3, token: options.githubToken }));
432
+ }
433
+ const asyncResults = await Promise.allSettled(asyncTasks);
434
+ for (const r of asyncResults) {
435
+ if (r.status === "fulfilled" && Array.isArray(r.value)) {
436
+ matches.push(...r.value);
437
+ }
438
+ }
439
+ let filtered = matches;
440
+ if (options.licenseFilter === "creative_commons") {
441
+ filtered = filtered.filter((item) => /cc\s*by|creative\s*commons|cc0/i.test(item.license.type));
442
+ } else if (options.licenseFilter === "public_domain") {
443
+ filtered = filtered.filter((item) => /public\s*domain|cc0/i.test(item.license.type));
444
+ }
445
+ const seen = /* @__PURE__ */ new Set();
446
+ const deduped = [];
447
+ for (const item of filtered) {
448
+ const key = item.url || item.id;
449
+ if (seen.has(key)) continue;
450
+ seen.add(key);
451
+ deduped.push(item);
452
+ }
453
+ deduped.sort((a, b) => b.relevanceScore - a.relevanceScore);
454
+ const topResults = deduped.slice(0, limit);
455
+ const categoryCounts = {
456
+ simulation: 0,
457
+ curriculum: 0,
458
+ media_image: 0,
459
+ media_video: 0,
460
+ hands_on_lab: 0,
461
+ textbook: 0,
462
+ problem_set: 0
463
+ };
464
+ for (const item of topResults) {
465
+ if (categoryCounts[item.type] !== void 0) {
466
+ categoryCounts[item.type]++;
467
+ }
468
+ }
469
+ const markdownSummary = this.generateMarkdownSummary(query, topResults);
470
+ return {
471
+ query,
472
+ totalFound: topResults.length,
473
+ categoryCounts,
474
+ resources: topResults,
475
+ items: topResults,
476
+ markdownSummary,
477
+ markdownReport: markdownSummary
478
+ };
479
+ }
480
+ async searchAndCatalog(query, options = {}) {
481
+ return this.findResources(query, options);
482
+ }
483
+ generateMarkdown(catalog) {
484
+ return catalog.markdownSummary;
485
+ }
486
+ generateMarkdownSummary(query, items) {
487
+ if (items.length === 0) {
488
+ return `Kh\xF4ng t\xECm th\u1EA5y t\xE0i nguy\xEAn gi\xE1o d\u1EE5c m\u1EDF ph\xF9 h\u1EE3p cho ch\u1EE7 \u0111\u1EC1: "${query}".`;
489
+ }
490
+ const sections = [`### \u{1F52C} Danh m\u1EE5c T\xE0i nguy\xEAn STEM & L\u1EADp tr\xECnh cho "${query}"
491
+ `];
492
+ const typeLabels = {
493
+ simulation: "\u{1F3AE} M\xF4 ph\u1ECFng T\u01B0\u01A1ng t\xE1c (PhET / Labs)",
494
+ curriculum: "\u{1F4DA} Gi\xE1o tr\xECnh & L\u1ED9 tr\xECnh M\u1EDF",
495
+ media_image: "\u{1F5BC}\uFE0F H\xECnh \u1EA3nh & S\u01A1 \u0111\u1ED3 Gi\u1EA5y ph\xE9p M\u1EDF (CC / Public Domain)",
496
+ media_video: "\u{1F3AC} Video & T\u01B0 li\u1EC7u Khoa h\u1ECDc",
497
+ hands_on_lab: "\u{1F9EA} Ho\u1EA1t \u0111\u1ED9ng Th\u1EF1c h\xE0nh & Kh\xE1m ph\xE1 (Hands-on)",
498
+ textbook: "\u{1F4D6} S\xE1ch Gi\xE1o tr\xECnh M\u1EDF (OpenStax / OER)",
499
+ problem_set: "\u{1F4A1} B\xE0i t\u1EADp & Th\u1EED th\xE1ch L\u1EADp tr\xECnh"
500
+ };
501
+ const grouped = {};
502
+ for (const it of items) {
503
+ if (!grouped[it.type]) grouped[it.type] = [];
504
+ grouped[it.type].push(it);
505
+ }
506
+ for (const [type, groupItems] of Object.entries(grouped)) {
507
+ sections.push(`#### ${typeLabels[type] || type}`);
508
+ for (const it of groupItems) {
509
+ it.thumbnailUrl ? `![preview](${it.thumbnailUrl})
510
+ ` : "";
511
+ const embed = it.embedUrl ? `> \u{1F517} **T\u01B0\u01A1ng t\xE1c tr\u1EF1c ti\u1EBFp**: [M\u1EDF Simulation To\xE0n m\xE0n h\xECnh](${it.embedUrl})
512
+ ` : "";
513
+ sections.push(
514
+ `- **[${it.title}](${it.url})** \u2014 *${it.provider.toUpperCase()}* (${it.license.type})
515
+ ${it.description}
516
+ ${embed} *Tr\xEDch d\u1EABn b\u1EA3n quy\u1EC1n*: \`${it.license.attributionText}\``
517
+ );
518
+ }
519
+ sections.push("");
520
+ }
521
+ return sections.join("\n");
522
+ }
523
+ };
524
+
525
+ export { GitHubCurriculumClient, NasaMediaClient, OpenverseClient, StemResourceResearcher };
526
+ //# sourceMappingURL=chunk-YICMTZS5.js.map
527
+ //# sourceMappingURL=chunk-YICMTZS5.js.map