@scrabble-solver/scrabble-solver 2.8.5 → 2.8.7
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 +9 -9
- 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/413.js +183 -94
- package/.next/server/chunks/{206.js → 429.js} +2 -4137
- package/.next/server/chunks/515.js +111 -78
- package/.next/server/chunks/{907.js → 911.js} +134 -367
- package/.next/server/chunks/939.js +218 -0
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/pages/_app.js +3 -2
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +33 -17
- package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/.next/server/pages/api/solve.js +404 -58
- package/.next/server/pages/api/solve.js.nft.json +1 -1
- package/.next/server/pages/api/visit.js +3 -2
- package/.next/server/pages/api/visit.js.nft.json +1 -1
- package/.next/server/pages/index.html +3 -7
- package/.next/server/pages/index.js +12 -14
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/static/chunks/56-cf37c430261bbea5.js +1 -0
- package/.next/static/chunks/pages/_app-0b12a65bea70a0df.js +1 -0
- package/.next/static/chunks/pages/index-fcb69802550afb81.js +1 -0
- package/.next/static/css/1f39b55d50f5b30b.css +1 -0
- package/.next/static/css/751e8a14776d05d8.css +1 -0
- package/.next/static/z_0_lqfmiI_ISokr6NNRq/_buildManifest.js +1 -0
- package/.next/static/{TzKQ3IntkvaYmHBkWpfoi → z_0_lqfmiI_ISokr6NNRq}/_ssgManifest.js +0 -0
- package/.next/trace +40 -42
- package/package.json +9 -9
- package/src/api/index.ts +3 -9
- package/src/api/isBoardValid.ts +43 -0
- package/src/api/isCellValid.ts +26 -0
- package/src/api/isRowValid.ts +19 -0
- package/src/components/Board/Board.tsx +3 -1
- package/src/components/Board/BoardPure.tsx +4 -1
- package/src/components/Board/components/Cell/Cell.module.scss +28 -11
- package/src/components/Board/components/Cell/Cell.tsx +12 -1
- package/src/components/Board/components/Cell/CellPure.tsx +3 -1
- package/src/components/Board/components/Cell/lib.ts +10 -2
- package/src/components/Dictionary/Dictionary.module.scss +20 -0
- package/src/components/Dictionary/Dictionary.tsx +40 -29
- package/src/components/Results/Cell.tsx +3 -2
- package/src/components/Results/Result.tsx +16 -6
- package/src/components/ResultsInput/ResultsInput.tsx +11 -3
- package/src/hooks/useIsTablet.ts +2 -2
- package/src/lib/getRemainingTiles.ts +1 -1
- package/src/lib/index.ts +2 -1
- package/src/lib/isRegExp.ts +11 -0
- package/src/lib/isStringArray.ts +5 -0
- package/src/lib/sortResults.ts +5 -5
- package/src/pages/_app.tsx +6 -3
- package/src/pages/api/dictionary/[locale]/[word].ts +35 -11
- package/src/pages/api/solve.ts +39 -19
- package/src/pages/api/visit.ts +1 -0
- package/src/pages/index.module.scss +5 -11
- package/src/pages/index.tsx +5 -5
- package/src/sdk/{findWordDefinition.ts → findWordDefinitions.ts} +3 -3
- package/src/sdk/index.ts +1 -1
- package/src/state/sagas.ts +11 -11
- package/src/state/selectors.ts +6 -2
- package/src/state/slices/dictionaryInitialState.ts +3 -3
- package/src/state/slices/dictionarySlice.ts +4 -10
- package/.next/static/TzKQ3IntkvaYmHBkWpfoi/_buildManifest.js +0 -1
- package/.next/static/chunks/56-2d34867599a0ac66.js +0 -1
- package/.next/static/chunks/pages/_app-6ffa2ab900772b67.js +0 -1
- package/.next/static/chunks/pages/index-13ea7770a65c69ee.js +0 -1
- package/.next/static/css/3159cfe62ff742a3.css +0 -1
- package/.next/static/css/551d09cac435debb.css +0 -1
- package/src/api/validateBoard.ts +0 -45
- package/src/api/validateCell.ts +0 -40
- package/src/api/validateCharacter.ts +0 -14
- package/src/api/validateCharacters.ts +0 -24
- package/src/api/validateConfigId.ts +0 -9
- package/src/api/validateLocale.ts +0 -15
- package/src/api/validateRow.ts +0 -17
- package/src/api/validateTile.ts +0 -21
- package/src/api/validateWord.ts +0 -11
- package/src/lib/isLocale.ts +0 -7
|
@@ -220,13 +220,13 @@ const tiles_1 = __webpack_require__(87529);
|
|
|
220
220
|
const base = {
|
|
221
221
|
allTilesBonusScore: 50,
|
|
222
222
|
blankScore: 0,
|
|
223
|
+
blanksCount: 2,
|
|
223
224
|
boardHeight: 15,
|
|
224
225
|
boardWidth: 15,
|
|
225
226
|
bonuses: bonuses_1.default,
|
|
226
227
|
id: 'literaki',
|
|
227
|
-
|
|
228
|
+
maximumCharactersCount: 7,
|
|
228
229
|
name: 'Literaki',
|
|
229
|
-
numberOfBlanks: 2,
|
|
230
230
|
};
|
|
231
231
|
const literaki = {
|
|
232
232
|
id: base.id,
|
|
@@ -570,13 +570,13 @@ const tiles_1 = __webpack_require__(29213);
|
|
|
570
570
|
const base = {
|
|
571
571
|
allTilesBonusScore: 50,
|
|
572
572
|
blankScore: 0,
|
|
573
|
+
blanksCount: 2,
|
|
573
574
|
boardHeight: 15,
|
|
574
575
|
boardWidth: 15,
|
|
575
576
|
bonuses: bonuses_1.default,
|
|
576
577
|
id: 'scrabble',
|
|
577
|
-
|
|
578
|
+
maximumCharactersCount: 7,
|
|
578
579
|
name: 'Scrabble',
|
|
579
|
-
numberOfBlanks: 2,
|
|
580
580
|
};
|
|
581
581
|
const scrabble = {
|
|
582
582
|
id: base.id,
|
|
@@ -861,7 +861,7 @@ exports.VOWELS = ['a', 'ą', 'ä', 'e', 'ę', 'i', 'o', 'ó', 'ö', 'u', 'ü', '
|
|
|
861
861
|
|
|
862
862
|
/***/ }),
|
|
863
863
|
|
|
864
|
-
/***/
|
|
864
|
+
/***/ 92237:
|
|
865
865
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
866
866
|
|
|
867
867
|
|
|
@@ -881,6 +881,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
881
881
|
"Mf": () => (/* reexport */ lib_inverseDirection),
|
|
882
882
|
"yl": () => (/* reexport */ lib_isCtrl),
|
|
883
883
|
"V5": () => (/* reexport */ lib_isMac),
|
|
884
|
+
"Kj": () => (/* reexport */ lib_isRegExp),
|
|
884
885
|
"HP": () => (/* reexport */ lib_memoize),
|
|
885
886
|
"ZT": () => (/* reexport */ lib_noop),
|
|
886
887
|
"uj": () => (/* reexport */ lib_sortResults),
|
|
@@ -888,7 +889,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
888
889
|
"gV": () => (/* reexport */ lib_zipCharactersAndTiles)
|
|
889
890
|
});
|
|
890
891
|
|
|
891
|
-
// UNUSED EXPORTS: comparator, createKeyComparator, getRemainingTilesCount, getTotalRemainingTilesCount,
|
|
892
|
+
// UNUSED EXPORTS: comparator, createKeyComparator, getRemainingTilesCount, getTotalRemainingTilesCount, isStringArray, numberComparator, reverseComparator, stringComparator
|
|
892
893
|
|
|
893
894
|
;// CONCATENATED MODULE: ./src/lib/canUseDom.ts
|
|
894
895
|
const canUseDom = Boolean( false && 0);
|
|
@@ -1033,7 +1034,7 @@ const getRemainingTiles = (config, board, characters)=>{
|
|
|
1033
1034
|
]));
|
|
1034
1035
|
const blank = {
|
|
1035
1036
|
character: constants_build.BLANK,
|
|
1036
|
-
count: config.
|
|
1037
|
+
count: config.blanksCount,
|
|
1037
1038
|
score: config.blankScore,
|
|
1038
1039
|
usedCount: nonEmptyCells.filter((cell)=>cell.tile.isBlank).length + characters.filter((character)=>character === constants_build.BLANK).length
|
|
1039
1040
|
};
|
|
@@ -1132,12 +1133,6 @@ const isCtrl = (event)=>{
|
|
|
1132
1133
|
};
|
|
1133
1134
|
/* harmony default export */ const lib_isCtrl = (isCtrl);
|
|
1134
1135
|
|
|
1135
|
-
;// CONCATENATED MODULE: ./src/lib/isLocale.ts
|
|
1136
|
-
|
|
1137
|
-
const locales = Object.values(build.Locale);
|
|
1138
|
-
const isLocale = (locale)=>locales.includes(locale);
|
|
1139
|
-
/* harmony default export */ const lib_isLocale = ((/* unused pure expression or super */ null && (isLocale)));
|
|
1140
|
-
|
|
1141
1136
|
;// CONCATENATED MODULE: ./src/lib/isMac.ts
|
|
1142
1137
|
const isMac = ()=>{
|
|
1143
1138
|
if (!globalThis.navigator) {
|
|
@@ -1147,6 +1142,18 @@ const isMac = ()=>{
|
|
|
1147
1142
|
};
|
|
1148
1143
|
/* harmony default export */ const lib_isMac = (isMac);
|
|
1149
1144
|
|
|
1145
|
+
;// CONCATENATED MODULE: ./src/lib/isRegExp.ts
|
|
1146
|
+
const isRegExp = (value)=>{
|
|
1147
|
+
try {
|
|
1148
|
+
// eslint-disable-next-line no-new
|
|
1149
|
+
new RegExp(value);
|
|
1150
|
+
return true;
|
|
1151
|
+
} catch {
|
|
1152
|
+
return false;
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
/* harmony default export */ const lib_isRegExp = (isRegExp);
|
|
1156
|
+
|
|
1150
1157
|
;// CONCATENATED MODULE: ./src/lib/memoize.ts
|
|
1151
1158
|
const memoize = (fn)=>{
|
|
1152
1159
|
const cache = [];
|
|
@@ -1194,13 +1201,13 @@ const reverseComparator = (comparator)=>{
|
|
|
1194
1201
|
|
|
1195
1202
|
|
|
1196
1203
|
const comparators = {
|
|
1197
|
-
[types/* ResultColumn.BlanksCount */.M.BlanksCount]: lib_createKeyComparator("
|
|
1198
|
-
[types/* ResultColumn.ConsonantsCount */.M.ConsonantsCount]: lib_createKeyComparator("
|
|
1204
|
+
[types/* ResultColumn.BlanksCount */.M.BlanksCount]: lib_createKeyComparator("blanksCount"),
|
|
1205
|
+
[types/* ResultColumn.ConsonantsCount */.M.ConsonantsCount]: lib_createKeyComparator("consonantsCount"),
|
|
1199
1206
|
[types/* ResultColumn.Points */.M.Points]: lib_createKeyComparator("points"),
|
|
1200
|
-
[types/* ResultColumn.TilesCount */.M.TilesCount]: lib_createKeyComparator("
|
|
1201
|
-
[types/* ResultColumn.VowelsCount */.M.VowelsCount]: lib_createKeyComparator("
|
|
1207
|
+
[types/* ResultColumn.TilesCount */.M.TilesCount]: lib_createKeyComparator("tilesCount"),
|
|
1208
|
+
[types/* ResultColumn.VowelsCount */.M.VowelsCount]: lib_createKeyComparator("vowelsCount"),
|
|
1202
1209
|
[types/* ResultColumn.Word */.M.Word]: lib_createKeyComparator("word"),
|
|
1203
|
-
[types/* ResultColumn.WordsCount */.M.WordsCount]: lib_createKeyComparator("
|
|
1210
|
+
[types/* ResultColumn.WordsCount */.M.WordsCount]: lib_createKeyComparator("wordsCount")
|
|
1204
1211
|
};
|
|
1205
1212
|
const sortResults = (results, column, sortDirection)=>{
|
|
1206
1213
|
if (typeof results === "undefined") {
|
|
@@ -1299,6 +1306,7 @@ const zipCharactersAndTiles = (characters, tiles)=>{
|
|
|
1299
1306
|
|
|
1300
1307
|
|
|
1301
1308
|
|
|
1309
|
+
|
|
1302
1310
|
|
|
1303
1311
|
|
|
1304
1312
|
/***/ }),
|
|
@@ -1408,7 +1416,7 @@ __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __we
|
|
|
1408
1416
|
/* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(redux__WEBPACK_IMPORTED_MODULE_0__);
|
|
1409
1417
|
/* harmony import */ var redux_saga__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75998);
|
|
1410
1418
|
/* harmony import */ var _rootReducer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12935);
|
|
1411
|
-
/* harmony import */ var _sagas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
1419
|
+
/* harmony import */ var _sagas__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(58531);
|
|
1412
1420
|
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([redux_saga__WEBPACK_IMPORTED_MODULE_1__]);
|
|
1413
1421
|
redux_saga__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
1414
1422
|
|
|
@@ -1572,7 +1580,7 @@ const rootReducer = (0,redux__WEBPACK_IMPORTED_MODULE_0__.combineReducers)({
|
|
|
1572
1580
|
|
|
1573
1581
|
/***/ }),
|
|
1574
1582
|
|
|
1575
|
-
/***/
|
|
1583
|
+
/***/ 58531:
|
|
1576
1584
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1577
1585
|
|
|
1578
1586
|
|
|
@@ -1586,15 +1594,15 @@ var build = __webpack_require__(34046);
|
|
|
1586
1594
|
// EXTERNAL MODULE: external "redux-saga/effects"
|
|
1587
1595
|
var effects_ = __webpack_require__(56477);
|
|
1588
1596
|
// EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
|
|
1589
|
-
var lib = __webpack_require__(
|
|
1590
|
-
;// CONCATENATED MODULE: ./src/sdk/
|
|
1597
|
+
var lib = __webpack_require__(92237);
|
|
1598
|
+
;// CONCATENATED MODULE: ./src/sdk/findWordDefinitions.ts
|
|
1591
1599
|
|
|
1592
|
-
const
|
|
1600
|
+
const findWordDefinitions = async (locale, word)=>{
|
|
1593
1601
|
const url = `/api/dictionary/${locale}/${word}`;
|
|
1594
1602
|
const json = await fetch(url).then((response)=>response.json());
|
|
1595
|
-
return build.WordDefinition.fromJson
|
|
1603
|
+
return json.map(build.WordDefinition.fromJson);
|
|
1596
1604
|
};
|
|
1597
|
-
/* harmony default export */ const
|
|
1605
|
+
/* harmony default export */ const sdk_findWordDefinitions = (findWordDefinitions);
|
|
1598
1606
|
|
|
1599
1607
|
;// CONCATENATED MODULE: ./src/sdk/solve.ts
|
|
1600
1608
|
const solve = ({ board , characters , configId , locale })=>{
|
|
@@ -1641,7 +1649,7 @@ var slices = __webpack_require__(28546);
|
|
|
1641
1649
|
|
|
1642
1650
|
|
|
1643
1651
|
const SUBMIT_DELAY = 150;
|
|
1644
|
-
const
|
|
1652
|
+
const memoizedFindWordDefinitions = (0,lib/* memoize */.HP)(sdk_findWordDefinitions);
|
|
1645
1653
|
function* rootSaga() {
|
|
1646
1654
|
yield (0,effects_.takeEvery)(slices/* resultsSlice.actions.applyResult.type */._C.actions.applyResult.type, onApplyResult);
|
|
1647
1655
|
yield (0,effects_.takeEvery)(slices/* resultsSlice.actions.changeResultCandidate.type */._C.actions.changeResultCandidate.type, onResultCandidateChange);
|
|
@@ -1666,12 +1674,12 @@ function* onConfigIdChange() {
|
|
|
1666
1674
|
function* onDictionarySubmit() {
|
|
1667
1675
|
const { input: word } = yield (0,effects_.select)(selectors/* selectDictionary */.w1);
|
|
1668
1676
|
const locale = yield (0,effects_.select)(selectors/* selectLocale */.fN);
|
|
1669
|
-
if (!
|
|
1677
|
+
if (!memoizedFindWordDefinitions.hasCache(locale, word)) {
|
|
1670
1678
|
yield (0,effects_.delay)(SUBMIT_DELAY);
|
|
1671
1679
|
}
|
|
1672
1680
|
try {
|
|
1673
|
-
const
|
|
1674
|
-
yield (0,effects_.put)(slices/* dictionarySlice.actions.submitSuccess */.lj.actions.submitSuccess(
|
|
1681
|
+
const wordDefinitions = yield (0,effects_.call)(memoizedFindWordDefinitions, locale, word);
|
|
1682
|
+
yield (0,effects_.put)(slices/* dictionarySlice.actions.submitSuccess */.lj.actions.submitSuccess(wordDefinitions));
|
|
1675
1683
|
} catch (error) {
|
|
1676
1684
|
yield (0,effects_.put)(slices/* dictionarySlice.actions.submitFailure */.lj.actions.submitFailure());
|
|
1677
1685
|
}
|
|
@@ -1693,7 +1701,7 @@ function* onLocaleChange() {
|
|
|
1693
1701
|
}
|
|
1694
1702
|
function* onResultCandidateChange({ payload: result }) {
|
|
1695
1703
|
if (result) {
|
|
1696
|
-
yield (0,effects_.put)(slices/* dictionarySlice.actions.changeInput */.lj.actions.changeInput(result.
|
|
1704
|
+
yield (0,effects_.put)(slices/* dictionarySlice.actions.changeInput */.lj.actions.changeInput(result.words.join(", ")));
|
|
1697
1705
|
yield (0,effects_.put)(slices/* dictionarySlice.actions.submit */.lj.actions.submit());
|
|
1698
1706
|
}
|
|
1699
1707
|
}
|
|
@@ -1730,15 +1738,15 @@ function* onSubmit() {
|
|
|
1730
1738
|
function* ensureProperTilesCount() {
|
|
1731
1739
|
const { config } = yield (0,effects_.select)(selectors/* selectConfig */.$o);
|
|
1732
1740
|
const characters = yield (0,effects_.select)(selectors/* selectCharacters */.yp);
|
|
1733
|
-
if (config.
|
|
1734
|
-
const differenceCount = Math.abs(config.
|
|
1741
|
+
if (config.maximumCharactersCount > characters.length) {
|
|
1742
|
+
const differenceCount = Math.abs(config.maximumCharactersCount - characters.length);
|
|
1735
1743
|
yield (0,effects_.put)(slices/* rackSlice.actions.init */.O_.actions.init([
|
|
1736
1744
|
...characters,
|
|
1737
1745
|
...Array(differenceCount).fill(null)
|
|
1738
1746
|
]));
|
|
1739
|
-
} else if (config.
|
|
1740
|
-
const nonNulls = characters.filter(Boolean).slice(0, config.
|
|
1741
|
-
const differenceCount1 = Math.abs(config.
|
|
1747
|
+
} else if (config.maximumCharactersCount < characters.length) {
|
|
1748
|
+
const nonNulls = characters.filter(Boolean).slice(0, config.maximumCharactersCount);
|
|
1749
|
+
const differenceCount1 = Math.abs(config.maximumCharactersCount - nonNulls.length);
|
|
1742
1750
|
const autoGroupTiles = yield (0,effects_.select)(selectors/* selectAutoGroupTiles */.uz);
|
|
1743
1751
|
yield (0,effects_.put)(slices/* rackSlice.actions.init */.O_.actions.init([
|
|
1744
1752
|
...nonNulls,
|
|
@@ -1818,7 +1826,7 @@ const i18n = {
|
|
|
1818
1826
|
/* harmony default export */ const src_i18n = (i18n);
|
|
1819
1827
|
|
|
1820
1828
|
// EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
|
|
1821
|
-
var lib = __webpack_require__(
|
|
1829
|
+
var lib = __webpack_require__(92237);
|
|
1822
1830
|
;// CONCATENATED MODULE: ./src/state/selectors.ts
|
|
1823
1831
|
|
|
1824
1832
|
|
|
@@ -1873,8 +1881,12 @@ const selectSortedFilteredResults = (0,toolkit_.createSelector)([
|
|
|
1873
1881
|
return results;
|
|
1874
1882
|
}
|
|
1875
1883
|
return results.filter((result)=>{
|
|
1876
|
-
|
|
1877
|
-
|
|
1884
|
+
try {
|
|
1885
|
+
const regExp = new RegExp(query, "gi");
|
|
1886
|
+
return regExp.test(result.word);
|
|
1887
|
+
} catch {
|
|
1888
|
+
return false;
|
|
1889
|
+
}
|
|
1878
1890
|
});
|
|
1879
1891
|
});
|
|
1880
1892
|
const selectResultCandidate = (0,toolkit_.createSelector)([
|
|
@@ -2074,11 +2086,9 @@ const boardSlice = (0,toolkit_.createSlice)({
|
|
|
2074
2086
|
|
|
2075
2087
|
;// CONCATENATED MODULE: ./src/state/slices/dictionaryInitialState.ts
|
|
2076
2088
|
const dictionaryInitialState = {
|
|
2077
|
-
definitions: [],
|
|
2078
2089
|
input: "",
|
|
2079
|
-
isAllowed: null,
|
|
2080
2090
|
isLoading: false,
|
|
2081
|
-
|
|
2091
|
+
results: []
|
|
2082
2092
|
};
|
|
2083
2093
|
/* harmony default export */ const slices_dictionaryInitialState = (dictionaryInitialState);
|
|
2084
2094
|
|
|
@@ -2099,28 +2109,22 @@ const dictionarySlice = (0,toolkit_.createSlice)({
|
|
|
2099
2109
|
submit: (state)=>{
|
|
2100
2110
|
return {
|
|
2101
2111
|
...state,
|
|
2102
|
-
definitions: slices_dictionaryInitialState.definitions,
|
|
2103
|
-
isAllowed: slices_dictionaryInitialState.isAllowed,
|
|
2104
2112
|
isLoading: true,
|
|
2105
|
-
|
|
2113
|
+
results: slices_dictionaryInitialState.results
|
|
2106
2114
|
};
|
|
2107
2115
|
},
|
|
2108
2116
|
submitFailure: (state)=>{
|
|
2109
2117
|
return {
|
|
2110
2118
|
...state,
|
|
2111
|
-
definitions: slices_dictionaryInitialState.definitions,
|
|
2112
|
-
isAllowed: false,
|
|
2113
2119
|
isLoading: false,
|
|
2114
|
-
|
|
2120
|
+
results: slices_dictionaryInitialState.results
|
|
2115
2121
|
};
|
|
2116
2122
|
},
|
|
2117
2123
|
submitSuccess: (state, action)=>{
|
|
2118
2124
|
return {
|
|
2119
2125
|
...state,
|
|
2120
|
-
definitions: action.payload.definitions,
|
|
2121
|
-
isAllowed: action.payload.isAllowed,
|
|
2122
2126
|
isLoading: false,
|
|
2123
|
-
|
|
2127
|
+
results: action.payload
|
|
2124
2128
|
};
|
|
2125
2129
|
}
|
|
2126
2130
|
}
|
|
@@ -2128,7 +2132,7 @@ const dictionarySlice = (0,toolkit_.createSlice)({
|
|
|
2128
2132
|
/* harmony default export */ const slices_dictionarySlice = (dictionarySlice);
|
|
2129
2133
|
|
|
2130
2134
|
// EXTERNAL MODULE: ./src/lib/index.ts + 27 modules
|
|
2131
|
-
var lib = __webpack_require__(
|
|
2135
|
+
var lib = __webpack_require__(92237);
|
|
2132
2136
|
;// CONCATENATED MODULE: ./src/state/slices/rackInitialState.ts
|
|
2133
2137
|
const rackInitialState = [
|
|
2134
2138
|
null,
|
|
@@ -2440,8 +2444,8 @@ const Tile_1 = __importDefault(__webpack_require__(25275));
|
|
|
2440
2444
|
class Board {
|
|
2441
2445
|
constructor({ rows }) {
|
|
2442
2446
|
this.rows = rows;
|
|
2443
|
-
this.
|
|
2444
|
-
this.
|
|
2447
|
+
this.columnsCount = rows[0].length;
|
|
2448
|
+
this.rowsCount = rows.length;
|
|
2445
2449
|
}
|
|
2446
2450
|
static create(width, height) {
|
|
2447
2451
|
return Board.fromStringArray(Array(height).fill(Array(width).fill(' ').join('')));
|
|
@@ -2462,8 +2466,8 @@ class Board {
|
|
|
2462
2466
|
});
|
|
2463
2467
|
}
|
|
2464
2468
|
get center() {
|
|
2465
|
-
const x = Math.floor(this.
|
|
2466
|
-
const y = Math.floor(this.
|
|
2469
|
+
const x = Math.floor(this.columnsCount / 2);
|
|
2470
|
+
const y = Math.floor(this.rowsCount / 2);
|
|
2467
2471
|
return this.rows[y][x];
|
|
2468
2472
|
}
|
|
2469
2473
|
clone() {
|
|
@@ -2474,20 +2478,20 @@ class Board {
|
|
|
2474
2478
|
return this.collidesUp(cell) || this.collidesDown(cell) || this.collidesLeft(cell) || this.collidesRight(cell);
|
|
2475
2479
|
}
|
|
2476
2480
|
collidesDown({ x, y }) {
|
|
2477
|
-
return y < this.
|
|
2481
|
+
return y < this.rowsCount - 1 && !this.rows[y + 1][x].isEmpty;
|
|
2478
2482
|
}
|
|
2479
2483
|
collidesLeft({ x, y }) {
|
|
2480
2484
|
return x > 0 && !this.rows[y][x - 1].isEmpty;
|
|
2481
2485
|
}
|
|
2482
2486
|
collidesRight({ x, y }) {
|
|
2483
|
-
return x < this.
|
|
2487
|
+
return x < this.columnsCount - 1 && !this.rows[y][x + 1].isEmpty;
|
|
2484
2488
|
}
|
|
2485
2489
|
collidesUp({ x, y }) {
|
|
2486
2490
|
return y > 0 && !this.rows[y - 1][x].isEmpty;
|
|
2487
2491
|
}
|
|
2488
2492
|
equals(other) {
|
|
2489
|
-
return (this.
|
|
2490
|
-
this.
|
|
2493
|
+
return (this.columnsCount === other.columnsCount &&
|
|
2494
|
+
this.rowsCount === other.rowsCount &&
|
|
2491
2495
|
this.rows.every((row, rowIndex) => {
|
|
2492
2496
|
return row.every((cell, cellIndex) => {
|
|
2493
2497
|
return cell.equals(other.rows[rowIndex][cellIndex]);
|
|
@@ -2529,6 +2533,34 @@ class Board {
|
|
|
2529
2533
|
exports["default"] = Board;
|
|
2530
2534
|
|
|
2531
2535
|
|
|
2536
|
+
/***/ }),
|
|
2537
|
+
|
|
2538
|
+
/***/ 46936:
|
|
2539
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2543
|
+
exports.isBoardJson = void 0;
|
|
2544
|
+
const CellJson_1 = __webpack_require__(59819);
|
|
2545
|
+
const isBoardJson = (value) => {
|
|
2546
|
+
if (!Array.isArray(value)) {
|
|
2547
|
+
return false;
|
|
2548
|
+
}
|
|
2549
|
+
for (const row of value) {
|
|
2550
|
+
if (!Array.isArray(value)) {
|
|
2551
|
+
return false;
|
|
2552
|
+
}
|
|
2553
|
+
for (const cell of row) {
|
|
2554
|
+
if (!(0, CellJson_1.isCellJson)(cell)) {
|
|
2555
|
+
return false;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
return true;
|
|
2560
|
+
};
|
|
2561
|
+
exports.isBoardJson = isBoardJson;
|
|
2562
|
+
|
|
2563
|
+
|
|
2532
2564
|
/***/ }),
|
|
2533
2565
|
|
|
2534
2566
|
/***/ 37706:
|
|
@@ -2588,9 +2620,6 @@ class Cell {
|
|
|
2588
2620
|
this.y = y;
|
|
2589
2621
|
}
|
|
2590
2622
|
static fromJson(json) {
|
|
2591
|
-
if (!json) {
|
|
2592
|
-
return Cell.Null;
|
|
2593
|
-
}
|
|
2594
2623
|
return new Cell({
|
|
2595
2624
|
isEmpty: json.isEmpty,
|
|
2596
2625
|
tile: Tile_1.default.fromJson(json.tile),
|
|
@@ -2627,21 +2656,32 @@ class Cell {
|
|
|
2627
2656
|
return this.tile.toString();
|
|
2628
2657
|
}
|
|
2629
2658
|
}
|
|
2630
|
-
Cell.Null = Object.freeze({
|
|
2631
|
-
isEmpty: true,
|
|
2632
|
-
tile: Tile_1.default.Null,
|
|
2633
|
-
x: 0,
|
|
2634
|
-
y: 0,
|
|
2635
|
-
clone: () => Cell.Null,
|
|
2636
|
-
equals: (other) => other === Cell.Null,
|
|
2637
|
-
hasTile: () => false,
|
|
2638
|
-
isCandidate: () => false,
|
|
2639
|
-
toString: () => '',
|
|
2640
|
-
toJson: () => null,
|
|
2641
|
-
});
|
|
2642
2659
|
exports["default"] = Cell;
|
|
2643
2660
|
|
|
2644
2661
|
|
|
2662
|
+
/***/ }),
|
|
2663
|
+
|
|
2664
|
+
/***/ 59819:
|
|
2665
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2669
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2670
|
+
};
|
|
2671
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2672
|
+
exports.isCellJson = void 0;
|
|
2673
|
+
const isObject_1 = __importDefault(__webpack_require__(24814));
|
|
2674
|
+
const TileJson_1 = __webpack_require__(214);
|
|
2675
|
+
const isCellJson = (value) => {
|
|
2676
|
+
return ((0, isObject_1.default)(value) &&
|
|
2677
|
+
typeof value.isEmpty === 'boolean' &&
|
|
2678
|
+
((0, TileJson_1.isTileJson)(value.tile) || value.tile === null) &&
|
|
2679
|
+
typeof value.x === 'number' &&
|
|
2680
|
+
typeof value.y === 'number');
|
|
2681
|
+
};
|
|
2682
|
+
exports.isCellJson = isCellJson;
|
|
2683
|
+
|
|
2684
|
+
|
|
2645
2685
|
/***/ }),
|
|
2646
2686
|
|
|
2647
2687
|
/***/ 19582:
|
|
@@ -2709,6 +2749,9 @@ class Config {
|
|
|
2709
2749
|
get blankScore() {
|
|
2710
2750
|
return this.config.blankScore;
|
|
2711
2751
|
}
|
|
2752
|
+
get blanksCount() {
|
|
2753
|
+
return this.config.blanksCount;
|
|
2754
|
+
}
|
|
2712
2755
|
get boardHeight() {
|
|
2713
2756
|
return this.config.boardHeight;
|
|
2714
2757
|
}
|
|
@@ -2751,11 +2794,8 @@ class Config {
|
|
|
2751
2794
|
isTwoCharacterTilePrefix(character) {
|
|
2752
2795
|
return typeof this.getTwoCharacterTileByPrefix(character) !== 'undefined';
|
|
2753
2796
|
}
|
|
2754
|
-
get
|
|
2755
|
-
return this.config.
|
|
2756
|
-
}
|
|
2757
|
-
get numberOfBlanks() {
|
|
2758
|
-
return this.config.numberOfBlanks;
|
|
2797
|
+
get maximumCharactersCount() {
|
|
2798
|
+
return this.config.maximumCharactersCount;
|
|
2759
2799
|
}
|
|
2760
2800
|
get tiles() {
|
|
2761
2801
|
return this.config.tiles;
|
|
@@ -2836,6 +2876,7 @@ exports["default"] = HorizontalPattern;
|
|
|
2836
2876
|
|
|
2837
2877
|
|
|
2838
2878
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2879
|
+
exports.isLocale = void 0;
|
|
2839
2880
|
// eslint-disable-next-line no-shadow
|
|
2840
2881
|
var Locale;
|
|
2841
2882
|
(function (Locale) {
|
|
@@ -2846,6 +2887,9 @@ var Locale;
|
|
|
2846
2887
|
Locale["PL_PL"] = "pl-PL";
|
|
2847
2888
|
Locale["DE_DE"] = "de-DE";
|
|
2848
2889
|
})(Locale || (Locale = {}));
|
|
2890
|
+
const locales = Object.values(Locale);
|
|
2891
|
+
const isLocale = (locale) => locales.includes(locale);
|
|
2892
|
+
exports.isLocale = isLocale;
|
|
2849
2893
|
exports["default"] = Locale;
|
|
2850
2894
|
|
|
2851
2895
|
|
|
@@ -2862,9 +2906,9 @@ class Pattern {
|
|
|
2862
2906
|
this.cells = cells;
|
|
2863
2907
|
}
|
|
2864
2908
|
canBePlaced(config) {
|
|
2865
|
-
const
|
|
2866
|
-
const
|
|
2867
|
-
return (
|
|
2909
|
+
const emptyCellsCount = this.getEmptyCellsCount();
|
|
2910
|
+
const isUsedCellsCountInRange = emptyCellsCount >= 1 && emptyCellsCount <= config.maximumCharactersCount;
|
|
2911
|
+
return (isUsedCellsCountInRange &&
|
|
2868
2912
|
(this.hasAtLeast1NonEmptyCell() || this.collides() || (this.goesThroughBoardCenter() && this.board.isEmpty())));
|
|
2869
2913
|
}
|
|
2870
2914
|
clone() {
|
|
@@ -2879,7 +2923,7 @@ class Pattern {
|
|
|
2879
2923
|
getIndexOfFirstCellWithoutTile() {
|
|
2880
2924
|
return this.cells.findIndex((cell) => !cell.hasTile());
|
|
2881
2925
|
}
|
|
2882
|
-
|
|
2926
|
+
getEmptyCellsCount() {
|
|
2883
2927
|
return this.cells.filter((cell) => cell.isEmpty).length;
|
|
2884
2928
|
}
|
|
2885
2929
|
goesThroughBoardCenter() {
|
|
@@ -2921,28 +2965,29 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
2921
2965
|
const constants_1 = __webpack_require__(7618);
|
|
2922
2966
|
const Cell_1 = __importDefault(__webpack_require__(52251));
|
|
2923
2967
|
class Result {
|
|
2924
|
-
constructor({ cells, id,
|
|
2968
|
+
constructor({ cells, id, collisions, points, }) {
|
|
2925
2969
|
const tiles = getTiles(cells);
|
|
2970
|
+
this.blanksCount = getBlanks(tiles).length;
|
|
2926
2971
|
this.cells = cells;
|
|
2972
|
+
this.collisions = collisions;
|
|
2973
|
+
this.consonantsCount = getConsonants(tiles).length;
|
|
2927
2974
|
this.id = id;
|
|
2928
2975
|
this.length = cells.length;
|
|
2929
|
-
this.numberOfCollisions = numberOfCollisions;
|
|
2930
|
-
this.numberOfConsonants = getConsonants(tiles).length;
|
|
2931
|
-
this.numberOfBlanks = getBlanks(tiles).length;
|
|
2932
|
-
this.numberOfTiles = tiles.length;
|
|
2933
|
-
this.numberOfVowels = getVowels(tiles).length;
|
|
2934
|
-
this.numberOfWords = 1 + this.numberOfCollisions;
|
|
2935
2976
|
this.points = points;
|
|
2936
2977
|
this.pointsRatio = getPointsRatio(tiles, points);
|
|
2937
2978
|
this.tiles = tiles;
|
|
2938
2979
|
this.tilesCharacters = getTilesCharacters(tiles);
|
|
2980
|
+
this.tilesCount = tiles.length;
|
|
2981
|
+
this.vowelsCount = getVowels(tiles).length;
|
|
2939
2982
|
this.word = getWord(cells);
|
|
2983
|
+
this.words = getWords(cells, collisions);
|
|
2984
|
+
this.wordsCount = 1 + this.collisions.length;
|
|
2940
2985
|
}
|
|
2941
2986
|
static fromJson(json) {
|
|
2942
2987
|
return new Result({
|
|
2943
|
-
cells: json.cells.map(Cell_1.default.fromJson),
|
|
2944
2988
|
id: json.id,
|
|
2945
|
-
|
|
2989
|
+
cells: json.cells.map(Cell_1.default.fromJson),
|
|
2990
|
+
collisions: json.collisions.map((collision) => collision.map(Cell_1.default.fromJson)),
|
|
2946
2991
|
points: json.points,
|
|
2947
2992
|
});
|
|
2948
2993
|
}
|
|
@@ -2950,7 +2995,7 @@ class Result {
|
|
|
2950
2995
|
return {
|
|
2951
2996
|
cells: this.cells.map((cell) => cell.toJson()),
|
|
2952
2997
|
id: this.id,
|
|
2953
|
-
|
|
2998
|
+
collisions: this.collisions.map((collision) => collision.map((cell) => cell.toJson())),
|
|
2954
2999
|
points: this.points,
|
|
2955
3000
|
};
|
|
2956
3001
|
}
|
|
@@ -2965,6 +3010,10 @@ const getPointsRatio = (tiles, points) => points / tiles.length;
|
|
|
2965
3010
|
const getTiles = (cells) => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
|
|
2966
3011
|
const getTilesCharacters = (tiles) => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
|
|
2967
3012
|
const getWord = (cells) => cells.map(String).join('');
|
|
3013
|
+
const getWords = (cells, collisions) => [
|
|
3014
|
+
getWord(cells),
|
|
3015
|
+
...collisions.map((collision) => collision.map(String).join('')),
|
|
3016
|
+
];
|
|
2968
3017
|
const isConsonant = ({ character, isBlank }) => constants_1.CONSONANTS.includes(character) && !isBlank;
|
|
2969
3018
|
const isVowel = ({ character, isBlank }) => constants_1.VOWELS.includes(character) && !isBlank;
|
|
2970
3019
|
exports["default"] = Result;
|
|
@@ -3022,6 +3071,24 @@ Tile.Null = Object.freeze({
|
|
|
3022
3071
|
exports["default"] = Tile;
|
|
3023
3072
|
|
|
3024
3073
|
|
|
3074
|
+
/***/ }),
|
|
3075
|
+
|
|
3076
|
+
/***/ 214:
|
|
3077
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3081
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3082
|
+
};
|
|
3083
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3084
|
+
exports.isTileJson = void 0;
|
|
3085
|
+
const isObject_1 = __importDefault(__webpack_require__(24814));
|
|
3086
|
+
const isTileJson = (value) => {
|
|
3087
|
+
return (0, isObject_1.default)(value) && typeof value.character === 'string' && typeof value.isBlank === 'boolean';
|
|
3088
|
+
};
|
|
3089
|
+
exports.isTileJson = isTileJson;
|
|
3090
|
+
|
|
3091
|
+
|
|
3025
3092
|
/***/ }),
|
|
3026
3093
|
|
|
3027
3094
|
/***/ 65168:
|
|
@@ -3145,27 +3212,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3145
3212
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3146
3213
|
};
|
|
3147
3214
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3148
|
-
exports.WordDefinition = exports.WordBonus = exports.VerticalPattern = exports.Tile = exports.Result = exports.Pattern = exports.Locale = exports.HorizontalPattern = exports.Config = exports.CharacterBonus = exports.Cell = exports.Bonus = exports.Board = void 0;
|
|
3215
|
+
exports.WordDefinition = exports.WordBonus = exports.VerticalPattern = exports.isTileJson = exports.Tile = exports.Result = exports.Pattern = exports.isLocale = exports.Locale = exports.isObject = exports.HorizontalPattern = exports.Config = exports.CharacterBonus = exports.isCellJson = exports.Cell = exports.Bonus = exports.isBoardJson = exports.Board = void 0;
|
|
3149
3216
|
var Board_1 = __webpack_require__(80559);
|
|
3150
3217
|
Object.defineProperty(exports, "Board", ({ enumerable: true, get: function () { return __importDefault(Board_1).default; } }));
|
|
3218
|
+
var BoardJson_1 = __webpack_require__(46936);
|
|
3219
|
+
Object.defineProperty(exports, "isBoardJson", ({ enumerable: true, get: function () { return BoardJson_1.isBoardJson; } }));
|
|
3151
3220
|
var Bonus_1 = __webpack_require__(37706);
|
|
3152
3221
|
Object.defineProperty(exports, "Bonus", ({ enumerable: true, get: function () { return __importDefault(Bonus_1).default; } }));
|
|
3153
3222
|
var Cell_1 = __webpack_require__(52251);
|
|
3154
3223
|
Object.defineProperty(exports, "Cell", ({ enumerable: true, get: function () { return __importDefault(Cell_1).default; } }));
|
|
3224
|
+
var CellJson_1 = __webpack_require__(59819);
|
|
3225
|
+
Object.defineProperty(exports, "isCellJson", ({ enumerable: true, get: function () { return CellJson_1.isCellJson; } }));
|
|
3155
3226
|
var CharacterBonus_1 = __webpack_require__(19582);
|
|
3156
3227
|
Object.defineProperty(exports, "CharacterBonus", ({ enumerable: true, get: function () { return __importDefault(CharacterBonus_1).default; } }));
|
|
3157
3228
|
var Config_1 = __webpack_require__(28433);
|
|
3158
3229
|
Object.defineProperty(exports, "Config", ({ enumerable: true, get: function () { return __importDefault(Config_1).default; } }));
|
|
3159
3230
|
var HorizontalPattern_1 = __webpack_require__(49594);
|
|
3160
3231
|
Object.defineProperty(exports, "HorizontalPattern", ({ enumerable: true, get: function () { return __importDefault(HorizontalPattern_1).default; } }));
|
|
3232
|
+
var isObject_1 = __webpack_require__(24814);
|
|
3233
|
+
Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return __importDefault(isObject_1).default; } }));
|
|
3161
3234
|
var Locale_1 = __webpack_require__(26634);
|
|
3162
3235
|
Object.defineProperty(exports, "Locale", ({ enumerable: true, get: function () { return __importDefault(Locale_1).default; } }));
|
|
3236
|
+
Object.defineProperty(exports, "isLocale", ({ enumerable: true, get: function () { return Locale_1.isLocale; } }));
|
|
3163
3237
|
var Pattern_1 = __webpack_require__(63207);
|
|
3164
3238
|
Object.defineProperty(exports, "Pattern", ({ enumerable: true, get: function () { return __importDefault(Pattern_1).default; } }));
|
|
3165
3239
|
var Result_1 = __webpack_require__(30091);
|
|
3166
3240
|
Object.defineProperty(exports, "Result", ({ enumerable: true, get: function () { return __importDefault(Result_1).default; } }));
|
|
3167
3241
|
var Tile_1 = __webpack_require__(25275);
|
|
3168
3242
|
Object.defineProperty(exports, "Tile", ({ enumerable: true, get: function () { return __importDefault(Tile_1).default; } }));
|
|
3243
|
+
var TileJson_1 = __webpack_require__(214);
|
|
3244
|
+
Object.defineProperty(exports, "isTileJson", ({ enumerable: true, get: function () { return TileJson_1.isTileJson; } }));
|
|
3169
3245
|
var VerticalPattern_1 = __webpack_require__(65168);
|
|
3170
3246
|
Object.defineProperty(exports, "VerticalPattern", ({ enumerable: true, get: function () { return __importDefault(VerticalPattern_1).default; } }));
|
|
3171
3247
|
var WordBonus_1 = __webpack_require__(58627);
|
|
@@ -3174,6 +3250,19 @@ var WordDefinition_1 = __webpack_require__(31560);
|
|
|
3174
3250
|
Object.defineProperty(exports, "WordDefinition", ({ enumerable: true, get: function () { return __importDefault(WordDefinition_1).default; } }));
|
|
3175
3251
|
|
|
3176
3252
|
|
|
3253
|
+
/***/ }),
|
|
3254
|
+
|
|
3255
|
+
/***/ 24814:
|
|
3256
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3257
|
+
|
|
3258
|
+
|
|
3259
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3260
|
+
const isObject = (value) => {
|
|
3261
|
+
return typeof value === 'object' && value !== null;
|
|
3262
|
+
};
|
|
3263
|
+
exports["default"] = isObject;
|
|
3264
|
+
|
|
3265
|
+
|
|
3177
3266
|
/***/ })
|
|
3178
3267
|
|
|
3179
3268
|
};
|