guessit-js 3.9.0 → 4.0.1

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.
@@ -2239,7 +2239,7 @@ const WORD_NUMERALS = {
2239
2239
  "trois": 3,
2240
2240
  "quatre": 4,
2241
2241
  "cinq": 5,
2242
- "six": 6,
2242
+ // 'six' is shared with the English list above (same spelling and value)
2243
2243
  "sept": 7,
2244
2244
  "huit": 8,
2245
2245
  "neuf": 9,
@@ -2304,6 +2304,857 @@ function and_(...validators) {
2304
2304
  function or_(...validators) {
2305
2305
  return (m) => validators.some((v) => v(m));
2306
2306
  }
2307
+ const DIACRITIC_FOLD = {
2308
+ "À": "A",
2309
+ "Á": "A",
2310
+ "Â": "A",
2311
+ "Ã": "A",
2312
+ "Ä": "A",
2313
+ "Å": "A",
2314
+ "Ç": "C",
2315
+ "È": "E",
2316
+ "É": "E",
2317
+ "Ê": "E",
2318
+ "Ë": "E",
2319
+ "Ì": "I",
2320
+ "Í": "I",
2321
+ "Î": "I",
2322
+ "Ï": "I",
2323
+ "Ñ": "N",
2324
+ "Ò": "O",
2325
+ "Ó": "O",
2326
+ "Ô": "O",
2327
+ "Õ": "O",
2328
+ "Ö": "O",
2329
+ "Ù": "U",
2330
+ "Ú": "U",
2331
+ "Û": "U",
2332
+ "Ü": "U",
2333
+ "Ý": "Y",
2334
+ "à": "a",
2335
+ "á": "a",
2336
+ "â": "a",
2337
+ "ã": "a",
2338
+ "ä": "a",
2339
+ "å": "a",
2340
+ "ç": "c",
2341
+ "è": "e",
2342
+ "é": "e",
2343
+ "ê": "e",
2344
+ "ë": "e",
2345
+ "ì": "i",
2346
+ "í": "i",
2347
+ "î": "i",
2348
+ "ï": "i",
2349
+ "ñ": "n",
2350
+ "ò": "o",
2351
+ "ó": "o",
2352
+ "ô": "o",
2353
+ "õ": "o",
2354
+ "ö": "o",
2355
+ "ù": "u",
2356
+ "ú": "u",
2357
+ "û": "u",
2358
+ "ü": "u",
2359
+ "ý": "y",
2360
+ "ÿ": "y",
2361
+ "Ā": "A",
2362
+ "ā": "a",
2363
+ "Ă": "A",
2364
+ "ă": "a",
2365
+ "Ą": "A",
2366
+ "ą": "a",
2367
+ "Ć": "C",
2368
+ "ć": "c",
2369
+ "Ĉ": "C",
2370
+ "ĉ": "c",
2371
+ "Ċ": "C",
2372
+ "ċ": "c",
2373
+ "Č": "C",
2374
+ "č": "c",
2375
+ "Ď": "D",
2376
+ "ď": "d",
2377
+ "Ē": "E",
2378
+ "ē": "e",
2379
+ "Ĕ": "E",
2380
+ "ĕ": "e",
2381
+ "Ė": "E",
2382
+ "ė": "e",
2383
+ "Ę": "E",
2384
+ "ę": "e",
2385
+ "Ě": "E",
2386
+ "ě": "e",
2387
+ "Ĝ": "G",
2388
+ "ĝ": "g",
2389
+ "Ğ": "G",
2390
+ "ğ": "g",
2391
+ "Ġ": "G",
2392
+ "ġ": "g",
2393
+ "Ģ": "G",
2394
+ "ģ": "g",
2395
+ "Ĥ": "H",
2396
+ "ĥ": "h",
2397
+ "Ĩ": "I",
2398
+ "ĩ": "i",
2399
+ "Ī": "I",
2400
+ "ī": "i",
2401
+ "Ĭ": "I",
2402
+ "ĭ": "i",
2403
+ "Į": "I",
2404
+ "į": "i",
2405
+ "İ": "I",
2406
+ "Ĵ": "J",
2407
+ "ĵ": "j",
2408
+ "Ķ": "K",
2409
+ "ķ": "k",
2410
+ "Ĺ": "L",
2411
+ "ĺ": "l",
2412
+ "Ļ": "L",
2413
+ "ļ": "l",
2414
+ "Ľ": "L",
2415
+ "ľ": "l",
2416
+ "Ń": "N",
2417
+ "ń": "n",
2418
+ "Ņ": "N",
2419
+ "ņ": "n",
2420
+ "Ň": "N",
2421
+ "ň": "n",
2422
+ "Ō": "O",
2423
+ "ō": "o",
2424
+ "Ŏ": "O",
2425
+ "ŏ": "o",
2426
+ "Ő": "O",
2427
+ "ő": "o",
2428
+ "Ŕ": "R",
2429
+ "ŕ": "r",
2430
+ "Ŗ": "R",
2431
+ "ŗ": "r",
2432
+ "Ř": "R",
2433
+ "ř": "r",
2434
+ "Ś": "S",
2435
+ "ś": "s",
2436
+ "Ŝ": "S",
2437
+ "ŝ": "s",
2438
+ "Ş": "S",
2439
+ "ş": "s",
2440
+ "Š": "S",
2441
+ "š": "s",
2442
+ "Ţ": "T",
2443
+ "ţ": "t",
2444
+ "Ť": "T",
2445
+ "ť": "t",
2446
+ "Ũ": "U",
2447
+ "ũ": "u",
2448
+ "Ū": "U",
2449
+ "ū": "u",
2450
+ "Ŭ": "U",
2451
+ "ŭ": "u",
2452
+ "Ů": "U",
2453
+ "ů": "u",
2454
+ "Ű": "U",
2455
+ "ű": "u",
2456
+ "Ų": "U",
2457
+ "ų": "u",
2458
+ "Ŵ": "W",
2459
+ "ŵ": "w",
2460
+ "Ŷ": "Y",
2461
+ "ŷ": "y",
2462
+ "Ÿ": "Y",
2463
+ "Ź": "Z",
2464
+ "ź": "z",
2465
+ "Ż": "Z",
2466
+ "ż": "z",
2467
+ "Ž": "Z",
2468
+ "ž": "z",
2469
+ "Ơ": "O",
2470
+ "ơ": "o",
2471
+ "Ư": "U",
2472
+ "ư": "u",
2473
+ "Ǎ": "A",
2474
+ "ǎ": "a",
2475
+ "Ǐ": "I",
2476
+ "ǐ": "i",
2477
+ "Ǒ": "O",
2478
+ "ǒ": "o",
2479
+ "Ǔ": "U",
2480
+ "ǔ": "u",
2481
+ "Ǖ": "U",
2482
+ "ǖ": "u",
2483
+ "Ǘ": "U",
2484
+ "ǘ": "u",
2485
+ "Ǚ": "U",
2486
+ "ǚ": "u",
2487
+ "Ǜ": "U",
2488
+ "ǜ": "u",
2489
+ "Ǟ": "A",
2490
+ "ǟ": "a",
2491
+ "Ǡ": "A",
2492
+ "ǡ": "a",
2493
+ "Ǣ": "Æ",
2494
+ "ǣ": "æ",
2495
+ "Ǧ": "G",
2496
+ "ǧ": "g",
2497
+ "Ǩ": "K",
2498
+ "ǩ": "k",
2499
+ "Ǫ": "O",
2500
+ "ǫ": "o",
2501
+ "Ǭ": "O",
2502
+ "ǭ": "o",
2503
+ "Ǯ": "Ʒ",
2504
+ "ǯ": "ʒ",
2505
+ "ǰ": "j",
2506
+ "Ǵ": "G",
2507
+ "ǵ": "g",
2508
+ "Ǹ": "N",
2509
+ "ǹ": "n",
2510
+ "Ǻ": "A",
2511
+ "ǻ": "a",
2512
+ "Ǽ": "Æ",
2513
+ "ǽ": "æ",
2514
+ "Ǿ": "Ø",
2515
+ "ǿ": "ø",
2516
+ "Ȁ": "A",
2517
+ "ȁ": "a",
2518
+ "Ȃ": "A",
2519
+ "ȃ": "a",
2520
+ "Ȅ": "E",
2521
+ "ȅ": "e",
2522
+ "Ȇ": "E",
2523
+ "ȇ": "e",
2524
+ "Ȉ": "I",
2525
+ "ȉ": "i",
2526
+ "Ȋ": "I",
2527
+ "ȋ": "i",
2528
+ "Ȍ": "O",
2529
+ "ȍ": "o",
2530
+ "Ȏ": "O",
2531
+ "ȏ": "o",
2532
+ "Ȑ": "R",
2533
+ "ȑ": "r",
2534
+ "Ȓ": "R",
2535
+ "ȓ": "r",
2536
+ "Ȕ": "U",
2537
+ "ȕ": "u",
2538
+ "Ȗ": "U",
2539
+ "ȗ": "u",
2540
+ "Ș": "S",
2541
+ "ș": "s",
2542
+ "Ț": "T",
2543
+ "ț": "t",
2544
+ "Ȟ": "H",
2545
+ "ȟ": "h",
2546
+ "Ȧ": "A",
2547
+ "ȧ": "a",
2548
+ "Ȩ": "E",
2549
+ "ȩ": "e",
2550
+ "Ȫ": "O",
2551
+ "ȫ": "o",
2552
+ "Ȭ": "O",
2553
+ "ȭ": "o",
2554
+ "Ȯ": "O",
2555
+ "ȯ": "o",
2556
+ "Ȱ": "O",
2557
+ "ȱ": "o",
2558
+ "Ȳ": "Y",
2559
+ "ȳ": "y",
2560
+ "΅": "¨",
2561
+ "Ά": "Α",
2562
+ "Έ": "Ε",
2563
+ "Ή": "Η",
2564
+ "Ί": "Ι",
2565
+ "Ό": "Ο",
2566
+ "Ύ": "Υ",
2567
+ "Ώ": "Ω",
2568
+ "ΐ": "ι",
2569
+ "Ϊ": "Ι",
2570
+ "Ϋ": "Υ",
2571
+ "ά": "α",
2572
+ "έ": "ε",
2573
+ "ή": "η",
2574
+ "ί": "ι",
2575
+ "ΰ": "υ",
2576
+ "ϊ": "ι",
2577
+ "ϋ": "υ",
2578
+ "ό": "ο",
2579
+ "ύ": "υ",
2580
+ "ώ": "ω",
2581
+ "ϓ": "ϒ",
2582
+ "ϔ": "ϒ",
2583
+ "Ѐ": "Е",
2584
+ "Ё": "Е",
2585
+ "Ѓ": "Г",
2586
+ "Ї": "І",
2587
+ "Ќ": "К",
2588
+ "Ѝ": "И",
2589
+ "Ў": "У",
2590
+ "Й": "И",
2591
+ "й": "и",
2592
+ "ѐ": "е",
2593
+ "ё": "е",
2594
+ "ѓ": "г",
2595
+ "ї": "і",
2596
+ "ќ": "к",
2597
+ "ѝ": "и",
2598
+ "ў": "у",
2599
+ "Ѷ": "Ѵ",
2600
+ "ѷ": "ѵ",
2601
+ "Ӂ": "Ж",
2602
+ "ӂ": "ж",
2603
+ "Ӑ": "А",
2604
+ "ӑ": "а",
2605
+ "Ӓ": "А",
2606
+ "ӓ": "а",
2607
+ "Ӗ": "Е",
2608
+ "ӗ": "е",
2609
+ "Ӛ": "Ә",
2610
+ "ӛ": "ә",
2611
+ "Ӝ": "Ж",
2612
+ "ӝ": "ж",
2613
+ "Ӟ": "З",
2614
+ "ӟ": "з",
2615
+ "Ӣ": "И",
2616
+ "ӣ": "и",
2617
+ "Ӥ": "И",
2618
+ "ӥ": "и",
2619
+ "Ӧ": "О",
2620
+ "ӧ": "о",
2621
+ "Ӫ": "Ө",
2622
+ "ӫ": "ө",
2623
+ "Ӭ": "Э",
2624
+ "ӭ": "э",
2625
+ "Ӯ": "У",
2626
+ "ӯ": "у",
2627
+ "Ӱ": "У",
2628
+ "ӱ": "у",
2629
+ "Ӳ": "У",
2630
+ "ӳ": "у",
2631
+ "Ӵ": "Ч",
2632
+ "ӵ": "ч",
2633
+ "Ӹ": "Ы",
2634
+ "ӹ": "ы",
2635
+ "Ḁ": "A",
2636
+ "ḁ": "a",
2637
+ "Ḃ": "B",
2638
+ "ḃ": "b",
2639
+ "Ḅ": "B",
2640
+ "ḅ": "b",
2641
+ "Ḇ": "B",
2642
+ "ḇ": "b",
2643
+ "Ḉ": "C",
2644
+ "ḉ": "c",
2645
+ "Ḋ": "D",
2646
+ "ḋ": "d",
2647
+ "Ḍ": "D",
2648
+ "ḍ": "d",
2649
+ "Ḏ": "D",
2650
+ "ḏ": "d",
2651
+ "Ḑ": "D",
2652
+ "ḑ": "d",
2653
+ "Ḓ": "D",
2654
+ "ḓ": "d",
2655
+ "Ḕ": "E",
2656
+ "ḕ": "e",
2657
+ "Ḗ": "E",
2658
+ "ḗ": "e",
2659
+ "Ḙ": "E",
2660
+ "ḙ": "e",
2661
+ "Ḛ": "E",
2662
+ "ḛ": "e",
2663
+ "Ḝ": "E",
2664
+ "ḝ": "e",
2665
+ "Ḟ": "F",
2666
+ "ḟ": "f",
2667
+ "Ḡ": "G",
2668
+ "ḡ": "g",
2669
+ "Ḣ": "H",
2670
+ "ḣ": "h",
2671
+ "Ḥ": "H",
2672
+ "ḥ": "h",
2673
+ "Ḧ": "H",
2674
+ "ḧ": "h",
2675
+ "Ḩ": "H",
2676
+ "ḩ": "h",
2677
+ "Ḫ": "H",
2678
+ "ḫ": "h",
2679
+ "Ḭ": "I",
2680
+ "ḭ": "i",
2681
+ "Ḯ": "I",
2682
+ "ḯ": "i",
2683
+ "Ḱ": "K",
2684
+ "ḱ": "k",
2685
+ "Ḳ": "K",
2686
+ "ḳ": "k",
2687
+ "Ḵ": "K",
2688
+ "ḵ": "k",
2689
+ "Ḷ": "L",
2690
+ "ḷ": "l",
2691
+ "Ḹ": "L",
2692
+ "ḹ": "l",
2693
+ "Ḻ": "L",
2694
+ "ḻ": "l",
2695
+ "Ḽ": "L",
2696
+ "ḽ": "l",
2697
+ "Ḿ": "M",
2698
+ "ḿ": "m",
2699
+ "Ṁ": "M",
2700
+ "ṁ": "m",
2701
+ "Ṃ": "M",
2702
+ "ṃ": "m",
2703
+ "Ṅ": "N",
2704
+ "ṅ": "n",
2705
+ "Ṇ": "N",
2706
+ "ṇ": "n",
2707
+ "Ṉ": "N",
2708
+ "ṉ": "n",
2709
+ "Ṋ": "N",
2710
+ "ṋ": "n",
2711
+ "Ṍ": "O",
2712
+ "ṍ": "o",
2713
+ "Ṏ": "O",
2714
+ "ṏ": "o",
2715
+ "Ṑ": "O",
2716
+ "ṑ": "o",
2717
+ "Ṓ": "O",
2718
+ "ṓ": "o",
2719
+ "Ṕ": "P",
2720
+ "ṕ": "p",
2721
+ "Ṗ": "P",
2722
+ "ṗ": "p",
2723
+ "Ṙ": "R",
2724
+ "ṙ": "r",
2725
+ "Ṛ": "R",
2726
+ "ṛ": "r",
2727
+ "Ṝ": "R",
2728
+ "ṝ": "r",
2729
+ "Ṟ": "R",
2730
+ "ṟ": "r",
2731
+ "Ṡ": "S",
2732
+ "ṡ": "s",
2733
+ "Ṣ": "S",
2734
+ "ṣ": "s",
2735
+ "Ṥ": "S",
2736
+ "ṥ": "s",
2737
+ "Ṧ": "S",
2738
+ "ṧ": "s",
2739
+ "Ṩ": "S",
2740
+ "ṩ": "s",
2741
+ "Ṫ": "T",
2742
+ "ṫ": "t",
2743
+ "Ṭ": "T",
2744
+ "ṭ": "t",
2745
+ "Ṯ": "T",
2746
+ "ṯ": "t",
2747
+ "Ṱ": "T",
2748
+ "ṱ": "t",
2749
+ "Ṳ": "U",
2750
+ "ṳ": "u",
2751
+ "Ṵ": "U",
2752
+ "ṵ": "u",
2753
+ "Ṷ": "U",
2754
+ "ṷ": "u",
2755
+ "Ṹ": "U",
2756
+ "ṹ": "u",
2757
+ "Ṻ": "U",
2758
+ "ṻ": "u",
2759
+ "Ṽ": "V",
2760
+ "ṽ": "v",
2761
+ "Ṿ": "V",
2762
+ "ṿ": "v",
2763
+ "Ẁ": "W",
2764
+ "ẁ": "w",
2765
+ "Ẃ": "W",
2766
+ "ẃ": "w",
2767
+ "Ẅ": "W",
2768
+ "ẅ": "w",
2769
+ "Ẇ": "W",
2770
+ "ẇ": "w",
2771
+ "Ẉ": "W",
2772
+ "ẉ": "w",
2773
+ "Ẋ": "X",
2774
+ "ẋ": "x",
2775
+ "Ẍ": "X",
2776
+ "ẍ": "x",
2777
+ "Ẏ": "Y",
2778
+ "ẏ": "y",
2779
+ "Ẑ": "Z",
2780
+ "ẑ": "z",
2781
+ "Ẓ": "Z",
2782
+ "ẓ": "z",
2783
+ "Ẕ": "Z",
2784
+ "ẕ": "z",
2785
+ "ẖ": "h",
2786
+ "ẗ": "t",
2787
+ "ẘ": "w",
2788
+ "ẙ": "y",
2789
+ "ẛ": "ſ",
2790
+ "Ạ": "A",
2791
+ "ạ": "a",
2792
+ "Ả": "A",
2793
+ "ả": "a",
2794
+ "Ấ": "A",
2795
+ "ấ": "a",
2796
+ "Ầ": "A",
2797
+ "ầ": "a",
2798
+ "Ẩ": "A",
2799
+ "ẩ": "a",
2800
+ "Ẫ": "A",
2801
+ "ẫ": "a",
2802
+ "Ậ": "A",
2803
+ "ậ": "a",
2804
+ "Ắ": "A",
2805
+ "ắ": "a",
2806
+ "Ằ": "A",
2807
+ "ằ": "a",
2808
+ "Ẳ": "A",
2809
+ "ẳ": "a",
2810
+ "Ẵ": "A",
2811
+ "ẵ": "a",
2812
+ "Ặ": "A",
2813
+ "ặ": "a",
2814
+ "Ẹ": "E",
2815
+ "ẹ": "e",
2816
+ "Ẻ": "E",
2817
+ "ẻ": "e",
2818
+ "Ẽ": "E",
2819
+ "ẽ": "e",
2820
+ "Ế": "E",
2821
+ "ế": "e",
2822
+ "Ề": "E",
2823
+ "ề": "e",
2824
+ "Ể": "E",
2825
+ "ể": "e",
2826
+ "Ễ": "E",
2827
+ "ễ": "e",
2828
+ "Ệ": "E",
2829
+ "ệ": "e",
2830
+ "Ỉ": "I",
2831
+ "ỉ": "i",
2832
+ "Ị": "I",
2833
+ "ị": "i",
2834
+ "Ọ": "O",
2835
+ "ọ": "o",
2836
+ "Ỏ": "O",
2837
+ "ỏ": "o",
2838
+ "Ố": "O",
2839
+ "ố": "o",
2840
+ "Ồ": "O",
2841
+ "ồ": "o",
2842
+ "Ổ": "O",
2843
+ "ổ": "o",
2844
+ "Ỗ": "O",
2845
+ "ỗ": "o",
2846
+ "Ộ": "O",
2847
+ "ộ": "o",
2848
+ "Ớ": "O",
2849
+ "ớ": "o",
2850
+ "Ờ": "O",
2851
+ "ờ": "o",
2852
+ "Ở": "O",
2853
+ "ở": "o",
2854
+ "Ỡ": "O",
2855
+ "ỡ": "o",
2856
+ "Ợ": "O",
2857
+ "ợ": "o",
2858
+ "Ụ": "U",
2859
+ "ụ": "u",
2860
+ "Ủ": "U",
2861
+ "ủ": "u",
2862
+ "Ứ": "U",
2863
+ "ứ": "u",
2864
+ "Ừ": "U",
2865
+ "ừ": "u",
2866
+ "Ử": "U",
2867
+ "ử": "u",
2868
+ "Ữ": "U",
2869
+ "ữ": "u",
2870
+ "Ự": "U",
2871
+ "ự": "u",
2872
+ "Ỳ": "Y",
2873
+ "ỳ": "y",
2874
+ "Ỵ": "Y",
2875
+ "ỵ": "y",
2876
+ "Ỷ": "Y",
2877
+ "ỷ": "y",
2878
+ "Ỹ": "Y",
2879
+ "ỹ": "y",
2880
+ "ἀ": "α",
2881
+ "ἁ": "α",
2882
+ "ἂ": "α",
2883
+ "ἃ": "α",
2884
+ "ἄ": "α",
2885
+ "ἅ": "α",
2886
+ "ἆ": "α",
2887
+ "ἇ": "α",
2888
+ "Ἀ": "Α",
2889
+ "Ἁ": "Α",
2890
+ "Ἂ": "Α",
2891
+ "Ἃ": "Α",
2892
+ "Ἄ": "Α",
2893
+ "Ἅ": "Α",
2894
+ "Ἆ": "Α",
2895
+ "Ἇ": "Α",
2896
+ "ἐ": "ε",
2897
+ "ἑ": "ε",
2898
+ "ἒ": "ε",
2899
+ "ἓ": "ε",
2900
+ "ἔ": "ε",
2901
+ "ἕ": "ε",
2902
+ "Ἐ": "Ε",
2903
+ "Ἑ": "Ε",
2904
+ "Ἒ": "Ε",
2905
+ "Ἓ": "Ε",
2906
+ "Ἔ": "Ε",
2907
+ "Ἕ": "Ε",
2908
+ "ἠ": "η",
2909
+ "ἡ": "η",
2910
+ "ἢ": "η",
2911
+ "ἣ": "η",
2912
+ "ἤ": "η",
2913
+ "ἥ": "η",
2914
+ "ἦ": "η",
2915
+ "ἧ": "η",
2916
+ "Ἠ": "Η",
2917
+ "Ἡ": "Η",
2918
+ "Ἢ": "Η",
2919
+ "Ἣ": "Η",
2920
+ "Ἤ": "Η",
2921
+ "Ἥ": "Η",
2922
+ "Ἦ": "Η",
2923
+ "Ἧ": "Η",
2924
+ "ἰ": "ι",
2925
+ "ἱ": "ι",
2926
+ "ἲ": "ι",
2927
+ "ἳ": "ι",
2928
+ "ἴ": "ι",
2929
+ "ἵ": "ι",
2930
+ "ἶ": "ι",
2931
+ "ἷ": "ι",
2932
+ "Ἰ": "Ι",
2933
+ "Ἱ": "Ι",
2934
+ "Ἲ": "Ι",
2935
+ "Ἳ": "Ι",
2936
+ "Ἴ": "Ι",
2937
+ "Ἵ": "Ι",
2938
+ "Ἶ": "Ι",
2939
+ "Ἷ": "Ι",
2940
+ "ὀ": "ο",
2941
+ "ὁ": "ο",
2942
+ "ὂ": "ο",
2943
+ "ὃ": "ο",
2944
+ "ὄ": "ο",
2945
+ "ὅ": "ο",
2946
+ "Ὀ": "Ο",
2947
+ "Ὁ": "Ο",
2948
+ "Ὂ": "Ο",
2949
+ "Ὃ": "Ο",
2950
+ "Ὄ": "Ο",
2951
+ "Ὅ": "Ο",
2952
+ "ὐ": "υ",
2953
+ "ὑ": "υ",
2954
+ "ὒ": "υ",
2955
+ "ὓ": "υ",
2956
+ "ὔ": "υ",
2957
+ "ὕ": "υ",
2958
+ "ὖ": "υ",
2959
+ "ὗ": "υ",
2960
+ "Ὑ": "Υ",
2961
+ "Ὓ": "Υ",
2962
+ "Ὕ": "Υ",
2963
+ "Ὗ": "Υ",
2964
+ "ὠ": "ω",
2965
+ "ὡ": "ω",
2966
+ "ὢ": "ω",
2967
+ "ὣ": "ω",
2968
+ "ὤ": "ω",
2969
+ "ὥ": "ω",
2970
+ "ὦ": "ω",
2971
+ "ὧ": "ω",
2972
+ "Ὠ": "Ω",
2973
+ "Ὡ": "Ω",
2974
+ "Ὢ": "Ω",
2975
+ "Ὣ": "Ω",
2976
+ "Ὤ": "Ω",
2977
+ "Ὥ": "Ω",
2978
+ "Ὦ": "Ω",
2979
+ "Ὧ": "Ω",
2980
+ "ὰ": "α",
2981
+ "ά": "α",
2982
+ "ὲ": "ε",
2983
+ "έ": "ε",
2984
+ "ὴ": "η",
2985
+ "ή": "η",
2986
+ "ὶ": "ι",
2987
+ "ί": "ι",
2988
+ "ὸ": "ο",
2989
+ "ό": "ο",
2990
+ "ὺ": "υ",
2991
+ "ύ": "υ",
2992
+ "ὼ": "ω",
2993
+ "ώ": "ω",
2994
+ "ᾀ": "α",
2995
+ "ᾁ": "α",
2996
+ "ᾂ": "α",
2997
+ "ᾃ": "α",
2998
+ "ᾄ": "α",
2999
+ "ᾅ": "α",
3000
+ "ᾆ": "α",
3001
+ "ᾇ": "α",
3002
+ "ᾈ": "Α",
3003
+ "ᾉ": "Α",
3004
+ "ᾊ": "Α",
3005
+ "ᾋ": "Α",
3006
+ "ᾌ": "Α",
3007
+ "ᾍ": "Α",
3008
+ "ᾎ": "Α",
3009
+ "ᾏ": "Α",
3010
+ "ᾐ": "η",
3011
+ "ᾑ": "η",
3012
+ "ᾒ": "η",
3013
+ "ᾓ": "η",
3014
+ "ᾔ": "η",
3015
+ "ᾕ": "η",
3016
+ "ᾖ": "η",
3017
+ "ᾗ": "η",
3018
+ "ᾘ": "Η",
3019
+ "ᾙ": "Η",
3020
+ "ᾚ": "Η",
3021
+ "ᾛ": "Η",
3022
+ "ᾜ": "Η",
3023
+ "ᾝ": "Η",
3024
+ "ᾞ": "Η",
3025
+ "ᾟ": "Η",
3026
+ "ᾠ": "ω",
3027
+ "ᾡ": "ω",
3028
+ "ᾢ": "ω",
3029
+ "ᾣ": "ω",
3030
+ "ᾤ": "ω",
3031
+ "ᾥ": "ω",
3032
+ "ᾦ": "ω",
3033
+ "ᾧ": "ω",
3034
+ "ᾨ": "Ω",
3035
+ "ᾩ": "Ω",
3036
+ "ᾪ": "Ω",
3037
+ "ᾫ": "Ω",
3038
+ "ᾬ": "Ω",
3039
+ "ᾭ": "Ω",
3040
+ "ᾮ": "Ω",
3041
+ "ᾯ": "Ω",
3042
+ "ᾰ": "α",
3043
+ "ᾱ": "α",
3044
+ "ᾲ": "α",
3045
+ "ᾳ": "α",
3046
+ "ᾴ": "α",
3047
+ "ᾶ": "α",
3048
+ "ᾷ": "α",
3049
+ "Ᾰ": "Α",
3050
+ "Ᾱ": "Α",
3051
+ "Ὰ": "Α",
3052
+ "Ά": "Α",
3053
+ "ᾼ": "Α",
3054
+ "῁": "¨",
3055
+ "ῂ": "η",
3056
+ "ῃ": "η",
3057
+ "ῄ": "η",
3058
+ "ῆ": "η",
3059
+ "ῇ": "η",
3060
+ "Ὲ": "Ε",
3061
+ "Έ": "Ε",
3062
+ "Ὴ": "Η",
3063
+ "Ή": "Η",
3064
+ "ῌ": "Η",
3065
+ "῍": "᾿",
3066
+ "῎": "᾿",
3067
+ "῏": "᾿",
3068
+ "ῐ": "ι",
3069
+ "ῑ": "ι",
3070
+ "ῒ": "ι",
3071
+ "ΐ": "ι",
3072
+ "ῖ": "ι",
3073
+ "ῗ": "ι",
3074
+ "Ῐ": "Ι",
3075
+ "Ῑ": "Ι",
3076
+ "Ὶ": "Ι",
3077
+ "Ί": "Ι",
3078
+ "῝": "῾",
3079
+ "῞": "῾",
3080
+ "῟": "῾",
3081
+ "ῠ": "υ",
3082
+ "ῡ": "υ",
3083
+ "ῢ": "υ",
3084
+ "ΰ": "υ",
3085
+ "ῤ": "ρ",
3086
+ "ῥ": "ρ",
3087
+ "ῦ": "υ",
3088
+ "ῧ": "υ",
3089
+ "Ῠ": "Υ",
3090
+ "Ῡ": "Υ",
3091
+ "Ὺ": "Υ",
3092
+ "Ύ": "Υ",
3093
+ "Ῥ": "Ρ",
3094
+ "῭": "¨",
3095
+ "΅": "¨",
3096
+ "ῲ": "ω",
3097
+ "ῳ": "ω",
3098
+ "ῴ": "ω",
3099
+ "ῶ": "ω",
3100
+ "ῷ": "ω",
3101
+ "Ὸ": "Ο",
3102
+ "Ό": "Ο",
3103
+ "Ὼ": "Ω",
3104
+ "Ώ": "Ω",
3105
+ "ῼ": "Ω",
3106
+ "Å": "A",
3107
+ "↚": "←",
3108
+ "↛": "→",
3109
+ "↮": "↔",
3110
+ "⇍": "⇐",
3111
+ "⇎": "⇔",
3112
+ "⇏": "⇒",
3113
+ "∄": "∃",
3114
+ "∉": "∈",
3115
+ "∌": "∋",
3116
+ "∤": "∣",
3117
+ "∦": "∥",
3118
+ "≁": "∼",
3119
+ "≄": "≃",
3120
+ "≇": "≅",
3121
+ "≉": "≈",
3122
+ "≠": "=",
3123
+ "≢": "≡",
3124
+ "≭": "≍",
3125
+ "≮": "<",
3126
+ "≯": ">",
3127
+ "≰": "≤",
3128
+ "≱": "≥",
3129
+ "≴": "≲",
3130
+ "≵": "≳",
3131
+ "≸": "≶",
3132
+ "≹": "≷",
3133
+ "⊀": "≺",
3134
+ "⊁": "≻",
3135
+ "⊄": "⊂",
3136
+ "⊅": "⊃",
3137
+ "⊈": "⊆",
3138
+ "⊉": "⊇",
3139
+ "⊬": "⊢",
3140
+ "⊭": "⊨",
3141
+ "⊮": "⊩",
3142
+ "⊯": "⊫",
3143
+ "⋠": "≼",
3144
+ "⋡": "≽",
3145
+ "⋢": "⊑",
3146
+ "⋣": "⊒",
3147
+ "⋪": "⊲",
3148
+ "⋫": "⊳",
3149
+ "⋬": "⊴",
3150
+ "⋭": "⊵",
3151
+ "⫝̸": "⫝"
3152
+ };
3153
+ function foldDiacritics(input) {
3154
+ let out = "";
3155
+ for (const ch of input) out += DIACRITIC_FOLD[ch] ?? ch;
3156
+ return out.replace(/[̀-ͯ]/g, "");
3157
+ }
2307
3158
  const EXCLUDED_CLEAN_CHARS = /* @__PURE__ */ new Set([",", ":", ";", "-", "/", "\\"]);
2308
3159
  const cleanChars = seps.split("").filter((c) => !EXCLUDED_CLEAN_CHARS.has(c)).join("");
2309
3160
  function potentialBefore(i, inputString) {
@@ -2458,6 +3309,14 @@ function validateRoman(match) {
2458
3309
  }
2459
3310
  return sepsSurround(match);
2460
3311
  }
3312
+ function seasonWordNotYear(match) {
3313
+ const raw = String(match.raw ?? "");
3314
+ if (/^\d{4}$/.test(raw)) {
3315
+ const n = parseInt(raw, 10);
3316
+ if (n >= 1900 && n <= 2100) return false;
3317
+ }
3318
+ return validateRoman(match);
3319
+ }
2461
3320
  function episodes(config) {
2462
3321
  config.range_separators;
2463
3322
  const discreteSeparators = config.discrete_separators;
@@ -2519,6 +3378,9 @@ function episodes(config) {
2519
3378
  conflictSolver: seasonEpisodeConflictSolver,
2520
3379
  abbreviations: [altDash]
2521
3380
  });
3381
+ rebulk.regex("第(?<episode>\\d{1,4})話", { tags: ["SxxExx"] });
3382
+ rebulk.regex("(?:シーズン|シリーズ)(?<season>\\d{1,2})", { tags: ["SxxExx"] });
3383
+ rebulk.regex("(?<season>\\d{1,2})期", {});
2522
3384
  const seasonMarkerPattern = buildOrPattern(config.season_markers, "seasonMarker");
2523
3385
  const episodeMarkerPattern = buildOrPattern(
2524
3386
  [...config.episode_markers, ...config.disc_markers],
@@ -2597,14 +3459,14 @@ function episodes(config) {
2597
3459
  formatter: { season: parseNumber, season_count: parseNumber },
2598
3460
  validator: {
2599
3461
  __parent__: and_(sepsSurround, orderingValidator),
2600
- season: validateRoman,
3462
+ season: seasonWordNotYear,
2601
3463
  season_count: validateRoman
2602
3464
  },
2603
3465
  chainBreaker: (matches) => episodesSeasonChainBreaker(matches, config),
2604
3466
  disabled: (context) => context?.type === "movie" || isDisabled(context, "season")
2605
3467
  }).defaults({
2606
3468
  formatter: { season: parseNumber, season_count: parseNumber },
2607
- validator: { season: validateRoman, season_count: validateRoman },
3469
+ validator: { season: seasonWordNotYear, season_count: validateRoman },
2608
3470
  conflictSolver: seasonEpisodeConflictSolver
2609
3471
  }).regex(seasonWordPattern + `@?(?P<season>${numeralWithWords})`).regex(ofWordPattern + `@?(?P<season_count>${numeral})`).repeater("?").regex(
2610
3472
  `@?` + buildOrPattern(
@@ -2850,13 +3712,11 @@ class RangeExpansionRule extends Rule {
2850
3712
  const gap = nextVal - curVal;
2851
3713
  if (gap <= 1 || gap > maxRange) continue;
2852
3714
  const between = matches.inputString?.slice(current.end, next.start) || "";
2853
- const betweenClean = between.replace(/[\s._]/g, "").toLowerCase();
2854
- const betweenStripMarkers = betweenClean.replace(/[sex]/gi, "");
2855
- const isRange = rangeSeps.has(betweenClean) || rangeSeps.has(betweenStripMarkers);
2856
- const sameChain = current.initiator && current.initiator === next.initiator;
2857
- const discreteSeps = new Set((this.config.discrete_separators || ["+", "&", "and", "et"]).map((s) => s.toLowerCase()));
2858
- const isDiscrete = discreteSeps.has(betweenClean);
2859
- if (isRange || sameChain && !isDiscrete) {
3715
+ const betweenClean = between.replace(/[\s.]/g, "").toLowerCase();
3716
+ const betweenStripMarkers = betweenClean.replace(/[sexp]/gi, "");
3717
+ const hasRangeChar = /[-~_]/.test(between);
3718
+ const isRange = hasRangeChar || rangeSeps.has(betweenClean) || rangeSeps.has(betweenStripMarkers);
3719
+ if (isRange) {
2860
3720
  for (let v = curVal + 1; v < nextVal; v++) {
2861
3721
  const m = new Match(current.start, next.end, {
2862
3722
  name,
@@ -3210,6 +4070,17 @@ function container(config) {
3210
4070
  const videos = config["videos"] || [];
3211
4071
  const torrent = config["torrent"] || [];
3212
4072
  const nzb = config["nzb"] || [];
4073
+ const archives = config["archives"] || [];
4074
+ const images = config["images"] || [];
4075
+ if (archives.length) rebulk.regex("\\." + buildOrPattern(archives, void 0, true) + "$", {
4076
+ exts: archives,
4077
+ tags: ["extension", "archive"]
4078
+ });
4079
+ rebulk.regex("\\.r\\d{2}$", { tags: ["extension", "archive"] });
4080
+ if (images.length) rebulk.regex("\\." + buildOrPattern(images, void 0, true) + "$", {
4081
+ exts: images,
4082
+ tags: ["extension", "image"]
4083
+ });
3213
4084
  if (subtitles.length) rebulk.regex("\\." + buildOrPattern(subtitles, void 0, true) + "$", {
3214
4085
  exts: subtitles,
3215
4086
  tags: ["extension", "subtitle"]
@@ -4413,10 +5284,38 @@ const DATE_REGEXPS = [
4413
5284
  new RegExp(`(?:^|[^\\d])((\\d{1,2})${DSEP}(\\d{1,2})${DSEP}(\\d{2}))(?:$|[^\\d])`, "i"),
4414
5285
  new RegExp(`(?:^|[^\\d])((\\d{4})${DSEP_BIS}(\\d{1,2})${DSEP}(\\d{1,2}))(?:$|[^\\d])`, "i"),
4415
5286
  new RegExp(`(?:^|[^\\d])((\\d{1,2})${DSEP}(\\d{1,2})${DSEP_BIS}(\\d{4}))(?:$|[^\\d])`, "i"),
4416
- new RegExp(`(?:^|[^\\d])((\\d{1,2}(?:st|nd|rd|th)?${DSEP}(?:[a-z]{3,10})${DSEP}\\d{4}))(?:$|[^\\d])`, "i")
5287
+ new RegExp(`(?:^|[^\\d])((\\d{1,2}(?:st|nd|rd|th)?${DSEP}(?:[a-z]{3,10})${DSEP}\\d{4}))(?:$|[^\\d])`, "i"),
5288
+ // Month-name first: "July 30 2021", "Jul.30.2021"
5289
+ new RegExp(`(?:^|[^a-z\\d])(([a-z]{3,10})${DSEP}\\d{1,2}(?:st|nd|rd|th)?${DSEP}\\d{4})(?:$|[^\\d])`, "i")
4417
5290
  ];
5291
+ const MONTHS = {
5292
+ jan: 1,
5293
+ january: 1,
5294
+ feb: 2,
5295
+ february: 2,
5296
+ mar: 3,
5297
+ march: 3,
5298
+ apr: 4,
5299
+ april: 4,
5300
+ may: 5,
5301
+ jun: 6,
5302
+ june: 6,
5303
+ jul: 7,
5304
+ july: 7,
5305
+ aug: 8,
5306
+ august: 8,
5307
+ sep: 9,
5308
+ sept: 9,
5309
+ september: 9,
5310
+ oct: 10,
5311
+ october: 10,
5312
+ nov: 11,
5313
+ november: 11,
5314
+ dec: 12,
5315
+ december: 12
5316
+ };
4418
5317
  function validYear(year) {
4419
- return year >= 1920 && year < 2035;
5318
+ return year >= 1900 && year < 2035;
4420
5319
  }
4421
5320
  function validWeek(week) {
4422
5321
  return week >= 1 && week < 53;
@@ -4441,6 +5340,27 @@ function tryParseDate(match, groups2, yearFirst, dayFirst) {
4441
5340
  for (const yf of yearFirstOpts) {
4442
5341
  for (const df of dayFirstOpts) {
4443
5342
  let year, month, day;
5343
+ const monthNameIdx = parts.findIndex((x) => MONTHS[x.toLowerCase()] !== void 0);
5344
+ if (parts.length === 3 && monthNameIdx >= 0) {
5345
+ month = MONTHS[parts[monthNameIdx].toLowerCase()];
5346
+ const rest = parts.filter((_, i) => i !== monthNameIdx).map((x) => parseInt(x.replace(/(st|nd|rd|th)$/i, ""), 10));
5347
+ const yearPos = rest.findIndex((n) => n >= 1e3);
5348
+ if (yearPos >= 0) {
5349
+ year = rest[yearPos];
5350
+ day = rest[1 - yearPos];
5351
+ } else {
5352
+ year = rest[1];
5353
+ day = rest[0];
5354
+ }
5355
+ if (month >= 1 && month <= 12 && day >= 1 && day <= 31 && validYear(year)) {
5356
+ const ts = Date.UTC(year, month - 1, day);
5357
+ const d = new Date(ts);
5358
+ if (d.getUTCFullYear() === year && d.getUTCMonth() === month - 1 && d.getUTCDate() === day) {
5359
+ return d;
5360
+ }
5361
+ }
5362
+ continue;
5363
+ }
4444
5364
  if (parts.length === 1) {
4445
5365
  const s = parts[0];
4446
5366
  if (s.length === 8) {
@@ -4699,6 +5619,32 @@ function buildExpectedFunction(optionName) {
4699
5619
  return results;
4700
5620
  };
4701
5621
  }
5622
+ const TITLE_STOP_WORDS = /* @__PURE__ */ new Set([
5623
+ "the",
5624
+ "a",
5625
+ "an",
5626
+ "and",
5627
+ "or",
5628
+ "of",
5629
+ "to",
5630
+ "in",
5631
+ "on",
5632
+ "at",
5633
+ "for",
5634
+ "from",
5635
+ "by",
5636
+ "with",
5637
+ "into",
5638
+ "onto",
5639
+ "no",
5640
+ "le",
5641
+ "la",
5642
+ "les",
5643
+ "de",
5644
+ "du",
5645
+ "des",
5646
+ "el"
5647
+ ]);
4702
5648
  function hasmatch$1(result) {
4703
5649
  if (result === null || result === void 0) return false;
4704
5650
  if (Array.isArray(result)) return result.length > 0;
@@ -4746,9 +5692,21 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
4746
5692
  }
4747
5693
  /**
4748
5694
  * Determine if a match should be ignored (e.g., language, country).
5695
+ *
5696
+ * Python parity: a full-word (len > 3) UPPERCASE language/country is a real
5697
+ * token, not title filler, so it is NOT ignored — e.g. the trailing "FRENCH"
5698
+ * in "...XViD-NTK.FRENCH..." must not be pulled into an alternative_title.
5699
+ * Lowercase or short (<= 3 char) language/country codes remain ignored.
4749
5700
  */
4750
5701
  isIgnored(match) {
4751
- return match.name === "language" || match.name === "country" || match.name === "episode_details";
5702
+ if (!(match.name === "language" || match.name === "country" || match.name === "episode_details")) {
5703
+ return false;
5704
+ }
5705
+ const raw = match.raw ?? "";
5706
+ if (match.end - match.start > 3 && raw !== "" && raw === raw.toUpperCase() && raw !== raw.toLowerCase()) {
5707
+ return false;
5708
+ }
5709
+ return true;
4752
5710
  }
4753
5711
  /**
4754
5712
  * Determine if we should keep a hole boundary (don't trim this side).
@@ -4952,6 +5910,15 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
4952
5910
  while (ignoredArray.length > 0) {
4953
5911
  const lastIgnored = ignoredArray[ignoredArray.length - 1];
4954
5912
  if (lastIgnored.end === trimmedHole.end) {
5913
+ if (lastIgnored.name === "language" || lastIgnored.name === "country") {
5914
+ const beforeWords = inp.slice(trimmedHole.start, lastIgnored.start).toLowerCase().split(/[^a-z0-9]+/i).filter(Boolean);
5915
+ const lastWord = beforeWords[beforeWords.length - 1];
5916
+ if (lastWord && TITLE_STOP_WORDS.has(lastWord)) {
5917
+ toRemove.push(lastIgnored);
5918
+ ignoredArray.pop();
5919
+ break;
5920
+ }
5921
+ }
4955
5922
  if (lastIgnored.name === "episode_details" && lastIgnored.value === "Special") {
4956
5923
  const nextMatch = matches.range(
4957
5924
  lastIgnored.end,
@@ -5012,6 +5979,16 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
5012
5979
  }
5013
5980
  }
5014
5981
  }
5982
+ const mainTitle = toAppend.find((t) => t.name === this.matchName);
5983
+ if (mainTitle) {
5984
+ const absorbedRaw = matches.range(
5985
+ mainTitle.start,
5986
+ mainTitle.end,
5987
+ (m) => m.name === "episode_details" || m.name === "country" || m.name === "language"
5988
+ );
5989
+ const absorbed = Array.isArray(absorbedRaw) ? absorbedRaw : absorbedRaw ? [absorbedRaw] : [];
5990
+ for (const m of absorbed) if (!toRemove.includes(m)) toRemove.push(m);
5991
+ }
5015
5992
  return { toAppend, toRemove };
5016
5993
  }
5017
5994
  /**
@@ -5117,13 +6094,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
5117
6094
  const result = this.checkTitlesInFilepart(filepart, matches);
5118
6095
  if (result.toAppend.length > 0 || result.toRemove.length > 0) {
5119
6096
  if (serieNameMatch) {
5120
- const normTitle = (s) => {
5121
- try {
5122
- s = s.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
5123
- } catch {
5124
- }
5125
- return s.replace(/[''`]/g, "").replace(/\.+$/, "").toLowerCase().trim();
5126
- };
6097
+ const normTitle = (s) => foldDiacritics(s).replace(/[''`]/g, "").replace(/\.+$/, "").toLowerCase().trim();
5127
6098
  for (const titleMatch of result.toAppend) {
5128
6099
  if (normTitle(String(titleMatch.value)) !== normTitle(String(serieNameMatch.value))) {
5129
6100
  titleMatch.name = "episode_title";
@@ -5145,13 +6116,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
5145
6116
  continue;
5146
6117
  }
5147
6118
  const newVal = String(newTitle.value ?? "");
5148
- const norm = (s) => {
5149
- try {
5150
- s = s.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
5151
- } catch {
5152
- }
5153
- return s.replace(/[''`]/g, "").toLowerCase();
5154
- };
6119
+ const norm = (s) => foldDiacritics(s).replace(/[''`]/g, "").toLowerCase();
5155
6120
  const existingIdx = toAppend.findIndex((m) => {
5156
6121
  const existingVal = String(m.value ?? "");
5157
6122
  return norm(existingVal) === norm(newVal) && existingVal !== newVal;
@@ -5245,11 +6210,253 @@ const _PreferTitleWithYear = class _PreferTitleWithYear extends Rule {
5245
6210
  _PreferTitleWithYear.priority = 32;
5246
6211
  _PreferTitleWithYear.dependency = [TitleFromPosition];
5247
6212
  let PreferTitleWithYear = _PreferTitleWithYear;
6213
+ const ARTICLES = /* @__PURE__ */ new Set([
6214
+ "the",
6215
+ "a",
6216
+ "an",
6217
+ "le",
6218
+ "la",
6219
+ "les",
6220
+ "l'",
6221
+ "el",
6222
+ "los",
6223
+ "las",
6224
+ "il",
6225
+ "lo",
6226
+ "un",
6227
+ "una",
6228
+ "der",
6229
+ "die",
6230
+ "das",
6231
+ "de",
6232
+ "het",
6233
+ "o",
6234
+ "os"
6235
+ ]);
6236
+ const _ExtendLoneArticleTitle = class _ExtendLoneArticleTitle extends Rule {
6237
+ constructor() {
6238
+ super(...arguments);
6239
+ this.consequence = RemoveMatch;
6240
+ }
6241
+ when(matches, _context) {
6242
+ const inp = matches.inputString || "";
6243
+ const out = [];
6244
+ const titles = matches.named("title");
6245
+ const titleArr = Array.isArray(titles) ? titles : titles ? [titles] : [];
6246
+ for (const title2 of titleArr) {
6247
+ if (!ARTICLES.has(String(title2.value ?? "").trim().toLowerCase())) continue;
6248
+ const filepart = matches.markers.atMatch(title2, (m) => m.name === "path", 0);
6249
+ if (!filepart) continue;
6250
+ const prop = matches.range(
6251
+ title2.end,
6252
+ filepart.end,
6253
+ (m) => !m.private && ["edition", "language", "country", "other", "source"].includes(m.name ?? ""),
6254
+ 0
6255
+ );
6256
+ if (!prop) continue;
6257
+ if (![...inp.slice(title2.end, prop.start)].every((c) => seps.includes(c))) continue;
6258
+ const next = matches.range(
6259
+ prop.end,
6260
+ filepart.end,
6261
+ (m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
6262
+ 0
6263
+ );
6264
+ if (next && inp.slice(prop.end, next.start).replace(/[sexd]/gi, "").split("").some((c) => !seps.includes(c))) continue;
6265
+ out.push({ title: title2, prop });
6266
+ }
6267
+ return out.length ? out : false;
6268
+ }
6269
+ then(matches, whenResponse, _context) {
6270
+ for (const { title: title2, prop } of whenResponse) {
6271
+ const inp = matches.inputString || "";
6272
+ matches.remove(title2);
6273
+ matches.remove(prop);
6274
+ title2.end = prop.end;
6275
+ title2.value = cleanup(inp.slice(title2.start, title2.end));
6276
+ matches.append(title2);
6277
+ }
6278
+ }
6279
+ };
6280
+ _ExtendLoneArticleTitle.priority = -32;
6281
+ let ExtendLoneArticleTitle = _ExtendLoneArticleTitle;
6282
+ const _CountryAtTitlePosition = class _CountryAtTitlePosition extends Rule {
6283
+ constructor() {
6284
+ super(...arguments);
6285
+ this.consequence = RemoveMatch;
6286
+ }
6287
+ when(matches, _context) {
6288
+ const inp = matches.inputString || "";
6289
+ const out = [];
6290
+ const cand = matches.range(
6291
+ 0,
6292
+ inp.length,
6293
+ (m) => !m.private && ["country", "other", "edition"].includes(m.name ?? "")
6294
+ );
6295
+ const arr = Array.isArray(cand) ? cand : cand ? [cand] : [];
6296
+ for (const c of arr) {
6297
+ if (!/^[A-Z][a-z]+$/.test(c.raw ?? "")) continue;
6298
+ const filepart = matches.markers.atMatch(c, (m) => m.name === "path", 0);
6299
+ if (!filepart) continue;
6300
+ if (![...inp.slice(filepart.start, c.start)].every((ch) => seps.includes(ch))) continue;
6301
+ const year = matches.range(c.end, filepart.end, (m) => !m.private && m.name === "year", 0);
6302
+ if (!year) continue;
6303
+ const se = matches.range(c.end, year.start, (m) => !m.private && ["season", "episode", "date"].includes(m.name ?? ""), 0);
6304
+ if (se) continue;
6305
+ if (![...inp.slice(c.end, year.start)].every((ch) => seps.includes(ch))) continue;
6306
+ out.push(c);
6307
+ }
6308
+ return out.length ? out : false;
6309
+ }
6310
+ };
6311
+ _CountryAtTitlePosition.priority = 64;
6312
+ let CountryAtTitlePosition = _CountryAtTitlePosition;
6313
+ const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle extends Rule {
6314
+ constructor() {
6315
+ super(...arguments);
6316
+ this.consequence = RemoveMatch;
6317
+ }
6318
+ when(matches, _context) {
6319
+ const inp = matches.inputString || "";
6320
+ const out = [];
6321
+ for (const filepart of matches.markers.named("path")) {
6322
+ if (matches.range(filepart.start, filepart.end, (m) => m.name === "title", 0)) continue;
6323
+ const anchor = matches.range(
6324
+ filepart.start,
6325
+ filepart.end,
6326
+ (m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
6327
+ 0
6328
+ );
6329
+ if (!anchor) continue;
6330
+ const lead = matches.range(filepart.start, filepart.end, (m) => !m.private && !!m.value, 0);
6331
+ if (!lead || !["other", "country", "edition"].includes(lead.name ?? "")) continue;
6332
+ if (lead.start >= anchor.start) continue;
6333
+ if (![...inp.slice(filepart.start, lead.start)].every((c) => seps.includes(c))) continue;
6334
+ out.push(lead);
6335
+ }
6336
+ return out.length ? out : false;
6337
+ }
6338
+ then(matches, whenResponse, _context) {
6339
+ const inp = matches.inputString || "";
6340
+ for (const lead of whenResponse) {
6341
+ matches.remove(lead);
6342
+ const t = new Match(lead.start, lead.end, {
6343
+ name: "title",
6344
+ value: cleanup(inp.slice(lead.start, lead.end)),
6345
+ inputString: inp
6346
+ });
6347
+ matches.append(t);
6348
+ }
6349
+ }
6350
+ };
6351
+ _PropertyAtTitlePositionAsTitle.priority = -48;
6352
+ let PropertyAtTitlePositionAsTitle = _PropertyAtTitlePositionAsTitle;
6353
+ const _RemoveNumericAlternativeTitle = class _RemoveNumericAlternativeTitle extends Rule {
6354
+ constructor() {
6355
+ super(...arguments);
6356
+ this.consequence = RemoveMatch;
6357
+ }
6358
+ when(matches, _context) {
6359
+ const alts = matches.named("alternative_title");
6360
+ const altArr = Array.isArray(alts) ? alts : alts ? [alts] : [];
6361
+ if (!altArr.length) return false;
6362
+ const out = [];
6363
+ for (const alt of altArr) {
6364
+ const raw = String(alt.raw ?? alt.value ?? "");
6365
+ if (!/^[\d\s.~_-]+$/.test(raw) || !/\d/.test(raw)) continue;
6366
+ const filepart = matches.markers.atMatch(alt, (m) => m.name === "path", 0);
6367
+ if (!filepart) continue;
6368
+ const hasEpisode = matches.range(
6369
+ filepart.start,
6370
+ filepart.end,
6371
+ (m) => m.name === "episode" || m.name === "absolute_episode",
6372
+ 0
6373
+ );
6374
+ if (hasEpisode) out.push(alt);
6375
+ }
6376
+ return out.length ? out : false;
6377
+ }
6378
+ };
6379
+ _RemoveNumericAlternativeTitle.priority = -64;
6380
+ let RemoveNumericAlternativeTitle = _RemoveNumericAlternativeTitle;
6381
+ const _RemoveTailAlternativeTitle = class _RemoveTailAlternativeTitle extends Rule {
6382
+ constructor() {
6383
+ super(...arguments);
6384
+ this.consequence = RemoveMatch;
6385
+ }
6386
+ when(matches, _context) {
6387
+ const alts = matches.named("alternative_title");
6388
+ const altArr = Array.isArray(alts) ? alts : alts ? [alts] : [];
6389
+ if (!altArr.length) return false;
6390
+ const titleish = /* @__PURE__ */ new Set(["year", "title", "alternative_title", "episode_title", "type"]);
6391
+ const out = [];
6392
+ for (const alt of altArr) {
6393
+ const filepart = matches.markers.atMatch(alt, (m) => m.name === "path", 0);
6394
+ if (!filepart) continue;
6395
+ const years = matches.range(filepart.start, filepart.end, (m) => m.name === "year");
6396
+ const yearArr = Array.isArray(years) ? years : years ? [years] : [];
6397
+ if (!yearArr.length) continue;
6398
+ const yMax = Math.max(...yearArr.map((y) => y.end));
6399
+ if (alt.start < yMax) continue;
6400
+ const between = matches.range(
6401
+ yMax,
6402
+ alt.start,
6403
+ (m) => !m.private && !!m.value && !titleish.has(m.name ?? ""),
6404
+ 0
6405
+ );
6406
+ if (between) out.push(alt);
6407
+ }
6408
+ return out.length ? out : false;
6409
+ }
6410
+ };
6411
+ _RemoveTailAlternativeTitle.priority = POST_PROCESS;
6412
+ _RemoveTailAlternativeTitle.dependency = ["RenameEpisodeTitleWhenMovieType"];
6413
+ let RemoveTailAlternativeTitle = _RemoveTailAlternativeTitle;
6414
+ const _RemoveTailTitle = class _RemoveTailTitle extends Rule {
6415
+ constructor() {
6416
+ super(...arguments);
6417
+ this.consequence = RemoveMatch;
6418
+ }
6419
+ when(matches, _context) {
6420
+ const titleish = /* @__PURE__ */ new Set(["year", "title", "alternative_title", "episode_title", "type"]);
6421
+ const out = [];
6422
+ for (const filepart of matches.markers.named("path")) {
6423
+ const titles = matches.range(
6424
+ filepart.start,
6425
+ filepart.end,
6426
+ (m) => m.name === "title"
6427
+ );
6428
+ const titleArr = (Array.isArray(titles) ? titles : titles ? [titles] : []).slice().sort((a, b) => a.start - b.start);
6429
+ if (titleArr.length < 2) continue;
6430
+ const primary = titleArr[0];
6431
+ const head = String(primary.value ?? "").trim().toLowerCase();
6432
+ if (!head) continue;
6433
+ if (TITLE_STOP_WORDS.has(head)) {
6434
+ if (titleArr.slice(1).some((t) => !TITLE_STOP_WORDS.has(String(t.value ?? "").trim().toLowerCase()))) {
6435
+ out.push(primary);
6436
+ }
6437
+ continue;
6438
+ }
6439
+ for (const t of titleArr.slice(1)) {
6440
+ const between = matches.range(
6441
+ primary.end,
6442
+ t.start,
6443
+ (m) => !m.private && !!m.value && !titleish.has(m.name ?? ""),
6444
+ 0
6445
+ );
6446
+ if (between) out.push(t);
6447
+ }
6448
+ }
6449
+ return out.length ? out : false;
6450
+ }
6451
+ };
6452
+ _RemoveTailTitle.priority = POST_PROCESS;
6453
+ _RemoveTailTitle.dependency = ["RenameEpisodeTitleWhenMovieType"];
6454
+ let RemoveTailTitle = _RemoveTailTitle;
5248
6455
  function title(config) {
5249
6456
  const rebulk = new Rebulk({
5250
6457
  disabled: (context) => isDisabled(context, "title")
5251
6458
  });
5252
- rebulk.rules(TitleFromPosition, PreferTitleWithYear);
6459
+ rebulk.rules(CountryAtTitlePosition, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle);
5253
6460
  const expectedTitle = buildExpectedFunction("expected_title");
5254
6461
  rebulk.functional(expectedTitle, {
5255
6462
  name: "title",
@@ -5281,10 +6488,279 @@ function episodeTitle(config) {
5281
6488
  TrimLanguageFromEpisodeTitle,
5282
6489
  Filepart3EpisodeTitle,
5283
6490
  Filepart2EpisodeTitle,
6491
+ NumericEpisodeTitleToEpisode,
6492
+ RemoveEpisodeTitleInReleaseGroup,
6493
+ RemoveEpisodeMarkerWordTitle,
6494
+ RemoveEpisodeTitleCoveredByDetailsInGroup,
6495
+ RemoveFansubCreditEpisodeTitle,
6496
+ RemoveSubtitleDescriptorEpisodeTitle,
6497
+ RemoveHashFilepartJunk,
6498
+ RemoveTailEpisodeTitle,
5284
6499
  RenameEpisodeTitleWhenMovieType
5285
6500
  );
5286
6501
  return rebulk;
5287
6502
  }
6503
+ const EPISODE_MARKER_WORDS = /* @__PURE__ */ new Set([
6504
+ "ep",
6505
+ "eps",
6506
+ "episode",
6507
+ "episodes",
6508
+ "episodio",
6509
+ "episodios",
6510
+ "cap",
6511
+ "capitulo",
6512
+ "capitulos",
6513
+ "folge",
6514
+ "e"
6515
+ ]);
6516
+ const _RemoveEpisodeMarkerWordTitle = class _RemoveEpisodeMarkerWordTitle extends Rule {
6517
+ constructor() {
6518
+ super(...arguments);
6519
+ this.consequence = RemoveMatch;
6520
+ }
6521
+ when(matches, _context) {
6522
+ const ets = matches.named("episode_title");
6523
+ const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
6524
+ if (!etArr.length) return false;
6525
+ const out = [];
6526
+ for (const et of etArr) {
6527
+ if (!EPISODE_MARKER_WORDS.has(String(et.value ?? "").trim().toLowerCase())) continue;
6528
+ const next = matches.range(
6529
+ et.end,
6530
+ matches.inputString?.length ?? et.end + 100,
6531
+ (m) => !m.private && !!m.value,
6532
+ 0
6533
+ );
6534
+ if (next && next.name === "episode") out.push(et);
6535
+ }
6536
+ return out.length ? out : false;
6537
+ }
6538
+ };
6539
+ _RemoveEpisodeMarkerWordTitle.priority = POST_PROCESS;
6540
+ let RemoveEpisodeMarkerWordTitle = _RemoveEpisodeMarkerWordTitle;
6541
+ const _RemoveHashFilepartJunk = class _RemoveHashFilepartJunk extends Rule {
6542
+ constructor() {
6543
+ super(...arguments);
6544
+ this.consequence = RemoveMatch;
6545
+ }
6546
+ static isHash(token) {
6547
+ if (/[\s._\-]/.test(token)) return false;
6548
+ if (/^[0-9a-f]{16,}$/i.test(token)) return true;
6549
+ return token.length >= 24 && /[a-z]/.test(token) && /[A-Z]/.test(token) && /\d/.test(token);
6550
+ }
6551
+ when(matches, _context) {
6552
+ const inp = matches.inputString ?? "";
6553
+ const strip2 = /* @__PURE__ */ new Set(["episode_title", "version", "episode_details", "alternative_title"]);
6554
+ const out = [];
6555
+ for (const fp of matches.markers.named("path")) {
6556
+ let text = inp.slice(fp.start, fp.end);
6557
+ const cont = matches.range(fp.start, fp.end, (m) => m.name === "container", 0);
6558
+ if (cont) text = inp.slice(fp.start, cont.start);
6559
+ if (!_RemoveHashFilepartJunk.isHash(text.replace(/[.\s]+$/, ""))) continue;
6560
+ for (const m of matches.range(fp.start, fp.end, (m2) => strip2.has(m2.name ?? ""))) {
6561
+ out.push(m);
6562
+ }
6563
+ }
6564
+ return out.length ? out : false;
6565
+ }
6566
+ };
6567
+ _RemoveHashFilepartJunk.priority = POST_PROCESS;
6568
+ let RemoveHashFilepartJunk = _RemoveHashFilepartJunk;
6569
+ const _RemoveEpisodeTitleCoveredByDetailsInGroup = class _RemoveEpisodeTitleCoveredByDetailsInGroup extends Rule {
6570
+ constructor() {
6571
+ super(...arguments);
6572
+ this.consequence = RemoveMatch;
6573
+ }
6574
+ when(matches, _context) {
6575
+ const ets = matches.named("episode_title");
6576
+ const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
6577
+ const out = [];
6578
+ for (const et of etArr) {
6579
+ if (!matches.markers.atMatch(et, (m) => m.name === "group", 0)) continue;
6580
+ const covered = matches.range(
6581
+ et.start,
6582
+ et.end,
6583
+ (m) => m.name === "episode_details" && m.start <= et.start && m.end >= et.end,
6584
+ 0
6585
+ );
6586
+ if (covered) out.push(et);
6587
+ }
6588
+ return out.length ? out : false;
6589
+ }
6590
+ };
6591
+ _RemoveEpisodeTitleCoveredByDetailsInGroup.priority = POST_PROCESS;
6592
+ let RemoveEpisodeTitleCoveredByDetailsInGroup = _RemoveEpisodeTitleCoveredByDetailsInGroup;
6593
+ const _RemoveFansubCreditEpisodeTitle = class _RemoveFansubCreditEpisodeTitle extends Rule {
6594
+ constructor() {
6595
+ super(...arguments);
6596
+ this.consequence = RemoveMatch;
6597
+ }
6598
+ when(matches, _context) {
6599
+ const ets = matches.named("episode_title");
6600
+ const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
6601
+ const out = etArr.filter((et) => /\bfansub/i.test(String(et.value ?? "")));
6602
+ return out.length ? out : false;
6603
+ }
6604
+ };
6605
+ _RemoveFansubCreditEpisodeTitle.priority = POST_PROCESS;
6606
+ let RemoveFansubCreditEpisodeTitle = _RemoveFansubCreditEpisodeTitle;
6607
+ const _RemoveSubtitleDescriptorEpisodeTitle = class _RemoveSubtitleDescriptorEpisodeTitle extends Rule {
6608
+ constructor() {
6609
+ super(...arguments);
6610
+ this.consequence = RemoveMatch;
6611
+ }
6612
+ when(matches, _context) {
6613
+ const inp = matches.inputString ?? "";
6614
+ const ets = matches.named("episode_title");
6615
+ const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
6616
+ const out = [];
6617
+ for (const et of etArr) {
6618
+ if (/[\s.]/.test(String(et.value ?? "").trim())) continue;
6619
+ const after = inp.slice(et.end).replace(/^[\s._-]+/, "");
6620
+ if (/^subtitl(e|es)\b|^subs?\b/i.test(after)) out.push(et);
6621
+ }
6622
+ return out.length ? out : false;
6623
+ }
6624
+ };
6625
+ _RemoveSubtitleDescriptorEpisodeTitle.priority = POST_PROCESS;
6626
+ let RemoveSubtitleDescriptorEpisodeTitle = _RemoveSubtitleDescriptorEpisodeTitle;
6627
+ const ET_STOP_WORDS = /* @__PURE__ */ new Set([
6628
+ "the",
6629
+ "a",
6630
+ "an",
6631
+ "and",
6632
+ "or",
6633
+ "of",
6634
+ "to",
6635
+ "in",
6636
+ "on",
6637
+ "at",
6638
+ "for",
6639
+ "from",
6640
+ "by",
6641
+ "with",
6642
+ "le",
6643
+ "la",
6644
+ "les",
6645
+ "de",
6646
+ "du",
6647
+ "des",
6648
+ "el"
6649
+ ]);
6650
+ const _RemoveTailEpisodeTitle = class _RemoveTailEpisodeTitle extends Rule {
6651
+ constructor() {
6652
+ super(...arguments);
6653
+ this.consequence = RemoveMatch;
6654
+ }
6655
+ when(matches, _context) {
6656
+ const out = [];
6657
+ for (const fp of matches.markers.named("path")) {
6658
+ const ets = matches.range(fp.start, fp.end, (m) => m.name === "episode_title");
6659
+ const etArr = (Array.isArray(ets) ? ets : ets ? [ets] : []).slice().sort((a, b) => a.start - b.start);
6660
+ if (etArr.length < 2) continue;
6661
+ const primary = etArr[0];
6662
+ const head = String(primary.value ?? "").trim().toLowerCase();
6663
+ if (!head || ET_STOP_WORDS.has(head)) continue;
6664
+ for (const et of etArr.slice(1)) {
6665
+ const between = matches.range(
6666
+ primary.end,
6667
+ et.start,
6668
+ (m) => !m.private && !!m.value && !_RemoveTailEpisodeTitle.TITLEISH.has(m.name ?? ""),
6669
+ 0
6670
+ );
6671
+ if (between) out.push(et);
6672
+ }
6673
+ }
6674
+ return out.length ? out : false;
6675
+ }
6676
+ };
6677
+ _RemoveTailEpisodeTitle.priority = POST_PROCESS;
6678
+ _RemoveTailEpisodeTitle.TITLEISH = /* @__PURE__ */ new Set([
6679
+ "year",
6680
+ "title",
6681
+ "alternative_title",
6682
+ "episode_title",
6683
+ "type",
6684
+ "episode",
6685
+ "season"
6686
+ ]);
6687
+ let RemoveTailEpisodeTitle = _RemoveTailEpisodeTitle;
6688
+ const _RemoveEpisodeTitleInReleaseGroup = class _RemoveEpisodeTitleInReleaseGroup extends Rule {
6689
+ constructor() {
6690
+ super(...arguments);
6691
+ this.consequence = RemoveMatch;
6692
+ }
6693
+ when(matches, _context) {
6694
+ const ets = matches.named("episode_title");
6695
+ const etArr = Array.isArray(ets) ? ets : ets ? [ets] : [];
6696
+ if (!etArr.length) return false;
6697
+ const out = [];
6698
+ const inp = matches.inputString ?? "";
6699
+ const hasReleaseIn = (s, e) => !!matches.range(s, e, (m) => _RemoveEpisodeTitleInReleaseGroup.RELEASE_PROPS.has(m.name ?? ""), 0);
6700
+ const onlySeps = (s, e) => e <= s || [...inp.slice(s, e)].every((c) => "[](){} .-_".includes(c));
6701
+ for (const et of etArr) {
6702
+ const group = matches.markers.atMatch(et, (m) => m.name === "group", 0);
6703
+ if (!group) continue;
6704
+ let tag = hasReleaseIn(group.start, group.end);
6705
+ if (!tag) {
6706
+ for (const other2 of matches.markers.named("group")) {
6707
+ if (other2.span?.[0] === group.span?.[0]) continue;
6708
+ const adjacent = other2.start >= group.end && onlySeps(group.end, other2.start) || other2.end <= group.start && onlySeps(other2.end, group.start);
6709
+ if (adjacent && hasReleaseIn(other2.start, other2.end)) {
6710
+ tag = true;
6711
+ break;
6712
+ }
6713
+ }
6714
+ }
6715
+ if (tag) out.push(et);
6716
+ }
6717
+ return out.length ? out : false;
6718
+ }
6719
+ };
6720
+ _RemoveEpisodeTitleInReleaseGroup.priority = POST_PROCESS;
6721
+ _RemoveEpisodeTitleInReleaseGroup.RELEASE_PROPS = /* @__PURE__ */ new Set([
6722
+ "screen_size",
6723
+ "video_codec",
6724
+ "audio_codec",
6725
+ "audio_channels",
6726
+ "source",
6727
+ "color_depth",
6728
+ "video_profile",
6729
+ "audio_profile",
6730
+ "streaming_service",
6731
+ "video_bit_rate",
6732
+ "audio_bit_rate",
6733
+ "container"
6734
+ ]);
6735
+ let RemoveEpisodeTitleInReleaseGroup = _RemoveEpisodeTitleInReleaseGroup;
6736
+ const _NumericEpisodeTitleToEpisode = class _NumericEpisodeTitleToEpisode extends Rule {
6737
+ constructor() {
6738
+ super(...arguments);
6739
+ this.consequence = RemoveMatch;
6740
+ }
6741
+ when(matches, _context) {
6742
+ const out = [];
6743
+ for (const fp of matches.markers.named("path")) {
6744
+ if (matches.range(fp.start, fp.end, (m) => m.name === "episode" && !m.private, 0)) continue;
6745
+ if (!matches.range(fp.start, fp.end, (m) => m.name === "season" && !m.private, 0)) continue;
6746
+ const ets = matches.range(fp.start, fp.end, (m) => m.name === "episode_title");
6747
+ for (const et of Array.isArray(ets) ? ets : ets ? [ets] : []) {
6748
+ if (/^\d{1,3}$/.test(String(et.value ?? "").trim())) out.push(et);
6749
+ }
6750
+ }
6751
+ return out.length ? out : false;
6752
+ }
6753
+ then(matches, whenResponse, _context) {
6754
+ for (const et of whenResponse) {
6755
+ matches.remove(et);
6756
+ et.name = "episode";
6757
+ et.value = parseInt(String(et.value).trim(), 10);
6758
+ matches.append(et);
6759
+ }
6760
+ }
6761
+ };
6762
+ _NumericEpisodeTitleToEpisode.priority = POST_PROCESS;
6763
+ let NumericEpisodeTitleToEpisode = _NumericEpisodeTitleToEpisode;
5288
6764
  const _RemoveConflictsWithEpisodeTitle = class _RemoveConflictsWithEpisodeTitle extends Rule {
5289
6765
  constructor() {
5290
6766
  super(...arguments);
@@ -5457,7 +6933,14 @@ const _EpisodeTitleFromPosition = class _EpisodeTitleFromPosition extends Rule {
5457
6933
  this.previousNames = ["episode", "episode_count", "season", "season_count", "date", "title", "year"];
5458
6934
  }
5459
6935
  isIgnored(match) {
5460
- return match.name === "language" || match.name === "country" || match.name === "episode_details";
6936
+ if (!(match.name === "language" || match.name === "country" || match.name === "episode_details")) {
6937
+ return false;
6938
+ }
6939
+ const raw = match.raw ?? "";
6940
+ if (match.end - match.start > 3 && raw !== "" && raw === raw.toUpperCase() && raw !== raw.toLowerCase()) {
6941
+ return false;
6942
+ }
6943
+ return true;
5461
6944
  }
5462
6945
  when(matches, _context) {
5463
6946
  const toAppend = [];
@@ -5489,7 +6972,44 @@ const _EpisodeTitleFromPosition = class _EpisodeTitleFromPosition extends Rule {
5489
6972
  predicate: (m) => !!m.value
5490
6973
  });
5491
6974
  const holeArray = Array.isArray(holesResult) ? holesResult : holesResult ? [holesResult] : [];
6975
+ const inp = matches.inputString || "";
5492
6976
  for (const hole of holeArray) {
6977
+ const groupMarker = matches.markers?.atMatch?.(hole, (m) => m.name === "group", 0);
6978
+ if (groupMarker) {
6979
+ const yearInGroup = matches.range(
6980
+ groupMarker.start,
6981
+ groupMarker.end,
6982
+ (m) => (m.name === "year" || m.name === "date") && !m.private,
6983
+ 0
6984
+ );
6985
+ if (yearInGroup) continue;
6986
+ }
6987
+ const cropName = (m) => m.name === "language" || m.name === "country";
6988
+ const fpLangsRaw = matches.range(filepart.start, filepart.end, (m) => cropName(m));
6989
+ const langArr = Array.isArray(fpLangsRaw) ? fpLangsRaw : fpLangsRaw ? [fpLangsRaw] : [];
6990
+ let guard = 0;
6991
+ while (guard++ < 64) {
6992
+ let e = hole.end;
6993
+ while (e > hole.start && seps.includes(inp[e - 1])) e--;
6994
+ if (e <= hole.start) break;
6995
+ const cover = langArr.find((m) => m.start <= e - 1 && m.end >= e);
6996
+ if (cover && cover.start < hole.end) {
6997
+ hole.end = Math.min(hole.end, cover.start);
6998
+ } else break;
6999
+ }
7000
+ guard = 0;
7001
+ while (guard++ < 64) {
7002
+ let s = hole.start;
7003
+ while (s < hole.end && seps.includes(inp[s])) s++;
7004
+ if (s >= hole.end) break;
7005
+ const cover = langArr.find((m) => m.start <= s && m.end >= s + 1);
7006
+ if (cover && cover.end > hole.start) {
7007
+ hole.start = Math.max(hole.start, cover.end);
7008
+ } else break;
7009
+ }
7010
+ while (hole.start < hole.end && seps.includes(inp[hole.start])) hole.start++;
7011
+ while (hole.end > hole.start && seps.includes(inp[hole.end - 1])) hole.end--;
7012
+ if (hole.end <= hole.start || !hole.value) continue;
5493
7013
  const prevPred = (m) => !m.private && this.previousNames.includes(m.name ?? "");
5494
7014
  const prevMatches = matches.range(filepart.start, hole.start, prevPred);
5495
7015
  const prevArr = Array.isArray(prevMatches) ? prevMatches : prevMatches ? [prevMatches] : [];
@@ -5794,7 +7314,7 @@ const LANGUAGES = [
5794
7314
  { alpha3: "fin", alpha2: "fi", name: "Finnish", opensubtitles: "fin" },
5795
7315
  { alpha3: "hun", alpha2: "hu", name: "Hungarian", opensubtitles: "hun" },
5796
7316
  { alpha3: "ces", alpha2: "cs", name: "Czech", opensubtitles: "cze" },
5797
- { alpha3: "rum", alpha2: "ro", name: "Romanian", opensubtitles: "rum" },
7317
+ { alpha3: "ron", alpha2: "ro", name: "Romanian", opensubtitles: "rum" },
5798
7318
  { alpha3: "ukr", alpha2: "uk", name: "Ukrainian", opensubtitles: "ukr" },
5799
7319
  { alpha3: "heb", alpha2: "he", name: "Hebrew", opensubtitles: "heb" },
5800
7320
  { alpha3: "cat", alpha2: "ca", name: "Catalan", opensubtitles: "cat" },
@@ -6141,23 +7661,33 @@ class LanguageFinder {
6141
7661
  regularLangMap.get(key).add(match);
6142
7662
  }
6143
7663
  }
7664
+ const emitted = /* @__PURE__ */ new Set();
7665
+ const emit = (m) => {
7666
+ const key = `${m.propertyName}:${m.word.start}-${m.word.end}:${m.lang.alpha3}`;
7667
+ if (emitted.has(key)) return void 0;
7668
+ emitted.add(key);
7669
+ return this.toRebulkMatch(m);
7670
+ };
6144
7671
  for (const [key, values] of multiMap) {
6145
7672
  if (regularLangMap.has(key) || !undeterminedMap.has(key)) {
6146
7673
  for (const value of values) {
6147
- yield this.toRebulkMatch(value);
7674
+ const r = emit(value);
7675
+ if (r) yield r;
6148
7676
  }
6149
7677
  }
6150
7678
  }
6151
7679
  for (const [key, values] of undeterminedMap) {
6152
7680
  if (!regularLangMap.has(key)) {
6153
7681
  for (const value of values) {
6154
- yield this.toRebulkMatch(value);
7682
+ const r = emit(value);
7683
+ if (r) yield r;
6155
7684
  }
6156
7685
  }
6157
7686
  }
6158
7687
  for (const values of regularLangMap.values()) {
6159
7688
  for (const value of values) {
6160
- yield this.toRebulkMatch(value);
7689
+ const r = emit(value);
7690
+ if (r) yield r;
6161
7691
  }
6162
7692
  }
6163
7693
  }
@@ -6279,7 +7809,13 @@ class LanguageFinder {
6279
7809
  let matchEnd = currentWord.end;
6280
7810
  if (currentWord !== word) {
6281
7811
  const trimmedValue = value.trim();
6282
- if (trimmedValue && fallbackWord) {
7812
+ if (trimmedValue && word && word.value.toLowerCase() === trimmedValue) {
7813
+ matchStart = word.start;
7814
+ matchEnd = word.end;
7815
+ } else if (trimmedValue && word && word.nextWord && word.nextWord.value.toLowerCase() === trimmedValue) {
7816
+ matchStart = word.nextWord.start;
7817
+ matchEnd = word.nextWord.end;
7818
+ } else if (trimmedValue && fallbackWord) {
6283
7819
  matchStart = fallbackWord.start;
6284
7820
  matchEnd = fallbackWord.end;
6285
7821
  }
@@ -6528,30 +8064,29 @@ const _RemoveCommonWordsLanguageRule = class _RemoveCommonWordsLanguageRule exte
6528
8064
  this.consequence = RemoveMatch;
6529
8065
  this.priority = 32;
6530
8066
  }
6531
- when(matches, context) {
8067
+ when(matches, _context) {
6532
8068
  const toRemove = [];
6533
- const fileparts = matches.markers?.named("path") || [];
6534
- const filepartArr = Array.isArray(fileparts) ? fileparts : fileparts ? [fileparts] : [];
6535
- for (const filepart of filepartArr) {
6536
- const langs = matches.range?.(
6537
- filepart.start,
6538
- filepart.end,
6539
- (m) => m.name === "language" || m.name === "subtitle_language"
6540
- ) || [];
6541
- const commonLangs = langs.filter((m) => m.tags?.includes("common"));
6542
- const nonCommonLangs = langs.filter((m) => !m.tags?.includes("common"));
6543
- if (nonCommonLangs.length === 0) {
6544
- toRemove.push(...commonLangs);
6545
- } else {
6546
- const groups2 = matches.markers?.named?.("group") || [];
6547
- const groupArr = Array.isArray(groups2) ? groups2 : groups2 ? [groups2] : [];
6548
- const isInGroup = (m) => groupArr.some((g) => m.start >= g.start && m.end <= g.end);
6549
- const nonCommonOutsideGroups = nonCommonLangs.filter((m) => !isInGroup(m));
6550
- if (nonCommonOutsideGroups.length === 0) {
6551
- const commonOutsideGroups = commonLangs.filter((m) => !isInGroup(m));
6552
- toRemove.push(...commonOutsideGroups);
6553
- }
8069
+ const all = matches.range?.(0, matches.inputString?.length ?? 0, (m) => m.name === "language" || m.name === "subtitle_language") || [];
8070
+ const allArr = Array.isArray(all) ? all : all ? [all] : [];
8071
+ for (const match of allArr) {
8072
+ if (!match.tags?.includes("common")) continue;
8073
+ const group = matches.markers?.atMatch?.(match, (m) => m.name === "group", 0);
8074
+ if (group) {
8075
+ const nonLang = matches.range?.(
8076
+ group.start,
8077
+ group.end,
8078
+ (m) => m.name !== "language" && m.name !== "subtitle_language"
8079
+ );
8080
+ const hasNonLang = Array.isArray(nonLang) ? nonLang.length > 0 : !!nonLang;
8081
+ const holesRes = matches.holes?.(
8082
+ group.start,
8083
+ group.end,
8084
+ { predicate: (m) => m.value && [...String(m.value)].some((c) => !seps.includes(c)) }
8085
+ );
8086
+ const hasContentHoles = Array.isArray(holesRes) ? holesRes.length > 0 : !!holesRes;
8087
+ if (!hasNonLang && !hasContentHoles) continue;
6554
8088
  }
8089
+ toRemove.push(match);
6555
8090
  }
6556
8091
  return toRemove.length > 0 ? toRemove : false;
6557
8092
  }
@@ -6594,16 +8129,44 @@ const _RemoveUndeterminedLanguagesRule = class _RemoveUndeterminedLanguagesRule
6594
8129
  };
6595
8130
  _RemoveUndeterminedLanguagesRule.priority = 32;
6596
8131
  let RemoveUndeterminedLanguagesRule = _RemoveUndeterminedLanguagesRule;
6597
- function language(config, commonWords) {
6598
- const subtitleBoth = config.subtitle_affixes;
6599
- const subtitlePrefixes = [
6600
- ...subtitleBoth,
6601
- ...config.subtitle_prefixes
6602
- ].sort((a, b) => b.length - a.length);
6603
- const subtitleSuffixes = [
6604
- ...subtitleBoth,
6605
- ...config.subtitle_suffixes
6606
- ].sort((a, b) => b.length - a.length);
8132
+ class DedupLanguageRule extends Rule {
8133
+ constructor() {
8134
+ super(...arguments);
8135
+ this.consequence = RemoveMatch;
8136
+ this.dependency = [SubtitlePrefixLanguageRule, SubtitleSuffixLanguageRule, SubtitleExtensionRule];
8137
+ }
8138
+ identity(match) {
8139
+ const v = match.value;
8140
+ if (v instanceof Language) {
8141
+ const country2 = v.country;
8142
+ return `${v.alpha3}:${country2 ? String(country2) : ""}`;
8143
+ }
8144
+ return String(v);
8145
+ }
8146
+ when(matches) {
8147
+ const toRemove = [];
8148
+ for (const name of ["language", "subtitle_language"]) {
8149
+ const list = [...matches.named(name) || []].sort((a, b) => a.start - b.start || a.end - b.end);
8150
+ const seen = /* @__PURE__ */ new Set();
8151
+ for (const m of list) {
8152
+ const key = `${m.start}-${m.end}:${this.identity(m)}`;
8153
+ if (seen.has(key)) toRemove.push(m);
8154
+ else seen.add(key);
8155
+ }
8156
+ }
8157
+ return toRemove.length > 0 ? toRemove : false;
8158
+ }
8159
+ }
8160
+ function language(config, commonWords) {
8161
+ const subtitleBoth = config.subtitle_affixes;
8162
+ const subtitlePrefixes = [
8163
+ ...subtitleBoth,
8164
+ ...config.subtitle_prefixes
8165
+ ].sort((a, b) => b.length - a.length);
8166
+ const subtitleSuffixes = [
8167
+ ...subtitleBoth,
8168
+ ...config.subtitle_suffixes
8169
+ ].sort((a, b) => b.length - a.length);
6607
8170
  const langBoth = config.language_affixes;
6608
8171
  const langPrefixes = [...langBoth, ...config.language_prefixes].sort(
6609
8172
  (a, b) => b.length - a.length
@@ -6668,10 +8231,38 @@ function language(config, commonWords) {
6668
8231
  SubtitleExtensionRule,
6669
8232
  RemoveCommonWordsLanguageRule,
6670
8233
  RemoveLanguageRule,
6671
- RemoveUndeterminedLanguagesRule
8234
+ RemoveUndeterminedLanguagesRule,
8235
+ DedupLanguageRule,
8236
+ RemoveLanguageInsideTitle
6672
8237
  );
6673
8238
  return rebulk;
6674
8239
  }
8240
+ const _RemoveLanguageInsideTitle = class _RemoveLanguageInsideTitle extends Rule {
8241
+ constructor() {
8242
+ super(...arguments);
8243
+ this.consequence = RemoveMatch;
8244
+ }
8245
+ when(matches) {
8246
+ const titleNames = /* @__PURE__ */ new Set(["title", "episode_title", "alternative_title"]);
8247
+ const titles = matches.range(
8248
+ 0,
8249
+ (matches.inputString ?? "").length,
8250
+ (m) => titleNames.has(m.name ?? "")
8251
+ );
8252
+ if (!titles.length) return false;
8253
+ const out = [];
8254
+ for (const name of ["language", "subtitle_language"]) {
8255
+ for (const lang of matches.named(name)) {
8256
+ const rawLen = String(lang.raw ?? "").trim().length;
8257
+ if (rawLen > 3) continue;
8258
+ if (titles.some((t) => t.start <= lang.start && t.end >= lang.end)) out.push(lang);
8259
+ }
8260
+ }
8261
+ return out.length ? out : false;
8262
+ }
8263
+ };
8264
+ _RemoveLanguageInsideTitle.priority = POST_PROCESS;
8265
+ let RemoveLanguageInsideTitle = _RemoveLanguageInsideTitle;
6675
8266
  const COUNTRY_MAP = {
6676
8267
  "us": "US",
6677
8268
  "usa": "US",
@@ -6811,9 +8402,24 @@ function releaseGroup(config) {
6811
8402
  return rebulk.rules(
6812
8403
  new DashSeparatedReleaseGroup(cleanGroupname),
6813
8404
  new SceneReleaseGroup(cleanGroupname),
6814
- AnimeReleaseGroup
8405
+ AnimeReleaseGroup,
8406
+ new TrailingTokenAfterEpisodeAsReleaseGroup(cleanGroupname),
8407
+ RemoveSeasonPackReleaseGroup
6815
8408
  );
6816
8409
  }
8410
+ const _RemoveSeasonPackReleaseGroup = class _RemoveSeasonPackReleaseGroup extends Rule {
8411
+ constructor() {
8412
+ super(...arguments);
8413
+ this.consequence = RemoveMatch;
8414
+ }
8415
+ when(matches) {
8416
+ const rgs = matches.named("release_group");
8417
+ const out = (Array.isArray(rgs) ? rgs : rgs ? [rgs] : []).filter((m) => /(^|[\s._\-\[(])seasons?[\s._-]*\d/i.test(String(m.value ?? "")));
8418
+ return out.length ? out : false;
8419
+ }
8420
+ };
8421
+ _RemoveSeasonPackReleaseGroup.priority = POST_PROCESS;
8422
+ let RemoveSeasonPackReleaseGroup = _RemoveSeasonPackReleaseGroup;
6817
8423
  class DashSeparatedReleaseGroup extends Rule {
6818
8424
  constructor(valueFormatter) {
6819
8425
  super();
@@ -6828,6 +8434,17 @@ class DashSeparatedReleaseGroup extends Rule {
6828
8434
  if (matches.markers.atMatch(candidate, (m) => m.name === "group", 0)) {
6829
8435
  return false;
6830
8436
  }
8437
+ if (matches.range(candidate.start, candidate.end, (m) => m.name === "episode", 0)) {
8438
+ return false;
8439
+ }
8440
+ if (candidate.start === start && matches.range(
8441
+ candidate.end,
8442
+ end,
8443
+ (m) => ["season", "episode", "date"].includes(m.name ?? "") && !m.private,
8444
+ 0
8445
+ )) {
8446
+ return false;
8447
+ }
6831
8448
  const firstHole = matches.holes(
6832
8449
  candidate.end,
6833
8450
  end,
@@ -7067,7 +8684,11 @@ const _AnimeReleaseGroup = class _AnimeReleaseGroup extends Rule {
7067
8684
  (mm) => !mm.tags.includes("weak-language")
7068
8685
  );
7069
8686
  if (innerMatches.length === 0) return true;
7070
- return innerMatches.every((mm) => mm.name === "other");
8687
+ if (innerMatches.every((mm) => mm.name === "other")) return true;
8688
+ if (m.start === filepart.start && innerMatches.every((mm) => mm.name === "container" && mm.tags?.includes("subtitle"))) {
8689
+ return true;
8690
+ }
8691
+ return false;
7071
8692
  };
7072
8693
  const emptyGroup = matches.markers.range(
7073
8694
  filepart.start,
@@ -7086,7 +8707,7 @@ const _AnimeReleaseGroup = class _AnimeReleaseGroup extends Rule {
7086
8707
  ...matches.range(
7087
8708
  emptyGroup.start,
7088
8709
  emptyGroup.end,
7089
- (m) => m.tags.includes("weak-language") || m.name === "other"
8710
+ (m) => m.tags.includes("weak-language") || m.name === "other" || m.name === "container" && m.tags?.includes("subtitle")
7090
8711
  )
7091
8712
  );
7092
8713
  }
@@ -7101,6 +8722,57 @@ _AnimeReleaseGroup.dependency = ["SceneReleaseGroup", "TitleFromPosition"];
7101
8722
  _AnimeReleaseGroup.consequence = [RemoveMatch, AppendMatch];
7102
8723
  _AnimeReleaseGroup.properties = { release_group: [null] };
7103
8724
  let AnimeReleaseGroup = _AnimeReleaseGroup;
8725
+ const _TrailingTokenAfterEpisodeAsReleaseGroup = class _TrailingTokenAfterEpisodeAsReleaseGroup extends Rule {
8726
+ constructor(valueFormatter) {
8727
+ super();
8728
+ this.consequence = [RemoveMatch, AppendMatch];
8729
+ this.valueFormatter = valueFormatter;
8730
+ }
8731
+ when(matches) {
8732
+ if (matches.named("release_group").length > 0) return false;
8733
+ const inp = matches.inputString ?? "";
8734
+ const toRemove = [];
8735
+ const toAppend = [];
8736
+ for (const filepart of matches.markers.named("path")) {
8737
+ const last = matches.range(
8738
+ filepart.start,
8739
+ filepart.end,
8740
+ (m) => !m.private && m.name === "episode_title" && m.value,
8741
+ -1
8742
+ );
8743
+ if (!last) continue;
8744
+ const after = matches.range(
8745
+ last.end,
8746
+ filepart.end,
8747
+ (m) => !m.private && m.span[0] !== m.span[1],
8748
+ 0
8749
+ );
8750
+ if (after) continue;
8751
+ const raw = String(last.raw ?? last.value);
8752
+ if (/[\s.]/.test(raw.trim())) continue;
8753
+ if (inp[last.start - 1] !== "-") continue;
8754
+ const prev = matches.range(
8755
+ filepart.start,
8756
+ last.start,
8757
+ (m) => !m.private,
8758
+ -1
8759
+ );
8760
+ if (!prev || !["episode", "absolute_episode"].includes(prev.name ?? "")) continue;
8761
+ const rg = new Match(last.start, last.end, {
8762
+ name: "release_group",
8763
+ inputString: inp
8764
+ });
8765
+ rg.formatter = this.valueFormatter;
8766
+ if (rg.value) {
8767
+ toRemove.push(last);
8768
+ toAppend.push(rg);
8769
+ }
8770
+ }
8771
+ return toRemove.length || toAppend.length ? [toRemove, toAppend] : false;
8772
+ }
8773
+ };
8774
+ _TrailingTokenAfterEpisodeAsReleaseGroup.dependency = ["AnimeReleaseGroup"];
8775
+ let TrailingTokenAfterEpisodeAsReleaseGroup = _TrailingTokenAfterEpisodeAsReleaseGroup;
7104
8776
  function streamingService(config) {
7105
8777
  const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "streaming_service") });
7106
8778
  rebulk.stringDefaults({ ignoreCase: true }).regexDefaults({ flags: "i", abbreviations: [dash] });
@@ -7114,7 +8786,17 @@ const _ValidateStreamingService = class _ValidateStreamingService extends Rule {
7114
8786
  const toRemove = [];
7115
8787
  const allServices = matches.named("streaming_service");
7116
8788
  if (process.env.DEBUG_SS) console.log(`[VS.when] allServices count=${allServices.length}`);
8789
+ const inp = matches.inputString || "";
7117
8790
  for (const service of allServices) {
8791
+ const rawLen = (service.raw ?? "").length;
8792
+ if (rawLen <= 3) {
8793
+ const charAfter = inp[service.end];
8794
+ const charBefore = inp[service.start - 1];
8795
+ if (charAfter && /[a-z0-9]/i.test(charAfter) || charBefore && /[a-z0-9]/i.test(charBefore)) {
8796
+ toRemove.push(service);
8797
+ continue;
8798
+ }
8799
+ }
7118
8800
  const suffixPred = (m) => !m.private && m.tags?.includes("streaming_service.suffix");
7119
8801
  const prefixPred = (m) => !m.private && m.tags?.includes("streaming_service.prefix");
7120
8802
  const suffixMatches = matches.range(service.end, service.end + 30, suffixPred);
@@ -7182,11 +8864,60 @@ function other(config) {
7182
8864
  ValidateStreamingServiceNeighbor,
7183
8865
  ValidateAtEnd,
7184
8866
  ValidateReal,
8867
+ RemoveTitleCaseAmbiguous,
8868
+ ImageArtKeywordToOther,
7185
8869
  ProperCountRule,
7186
8870
  FixCountRule
7187
8871
  );
7188
8872
  return rebulk;
7189
8873
  }
8874
+ const ART_KEYWORDS = {
8875
+ poster: "Poster",
8876
+ fanart: "Fanart",
8877
+ banner: "Banner",
8878
+ thumb: "Thumbnail",
8879
+ thumbnail: "Thumbnail",
8880
+ landscape: "Landscape",
8881
+ cover: "Cover",
8882
+ clearart: "Clear Art",
8883
+ clearlogo: "Clear Logo",
8884
+ logo: "Logo",
8885
+ discart: "Disc Art"
8886
+ };
8887
+ const _ImageArtKeywordToOther = class _ImageArtKeywordToOther extends Rule {
8888
+ constructor() {
8889
+ super(...arguments);
8890
+ this.consequence = [RemoveMatch, AppendMatch];
8891
+ }
8892
+ when(matches) {
8893
+ const toRemove = [];
8894
+ const toAppend = [];
8895
+ for (const fp of matches.markers.named("path")) {
8896
+ const hasImage = matches.range(
8897
+ fp.start,
8898
+ fp.end,
8899
+ (m) => m.name === "container" && m.tags?.includes("image"),
8900
+ 0
8901
+ );
8902
+ if (!hasImage) continue;
8903
+ const cands = matches.range(
8904
+ fp.start,
8905
+ fp.end,
8906
+ (m) => ["title", "alternative_title", "episode_title"].includes(m.name ?? "")
8907
+ );
8908
+ for (const c of cands) {
8909
+ const key = String(c.value ?? "").trim().toLowerCase().replace(/[\s._-]+/g, "");
8910
+ const canon = ART_KEYWORDS[key];
8911
+ if (!canon) continue;
8912
+ toRemove.push(c);
8913
+ toAppend.push(new Match(c.start, c.end, { name: "other", value: canon, inputString: matches.inputString }));
8914
+ }
8915
+ }
8916
+ return toRemove.length ? [toRemove, toAppend] : false;
8917
+ }
8918
+ };
8919
+ _ImageArtKeywordToOther.priority = POST_PROCESS;
8920
+ let ImageArtKeywordToOther = _ImageArtKeywordToOther;
7190
8921
  function completeWords(rebulk, seasonWords, completeArticleWords) {
7191
8922
  const seasonWordsPattern = buildOrPattern(seasonWords);
7192
8923
  const completeArticleWordsPattern = buildOrPattern(completeArticleWords);
@@ -7252,7 +8983,7 @@ let ProperCountRule = _ProperCountRule;
7252
8983
  const _FixCountRule = class _FixCountRule extends Rule {
7253
8984
  when(matches) {
7254
8985
  const fixes = matches.named("other", (m2) => m2.value === "Fix").filter((m2) => {
7255
- const raw = rawCleanup(m2.raw).toLowerCase();
8986
+ const raw = rawCleanup(m2.raw ?? "").toLowerCase();
7256
8987
  return raw === "fix" || raw === "fixed";
7257
8988
  });
7258
8989
  if (!fixes || fixes.length === 0) return;
@@ -7495,6 +9226,23 @@ const _ValidateAtEnd = class _ValidateAtEnd extends Rule {
7495
9226
  _ValidateAtEnd.priority = 32;
7496
9227
  _ValidateAtEnd.consequence = RemoveMatch;
7497
9228
  let ValidateAtEnd = _ValidateAtEnd;
9229
+ const _RemoveTitleCaseAmbiguous = class _RemoveTitleCaseAmbiguous extends Rule {
9230
+ // Exact Title-Case spellings of words that double as common title words. The
9231
+ // canonical tag spellings ("PROPER", "REAL.PROPER", "CAM", "CONVERT") and
9232
+ // lowercase scene spellings are unaffected; only the Title-Case word is removed.
9233
+ when(matches) {
9234
+ const TITLE_WORDS = /* @__PURE__ */ new Set(["Real", "Cam", "Convert"]);
9235
+ const ret = [];
9236
+ for (const m of matches.range(0, matches.inputString?.length ?? 0)) {
9237
+ if (m.name !== "other" && m.name !== "source") continue;
9238
+ if (TITLE_WORDS.has(m.raw ?? "")) ret.push(m);
9239
+ }
9240
+ return ret.length ? ret : false;
9241
+ }
9242
+ };
9243
+ _RemoveTitleCaseAmbiguous.consequence = RemoveMatch;
9244
+ _RemoveTitleCaseAmbiguous.priority = 64;
9245
+ let RemoveTitleCaseAmbiguous = _RemoveTitleCaseAmbiguous;
7498
9246
  const _ValidateReal = class _ValidateReal extends Rule {
7499
9247
  when(matches) {
7500
9248
  const ret = [];
@@ -7611,9 +9359,35 @@ function bonus(config) {
7611
9359
  const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "bonus") });
7612
9360
  rebulk.regexDefaults({ name: "bonus", flags: "i" });
7613
9361
  loadConfigPatterns(rebulk, config["bonus"]);
7614
- rebulk.rules(BonusToEpisodeRule, BonusTitleRule);
9362
+ rebulk.rules(BonusAtFilepartStartRule, BonusToEpisodeRule, BonusTitleRule);
7615
9363
  return rebulk;
7616
9364
  }
9365
+ const _BonusAtFilepartStartRule = class _BonusAtFilepartStartRule extends Rule {
9366
+ when(matches) {
9367
+ const inputString = matches.inputString || "";
9368
+ const bonuses = matches.named("bonus")?.filter((m) => !m.private) ?? [];
9369
+ const toRemove = [];
9370
+ for (const bonus2 of bonuses) {
9371
+ const filepart = matches.markers.atMatch(bonus2, (m) => m.name === "path", 0);
9372
+ if (!filepart) continue;
9373
+ const parent = bonus2.parent;
9374
+ const xStart = parent ? parent.start : bonus2.start - 1;
9375
+ const before = inputString.slice(filepart.start, xStart);
9376
+ if ([...before].every((c) => seps.includes(c))) {
9377
+ toRemove.push(bonus2);
9378
+ if (parent) toRemove.push(parent);
9379
+ }
9380
+ }
9381
+ return toRemove;
9382
+ }
9383
+ then(matches, whenResponse) {
9384
+ for (const m of whenResponse) {
9385
+ matches.remove(m);
9386
+ }
9387
+ }
9388
+ };
9389
+ _BonusAtFilepartStartRule.priority = 128;
9390
+ let BonusAtFilepartStartRule = _BonusAtFilepartStartRule;
7617
9391
  const _BonusToEpisodeRule = class _BonusToEpisodeRule extends Rule {
7618
9392
  when(matches) {
7619
9393
  const bonuses = matches.named("bonus")?.filter((m) => !m.private) ?? [];
@@ -7940,7 +9714,7 @@ function crc(_config) {
7940
9714
  });
7941
9715
  rebulk.regex("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", {
7942
9716
  name: "uuid",
7943
- validator: null,
9717
+ validator: void 0,
7944
9718
  conflictSolver: (_match, other2) => ["episode", "season", "crc32"].includes(other2.name ?? "") ? other2 : "__default__"
7945
9719
  });
7946
9720
  rebulk.functional(guessIdnumber, {
@@ -7949,6 +9723,38 @@ function crc(_config) {
7949
9723
  });
7950
9724
  return rebulk;
7951
9725
  }
9726
+ function imdb(_config) {
9727
+ const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "imdb_id") });
9728
+ rebulk.regexDefaults({ flags: "i" });
9729
+ rebulk.defaults({ validator: sepsSurround });
9730
+ rebulk.regex("tt\\d{7,8}", {
9731
+ name: "imdb_id",
9732
+ formatter: (value) => value.toLowerCase()
9733
+ });
9734
+ rebulk.regex("tmdb(?:id)?[-=]?(?<tmdb_id>\\d{1,9})", {
9735
+ name: "tmdb_id",
9736
+ private_parent: true,
9737
+ children: true,
9738
+ formatter: (value) => parseInt(value, 10)
9739
+ });
9740
+ rebulk.regex("tvdb(?:id)?[-=]?(?<tvdb_id>\\d{1,9})", {
9741
+ name: "tvdb_id",
9742
+ private_parent: true,
9743
+ children: true,
9744
+ formatter: (value) => parseInt(value, 10)
9745
+ });
9746
+ return rebulk;
9747
+ }
9748
+ function volume(_config) {
9749
+ const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "volume") });
9750
+ rebulk.regexDefaults({ flags: "i" });
9751
+ rebulk.regex("vol(?:\\d{1,3}|(?:ume)?[-. ]\\d{1,3})", {
9752
+ name: "volume",
9753
+ validator: sepsSurround,
9754
+ formatter: (value) => parseInt(value.replace(/\D/g, ""), 10)
9755
+ });
9756
+ return rebulk;
9757
+ }
7952
9758
  const MIMETYPE_MAP = {
7953
9759
  "mkv": "video/x-matroska",
7954
9760
  "mp4": "video/mp4",
@@ -7966,9 +9772,19 @@ const MIMETYPE_MAP = {
7966
9772
  "jpeg": "image/jpeg",
7967
9773
  "png": "image/png",
7968
9774
  "gif": "image/gif",
9775
+ "svg": "image/svg+xml",
7969
9776
  "zip": "application/zip",
7970
9777
  "rar": "application/x-rar-compressed",
7971
- "pdf": "application/pdf"
9778
+ "pdf": "application/pdf",
9779
+ // .srt subtitles are plain text (matches Python's text/plain).
9780
+ "srt": "text/plain",
9781
+ // MPEG transport stream (Blu-ray/DVD/broadcast). video/mp2t is the correct
9782
+ // IANA type — Python's mimetypes returns a bogus "text/vnd.trolltech.linguist"
9783
+ // for .ts, so here we intentionally diverge to the *correct* value.
9784
+ "ts": "video/mp2t",
9785
+ // Disc image and torrent — both correct and match Python.
9786
+ "iso": "application/x-iso9660-image",
9787
+ "torrent": "application/x-bittorrent"
7972
9788
  };
7973
9789
  function mimetype(_config) {
7974
9790
  const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "mimetype") });
@@ -8459,6 +10275,8 @@ function rebulkBuilder(config) {
8459
10275
  rebulk.rebulk(film(cfg("film")));
8460
10276
  rebulk.rebulk(part(cfg("part")));
8461
10277
  rebulk.rebulk(crc(cfg("crc")));
10278
+ rebulk.rebulk(imdb(cfg("imdb")));
10279
+ rebulk.rebulk(volume(cfg("volume")));
8462
10280
  rebulk.rebulk(processors(cfg("processors")));
8463
10281
  rebulk.rebulk(mimetype(cfg("mimetype")));
8464
10282
  rebulk.rebulk(type_(cfg("type")));
@@ -8728,7 +10546,7 @@ const advanced_config = {
8728
10546
  },
8729
10547
  cd: {
8730
10548
  _cd_of_cd_count: {
8731
- regex: "cd-?(?P<cd>\\d+)(?:-?of-?(?P<cd_count>\\d+))?",
10549
+ regex: "(?<!\\d)(?<![^\\W\\d_])cd-?(?P<cd>\\d+)(?:-?of-?(?P<cd_count>\\d+))?",
8732
10550
  validator: {
8733
10551
  cd: "lambda match: 0 < match.value < 100",
8734
10552
  cd_count: "lambda match: 0 < match.value < 100"
@@ -8819,6 +10637,29 @@ const advanced_config = {
8819
10637
  ],
8820
10638
  nzb: [
8821
10639
  "nzb"
10640
+ ],
10641
+ archives: [
10642
+ "rar",
10643
+ "zip",
10644
+ "7z",
10645
+ "tar",
10646
+ "gz",
10647
+ "bz2",
10648
+ "tgz",
10649
+ "ace",
10650
+ "arj",
10651
+ "cbr",
10652
+ "cbz",
10653
+ "cb7"
10654
+ ],
10655
+ images: [
10656
+ "jpg",
10657
+ "jpeg",
10658
+ "png",
10659
+ "gif",
10660
+ "bmp",
10661
+ "tbn",
10662
+ "webp"
8822
10663
  ]
8823
10664
  },
8824
10665
  country: {
@@ -9033,7 +10874,8 @@ const advanced_config = {
9033
10874
  "s"
9034
10875
  ],
9035
10876
  season_ep_markers: [
9036
- "x"
10877
+ "x",
10878
+ "×"
9037
10879
  ],
9038
10880
  disc_markers: [
9039
10881
  "d"
@@ -9043,7 +10885,8 @@ const advanced_config = {
9043
10885
  "ex",
9044
10886
  "ep",
9045
10887
  "e",
9046
- "x"
10888
+ "x",
10889
+ "×"
9047
10890
  ],
9048
10891
  range_separators: [
9049
10892
  "-",
@@ -9390,6 +11233,57 @@ const advanced_config = {
9390
11233
  string: "3D",
9391
11234
  tags: "has-neighbor"
9392
11235
  },
11236
+ "Virtual Reality": {
11237
+ string: [
11238
+ "VR"
11239
+ ],
11240
+ regex: [
11241
+ "VR180",
11242
+ "VR360"
11243
+ ],
11244
+ tags: "has-neighbor"
11245
+ },
11246
+ "Opening Credits": {
11247
+ string: [
11248
+ "NCOP",
11249
+ "OPED"
11250
+ ],
11251
+ regex: [
11252
+ "NC-?OP",
11253
+ "creditless-?opening"
11254
+ ],
11255
+ tags: "has-neighbor"
11256
+ },
11257
+ "Ending Credits": {
11258
+ string: [
11259
+ "NCED"
11260
+ ],
11261
+ regex: [
11262
+ "NC-?ED",
11263
+ "creditless-?ending"
11264
+ ],
11265
+ tags: "has-neighbor"
11266
+ },
11267
+ "Half SBS": {
11268
+ string: [
11269
+ "HSBS"
11270
+ ],
11271
+ regex: [
11272
+ "Half-?SBS"
11273
+ ],
11274
+ tags: "has-neighbor"
11275
+ },
11276
+ "Half OU": {
11277
+ string: [
11278
+ "HOU",
11279
+ "HTAB"
11280
+ ],
11281
+ regex: [
11282
+ "Half-?OU",
11283
+ "Half-?TAB"
11284
+ ],
11285
+ tags: "has-neighbor"
11286
+ },
9393
11287
  "High Quality": {
9394
11288
  string: "HQ",
9395
11289
  tags: "uhdbluray-neighbor"
@@ -9397,10 +11291,16 @@ const advanced_config = {
9397
11291
  "High Resolution": "HR",
9398
11292
  "Line Dubbed": "LD",
9399
11293
  "Mic Dubbed": "MD",
9400
- "Micro HD": [
9401
- "mHD",
9402
- "HDLight"
9403
- ],
11294
+ "Micro HD": {
11295
+ string: [
11296
+ "mHD",
11297
+ "HDLight"
11298
+ ],
11299
+ regex: [
11300
+ "micro-?hd",
11301
+ "hd-?lite"
11302
+ ]
11303
+ },
9404
11304
  "Low Definition": "LDTV",
9405
11305
  "High Frame Rate": "HFR",
9406
11306
  "Variable Frame Rate": "VFR",
@@ -10023,6 +11923,1035 @@ function mergeOptionValue(option, value, merged) {
10023
11923
  function deepCopy(obj) {
10024
11924
  return JSON.parse(JSON.stringify(obj));
10025
11925
  }
11926
+ const GUESSIT_SCHEMA = {
11927
+ "absolute_episode": {
11928
+ "type": [
11929
+ "number"
11930
+ ],
11931
+ "array": true,
11932
+ "scalar": true
11933
+ },
11934
+ "alternative_title": {
11935
+ "type": [
11936
+ "string"
11937
+ ],
11938
+ "array": true,
11939
+ "scalar": true
11940
+ },
11941
+ "another": {
11942
+ "type": [
11943
+ "string"
11944
+ ],
11945
+ "array": false,
11946
+ "scalar": false
11947
+ },
11948
+ "aspect_ratio": {
11949
+ "type": [
11950
+ "number"
11951
+ ],
11952
+ "array": false,
11953
+ "scalar": true
11954
+ },
11955
+ "audio_bit_rate": {
11956
+ "type": [
11957
+ "string"
11958
+ ],
11959
+ "array": false,
11960
+ "scalar": true
11961
+ },
11962
+ "audio_channels": {
11963
+ "type": [
11964
+ "string"
11965
+ ],
11966
+ "array": true,
11967
+ "scalar": true,
11968
+ "enum": [
11969
+ "1.0",
11970
+ "1ch",
11971
+ "2.0",
11972
+ "20",
11973
+ "2ch",
11974
+ "5.1",
11975
+ "5ch",
11976
+ "6ch",
11977
+ "7.1",
11978
+ "7ch",
11979
+ "8ch",
11980
+ "mono",
11981
+ "stereo"
11982
+ ]
11983
+ },
11984
+ "audio_codec": {
11985
+ "type": [
11986
+ "string"
11987
+ ],
11988
+ "array": true,
11989
+ "scalar": true,
11990
+ "enum": [
11991
+ "AAC",
11992
+ "Atmos",
11993
+ "DD+",
11994
+ "DDP",
11995
+ "Dolby",
11996
+ "Dolby Atmos",
11997
+ "Dolby Digital",
11998
+ "Dolby Digital Plus",
11999
+ "Dolby TrueHD",
12000
+ "DolbyDigital",
12001
+ "DTS",
12002
+ "DTS-HD",
12003
+ "DTS-X",
12004
+ "DTS:X",
12005
+ "DTSX",
12006
+ "Flac",
12007
+ "FLAC",
12008
+ "LAME",
12009
+ "LPCM",
12010
+ "MP2",
12011
+ "MP3",
12012
+ "Opus",
12013
+ "PCM",
12014
+ "Vorbis"
12015
+ ]
12016
+ },
12017
+ "audio_profile": {
12018
+ "type": [
12019
+ "string"
12020
+ ],
12021
+ "array": true,
12022
+ "scalar": true,
12023
+ "enum": [
12024
+ "ES",
12025
+ "EX",
12026
+ "Extended Surround",
12027
+ "HE",
12028
+ "High Efficiency",
12029
+ "High Quality",
12030
+ "High Resolution Audio",
12031
+ "HQ",
12032
+ "HR",
12033
+ "HRA",
12034
+ "LC",
12035
+ "Low Complexity",
12036
+ "MA",
12037
+ "Master Audio"
12038
+ ]
12039
+ },
12040
+ "bonus": {
12041
+ "type": [
12042
+ "number"
12043
+ ],
12044
+ "array": false,
12045
+ "scalar": true
12046
+ },
12047
+ "bonus_title": {
12048
+ "type": [
12049
+ "string"
12050
+ ],
12051
+ "array": false,
12052
+ "scalar": true
12053
+ },
12054
+ "cd": {
12055
+ "type": [
12056
+ "number"
12057
+ ],
12058
+ "array": false,
12059
+ "scalar": true
12060
+ },
12061
+ "cd_count": {
12062
+ "type": [
12063
+ "number"
12064
+ ],
12065
+ "array": false,
12066
+ "scalar": true
12067
+ },
12068
+ "color_depth": {
12069
+ "type": [
12070
+ "string"
12071
+ ],
12072
+ "array": false,
12073
+ "scalar": true,
12074
+ "enum": [
12075
+ "10-bit",
12076
+ "12-bit",
12077
+ "8-bit"
12078
+ ]
12079
+ },
12080
+ "container": {
12081
+ "type": [
12082
+ "string"
12083
+ ],
12084
+ "array": true,
12085
+ "scalar": true,
12086
+ "enum": [
12087
+ "3g2",
12088
+ "3gp",
12089
+ "3gp2",
12090
+ "7z",
12091
+ "ace",
12092
+ "arj",
12093
+ "asf",
12094
+ "avi",
12095
+ "bmp",
12096
+ "bz2",
12097
+ "cb7",
12098
+ "cbr",
12099
+ "cbz",
12100
+ "divx",
12101
+ "flv",
12102
+ "gif",
12103
+ "gz",
12104
+ "idx",
12105
+ "iso",
12106
+ "jpeg",
12107
+ "jpg",
12108
+ "m2ts",
12109
+ "m4v",
12110
+ "mk2",
12111
+ "mk3d",
12112
+ "mka",
12113
+ "mkv",
12114
+ "MKV",
12115
+ "mov",
12116
+ "mp4",
12117
+ "mp4a",
12118
+ "mpeg",
12119
+ "mpg",
12120
+ "nfo",
12121
+ "nzb",
12122
+ "ogg",
12123
+ "ogm",
12124
+ "ogv",
12125
+ "png",
12126
+ "qt",
12127
+ "r00",
12128
+ "ra",
12129
+ "ram",
12130
+ "rar",
12131
+ "rm",
12132
+ "srt",
12133
+ "ssa",
12134
+ "tar",
12135
+ "tbn",
12136
+ "tgz",
12137
+ "torrent",
12138
+ "ts",
12139
+ "vob",
12140
+ "wav",
12141
+ "webm",
12142
+ "webp",
12143
+ "wma",
12144
+ "wmv",
12145
+ "zip"
12146
+ ]
12147
+ },
12148
+ "country": {
12149
+ "type": [
12150
+ "Language"
12151
+ ],
12152
+ "array": false,
12153
+ "scalar": true
12154
+ },
12155
+ "crc32": {
12156
+ "type": [
12157
+ "string"
12158
+ ],
12159
+ "array": false,
12160
+ "scalar": true
12161
+ },
12162
+ "date": {
12163
+ "type": [
12164
+ "object"
12165
+ ],
12166
+ "array": false,
12167
+ "scalar": true
12168
+ },
12169
+ "disc": {
12170
+ "type": [
12171
+ "number"
12172
+ ],
12173
+ "array": true,
12174
+ "scalar": true
12175
+ },
12176
+ "edition": {
12177
+ "type": [
12178
+ "string"
12179
+ ],
12180
+ "array": true,
12181
+ "scalar": true,
12182
+ "enum": [
12183
+ "Alternative Cut",
12184
+ "CC",
12185
+ "collector",
12186
+ "Collector",
12187
+ "Criterion",
12188
+ "DC",
12189
+ "ddc",
12190
+ "deluxe",
12191
+ "Deluxe",
12192
+ "Director's Cut",
12193
+ "Director's Definitive Cut",
12194
+ "extended",
12195
+ "Extended",
12196
+ "Fan",
12197
+ "Festival",
12198
+ "imax",
12199
+ "IMAX",
12200
+ "limited",
12201
+ "Limited",
12202
+ "Remastered",
12203
+ "Restored",
12204
+ "se",
12205
+ "Special",
12206
+ "theatrical",
12207
+ "Theatrical",
12208
+ "Ultimate",
12209
+ "Uncensored",
12210
+ "Uncut",
12211
+ "Unrated"
12212
+ ]
12213
+ },
12214
+ "episode": {
12215
+ "type": [
12216
+ "number"
12217
+ ],
12218
+ "array": true,
12219
+ "scalar": true
12220
+ },
12221
+ "episode_count": {
12222
+ "type": [
12223
+ "number"
12224
+ ],
12225
+ "array": false,
12226
+ "scalar": true
12227
+ },
12228
+ "episode_details": {
12229
+ "type": [
12230
+ "string"
12231
+ ],
12232
+ "array": true,
12233
+ "scalar": true
12234
+ },
12235
+ "episode_format": {
12236
+ "type": [
12237
+ "string"
12238
+ ],
12239
+ "array": false,
12240
+ "scalar": true,
12241
+ "enum": [
12242
+ "Minisode"
12243
+ ]
12244
+ },
12245
+ "episode_title": {
12246
+ "type": [
12247
+ "string"
12248
+ ],
12249
+ "array": true,
12250
+ "scalar": true
12251
+ },
12252
+ "film": {
12253
+ "type": [
12254
+ "number"
12255
+ ],
12256
+ "array": false,
12257
+ "scalar": true
12258
+ },
12259
+ "film_title": {
12260
+ "type": [
12261
+ "string"
12262
+ ],
12263
+ "array": false,
12264
+ "scalar": true
12265
+ },
12266
+ "frame_rate": {
12267
+ "type": [
12268
+ "string"
12269
+ ],
12270
+ "array": false,
12271
+ "scalar": true
12272
+ },
12273
+ "language": {
12274
+ "type": [
12275
+ "Language"
12276
+ ],
12277
+ "array": true,
12278
+ "scalar": true
12279
+ },
12280
+ "mimetype": {
12281
+ "type": [
12282
+ "string"
12283
+ ],
12284
+ "array": false,
12285
+ "scalar": true,
12286
+ "enum": [
12287
+ "application/x-bittorrent",
12288
+ "application/x-iso9660-image",
12289
+ "application/x-rar-compressed",
12290
+ "application/zip",
12291
+ "image/gif",
12292
+ "image/jpeg",
12293
+ "image/png",
12294
+ "text/plain",
12295
+ "video/mp2t",
12296
+ "video/mp4",
12297
+ "video/webm",
12298
+ "video/x-matroska",
12299
+ "video/x-msvideo"
12300
+ ]
12301
+ },
12302
+ "other": {
12303
+ "type": [
12304
+ "string"
12305
+ ],
12306
+ "array": true,
12307
+ "scalar": true,
12308
+ "enum": [
12309
+ "2in1",
12310
+ "3D",
12311
+ "asrequested",
12312
+ "Audio Fixed",
12313
+ "Banner",
12314
+ "Bonus",
12315
+ "BT.2020",
12316
+ "Classic",
12317
+ "Clear Art",
12318
+ "Clear Logo",
12319
+ "Colorized",
12320
+ "Complet",
12321
+ "Complete",
12322
+ "CONVERT",
12323
+ "Converted",
12324
+ "Cover",
12325
+ "Dirfix",
12326
+ "Disc Art",
12327
+ "DOCU",
12328
+ "Documentary",
12329
+ "DOKU",
12330
+ "Dolby Vision",
12331
+ "Dual",
12332
+ "Dual Audio",
12333
+ "East Coast Feed",
12334
+ "Ending Credits",
12335
+ "Extras",
12336
+ "Fan Subtitled",
12337
+ "Fanart",
12338
+ "Fansub",
12339
+ "Fast Subtitled",
12340
+ "Fastsub",
12341
+ "FHD",
12342
+ "Fix",
12343
+ "Fixed",
12344
+ "Full HD",
12345
+ "Half OU",
12346
+ "Half SBS",
12347
+ "Hardcoded Subtitles",
12348
+ "HC",
12349
+ "HD",
12350
+ "HDLight",
12351
+ "HDR10",
12352
+ "HFR",
12353
+ "High Frame Rate",
12354
+ "High Quality",
12355
+ "High Resolution",
12356
+ "HQ",
12357
+ "HR",
12358
+ "Hybrid",
12359
+ "Internal",
12360
+ "Landscape",
12361
+ "LD",
12362
+ "LDTV",
12363
+ "LiNE",
12364
+ "Line Audio",
12365
+ "Line Dubbed",
12366
+ "Logo",
12367
+ "Low Definition",
12368
+ "MD",
12369
+ "mHD",
12370
+ "Mic Dubbed",
12371
+ "Micro HD",
12372
+ "Mux",
12373
+ "Nfofix",
12374
+ "NTSC",
12375
+ "Oad",
12376
+ "OAR",
12377
+ "Oav",
12378
+ "Obfuscated",
12379
+ "Ona",
12380
+ "Open Matte",
12381
+ "Opening Credits",
12382
+ "Original Animated Video",
12383
+ "Original Animation DVD",
12384
+ "Original Aspect Ratio",
12385
+ "Original Net Animation",
12386
+ "Original Video",
12387
+ "OV",
12388
+ "Ova",
12389
+ "PAL",
12390
+ "postbot",
12391
+ "Poster",
12392
+ "Preair",
12393
+ "Proof",
12394
+ "Prooffix",
12395
+ "Proper",
12396
+ "PS Vita",
12397
+ "R5",
12398
+ "RC",
12399
+ "Read NFO",
12400
+ "Real",
12401
+ "Reencoded",
12402
+ "Region 5",
12403
+ "Region C",
12404
+ "Remux",
12405
+ "Repost",
12406
+ "Retail",
12407
+ "Rip",
12408
+ "Sample",
12409
+ "Scrambled",
12410
+ "Screener",
12411
+ "SDR",
12412
+ "SECAM",
12413
+ "Standard Dynamic Range",
12414
+ "Straight to Video",
12415
+ "STV",
12416
+ "Sync Fixed",
12417
+ "Thumbnail",
12418
+ "Trailer",
12419
+ "UHD",
12420
+ "Ultra HD",
12421
+ "Upscaled",
12422
+ "Variable Frame Rate",
12423
+ "VFR",
12424
+ "Virtual Reality",
12425
+ "Vita",
12426
+ "VO",
12427
+ "vost",
12428
+ "West Coast Feed",
12429
+ "Widescreen",
12430
+ "ws",
12431
+ "xpost",
12432
+ "XXX"
12433
+ ]
12434
+ },
12435
+ "part": {
12436
+ "type": [
12437
+ "number"
12438
+ ],
12439
+ "array": true,
12440
+ "scalar": true
12441
+ },
12442
+ "proper_count": {
12443
+ "type": [
12444
+ "number"
12445
+ ],
12446
+ "array": false,
12447
+ "scalar": true
12448
+ },
12449
+ "release_group": {
12450
+ "type": [
12451
+ "string"
12452
+ ],
12453
+ "array": false,
12454
+ "scalar": true
12455
+ },
12456
+ "screen_size": {
12457
+ "type": [
12458
+ "string"
12459
+ ],
12460
+ "array": false,
12461
+ "scalar": true,
12462
+ "enum": [
12463
+ "1080i",
12464
+ "1080p",
12465
+ "1440p",
12466
+ "1444x866",
12467
+ "2160p",
12468
+ "360p",
12469
+ "368p",
12470
+ "480p",
12471
+ "4k",
12472
+ "540p",
12473
+ "576p",
12474
+ "720p",
12475
+ "720x432",
12476
+ "960x544"
12477
+ ]
12478
+ },
12479
+ "season": {
12480
+ "type": [
12481
+ "number"
12482
+ ],
12483
+ "array": true,
12484
+ "scalar": true
12485
+ },
12486
+ "season_count": {
12487
+ "type": [
12488
+ "number"
12489
+ ],
12490
+ "array": false,
12491
+ "scalar": true
12492
+ },
12493
+ "size": {
12494
+ "type": [
12495
+ "string"
12496
+ ],
12497
+ "array": false,
12498
+ "scalar": true
12499
+ },
12500
+ "source": {
12501
+ "type": [
12502
+ "string"
12503
+ ],
12504
+ "array": false,
12505
+ "scalar": true,
12506
+ "enum": [
12507
+ "Analog HDTV",
12508
+ "Blu-ray",
12509
+ "Camera",
12510
+ "Digital Master",
12511
+ "Digital TV",
12512
+ "DVD",
12513
+ "HD Camera",
12514
+ "HD Telecine",
12515
+ "HD Telesync",
12516
+ "HD-DVD",
12517
+ "HDTV",
12518
+ "Pay-per-view",
12519
+ "Satellite",
12520
+ "Telecine",
12521
+ "Telesync",
12522
+ "TV",
12523
+ "Ultra HD Blu-ray",
12524
+ "Ultra HDTV",
12525
+ "VHS",
12526
+ "Video on Demand",
12527
+ "Web",
12528
+ "Workprint"
12529
+ ]
12530
+ },
12531
+ "streaming_service": {
12532
+ "type": [
12533
+ "string"
12534
+ ],
12535
+ "array": false,
12536
+ "scalar": true,
12537
+ "enum": [
12538
+ "4OD",
12539
+ "9Now",
12540
+ "9NOW",
12541
+ "A&E",
12542
+ "ABC",
12543
+ "ABC Australia",
12544
+ "Adult Swim",
12545
+ "AE",
12546
+ "AJAZ",
12547
+ "Al Jazeera English",
12548
+ "ALL4",
12549
+ "Amazon",
12550
+ "Amazon Prime",
12551
+ "AMBC",
12552
+ "AMC",
12553
+ "America's Test Kitchen",
12554
+ "AMZN",
12555
+ "AMZN-CBR",
12556
+ "Animal Planet",
12557
+ "AnimeLab",
12558
+ "ANLB",
12559
+ "ANPL",
12560
+ "AOL",
12561
+ "AppleTV",
12562
+ "APTV",
12563
+ "ARD",
12564
+ "AS",
12565
+ "ATK",
12566
+ "ATV+",
12567
+ "ATVP",
12568
+ "AUBC",
12569
+ "BBC iPlayer",
12570
+ "Binge",
12571
+ "BKPL",
12572
+ "Blackpills",
12573
+ "BLU",
12574
+ "BluTV",
12575
+ "BNGE",
12576
+ "BOOM",
12577
+ "Boomerang",
12578
+ "BRAV",
12579
+ "BravoTV",
12580
+ "Canal+",
12581
+ "Cartoon Network",
12582
+ "CBC",
12583
+ "CBS",
12584
+ "CC",
12585
+ "CCGC",
12586
+ "Channel 4",
12587
+ "CHGD",
12588
+ "CHRGD",
12589
+ "Cinemax",
12590
+ "CMAX",
12591
+ "CMT",
12592
+ "CN",
12593
+ "CNBC",
12594
+ "CNLP",
12595
+ "Comedians in Cars Getting Coffee",
12596
+ "Comedy Central",
12597
+ "Country Music Television",
12598
+ "CR",
12599
+ "Crackle",
12600
+ "CRAV",
12601
+ "Crave",
12602
+ "CRKL",
12603
+ "Crunchy Roll",
12604
+ "CSpan",
12605
+ "CSPN",
12606
+ "CTV",
12607
+ "CUR",
12608
+ "CuriosityStream",
12609
+ "CW",
12610
+ "CWS",
12611
+ "CWSeed",
12612
+ "Daisuki",
12613
+ "DC Universe",
12614
+ "DCU",
12615
+ "DDY",
12616
+ "Deadhouse Films",
12617
+ "DF",
12618
+ "DHF",
12619
+ "Digiturk Diledigin Yerde",
12620
+ "DISC",
12621
+ "Discovery",
12622
+ "Discovery Plus",
12623
+ "Disney",
12624
+ "Disney+",
12625
+ "DIY",
12626
+ "DIY Network",
12627
+ "Doc Club",
12628
+ "DOCC",
12629
+ "DPlay",
12630
+ "DPLY",
12631
+ "DramaFever",
12632
+ "DSCP",
12633
+ "DSKI",
12634
+ "DSNP",
12635
+ "DSNY",
12636
+ "E!",
12637
+ "El Trece",
12638
+ "ePix",
12639
+ "EPIX",
12640
+ "ESPN",
12641
+ "ESQ",
12642
+ "Esquire",
12643
+ "ETTV",
12644
+ "ETV",
12645
+ "Facebook Watch",
12646
+ "FAM",
12647
+ "Family",
12648
+ "Family Jr",
12649
+ "Fandor",
12650
+ "FANDOR",
12651
+ "FBWatch",
12652
+ "FJR",
12653
+ "FOOD",
12654
+ "Food Network",
12655
+ "Fox",
12656
+ "FOX",
12657
+ "Fox Premium",
12658
+ "FOXP",
12659
+ "Foxtel",
12660
+ "FP",
12661
+ "FREE",
12662
+ "Freeform",
12663
+ "FXTL",
12664
+ "FYI",
12665
+ "FYI Network",
12666
+ "Gaga",
12667
+ "GagaOOLala",
12668
+ "GC",
12669
+ "GLBL",
12670
+ "GLOB",
12671
+ "Global",
12672
+ "GloboSat Play",
12673
+ "Hallmark",
12674
+ "HBO",
12675
+ "HBO Go",
12676
+ "HBO Max",
12677
+ "HGTV",
12678
+ "HIST",
12679
+ "History",
12680
+ "HLMK",
12681
+ "HMAX",
12682
+ "hoichoi",
12683
+ "HoiChoi",
12684
+ "Hulu",
12685
+ "HULU",
12686
+ "ID",
12687
+ "IFC",
12688
+ "iflix",
12689
+ "IFX",
12690
+ "INA",
12691
+ "Investigation Discovery",
12692
+ "iP",
12693
+ "iQIYI",
12694
+ "iT",
12695
+ "iTunes",
12696
+ "ITV",
12697
+ "KNOW",
12698
+ "Knowledge Network",
12699
+ "LIFE",
12700
+ "Lifetime",
12701
+ "MBC",
12702
+ "MBCVOD",
12703
+ "MNBC",
12704
+ "Motor Trend OnDemand",
12705
+ "MSNBC",
12706
+ "MTOD",
12707
+ "MTV",
12708
+ "MUBI",
12709
+ "NATG",
12710
+ "National Audiovisual Institute",
12711
+ "National Film Board",
12712
+ "National Geographic",
12713
+ "NBA",
12714
+ "NBA TV",
12715
+ "NBC",
12716
+ "Netflix",
12717
+ "NF",
12718
+ "NFB",
12719
+ "NFL",
12720
+ "NFL Now",
12721
+ "NFLN",
12722
+ "NHL GameCenter",
12723
+ "NICK",
12724
+ "NICKAPP",
12725
+ "Nickelodeon",
12726
+ "Norsk Rikskringkasting",
12727
+ "NRK",
12728
+ "ODK",
12729
+ "OnDemandKorea",
12730
+ "Oprah Winfrey Network",
12731
+ "Opto",
12732
+ "OPTO",
12733
+ "OWN",
12734
+ "Paramount+",
12735
+ "ParamountPlus",
12736
+ "PBS",
12737
+ "PBS Kids",
12738
+ "PBSK",
12739
+ "PCOK",
12740
+ "Peacock",
12741
+ "Playstation Network",
12742
+ "PLUZ",
12743
+ "Pluzz",
12744
+ "PMNP",
12745
+ "PMT+",
12746
+ "PMTP",
12747
+ "POGO",
12748
+ "PokerGO",
12749
+ "PSN",
12750
+ "Rakuten TV",
12751
+ "RED",
12752
+ "RKTN",
12753
+ "ROKU",
12754
+ "RTE",
12755
+ "RTE One",
12756
+ "RUUTU",
12757
+ "SBS",
12758
+ "SCI",
12759
+ "Science Channel",
12760
+ "SeeSo",
12761
+ "SESO",
12762
+ "SHMI",
12763
+ "SHO",
12764
+ "Shomi",
12765
+ "Showtime",
12766
+ "SNET",
12767
+ "Sony",
12768
+ "SONY",
12769
+ "SPIK",
12770
+ "Spike",
12771
+ "Spike TV",
12772
+ "SPKE",
12773
+ "Sportsnet",
12774
+ "Sprout",
12775
+ "SPRT",
12776
+ "Stan",
12777
+ "STAN",
12778
+ "Starz",
12779
+ "STZ",
12780
+ "Sveriges Television",
12781
+ "SVT",
12782
+ "SwearNet",
12783
+ "SWER",
12784
+ "Syfy",
12785
+ "SYFY",
12786
+ "TBS",
12787
+ "TFou",
12788
+ "TFOU",
12789
+ "The CW",
12790
+ "The Roku Channel",
12791
+ "TLC",
12792
+ "TUBI",
12793
+ "TubiTV",
12794
+ "TV Land",
12795
+ "TV3",
12796
+ "TV3 Ireland",
12797
+ "TV4",
12798
+ "TV4 Sweeden",
12799
+ "TVING",
12800
+ "TVL",
12801
+ "TVNZ",
12802
+ "UFC",
12803
+ "UFC Fight Pass",
12804
+ "UKTV",
12805
+ "UNIV",
12806
+ "Univision",
12807
+ "USA Network",
12808
+ "USAN",
12809
+ "Velocity",
12810
+ "VH1",
12811
+ "VICE",
12812
+ "Viceland",
12813
+ "Viki",
12814
+ "VIKI",
12815
+ "Vimeo",
12816
+ "VLCT",
12817
+ "VMEO",
12818
+ "VRV",
12819
+ "W Network",
12820
+ "WatchMe",
12821
+ "WME",
12822
+ "WNET",
12823
+ "WWE Network",
12824
+ "WWEN",
12825
+ "XBOX",
12826
+ "Xbox Video",
12827
+ "Yahoo",
12828
+ "YHOO",
12829
+ "YouTube Red",
12830
+ "ZDF"
12831
+ ]
12832
+ },
12833
+ "subtitle_language": {
12834
+ "type": [
12835
+ "Language"
12836
+ ],
12837
+ "array": true,
12838
+ "scalar": true
12839
+ },
12840
+ "title": {
12841
+ "type": [
12842
+ "string"
12843
+ ],
12844
+ "array": false,
12845
+ "scalar": true
12846
+ },
12847
+ "type": {
12848
+ "type": [
12849
+ "string"
12850
+ ],
12851
+ "array": false,
12852
+ "scalar": true,
12853
+ "enum": [
12854
+ "episode",
12855
+ "movie"
12856
+ ]
12857
+ },
12858
+ "uuid": {
12859
+ "type": [
12860
+ "string"
12861
+ ],
12862
+ "array": false,
12863
+ "scalar": true
12864
+ },
12865
+ "version": {
12866
+ "type": [
12867
+ "number"
12868
+ ],
12869
+ "array": false,
12870
+ "scalar": true
12871
+ },
12872
+ "video_api": {
12873
+ "type": [
12874
+ "string"
12875
+ ],
12876
+ "array": false,
12877
+ "scalar": true,
12878
+ "enum": [
12879
+ "DXVA"
12880
+ ]
12881
+ },
12882
+ "video_bit_rate": {
12883
+ "type": [
12884
+ "string"
12885
+ ],
12886
+ "array": false,
12887
+ "scalar": true
12888
+ },
12889
+ "video_codec": {
12890
+ "type": [
12891
+ "string"
12892
+ ],
12893
+ "array": false,
12894
+ "scalar": true,
12895
+ "enum": [
12896
+ "DivX",
12897
+ "DVDivX",
12898
+ "H.263",
12899
+ "H.264",
12900
+ "H.265",
12901
+ "MPEG-2",
12902
+ "RealVideo",
12903
+ "VC-1",
12904
+ "VP7",
12905
+ "VP8",
12906
+ "VP80",
12907
+ "VP9",
12908
+ "Xvid",
12909
+ "XviD"
12910
+ ]
12911
+ },
12912
+ "video_profile": {
12913
+ "type": [
12914
+ "string"
12915
+ ],
12916
+ "array": true,
12917
+ "scalar": true,
12918
+ "enum": [
12919
+ "Advanced Video Codec High Definition",
12920
+ "Baseline",
12921
+ "BP",
12922
+ "EP",
12923
+ "Extended",
12924
+ "HEVC",
12925
+ "High",
12926
+ "High 10",
12927
+ "High 4:2:2",
12928
+ "High 4:4:4 Predictive",
12929
+ "High Efficiency Video Coding",
12930
+ "HiP",
12931
+ "HP",
12932
+ "Main",
12933
+ "MP",
12934
+ "SC",
12935
+ "Scalable Video Coding",
12936
+ "SVC",
12937
+ "XP"
12938
+ ]
12939
+ },
12940
+ "website": {
12941
+ "type": [
12942
+ "string"
12943
+ ],
12944
+ "array": false,
12945
+ "scalar": true
12946
+ },
12947
+ "year": {
12948
+ "type": [
12949
+ "number"
12950
+ ],
12951
+ "array": false,
12952
+ "scalar": true
12953
+ }
12954
+ };
10026
12955
  class GuessItException extends Error {
10027
12956
  constructor(string, options, cause) {
10028
12957
  const causeMsg = cause instanceof Error ? cause.message : String(cause);
@@ -10089,6 +13018,18 @@ class GuessItApi {
10089
13018
  !!mergedOptions["enforceList"] || !!mergedOptions["enforce_list"]
10090
13019
  );
10091
13020
  const result = Object.fromEntries(matchesDict);
13021
+ for (const key of ["language", "subtitle_language"]) {
13022
+ const v = result[key];
13023
+ if (!Array.isArray(v)) continue;
13024
+ const seen = /* @__PURE__ */ new Set();
13025
+ const deduped = v.filter((lang) => {
13026
+ const id = lang && typeof lang === "object" && "alpha3" in lang ? `${lang.alpha3}:${lang.country ?? ""}` : String(lang);
13027
+ if (seen.has(id)) return false;
13028
+ seen.add(id);
13029
+ return true;
13030
+ });
13031
+ result[key] = deduped.length === 1 ? deduped[0] : deduped;
13032
+ }
10092
13033
  if (mergedOptions["outputInputString"] || mergedOptions["output_input_string"]) {
10093
13034
  result["input_string"] = matches.inputString;
10094
13035
  }
@@ -10116,13 +13057,22 @@ class GuessItApi {
10116
13057
  }
10117
13058
  }
10118
13059
  }
10119
- const ordered = {};
13060
+ let ordered = {};
10120
13061
  for (const k of Object.keys(props).sort()) {
10121
13062
  ordered[k] = [...props[k]].sort((a, b) => String(a).localeCompare(String(b)));
10122
13063
  }
10123
13064
  const rb = this._rebulk;
10124
13065
  if (rb.customizeProperties) {
10125
- return rb.customizeProperties(ordered);
13066
+ ordered = rb.customizeProperties(ordered);
13067
+ }
13068
+ for (const [name, def] of Object.entries(GUESSIT_SCHEMA)) {
13069
+ const cur = Array.isArray(ordered[name]) ? ordered[name] : [];
13070
+ if (def.enum) {
13071
+ const merged = /* @__PURE__ */ new Set([...cur, ...def.enum]);
13072
+ ordered[name] = [...merged].sort((a, b) => String(a).localeCompare(String(b)));
13073
+ } else if (cur.length === 0) {
13074
+ ordered[name] = [null];
13075
+ }
10126
13076
  }
10127
13077
  return ordered;
10128
13078
  }
@@ -10151,6 +13101,7 @@ function reset() {
10151
13101
  defaultApi.reset();
10152
13102
  }
10153
13103
  export {
13104
+ GUESSIT_SCHEMA,
10154
13105
  GuessItApi,
10155
13106
  GuessItException,
10156
13107
  configure,