File size: 66,343 Bytes
cca0cf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
/**

 * @fileoverview Stealth Shield Matrix, Anti-Ban Protection UI & Cooldown Pacing Controller

 * @module controllers/stealth-pacing-controller

 * @description وحدة التحكم في دروع التخفي، محاكاة منحنيات الماوس، فترات التبريد الحرارية، واختبار السلوك الحي.

 */

(global => {
    'use strict';

    const SHIELD_INTEGRITY_SALT = global.FritreeAppConstants?.SECURITY_SALTS?.FB_SHIELD_SALT || 
        "FritreeFacebookStealthShieldSymmetricSignatureSalt_SHA256_2026_EnterpriseSecureForce";

    const DEFAULT_SHIELD_CONFIG = global.FritreeAppConstants?.DEFAULT_SHIELD_MATRIX || {
        scrollStepPixels: 250, scrollTotalCycles: 4, mouseMovementCycles: 5, mouseJitterSpeed: 8, coordinateJitterRadius: 8, showVirtualCursor: true,
        waScrollStepPixels: 200, waScrollTotalCycles: 3, waCoordinateJitterRadius: 6, waTypingDeletions: 3, typoRatio: 0.04,
        humanScrollActive: true, simulateMouseActive: true, antiHoneypotActive: true, humanTypingActive: true,
        canvasNoiseActive: true, audioContextNoiseActive: true, webRtcLeakProtectionActive: true,
        zwspObfuscationActive: true, zwspObfuscationDensity: 0.25, unicodeHomoglyphActive: true, unicodeHomoglyphStrength: 0.20,
        synonymParaphrasingActive: true, synonymParaphrasingStrength: 0.40, exifCleansingActive: true, pixelNoiseActive: true,
        unlimitedPublishingActive: true, unlimitedMessagingActive: true, antiBotScramblerActive: true,
        safeHoursSchedulerActive: true
    };

    /**

     * مصفوفة الحقول ذات المدخلات المزدوجة (Number Input + Range Slider)

     */
    const DUAL_INPUT_MAPPING = Object.freeze([
        { numId: 'im8lcqf85q', rangeId: 'r5r3nf944x', lblId: 'd2p6hdv09g', configKey: 'scrollStepPixels', suffix: ' بكسل' },
        { numId: 'xh4v4gefq8', rangeId: 'd2h9zi5d8q', lblId: 'z034ly7vrp', configKey: 'scrollTotalCycles', suffix: ' دورات' },
        { numId: 'ermiz7sdjh', rangeId: 'eohhg1ndju', lblId: 'lpmhfzu3km', configKey: 'mouseMovementCycles', suffix: ' مسارات' },
        { numId: 'zc4iigs48o', rangeId: 'qzakpnocrm', lblId: 'e4ajtz6vlv', configKey: 'mouseJitterSpeed', suffix: ' مللي ثانية' },
        { numId: 'wbf1v4khns', rangeId: 'uxum8urssm', lblId: 'y2n5vy9rut', configKey: 'coordinateJitterRadius', suffix: ' بكسل' },
        { numId: 'te2outp1tr', rangeId: 'z0cclfkndb', lblId: 'zbyylei7gx', configKey: 'waScrollStepPixels', suffix: ' بكسل' },
        { numId: 'yyju5075b0', rangeId: 'evjpj9u9hy', lblId: 'nm27sf3k3c', configKey: 'waScrollTotalCycles', suffix: ' دورات' },
        { numId: 'jyxpicjb18', rangeId: 'nq4w58kmh8', lblId: 'dnainkcka3', configKey: 'waCoordinateJitterRadius', suffix: ' بكسل' },
        { numId: 'w2zbm8bpbs', rangeId: 'n3w3m5tvbo', lblId: 'tqmedoe2pk', configKey: 'waTypingDeletions', suffix: ' دورات' },
        { numId: 'b1urxuziof', rangeId: 'jiejaczaq6', lblId: 'tny1nnj5ku', configKey: 'typoRatio', suffix: ' %' },
        { numId: 'dnevunqmlt', rangeId: 'juzm8y7nqm', lblId: 'xakyxiwhnt', configKey: 'zwspObfuscationDensity', suffix: ' %' },
        { numId: 'dmkenc7vj2', rangeId: 'mok38uk2ki', lblId: 'upisaz9z2w', configKey: 'unicodeHomoglyphStrength', suffix: ' %' },
        { numId: 'bxpbhgie4d', rangeId: 'j2p9auo70g', lblId: 'a7zbitm5o2', configKey: 'synonymParaphrasingStrength', suffix: ' %' }
    ]);

    /**

     * بناء نافذة إعدادات فترات الانتظار والتبريد ومحاكي الأمان (#b5p47f68ia)

     */
    function appendPacingModalLayout() {
        if (document.getElementById('b5p47f68ia')) return;

        const modal = document.createElement('div');
        modal.className = 'cpzxome5dd';
        modal.id = 'b5p47f68ia';
        modal.style.cssText = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: var(--z-modal-backdrop); background-color: rgba(15, 23, 42, 0.65); direction: rtl; text-align: right; box-sizing: border-box;';
        modal.innerHTML = `

            <div class="s4yvtq9394" style="max-width: min(820px, 94vw); max-height: min(90vh, 850px); border-radius: var(--radius-xl); background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-modal);">

                <div class="x8pdlyq70a" style="border-bottom: 1px solid var(--border); padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; background: var(--bg-subtle);">

                    <div class="tooau3ykdi" style="font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px;">

                        <i class="fa-solid fa-stopwatch" style="color: var(--primary);"></i> 

                        <span>إعدادات فترات التبريد والانتظار ومحاكي الأمان</span>

                    </div>

                    <button class="bcuz086hu4" id="close-pacing-modal-btn">&times;</button>

                </div>

                <div class="zn6t0dl6ke" style="padding: clamp(14px, 1.5vw, 22px); max-height: 78vh; overflow-y: auto;">

                    <!-- تبويبات فترات الانتظار -->

                    <div class="pfe6btieb6" style="margin-bottom: 16px;">

                        <div class="n9cqm6ze7d qo2hmc0xkq vn5qn7dmpk" id="h1w7d0p7nn" data-tab-target="mcuawm6x53">

                            <i class="fa-brands fa-facebook"></i> <span>تبريد فيسبوك</span>

                        </div>

                        <div class="n9cqm6ze7d qo2hmc0xkq" id="bwcd4lytz0" data-tab-target="xgbsksw8rt">

                            <i class="fa-brands fa-whatsapp"></i> <span>تبريد واتساب</span>

                        </div>

                        <div class="n9cqm6ze7d qo2hmc0xkq" id="tab-pacing-sim" data-tab-target="sim-pacing-tab">

                            <i class="fa-solid fa-chart-line"></i> <span>محاكي وقت وأمان الحملة</span>

                        </div>

                    </div>



                    <!-- 1. إعدادات تبريد فيسبوك -->

                    <div id="mcuawm6x53" class="oaw2p63ner" style="display: block;">

                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(12px, 1.4vw, 16px); margin-bottom: 12px; background: var(--bg-subtle);">

                            <div class="d0uttwsjz2" style="margin-bottom: 10px;">

                                <label style="font-weight: 700; font-size: 11.5px;"><i class="fa-solid fa-sliders"></i> <span>نمط التبريد والانتظار بين المجموعات:</span></label>

                                <select id="l37axh2l1n" class="xy26ymifmf" style="padding: 7px 10px; font-weight: 700;">

                                    <option value="continuous" selected>فترات تبريد حرارية متدرجة (عشوائي متقدم - الأكثر أماناً)</option>

                                    <option value="random">فترات انتظار عشوائية بين حد أدنى وأقصى</option>

                                    <option value="fixed">فترة انتظار ثابتة ومحددة</option>

                                    <option value="burst">دفعات سريعة مع فترات راحة طويلة</option>

                                </select>

                            </div>

                            <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 10px;">

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 10.5px;"><i class="fa-solid fa-hourglass-start"></i> <span>أقل فترة (ثانية):</span></label>

                                    <input type="number" id="fcdd19jd0b" class="xy26ymifmf" value="45" min="5" max="600" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 10.5px;"><i class="fa-solid fa-hourglass-end"></i> <span>أقصى فترة (ثانية):</span></label>

                                    <input type="number" id="nypjlieshn" class="xy26ymifmf" value="120" min="10" max="1200" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 10.5px;"><i class="fa-solid fa-lock"></i> <span>الانتظار الثابت (ث):</span></label>

                                    <input type="number" id="nmngttm14l" class="xy26ymifmf" value="60" min="5" max="600" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                            </div>

                            <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px;">

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">استراحة بعد X منشور:</label>

                                    <input type="number" id="er9a6wk592" class="xy26ymifmf" value="5" min="2" max="50" style="padding: 4px; text-align: center;">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">مدة الاستراحة (ث):</label>

                                    <input type="number" id="f85bxwyms9" class="xy26ymifmf" value="300" min="30" max="1800" style="padding: 4px; text-align: center;">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">راحة كبرى بعد X:</label>

                                    <input type="number" id="oifuahm7ox" class="xy26ymifmf" value="15" min="5" max="100" style="padding: 4px; text-align: center;">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">مدة الراحة الكبرى (ث):</label>

                                    <input type="number" id="l1mxkqhsts" class="xy26ymifmf" value="900" min="60" max="3600" style="padding: 4px; text-align: center;">

                                </div>

                            </div>

                        </div>

                    </div>



                    <!-- 2. إعدادات تبريد واتساب -->

                    <div id="xgbsksw8rt" class="oaw2p63ner" style="display: none;">

                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(12px, 1.4vw, 16px); margin-bottom: 12px; background: var(--bg-subtle);">

                            <div class="d0uttwsjz2" style="margin-bottom: 10px;">

                                <label style="font-weight: 700; font-size: 11.5px;"><i class="fa-solid fa-sliders"></i> <span>نمط التبريد والانتظار بين رسائل الواتساب:</span></label>

                                <select id="bfptsf9qwy" class="xy26ymifmf" style="padding: 7px 10px; font-weight: 700;">

                                    <option value="continuous" selected>فترات تبريد حرارية متدرجة (عشوائي متقدم - الأكثر أماناً)</option>

                                    <option value="random">فترات انتظار عشوائية بين حد أدنى وأقصى</option>

                                    <option value="fixed">فترة انتظار ثابتة ومحددة</option>

                                    <option value="burst">دفعات سريعة مع فترات راحة</option>

                                </select>

                            </div>

                            <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 10px;">

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 10.5px;"><i class="fa-solid fa-hourglass-start"></i> <span>أقل فترة (ثانية):</span></label>

                                    <input type="number" id="u7hi952ajh" class="xy26ymifmf" value="60" min="5" max="600" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 10.5px;"><i class="fa-solid fa-hourglass-end"></i> <span>أقصى فترة (ثانية):</span></label>

                                    <input type="number" id="zjxupa8x3b" class="xy26ymifmf" value="150" min="10" max="1200" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 10.5px;"><i class="fa-solid fa-lock"></i> <span>الانتظار الثابت (ث):</span></label>

                                    <input type="number" id="sfoi4d52jk" class="xy26ymifmf" value="75" min="5" max="600" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                            </div>

                            <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px;">

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">استراحة بعد X رسائل:</label>

                                    <input type="number" id="qne5lmug39" class="xy26ymifmf" value="5" min="2" max="50" style="padding: 4px; text-align: center;">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">مدة الاستراحة (ث):</label>

                                    <input type="number" id="a7y6fdy14u" class="xy26ymifmf" value="300" min="30" max="1800" style="padding: 4px; text-align: center;">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">راحة كبرى بعد X:</label>

                                    <input type="number" id="xpqbg0sodc" class="xy26ymifmf" value="10" min="5" max="100" style="padding: 4px; text-align: center;">

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 9.5px;">مدة الراحة الكبرى (ث):</label>

                                    <input type="number" id="ajt7y78irf" class="xy26ymifmf" value="900" min="60" max="3600" style="padding: 4px; text-align: center;">

                                </div>

                            </div>

                        </div>

                    </div>



                    <!-- 3. محاكي وقت وأمان الحملة -->

                    <div id="sim-pacing-tab" class="oaw2p63ner" style="display: none;">

                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(12px, 1.4vw, 16px); margin-bottom: 12px; background: var(--bg-subtle);">

                            <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;">

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 11px; font-weight: 700;"><i class="fa-solid fa-shapes"></i> <span>المنصة للمحاكاة:</span></label>

                                    <select id="txcj9gg61x" class="xy26ymifmf" style="padding: 6px 8px;">

                                        <option value="fb" selected>حملة فيسبوك (Facebook)</option>

                                        <option value="wa">حملة واتساب (WhatsApp)</option>

                                    </select>

                                </div>

                                <div class="d0uttwsjz2" style="margin: 0;">

                                    <label style="font-size: 11px; font-weight: 700;"><i class="fa-solid fa-hashtag"></i> <span>عدد عمليات الإرسال:</span></label>

                                    <input type="number" id="ebgtwww2cx" class="xy26ymifmf" value="20" min="1" max="500" style="padding: 6px; text-align: center; font-weight: 700; font-family: var(--font-code);">

                                </div>

                            </div>

                            <div style="display: flex; justify-content: space-between; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 10px; flex-wrap: wrap; gap: 8px;">

                                <div>

                                    <div id="c1xm1ix27g" style="font-size: 12.5px; font-weight: 800; color: var(--text-main);">

                                        <i class="fa-solid fa-stopwatch" style="color: var(--primary);"></i> <span>وقت التشغيل المتوقع: 25 دقيقة</span>

                                    </div>

                                    <div id="hshj1zv2hr" class="zcsc0rlnfn green" style="margin-top: 4px; font-size: 10.5px;">

                                        <i class="fa-solid fa-circle-check"></i> <span>مستوى أمان مرتفع وممتاز</span>

                                    </div>

                                </div>

                                <button type="button" id="dc1dg75tdv" class="itdnt14mss" style="padding: 6px 12px; font-size: 11px; font-weight: 800; min-height: 30px;">

                                    <i class="fa-solid fa-calculator"></i> <span>إعادة الحساب</span>

                                </button>

                            </div>

                        </div>

                    </div>



                    <!-- زر حفظ وتطبيق الإعدادات -->

                    <div style="display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px;">

                        <button type="button" id="save-pacing-btn" class="itdnt14mss" style="padding: 8px 20px; font-size: 12px; font-weight: 800;">

                            <i class="fa-solid fa-floppy-disk"></i> <span>حفظ وتطبيق فترات التبريد</span>

                        </button>

                    </div>

                </div>

            </div>

        `;
        document.body.appendChild(modal);

        document.getElementById('close-pacing-modal-btn').onclick = () => {
            modal.style.display = 'none';
        };

        document.getElementById('save-pacing-btn').onclick = async () => {
            await saveDelayIntervalSettingsFromModal();
            modal.style.display = 'none';
            alert('تم بنجاح حفظ وتأمين فترات الانتظار والتبريد الجديدة!');
        };
    }

    /**

     * حفظ إعدادات فترات التبريد من النافذة للتخزين المشفر

     */
    async function saveDelayIntervalSettingsFromModal() {
        const getNum = id => parseInt(document.getElementById(id)?.value, 10);
        const getStr = id => document.getElementById(id)?.value;

        const fbIntervals = {
            mode: getStr('l37axh2l1n') || 'continuous',
            min: getNum('fcdd19jd0b') || 45,
            max: getNum('nypjlieshn') || 120,
            fixed: getNum('nmngttm14l') || 60,
            burstCount: getNum('er9a6wk592') || 5,
            burstPause: getNum('f85bxwyms9') || 300,
            longBreakCount: getNum('oifuahm7ox') || 15,
            longBreakPause: getNum('l1mxkqhsts') || 900
        };

        const waIntervals = {
            mode: getStr('bfptsf9qwy') || 'continuous',
            min: getNum('u7hi952ajh') || 60,
            max: getNum('zjxupa8x3b') || 150,
            fixed: getNum('sfoi4d52jk') || 75,
            burstCount: getNum('qne5lmug39') || 5,
            burstPause: getNum('a7y6fdy14u') || 300,
            longBreakCount: getNum('xpqbg0sodc') || 10,
            longBreakPause: getNum('ajt7y78irf') || 900
        };

        if (global.FritreeStorage) {
            await global.FritreeStorage.set('local_sleep_intervals_fb', fbIntervals);
            await global.FritreeStorage.set('local_sleep_intervals_wa', waIntervals);
            await global.FritreeStorage.set('local_sleep_intervals', { fb: fbIntervals, wa: waIntervals });
        }

        updateAverageCooldownCardDisplay(fbIntervals);
    }

    /**

     * تحميل إعدادات فترات التبريد وتعبئتها في حقول النافذة

     */
    async function loadDelayIntervalSettingsIntoModal() {
        appendPacingModalLayout();
        if (!global.FritreeStorage) return;

        const fbIntervals = await global.FritreeStorage.get('local_sleep_intervals_fb', {
            mode: 'continuous', min: 45, max: 120, fixed: 60, burstCount: 5, burstPause: 300, longBreakCount: 15, longBreakPause: 900
        });

        const waIntervals = await global.FritreeStorage.get('local_sleep_intervals_wa', {
            mode: 'continuous', min: 60, max: 150, fixed: 75, burstCount: 5, burstPause: 300, longBreakCount: 10, longBreakPause: 900
        });

        const setVal = (id, val) => {
            const el = document.getElementById(id);
            if (el && val !== undefined) el.value = val;
        };

        setVal('l37axh2l1n', fbIntervals.mode);
        setVal('fcdd19jd0b', fbIntervals.min);
        setVal('nypjlieshn', fbIntervals.max);
        setVal('nmngttm14l', fbIntervals.fixed);
        setVal('er9a6wk592', fbIntervals.burstCount);
        setVal('f85bxwyms9', fbIntervals.burstPause);
        setVal('oifuahm7ox', fbIntervals.longBreakCount);
        setVal('l1mxkqhsts', fbIntervals.longBreakPause);

        setVal('bfptsf9qwy', waIntervals.mode);
        setVal('u7hi952ajh', waIntervals.min);
        setVal('zjxupa8x3b', waIntervals.max);
        setVal('sfoi4d52jk', waIntervals.fixed);
        setVal('qne5lmug39', waIntervals.burstCount);
        setVal('a7y6fdy14u', waIntervals.burstPause);
        setVal('xpqbg0sodc', waIntervals.longBreakCount);
        setVal('ajt7y78irf', waIntervals.longBreakPause);

        updateAverageCooldownCardDisplay(fbIntervals);
    }

    /**

     * تحديث شارة متوسط فترة التبريد في شاشة المراقبة

     */
    function updateAverageCooldownCardDisplay(intervals) {
        const badge = document.getElementById('e8fmmjhyng');
        if (!badge || !intervals) return;

        let display = '60 ثانية';
        if (intervals.mode === 'continuous' || intervals.mode === 'random') {
            const avg = Math.round(((intervals.min || 45) + (intervals.max || 120)) / 2);
            display = `${avg} ثانية (~${intervals.min}-${intervals.max} ث)`;
        } else if (intervals.mode === 'fixed') {
            display = `${intervals.fixed || 60} ثانية (ثابت)`;
        } else if (intervals.mode === 'burst') {
            display = `دفعة (${intervals.burstCount} عمليات)`;
        }
        badge.innerHTML = `<i class="fa-solid fa-gauge" style="font-size:14px; color:#6366f1;"></i> ${display}`;
    }

    /**

     * فتح نافذة إعدادات فترات التبريد وتوجيهها للمنصة المختارة

     */
    function openPacingModal(platform = 'fb') {
        appendPacingModalLayout();
        loadDelayIntervalSettingsIntoModal();
        const modal = document.getElementById('b5p47f68ia');
        if (!modal) return;

        const fbTab = document.getElementById('h1w7d0p7nn');
        const waTab = document.getElementById('bwcd4lytz0');
        if (platform === 'wa' && waTab) {
            waTab.click();
        } else if (fbTab) {
            fbTab.click();
        }

        modal.style.display = 'flex';
        runDelaySimulation();
    }

    /**

     * بناء واجهة قسم أمان الحساب ودروع التخفي (#qt3bcp0qq8)

     */
    function buildSecurityPaneLayout() {
        const contentArea = document.getElementById('s7ihkirolg');
        if (!contentArea) return false;

        const host = document.getElementById('fritree-dynamic-panes-host') || contentArea;
        let pane = document.getElementById('qt3bcp0qq8');
        if (pane) {
            if (pane.parentElement !== host) {
                host.appendChild(pane);
            }
            return true;
        }

        pane = document.createElement('section');
        pane.className = 'rjiai07g77';
        pane.id = 'qt3bcp0qq8';
        pane.innerHTML = `

            <div class="d5tp7way8h zcjbe1otmg" style="margin: 0; padding: clamp(14px, 1.8vw, 24px); border-radius: var(--radius-xl); border: 1px solid var(--border); direction: rtl; text-align: right; background: var(--bg-card); box-sizing: border-box;">

                

                <!-- ترويسة دروع الأمان ومؤشر الجاهزية -->

                <div style="display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 16px; flex-wrap: wrap; gap: 10px;">

                    <div>

                        <h2 style="font-size: clamp(15px, 1.2vw, 18px); font-weight: 900; display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-main);">

                            <i class="fa-solid fa-user-shield" style="color: #6366f1;"></i> 

                            <span>مركز أمان الحساب ودروع الحماية من الحظر</span>

                        </h2>

                        <p style="font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 700;">

                            <i class="fa-solid fa-shield-halved"></i> 

                            <span>محاكاة السلوك البشري الطبيعي وتمويه البصمة الرقمية لحماية حساباتك في فيسبوك وواتساب.</span>

                        </p>

                    </div>

                    <div id="bwl4zaunoo" class="zcsc0rlnfn green" style="font-size: 11.5px; padding: 5px 12px; font-weight: 800;">

                        <i class="fa-solid fa-shield-halved"></i> <span>مستوى حماية ممتاز وآمن تماماً</span>

                    </div>

                </div>



                <!-- شريط مؤشر كفاءة الحماية -->

                <div style="background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(12px, 1.4vw, 16px); margin-bottom: 16px;">

                    <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 800; margin-bottom: 6px;">

                        <span><i class="fa-solid fa-gauge-high" style="color: var(--primary);"></i> <span>مؤشر جاهزية دروع التخفي ومكافحة الحظر:</span></span>

                        <span id="security-score-pct-label" style="font-weight: 900; color: var(--success); font-family: var(--font-code);">100%</span>

                    </div>

                    <div class="s58rzsrk81" style="height: 10px;">

                        <div id="nzpx23e2am" class="xv12sshgcd" style="width: 100%;"></div>

                    </div>

                    <div id="remediations-box" style="margin-top: 8px; font-size: 10.5px; color: var(--text-muted); line-height: 1.5; display: none;"></div>

                </div>



                <!-- تبويبات إعدادات الحماية -->

                <div class="pfe6btieb6" style="margin-bottom: 16px;">

                    <div class="n9cqm6ze7d vn5qn7dmpk" id="jtdhxfkv1j">

                        <i class="fa-brands fa-facebook"></i> <span>دروع فيسبوك</span>

                    </div>

                    <div class="n9cqm6ze7d" id="lftegt1t8z">

                        <i class="fa-brands fa-whatsapp"></i> <span>دروع واتساب</span>

                    </div>

                    <div class="n9cqm6ze7d" id="lnlkhhgfo6">

                        <i class="fa-solid fa-bezier-curve"></i> <span>محاكاة حركة الماوس والتصفح</span>

                    </div>

                </div>



                <!-- 1. دروع فيسبوك -->

                <div id="c13az1759q" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(250px, 25vw, 1fr), 1fr)); gap: 12px; margin-bottom: 16px;">

                    <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-card);">

                        <strong style="font-size: 12.5px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 6px; color: var(--text-main);">

                            <i class="fa-solid fa-fingerprint" style="color: var(--primary);"></i> <span>حماية البصمة الرقمية (Fingerprint)</span>

                        </strong>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="ayeuwtm17p" checked>

                            <span>تطهير بيانات EXIF وحقن بكسل التمويه للصور</span>

                        </label>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="ctinl8rsq4" checked>

                            <span>تشويش بصمة المتصفح (Canvas Noise)</span>

                        </label>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="anbc67zy1r" checked>

                            <span>تمويه الحروف المتجانسة (Unicode Homoglyphs)</span>

                        </label>

                    </div>



                    <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-card);">

                        <strong style="font-size: 12.5px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 6px; color: var(--text-main);">

                            <i class="fa-solid fa-wand-magic-sparkles" style="color: #8b5cf6;"></i> <span>التمويه اللغوي الذكي</span>

                        </strong>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="ns1dmmtyz0" checked>

                            <span>تشويش الكلمات بالفواصل الصفرية (ZWSP)</span>

                        </label>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="g5ln0sgxqr" checked>

                            <span>إعادة الصياغة التلقائية بمعجم المترادفات</span>

                        </label>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="nsksvirsv9" checked>

                            <span>مبعثر ومشتت فلاتر البوتات (Anti-Bot Scrambler)</span>

                        </label>

                    </div>



                    <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-card);">

                        <strong style="font-size: 12.5px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 6px; color: var(--text-main);">

                            <i class="fa-solid fa-shield-halved" style="color: var(--success);"></i> <span>وضع الإرسال غير المحدود</span>

                        </strong>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="eu4jeaso7w" checked>

                            <span>تفعيل وضع النشر غير المحدود في فيسبوك</span>

                        </label>

                        <label class="mkxtd1c1kq" style="padding: 6px 10px; margin: 0; min-height: 36px;">

                            <input type="checkbox" id="x0xjllyi37" checked>

                            <span>تفعيل وضع البث غير المحدود في واتساب</span>

                        </label>

                    </div>

                </div>



                <!-- 2. دروع واتساب -->

                <div id="cx5bc9v8nm" style="display: none; flex-direction: column; gap: 12px; margin-bottom: 16px;">

                    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(250px, 25vw, 1fr), 1fr)); gap: 12px;">

                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; background: var(--bg-card); display: flex; flex-direction: column; gap: 8px;">

                            <strong style="font-size: 12.5px; display: flex; align-items: center; gap: 6px; color: var(--text-main);">

                                <i class="fa-brands fa-whatsapp" style="color: var(--wa-brand);"></i> <span>محاكاة كتابة مسودة تجريبية بالواتساب</span>

                            </strong>

                            <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-secondary);">

                                <span id="tqmedoe2pk">دورات كتابة وحذف المسودة: 3 دورات</span>

                                <input type="number" id="w2zbm8bpbs" value="3" min="1" max="6" style="width: 55px; text-align: center; padding: 4px;">

                            </div>

                            <input type="range" id="n3w3m5tvbo" min="1" max="6" value="3">

                        </div>



                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; background: var(--bg-card); display: flex; flex-direction: column; gap: 8px;">

                            <strong style="font-size: 12.5px; display: flex; align-items: center; gap: 6px; color: var(--text-main);">

                                <i class="fa-solid fa-keyboard" style="color: #0284c7;"></i> <span>نسبة الأخطاء الإملائية والسرعة الطبيعية</span>

                            </strong>

                            <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-secondary);">

                                <span id="tny1nnj5ku">نسبة الأخطاء الإملائية: 4 %</span>

                                <input type="number" id="b1urxuziof" value="4" min="0" max="15" style="width: 55px; text-align: center; padding: 4px;">

                            </div>

                            <input type="range" id="jiejaczaq6" min="0" max="15" value="4">

                        </div>

                    </div>

                </div>



                <!-- 3. محاكاة حركة الماوس والتصفح -->

                <div id="f155ivwba3" style="display: none; flex-direction: column; gap: 12px; margin-bottom: 16px;">

                    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(220px, 20vw, 1fr), 1fr)); gap: 10px;">

                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; background: var(--bg-card); display: flex; flex-direction: column; gap: 6px;">

                            <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-main);">

                                <span><i class="fa-solid fa-arrows-up-down" style="color:var(--primary);"></i> <span id="d2p6hdv09g">خطوة التصفح: 250 بكسل</span></span>

                                <input type="number" id="im8lcqf85q" value="250" min="100" max="800" style="width: 65px; text-align: center; padding: 4px;">

                            </div>

                            <input type="range" id="r5r3nf944x" min="100" max="800" value="250">

                        </div>



                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; background: var(--bg-card); display: flex; flex-direction: column; gap: 6px;">

                            <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-main);">

                                <span><i class="fa-solid fa-rotate" style="color:var(--primary);"></i> <span id="z034ly7vrp">دورات محاكاة القراءة: 4 دورات</span></span>

                                <input type="number" id="xh4v4gefq8" value="4" min="1" max="10" style="width: 65px; text-align: center; padding: 4px;">

                            </div>

                            <input type="range" id="d2h9zi5d8q" min="1" max="10" value="4">

                        </div>



                        <div style="border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; background: var(--bg-card); display: flex; flex-direction: column; gap: 6px;">

                            <div style="display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-main);">

                                <span><i class="fa-solid fa-bezier-curve" style="color:var(--primary);"></i> <span id="lpmhfzu3km">مسارات حركة الماوس: 5 مسارات</span></span>

                                <input type="number" id="ermiz7sdjh" value="5" min="1" max="12" style="width: 65px; text-align: center; padding: 4px;">

                            </div>

                            <input type="range" id="eohhg1ndju" min="1" max="12" value="5">

                        </div>

                    </div>



                    <div style="display: flex; gap: 8px; flex-wrap: wrap;">

                        <button type="button" id="sfiikjkf74" class="itdnt14mss" style="padding: 8px 14px; font-size: 11.5px; font-weight: 800;">

                            <i class="fa-solid fa-vial"></i> <span>إطلاق اختبار محاكاة السلوك في فيسبوك</span>

                        </button>

                        <button type="button" id="mj26t0wtq4" class="itdnt14mss" style="padding: 8px 14px; font-size: 11.5px; font-weight: 800; background: var(--wa-brand); border-color: var(--wa-brand);">

                            <i class="fa-solid fa-vial"></i> <span>إطلاق اختبار محاكاة السلوك في واتساب</span>

                        </button>

                    </div>

                </div>

            </div>

        `;

        host.appendChild(pane);
        return true;
    }

    /**

     * تبديل علامات تبويب درع التخفي

     */
    function initStealthModalTabs() {
        const tabFbRules = document.getElementById('jtdhxfkv1j');
        const tabFbMouse = document.getElementById('lnlkhhgfo6');
        const tabWaRules = document.getElementById('lftegt1t8z');
        const secFbBehavior = document.getElementById('c13az1759q');
        const secFbMouseScroll = document.getElementById('f155ivwba3');
        const secWaBehavior = document.getElementById('cx5bc9v8nm');

        const resetStealthTabColors = () => {
            [tabFbRules, tabFbMouse, tabWaRules].forEach(tab => {
                if (tab) tab.classList.remove('vn5qn7dmpk');
            });
        };

        const configureStealthPaneDisplay = (activeTab, activePane) => {
            [secFbBehavior, secFbMouseScroll, secWaBehavior].forEach(pane => {
                if (pane) pane.style.display = 'none';
            });
            resetStealthTabColors();
            if (activePane) {
                activePane.style.display = (activePane.id === 'c13az1759q') ? 'grid' : 'flex';
            }
            if (activeTab) {
                activeTab.classList.add('vn5qn7dmpk');
            }
        };

        if (tabFbRules) tabFbRules.onclick = () => configureStealthPaneDisplay(tabFbRules, secFbBehavior);
        if (tabFbMouse) tabFbMouse.onclick = () => configureStealthPaneDisplay(tabFbMouse, secFbMouseScroll);
        if (tabWaRules) tabWaRules.onclick = () => configureStealthPaneDisplay(tabWaRules, secWaBehavior);
    }

    /**

     * ربط مدخلات السلايدر المزدوجة بالاتجاهين (Two-Way Binding)

     */
    function initSlidersBinds() {
        DUAL_INPUT_MAPPING.forEach(pair => {
            const numEl = document.getElementById(pair.numId);
            const rangeEl = document.getElementById(pair.rangeId);
            const lblEl = document.getElementById(pair.lblId);

            if (numEl && rangeEl) {
                numEl.oninput = async (e) => {
                    let val = parseInt(e.target.value, 10) || 0;
                    const min = parseInt(rangeEl.min, 10);
                    const max = parseInt(rangeEl.max, 10);
                    if (val < min) val = min;
                    if (val > max) val = max;
                    rangeEl.value = val;

                    if (lblEl) {
                        if (pair.configKey === 'typoRatio') lblEl.textContent = `نسبة الأخطاء الإملائية: ${val} %`;
                        else if (pair.configKey === 'zwspObfuscationDensity') lblEl.textContent = `كثافة الفواصل الصفرية: ${val} %`;
                        else if (pair.configKey === 'unicodeHomoglyphStrength') lblEl.textContent = `نسبة الحروف المتجانسة: ${val} %`;
                        else if (pair.configKey === 'synonymParaphrasingStrength') lblEl.textContent = `معدل المترادفات: ${val} %`;
                        else lblEl.textContent = `${pair.lblId.includes('scroll') ? 'خطوة التصفح: ' : ''}${val.toLocaleString('en-US')}${pair.suffix}`;
                    }
                    await saveActiveStealthUIForm();
                };

                rangeEl.oninput = async (e) => {
                    const val = parseInt(e.target.value, 10);
                    numEl.value = val;

                    if (lblEl) {
                        if (pair.configKey === 'typoRatio') lblEl.textContent = `نسبة الأخطاء الإملائية: ${val} %`;
                        else if (pair.configKey === 'zwspObfuscationDensity') lblEl.textContent = `كثافة الفواصل الصفرية: ${val} %`;
                        else if (pair.configKey === 'unicodeHomoglyphStrength') lblEl.textContent = `نسبة الحروف المتجانسة: ${val} %`;
                        else if (pair.configKey === 'synonymParaphrasingStrength') lblEl.textContent = `معدل المترادفات: ${val} %`;
                        else lblEl.textContent = `${pair.lblId.includes('scroll') ? 'خطوة التصفح: ' : ''}${val.toLocaleString('en-US')}${pair.suffix}`;
                    }
                    await saveActiveStealthUIForm();
                };
            }
        });

        const newStealthChecks = [
            'sl9p4u8bsq', 'rhwr8ddxsn', 'ns1dmmtyz0', 'anbc67zy1r',
            'g5ln0sgxqr', 'ayeuwtm17p', 'ctinl8rsq4', 'eu4jeaso7w',
            'x0xjllyi37', 'nsksvirsv9'
        ];

        newStealthChecks.forEach(id => {
            const el = document.getElementById(id);
            if (el) {
                el.onchange = async () => {
                    await saveActiveStealthUIForm();
                };
            }
        });
    }

    /**

     * تحميل حالة درع التخفي وتعبئة عناصر النموذج

     */
    async function loadActiveStealthUIForm() {
        buildSecurityPaneLayout();
        appendPacingModalLayout();
        await loadDelayIntervalSettingsIntoModal();

        const config = await global.FritreeStorage.get('local_shield_config_matrix', DEFAULT_SHIELD_CONFIG);

        const setVal = (rangeId, numId, labelId, val, suffix = '', configKey = '') => {
            const range = document.getElementById(rangeId);
            const num = document.getElementById(numId);
            const label = document.getElementById(labelId);
            if (range) range.value = val;
            if (num) num.value = val;
            if (label) {
                if (configKey === 'typoRatio') label.textContent = `نسبة الأخطاء الإملائية: ${val} %`;
                else if (configKey === 'zwspObfuscationDensity') label.textContent = `كثافة الفواصل الصفرية: ${val} %`;
                else if (configKey === 'unicodeHomoglyphStrength') label.textContent = `نسبة الحروف المتجانسة: ${val} %`;
                else if (configKey === 'synonymParaphrasingStrength') label.textContent = `معدل المترادفات: ${val} %`;
                else label.textContent = `${labelId.includes('scroll') ? 'خطوة التصفح: ' : ''}${val.toLocaleString('en-US')}${suffix}`;
            }
        };

        setVal('r5r3nf944x', 'im8lcqf85q', 'd2p6hdv09g', config.scrollStepPixels || 250, ' بكسل');
        setVal('d2h9zi5d8q', 'xh4v4gefq8', 'z034ly7vrp', config.scrollTotalCycles || 4, ' دورات');
        setVal('eohhg1ndju', 'ermiz7sdjh', 'lpmhfzu3km', config.mouseMovementCycles || 5, ' مسارات');
        setVal('qzakpnocrm', 'zc4iigs48o', 'e4ajtz6vlv', config.mouseJitterSpeed || 8, ' مللي ثانية');
        setVal('uxum8urssm', 'wbf1v4khns', 'y2n5vy9rut', config.coordinateJitterRadius || 8, ' بكسل');
        setVal('z0cclfkndb', 'te2outp1tr', 'zbyylei7gx', config.waScrollStepPixels || 200, ' بكسل');
        setVal('evjpj9u9hy', 'yyju5075b0', 'nm27sf3k3c', config.waScrollTotalCycles || 3, ' دورات');
        setVal('nq4w58kmh8', 'jyxpicjb18', 'dnainkcka3', config.waCoordinateJitterRadius || 6, ' بكسل');
        setVal('n3w3m5tvbo', 'w2zbm8bpbs', 'tqmedoe2pk', config.waTypingDeletions || 3, ' دورات');
        setVal('jiejaczaq6', 'b1urxuziof', 'tny1nnj5ku', Math.round((config.typoRatio !== undefined ? config.typoRatio : 0.04) * 100), ' %', 'typoRatio');
        setVal('juzm8y7nqm', 'dnevunqmlt', 'xakyxiwhnt', Math.round((config.zwspObfuscationDensity !== undefined ? config.zwspObfuscationDensity : 0.25) * 100), ' %', 'zwspObfuscationDensity');
        setVal('mok38uk2ki', 'dmkenc7vj2', 'upisaz9z2w', Math.round((config.unicodeHomoglyphStrength !== undefined ? config.unicodeHomoglyphStrength : 0.20) * 100), ' %', 'unicodeHomoglyphStrength');
        setVal('j2p9auo70g', 'bxpbhgie4d', 'a7zbitm5o2', Math.round((config.synonymParaphrasingStrength !== undefined ? config.synonymParaphrasingStrength : 0.40) * 100), ' %', 'synonymParaphrasingStrength');

        const setCheckState = (id, val) => {
            const el = document.getElementById(id);
            if (el) el.checked = !!val;
        };

        setCheckState('sl9p4u8bsq', config.showVirtualCursor !== false);
        setCheckState('rhwr8ddxsn', config.showVirtualCursor !== false);
        setCheckState('ns1dmmtyz0', config.zwspObfuscationActive !== false);
        setCheckState('anbc67zy1r', config.unicodeHomoglyphActive !== false);
        setCheckState('g5ln0sgxqr', config.synonymParaphrasingActive !== false);
        setCheckState('ayeuwtm17p', config.exifCleansingActive !== false);
        setCheckState('ctinl8rsq4', config.pixelNoiseActive !== false);
        setCheckState('eu4jeaso7w', config.unlimitedPublishingActive !== false);
        setCheckState('x0xjllyi37', config.unlimitedMessagingActive !== false);
        setCheckState('nsksvirsv9', config.antiBotScramblerActive !== false);

        if (global.FritreeAntibanRulesService && typeof global.FritreeAntibanRulesService.evaluateRisk === 'function') {
            await global.FritreeAntibanRulesService.evaluateRisk();
        }
    }

    /**

     * حفظ وتوقيع خيارات درع التخفي في التخزين المشفر

     */
    async function saveActiveStealthUIForm() {
        const currentMatrix = await global.FritreeStorage.get('local_shield_config_matrix', DEFAULT_SHIELD_CONFIG);

        const getVal = (id) => {
            const el = document.getElementById(id);
            return el ? parseInt(el.value, 10) : null;
        };

        const step = getVal('im8lcqf85q') || getVal('r5r3nf944x');
        const cycles = getVal('xh4v4gefq8') || getVal('d2h9zi5d8q');
        const mCycles = getVal('ermiz7sdjh') || getVal('eohhg1ndju');
        const mSpeed = getVal('zc4iigs48o') || getVal('qzakpnocrm');
        const clickJitter = getVal('wbf1v4khns') || getVal('uxum8urssm');
        const chkCursor = document.getElementById('sl9p4u8bsq');

        if (step !== null) currentMatrix.scrollStepPixels = step;
        if (cycles !== null) currentMatrix.scrollTotalCycles = cycles;
        if (mCycles !== null) currentMatrix.mouseMovementCycles = mCycles;
        if (mSpeed !== null) currentMatrix.mouseJitterSpeed = mSpeed;
        if (clickJitter !== null) currentMatrix.coordinateJitterRadius = clickJitter;
        if (chkCursor) currentMatrix.showVirtualCursor = chkCursor.checked;

        const waStep = getVal('te2outp1tr') || getVal('z0cclfkndb');
        const waCycles = getVal('yyju5075b0') || getVal('evjpj9u9hy');
        const waClickJitter = getVal('jyxpicjb18') || getVal('nq4w58kmh8');
        const waTypingDeletions = getVal('w2zbm8bpbs') || getVal('n3w3m5tvbo');
        const chkWaCursor = document.getElementById('rhwr8ddxsn');

        if (waStep !== null) currentMatrix.waScrollStepPixels = waStep;
        if (waCycles !== null) currentMatrix.waScrollTotalCycles = waCycles;
        if (waClickJitter !== null) currentMatrix.waCoordinateJitterRadius = waClickJitter;
        if (waTypingDeletions !== null) currentMatrix.waTypingDeletions = waTypingDeletions;
        if (chkWaCursor) currentMatrix.showVirtualCursor = chkWaCursor.checked;

        const getPctVal = (numId, rangeId) => {
            const val = getVal(numId) || getVal(rangeId);
            return val !== null ? val / 100 : null;
        };

        const typo = getPctVal('b1urxuziof', 'jiejaczaq6');
        const zwspD = getPctVal('dnevunqmlt', 'juzm8y7nqm');
        const homoglyphS = getPctVal('dmkenc7vj2', 'mok38uk2ki');
        const paraS = getPctVal('bxpbhgie4d', 'j2p9auo70g');

        if (typo !== null) currentMatrix.typoRatio = typo;
        if (zwspD !== null) currentMatrix.zwspObfuscationDensity = zwspD;
        if (homoglyphS !== null) currentMatrix.unicodeHomoglyphStrength = homoglyphS;
        if (paraS !== null) currentMatrix.synonymParaphrasingStrength = paraS;

        const getCheckState = (id) => {
            const el = document.getElementById(id);
            return el ? el.checked : true;
        };

        currentMatrix.zwspObfuscationActive = getCheckState('ns1dmmtyz0');
        currentMatrix.unicodeHomoglyphActive = getCheckState('anbc67zy1r');
        currentMatrix.synonymParaphrasingActive = getCheckState('g5ln0sgxqr');
        currentMatrix.exifCleansingActive = getCheckState('ayeuwtm17p');
        currentMatrix.pixelNoiseActive = getCheckState('ctinl8rsq4');
        currentMatrix.unlimitedPublishingActive = getCheckState('eu4jeaso7w');
        currentMatrix.unlimitedMessagingActive = getCheckState('x0xjllyi37');
        currentMatrix.antiBotScramblerActive = getCheckState('nsksvirsv9');

        const serialized = JSON.stringify(currentMatrix);
        const concatString = `${serialized}:${SHIELD_INTEGRITY_SALT}`;
        let signature = "fallback_shield_sig_512_" + concatString.length;

        if (global.FritreeCrypto && typeof global.FritreeCrypto.signReceipt === 'function') {
            signature = await global.FritreeCrypto.signReceipt(
                "FB_STEALTH_SHIELD", 
                concatString.length, 
                "config_signature_512", 
                concatString, 
                SHIELD_INTEGRITY_SALT
            );
        }

        await global.FritreeStorage.set('local_shield_config_matrix', currentMatrix);
        await global.FritreeStorage.set('local_shield_config_matrix_sig_512', signature);

        if (global.FritreeAntibanRulesService && typeof global.FritreeAntibanRulesService.evaluateRisk === 'function') {
            await global.FritreeAntibanRulesService.evaluateRisk();
        }
    }

    /**

     * إطلاق اختبار محاكاة السلوك البشري الحي في التبويب النشط

     */
    function initLiveTestTriggers() {
        const liveTestBtn = document.getElementById('sfiikjkf74');
        if (liveTestBtn) {
            liveTestBtn.onclick = async () => {
                liveTestBtn.disabled = true;
                liveTestBtn.style.opacity = '0.7';
                liveTestBtn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> <span>جاري محاكاة الحركة في فيسبوك...</span>';

                chrome.tabs.query({ url: ['*://*.facebook.com/*', '*://*.web.facebook.com/*'] }, (tabs) => {
                    if (!tabs || !tabs.length) {
                        alert('تنبيه: لا يوجد أي تبويب فيسبوك مفتوح حالياً. افتح فيسبوك لتشغيل التجربة!');
                        resetLiveTestBtn();
                        return;
                    }
                    chrome.tabs.sendMessage(tabs[0].id, { action: 'execute_live_stealth_test' }, (response) => {
                        if (chrome.runtime.lastError) {
                            alert('فشل الربط: يرجى إبقاء صفحة فيسبوك محملة في التبويب النشط.');
                        } else if (response && response.success) {
                            if (typeof window.addLog === 'function') {
                                window.addLog('اكتمل الاختبار المباشر: تمت محاكاة حركة الماوس والتصفح في فيسبوك بنجاح.', 'success');
                            }
                        }
                        resetLiveTestBtn();
                    });
                });

                function resetLiveTestBtn() {
                    liveTestBtn.disabled = false;
                    liveTestBtn.style.opacity = '1';
                    liveTestBtn.innerHTML = '<i class="fa-solid fa-vial"></i> <span>إطلاق اختبار محاكاة السلوك في فيسبوك</span>';
                }
            };
        }

        const waLiveTestBtn = document.getElementById('mj26t0wtq4');
        if (waLiveTestBtn) {
            waLiveTestBtn.onclick = async () => {
                waLiveTestBtn.disabled = true;
                waLiveTestBtn.style.opacity = '0.7';
                waLiveTestBtn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> <span>جاري محاكاة الحركة في واتساب ويب...</span>';

                chrome.tabs.query({ url: ['*://web.whatsapp.com/*', '*://*.whatsapp.com/*'] }, (tabs) => {
                    if (!tabs || !tabs.length) {
                        alert('تنبيه: صفحة واتساب ويب غير مفتوحة حالياً. افتح واتساب ويب أولاً للتجربة المباشرة!');
                        resetWaLiveTestBtn();
                        return;
                    }
                    chrome.tabs.sendMessage(tabs[0].id, { action: 'execute_live_stealth_test' }, (response) => {
                        if (chrome.runtime.lastError) {
                            alert('فشل الربط: تأكد من تحميل صفحة واتساب ويب.');
                        } else if (response && response.success) {
                            if (typeof window.addLog === 'function') {
                                window.addLog('اكتمل اختبار الواتساب المباشر: تمت محاكاة التصفح وحركة الماوس داخل المحادثة بنجاح.', 'success');
                            }
                        }
                        resetWaLiveTestBtn();
                    });
                });

                function resetWaLiveTestBtn() {
                    waLiveTestBtn.disabled = false;
                    waLiveTestBtn.style.opacity = '1';
                    waLiveTestBtn.innerHTML = '<i class="fa-solid fa-vial"></i> <span>إطلاق اختبار محاكاة السلوك في واتساب</span>';
                }
            };
        }
    }

    /**

     * ربط تنقل تبويبات فترات الانتظار والتبريد ومحاكي الأمان

     */
    function bindPacingTabNav() {
        const tabs = document.querySelectorAll('.qo2hmc0xkq');
        if (!tabs || tabs.length === 0) return;

        tabs.forEach(tab => {
            tab.onclick = () => {
                const targetId = tab.getAttribute('data-tab-target');
                if (!targetId) return;

                document.querySelectorAll('.qo2hmc0xkq').forEach(t => t.classList.remove('vn5qn7dmpk'));
                document.querySelectorAll('.oaw2p63ner').forEach(c => c.style.display = 'none');
                tab.classList.add('vn5qn7dmpk');

                const targetSec = document.getElementById(targetId);
                if (targetSec) targetSec.style.display = 'block';

                const simPlatformSelect = document.getElementById('txcj9gg61x');
                if (simPlatformSelect) {
                    if (targetId === 'mcuawm6x53') simPlatformSelect.value = 'fb';
                    if (targetId === 'xgbsksw8rt') simPlatformSelect.value = 'wa';
                }
                runDelaySimulation();
            };
        });
    }

    /**

     * محاكاة خطة النشر والجدول الزمني للعمليات

     */
    function runDelaySimulation() {
        const simPlatform = document.getElementById('txcj9gg61x')?.value || 'fb';
        const modeSelect = simPlatform === 'wa' ? document.getElementById('bfptsf9qwy') : document.getElementById('l37axh2l1n');
        const postCountInput = document.getElementById('ebgtwww2cx');

        const mode = modeSelect ? modeSelect.value : 'continuous';
        const postCount = parseInt(postCountInput ? postCountInput.value : '20', 10) || 20;

        const minDelay = parseInt(document.getElementById(simPlatform === 'wa' ? 'u7hi952ajh' : 'fcdd19jd0b')?.value || '45', 10) || 45;
        const maxDelay = parseInt(document.getElementById(simPlatform === 'wa' ? 'zjxupa8x3b' : 'nypjlieshn')?.value || '120', 10) || 120;
        const fixedDelay = parseInt(document.getElementById(simPlatform === 'wa' ? 'sfoi4d52jk' : 'nmngttm14l')?.value || '60', 10) || 60;
        const burstCount = parseInt(document.getElementById(simPlatform === 'wa' ? 'qne5lmug39' : 'er9a6wk592')?.value || '5', 10) || 5;
        const burstPause = parseInt(document.getElementById(simPlatform === 'wa' ? 'a7y6fdy14u' : 'f85bxwyms9')?.value || '300', 10) || 300;
        const longBreakCount = parseInt(document.getElementById(simPlatform === 'wa' ? 'xpqbg0sodc' : 'oifuahm7ox')?.value || '15', 10) || 15;
        const longBreakPause = parseInt(document.getElementById(simPlatform === 'wa' ? 'ajt7y78irf' : 'l1mxkqhsts')?.value || '900', 10) || 900;

        let totalSeconds = 0;
        let totalCooldown = 0;

        for (let i = 1; i <= postCount; i++) {
            totalSeconds += 5;
            let stepCooldown = 0;

            if (i < postCount) {
                if (mode === 'continuous') {
                    const decayRatio = (postCount - i) / postCount;
                    const median = (minDelay + maxDelay) / 2;
                    stepCooldown = Math.floor(minDelay + (median * decayRatio));
                } else if (mode === 'fixed') {
                    stepCooldown = fixedDelay;
                } else if (mode === 'burst') {
                    stepCooldown = (i % burstCount === 0) ? burstPause : 10;
                } else {
                    stepCooldown = Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay;
                }
                totalCooldown += stepCooldown;
                totalSeconds += stepCooldown;
            }

            if (longBreakCount > 0 && i < postCount && i % longBreakCount === 0) {
                totalSeconds += longBreakPause;
            }
        }

        const totalMinutes = Math.ceil(totalSeconds / 60);
        const outputSummaryText = document.getElementById('c1xm1ix27g');
        if (outputSummaryText) {
            outputSummaryText.innerHTML = `<i class="fa-solid fa-stopwatch" style="color:var(--primary);"></i> <span>إجمالي وقت تشغيل الحملة المتوقع: ${totalMinutes} دقيقة</span>`;
        }

        const avgInterval = postCount > 1 ? (totalCooldown / (postCount - 1)) : totalCooldown;
        const safetyBadge = document.getElementById('hshj1zv2hr');
        const minSafeAvg = simPlatform === 'wa' ? 45 : 30;

        if (safetyBadge) {
            if (avgInterval < minSafeAvg) {
                safetyBadge.className = "zcsc0rlnfn red";
                safetyBadge.innerHTML = `<i class="fa-solid fa-triangle-exclamation"></i> <span>مستوى أمان منخفض (خطر حظر مرتفع)</span>`;
            } else if (avgInterval < (minSafeAvg * 1.5)) {
                safetyBadge.className = "zcsc0rlnfn yellow";
                safetyBadge.innerHTML = `<i class="fa-solid fa-shield-halved"></i> <span>مستوى أمان متوسط ومقبول</span>`;
            } else {
                safetyBadge.className = "zcsc0rlnfn green";
                safetyBadge.innerHTML = `<i class="fa-solid fa-circle-check"></i> <span>مستوى أمان مرتفع وممتاز</span>`;
            }
        }
    }

    /**

     * تهيئة وحدة دروع التخفي وفترات التبريد

     */
    function initStealthPacingController() {
        buildSecurityPaneLayout();
        appendPacingModalLayout();
        initStealthModalTabs();
        initSlidersBinds();
        initLiveTestTriggers();
        bindPacingTabNav();
        loadActiveStealthUIForm();

        const runSimBtn = document.getElementById('dc1dg75tdv');
        if (runSimBtn) runSimBtn.onclick = runDelaySimulation;

        const simPlatformSelect = document.getElementById('txcj9gg61x');
        if (simPlatformSelect) simPlatformSelect.onchange = runDelaySimulation;
    }

    /**

     * تصدير وحدة تحكم التخفي والتبريد

     */
    global.FritreeStealthUI = {
        init: initStealthPacingController,
        buildPane: buildSecurityPaneLayout,
        loadForm: loadActiveStealthUIForm,
        saveForm: saveActiveStealthUIForm
    };

    global.FritreePacingUI = {
        init: initStealthPacingController,
        openModal: openPacingModal,
        runSimulation: runDelaySimulation,
        saveSettings: saveDelayIntervalSettingsFromModal,
        loadSettings: loadDelayIntervalSettingsIntoModal
    };

    if (typeof document !== 'undefined') {
        if (document.readyState === 'complete' || document.readyState === 'interactive') {
            initStealthPacingController();
        } else {
            document.addEventListener('DOMContentLoaded', initStealthPacingController);
        }
    }

})(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);