cubing 0.55.1 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/bin/scramble.js +1 -0
  2. package/dist/bin/scramble.js.map +2 -2
  3. package/dist/lib/cubing/{KPattern-BXlfgC6b.d.ts → PuzzleLoader-DWqO9l1G.d.ts} +44 -43
  4. package/dist/lib/cubing/alg/index.d.ts +3 -3
  5. package/dist/lib/cubing/bluetooth/index.d.ts +7 -7
  6. package/dist/lib/cubing/bluetooth/index.js +7 -6
  7. package/dist/lib/cubing/bluetooth/index.js.map +2 -2
  8. package/dist/lib/cubing/{bluetooth-puzzle-CkZw4jC6.d.ts → bluetooth-puzzle-C6TIIh-Z.d.ts} +1 -1
  9. package/dist/lib/cubing/chunks/{chunk-Y5U55NHQ.js → chunk-KO64SKMG.js} +3 -3
  10. package/dist/lib/cubing/chunks/{chunk-WELOEBCE.js → chunk-M4T7GO54.js} +77 -83
  11. package/dist/lib/cubing/chunks/chunk-M4T7GO54.js.map +7 -0
  12. package/dist/lib/cubing/chunks/{chunk-PJH5IVDC.js → chunk-MA47PABE.js} +2 -2
  13. package/dist/lib/cubing/chunks/{chunk-MFK4M6PV.js → chunk-WOAANT6Y.js} +23 -14
  14. package/dist/lib/cubing/chunks/chunk-WOAANT6Y.js.map +7 -0
  15. package/dist/lib/cubing/chunks/{chunk-55STZK6V.js → chunk-XKTLEY2R.js} +2 -2
  16. package/dist/lib/cubing/chunks/chunk-XKTLEY2R.js.map +7 -0
  17. package/dist/lib/cubing/chunks/{chunk-JS5PDZ4D.js → chunk-XPH22PGR.js} +1 -1
  18. package/dist/lib/cubing/chunks/{chunk-2QDTMC3W.js → chunk-YFGRXDD4.js} +2 -2
  19. package/dist/lib/cubing/chunks/{chunk-SGPKF5IH.js → chunk-YQVHA4F6.js} +1 -1
  20. package/dist/lib/cubing/chunks/{inside-KP7ZR25G.js → inside-KAVAZETT.js} +10 -10
  21. package/dist/lib/cubing/chunks/{puzzles-dynamic-side-events-QIADTLKJ.js → puzzles-dynamic-side-events-AHFPWEBD.js} +24 -143
  22. package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-AHFPWEBD.js.map +7 -0
  23. package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-EGIM6IYZ.js → search-dynamic-sgs-side-events-FTWMZ5ZJ.js} +3 -3
  24. package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-R2TXOWXD.js → search-dynamic-sgs-unofficial-ZYGVRJQK.js} +3 -3
  25. package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-JXJRJXQ6.js → search-dynamic-solve-4x4x4-6MKLH6KJ.js} +5 -5
  26. package/dist/lib/cubing/chunks/search-worker-entry.js +1 -1
  27. package/dist/lib/cubing/chunks/{twisty-dynamic-3d-H7YMZQPB.js → twisty-dynamic-3d-QGRCHB6L.js} +47 -40
  28. package/dist/lib/cubing/chunks/twisty-dynamic-3d-QGRCHB6L.js.map +7 -0
  29. package/dist/lib/cubing/chunks/{twsearch-HWA5BU3S.js → twsearch-ITWEA5PO.js} +4 -4
  30. package/dist/lib/cubing/chunks/twsearch-ITWEA5PO.js.map +7 -0
  31. package/dist/lib/cubing/chunks/twsearch_wasm_bg-NHUYB5UW-HHHVHFI5.js +10 -0
  32. package/dist/lib/cubing/chunks/twsearch_wasm_bg-NHUYB5UW-HHHVHFI5.js.map +7 -0
  33. package/dist/lib/cubing/{index-BaPEgEPZ.d.ts → index-g0IQg962.d.ts} +1 -1
  34. package/dist/lib/cubing/kpuzzle/index.d.ts +2 -2
  35. package/dist/lib/cubing/notation/index.d.ts +2 -2
  36. package/dist/lib/cubing/notation/index.js +2 -2
  37. package/dist/lib/cubing/protocol/index.d.ts +2 -2
  38. package/dist/lib/cubing/protocol/index.js +2 -2
  39. package/dist/lib/cubing/puzzle-geometry/index.d.ts +3 -3
  40. package/dist/lib/cubing/puzzle-geometry/index.js +167 -52
  41. package/dist/lib/cubing/puzzle-geometry/index.js.map +2 -2
  42. package/dist/lib/cubing/puzzles/index.d.ts +2 -2
  43. package/dist/lib/cubing/puzzles/index.js +2 -2
  44. package/dist/lib/cubing/scramble/index.d.ts +3 -3
  45. package/dist/lib/cubing/scramble/index.js +4 -4
  46. package/dist/lib/cubing/search/index.d.ts +3 -3
  47. package/dist/lib/cubing/search/index.js +4 -4
  48. package/dist/lib/cubing/stream/index.d.ts +3 -3
  49. package/dist/lib/cubing/twisty/index.d.ts +3 -3
  50. package/dist/lib/cubing/twisty/index.js +23 -18
  51. package/dist/lib/cubing/twisty/index.js.map +3 -3
  52. package/package.json +5 -5
  53. package/dist/lib/cubing/chunks/chunk-55STZK6V.js.map +0 -7
  54. package/dist/lib/cubing/chunks/chunk-MFK4M6PV.js.map +0 -7
  55. package/dist/lib/cubing/chunks/chunk-WELOEBCE.js.map +0 -7
  56. package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-QIADTLKJ.js.map +0 -7
  57. package/dist/lib/cubing/chunks/twisty-dynamic-3d-H7YMZQPB.js.map +0 -7
  58. package/dist/lib/cubing/chunks/twsearch-HWA5BU3S.js.map +0 -7
  59. package/dist/lib/cubing/chunks/twsearch_wasm_bg-BI4JVWGR-OGWODKOA.js +0 -10
  60. package/dist/lib/cubing/chunks/twsearch_wasm_bg-BI4JVWGR-OGWODKOA.js.map +0 -7
  61. /package/dist/lib/cubing/chunks/{chunk-Y5U55NHQ.js.map → chunk-KO64SKMG.js.map} +0 -0
  62. /package/dist/lib/cubing/chunks/{chunk-PJH5IVDC.js.map → chunk-MA47PABE.js.map} +0 -0
  63. /package/dist/lib/cubing/chunks/{chunk-JS5PDZ4D.js.map → chunk-XPH22PGR.js.map} +0 -0
  64. /package/dist/lib/cubing/chunks/{chunk-2QDTMC3W.js.map → chunk-YFGRXDD4.js.map} +0 -0
  65. /package/dist/lib/cubing/chunks/{chunk-SGPKF5IH.js.map → chunk-YQVHA4F6.js.map} +0 -0
  66. /package/dist/lib/cubing/chunks/{inside-KP7ZR25G.js.map → inside-KAVAZETT.js.map} +0 -0
  67. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-side-events-EGIM6IYZ.js.map → search-dynamic-sgs-side-events-FTWMZ5ZJ.js.map} +0 -0
  68. /package/dist/lib/cubing/chunks/{search-dynamic-sgs-unofficial-R2TXOWXD.js.map → search-dynamic-sgs-unofficial-ZYGVRJQK.js.map} +0 -0
  69. /package/dist/lib/cubing/chunks/{search-dynamic-solve-4x4x4-JXJRJXQ6.js.map → search-dynamic-solve-4x4x4-6MKLH6KJ.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { s as Alg, K as KPattern, v as KPuzzle } from './KPattern-BXlfgC6b.js';
1
+ import { s as Alg, K as KPattern, v as KPuzzle } from './PuzzleLoader-DWqO9l1G.js';
2
2
 
3
3
  declare enum PrefetchLevel {
4
4
  Auto = "auto",
@@ -1,2 +1,2 @@
1
- export { K as KPattern, a9 as KPatternData, aa as KPatternOrbitData, v as KPuzzle, a8 as KPuzzleDefinition, z as KTransformation, ab as KTransformationData, ac as KTransformationOrbitData } from '../KPattern-BXlfgC6b.js';
2
- import 'three';
1
+ export { K as KPattern, a9 as KPatternData, aa as KPatternOrbitData, v as KPuzzle, a8 as KPuzzleDefinition, z as KTransformation, ab as KTransformationData, ac as KTransformationOrbitData } from '../PuzzleLoader-DWqO9l1G.js';
2
+ import 'three/src/Three.js';
@@ -1,5 +1,5 @@
1
- import { s as Alg, t as PuzzleLoader } from '../KPattern-BXlfgC6b.js';
2
- import 'three';
1
+ import { s as Alg, t as PuzzleLoader } from '../PuzzleLoader-DWqO9l1G.js';
2
+ import 'three/src/Three.js';
3
3
 
4
4
  declare enum CommonMetric {
5
5
  OuterBlockTurnMetric = "OBTM",
@@ -5,8 +5,8 @@ import {
5
5
  countMetricMoves,
6
6
  countMoves,
7
7
  countMovesETM
8
- } from "../chunks/chunk-PJH5IVDC.js";
9
- import "../chunks/chunk-SGPKF5IH.js";
8
+ } from "../chunks/chunk-MA47PABE.js";
9
+ import "../chunks/chunk-YQVHA4F6.js";
10
10
  import "../chunks/chunk-TQF5J7MH.js";
11
11
  import "../chunks/chunk-2SBMIHZV.js";
12
12
  export {
@@ -1,5 +1,5 @@
1
- import { K as KPattern } from '../KPattern-BXlfgC6b.js';
2
- import 'three';
1
+ import { K as KPattern } from '../PuzzleLoader-DWqO9l1G.js';
2
+ import 'three/src/Three.js';
3
3
 
4
4
  type Binary3x3x3Pattern = Uint8Array;
5
5
  interface Binary3x3x3Components {
@@ -5,8 +5,8 @@ import {
5
5
  spacedHexToBuffer,
6
6
  twizzleBinaryToBinaryComponents,
7
7
  twizzleBinaryToReid3x3x3
8
- } from "../chunks/chunk-2QDTMC3W.js";
9
- import "../chunks/chunk-SGPKF5IH.js";
8
+ } from "../chunks/chunk-YFGRXDD4.js";
9
+ import "../chunks/chunk-YQVHA4F6.js";
10
10
  import "../chunks/chunk-TQF5J7MH.js";
11
11
  import "../chunks/chunk-2SBMIHZV.js";
12
12
  export {
@@ -1,6 +1,6 @@
1
- import { P as Perm } from '../KPattern-BXlfgC6b.js';
2
- export { q as EXPERIMENTAL_PUZZLE_BASE_SHAPES, n as EXPERIMENTAL_PUZZLE_CUT_TYPES, k as ExperimentalPGNotation, r as ExperimentalPuzzleBaseShape, l as ExperimentalPuzzleCutDescription, o as ExperimentalPuzzleCutType, m as ExperimentalPuzzleDescription, j as ExperimentalPuzzleGeometryOptions, d as PuzzleGeometry, Q as Quat, S as StickerDat, e as StickerDatAxis, f as StickerDatFace, h as StickerDatSticker, c as getPG3DNamedPuzzles, g as getPuzzleDescriptionString, a as getPuzzleGeometryByDesc, b as getPuzzleGeometryByName, i as parseOptions, p as parsePuzzleDescription } from '../KPattern-BXlfgC6b.js';
3
- import 'three';
1
+ import { P as Perm } from '../PuzzleLoader-DWqO9l1G.js';
2
+ export { q as EXPERIMENTAL_PUZZLE_BASE_SHAPES, n as EXPERIMENTAL_PUZZLE_CUT_TYPES, k as ExperimentalPGNotation, r as ExperimentalPuzzleBaseShape, l as ExperimentalPuzzleCutDescription, o as ExperimentalPuzzleCutType, m as ExperimentalPuzzleDescription, j as ExperimentalPuzzleGeometryOptions, d as PuzzleGeometry, Q as Quat, S as StickerDat, e as StickerDatAxis, f as StickerDatFace, h as StickerDatSticker, c as getPG3DNamedPuzzles, g as getPuzzleDescriptionString, a as getPuzzleGeometryByDesc, b as getPuzzleGeometryByName, i as parseOptions, p as parsePuzzleDescription } from '../PuzzleLoader-DWqO9l1G.js';
3
+ import 'three/src/Three.js';
4
4
 
5
5
  declare function schreierSims(g: Perm[], disp: (s: string) => void): bigint;
6
6
 
@@ -2512,7 +2512,7 @@ function findelement(a, p) {
2512
2512
  return i;
2513
2513
  }
2514
2514
  }
2515
- throw new Error("Element not found");
2515
+ throw Error("Element not found");
2516
2516
  }
2517
2517
  function getPG3DNamedPuzzles() {
2518
2518
  return PGPuzzles;
@@ -2546,7 +2546,7 @@ function parsePuzzleDescription(s) {
2546
2546
  function getPuzzleGeometryByDesc(desc, options = {}) {
2547
2547
  const parsed = parsePuzzleDescription(desc);
2548
2548
  if (parsed === null) {
2549
- throw new Error("Could not parse the puzzle description");
2549
+ throw Error("Could not parse the puzzle description");
2550
2550
  }
2551
2551
  const pg = new PuzzleGeometry(
2552
2552
  parsed,
@@ -2580,7 +2580,7 @@ function getmovename(geo, bits, slices) {
2580
2580
  movenamePrefix = String(bits[1] + 1);
2581
2581
  }
2582
2582
  } else {
2583
- throw new Error(
2583
+ throw Error(
2584
2584
  `We only support slice and outer block moves right now. ${bits}`
2585
2585
  );
2586
2586
  }
@@ -2603,7 +2603,7 @@ function splitByFaceNames(s, facenames) {
2603
2603
  r.push(currentMatch);
2604
2604
  at += currentMatch.length;
2605
2605
  } else {
2606
- throw new Error(`Could not split ${s} into face names.`);
2606
+ throw Error(`Could not split ${s} into face names.`);
2607
2607
  }
2608
2608
  }
2609
2609
  return r;
@@ -2716,7 +2716,7 @@ var PuzzleGeometry = class {
2716
2716
  swizzler;
2717
2717
  notationMapper = new NullMapper();
2718
2718
  addNotationMapper = "";
2719
- setReidOrder = false;
2719
+ setReidOrSpeffzOrder = false;
2720
2720
  options;
2721
2721
  create(puzzleDescription) {
2722
2722
  const { shape, cuts } = puzzleDescription;
@@ -2747,7 +2747,7 @@ var PuzzleGeometry = class {
2747
2747
  break;
2748
2748
  }
2749
2749
  default:
2750
- throw new Error(`Bad shape argument: ${shape}`);
2750
+ throw Error(`Bad shape argument: ${shape}`);
2751
2751
  }
2752
2752
  this.rotations = closure(g);
2753
2753
  if (this.options.verbosity) {
@@ -2809,7 +2809,7 @@ var PuzzleGeometry = class {
2809
2809
  break;
2810
2810
  }
2811
2811
  default:
2812
- throw new Error(`Bad cut argument: ${cut.cutType}`);
2812
+ throw Error(`Bad cut argument: ${cut.cutType}`);
2813
2813
  }
2814
2814
  cutplanes.push(normal.makecut(cut.distance));
2815
2815
  intersects.push(cut.distance < distance);
@@ -2865,7 +2865,7 @@ var PuzzleGeometry = class {
2865
2865
  } else if (i === el[2]) {
2866
2866
  facelist.push(el[1]);
2867
2867
  } else {
2868
- throw new Error("Could not find edge");
2868
+ throw Error("Could not find edge");
2869
2869
  }
2870
2870
  }
2871
2871
  otherfaces.push(facelist);
@@ -2880,7 +2880,7 @@ var PuzzleGeometry = class {
2880
2880
  const f0 = neti[0];
2881
2881
  const fi = facenametoindex[f0];
2882
2882
  if (fi === void 0) {
2883
- throw new Error("Bad edge description; first edge not connected");
2883
+ throw Error("Bad edge description; first edge not connected");
2884
2884
  }
2885
2885
  let ii = -1;
2886
2886
  for (let j = 0; j < otherfaces[fi].length; j++) {
@@ -2891,7 +2891,7 @@ var PuzzleGeometry = class {
2891
2891
  }
2892
2892
  }
2893
2893
  if (ii < 0) {
2894
- throw new Error("First element of a net not known");
2894
+ throw Error("First element of a net not known");
2895
2895
  }
2896
2896
  for (let j = 2; j < neti.length; j++) {
2897
2897
  if (neti[j] === "") {
@@ -2900,7 +2900,7 @@ var PuzzleGeometry = class {
2900
2900
  const of = otherfaces[fi][(j + ii - 1) % edgesperface];
2901
2901
  const fn2 = faceindextoname[of];
2902
2902
  if (fn2 !== void 0 && fn2 !== neti[j]) {
2903
- throw new Error("Face mismatch in net");
2903
+ throw Error("Face mismatch in net");
2904
2904
  }
2905
2905
  faceindextoname[of] = neti[j];
2906
2906
  facenametoindex[neti[j]] = of;
@@ -2965,7 +2965,7 @@ var PuzzleGeometry = class {
2965
2965
  }
2966
2966
  for (let i = 0; i < edgenames.length; i++) {
2967
2967
  if (edgenames[i].length !== 3) {
2968
- throw new Error(`Bad length in edge names ${edgenames[i]}`);
2968
+ throw Error(`Bad length in edge names ${edgenames[i]}`);
2969
2969
  }
2970
2970
  const f1 = edgenames[i][1];
2971
2971
  const f2 = edgenames[i][2];
@@ -2982,7 +2982,7 @@ var PuzzleGeometry = class {
2982
2982
  for (let i = 0; i < vertexnames.length; i++) {
2983
2983
  let bits = 0;
2984
2984
  if (vertexnames[i].length < 4) {
2985
- throw new Error("Bad length in vertex names");
2985
+ throw Error("Bad length in vertex names");
2986
2986
  }
2987
2987
  for (let j = 1; j < vertexnames[i].length; j++) {
2988
2988
  bits |= 1 << facenametoindex[vertexnames[i][j][0]];
@@ -2995,7 +2995,7 @@ var PuzzleGeometry = class {
2995
2995
  }
2996
2996
  }
2997
2997
  if (st < 0) {
2998
- throw new Error(
2998
+ throw Error(
2999
2999
  "Internal error; couldn't find face name when fixing corners"
3000
3000
  );
3001
3001
  }
@@ -3127,7 +3127,7 @@ var PuzzleGeometry = class {
3127
3127
  }
3128
3128
  if (shape === "c" && sawface && !sawedge && !sawvertex) {
3129
3129
  this.addNotationMapper = "NxNxNCubeMapper";
3130
- this.setReidOrder = true;
3130
+ this.setReidOrSpeffzOrder = true;
3131
3131
  }
3132
3132
  if (shape === "c" && sawvertex && !sawface && !sawedge) {
3133
3133
  this.addNotationMapper = "SkewbMapper";
@@ -3257,6 +3257,16 @@ var PuzzleGeometry = class {
3257
3257
  );
3258
3258
  return [x1, y1, off];
3259
3259
  }
3260
+ // Given an string of uppercase letters, make a bitmask
3261
+ // indicating what letters are in it. Cheap swizzling
3262
+ // for internal use.
3263
+ upperStringToBitSet(geo) {
3264
+ let r = 0;
3265
+ for (let i = 0; i < geo.length; i++) {
3266
+ r |= 1 << geo.charCodeAt(i) - 65;
3267
+ }
3268
+ return r;
3269
+ }
3260
3270
  allstickers() {
3261
3271
  const t1 = tstart("allstickers");
3262
3272
  this.faces = expandfaces(this.baseplanerot, this.faces);
@@ -3357,7 +3367,7 @@ var PuzzleGeometry = class {
3357
3367
  }
3358
3368
  }
3359
3369
  if (pos === null || neg === null) {
3360
- throw new Error("Saw positive or negative sides as null");
3370
+ throw Error("Saw positive or negative sides as null");
3361
3371
  }
3362
3372
  movesetgeos.push([
3363
3373
  pos[0],
@@ -3455,7 +3465,7 @@ var PuzzleGeometry = class {
3455
3465
  break;
3456
3466
  }
3457
3467
  if (looplimit > 1e3) {
3458
- throw new Error("Bad epsilon math; too close to border");
3468
+ throw Error("Bad epsilon math; too close to border");
3459
3469
  }
3460
3470
  }
3461
3471
  let bits = 0;
@@ -3470,7 +3480,7 @@ var PuzzleGeometry = class {
3470
3480
  }
3471
3481
  }
3472
3482
  if (mini < 0) {
3473
- throw new Error("Could not find marked face in list");
3483
+ throw Error("Could not find marked face in list");
3474
3484
  }
3475
3485
  if (mini !== 0) {
3476
3486
  const ofacelist = facelist.slice();
@@ -3550,7 +3560,7 @@ var PuzzleGeometry = class {
3550
3560
  }
3551
3561
  cubiesetnum++;
3552
3562
  }
3553
- if (this.setReidOrder && 4 <= this.stickersperface && this.stickersperface <= 9) {
3563
+ if (this.setReidOrSpeffzOrder && 4 <= this.stickersperface) {
3554
3564
  const reidorder = [
3555
3565
  [
3556
3566
  "UF",
@@ -3569,23 +3579,130 @@ var PuzzleGeometry = class {
3569
3579
  ["UFR", "URB", "UBL", "ULF", "DRF", "DFL", "DLB", "DBR"],
3570
3580
  ["U", "L", "F", "R", "B", "D"]
3571
3581
  ];
3582
+ const spefffaceorder = ["U", "L", "F", "R", "B", "D"];
3583
+ const speffcornerorder = [
3584
+ "UBL",
3585
+ "URB",
3586
+ "UFR",
3587
+ "ULF",
3588
+ "UBL",
3589
+ "ULF",
3590
+ "DFL",
3591
+ "DLB",
3592
+ "ULF",
3593
+ "UFR",
3594
+ "DRF",
3595
+ "DFL",
3596
+ "UFR",
3597
+ "URB",
3598
+ "DBR",
3599
+ "DRF",
3600
+ "URB",
3601
+ "UBL",
3602
+ "DLB",
3603
+ "DBR",
3604
+ "DFL",
3605
+ "DRF",
3606
+ "DBR",
3607
+ "DLB"
3608
+ ];
3572
3609
  const reidmap = {};
3573
3610
  for (const cubie of reidorder) {
3574
3611
  for (let j = 0; j < cubie.length; j++) {
3575
- let mask = 0;
3576
- for (let k = 0; k < cubie[j].length; k++) {
3577
- mask |= 1 << cubie[j].charCodeAt(k) - 65;
3578
- }
3579
- reidmap[mask] = j;
3612
+ reidmap[this.upperStringToBitSet(cubie[j])] = j;
3613
+ }
3614
+ }
3615
+ const cornerloc = {};
3616
+ const spefffacelookup = {};
3617
+ const speffcornerlocs = [];
3618
+ const speffuncorner = [
3619
+ -1,
3620
+ 0,
3621
+ 1,
3622
+ 0,
3623
+ 2,
3624
+ -1,
3625
+ 1,
3626
+ -1,
3627
+ 3,
3628
+ 3,
3629
+ -1,
3630
+ -1,
3631
+ 2,
3632
+ -1,
3633
+ -1,
3634
+ -1
3635
+ ];
3636
+ if (this.stickersperface > 9) {
3637
+ for (const vertex of this.vertexnames) {
3638
+ cornerloc[this.upperStringToBitSet(vertex[1])] = vertex[0];
3639
+ }
3640
+ for (let i = 0; i < 6; i++) {
3641
+ spefffacelookup[spefffaceorder[i]] = i;
3642
+ }
3643
+ for (const co of speffcornerorder) {
3644
+ speffcornerlocs.push(cornerloc[this.upperStringToBitSet(co)]);
3580
3645
  }
3581
3646
  }
3582
3647
  for (const cubieset of cubiesetcubies) {
3583
3648
  for (const cubienum of cubieset) {
3584
- let mask = 0;
3585
- for (const cubie of cubies[cubienum]) {
3586
- mask |= 1 << this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65;
3649
+ if (cubies[cubienum].length === 3 || this.stickersperface <= 9) {
3650
+ let mask = 0;
3651
+ for (const cubie of cubies[cubienum]) {
3652
+ mask |= 1 << this.facenames[this.getfaceindex(cubie)][1].charCodeAt(0) - 65;
3653
+ }
3654
+ cubieordnums[cubienum] = reidmap[mask];
3655
+ } else {
3656
+ if (cubies[cubienum].length <= 2) {
3657
+ const ordset = [];
3658
+ for (let k = 0; k < cubies[cubienum].length; k++) {
3659
+ const sticker = cubies[cubienum][k];
3660
+ const facekey = spefffacelookup[this.facenames[this.getfaceindex(sticker)][1]];
3661
+ let bestdist = 1e20;
3662
+ const cubieloc = this.faces[sticker].centermass();
3663
+ let bestmask = 0;
3664
+ for (let i = 0; i < 4; i++) {
3665
+ const t = cubieloc.dist(speffcornerlocs[4 * facekey + i]);
3666
+ if (t + eps3 < bestdist) {
3667
+ bestdist = t;
3668
+ bestmask = 1 << i;
3669
+ } else if (t < bestdist + eps3) {
3670
+ bestmask |= 1 << i;
3671
+ }
3672
+ }
3673
+ bestmask = speffuncorner[bestmask];
3674
+ if (bestmask >= 0) {
3675
+ const speffind = 4 * facekey + bestmask;
3676
+ ordset.push([speffind, speffcornerorder[speffind]]);
3677
+ }
3678
+ }
3679
+ if (ordset.length > 0) {
3680
+ if (cubies[cubienum].length === 1) {
3681
+ cubieordnums[cubienum] = ordset[0][0];
3682
+ } else if (ordset.length === 2 && ordset[0][1] === ordset[1][1]) {
3683
+ let k = 0;
3684
+ const f0c = spefffaceorder[ordset[0][0] >> 2];
3685
+ const f1c = spefffaceorder[ordset[1][0] >> 2];
3686
+ const corn = ordset[0][1];
3687
+ while (k < 3 && (f0c === corn.charAt(k) || f1c === corn.charAt(k))) {
3688
+ k++;
3689
+ }
3690
+ if (k === 3) {
3691
+ throw Error("Internal error (2) in Speffz");
3692
+ }
3693
+ k = (k + 1) % 3;
3694
+ if (f0c === corn.charAt(k)) {
3695
+ cubieordnums[cubienum] = ordset[0][0];
3696
+ } else if (f1c === corn.charAt(k)) {
3697
+ cubieordnums[cubienum] = ordset[1][0];
3698
+ } else {
3699
+ console.log(f0c, f1c, corn, k, ordset);
3700
+ throw Error("Internal error (3) in Speffz");
3701
+ }
3702
+ }
3703
+ }
3704
+ }
3587
3705
  }
3588
- cubieordnums[cubienum] = reidmap[mask];
3589
3706
  }
3590
3707
  }
3591
3708
  }
@@ -3604,7 +3721,7 @@ var PuzzleGeometry = class {
3604
3721
  }
3605
3722
  }
3606
3723
  if (this.fixedCubie < 0) {
3607
- throw new Error(
3724
+ throw Error(
3608
3725
  `Could not find a cubie of type ${this.options.fixedPieceType} to fix.`
3609
3726
  );
3610
3727
  }
@@ -3627,14 +3744,14 @@ var PuzzleGeometry = class {
3627
3744
  const re = /^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$/;
3628
3745
  const p = mv.match(re);
3629
3746
  if (p === null) {
3630
- throw new Error(`Bad move passed ${mv}`);
3747
+ throw Error(`Bad move passed ${mv}`);
3631
3748
  }
3632
3749
  const grip = p[4];
3633
3750
  let loslice = void 0;
3634
3751
  let hislice = void 0;
3635
3752
  if (p[2] !== void 0) {
3636
3753
  if (p[3] === void 0) {
3637
- throw new Error("Missing second number in range");
3754
+ throw Error("Missing second number in range");
3638
3755
  }
3639
3756
  loslice = parseInt(p[2], 10);
3640
3757
  }
@@ -3655,14 +3772,14 @@ var PuzzleGeometry = class {
3655
3772
  parseMove(move) {
3656
3773
  const bm = this.notationMapper.notationToInternal(move);
3657
3774
  if (bm === null) {
3658
- throw new Error(`Bad move ${move.family}`);
3775
+ throw Error(`Bad move ${move.family}`);
3659
3776
  }
3660
3777
  move = bm;
3661
3778
  let grip = move.family;
3662
3779
  let fullrotation = false;
3663
3780
  if (grip.endsWith("v") && grip[0] <= "Z") {
3664
3781
  if (move.innerLayer !== void 0 || move.outerLayer !== void 0) {
3665
- throw new Error("Cannot use a prefix with full cube rotations");
3782
+ throw Error("Cannot use a prefix with full cube rotations");
3666
3783
  }
3667
3784
  grip = grip.slice(0, -1);
3668
3785
  fullrotation = true;
@@ -3693,7 +3810,7 @@ var PuzzleGeometry = class {
3693
3810
  hislice = 2;
3694
3811
  }
3695
3812
  if (geo === void 0) {
3696
- throw new Error(`Bad grip in move ${move.family}`);
3813
+ throw Error(`Bad grip in move ${move.family}`);
3697
3814
  }
3698
3815
  if (move.outerLayer !== void 0) {
3699
3816
  loslice = move.outerLayer;
@@ -3717,14 +3834,12 @@ var PuzzleGeometry = class {
3717
3834
  hislice = this.moveplanesets[msi].length;
3718
3835
  }
3719
3836
  if (loslice < 0 || loslice > this.moveplanesets[msi].length || hislice < 0 || hislice > this.moveplanesets[msi].length) {
3720
- throw new Error(
3837
+ throw Error(
3721
3838
  `Bad slice spec ${loslice} ${hislice} vs ${this.moveplanesets[msi].length}`
3722
3839
  );
3723
3840
  }
3724
3841
  if (!permissivieMoveParsing && loslice === 0 && hislice === this.moveplanesets[msi].length && !fullrotation) {
3725
- throw new Error(
3726
- "! full puzzle rotations must be specified with v suffix."
3727
- );
3842
+ throw Error("! full puzzle rotations must be specified with v suffix.");
3728
3843
  }
3729
3844
  return [void 0, msi, loslice, hislice, firstgrip, move.amount];
3730
3845
  }
@@ -3845,7 +3960,7 @@ var PuzzleGeometry = class {
3845
3960
  }
3846
3961
  }
3847
3962
  if (o < 0) {
3848
- throw new Error(
3963
+ throw Error(
3849
3964
  "Couldn't find rotation of center faces; ignoring for now."
3850
3965
  );
3851
3966
  } else {
@@ -3870,7 +3985,7 @@ var PuzzleGeometry = class {
3870
3985
  }
3871
3986
  if (b.length > 2 && !cubiedone[b[0]]) {
3872
3987
  if (b.length !== 2 * this.movesetorders[k]) {
3873
- throw new Error("Bad length in perm gen");
3988
+ throw Error("Bad length in perm gen");
3874
3989
  }
3875
3990
  for (const v of b) {
3876
3991
  axiscmoves[sc].push(v);
@@ -4076,7 +4191,7 @@ ${comment}
4076
4191
  const internalDefinition = od.toKPuzzleDefinition(includemoves);
4077
4192
  internalDefinition.experimentalPuzzleDescription = this.puzzleDescription;
4078
4193
  if (!internalDefinition) {
4079
- throw new Error("Missing definition!");
4194
+ throw Error("Missing definition!");
4080
4195
  }
4081
4196
  return internalDefinition;
4082
4197
  }
@@ -4234,7 +4349,7 @@ ${comment}
4234
4349
  }
4235
4350
  }
4236
4351
  if (found < 0) {
4237
- throw new Error("Could not find rotation");
4352
+ throw Error("Could not find rotation");
4238
4353
  }
4239
4354
  const cmp = mps[found];
4240
4355
  if (cmp.length !== mps[k].length || this.moveplanesets[k].length !== this.moveplanesets[found].length || this.diffmvsets(
@@ -4260,7 +4375,7 @@ ${comment}
4260
4375
  } else if (addrot[i] === 3) {
4261
4376
  addrot[i] = 0;
4262
4377
  } else {
4263
- throw new Error("Impossible addrot val");
4378
+ throw Error("Impossible addrot val");
4264
4379
  }
4265
4380
  }
4266
4381
  }
@@ -4276,7 +4391,7 @@ ${comment}
4276
4391
  for (let i = 0; i < moveset.length; i += 2) {
4277
4392
  for (let j = 0; j < i; j += 2) {
4278
4393
  if (moveset[i][0] === moveset[j][0] && moveset[i][1] === moveset[j][1]) {
4279
- throw new Error("Redundant moves in moveset.");
4394
+ throw Error("Redundant moves in moveset.");
4280
4395
  }
4281
4396
  }
4282
4397
  }
@@ -4460,10 +4575,10 @@ ${comment}
4460
4575
  }
4461
4576
  }
4462
4577
  if (!feature1) {
4463
- throw new Error(`Could not find feature ${feature1name}`);
4578
+ throw Error(`Could not find feature ${feature1name}`);
4464
4579
  }
4465
4580
  if (!feature2) {
4466
- throw new Error(`Could not find feature ${feature2name}`);
4581
+ throw Error(`Could not find feature ${feature2name}`);
4467
4582
  }
4468
4583
  const r1 = feature1.pointrotation(direction1);
4469
4584
  const feature2rot = feature2.rotatepoint(r1);
@@ -4482,7 +4597,7 @@ ${comment}
4482
4597
  orientationDescription = defaultOrientations()[basefacecount];
4483
4598
  }
4484
4599
  if (!orientationDescription) {
4485
- throw new Error("No default orientation?");
4600
+ throw Error("No default orientation?");
4486
4601
  }
4487
4602
  return this.getOrientationRotation(orientationDescription);
4488
4603
  }
@@ -4508,7 +4623,7 @@ ${comment}
4508
4623
  const polyn = face0.length;
4509
4624
  const net = this.net;
4510
4625
  if (net === null) {
4511
- throw new Error("No net?");
4626
+ throw Error("No net?");
4512
4627
  }
4513
4628
  const edges = {};
4514
4629
  let minx = 0;
@@ -4523,7 +4638,7 @@ ${comment}
4523
4638
  for (const neti of net) {
4524
4639
  const f0 = neti[0];
4525
4640
  if (!edges[f0]) {
4526
- throw new Error("Bad edge description; first edge not connected.");
4641
+ throw Error("Bad edge description; first edge not connected.");
4527
4642
  }
4528
4643
  for (let j = 1; j < neti.length; j++) {
4529
4644
  const f1 = neti[j];
@@ -4564,7 +4679,7 @@ ${comment}
4564
4679
  for (const neti of net) {
4565
4680
  const f0 = neti[0];
4566
4681
  if (!edges2[f0]) {
4567
- throw new Error("Bad edge description; first edge not connected.");
4682
+ throw Error("Bad edge description; first edge not connected.");
4568
4683
  }
4569
4684
  let gfi = -1;
4570
4685
  for (let j = 0; j < bg.facenames.length; j++) {
@@ -4574,7 +4689,7 @@ ${comment}
4574
4689
  }
4575
4690
  }
4576
4691
  if (gfi < 0) {
4577
- throw new Error(`Could not find first face name ${f0}`);
4692
+ throw Error(`Could not find first face name ${f0}`);
4578
4693
  }
4579
4694
  const thisface = bg.facenames[gfi][0];
4580
4695
  for (let j = 1; j < neti.length; j++) {
@@ -4601,7 +4716,7 @@ ${comment}
4601
4716
  }
4602
4717
  }
4603
4718
  if (gf1i < 0) {
4604
- throw new Error("Could not find second face name");
4719
+ throw Error("Could not find second face name");
4605
4720
  }
4606
4721
  const otherface = bg.facenames[gf1i][0];
4607
4722
  for (let k = 0; k < otherface.length; k++) {