@scrabble-solver/scrabble-solver 2.8.2 → 2.8.4
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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +10 -10
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/206.js +98 -97
- package/.next/server/chunks/413.js +396 -677
- package/.next/server/chunks/515.js +546 -550
- package/.next/server/chunks/907.js +399 -681
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +5 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/pages/_app.js +7 -10
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js +0 -3
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +114 -171
- package/.next/server/pages/api/solve.js +426 -1206
- package/.next/server/pages/index.html +17 -1
- package/.next/server/pages/index.js +7 -14
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/static/-UOLkxdxU0PlKbXa09-xO/_buildManifest.js +1 -0
- package/.next/static/{nXSSCVI5pGlS_NxEidxkS → -UOLkxdxU0PlKbXa09-xO}/_ssgManifest.js +0 -0
- package/.next/static/chunks/56-2d34867599a0ac66.js +1 -0
- package/.next/static/chunks/pages/{404-02d949d2fe59e960.js → 404-30c06e61d256c5b2.js} +1 -1
- package/.next/static/chunks/pages/_app-6ffa2ab900772b67.js +1 -0
- package/.next/static/chunks/pages/{index-75517525489ab316.js → index-13ea7770a65c69ee.js} +1 -1
- package/.next/static/css/{d676d43c6b9c9a57.css → 551d09cac435debb.css} +1 -1
- package/.next/static/css/{6a9e5ba3f77c27f2.css → cdbc9e0afcff5473.css} +1 -1
- package/.next/trace +42 -42
- package/package.json +14 -14
- package/src/components/Board/Board.tsx +1 -1
- package/src/components/Board/BoardPure.tsx +1 -1
- package/src/components/Board/components/Cell/Button.tsx +1 -1
- package/src/components/Board/components/Cell/Cell.tsx +1 -1
- package/src/components/Board/components/Cell/CellPure.tsx +1 -1
- package/src/components/Board/hooks/useGrid.ts +9 -0
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/Dictionary/Dictionary.tsx +1 -1
- package/src/components/DictionaryInput/DictionaryInput.tsx +1 -1
- package/src/components/EmptyState/EmptyState.tsx +1 -1
- package/src/components/Key/Key.tsx +1 -1
- package/src/components/KeyMap/KeyMap.tsx +2 -2
- package/src/components/KeyMap/components/Mapping/Mapping.module.scss +4 -0
- package/src/components/KeyMap/components/Mapping/Mapping.tsx +16 -12
- package/src/components/Loading/Loading.tsx +1 -1
- package/src/components/Logo/Logo.tsx +1 -1
- package/src/components/NavButtons/NavButtons.tsx +1 -1
- package/src/components/NotFound/NotFound.tsx +1 -1
- package/src/components/PlainTiles/PlainTiles.tsx +5 -1
- package/src/components/PlainTiles/Tile.tsx +1 -1
- package/src/components/Rack/Rack.tsx +1 -1
- package/src/components/Rack/RackTile.tsx +1 -1
- package/src/components/Radio/Radio.tsx +1 -1
- package/src/components/RemainingTiles/Character.tsx +1 -1
- package/src/components/RemainingTiles/RemainingTiles.tsx +1 -1
- package/src/components/Results/Cell.tsx +1 -1
- package/src/components/Results/HeaderButton.tsx +1 -1
- package/src/components/Results/Result.tsx +1 -1
- package/src/components/Results/Results.tsx +1 -1
- package/src/components/Results/SolveButton.tsx +1 -1
- package/src/components/ResultsInput/ResultsInput.tsx +1 -1
- package/src/components/Screen/Screen.tsx +1 -1
- package/src/components/Settings/Settings.tsx +1 -1
- package/src/components/Settings/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -1
- package/src/components/Settings/components/ConfigSetting/ConfigSetting.tsx +1 -1
- package/src/components/Settings/components/LocaleSetting/LocaleSetting.tsx +1 -1
- package/src/components/Sidebar/Sidebar.tsx +1 -1
- package/src/components/Sidebar/components/Section/Section.tsx +1 -1
- package/src/components/Splash/Splash.tsx +1 -1
- package/src/components/SquareButton/Link.tsx +1 -1
- package/src/components/SquareButton/SquareButton.tsx +1 -1
- package/src/components/SvgFontCss/SvgFontCss.tsx +12 -0
- package/src/components/SvgFontCss/index.ts +1 -0
- package/src/components/Tile/Tile.tsx +1 -1
- package/src/components/Tile/TilePure.tsx +2 -2
- package/src/components/Tooltip/useTooltip.tsx +1 -1
- package/src/components/Well/Well.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/hooks/usePortal.tsx +19 -9
- package/src/lib/createKeyboardNavigation.ts +3 -0
- package/src/lib/memoize.ts +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/pages/_document.tsx +1 -1
- package/src/pages/index.tsx +6 -15
- package/src/styles/global.scss +3 -0
- package/.next/static/chunks/195-fcadef5c6eed8338.js +0 -1
- package/.next/static/chunks/pages/_app-f4030148d742bcd2.js +0 -1
- package/.next/static/nXSSCVI5pGlS_NxEidxkS/_buildManifest.js +0 -1
|
@@ -164,23 +164,22 @@ const parseRequest = (request)=>{
|
|
|
164
164
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
165
165
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
166
166
|
};
|
|
167
|
-
var _a;
|
|
168
167
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
168
|
+
const types_1 = __webpack_require__(46452);
|
|
169
|
+
const crawlEnglish_1 = __importDefault(__webpack_require__(90357));
|
|
170
|
+
const crawlFrench_1 = __importDefault(__webpack_require__(93174));
|
|
171
|
+
const crawlGerman_1 = __importDefault(__webpack_require__(69047));
|
|
172
|
+
const crawlPolish_1 = __importDefault(__webpack_require__(18698));
|
|
173
|
+
const crawlSpanish_1 = __importDefault(__webpack_require__(82360));
|
|
174
|
+
const crawlPerLocale = {
|
|
175
|
+
[types_1.Locale.DE_DE]: crawlGerman_1.default,
|
|
176
|
+
[types_1.Locale.EN_GB]: crawlEnglish_1.default,
|
|
177
|
+
[types_1.Locale.EN_US]: crawlEnglish_1.default,
|
|
178
|
+
[types_1.Locale.ES_ES]: crawlSpanish_1.default,
|
|
179
|
+
[types_1.Locale.FR_FR]: crawlFrench_1.default,
|
|
180
|
+
[types_1.Locale.PL_PL]: crawlPolish_1.default,
|
|
181
|
+
};
|
|
182
|
+
const crawl = (locale, word) => {
|
|
184
183
|
return crawlPerLocale[locale](word);
|
|
185
184
|
};
|
|
186
185
|
exports["default"] = crawl;
|
|
@@ -193,12 +192,12 @@ exports["default"] = crawl;
|
|
|
193
192
|
|
|
194
193
|
|
|
195
194
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
const lib_1 = __webpack_require__(3805);
|
|
196
|
+
const crawlEnglish = (word) => {
|
|
198
197
|
return (0, lib_1.request)({
|
|
199
198
|
protocol: 'https',
|
|
200
199
|
hostname: 'www.merriam-webster.com',
|
|
201
|
-
path:
|
|
200
|
+
path: `/dictionary/${encodeURIComponent(word)}`,
|
|
202
201
|
});
|
|
203
202
|
};
|
|
204
203
|
exports["default"] = crawlEnglish;
|
|
@@ -211,12 +210,12 @@ exports["default"] = crawlEnglish;
|
|
|
211
210
|
|
|
212
211
|
|
|
213
212
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
const lib_1 = __webpack_require__(3805);
|
|
214
|
+
const crawlFrench = (word) => {
|
|
216
215
|
return (0, lib_1.request)({
|
|
217
216
|
protocol: 'https',
|
|
218
217
|
hostname: 'www.cnrtl.fr',
|
|
219
|
-
path:
|
|
218
|
+
path: `/definition/${encodeURIComponent(word)}`,
|
|
220
219
|
});
|
|
221
220
|
};
|
|
222
221
|
exports["default"] = crawlFrench;
|
|
@@ -229,12 +228,12 @@ exports["default"] = crawlFrench;
|
|
|
229
228
|
|
|
230
229
|
|
|
231
230
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
const lib_1 = __webpack_require__(3805);
|
|
232
|
+
const crawlGerman = (word) => {
|
|
234
233
|
return (0, lib_1.request)({
|
|
235
234
|
protocol: 'https',
|
|
236
235
|
hostname: 'www.dwds.de',
|
|
237
|
-
path:
|
|
236
|
+
path: `?q=${encodeURIComponent(word)}&from=wb`,
|
|
238
237
|
});
|
|
239
238
|
};
|
|
240
239
|
exports["default"] = crawlGerman;
|
|
@@ -247,12 +246,12 @@ exports["default"] = crawlGerman;
|
|
|
247
246
|
|
|
248
247
|
|
|
249
248
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
const lib_1 = __webpack_require__(3805);
|
|
250
|
+
const crawlPolish = (word) => {
|
|
252
251
|
return (0, lib_1.request)({
|
|
253
252
|
protocol: 'https',
|
|
254
253
|
hostname: 'sjp.pl',
|
|
255
|
-
path:
|
|
254
|
+
path: `/${encodeURIComponent(word)}`,
|
|
256
255
|
});
|
|
257
256
|
};
|
|
258
257
|
exports["default"] = crawlPolish;
|
|
@@ -265,12 +264,12 @@ exports["default"] = crawlPolish;
|
|
|
265
264
|
|
|
266
265
|
|
|
267
266
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
const lib_1 = __webpack_require__(3805);
|
|
268
|
+
const crawlSpanish = (word) => {
|
|
270
269
|
return (0, lib_1.request)({
|
|
271
270
|
protocol: 'https',
|
|
272
271
|
hostname: 'www.diccionarios.com',
|
|
273
|
-
path:
|
|
272
|
+
path: `/diccionario/espanol/${encodeURIComponent(word)}`,
|
|
274
273
|
});
|
|
275
274
|
};
|
|
276
275
|
exports["default"] = crawlSpanish;
|
|
@@ -304,62 +303,19 @@ Object.defineProperty(exports, "crawlGerman", ({ enumerable: true, get: function
|
|
|
304
303
|
/***/ }),
|
|
305
304
|
|
|
306
305
|
/***/ 41568:
|
|
307
|
-
/***/ (
|
|
306
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
308
307
|
|
|
309
308
|
|
|
310
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
311
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
312
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
313
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
314
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
315
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
316
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
317
|
-
});
|
|
318
|
-
};
|
|
319
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
320
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
321
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
322
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
323
|
-
function step(op) {
|
|
324
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
325
|
-
while (_) try {
|
|
326
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
327
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
328
|
-
switch (op[0]) {
|
|
329
|
-
case 0: case 1: t = op; break;
|
|
330
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
331
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
332
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
333
|
-
default:
|
|
334
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
335
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
336
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
337
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
338
|
-
if (t[2]) _.ops.pop();
|
|
339
|
-
_.trys.pop(); continue;
|
|
340
|
-
}
|
|
341
|
-
op = body.call(thisArg, _);
|
|
342
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
343
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
309
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
html = _b.sent();
|
|
357
|
-
_a = (0, parse_1.parse)(locale, html), definitions = _a.definitions, isAllowed = _a.isAllowed;
|
|
358
|
-
wordDefinition = new types_1.WordDefinition({ definitions: definitions, isAllowed: isAllowed, word: word });
|
|
359
|
-
return [2 /*return*/, wordDefinition];
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
}); };
|
|
310
|
+
const types_1 = __webpack_require__(46452);
|
|
311
|
+
const crawl_1 = __webpack_require__(66344);
|
|
312
|
+
const parse_1 = __webpack_require__(74630);
|
|
313
|
+
const getWordDefinition = async (locale, word) => {
|
|
314
|
+
const html = await (0, crawl_1.crawl)(locale, word);
|
|
315
|
+
const { definitions, isAllowed } = (0, parse_1.parse)(locale, html);
|
|
316
|
+
const wordDefinition = new types_1.WordDefinition({ definitions, isAllowed, word });
|
|
317
|
+
return wordDefinition;
|
|
318
|
+
};
|
|
363
319
|
exports["default"] = getWordDefinition;
|
|
364
320
|
|
|
365
321
|
|
|
@@ -424,25 +380,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
424
380
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
425
381
|
};
|
|
426
382
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
383
|
+
const striptags_1 = __importDefault(__webpack_require__(37983));
|
|
384
|
+
const EMPHASIS_TAGS = ['a', 'b', 'em', 'internalXref'];
|
|
385
|
+
const normalizeHtmlTags = (definition) => (0, striptags_1.default)((0, striptags_1.default)(definition, EMPHASIS_TAGS), undefined, '"');
|
|
386
|
+
const normalizeLineBreaks = (definition) => definition.replace(/[\r\n]/g, '');
|
|
387
|
+
const normalizeQuotes = (definition) => definition.replace(/\."/g, '".');
|
|
432
388
|
/**
|
|
433
389
|
* `(1.2) definition` -> `definition`
|
|
434
390
|
*/
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
391
|
+
const normalizeMarkers = (definition) => definition.replace(/^\(\d+\.\d+\)\s+/g, '');
|
|
392
|
+
const normalizeTrailingSymbols = (definition) => definition.trim().replace(/:$/, '');
|
|
393
|
+
const normalizeLeadingSymbols = (definition) => definition.trim().replace(/^:/, '');
|
|
394
|
+
const normalizeNonWords = (definition) => (/\w/.test(definition) ? definition : '');
|
|
395
|
+
const normalizeCommas = (definition) => {
|
|
440
396
|
return definition
|
|
441
397
|
.replace(/\s+,\s+/g, ', ')
|
|
442
398
|
.replace(/^,/, '')
|
|
443
399
|
.replace(/,$/, '');
|
|
444
400
|
};
|
|
445
|
-
|
|
401
|
+
const normalizers = [
|
|
446
402
|
normalizeHtmlTags,
|
|
447
403
|
normalizeMarkers,
|
|
448
404
|
normalizeQuotes,
|
|
@@ -451,11 +407,11 @@ var normalizers = [
|
|
|
451
407
|
normalizeLeadingSymbols,
|
|
452
408
|
normalizeNonWords,
|
|
453
409
|
normalizeCommas,
|
|
454
|
-
|
|
410
|
+
(definition) => definition.trim(),
|
|
455
411
|
];
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
412
|
+
const normalizeDefinition = (definition) => {
|
|
413
|
+
const normalized = normalizers.reduce((result, normalize) => normalize(result), definition);
|
|
414
|
+
const hasChanged = normalized !== definition;
|
|
459
415
|
return hasChanged ? normalizeDefinition(normalized) : normalized;
|
|
460
416
|
};
|
|
461
417
|
exports["default"] = normalizeDefinition;
|
|
@@ -464,34 +420,22 @@ exports["default"] = normalizeDefinition;
|
|
|
464
420
|
/***/ }),
|
|
465
421
|
|
|
466
422
|
/***/ 36:
|
|
467
|
-
/***/ (
|
|
423
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
468
424
|
|
|
469
425
|
|
|
470
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
471
|
-
var t = {};
|
|
472
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
473
|
-
t[p] = s[p];
|
|
474
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
475
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
476
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
477
|
-
t[p[i]] = s[p[i]];
|
|
478
|
-
}
|
|
479
|
-
return t;
|
|
480
|
-
};
|
|
481
426
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return new Promise(function (resolve, reject) {
|
|
427
|
+
const follow_redirects_1 = __webpack_require__(46966);
|
|
428
|
+
const request = ({ protocol, ...options }) => {
|
|
429
|
+
const agent = protocol === 'https' ? follow_redirects_1.https : follow_redirects_1.http;
|
|
430
|
+
return new Promise((resolve, reject) => {
|
|
487
431
|
return agent
|
|
488
|
-
.get(options,
|
|
489
|
-
|
|
432
|
+
.get(options, (response) => {
|
|
433
|
+
let data = '';
|
|
490
434
|
response.setEncoding('utf8');
|
|
491
|
-
response.on('data',
|
|
435
|
+
response.on('data', (chunk) => {
|
|
492
436
|
data += chunk;
|
|
493
437
|
});
|
|
494
|
-
response.on('end',
|
|
438
|
+
response.on('end', () => {
|
|
495
439
|
try {
|
|
496
440
|
resolve(data);
|
|
497
441
|
}
|
|
@@ -513,7 +457,7 @@ exports["default"] = request;
|
|
|
513
457
|
|
|
514
458
|
|
|
515
459
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
516
|
-
|
|
460
|
+
const unique = (array) => Array.from(new Set(array));
|
|
517
461
|
exports["default"] = unique;
|
|
518
462
|
|
|
519
463
|
|
|
@@ -551,28 +495,27 @@ Object.defineProperty(exports, "parseSpanish", ({ enumerable: true, get: functio
|
|
|
551
495
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
552
496
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
553
497
|
};
|
|
554
|
-
var _a;
|
|
555
498
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
499
|
+
const types_1 = __webpack_require__(46452);
|
|
500
|
+
const lib_1 = __webpack_require__(3805);
|
|
501
|
+
const parseEnglish_1 = __importDefault(__webpack_require__(26519));
|
|
502
|
+
const parseFrench_1 = __importDefault(__webpack_require__(51120));
|
|
503
|
+
const parseGerman_1 = __importDefault(__webpack_require__(29075));
|
|
504
|
+
const parsePolish_1 = __importDefault(__webpack_require__(92198));
|
|
505
|
+
const parseSpanish_1 = __importDefault(__webpack_require__(22292));
|
|
506
|
+
const parsePerLocale = {
|
|
507
|
+
[types_1.Locale.DE_DE]: parseGerman_1.default,
|
|
508
|
+
[types_1.Locale.EN_GB]: parseEnglish_1.default,
|
|
509
|
+
[types_1.Locale.EN_US]: parseEnglish_1.default,
|
|
510
|
+
[types_1.Locale.ES_ES]: parseSpanish_1.default,
|
|
511
|
+
[types_1.Locale.FR_FR]: parseFrench_1.default,
|
|
512
|
+
[types_1.Locale.PL_PL]: parsePolish_1.default,
|
|
513
|
+
};
|
|
514
|
+
const parse = (locale, html) => {
|
|
515
|
+
const { definitions, isAllowed } = parsePerLocale[locale](html);
|
|
573
516
|
return {
|
|
574
517
|
definitions: (0, lib_1.unique)(definitions.map(lib_1.normalizeDefinition).filter(Boolean)),
|
|
575
|
-
isAllowed
|
|
518
|
+
isAllowed,
|
|
576
519
|
};
|
|
577
520
|
};
|
|
578
521
|
exports["default"] = parse;
|
|
@@ -588,15 +531,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
588
531
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
589
532
|
};
|
|
590
533
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
534
|
+
const cheerio_1 = __importDefault(__webpack_require__(85131));
|
|
535
|
+
const parseEnglish = (html) => {
|
|
536
|
+
const $ = cheerio_1.default.load(html);
|
|
594
537
|
$('strong.mw_t_bc').replaceWith(', ');
|
|
595
538
|
$('.text-lowercase').remove();
|
|
596
539
|
$('[id^=dictionary-entry]').find('.dtText > *:not(a)').remove();
|
|
597
|
-
|
|
540
|
+
const $definitions = $('[id^=dictionary-entry]').find('.dtText, .cxl-ref');
|
|
598
541
|
return {
|
|
599
|
-
definitions: Array.from($definitions).map(
|
|
542
|
+
definitions: Array.from($definitions).map((definition) => $(definition).text()),
|
|
600
543
|
isAllowed: $definitions.length > 0,
|
|
601
544
|
};
|
|
602
545
|
};
|
|
@@ -613,12 +556,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
613
556
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
614
557
|
};
|
|
615
558
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
559
|
+
const cheerio_1 = __importDefault(__webpack_require__(85131));
|
|
560
|
+
const parseFrench = (html) => {
|
|
561
|
+
const $ = cheerio_1.default.load(html);
|
|
562
|
+
const $definitions = $('.tlf_cdefinition');
|
|
620
563
|
return {
|
|
621
|
-
definitions: Array.from($definitions).map(
|
|
564
|
+
definitions: Array.from($definitions).map((definition) => $(definition).text()),
|
|
622
565
|
isAllowed: $('#vitemselected span').length > 0,
|
|
623
566
|
};
|
|
624
567
|
};
|
|
@@ -635,11 +578,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
635
578
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
636
579
|
};
|
|
637
580
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
581
|
+
const cheerio_1 = __importDefault(__webpack_require__(85131));
|
|
582
|
+
const parseGerman = (html) => {
|
|
583
|
+
const $ = cheerio_1.default.load(html);
|
|
584
|
+
const $meaningOverview = $('.bedeutungsuebersicht');
|
|
585
|
+
let $definitions;
|
|
643
586
|
if ($meaningOverview.length > 0) {
|
|
644
587
|
$definitions = $('.bedeutungsuebersicht > ol > li > a');
|
|
645
588
|
}
|
|
@@ -647,7 +590,7 @@ var parseGerman = function (html) {
|
|
|
647
590
|
$definitions = $('.dwdswb-lesart .dwdswb-definition');
|
|
648
591
|
}
|
|
649
592
|
return {
|
|
650
|
-
definitions: Array.from($definitions).map(
|
|
593
|
+
definitions: Array.from($definitions).map((definition) => $(definition).text().replace('/\n/', '')),
|
|
651
594
|
isAllowed: $definitions.length > 0,
|
|
652
595
|
};
|
|
653
596
|
};
|
|
@@ -664,12 +607,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
664
607
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
665
608
|
};
|
|
666
609
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
610
|
+
const cheerio_1 = __importDefault(__webpack_require__(85131));
|
|
611
|
+
const parsePolish = (html) => {
|
|
612
|
+
const $ = cheerio_1.default.load(html);
|
|
613
|
+
const $header = $($('h1')[0]);
|
|
614
|
+
const $isAllowed = $header.next();
|
|
615
|
+
const $definitions = $header.next().next().next().next();
|
|
673
616
|
return {
|
|
674
617
|
definitions: $definitions.text().trim().split(/\d+\./),
|
|
675
618
|
isAllowed: $isAllowed.text().trim().indexOf('dopuszczalne w grach') >= 0,
|
|
@@ -688,9 +631,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
688
631
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
689
632
|
};
|
|
690
633
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
634
|
+
const cheerio_1 = __importDefault(__webpack_require__(85131));
|
|
635
|
+
const parseSpanish = (html) => {
|
|
636
|
+
const $ = cheerio_1.default.load(html);
|
|
694
637
|
$('.verdBold14 + .gris11 + .gris13').remove();
|
|
695
638
|
$('br + .gris13').remove();
|
|
696
639
|
$('.grisItalic13 + .gris13').remove();
|
|
@@ -698,19 +641,19 @@ var parseSpanish = function (html) {
|
|
|
698
641
|
$('font.gris11').remove();
|
|
699
642
|
$('font[class^="grisBold"]').remove();
|
|
700
643
|
$('font[class^="grisItalic"]').remove();
|
|
701
|
-
Array.from($('.gris13')).forEach(
|
|
702
|
-
|
|
644
|
+
Array.from($('.gris13')).forEach((element) => {
|
|
645
|
+
const children = $(element).find('.gris13');
|
|
703
646
|
if (children && children.length > 0) {
|
|
704
647
|
children.remove();
|
|
705
648
|
}
|
|
706
649
|
});
|
|
707
|
-
|
|
650
|
+
const definitions = Array.from($('.dcom-search-result .gris13'));
|
|
708
651
|
return {
|
|
709
652
|
definitions: definitions
|
|
710
|
-
.map(
|
|
653
|
+
.map((definition) => $(definition).text().trim())
|
|
711
654
|
.filter(Boolean)
|
|
712
|
-
.map(
|
|
713
|
-
.map(
|
|
655
|
+
.map((definition) => definition.replace(/\s+\.$/g, ''))
|
|
656
|
+
.map((definition) => (definition.endsWith('.') ? definition : `${definition}.`)),
|
|
714
657
|
isAllowed: definitions.length > 0,
|
|
715
658
|
};
|
|
716
659
|
};
|