cubing 0.25.2 → 0.25.6
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/README.md +12 -30
- package/dist/esm/{2x2x2.sgs.json-NUOQFJWU.js → 2x2x2.sgs.json-GQVTWF7L.js} +3 -3
- package/dist/esm/{2x2x2.sgs.json-NUOQFJWU.js.map → 2x2x2.sgs.json-GQVTWF7L.js.map} +0 -0
- package/dist/esm/{3d-dynamic-AKACURPM.js → 3d-dynamic-DKWMBHRS.js} +19 -17
- package/dist/esm/{3d-dynamic-AKACURPM.js.map → 3d-dynamic-DKWMBHRS.js.map} +2 -2
- package/dist/esm/{444-solver-GNQ5BHCL.js → 444-solver-ZBJQH3QR.js} +4 -4
- package/dist/esm/{444-solver-GNQ5BHCL.js.map → 444-solver-ZBJQH3QR.js.map} +0 -0
- package/dist/esm/bluetooth/index.js +3 -3
- package/dist/esm/chunk-BEXHMXCT.js +9 -0
- package/dist/esm/chunk-BEXHMXCT.js.map +7 -0
- package/dist/esm/{chunk-SNWS6JXI.js → chunk-BOKO2BWT.js} +101 -27
- package/dist/esm/chunk-BOKO2BWT.js.map +7 -0
- package/dist/esm/{chunk-KRL5KQQK.js → chunk-F5WNHV7V.js} +2 -2
- package/dist/esm/{chunk-KRL5KQQK.js.map → chunk-F5WNHV7V.js.map} +2 -2
- package/dist/esm/{chunk-Y32HHZUY.js → chunk-FE3HTWQK.js} +8 -2
- package/dist/esm/chunk-FE3HTWQK.js.map +7 -0
- package/dist/esm/{chunk-CYKV7QC5.js → chunk-HTPDDD3Q.js} +2 -2
- package/dist/esm/{chunk-CYKV7QC5.js.map → chunk-HTPDDD3Q.js.map} +0 -0
- package/dist/esm/chunk-IVQ4ITE2.js +33 -0
- package/dist/esm/chunk-IVQ4ITE2.js.map +7 -0
- package/dist/esm/{chunk-QMZKTP7F.js → chunk-L73RWUDG.js} +3 -3
- package/dist/esm/{chunk-QMZKTP7F.js.map → chunk-L73RWUDG.js.map} +0 -0
- package/dist/esm/{chunk-TXTMBIUR.js → chunk-L7AOT5LY.js} +2 -2
- package/dist/esm/{chunk-TXTMBIUR.js.map → chunk-L7AOT5LY.js.map} +0 -0
- package/dist/esm/{chunk-T5KQKRR3.js → chunk-LZGPOT2V.js} +3 -3
- package/dist/esm/{chunk-T5KQKRR3.js.map → chunk-LZGPOT2V.js.map} +0 -0
- package/dist/esm/{chunk-ASJ2DADD.js → chunk-ME2QTCHN.js} +3 -3
- package/dist/esm/{chunk-ASJ2DADD.js.map → chunk-ME2QTCHN.js.map} +0 -0
- package/dist/esm/{chunk-FZJDXPAH.js → chunk-T2BDGTK3.js} +11 -34
- package/dist/esm/chunk-T2BDGTK3.js.map +7 -0
- package/dist/esm/{chunk-L3PZ4XAT.js → chunk-TG5KP5IL.js} +7 -2
- package/dist/esm/{chunk-L3PZ4XAT.js.map → chunk-TG5KP5IL.js.map} +2 -2
- package/dist/esm/{chunk-5O24MNND.js → chunk-WDJDRVZZ.js} +6 -3
- package/dist/esm/chunk-WDJDRVZZ.js.map +7 -0
- package/dist/esm/{fto.dynamic-A3AASYQ6.js → fto.dynamic-ZH5IVUKX.js} +3 -3
- package/dist/esm/{fto.dynamic-A3AASYQ6.js.map → fto.dynamic-ZH5IVUKX.js.map} +0 -0
- package/dist/esm/kilominx.kpuzzle.svg-7XJBOKFU.js +83 -0
- package/dist/esm/kilominx.kpuzzle.svg-7XJBOKFU.js.map +7 -0
- package/dist/esm/kilosolver-N6JM5PUY.js +713 -0
- package/dist/esm/kilosolver-N6JM5PUY.js.map +7 -0
- package/dist/esm/kpuzzle/index.js +1 -1
- package/dist/esm/{megaminx.sgs.json-KKR4VPHV.js → megaminx.sgs.json-JXXOXGQE.js} +4 -4
- package/dist/esm/{megaminx.sgs.json-KKR4VPHV.js.map → megaminx.sgs.json-JXXOXGQE.js.map} +0 -0
- package/dist/esm/protocol/index.js +2 -2
- package/dist/esm/puzzle-geometry/index.js +1 -1
- package/dist/esm/puzzles/index.js +4 -2
- package/dist/esm/{pyraminx.sgs.json-X37XL7MA.js → pyraminx.sgs.json-EHYGSC7B.js} +4 -4
- package/dist/esm/{pyraminx.sgs.json-X37XL7MA.js.map → pyraminx.sgs.json-EHYGSC7B.js.map} +0 -0
- package/dist/esm/redi_cube-E5F64NIQ.js +564 -0
- package/dist/esm/redi_cube-E5F64NIQ.js.map +7 -0
- package/dist/esm/redi_cube.kpuzzle.json-EPBKWOMV.js +66 -0
- package/dist/esm/redi_cube.kpuzzle.json-EPBKWOMV.js.map +7 -0
- package/dist/esm/redi_cube.kpuzzle.svg-BSHCMC2Z.js +160 -0
- package/dist/esm/redi_cube.kpuzzle.svg-BSHCMC2Z.js.map +7 -0
- package/dist/esm/scramble/index.js +6 -4
- package/dist/esm/search/index.js +6 -4
- package/dist/esm/{entry-2KUJYJBJ.js → search-worker-js-entry-BDMABBZV.js} +42 -20
- package/dist/esm/search-worker-js-entry-BDMABBZV.js.map +7 -0
- package/dist/esm/search-worker-ts-entry-3B5U6XER.js +22 -0
- package/dist/esm/search-worker-ts-entry-3B5U6XER.js.map +7 -0
- package/dist/esm/{skewb.sgs.json-MWONK6HT.js → skewb.sgs.json-F5FL7533.js} +4 -4
- package/dist/esm/{skewb.sgs.json-MWONK6HT.js.map → skewb.sgs.json-F5FL7533.js.map} +0 -0
- package/dist/esm/twisty/index.js +8 -3
- package/dist/esm/twisty/index.js.map +2 -2
- package/dist/esm/worker-inside-generated-string-AHMSHHSF.js +3674 -0
- package/dist/esm/worker-inside-generated-string-AHMSHHSF.js.map +7 -0
- package/dist/types/kpuzzle/KPuzzleDefinition.d.ts +1 -0
- package/dist/types/puzzles/events.d.ts +8 -0
- package/dist/types/puzzles/implementations/kilominx/index.d.ts +2 -0
- package/dist/types/puzzles/implementations/kilominx/kilominx.kpuzzle.svg.d.ts +1 -0
- package/dist/types/puzzles/implementations/redi-cube/index.d.ts +2 -0
- package/dist/types/puzzles/implementations/redi-cube/redi_cube.kpuzzle.json.d.ts +2 -0
- package/dist/types/puzzles/implementations/redi-cube/redi_cube.kpuzzle.svg.d.ts +1 -0
- package/dist/types/puzzles/index.d.ts +6 -11
- package/dist/types/search/inside/{entry.d.ts → search-worker-js-entry.d.ts} +0 -0
- package/dist/types/search/inside/{search-worker-entry-path-getter.d.ts → search-worker-ts-entry-path-getter.d.ts} +0 -0
- package/dist/types/search/inside/{search-worker-entry.d.ts → search-worker-ts-entry.d.ts} +0 -0
- package/dist/types/search/inside/solve/puzzles/kilominx.d.ts +2 -0
- package/dist/types/search/inside/solve/puzzles/redi_cube.d.ts +2 -0
- package/dist/types/search/inside/worker-guard.d.ts +3 -0
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +2 -0
- package/dist/types/vendor/comlink-everywhere/inside/index.d.ts +3 -1
- package/dist/types/vendor/xyzzy/fto-solver-original.d.ts +1 -56
- package/dist/types/vendor/xyzzy/kilosolver.d.ts +2 -140
- package/dist/types/vendor/xyzzy/redi_cube.d.ts +2 -0
- package/package.json +65 -70
- package/dist/esm/chunk-5O24MNND.js.map +0 -7
- package/dist/esm/chunk-FZJDXPAH.js.map +0 -7
- package/dist/esm/chunk-SNWS6JXI.js.map +0 -7
- package/dist/esm/chunk-Y32HHZUY.js.map +0 -7
- package/dist/esm/entry-2KUJYJBJ.js.map +0 -7
- package/dist/esm/search-worker-entry-ZJAXYGSH.js +0 -18
- package/dist/esm/search-worker-entry-ZJAXYGSH.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-OBSDMXAS.js +0 -3447
- package/dist/esm/worker-inside-generated-string-OBSDMXAS.js.map +0 -7
- package/dist/types/search/esm-test-worker.d.ts +0 -3
- package/dist/types/vendor/xyzzy/rediscrambler.d.ts +0 -94
|
@@ -16,6 +16,8 @@ export declare const puzzleIDs: {
|
|
|
16
16
|
fto: boolean;
|
|
17
17
|
gigaminx: boolean;
|
|
18
18
|
master_tetraminx: boolean;
|
|
19
|
+
kilominx: boolean;
|
|
20
|
+
redi_cube: boolean;
|
|
19
21
|
};
|
|
20
22
|
export declare type PuzzleID = keyof typeof puzzleIDs;
|
|
21
23
|
export declare class PuzzleIDRequestProp extends SimpleTwistyPropSource<PuzzleID | NoValueType> {
|
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
declare function counter(A: any): any[];
|
|
2
|
-
declare function counter(A: any): any[];
|
|
3
|
-
declare function counter(A: any): any[];
|
|
4
|
-
declare function factorial(n: any): any;
|
|
5
2
|
declare function factorial(n: any): any;
|
|
6
|
-
declare function factorial(n: any): any;
|
|
7
|
-
declare function C(n: any, k: any): number;
|
|
8
|
-
declare function C(n: any, k: any): number;
|
|
9
3
|
declare function C(n: any, k: any): number;
|
|
10
4
|
declare function C4(n: any, k0: any, k1: any, k2: any, k3?: number): number;
|
|
11
5
|
declare function permutation_to_index(perm: any): number;
|
|
12
|
-
declare function permutation_to_index(perm: any): number;
|
|
13
|
-
declare function permutation_to_index(perm: any): number;
|
|
14
|
-
declare function index_to_permutation(ind: any, n: any): number[];
|
|
15
|
-
declare function index_to_permutation(ind: any, n: any): number[];
|
|
16
6
|
declare function index_to_permutation(ind: any, n: any): number[];
|
|
17
7
|
declare function permutation_parity(A: any): number;
|
|
18
|
-
declare function permutation_parity(A: any): number;
|
|
19
|
-
declare function permutation_parity(A: any): number;
|
|
20
|
-
declare function index_to_evenpermutation(ind: any, n: any): number[];
|
|
21
8
|
declare function index_to_evenpermutation(ind: any, n: any): number[];
|
|
22
|
-
declare function index_to_evenpermutation(ind: any, n: any): number[];
|
|
23
|
-
declare function evenpermutation_to_index(perm: any): number;
|
|
24
|
-
declare function evenpermutation_to_index(perm: any): number;
|
|
25
9
|
declare function evenpermutation_to_index(perm: any): number;
|
|
26
10
|
declare function random_permutation(n: any): number[];
|
|
27
11
|
declare function random_even_permutation(n: any): number[];
|
|
28
12
|
declare function comb_to_index(l: any): number;
|
|
29
|
-
declare function comb_to_index(l: any): number;
|
|
30
|
-
declare function comb_to_index(l: any): number;
|
|
31
|
-
declare function index_to_comb(ind: any, ones: any, bits: any): any[];
|
|
32
|
-
declare function index_to_comb(ind: any, ones: any, bits: any): any[];
|
|
33
13
|
declare function index_to_comb(ind: any, ones: any, bits: any): any[];
|
|
34
14
|
declare function ctz(n: any): number;
|
|
35
15
|
declare function generate_comb_lookup_tables(n: any, k: any): any;
|
|
@@ -38,11 +18,8 @@ declare function spread_bits(n: any): any;
|
|
|
38
18
|
declare function interleave_bits(x: any, y: any): number;
|
|
39
19
|
declare function generate_comb4_lookup_tables(n: any, k0: any, k1: any, k2: any, k3: any): any;
|
|
40
20
|
declare function compose(A: any, B: any): any[];
|
|
41
|
-
declare function compose(A: any, B: any): any[];
|
|
42
|
-
declare function compose(A: any, B: any): any[];
|
|
43
21
|
declare function compose3(A: any, B: any, C: any): any[];
|
|
44
22
|
declare function compose_o(A: any, B: any): any[][];
|
|
45
|
-
declare function compose_o(A: any, B: any): any[][];
|
|
46
23
|
declare function permutation_from_cycles(cycles: any, n: any): any[];
|
|
47
24
|
declare function reduce_permutation(perm: any, keep: any): any[];
|
|
48
25
|
declare function invert_permutation(perm: any): any[];
|
|
@@ -62,21 +39,12 @@ declare function convert_move_to_permutations(move: any): {
|
|
|
62
39
|
bp: number[];
|
|
63
40
|
};
|
|
64
41
|
declare function random_state(): any[];
|
|
65
|
-
declare function random_state(): any[][];
|
|
66
42
|
declare function stringify_move_sequence(move_sequence: any, no_wide?: boolean): any;
|
|
67
|
-
declare function stringify_move_sequence(move_sequence: any): any;
|
|
68
|
-
declare function stringify_move_sequence(move_sequence: any): any;
|
|
69
|
-
declare function print_move_sequence(move_sequence: any): void;
|
|
70
43
|
declare function print_move_sequence(move_sequence: any): void;
|
|
71
|
-
declare function print_move_sequence(move_sequence: any): void;
|
|
72
|
-
declare function apply_move_sequence(state: any, move_sequence: any): any;
|
|
73
|
-
declare function apply_move_sequence(state: any, move_sequence: any): any;
|
|
74
44
|
declare function apply_move_sequence(state: any, move_sequence: any): any;
|
|
75
45
|
declare function invert_move_sequence(move_sequence: any): any;
|
|
76
46
|
declare function simplify_move_sequence(move_sequence: any, make_noise?: boolean): any[][];
|
|
77
47
|
declare function generate_random_state_scramble(): any;
|
|
78
|
-
declare function generate_random_state_scramble(): any;
|
|
79
|
-
declare function generate_random_state_scramble(): any;
|
|
80
48
|
declare function generate_multiple_random_state_scrambles(n: any): any[];
|
|
81
49
|
declare function generate_mtable_comb_generic(n: any, k: any, permutations: any): Uint32Array[];
|
|
82
50
|
declare function generate_mtable_comb4_generic(n: any, k0: any, k1: any, k2: any, k3: any, permutations: any): Uint32Array[];
|
|
@@ -86,20 +54,11 @@ declare function trim_unreachable(mtable: any, origin: any): any[];
|
|
|
86
54
|
declare function reduce_to_quotient(mtable: any, origins: any): (Int32Array | Int32Array[])[];
|
|
87
55
|
declare function generate_mirrored_coordinate_table(mtable: any, a: any, b: any): Int32Array;
|
|
88
56
|
declare function bfs(mtable: any, goal_states: any): Int8Array;
|
|
89
|
-
declare function bfs(mtable: any, goal_states: any): any[];
|
|
90
|
-
declare function bfs(mtable: any, goal_states: any): any[];
|
|
91
57
|
declare function ida_solve_gen(indices: any, mtables: any, ptables: any, moves_left: any, commute: any): Generator<any, void, any>;
|
|
92
|
-
declare function ida_solve_gen(indices: any, mtables: any, ptables: any): Generator<any, void, any>;
|
|
93
58
|
declare function ida_search_gen(indices: any, mtables: any, ptables: any, bound: any, last: any, commute: any): any;
|
|
94
|
-
declare function ida_search_gen(indices: any, mtables: any, ptables: any, bound: any, last: any): any;
|
|
95
59
|
declare function solve(facelets: any, readable?: boolean): any[][];
|
|
96
|
-
declare function solve(state: any): any[];
|
|
97
|
-
declare function solve(state: any): any;
|
|
98
60
|
declare function index_phase1(facelets: any): any[];
|
|
99
|
-
declare function index_phase1(state: any): number[];
|
|
100
61
|
declare function generate_phase1_edge_mtable(): any;
|
|
101
|
-
declare function generate_phase1_edge_mtable(): any;
|
|
102
|
-
declare function generate_phase1_edge_ptable(): any;
|
|
103
62
|
declare function generate_phase1_edge_ptable(): any;
|
|
104
63
|
declare function generate_phase1_centreA_mtable(): any;
|
|
105
64
|
declare function generate_phase1_centreB_mtable(): any;
|
|
@@ -108,14 +67,10 @@ declare function solve_phase1_gen(facelets: any): Generator<any, void, any>;
|
|
|
108
67
|
declare function phase1_ida_solve_gen(indices: any, mtables: any, ptables: any, moves_left: any): Generator<any, void, any>;
|
|
109
68
|
declare function phase1_ida_search_gen(indices: any, mtables: any, ptables: any, bound: any, last: any): any;
|
|
110
69
|
declare function index_phase2(facelets: any): any[];
|
|
111
|
-
declare function index_phase2(state: any): number[];
|
|
112
70
|
declare function solve_phase2_gen(facelets: any): Generator<any, void, any>;
|
|
113
71
|
declare function solve_phase2(facelets: any): any;
|
|
114
|
-
declare function solve_phase2(state: any): any;
|
|
115
72
|
declare function generate_phase2_centre_mtables(): any;
|
|
116
73
|
declare function generate_phase2_edge_mtable(): any;
|
|
117
|
-
declare function generate_phase2_edge_mtable(): any;
|
|
118
|
-
declare function generate_phase2_corner_mtable(): any;
|
|
119
74
|
declare function generate_phase2_corner_mtable(): any;
|
|
120
75
|
declare function generate_phase2_corner_mtable_compact(): any;
|
|
121
76
|
declare function generate_phase2_ce_mtable(): any;
|
|
@@ -155,9 +110,6 @@ declare let move_Ui: any[];
|
|
|
155
110
|
declare let move_X: number[];
|
|
156
111
|
declare let move_Y: number[];
|
|
157
112
|
declare let move_Z: number[];
|
|
158
|
-
declare let move_L: any[];
|
|
159
|
-
declare let move_F: any[];
|
|
160
|
-
declare let move_R: any[];
|
|
161
113
|
declare let move_Us: any[];
|
|
162
114
|
declare let move_Uw: any[];
|
|
163
115
|
declare let move_Uwi: any[];
|
|
@@ -169,14 +121,7 @@ declare let corner_piece_facelets: number[][];
|
|
|
169
121
|
declare let edge_piece_facelets: number[][];
|
|
170
122
|
declare let centreA_piece_facelets: number[];
|
|
171
123
|
declare let centreB_piece_facelets: number[];
|
|
172
|
-
declare let
|
|
173
|
-
declare let move_names: string[];
|
|
174
|
-
declare let move_permutations: {
|
|
175
|
-
cp: number[];
|
|
176
|
-
ep: number[];
|
|
177
|
-
ap: number[];
|
|
178
|
-
bp: number[];
|
|
179
|
-
}[];
|
|
124
|
+
declare let move_permutations: any;
|
|
180
125
|
declare let cached_mtables: {};
|
|
181
126
|
declare let cached_ptables: {};
|
|
182
127
|
declare let phase1_centre_colour_map: number[];
|
|
@@ -1,140 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare function counter(A: any): any[];
|
|
4
|
-
declare function factorial(n: any): any;
|
|
5
|
-
declare function factorial(n: any): any;
|
|
6
|
-
declare function factorial(n: any): any;
|
|
7
|
-
declare function C(n: any, k: any): number;
|
|
8
|
-
declare function C(n: any, k: any): number;
|
|
9
|
-
declare function C(n: any, k: any): number;
|
|
10
|
-
declare function permutation_to_index(perm: any): number;
|
|
11
|
-
declare function permutation_to_index(perm: any): number;
|
|
12
|
-
declare function permutation_to_index(perm: any): number;
|
|
13
|
-
declare function index_to_permutation(ind: any, n: any): number[];
|
|
14
|
-
declare function index_to_permutation(ind: any, n: any): number[];
|
|
15
|
-
declare function index_to_permutation(ind: any, n: any): number[];
|
|
16
|
-
declare function permutation_parity(A: any): number;
|
|
17
|
-
declare function permutation_parity(A: any): number;
|
|
18
|
-
declare function permutation_parity(A: any): number;
|
|
19
|
-
declare function index_to_evenpermutation(ind: any, n: any): number[];
|
|
20
|
-
declare function index_to_evenpermutation(ind: any, n: any): number[];
|
|
21
|
-
declare function index_to_evenpermutation(ind: any, n: any): number[];
|
|
22
|
-
declare function evenpermutation_to_index(perm: any): number;
|
|
23
|
-
declare function evenpermutation_to_index(perm: any): number;
|
|
24
|
-
declare function evenpermutation_to_index(perm: any): number;
|
|
25
|
-
declare function comb_to_index(l: any): number;
|
|
26
|
-
declare function comb_to_index(l: any): number;
|
|
27
|
-
declare function comb_to_index(l: any): number;
|
|
28
|
-
declare function index_to_comb(ind: any, ones: any, bits: any): any[];
|
|
29
|
-
declare function index_to_comb(ind: any, ones: any, bits: any): any[];
|
|
30
|
-
declare function index_to_comb(ind: any, ones: any, bits: any): any[];
|
|
31
|
-
declare function compose(A: any, B: any): any[];
|
|
32
|
-
declare function compose(A: any, B: any): any[];
|
|
33
|
-
declare function compose(A: any, B: any): any[];
|
|
34
|
-
declare function compose_o(A: any, B: any): any[][];
|
|
35
|
-
declare function compose_o(A: any, B: any): any[][];
|
|
36
|
-
declare function permutation_from_cycle(cycle: any, n: any): any[];
|
|
37
|
-
declare function permutation_from_cycle(cycle: any, n: any): any[];
|
|
38
|
-
declare function unsparsify_list(d: any, n: any): any[];
|
|
39
|
-
declare function unsparsify_list(d: any, n: any): any[];
|
|
40
|
-
declare function random_state(): any[];
|
|
41
|
-
declare function random_state(): any[][];
|
|
42
|
-
declare function stringify_move_sequence(move_sequence: any, no_wide?: boolean): any;
|
|
43
|
-
declare function stringify_move_sequence(move_sequence: any): any;
|
|
44
|
-
declare function stringify_move_sequence(move_sequence: any): any;
|
|
45
|
-
declare function print_move_sequence(move_sequence: any): void;
|
|
46
|
-
declare function print_move_sequence(move_sequence: any): void;
|
|
47
|
-
declare function print_move_sequence(move_sequence: any): void;
|
|
48
|
-
declare function apply_move_sequence(state: any, move_sequence: any): any;
|
|
49
|
-
declare function apply_move_sequence(state: any, move_sequence: any): any;
|
|
50
|
-
declare function apply_move_sequence(state: any, move_sequence: any): any;
|
|
51
|
-
declare function generate_random_state_scramble(): any;
|
|
52
|
-
declare function generate_random_state_scramble(): any;
|
|
53
|
-
declare function generate_random_state_scramble(): any;
|
|
54
|
-
declare function generate_random_move_scramble(M: any, N: any): number[][];
|
|
55
|
-
declare function map_piece_to_face(loc: any, ori: any): string;
|
|
56
|
-
declare function create_svg_template(state: any, colour_scheme: any): Element;
|
|
57
|
-
declare function draw_state(svgel: any, state: any, colour_scheme: any): any;
|
|
58
|
-
declare function solve_phase1(state: any): any;
|
|
59
|
-
declare function search_phase1(flags: any, depth: any, last: any): any;
|
|
60
|
-
declare function index_phase2(facelets: any): any[];
|
|
61
|
-
declare function index_phase2(state: any): number[];
|
|
62
|
-
declare function solve_phase2(facelets: any): any;
|
|
63
|
-
declare function solve_phase2(state: any): any;
|
|
64
|
-
declare function index_phase3(state: any): number[];
|
|
65
|
-
declare function solve_phase3(state: any): any;
|
|
66
|
-
declare function index_phase4(state: any): number[];
|
|
67
|
-
declare function solve_phase4(state: any): any;
|
|
68
|
-
declare function solve_phase4_fast(state: any): any;
|
|
69
|
-
declare function solve(facelets: any, readable?: boolean): any[][];
|
|
70
|
-
declare function solve(state: any): any[];
|
|
71
|
-
declare function solve(state: any): any;
|
|
72
|
-
declare function cn_solve(state: any): any;
|
|
73
|
-
declare function generate_phase23_orientation_mtable(): any;
|
|
74
|
-
declare function generate_phase2_orientation_ptable(): any;
|
|
75
|
-
declare function generate_phase3_orientation_ptable(): any;
|
|
76
|
-
declare function generate_phase23_permutation_mtable(): any;
|
|
77
|
-
declare function generate_phase2_permutation_ptable(): any;
|
|
78
|
-
declare function generate_phase3_permutation_ptable(): any;
|
|
79
|
-
declare function generate_phase4_orientation_mtable(): any;
|
|
80
|
-
declare function generate_phase4_permutation_mtable(): any;
|
|
81
|
-
declare function generate_phase4_orientation_ptable(): any;
|
|
82
|
-
declare function generate_phase4_permutation_ptable(): any;
|
|
83
|
-
declare function generate_phase4_near_ptable_list(threshold: any): any;
|
|
84
|
-
declare function binary_search(A: any, x: any): boolean;
|
|
85
|
-
declare function cache_all_tables(): void;
|
|
86
|
-
declare function bfs(mtable: any, goal_states: any): Int8Array;
|
|
87
|
-
declare function bfs(mtable: any, goal_states: any): any[];
|
|
88
|
-
declare function bfs(mtable: any, goal_states: any): any[];
|
|
89
|
-
declare function ida_solve(indices: any, mtables: any, ptables: any): any;
|
|
90
|
-
declare function ida_solve(indices: any, mtables: any, ptables: any, max_bound: any): any;
|
|
91
|
-
declare function ida_search(indices: any, mtables: any, ptables: any, bound: any, last: any): number[][] | undefined;
|
|
92
|
-
declare function ida_search(indices: any, mtables: any, ptables: any, bound: any, last: any): any;
|
|
93
|
-
declare function phase4_ida_solve(indices: any): any;
|
|
94
|
-
declare function phase4_ida_search(indices: any, bound: any, last: any, mtable_o: any, mtable_p: any, ptable_o: any, ptable_p: any, ptable_n: any): any;
|
|
95
|
-
declare function phase4_ida_solve_gen(indices: any): Generator<any, void, any>;
|
|
96
|
-
declare function phase4_ida_search_gen(indices: any, bound: any, last: any, mtable_o: any, mtable_p: any, ptable_o: any, ptable_p: any, ptable_n: any): any;
|
|
97
|
-
declare function generate_hs_mtable(): any;
|
|
98
|
-
declare function generate_hs_u_ptable(): any;
|
|
99
|
-
declare function generate_hs_d_ptable(): any;
|
|
100
|
-
declare function index_hs(state: any): number[];
|
|
101
|
-
declare function solve_hs(state: any): any;
|
|
102
|
-
declare function solve_hs_twophase(state: any): any;
|
|
103
|
-
declare function generate_hybrid_scramble(): any[][];
|
|
104
|
-
declare function generate_fullseparate_mtable(): any;
|
|
105
|
-
declare function generate_fullseparate_ptable(): any;
|
|
106
|
-
declare function bfs5(mtable: any, goal_states: any): any[];
|
|
107
|
-
declare let PHASE4_THRESHOLD: number;
|
|
108
|
-
declare function evenpermutation10_to_index(perm: any): number;
|
|
109
|
-
declare function index_to_evenpermutation10(ind: any, perm: any): any;
|
|
110
|
-
declare let move_U: any[][];
|
|
111
|
-
declare let move_R: any[][];
|
|
112
|
-
declare let move_F: any[][];
|
|
113
|
-
declare let move_L: any[][];
|
|
114
|
-
declare let move_BL: any[][];
|
|
115
|
-
declare let move_BR: any[][];
|
|
116
|
-
declare let move_x2: any[][];
|
|
117
|
-
declare let move_y: any[][];
|
|
118
|
-
declare let move_rot: number[][];
|
|
119
|
-
declare let moves: any[][];
|
|
120
|
-
declare let move_names: string[];
|
|
121
|
-
declare let id: any[][];
|
|
122
|
-
declare let moves_full: any[];
|
|
123
|
-
declare namespace default_colour_scheme {
|
|
124
|
-
const U: string;
|
|
125
|
-
const L: string;
|
|
126
|
-
const F: string;
|
|
127
|
-
const R: string;
|
|
128
|
-
const BR: string;
|
|
129
|
-
const BL: string;
|
|
130
|
-
const DBR: string;
|
|
131
|
-
const DB: string;
|
|
132
|
-
const DBL: string;
|
|
133
|
-
const DFL: string;
|
|
134
|
-
const DFR: string;
|
|
135
|
-
const D: string;
|
|
136
|
-
}
|
|
137
|
-
declare let face_names: string[];
|
|
138
|
-
declare let rotation_amounts: number[][];
|
|
139
|
-
declare let translation_amounts: any;
|
|
140
|
-
declare let tables: {};
|
|
1
|
+
export function getRandomKilominxScramble(): Promise<Alg>;
|
|
2
|
+
import { Alg } from "../../alg";
|
package/package.json
CHANGED
|
@@ -1,12 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cubing",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.6",
|
|
4
4
|
"description": "A collection of JavaScript cubing libraries.",
|
|
5
5
|
"author": "The js.cubing.net team",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"types": "dist/types/index.d.ts",
|
|
8
7
|
"license": "GPL-3.0-or-later",
|
|
9
8
|
"repository": "github:cubing/cubing.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./alg": {
|
|
11
|
+
"import": "./dist/esm/alg/index.js",
|
|
12
|
+
"types": "./dist/types/alg/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./bluetooth": {
|
|
15
|
+
"import": "./dist/esm/bluetooth/index.js",
|
|
16
|
+
"types": "./dist/types/bluetooth/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./kpuzzle": {
|
|
19
|
+
"import": "./dist/esm/kpuzzle/index.js",
|
|
20
|
+
"types": "./dist/types/kpuzzle/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./notation": {
|
|
23
|
+
"import": "./dist/esm/notation/index.js",
|
|
24
|
+
"types": "./dist/types/notation/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./protocol": {
|
|
27
|
+
"import": "./dist/esm/protocol/index.js",
|
|
28
|
+
"types": "./dist/types/protocol/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./puzzle-geometry": {
|
|
31
|
+
"import": "./dist/esm/puzzle-geometry/index.js",
|
|
32
|
+
"types": "./dist/esm/types/puzzle-geometry/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./puzzles": {
|
|
35
|
+
"import": "./dist/esm/puzzles/index.js",
|
|
36
|
+
"types": "./dist/esm/types-geometry/index.d.ts"
|
|
37
|
+
},
|
|
38
|
+
"./scramble": {
|
|
39
|
+
"import": "./dist/esm/scramble/index.js",
|
|
40
|
+
"types": "./dist/types/scramble/index.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./search": {
|
|
43
|
+
"import": "./dist/esm/search/index.js",
|
|
44
|
+
"types": "./dist/types/search/index.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./stream": {
|
|
47
|
+
"import": "./dist/esm/stream/index.js",
|
|
48
|
+
"types": "./dist/types/stream/index.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./twisty": {
|
|
51
|
+
"import": "./dist/esm/twisty/index.js",
|
|
52
|
+
"types": "./dist/types/twisty/index.d.ts"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
10
55
|
"dependencies": {
|
|
11
56
|
"@types/three": "^0.135.0",
|
|
12
57
|
"@types/web-bluetooth": "^0.0.12",
|
|
@@ -33,7 +78,7 @@
|
|
|
33
78
|
"peggy": "^1.1.0",
|
|
34
79
|
"prettier": "^2.2.1",
|
|
35
80
|
"puppeteer": "^13.1.2",
|
|
36
|
-
"typescript": "^4.
|
|
81
|
+
"typescript": "^4.6.0-dev.20220131",
|
|
37
82
|
"yargs": "^16.2.0"
|
|
38
83
|
},
|
|
39
84
|
"minimalDevDependencies": [
|
|
@@ -41,6 +86,16 @@
|
|
|
41
86
|
"esbuild",
|
|
42
87
|
"jszip"
|
|
43
88
|
],
|
|
89
|
+
"files": [
|
|
90
|
+
"/LICENSE.md",
|
|
91
|
+
"/README.md",
|
|
92
|
+
"/package.json",
|
|
93
|
+
"/package-lock.json",
|
|
94
|
+
"/dist/esm/**/*",
|
|
95
|
+
"/dist/types/**/*",
|
|
96
|
+
"/*/package.json",
|
|
97
|
+
"/*/index.d.ts"
|
|
98
|
+
],
|
|
44
99
|
"scripts": {
|
|
45
100
|
"build": "npm run clean && node ./script/build/main.js all",
|
|
46
101
|
"build-esm": "node ./script/build/main.js esm",
|
|
@@ -72,10 +127,6 @@
|
|
|
72
127
|
"lint": "npx eslint --ext=js,ts src script",
|
|
73
128
|
"prepack": "npm run clean && npm run build && npm run test-dist-esm-node-import"
|
|
74
129
|
},
|
|
75
|
-
"targets": {
|
|
76
|
-
"twizzle-net": {},
|
|
77
|
-
"experiments-cubing-net": {}
|
|
78
|
-
},
|
|
79
130
|
"keywords": [
|
|
80
131
|
"cubing",
|
|
81
132
|
"speedcubing",
|
|
@@ -87,6 +138,12 @@
|
|
|
87
138
|
"rubik",
|
|
88
139
|
"rubik's"
|
|
89
140
|
],
|
|
141
|
+
"prettier": {
|
|
142
|
+
"semi": true,
|
|
143
|
+
"trailingComma": "all",
|
|
144
|
+
"tabWidth": 2,
|
|
145
|
+
"quoteProps": "consistent"
|
|
146
|
+
},
|
|
90
147
|
"eslintConfig": {
|
|
91
148
|
"parser": "@babel/eslint-parser",
|
|
92
149
|
"parserOptions": {
|
|
@@ -159,58 +216,6 @@
|
|
|
159
216
|
"node": true
|
|
160
217
|
}
|
|
161
218
|
},
|
|
162
|
-
"prettier": {
|
|
163
|
-
"semi": true,
|
|
164
|
-
"trailingComma": "all",
|
|
165
|
-
"tabWidth": 2,
|
|
166
|
-
"quoteProps": "consistent"
|
|
167
|
-
},
|
|
168
|
-
"exports": {
|
|
169
|
-
"./alg": {
|
|
170
|
-
"import": "./dist/esm/alg/index.js",
|
|
171
|
-
"types": "./dist/types/alg/index.d.ts"
|
|
172
|
-
},
|
|
173
|
-
"./bluetooth": {
|
|
174
|
-
"import": "./dist/esm/bluetooth/index.js",
|
|
175
|
-
"types": "./dist/types/bluetooth/index.d.ts"
|
|
176
|
-
},
|
|
177
|
-
"./kpuzzle": {
|
|
178
|
-
"import": "./dist/esm/kpuzzle/index.js",
|
|
179
|
-
"types": "./dist/types/kpuzzle/index.d.ts"
|
|
180
|
-
},
|
|
181
|
-
"./notation": {
|
|
182
|
-
"import": "./dist/esm/notation/index.js",
|
|
183
|
-
"types": "./dist/types/notation/index.d.ts"
|
|
184
|
-
},
|
|
185
|
-
"./protocol": {
|
|
186
|
-
"import": "./dist/esm/protocol/index.js",
|
|
187
|
-
"types": "./dist/types/protocol/index.d.ts"
|
|
188
|
-
},
|
|
189
|
-
"./puzzle-geometry": {
|
|
190
|
-
"import": "./dist/esm/puzzle-geometry/index.js",
|
|
191
|
-
"types": "./dist/esm/types/puzzle-geometry/index.d.ts"
|
|
192
|
-
},
|
|
193
|
-
"./puzzles": {
|
|
194
|
-
"import": "./dist/esm/puzzles/index.js",
|
|
195
|
-
"types": "./dist/esm/types-geometry/index.d.ts"
|
|
196
|
-
},
|
|
197
|
-
"./scramble": {
|
|
198
|
-
"import": "./dist/esm/scramble/index.js",
|
|
199
|
-
"types": "./dist/types/scramble/index.d.ts"
|
|
200
|
-
},
|
|
201
|
-
"./search": {
|
|
202
|
-
"import": "./dist/esm/search/index.js",
|
|
203
|
-
"types": "./dist/types/search/index.d.ts"
|
|
204
|
-
},
|
|
205
|
-
"./stream": {
|
|
206
|
-
"import": "./dist/esm/stream/index.js",
|
|
207
|
-
"types": "./dist/types/stream/index.d.ts"
|
|
208
|
-
},
|
|
209
|
-
"./twisty": {
|
|
210
|
-
"import": "./dist/esm/twisty/index.js",
|
|
211
|
-
"types": "./dist/types/twisty/index.d.ts"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
219
|
"babel": {
|
|
215
220
|
"presets": [
|
|
216
221
|
[
|
|
@@ -230,15 +235,5 @@
|
|
|
230
235
|
"<rootDir>/script"
|
|
231
236
|
],
|
|
232
237
|
"coverageDirectory": "<rootDir>/.temp/coverage"
|
|
233
|
-
}
|
|
234
|
-
"files": [
|
|
235
|
-
"/LICENSE.md",
|
|
236
|
-
"/README.md",
|
|
237
|
-
"/package.json",
|
|
238
|
-
"/package-lock.json",
|
|
239
|
-
"/dist/esm/**/*",
|
|
240
|
-
"/dist/types/**/*",
|
|
241
|
-
"/*/package.json",
|
|
242
|
-
"/*/index.d.ts"
|
|
243
|
-
]
|
|
238
|
+
}
|
|
244
239
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/cubing/vendor/comlink-everywhere/inside/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { expose as comlinkExpose } from \"comlink\";\n\nconst useNodeWorkarounds =\n typeof globalThis.Worker === \"undefined\" &&\n typeof (globalThis as any).WorkerNavigator === \"undefined\";\n\n// Mangled so that bundlers don't try to inline the source.\nconst worker_threads_mangled = \"w-orker-_threa-ds\";\nconst worker_threads_unmangled = () => worker_threads_mangled.replace(/-/g, \"\");\n\nexport async function nodeEndpointPort(): Promise<MessagePort> {\n const { parentPort } = await import(worker_threads_unmangled()).catch();\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const nodeEndpoint = (await import(\"comlink/dist/esm/node-adapter.mjs\"))\n .default as (_: any) => MessagePort;\n return nodeEndpoint(parentPort);\n}\n\nexport function expose(api: any) {\n if (useNodeWorkarounds) {\n (async () => {\n comlinkExpose(api, await nodeEndpointPort());\n })();\n } else {\n comlinkExpose(api);\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAAA;AAEA,IAAM,qBACJ,OAAO,WAAW,WAAW,eAC7B,OAAQ,WAAmB,oBAAoB;AAGjD,IAAM,yBAAyB;AAC/B,IAAM,2BAA2B,MAAM,uBAAuB,QAAQ,MAAM;AAE5E,kCAA+D;AAC7D,QAAM,EAAE,eAAe,MAAM,OAAO,4BAA4B;AAGhE,QAAM,eAAgB,OAAM,OAAO,sCAChC;AACH,SAAO,aAAa;AAAA;AAGf,gBAAgB,KAAU;AAC/B,MAAI,oBAAoB;AACtB,IAAC,aAAY;AACX,oBAAc,KAAK,MAAM;AAAA;AAAA,SAEtB;AACL,kBAAc;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/cubing/search/inside/solve/puzzles/clock.ts", "../../src/cubing/search/inside/solve/puzzles/wca-minx.ts", "../../src/cubing/vendor/comlink-everywhere/node-adapter.ts", "../../src/cubing/vendor/comlink-everywhere/outside/index.ts", "../../src/cubing/search/inside/search-worker-entry-path-getter.ts", "../../src/cubing/search/instantiator.ts", "../../src/cubing/search/outside.ts"],
|
|
4
|
-
"sourcesContent": ["import { randomUIntBelowFactory } from \"../../../../vendor/random-uint-below\";\n\nconst pins = [\"UR\", \"DR\", \"DL\", \"UL\"];\nconst backMoves = [\"U\", \"R\", \"D\", \"L\", \"ALL\"];\nconst frontMoves = pins.concat(backMoves);\n\nconst randomUIntBelowPromise = randomUIntBelowFactory();\n\nexport async function randomClockScrambleString(): Promise<string> {\n const randomUIntBelow = await randomUIntBelowPromise;\n\n let filteringMoveCount = 0;\n\n async function randomSuffix(randomUIntBelow: (max: number) => number) {\n const amount = randomUIntBelow(12);\n if (amount !== 0) {\n filteringMoveCount++;\n }\n if (amount <= 6) {\n return `${amount}+`;\n } else {\n return `${12 - amount}-`;\n }\n }\n\n const moves = [];\n async function side(families: string[]): Promise<void> {\n for (const family of families) {\n moves.push(`${family}${await randomSuffix(randomUIntBelow)}`);\n }\n }\n\n await side(frontMoves);\n moves.push(\"y2\");\n await side(backMoves);\n\n // https://www.worldcubeassociation.org/regulations/#4b3\n if (filteringMoveCount < 2) {\n return randomClockScrambleString();\n }\n\n for (const pin of pins) {\n if (randomUIntBelow(2) === 0) {\n moves.push(pin);\n }\n }\n return moves.join(\" \");\n}\n", "import { randomUIntBelowFactory } from \"../../../../vendor/random-uint-below\";\n\nconst randomUIntBelowPromise = randomUIntBelowFactory();\n\nconst suffixes = [\"++\", \"--\"];\n\nexport async function randomMegaminxScrambleString(): Promise<string> {\n const randomUIntBelow = await randomUIntBelowPromise;\n\n function rdPair(): string {\n return `R${suffixes[randomUIntBelow(2)]} D${suffixes[randomUIntBelow(2)]}`;\n }\n\n function randomU(): string {\n return `U${[\"\", \"'\"][randomUIntBelow(2)]}`;\n }\n\n function row(): string {\n const chunks = [];\n for (let i = 0; i < 5; i++) {\n chunks.push(rdPair());\n }\n chunks.push(randomU());\n return chunks.join(\" \");\n }\n\n const chunks = [];\n for (let i = 0; i < 6; i++) {\n chunks.push(row());\n }\n return chunks.join(\"\\n\");\n}\n", "import type { Worker as NodeWorker } from \"worker_threads\";\n\n/**\n * Copyright 2019 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype EventHandler = EventListenerObject | ((event: any) => void);\n\nfunction nodeEndpoint(nep: NodeWorker): Worker & {\n nodeWorker?: import(\"worker_threads\").Worker;\n} {\n const listeners = new WeakMap();\n return {\n postMessage: nep.postMessage.bind(nep),\n addEventListener: (_: string, eh: EventHandler) => {\n const l = (data: Event) => {\n if (\"handleEvent\" in eh) {\n eh.handleEvent({ data } as any);\n } else {\n eh({ data });\n }\n };\n nep.on(\"message\", l);\n listeners.set(eh, l);\n },\n removeEventListener: (_: string, eh: EventHandler) => {\n const l = listeners.get(eh);\n if (!l) {\n return;\n }\n nep.off(\"message\", l);\n listeners.delete(eh);\n },\n nodeWorker: nep,\n // start: nep.start && nep.start.bind(nep),\n } as Worker & {\n nodeWorker?: import(\"worker_threads\").Worker;\n };\n}\n\nexport default nodeEndpoint;\n//# sourceMappingURL=node-adapter.mjs.map\n", "import nodeEndpoint from \"../node-adapter\";\n\nexport { wrap } from \"comlink\";\n// Mangled so that bundlers don't try to inline the source.\n\nconst worker_threads_mangled = \"w-orker-_threa-ds\";\nconst worker_threads_unmangled = () => worker_threads_mangled.replace(/-/g, \"\");\n\nconst useNodeWorkarounds =\n typeof globalThis.Worker === \"undefined\" &&\n typeof (globalThis as any).WorkerNavigator === \"undefined\";\n\nasync function nodeWorker(\n source: string | URL,\n options?: { eval?: boolean },\n): Promise<Worker> {\n const { Worker: NodeWorker } = await import(worker_threads_unmangled());\n const worker = new NodeWorker(source, options);\n worker.unref();\n return nodeEndpoint(worker);\n}\n\nexport async function constructWorker(\n source: string | URL,\n options?: { eval?: boolean; type?: WorkerType },\n): Promise<Worker> {\n let worker;\n if (useNodeWorkarounds) {\n return nodeWorker(source, { eval: options?.eval });\n } else {\n if (options?.eval) {\n const blob = new Blob([source as string], {\n type: \"application/javascript\",\n });\n source = URL.createObjectURL(blob);\n }\n worker = new globalThis.Worker(source, {\n type: options ? options.type : undefined, // TODO: Is it safe to use `options?.type`?\n });\n }\n return worker;\n}\n", "(globalThis as any).DO_NOT_EXPOSE_API = true;\n\nexport async function getWorkerEntryFileURL() {\n return (await import(\"./search-worker-entry\")).WORKER_ENTRY_FILE_URL;\n}\n", "import { constructWorker, wrap } from \"../vendor/comlink-everywhere/outside\";\nimport type { WorkerInsideAPI } from \"./inside/api\";\nimport { getWorkerEntryFileURL } from \"./inside/search-worker-entry-path-getter\";\n\nconst MODULE_WORKER_TIMEOUT_MILLISECONDS = 5000;\nexport async function instantiateModuleWorker(): Promise<WorkerInsideAPI> {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise<WorkerInsideAPI>(async (resolve, reject) => {\n const timeoutID = setTimeout(() => {\n reject(new Error(\"module instantiation timeout\"));\n }, MODULE_WORKER_TIMEOUT_MILLISECONDS);\n\n try {\n const workerEntryFileURL = await getWorkerEntryFileURL();\n if (!workerEntryFileURL) {\n // This happens in `bundle-global`.\n reject(new Error(\"Could not get worker entry file URL.\"));\n }\n let url: string | URL;\n if (globalThis.Blob) {\n // Standard browser-like environment.\n const importSrc = `import \"${workerEntryFileURL}\";`;\n const blob = new Blob([importSrc], {\n type: \"text/javascript\",\n });\n url = URL.createObjectURL(blob);\n } else {\n // `node` doesn't have `Blob`. We can keep the original entry file URL there, but we have to wrap it.\n // Needed for `node`\n url = new URL(workerEntryFileURL);\n }\n\n const worker = (await constructWorker(url, {\n type: \"module\",\n })) as Worker & {\n nodeWorker?: import(\"worker_threads\").Worker;\n };\n\n const onError = (e: ErrorEvent) => {\n // TODO: Remove fallback when Firefox implements module workers: https://bugzilla.mozilla.org/show_bug.cgi?id=1247687\n if (e.message?.startsWith(\"SyntaxError\")) {\n reject(e);\n }\n };\n\n const onFirstMessage = (messageData: string) => {\n if (messageData === \"comlink-exposed\") {\n // We need to clear the timeout so that we don't prevent `node` from exiting in the meantime.\n clearTimeout(timeoutID);\n resolve(wrap<WorkerInsideAPI>(worker));\n } else {\n reject(\n new Error(\"wrong module instantiation message \" + messageData),\n );\n }\n };\n\n if (worker.nodeWorker) {\n // We have to use `once` so the `unref()` from `comlink-everywhere` allows the process to quite as expected.\n worker.nodeWorker.once(\"message\", onFirstMessage);\n } else {\n worker.addEventListener(\"error\", onError, {\n once: true,\n });\n worker.addEventListener(\"message\", (e) => onFirstMessage(e.data), {\n once: true,\n });\n }\n } catch (e) {\n reject(e);\n }\n });\n}\n\nexport async function instantiateWorker(): Promise<WorkerInsideAPI> {\n try {\n // `await` is important for `catch` to work.\n return await instantiateModuleWorker();\n } catch (e) {\n console.warn(\n \"Could not instantiate module worker (this is expected in Firefox and `bundle-global`). Falling back to string worker.\",\n e,\n );\n const { workerSource } = await import(\n \"./worker-inside-generated-string.js\"\n );\n const worker = await constructWorker(workerSource, { eval: true });\n return wrap(worker);\n }\n}\n", "import { Alg } from \"../alg\";\n// import { preInitialize222 } from \"../implementations/2x2x2\";\nimport { randomClockScrambleString } from \"./inside/solve/puzzles/clock\"; // TODO: don't reach into `inside` code.\nimport { randomMegaminxScrambleString } from \"./inside/solve/puzzles/wca-minx\"; // TODO: don't reach into `inside` code.\nimport { instantiateWorker } from \"./instantiator\";\nimport type { WorkerInsideAPI } from \"./inside/api\";\nimport type { KState } from \"../kpuzzle/KState\";\n\nlet cachedWorkerInstance: Promise<WorkerInsideAPI> | null = null;\nasync function getCachedWorkerInstance(): Promise<WorkerInsideAPI> {\n return await (cachedWorkerInstance ??= instantiateWorker());\n}\n\n// Pre-initialize the scrambler for the given event. (Otherwise, an event is\n// initialized the first time you ask for a scramble for that event.)\n//\n// Some typical numbers for a fast computer:\n// - 3x3x3 initialization: 200ms\n// - Each 3x3x3 scramble: 50ms\n// - 4x4x4 initialization: 2500ms\n// - Each 4x4x4 scramble: 300ms to 800ms\n//\n// It is safe to immediately call for a scramble\n// any time after starting pre-initialization, or to call for them without\n// pre-initializing. Pre-initializing essentially gives the scramble worker a\n// head start in case a scramble doesn't get requested immediately.\n//\n// Note that events cannot be pre-initialized in parallel. Attempting to\n// pre-initialize multiple events will initialize them consecutively. Scrambles\n// for a given event cannot be computed while another event is being initialized.\nexport function _preInitializationHintForEvent(\n eventID: string,\n // callback?: () => void\n): void {\n switch (eventID) {\n case \"clock\":\n case \"minx\":\n return;\n case \"333oh\":\n return _preInitializationHintForEvent(\"333\");\n }\n (async () => {\n await (await getCachedWorkerInstance()).initialize(eventID);\n })();\n}\n\nexport async function randomScrambleForEvent(eventID: string): Promise<Alg> {\n switch (eventID) {\n case \"clock\":\n return Alg.fromString(await randomClockScrambleString());\n case \"minx\":\n return Alg.fromString(await randomMegaminxScrambleString());\n }\n const prom = _randomScrambleStringForEvent(eventID);\n const wat = await prom;\n return Alg.fromString(wat);\n}\n\nexport async function _randomScrambleStringForEvent(\n eventID: string,\n): Promise<string> {\n const cwi = await getCachedWorkerInstance();\n return cwi.randomScrambleStringForEvent(eventID);\n}\n\nexport async function randomScrambleStringForEvent(\n eventID: string,\n): Promise<string> {\n switch (eventID) {\n case \"clock\":\n return randomClockScrambleString();\n case \"minx\":\n return randomMegaminxScrambleString();\n }\n return await _randomScrambleStringForEvent(eventID);\n}\n\nexport async function experimentalSolve3x3x3IgnoringCenters(\n state: KState,\n): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(await cwi.solve333ToString(state.stateData));\n}\n\nexport async function experimentalSolve2x2x2(state: KState): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(await cwi.solve222ToString(state.stateData));\n}\n\nexport async function solveSkewb(state: KState): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(await cwi.solveSkewbToString(state.stateData));\n}\n\nexport async function solvePyraminx(state: KState): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(await cwi.solvePyraminxToString(state.stateData));\n}\n\nexport async function solveMegaminx(state: KState): Promise<Alg> {\n const cwi = await getCachedWorkerInstance();\n return Alg.fromString(await cwi.solveMegaminxToString(state.stateData));\n}\n\nexport function setDebug(options: { logPerf?: boolean }): void {\n const { logPerf } = options;\n if (typeof logPerf !== \"undefined\") {\n getCachedWorkerInstance().then((cwi) => cwi.setDebugMeasurePerf(logPerf));\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAEA,IAAM,OAAO,CAAC,MAAM,MAAM,MAAM;AAChC,IAAM,YAAY,CAAC,KAAK,KAAK,KAAK,KAAK;AACvC,IAAM,aAAa,KAAK,OAAO;AAE/B,IAAM,yBAAyB;AAE/B,2CAAmE;AACjE,QAAM,kBAAkB,MAAM;AAE9B,MAAI,qBAAqB;AAEzB,8BAA4B,kBAA0C;AACpE,UAAM,SAAS,iBAAgB;AAC/B,QAAI,WAAW,GAAG;AAChB;AAAA;AAEF,QAAI,UAAU,GAAG;AACf,aAAO,GAAG;AAAA,WACL;AACL,aAAO,GAAG,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